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

Revision 2440, 1.8 KB checked in by lowjoel, 3 years ago (diff)

Use the new identifier names defined in Eraser.Plugins.

  • 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[ActivePrngGuid];
53            }
54        }
55
56        /// <summary>
57        /// Sets the GUID of the active PRNG.
58        /// </summary>
59        public Guid ActivePrngGuid
60        {
61            private get;
62            set;
63        }
64
65        /// <summary>
66        /// Allows the EntropyThread to get entropy to the PRNG functions as seeds.
67        /// </summary>
68        /// <param name="entropy">An array of bytes, being entropy for the PRNG.</param>
69        public void AddEntropy(byte[] entropy)
70        {
71            lock (this)
72                foreach (IPrng prng in Host.Instance.Prngs)
73                    prng.Reseed(entropy);
74        }
75    }
76}
Note: See TracBrowser for help on using the repository browser.