public static void Load() { try { Log.Info("LifeCycle.Load() called"); Log.Info("testing stack trace:\n" + Environment.StackTrace, false); NetworkExtensionManager.Instance.OnLoad(); Log.Info($"Scene={Scene} LoadMode={Mode}"); if (Scene != "AssetEditor") { Log.Info("Applying in game patches"); HarmonyUtil.InstallHarmony <InGamePatchAttribute>(HARMONY_ID); } else { Log.Info("Applying all patches"); HarmonyUtil.InstallHarmony(HARMONY_ID, forbidden: typeof(PreloadPatchAttribute)); HintBox.Create(); } NetInfoExtionsion.Ensure_EditedNetInfos(); ObserverDisposable = GeometryManager.Instance.Subscribe(new ARTMPEObsever()); ARTool.Create(); Log.Info("LifeCycle.Load() successfull!"); Log.Flush(); } catch (Exception ex) { Log.Exception(ex); throw ex; } }
public static void Enable() { try { Log.Debug("Testing StackTrace:\n" + new StackTrace(true).ToString(), copyToGameLog: false); KianCommons.UI.TextureUtil.EmbededResources = false; HelpersExtensions.VERBOSE = false; Loaded = false; Log.Buffered = true; HarmonyHelper.EnsureHarmonyInstalled(); //LoadingManager.instance.m_simulationDataReady += SimulationDataReady; // load/update data LoadingManager.instance.m_levelPreLoaded += Preload; if (LoadingManager.instance.m_loadingComplete) { HotReload(); } #if FAST_TEST_HARMONY HarmonyHelper.DoOnHarmonyReady(() => { HarmonyUtil.InstallHarmony(HARMONY_ID); Process.GetCurrentProcess().Kill(); }); #endif Test(); } catch (Exception ex) { Log.Exception(ex); } }
public static void SimulationDataReady() { Log.Info($"LifeCycle.SimulationDataReady() called. mode={Mode} updateMode={UpdateMode}, scene={Scene}"); System.Threading.Thread.Sleep(1000 * 50); //50 sec Log.Info($"LifeCycle.SimulationDataReady() after sleep"); if (Scene == "ThemeEditor") { return; } CSURUtil.Init(); if (Settings.GameConfig == null) { switch (Mode) { case LoadMode.NewGameFromScenario: case LoadMode.LoadScenario: case LoadMode.LoadMap: // no NC or old NC Settings.GameConfig = GameConfigT.LoadGameDefault; break; default: Settings.GameConfig = GameConfigT.NewGameDefault; break; } } HarmonyUtil.InstallHarmony(HARMONY_ID); // game config is checked in patch. NodeManager.Instance.OnLoad(); SegmentEndManager.Instance.OnLoad(); Loaded = true; Log.Info("LifeCycle.SimulationDataReady() sucessful"); }
public void OnEnabled() { System.IO.File.WriteAllText("mod.debug.log", ""); // restart log. HarmonyHelper.DoOnHarmonyReady(() => HarmonyUtil.InstallHarmony(HarmonyId)); if (HelpersExtensions.InGame) { LifeCycle.Load(); } }
// first thing that happens when start game/editor from main menue or load another game. public static void PreLoad() { try { LogCalled(); HarmonyUtil.InstallHarmony(HarmonyId); // if not installed already. } catch (Exception e) { Log.Exception(e); } }
//static LoadOrderMod() => Log.Debug("Static Ctor " + Environment.StackTrace); //public LoadOrderMod() => Log.Debug("Instance Ctor " + Environment.StackTrace); public void OnEnabled() { try { Log.Called(); Util.LoadOrderUtil.ApplyGameLoggingImprovements(); var args = Environment.GetCommandLineArgs(); Log.Info("command line args are: " + string.Join(" ", args)); Log.ShowGap = true; #if DEBUG Log.Buffered = true; #else Log.Buffered = true; #endif //Log.Debug("Testing StackTrace:\n" + new StackTrace(true).ToString(), copyToGameLog: true); //KianCommons.UI.TextureUtil.EmbededResources = false; //HelpersExtensions.VERBOSE = false; //foreach(var p in ColossalFramework.Plugins.PluginManager.instance.GetPluginsInfo()) { // string savedKey = p.name + p.modPath.GetHashCode().ToString() + ".enabled"; // Log.Debug($"plugin info: savedKey={savedKey} cachedName={p.name} modPath={p.modPath}"); //} CheckPatchLoader(); HarmonyHelper.DoOnHarmonyReady(() => { //HarmonyLib.Harmony.DEBUG = true; HarmonyUtil.InstallHarmony(HARMONY_ID, null, null); // continue on error. }); SceneManager.sceneLoaded += OnSceneLoaded; SceneManager.activeSceneChanged += OnActiveSceneChanged; LoadingManager.instance.m_introLoaded += LoadOrderUtil.TurnOffSteamPanels; LoadingManager.instance.m_introLoaded += CheckPatchLoader; LoadOrderUtil.TurnOffSteamPanels(); bool introLoaded = ContentManagerUtil.IsIntroLoaded; if (introLoaded) { CacheUtil.CacheData(); } else { LoadingManager.instance.m_introLoaded += CacheUtil.CacheData; } if (!Settings.ConfigUtil.Config.IgnoranceIsBliss) { CheckSubsUtil.RegisterEvents(); } Log.Flush(); } catch (Exception ex) { Log.Exception(ex); } }
public static void Preload() { try { Log.Info("LifeCycle.Preload() called"); PluginUtil.LogPlugins(); if (!preloadPatchesApplied_) { HarmonyUtil.InstallHarmony <PreloadPatchAttribute>(HARMONY_ID_MANUAL); preloadPatchesApplied_ = true; } } catch (Exception ex) { Log.Exception(ex); } }
public static void Enable() { Log.Debug("Testing StackTrace:\n" + new StackTrace(true).ToString(), copyToGameLog: false); KianCommons.UI.TextureUtil.EmbededResources = false; HelpersExtensions.VERBOSE = false; Loaded = false; HarmonyHelper.EnsureHarmonyInstalled(); LoadingManager.instance.m_simulationDataReady += SimulationDataReady; // load/update data if (HelpersExtensions.InGameOrEditor) { HotReload(); } if (fastTestHarmony) { HarmonyUtil.InstallHarmony(HARMONY_ID); } }
public void OnEnabled() { HarmonyHelper.EnsureHarmonyInstalled(); HarmonyHelper.DoOnHarmonyReady(() => HarmonyUtil.InstallHarmony(HARMONY_ID)); }
public override void OnCreated(ILoading loading) => HarmonyUtil.InstallHarmony(HARMONY_ID);
public static void InstallHarmony() => HarmonyUtil.InstallHarmony(HARMONY_ID);