ModuleContainer BuildModuleContainer(ModuleContainerBuilder builder, ModuleCollection modules, string topLevelDirectoryNameConvention) { if (modules.Count == 0) { // By convention, each subdirectory of topLevelDirectoryNameConvention is a module. builder.AddModuleForEachSubdirectoryOf(topLevelDirectoryNameConvention, ""); } else { AddModulesFromConfig(modules, builder); } return(builder.Build()); }
void AddModulesFromConfig(ModuleCollection moduleElements, ModuleContainerBuilder builder) { foreach (ModuleElement module in moduleElements) { // "foo/*" implies each sub-directory of "~/foo" is a module. if (module.Path.EndsWith("*")) { var path = module.Path.Substring(0, module.Path.Length - 2); builder.AddModuleForEachSubdirectoryOf(path, module.Location); } else // the given path is the module itself. { builder.AddModule(module.Path, module.Location); } } }
ModuleContainer BuildModuleContainer(ModuleContainerBuilder builder, ModuleCollection modules, string topLevelDirectoryNameConvention) { if (modules.Count == 0) { // By convention, each subdirectory of topLevelDirectoryNameConvention is a module. builder.AddModuleForEachSubdirectoryOf(topLevelDirectoryNameConvention, ""); } else { AddModulesFromConfig(modules, builder); } return builder.Build(); }