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/SettingsForm.cs

    r510 r561  
    4343 
    4444            //Load the settings. 
    45             Dictionary<string, object> settings = DefaultPlugin.Settings; 
    46             if (settings.ContainsKey("FL16Method")) 
    47             { 
    48                 Guid fl16Method = (Guid)settings["FL16Method"]; 
     45            DefaultPluginSettings settings = DefaultPlugin.Settings; 
     46            if (settings.FL16Method != Guid.Empty) 
    4947                foreach (object item in fl16MethodCmb.Items) 
    50                     if (((ErasureMethod)item).GUID == fl16Method) 
     48                    if (((ErasureMethod)item).GUID == settings.FL16Method) 
    5149                    { 
    5250                        fl16MethodCmb.SelectedItem = item; 
    5351                        break; 
    5452                    } 
    55             } 
    5653 
    5754            if (fl16MethodCmb.SelectedIndex == -1) 
     
    6764            } 
    6865 
    69             if (DefaultPlugin.Settings.ContainsKey("EraseCustom")) 
     66            if (DefaultPlugin.Settings.EraseCustom != null) 
    7067            { 
    71                 customMethods = (Dictionary<Guid, CustomErasureMethod>) 
    72                     DefaultPlugin.Settings["EraseCustom"]; 
     68                customMethods = DefaultPlugin.Settings.EraseCustom; 
    7369 
    7470                //Display the whole set on the list. 
     
    108104            { 
    109105                CustomErasureMethod method = form.Method; 
     106                customMethods.Add(method.GUID, method); 
    110107                addCustomMethods.Add(method); 
    111108                AddMethod(method); 
     
    136133            } 
    137134 
    138             DefaultPlugin.Settings["FL16Method"] = ((ErasureMethod)fl16MethodCmb.SelectedItem).GUID; 
     135            DefaultPlugin.Settings.FL16Method = ((ErasureMethod)fl16MethodCmb.SelectedItem).GUID; 
    139136 
    140137            //Save the list of custom erasure methods 
    141             DefaultPlugin.Settings["EraseCustom"] = customMethods; 
     138            DefaultPlugin.Settings.EraseCustom = customMethods; 
    142139 
    143140            //Remove the old methods. 
     
    147144            //Update the Erasure method manager on the methods 
    148145            foreach (CustomErasureMethod method in addCustomMethods) 
    149             { 
    150                 customMethods.Add(method.GUID, method); 
    151146                ErasureMethodManager.Register(new EraseCustom(method), new object[] { method }); 
    152             } 
    153147 
    154148            //Close the dialog 
Note: See TracChangeset for help on using the changeset viewer.