public static void Initialize() { if (GameVersion != null) { Debug.Log("olmod Initialize called but is already initialized!"); return; } GameVersion = typeof(Overload.GameManager).Assembly.GetName().Version; Debug.Log("Initializing " + Version + ", game " + GameVersion); Debug.Log("Command line " + String.Join(" ", Environment.GetCommandLineArgs())); Config.Init(); MPInternet.CheckInternetServer(); HarmonyInstance.DEBUG = FindArg("-harmonydebug"); var harmony = HarmonyInstance.Create("olmod.olmod"); try { harmony.PatchAll(Assembly.GetExecutingAssembly()); } catch (Exception ex) { Debug.Log(ex.ToString()); } Debug.Log("Done initializing " + Version); if (Config.OLModDir != null && Config.OLModDir != "") { try { foreach (var f in Directory.GetFiles(Config.OLModDir, "Mod-*.dll")) { Debug.Log("Loading mod " + f); var asm = Assembly.LoadFile(f); try { harmony.PatchAll(asm); } catch (Exception ex) { Debug.Log("Running mod " + f + ": " + ex.ToString()); } } } catch (Exception ex) { Debug.Log(ex); } } }
public static void Initialize() { if (GameVersion != null) { Debug.Log("olmod Initialize called but is already initialized!"); return; } Modded = FindArg("-modded"); VREnabled = FindArgVal("-vrmode", out var vrmode) && vrmode != "none"; GameVersion = typeof(GameManager).Assembly.GetName().Version; Debug.Log("Initializing " + OlmodVersion.FullVersionString + ", game " + GameVersion); Debug.Log("Command line " + String.Join(" ", Environment.GetCommandLineArgs())); Config.Init(); MPInternet.CheckInternetServer(); Harmony.DEBUG = FindArg("-harmonydebug"); var harmony = new Harmony("olmod.olmod"); try { harmony.PatchAll(Assembly.GetExecutingAssembly()); } catch (Exception ex) { Debug.Log(ex.ToString()); } Debug.Log("Done initializing " + OlmodVersion.FullVersionString); if (Modded && Config.OLModDir != null && Config.OLModDir != "") { Modded = false; // Modded mode was on, we turn it off here because we don't want to have it on if there aren't actually any mods. try { var files = Directory.GetFiles(Config.OLModDir, "Mod-*.dll"); ModsLoaded = string.Join(",", files); foreach (var f in files) { Debug.Log("Loading mod " + f); var asm = Assembly.LoadFile(f); try { harmony.PatchAll(asm); Modded = true; // At this point we're sure we're modded, so set to true. } catch (Exception ex) { Debug.Log("Running mod " + f + ": " + ex.ToString()); } } } catch (Exception ex) { Debug.Log(ex); } } if (Modded) { OlmodVersion.Modded = true; // Only display modded tag if you're playing modded. } }