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