Removed Aboutbox, moved profile and sttings to appdata, added import profile options minor UI changes

This commit is contained in:
jays2kings 2014-05-15 18:10:17 -04:00
parent 809bc119ca
commit dacaada0ea
11 changed files with 230 additions and 354 deletions

View File

@ -80,7 +80,7 @@ namespace DS4Control
{
protected static BackingStore m_Config = new BackingStore();
protected static Int32 m_IdleTimeout = 600000;
public static string appdatapath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\DS4Tool";
public static event EventHandler<EventArgs> ControllerStatusChange; // called when a controller is added/removed/battery or touchpad mode changes/etc.
public static void ControllerStatusChanged(object sender)
{
@ -290,7 +290,7 @@ namespace DS4Control
}
public static void setAProfile(int device, string filepath)
{
m_Config.profilePath[device] = Directory.GetParent(Assembly.GetExecutingAssembly().Location).FullName + @"\Profiles\" + filepath + ".xml";
m_Config.profilePath[device] = Global.appdatapath + @"\Profiles\" + filepath + ".xml";
}
public static string getAProfile(int device)
{
@ -372,7 +372,7 @@ namespace DS4Control
public class BackingStore
{
protected String m_Profile = Directory.GetParent(Assembly.GetExecutingAssembly().Location).FullName + @"\Profiles.xml";
protected String m_Profile = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\DS4Tool\\Profiles.xml";
protected XmlDocument m_Xdoc = new XmlDocument();
public int[] buttonMouseSensitivity = { 50, 50, 50, 50 };
@ -449,10 +449,7 @@ namespace DS4Control
public Boolean SaveProfile(int device, String propath, System.Windows.Forms.Control[] buttons)
{
Boolean Saved = true;
//String folderName = Directory.GetParent(Assembly.GetExecutingAssembly().Location).FullName;
//String pathString = System.IO.Path.Combine(folderName, "Profiles");
//System.IO.Directory.CreateDirectory(pathString);
String path = Directory.GetParent(Assembly.GetExecutingAssembly().Location).FullName + @"\Profiles\" + propath + ".xml";
String path = Global.appdatapath + @"\Profiles\" + propath + ".xml";
try
{
XmlNode Node;

View File

@ -1,96 +0,0 @@
namespace ScpServer
{
partial class AboutBox
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.OkButton = new System.Windows.Forms.Button();
this.textBox1 = new System.Windows.Forms.TextBox();
this.linkLabel1 = new System.Windows.Forms.LinkLabel();
this.SuspendLayout();
//
// OkButton
//
this.OkButton.Location = new System.Drawing.Point(260, 118);
this.OkButton.Name = "OkButton";
this.OkButton.Size = new System.Drawing.Size(75, 23);
this.OkButton.TabIndex = 0;
this.OkButton.Text = "Ok";
this.OkButton.UseVisualStyleBackColor = true;
this.OkButton.Click += new System.EventHandler(this.OkButton_Click);
//
// textBox1
//
this.textBox1.BackColor = System.Drawing.SystemColors.Control;
this.textBox1.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.textBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.textBox1.Location = new System.Drawing.Point(12, 12);
this.textBox1.Multiline = true;
this.textBox1.Name = "textBox1";
this.textBox1.ReadOnly = true;
this.textBox1.Size = new System.Drawing.Size(260, 61);
this.textBox1.TabIndex = 1;
this.textBox1.Text = "DS4Windows is Open Source software!\r\n\r\nInsert link to GPL here (at some point.)";
this.textBox1.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// linkLabel1
//
this.linkLabel1.AutoSize = true;
this.linkLabel1.Location = new System.Drawing.Point(9, 86);
this.linkLabel1.Name = "linkLabel1";
this.linkLabel1.Size = new System.Drawing.Size(324, 13);
this.linkLabel1.TabIndex = 2;
this.linkLabel1.TabStop = true;
this.linkLabel1.Text = "https://code.google.com/r/brianfundakowskifeldman-ds4windows/";
this.linkLabel1.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel1_LinkClicked);
//
// AboutBox
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(347, 153);
this.Controls.Add(this.linkLabel1);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.OkButton);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "AboutBox";
this.Text = "About";
this.Load += new System.EventHandler(this.AboutBox_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button OkButton;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.LinkLabel linkLabel1;
}
}

View File

@ -1,34 +0,0 @@
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;
namespace ScpServer
{
public partial class AboutBox : Form
{
public AboutBox()
{
InitializeComponent();
}
private void OkButton_Click(object sender, EventArgs e)
{
this.Close();
}
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
System.Diagnostics.Process.Start(e.Link.LinkData.ToString());
}
private void AboutBox_Load(object sender, EventArgs e)
{
linkLabel1.Links.Add(0, linkLabel1.Text.Length, "https://code.google.com/r/brianfundakowskifeldman-ds4windows/");
}
}
}

View File

@ -1,120 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -83,12 +83,6 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="AboutBox.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="AboutBox.Designer.cs">
<DependentUpon>AboutBox.cs</DependentUpon>
</Compile>
<Compile Include="AdvancedColorDialog.cs" />
<Compile Include="Hotkeys.cs">
<SubType>Form</SubType>
@ -122,9 +116,6 @@
<DependentUpon>ScpForm.cs</DependentUpon>
</Compile>
<Compile Include="Settings.cs" />
<EmbeddedResource Include="AboutBox.resx">
<DependentUpon>AboutBox.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Hotkeys.resx">
<DependentUpon>Hotkeys.cs</DependentUpon>
</EmbeddedResource>

View File

@ -37,16 +37,20 @@
this.button1 = new System.Windows.Forms.Button();
this.label9 = new System.Windows.Forms.Label();
this.label10 = new System.Windows.Forms.Label();
this.label11 = new System.Windows.Forms.Label();
this.label13 = new System.Windows.Forms.Label();
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.label2 = new System.Windows.Forms.Label();
this.lbAbout = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(22, 17);
this.label1.Location = new System.Drawing.Point(26, 31);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(129, 13);
this.label1.TabIndex = 0;
@ -55,7 +59,7 @@
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(22, 97);
this.label3.Location = new System.Drawing.Point(26, 111);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(108, 13);
this.label3.TabIndex = 2;
@ -64,7 +68,7 @@
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(22, 122);
this.label4.Location = new System.Drawing.Point(26, 136);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(166, 13);
this.label4.TabIndex = 3;
@ -73,7 +77,7 @@
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(222, 17);
this.label5.Location = new System.Drawing.Point(226, 31);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(138, 26);
this.label5.TabIndex = 4;
@ -82,7 +86,7 @@
// label7
//
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(222, 97);
this.label7.Location = new System.Drawing.Point(226, 111);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(50, 13);
this.label7.TabIndex = 6;
@ -91,15 +95,16 @@
// label8
//
this.label8.AutoSize = true;
this.label8.Location = new System.Drawing.Point(222, 122);
this.label8.Location = new System.Drawing.Point(226, 136);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(145, 26);
this.label8.TabIndex = 7;
this.label8.Text = "Right click (Best used with \r\nright side is used as a mouse)";
this.label8.Text = "Right click (Best used when \r\nright side is used as a mouse)";
//
// button1
//
this.button1.Location = new System.Drawing.Point(164, 202);
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.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 8;
@ -110,7 +115,7 @@
// label9
//
this.label9.AutoSize = true;
this.label9.Location = new System.Drawing.Point(222, 73);
this.label9.Location = new System.Drawing.Point(226, 87);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(83, 13);
this.label9.TabIndex = 10;
@ -119,34 +124,25 @@
// label10
//
this.label10.AutoSize = true;
this.label10.Location = new System.Drawing.Point(22, 73);
this.label10.Location = new System.Drawing.Point(26, 87);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(171, 13);
this.label10.TabIndex = 9;
this.label10.Text = "Two fingers up/down on touchpad";
//
// label11
//
this.label11.AutoSize = true;
this.label11.Location = new System.Drawing.Point(22, 167);
this.label11.Name = "label11";
this.label11.Size = new System.Drawing.Size(200, 13);
this.label11.TabIndex = 13;
this.label11.Text = "Note: Repeat Keys and Scan Code Keys";
//
// label13
//
this.label13.AutoSize = true;
this.label13.Location = new System.Drawing.Point(22, 180);
this.label13.Location = new System.Drawing.Point(26, 171);
this.label13.Name = "label13";
this.label13.Size = new System.Drawing.Size(372, 13);
this.label13.Size = new System.Drawing.Size(361, 13);
this.label13.TabIndex = 14;
this.label13.Text = "These are alternate key press styles which certain games might need to work.";
this.label13.Text = "Note: Scan Code Keys may be needed to make which certain games work.";
//
// label14
//
this.label14.AutoSize = true;
this.label14.Location = new System.Drawing.Point(223, 49);
this.label14.Location = new System.Drawing.Point(227, 63);
this.label14.Name = "label14";
this.label14.Size = new System.Drawing.Size(131, 13);
this.label14.TabIndex = 16;
@ -155,21 +151,77 @@
// label15
//
this.label15.AutoSize = true;
this.label15.Location = new System.Drawing.Point(23, 49);
this.label15.Location = new System.Drawing.Point(27, 63);
this.label15.Name = "label15";
this.label15.Size = new System.Drawing.Size(103, 13);
this.label15.TabIndex = 15;
this.label15.Text = "PS Button + Options";
//
// linkProfiles
//
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.Name = "linkProfiles";
this.linkProfiles.Size = new System.Drawing.Size(94, 13);
this.linkProfiles.TabIndex = 17;
this.linkProfiles.TabStop = true;
this.linkProfiles.Text = "Open Profile folder";
this.linkProfiles.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkProfiles_LinkClicked);
//
// linkLabel1
//
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);
//
// linkLabel2
//
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);
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(26, 194);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(72, 13);
this.label2.TabIndex = 13;
this.label2.Text = "Source Code:";
//
// lbAbout
//
this.lbAbout.AutoSize = true;
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(229, 13);
this.lbAbout.TabIndex = 0;
this.lbAbout.Text = "DS4Windows is Open Source software!";
//
// Hotkeys
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(399, 236);
this.ClientSize = new System.Drawing.Size(399, 244);
this.Controls.Add(this.linkLabel2);
this.Controls.Add(this.linkLabel1);
this.Controls.Add(this.linkProfiles);
this.Controls.Add(this.label14);
this.Controls.Add(this.label15);
this.Controls.Add(this.label13);
this.Controls.Add(this.label11);
this.Controls.Add(this.label2);
this.Controls.Add(this.label9);
this.Controls.Add(this.label10);
this.Controls.Add(this.button1);
@ -178,9 +230,13 @@
this.Controls.Add(this.label5);
this.Controls.Add(this.label4);
this.Controls.Add(this.label3);
this.Controls.Add(this.lbAbout);
this.Controls.Add(this.label1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "Hotkeys";
this.Text = "Hotkeys";
this.Text = "Help";
this.ResumeLayout(false);
this.PerformLayout();
@ -197,9 +253,13 @@
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.Label label10;
private System.Windows.Forms.Label label11;
private System.Windows.Forms.Label label13;
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.Label label2;
private System.Windows.Forms.Label lbAbout;
}
}

View File

@ -6,6 +6,7 @@ using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DS4Control;
namespace ScpServer
{
@ -20,5 +21,20 @@ namespace ScpServer
{
this.Close();
}
private void linkProfiles_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
System.Diagnostics.Process.Start(Global.appdatapath + "\\Profiles");
}
private void linkLabel2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
System.Diagnostics.Process.Start("https://code.google.com/r/jays2kings-ds4tool/source/list?name=jay");
}
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
System.Diagnostics.Process.Start("https://code.google.com/r/brianfundakowskifeldman-ds4windows/");
}
}
}

View File

@ -198,7 +198,7 @@ namespace ScpServer
if (tBProfile.Text != null && tBProfile.Text != "" && !tBProfile.Text.Contains("\\") && !tBProfile.Text.Contains("/") && !tBProfile.Text.Contains(":") && !tBProfile.Text.Contains("*") && !tBProfile.Text.Contains("?") && !tBProfile.Text.Contains("\"") && !tBProfile.Text.Contains("<") && !tBProfile.Text.Contains(">") && !tBProfile.Text.Contains("|"))
{
System.IO.File.Delete(Directory.GetParent(Assembly.GetExecutingAssembly().Location).FullName + @"\Profiles\" + filename + ".xml");
System.IO.File.Delete(Global.appdatapath + @"\Profiles\" + filename + ".xml");
Global.setAProfile(device, tBProfile.Text);
Global.SaveProfile(device, tBProfile.Text, buttons.ToArray());
Global.Save();
@ -518,7 +518,6 @@ namespace ScpServer
tBProfile.ForeColor = System.Drawing.SystemColors.WindowText;
else
tBProfile.ForeColor = System.Drawing.SystemColors.GrayText;
//if (System.IO.File.Exists(Directory.GetParent(Assembly.GetExecutingAssembly().Location).FullName + @"\Profiles\" + tBProfile.Text + ".xml"))
}
private void tBProfile_Enter(object sender, EventArgs e)

View File

@ -35,11 +35,9 @@
this.chData = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.tmrUpdate = new System.Windows.Forms.Timer(this.components);
this.pnlButton = new System.Windows.Forms.Panel();
this.AboutButton = new System.Windows.Forms.Button();
this.btnStartStop = new System.Windows.Forms.Button();
this.btnClear = new System.Windows.Forms.Button();
this.btnStop = new System.Windows.Forms.Button();
this.hotkeysButton = new System.Windows.Forms.Button();
this.lnkControllers = new System.Windows.Forms.LinkLabel();
this.hideDS4CheckBox = new System.Windows.Forms.CheckBox();
this.startMinimizedCheckBox = new System.Windows.Forms.CheckBox();
@ -77,6 +75,9 @@
this.openToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
this.openProfiles = new System.Windows.Forms.OpenFileDialog();
this.llbHelp = new System.Windows.Forms.LinkLabel();
this.btnImportProfiles = new System.Windows.Forms.Button();
this.pnlButton.SuspendLayout();
this.pnlDebug.SuspendLayout();
this.pnlStatus.SuspendLayout();
@ -119,11 +120,11 @@
//
// pnlButton
//
this.pnlButton.Controls.Add(this.AboutButton);
this.pnlButton.Controls.Add(this.btnImportProfiles);
this.pnlButton.Controls.Add(this.llbHelp);
this.pnlButton.Controls.Add(this.btnStartStop);
this.pnlButton.Controls.Add(this.btnClear);
this.pnlButton.Controls.Add(this.btnStop);
this.pnlButton.Controls.Add(this.hotkeysButton);
this.pnlButton.Controls.Add(this.lnkControllers);
this.pnlButton.Dock = System.Windows.Forms.DockStyle.Bottom;
this.pnlButton.Location = new System.Drawing.Point(0, 477);
@ -131,20 +132,10 @@
this.pnlButton.Size = new System.Drawing.Size(794, 35);
this.pnlButton.TabIndex = 10;
//
// AboutButton
//
this.AboutButton.Location = new System.Drawing.Point(9, 5);
this.AboutButton.Name = "AboutButton";
this.AboutButton.Size = new System.Drawing.Size(75, 23);
this.AboutButton.TabIndex = 11;
this.AboutButton.Text = "About";
this.AboutButton.UseVisualStyleBackColor = true;
this.AboutButton.Click += new System.EventHandler(this.AboutButton_Click);
//
// btnStartStop
//
this.btnStartStop.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnStartStop.Location = new System.Drawing.Point(666, 5);
this.btnStartStop.Location = new System.Drawing.Point(666, 6);
this.btnStartStop.Name = "btnStartStop";
this.btnStartStop.Size = new System.Drawing.Size(119, 23);
this.btnStartStop.TabIndex = 1;
@ -177,20 +168,10 @@
this.btnStop.Visible = false;
this.btnStop.Click += new System.EventHandler(this.btnStop_Click);
//
// hotkeysButton
//
this.hotkeysButton.Location = new System.Drawing.Point(90, 5);
this.hotkeysButton.Name = "hotkeysButton";
this.hotkeysButton.Size = new System.Drawing.Size(75, 23);
this.hotkeysButton.TabIndex = 12;
this.hotkeysButton.Text = "Hotkeys";
this.hotkeysButton.UseVisualStyleBackColor = true;
this.hotkeysButton.Click += new System.EventHandler(this.hotkeysButton_Click);
//
// lnkControllers
//
this.lnkControllers.AutoSize = true;
this.lnkControllers.Location = new System.Drawing.Point(171, 10);
this.lnkControllers.Location = new System.Drawing.Point(170, 11);
this.lnkControllers.Name = "lnkControllers";
this.lnkControllers.Size = new System.Drawing.Size(56, 13);
this.lnkControllers.TabIndex = 11;
@ -269,7 +250,7 @@
this.gpPads.Controls.Add(this.lbLastMessage);
this.gpPads.Location = new System.Drawing.Point(-6, -9);
this.gpPads.Name = "gpPads";
this.gpPads.Size = new System.Drawing.Size(803, 129);
this.gpPads.Size = new System.Drawing.Size(803, 182);
this.gpPads.TabIndex = 1;
this.gpPads.TabStop = false;
//
@ -501,7 +482,7 @@
//
this.lbLastMessage.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.lbLastMessage.ForeColor = System.Drawing.SystemColors.GrayText;
this.lbLastMessage.Location = new System.Drawing.Point(15, 107);
this.lbLastMessage.Location = new System.Drawing.Point(15, 133);
this.lbLastMessage.Name = "lbLastMessage";
this.lbLastMessage.Size = new System.Drawing.Size(551, 20);
this.lbLastMessage.TabIndex = 41;
@ -587,6 +568,33 @@
this.toolStripSeparator2.Name = "toolStripSeparator2";
this.toolStripSeparator2.Size = new System.Drawing.Size(211, 6);
//
// openProfiles
//
this.openProfiles.Filter = "XML Files (*.xml)|*.xml";
this.openProfiles.Multiselect = true;
this.openProfiles.FileOk += new System.ComponentModel.CancelEventHandler(this.openFileDialog1_FileOk);
//
// llbHelp
//
this.llbHelp.AutoSize = true;
this.llbHelp.Location = new System.Drawing.Point(102, 11);
this.llbHelp.Name = "llbHelp";
this.llbHelp.Size = new System.Drawing.Size(62, 13);
this.llbHelp.TabIndex = 13;
this.llbHelp.TabStop = true;
this.llbHelp.Text = "Help/About";
this.llbHelp.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.llbHelp_LinkClicked);
//
// btnImportProfiles
//
this.btnImportProfiles.Location = new System.Drawing.Point(9, 6);
this.btnImportProfiles.Name = "btnImportProfiles";
this.btnImportProfiles.Size = new System.Drawing.Size(87, 23);
this.btnImportProfiles.TabIndex = 14;
this.btnImportProfiles.Text = "Import Profile(s)";
this.btnImportProfiles.UseVisualStyleBackColor = true;
this.btnImportProfiles.Click += new System.EventHandler(this.btnImportProfiles_Click);
//
// ScpForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -627,12 +635,10 @@
private System.Windows.Forms.Panel pnlStatus;
private System.Windows.Forms.GroupBox gpPads;
private System.Windows.Forms.NotifyIcon notifyIcon1;
private System.Windows.Forms.Button hotkeysButton;
private System.Windows.Forms.CheckBox hideDS4CheckBox;
private System.Windows.Forms.CheckBox startMinimizedCheckBox;
private System.Windows.Forms.Label lbLastMessage;
private System.Windows.Forms.LinkLabel lnkControllers;
private System.Windows.Forms.Button AboutButton;
private System.Windows.Forms.ComboBox cBController4;
private System.Windows.Forms.ComboBox cBController3;
private System.Windows.Forms.ComboBox cBController2;
@ -662,6 +668,9 @@
private System.Windows.Forms.ToolStripMenuItem editProfileForController3ToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator2;
private System.Windows.Forms.OpenFileDialog openProfiles;
private System.Windows.Forms.LinkLabel llbHelp;
private System.Windows.Forms.Button btnImportProfiles;
//private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem2;
}
}

View File

@ -13,6 +13,7 @@ namespace ScpServer
{
private DS4Control.Control rootHub;
delegate void LogDebugDelegate(DateTime Time, String Data);
double version = 6.8;
protected void LogDebug(DateTime Time, String Data)
{
@ -95,29 +96,38 @@ namespace ScpServer
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");
Directory.CreateDirectory(Global.appdatapath);
wc.DownloadFileAsync(url, Global.appdatapath + "\\version.txt");
wc.DownloadFileCompleted += Check_Version;
// if (Directory.Exists(Directory.GetParent(Assembly.GetExecutingAssembly().Location).FullName + @"\Profiles\"))
//File.C
}
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))
try
{
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();
}
if (double.TryParse(File.ReadAllText(Global.appdatapath + "\\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(Global.appdatapath + "\\version.txt");
else
File.Delete("version.txt");
File.Delete(Global.appdatapath + "\\version.txt");
}
else
File.Delete("version.txt");
File.Delete(Global.appdatapath + "\\version.txt");
}
catch
{
}
else
File.Delete("version.txt");
}
protected void Form_Load(object sender, EventArgs e)
@ -160,8 +170,8 @@ namespace ScpServer
{
try
{
string[] profiles = System.IO.Directory.GetFiles(Directory.GetParent(Assembly.GetExecutingAssembly().Location).FullName + @"\Profiles\");
int cutoff = (Directory.GetParent(Assembly.GetExecutingAssembly().Location).FullName + @"\Profiles\").Length;
string[] profiles = System.IO.Directory.GetFiles(Global.appdatapath + @"\Profiles\");
int cutoff = (Global.appdatapath + @"\Profiles\").Length;
List<string> profilenames = new List<string>();
foreach (String s in profiles)
if (s.EndsWith(".xml"))
@ -198,12 +208,17 @@ namespace ScpServer
}
catch (DirectoryNotFoundException)
{
System.IO.Directory.CreateDirectory(Directory.GetParent(Assembly.GetExecutingAssembly().Location).FullName + @"\Profiles\");
if (Directory.Exists(Directory.GetParent(Assembly.GetExecutingAssembly().Location).FullName + @"\Profiles\"))
MessageBox.Show("Please import or make a profile", "Profile Folder Moved");
Directory.CreateDirectory(Global.appdatapath + @"\Profiles\");
for (int i = 0; i < 4; i++)
{
cbs[i].Items.Add("");
cbs[i].SelectedIndex = 0;
cbs[i].Text = "(No Profile Found)";
shortcuts[i].Text = "Make Profile for Controller " + (i + 1);
ebns[i].Text = "New";
cbs[i].Items.Add("+New Profile");
shortcuts[i].DropDownItems.Add("-");
shortcuts[i].DropDownItems.Add("+New Profile");
}
}
}
@ -366,7 +381,7 @@ namespace ScpServer
string filename = cbs[tdevice].Items[cbs[tdevice].SelectedIndex].ToString();
if (MessageBox.Show("\"" + filename + "\" cannot be restored.", "Delete Profile?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
{
System.IO.File.Delete(Directory.GetParent(Assembly.GetExecutingAssembly().Location).FullName + @"\Profiles\" + filename + ".xml");
System.IO.File.Delete(Global.appdatapath + filename + ".xml");
Global.setAProfile(tdevice, null);
RefreshProfiles();
}
@ -403,13 +418,6 @@ namespace ScpServer
Global.Save();
}
private void AboutButton_Click(object sender, EventArgs e)
{
AboutBox box = new AboutBox();
box.Icon = this.Icon;
box.ShowDialog();
}
private void lvDebug_ItemActivate(object sender, EventArgs e)
{
MessageBox.Show(((ListView)sender).FocusedItem.SubItems[1].Text, "Log");
@ -487,6 +495,49 @@ namespace ScpServer
{
}
private void linkProfiles_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
openProfiles.InitialDirectory = Directory.GetParent(Assembly.GetExecutingAssembly().Location).FullName + @"\Profiles\";
if (openProfiles.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
string[] files = openProfiles .FileNames;
for (int i = 0; i < files.Length; i++)
{
string[] temp = files[i].Split('\\');
files[i] = temp[temp.Length-1];
File.Copy(openProfiles.FileNames[i], Global.appdatapath + "\\Profiles\\" + files[i], true);
}
RefreshProfiles();
}
}
private void openFileDialog1_FileOk(object sender, System.ComponentModel.CancelEventArgs e)
{
}
private void llbHelp_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
Hotkeys hotkeysForm = new Hotkeys();
hotkeysForm.Icon = this.Icon;
hotkeysForm.ShowDialog();
}
private void btnImportProfiles_Click(object sender, EventArgs e)
{
openProfiles.InitialDirectory = Directory.GetParent(Assembly.GetExecutingAssembly().Location).FullName + @"\Profiles\";
if (openProfiles.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
string[] files = openProfiles.FileNames;
for (int i = 0; i < files.Length; i++)
{
string[] temp = files[i].Split('\\');
files[i] = temp[temp.Length - 1];
File.Copy(openProfiles.FileNames[i], Global.appdatapath + "\\Profiles\\" + files[i], true);
}
RefreshProfiles();
}
}
}
public class ThemeUtil

View File

@ -6299,4 +6299,7 @@
AADffwAA338AAJ5/AACe/wAA3d8AAN3vAADf7wAA7c8AAP+/AAD/vwAA/78AAP//AAA=
</value>
</data>
<metadata name="openProfiles.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>449, 17</value>
</metadata>
</root>