Decompiled source of NoHeadMenuDash v2.0.1

plugins/NoHeadMenuDash/NoHeadMenuDash.dll

Decompiled 19 hours ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using BepInEx.NET.Common;
using BepInExResoniteShim;
using FrooxEngine;
using HarmonyLib;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(/*Could not decode attribute arguments.*/)]
[assembly: TargetFramework(".NETCoreApp,Version=v10.0", FrameworkDisplayName = ".NET 10.0")]
[assembly: AssemblyCompany("art0007i")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("2.0.1.0")]
[assembly: AssemblyInformationalVersion("2.0.1+70fc8840625ec08adf0f0cab013b5852e9336277")]
[assembly: AssemblyProduct("NoHeadMenuDash")]
[assembly: AssemblyTitle("NoHeadMenuDash")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/art0007i/NoHeadMenuDash")]
[assembly: AssemblyVersion("2.0.1.0")]
[module: RefSafetyRules(11)]
namespace NoHeadMenuDash;

[ResonitePlugin("art0007i.NoHeadMenuDash", "NoHeadMenuDash", "2.0.1", "art0007i", "https://github.com/art0007i/NoHeadMenuDash")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BasePlugin
{
	[HarmonyPatch(typeof(InteractionHandler))]
	[HarmonyPatch("EndMenu")]
	private class InteractionHandler_EndMenu_Patch
	{
		private static global::System.Collections.Generic.IEnumerable<CodeInstruction> Transpiler(global::System.Collections.Generic.IEnumerable<CodeInstruction> instructions)
		{
			int num = 0;
			int num2 = 0;
			List<CodeInstruction> val = new List<CodeInstruction>(instructions);
			for (int i = 0; i < val.Count; i++)
			{
				if (val[i].operand is MethodInfo)
				{
					object operand = val[i].operand;
					MethodInfo val2 = (MethodInfo)((operand is MethodInfo) ? operand : null);
					if (((MemberInfo)val2).Name == "get_IsNearHead")
					{
						num = i;
					}
					else if (((MemberInfo)val2).Name == "TryVibrateMedium")
					{
						num2 = i + 1;
					}
				}
			}
			val.RemoveRange(num - 5, num2 - num + 6);
			return Enumerable.AsEnumerable<CodeInstruction>((global::System.Collections.Generic.IEnumerable<CodeInstruction>)val);
		}
	}

	[HarmonyPatch(typeof(InteractionHandler))]
	[HarmonyPatch("StartMenu")]
	private class InteractionHandler_StartMenu_Patch
	{
		public static void Postfix(InteractionHandler __instance)
		{
			if (__instance.IsNearHead && !__instance.SharesUserspaceToggleAndMenus)
			{
				((MethodBase)AccessTools.Method(typeof(InteractionHandler), "TryOpenContextMenu", (global::System.Type[])null, (global::System.Type[])null)).Invoke((object)__instance, (object[])null);
			}
		}
	}

	internal static ManualLogSource Log;

	public override void Load()
	{
		Log = ((BasePlugin)this).Log;
		((BasePlugin)this).HarmonyInstance.PatchAll();
	}
}
public static class PluginMetadata
{
	public const string GUID = "art0007i.NoHeadMenuDash";

	public const string NAME = "NoHeadMenuDash";

	public const string VERSION = "2.0.1";

	public const string AUTHORS = "art0007i";

	public const string REPOSITORY_URL = "https://github.com/art0007i/NoHeadMenuDash";
}