static Modules() { Directory = Path.Combine(Paths.BinaryRootPath, "Modules"); _moduleImplementationDescriptors = Assembly.GetExecutingAssembly().GetAttributedTypes(typeof(TypeOfModuleAttribute)).ToDictionary( x => Activator.CreateInstance(x) as ModuleImplementation, x => new HashSet <IModuleDescriptor>()); ModuleImplementation[] moduleImplementations = _moduleImplementationDescriptors.Keys.ToArray(); ModuleManagement = new ModuleManagement(moduleImplementations); ModuleRepository = new ModuleRepository(moduleImplementations); }
private bool TryAddModulePath(ModuleCreationOptions mco) { var filePath = mco.FilePath ?? mco.Uri?.ToAbsolutePath(); if (filePath == null) { throw new InvalidOperationException("Can't create document with no file path or URI specified"); } if (!ModuleManagement.TryAddModulePath(filePath, 0, true, out var fullName)) { return(false); } mco.FilePath = filePath; mco.ModuleName = fullName; return(true); }