public override void OnGameInitializationFinished(Game game) { base.OnGameInitializationFinished(game); log.Initialize(); if (Campaign.Current == null) { return; } string[] modNames = Campaign.Current.SandBoxManager.ModuleManager.ModuleNames; if (!ATCSettings.Instance.EnableModScan) { localATConfigs = Directory.GetFiles(modATCPath, "*ATC.modconfig.xml", SearchOption.AllDirectories); if (localATConfigs.Length != 0) { foreach (string file in localATConfigs) { ATCconfig.Instance.LoadXML(file); mergeConfigs = true; } } else { log.Add("ERROR: Mod Scan disabled and no *ATC.modconfig.xml found in /AdonnaysTroopChanger/Config!"); log.Add("ERROR: Either allow ATC to scan for mods in Mod Options -> Enable Mod Scan (recommended for beginners!) or create your own ATC.modconfig.xml (recommended for advanced users)."); log.Add("FATAL ERROR: ATC Disabled!"); disableATC = true; } } else { foreach (string modName in modNames) { string modPath = String.Concat(modulePath, modName, "/"); foreignConfigs = Directory.GetFiles(modPath, "*ATC.modconfig.xml", SearchOption.AllDirectories); foreach (string file in foreignConfigs) { ATCconfig.Instance.LoadXML(file); mergeConfigs = true; } } if (!mergeConfigs) { log.Add("ERROR: Mod Scan enabled but no *ATC.modconfig.xml found in any of the /Modules subfolders!"); log.Add("ERROR: Please check if your troop mods are ATC 1.2.x compatible or create your own *ATC.modconfig.xml."); log.Add("ERROR: Workaround: If the troop mod came with an 1.1.x ATC.config.xml, just rename that to ATC.modconfig.xml."); log.Add("FATAL ERROR: ATC Disabled!"); disableATC = true; } } if (SubModule.disableATC) { return; } ATCconfig.ValidateTroops(); if (mergeConfigs) { ATCconfig.Instance.SaveMergedXML(mergedFile); } }