source: branches/eraser6/pluginsRewrite/Eraser.Plugins/Registrars/PrngRegistrar.cs @ 2476

Revision 2476, 1.7 KB checked in by lowjoel, 3 years ago (diff)

The PrngRegistrar? should not try to store the active PRNG's GUID. It should be left to the Eraser.Plugins.Settings class.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
Line 
1/*
2 * $Id$
3 * Copyright 2008-2011 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.Linq;
25using System.Text;
26
27using Eraser.Plugins.ExtensionPoints;
28
29namespace Eraser.Plugins.Registrars
30{
31    /// <summary>
32    /// Class managing all the PRNG algorithms.
33    /// </summary>
34    public class PrngRegistrar : Registrar<IPrng>
35    {
36        /// <summary>
37        /// Constructor.
38        /// </summary>
39        internal PrngRegistrar()
40        {
41        }
42
43        /// <summary>
44        /// Gets the PRNG that is active.
45        /// </summary>
46        /// <remarks>Client code should set the <see cref="ActivePrngGuid"/>
47        /// member.</remarks>
48        public IPrng ActivePrng
49        {
50            get
51            {
52                return this[Host.Instance.Settings.ActivePrng];
53            }
54        }
55
56        /// <summary>
57        /// Allows the EntropyThread to get entropy to the PRNG functions as seeds.
58        /// </summary>
59        /// <param name="entropy">An array of bytes, being entropy for the PRNG.</param>
60        public void AddEntropy(byte[] entropy)
61        {
62            lock (this)
63                foreach (IPrng prng in Host.Instance.Prngs)
64                    prng.Reseed(entropy);
65        }
66    }
67}
Note: See TracBrowser for help on using the repository browser.