Exemple #1
0
 /// <summary>
 /// Construtor Padrão
 /// </summary>
 /// <param name="registryLoader"></param>
 public Registry(IRegistryLoader registryLoader)
 {
     registryLoader.Require("registryLoader").NotNull();
     _registryLoader = registryLoader;
     _root           = new RegistryFolder();
     PopulateRoot();
 }
Exemple #2
0
 /// <summary>
 /// Popula a lista
 /// </summary>
 private void PopulateRoot()
 {
     foreach (var entry in _registryLoader.GetRoot())
     {
         RegistryFolder 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 RegistryFolder()
                 {
                     Name = entries[i]
                 };
                 currentFolder.Children.Add(child);
             }
             currentFolder = child;
         }
         currentFolder.Entries.Add(entry);
     }
 }