private static void AddModuleFromAssembly(FileInfo file, bool basicNode = false) { try { MyModuleConfig moduleConfig = MyModuleConfig.LoadModuleConfig(file); Modules.Add(moduleConfig); AssemblyLookup[moduleConfig.Assembly.FullName] = moduleConfig; if (moduleConfig.NodeConfigList != null) { foreach (MyNodeConfig nc in moduleConfig.NodeConfigList) { nc.IsBasicNode = basicNode; if (nc.NodeType != null) { KnownNodes[nc.NodeType] = nc; } } } if (moduleConfig.WorldConfigList != null) { foreach (MyWorldConfig wc in moduleConfig.WorldConfigList) { wc.IsBasicNode = basicNode; if (wc.NodeType != null) { KnownWorlds[wc.NodeType] = wc; } } } if (moduleConfig.CategoryList != null) { foreach (MyCategoryConfig categoryConfig in moduleConfig.CategoryList) { KnownCategories[categoryConfig.Name] = categoryConfig; } } MyLog.INFO.WriteLine("Module loaded: " + file.Name + (moduleConfig.Conversion != null ? " (version=" + moduleConfig.GetXmlVersion() + ")" : " (no versioning)")); } catch (Exception e) { if (basicNode) { throw new MyModuleLoadingException("Core module loading failed (" + e.Message + ")", e); } // We don't report the nodes.xml missing - the dll could still contain UI extensions. if (!(e is FileNotFoundException)) { MyLog.ERROR.WriteLine("Module loading failed: " + e.Message); } } }
private static void AddModuleFromAssembly(FileInfo file, bool basicNode = false) { try { MyModuleConfig moduleConfig = MyModuleConfig.LoadModuleConfig(file); Modules.Add(moduleConfig); AssemblyLookup[moduleConfig.Assembly] = moduleConfig; if (moduleConfig.NodeConfigList != null) { foreach (MyNodeConfig nc in moduleConfig.NodeConfigList) { nc.IsBasicNode = basicNode; if (nc.NodeType != null) { KnownNodes[nc.NodeType] = nc; } } } if (moduleConfig.WorldConfigList != null) { foreach (MyWorldConfig wc in moduleConfig.WorldConfigList) { wc.IsBasicNode = basicNode; if (wc.NodeType != null) { KnownWorlds[wc.NodeType] = wc; } } } MyLog.INFO.WriteLine("Module loaded: " + file.Name + (moduleConfig.Conversion != null ? " (version=" + moduleConfig.GetXmlVersion() + ")" : " (no versioning)")); } catch (Exception e) { MyLog.ERROR.WriteLine("Module loading failed: " + e.Message); if (basicNode) { throw new MyModuleLoadingException("Core module loading failed (" + e.Message + ")", e); } } }
private static void AddModuleFromAssembly(FileInfo file, bool basicNode = false) { try { MyModuleConfig moduleConfig = MyModuleConfig.LoadModuleConfig(file); Modules.Add(moduleConfig); AssemblyLookup[moduleConfig.Assembly.FullName] = moduleConfig; if (moduleConfig.NodeConfigList != null) { foreach (MyNodeConfig nc in moduleConfig.NodeConfigList) { nc.IsBasicNode = basicNode; if (nc.NodeType != null) { KnownNodes[nc.NodeType] = nc; } } } if (moduleConfig.WorldConfigList != null) { foreach (MyWorldConfig wc in moduleConfig.WorldConfigList) { wc.IsBasicNode = basicNode; if (wc.NodeType != null) { KnownWorlds[wc.NodeType] = wc; } } } if (moduleConfig.CategoryList != null) { foreach (MyCategoryConfig categoryConfig in moduleConfig.CategoryList) { KnownCategories[categoryConfig.Name] = categoryConfig; } } MyLog.INFO.WriteLine("Module loaded: " + file.Name + (moduleConfig.Conversion != null ? " (version=" + moduleConfig.GetXmlVersion() + ")" : " (no versioning)")); } catch (Exception e) { if (basicNode) { throw new MyModuleLoadingException("Core module loading failed (" + e.Message + ")", e); } if (e is ResourceNotFoundException) { // Missing nodes.xml is OK for UI extensions. if (!file.Name.EndsWith(".GUI.dll")) { MyLog.INFO.WriteLine($"Module {file.Name} skipped for now (may be loaded as UI module): " + e.Message); } } else { MyLog.ERROR.WriteLine($"Module {file.Name} loading failed: " + e.Message); } } }