| Revision 234,
1.1 KB
checked in by lowjoel, 5 years ago
(diff) |
|
Implemented task list saving/loading
|
| Line | |
|---|
| 1 | using System; |
|---|
| 2 | using System.Collections.Generic; |
|---|
| 3 | using System.Windows.Forms; |
|---|
| 4 | |
|---|
| 5 | using Eraser.Manager; |
|---|
| 6 | using Microsoft.Win32; |
|---|
| 7 | using System.IO; |
|---|
| 8 | |
|---|
| 9 | namespace Eraser |
|---|
| 10 | { |
|---|
| 11 | static class Program |
|---|
| 12 | { |
|---|
| 13 | /// <summary> |
|---|
| 14 | /// The main entry point for the application. |
|---|
| 15 | /// </summary> |
|---|
| 16 | [STAThread] |
|---|
| 17 | static void Main() |
|---|
| 18 | { |
|---|
| 19 | Application.EnableVisualStyles(); |
|---|
| 20 | Application.SetCompatibleTextRenderingDefault(false); |
|---|
| 21 | |
|---|
| 22 | using (eraserClient = new DirectExecutor()) |
|---|
| 23 | { |
|---|
| 24 | //Load the task list |
|---|
| 25 | RegistryKey key = Application.UserAppDataRegistry; |
|---|
| 26 | byte[] savedTaskList = (byte[])key.GetValue("TaskList", new byte[] { }); |
|---|
| 27 | using (MemoryStream stream = new MemoryStream(savedTaskList)) |
|---|
| 28 | { |
|---|
| 29 | eraserClient.LoadTaskList(stream); |
|---|
| 30 | } |
|---|
| 31 | |
|---|
| 32 | //Run the program |
|---|
| 33 | Application.Run(new MainForm()); |
|---|
| 34 | |
|---|
| 35 | //Save the task list |
|---|
| 36 | using (MemoryStream stream = new MemoryStream()) |
|---|
| 37 | { |
|---|
| 38 | eraserClient.SaveTaskList(stream); |
|---|
| 39 | key.SetValue("TaskList", stream.ToArray(), RegistryValueKind.Binary); |
|---|
| 40 | } |
|---|
| 41 | } |
|---|
| 42 | } |
|---|
| 43 | |
|---|
| 44 | public static DirectExecutor eraserClient; |
|---|
| 45 | } |
|---|
| 46 | } |
|---|
Note: See
TracBrowser
for help on using the repository browser.