mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2025-01-23 21:51:09 +01:00
Version 1.4.16
Extra actions for controls, set rumble, change lightbar and flash, and mouse sensitivity while holding a controls Regardless of where DS4Windows is first placed, the driver will always install in DS4Windows' directory Appdata location is now named "DS4Windows". If your profiles are saved in appdata "%Appdata%/DS4Tool" they will be moved automatically to "%Appdata%/DS4Windows", assuming access to the files are available.
This commit is contained in:
parent
56d21aa3c0
commit
0b79c0121c
@ -414,6 +414,10 @@ namespace DS4Control
|
|||||||
Mapping.MapCustom(ind, cState, MappedState[ind], ExposedState[ind], touchPad[ind]);
|
Mapping.MapCustom(ind, cState, MappedState[ind], ExposedState[ind], touchPad[ind]);
|
||||||
cState = MappedState[ind];
|
cState = MappedState[ind];
|
||||||
}
|
}
|
||||||
|
if (Global.getHasCustomExtras(ind))
|
||||||
|
{
|
||||||
|
DoExtras(ind);
|
||||||
|
}
|
||||||
|
|
||||||
// Update the GUI/whatever.
|
// Update the GUI/whatever.
|
||||||
DS4LightBar.updateLightBar(device, ind, cState, ExposedState[ind], touchPad[ind]);
|
DS4LightBar.updateLightBar(device, ind, cState, ExposedState[ind], touchPad[ind]);
|
||||||
@ -438,6 +442,65 @@ namespace DS4Control
|
|||||||
device.IdleTimeout = Global.getIdleDisconnectTimeout(ind);
|
device.IdleTimeout = Global.getIdleDisconnectTimeout(ind);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
bool[] held = new bool[4];
|
||||||
|
int[] oldmouse = new int[4] {-1,-1,-1,-1};
|
||||||
|
private void DoExtras(int ind)
|
||||||
|
{
|
||||||
|
DS4State cState = CurrentState[ind];
|
||||||
|
DS4StateExposed eState = ExposedState[ind];
|
||||||
|
Mouse tp = touchPad[ind];
|
||||||
|
DS4Controls helddown = DS4Controls.None;
|
||||||
|
foreach (KeyValuePair<DS4Controls, string> p in Global.getCustomExtras(ind))
|
||||||
|
{
|
||||||
|
if (Mapping.getBoolMapping(p.Key, cState, eState, tp))
|
||||||
|
{
|
||||||
|
helddown = p.Key;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (helddown != DS4Controls.None)
|
||||||
|
{
|
||||||
|
string p = Global.getCustomExtras(ind)[helddown];
|
||||||
|
string[] extraS = p.Split(',');
|
||||||
|
int[] extras = new int[extraS.Length];
|
||||||
|
for (int i = 0; i < extraS.Length; i++)
|
||||||
|
{
|
||||||
|
int b;
|
||||||
|
if (int.TryParse(extraS[i], out b))
|
||||||
|
extras[i] = b;
|
||||||
|
}
|
||||||
|
held[ind] = true;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!(extras[0] == extras[1] && extras[1] == 0))
|
||||||
|
setRumble((byte)extras[0], (byte)extras[1], ind);
|
||||||
|
if (extras[2] == 1)
|
||||||
|
{
|
||||||
|
DS4Color color = new DS4Color { red = (byte)extras[3], green = (byte)extras[4], blue = (byte)extras[5] };
|
||||||
|
DS4LightBar.forcedColor[ind] = color;
|
||||||
|
DS4LightBar.forcedFlash[ind] = (byte)extras[6];
|
||||||
|
DS4LightBar.forcelight[ind] = true;
|
||||||
|
}
|
||||||
|
if (extras[7] == 1)
|
||||||
|
{
|
||||||
|
if (oldmouse[ind] == -1)
|
||||||
|
oldmouse[ind] = Global.getButtonMouseSensitivity(ind);
|
||||||
|
Global.setButtonMouseSensitivity(ind, extras[8]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
}
|
||||||
|
else if (held[ind])
|
||||||
|
{
|
||||||
|
DS4LightBar.forcelight[ind] = false;
|
||||||
|
DS4LightBar.forcedFlash[ind] = 0;
|
||||||
|
//Console.WriteLine(p.Key + " is done");
|
||||||
|
Global.setButtonMouseSensitivity(ind, oldmouse[ind]);
|
||||||
|
oldmouse[ind] = -1;
|
||||||
|
setRumble(0, 0, ind);
|
||||||
|
held[ind] = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public string GetInputkeys(int ind)
|
public string GetInputkeys(int ind)
|
||||||
{
|
{
|
||||||
|
@ -25,10 +25,13 @@ namespace DS4Control
|
|||||||
public static double[] fadetimer = new double[4] { 0, 0, 0, 0 };
|
public static double[] fadetimer = new double[4] { 0, 0, 0, 0 };
|
||||||
static bool[] fadedirection = new bool[4] { false, false, false, false };
|
static bool[] fadedirection = new bool[4] { false, false, false, false };
|
||||||
static DateTime oldnow = DateTime.UtcNow;
|
static DateTime oldnow = DateTime.UtcNow;
|
||||||
|
public static bool[] forcelight = new bool[4] { false, false, false, false };
|
||||||
|
public static DS4Color[] forcedColor = new DS4Color[4];
|
||||||
|
public static byte[] forcedFlash = new byte[4];
|
||||||
public static void updateLightBar(DS4Device device, int deviceNum, DS4State cState, DS4StateExposed eState, Mouse tp)
|
public static void updateLightBar(DS4Device device, int deviceNum, DS4State cState, DS4StateExposed eState, Mouse tp)
|
||||||
{
|
{
|
||||||
DS4Color color;
|
DS4Color color;
|
||||||
if (!defualtLight)
|
if (!defualtLight && !forcelight[deviceNum])
|
||||||
{
|
{
|
||||||
if (Global.getShiftColorOn(deviceNum) && Global.getShiftModifier(deviceNum) > 0 && shiftMod(device, deviceNum, cState, eState, tp))
|
if (Global.getShiftColorOn(deviceNum) && Global.getShiftModifier(deviceNum) > 0 && shiftMod(device, deviceNum, cState, eState, tp))
|
||||||
{
|
{
|
||||||
@ -128,6 +131,10 @@ namespace DS4Control
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (forcelight[deviceNum])
|
||||||
|
{
|
||||||
|
color = forcedColor[deviceNum];
|
||||||
|
}
|
||||||
else if (shuttingdown)
|
else if (shuttingdown)
|
||||||
color = new DS4Color { red = 0, green = 0, blue = 0 };
|
color = new DS4Color { red = 0, green = 0, blue = 0 };
|
||||||
else
|
else
|
||||||
@ -153,7 +160,12 @@ namespace DS4Control
|
|||||||
};
|
};
|
||||||
if (haptics.IsLightBarSet())
|
if (haptics.IsLightBarSet())
|
||||||
{
|
{
|
||||||
if (device.Battery <= Global.getFlashAt(deviceNum) && !defualtLight && !device.Charging)
|
if (forcelight[deviceNum] && forcedFlash[deviceNum] > 0)
|
||||||
|
{
|
||||||
|
haptics.LightBarFlashDurationOff = haptics.LightBarFlashDurationOn = (byte)(25 - forcedFlash[deviceNum]);
|
||||||
|
haptics.LightBarExplicitlyOff = true;
|
||||||
|
}
|
||||||
|
else if (device.Battery <= Global.getFlashAt(deviceNum) && !defualtLight && !device.Charging)
|
||||||
{
|
{
|
||||||
int level = device.Battery / 10;
|
int level = device.Battery / 10;
|
||||||
//if (level >= 10)
|
//if (level >= 10)
|
||||||
@ -183,6 +195,7 @@ namespace DS4Control
|
|||||||
System.Threading.Thread.Sleep(5);
|
System.Threading.Thread.Sleep(5);
|
||||||
device.pushHapticState(haptics);
|
device.pushHapticState(haptics);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool defualtLight = false, shuttingdown = false;
|
public static bool defualtLight = false, shuttingdown = false;
|
||||||
|
|
||||||
public static bool shiftMod(DS4Device device, int deviceNum, DS4State cState, DS4StateExposed eState, Mouse tp)
|
public static bool shiftMod(DS4Device device, int deviceNum, DS4State cState, DS4StateExposed eState, Mouse tp)
|
||||||
|
@ -176,30 +176,35 @@ namespace DS4Control
|
|||||||
if (gkp.current.toggleCount != 0 && gkp.previous.toggleCount == 0 && gkp.current.toggle)
|
if (gkp.current.toggleCount != 0 && gkp.previous.toggleCount == 0 && gkp.current.toggle)
|
||||||
{
|
{
|
||||||
if (gkp.current.scanCodeCount != 0)
|
if (gkp.current.scanCodeCount != 0)
|
||||||
InputMethods.performSCKeyPress(kvp.Key);
|
InputMethods.PressKeys(kvp.Key);
|
||||||
|
//InputMethods.performSCKeyPress(kvp.Key);
|
||||||
else
|
else
|
||||||
InputMethods.performKeyPress(kvp.Key);
|
InputMethods.PressKeys(kvp.Key);
|
||||||
|
// InputMethods.performKeyPress(kvp.Key);
|
||||||
}
|
}
|
||||||
else if (gkp.current.toggleCount != 0 && gkp.previous.toggleCount == 0 && !gkp.current.toggle)
|
else if (gkp.current.toggleCount != 0 && gkp.previous.toggleCount == 0 && !gkp.current.toggle)
|
||||||
{
|
{
|
||||||
if (gkp.previous.scanCodeCount != 0) // use the last type of VK/SC
|
if (gkp.previous.scanCodeCount != 0) // use the last type of VK/SC
|
||||||
InputMethods.performSCKeyRelease(kvp.Key);
|
InputMethods.performSCKeyRelease(kvp.Key);
|
||||||
else
|
else
|
||||||
InputMethods.performKeyRelease(kvp.Key);
|
InputMethods.ReleaseKeys(kvp.Key);
|
||||||
|
//InputMethods.performKeyRelease(kvp.Key);
|
||||||
}
|
}
|
||||||
else if (gkp.current.vkCount + gkp.current.scanCodeCount != 0 && gkp.previous.vkCount + gkp.previous.scanCodeCount == 0)
|
else if (gkp.current.vkCount + gkp.current.scanCodeCount != 0 && gkp.previous.vkCount + gkp.previous.scanCodeCount == 0)
|
||||||
{
|
{
|
||||||
if (gkp.current.scanCodeCount != 0)
|
if (gkp.current.scanCodeCount != 0)
|
||||||
{
|
{
|
||||||
oldnow = DateTime.UtcNow;
|
oldnow = DateTime.UtcNow;
|
||||||
InputMethods.performSCKeyPress(kvp.Key);
|
InputMethods.PressKeys(kvp.Key);
|
||||||
|
//InputMethods.performSCKeyPress(kvp.Key);
|
||||||
pressagain = false;
|
pressagain = false;
|
||||||
keyshelddown = kvp.Key;
|
keyshelddown = kvp.Key;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
oldnow = DateTime.UtcNow;
|
oldnow = DateTime.UtcNow;
|
||||||
InputMethods.performKeyPress(kvp.Key);
|
InputMethods.PressKeys(kvp.Key);
|
||||||
|
//InputMethods.performKeyPress(kvp.Key);
|
||||||
pressagain = false;
|
pressagain = false;
|
||||||
keyshelddown = kvp.Key;
|
keyshelddown = kvp.Key;
|
||||||
}
|
}
|
||||||
@ -221,7 +226,8 @@ namespace DS4Control
|
|||||||
if (now >= oldnow + TimeSpan.FromMilliseconds(25) && pressagain)
|
if (now >= oldnow + TimeSpan.FromMilliseconds(25) && pressagain)
|
||||||
{
|
{
|
||||||
oldnow = now;
|
oldnow = now;
|
||||||
InputMethods.performSCKeyPress(kvp.Key);
|
//InputMethods.performSCKeyPress(kvp.Key);
|
||||||
|
InputMethods.PressKeys(kvp.Key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (pressagain)
|
else if (pressagain)
|
||||||
@ -230,7 +236,8 @@ namespace DS4Control
|
|||||||
if (now >= oldnow + TimeSpan.FromMilliseconds(25) && pressagain)
|
if (now >= oldnow + TimeSpan.FromMilliseconds(25) && pressagain)
|
||||||
{
|
{
|
||||||
oldnow = now;
|
oldnow = now;
|
||||||
InputMethods.performKeyPress(kvp.Key);
|
InputMethods.PressKeys(kvp.Key);
|
||||||
|
//InputMethods.performKeyPress(kvp.Key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -245,7 +252,8 @@ namespace DS4Control
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
InputMethods.performKeyRelease(kvp.Key);
|
InputMethods.ReleaseKeys(kvp.Key);
|
||||||
|
//InputMethods.performKeyRelease(kvp.Key);
|
||||||
pressagain = false;
|
pressagain = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -559,6 +559,10 @@ namespace DS4Control
|
|||||||
{
|
{
|
||||||
return m_Config.GetCustomMacro(device, controlName);
|
return m_Config.GetCustomMacro(device, controlName);
|
||||||
}
|
}
|
||||||
|
public static string getCustomExtras(int device, DS4Controls controlName)
|
||||||
|
{
|
||||||
|
return m_Config.GetCustomExtras(device, controlName);
|
||||||
|
}
|
||||||
public static DS4KeyType getCustomKeyType(int device, DS4Controls controlName)
|
public static DS4KeyType getCustomKeyType(int device, DS4Controls controlName)
|
||||||
{
|
{
|
||||||
return m_Config.GetCustomKeyType(device, controlName);
|
return m_Config.GetCustomKeyType(device, controlName);
|
||||||
@ -568,6 +572,10 @@ namespace DS4Control
|
|||||||
return m_Config.customMapButtons[device].Count > 0
|
return m_Config.customMapButtons[device].Count > 0
|
||||||
|| m_Config.customMapKeys[device].Count > 0;
|
|| m_Config.customMapKeys[device].Count > 0;
|
||||||
}
|
}
|
||||||
|
public static bool getHasCustomExtras(int device)
|
||||||
|
{
|
||||||
|
return m_Config.customMapExtras[device].Count > 0;
|
||||||
|
}
|
||||||
public static Dictionary<DS4Controls, X360Controls> getCustomButtons(int device)
|
public static Dictionary<DS4Controls, X360Controls> getCustomButtons(int device)
|
||||||
{
|
{
|
||||||
return m_Config.customMapButtons[device];
|
return m_Config.customMapButtons[device];
|
||||||
@ -580,6 +588,10 @@ namespace DS4Control
|
|||||||
{
|
{
|
||||||
return m_Config.customMapMacros[device];
|
return m_Config.customMapMacros[device];
|
||||||
}
|
}
|
||||||
|
public static Dictionary<DS4Controls, string> getCustomExtras(int device)
|
||||||
|
{
|
||||||
|
return m_Config.customMapExtras[device];
|
||||||
|
}
|
||||||
public static Dictionary<DS4Controls, DS4KeyType> getCustomKeyTypes(int device)
|
public static Dictionary<DS4Controls, DS4KeyType> getCustomKeyTypes(int device)
|
||||||
{
|
{
|
||||||
return m_Config.customMapKeyTypes[device];
|
return m_Config.customMapKeyTypes[device];
|
||||||
@ -597,6 +609,10 @@ namespace DS4Control
|
|||||||
{
|
{
|
||||||
return m_Config.GetShiftCustomMacro(device, controlName);
|
return m_Config.GetShiftCustomMacro(device, controlName);
|
||||||
}
|
}
|
||||||
|
public static string getShiftCustomExtras(int device, DS4Controls controlName)
|
||||||
|
{
|
||||||
|
return m_Config.GetShiftCustomExtras(device, controlName);
|
||||||
|
}
|
||||||
public static DS4KeyType getShiftCustomKeyType(int device, DS4Controls controlName)
|
public static DS4KeyType getShiftCustomKeyType(int device, DS4Controls controlName)
|
||||||
{
|
{
|
||||||
return m_Config.GetShiftCustomKeyType(device, controlName);
|
return m_Config.GetShiftCustomKeyType(device, controlName);
|
||||||
@ -606,6 +622,10 @@ namespace DS4Control
|
|||||||
return m_Config.shiftCustomMapButtons[device].Count > 0
|
return m_Config.shiftCustomMapButtons[device].Count > 0
|
||||||
|| m_Config.shiftCustomMapKeys[device].Count > 0;
|
|| m_Config.shiftCustomMapKeys[device].Count > 0;
|
||||||
}
|
}
|
||||||
|
public static bool getHasShiftCustomExtras(int device)
|
||||||
|
{
|
||||||
|
return m_Config.shiftCustomMapExtras[device].Count > 0;
|
||||||
|
}
|
||||||
public static Dictionary<DS4Controls, X360Controls> getShiftCustomButtons(int device)
|
public static Dictionary<DS4Controls, X360Controls> getShiftCustomButtons(int device)
|
||||||
{
|
{
|
||||||
return m_Config.shiftCustomMapButtons[device];
|
return m_Config.shiftCustomMapButtons[device];
|
||||||
@ -618,6 +638,10 @@ namespace DS4Control
|
|||||||
{
|
{
|
||||||
return m_Config.shiftCustomMapMacros[device];
|
return m_Config.shiftCustomMapMacros[device];
|
||||||
}
|
}
|
||||||
|
public static Dictionary<DS4Controls, string> getShiftCustomExtras(int device)
|
||||||
|
{
|
||||||
|
return m_Config.shiftCustomMapExtras[device];
|
||||||
|
}
|
||||||
public static Dictionary<DS4Controls, DS4KeyType> getShiftCustomKeyTypes(int device)
|
public static Dictionary<DS4Controls, DS4KeyType> getShiftCustomKeyTypes(int device)
|
||||||
{
|
{
|
||||||
return m_Config.shiftCustomMapKeyTypes[device];
|
return m_Config.shiftCustomMapKeyTypes[device];
|
||||||
@ -813,11 +837,13 @@ namespace DS4Control
|
|||||||
public Dictionary<DS4Controls, UInt16>[] customMapKeys = { null, null, null, null, null };
|
public Dictionary<DS4Controls, UInt16>[] customMapKeys = { null, null, null, null, null };
|
||||||
public Dictionary<DS4Controls, String>[] customMapMacros = { null, null, null, null, null };
|
public Dictionary<DS4Controls, String>[] customMapMacros = { null, null, null, null, null };
|
||||||
public Dictionary<DS4Controls, X360Controls>[] customMapButtons = { null, null, null, null, null };
|
public Dictionary<DS4Controls, X360Controls>[] customMapButtons = { null, null, null, null, null };
|
||||||
|
public Dictionary<DS4Controls, String>[] customMapExtras = { null, null, null, null, null };
|
||||||
|
|
||||||
public Dictionary<DS4Controls, DS4KeyType>[] shiftCustomMapKeyTypes = { null, null, null, null, null };
|
public Dictionary<DS4Controls, DS4KeyType>[] shiftCustomMapKeyTypes = { null, null, null, null, null };
|
||||||
public Dictionary<DS4Controls, UInt16>[] shiftCustomMapKeys = { null, null, null, null, null };
|
public Dictionary<DS4Controls, UInt16>[] shiftCustomMapKeys = { null, null, null, null, null };
|
||||||
public Dictionary<DS4Controls, String>[] shiftCustomMapMacros = { null, null, null, null, null };
|
public Dictionary<DS4Controls, String>[] shiftCustomMapMacros = { null, null, null, null, null };
|
||||||
public Dictionary<DS4Controls, X360Controls>[] shiftCustomMapButtons = { null, null, null, null, null };
|
public Dictionary<DS4Controls, X360Controls>[] shiftCustomMapButtons = { null, null, null, null, null };
|
||||||
|
public Dictionary<DS4Controls, String>[] shiftCustomMapExtras = { null, null, null, null, null };
|
||||||
|
|
||||||
public BackingStore()
|
public BackingStore()
|
||||||
{
|
{
|
||||||
@ -827,11 +853,13 @@ namespace DS4Control
|
|||||||
customMapKeys[i] = new Dictionary<DS4Controls, UInt16>();
|
customMapKeys[i] = new Dictionary<DS4Controls, UInt16>();
|
||||||
customMapMacros[i] = new Dictionary<DS4Controls, String>();
|
customMapMacros[i] = new Dictionary<DS4Controls, String>();
|
||||||
customMapButtons[i] = new Dictionary<DS4Controls, X360Controls>();
|
customMapButtons[i] = new Dictionary<DS4Controls, X360Controls>();
|
||||||
|
customMapExtras[i] = new Dictionary<DS4Controls, string>();
|
||||||
|
|
||||||
shiftCustomMapKeyTypes[i] = new Dictionary<DS4Controls, DS4KeyType>();
|
shiftCustomMapKeyTypes[i] = new Dictionary<DS4Controls, DS4KeyType>();
|
||||||
shiftCustomMapKeys[i] = new Dictionary<DS4Controls, UInt16>();
|
shiftCustomMapKeys[i] = new Dictionary<DS4Controls, UInt16>();
|
||||||
shiftCustomMapMacros[i] = new Dictionary<DS4Controls, String>();
|
shiftCustomMapMacros[i] = new Dictionary<DS4Controls, String>();
|
||||||
shiftCustomMapButtons[i] = new Dictionary<DS4Controls, X360Controls>();
|
shiftCustomMapButtons[i] = new Dictionary<DS4Controls, X360Controls>();
|
||||||
|
shiftCustomMapExtras[i] = new Dictionary<DS4Controls, string>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -853,6 +881,12 @@ namespace DS4Control
|
|||||||
return customMapMacros[device][controlName];
|
return customMapMacros[device][controlName];
|
||||||
else return "0";
|
else return "0";
|
||||||
}
|
}
|
||||||
|
public string GetCustomExtras(int device, DS4Controls controlName)
|
||||||
|
{
|
||||||
|
if (customMapExtras[device].ContainsKey(controlName))
|
||||||
|
return customMapExtras[device][controlName];
|
||||||
|
else return "0";
|
||||||
|
}
|
||||||
public DS4KeyType GetCustomKeyType(int device, DS4Controls controlName)
|
public DS4KeyType GetCustomKeyType(int device, DS4Controls controlName)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@ -882,6 +916,12 @@ namespace DS4Control
|
|||||||
return shiftCustomMapMacros[device][controlName];
|
return shiftCustomMapMacros[device][controlName];
|
||||||
else return "0";
|
else return "0";
|
||||||
}
|
}
|
||||||
|
public string GetShiftCustomExtras(int device, DS4Controls controlName)
|
||||||
|
{
|
||||||
|
if (customMapExtras[device].ContainsKey(controlName))
|
||||||
|
return customMapExtras[device][controlName];
|
||||||
|
else return "0";
|
||||||
|
}
|
||||||
public DS4KeyType GetShiftCustomKeyType(int device, DS4Controls controlName)
|
public DS4KeyType GetShiftCustomKeyType(int device, DS4Controls controlName)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@ -964,6 +1004,7 @@ namespace DS4Control
|
|||||||
XmlNode Macro = m_Xdoc.CreateNode(XmlNodeType.Element, "Macro", null);
|
XmlNode Macro = m_Xdoc.CreateNode(XmlNodeType.Element, "Macro", null);
|
||||||
XmlNode KeyType = m_Xdoc.CreateNode(XmlNodeType.Element, "KeyType", null);
|
XmlNode KeyType = m_Xdoc.CreateNode(XmlNodeType.Element, "KeyType", null);
|
||||||
XmlNode Button = m_Xdoc.CreateNode(XmlNodeType.Element, "Button", null);
|
XmlNode Button = m_Xdoc.CreateNode(XmlNodeType.Element, "Button", null);
|
||||||
|
XmlNode Extras = m_Xdoc.CreateNode(XmlNodeType.Element, "Extras", null);
|
||||||
if (buttons != null)
|
if (buttons != null)
|
||||||
{
|
{
|
||||||
foreach (var button in buttons)
|
foreach (var button in buttons)
|
||||||
@ -973,36 +1014,68 @@ namespace DS4Control
|
|||||||
{
|
{
|
||||||
XmlNode buttonNode;
|
XmlNode buttonNode;
|
||||||
string keyType = String.Empty;
|
string keyType = String.Empty;
|
||||||
if (button.Tag is String && (String)button.Tag == "Unbound")
|
|
||||||
{
|
if (button.Tag is KeyValuePair<string, string>)
|
||||||
keyType += DS4KeyType.Unbound;
|
if (((KeyValuePair<string, string>)button.Tag).Key == "Unbound")
|
||||||
}
|
keyType += DS4KeyType.Unbound;
|
||||||
{
|
|
||||||
if (button.Font.Strikeout)
|
if (button.Font.Strikeout)
|
||||||
keyType += DS4KeyType.HoldMacro;
|
keyType += DS4KeyType.HoldMacro;
|
||||||
if (button.Font.Underline)
|
if (button.Font.Underline)
|
||||||
keyType += DS4KeyType.Macro;
|
keyType += DS4KeyType.Macro;
|
||||||
if (button.Font.Italic)
|
if (button.Font.Italic)
|
||||||
keyType += DS4KeyType.Toggle;
|
keyType += DS4KeyType.Toggle;
|
||||||
if (button.Font.Bold)
|
if (button.Font.Bold)
|
||||||
keyType += DS4KeyType.ScanCode;
|
keyType += DS4KeyType.ScanCode;
|
||||||
}
|
|
||||||
if (keyType != String.Empty)
|
if (keyType != String.Empty)
|
||||||
{
|
{
|
||||||
buttonNode = m_Xdoc.CreateNode(XmlNodeType.Element, button.Name, null);
|
buttonNode = m_Xdoc.CreateNode(XmlNodeType.Element, button.Name, null);
|
||||||
buttonNode.InnerText = keyType;
|
buttonNode.InnerText = keyType;
|
||||||
KeyType.AppendChild(buttonNode);
|
KeyType.AppendChild(buttonNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string[] extras;
|
||||||
buttonNode = m_Xdoc.CreateNode(XmlNodeType.Element, button.Name, null);
|
buttonNode = m_Xdoc.CreateNode(XmlNodeType.Element, button.Name, null);
|
||||||
buttonNode.InnerText = button.Tag.ToString();
|
if (button.Tag is KeyValuePair<IEnumerable<int>, string> || button.Tag is KeyValuePair<Int32[], string> || button.Tag is KeyValuePair<UInt16[], string>)
|
||||||
if (button.Tag is IEnumerable<int> || button.Tag is Int32[] || button.Tag is UInt16[])
|
|
||||||
{
|
{
|
||||||
buttonNode.InnerText = string.Join("/", (int[])button.Tag);
|
KeyValuePair<Int32[], string> tag = (KeyValuePair<Int32[], string>)button.Tag;
|
||||||
|
int[] ii = tag.Key;
|
||||||
|
buttonNode.InnerText = string.Join("/", ii);
|
||||||
Macro.AppendChild(buttonNode);
|
Macro.AppendChild(buttonNode);
|
||||||
|
extras = tag.Value.Split(',');
|
||||||
}
|
}
|
||||||
else if (button.Tag is Int32 || button.Tag is UInt16)
|
else if (button.Tag is KeyValuePair<Int32, string> || button.Tag is KeyValuePair<UInt16, string> || button.Tag is KeyValuePair<byte, string>)
|
||||||
|
{
|
||||||
|
KeyValuePair<int, string> tag = (KeyValuePair<int, string>)button.Tag;
|
||||||
|
buttonNode.InnerText = tag.Key.ToString();
|
||||||
Key.AppendChild(buttonNode);
|
Key.AppendChild(buttonNode);
|
||||||
else Button.AppendChild(buttonNode);
|
extras = tag.Value.Split(',');
|
||||||
|
}
|
||||||
|
else if (button.Tag is KeyValuePair<string, string>)
|
||||||
|
{
|
||||||
|
KeyValuePair<string, string> tag = (KeyValuePair<string, string>)button.Tag;
|
||||||
|
buttonNode.InnerText = tag.Key;
|
||||||
|
Button.AppendChild(buttonNode);
|
||||||
|
extras = tag.Value.Split(',');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
KeyValuePair<object, string> tag = (KeyValuePair<object, string>)button.Tag;
|
||||||
|
extras = tag.Value.Split(',');
|
||||||
|
}
|
||||||
|
bool hasvalue = false;
|
||||||
|
foreach (string s in extras)
|
||||||
|
if (s != "0")
|
||||||
|
{
|
||||||
|
hasvalue = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (hasvalue)
|
||||||
|
{
|
||||||
|
XmlNode extraNode = m_Xdoc.CreateNode(XmlNodeType.Element, button.Name, null);
|
||||||
|
extraNode.InnerText = String.Join(",", extras);
|
||||||
|
Extras.AppendChild(extraNode);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Node.AppendChild(NodeControl);
|
Node.AppendChild(NodeControl);
|
||||||
@ -1012,6 +1085,8 @@ namespace DS4Control
|
|||||||
NodeControl.AppendChild(Macro);
|
NodeControl.AppendChild(Macro);
|
||||||
if (Key.HasChildNodes)
|
if (Key.HasChildNodes)
|
||||||
NodeControl.AppendChild(Key);
|
NodeControl.AppendChild(Key);
|
||||||
|
if (Extras.HasChildNodes)
|
||||||
|
NodeControl.AppendChild(Extras);
|
||||||
if (KeyType.HasChildNodes)
|
if (KeyType.HasChildNodes)
|
||||||
NodeControl.AppendChild(KeyType);
|
NodeControl.AppendChild(KeyType);
|
||||||
}
|
}
|
||||||
@ -1025,6 +1100,7 @@ namespace DS4Control
|
|||||||
XmlNode ShiftMacro = m_Xdoc.CreateNode(XmlNodeType.Element, "Macro", null);
|
XmlNode ShiftMacro = m_Xdoc.CreateNode(XmlNodeType.Element, "Macro", null);
|
||||||
XmlNode ShiftKeyType = m_Xdoc.CreateNode(XmlNodeType.Element, "KeyType", null);
|
XmlNode ShiftKeyType = m_Xdoc.CreateNode(XmlNodeType.Element, "KeyType", null);
|
||||||
XmlNode ShiftButton = m_Xdoc.CreateNode(XmlNodeType.Element, "Button", null);
|
XmlNode ShiftButton = m_Xdoc.CreateNode(XmlNodeType.Element, "Button", null);
|
||||||
|
XmlNode ShiftExtras = m_Xdoc.CreateNode(XmlNodeType.Element, "Extras", null);
|
||||||
if (shiftbuttons != null)
|
if (shiftbuttons != null)
|
||||||
{
|
{
|
||||||
foreach (var button in shiftbuttons)
|
foreach (var button in shiftbuttons)
|
||||||
@ -1034,36 +1110,67 @@ namespace DS4Control
|
|||||||
{
|
{
|
||||||
XmlNode buttonNode;
|
XmlNode buttonNode;
|
||||||
string keyType = String.Empty;
|
string keyType = String.Empty;
|
||||||
if (button.Tag is String && (String)button.Tag == "Unbound")
|
if (button.Tag is KeyValuePair<string, string>)
|
||||||
{
|
if (((KeyValuePair<string, string>)button.Tag).Key == "Unbound")
|
||||||
keyType += DS4KeyType.Unbound;
|
keyType += DS4KeyType.Unbound;
|
||||||
}
|
|
||||||
{
|
if (button.Font.Strikeout)
|
||||||
if (button.Font.Strikeout)
|
keyType += DS4KeyType.HoldMacro;
|
||||||
keyType += DS4KeyType.HoldMacro;
|
if (button.Font.Underline)
|
||||||
if (button.Font.Underline)
|
keyType += DS4KeyType.Macro;
|
||||||
keyType += DS4KeyType.Macro;
|
if (button.Font.Italic)
|
||||||
if (button.Font.Italic)
|
keyType += DS4KeyType.Toggle;
|
||||||
keyType += DS4KeyType.Toggle;
|
if (button.Font.Bold)
|
||||||
if (button.Font.Bold)
|
keyType += DS4KeyType.ScanCode;
|
||||||
keyType += DS4KeyType.ScanCode;
|
|
||||||
}
|
|
||||||
if (keyType != String.Empty)
|
if (keyType != String.Empty)
|
||||||
{
|
{
|
||||||
buttonNode = m_Xdoc.CreateNode(XmlNodeType.Element, button.Name, null);
|
buttonNode = m_Xdoc.CreateNode(XmlNodeType.Element, button.Name, null);
|
||||||
buttonNode.InnerText = keyType;
|
buttonNode.InnerText = keyType;
|
||||||
ShiftKeyType.AppendChild(buttonNode);
|
ShiftKeyType.AppendChild(buttonNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string[] extras;
|
||||||
buttonNode = m_Xdoc.CreateNode(XmlNodeType.Element, button.Name, null);
|
buttonNode = m_Xdoc.CreateNode(XmlNodeType.Element, button.Name, null);
|
||||||
buttonNode.InnerText = button.Tag.ToString();
|
if (button.Tag is KeyValuePair<IEnumerable<int>, string> || button.Tag is KeyValuePair<Int32[], string> || button.Tag is KeyValuePair<UInt16[], string>)
|
||||||
if (button.Tag is IEnumerable<int> || button.Tag is Int32[] || button.Tag is UInt16[])
|
|
||||||
{
|
{
|
||||||
buttonNode.InnerText = string.Join("/", (int[])button.Tag);
|
KeyValuePair<Int32[], string> tag = (KeyValuePair<Int32[], string>)button.Tag;
|
||||||
|
int[] ii = tag.Key;
|
||||||
|
buttonNode.InnerText = string.Join("/", ii);
|
||||||
ShiftMacro.AppendChild(buttonNode);
|
ShiftMacro.AppendChild(buttonNode);
|
||||||
|
extras = tag.Value.Split(',');
|
||||||
}
|
}
|
||||||
else if (button.Tag is Int32 || button.Tag is UInt16)
|
else if (button.Tag is KeyValuePair<Int32, string> || button.Tag is KeyValuePair<UInt16, string> || button.Tag is KeyValuePair<byte, string>)
|
||||||
|
{
|
||||||
|
KeyValuePair<int, string> tag = (KeyValuePair<int, string>)button.Tag;
|
||||||
|
buttonNode.InnerText = tag.Key.ToString();
|
||||||
ShiftKey.AppendChild(buttonNode);
|
ShiftKey.AppendChild(buttonNode);
|
||||||
else ShiftButton.AppendChild(buttonNode);
|
extras = tag.Value.Split(',');
|
||||||
|
}
|
||||||
|
else if (button.Tag is KeyValuePair<string, string>)
|
||||||
|
{
|
||||||
|
KeyValuePair<string, string> tag = (KeyValuePair<string, string>)button.Tag;
|
||||||
|
buttonNode.InnerText = tag.Key;
|
||||||
|
ShiftButton.AppendChild(buttonNode);
|
||||||
|
extras = tag.Value.Split(',');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
KeyValuePair<object, string> tag = (KeyValuePair<object, string>)button.Tag;
|
||||||
|
extras = tag.Value.Split(',');
|
||||||
|
}
|
||||||
|
bool hasvalue = false;
|
||||||
|
foreach (string s in extras)
|
||||||
|
if (s != "0")
|
||||||
|
{
|
||||||
|
hasvalue = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (hasvalue)
|
||||||
|
{
|
||||||
|
XmlNode extraNode = m_Xdoc.CreateNode(XmlNodeType.Element, button.Name, null);
|
||||||
|
extraNode.InnerText = String.Join(",", extras);
|
||||||
|
ShiftExtras.AppendChild(extraNode);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Node.AppendChild(NodeShiftControl);
|
Node.AppendChild(NodeShiftControl);
|
||||||
@ -1279,10 +1386,12 @@ namespace DS4Control
|
|||||||
Dictionary<DS4Controls, UInt16> customMapKeys = new Dictionary<DS4Controls, UInt16>();
|
Dictionary<DS4Controls, UInt16> customMapKeys = new Dictionary<DS4Controls, UInt16>();
|
||||||
Dictionary<DS4Controls, X360Controls> customMapButtons = new Dictionary<DS4Controls, X360Controls>();
|
Dictionary<DS4Controls, X360Controls> customMapButtons = new Dictionary<DS4Controls, X360Controls>();
|
||||||
Dictionary<DS4Controls, String> customMapMacros = new Dictionary<DS4Controls, String>();
|
Dictionary<DS4Controls, String> customMapMacros = new Dictionary<DS4Controls, String>();
|
||||||
|
Dictionary<DS4Controls, String> customMapExtras = new Dictionary<DS4Controls, String>();
|
||||||
Dictionary<DS4Controls, DS4KeyType> shiftCustomMapKeyTypes = new Dictionary<DS4Controls, DS4KeyType>();
|
Dictionary<DS4Controls, DS4KeyType> shiftCustomMapKeyTypes = new Dictionary<DS4Controls, DS4KeyType>();
|
||||||
Dictionary<DS4Controls, UInt16> shiftCustomMapKeys = new Dictionary<DS4Controls, UInt16>();
|
Dictionary<DS4Controls, UInt16> shiftCustomMapKeys = new Dictionary<DS4Controls, UInt16>();
|
||||||
Dictionary<DS4Controls, X360Controls> shiftCustomMapButtons = new Dictionary<DS4Controls, X360Controls>();
|
Dictionary<DS4Controls, X360Controls> shiftCustomMapButtons = new Dictionary<DS4Controls, X360Controls>();
|
||||||
Dictionary<DS4Controls, String> shiftCustomMapMacros = new Dictionary<DS4Controls, String>();
|
Dictionary<DS4Controls, String> shiftCustomMapMacros = new Dictionary<DS4Controls, String>();
|
||||||
|
Dictionary<DS4Controls, String> shiftCustomMapExtras = new Dictionary<DS4Controls, String>();
|
||||||
string rootname = "DS4Windows";
|
string rootname = "DS4Windows";
|
||||||
Boolean missingSetting = false;
|
Boolean missingSetting = false;
|
||||||
string profilepath;
|
string profilepath;
|
||||||
@ -1491,6 +1600,10 @@ namespace DS4Control
|
|||||||
foreach (XmlNode item in ParentItem.ChildNodes)
|
foreach (XmlNode item in ParentItem.ChildNodes)
|
||||||
if (UInt16.TryParse(item.InnerText, out wvk))
|
if (UInt16.TryParse(item.InnerText, out wvk))
|
||||||
customMapKeys.Add(getDS4ControlsByName(item.Name), wvk);
|
customMapKeys.Add(getDS4ControlsByName(item.Name), wvk);
|
||||||
|
ParentItem = m_Xdoc.SelectSingleNode("/" + rootname + "/Control/Extras");
|
||||||
|
if (ParentItem != null)
|
||||||
|
foreach (XmlNode item in ParentItem.ChildNodes)
|
||||||
|
customMapExtras.Add(getDS4ControlsByName(item.Name), item.InnerText);
|
||||||
ParentItem = m_Xdoc.SelectSingleNode("/" + rootname + "/Control/KeyType");
|
ParentItem = m_Xdoc.SelectSingleNode("/" + rootname + "/Control/KeyType");
|
||||||
if (ParentItem != null)
|
if (ParentItem != null)
|
||||||
foreach (XmlNode item in ParentItem.ChildNodes)
|
foreach (XmlNode item in ParentItem.ChildNodes)
|
||||||
@ -1525,6 +1638,10 @@ namespace DS4Control
|
|||||||
foreach (XmlNode item in ParentItem.ChildNodes)
|
foreach (XmlNode item in ParentItem.ChildNodes)
|
||||||
if (UInt16.TryParse(item.InnerText, out wvk))
|
if (UInt16.TryParse(item.InnerText, out wvk))
|
||||||
shiftCustomMapKeys.Add(getDS4ControlsByName(item.Name), wvk);
|
shiftCustomMapKeys.Add(getDS4ControlsByName(item.Name), wvk);
|
||||||
|
ParentItem = m_Xdoc.SelectSingleNode("/" + rootname + "/ShiftControl/Extras");
|
||||||
|
if (ParentItem != null)
|
||||||
|
foreach (XmlNode item in ParentItem.ChildNodes)
|
||||||
|
shiftCustomMapExtras.Add(getDS4ControlsByName(item.Name), item.InnerText);
|
||||||
ParentItem = m_Xdoc.SelectSingleNode("/" + rootname + "/ShiftControl/KeyType");
|
ParentItem = m_Xdoc.SelectSingleNode("/" + rootname + "/ShiftControl/KeyType");
|
||||||
if (ParentItem != null)
|
if (ParentItem != null)
|
||||||
foreach (XmlNode item in ParentItem.ChildNodes)
|
foreach (XmlNode item in ParentItem.ChildNodes)
|
||||||
@ -1548,8 +1665,8 @@ namespace DS4Control
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LoadButtons(buttons, "Control", customMapKeyTypes, customMapKeys, customMapButtons, customMapMacros);
|
LoadButtons(buttons, "Control", customMapKeyTypes, customMapKeys, customMapButtons, customMapMacros, customMapExtras);
|
||||||
LoadButtons(shiftbuttons, "ShiftControl", shiftCustomMapKeyTypes, shiftCustomMapKeys, shiftCustomMapButtons, shiftCustomMapMacros);
|
LoadButtons(shiftbuttons, "ShiftControl", shiftCustomMapKeyTypes, shiftCustomMapKeys, shiftCustomMapButtons, shiftCustomMapMacros, shiftCustomMapExtras);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//catch { Loaded = false; }
|
//catch { Loaded = false; }
|
||||||
@ -1559,11 +1676,13 @@ namespace DS4Control
|
|||||||
this.customMapKeys[device] = customMapKeys;
|
this.customMapKeys[device] = customMapKeys;
|
||||||
this.customMapKeyTypes[device] = customMapKeyTypes;
|
this.customMapKeyTypes[device] = customMapKeyTypes;
|
||||||
this.customMapMacros[device] = customMapMacros;
|
this.customMapMacros[device] = customMapMacros;
|
||||||
|
this.customMapExtras[device] = customMapExtras;
|
||||||
|
|
||||||
this.shiftCustomMapButtons[device] = shiftCustomMapButtons;
|
this.shiftCustomMapButtons[device] = shiftCustomMapButtons;
|
||||||
this.shiftCustomMapKeys[device] = shiftCustomMapKeys;
|
this.shiftCustomMapKeys[device] = shiftCustomMapKeys;
|
||||||
this.shiftCustomMapKeyTypes[device] = shiftCustomMapKeyTypes;
|
this.shiftCustomMapKeyTypes[device] = shiftCustomMapKeyTypes;
|
||||||
this.shiftCustomMapMacros[device] = shiftCustomMapMacros;
|
this.shiftCustomMapMacros[device] = shiftCustomMapMacros;
|
||||||
|
this.shiftCustomMapExtras[device] = shiftCustomMapExtras;
|
||||||
}
|
}
|
||||||
// Only add missing settings if the actual load was graceful
|
// Only add missing settings if the actual load was graceful
|
||||||
if (missingSetting && Loaded)// && buttons != null)
|
if (missingSetting && Loaded)// && buttons != null)
|
||||||
@ -1573,7 +1692,7 @@ namespace DS4Control
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void LoadButtons(System.Windows.Forms.Control[] buttons, string control, Dictionary<DS4Controls, DS4KeyType> customMapKeyTypes,
|
public void LoadButtons(System.Windows.Forms.Control[] buttons, string control, Dictionary<DS4Controls, DS4KeyType> customMapKeyTypes,
|
||||||
Dictionary<DS4Controls, UInt16> customMapKeys, Dictionary<DS4Controls, X360Controls> customMapButtons, Dictionary<DS4Controls, String> customMapMacros)
|
Dictionary<DS4Controls, UInt16> customMapKeys, Dictionary<DS4Controls, X360Controls> customMapButtons, Dictionary<DS4Controls, String> customMapMacros, Dictionary<DS4Controls, String> customMapExtras)
|
||||||
{
|
{
|
||||||
XmlNode Item;
|
XmlNode Item;
|
||||||
DS4KeyType keyType;
|
DS4KeyType keyType;
|
||||||
@ -1617,7 +1736,15 @@ namespace DS4Control
|
|||||||
if (keyType != DS4KeyType.None)
|
if (keyType != DS4KeyType.None)
|
||||||
customMapKeyTypes.Add(getDS4ControlsByName(Item.Name), keyType);
|
customMapKeyTypes.Add(getDS4ControlsByName(Item.Name), keyType);
|
||||||
}
|
}
|
||||||
|
string extras;
|
||||||
|
Item = m_Xdoc.SelectSingleNode(String.Format("/" + rootname + "/" + control + "/Extras/{0}", button.Name));
|
||||||
|
if (Item != null)
|
||||||
|
{
|
||||||
|
extras = Item.InnerText;
|
||||||
|
customMapExtras.Add(getDS4ControlsByName(button.Name), Item.InnerText);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
extras = "0,0,0,0,0,0,0,0";
|
||||||
Item = m_Xdoc.SelectSingleNode(String.Format("/" + rootname + "/" + control + "/Macro/{0}", button.Name));
|
Item = m_Xdoc.SelectSingleNode(String.Format("/" + rootname + "/" + control + "/Macro/{0}", button.Name));
|
||||||
if (Item != null)
|
if (Item != null)
|
||||||
{
|
{
|
||||||
@ -1635,7 +1762,7 @@ namespace DS4Control
|
|||||||
else if (keys[i] > 300) splitter[i] = "Wait " + (keys[i] - 300) + "ms";
|
else if (keys[i] > 300) splitter[i] = "Wait " + (keys[i] - 300) + "ms";
|
||||||
}
|
}
|
||||||
button.Text = "Macro";
|
button.Text = "Macro";
|
||||||
button.Tag = keys;
|
button.Tag = new KeyValuePair<int[], string>(keys, extras);
|
||||||
customMapMacros.Add(getDS4ControlsByName(button.Name), Item.InnerText);
|
customMapMacros.Add(getDS4ControlsByName(button.Name), Item.InnerText);
|
||||||
}
|
}
|
||||||
else if (m_Xdoc.SelectSingleNode(String.Format("/" + rootname + "/" + control + "/Key/{0}", button.Name)) != null)
|
else if (m_Xdoc.SelectSingleNode(String.Format("/" + rootname + "/" + control + "/Key/{0}", button.Name)) != null)
|
||||||
@ -1645,20 +1772,21 @@ namespace DS4Control
|
|||||||
{
|
{
|
||||||
//foundBinding = true;
|
//foundBinding = true;
|
||||||
customMapKeys.Add(getDS4ControlsByName(Item.Name), wvk);
|
customMapKeys.Add(getDS4ControlsByName(Item.Name), wvk);
|
||||||
button.Tag = wvk;
|
button.Tag = new KeyValuePair<int, string>(wvk, extras);
|
||||||
button.Text = ((System.Windows.Forms.Keys)wvk).ToString();
|
button.Text = ((System.Windows.Forms.Keys)wvk).ToString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else if (m_Xdoc.SelectSingleNode(String.Format("/" + rootname + "/" + control + "/Button/{0}", button.Name)) != null)
|
||||||
{
|
{
|
||||||
Item = m_Xdoc.SelectSingleNode(String.Format("/" + rootname + "/" + control + "/Button/{0}", button.Name));
|
Item = m_Xdoc.SelectSingleNode(String.Format("/" + rootname + "/" + control + "/Button/{0}", button.Name));
|
||||||
if (Item != null)
|
//foundBinding = true;
|
||||||
{
|
button.Tag = new KeyValuePair<string, string>(Item.InnerText, extras);
|
||||||
//foundBinding = true;
|
button.Text = Item.InnerText;
|
||||||
button.Tag = Item.InnerText;
|
customMapButtons.Add(getDS4ControlsByName(button.Name), getX360ControlsByName(Item.InnerText));
|
||||||
button.Text = Item.InnerText;
|
}
|
||||||
customMapButtons.Add(getDS4ControlsByName(button.Name), getX360ControlsByName(Item.InnerText));
|
else
|
||||||
}
|
{
|
||||||
|
button.Tag = new KeyValuePair<object, string>(null, extras);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
|
@ -31,7 +31,8 @@ namespace DS4Windows
|
|||||||
WebClient wc = new WebClient();
|
WebClient wc = new WebClient();
|
||||||
Timer test = new Timer(), hotkeysTimer = new Timer();
|
Timer test = new Timer(), hotkeysTimer = new Timer();
|
||||||
string exepath = Directory.GetParent(Assembly.GetExecutingAssembly().Location).FullName;
|
string exepath = Directory.GetParent(Assembly.GetExecutingAssembly().Location).FullName;
|
||||||
string appdatapath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\DS4Tool";
|
string appdatapath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\DS4Windows";
|
||||||
|
string oldappdatapath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\DS4Tool";
|
||||||
float dpix, dpiy;
|
float dpix, dpiy;
|
||||||
DateTime oldnow = DateTime.UtcNow;
|
DateTime oldnow = DateTime.UtcNow;
|
||||||
string tempprofile = "null";
|
string tempprofile = "null";
|
||||||
@ -86,7 +87,7 @@ namespace DS4Windows
|
|||||||
(ToolStripMenuItem)notifyIcon1.ContextMenuStrip.Items[3] };
|
(ToolStripMenuItem)notifyIcon1.ContextMenuStrip.Items[3] };
|
||||||
SystemEvents.PowerModeChanged += OnPowerChange;
|
SystemEvents.PowerModeChanged += OnPowerChange;
|
||||||
tSOptions.Visible = false;
|
tSOptions.Visible = false;
|
||||||
if (File.Exists(appdatapath + "\\Profiles.xml"))
|
if (File.Exists(appdatapath + "\\Auto Profiles.xml"))
|
||||||
tt.SetToolTip(linkUninstall, Properties.Resources.IfRemovingDS4Windows);
|
tt.SetToolTip(linkUninstall, Properties.Resources.IfRemovingDS4Windows);
|
||||||
tt.SetToolTip(cBSwipeProfiles, Properties.Resources.TwoFingerSwipe);
|
tt.SetToolTip(cBSwipeProfiles, Properties.Resources.TwoFingerSwipe);
|
||||||
tt.SetToolTip(cBQuickCharge, Properties.Resources.QuickCharge);
|
tt.SetToolTip(cBQuickCharge, Properties.Resources.QuickCharge);
|
||||||
@ -101,6 +102,20 @@ namespace DS4Windows
|
|||||||
Global.SaveWhere(exepath);
|
Global.SaveWhere(exepath);
|
||||||
else if (File.Exists(appdatapath + "\\Auto Profiles.xml"))
|
else if (File.Exists(appdatapath + "\\Auto Profiles.xml"))
|
||||||
Global.SaveWhere(appdatapath);
|
Global.SaveWhere(appdatapath);
|
||||||
|
else if (File.Exists(oldappdatapath + "\\Auto Profiles.xml"))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Directory.Move(oldappdatapath, appdatapath);
|
||||||
|
Global.SaveWhere(appdatapath);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
MessageBox.Show(Properties.Resources.CannotMoveFiles, "DS4Windows");
|
||||||
|
Close();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
else if (!File.Exists(exepath + "\\Auto Profiles.xml")
|
else if (!File.Exists(exepath + "\\Auto Profiles.xml")
|
||||||
&& !File.Exists(appdatapath + "\\Auto Profiles.xml"))
|
&& !File.Exists(appdatapath + "\\Auto Profiles.xml"))
|
||||||
{
|
{
|
||||||
@ -261,13 +276,6 @@ namespace DS4Windows
|
|||||||
Show();
|
Show();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*private void exitToolStripMenuItem_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
mAllowClose = mAllowVisible = true;
|
|
||||||
if (!mLoadFired) Show();
|
|
||||||
Close();
|
|
||||||
}*/
|
|
||||||
|
|
||||||
public static string GetTopWindowName()
|
public static string GetTopWindowName()
|
||||||
{
|
{
|
||||||
IntPtr hWnd = GetForegroundWindow();
|
IntPtr hWnd = GetForegroundWindow();
|
||||||
@ -402,9 +410,15 @@ namespace DS4Windows
|
|||||||
|
|
||||||
if (!deriverinstalled)
|
if (!deriverinstalled)
|
||||||
{
|
{
|
||||||
WelcomeDialog wd = new WelcomeDialog();
|
Process p = new Process();
|
||||||
wd.ShowDialog();
|
p.StartInfo.FileName = Assembly.GetExecutingAssembly().Location;
|
||||||
wd.FormClosed += delegate { btnStartStop_Clicked(false); btnStartStop_Clicked(false); };
|
p.StartInfo.Arguments = "driverinstall";
|
||||||
|
p.StartInfo.Verb = "runas";
|
||||||
|
try { p.Start(); }
|
||||||
|
catch { }
|
||||||
|
//WelcomeDialog wd = new WelcomeDialog();
|
||||||
|
//wd.ShowDialog();
|
||||||
|
//wd.FormClosed += delegate { btnStartStop_Clicked(false); btnStartStop_Clicked(false); };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
@ -442,8 +456,8 @@ namespace DS4Windows
|
|||||||
p.StartInfo.FileName = exepath + "\\DS4Updater.exe";
|
p.StartInfo.FileName = exepath + "\\DS4Updater.exe";
|
||||||
if (Global.AdminNeeded())
|
if (Global.AdminNeeded())
|
||||||
p.StartInfo.Verb = "runas";
|
p.StartInfo.Verb = "runas";
|
||||||
p.Start();
|
try { p.Start(); Close(); }
|
||||||
Close();
|
catch { }
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
File.Delete(Global.appdatapath + "\\version.txt");
|
File.Delete(Global.appdatapath + "\\version.txt");
|
||||||
@ -1297,8 +1311,8 @@ namespace DS4Windows
|
|||||||
p.StartInfo.FileName = exepath + "\\DS4Updater.exe";
|
p.StartInfo.FileName = exepath + "\\DS4Updater.exe";
|
||||||
if (Global.AdminNeeded())
|
if (Global.AdminNeeded())
|
||||||
p.StartInfo.Verb = "runas";
|
p.StartInfo.Verb = "runas";
|
||||||
p.Start();
|
try { p.Start(); Close(); }
|
||||||
Close();
|
catch { }
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
File.Delete(Global.appdatapath + "\\version.txt");
|
File.Delete(Global.appdatapath + "\\version.txt");
|
||||||
@ -1328,8 +1342,14 @@ namespace DS4Windows
|
|||||||
|
|
||||||
private void lLSetup_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
|
private void lLSetup_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
|
||||||
{
|
{
|
||||||
WelcomeDialog wd = new WelcomeDialog();
|
Process p = new Process();
|
||||||
wd.ShowDialog();
|
p.StartInfo.FileName = Assembly.GetExecutingAssembly().Location;
|
||||||
|
p.StartInfo.Arguments = "driverinstall";
|
||||||
|
p.StartInfo.Verb = "runas";
|
||||||
|
try { p.Start(); }
|
||||||
|
catch { }
|
||||||
|
//WelcomeDialog wd = new WelcomeDialog();
|
||||||
|
//wd.ShowDialog();
|
||||||
tabSettings.Text = "Settings";
|
tabSettings.Text = "Settings";
|
||||||
linkSetup.LinkColor = Color.Blue;
|
linkSetup.LinkColor = Color.Blue;
|
||||||
}
|
}
|
||||||
|
@ -81,9 +81,7 @@
|
|||||||
<PropertyGroup />
|
<PropertyGroup />
|
||||||
<PropertyGroup />
|
<PropertyGroup />
|
||||||
<PropertyGroup />
|
<PropertyGroup />
|
||||||
<PropertyGroup>
|
<PropertyGroup />
|
||||||
<NoWin32Manifest>true</NoWin32Manifest>
|
|
||||||
</PropertyGroup>
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
|
2647
DS4Tool/KBM360.Designer.cs
generated
2647
DS4Tool/KBM360.Designer.cs
generated
File diff suppressed because it is too large
Load Diff
@ -17,8 +17,9 @@ namespace DS4Windows
|
|||||||
private Options ops;
|
private Options ops;
|
||||||
public List<string> macros = new List<string>();
|
public List<string> macros = new List<string>();
|
||||||
public List<int> macrostag = new List<int>();
|
public List<int> macrostag = new List<int>();
|
||||||
public bool macrorepeat;
|
public bool macrorepeat, newaction;
|
||||||
RecordBox rb;
|
RecordBox rb;
|
||||||
|
object oldtag;
|
||||||
public KBM360(DS4Control.Control bus_device, int deviceNum, Options ooo, Button buton)
|
public KBM360(DS4Control.Control bus_device, int deviceNum, Options ooo, Button buton)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
@ -28,11 +29,63 @@ namespace DS4Windows
|
|||||||
button = buton;
|
button = buton;
|
||||||
cbToggle.Checked = button.Font.Italic;
|
cbToggle.Checked = button.Font.Italic;
|
||||||
cbScanCode.Checked = button.Font.Bold;
|
cbScanCode.Checked = button.Font.Bold;
|
||||||
if (button.Font.Underline)
|
if (button.Tag != null)
|
||||||
{
|
{
|
||||||
lBMacroOn.Visible = true;
|
string[] extras;
|
||||||
foreach (int i in ((int[])button.Tag))
|
if (button.Tag is KeyValuePair<int, string>)
|
||||||
macrostag.Add(i);
|
{
|
||||||
|
KeyValuePair<int, string> tag = (KeyValuePair<int, string>)button.Tag;
|
||||||
|
oldtag = tag.Key;
|
||||||
|
extras = tag.Value.Split(',');
|
||||||
|
}
|
||||||
|
else if (button.Tag is KeyValuePair<Int32[], string>)
|
||||||
|
{
|
||||||
|
KeyValuePair<Int32[], string> tag = (KeyValuePair<Int32[], string>)button.Tag;
|
||||||
|
oldtag = tag.Key;
|
||||||
|
if (button.Font.Underline)
|
||||||
|
{
|
||||||
|
lBMacroOn.Visible = true;
|
||||||
|
foreach (int i in ((int[])tag.Key))
|
||||||
|
macrostag.Add(i);
|
||||||
|
}
|
||||||
|
if (button.Font.Strikeout)
|
||||||
|
macrorepeat = true;
|
||||||
|
extras = tag.Value.Split(',');
|
||||||
|
}
|
||||||
|
else if (button.Tag is KeyValuePair<string, string>)
|
||||||
|
{
|
||||||
|
KeyValuePair<string, string> tag = (KeyValuePair<string, string>)button.Tag;
|
||||||
|
oldtag = tag.Key;
|
||||||
|
extras = tag.Value.Split(',');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
KeyValuePair<object, string> tag = (KeyValuePair<object, string>)button.Tag;
|
||||||
|
extras = tag.Value.Split(',');
|
||||||
|
}
|
||||||
|
int b;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (int.TryParse(extras[0], out b)) nUDHeavy.Value = b;
|
||||||
|
if (int.TryParse(extras[1], out b)) nUDLight.Value = b;
|
||||||
|
if (int.TryParse(extras[2], out b))
|
||||||
|
if (b == 1)
|
||||||
|
{
|
||||||
|
cBLightbar.Checked = true;
|
||||||
|
if (int.TryParse(extras[3], out b)) tBRedBar.Value = b;
|
||||||
|
if (int.TryParse(extras[4], out b)) tBGreenBar.Value = b;
|
||||||
|
if (int.TryParse(extras[5], out b)) tBBlueBar.Value = b;
|
||||||
|
if (int.TryParse(extras[6], out b)) nUDLightFlash.Value = b;
|
||||||
|
}
|
||||||
|
if (int.TryParse(extras[7], out b))
|
||||||
|
if (b == 1)
|
||||||
|
{
|
||||||
|
cBMouse.Checked = true;
|
||||||
|
if (int.TryParse(extras[8], out b)) nUDMouse.Value = b;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
}
|
}
|
||||||
if (button.Name.StartsWith("bn"))
|
if (button.Name.StartsWith("bn"))
|
||||||
Text = Properties.Resources.SelectActionTitle.Replace("*action*", button.Name.Substring(2));
|
Text = Properties.Resources.SelectActionTitle.Replace("*action*", button.Name.Substring(2));
|
||||||
@ -46,7 +99,7 @@ namespace DS4Windows
|
|||||||
Text = Properties.Resources.SelectActionTitle.Replace("*action*", button.Name.Substring(7));
|
Text = Properties.Resources.SelectActionTitle.Replace("*action*", button.Name.Substring(7));
|
||||||
btnFallBack.Text = "Fall Back";
|
btnFallBack.Text = "Fall Back";
|
||||||
}
|
}
|
||||||
foreach (System.Windows.Forms.Control control in this.Controls)
|
foreach (System.Windows.Forms.Control control in Controls)
|
||||||
if (control is Button)
|
if (control is Button)
|
||||||
((Button)control).Click += anybtn_Click;
|
((Button)control).Click += anybtn_Click;
|
||||||
if (button.Name.Contains("Touch") || button.Name.Contains("Swipe"))
|
if (button.Name.Contains("Touch") || button.Name.Contains("Swipe"))
|
||||||
@ -61,7 +114,7 @@ namespace DS4Windows
|
|||||||
|
|
||||||
public void anybtn_Click(object sender, EventArgs e)
|
public void anybtn_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (rb == null && sender is Button && ((Button)sender).Name != "bnMacro")
|
if (rb == null && sender is Button && ((Button)sender).Name != "bnMacro" && ((Button)sender).Name != "bnTest")
|
||||||
{
|
{
|
||||||
Button bn = ((Button)sender);
|
Button bn = ((Button)sender);
|
||||||
string keyname;
|
string keyname;
|
||||||
@ -93,41 +146,68 @@ namespace DS4Windows
|
|||||||
else
|
else
|
||||||
keytag = ((Button)sender).Tag;
|
keytag = ((Button)sender).Tag;
|
||||||
lBMacroOn.Visible = false;
|
lBMacroOn.Visible = false;
|
||||||
ops.ChangeButtonText(keyname, keytag);
|
string extras = GetExtras();
|
||||||
|
KeyValuePair<object, string> tag = new KeyValuePair<object, string>(keytag, extras);
|
||||||
|
newaction = true;
|
||||||
|
ops.ChangeButtonText(keyname, tag);
|
||||||
this.Close();
|
this.Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private string GetExtras()
|
||||||
|
{
|
||||||
|
string t =(byte)nUDHeavy.Value + "," + (byte)nUDLight.Value + "," +
|
||||||
|
(cBLightbar.Checked ? "1" + "," + tBRedBar.Value + "," + tBGreenBar.Value + "," + tBBlueBar.Value + "," + nUDLightFlash.Value: "0,0,0,0,0") + "," +
|
||||||
|
(cBMouse.Checked ? "1" + "," + (byte)nUDMouse.Value : "0,0");
|
||||||
|
return t;
|
||||||
|
}
|
||||||
private void finalMeasure(object sender, FormClosedEventArgs e)
|
private void finalMeasure(object sender, FormClosedEventArgs e)
|
||||||
{
|
{
|
||||||
if (rb != null)
|
if (rb != null) //if record macro is open
|
||||||
{
|
{
|
||||||
if (!rb.saved && rb.macros.Count > 0)
|
if (!rb.saved && rb.macros.Count > 0)
|
||||||
if (MessageBox.Show(Properties.Resources.SaveRecordedMacro, "DS4Windows", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
|
if (MessageBox.Show(Properties.Resources.SaveRecordedMacro, "DS4Windows", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
|
||||||
rb.btnSave_Click(this, null);
|
rb.btnSave_Click(this, null);
|
||||||
}
|
}
|
||||||
if (lBMacroOn.Visible)
|
if (lBMacroOn.Visible)
|
||||||
ops.ChangeButtonText("Macro", macrostag.ToArray());
|
{
|
||||||
|
string extras = GetExtras();
|
||||||
|
KeyValuePair<object, string> tag = new KeyValuePair<object, string>(macrostag.ToArray(), extras);
|
||||||
|
ops.ChangeButtonText("Macro", tag);
|
||||||
|
//ops.ChangeButtonText("Macro", macrostag.ToArray());
|
||||||
|
}
|
||||||
|
else if (!newaction)
|
||||||
|
{
|
||||||
|
string extras = GetExtras();
|
||||||
|
KeyValuePair<object, string> tag = new KeyValuePair<object, string>(oldtag, extras);
|
||||||
|
ops.ChangeButtonText(button.Text, tag);
|
||||||
|
}
|
||||||
ops.Toggle_Bn(cbScanCode.Checked, cbToggle.Checked, lBMacroOn.Visible, macrorepeat);
|
ops.Toggle_Bn(cbScanCode.Checked, cbToggle.Checked, lBMacroOn.Visible, macrorepeat);
|
||||||
ops.UpdateLists();
|
ops.UpdateLists();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Key_Down_Action(object sender, KeyEventArgs e)
|
private void Key_Down_Action(object sender, KeyEventArgs e)
|
||||||
{
|
{
|
||||||
if (rb == null)
|
if (rb == null && !(ActiveControl is NumericUpDown) && !(ActiveControl is TrackBar))
|
||||||
{
|
{
|
||||||
lBMacroOn.Visible = false;
|
lBMacroOn.Visible = false;
|
||||||
ops.ChangeButtonText(e.KeyCode.ToString(), e.KeyValue);
|
string extras = GetExtras();
|
||||||
|
KeyValuePair<object, string> tag = new KeyValuePair<object, string>(e.KeyValue, extras);
|
||||||
|
newaction = true;
|
||||||
|
ops.ChangeButtonText(e.KeyCode.ToString(), tag);
|
||||||
this.Close();
|
this.Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Key_Press_Action(object sender, KeyEventArgs e)
|
private void Key_Press_Action(object sender, KeyEventArgs e)
|
||||||
{
|
{
|
||||||
if (rb == null)
|
if (rb == null && !(ActiveControl is NumericUpDown) && !(ActiveControl is TrackBar))
|
||||||
{
|
{
|
||||||
lBMacroOn.Visible = false;
|
lBMacroOn.Visible = false;
|
||||||
ops.ChangeButtonText(e.KeyCode.ToString(), e.KeyValue);
|
string extras = GetExtras();
|
||||||
|
KeyValuePair<object, string> tag = new KeyValuePair<object, string>(e.KeyValue, extras);
|
||||||
|
newaction = true;
|
||||||
|
ops.ChangeButtonText(e.KeyCode.ToString(), tag);
|
||||||
this.Close();
|
this.Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -187,5 +267,140 @@ namespace DS4Windows
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int alphacolor;
|
||||||
|
private Color reg, full;
|
||||||
|
int bgc = 240; //Color of the form background, If greyscale color
|
||||||
|
private void redBar_ValueChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
cBLightbar.Checked = true;
|
||||||
|
int value = ((TrackBar)sender).Value;
|
||||||
|
int sat = bgc - (value < bgc ? value : bgc);
|
||||||
|
int som = bgc + 11 * (int)(value * 0.0039215);
|
||||||
|
((TrackBar)sender).BackColor = Color.FromArgb(som, sat, sat);
|
||||||
|
alphacolor = Math.Max(tBRedBar.Value, Math.Max(tBGreenBar.Value, tBBlueBar.Value));
|
||||||
|
reg = Color.FromArgb(tBRedBar.Value, tBGreenBar.Value, tBBlueBar.Value);
|
||||||
|
full = HuetoRGB(reg.GetHue(), reg.GetBrightness(), reg);
|
||||||
|
bnColor.BackColor = Color.FromArgb((alphacolor > 205 ? 255 : (alphacolor + 50)), full);
|
||||||
|
Global.saveColor(device, (byte)tBRedBar.Value, (byte)tBGreenBar.Value, (byte)tBBlueBar.Value);
|
||||||
|
lbRedV.Text = ((TrackBar)sender).Value.ToString();
|
||||||
|
}
|
||||||
|
private void greenBar_ValueChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
cBLightbar.Checked = true;
|
||||||
|
int value = ((TrackBar)sender).Value;
|
||||||
|
int sat = bgc - (value < bgc ? value : bgc);
|
||||||
|
int som = bgc + 11 * (int)(value * 0.0039215);
|
||||||
|
((TrackBar)sender).BackColor = Color.FromArgb(sat, som, sat);
|
||||||
|
alphacolor = Math.Max(tBRedBar.Value, Math.Max(tBGreenBar.Value, tBBlueBar.Value));
|
||||||
|
reg = Color.FromArgb(tBRedBar.Value, tBGreenBar.Value, tBBlueBar.Value);
|
||||||
|
full = HuetoRGB(reg.GetHue(), reg.GetBrightness(), reg);
|
||||||
|
bnColor.BackColor = Color.FromArgb((alphacolor > 205 ? 255 : (alphacolor + 50)), full);
|
||||||
|
Global.saveColor(device, (byte)tBRedBar.Value, (byte)tBGreenBar.Value, (byte)tBBlueBar.Value);
|
||||||
|
lbGreenV.Text = ((TrackBar)sender).Value.ToString();
|
||||||
|
}
|
||||||
|
private void blueBar_ValueChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
cBLightbar.Checked = true;
|
||||||
|
int value = ((TrackBar)sender).Value;
|
||||||
|
int sat = bgc - (value < bgc ? value : bgc);
|
||||||
|
int som = bgc + 11 * (int)(value * 0.0039215);
|
||||||
|
((TrackBar)sender).BackColor = Color.FromArgb(sat, sat, som);
|
||||||
|
alphacolor = Math.Max(tBRedBar.Value, Math.Max(tBGreenBar.Value, tBBlueBar.Value));
|
||||||
|
reg = Color.FromArgb(tBRedBar.Value, tBGreenBar.Value, tBBlueBar.Value);
|
||||||
|
full = HuetoRGB(reg.GetHue(), reg.GetBrightness(), reg);
|
||||||
|
bnColor.BackColor = Color.FromArgb((alphacolor > 205 ? 255 : (alphacolor + 50)), full);
|
||||||
|
Global.saveColor(device, (byte)tBRedBar.Value, (byte)tBGreenBar.Value, (byte)tBBlueBar.Value);
|
||||||
|
lbBlueV.Text = ((TrackBar)sender).Value.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public Color HuetoRGB(float hue, float light, Color rgb)
|
||||||
|
{
|
||||||
|
float L = (float)Math.Max(.5, light);
|
||||||
|
float C = (1 - Math.Abs(2 * L - 1));
|
||||||
|
float X = (C * (1 - Math.Abs((hue / 60) % 2 - 1)));
|
||||||
|
float m = L - C / 2;
|
||||||
|
float R = 0, G = 0, B = 0;
|
||||||
|
if (light == 1) return Color.FromName("White");
|
||||||
|
else if (rgb.R == rgb.G && rgb.G == rgb.B) return Color.FromName("White");
|
||||||
|
else if (0 <= hue && hue < 60) { R = C; G = X; }
|
||||||
|
else if (60 <= hue && hue < 120) { R = X; G = C; }
|
||||||
|
else if (120 <= hue && hue < 180) { G = C; B = X; }
|
||||||
|
else if (180 <= hue && hue < 240) { G = X; B = C; }
|
||||||
|
else if (240 <= hue && hue < 300) { R = X; B = C; }
|
||||||
|
else if (300 <= hue && hue < 360) { R = C; B = X; }
|
||||||
|
return Color.FromArgb((int)((R + m) * 255), (int)((G + m) * 255), (int)((B + m) * 255));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void bnColor_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
advColorDialog.Color = bnColor.BackColor;
|
||||||
|
if (advColorDialog.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
cBLightbar.Checked = true;
|
||||||
|
bnColor.BackColor = advColorDialog.Color;
|
||||||
|
tBRedBar.Value = advColorDialog.Color.R;
|
||||||
|
tBGreenBar.Value = advColorDialog.Color.G;
|
||||||
|
tBBlueBar.Value = advColorDialog.Color.B;
|
||||||
|
}
|
||||||
|
if (device < 4)
|
||||||
|
DS4Control.DS4LightBar.forcelight[device] = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void advColorDialog_OnUpdateColor(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (sender is Color && device < 4)
|
||||||
|
{
|
||||||
|
Color color = (Color)sender;
|
||||||
|
DS4Library.DS4Color dcolor = new DS4Library.DS4Color { red = color.R, green = color.G, blue = color.B };
|
||||||
|
DS4Control.DS4LightBar.forcedColor[device] = dcolor;
|
||||||
|
DS4Control.DS4LightBar.forcedFlash[device] = 0;
|
||||||
|
DS4Control.DS4LightBar.forcelight[device] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void bnTest_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (device < 4)
|
||||||
|
if (((Button)sender).Text == Properties.Resources.TestText)
|
||||||
|
{
|
||||||
|
scpDevice.setRumble((byte)nUDHeavy.Value, (byte)nUDLight.Value, device);
|
||||||
|
((Button)sender).Text = Properties.Resources.StopText;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
scpDevice.setRumble(0, 0, device);
|
||||||
|
((Button)sender).Text = Properties.Resources.TestText;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if (((Button)sender).Text == Properties.Resources.TestText)
|
||||||
|
{
|
||||||
|
scpDevice.setRumble((byte)nUDHeavy.Value, (byte)nUDLight.Value, 0);
|
||||||
|
((Button)sender).Text = Properties.Resources.StopText;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
scpDevice.setRumble(0, 0, 0);
|
||||||
|
((Button)sender).Text = Properties.Resources.TestText;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void nUD_ValueChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (bnTest.Text != Properties.Resources.TestText)
|
||||||
|
{
|
||||||
|
if (device < 4)
|
||||||
|
scpDevice.setRumble((byte)nUDHeavy.Value, (byte)nUDLight.Value, device);
|
||||||
|
else
|
||||||
|
scpDevice.setRumble((byte)nUDHeavy.Value, (byte)nUDLight.Value, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void nUDMouse_ValueChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
cBMouse.Checked = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
9024
DS4Tool/KBM360.resx
9024
DS4Tool/KBM360.resx
File diff suppressed because it is too large
Load Diff
@ -470,18 +470,18 @@ namespace DS4Windows
|
|||||||
kbm360.ShowDialog();
|
kbm360.ShowDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ChangeButtonText(string controlname, object tag)
|
public void ChangeButtonText(string controlname, KeyValuePair<object, string> tag)
|
||||||
{
|
{
|
||||||
lastSelected.Text = controlname;
|
lastSelected.Text = controlname;
|
||||||
int value;
|
int value;
|
||||||
if (tag == null)
|
if (tag.Key == null)
|
||||||
lastSelected.Tag = tag;
|
|
||||||
else if (Int32.TryParse(tag.ToString(), out value))
|
|
||||||
lastSelected.Tag = value;
|
|
||||||
else if (tag is Int32[])
|
|
||||||
lastSelected.Tag = tag;
|
lastSelected.Tag = tag;
|
||||||
|
else if (Int32.TryParse(tag.Key.ToString(), out value))
|
||||||
|
lastSelected.Tag = new KeyValuePair<int, string>(value, tag.Value);
|
||||||
|
else if (tag.Key is Int32[])
|
||||||
|
lastSelected.Tag = new KeyValuePair<Int32[], string>((Int32[])tag.Key, tag.Value);
|
||||||
else
|
else
|
||||||
lastSelected.Tag = tag.ToString();
|
lastSelected.Tag = new KeyValuePair<string, string>(tag.Key.ToString(), tag.Value);
|
||||||
}
|
}
|
||||||
public void ChangeButtonText(string controlname)
|
public void ChangeButtonText(string controlname)
|
||||||
{
|
{
|
||||||
@ -490,11 +490,11 @@ namespace DS4Windows
|
|||||||
}
|
}
|
||||||
public void Toggle_Bn(bool SC, bool TG, bool MC, bool MR)
|
public void Toggle_Bn(bool SC, bool TG, bool MC, bool MR)
|
||||||
{
|
{
|
||||||
if (lastSelected.Tag is int || lastSelected.Tag is UInt16 || lastSelected.Tag is int[])
|
if (lastSelected.Tag is KeyValuePair<int, string> || lastSelected.Tag is KeyValuePair<UInt16, string> || lastSelected.Tag is KeyValuePair<int[], string>)
|
||||||
lastSelected.Font = new Font(lastSelected.Font,
|
lastSelected.Font = new Font(lastSelected.Font,
|
||||||
(SC ? FontStyle.Bold : FontStyle.Regular) | (TG ? FontStyle.Italic : FontStyle.Regular) |
|
(SC ? FontStyle.Bold : FontStyle.Regular) | (TG ? FontStyle.Italic : FontStyle.Regular) |
|
||||||
(MC ? FontStyle.Underline : FontStyle.Regular) | (MR ? FontStyle.Strikeout : FontStyle.Regular));
|
(MC ? FontStyle.Underline : FontStyle.Regular) | (MR ? FontStyle.Strikeout : FontStyle.Regular));
|
||||||
else if (lastSelected.Tag is string)
|
else if (lastSelected.Tag is KeyValuePair<string, string>)
|
||||||
if (lastSelected.Tag.ToString().Contains("Mouse Button"))
|
if (lastSelected.Tag.ToString().Contains("Mouse Button"))
|
||||||
lastSelected.Font = new Font(lastSelected.Font, TG ? FontStyle.Italic : FontStyle.Regular);
|
lastSelected.Font = new Font(lastSelected.Font, TG ? FontStyle.Italic : FontStyle.Regular);
|
||||||
else
|
else
|
||||||
@ -534,12 +534,8 @@ namespace DS4Windows
|
|||||||
tBGreenBar.Value = advColorDialog.Color.G;
|
tBGreenBar.Value = advColorDialog.Color.G;
|
||||||
tBBlueBar.Value = advColorDialog.Color.B;
|
tBBlueBar.Value = advColorDialog.Color.B;
|
||||||
}
|
}
|
||||||
else Global.saveColor(device, oldLedColor[0], oldLedColor[1], oldLedColor[2]);
|
if (device < 4)
|
||||||
Global.saveChargingColor(device, oldChargingColor[0], oldChargingColor[1], oldChargingColor[2]);
|
DS4Control.DS4LightBar.forcelight[device] = false;
|
||||||
Global.saveLowColor(device, oldLowLedColor[0], oldLowLedColor[1], oldLowLedColor[2]);
|
|
||||||
oldChargingColor = null;
|
|
||||||
oldLedColor = null;
|
|
||||||
oldLowLedColor = null;
|
|
||||||
}
|
}
|
||||||
private void lowColorChooserButton_Click(object sender, EventArgs e)
|
private void lowColorChooserButton_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
@ -552,12 +548,8 @@ namespace DS4Windows
|
|||||||
tBLowGreenBar.Value = advColorDialog.Color.G;
|
tBLowGreenBar.Value = advColorDialog.Color.G;
|
||||||
tBLowBlueBar.Value = advColorDialog.Color.B;
|
tBLowBlueBar.Value = advColorDialog.Color.B;
|
||||||
}
|
}
|
||||||
else Global.saveLowColor(device, oldLowLedColor[0], oldLowLedColor[1], oldLowLedColor[2]);
|
if (device < 4)
|
||||||
Global.saveChargingColor(device, oldChargingColor[0], oldChargingColor[1], oldChargingColor[2]);
|
DS4Control.DS4LightBar.forcelight[device] = false;
|
||||||
Global.saveColor(device, oldLedColor[0], oldLedColor[1], oldLedColor[2]);
|
|
||||||
oldChargingColor = null;
|
|
||||||
oldLedColor = null;
|
|
||||||
oldLowLedColor = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -569,30 +561,18 @@ namespace DS4Windows
|
|||||||
{
|
{
|
||||||
btnChargingColor.BackColor = advColorDialog.Color;
|
btnChargingColor.BackColor = advColorDialog.Color;
|
||||||
}
|
}
|
||||||
else Global.saveChargingColor(device, oldChargingColor[0], oldChargingColor[1], oldChargingColor[2]);
|
if (device < 4)
|
||||||
Global.saveLowColor(device, oldLowLedColor[0], oldLowLedColor[1], oldLowLedColor[2]);
|
DS4Control.DS4LightBar.forcelight[device] = false;
|
||||||
Global.saveColor(device, oldLedColor[0], oldLedColor[1], oldLedColor[2]);
|
|
||||||
oldChargingColor = null;
|
|
||||||
oldLedColor = null;
|
|
||||||
oldLowLedColor = null;
|
|
||||||
}
|
}
|
||||||
private void advColorDialog_OnUpdateColor(object sender, EventArgs e)
|
private void advColorDialog_OnUpdateColor(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (oldLedColor == null || oldLowLedColor == null || oldChargingColor == null)
|
if (sender is Color && device < 4)
|
||||||
{
|
|
||||||
DS4Color color = Global.loadColor(device);
|
|
||||||
oldLedColor = new Byte[] { color.red, color.green, color.blue };
|
|
||||||
color = Global.loadLowColor(device);
|
|
||||||
oldLowLedColor = new Byte[] { color.red, color.green, color.blue };
|
|
||||||
color = Global.loadChargingColor(device);
|
|
||||||
oldChargingColor = new Byte[] { color.red, color.green, color.blue };
|
|
||||||
}
|
|
||||||
if (sender is Color)
|
|
||||||
{
|
{
|
||||||
Color color = (Color)sender;
|
Color color = (Color)sender;
|
||||||
Global.saveColor(device, color.R, color.G, color.B);
|
DS4Library.DS4Color dcolor = new DS4Library.DS4Color { red = color.R, green = color.G, blue = color.B };
|
||||||
Global.saveLowColor(device, color.R, color.G, color.B);
|
DS4Control.DS4LightBar.forcedColor[device] = dcolor;
|
||||||
Global.saveChargingColor(device, color.R, color.G, color.B);
|
DS4Control.DS4LightBar.forcedFlash[device] = 0;
|
||||||
|
DS4Control.DS4LightBar.forcelight[device] = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int bgc = 255; //Color of the form background, If greyscale color
|
int bgc = 255; //Color of the form background, If greyscale color
|
||||||
@ -1434,7 +1414,7 @@ namespace DS4Windows
|
|||||||
private void cBDinput_CheckedChanged(object sender, EventArgs e)
|
private void cBDinput_CheckedChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Global.setDinputOnly(device, cBDinput.Checked);
|
Global.setDinputOnly(device, cBDinput.Checked);
|
||||||
if (device > 4)
|
if (device < 4)
|
||||||
{
|
{
|
||||||
root.btnStartStop_Clicked(false);
|
root.btnStartStop_Clicked(false);
|
||||||
root.btnStartStop_Clicked(false);
|
root.btnStartStop_Clicked(false);
|
||||||
|
2755
DS4Tool/Options.resx
2755
DS4Tool/Options.resx
File diff suppressed because it is too large
Load Diff
@ -30,6 +30,16 @@ namespace DS4Windows
|
|||||||
[STAThread]
|
[STAThread]
|
||||||
static void Main(string[] args)
|
static void Main(string[] args)
|
||||||
{
|
{
|
||||||
|
foreach(string s in args)
|
||||||
|
{
|
||||||
|
if (s == "driverinstall")
|
||||||
|
{
|
||||||
|
Application.EnableVisualStyles();
|
||||||
|
Application.SetCompatibleTextRenderingDefault(false);
|
||||||
|
Application.Run(new WelcomeDialog());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
System.Runtime.GCSettings.LatencyMode = System.Runtime.GCLatencyMode.LowLatency;
|
System.Runtime.GCSettings.LatencyMode = System.Runtime.GCLatencyMode.LowLatency;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
|||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("1.4.158")]
|
[assembly: AssemblyVersion("1.4.16")]
|
||||||
[assembly: AssemblyFileVersion("1.4.158")]
|
[assembly: AssemblyFileVersion("1.4.16")]
|
||||||
|
@ -580,4 +580,10 @@
|
|||||||
<data name="QuickCharge" xml:space="preserve">
|
<data name="QuickCharge" xml:space="preserve">
|
||||||
<value>EXPERIMENTAL: Auto-Disable BT when conencting to USB</value>
|
<value>EXPERIMENTAL: Auto-Disable BT when conencting to USB</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="TestText" xml:space="preserve">
|
||||||
|
<value>Test</value>
|
||||||
|
</data>
|
||||||
|
<data name="CannotMoveFiles" xml:space="preserve">
|
||||||
|
<value>Cannot move files, to new location, Please close out of any profiles in external programs</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
18
DS4Tool/Properties/Resources1.Designer.cs
generated
18
DS4Tool/Properties/Resources1.Designer.cs
generated
@ -183,6 +183,15 @@ namespace DS4Windows.Properties {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Cannot move files, to new location, Please close out of any profiles in external programs.
|
||||||
|
/// </summary>
|
||||||
|
internal static string CannotMoveFiles {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("CannotMoveFiles", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Cannot write at current locataion. Copy Settings to appdata?.
|
/// Looks up a localized string similar to Cannot write at current locataion. Copy Settings to appdata?.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -1284,6 +1293,15 @@ namespace DS4Windows.Properties {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Test.
|
||||||
|
/// </summary>
|
||||||
|
internal static string TestText {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("TestText", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Tilt Down.
|
/// Looks up a localized string similar to Tilt Down.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -39,10 +39,11 @@ namespace DS4Windows
|
|||||||
|
|
||||||
private void bnStep1_Click(object sender, EventArgs e)
|
private void bnStep1_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
//Application.Run(new DS4Driver(ref bnStep1));
|
||||||
WebClient wb = new WebClient();
|
WebClient wb = new WebClient();
|
||||||
if (bnStep1.Text == Properties.Resources.Step1)
|
if (bnStep1.Text == Properties.Resources.Step1)
|
||||||
{
|
{
|
||||||
wb.DownloadFileAsync(new Uri("http://ds4windows.com/Files/Virtual Bus Driver.zip"), Global.appdatapath + "\\VBus.zip");
|
wb.DownloadFileAsync(new Uri("http://ds4windows.com/Files/Virtual Bus Driver.zip"), exepath + "\\VBus.zip");
|
||||||
wb.DownloadProgressChanged += wb_DownloadProgressChanged;
|
wb.DownloadProgressChanged += wb_DownloadProgressChanged;
|
||||||
wb.DownloadFileCompleted += wb_DownloadFileCompleted;
|
wb.DownloadFileCompleted += wb_DownloadFileCompleted;
|
||||||
}
|
}
|
||||||
@ -56,9 +57,48 @@ namespace DS4Windows
|
|||||||
string exepath = Directory.GetParent(Assembly.GetExecutingAssembly().Location).FullName;
|
string exepath = Directory.GetParent(Assembly.GetExecutingAssembly().Location).FullName;
|
||||||
private void wb_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
|
private void wb_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
|
||||||
{
|
{
|
||||||
if (!Global.AdminNeeded())
|
bnStep1.Text = Properties.Resources.OpeningInstaller;
|
||||||
|
try
|
||||||
{
|
{
|
||||||
bnStep1.Text = Properties.Resources.OpeningInstaller;
|
File.Delete(exepath + "\\ScpDriver.exe");
|
||||||
|
File.Delete(exepath + "\\ScpDriver.log");
|
||||||
|
Directory.Delete(exepath + "\\System", true);
|
||||||
|
Directory.Delete(exepath + "\\DIFxAPI", true);
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
Directory.CreateDirectory(exepath + "\\Virtual Bus Driver");
|
||||||
|
try { ZipFile.ExtractToDirectory(exepath + "\\VBus.zip", exepath + "\\Virtual Bus Driver"); } //Saved so the user can uninstall later
|
||||||
|
catch { }
|
||||||
|
try { ZipFile.ExtractToDirectory(exepath + "\\VBus.zip", exepath); }
|
||||||
|
//Made here as starting the scpdriver.exe via process.start, the program looks for file from where it was called, not where the exe is
|
||||||
|
catch { }
|
||||||
|
if (File.Exists(exepath + "\\ScpDriver.exe"))
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Process.Start(exepath + "\\ScpDriver.exe", "si");
|
||||||
|
bnStep1.Text = Properties.Resources.Installing;
|
||||||
|
}
|
||||||
|
catch { Process.Start(exepath + "\\Virtual Bus Driver"); }
|
||||||
|
|
||||||
|
Timer timer = new Timer();
|
||||||
|
timer.Start();
|
||||||
|
timer.Tick += timer_Tick;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool running = false;
|
||||||
|
private void timer_Tick(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Process[] processes = Process.GetProcessesByName("ScpDriver");
|
||||||
|
if (processes.Length < 1)
|
||||||
|
{
|
||||||
|
string log = File.ReadAllText(exepath + "\\ScpDriver.log");
|
||||||
|
if (log.Contains("Install Succeeded"))
|
||||||
|
bnStep1.Text = Properties.Resources.InstallComplete;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
bnStep1.Text = Properties.Resources.InstallFailed;
|
||||||
|
Process.Start(exepath + "\\Virtual Bus Driver");
|
||||||
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
File.Delete(exepath + "\\ScpDriver.exe");
|
File.Delete(exepath + "\\ScpDriver.exe");
|
||||||
@ -67,76 +107,8 @@ namespace DS4Windows
|
|||||||
Directory.Delete(exepath + "\\DIFxAPI", true);
|
Directory.Delete(exepath + "\\DIFxAPI", true);
|
||||||
}
|
}
|
||||||
catch { }
|
catch { }
|
||||||
Directory.CreateDirectory(Global.appdatapath + "\\Virtual Bus Driver");
|
File.Delete(exepath + "\\VBus.zip");
|
||||||
try { ZipFile.ExtractToDirectory(Global.appdatapath + "\\VBus.zip", Global.appdatapath + "\\Virtual Bus Driver"); } //Saved so the user can uninstall later
|
((Timer)sender).Stop();
|
||||||
catch { }
|
|
||||||
try { ZipFile.ExtractToDirectory(Global.appdatapath + "\\VBus.zip", exepath); }
|
|
||||||
//Made here as starting the scpdriver.exe via process.start, the program looks for file from where it was called, not where the exe is
|
|
||||||
catch { }
|
|
||||||
if (File.Exists(exepath + "\\ScpDriver.exe"))
|
|
||||||
try
|
|
||||||
{
|
|
||||||
Process.Start(exepath + "\\ScpDriver.exe", "si");
|
|
||||||
bnStep1.Text = Properties.Resources.Installing;
|
|
||||||
}
|
|
||||||
catch { Process.Start(Global.appdatapath + "\\Virtual Bus Driver"); }
|
|
||||||
|
|
||||||
Timer timer = new Timer();
|
|
||||||
timer.Start();
|
|
||||||
timer.Tick += timer_Tick;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
bnStep1.Text = Properties.Resources.OpenScpDriver;
|
|
||||||
Directory.CreateDirectory(Global.appdatapath + "\\Virtual Bus Driver");
|
|
||||||
try { ZipFile.ExtractToDirectory(Global.appdatapath + "\\VBus.zip", Global.appdatapath + "\\Virtual Bus Driver"); }
|
|
||||||
catch { }
|
|
||||||
Process.Start(Global.appdatapath + "\\Virtual Bus Driver");
|
|
||||||
Timer timer = new Timer();
|
|
||||||
timer.Start();
|
|
||||||
timer.Tick += timer_Tick;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool running = false;
|
|
||||||
private void timer_Tick(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
Process[] processes = Process.GetProcessesByName("ScpDriver");
|
|
||||||
if (!Global.AdminNeeded())
|
|
||||||
{
|
|
||||||
if (processes.Length < 1)
|
|
||||||
{
|
|
||||||
string log = File.ReadAllText(exepath + "\\ScpDriver.log");
|
|
||||||
if (log.Contains("Install Succeeded"))
|
|
||||||
bnStep1.Text = Properties.Resources.InstallComplete;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
bnStep1.Text = Properties.Resources.InstallFailed;
|
|
||||||
Process.Start(Global.appdatapath + "\\Virtual Bus Driver");
|
|
||||||
}
|
|
||||||
try
|
|
||||||
{
|
|
||||||
File.Delete(exepath + "\\ScpDriver.exe");
|
|
||||||
File.Delete(exepath + "\\ScpDriver.log");
|
|
||||||
Directory.Delete(exepath + "\\System", true);
|
|
||||||
Directory.Delete(exepath + "\\DIFxAPI", true);
|
|
||||||
}
|
|
||||||
catch { }
|
|
||||||
File.Delete(Global.appdatapath + "\\VBus.zip");
|
|
||||||
((Timer)sender).Stop();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (processes.Length > 0)
|
|
||||||
running = true;
|
|
||||||
if (running)
|
|
||||||
if (processes.Length < 1)
|
|
||||||
{
|
|
||||||
bnStep1.Text = Properties.Resources.InstallComplete;
|
|
||||||
File.Delete(Global.appdatapath + "\\VBus.zip");
|
|
||||||
((Timer)sender).Stop();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,10 +119,10 @@
|
|||||||
</resheader>
|
</resheader>
|
||||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||||
<data name="bnStep1.Location" type="System.Drawing.Point, System.Drawing">
|
<data name="bnStep1.Location" type="System.Drawing.Point, System.Drawing">
|
||||||
<value>82, 8</value>
|
<value>29, 8</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="bnStep1.Size" type="System.Drawing.Size, System.Drawing">
|
<data name="bnStep1.Size" type="System.Drawing.Size, System.Drawing">
|
||||||
<value>155, 23</value>
|
<value>259, 23</value>
|
||||||
</data>
|
</data>
|
||||||
<assembly alias="mscorlib" name="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
<assembly alias="mscorlib" name="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||||
<data name="bnStep1.TabIndex" type="System.Int32, mscorlib">
|
<data name="bnStep1.TabIndex" type="System.Int32, mscorlib">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user