/// <summary> /// Adds all the modules in <param name="moduleRepository"/> to this module with content /// </summary> /// <remarks> /// When existing modules are added, specs are appended to the existing collection of specs /// </remarks> public ModuleRepository AddAll(ModuleRepository moduleRepository) { foreach (var key in moduleRepository.m_backingDictionary.Keys) { m_backingDictionary.Add(key, moduleRepository.m_backingDictionary[key].ToArray()); } return(this); }
/// <nodoc/> public ModuleRepositoryFileSystem(PathTable pathTable, params ModuleRepository[] moduleRepositoryArray) { Contract.Requires(moduleRepositoryArray.Length > 0); Contract.Requires(moduleRepositoryArray.Select(repo => repo.RootDir).Distinct().Count() == 1, "All repositories must have the same root dir"); // Traverse the sequence var aggregatedContent = moduleRepositoryArray.Aggregate( seed: new ModuleRepository(pathTable, moduleRepositoryArray.First().RootDir), func: (acum, modulesWithContent) => acum.AddAll(modulesWithContent)); m_moduleRepository = aggregatedContent; m_pathTable = pathTable; }
/// <summary> /// Creates a new instance of a module repository by copying the content from <param name="moduleRepository"/> /// </summary> public ModuleRepository(ModuleRepository moduleRepository) { PathTable = moduleRepository.PathTable; RootDir = moduleRepository.RootDir; m_backingDictionary = new MultiValueDictionary <ModuleDescriptor, NameContentPair>(moduleRepository.m_backingDictionary); }