Flood.Modules.ModuleManager.LoadModule C# (CSharp) Метод

LoadModule() публичный Метод

public LoadModule ( ModuleId moduleId ) : Assembly
moduleId ModuleId
Результат System.Reflection.Assembly
        public Assembly LoadModule(ModuleId moduleId)
        {
            if(serviceManager == null)
                throw new NullReferenceException("Init ModuleManager before loading any module");

            Assembly assembly;
            if (loadedModules.TryGetValue(moduleId, out assembly))
                return assembly;

            assembly = GetLoadedAssembly(moduleId);
            if (assembly == null)
            {
                var stream = ModuleLibrary.GetModuleStream(moduleId);
                assembly = Assembly.Load(stream.ReadAllBytes());
            }

            loadedModules.Add(moduleId, assembly);

            var module = CreateModuleObject(assembly);
            module.OnLoad(serviceManager);
            modules.Add(module);

            CheckGlobalServices(assembly);

            return assembly;
        }