Some mods target the Mono version of the game, which is available by opting into the Steam beta branch "alternate"
Decompiled source of UpdatesChecker v1.0.8
UpdatesChecker.dll
Decompiled 4 days agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Net; using System.Net.Http; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Threading.Tasks; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppSystem.Collections; using MelonLoader; using MelonLoader.Preferences; using Microsoft.CodeAnalysis; using Newtonsoft.Json; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; 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: MelonInfo(typeof(UpdatesChecker), "UpdatesChecker", "1.0.8", "DiumStream", null)] [assembly: MelonGame("TVGS", "Schedule I")] [assembly: AssemblyMetadata("NexusModID", "795")] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyVersion("0.0.0.0")] 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; } } } public class UpdatesChecker : MelonMod { private const string API_URL = "https://api.nexusmods.com/v1"; private const string CACHE_FILE = "UserData/UpdatesChecker/UpdateChecker.json"; private const string INCOMPATIBLE_FILE = "UserData/UpdatesChecker/incompatibles.json"; private static readonly HttpClient client = new HttpClient(); public static List<ModUpdate> updatesAvailable = new List<ModUpdate>(); public static List<ModInfo> incompatibleMods = new List<ModInfo>(); public static UpdatesChecker instance = null; private string apiKey = "5vq3WA+dXKVc15kf6UVokvkKErtqAH5Uwkqo6AlxdTyP--q+9hgsBPe788KCWX--6KH/XjJ7YCFh+s0G1EcSEQ=="; private DateTime lastAPICall = DateTime.MinValue; private const int RATE_LIMIT_DELAY = 500; public override void OnInitializeMelon() { Config.Load(); instance = this; MelonLogger.Msg(Lang.Get("checking_updates")); client.DefaultRequestHeaders.Add("apikey", apiKey); string path = Path.GetDirectoryName("UserData/UpdatesChecker/UpdateChecker.json") ?? throw new InvalidOperationException("Invalid cache path"); Directory.CreateDirectory(path); ModsUI.Initialize((MelonMod)(object)this); MelonCoroutines.Start(StartupUpdateCheck()); } private IEnumerator StartupUpdateCheck() { yield return CheckForUpdatesAsync(); SaveCache(); GameObject? modWindow = ModsUI.modWindow; if (modWindow != null && modWindow.activeSelf) { ModsUI.UpdateWindowContent(); } } public IEnumerator CheckForUpdatesAsync() { Task task; try { task = CheckForUpdates(); } catch (Exception ex2) { Exception ex = ex2; MelonLogger.Error(Lang.Get("cache_error", ex.Message)); yield break; } while (!task.IsCompleted) { yield return null; } if (task.Exception != null) { MelonLogger.Error(Lang.Get("cache_error", task.Exception.InnerException?.Message ?? task.Exception.Message)); yield break; } MelonLogger.Msg(Lang.Get("updates_found", updatesAvailable.Count)); SaveCache(); GameObject? modWindow = ModsUI.modWindow; if (modWindow != null && modWindow.activeSelf) { ModsUI.UpdateWindowContent(); } } public async Task CheckForUpdates() { updatesAvailable.Clear(); List<ModInfo> mods = GetInstalledMods(); foreach (ModInfo mod in mods) { if (mod.NexusID <= 0) { continue; } try { double timeSinceLastCall = (DateTime.Now - lastAPICall).TotalMilliseconds; if (timeSinceLastCall < 500.0) { await Task.Delay(500 - (int)timeSinceLastCall); } string url = $"{"https://api.nexusmods.com/v1"}/games/schedule1/mods/{mod.NexusID}.json"; HttpResponseMessage response = await client.GetAsync(url); lastAPICall = DateTime.Now; if (response.StatusCode == HttpStatusCode.TooManyRequests) { MelonLogger.Warning(Lang.Get("rate_limit")); await Task.Delay(60000); continue; } if (!response.IsSuccessStatusCode) { MelonLogger.Warning(Lang.Get("http_code", mod.Name, response.StatusCode)); continue; } NexusModInfo latest = JsonConvert.DeserializeObject<NexusModInfo>(await response.Content.ReadAsStringAsync()); if (latest == null) { MelonLogger.Warning(Lang.Get("invalid_api_response", mod.Name)); } else if (!VersionMatch(mod.Version, latest.Version)) { updatesAvailable.Add(new ModUpdate { ModName = mod.Name, CurrentVersion = mod.Version, LatestVersion = latest.Version }); if (mod.Name == "UpdatesChecker") { LogSelfCheckResult(mod.Version, latest.Version); } } } catch (HttpRequestException ex2) when (ex2.StatusCode.GetValueOrDefault() == HttpStatusCode.TooManyRequests) { MelonLogger.Warning(Lang.Get("rate_limit")); await Task.Delay(60000); } catch (Exception ex3) { Exception ex = ex3; if (mod.Name == "UpdatesChecker") { MelonLogger.Error("Self-check failed: " + ex.Message); continue; } MelonLogger.Error(Lang.Get("error_mod", mod.Name, ex.Message)); } } } private void SaveCache() { try { File.WriteAllText("UserData/UpdatesChecker/UpdateChecker.json", JsonConvert.SerializeObject((object)updatesAvailable, (Formatting)1)); File.WriteAllText("UserData/UpdatesChecker/incompatibles.json", JsonConvert.SerializeObject((object)incompatibleMods, (Formatting)1)); } catch (Exception ex) { MelonLogger.Error(Lang.Get("cache_save_error", ex.Message)); } } private void LogSelfCheckResult(string current, string latest) { string text = (VersionMatch(current, latest) ? "✓ Up to date" : ("⚠\ufe0f Update available: " + current + " → " + latest)); MelonLogger.Msg("[Auto-Check] UpdatesChecker " + text); } private bool VersionMatch(string current, string latest) { try { Version version = new Version(current); Version version2 = new Version(latest); return version >= version2; } catch { return string.Equals(current, latest, StringComparison.OrdinalIgnoreCase); } } private List<ModInfo> GetInstalledMods() { List<ModInfo> list = new List<ModInfo>(); incompatibleMods.Clear(); int selfNexusId = GetSelfNexusId(); if (selfNexusId > 0) { list.Add(new ModInfo { Name = "UpdatesChecker", Version = "1.0.8", NexusID = selfNexusId, IsCompatible = true }); } foreach (MelonMod registeredMelon in MelonTypeBase<MelonMod>.RegisteredMelons) { if (!(((MelonBase)registeredMelon).Info.Name == "UpdatesChecker")) { int nexusIdFromMod = GetNexusIdFromMod(registeredMelon); bool flag = nexusIdFromMod > 0; ModInfo item = new ModInfo { Name = ((MelonBase)registeredMelon).Info.Name, Version = ((MelonBase)registeredMelon).Info.Version, NexusID = nexusIdFromMod, IsCompatible = flag }; list.Add(item); if (!flag) { incompatibleMods.Add(item); MelonLogger.Warning("[Incompatible] " + ((MelonBase)registeredMelon).Info.Name + " - No NexusModID"); } } } return list; } private int GetSelfNexusId() { try { Assembly executingAssembly = Assembly.GetExecutingAssembly(); IEnumerable<AssemblyMetadataAttribute> customAttributes = executingAssembly.GetCustomAttributes<AssemblyMetadataAttribute>(); foreach (AssemblyMetadataAttribute item in customAttributes) { if (item.Key.Equals("NexusModID", StringComparison.OrdinalIgnoreCase)) { if (int.TryParse(item.Value, out var result)) { return result; } MelonLogger.Error(Lang.Get("invalid_nexusid", "UpdateChecker", item.Value ?? "null")); return -1; } } } catch (Exception ex) { MelonLogger.Error(Lang.Get("cache_error", ex.Message)); } return -1; } private int GetNexusIdFromMod(MelonMod mod) { try { Assembly assembly = ((MelonBase)mod).MelonAssembly.Assembly; IEnumerable<AssemblyMetadataAttribute> customAttributes = assembly.GetCustomAttributes<AssemblyMetadataAttribute>(); foreach (AssemblyMetadataAttribute item in customAttributes) { if (item.Key.Equals("NexusModID", StringComparison.OrdinalIgnoreCase)) { if (int.TryParse(item.Value, out var result)) { return result; } MelonLogger.Error(Lang.Get("invalid_nexusid", ((MelonBase)mod).Info.Name, item.Value ?? "null")); return -1; } } } catch (Exception ex) { MelonLogger.Error(Lang.Get("cache_error", ex.Message)); } return -1; } } public class ModInfo { public string Name { get; set; } = string.Empty; public string Version { get; set; } = string.Empty; public int NexusID { get; set; } public bool IsCompatible { get; set; } } public class NexusModInfo { [JsonProperty("version")] public string Version { get; set; } = string.Empty; } public class ModUpdate { public string ModName { get; set; } = string.Empty; public string CurrentVersion { get; set; } = string.Empty; public string LatestVersion { get; set; } = string.Empty; } public static class Config { public static MelonPreferences_Category Category { get; private set; } public static MelonPreferences_Entry<string> Language { get; private set; } public static void Load() { Category = MelonPreferences.CreateCategory("UpdatesChecker_Settings", "Updates Checker"); Language = Category.CreateEntry<string>("Language", "en", "Language", "UI Language (en/fr/ru)", false, false, (ValueValidator)null, (string)null); } public static string GetLanguage() { return Language.Value.ToLower(); } } public static class Lang { public static string Get(string key, params object[] args) { string language = Config.GetLanguage(); if (1 == 0) { } string text2; if (!(language == "fr")) { if (language == "ru") { if (1 == 0) { } string text = key switch { "update_checker" => "ПРОВЕРКА ОБНОВЛЕНИЙ", "all_up_to_date" => "✅ Все моды обновлены", "updates_found" => "Найдено обновлений: {0}", "first_launch" => "Первый запуск - проверка обновлений...", "checking_updates" => "Проверка обновлений...", "main_menu_not_found" => "Главное меню не найдено - используется плавающая кнопка", "cache_loaded" => "Кэш загружен: {0} обновлений сохранено", "empty_cache" => "Пустой кэш - сброс", "cache_error" => "Ошибка чтения кэша: {0}", "cache_save_error" => "Ошибка сохранения кэша: {0}", "rate_limit" => "Лимит API - пауза 60 секунд", "http_code" => "{0} - HTTP код {1}", "invalid_api_response" => "{0} - Некорректный ответ API", "error_mod" => "Ошибка {0}: {1}", "no_nexusid" => "{0} - NexusModID не найден", "invalid_nexusid" => "Некорректный NexusID в {0}: {1}", "current_version" => "Текущая версия", "new_version" => "Новая версия", "version" => "версия", "missing_nexusmodid" => "⚠\ufe0f Имеется NexusModID", "back" => "Назад", "close" => "Закрыть", "incompatible_mods" => "Несовместимые моды", _ => key, }; if (1 == 0) { } text2 = text; } else { if (1 == 0) { } string text = key switch { "update_checker" => "UPDATE CHECKER", "all_up_to_date" => "✅ All mods are up to date", "updates_found" => "{0} updates found", "first_launch" => "First Launch - Checking for Updates...", "checking_updates" => "Checking for updates...", "main_menu_not_found" => "MainMenu not found - Fallback on floating button", "cache_loaded" => "Cache loaded : {0} saved updates", "empty_cache" => "Empty or Invalid Cache - Reset", "cache_error" => "Cache read error : {0}", "cache_save_error" => "Cache save error : {0}", "rate_limit" => "API rate limit reached - 60s pause", "http_code" => "{0} - HTTP Code {1}", "invalid_api_response" => "{0} - Invalid API response", "error_mod" => "Error {0}: {1}", "no_nexusid" => "{0} - No NexusModID found", "invalid_nexusid" => "Invalid NexusID format in {0}: {1}", "current_version" => "Current version", "new_version" => "New version", "version" => "Version", "missing_nexusmodid" => "⚠\ufe0f Missing NexusModID", "back" => "back", "close" => "Close", "incompatible_mods" => "Incompatible Mods", _ => key, }; if (1 == 0) { } text2 = text; } } else { if (1 == 0) { } string text = key switch { "update_checker" => "UPDATE CHECKER", "all_up_to_date" => "✅ Tous les mods sont à jour", "updates_found" => "{0} mises à jour trouvées", "first_launch" => "Premier lancement - Vérification des mises à jour...", "checking_updates" => "Vérification des mises à jour...", "main_menu_not_found" => "Menu principal introuvable - Bouton flottant utilisé", "cache_loaded" => "Cache chargé : {0} mises à jour enregistrées", "empty_cache" => "Cache vide ou invalide - Réinitialisation", "cache_error" => "Erreur lecture cache : {0}", "cache_save_error" => "Erreur sauvegarde cache : {0}", "rate_limit" => "Limite API atteinte - Pause de 60s", "http_code" => "{0} - Code HTTP {1}", "invalid_api_response" => "{0} - Réponse API invalide", "error_mod" => "Erreur {0}: {1}", "no_nexusid" => "{0} - Aucun NexusModID trouvé", "invalid_nexusid" => "Format NexusID invalide dans {0}: {1}", "current_version" => "Version actuelle", "new_version" => "Nouvelle version", "version" => "Version", "missing_nexusmodid" => "⚠\ufe0f Missing NexusModID", "back" => "Retour", "close" => "Fermer", "incompatible_mods" => "Incompatible Mods", _ => key, }; if (1 == 0) { } text2 = text; } if (1 == 0) { } string format = text2; return string.Format(format, args); } } public static class ModsUI { public static class RoundedCorners { public static Texture2D CreateRoundedTexture(int width, int height, int radius, Color color) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Expected O, but got Unknown //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(width, height); Color[] array = (Color[])(object)new Color[width * height]; float num = radius * radius; for (int i = 0; i < height; i++) { for (int j = 0; j < width; j++) { bool flag = false; if (j < radius && i < radius) { flag = (float)((j - radius) * (j - radius) + (i - radius) * (i - radius)) > num; } else if (j < radius && i > height - radius) { flag = (float)((j - radius) * (j - radius) + (i - (height - radius)) * (i - (height - radius))) > num; } else if (j > width - radius && i < radius) { flag = (float)((j - (width - radius)) * (j - (width - radius)) + (i - radius) * (i - radius)) > num; } else if (j > width - radius && i > height - radius) { flag = (float)((j - (width - radius)) * (j - (width - radius)) + (i - (height - radius)) * (i - (height - radius))) > num; } array[i * width + j] = (flag ? Color.clear : color); } } val.SetPixels(Il2CppStructArray<Color>.op_Implicit(array)); val.Apply(); return val; } } public static GameObject? modButton; public static GameObject? modWindow; public static GameObject? incompatibleModsButton; public static GameObject? incompatibleModsWindow; public static RectTransform? contentReference; public static bool buttonInitialized; public static bool isInitializing; public static void Initialize(MelonMod instance) { if (!isInitializing) { isInitializing = true; MelonLogger.Msg("Initializing Custom UI..."); MelonCoroutines.Start(MenuDelayedInit()); } } public static IEnumerator MenuDelayedInit() { yield return (object)new WaitForSeconds(3f); int num; if (!buttonInitialized) { Scene activeScene = SceneManager.GetActiveScene(); num = ((((Scene)(ref activeScene)).name != "Menu") ? 1 : 0); } else { num = 1; } if (num == 0) { if ((Object)(object)modButton != (Object)null) { Object.Destroy((Object)(object)modButton); modButton = null; } if ((Object)(object)modWindow != (Object)null) { Object.Destroy((Object)(object)modWindow); modWindow = null; } FindMainMenu(); isInitializing = false; } } public static void FindMainMenu() { try { GameObject val = GameObject.Find("MainMenu"); if ((Object)(object)val == (Object)null) { MelonLogger.Warning(Lang.Get("main_menu_not_found")); return; } CreateLeftMenuButton(val); buttonInitialized = true; } catch (Exception ex) { MelonLogger.Error("FindMainMenu error: " + ex.Message + "\n" + ex.StackTrace); } } public static void CreateLeftMenuButton(GameObject mainMenu) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_006a: 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) //IL_0096: 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_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Expected O, but got Unknown //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) try { if (!((Object)(object)modButton != (Object)null)) { modButton = new GameObject("ModsButton"); modButton.transform.SetParent(mainMenu.transform, false); RectTransform val = modButton.AddComponent<RectTransform>(); val.anchorMin = new Vector2(0f, 0.5f); val.anchorMax = new Vector2(0f, 0.5f); val.pivot = new Vector2(0f, 0.5f); val.anchoredPosition = new Vector2(45f, -10f); val.sizeDelta = new Vector2(200f, 60f); Image val2 = modButton.AddComponent<Image>(); ((Graphic)val2).color = new Color(0f, 0f, 0f, 0.01f); GameObject val3 = new GameObject("Text"); val3.transform.SetParent(modButton.transform, false); Text val4 = val3.AddComponent<Text>(); val4.text = Lang.Get("update_checker"); val4.font = Resources.GetBuiltinResource<Font>("Arial.ttf"); ((Graphic)val4).color = Color.white; val4.alignment = (TextAnchor)4; val4.fontSize = 24; val4.fontStyle = (FontStyle)1; RectTransform component = val3.GetComponent<RectTransform>(); component.anchorMin = Vector2.zero; component.anchorMax = Vector2.one; component.offsetMin = Vector2.zero; component.offsetMax = Vector2.zero; Button val5 = modButton.AddComponent<Button>(); ((Selectable)val5).targetGraphic = (Graphic)(object)val2; ((UnityEvent)val5.onClick).AddListener(UnityAction.op_Implicit((Action)delegate { ToggleWindow(); })); if ((Object)(object)modWindow == (Object)null) { modWindow = CreateWindow(mainMenu); modWindow.SetActive(false); } CreateIncompatibleModsButton(modWindow); } } catch (Exception ex) { MelonLogger.Error("Erreur CreateLeftMenuButton: " + ex.Message); } } public static void CreateIncompatibleModsButton(GameObject parent) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_003e: 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_006a: 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) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Expected O, but got Unknown //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) try { incompatibleModsButton = new GameObject("IncompatibleModsButton"); incompatibleModsButton.transform.SetParent(parent.transform, false); RectTransform val = incompatibleModsButton.AddComponent<RectTransform>(); val.anchorMin = new Vector2(0.5f, 0f); val.anchorMax = new Vector2(0.5f, 0f); val.pivot = new Vector2(0.5f, 0f); val.anchoredPosition = new Vector2(0f, 70f); val.sizeDelta = new Vector2(180f, 40f); Image val2 = incompatibleModsButton.AddComponent<Image>(); ((Graphic)val2).color = new Color(0.8f, 0.2f, 0.2f, 0.7f); val2.sprite = Sprite.Create(RoundedCorners.CreateRoundedTexture(180, 40, 8, ((Graphic)val2).color), new Rect(0f, 0f, 180f, 40f), new Vector2(0.5f, 0.5f)); GameObject val3 = new GameObject("Text"); val3.transform.SetParent(incompatibleModsButton.transform, false); Text val4 = val3.AddComponent<Text>(); val4.text = Lang.Get("incompatible_mods"); val4.font = Resources.GetBuiltinResource<Font>("Arial.ttf"); ((Graphic)val4).color = Color.white; val4.alignment = (TextAnchor)4; val4.fontSize = 16; val4.fontStyle = (FontStyle)1; RectTransform component = val3.GetComponent<RectTransform>(); component.anchorMin = Vector2.zero; component.anchorMax = Vector2.one; component.offsetMin = Vector2.zero; component.offsetMax = Vector2.zero; Button val5 = incompatibleModsButton.AddComponent<Button>(); ((Selectable)val5).targetGraphic = (Graphic)(object)val2; ((UnityEvent)val5.onClick).AddListener(UnityAction.op_Implicit((Action)delegate { ToggleIncompatibleModsWindow(); })); } catch (Exception ex) { MelonLogger.Error("CreateIncompatibleModsButton error: " + ex.Message); } } public static void ToggleIncompatibleModsWindow() { try { if ((Object)(object)incompatibleModsWindow == (Object)null) { GameObject? obj = modWindow; object obj2; if (obj == null) { obj2 = null; } else { Transform parent = obj.transform.parent; obj2 = ((parent != null) ? ((Component)parent).gameObject : null); } if (obj2 == null) { obj2 = GetOrCreateCanvas(); } GameObject parent2 = (GameObject)obj2; incompatibleModsWindow = CreateIncompatibleModsWindow(parent2); } bool flag = !incompatibleModsWindow.activeSelf; incompatibleModsWindow.SetActive(flag); if ((Object)(object)modWindow != (Object)null) { modWindow.SetActive(!flag); } if (flag) { UpdateIncompatibleModsContent(); } } catch (Exception ex) { MelonLogger.Error("ToggleIncompatibleModsWindow Error: " + ex.Message); } } public static GameObject CreateIncompatibleModsWindow(GameObject parent) { //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Expected O, but got Unknown //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Expected O, but got Unknown //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0270: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Expected O, but got Unknown //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Unknown result type (might be due to invalid IL or missing references) //IL_02ea: Unknown result type (might be due to invalid IL or missing references) //IL_0301: Unknown result type (might be due to invalid IL or missing references) //IL_032b: Unknown result type (might be due to invalid IL or missing references) //IL_034c: Unknown result type (might be due to invalid IL or missing references) //IL_0363: Unknown result type (might be due to invalid IL or missing references) //IL_0381: Unknown result type (might be due to invalid IL or missing references) //IL_0390: Unknown result type (might be due to invalid IL or missing references) //IL_03a5: Unknown result type (might be due to invalid IL or missing references) //IL_03ac: Expected O, but got Unknown //IL_03f5: Unknown result type (might be due to invalid IL or missing references) //IL_0427: Unknown result type (might be due to invalid IL or missing references) //IL_0434: Unknown result type (might be due to invalid IL or missing references) //IL_0441: Unknown result type (might be due to invalid IL or missing references) //IL_044e: Unknown result type (might be due to invalid IL or missing references) GameObject window = CreateWindow(parent); ((Object)window).name = "IncompatibleModsWindow"; Text componentInChildren = window.GetComponentInChildren<Text>(); if ((Object)(object)componentInChildren != (Object)null) { componentInChildren.text = Lang.Get("incompatible_mods"); ((Graphic)componentInChildren).color = new Color(1f, 0.4f, 0.4f); } GameObject val = new GameObject("BackButton"); val.transform.SetParent(window.transform, false); RectTransform val2 = val.AddComponent<RectTransform>(); val2.anchorMin = new Vector2(0.5f, 0f); val2.anchorMax = new Vector2(0.5f, 0f); val2.pivot = new Vector2(0.5f, 0f); val2.anchoredPosition = new Vector2(0f, 70f); val2.sizeDelta = new Vector2(180f, 40f); Image val3 = val.AddComponent<Image>(); ((Graphic)val3).color = new Color(0.2f, 0.2f, 0.8f, 0.7f); val3.sprite = Sprite.Create(RoundedCorners.CreateRoundedTexture(180, 40, 8, ((Graphic)val3).color), new Rect(0f, 0f, 180f, 40f), new Vector2(0.5f, 0.5f)); GameObject val4 = new GameObject("Text"); val4.transform.SetParent(val.transform, false); Text val5 = val4.AddComponent<Text>(); val5.text = Lang.Get("back"); val5.font = Resources.GetBuiltinResource<Font>("Arial.ttf"); ((Graphic)val5).color = Color.white; val5.alignment = (TextAnchor)4; val5.fontSize = 16; val5.fontStyle = (FontStyle)1; RectTransform component = val4.GetComponent<RectTransform>(); component.anchorMin = Vector2.zero; component.anchorMax = Vector2.one; component.offsetMin = Vector2.zero; component.offsetMax = Vector2.zero; Button val6 = val.AddComponent<Button>(); ((UnityEvent)val6.onClick).AddListener(UnityAction.op_Implicit((Action)delegate { if ((Object)(object)modWindow != (Object)null) { modWindow.SetActive(true); } if ((Object)(object)incompatibleModsWindow != (Object)null) { incompatibleModsWindow.SetActive(false); } })); GameObject val7 = new GameObject("CloseButton"); val7.transform.SetParent(window.transform, false); RectTransform val8 = val7.AddComponent<RectTransform>(); val8.anchorMin = new Vector2(0.5f, 0f); val8.anchorMax = new Vector2(0.5f, 0f); val8.pivot = new Vector2(0.5f, 0f); val8.anchoredPosition = new Vector2(0f, 20f); val8.sizeDelta = new Vector2(180f, 40f); Image val9 = val7.AddComponent<Image>(); ((Graphic)val9).color = new Color(0.8f, 0.2f, 0.2f, 0.7f); ((Graphic)val9).color = new Color(0.8f, 0.2f, 0.2f, 0.7f); val9.sprite = Sprite.Create(RoundedCorners.CreateRoundedTexture(180, 40, 8, ((Graphic)val9).color), new Rect(0f, 0f, 180f, 40f), new Vector2(0.5f, 0.5f)); GameObject val10 = new GameObject("Text"); val10.transform.SetParent(val7.transform, false); Text val11 = val10.AddComponent<Text>(); val11.text = Lang.Get("close"); val11.font = Resources.GetBuiltinResource<Font>("Arial.ttf"); ((Graphic)val11).color = Color.white; val11.alignment = (TextAnchor)4; val11.fontSize = 16; val11.fontStyle = (FontStyle)1; RectTransform component2 = val10.GetComponent<RectTransform>(); component2.anchorMin = Vector2.zero; component2.anchorMax = Vector2.one; component2.offsetMin = Vector2.zero; component2.offsetMax = Vector2.zero; Button val12 = val7.AddComponent<Button>(); ((UnityEvent)val12.onClick).AddListener(UnityAction.op_Implicit((Action)delegate { window.SetActive(false); })); return window; } public static void UpdateIncompatibleModsContent() { //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) try { if ((Object)(object)incompatibleModsWindow == (Object)null) { return; } ScrollRect componentInChildren = incompatibleModsWindow.GetComponentInChildren<ScrollRect>(); if ((Object)(object)componentInChildren == (Object)null || (Object)(object)componentInChildren.content == (Object)null) { return; } GameObject gameObject = ((Component)componentInChildren.content).gameObject; RectTransform component = gameObject.GetComponent<RectTransform>(); component.anchoredPosition = Vector2.zero; component.sizeDelta = new Vector2(400f, 0f); for (int num = gameObject.transform.childCount - 1; num >= 0; num--) { Transform child = gameObject.transform.GetChild(num); Object.Destroy((Object)(object)((Component)child).gameObject); } if (!UpdatesChecker.incompatibleMods.Any()) { CreateTextElement(gameObject, "Aucun mod incompatible trouvé"); return; } foreach (ModInfo incompatibleMod in UpdatesChecker.incompatibleMods) { CreateTextElement(gameObject, $"<b><size=18>{incompatibleMod.Name}</size></b>\n<color=#ff5555>{Lang.Get("missing_nexusmodid")}</color>\n<color=#aaaaaa>{Lang.Get("version")}: {incompatibleMod.Version}</color>\n" + "<color=#555555>────────────────────</color>"); } float num2 = (float)UpdatesChecker.incompatibleMods.Count * 95f; component.sizeDelta = new Vector2(400f, num2); LayoutRebuilder.ForceRebuildLayoutImmediate(component); } catch (Exception ex) { MelonLogger.Error("UpdateIncompatibleModsContent error: " + ex.Message); } } public static GameObject CreateWindow(GameObject parent) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_005d: 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_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Expected O, but got Unknown //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Expected O, but got Unknown //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_026f: Unknown result type (might be due to invalid IL or missing references) //IL_0286: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_02eb: Unknown result type (might be due to invalid IL or missing references) //IL_030d: Unknown result type (might be due to invalid IL or missing references) //IL_0314: Expected O, but got Unknown //IL_033e: Unknown result type (might be due to invalid IL or missing references) //IL_0355: Unknown result type (might be due to invalid IL or missing references) //IL_036c: Unknown result type (might be due to invalid IL or missing references) //IL_0383: Unknown result type (might be due to invalid IL or missing references) //IL_03a1: Unknown result type (might be due to invalid IL or missing references) //IL_03ab: Expected O, but got Unknown //IL_0411: Unknown result type (might be due to invalid IL or missing references) //IL_0418: Expected O, but got Unknown //IL_0446: Unknown result type (might be due to invalid IL or missing references) //IL_045d: Unknown result type (might be due to invalid IL or missing references) //IL_0474: Unknown result type (might be due to invalid IL or missing references) //IL_048b: Unknown result type (might be due to invalid IL or missing references) //IL_04a2: Unknown result type (might be due to invalid IL or missing references) //IL_04cc: Unknown result type (might be due to invalid IL or missing references) //IL_04e3: Unknown result type (might be due to invalid IL or missing references) //IL_0501: Unknown result type (might be due to invalid IL or missing references) //IL_0510: Unknown result type (might be due to invalid IL or missing references) //IL_0525: Unknown result type (might be due to invalid IL or missing references) //IL_052c: Expected O, but got Unknown //IL_0575: Unknown result type (might be due to invalid IL or missing references) //IL_05a7: Unknown result type (might be due to invalid IL or missing references) //IL_05b4: Unknown result type (might be due to invalid IL or missing references) //IL_05c1: Unknown result type (might be due to invalid IL or missing references) //IL_05ce: Unknown result type (might be due to invalid IL or missing references) try { GameObject window = new GameObject("ModsWindow"); window.transform.SetParent(parent.transform, false); RectTransform val = window.AddComponent<RectTransform>(); val.anchorMin = new Vector2(0.5f, 0.5f); val.anchorMax = new Vector2(0.5f, 0.5f); val.pivot = new Vector2(0.5f, 0.5f); val.sizeDelta = new Vector2(460f, 600f); val.anchoredPosition = Vector2.zero; Image val2 = window.AddComponent<Image>(); ((Graphic)val2).color = new Color(0.08f, 0.08f, 0.08f, 0.98f); val2.sprite = Sprite.Create(RoundedCorners.CreateRoundedTexture(460, 600, 20, ((Graphic)val2).color), new Rect(0f, 0f, 460f, 600f), new Vector2(0.5f, 0.5f)); GameObject val3 = new GameObject("Title"); val3.transform.SetParent(window.transform, false); RectTransform val4 = val3.AddComponent<RectTransform>(); val4.anchorMin = new Vector2(0.5f, 1f); val4.anchorMax = new Vector2(0.5f, 1f); val4.pivot = new Vector2(0.5f, 1f); val4.anchoredPosition = new Vector2(0f, -20f); val4.sizeDelta = new Vector2(400f, 40f); Text val5 = val3.AddComponent<Text>(); val5.text = Lang.Get("update_checker"); val5.font = Resources.GetBuiltinResource<Font>("Arial.ttf"); ((Graphic)val5).color = new Color(0.9f, 0.95f, 1f); val5.alignment = (TextAnchor)1; val5.fontSize = 28; val5.fontStyle = (FontStyle)1; GameObject val6 = new GameObject("ScrollView"); val6.transform.SetParent(window.transform, false); RectTransform val7 = val6.AddComponent<RectTransform>(); val7.anchorMin = new Vector2(0f, 0f); val7.anchorMax = new Vector2(1f, 1f); val7.offsetMin = new Vector2(20f, 125f); val7.offsetMax = new Vector2(-20f, -70f); ScrollRect val8 = val6.AddComponent<ScrollRect>(); val8.movementType = (MovementType)2; val8.inertia = false; val8.scrollSensitivity = 25f; ((Graphic)val6.AddComponent<Image>()).color = new Color(0.12f, 0.12f, 0.12f, 0.5f); Mask val9 = val6.AddComponent<Mask>(); val9.showMaskGraphic = false; GameObject val10 = new GameObject("Content"); val10.transform.SetParent(val6.transform, false); RectTransform val11 = val10.AddComponent<RectTransform>(); val11.anchorMin = new Vector2(0.5f, 1f); val11.anchorMax = new Vector2(0.5f, 1f); val11.pivot = new Vector2(0.5f, 1f); val11.sizeDelta = new Vector2(400f, 0f); VerticalLayoutGroup val12 = val10.AddComponent<VerticalLayoutGroup>(); ((LayoutGroup)val12).padding = new RectOffset(10, 10, 10, 10); ((HorizontalOrVerticalLayoutGroup)val12).spacing = 15f; ((LayoutGroup)val12).childAlignment = (TextAnchor)1; ((HorizontalOrVerticalLayoutGroup)val12).childControlHeight = false; ((HorizontalOrVerticalLayoutGroup)val12).childControlWidth = true; ((HorizontalOrVerticalLayoutGroup)val12).childForceExpandHeight = false; ((HorizontalOrVerticalLayoutGroup)val12).childForceExpandWidth = false; ContentSizeFitter val13 = val10.AddComponent<ContentSizeFitter>(); val13.verticalFit = (FitMode)2; val8.content = val11; val8.viewport = val7; GameObject val14 = new GameObject("CloseButton"); val14.transform.SetParent(window.transform, false); RectTransform val15 = val14.AddComponent<RectTransform>(); val15.anchorMin = new Vector2(0.5f, 0f); val15.anchorMax = new Vector2(0.5f, 0f); val15.pivot = new Vector2(0.5f, 0f); val15.anchoredPosition = new Vector2(0f, 20f); val15.sizeDelta = new Vector2(180f, 40f); Image val16 = val14.AddComponent<Image>(); ((Graphic)val16).color = new Color(0.8f, 0.2f, 0.2f, 0.7f); val16.sprite = Sprite.Create(RoundedCorners.CreateRoundedTexture(180, 40, 8, ((Graphic)val16).color), new Rect(0f, 0f, 180f, 40f), new Vector2(0.5f, 0.5f)); GameObject val17 = new GameObject("Text"); val17.transform.SetParent(val14.transform, false); Text val18 = val17.AddComponent<Text>(); val18.text = Lang.Get("close"); val18.font = Resources.GetBuiltinResource<Font>("Arial.ttf"); ((Graphic)val18).color = Color.white; val18.alignment = (TextAnchor)4; val18.fontSize = 16; val18.fontStyle = (FontStyle)1; RectTransform component = val17.GetComponent<RectTransform>(); component.anchorMin = Vector2.zero; component.anchorMax = Vector2.one; component.offsetMin = Vector2.zero; component.offsetMax = Vector2.zero; Button val19 = val14.AddComponent<Button>(); ((UnityEvent)val19.onClick).AddListener(UnityAction.op_Implicit((Action)delegate { window.SetActive(false); })); return window; } catch (Exception ex) { MelonLogger.Error("CreateWindow error: " + ex.Message); return null; } } public static void ToggleWindow() { //IL_007d: Unknown result type (might be due to invalid IL or missing references) try { if ((Object)(object)modWindow == (Object)null) { GameObject? obj = modButton; object obj2; if (obj == null) { obj2 = null; } else { Transform parent = obj.transform.parent; obj2 = ((parent != null) ? ((Component)parent).gameObject : null); } if (obj2 == null) { obj2 = GetOrCreateCanvas(); } GameObject parent2 = (GameObject)obj2; modWindow = CreateWindow(parent2); } modWindow.SetActive(!modWindow.activeSelf); if (modWindow.activeSelf) { RectTransform component = modWindow.GetComponent<RectTransform>(); component.anchoredPosition = Vector2.zero; UpdateWindowContent(); } } catch (Exception ex) { MelonLogger.Error("ToggleWindow Error: " + ex.Message); } } public static void UpdateWindowContent() { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Expected O, but got Unknown //IL_022b: Unknown result type (might be due to invalid IL or missing references) try { if ((Object)(object)modWindow == (Object)null) { return; } Transform val = modWindow.transform.Find("ScrollView/Content"); if ((Object)(object)val == (Object)null) { return; } GameObject gameObject = ((Component)val).gameObject; RectTransform component = gameObject.GetComponent<RectTransform>(); component.anchoredPosition = Vector2.zero; component.sizeDelta = new Vector2(400f, 0f); IEnumerator enumerator = gameObject.transform.GetEnumerator(); try { while (enumerator.MoveNext()) { Transform val2 = (Transform)enumerator.Current; Object.Destroy((Object)(object)((Component)val2).gameObject); } } finally { if (enumerator is IDisposable disposable) { disposable.Dispose(); } } IEnumerable<ModUpdate> updatesAvailable = UpdatesChecker.updatesAvailable; IEnumerable<ModUpdate> enumerable = updatesAvailable ?? Enumerable.Empty<ModUpdate>(); if (!enumerable.Any()) { CreateTextElement(gameObject, Lang.Get("all_up_to_date")); return; } foreach (ModUpdate item in enumerable) { CreateTextElement(gameObject, $"<b><size=18>{item.ModName}</size></b>\n<color=#aaaaaa>{Lang.Get("current_version")}: {item.CurrentVersion}</color>\n<color=#4CAF50>{Lang.Get("new_version")}: {item.LatestVersion}</color>\n" + "<color=#555555>────────────────────</color>"); } float num = (float)enumerable.Count() * 95f; component.sizeDelta = new Vector2(400f, num); LayoutRebuilder.ForceRebuildLayoutImmediate(component); } catch (Exception ex) { MelonLogger.Error("UpdateWindowContent error: " + ex.Message); } } public static void CreateTextElement(GameObject parent, string text) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_009b: 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_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Expected O, but got Unknown //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_0220: Unknown result type (might be due to invalid IL or missing references) try { GameObject val = new GameObject("UpdateElement"); val.transform.SetParent(parent.transform, false); RectTransform val2 = val.AddComponent<RectTransform>(); val2.anchorMin = new Vector2(0.5f, 1f); val2.anchorMax = new Vector2(0.5f, 1f); val2.pivot = new Vector2(0.5f, 1f); val2.sizeDelta = new Vector2(380f, 80f); Image val3 = val.AddComponent<Image>(); ((Graphic)val3).color = new Color(0.08f, 0.08f, 0.08f, 0.95f); val3.sprite = Sprite.Create(RoundedCorners.CreateRoundedTexture(380, 80, 12, ((Graphic)val3).color), new Rect(0f, 0f, 380f, 80f), new Vector2(0.5f, 0.5f)); GameObject val4 = new GameObject("Text"); val4.transform.SetParent(val.transform, false); RectTransform val5 = val4.AddComponent<RectTransform>(); val5.anchorMin = Vector2.zero; val5.anchorMax = Vector2.one; val5.offsetMin = new Vector2(10f, 5f); val5.offsetMax = new Vector2(-10f, -5f); Text val6 = val4.AddComponent<Text>(); val6.text = text; val6.font = Resources.GetBuiltinResource<Font>("Arial.ttf"); ((Graphic)val6).color = new Color(0.95f, 0.95f, 0.95f, 1f); val6.fontSize = 16; val6.supportRichText = true; val6.alignment = (TextAnchor)4; LayoutElement val7 = val.AddComponent<LayoutElement>(); val7.minHeight = 80f; val7.preferredHeight = 80f; val7.preferredWidth = 380f; Outline val8 = val4.AddComponent<Outline>(); ((Shadow)val8).effectColor = new Color(0f, 0f, 0f, 0.3f); ((Shadow)val8).effectDistance = new Vector2(1f, -1f); } catch (Exception ex) { MelonLogger.Error("CreateTextElement error: " + ex.GetType().Name + " - " + ex.Message); } } public static GameObject GetOrCreateCanvas() { //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Expected O, but got Unknown try { GameObject val = GameObject.Find("Canvas"); if ((Object)(object)val == (Object)null) { val = new GameObject("Canvas"); Canvas val2 = val.AddComponent<Canvas>(); val2.renderMode = (RenderMode)0; val.AddComponent<CanvasScaler>(); val.AddComponent<GraphicRaycaster>(); if ((Object)(object)Object.FindObjectOfType<EventSystem>() == (Object)null) { GameObject val3 = new GameObject("EventSystem"); val3.AddComponent<EventSystem>(); val3.AddComponent<StandaloneInputModule>(); } } return val; } catch (Exception ex) { MelonLogger.Error("GetOrCreateCanvas error: " + ex.Message); return ((Component)new GameObject("FallbackCanvas").AddComponent<Canvas>()).gameObject; } } } public static class PluginInfo { public const string PLUGIN_AUTHOR = "DiumStream"; public const string PLUGIN_NAME = "UpdatesChecker"; public const string PLUGIN_VERSION = "1.0.8"; }