Decompiled source of LethalModManager v0.1.6
LethalModManager.dll
Decompiled 8 months ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.CodeDom.Compiler; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; using System.Diagnostics; using System.Globalization; using System.IO; using System.IO.Compression; using System.Linq; using System.Net; using System.Net.Http; using System.Reflection; using System.Reflection.Emit; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using Newtonsoft.Json; using Steamworks; using Steamworks.Data; using TMPro; using UnityEngine; using UnityEngine.Events; using UnityEngine.Networking; using UnityEngine.Rendering; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("LethalModManager")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+d0e680e28ecd8bba0834b1100bf96a5649243635")] [assembly: AssemblyProduct("LethalModManager")] [assembly: AssemblyTitle("LethalModManager")] [assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/Kyxino/LethalModManager")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace LethalModManager { [JsonConverter(typeof(ModInfo))] internal class ModInfoConverter : JsonConverter<ModInfo> { public override bool CanRead => true; public override bool CanWrite => true; public override void WriteJson(JsonWriter writer, ModInfo value, JsonSerializer serializer) { writer.WriteValue(value.ToString()); } public override ModInfo ReadJson(JsonReader reader, Type objectType, ModInfo existingValue, bool hasExistingValue, JsonSerializer serializer) { return ModInfo.Parse(reader.Value.ToString()); } } public class ModInfo { public static Dictionary<string, ModInfo> CachedModInfos = new Dictionary<string, ModInfo>(); public static readonly ModInfo BepInEx_Offline = new ModInfo("BepInEx", "BepInExPack", new Version("5.4.2100")); public static readonly ModInfo LethalModManager_Offline = new ModInfo("kyxino", "LethalModManager", new Version("0.1.6")); private string _Creator; private string _Name; private Version _Version; public string Full_Name; public string Full_Version; public static ModInfo BepInEx => BepInEx_Offline; public static ModInfo LethalModManager => LethalModManager_Offline; public string Creator { get { return _Creator; } set { _Creator = value; Full_Name = value + "-" + _Name; Full_Version = ((_Version != null) ? $"{Full_Name}-{Version}" : null); } } public string Name { get { return _Name; } set { _Name = value; Full_Name = _Creator + "-" + value; Full_Version = ((_Version != null) ? $"{Full_Name}-{Version}" : null); } } public Version Version { get { return _Version; } set { _Version = value; Full_Version = ((value != null) ? $"{_Creator}-{_Name}-{value}" : null); } } public Uri DownloadURL => new Uri($"https://thunderstore.io/package/download/{Creator}/{Name}/{Version}/"); public ModInfo(string ModCreator, string ModName, Version ModVersion = null) { _Creator = ModCreator; _Name = ModName; _Version = ModVersion; Full_Name = ModCreator + "-" + ModName; Full_Version = ((ModVersion != null) ? $"{ModCreator}-{ModName}-{ModVersion}" : null); base..ctor(); } public ModListing GetMod() { ModListing value; return LMM_ModHandler.ThunderstoreData.TryGetValue(Full_Name, out value) ? value : null; } public VersionListing GetVersion(ModListing AltModClassData = null) { return (AltModClassData ?? GetMod())?.Versions?.FirstOrDefault((VersionListing x) => x.Version == Version); } public void Download(bool IncludeDependencies = true, string Profile = null, bool SaveToTempProfile = false, bool IgnoreConfigs = false) { if (IncludeDependencies) { VersionListing version = GetVersion(); IEnumerable<KeyValuePair<ModInfo, int>> enumerable = version.FilteredDependencies.Where((KeyValuePair<ModInfo, int> x) => x.Key.Full_Name != "BepInEx-BepInExPack" && x.Key.Full_Name != "kyxino-LethalModManager"); LMM_ModHandler.DownloadMod(this, Profile, SaveToTempProfile, IgnoreConfigs); foreach (KeyValuePair<ModInfo, int> item in enumerable) { LMM_ModHandler.DownloadMod(item.Key, Profile, SaveToTempProfile, IgnoreConfigs); } } else { LMM_ModHandler.DownloadMod(this, Profile, SaveToTempProfile, IgnoreConfigs); } ModManager.MLS.LogFatal((object)"DONE DOWNLOADING."); } public void SetInfo(string ModCreator, string ModName, Version ModVersion = null) { _Creator = ModCreator; Name = ModName; Version = ModVersion; } public void SetInfo(string ModVersionString) { if (CachedModInfos.TryGetValue(ModVersionString, out var value)) { _Creator = value.Creator; Name = value.Name; Version = value.Version; } else { string[] array = ModVersionString.Split('-'); Version result; int num = ((!Version.TryParse(array[^1], out result)) ? 1 : 2); _Creator = string.Join('-', array, 0, array.Length - num); Name = array[^num]; Version = result; } } public ModInfo WithVersion(Version ModVersion) { return new ModInfo(Creator, Name, ModVersion); } public static ModInfo Parse(string input) { if (CachedModInfos.TryGetValue(input, out var value)) { return value; } string[] array = input.Split('-'); Version result; int num = ((!Version.TryParse(array[^1], out result)) ? 1 : 2); return CachedModInfos[input] = new ModInfo(string.Join('-', array, 0, array.Length - num), array[^num], result); } public static bool TryParse(string input, out ModInfo result) { if (Utility.IsNullOrWhiteSpace(input) || input.Count((char x) => x == '-') < 2) { return (result = null) != null; } result = Parse(input); return true; } public bool Equals(ModInfo B) { return GetHashCode() == B.GetHashCode(); } public override bool Equals(object obj) { return GetHashCode() == obj.GetHashCode(); } public override int GetHashCode() { return HashCode.Combine(Creator, Name, Version); } public static bool operator ==(ModInfo A, ModInfo B) { return A?.GetHashCode() == B?.GetHashCode(); } public static bool operator !=(ModInfo A, ModInfo B) { return A?.GetHashCode() != B?.GetHashCode(); } } public enum ModStatus { Missing, Downloading, Downloaded, Extracting, Installed } public class Profile { public string Name; public string Desc; public string Author; public string Linked; public DirectoryInfo ProfilePath; public Dictionary<string, LocalMod> Mods; } public class LocalMod { public bool Active = false; public ModStatus Status = ModStatus.Missing; public Profile LinkedProfile; public static ModManifestV1 Manifest; public ModInfo Mod; public List<string> LinkedConfigs; public string CorePath; public string PatchersPath; public string PluginsPath; public string TempZipPath; public string CachedZipPath; } public class ModPage { } public class ModListPage { } public class ModListing { public int Downloads = 0; public int Dependents = 0; public int OnceDependents = 0; public int CurrentDependents = 0; [JsonProperty("date_created")] public DateTime Created; [JsonProperty("date_updated")] public DateTime Updated; [JsonProperty("rating_score")] public int Likes; [JsonProperty("is_pinned")] public bool Pinned; [JsonProperty("is_deprecated")] public bool Deprecated; [JsonProperty("has_nsfw_content")] public bool NSFW; [JsonProperty("categories")] public List<string> Tags; [JsonProperty("versions")] public List<VersionListing> Versions; [JsonProperty("full_name")] public ModInfo Info { get; set; } public string Creator => Info.Creator; public string Name => Info.Name; public string Full_Name => Info.Full_Name; } public class ModManifestV1 { [JsonProperty("name")] public string Name; [JsonProperty("version_number")] public Version Version; [JsonProperty("website_url")] public string Website; [JsonProperty("description")] public string Desc; [JsonProperty("dependencies")] public List<ModInfo> Dependencies; public bool UserEnabled = false; public string DirectoryPath; } public class VersionListing { public ModListing Mod; public Version Version; [JsonProperty("full_name")] public string Full_Version; [JsonProperty("description")] public string Desc; public string Icon; [JsonProperty("dependencies")] public List<ModInfo> Dependencies; public Dictionary<ModInfo, int> FilteredDependencies; [JsonProperty("downloads")] public int Downloads; public int Dependents = 0; public int OnceDependents = 0; public int CurrentDependents = 0; [JsonProperty("date_created")] public DateTime Created; [JsonProperty("is_active")] public bool Active; [JsonProperty("file_size")] public long Size; public ModInfo Info => Mod.Info; public string Creator => Info.Creator; public string Name => Info.Name; public string Full_Name => Info.Full_Name; } public enum ModSlotState { Required, Preferred, Optional, Forced, Enabled, Disabled } internal class LMM_ModSlot : MonoBehaviour { public ModInfo ModInfo; public ModManifestV1 ModManifest; public ModSlotState State; public IEnumerator ImageEnumerator; public Button Button; public Image Border; public Image Panel; public RawImage Logo; public Text Label; public Text Desc; public Button Website; public Transform Data; public Text Creator; public Text Downloads; public Text Dependents; public Text Likes; public Text Dependencies; public Text Size; public Text TinyDesc; public Transform Options; public Image OptionsFrame; public Button ProfileDownload; public Dropdown ProfileDropdown; public Button ModToggle; public Button ModDelete; public Dropdown VersionDropdown; private UnityWebRequest LogoRequest; private Texture2D DownloadedTexture; public void SetModInfo(string ModCreator, string ModName, Version ModVersion = null) { if (ModInfo != null) { ModInfo.SetInfo(ModCreator, ModName, ModVersion); } else { ModInfo = new ModInfo(ModCreator, ModName, ModVersion); } } public void SetModInfo(string ModVersionString) { if (ModInfo != null) { ModInfo.SetInfo(ModVersionString); } else { ModInfo = ModInfo.Parse(ModVersionString); } } private void Awake() { //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Expected O, but got Unknown //IL_024c: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Expected O, but got Unknown //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Expected O, but got Unknown //IL_0286: Unknown result type (might be due to invalid IL or missing references) //IL_0290: Expected O, but got Unknown //IL_02a3: Unknown result type (might be due to invalid IL or missing references) //IL_02ad: Expected O, but got Unknown Button = ((Component)this).transform.Find<Button>(); Border = ((Component)this).transform.Find<Image>(); Panel = ((Component)this).transform.Find<Image>("Panel"); Logo = ((Component)this).transform.Find<RawImage>("Logo"); Label = ((Component)this).transform.Find<Text>("ModText"); Desc = ((Component)this).transform.Find<Text>("Description"); Website = ((Component)this).transform.Find<Button>("Website"); Data = ((Component)this).transform.Find("Data"); Creator = Data.Find<Text>("CTEXT"); Downloads = Data.Find<Text>("DTEXT"); Dependents = Data.Find<Text>("DPTTEXT"); Likes = Data.Find<Text>("LTEXT"); Dependencies = Data.Find<Text>("DPCTEXT"); Size = ((Component)this).transform.Find<Text>("ModSize"); TinyDesc = ((Component)this).transform.Find<Text>("TinyDesc"); Options = ((Component)this).transform.Find("Options"); OptionsFrame = Options.Find<Image>(); ProfileDownload = Options.Find<Button>("ProfileDownload"); ProfileDropdown = Options.Find<Dropdown>("ProfileDropdown"); ModToggle = Options.Find<Button>("ModToggle"); ModDelete = Options.Find<Button>("ModDelete"); VersionDropdown = Options.Find<Dropdown>("VersionDropdown"); UpdateBorderByState(); ((UnityEvent)Website.onClick).AddListener((UnityAction)delegate { Application.OpenURL("https://thunderstore.io/c/lethal-company/p/" + ModInfo.Creator + "/" + ModInfo.Name + "/" + ((ModInfo.GetVersion() != null && ModManager.SpecificModVersionLink.Value) ? $"v/{ModInfo.Version}/" : "")); }); ((UnityEvent<int>)(object)VersionDropdown.onValueChanged).AddListener((UnityAction<int>)delegate(int VersionId) { ModListing mod = ModInfo.GetMod(); if (mod != null) { ModListing value; List<VersionListing> LocalModVersions = ((mod == null) ? null : (LMM_ModHandler.LocalMods.TryGetValue(mod.Full_Name, out value) ? value : null)?.Versions); List<VersionListing> list = mod?.Versions?.ToList() ?? LocalModVersions; if (LocalModVersions != null) { int i2; for (i2 = 0; i2 < LocalModVersions?.Count; i2++) { if (list.FirstOrDefault((VersionListing x) => x.Version == LocalModVersions[i2].Version) == null) { list.Add(LocalModVersions[i2]); } } } list.Sort((VersionListing x, VersionListing y) => y.Version.CompareTo(x.Version)); ModInfo.Version = list.FirstOrDefault((VersionListing x) => VersionDropdown.options[VersionId].text.EndsWith($": {x.Version}"))?.Version; bool? showOptions = true; UpdateModSlot(null, showOptions); } }); ProfileDropdown.AddOptions(LMM_UI.Actions.Find<Dropdown>("Local/ProfileSelectionDropdown").options); ((UnityEvent)ProfileDownload.onClick).AddListener((UnityAction)delegate { Text obj = ((Component)ProfileDropdown).transform.Find<Text>("Text"); string obj2 = ((obj != null) ? obj.text : null); Transform actions = LMM_UI.Actions; object obj3; if (actions == null) { obj3 = null; } else { Text obj4 = actions.Find<Text>("Local/ProfileSelectionDropdown/Text"); obj3 = ((obj4 != null) ? obj4.text : null); } if (obj2 == (string?)obj3) { LMM_UI.Instance.AddModToUI(ModInfo.Full_Version, LMM_UI.LP_Local); VersionListing version = ModInfo.GetVersion(); foreach (KeyValuePair<ModInfo, int> item in version.FilteredDependencies.Where((KeyValuePair<ModInfo, int> x) => x.Key.Full_Name != "BepInEx-BepInExPack" && x.Key.Full_Name != "kyxino-LethalModManager")) { LMM_UI.Instance.AddModToUI(item.Key.Full_Version, LMM_UI.LP_Local); } } Task.Run(delegate { LMM_UI.DisableInteracts.Add(ProfileDownload); ModInfo.Download(IncludeDependencies: true, ProfileDropdown.options[ProfileDropdown.value].text); LMM_UI.EnableInteracts.Add(ProfileDownload); }); }); ((UnityEvent)Button.onClick).AddListener((UnityAction)delegate { if (State == ModSlotState.Enabled || State == ModSlotState.Disabled) { ((Component)Options).gameObject.SetActive(!((Component)Options).gameObject.activeSelf); } else if (State != ModSlotState.Forced) { SetState((State == ModSlotState.Optional) ? ModSlotState.Preferred : ((State != ModSlotState.Preferred) ? ModSlotState.Optional : ModSlotState.Required)); UpdateBorderByState(); } }); ((UnityEvent)ModToggle.onClick).AddListener((UnityAction)delegate { bool userEnabled = ModManifest.UserEnabled; ((Selectable)ModToggle).interactable = false; DirectoryInfo parent2 = Directory.GetParent(ModManifest.DirectoryPath); if (Directory.Exists(Path.Combine(parent2.Parent.FullName, "plugins", parent2.Name))) { string[] files5 = Directory.GetFiles(Path.Combine(parent2.Parent.FullName, "plugins", parent2.Name), userEnabled ? "*" : "*.old", SearchOption.AllDirectories); foreach (string text8 in files5) { try { string destFileName; if (!userEnabled) { string text9 = text8; destFileName = text9.Substring(0, text9.Length - 4); } else { destFileName = text8 + ".old"; } File.Move(text8, destFileName); } catch (Exception ex5) { ModManager.MLS.LogWarning((object)ex5.Message); } } } if (Directory.Exists(Path.Combine(parent2.Parent.FullName, "patchers", parent2.Name))) { string[] files6 = Directory.GetFiles(Path.Combine(parent2.Parent.FullName, "patchers", parent2.Name), userEnabled ? "*" : "*.old", SearchOption.AllDirectories); foreach (string text10 in files6) { try { string destFileName2; if (!userEnabled) { string text9 = text10; destFileName2 = text9.Substring(0, text9.Length - 4); } else { destFileName2 = text10 + ".old"; } File.Move(text10, destFileName2); } catch (Exception ex6) { ModManager.MLS.LogWarning((object)ex6.Message); } } } if (Directory.Exists(Path.Combine(parent2.Parent.FullName, "core", parent2.Name))) { string[] files7 = Directory.GetFiles(Path.Combine(parent2.Parent.FullName, "core", parent2.Name), userEnabled ? "*" : "*.old", SearchOption.AllDirectories); foreach (string text11 in files7) { try { string destFileName3; if (!userEnabled) { string text9 = text11; destFileName3 = text9.Substring(0, text9.Length - 4); } else { destFileName3 = text11 + ".old"; } File.Move(text11, destFileName3); } catch (Exception ex7) { ModManager.MLS.LogWarning((object)ex7.Message); } } } ((Component)ModToggle).transform.Find<Text>().text = (userEnabled ? "Disable Mod" : "Enable Mod"); ((Selectable)ModToggle).interactable = true; ModManifest.UserEnabled = !userEnabled; UpdateBorderByState(); }); ((UnityEvent)ModDelete.onClick).AddListener((UnityAction)delegate { State = ModSlotState.Disabled; ((Selectable)ModToggle).interactable = false; ((Selectable)ModDelete).interactable = false; DirectoryInfo parent = Directory.GetParent(ModManifest.DirectoryPath); string text = Path.Combine(parent.Parent.FullName, "plugins", parent.Name); string text2 = Path.Combine(parent.Parent.FullName, "patchers", parent.Name); string text3 = Path.Combine(parent.Parent.FullName, "core", parent.Name); try { Directory.Delete(ModManifest.DirectoryPath, recursive: true); } catch (Exception) { string[] files = Directory.GetFiles(ModManifest.DirectoryPath, "*", SearchOption.AllDirectories); foreach (string text4 in files) { File.Move(text4, text4 + ".lmm-delete"); } Directory.Move(ModManifest.DirectoryPath, Path.Combine(Paths.GameRootPath, "DELETE", Random.Range(0, 10000000).ToString("X"))); } try { if (Directory.Exists(text)) { Directory.Delete(text, recursive: true); } } catch (Exception) { if (Directory.Exists(text2)) { string[] files2 = Directory.GetFiles(text, "*", SearchOption.AllDirectories); foreach (string text5 in files2) { File.Move(text5, text5 + ".lmm-delete"); } Directory.Move(text, Path.Combine(Paths.GameRootPath, "DELETE", Random.Range(0, 10000000).ToString("X"))); } } try { if (Directory.Exists(text2)) { Directory.Delete(text2, recursive: true); } } catch (Exception) { if (Directory.Exists(text2)) { string[] files3 = Directory.GetFiles(text2, "*", SearchOption.AllDirectories); foreach (string text6 in files3) { File.Move(text6, text6 + ".lmm-delete"); } Directory.Move(text2, Path.Combine(Paths.GameRootPath, "DELETE", Random.Range(0, 10000000).ToString("X"))); } } try { if (Directory.Exists(text3)) { Directory.Delete(text3, recursive: true); } } catch (Exception) { if (Directory.Exists(text3)) { string[] files4 = Directory.GetFiles(text3, "*", SearchOption.AllDirectories); foreach (string text7 in files4) { File.Move(text7, text7 + ".lmm-delete"); } Directory.Move(text3, Path.Combine(Paths.GameRootPath, "DELETE", Random.Range(0, 10000000).ToString("X"))); } } ModManifest.UserEnabled = false; UpdateBorderByState(); }); } public void SetState(ModSlotState NewState) { if (State != ModSlotState.Forced && State != ModSlotState.Enabled && State != ModSlotState.Disabled) { ((Component)Options).gameObject.SetActive(false); State = NewState; UpdateBorderByState(); } } public void UpdateBorderByState() { //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: 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_009e: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) Image optionsFrame = OptionsFrame; Image border = Border; ModManifestV1 modManifest = ModManifest; Color color = (((Graphic)border).color = Color32.op_Implicit((modManifest != null && !modManifest.UserEnabled) ? LMM_Colors.Secondary_Border : ((State == ModSlotState.Required || State == ModSlotState.Forced) ? Color32.op_Implicit(Color.white) : ((State == ModSlotState.Preferred || State == ModSlotState.Enabled) ? LMM_Colors.Primary_Border : LMM_Colors.Secondary_Border)))); ((Graphic)optionsFrame).color = color; Image panel = Panel; ModManifestV1 modManifest2 = ModManifest; ((Graphic)panel).color = ((modManifest2 != null && !modManifest2.UserEnabled) ? Color.black : Color.white); } public void OnDestroy() { LMM_UI.UpdateUI = true; } public void UpdateDataLayout() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Data == (Object)null) { return; } Vector2 val = Vector2.zero; RectTransform[] componentsInChildren = ((Component)Data).GetComponentsInChildren<RectTransform>(true); foreach (RectTransform val2 in componentsInChildren) { if (!((Object)(object)val2 == (Object)(object)Data.Find<RectTransform>())) { val2.anchoredPosition = val; Text component = ((Component)val2).GetComponent<Text>(); if ((Object)(object)component != (Object)null) { val2.sizeDelta = new Vector2(component.preferredWidth, 24f); } Vector2 val3 = val; Rect rect = val2.rect; val = val3 + new Vector2(((Rect)(ref rect)).width + 2f, 0f); } } } public IEnumerator DownloadImage(string MediaUrl) { if ((Object)(object)Logo.texture != (Object)null) { Object.Destroy((Object)(object)Logo.texture); } Logo.texture = null; UnityWebRequest logoRequest = LogoRequest; if (logoRequest != null) { logoRequest.Abort(); } UnityWebRequest logoRequest2 = LogoRequest; if (logoRequest2 != null) { logoRequest2.Dispose(); } LogoRequest = UnityWebRequestTexture.GetTexture(MediaUrl); for (int i = 0; i < ModManager.RetryLogoLoadingTimes.Value; i++) { if (((object)Logo).Equals((object?)null)) { break; } yield return LogoRequest.SendWebRequest(); if (((object)Logo).Equals((object?)null)) { break; } if ((int)LogoRequest.result == 2 || (int)LogoRequest.result == 3) { LogoRequest = UnityWebRequestTexture.GetTexture(MediaUrl); continue; } if ((Object)(object)DownloadedTexture != (Object)null) { Object.Destroy((Object)(object)DownloadedTexture); } DownloadedTexture = DownloadHandlerTexture.GetContent(LogoRequest); if (!((object)Logo).Equals((object?)null)) { Logo.texture = (Texture)(object)DownloadedTexture; } break; } } public void UpdateModSlot(bool? SetActive = null, bool? ShowOptions = false) { if (ImageEnumerator != null) { ((MonoBehaviour)LMM_UI.Instance).StopCoroutine(ImageEnumerator); } ImageEnumerator = null; if (SetActive.HasValue) { ((Component)this).gameObject.SetActive(SetActive.Value); } if (ShowOptions.HasValue) { ((Component)Options).gameObject.SetActive(ShowOptions.Value); } ModListing mod = ModInfo.GetMod(); VersionListing version = ModInfo.GetVersion(mod); string text = ModInfo.Name.Replace('_', ' ') + ((ModInfo.Version != null) ? $" v{ModInfo.Version}" : ""); Label.text = text; Desc.text = version?.Desc ?? ""; ((Component)Website).gameObject.SetActive(version != null || !ModManager.HideLinkIfMissingVersion.Value); Creator.text = ModInfo.Creator ?? "-"; Downloads.text = ((mod == null && (!ModManager.SpecificModVersionDownloads.Value || version == null)) ? "-" : ((!ModManager.SpecificModVersionDownloads.Value) ? mod?.Downloads : version?.Downloads)?.ToString("N0")); Text dependents = Dependents; string text2; if (ModManager.SpecificModVersionDependents.Value ? (version != null) : (mod != null)) { DependentVersionChecks value = ModManager.ModpackVersionCheck.Value; if (1 == 0) { } int num = value switch { DependentVersionChecks.All => ModManager.SpecificModVersionDependents.Value ? version.Dependents : mod.Dependents, DependentVersionChecks.Latest => ModManager.SpecificModVersionDependents.Value ? version.CurrentDependents : mod.CurrentDependents, _ => ModManager.SpecificModVersionDependents.Value ? version.OnceDependents : mod.OnceDependents, }; if (1 == 0) { } text2 = num.ToString("N0"); } else { text2 = "-"; } dependents.text = text2; Likes.text = mod?.Likes.ToString("N0") ?? "-"; Dependencies.text = ((!ModManager.CountFlattenedDependencies.Value) ? version?.Dependencies?.Count : version?.FilteredDependencies?.Count)?.ToString("N0") ?? "-"; UpdateDataLayout(); Text size = Size; object text3; if (version != null) { _ = version.Size; text3 = string.Format("{0}{1}", Math.Round((decimal)((version.Size > 999999) ? ((float)version.Size / 1000000f) : ((version.Size > 999) ? ((float)version.Size / 1000f) : ((float)version.Size)))), (version.Size > 999999) ? "MB" : ((version.Size > 999) ? "KB" : "B")); } else { text3 = ""; } size.text = (string)text3; Text tinyDesc = TinyDesc; object text4; if (mod == null) { text4 = ""; } else { string[] obj = new string[6] { "Tags: ", null, null, null, null, null }; List<string> tags = mod.Tags; obj[1] = ((tags != null) ? GeneralExtensions.Join<string>((IEnumerable<string>)tags, (Func<string, string>)null, ", ") : null) ?? "-"; obj[2] = " | Updated: "; obj[3] = ((mod.Updated == default(DateTime)) ? "-" : LMM_Utils.HowLongAgo(mod.Updated)); obj[4] = " | Created: "; obj[5] = ((mod.Created == default(DateTime)) ? "-" : LMM_Utils.HowLongAgo(mod.Created)); text4 = string.Concat(obj); } tinyDesc.text = (string)text4; Button modDelete = ModDelete; bool interactable = (((Selectable)ModToggle).interactable = ModManifest != null && ModManifest.Version == version?.Version); ((Selectable)modDelete).interactable = interactable; VersionDropdown.ClearOptions(); ModListing value2; List<VersionListing> LocalModVersions = (LMM_ModHandler.LocalMods.TryGetValue(ModInfo.Full_Name, out value2) ? value2 : null)?.Versions; List<VersionListing> list = mod?.Versions?.ToList() ?? LocalModVersions; if (LocalModVersions != null) { int i; for (i = 0; i < LocalModVersions.Count; i++) { if (list.FirstOrDefault((VersionListing x) => x.Version == LocalModVersions[i].Version) == null) { list.Add(LocalModVersions[i]); } } } list?.Sort((VersionListing x, VersionListing y) => y.Version.CompareTo(x.Version)); if (list != null && mod != null) { VersionDropdown.AddOptions(list.Select(delegate(VersionListing x) { bool? flag2 = LMM_ModHandler.UserMods.FirstOrDefault((KeyValuePair<string, ModManifestV1> y) => $"{y.Key}-{y.Value.Version}" == x.Full_Version).Value?.UserEnabled; if (1 == 0) { } string arg = ((!flag2.HasValue) ? (File.Exists(".\\LethalModManager\\ModStorage\\" + x.Full_Version + ".zip") ? "Downloaded " : "") : ((!flag2.GetValueOrDefault()) ? "Inactive " : "Installed ")); if (1 == 0) { } return $"{arg}Version: {x.Version}"; }).ToList()); } if (list != null && version != null) { VersionDropdown.SetValueWithoutNotify(list.IndexOf(version)); } if (version != null) { ((MonoBehaviour)LMM_UI.Instance).StartCoroutine(ImageEnumerator = DownloadImage(version.Icon ?? ("https://gcdn.thunderstore.io/live/repository/icons/" + version.Full_Version + ".png"))); } } public void Update() { if (LMM_UI.BreakUI) { return; } if (LMM_ModHandler.FinishedDownloads.Contains(ModInfo.Full_Version)) { VersionListing version = ModInfo.GetVersion(); Text size = Size; object text; if (version != null) { _ = version.Size; text = string.Format("{0}{1}", Math.Round((decimal)((version.Size > 999999) ? ((float)version.Size / 1000000f) : ((version.Size > 999) ? ((float)version.Size / 1000f) : ((float)version.Size)))), (version.Size > 999999) ? "MB" : ((version.Size > 999) ? "KB" : "B")); } else { text = ""; } size.text = (string)text; LMM_ModHandler.FinishedDownloads.Remove(ModInfo.Full_Version); } else if (LMM_ModHandler.QueuedDownloads.ContainsKey(ModInfo.Full_Version)) { DownloadProgressChangedEventArgs downloadProgressChangedEventArgs = LMM_ModHandler.QueuedDownloads[ModInfo.Full_Version]; Size.text = string.Format("{0}{1}/{2}{3}", Math.Round((decimal)((downloadProgressChangedEventArgs.BytesReceived > 999999) ? ((float)downloadProgressChangedEventArgs.BytesReceived / 1000000f) : ((downloadProgressChangedEventArgs.BytesReceived > 999) ? ((float)downloadProgressChangedEventArgs.BytesReceived / 1000f) : ((float)downloadProgressChangedEventArgs.BytesReceived)))), (downloadProgressChangedEventArgs.BytesReceived > 999999) ? "MB" : ((downloadProgressChangedEventArgs.BytesReceived > 999) ? "KB" : "B"), Math.Round((decimal)((downloadProgressChangedEventArgs.TotalBytesToReceive > 999999) ? ((float)downloadProgressChangedEventArgs.TotalBytesToReceive / 1000000f) : ((downloadProgressChangedEventArgs.TotalBytesToReceive > 999) ? ((float)downloadProgressChangedEventArgs.TotalBytesToReceive / 1000f) : ((float)downloadProgressChangedEventArgs.TotalBytesToReceive)))), (downloadProgressChangedEventArgs.TotalBytesToReceive > 999999) ? "MB" : ((downloadProgressChangedEventArgs.TotalBytesToReceive > 999) ? "KB" : "B")); } } } [StructLayout(LayoutKind.Sequential, Size = 1)] public struct LMM_Colors { public static Color32 Background_Tint = new Color32((byte)58, (byte)0, (byte)0, (byte)201); public static Color32 Logo_Mult = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue); public static Color32 Primary_Frame = new Color32((byte)79, (byte)0, (byte)0, byte.MaxValue); public static Color32 Primary_Border = new Color32((byte)202, (byte)48, (byte)0, byte.MaxValue); public static Color32 Secondary_Border = new Color32((byte)64, (byte)0, (byte)0, byte.MaxValue); public static Color32 Primary_Text = new Color32(byte.MaxValue, (byte)122, (byte)0, byte.MaxValue); public static Color32 Secondary_Text_Icons = new Color32((byte)202, (byte)48, (byte)0, byte.MaxValue); public static Color32 Unknown_1 = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, (byte)0); public static Color32 Dropdown_Normal = new Color32((byte)87, (byte)0, (byte)0, byte.MaxValue); public static Color32 Dropdown_Highlighted = new Color32((byte)118, (byte)0, (byte)0, byte.MaxValue); public static Color32 Dropdown_Selected = new Color32((byte)118, (byte)0, (byte)0, byte.MaxValue); public static Color32 Dropdown_Pressed = new Color32((byte)0, (byte)0, (byte)0, byte.MaxValue); } internal class LMM_UI : MonoBehaviour { [CompilerGenerated] private static class <>O { public static Func<string, string> <0>__GetFileName; public static UnityAction <1>__UpdateThunderstoreData; } [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Action <>9__14_0; public static Comparison<ModListing> <>9__31_0; public static Comparison<ModListing> <>9__31_1; public static Comparison<ModListing> <>9__31_2; public static Comparison<ModListing> <>9__31_8; public static Comparison<ModListing> <>9__31_9; public static Comparison<ModListing> <>9__31_10; public static Comparison<ModListing> <>9__31_11; public static Comparison<ModListing> <>9__31_12; public static Comparison<ModListing> <>9__31_13; public static Comparison<ModListing> <>9__31_3; public static Comparison<ModListing> <>9__31_4; public static Comparison<ModListing> <>9__31_5; public static Comparison<ModListing> <>9__31_6; public static Comparison<ModListing> <>9__31_7; public static Func<string, string> <>9__32_0; public static UnityAction <>9__34_0; public static UnityAction <>9__34_1; public static UnityAction <>9__34_2; public static UnityAction <>9__34_3; public static Func<ModListing, bool> <>9__34_24; public static UnityAction <>9__34_20; public static UnityAction <>9__34_21; internal void <Awake>b__14_0() { LMM_ModHandler.LoadThunderstoreData(ModManager.ForceUpdateUponOpening.Value); } internal int <ResortData>b__31_0(ModListing x, ModListing y) { return y.Updated.CompareTo(x.Updated); } internal int <ResortData>b__31_1(ModListing x, ModListing y) { return y.Created.CompareTo(x.Created); } internal int <ResortData>b__31_2(ModListing x, ModListing y) { return y.Downloads.CompareTo(x.Downloads); } internal int <ResortData>b__31_8(ModListing x, ModListing y) { return y.Versions.FirstOrDefault().Dependents.CompareTo(x.Versions.FirstOrDefault().Dependents); } internal int <ResortData>b__31_9(ModListing x, ModListing y) { return y.Dependents.CompareTo(x.Dependents); } internal int <ResortData>b__31_10(ModListing x, ModListing y) { return y.Versions.FirstOrDefault().CurrentDependents.CompareTo(x.Versions.FirstOrDefault().CurrentDependents); } internal int <ResortData>b__31_11(ModListing x, ModListing y) { return y.CurrentDependents.CompareTo(x.CurrentDependents); } internal int <ResortData>b__31_12(ModListing x, ModListing y) { return y.Versions.FirstOrDefault().OnceDependents.CompareTo(x.Versions.FirstOrDefault().OnceDependents); } internal int <ResortData>b__31_13(ModListing x, ModListing y) { return y.OnceDependents.CompareTo(x.OnceDependents); } internal int <ResortData>b__31_3(ModListing x, ModListing y) { return y.Likes.CompareTo(x.Likes); } internal int <ResortData>b__31_4(ModListing x, ModListing y) { return y.Versions.FirstOrDefault().FilteredDependencies.Count.CompareTo(x.Versions.FirstOrDefault().FilteredDependencies.Count); } internal int <ResortData>b__31_5(ModListing x, ModListing y) { return y.Versions.FirstOrDefault().Dependencies.Count.CompareTo(x.Versions.FirstOrDefault().Dependencies.Count); } internal int <ResortData>b__31_6(ModListing x, ModListing y) { return y.Versions.Count.CompareTo(x.Versions.Count); } internal int <ResortData>b__31_7(ModListing x, ModListing y) { return y.Versions.FirstOrDefault().Size.CompareTo(x.Versions.FirstOrDefault().Size); } internal string <UpdateProfileSelection>b__32_0(string x) { return "TEMP: " + Path.GetFileName(x); } internal void <Start>b__34_0() { LoadMenu("Local"); } internal void <Start>b__34_1() { LoadMenu("Thunderstore"); } internal void <Start>b__34_2() { LoadMenu("Downloads"); } internal void <Start>b__34_3() { ConfigsToDownload = null; ModManager.JoiningLobbyId = null; ((Component)LMM_Canvas).gameObject.SetActive(false); } internal bool <Start>b__34_24(ModListing x) { int result; if (!x.Tags.Contains("Modpacks")) { VersionListing? versionListing = x.Versions.FirstOrDefault(); result = ((versionListing != null && versionListing.Dependencies?.Count < 10) ? 1 : 0); } else { result = 0; } return (byte)result != 0; } internal void <Start>b__34_20() { ModManager.MLS.LogFatal((object)"Attempting to open lobby via mod sync."); using WebClient webClient = new WebClient(); Dictionary<string, int> dictionary = new Dictionary<string, int>(); for (int i = 0; i < LP_Host.childCount; i++) { LMM_ModSlot component = ((Component)LP_Host.GetChild(i)).GetComponent<LMM_ModSlot>(); dictionary.Add(component.ModInfo.Full_Version, (component.State != ModSlotState.Optional) ? ((component.State == ModSlotState.Preferred) ? 1 : (-1)) : 0); } ((Component)LMM_Canvas).gameObject.SetActive(false); Dictionary<string, object> dictionary2 = new Dictionary<string, object> { ["Mods"] = dictionary, ["Configs"] = LMM_ModHandler.CompressConfigs() }; string data = "#lethalmodmanager\n" + Convert.ToBase64String(Encoding.ASCII.GetBytes(JsonConvert.SerializeObject((object)dictionary2))); webClient.Headers.Add("Content-Type", "application/octet-stream"); string text = webClient.UploadString("https://thunderstore.io/api/experimental/legacyprofile/create/", data); Dictionary<string, object> dictionary3 = JsonConvert.DeserializeObject<Dictionary<string, object>>(text); ModManager.MLS.LogWarning((object)text); if (!dictionary3.TryGetValue("key", out var value)) { FailedOpenLobby = Time.time + 1f; return; } ModManager.ModSyncKey = value.ToString(); ModManager.ModSyncCount = dictionary.Count; ModManager.MLS.LogWarning((object)ModManager.ModSyncKey); ModManager.OpeningLobby = true; Object.FindObjectOfType<MenuManager>().ConfirmHostButton(); } internal void <Start>b__34_21() { for (int i = 0; i < LP_LobbyMods.childCount; i++) { ((Component)LP_LobbyMods.GetChild(i)).GetComponent<LMM_ModSlot>()?.SetState(ModSlotState.Preferred); } } } public static LMM_UI Instance; public static Transform LMM_Canvas; public static Transform Actions; public static Transform ListPanel; public static Transform LP_Local; public static Transform LP_Thunderstore; public static Transform LP_Downloads; public static Transform LP_Host; public static Transform LP_Config; public static Transform LP_LobbyMods; public static Transform LP_LobbyConfigs; public static GameObject ModSlotTemp; public static GameObject ModManagerCanvas; public static float? FailedOpenLobby; public static bool AttemptQuickReload = false; public static ulong? AttemptQuickLobby = null; public static bool UpdateModSlots = false; public static bool BreakUI = false; public static bool ResortUI = false; public static bool UpdateUI = true; public static bool SwitchedPanel = true; public static bool PreviousActive = false; public static float PreviousWidth = 0f; public static float PreviousHeight = 0f; public static List<Button> DisableInteracts = new List<Button>(); public static List<Button> EnableInteracts = new List<Button>(); public static string ConfigsToDownload; public void AddModToUI(string DepString, Transform Parent, ModManifestV1 Manifest = null, ModSlotState State = ModSlotState.Enabled, bool IgnoreExisting = false) { //IL_00df: Unknown result type (might be due to invalid IL or missing references) if (!IgnoreExisting) { for (int i = 0; i < Parent.childCount; i++) { ModInfo modInfo = ModInfo.Parse(DepString); LMM_ModSlot component = ((Component)Parent.GetChild(i)).GetComponent<LMM_ModSlot>(); if (!(component.ModInfo.Full_Name != modInfo.Full_Name)) { component.ModInfo = modInfo; component.UpdateBorderByState(); component.UpdateModSlot(null, false); UpdateUI = true; return; } } } LMM_ModSlot lMM_ModSlot = Object.Instantiate<GameObject>(ModSlotTemp).AddComponent<LMM_ModSlot>(); lMM_ModSlot.ModManifest = Manifest; lMM_ModSlot.SetState(State); lMM_ModSlot.UpdateBorderByState(); lMM_ModSlot.SetModInfo(DepString); lMM_ModSlot.UpdateModSlot(null, false); ((Component)lMM_ModSlot).transform.SetParent(Parent); ((Component)lMM_ModSlot).transform.localScale = Vector3.one; UpdateUI = true; } private void Awake() { Instance = this; AssetBundle val = null; try { val = AssetBundle.LoadFromMemory(Resource1.LethalModManagerUI); } catch (Exception ex) { ModManager.MLS.LogError((object)ex); } if ((Object)(object)val == (Object)null) { ModManager.MLS.LogWarning((object)"LethalModManager could not load, WHAT."); return; } ModManager.MLS.LogWarning((object)"LethalModManagerUI has loaded."); Object obj = val.LoadAsset("ModSlotV2.prefab"); ModSlotTemp = (GameObject)(object)((obj is GameObject) ? obj : null); Object obj2 = val.LoadAsset("LMM_Canvas.prefab"); ModManagerCanvas = (GameObject)(object)((obj2 is GameObject) ? obj2 : null); ModManagerCanvas.GetComponent<CanvasScaler>().uiScaleMode = (ScaleMode)(ModManager.ScaleUI.Value ? 1 : 0); ModManagerCanvas.GetComponent<CanvasScaler>().matchWidthOrHeight = ModManager.ScaleBetweenWidthToHeight.Value; Object.DontDestroyOnLoad((Object)(object)ModManagerCanvas); Task.Run(delegate { LMM_ModHandler.LoadThunderstoreData(ModManager.ForceUpdateUponOpening.Value); }); } private void Update() { //IL_029c: Unknown result type (might be due to invalid IL or missing references) //IL_0428: Unknown result type (might be due to invalid IL or missing references) //IL_042d: Unknown result type (might be due to invalid IL or missing references) //IL_044d: Unknown result type (might be due to invalid IL or missing references) //IL_0452: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Instance == (Object)null || BreakUI) { return; } if (AttemptQuickReload && LMM_ModHandler.QueuedDownloads.Count <= 0 && LMM_ModHandler.ExtractingMods.Count <= 0) { AttemptQuickReload = false; ModManager.DoorstopSettings.Add("isQuickReloaded=true"); ModManager.DoorstopSettings.Add("reloadLaunchMode=" + ((GameNetworkManager.Instance?.disableSteam).Value ? "LAN" : "Online")); if (AttemptQuickLobby.HasValue) { ModManager.DoorstopSettings.Add("joiningLobbyId=" + AttemptQuickLobby); } File.WriteAllLines(Path.Combine(Paths.GameRootPath, "doorstop_config.ini"), ModManager.DoorstopSettings); Process process = new Process { StartInfo = new ProcessStartInfo("steam://rungameid/1966720") { UseShellExecute = true } }; ModManager.MLS.LogWarning((object)process.Start()); Process.GetCurrentProcess().Kill(); return; } while (DisableInteracts.Count > 0) { ((Selectable)DisableInteracts[0]).interactable = false; DisableInteracts.Remove(DisableInteracts[0]); } while (EnableInteracts.Count > 0) { ((Selectable)EnableInteracts[0]).interactable = true; EnableInteracts.Remove(EnableInteracts[0]); } if (!((Component)LMM_Canvas).gameObject.activeSelf) { return; } if (FailedOpenLobby.HasValue) { if (FailedOpenLobby <= Time.time) { FailedOpenLobby = null; } Actions.Find<Text>("Host/OpenLobby/Text").text = ((!FailedOpenLobby.HasValue) ? "Open Lobby" : "Failed"); } if (ResortUI) { ResortUI = false; if ((Object)(object)Actions != (Object)null) { ((Transform)Actions.Find<RectTransform>("Thunderstore/ReverseSort/Text")).eulerAngles = new Vector3(0f, 0f, (float)(LMM_ModHandler.TS_Reversed ? 90 : (-90))); } ResortData(); } if (UpdateModSlots) { UpdateModSlots = false; for (int i = 0; i < LP_Host.childCount; i++) { ((Component)LP_Host.GetChild(i)).GetComponent<LMM_ModSlot>().UpdateModSlot(null, false); } for (int j = 0; j < LP_Local.childCount; j++) { ((Component)LP_Local.GetChild(j)).GetComponent<LMM_ModSlot>().UpdateModSlot(null, false); } for (int k = 0; k < LP_Downloads.childCount; k++) { ((Component)LP_Downloads.GetChild(k)).GetComponent<LMM_ModSlot>().UpdateModSlot(null, false); } } if (LMM_ModHandler.DownloadedMods.Count > 0) { string text = LMM_ModHandler.DownloadedMods.FirstOrDefault(); LMM_ModHandler.DownloadedMods.Remove(text); AddModToUI(Path.GetFileNameWithoutExtension(text), LP_Downloads); } bool flag = PreviousActive == (PreviousActive = ((Component)LMM_Canvas).gameObject.activeSelf); if (!UpdateUI && !SwitchedPanel && flag) { float previousWidth = PreviousWidth; Rect rect = LMM_Canvas.Find<RectTransform>().rect; if (previousWidth == (PreviousWidth = ((Rect)(ref rect)).width)) { float previousHeight = PreviousHeight; rect = ((Component)LMM_Canvas).GetComponent<RectTransform>().rect; if (previousHeight == (PreviousHeight = ((Rect)(ref rect)).height)) { return; } } } UpdateUI = false; SwitchedPanel = false; LMM_Utils.AdjustScroll(LP_Local); LMM_Utils.AdjustScroll(LP_Thunderstore); LMM_Utils.AdjustScroll(LP_Downloads); LMM_Utils.AdjustScroll(LP_Host); LMM_Utils.AdjustScroll(LP_LobbyMods); } public void UpdatePage(int Offset) { if (LMM_ModHandler.TS_SearchChoice == null) { return; } int count = LMM_ModHandler.TS_SearchChoice.Count; ModManager.MLS.LogWarning((object)$"{Offset} | {count} | {LMM_ModHandler.TS_Count} | {Math.Max(0, Mathf.FloorToInt((float)(count - 1) / (float)LMM_ModHandler.TS_Count) * LMM_ModHandler.TS_Count)}"); Offset = Math.Clamp(Offset, 0, Math.Max(0, Mathf.FloorToInt((float)(count - 1) / (float)LMM_ModHandler.TS_Count) * LMM_ModHandler.TS_Count)); for (int i = 0; i < Math.Min(Offset + LMM_ModHandler.TS_Count, count) - Offset; i++) { if (i < LP_Thunderstore.childCount) { LMM_ModSlot component = ((Component)LP_Thunderstore.GetChild(i)).GetComponent<LMM_ModSlot>(); if (Object.op_Implicit((Object)(object)component)) { ModListing modListing = LMM_ModHandler.TS_SearchChoice[i + Offset]; component.SetModInfo(modListing.Creator, modListing.Name, modListing?.Versions?.FirstOrDefault()?.Version); component.UpdateModSlot(true, false); } } else { AddModToUI(LMM_ModHandler.TS_SearchChoice[i + Offset].Versions.FirstOrDefault()?.Full_Version, LP_Thunderstore); } } for (int j = Math.Min(Offset + LMM_ModHandler.TS_Count, count) - Offset; j < LP_Thunderstore.childCount; j++) { LMM_ModSlot component2 = ((Component)LP_Thunderstore.GetChild(j)).GetComponent<LMM_ModSlot>(); ((MonoBehaviour)component2).StopAllCoroutines(); Object.Destroy((Object)(object)((Component)component2).gameObject); } LMM_ModHandler.TS_Offset = Offset; Actions.Find<InputField>("Thunderstore/InputPage").SetTextWithoutNotify($"{Math.Ceiling((float)(LMM_ModHandler.TS_Offset + LMM_ModHandler.TS_Count) / (float)LMM_ModHandler.TS_Count)}"); UpdateUI = true; SwitchedPanel = true; } public static void LoadMenu(string MenuName) { try { ((Component)LMM_Canvas).gameObject.SetActive(true); RectTransform val = ListPanel.Find<RectTransform>(MenuName); LMM_Utils.HideOthersInParent((Transform)(object)val); LMM_Utils.HideOthersInParent(Actions.Find(MenuName)); ListPanel.Find<ScrollRect>().content = val; UpdateUI = true; SwitchedPanel = true; } catch (Exception ex) { ModManager.MLS.LogWarning((object)ex.Message); } } public void ResortData(int? Value = null) { Dropdown val = Actions?.Find<Dropdown>("Thunderstore/SortDropdown"); if ((Object)(object)val == (Object)null) { return; } OptionData obj = val.options[Value ?? val.value]; switch (((obj != null) ? obj.text : null) ?? "Last Updated") { default: LMM_ModHandler.TS_SearchChoice.Sort((ModListing x, ModListing y) => y.Updated.CompareTo(x.Updated)); break; case "Last Released": LMM_ModHandler.TS_SearchChoice.Sort((ModListing x, ModListing y) => y.Created.CompareTo(x.Created)); break; case "Most Downloads": LMM_ModHandler.TS_SearchChoice.Sort((ModListing x, ModListing y) => y.Downloads.CompareTo(x.Downloads)); break; case "Most Dependents": switch (ModManager.ModpackVersionCheck.Value) { case DependentVersionChecks.All: if (ModManager.SpecificModVersionDependents.Value) { LMM_ModHandler.TS_SearchChoice.Sort((ModListing x, ModListing y) => y.Versions.FirstOrDefault().Dependents.CompareTo(x.Versions.FirstOrDefault().Dependents)); } else { LMM_ModHandler.TS_SearchChoice.Sort((ModListing x, ModListing y) => y.Dependents.CompareTo(x.Dependents)); } break; case DependentVersionChecks.Latest: if (ModManager.SpecificModVersionDependents.Value) { LMM_ModHandler.TS_SearchChoice.Sort((ModListing x, ModListing y) => y.Versions.FirstOrDefault().CurrentDependents.CompareTo(x.Versions.FirstOrDefault().CurrentDependents)); } else { LMM_ModHandler.TS_SearchChoice.Sort((ModListing x, ModListing y) => y.CurrentDependents.CompareTo(x.CurrentDependents)); } break; default: if (ModManager.SpecificModVersionDependents.Value) { LMM_ModHandler.TS_SearchChoice.Sort((ModListing x, ModListing y) => y.Versions.FirstOrDefault().OnceDependents.CompareTo(x.Versions.FirstOrDefault().OnceDependents)); } else { LMM_ModHandler.TS_SearchChoice.Sort((ModListing x, ModListing y) => y.OnceDependents.CompareTo(x.OnceDependents)); } break; } break; case "Most Likes": LMM_ModHandler.TS_SearchChoice.Sort((ModListing x, ModListing y) => y.Likes.CompareTo(x.Likes)); break; case "Most Dependencies": if (ModManager.CountFlattenedDependencies.Value) { LMM_ModHandler.TS_SearchChoice.Sort((ModListing x, ModListing y) => y.Versions.FirstOrDefault().FilteredDependencies.Count.CompareTo(x.Versions.FirstOrDefault().FilteredDependencies.Count)); } else { LMM_ModHandler.TS_SearchChoice.Sort((ModListing x, ModListing y) => y.Versions.FirstOrDefault().Dependencies.Count.CompareTo(x.Versions.FirstOrDefault().Dependencies.Count)); } break; case "Most Versions": LMM_ModHandler.TS_SearchChoice.Sort((ModListing x, ModListing y) => y.Versions.Count.CompareTo(x.Versions.Count)); break; case "Latest Size": LMM_ModHandler.TS_SearchChoice.Sort((ModListing x, ModListing y) => y.Versions.FirstOrDefault().Size.CompareTo(x.Versions.FirstOrDefault().Size)); break; } if (LMM_ModHandler.TS_Reversed) { LMM_ModHandler.TS_SearchChoice?.Reverse(); } UpdatePage(LMM_ModHandler.TS_Offset); } public void UpdateProfileSelection(Dropdown ProfileSelectionDropdown, bool Select = false) { ProfileSelectionDropdown.ClearOptions(); ProfileSelectionDropdown.AddOptions(new List<string> { "Main Directory" }); List<string> list = (from x in Directory.GetDirectories(ModManager.DIR_TempProfiles.FullName) select "TEMP: " + Path.GetFileName(x)).ToList(); ProfileSelectionDropdown.AddOptions(list); List<string> list2 = Directory.GetDirectories(ModManager.DIR_Profiles.FullName).Select(Path.GetFileName).ToList(); ProfileSelectionDropdown.AddOptions(list2); string fullName = ModManager.DIR_CurrentProfile.Parent.FullName; ModManager.MLS.LogFatal((object)fullName); ModManager.MLS.LogFatal((object)ModManager.DIR_LethalCompany.FullName); string text = ((ModManager.DIR_Profiles.FullName == fullName) ? "LMM" : ((ModManager.DIR_TempProfiles.FullName == fullName) ? "TEMP" : ((ModManager.DIR_LethalCompany.FullName == ModManager.DIR_CurrentProfile.FullName) ? "MAIN" : "ALT"))); if (text == "ALT") { ProfileSelectionDropdown.AddOptions(new List<string> { "ALT: " + ModManager.DIR_CurrentProfile.Name }); if (Select) { ProfileSelectionDropdown.value = ProfileSelectionDropdown.options.Count; } } else { if (!(text != "MAIN")) { return; } List<string> ProfilesDirectory = ((text == "LMM") ? list2 : list); if (Select) { ProfileSelectionDropdown.value = ProfileSelectionDropdown.options.FindIndex((OptionData x) => !ProfilesDirectory.Contains(x.text)); } } } private void Start() { //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Expected O, but got Unknown //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Expected O, but got Unknown //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Expected O, but got Unknown //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Expected O, but got Unknown //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Expected O, but got Unknown //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Expected O, but got Unknown //IL_02af: Unknown result type (might be due to invalid IL or missing references) //IL_02b9: Expected O, but got Unknown //IL_046b: Unknown result type (might be due to invalid IL or missing references) //IL_0475: Expected O, but got Unknown //IL_04a1: Unknown result type (might be due to invalid IL or missing references) //IL_04ab: Expected O, but got Unknown //IL_04c7: Unknown result type (might be due to invalid IL or missing references) //IL_04d1: Expected O, but got Unknown //IL_04ed: Unknown result type (might be due to invalid IL or missing references) //IL_04f7: Expected O, but got Unknown //IL_0539: Unknown result type (might be due to invalid IL or missing references) //IL_0543: Expected O, but got Unknown //IL_055f: Unknown result type (might be due to invalid IL or missing references) //IL_0569: Expected O, but got Unknown //IL_0585: Unknown result type (might be due to invalid IL or missing references) //IL_058f: Expected O, but got Unknown //IL_0608: Unknown result type (might be due to invalid IL or missing references) //IL_0612: Expected O, but got Unknown //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Expected O, but got Unknown //IL_063b: Unknown result type (might be due to invalid IL or missing references) //IL_0640: Unknown result type (might be due to invalid IL or missing references) //IL_0646: Expected O, but got Unknown //IL_06ba: Unknown result type (might be due to invalid IL or missing references) //IL_06c4: Expected O, but got Unknown //IL_0674: Unknown result type (might be due to invalid IL or missing references) //IL_0679: Unknown result type (might be due to invalid IL or missing references) //IL_067f: Expected O, but got Unknown //IL_09d5: Unknown result type (might be due to invalid IL or missing references) //IL_09da: Unknown result type (might be due to invalid IL or missing references) try { LMM_Canvas = Object.Instantiate<GameObject>(ModManagerCanvas, GameObject.Find("Canvas").transform.parent, false).transform; ButtonClickedEvent onClick = LMM_Canvas.Find<Button>("Menu/Local_Show").onClick; object obj = <>c.<>9__34_0; if (obj == null) { UnityAction val = delegate { LoadMenu("Local"); }; <>c.<>9__34_0 = val; obj = (object)val; } ((UnityEvent)onClick).AddListener((UnityAction)obj); ButtonClickedEvent onClick2 = LMM_Canvas.Find<Button>("Menu/TS_Show").onClick; object obj2 = <>c.<>9__34_1; if (obj2 == null) { UnityAction val2 = delegate { LoadMenu("Thunderstore"); }; <>c.<>9__34_1 = val2; obj2 = (object)val2; } ((UnityEvent)onClick2).AddListener((UnityAction)obj2); ButtonClickedEvent onClick3 = LMM_Canvas.Find<Button>("Menu/Downloads_Show").onClick; object obj3 = <>c.<>9__34_2; if (obj3 == null) { UnityAction val3 = delegate { LoadMenu("Downloads"); }; <>c.<>9__34_2 = val3; obj3 = (object)val3; } ((UnityEvent)onClick3).AddListener((UnityAction)obj3); ButtonClickedEvent onClick4 = LMM_Canvas.Find<Button>("Menu/ExitAction").onClick; object obj4 = <>c.<>9__34_3; if (obj4 == null) { UnityAction val4 = delegate { ConfigsToDownload = null; ModManager.JoiningLobbyId = null; ((Component)LMM_Canvas).gameObject.SetActive(false); }; <>c.<>9__34_3 = val4; obj4 = (object)val4; } ((UnityEvent)onClick4).AddListener((UnityAction)obj4); ButtonClickedEvent onClick5 = LMM_Canvas.Find<Button>("Menu/Reload").onClick; object obj5 = <>O.<1>__UpdateThunderstoreData; if (obj5 == null) { UnityAction val5 = LMM_ModHandler.UpdateThunderstoreData; <>O.<1>__UpdateThunderstoreData = val5; obj5 = (object)val5; } ((UnityEvent)onClick5).AddListener((UnityAction)obj5); LMM_Canvas.Find<Text>("LMM/Text").text = "LethalModManager v0.1.6 by Kyxino"; Actions = LMM_Canvas.Find("Menu/Actions"); InputField SaveProfileInput = Actions.Find<InputField>("Local/SaveProfile"); Text SaveProfileButtonText = Actions.Find<Text>("Local/SaveProfileButton/Text"); Dropdown ProfileSelectionDropdown = Actions.Find<Dropdown>("Local/ProfileSelectionDropdown"); Text ProfileDropdownText = Actions.Find<Text>("Local/ProfileSelectionDropdown/Text"); UpdateProfileSelection(ProfileSelectionDropdown, Select: true); ((UnityEvent<int>)(object)ProfileSelectionDropdown.onValueChanged).AddListener((UnityAction<int>)delegate(int Value) { string text11 = ProfileSelectionDropdown.options[Value].text; SaveProfileInput.text = ((text11.StartsWith("TEMP:") || text11.StartsWith("ALT:")) ? "" : text11); for (int num3 = 0; num3 < LP_Local.childCount; num3++) { LMM_ModSlot component4 = ((Component)LP_Local.GetChild(num3)).GetComponent<LMM_ModSlot>(); ((MonoBehaviour)component4).StopAllCoroutines(); Object.Destroy((Object)(object)((Component)component4).gameObject); } object obj8; if (!text11.StartsWith("TEMP: ")) { obj8 = (text11.StartsWith("ALT: ") ? Paths.PluginPath : ((text11 == "Main Directory") ? Path.Combine(ModManager.DIR_LethalCompany.FullName, "BepInEx", "plugins") : Path.Combine(ModManager.DIR_Profiles.FullName, text11, "BepInEx", "plugins"))); } else { string fullName = ModManager.DIR_TempProfiles.FullName; string text12 = text11; obj8 = Path.Combine(fullName, text12.Substring(7, text12.Length - 7), "BepInEx", "plugins"); } string text13 = (string)obj8; ModManager.MLS.LogInfo((object)text13); foreach (KeyValuePair<string, ModManifestV1> mod2 in LMM_ModHandler.GetMods(text13)) { AddModToUI($"{mod2.Key}-{mod2.Value.Version}", LP_Local, mod2.Value, ModSlotState.Enabled, IgnoreExisting: true); } UpdateUI = true; SwitchedPanel = true; }); char[] InvalidPathChars = Path.GetInvalidFileNameChars(); ModManager.MLS.LogFatal((object)InvalidPathChars); SaveProfileButtonText.text = "New Profile"; ((UnityEvent<string>)(object)SaveProfileInput.onValueChanged).AddListener((UnityAction<string>)delegate(string Value) { string text10 = string.Join("", Value.Where((char x) => !InvalidPathChars.Contains(x))); int caretPosition = SaveProfileInput.caretPosition; SaveProfileInput.SetTextWithoutNotify(text10); SaveProfileInput.caretPosition = caretPosition; SaveProfileButtonText.text = (Directory.Exists(Path.Combine(ModManager.DIR_Profiles.FullName, text10)) ? "Delete Profile" : "New Profile"); }); ((UnityEvent)Actions.Find<Button>("Local/SaveProfileButton").onClick).AddListener((UnityAction)delegate { string text9 = SaveProfileInput.text.Trim(); if (text9.Length >= 1 && !(text9 == "Main Directory")) { ModManager.MLS.LogFatal((object)text9); if (SaveProfileButtonText.text == "Delete Profile") { UpdateProfileSelection(ProfileSelectionDropdown, Select: true); } else { SaveProfileButtonText.text = "Delete Profile"; LMM_ModHandler.CreateProfile(text9); ProfileSelectionDropdown.AddOptions(new List<string> { text9 }); } } }); ((UnityEvent)Actions.Find<Button>("Local/LoadProfile").onClick).AddListener((UnityAction)delegate { string text6 = SaveProfileInput.text.Trim(); for (int n = 0; n < ModManager.DoorstopSettings.Count; n++) { string text7 = ModManager.DoorstopSettings[n]; if (text7.StartsWith("targetAssembly=")) { List<string> doorstopSettings = ModManager.DoorstopSettings; int index = n; object value3; if (!(ProfileDropdownText.text == "Main Directory")) { if (!ProfileDropdownText.text.StartsWith("ALT: ")) { if (!ProfileDropdownText.text.StartsWith("TEMP: ")) { value3 = "targetAssembly=.\\LethalModManager\\Profiles\\" + ProfileDropdownText.text + "\\BepInEx\\core\\BepInEx.Preloader.dll"; } else { string text8 = ProfileDropdownText.text; value3 = "targetAssembly=.\\LethalModManager\\TempProfiles\\" + text8.Substring(5, text8.Length - 5) + "\\BepInEx\\core\\BepInEx.Preloader.dll"; } } else { value3 = Paths.BepInExAssemblyDirectory + "\\BepInEx.Preloader.dll"; } } else { value3 = "targetAssembly=BepInEx\\core\\BepInEx.Preloader.dll"; } doorstopSettings[index] = (string)value3; } } LMM_ModHandler.QuickReload(); }); ((UnityEvent)Actions.Find<Button>("Thunderstore/ReverseSort").onClick).AddListener((UnityAction)delegate { //IL_0035: Unknown result type (might be due to invalid IL or missing references) LMM_ModHandler.TS_Reversed = !LMM_ModHandler.TS_Reversed; ((Transform)Actions.Find<RectTransform>("Thunderstore/ReverseSort/Text")).eulerAngles = new Vector3(0f, 0f, (float)(LMM_ModHandler.TS_Reversed ? 90 : (-90))); LMM_ModHandler.TS_SearchChoice.Reverse(); UpdatePage(0); }); ModManager.MLS.LogWarning((object)"FFFFFFFFFFFFFFFFF"); Actions.Find<Dropdown>("Thunderstore/SortDropdown").ClearOptions(); Actions.Find<Dropdown>("Thunderstore/SortDropdown").AddOptions(new List<string>(8) { "Last Updated", "Last Released", "Most Downloads", "Most Dependents", "Most Likes", "Most Dependencies", "Most Versions", "Latest Size" }); ((UnityEvent<int>)(object)Actions.Find<Dropdown>("Thunderstore/SortDropdown").onValueChanged).AddListener((UnityAction<int>)delegate(int Value) { ResortData(Value); }); Actions.Find<Dropdown>("Thunderstore/CountDropdown").ClearOptions(); Actions.Find<Dropdown>("Thunderstore/CountDropdown").AddOptions(new List<string>(7) { "12 Results", "18 Results", "24 Results", "36 Results", "48 Results", "72 Results", "96 Results" }); ((UnityEvent<int>)(object)Actions.Find<Dropdown>("Thunderstore/CountDropdown").onValueChanged).AddListener((UnityAction<int>)delegate(int Value) { LMM_ModHandler.TS_Count = (int.TryParse(Actions.Find<Dropdown>("Thunderstore/CountDropdown").options[Value].text.Replace(" Results", ""), out var result3) ? result3 : 12); UpdatePage(LMM_ModHandler.TS_Offset); }); ModManager.MLS.LogWarning((object)"FFFFFFFFFFFFFFFFF"); Actions.Find<Dropdown>("Thunderstore/CountDropdown").value = 0; ((UnityEvent)Actions.Find<Button>("Thunderstore/SearchButton").onClick).AddListener((UnityAction)delegate { string Text = Actions.Find<InputField>("Thunderstore/Search").text.ToUpper(); LMM_ModHandler.TS_SearchChoice = LMM_ModHandler.TS_Search; if (Text.StartsWith(";")) { string text5 = Text; Text = text5.Substring(1, text5.Length - 1); LMM_ModHandler.TS_SearchChoice = LMM_ModHandler.TS_SearchChoice.Where(delegate(ModListing x) { int result2; if (!x.Tags.Contains("Modpacks")) { VersionListing? versionListing = x.Versions.FirstOrDefault(); result2 = ((versionListing != null && versionListing.Dependencies?.Count < 10) ? 1 : 0); } else { result2 = 0; } return (byte)result2 != 0; }).ToList(); } LMM_ModHandler.TS_SearchChoice = LMM_ModHandler.TS_SearchChoice.Where((ModListing x) => x.Full_Name.ToUpper().Contains(Text) || x.Versions.FirstOrDefault().Desc.ToUpper().Contains(Text)).ToList(); UpdatePage(0); }); ModManager.MLS.LogWarning((object)"FFFFFFFFFFFFFFFFF"); ((UnityEvent)Actions.Find<Button>("Thunderstore/FirstPage").onClick).AddListener((UnityAction)delegate { UpdatePage(0); }); ((UnityEvent)Actions.Find<Button>("Thunderstore/DoubleBackPage").onClick).AddListener((UnityAction)delegate { UpdatePage(LMM_ModHandler.TS_Offset - 2 * LMM_ModHandler.TS_Count); }); ((UnityEvent)Actions.Find<Button>("Thunderstore/BackPage").onClick).AddListener((UnityAction)delegate { UpdatePage(LMM_ModHandler.TS_Offset - LMM_ModHandler.TS_Count); }); ((UnityEvent<string>)(object)Actions.Find<InputField>("Thunderstore/InputPage").onEndEdit).AddListener((UnityAction<string>)delegate(string Input) { UpdatePage((int.Parse(Input) - 1) * LMM_ModHandler.TS_Count); }); ((UnityEvent)Actions.Find<Button>("Thunderstore/NextPage").onClick).AddListener((UnityAction)delegate { UpdatePage(LMM_ModHandler.TS_Offset + LMM_ModHandler.TS_Count); }); ((UnityEvent)Actions.Find<Button>("Thunderstore/DoubleNextPage").onClick).AddListener((UnityAction)delegate { UpdatePage(LMM_ModHandler.TS_Offset + 2 * LMM_ModHandler.TS_Count); }); ((UnityEvent)Actions.Find<Button>("Thunderstore/LastPage").onClick).AddListener((UnityAction)delegate { UpdatePage(Mathf.FloorToInt((float)LMM_ModHandler.TS_SearchChoice.Count / (float)LMM_ModHandler.TS_Count) * LMM_ModHandler.TS_Count); }); string[] AutoRequired = new string[6] { "Equipment", "Items", "Monsters", "Moons", "Furniture", "Modpacks" }; int AllSetting = 1; Actions.Find<Text>("Host/SetAllPriority/Text").text = "Set All Preferred"; ((UnityEvent)Actions.Find<Button>("Host/SetAllPriority").onClick).AddListener((UnityAction)delegate { for (int m = 0; m < LP_Host.childCount; m++) { LMM_ModSlot component3 = ((Component)LP_Host.GetChild(m)).GetComponent<LMM_ModSlot>(); if (!((Object)(object)component3 == (Object)null)) { switch (AllSetting) { case 0: component3.SetState(ModSlotState.Optional); break; case 1: component3.SetState(ModSlotState.Preferred); break; case -1: component3.SetState(ModSlotState.Required); break; default: { ModListing mod = component3.ModInfo.GetMod(); if (mod == null) { continue; } if (mod.Tags.Contains("Translations")) { component3.SetState(ModSlotState.Optional); } else if (mod.Tags.FirstOrDefault((string x) => AutoRequired.Contains(x)) != null || (mod.Tags.Contains("Server-side") && mod.Tags.Contains("Client-side"))) { component3.SetState(ModSlotState.Required); } else { component3.SetState(ModSlotState.Preferred); } break; } } component3.UpdateBorderByState(); } } AllSetting = (AllSetting + 2) % 4 - 1; Actions.Find<Text>("Host/SetAllPriority/Text").text = ((AllSetting == 0) ? "Set All Optional" : ((AllSetting == 1) ? "Set All Preferred" : ((AllSetting == -1) ? "Set All Required" : "Set All Mods Auto"))); }); ButtonClickedEvent onClick6 = Actions.Find<Button>("Host/OpenLobby").onClick; object obj6 = <>c.<>9__34_20; if (obj6 == null) { UnityAction val6 = delegate { ModManager.MLS.LogFatal((object)"Attempting to open lobby via mod sync."); using WebClient webClient = new WebClient(); Dictionary<string, int> dictionary2 = new Dictionary<string, int>(); for (int l = 0; l < LP_Host.childCount; l++) { LMM_ModSlot component2 = ((Component)LP_Host.GetChild(l)).GetComponent<LMM_ModSlot>(); dictionary2.Add(component2.ModInfo.Full_Version, (component2.State != ModSlotState.Optional) ? ((component2.State == ModSlotState.Preferred) ? 1 : (-1)) : 0); } ((Component)LMM_Canvas).gameObject.SetActive(false); Dictionary<string, object> dictionary3 = new Dictionary<string, object> { ["Mods"] = dictionary2, ["Configs"] = LMM_ModHandler.CompressConfigs() }; string data = "#lethalmodmanager\n" + Convert.ToBase64String(Encoding.ASCII.GetBytes(JsonConvert.SerializeObject((object)dictionary3))); webClient.Headers.Add("Content-Type", "application/octet-stream"); string text4 = webClient.UploadString("https://thunderstore.io/api/experimental/legacyprofile/create/", data); Dictionary<string, object> dictionary4 = JsonConvert.DeserializeObject<Dictionary<string, object>>(text4); ModManager.MLS.LogWarning((object)text4); if (!dictionary4.TryGetValue("key", out var value2)) { FailedOpenLobby = Time.time + 1f; } else { ModManager.ModSyncKey = value2.ToString(); ModManager.ModSyncCount = dictionary2.Count; ModManager.MLS.LogWarning((object)ModManager.ModSyncKey); ModManager.OpeningLobby = true; Object.FindObjectOfType<MenuManager>().ConfirmHostButton(); } }; <>c.<>9__34_20 = val6; obj6 = (object)val6; } ((UnityEvent)onClick6).AddListener((UnityAction)obj6); ButtonClickedEvent onClick7 = Actions.Find<Button>("LobbyMods/ApplyAll").onClick; object obj7 = <>c.<>9__34_21; if (obj7 == null) { UnityAction val7 = delegate { for (int k = 0; k < LP_LobbyMods.childCount; k++) { ((Component)LP_LobbyMods.GetChild(k)).GetComponent<LMM_ModSlot>()?.SetState(ModSlotState.Preferred); } }; <>c.<>9__34_21 = val7; obj7 = (object)val7; } ((UnityEvent)onClick7).AddListener((UnityAction)obj7); Actions.Find<Text>("LobbyMods/Download/Text").text = "Install/Launch"; ((UnityEvent)Actions.Find<Button>("LobbyMods/Download").onClick).AddListener((UnityAction)delegate { LMM_ModHandler.CreateProfile(ModManager.JoiningLobbyId.ToString(), TempProfile: true); for (int i = 0; i < LP_LobbyMods.childCount; i++) { LMM_ModSlot component = ((Component)LP_LobbyMods.GetChild(i)).GetComponent<LMM_ModSlot>(); if ((Object)(object)component != (Object)null && (component.State == ModSlotState.Preferred || component.State == ModSlotState.Forced)) { component.ModInfo.Download(IncludeDependencies: false, ModManager.JoiningLobbyId.ToString(), SaveToTempProfile: true, IgnoreConfigs: true); } } string text = Path.Combine(ModManager.DIR_TempProfiles.FullName, ModManager.JoiningLobbyId.ToString()); Match match = Regex.Match(ConfigsToDownload, "LMM\\$.+\\n"); while (match.Success) { ModManager.MLS.LogWarning((object)match.Index); string value = match.Value; string path = text + "\\BepInEx\\" + value.Substring(4, value.Length - 1 - 4).Replace('/', '\\'); int num = match.Index + match.Length; match = match.NextMatch(); new DirectoryInfo(path).Parent.Create(); string configsToDownload = ConfigsToDownload; int num2 = num; File.WriteAllText(path, configsToDownload.Substring(num2, (match.Success ? (match.Index - 1) : ConfigsToDownload.Length) - num2)); } string text2 = SaveProfileInput.text.Trim(); for (int j = 0; j < ModManager.DoorstopSettings.Count; j++) { string text3 = ModManager.DoorstopSettings[j]; if (text3.StartsWith("targetAssembly=")) { ModManager.DoorstopSettings[j] = $"targetAssembly=.\\LethalModManager\\TempProfiles\\{ModManager.JoiningLobbyId}\\BepInEx\\core\\BepInEx.Preloader.dll"; } } LMM_ModHandler.QuickReload(ModManager.JoiningLobbyId); }); ListPanel = LMM_Canvas.Find("Menu/ListPanel"); LP_Local = ListPanel.Find("Local"); LP_Thunderstore = Object.Instantiate<Transform>(LP_Local, ListPanel, false); ((Object)LP_Thunderstore).name = "Thunderstore"; LP_Downloads = Object.Instantiate<Transform>(LP_Local, ListPanel, false); ((Object)LP_Downloads).name = "Downloads"; LP_Host = Object.Instantiate<Transform>(LP_Local, ListPanel, false); ((Object)LP_Host).name = "Host"; LP_Config = Object.Instantiate<Transform>(LP_Local, ListPanel, false); ((Object)LP_Config).name = "Config"; LP_LobbyMods = Object.Instantiate<Transform>(LP_Local, ListPanel, false); ((Object)LP_LobbyMods).name = "LobbyMods"; LP_LobbyConfigs = Object.Instantiate<Transform>(LP_Local, ListPanel, false); ((Object)LP_LobbyConfigs).name = "LobbyConfigs"; LMM_ModHandler.UserMods = LMM_ModHandler.GetMods(); Dictionary<string, ModInfo> dictionary = new Dictionary<string, ModInfo>(); foreach (string item in Directory.EnumerateFiles(".\\LethalModManager\\ModStorage", "*.zip")) { if (!ModInfo.TryParse(Path.GetFileNameWithoutExtension(item), out var result)) { continue; } string full_Name = result.Full_Name; if (dictionary.ContainsKey(full_Name)) { if (dictionary[full_Name].Version < result.Version) { dictionary[full_Name] = result; } } else { dictionary.TryAdd(full_Name, result); } } foreach (KeyValuePair<string, ModInfo> item2 in dictionary) { AddModToUI(item2.Value.Full_Version, LP_Downloads); } foreach (KeyValuePair<string, ModManifestV1> userMod in LMM_ModHandler.UserMods) { AddModToUI($"{userMod.Key}-{userMod.Value.Version}", LP_Local, userMod.Value); if (userMod.Value.UserEnabled) { Instance.AddModToUI($"{userMod.Key}-{userMod.Value.Version}", LP_Host, userMod.Value, ModSlotState.Preferred); } } UpdateUI = true; SwitchedPanel = true; ResortData(0); Object.DontDestroyOnLoad((Object)(object)LMM_Canvas); ((Component)LMM_Canvas).gameObject.SetActive(false); ((Component)LMM_Canvas.Find("Tint")).gameObject.SetActive(true); ManualLogSource mLS = ModManager.MLS; Scene activeScene = SceneManager.GetActiveScene(); mLS.LogWarning((object)("Scene: " + ((Scene)(ref activeScene)).name + " | Loaded LMM_UI.")); } catch (Exception ex) { BreakUI = true; ModManager.MLS.LogError((object)"[LMM]: Unexpected error, disabling to prevent error spam."); ModManager.MLS.LogError((object)ex); } } } public enum LaunchOptions { None, Online, LAN } public enum DependentVersionChecks { Once, Latest, All } [DefaultExecutionOrder(int.MaxValue)] [BepInPlugin("Kyxino.LethalModManager", "LethalModManager", "0.1.6")] public class ModManager : BaseUnityPlugin { private readonly Harmony HarmonyX = new Harmony("Kyxino.LethalModManager"); public const string ModVersion = "0.1.6"; internal static ManualLogSource MLS = Logger.CreateLogSource("Kyxino.LethalModManager"); public static ModManager Instance; public static ConfigFile LMM_Config = new ConfigFile(Path.Combine("LethalModManager", "Settings.cfg"), true, MetadataHelper.GetMetadata(typeof(ModManager))); public static ConfigFile Mod_Config = new ConfigFile(Path.Combine(Paths.ConfigPath, "Kyxino.LethalModManager.cfg"), true, MetadataHelper.GetMetadata(typeof(ModManager))); public static ConfigEntry<bool> Active_LobbySearcher = Mod_Config.Bind<bool>("Active Settings", "LobbySearcher", true, "[Needs Restarting] LMM's lobby search for mod sync compatibility. (Handles basic stuff that other things that override the vanilla one typically handles, this will eventually be replaced with a lobby search in the LMM UI that won't affect the vanilla one at some point.)"); public static ConfigEntry<bool> SharedRequiredInstantLoading = LMM_Config.Bind<bool>("Mod Sync Settings", "SharedRequiredInstantLoading", false, "Temporary setting for joining hosts and sharing the same required mods to instantly join rather than download a temp profile and what not. (Warning: This is more likely to cause you to accidentally have missing mods/configs.)"); public static ConfigEntry<float> PositionalRelativityToHostButtonMultiplier = Mod_Config.Bind<float>("Mods Button", "PositionalRelativityToHostButtonMultiplier", 1f, "If another button is above the Host button, please set this to 2."); public static ConfigEntry<float> UpdateTime = LMM_Config.Bind<float>("API Settings", "UpdateTime", 30f, "How long (in minutes) between every API request to update mod info."); public static ConfigEntry<bool> ForceUpdateUponOpening = LMM_Config.Bind<bool>("API Settings", "ForceUpdateUponOpening", false, "If the mod data should update every time the game is opened REGARDLESS of the update timer."); public static ConfigEntry<bool> ScaleUI = LMM_Config.Bind<bool>("UI Settings", "ScaleUI", true, "If the UI should scale with your screen ratio."); public static ConfigEntry<float> ScaleBetweenWidthToHeight = LMM_Config.Bind<float>("UI Settings", "ScaleBetweenWidthToHeight", 1f, "How the UI should scale with your screen ratio. (Width: 0 -> Height: 1)"); public static ConfigEntry<string> ModsButtonText = LMM_Config.Bind<string>("UI Settings", "LMM_ButtonText", "> LethalModManager", "Feel free to name it whatever you want. (Modpacks can't change your choice.)"); public static ConfigEntry<int> RetryLogoLoadingTimes = LMM_Config.Bind<int>("Thunderstore Settings", "RetryLogoLoadingTimes", 5, "How many times should LMM try to load a logo from online."); public static ConfigEntry<bool> SpecificModVersionLink = LMM_Config.Bind<bool>("Thunderstore Settings", "SpecificModVersionLink", false, "If clicking the Web icon on a mod should take you to the specific version."); public static ConfigEntry<bool> HideLinkIfMissingVersion = LMM_Config.Bind<bool>("Thunderstore Settings", "HideLinkIfMissingVersion", true, "If the Web icon should be hidden from a mod if missing the selected version."); public static ConfigEntry<bool> CountFlattenedDependencies = LMM_Config.Bind<bool>("Thunderstore Settings", "CountFlattenedDependencies", false, "If it should count flattened dependencies or just listed dependencies."); public static ConfigEntry<bool> SpecificModVersionDownloads = LMM_Config.Bind<bool>("Thunderstore Settings", "SpecificModVersionDownloads", false, "If it should only show the specific version's downloads."); public static ConfigEntry<bool> SpecificModVersionDependents = LMM_Config.Bind<bool>("Thunderstore Settings", "SpecificModVersionDependents", false, "If it should only count the dependents for the specific version."); public static ConfigEntry<DependentVersionChecks> ModpackVersionCheck = LMM_Config.Bind<DependentVersionChecks>("Thunderstore Settings", "ModpackVersionCheck", DependentVersionChecks.Once, "How it should calculate those dependents."); public static ConfigEntry<bool> ForcedLobbySearch = Mod_Config.Bind<bool>("Search Settings", "ForcedLobbySearch", false, "If this is enabled, it will forcibly replace lobby searching if you want it to work regardless of other lobby mods that may change it."); public static ConfigEntry<bool> IncludeFullLobbies = Mod_Config.Bind<bool>("Search Settings", "IncludeFullLobbies", false, "Whether or not to show full lobbies. (You are weird.)"); public static ConfigEntry<bool> OnlyShowModSyncLobbies = Mod_Config.Bind<bool>("Search Settings", "OnlyShowModSyncLobbies", false, "Whether or not to ONLY show lobbies with LMM hosts for mod sync."); public static DirectoryInfo DIR_LMM = Directory.CreateDirectory("LethalModManager"); public static DirectoryInfo DIR_ModCache = DIR_LMM.CreateSubdirectory("ModCache"); public static DirectoryInfo DIR_ModStorage = DIR_LMM.CreateSubdirectory("ModStorage"); public static DirectoryInfo DIR_TempProfiles = DIR_LMM.CreateSubdirectory("TempProfiles"); public static DirectoryInfo DIR_Profiles = DIR_LMM.CreateSubdirectory("Profiles"); public static DirectoryInfo DIR_LethalCompany = DIR_LMM.Parent; public static DirectoryInfo DIR_CurrentProfile = Directory.GetParent(Paths.BepInExRootPath); public static List<string> DoorstopSettings; public static bool IsQuickReloaded; public static LaunchOptions QR_AutoLaunchMode; public static string ModSyncKey; public static int ModSyncCount; public static bool OpeningLobby; public static ulong? JoiningLobbyId; public static bool HasQuickReloaded; public static bool SkippedLaunchModeMenu; public static bool QR_SkipSplash; public static bool QR_SkipBootAnim; public static bool QL_SkipSplash; public static bool QL_SkipBootAnim; public static LaunchOptions QL_AutoLaunchMode; public static bool SkipSplash; public static bool SkipBootAnim; public static bool SkipUpdatePopup; public static bool SkipLANPopup; public static LaunchOptions AutoLaunchMode; private void Awake() { Instance = this; MLS.LogWarning((object)GeneralExtensions.Join<string>((IEnumerable<string>)DoorstopSettings, (Func<string, string>)null, "\n")); if (IsQuickReloaded) { DoorstopSettings.Remove("isQuickReloaded=true"); DoorstopSettings.Remove("reloadLaunchMode=LAN"); DoorstopSettings.Remove("reloadLaunchMode=Online"); for (int i = 0; i < DoorstopSettings.Count; i++) { string text = DoorstopSettings[i]; if (text.StartsWith("targetAssembly=")) { DoorstopSettings[i] = "targetAssembly=BepInEx\\core\\BepInEx.Preloader.dll"; } } File.WriteAllLines(Path.Combine(Paths.GameRootPath, "doorstop_config.ini"), DoorstopSettings.Where((string x) => !x.StartsWith("joiningLobbyId"))); } else { try { DirectoryInfo[] directories = DIR_TempProfiles.GetDirectories(); foreach (DirectoryInfo directoryInfo in directories) { directoryInfo.Delete(recursive: true); } } catch (Exception ex) { MLS.LogWarning((object)ex.Message); } } QuickLoad(); ((Object)((Component)this).gameObject).hideFlags = (HideFlags)63; Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject); ((Object)((Component)this).gameObject).name = "LethalModManager"; ((Component)this).gameObject.AddComponent<LMM_UI>(); MLS.LogInfo((object)"Loaded LethalModManager, patching."); JsonConvert.DefaultSettings = () => new JsonSerializerSettings { Converters = new List<JsonConverter> { (JsonConverter)(object)new ModInfoConverter() } }; HarmonyX.PatchAll(typeof(LMM_LobbySearcher)); HarmonyX.PatchAll(typeof(LMM_ModHandler)); HarmonyX.PatchAll(typeof(LMM_ModSyncer)); DirectoryInfo directoryInfo2 = new DirectoryInfo(Path.Combine(Paths.GameRootPath, "DELETE")); if (directoryInfo2.Exists) { directoryInfo2.Delete(recursive: true); } directoryInfo2.Create(); string[] files = Directory.GetFiles(Paths.GameRootPath, "*.lmm-delete", SearchOption.AllDirectories); foreach (string path in files) { try { File.Delete(path); } catch (Exception ex2) { MLS.LogError((object)ex2.Message); } } string[] files2 = Directory.GetFiles(Paths.BepInExRootPath, "*.lmm-delete", SearchOption.AllDirectories); foreach (string path2 in files2) { try { File.Delete(path2); } catch (Exception ex3) { MLS.LogError((object)ex3.Message); } } LMM_ModHandler.CreateProfile("Main Directory"); } private void QuickLoad() { if (HasQuickReloaded) { return; } HasQuickReloaded = true; SceneManager.sceneLoaded += OnSceneLoaded; HarmonyX.PatchAll(typeof(ModManager)); if (!SkipSplash) { return; } Task.Run(delegate { while (!SkippedLaunchModeMenu) { SplashScreen.Stop((StopBehavior)0); } MLS.LogWarning((object)SplashScreen.isFinished); }); } private static void OnSceneLoaded(Scene scene, LoadSceneMode mode) { if (((Scene)(ref scene)).name == "InitScene" || ((Scene)(ref scene)).name == "InitSceneLANMode") { SkippedLaunchModeMenu = true; if (SkipBootAnim) { InitializeGame val = Object.FindObjectOfType<InitializeGame>(); if (!((Object)(object)val == (Object)null)) { val.runBootUpScreen = false; } } } else { if (!(((Scene)(ref scene)).name == "MainMenu")) { return; } SkippedLaunchModeMenu = true; if (SkipUpdatePopup) { GameNetworkManager.Instance.firstTimeInMenu = false; } if (!SkipLANPopup) { return; } MenuManager obj = Object.FindObjectOfType<MenuManager>(); if (obj != null) { GameObject lanWarningContainer = obj.lanWarningContainer; if (lanWarningContainer != null) { lanWarningContainer.SetActive(false); } } } } [HarmonyPrefix] [HarmonyPatch(typeof(PreInitSceneScript), "SkipToFinalSetting")] public static bool SkipToFinalSetting(PreInitSceneScript __instance) { if (AutoLaunchMode == LaunchOptions.None) { return SkippedLaunchModeMenu = true; } GameObject launchSettingsPanelsContainer = __instance.launchSettingsPanelsContainer; if (launchSettingsPanelsContainer != null) { launchSettingsPanelsContainer.SetActive(false); } if (SkippedLaunchModeMenu) { return false; } SkippedLaunchModeMenu = true; SceneManager.LoadScene((AutoLaunchMode == LaunchOptions.LAN) ? "InitSceneLANMode" : "InitScene"); return false; } static ModManager() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Expected O, but got Unknown string[] array = File.ReadAllLines(Path.Combine(Paths.GameRootPath, "doorstop_config.ini")); List<string> list = new List<string>(array.Length); string[] array2 = array; foreach (string item in array2) { list.Add(item); } DoorstopSettings = list; IsQuickReloaded = DoorstopSettings.Contains("isQuickReloaded=true"); string text = DoorstopSettings.Where((string x) => x.StartsWith("reloadLaunchMode=")).LastOrDefault(); if (1 == 0) { } LaunchOptions qR_AutoLaunchMode = ((text == "reloadLaunchMode=Online") ? LaunchOptions.Online : ((text == "reloadLaunchMode=LAN") ? LaunchOptions.LAN : LaunchOptions.None)); if (1 == 0) { } QR_AutoLaunchMode = qR_AutoLaunchMode; OpeningLobby = false; JoiningLobbyId = (ulong.TryParse(DoorstopSettings.Where((string x) => x.StartsWith("joiningLobbyId=")).LastOrDefault()?.Replace("joiningLobbyId=", ""), out var result) ? new ulong?(result) : null); HasQuickReloaded = false; SkippedLaunchModeMenu = false; QR_SkipSplash = Mod_Config.Bind<bool>("Quick Reload", "SkipSplash", true, "Whether or not to skip the Unity/Zeekerss splash screen when quick reloading.").Value; QR_SkipBootAnim = Mod_Config.Bind<bool>("Quick Reload", "SkipBootAnim", true, "Whether or not to skip the OS boot animation when quick reloading.").Value; QL_SkipSplash = Mod_Config.Bind<bool>("Quick Launch", "SkipSplash", false, "Whether or not to skip the Unity/Zeekerss splash screen.").Value; QL_SkipBootAnim = Mod_Config.Bind<bool>("Quick Launch", "SkipBootAnim", false, "Whether or not to skip the OS boot animation.").Value; QL_AutoLaunchMode = Mod_Config.Bind<LaunchOptions>("Quick Launch", "AutoLaunchMode", LaunchOptions.None, "What mode should be automatically selected.").Value; SkipSplash = (IsQuickReloaded ? QR_SkipSplash : QL_SkipSplash); SkipBootAnim = (IsQuickReloaded ? QR_SkipBootAnim : QL_SkipBootAnim); SkipUpdatePopup = Mod_Config.Bind<bool>("Quick Launch", "SkipUpdatePopup", false, "Whether or not to skip the update popup.").Value; SkipLANPopup = Mod_Config.Bind<bool>("Quick Launch", "SkipLANPopup", false, "Whether or not to skip the LAN popup.").Value; AutoLaunchMode = (IsQuickReloaded ? QR_AutoLaunchMode : QL_AutoLaunchMode); } } [GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] [DebuggerNonUserCode] [CompilerGenerated] internal class Resource1 { private static ResourceManager resourceMan; private static CultureInfo resourceCulture; [EditorBrowsable(EditorBrowsableState.Advanced)] internal static ResourceManager ResourceManager { get { if (resourceMan == null) { ResourceManager resourceManager = new ResourceManager("LethalModManager.Resource1", typeof(Resource1).Assembly); resourceMan = resourceManager; } return resourceMan; } } [EditorBrowsable(EditorBrowsableState.Advanced)] internal static CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } } internal static byte[] LethalModManagerUI { get { object @object = ResourceManager.GetObject("LethalModManagerUI", resourceCulture); return (byte[])@object; } } internal Resource1() { } } internal class LMM_LobbySearcher { [HarmonyPostfix] [HarmonyPatch(typeof(SteamLobbyManager), "loadLobbyListAndFilter")] private static void LobbyListFilter(SteamLobbyManager __instance, ref IEnumerator __result) { __result = LMM_Utils.HarmonyEnumerator(__result, null, delegate { //IL_0028: 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) LobbySlot val2 = ((Component)__instance.levelListContainer).GetComponentsInChildren<LobbySlot>().LastOrDefault(); if (!((Object)(object)val2 == (Object)null)) { Lobby thisLobby2 = val2.thisLobby; if (!Utility.IsNullOrWhiteSpace(((Lobby)(ref thisLobby2)).GetData("LMM_Sync"))) { ((TMP_Text)((Component)val2).transform.Find<TextMeshProUGUI>("JoinButton/Text (TMP)")).text = "Sync"; } ((TMP_Text)val2.LobbyName).text = ((Lobby)(ref thisLobby2)).GetData("name"); ((TMP_Text)val2.playerCount).text = $"{((Lobby)(ref thisLobby2)).MemberCount} / {((Lobby)(ref thisLobby2)).MaxMembers}"; if (!Utility.IsNullOrWhiteSpace(((Lobby)(ref thisLobby2)).GetData("LMM_Mods"))) { TextMeshProUGUI playerCount2 = val2.playerCount; ((TMP_Text)playerCount2).text = ((TMP_Text)playerCount2).text + " (" + ((Lobby)(ref thisLobby2)).GetData("LMM_Mods") + " Mods | v" + ((Lobby)(ref thisLobby2)).GetData("vers") + ")"; } if (!Utility.IsNullOrWhiteSpace(((Lobby)(ref thisLobby2)).GetData("LethalModManager"))) { ((Component)val2).transform.SetAsFirstSibling(); } } }, null, null, delegate { //IL_0028: 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) LobbySlot val = ((Component)__instance.levelListContainer).GetComponentsInChildren<LobbySlot>().LastOrDefault(); if (!((Object)(object)val == (Object)null)) { Lobby thisLobby = val.thisLobby; if (!Utility.IsNullOrWhiteSpace(((Lobby)(ref thisLobby)).GetData("LMM_Sync"))) { ((TMP_Text)((Component)val).transform.Find<TextMeshProUGUI>("JoinButton/Text (TMP)")).text = "Sync"; } ((TMP_Text)val.LobbyName).text = ((Lobby)(ref thisLobby)).GetData("name"); ((TMP_Text)val.playerCount).text = $"{((Lobby)(ref thisLobby)).MemberCount} / {((Lobby)(ref thisLobby)).MaxMembers}"; if (!Utility.IsNullOrWhiteSpace(((Lobby)(ref thisLobby)).GetData("LMM_Mods"))) { TextMeshProUGUI playerCount = val.playerCount; ((TMP_Text)playerCount).text = ((TMP_Text)playerCount).text + " (" + ((Lobby)(ref thisLobby)).GetData("LMM_Mods") + " Mods | v" + ((Lobby)(ref thisLobby)).GetData("vers") + ")"; } if (!Utility.IsNullOrWhiteSpace(((Lobby)(ref thisLobby)).GetData("LethalModManager"))) { ((Component)val).transform.SetAsFirstSibling(); } } }); } private static async void LobbyRedo(SteamLobbyManager __instance) { if (!GameNetworkManager.Instance.waitingForLobbyDataRefresh) { Coroutine loadLobbyListCoroutine = LMM_Utils.GetField<Coroutine>(__instance, "loadLobbyListCoroutine"); if (loadLobbyListCoroutine != null) { ((MonoBehaviour)__instance).StopCoroutine(loadLobbyListCoroutine); } LMM_Utils.SetField(__instance, "refreshServerListTimer", 0f); ((TMP_Text)__instance.serverListBlankText).text = "Loading server list..."; LobbySlot[] LobbySlots = Object.FindObjectsOfType<LobbySlot>(); LobbySlot[] array = LobbySlots; foreach (LobbySlot Destroy in array) { Object.Destroy((Object)(object)((Component)Destroy).gameObject); } Debug.Log((object)"Requested server list"); GameNetworkManager.Instance.waitingForLobbyDataRefresh = true; int sortByDistanceSetting = __instance.sortByDistanceSetting; if (1 == 0) { } LobbyQuery lobbyList; LobbyQuery val; switch (sortByDistanceSetting) { case 0: lobbyList = SteamMatchmaking.LobbyList; val = ((LobbyQuery)(ref lobbyList)).FilterDistanceClose(); break; case 1: lobbyList = SteamMatchmaking.LobbyList; val = ((LobbyQuery)(ref lobbyList)).FilterDistanceFar(); break; default: lobbyList = SteamMatchmaking.LobbyList; val = ((LobbyQuery)(ref lobbyList)).FilterDistanceWorldwide(); break; } if (1 == 0) { } LobbyQuery lobbyQuery = val; if (!LMM_Utils.GetField<bool>(__instance, "sortWithChallengeMoons")) { lobbyQuery = ((LobbyQuery)(ref lobbyQuery)).WithKeyValue("chal", "f"); } if (__instance.serverTagInputField.text != string.Empty) { lobbyQuery = ((LobbyQuery)(ref lobbyQuery)).WithKeyValue("tag", __instance.serverTagInputField.text.Substring(0, Mathf.Min(19, __instance.serverTagInputField.text.Length)).ToLower()); } val = ((LobbyQuery)(ref lobbyQuery)).WithSlotsAvailable((!ModManager.IncludeFullLobbies.Value) ? 1 : 0); Lobby[] AllLobbies = (await ((LobbyQuery)(ref val)).RequestAsync())?.ToArray(); Lobby[] currentLobbyList = LMM_Utils.SetField(__instance, "currentLobbyList", AllLobbies); GameNetworkManager.Instance.waitingForLobbyDataRefresh = false; if (currentLobbyList != null) { Debug.Log((object)"Got lobby list!"); LMM_Utils.InvokeMethod(__instance, "DebugLogServerList"); ((Component)__instance.serverListBlankText).gameObject.SetActive(currentLobbyList.Length == 0); ((TMP_Text)__instance.serverListBlankText).text = "No available servers to join."; LMM_Utils.SetField(__instance, "lobbySlotPositionOffset", 0f); LMM_Utils.SetField<Coroutine>(__instance, "loadLobbyListCoroutine", ((MonoBehaviour)__instance).StartCoroutine((IEnumerator)LMM_Utils.InvokeMethod(__instance, "loadLobbyListAndFilter", new object[1] { currentLobbyList }))); } else { Debug.Log((object)"Lobby list is null after request."); ((Component)__instance.serverListBlankText).gameObject.SetActive(true); ((TMP_Text)__instance.serverListBlankText).text = "No available servers to join."; } } } [HarmonyPrefix] [HarmonyPatch(typeof(SteamLobbyManager), "LoadServerList")] [HarmonyAfter(new string[] { "me.swipez.melonloader.morecompany" })] private static bool UnfortunateForcedPatch(SteamLobbyManager __instance) { if (!ModManager.ForcedLobbySearch.Value) { return true; } LobbyRedo(__instance); return false; } [HarmonyPostfix] [HarmonyPatch(typeof(SteamLobbyManager), "OnEnable")] private static void FixLobbySearchList(SteamLobbyManager __instance, Transform ___levelListContainer) { ContentSizeFitter val = ((Component)___levelListContainer).gameObject.AddComponent<ContentSizeFitter>(); val.verticalFit = (FitMode)2; VerticalLayoutGroup val2 = ((Component)___levelListContainer).gameObject.AddComponent<VerticalLayoutGroup>(); ((HorizontalOrVerticalLayoutGroup)val2).childControlHeight = false; ((HorizontalOrVerticalLayoutGroup)val2).spacing = 2f; } } internal static class LMM_ModHandler { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Func<KeyValuePair<ModInfo, int>, string> <>9__21_0; public static Func<KeyValuePair<ModInfo, int>, (ModInfo Key, int Value)> <>9__21_1; public static Func<KeyValuePair<string, (ModInfo Key, int Value)>, ModInfo> <>9__21_2; public static Func<KeyValueP