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