Decompiled source of LethalCursor v1.0.2

LethalCursor.dll

Decompiled 5 months ago
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
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: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("UnityEngine")]
[assembly: AssemblyCompany("LethalCursor")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("HIDES THE CURSOR FOREVER GRAAAHHH!!!")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("LethalCursor")]
[assembly: AssemblyTitle("LethalCursor")]
[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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace LethalCursor
{
	[BepInPlugin("LethalCursor", "LethalCursor", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		private ConfigEntry<string> cursorPath;

		private ConfigEntry<int> hotspotX;

		private ConfigEntry<int> hotspotY;

		private ConfigEntry<bool> disableModEntirely;

		private void Awake()
		{
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Expected O, but got Unknown
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "cursor.png");
			cursorPath = ((BaseUnityPlugin)this).Config.Bind<string>("General", "CursorPath", text, "The path to an image to use as a cursor.");
			hotspotX = ((BaseUnityPlugin)this).Config.Bind<int>("General", "HotSpotX", 0, "The X value of the cursor hotspot");
			hotspotY = ((BaseUnityPlugin)this).Config.Bind<int>("General", "HotSpotY", 0, "The Y value of the cursor hotspot");
			disableModEntirely = ((BaseUnityPlugin)this).Config.Bind<bool>("General.Toggles", "DisableMod", false, "Just use the default cursor.");
			if (disableModEntirely.Value)
			{
				((BaseUnityPlugin)this).Logger.LogWarning((object)"You have disabled the mod in the configuration file. The mod will use the default cursor");
				return;
			}
			((BaseUnityPlugin)this).Logger.LogInfo((object)"LethalCursor has been loaded! The default image is the white pixel, refer to the instructions or to the config for more info!");
			((BaseUnityPlugin)this).Logger.LogInfo((object)("Loading the image from " + cursorPath.Value));
			Texture2D val = new Texture2D(32, 32);
			byte[] array = File.ReadAllBytes(cursorPath.Value);
			ImageConversion.LoadImage(val, array);
			if ((Object)(object)val != (Object)null)
			{
				((BaseUnityPlugin)this).Logger.LogInfo((object)"Cursor is loaded succesfully!");
				Cursor.SetCursor(val, new Vector2((float)hotspotX.Value, (float)hotspotY.Value), (CursorMode)0);
			}
			else
			{
				((BaseUnityPlugin)this).Logger.LogError((object)"Something went wrong while loading the cursor! Using the default cursor instead!");
			}
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "LethalCursor";

		public const string PLUGIN_NAME = "LethalCursor";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}