/// <summary> /// Loads the grouped setting values from the persistent store. /// </summary> public override void Load() { string strValue = null; bool booRetrieved = false; if (EnvironmentInfo.Settings.DelayedSettings.ContainsKey(GameMode.ModeId)) { booRetrieved = EnvironmentInfo.Settings.DelayedSettings[GameMode.ModeId].TryGetValue(String.Format("InstallationPaths~{0}", GameMode.ModeId), out strValue); } if (!booRetrieved) { EnvironmentInfo.Settings.InstallationPaths.TryGetValue(GameMode.ModeId, out strValue); } InstallationPath = strValue; strValue = null; EnvironmentInfo.Settings.CustomLaunchCommands.TryGetValue(GameMode.ModeId, out strValue); CustomLaunchCommand = strValue; strValue = null; EnvironmentInfo.Settings.CustomLaunchCommandArguments.TryGetValue(GameMode.ModeId, out strValue); CustomLaunchCommandArguments = strValue; RequiredDirectoriesVM.LoadSettings(); }
/// <summary> /// Persists the grouped setting values to the persistent store. /// </summary> /// <returns><c>true</c> if the settings were persisted; /// <c>false</c> otherwise.</returns> public override bool Save() { if (!RequiredDirectoriesVM.ValidateSettings()) { return(false); } RequiredDirectoriesVM.SaveSettings(true); EnvironmentInfo.Settings.CustomLaunchCommands[GameMode.ModeId] = FileUtil.StripInvalidPathChars(CustomLaunchCommand); EnvironmentInfo.Settings.CustomLaunchCommandArguments[GameMode.ModeId] = CustomLaunchCommandArguments; EnvironmentInfo.Settings.Save(); return(true); }
/// <summary> /// Loads the grouped setting values from the persistent store. /// </summary> public override void Load() { string strValue = null; strValue = null; EnvironmentInfo.Settings.CustomLaunchCommands.TryGetValue(GameMode.ModeId, out strValue); CustomLaunchCommand = strValue; strValue = null; EnvironmentInfo.Settings.CustomLaunchCommandArguments.TryGetValue(GameMode.ModeId, out strValue); CustomLaunchCommandArguments = strValue; RequiredDirectoriesVM.LoadSettings(); }
/// <summary> /// Persists the grouped setting values to the persistent store. /// </summary> /// <returns><c>true</c> if the settings were persisted; /// <c>false</c> otherwise.</returns> public override bool Save() { if (!RequiredDirectoriesVM.ValidateSettings()) { return(false); } RequiredDirectoriesVM.SaveSettings(true); if (!String.Equals(EnvironmentInfo.Settings.InstallationPaths[GameMode.ModeId], InstallationPath.Trim(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar))) { EnvironmentInfo.Settings.DelayedSettings[GameMode.ModeId].Add(String.Format("InstallationPaths~{0}", GameMode.ModeId), InstallationPath.Trim(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar)); } EnvironmentInfo.Settings.CustomLaunchCommands[GameMode.ModeId] = FileUtil.StripInvalidPathChars(CustomLaunchCommand); EnvironmentInfo.Settings.CustomLaunchCommandArguments[GameMode.ModeId] = CustomLaunchCommandArguments; EnvironmentInfo.Settings.Save(); return(true); }