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