/// <summary>
 /// Initializes the <see cref="RegistryBase"/>.
 /// </summary>
 /// <param name="indexGenerator">The <see cref="IndexGenerator"/> to use for the new instance.</param>
 /// <param name="keys">The <see cref="IDictionary{TKey,TValue}"/> to use for the new instance.</param>
 protected RegistryBase(IndexGenerator indexGenerator, IDictionary<uint, VirtualRegistryKey> keys)
 {
   _indexGenerator = indexGenerator;
   _keys = keys;
   _keysSynchronizationLock = new ReaderWriterLockSlim();
   _keyAliases = new Dictionary<uint, uint>();
 }
 public void Initialize()
 {
   var indexGenerator = new IndexGenerator();
   // Reserve the first 20 indices for static virtual keys.
   indexGenerator.ExcludedRanges.Add(new IndexRange(0, 20));
   // Reserved indices for registry rootkeys.
   indexGenerator.ExcludedRanges.Add(new IndexRange(0x80000000, 0x80000006));
   var engineRules = _dataSource.GetRegistryEngineRules();
   var knownKeys = new ObservableDictionary<uint, VirtualRegistryKey>();
   _dataSource.SynchronizeRegistryWith(knownKeys);
   _switch = new RegistrySwitch(indexGenerator, knownKeys, engineRules);
 }
 public VirtualRegistry(IndexGenerator indexGenerator, IDictionary<uint, VirtualRegistryKey> knownKeys)
   : base(indexGenerator, knownKeys)
 {
 }
 public TransparentRegistry(IndexGenerator indexGenerator)
   : base(indexGenerator)
 {
   _keysPendingClosure = new List<uint>();
   _keysPendingClosureSyncRoot = new object();
 }
 /// <summary>
 /// Initializes a new instance of <see cref="RegistrySwitch"/>.
 /// </summary>
 /// <param name="indexGenerator">The <see cref="IndexGenerator"/> to use for generating virtual key handles.</param>
 /// <param name="knownKeys">A list of all known virtual registry keys.</param>
 /// <param name="ruleCollection">The collection of engine rules to consider when deciding on a target registry.</param>
 public RegistrySwitch(IndexGenerator indexGenerator, IDictionary<uint, VirtualRegistryKey> knownKeys, RegistryRuleCollection ruleCollection)
 {
   _transparentRegistry = new TransparentRegistry(indexGenerator);
   _virtualRegistry = new VirtualRegistry(indexGenerator, knownKeys);
   _engineRules = ruleCollection;
 }
 /// <summary>
 /// Initializes the <see cref="RegistryBase"/>.
 /// </summary>
 /// <param name="indexGenerator">The <see cref="IndexGenerator"/> to use for the new instance.</param>
 protected RegistryBase(IndexGenerator indexGenerator)
   : this(indexGenerator, new Dictionary<uint, VirtualRegistryKey>())
 {
 }