source: trunk/eraser6/Eraser.DefaultPlugins/Plugin.cs @ 1802

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

Merged the CodeReview? Branch back to trunk. (Finally!) Closes #275: Code Review.

  • 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["FL16Method"] == null ? Guid.Empty :
114                    (Guid)settings["FL16Method"];
115            }
116            set
117            {
118                settings["FL16Method"] = value;
119            }
120        }
121
122        /// <summary>
123        /// The set of custom erasure methods.
124        /// </summary>
125        public Dictionary<Guid, CustomErasureMethod> EraseCustom
126        {
127            get
128            {
129                return (Dictionary<Guid, CustomErasureMethod>)settings["EraseCustom"];
130            }
131            set
132            {
133                settings["EraseCustom"] = value;
134            }
135        }
136
137        /// <summary>
138        /// The data store for our settings.
139        /// </summary>
140        Settings settings;
141    }
142}
Note: See TracBrowser for help on using the repository browser.