Changeset 562


Ignore:
Timestamp:
11/14/2008 8:43:37 AM (3 years ago)
Author:
lowjoel
Message:

-The EraserSettings? class should belong in Program.cs
-Defined a few defaults:

-File erasure method: Gutmann (35)
-Unused space: Pseudorandom (1)
-PRNG: RNGCryptoServiceProvider
-UI language: whatever the current UI culture is

Location:
branches/eraser6
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/eraser6/Eraser/Program.cs

    r561 r562  
    163163            //Open the registry key containing the settings 
    164164            RegistryKey pluginsKey = Application.UserAppDataRegistry.OpenSubKey( 
    165                 "Plugins\\" + guid.ToString(), true); 
     165                guid.ToString(), true); 
    166166            if (pluginsKey == null) 
    167167                pluginsKey = Application.UserAppDataRegistry.CreateSubKey( 
    168                     "Plugins\\" + guid.ToString()); 
     168                    guid.ToString()); 
    169169 
    170170            //Return the Settings object. 
     
    172172        } 
    173173    } 
     174 
     175    internal class EraserSettings 
     176    { 
     177        public EraserSettings() 
     178        { 
     179            settings = Manager.ManagerLibrary.Instance.SettingsManager.ModuleSettings; 
     180        } 
     181 
     182        /// <summary> 
     183        /// Gets or sets the LCID of the language which the UI should be displayed in. 
     184        /// </summary> 
     185        public string Language 
     186        { 
     187            get 
     188            { 
     189                return settings["Language"] == null ?  
     190                    GetCurrentCulture().Name : 
     191                    (string)settings["Language"]; 
     192            } 
     193            set 
     194            { 
     195                settings["Language"] = value; 
     196            } 
     197        } 
     198 
     199        /// <summary> 
     200        /// Gets or sets a value on whether the main frame should be minimised to the 
     201        /// system notification area. 
     202        /// </summary> 
     203        public bool HideWhenMinimised 
     204        { 
     205            get 
     206            { 
     207                return settings["HideWhenMinimised"] == null ? 
     208                    true : (bool)settings["HideWhenMinimised"]; 
     209            } 
     210            set 
     211            { 
     212                settings["HideWhenMinimised"] = value; 
     213            } 
     214        } 
     215 
     216        /// <summary> 
     217        /// Gets the current UI culture, correct to the top-level culture (i.e., English 
     218        /// instead of English (United Kingdom)) 
     219        /// </summary> 
     220        /// <returns>The CultureInfo of the current UI culture, correct to the top level.</returns> 
     221        private static CultureInfo GetCurrentCulture() 
     222        { 
     223            CultureInfo culture = CultureInfo.CurrentUICulture; 
     224            while (culture.Parent != CultureInfo.InvariantCulture) 
     225                culture = culture.Parent; 
     226 
     227            return culture; 
     228        } 
     229 
     230        private Manager.Settings settings; 
     231    } 
    174232} 
  • branches/eraser6/Eraser/SettingsPanel.cs

    r561 r562  
    375375        } 
    376376    } 
    377  
    378     internal class EraserSettings 
    379     { 
    380         public EraserSettings() 
    381         { 
    382             settings = Manager.ManagerLibrary.Instance.SettingsManager.ModuleSettings; 
    383         } 
    384  
    385         /// <summary> 
    386         /// Gets or sets a value containing the language the UI should be displayed in. 
    387         /// </summary> 
    388         public string Language 
    389         { 
    390             get 
    391             { 
    392                 return (string)settings["Language"]; 
    393             } 
    394             set 
    395             { 
    396                 settings["Language"] = value; 
    397             } 
    398         } 
    399  
    400         /// <summary> 
    401         /// Gets or sets a value on whether the main frame should be minimised to the 
    402         /// system notification area. 
    403         /// </summary> 
    404         public bool HideWhenMinimised 
    405         { 
    406             get 
    407             { 
    408                 return (bool)settings["HideWhenMinimised"]; 
    409             } 
    410             set 
    411             { 
    412                 settings["HideWhenMinimised"] = value; 
    413             } 
    414         } 
    415  
    416         private Manager.Settings settings; 
    417     } 
    418377} 
    419378 
  • branches/eraser6/Manager/Method.cs

    r508 r562  
    451451        } 
    452452 
    453  
    454453        /// <summary> 
    455454        /// Allows plug-ins to register methods with the main program. Thread-safe. 
  • branches/eraser6/Manager/Settings.cs

    r561 r562  
    116116            get 
    117117            { 
    118                 return settings["DefaultFileErasureMethod"] == null ? Guid.Empty : 
     118                return settings["DefaultFileErasureMethod"] == null ?  
     119                    new Guid("1407FC4E-FEFF-4375-B4FB-D7EFBB7E9922") : 
    119120                    (Guid)settings["DefaultFileErasureMethod"]; 
    120121            } 
     
    134135            get 
    135136            { 
    136                 return settings["DefaultUnusedSpaceErasureMethod"] == null ? Guid.Empty : 
     137                return settings["DefaultUnusedSpaceErasureMethod"] == null ?  
     138                    new Guid("{BF8BA267-231A-4085-9BF9-204DE65A6641}") : 
    137139                    (Guid)settings["DefaultUnusedSpaceErasureMethod"]; 
    138140            } 
     
    151153            get 
    152154            { 
    153                 return settings["ActivePRNG"] == null ? Guid.Empty : 
     155                return settings["ActivePRNG"] == null ?  
     156                    new Guid("{6BF35B8E-F37F-476e-B6B2-9994A92C3B0C}") : 
    154157                    (Guid)settings["ActivePRNG"]; 
    155158            } 
Note: See TracChangeset for help on using the changeset viewer.