Changeset 1772 for branches/eraser6/CodeReview/Eraser/Settings.cs
- Timestamp:
- 2/8/2010 8:25:51 AM (2 years ago)
- File:
-
- 1 edited
-
branches/eraser6/CodeReview/Eraser/Settings.cs (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eraser6/CodeReview/Eraser/Settings.cs
r1770 r1772 49 49 public RegistrySettings(Guid pluginId, RegistryKey key) 50 50 { 51 this. pluginID = pluginId;52 this. key = key;51 this.PluginID = pluginId; 52 this.Key = key; 53 53 } 54 54 … … 68 68 private void Dispose(bool disposing) 69 69 { 70 if (Key == null) 71 return; 72 70 73 if (disposing) 71 key.Close(); 74 Key.Close(); 75 Key = null; 72 76 } 73 77 … … 79 83 { 80 84 //Get the raw registry value 81 object rawResult = key.GetValue(setting, null);85 object rawResult = Key.GetValue(setting, null); 82 86 83 87 //Check if it is a serialised object … … 92 96 catch (SerializationException) 93 97 { 94 key.DeleteValue(setting);98 Key.DeleteValue(setting); 95 99 MessageBox.Show(S._("Could not load the setting {0}\\{1} for " + 96 "plugin {2}. The setting has been lost.", key, setting,97 pluginID.ToString()),100 "plugin {2}. The setting has been lost.", Key, setting, 101 PluginID.ToString()), 98 102 S._("Eraser"), MessageBoxButtons.OK, MessageBoxIcon.Error, 99 103 MessageBoxDefaultButton.Button1, … … 113 117 if (value == null) 114 118 { 115 key.DeleteValue(setting);119 Key.DeleteValue(setting); 116 120 } 117 121 else 118 122 { 119 123 if (value is bool) 120 key.SetValue(setting, value, RegistryValueKind.DWord);124 Key.SetValue(setting, value, RegistryValueKind.DWord); 121 125 else if ((value is int) || (value is uint)) 122 key.SetValue(setting, value, RegistryValueKind.DWord);126 Key.SetValue(setting, value, RegistryValueKind.DWord); 123 127 else if ((value is long) || (value is ulong)) 124 key.SetValue(setting, value, RegistryValueKind.QWord);128 Key.SetValue(setting, value, RegistryValueKind.QWord); 125 129 else if (value is string) 126 key.SetValue(setting, value, RegistryValueKind.String);130 Key.SetValue(setting, value, RegistryValueKind.String); 127 131 else 128 132 using (MemoryStream stream = new MemoryStream()) 129 133 { 130 134 new BinaryFormatter().Serialize(stream, value); 131 key.SetValue(setting, stream.ToArray(), RegistryValueKind.Binary);135 Key.SetValue(setting, stream.ToArray(), RegistryValueKind.Binary); 132 136 } 133 137 } … … 138 142 /// The GUID of the plugin whose settings this object is storing. 139 143 /// </summary> 140 private Guid pluginID;144 private Guid PluginID; 141 145 142 146 /// <summary> 143 147 /// The registry key where the data is stored. 144 148 /// </summary> 145 private RegistryKey key;149 private RegistryKey Key; 146 150 } 147 151
Note: See TracChangeset
for help on using the changeset viewer.
