using System; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.IO; using System.IO.Compression; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Cryptography; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using System.Threading; using System.Threading.Tasks; using AngryLevelLoader; using AngryLevelLoader.Containers; using AngryLevelLoader.DataTypes; using AngryLevelLoader.DataTypes.MapVarHandlers; using AngryLevelLoader.Extensions; using AngryLevelLoader.Fields; using AngryLevelLoader.Managers; using AngryLevelLoader.Managers.BannedMods; using AngryLevelLoader.Managers.LegacyPatches; using AngryLevelLoader.Managers.ServerManager; using AngryLevelLoader.Notifications; using AngryLevelLoader.Patches; using AngryLevelLoader.UserInterface; using AngryLevelLoader.Utils; using AngryUiComponents; using BananaDifficulty; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Logging; using BillionDifficulty; using Configgy; using FasterPunch; using HarmonyLib; using Logic; using LucasMeshCombine; using Newtonsoft.Json; using Notiffy.API; using PluginConfig; using PluginConfig.API; using PluginConfig.API.Decorators; using PluginConfig.API.Fields; using PluginConfig.API.Functionals; using ProjectProphet; using RudeLevelScript; using RudeLevelScripts; using RudeLevelScripts.Essentials; using Steamworks; using Steamworks.Data; using TMPro; using The_Timestopper; using TimeStop; using ULTRAKILL.Portal; using Ultracoins; using Ultrapain; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.AddressableAssets.ResourceLocators; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Utilities; using UnityEngine.Networking; using UnityEngine.ResourceManagement.AsyncOperations; using UnityEngine.SceneManagement; using UnityEngine.UI; using UnityExplorer.ObjectExplorer; using UnityExplorer.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("AngryLevelLoader")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Loads level made with Rude level editor")] [assembly: AssemblyFileVersion("4.0.3.0")] [assembly: AssemblyInformationalVersion("4.0.3+a99074082a13f68eee4cc1fec63497b76654ee28")] [assembly: AssemblyProduct("AngryLevelLoader")] [assembly: AssemblyTitle("AngryLevelLoader")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("4.0.3.0")] [module: UnverifiableCode] internal class CrossThreadInvoker : ISynchronizeInvoke { private class BackgroundUpdater : MonoBehaviour { public void Update() { ProcessQueue(); } } private class AsyncResult : IAsyncResult { public Delegate method; public object[] args; public ManualResetEvent manualResetEvent; public Thread invokingThread; public bool IsCompleted { get; set; } public WaitHandle AsyncWaitHandle => manualResetEvent; public object AsyncState { get; set; } public bool CompletedSynchronously { get; set; } public void Invoke() { AsyncState = method.DynamicInvoke(args); IsCompleted = true; manualResetEvent.Set(); } } private static CrossThreadInvoker instance; private static Thread mainThread; private static readonly Queue ToExecute = new Queue(); public static CrossThreadInvoker Instance => instance; public bool InvokeRequired => mainThread.ManagedThreadId != Thread.CurrentThread.ManagedThreadId; public static void Init() { if (instance == null) { mainThread = Thread.CurrentThread; instance = new CrossThreadInvoker(); ((Component)Plugin.instance).gameObject.AddComponent(); } } private static void ProcessQueue() { if (Thread.CurrentThread != mainThread) { throw new Exception("must be called from the same thread it was created on (created on thread id: " + mainThread.ManagedThreadId + ", called from thread id: " + Thread.CurrentThread.ManagedThreadId); } AsyncResult asyncResult = null; while (true) { lock (ToExecute) { if (ToExecute.Count == 0) { break; } asyncResult = ToExecute.Dequeue(); } asyncResult.Invoke(); } } public IAsyncResult BeginInvoke(Delegate method, object[] args) { AsyncResult asyncResult = new AsyncResult { method = method, args = args, IsCompleted = false, manualResetEvent = new ManualResetEvent(initialState: false), invokingThread = Thread.CurrentThread }; if (mainThread.ManagedThreadId != asyncResult.invokingThread.ManagedThreadId) { lock (ToExecute) { ToExecute.Enqueue(asyncResult); } } else { asyncResult.Invoke(); asyncResult.CompletedSynchronously = true; } return asyncResult; } public object EndInvoke(IAsyncResult result) { if (!result.IsCompleted) { result.AsyncWaitHandle.WaitOne(); } return result.AsyncState; } public object Invoke(Delegate method, object[] args) { if (InvokeRequired) { IAsyncResult result = BeginInvoke(method, args); return EndInvoke(result); } return method.DynamicInvoke(args); } } namespace AngryLevelLoader { public static class AngryPaths { internal enum Repo { AngryLevelLoader, AngryLevels } public const string SERVER_ROOT_GLOBAL = "https://angry.dnzsoft.com"; public const string SERVER_ROOT_LOCAL = "http://localhost:3000"; public static string SERVER_ROOT { get { if (!ConfigManager.useLocalServer.value) { return "https://angry.dnzsoft.com"; } return "http://localhost:3000"; } } public static string ConfigFolderPath => Path.Combine(Paths.ConfigPath, "AngryLevelLoader"); public static string OnlineCacheFolderPath => Path.Combine(ConfigFolderPath, "OnlineCache"); public static string ThumbnailCachePath => Path.Combine(OnlineCacheFolderPath, "thumbnailCacheHashes.txt"); public static string LevelCatalogCachePath => Path.Combine(OnlineCacheFolderPath, "V2", "LevelCatalog.json"); public static string ScriptsPath => Path.Combine(Plugin.workingDir, "Scripts"); public static string ScriptCatalogCachePath => Path.Combine(OnlineCacheFolderPath, "ScriptCatalog.json"); public static string ThumbnailCacheFolderPath => Path.Combine(OnlineCacheFolderPath, "ThumbnailCache"); public static string LastPlayedMapPath => Path.Combine(ConfigFolderPath, "lastPlayedMap.txt"); public static string LastUpdateMapPath => Path.Combine(ConfigFolderPath, "lastUpdateMap.txt"); internal static string GetGithubURL(Repo repo, string path) { string text = "release"; if (ConfigManager.useDevelopmentBranch.value) { text = "dev"; } string text2 = "AngryLevels"; switch (repo) { case Repo.AngryLevels: text2 = "AngryLevels"; break; case Repo.AngryLevelLoader: text2 = "AngryLevelLoader"; break; } return "https://raw.githubusercontent.com/eternalUnion/" + text2 + "/" + text + "/" + path; } internal static void TryCreateAllPaths() { AngryIOUtils.TryCreateDirectory(ConfigFolderPath); AngryIOUtils.TryCreateDirectory(OnlineCacheFolderPath); AngryIOUtils.TryCreateDirectory(ThumbnailCacheFolderPath); AngryIOUtils.TryCreateDirectory(ScriptsPath); } } internal class SpaceField : CustomConfigField { public SpaceField(ConfigPanel parentPanel, float space) : base(parentPanel, 60f, space) { } } [BepInPlugin("com.eternalUnion.angryLevelLoader", "AngryLevelLoader", "4.0.3")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { [CompilerGenerated] private sealed class <g__LoadLevelInstantly|26_5>d : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; private <>c__DisplayClass26_0 <>8__1; private BundleContainer 5__2; private LevelContainer 5__3; private Transform 5__4; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <g__LoadLevelInstantly|26_5>d(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>8__1 = null; 5__2 = null; 5__3 = null; 5__4 = null; <>1__state = -2; } private bool MoveNext() { //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Expected O, but got Unknown //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0322: Unknown result type (might be due to invalid IL or missing references) //IL_032c: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>8__1 = new <>c__DisplayClass26_0(); <>2__current = null; <>1__state = 1; return true; case 1: <>1__state = -1; if (!TryGetAngryBundleByGuid(InternalConfigManager.instantLoadLevelGuid.value, out 5__2)) { logger.LogInfo((object)"Bundle not found"); return false; } <>8__1.handler = 5__2.ReloadBundle(forceReload: false, lazyLoad: false); <>2__current = (object)new WaitUntil((Func)(() => <>8__1.handler.IsCompleted)); <>1__state = 2; return true; case 2: { <>1__state = -1; if (!5__2.TryGetLevelContainer(InternalConfigManager.instantLoadLevelId.value, out 5__3)) { logger.LogInfo((object)"Level not found"); return false; } Scene activeScene = SceneManager.GetActiveScene(); GameObject val = (from obj in ((Scene)(ref activeScene)).GetRootGameObjects() where ((Object)obj).name == "Canvas" select obj).FirstOrDefault(); if ((Object)(object)val == (Object)null) { logger.LogWarning((object)"Angry tried to create main menu buttons, but root canvas was not found!"); return false; } 5__4 = val.transform.Find("OptionsMenu"); if ((Object)(object)5__4 == (Object)null) { logger.LogError((object)"Angry tried to find the options menu but failed!"); return false; } ((Component)5__4).gameObject.SetActive(true); <>2__current = null; <>1__state = 3; return true; } case 3: { <>1__state = -1; Transform val2 = ((Component)5__4).transform.Find("Navigation Rail/PluginConfiguratorButton(Clone)"); if ((Object)(object)val2 == (Object)null) { val2 = ((Component)5__4).transform.Find("Navigation Rail/PluginConfiguratorButton"); } if ((Object)(object)val2 == (Object)null) { logger.LogError((object)"Angry tried to find the plugin configurator button but failed!"); return false; } Transform val3 = 5__4.Find("Navigation Rail"); ButtonHighlightParent val4 = default(ButtonHighlightParent); if ((Object)(object)val3 != (Object)null && ((Component)val3).gameObject.TryGetComponent(ref val4) && (val4.buttons == null || val4.buttons.Length == 0)) { val4.Start(); val4.targetOnStart = null; } ((UnityEvent)((Component)val2).gameObject.GetComponent