Fix at Windows startup showing Welcome window

Startup now uses a shortcut in the start menu startup folder instead of registry. Registry key now removed
Fix duplicates of programs showing up when batch adding programs
Clicking the X button in the main windows will close profile settings instead of the whole program if profile settings are open. Otherwise the program shuts down regularly
UI Fixes
This commit is contained in:
jays2kings 2014-06-13 15:52:25 -04:00
parent 6e6c627556
commit 03b4c66ff3
8 changed files with 305 additions and 144 deletions

View File

@ -98,8 +98,8 @@ namespace DS4Control
{
try
{
File.WriteAllText("test.txt", "test");
File.Delete("test.txt");
File.WriteAllText(exepath + "\\test.txt", "test");
File.Delete(exepath + "\\test.txt");
return false;
}
catch (UnauthorizedAccessException)
@ -508,14 +508,6 @@ namespace DS4Control
return c1;
}
/*public static DS4Color getTransitionedColor(DS4Color lowcolor, DS4Color maxcolor, uint ratio)
{
Color cs = Color.FromArgb(lowcolor.red, lowcolor.green, lowcolor.blue);
Color cs2 = Color.FromArgb(maxcolor.red, maxcolor.green, maxcolor.blue);
Color csR = applyRatio(cs, cs2, ratio);
DS4Color dr = new DS4Color { red = csR.R, green = csR.G, blue = csR.B };
return dr;
}*/
private static Color applyRatio(Color c1, Color c2, uint r)
{
float ratio = r / 100f;

View File

@ -240,9 +240,9 @@
this.label15.AutoSize = true;
this.label15.Location = new System.Drawing.Point(3, 108);
this.label15.Name = "label15";
this.label15.Size = new System.Drawing.Size(103, 13);
this.label15.Size = new System.Drawing.Size(176, 13);
this.label15.TabIndex = 15;
this.label15.Text = "PS Button + Options";
this.label15.Text = "PS + Options or hold PS for 10 secs";
//
// label4
//

File diff suppressed because it is too large Load Diff

View File

@ -17,6 +17,7 @@ namespace ScpServer
public partial class SaveWhere : Form
{
private bool multisaves;
string exepath = Directory.GetParent(Assembly.GetExecutingAssembly().Location).FullName;
public SaveWhere(bool multisavespots)
{
InitializeComponent();
@ -49,9 +50,9 @@ namespace ScpServer
if (multisaves && !cBDeleteOther.Checked)
try
{
Directory.Delete("Profiles", true);
File.Delete("Profiles.xml");
File.Delete("Auto Profiles.xml");
Directory.Delete(exepath + "\\Profiles", true);
File.Delete(exepath + "\\Profiles.xml");
File.Delete(exepath + "\\Auto Profiles.xml");
}
catch (UnauthorizedAccessException) { MessageBox.Show("Cannot Delete old settings, please manaully delete", "DS4Windows"); }
else if (!multisaves)

View File

@ -86,7 +86,7 @@
this.tSOptions = new System.Windows.Forms.ToolStrip();
this.toolStripLabel1 = new System.Windows.Forms.ToolStripLabel();
this.tSTBProfile = new System.Windows.Forms.ToolStripTextBox();
this.toolStripButton1 = new System.Windows.Forms.ToolStripButton();
this.tSBSaveProfile = new System.Windows.Forms.ToolStripButton();
this.tSBCancel = new System.Windows.Forms.ToolStripButton();
this.toolStrip1 = new System.Windows.Forms.ToolStrip();
this.tsBNewProfle = new System.Windows.Forms.ToolStripButton();
@ -121,7 +121,6 @@
this.lLBUpdate = new System.Windows.Forms.LinkLabel();
this.linkUninstall = new System.Windows.Forms.LinkLabel();
this.lLSetup = new System.Windows.Forms.LinkLabel();
this.lLAppDataDelete = new System.Windows.Forms.LinkLabel();
this.saveProfiles = new System.Windows.Forms.SaveFileDialog();
this.pnlButton.SuspendLayout();
this.cMTaskbar.SuspendLayout();
@ -410,7 +409,7 @@
this.tLPControllers.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 23.34039F));
this.tLPControllers.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25.31077F));
this.tLPControllers.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 117F));
this.tLPControllers.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 45F));
this.tLPControllers.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 48F));
this.tLPControllers.Controls.Add(this.pBStatus1, 1, 1);
this.tLPControllers.Controls.Add(this.lbPad1, 0, 1);
this.tLPControllers.Controls.Add(this.lbPad2, 0, 2);
@ -452,7 +451,7 @@
this.pBStatus1.Anchor = System.Windows.Forms.AnchorStyles.None;
this.pBStatus1.Image = ((System.Drawing.Image)(resources.GetObject("pBStatus1.Image")));
this.pBStatus1.InitialImage = global::ScpServer.Properties.Resources.BT;
this.pBStatus1.Location = new System.Drawing.Point(373, 19);
this.pBStatus1.Location = new System.Drawing.Point(370, 19);
this.pBStatus1.Name = "pBStatus1";
this.pBStatus1.Size = new System.Drawing.Size(39, 20);
this.pBStatus1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
@ -484,7 +483,7 @@
// bnEditC3
//
this.bnEditC3.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.bnEditC3.Location = new System.Drawing.Point(742, 76);
this.bnEditC3.Location = new System.Drawing.Point(739, 76);
this.bnEditC3.Name = "bnEditC3";
this.bnEditC3.Size = new System.Drawing.Size(40, 23);
this.bnEditC3.TabIndex = 43;
@ -496,7 +495,7 @@
// bnEditC4
//
this.bnEditC4.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.bnEditC4.Location = new System.Drawing.Point(742, 105);
this.bnEditC4.Location = new System.Drawing.Point(739, 105);
this.bnEditC4.Name = "bnEditC4";
this.bnEditC4.Size = new System.Drawing.Size(40, 23);
this.bnEditC4.TabIndex = 43;
@ -532,7 +531,7 @@
this.cBController1.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.cBController1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cBController1.FormattingEnabled = true;
this.cBController1.Location = new System.Drawing.Point(625, 19);
this.cBController1.Location = new System.Drawing.Point(622, 19);
this.cBController1.Name = "cBController1";
this.cBController1.Size = new System.Drawing.Size(111, 21);
this.cBController1.TabIndex = 42;
@ -542,7 +541,7 @@
// bnEditC2
//
this.bnEditC2.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.bnEditC2.Location = new System.Drawing.Point(742, 47);
this.bnEditC2.Location = new System.Drawing.Point(739, 47);
this.bnEditC2.Name = "bnEditC2";
this.bnEditC2.Size = new System.Drawing.Size(40, 23);
this.bnEditC2.TabIndex = 43;
@ -556,7 +555,7 @@
this.cBController2.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.cBController2.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cBController2.FormattingEnabled = true;
this.cBController2.Location = new System.Drawing.Point(625, 48);
this.cBController2.Location = new System.Drawing.Point(622, 48);
this.cBController2.Name = "cBController2";
this.cBController2.Size = new System.Drawing.Size(111, 21);
this.cBController2.TabIndex = 42;
@ -568,7 +567,7 @@
this.cBController3.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.cBController3.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cBController3.FormattingEnabled = true;
this.cBController3.Location = new System.Drawing.Point(625, 77);
this.cBController3.Location = new System.Drawing.Point(622, 77);
this.cBController3.Name = "cBController3";
this.cBController3.Size = new System.Drawing.Size(111, 21);
this.cBController3.TabIndex = 42;
@ -578,7 +577,7 @@
// bnEditC1
//
this.bnEditC1.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.bnEditC1.Location = new System.Drawing.Point(742, 18);
this.bnEditC1.Location = new System.Drawing.Point(739, 18);
this.bnEditC1.Name = "bnEditC1";
this.bnEditC1.Size = new System.Drawing.Size(40, 23);
this.bnEditC1.TabIndex = 43;
@ -592,7 +591,7 @@
this.cBController4.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.cBController4.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cBController4.FormattingEnabled = true;
this.cBController4.Location = new System.Drawing.Point(625, 106);
this.cBController4.Location = new System.Drawing.Point(622, 106);
this.cBController4.Name = "cBController4";
this.cBController4.Size = new System.Drawing.Size(111, 21);
this.cBController4.TabIndex = 42;
@ -604,7 +603,7 @@
this.lBSelectedProfile.Anchor = System.Windows.Forms.AnchorStyles.None;
this.lBSelectedProfile.AutoSize = true;
this.lBSelectedProfile.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lBSelectedProfile.Location = new System.Drawing.Point(626, 0);
this.lBSelectedProfile.Location = new System.Drawing.Point(623, 0);
this.lBSelectedProfile.Name = "lBSelectedProfile";
this.lBSelectedProfile.Size = new System.Drawing.Size(109, 15);
this.lBSelectedProfile.TabIndex = 45;
@ -626,7 +625,7 @@
this.lBStatus.Anchor = System.Windows.Forms.AnchorStyles.None;
this.lBStatus.AutoSize = true;
this.lBStatus.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lBStatus.Location = new System.Drawing.Point(369, 0);
this.lBStatus.Location = new System.Drawing.Point(366, 0);
this.lBStatus.Name = "lBStatus";
this.lBStatus.Size = new System.Drawing.Size(47, 15);
this.lBStatus.TabIndex = 45;
@ -637,7 +636,7 @@
this.lBBattery.Anchor = System.Windows.Forms.AnchorStyles.None;
this.lBBattery.AutoSize = true;
this.lBBattery.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lBBattery.Location = new System.Drawing.Point(518, 0);
this.lBBattery.Location = new System.Drawing.Point(515, 0);
this.lBBattery.Name = "lBBattery";
this.lBBattery.Size = new System.Drawing.Size(51, 15);
this.lBBattery.TabIndex = 45;
@ -648,7 +647,7 @@
this.lBBatt1.Anchor = System.Windows.Forms.AnchorStyles.None;
this.lBBatt1.AutoSize = true;
this.lBBatt1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lBBatt1.Location = new System.Drawing.Point(524, 22);
this.lBBatt1.Location = new System.Drawing.Point(521, 22);
this.lBBatt1.Name = "lBBatt1";
this.lBBatt1.Size = new System.Drawing.Size(39, 15);
this.lBBatt1.TabIndex = 44;
@ -659,7 +658,7 @@
this.lBBatt2.Anchor = System.Windows.Forms.AnchorStyles.None;
this.lBBatt2.AutoSize = true;
this.lBBatt2.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lBBatt2.Location = new System.Drawing.Point(524, 51);
this.lBBatt2.Location = new System.Drawing.Point(521, 51);
this.lBBatt2.Name = "lBBatt2";
this.lBBatt2.Size = new System.Drawing.Size(39, 15);
this.lBBatt2.TabIndex = 44;
@ -670,7 +669,7 @@
this.lBBatt3.Anchor = System.Windows.Forms.AnchorStyles.None;
this.lBBatt3.AutoSize = true;
this.lBBatt3.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lBBatt3.Location = new System.Drawing.Point(524, 80);
this.lBBatt3.Location = new System.Drawing.Point(521, 80);
this.lBBatt3.Name = "lBBatt3";
this.lBBatt3.Size = new System.Drawing.Size(39, 15);
this.lBBatt3.TabIndex = 44;
@ -681,7 +680,7 @@
this.lBBatt4.Anchor = System.Windows.Forms.AnchorStyles.None;
this.lBBatt4.AutoSize = true;
this.lBBatt4.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lBBatt4.Location = new System.Drawing.Point(524, 109);
this.lBBatt4.Location = new System.Drawing.Point(521, 109);
this.lBBatt4.Name = "lBBatt4";
this.lBBatt4.Size = new System.Drawing.Size(39, 15);
this.lBBatt4.TabIndex = 44;
@ -692,7 +691,7 @@
this.pBStatus2.Anchor = System.Windows.Forms.AnchorStyles.None;
this.pBStatus2.Image = ((System.Drawing.Image)(resources.GetObject("pBStatus2.Image")));
this.pBStatus2.InitialImage = global::ScpServer.Properties.Resources.BT;
this.pBStatus2.Location = new System.Drawing.Point(373, 48);
this.pBStatus2.Location = new System.Drawing.Point(370, 48);
this.pBStatus2.Name = "pBStatus2";
this.pBStatus2.Size = new System.Drawing.Size(39, 20);
this.pBStatus2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
@ -704,7 +703,7 @@
this.pBStatus3.Anchor = System.Windows.Forms.AnchorStyles.None;
this.pBStatus3.Image = ((System.Drawing.Image)(resources.GetObject("pBStatus3.Image")));
this.pBStatus3.InitialImage = global::ScpServer.Properties.Resources.BT;
this.pBStatus3.Location = new System.Drawing.Point(373, 77);
this.pBStatus3.Location = new System.Drawing.Point(370, 77);
this.pBStatus3.Name = "pBStatus3";
this.pBStatus3.Size = new System.Drawing.Size(39, 20);
this.pBStatus3.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
@ -716,7 +715,7 @@
this.pBStatus4.Anchor = System.Windows.Forms.AnchorStyles.None;
this.pBStatus4.Image = ((System.Drawing.Image)(resources.GetObject("pBStatus4.Image")));
this.pBStatus4.InitialImage = global::ScpServer.Properties.Resources.BT;
this.pBStatus4.Location = new System.Drawing.Point(373, 106);
this.pBStatus4.Location = new System.Drawing.Point(370, 106);
this.pBStatus4.Name = "pBStatus4";
this.pBStatus4.Size = new System.Drawing.Size(39, 20);
this.pBStatus4.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
@ -742,7 +741,7 @@
this.tSOptions.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripLabel1,
this.tSTBProfile,
this.toolStripButton1,
this.tSBSaveProfile,
this.tSBCancel});
this.tSOptions.Location = new System.Drawing.Point(3, 28);
this.tSOptions.Name = "tSOptions";
@ -766,15 +765,15 @@
this.tSTBProfile.Leave += new System.EventHandler(this.tBProfile_Leave);
this.tSTBProfile.TextChanged += new System.EventHandler(this.tBProfile_TextChanged);
//
// toolStripButton1
// tSBSaveProfile
//
this.toolStripButton1.AutoToolTip = false;
this.toolStripButton1.Image = global::ScpServer.Properties.Resources.saveprofile;
this.toolStripButton1.ImageTransparentColor = System.Drawing.Color.Magenta;
this.toolStripButton1.Name = "toolStripButton1";
this.toolStripButton1.Size = new System.Drawing.Size(88, 22);
this.toolStripButton1.Text = "Save Profile";
this.toolStripButton1.Click += new System.EventHandler(this.toolStripButton1_Click);
this.tSBSaveProfile.AutoToolTip = false;
this.tSBSaveProfile.Image = global::ScpServer.Properties.Resources.saveprofile;
this.tSBSaveProfile.ImageTransparentColor = System.Drawing.Color.Magenta;
this.tSBSaveProfile.Name = "tSBSaveProfile";
this.tSBSaveProfile.Size = new System.Drawing.Size(88, 22);
this.tSBSaveProfile.Text = "Save Profile";
this.tSBSaveProfile.Click += new System.EventHandler(this.tSBSaveProfile_Click);
//
// tSBCancel
//
@ -1018,7 +1017,6 @@
this.flowLayoutPanel1.Controls.Add(this.lLBUpdate);
this.flowLayoutPanel1.Controls.Add(this.linkUninstall);
this.flowLayoutPanel1.Controls.Add(this.lLSetup);
this.flowLayoutPanel1.Controls.Add(this.lLAppDataDelete);
this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.flowLayoutPanel1.Location = new System.Drawing.Point(3, 3);
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
@ -1144,18 +1142,6 @@
this.lLSetup.Text = "Controller Setup";
this.lLSetup.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.lLSetup_LinkClicked);
//
// lLAppDataDelete
//
this.lLAppDataDelete.AutoSize = true;
this.lLAppDataDelete.Location = new System.Drawing.Point(3, 51);
this.lLAppDataDelete.Name = "lLAppDataDelete";
this.lLAppDataDelete.Size = new System.Drawing.Size(127, 13);
this.lLAppDataDelete.TabIndex = 53;
this.lLAppDataDelete.TabStop = true;
this.lLAppDataDelete.Text = "Delete Old Settings folder";
this.lLAppDataDelete.Visible = false;
this.lLAppDataDelete.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.lLAppDataDelete_LinkClicked);
//
// saveProfiles
//
this.saveProfiles.Filter = "XML Files (*.xml)|*.xml";
@ -1173,7 +1159,7 @@
this.Name = "ScpForm";
this.Text = "DS4Windows";
this.Activated += new System.EventHandler(this.ScpForm_Activated);
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form_Close);
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.ScpForm_Closing);
this.Load += new System.EventHandler(this.Form_Load);
this.DragDrop += new System.Windows.Forms.DragEventHandler(this.ScpForm_DragDrop);
this.DragEnter += new System.Windows.Forms.DragEventHandler(this.ScpForm_DragEnter);
@ -1287,7 +1273,7 @@
private System.Windows.Forms.ToolStrip tSOptions;
private System.Windows.Forms.ToolStripLabel toolStripLabel1;
private System.Windows.Forms.ToolStripTextBox tSTBProfile;
private System.Windows.Forms.ToolStripButton toolStripButton1;
private System.Windows.Forms.ToolStripButton tSBSaveProfile;
private System.Windows.Forms.ToolStripButton tSBCancel;
private System.Windows.Forms.TabPage tabSettings;
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
@ -1301,7 +1287,6 @@
private System.Windows.Forms.LinkLabel linkProfiles;
private System.Windows.Forms.CheckBox cBNotifications;
private System.Windows.Forms.LinkLabel lLSetup;
private System.Windows.Forms.LinkLabel lLAppDataDelete;
//private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem2;
}
}

View File

@ -17,7 +17,7 @@ namespace ScpServer
{
public partial class ScpForm : Form
{
double version = 10.3;
double version = 10.35;
private DS4Control.Control rootHub;
delegate void LogDebugDelegate(DateTime Time, String Data);
@ -29,6 +29,7 @@ namespace ScpServer
WebClient wc = new WebClient();
Timer test = new Timer(), hotkeystimer = new Timer();
string exepath = Directory.GetParent(Assembly.GetExecutingAssembly().Location).FullName;
string appdatapath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\DS4Tool";
float dpix, dpiy;
DateTime oldnow = DateTime.UtcNow;
string tempprofile = "null";
@ -86,9 +87,8 @@ namespace ScpServer
tSOptions.Visible = false;
LoadP();
ToolTip tt = new ToolTip();
if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\DS4Tool\\Profiles.xml"))
if (File.Exists(appdatapath + "\\Profiles.xml"))
tt.SetToolTip(linkUninstall, "If removing DS4Windows, You can delete the settings following the profile folder link");
tt.SetToolTip(lLAppDataDelete, @"Delete Appdata\DS4Tool folder as it's no longer in use");
}
public static string GetTopWindowName()
@ -125,17 +125,20 @@ namespace ScpServer
protected void Form_Load(object sender, EventArgs e)
{
SetupArrays();
if (!File.Exists("Profiles.xml") && !File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\DS4Tool\Profiles.xml"))
if (File.Exists(exepath + "\\Profiles.xml")
&& File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\DS4Tool\\Profiles.xml"))
new SaveWhere(true).ShowDialog();
else if (File.Exists(exepath + "\\Profiles.xml"))
Global.SaveWhere(exepath);
else if (File.Exists(appdatapath + "\\Profiles.xml"))
Global.SaveWhere(appdatapath);
else if (!File.Exists(exepath + "\\Profiles.xml")
&& !File.Exists(appdatapath + "\\Profiles.xml"))
{
new WelcomeDialog().ShowDialog();
new SaveWhere(false).ShowDialog();
}
else if (File.Exists("Profiles.xml") && File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\DS4Tool\\Profiles.xml"))
new SaveWhere(true).ShowDialog();
else if (File.Exists("Profiles.xml"))
Global.SaveWhere(Directory.GetParent(Assembly.GetExecutingAssembly().Location).FullName);
else if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\DS4Tool\\Profiles.xml"))
Global.SaveWhere(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\DS4Tool");
if (String.IsNullOrEmpty(Global.appdatapath))
{
@ -169,18 +172,13 @@ namespace ScpServer
{
try
{
Directory.CreateDirectory(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)
+ "\\DS4Tool");
File.Copy("Profiles.xml", Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)
+ "\\DS4Tool\\Profiles.xml");
File.Copy("Auto Profiles.xml", Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)
+ "\\DS4Tool\\Auto Profiles.xml");
Directory.CreateDirectory(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)
+ "\\DS4Tool\\Profiles");
foreach (string s in Directory.GetFiles("Profiles"))
Directory.CreateDirectory(appdatapath);
File.Copy(exepath + "\\Profiles.xml", appdatapath + "\\Profiles.xml");
File.Copy(exepath + "\\Auto Profiles.xml", appdatapath + "\\Auto Profiles.xml");
Directory.CreateDirectory(appdatapath + "\\Profiles");
foreach (string s in Directory.GetFiles(exepath + "\\Profiles"))
{
File.Copy(s, Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)
+ "\\DS4Tool\\Profiles\\" + Path.GetFileName(s));
File.Copy(s, appdatapath + "\\Profiles\\" + Path.GetFileName(s));
}
}
catch { }
@ -208,9 +206,7 @@ namespace ScpServer
startMinimizedCheckBox.CheckedChanged -= startMinimizedCheckBox_CheckedChanged;
startMinimizedCheckBox.Checked = Global.getStartMinimized();
startMinimizedCheckBox.CheckedChanged += startMinimizedCheckBox_CheckedChanged;
RegistryKey KeyLoc = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", false);
StartWindowsCheckBox.Checked = (KeyLoc.GetValue("DS4Tool") != null);
StartWindowsCheckBox.Checked = File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.Startup) + "\\DS4Windows.lnk");
if (startMinimizedCheckBox.Checked)
this.WindowState = FormWindowState.Minimized;
Form_Resize(sender, e);
@ -244,18 +240,15 @@ namespace ScpServer
Global.setLastChecked(DateTime.Now);
}
if (File.Exists("Updater.exe"))
if (File.Exists(exepath + "\\Updater.exe"))
{
System.Threading.Thread.Sleep(2000);
File.Delete("Updater.exe");
File.Delete(exepath + "\\Updater.exe");
}
//test.Start();
hotkeystimer.Start();
hotkeystimer.Tick += Hotkeys;
test.Tick += test_Tick;
if (Global.appdatapath == Directory.GetParent(Assembly.GetExecutingAssembly().Location).FullName
&& Directory.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\DS4Tool"))
lLAppDataDelete.Visible = true;
if (!System.IO.Directory.Exists(Global.appdatapath + "\\Virtual Bus Driver"))
linkUninstall.Visible = false;
}
@ -404,18 +397,27 @@ namespace ScpServer
if (newversion > version)
if (MessageBox.Show("Download Version " + newversion + " now?", "DS4Windows Update Available!", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
{
if (!File.Exists("DS4Updater.exe"))
if (!File.Exists(exepath + "\\DS4Updater.exe"))
{
Uri url2 = new Uri("https://dl.dropboxusercontent.com/u/16364552/DS4Tool/DS4Updater.exe");
WebClient wc2 = new WebClient();
wc2.DownloadFile(url2, "DS4Updater.exe");
if (Global.appdatapath == exepath)
wc2.DownloadFile(url2, exepath + "\\DS4Updater.exe");
else
{
MessageBox.Show("Please Download the Updater now, and place it in the programs folder, then check for update again");
Process.Start("https://www.dropbox.com/s/tlqtdkdumdo0yir/DS4Updater.exe");
}
}
if (Global.appdatapath == exepath)
{
Process p = new Process();
p.StartInfo.FileName = "DS4Updater.exe";
if (!Global.AdminNeeded())
p.StartInfo.FileName = exepath + "\\DS4Updater.exe";
if (Global.AdminNeeded())
p.StartInfo.Verb = "runas";
p.Start();
this.Close();
Close();
}
}
else
File.Delete(Global.appdatapath + "\\version.txt");
@ -752,7 +754,7 @@ namespace ScpServer
string filename = lBProfiles.SelectedItem.ToString();
if (MessageBox.Show("\"" + filename + "\" cannot be restored.", "Delete Profile?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
{
System.IO.File.Delete(Global.appdatapath + "\\Profiles\\" + filename + ".xml");
System.IO.File.Delete(Global.appdatapath + @"\Profiles\" + filename + ".xml");
RefreshProfiles();
}
}
@ -996,11 +998,37 @@ namespace ScpServer
{
RegistryKey KeyLoc = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
if (StartWindowsCheckBox.Checked)
KeyLoc.SetValue("DS4Tool", "\"" + Application.ExecutablePath.ToString() + "\"");
appShortcutToStartup();
else
File.Delete(Environment.GetFolderPath(Environment.SpecialFolder.Startup) + "\\DS4Windows.lnk");
KeyLoc.DeleteValue("DS4Tool", false);
}
private void appShortcutToStartup()
{
Type t = Type.GetTypeFromCLSID(new Guid("72C24DD5-D70A-438B-8A42-98424B88AFB8")); //Windows Script Host Shell Object
dynamic shell = Activator.CreateInstance(t);
try
{
var lnk = shell.CreateShortcut(Environment.GetFolderPath(Environment.SpecialFolder.Startup) + "\\DS4Windows.lnk");
try
{
string app = Assembly.GetExecutingAssembly().Location;
lnk.TargetPath = Assembly.GetExecutingAssembly().Location;
lnk.IconLocation = app.Replace('\\', '/');
lnk.Save();
}
finally
{
Marshal.FinalReleaseComObject(lnk);
}
}
finally
{
Marshal.FinalReleaseComObject(shell);
}
}
private void tabMain_SelectedIndexChanged(object sender, EventArgs e)
{
lbLastMessage.Visible = tabMain.SelectedIndex != 2;
@ -1099,7 +1127,7 @@ namespace ScpServer
opt.Close();
}
private void toolStripButton1_Click(object sender, EventArgs e)
private void tSBSaveProfile_Click(object sender, EventArgs e)
{
if (opt != null)
{
@ -1185,19 +1213,28 @@ namespace ScpServer
if (newversion > Global.getVersion())
if (MessageBox.Show("Download Version " + newversion + " now?", "DS4Windows Update Available!", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
{
if (!File.Exists("DS4Updater.exe"))
if (!File.Exists(exepath + "\\DS4Updater.exe"))
{
Uri url2 = new Uri("https://dl.dropboxusercontent.com/u/16364552/DS4Tool/DS4Updater.exe");
WebClient wc2 = new WebClient();
wc2.DownloadFile(url2, "DS4Updater.exe");
if (Global.appdatapath == exepath)
wc2.DownloadFile(url2, exepath + "\\DS4Updater.exe");
else
{
MessageBox.Show("Please Download the Updater now, and place it in the programs folder, then check for update again");
Process.Start("https://www.dropbox.com/s/tlqtdkdumdo0yir/DS4Updater.exe");
}
}
if (Global.appdatapath == exepath)
{
Process p = new Process();
p.StartInfo.FileName = "DS4Updater.exe";
p.StartInfo.FileName = exepath + "\\DS4Updater.exe";
if (Global.AdminNeeded())
p.StartInfo.Verb = "runas";
p.Start();
Close();
}
}
else
File.Delete(Global.appdatapath + "\\version.txt");
else
@ -1218,7 +1255,7 @@ namespace ScpServer
private void linkUninstall_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
if (System.IO.File.Exists(Global.appdatapath + "\\Virtual Bus Driver\\ScpDriver.exe"))
if (File.Exists(Global.appdatapath + "\\Virtual Bus Driver\\ScpDriver.exe"))
try { System.Diagnostics.Process.Start(Global.appdatapath + "\\Virtual Bus Driver\\ScpDriver.exe"); }
catch { System.Diagnostics.Process.Start(Global.appdatapath + "\\Virtual Bus Driver"); }
}
@ -1243,19 +1280,14 @@ namespace ScpServer
}
}
private void lLAppDataDelete_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
protected void ScpForm_Closing(object sender, FormClosingEventArgs e)
{
try { Directory.Delete(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\DS4Tool", true); }
catch{}
finally
if (opt != null)
{
MessageBox.Show("Old Settings Deleted");
lLAppDataDelete.Visible = false;
opt.Close();
e.Cancel = true;
return;
}
}
protected void Form_Close(object sender, FormClosingEventArgs e)
{
if (systemShutdown)
// Reset the variable because the user might cancel the
// shutdown.

View File

@ -6302,6 +6302,15 @@
<metadata name="openProfiles.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>449, 17</value>
</metadata>
<metadata name="tSOptions.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>891, 17</value>
</metadata>
<metadata name="toolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>568, 17</value>
</metadata>
<metadata name="cMProfile.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>788, 17</value>
</metadata>
<data name="pBStatus1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAACcAAAAUCAYAAAAOTSQ2AAAABGdBTUEAALGOfPtRkwAAACBjSFJNAACH
@ -6526,12 +6535,6 @@
1WDefQHxFbbcLCQjmgAAAABJRU5ErkJggg==
</value>
</data>
<metadata name="tSOptions.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>891, 17</value>
</metadata>
<metadata name="toolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>568, 17</value>
</metadata>
<data name="tsBDeleteProfile.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
@ -6567,9 +6570,6 @@
AABJRU5ErkJggg==
</value>
</data>
<metadata name="cMProfile.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>788, 17</value>
</metadata>
<metadata name="saveProfiles.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>673, 17</value>
</metadata>

View File

@ -147,7 +147,7 @@ namespace ScpServer
lodsf.RemoveAt(i);
for (int i = lodsf.Count - 1; i >= 0; i--)
for (int j = programpaths.Count - 1; j >= 0; j--)
if (lodsf[i] == programpaths[j])
if (lodsf[i].ToLower().Replace('/', '\\') == programpaths[j].ToLower().Replace('/', '\\'))
lodsf.RemoveAt(i);
foreach (string st in lodsf)
{