From 809bc119caab1c6dc454f976bb984df18d461718 Mon Sep 17 00:00:00 2001 From: jays2kings Date: Wed, 14 May 2014 03:12:15 -0400 Subject: [PATCH] Added Auto Updates using my dropbx --- DS4Tool/DS4Tool.csproj | 34 ++++++++++++++----- DS4Tool/Options.cs | 40 +++++++++++++++++++++++ DS4Tool/Properties/Resources.resx | 9 ----- DS4Tool/Properties/Resources1.Designer.cs | 30 ----------------- DS4Tool/ScpForm.cs | 25 ++++++++++++++ 5 files changed, 91 insertions(+), 47 deletions(-) diff --git a/DS4Tool/DS4Tool.csproj b/DS4Tool/DS4Tool.csproj index 14a07c4..8b4782a 100644 --- a/DS4Tool/DS4Tool.csproj +++ b/DS4Tool/DS4Tool.csproj @@ -11,20 +11,25 @@ DS4Tool v4.0 512 - publish\ + true + C:\Users\Jonathan\Dropbox\Public\DS4 Tool\ true - Disk - false - Foreground - 7 + Web + true + Background + 1 Days - false + true false true - 0 + https://dl.dropboxusercontent.com/u/16364552/DS4%2520Tool/ + 1.0.0.1 + true + publish.htm + 4 1.0.0.%2a - false false + true true @@ -53,6 +58,18 @@ ScpServer.Program + + 5F2A5A97E42A73158D79996F7F3BE738271F5047 + + + DS4Tool_TemporaryKey.pfx + + + true + + + true + @@ -125,6 +142,7 @@ ScpForm.cs + SettingsSingleFileGenerator Settings.Designer.cs diff --git a/DS4Tool/Options.cs b/DS4Tool/Options.cs index 6bdb89a..9234018 100644 --- a/DS4Tool/Options.cs +++ b/DS4Tool/Options.cs @@ -110,6 +110,8 @@ namespace ScpServer if (control is Button) if (!((Button)control).Name.Contains("btn")) buttons.Add((Button)control); + foreach (Button b in buttons) + b.MouseHover += button_MouseHover; if (filename != "" && filename != "New Profile") Global.LoadProfile(device, buttons.ToArray()); ToolTip tp = new ToolTip(); @@ -122,6 +124,44 @@ namespace ScpServer UpdateLists(); } + private void button_MouseHover(object sender, EventArgs e) + { + switch (((Button)sender).Name) + { + #region + case ("bnCross"): lBControls.SelectedIndex = 0; break; + case ("bnCircle"): lBControls.SelectedIndex = 1; break; + case ("bnSquare"): lBControls.SelectedIndex = 2; break; + case ("bnTriangle"): lBControls.SelectedIndex = 3; break; + case ("bnOptions"): lBControls.SelectedIndex = 4; break; + case ("bnShare"): lBControls.SelectedIndex = 5; break; + case ("bnUp"): lBControls.SelectedIndex = 6; break; + case ("bnDown"): lBControls.SelectedIndex = 7; break; + case ("bnLeft"): lBControls.SelectedIndex = 8; break; + case ("bnRight"): lBControls.SelectedIndex = 9; break; + case ("bnPS"): lBControls.SelectedIndex = 10; break; + case ("bnL1"): lBControls.SelectedIndex = 11; break; + case ("bnR1"): lBControls.SelectedIndex = 12; break; + case ("bnL2"): lBControls.SelectedIndex = 13; break; + case ("bnR2"): lBControls.SelectedIndex = 14; break; + case ("bnL3"): lBControls.SelectedIndex = 15; break; + case ("bnR3"): lBControls.SelectedIndex = 16; break; + case ("bnTouchLeft"): lBControls.SelectedIndex = 17; break; + case ("bnTouchRight"): lBControls.SelectedIndex = 18; break; + case ("bnTouchMulti"): lBControls.SelectedIndex = 19; break; + case ("bnTouchUpper"): lBControls.SelectedIndex = 20; break; + case ("bnLSUp"): lBControls.SelectedIndex = 21; break; + case ("bnLSDown"): lBControls.SelectedIndex = 22; break; + case ("bnLSLeft"): lBControls.SelectedIndex = 23; break; + case ("bnLSRight"): lBControls.SelectedIndex = 24; break; + case ("bnRSUp"): lBControls.SelectedIndex = 25; break; + case ("bnRSDown"): lBControls.SelectedIndex = 26; break; + case ("bnRSLeft"): lBControls.SelectedIndex = 27; break; + case ("bnRSRight"): lBControls.SelectedIndex = 28; break; + #endregion + } + } + private void SetDynamicTrackBarValue(TrackBar trackBar, int value) { if (trackBar.Maximum < value) diff --git a/DS4Tool/Properties/Resources.resx b/DS4Tool/Properties/Resources.resx index 1382bb8..5158736 100644 --- a/DS4Tool/Properties/Resources.resx +++ b/DS4Tool/Properties/Resources.resx @@ -132,9 +132,6 @@ ..\Resources\360 fades.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\Touch states2.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\mouse.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -159,12 +156,6 @@ ..\Resources\sticks.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\sticks2.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\Touch.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\UpperTouch.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a diff --git a/DS4Tool/Properties/Resources1.Designer.cs b/DS4Tool/Properties/Resources1.Designer.cs index 380a1ca..9b3b871 100644 --- a/DS4Tool/Properties/Resources1.Designer.cs +++ b/DS4Tool/Properties/Resources1.Designer.cs @@ -169,16 +169,6 @@ namespace ScpServer.Properties { } } - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - public static System.Drawing.Bitmap sticks2 { - get { - object obj = ResourceManager.GetObject("sticks2", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - /// /// Looks up a localized string similar to Stop. /// @@ -188,26 +178,6 @@ namespace ScpServer.Properties { } } - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - public static System.Drawing.Bitmap Touch { - get { - object obj = ResourceManager.GetObject("Touch", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - public static System.Drawing.Bitmap Touch_states2 { - get { - object obj = ResourceManager.GetObject("Touch_states2", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// diff --git a/DS4Tool/ScpForm.cs b/DS4Tool/ScpForm.cs index 910a554..8a88e7c 100644 --- a/DS4Tool/ScpForm.cs +++ b/DS4Tool/ScpForm.cs @@ -6,6 +6,7 @@ using System.Threading; using System.IO; using System.Reflection; using System.Collections.Generic; +using System.Net; namespace ScpServer { public partial class ScpForm : Form @@ -74,6 +75,7 @@ namespace ScpServer protected Button[] dbns; protected Label[] protexts; protected ToolStripMenuItem[] shortcuts; + WebClient wc = new WebClient(); public ScpForm() { InitializeComponent(); @@ -92,7 +94,30 @@ namespace ScpServer (ToolStripMenuItem)notifyIcon1.ContextMenuStrip.Items[3] }; foreach (ToolStripMenuItem t in shortcuts) t.DropDownItemClicked += Profile_Changed_Menu; + Uri url = new Uri("https://dl.dropboxusercontent.com/u/16364552/DS4Tool/newest%20version.txt"); //Sorry other devs, gonna have to find your own server + wc.DownloadFileAsync(url, "version.txt"); + wc.DownloadFileCompleted += Check_Version; + } + double version = 6.5; + private void Check_Version(object sender, System.ComponentModel.AsyncCompletedEventArgs e) + { + double newversion; + if(double.TryParse(File.ReadAllText("version.txt"), out newversion)) + { + if (newversion > version) + if (MessageBox.Show("Download now?", "New Version Available!", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes) + { + System.Diagnostics.Process.Start("Updater.exe"); + this.Close(); + } + else + File.Delete("version.txt"); + else + File.Delete("version.txt"); + } + else + File.Delete("version.txt"); } protected void Form_Load(object sender, EventArgs e)