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

Revision 2036, 4.4 KB checked in by lowjoel, 4 years ago (diff)

Split the ErasureTarget?.cs file into the ErasureTarget? abstract base class, and implement the ErasureTarget? abstract base class in the DefaultPlugins? library.

  • 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            ManagerLibrary.Instance.ErasureTargetRegistrar.Add(new FileTarget());
64            ManagerLibrary.Instance.ErasureTargetRegistrar.Add(new FolderTarget());
65            ManagerLibrary.Instance.ErasureTargetRegistrar.Add(new RecycleBinTarget());
66            ManagerLibrary.Instance.ErasureTargetRegistrar.Add(new UnusedSpaceTarget());
67        }
68
69        public void Dispose()
70        {
71            GC.SuppressFinalize(this);
72        }
73
74        public string Name
75        {
76            get { return S._("Default Erasure Methods and PRNGs"); }
77        }
78
79        public string Author
80        {
81            get { return S._("The Eraser Project <eraser-development@lists.sourceforge.net>"); }
82        }
83
84        public bool Configurable
85        {
86            get { return true; }
87        }
88
89        public void DisplaySettings(Control parent)
90        {
91            SettingsForm form = new SettingsForm();
92            form.ShowDialog();
93        }
94
95        /// <summary>
96        /// The dictionary holding settings for this plugin.
97        /// </summary>
98        internal static DefaultPluginSettings Settings;
99    }
100
101    /// <summary>
102    /// A concrete class to manage the settings for this plugin.
103    /// </summary>
104    internal class DefaultPluginSettings
105    {
106        public DefaultPluginSettings()
107        {
108            settings = Manager.ManagerLibrary.Instance.SettingsManager.ModuleSettings;
109        }
110
111        /// <summary>
112        /// The First/last 16 kilobyte erasure method.
113        /// </summary>
114        public Guid FL16Method
115        {
116            get
117            {
118                return settings.GetValue<Guid>("FL16Method");
119            }
120            set
121            {
122                settings.SetValue("FL16Method", value);
123            }
124        }
125
126        /// <summary>
127        /// The set of custom erasure methods.
128        /// </summary>
129        public Dictionary<Guid, CustomErasureMethod> EraseCustom
130        {
131            get
132            {
133                return settings.GetValue<Dictionary<Guid, CustomErasureMethod>>("EraseCustom");
134            }
135            set
136            {
137                settings.SetValue("EraseCustom", value);
138            }
139        }
140
141        /// <summary>
142        /// The data store for our settings.
143        /// </summary>
144        Settings settings;
145    }
146}
Note: See TracBrowser for help on using the repository browser.