/// <summary> /// Gets a fresh copy of the settings /// </summary> public static SettingObject GetDefaultSettings() { SettingObject settings = new SettingObject(); settings.DefaultFont = SystemFonts.MenuFont; return(settings); }
/// <summary> /// Gets a fresh copy of the settings /// </summary> public static SettingObject GetDefaultSettings() { SettingObject settings = new SettingObject(); settings.IndentView = IndentView.Real; settings.DefaultFont = SystemFonts.MenuFont; return settings; }
/// <summary> /// Gets a fresh copy of the settings /// </summary> public static SettingObject GetDefaultSettings() { SettingObject settings = new SettingObject(); settings.IndentView = ScintillaNet.Enums.IndentView.Real; settings.DefaultFont = SystemFonts.MenuFont; return(settings); }
/// <summary> /// Gets a fresh copy of the settings /// </summary> public static SettingObject GetDefaultSettings() { SettingObject settings = new SettingObject(); settings.DefaultFont = SystemFonts.MenuFont; List<Argument> arguments = new List<Argument>(); arguments.Add(new Argument("DefaultUser", "...")); settings.CustomArguments = arguments; return settings; }
/// <summary> /// Gets a fresh copy of the settings /// </summary> public static SettingObject GetDefaultSettings() { SettingObject settings = new SettingObject(); settings.DefaultFont = SystemFonts.MenuFont; List <Argument> arguments = new List <Argument>(); arguments.Add(new Argument("DefaultUser", "...")); settings.CustomArguments = arguments; return(settings); }
/// <summary> /// Ensures that the values of the settings are not null /// </summary> public static void EnsureValidity(SettingObject settings) { try { SettingObject defaults = GetDefaultSettings(); PropertyInfo[] properties = settings.GetType().GetProperties(); foreach (PropertyInfo property in properties) { Object current = settings.GetValue(property.Name); if (current == null || (current is Color && (Color)current == Color.Empty)) { Object value = defaults.GetValue(property.Name); settings.SetValue(property.Name, value); } } } catch (Exception ex) { ErrorManager.ShowError(ex); } }
/// <summary> /// Ensures that the values of the settings are not null /// </summary> public static void EnsureValidity(SettingObject settings) { try { SettingObject defaults = GetDefaultSettings(); PropertyInfo[] properties = settings.GetType().GetProperties(); foreach (PropertyInfo property in properties) { Object current = settings.GetValue(property.Name); if (current == null || (current is Color && (Color)current == Color.Empty)) { Object value = defaults.GetValue(property.Name); settings.SetValue(property.Name, value); } } } catch (Exception ex) { ErrorManager.ShowError(ex); } }
/// <summary> /// Initializes the application settings /// </summary> private void InitializeSettings() { this.appSettings = SettingObject.GetDefaultSettings(); if (!File.Exists(FileNameHelper.SettingData)) { String folder = Path.GetDirectoryName(FileNameHelper.SettingData); if (!Directory.Exists(folder)) Directory.CreateDirectory(folder); ObjectSerializer.Serialize(FileNameHelper.SettingData, this.appSettings); } else { Object obj = ObjectSerializer.Deserialize(FileNameHelper.SettingData, this.appSettings, false); this.appSettings = (SettingObject)obj; } SettingObject.EnsureValidity(this.appSettings); FileStateManager.RemoveOldStateFiles(); }
/// <summary> /// Initializes the application settings /// </summary> private void InitializeSettings() { this.appSettings = SettingObject.GetDefaultSettings(); if (File.Exists(FileNameHelper.SettingData)) { Object obj = ObjectSerializer.Deserialize(FileNameHelper.SettingData, this.appSettings, false); this.appSettings = (SettingObject)obj; } SettingObject.EnsureValidity(this.appSettings); FileStateManager.RemoveOldStateFiles(); }
/// <summary> /// Initializes the application settings /// </summary> private void InitializeSettings() { this.appSettings = SettingObject.GetDefaultSettings(); if (File.Exists(FileNameHelper.SettingData)) { Object obj = ObjectSerializer.Deserialize(FileNameHelper.SettingData, this.appSettings, false); this.appSettings = (SettingObject)obj; } SettingObject.EnsureValidity(this.appSettings); String currentTheme = Path.Combine(PathHelper.ThemesDir, "CURRENT"); if (File.Exists(currentTheme)) ThemeManager.LoadTheme(currentTheme); PlatformData.Load(Path.Combine(PathHelper.SettingDir, "Platforms")); FileStateManager.RemoveOldStateFiles(); }