//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 void OnDisabled() { try { foreach (var item in GameObject.FindObjectsOfType <EntryStatusPanel>()) { GameObject.DestroyImmediate(item?.gameObject); } LoadingManager.instance.m_introLoaded -= CacheUtil.CacheData; LoadingManager.instance.m_introLoaded -= LoadOrderUtil.TurnOffSteamPanels; LoadingManager.instance.m_introLoaded -= CheckPatchLoader; HarmonyUtil.UninstallHarmony(HARMONY_ID); MonoStatus.Release(); LOMAssetDataExtension.Release(); Settings.ConfigUtil.Terminate(); CheckSubsUtil.RemoveEvents(); Log.Buffered = false; } catch (Exception ex) { Log.Exception(ex); } }
public static void Make(ExtUITabstrip tabStrip) { UIHelper panelHelper = tabStrip.AddTabPage("Subscriptions"); UIButton button; UICheckBox checkBox; //g.AddButton("Perform All", OnPerformAllClicked); button = panelHelper.AddButton("Refresh workshop items (checks for bad items)", RequestItemDetails) as UIButton; button.tooltip = "checks for missing/partially downloaded/outdated items"; button = panelHelper.AddButton("unsubscribe from deprecated workshop items [EXPERIMENTAL] ", () => CheckSubsUtil.Instance.UnsubDepricated()) as UIButton; button.tooltip = "if steam does not return item path, i assume its deprecated."; button = panelHelper.AddButton("Resubscribe to all broken downloads (exits game) [EXPERIMENTAL]", CheckSubsUtil.ResubcribeExternally) as UIButton; button.tooltip = "less steam can hide problems. if you use less steam please click 'Refresh workshop items' to get all broken downloads"; button.isVisible = false; //hide for now. checkBox = panelHelper.AddCheckbox( "Delete unsubscribed items on startup", Config.DeleteUnsubscribedItemsOnLoad, val => { ConfigUtil.Config.DeleteUnsubscribedItemsOnLoad = val; ConfigUtil.SaveConfig(); }) as UICheckBox; button = panelHelper.AddButton("Delete Now", () => CheckSubsUtil.Instance.DeleteUnsubbed()) as UIButton; Settings.Pairup(checkBox, button); { var g = panelHelper.AddGroup("Broken downloads") as UIHelper; tfSteamPath_ = g.AddTextfield( text: "Steam Path: ", defaultContent: ConfigUtil.Config.SteamPath ?? "", eventChangedCallback: _ => { }, eventSubmittedCallback : delegate(string text) { if (CheckSteamPath(text)) { ConfigUtil.Config.SteamPath = text; ConfigUtil.SaveConfig(); } }) as UITextField; tfSteamPath_.width = 650; tfSteamPath_.tooltip = "Path to steam.exe"; g.AddButton("Redownload broken downloads [EXPERIMENTAL]", delegate() { try { var path = tfSteamPath_.text; if (CheckSteamPath(path)) { CheckSubsUtil.ReDownload(path); Prompt.Warning("Exit", "Please exit to desktop, wait for steam download to finish, and then start Cities skylines again.\n" + "Should this not work the first time, please try again."); } } catch (Exception ex) { ex.Log(); } }); } //b = g.AddButton("delete duplicates", OnPerformAllClicked) as UIButton; //b.tooltip = "when excluded mod is updated, and included duplicate of it is created"; }
static void OnPerformAllClicked() { Log.Debug("Perform all pressed"); CheckSubsUtil.EnsureAll(); SteamUtilities.DeleteUnsubbed(); }