Changeset 238 for branches/eraser6/Eraser/Program.cs
- Timestamp:
- 3/11/2008 1:38:02 PM (5 years ago)
- File:
-
- 1 edited
-
branches/eraser6/Eraser/Program.cs (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eraser6/Eraser/Program.cs
r236 r238 23 23 using (eraserClient = new DirectExecutor()) 24 24 { 25 //Set the defaults for the library 26 Globals.Settings = new Settings(); 27 25 28 //Load the task list 26 29 RegistryKey key = Application.UserAppDataRegistry; … … 31 34 } 32 35 36 //Create the main form 37 MainForm form = new MainForm(); 38 33 39 //Run tasks which are meant to be run on restart 34 eraserClient.QueueRestartTasks(); 40 int restartPos = Environment.CommandLine.ToLower().IndexOf("restart"); 41 if ((restartPos > 1 && 42 Environment.CommandLine[restartPos - 1] == '/') || 43 (restartPos > 2 && 44 Environment.CommandLine[restartPos - 1] == '-' && 45 Environment.CommandLine[restartPos - 2] == '-')) 46 { 47 eraserClient.QueueRestartTasks(); 48 } 35 49 36 50 //Run the program 37 Application.Run( new MainForm());51 Application.Run(form); 38 52 39 53 //Save the task list … … 48 62 public static DirectExecutor eraserClient; 49 63 } 64 65 public class Settings : Manager.Settings 66 { 67 public Settings() 68 { 69 RegistryKey key = Application.UserAppDataRegistry; 70 ActivePRNG = new Guid((string) 71 key.GetValue("PRNG", (object)Guid.Empty)); 72 EraseLockedFilesOnRestart = 73 (int)key.GetValue("EraseOnRestart", (object)true) != 0; 74 ConfirmEraseOnRestart = 75 (int)key.GetValue("ConfirmEraseOnRestart", (object)true) != 0; 76 DefaultFileErasureMethod = new Guid((string) 77 key.GetValue("DefaultFileErasureMethod", (object)Guid.Empty)); 78 DefaultUnusedSpaceErasureMethod = new Guid((string) 79 key.GetValue("DefaultUnusedSpaceErasureMethod", (object)Guid.Empty)); 80 ExecuteMissedTasksImmediately = 81 (int)key.GetValue("ExecuteMissedTasksImmediately", (object)true) != 0; 82 } 83 84 ~Settings() 85 { 86 RegistryKey key = Application.UserAppDataRegistry; 87 key.SetValue("PRNG", ActivePRNG); 88 key.SetValue("EraseOnRestart", EraseLockedFilesOnRestart, 89 RegistryValueKind.DWord); 90 key.SetValue("ConfirmEraseOnRestart", ConfirmEraseOnRestart, 91 RegistryValueKind.DWord); 92 key.SetValue("DefaultFileErasureMethod", DefaultFileErasureMethod); 93 key.SetValue("DefaultUnusedSpaceErasureMethod", 94 DefaultUnusedSpaceErasureMethod); 95 key.SetValue("ExecuteMissedTasksImmediately", 96 ExecuteMissedTasksImmediately, RegistryValueKind.DWord); 97 } 98 } 50 99 }
Note: See TracChangeset
for help on using the changeset viewer.
