mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2024-11-27 03:24:20 +01:00
Move code out of main form ctor
This commit is contained in:
parent
0358002e72
commit
3df7f24a7b
@ -358,7 +358,43 @@ namespace DS4Windows
|
|||||||
catch { /* Skip setting culture that we cannot set */ }
|
catch { /* Skip setting culture that we cannot set */ }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void CreateStdActions()
|
||||||
|
{
|
||||||
|
XmlDocument xDoc = new XmlDocument();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string[] profiles = Directory.GetFiles(appdatapath + @"\Profiles\");
|
||||||
|
string s = string.Empty;
|
||||||
|
//foreach (string s in profiles)
|
||||||
|
for (int i = 0, proflen = profiles.Length; i < proflen; i++)
|
||||||
|
{
|
||||||
|
s = profiles[i];
|
||||||
|
if (Path.GetExtension(s) == ".xml")
|
||||||
|
{
|
||||||
|
xDoc.Load(s);
|
||||||
|
XmlNode el = xDoc.SelectSingleNode("DS4Windows/ProfileActions");
|
||||||
|
if (el != null)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(el.InnerText))
|
||||||
|
el.InnerText = "Disconnect Controller";
|
||||||
|
else
|
||||||
|
el.InnerText += "/Disconnect Controller";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
XmlNode Node = xDoc.SelectSingleNode("DS4Windows");
|
||||||
|
el = xDoc.CreateElement("ProfileActions");
|
||||||
|
el.InnerText = "Disconnect Controller";
|
||||||
|
Node.AppendChild(el);
|
||||||
|
}
|
||||||
|
|
||||||
|
xDoc.Save(s);
|
||||||
|
LoadActions();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
}
|
||||||
|
|
||||||
public static event EventHandler<EventArgs> ControllerStatusChange; // called when a controller is added/removed/battery or touchpad mode changes/etc.
|
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)
|
public static void ControllerStatusChanged(object sender)
|
||||||
|
@ -216,40 +216,7 @@ namespace DS4Windows
|
|||||||
|
|
||||||
if (!LoadActions()) //if first no actions have been made yet, create PS+Option to D/C and save it to every profile
|
if (!LoadActions()) //if first no actions have been made yet, create PS+Option to D/C and save it to every profile
|
||||||
{
|
{
|
||||||
XmlDocument xDoc = new XmlDocument();
|
Global.CreateStdActions();
|
||||||
try
|
|
||||||
{
|
|
||||||
string[] profiles = Directory.GetFiles(appdatapath + @"\Profiles\");
|
|
||||||
string s = string.Empty;
|
|
||||||
//foreach (string s in profiles)
|
|
||||||
for (int i = 0, proflen = profiles.Length; i < proflen; i++)
|
|
||||||
{
|
|
||||||
s = profiles[i];
|
|
||||||
if (Path.GetExtension(s) == ".xml")
|
|
||||||
{
|
|
||||||
xDoc.Load(s);
|
|
||||||
XmlNode el = xDoc.SelectSingleNode("DS4Windows/ProfileActions");
|
|
||||||
if (el != null)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(el.InnerText))
|
|
||||||
el.InnerText = "Disconnect Controller";
|
|
||||||
else
|
|
||||||
el.InnerText += "/Disconnect Controller";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
XmlNode Node = xDoc.SelectSingleNode("DS4Windows");
|
|
||||||
el = xDoc.CreateElement("ProfileActions");
|
|
||||||
el.InnerText = "Disconnect Controller";
|
|
||||||
Node.AppendChild(el);
|
|
||||||
}
|
|
||||||
|
|
||||||
xDoc.Save(s);
|
|
||||||
LoadActions();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch { }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool start = true;
|
bool start = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user