Decompiled source of SideButtonBindings v1.0.0

SideButtonBindings.dll

Decompiled a day ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("SideButtonBindings")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Allow mouse side buttons in key bindings / 允许使用鼠标侧键设置快捷键")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+10d7d5c52035e347e2d00b648276bf1b19a61e01")]
[assembly: AssemblyProduct("SideButtonBindings")]
[assembly: AssemblyTitle("SideButtonBindings")]
[assembly: AssemblyVersion("1.0.0.0")]
[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 SideButtonBindings
{
	[BepInPlugin("org.fyyy.sidebuttonbindings", "SideButtonBindings", "1.0.0")]
	public sealed class Plugin : BaseUnityPlugin
	{
		private Harmony _harmony;

		private void Awake()
		{
			_harmony = Harmony.CreateAndPatchAll(typeof(SideButtonPatch), "org.fyyy.sidebuttonbindings");
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Mouse side button bindings enabled.");
		}

		private void OnDestroy()
		{
			Harmony harmony = _harmony;
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
		}
	}
	[HarmonyPatch(typeof(UIKeyEntry), "OverrideKey")]
	internal static class SideButtonPatch
	{
		internal static void Prefix(ref BuiltinKey ___builtinKey, int keyCode, out int __state)
		{
			__state = ___builtinKey.conflictGroup;
			if (keyCode >= 326 && keyCode <= 329)
			{
				___builtinKey.conflictGroup |= 6144;
			}
		}

		internal static void Finalizer(ref BuiltinKey ___builtinKey, int __state)
		{
			___builtinKey.conflictGroup = __state;
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "org.fyyy.sidebuttonbindings";

		public const string PLUGIN_NAME = "SideButtonBindings";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}