diff --git a/ShiftOS.WinForms/Applications/ShiftSweeper.Designer.cs b/ShiftOS.WinForms/Applications/ShiftSweeper.Designer.cs index 55844f1..8782260 100644 --- a/ShiftOS.WinForms/Applications/ShiftSweeper.Designer.cs +++ b/ShiftOS.WinForms/Applications/ShiftSweeper.Designer.cs @@ -299,6 +299,7 @@ namespace ShiftOS.WinForms.Applications this.Controls.Add(this.pictureBox1); this.Name = "ShiftSweeper"; this.Size = new System.Drawing.Size(596, 426); + this.Load += new System.EventHandler(this.ShiftSweeper_Load); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.flagButton)).EndInit(); this.ResumeLayout(false); diff --git a/ShiftOS.WinForms/Applications/ShiftSweeper.cs b/ShiftOS.WinForms/Applications/ShiftSweeper.cs index aaeed3f..d8de58e 100644 --- a/ShiftOS.WinForms/Applications/ShiftSweeper.cs +++ b/ShiftOS.WinForms/Applications/ShiftSweeper.cs @@ -205,8 +205,9 @@ namespace ShiftOS.WinForms.Applications return bttn; } - private void bttnOnclick(object sender, EventArgs e) + private void bttnOnclick(object sender, EventArgs ee) { + MouseEventArgs e = (MouseEventArgs)ee; if (!ticking.Enabled) return; PictureBox bttnClick = sender as PictureBox; @@ -218,8 +219,9 @@ namespace ShiftOS.WinForms.Applications int x = System.Convert.ToInt32(split[0]); int y = System.Convert.ToInt32(split[1]); + - if (!flagtime) + if (!flagtime && e.Button == MouseButtons.Left) { if (minemap[x, y] == -1) { @@ -249,7 +251,7 @@ namespace ShiftOS.WinForms.Applications else if (minemap[x, y] < -1) return; else removeBlank(x, y); } - else + else if(flagtime || e.Button == MouseButtons.Right) { if (!bttnClick.Enabled) return; @@ -364,5 +366,9 @@ namespace ShiftOS.WinForms.Applications flagtime = true; } } + + private void ShiftSweeper_Load(object sender, EventArgs e) { + + } } } diff --git a/ShiftOS.WinForms/ShiftOSAudioProvider.cs b/ShiftOS.WinForms/ShiftOSAudioProvider.cs index 27c0e5f..fccc76a 100644 --- a/ShiftOS.WinForms/ShiftOSAudioProvider.cs +++ b/ShiftOS.WinForms/ShiftOSAudioProvider.cs @@ -39,8 +39,13 @@ namespace ShiftOS.WinForms { get { - var wc = new System.Net.WebClient(); - return JsonConvert.DeserializeObject>(wc.DownloadString("http://getshiftos.ml/api.php?q=soundtrack")).Count; + System.Net.WebClient wc = new System.Net.WebClient(); + try { + string result = wc.DownloadString("http://getshiftos.ml/api.php?q=soundtrack"); + return JsonConvert.DeserializeObject>(result).Count; + } catch { + return JsonConvert.DeserializeObject>("[]").Count; + } } } @@ -73,10 +78,17 @@ namespace ShiftOS.WinForms public byte[] GetTrack(int index) { - var wc = new System.Net.WebClient(); - var st = JsonConvert.DeserializeObject>(wc.DownloadString("http://getshiftos.ml/api.php?q=soundtrack")); + System.Net.WebClient wc = new System.Net.WebClient(); - return wc.DownloadData(st[index]); + try { + string result = wc.DownloadString("http://getshiftos.ml/api.php?q=soundtrack"); + + var st = JsonConvert.DeserializeObject>(result); + + return wc.DownloadData(st[index]); + } catch { + return null; + } } }