source: trunk/eraser/Eraser.DefaultPlugins/Plugin.cs @ 1983

Revision 1983, 4.1 KB checked in by lowjoel, 4 years ago (diff)

Revised code to deal with settings. This version uses native types where possible to increase portability and ease of registry editing. It also deals with defaults.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
Line 
1/*
2 * $Id$
3 * Copyright 2008-2010 The Eraser Project
4 * Original Author: Joel Low <lowjoel@users.sourceforge.net>
5 * Modified By:
6 *
7 * This file is part of Eraser.
8 *
9 * Eraser is free software: you can redistribute it and/or modify it under the
10 * terms of the GNU General Public License as published by the Free Software
11 * Foundation, either version 3 of the License, or (at your option) any later
12 * version.
13 *
14 * Eraser is distributed in the hope that it will be useful, but WITHOUT ANY
15 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
16 * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
17 *
18 * A copy of the GNU General Public License can be found at
19 * <http://www.gnu.org/licenses/>.
20 */
21
22using System;
23using System.Collections.Generic;
24using System.Text;
25using System.Windows.Forms;
26
27using Eraser.Manager;
28using Eraser.Manager.Plugin;
29using Eraser.Util;
30
31namespace Eraser.DefaultPlugins
32{
33    public sealed class DefaultPlugin : IPlugin
34    {
35        public void Initialize(Host host)
36        {
37            Settings = new DefaultPluginSettings();
38
39            //Then register the erasure methods et al.
40            ManagerLibrary.Instance.ErasureMethodRegistrar.Add(new Gutmann());          //35 passes
41            ManagerLibrary.Instance.ErasureMethodRegistrar.Add(new GutmannLite());      //10 passes
42            ManagerLibrary.Instance.ErasureMethodRegistrar.Add(new DoD_EcE());          //7 passes
43            ManagerLibrary.Instance.ErasureMethodRegistrar.Add(new RCMP_TSSIT_OPS_II());    //7 passes
44            ManagerLibrary.Instance.ErasureMethodRegistrar.Add(new Schneier());         //7 passes
45            ManagerLibrary.Instance.ErasureMethodRegistrar.Add(new VSITR());                //7 passes
46            ManagerLibrary.Instance.ErasureMethodRegistrar.Add(new DoD_E());                //3 passes
47            ManagerLibrary.Instance.ErasureMethodRegistrar.Add(new HMGIS5Enhanced());       //3 passes
48            ManagerLibrary.Instance.ErasureMethodRegistrar.Add(new USAF5020());         //3 passes
49            ManagerLibrary.Instance.ErasureMethodRegistrar.Add(new USArmyAR380_19());       //3 passes
50            ManagerLibrary.Instance.ErasureMethodRegistrar.Add(new GOSTP50739());           //2 passes
51            ManagerLibrary.Instance.ErasureMethodRegistrar.Add(new HMGIS5Baseline());       //1 pass
52            ManagerLibrary.Instance.ErasureMethodRegistrar.Add(new Pseudorandom());     //1 pass
53            EraseCustom.RegisterAll();
54            ManagerLibrary.Instance.ErasureMethodRegistrar.Add(new FirstLast16KB());
55
56            ManagerLibrary.Instance.PrngRegistrar.Add(new RngCrypto());
57
58            ManagerLibrary.Instance.FileSystemRegistrar.Add(new Fat12FileSystem());
59            ManagerLibrary.Instance.FileSystemRegistrar.Add(new Fat16FileSystem());
60            ManagerLibrary.Instance.FileSystemRegistrar.Add(new Fat32FileSystem());
61            ManagerLibrary.Instance.FileSystemRegistrar.Add(new NtfsFileSystem());
62        }
63
64        public void Dispose()
65        {
66            GC.SuppressFinalize(this);
67        }
68
69        public string Name
70        {
71            get { return S._("Default Erasure Methods and PRNGs"); }
72        }
73
74        public string Author
75        {
76            get { return S._("The Eraser Project <eraser-development@lists.sourceforge.net>"); }
77        }
78
79        public bool Configurable
80        {
81            get { return true; }
82        }
83
84        public void DisplaySettings(Control parent)
85        {
86            SettingsForm form = new SettingsForm();
87            form.ShowDialog();
88        }
89
90        /// <summary>
91        /// The dictionary holding settings for this plugin.
92        /// </summary>
93        internal static DefaultPluginSettings Settings;
94    }
95
96    /// <summary>
97    /// A concrete class to manage the settings for this plugin.
98    /// </summary>
99    internal class DefaultPluginSettings
100    {
101        public DefaultPluginSettings()
102        {
103            settings = Manager.ManagerLibrary.Instance.SettingsManager.ModuleSettings;
104        }
105
106        /// <summary>
107        /// The First/last 16 kilobyte erasure method.
108        /// </summary>
109        public Guid FL16Method
110        {
111            get
112            {
113                return settings.GetValue<Guid>("FL16Method");
114            }
115            set
116            {
117                settings.SetValue("FL16Method", value);
118            }
119        }
120
121        /// <summary>
122        /// The set of custom erasure methods.
123        /// </summary>
124        public Dictionary<Guid, CustomErasureMethod> EraseCustom
125        {
126            get
127            {
128                return settings.GetValue<Dictionary<Guid, CustomErasureMethod>>("EraseCustom");
129            }
130            set
131            {
132                settings.SetValue("EraseCustom", value);
133            }
134        }
135
136        /// <summary>
137        /// The data store for our settings.
138        /// </summary>
139        Settings settings;
140    }
141}
Note: See TracBrowser for help on using the repository browser.