Decompiled source of maximize v1.0.2

res_set.dll

Decompiled 3 weeks ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;

[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("murderminemurder, murderminer")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("res_set")]
[assembly: AssemblyFileVersion("1.0.4.0")]
[assembly: AssemblyInformationalVersion("1.0.4")]
[assembly: AssemblyProduct("res_set")]
[assembly: AssemblyTitle("res_set")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.4.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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace res_set
{
	[BepInPlugin("murderminemurderer.dotheresolution", "dotheresolution", "1.0.1")]
	[BepInProcess("MageArena.exe")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class res_set : BaseUnityPlugin
	{
		public static ManualLogSource Logger;

		public static bool debug;

		private void Awake()
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			Logger = ((BaseUnityPlugin)this).Logger;
			Logger.LogInfo((object)"res_set loaded");
			configman.dotheconfig(((BaseUnityPlugin)this).Config);
			new Harmony("murderminemurderer.resolution").PatchAll();
		}
	}
	public static class configman
	{
		public static ConfigEntry<int> resolutionx;

		public static ConfigEntry<int> resolutiony;

		public static void dotheconfig(ConfigFile config)
		{
			resolutionx = config.Bind<int>("config", "resolutionX", Display.main.renderingWidth, (ConfigDescription)null);
			resolutiony = config.Bind<int>("config", "resolutionY", Display.main.renderingHeight, (ConfigDescription)null);
		}
	}
	[HarmonyPatch(typeof(MainMenuManager))]
	public static class resolution
	{
		private enum CmdShow
		{
			Hide,
			ShowNormal,
			ShowMinimized,
			ShowMaximized,
			ShowNormalDontActivate,
			Show,
			Minimize,
			ShowMinimizedDontActivate,
			ShowDontActivate,
			Restore,
			ShowDefault,
			ForceMinimize
		}

		private static IntPtr handle = IntPtr.Zero;

		[DllImport("user32.dll")]
		private static extern IntPtr GetActiveWindow();

		[DllImport("user32.dll")]
		private static extern bool IsIconic(IntPtr hWnd);

		[DllImport("user32.dll")]
		private static extern bool IsZoomed(IntPtr hWnd);

		[DllImport("user32.dll")]
		private static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);

		private static void GetHandle()
		{
			if (!(handle != IntPtr.Zero))
			{
				handle = GetActiveWindow();
			}
		}

		private static void ShowAsync(CmdShow cmd)
		{
			GetHandle();
			ShowWindowAsync(handle, (int)cmd);
		}

		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		public static void res()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			Screen.SetResolution(configman.resolutionx.Value, configman.resolutiony.Value, (FullScreenMode)3, new RefreshRate
			{
				numerator = 144u,
				denominator = 1u
			});
			ShowAsync(CmdShow.ShowMaximized);
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "res_set";

		public const string PLUGIN_NAME = "res_set";

		public const string PLUGIN_VERSION = "1.0.4";
	}
}