/// <summary> /// This is an helper method, it will provide a list with all unknown assemblies, it will filter /// any Game, Unity, System and Guu assemblies as all as any assembly loaded by Guu when loading /// mods and any assembly loaded by SRML if SRML is present. /// /// NOTE THAT in terms of SRML false positives might appear, some assemblies get loaded that are /// not considered mods, this means they will still appear on this list. /// /// However most results will, most likely be, UMF Mods or some other kind. /// /// The file can be found in the root of the game's folder /// </summary> public static void GetAllUnknownAssemblies() { HashSet <string> ignoreList = new HashSet <string> { "0Harmony", "INIFileParser", "Newtonsoft.Json", "discord-rpc", "InControlNative", "steam_api64", "XInputInterface64", "DOTween", "InControl", "InControl.Examples", "Logger", "mscorlib", "SRML", "SRML.Editor", "System", "UnityEngine", "HarmonySharedState", "uModFramework", "PluginManager.Core", "BouncyCastle.Crypto", "Ionic.Zip.Unity" }; FileInfo dump = new FileInfo(Path.Combine(Application.dataPath, "../unknownAssemblies.txt")); using (StreamWriter writer = dump.CreateText()) { foreach (Assembly assembly in AppDomain.CurrentDomain.GetAssemblies()) { string name = assembly.GetName().Name; if (name.StartsWith("Assembly-") || name.StartsWith("System.") || name.StartsWith("Unity.") || name.StartsWith("UnityEngine.") || name.StartsWith("Guu.") || name.StartsWith("Mono.") || name.StartsWith("uModFramework.") || name.StartsWith("Eden.") || name.StartsWith("EdenUnity.")) { continue; } if (MOD_CONTEXTS.ContainsKey(assembly)) { continue; } if (GuuCore.ADDON_ASSEMBLIES.Contains(assembly)) { continue; } if (ignoreList.Contains(name)) { continue; } if (IsSRMLAssembly(assembly)) { continue; } writer.WriteLine(name); } writer.Flush(); } }
/// <summary>Gets the mod context for the given type (searching from it's assembly). Or null if none if found</summary> public static ModContext GetModContext(Type typeForContext) => MOD_CONTEXTS.ContainsKey(typeForContext.Assembly) ? MOD_CONTEXTS[typeForContext.Assembly] : null;
/// <summary>Gets the mod context for the given mod assembly. Or null if none if found</summary> public static ModContext GetModContext(Assembly modAssembly) => MOD_CONTEXTS.ContainsKey(modAssembly) ? MOD_CONTEXTS[modAssembly] : null;