Rest of DS4Windows has been upped to .NET 4.5 (If you have .net 4/already can run DS4Windows, this won't affect you), thanks to this update, you can now...

Add delay to macros from one millisecond to 60 seconds, macros with delays only run once until pressed again. Without delays, the macro can be repeated while held down.
Profiles and settings are now back inside the application folder to help portability. It will remain in appdata as previous versions if DS4Windows is in a admin folder, I may try to add a setting for location saving.
Import profile option will automatically go to the appdata profile folder, auto profiles and settings will automatically copy over.
Option to delete the appdata folder if not in use in the settings tab, this way it helps with cleanup.
Another fix for auto profiles startup bug
Better reading of autoprofile program path names
Now only one instance of DS4Windows is possible, if another DS4Tool or DS4Windows that is not this version is started, this DS4Windows comes back into focus.
UI fixes
This commit is contained in:
jays2kings 2014-06-10 15:45:09 -04:00
parent d11b15d073
commit e8113bfdf1
21 changed files with 711 additions and 215 deletions

View File

@ -356,6 +356,7 @@ namespace DS4Control
return "None";
}
private int XINPUT_UNPLUG_SETTLE_TIME = 250; // Inhibit races that occur with the asynchronous teardown of ScpVBus -> X360 driver instance.
//Called when DS4 is disconnected or timed out
protected virtual void On_DS4Removal(object sender, EventArgs e)
@ -403,7 +404,7 @@ namespace DS4Control
if (Global.getHasCustomKeysorButtons(ind))
{
Mapping.MapCustom(ind, cState, MappedState[ind], pState);
Mapping.MapCustom(ind, cState, MappedState[ind]);
cState = MappedState[ind];
}
@ -411,7 +412,7 @@ namespace DS4Control
DS4LightBar.updateLightBar(device, ind);
//DS4LightBar.defualtLight(device, ind);
x360Bus.Parse(cState, processingData[ind].Report, ind);
x360Bus.Parse(MappedState[ind], processingData[ind].Report, ind);
// We push the translated Xinput state, and simultaneously we
// pull back any possible rumble data coming from Xinput consumers.
if (x360Bus.Report(processingData[ind].Report, processingData[ind].Rumble))
@ -570,5 +571,10 @@ namespace DS4Control
{
return CurrentState[ind];
}
public DS4State getDS4StateMapped(int ind)
{
return MappedState[ind];
}
}
}

View File

@ -9,8 +9,9 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>DS4Control</RootNamespace>
<AssemblyName>DS4Control</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@ -20,6 +21,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@ -28,6 +30,7 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />

View File

@ -3,6 +3,8 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using DS4Library;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace DS4Control
{
public class Mapping
@ -287,7 +289,7 @@ namespace DS4Control
string macro = Global.getCustomMacro(device, what);
if (macro != "0")
{
DS4KeyType keyType = Global.getCustomKeyType(device, what);
/*DS4KeyType keyType = Global.getCustomKeyType(device, what);
SyntheticState.KeyPresses kp;
string[] skeys = macro.Split('/');
ushort[] keys = new ushort[skeys.Length];
@ -306,7 +308,7 @@ namespace DS4Control
else
kp.current.vkCount++;
kp.current.repeatCount++;
}
}*/
}
else if (Global.getCustomKey(device, what) != 0)
{
@ -439,24 +441,116 @@ namespace DS4Control
}
}
}
public static bool[] pressedonce = new bool[261];
public static int DS4ControltoInt(DS4Controls ctrl)
{
switch (ctrl)
{
case DS4Controls.Share: return 1;
case DS4Controls.Options: return 2;
case DS4Controls.L1: return 3;
case DS4Controls.R1: return 4;
case DS4Controls.L3: return 5;
case DS4Controls.R3: return 6;
case DS4Controls.DpadUp: return 7;
case DS4Controls.DpadDown: return 8;
case DS4Controls.DpadLeft: return 9;
case DS4Controls.DpadRight: return 10;
case DS4Controls.PS: return 11;
case DS4Controls.Cross: return 12;
case DS4Controls.Square: return 13;
case DS4Controls.Triangle: return 14;
case DS4Controls.Circle: return 15;
case DS4Controls.LXNeg: return 16;
case DS4Controls.LYNeg: return 17;
case DS4Controls.RXNeg: return 18;
case DS4Controls.RYNeg: return 19;
case DS4Controls.LXPos: return 20;
case DS4Controls.LYPos: return 21;
case DS4Controls.RXPos: return 22;
case DS4Controls.RYPos: return 23;
case DS4Controls.L2: return 24;
case DS4Controls.R2: return 25;
case DS4Controls.TouchMulti: return 26;
case DS4Controls.TouchLeft: return 27;
case DS4Controls.TouchRight: return 28;
case DS4Controls.TouchUpper: return 29;
}
return 0;
}
public static bool[] pressedonce = new bool[261], macrodone = new bool[30];
public static int test = 0;
/** Map DS4 Buttons/Axes to other DS4 Buttons/Axes (largely the same as Xinput ones) and to keyboard and mouse buttons. */
public static void MapCustom(int device, DS4State cState, DS4State MappedState, DS4State pState = null)
public static async void MapCustom(int device, DS4State cState, DS4State MappedState)
{
cState.CopyTo(MappedState);
SyntheticState deviceState = Mapping.deviceState[device];
foreach (KeyValuePair<DS4Controls, string> customKey in Global.getCustomMacros(device))
foreach (KeyValuePair<DS4Controls, string> customKey in Global.getCustomMacros(device)) //with delays
{
DS4KeyType keyType = Global.getCustomKeyType(device, customKey.Key);
if (getBoolMapping(customKey.Key, cState))
{
resetToDefaultValue(customKey.Key, MappedState);
string[] skeys = customKey.Value.Split('/');
ushort[] keys = new ushort[skeys.Length];
for (int i = 0; i < keys.Length; i++)
{
keys[i] = ushort.Parse(skeys[i]);
bool timedmacro = false;
for (int i = 0; i < keys.Length; i++)
if (keys[i] > 300)
{
timedmacro = true;
break;
}
if (timedmacro && !macrodone[DS4ControltoInt(customKey.Key)])
{
macrodone[DS4ControltoInt(customKey.Key)] = true;
for (int i = 0; i < keys.Length; i++)
{
if (keys[i] > 300) //ints over 300 used to delay
await Task.Delay(keys[i] - 300);
else if (keys[i] == 256) InputMethods.MouseEvent(InputMethods.MOUSEEVENTF_LEFTDOWN); //anything above 255 is not a keyvalue
else if (keys[i] == 257) InputMethods.MouseEvent(InputMethods.MOUSEEVENTF_RIGHTDOWN);
else if (keys[i] == 258) InputMethods.MouseEvent(InputMethods.MOUSEEVENTF_MIDDLEDOWN);
else if (keys[i] == 259) InputMethods.MouseEvent(InputMethods.MOUSEEVENTF_XBUTTONDOWN, 1);
else if (keys[i] == 260) InputMethods.MouseEvent(InputMethods.MOUSEEVENTF_XBUTTONDOWN, 2);
else
InputMethods.performKeyPress(keys[i]);
}
for (int i = keys.Length - 1; i >= 0; i--)
{
if (keys[i] == 256) InputMethods.MouseEvent(InputMethods.MOUSEEVENTF_LEFTUP); //anything above 255 is not a keyvalue
else if (keys[i] == 257) InputMethods.MouseEvent(InputMethods.MOUSEEVENTF_RIGHTUP);
else if (keys[i] == 258) InputMethods.MouseEvent(InputMethods.MOUSEEVENTF_MIDDLEUP);
else if (keys[i] == 259) InputMethods.MouseEvent(InputMethods.MOUSEEVENTF_XBUTTONUP, 1);
else if (keys[i] == 260) InputMethods.MouseEvent(InputMethods.MOUSEEVENTF_XBUTTONUP, 2);
else if (keys[i] < 300)
InputMethods.performKeyRelease(keys[i]);
}
}
else if (!timedmacro)
{
for (int i = 0; i < keys.Length; i++)
{
if (i > 0 && keys[i - 1] > 300)
{
if (keys[i] == 256) deviceState.currentClicks.leftCount++; //anything above 255 is not a keyvalue
if (keys[i] == 257) deviceState.currentClicks.rightCount++;
if (keys[i] == 258) deviceState.currentClicks.middleCount++;
if (keys[i] == 259) deviceState.currentClicks.fourthCount++;
if (keys[i] == 260) deviceState.currentClicks.fifthCount++;
SyntheticState.KeyPresses kp;
if (!deviceState.keyPresses.TryGetValue(keys[i], out kp))
deviceState.keyPresses[keys[i]] = kp = new SyntheticState.KeyPresses();
if (keyType.HasFlag(DS4KeyType.ScanCode))
kp.current.scanCodeCount++;
else
kp.current.vkCount++;
kp.current.repeatCount++;
}
else if (keys[i] < 261)
{
if (keys[i] == 256) deviceState.currentClicks.leftCount++; //anything above 255 is not a keyvalue
if (keys[i] == 257) deviceState.currentClicks.rightCount++;
if (keys[i] == 258) deviceState.currentClicks.middleCount++;
@ -473,6 +567,10 @@ namespace DS4Control
}
}
}
}
else if (!getBoolMapping(customKey.Key, cState))
macrodone[DS4ControltoInt(customKey.Key)] = false;
}
foreach (KeyValuePair<DS4Controls, ushort> customKey in Global.getCustomKeys(device))
{
DS4KeyType keyType = Global.getCustomKeyType(device, customKey.Key);
@ -502,7 +600,7 @@ namespace DS4Control
}
bool LX = false, LY = false, RX = false, RY = false;
bool LX = false, LY = false, RX = false, RY = false, L2 = false, R2 = false;
MappedState.LX = 127;
MappedState.LY = 127;
MappedState.RX = 127;
@ -668,11 +766,19 @@ namespace DS4Control
break;
case X360Controls.LT:
if (MappedState.L2 == 0)
{
MappedState.L2 = getByteMapping(customButton.Key, cState);
L2 = true;
}
break;
case X360Controls.RT:
if (MappedState.R2 == 0)
if (MappedState.L2 == 0 && MappedState.R2 == 0)
{
MappedState.R2 = getByteMapping(customButton.Key, cState);
//if (MappedState.R2 == 255)
//MessageBox.Show("225");
R2 = true;
}
break;
case X360Controls.LeftMouse:
if (getBoolMapping(customButton.Key, cState))
@ -705,28 +811,28 @@ namespace DS4Control
case X360Controls.MouseUp:
if (MouseDeltaY == 0)
{
MouseDeltaY = getMouseMapping(device, customButton.Key, cState, pState, 0);
MouseDeltaY = getMouseMapping(device, customButton.Key, cState, 0);
MouseDeltaY = -Math.Abs((MouseDeltaY == -2147483648 ? 0 : MouseDeltaY));
}
break;
case X360Controls.MouseDown:
if (MouseDeltaY == 0)
{
MouseDeltaY = getMouseMapping(device, customButton.Key, cState, pState, 1);
MouseDeltaY = getMouseMapping(device, customButton.Key, cState, 1);
MouseDeltaY = Math.Abs((MouseDeltaY == -2147483648 ? 0 : MouseDeltaY));
}
break;
case X360Controls.MouseLeft:
if (MouseDeltaX == 0)
{
MouseDeltaX = getMouseMapping(device, customButton.Key, cState, pState, 2);
MouseDeltaX = getMouseMapping(device, customButton.Key, cState, 2);
MouseDeltaX = -Math.Abs((MouseDeltaX == -2147483648 ? 0 : MouseDeltaX));
}
break;
case X360Controls.MouseRight:
if (MouseDeltaX == 0)
{
MouseDeltaX = getMouseMapping(device, customButton.Key, cState, pState, 3);
MouseDeltaX = getMouseMapping(device, customButton.Key, cState, 3);
MouseDeltaX = Math.Abs((MouseDeltaX == -2147483648 ? 0 : MouseDeltaX));
}
break;
@ -741,11 +847,15 @@ namespace DS4Control
MappedState.RX = cState.RX;
if (!RY)
MappedState.RY = cState.RY;
/*if (!L2)
MappedState.L2 = cState.L2;
if (!R2)
MappedState.R2 = cState.R2;//*/
InputMethods.MoveCursorBy(MouseDeltaX, MouseDeltaY);
}
public static DateTime[] mousenow = { DateTime.UtcNow, DateTime.UtcNow, DateTime.UtcNow, DateTime.UtcNow };
public static double mvalue = 0;
private static int getMouseMapping(int device, DS4Controls control, DS4State cState, DS4State pState, int mnum)
private static int getMouseMapping(int device, DS4Controls control, DS4State cState, int mnum)
{
int deadzone = 10;

View File

@ -81,8 +81,17 @@ namespace DS4Control
{
protected static BackingStore m_Config = new BackingStore();
protected static Int32 m_IdleTimeout = 600000;
//public static string appdatapath = Directory.GetParent(Assembly.GetExecutingAssembly().Location).FullName;
public static string appdatapath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\DS4Tool";
static string exepath = Directory.GetParent(Assembly.GetExecutingAssembly().Location).FullName;
public static string appdatapath;
public static void SaveWhere()
{
if (!exepath.StartsWith("C:\\Program Files") && !exepath.StartsWith("C:\\Windows"))
appdatapath = Directory.GetParent(Assembly.GetExecutingAssembly().Location).FullName;
else
appdatapath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\DS4Tool";
m_Config.m_Profile = appdatapath + "\\Profiles.xml";
}
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)
{
@ -534,7 +543,8 @@ namespace DS4Control
public class BackingStore
{
protected String m_Profile = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\DS4Tool" + "\\Profiles.xml";
//public String m_Profile = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\DS4Tool" + "\\Profiles.xml";
public String m_Profile = Directory.GetParent(Assembly.GetExecutingAssembly().Location).FullName + "\\Profiles.xml";
protected XmlDocument m_Xdoc = new XmlDocument();
//fifth value used to for options, not fifth controller
public int[] buttonMouseSensitivity = { 25, 25, 25, 25, 25 };
@ -972,6 +982,7 @@ namespace DS4Control
else if (keys[i] == 258) splitter[i] = "Middle Mouse Button";
else if (keys[i] == 259) splitter[i] = "4th Mouse Button";
else if (keys[i] == 260) splitter[i] = "5th Mouse Button";
else if (keys[i] > 300) splitter[i] = "Wait " + (keys[i] - 300) + "ms";
}
button.Text = string.Join(", ", splitter);
button.Tag = keys;

View File

@ -9,8 +9,9 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>DS4Library</RootNamespace>
<AssemblyName>DS4Library</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@ -20,6 +21,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@ -29,6 +31,7 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />

View File

@ -9,8 +9,9 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>DS4Service</RootNamespace>
<AssemblyName>DS4Service</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
@ -21,6 +22,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
@ -30,6 +32,7 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
@ -73,6 +76,9 @@
<DependentUpon>ProjectInstaller.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.

3
DS4Service/app.config Normal file
View File

@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/></startup></configuration>

48
DS4Tool/Alreadyrunning.Designer.cs generated Normal file
View File

@ -0,0 +1,48 @@
namespace ScpServer
{
partial class Alreadyrunning
{
/// <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.SuspendLayout();
//
// Alreadyrunning
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(226, 43);
this.Name = "Alreadyrunning";
this.ShowInTaskbar = false;
this.Text = "Alreadyrunning";
this.ResumeLayout(false);
}
#endregion
}
}

36
DS4Tool/Alreadyrunning.cs Normal file
View File

@ -0,0 +1,36 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace ScpServer
{
public partial class Alreadyrunning : Form
{
Stopwatch sw;
public Alreadyrunning()
{
InitializeComponent();
this.WindowState = FormWindowState.Minimized;
Hide();
Timer t = new Timer();
t.Start();
t.Tick += t_Tick;
sw = new Stopwatch();
sw.Start();
}
void t_Tick(object sender, EventArgs e)
{
if (sw.ElapsedMilliseconds >= 10)
this.Close();
}
}
}

120
DS4Tool/Alreadyrunning.resx Normal file
View File

@ -0,0 +1,120 @@
<?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

@ -90,6 +90,12 @@
</ItemGroup>
<ItemGroup>
<Compile Include="AdvancedColorDialog.cs" />
<Compile Include="Alreadyrunning.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Alreadyrunning.Designer.cs">
<DependentUpon>Alreadyrunning.cs</DependentUpon>
</Compile>
<Compile Include="Hotkeys.cs">
<SubType>Form</SubType>
</Compile>
@ -145,6 +151,9 @@
<Compile Include="WinProgs.Designer.cs">
<DependentUpon>WinProgs.cs</DependentUpon>
</Compile>
<EmbeddedResource Include="Alreadyrunning.resx">
<DependentUpon>Alreadyrunning.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Hotkeys.resx">
<DependentUpon>Hotkeys.cs</DependentUpon>
</EmbeddedResource>

View File

@ -184,8 +184,14 @@
this.KBMlabel = new System.Windows.Forms.Label();
this.cBMacro = new System.Windows.Forms.CheckBox();
this.lBMacroOrder = new System.Windows.Forms.Label();
this.pnLDelay = new System.Windows.Forms.Panel();
this.lBDelay = new System.Windows.Forms.Label();
this.nUDDelay = new System.Windows.Forms.NumericUpDown();
this.lBms = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.pnLDelay.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.nUDDelay)).BeginInit();
this.SuspendLayout();
//
// lBTip
@ -1720,7 +1726,7 @@
// X360Label
//
this.X360Label.AutoSize = true;
this.X360Label.Location = new System.Drawing.Point(394, 210);
this.X360Label.Location = new System.Drawing.Point(393, 202);
this.X360Label.Name = "X360Label";
this.X360Label.Size = new System.Drawing.Size(73, 13);
this.X360Label.TabIndex = 318;
@ -1757,11 +1763,54 @@
this.lBMacroOrder.Text = "Macro Order: ";
this.lBMacroOrder.Visible = false;
//
// pnLDelay
//
this.pnLDelay.Controls.Add(this.nUDDelay);
this.pnLDelay.Controls.Add(this.lBms);
this.pnLDelay.Controls.Add(this.lBDelay);
this.pnLDelay.Location = new System.Drawing.Point(12, 200);
this.pnLDelay.Name = "pnLDelay";
this.pnLDelay.Size = new System.Drawing.Size(183, 23);
this.pnLDelay.TabIndex = 320;
this.pnLDelay.Visible = false;
//
// lBDelay
//
this.lBDelay.AutoSize = true;
this.lBDelay.Location = new System.Drawing.Point(3, 2);
this.lBDelay.Name = "lBDelay";
this.lBDelay.Size = new System.Drawing.Size(56, 13);
this.lBDelay.TabIndex = 0;
this.lBDelay.Text = "Add Delay";
//
// nUDDelay
//
this.nUDDelay.Location = new System.Drawing.Point(65, 0);
this.nUDDelay.Maximum = new decimal(new int[] {
60000,
0,
0,
0});
this.nUDDelay.Name = "nUDDelay";
this.nUDDelay.Size = new System.Drawing.Size(77, 20);
this.nUDDelay.TabIndex = 1;
this.nUDDelay.ValueChanged += new System.EventHandler(this.nUDDelay_ValueChanged);
//
// lBms
//
this.lBms.AutoSize = true;
this.lBms.Location = new System.Drawing.Point(148, 2);
this.lBms.Name = "lBms";
this.lBms.Size = new System.Drawing.Size(20, 13);
this.lBms.TabIndex = 0;
this.lBms.Text = "ms";
//
// KBM360
//
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.ClientSize = new System.Drawing.Size(854, 403);
this.Controls.Add(this.pnLDelay);
this.Controls.Add(this.lBMacroOrder);
this.Controls.Add(this.KBMlabel);
this.Controls.Add(this.X360Label);
@ -1928,6 +1977,9 @@
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.Key_Down_Action);
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.pnLDelay.ResumeLayout(false);
this.pnLDelay.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.nUDDelay)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
@ -2091,6 +2143,10 @@
private System.Windows.Forms.Label KBMlabel;
private System.Windows.Forms.CheckBox cBMacro;
private System.Windows.Forms.Label lBMacroOrder;
private System.Windows.Forms.Panel pnLDelay;
private System.Windows.Forms.NumericUpDown nUDDelay;
private System.Windows.Forms.Label lBms;
private System.Windows.Forms.Label lBDelay;
}
}

View File

@ -82,6 +82,11 @@ namespace ScpServer
if (!bn.Font.Bold && bn.Tag.ToString() != "X360" && macrostag.Count < 5 && (bn.Text.Contains("Mouse") ^ !bn.Text.Contains("Button"))) //end is xor to remove mouse movement and wheel from macro
{
bn.Font = new Font(bn.Font, FontStyle.Bold);
if (nUDDelay.Value >= 1)
{
macros.Add("Wait " + (int)nUDDelay.Value + "ms");
macrostag.Add(300 + (int)nUDDelay.Value);
}
macros.Add(keyname);
int value;
if (int.TryParse(bn.Tag.ToString(), out value))
@ -98,10 +103,18 @@ namespace ScpServer
else if (bn.Tag.ToString() != "X360")
{
bn.Font = new Font(bn.Font, FontStyle.Regular);
macros.Remove(keyname);
int value;
if (int.TryParse(bn.Tag.ToString(), out value))
{
int previ = macrostag.IndexOf(value) - 1;
if (previ > -1 && macrostag[previ] > 300)
{
macros.RemoveAt(previ);
macrostag.RemoveAt(previ);
}
macrostag.Remove(value);
macros.Remove(keyname);
}
else
{
if (bn.Text == "Left Mouse Button") macrostag.Remove(256);
@ -111,6 +124,11 @@ namespace ScpServer
if (bn.Text == "5th Mouse Button") macrostag.Remove(260);
}
}
nUDDelay.Value = 0;
if (macrostag.Count >= 4)
pnLDelay.Enabled = false;
else
pnLDelay.Enabled = true;
string macro = string.Join(", ", macros.ToArray());
lBMacroOrder.Text = "Macro Order: " + macro;
}
@ -128,14 +146,18 @@ namespace ScpServer
}
private void Key_Down_Action(object sender, KeyEventArgs e)
{
if (!cBMacro.Checked)
{
ops.ChangeButtonText(e.KeyCode.ToString(), e.KeyValue);
this.Close();
}
}
private void cBMacro_CheckedChanged(object sender, EventArgs e)
{
lBMacroOrder.Visible = cBMacro.Checked;
pnLDelay.Visible = cBMacro.Checked;
if (cBMacro.Checked)
cbToggle.Checked = false;
}
@ -146,5 +168,10 @@ namespace ScpServer
cBMacro.Checked = false;
}
private void nUDDelay_ValueChanged(object sender, EventArgs e)
{
}
}
}

View File

@ -700,7 +700,7 @@
this.pBSticks.Location = new System.Drawing.Point(0, 1);
this.pBSticks.Name = "pBSticks";
this.pBSticks.Size = new System.Drawing.Size(245, 132);
this.pBSticks.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
this.pBSticks.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.pBSticks.TabIndex = 161;
this.pBSticks.TabStop = false;
//

View File

@ -1,10 +1,21 @@
using System;
using System.Windows.Forms;
using System.Threading;
using System.Runtime.InteropServices;
using System.Diagnostics;
namespace ScpServer
{
static class Program
{
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool SetForegroundWindow(IntPtr hWnd);
[DllImport("user32.dll")]
private static extern IntPtr GetForegroundWindow();
/// <summary>
/// The main entry point for the application.
/// </summary>
@ -20,9 +31,34 @@ namespace ScpServer
{
// Ignore problems raising the priority.
}
bool createdNew = true;
using (Mutex mutex = new Mutex(true, "MyApplicationName", out createdNew))
{
if (createdNew)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new ScpForm());
}
else
{
Process current = Process.GetCurrentProcess();
foreach (Process process in Process.GetProcessesByName(current.ProcessName))
{
if (process.Id != current.Id)
{
SetForegroundWindow(process.MainWindowHandle);
if (GetForegroundWindow() != process.MainWindowHandle)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Alreadyrunning());
}
break;
}
}
}
}
}
}
}

View File

@ -120,8 +120,9 @@
this.linkProfiles = new System.Windows.Forms.LinkLabel();
this.lLBUpdate = new System.Windows.Forms.LinkLabel();
this.linkUninstall = new System.Windows.Forms.LinkLabel();
this.saveProfiles = new System.Windows.Forms.SaveFileDialog();
this.lLSetup = new System.Windows.Forms.LinkLabel();
this.saveProfiles = new System.Windows.Forms.SaveFileDialog();
this.lLAppDataDelete = new System.Windows.Forms.LinkLabel();
this.pnlButton.SuspendLayout();
this.cMTaskbar.SuspendLayout();
this.tabMain.SuspendLayout();
@ -179,6 +180,7 @@
this.pnlButton.Controls.Add(this.lBTest);
this.pnlButton.Controls.Add(this.btnStartStop);
this.pnlButton.Controls.Add(this.lbLastMessage);
this.pnlButton.Controls.Add(this.llbHelp);
this.pnlButton.Dock = System.Windows.Forms.DockStyle.Bottom;
this.pnlButton.Location = new System.Drawing.Point(0, 339);
this.pnlButton.Name = "pnlButton";
@ -189,7 +191,7 @@
//
this.lBTest.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.lBTest.AutoSize = true;
this.lBTest.Location = new System.Drawing.Point(625, 9);
this.lBTest.Location = new System.Drawing.Point(291, 9);
this.lBTest.Name = "lBTest";
this.lBTest.Size = new System.Drawing.Size(98, 13);
this.lBTest.TabIndex = 46;
@ -214,14 +216,14 @@
this.lbLastMessage.ForeColor = System.Drawing.SystemColors.GrayText;
this.lbLastMessage.Location = new System.Drawing.Point(4, 9);
this.lbLastMessage.Name = "lbLastMessage";
this.lbLastMessage.Size = new System.Drawing.Size(724, 18);
this.lbLastMessage.Size = new System.Drawing.Size(634, 18);
this.lbLastMessage.TabIndex = 41;
//
// llbHelp
//
this.llbHelp.Anchor = System.Windows.Forms.AnchorStyles.None;
this.llbHelp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.llbHelp.AutoSize = true;
this.llbHelp.Location = new System.Drawing.Point(198, 30);
this.llbHelp.Location = new System.Drawing.Point(644, 9);
this.llbHelp.Name = "llbHelp";
this.llbHelp.Size = new System.Drawing.Size(79, 13);
this.llbHelp.TabIndex = 13;
@ -233,12 +235,12 @@
//
this.lnkControllers.Anchor = System.Windows.Forms.AnchorStyles.None;
this.lnkControllers.AutoSize = true;
this.lnkControllers.Location = new System.Drawing.Point(383, 30);
this.lnkControllers.Location = new System.Drawing.Point(269, 30);
this.lnkControllers.Name = "lnkControllers";
this.lnkControllers.Size = new System.Drawing.Size(122, 13);
this.lnkControllers.Size = new System.Drawing.Size(73, 13);
this.lnkControllers.TabIndex = 11;
this.lnkControllers.TabStop = true;
this.lnkControllers.Text = "Control Panel Controllers";
this.lnkControllers.Text = "CP Controllers";
this.lnkControllers.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.lnkControllers_LinkClicked);
//
// StartWindowsCheckBox
@ -408,7 +410,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, 47F));
this.tLPControllers.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 50F));
this.tLPControllers.Controls.Add(this.pBStatus1, 1, 1);
this.tLPControllers.Controls.Add(this.lbPad1, 0, 1);
this.tLPControllers.Controls.Add(this.lbPad2, 0, 2);
@ -450,7 +452,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(372, 19);
this.pBStatus1.Location = new System.Drawing.Point(369, 19);
this.pBStatus1.Name = "pBStatus1";
this.pBStatus1.Size = new System.Drawing.Size(39, 20);
this.pBStatus1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
@ -482,7 +484,7 @@
// bnEditC3
//
this.bnEditC3.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.bnEditC3.Location = new System.Drawing.Point(741, 76);
this.bnEditC3.Location = new System.Drawing.Point(737, 76);
this.bnEditC3.Name = "bnEditC3";
this.bnEditC3.Size = new System.Drawing.Size(40, 23);
this.bnEditC3.TabIndex = 43;
@ -494,7 +496,7 @@
// bnEditC4
//
this.bnEditC4.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.bnEditC4.Location = new System.Drawing.Point(741, 105);
this.bnEditC4.Location = new System.Drawing.Point(737, 105);
this.bnEditC4.Name = "bnEditC4";
this.bnEditC4.Size = new System.Drawing.Size(40, 23);
this.bnEditC4.TabIndex = 43;
@ -530,7 +532,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(624, 19);
this.cBController1.Location = new System.Drawing.Point(620, 19);
this.cBController1.Name = "cBController1";
this.cBController1.Size = new System.Drawing.Size(111, 21);
this.cBController1.TabIndex = 42;
@ -540,7 +542,7 @@
// bnEditC2
//
this.bnEditC2.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.bnEditC2.Location = new System.Drawing.Point(741, 47);
this.bnEditC2.Location = new System.Drawing.Point(737, 47);
this.bnEditC2.Name = "bnEditC2";
this.bnEditC2.Size = new System.Drawing.Size(40, 23);
this.bnEditC2.TabIndex = 43;
@ -554,7 +556,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(624, 48);
this.cBController2.Location = new System.Drawing.Point(620, 48);
this.cBController2.Name = "cBController2";
this.cBController2.Size = new System.Drawing.Size(111, 21);
this.cBController2.TabIndex = 42;
@ -566,7 +568,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(624, 77);
this.cBController3.Location = new System.Drawing.Point(620, 77);
this.cBController3.Name = "cBController3";
this.cBController3.Size = new System.Drawing.Size(111, 21);
this.cBController3.TabIndex = 42;
@ -576,7 +578,7 @@
// bnEditC1
//
this.bnEditC1.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.bnEditC1.Location = new System.Drawing.Point(741, 18);
this.bnEditC1.Location = new System.Drawing.Point(737, 18);
this.bnEditC1.Name = "bnEditC1";
this.bnEditC1.Size = new System.Drawing.Size(40, 23);
this.bnEditC1.TabIndex = 43;
@ -590,7 +592,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(624, 106);
this.cBController4.Location = new System.Drawing.Point(620, 106);
this.cBController4.Name = "cBController4";
this.cBController4.Size = new System.Drawing.Size(111, 21);
this.cBController4.TabIndex = 42;
@ -602,7 +604,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(625, 0);
this.lBSelectedProfile.Location = new System.Drawing.Point(621, 0);
this.lBSelectedProfile.Name = "lBSelectedProfile";
this.lBSelectedProfile.Size = new System.Drawing.Size(109, 15);
this.lBSelectedProfile.TabIndex = 45;
@ -624,7 +626,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(368, 0);
this.lBStatus.Location = new System.Drawing.Point(365, 0);
this.lBStatus.Name = "lBStatus";
this.lBStatus.Size = new System.Drawing.Size(47, 15);
this.lBStatus.TabIndex = 45;
@ -635,7 +637,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(517, 0);
this.lBBattery.Location = new System.Drawing.Point(513, 0);
this.lBBattery.Name = "lBBattery";
this.lBBattery.Size = new System.Drawing.Size(51, 15);
this.lBBattery.TabIndex = 45;
@ -646,7 +648,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(523, 22);
this.lBBatt1.Location = new System.Drawing.Point(519, 22);
this.lBBatt1.Name = "lBBatt1";
this.lBBatt1.Size = new System.Drawing.Size(39, 15);
this.lBBatt1.TabIndex = 44;
@ -657,7 +659,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(523, 51);
this.lBBatt2.Location = new System.Drawing.Point(519, 51);
this.lBBatt2.Name = "lBBatt2";
this.lBBatt2.Size = new System.Drawing.Size(39, 15);
this.lBBatt2.TabIndex = 44;
@ -668,7 +670,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(523, 80);
this.lBBatt3.Location = new System.Drawing.Point(519, 80);
this.lBBatt3.Name = "lBBatt3";
this.lBBatt3.Size = new System.Drawing.Size(39, 15);
this.lBBatt3.TabIndex = 44;
@ -679,7 +681,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(523, 109);
this.lBBatt4.Location = new System.Drawing.Point(519, 109);
this.lBBatt4.Name = "lBBatt4";
this.lBBatt4.Size = new System.Drawing.Size(39, 15);
this.lBBatt4.TabIndex = 44;
@ -690,7 +692,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(372, 48);
this.pBStatus2.Location = new System.Drawing.Point(369, 48);
this.pBStatus2.Name = "pBStatus2";
this.pBStatus2.Size = new System.Drawing.Size(39, 20);
this.pBStatus2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
@ -702,7 +704,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(372, 77);
this.pBStatus3.Location = new System.Drawing.Point(369, 77);
this.pBStatus3.Name = "pBStatus3";
this.pBStatus3.Size = new System.Drawing.Size(39, 20);
this.pBStatus3.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
@ -714,7 +716,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(372, 106);
this.pBStatus4.Location = new System.Drawing.Point(369, 106);
this.pBStatus4.Name = "pBStatus4";
this.pBStatus4.Size = new System.Drawing.Size(39, 20);
this.pBStatus4.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
@ -1011,12 +1013,12 @@
this.flowLayoutPanel1.Controls.Add(this.cBNotifications);
this.flowLayoutPanel1.Controls.Add(this.cBUpdate);
this.flowLayoutPanel1.Controls.Add(this.pNUpdate);
this.flowLayoutPanel1.Controls.Add(this.llbHelp);
this.flowLayoutPanel1.Controls.Add(this.linkProfiles);
this.flowLayoutPanel1.Controls.Add(this.lnkControllers);
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";
@ -1098,18 +1100,18 @@
//
this.linkProfiles.Anchor = System.Windows.Forms.AnchorStyles.None;
this.linkProfiles.AutoSize = true;
this.linkProfiles.Location = new System.Drawing.Point(283, 30);
this.linkProfiles.Location = new System.Drawing.Point(198, 30);
this.linkProfiles.Name = "linkProfiles";
this.linkProfiles.Size = new System.Drawing.Size(94, 13);
this.linkProfiles.Size = new System.Drawing.Size(65, 13);
this.linkProfiles.TabIndex = 50;
this.linkProfiles.TabStop = true;
this.linkProfiles.Text = "Open Profile folder";
this.linkProfiles.Text = "Profile folder";
this.linkProfiles.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkProfiles_LinkClicked);
//
// lLBUpdate
//
this.lLBUpdate.Anchor = System.Windows.Forms.AnchorStyles.None;
this.lLBUpdate.Location = new System.Drawing.Point(511, 25);
this.lLBUpdate.Location = new System.Drawing.Point(348, 25);
this.lLBUpdate.Name = "lLBUpdate";
this.lLBUpdate.Size = new System.Drawing.Size(116, 23);
this.lLBUpdate.TabIndex = 49;
@ -1121,7 +1123,7 @@
// linkUninstall
//
this.linkUninstall.Anchor = System.Windows.Forms.AnchorStyles.None;
this.linkUninstall.Location = new System.Drawing.Point(633, 25);
this.linkUninstall.Location = new System.Drawing.Point(470, 25);
this.linkUninstall.Name = "linkUninstall";
this.linkUninstall.Size = new System.Drawing.Size(106, 23);
this.linkUninstall.TabIndex = 44;
@ -1130,15 +1132,11 @@
this.linkUninstall.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.linkUninstall.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkUninstall_LinkClicked);
//
// saveProfiles
//
this.saveProfiles.Filter = "XML Files (*.xml)|*.xml";
//
// lLSetup
//
this.lLSetup.Anchor = System.Windows.Forms.AnchorStyles.None;
this.lLSetup.AutoSize = true;
this.lLSetup.Location = new System.Drawing.Point(3, 51);
this.lLSetup.Location = new System.Drawing.Point(582, 30);
this.lLSetup.Name = "lLSetup";
this.lLSetup.Size = new System.Drawing.Size(82, 13);
this.lLSetup.TabIndex = 52;
@ -1146,6 +1144,22 @@
this.lLSetup.Text = "Controller Setup";
this.lLSetup.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.lLSetup_LinkClicked);
//
// saveProfiles
//
this.saveProfiles.Filter = "XML Files (*.xml)|*.xml";
//
// 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);
//
// ScpForm
//
this.AllowDrop = true;
@ -1155,9 +1169,10 @@
this.ClientSize = new System.Drawing.Size(794, 369);
this.Controls.Add(this.tabMain);
this.Controls.Add(this.pnlButton);
this.MinimumSize = new System.Drawing.Size(420, 137);
this.MinimumSize = new System.Drawing.Size(420, 231);
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.Load += new System.EventHandler(this.Form_Load);
this.DragDrop += new System.Windows.Forms.DragEventHandler(this.ScpForm_DragDrop);
@ -1286,6 +1301,7 @@
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;
double version = 10.2;
private DS4Control.Control rootHub;
delegate void LogDebugDelegate(DateTime Time, String Data);
@ -30,7 +30,6 @@ namespace ScpServer
Timer test = new Timer(), hotkeystimer = new Timer();
string exepath = Directory.GetParent(Assembly.GetExecutingAssembly().Location).FullName;
float dpix, dpiy;
string filename;
DateTime oldnow = DateTime.UtcNow;
string tempprofile = "null";
List<string> profilenames= new List<string>();
@ -64,32 +63,15 @@ namespace ScpServer
[DllImport("user32.dll")]
private static extern uint GetWindowThreadProcessId(IntPtr hWnd, out uint lpdwProcessId);
//HANDLE WINAPI OpenProcess(
// __in DWORD dwDesiredAccess,
// __in BOOL bInheritHandle,
// __in DWORD dwProcessId
//);
[DllImport("kernel32.dll")]
private static extern IntPtr OpenProcess(uint dwDesiredAccess, bool bInheritHandle, uint dwProcessId);
[DllImport("kernel32.dll")]
private static extern bool CloseHandle(IntPtr handle);
// DWORD WINAPI GetModuleBaseName(
// __in HANDLE hProcess,
// __in_opt HMODULE hModule,
// __out LPTSTR lpBaseName,
// __in DWORD nSize
// );
[DllImport("psapi.dll")]
private static extern uint GetModuleBaseName(IntPtr hWnd, IntPtr hModule, StringBuilder lpFileName, int nSize);
// DWORD WINAPI GetModuleFileNameEx(
// __in HANDLE hProcess,
// __in_opt HMODULE hModule,
// __out LPTSTR lpFilename,
// __in DWORD nSize
// );
[DllImport("psapi.dll")]
private static extern uint GetModuleFileNameEx(IntPtr hWnd, IntPtr hModule, StringBuilder lpFileName, int nSize);
@ -105,9 +87,7 @@ namespace ScpServer
LoadP();
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;
//MessageBox.Show(Path.GetFileNameWithoutExtension(GetTopWindowName()));
tt.SetToolTip(lLAppDataDelete, @"Delete Appdata\DS4Tool folder as it's no longer in use");
}
public static string GetTopWindowName()
@ -144,6 +124,17 @@ namespace ScpServer
protected void Form_Load(object sender, EventArgs e)
{
SetupArrays();
if (!exepath.StartsWith("C:\\Program Files") && !exepath.StartsWith("C:\\Windows"))
{
if (!File.Exists("Profiles.xml") &&
File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\DS4Tool\Profiles.xml"))
File.Copy(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\DS4Tool\Profiles.xml",
"Profiles.xml", false);
if (!File.Exists("Auto Profiles.xml") &&
File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\DS4Tool\Auto Profiles.xml"))
File.Copy(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\DS4Tool\Auto Profiles.xml",
"Auto Profiles.xml", false);
}
Graphics g = this.CreateGraphics();
try
@ -162,10 +153,16 @@ namespace ScpServer
Log.GuiLog += On_Debug;
Log.TrayIconLog += ShowNotification;
// tmrUpdate.Enabled = true; TODO remove tmrUpdate and leave tick()
Global.SaveWhere();
if (!File.Exists(Global.appdatapath + @"\Profiles.xml"))
{
WelcomeDialog wd = new WelcomeDialog();
wd.ShowDialog();
}
Directory.CreateDirectory(Global.appdatapath);
Global.Load();
Global.setVersion(version);
Global.Save();
foreach (ToolStripMenuItem t in shortcuts)
t.DropDownItemClicked += Profile_Changed_Menu;
hideDS4CheckBox.CheckedChanged -= hideDS4CheckBox_CheckedChanged;
@ -190,6 +187,7 @@ namespace ScpServer
RefreshProfiles();
for (int i = 0; i < 4; i++)
Global.LoadProfile(i);
Global.ControllerStatusChange += ControllerStatusChange;
ControllerStatusChanged();
if (btnStartStop.Enabled)
@ -208,12 +206,8 @@ namespace ScpServer
nUDUpdateTime.Value = checkwhen;
}
Uri url = new Uri("https://dl.dropboxusercontent.com/u/16364552/DS4Tool/newest%20version.txt"); //Sorry other devs, gonna have to find your own server
if (!Directory.Exists(Global.appdatapath))
{
WelcomeDialog wd = new WelcomeDialog();
wd.ShowDialog();
}
Directory.CreateDirectory(Global.appdatapath);
if (checkwhen > 0 && DateTime.Now >= Global.getLastChecked() + TimeSpan.FromHours(checkwhen))
{
wc.DownloadFileAsync(url, Global.appdatapath + "\\version.txt");
@ -230,12 +224,18 @@ namespace ScpServer
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;
}
private void test_Tick(object sender, EventArgs e)
{
lBTest.Visible = true;
lBTest.Text = filename;
lBTest.Text = Mapping.getByteMapping(DS4Controls.R1, rootHub.getDS4State(0)).ToString() + " " + rootHub.getDS4StateMapped(0).R2.ToString();
//lBTest.Text = rootHub.getDS4StateMapped(0).L2.ToString();
}
void Hotkeys(object sender, EventArgs e)
{
@ -260,24 +260,31 @@ namespace ScpServer
if (tempprofile == "null")
for (int i = 0; i < programpaths.Count; i++)
{
string name = Path.GetFileNameWithoutExtension(programpaths[i]);
if (programpaths[i].ToLower() == GetTopWindowName().ToLower())
string name = programpaths[i].ToLower().Replace('/', '\\');
if (name == GetTopWindowName().ToLower().Replace('/', '\\'))
{
for (int j = 0; j < 4; j++)
if (proprofiles[j][i] != "(none)")
Global.LoadTempProfile(j, proprofiles[j][i]); //j is controller index, i is filename
tempprofile = programpaths[i].ToLower();
tempprofile = name;
}
}
else
{
if (tempprofile != GetTopWindowName().ToLower())
if (tempprofile != GetTopWindowName().ToLower().Replace('/', '\\'))
{
tempprofile = "null";
for (int j = 0; j < 4; j++)
Global.LoadProfile(j);
}
}
if (Process.GetProcessesByName("DS4Tool").Length + Process.GetProcessesByName("DS4Windows").Length > 1)
{//The second process closes and this one comes in focus
Show();
WindowState = FormWindowState.Normal;
ShowInTaskbar = true;
Focus();
}
#region Old Process check
/*DateTime now = DateTime.UtcNow;
if (now >= oldnow + TimeSpan.FromSeconds(2))
@ -428,6 +435,20 @@ namespace ScpServer
}
}
catch (DirectoryNotFoundException)
{
if (Global.appdatapath == Directory.GetParent(Assembly.GetExecutingAssembly().Location).FullName)
{
if (Directory.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\DS4Tool" + @"\Profiles\"))
MessageBox.Show("Please import or make a profile", "Profile Folder Moved to program folder");
Directory.CreateDirectory(Global.appdatapath + @"\Profiles\");
for (int i = 0; i < 4; i++)
{
cbs[i].Text = "(No Profile Loaded)";
shortcuts[i].Text = "Make Profile for Controller " + (i + 1);
ebns[i].Text = "New";
}
}
else
{
if (Directory.Exists(Directory.GetParent(Assembly.GetExecutingAssembly().Location).FullName + @"\Profiles\"))
MessageBox.Show("Please import or make a profile", "Profile Folder Moved");
@ -439,6 +460,7 @@ namespace ScpServer
ebns[i].Text = "New";
}
}
}
finally
{
for (int i = 0; i < 4; i++)
@ -517,7 +539,6 @@ namespace ScpServer
this.Show();
this.ShowInTaskbar = true;
}
//Added last message alternative
if (this.Height > 220)
@ -602,7 +623,7 @@ namespace ScpServer
if (Pads[Index].Text != "Connecting...")
{
Enable_Controls(Index, true);
MinimumSize = new Size(MinimumSize.Width, 137 + 29 * Index);
//MinimumSize = new Size(MinimumSize.Width, 137 + 29 * Index);
}
}
else
@ -732,6 +753,9 @@ namespace ScpServer
private void tSBImportProfile_Click(object sender, EventArgs e)
{
if (Global.appdatapath == Directory.GetParent(Assembly.GetExecutingAssembly().Location).FullName)
openProfiles.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\DS4Tool" + @"\Profiles\";
else
openProfiles.InitialDirectory = Directory.GetParent(Assembly.GetExecutingAssembly().Location).FullName + @"\Profiles\";
if (openProfiles.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
@ -951,34 +975,6 @@ namespace ScpServer
private void tabMain_SelectedIndexChanged(object sender, EventArgs e)
{
lbLastMessage.Visible = tabMain.SelectedIndex != 2;
if (tabMain.SelectedIndex == 3 && opt == null)
{
if (dpix == 120)
{
if (this.Size.Width < 930 || this.Size.Height < 392)
oldsize = Size;
if (this.Size.Height < 415)
this.Size = new System.Drawing.Size(this.Size.Width, 392);
if (this.Size.Width < 930)
this.Size = new System.Drawing.Size(930, this.Size.Height);
}
else
{
if (this.Size.Width < 755 || this.Size.Height < 316)
oldsize = Size;
if (this.Size.Height < 316)
this.Size = new System.Drawing.Size(this.Size.Width, 316);
if (this.Size.Width < 755)
this.Size = new System.Drawing.Size(755, this.Size.Height);
}
}
else if (oldsize != new System.Drawing.Size(0, 0) && opt == null)
{
Size = oldsize;
oldsize = new System.Drawing.Size(0, 0);
}
}
private void lBProfiles_MouseDown(object sender, MouseEventArgs e)
@ -1137,6 +1133,22 @@ namespace ScpServer
Global.setCheckWhen((int)nUDUpdateTime.Value * 24);
if (nUDUpdateTime.Value < 1)
cBUpdate.Checked = false;
if (nUDUpdateTime.Value == 1)
{
int index = cBUpdateTime.SelectedIndex;
cBUpdateTime.Items.Clear();
cBUpdateTime.Items.Add("hour");
cBUpdateTime.Items.Add("day");
cBUpdateTime.SelectedIndex = index;
}
else if (cBUpdateTime.Items[0].ToString() == "hour")
{
int index = cBUpdateTime.SelectedIndex;
cBUpdateTime.Items.Clear();
cBUpdateTime.Items.Add("hours");
cBUpdateTime.Items.Add("days");
cBUpdateTime.SelectedIndex = index;
}
}
private void cBUpdateTime_SelectedIndexChanged(object sender, EventArgs e)
@ -1213,6 +1225,26 @@ namespace ScpServer
WelcomeDialog wd = new WelcomeDialog();
wd.ShowDialog();
}
private void ScpForm_Activated(object sender, EventArgs e)
{
if (!this.ShowInTaskbar)
{
this.Show();
this.ShowInTaskbar = true;
}
}
private void lLAppDataDelete_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
try { Directory.Delete(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\DS4Tool", true); }
catch{}
finally
{
MessageBox.Show("Old Settings Deleted");
lLAppDataDelete.Visible = false;
}
}
}
public class ThemeUtil

View File

@ -111,6 +111,7 @@ namespace ScpServer
}
catch { }
File.Delete(Global.appdatapath + "\\VBus.zip");
((Timer)sender).Stop();
}
}
else
@ -122,6 +123,7 @@ namespace ScpServer
{
bnStep1.Text = "Install Complete";
File.Delete(Global.appdatapath + "\\VBus.zip");
((Timer)sender).Stop();
}
}
}

View File

@ -40,14 +40,12 @@
this.lBController2 = new System.Windows.Forms.Label();
this.lBController3 = new System.Windows.Forms.Label();
this.lBController4 = new System.Windows.Forms.Label();
this.lBBeta = new System.Windows.Forms.Label();
this.openProgram = new System.Windows.Forms.OpenFileDialog();
this.bnDelete = new System.Windows.Forms.Button();
this.iLIcons = new System.Windows.Forms.ImageList(this.components);
this.lVPrograms = new System.Windows.Forms.ListView();
this.nameHeader = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.PathHeader = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.lBTip = new System.Windows.Forms.Label();
this.pBProfilesTip = new System.Windows.Forms.Label();
this.bnHideUnchecked = new System.Windows.Forms.Button();
this.cMSPrograms = new System.Windows.Forms.ContextMenuStrip(this.components);
@ -60,10 +58,9 @@
//
// bnAddPrograms
//
this.bnAddPrograms.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.bnAddPrograms.Location = new System.Drawing.Point(516, 195);
this.bnAddPrograms.Location = new System.Drawing.Point(5, 2);
this.bnAddPrograms.Name = "bnAddPrograms";
this.bnAddPrograms.Size = new System.Drawing.Size(114, 23);
this.bnAddPrograms.Size = new System.Drawing.Size(88, 23);
this.bnAddPrograms.TabIndex = 2;
this.bnAddPrograms.Text = "Add programs";
this.bnAddPrograms.UseVisualStyleBackColor = true;
@ -72,9 +69,9 @@
// lBProgramPath
//
this.lBProgramPath.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.lBProgramPath.Location = new System.Drawing.Point(602, 131);
this.lBProgramPath.Location = new System.Drawing.Point(519, 195);
this.lBProgramPath.Name = "lBProgramPath";
this.lBProgramPath.Size = new System.Drawing.Size(47, 18);
this.lBProgramPath.Size = new System.Drawing.Size(205, 18);
this.lBProgramPath.TabIndex = 3;
this.lBProgramPath.Visible = false;
this.lBProgramPath.TextChanged += new System.EventHandler(this.lBProgramPath_TextChanged);
@ -84,7 +81,7 @@
this.cBProfile1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.cBProfile1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cBProfile1.FormattingEnabled = true;
this.cBProfile1.Location = new System.Drawing.Point(609, 18);
this.cBProfile1.Location = new System.Drawing.Point(609, 28);
this.cBProfile1.Name = "cBProfile1";
this.cBProfile1.Size = new System.Drawing.Size(121, 21);
this.cBProfile1.TabIndex = 6;
@ -95,7 +92,7 @@
this.cBProfile2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.cBProfile2.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cBProfile2.FormattingEnabled = true;
this.cBProfile2.Location = new System.Drawing.Point(609, 45);
this.cBProfile2.Location = new System.Drawing.Point(609, 55);
this.cBProfile2.Name = "cBProfile2";
this.cBProfile2.Size = new System.Drawing.Size(121, 21);
this.cBProfile2.TabIndex = 6;
@ -106,7 +103,7 @@
this.cBProfile3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.cBProfile3.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cBProfile3.FormattingEnabled = true;
this.cBProfile3.Location = new System.Drawing.Point(609, 72);
this.cBProfile3.Location = new System.Drawing.Point(609, 82);
this.cBProfile3.Name = "cBProfile3";
this.cBProfile3.Size = new System.Drawing.Size(121, 21);
this.cBProfile3.TabIndex = 6;
@ -117,7 +114,7 @@
this.cBProfile4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.cBProfile4.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cBProfile4.FormattingEnabled = true;
this.cBProfile4.Location = new System.Drawing.Point(609, 99);
this.cBProfile4.Location = new System.Drawing.Point(609, 109);
this.cBProfile4.Name = "cBProfile4";
this.cBProfile4.Size = new System.Drawing.Size(121, 21);
this.cBProfile4.TabIndex = 6;
@ -127,7 +124,7 @@
//
this.bnSave.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.bnSave.Enabled = false;
this.bnSave.Location = new System.Drawing.Point(663, 126);
this.bnSave.Location = new System.Drawing.Point(663, 2);
this.bnSave.Name = "bnSave";
this.bnSave.Size = new System.Drawing.Size(67, 23);
this.bnSave.TabIndex = 2;
@ -139,7 +136,7 @@
//
this.lBController1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.lBController1.AutoSize = true;
this.lBController1.Location = new System.Drawing.Point(516, 21);
this.lBController1.Location = new System.Drawing.Point(516, 31);
this.lBController1.Name = "lBController1";
this.lBController1.Size = new System.Drawing.Size(60, 13);
this.lBController1.TabIndex = 7;
@ -149,7 +146,7 @@
//
this.lBController2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.lBController2.AutoSize = true;
this.lBController2.Location = new System.Drawing.Point(516, 48);
this.lBController2.Location = new System.Drawing.Point(516, 58);
this.lBController2.Name = "lBController2";
this.lBController2.Size = new System.Drawing.Size(60, 13);
this.lBController2.TabIndex = 7;
@ -159,7 +156,7 @@
//
this.lBController3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.lBController3.AutoSize = true;
this.lBController3.Location = new System.Drawing.Point(516, 75);
this.lBController3.Location = new System.Drawing.Point(516, 85);
this.lBController3.Name = "lBController3";
this.lBController3.Size = new System.Drawing.Size(60, 13);
this.lBController3.TabIndex = 7;
@ -169,26 +166,12 @@
//
this.lBController4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.lBController4.AutoSize = true;
this.lBController4.Location = new System.Drawing.Point(516, 102);
this.lBController4.Location = new System.Drawing.Point(516, 112);
this.lBController4.Name = "lBController4";
this.lBController4.Size = new System.Drawing.Size(60, 13);
this.lBController4.TabIndex = 7;
this.lBController4.Text = "Controller 4";
//
// lBBeta
//
this.lBBeta.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.lBBeta.AutoSize = true;
this.lBBeta.BackColor = System.Drawing.Color.Transparent;
this.lBBeta.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lBBeta.ForeColor = System.Drawing.SystemColors.GrayText;
this.lBBeta.Location = new System.Drawing.Point(606, 175);
this.lBBeta.Name = "lBBeta";
this.lBBeta.Size = new System.Drawing.Size(38, 18);
this.lBBeta.TabIndex = 8;
this.lBBeta.Text = "Beta";
this.lBBeta.Visible = false;
//
// openProgram
//
this.openProgram.FileName = "openFileDialog1";
@ -197,7 +180,7 @@
// bnDelete
//
this.bnDelete.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.bnDelete.Location = new System.Drawing.Point(519, 126);
this.bnDelete.Location = new System.Drawing.Point(590, 2);
this.bnDelete.Name = "bnDelete";
this.bnDelete.Size = new System.Drawing.Size(67, 23);
this.bnDelete.TabIndex = 2;
@ -222,10 +205,11 @@
this.PathHeader});
this.lVPrograms.FullRowSelect = true;
this.lVPrograms.LargeImageList = this.iLIcons;
this.lVPrograms.Location = new System.Drawing.Point(5, 6);
this.lVPrograms.Location = new System.Drawing.Point(5, 28);
this.lVPrograms.MultiSelect = false;
this.lVPrograms.Name = "lVPrograms";
this.lVPrograms.Size = new System.Drawing.Size(505, 212);
this.lVPrograms.ShowItemToolTips = true;
this.lVPrograms.Size = new System.Drawing.Size(505, 190);
this.lVPrograms.SmallImageList = this.iLIcons;
this.lVPrograms.TabIndex = 12;
this.lVPrograms.UseCompatibleStateImageBehavior = false;
@ -243,26 +227,13 @@
this.PathHeader.Text = "Path";
this.PathHeader.Width = 358;
//
// lBTip
//
this.lBTip.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.lBTip.AutoSize = true;
this.lBTip.BackColor = System.Drawing.Color.Transparent;
this.lBTip.ForeColor = System.Drawing.SystemColors.GrayText;
this.lBTip.Location = new System.Drawing.Point(529, 152);
this.lBTip.Name = "lBTip";
this.lBTip.Size = new System.Drawing.Size(191, 13);
this.lBTip.TabIndex = 8;
this.lBTip.Text = "Pick a program, then profiles, and save";
this.lBTip.Visible = false;
//
// pBProfilesTip
//
this.pBProfilesTip.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.pBProfilesTip.AutoSize = true;
this.pBProfilesTip.BackColor = System.Drawing.Color.Transparent;
this.pBProfilesTip.ForeColor = System.Drawing.SystemColors.GrayText;
this.pBProfilesTip.Location = new System.Drawing.Point(620, 2);
this.pBProfilesTip.Location = new System.Drawing.Point(622, 136);
this.pBProfilesTip.Name = "pBProfilesTip";
this.pBProfilesTip.Size = new System.Drawing.Size(89, 13);
this.pBProfilesTip.TabIndex = 8;
@ -270,8 +241,7 @@
//
// bnHideUnchecked
//
this.bnHideUnchecked.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.bnHideUnchecked.Location = new System.Drawing.Point(636, 195);
this.bnHideUnchecked.Location = new System.Drawing.Point(99, 2);
this.bnHideUnchecked.Name = "bnHideUnchecked";
this.bnHideUnchecked.Size = new System.Drawing.Size(94, 23);
this.bnHideUnchecked.TabIndex = 2;
@ -324,6 +294,7 @@
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.White;
this.ClientSize = new System.Drawing.Size(736, 222);
this.Controls.Add(this.pBProfilesTip);
this.Controls.Add(this.bnHideUnchecked);
this.Controls.Add(this.bnAddPrograms);
this.Controls.Add(this.lVPrograms);
@ -338,9 +309,6 @@
this.Controls.Add(this.lBProgramPath);
this.Controls.Add(this.bnDelete);
this.Controls.Add(this.bnSave);
this.Controls.Add(this.pBProfilesTip);
this.Controls.Add(this.lBTip);
this.Controls.Add(this.lBBeta);
this.Name = "WinProgs";
this.Text = "Auto-Profiles";
this.cMSPrograms.ResumeLayout(false);
@ -362,14 +330,12 @@
private System.Windows.Forms.Label lBController2;
private System.Windows.Forms.Label lBController3;
private System.Windows.Forms.Label lBController4;
private System.Windows.Forms.Label lBBeta;
private System.Windows.Forms.OpenFileDialog openProgram;
private System.Windows.Forms.Button bnDelete;
private System.Windows.Forms.ImageList iLIcons;
private System.Windows.Forms.ListView lVPrograms;
private System.Windows.Forms.ColumnHeader nameHeader;
private System.Windows.Forms.ColumnHeader PathHeader;
private System.Windows.Forms.Label lBTip;
private System.Windows.Forms.Label pBProfilesTip;
private System.Windows.Forms.Button bnHideUnchecked;
private System.Windows.Forms.ContextMenuStrip cMSPrograms;

View File

@ -46,10 +46,14 @@ namespace ScpServer
Create();
LoadP();
RegistryKey regKey = Registry.CurrentUser;
/*RegistryKey regKey = Registry.CurrentUser;
regKey = regKey.OpenSubKey(@"Software\Valve\Steam");
if (regKey != null)
steamgamesdir = regKey.GetValue("SteamPath").ToString() + @"\steamapps\common";
if (regKey != null)*/
if (Directory.Exists(@"C:\Program Files (x86)\Steam\steamapps\common"))
steamgamesdir = @"C:\Program Files (x86)\Steam\steamapps\common";
else if (Directory.Exists(@"C:\Program Files\Steam\steamapps\common"))
steamgamesdir = @"C:\Program Files\Steam\steamapps\common";
else
cMSPrograms.Items.Remove(addSteamGamesToolStripMenuItem);
@ -106,6 +110,7 @@ namespace ScpServer
ListViewItem lvi = new ListViewItem(Path.GetFileNameWithoutExtension(st), index);
lvi.SubItems.Add(st);
lvi.Checked = true;
lvi.ToolTipText = st;
lVPrograms.Items.Add(lvi);
}
}
@ -156,6 +161,7 @@ namespace ScpServer
iLIcons.Images.Add(Icon.ExtractAssociatedIcon(st));
ListViewItem lvi = new ListViewItem(Path.GetFileNameWithoutExtension(st), iLIcons.Images.Count + index);
lvi.SubItems.Add(st);
lvi.ToolTipText = st;
lVPrograms.Items.Add(lvi);
}
}

View File

@ -10,7 +10,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>HidLibrary</RootNamespace>
<AssemblyName>HidLibrary</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>