Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of LCModSyncBeta v0.2.1
plugins/LCModSync.dll
Decompiled 2 years agousing System; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.IO; using System.IO.Compression; using System.Linq; using System.Net; using System.Net.Http; using System.Net.Http.Headers; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Text; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Logging; using HarmonyLib; using LCModSync.MYGUI; using LCModSync.Patches; using Mono.Cecil; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using Steamworks; using Steamworks.Data; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("LCModSync")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("LCModSync")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("ed995f42-e9cc-49fd-9e45-78ba6baf9a7e")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace LCModSync { [BepInPlugin("Poseidon.ModSync", "Lethal Company ModSync", "0.2.1")] public class ModSyncPlugin : BaseUnityPlugin { private const string modGUID = "Poseidon.ModSync"; private const string modName = "Lethal Company ModSync"; private const string modVersion = "0.2.1"; private readonly Harmony harmony = new Harmony("Poseidon.ModSync"); internal static ManualLogSource mls; internal static List<string> modCreators; internal static List<string> modNames; internal static List<string> modGUIDs; public static ModSyncPlugin Instance; private GameObject scriptManager; private static HttpClient client = new HttpClient(); private static string zipPath; private static string outputPath; internal string currentModName; internal string currentModCreator; internal bool currentModDownloaded; internal static List<string> currentModCreators; internal static List<string> currentModNames; internal string currentModURL; internal int downloadProgress; public EventHandler eventDownloadComplete; internal ConfirmDownloadGUI myGUI; internal GameObject currentGUIObject; internal bool guiMenuOpen; internal static List<string> whiteListedPluginName = new List<string> { "LC_API", "Lethal_Company_Enhancer", "HotbarPlus", "FasterItemDropship", "SpectateEnemies", "MoreCompany", "anormaltwig", "MikesTweaks", "Brutal_Company" }; internal static List<string> whiteListedPluginCreator = new List<string> { "2018", "Mom_Llama", "FlipMods", "FlipMods", "AllToasters", "notnotnotswipez", "anormaltwig", "MikeMediaStudios", "2018" }; internal static List<string> whiteListedPluginGUID = new List<string> { "LC_API", "mom.llama.enhancer", "FlipMods.HotbarPlus", "FlipMods.FasterItemDropship", "SpectateEnemy", "me.swipez.melonloader.morecompany", "twig.latecompany", "MikesTweaks", "BrutalCompany" }; public string ScriptDirectory => Path.Combine(Paths.BepInExRootPath, "scripts"); private void Awake() { ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; if ((Object)(object)Instance == (Object)null) { Instance = this; } mls = Logger.CreateLogSource("Poseidon.ModSync"); mls.LogInfo((object)"Loaded Lethal Company ModSync, patching."); harmony.PatchAll(typeof(GameNetworkManagerPatch)); harmony.PatchAll(typeof(LobbySlotPatch)); Directory.CreateDirectory(".\\BepInEx\\scripts"); Directory.CreateDirectory(".\\BepInEx\\downloads"); modCreators = new List<string>(); modNames = new List<string>(); } internal static void getPlugins() { mls.LogInfo((object)"Checking for plugins"); foreach (KeyValuePair<string, PluginInfo> pluginInfo in Chainloader.PluginInfos) { try { ((Component)pluginInfo.Value.Instance).BroadcastMessage("sendModInfo", (object)null, (SendMessageOptions)1); } catch (Exception) { modGUIDs.Add(pluginInfo.Value.Metadata.GUID); mls.LogInfo((object)("Failed to gather details about " + pluginInfo.Value.Metadata.Name + ". Skipping.")); } } } private static string getModURLFromRequest(string inputData) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) string text = Extensions.Value<string>((IEnumerable<JToken>)((JObject)JsonConvert.DeserializeObject(inputData))["latest"][(object)"download_url"]); mls.LogInfo((object)("URL pulled via JSON: " + text)); return text; } public static string RemoveSpecialCharacters(string str) { return Regex.Replace(str, "[^a-zA-Z0-9_.-]+", string.Empty, RegexOptions.Compiled); } internal void promptDownloadMods(List<string> modCreator, List<string> modName) { currentModNames = modName; currentModCreators = modCreator; for (int i = 0; i < modCreator.Count; i++) { modCreator[i] = RemoveSpecialCharacters(modCreator[i]); modName[i] = RemoveSpecialCharacters(modName[i]); } mls.LogInfo((object)"About to call downloadindividualmods"); downloadIndividualMod(modCreator[0], modName[0]); } internal void downloadIndividualMod(string firstModCreator, string firstModName) { //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Expected O, but got Unknown //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown if ((Object)(object)myGUI == (Object)null) { currentGUIObject = new GameObject("DownloadPrompt"); Object.DontDestroyOnLoad((Object)(object)currentGUIObject); ((Object)currentGUIObject).hideFlags = (HideFlags)61; currentGUIObject.AddComponent<ConfirmDownloadGUI>(); myGUI = (ConfirmDownloadGUI)(object)currentGUIObject.GetComponent("DownloadPrompt"); } else { Object.Destroy((Object)(object)currentGUIObject.gameObject); currentGUIObject = new GameObject("DownloadPrompt"); Object.DontDestroyOnLoad((Object)(object)currentGUIObject); ((Object)currentGUIObject).hideFlags = (HideFlags)61; currentGUIObject.AddComponent<ConfirmDownloadGUI>(); myGUI = (ConfirmDownloadGUI)(object)currentGUIObject.GetComponent("DownloadPrompt"); } mls.LogInfo((object)"called downloadindividual mods"); Instance.currentModCreator = firstModCreator; Instance.currentModName = firstModName; string modInfoFromStore = getModInfoFromStore(firstModCreator + "/" + firstModName + "/"); currentModURL = getModURLFromRequest(modInfoFromStore); if (currentModURL != string.Empty) { Uri uri = new Uri(currentModURL); if (uri.Host == "www.thunderstore.io" || uri.Host == "https://thunderstore.io" || uri.Host == "thunderstore.io") { mls.LogInfo((object)"It was a thunderstore link so time to download >:)"); mls.LogInfo((object)"about to open up that sexc gui"); myGUI.isMenuOpen = true; guiMenuOpen = true; } else { mls.LogInfo((object)"ignoring and moving to next mod, bad URL"); myGUI.isMenuOpen = false; guiMenuOpen = false; } } } internal static void downloadFromURLAfterConfirmation(string modURL, string modName, bool shouldDownload) { if (shouldDownload) { using WebClient webClient = new WebClient(); webClient.DownloadFileCompleted += onDownloadComplete; webClient.DownloadProgressChanged += onDownloadProgressChange; webClient.DownloadFileAsync(new Uri(modURL), ".\\Bepinex\\downloads\\" + modName + ".zip"); } zipPath = Path.GetFullPath(".\\Bepinex\\downloads\\" + modName + ".zip"); outputPath = Path.GetFullPath(".\\Bepinex\\scripts\\"); string text = outputPath; char directorySeparatorChar = Path.DirectorySeparatorChar; if (!text.EndsWith(directorySeparatorChar.ToString(), StringComparison.Ordinal)) { string text2 = outputPath; directorySeparatorChar = Path.DirectorySeparatorChar; outputPath = text2 + directorySeparatorChar; } if (!shouldDownload) { Instance.downloadProgress = 0; extractCurrentMod(); } } private static void onDownloadProgressChange(object sender, DownloadProgressChangedEventArgs e) { Instance.downloadProgress = e.ProgressPercentage; } private static void onDownloadComplete(object sender, AsyncCompletedEventArgs e) { Instance.downloadProgress = 0; extractCurrentMod(); } private static void extractCurrentMod() { try { Directory.CreateDirectory(".\\BepInEx\\scripts"); Directory.CreateDirectory(".\\BepInEx\\downloads"); using ZipArchive zipArchive = ZipFile.OpenRead(zipPath); foreach (ZipArchiveEntry entry in zipArchive.Entries) { if (entry.FullName.EndsWith(".dll", StringComparison.OrdinalIgnoreCase)) { mls.LogInfo((object)entry.FullName); if (outputPath.StartsWith(outputPath, StringComparison.Ordinal)) { entry.ExtractToFile(outputPath + entry.Name); } mls.LogInfo((object)"trying to extract buckaroo"); } } } catch (Exception ex) { mls.LogInfo((object)("Extraction failed: " + ex.Message)); mls.LogInfo((object)"Cleaning up and moving to next mod"); } try { File.Delete(zipPath); } catch { mls.LogInfo((object)"already gone or handle exists"); } currentModCreators.RemoveAt(0); currentModNames.RemoveAt(0); Object.Destroy((Object)(object)Instance.currentGUIObject.gameObject); mls.LogInfo((object)$"finished downloading mod, about to cleanup to progress. You have {currentModNames.Count} mods left to download"); if (currentModCreators.Count <= 0) { LobbySlotPatch.finishLoadingIntoLobby(); } else { Instance.downloadIndividualMod(currentModCreators[0], currentModNames[0]); } } internal static void storeModInfo(string modURL, string modName) { try { if (!modCreators.Contains(modURL)) { modNames.Add(modName); modCreators.Add(modURL); } } catch { mls.LogInfo((object)"getModInfo failed"); } } public void getModInfo(List<string> modInfo) { mls.LogInfo((object)("We have received " + modInfo[1])); storeModInfo(modInfo[0], modInfo[1]); } private IEnumerable<Type> GetTypesSafe(Assembly ass) { try { return ass.GetTypes(); } catch (ReflectionTypeLoadException ex) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine("\r\n-- LoaderExceptions --"); Exception[] loaderExceptions = ex.LoaderExceptions; foreach (Exception ex2 in loaderExceptions) { stringBuilder.AppendLine(ex2.ToString()); } stringBuilder.AppendLine("\r\n-- StackTrace --"); stringBuilder.AppendLine(ex.StackTrace); ((BaseUnityPlugin)this).Logger.LogError((object)stringBuilder.ToString()); return ex.Types.Where((Type x) => x != null); } } private IEnumerator DelayAction(Action action) { yield return null; action(); } internal void ReloadPlugins() { //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Expected O, but got Unknown if ((Object)(object)scriptManager != (Object)null) { BaseUnityPlugin[] components = scriptManager.GetComponents<BaseUnityPlugin>(); for (int i = 0; i < components.Length; i++) { string gUID = components[i].Info.Metadata.GUID; if (Chainloader.PluginInfos.ContainsKey(gUID)) { Chainloader.PluginInfos.Remove(gUID); } } Object.Destroy((Object)(object)scriptManager); } scriptManager = new GameObject($"ScriptEngine_{DateTime.Now.Ticks}"); Object.DontDestroyOnLoad((Object)(object)scriptManager); if (Directory.GetFiles(ScriptDirectory, "*.dll", SearchOption.AllDirectories).Length != 0) { string[] files = Directory.GetFiles(ScriptDirectory, "*.dll", SearchOption.AllDirectories); foreach (string path in files) { LoadDLL(path, scriptManager); } } } private void LoadDLL(string path, GameObject obj) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Expected O, but got Unknown DefaultAssemblyResolver val = new DefaultAssemblyResolver(); ((BaseAssemblyResolver)val).AddSearchDirectory(ScriptDirectory); ((BaseAssemblyResolver)val).AddSearchDirectory(Paths.ManagedPath); ((BaseAssemblyResolver)val).AddSearchDirectory(Paths.BepInExAssemblyDirectory); AssemblyDefinition val2 = AssemblyDefinition.ReadAssembly(path, new ReaderParameters { AssemblyResolver = (IAssemblyResolver)(object)val }); try { using MemoryStream memoryStream = new MemoryStream(); val2.Write((Stream)memoryStream); Assembly ass = Assembly.Load(memoryStream.ToArray()); foreach (Type type in GetTypesSafe(ass)) { try { if (!typeof(BaseUnityPlugin).IsAssignableFrom(type)) { continue; } BepInPlugin metadata = MetadataHelper.GetMetadata(type); if (metadata == null) { continue; } if (Chainloader.PluginInfos.TryGetValue(metadata.GUID, out var value)) { throw new InvalidOperationException($"A plugin with GUID {metadata.GUID} is already loaded! ({value.Metadata.Name} v{value.Metadata.Version})"); } TypeDefinition val3 = ((IEnumerable<TypeDefinition>)val2.MainModule.Types).First((TypeDefinition x) => ((MemberReference)x).FullName == type.FullName); PluginInfo pluginInfo = Chainloader.ToPluginInfo(val3); ((MonoBehaviour)this).StartCoroutine(DelayAction(delegate { //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown try { Chainloader.PluginInfos[metadata.GUID] = pluginInfo; Component val4 = obj.AddComponent(type); Traverse obj2 = Traverse.Create((object)pluginInfo); obj2.Property<BaseUnityPlugin>("Instance", (object[])null).Value = (BaseUnityPlugin)val4; obj2.Property<string>("Location", (object[])null).Value = path; } catch (Exception arg2) { ((BaseUnityPlugin)this).Logger.LogError((object)$"Failed to load plugin {metadata.GUID} because of exception: {arg2}"); Chainloader.PluginInfos.Remove(metadata.GUID); } })); } catch (Exception arg) { ((BaseUnityPlugin)this).Logger.LogError((object)$"Failed to load plugin {type.Name} because of exception: {arg}"); } } } finally { ((IDisposable)val2)?.Dispose(); } } private static string getModInfoFromStore(string packagename) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown client.DefaultRequestHeaders.Accept.Clear(); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); string text = "https://thunderstore.io/api/experimental/package/" + packagename; try { return client.GetAsync(text).Result.Content.ReadAsStringAsync().Result; } catch { return "exception occurred"; } } } } namespace LCModSync.Patches { [HarmonyPatch(typeof(LobbySlot))] internal class LobbySlotPatch { private static Lobby lobbyRef; public LobbySlotPatch Instance { get; private set; } [HarmonyPatch("OnLobbyDataRefresh")] [HarmonyPrefix] private static bool patchLobbyJoin(ref Lobby lobby, ref Coroutine ___timeOutLobbyRefreshCoroutine) { //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) if (___timeOutLobbyRefreshCoroutine != null) { ModSyncPlugin.mls.LogInfo((object)"timeout still existed, destroy it so we don't get kicked out"); ((MonoBehaviour)GameNetworkManager.Instance).StopCoroutine(___timeOutLobbyRefreshCoroutine); ___timeOutLobbyRefreshCoroutine = null; } if (!GameNetworkManager.Instance.waitingForLobbyDataRefresh) { ModSyncPlugin.mls.LogInfo((object)"prevent infinite load on fail"); return true; } GameNetworkManager.Instance.waitingForLobbyDataRefresh = false; SteamMatchmaking.OnLobbyDataChanged -= LobbySlot.OnLobbyDataRefresh; lobbyRef = lobby; ModSyncPlugin.mls.LogInfo((object)((Lobby)(ref lobby)).GetData("TestData")); string data = ((Lobby)(ref lobby)).GetData("modNames"); string data2 = ((Lobby)(ref lobby)).GetData("modCreators"); ((Lobby)(ref lobby)).GetData("modGUIDs"); List<string> list = new List<string>(); List<string> list2 = new List<string>(); List<string> list3 = new List<string>(); if (data != "") { list = data.Split(new char[1] { ' ' }).ToList(); list2 = data2.Split(new char[1] { ' ' }).ToList(); } if (list2.Count != list.Count) { ModSyncPlugin.mls.LogWarning((object)"Host has mods with improper formatting."); } List<string> list4 = new List<string>(); ModSyncPlugin.mls.LogInfo((object)"got currently installed plugins"); List<string> modNames = ModSyncPlugin.modNames; foreach (KeyValuePair<string, PluginInfo> pluginInfo in Chainloader.PluginInfos) { list4.Add(pluginInfo.Value.Metadata.GUID); } if (list.Count > 0) { ModSyncPlugin.mls.LogInfo((object)"checking for installed plugins via name"); foreach (string item in list) { if (modNames.Contains(item)) { ModSyncPlugin.mls.LogInfo((object)"removing mod from list to install via name"); int index = list.IndexOf(item); list.RemoveAt(index); list2.RemoveAt(index); } } } if (list3.Count > 0) { try { foreach (string item2 in list3) { ModSyncPlugin.mls.LogInfo((object)"checking for installed plugins via guid"); ModSyncPlugin.mls.LogInfo((object)("Current mod GUID: " + item2)); if (ModSyncPlugin.whiteListedPluginGUID.Contains(item2) && !list4.Contains(item2)) { ModSyncPlugin.mls.LogInfo((object)"adding mod that was on whitelist and not already installed"); int index2 = ModSyncPlugin.whiteListedPluginGUID.IndexOf(item2); list.Add(ModSyncPlugin.whiteListedPluginName[index2]); list2.Add(ModSyncPlugin.whiteListedPluginCreator[index2]); } } } catch (Exception ex) { ModSyncPlugin.mls.LogInfo((object)ex.Message); } } else { ModSyncPlugin.mls.LogInfo((object)"found no mods by GUID to add to list"); } ModSyncPlugin.mls.LogInfo((object)("Mod creators downloading from: " + string.Join(" ", list2))); ModSyncPlugin.mls.LogInfo((object)$"Amount of mods to download: {list2.Count}"); if (list2.Count > 0) { ModSyncPlugin.mls.LogInfo((object)"found at least 1 mod to touch"); ModSyncPlugin.Instance.currentModDownloaded = false; ModSyncPlugin.Instance.promptDownloadMods(list2, list); } else { ModSyncPlugin.mls.LogInfo((object)"Found NO mods to download"); finishLoadingIntoLobby(); } return false; } public static void finishLoadingIntoLobby() { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) ModSyncPlugin.Instance.ReloadPlugins(); if (GameNetworkManager.Instance.LobbyDataIsJoinable(lobbyRef)) { GameNetworkManager.Instance.JoinLobby(lobbyRef, ((Lobby)(ref lobbyRef)).Id); } } } [HarmonyPatch(typeof(GameNetworkManager))] internal class GameNetworkManagerPatch { [HarmonyPatch("SteamMatchmaking_OnLobbyCreated")] [HarmonyPrefix] public static void lobbyCreatedPatch(ref Result result, ref Lobby lobby) { ModSyncPlugin.getPlugins(); ModSyncPlugin.mls.LogInfo((object)"Lobby created"); ((Lobby)(ref lobby)).SetData("TestData", "BOOP"); ((Lobby)(ref lobby)).SetData("modNames", string.Join(" ", ModSyncPlugin.modNames)); ((Lobby)(ref lobby)).SetData("modCreators", string.Join(" ", ModSyncPlugin.modCreators)); ((Lobby)(ref lobby)).SetData("modGUIDs", string.Join(" ", ModSyncPlugin.modGUIDs)); } } } namespace LCModSync.MYGUI { internal class ConfirmDownloadGUI : MonoBehaviour { public bool isMenuOpen; private bool wasKeyDown; private int MENUWIDTH = 800; private int MENUHEIGHT = 400; private int MENUX; private int MENUY; private int ITEMWIDTH = 300; private int CENTERX; private GUIStyle menuStyle; private GUIStyle confirmButtonStyle; private GUIStyle declineButtonStyle; private GUIStyle labelStyle; private GUIStyle hScrollStyle; private void Awake() { ModSyncPlugin.mls.LogInfo((object)"Download Confirmation has arrived"); isMenuOpen = false; MENUWIDTH = Screen.width / 3; MENUHEIGHT = Screen.width / 4; ITEMWIDTH = MENUWIDTH / 2; MENUX = Screen.width / 2 - MENUWIDTH / 2; MENUY = Screen.height / 2 - MENUHEIGHT / 2; CENTERX = MENUX + (MENUWIDTH / 2 - ITEMWIDTH / 2); } private Texture2D MakeTex(int width, int height, Color col) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown Color[] array = (Color[])(object)new Color[width * height]; for (int i = 0; i < array.Length; i++) { array[i] = col; } Texture2D val = new Texture2D(width, height); val.SetPixels(array); val.Apply(); return val; } private void intitializeMenu() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Expected O, but got Unknown //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Expected O, but got Unknown //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Expected O, but got Unknown //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: Unknown result type (might be due to invalid IL or missing references) if (menuStyle == null) { menuStyle = new GUIStyle(GUI.skin.box); confirmButtonStyle = new GUIStyle(GUI.skin.button); declineButtonStyle = new GUIStyle(GUI.skin.button); labelStyle = new GUIStyle(GUI.skin.label); hScrollStyle = new GUIStyle(GUI.skin.horizontalSlider); menuStyle.normal.textColor = Color.white; menuStyle.normal.background = MakeTex(2, 2, new Color(0.01f, 0.01f, 0.1f, 0.9f)); menuStyle.fontSize = 18; ((Object)menuStyle.normal.background).hideFlags = (HideFlags)61; confirmButtonStyle.normal.textColor = Color.white; confirmButtonStyle.normal.background = MakeTex(2, 2, new Color(0.01f, 0.3f, 0.1f, 0.9f)); confirmButtonStyle.hover.background = MakeTex(2, 2, new Color(0.01f, 0.4f, 0.1f, 0.9f)); confirmButtonStyle.fontSize = 22; ((Object)confirmButtonStyle.normal.background).hideFlags = (HideFlags)61; declineButtonStyle.normal.textColor = Color.white; declineButtonStyle.normal.background = MakeTex(2, 2, new Color(0.3f, 0.01f, 0.1f, 0.9f)); declineButtonStyle.hover.background = MakeTex(2, 2, new Color(0.4f, 0.01f, 0.1f, 0.9f)); declineButtonStyle.fontSize = 22; ((Object)declineButtonStyle.normal.background).hideFlags = (HideFlags)61; labelStyle.normal.textColor = Color.white; labelStyle.normal.background = MakeTex(2, 2, new Color(0.01f, 0.01f, 0.1f, 0f)); labelStyle.fontSize = 24; labelStyle.alignment = (TextAnchor)4; ((Object)labelStyle.normal.background).hideFlags = (HideFlags)61; hScrollStyle.normal.textColor = Color.white; hScrollStyle.normal.background = MakeTex(2, 2, new Color(0f, 0f, 0.2f, 0.9f)); ((Object)hScrollStyle.normal.background).hideFlags = (HideFlags)61; } } public void OnGUI() { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) if (menuStyle == null) { intitializeMenu(); } GUI.Box(new Rect((float)MENUX, (float)MENUY, (float)MENUWIDTH, (float)MENUHEIGHT), "ModSync", menuStyle); GUI.Label(new Rect((float)CENTERX, (float)(MENUY + 100), (float)ITEMWIDTH, 80f), "Would you like to download " + ModSyncPlugin.Instance.currentModName + " by " + ModSyncPlugin.Instance.currentModCreator + "?", labelStyle); GUI.Label(new Rect((float)CENTERX, (float)(MENUY + 200), (float)ITEMWIDTH, 80f), $"{ModSyncPlugin.Instance.downloadProgress}%", labelStyle); if (GUI.Button(new Rect((float)MENUX + 0.25f * (float)MENUX - (float)ITEMWIDTH / 1.5f / 2f, (float)(MENUY + MENUHEIGHT - 150), (float)ITEMWIDTH / 1.5f, 50f), "Confirm Download", confirmButtonStyle)) { ModSyncPlugin.downloadFromURLAfterConfirmation(ModSyncPlugin.Instance.currentModURL, ModSyncPlugin.Instance.currentModName, shouldDownload: true); } if (GUI.Button(new Rect((float)MENUX + 0.75f * (float)MENUX - (float)ITEMWIDTH / 1.5f / 2f, (float)(MENUY + MENUHEIGHT - 150), (float)ITEMWIDTH / 1.5f, 50f), "Decline Download", declineButtonStyle)) { ModSyncPlugin.downloadFromURLAfterConfirmation(ModSyncPlugin.Instance.currentModURL, ModSyncPlugin.Instance.currentModName, shouldDownload: false); } _ = ModSyncPlugin.Instance.guiMenuOpen; } } }