Decompiled source of MonoDetour BepInEx 5 v0.6.5

patchers/0.com.github.MonoDetour.BepInEx.5.dll

Decompiled a day ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx.Logging;
using Microsoft.CodeAnalysis;
using Mono.Cecil;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("Hamunii")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.6.5.0")]
[assembly: AssemblyInformationalVersion("0.6.5+6a4c28d54be44828571db7e49670b5b38256706c")]
[assembly: AssemblyProduct("MonoDetour.BepInEx.5")]
[assembly: AssemblyTitle("MonoDetour.BepInEx.5")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/MonoDetour/MonoDetour")]
[assembly: AssemblyVersion("0.6.5.0")]
[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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[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 MonoDetour.Logging
{
	internal static class Patcher
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static LogReceiver <0>__LogHandler;
		}

		internal static ManualLogSource Log = Logger.CreateLogSource("MonoDetour");

		public static IEnumerable<string> TargetDLLs { get; } = Array.Empty<string>();


		public static void Initialize()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			object obj = <>O.<0>__LogHandler;
			if (obj == null)
			{
				LogReceiver val = LogHandler;
				<>O.<0>__LogHandler = val;
				obj = (object)val;
			}
			MonoDetourLogger.OnLog += (LogReceiver)obj;
		}

		private static void LogHandler(LogChannel channel, string message)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Invalid comparison between Unknown and I4
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Invalid comparison between Unknown and I4
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Invalid comparison between Unknown and I4
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Invalid comparison between Unknown and I4
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			LogLevel val;
			if ((int)channel <= 4)
			{
				if ((int)channel != 0)
				{
					if ((int)channel != 4)
					{
						goto IL_0029;
					}
					val = (LogLevel)32;
				}
				else
				{
					val = (LogLevel)0;
				}
			}
			else if ((int)channel != 8)
			{
				if ((int)channel != 16)
				{
					goto IL_0029;
				}
				val = (LogLevel)2;
			}
			else
			{
				val = (LogLevel)4;
			}
			LogLevel val2 = val;
			Log.Log(val2, (object)message);
			return;
			IL_0029:
			throw new ArgumentOutOfRangeException("A log can only have a single known channel.");
		}

		public static void Patch(AssemblyDefinition _)
		{
		}
	}
}