Пример #1
0
 /// <summary>
 /// Construtor Padrão
 /// </summary>
 /// <param name="registryLoader"></param>
 public Registry2(IRegistryLoader2 registryLoader)
 {
     registryLoader.Require("registryLoader").NotNull();
     _registryLoader = registryLoader;
     _root           = new RegistryFolder2();
     PopulateRoot();
 }
Пример #2
0
 /// <summary>
 /// Popula a lista
 /// </summary>
 private void PopulateRoot()
 {
     foreach (var entry in _registryLoader.GetRoot())
     {
         RegistryFolder2 currentFolder = _root;
         var             entries       = entry.Path.Split('\\').ToArray();
         for (int i = 0; i < entries.Count() - 1; i++)
         {
             var child = currentFolder.Children.Where(f => StringComparer.OrdinalIgnoreCase.Equals(entries[i], f.Name)).FirstOrDefault();
             if (child == null)
             {
                 child = new RegistryFolder2()
                 {
                     Name = entries[i]
                 };
                 currentFolder.Children.Add(child);
             }
             if (child is RegistryFolder2)
             {
                 currentFolder = child as RegistryFolder2;
             }
         }
         currentFolder.Entries.Add(entry);
     }
 }