diff --git a/DS4Control/Control.cs b/DS4Control/Control.cs index cfdb35c..e96c464 100644 --- a/DS4Control/Control.cs +++ b/DS4Control/Control.cs @@ -82,8 +82,7 @@ namespace DS4Control device.Report += this.On_Report; //m_switcher.setMode(Global.getInitialMode(ind)); TouchPadOn(ind, device); - string[] profileA = Global.getAProfile(ind).Split('\\'); - string filename = profileA[profileA.Length - 1]; + string filename = Path.GetFileName(Global.getAProfile(ind)); ind++; if (System.IO.File.Exists(Global.appdatapath + "\\Profiles\\" + filename)) { @@ -92,8 +91,8 @@ namespace DS4Control } else { - LogDebug("Controller " + ind + " is using a profile not found"); - Log.LogToTray("Controller " + ind + " is using a profile not found"); + LogDebug("Controller " + ind + " is not using a profile"); + Log.LogToTray("Controller " + ind + " is not using a profile"); } if (ind >= 4) // out of Xinput devices! break; @@ -173,17 +172,16 @@ namespace DS4Control device.Report += this.On_Report; x360Bus.Plugin(Index); TouchPadOn(Index, device); - string[] profileA = Global.getAProfile(Index).Split('\\'); - string filename = profileA[profileA.Length - 1]; + string filename = Path.GetFileName(Global.getAProfile(Index)); if (System.IO.File.Exists(Global.appdatapath + "\\Profiles\\" + filename)) { - LogDebug("Controller " + (Index+1) + " is using Profile \"" + filename.Substring(0, filename.Length - 4) + "\""); + LogDebug("Controller " + (Index + 1) + " is using Profile \"" + filename.Substring(0, filename.Length - 4) + "\""); Log.LogToTray("Controller " + (Index + 1) + " is using Profile \"" + filename.Substring(0, filename.Length - 4) + "\""); } else { - LogDebug("Controller " + (Index + 1) + " is using a profile not found"); - Log.LogToTray("Controller " + (Index + 1) + " is using a profile not found"); + LogDebug("Controller " + (Index + 1) + " is not using a profile"); + Log.LogToTray("Controller " + (Index + 1) + " is not using a profile"); } break; @@ -404,7 +402,7 @@ namespace DS4Control public virtual void LogDebug(String Data) { - Console.WriteLine(System.DateTime.UtcNow.ToString("o") + "> " + Data); + Console.WriteLine(System.DateTime.Now.ToString("G") + "> " + Data); if (Debug != null) { DebugEventArgs args = new DebugEventArgs(Data); diff --git a/DS4Tool/DS4Tool.csproj b/DS4Tool/DS4Tool.csproj index 3ae7715..3702341 100644 --- a/DS4Tool/DS4Tool.csproj +++ b/DS4Tool/DS4Tool.csproj @@ -9,7 +9,7 @@ Properties ScpServer DS4Tool - v4.0 + v4.5 512 true C:\Users\Jonathan\Dropbox\Public\DS4 Tool\ @@ -31,6 +31,7 @@ false true true + AnyCPU @@ -41,6 +42,7 @@ DEBUG;TRACE prompt 3 + false AnyCPU @@ -50,6 +52,7 @@ TRACE prompt 4 + false Resources\DS4.ico @@ -73,6 +76,9 @@ + + + @@ -116,6 +122,12 @@ ScpForm.cs + + Form + + + WelcomeDialog.cs + Hotkeys.cs @@ -133,6 +145,10 @@ ScpForm.cs + + WelcomeDialog.cs + + SettingsSingleFileGenerator @@ -169,6 +185,7 @@ + diff --git a/DS4Tool/Hotkeys.Designer.cs b/DS4Tool/Hotkeys.Designer.cs index 5fb4b03..089cebf 100644 --- a/DS4Tool/Hotkeys.Designer.cs +++ b/DS4Tool/Hotkeys.Designer.cs @@ -41,10 +41,13 @@ this.label14 = new System.Windows.Forms.Label(); this.label15 = new System.Windows.Forms.Label(); this.linkProfiles = new System.Windows.Forms.LinkLabel(); - this.linkLabel1 = new System.Windows.Forms.LinkLabel(); - this.linkLabel2 = new System.Windows.Forms.LinkLabel(); + this.linkElectro = new System.Windows.Forms.LinkLabel(); + this.linkJays2Kings = new System.Windows.Forms.LinkLabel(); this.label2 = new System.Windows.Forms.Label(); this.lbAbout = new System.Windows.Forms.Label(); + this.linkInhexSTER = new System.Windows.Forms.LinkLabel(); + this.linkJhebbel = new System.Windows.Forms.LinkLabel(); + this.linkUninstall = new System.Windows.Forms.LinkLabel(); this.SuspendLayout(); // // label1 @@ -61,18 +64,18 @@ this.label3.AutoSize = true; this.label3.Location = new System.Drawing.Point(26, 111); this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(108, 13); + this.label3.Size = new System.Drawing.Size(176, 13); this.label3.TabIndex = 2; - this.label3.Text = "Pad click (if tap is on)"; + this.label3.Text = "Tap then hold touchpad (if enabled)"; // // label4 // this.label4.AutoSize = true; this.label4.Location = new System.Drawing.Point(26, 136); this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(166, 13); + this.label4.Size = new System.Drawing.Size(172, 13); this.label4.TabIndex = 3; - this.label4.Text = "Pad click on lower right if enabled"; + this.label4.Text = "Pad click on lower right (if enabled)"; // // label5 // @@ -88,23 +91,23 @@ this.label7.AutoSize = true; this.label7.Location = new System.Drawing.Point(226, 111); this.label7.Name = "label7"; - this.label7.Size = new System.Drawing.Size(50, 13); + this.label7.Size = new System.Drawing.Size(83, 13); this.label7.TabIndex = 6; - this.label7.Text = "Left click"; + this.label7.Text = "Left mouse drag"; // // label8 // this.label8.AutoSize = true; this.label8.Location = new System.Drawing.Point(226, 136); this.label8.Name = "label8"; - this.label8.Size = new System.Drawing.Size(145, 26); + this.label8.Size = new System.Drawing.Size(165, 26); this.label8.TabIndex = 7; - this.label8.Text = "Right click (Best used when \r\nright side is used as a mouse)"; + this.label8.Text = "Right click (Best used when right \r\nside is used as a mouse button)"; // // button1 // this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.button1.Location = new System.Drawing.Point(163, 217); + this.button1.Location = new System.Drawing.Point(163, 275); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(75, 23); this.button1.TabIndex = 8; @@ -161,7 +164,7 @@ // this.linkProfiles.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.linkProfiles.AutoSize = true; - this.linkProfiles.Location = new System.Drawing.Point(292, 222); + this.linkProfiles.Location = new System.Drawing.Point(292, 280); this.linkProfiles.Name = "linkProfiles"; this.linkProfiles.Size = new System.Drawing.Size(94, 13); this.linkProfiles.TabIndex = 17; @@ -169,36 +172,36 @@ this.linkProfiles.Text = "Open Profile folder"; this.linkProfiles.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkProfiles_LinkClicked); // - // linkLabel1 + // linkElectro // - this.linkLabel1.AutoSize = true; - this.linkLabel1.Location = new System.Drawing.Point(215, 194); - this.linkLabel1.Name = "linkLabel1"; - this.linkLabel1.Size = new System.Drawing.Size(143, 13); - this.linkLabel1.TabIndex = 18; - this.linkLabel1.TabStop = true; - this.linkLabel1.Text = "elctrobrains (Branched off of)"; - this.linkLabel1.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel1_LinkClicked); + this.linkElectro.AutoSize = true; + this.linkElectro.Location = new System.Drawing.Point(215, 216); + this.linkElectro.Name = "linkElectro"; + this.linkElectro.Size = new System.Drawing.Size(143, 13); + this.linkElectro.TabIndex = 18; + this.linkElectro.TabStop = true; + this.linkElectro.Text = "elctrobrains (Branched off of)"; + this.linkElectro.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel1_LinkClicked); // - // linkLabel2 + // linkJays2Kings // - this.linkLabel2.AutoSize = true; - this.linkLabel2.Location = new System.Drawing.Point(105, 194); - this.linkLabel2.Name = "linkLabel2"; - this.linkLabel2.Size = new System.Drawing.Size(92, 13); - this.linkLabel2.TabIndex = 18; - this.linkLabel2.TabStop = true; - this.linkLabel2.Text = "Jays2Kings (Mine)"; - this.linkLabel2.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel2_LinkClicked); + this.linkJays2Kings.AutoSize = true; + this.linkJays2Kings.Location = new System.Drawing.Point(95, 216); + this.linkJays2Kings.Name = "linkJays2Kings"; + this.linkJays2Kings.Size = new System.Drawing.Size(60, 13); + this.linkJays2Kings.TabIndex = 18; + this.linkJays2Kings.TabStop = true; + this.linkJays2Kings.Text = "Jays2Kings"; + this.linkJays2Kings.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel2_LinkClicked); // // label2 // this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(26, 194); + this.label2.Location = new System.Drawing.Point(146, 194); this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(72, 13); + this.label2.Size = new System.Drawing.Size(109, 13); this.label2.TabIndex = 13; - this.label2.Text = "Source Code:"; + this.label2.Text = "Credits/Source Code:"; // // lbAbout // @@ -206,17 +209,54 @@ this.lbAbout.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.lbAbout.Location = new System.Drawing.Point(26, 9); this.lbAbout.Name = "lbAbout"; - this.lbAbout.Size = new System.Drawing.Size(201, 13); + this.lbAbout.Size = new System.Drawing.Size(243, 13); this.lbAbout.TabIndex = 0; - this.lbAbout.Text = "DS4Windows - J2K Build (Version "; + this.lbAbout.Text = "DS4Windows - Jays2Kings Build (Version "; + // + // linkInhexSTER + // + this.linkInhexSTER.AutoSize = true; + this.linkInhexSTER.Location = new System.Drawing.Point(38, 243); + this.linkInhexSTER.Name = "linkInhexSTER"; + this.linkInhexSTER.Size = new System.Drawing.Size(159, 13); + this.linkInhexSTER.TabIndex = 18; + this.linkInhexSTER.TabStop = true; + this.linkInhexSTER.Text = "InhexSTER (Starter of DS4Tool)"; + this.linkInhexSTER.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkInhexSTER_LinkClicked); + // + // linkJhebbel + // + this.linkJhebbel.AutoSize = true; + this.linkJhebbel.Location = new System.Drawing.Point(268, 243); + this.linkJhebbel.Name = "linkJhebbel"; + this.linkJhebbel.Size = new System.Drawing.Size(41, 13); + this.linkJhebbel.TabIndex = 18; + this.linkJhebbel.TabStop = true; + this.linkJhebbel.Text = "jhebbel"; + this.linkJhebbel.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkJhebbel_LinkClicked); + // + // linkUninstall + // + this.linkUninstall.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.linkUninstall.AutoSize = true; + this.linkUninstall.Location = new System.Drawing.Point(12, 280); + this.linkUninstall.Name = "linkUninstall"; + this.linkUninstall.Size = new System.Drawing.Size(106, 13); + this.linkUninstall.TabIndex = 17; + this.linkUninstall.TabStop = true; + this.linkUninstall.Text = "Uninstall VBus Driver"; + this.linkUninstall.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkUninstall_LinkClicked); // // Hotkeys // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(399, 244); - this.Controls.Add(this.linkLabel2); - this.Controls.Add(this.linkLabel1); + this.ClientSize = new System.Drawing.Size(399, 302); + this.Controls.Add(this.linkJhebbel); + this.Controls.Add(this.linkInhexSTER); + this.Controls.Add(this.linkJays2Kings); + this.Controls.Add(this.linkElectro); + this.Controls.Add(this.linkUninstall); this.Controls.Add(this.linkProfiles); this.Controls.Add(this.label14); this.Controls.Add(this.label15); @@ -257,9 +297,12 @@ private System.Windows.Forms.Label label14; private System.Windows.Forms.Label label15; private System.Windows.Forms.LinkLabel linkProfiles; - private System.Windows.Forms.LinkLabel linkLabel1; - private System.Windows.Forms.LinkLabel linkLabel2; + private System.Windows.Forms.LinkLabel linkElectro; + private System.Windows.Forms.LinkLabel linkJays2Kings; private System.Windows.Forms.Label label2; private System.Windows.Forms.Label lbAbout; + private System.Windows.Forms.LinkLabel linkInhexSTER; + private System.Windows.Forms.LinkLabel linkJhebbel; + private System.Windows.Forms.LinkLabel linkUninstall; } } \ No newline at end of file diff --git a/DS4Tool/Hotkeys.cs b/DS4Tool/Hotkeys.cs index 60d818e..beec1ba 100644 --- a/DS4Tool/Hotkeys.cs +++ b/DS4Tool/Hotkeys.cs @@ -16,6 +16,10 @@ namespace ScpServer { InitializeComponent(); lbAbout.Text += Global.getVersion().ToString() + ")"; + ToolTip tt = new ToolTip(); + tt.SetToolTip(linkUninstall, "To fully remove DS4Windows, You can delete the profiles by the link to the other side"); + if (!System.IO.Directory.Exists(Global.appdatapath + "\\Virtual Bus Driver")) + linkUninstall.Visible = false; } private void button1_Click(object sender, EventArgs e) @@ -37,5 +41,20 @@ namespace ScpServer { System.Diagnostics.Process.Start("https://code.google.com/r/brianfundakowskifeldman-ds4windows/"); } + + private void linkInhexSTER_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) + { + System.Diagnostics.Process.Start("https://code.google.com/p/ds4-tool/"); + } + + private void linkJhebbel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) + { + System.Diagnostics.Process.Start("https://code.google.com/r/jhebbel-ds4tool/source/browse/"); + } + + private void linkUninstall_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) + { + System.Diagnostics.Process.Start(Global.appdatapath + "\\Virtual Bus Driver\\ScpDriver.exe"); + } } } diff --git a/DS4Tool/Properties/Resources.resx b/DS4Tool/Properties/Resources.resx index 5158736..ffca937 100644 --- a/DS4Tool/Properties/Resources.resx +++ b/DS4Tool/Properties/Resources.resx @@ -159,4 +159,7 @@ ..\Resources\UpperTouch.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\Pairmode.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/DS4Tool/Properties/Resources1.Designer.cs b/DS4Tool/Properties/Resources1.Designer.cs index 9b3b871..a6eb09f 100644 --- a/DS4Tool/Properties/Resources1.Designer.cs +++ b/DS4Tool/Properties/Resources1.Designer.cs @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.34014 +// Runtime Version:4.0.30319.34209 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -120,6 +120,16 @@ namespace ScpServer.Properties { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + public static System.Drawing.Bitmap Pairmode { + get { + object obj = ResourceManager.GetObject("Pairmode", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// diff --git a/DS4Tool/Properties/Settings.Designer.cs b/DS4Tool/Properties/Settings.Designer.cs index 8eec031..6679ee6 100644 --- a/DS4Tool/Properties/Settings.Designer.cs +++ b/DS4Tool/Properties/Settings.Designer.cs @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.34011 +// Runtime Version:4.0.30319.34209 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -12,7 +12,7 @@ namespace ScpServer.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")] internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); diff --git a/DS4Tool/Resources/Pairmode.png b/DS4Tool/Resources/Pairmode.png new file mode 100644 index 0000000..2f97754 Binary files /dev/null and b/DS4Tool/Resources/Pairmode.png differ diff --git a/DS4Tool/ScpForm.cs b/DS4Tool/ScpForm.cs index ca0eb00..5748c1f 100644 --- a/DS4Tool/ScpForm.cs +++ b/DS4Tool/ScpForm.cs @@ -7,13 +7,14 @@ using System.IO; using System.Reflection; using System.Collections.Generic; using System.Net; +using System.Management; namespace ScpServer { public partial class ScpForm : Form { private DS4Control.Control rootHub; delegate void LogDebugDelegate(DateTime Time, String Data); - double version = 6.95; + double version = 7.011; protected Label[] Pads; protected ComboBox[] cbs; @@ -40,11 +41,41 @@ namespace ScpServer (ToolStripMenuItem)notifyIcon1.ContextMenuStrip.Items[3] }; foreach (ToolStripMenuItem t in shortcuts) t.DropDownItemClicked += Profile_Changed_Menu; + CheckDrivers(); Uri url = new Uri("https://dl.dropboxusercontent.com/u/16364552/DS4Tool/newest%20version.txt"); //Sorry other devs, gonna have to find your own server Directory.CreateDirectory(Global.appdatapath); wc.DownloadFileAsync(url, Global.appdatapath + "\\version.txt"); wc.DownloadFileCompleted += Check_Version; - + + if (!File.Exists("Updater.exe")) + { + Uri url2 = new Uri("https://dl.dropboxusercontent.com/u/16364552/DS4Tool/Updater.exe"); + WebClient wc2 = new WebClient(); + wc2.DownloadFileAsync(url2, "Updater.exe"); + } + } + + private void CheckDrivers() + { + bool deriverinstalled = false; + ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT * FROM Win32_PnPSignedDriver"); + foreach (ManagementObject obj in searcher.Get()) + { + try + { + if (obj.GetPropertyValue("DeviceName").ToString() == "Scp Virtual Bus Driver") + { + deriverinstalled = true; + break; + } + } + catch { } + } + if (!deriverinstalled) + { + WelcomeDialog wd = new WelcomeDialog(); + wd.ShowDialog(); + } } private void Check_Version(object sender, System.ComponentModel.AsyncCompletedEventArgs e) @@ -116,23 +147,20 @@ namespace ScpServer { try { - string[] profiles = System.IO.Directory.GetFiles(Global.appdatapath + @"\Profiles\"); - int cutoff = (Global.appdatapath + @"\Profiles\").Length; + string[] profiles = Directory.GetFiles(Global.appdatapath + @"\Profiles\"); List profilenames = new List(); foreach (String s in profiles) if (s.EndsWith(".xml")) - profilenames.Add(s.Substring(cutoff, s.Length - 4 - cutoff)); + profilenames.Add(Path.GetFileNameWithoutExtension(s)); for (int i = 0; i < 4; i++) { cbs[i].Items.Clear(); shortcuts[i].DropDownItems.Clear(); - string[] profileA = Global.getAProfile(i).Split('\\'); - string filename = profileA[profileA.Length - 1]; cbs[i].Items.AddRange(profilenames.ToArray()); foreach (string s in profilenames) - shortcuts[i].DropDownItems.Add(s); + shortcuts[i].DropDownItems.Add(Path.GetFileNameWithoutExtension(s)); for (int j = 0; j < cbs[i].Items.Count; j++) - if (cbs[i].Items[j] + ".xml" == filename) + if (cbs[i].Items[j].ToString() == Path.GetFileNameWithoutExtension(Global.getAProfile(i))) { cbs[i].SelectedIndex = j; ((ToolStripMenuItem)shortcuts[i].DropDownItems[j]).Checked = true; @@ -182,7 +210,7 @@ namespace ScpServer } else { - String Posted = Time.ToString("O"); + String Posted = Time.ToString("G"); lvDebug.Items.Add(new ListViewItem(new String[] { Posted, Data })).EnsureVisible(); @@ -206,22 +234,25 @@ namespace ScpServer this.Hide(); this.ShowInTaskbar = false; } + else if (FormWindowState.Normal == this.WindowState) { notifyIcon1.Visible = false; this.Show(); this.ShowInTaskbar = true; } + //Added last message alternative + if (this.Height > 220) lbLastMessage.Visible = false; else lbLastMessage.Visible = true; - - for (int i = 0; i < 4; i++) - if (this.Width > 665) - protexts[i].Visible = true; - else - protexts[i].Visible = false; + if (protexts != null) + for (int i = 0; i < 4; i++) + if (this.Width > 665) + protexts[i].Visible = true; + else + protexts[i].Visible = false; } protected void btnStartStop_Click(object sender, EventArgs e) diff --git a/DS4Tool/WelcomeDialog.Designer.cs b/DS4Tool/WelcomeDialog.Designer.cs new file mode 100644 index 0000000..cc3b1a7 --- /dev/null +++ b/DS4Tool/WelcomeDialog.Designer.cs @@ -0,0 +1,181 @@ +namespace ScpServer +{ + partial class WelcomeDialog + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.bnFinish = new System.Windows.Forms.Button(); + this.bnStep1 = new System.Windows.Forms.Button(); + this.button2 = new System.Windows.Forms.Button(); + this.pictureBox1 = new System.Windows.Forms.PictureBox(); + this.labelBluetooth = new System.Windows.Forms.Label(); + this.labelUSB = new System.Windows.Forms.Label(); + this.labelBluetooth2 = new System.Windows.Forms.Label(); + this.linkBluetoothSettings = new System.Windows.Forms.LinkLabel(); + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); + this.SuspendLayout(); + // + // bnFinish + // + this.bnFinish.Location = new System.Drawing.Point(123, 388); + this.bnFinish.Name = "bnFinish"; + this.bnFinish.Size = new System.Drawing.Size(75, 23); + this.bnFinish.TabIndex = 0; + this.bnFinish.Text = "Finish"; + this.bnFinish.UseVisualStyleBackColor = true; + this.bnFinish.Click += new System.EventHandler(this.bnFinish_Click); + // + // bnStep1 + // + this.bnStep1.Location = new System.Drawing.Point(82, 8); + this.bnStep1.Name = "bnStep1"; + this.bnStep1.Size = new System.Drawing.Size(155, 23); + this.bnStep1.TabIndex = 1; + this.bnStep1.Text = "Step 1: Install the DS4 Driver"; + this.bnStep1.UseVisualStyleBackColor = true; + this.bnStep1.Click += new System.EventHandler(this.bnStep1_Click); + // + // button2 + // + this.button2.Location = new System.Drawing.Point(29, 57); + this.button2.Name = "button2"; + this.button2.Size = new System.Drawing.Size(259, 23); + this.button2.TabIndex = 1; + this.button2.Text = "Step 2: If on Windows 7 or below, Install 360 Drvier"; + this.button2.UseVisualStyleBackColor = true; + this.button2.Click += new System.EventHandler(this.button2_Click); + // + // pictureBox1 + // + this.pictureBox1.Image = global::ScpServer.Properties.Resources.Pairmode; + this.pictureBox1.InitialImage = null; + this.pictureBox1.Location = new System.Drawing.Point(36, 197); + this.pictureBox1.Name = "pictureBox1"; + this.pictureBox1.Size = new System.Drawing.Size(245, 132); + this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; + this.pictureBox1.TabIndex = 2; + this.pictureBox1.TabStop = false; + // + // labelBluetooth + // + this.labelBluetooth.Location = new System.Drawing.Point(1, 155); + this.labelBluetooth.Name = "labelBluetooth"; + this.labelBluetooth.Size = new System.Drawing.Size(312, 39); + this.labelBluetooth.TabIndex = 3; + this.labelBluetooth.Text = "To set up bluetooth (optional):\r\nHold the PS Button and Share for 3 seconds\r\nThe " + + "lightbar will begin to double flash"; + this.labelBluetooth.TextAlign = System.Drawing.ContentAlignment.TopCenter; + // + // labelUSB + // + this.labelUSB.Location = new System.Drawing.Point(0, 106); + this.labelUSB.Name = "labelUSB"; + this.labelUSB.Size = new System.Drawing.Size(313, 39); + this.labelUSB.TabIndex = 3; + this.labelUSB.Text = "Step 3: Connecting the DualShock 4 controller\r\nTo set up wired/usb:\r\nSimply plug " + + "a mirco usb into your PC and DualShock 4"; + this.labelUSB.TextAlign = System.Drawing.ContentAlignment.TopCenter; + // + // labelBluetooth2 + // + this.labelBluetooth2.Location = new System.Drawing.Point(1, 332); + this.labelBluetooth2.Name = "labelBluetooth2"; + this.labelBluetooth2.Size = new System.Drawing.Size(312, 64); + this.labelBluetooth2.TabIndex = 3; + this.labelBluetooth2.Text = "Once flashing go to your Bluetooth Settings\r\nand Connect to \"Wireless Controller\"" + + "\r\n\r\nOnce paired, you\'re good to go. Have fun!"; + this.labelBluetooth2.TextAlign = System.Drawing.ContentAlignment.TopCenter; + // + // linkBluetoothSettings + // + this.linkBluetoothSettings.AutoSize = true; + this.linkBluetoothSettings.Location = new System.Drawing.Point(169, 332); + this.linkBluetoothSettings.Name = "linkBluetoothSettings"; + this.linkBluetoothSettings.Size = new System.Drawing.Size(93, 13); + this.linkBluetoothSettings.TabIndex = 4; + this.linkBluetoothSettings.TabStop = true; + this.linkBluetoothSettings.Text = "Bluetooth Settings"; + this.linkBluetoothSettings.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkBluetoothSettings_LinkClicked); + // + // label1 + // + this.label1.Location = new System.Drawing.Point(1, 32); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(314, 22); + this.label1.TabIndex = 3; + this.label1.Text = "Make sure to check Force Install"; + this.label1.TextAlign = System.Drawing.ContentAlignment.TopCenter; + // + // label2 + // + this.label2.Location = new System.Drawing.Point(0, 82); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(315, 22); + this.label2.TabIndex = 3; + this.label2.Text = "You do not have to do this if you have before"; + this.label2.TextAlign = System.Drawing.ContentAlignment.TopCenter; + // + // WelcomeDialog + // + this.AcceptButton = this.bnFinish; + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(315, 422); + this.Controls.Add(this.linkBluetoothSettings); + this.Controls.Add(this.labelBluetooth); + this.Controls.Add(this.pictureBox1); + this.Controls.Add(this.button2); + this.Controls.Add(this.bnStep1); + this.Controls.Add(this.bnFinish); + this.Controls.Add(this.label2); + this.Controls.Add(this.label1); + this.Controls.Add(this.labelUSB); + this.Controls.Add(this.labelBluetooth2); + this.Name = "WelcomeDialog"; + this.Text = "Welcome to DS4Windows"; + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Button bnFinish; + private System.Windows.Forms.Button bnStep1; + private System.Windows.Forms.Button button2; + private System.Windows.Forms.PictureBox pictureBox1; + private System.Windows.Forms.Label labelBluetooth; + private System.Windows.Forms.Label labelUSB; + private System.Windows.Forms.Label labelBluetooth2; + private System.Windows.Forms.LinkLabel linkBluetoothSettings; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label2; + } +} \ No newline at end of file diff --git a/DS4Tool/WelcomeDialog.cs b/DS4Tool/WelcomeDialog.cs new file mode 100644 index 0000000..a0c0246 --- /dev/null +++ b/DS4Tool/WelcomeDialog.cs @@ -0,0 +1,139 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Windows.Forms; +using System.Net; +using DS4Control; +using System.IO; +using System.IO.Compression; +using System.Diagnostics; +using System.Runtime.InteropServices; +using System.Security.Principal; +using System.Security.Permissions; +using System.Reflection; + +namespace ScpServer +{ + public partial class WelcomeDialog : Form + { + public WelcomeDialog() + { + InitializeComponent(); + this.Icon = Properties.Resources.DS4; + if (!File.Exists("Updater.exe")) + { + Uri url2 = new Uri("https://dl.dropboxusercontent.com/u/16364552/DS4Tool/Updater.exe"); + WebClient wc2 = new WebClient(); + wc2.DownloadFileAsync(url2, "Updater.exe"); + } + } + + private void bnFinish_Click(object sender, EventArgs e) + { + this.Close(); + } + + private void linkBluetoothSettings_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) + { + Process.Start("control", "bthprops.cpl"); + } + + private void bnStep1_Click(object sender, EventArgs e) + { + WebClient wb = new WebClient(); + if (bnStep1.Text == "Step 1: Install the DS4 Driver") + { + wb.DownloadFileAsync(new Uri("https://docs.google.com/uc?authuser=0&id=0BwPaAe9M8N9mYVdPakJ6OXpMUlU&export=download"), Global.appdatapath + "\\VBus.zip"); + wb.DownloadProgressChanged += wb_DownloadProgressChanged; + wb.DownloadFileCompleted += wb_DownloadFileCompleted; + } + } + + private void wb_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e) + { + bnStep1.Text = "Downloading " + e.ProgressPercentage + "%"; + } + + string exepath = Directory.GetParent(Assembly.GetExecutingAssembly().Location).FullName; + private void wb_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e) + { + if (!exepath.StartsWith("C:\\Program Files") && !exepath.StartsWith("C:\\Windows")) + { + bnStep1.Text = "Opening Installer"; + try + { + File.Delete(exepath + "\\ScpDriver.exe"); + File.Delete(exepath + "\\ScpDriver.log"); + Directory.Delete(exepath + "\\System", true); + Directory.Delete(exepath + "\\DIFxAPI", true); + } + catch { } + Directory.CreateDirectory(Global.appdatapath + "\\Virtual Bus Driver"); + try { ZipFile.ExtractToDirectory(Global.appdatapath + "\\VBus.zip", Global.appdatapath + "\\Virtual Bus Driver"); } //Saved so the user can uninstall later + catch { } + try { ZipFile.ExtractToDirectory(Global.appdatapath + "\\VBus.zip", exepath); } + //Made here as starting the scpdriver.exe via process.start, the program looks for file from where it was called, not where the exe is + catch { } + Process.Start(exepath + "\\ScpDriver.exe"); + Timer timer = new Timer(); + timer.Start(); + timer.Tick += timer_Tick; + } + else + { + bnStep1.Text = "Please Open ScpDriver.exe"; + Directory.CreateDirectory(Global.appdatapath + "\\Virtual Bus Driver"); + try { ZipFile.ExtractToDirectory(Global.appdatapath + "\\VBus.zip", Global.appdatapath + "\\Virtual Bus Driver"); } + catch { } + Process.Start(Global.appdatapath + "\\Virtual Bus Driver"); + Timer timer = new Timer(); + timer.Start(); + timer.Tick += timer_Tick; + } + } + + bool running = false; + private void timer_Tick(object sender, EventArgs e) + { + Process[] processes = Process.GetProcessesByName("ScpDriver"); + if (!exepath.StartsWith("C:\\Program Files") && !exepath.StartsWith("C:\\Windows")) + { + if (processes.Length < 1) + { + bnStep1.Text = "Install Complete"; + + try + { + File.Delete(exepath + "\\ScpDriver.exe"); + File.Delete(exepath + "\\ScpDriver.log"); + Directory.Delete(exepath + "\\System", true); + Directory.Delete(exepath + "\\DIFxAPI", true); + } + catch { } + File.Delete(Global.appdatapath + "\\VBus.zip"); + } + } + else + { + if (processes.Length > 0) + running = true; + if (running) + if (processes.Length < 1) + { + bnStep1.Text = "Install Complete"; + File.Delete(Global.appdatapath + "\\VBus.zip"); + } + } + } + + + private void button2_Click(object sender, EventArgs e) + { + Process.Start("http://www.microsoft.com/hardware/en-us/d/xbox-360-controller-for-windows"); + } + } +} diff --git a/DS4Tool/WelcomeDialog.resx b/DS4Tool/WelcomeDialog.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/DS4Tool/WelcomeDialog.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/DS4Tool/app.config b/DS4Tool/app.config index e365603..c5e1dae 100644 --- a/DS4Tool/app.config +++ b/DS4Tool/app.config @@ -1,3 +1,3 @@ - +