Ignore:
Timestamp:
11/14/2008 8:20:48 AM (4 years ago)
Author:
lowjoel
Message:

Part one to fixing #32: replace the Dictionary object with the Settings object for plugin settings; The old Settings class is now the SettingsManager? class.
Also, since we are now using a generic Object, I've implemented a few helper class (XXSettings) classes to allow for the concrete setting + type to be retrieved.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eraser6/DefaultPlugins/Plugin.cs

    r510 r561  
    3535        public void Initialize(Host host) 
    3636        { 
    37             //Get the settings dictionary 
    38             Settings = Manager.ManagerLibrary.Instance.Settings.PluginSettings; 
     37            Settings = new DefaultPluginSettings(); 
    3938 
    4039            //Then register the erasure methods et al. 
     
    6968        public void Dispose() 
    7069        { 
    71             Manager.ManagerLibrary.Instance.Settings.SetSettings(Settings); 
    7270        } 
    7371 
     
    9694        /// The dictionary holding settings for this plugin. 
    9795        /// </summary> 
    98         public static Dictionary<string, object> Settings = null; 
     96        internal static DefaultPluginSettings Settings = null; 
     97    } 
     98 
     99    /// <summary> 
     100    /// A concrete class to manage the settings for this plugin. 
     101    /// </summary> 
     102    internal class DefaultPluginSettings 
     103    { 
     104        public DefaultPluginSettings() 
     105        { 
     106            settings = Manager.ManagerLibrary.Instance.SettingsManager.ModuleSettings; 
     107        } 
     108 
     109        /// <summary> 
     110        /// The First/last 16 kilobyte erasure method. 
     111        /// </summary> 
     112        public Guid FL16Method 
     113        { 
     114            get 
     115            { 
     116                return settings["FL16Method"] == null ? Guid.Empty : 
     117                    (Guid)settings["FL16Method"]; 
     118            } 
     119            set 
     120            { 
     121                settings["FL16Method"] = value; 
     122            } 
     123        } 
     124 
     125        /// <summary> 
     126        /// The set of custom erasure methods. 
     127        /// </summary> 
     128        public Dictionary<Guid, CustomErasureMethod> EraseCustom 
     129        { 
     130            get 
     131            { 
     132                return (Dictionary<Guid, CustomErasureMethod>)settings["EraseCustom"]; 
     133            } 
     134            set 
     135            { 
     136                settings["EraseCustom"] = value; 
     137            } 
     138        } 
     139 
     140        /// <summary> 
     141        /// The data store for our settings. 
     142        /// </summary> 
     143        Settings settings; 
    99144    } 
    100145} 
Note: See TracChangeset for help on using the changeset viewer.