| 1 | /* |
|---|
| 2 | * $Id$ |
|---|
| 3 | * Copyright 2008 The Eraser Project |
|---|
| 4 | * Original Author: Joel Low <lowjoel@users.sourceforge.net> |
|---|
| 5 | * Modified By: Kasra Nassiri <cjax@users.sourceforge.net> @10/18/2008 |
|---|
| 6 | * Modified By: |
|---|
| 7 | * |
|---|
| 8 | * This file is part of Eraser. |
|---|
| 9 | * |
|---|
| 10 | * Eraser is free software: you can redistribute it and/or modify it under the |
|---|
| 11 | * terms of the GNU General Public License as published by the Free Software |
|---|
| 12 | * Foundation, either version 3 of the License, or (at your option) any later |
|---|
| 13 | * version. |
|---|
| 14 | * |
|---|
| 15 | * Eraser is distributed in the hope that it will be useful, but WITHOUT ANY |
|---|
| 16 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR |
|---|
| 17 | * A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
|---|
| 18 | * |
|---|
| 19 | * A copy of the GNU General Public License can be found at |
|---|
| 20 | * <http://www.gnu.org/licenses/>. |
|---|
| 21 | */ |
|---|
| 22 | |
|---|
| 23 | using System; |
|---|
| 24 | using System.Collections.Generic; |
|---|
| 25 | using System.ComponentModel; |
|---|
| 26 | using System.Data; |
|---|
| 27 | using System.Drawing; |
|---|
| 28 | using System.Text; |
|---|
| 29 | using System.Windows.Forms; |
|---|
| 30 | |
|---|
| 31 | using Eraser.Manager; |
|---|
| 32 | using Eraser.Manager.Plugin; |
|---|
| 33 | using Microsoft.Win32; |
|---|
| 34 | using System.Globalization; |
|---|
| 35 | using Eraser.Util; |
|---|
| 36 | using System.Threading; |
|---|
| 37 | |
|---|
| 38 | namespace Eraser |
|---|
| 39 | { |
|---|
| 40 | internal partial class SettingsPanel : BasePanel |
|---|
| 41 | { |
|---|
| 42 | public SettingsPanel() |
|---|
| 43 | { |
|---|
| 44 | InitializeComponent(); |
|---|
| 45 | UXThemeApi.UpdateControlTheme(this); |
|---|
| 46 | |
|---|
| 47 | //For new plugins, register the callback. |
|---|
| 48 | Host.Instance.PluginLoaded += OnNewPluginLoaded; |
|---|
| 49 | ErasureMethodManager.MethodRegistered += OnMethodRegistered; |
|---|
| 50 | ErasureMethodManager.MethodUnregistered += OnMethodUnregistered; |
|---|
| 51 | |
|---|
| 52 | //Load the values |
|---|
| 53 | LoadPluginDependantValues(); |
|---|
| 54 | LoadSettings(); |
|---|
| 55 | } |
|---|
| 56 | |
|---|
| 57 | private void OnNewPluginLoaded(object sender, PluginLoadedEventArgs e) |
|---|
| 58 | { |
|---|
| 59 | ListViewItem item = new ListViewItem(); |
|---|
| 60 | if (e.Instance.Plugin == null) |
|---|
| 61 | { |
|---|
| 62 | item.Text = System.IO.Path.GetFileNameWithoutExtension(e.Instance.Assembly.Location); |
|---|
| 63 | item.SubItems.Add(e.Instance.AssemblyInfo.Author); |
|---|
| 64 | } |
|---|
| 65 | else |
|---|
| 66 | { |
|---|
| 67 | item.Text = e.Instance.Plugin.Name; |
|---|
| 68 | item.SubItems.Add(e.Instance.Plugin.Author); |
|---|
| 69 | } |
|---|
| 70 | |
|---|
| 71 | //The item is checked if the plugin was given the green light to load |
|---|
| 72 | item.Checked = e.Instance.Plugin != null || |
|---|
| 73 | (Manager.ManagerLibrary.Settings.PluginApprovals.ContainsKey( |
|---|
| 74 | e.Instance.AssemblyInfo.Guid) && Manager.ManagerLibrary. |
|---|
| 75 | Settings.PluginApprovals[e.Instance.AssemblyInfo.Guid] |
|---|
| 76 | ); |
|---|
| 77 | |
|---|
| 78 | //Visually display the other metadata associated with the assembly |
|---|
| 79 | item.ImageIndex = e.Instance.AssemblyAuthenticode == null ? -1 : 0; |
|---|
| 80 | item.Group = e.Instance.IsCore ? pluginsManager.Groups[0] : |
|---|
| 81 | pluginsManager.Groups[1]; |
|---|
| 82 | item.SubItems.Add(e.Instance.Assembly.GetName().Version.ToString()); |
|---|
| 83 | item.SubItems.Add(e.Instance.Assembly.Location); |
|---|
| 84 | item.Tag = e.Instance; |
|---|
| 85 | pluginsManager.Items.Add(item); |
|---|
| 86 | } |
|---|
| 87 | |
|---|
| 88 | private void OnMethodRegistered(object sender, ErasureMethodRegistrationEventArgs e) |
|---|
| 89 | { |
|---|
| 90 | ErasureMethod method = ErasureMethodManager.GetInstance(e.Guid); |
|---|
| 91 | eraseFilesMethod.Items.Add(method); |
|---|
| 92 | if (method is UnusedSpaceErasureMethod) |
|---|
| 93 | eraseUnusedMethod.Items.Add(method); |
|---|
| 94 | } |
|---|
| 95 | |
|---|
| 96 | private void OnMethodUnregistered(object sender, ErasureMethodRegistrationEventArgs e) |
|---|
| 97 | { |
|---|
| 98 | foreach (object obj in eraseFilesMethod.Items) |
|---|
| 99 | if (((ErasureMethod)obj).Guid == e.Guid) |
|---|
| 100 | { |
|---|
| 101 | eraseFilesMethod.Items.Remove(obj); |
|---|
| 102 | break; |
|---|
| 103 | } |
|---|
| 104 | |
|---|
| 105 | foreach (object obj in eraseUnusedMethod.Items) |
|---|
| 106 | if (((ErasureMethod)obj).Guid == e.Guid) |
|---|
| 107 | { |
|---|
| 108 | eraseUnusedMethod.Items.Remove(obj); |
|---|
| 109 | break; |
|---|
| 110 | } |
|---|
| 111 | |
|---|
| 112 | if (eraseFilesMethod.SelectedIndex == -1) |
|---|
| 113 | eraseFilesMethod.SelectedIndex = 0; |
|---|
| 114 | if (eraseUnusedMethod.SelectedIndex == -1) |
|---|
| 115 | eraseUnusedMethod.SelectedIndex = 0; |
|---|
| 116 | } |
|---|
| 117 | |
|---|
| 118 | private void LoadPluginDependantValues() |
|---|
| 119 | { |
|---|
| 120 | //Load the list of plugins |
|---|
| 121 | Host instance = Host.Instance; |
|---|
| 122 | IEnumerator<PluginInstance> i = instance.Plugins.GetEnumerator(); |
|---|
| 123 | while (i.MoveNext()) |
|---|
| 124 | OnNewPluginLoaded(this, new PluginLoadedEventArgs(i.Current)); |
|---|
| 125 | |
|---|
| 126 | //Refresh the list of languages |
|---|
| 127 | IList<Language> languages = LanguageManager.Items; |
|---|
| 128 | foreach (Language culture in languages) |
|---|
| 129 | uiLanguage.Items.Add(culture); |
|---|
| 130 | |
|---|
| 131 | //Refresh the list of erasure methods |
|---|
| 132 | Dictionary<Guid, ErasureMethod> methods = ErasureMethodManager.Items; |
|---|
| 133 | foreach (ErasureMethod method in methods.Values) |
|---|
| 134 | { |
|---|
| 135 | eraseFilesMethod.Items.Add(method); |
|---|
| 136 | if (method is UnusedSpaceErasureMethod) |
|---|
| 137 | eraseUnusedMethod.Items.Add(method); |
|---|
| 138 | } |
|---|
| 139 | |
|---|
| 140 | //Refresh the list of PRNGs |
|---|
| 141 | Dictionary<Guid, Prng> prngs = PrngManager.Items; |
|---|
| 142 | foreach (Prng prng in prngs.Values) |
|---|
| 143 | erasePRNG.Items.Add(prng); |
|---|
| 144 | } |
|---|
| 145 | |
|---|
| 146 | private void LoadSettings() |
|---|
| 147 | { |
|---|
| 148 | EraserSettings settings = EraserSettings.Get(); |
|---|
| 149 | foreach (Object lang in uiLanguage.Items) |
|---|
| 150 | if (((Language)lang).Name == settings.Language) |
|---|
| 151 | { |
|---|
| 152 | uiLanguage.SelectedItem = lang; |
|---|
| 153 | break; |
|---|
| 154 | } |
|---|
| 155 | |
|---|
| 156 | foreach (Object method in eraseFilesMethod.Items) |
|---|
| 157 | if (((ErasureMethod)method).Guid == ManagerLibrary.Settings.DefaultFileErasureMethod) |
|---|
| 158 | { |
|---|
| 159 | eraseFilesMethod.SelectedItem = method; |
|---|
| 160 | break; |
|---|
| 161 | } |
|---|
| 162 | |
|---|
| 163 | foreach (Object method in eraseUnusedMethod.Items) |
|---|
| 164 | if (((ErasureMethod)method).Guid == ManagerLibrary.Settings.DefaultUnusedSpaceErasureMethod) |
|---|
| 165 | { |
|---|
| 166 | eraseUnusedMethod.SelectedItem = method; |
|---|
| 167 | break; |
|---|
| 168 | } |
|---|
| 169 | |
|---|
| 170 | foreach (Object prng in erasePRNG.Items) |
|---|
| 171 | if (((Prng)prng).Guid == ManagerLibrary.Settings.ActivePrng) |
|---|
| 172 | { |
|---|
| 173 | erasePRNG.SelectedItem = prng; |
|---|
| 174 | break; |
|---|
| 175 | } |
|---|
| 176 | |
|---|
| 177 | foreach (string path in ManagerLibrary.Settings.PlausibleDeniabilityFiles) |
|---|
| 178 | plausibleDeniabilityFiles.Items.Add(path); |
|---|
| 179 | |
|---|
| 180 | uiContextMenu.Checked = settings.IntegrateWithShell; |
|---|
| 181 | lockedForceUnlock.Checked = |
|---|
| 182 | ManagerLibrary.Settings.ForceUnlockLockedFiles; |
|---|
| 183 | schedulerMissedImmediate.Checked = |
|---|
| 184 | ManagerLibrary.Settings.ExecuteMissedTasksImmediately; |
|---|
| 185 | schedulerMissedIgnore.Checked = |
|---|
| 186 | !ManagerLibrary.Settings.ExecuteMissedTasksImmediately; |
|---|
| 187 | plausibleDeniability.Checked = |
|---|
| 188 | ManagerLibrary.Settings.PlausibleDeniability; |
|---|
| 189 | plausibleDeniability_CheckedChanged(plausibleDeniability, new EventArgs()); |
|---|
| 190 | schedulerClearCompleted.Checked = settings.ClearCompletedTasks; |
|---|
| 191 | |
|---|
| 192 | List<string> defaultsList = new List<string>(); |
|---|
| 193 | |
|---|
| 194 | //Select an intelligent default if the settings are invalid. |
|---|
| 195 | if (uiLanguage.SelectedIndex == -1) |
|---|
| 196 | { |
|---|
| 197 | defaultsList.Add(S._("User interface language")); |
|---|
| 198 | foreach (Language lang in uiLanguage.Items) |
|---|
| 199 | if ((CultureInfo)lang == CultureInfo.CurrentUICulture) |
|---|
| 200 | uiLanguage.SelectedItem = lang; |
|---|
| 201 | } |
|---|
| 202 | if (eraseFilesMethod.SelectedIndex == -1) |
|---|
| 203 | { |
|---|
| 204 | if (eraseFilesMethod.Items.Count > 0) |
|---|
| 205 | { |
|---|
| 206 | eraseFilesMethod.SelectedIndex = 0; |
|---|
| 207 | ManagerLibrary.Settings.DefaultFileErasureMethod = |
|---|
| 208 | ((ErasureMethod)eraseFilesMethod.SelectedItem).Guid; |
|---|
| 209 | } |
|---|
| 210 | defaultsList.Add(S._("Default file erasure method")); |
|---|
| 211 | } |
|---|
| 212 | if (eraseUnusedMethod.SelectedIndex == -1) |
|---|
| 213 | { |
|---|
| 214 | if (eraseUnusedMethod.Items.Count > 0) |
|---|
| 215 | { |
|---|
| 216 | eraseUnusedMethod.SelectedIndex = 0; |
|---|
| 217 | ManagerLibrary.Settings.DefaultUnusedSpaceErasureMethod = |
|---|
| 218 | ((ErasureMethod)eraseUnusedMethod.SelectedItem).Guid; |
|---|
| 219 | } |
|---|
| 220 | defaultsList.Add(S._("Default unused space erasure method")); |
|---|
| 221 | } |
|---|
| 222 | if (erasePRNG.SelectedIndex == -1) |
|---|
| 223 | { |
|---|
| 224 | if (erasePRNG.Items.Count > 0) |
|---|
| 225 | { |
|---|
| 226 | erasePRNG.SelectedIndex = 0; |
|---|
| 227 | ManagerLibrary.Settings.ActivePrng = |
|---|
| 228 | ((Prng)erasePRNG.SelectedItem).Guid; |
|---|
| 229 | } |
|---|
| 230 | defaultsList.Add(S._("Randomness data source")); |
|---|
| 231 | } |
|---|
| 232 | |
|---|
| 233 | //Remind the user. |
|---|
| 234 | if (defaultsList.Count != 0) |
|---|
| 235 | { |
|---|
| 236 | string defaults = string.Empty; |
|---|
| 237 | foreach (string item in defaultsList) |
|---|
| 238 | defaults += "\t" + item + "\n"; |
|---|
| 239 | MessageBox.Show(S._("The following settings held invalid values:\n\n" + |
|---|
| 240 | "{0}\nThese settings have now been set to naive defaults.\n\n" + |
|---|
| 241 | "Please check that the new settings suit your required level of security.", |
|---|
| 242 | defaults), S._("Eraser"), MessageBoxButtons.OK, MessageBoxIcon.Warning, |
|---|
| 243 | MessageBoxDefaultButton.Button1, |
|---|
| 244 | S.IsRightToLeft(this) ? MessageBoxOptions.RtlReading : 0); |
|---|
| 245 | saveSettings_Click(null, null); |
|---|
| 246 | } |
|---|
| 247 | } |
|---|
| 248 | |
|---|
| 249 | private void plausableDeniabilityFilesRemoveUpdate() |
|---|
| 250 | { |
|---|
| 251 | plausibleDeniabilityFilesRemove.Enabled = plausibleDeniability.Checked && |
|---|
| 252 | plausibleDeniabilityFiles.SelectedIndices.Count > 0; |
|---|
| 253 | } |
|---|
| 254 | |
|---|
| 255 | private void plausibleDeniability_CheckedChanged(object sender, EventArgs e) |
|---|
| 256 | { |
|---|
| 257 | plausibleDeniabilityFiles.Enabled = plausibleDeniabilityFilesAddFile.Enabled = |
|---|
| 258 | plausibleDeniabilityFilesAddFolder.Enabled = plausibleDeniability.Checked; |
|---|
| 259 | plausableDeniabilityFilesRemoveUpdate(); |
|---|
| 260 | } |
|---|
| 261 | |
|---|
| 262 | private void plausibleDeniabilityFiles_SelectedIndexChanged(object sender, EventArgs e) |
|---|
| 263 | { |
|---|
| 264 | plausableDeniabilityFilesRemoveUpdate(); |
|---|
| 265 | } |
|---|
| 266 | |
|---|
| 267 | private void plausibleDeniabilityFilesAddFile_Click(object sender, EventArgs e) |
|---|
| 268 | { |
|---|
| 269 | if (openFileDialog.ShowDialog() == DialogResult.OK) |
|---|
| 270 | plausibleDeniabilityFiles.Items.AddRange(openFileDialog.FileNames); |
|---|
| 271 | |
|---|
| 272 | plausableDeniabilityFilesRemoveUpdate(); |
|---|
| 273 | } |
|---|
| 274 | |
|---|
| 275 | private void plausibleDeniabilityFilesAddFolder_Click(object sender, EventArgs e) |
|---|
| 276 | { |
|---|
| 277 | try |
|---|
| 278 | { |
|---|
| 279 | if (folderBrowserDialog.ShowDialog() == DialogResult.OK) |
|---|
| 280 | plausibleDeniabilityFiles.Items.Add(folderBrowserDialog.SelectedPath); |
|---|
| 281 | plausableDeniabilityFilesRemoveUpdate(); |
|---|
| 282 | } |
|---|
| 283 | catch (NotSupportedException) |
|---|
| 284 | { |
|---|
| 285 | MessageBox.Show(this, S._("The path you selected is invalid."), S._("Eraser"), |
|---|
| 286 | MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, |
|---|
| 287 | S.IsRightToLeft(this) ? MessageBoxOptions.RtlReading : 0); |
|---|
| 288 | } |
|---|
| 289 | } |
|---|
| 290 | |
|---|
| 291 | private void plausibleDeniabilityFilesRemove_Click(object sender, EventArgs e) |
|---|
| 292 | { |
|---|
| 293 | if (plausibleDeniabilityFiles.SelectedIndex != -1) |
|---|
| 294 | { |
|---|
| 295 | ListBox.SelectedObjectCollection items = |
|---|
| 296 | plausibleDeniabilityFiles.SelectedItems; |
|---|
| 297 | while (items.Count > 0) |
|---|
| 298 | { |
|---|
| 299 | for (int i = 0; i < items.Count; i++) |
|---|
| 300 | plausibleDeniabilityFiles.Items.Remove(items[i]); |
|---|
| 301 | |
|---|
| 302 | items = plausibleDeniabilityFiles.SelectedItems; |
|---|
| 303 | } |
|---|
| 304 | |
|---|
| 305 | plausableDeniabilityFilesRemoveUpdate(); |
|---|
| 306 | } |
|---|
| 307 | } |
|---|
| 308 | |
|---|
| 309 | private void pluginsManager_ItemCheck(object sender, ItemCheckEventArgs e) |
|---|
| 310 | { |
|---|
| 311 | ListViewItem item = pluginsManager.Items[e.Index]; |
|---|
| 312 | PluginInstance instance = (PluginInstance)item.Tag; |
|---|
| 313 | if (instance.IsCore) |
|---|
| 314 | e.NewValue = CheckState.Checked; |
|---|
| 315 | } |
|---|
| 316 | |
|---|
| 317 | private void pluginsMenu_Opening(object sender, CancelEventArgs e) |
|---|
| 318 | { |
|---|
| 319 | if (pluginsManager.SelectedItems.Count == 1) |
|---|
| 320 | { |
|---|
| 321 | PluginInstance instance = (PluginInstance)pluginsManager.SelectedItems[0].Tag; |
|---|
| 322 | e.Cancel = instance.Plugin == null || !instance.Plugin.Configurable; |
|---|
| 323 | } |
|---|
| 324 | else |
|---|
| 325 | e.Cancel = true; |
|---|
| 326 | } |
|---|
| 327 | |
|---|
| 328 | private void settingsToolStripMenuItem_Click(object sender, EventArgs e) |
|---|
| 329 | { |
|---|
| 330 | if (pluginsManager.SelectedItems.Count != 1) |
|---|
| 331 | return; |
|---|
| 332 | |
|---|
| 333 | PluginInstance instance = (PluginInstance)pluginsManager.SelectedItems[0].Tag; |
|---|
| 334 | instance.Plugin.DisplaySettings(this); |
|---|
| 335 | } |
|---|
| 336 | |
|---|
| 337 | private void saveSettings_Click(object sender, EventArgs e) |
|---|
| 338 | { |
|---|
| 339 | EraserSettings settings = EraserSettings.Get(); |
|---|
| 340 | ManagerSettings managerSettings = ManagerLibrary.Settings; |
|---|
| 341 | |
|---|
| 342 | //Save the settings that don't fail first. |
|---|
| 343 | managerSettings.ForceUnlockLockedFiles = lockedForceUnlock.Checked; |
|---|
| 344 | managerSettings.ExecuteMissedTasksImmediately = schedulerMissedImmediate.Checked; |
|---|
| 345 | settings.ClearCompletedTasks = schedulerClearCompleted.Checked; |
|---|
| 346 | |
|---|
| 347 | bool pluginApprovalsChanged = false; |
|---|
| 348 | IDictionary<Guid, bool> pluginApprovals = managerSettings.PluginApprovals; |
|---|
| 349 | foreach (ListViewItem item in pluginsManager.Items) |
|---|
| 350 | { |
|---|
| 351 | PluginInstance plugin = (PluginInstance)item.Tag; |
|---|
| 352 | Guid guid = plugin.AssemblyInfo.Guid; |
|---|
| 353 | if (!pluginApprovals.ContainsKey(guid)) |
|---|
| 354 | { |
|---|
| 355 | pluginApprovals.Add(guid, item.Checked); |
|---|
| 356 | pluginApprovalsChanged = true; |
|---|
| 357 | } |
|---|
| 358 | else if (pluginApprovals[guid] != item.Checked) |
|---|
| 359 | { |
|---|
| 360 | pluginApprovals[guid] = item.Checked; |
|---|
| 361 | pluginApprovalsChanged = true; |
|---|
| 362 | } |
|---|
| 363 | } |
|---|
| 364 | |
|---|
| 365 | if (pluginApprovalsChanged) |
|---|
| 366 | { |
|---|
| 367 | MessageBox.Show(this, S._("Plugins which have just been approved will only be loaded " + |
|---|
| 368 | "the next time Eraser is started."), S._("Eraser"), MessageBoxButtons.OK, |
|---|
| 369 | MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, |
|---|
| 370 | S.IsRightToLeft(this) ? MessageBoxOptions.RtlReading : 0); |
|---|
| 371 | } |
|---|
| 372 | |
|---|
| 373 | //Error checks for the rest that do. |
|---|
| 374 | errorProvider.Clear(); |
|---|
| 375 | if (uiLanguage.SelectedIndex == -1) |
|---|
| 376 | { |
|---|
| 377 | errorProvider.SetError(uiLanguage, S._("An invalid language was selected.")); |
|---|
| 378 | return; |
|---|
| 379 | } |
|---|
| 380 | else if (eraseFilesMethod.SelectedIndex == -1) |
|---|
| 381 | { |
|---|
| 382 | errorProvider.SetError(eraseFilesMethod, S._("An invalid file erasure method " + |
|---|
| 383 | "was selected.")); |
|---|
| 384 | return; |
|---|
| 385 | } |
|---|
| 386 | else if (eraseUnusedMethod.SelectedIndex == -1) |
|---|
| 387 | { |
|---|
| 388 | errorProvider.SetError(eraseUnusedMethod, S._("An invalid unused disk space " + |
|---|
| 389 | "erasure method was selected.")); |
|---|
| 390 | return; |
|---|
| 391 | } |
|---|
| 392 | else if (erasePRNG.SelectedIndex == -1) |
|---|
| 393 | { |
|---|
| 394 | errorProvider.SetError(erasePRNG, S._("An invalid randomness data " + |
|---|
| 395 | "source was selected.")); |
|---|
| 396 | return; |
|---|
| 397 | } |
|---|
| 398 | else if (plausibleDeniability.Checked && plausibleDeniabilityFiles.Items.Count == 0) |
|---|
| 399 | { |
|---|
| 400 | errorProvider.SetError(plausibleDeniabilityFiles, S._("Erasures with plausible deniability " + |
|---|
| 401 | "was selected, but no files were selected to be used as decoys.")); |
|---|
| 402 | errorProvider.SetIconPadding(plausibleDeniabilityFiles, -16); |
|---|
| 403 | return; |
|---|
| 404 | } |
|---|
| 405 | |
|---|
| 406 | if (((Language)uiLanguage.SelectedItem).Name != settings.Language) |
|---|
| 407 | { |
|---|
| 408 | settings.Language = ((Language)uiLanguage.SelectedItem).Name; |
|---|
| 409 | MessageBox.Show(this, S._("The new UI language will take only effect when " + |
|---|
| 410 | "Eraser is restarted."), S._("Eraser"), MessageBoxButtons.OK, |
|---|
| 411 | MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, |
|---|
| 412 | S.IsRightToLeft(this) ? MessageBoxOptions.RtlReading : 0); |
|---|
| 413 | } |
|---|
| 414 | settings.IntegrateWithShell = uiContextMenu.Checked; |
|---|
| 415 | |
|---|
| 416 | managerSettings.DefaultFileErasureMethod = |
|---|
| 417 | ((ErasureMethod)eraseFilesMethod.SelectedItem).Guid; |
|---|
| 418 | managerSettings.DefaultUnusedSpaceErasureMethod = |
|---|
| 419 | ((ErasureMethod)eraseUnusedMethod.SelectedItem).Guid; |
|---|
| 420 | |
|---|
| 421 | Prng newPRNG = (Prng)erasePRNG.SelectedItem; |
|---|
| 422 | if (newPRNG.Guid != managerSettings.ActivePrng) |
|---|
| 423 | { |
|---|
| 424 | MessageBox.Show(this, S._("The new randomness data source will only be used when " + |
|---|
| 425 | "the next task is run.\nCurrently running tasks will use the old source."), |
|---|
| 426 | S._("Eraser"), MessageBoxButtons.OK, MessageBoxIcon.Information, |
|---|
| 427 | MessageBoxDefaultButton.Button1, |
|---|
| 428 | S.IsRightToLeft(this) ? MessageBoxOptions.RtlReading : 0); |
|---|
| 429 | managerSettings.ActivePrng = newPRNG.Guid; |
|---|
| 430 | } |
|---|
| 431 | |
|---|
| 432 | managerSettings.PlausibleDeniability = plausibleDeniability.Checked; |
|---|
| 433 | IList<string> plausibleDeniabilityFilesList = managerSettings.PlausibleDeniabilityFiles; |
|---|
| 434 | foreach (string str in this.plausibleDeniabilityFiles.Items) |
|---|
| 435 | plausibleDeniabilityFilesList.Add(str); |
|---|
| 436 | } |
|---|
| 437 | } |
|---|
| 438 | } |
|---|
| 439 | |
|---|