/// <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> /// 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); } }