Changeset 2357 for branches/eraser6/pluginsRewrite
- Timestamp:
- 11/07/11 06:07:52 (19 months ago)
- Location:
- branches/eraser6/pluginsRewrite
- Files:
-
- 3 added
- 10 edited
- 4 moved
-
Eraser.Manager/EntropyPoller.cs (moved) (moved from branches/eraser6/pluginsRewrite/Eraser.Manager/EntropySource.cs) (1 diff)
-
Eraser.Manager/Eraser.Manager.csproj (modified) (1 diff)
-
Eraser.Manager/ErasureTarget.cs (modified) (1 diff)
-
Eraser.Manager/ManagerLibrary.cs (modified) (3 diffs)
-
Eraser.Plugins/Eraser.Plugins.csproj (modified) (1 diff)
-
Eraser.Plugins/ExtensionPoints/EntropySource.cs (modified) (1 diff)
-
Eraser.Plugins/ExtensionPoints/ErasureMethod.cs (modified) (1 diff)
-
Eraser.Plugins/ExtensionPoints/ErasureTarget.cs (modified) (3 diffs)
-
Eraser.Plugins/ExtensionPoints/FileSystem.cs (modified) (3 diffs)
-
Eraser.Plugins/ExtensionPoints/Prng.cs (modified) (1 diff)
-
Eraser.Plugins/Host.cs (modified) (7 diffs)
-
Eraser.Plugins/Registrars (added)
-
Eraser.Plugins/Registrars/EntropySourceRegistrar.cs (added)
-
Eraser.Plugins/Registrars/ErasureMethodRegistrar.cs (moved) (moved from branches/eraser6/pluginsRewrite/Eraser.Manager/ErasureMethod.cs) (3 diffs)
-
Eraser.Plugins/Registrars/ErasureTargetFactoryRegistrar.cs (added)
-
Eraser.Plugins/Registrars/FileSystemRegistrar.cs (moved) (moved from branches/eraser6/pluginsRewrite/Eraser.Manager/FileSystem.cs) (2 diffs)
-
Eraser.Plugins/Registrars/PrngRegistrar.cs (moved) (moved from branches/eraser6/pluginsRewrite/Eraser.Manager/PRNG.cs) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eraser6/pluginsRewrite/Eraser.Manager/EntropyPoller.cs
r2352 r2357 36 36 { 37 37 /// <summary> 38 /// A class which manages all of the instances of the EntropySources39 /// available. Plugins could register their entropy sources via this class.40 /// </summary>41 public class EntropySourceRegistrar : Registrar<EntropySource>42 {43 /// <summary>44 /// Constructor.45 /// </summary>46 internal EntropySourceRegistrar()47 {48 Poller = new EntropyPoller();49 }50 51 /// <summary>52 /// Gets the entropy poller instance associated with this manager.53 /// </summary>54 public EntropyPoller Poller { get; private set; }55 56 /// <summary>57 /// The list of currently registered Entropy Sources.58 /// </summary>59 private Dictionary<Guid, EntropySource> sources = new Dictionary<Guid, EntropySource>();60 };61 62 /// <summary>63 38 /// A class which uses EntropyPoll class to fetch system data as a source of 64 39 /// randomness at "regular" but "random" intervals -
branches/eraser6/pluginsRewrite/Eraser.Manager/Eraser.Manager.csproj
r2347 r2357 69 69 </Compile> 70 70 <Compile Include="DirectExecutor.cs" /> 71 <Compile Include="Entropy Source.cs" />71 <Compile Include="EntropyPoller.cs" /> 72 72 <Compile Include="ErasureTarget.cs" /> 73 73 <Compile Include="Exception.cs" /> 74 74 <Compile Include="Executor.cs" /> 75 <Compile Include="FileSystem.cs" />76 75 <Compile Include="ManagerLibrary.cs" /> 77 <Compile Include="ErasureMethod.cs" />78 <Compile Include="PRNG.cs" />79 76 <Compile Include="Properties\AssemblyInfo.cs" /> 80 77 <Compile Include="RemoteExecutor.cs" /> -
branches/eraser6/pluginsRewrite/Eraser.Manager/ErasureTarget.cs
r2352 r2357 35 35 namespace Eraser.Manager 36 36 { 37 public class ErasureTargetRegistrar : FactoryRegistrar<ErasureTarget>38 {39 }40 41 37 /// <summary> 42 38 /// Maintains a collection of erasure targets. -
branches/eraser6/pluginsRewrite/Eraser.Manager/ManagerLibrary.cs
r2291 r2357 44 44 Instance = this; 45 45 SettingsManager = settings; 46 47 EntropySourceRegistrar = new EntropySourceRegistrar();48 PrngRegistrar = new PrngRegistrar();49 ErasureMethodRegistrar = new ErasureMethodRegistrar();50 ErasureTargetRegistrar = new ErasureTargetRegistrar();51 FileSystemRegistrar = new FileSystemRegistrar();52 Host.Initialise();46 Host.Initialise( 47 entropySources: new EntropySourceRegistrar(), 48 prngs: new PrngRegistrar(), 49 erasureMethods: new ErasureMethodRegistrar(), 50 erasureTargetFactories: new FactoryRegistrar<Plugins.ExtensionPoints.ErasureTarget>(), 51 fileSystems: new FileSystemRegistrar() 52 ); 53 53 Host.Instance.Load(); 54 54 } … … 66 66 if (disposing) 67 67 { 68 EntropySourceRegistrar.Poller.Abort();68 ((EntropySourceRegistrar)Host.Instance.EntropySources).Poller.Abort(); 69 69 Host.Instance.Dispose(); 70 70 SettingsManager.Save(); … … 109 109 110 110 /// <summary> 111 /// The global instance of the EntropySource Manager112 /// </summary>113 public EntropySourceRegistrar EntropySourceRegistrar { get; private set; }114 115 /// <summary>116 /// The global instance of the PRNG Manager.117 /// </summary>118 public PrngRegistrar PrngRegistrar { get; private set; }119 120 /// <summary>121 /// The global instance of the Erasure method Manager.122 /// </summary>123 public ErasureMethodRegistrar ErasureMethodRegistrar { get; private set; }124 125 /// <summary>126 /// The global instance of the Erasure target Manager.127 /// </summary>128 public ErasureTargetRegistrar ErasureTargetRegistrar { get; private set; }129 130 /// <summary>131 /// The global instance of the File System manager.132 /// </summary>133 public FileSystemRegistrar FileSystemRegistrar { get; private set; }134 135 /// <summary>136 111 /// Global instance of the Settings manager. 137 112 /// </summary> -
branches/eraser6/pluginsRewrite/Eraser.Plugins/Eraser.Plugins.csproj
r2352 r2357 68 68 <Compile Include="Host.cs" /> 69 69 <Compile Include="Properties\AssemblyInfo.cs" /> 70 <Compile Include="Registrars\EntropySourceRegistrar.cs" /> 71 <Compile Include="Registrars\ErasureMethodRegistrar.cs" /> 72 <Compile Include="Registrars\ErasureTargetFactoryRegistrar.cs" /> 73 <Compile Include="Registrars\FileSystemRegistrar.cs" /> 74 <Compile Include="Registrars\PrngRegistrar.cs" /> 70 75 </ItemGroup> 71 76 <ItemGroup> -
branches/eraser6/pluginsRewrite/Eraser.Plugins/ExtensionPoints/EntropySource.cs
r2352 r2357 3 3 * Copyright 2008-2010 The Eraser Project 4 4 * Original Author: Joel Low <lowjoel@users.sourceforge.net> 5 * Modified By: Kasra Nassiri <cjax@users.sourceforge.net>5 * Modified By: 6 6 * 7 7 * This file is part of Eraser. -
branches/eraser6/pluginsRewrite/Eraser.Plugins/ExtensionPoints/ErasureMethod.cs
r2352 r2357 128 128 129 129 //Randomize. 130 Prng rand = ManagerLibrary.Instance.PrngRegistrar[ManagerLibrary.Settings.ActivePrng];130 Prng rand = Host.Instance.Prngs[ManagerLibrary.Settings.ActivePrng]; 131 131 for (int i = 0; i < result.Length; ++i) 132 132 { -
branches/eraser6/pluginsRewrite/Eraser.Plugins/ExtensionPoints/ErasureTarget.cs
r2352 r2357 29 29 30 30 using Eraser.Util; 31 using Eraser.Manager;32 31 33 32 namespace Eraser.Plugins.ExtensionPoints … … 46 45 Method = ErasureMethodRegistrar.Default; 47 46 else 48 Method = ManagerLibrary.Instance.ErasureMethodRegistrar[methodGuid];47 Method = Host.Instance.ErasureMethods[methodGuid]; 49 48 } 50 49 … … 72 71 Method = ErasureMethodRegistrar.Default; 73 72 } 74 75 /// <summary>76 /// The task which owns this target.77 /// </summary>78 public Task Task { get; internal set; }79 73 80 74 /// <summary> -
branches/eraser6/pluginsRewrite/Eraser.Plugins/ExtensionPoints/FileSystem.cs
r2352 r2357 26 26 27 27 using System.IO; 28 28 29 using Eraser.Util; 29 30 … … 46 47 { 47 48 //Get the PRNG we are going to use 48 Prng prng = ManagerLibrary.Instance.PrngRegistrar[ManagerLibrary.Settings.ActivePrng];49 Prng prng = Host.Instance.Prngs[ManagerLibrary.Settings.ActivePrng]; 49 50 50 51 //Initialsie the base name, if any. … … 135 136 List<string> entries = new List<string>( 136 137 ManagerLibrary.Settings.PlausibleDeniabilityFiles); 137 Prng prng = ManagerLibrary.Instance.PrngRegistrar[ManagerLibrary.Settings.ActivePrng];138 Prng prng = Host.Instance.Prngs[ManagerLibrary.Settings.ActivePrng]; 138 139 do 139 140 { -
branches/eraser6/pluginsRewrite/Eraser.Plugins/ExtensionPoints/Prng.cs
r2352 r2357 3 3 * Copyright 2008-2010 The Eraser Project 4 4 * Original Author: Joel Low <lowjoel@users.sourceforge.net> 5 * Modified By: Kasra Nassiri <cjax@users.sourceforge.net>6 5 * Modified By: 7 6 * -
branches/eraser6/pluginsRewrite/Eraser.Plugins/Host.cs
r2355 r2357 29 29 30 30 using Eraser.Util; 31 using Eraser.Plugins.ExtensionPoints; 31 32 32 33 namespace Eraser.Plugins … … 60 61 61 62 /// <summary> 62 /// Initialises the Plugins library. Call <see cref="Host.Load"/> when object 63 /// Initialises the Plugins library. This allows you to specify the registrars 64 /// in charge of every extension point defined. 65 /// 66 /// Call <see cref="Host.Load"/> when object 63 67 /// initialisation is complete. 64 68 /// </summary> 69 /// <param name="entropySources">The Entropy Source registrar to use.</param> 70 /// <param name="prngs">The PRNG registrar to use.</param> 71 /// <param name="erasureMethods">The Erasure Methods registrar to use.</param> 72 /// <param name="erasureTargetFactories">The Erasure Target Factories registrar to use.</param> 73 /// <param name="fileSystems">The File System registrar to use.</param> 65 74 /// <remarks>Call <see cref="Host.Instance.Dispose"/> when exiting.</remarks> 66 public static void Initialise() 67 { 68 new DefaultHost(); 75 public static void Initialise(Registrar<EntropySource> entropySources, 76 Registrar<Prng> prngs, Registrar<ErasureMethod> erasureMethods, 77 FactoryRegistrar<ErasureTarget> erasureTargetFactories, 78 Registrar<FileSystem> fileSystems) 79 { 80 new DefaultHost(entropySources, prngs, erasureMethods, erasureTargetFactories, 81 fileSystems); 69 82 } 70 83 … … 72 85 /// Constructor. Sets the global Plugin Host instance. 73 86 /// </summary> 87 /// <param name="entropySources">The Entropy Source registrar to use.</param> 88 /// <param name="prngs">The PRNG registrar to use.</param> 89 /// <param name="erasureMethods">The Erasure Methods registrar to use.</param> 90 /// <param name="erasureTargetFactories">The Erasure Target Factories registrar to use.</param> 91 /// <param name="fileSystems">The File System registrar to use.</param> 74 92 /// <see cref="Host.Instance"/> 75 protected Host() 93 protected Host(Registrar<EntropySource> entropySources, 94 Registrar<Prng> prngs, Registrar<ErasureMethod> erasureMethods, 95 FactoryRegistrar<ErasureTarget> erasureTargetFactories, 96 Registrar<FileSystem> fileSystems) 76 97 { 77 98 if (Instance != null) … … 79 100 "exist at any one point of time."); 80 101 Instance = this; 102 103 EntropySources = entropySources; 104 Prngs = prngs; 105 ErasureMethods = erasureMethods; 106 ErasureTargetFactories = erasureTargetFactories; 107 FileSystems = fileSystems; 81 108 } 82 109 … … 89 116 private set; 90 117 } 118 119 #region Plugin Loading and Management 91 120 92 121 /// <summary> … … 144 173 PluginLoaded(sender, e); 145 174 } 175 176 #endregion 177 178 #region Type Registrars 179 180 /// <summary> 181 /// The global instance of the EntropySource Manager 182 /// </summary> 183 public Registrar<EntropySource> EntropySources 184 { 185 get; 186 private set; 187 } 188 189 /// <summary> 190 /// The global instance of the PRNG Manager. 191 /// </summary> 192 public Registrar<Prng> Prngs 193 { 194 get; 195 private set; 196 } 197 198 /// <summary> 199 /// The global instance of the Erasure method Manager. 200 /// </summary> 201 public Registrar<ErasureMethod> ErasureMethods 202 { 203 get; 204 private set; 205 } 206 207 /// <summary> 208 /// The global instance of the Erasure target Manager. 209 /// </summary> 210 public FactoryRegistrar<ErasureTarget> ErasureTargetFactories 211 { 212 get; 213 private set; 214 } 215 216 /// <summary> 217 /// The global instance of the File System manager. 218 /// </summary> 219 public Registrar<FileSystem> FileSystems 220 { 221 get; 222 private set; 223 } 224 225 #endregion 146 226 } 147 227 … … 154 234 /// Constructor. 155 235 /// </summary> 156 public DefaultHost() : base() 236 public DefaultHost(Registrar<EntropySource> entropySources, 237 Registrar<Prng> prngs, Registrar<ErasureMethod> erasureMethods, 238 FactoryRegistrar<ErasureTarget> erasureTargetFactories, 239 Registrar<FileSystem> fileSystems) 240 : base(entropySources, prngs, erasureMethods, erasureTargetFactories, fileSystems) 157 241 { 158 242 //Specify additional places to load assemblies from -
branches/eraser6/pluginsRewrite/Eraser.Plugins/Registrars/ErasureMethodRegistrar.cs
r2352 r2357 1 /*1 /* 2 2 * $Id$ 3 * Copyright 2008-201 0The Eraser Project3 * Copyright 2008-2011 The Eraser Project 4 4 * Original Author: Joel Low <lowjoel@users.sourceforge.net> 5 5 * Modified By: … … 22 22 using System; 23 23 using System.Collections.Generic; 24 using System.Linq; 24 25 using System.Text; 25 26 26 using System.Reflection;27 using System.IO;28 29 27 using Eraser.Util; 30 using Eraser.Plugins;31 28 using Eraser.Plugins.ExtensionPoints; 32 29 33 namespace Eraser. Manager30 namespace Eraser.Plugins.Registrars 34 31 { 35 32 /// <summary> … … 86 83 #endregion 87 84 } 88 89 public class ErasureMethodRegistrationEventArgs : EventArgs90 {91 /// <summary>92 /// Constructor.93 /// </summary>94 /// <param name="value">The GUID of the newly registered/unregistered95 /// erasure method.</param>96 public ErasureMethodRegistrationEventArgs(Guid value)97 {98 Guid = value;99 }100 101 /// <summary>102 /// The GUID of the newly registsered/unregistered erasure method.103 /// </summary>104 public Guid Guid { get; private set; }105 }106 85 } -
branches/eraser6/pluginsRewrite/Eraser.Plugins/Registrars/FileSystemRegistrar.cs
r2352 r2357 1 1 /* 2 2 * $Id$ 3 * Copyright 2008-201 0The Eraser Project3 * Copyright 2008-2011 The Eraser Project 4 4 * Original Author: Joel Low <lowjoel@users.sourceforge.net> 5 5 * Modified By: … … 22 22 using System; 23 23 using System.Collections.Generic; 24 using System.Linq; 24 25 using System.Text; 25 26 26 using Eraser.Util;27 using Eraser.Plugins;28 27 using Eraser.Plugins.ExtensionPoints; 29 28 30 namespace Eraser. Manager29 namespace Eraser.Plugins.Registrars 31 30 { 32 31 public class FileSystemRegistrar : Registrar<FileSystem> -
branches/eraser6/pluginsRewrite/Eraser.Plugins/Registrars/PrngRegistrar.cs
r2352 r2357 1 /*1 /* 2 2 * $Id$ 3 * Copyright 2008-201 0The Eraser Project3 * Copyright 2008-2011 The Eraser Project 4 4 * Original Author: Joel Low <lowjoel@users.sourceforge.net> 5 * Modified By: Kasra Nassiri <cjax@users.sourceforge.net>6 5 * Modified By: 7 6 * … … 23 22 using System; 24 23 using System.Collections.Generic; 24 using System.Linq; 25 25 using System.Text; 26 26 27 using System.Threading;28 using System.Security.Cryptography;29 using System.Runtime.InteropServices;30 using System.Diagnostics;31 using System.Reflection;32 using System.IO;33 using Microsoft.Win32.SafeHandles;34 35 using Eraser.Util;36 using Eraser.Plugins;37 27 using Eraser.Plugins.ExtensionPoints; 38 28 39 namespace Eraser. Manager29 namespace Eraser.Plugins.Registrars 40 30 { 41 31 /// <summary>
Note: See TracChangeset
for help on using the changeset viewer.
