// Returns true when file settings are active public bool Startup() { if (RawAccelSettings.Exists()) { try { RawAccelSettings = RawAccelSettings.Load(() => MakeGUISettingsFromFields()); UpdateFieldsFromGUISettings(); if (RawAccelSettings.GUISettings.AutoWriteToDriverOnStartup) { TryUpdateAccel(RawAccelSettings.AccelerationSettings); } return(RawAccelSettings.GUISettings.AutoWriteToDriverOnStartup); } catch (JsonException e) { Console.WriteLine($"bad settings: {e}"); } } RawAccelSettings = new RawAccelSettings( DriverInterop.GetActiveSettings(), MakeGUISettingsFromFields()); RawAccelSettings.Save(); return(true); }
public SettingsErrors TryUpdateActiveSettings(DriverSettings settings) { var errors = TryUpdateAccel(settings); if (errors.Empty()) { RawAccelSettings.AccelerationSettings = settings; RawAccelSettings.GUISettings = MakeGUISettingsFromFields(); RawAccelSettings.Save(); } return(errors); }
public void Startup() { if (RawAccelSettings.Exists()) { try { RawAccelSettings = RawAccelSettings.Load(() => MakeGUISettingsFromFields()); UpdateFieldsFromGUISettings(); UpdateActiveAccelFromFileSettings(RawAccelSettings.AccelerationSettings); return; } catch (JsonException e) { Console.WriteLine($"bad settings: {e}"); } } RawAccelSettings = new RawAccelSettings( DriverInterop.GetActiveSettings(), MakeGUISettingsFromFields()); RawAccelSettings.Save(); }