Changeset 561
- Timestamp:
- 11/14/2008 8:20:48 AM (5 years ago)
- Location:
- branches/eraser6
- Files:
-
- 12 edited
-
DefaultPlugins/EraseCustom.cs (modified) (1 diff)
-
DefaultPlugins/EraseFirstLast16KB.cs (modified) (1 diff)
-
DefaultPlugins/Plugin.cs (modified) (3 diffs)
-
DefaultPlugins/SettingsForm.cs (modified) (5 diffs)
-
Eraser/MainForm.cs (modified) (1 diff)
-
Eraser/Program.cs (modified) (1 diff)
-
Eraser/SettingsPanel.cs (modified) (3 diffs)
-
Eraser/Strings.NL.resx (modified) (1 diff)
-
Eraser/Strings.en.resx (modified) (1 diff)
-
Eraser/Strings.resx (modified) (1 diff)
-
Manager/Manager.cs (modified) (3 diffs)
-
Manager/Settings.cs (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eraser6/DefaultPlugins/EraseCustom.cs
r493 r561 46 46 internal static void RegisterAll() 47 47 { 48 if ( !DefaultPlugin.Settings.ContainsKey("EraseCustom"))48 if (DefaultPlugin.Settings.EraseCustom == null) 49 49 return; 50 50 51 Dictionary<Guid, CustomErasureMethod> methods = (Dictionary<Guid, CustomErasureMethod>)52 DefaultPlugin.Settings ["EraseCustom"];51 Dictionary<Guid, CustomErasureMethod> methods = 52 DefaultPlugin.Settings.EraseCustom; 53 53 foreach (Guid guid in methods.Keys) 54 54 { -
branches/eraser6/DefaultPlugins/EraseFirstLast16KB.cs
r417 r561 36 36 { 37 37 //Try to retrieve the set erasure method 38 if (DefaultPlugin.Settings. ContainsKey("FL16Method"))38 if (DefaultPlugin.Settings.FL16Method != Guid.Empty) 39 39 method = ErasureMethodManager.GetInstance( 40 (Guid)DefaultPlugin.Settings["FL16Method"]);40 DefaultPlugin.Settings.FL16Method); 41 41 else 42 42 try -
branches/eraser6/DefaultPlugins/Plugin.cs
r510 r561 35 35 public void Initialize(Host host) 36 36 { 37 //Get the settings dictionary 38 Settings = Manager.ManagerLibrary.Instance.Settings.PluginSettings; 37 Settings = new DefaultPluginSettings(); 39 38 40 39 //Then register the erasure methods et al. … … 69 68 public void Dispose() 70 69 { 71 Manager.ManagerLibrary.Instance.Settings.SetSettings(Settings);72 70 } 73 71 … … 96 94 /// The dictionary holding settings for this plugin. 97 95 /// </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; 99 144 } 100 145 } -
branches/eraser6/DefaultPlugins/SettingsForm.cs
r510 r561 43 43 44 44 //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) 49 47 foreach (object item in fl16MethodCmb.Items) 50 if (((ErasureMethod)item).GUID == fl16Method)48 if (((ErasureMethod)item).GUID == settings.FL16Method) 51 49 { 52 50 fl16MethodCmb.SelectedItem = item; 53 51 break; 54 52 } 55 }56 53 57 54 if (fl16MethodCmb.SelectedIndex == -1) … … 67 64 } 68 65 69 if (DefaultPlugin.Settings. ContainsKey("EraseCustom"))66 if (DefaultPlugin.Settings.EraseCustom != null) 70 67 { 71 customMethods = (Dictionary<Guid, CustomErasureMethod>) 72 DefaultPlugin.Settings["EraseCustom"]; 68 customMethods = DefaultPlugin.Settings.EraseCustom; 73 69 74 70 //Display the whole set on the list. … … 108 104 { 109 105 CustomErasureMethod method = form.Method; 106 customMethods.Add(method.GUID, method); 110 107 addCustomMethods.Add(method); 111 108 AddMethod(method); … … 136 133 } 137 134 138 DefaultPlugin.Settings ["FL16Method"]= ((ErasureMethod)fl16MethodCmb.SelectedItem).GUID;135 DefaultPlugin.Settings.FL16Method = ((ErasureMethod)fl16MethodCmb.SelectedItem).GUID; 139 136 140 137 //Save the list of custom erasure methods 141 DefaultPlugin.Settings ["EraseCustom"]= customMethods;138 DefaultPlugin.Settings.EraseCustom = customMethods; 142 139 143 140 //Remove the old methods. … … 147 144 //Update the Erasure method manager on the methods 148 145 foreach (CustomErasureMethod method in addCustomMethods) 149 {150 customMethods.Add(method.GUID, method);151 146 ErasureMethodManager.Register(new EraseCustom(method), new object[] { method }); 152 }153 147 154 148 //Close the dialog -
branches/eraser6/Eraser/MainForm.cs
r513 r561 305 305 get 306 306 { 307 Dictionary<string, object>settings =308 ManagerLibrary.Instance.Settings .PluginSettings;309 return settings .ContainsKey("HideWhenMinimised") ?310 (bool)settings["HideWhenMinimised"] : true;307 Manager.Settings settings = 308 ManagerLibrary.Instance.SettingsManager.ModuleSettings; 309 return settings["HideWhenMinimised"] == null ? true : 310 (bool)settings["HideWhenMinimised"]; 311 311 } 312 312 313 313 set 314 314 { 315 Dictionary<string, object>settings =316 ManagerLibrary.Instance.Settings .PluginSettings;315 Manager.Settings settings = 316 ManagerLibrary.Instance.SettingsManager.ModuleSettings; 317 317 settings["HideWhenMinimised"] = hideWhenMinimiseToolStripMenuItem.Checked; 318 ManagerLibrary.Instance.Settings.SetSettings(settings);319 318 } 320 319 } -
branches/eraser6/Eraser/Program.cs
r495 r561 97 97 } 98 98 99 public class Settings : Manager.Settings 99 public class Settings : Manager.SettingsManager 100 100 { 101 public Settings() 101 /// <summary> 102 /// Registry-based storage backing for the Settings class. 103 /// </summary> 104 private class RegistrySettings : Manager.Settings 102 105 { 103 Load(); 106 /// <summary> 107 /// Constructor. 108 /// </summary> 109 /// <param name="key">The registry key to look for the settings in.</param> 110 public RegistrySettings(Guid pluginID, RegistryKey key) 111 { 112 this.key = key; 113 } 114 115 public override object this[string setting] 116 { 117 get 118 { 119 byte[] currentSetting = (byte[])key.GetValue(setting, null); 120 if (currentSetting != null && currentSetting.Length != 0) 121 using (MemoryStream stream = new MemoryStream(currentSetting)) 122 try 123 { 124 return new BinaryFormatter().Deserialize(stream); 125 } 126 catch (Exception) 127 { 128 key.DeleteValue(setting); 129 MessageBox.Show(string.Format(S._("Could not load the setting {0} for plugin {1}." + 130 "The setting has been lost."), key, pluginID.ToString()), 131 S._("Eraser"), MessageBoxButtons.OK, MessageBoxIcon.Error); 132 } 133 134 return null; 135 } 136 set 137 { 138 using (MemoryStream stream = new MemoryStream()) 139 { 140 new BinaryFormatter().Serialize(stream, value); 141 key.SetValue(setting, stream.ToArray(), RegistryValueKind.Binary); 142 } 143 } 144 } 145 146 /// <summary> 147 /// The GUID of the plugin whose settings this object is storing. 148 /// </summary> 149 private Guid pluginID; 150 151 /// <summary> 152 /// The registry key where the data is stored. 153 /// </summary> 154 private RegistryKey key; 104 155 } 105 156 106 p rotected override void Load()157 public override void Save() 107 158 { 108 RegistryKey key = Application.UserAppDataRegistry;109 ActivePRNG = new Guid((string)110 key.GetValue("PRNG", Guid.Empty.ToString()));111 EraseLockedFilesOnRestart =112 (int)key.GetValue("EraseOnRestart", (object)1) != 0;113 ConfirmEraseOnRestart =114 (int)key.GetValue("ConfirmEraseOnRestart", (object)0) != 0;115 DefaultFileErasureMethod = new Guid((string)116 key.GetValue("DefaultFileErasureMethod", Guid.Empty.ToString()));117 DefaultUnusedSpaceErasureMethod = new Guid((string)118 key.GetValue("DefaultUnusedSpaceErasureMethod", Guid.Empty.ToString()));119 ExecuteMissedTasksImmediately =120 (int)key.GetValue("ExecuteMissedTasksImmediately", (object)1) != 0;121 PlausibleDeniability =122 (int)key.GetValue("PlausibleDeniability", (object)0) != 0;123 124 UILanguage = (string)key.GetValue("UILanguage", CultureInfo.CurrentUICulture.Name);125 System.Threading.Thread.CurrentThread.CurrentUICulture =126 new CultureInfo(UILanguage);127 128 //Load the plausible deniability files129 byte[] plausibleDeniabilityFiles = (byte[])130 key.GetValue("PlausibleDeniabilityFiles", new byte[0]);131 if (plausibleDeniabilityFiles.Length != 0)132 using (MemoryStream stream = new MemoryStream(plausibleDeniabilityFiles))133 {134 try135 {136 this.PlausibleDeniabilityFiles = (List<string>)137 new BinaryFormatter().Deserialize(stream);138 }139 catch (Exception)140 {141 key.DeleteValue("PlausibleDeniabilityFiles");142 MessageBox.Show(S._("Could not load list of files used for plausible " +143 "deniability.\n\nThe list of files have been lost."),144 S._("Eraser"), MessageBoxButtons.OK, MessageBoxIcon.Error);145 }146 }147 159 } 148 160 149 protected override void Save() 150 { 151 RegistryKey key = Application.UserAppDataRegistry; 152 key.SetValue("PRNG", ActivePRNG); 153 key.SetValue("EraseOnRestart", EraseLockedFilesOnRestart, 154 RegistryValueKind.DWord); 155 key.SetValue("ConfirmEraseOnRestart", ConfirmEraseOnRestart, 156 RegistryValueKind.DWord); 157 key.SetValue("DefaultFileErasureMethod", DefaultFileErasureMethod); 158 key.SetValue("DefaultUnusedSpaceErasureMethod", 159 DefaultUnusedSpaceErasureMethod); 160 key.SetValue("ExecuteMissedTasksImmediately", 161 ExecuteMissedTasksImmediately, RegistryValueKind.DWord); 162 key.SetValue("PlausibleDeniability", PlausibleDeniability, 163 RegistryValueKind.DWord); 164 key.SetValue("UILanguage", UILanguage); 165 166 using (MemoryStream stream = new MemoryStream()) 167 { 168 new BinaryFormatter().Serialize(stream, PlausibleDeniabilityFiles); 169 key.SetValue("PlausibleDeniabilityFiles", stream.ToArray(), RegistryValueKind.Binary); 170 } 171 } 172 173 protected override Dictionary<string, object> GetSettings(Guid guid) 161 protected override Manager.Settings GetSettings(Guid guid) 174 162 { 175 163 //Open the registry key containing the settings 176 164 RegistryKey pluginsKey = Application.UserAppDataRegistry.OpenSubKey( 177 165 "Plugins\\" + guid.ToString(), true); 178 Dictionary<string, object> result = new Dictionary<string, object>(); 166 if (pluginsKey == null) 167 pluginsKey = Application.UserAppDataRegistry.CreateSubKey( 168 "Plugins\\" + guid.ToString()); 179 169 180 //Load every key/value pair into the dictionary 181 if (pluginsKey != null) 182 foreach (string key in pluginsKey.GetValueNames()) 183 { 184 byte[] currentSetting = (byte[])pluginsKey.GetValue(key, null); 185 if (currentSetting.Length != 0) 186 using (MemoryStream stream = new MemoryStream(currentSetting)) 187 { 188 try 189 { 190 result[key] = new BinaryFormatter().Deserialize(stream); 191 } 192 catch (Exception) 193 { 194 pluginsKey.DeleteValue(key); 195 MessageBox.Show(string.Format(S._("Could not load the setting {0} for plugin {1}." + 196 "The setting has been lost."), key, guid.ToString()), 197 S._("Eraser"), MessageBoxButtons.OK, MessageBoxIcon.Error); 198 } 199 } 200 else 201 result[key] = null; 202 } 203 204 //We're done! 205 return result; 206 } 207 208 protected override void SetSettings(Guid guid, Dictionary<string, object> settings) 209 { 210 //Open the registry key containing the settings 211 RegistryKey pluginKey = Application.UserAppDataRegistry.OpenSubKey( 212 "Plugins\\" + guid.ToString(), true); 213 if (pluginKey == null) 214 pluginKey = Application.UserAppDataRegistry.CreateSubKey("Plugins\\" + guid.ToString()); 215 216 foreach (string key in settings.Keys) 217 { 218 using (MemoryStream stream = new MemoryStream()) 219 { 220 new BinaryFormatter().Serialize(stream, settings[key]); 221 pluginKey.SetValue(key, stream.ToArray(), RegistryValueKind.Binary); 222 } 223 } 170 //Return the Settings object. 171 return new RegistrySettings(guid, pluginsKey); 224 172 } 225 173 } -
branches/eraser6/Eraser/SettingsPanel.cs
r510 r561 126 126 private void LoadSettings() 127 127 { 128 EraserSettings settings = new EraserSettings(); 128 129 foreach (Object lang in uiLanguage.Items) 129 if (((Language)lang).Name == ManagerLibrary.Instance.Settings.UILanguage)130 if (((Language)lang).Name == settings.Language) 130 131 { 131 132 uiLanguage.SelectedItem = lang; … … 338 339 } 339 340 340 if (((Language)uiLanguage.SelectedItem).Name != 341 ManagerLibrary.Instance.Settings.UILanguage) 342 { 343 ManagerLibrary.Instance.Settings.UILanguage = 344 ((Language)uiLanguage.SelectedItem).Name; 341 EraserSettings settings = new EraserSettings(); 342 if (((Language)uiLanguage.SelectedItem).Name != settings.Language) 343 { 344 settings.Language = ((Language)uiLanguage.SelectedItem).Name; 345 345 MessageBox.Show(S._("The new UI language will take only effect when Eraser is restarted."), 346 346 S._("Eraser"), MessageBoxButtons.OK, MessageBoxIcon.Information); … … 375 375 } 376 376 } 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 } 377 418 } 378 419 -
branches/eraser6/Eraser/Strings.NL.resx
r524 r561 148 148 <value>Kan geen taak lijst vinden. Alle taken zijn verdwenen.</value> 149 149 </data> 150 <data name="Could not load list of files used for plausible deniability.\n\nThe list of files have been lost." xml:space="preserve">151 <value>Kan geen taak lijst vinden. Alle taken zijn verdwenen.\n</value>152 </data>153 150 <data name="Could not load the setting {0} for plugin {1}.The setting has been lost." xml:space="preserve"> 154 151 <value>(Untranslated)</value> -
branches/eraser6/Eraser/Strings.en.resx
r525 r561 148 148 <value>Could not load task list. All task entries have been lost.</value> 149 149 </data> 150 <data name="Could not load list of files used for plausible deniability.\n\nThe list of files have been lost." xml:space="preserve">151 <value>Could not load list of files used for plausible deniability.\n\nThe list of files have been lost.</value>152 </data>153 150 <data name="Could not load the setting {0} for plugin {1}.The setting has been lost." xml:space="preserve"> 154 151 <value>Could not load the setting {0} for plugin {1}.The setting has been lost.</value> -
branches/eraser6/Eraser/Strings.resx
r524 r561 148 148 <value>Could not load task list. All task entries have been lost.</value> 149 149 </data> 150 <data name="Could not load list of files used for plausible deniability.\n\nThe list of files have been lost." xml:space="preserve">151 <value>Could not load list of files used for plausible deniability.\n\nThe list of files have been lost.</value>152 </data>153 150 <data name="Could not load the setting {0} for plugin {1}.The setting has been lost." xml:space="preserve"> 154 151 <value>Could not load the setting {0} for plugin {1}.The setting has been lost.</value> -
branches/eraser6/Manager/Manager.cs
r557 r561 32 32 public class ManagerLibrary : IDisposable 33 33 { 34 public ManagerLibrary(Settings settings)34 public ManagerLibrary(SettingsManager settings) 35 35 { 36 36 Instance = this; 37 Settings = settings;37 SettingsManager = settings; 38 38 39 39 EntropySourceManager = new EntropySourceManager(); … … 48 48 EntropySourceManager.Poller.Abort(); 49 49 Host.Dispose(); 50 Settings .Save();50 SettingsManager.Save(); 51 51 Instance = null; 52 52 } … … 78 78 79 79 /// <summary> 80 /// Global instance of the Settings object.80 /// Global instance of the Settings manager. 81 81 /// </summary> 82 public Settings Settings; 82 public SettingsManager SettingsManager; 83 84 /// <summary> 85 /// Gets the settings object representing the settings for the Eraser 86 /// Manager. This is just shorthand for the local classes. 87 /// </summary> 88 public ManagerSettings Settings 89 { 90 get 91 { 92 return new ManagerSettings(); 93 } 94 } 83 95 84 96 /// <summary> -
branches/eraser6/Manager/Settings.cs
r429 r561 28 28 namespace Eraser.Manager 29 29 { 30 public abstract class SettingsManager 31 { 32 /// <summary> 33 /// Saves all the settings to persistent storage. 34 /// </summary> 35 public abstract void Save(); 36 37 /// <summary> 38 /// Gets the dictionary holding settings for the calling assembly. 39 /// </summary> 40 public Settings ModuleSettings 41 { 42 get 43 { 44 return GetSettings(new Guid(((GuidAttribute)Assembly.GetCallingAssembly(). 45 GetCustomAttributes(typeof(GuidAttribute), false)[0]).Value)); 46 } 47 } 48 49 /// <summary> 50 /// Gets the settings from the data source. 51 /// </summary> 52 /// <param name="guid">The GUID of the calling plugin</param> 53 /// <returns>The Settings object which will act as the data store.</returns> 54 protected abstract Settings GetSettings(Guid guid); 55 } 56 30 57 /// <summary> 31 /// Settings class. Holds the defaults for the manager's operations.58 /// Settings class. Represents settings to a given client. 32 59 /// </summary> 33 60 public abstract class Settings 34 61 { 35 62 /// <summary> 36 /// Saves all the settings to any persistent storage. 37 /// </summary> 38 protected internal abstract void Save(); 39 40 /// <summary> 41 /// Loads all settings from storage. 42 /// </summary> 43 protected internal abstract void Load(); 63 /// Gets the setting 64 /// </summary> 65 /// <param name="setting">The name of the setting.</param> 66 /// <returns>The object stored in the settings database, or null if undefined.</returns> 67 public abstract object this[string setting] 68 { 69 get; 70 set; 71 } 44 72 45 73 /// <summary> … … 59 87 uiLanguage = value; 60 88 } 89 } 90 91 private string uiLanguage; 92 } 93 94 /// <summary> 95 /// Handles the settings related to the Eraser Manager. 96 /// </summary> 97 public class ManagerSettings 98 { 99 /// <summary> 100 /// Constructor. 101 /// </summary> 102 /// <param name="settings">The Settings object which is the data store for 103 /// this object.</param> 104 public ManagerSettings() 105 { 106 settings = ManagerLibrary.Instance.SettingsManager.ModuleSettings; 61 107 } 62 108 … … 70 116 get 71 117 { 72 lock (this) 73 return defaultFileErasureMethod; 74 } 75 set 76 { 77 lock (this) 78 defaultFileErasureMethod = value; 118 return settings["DefaultFileErasureMethod"] == null ? Guid.Empty : 119 (Guid)settings["DefaultFileErasureMethod"]; 120 } 121 set 122 { 123 settings["DefaultFileErasureMethod"] = value; 79 124 } 80 125 } … … 89 134 get 90 135 { 91 lock (this) 92 return defaultUnusedSpaceErasureMethod; 93 } 94 set 95 { 96 lock (this) 97 defaultUnusedSpaceErasureMethod = value; 136 return settings["DefaultUnusedSpaceErasureMethod"] == null ? Guid.Empty : 137 (Guid)settings["DefaultUnusedSpaceErasureMethod"]; 138 } 139 set 140 { 141 settings["DefaultUnusedSpaceErasureMethod"] = value; 98 142 } 99 143 } … … 107 151 get 108 152 { 109 lock (this) 110 return activePRNG; 111 } 112 set 113 { 114 lock (this) 115 activePRNG = value; 153 return settings["ActivePRNG"] == null ? Guid.Empty : 154 (Guid)settings["ActivePRNG"]; 155 } 156 set 157 { 158 settings["ActivePRNG"] = value; 116 159 } 117 160 } … … 125 168 get 126 169 { 127 lock (this) 128 return eraseLockedFilesOnRestart; 129 } 130 set 131 { 132 lock (this) 133 eraseLockedFilesOnRestart = value; 170 return settings["EraseLockedFilesOnRestart"] == null ? true : 171 (bool)settings["EraseLockedFilesOnRestart"]; 172 } 173 set 174 { 175 settings["EraseLockedFilesOnRestart"] = value; 134 176 } 135 177 } … … 143 185 get 144 186 { 145 lock (this) 146 return confirmEraseOnRestart; 147 } 148 set 149 { 150 lock (this) 151 confirmEraseOnRestart = value; 187 return settings["ConfirmEraseOnRestart"] == null ? 188 true : (bool)settings["ConfirmEraseOnRestart"]; 189 } 190 set 191 { 192 settings["ConfirmEraseOnRestart"] = value; 152 193 } 153 194 } … … 160 201 get 161 202 { 162 lock (this) 163 return executeMissedTasksImmediately; 164 } 165 set 166 { 167 lock (this) 168 executeMissedTasksImmediately = value; 203 return settings["ExecuteMissedTasksImmediately"] == null ? 204 true : (bool)settings["ExecuteMissedTasksImmediately"]; 205 } 206 set 207 { 208 settings["ExecuteMissedTasksImmediately"] = value; 169 209 } 170 210 } … … 180 220 get 181 221 { 182 lock (this) 183 return plausibleDeniability; 184 } 185 set 186 { 187 lock (this) 188 plausibleDeniability = value; 222 return settings["PlausibleDeniability"] == null ? false : 223 (bool)settings["PlausibleDeniability"]; 224 } 225 set 226 { 227 settings["PlausibleDeniability"] = value; 189 228 } 190 229 } … … 197 236 get 198 237 { 199 lock (this) 200 return plausibleDeniabilityFiles; 201 } 202 set 203 { 204 lock (this) 205 plausibleDeniabilityFiles = value; 206 } 207 } 208 209 /// <summary> 210 /// Gets the dictionary holding settings for the calling assembly. 211 /// </summary> 212 public Dictionary<string, object> PluginSettings 213 { 214 get 215 { 216 return GetSettings(new Guid(((GuidAttribute)Assembly.GetCallingAssembly(). 217 GetCustomAttributes(typeof(GuidAttribute), false)[0]).Value)); 218 } 219 } 220 221 /// <summary> 222 /// Gets the settings from the data source. 223 /// </summary> 224 /// <param name="guid">The GUID of the calling plugin</param> 225 /// <returns>The dictionary containing settings for the plugin</returns> 226 protected abstract Dictionary<string, object> GetSettings(Guid guid); 227 228 /// <summary> 229 /// Sets the settings for the calling plugin. 230 /// </summary> 231 /// <param name="settings">The settings of the plugin</param> 232 public void SetSettings(Dictionary<string, object> settings) 233 { 234 SetSettings(new Guid(((GuidAttribute)Assembly.GetCallingAssembly(). 235 GetCustomAttributes(typeof(GuidAttribute), false)[0]).Value), settings); 236 } 237 238 /// <summary> 239 /// Saves the settings from the plugin into the data source. 240 /// </summary> 241 /// <param name="guid"></param> 242 /// <param name="settings"></param> 243 protected abstract void SetSettings(Guid guid, Dictionary<string, object> settings); 244 245 private string uiLanguage; 246 private Guid defaultFileErasureMethod = Guid.Empty; 247 private Guid defaultUnusedSpaceErasureMethod = Guid.Empty; 248 private Guid activePRNG = Guid.Empty; 249 private bool eraseLockedFilesOnRestart = true; 250 private bool confirmEraseOnRestart = true; 251 private bool executeMissedTasksImmediately = true; 252 private bool plausibleDeniability = true; 253 private List<string> plausibleDeniabilityFiles = new List<string>(); 238 return settings["PlausibleDeniabilityFiles"] == null ? 239 new List<string>() : 240 (List<string>)settings["PlausibleDeniabilityFiles"]; 241 } 242 set 243 { 244 settings["PlausibleDeniabilityFiles"] = value; 245 } 246 } 247 248 /// <summary> 249 /// The Settings object which is the data store of this object. 250 /// </summary> 251 private Settings settings; 254 252 } 255 253 }
Note: See TracChangeset
for help on using the changeset viewer.
