Fix for loading older profiles before 10.65

This commit is contained in:
jays2kings 2014-07-02 22:33:05 -04:00
parent 49e2e642ed
commit 0765b4600e
2 changed files with 238 additions and 243 deletions

View File

@ -820,7 +820,6 @@ namespace DS4Control
m_Xdoc.Save(path);
}
catch { Saved = false; }
return Saved;
}
private DS4Controls getDS4ControlsByName(string key)
@ -930,8 +929,6 @@ namespace DS4Control
profilepath = profilePath[device];
else
profilepath = propath;
try
{
if (File.Exists(profilepath))
{
XmlNode Item;
@ -956,12 +953,11 @@ namespace DS4Control
m_Leds[device][i] = byte.Parse(colors[i]);
}
catch { missingSetting = true; }
if (string.IsNullOrEmpty(m_Xdoc.SelectSingleNode("/ScpControl/Color").InnerText))
if (m_Xdoc.SelectSingleNode("/ScpControl/Color") == null)
{
//Old method of color saving
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/Red"); Byte.TryParse(Item.InnerText, out m_Leds[device][0]); }
catch { missingSetting = true; }
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/Green"); Byte.TryParse(Item.InnerText, out m_Leds[device][1]); }
catch { missingSetting = true; }
@ -995,7 +991,7 @@ namespace DS4Control
m_LowLeds[device][i] = byte.Parse(colors[i]);
}
catch { missingSetting = true; }
if (string.IsNullOrEmpty(m_Xdoc.SelectSingleNode("/ScpControl/LowColor").InnerText))
if (m_Xdoc.SelectSingleNode("/ScpControl/LowColor") == null)
{
//Old method of color saving
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/LowRed"); Byte.TryParse(Item.InnerText, out m_LowLeds[device][0]); }
@ -1018,7 +1014,7 @@ namespace DS4Control
m_ChargingLeds[device][i] = byte.Parse(colors[i]);
}
catch { missingSetting = true; }
if (string.IsNullOrEmpty(m_Xdoc.SelectSingleNode("/ScpControl/ChargingColor").InnerText))
if (m_Xdoc.SelectSingleNode("/ScpControl/ChargingColor") == null)
{
try { Item = m_Xdoc.SelectSingleNode("/ScpControl/ChargingRed"); Byte.TryParse(Item.InnerText, out m_ChargingLeds[device][0]); }
catch { missingSetting = true; }
@ -1181,8 +1177,7 @@ namespace DS4Control
}
}
}
}
catch { Loaded = false; }
//catch { Loaded = false; }
if (Loaded)
{
@ -1193,7 +1188,7 @@ namespace DS4Control
}
// Only add missing settings if the actual load was graceful
if (missingSetting && Loaded)
SaveProfile(device, profilepath, null);
SaveProfile(device, profilepath, buttons);
return Loaded;
}

View File

@ -18,7 +18,7 @@ namespace ScpServer
{
public partial class ScpForm : Form
{
double version = 10.65;
double version = 10.651;
private DS4Control.Control rootHub;
delegate void LogDebugDelegate(DateTime Time, String Data);