public static void Bootstrap() { if (thisGameObject == null) { thisGameObject = new GameObject(); thisGameObject.name = "ImprovedWorkshopIntegration"; thisGameObject.AddComponent <ImprovedWorkshopIntegration>(); thisGameObject.transform.parent = ModTools.Instance.gameObject.transform; } improvedModsPanelExists = CheckForImprovedModsPanel(); if (!improvedModsPanelExists) { InitializeModSortDropDown(); } if (bootstrapped) { return; } var go = GameObject.Find("(Library) WorkshopModUploadPanel"); if (go == null) { return; } workshopModUploadPanel = go.GetComponent <WorkshopModUploadPanel>(); if (workshopModUploadPanel == null) { return; } var modsList = GameObject.Find("ModsList"); if (modsList == null) { return; } m_StagingPath = Util.FindField(workshopModUploadPanel, "m_StagingPath"); m_PreviewPath = Util.FindField(workshopModUploadPanel, "m_PreviewPath"); m_ContentPath = Util.FindField(workshopModUploadPanel, "m_ContentPath"); m_CurrentHandle = Util.FindField(workshopModUploadPanel, "m_CurrentHandle"); m_ShareButton = Util.FindField(workshopModUploadPanel, "m_ShareButton"); m_TargetFolder = Util.FindField(workshopModUploadPanel, "m_TargetFolder"); m_ShareButton = Util.FindField(workshopModUploadPanel, "m_ShareButton"); m_Title = Util.FindField(workshopModUploadPanel, "m_Title"); m_Desc = Util.FindField(workshopModUploadPanel, "m_Desc"); m_ChangeNote = Util.FindField(workshopModUploadPanel, "m_ChangeNote"); m_DefaultModPreviewTexture = Util.FindField(workshopModUploadPanel, "m_DefaultModPreviewTexture"); reloadPreviewImage = typeof(WorkshopModUploadPanel).GetMethod("ReloadPreviewImage", BindingFlags.Instance | BindingFlags.NonPublic); startWatchingPath = typeof(WorkshopModUploadPanel).GetMethod("StartWatchingPath", BindingFlags.Instance | BindingFlags.NonPublic); revertState = RedirectionHelper.RedirectCalls ( typeof(WorkshopModUploadPanel).GetMethod("SetAssetInternal", BindingFlags.Instance | BindingFlags.NonPublic), typeof(ImprovedWorkshopIntegration).GetMethod("SetAssetInternal", BindingFlags.Instance | BindingFlags.NonPublic) ); if (!improvedModsPanelExists) { modsPanelBootstrapped = true; revertState2 = RedirectionHelper.RedirectCalls ( typeof(PackageEntry).GetMethod("FormatPackageName", BindingFlags.Static | BindingFlags.NonPublic), typeof(ImprovedWorkshopIntegration).GetMethod("FormatPackageName", BindingFlags.Static | BindingFlags.NonPublic) ); revertState3 = RedirectionHelper.RedirectCalls ( typeof(CustomContentPanel).GetMethod("RefreshPlugins", BindingFlags.Instance | BindingFlags.NonPublic), typeof(ImprovedWorkshopIntegration).GetMethod("RefreshPlugins", BindingFlags.Static | BindingFlags.Public) ); } else { modsPanelBootstrapped = false; } bootstrapped = true; }