Decompiled source of EveryCloseMakes2MoreWindows v1.0.2

EveryCloseMakes2MoreWindows.dll

Decompiled 14 hours ago
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using Microsoft.CodeAnalysis;
using PluginConfig.API;
using PluginConfig.API.Fields;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.SceneManagement;
using UnityEngine.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("EveryCloseMakes2MoreWindows")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.2.0")]
[assembly: AssemblyInformationalVersion("1.0.2+d0efada1f679415e3fbfad0c143e5b60f81c6500")]
[assembly: AssemblyProduct("EveryCloseMakes2MoreWindows")]
[assembly: AssemblyTitle("EveryCloseMakes2MoreWindows")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.2.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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 EveryCloseMakes2MoreWindows
{
	public static class Assets
	{
		public static AssetBundle Bundle { get; private set; }

		public static Sprite icon { get; private set; }

		public static Sprite twoMore { get; private set; }

		public static void Load()
		{
			LoadBundle();
			icon = Bundle.LoadAsset<Sprite>("icon.png");
			twoMore = Bundle.LoadAsset<Sprite>("2 more.png");
		}

		public static void LoadBundle()
		{
			using Stream stream = typeof(Assets).Assembly.GetManifestResourceStream("everyclosemakes2morewindows-assets.bundle");
			Bundle = AssetBundle.LoadFromStream(stream);
		}
	}
	[BepInPlugin("Bryan_-000-.EveryCloseMakes2MoreWindows", "EveryCloseMakes2MoreWindows", "1.0.2")]
	public class Plugin : BaseUnityPlugin
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static Func<GameObject, bool> <>9__2_1;

			public static UnityAction<Scene, LoadSceneMode> <>9__2_0;

			public static OnValueChangeEventDelegate <>9__3_0;

			internal void <Awake>b__2_0(Scene scene, LoadSceneMode _)
			{
				//IL_0054: Unknown result type (might be due to invalid IL or missing references)
				//IL_0059: Unknown result type (might be due to invalid IL or missing references)
				//IL_0072: Unknown result type (might be due to invalid IL or missing references)
				//IL_0087: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
				if (SceneHelper.CurrentScene == "Main Menu")
				{
					Transform val = ((Scene)(ref scene)).GetRootGameObjects().First((GameObject val4) => ((Object)val4).name == "Canvas").transform.Find("Main Menu (1)/LeftSide/Quit");
					GameObject val2 = new GameObject("2 more");
					RectTransform val3 = val2.AddComponent<RectTransform>();
					Image obj = val2.AddComponent<Image>();
					((Transform)val3).parent = val.parent;
					((Transform)val3).localScale = Vector3.one;
					val3.sizeDelta = new Vector2(584f, 175f);
					((Transform)val3).localPosition = new Vector3(283f, -529f, 0f);
					obj.sprite = Assets.twoMore;
					((Graphic)obj).raycastTarget = false;
				}
			}

			internal bool <Awake>b__2_1(GameObject obj)
			{
				return ((Object)obj).name == "Canvas";
			}

			internal void <LoadConfig>b__3_0(FloatSliderValueChangeEvent valueEvent)
			{
				valueEvent.newValue = (windowsToSpawn = Mathf.RoundToInt(valueEvent.newValue));
			}
		}

		public static PluginConfigurator config;

		public static int windowsToSpawn = 2;

		public float timeSinceALTF4;

		public void Awake()
		{
			((BaseUnityPlugin)this).Logger.LogInfo((object)"laoding.. :drool:");
			Assets.Load();
			LoadConfig();
			EvilMwahaha();
			SceneManager.sceneLoaded += delegate(Scene scene, LoadSceneMode _)
			{
				//IL_0054: Unknown result type (might be due to invalid IL or missing references)
				//IL_0059: Unknown result type (might be due to invalid IL or missing references)
				//IL_0072: Unknown result type (might be due to invalid IL or missing references)
				//IL_0087: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
				if (SceneHelper.CurrentScene == "Main Menu")
				{
					Transform val = ((Scene)(ref scene)).GetRootGameObjects().First((GameObject val4) => ((Object)val4).name == "Canvas").transform.Find("Main Menu (1)/LeftSide/Quit");
					GameObject val2 = new GameObject("2 more");
					RectTransform val3 = val2.AddComponent<RectTransform>();
					Image obj = val2.AddComponent<Image>();
					((Transform)val3).parent = val.parent;
					((Transform)val3).localScale = Vector3.one;
					val3.sizeDelta = new Vector2(584f, 175f);
					((Transform)val3).localPosition = new Vector3(283f, -529f, 0f);
					obj.sprite = Assets.twoMore;
					((Graphic)obj).raycastTarget = false;
				}
			};
		}

		public void LoadConfig()
		{
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Expected O, but got Unknown
			config = PluginConfigurator.Create("EveryCloseMakes2MoreWindows", "Bryan_-000-.EveryCloseMakes2MoreWindows");
			config.presetButtonHidden = true;
			config.image = Assets.icon;
			FloatSliderField val = new FloatSliderField(config.rootPanel, "Amount of windows to open", "MEoWmRRpmEOWmEOwmIAoW", new Tuple<float, float>(0f, 100f), 2f);
			windowsToSpawn = Mathf.RoundToInt(val.value);
			object obj = <>c.<>9__3_0;
			if (obj == null)
			{
				OnValueChangeEventDelegate val2 = delegate(FloatSliderValueChangeEvent valueEvent)
				{
					valueEvent.newValue = (windowsToSpawn = Mathf.RoundToInt(valueEvent.newValue));
				};
				<>c.<>9__3_0 = val2;
				obj = (object)val2;
			}
			val.onValueChange += (OnValueChangeEventDelegate)obj;
		}

		public void EvilMwahaha()
		{
			((BaseUnityPlugin)this).Logger.LogInfo((object)"evil >:3 ");
			Application.quitting += delegate
			{
				if (!(Time.realtimeSinceStartup - timeSinceALTF4 > 1f))
				{
					for (int i = 0; i < windowsToSpawn; i++)
					{
						Environment.SetEnvironmentVariable("DOORSTOP_INITIALIZED", null);
						Environment.SetEnvironmentVariable("DOORSTOP_DISABLE", null);
						Application.OpenURL(Paths.ExecutablePath);
					}
				}
			};
		}

		public void Update()
		{
			if (Input.GetKey((KeyCode)308) && Input.GetKey((KeyCode)285))
			{
				timeSinceALTF4 = Time.realtimeSinceStartup;
			}
		}
	}
}