public static string[] GetModList() { if (modList == null) { if (BattleTechGame == null) { throw new InvalidOperationException("Mod List is not known until GameStartsOnce."); } modList = new HashSet <string>(); try { foreach (MethodBase method in PatchProcessor.AllPatchedMethods()) { modList.UnionWith(PatchProcessor.GetPatchInfo(method).Owners); } // Some mods may not leave a harmony trace and can only be parsed from log Regex regx = new Regex(" in type \"([^\"]+)\"", RegexOptions.Compiled); foreach (string line in File.ReadAllLines("Mods/BTModLoader.log")) { Match match = regx.Match(line); if (match.Success) { modList.Add(match.Groups[1].Value); } } } catch (Exception ex) { BattleMod.BTML_LOG.Error(ex); } } return(modList.ToArray()); }