Пример #1
0
        /// <summary>
        /// Gets a fresh copy of the settings
        /// </summary>
        public static SettingObject GetDefaultSettings()
        {
            SettingObject settings = new SettingObject();

            settings.DefaultFont = SystemFonts.MenuFont;
            return(settings);
        }
Пример #2
0
 /// <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;
 }
Пример #3
0
        /// <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);
        }
Пример #4
0
 /// <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;
 }
Пример #5
0
        /// <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);
        }
Пример #6
0
 /// <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);
     }
 }
Пример #7
0
 /// <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);
     }
 }
Пример #8
0
 /// <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();
 }
Пример #9
0
 /// <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();
 }
Пример #10
0
 /// <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();
 }