Decompiled source of AeiouContent v0.2.0

AeiouContent.dll

Decompiled 8 months ago
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.IO.Pipes;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Threading;
using BepInEx;
using BepInEx.Logging;
using CWChat;
using ExitGames.Client.Photon;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using TMPro;
using UnityEngine;
using Zorro.Core;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("AeiouContent")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("DECtalk text-to-speech in Content Warning.")]
[assembly: AssemblyFileVersion("0.2.0.0")]
[assembly: AssemblyInformationalVersion("0.2.0+e9ba8a76d1a3bfd9fe4915ff982360b2ae35ab93")]
[assembly: AssemblyProduct("AeiouContent")]
[assembly: AssemblyTitle("AeiouContent")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.2.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.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 AeiouContent
{
	internal sealed class AeiouTimeTracker : MonoBehaviour
	{
		public float speakStopTime;

		public float loudness = 1f;
	}
	[HarmonyPatch(typeof(Player))]
	internal sealed class PlayerHook
	{
		[HarmonyPatch("OnGetMic")]
		[HarmonyPostfix]
		private static void OnGetMicPostfix(ref Player __instance)
		{
			Util.UpdateMicrophoneValue(__instance);
		}
	}
	[HarmonyPatch(typeof(PlayerSyncer))]
	internal sealed class PlayerSyncerHook
	{
		private static readonly FieldInfo? PlayerField = typeof(PlayerSyncer).GetField("player", BindingFlags.Instance | BindingFlags.NonPublic);

		[HarmonyPatch("OnPhotonSerializeView")]
		[HarmonyPostfix]
		private static void OnPhotonSerializeViewPostfix(ref PlayerSyncer __instance, PhotonStream stream, PhotonMessageInfo info)
		{
			if (!stream.IsWriting)
			{
				object? obj = PlayerField?.GetValue(__instance);
				Player val = (Player)((obj is Player) ? obj : null);
				if (!((Object)(object)val == (Object)null) && val.data != null)
				{
					Util.UpdateMicrophoneValue(val);
				}
			}
		}
	}
	[BepInPlugin("AeiouContent", "AeiouContent", "0.2.0")]
	public sealed class Plugin : BaseUnityPlugin
	{
		internal const string Guid = "AeiouContent";

		internal const string Name = "AeiouContent";

		internal const string Version = "0.2.0";

		public const string TtsGameObjectName = "AeiouContentGameObject";

		public const float MaxTtsAudibleDistance = 60f;

		public const float MaxTextVisibleDistance = 45f;

		public const float TextVisibilityVerticalRangeScaling = 0.3f;

		public const float TtsVolumeBoost = 1.2f;

		private Harmony _harmony;

		internal static Plugin Instance;

		internal SpeakProcessOwner SpeakProcessOwner;

		internal ManualLogSource SelfLogger => ((BaseUnityPlugin)this).Logger;

		private void Awake()
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Expected O, but got Unknown
			Instance = this;
			SpeakProcessOwner = new SpeakProcessOwner();
			SpeakProcessOwner.Init();
			_harmony = new Harmony("AeiouContent");
			_harmony.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"AeiouContent loaded!");
		}
	}
	[HarmonyPatch(typeof(RagdollHandler))]
	internal static class RagdollHandlerHook
	{
		private static readonly GameObject?[] AudioSourceGameObjects = (GameObject?[])(object)new GameObject[8];

		private static int _lastUsedAudioSource = -1;

		private const int NumSources = 8;

		private const int MaxSeconds = 40;

		private const int Frequency = 11025;

		private const int MaxSamples = 441000;

		private static readonly float[] UploadBuffer = new float[441000];

		private static GameObject GetAudioSourceGameObject()
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			_lastUsedAudioSource = (_lastUsedAudioSource + 1) % AudioSourceGameObjects.Length;
			GameObject val = AudioSourceGameObjects[_lastUsedAudioSource];
			if ((Object)(object)val != (Object)null)
			{
				return val;
			}
			val = new GameObject("AeiouContentGameObject");
			AudioSource obj = val.AddComponent<AudioSource>();
			val.AddComponent<AeiouTimeTracker>();
			AudioSourceGameObjects[_lastUsedAudioSource] = val;
			AudioSource val2 = obj;
			if (val2.clip == null)
			{
				AudioClip val4 = (val2.clip = AudioClip.Create("AeiouClip", 441000, 1, 11025, false));
			}
			return val;
		}

		[HarmonyPatch("FixedUpdate")]
		[HarmonyPostfix]
		private static void FixedUpdatePostfix(ref RagdollHandler __instance)
		{
			//IL_029d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0290: Unknown result type (might be due to invalid IL or missing references)
			SpeakProcessOwner.IncomingAudio result;
			GameObject val;
			GameObject sourceObject;
			AudioSource component2;
			float spatialBlend;
			for (; Plugin.Instance.SpeakProcessOwner.IncomingAudioData.TryDequeue(out result); component2.spatialBlend = spatialBlend, component2.dopplerLevel = 0f, val.transform.parent = null, val.transform.position = (((Object)(object)sourceObject != (Object)null) ? sourceObject.transform.position : Vector3.zero), val.transform.parent = (((Object)(object)sourceObject != (Object)null) ? sourceObject.transform : null), component2.Play())
			{
				val = null;
				Util.GetTtsGameObjects(result.Player, out sourceObject, out GameObject ttsObject);
				if ((Object)(object)ttsObject != (Object)null)
				{
					ttsObject.transform.parent = null;
					AudioSource component = ttsObject.GetComponent<AudioSource>();
					if ((Object)(object)component != (Object)null)
					{
						component.Stop();
					}
					val = ttsObject;
				}
				else if ((Object)(object)val == (Object)null)
				{
					val = GetAudioSourceGameObject();
				}
				Array.Clear(UploadBuffer, 0, UploadBuffer.Length);
				component2 = val.GetComponent<AudioSource>();
				AeiouTimeTracker component3 = val.GetComponent<AeiouTimeTracker>();
				component2.Stop();
				component2.clip.SetData(UploadBuffer, 0);
				for (int i = 0; i < Math.Min(result.Data.Length / 2, UploadBuffer.Length); i++)
				{
					ushort num = (ushort)(result.Data[i * 2] | (result.Data[i * 2 + 1] << 8));
					UploadBuffer[i] = Math.Clamp((float)(short)num / 32767f * 1.2f, -1f, 1f);
				}
				float num2 = (float)Math.Min(result.Data.Length / 2, UploadBuffer.Length) / 11025f;
				component3.speakStopTime = Time.unscaledTime + num2;
				component3.loudness = Mathf.Lerp(0.4f, 1f, Math.Min(1f, (float)result.MessageText.Count((char c) => c == '!' || char.IsUpper(c)) * 0.15f));
				component2.clip.SetData(UploadBuffer, 0);
				component2.outputAudioMixerGroup = SingletonAsset<MixerHolder>.Instance.voiceMixer.audioMixer.outputAudioMixerGroup;
				component2.rolloffMode = (AudioRolloffMode)1;
				component2.minDistance = 10f;
				component2.maxDistance = 60f;
				int spatialize;
				if ((Object)(object)result.Player != (Object)(object)Player.localPlayer)
				{
					Player player = result.Player;
					if (player != null)
					{
						PlayerData data = player.data;
						if (data != null)
						{
							spatialize = ((!data.dead) ? 1 : 0);
							goto IL_021d;
						}
					}
					spatialize = 0;
				}
				else
				{
					spatialize = 0;
				}
				goto IL_021d;
				IL_021d:
				component2.spatialize = (byte)spatialize != 0;
				if ((Object)(object)result.Player != (Object)(object)Player.localPlayer)
				{
					Player player = result.Player;
					if (player != null)
					{
						PlayerData data = player.data;
						if (data != null && !data.dead)
						{
							spatialBlend = 1f;
							continue;
						}
					}
				}
				spatialBlend = 0f;
			}
		}
	}
	[HarmonyPatch(typeof(ChatNet))]
	internal sealed class SimpleChatHook
	{
		private const byte ChatMessageCode = 16;

		[HarmonyPatch("OnEvent")]
		[HarmonyPrefix]
		private static bool OnEventPrefix(ref ChatNet __instance, EventData photonEvent)
		{
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01db: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
			if (photonEvent.Code != 16)
			{
				return false;
			}
			if (!(photonEvent.CustomData is object[] array) || array.Length < 4 || !(array[0] is string text) || !(array[1] is string text2) || !(array[2] is bool flag) || !(array[3] is string text3))
			{
				return false;
			}
			MsgData val = default(MsgData);
			((MsgData)(ref val))..ctor(text, text2, flag, text3);
			int actorNumber = photonEvent.Sender;
			Plugin.Instance.SelfLogger.LogMessage((object)("Message from " + val.name + ": " + val.message));
			Player val2 = ((IEnumerable<Player>)PlayerHandler.instance.players).FirstOrDefault((Func<Player, bool>)((Player p) => p.refs.view.Owner.ActorNumber == actorNumber));
			if (val2 == null)
			{
				return false;
			}
			if (!Player.localPlayer.data.dead && val2.data.dead)
			{
				return false;
			}
			val.name = val2.refs.view.Controller.NickName + " ( " + ((TMP_Text)val2.refs.visor.visorFaceText).text + " )";
			Bodypart? bodypart = Util.GetBodypart(val2, (BodypartType)4);
			Vector3 val3 = ((bodypart != null) ? ((Component)bodypart).transform.position : Vector3.zero);
			Bodypart? bodypart2 = Util.GetBodypart(Player.localPlayer, (BodypartType)4);
			Vector3 val4 = ((bodypart2 != null) ? ((Component)bodypart2).transform.position : Vector3.zero);
			float num = Vector3.Distance(val3, val4);
			Plugin.Instance.SelfLogger.LogDebug((object)$"Distance from {val2.refs.view.Controller.NickName}: {num}");
			if (num <= 60f)
			{
				Plugin.Instance.SpeakProcessOwner.Speak(val.message, val2);
			}
			if (Vector3.Distance(Util.GetVerticallyScaledPosition(val3), Util.GetVerticallyScaledPosition(val4)) <= 45f)
			{
				__instance.AddNewMessage(val);
			}
			return false;
		}
	}
	internal sealed class SpeakProcessOwner
	{
		private readonly struct State
		{
			internal readonly Process Process;

			internal readonly AnonymousPipeServerStream OutPipe;

			internal readonly AnonymousPipeServerStream InPipe;

			internal readonly BinaryReader BinaryReader;

			internal readonly StreamWriter StreamWriter;

			public State(Process process, AnonymousPipeServerStream outPipe, AnonymousPipeServerStream inPipe, BinaryReader binaryReader, StreamWriter streamWriter)
			{
				Process = process;
				OutPipe = outPipe;
				InPipe = inPipe;
				BinaryReader = binaryReader;
				StreamWriter = streamWriter;
			}
		}

		private readonly struct OutgoingMsg
		{
			public readonly string Message;

			public readonly Player? Player;

			public OutgoingMsg(string message, Player? player)
			{
				Message = message;
				Player = player;
			}
		}

		public readonly struct IncomingAudio
		{
			public readonly string MessageText;

			public readonly byte[] Data;

			public readonly Player? Player;

			public IncomingAudio(string messageText, byte[] data, Player? player)
			{
				MessageText = messageText;
				Data = data;
				Player = player;
			}
		}

		private readonly ConcurrentQueue<OutgoingMsg> _outgoingMsgs = new ConcurrentQueue<OutgoingMsg>();

		private readonly object _mutex = new object();

		private State? _currentState;

		public readonly ConcurrentQueue<IncomingAudio> IncomingAudioData = new ConcurrentQueue<IncomingAudio>();

		public void Init()
		{
			lock (_mutex)
			{
				_currentState?.Process.Kill();
				string directoryName = Path.GetDirectoryName(Path.GetFullPath(typeof(Plugin).Assembly.Location));
				if (string.IsNullOrWhiteSpace(directoryName) || !Directory.Exists(directoryName))
				{
					Plugin.Instance.SelfLogger.LogError((object)("Failed to start SpeakServer: \"" + directoryName + "\" is not a valid directory"));
					return;
				}
				AnonymousPipeServerStream anonymousPipeServerStream = new AnonymousPipeServerStream(PipeDirection.Out, HandleInheritability.Inheritable);
				AnonymousPipeServerStream anonymousPipeServerStream2 = new AnonymousPipeServerStream(PipeDirection.In, HandleInheritability.Inheritable);
				Process process = Process.Start(new ProcessStartInfo
				{
					FileName = Path.Combine(directoryName, "./SpeakServer.exe"),
					UseShellExecute = false,
					Arguments = anonymousPipeServerStream.GetClientHandleAsString() + " " + anonymousPipeServerStream2.GetClientHandleAsString()
				});
				if (process == null)
				{
					Plugin.Instance.SelfLogger.LogError((object)"Failed to start SpeakServer: program could not launch");
					return;
				}
				StreamWriter streamWriter = new StreamWriter(anonymousPipeServerStream);
				BinaryReader binaryReader = new BinaryReader(anonymousPipeServerStream2);
				_currentState = new State(process, anonymousPipeServerStream, anonymousPipeServerStream2, binaryReader, streamWriter);
			}
			new Thread(ServerCommunicationLoop).Start();
			Plugin.Instance.SelfLogger.LogInfo((object)"Starting up AeiouContent!");
		}

		private State? GetState()
		{
			lock (_mutex)
			{
				return _currentState;
			}
		}

		public void Speak(string message, Player? player)
		{
			_outgoingMsgs.Enqueue(new OutgoingMsg(message, player));
		}

		private void ServerCommunicationLoop()
		{
			State? state = GetState();
			if (!state.HasValue)
			{
				return;
			}
			State valueOrDefault = state.GetValueOrDefault();
			while (valueOrDefault.OutPipe.IsConnected && valueOrDefault.InPipe.IsConnected)
			{
				state = GetState();
				if (!state.HasValue || !state.GetValueOrDefault().Equals(valueOrDefault))
				{
					break;
				}
				try
				{
					OutgoingMsg result;
					while (_outgoingMsgs.TryDequeue(out result))
					{
						valueOrDefault.StreamWriter.WriteLine("msg=" + result.Message);
						valueOrDefault.StreamWriter.Flush();
						int num = valueOrDefault.BinaryReader.ReadInt32();
						if (num > 0)
						{
							byte[] data = valueOrDefault.BinaryReader.ReadBytes(num);
							IncomingAudioData.Enqueue(new IncomingAudio(result.Message, data, result.Player));
						}
					}
				}
				catch (Exception arg)
				{
					Plugin.Instance.SelfLogger.LogError((object)$"Exception in ServerCommunicationLoop: {arg}");
				}
				Thread.Sleep(32);
			}
		}
	}
	internal static class Util
	{
		private static readonly MethodInfo? GetBodypartMethodInfo = typeof(PlayerRagdoll).GetMethod("GetBodypart", BindingFlags.Instance | BindingFlags.NonPublic);

		public static Bodypart? GetBodypart(Player? player, BodypartType type)
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			if (player == null)
			{
				return null;
			}
			if ((object)GetBodypartMethodInfo == null)
			{
				return null;
			}
			object? obj = GetBodypartMethodInfo.Invoke(player.refs.ragdoll, new object[1] { type });
			return (Bodypart?)((obj is Bodypart) ? obj : null);
		}

		public static void GetTtsGameObjects(Player? player, out GameObject? sourceObject, out GameObject? ttsObject)
		{
			object obj;
			if ((Object)(object)player != (Object)(object)Player.localPlayer && player != null)
			{
				PlayerData data = player.data;
				if (data != null && !data.dead)
				{
					obj = GetBodypart(player, (BodypartType)4);
					goto IL_0030;
				}
			}
			obj = MainCamera.instance;
			goto IL_0030;
			IL_0030:
			MonoBehaviour val = (MonoBehaviour)obj;
			sourceObject = (((Object)(object)val != (Object)null) ? ((Component)val).gameObject : null);
			ttsObject = null;
			if (!((Object)(object)sourceObject == (Object)null))
			{
				Transform val2 = sourceObject.transform.Find("AeiouContentGameObject");
				ttsObject = (((Object)(object)val2 != (Object)null) ? ((Component)val2).gameObject : null);
			}
		}

		public static void UpdateMicrophoneValue(Player player)
		{
			if (player.data.dead)
			{
				return;
			}
			GetTtsGameObjects(player, out GameObject _, out GameObject ttsObject);
			if (!((Object)(object)ttsObject == (Object)null))
			{
				AeiouTimeTracker component = ttsObject.GetComponent<AeiouTimeTracker>();
				if (!((Object)(object)component == (Object)null) && !(Time.unscaledTime > component.speakStopTime))
				{
					player.data.microphoneValue = component.loudness;
				}
			}
		}

		public static Vector3 GetVerticallyScaledPosition(Vector3 position)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			return new Vector3(position.x, position.y / 0.3f, position.z);
		}
	}
}

SharpTalk.dll

Decompiled 8 months ago
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("SharpTalk")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+e9ba8a76d1a3bfd9fe4915ff982360b2ae35ab93")]
[assembly: AssemblyProduct("SharpTalk")]
[assembly: AssemblyTitle("SharpTalk")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace SharpTalk;

public class FonixTalkEngine : IDisposable
{
	[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
	private delegate void DtCallbackRoutine(int P_0, int P_1, uint P_2, uint P_3);

	private struct PhonemeMark
	{
		public byte ThisPhoneme;

		public byte NextPhoneme;

		public ushort Duration;
	}

	[StructLayout(LayoutKind.Explicit)]
	private struct PhonemeTag
	{
		[FieldOffset(0)]
		public PhonemeMark PMData;

		[FieldOffset(0)]
		public int DWData;
	}

	private struct InMemoryRaiiHelper : IDisposable
	{
		private readonly FonixTalkEngine _engine;

		public InMemoryRaiiHelper(FonixTalkEngine P_0)
		{
			_engine = P_0;
		}

		public void Dispose()
		{
			_engine.CloseInMemory();
		}
	}

	private struct BufferRaiiHelper : IDisposable
	{
		private readonly FonixTalkEngine _engine;

		public BufferRaiiHelper(FonixTalkEngine P_0)
		{
			_engine = P_0;
		}

		public void Dispose()
		{
			_engine.FreeBuffer();
		}
	}

	[CompilerGenerated]
	private EventHandler<PhonemeEventArgs> Phoneme;

	private static readonly uint UiIndexMsg = RegisterWindowMessage("DECtalkIndexMessage");

	private static readonly uint UiErrorMsg = RegisterWindowMessage("DECtalkErrorMessage");

	private static readonly uint UiBufferMsg = RegisterWindowMessage("DECtalkBufferMessage");

	private static readonly uint UiPhonemeMsg = RegisterWindowMessage("DECtalkVisualMessage");

	private IntPtr _handle;

	private DtCallbackRoutine _callback;

	private TtsBufferManaged _buffer;

	private Stream _bufferStream;

	[DllImport("FonixTalk.dll")]
	private static extern MMRESULT TextToSpeechStartupEx(out IntPtr P_0, uint P_1, uint P_2, DtCallbackRoutine P_3, ref IntPtr P_4);

	[DllImport("FonixTalk.dll")]
	[return: MarshalAs(UnmanagedType.Bool)]
	private static extern bool TextToSpeechSelectLang(IntPtr P_0, uint P_1);

	[DllImport("FonixTalk.dll")]
	private static extern uint TextToSpeechStartLang([MarshalAs(UnmanagedType.LPStr)] string P_0);

	[DllImport("FonixTalk.dll")]
	private static extern MMRESULT TextToSpeechSpeakA(IntPtr P_0, [MarshalAs(UnmanagedType.LPStr)] string P_1, uint P_2);

	[DllImport("FonixTalk.dll")]
	private static extern MMRESULT TextToSpeechShutdown(IntPtr P_0);

	[DllImport("FonixTalk.dll")]
	private static extern MMRESULT TextToSpeechReset(IntPtr P_0, [MarshalAs(UnmanagedType.Bool)] bool P_1);

	[DllImport("FonixTalk.dll")]
	private static extern MMRESULT TextToSpeechSync(IntPtr P_0);

	[DllImport("FonixTalk.dll")]
	private unsafe static extern MMRESULT TextToSpeechAddBuffer(IntPtr P_0, TtsBufferManaged.TTS_BUFFER_T* P_1);

	[DllImport("FonixTalk.dll")]
	private static extern MMRESULT TextToSpeechOpenInMemory(IntPtr P_0, uint P_1);

	[DllImport("FonixTalk.dll")]
	private static extern MMRESULT TextToSpeechCloseInMemory(IntPtr P_0);

	[DllImport("user32.dll")]
	private static extern uint RegisterWindowMessage([MarshalAs(UnmanagedType.LPStr)] string P_0);

	public FonixTalkEngine()
	{
		Init("US");
	}

	private void Init(string P_0)
	{
		_callback = TtsCallback;
		_buffer = null;
		_bufferStream = null;
		if (P_0 != "XX")
		{
			uint num = TextToSpeechStartLang(P_0);
			if ((num & 0x4000u) != 0)
			{
				switch (num)
				{
				case 32767u:
					throw new FonixTalkException("This version of DECtalk does not support multiple languages.");
				case 32766u:
					throw new FonixTalkException("The specified language was not found.");
				}
			}
			if (!TextToSpeechSelectLang(IntPtr.Zero, num))
			{
				throw new FonixTalkException("The specified language failed to load.");
			}
		}
		Check(TextToSpeechStartupEx(out _handle, uint.MaxValue, 0u, _callback, ref _handle));
		Speak("[:phone on]");
	}

	private unsafe void TtsCallback(int lParam1, int lParam2, uint drCallbackParameter, uint uiMsg)
	{
		if (uiMsg == UiPhonemeMsg && Phoneme != null)
		{
			PhonemeTag phonemeTag = default(PhonemeTag);
			phonemeTag.DWData = lParam2;
			PhonemeTag phonemeTag2 = phonemeTag;
			Phoneme(this, new PhonemeEventArgs((char)phonemeTag2.PMData.ThisPhoneme, phonemeTag2.PMData.Duration));
		}
		else if (uiMsg == UiBufferMsg)
		{
			_bufferStream.Write(_buffer.GetBufferBytes(), 0, (int)_buffer.Length);
			_ = _buffer.Full;
			_buffer.Reset();
			Check(TextToSpeechAddBuffer(_handle, _buffer.ValuePointer));
		}
		else if (uiMsg != UiErrorMsg)
		{
			_ = UiIndexMsg;
		}
	}

	public byte[] SpeakToMemory(string P_0)
	{
		using (_bufferStream = new MemoryStream())
		{
			using (OpenInMemory(4u))
			{
				using (ReadyBuffer())
				{
					Speak(P_0);
					Sync();
					TextToSpeechReset(_handle, false);
				}
			}
			return ((MemoryStream)_bufferStream).ToArray();
		}
	}

	public void Sync()
	{
		Check(TextToSpeechSync(_handle));
	}

	public void Speak(string P_0)
	{
		Check(TextToSpeechSpeakA(_handle, P_0, 1u));
	}

	private static void Check(MMRESULT P_0)
	{
		if (P_0 != 0)
		{
			throw new FonixTalkException(P_0);
		}
	}

	private InMemoryRaiiHelper OpenInMemory(uint P_0)
	{
		Check(TextToSpeechOpenInMemory(_handle, P_0));
		return new InMemoryRaiiHelper(this);
	}

	private void CloseInMemory()
	{
		Check(TextToSpeechCloseInMemory(_handle));
	}

	private unsafe BufferRaiiHelper ReadyBuffer()
	{
		if (_buffer != null)
		{
			throw new InvalidOperationException("Buffer already exists.");
		}
		_buffer = new TtsBufferManaged();
		Check(TextToSpeechAddBuffer(_handle, _buffer.ValuePointer));
		return new BufferRaiiHelper(this);
	}

	private void FreeBuffer()
	{
		_buffer.Dispose();
		_buffer = null;
	}

	~FonixTalkEngine()
	{
		Dispose(false);
	}

	public void Dispose()
	{
		Dispose(true);
	}

	private void Dispose(bool P_0)
	{
		TextToSpeechShutdown(_handle);
		if (_buffer != null)
		{
			_buffer.Dispose();
		}
		if (P_0)
		{
			GC.SuppressFinalize(this);
		}
	}
}
public sealed class FonixTalkException : Exception
{
	internal FonixTalkException(MMRESULT P_0)
		: base(GetMessage(P_0))
	{
	}

	internal FonixTalkException(string P_0)
		: base(P_0)
	{
	}

	private static string GetMessage(MMRESULT P_0)
	{
		return P_0 switch
		{
			MMRESULT.MMSYSERR_INVALPARAM => "An invalid parameter was passed to the function.", 
			MMRESULT.MMSYSERR_INVALHANDLE => "The associated handle is invalid. Did you dispose it?", 
			MMRESULT.MMSYSERR_ERROR => "The function returned a generic error. Please check that you are using the functions correctly.", 
			MMRESULT.MMSYSERR_NOERROR => "The function did not throw an error. If you are seeing this, Berkin was obviously high while coding.", 
			MMRESULT.MMSYSERR_NOMEM => "There was insufficnent memory available to allocate the requested resources.", 
			MMRESULT.MMSYSERR_ALLOCATED => "The requested resources are already in use somewhere else.", 
			MMRESULT.WAVERR_BADFORMAT => "Wave output device does not support request format.", 
			MMRESULT.MMSYSERR_BADDEVICEID => "Device ID out of range.", 
			MMRESULT.MMSYSERR_NODRIVER => "No wave output device present.", 
			_ => P_0.ToString(), 
		};
	}
}
internal enum MMRESULT : uint
{
	MMSYSERR_NOERROR = 0u,
	MMSYSERR_ERROR = 1u,
	MMSYSERR_BADDEVICEID = 2u,
	MMSYSERR_NOTENABLED = 3u,
	MMSYSERR_ALLOCATED = 4u,
	MMSYSERR_INVALHANDLE = 5u,
	MMSYSERR_NODRIVER = 6u,
	MMSYSERR_NOMEM = 7u,
	MMSYSERR_NOTSUPPORTED = 8u,
	MMSYSERR_BADERRNUM = 9u,
	MMSYSERR_INVALFLAG = 10u,
	MMSYSERR_INVALPARAM = 11u,
	MMSYSERR_HANDLEBUSY = 12u,
	MMSYSERR_INVALIDALIAS = 13u,
	MMSYSERR_BADDB = 14u,
	MMSYSERR_KEYNOTFOUND = 15u,
	MMSYSERR_READERROR = 16u,
	MMSYSERR_WRITEERROR = 17u,
	MMSYSERR_DELETEERROR = 18u,
	MMSYSERR_VALNOTFOUND = 19u,
	MMSYSERR_NODRIVERCB = 20u,
	WAVERR_BADFORMAT = 32u,
	WAVERR_STILLPLAYING = 33u,
	WAVERR_UNPREPARED = 34u
}
public class PhonemeEventArgs : EventArgs
{
	public readonly char Phoneme;

	public readonly uint Duration;

	internal PhonemeEventArgs(char P_0, uint P_1)
	{
		Phoneme = P_0;
		Duration = P_1;
	}
}
[StructLayout(LayoutKind.Sequential)]
internal class TtsBufferManaged : IDisposable
{
	public struct TTS_BUFFER_T
	{
		public IntPtr DataPtr;

		public unsafe TTS_PHONEME_T* PhonemeArrayPtr;

		public unsafe TTS_INDEX_T* IndexArrayPtr;

		public uint MaxBufferLength;

		public uint MaxPhonemeChanges;

		public uint MaxIndexMarks;

		public uint BufferLength;

		public uint PhonemeChangeCount;

		public uint IndexMarkCount;

		public uint _reserved;
	}

	private TTS_BUFFER_T _value;

	private GCHandle _pinHandle;

	public bool Full => _value.BufferLength == _value.MaxBufferLength;

	public uint Length => _value.BufferLength;

	public unsafe TTS_BUFFER_T* ValuePointer
	{
		get
		{
			fixed (TTS_BUFFER_T* result = &_value)
			{
				return result;
			}
		}
	}

	public TtsBufferManaged()
	{
		_value = default(TTS_BUFFER_T);
		_pinHandle = GCHandle.Alloc(this, GCHandleType.Pinned);
		_value.MaxBufferLength = 16384u;
		_value.DataPtr = Marshal.AllocHGlobal(16384);
	}

	public byte[] GetBufferBytes()
	{
		byte[] array = new byte[_value.BufferLength];
		Marshal.Copy(_value.DataPtr, array, 0, (int)_value.BufferLength);
		return array;
	}

	public void Reset()
	{
		_value.BufferLength = 0u;
		_value.PhonemeChangeCount = 0u;
		_value.IndexMarkCount = 0u;
	}

	public void Dispose()
	{
		Marshal.FreeHGlobal(_value.DataPtr);
		_pinHandle.Free();
		GC.SuppressFinalize(this);
	}
}
internal struct TTS_INDEX_T
{
	public uint IndexValue;

	public uint SampleNumber;

	private readonly uint _reserved;
}
internal struct TTS_PHONEME_T
{
	public uint Phoneme;

	public uint PhonemeSampleNumber;

	public uint PhonemeDuration;

	private readonly uint _reserved;
}

SpeakServer.dll

Decompiled 8 months ago
using System;
using System.Diagnostics;
using System.IO;
using System.IO.Pipes;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Text;
using SharpTalk;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(/*Could not decode attribute arguments.*/)]
[assembly: TargetFramework(".NETCoreApp,Version=v8.0", FrameworkDisplayName = ".NET 8.0")]
[assembly: AssemblyCompany("SpeakServer")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+e9ba8a76d1a3bfd9fe4915ff982360b2ae35ab93")]
[assembly: AssemblyProduct("SpeakServer")]
[assembly: AssemblyTitle("SpeakServer")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace SpeakServer;

internal static class Program
{
	private static void Main(string[] P_0)
	{
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		//IL_0049: Expected O, but got Unknown
		//IL_004d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0053: Expected O, but got Unknown
		//IL_0060: Unknown result type (might be due to invalid IL or missing references)
		//IL_0066: Expected O, but got Unknown
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0073: Expected O, but got Unknown
		//IL_0073: Unknown result type (might be due to invalid IL or missing references)
		//IL_007a: Expected O, but got Unknown
		if (P_0.Length < 2)
		{
			Console.WriteLine($"AeiouCompany SpeakServer: 2 pipes required, got {P_0.Length}, closing");
			return;
		}
		AnonymousPipeClientStream val = new AnonymousPipeClientStream((PipeDirection)1, P_0[0]);
		try
		{
			AnonymousPipeClientStream val2 = new AnonymousPipeClientStream((PipeDirection)2, P_0[1]);
			try
			{
				StreamReader val3 = new StreamReader((Stream)(object)val, Encoding.UTF8, true, 8192, true);
				try
				{
					BinaryWriter val4 = new BinaryWriter((Stream)(object)val2, Encoding.UTF8, true);
					try
					{
						FonixTalkEngine val5 = new FonixTalkEngine();
						try
						{
							Console.WriteLine("AeiouCompany SpeakServer: Connected!");
							ListenForMessages(val2, val3, val4, val5);
							val5.Sync();
						}
						finally
						{
							((global::System.IDisposable)val5)?.Dispose();
						}
					}
					finally
					{
						((global::System.IDisposable)val4)?.Dispose();
					}
				}
				finally
				{
					((global::System.IDisposable)val3)?.Dispose();
				}
			}
			finally
			{
				((global::System.IDisposable)val2)?.Dispose();
			}
		}
		finally
		{
			((global::System.IDisposable)val)?.Dispose();
		}
	}

	private static void ListenForMessages(AnonymousPipeClientStream P_0, StreamReader P_1, BinaryWriter P_2, FonixTalkEngine P_3)
	{
		//IL_00e4: Expected O, but got Unknown
		while (((PipeStream)P_0).IsConnected)
		{
			try
			{
				string text = ((TextReader)P_1).ReadLine() ?? "";
				Console.WriteLine("AeiouCompany SpeakServer: Incoming line \"" + text + "\"");
				if (string.IsNullOrWhiteSpace(text))
				{
					P_2.Write(0);
					P_2.Flush();
					continue;
				}
				if (text == "exit")
				{
					break;
				}
				if (text.StartsWith("msg=", (StringComparison)4))
				{
					string text2 = text.Substring("msg=".Length);
					byte[] array = P_3.SpeakToMemory("[:np]" + text2 + "]");
					P_2.Write(array.Length);
					P_2.Write(array);
					P_2.Flush();
					Console.WriteLine($"AeiouCompany SpeakServer: Output {array.Length} bytes of audio");
				}
			}
			catch (IOException val)
			{
				IOException val2 = val;
				Console.WriteLine("Broken: " + ((global::System.Exception)(object)val2).Message);
				break;
			}
		}
	}
}

System.Collections.Immutable.dll

Decompiled 8 months ago
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using FxResources.System.Collections.Immutable;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(/*Could not decode attribute arguments.*/)]
[assembly: TargetFramework(".NETCoreApp,Version=v8.0", FrameworkDisplayName = ".NET 8.0")]
[assembly: AssemblyMetadata("Serviceable", "True")]
[assembly: AssemblyMetadata("PreferInbox", "True")]
[assembly: AssemblyDefaultAlias("System.Collections.Immutable")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: CLSCompliant(true)]
[assembly: AssemblyMetadata("IsTrimmable", "True")]
[assembly: DefaultDllImportSearchPaths(/*Could not decode attribute arguments.*/)]
[assembly: AssemblyCompany("Microsoft Corporation")]
[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")]
[assembly: AssemblyDescription("This package provides collections that are thread safe and guaranteed to never change their contents, also known as immutable collections. Like strings, any methods that perform modifications will not change the existing instance but instead return a new instance. For efficiency reasons, the implementation uses a sharing mechanism to ensure that newly created instances share as much data as possible with the previous instance while ensuring that operations have a predictable time complexity.\r\n\r\nThe System.Collections.Immutable library is built-in as part of the shared framework in .NET Runtime. The package can be installed when you need to use it in other target frameworks.")]
[assembly: AssemblyFileVersion("8.0.324.11423")]
[assembly: AssemblyInformationalVersion("8.0.3+9f4b1f5d664afdfc80e1508ab7ed099dff210fbd")]
[assembly: AssemblyProduct("Microsoft® .NET")]
[assembly: AssemblyTitle("System.Collections.Immutable")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/dotnet/runtime")]
[assembly: AssemblyVersion("8.0.0.0")]
[module: RefSafetyRules(11)]
[module: NullablePublicOnly(true)]
[module: SkipLocalsInit]
namespace FxResources.System.Collections.Immutable
{
	internal static class SR
	{
	}
}
namespace System
{
	internal static class SR
	{
		private static readonly bool s_usingResourceKeys;

		private static ResourceManager s_resourceManager;

		internal static ResourceManager ResourceManager
		{
			get
			{
				//IL_0013: Unknown result type (might be due to invalid IL or missing references)
				//IL_0018: Unknown result type (might be due to invalid IL or missing references)
				//IL_001e: Expected O, but got Unknown
				object obj = s_resourceManager;
				if (obj == null)
				{
					ResourceManager val = new ResourceManager(typeof(FxResources.System.Collections.Immutable.SR));
					s_resourceManager = val;
					obj = (object)val;
				}
				return (ResourceManager)obj;
			}
		}

		internal static string CapacityMustEqualCountOnMove => GetResourceString("CapacityMustEqualCountOnMove");

		internal static string InvalidOperationOnDefaultArray => GetResourceString("InvalidOperationOnDefaultArray");

		internal static bool UsingResourceKeys()
		{
			return s_usingResourceKeys;
		}

		private static string GetResourceString(string P_0)
		{
			if (UsingResourceKeys())
			{
				return P_0;
			}
			string result = null;
			try
			{
				result = ResourceManager.GetString(P_0);
			}
			catch (MissingManifestResourceException)
			{
			}
			return result;
		}

		static SR()
		{
			System.Runtime.CompilerServices.Unsafe.SkipInit(out bool flag);
			s_usingResourceKeys = AppContext.TryGetSwitch("System.Resources.UseSystemResourceKeys", ref flag) && flag;
		}
	}
}
namespace System.Linq
{
	public static class ImmutableArrayExtensions
	{
		public static T? FirstOrDefault<T>(this ImmutableArray<T> P_0, Func<T, bool> P_1)
		{
			Requires.NotNull<Func<T, bool>>(P_1, "predicate");
			T[] array = P_0.array;
			foreach (T val in array)
			{
				if (P_1.Invoke(val))
				{
					return val;
				}
			}
			return default(T);
		}
	}
}
namespace System.Runtime.Versioning
{
	[AttributeUsage(/*Could not decode attribute arguments.*/)]
	internal sealed class NonVersionableAttribute : System.Attribute
	{
	}
}
namespace System.Runtime.InteropServices
{
	public static class ImmutableCollectionsMarshal
	{
		public static ImmutableArray<T> AsImmutableArray<T>(T[]? P_0)
		{
			return new ImmutableArray<T>(P_0);
		}
	}
}
namespace System.Collections.Immutable
{
	internal interface IImmutableArray
	{
		System.Array? Array { get; }
	}
	public static class ImmutableArray
	{
		public static ImmutableArray<T>.Builder CreateBuilder<T>(int P_0)
		{
			return new ImmutableArray<T>.Builder(P_0);
		}
	}
	[DefaultMember("Item")]
	[CollectionBuilder(typeof(ImmutableArray), "Create")]
	[DebuggerDisplay("{DebuggerDisplay,nq}")]
	[NonVersionable]
	public readonly struct ImmutableArray<T> : System.Collections.Generic.IReadOnlyList<T>, System.Collections.Generic.IEnumerable<T>, System.Collections.IEnumerable, System.Collections.Generic.IReadOnlyCollection<T>, System.Collections.Generic.IList<T>, System.Collections.Generic.ICollection<T>, IEquatable<ImmutableArray<T>>, System.Collections.IList, System.Collections.ICollection, IImmutableArray
	{
		[DefaultMember("Item")]
		[DebuggerDisplay("Count = {Count}")]
		[DebuggerTypeProxy(typeof(ImmutableArrayBuilderDebuggerProxy<>))]
		public sealed class Builder : System.Collections.Generic.IList<T>, System.Collections.Generic.ICollection<T>, System.Collections.Generic.IEnumerable<T>, System.Collections.IEnumerable, System.Collections.Generic.IReadOnlyList<T>, System.Collections.Generic.IReadOnlyCollection<T>
		{
			[CompilerGenerated]
			private sealed class <GetEnumerator>d__66 : System.Collections.Generic.IEnumerator<T>, System.Collections.IEnumerator, System.IDisposable
			{
				private int <>1__state;

				private T <>2__current;

				public Builder <>4__this;

				private int <i>5__2;

				T System.Collections.Generic.IEnumerator<T>.Current
				{
					[DebuggerHidden]
					get
					{
						return <>2__current;
					}
				}

				object System.Collections.IEnumerator.Current
				{
					[DebuggerHidden]
					get
					{
						return <>2__current;
					}
				}

				[DebuggerHidden]
				public <GetEnumerator>d__66(int P_0)
				{
					<>1__state = P_0;
				}

				[DebuggerHidden]
				void System.IDisposable.Dispose()
				{
				}

				private bool MoveNext()
				{
					int num = <>1__state;
					Builder builder = <>4__this;
					switch (num)
					{
					default:
						return false;
					case 0:
						<>1__state = -1;
						<i>5__2 = 0;
						break;
					case 1:
						<>1__state = -1;
						<i>5__2++;
						break;
					}
					if (<i>5__2 < builder.Count)
					{
						<>2__current = builder[<i>5__2];
						<>1__state = 1;
						return true;
					}
					return false;
				}

				bool System.Collections.IEnumerator.MoveNext()
				{
					//ILSpy generated this explicit interface implementation from .override directive in MoveNext
					return this.MoveNext();
				}

				[DebuggerHidden]
				void System.Collections.IEnumerator.Reset()
				{
					//IL_0000: Unknown result type (might be due to invalid IL or missing references)
					throw new NotSupportedException();
				}
			}

			private T[] _elements;

			private int _count;

			public int Capacity => _elements.Length;

			public int Count
			{
				get
				{
					return _count;
				}
				set
				{
					Requires.Range(value >= 0, "value");
					if (value < _count)
					{
						if (_count - value > 64)
						{
							System.Array.Clear((System.Array)_elements, value, _count - value);
						}
						else
						{
							for (int i = value; i < Count; i++)
							{
								_elements[i] = default(T);
							}
						}
					}
					else if (value > _count)
					{
						EnsureCapacity(value);
					}
					_count = value;
				}
			}

			public T this[int P_0]
			{
				get
				{
					if (P_0 >= Count)
					{
						ThrowIndexOutOfRangeException();
					}
					return _elements[P_0];
				}
				set
				{
					if (P_0 >= Count)
					{
						ThrowIndexOutOfRangeException();
					}
					_elements[P_0] = value;
				}
			}

			bool System.Collections.Generic.ICollection<T>.IsReadOnly => false;

			internal Builder(int P_0)
			{
				Requires.Range(P_0 >= 0, "capacity");
				_elements = new T[P_0];
				_count = 0;
			}

			private static void ThrowIndexOutOfRangeException()
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				throw new IndexOutOfRangeException();
			}

			public ImmutableArray<T> MoveToImmutable()
			{
				//IL_0013: Unknown result type (might be due to invalid IL or missing references)
				if (Capacity != Count)
				{
					throw new InvalidOperationException(SR.CapacityMustEqualCountOnMove);
				}
				T[] elements = _elements;
				_elements = ImmutableArray<T>.Empty.array;
				_count = 0;
				return new ImmutableArray<T>(elements);
			}

			public void Clear()
			{
				Count = 0;
			}

			public void Insert(int P_0, T P_1)
			{
				Requires.Range(P_0 >= 0 && P_0 <= Count, "index");
				EnsureCapacity(Count + 1);
				if (P_0 < Count)
				{
					System.Array.Copy((System.Array)_elements, P_0, (System.Array)_elements, P_0 + 1, Count - P_0);
				}
				_count++;
				_elements[P_0] = P_1;
			}

			public void Add(T P_0)
			{
				int num = _count + 1;
				EnsureCapacity(num);
				_elements[_count] = P_0;
				_count = num;
			}

			public bool Remove(T P_0)
			{
				int num = IndexOf(P_0);
				if (num >= 0)
				{
					RemoveAt(num);
					return true;
				}
				return false;
			}

			public void RemoveAt(int P_0)
			{
				Requires.Range(P_0 >= 0 && P_0 < Count, "index");
				if (P_0 < Count - 1)
				{
					System.Array.Copy((System.Array)_elements, P_0 + 1, (System.Array)_elements, P_0, Count - P_0 - 1);
				}
				Count--;
			}

			public bool Contains(T P_0)
			{
				return IndexOf(P_0) >= 0;
			}

			public T[] ToArray()
			{
				if (Count == 0)
				{
					return ImmutableArray<T>.Empty.array;
				}
				T[] array = new T[Count];
				System.Array.Copy((System.Array)_elements, (System.Array)array, Count);
				return array;
			}

			public void CopyTo(T[] P_0, int P_1)
			{
				Requires.NotNull(P_0, "array");
				Requires.Range(P_1 >= 0 && P_1 + Count <= P_0.Length, "index");
				System.Array.Copy((System.Array)_elements, 0, (System.Array)P_0, P_1, Count);
			}

			private void EnsureCapacity(int P_0)
			{
				if (_elements.Length < P_0)
				{
					int num = Math.Max(_elements.Length * 2, P_0);
					System.Array.Resize<T>(ref _elements, num);
				}
			}

			public int IndexOf(T P_0)
			{
				return IndexOf(P_0, 0, _count, (IEqualityComparer<T>?)(object)EqualityComparer<T>.Default);
			}

			public int IndexOf(T P_0, int P_1, int P_2, IEqualityComparer<T>? P_3)
			{
				if (P_2 == 0 && P_1 == 0)
				{
					return -1;
				}
				Requires.Range(P_1 >= 0 && P_1 < Count, "startIndex");
				Requires.Range(P_2 >= 0 && P_1 + P_2 <= Count, "count");
				if (P_3 == null)
				{
					P_3 = (IEqualityComparer<T>?)(object)EqualityComparer<T>.Default;
				}
				if (P_3 == EqualityComparer<T>.Default)
				{
					return System.Array.IndexOf<T>(_elements, P_0, P_1, P_2);
				}
				for (int i = P_1; i < P_1 + P_2; i++)
				{
					if (P_3.Equals(_elements[i], P_0))
					{
						return i;
					}
				}
				return -1;
			}

			[IteratorStateMachine(typeof(ImmutableArray<>.Builder.<GetEnumerator>d__66))]
			public System.Collections.Generic.IEnumerator<T> GetEnumerator()
			{
				for (int i = 0; i < Count; i++)
				{
					yield return this[i];
				}
			}

			System.Collections.Generic.IEnumerator<T> System.Collections.Generic.IEnumerable<T>.GetEnumerator()
			{
				return GetEnumerator();
			}

			System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
			{
				return (System.Collections.IEnumerator)GetEnumerator();
			}
		}

		public struct Enumerator
		{
			private readonly T[] _array;

			private int _index;

			public T Current => _array[_index];

			internal Enumerator(T[] P_0)
			{
				_array = P_0;
				_index = -1;
			}

			public bool MoveNext()
			{
				return ++_index < _array.Length;
			}
		}

		private sealed class EnumeratorObject : System.Collections.Generic.IEnumerator<T>, System.Collections.IEnumerator, System.IDisposable
		{
			private static readonly System.Collections.Generic.IEnumerator<T> s_EmptyEnumerator = new EnumeratorObject(ImmutableArray<T>.Empty.array);

			private readonly T[] _array;

			private int _index;

			public T Current
			{
				get
				{
					//IL_0022: Unknown result type (might be due to invalid IL or missing references)
					if ((uint)_index < (uint)_array.Length)
					{
						return _array[_index];
					}
					throw new InvalidOperationException();
				}
			}

			object System.Collections.IEnumerator.Current => Current;

			private EnumeratorObject(T[] P_0)
			{
				_index = -1;
				_array = P_0;
			}

			public bool MoveNext()
			{
				int num = _index + 1;
				int num2 = _array.Length;
				if ((uint)num <= (uint)num2)
				{
					_index = num;
					return (uint)num < (uint)num2;
				}
				return false;
			}

			void System.Collections.IEnumerator.Reset()
			{
				_index = -1;
			}

			public void Dispose()
			{
			}

			internal static System.Collections.Generic.IEnumerator<T> Create(T[] P_0)
			{
				if (P_0.Length != 0)
				{
					return new EnumeratorObject(P_0);
				}
				return s_EmptyEnumerator;
			}
		}

		public static readonly ImmutableArray<T> Empty = new ImmutableArray<T>(new T[0]);

		[DebuggerBrowsable(/*Could not decode attribute arguments.*/)]
		internal readonly T[]? array;

		T System.Collections.Generic.IList<T>.this[int P_0]
		{
			get
			{
				ImmutableArray<T> immutableArray = this;
				immutableArray.ThrowInvalidOperationIfNotInitialized();
				return immutableArray[P_0];
			}
			set
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				throw new NotSupportedException();
			}
		}

		[DebuggerBrowsable(/*Could not decode attribute arguments.*/)]
		bool System.Collections.Generic.ICollection<T>.IsReadOnly => true;

		[DebuggerBrowsable(/*Could not decode attribute arguments.*/)]
		int System.Collections.Generic.ICollection<T>.Count
		{
			get
			{
				ImmutableArray<T> immutableArray = this;
				immutableArray.ThrowInvalidOperationIfNotInitialized();
				return immutableArray.Length;
			}
		}

		[DebuggerBrowsable(/*Could not decode attribute arguments.*/)]
		int System.Collections.Generic.IReadOnlyCollection<T>.Count
		{
			get
			{
				ImmutableArray<T> immutableArray = this;
				immutableArray.ThrowInvalidOperationIfNotInitialized();
				return immutableArray.Length;
			}
		}

		T System.Collections.Generic.IReadOnlyList<T>.this[int P_0]
		{
			get
			{
				ImmutableArray<T> immutableArray = this;
				immutableArray.ThrowInvalidOperationIfNotInitialized();
				return immutableArray[P_0];
			}
		}

		public T this[int P_0]
		{
			[NonVersionable]
			get
			{
				return array[P_0];
			}
		}

		[DebuggerBrowsable(/*Could not decode attribute arguments.*/)]
		public int Length
		{
			[NonVersionable]
			get
			{
				return array.Length;
			}
		}

		[DebuggerBrowsable(/*Could not decode attribute arguments.*/)]
		public bool IsDefault => array == null;

		[DebuggerBrowsable(/*Could not decode attribute arguments.*/)]
		System.Array? IImmutableArray.Array => array;

		[DebuggerBrowsable(/*Could not decode attribute arguments.*/)]
		private string DebuggerDisplay
		{
			get
			{
				ImmutableArray<T> immutableArray = this;
				if (!immutableArray.IsDefault)
				{
					return $"Length = {immutableArray.Length}";
				}
				return "Uninitialized";
			}
		}

		public System.ReadOnlySpan<T> AsSpan()
		{
			return new System.ReadOnlySpan<T>(array);
		}

		public int IndexOf(T P_0)
		{
			ImmutableArray<T> immutableArray = this;
			return immutableArray.IndexOf(P_0, 0, immutableArray.Length, (IEqualityComparer<T>?)(object)EqualityComparer<T>.Default);
		}

		public int IndexOf(T P_0, int P_1, int P_2, IEqualityComparer<T>? P_3)
		{
			ImmutableArray<T> immutableArray = this;
			immutableArray.ThrowNullRefIfNotInitialized();
			if (P_2 == 0 && P_1 == 0)
			{
				return -1;
			}
			Requires.Range(P_1 >= 0 && P_1 < immutableArray.Length, "startIndex");
			Requires.Range(P_2 >= 0 && P_1 + P_2 <= immutableArray.Length, "count");
			if (P_3 == null)
			{
				P_3 = (IEqualityComparer<T>?)(object)EqualityComparer<T>.Default;
			}
			if (P_3 == EqualityComparer<T>.Default)
			{
				return System.Array.IndexOf<T>(immutableArray.array, P_0, P_1, P_2);
			}
			for (int i = P_1; i < P_1 + P_2; i++)
			{
				if (P_3.Equals(immutableArray.array[i], P_0))
				{
					return i;
				}
			}
			return -1;
		}

		public bool Contains(T P_0)
		{
			return IndexOf(P_0) >= 0;
		}

		void System.Collections.Generic.IList<T>.Insert(int P_0, T P_1)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			throw new NotSupportedException();
		}

		void System.Collections.Generic.IList<T>.RemoveAt(int P_0)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			throw new NotSupportedException();
		}

		void System.Collections.Generic.ICollection<T>.Add(T P_0)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			throw new NotSupportedException();
		}

		void System.Collections.Generic.ICollection<T>.Clear()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			throw new NotSupportedException();
		}

		bool System.Collections.Generic.ICollection<T>.Remove(T P_0)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			throw new NotSupportedException();
		}

		internal ImmutableArray(T[]? P_0)
		{
			array = P_0;
		}

		public void CopyTo(T[] P_0, int P_1)
		{
			ImmutableArray<T> immutableArray = this;
			immutableArray.ThrowNullRefIfNotInitialized();
			System.Array.Copy((System.Array)immutableArray.array, 0, (System.Array)P_0, P_1, immutableArray.Length);
		}

		[MethodImpl(256)]
		public Enumerator GetEnumerator()
		{
			ImmutableArray<T> immutableArray = this;
			immutableArray.ThrowNullRefIfNotInitialized();
			return new Enumerator(immutableArray.array);
		}

		public override int GetHashCode()
		{
			ImmutableArray<T> immutableArray = this;
			if (immutableArray.array != null)
			{
				return ((object)immutableArray.array).GetHashCode();
			}
			return 0;
		}

		public override bool Equals([NotNullWhen(true)] object? P_0)
		{
			if (P_0 is IImmutableArray immutableArray)
			{
				return array == immutableArray.Array;
			}
			return false;
		}

		[NonVersionable]
		public bool Equals(ImmutableArray<T> P_0)
		{
			return array == P_0.array;
		}

		System.Collections.Generic.IEnumerator<T> System.Collections.Generic.IEnumerable<T>.GetEnumerator()
		{
			ImmutableArray<T> immutableArray = this;
			immutableArray.ThrowInvalidOperationIfNotInitialized();
			return EnumeratorObject.Create(immutableArray.array);
		}

		System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
		{
			ImmutableArray<T> immutableArray = this;
			immutableArray.ThrowInvalidOperationIfNotInitialized();
			return (System.Collections.IEnumerator)EnumeratorObject.Create(immutableArray.array);
		}

		internal void ThrowNullRefIfNotInitialized()
		{
			_ = array.Length;
		}

		private void ThrowInvalidOperationIfNotInitialized()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			if (IsDefault)
			{
				throw new InvalidOperationException(SR.InvalidOperationOnDefaultArray);
			}
		}
	}
	internal sealed class ImmutableArrayBuilderDebuggerProxy<T>
	{
		private readonly ImmutableArray<T>.Builder _builder;

		[DebuggerBrowsable(/*Could not decode attribute arguments.*/)]
		public T[] A => _builder.ToArray();

		public ImmutableArrayBuilderDebuggerProxy(ImmutableArray<T>.Builder builder)
		{
			Requires.NotNull(builder, "builder");
			_builder = builder;
		}
	}
	internal static class Requires
	{
		[DebuggerStepThrough]
		public static void NotNull<T>([NotNull] T P_0, string? P_1) where T : class
		{
			if (P_0 == null)
			{
				FailArgumentNullException(P_1);
			}
		}

		[DoesNotReturn]
		[DebuggerStepThrough]
		public static void FailArgumentNullException(string? P_0)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			throw new ArgumentNullException(P_0);
		}

		[DebuggerStepThrough]
		public static void Range([DoesNotReturnIf(false)] bool P_0, string? P_1, string? P_2 = null)
		{
			if (!P_0)
			{
				FailRange(P_1, P_2);
			}
		}

		[DoesNotReturn]
		[DebuggerStepThrough]
		public static void FailRange(string? P_0, string? P_1 = null)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			if (string.IsNullOrEmpty(P_1))
			{
				throw new ArgumentOutOfRangeException(P_0);
			}
			throw new ArgumentOutOfRangeException(P_0, P_1);
		}
	}
}

System.Console.dll

Decompiled 8 months ago
using System;
using System.CodeDom.Compiler;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Text;
using System.Threading;
using FxResources.System.Console;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(/*Could not decode attribute arguments.*/)]
[assembly: DisableRuntimeMarshalling]
[assembly: TargetFramework(".NETCoreApp,Version=v8.0", FrameworkDisplayName = ".NET 8.0")]
[assembly: AssemblyMetadata("Serviceable", "True")]
[assembly: AssemblyMetadata("PreferInbox", "True")]
[assembly: AssemblyDefaultAlias("System.Console")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: CLSCompliant(true)]
[assembly: AssemblyMetadata("IsTrimmable", "True")]
[assembly: DefaultDllImportSearchPaths(/*Could not decode attribute arguments.*/)]
[assembly: AssemblyCompany("Microsoft Corporation")]
[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")]
[assembly: AssemblyDescription("System.Console")]
[assembly: AssemblyFileVersion("8.0.324.11423")]
[assembly: AssemblyInformationalVersion("8.0.3+9f4b1f5d664afdfc80e1508ab7ed099dff210fbd")]
[assembly: AssemblyProduct("Microsoft® .NET")]
[assembly: AssemblyTitle("System.Console")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/dotnet/runtime")]
[assembly: SupportedOSPlatform("Windows")]
[assembly: AssemblyVersion("8.0.0.0")]
[module: RefSafetyRules(11)]
[module: NullablePublicOnly(false)]
[module: SkipLocalsInit]
internal static class Interop
{
	internal static class Kernel32
	{
		[StructLayout(0, CharSet = 3)]
		private struct CPINFOEXW
		{
			internal uint MaxCharSize;

			[FixedBuffer(typeof(byte), 2)]
			internal unsafe fixed byte DefaultChar[2];

			[FixedBuffer(typeof(byte), 12)]
			internal unsafe fixed byte LeadByte[12];

			internal char UnicodeDefaultChar;

			internal uint CodePage;

			[FixedBuffer(typeof(char), 260)]
			internal unsafe fixed char CodePageName[260];
		}

		[DllImport("kernel32.dll", CharSet = 3, ExactSpelling = true)]
		[LibraryImport(/*Could not decode attribute arguments.*/)]
		private unsafe static extern BOOL GetCPInfoExW(uint P_0, uint P_1, CPINFOEXW* P_2);

		internal unsafe static int GetLeadByteRanges(int P_0, byte[] P_1)
		{
			int num = 0;
			System.Runtime.CompilerServices.Unsafe.SkipInit(out CPINFOEXW cPINFOEXW);
			if (GetCPInfoExW((uint)P_0, 0u, &cPINFOEXW) != 0)
			{
				for (int i = 0; i < 10 && P_1[i] != 0; i += 2)
				{
					P_1[i] = cPINFOEXW.LeadByte[i];
					P_1[i + 1] = cPINFOEXW.LeadByte[i + 1];
					num++;
				}
			}
			return num;
		}

		[LibraryImport("kernel32.dll", SetLastError = true)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		[return: MarshalAs(2)]
		internal unsafe static bool GetConsoleMode(nint P_0, out int P_1)
		{
			System.Runtime.CompilerServices.Unsafe.SkipInit<int>(ref P_1);
			int num;
			int lastSystemError;
			fixed (int* ptr = &P_1)
			{
				Marshal.SetLastSystemError(0);
				num = __PInvoke(P_0, ptr);
				lastSystemError = Marshal.GetLastSystemError();
			}
			bool result = num != 0;
			Marshal.SetLastPInvokeError(lastSystemError);
			return result;
			[DllImport("kernel32.dll", EntryPoint = "GetConsoleMode", ExactSpelling = true)]
			[CompilerGenerated]
			static extern unsafe int __PInvoke(nint, int*);
		}

		internal static bool IsGetConsoleModeCallSuccessful(nint P_0)
		{
			int num;
			return GetConsoleMode(P_0, out num);
		}

		[DllImport("kernel32.dll", ExactSpelling = true)]
		[LibraryImport("kernel32.dll")]
		internal static extern uint GetConsoleOutputCP();

		[LibraryImport("kernel32.dll", SetLastError = true)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		internal static uint GetFileType(nint P_0)
		{
			Marshal.SetLastSystemError(0);
			uint result = __PInvoke(P_0);
			int lastSystemError = Marshal.GetLastSystemError();
			Marshal.SetLastPInvokeError(lastSystemError);
			return result;
			[DllImport("kernel32.dll", EntryPoint = "GetFileType", ExactSpelling = true)]
			[CompilerGenerated]
			static extern uint __PInvoke(nint);
		}

		[DllImport("kernel32.dll", ExactSpelling = true)]
		[LibraryImport("kernel32.dll")]
		[SuppressGCTransition]
		internal static extern nint GetStdHandle(int P_0);

		[DllImport("kernel32.dll", ExactSpelling = true)]
		[LibraryImport("kernel32.dll")]
		internal unsafe static extern int MultiByteToWideChar(uint P_0, uint P_1, byte* P_2, int P_3, char* P_4, int P_5);

		[LibraryImport("kernel32.dll", SetLastError = true)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		internal unsafe static int ReadFile(nint P_0, byte* P_1, int P_2, out int P_3, nint P_4)
		{
			System.Runtime.CompilerServices.Unsafe.SkipInit<int>(ref P_3);
			int result;
			int lastSystemError;
			fixed (int* ptr = &P_3)
			{
				Marshal.SetLastSystemError(0);
				result = __PInvoke(P_0, P_1, P_2, ptr, P_4);
				lastSystemError = Marshal.GetLastSystemError();
			}
			Marshal.SetLastPInvokeError(lastSystemError);
			return result;
			[DllImport("kernel32.dll", EntryPoint = "ReadFile", ExactSpelling = true)]
			[CompilerGenerated]
			static extern unsafe int __PInvoke(nint, byte*, int, int*, nint);
		}

		[LibraryImport(/*Could not decode attribute arguments.*/)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		[return: MarshalAs(2)]
		internal unsafe static bool ReadConsole(nint P_0, byte* P_1, int P_2, out int P_3, nint P_4)
		{
			System.Runtime.CompilerServices.Unsafe.SkipInit<int>(ref P_3);
			int num;
			int lastSystemError;
			fixed (int* ptr = &P_3)
			{
				Marshal.SetLastSystemError(0);
				num = __PInvoke(P_0, P_1, P_2, ptr, P_4);
				lastSystemError = Marshal.GetLastSystemError();
			}
			bool result = num != 0;
			Marshal.SetLastPInvokeError(lastSystemError);
			return result;
			[DllImport("kernel32.dll", EntryPoint = "ReadConsoleW", ExactSpelling = true)]
			[CompilerGenerated]
			static extern unsafe int __PInvoke(nint, byte*, int, int*, nint);
		}

		[DllImport("kernel32.dll", ExactSpelling = true)]
		[LibraryImport("kernel32.dll")]
		internal unsafe static extern int WideCharToMultiByte(uint P_0, uint P_1, char* P_2, int P_3, byte* P_4, int P_5, byte* P_6, BOOL* P_7);

		[LibraryImport("kernel32.dll", SetLastError = true)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		internal unsafe static int WriteFile(nint P_0, byte* P_1, int P_2, out int P_3, nint P_4)
		{
			System.Runtime.CompilerServices.Unsafe.SkipInit<int>(ref P_3);
			int result;
			int lastSystemError;
			fixed (int* ptr = &P_3)
			{
				Marshal.SetLastSystemError(0);
				result = __PInvoke(P_0, P_1, P_2, ptr, P_4);
				lastSystemError = Marshal.GetLastSystemError();
			}
			Marshal.SetLastPInvokeError(lastSystemError);
			return result;
			[DllImport("kernel32.dll", EntryPoint = "WriteFile", ExactSpelling = true)]
			[CompilerGenerated]
			static extern unsafe int __PInvoke(nint, byte*, int, int*, nint);
		}

		[LibraryImport(/*Could not decode attribute arguments.*/)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		[return: MarshalAs(2)]
		internal unsafe static bool WriteConsole(nint P_0, byte* P_1, int P_2, out int P_3, nint P_4)
		{
			System.Runtime.CompilerServices.Unsafe.SkipInit<int>(ref P_3);
			int num;
			int lastSystemError;
			fixed (int* ptr = &P_3)
			{
				Marshal.SetLastSystemError(0);
				num = __PInvoke(P_0, P_1, P_2, ptr, P_4);
				lastSystemError = Marshal.GetLastSystemError();
			}
			bool result = num != 0;
			Marshal.SetLastPInvokeError(lastSystemError);
			return result;
			[DllImport("kernel32.dll", EntryPoint = "WriteConsoleW", ExactSpelling = true)]
			[CompilerGenerated]
			static extern unsafe int __PInvoke(nint, byte*, int, int*, nint);
		}
	}

	internal enum BOOL
	{
		FALSE,
		TRUE
	}
}
namespace FxResources.System.Console
{
	internal static class SR
	{
	}
}
namespace System
{
	public static class Console
	{
		private static readonly object s_syncObject = new object();

		private static TextWriter s_out;

		private static Encoding s_outputEncoding;

		private static StrongBox<bool> _isStdOutRedirected;

		public static Encoding OutputEncoding
		{
			get
			{
				Encoding val = Volatile.Read<Encoding>(ref s_outputEncoding);
				if (val == null)
				{
					lock (s_syncObject)
					{
						if (s_outputEncoding == null)
						{
							Volatile.Write<Encoding>(ref s_outputEncoding, ConsolePal.OutputEncoding);
						}
						val = s_outputEncoding;
					}
				}
				return val;
			}
		}

		public static TextWriter Out
		{
			get
			{
				return Volatile.Read<TextWriter>(ref s_out) ?? EnsureInitialized();
				[CompilerGenerated]
				static TextWriter EnsureInitialized()
				{
					lock (s_syncObject)
					{
						if (s_out == null)
						{
							Volatile.Write<TextWriter>(ref s_out, CreateOutputWriter(ConsolePal.OpenStandardOutput()));
						}
						return s_out;
					}
				}
			}
		}

		public static bool IsOutputRedirected
		{
			get
			{
				StrongBox<bool> val = Volatile.Read<StrongBox<bool>>(ref _isStdOutRedirected) ?? EnsureInitialized();
				return val.Value;
				[CompilerGenerated]
				static StrongBox<bool> EnsureInitialized()
				{
					Volatile.Write<StrongBox<bool>>(ref _isStdOutRedirected, new StrongBox<bool>(ConsolePal.IsOutputRedirectedCore()));
					return _isStdOutRedirected;
				}
			}
		}

		private static TextWriter CreateOutputWriter(Stream P_0)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Expected O, but got Unknown
			if (P_0 != Stream.Null)
			{
				return TextWriter.Synchronized((TextWriter)new StreamWriter(P_0, OutputEncoding.RemovePreamble(), 256, true)
				{
					AutoFlush = true
				});
			}
			return TextWriter.Null;
		}

		[MethodImpl(8)]
		public static void WriteLine(string? P_0)
		{
			Out.WriteLine(P_0);
		}
	}
	internal static class ConsolePal
	{
		private sealed class WindowsConsoleStream : ConsoleStream
		{
			private readonly bool _isPipe;

			private nint _handle;

			private readonly bool _useFileAPIs;

			internal WindowsConsoleStream(nint P_0, FileAccess P_1, bool P_2)
				: base(P_1)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				_handle = P_0;
				_isPipe = Interop.Kernel32.GetFileType(P_0) == 3;
				_useFileAPIs = P_2;
			}

			protected override void Dispose(bool P_0)
			{
				_handle = System.IntPtr.Zero;
				base.Dispose(P_0);
			}

			public override int Read(System.Span<byte> P_0)
			{
				int result;
				int num = ReadFileNative(_handle, P_0, _isPipe, out result, _useFileAPIs);
				if (num != 0)
				{
					throw Win32Marshal.GetExceptionForWin32Error(num);
				}
				return result;
			}

			public override void Write(System.ReadOnlySpan<byte> P_0)
			{
				int num = WriteFileNative(_handle, P_0, _useFileAPIs);
				if (num != 0)
				{
					throw Win32Marshal.GetExceptionForWin32Error(num);
				}
			}

			public override void Flush()
			{
				if (_handle == (nint)System.IntPtr.Zero)
				{
					throw Error.GetFileNotOpen();
				}
				base.Flush();
			}

			private unsafe static int ReadFileNative(nint P_0, System.Span<byte> P_1, bool P_2, out int P_3, bool P_4)
			{
				if (P_1.IsEmpty)
				{
					P_3 = 0;
					return 0;
				}
				bool flag;
				fixed (byte* ptr = P_1)
				{
					if (P_4)
					{
						flag = Interop.Kernel32.ReadFile(P_0, ptr, P_1.Length, out P_3, System.IntPtr.Zero) != 0;
					}
					else
					{
						flag = Interop.Kernel32.ReadConsole(P_0, ptr, P_1.Length / 2, out var num, System.IntPtr.Zero);
						P_3 = num * 2;
					}
				}
				if (flag)
				{
					return 0;
				}
				int lastPInvokeError = Marshal.GetLastPInvokeError();
				if (lastPInvokeError == 232 || lastPInvokeError == 109)
				{
					return 0;
				}
				return lastPInvokeError;
			}

			private unsafe static int WriteFileNative(nint P_0, System.ReadOnlySpan<byte> P_1, bool P_2)
			{
				if (P_1.IsEmpty)
				{
					return 0;
				}
				bool flag;
				fixed (byte* ptr = P_1.GetPinnableReference())
				{
					flag = ((!P_2) ? Interop.Kernel32.WriteConsole(P_0, ptr, P_1.Length / 2, out var _, System.IntPtr.Zero) : (Interop.Kernel32.WriteFile(P_0, ptr, P_1.Length, out var _, System.IntPtr.Zero) != 0));
				}
				if (flag)
				{
					return 0;
				}
				int lastPInvokeError = Marshal.GetLastPInvokeError();
				if (lastPInvokeError == 232 || lastPInvokeError == 109 || lastPInvokeError == 233)
				{
					return 0;
				}
				return lastPInvokeError;
			}
		}

		private static nint InvalidHandleValue => new System.IntPtr(-1);

		private static nint OutputHandle => Interop.Kernel32.GetStdHandle(-11);

		public static Encoding OutputEncoding => EncodingHelper.GetSupportedConsoleEncoding((int)Interop.Kernel32.GetConsoleOutputCP());

		public static Stream OpenStandardOutput()
		{
			return GetStandardFile(-11, (FileAccess)2, Console.OutputEncoding.CodePage != 1200 || Console.IsOutputRedirected);
		}

		private static Stream GetStandardFile(int P_0, FileAccess P_1, bool P_2)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Invalid comparison between Unknown and I4
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			nint stdHandle = Interop.Kernel32.GetStdHandle(P_0);
			if (stdHandle == (nint)System.IntPtr.Zero || stdHandle == InvalidHandleValue || ((int)P_1 != 1 && !ConsoleHandleIsWritable(stdHandle)))
			{
				return Stream.Null;
			}
			return (Stream)(object)new WindowsConsoleStream(stdHandle, P_1, P_2);
		}

		private unsafe static bool ConsoleHandleIsWritable(nint P_0)
		{
			byte b = 65;
			int num;
			int num2 = Interop.Kernel32.WriteFile(P_0, &b, 0, out num, System.IntPtr.Zero);
			return num2 != 0;
		}

		public static bool IsOutputRedirectedCore()
		{
			return IsHandleRedirected(OutputHandle);
		}

		private static bool IsHandleRedirected(nint P_0)
		{
			uint fileType = Interop.Kernel32.GetFileType(P_0);
			if ((fileType & 2) != 2)
			{
				return true;
			}
			return !Interop.Kernel32.IsGetConsoleModeCallSuccessful(P_0);
		}
	}
	internal static class SR
	{
		private static readonly bool s_usingResourceKeys;

		private static ResourceManager s_resourceManager;

		internal static ResourceManager ResourceManager
		{
			get
			{
				//IL_0013: Unknown result type (might be due to invalid IL or missing references)
				//IL_0018: Unknown result type (might be due to invalid IL or missing references)
				//IL_001e: Expected O, but got Unknown
				object obj = s_resourceManager;
				if (obj == null)
				{
					ResourceManager val = new ResourceManager(typeof(FxResources.System.Console.SR));
					s_resourceManager = val;
					obj = (object)val;
				}
				return (ResourceManager)obj;
			}
		}

		internal static string NotSupported_UnseekableStream => GetResourceString("NotSupported_UnseekableStream");

		internal static string ObjectDisposed_FileClosed => GetResourceString("ObjectDisposed_FileClosed");

		internal static string NotSupported_UnwritableStream => GetResourceString("NotSupported_UnwritableStream");

		internal static string NotSupported_UnreadableStream => GetResourceString("NotSupported_UnreadableStream");

		internal static string IO_AlreadyExists_Name => GetResourceString("IO_AlreadyExists_Name");

		internal static string IO_FileExists_Name => GetResourceString("IO_FileExists_Name");

		internal static string IO_FileNotFound => GetResourceString("IO_FileNotFound");

		internal static string IO_FileNotFound_FileName => GetResourceString("IO_FileNotFound_FileName");

		internal static string IO_PathNotFound_NoPathName => GetResourceString("IO_PathNotFound_NoPathName");

		internal static string IO_PathNotFound_Path => GetResourceString("IO_PathNotFound_Path");

		internal static string IO_PathTooLong => GetResourceString("IO_PathTooLong");

		internal static string UnauthorizedAccess_IODenied_NoPathName => GetResourceString("UnauthorizedAccess_IODenied_NoPathName");

		internal static string UnauthorizedAccess_IODenied_Path => GetResourceString("UnauthorizedAccess_IODenied_Path");

		internal static string IO_SharingViolation_File => GetResourceString("IO_SharingViolation_File");

		internal static string IO_SharingViolation_NoFileName => GetResourceString("IO_SharingViolation_NoFileName");

		internal static string ArgumentOutOfRange_IndexCountBuffer => GetResourceString("ArgumentOutOfRange_IndexCountBuffer");

		internal static string ArgumentOutOfRange_IndexCount => GetResourceString("ArgumentOutOfRange_IndexCount");

		internal static string ArgumentOutOfRange_IndexMustBeLessOrEqual => GetResourceString("ArgumentOutOfRange_IndexMustBeLessOrEqual");

		internal static string Argument_EncodingConversionOverflowBytes => GetResourceString("Argument_EncodingConversionOverflowBytes");

		internal static string Argument_EncodingConversionOverflowChars => GetResourceString("Argument_EncodingConversionOverflowChars");

		internal static string ArgumentOutOfRange_GetByteCountOverflow => GetResourceString("ArgumentOutOfRange_GetByteCountOverflow");

		internal static string ArgumentOutOfRange_GetCharCountOverflow => GetResourceString("ArgumentOutOfRange_GetCharCountOverflow");

		internal static string Argument_InvalidCharSequenceNoIndex => GetResourceString("Argument_InvalidCharSequenceNoIndex");

		internal static string IO_PathTooLong_Path => GetResourceString("IO_PathTooLong_Path");

		internal static bool UsingResourceKeys()
		{
			return s_usingResourceKeys;
		}

		private static string GetResourceString(string P_0)
		{
			if (UsingResourceKeys())
			{
				return P_0;
			}
			string result = null;
			try
			{
				result = ResourceManager.GetString(P_0);
			}
			catch (MissingManifestResourceException)
			{
			}
			return result;
		}

		internal static string Format(string P_0, object P_1)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", new object[2] { P_0, P_1 });
			}
			return string.Format(P_0, P_1);
		}

		static SR()
		{
			System.Runtime.CompilerServices.Unsafe.SkipInit(out bool flag);
			s_usingResourceKeys = AppContext.TryGetSwitch("System.Resources.UseSystemResourceKeys", ref flag) && flag;
		}
	}
}
namespace System.Text
{
	internal static class EncodingExtensions
	{
		public static Encoding RemovePreamble(this Encoding P_0)
		{
			if (P_0.Preamble.Length == 0)
			{
				return P_0;
			}
			return (Encoding)(object)new ConsoleEncoding(P_0);
		}
	}
	internal sealed class ConsoleEncoding : Encoding
	{
		private readonly Encoding _encoding;

		public override int CodePage => _encoding.CodePage;

		public override string EncodingName => _encoding.EncodingName;

		internal ConsoleEncoding(Encoding P_0)
		{
			_encoding = P_0;
		}

		public override byte[] GetPreamble()
		{
			return System.Array.Empty<byte>();
		}

		public unsafe override int GetByteCount(char* P_0, int P_1)
		{
			return _encoding.GetByteCount(P_0, P_1);
		}

		public override int GetByteCount(char[] P_0, int P_1, int P_2)
		{
			return _encoding.GetByteCount(P_0, P_1, P_2);
		}

		public override int GetByteCount(string P_0)
		{
			return _encoding.GetByteCount(P_0);
		}

		public unsafe override int GetBytes(char* P_0, int P_1, byte* P_2, int P_3)
		{
			return _encoding.GetBytes(P_0, P_1, P_2, P_3);
		}

		public override int GetBytes(char[] P_0, int P_1, int P_2, byte[] P_3, int P_4)
		{
			return _encoding.GetBytes(P_0, P_1, P_2, P_3, P_4);
		}

		public override byte[] GetBytes(string P_0)
		{
			return _encoding.GetBytes(P_0);
		}

		public override int GetBytes(string P_0, int P_1, int P_2, byte[] P_3, int P_4)
		{
			return _encoding.GetBytes(P_0, P_1, P_2, P_3, P_4);
		}

		public unsafe override int GetCharCount(byte* P_0, int P_1)
		{
			return _encoding.GetCharCount(P_0, P_1);
		}

		public override int GetCharCount(byte[] P_0, int P_1, int P_2)
		{
			return _encoding.GetCharCount(P_0, P_1, P_2);
		}

		public unsafe override int GetChars(byte* P_0, int P_1, char* P_2, int P_3)
		{
			return _encoding.GetChars(P_0, P_1, P_2, P_3);
		}

		public override char[] GetChars(byte[] P_0, int P_1, int P_2)
		{
			return _encoding.GetChars(P_0, P_1, P_2);
		}

		public override int GetChars(byte[] P_0, int P_1, int P_2, char[] P_3, int P_4)
		{
			return _encoding.GetChars(P_0, P_1, P_2, P_3, P_4);
		}

		public override Decoder GetDecoder()
		{
			return _encoding.GetDecoder();
		}

		public override Encoder GetEncoder()
		{
			return _encoding.GetEncoder();
		}

		public override int GetMaxByteCount(int P_0)
		{
			return _encoding.GetMaxByteCount(P_0);
		}

		public override int GetMaxCharCount(int P_0)
		{
			return _encoding.GetMaxCharCount(P_0);
		}

		public override string GetString(byte[] P_0, int P_1, int P_2)
		{
			return _encoding.GetString(P_0, P_1, P_2);
		}
	}
	internal sealed class OSEncoding : Encoding
	{
		private readonly int _codePage;

		private string _encodingName;

		public override string EncodingName => _encodingName ?? (_encodingName = $"Codepage - {_codePage}");

		internal OSEncoding(int P_0)
			: base(P_0)
		{
			_codePage = P_0;
		}

		public unsafe override int GetByteCount(char[] P_0, int P_1, int P_2)
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			ArgumentNullException.ThrowIfNull((object)P_0, "chars");
			ArgumentOutOfRangeException.ThrowIfNegative<int>(P_1, "index");
			ArgumentOutOfRangeException.ThrowIfNegative<int>(P_2, "count");
			if (P_0.Length - P_1 < P_2)
			{
				throw new ArgumentOutOfRangeException("chars", SR.ArgumentOutOfRange_IndexCountBuffer);
			}
			if (P_2 == 0)
			{
				return 0;
			}
			fixed (char* ptr = P_0)
			{
				return WideCharToMultiByte(_codePage, ptr + P_1, P_2, null, 0);
			}
		}

		public unsafe override int GetByteCount(string P_0)
		{
			ArgumentNullException.ThrowIfNull((object)P_0, "s");
			if (P_0.Length == 0)
			{
				return 0;
			}
			fixed (char* ptr = P_0)
			{
				return WideCharToMultiByte(_codePage, ptr, P_0.Length, null, 0);
			}
		}

		public unsafe override int GetBytes(string P_0, int P_1, int P_2, byte[] P_3, int P_4)
		{
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			ArgumentNullException.ThrowIfNull((object)P_0, "s");
			ArgumentNullException.ThrowIfNull((object)P_3, "bytes");
			ArgumentOutOfRangeException.ThrowIfNegative<int>(P_1, "charIndex");
			ArgumentOutOfRangeException.ThrowIfNegative<int>(P_2, "charCount");
			if (P_0.Length - P_1 < P_2)
			{
				throw new ArgumentOutOfRangeException("s", SR.ArgumentOutOfRange_IndexCount);
			}
			if (P_4 < 0 || P_4 > P_3.Length)
			{
				throw new ArgumentOutOfRangeException("byteIndex", SR.ArgumentOutOfRange_IndexMustBeLessOrEqual);
			}
			if (P_2 == 0)
			{
				return 0;
			}
			if (P_3.Length == 0)
			{
				throw new ArgumentOutOfRangeException(SR.Argument_EncodingConversionOverflowBytes);
			}
			fixed (char* ptr = P_0)
			{
				fixed (byte* ptr2 = &P_3[0])
				{
					return WideCharToMultiByte(_codePage, ptr + P_1, P_2, ptr2 + P_4, P_3.Length - P_4);
				}
			}
		}

		public unsafe override int GetBytes(char[] P_0, int P_1, int P_2, byte[] P_3, int P_4)
		{
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			ArgumentNullException.ThrowIfNull((object)P_0, "chars");
			ArgumentNullException.ThrowIfNull((object)P_3, "bytes");
			ArgumentOutOfRangeException.ThrowIfNegative<int>(P_1, "charIndex");
			ArgumentOutOfRangeException.ThrowIfNegative<int>(P_2, "charCount");
			if (P_0.Length - P_1 < P_2)
			{
				throw new ArgumentOutOfRangeException("chars", SR.ArgumentOutOfRange_IndexCountBuffer);
			}
			if (P_4 < 0 || P_4 > P_3.Length)
			{
				throw new ArgumentOutOfRangeException("byteIndex", SR.ArgumentOutOfRange_IndexMustBeLessOrEqual);
			}
			if (P_2 == 0)
			{
				return 0;
			}
			if (P_3.Length == 0)
			{
				throw new ArgumentOutOfRangeException(SR.Argument_EncodingConversionOverflowBytes);
			}
			fixed (char* ptr = P_0)
			{
				fixed (byte* ptr2 = &P_3[0])
				{
					return WideCharToMultiByte(_codePage, ptr + P_1, P_2, ptr2 + P_4, P_3.Length - P_4);
				}
			}
		}

		public unsafe override int GetCharCount(byte[] P_0, int P_1, int P_2)
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			ArgumentNullException.ThrowIfNull((object)P_0, "bytes");
			ArgumentOutOfRangeException.ThrowIfNegative<int>(P_1, "index");
			ArgumentOutOfRangeException.ThrowIfNegative<int>(P_2, "count");
			if (P_0.Length - P_1 < P_2)
			{
				throw new ArgumentOutOfRangeException("bytes", SR.ArgumentOutOfRange_IndexCountBuffer);
			}
			if (P_2 == 0)
			{
				return 0;
			}
			fixed (byte* ptr = P_0)
			{
				return MultiByteToWideChar(_codePage, ptr + P_1, P_2, null, 0);
			}
		}

		public unsafe override int GetChars(byte[] P_0, int P_1, int P_2, char[] P_3, int P_4)
		{
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			ArgumentNullException.ThrowIfNull((object)P_0, "bytes");
			ArgumentNullException.ThrowIfNull((object)P_3, "chars");
			ArgumentOutOfRangeException.ThrowIfNegative<int>(P_1, "byteIndex");
			ArgumentOutOfRangeException.ThrowIfNegative<int>(P_2, "byteCount");
			if (P_0.Length - P_1 < P_2)
			{
				throw new ArgumentOutOfRangeException("bytes", SR.ArgumentOutOfRange_IndexCountBuffer);
			}
			if (P_4 < 0 || P_4 > P_3.Length)
			{
				throw new ArgumentOutOfRangeException("charIndex", SR.ArgumentOutOfRange_IndexMustBeLessOrEqual);
			}
			if (P_2 == 0)
			{
				return 0;
			}
			if (P_3.Length == 0)
			{
				throw new ArgumentOutOfRangeException(SR.Argument_EncodingConversionOverflowChars);
			}
			fixed (byte* ptr = P_0)
			{
				fixed (char* ptr2 = &P_3[0])
				{
					return MultiByteToWideChar(_codePage, ptr + P_1, P_2, ptr2 + P_4, P_3.Length - P_4);
				}
			}
		}

		public override int GetMaxByteCount(int P_0)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			ArgumentOutOfRangeException.ThrowIfNegative<int>(P_0, "charCount");
			long num = (long)P_0 * 14L;
			if (num > 2147483647)
			{
				throw new ArgumentOutOfRangeException("charCount", SR.ArgumentOutOfRange_GetByteCountOverflow);
			}
			return (int)num;
		}

		public override int GetMaxCharCount(int P_0)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			ArgumentOutOfRangeException.ThrowIfNegative<int>(P_0, "byteCount");
			long num = P_0 * 4;
			if (num > 2147483647)
			{
				throw new ArgumentOutOfRangeException("byteCount", SR.ArgumentOutOfRange_GetCharCountOverflow);
			}
			return (int)num;
		}

		public override Encoder GetEncoder()
		{
			return (Encoder)(object)new OSEncoder((Encoding)(object)this);
		}

		public override Decoder GetDecoder()
		{
			switch (((Encoding)this).CodePage)
			{
			case 932:
			case 936:
			case 949:
			case 950:
			case 1361:
			case 10001:
			case 10002:
			case 10003:
			case 10008:
			case 20000:
			case 20001:
			case 20002:
			case 20003:
			case 20004:
			case 20005:
			case 20261:
			case 20932:
			case 20936:
			case 51949:
				return (Decoder)(object)new DecoderDBCS((Encoding)(object)this);
			default:
				return ((Encoding)this).GetDecoder();
			}
		}

		internal unsafe static int WideCharToMultiByte(int P_0, char* P_1, int P_2, byte* P_3, int P_4)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			int num = Interop.Kernel32.WideCharToMultiByte((uint)P_0, 0u, P_1, P_2, P_3, P_4, null, null);
			if (num <= 0)
			{
				throw new ArgumentException(SR.Argument_InvalidCharSequenceNoIndex);
			}
			return num;
		}

		internal unsafe static int MultiByteToWideChar(int P_0, byte* P_1, int P_2, char* P_3, int P_4)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			int num = Interop.Kernel32.MultiByteToWideChar((uint)P_0, 0u, P_1, P_2, P_3, P_4);
			if (num <= 0)
			{
				throw new ArgumentException(SR.Argument_InvalidCharSequenceNoIndex);
			}
			return num;
		}
	}
	internal sealed class OSEncoder : Encoder
	{
		private char _charLeftOver;

		private readonly Encoding _encoding;

		internal OSEncoder(Encoding P_0)
		{
			_encoding = P_0;
			((Encoder)this).Reset();
		}

		public override void Reset()
		{
			_charLeftOver = '\0';
		}

		public unsafe override int GetByteCount(char[] P_0, int P_1, int P_2, bool P_3)
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			ArgumentNullException.ThrowIfNull((object)P_0, "chars");
			ArgumentOutOfRangeException.ThrowIfNegative<int>(P_1, "index");
			ArgumentOutOfRangeException.ThrowIfNegative<int>(P_2, "count");
			if (P_0.Length - P_1 < P_2)
			{
				throw new ArgumentOutOfRangeException("chars", SR.ArgumentOutOfRange_IndexCountBuffer);
			}
			if (P_0.Length == 0 && (_charLeftOver == '\0' || !P_3))
			{
				return 0;
			}
			fixed (char* ptr = P_0)
			{
				System.Runtime.CompilerServices.Unsafe.SkipInit(out char c);
				char* ptr2 = ((ptr == null) ? (&c) : (ptr + P_1));
				return ((Encoder)this).GetByteCount(ptr2, P_2, P_3);
			}
		}

		private unsafe int ConvertWithLeftOverChar(char* P_0, int P_1, byte* P_2, int P_3)
		{
			char* ptr = stackalloc char[2];
			*ptr = _charLeftOver;
			int num = 0;
			if (P_1 > 0 && char.IsLowSurrogate(*P_0))
			{
				ptr[1] = *P_0;
				num++;
			}
			int num2 = OSEncoding.WideCharToMultiByte(_encoding.CodePage, ptr, num + 1, P_2, P_3);
			if (P_1 - num > 0)
			{
				num2 += OSEncoding.WideCharToMultiByte(_encoding.CodePage, P_0 + num, P_1 - num, (P_2 == null) ? null : (P_2 + num2), (P_2 != null) ? (P_3 - num2) : 0);
			}
			return num2;
		}

		public unsafe override int GetByteCount(char* P_0, int P_1, bool P_2)
		{
			ArgumentNullException.ThrowIfNull((void*)P_0, "chars");
			ArgumentOutOfRangeException.ThrowIfNegative<int>(P_1, "count");
			bool flag = P_1 > 0 && !P_2 && char.IsHighSurrogate(P_0[P_1 - 1]);
			if (flag)
			{
				P_1--;
			}
			if (_charLeftOver == '\0')
			{
				if (P_1 <= 0)
				{
					return 0;
				}
				return OSEncoding.WideCharToMultiByte(_encoding.CodePage, P_0, P_1, null, 0);
			}
			if (P_1 == 0 && !flag && !P_2)
			{
				return 0;
			}
			return ConvertWithLeftOverChar(P_0, P_1, null, 0);
		}

		public unsafe override int GetBytes(char[] P_0, int P_1, int P_2, byte[] P_3, int P_4, bool P_5)
		{
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			ArgumentNullException.ThrowIfNull((object)P_0, "chars");
			ArgumentNullException.ThrowIfNull((object)P_3, "bytes");
			ArgumentOutOfRangeException.ThrowIfNegative<int>(P_1, "charIndex");
			ArgumentOutOfRangeException.ThrowIfNegative<int>(P_2, "charCount");
			if (P_0.Length - P_1 < P_2)
			{
				throw new ArgumentOutOfRangeException("chars", SR.ArgumentOutOfRange_IndexCountBuffer);
			}
			if (P_4 < 0 || P_4 > P_3.Length)
			{
				throw new ArgumentOutOfRangeException("byteIndex", SR.ArgumentOutOfRange_IndexMustBeLessOrEqual);
			}
			if (P_3.Length == 0)
			{
				return 0;
			}
			if (P_2 == 0 && (_charLeftOver == '\0' || !P_5))
			{
				return 0;
			}
			fixed (char* ptr = P_0)
			{
				fixed (byte* ptr3 = &P_3[0])
				{
					System.Runtime.CompilerServices.Unsafe.SkipInit(out char c);
					char* ptr2 = ((ptr == null) ? (&c) : (ptr + P_1));
					return ((Encoder)this).GetBytes(ptr2, P_2, ptr3 + P_4, P_3.Length - P_4, P_5);
				}
			}
		}

		public unsafe override int GetBytes(char* P_0, int P_1, byte* P_2, int P_3, bool P_4)
		{
			ArgumentNullException.ThrowIfNull((void*)P_0, "chars");
			ArgumentNullException.ThrowIfNull((void*)P_2, "bytes");
			ArgumentOutOfRangeException.ThrowIfNegative<int>(P_3, "byteCount");
			ArgumentOutOfRangeException.ThrowIfNegative<int>(P_1, "charCount");
			if (P_3 == 0)
			{
				return 0;
			}
			char c = ((P_1 > 0 && !P_4 && char.IsHighSurrogate(P_0[P_1 - 1])) ? P_0[P_1 - 1] : '\0');
			if (c != 0)
			{
				P_1--;
			}
			if (_charLeftOver == '\0')
			{
				if (P_1 <= 0)
				{
					_charLeftOver = c;
					return 0;
				}
				int result = OSEncoding.WideCharToMultiByte(_encoding.CodePage, P_0, P_1, P_2, P_3);
				_charLeftOver = c;
				return result;
			}
			if (P_1 == 0 && c == '\0' && !P_4)
			{
				return 0;
			}
			int result2 = ConvertWithLeftOverChar(P_0, P_1, P_2, P_3);
			_charLeftOver = c;
			return result2;
		}
	}
	internal sealed class DecoderDBCS : Decoder
	{
		private readonly Encoding _encoding;

		private readonly byte[] _leadByteRanges = new byte[10];

		private readonly int _rangesCount;

		private byte _leftOverLeadByte;

		internal DecoderDBCS(Encoding P_0)
		{
			_encoding = P_0;
			_rangesCount = Interop.Kernel32.GetLeadByteRanges(_encoding.CodePage, _leadByteRanges);
			((Decoder)this).Reset();
		}

		private bool IsLeadByte(byte P_0)
		{
			if (P_0 < _leadByteRanges[0])
			{
				return false;
			}
			for (int i = 0; i < _rangesCount; i += 2)
			{
				if (P_0 >= _leadByteRanges[i] && P_0 <= _leadByteRanges[i + 1])
				{
					return true;
				}
			}
			return false;
		}

		public override void Reset()
		{
			_leftOverLeadByte = 0;
		}

		public override int GetCharCount(byte[] P_0, int P_1, int P_2)
		{
			return ((Decoder)this).GetCharCount(P_0, P_1, P_2, false);
		}

		public unsafe override int GetCharCount(byte[] P_0, int P_1, int P_2, bool P_3)
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			ArgumentNullException.ThrowIfNull((object)P_0, "bytes");
			ArgumentOutOfRangeException.ThrowIfNegative<int>(P_1, "index");
			ArgumentOutOfRangeException.ThrowIfNegative<int>(P_2, "count");
			if (P_0.Length - P_1 < P_2)
			{
				throw new ArgumentOutOfRangeException("bytes", SR.ArgumentOutOfRange_IndexCountBuffer);
			}
			if (P_2 == 0 && (_leftOverLeadByte == 0 || !P_3))
			{
				return 0;
			}
			fixed (byte* ptr = P_0)
			{
				System.Runtime.CompilerServices.Unsafe.SkipInit(out byte b);
				byte* ptr2 = ((ptr == null) ? (&b) : (ptr + P_1));
				return ((Decoder)this).GetCharCount(ptr2, P_2, P_3);
			}
		}

		private unsafe int ConvertWithLeftOverByte(byte* P_0, int P_1, char* P_2, int P_3)
		{
			byte* ptr = stackalloc byte[2];
			*ptr = _leftOverLeadByte;
			int num = 0;
			if (P_1 > 0)
			{
				ptr[1] = *P_0;
				num++;
			}
			int num2 = OSEncoding.MultiByteToWideChar(_encoding.CodePage, ptr, num + 1, P_2, P_3);
			if (P_1 - num > 0)
			{
				num2 += OSEncoding.MultiByteToWideChar(_encoding.CodePage, P_0 + num, P_1 - num, (P_2 == null) ? null : (P_2 + num2), (P_2 != null) ? (P_3 - num2) : 0);
			}
			return num2;
		}

		public unsafe override int GetCharCount(byte* P_0, int P_1, bool P_2)
		{
			ArgumentNullException.ThrowIfNull((void*)P_0, "bytes");
			ArgumentOutOfRangeException.ThrowIfNegative<int>(P_1, "count");
			bool flag = P_1 > 0 && !P_2 && IsLastByteALeadByte(P_0, P_1);
			if (flag)
			{
				P_1--;
			}
			if (_leftOverLeadByte == 0)
			{
				if (P_1 <= 0)
				{
					return 0;
				}
				return OSEncoding.MultiByteToWideChar(_encoding.CodePage, P_0, P_1, null, 0);
			}
			if (P_1 == 0 && !flag && !P_2)
			{
				return 0;
			}
			return ConvertWithLeftOverByte(P_0, P_1, null, 0);
		}

		public override int GetChars(byte[] P_0, int P_1, int P_2, char[] P_3, int P_4)
		{
			return ((Decoder)this).GetChars(P_0, P_1, P_2, P_3, P_4, false);
		}

		public unsafe override int GetChars(byte[] P_0, int P_1, int P_2, char[] P_3, int P_4, bool P_5)
		{
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			ArgumentNullException.ThrowIfNull((object)P_0, "bytes");
			ArgumentNullException.ThrowIfNull((object)P_3, "chars");
			ArgumentOutOfRangeException.ThrowIfNegative<int>(P_1, "byteIndex");
			ArgumentOutOfRangeException.ThrowIfNegative<int>(P_2, "byteCount");
			if (P_0.Length - P_1 < P_2)
			{
				throw new ArgumentOutOfRangeException("bytes", SR.ArgumentOutOfRange_IndexCountBuffer);
			}
			if (P_4 < 0 || P_4 > P_3.Length)
			{
				throw new ArgumentOutOfRangeException("charIndex", SR.ArgumentOutOfRange_IndexMustBeLessOrEqual);
			}
			if (P_3.Length == 0)
			{
				return 0;
			}
			if (P_2 == 0 && (_leftOverLeadByte == 0 || !P_5))
			{
				return 0;
			}
			fixed (char* ptr3 = &P_3[0])
			{
				fixed (byte* ptr = P_0)
				{
					System.Runtime.CompilerServices.Unsafe.SkipInit(out byte b);
					byte* ptr2 = ((ptr == null) ? (&b) : (ptr + P_1));
					return ((Decoder)this).GetChars(ptr2, P_2, ptr3 + P_4, P_3.Length - P_4, P_5);
				}
			}
		}

		public unsafe override int GetChars(byte* P_0, int P_1, char* P_2, int P_3, bool P_4)
		{
			ArgumentNullException.ThrowIfNull((void*)P_0, "bytes");
			ArgumentNullException.ThrowIfNull((void*)P_2, "chars");
			ArgumentOutOfRangeException.ThrowIfNegative<int>(P_1, "byteCount");
			ArgumentOutOfRangeException.ThrowIfNegative<int>(P_3, "charCount");
			if (P_3 == 0)
			{
				return 0;
			}
			byte b = (byte)((P_1 > 0 && !P_4 && IsLastByteALeadByte(P_0, P_1)) ? P_0[P_1 - 1] : 0);
			if (b != 0)
			{
				P_1--;
			}
			if (_leftOverLeadByte == 0)
			{
				if (P_1 <= 0)
				{
					_leftOverLeadByte = b;
					return 0;
				}
				int result = OSEncoding.MultiByteToWideChar(_encoding.CodePage, P_0, P_1, P_2, P_3);
				_leftOverLeadByte = b;
				return result;
			}
			if (P_1 == 0 && b == 0 && !P_4)
			{
				return 0;
			}
			int result2 = ConvertWithLeftOverByte(P_0, P_1, P_2, P_3);
			_leftOverLeadByte = b;
			return result2;
		}

		private unsafe bool IsLastByteALeadByte(byte* P_0, int P_1)
		{
			if (!IsLeadByte(P_0[P_1 - 1]))
			{
				return false;
			}
			int i = 0;
			if (_leftOverLeadByte != 0)
			{
				i++;
			}
			for (; i < P_1; i++)
			{
				if (IsLeadByte(P_0[i]))
				{
					i++;
					if (i >= P_1)
					{
						return true;
					}
				}
			}
			return false;
		}
	}
	internal static class EncodingHelper
	{
		internal static Encoding GetSupportedConsoleEncoding(int P_0)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Expected O, but got Unknown
			int codePage = Encoding.GetEncoding(0).CodePage;
			if (codePage == P_0 || codePage != 65001)
			{
				return Encoding.GetEncoding(P_0);
			}
			if (P_0 != 65001)
			{
				return (Encoding)(object)new OSEncoding(P_0);
			}
			return (Encoding)new UTF8Encoding(false);
		}
	}
}
namespace System.IO
{
	internal abstract class ConsoleStream : Stream
	{
		private bool _canRead;

		private bool _canWrite;

		public sealed override bool CanRead => _canRead;

		public sealed override bool CanWrite => _canWrite;

		public sealed override bool CanSeek => false;

		public sealed override long Length
		{
			get
			{
				throw Error.GetSeekNotSupported();
			}
		}

		public sealed override long Position
		{
			get
			{
				throw Error.GetSeekNotSupported();
			}
			set
			{
				throw Error.GetSeekNotSupported();
			}
		}

		internal ConsoleStream(FileAccess P_0)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Invalid comparison between Unknown and I4
			//IL_0013: 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_0017: Invalid comparison between Unknown and I4
			_canRead = (P_0 & 1) == 1;
			_canWrite = (P_0 & 2) == 2;
		}

		public override void Write(byte[] P_0, int P_1, int P_2)
		{
			ValidateWrite(P_0, P_1, P_2);
			((Stream)this).Write(new System.ReadOnlySpan<byte>(P_0, P_1, P_2));
		}

		public override int Read(byte[] P_0, int P_1, int P_2)
		{
			ValidateRead(P_0, P_1, P_2);
			return ((Stream)this).Read(new System.Span<byte>(P_0, P_1, P_2));
		}

		public override int ReadByte()
		{
			byte result = 0;
			if (((Stream)this).Read(new System.Span<byte>(ref result)) == 0)
			{
				return -1;
			}
			return result;
		}

		protected override void Dispose(bool P_0)
		{
			_canRead = false;
			_canWrite = false;
			((Stream)this).Dispose(P_0);
		}

		public override void Flush()
		{
		}

		public sealed override long Seek(long P_0, SeekOrigin P_1)
		{
			throw Error.GetSeekNotSupported();
		}

		protected void ValidateRead(byte[] P_0, int P_1, int P_2)
		{
			Stream.ValidateBufferArguments(P_0, P_1, P_2);
			if (!_canRead)
			{
				throw Error.GetReadNotSupported();
			}
		}

		protected void ValidateWrite(byte[] P_0, int P_1, int P_2)
		{
			Stream.ValidateBufferArguments(P_0, P_1, P_2);
			if (!_canWrite)
			{
				throw Error.GetWriteNotSupported();
			}
		}
	}
	internal static class Error
	{
		internal static System.Exception GetFileNotOpen()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			return (System.Exception)new ObjectDisposedException((string)null, SR.ObjectDisposed_FileClosed);
		}

		internal static System.Exception GetReadNotSupported()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			return (System.Exception)new NotSupportedException(SR.NotSupported_UnreadableStream);
		}

		internal static System.Exception GetSeekNotSupported()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			return (System.Exception)new NotSupportedException(SR.NotSupported_UnseekableStream);
		}

		internal static System.Exception GetWriteNotSupported()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			return (System.Exception)new NotSupportedException(SR.NotSupported_UnwritableStream);
		}
	}
	internal static class Win32Marshal
	{
		internal static System.Exception GetExceptionForWin32Error(int P_0, string P_1 = "")
		{
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Expected O, but got Unknown
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Expected O, but got Unknown
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Expected O, but got Unknown
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Expected O, but got Unknown
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Expected O, but got Unknown
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Expected O, but got Unknown
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Expected O, but got Unknown
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Expected O, but got Unknown
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Expected O, but got Unknown
			switch (P_0)
			{
			case 2:
				return (System.Exception)new FileNotFoundException(string.IsNullOrEmpty(P_1) ? SR.IO_FileNotFound : SR.Format(SR.IO_FileNotFound_FileName, P_1), P_1);
			case 3:
				return (System.Exception)new DirectoryNotFoundException(string.IsNullOrEmpty(P_1) ? SR.IO_PathNotFound_NoPathName : SR.Format(SR.IO_PathNotFound_Path, P_1));
			case 5:
				return (System.Exception)new UnauthorizedAccessException(string.IsNullOrEmpty(P_1) ? SR.UnauthorizedAccess_IODenied_NoPathName : SR.Format(SR.UnauthorizedAccess_IODenied_Path, P_1));
			case 183:
				if (!string.IsNullOrEmpty(P_1))
				{
					return (System.Exception)new IOException(SR.Format(SR.IO_AlreadyExists_Name, P_1), MakeHRFromErrorCode(P_0));
				}
				break;
			case 206:
				return (System.Exception)new PathTooLongException(string.IsNullOrEmpty(P_1) ? SR.IO_PathTooLong : SR.Format(SR.IO_PathTooLong_Path, P_1));
			case 32:
				return (System.Exception)new IOException(string.IsNullOrEmpty(P_1) ? SR.IO_SharingViolation_NoFileName : SR.Format(SR.IO_SharingViolation_File, P_1), MakeHRFromErrorCode(P_0));
			case 80:
				if (!string.IsNullOrEmpty(P_1))
				{
					return (System.Exception)new IOException(SR.Format(SR.IO_FileExists_Name, P_1), MakeHRFromErrorCode(P_0));
				}
				break;
			case 995:
				return (System.Exception)new OperationCanceledException();
			}
			string text = (string.IsNullOrEmpty(P_1) ? GetPInvokeErrorMessage(P_0) : (GetPInvokeErrorMessage(P_0) + " : '" + P_1 + "'"));
			return (System.Exception)new IOException(text, MakeHRFromErrorCode(P_0));
			[CompilerGenerated]
			static string GetPInvokeErrorMessage(int)
			{
				return Marshal.GetPInvokeErrorMessage(P_0);
			}
		}

		internal static int MakeHRFromErrorCode(int P_0)
		{
			if ((0xFFFF0000u & P_0) != 0L)
			{
				return P_0;
			}
			return -2147024896 | P_0;
		}
	}
}

System.Diagnostics.StackTrace.dll

Decompiled 8 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Reflection.Metadata;
using System.Reflection.Metadata.Ecma335;
using System.Reflection.PortableExecutable;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(/*Could not decode attribute arguments.*/)]
[assembly: TargetFramework(".NETCoreApp,Version=v8.0", FrameworkDisplayName = ".NET 8.0")]
[assembly: AssemblyMetadata("Serviceable", "True")]
[assembly: AssemblyMetadata("PreferInbox", "True")]
[assembly: AssemblyDefaultAlias("System.Diagnostics.StackTrace")]
[assembly: CLSCompliant(true)]
[assembly: AssemblyMetadata("IsTrimmable", "True")]
[assembly: DefaultDllImportSearchPaths(/*Could not decode attribute arguments.*/)]
[assembly: AssemblyCompany("Microsoft Corporation")]
[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")]
[assembly: AssemblyDescription("System.Diagnostics.StackTrace")]
[assembly: AssemblyFileVersion("8.0.324.11423")]
[assembly: AssemblyInformationalVersion("8.0.3+9f4b1f5d664afdfc80e1508ab7ed099dff210fbd")]
[assembly: AssemblyProduct("Microsoft® .NET")]
[assembly: AssemblyTitle("System.Diagnostics.StackTrace")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/dotnet/runtime")]
[assembly: AssemblyVersion("8.0.0.0")]
[module: RefSafetyRules(11)]
[module: NullablePublicOnly(false)]
[module: SkipLocalsInit]
namespace System.Diagnostics;

internal sealed class StackTraceSymbols : System.IDisposable
{
	private readonly ConditionalWeakTable<Assembly, MetadataReaderProvider> _metadataCache;

	public StackTraceSymbols()
	{
		_metadataCache = new ConditionalWeakTable<Assembly, MetadataReaderProvider>();
	}

	void System.IDisposable.Dispose()
	{
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		System.Collections.Generic.IEnumerator<KeyValuePair<Assembly, MetadataReaderProvider>> enumerator = ((System.Collections.Generic.IEnumerable<KeyValuePair<Assembly, MetadataReaderProvider>>)_metadataCache).GetEnumerator();
		try
		{
			System.Runtime.CompilerServices.Unsafe.SkipInit(out Assembly val);
			System.Runtime.CompilerServices.Unsafe.SkipInit(out MetadataReaderProvider val2);
			while (((System.Collections.IEnumerator)enumerator).MoveNext())
			{
				enumerator.Current.Deconstruct(ref val, ref val2);
				MetadataReaderProvider val3 = val2;
				if (val3 != null)
				{
					val3.Dispose();
				}
			}
		}
		finally
		{
			((System.IDisposable)enumerator)?.Dispose();
		}
		_metadataCache.Clear();
	}

	internal void GetSourceLineInfo(Assembly assembly, string assemblyPath, nint loadedPeAddress, int loadedPeSize, bool isFileLayout, nint inMemoryPdbAddress, int inMemoryPdbSize, int methodToken, int ilOffset, out string sourceFile, out int sourceLine, out int sourceColumn)
	{
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: Invalid comparison between Unknown and I4
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_003a: Unknown result type (might be due to invalid IL or missing references)
		//IL_003f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		//IL_0048: Unknown result type (might be due to invalid IL or missing references)
		//IL_004a: Unknown result type (might be due to invalid IL or missing references)
		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: Unknown result type (might be due to invalid IL or missing references)
		//IL_0053: Unknown result type (might be due to invalid IL or missing references)
		//IL_0058: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0079: Unknown result type (might be due to invalid IL or missing references)
		//IL_007e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0084: Unknown result type (might be due to invalid IL or missing references)
		//IL_0089: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00da: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0102: Unknown result type (might be due to invalid IL or missing references)
		//IL_0106: Unknown result type (might be due to invalid IL or missing references)
		//IL_010b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0110: Unknown result type (might be due to invalid IL or missing references)
		//IL_0114: Unknown result type (might be due to invalid IL or missing references)
		sourceFile = null;
		sourceLine = 0;
		sourceColumn = 0;
		MetadataReader val = TryGetReader(assembly, assemblyPath, loadedPeAddress, loadedPeSize, isFileLayout, inMemoryPdbAddress, inMemoryPdbSize);
		if (val == null)
		{
			return;
		}
		Handle val2 = MetadataTokens.Handle(methodToken);
		if ((int)((Handle)(ref val2)).Kind != 6)
		{
			return;
		}
		MethodDefinitionHandle val3 = (MethodDefinitionHandle)val2;
		MethodDebugInformationHandle val4 = ((MethodDefinitionHandle)(ref val3)).ToDebugInformationHandle();
		MethodDebugInformation methodDebugInformation = val.GetMethodDebugInformation(val4);
		BlobHandle sequencePointsBlob = ((MethodDebugInformation)(ref methodDebugInformation)).SequencePointsBlob;
		if (((BlobHandle)(ref sequencePointsBlob)).IsNil)
		{
			return;
		}
		SequencePointCollection sequencePoints = ((MethodDebugInformation)(ref methodDebugInformation)).GetSequencePoints();
		SequencePoint? val5 = null;
		Enumerator enumerator = ((SequencePointCollection)(ref sequencePoints)).GetEnumerator();
		try
		{
			while (((Enumerator)(ref enumerator)).MoveNext())
			{
				SequencePoint current = ((Enumerator)(ref enumerator)).Current;
				if (((SequencePoint)(ref current)).Offset > ilOffset)
				{
					break;
				}
				if (((SequencePoint)(ref current)).StartLine != 16707566)
				{
					val5 = current;
				}
			}
		}
		finally
		{
			((System.IDisposable)(Enumerator)(ref enumerator)).Dispose();
		}
		if (val5.HasValue)
		{
			SequencePoint value = val5.Value;
			sourceLine = ((SequencePoint)(ref value)).StartLine;
			value = val5.Value;
			sourceColumn = ((SequencePoint)(ref value)).StartColumn;
			value = val5.Value;
			Document document = val.GetDocument(((SequencePoint)(ref value)).Document);
			sourceFile = val.GetString(((Document)(ref document)).Name);
		}
	}

	private MetadataReader TryGetReader(Assembly P_0, string P_1, nint P_2, int P_3, bool P_4, nint P_5, int P_6)
	{
		if (P_2 == (nint)System.IntPtr.Zero && P_1 == null && P_5 == (nint)System.IntPtr.Zero)
		{
			return null;
		}
		System.Runtime.CompilerServices.Unsafe.SkipInit(out MetadataReaderProvider val);
		while (!_metadataCache.TryGetValue(P_0, ref val))
		{
			val = ((P_5 != (nint)System.IntPtr.Zero) ? TryOpenReaderForInMemoryPdb(P_5, P_6) : TryOpenReaderFromAssemblyFile(P_1, P_2, P_3, P_4));
			if (_metadataCache.TryAdd(P_0, val))
			{
				break;
			}
			if (val != null)
			{
				val.Dispose();
			}
		}
		if (val == null)
		{
			return null;
		}
		return val.GetMetadataReader((MetadataReaderOptions)1, (MetadataStringDecoder)null);
	}

	private unsafe static MetadataReaderProvider TryOpenReaderForInMemoryPdb(nint P_0, int P_1)
	{
		if (P_1 < 4 || *(uint*)P_0 != 1112167234)
		{
			return null;
		}
		MetadataReaderProvider val = MetadataReaderProvider.FromMetadataImage((byte*)P_0, P_1);
		try
		{
			val.GetMetadataReader((MetadataReaderOptions)1, (MetadataStringDecoder)null);
			return val;
		}
		catch (BadImageFormatException)
		{
			val.Dispose();
			return null;
		}
	}

	private unsafe static PEReader TryGetPEReader(string P_0, nint P_1, int P_2, bool P_3)
	{
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0029: Expected O, but got Unknown
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		//IL_0018: Expected O, but got Unknown
		if (P_1 != (nint)System.IntPtr.Zero && P_2 > 0)
		{
			return new PEReader((byte*)P_1, P_2, !P_3);
		}
		Stream val = TryOpenFile(P_0);
		if (val != null)
		{
			return new PEReader(val);
		}
		return null;
	}

	private static MetadataReaderProvider TryOpenReaderFromAssemblyFile(string P_0, nint P_1, int P_2, bool P_3)
	{
		//IL_0044: Unknown result type (might be due to invalid IL or missing references)
		//IL_0049: Unknown result type (might be due to invalid IL or missing references)
		//IL_004d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0052: Unknown result type (might be due to invalid IL or missing references)
		//IL_0058: Unknown result type (might be due to invalid IL or missing references)
		//IL_005d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0061: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Invalid comparison between Unknown and I4
		//IL_006b: Unknown result type (might be due to invalid IL or missing references)
		PEReader val = TryGetPEReader(P_0, P_1, P_2, P_3);
		try
		{
			if (val == null)
			{
				return null;
			}
			System.Runtime.CompilerServices.Unsafe.SkipInit(out MetadataReaderProvider result);
			System.Runtime.CompilerServices.Unsafe.SkipInit(out string text);
			if (P_0 != null && val.TryOpenAssociatedPortablePdb(P_0, (Func<string, Stream>)TryOpenFile, ref result, ref text))
			{
				return result;
			}
			Enumerator<DebugDirectoryEntry> enumerator = val.ReadDebugDirectory().GetEnumerator();
			while (enumerator.MoveNext())
			{
				DebugDirectoryEntry current = enumerator.Current;
				if ((int)((DebugDirectoryEntry)(ref current)).Type == 17)
				{
					try
					{
						return val.ReadEmbeddedPortablePdbDebugDirectoryData(current);
					}
					catch (System.Exception ex) when (ex is BadImageFormatException || ex is IOException)
					{
					}
					break;
				}
			}
		}
		finally
		{
			((System.IDisposable)val)?.Dispose();
		}
		return null;
	}

	private static Stream TryOpenFile(string path)
	{
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0015: Expected O, but got Unknown
		if (!File.Exists(path))
		{
			return null;
		}
		try
		{
			return (Stream)new FileStream(path, (FileMode)3, (FileAccess)1, (FileShare)5);
		}
		catch
		{
			return null;
		}
	}
}

System.IO.Compression.dll

Decompiled 8 months ago
using System;
using System.Buffers;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.IO.Compression;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Threading;
using System.Threading.Tasks;
using FxResources.System.IO.Compression;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(/*Could not decode attribute arguments.*/)]
[assembly: TargetFramework(".NETCoreApp,Version=v8.0", FrameworkDisplayName = ".NET 8.0")]
[assembly: AssemblyMetadata("Serviceable", "True")]
[assembly: AssemblyMetadata("PreferInbox", "True")]
[assembly: AssemblyDefaultAlias("System.IO.Compression")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: CLSCompliant(true)]
[assembly: AssemblyMetadata("IsTrimmable", "True")]
[assembly: DefaultDllImportSearchPaths(/*Could not decode attribute arguments.*/)]
[assembly: AssemblyCompany("Microsoft Corporation")]
[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")]
[assembly: AssemblyDescription("System.IO.Compression")]
[assembly: AssemblyFileVersion("8.0.324.11423")]
[assembly: AssemblyInformationalVersion("8.0.3+9f4b1f5d664afdfc80e1508ab7ed099dff210fbd")]
[assembly: AssemblyProduct("Microsoft® .NET")]
[assembly: AssemblyTitle("System.IO.Compression")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/dotnet/runtime")]
[assembly: SupportedOSPlatform("Windows")]
[assembly: AssemblyVersion("8.0.0.0")]
[module: RefSafetyRules(11)]
[module: NullablePublicOnly(false)]
[module: SkipLocalsInit]
internal static class Interop
{
	internal static class ZLib
	{
		[DllImport("System.IO.Compression.Native", EntryPoint = "CompressionNative_DeflateInit2_", ExactSpelling = true)]
		[LibraryImport("System.IO.Compression.Native", EntryPoint = "CompressionNative_DeflateInit2_")]
		internal unsafe static extern ZLibNative.ErrorCode DeflateInit2_(ZLibNative.ZStream* P_0, ZLibNative.CompressionLevel P_1, ZLibNative.CompressionMethod P_2, int P_3, int P_4, ZLibNative.CompressionStrategy P_5);

		[DllImport("System.IO.Compression.Native", EntryPoint = "CompressionNative_Deflate", ExactSpelling = true)]
		[LibraryImport("System.IO.Compression.Native", EntryPoint = "CompressionNative_Deflate")]
		internal unsafe static extern ZLibNative.ErrorCode Deflate(ZLibNative.ZStream* P_0, ZLibNative.FlushCode P_1);

		[DllImport("System.IO.Compression.Native", EntryPoint = "CompressionNative_DeflateEnd", ExactSpelling = true)]
		[LibraryImport("System.IO.Compression.Native", EntryPoint = "CompressionNative_DeflateEnd")]
		internal unsafe static extern ZLibNative.ErrorCode DeflateEnd(ZLibNative.ZStream* P_0);

		[DllImport("System.IO.Compression.Native", EntryPoint = "CompressionNative_InflateInit2_", ExactSpelling = true)]
		[LibraryImport("System.IO.Compression.Native", EntryPoint = "CompressionNative_InflateInit2_")]
		internal unsafe static extern ZLibNative.ErrorCode InflateInit2_(ZLibNative.ZStream* P_0, int P_1);

		[DllImport("System.IO.Compression.Native", EntryPoint = "CompressionNative_Inflate", ExactSpelling = true)]
		[LibraryImport("System.IO.Compression.Native", EntryPoint = "CompressionNative_Inflate")]
		internal unsafe static extern ZLibNative.ErrorCode Inflate(ZLibNative.ZStream* P_0, ZLibNative.FlushCode P_1);

		[DllImport("System.IO.Compression.Native", EntryPoint = "CompressionNative_InflateEnd", ExactSpelling = true)]
		[LibraryImport("System.IO.Compression.Native", EntryPoint = "CompressionNative_InflateEnd")]
		internal unsafe static extern ZLibNative.ErrorCode InflateEnd(ZLibNative.ZStream* P_0);
	}
}
namespace FxResources.System.IO.Compression
{
	internal static class SR
	{
	}
}
namespace System
{
	internal static class SR
	{
		private static readonly bool s_usingResourceKeys;

		private static ResourceManager s_resourceManager;

		internal static ResourceManager ResourceManager
		{
			get
			{
				//IL_0013: Unknown result type (might be due to invalid IL or missing references)
				//IL_0018: Unknown result type (might be due to invalid IL or missing references)
				//IL_001e: Expected O, but got Unknown
				object obj = s_resourceManager;
				if (obj == null)
				{
					ResourceManager val = new ResourceManager(typeof(FxResources.System.IO.Compression.SR));
					s_resourceManager = val;
					obj = (object)val;
				}
				return (ResourceManager)obj;
			}
		}

		internal static string ArgumentOutOfRange_Enum => GetResourceString("ArgumentOutOfRange_Enum");

		internal static string CannotReadFromDeflateStream => GetResourceString("CannotReadFromDeflateStream");

		internal static string CannotWriteToDeflateStream => GetResourceString("CannotWriteToDeflateStream");

		internal static string GenericInvalidData => GetResourceString("GenericInvalidData");

		internal static string InvalidBeginCall => GetResourceString("InvalidBeginCall");

		internal static string NotSupported => GetResourceString("NotSupported");

		internal static string NotSupported_UnreadableStream => GetResourceString("NotSupported_UnreadableStream");

		internal static string NotSupported_UnwritableStream => GetResourceString("NotSupported_UnwritableStream");

		internal static string ZLibErrorDLLLoadError => GetResourceString("ZLibErrorDLLLoadError");

		internal static string ZLibErrorInconsistentStream => GetResourceString("ZLibErrorInconsistentStream");

		internal static string ZLibErrorIncorrectInitParameters => GetResourceString("ZLibErrorIncorrectInitParameters");

		internal static string ZLibErrorNotEnoughMemory => GetResourceString("ZLibErrorNotEnoughMemory");

		internal static string ZLibErrorVersionMismatch => GetResourceString("ZLibErrorVersionMismatch");

		internal static string ZLibErrorUnexpected => GetResourceString("ZLibErrorUnexpected");

		internal static string TruncatedData => GetResourceString("TruncatedData");

		internal static string UnsupportedCompression => GetResourceString("UnsupportedCompression");

		internal static bool UsingResourceKeys()
		{
			return s_usingResourceKeys;
		}

		private static string GetResourceString(string P_0)
		{
			if (UsingResourceKeys())
			{
				return P_0;
			}
			string result = null;
			try
			{
				result = ResourceManager.GetString(P_0);
			}
			catch (MissingManifestResourceException)
			{
			}
			return result;
		}

		static SR()
		{
			System.Runtime.CompilerServices.Unsafe.SkipInit(out bool flag);
			s_usingResourceKeys = AppContext.TryGetSwitch("System.Resources.UseSystemResourceKeys", ref flag) && flag;
		}
	}
}
namespace System.IO.Compression
{
	internal sealed class Deflater : System.IDisposable
	{
		private readonly ZLibNative.ZLibStreamHandle _zlibStream;

		private MemoryHandle _inputBufferHandle;

		private bool _isDisposed;

		private object SyncLock => this;

		internal Deflater(CompressionLevel P_0, int P_1)
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			ZLibNative.CompressionLevel compressionLevel;
			int num;
			switch (P_0)
			{
			case CompressionLevel.Optimal:
				compressionLevel = ZLibNative.CompressionLevel.DefaultCompression;
				num = 8;
				break;
			case CompressionLevel.Fastest:
				compressionLevel = ZLibNative.CompressionLevel.BestSpeed;
				num = 8;
				break;
			case CompressionLevel.NoCompression:
				compressionLevel = ZLibNative.CompressionLevel.NoCompression;
				num = 7;
				break;
			case CompressionLevel.SmallestSize:
				compressionLevel = ZLibNative.CompressionLevel.BestCompression;
				num = 8;
				break;
			default:
				throw new ArgumentOutOfRangeException("compressionLevel");
			}
			ZLibNative.CompressionStrategy compressionStrategy = ZLibNative.CompressionStrategy.DefaultStrategy;
			ZLibNative.ErrorCode errorCode;
			try
			{
				errorCode = ZLibNative.CreateZLibStreamForDeflate(out _zlibStream, compressionLevel, P_1, num, compressionStrategy);
			}
			catch (System.Exception ex)
			{
				throw new ZLibException(SR.ZLibErrorDLLLoadError, ex);
			}
			switch (errorCode)
			{
			case ZLibNative.ErrorCode.Ok:
				break;
			case ZLibNative.ErrorCode.MemError:
				throw new ZLibException(SR.ZLibErrorNotEnoughMemory, "deflateInit2_", (int)errorCode, _zlibStream.GetErrorMessage());
			case ZLibNative.ErrorCode.VersionError:
				throw new ZLibException(SR.ZLibErrorVersionMismatch, "deflateInit2_", (int)errorCode, _zlibStream.GetErrorMessage());
			case ZLibNative.ErrorCode.StreamError:
				throw new ZLibException(SR.ZLibErrorIncorrectInitParameters, "deflateInit2_", (int)errorCode, _zlibStream.GetErrorMessage());
			default:
				throw new ZLibException(SR.ZLibErrorUnexpected, "deflateInit2_", (int)errorCode, _zlibStream.GetErrorMessage());
			}
		}

		~Deflater()
		{
			Dispose(false);
		}

		public void Dispose()
		{
			Dispose(true);
			GC.SuppressFinalize((object)this);
		}

		private void Dispose(bool P_0)
		{
			if (!_isDisposed)
			{
				if (P_0)
				{
					((SafeHandle)_zlibStream).Dispose();
				}
				DeallocateInputBufferHandle();
				_isDisposed = true;
			}
		}

		public bool NeedsInput()
		{
			return _zlibStream.AvailIn == 0;
		}

		internal unsafe void SetInput(ReadOnlyMemory<byte> P_0)
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			if (P_0.Length == 0)
			{
				return;
			}
			lock (SyncLock)
			{
				_inputBufferHandle = P_0.Pin();
				_zlibStream.NextIn = (nint)((MemoryHandle)(ref _inputBufferHandle)).Pointer;
				_zlibStream.AvailIn = (uint)P_0.Length;
			}
		}

		internal unsafe void SetInput(byte* P_0, int P_1)
		{
			if (P_1 == 0)
			{
				return;
			}
			lock (SyncLock)
			{
				_zlibStream.NextIn = (nint)P_0;
				_zlibStream.AvailIn = (uint)P_1;
			}
		}

		internal int GetDeflateOutput(byte[] P_0)
		{
			try
			{
				ReadDeflateOutput(P_0, ZLibNative.FlushCode.NoFlush, out var result);
				return result;
			}
			finally
			{
				if (_zlibStream.AvailIn == 0)
				{
					DeallocateInputBufferHandle();
				}
			}
		}

		private unsafe ZLibNative.ErrorCode ReadDeflateOutput(byte[] P_0, ZLibNative.FlushCode P_1, out int P_2)
		{
			lock (SyncLock)
			{
				fixed (byte* nextOut = &P_0[0])
				{
					_zlibStream.NextOut = (nint)nextOut;
					_zlibStream.AvailOut = (uint)P_0.Length;
					ZLibNative.ErrorCode result = Deflate(P_1);
					P_2 = P_0.Length - (int)_zlibStream.AvailOut;
					return result;
				}
			}
		}

		internal bool Finish(byte[] P_0, out int P_1)
		{
			ZLibNative.ErrorCode errorCode = ReadDeflateOutput(P_0, ZLibNative.FlushCode.Finish, out P_1);
			return errorCode == ZLibNative.ErrorCode.StreamEnd;
		}

		internal bool Flush(byte[] P_0, out int P_1)
		{
			return ReadDeflateOutput(P_0, ZLibNative.FlushCode.SyncFlush, out P_1) == ZLibNative.ErrorCode.Ok;
		}

		private void DeallocateInputBufferHandle()
		{
			lock (SyncLock)
			{
				_zlibStream.AvailIn = 0u;
				_zlibStream.NextIn = ZLibNative.ZNullPtr;
				((MemoryHandle)(ref _inputBufferHandle)).Dispose();
			}
		}

		private ZLibNative.ErrorCode Deflate(ZLibNative.FlushCode P_0)
		{
			ZLibNative.ErrorCode errorCode;
			try
			{
				errorCode = _zlibStream.Deflate(P_0);
			}
			catch (System.Exception ex)
			{
				throw new ZLibException(SR.ZLibErrorDLLLoadError, ex);
			}
			switch (errorCode)
			{
			case ZLibNative.ErrorCode.Ok:
			case ZLibNative.ErrorCode.StreamEnd:
				return errorCode;
			case ZLibNative.ErrorCode.BufError:
				return errorCode;
			case ZLibNative.ErrorCode.StreamError:
				throw new ZLibException(SR.ZLibErrorInconsistentStream, "deflate", (int)errorCode, _zlibStream.GetErrorMessage());
			default:
				throw new ZLibException(SR.ZLibErrorUnexpected, "deflate", (int)errorCode, _zlibStream.GetErrorMessage());
			}
		}
	}
	public class DeflateStream : Stream
	{
		[StructLayout(3)]
		[CompilerGenerated]
		private struct <<ReadAsyncMemory>g__Core|51_0>d : IAsyncStateMachine
		{
			public int <>1__state;

			public AsyncValueTaskMethodBuilder<int> <>t__builder;

			public DeflateStream <>4__this;

			public System.Memory<byte> buffer;

			public CancellationToken cancellationToken;

			private int <bytesRead>5__2;

			private ConfiguredValueTaskAwaiter<int> <>u__1;

			private void MoveNext()
			{
				//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
				//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
				//IL_007b: Unknown result type (might be due to invalid IL or missing references)
				//IL_008a: Unknown result type (might be due to invalid IL or missing references)
				//IL_008f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0093: Unknown result type (might be due to invalid IL or missing references)
				//IL_0098: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
				//IL_00af: Unknown result type (might be due to invalid IL or missing references)
				int num = <>1__state;
				DeflateStream deflateStream = <>4__this;
				int result2;
				try
				{
					if (num != 0)
					{
						deflateStream.AsyncOperationStarting();
					}
					try
					{
						if (num != 0)
						{
							goto IL_001e;
						}
						ConfiguredValueTaskAwaiter<int> awaiter = <>u__1;
						<>u__1 = default(ConfiguredValueTaskAwaiter<int>);
						num = (<>1__state = -1);
						goto IL_00e4;
						IL_001e:
						<bytesRead>5__2 = deflateStream._inflater.Inflate(buffer.Span);
						if (<bytesRead>5__2 == 0 && !deflateStream.InflatorIsFinished)
						{
							if (deflateStream._inflater.NeedsInput())
							{
								awaiter = deflateStream._stream.ReadAsync(new System.Memory<byte>(deflateStream._buffer, 0, deflateStream._buffer.Length), cancellationToken).ConfigureAwait(false).GetAwaiter();
								if (!awaiter.IsCompleted)
								{
									num = (<>1__state = 0);
									<>u__1 = awaiter;
									<>t__builder.AwaitUnsafeOnCompleted<ConfiguredValueTaskAwaiter<int>, <<ReadAsyncMemory>g__Core|51_0>d>(ref awaiter, ref this);
									return;
								}
								goto IL_00e4;
							}
							goto IL_014e;
						}
						goto IL_015e;
						IL_00e4:
						int result = awaiter.GetResult();
						int num2 = result;
						if (num2 <= 0)
						{
							if (s_useStrictValidation && !deflateStream._inflater.Finished() && deflateStream._inflater.NonEmptyInput() && !buffer.IsEmpty)
							{
								ThrowTruncatedInvalidData();
							}
							goto IL_015e;
						}
						if (num2 > deflateStream._buffer.Length)
						{
							ThrowGenericInvalidData();
						}
						else
						{
							deflateStream._inflater.SetInput(deflateStream._buffer, 0, num2);
						}
						goto IL_014e;
						IL_015e:
						result2 = <bytesRead>5__2;
						goto end_IL_0018;
						IL_014e:
						if (!buffer.IsEmpty)
						{
							goto IL_001e;
						}
						goto IL_015e;
						end_IL_0018:;
					}
					finally
					{
						if (num < 0)
						{
							deflateStream.AsyncOperationCompleting();
						}
					}
				}
				catch (System.Exception exception)
				{
					<>1__state = -2;
					<>t__builder.SetException(exception);
					return;
				}
				<>1__state = -2;
				<>t__builder.SetResult(result2);
			}
		}

		[StructLayout(3)]
		[CompilerGenerated]
		private struct <<WriteAsyncMemory>g__Core|66_0>d : IAsyncStateMachine
		{
			public int <>1__state;

			public AsyncValueTaskMethodBuilder <>t__builder;

			public DeflateStream <>4__this;

			public CancellationToken cancellationToken;

			public ReadOnlyMemory<byte> buffer;

			private ConfiguredValueTaskAwaiter <>u__1;

			private void MoveNext()
			{
				//IL_006f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0074: Unknown result type (might be due to invalid IL or missing references)
				//IL_007b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0098: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
				//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
				//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
				//IL_0025: Unknown result type (might be due to invalid IL or missing references)
				//IL_0033: Unknown result type (might be due to invalid IL or missing references)
				//IL_0038: Unknown result type (might be due to invalid IL or missing references)
				//IL_003c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0041: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
				//IL_0055: Unknown result type (might be due to invalid IL or missing references)
				//IL_0056: Unknown result type (might be due to invalid IL or missing references)
				int num = <>1__state;
				DeflateStream deflateStream = <>4__this;
				try
				{
					if ((uint)num > 1u)
					{
						deflateStream.AsyncOperationStarting();
					}
					try
					{
						ConfiguredValueTaskAwaiter awaiter;
						ConfiguredValueTaskAwaitable val;
						ConfiguredValueTaskAwaiter awaiter2;
						if (num != 0)
						{
							if (num == 1)
							{
								awaiter = <>u__1;
								<>u__1 = default(ConfiguredValueTaskAwaiter);
								num = (<>1__state = -1);
								goto IL_0109;
							}
							val = deflateStream.WriteDeflaterOutputAsync(cancellationToken).ConfigureAwait(false);
							awaiter2 = ((ConfiguredValueTaskAwaitable)(ref val)).GetAwaiter();
							if (!((ConfiguredValueTaskAwaiter)(ref awaiter2)).IsCompleted)
							{
								num = (<>1__state = 0);
								<>u__1 = awaiter2;
								((AsyncValueTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<ConfiguredValueTaskAwaiter, <<WriteAsyncMemory>g__Core|66_0>d>(ref awaiter2, ref this);
								return;
							}
						}
						else
						{
							awaiter2 = <>u__1;
							<>u__1 = default(ConfiguredValueTaskAwaiter);
							num = (<>1__state = -1);
						}
						((ConfiguredValueTaskAwaiter)(ref awaiter2)).GetResult();
						deflateStream._deflater.SetInput(buffer);
						val = deflateStream.WriteDeflaterOutputAsync(cancellationToken).ConfigureAwait(false);
						awaiter = ((ConfiguredValueTaskAwaitable)(ref val)).GetAwaiter();
						if (!((ConfiguredValueTaskAwaiter)(ref awaiter)).IsCompleted)
						{
							num = (<>1__state = 1);
							<>u__1 = awaiter;
							((AsyncValueTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<ConfiguredValueTaskAwaiter, <<WriteAsyncMemory>g__Core|66_0>d>(ref awaiter, ref this);
							return;
						}
						goto IL_0109;
						IL_0109:
						((ConfiguredValueTaskAwaiter)(ref awaiter)).GetResult();
						deflateStream._wroteBytes = true;
					}
					finally
					{
						if (num < 0)
						{
							deflateStream.AsyncOperationCompleting();
						}
					}
				}
				catch (System.Exception exception)
				{
					<>1__state = -2;
					((AsyncValueTaskMethodBuilder)(ref <>t__builder)).SetException(exception);
					return;
				}
				<>1__state = -2;
				((AsyncValueTaskMethodBuilder)(ref <>t__builder)).SetResult();
			}
		}

		[StructLayout(3)]
		[CompilerGenerated]
		private struct <WriteDeflaterOutputAsync>d__67 : IAsyncStateMachine
		{
			public int <>1__state;

			public AsyncValueTaskMethodBuilder <>t__builder;

			public DeflateStream <>4__this;

			public CancellationToken cancellationToken;

			private ConfiguredValueTaskAwaiter <>u__1;

			private void MoveNext()
			{
				//IL_0088: Unknown result type (might be due to invalid IL or missing references)
				//IL_008d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0094: Unknown result type (might be due to invalid IL or missing references)
				//IL_003a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0040: Unknown result type (might be due to invalid IL or missing references)
				//IL_004f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0054: Unknown result type (might be due to invalid IL or missing references)
				//IL_0058: Unknown result type (might be due to invalid IL or missing references)
				//IL_005d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0071: Unknown result type (might be due to invalid IL or missing references)
				//IL_0072: Unknown result type (might be due to invalid IL or missing references)
				int num = <>1__state;
				DeflateStream deflateStream = <>4__this;
				try
				{
					if (num != 0)
					{
						goto IL_00aa;
					}
					ConfiguredValueTaskAwaiter awaiter = <>u__1;
					<>u__1 = default(ConfiguredValueTaskAwaiter);
					num = (<>1__state = -1);
					goto IL_00a3;
					IL_00aa:
					while (!deflateStream._deflater.NeedsInput())
					{
						int deflateOutput = deflateStream._deflater.GetDeflateOutput(deflateStream._buffer);
						if (deflateOutput <= 0)
						{
							continue;
						}
						ConfiguredValueTaskAwaitable val = deflateStream._stream.WriteAsync(new ReadOnlyMemory<byte>(deflateStream._buffer, 0, deflateOutput), cancellationToken).ConfigureAwait(false);
						awaiter = ((ConfiguredValueTaskAwaitable)(ref val)).GetAwaiter();
						if (!((ConfiguredValueTaskAwaiter)(ref awaiter)).IsCompleted)
						{
							num = (<>1__state = 0);
							<>u__1 = awaiter;
							((AsyncValueTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<ConfiguredValueTaskAwaiter, <WriteDeflaterOutputAsync>d__67>(ref awaiter, ref this);
							return;
						}
						goto IL_00a3;
					}
					goto end_IL_000e;
					IL_00a3:
					((ConfiguredValueTaskAwaiter)(ref awaiter)).GetResult();
					goto IL_00aa;
					end_IL_000e:;
				}
				catch (System.Exception exception)
				{
					<>1__state = -2;
					((AsyncValueTaskMethodBuilder)(ref <>t__builder)).SetException(exception);
					return;
				}
				<>1__state = -2;
				((AsyncValueTaskMethodBuilder)(ref <>t__builder)).SetResult();
			}
		}

		private Stream _stream;

		private CompressionMode _mode;

		private bool _leaveOpen;

		private Inflater _inflater;

		private Deflater _deflater;

		private byte[] _buffer;

		private int _activeAsyncOperation;

		private bool _wroteBytes;

		private static readonly bool s_useStrictValidation;

		public override bool CanRead
		{
			get
			{
				if (_stream == null)
				{
					return false;
				}
				if (_mode == CompressionMode.Decompress)
				{
					return _stream.CanRead;
				}
				return false;
			}
		}

		public override bool CanWrite
		{
			get
			{
				if (_stream == null)
				{
					return false;
				}
				if (_mode == CompressionMode.Compress)
				{
					return _stream.CanWrite;
				}
				return false;
			}
		}

		public override bool CanSeek => false;

		public override long Length
		{
			get
			{
				//IL_0005: Unknown result type (might be due to invalid IL or missing references)
				throw new NotSupportedException(SR.NotSupported);
			}
		}

		public override long Position
		{
			get
			{
				//IL_0005: Unknown result type (might be due to invalid IL or missing references)
				throw new NotSupportedException(SR.NotSupported);
			}
			set
			{
				//IL_0005: Unknown result type (might be due to invalid IL or missing references)
				throw new NotSupportedException(SR.NotSupported);
			}
		}

		private bool InflatorIsFinished
		{
			get
			{
				if (_inflater.Finished())
				{
					if (_inflater.IsGzipStream())
					{
						return !_inflater.NeedsInput();
					}
					return true;
				}
				return false;
			}
		}

		private bool AsyncOperationIsActive => _activeAsyncOperation != 0;

		public DeflateStream(Stream P_0, CompressionMode P_1, bool P_2)
			: this(P_0, P_1, P_2, -15, -1L)
		{
		}

		internal DeflateStream(Stream P_0, CompressionMode P_1, bool P_2, int P_3, long P_4 = -1L)
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			ArgumentNullException.ThrowIfNull((object)P_0, "stream");
			switch (P_1)
			{
			case CompressionMode.Decompress:
				if (!P_0.CanRead)
				{
					throw new ArgumentException(SR.NotSupported_UnreadableStream, "stream");
				}
				_inflater = new Inflater(P_3, P_4);
				_stream = P_0;
				_mode = CompressionMode.Decompress;
				_leaveOpen = P_2;
				break;
			case CompressionMode.Compress:
				InitializeDeflater(P_0, P_2, P_3, CompressionLevel.Optimal);
				break;
			default:
				throw new ArgumentException(SR.ArgumentOutOfRange_Enum, "mode");
			}
		}

		[MemberNotNull("_stream")]
		internal void InitializeDeflater(Stream P_0, bool P_1, int P_2, CompressionLevel P_3)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			if (!P_0.CanWrite)
			{
				throw new ArgumentException(SR.NotSupported_UnwritableStream, "stream");
			}
			_deflater = new Deflater(P_3, P_2);
			_stream = P_0;
			_mode = CompressionMode.Compress;
			_leaveOpen = P_1;
			InitializeBuffer();
		}

		[MemberNotNull("_buffer")]
		private void InitializeBuffer()
		{
			_buffer = ArrayPool<byte>.Shared.Rent(8192);
		}

		[MemberNotNull("_buffer")]
		private void EnsureBufferInitialized()
		{
			if (_buffer == null)
			{
				InitializeBuffer();
			}
		}

		public override void Flush()
		{
			EnsureNotDisposed();
			if (_mode == CompressionMode.Compress)
			{
				FlushBuffers();
			}
		}

		public override long Seek(long P_0, SeekOrigin P_1)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			throw new NotSupportedException(SR.NotSupported);
		}

		public override int ReadByte()
		{
			EnsureDecompressionMode();
			EnsureNotDisposed();
			if (!_inflater.Inflate(out var result))
			{
				return ((Stream)this).ReadByte();
			}
			return result;
		}

		public override int Read(byte[] P_0, int P_1, int P_2)
		{
			Stream.ValidateBufferArguments(P_0, P_1, P_2);
			return ReadCore(new System.Span<byte>(P_0, P_1, P_2));
		}

		public override int Read(System.Span<byte> P_0)
		{
			if (((object)this).GetType() != typeof(DeflateStream))
			{
				return ((Stream)this).Read(P_0);
			}
			return ReadCore(P_0);
		}

		internal int ReadCore(System.Span<byte> P_0)
		{
			EnsureDecompressionMode();
			EnsureNotDisposed();
			EnsureBufferInitialized();
			int num;
			do
			{
				num = _inflater.Inflate(P_0);
				if (num != 0 || InflatorIsFinished)
				{
					break;
				}
				if (!_inflater.NeedsInput())
				{
					continue;
				}
				int num2 = _stream.Read(_buffer, 0, _buffer.Length);
				if (num2 <= 0)
				{
					if (s_useStrictValidation && !P_0.IsEmpty && !_inflater.Finished() && _inflater.NonEmptyInput())
					{
						ThrowTruncatedInvalidData();
					}
					break;
				}
				if (num2 > _buffer.Length)
				{
					ThrowGenericInvalidData();
				}
				else
				{
					_inflater.SetInput(_buffer, 0, num2);
				}
			}
			while (!P_0.IsEmpty);
			return num;
		}

		private void EnsureNotDisposed()
		{
			ObjectDisposedException.ThrowIf(_stream == null, (object)this);
		}

		private void EnsureDecompressionMode()
		{
			if (_mode != 0)
			{
				ThrowCannotReadFromDeflateStreamException();
			}
			[CompilerGenerated]
			static void ThrowCannotReadFromDeflateStreamException()
			{
				//IL_0005: Unknown result type (might be due to invalid IL or missing references)
				throw new InvalidOperationException(SR.CannotReadFromDeflateStream);
			}
		}

		private void EnsureCompressionMode()
		{
			if (_mode != CompressionMode.Compress)
			{
				ThrowCannotWriteToDeflateStreamException();
			}
			[CompilerGenerated]
			static void ThrowCannotWriteToDeflateStreamException()
			{
				//IL_0005: Unknown result type (might be due to invalid IL or missing references)
				throw new InvalidOperationException(SR.CannotWriteToDeflateStream);
			}
		}

		private static void ThrowGenericInvalidData()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			throw new InvalidDataException(SR.GenericInvalidData);
		}

		private static void ThrowTruncatedInvalidData()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			throw new InvalidDataException(SR.TruncatedData);
		}

		public override IAsyncResult BeginRead(byte[] P_0, int P_1, int P_2, AsyncCallback? P_3, object? P_4)
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			return TaskToAsyncResult.Begin((System.Threading.Tasks.Task)((Stream)this).ReadAsync(P_0, P_1, P_2, CancellationToken.None), P_3, P_4);
		}

		public override int EndRead(IAsyncResult P_0)
		{
			EnsureDecompressionMode();
			EnsureNotDisposed();
			return TaskToAsyncResult.End<int>(P_0);
		}

		public override System.Threading.Tasks.Task<int> ReadAsync(byte[] P_0, int P_1, int P_2, CancellationToken P_3)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			Stream.ValidateBufferArguments(P_0, P_1, P_2);
			return ReadAsyncMemory(new System.Memory<byte>(P_0, P_1, P_2), P_3).AsTask();
		}

		public override System.Threading.Tasks.ValueTask<int> ReadAsync(System.Memory<byte> P_0, CancellationToken P_1 = default(CancellationToken))
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			if (((object)this).GetType() != typeof(DeflateStream))
			{
				return ((Stream)this).ReadAsync(P_0, P_1);
			}
			return ReadAsyncMemory(P_0, P_1);
		}

		internal System.Threading.Tasks.ValueTask<int> ReadAsyncMemory(System.Memory<byte> P_0, CancellationToken P_1)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			EnsureDecompressionMode();
			EnsureNoActiveAsyncOperation();
			EnsureNotDisposed();
			if (((CancellationToken)(ref P_1)).IsCancellationRequested)
			{
				return System.Threading.Tasks.ValueTask.FromCanceled<int>(P_1);
			}
			EnsureBufferInitialized();
			return Core(P_0, P_1);
			[AsyncStateMachine(typeof(<<ReadAsyncMemory>g__Core|51_0>d))]
			[CompilerGenerated]
			System.Threading.Tasks.ValueTask<int> Core(System.Memory<byte>, CancellationToken)
			{
				//IL_0002: 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_001e: Unknown result type (might be due to invalid IL or missing references)
				//IL_001f: Unknown result type (might be due to invalid IL or missing references)
				System.Runtime.CompilerServices.Unsafe.SkipInit(out <<ReadAsyncMemory>g__Core|51_0>d <<ReadAsyncMemory>g__Core|51_0>d);
				<<ReadAsyncMemory>g__Core|51_0>d.<>t__builder = AsyncValueTaskMethodBuilder<int>.Create();
				<<ReadAsyncMemory>g__Core|51_0>d.<>4__this = this;
				<<ReadAsyncMemory>g__Core|51_0>d.buffer = P_0;
				<<ReadAsyncMemory>g__Core|51_0>d.cancellationToken = P_1;
				<<ReadAsyncMemory>g__Core|51_0>d.<>1__state = -1;
				<<ReadAsyncMemory>g__Core|51_0>d.<>t__builder.Start<<<ReadAsyncMemory>g__Core|51_0>d>(ref <<ReadAsyncMemory>g__Core|51_0>d);
				return <<ReadAsyncMemory>g__Core|51_0>d.<>t__builder.Task;
			}
		}

		public override void Write(byte[] P_0, int P_1, int P_2)
		{
			Stream.ValidateBufferArguments(P_0, P_1, P_2);
			WriteCore(new System.ReadOnlySpan<byte>(P_0, P_1, P_2));
		}

		public override void Write(System.ReadOnlySpan<byte> P_0)
		{
			if (((object)this).GetType() != typeof(DeflateStream))
			{
				((Stream)this).Write(P_0);
			}
			else
			{
				WriteCore(P_0);
			}
		}

		internal unsafe void WriteCore(System.ReadOnlySpan<byte> P_0)
		{
			EnsureCompressionMode();
			EnsureNotDisposed();
			WriteDeflaterOutput();
			fixed (byte* ptr = &MemoryMarshal.GetReference<byte>(P_0))
			{
				_deflater.SetInput(ptr, P_0.Length);
				WriteDeflaterOutput();
				_wroteBytes = true;
			}
		}

		private void WriteDeflaterOutput()
		{
			while (!_deflater.NeedsInput())
			{
				int deflateOutput = _deflater.GetDeflateOutput(_buffer);
				if (deflateOutput > 0)
				{
					_stream.Write(_buffer, 0, deflateOutput);
				}
			}
		}

		private void FlushBuffers()
		{
			if (_wroteBytes)
			{
				WriteDeflaterOutput();
				bool flag;
				do
				{
					flag = _deflater.Flush(_buffer, out var num);
					if (flag)
					{
						_stream.Write(_buffer, 0, num);
					}
				}
				while (flag);
			}
			_stream.Flush();
		}

		private void PurgeBuffers(bool P_0)
		{
			if (!P_0 || _stream == null || _mode != CompressionMode.Compress)
			{
				return;
			}
			if (_wroteBytes)
			{
				WriteDeflaterOutput();
				bool flag;
				do
				{
					flag = _deflater.Finish(_buffer, out var num);
					if (num > 0)
					{
						_stream.Write(_buffer, 0, num);
					}
				}
				while (!flag);
			}
			else
			{
				int num2;
				while (!_deflater.Finish(_buffer, out num2))
				{
				}
			}
		}

		protected override void Dispose(bool P_0)
		{
			try
			{
				PurgeBuffers(P_0);
			}
			finally
			{
				try
				{
					if (P_0 && !_leaveOpen)
					{
						Stream stream = _stream;
						if (stream != null)
						{
							stream.Dispose();
						}
					}
				}
				finally
				{
					_stream = null;
					try
					{
						_deflater?.Dispose();
						_inflater?.Dispose();
					}
					finally
					{
						_deflater = null;
						_inflater = null;
						byte[] buffer = _buffer;
						if (buffer != null)
						{
							_buffer = null;
							if (!AsyncOperationIsActive)
							{
								ArrayPool<byte>.Shared.Return(buffer, false);
							}
						}
						((Stream)this).Dispose(P_0);
					}
				}
			}
		}

		public override IAsyncResult BeginWrite(byte[] P_0, int P_1, int P_2, AsyncCallback? P_3, object? P_4)
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			return TaskToAsyncResult.Begin(((Stream)this).WriteAsync(P_0, P_1, P_2, CancellationToken.None), P_3, P_4);
		}

		public override void EndWrite(IAsyncResult P_0)
		{
			EnsureCompressionMode();
			EnsureNotDisposed();
			TaskToAsyncResult.End(P_0);
		}

		public override System.Threading.Tasks.Task WriteAsync(byte[] P_0, int P_1, int P_2, CancellationToken P_3)
		{
			//IL_000c: 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)
			Stream.ValidateBufferArguments(P_0, P_1, P_2);
			return WriteAsyncMemory(new ReadOnlyMemory<byte>(P_0, P_1, P_2), P_3).AsTask();
		}

		public override System.Threading.Tasks.ValueTask WriteAsync(ReadOnlyMemory<byte> P_0, CancellationToken P_1)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			if (((object)this).GetType() != typeof(DeflateStream))
			{
				return ((Stream)this).WriteAsync(P_0, P_1);
			}
			return WriteAsyncMemory(P_0, P_1);
		}

		internal System.Threading.Tasks.ValueTask WriteAsyncMemory(ReadOnlyMemory<byte> P_0, CancellationToken P_1)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: 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)
			EnsureCompressionMode();
			EnsureNoActiveAsyncOperation();
			EnsureNotDisposed();
			if (!((CancellationToken)(ref P_1)).IsCancellationRequested)
			{
				return Core(P_0, P_1);
			}
			return System.Threading.Tasks.ValueTask.FromCanceled(P_1);
			[AsyncStateMachine(typeof(<<WriteAsyncMemory>g__Core|66_0>d))]
			[CompilerGenerated]
			System.Threading.Tasks.ValueTask Core(ReadOnlyMemory<byte>, CancellationToken)
			{
				//IL_0002: 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_0016: Unknown result type (might be due to invalid IL or missing references)
				//IL_0017: Unknown result type (might be due to invalid IL or missing references)
				//IL_001e: Unknown result type (might be due to invalid IL or missing references)
				//IL_001f: Unknown result type (might be due to invalid IL or missing references)
				System.Runtime.CompilerServices.Unsafe.SkipInit(out <<WriteAsyncMemory>g__Core|66_0>d <<WriteAsyncMemory>g__Core|66_0>d);
				<<WriteAsyncMemory>g__Core|66_0>d.<>t__builder = AsyncValueTaskMethodBuilder.Create();
				<<WriteAsyncMemory>g__Core|66_0>d.<>4__this = this;
				<<WriteAsyncMemory>g__Core|66_0>d.buffer = P_0;
				<<WriteAsyncMemory>g__Core|66_0>d.cancellationToken = P_1;
				<<WriteAsyncMemory>g__Core|66_0>d.<>1__state = -1;
				((AsyncValueTaskMethodBuilder)(ref <<WriteAsyncMemory>g__Core|66_0>d.<>t__builder)).Start<<<WriteAsyncMemory>g__Core|66_0>d>(ref <<WriteAsyncMemory>g__Core|66_0>d);
				return ((AsyncValueTaskMethodBuilder)(ref <<WriteAsyncMemory>g__Core|66_0>d.<>t__builder)).Task;
			}
		}

		[AsyncStateMachine(typeof(<WriteDeflaterOutputAsync>d__67))]
		private System.Threading.Tasks.ValueTask WriteDeflaterOutputAsync(CancellationToken P_0)
		{
			//IL_0002: 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_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			System.Runtime.CompilerServices.Unsafe.SkipInit(out <WriteDeflaterOutputAsync>d__67 <WriteDeflaterOutputAsync>d__);
			<WriteDeflaterOutputAsync>d__.<>t__builder = AsyncValueTaskMethodBuilder.Create();
			<WriteDeflaterOutputAsync>d__.<>4__this = this;
			<WriteDeflaterOutputAsync>d__.cancellationToken = P_0;
			<WriteDeflaterOutputAsync>d__.<>1__state = -1;
			((AsyncValueTaskMethodBuilder)(ref <WriteDeflaterOutputAsync>d__.<>t__builder)).Start<<WriteDeflaterOutputAsync>d__67>(ref <WriteDeflaterOutputAsync>d__);
			return ((AsyncValueTaskMethodBuilder)(ref <WriteDeflaterOutputAsync>d__.<>t__builder)).Task;
		}

		private void EnsureNoActiveAsyncOperation()
		{
			if (AsyncOperationIsActive)
			{
				ThrowInvalidBeginCall();
			}
		}

		private void AsyncOperationStarting()
		{
			if (Interlocked.Exchange(ref _activeAsyncOperation, 1) != 0)
			{
				ThrowInvalidBeginCall();
			}
		}

		private void AsyncOperationCompleting()
		{
			Volatile.Write(ref _activeAsyncOperation, 0);
		}

		private static void ThrowInvalidBeginCall()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			throw new InvalidOperationException(SR.InvalidBeginCall);
		}

		static DeflateStream()
		{
			System.Runtime.CompilerServices.Unsafe.SkipInit(out bool flag);
			s_useStrictValidation = AppContext.TryGetSwitch("System.IO.Compression.UseStrictValidation", ref flag) && flag;
		}
	}
	internal sealed class Inflater : System.IDisposable
	{
		private bool _nonEmptyInput;

		private bool _finished;

		private bool _isDisposed;

		private readonly int _windowBits;

		private ZLibNative.ZLibStreamHandle _zlibStream;

		private MemoryHandle _inputBufferHandle;

		private readonly long _uncompressedSize;

		private long _currentInflatedCount;

		private object SyncLock => this;

		private unsafe bool IsInputBufferHandleAllocated => ((MemoryHandle)(ref _inputBufferHandle)).Pointer != null;

		internal Inflater(int P_0, long P_1 = -1L)
		{
			_finished = false;
			_nonEmptyInput = false;
			_isDisposed = false;
			_windowBits = P_0;
			InflateInit(P_0);
			_uncompressedSize = P_1;
		}

		public bool Finished()
		{
			return _finished;
		}

		public unsafe bool Inflate(out byte P_0)
		{
			fixed (byte* ptr = &P_0)
			{
				int num = InflateVerified(ptr, 1);
				return num != 0;
			}
		}

		public unsafe int Inflate(System.Span<byte> P_0)
		{
			if (P_0.Length == 0)
			{
				return 0;
			}
			fixed (byte* ptr = &MemoryMarshal.GetReference<byte>(P_0))
			{
				return InflateVerified(ptr, P_0.Length);
			}
		}

		public unsafe int InflateVerified(byte* P_0, int P_1)
		{
			try
			{
				int num = 0;
				if (_uncompressedSize == -1)
				{
					ReadOutput(P_0, P_1, out num);
				}
				else if (_uncompressedSize > _currentInflatedCount)
				{
					P_1 = (int)Math.Min((long)P_1, _uncompressedSize - _currentInflatedCount);
					ReadOutput(P_0, P_1, out num);
					_currentInflatedCount += num;
				}
				else
				{
					_finished = true;
					_zlibStream.AvailIn = 0u;
				}
				return num;
			}
			finally
			{
				if (_zlibStream.AvailIn == 0 && IsInputBufferHandleAllocated)
				{
					DeallocateInputBufferHandle();
				}
			}
		}

		private unsafe void ReadOutput(byte* P_0, int P_1, out int P_2)
		{
			if (ReadInflateOutput(P_0, P_1, ZLibNative.FlushCode.NoFlush, out P_2) == ZLibNative.ErrorCode.StreamEnd)
			{
				if (!NeedsInput() && IsGzipStream() && IsInputBufferHandleAllocated)
				{
					_finished = ResetStreamForLeftoverInput();
				}
				else
				{
					_finished = true;
				}
			}
		}

		private unsafe bool ResetStreamForLeftoverInput()
		{
			lock (SyncLock)
			{
				nint nextIn = _zlibStream.NextIn;
				byte* ptr = (byte*)((System.IntPtr)nextIn).ToPointer();
				uint availIn = _zlibStream.AvailIn;
				if (*ptr != 31 || (availIn > 1 && ptr[1] != 139))
				{
					return true;
				}
				((SafeHandle)_zlibStream).Dispose();
				InflateInit(_windowBits);
				_zlibStream.NextIn = nextIn;
				_zlibStream.AvailIn = availIn;
				_finished = false;
			}
			return false;
		}

		internal bool IsGzipStream()
		{
			if (_windowBits >= 24)
			{
				return _windowBits <= 31;
			}
			return false;
		}

		public bool NeedsInput()
		{
			return _zlibStream.AvailIn == 0;
		}

		public bool NonEmptyInput()
		{
			return _nonEmptyInput;
		}

		public void SetInput(byte[] P_0, int P_1, int P_2)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			SetInput(System.Memory<byte>.op_Implicit(MemoryExtensions.AsMemory<byte>(P_0, P_1, P_2)));
		}

		public unsafe void SetInput(ReadOnlyMemory<byte> P_0)
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			if (P_0.IsEmpty)
			{
				return;
			}
			lock (SyncLock)
			{
				_inputBufferHandle = P_0.Pin();
				_zlibStream.NextIn = (nint)((MemoryHandle)(ref _inputBufferHandle)).Pointer;
				_zlibStream.AvailIn = (uint)P_0.Length;
				_finished = false;
				_nonEmptyInput = true;
			}
		}

		private void Dispose(bool P_0)
		{
			if (!_isDisposed)
			{
				if (P_0)
				{
					((SafeHandle)_zlibStream).Dispose();
				}
				if (IsInputBufferHandleAllocated)
				{
					DeallocateInputBufferHandle();
				}
				_isDisposed = true;
			}
		}

		public void Dispose()
		{
			Dispose(true);
			GC.SuppressFinalize((object)this);
		}

		~Inflater()
		{
			Dispose(false);
		}

		[MemberNotNull("_zlibStream")]
		private void InflateInit(int P_0)
		{
			ZLibNative.ErrorCode errorCode;
			try
			{
				errorCode = ZLibNative.CreateZLibStreamForInflate(out _zlibStream, P_0);
			}
			catch (System.Exception ex)
			{
				throw new ZLibException(SR.ZLibErrorDLLLoadError, ex);
			}
			switch (errorCode)
			{
			case ZLibNative.ErrorCode.Ok:
				break;
			case ZLibNative.ErrorCode.MemError:
				throw new ZLibException(SR.ZLibErrorNotEnoughMemory, "inflateInit2_", (int)errorCode, _zlibStream.GetErrorMessage());
			case ZLibNative.ErrorCode.VersionError:
				throw new ZLibException(SR.ZLibErrorVersionMismatch, "inflateInit2_", (int)errorCode, _zlibStream.GetErrorMessage());
			case ZLibNative.ErrorCode.StreamError:
				throw new ZLibException(SR.ZLibErrorIncorrectInitParameters, "inflateInit2_", (int)errorCode, _zlibStream.GetErrorMessage());
			default:
				throw new ZLibException(SR.ZLibErrorUnexpected, "inflateInit2_", (int)errorCode, _zlibStream.GetErrorMessage());
			}
		}

		private unsafe ZLibNative.ErrorCode ReadInflateOutput(byte* P_0, int P_1, ZLibNative.FlushCode P_2, out int P_3)
		{
			lock (SyncLock)
			{
				_zlibStream.NextOut = (nint)P_0;
				_zlibStream.AvailOut = (uint)P_1;
				ZLibNative.ErrorCode result = Inflate(P_2);
				P_3 = P_1 - (int)_zlibStream.AvailOut;
				return result;
			}
		}

		private ZLibNative.ErrorCode Inflate(ZLibNative.FlushCode P_0)
		{
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			ZLibNative.ErrorCode errorCode;
			try
			{
				errorCode = _zlibStream.Inflate(P_0);
			}
			catch (System.Exception ex)
			{
				throw new ZLibException(SR.ZLibErrorDLLLoadError, ex);
			}
			switch (errorCode)
			{
			case ZLibNative.ErrorCode.Ok:
			case ZLibNative.ErrorCode.StreamEnd:
				return errorCode;
			case ZLibNative.ErrorCode.BufError:
				return errorCode;
			case ZLibNative.ErrorCode.MemError:
				throw new ZLibException(SR.ZLibErrorNotEnoughMemory, "inflate_", (int)errorCode, _zlibStream.GetErrorMessage());
			case ZLibNative.ErrorCode.DataError:
				throw new InvalidDataException(SR.UnsupportedCompression);
			case ZLibNative.ErrorCode.StreamError:
				throw new ZLibException(SR.ZLibErrorInconsistentStream, "inflate_", (int)errorCode, _zlibStream.GetErrorMessage());
			default:
				throw new ZLibException(SR.ZLibErrorUnexpected, "inflate_", (int)errorCode, _zlibStream.GetErrorMessage());
			}
		}

		private void DeallocateInputBufferHandle()
		{
			lock (SyncLock)
			{
				_zlibStream.AvailIn = 0u;
				_zlibStream.NextIn = ZLibNative.ZNullPtr;
				((MemoryHandle)(ref _inputBufferHandle)).Dispose();
			}
		}
	}
	[Serializable]
	[TypeForwardedFrom("System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
	public class ZLibException : IOException
	{
		private readonly string _zlibErrorContext = string.Empty;

		private readonly string _zlibErrorMessage = string.Empty;

		private readonly ZLibNative.ErrorCode _zlibErrorCode;

		public ZLibException(string? P_0, string? P_1, int P_2, string? P_3)
			: base(P_0)
		{
			_zlibErrorContext = P_1;
			_zlibErrorCode = (ZLibNative.ErrorCode)P_2;
			_zlibErrorMessage = P_3;
		}

		public ZLibException(string? P_0, System.Exception? P_1)
			: base(P_0, P_1)
		{
		}
	}
	internal static class ZLibNative
	{
		public enum FlushCode
		{
			NoFlush = 0,
			SyncFlush = 2,
			Finish = 4,
			Block = 5
		}

		public enum ErrorCode
		{
			Ok = 0,
			StreamEnd = 1,
			StreamError = -2,
			DataError = -3,
			MemError = -4,
			BufError = -5,
			VersionError = -6
		}

		public enum CompressionLevel
		{
			NoCompression = 0,
			BestSpeed = 1,
			DefaultCompression = -1,
			BestCompression = 9
		}

		public enum CompressionStrategy
		{
			DefaultStrategy
		}

		public enum CompressionMethod
		{
			Deflated = 8
		}

		public sealed class ZLibStreamHandle : SafeHandle
		{
			public enum State
			{
				NotInitialized,
				InitializedForDeflate,
				InitializedForInflate,
				Disposed
			}

			private ZStream _zStream;

			private volatile State _initializationState;

			public override bool IsInvalid => base.handle == (System.IntPtr)new System.IntPtr(-1);

			public State InitializationState => _initializationState;

			public nint NextIn
			{
				get
				{
					return _zStream.nextIn;
				}
				set
				{
					_zStream.nextIn = value;
				}
			}

			public uint AvailIn
			{
				get
				{
					return _zStream.availIn;
				}
				set
				{
					_zStream.availIn = value;
				}
			}

			public nint NextOut
			{
				set
				{
					_zStream.nextOut = value;
				}
			}

			public uint AvailOut
			{
				get
				{
					return _zStream.availOut;
				}
				set
				{
					_zStream.availOut = value;
				}
			}

			public ZLibStreamHandle()
				: base((System.IntPtr)new System.IntPtr(-1), true)
			{
				_initializationState = State.NotInitialized;
				((SafeHandle)this).SetHandle(System.IntPtr.Zero);
			}

			protected override bool ReleaseHandle()
			{
				return InitializationState switch
				{
					State.NotInitialized => true, 
					State.InitializedForDeflate => DeflateEnd() == ErrorCode.Ok, 
					State.InitializedForInflate => InflateEnd() == ErrorCode.Ok, 
					State.Disposed => true, 
					_ => false, 
				};
			}

			private void EnsureNotDisposed()
			{
				ObjectDisposedException.ThrowIf(InitializationState == State.Disposed, (object)this);
			}

			private void EnsureState(State P_0)
			{
				//IL_0020: Unknown result type (might be due to invalid IL or missing references)
				if (InitializationState != P_0)
				{
					throw new InvalidOperationException("InitializationState != " + ((object)P_0).ToString());
				}
			}

			public unsafe ErrorCode DeflateInit2_(CompressionLevel P_0, int P_1, int P_2, CompressionStrategy P_3)
			{
				EnsureNotDisposed();
				EnsureState(State.NotInitialized);
				fixed (ZStream* ptr = &_zStream)
				{
					ErrorCode result = Interop.ZLib.DeflateInit2_(ptr, P_0, CompressionMethod.Deflated, P_1, P_2, P_3);
					_initializationState = State.InitializedForDeflate;
					return result;
				}
			}

			public unsafe ErrorCode Deflate(FlushCode P_0)
			{
				EnsureNotDisposed();
				EnsureState(State.InitializedForDeflate);
				fixed (ZStream* ptr = &_zStream)
				{
					return Interop.ZLib.Deflate(ptr, P_0);
				}
			}

			public unsafe ErrorCode DeflateEnd()
			{
				EnsureNotDisposed();
				EnsureState(State.InitializedForDeflate);
				fixed (ZStream* ptr = &_zStream)
				{
					ErrorCode result = Interop.ZLib.DeflateEnd(ptr);
					_initializationState = State.Disposed;
					return result;
				}
			}

			public unsafe ErrorCode InflateInit2_(int P_0)
			{
				EnsureNotDisposed();
				EnsureState(State.NotInitialized);
				fixed (ZStream* ptr = &_zStream)
				{
					ErrorCode result = Interop.ZLib.InflateInit2_(ptr, P_0);
					_initializationState = State.InitializedForInflate;
					return result;
				}
			}

			public unsafe ErrorCode Inflate(FlushCode P_0)
			{
				EnsureNotDisposed();
				EnsureState(State.InitializedForInflate);
				fixed (ZStream* ptr = &_zStream)
				{
					return Interop.ZLib.Inflate(ptr, P_0);
				}
			}

			public unsafe ErrorCode InflateEnd()
			{
				EnsureNotDisposed();
				EnsureState(State.InitializedForInflate);
				fixed (ZStream* ptr = &_zStream)
				{
					ErrorCode result = Interop.ZLib.InflateEnd(ptr);
					_initializationState = State.Disposed;
					return result;
				}
			}

			public string GetErrorMessage()
			{
				if (_zStream.msg == ZNullPtr)
				{
					return string.Empty;
				}
				return Marshal.PtrToStringUTF8((System.IntPtr)_zStream.msg);
			}
		}

		internal struct ZStream
		{
			internal nint nextIn;

			internal nint nextOut;

			internal nint msg;

			private readonly nint internalState;

			internal uint availIn;

			internal uint availOut;
		}

		internal static readonly nint ZNullPtr = System.IntPtr.Zero;

		public static ErrorCode CreateZLibStreamForDeflate(out ZLibStreamHandle P_0, CompressionLevel P_1, int P_2, int P_3, CompressionStrategy P_4)
		{
			P_0 = new ZLibStreamHandle();
			return P_0.DeflateInit2_(P_1, P_2, P_3, P_4);
		}

		public static ErrorCode CreateZLibStreamForInflate(out ZLibStreamHandle P_0, int P_1)
		{
			P_0 = new ZLibStreamHandle();
			return P_0.InflateInit2_(P_1);
		}
	}
	public enum CompressionLevel
	{
		Optimal,
		Fastest,
		NoCompression,
		SmallestSize
	}
	public enum CompressionMode
	{
		Decompress,
		Compress
	}
}

System.IO.MemoryMappedFiles.dll

Decompiled 8 months ago
using System;
using System.CodeDom.Compiler;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.InteropServices.Marshalling;
using System.Runtime.Versioning;
using System.Threading;
using FxResources.System.IO.MemoryMappedFiles;
using Microsoft.Win32.SafeHandles;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(/*Could not decode attribute arguments.*/)]
[assembly: DisableRuntimeMarshalling]
[assembly: TargetFramework(".NETCoreApp,Version=v8.0", FrameworkDisplayName = ".NET 8.0")]
[assembly: AssemblyMetadata("Serviceable", "True")]
[assembly: AssemblyMetadata("PreferInbox", "True")]
[assembly: AssemblyDefaultAlias("System.IO.MemoryMappedFiles")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: CLSCompliant(true)]
[assembly: AssemblyMetadata("IsTrimmable", "True")]
[assembly: DefaultDllImportSearchPaths(/*Could not decode attribute arguments.*/)]
[assembly: AssemblyCompany("Microsoft Corporation")]
[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")]
[assembly: AssemblyDescription("System.IO.MemoryMappedFiles")]
[assembly: AssemblyFileVersion("8.0.324.11423")]
[assembly: AssemblyInformationalVersion("8.0.3+9f4b1f5d664afdfc80e1508ab7ed099dff210fbd")]
[assembly: AssemblyProduct("Microsoft® .NET")]
[assembly: AssemblyTitle("System.IO.MemoryMappedFiles")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/dotnet/runtime")]
[assembly: SupportedOSPlatform("Windows")]
[assembly: AssemblyVersion("8.0.0.0")]
[module: RefSafetyRules(11)]
[module: NullablePublicOnly(false)]
[module: SkipLocalsInit]
internal static class Interop
{
	internal static class Kernel32
	{
		internal struct SECURITY_ATTRIBUTES
		{
			internal uint nLength;

			internal unsafe void* lpSecurityDescriptor;

			internal BOOL bInheritHandle;
		}

		internal struct SYSTEM_INFO
		{
			internal ushort wProcessorArchitecture;

			internal ushort wReserved;

			internal int dwPageSize;

			internal nint lpMinimumApplicationAddress;

			internal nint lpMaximumApplicationAddress;

			internal nint dwActiveProcessorMask;

			internal int dwNumberOfProcessors;

			internal int dwProcessorType;

			internal int dwAllocationGranularity;

			internal short wProcessorLevel;

			internal short wProcessorRevision;
		}

		internal struct MEMORY_BASIC_INFORMATION
		{
			internal unsafe void* BaseAddress;

			internal unsafe void* AllocationBase;

			internal uint AllocationProtect;

			internal nuint RegionSize;

			internal uint State;

			internal uint Protect;

			internal uint Type;
		}

		internal struct MEMORYSTATUSEX
		{
			internal uint dwLength;

			internal uint dwMemoryLoad;

			internal ulong ullTotalPhys;

			internal ulong ullAvailPhys;

			internal ulong ullTotalPageFile;

			internal ulong ullAvailPageFile;

			internal ulong ullTotalVirtual;

			internal ulong ullAvailVirtual;

			internal ulong ullAvailExtendedVirtual;
		}

		[LibraryImport(/*Could not decode attribute arguments.*/)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		internal unsafe static SafeMemoryMappedFileHandle CreateFileMapping(SafeFileHandle P_0, ref SECURITY_ATTRIBUTES P_1, int P_2, int P_3, int P_4, string P_5)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			bool flag = false;
			nint num = 0;
			SafeMemoryMappedFileHandle result = null;
			nint num2 = 0;
			System.Runtime.CompilerServices.Unsafe.SkipInit(out ManagedToUnmanagedOut<SafeMemoryMappedFileHandle> val);
			val..ctor();
			ManagedToUnmanagedIn<SafeFileHandle> val2 = default(ManagedToUnmanagedIn<SafeFileHandle>);
			int lastSystemError;
			try
			{
				val2.FromManaged(P_0);
				fixed (char* ptr = Utf16StringMarshaller.GetPinnableReference(P_5))
				{
					void* ptr2 = ptr;
					fixed (SECURITY_ATTRIBUTES* ptr3 = &P_1)
					{
						num = val2.ToUnmanaged();
						Marshal.SetLastSystemError(0);
						num2 = __PInvoke(num, ptr3, P_2, P_3, P_4, (ushort*)ptr2);
						lastSystemError = Marshal.GetLastSystemError();
					}
				}
				flag = true;
				val.FromUnmanaged((System.IntPtr)num2);
				result = val.ToManaged();
			}
			finally
			{
				if (flag)
				{
					val.Free();
				}
				val2.Free();
			}
			Marshal.SetLastPInvokeError(lastSystemError);
			return result;
			[DllImport("kernel32.dll", EntryPoint = "CreateFileMappingW", ExactSpelling = true)]
			[CompilerGenerated]
			static extern unsafe nint __PInvoke(nint, SECURITY_ATTRIBUTES*, int, int, int, ushort*);
		}

		[LibraryImport(/*Could not decode attribute arguments.*/)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		internal unsafe static SafeMemoryMappedFileHandle CreateFileMapping(nint P_0, ref SECURITY_ATTRIBUTES P_1, int P_2, int P_3, int P_4, string P_5)
		{
			bool flag = false;
			SafeMemoryMappedFileHandle result = null;
			nint num = 0;
			System.Runtime.CompilerServices.Unsafe.SkipInit(out ManagedToUnmanagedOut<SafeMemoryMappedFileHandle> val);
			val..ctor();
			int lastSystemError;
			try
			{
				fixed (char* ptr = Utf16StringMarshaller.GetPinnableReference(P_5))
				{
					void* ptr2 = ptr;
					fixed (SECURITY_ATTRIBUTES* ptr3 = &P_1)
					{
						Marshal.SetLastSystemError(0);
						num = __PInvoke(P_0, ptr3, P_2, P_3, P_4, (ushort*)ptr2);
						lastSystemError = Marshal.GetLastSystemError();
					}
				}
				flag = true;
				val.FromUnmanaged((System.IntPtr)num);
				result = val.ToManaged();
			}
			finally
			{
				if (flag)
				{
					val.Free();
				}
			}
			Marshal.SetLastPInvokeError(lastSystemError);
			return result;
			[DllImport("kernel32.dll", EntryPoint = "CreateFileMappingW", ExactSpelling = true)]
			[CompilerGenerated]
			static extern unsafe nint __PInvoke(nint, SECURITY_ATTRIBUTES*, int, int, int, ushort*);
		}

		[LibraryImport(/*Could not decode attribute arguments.*/)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		internal static SafeMemoryMappedViewHandle MapViewOfFile(SafeMemoryMappedFileHandle P_0, int P_1, int P_2, int P_3, nuint P_4)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			bool flag = false;
			nint num = 0;
			SafeMemoryMappedViewHandle result = null;
			nint num2 = 0;
			System.Runtime.CompilerServices.Unsafe.SkipInit(out ManagedToUnmanagedOut<SafeMemoryMappedViewHandle> val);
			val..ctor();
			ManagedToUnmanagedIn<SafeMemoryMappedFileHandle> val2 = default(ManagedToUnmanagedIn<SafeMemoryMappedFileHandle>);
			int lastSystemError;
			try
			{
				val2.FromManaged(P_0);
				num = val2.ToUnmanaged();
				Marshal.SetLastSystemError(0);
				num2 = __PInvoke(num, P_1, P_2, P_3, P_4);
				lastSystemError = Marshal.GetLastSystemError();
				flag = true;
				val.FromUnmanaged((System.IntPtr)num2);
				result = val.ToManaged();
			}
			finally
			{
				if (flag)
				{
					val.Free();
				}
				val2.Free();
			}
			Marshal.SetLastPInvokeError(lastSystemError);
			return result;
			[DllImport("kernel32.dll", EntryPoint = "MapViewOfFile", ExactSpelling = true)]
			[CompilerGenerated]
			static extern nint __PInvoke(nint, int, int, int, nuint);
		}

		[LibraryImport("kernel32.dll", SetLastError = true)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		internal static nint VirtualAlloc(SafeHandle P_0, nuint P_1, int P_2, int P_3)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			nint num = 0;
			nint result = 0;
			ManagedToUnmanagedIn<SafeHandle> val = default(ManagedToUnmanagedIn<SafeHandle>);
			int lastSystemError;
			try
			{
				val.FromManaged(P_0);
				num = val.ToUnmanaged();
				Marshal.SetLastSystemError(0);
				result = __PInvoke(num, P_1, P_2, P_3);
				lastSystemError = Marshal.GetLastSystemError();
			}
			finally
			{
				val.Free();
			}
			Marshal.SetLastPInvokeError(lastSystemError);
			return result;
			[DllImport("kernel32.dll", EntryPoint = "VirtualAlloc", ExactSpelling = true)]
			[CompilerGenerated]
			static extern nint __PInvoke(nint, nuint, int, int);
		}

		[DllImport("kernel32.dll", ExactSpelling = true)]
		[LibraryImport("kernel32.dll")]
		internal unsafe static extern BOOL GlobalMemoryStatusEx(MEMORYSTATUSEX* P_0);

		[LibraryImport("kernel32.dll", SetLastError = true)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		[return: MarshalAs(2)]
		internal static bool CloseHandle(nint P_0)
		{
			Marshal.SetLastSystemError(0);
			int num = __PInvoke(P_0);
			int lastSystemError = Marshal.GetLastSystemError();
			bool result = num != 0;
			Marshal.SetLastPInvokeError(lastSystemError);
			return result;
			[DllImport("kernel32.dll", EntryPoint = "CloseHandle", ExactSpelling = true)]
			[CompilerGenerated]
			static extern int __PInvoke(nint);
		}

		[LibraryImport("kernel32.dll", SetLastError = true)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		[return: MarshalAs(2)]
		internal static bool FlushViewOfFile(nint P_0, nuint P_1)
		{
			Marshal.SetLastSystemError(0);
			int num = __PInvoke(P_0, P_1);
			int lastSystemError = Marshal.GetLastSystemError();
			bool result = num != 0;
			Marshal.SetLastPInvokeError(lastSystemError);
			return result;
			[DllImport("kernel32.dll", EntryPoint = "FlushViewOfFile", ExactSpelling = true)]
			[CompilerGenerated]
			static extern int __PInvoke(nint, nuint);
		}

		[DllImport("kernel32.dll", ExactSpelling = true)]
		[LibraryImport("kernel32.dll")]
		internal unsafe static extern void GetSystemInfo(SYSTEM_INFO* P_0);

		[LibraryImport("kernel32.dll", SetLastError = true)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		[return: MarshalAs(2)]
		internal static bool UnmapViewOfFile(nint P_0)
		{
			Marshal.SetLastSystemError(0);
			int num = __PInvoke(P_0);
			int lastSystemError = Marshal.GetLastSystemError();
			bool result = num != 0;
			Marshal.SetLastPInvokeError(lastSystemError);
			return result;
			[DllImport("kernel32.dll", EntryPoint = "UnmapViewOfFile", ExactSpelling = true)]
			[CompilerGenerated]
			static extern int __PInvoke(nint);
		}

		[LibraryImport("kernel32.dll", SetLastError = true)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		internal unsafe static nuint VirtualQuery(SafeHandle P_0, ref MEMORY_BASIC_INFORMATION P_1, nuint P_2)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			nint num = 0;
			nuint result = 0u;
			ManagedToUnmanagedIn<SafeHandle> val = default(ManagedToUnmanagedIn<SafeHandle>);
			int lastSystemError;
			try
			{
				val.FromManaged(P_0);
				fixed (MEMORY_BASIC_INFORMATION* ptr = &P_1)
				{
					num = val.ToUnmanaged();
					Marshal.SetLastSystemError(0);
					result = __PInvoke(num, ptr, P_2);
					lastSystemError = Marshal.GetLastSystemError();
				}
			}
			finally
			{
				val.Free();
			}
			Marshal.SetLastPInvokeError(lastSystemError);
			return result;
			[DllImport("kernel32.dll", EntryPoint = "VirtualQuery", ExactSpelling = true)]
			[CompilerGenerated]
			static extern unsafe nuint __PInvoke(nint, MEMORY_BASIC_INFORMATION*, nuint);
		}
	}

	internal enum BOOL
	{
		FALSE,
		TRUE
	}

	public unsafe static void CheckForAvailableVirtualMemory(ulong P_0)
	{
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		Kernel32.MEMORYSTATUSEX mEMORYSTATUSEX = default(Kernel32.MEMORYSTATUSEX);
		mEMORYSTATUSEX.dwLength = (uint)sizeof(Kernel32.MEMORYSTATUSEX);
		if (Kernel32.GlobalMemoryStatusEx(&mEMORYSTATUSEX) != 0)
		{
			ulong ullTotalVirtual = mEMORYSTATUSEX.ullTotalVirtual;
			if (P_0 >= ullTotalVirtual)
			{
				throw new IOException(System.SR.IO_NotEnoughMemory);
			}
		}
	}

	public static SafeMemoryMappedFileHandle CreateFileMapping(SafeFileHandle P_0, ref Kernel32.SECURITY_ATTRIBUTES P_1, int P_2, long P_3, string P_4)
	{
		SplitLong(P_3, out var num, out var num2);
		return Kernel32.CreateFileMapping(P_0, ref P_1, P_2, num, num2, P_4);
	}

	public static SafeMemoryMappedFileHandle CreateFileMapping(nint P_0, ref Kernel32.SECURITY_ATTRIBUTES P_1, int P_2, long P_3, string P_4)
	{
		SplitLong(P_3, out var num, out var num2);
		return Kernel32.CreateFileMapping(P_0, ref P_1, P_2, num, num2, P_4);
	}

	public static SafeMemoryMappedViewHandle MapViewOfFile(SafeMemoryMappedFileHandle P_0, int P_1, long P_2, nuint P_3)
	{
		SplitLong(P_2, out var num, out var num2);
		return Kernel32.MapViewOfFile(P_0, P_1, num, num2, P_3);
	}

	public static nint VirtualAlloc(SafeHandle P_0, nuint P_1, int P_2, int P_3)
	{
		return Kernel32.VirtualAlloc(P_0, P_1, P_2, P_3);
	}

	[MethodImpl(256)]
	private static void SplitLong(long P_0, out int P_1, out int P_2)
	{
		P_1 = (int)(P_0 >> 32);
		P_2 = (int)(P_0 & 0xFFFFFFFFu);
	}
}
namespace FxResources.System.IO.MemoryMappedFiles
{
	internal static class SR
	{
	}
}
namespace System
{
	internal static class SR
	{
		private static readonly bool s_usingResourceKeys;

		private static ResourceManager s_resourceManager;

		internal static ResourceManager ResourceManager
		{
			get
			{
				//IL_0013: Unknown result type (might be due to invalid IL or missing references)
				//IL_0018: Unknown result type (might be due to invalid IL or missing references)
				//IL_001e: Expected O, but got Unknown
				object obj = s_resourceManager;
				if (obj == null)
				{
					ResourceManager val = new ResourceManager(typeof(FxResources.System.IO.MemoryMappedFiles.SR));
					s_resourceManager = val;
					obj = (object)val;
				}
				return (ResourceManager)obj;
			}
		}

		internal static string IO_FileNotFound => GetResourceString("IO_FileNotFound");

		internal static string IO_FileNotFound_FileName => GetResourceString("IO_FileNotFound_FileName");

		internal static string IO_AlreadyExists_Name => GetResourceString("IO_AlreadyExists_Name");

		internal static string IO_FileExists_Name => GetResourceString("IO_FileExists_Name");

		internal static string IO_SharingViolation_File => GetResourceString("IO_SharingViolation_File");

		internal static string IO_SharingViolation_NoFileName => GetResourceString("IO_SharingViolation_NoFileName");

		internal static string IO_PathNotFound_Path => GetResourceString("IO_PathNotFound_Path");

		internal static string IO_PathNotFound_NoPathName => GetResourceString("IO_PathNotFound_NoPathName");

		internal static string IO_PathTooLong => GetResourceString("IO_PathTooLong");

		internal static string UnauthorizedAccess_IODenied_Path => GetResourceString("UnauthorizedAccess_IODenied_Path");

		internal static string UnauthorizedAccess_IODenied_NoPathName => GetResourceString("UnauthorizedAccess_IODenied_NoPathName");

		internal static string Argument_MapNameEmptyString => GetResourceString("Argument_MapNameEmptyString");

		internal static string Argument_EmptyFile => GetResourceString("Argument_EmptyFile");

		internal static string Argument_NewMMFWriteAccessNotAllowed => GetResourceString("Argument_NewMMFWriteAccessNotAllowed");

		internal static string Argument_ReadAccessWithLargeCapacity => GetResourceString("Argument_ReadAccessWithLargeCapacity");

		internal static string ArgumentOutOfRange_CapacityLargerThanLogicalAddressSpaceNotAllowed => GetResourceString("ArgumentOutOfRange_CapacityLargerThanLogicalAddressSpaceNotAllowed");

		internal static string ArgumentOutOfRange_PositiveOrDefaultCapacityRequired => GetResourceString("ArgumentOutOfRange_PositiveOrDefaultCapacityRequired");

		internal static string ArgumentOutOfRange_PositiveOrDefaultSizeRequired => GetResourceString("ArgumentOutOfRange_PositiveOrDefaultSizeRequired");

		internal static string ArgumentOutOfRange_CapacityGEFileSizeRequired => GetResourceString("ArgumentOutOfRange_CapacityGEFileSizeRequired");

		internal static string IO_NotEnoughMemory => GetResourceString("IO_NotEnoughMemory");

		internal static string ObjectDisposed_ViewAccessorClosed => GetResourceString("ObjectDisposed_ViewAccessorClosed");

		internal static string IO_PathTooLong_Path => GetResourceString("IO_PathTooLong_Path");

		internal static bool UsingResourceKeys()
		{
			return s_usingResourceKeys;
		}

		private static string GetResourceString(string P_0)
		{
			if (UsingResourceKeys())
			{
				return P_0;
			}
			string result = null;
			try
			{
				result = ResourceManager.GetString(P_0);
			}
			catch (MissingManifestResourceException)
			{
			}
			return result;
		}

		internal static string Format(string P_0, object P_1)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", new object[2] { P_0, P_1 });
			}
			return string.Format(P_0, P_1);
		}

		static SR()
		{
			System.Runtime.CompilerServices.Unsafe.SkipInit(out bool flag);
			s_usingResourceKeys = AppContext.TryGetSwitch("System.Resources.UseSystemResourceKeys", ref flag) && flag;
		}
	}
}
namespace System.IO
{
	internal static class Win32Marshal
	{
		internal static System.Exception GetExceptionForLastWin32Error(string P_0 = "")
		{
			return GetExceptionForWin32Error(Marshal.GetLastPInvokeError(), P_0);
		}

		internal static System.Exception GetExceptionForWin32Error(int P_0, string P_1 = "")
		{
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Expected O, but got Unknown
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Expected O, but got Unknown
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Expected O, but got Unknown
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Expected O, but got Unknown
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Expected O, but got Unknown
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Expected O, but got Unknown
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Expected O, but got Unknown
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Expected O, but got Unknown
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Expected O, but got Unknown
			switch (P_0)
			{
			case 2:
				return (System.Exception)new FileNotFoundException(string.IsNullOrEmpty(P_1) ? SR.IO_FileNotFound : SR.Format(SR.IO_FileNotFound_FileName, P_1), P_1);
			case 3:
				return (System.Exception)new DirectoryNotFoundException(string.IsNullOrEmpty(P_1) ? SR.IO_PathNotFound_NoPathName : SR.Format(SR.IO_PathNotFound_Path, P_1));
			case 5:
				return (System.Exception)new UnauthorizedAccessException(string.IsNullOrEmpty(P_1) ? SR.UnauthorizedAccess_IODenied_NoPathName : SR.Format(SR.UnauthorizedAccess_IODenied_Path, P_1));
			case 183:
				if (!string.IsNullOrEmpty(P_1))
				{
					return (System.Exception)new IOException(SR.Format(SR.IO_AlreadyExists_Name, P_1), MakeHRFromErrorCode(P_0));
				}
				break;
			case 206:
				return (System.Exception)new PathTooLongException(string.IsNullOrEmpty(P_1) ? SR.IO_PathTooLong : SR.Format(SR.IO_PathTooLong_Path, P_1));
			case 32:
				return (System.Exception)new IOException(string.IsNullOrEmpty(P_1) ? SR.IO_SharingViolation_NoFileName : SR.Format(SR.IO_SharingViolation_File, P_1), MakeHRFromErrorCode(P_0));
			case 80:
				if (!string.IsNullOrEmpty(P_1))
				{
					return (System.Exception)new IOException(SR.Format(SR.IO_FileExists_Name, P_1), MakeHRFromErrorCode(P_0));
				}
				break;
			case 995:
				return (System.Exception)new OperationCanceledException();
			}
			string text = (string.IsNullOrEmpty(P_1) ? GetPInvokeErrorMessage(P_0) : (GetPInvokeErrorMessage(P_0) + " : '" + P_1 + "'"));
			return (System.Exception)new IOException(text, MakeHRFromErrorCode(P_0));
			[CompilerGenerated]
			static string GetPInvokeErrorMessage(int)
			{
				return Marshal.GetPInvokeErrorMessage(P_0);
			}
		}

		internal static int MakeHRFromErrorCode(int P_0)
		{
			if ((0xFFFF0000u & P_0) != 0L)
			{
				return P_0;
			}
			return -2147024896 | P_0;
		}
	}
}
namespace System.IO.MemoryMappedFiles
{
	[Flags]
	public enum MemoryMappedFileOptions
	{
		None = 0,
		DelayAllocatePages = 0x4000000
	}
	public enum MemoryMappedFileAccess
	{
		ReadWrite,
		Read,
		Write,
		CopyOnWrite,
		ReadExecute,
		ReadWriteExecute
	}
	public class MemoryMappedFile : System.IDisposable
	{
		private readonly SafeMemoryMappedFileHandle _handle;

		private readonly bool _leaveOpen;

		private readonly SafeFileHandle _fileHandle;

		private MemoryMappedFile(SafeMemoryMappedFileHandle P_0, SafeFileHandle P_1, bool P_2)
		{
			_handle = P_0;
			_fileHandle = P_1;
			_leaveOpen = P_2;
		}

		public static MemoryMappedFile CreateFromFile(FileStream P_0, string? P_1, long P_2, MemoryMappedFileAccess P_3, HandleInheritability P_4, bool P_5)
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Invalid comparison between Unknown and I4
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			ArgumentNullException.ThrowIfNull((object)P_0, "fileStream");
			ValidateCreateFile(P_1, P_2, P_3);
			long length = ((Stream)P_0).Length;
			if (P_2 == 0L && length == 0L)
			{
				throw new ArgumentException(SR.Argument_EmptyFile);
			}
			if ((int)P_4 < 0 || (int)P_4 > 1)
			{
				throw new ArgumentOutOfRangeException("inheritability");
			}
			((Stream)P_0).Flush();
			if (P_2 == 0L)
			{
				P_2 = length;
			}
			SafeFileHandle safeFileHandle = P_0.SafeFileHandle;
			SafeMemoryMappedFileHandle safeMemoryMappedFileHandle = CreateCore(safeFileHandle, P_1, P_4, P_3, MemoryMappedFileOptions.None, P_2, length);
			return new MemoryMappedFile(safeMemoryMappedFileHandle, safeFileHandle, P_5);
		}

		public MemoryMappedViewAccessor CreateViewAccessor(long P_0, long P_1, MemoryMappedFileAccess P_2)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			ArgumentOutOfRangeException.ThrowIfNegative<long>(P_0, "offset");
			if (P_1 < 0)
			{
				throw new ArgumentOutOfRangeException("size", SR.ArgumentOutOfRange_PositiveOrDefaultSizeRequired);
			}
			if (P_2 < MemoryMappedFileAccess.ReadWrite || P_2 > MemoryMappedFileAccess.ReadWriteExecute)
			{
				throw new ArgumentOutOfRangeException("access");
			}
			_ = 4;
			if (P_1 > 4294967295u)
			{
				throw new ArgumentOutOfRangeException("size", SR.ArgumentOutOfRange_CapacityLargerThanLogicalAddressSpaceNotAllowed);
			}
			MemoryMappedView memoryMappedView = MemoryMappedView.CreateView(_handle, P_2, P_0, P_1);
			return new MemoryMappedViewAccessor(memoryMappedView);
		}

		public void Dispose()
		{
			Dispose(true);
			GC.SuppressFinalize((object)this);
		}

		protected virtual void Dispose(bool P_0)
		{
			try
			{
				if (!((SafeHandle)_handle).IsClosed)
				{
					((SafeHandle)_handle).Dispose();
				}
			}
			finally
			{
				if (!_leaveOpen)
				{
					SafeFileHandle fileHandle = _fileHandle;
					if (fileHandle != null)
					{
						((SafeHandle)fileHandle).Dispose();
					}
				}
			}
		}

		internal static FileAccess GetFileAccess(MemoryMappedFileAccess P_0)
		{
			switch (P_0)
			{
			case MemoryMappedFileAccess.Read:
			case MemoryMappedFileAccess.ReadExecute:
				return (FileAccess)1;
			case MemoryMappedFileAccess.ReadWrite:
			case MemoryMappedFileAccess.CopyOnWrite:
			case MemoryMappedFileAccess.ReadWriteExecute:
				return (FileAccess)3;
			default:
				return (FileAccess)2;
			}
		}

		private static void ValidateCreateFile(string P_0, long P_1, MemoryMappedFileAccess P_2)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			if (P_0 != null && P_0.Length == 0)
			{
				throw new ArgumentException(SR.Argument_MapNameEmptyString);
			}
			if (P_1 < 0)
			{
				throw new ArgumentOutOfRangeException("capacity", SR.ArgumentOutOfRange_PositiveOrDefaultCapacityRequired);
			}
			switch (P_2)
			{
			default:
				throw new ArgumentOutOfRangeException("access");
			case MemoryMappedFileAccess.Write:
				throw new ArgumentException(SR.Argument_NewMMFWriteAccessNotAllowed, "access");
			case MemoryMappedFileAccess.ReadWrite:
			case MemoryMappedFileAccess.Read:
			case MemoryMappedFileAccess.CopyOnWrite:
			case MemoryMappedFileAccess.ReadExecute:
			case MemoryMappedFileAccess.ReadWriteExecute:
				break;
			}
		}

		private static void VerifyMemoryMappedFileAccess(MemoryMappedFileAccess P_0, long P_1, long P_2)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			if (P_0 == MemoryMappedFileAccess.Read && P_1 > P_2)
			{
				throw new ArgumentException(SR.Argument_ReadAccessWithLargeCapacity);
			}
			if (P_2 > P_1)
			{
				throw new ArgumentOutOfRangeException("capacity", SR.ArgumentOutOfRange_CapacityGEFileSizeRequired);
			}
		}

		private static SafeMemoryMappedFileHandle CreateCore(SafeFileHandle P_0, string P_1, HandleInheritability P_2, MemoryMappedFileAccess P_3, MemoryMappedFileOptions P_4, long P_5, long P_6)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			Interop.Kernel32.SECURITY_ATTRIBUTES secAttrs = GetSecAttrs(P_2);
			if (P_0 != null)
			{
				VerifyMemoryMappedFileAccess(P_3, P_5, P_6);
			}
			SafeMemoryMappedFileHandle safeMemoryMappedFileHandle = ((P_0 != null) ? Interop.CreateFileMapping(P_0, ref secAttrs, GetPageAccess(P_3) | (int)P_4, P_5, P_1) : Interop.CreateFileMapping(new System.IntPtr(-1), ref secAttrs, GetPageAccess(P_3) | (int)P_4, P_5, P_1));
			int lastPInvokeError = Marshal.GetLastPInvokeError();
			if (!((SafeHandle)safeMemoryMappedFileHandle).IsInvalid)
			{
				if (lastPInvokeError == 183)
				{
					((SafeHandle)safeMemoryMappedFileHandle).Dispose();
					throw Win32Marshal.GetExceptionForWin32Error(lastPInvokeError);
				}
				return safeMemoryMappedFileHandle;
			}
			((SafeHandle)safeMemoryMappedFileHandle).Dispose();
			throw Win32Marshal.GetExceptionForWin32Error(lastPInvokeError);
		}

		internal static int GetFileMapAccess(MemoryMappedFileAccess P_0)
		{
			return P_0 switch
			{
				MemoryMappedFileAccess.Read => 4, 
				MemoryMappedFileAccess.Write => 2, 
				MemoryMappedFileAccess.ReadWrite => 6, 
				MemoryMappedFileAccess.CopyOnWrite => 1, 
				MemoryMappedFileAccess.ReadExecute => 36, 
				_ => 38, 
			};
		}

		internal static int GetPageAccess(MemoryMappedFileAccess P_0)
		{
			return P_0 switch
			{
				MemoryMappedFileAccess.Read => 2, 
				MemoryMappedFileAccess.ReadWrite => 4, 
				MemoryMappedFileAccess.CopyOnWrite => 8, 
				MemoryMappedFileAccess.ReadExecute => 32, 
				_ => 64, 
			};
		}

		private unsafe static Interop.Kernel32.SECURITY_ATTRIBUTES GetSecAttrs(HandleInheritability P_0)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			Interop.Kernel32.SECURITY_ATTRIBUTES result = default(Interop.Kernel32.SECURITY_ATTRIBUTES);
			if ((P_0 & 1) != 0)
			{
				result = default(Interop.Kernel32.SECURITY_ATTRIBUTES);
				result.nLength = (uint)sizeof(Interop.Kernel32.SECURITY_ATTRIBUTES);
				result.bInheritHandle = Interop.BOOL.TRUE;
			}
			return result;
		}
	}
	internal sealed class MemoryMappedView : System.IDisposable
	{
		private readonly SafeMemoryMappedViewHandle _viewHandle;

		private readonly long _pointerOffset;

		private readonly long _size;

		private readonly MemoryMappedFileAccess _access;

		public SafeMemoryMappedViewHandle ViewHandle => _viewHandle;

		public long PointerOffset => _pointerOffset;

		public long Size => _size;

		public MemoryMappedFileAccess Access => _access;

		public bool IsClosed => ((SafeHandle)_viewHandle).IsClosed;

		private MemoryMappedView(SafeMemoryMappedViewHandle P_0, long P_1, long P_2, MemoryMappedFileAccess P_3)
		{
			_viewHandle = P_0;
			_pointerOffset = P_1;
			_size = P_2;
			_access = P_3;
		}

		public void Dispose()
		{
			if (!((SafeHandle)_viewHandle).IsClosed)
			{
				((SafeHandle)_viewHandle).Dispose();
			}
			GC.SuppressFinalize((object)this);
		}

		private static void ValidateSizeAndOffset(long P_0, long P_1, long P_2, out ulong P_3, out long P_4, out long P_5)
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			P_4 = P_1 % P_2;
			P_5 = P_1 - P_4;
			P_3 = (ulong)((P_0 != 0L) ? (P_0 + P_4) : 0);
			_ = 4;
			if (P_3 > 4294967295u)
			{
				throw new ArgumentOutOfRangeException("size", SR.ArgumentOutOfRange_CapacityLargerThanLogicalAddressSpaceNotAllowed);
			}
		}

		public static MemoryMappedView CreateView(SafeMemoryMappedFileHandle P_0, MemoryMappedFileAccess P_1, long P_2, long P_3)
		{
			ValidateSizeAndOffset(P_3, P_2, GetSystemPageAllocationGranularity(), out var num, out var num2, out var num3);
			Interop.CheckForAvailableVirtualMemory(num);
			SafeMemoryMappedViewHandle safeMemoryMappedViewHandle = Interop.MapViewOfFile(P_0, MemoryMappedFile.GetFileMapAccess(P_1), num3, new System.UIntPtr(num));
			if (((SafeHandle)safeMemoryMappedViewHandle).IsInvalid)
			{
				((SafeHandle)safeMemoryMappedViewHandle).Dispose();
				throw Win32Marshal.GetExceptionForLastWin32Error();
			}
			Interop.Kernel32.MEMORY_BASIC_INFORMATION mEMORY_BASIC_INFORMATION = default(Interop.Kernel32.MEMORY_BASIC_INFORMATION);
			Interop.Kernel32.VirtualQuery((SafeHandle)(object)safeMemoryMappedViewHandle, ref mEMORY_BASIC_INFORMATION, (nuint)Marshal.SizeOf<Interop.Kernel32.MEMORY_BASIC_INFORMATION>(mEMORY_BASIC_INFORMATION));
			ulong num4 = mEMORY_BASIC_INFORMATION.RegionSize;
			if ((mEMORY_BASIC_INFORMATION.State & 0x2000u) != 0 || num4 < num)
			{
				Interop.VirtualAlloc((SafeHandle)(object)safeMemoryMappedViewHandle, (nuint)((num != 0L) ? num : num4), 4096, MemoryMappedFile.GetPageAccess(P_1));
				int lastPInvokeError = Marshal.GetLastPInvokeError();
				if (((SafeHandle)safeMemoryMappedViewHandle).IsInvalid)
				{
					((SafeHandle)safeMemoryMappedViewHandle).Dispose();
					throw Win32Marshal.GetExceptionForWin32Error(lastPInvokeError);
				}
				mEMORY_BASIC_INFORMATION = default(Interop.Kernel32.MEMORY_BASIC_INFORMATION);
				Interop.Kernel32.VirtualQuery((SafeHandle)(object)safeMemoryMappedViewHandle, ref mEMORY_BASIC_INFORMATION, (nuint)Marshal.SizeOf<Interop.Kernel32.MEMORY_BASIC_INFORMATION>(mEMORY_BASIC_INFORMATION));
				num4 = mEMORY_BASIC_INFORMATION.RegionSize;
			}
			if (P_3 == 0L)
			{
				P_3 = (long)num4 - num2;
			}
			((SafeBuffer)safeMemoryMappedViewHandle).Initialize((ulong)(P_3 + num2));
			return new MemoryMappedView(safeMemoryMappedViewHandle, num2, P_3, P_1);
		}

		public unsafe void Flush(nuint P_0)
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			byte* ptr = null;
			try
			{
				((SafeBuffer)_viewHandle).AcquirePointer(ref ptr);
				if (Interop.Kernel32.FlushViewOfFile((nint)ptr, P_0))
				{
					return;
				}
				int lastPInvokeError = Marshal.GetLastPInvokeError();
				if (lastPInvokeError != 33)
				{
					throw Win32Marshal.GetExceptionForWin32Error(lastPInvokeError);
				}
				SpinWait val = default(SpinWait);
				for (int i = 0; i < 15; i++)
				{
					int num = 1 << i;
					Thread.Sleep(num);
					for (int j = 0; j < 20; j++)
					{
						if (Interop.Kernel32.FlushViewOfFile((nint)ptr, P_0))
						{
							return;
						}
						lastPInvokeError = Marshal.GetLastPInvokeError();
						if (lastPInvokeError != 33)
						{
							throw Win32Marshal.GetExceptionForWin32Error(lastPInvokeError);
						}
						((SpinWait)(ref val)).SpinOnce();
					}
				}
				throw Win32Marshal.GetExceptionForWin32Error(lastPInvokeError);
			}
			finally
			{
				if (ptr != null)
				{
					((SafeBuffer)_viewHandle).ReleasePointer();
				}
			}
		}

		private unsafe static int GetSystemPageAllocationGranularity()
		{
			System.Runtime.CompilerServices.Unsafe.SkipInit(out Interop.Kernel32.SYSTEM_INFO sYSTEM_INFO);
			Interop.Kernel32.GetSystemInfo(&sYSTEM_INFO);
			return sYSTEM_INFO.dwAllocationGranularity;
		}
	}
	public sealed class MemoryMappedViewAccessor : UnmanagedMemoryAccessor
	{
		private readonly MemoryMappedView _view;

		public SafeMemoryMappedViewHandle SafeMemoryMappedViewHandle => _view.ViewHandle;

		public long PointerOffset => _view.PointerOffset;

		internal MemoryMappedViewAccessor(MemoryMappedView P_0)
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			_view = P_0;
			((UnmanagedMemoryAccessor)this).Initialize((SafeBuffer)(object)_view.ViewHandle, _view.PointerOffset, _view.Size, MemoryMappedFile.GetFileAccess(_view.Access));
		}

		protected override void Dispose(bool P_0)
		{
			try
			{
				if (P_0 && !_view.IsClosed && ((UnmanagedMemoryAccessor)this).CanWrite)
				{
					Flush();
				}
			}
			finally
			{
				try
				{
					_view.Dispose();
				}
				finally
				{
					((UnmanagedMemoryAccessor)this).Dispose(P_0);
				}
			}
		}

		public void Flush()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			if (!((UnmanagedMemoryAccessor)this).IsOpen)
			{
				throw new ObjectDisposedException("MemoryMappedViewAccessor", SR.ObjectDisposed_ViewAccessorClosed);
			}
			_view.Flush((nuint)((UnmanagedMemoryAccessor)this).Capacity);
		}
	}
}
namespace Microsoft.Win32.SafeHandles
{
	public sealed class SafeMemoryMappedFileHandle : SafeHandleZeroOrMinusOneIsInvalid
	{
		public override bool IsInvalid => ((SafeHandleZeroOrMinusOneIsInvalid)this).IsInvalid;

		public SafeMemoryMappedFileHandle()
			: base(true)
		{
		}

		protected override bool ReleaseHandle()
		{
			return Interop.Kernel32.CloseHandle(((SafeHandle)this).handle);
		}
	}
	public sealed class SafeMemoryMappedViewHandle : SafeBuffer
	{
		public SafeMemoryMappedViewHandle()
			: base(true)
		{
		}

		protected override bool ReleaseHandle()
		{
			nint handle = ((SafeHandle)this).handle;
			((SafeHandle)this).handle = System.IntPtr.Zero;
			return Interop.Kernel32.UnmapViewOfFile(handle);
		}
	}
}

System.IO.Pipes.dll

Decompiled 8 months ago
using System;
using System.Buffers;
using System.CodeDom.Compiler;
using System.Diagnostics;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.ExceptionServices;
using System.Runtime.InteropServices;
using System.Runtime.InteropServices.Marshalling;
using System.Runtime.Versioning;
using System.Threading;
using System.Threading.Tasks;
using System.Threading.Tasks.Sources;
using FxResources.System.IO.Pipes;
using Microsoft.Win32.SafeHandles;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(/*Could not decode attribute arguments.*/)]
[assembly: DisableRuntimeMarshalling]
[assembly: TargetFramework(".NETCoreApp,Version=v8.0", FrameworkDisplayName = ".NET 8.0")]
[assembly: AssemblyMetadata("Serviceable", "True")]
[assembly: AssemblyMetadata("PreferInbox", "True")]
[assembly: AssemblyDefaultAlias("System.IO.Pipes")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: CLSCompliant(true)]
[assembly: AssemblyMetadata("IsTrimmable", "True")]
[assembly: DefaultDllImportSearchPaths(/*Could not decode attribute arguments.*/)]
[assembly: AssemblyCompany("Microsoft Corporation")]
[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")]
[assembly: AssemblyDescription("System.IO.Pipes")]
[assembly: AssemblyFileVersion("8.0.324.11423")]
[assembly: AssemblyInformationalVersion("8.0.3+9f4b1f5d664afdfc80e1508ab7ed099dff210fbd")]
[assembly: AssemblyProduct("Microsoft® .NET")]
[assembly: AssemblyTitle("System.IO.Pipes")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/dotnet/runtime")]
[assembly: SupportedOSPlatform("Windows")]
[assembly: AssemblyVersion("8.0.0.0")]
[module: RefSafetyRules(11)]
[module: NullablePublicOnly(false)]
[module: SkipLocalsInit]
internal static class Interop
{
	internal static class Kernel32
	{
		[LibraryImport("kernel32.dll", SetLastError = true)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		[return: MarshalAs(2)]
		internal static bool CloseHandle(nint P_0)
		{
			Marshal.SetLastSystemError(0);
			int num = __PInvoke(P_0);
			int lastSystemError = Marshal.GetLastSystemError();
			bool result = num != 0;
			Marshal.SetLastPInvokeError(lastSystemError);
			return result;
			[DllImport("kernel32.dll", EntryPoint = "CloseHandle", ExactSpelling = true)]
			[CompilerGenerated]
			static extern int __PInvoke(nint);
		}

		[LibraryImport("kernel32.dll", SetLastError = true)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		internal static int GetFileType(SafeHandle P_0)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			nint num = 0;
			int result = 0;
			ManagedToUnmanagedIn<SafeHandle> val = default(ManagedToUnmanagedIn<SafeHandle>);
			int lastSystemError;
			try
			{
				val.FromManaged(P_0);
				num = val.ToUnmanaged();
				Marshal.SetLastSystemError(0);
				result = __PInvoke(num);
				lastSystemError = Marshal.GetLastSystemError();
			}
			finally
			{
				val.Free();
			}
			Marshal.SetLastPInvokeError(lastSystemError);
			return result;
			[DllImport("kernel32.dll", EntryPoint = "GetFileType", ExactSpelling = true)]
			[CompilerGenerated]
			static extern int __PInvoke(nint);
		}

		[LibraryImport("kernel32.dll", SetLastError = true)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		[return: MarshalAs(2)]
		internal unsafe static bool CancelIoEx(SafeHandle P_0, NativeOverlapped* P_1)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			nint num = 0;
			bool result = false;
			int num2 = 0;
			ManagedToUnmanagedIn<SafeHandle> val = default(ManagedToUnmanagedIn<SafeHandle>);
			int lastSystemError;
			try
			{
				val.FromManaged(P_0);
				num = val.ToUnmanaged();
				Marshal.SetLastSystemError(0);
				num2 = __PInvoke(num, P_1);
				lastSystemError = Marshal.GetLastSystemError();
				result = num2 != 0;
			}
			finally
			{
				val.Free();
			}
			Marshal.SetLastPInvokeError(lastSystemError);
			return result;
			[DllImport("kernel32.dll", EntryPoint = "CancelIoEx", ExactSpelling = true)]
			[CompilerGenerated]
			static extern unsafe int __PInvoke(nint, NativeOverlapped*);
		}

		[LibraryImport("kernel32.dll", SetLastError = true)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		internal unsafe static int ReadFile(SafeHandle P_0, byte* P_1, int P_2, out int P_3, nint P_4)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			System.Runtime.CompilerServices.Unsafe.SkipInit<int>(ref P_3);
			nint num = 0;
			int result = 0;
			ManagedToUnmanagedIn<SafeHandle> val = default(ManagedToUnmanagedIn<SafeHandle>);
			int lastSystemError;
			try
			{
				val.FromManaged(P_0);
				fixed (int* ptr = &P_3)
				{
					num = val.ToUnmanaged();
					Marshal.SetLastSystemError(0);
					result = __PInvoke(num, P_1, P_2, ptr, P_4);
					lastSystemError = Marshal.GetLastSystemError();
				}
			}
			finally
			{
				val.Free();
			}
			Marshal.SetLastPInvokeError(lastSystemError);
			return result;
			[DllImport("kernel32.dll", EntryPoint = "ReadFile", ExactSpelling = true)]
			[CompilerGenerated]
			static extern unsafe int __PInvoke(nint, byte*, int, int*, nint);
		}

		[LibraryImport("kernel32.dll", SetLastError = true)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		internal unsafe static int ReadFile(SafeHandle P_0, byte* P_1, int P_2, nint P_3, NativeOverlapped* P_4)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			nint num = 0;
			int result = 0;
			ManagedToUnmanagedIn<SafeHandle> val = default(ManagedToUnmanagedIn<SafeHandle>);
			int lastSystemError;
			try
			{
				val.FromManaged(P_0);
				num = val.ToUnmanaged();
				Marshal.SetLastSystemError(0);
				result = __PInvoke(num, P_1, P_2, P_3, P_4);
				lastSystemError = Marshal.GetLastSystemError();
			}
			finally
			{
				val.Free();
			}
			Marshal.SetLastPInvokeError(lastSystemError);
			return result;
			[DllImport("kernel32.dll", EntryPoint = "ReadFile", ExactSpelling = true)]
			[CompilerGenerated]
			static extern unsafe int __PInvoke(nint, byte*, int, nint, NativeOverlapped*);
		}

		[LibraryImport("kernel32.dll", SetLastError = true)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		internal unsafe static int WriteFile(SafeHandle P_0, byte* P_1, int P_2, out int P_3, nint P_4)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			System.Runtime.CompilerServices.Unsafe.SkipInit<int>(ref P_3);
			nint num = 0;
			int result = 0;
			ManagedToUnmanagedIn<SafeHandle> val = default(ManagedToUnmanagedIn<SafeHandle>);
			int lastSystemError;
			try
			{
				val.FromManaged(P_0);
				fixed (int* ptr = &P_3)
				{
					num = val.ToUnmanaged();
					Marshal.SetLastSystemError(0);
					result = __PInvoke(num, P_1, P_2, ptr, P_4);
					lastSystemError = Marshal.GetLastSystemError();
				}
			}
			finally
			{
				val.Free();
			}
			Marshal.SetLastPInvokeError(lastSystemError);
			return result;
			[DllImport("kernel32.dll", EntryPoint = "WriteFile", ExactSpelling = true)]
			[CompilerGenerated]
			static extern unsafe int __PInvoke(nint, byte*, int, int*, nint);
		}

		[LibraryImport("kernel32.dll", SetLastError = true)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		internal unsafe static int WriteFile(SafeHandle P_0, byte* P_1, int P_2, nint P_3, NativeOverlapped* P_4)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			nint num = 0;
			int result = 0;
			ManagedToUnmanagedIn<SafeHandle> val = default(ManagedToUnmanagedIn<SafeHandle>);
			int lastSystemError;
			try
			{
				val.FromManaged(P_0);
				num = val.ToUnmanaged();
				Marshal.SetLastSystemError(0);
				result = __PInvoke(num, P_1, P_2, P_3, P_4);
				lastSystemError = Marshal.GetLastSystemError();
			}
			finally
			{
				val.Free();
			}
			Marshal.SetLastPInvokeError(lastSystemError);
			return result;
			[DllImport("kernel32.dll", EntryPoint = "WriteFile", ExactSpelling = true)]
			[CompilerGenerated]
			static extern unsafe int __PInvoke(nint, byte*, int, nint, NativeOverlapped*);
		}

		[LibraryImport("kernel32.dll", SetLastError = true)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		internal static SafeThreadHandle OpenThread(int P_0, [MarshalAs(2)] bool P_1, int P_2)
		{
			bool flag = false;
			int num = 0;
			SafeThreadHandle result = null;
			nint num2 = 0;
			System.Runtime.CompilerServices.Unsafe.SkipInit(out ManagedToUnmanagedOut<SafeThreadHandle> val);
			val..ctor();
			int lastSystemError;
			try
			{
				num = (P_1 ? 1 : 0);
				Marshal.SetLastSystemError(0);
				num2 = __PInvoke(P_0, num, P_2);
				lastSystemError = Marshal.GetLastSystemError();
				flag = true;
				val.FromUnmanaged((System.IntPtr)num2);
				result = val.ToManaged();
			}
			finally
			{
				if (flag)
				{
					val.Free();
				}
			}
			Marshal.SetLastPInvokeError(lastSystemError);
			return result;
			[DllImport("kernel32.dll", EntryPoint = "OpenThread", ExactSpelling = true)]
			[CompilerGenerated]
			static extern nint __PInvoke(int, int, int);
		}

		[LibraryImport("kernel32.dll", SetLastError = true)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		[return: MarshalAs(2)]
		internal static bool CancelSynchronousIo(SafeThreadHandle P_0)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			nint num = 0;
			bool result = false;
			int num2 = 0;
			ManagedToUnmanagedIn<SafeThreadHandle> val = default(ManagedToUnmanagedIn<SafeThreadHandle>);
			int lastSystemError;
			try
			{
				val.FromManaged(P_0);
				num = val.ToUnmanaged();
				Marshal.SetLastSystemError(0);
				num2 = __PInvoke(num);
				lastSystemError = Marshal.GetLastSystemError();
				result = num2 != 0;
			}
			finally
			{
				val.Free();
			}
			Marshal.SetLastPInvokeError(lastSystemError);
			return result;
			[DllImport("kernel32.dll", EntryPoint = "CancelSynchronousIo", ExactSpelling = true)]
			[CompilerGenerated]
			static extern int __PInvoke(nint);
		}

		[DllImport("kernel32.dll", ExactSpelling = true)]
		[LibraryImport("kernel32.dll")]
		[SuppressGCTransition]
		public static extern int GetCurrentThreadId();
	}
}
namespace FxResources.System.IO.Pipes
{
	internal static class SR
	{
	}
}
namespace System
{
	internal static class SR
	{
		private static readonly bool s_usingResourceKeys;

		private static ResourceManager s_resourceManager;

		internal static ResourceManager ResourceManager
		{
			get
			{
				//IL_0013: Unknown result type (might be due to invalid IL or missing references)
				//IL_0018: Unknown result type (might be due to invalid IL or missing references)
				//IL_001e: Expected O, but got Unknown
				object obj = s_resourceManager;
				if (obj == null)
				{
					ResourceManager val = new ResourceManager(typeof(FxResources.System.IO.Pipes.SR));
					s_resourceManager = val;
					obj = (object)val;
				}
				return (ResourceManager)obj;
			}
		}

		internal static string Argument_InvalidHandle => GetResourceString("Argument_InvalidHandle");

		internal static string ArgumentOutOfRange_DirectionModeInOutOrInOut => GetResourceString("ArgumentOutOfRange_DirectionModeInOutOrInOut");

		internal static string InvalidOperation_PipeNotYetConnected => GetResourceString("InvalidOperation_PipeNotYetConnected");

		internal static string InvalidOperation_PipeDisconnected => GetResourceString("InvalidOperation_PipeDisconnected");

		internal static string InvalidOperation_PipeHandleNotSet => GetResourceString("InvalidOperation_PipeHandleNotSet");

		internal static string IO_EOF_ReadBeyondEOF => GetResourceString("IO_EOF_ReadBeyondEOF");

		internal static string IO_FileNotFound => GetResourceString("IO_FileNotFound");

		internal static string IO_FileNotFound_FileName => GetResourceString("IO_FileNotFound_FileName");

		internal static string IO_AlreadyExists_Name => GetResourceString("IO_AlreadyExists_Name");

		internal static string IO_FileExists_Name => GetResourceString("IO_FileExists_Name");

		internal static string IO_SharingViolation_File => GetResourceString("IO_SharingViolation_File");

		internal static string IO_SharingViolation_NoFileName => GetResourceString("IO_SharingViolation_NoFileName");

		internal static string IO_PipeBroken => GetResourceString("IO_PipeBroken");

		internal static string IO_InvalidPipeHandle => GetResourceString("IO_InvalidPipeHandle");

		internal static string IO_PathNotFound_Path => GetResourceString("IO_PathNotFound_Path");

		internal static string IO_PathNotFound_NoPathName => GetResourceString("IO_PathNotFound_NoPathName");

		internal static string IO_PathTooLong => GetResourceString("IO_PathTooLong");

		internal static string NotSupported_UnreadableStream => GetResourceString("NotSupported_UnreadableStream");

		internal static string NotSupported_UnseekableStream => GetResourceString("NotSupported_UnseekableStream");

		internal static string NotSupported_UnwritableStream => GetResourceString("NotSupported_UnwritableStream");

		internal static string NotSupported_AnonymousPipeUnidirectional => GetResourceString("NotSupported_AnonymousPipeUnidirectional");

		internal static string ObjectDisposed_PipeClosed => GetResourceString("ObjectDisposed_PipeClosed");

		internal static string UnauthorizedAccess_IODenied_Path => GetResourceString("UnauthorizedAccess_IODenied_Path");

		internal static string UnauthorizedAccess_IODenied_NoPathName => GetResourceString("UnauthorizedAccess_IODenied_NoPathName");

		internal static string IO_PathTooLong_Path => GetResourceString("IO_PathTooLong_Path");

		internal static bool UsingResourceKeys()
		{
			return s_usingResourceKeys;
		}

		private static string GetResourceString(string P_0)
		{
			if (UsingResourceKeys())
			{
				return P_0;
			}
			string result = null;
			try
			{
				result = ResourceManager.GetString(P_0);
			}
			catch (MissingManifestResourceException)
			{
			}
			return result;
		}

		internal static string Format(string P_0, object P_1)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", new object[2] { P_0, P_1 });
			}
			return string.Format(P_0, P_1);
		}

		static SR()
		{
			System.Runtime.CompilerServices.Unsafe.SkipInit(out bool flag);
			s_usingResourceKeys = AppContext.TryGetSwitch("System.Resources.UseSystemResourceKeys", ref flag) && flag;
		}
	}
}
namespace System.Threading
{
	internal sealed class AsyncOverSyncWithIoCancellation
	{
		private struct SyncAsyncWorkItemRegistration : System.IDisposable
		{
			public AsyncOverSyncWithIoCancellation WorkItem;

			public CancellationTokenRegistration CancellationRegistration;

			public void Dispose()
			{
				//IL_0035: Unknown result type (might be due to invalid IL or missing references)
				//IL_003a: Unknown result type (might be due to invalid IL or missing references)
				if (WorkItem != null)
				{
					Volatile.Write(ref WorkItem._continueTryingToCancel, false);
					((CancellationTokenRegistration)(ref CancellationRegistration)).Dispose();
					System.Threading.Tasks.Task callbackCompleted = WorkItem._callbackCompleted;
					if (callbackCompleted != null)
					{
						TaskAwaiter awaiter = callbackCompleted.GetAwaiter();
						((TaskAwaiter)(ref awaiter)).GetResult();
					}
				}
			}
		}

		[StructLayout(3)]
		[CompilerGenerated]
		private struct <InvokeAsync>d__7<TState> : IAsyncStateMachine
		{
			public int <>1__state;

			public PoolingAsyncValueTaskMethodBuilder <>t__builder;

			public CancellationToken cancellationToken;

			public Action<TState> action;

			public TState state;

			private ConfiguredTaskAwaiter <>u__1;

			private void MoveNext()
			{
				//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
				//IL_004b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0050: Unknown result type (might be due to invalid IL or missing references)
				//IL_0057: Unknown result type (might be due to invalid IL or missing references)
				//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_0018: 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_00a9: Unknown result type (might be due to invalid IL or missing references)
				//IL_00af: Unknown result type (might be due to invalid IL or missing references)
				//IL_006e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0031: 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)
				int num = <>1__state;
				try
				{
					ConfiguredTaskAwaiter awaiter;
					if (num != 0)
					{
						ConfiguredTaskAwaitable val = System.Threading.Tasks.Task.CompletedTask.ConfigureAwait((ConfigureAwaitOptions)4);
						awaiter = ((ConfiguredTaskAwaitable)(ref val)).GetAwaiter();
						if (!((ConfiguredTaskAwaiter)(ref awaiter)).IsCompleted)
						{
							num = (<>1__state = 0);
							<>u__1 = awaiter;
							((PoolingAsyncValueTaskMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter, <InvokeAsync>d__7<TState>>(ref awaiter, ref this);
							return;
						}
					}
					else
					{
						awaiter = <>u__1;
						<>u__1 = default(ConfiguredTaskAwaiter);
						num = (<>1__state = -1);
					}
					((ConfiguredTaskAwaiter)(ref awaiter)).GetResult();
					SyncAsyncWorkItemRegistration syncAsyncWorkItemRegistration = RegisterCancellation(cancellationToken);
					System.Runtime.CompilerServices.Unsafe.SkipInit(out OperationCanceledException val2);
					try
					{
						action.Invoke(state);
					}
					catch (object obj) when (((Func<bool>)delegate
					{
						// Could not convert BlockContainer to single expression
						object obj2 = ((obj is OperationCanceledException) ? obj : null);
						System.Runtime.CompilerServices.Unsafe.SkipInit(out int result);
						if (obj2 == null)
						{
							result = 0;
						}
						else
						{
							val2 = (OperationCanceledException)obj2;
							result = ((((CancellationToken)(ref cancellationToken)).IsCancellationRequested && val2.CancellationToken != cancellationToken) ? 1 : 0);
						}
						return (byte)result != 0;
					}).Invoke())
					{
						throw CreateAppropriateCancellationException(cancellationToken, val2);
					}
					finally
					{
						if (num < 0)
						{
							syncAsyncWorkItemRegistration.Dispose();
						}
					}
				}
				catch (System.Exception exception)
				{
					<>1__state = -2;
					((PoolingAsyncValueTaskMethodBuilder)(ref <>t__builder)).SetException(exception);
					return;
				}
				<>1__state = -2;
				((PoolingAsyncValueTaskMethodBuilder)(ref <>t__builder)).SetResult();
			}
		}

		[StructLayout(3)]
		[CompilerGenerated]
		private struct <InvokeAsync>d__8<TState, TResult> : IAsyncStateMachine
		{
			public int <>1__state;

			public PoolingAsyncValueTaskMethodBuilder<TResult> <>t__builder;

			public CancellationToken cancellationToken;

			public Func<TState, TResult> func;

			public TState state;

			private ConfiguredTaskAwaiter <>u__1;

			private void MoveNext()
			{
				//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
				//IL_004c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0051: Unknown result type (might be due to invalid IL or missing references)
				//IL_0058: Unknown result type (might be due to invalid IL or missing references)
				//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_0019: Unknown result type (might be due to invalid IL or missing references)
				//IL_001e: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
				//IL_006f: 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)
				//IL_0033: Unknown result type (might be due to invalid IL or missing references)
				int num = <>1__state;
				TResult val2;
				try
				{
					ConfiguredTaskAwaiter awaiter;
					if (num != 0)
					{
						ConfiguredTaskAwaitable val = System.Threading.Tasks.Task.CompletedTask.ConfigureAwait((ConfigureAwaitOptions)4);
						awaiter = ((ConfiguredTaskAwaitable)(ref val)).GetAwaiter();
						if (!((ConfiguredTaskAwaiter)(ref awaiter)).IsCompleted)
						{
							num = (<>1__state = 0);
							<>u__1 = awaiter;
							System.Runtime.CompilerServices.Unsafe.As<PoolingAsyncValueTaskMethodBuilder<TResult>, PoolingAsyncValueTaskMethodBuilder<?>>(ref <>t__builder).AwaitUnsafeOnCompleted<ConfiguredTaskAwaiter, <InvokeAsync>d__8<TState, TResult>>(ref awaiter, ref this);
							return;
						}
					}
					else
					{
						awaiter = <>u__1;
						<>u__1 = default(ConfiguredTaskAwaiter);
						num = (<>1__state = -1);
					}
					((ConfiguredTaskAwaiter)(ref awaiter)).GetResult();
					SyncAsyncWorkItemRegistration syncAsyncWorkItemRegistration = RegisterCancellation(cancellationToken);
					System.Runtime.CompilerServices.Unsafe.SkipInit(out OperationCanceledException val3);
					try
					{
						val2 = func.Invoke(state);
					}
					catch (object obj) when (((Func<bool>)delegate
					{
						// Could not convert BlockContainer to single expression
						object obj2 = ((obj is OperationCanceledException) ? obj : null);
						System.Runtime.CompilerServices.Unsafe.SkipInit(out int result);
						if (obj2 == null)
						{
							result = 0;
						}
						else
						{
							val3 = (OperationCanceledException)obj2;
							result = ((((CancellationToken)(ref cancellationToken)).IsCancellationRequested && val3.CancellationToken != cancellationToken) ? 1 : 0);
						}
						return (byte)result != 0;
					}).Invoke())
					{
						throw CreateAppropriateCancellationException(cancellationToken, val3);
					}
					finally
					{
						if (num < 0)
						{
							syncAsyncWorkItemRegistration.Dispose();
						}
					}
				}
				catch (System.Exception exception)
				{
					<>1__state = -2;
					System.Runtime.CompilerServices.Unsafe.As<PoolingAsyncValueTaskMethodBuilder<TResult>, PoolingAsyncValueTaskMethodBuilder<?>>(ref <>t__builder).SetException(exception);
					return;
				}
				<>1__state = -2;
				System.Runtime.CompilerServices.Unsafe.As<PoolingAsyncValueTaskMethodBuilder<TResult>, PoolingAsyncValueTaskMethodBuilder<?>>(ref <>t__builder).SetResult(val2);
			}
		}

		[ThreadStatic]
		private static AsyncOverSyncWithIoCancellation t_instance;

		private readonly SafeThreadHandle _threadHandle;

		private bool _finishedCancellationRegistration;

		private bool _continueTryingToCancel;

		private System.Threading.Tasks.Task _callbackCompleted;

		private AsyncOverSyncWithIoCancellation()
		{
			SafeThreadHandle safeThreadHandle = Interop.Kernel32.OpenThread(1, false, Interop.Kernel32.GetCurrentThreadId());
			if (!((SafeHandle)safeThreadHandle).IsInvalid)
			{
				_threadHandle = safeThreadHandle;
			}
			else
			{
				((SafeHandle)safeThreadHandle).Dispose();
			}
		}

		private void Reset()
		{
			_finishedCancellationRegistration = false;
			_continueTryingToCancel = true;
			_callbackCompleted = null;
		}

		[AsyncStateMachine(typeof(<InvokeAsync>d__7<>))]
		[AsyncMethodBuilder(typeof(PoolingAsyncValueTaskMethodBuilder))]
		public static System.Threading.Tasks.ValueTask InvokeAsync<TState>(Action<TState> P_0, TState P_1, CancellationToken P_2)
		{
			//IL_0002: 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_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			System.Runtime.CompilerServices.Unsafe.SkipInit(out <InvokeAsync>d__7<TState> <InvokeAsync>d__);
			<InvokeAsync>d__.<>t__builder = PoolingAsyncValueTaskMethodBuilder.Create();
			<InvokeAsync>d__.action = P_0;
			<InvokeAsync>d__.state = P_1;
			<InvokeAsync>d__.cancellationToken = P_2;
			<InvokeAsync>d__.<>1__state = -1;
			((PoolingAsyncValueTaskMethodBuilder)(ref <InvokeAsync>d__.<>t__builder)).Start<<InvokeAsync>d__7<TState>>(ref <InvokeAsync>d__);
			return ((PoolingAsyncValueTaskMethodBuilder)(ref <InvokeAsync>d__.<>t__builder)).Task;
		}

		[AsyncStateMachine(typeof(<InvokeAsync>d__8<, >))]
		[AsyncMethodBuilder(typeof(PoolingAsyncValueTaskMethodBuilder<>))]
		public unsafe static System.Threading.Tasks.ValueTask<TResult> InvokeAsync<TState, TResult>(Func<TState, TResult> P_0, TState P_1, CancellationToken P_2)
		{
			//IL_0002: 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_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			System.Runtime.CompilerServices.Unsafe.SkipInit(out <InvokeAsync>d__8<TState, TResult> <InvokeAsync>d__);
			<InvokeAsync>d__.<>t__builder = PoolingAsyncValueTaskMethodBuilder<TResult>.Create();
			<InvokeAsync>d__.func = P_0;
			<InvokeAsync>d__.state = P_1;
			<InvokeAsync>d__.cancellationToken = P_2;
			<InvokeAsync>d__.<>1__state = -1;
			((PoolingAsyncValueTaskMethodBuilder<?>*)(&<InvokeAsync>d__.<>t__builder))->Start<<InvokeAsync>d__8<TState, TResult>>(ref <InvokeAsync>d__);
			return <InvokeAsync>d__.<>t__builder.Task;
		}

		private static OperationCanceledException CreateAppropriateCancellationException(CancellationToken P_0, OperationCanceledException P_1)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			OperationCanceledException val = new OperationCanceledException(P_0);
			string stackTrace = ((System.Exception)(object)P_1).StackTrace;
			if (stackTrace != null)
			{
				ExceptionDispatchInfo.SetRemoteStackTrace((System.Exception)(object)val, stackTrace);
			}
			return val;
		}

		private static SyncAsyncWorkItemRegistration RegisterCancellation(CancellationToken P_0)
		{
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			if (!((CancellationToken)(ref P_0)).CanBeCanceled)
			{
				return default(SyncAsyncWorkItemRegistration);
			}
			((CancellationToken)(ref P_0)).ThrowIfCancellationRequested();
			AsyncOverSyncWithIoCancellation asyncOverSyncWithIoCancellation = t_instance ?? (t_instance = new AsyncOverSyncWithIoCancellation());
			if (asyncOverSyncWithIoCancellation._threadHandle == null)
			{
				return default(SyncAsyncWorkItemRegistration);
			}
			asyncOverSyncWithIoCancellation.Reset();
			SyncAsyncWorkItemRegistration result = default(SyncAsyncWorkItemRegistration);
			result.WorkItem = asyncOverSyncWithIoCancellation;
			result.CancellationRegistration = ((CancellationToken)(ref P_0)).UnsafeRegister((Action<object>)delegate(object s)
			{
				//IL_003b: Unknown result type (might be due to invalid IL or missing references)
				AsyncOverSyncWithIoCancellation asyncOverSyncWithIoCancellation2 = (AsyncOverSyncWithIoCancellation)s;
				if (Volatile.Read(ref asyncOverSyncWithIoCancellation2._finishedCancellationRegistration))
				{
					asyncOverSyncWithIoCancellation2._callbackCompleted = System.Threading.Tasks.Task.Factory.StartNew((Action<object>)delegate(object s)
					{
						//IL_0009: Unknown result type (might be due to invalid IL or missing references)
						AsyncOverSyncWithIoCancellation asyncOverSyncWithIoCancellation3 = (AsyncOverSyncWithIoCancellation)s;
						SpinWait val = default(SpinWait);
						while (Volatile.Read(ref asyncOverSyncWithIoCancellation3._continueTryingToCancel) && !Interop.Kernel32.CancelSynchronousIo(asyncOverSyncWithIoCancellation3._threadHandle) && Marshal.GetLastPInvokeError() == 1168)
						{
							((SpinWait)(ref val)).SpinOnce();
						}
					}, (object)asyncOverSyncWithIoCancellation2, CancellationToken.None, (TaskCreationOptions)8, TaskScheduler.Default);
				}
			}, (object)asyncOverSyncWithIoCancellation);
			Volatile.Write(ref asyncOverSyncWithIoCancellation._finishedCancellationRegistration, true);
			if (((CancellationToken)(ref P_0)).IsCancellationRequested)
			{
				result.Dispose();
				throw new OperationCanceledException(P_0);
			}
			return result;
		}
	}
}
namespace System.IO
{
	internal static class Error
	{
		internal static System.Exception GetEndOfFile()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			return (System.Exception)new EndOfStreamException(SR.IO_EOF_ReadBeyondEOF);
		}

		internal static System.Exception GetPipeNotOpen()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			return (System.Exception)new ObjectDisposedException((string)null, SR.ObjectDisposed_PipeClosed);
		}

		internal static System.Exception GetReadNotSupported()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			return (System.Exception)new NotSupportedException(SR.NotSupported_UnreadableStream);
		}

		internal static System.Exception GetSeekNotSupported()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			return (System.Exception)new NotSupportedException(SR.NotSupported_UnseekableStream);
		}

		internal static System.Exception GetWriteNotSupported()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			return (System.Exception)new NotSupportedException(SR.NotSupported_UnwritableStream);
		}
	}
	internal static class Win32Marshal
	{
		internal static System.Exception GetExceptionForWin32Error(int P_0, string P_1 = "")
		{
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Expected O, but got Unknown
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Expected O, but got Unknown
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Expected O, but got Unknown
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Expected O, but got Unknown
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Expected O, but got Unknown
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Expected O, but got Unknown
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Expected O, but got Unknown
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Expected O, but got Unknown
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Expected O, but got Unknown
			switch (P_0)
			{
			case 2:
				return (System.Exception)new FileNotFoundException(string.IsNullOrEmpty(P_1) ? SR.IO_FileNotFound : SR.Format(SR.IO_FileNotFound_FileName, P_1), P_1);
			case 3:
				return (System.Exception)new DirectoryNotFoundException(string.IsNullOrEmpty(P_1) ? SR.IO_PathNotFound_NoPathName : SR.Format(SR.IO_PathNotFound_Path, P_1));
			case 5:
				return (System.Exception)new UnauthorizedAccessException(string.IsNullOrEmpty(P_1) ? SR.UnauthorizedAccess_IODenied_NoPathName : SR.Format(SR.UnauthorizedAccess_IODenied_Path, P_1));
			case 183:
				if (!string.IsNullOrEmpty(P_1))
				{
					return (System.Exception)new IOException(SR.Format(SR.IO_AlreadyExists_Name, P_1), MakeHRFromErrorCode(P_0));
				}
				break;
			case 206:
				return (System.Exception)new PathTooLongException(string.IsNullOrEmpty(P_1) ? SR.IO_PathTooLong : SR.Format(SR.IO_PathTooLong_Path, P_1));
			case 32:
				return (System.Exception)new IOException(string.IsNullOrEmpty(P_1) ? SR.IO_SharingViolation_NoFileName : SR.Format(SR.IO_SharingViolation_File, P_1), MakeHRFromErrorCode(P_0));
			case 80:
				if (!string.IsNullOrEmpty(P_1))
				{
					return (System.Exception)new IOException(SR.Format(SR.IO_FileExists_Name, P_1), MakeHRFromErrorCode(P_0));
				}
				break;
			case 995:
				return (System.Exception)new OperationCanceledException();
			}
			string text = (string.IsNullOrEmpty(P_1) ? GetPInvokeErrorMessage(P_0) : (GetPInvokeErrorMessage(P_0) + " : '" + P_1 + "'"));
			return (System.Exception)new IOException(text, MakeHRFromErrorCode(P_0));
			[CompilerGenerated]
			static string GetPInvokeErrorMessage(int)
			{
				return Marshal.GetPInvokeErrorMessage(P_0);
			}
		}

		internal static int MakeHRFromErrorCode(int P_0)
		{
			if ((0xFFFF0000u & P_0) != 0L)
			{
				return P_0;
			}
			return -2147024896 | P_0;
		}
	}
}
namespace System.IO.Pipes
{
	public sealed class AnonymousPipeClientStream : PipeStream
	{
		public AnonymousPipeClientStream(PipeDirection P_0, string P_1)
			: base(P_0, 0)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			if (P_0 == PipeDirection.InOut)
			{
				throw new NotSupportedException(SR.NotSupported_AnonymousPipeUnidirectional);
			}
			ArgumentNullException.ThrowIfNull((object)P_1, "pipeHandleAsString");
			System.Runtime.CompilerServices.Unsafe.SkipInit(out long num);
			if (!long.TryParse(P_1, ref num))
			{
				throw new ArgumentException(SR.Argument_InvalidHandle, "pipeHandleAsString");
			}
			SafePipeHandle safePipeHandle = new SafePipeHandle((nint)num, true);
			if (((SafeHandle)safePipeHandle).IsInvalid)
			{
				((SafeHandle)safePipeHandle).Dispose();
				throw new ArgumentException(SR.Argument_InvalidHandle, "pipeHandleAsString");
			}
			Init(P_0, safePipeHandle);
		}

		private void Init(PipeDirection P_0, SafePipeHandle P_1)
		{
			PipeStream.ValidateHandleIsPipe(P_1);
			InitializeHandle(P_1, true, false);
			base.State = PipeState.Connected;
		}

		~AnonymousPipeClientStream()
		{
			try
			{
				((Stream)this).Dispose(false);
			}
			finally
			{
				((object)this).Finalize();
			}
		}
	}
	public enum PipeDirection
	{
		In = 1,
		Out,
		InOut
	}
	internal enum PipeState
	{
		WaitingToConnect,
		Connected,
		Broken,
		Disconnected,
		Closed
	}
	public abstract class PipeStream : Stream
	{
		internal abstract class PipeValueTaskSource : IValueTaskSource<int>, IValueTaskSource
		{
			internal static readonly IOCompletionCallback s_ioCallback = new IOCompletionCallback(IOCallback);

			internal readonly PreAllocatedOverlapped _preallocatedOverlapped;

			internal readonly PipeStream _pipeStream;

			internal MemoryHandle _memoryHandle;

			internal ManualResetValueTaskSourceCore<int> _source;

			internal unsafe NativeOverlapped* _overlapped;

			internal CancellationTokenRegistration _cancellationRegistration;

			internal ulong _result;

			internal short Version => _source.Version;

			protected PipeValueTaskSource(PipeStream P_0)
			{
				//IL_0021: Unknown result type (might be due to invalid IL or missing references)
				//IL_002b: Expected O, but got Unknown
				_pipeStream = P_0;
				_source.RunContinuationsAsynchronously = true;
				_preallocatedOverlapped = new PreAllocatedOverlapped(s_ioCallback, (object)this, (object)null);
			}

			internal void Dispose()
			{
				ReleaseResources();
				_preallocatedOverlapped.Dispose();
			}

			internal unsafe void PrepareForOperation(ReadOnlyMemory<byte> P_0 = default(ReadOnlyMemory<byte>))
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0010: Unknown result type (might be due to invalid IL or missing references)
				_result = 0uL;
				_memoryHandle = P_0.Pin();
				_overlapped = _pipeStream._threadPoolBinding.AllocateNativeOverlapped(_preallocatedOverlapped);
			}

			public ValueTaskSourceStatus GetStatus(short P_0)
			{
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				return _source.GetStatus(P_0);
			}

			public void OnCompleted(Action<object> P_0, object P_1, short P_2, ValueTaskSourceOnCompletedFlags P_3)
			{
				//IL_0009: Unknown result type (might be due to invalid IL or missing references)
				_source.OnCompleted(P_0, P_1, P_2, P_3);
			}

			void IValueTaskSource.GetResult(short P_0)
			{
				GetResult(P_0);
			}

			public int GetResult(short P_0)
			{
				try
				{
					return _source.GetResult(P_0);
				}
				finally
				{
					_pipeStream.TryToReuse(this);
				}
			}

			internal unsafe void RegisterForCancellation(CancellationToken P_0)
			{
				//IL_002c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0031: Unknown result type (might be due to invalid IL or missing references)
				if (!((CancellationToken)(ref P_0)).CanBeCanceled)
				{
					return;
				}
				try
				{
					_cancellationRegistration = ((CancellationToken)(ref P_0)).UnsafeRegister((Action<object, CancellationToken>)delegate(object s, CancellationToken token)
					{
						PipeValueTaskSource pipeValueTaskSource = (PipeValueTaskSource)s;
						SafePipeHandle internalHandle = pipeValueTaskSource._pipeStream.InternalHandle;
						if (internalHandle != null && !((SafeHandle)internalHandle).IsClosed)
						{
							try
							{
								Interop.Kernel32.CancelIoEx((SafeHandle)(object)internalHandle, pipeValueTaskSource._overlapped);
							}
							catch (ObjectDisposedException)
							{
							}
						}
					}, (object)this);
				}
				catch (OutOfMemoryException)
				{
				}
			}

			internal unsafe void ReleaseResources()
			{
				((CancellationTokenRegistration)(ref _cancellationRegistration)).Dispose();
				((MemoryHandle)(ref _memoryHandle)).Dispose();
				if (_overlapped != null)
				{
					_pipeStream._threadPoolBinding.FreeNativeOverlapped(_overlapped);
					_overlapped = null;
				}
			}

			internal void FinishedScheduling()
			{
				ulong num = Interlocked.Exchange(ref _result, 1uL);
				if (num != 0L)
				{
					Complete((uint)num, (uint)(int)(num >> 32) & 0x7FFFFFFFu);
				}
			}

			private unsafe static void IOCallback(uint errorCode, uint numBytes, NativeOverlapped* pOverlapped)
			{
				PipeValueTaskSource pipeValueTaskSource = (PipeValueTaskSource)ThreadPoolBoundHandle.GetNativeOverlappedState(pOverlapped);
				if (Interlocked.Exchange(ref pipeValueTaskSource._result, 0x8000000000000000uL | ((ulong)numBytes << 32) | errorCode) != 0L)
				{
					pipeValueTaskSource.Complete(errorCode, numBytes);
				}
			}

			private void Complete(uint P_0, uint P_1)
			{
				ReleaseResources();
				CompleteCore(P_0, P_1);
			}

			private protected abstract void CompleteCore(uint P_0, uint P_1);
		}

		internal sealed class ReadWriteValueTaskSource : PipeValueTaskSource
		{
			internal readonly bool _isWrite;

			internal ReadWriteValueTaskSource(PipeStream P_0, bool P_1)
				: base(P_0)
			{
				_isWrite = P_1;
			}

			private protected override void CompleteCore(uint P_0, uint P_1)
			{
				//IL_0059: Unknown result type (might be due to invalid IL or missing references)
				//IL_005e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0075: Unknown result type (might be due to invalid IL or missing references)
				//IL_0076: Unknown result type (might be due to invalid IL or missing references)
				//IL_006e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0080: Expected O, but got Unknown
				if (!_isWrite)
				{
					bool flag = true;
					switch (P_0)
					{
					case 109u:
					case 232u:
					case 233u:
						P_0 = 0u;
						break;
					case 234u:
						P_0 = 0u;
						flag = false;
						break;
					}
					_pipeStream.UpdateMessageCompletion(flag);
				}
				switch (P_0)
				{
				case 0u:
					_source.SetResult((int)P_1);
					break;
				case 995u:
				{
					CancellationToken token = ((CancellationTokenRegistration)(ref _cancellationRegistration)).Token;
					_source.SetException((System.Exception)(((CancellationToken)(ref token)).IsCancellationRequested ? new OperationCanceledException(token) : new OperationCanceledException()));
					break;
				}
				default:
					_source.SetException(_pipeStream.WinIOError((int)P_0));
					break;
				}
			}
		}

		private SafePipeHandle _handle;

		private bool _canRead;

		private bool _canWrite;

		private bool _isAsync;

		private bool _isMessageComplete;

		private bool _isFromExistingHandle;

		private bool _isHandleExposed;

		private PipeTransmissionMode _readMode;

		private PipeTransmissionMode _transmissionMode;

		private PipeDirection _pipeDirection;

		private uint _outBufferSize;

		private PipeState _state;

		internal ThreadPoolBoundHandle _threadPoolBinding;

		private ReadWriteValueTaskSource _reusableReadValueTaskSource;

		private ReadWriteValueTaskSource _reusableWriteValueTaskSource;

		public bool IsConnected => State == PipeState.Connected;

		internal SafePipeHandle? InternalHandle => _handle;

		public override bool CanRead => _canRead;

		public override bool CanWrite => _canWrite;

		public override bool CanSeek => false;

		public override long Length
		{
			get
			{
				throw Error.GetSeekNotSupported();
			}
		}

		public override long Position
		{
			get
			{
				throw Error.GetSeekNotSupported();
			}
			set
			{
				throw Error.GetSeekNotSupported();
			}
		}

		internal PipeState State
		{
			get
			{
				return _state;
			}
			set
			{
				_state = value;
			}
		}

		protected PipeStream(PipeDirection P_0, int P_1)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			if (P_0 < PipeDirection.In || P_0 > PipeDirection.InOut)
			{
				throw new ArgumentOutOfRangeException("direction", SR.ArgumentOutOfRange_DirectionModeInOutOrInOut);
			}
			ArgumentOutOfRangeException.ThrowIfNegative<int>(P_1, "bufferSize");
			Init(P_0, PipeTransmissionMode.Byte, (uint)P_1);
		}

		private void Init(PipeDirection P_0, PipeTransmissionMode P_1, uint P_2)
		{
			_readMode = P_1;
			_transmissionMode = P_1;
			_pipeDirection = P_0;
			if ((_pipeDirection & PipeDirection.In) != 0)
			{
				_canRead = true;
			}
			if ((_pipeDirection & PipeDirection.Out) != 0)
			{
				_canWrite = true;
			}
			_outBufferSize = P_2;
			_isMessageComplete = true;
			_state = PipeState.WaitingToConnect;
		}

		protected void InitializeHandle(SafePipeHandle? P_0, bool P_1, bool P_2)
		{
			if (P_2 && P_0 != null)
			{
				InitializeAsyncHandle(P_0);
			}
			_handle = P_0;
			_isAsync = P_2;
			_isHandleExposed = P_1;
			_isFromExistingHandle = P_1;
		}

		public unsafe override int ReadByte()
		{
			System.Runtime.CompilerServices.Unsafe.SkipInit(out byte result);
			if (((Stream)this).Read(new System.Span<byte>((void*)(&result), 1)) <= 0)
			{
				return -1;
			}
			return result;
		}

		public override void Flush()
		{
			CheckWriteOperations();
		}

		protected override void Dispose(bool P_0)
		{
			try
			{
				if (_handle != null && !((SafeHandle)_handle).IsClosed)
				{
					((SafeHandle)_handle).Dispose();
				}
				DisposeCore(P_0);
			}
			finally
			{
				((Stream)this).Dispose(P_0);
			}
			_state = PipeState.Closed;
		}

		internal void UpdateMessageCompletion(bool P_0)
		{
			_isMessageComplete = P_0 || _state == PipeState.Broken;
		}

		public override long Seek(long P_0, SeekOrigin P_1)
		{
			throw Error.GetSeekNotSupported();
		}

		protected internal void CheckReadOperations()
		{
			//IL_000d: 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_0034: Unknown result type (might be due to invalid IL or missing references)
			if (_state == PipeState.WaitingToConnect)
			{
				throw new InvalidOperationException(SR.InvalidOperation_PipeNotYetConnected);
			}
			if (_state == PipeState.Disconnected)
			{
				throw new InvalidOperationException(SR.InvalidOperation_PipeDisconnected);
			}
			if (_handle == null)
			{
				throw new InvalidOperationException(SR.InvalidOperation_PipeHandleNotSet);
			}
			if (_state == PipeState.Closed || (_handle != null && ((SafeHandle)_handle).IsClosed))
			{
				throw Error.GetPipeNotOpen();
			}
		}

		protected internal void CheckWriteOperations()
		{
			//IL_000d: 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_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			if (_state == PipeState.WaitingToConnect)
			{
				throw new InvalidOperationException(SR.InvalidOperation_PipeNotYetConnected);
			}
			if (_state == PipeState.Disconnected)
			{
				throw new InvalidOperationException(SR.InvalidOperation_PipeDisconnected);
			}
			if (_handle == null)
			{
				throw new InvalidOperationException(SR.InvalidOperation_PipeHandleNotSet);
			}
			if (_state == PipeState.Broken)
			{
				throw new IOException(SR.IO_PipeBroken);
			}
			if (_state == PipeState.Closed || (_handle != null && ((SafeHandle)_handle).IsClosed))
			{
				throw Error.GetPipeNotOpen();
			}
		}

		public override int Read(byte[] P_0, int P_1, int P_2)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			if (_isAsync)
			{
				return ((Stream)this).ReadAsync(P_0, P_1, P_2, CancellationToken.None).GetAwaiter().GetResult();
			}
			Stream.ValidateBufferArguments(P_0, P_1, P_2);
			if (!((Stream)this).CanRead)
			{
				throw Error.GetReadNotSupported();
			}
			CheckReadOperations();
			return ReadCore(new System.Span<byte>(P_0, P_1, P_2));
		}

		public override int Read(System.Span<byte> P_0)
		{
			if (_isAsync)
			{
				return ((Stream)this).Read(P_0);
			}
			if (!((Stream)this).CanRead)
			{
				throw Error.GetReadNotSupported();
			}
			CheckReadOperations();
			return ReadCore(P_0);
		}

		public override System.Threading.Tasks.Task<int> ReadAsync(byte[] P_0, int P_1, int P_2, CancellationToken P_3)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			Stream.ValidateBufferArguments(P_0, P_1, P_2);
			if (!((Stream)this).CanRead)
			{
				throw Error.GetReadNotSupported();
			}
			if (((CancellationToken)(ref P_3)).IsCancellationRequested)
			{
				return System.Threading.Tasks.Task.FromCanceled<int>(P_3);
			}
			CheckReadOperations();
			if (P_2 == 0)
			{
				UpdateMessageCompletion(false);
				return System.Threading.Tasks.Task.FromResult<int>(0);
			}
			if (!_isAsync)
			{
				return AsyncOverSyncRead(new System.Memory<byte>(P_0, P_1, P_2), P_3).AsTask();
			}
			return ReadAsyncCore(new System.Memory<byte>(P_0, P_1, P_2), P_3).AsTask();
		}

		public override System.Threading.Tasks.ValueTask<int> ReadAsync(System.Memory<byte> P_0, CancellationToken P_1 = default(CancellationToken))
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			if (!((Stream)this).CanRead)
			{
				throw Error.GetReadNotSupported();
			}
			if (((CancellationToken)(ref P_1)).IsCancellationRequested)
			{
				return System.Threading.Tasks.ValueTask.FromCanceled<int>(P_1);
			}
			CheckReadOperations();
			if (P_0.Length == 0)
			{
				UpdateMessageCompletion(false);
				return new System.Threading.Tasks.ValueTask<int>(0);
			}
			if (!_isAsync)
			{
				return AsyncOverSyncRead(P_0, P_1);
			}
			return ReadAsyncCore(P_0, P_1);
		}

		private System.Threading.Tasks.ValueTask<int> AsyncOverSyncRead(System.Memory<byte> P_0, CancellationToken P_1)
		{
			//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)
			return AsyncOverSyncWithIoCancellation.InvokeAsync<ValueTuple<PipeStream, System.Memory<byte>>, int>((ValueTuple<PipeStream, System.Memory<byte>> s) => s.Item1.ReadCore(s.Item2.Span), new ValueTuple<PipeStream, System.Memory<byte>>(this, P_0), P_1);
		}

		public override IAsyncResult BeginRead(byte[] P_0, int P_1, int P_2, AsyncCallback? P_3, object? P_4)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			if (_isAsync)
			{
				return TaskToAsyncResult.Begin((System.Threading.Tasks.Task)((Stream)this).ReadAsync(P_0, P_1, P_2, CancellationToken.None), P_3, P_4);
			}
			return ((Stream)this).BeginRead(P_0, P_1, P_2, P_3, P_4);
		}

		public override int EndRead(IAsyncResult P_0)
		{
			if (_isAsync)
			{
				return TaskToAsyncResult.End<int>(P_0);
			}
			return ((Stream)this).EndRead(P_0);
		}

		public override void Write(byte[] P_0, int P_1, int P_2)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			if (_isAsync)
			{
				TaskAwaiter awaiter = ((Stream)this).WriteAsync(P_0, P_1, P_2, CancellationToken.None).GetAwaiter();
				((TaskAwaiter)(ref awaiter)).GetResult();
				return;
			}
			Stream.ValidateBufferArguments(P_0, P_1, P_2);
			if (!((Stream)this).CanWrite)
			{
				throw Error.GetWriteNotSupported();
			}
			CheckWriteOperations();
			WriteCore(new System.ReadOnlySpan<byte>(P_0, P_1, P_2));
		}

		public override void Write(System.ReadOnlySpan<byte> P_0)
		{
			if (_isAsync)
			{
				((Stream)this).Write(P_0);
				return;
			}
			if (!((Stream)this).CanWrite)
			{
				throw Error.GetWriteNotSupported();
			}
			CheckWriteOperations();
			WriteCore(P_0);
		}

		public override System.Threading.Tasks.Task WriteAsync(byte[] P_0, int P_1, int P_2, CancellationToken P_3)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			Stream.ValidateBufferArguments(P_0, P_1, P_2);
			if (!((Stream)this).CanWrite)
			{
				throw Error.GetWriteNotSupported();
			}
			if (((CancellationToken)(ref P_3)).IsCancellationRequested)
			{
				return System.Threading.Tasks.Task.FromCanceled<int>(P_3);
			}
			CheckWriteOperations();
			if (P_2 != 0)
			{
				if (!_isAsync)
				{
					return AsyncOverSyncWrite(new ReadOnlyMemory<byte>(P_0, P_1, P_2), P_3).AsTask();
				}
				return WriteAsyncCore(new ReadOnlyMemory<byte>(P_0, P_1, P_2), P_3).AsTask();
			}
			return System.Threading.Tasks.Task.CompletedTask;
		}

		public override System.Threading.Tasks.ValueTask WriteAsync(ReadOnlyMemory<byte> P_0, CancellationToken P_1 = default(CancellationToken))
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			if (!((Stream)this).CanWrite)
			{
				throw Error.GetWriteNotSupported();
			}
			if (((CancellationToken)(ref P_1)).IsCancellationRequested)
			{
				return System.Threading.Tasks.ValueTask.FromCanceled(P_1);
			}
			CheckWriteOperations();
			if (P_0.Length != 0)
			{
				if (!_isAsync)
				{
					return AsyncOverSyncWrite(P_0, P_1);
				}
				return WriteAsyncCore(P_0, P_1);
			}
			return default(System.Threading.Tasks.ValueTask);
		}

		private System.Threading.Tasks.ValueTask AsyncOverSyncWrite(ReadOnlyMemory<byte> P_0, CancellationToken P_1)
		{
			//IL_0020: 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)
			return AsyncOverSyncWithIoCancellation.InvokeAsync<ValueTuple<PipeStream, ReadOnlyMemory<byte>>>(delegate(ValueTuple<PipeStream, ReadOnlyMemory<byte>> s)
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				s.Item1.WriteCore(s.Item2.Span);
			}, new ValueTuple<PipeStream, ReadOnlyMemory<byte>>(this, P_0), P_1);
		}

		public override IAsyncResult BeginWrite(byte[] P_0, int P_1, int P_2, AsyncCallback? P_3, object? P_4)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			if (_isAsync)
			{
				return TaskToAsyncResult.Begin(((Stream)this).WriteAsync(P_0, P_1, P_2, CancellationToken.None), P_3, P_4);
			}
			return ((Stream)this).BeginWrite(P_0, P_1, P_2, P_3, P_4);
		}

		public override void EndWrite(IAsyncResult P_0)
		{
			if (_isAsync)
			{
				TaskToAsyncResult.End(P_0);
			}
			else
			{
				((Stream)this).EndWrite(P_0);
			}
		}

		private protected static void ValidateHandleIsPipe(SafePipeHandle P_0)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			if (Interop.Kernel32.GetFileType((SafeHandle)(object)P_0) != 3)
			{
				throw new IOException(SR.IO_InvalidPipeHandle);
			}
		}

		private void InitializeAsyncHandle(SafePipeHandle P_0)
		{
			_threadPoolBinding = ThreadPoolBoundHandle.BindHandle((SafeHandle)(object)P_0);
		}

		internal virtual void TryToReuse(PipeValueTaskSource P_0)
		{
			P_0._source.Reset();
			if (P_0 is ReadWriteValueTaskSource readWriteValueTaskSource && Interlocked.CompareExchange<ReadWriteValueTaskSource>(ref readWriteValueTaskSource._isWrite ? ref _reusableWriteValueTaskSource : ref _reusableReadValueTaskSource, readWriteValueTaskSource, (ReadWriteValueTaskSource)null) != null)
			{
				P_0._preallocatedOverlapped.Dispose();
			}
		}

		private void DisposeCore(bool P_0)
		{
			if (P_0)
			{
				ThreadPoolBoundHandle threadPoolBinding = _threadPoolBinding;
				if (threadPoolBinding != null)
				{
					threadPoolBinding.Dispose();
				}
				Interlocked.Exchange<ReadWriteValueTaskSource>(ref _reusableReadValueTaskSource, (ReadWriteValueTaskSource)null)?.Dispose();
				Interlocked.Exchange<ReadWriteValueTaskSource>(ref _reusableWriteValueTaskSource, (ReadWriteValueTaskSource)null)?.Dispose();
			}
		}

		private unsafe int ReadCore(System.Span<byte> P_0)
		{
			if (P_0.Length == 0)
			{
				return 0;
			}
			fixed (byte* ptr = &MemoryMarshal.GetReference<byte>(P_0))
			{
				int result = 0;
				if (Interop.Kernel32.ReadFile((SafeHandle)(object)_handle, ptr, P_0.Length, out result, System.IntPtr.Zero) != 0)
				{
					_isMessageComplete = true;
					return result;
				}
				int lastPInvokeError = Marshal.GetLastPInvokeError();
				_isMessageComplete = lastPInvokeError != 234;
				switch (lastPInvokeError)
				{
				case 234:
					return result;
				case 109:
				case 233:
					State = PipeState.Broken;
					return 0;
				default:
					throw Win32Marshal.GetExceptionForWin32Error(lastPInvokeError, string.Empty);
				}
			}
		}

		private unsafe System.Threading.Tasks.ValueTask<int> ReadAsyncCore(System.Memory<byte> P_0, CancellationToken P_1)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			ReadWriteValueTaskSource readWriteValueTaskSource = Interlocked.Exchange<ReadWriteValueTaskSource>(ref _reusableReadValueTaskSource, (ReadWriteValueTaskSource)null) ?? new ReadWriteValueTaskSource(this, false);
			try
			{
				readWriteValueTaskSource.PrepareForOperation(System.Memory<byte>.op_Implicit(P_0));
				if (Interop.Kernel32.ReadFile((SafeHandle)(object)_handle, (byte*)((MemoryHandle)(ref readWriteValueTaskSource._memoryHandle)).Pointer, P_0.Length, System.IntPtr.Zero, readWriteValueTaskSource._overlapped) == 0)
				{
					int lastPInvokeError = Marshal.GetLastPInvokeError();
					switch (lastPInvokeError)
					{
					case 997:
						readWriteValueTaskSource.RegisterForCancellation(P_1);
						break;
					case 109:
					case 233:
						State = PipeState.Broken;
						((NativeOverlapped)readWriteValueTaskSource._overlapped).InternalLow = System.IntPtr.Zero;
						readWriteValueTaskSource.Dispose();
						UpdateMessageCompletion(true);
						return new System.Threading.Tasks.ValueTask<int>(0);
					default:
						readWriteValueTaskSource.Dispose();
						return System.Threading.Tasks.ValueTask.FromException<int>(Win32Marshal.GetExceptionForWin32Error(lastPInvokeError));
					case 234:
						break;
					}
				}
			}
			catch
			{
				readWriteValueTaskSource.Dispose();
				throw;
			}
			readWriteValueTaskSource.FinishedScheduling();
			return new System.Threading.Tasks.ValueTask<int>((IValueTaskSource<int>)readWriteValueTaskSource, readWriteValueTaskSource.Version);
		}

		private unsafe void WriteCore(System.ReadOnlySpan<byte> P_0)
		{
			if (P_0.Length == 0)
			{
				return;
			}
			fixed (byte* ptr = &MemoryMarshal.GetReference<byte>(P_0))
			{
				int num = 0;
				if (Interop.Kernel32.WriteFile((SafeHandle)(object)_handle, ptr, P_0.Length, out num, System.IntPtr.Zero) == 0)
				{
					throw WinIOError(Marshal.GetLastPInvokeError());
				}
			}
		}

		private unsafe System.Threading.Tasks.ValueTask WriteAsyncCore(ReadOnlyMemory<byte> P_0, CancellationToken P_1)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			ReadWriteValueTaskSource readWriteValueTaskSource = Interlocked.Exchange<ReadWriteValueTaskSource>(ref _reusableWriteValueTaskSource, (ReadWriteValueTaskSource)null) ?? new ReadWriteValueTaskSource(this, true);
			try
			{
				readWriteValueTaskSource.PrepareForOperation(P_0);
				if (Interop.Kernel32.WriteFile((SafeHandle)(object)_handle, (byte*)((MemoryHandle)(ref readWriteValueTaskSource._memoryHandle)).Pointer, P_0.Length, System.IntPtr.Zero, readWriteValueTaskSource._overlapped) == 0)
				{
					int lastPInvokeError = Marshal.GetLastPInvokeError();
					if (lastPInvokeError != 997)
					{
						readWriteValueTaskSource.Dispose();
						return System.Threading.Tasks.ValueTask.FromException(ExceptionDispatchInfo.SetCurrentStackTrace(WinIOError(lastPInvokeError)));
					}
					readWriteValueTaskSource.RegisterForCancellation(P_1);
				}
			}
			catch
			{
				readWriteValueTaskSource.Dispose();
				throw;
			}
			readWriteValueTaskSource.FinishedScheduling();
			return new System.Threading.Tasks.ValueTask((IValueTaskSource)(object)readWriteValueTaskSource, readWriteValueTaskSource.Version);
		}

		internal System.Exception WinIOError(int P_0)
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Expected O, but got Unknown
			switch (P_0)
			{
			case 109:
			case 232:
			case 233:
				_state = PipeState.Broken;
				return (System.Exception)new IOException(SR.IO_PipeBroken, Win32Marshal.MakeHRFromErrorCode(P_0));
			case 38:
				return Error.GetEndOfFile();
			case 6:
				((SafeHandle)_handle).SetHandleAsInvalid();
				_state = PipeState.Broken;
				break;
			}
			return Win32Marshal.GetExceptionForWin32Error(P_0);
		}
	}
	public enum PipeTransmissionMode
	{
		Byte,
		[SupportedOSPlatform("windows")]
		Message
	}
}
namespace Microsoft.Win32.SafeHandles
{
	public sealed class SafePipeHandle : SafeHandleZeroOrMinusOneIsInvalid
	{
		public SafePipeHandle(nint P_0, bool P_1)
			: base(P_1)
		{
			((SafeHandle)this).SetHandle((System.IntPtr)P_0);
		}

		protected override bool ReleaseHandle()
		{
			return Interop.Kernel32.CloseHandle(((SafeHandle)this).handle);
		}
	}
	internal sealed class SafeThreadHandle : SafeHandle
	{
		public override bool IsInvalid
		{
			get
			{
				nint handle = base.handle;
				long num = handle;
				if ((ulong)(num - -1) <= 1uL)
				{
					return true;
				}
				return false;
			}
		}

		public SafeThreadHandle()
			: base((System.IntPtr)0, true)
		{
		}

		protected override bool ReleaseHandle()
		{
			return Interop.Kernel32.CloseHandle(base.handle);
		}
	}
}

System.Private.CoreLib.dll

Decompiled 8 months ago
using System;
using System.Buffers;
using System.Buffers.Binary;
using System.Buffers.Text;
using System.CodeDom.Compiler;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Configuration.Assemblies;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Diagnostics.Tracing;
using System.Globalization;
using System.IO;
using System.IO.Strategies;
using System.Numerics;
using System.Private.CoreLib;
using System.Reflection;
using System.Reflection.Emit;
using System.Resources;
using System.Runtime;
using System.Runtime.CompilerServices;
using System.Runtime.ConstrainedExecution;
using System.Runtime.ExceptionServices;
using System.Runtime.InteropServices;
using System.Runtime.InteropServices.ComTypes;
using System.Runtime.InteropServices.Marshalling;
using System.Runtime.Intrinsics;
using System.Runtime.Intrinsics.Arm;
using System.Runtime.Intrinsics.Wasm;
using System.Runtime.Intrinsics.X86;
using System.Runtime.Loader;
using System.Runtime.Remoting;
using System.Runtime.Serialization;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Principal;
using System.StubHelpers;
using System.Text;
using System.Text.Unicode;
using System.Threading;
using System.Threading.Tasks;
using System.Threading.Tasks.Sources;
using Internal;
using Internal.Win32;
using Internal.Win32.SafeHandles;
using Microsoft.Win32.SafeHandles;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: CLSCompliant(true)]
[assembly: DefaultDllImportSearchPaths(DllImportSearchPath.System32 | DllImportSearchPath.AssemblyDirectory)]
[assembly: AssemblyMetadata("Serviceable", "True")]
[assembly: AssemblyMetadata("IsTrimmable", "True")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: DisableRuntimeMarshalling]
[assembly: TargetFramework(".NETCoreApp,Version=v8.0", FrameworkDisplayName = ".NET 8.0")]
[assembly: AssemblyCompany("Microsoft Corporation")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")]
[assembly: AssemblyDescription("System.Private.CoreLib")]
[assembly: AssemblyFileVersion("8.0.324.11423")]
[assembly: AssemblyInformationalVersion("8.0.3+9f4b1f5d664afdfc80e1508ab7ed099dff210fbd")]
[assembly: AssemblyProduct("Microsoft® .NET")]
[assembly: AssemblyTitle("System.Private.CoreLib")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/dotnet/runtime")]
[assembly: AssemblyVersion("8.0.0.0")]
[module: RefSafetyRules(11)]
[module: NullablePublicOnly(false)]
[module: SkipLocalsInit]
internal static class Interop
{
	internal static class OleAut32
	{
		[DllImport("oleaut32.dll", ExactSpelling = true)]
		[LibraryImport("oleaut32.dll")]
		internal static extern void VariantClear(nint P_0);

		[LibraryImport("oleaut32.dll")]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		internal unsafe static nint SysAllocStringByteLen(byte[] P_0, uint P_1)
		{
			nint result;
			fixed (byte* ptr = &ArrayMarshaller<byte, byte>.ManagedToUnmanagedIn.GetPinnableReference(P_0))
			{
				void* ptr2 = ptr;
				result = __PInvoke((byte*)ptr2, P_1);
			}
			return result;
			[DllImport("oleaut32.dll", EntryPoint = "SysAllocStringByteLen", ExactSpelling = true)]
			static extern unsafe nint __PInvoke(byte*, uint);
		}

		[DllImport("oleaut32.dll", ExactSpelling = true)]
		[LibraryImport("oleaut32.dll")]
		internal static extern void SysFreeString(nint P_0);
	}

	internal static class Globalization
	{
		internal enum ResultCode
		{
			Success,
			UnknownError,
			InsufficientBuffer,
			OutOfMemory,
			InvalidCodePoint
		}

		[LibraryImport("System.Globalization.Native", EntryPoint = "GlobalizationNative_GetCalendars", StringMarshalling = StringMarshalling.Utf16)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		internal unsafe static int GetCalendars(string P_0, CalendarId[] P_1, int P_2)
		{
			int result;
			fixed (CalendarId* ptr = &ArrayMarshaller<CalendarId, CalendarId>.ManagedToUnmanagedIn.GetPinnableReference(P_1))
			{
				void* ptr2 = ptr;
				fixed (char* ptr3 = &Utf16StringMarshaller.GetPinnableReference(P_0))
				{
					void* ptr4 = ptr3;
					result = __PInvoke((ushort*)ptr4, (CalendarId*)ptr2, P_2);
				}
			}
			return result;
			[DllImport("System.Globalization.Native", EntryPoint = "GlobalizationNative_GetCalendars", ExactSpelling = true)]
			static extern unsafe int __PInvoke(ushort*, CalendarId*, int);
		}

		[LibraryImport("System.Globalization.Native", EntryPoint = "GlobalizationNative_GetCalendarInfo", StringMarshalling = StringMarshalling.Utf16)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		internal unsafe static ResultCode GetCalendarInfo(string P_0, CalendarId P_1, CalendarDataType P_2, char* P_3, int P_4)
		{
			ResultCode result;
			fixed (char* ptr = &Utf16StringMarshaller.GetPinnableReference(P_0))
			{
				void* ptr2 = ptr;
				result = __PInvoke((ushort*)ptr2, P_1, P_2, P_3, P_4);
			}
			return result;
			[DllImport("System.Globalization.Native", EntryPoint = "GlobalizationNative_GetCalendarInfo", ExactSpelling = true)]
			static extern unsafe ResultCode __PInvoke(ushort*, CalendarId, CalendarDataType, char*, int);
		}

		internal unsafe static bool EnumCalendarInfo(delegate* unmanaged<char*, nint, void> P_0, string P_1, CalendarId P_2, CalendarDataType P_3, nint P_4)
		{
			return EnumCalendarInfo((nint)P_0, P_1, P_2, P_3, P_4);
		}

		[LibraryImport("System.Globalization.Native", EntryPoint = "GlobalizationNative_EnumCalendarInfo", StringMarshalling = StringMarshalling.Utf16)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		[return: MarshalAs(UnmanagedType.Bool)]
		private unsafe static bool EnumCalendarInfo(nint P_0, string P_1, CalendarId P_2, CalendarDataType P_3, nint P_4)
		{
			int num;
			fixed (char* ptr = &Utf16StringMarshaller.GetPinnableReference(P_1))
			{
				void* ptr2 = ptr;
				num = __PInvoke(P_0, (ushort*)ptr2, P_2, P_3, P_4);
			}
			return num != 0;
			[DllImport("System.Globalization.Native", EntryPoint = "GlobalizationNative_EnumCalendarInfo", ExactSpelling = true)]
			static extern unsafe int __PInvoke(nint, ushort*, CalendarId, CalendarDataType, nint);
		}

		[DllImport("System.Globalization.Native", EntryPoint = "GlobalizationNative_GetLatestJapaneseEra", ExactSpelling = true)]
		[LibraryImport("System.Globalization.Native", EntryPoint = "GlobalizationNative_GetLatestJapaneseEra")]
		internal static extern int GetLatestJapaneseEra();

		[LibraryImport("System.Globalization.Native", EntryPoint = "GlobalizationNative_GetJapaneseEraStartDate")]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		[return: MarshalAs(UnmanagedType.Bool)]
		internal unsafe static bool GetJapaneseEraStartDate(int P_0, out int P_1, out int P_2, out int P_3)
		{
			Unsafe.SkipInit<int>(out P_1);
			Unsafe.SkipInit<int>(out P_2);
			Unsafe.SkipInit<int>(out P_3);
			int num;
			fixed (int* ptr3 = &P_3)
			{
				fixed (int* ptr2 = &P_2)
				{
					fixed (int* ptr = &P_1)
					{
						num = __PInvoke(P_0, ptr, ptr2, ptr3);
					}
				}
			}
			return num != 0;
			[DllImport("System.Globalization.Native", EntryPoint = "GlobalizationNative_GetJapaneseEraStartDate", ExactSpelling = true)]
			static extern unsafe int __PInvoke(int, int*, int*, int*);
		}

		[LibraryImport("System.Globalization.Native", EntryPoint = "GlobalizationNative_ChangeCase", StringMarshalling = StringMarshalling.Utf16)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		[return: MarshalAs(UnmanagedType.Bool)]
		internal unsafe static void ChangeCase(char* P_0, int P_1, char* P_2, int P_3, [MarshalAs(UnmanagedType.Bool)] bool P_4)
		{
			int num = (P_4 ? 1 : 0);
			__PInvoke(P_0, P_1, P_2, P_3, num);
			[DllImport("System.Globalization.Native", EntryPoint = "GlobalizationNative_ChangeCase", ExactSpelling = true)]
			[return: MarshalAs(UnmanagedType.Bool)]
			static extern unsafe void __PInvoke(char*, int, char*, int, int);
		}

		[LibraryImport("System.Globalization.Native", EntryPoint = "GlobalizationNative_ChangeCaseInvariant", StringMarshalling = StringMarshalling.Utf16)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		[return: MarshalAs(UnmanagedType.Bool)]
		internal unsafe static void ChangeCaseInvariant(char* P_0, int P_1, char* P_2, int P_3, [MarshalAs(UnmanagedType.Bool)] bool P_4)
		{
			int num = (P_4 ? 1 : 0);
			__PInvoke(P_0, P_1, P_2, P_3, num);
			[DllImport("System.Globalization.Native", EntryPoint = "GlobalizationNative_ChangeCaseInvariant", ExactSpelling = true)]
			[return: MarshalAs(UnmanagedType.Bool)]
			static extern unsafe void __PInvoke(char*, int, char*, int, int);
		}

		[LibraryImport("System.Globalization.Native", EntryPoint = "GlobalizationNative_ChangeCaseTurkish", StringMarshalling = StringMarshalling.Utf16)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		[return: MarshalAs(UnmanagedType.Bool)]
		internal unsafe static void ChangeCaseTurkish(char* P_0, int P_1, char* P_2, int P_3, [MarshalAs(UnmanagedType.Bool)] bool P_4)
		{
			int num = (P_4 ? 1 : 0);
			__PInvoke(P_0, P_1, P_2, P_3, num);
			[DllImport("System.Globalization.Native", EntryPoint = "GlobalizationNative_ChangeCaseTurkish", ExactSpelling = true)]
			[return: MarshalAs(UnmanagedType.Bool)]
			static extern unsafe void __PInvoke(char*, int, char*, int, int);
		}

		[DllImport("System.Globalization.Native", CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_InitOrdinalCasingPage", ExactSpelling = true)]
		[LibraryImport("System.Globalization.Native", EntryPoint = "GlobalizationNative_InitOrdinalCasingPage", StringMarshalling = StringMarshalling.Utf16)]
		internal unsafe static extern void InitOrdinalCasingPage(int P_0, char* P_1);

		[LibraryImport("System.Globalization.Native", EntryPoint = "GlobalizationNative_GetSortHandle", StringMarshalling = StringMarshalling.Utf8)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		internal unsafe static ResultCode GetSortHandle(string P_0, out nint P_1)
		{
			Unsafe.SkipInit<nint>(out P_1);
			byte* ptr = default(byte*);
			ResultCode resultCode = ResultCode.Success;
			Utf8StringMarshaller.ManagedToUnmanagedIn managedToUnmanagedIn = default(Utf8StringMarshaller.ManagedToUnmanagedIn);
			try
			{
				Span<byte> span = stackalloc byte[256];
				managedToUnmanagedIn.FromManaged(P_0, span);
				fixed (nint* ptr2 = &P_1)
				{
					ptr = managedToUnmanagedIn.ToUnmanaged();
					return __PInvoke(ptr, ptr2);
				}
			}
			finally
			{
				managedToUnmanagedIn.Free();
			}
			[DllImport("System.Globalization.Native", EntryPoint = "GlobalizationNative_GetSortHandle", ExactSpelling = true)]
			static extern unsafe ResultCode __PInvoke(byte*, nint*);
		}

		[DllImport("System.Globalization.Native", EntryPoint = "GlobalizationNative_CloseSortHandle", ExactSpelling = true)]
		[LibraryImport("System.Globalization.Native", EntryPoint = "GlobalizationNative_CloseSortHandle")]
		internal static extern void CloseSortHandle(nint P_0);

		[DllImport("System.Globalization.Native", CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_CompareString", ExactSpelling = true)]
		[LibraryImport("System.Globalization.Native", EntryPoint = "GlobalizationNative_CompareString", StringMarshalling = StringMarshalling.Utf16)]
		internal unsafe static extern int CompareString(nint P_0, char* P_1, int P_2, char* P_3, int P_4, CompareOptions P_5);

		[DllImport("System.Globalization.Native", CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_IndexOf", ExactSpelling = true)]
		[LibraryImport("System.Globalization.Native", EntryPoint = "GlobalizationNative_IndexOf", StringMarshalling = StringMarshalling.Utf16)]
		internal unsafe static extern int IndexOf(nint P_0, char* P_1, int P_2, char* P_3, int P_4, CompareOptions P_5, int* P_6);

		[DllImport("System.Globalization.Native", CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_LastIndexOf", ExactSpelling = true)]
		[LibraryImport("System.Globalization.Native", EntryPoint = "GlobalizationNative_LastIndexOf", StringMarshalling = StringMarshalling.Utf16)]
		internal unsafe static extern int LastIndexOf(nint P_0, char* P_1, int P_2, char* P_3, int P_4, CompareOptions P_5, int* P_6);

		[MethodImpl(MethodImplOptions.NoInlining)]
		[LibraryImport("System.Globalization.Native", EntryPoint = "GlobalizationNative_StartsWith", StringMarshalling = StringMarshalling.Utf16)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		[return: MarshalAs(UnmanagedType.Bool)]
		internal unsafe static bool StartsWith(nint P_0, char* P_1, int P_2, char* P_3, int P_4, CompareOptions P_5, int* P_6)
		{
			int num = __PInvoke(P_0, P_1, P_2, P_3, P_4, P_5, P_6);
			return num != 0;
			[DllImport("System.Globalization.Native", EntryPoint = "GlobalizationNative_StartsWith", ExactSpelling = true)]
			static extern unsafe int __PInvoke(nint, char*, int, char*, int, CompareOptions, int*);
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		[LibraryImport("System.Globalization.Native", EntryPoint = "GlobalizationNative_EndsWith", StringMarshalling = StringMarshalling.Utf16)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		[return: MarshalAs(UnmanagedType.Bool)]
		internal unsafe static bool EndsWith(nint P_0, char* P_1, int P_2, char* P_3, int P_4, CompareOptions P_5, int* P_6)
		{
			int num = __PInvoke(P_0, P_1, P_2, P_3, P_4, P_5, P_6);
			return num != 0;
			[DllImport("System.Globalization.Native", EntryPoint = "GlobalizationNative_EndsWith", ExactSpelling = true)]
			static extern unsafe int __PInvoke(nint, char*, int, char*, int, CompareOptions, int*);
		}

		[DllImport("System.Globalization.Native", EntryPoint = "GlobalizationNative_LoadICU", ExactSpelling = true)]
		[LibraryImport("System.Globalization.Native", EntryPoint = "GlobalizationNative_LoadICU")]
		internal static extern int LoadICU();

		internal static void InitICUFunctions(nint P_0, nint P_1, ReadOnlySpan<char> P_2, ReadOnlySpan<char> P_3)
		{
			InitICUFunctions(P_0, P_1, P_2.ToString(), (P_3.Length > 0) ? P_3.ToString() : null);
		}

		[LibraryImport("System.Globalization.Native", EntryPoint = "GlobalizationNative_InitICUFunctions", StringMarshalling = StringMarshalling.Utf8)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		internal unsafe static void InitICUFunctions(nint P_0, nint P_1, string P_2, string P_3)
		{
			byte* ptr = default(byte*);
			byte* ptr2 = default(byte*);
			Utf8StringMarshaller.ManagedToUnmanagedIn managedToUnmanagedIn = default(Utf8StringMarshaller.ManagedToUnmanagedIn);
			Utf8StringMarshaller.ManagedToUnmanagedIn managedToUnmanagedIn2 = default(Utf8StringMarshaller.ManagedToUnmanagedIn);
			try
			{
				Span<byte> span = stackalloc byte[256];
				managedToUnmanagedIn.FromManaged(P_3, span);
				span = stackalloc byte[256];
				managedToUnmanagedIn2.FromManaged(P_2, span);
				ptr2 = managedToUnmanagedIn.ToUnmanaged();
				ptr = managedToUnmanagedIn2.ToUnmanaged();
				__PInvoke(P_0, P_1, ptr, ptr2);
			}
			finally
			{
				managedToUnmanagedIn.Free();
				managedToUnmanagedIn2.Free();
			}
			[DllImport("System.Globalization.Native", EntryPoint = "GlobalizationNative_InitICUFunctions", ExactSpelling = true)]
			static extern unsafe void __PInvoke(nint, nint, byte*, byte*);
		}

		[LibraryImport("System.Globalization.Native", EntryPoint = "GlobalizationNative_GetLocaleName", StringMarshalling = StringMarshalling.Utf16)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		[return: MarshalAs(UnmanagedType.Bool)]
		internal unsafe static bool GetLocaleName(string P_0, char* P_1, int P_2)
		{
			int num;
			fixed (char* ptr = &Utf16StringMarshaller.GetPinnableReference(P_0))
			{
				void* ptr2 = ptr;
				num = __PInvoke((ushort*)ptr2, P_1, P_2);
			}
			return num != 0;
			[DllImport("System.Globalization.Native", EntryPoint = "GlobalizationNative_GetLocaleName", ExactSpelling = true)]
			static extern unsafe int __PInvoke(ushort*, char*, int);
		}

		[LibraryImport("System.Globalization.Native", EntryPoint = "GlobalizationNative_GetLocaleInfoString", StringMarshalling = StringMarshalling.Utf16)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		[return: MarshalAs(UnmanagedType.Bool)]
		internal unsafe static bool GetLocaleInfoString(string P_0, uint P_1, char* P_2, int P_3, string P_4 = null)
		{
			int num;
			fixed (char* ptr = &Utf16StringMarshaller.GetPinnableReference(P_4))
			{
				void* ptr2 = ptr;
				fixed (char* ptr3 = &Utf16StringMarshaller.GetPinnableReference(P_0))
				{
					void* ptr4 = ptr3;
					num = __PInvoke((ushort*)ptr4, P_1, P_2, P_3, (ushort*)ptr2);
				}
			}
			return num != 0;
			[DllImport("System.Globalization.Native", EntryPoint = "GlobalizationNative_GetLocaleInfoString", ExactSpelling = true)]
			static extern unsafe int __PInvoke(ushort*, uint, char*, int, ushort*);
		}

		[LibraryImport("System.Globalization.Native", EntryPoint = "GlobalizationNative_IsPredefinedLocale", StringMarshalling = StringMarshalling.Utf16)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		[return: MarshalAs(UnmanagedType.Bool)]
		internal unsafe static bool IsPredefinedLocale(string P_0)
		{
			int num;
			fixed (char* ptr = &Utf16StringMarshaller.GetPinnableReference(P_0))
			{
				void* ptr2 = ptr;
				num = __PInvoke((ushort*)ptr2);
			}
			return num != 0;
			[DllImport("System.Globalization.Native", EntryPoint = "GlobalizationNative_IsPredefinedLocale", ExactSpelling = true)]
			static extern unsafe int __PInvoke(ushort*);
		}

		[LibraryImport("System.Globalization.Native", EntryPoint = "GlobalizationNative_GetLocaleTimeFormat", StringMarshalling = StringMarshalling.Utf16)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		[return: MarshalAs(UnmanagedType.Bool)]
		internal unsafe static bool GetLocaleTimeFormat(string P_0, [MarshalAs(UnmanagedType.Bool)] bool P_1, char* P_2, int P_3)
		{
			int num = (P_1 ? 1 : 0);
			int num2;
			fixed (char* ptr = &Utf16StringMarshaller.GetPinnableReference(P_0))
			{
				void* ptr2 = ptr;
				num2 = __PInvoke((ushort*)ptr2, num, P_2, P_3);
			}
			return num2 != 0;
			[DllImport("System.Globalization.Native", EntryPoint = "GlobalizationNative_GetLocaleTimeFormat", ExactSpelling = true)]
			static extern unsafe int __PInvoke(ushort*, int, char*, int);
		}

		[LibraryImport("System.Globalization.Native", EntryPoint = "GlobalizationNative_GetLocaleInfoInt", StringMarshalling = StringMarshalling.Utf16)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		[return: MarshalAs(UnmanagedType.Bool)]
		internal unsafe static bool GetLocaleInfoInt(string P_0, uint P_1, ref int P_2)
		{
			int num;
			fixed (int* ptr3 = &P_2)
			{
				fixed (char* ptr = &Utf16StringMarshaller.GetPinnableReference(P_0))
				{
					void* ptr2 = ptr;
					num = __PInvoke((ushort*)ptr2, P_1, ptr3);
				}
			}
			return num != 0;
			[DllImport("System.Globalization.Native", EntryPoint = "GlobalizationNative_GetLocaleInfoInt", ExactSpelling = true)]
			static extern unsafe int __PInvoke(ushort*, uint, int*);
		}

		[LibraryImport("System.Globalization.Native", EntryPoint = "GlobalizationNative_GetLocaleInfoGroupingSizes", StringMarshalling = StringMarshalling.Utf16)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		[return: MarshalAs(UnmanagedType.Bool)]
		internal unsafe static bool GetLocaleInfoGroupingSizes(string P_0, uint P_1, ref int P_2, ref int P_3)
		{
			int num;
			fixed (int* ptr4 = &P_3)
			{
				fixed (int* ptr3 = &P_2)
				{
					fixed (char* ptr = &Utf16StringMarshaller.GetPinnableReference(P_0))
					{
						void* ptr2 = ptr;
						num = __PInvoke((ushort*)ptr2, P_1, ptr3, ptr4);
					}
				}
			}
			return num != 0;
			[DllImport("System.Globalization.Native", EntryPoint = "GlobalizationNative_GetLocaleInfoGroupingSizes", ExactSpelling = true)]
			static extern unsafe int __PInvoke(ushort*, uint, int*, int*);
		}

		[LibraryImport("System.Globalization.Native", EntryPoint = "GlobalizationNative_IanaIdToWindowsId", StringMarshalling = StringMarshalling.Utf16)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		internal unsafe static int IanaIdToWindowsId(string P_0, char* P_1, int P_2)
		{
			int result;
			fixed (char* ptr = &Utf16StringMarshaller.GetPinnableReference(P_0))
			{
				void* ptr2 = ptr;
				result = __PInvoke((ushort*)ptr2, P_1, P_2);
			}
			return result;
			[DllImport("System.Globalization.Native", EntryPoint = "GlobalizationNative_IanaIdToWindowsId", ExactSpelling = true)]
			static extern unsafe int __PInvoke(ushort*, char*, int);
		}
	}

	internal enum BOOL
	{
		FALSE,
		TRUE
	}

	internal static class Kernel32
	{
		internal struct OVERLAPPED_ENTRY
		{
			public nuint lpCompletionKey;

			public unsafe NativeOverlapped* lpOverlapped;

			public nuint Internal;

			public uint dwNumberOfBytesTransferred;
		}

		internal struct CONDITION_VARIABLE
		{
			private nint Ptr;
		}

		internal struct CRITICAL_SECTION
		{
			private nint DebugInfo;

			private int LockCount;

			private int RecursionCount;

			private nint OwningThread;

			private nint LockSemaphore;

			private nuint SpinCount;
		}

		internal struct FILE_ALLOCATION_INFO
		{
			internal long AllocationSize;
		}

		internal struct FILE_STANDARD_INFO
		{
			internal long AllocationSize;

			internal long EndOfFile;

			internal uint NumberOfLinks;

			internal BOOL DeletePending;

			internal BOOL Directory;
		}

		internal struct FILE_TIME
		{
			internal uint dwLowDateTime;

			internal uint dwHighDateTime;
		}

		internal enum FINDEX_INFO_LEVELS : uint
		{
			FindExInfoStandard,
			FindExInfoBasic,
			FindExInfoMaxInfoLevel
		}

		internal enum FINDEX_SEARCH_OPS : uint
		{
			FindExSearchNameMatch,
			FindExSearchLimitToDirectories,
			FindExSearchLimitToDevices,
			FindExSearchMaxSearchOp
		}

		internal enum GET_FILEEX_INFO_LEVELS : uint
		{
			GetFileExInfoStandard,
			GetFileExMaxInfoLevel
		}

		internal struct CPINFO
		{
			internal int MaxCharSize;

			internal unsafe fixed byte DefaultChar[2];

			internal unsafe fixed byte LeadByte[12];
		}

		internal struct PROCESS_MEMORY_COUNTERS
		{
			public uint cb;

			public uint PageFaultCount;

			public nuint PeakWorkingSetSize;

			public nuint WorkingSetSize;

			public nuint QuotaPeakPagedPoolUsage;

			public nuint QuotaPagedPoolUsage;

			public nuint QuotaPeakNonPagedPoolUsage;

			public nuint QuotaNonPagedPoolUsage;

			public nuint PagefileUsage;

			public nuint PeakPagefileUsage;
		}

		internal struct SECURITY_ATTRIBUTES
		{
			internal uint nLength;

			internal unsafe void* lpSecurityDescriptor;

			internal BOOL bInheritHandle;
		}

		internal struct STORAGE_READ_CAPACITY
		{
			internal uint Version;

			internal uint Size;

			internal uint BlockLength;

			internal long NumberOfBlocks;

			internal long DiskLength;
		}

		internal struct SYSTEMTIME
		{
			internal ushort Year;

			internal ushort Month;

			internal ushort DayOfWeek;

			internal ushort Day;

			internal ushort Hour;

			internal ushort Minute;

			internal ushort Second;

			internal ushort Milliseconds;

			internal bool Equals(in SYSTEMTIME P_0)
			{
				if (Year == P_0.Year && Month == P_0.Month && DayOfWeek == P_0.DayOfWeek && Day == P_0.Day && Hour == P_0.Hour && Minute == P_0.Minute && Second == P_0.Second)
				{
					return Milliseconds == P_0.Milliseconds;
				}
				return false;
			}
		}

		[StructLayout(0, CharSet = CharSet.Unicode)]
		internal struct TIME_DYNAMIC_ZONE_INFORMATION
		{
			internal int Bias;

			internal unsafe fixed char StandardName[32];

			internal SYSTEMTIME StandardDate;

			internal int StandardBias;

			internal unsafe fixed char DaylightName[32];

			internal SYSTEMTIME DaylightDate;

			internal int DaylightBias;

			internal unsafe fixed char TimeZoneKeyName[128];

			internal byte DynamicDaylightTimeDisabled;

			internal unsafe string GetTimeZoneKeyName()
			{
				fixed (char* ptr = TimeZoneKeyName)
				{
					return new string(ptr);
				}
			}
		}

		[StructLayout(0, CharSet = CharSet.Unicode)]
		internal struct TIME_ZONE_INFORMATION
		{
			internal int Bias;

			internal unsafe fixed char StandardName[32];

			internal SYSTEMTIME StandardDate;

			internal int StandardBias;

			internal unsafe fixed char DaylightName[32];

			internal SYSTEMTIME DaylightDate;

			internal int DaylightBias;

			internal unsafe TIME_ZONE_INFORMATION(in TIME_DYNAMIC_ZONE_INFORMATION P_0)
			{
				fixed (TIME_ZONE_INFORMATION* ptr = &this)
				{
					fixed (TIME_DYNAMIC_ZONE_INFORMATION* ptr2 = &P_0)
					{
						*ptr = *(TIME_ZONE_INFORMATION*)ptr2;
					}
				}
			}

			internal unsafe string GetStandardName()
			{
				fixed (char* ptr = StandardName)
				{
					return new string(ptr);
				}
			}

			internal unsafe string GetDaylightName()
			{
				fixed (char* ptr = DaylightName)
				{
					return new string(ptr);
				}
			}
		}

		internal struct REG_TZI_FORMAT
		{
			internal int Bias;

			internal int StandardBias;

			internal int DaylightBias;

			internal SYSTEMTIME StandardDate;

			internal SYSTEMTIME DaylightDate;

			internal REG_TZI_FORMAT(in TIME_ZONE_INFORMATION P_0)
			{
				Bias = P_0.Bias;
				StandardDate = P_0.StandardDate;
				StandardBias = P_0.StandardBias;
				DaylightDate = P_0.DaylightDate;
				DaylightBias = P_0.DaylightBias;
			}
		}

		internal struct WIN32_FILE_ATTRIBUTE_DATA
		{
			internal int dwFileAttributes;

			internal FILE_TIME ftCreationTime;

			internal FILE_TIME ftLastAccessTime;

			internal FILE_TIME ftLastWriteTime;

			internal uint nFileSizeHigh;

			internal uint nFileSizeLow;

			internal void PopulateFrom(ref WIN32_FIND_DATA P_0)
			{
				dwFileAttributes = (int)P_0.dwFileAttributes;
				ftCreationTime = P_0.ftCreationTime;
				ftLastAccessTime = P_0.ftLastAccessTime;
				ftLastWriteTime = P_0.ftLastWriteTime;
				nFileSizeHigh = P_0.nFileSizeHigh;
				nFileSizeLow = P_0.nFileSizeLow;
			}
		}

		[StructLayout(0, CharSet = CharSet.Unicode)]
		internal struct WIN32_FIND_DATA
		{
			internal uint dwFileAttributes;

			internal FILE_TIME ftCreationTime;

			internal FILE_TIME ftLastAccessTime;

			internal FILE_TIME ftLastWriteTime;

			internal uint nFileSizeHigh;

			internal uint nFileSizeLow;

			internal uint dwReserved0;

			internal uint dwReserved1;

			private unsafe fixed char _cFileName[260];

			private unsafe fixed char _cAlternateFileName[14];
		}

		internal struct PROCESSOR_NUMBER
		{
			public ushort Group;

			public byte Number;

			public byte Reserved;
		}

		[DllImport("kernel32.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
		[LibraryImport("kernel32.dll", StringMarshalling = StringMarshalling.Utf16)]
		internal unsafe static extern int LCIDToLocaleName(int P_0, char* P_1, int P_2, uint P_3);

		[LibraryImport("kernel32.dll", StringMarshalling = StringMarshalling.Utf16)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		internal unsafe static int LocaleNameToLCID(string P_0, uint P_1)
		{
			int result;
			fixed (char* ptr = &Utf16StringMarshaller.GetPinnableReference(P_0))
			{
				void* ptr2 = ptr;
				result = __PInvoke((ushort*)ptr2, P_1);
			}
			return result;
			[DllImport("kernel32.dll", EntryPoint = "LocaleNameToLCID", ExactSpelling = true)]
			static extern unsafe int __PInvoke(ushort*, uint);
		}

		[LibraryImport("kernel32.dll", SetLastError = true, StringMarshalling = StringMarshalling.Utf16)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		internal unsafe static int LCMapStringEx(string P_0, uint P_1, char* P_2, int P_3, void* P_4, int P_5, void* P_6, void* P_7, nint P_8)
		{
			int result;
			int lastSystemError;
			fixed (char* ptr = &Utf16StringMarshaller.GetPinnableReference(P_0))
			{
				void* ptr2 = ptr;
				Marshal.SetLastSystemError(0);
				result = __PInvoke((ushort*)ptr2, P_1, P_2, P_3, P_4, P_5, P_6, P_7, P_8);
				lastSystemError = Marshal.GetLastSystemError();
			}
			Marshal.SetLastPInvokeError(lastSystemError);
			return result;
			[DllImport("kernel32.dll", EntryPoint = "LCMapStringEx", ExactSpelling = true)]
			static extern unsafe int __PInvoke(ushort*, uint, char*, int, void*, int, void*, void*, nint);
		}

		[DllImport("kernel32.dll", ExactSpelling = true)]
		[LibraryImport("kernel32.dll", EntryPoint = "FindNLSStringEx", SetLastError = false)]
		internal unsafe static extern int FindNLSStringEx(char* P_0, uint P_1, char* P_2, int P_3, char* P_4, int P_5, int* P_6, void* P_7, void* P_8, nint P_9);

		[DllImport("kernel32.dll", ExactSpelling = true)]
		[LibraryImport("kernel32.dll", EntryPoint = "CompareStringEx")]
		internal unsafe static extern int CompareStringEx(char* P_0, uint P_1, char* P_2, int P_3, char* P_4, int P_5, void* P_6, void* P_7, nint P_8);

		[LibraryImport("kernel32.dll", EntryPoint = "CompareStringOrdinal")]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		internal unsafe static int CompareStringOrdinal(char* P_0, int P_1, char* P_2, int P_3, [MarshalAs(UnmanagedType.Bool)] bool P_4)
		{
			int num = (P_4 ? 1 : 0);
			return __PInvoke(P_0, P_1, P_2, P_3, num);
			[DllImport("kernel32.dll", EntryPoint = "CompareStringOrdinal", ExactSpelling = true)]
			static extern unsafe int __PInvoke(char*, int, char*, int, int);
		}

		[DllImport("kernel32.dll", ExactSpelling = true)]
		[LibraryImport("kernel32.dll", EntryPoint = "FindStringOrdinal", SetLastError = false)]
		internal unsafe static extern int FindStringOrdinal(uint P_0, char* P_1, int P_2, char* P_3, int P_4, BOOL P_5);

		[DllImport("kernel32.dll", ExactSpelling = true)]
		[LibraryImport("kernel32.dll")]
		internal unsafe static extern BOOL GetUserPreferredUILanguages(uint P_0, uint* P_1, char* P_2, uint* P_3);

		[LibraryImport("kernel32.dll", StringMarshalling = StringMarshalling.Utf16)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		internal unsafe static int GetLocaleInfoEx(string P_0, uint P_1, void* P_2, int P_3)
		{
			int result;
			fixed (char* ptr = &Utf16StringMarshaller.GetPinnableReference(P_0))
			{
				void* ptr2 = ptr;
				result = __PInvoke((ushort*)ptr2, P_1, P_2, P_3);
			}
			return result;
			[DllImport("kernel32.dll", EntryPoint = "GetLocaleInfoEx", ExactSpelling = true)]
			static extern unsafe int __PInvoke(ushort*, uint, void*, int);
		}

		[LibraryImport("kernel32.dll", StringMarshalling = StringMarshalling.Utf16)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		[return: MarshalAs(UnmanagedType.Bool)]
		internal unsafe static bool EnumTimeFormatsEx(delegate* unmanaged<char*, void*, BOOL> P_0, string P_1, uint P_2, void* P_3)
		{
			int num;
			fixed (char* ptr = &Utf16StringMarshaller.GetPinnableReference(P_1))
			{
				void* ptr2 = ptr;
				num = __PInvoke(P_0, (ushort*)ptr2, P_2, P_3);
			}
			return num != 0;
			[DllImport("kernel32.dll", EntryPoint = "EnumTimeFormatsEx", ExactSpelling = true)]
			static extern unsafe int __PInvoke(delegate* unmanaged<char*, void*, BOOL>, ushort*, uint, void*);
		}

		[LibraryImport("kernel32.dll", StringMarshalling = StringMarshalling.Utf16)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		internal unsafe static int GetCalendarInfoEx(string P_0, uint P_1, nint P_2, uint P_3, nint P_4, int P_5, out int P_6)
		{
			Unsafe.SkipInit<int>(out P_6);
			int result;
			fixed (int* ptr3 = &P_6)
			{
				fixed (char* ptr = &Utf16StringMarshaller.GetPinnableReference(P_0))
				{
					void* ptr2 = ptr;
					result = __PInvoke((ushort*)ptr2, P_1, P_2, P_3, P_4, P_5, ptr3);
				}
			}
			return result;
			[DllImport("kernel32.dll", EntryPoint = "GetCalendarInfoEx", ExactSpelling = true)]
			static extern unsafe int __PInvoke(ushort*, uint, nint, uint, nint, int, int*);
		}

		[LibraryImport("kernel32.dll", StringMarshalling = StringMarshalling.Utf16)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		internal unsafe static int GetCalendarInfoEx(string P_0, uint P_1, nint P_2, uint P_3, nint P_4, int P_5, nint P_6)
		{
			int result;
			fixed (char* ptr = &Utf16StringMarshaller.GetPinnableReference(P_0))
			{
				void* ptr2 = ptr;
				result = __PInvoke((ushort*)ptr2, P_1, P_2, P_3, P_4, P_5, P_6);
			}
			return result;
			[DllImport("kernel32.dll", EntryPoint = "GetCalendarInfoEx", ExactSpelling = true)]
			static extern unsafe int __PInvoke(ushort*, uint, nint, uint, nint, int, nint);
		}

		[LibraryImport("kernel32.dll", StringMarshalling = StringMarshalling.Utf16)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		[return: MarshalAs(UnmanagedType.Bool)]
		internal unsafe static bool EnumCalendarInfoExEx(delegate* unmanaged<char*, uint, nint, void*, BOOL> P_0, string P_1, uint P_2, string P_3, uint P_4, void* P_5)
		{
			int num;
			fixed (char* ptr = &Utf16StringMarshaller.GetPinnableReference(P_3))
			{
				void* ptr2 = ptr;
				fixed (char* ptr3 = &Utf16StringMarshaller.GetPinnableReference(P_1))
				{
					void* ptr4 = ptr3;
					num = __PInvoke(P_0, (ushort*)ptr4, P_2, (ushort*)ptr2, P_4, P_5);
				}
			}
			return num != 0;
			[DllImport("kernel32.dll", EntryPoint = "EnumCalendarInfoExEx", ExactSpelling = true)]
			static extern unsafe int __PInvoke(delegate* unmanaged<char*, uint, nint, void*, BOOL>, ushort*, uint, ushort*, uint, void*);
		}

		[LibraryImport("kernel32.dll", StringMarshalling = StringMarshalling.Utf16)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		internal unsafe static int ResolveLocaleName(string P_0, char* P_1, int P_2)
		{
			int result;
			fixed (char* ptr = &Utf16StringMarshaller.GetPinnableReference(P_0))
			{
				void* ptr2 = ptr;
				result = __PInvoke((ushort*)ptr2, P_1, P_2);
			}
			return result;
			[DllImport("kernel32.dll", EntryPoint = "ResolveLocaleName", ExactSpelling = true)]
			static extern unsafe int __PInvoke(ushort*, char*, int);
		}

		[LibraryImport("kernel32.dll", SetLastError = true)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		[return: MarshalAs(UnmanagedType.Bool)]
		internal unsafe static bool CancelIoEx(SafeHandle P_0, NativeOverlapped* P_1)
		{
			nint num = 0;
			bool result = false;
			int num2 = 0;
			SafeHandleMarshaller<SafeHandle>.ManagedToUnmanagedIn managedToUnmanagedIn = default(SafeHandleMarshaller<SafeHandle>.ManagedToUnmanagedIn);
			int lastSystemError;
			try
			{
				managedToUnmanagedIn.FromManaged(P_0);
				num = managedToUnmanagedIn.ToUnmanaged();
				Marshal.SetLastSystemError(0);
				num2 = __PInvoke(num, P_1);
				lastSystemError = Marshal.GetLastSystemError();
				result = num2 != 0;
			}
			finally
			{
				managedToUnmanagedIn.Free();
			}
			Marshal.SetLastPInvokeError(lastSystemError);
			return result;
			[DllImport("kernel32.dll", EntryPoint = "CancelIoEx", ExactSpelling = true)]
			static extern unsafe int __PInvoke(nint, NativeOverlapped*);
		}

		[LibraryImport("kernel32.dll", SetLastError = true)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		[return: MarshalAs(UnmanagedType.Bool)]
		internal static bool CancelSynchronousIo(SafeThreadHandle P_0)
		{
			nint num = 0;
			bool result = false;
			int num2 = 0;
			SafeHandleMarshaller<SafeThreadHandle>.ManagedToUnmanagedIn managedToUnmanagedIn = default(SafeHandleMarshaller<SafeThreadHandle>.ManagedToUnmanagedIn);
			int lastSystemError;
			try
			{
				managedToUnmanagedIn.FromManaged(P_0);
				num = managedToUnmanagedIn.ToUnmanaged();
				Marshal.SetLastSystemError(0);
				num2 = __PInvoke(num);
				lastSystemError = Marshal.GetLastSystemError();
				result = num2 != 0;
			}
			finally
			{
				managedToUnmanagedIn.Free();
			}
			Marshal.SetLastPInvokeError(lastSystemError);
			return result;
			[DllImport("kernel32.dll", EntryPoint = "CancelSynchronousIo", ExactSpelling = true)]
			static extern int __PInvoke(nint);
		}

		[LibraryImport("kernel32.dll", SetLastError = true)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		internal static nint CreateIoCompletionPort(nint P_0, nint P_1, nuint P_2, int P_3)
		{
			Marshal.SetLastSystemError(0);
			nint result = __PInvoke(P_0, P_1, P_2, P_3);
			int lastSystemError = Marshal.GetLastSystemError();
			Marshal.SetLastPInvokeError(lastSystemError);
			return result;
			[DllImport("kernel32.dll", EntryPoint = "CreateIoCompletionPort", ExactSpelling = true)]
			static extern nint __PInvoke(nint, nint, nuint, int);
		}

		[LibraryImport("kernel32.dll", SetLastError = true)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		[return: MarshalAs(UnmanagedType.Bool)]
		internal static bool PostQueuedCompletionStatus(nint P_0, uint P_1, nuint P_2, nint P_3)
		{
			Marshal.SetLastSystemError(0);
			int num = __PInvoke(P_0, P_1, P_2, P_3);
			int lastSystemError = Marshal.GetLastSystemError();
			bool result = num != 0;
			Marshal.SetLastPInvokeError(lastSystemError);
			return result;
			[DllImport("kernel32.dll", EntryPoint = "PostQueuedCompletionStatus", ExactSpelling = true)]
			static extern int __PInvoke(nint, uint, nuint, nint);
		}

		[LibraryImport("kernel32.dll", SetLastError = true)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		[return: MarshalAs(UnmanagedType.Bool)]
		internal unsafe static bool GetQueuedCompletionStatus(nint P_0, out uint P_1, out nuint P_2, out nint P_3, int P_4)
		{
			Unsafe.SkipInit<uint>(out P_1);
			Unsafe.SkipInit<nuint>(out P_2);
			Unsafe.SkipInit<nint>(out P_3);
			int num;
			int lastSystemError;
			fixed (nint* ptr3 = &P_3)
			{
				fixed (nuint* ptr2 = &P_2)
				{
					fixed (uint* ptr = &P_1)
					{
						Marshal.SetLastSystemError(0);
						num = __PInvoke(P_0, ptr, ptr2, ptr3, P_4);
						lastSystemError = Marshal.GetLastSystemError();
					}
				}
			}
			bool result = num != 0;
			Marshal.SetLastPInvokeError(lastSystemError);
			return result;
			[DllImport("kernel32.dll", EntryPoint = "GetQueuedCompletionStatus", ExactSpelling = true)]
			static extern unsafe int __PInvoke(nint, uint*, nuint*, nint*, int);
		}

		[LibraryImport("kernel32.dll", SetLastError = true)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		[return: MarshalAs(UnmanagedType.Bool)]
		internal unsafe static bool GetQueuedCompletionStatusEx(nint P_0, OVERLAPPED_ENTRY* P_1, int P_2, out int P_3, int P_4, [MarshalAs(UnmanagedType.Bool)] bool P_5)
		{
			Unsafe.SkipInit<int>(out P_3);
			int num = (P_5 ? 1 : 0);
			int num2;
			int lastSystemError;
			fixed (int* ptr = &P_3)
			{
				Marshal.SetLastSystemError(0);
				num2 = __PInvoke(P_0, P_1, P_2, ptr, P_4, num);
				lastSystemError = Marshal.GetLastSystemError();
			}
			bool result = num2 != 0;
			Marshal.SetLastPInvokeError(lastSystemError);
			return result;
			[DllImport("kernel32.dll", EntryPoint = "GetQueuedCompletionStatusEx", ExactSpelling = true)]
			static extern unsafe int __PInvoke(nint, OVERLAPPED_ENTRY*, int, int*, int, int);
		}

		[DllImport("kernel32.dll", ExactSpelling = true)]
		[LibraryImport("kernel32.dll")]
		internal unsafe static extern void InitializeConditionVariable(CONDITION_VARIABLE* P_0);

		[DllImport("kernel32.dll", ExactSpelling = true)]
		[LibraryImport("kernel32.dll")]
		internal unsafe static extern void WakeConditionVariable(CONDITION_VARIABLE* P_0);

		[LibraryImport("kernel32.dll")]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		[return: MarshalAs(UnmanagedType.Bool)]
		internal unsafe static bool SleepConditionVariableCS(CONDITION_VARIABLE* P_0, CRITICAL_SECTION* P_1, int P_2)
		{
			int num = __PInvoke(P_0, P_1, P_2);
			return num != 0;
			[DllImport("kernel32.dll", EntryPoint = "SleepConditionVariableCS", ExactSpelling = true)]
			static extern unsafe int __PInvoke(CONDITION_VARIABLE*, CRITICAL_SECTION*, int);
		}

		[LibraryImport("kernel32.dll", EntryPoint = "CreateFileW", SetLastError = true, StringMarshalling = StringMarshalling.Utf16)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		private unsafe static SafeFileHandle CreateFilePrivate(string P_0, int P_1, FileShare P_2, SECURITY_ATTRIBUTES* P_3, FileMode P_4, int P_5, nint P_6)
		{
			bool flag = false;
			SafeFileHandle result = null;
			nint num = 0;
			SafeHandleMarshaller<SafeFileHandle>.ManagedToUnmanagedOut managedToUnmanagedOut = new SafeHandleMarshaller<SafeFileHandle>.ManagedToUnmanagedOut();
			int lastSystemError;
			try
			{
				fixed (char* ptr = &Utf16StringMarshaller.GetPinnableReference(P_0))
				{
					void* ptr2 = ptr;
					Marshal.SetLastSystemError(0);
					num = __PInvoke((ushort*)ptr2, P_1, P_2, P_3, P_4, P_5, P_6);
					lastSystemError = Marshal.GetLastSystemError();
				}
				flag = true;
				managedToUnmanagedOut.FromUnmanaged(num);
				result = managedToUnmanagedOut.ToManaged();
			}
			finally
			{
				if (flag)
				{
					managedToUnmanagedOut.Free();
				}
			}
			Marshal.SetLastPInvokeError(lastSystemError);
			return result;
			[DllImport("kernel32.dll", EntryPoint = "CreateFileW", ExactSpelling = true)]
			static extern unsafe nint __PInvoke(ushort*, int, FileShare, SECURITY_ATTRIBUTES*, FileMode, int, nint);
		}

		internal unsafe static SafeFileHandle CreateFile(string P_0, int P_1, FileShare P_2, SECURITY_ATTRIBUTES* P_3, FileMode P_4, int P_5, nint P_6)
		{
			P_0 = PathInternal.EnsureExtendedPrefixIfNeeded(P_0);
			return CreateFilePrivate(P_0, P_1, P_2, P_3, P_4, P_5, P_6);
		}

		[DllImport("kernel32.dll", ExactSpelling = true)]
		[LibraryImport("kernel32.dll")]
		internal unsafe static extern nint CreateThreadpoolTimer(delegate* unmanaged<void*, void*, void*, void> P_0, nint P_1, nint P_2);

		[DllImport("kernel32.dll", ExactSpelling = true)]
		[LibraryImport("kernel32.dll")]
		internal unsafe static extern nint SetThreadpoolTimer(nint P_0, long* P_1, uint P_2, uint P_3);

		[LibraryImport("kernel32.dll", SetLastError = true)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		internal unsafe static SafeThreadPoolIOHandle CreateThreadpoolIo(SafeHandle P_0, delegate* unmanaged<nint, nint, nint, uint, nuint, nint, void> P_1, nint P_2, nint P_3)
		{
			bool flag = false;
			nint num = 0;
			SafeThreadPoolIOHandle result = null;
			nint num2 = 0;
			SafeHandleMarshaller<SafeThreadPoolIOHandle>.ManagedToUnmanagedOut managedToUnmanagedOut = new SafeHandleMarshaller<SafeThreadPoolIOHandle>.ManagedToUnmanagedOut();
			SafeHandleMarshaller<SafeHandle>.ManagedToUnmanagedIn managedToUnmanagedIn = default(SafeHandleMarshaller<SafeHandle>.ManagedToUnmanagedIn);
			int lastSystemError;
			try
			{
				managedToUnmanagedIn.FromManaged(P_0);
				num = managedToUnmanagedIn.ToUnmanaged();
				Marshal.SetLastSystemError(0);
				num2 = __PInvoke(num, P_1, P_2, P_3);
				lastSystemError = Marshal.GetLastSystemError();
				flag = true;
				managedToUnmanagedOut.FromUnmanaged(num2);
				result = managedToUnmanagedOut.ToManaged();
			}
			finally
			{
				if (flag)
				{
					managedToUnmanagedOut.Free();
				}
				managedToUnmanagedIn.Free();
			}
			Marshal.SetLastPInvokeError(lastSystemError);
			return result;
			[DllImport("kernel32.dll", EntryPoint = "CreateThreadpoolIo", ExactSpelling = true)]
			static extern unsafe nint __PInvoke(nint, delegate* unmanaged<nint, nint, nint, uint, nuint, nint, void>, nint, nint);
		}

		[DllImport("kernel32.dll", ExactSpelling = true)]
		[LibraryImport("kernel32.dll")]
		internal static extern void CloseThreadpoolIo(nint P_0);

		[LibraryImport("kernel32.dll")]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		internal static void StartThreadpoolIo(SafeThreadPoolIOHandle P_0)
		{
			nint num = 0;
			SafeHandleMarshaller<SafeThreadPoolIOHandle>.ManagedToUnmanagedIn managedToUnmanagedIn = default(SafeHandleMarshaller<SafeThreadPoolIOHandle>.ManagedToUnmanagedIn);
			try
			{
				managedToUnmanagedIn.FromManaged(P_0);
				num = managedToUnmanagedIn.ToUnmanaged();
				__PInvoke(num);
			}
			finally
			{
				managedToUnmanagedIn.Free();
			}
			[DllImport("kernel32.dll", EntryPoint = "StartThreadpoolIo", ExactSpelling = true)]
			static extern void __PInvoke(nint);
		}

		[LibraryImport("kernel32.dll")]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		internal static void CancelThreadpoolIo(SafeThreadPoolIOHandle P_0)
		{
			nint num = 0;
			SafeHandleMarshaller<SafeThreadPoolIOHandle>.ManagedToUnmanagedIn managedToUnmanagedIn = default(SafeHandleMarshaller<SafeThreadPoolIOHandle>.ManagedToUnmanagedIn);
			try
			{
				managedToUnmanagedIn.FromManaged(P_0);
				num = managedToUnmanagedIn.ToUnmanaged();
				__PInvoke(num);
			}
			finally
			{
				managedToUnmanagedIn.Free();
			}
			[DllImport("kernel32.dll", EntryPoint = "CancelThreadpoolIo", ExactSpelling = true)]
			static extern void __PInvoke(nint);
		}

		[DllImport("kernel32.dll", ExactSpelling = true)]
		[LibraryImport("kernel32.dll")]
		internal unsafe static extern nint CreateThreadpoolWork(delegate* unmanaged<nint, nint, nint, void> P_0, nint P_1, nint P_2);

		[DllImport("kernel32.dll", ExactSpelling = true)]
		[LibraryImport("kernel32.dll")]
		internal static extern void SubmitThreadpoolWork(nint P_0);

		[DllImport("kernel32.dll", ExactSpelling = true)]
		[LibraryImport("kernel32.dll")]
		internal static extern void CloseThreadpoolWork(nint P_0);

		[LibraryImport("kernel32.dll", EntryPoint = "DeleteFileW", SetLastError = true, StringMarshalling = StringMarshalling.Utf16)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		[return: MarshalAs(UnmanagedType.Bool)]
		private unsafe static bool DeleteFilePrivate(string P_0)
		{
			int num;
			int lastSystemError;
			fixed (char* ptr = &Utf16StringMarshaller.GetPinnableReference(P_0))
			{
				void* ptr2 = ptr;
				Marshal.SetLastSystemError(0);
				num = __PInvoke((ushort*)ptr2);
				lastSystemError = Marshal.GetLastSystemError();
			}
			bool result = num != 0;
			Marshal.SetLastPInvokeError(lastSystemError);
			return result;
			[DllImport("kernel32.dll", EntryPoint = "DeleteFileW", ExactSpelling = true)]
			static extern unsafe int __PInvoke(ushort*);
		}

		internal static bool DeleteFile(string P_0)
		{
			P_0 = PathInternal.EnsureExtendedPrefixIfNeeded(P_0);
			return DeleteFilePrivate(P_0);
		}

		[DllImport("kernel32.dll", ExactSpelling = true)]
		[LibraryImport("kernel32.dll")]
		internal unsafe static extern void InitializeCriticalSection(CRITICAL_SECTION* P_0);

		[DllImport("kernel32.dll", ExactSpelling = true)]
		[LibraryImport("kernel32.dll")]
		internal unsafe static extern void EnterCriticalSection(CRITICAL_SECTION* P_0);

		[DllImport("kernel32.dll", ExactSpelling = true)]
		[LibraryImport("kernel32.dll")]
		internal unsafe static extern void LeaveCriticalSection(CRITICAL_SECTION* P_0);

		[DllImport("kernel32.dll", ExactSpelling = true)]
		[LibraryImport("kernel32.dll")]
		internal unsafe static extern void DeleteCriticalSection(CRITICAL_SECTION* P_0);

		[LibraryImport("kernel32.dll", EntryPoint = "DeviceIoControl", SetLastError = true)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		[return: MarshalAs(UnmanagedType.Bool)]
		internal unsafe static bool DeviceIoControl(SafeHandle P_0, uint P_1, void* P_2, uint P_3, void* P_4, uint P_5, out uint P_6, nint P_7)
		{
			Unsafe.SkipInit<uint>(out P_6);
			nint num = 0;
			bool result = false;
			int num2 = 0;
			SafeHandleMarshaller<SafeHandle>.ManagedToUnmanagedIn managedToUnmanagedIn = default(SafeHandleMarshaller<SafeHandle>.ManagedToUnmanagedIn);
			int lastSystemError;
			try
			{
				managedToUnmanagedIn.FromManaged(P_0);
				fixed (uint* ptr = &P_6)
				{
					num = managedToUnmanagedIn.ToUnmanaged();
					Marshal.SetLastSystemError(0);
					num2 = __PInvoke(num, P_1, P_2, P_3, P_4, P_5, ptr, P_7);
					lastSystemError = Marshal.GetLastSystemError();
				}
				result = num2 != 0;
			}
			finally
			{
				managedToUnmanagedIn.Free();
			}
			Marshal.SetLastPInvokeError(lastSystemError);
			return result;
			[DllImport("kernel32.dll", EntryPoint = "DeviceIoControl", ExactSpelling = true)]
			static extern unsafe int __PInvoke(nint, uint, void*, uint, void*, uint, uint*, nint);
		}

		[LibraryImport("kernel32.dll", EntryPoint = "ExpandEnvironmentStringsW", SetLastError = true, StringMarshalling = StringMarshalling.Utf16)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		internal unsafe static uint ExpandEnvironmentStrings(string P_0, ref char P_1, uint P_2)
		{
			uint result;
			int lastSystemError;
			fixed (char* ptr3 = &P_1)
			{
				fixed (char* ptr = &Utf16StringMarshaller.GetPinnableReference(P_0))
				{
					void* ptr2 = ptr;
					Marshal.SetLastSystemError(0);
					result = __PInvoke((ushort*)ptr2, ptr3, P_2);
					lastSystemError = Marshal.GetLastSystemError();
				}
			}
			Marshal.SetLastPInvokeError(lastSystemError);
			return result;
			[DllImport("kernel32.dll", EntryPoint = "ExpandEnvironmentStringsW", ExactSpelling = true)]
			static extern unsafe uint __PInvoke(ushort*, char*, uint);
		}

		[DllImport("kernel32.dll", ExactSpelling = true)]
		[LibraryImport("kernel32.dll")]
		[SuppressGCTransition]
		internal unsafe static extern BOOL FileTimeToSystemTime(ulong* P_0, SYSTEMTIME* P_1);

		[LibraryImport("kernel32.dll", SetLastError = true)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		[return: MarshalAs(UnmanagedType.Bool)]
		internal static bool FindClose(nint P_0)
		{
			Marshal.SetLastSystemError(0);
			int num = __PInvoke(P_0);
			int lastSystemError = Marshal.GetLastSystemError();
			bool result = num != 0;
			Marshal.SetLastPInvokeError(lastSystemError);
			return result;
			[DllImport("kernel32.dll", EntryPoint = "FindClose", ExactSpelling = true)]
			static extern int __PInvoke(nint);
		}

		[LibraryImport("kernel32.dll", EntryPoint = "FindFirstFileExW", SetLastError = true, StringMarshalling = StringMarshalling.Utf16)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		private unsafe static SafeFindHandle FindFirstFileExPrivate(string P_0, FINDEX_INFO_LEVELS P_1, ref WIN32_FIND_DATA P_2, FINDEX_SEARCH_OPS P_3, nint P_4, int P_5)
		{
			bool flag = false;
			SafeFindHandle result = null;
			nint num = 0;
			SafeHandleMarshaller<SafeFindHandle>.ManagedToUnmanagedOut managedToUnmanagedOut = new SafeHandleMarshaller<SafeFindHandle>.ManagedToUnmanagedOut();
			int lastSystemError;
			try
			{
				fixed (WIN32_FIND_DATA* ptr3 = &P_2)
				{
					fixed (char* ptr = &Utf16StringMarshaller.GetPinnableReference(P_0))
					{
						void* ptr2 = ptr;
						Marshal.SetLastSystemError(0);
						num = __PInvoke((ushort*)ptr2, P_1, ptr3, P_3, P_4, P_5);
						lastSystemError = Marshal.GetLastSystemError();
					}
				}
				flag = true;
				managedToUnmanagedOut.FromUnmanaged(num);
				result = managedToUnmanagedOut.ToManaged();
			}
			finally
			{
				if (flag)
				{
					managedToUnmanagedOut.Free();
				}
			}
			Marshal.SetLastPInvokeError(lastSystemError);
			return result;
			[DllImport("kernel32.dll", EntryPoint = "FindFirstFileExW", ExactSpelling = true)]
			static extern unsafe nint __PInvoke(ushort*, FINDEX_INFO_LEVELS, WIN32_FIND_DATA*, FINDEX_SEARCH_OPS, nint, int);
		}

		internal static SafeFindHandle FindFirstFile(string P_0, ref WIN32_FIND_DATA P_1)
		{
			P_0 = PathInternal.EnsureExtendedPrefixIfNeeded(P_0);
			return FindFirstFileExPrivate(P_0, FINDEX_INFO_LEVELS.FindExInfoBasic, ref P_1, FINDEX_SEARCH_OPS.FindExSearchNameMatch, IntPtr.Zero, 0);
		}

		[LibraryImport("kernel32.dll", SetLastError = true)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		[return: MarshalAs(UnmanagedType.Bool)]
		internal static bool FlushFileBuffers(SafeHandle P_0)
		{
			nint num = 0;
			bool result = false;
			int num2 = 0;
			SafeHandleMarshaller<SafeHandle>.ManagedToUnmanagedIn managedToUnmanagedIn = default(SafeHandleMarshaller<SafeHandle>.ManagedToUnmanagedIn);
			int lastSystemError;
			try
			{
				managedToUnmanagedIn.FromManaged(P_0);
				num = managedToUnmanagedIn.ToUnmanaged();
				Marshal.SetLastSystemError(0);
				num2 = __PInvoke(num);
				lastSystemError = Marshal.GetLastSystemError();
				result = num2 != 0;
			}
			finally
			{
				managedToUnmanagedIn.Free();
			}
			Marshal.SetLastPInvokeError(lastSystemError);
			return result;
			[DllImport("kernel32.dll", EntryPoint = "FlushFileBuffers", ExactSpelling = true)]
			static extern int __PInvoke(nint);
		}

		[LibraryImport("kernel32.dll", SetLastError = true)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		[return: MarshalAs(UnmanagedType.Bool)]
		internal static bool FreeLibrary(nint P_0)
		{
			Marshal.SetLastSystemError(0);
			int num = __PInvoke(P_0);
			int lastSystemError = Marshal.GetLastSystemError();
			bool result = num != 0;
			Marshal.SetLastPInvokeError(lastSystemError);
			return result;
			[DllImport("kernel32.dll", EntryPoint = "FreeLibrary", ExactSpelling = true)]
			static extern int __PInvoke(nint);
		}

		[DllImport("kernel32.dll", ExactSpelling = true)]
		[LibraryImport("kernel32.dll")]
		[SuppressGCTransition]
		internal static extern int GetLastError();

		[DllImport("kernel32.dll", ExactSpelling = true)]
		[LibraryImport("kernel32.dll")]
		internal unsafe static extern BOOL GetCPInfo(uint P_0, CPINFO* P_1);

		[DllImport("kernel32.dll", ExactSpelling = true)]
		[LibraryImport("kernel32.dll")]
		internal static extern nint GetCurrentProcess();

		[DllImport("kernel32.dll", ExactSpelling = true)]
		[LibraryImport("kernel32.dll")]
		internal static extern uint GetCurrentProcessId();

		[DllImport("kernel32.dll", ExactSpelling = true)]
		[LibraryImport("kernel32.dll")]
		[SuppressGCTransition]
		public static extern int GetCurrentThreadId();

		[LibraryImport("kernel32.dll", EntryPoint = "GetFileAttributesExW", SetLastError = true, StringMarshalling = StringMarshalling.Utf16)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		[return: MarshalAs(UnmanagedType.Bool)]
		private unsafe static bool GetFileAttributesExPrivate(string P_0, GET_FILEEX_INFO_LEVELS P_1, ref WIN32_FILE_ATTRIBUTE_DATA P_2)
		{
			int num;
			int lastSystemError;
			fixed (WIN32_FILE_ATTRIBUTE_DATA* ptr3 = &P_2)
			{
				fixed (char* ptr = &Utf16StringMarshaller.GetPinnableReference(P_0))
				{
					void* ptr2 = ptr;
					Marshal.SetLastSystemError(0);
					num = __PInvoke((ushort*)ptr2, P_1, ptr3);
					lastSystemError = Marshal.GetLastSystemError();
				}
			}
			bool result = num != 0;
			Marshal.SetLastPInvokeError(lastSystemError);
			return result;
			[DllImport("kernel32.dll", EntryPoint = "GetFileAttributesExW", ExactSpelling = true)]
			static extern unsafe int __PInvoke(ushort*, GET_FILEEX_INFO_LEVELS, WIN32_FILE_ATTRIBUTE_DATA*);
		}

		internal static bool GetFileAttributesEx(string P_0, GET_FILEEX_INFO_LEVELS P_1, ref WIN32_FILE_ATTRIBUTE_DATA P_2)
		{
			P_0 = PathInternal.EnsureExtendedPrefixIfNeeded(P_0);
			return GetFileAttributesExPrivate(P_0, P_1, ref P_2);
		}

		[LibraryImport("kernel32.dll", SetLastError = true)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		[return: MarshalAs(UnmanagedType.Bool)]
		internal unsafe static bool GetFileInformationByHandleEx(SafeFileHandle P_0, int P_1, void* P_2, uint P_3)
		{
			nint num = 0;
			bool result = false;
			int num2 = 0;
			SafeHandleMarshaller<SafeFileHandle>.ManagedToUnmanagedIn managedToUnmanagedIn = default(SafeHandleMarshaller<SafeFileHandle>.ManagedToUnmanagedIn);
			int lastSystemError;
			try
			{
				managedToUnmanagedIn.FromManaged(P_0);
				num = managedToUnmanagedIn.ToUnmanaged();
				Marshal.SetLastSystemError(0);
				num2 = __PInvoke(num, P_1, P_2, P_3);
				lastSystemError = Marshal.GetLastSystemError();
				result = num2 != 0;
			}
			finally
			{
				managedToUnmanagedIn.Free();
			}
			Marshal.SetLastPInvokeError(lastSystemError);
			return result;
			[DllImport("kernel32.dll", EntryPoint = "GetFileInformationByHandleEx", ExactSpelling = true)]
			static extern unsafe int __PInvoke(nint, int, void*, uint);
		}

		[LibraryImport("kernel32.dll", SetLastError = true)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		internal static int GetFileType(SafeHandle P_0)
		{
			nint num = 0;
			int result = 0;
			SafeHandleMarshaller<SafeHandle>.ManagedToUnmanagedIn managedToUnmanagedIn = default(SafeHandleMarshaller<SafeHandle>.ManagedToUnmanagedIn);
			int lastSystemError;
			try
			{
				managedToUnmanagedIn.FromManaged(P_0);
				num = managedToUnmanagedIn.ToUnmanaged();
				Marshal.SetLastSystemError(0);
				result = __PInvoke(num);
				lastSystemError = Marshal.GetLastSystemError();
			}
			finally
			{
				managedToUnmanagedIn.Free();
			}
			Marshal.SetLastPInvokeError(lastSystemError);
			return result;
			[DllImport("kernel32.dll", EntryPoint = "GetFileType", ExactSpelling = true)]
			static extern int __PInvoke(nint);
		}

		[LibraryImport("kernel32.dll", SetLastError = true, StringMarshalling = StringMarshalling.Utf16)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		internal unsafe static uint GetFullPathNameW(ref char P_0, uint P_1, ref char P_2, nint P_3)
		{
			uint result;
			int lastSystemError;
			fixed (char* ptr2 = &P_2)
			{
				fixed (char* ptr = &P_0)
				{
					Marshal.SetLastSystemError(0);
					result = __PInvoke(ptr, P_1, ptr2, P_3);
					lastSystemError = Marshal.GetLastSystemError();
				}
			}
			Marshal.SetLastPInvokeError(lastSystemError);
			return result;
			[DllImport("kernel32.dll", EntryPoint = "GetFullPathNameW", ExactSpelling = true)]
			static extern unsafe uint __PInvoke(char*, uint, char*, nint);
		}

		[LibraryImport("kernel32.dll", SetLastError = true, StringMarshalling = StringMarshalling.Utf16)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		internal unsafe static uint GetLongPathNameW(ref char P_0, ref char P_1, uint P_2)
		{
			uint result;
			int lastSystemError;
			fixed (char* ptr2 = &P_1)
			{
				fixed (char* ptr = &P_0)
				{
					Marshal.SetLastSystemError(0);
					result = __PInvoke(ptr, ptr2, P_2);
					lastSystemError = Marshal.GetLastSystemError();
				}
			}
			Marshal.SetLastPInvokeError(lastSystemError);
			return result;
			[DllImport("kernel32.dll", EntryPoint = "GetLongPathNameW", ExactSpelling = true)]
			static extern unsafe uint __PInvoke(char*, char*, uint);
		}

		[LibraryImport("kernel32.dll", SetLastError = true)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		[return: MarshalAs(UnmanagedType.Bool)]
		internal unsafe static bool GetOverlappedResult(SafeFileHandle P_0, NativeOverlapped* P_1, ref int P_2, [MarshalAs(UnmanagedType.Bool)] bool P_3)
		{
			nint num = 0;
			int num2 = 0;
			bool result = false;
			int num3 = 0;
			SafeHandleMarshaller<SafeFileHandle>.ManagedToUnmanagedIn managedToUnmanagedIn = default(SafeHandleMarshaller<SafeFileHandle>.ManagedToUnmanagedIn);
			int lastSystemError;
			try
			{
				num2 = (P_3 ? 1 : 0);
				managedToUnmanagedIn.FromManaged(P_0);
				fixed (int* ptr = &P_2)
				{
					num = managedToUnmanagedIn.ToUnmanaged();
					Marshal.SetLastSystemError(0);
					num3 = __PInvoke(num, P_1, ptr, num2);
					lastSystemError = Marshal.GetLastSystemError();
				}
				result = num3 != 0;
			}
			finally
			{
				managedToUnmanagedIn.Free();
			}
			Marshal.SetLastPInvokeError(lastSystemError);
			return result;
			[DllImport("kernel32.dll", EntryPoint = "GetOverlappedResult", ExactSpelling = true)]
			static extern unsafe int __PInvoke(nint, NativeOverlapped*, int*, int);
		}

		[LibraryImport("kernel32.dll", EntryPoint = "K32GetProcessMemoryInfo")]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		[return: MarshalAs(UnmanagedType.Bool)]
		internal unsafe static bool GetProcessMemoryInfo(nint P_0, ref PROCESS_MEMORY_COUNTERS P_1, uint P_2)
		{
			int num;
			fixed (PROCESS_MEMORY_COUNTERS* ptr = &P_1)
			{
				num = __PInvoke(P_0, ptr, P_2);
			}
			return num != 0;
			[DllImport("kernel32.dll", EntryPoint = "K32GetProcessMemoryInfo", ExactSpelling = true)]
			static extern unsafe int __PInvoke(nint, PROCESS_MEMORY_COUNTERS*, uint);
		}

		[LibraryImport("kernel32.dll", SetLastError = true)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		[return: MarshalAs(UnmanagedType.Bool)]
		internal unsafe static bool GetProcessTimes(nint P_0, out long P_1, out long P_2, out long P_3, out long P_4)
		{
			Unsafe.SkipInit<long>(out P_1);
			Unsafe.SkipInit<long>(out P_2);
			Unsafe.SkipInit<long>(out P_3);
			Unsafe.SkipInit<long>(out P_4);
			int num;
			int lastSystemError;
			fixed (long* ptr4 = &P_4)
			{
				fixed (long* ptr3 = &P_3)
				{
					fixed (long* ptr2 = &P_2)
					{
						fixed (long* ptr = &P_1)
						{
							Marshal.SetLastSystemError(0);
							num = __PInvoke(P_0, ptr, ptr2, ptr3, ptr4);
							lastSystemError = Marshal.GetLastSystemError();
						}
					}
				}
			}
			bool result = num != 0;
			Marshal.SetLastPInvokeError(lastSystemError);
			return result;
			[DllImport("kernel32.dll", EntryPoint = "GetProcessTimes", ExactSpelling = true)]
			static extern unsafe int __PInvoke(nint, long*, long*, long*, long*);
		}

		[LibraryImport("kernel32.dll", SetLastError = true, StringMarshalling = StringMarshalling.Utf16)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		internal unsafe static uint GetSystemDirectoryW(ref char P_0, uint P_1)
		{
			uint result;
			int lastSystemError;
			fixed (char* ptr = &P_0)
			{
				Marshal.SetLastSystemError(0);
				result = __PInvoke(ptr, P_1);
				lastSystemError = Marshal.GetLastSystemError();
			}
			Marshal.SetLastPInvokeError(lastSystemError);
			return result;
			[DllImport("kernel32.dll", EntryPoint = "GetSystemDirectoryW", ExactSpelling = true)]
			static extern unsafe uint __PInvoke(char*, uint);
		}

		[DllImport("kernel32.dll", ExactSpelling = true)]
		[LibraryImport("kernel32.dll")]
		[SuppressGCTransition]
		internal unsafe static extern void GetSystemTime(SYSTEMTIME* P_0);

		[LibraryImport("kernel32.dll", SetLastError = true)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		[return: MarshalAs(UnmanagedType.Bool)]
		internal unsafe static bool GetSystemTimes(out long P_0, out long P_1, out long P_2)
		{
			Unsafe.SkipInit<long>(out P_0);
			Unsafe.SkipInit<long>(out P_1);
			Unsafe.SkipInit<long>(out P_2);
			int num;
			int lastSystemError;
			fixed (long* ptr3 = &P_2)
			{
				fixed (long* ptr2 = &P_1)
				{
					fixed (long* ptr = &P_0)
					{
						Marshal.SetLastSystemError(0);
						num = __PInvoke(ptr, ptr2, ptr3);
						lastSystemError = Marshal.GetLastSystemError();
					}
				}
			}
			bool result = num != 0;
			Marshal.SetLastPInvokeError(lastSystemError);
			return result;
			[DllImport("kernel32.dll", EntryPoint = "GetSystemTimes", ExactSpelling = true)]
			static extern unsafe int __PInvoke(long*, long*, long*);
		}

		[LibraryImport("kernel32.dll", EntryPoint = "LoadLibraryExW", SetLastError = true, StringMarshalling = StringMarshalling.Utf16)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		internal unsafe static nint LoadLibraryEx(string P_0, nint P_1, int P_2)
		{
			nint result;
			int lastSystemError;
			fixed (char* ptr = &Utf16StringMarshaller.GetPinnableReference(P_0))
			{
				void* ptr2 = ptr;
				Marshal.SetLastSystemError(0);
				result = __PInvoke((ushort*)ptr2, P_1, P_2);
				lastSystemError = Marshal.GetLastSystemError();
			}
			Marshal.SetLastPInvokeError(lastSystemError);
			return result;
			[DllImport("kernel32.dll", EntryPoint = "LoadLibraryExW", ExactSpelling = true)]
			static extern unsafe nint __PInvoke(ushort*, nint, int);
		}

		[DllImport("kernel32.dll", ExactSpelling = true)]
		[LibraryImport("kernel32.dll")]
		private static extern nint LocalAlloc(uint P_0, nuint P_1);

		internal unsafe static void* LocalAlloc(nuint P_0)
		{
			return (void*)LocalAlloc(0u, P_0);
		}

		[DllImport("kernel32.dll", ExactSpelling = true)]
		[LibraryImport("kernel32.dll")]
		private static extern nint LocalFree(nint P_0);

		internal unsafe static void* LocalFree(void* P_0)
		{
			return (void*)LocalFree((nint)P_0);
		}

		[DllImport("kernel32.dll", ExactSpelling = true)]
		[LibraryImport("kernel32.dll")]
		internal unsafe static extern int MultiByteToWideChar(uint P_0, uint P_1, byte* P_2, int P_3, char* P_4, int P_5);

		[LibraryImport("kernel32.dll", SetLastError = true)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		internal static SafeThreadHandle OpenThread(int P_0, [MarshalAs(UnmanagedType.Bool)] bool P_1, int P_2)
		{
			bool flag = false;
			int num = 0;
			SafeThreadHandle result = null;
			nint num2 = 0;
			SafeHandleMarshaller<SafeThreadHandle>.ManagedToUnmanagedOut managedToUnmanagedOut = new SafeHandleMarshaller<SafeThreadHandle>.ManagedToUnmanagedOut();
			int lastSystemError;
			try
			{
				num = (P_1 ? 1 : 0);
				Marshal.SetLastSystemError(0);
				num2 = __PInvoke(P_0, num, P_2);
				lastSystemError = Marshal.GetLastSystemError();
				flag = true;
				managedToUnmanagedOut.FromUnmanaged(num2);
				result = managedToUnmanagedOut.ToManaged();
			}
			finally
			{
				if (flag)
				{
					managedToUnmanagedOut.Free();
				}
			}
			Marshal.SetLastPInvokeError(lastSystemError);
			return result;
			[DllImport("kernel32.dll", EntryPoint = "OpenThread", ExactSpelling = true)]
			static extern nint __PInvoke(int, int, int);
		}

		[DllImport("kernel32.dll", ExactSpelling = true)]
		[LibraryImport("kernel32.dll")]
		[SuppressGCTransition]
		internal unsafe static extern BOOL QueryPerformanceCounter(long* P_0);

		[DllImport("kernel32.dll", ExactSpelling = true)]
		[LibraryImport("kernel32.dll")]
		internal unsafe static extern BOOL QueryPerformanceFrequency(long* P_0);

		[LibraryImport("kernel32.dll")]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		[return: MarshalAs(UnmanagedType.Bool)]
		internal unsafe static bool QueryUnbiasedInterruptTime(out ulong P_0)
		{
			Unsafe.SkipInit<ulong>(out P_0);
			int num;
			fixed (ulong* ptr = &P_0)
			{
				num = __PInvoke(ptr);
			}
			return num != 0;
			[DllImport("kernel32.dll", EntryPoint = "QueryUnbiasedInterruptTime", ExactSpelling = true)]
			static extern unsafe int __PInvoke(ulong*);
		}

		[LibraryImport("kernel32.dll", SetLastError = true)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		internal unsafe static int ReadFile(SafeHandle P_0, byte* P_1, int P_2, nint P_3, NativeOverlapped* P_4)
		{
			nint num = 0;
			int result = 0;
			SafeHandleMarshaller<SafeHandle>.ManagedToUnmanagedIn managedToUnmanagedIn = default(SafeHandleMarshaller<SafeHandle>.ManagedToUnmanagedIn);
			int lastSystemError;
			try
			{
				managedToUnmanagedIn.FromManaged(P_0);
				num = managedToUnmanagedIn.ToUnmanaged();
				Marshal.SetLastSystemError(0);
				result = __PInvoke(num, P_1, P_2, P_3, P_4);
				lastSystemError = Marshal.GetLastSystemError();
			}
			finally
			{
				managedToUnmanagedIn.Free();
			}
			Marshal.SetLastPInvokeError(lastSystemError);
			return result;
			[DllImport("kernel32.dll", EntryPoint = "ReadFile", ExactSpelling = true)]
			static extern unsafe int __PInvoke(nint, byte*, int, nint, NativeOverlapped*);
		}

		[LibraryImport("kernel32.dll", SetLastError = true)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		internal unsafe static int ReadFile(SafeHandle P_0, byte* P_1, int P_2, out int P_3, NativeOverlapped* P_4)
		{
			Unsafe.SkipInit<int>(out P_3);
			nint num = 0;
			int result = 0;
			SafeHandleMarshaller<SafeHandle>.ManagedToUnmanagedIn managedToUnmanagedIn = default(SafeHandleMarshaller<SafeHandle>.ManagedToUnmanagedIn);
			int lastSystemError;
			try
			{
				managedToUnmanagedIn.FromManaged(P_0);
				fixed (int* ptr = &P_3)
				{
					num = managedToUnmanagedIn.ToUnmanaged();
					Marshal.SetLastSystemError(0);
					result = __PInvoke(num, P_1, P_2, ptr, P_4);
					lastSystemError = Marshal.GetLastSystemError();
				}
			}
			finally
			{
				managedToUnmanagedIn.Free();
			}
			Marshal.SetLastPInvokeError(lastSystemError);
			return result;
			[DllImport("kernel32.dll", EntryPoint = "ReadFile", ExactSpelling = true)]
			static extern unsafe int __PInvoke(nint, byte*, int, int*, NativeOverlapped*);
		}

		[LibraryImport("kernel32.dll", SetLastError = true)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		[return: MarshalAs(UnmanagedType.Bool)]
		internal unsafe static bool SetFileInformationByHandle(SafeFileHandle P_0, int P_1, void* P_2, uint P_3)
		{
			nint num = 0;
			bool result = false;
			int num2 = 0;
			SafeHandleMarshaller<SafeFileHandle>.ManagedToUnmanagedIn managedToUnmanagedIn = default(SafeHandleMarshaller<SafeFileHandle>.ManagedToUnmanagedIn);
			int lastSystemError;
			try
			{
				managedToUnmanagedIn.FromManaged(P_0);
				num = managedToUnmanagedIn.ToUnmanaged();
				Marshal.SetLastSystemError(0);
				num2 = __PInvoke(num, P_1, P_2, P_3);
				lastSystemError = Marshal.GetLastSystemError();
				result = num2 != 0;
			}
			finally
			{
				managedToUnmanagedIn.Free();
			}
			Marshal.SetLastPInvokeError(lastSystemError);
			return result;
			[DllImport("kernel32.dll", EntryPoint = "SetFileInformationByHandle", ExactSpelling = true)]
			static extern unsafe int __PInvoke(nint, int, void*, uint);
		}

		[LibraryImport("kernel32.dll", SetLastError = true)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		[return: MarshalAs(UnmanagedType.Bool)]
		internal unsafe static bool SetFilePointerEx(SafeFileHandle P_0, long P_1, out long P_2, uint P_3)
		{
			Unsafe.SkipInit<long>(out P_2);
			nint num = 0;
			bool result = false;
			int num2 = 0;
			SafeHandleMarshaller<SafeFileHandle>.ManagedToUnmanagedIn managedToUnmanagedIn = default(SafeHandleMarshaller<SafeFileHandle>.ManagedToUnmanagedIn);
			int lastSystemError;
			try
			{
				managedToUnmanagedIn.FromManaged(P_0);
				fixed (long* ptr = &P_2)
				{
					num = managedToUnmanagedIn.ToUnmanaged();
					Marshal.SetLastSystemError(0);
					num2 = __PInvoke(num, P_1, ptr, P_3);
					lastSystemError = Marshal.GetLastSystemError();
				}
				result = num2 != 0;
			}
			finally
			{
				managedToUnmanagedIn.Free();
			}
			Marshal.SetLastPInvokeError(lastSystemError);
			return result;
			[DllImport("kernel32.dll", EntryPoint = "SetFilePointerEx", ExactSpelling = true)]
			static extern unsafe int __PInvoke(nint, long, long*, uint);
		}

		[DllImport("kernel32.dll", ExactSpelling = true)]
		[LibraryImport("kernel32.dll")]
		[SuppressGCTransition]
		internal static extern void SetLastError(int P_0);

		[SuppressGCTransition]
		[LibraryImport("kernel32.dll", SetLastError = true)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		[return: MarshalAs(UnmanagedType.Bool)]
		internal unsafe static bool SetThreadErrorMode(uint P_0, out uint P_1)
		{
			Unsafe.SkipInit<uint>(out P_1);
			int num;
			int lastSystemError;
			fixed (uint* ptr = &P_1)
			{
				Marshal.SetLastSystemError(0);
				num = __PInvoke(P_0, ptr);
				lastSystemError = Marshal.GetLastSystemError();
			}
			bool result = num != 0;
			Marshal.SetLastPInvokeError(lastSystemError);
			return result;
			[DllImport("kernel32.dll", EntryPoint = "SetThreadErrorMode", ExactSpelling = true)]
			[SuppressGCTransition]
			static extern unsafe int __PInvoke(uint, uint*);
		}

		[DllImport("kernel32.dll", ExactSpelling = true)]
		[LibraryImport("kernel32.dll")]
		[SuppressGCTransition]
		internal unsafe static extern BOOL SystemTimeToFileTime(SYSTEMTIME* P_0, ulong* P_1);

		[DllImport("kernel32.dll", ExactSpelling = true)]
		[LibraryImport("kernel32.dll")]
		internal static extern nint GetCurrentThread();

		[LibraryImport("kernel32.dll", SetLastError = true)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		[return: MarshalAs(UnmanagedType.Bool)]
		internal unsafe static bool GetThreadIOPendingFlag(nint P_0, out BOOL P_1)
		{
			Unsafe.SkipInit<BOOL>(out P_1);
			int num;
			int lastSystemError;
			fixed (BOOL* ptr = &P_1)
			{
				Marshal.SetLastSystemError(0);
				num = __PInvoke(P_0, ptr);
				lastSystemError = Marshal.GetLastSystemError();
			}
			bool result = num != 0;
			Marshal.SetLastPInvokeError(lastSystemError);
			return result;
			[DllImport("kernel32.dll", EntryPoint = "GetThreadIOPendingFlag", ExactSpelling = true)]
			static extern unsafe int __PInvoke(nint, BOOL*);
		}

		[LibraryImport("kernel32.dll", SetLastError = true)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		internal unsafe static uint GetDynamicTimeZoneInformation(out TIME_DYNAMIC_ZONE_INFORMATION P_0)
		{
			Unsafe.SkipInit<TIME_DYNAMIC_ZONE_INFORMATION>(out P_0);
			uint result;
			int lastSystemError;
			fixed (TIME_DYNAMIC_ZONE_INFORMATION* ptr = &P_0)
			{
				Marshal.SetLastSystemError(0);
				result = __PInvoke(ptr);
				lastSystemError = Marshal.GetLastSystemError();
			}
			Marshal.SetLastPInvokeError(lastSystemError);
			return result;
			[DllImport("kernel32.dll", EntryPoint = "GetDynamicTimeZoneInformation", ExactSpelling = true)]
			static extern unsafe uint __PInvoke(TIME_DYNAMIC_ZONE_INFORMATION*);
		}

		[LibraryImport("kernel32.dll", SetLastError = true)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		internal unsafe static uint GetTimeZoneInformation(out TIME_ZONE_INFORMATION P_0)
		{
			Unsafe.SkipInit<TIME_ZONE_INFORMATION>(out P_0);
			uint result;
			int lastSystemError;
			fixed (TIME_ZONE_INFORMATION* ptr = &P_0)
			{
				Marshal.SetLastSystemError(0);
				result = __PInvoke(ptr);
				lastSystemError = Marshal.GetLastSystemError();
			}
			Marshal.SetLastPInvokeError(lastSystemError);
			return result;
			[DllImport("kernel32.dll", EntryPoint = "GetTimeZoneInformation", ExactSpelling = true)]
			static extern unsafe uint __PInvoke(TIME_ZONE_INFORMATION*);
		}

		[DllImport("kernel32.dll", ExactSpelling = true)]
		[LibraryImport("kernel32.dll")]
		internal unsafe static extern BOOL TzSpecificLocalTimeToSystemTime(nint P_0, SYSTEMTIME* P_1, SYSTEMTIME* P_2);

		[DllImport("kernel32.dll", ExactSpelling = true)]
		[LibraryImport("kernel32.dll")]
		internal unsafe static extern int WideCharToMultiByte(uint P_0, uint P_1, char* P_2, int P_3, byte* P_4, int P_5, byte* P_6, BOOL* P_7);

		[LibraryImport("kernel32.dll", SetLastError = true)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		internal unsafe static int WriteFile(SafeHandle P_0, byte* P_1, int P_2, nint P_3, NativeOverlapped* P_4)
		{
			nint num = 0;
			int result = 0;
			SafeHandleMarshaller<SafeHandle>.ManagedToUnmanagedIn managedToUnmanagedIn = default(SafeHandleMarshaller<SafeHandle>.ManagedToUnmanagedIn);
			int lastSystemError;
			try
			{
				managedToUnmanagedIn.FromManaged(P_0);
				num = managedToUnmanagedIn.ToUnmanaged();
				Marshal.SetLastSystemError(0);
				result = __PInvoke(num, P_1, P_2, P_3, P_4);
				lastSystemError = Marshal.GetLastSystemError();
			}
			finally
			{
				managedToUnmanagedIn.Free();
			}
			Marshal.SetLastPInvokeError(lastSystemError);
			return result;
			[DllImport("kernel32.dll", EntryPoint = "WriteFile", ExactSpelling = true)]
			static extern unsafe int __PInvoke(nint, byte*, int, nint, NativeOverlapped*);
		}

		[LibraryImport("kernel32.dll", SetLastError = true)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		internal unsafe static int WriteFile(SafeHandle P_0, byte* P_1, int P_2, out int P_3, NativeOverlapped* P_4)
		{
			Unsafe.SkipInit<int>(out P_3);
			nint num = 0;
			int result = 0;
			SafeHandleMarshaller<SafeHandle>.ManagedToUnmanagedIn managedToUnmanagedIn = default(SafeHandleMarshaller<SafeHandle>.ManagedToUnmanagedIn);
			int lastSystemError;
			try
			{
				managedToUnmanagedIn.FromManaged(P_0);
				fixed (int* ptr = &P_3)
				{
					num = managedToUnmanagedIn.ToUnmanaged();
					Marshal.SetLastSystemError(0);
					result = __PInvoke(num, P_1, P_2, ptr, P_4);
					lastSystemError = Marshal.GetLastSystemError();
				}
			}
			finally
			{
				managedToUnmanagedIn.Free();
			}
			Marshal.SetLastPInvokeError(lastSystemError);
			return result;
			[DllImport("kernel32.dll", EntryPoint = "WriteFile", ExactSpelling = true)]
			static extern unsafe int __PInvoke(nint, byte*, int, int*, NativeOverlapped*);
		}

		[LibraryImport("kernel32.dll")]
		[SuppressGCTransition]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		internal unsafe static uint GetCurrentProcessorNumberEx(out PROCESSOR_NUMBER P_0)
		{
			Unsafe.SkipInit<PROCESSOR_NUMBER>(out P_0);
			uint result;
			fixed (PROCESSOR_NUMBER* ptr = &P_0)
			{
				result = __PInvoke(ptr);
			}
			return result;
			[DllImport("kernel32.dll", EntryPoint = "GetCurrentProcessorNumberEx", ExactSpelling = true)]
			[SuppressGCTransition]
			static extern unsafe uint __PInvoke(PROCESSOR_NUMBER*);
		}

		[DllImport("kernel32.dll", ExactSpelling = true)]
		[LibraryImport("kernel32.dll")]
		internal static extern void Sleep(uint P_0);

		[LibraryImport("kernel32.dll", SetLastError = true)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		[return: MarshalAs(UnmanagedType.Bool)]
		internal static bool CloseHandle(nint P_0)
		{
			Marshal.SetLastSystemError(0);
			int num = __PInvoke(P_0);
			int lastSystemError = Marshal.GetLastSystemError();
			bool result = num != 0;
			Marshal.SetLastPInvokeError(lastSystemError);
			return result;
			[DllImport("kernel32.dll", EntryPoint = "CloseHandle", ExactSpelling = true)]
			static extern int __PInvoke(nint);
		}

		[LibraryImport("kernel32.dll", SetLastError = true)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		[return: MarshalAs(UnmanagedType.Bool)]
		internal static bool SetEvent(SafeWaitHandle P_0)
		{
			nint num = 0;
			bool result = false;
			int num2 = 0;
			SafeHandleMarshaller<SafeWaitHandle>.ManagedToUnmanagedIn managedToUnmanagedIn = default(SafeHandleMarshaller<SafeWaitHandle>.ManagedToUnmanagedIn);
			int lastSystemError;
			try
			{
				managedToUnmanagedIn.FromManaged(P_0);
				num = managedToUnmanagedIn.ToUnmanaged();
				Marshal.SetLastSystemError(0);
				num2 = __PInvoke(num);
				lastSystemError = Marshal.GetLastSystemError();
				result = num2 != 0;
			}
			finally
			{
				managedToUnmanagedIn.Free();
			}
			Marshal.SetLastPInvokeError(lastSystemError);
			return result;
			[DllImport("kernel32.dll", EntryPoint = "SetEvent", ExactSpelling = true)]
			static extern int __PInvoke(nint);
		}

		[LibraryImport("kernel32.dll", SetLastError = true)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		[return: MarshalAs(UnmanagedType.Bool)]
		internal static bool ResetEvent(SafeWaitHandle P_0)
		{
			nint num = 0;
			bool result = false;
			int num2 = 0;
			SafeHandleMarshaller<SafeWaitHandle>.ManagedToUnmanagedIn managedToUnmanagedIn = default(SafeHandleMarshaller<SafeWaitHandle>.ManagedToUnmanagedIn);
			int lastSystemError;
			try
			{
				managedToUnmanagedIn.FromManaged(P_0);
				num = managedToUnmanagedIn.ToUnmanaged();
				Marshal.SetLastSystemError(0);
				num2 = __PInvoke(num);
				lastSystemError = Marshal.GetLastSystemError();
				result = num2 != 0;
			}
			finally
			{
				managedToUnmanagedIn.Free();
			}
			Marshal.SetLastPInvokeError(lastSystemError);
			return result;
			[DllImport("kernel32.dll", EntryPoint = "ResetEvent", ExactSpelling = true)]
			static extern int __PInvoke(nint);
		}

		[LibraryImport("kernel32.dll", EntryPoint = "CreateEventExW", SetLastError = true, StringMarshalling = StringMarshalling.Utf16)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		internal unsafe static SafeWaitHandle CreateEventEx(nint P_0, string P_1, uint P_2, uint P_3)
		{
			bool flag = false;
			SafeWaitHandle result = null;
			nint num = 0;
			SafeHandleMarshaller<SafeWaitHandle>.ManagedToUnmanagedOut managedToUnmanagedOut = new SafeHandleMarshaller<SafeWaitHandle>.ManagedToUnmanagedOut();
			int lastSystemError;
			try
			{
				fixed (char* ptr = &Utf16StringMarshaller.GetPinnableReference(P_1))
				{
					void* ptr2 = ptr;
					Marshal.SetLastSystemError(0);
					num = __PInvoke(P_0, (ushort*)ptr2, P_2, P_3);
					lastSystemError = Marshal.GetLastSystemError();
				}
				flag = true;
				managedToUnmanagedOut.FromUnmanaged(num);
				result = managedToUnmanagedOut.ToManaged();
			}
			finally
			{
				if (flag)
				{
					managedToUnmanagedOut.Free();
				}
			}
			Marshal.SetLastPInvokeError(lastSystemError);
			return result;
			[DllImport("kernel32.dll", EntryPoint = "CreateEventExW", ExactSpelling = true)]
			static extern unsafe nint __PInvoke(nint, ushort*, uint, uint);
		}

		[LibraryImport("kernel32.dll", EntryPoint = "GetEnvironmentVariableW", SetLastError = true, StringMarshalling = StringMarshalling.Utf16)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		internal unsafe static uint GetEnvironmentVariable(string P_0, ref char P_1, uint P_2)
		{
			uint result;
			int lastSystemError;
			fixed (char* ptr3 = &P_1)
			{
				fixed (char* ptr = &Utf16StringMarshaller.GetPinnableReference(P_0))
				{
					void* ptr2 = ptr;
					Marshal.SetLastSystemError(0);
					result = __PInvoke((ushort*)ptr2, ptr3, P_2);
					lastSystemError = Marshal.GetLastSystemError();
				}
			}
			Marshal.SetLastPInvokeError(lastSystemError);
			return result;
			[DllImport("kernel32.dll", EntryPoint = "GetEnvironmentVariableW", ExactSpelling = true)]
			static extern unsafe uint __PInvoke(ushort*, char*, uint);
		}

		[LibraryImport("kernel32.dll", EntryPoint = "FormatMessageW", SetLastError = true)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		private unsafe static int FormatMessage(int P_0, nint P_1, uint P_2, int P_3, void* P_4, int P_5, nint P_6)
		{
			Marshal.SetLastSystemError(0);
			int result = __PInvoke(P_0, P_1, P_2, P_3, P_4, P_5, P_6);
			int lastSystemError = Marshal.GetLastSystemError();
			Marshal.SetLastPInvokeError(lastSystemError);
			return result;
			[DllImport("kernel32.dll", EntryPoint = "FormatMessageW", ExactSpelling = true)]
			static extern unsafe int __PInvoke(int, nint, uint, int, void*, int, nint);
		}

		internal static string GetMessage(int P_0)
		{
			return GetMessage(P_0, IntPtr.Zero);
		}

		internal unsafe static string GetMessage(int P_0, nint P_1)
		{
			int num = 12800;
			if (P_1 != IntPtr.Zero)
			{
				num |= 0x800;
			}
			Span<char> span = stackalloc char[256];
			fixed (char* ptr = span)
			{
				int num2 = FormatMessage(num, P_1, (uint)P_0, 0, ptr, span.Length, IntPtr.Zero);
				if (num2 > 0)
				{
					return GetAndTrimString(span.Slice(0, num2));
				}
			}
			if (Marshal.GetLastWin32Error() == 122)
			{
				nint num3 = 0;
				try
				{
					int num4 = FormatMessage(num | 0x100, P_1, (uint)P_0, 0, &num3, 0, IntPtr.Zero);
					if (num4 > 0)
					{
						return GetAndTrimString(new Span<char>((void*)num3, num4));
					}
				}
				finally
				{
					Marshal.FreeHGlobal(num3);
				}
			}
			return $"Unknown error (0x{P_0:x})";
		}

		private static string GetAndTrimString(Span<char> P_0)
		{
			int num = P_0.Length;
			while (num > 0 && P_0[num - 1] <= ' ')
			{
				num--;
			}
			return P_0.Slice(0, num).ToString();
		}
	}

	internal static class Advapi32
	{
		internal enum ActivityControl : uint
		{
			EVENT_ACTIVITY_CTRL_GET_ID = 1u,
			EVENT_ACTIVITY_CTRL_SET_ID,
			EVENT_ACTIVITY_CTRL_CREATE_ID,
			EVENT_ACTIVITY_CTRL_GET_SET_ID,
			EVENT_ACTIVITY_CTRL_CREATE_SET_ID
		}

		internal struct EVENT_FILTER_DESCRIPTOR
		{
			public long Ptr;

			public int Size;

			public int Type;
		}

		internal enum EVENT_INFO_CLASS
		{
			BinaryTrackInfo,
			SetEnableAllKeywords,
			SetTraits
		}

		internal enum TRACE_QUERY_INFO_CLASS
		{
			TraceGuidQueryList,
			TraceGuidQueryInfo,
			TraceGuidQueryProcess,
			TraceStackTracingInfo,
			MaxTraceSetInfoClass
		}

		internal struct TRACE_GUID_INFO
		{
			public int InstanceCount;

			public int Reserved;
		}

		internal struct TRACE_PROVIDER_INSTANCE_INFO
		{
			public int NextOffset;

			public int EnableCount;

			public int Pid;

			public int Flags;
		}

		internal struct TRACE_ENABLE_INFO
		{
			public int IsEnabled;

			public byte Level;

			public byte Reserved1;

			public ushort LoggerId;

			public int EnableProperty;

			public int Reserved2;

			public long MatchAnyKeyword;

			public long MatchAllKeyword;
		}

		[LibraryImport("advapi32.dll")]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		internal unsafe static int EventActivityIdControl(ActivityControl P_0, ref Guid P_1)
		{
			int result;
			fixed (Guid* ptr = &P_1)
			{
				result = __PInvoke(P_0, ptr);
			}
			return result;
			[DllImport("advapi32.dll", EntryPoint = "EventActivityIdControl", ExactSpelling = true)]
			static extern unsafe int __PInvoke(ActivityControl, Guid*);
		}

		[DllImport("advapi32.dll", ExactSpelling = true)]
		[LibraryImport("advapi32.dll")]
		internal unsafe static extern uint EventRegister(Guid* P_0, delegate* unmanaged<Guid*, int, byte, long, long, EVENT_FILTER_DESCRIPTOR*, void*, void> P_1, void* P_2, long* P_3);

		[DllImport("advapi32.dll", ExactSpelling = true)]
		[LibraryImport("advapi32.dll")]
		internal unsafe static extern int EventSetInformation(long P_0, EVENT_INFO_CLASS P_1, void* P_2, uint P_3);

		[LibraryImport("advapi32.dll")]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		internal unsafe static int EnumerateTraceGuidsEx(TRACE_QUERY_INFO_CLASS P_0, void* P_1, int P_2, void* P_3, int P_4, out int P_5)
		{
			Unsafe.SkipInit<int>(out P_5);
			int result;
			fixed (int* ptr = &P_5)
			{
				result = __PInvoke(P_0, P_1, P_2, P_3, P_4, ptr);
			}
			return result;
			[DllImport("advapi32.dll", EntryPoint = "EnumerateTraceGuidsEx", ExactSpelling = true)]
			static extern unsafe int __PInvoke(TRACE_QUERY_INFO_CLASS, void*, int, void*, int, int*);
		}

		[DllImport("advapi32.dll", ExactSpelling = true)]
		[LibraryImport("advapi32.dll")]
		internal static extern uint EventUnregister(long P_0);

		internal unsafe static int EventWriteTransfer(long P_0, in EventDescriptor P_1, Guid* P_2, Guid* P_3, int P_4, EventProvider.EventData* P_5)
		{
			int num = EventWriteTransfer_PInvoke(P_0, in P_1, P_2, P_3, P_4, P_5);
			if (num == 87 && P_3 == null)
			{
				Guid empty = Guid.Empty;
				num = EventWriteTransfer_PInvoke(P_0, in P_1, P_2, &empty, P_4, P_5);
			}
			return num;
		}

		[LibraryImport("advapi32.dll", EntryPoint = "EventWriteTransfer")]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		private unsafe static int EventWriteTransfer_PInvoke(long P_0, in EventDescriptor P_1, Guid* P_2, Guid* P_3, int P_4, EventProvider.EventData* P_5)
		{
			int result;
			fixed (EventDescriptor* ptr = &P_1)
			{
				result = __PInvoke(P_0, ptr, P_2, P_3, P_4, P_5);
			}
			return result;
			[DllImport("advapi32.dll", EntryPoint = "EventWriteTransfer", ExactSpelling = true)]
			static extern unsafe int __PInvoke(long, EventDescriptor*, Guid*, Guid*, int, EventProvider.EventData*);
		}

		[DllImport("advapi32.dll", ExactSpelling = true)]
		[LibraryImport("advapi32.dll")]
		internal static extern int RegCloseKey(nint P_0);

		[LibraryImport("advapi32.dll", EntryPoint = "RegEnumKeyExW", StringMarshalling = StringMarshalling.Utf16)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		internal unsafe static int RegEnumKeyEx(SafeRegistryHandle P_0, int P_1, ref char P_2, ref int P_3, int[] P_4, [Out] char[] P_5, int[] P_6, long[] P_7)
		{
			nint num = 0;
			int num2 = 0;
			SafeHandleMarshaller<SafeRegistryHandle>.ManagedToUnmanagedIn managedToUnmanagedIn = default(SafeHandleMarshaller<SafeRegistryHandle>.ManagedToUnmanagedIn);
			try
			{
				managedToUnmanagedIn.FromManaged(P_0);
				fixed (long* ptr = &ArrayMarshaller<long, long>.ManagedToUnmanagedIn.GetPinnableReference(P_7))
				{
					void* ptr2 = ptr;
					fixed (int* ptr3 = &ArrayMarshaller<int, int>.ManagedToUnmanagedIn.GetPinnableReference(P_6))
					{
						void* ptr4 = ptr3;
						fixed (char* ptr5 = &ArrayMarshaller<char, char>.ManagedToUnmanagedIn.GetPinnableReference(P_5))
						{
							void* ptr6 = ptr5;
							fixed (int* ptr7 = &ArrayMarshaller<int, int>.ManagedToUnmanagedIn.GetPinnableReference(P_4))
							{
								void* ptr8 = ptr7;
								fixed (int* ptr10 = &P_3)
								{
									fixed (char* ptr9 = &P_2)
									{
										num = managedToUnmanagedIn.ToUnmanaged();
										return __PInvoke(num, P_1, ptr9, ptr10, (int*)ptr8, (char*)ptr6, (int*)ptr4, (long*)ptr2);
									}
								}
							}
						}
					}
				}
			}
			finally
			{
				managedToUnmanagedIn.Free();
			}
			[DllImport("advapi32.dll", EntryPoint = "RegEnumKeyExW", ExactSpelling = true)]
			static extern unsafe int __PInvoke(nint, int, char*, int*, int*, char*, int*, long*);
		}

		[LibraryImport("advapi32.dll", EntryPoint = "RegEnumValueW", StringMarshalling = StringMarshalling.Utf16)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		internal unsafe static int RegEnumValue(SafeRegistryHandle P_0, int P_1, [Out] char[] P_2, ref int P_3, nint P_4, int[] P_5, byte[] P_6, int[] P_7)
		{
			nint num = 0;
			int num2 = 0;
			SafeHandleMarshaller<SafeRegistryHandle>.ManagedToUnmanagedIn managedToUnmanagedIn = default(SafeHandleMarshaller<SafeRegistryHandle>.ManagedToUnmanagedIn);
			try
			{
				managedToUnmanagedIn.FromManaged(P_0);
				fixed (int* ptr = &ArrayMarshaller<int, int>.ManagedToUnmanagedIn.GetPinnableReference(P_7))
				{
					void* ptr2 = ptr;
					fixed (byte* ptr3 = &ArrayMarshaller<byte, byte>.ManagedToUnmanagedIn.GetPinnableReference(P_6))
					{
						void* ptr4 = ptr3;
						fixed (int* ptr5 = &ArrayMarshaller<int, int>.ManagedToUnmanagedIn.GetPinnableReference(P_5))
						{
							void* ptr6 = ptr5;
							fixed (int* ptr9 = &P_3)
							{
								fixed (char* ptr7 = &ArrayMarshaller<char, char>.ManagedToUnmanagedIn.GetPinnableReference(P_2))
								{
									void* ptr8 = ptr7;
									num = managedToUnmanagedIn.ToUnmanaged();
									return __PInvoke(num, P_1, (char*)ptr8, ptr9, P_4, (int*)ptr6, (byte*)ptr4, (int*)ptr2);
								}
							}
						}
					}
				}
			}
			finally
			{
				managedToUnmanagedIn.Free();
			}
			[DllImport("advapi32.dll", EntryPoint = "RegEnumValueW", ExactSpelling = true)]
			static extern unsafe int __PInvoke(nint, int, char*, int*, nint, int*, byte*, int*);
		}

		[LibraryImport("advapi32.dll", EntryPoint = "RegOpenKeyExW", StringMarshalling = StringMarshalling.Utf16)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		internal unsafe static int RegOpenKeyEx(SafeRegistryHandle P_0, string P_1, int P_2, int P_3, out SafeRegistryHandle P_4)
		{
			bool flag = false;
			Unsafe.SkipInit<SafeRegistryHandle>(out P_4);
			nint num = 0;
			nint num2 = 0;
			int result = 0;
			SafeHandleMarshaller<SafeRegistryHandle>.ManagedToUnmanagedOut managedToUnmanagedOut = new SafeHandleMarshaller<SafeRegistryHandle>.ManagedToUnmanagedOut();
			SafeHandleMarshaller<SafeRegistryHandle>.ManagedToUnmanagedIn managedToUnmanagedIn = default(SafeHandleMarshaller<SafeRegistryHandle>.ManagedToUnmanagedIn);
			try
			{
				managedToUnmanagedIn.FromManaged(P_0);
				fixed (char* ptr = &Utf16StringMarshaller.GetPinnableReference(P_1))
				{
					void* ptr2 = ptr;
					num = managedToUnmanagedIn.ToUnmanaged();
					result = __PInvoke(num, (ushort*)ptr2, P_2, P_3, &num2);
				}
				flag = true;
				managedToUnmanagedOut.FromUnmanaged(num2);
				P_4 = managedToUnmanagedOut.ToManaged();
				return result;
			}
			finally
			{
				if (flag)
				{
					managedToUnmanagedOut.Free();
				}
				managedToUnmanagedIn.Free();
			}
			[DllImport("advapi32.dll", EntryPoint = "RegOpenKeyExW", ExactSpelling = true)]
			static extern unsafe int __PInvoke(nint, ushort*, int, int, nint*);
		}

		[LibraryImport("advapi32.dll", EntryPoint = "RegQueryValueExW", StringMarshalling = StringMarshalling.Utf16)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		internal unsafe static int RegQueryValueEx(SafeRegistryHandle P_0, string P_1, int* P_2, int* P_3, byte* P_4, uint* P_5)
		{
			nint num = 0;
			int num2 = 0;
			SafeHandleMarshaller<SafeRegistryHandle>.ManagedToUnmanagedIn managedToUnmanagedIn = default(SafeHandleMarshaller<SafeRegistryHandle>.ManagedToUnmanagedIn);
			try
			{
				managedToUnmanagedIn.FromManaged(P_0);
				fixed (char* ptr = &Utf16StringMarshaller.GetPinnableReference(P_1))
				{
					void* ptr2 = ptr;
					num = managedToUnmanagedIn.ToUnmanaged();
					return __PInvoke(num, (ushort*)ptr2, P_2, P_3, P_4, P_5);
				}
			}
			finally
			{
				managedToUnmanagedIn.Free();
			}
			[DllImport("advapi32.dll", EntryPoint = "RegQueryValueExW", ExactSpelling = true)]
			static extern unsafe int __PInvoke(nint, ushort*, int*, int*, byte*, uint*);
		}
	}

	internal static class BCrypt
	{
		internal enum NTSTATUS : uint
		{
			STATUS_SUCCESS = 0u,
			STATUS_UNSUCCESSFUL = 3221225473u,
			STATUS_NOT_FOUND = 3221226021u,
			STATUS_INVALID_PARAMETER = 3221225485u,
			STATUS_NO_MEMORY = 3221225495u,
			STATUS_BUFFER_TOO_SMALL = 3221225507u,
			STATUS_AUTH_TAG_MISMATCH = 3221266434u
		}

		[DllImport("BCrypt.dll", ExactSpelling = true)]
		[LibraryImport("BCrypt.dll")]
		internal unsafe static extern NTSTATUS BCryptGenRandom(nint P_0, byte* P_1, int P_2, int P_3);
	}

	internal enum BOOLEAN : byte
	{
		FALSE,
		TRUE
	}

	internal static class NtDll
	{
		public enum CreateOptions : uint
		{
			FILE_DIRECTORY_FILE = 1u,
			FILE_WRITE_THROUGH = 2u,
			FILE_SEQUENTIAL_ONLY = 4u,
			FILE_NO_INTERMEDIATE_BUFFERING = 8u,
			FILE_SYNCHRONOUS_IO_ALERT = 0x10u,
			FILE_SYNCHRONOUS_IO_NONALERT = 0x20u,
			FILE_NON_DIRECTORY_FILE = 0x40u,
			FILE_CREATE_TREE_CONNECTION = 0x80u,
			FILE_COMPLETE_IF_OPLOCKED = 0x100u,
			FILE_NO_EA_KNOWLEDGE = 0x200u,
			FILE_RANDOM_ACCESS = 0x800u,
			FILE_DELETE_ON_CLOSE = 0x1000u,
			FILE_OPEN_BY_FILE_ID = 0x2000u,
			FILE_OPEN_FOR_BACKUP_INTENT = 0x4000u,
			FILE_NO_COMPRESSION = 0x8000u,
			FILE_OPEN_REQUIRING_OPLOCK = 0x10000u,
			FILE_DISALLOW_EXCLUSIVE = 0x20000u,
			FILE_SESSION_AWARE = 0x40000u,
			FILE_RESERVE_OPFILTER = 0x100000u,
			FILE_OPEN_REPARSE_POINT = 0x200000u,
			FILE_OPEN_NO_RECALL = 0x400000u
		}

		public struct IO_STATUS_BLOCK
		{
			[StructLayout(2)]
			public struct IO_STATUS
			{
				[FieldOffset(0)]
				public uint Status;

				[FieldOffset(0)]
				public nint Pointer;
			}

			public IO_STATUS Status;

			public nint Information;
		}

		[StructLayout(0, CharSet = CharSet.Unicode)]
		internal struct RTL_OSVERSIONINFOEX
		{
			internal uint dwOSVersionInfoSize;

			internal uint dwMajorVersion;

			internal uint dwMinorVersion;

			internal uint dwBuildNumber;

			internal uint dwPlatformId;

			internal unsafe fixed char szCSDVersion[128];
		}

		internal struct SYSTEM_LEAP_SECOND_INFORMATION
		{
			public BOOLEAN Enabled;

			public uint Flags;
		}

		[DllImport("ntdll.dll", ExactSpelling = true)]
		[LibraryImport("ntdll.dll")]
		public static extern uint RtlNtStatusToDosError(int P_0);

		[LibraryImport("ntdll.dll")]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		internal unsafe static int NtQueryInformationFile(SafeFileHandle P_0, out IO_STATUS_BLOCK P_1, void* P_2, uint P_3, uint P_4)
		{
			Unsafe.SkipInit<IO_STATUS_BLOCK>(out P_1);
			nint num = 0;
			int num2 = 0;
			SafeHandleMarshaller<SafeFileHandle>.ManagedToUnmanagedIn managedToUnmanagedIn = default(SafeHandleMarshaller<SafeFileHandle>.ManagedToUnmanagedIn);
			try
			{
				managedToUnmanagedIn.FromManaged(P_0);
				fixed (IO_STATUS_BLOCK* ptr = &P_1)
				{
					num = managedToUnmanagedIn.ToUnmanaged();
					return __PInvoke(num, ptr, P_2, P_3, P_4);
				}
			}
			finally
			{
				managedToUnmanagedIn.Free();
			}
			[DllImport("ntdll.dll", EntryPoint = "NtQueryInformationFile", ExactSpelling = true)]
			static extern unsafe int __PInvoke(nint, IO_STATUS_BLOCK*, void*, uint, uint);
		}

		[DllImport("ntdll.dll", ExactSpelling = true)]
		[LibraryImport("ntdll.dll")]
		internal unsafe static extern uint NtQuerySystemInformation(int P_0, void* P_1, uint P_2, uint* P_3);

		[LibraryImport("ntdll.dll")]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		private unsafe static int RtlGetVersion(ref RTL_OSVERSIONINFOEX P_0)
		{
			int result;
			fixed (RTL_OSVERSIONINFOEX* ptr = &P_0)
			{
				result = __PInvoke(ptr);
			}
			return result;
			[DllImport("ntdll.dll", EntryPoint = "RtlGetVersion", ExactSpelling = true)]
			static extern unsafe int __PInvoke(RTL_OSVERSIONINFOEX*);
		}

		internal unsafe static int RtlGetVersionEx(out RTL_OSVERSIONINFOEX P_0)
		{
			P_0 = default(RTL_OSVERSIONINFOEX);
			P_0.dwOSVersionInfoSize = (uint)sizeof(RTL_OSVERSIONINFOEX);
			return RtlGetVersion(ref P_0);
		}
	}

	internal static class StatusOptions
	{
		internal static bool NT_SUCCESS(uint P_0)
		{
			return (int)P_0 >= 0;
		}
	}

	internal static class Ole32
	{
		[DllImport("ole32.dll", ExactSpelling = true)]
		[LibraryImport("ole32.dll")]
		internal static extern nint CoTaskMemAlloc(nuint P_0);

		[DllImport("ole32.dll", ExactSpelling = true)]
		[LibraryImport("ole32.dll")]
		internal static extern void CoTaskMemFree(nint P_0);
	}

	internal static class Ucrtbase
	{
		[DllImport("ucrtbase.dll", ExactSpelling = true)]
		[LibraryImport("ucrtbase.dll")]
		[UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvCdecl) })]
		internal unsafe static extern void free(void* P_0);

		[DllImport("ucrtbase.dll", ExactSpelling = true)]
		[LibraryImport("ucrtbase.dll")]
		[UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvCdecl) })]
		internal unsafe static extern void* malloc(nuint P_0);
	}

	internal static class User32
	{
		[LibraryImport("user32.dll", EntryPoint = "LoadStringW", SetLastError = true)]
		[GeneratedCode("Microsoft.Interop.LibraryImportGenerator", "8.0.10.11423")]
		internal unsafe static int LoadString(nint P_0, uint P_1, char* P_2, int P_3)
		{
			Marshal.SetLastSystemError(0);
			int result = __PInvoke(P_0, P_1, P_2, P_3);
			int lastSystemError = Marshal.GetLastSystemError();
			Marshal.SetLastPInvokeError(lastSystemError);
			return result;
			[DllImport("user32.dll", EntryPoint = "LoadStringW", ExactSpelling = true)]
			static extern unsafe int __PInvoke(nint, uint, char*, int);
		}
	}

	internal static bool CallStringMethod<TArg1, TArg2, TArg3>(SpanFunc<char, TArg1, TArg2, TArg3, Globalization.ResultCode> P_0, TArg1 P_1, TArg2 P_2, TArg3 P_3, out string P_4)
	{
		Span<char> span = stackalloc char[256];
		switch (P_0(span, P_1, P_2, P_3))
		{
		case Globalization.ResultCode.Success:
			P_4 = span.Slice(0, span.IndexOf('\0')).ToString();
			return true;
		case Globalization.ResultCode.InsufficientBuffer:
			span = new char[1280];
			if (P_0(span, P_1, P_2, P_3) == Globalization.ResultCode.Success)
			{
				P_4 = span.Slice(0, span.IndexOf('\0')).ToString();
				return true;
			}
			break;
		}
		P_4 = null;
		return false;
	}

	internal unsafe static void GetRandomBytes(byte* P_0, int P_1)
	{
		switch (BCrypt.BCryptGenRandom(IntPtr.Zero, P_0, P_1, 2))
		{
		case BCrypt.NTSTATUS.STATUS_NO_MEMORY:
			throw new OutOfMemoryException();
		default:
			throw new InvalidOperationException();
		case BCrypt.NTSTATUS.STATUS_SUCCESS:
			break;
		}
	}
}
namespace Microsoft.Win32.SafeHandles
{
	public abstract class SafeHandleZeroOrMinusOneIsInvalid : SafeHandle
	{
		public override bool IsInvalid
		{
			get
			{
				if (handle != IntPtr.Zero)
				{
					return handle == new IntPtr(-1);
				}
				return true;
			}
		}

		protected SafeHandleZeroOrMinusOneIsInvalid(bool P_0)
			: base(IntPtr.Zero, P_0)
		{
		}
	}
	public sealed class SafeFileHandle : SafeHandleZeroOrMinusOneIsInvalid
	{
		internal sealed class OverlappedValueTaskSource : IValueTaskSource<int>, IValueTaskSource
		{
			internal unsafe static readonly IOCompletionCallback s_ioCallback = IOCallback;

			internal readonly PreAllocatedOverlapped _preallocatedOverlapped;

			internal readonly SafeFileHandle _fileHandle;

			private OSFileStreamStrategy _strategy;

			internal MemoryHandle _memoryHandle;

			private int _bufferSize;

			internal ManualResetValueTaskSourceCore<int> _source;

			private unsafe NativeOverlapped* _overlapped;

			private CancellationTokenRegistration _cancellationRegistration;

			internal ulong _result;

			internal short Version => _source.Version;

			internal OverlappedValueTaskSource(SafeFileHandle P_0)
			{
				_fileHandle = P_0;
				_source.RunContinuationsAsynchronously = true;
				_preallocatedOverlapped = PreAllocatedOverlapped.UnsafeCreate(s_ioCallback, this, null);
			}

			internal void Dispose()
			{
				ReleaseResources();
				_preallocatedOverlapped.Dispose();
			}

			internal unsafe NativeOverlapped* PrepareForOperation(ReadOnlyMemory<byte> P_0, long P_1, OSFileStreamStrategy P_2 = null)
			{
				_result = 0uL;
				_strategy = P_2;
				_bufferSize = P_0.Length;
				_memoryHandle = P_0.Pin();
				_overlapped = _fileHandle.ThreadPoolBinding.AllocateNativeOverlapped(_preallocatedOverlapped);
				if (_fileHandle.CanSeek)
				{
					_overlapped->OffsetLow = (int)P_1;
					_overlapped->OffsetHigh = (int)(P_1 >> 32);
				}
				ret

System.Reflection.Metadata.dll

Decompiled 8 months ago
using System.Buffers;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.IO.Compression;
using System.IO.MemoryMappedFiles;
using System.Linq;
using System.Reflection;
using System.Reflection.Internal;
using System.Reflection.Metadata;
using System.Reflection.Metadata.Ecma335;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.ConstrainedExecution;
using System.Runtime.ExceptionServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Text;
using System.Threading;
using FxResources.System.Reflection.Metadata;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(/*Could not decode attribute arguments.*/)]
[assembly: TargetFramework(".NETCoreApp,Version=v8.0", FrameworkDisplayName = ".NET 8.0")]
[assembly: AssemblyMetadata("Serviceable", "True")]
[assembly: AssemblyMetadata("PreferInbox", "True")]
[assembly: AssemblyDefaultAlias("System.Reflection.Metadata")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: AssemblyMetadata("IsTrimmable", "True")]
[assembly: DefaultDllImportSearchPaths(/*Could not decode attribute arguments.*/)]
[assembly: AssemblyCompany("Microsoft Corporation")]
[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")]
[assembly: AssemblyDescription("This package provides a low-level .NET (ECMA-335) metadata reader and writer. It's geared for performance and is the ideal choice for building higher-level libraries that intend to provide their own object model, such as compilers. The metadata format is defined by the ECMA-335 - Common Language Infrastructure (CLI) specification.\r\n\r\nThe System.Reflection.Metadata library is built-in as part of the shared framework in .NET Runtime. The package can be installed when you need to use it in other target frameworks.")]
[assembly: AssemblyFileVersion("8.0.324.11423")]
[assembly: AssemblyInformationalVersion("8.0.3+9f4b1f5d664afdfc80e1508ab7ed099dff210fbd")]
[assembly: AssemblyProduct("Microsoft® .NET")]
[assembly: AssemblyTitle("System.Reflection.Metadata")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/dotnet/runtime")]
[assembly: AssemblyVersion("8.0.0.0")]
[module: RefSafetyRules(11)]
[module: NullablePublicOnly(true)]
[module: SkipLocalsInit]
namespace FxResources.System.Reflection.Metadata
{
	internal static class SR
	{
	}
}
namespace System
{
	internal static class SR
	{
		private static readonly bool s_usingResourceKeys;

		private static ResourceManager s_resourceManager;

		internal static ResourceManager ResourceManager
		{
			get
			{
				//IL_0013: Unknown result type (might be due to invalid IL or missing references)
				//IL_0018: Unknown result type (might be due to invalid IL or missing references)
				//IL_001e: Expected O, but got Unknown
				object obj = s_resourceManager;
				if (obj == null)
				{
					ResourceManager val = new ResourceManager(typeof(FxResources.System.Reflection.Metadata.SR));
					s_resourceManager = val;
					obj = (object)val;
				}
				return (ResourceManager)obj;
			}
		}

		internal static string ImageTooSmall => GetResourceString("ImageTooSmall");

		internal static string InvalidCorHeaderSize => GetResourceString("InvalidCorHeaderSize");

		internal static string InvalidHandle => GetResourceString("InvalidHandle");

		internal static string InvalidMetadataSectionSpan => GetResourceString("InvalidMetadataSectionSpan");

		internal static string InvalidPESignature => GetResourceString("InvalidPESignature");

		internal static string InvalidToken => GetResourceString("InvalidToken");

		internal static string PEImageNotAvailable => GetResourceString("PEImageNotAvailable");

		internal static string MissingDataDirectory => GetResourceString("MissingDataDirectory");

		internal static string SectionTooSmall => GetResourceString("SectionTooSmall");

		internal static string StreamMustSupportReadAndSeek => GetResourceString("StreamMustSupportReadAndSeek");

		internal static string UnknownFileFormat => GetResourceString("UnknownFileFormat");

		internal static string UnknownPEMagicValue => GetResourceString("UnknownPEMagicValue");

		internal static string MetadataTableNotSorted => GetResourceString("MetadataTableNotSorted");

		internal static string ModuleTableInvalidNumberOfRows => GetResourceString("ModuleTableInvalidNumberOfRows");

		internal static string UnknownTables => GetResourceString("UnknownTables");

		internal static string IllegalTablesInCompressedMetadataStream => GetResourceString("IllegalTablesInCompressedMetadataStream");

		internal static string TableRowCountSpaceTooSmall => GetResourceString("TableRowCountSpaceTooSmall");

		internal static string OutOfBoundsRead => GetResourceString("OutOfBoundsRead");

		internal static string MetadataHeaderTooSmall => GetResourceString("MetadataHeaderTooSmall");

		internal static string MetadataSignature => GetResourceString("MetadataSignature");

		internal static string NotEnoughSpaceForVersionString => GetResourceString("NotEnoughSpaceForVersionString");

		internal static string StreamHeaderTooSmall => GetResourceString("StreamHeaderTooSmall");

		internal static string NotEnoughSpaceForStreamHeaderName => GetResourceString("NotEnoughSpaceForStreamHeaderName");

		internal static string NotEnoughSpaceForStringStream => GetResourceString("NotEnoughSpaceForStringStream");

		internal static string NotEnoughSpaceForBlobStream => GetResourceString("NotEnoughSpaceForBlobStream");

		internal static string NotEnoughSpaceForGUIDStream => GetResourceString("NotEnoughSpaceForGUIDStream");

		internal static string NotEnoughSpaceForMetadataStream => GetResourceString("NotEnoughSpaceForMetadataStream");

		internal static string InvalidMetadataStreamFormat => GetResourceString("InvalidMetadataStreamFormat");

		internal static string MetadataTablesTooSmall => GetResourceString("MetadataTablesTooSmall");

		internal static string MetadataTableHeaderTooSmall => GetResourceString("MetadataTableHeaderTooSmall");

		internal static string WinMDMissingMscorlibRef => GetResourceString("WinMDMissingMscorlibRef");

		internal static string UnexpectedStreamEnd => GetResourceString("UnexpectedStreamEnd");

		internal static string InvalidNumberOfSections => GetResourceString("InvalidNumberOfSections");

		internal static string InvalidCompressedInteger => GetResourceString("InvalidCompressedInteger");

		internal static string InvalidDocumentName => GetResourceString("InvalidDocumentName");

		internal static string RowIdOrHeapOffsetTooLarge => GetResourceString("RowIdOrHeapOffsetTooLarge");

		internal static string StreamTooLarge => GetResourceString("StreamTooLarge");

		internal static string ImageTooSmallOrContainsInvalidOffsetOrCount => GetResourceString("ImageTooSmallOrContainsInvalidOffsetOrCount");

		internal static string MetadataStringDecoderEncodingMustBeUtf8 => GetResourceString("MetadataStringDecoderEncodingMustBeUtf8");

		internal static string InvalidRowCount => GetResourceString("InvalidRowCount");

		internal static string InvalidEntryPointToken => GetResourceString("InvalidEntryPointToken");

		internal static string SequencePointValueOutOfRange => GetResourceString("SequencePointValueOutOfRange");

		internal static string InvalidDirectoryRVA => GetResourceString("InvalidDirectoryRVA");

		internal static string InvalidDirectorySize => GetResourceString("InvalidDirectorySize");

		internal static string InvalidDebugDirectoryEntryCharacteristics => GetResourceString("InvalidDebugDirectoryEntryCharacteristics");

		internal static string UnexpectedCodeViewDataSignature => GetResourceString("UnexpectedCodeViewDataSignature");

		internal static string UnexpectedEmbeddedPortablePdbDataSignature => GetResourceString("UnexpectedEmbeddedPortablePdbDataSignature");

		internal static string UnexpectedDebugDirectoryType => GetResourceString("UnexpectedDebugDirectoryType");

		internal static string UnexpectedArrayLength => GetResourceString("UnexpectedArrayLength");

		internal static string SizeMismatch => GetResourceString("SizeMismatch");

		internal static string DataTooBig => GetResourceString("DataTooBig");

		internal static string UnsupportedFormatVersion => GetResourceString("UnsupportedFormatVersion");

		internal static bool UsingResourceKeys()
		{
			return s_usingResourceKeys;
		}

		private static string GetResourceString(string P_0)
		{
			if (UsingResourceKeys())
			{
				return P_0;
			}
			string result = null;
			try
			{
				result = ResourceManager.GetString(P_0);
			}
			catch (MissingManifestResourceException)
			{
			}
			return result;
		}

		internal static string Format(string P_0, object? P_1)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", new object[2] { P_0, P_1 });
			}
			return string.Format(P_0, P_1);
		}

		static SR()
		{
			System.Runtime.CompilerServices.Unsafe.SkipInit(out bool flag);
			s_usingResourceKeys = AppContext.TryGetSwitch("System.Resources.UseSystemResourceKeys", ref flag) && flag;
		}
	}
}
namespace System.Reflection
{
	internal static class Throw
	{
		[DoesNotReturn]
		internal static void InvalidCast()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			throw new InvalidCastException();
		}

		[DoesNotReturn]
		internal static void InvalidArgument(string P_0, string P_1)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			throw new ArgumentException(P_0, P_1);
		}

		[DoesNotReturn]
		internal static void InvalidToken()
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			throw new ArgumentException(SR.InvalidToken, "token");
		}

		[DoesNotReturn]
		internal static void ArgumentNull(string P_0)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			throw new ArgumentNullException(P_0);
		}

		[DoesNotReturn]
		internal static void ArgumentOutOfRange(string P_0)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			throw new ArgumentOutOfRangeException(P_0);
		}

		[DoesNotReturn]
		internal static void OutOfBounds()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			throw new BadImageFormatException(SR.OutOfBoundsRead);
		}

		[DoesNotReturn]
		internal static void InvalidHandle()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			throw new BadImageFormatException(SR.InvalidHandle);
		}

		[DoesNotReturn]
		internal static void InvalidCompressedInteger()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			throw new BadImageFormatException(SR.InvalidCompressedInteger);
		}

		[DoesNotReturn]
		internal static void ImageTooSmall()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			throw new BadImageFormatException(SR.ImageTooSmall);
		}

		[DoesNotReturn]
		internal static void ImageTooSmallOrContainsInvalidOffsetOrCount()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			throw new BadImageFormatException(SR.ImageTooSmallOrContainsInvalidOffsetOrCount);
		}

		[DoesNotReturn]
		internal static void ReferenceOverflow()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			throw new BadImageFormatException(SR.RowIdOrHeapOffsetTooLarge);
		}

		[DoesNotReturn]
		internal static void TableNotSorted(TableIndex P_0)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			throw new BadImageFormatException(SR.Format(SR.MetadataTableNotSorted, P_0));
		}

		[DoesNotReturn]
		internal static void InvalidOperation_PEImageNotAvailable()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			throw new InvalidOperationException(SR.PEImageNotAvailable);
		}

		[DoesNotReturn]
		internal static void SequencePointValueOutOfRange()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			throw new BadImageFormatException(SR.SequencePointValueOutOfRange);
		}

		[DoesNotReturn]
		internal static void PEReaderDisposed()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			throw new ObjectDisposedException("PEReader");
		}
	}
}
namespace System.Reflection.PortableExecutable
{
	public sealed class CoffHeader
	{
		[CompilerGenerated]
		private readonly Machine <Machine>k__BackingField;

		[CompilerGenerated]
		private readonly int <TimeDateStamp>k__BackingField;

		[CompilerGenerated]
		private readonly int <PointerToSymbolTable>k__BackingField;

		[CompilerGenerated]
		private readonly int <NumberOfSymbols>k__BackingField;

		[CompilerGenerated]
		private readonly short <SizeOfOptionalHeader>k__BackingField;

		[CompilerGenerated]
		private readonly Characteristics <Characteristics>k__BackingField;

		[field: CompilerGenerated]
		public short NumberOfSections
		{
			[CompilerGenerated]
			get;
		}

		internal CoffHeader(ref PEBinaryReader P_0)
		{
			<Machine>k__BackingField = (Machine)P_0.ReadUInt16();
			NumberOfSections = P_0.ReadInt16();
			<TimeDateStamp>k__BackingField = P_0.ReadInt32();
			<PointerToSymbolTable>k__BackingField = P_0.ReadInt32();
			<NumberOfSymbols>k__BackingField = P_0.ReadInt32();
			<SizeOfOptionalHeader>k__BackingField = P_0.ReadInt16();
			<Characteristics>k__BackingField = (Characteristics)P_0.ReadUInt16();
		}
	}
	[Flags]
	public enum CorFlags
	{
		ILOnly = 1,
		Requires32Bit = 2,
		ILLibrary = 4,
		StrongNameSigned = 8,
		NativeEntryPoint = 0x10,
		TrackDebugData = 0x10000,
		Prefers32Bit = 0x20000
	}
	public sealed class CorHeader
	{
		[CompilerGenerated]
		private readonly ushort <MajorRuntimeVersion>k__BackingField;

		[CompilerGenerated]
		private readonly ushort <MinorRuntimeVersion>k__BackingField;

		[CompilerGenerated]
		private readonly CorFlags <Flags>k__BackingField;

		[CompilerGenerated]
		private readonly int <EntryPointTokenOrRelativeVirtualAddress>k__BackingField;

		[CompilerGenerated]
		private readonly DirectoryEntry <ResourcesDirectory>k__BackingField;

		[CompilerGenerated]
		private readonly DirectoryEntry <StrongNameSignatureDirectory>k__BackingField;

		[CompilerGenerated]
		private readonly DirectoryEntry <CodeManagerTableDirectory>k__BackingField;

		[CompilerGenerated]
		private readonly DirectoryEntry <VtableFixupsDirectory>k__BackingField;

		[CompilerGenerated]
		private readonly DirectoryEntry <ExportAddressTableJumpsDirectory>k__BackingField;

		[CompilerGenerated]
		private readonly DirectoryEntry <ManagedNativeHeaderDirectory>k__BackingField;

		[field: CompilerGenerated]
		public DirectoryEntry MetadataDirectory
		{
			[CompilerGenerated]
			get;
		}

		internal CorHeader(ref PEBinaryReader P_0)
		{
			P_0.ReadInt32();
			<MajorRuntimeVersion>k__BackingField = P_0.ReadUInt16();
			<MinorRuntimeVersion>k__BackingField = P_0.ReadUInt16();
			MetadataDirectory = new DirectoryEntry(ref P_0);
			<Flags>k__BackingField = (CorFlags)P_0.ReadUInt32();
			<EntryPointTokenOrRelativeVirtualAddress>k__BackingField = P_0.ReadInt32();
			<ResourcesDirectory>k__BackingField = new DirectoryEntry(ref P_0);
			<StrongNameSignatureDirectory>k__BackingField = new DirectoryEntry(ref P_0);
			<CodeManagerTableDirectory>k__BackingField = new DirectoryEntry(ref P_0);
			<VtableFixupsDirectory>k__BackingField = new DirectoryEntry(ref P_0);
			<ExportAddressTableJumpsDirectory>k__BackingField = new DirectoryEntry(ref P_0);
			<ManagedNativeHeaderDirectory>k__BackingField = new DirectoryEntry(ref P_0);
		}
	}
	public readonly struct CodeViewDebugDirectoryData
	{
		[CompilerGenerated]
		private readonly int <Age>k__BackingField;

		[field: CompilerGenerated]
		public Guid Guid
		{
			[CompilerGenerated]
			get;
		}

		[field: CompilerGenerated]
		public string Path
		{
			[CompilerGenerated]
			get;
		}

		internal CodeViewDebugDirectoryData(Guid P_0, int P_1, string P_2)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			Path = P_2;
			Guid = P_0;
			<Age>k__BackingField = P_1;
		}
	}
	public readonly struct DebugDirectoryEntry
	{
		[field: CompilerGenerated]
		public uint Stamp
		{
			[CompilerGenerated]
			get;
		}

		[field: CompilerGenerated]
		public ushort MajorVersion
		{
			[CompilerGenerated]
			get;
		}

		[field: CompilerGenerated]
		public ushort MinorVersion
		{
			[CompilerGenerated]
			get;
		}

		[field: CompilerGenerated]
		public DebugDirectoryEntryType Type
		{
			[CompilerGenerated]
			get;
		}

		[field: CompilerGenerated]
		public int DataSize
		{
			[CompilerGenerated]
			get;
		}

		[field: CompilerGenerated]
		public int DataRelativeVirtualAddress
		{
			[CompilerGenerated]
			get;
		}

		[field: CompilerGenerated]
		public int DataPointer
		{
			[CompilerGenerated]
			get;
		}

		public bool IsPortableCodeView => MinorVersion == 20557;

		public DebugDirectoryEntry(uint P_0, ushort P_1, ushort P_2, DebugDirectoryEntryType P_3, int P_4, int P_5, int P_6)
		{
			Stamp = P_0;
			MajorVersion = P_1;
			MinorVersion = P_2;
			Type = P_3;
			DataSize = P_4;
			DataRelativeVirtualAddress = P_5;
			DataPointer = P_6;
		}
	}
	public enum DebugDirectoryEntryType
	{
		Unknown = 0,
		Coff = 1,
		CodeView = 2,
		Reproducible = 16,
		EmbeddedPortablePdb = 17,
		PdbChecksum = 19
	}
	public readonly struct DirectoryEntry
	{
		public readonly int RelativeVirtualAddress;

		public readonly int Size;

		internal DirectoryEntry(ref PEBinaryReader P_0)
		{
			RelativeVirtualAddress = P_0.ReadInt32();
			Size = P_0.ReadInt32();
		}
	}
	public enum Machine : ushort
	{
		Unknown = 0,
		I386 = 332,
		WceMipsV2 = 361,
		Alpha = 388,
		SH3 = 418,
		SH3Dsp = 419,
		SH3E = 420,
		SH4 = 422,
		SH5 = 424,
		Arm = 448,
		Thumb = 450,
		ArmThumb2 = 452,
		AM33 = 467,
		PowerPC = 496,
		PowerPCFP = 497,
		IA64 = 512,
		MIPS16 = 614,
		Alpha64 = 644,
		MipsFpu = 870,
		MipsFpu16 = 1126,
		Tricore = 1312,
		Ebc = 3772,
		Amd64 = 34404,
		M32R = 36929,
		Arm64 = 43620,
		LoongArch32 = 25138,
		LoongArch64 = 25188
	}
	internal readonly struct PEBinaryReader
	{
		private readonly long _startOffset;

		private readonly long _maxOffset;

		private readonly BinaryReader _reader;

		public int CurrentOffset => (int)(_reader.BaseStream.Position - _startOffset);

		public PEBinaryReader(Stream P_0, int P_1)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Expected O, but got Unknown
			_startOffset = P_0.Position;
			_maxOffset = _startOffset + P_1;
			_reader = new BinaryReader(P_0, Encoding.UTF8, true);
		}

		public void Seek(int P_0)
		{
			CheckBounds(_startOffset, P_0);
			_reader.BaseStream.Seek((long)P_0, (SeekOrigin)0);
		}

		public byte[] ReadBytes(int P_0)
		{
			CheckBounds(_reader.BaseStream.Position, P_0);
			return _reader.ReadBytes(P_0);
		}

		public byte ReadByte()
		{
			CheckBounds(1u);
			return _reader.ReadByte();
		}

		public short ReadInt16()
		{
			CheckBounds(2u);
			return _reader.ReadInt16();
		}

		public ushort ReadUInt16()
		{
			CheckBounds(2u);
			return _reader.ReadUInt16();
		}

		public int ReadInt32()
		{
			CheckBounds(4u);
			return _reader.ReadInt32();
		}

		public uint ReadUInt32()
		{
			CheckBounds(4u);
			return _reader.ReadUInt32();
		}

		public ulong ReadUInt64()
		{
			CheckBounds(8u);
			return _reader.ReadUInt64();
		}

		public string ReadNullPaddedUTF8(int P_0)
		{
			byte[] array = ReadBytes(P_0);
			int num = 0;
			for (int num2 = array.Length; num2 > 0; num2--)
			{
				if (array[num2 - 1] != 0)
				{
					num = num2;
					break;
				}
			}
			return Encoding.UTF8.GetString(array, 0, num);
		}

		private void CheckBounds(uint P_0)
		{
			if ((ulong)(_reader.BaseStream.Position + P_0) > (ulong)_maxOffset)
			{
				Throw.ImageTooSmall();
			}
		}

		private void CheckBounds(long P_0, int P_1)
		{
			if ((ulong)(P_0 + (uint)P_1) > (ulong)_maxOffset)
			{
				Throw.ImageTooSmallOrContainsInvalidOffsetOrCount();
			}
		}
	}
	[Flags]
	public enum Characteristics : ushort
	{
		RelocsStripped = 1,
		ExecutableImage = 2,
		LineNumsStripped = 4,
		LocalSymsStripped = 8,
		AggressiveWSTrim = 0x10,
		LargeAddressAware = 0x20,
		BytesReversedLo = 0x80,
		Bit32Machine = 0x100,
		DebugStripped = 0x200,
		RemovableRunFromSwap = 0x400,
		NetRunFromSwap = 0x800,
		System = 0x1000,
		Dll = 0x2000,
		UpSystemOnly = 0x4000,
		BytesReversedHi = 0x8000
	}
	public enum PEMagic : ushort
	{
		PE32 = 267,
		PE32Plus = 523
	}
	public enum Subsystem : ushort
	{
		Unknown = 0,
		Native = 1,
		WindowsGui = 2,
		WindowsCui = 3,
		OS2Cui = 5,
		PosixCui = 7,
		NativeWindows = 8,
		WindowsCEGui = 9,
		EfiApplication = 10,
		EfiBootServiceDriver = 11,
		EfiRuntimeDriver = 12,
		EfiRom = 13,
		Xbox = 14,
		WindowsBootApplication = 16
	}
	[Flags]
	public enum DllCharacteristics : ushort
	{
		ProcessInit = 1,
		ProcessTerm = 2,
		ThreadInit = 4,
		ThreadTerm = 8,
		HighEntropyVirtualAddressSpace = 0x20,
		DynamicBase = 0x40,
		ForceIntegrity = 0x80,
		NxCompatible = 0x100,
		NoIsolation = 0x200,
		NoSeh = 0x400,
		NoBind = 0x800,
		AppContainer = 0x1000,
		WdmDriver = 0x2000,
		ControlFlowGuard = 0x4000,
		TerminalServerAware = 0x8000
	}
	[Flags]
	public enum SectionCharacteristics : uint
	{
		TypeReg = 0u,
		TypeDSect = 1u,
		TypeNoLoad = 2u,
		TypeGroup = 4u,
		TypeNoPad = 8u,
		TypeCopy = 0x10u,
		ContainsCode = 0x20u,
		ContainsInitializedData = 0x40u,
		ContainsUninitializedData = 0x80u,
		LinkerOther = 0x100u,
		LinkerInfo = 0x200u,
		TypeOver = 0x400u,
		LinkerRemove = 0x800u,
		LinkerComdat = 0x1000u,
		MemProtected = 0x4000u,
		NoDeferSpecExc = 0x4000u,
		GPRel = 0x8000u,
		MemFardata = 0x8000u,
		MemSysheap = 0x10000u,
		MemPurgeable = 0x20000u,
		Mem16Bit = 0x20000u,
		MemLocked = 0x40000u,
		MemPreload = 0x80000u,
		Align1Bytes = 0x100000u,
		Align2Bytes = 0x200000u,
		Align4Bytes = 0x300000u,
		Align8Bytes = 0x400000u,
		Align16Bytes = 0x500000u,
		Align32Bytes = 0x600000u,
		Align64Bytes = 0x700000u,
		Align128Bytes = 0x800000u,
		Align256Bytes = 0x900000u,
		Align512Bytes = 0xA00000u,
		Align1024Bytes = 0xB00000u,
		Align2048Bytes = 0xC00000u,
		Align4096Bytes = 0xD00000u,
		Align8192Bytes = 0xE00000u,
		AlignMask = 0xF00000u,
		LinkerNRelocOvfl = 0x1000000u,
		MemDiscardable = 0x2000000u,
		MemNotCached = 0x4000000u,
		MemNotPaged = 0x8000000u,
		MemShared = 0x10000000u,
		MemExecute = 0x20000000u,
		MemRead = 0x40000000u,
		MemWrite = 0x80000000u
	}
	public sealed class PEHeader
	{
		[CompilerGenerated]
		private readonly PEMagic <Magic>k__BackingField;

		[CompilerGenerated]
		private readonly byte <MajorLinkerVersion>k__BackingField;

		[CompilerGenerated]
		private readonly byte <MinorLinkerVersion>k__BackingField;

		[CompilerGenerated]
		private readonly int <SizeOfCode>k__BackingField;

		[CompilerGenerated]
		private readonly int <SizeOfInitializedData>k__BackingField;

		[CompilerGenerated]
		private readonly int <SizeOfUninitializedData>k__BackingField;

		[CompilerGenerated]
		private readonly int <AddressOfEntryPoint>k__BackingField;

		[CompilerGenerated]
		private readonly int <BaseOfCode>k__BackingField;

		[CompilerGenerated]
		private readonly int <BaseOfData>k__BackingField;

		[CompilerGenerated]
		private readonly ulong <ImageBase>k__BackingField;

		[CompilerGenerated]
		private readonly int <SectionAlignment>k__BackingField;

		[CompilerGenerated]
		private readonly int <FileAlignment>k__BackingField;

		[CompilerGenerated]
		private readonly ushort <MajorOperatingSystemVersion>k__BackingField;

		[CompilerGenerated]
		private readonly ushort <MinorOperatingSystemVersion>k__BackingField;

		[CompilerGenerated]
		private readonly ushort <MajorImageVersion>k__BackingField;

		[CompilerGenerated]
		private readonly ushort <MinorImageVersion>k__BackingField;

		[CompilerGenerated]
		private readonly ushort <MajorSubsystemVersion>k__BackingField;

		[CompilerGenerated]
		private readonly ushort <MinorSubsystemVersion>k__BackingField;

		[CompilerGenerated]
		private readonly int <SizeOfImage>k__BackingField;

		[CompilerGenerated]
		private readonly int <SizeOfHeaders>k__BackingField;

		[CompilerGenerated]
		private readonly uint <CheckSum>k__BackingField;

		[CompilerGenerated]
		private readonly Subsystem <Subsystem>k__BackingField;

		[CompilerGenerated]
		private readonly DllCharacteristics <DllCharacteristics>k__BackingField;

		[CompilerGenerated]
		private readonly ulong <SizeOfStackReserve>k__BackingField;

		[CompilerGenerated]
		private readonly ulong <SizeOfStackCommit>k__BackingField;

		[CompilerGenerated]
		private readonly ulong <SizeOfHeapReserve>k__BackingField;

		[CompilerGenerated]
		private readonly ulong <SizeOfHeapCommit>k__BackingField;

		[CompilerGenerated]
		private readonly int <NumberOfRvaAndSizes>k__BackingField;

		[CompilerGenerated]
		private readonly DirectoryEntry <ExportTableDirectory>k__BackingField;

		[CompilerGenerated]
		private readonly DirectoryEntry <ImportTableDirectory>k__BackingField;

		[CompilerGenerated]
		private readonly DirectoryEntry <ResourceTableDirectory>k__BackingField;

		[CompilerGenerated]
		private readonly DirectoryEntry <ExceptionTableDirectory>k__BackingField;

		[CompilerGenerated]
		private readonly DirectoryEntry <CertificateTableDirectory>k__BackingField;

		[CompilerGenerated]
		private readonly DirectoryEntry <BaseRelocationTableDirectory>k__BackingField;

		[CompilerGenerated]
		private readonly DirectoryEntry <CopyrightTableDirectory>k__BackingField;

		[CompilerGenerated]
		private readonly DirectoryEntry <GlobalPointerTableDirectory>k__BackingField;

		[CompilerGenerated]
		private readonly DirectoryEntry <ThreadLocalStorageTableDirectory>k__BackingField;

		[CompilerGenerated]
		private readonly DirectoryEntry <LoadConfigTableDirectory>k__BackingField;

		[CompilerGenerated]
		private readonly DirectoryEntry <BoundImportTableDirectory>k__BackingField;

		[CompilerGenerated]
		private readonly DirectoryEntry <ImportAddressTableDirectory>k__BackingField;

		[CompilerGenerated]
		private readonly DirectoryEntry <DelayImportTableDirectory>k__BackingField;

		[field: CompilerGenerated]
		public DirectoryEntry DebugTableDirectory
		{
			[CompilerGenerated]
			get;
		}

		[field: CompilerGenerated]
		public DirectoryEntry CorHeaderTableDirectory
		{
			[CompilerGenerated]
			get;
		}

		internal PEHeader(ref PEBinaryReader P_0)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			PEMagic pEMagic = (PEMagic)P_0.ReadUInt16();
			if (pEMagic != PEMagic.PE32 && pEMagic != PEMagic.PE32Plus)
			{
				throw new BadImageFormatException(SR.UnknownPEMagicValue);
			}
			<Magic>k__BackingField = pEMagic;
			<MajorLinkerVersion>k__BackingField = P_0.ReadByte();
			<MinorLinkerVersion>k__BackingField = P_0.ReadByte();
			<SizeOfCode>k__BackingField = P_0.ReadInt32();
			<SizeOfInitializedData>k__BackingField = P_0.ReadInt32();
			<SizeOfUninitializedData>k__BackingField = P_0.ReadInt32();
			<AddressOfEntryPoint>k__BackingField = P_0.ReadInt32();
			<BaseOfCode>k__BackingField = P_0.ReadInt32();
			if (pEMagic == PEMagic.PE32Plus)
			{
				<BaseOfData>k__BackingField = 0;
			}
			else
			{
				<BaseOfData>k__BackingField = P_0.ReadInt32();
			}
			if (pEMagic == PEMagic.PE32Plus)
			{
				<ImageBase>k__BackingField = P_0.ReadUInt64();
			}
			else
			{
				<ImageBase>k__BackingField = P_0.ReadUInt32();
			}
			<SectionAlignment>k__BackingField = P_0.ReadInt32();
			<FileAlignment>k__BackingField = P_0.ReadInt32();
			<MajorOperatingSystemVersion>k__BackingField = P_0.ReadUInt16();
			<MinorOperatingSystemVersion>k__BackingField = P_0.ReadUInt16();
			<MajorImageVersion>k__BackingField = P_0.ReadUInt16();
			<MinorImageVersion>k__BackingField = P_0.ReadUInt16();
			<MajorSubsystemVersion>k__BackingField = P_0.ReadUInt16();
			<MinorSubsystemVersion>k__BackingField = P_0.ReadUInt16();
			P_0.ReadUInt32();
			<SizeOfImage>k__BackingField = P_0.ReadInt32();
			<SizeOfHeaders>k__BackingField = P_0.ReadInt32();
			<CheckSum>k__BackingField = P_0.ReadUInt32();
			<Subsystem>k__BackingField = (Subsystem)P_0.ReadUInt16();
			<DllCharacteristics>k__BackingField = (DllCharacteristics)P_0.ReadUInt16();
			if (pEMagic == PEMagic.PE32Plus)
			{
				<SizeOfStackReserve>k__BackingField = P_0.ReadUInt64();
				<SizeOfStackCommit>k__BackingField = P_0.ReadUInt64();
				<SizeOfHeapReserve>k__BackingField = P_0.ReadUInt64();
				<SizeOfHeapCommit>k__BackingField = P_0.ReadUInt64();
			}
			else
			{
				<SizeOfStackReserve>k__BackingField = P_0.ReadUInt32();
				<SizeOfStackCommit>k__BackingField = P_0.ReadUInt32();
				<SizeOfHeapReserve>k__BackingField = P_0.ReadUInt32();
				<SizeOfHeapCommit>k__BackingField = P_0.ReadUInt32();
			}
			P_0.ReadUInt32();
			<NumberOfRvaAndSizes>k__BackingField = P_0.ReadInt32();
			<ExportTableDirectory>k__BackingField = new DirectoryEntry(ref P_0);
			<ImportTableDirectory>k__BackingField = new DirectoryEntry(ref P_0);
			<ResourceTableDirectory>k__BackingField = new DirectoryEntry(ref P_0);
			<ExceptionTableDirectory>k__BackingField = new DirectoryEntry(ref P_0);
			<CertificateTableDirectory>k__BackingField = new DirectoryEntry(ref P_0);
			<BaseRelocationTableDirectory>k__BackingField = new DirectoryEntry(ref P_0);
			DebugTableDirectory = new DirectoryEntry(ref P_0);
			<CopyrightTableDirectory>k__BackingField = new DirectoryEntry(ref P_0);
			<GlobalPointerTableDirectory>k__BackingField = new DirectoryEntry(ref P_0);
			<ThreadLocalStorageTableDirectory>k__BackingField = new DirectoryEntry(ref P_0);
			<LoadConfigTableDirectory>k__BackingField = new DirectoryEntry(ref P_0);
			<BoundImportTableDirectory>k__BackingField = new DirectoryEntry(ref P_0);
			<ImportAddressTableDirectory>k__BackingField = new DirectoryEntry(ref P_0);
			<DelayImportTableDirectory>k__BackingField = new DirectoryEntry(ref P_0);
			CorHeaderTableDirectory = new DirectoryEntry(ref P_0);
			new DirectoryEntry(ref P_0);
		}
	}
	public sealed class PEHeaders
	{
		private readonly CoffHeader _coffHeader;

		private readonly PEHeader _peHeader;

		private readonly ImmutableArray<SectionHeader> _sectionHeaders;

		private readonly CorHeader _corHeader;

		private readonly bool _isLoadedImage;

		private readonly int _metadataStartOffset = -1;

		private readonly int _metadataSize;

		private readonly int _coffHeaderStartOffset = -1;

		private readonly int _corHeaderStartOffset = -1;

		private readonly int _peHeaderStartOffset = -1;

		public int MetadataStartOffset => _metadataStartOffset;

		public int MetadataSize => _metadataSize;

		public bool IsCoffOnly => _peHeader == null;

		public PEHeader? PEHeader => _peHeader;

		public ImmutableArray<SectionHeader> SectionHeaders => _sectionHeaders;

		public PEHeaders(Stream P_0, int P_1, bool P_2)
		{
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			if (P_0 == null)
			{
				Throw.ArgumentNull("peStream");
			}
			if (!P_0.CanRead || !P_0.CanSeek)
			{
				throw new ArgumentException(SR.StreamMustSupportReadAndSeek, "peStream");
			}
			_isLoadedImage = P_2;
			int andValidateSize = StreamExtensions.GetAndValidateSize(P_0, P_1, "peStream");
			PEBinaryReader pEBinaryReader = new PEBinaryReader(P_0, andValidateSize);
			SkipDosHeader(ref pEBinaryReader, out var flag);
			_coffHeaderStartOffset = pEBinaryReader.CurrentOffset;
			_coffHeader = new CoffHeader(ref pEBinaryReader);
			if (!flag)
			{
				_peHeaderStartOffset = pEBinaryReader.CurrentOffset;
				_peHeader = new PEHeader(ref pEBinaryReader);
			}
			_sectionHeaders = ReadSectionHeaders(ref pEBinaryReader);
			if (!flag && TryCalculateCorHeaderOffset(out var num))
			{
				_corHeaderStartOffset = num;
				pEBinaryReader.Seek(num);
				_corHeader = new CorHeader(ref pEBinaryReader);
			}
			CalculateMetadataLocation(andValidateSize, out _metadataStartOffset, out _metadataSize);
		}

		private bool TryCalculateCorHeaderOffset(out int P_0)
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			if (!TryGetDirectoryOffset(_peHeader.CorHeaderTableDirectory, out P_0, false))
			{
				P_0 = -1;
				return false;
			}
			int size = _peHeader.CorHeaderTableDirectory.Size;
			if (size < 72)
			{
				throw new BadImageFormatException(SR.InvalidCorHeaderSize);
			}
			return true;
		}

		private static void SkipDosHeader(ref PEBinaryReader P_0, out bool P_1)
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			ushort num = P_0.ReadUInt16();
			if (num != 23117)
			{
				if (num == 0 && P_0.ReadUInt16() == 65535)
				{
					throw new BadImageFormatException(SR.UnknownFileFormat);
				}
				P_1 = true;
				P_0.Seek(0);
			}
			else
			{
				P_1 = false;
			}
			if (!P_1)
			{
				P_0.Seek(60);
				int num2 = P_0.ReadInt32();
				P_0.Seek(num2);
				uint num3 = P_0.ReadUInt32();
				if (num3 != 17744)
				{
					throw new BadImageFormatException(SR.InvalidPESignature);
				}
			}
		}

		private ImmutableArray<SectionHeader> ReadSectionHeaders(ref PEBinaryReader P_0)
		{
			//IL_0015: 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)
			int numberOfSections = _coffHeader.NumberOfSections;
			if (numberOfSections < 0)
			{
				throw new BadImageFormatException(SR.InvalidNumberOfSections);
			}
			Builder<SectionHeader> val = ImmutableArray.CreateBuilder<SectionHeader>(numberOfSections);
			for (int i = 0; i < numberOfSections; i++)
			{
				val.Add(new SectionHeader(ref P_0));
			}
			return val.MoveToImmutable();
		}

		public bool TryGetDirectoryOffset(DirectoryEntry P_0, out int P_1)
		{
			return TryGetDirectoryOffset(P_0, out P_1, true);
		}

		internal bool TryGetDirectoryOffset(DirectoryEntry P_0, out int P_1, bool P_2)
		{
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			int containingSectionIndex = GetContainingSectionIndex(P_0.RelativeVirtualAddress);
			if (containingSectionIndex < 0)
			{
				P_1 = -1;
				return false;
			}
			int num = P_0.RelativeVirtualAddress - _sectionHeaders[containingSectionIndex].VirtualAddress;
			if (!P_2 && P_0.Size > _sectionHeaders[containingSectionIndex].VirtualSize - num)
			{
				throw new BadImageFormatException(SR.SectionTooSmall);
			}
			P_1 = (_isLoadedImage ? P_0.RelativeVirtualAddress : (_sectionHeaders[containingSectionIndex].PointerToRawData + num));
			return true;
		}

		public int GetContainingSectionIndex(int P_0)
		{
			for (int i = 0; i < _sectionHeaders.Length; i++)
			{
				if (_sectionHeaders[i].VirtualAddress <= P_0 && P_0 < _sectionHeaders[i].VirtualAddress + _sectionHeaders[i].VirtualSize)
				{
					return i;
				}
			}
			return -1;
		}

		internal int IndexOfSection(string P_0)
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < SectionHeaders.Length; i++)
			{
				if (SectionHeaders[i].Name.Equals(P_0, (StringComparison)4))
				{
					return i;
				}
			}
			return -1;
		}

		private void CalculateMetadataLocation(long P_0, out int P_1, out int P_2)
		{
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			if (IsCoffOnly)
			{
				int num = IndexOfSection(".cormeta");
				if (num == -1)
				{
					P_1 = -1;
					P_2 = 0;
					return;
				}
				if (_isLoadedImage)
				{
					P_1 = SectionHeaders[num].VirtualAddress;
					P_2 = SectionHeaders[num].VirtualSize;
				}
				else
				{
					P_1 = SectionHeaders[num].PointerToRawData;
					P_2 = SectionHeaders[num].SizeOfRawData;
				}
			}
			else
			{
				if (_corHeader == null)
				{
					P_1 = 0;
					P_2 = 0;
					return;
				}
				if (!TryGetDirectoryOffset(_corHeader.MetadataDirectory, out P_1, false))
				{
					throw new BadImageFormatException(SR.MissingDataDirectory);
				}
				P_2 = _corHeader.MetadataDirectory.Size;
			}
			if (P_1 < 0 || P_1 >= P_0 || P_2 <= 0 || P_1 > P_0 - P_2)
			{
				throw new BadImageFormatException(SR.InvalidMetadataSectionSpan);
			}
		}
	}
	public sealed class PEReader : System.IDisposable
	{
		private MemoryBlockProvider _peImage;

		private PEHeaders _lazyPEHeaders;

		private AbstractMemoryBlock _lazyMetadataBlock;

		private AbstractMemoryBlock _lazyImageBlock;

		private AbstractMemoryBlock[] _lazyPESectionBlocks;

		[field: CompilerGenerated]
		public bool IsLoadedImage
		{
			[CompilerGenerated]
			get;
		}

		public PEHeaders PEHeaders
		{
			get
			{
				if (_lazyPEHeaders == null)
				{
					InitializePEHeaders();
				}
				return _lazyPEHeaders;
			}
		}

		public unsafe PEReader(byte* P_0, int P_1, bool P_2)
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			if (P_0 == null)
			{
				Throw.ArgumentNull("peImage");
			}
			if (P_1 < 0)
			{
				throw new ArgumentOutOfRangeException("size");
			}
			_peImage = new ExternalMemoryBlockProvider(P_0, P_1);
			IsLoadedImage = P_2;
		}

		public PEReader(Stream P_0)
			: this(P_0, PEStreamOptions.Default)
		{
		}

		public PEReader(Stream P_0, PEStreamOptions P_1)
			: this(P_0, P_1, 0)
		{
		}

		public unsafe PEReader(Stream P_0, PEStreamOptions P_1, int P_2)
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			if (P_0 == null)
			{
				Throw.ArgumentNull("peStream");
			}
			if (!P_0.CanRead || !P_0.CanSeek)
			{
				throw new ArgumentException(SR.StreamMustSupportReadAndSeek, "peStream");
			}
			if (!P_1.IsValid())
			{
				throw new ArgumentOutOfRangeException("options");
			}
			IsLoadedImage = (P_1 & PEStreamOptions.IsLoadedImage) != 0;
			long position = P_0.Position;
			int andValidateSize = StreamExtensions.GetAndValidateSize(P_0, P_2, "peStream");
			bool flag = true;
			try
			{
				if ((P_1 & (PEStreamOptions.PrefetchMetadata | PEStreamOptions.PrefetchEntireImage)) == 0)
				{
					_peImage = new StreamMemoryBlockProvider(P_0, position, andValidateSize, (P_1 & PEStreamOptions.LeaveOpen) != 0);
					flag = false;
				}
				else if ((P_1 & PEStreamOptions.PrefetchEntireImage) != 0)
				{
					NativeHeapMemoryBlock nativeHeapMemoryBlock = (NativeHeapMemoryBlock)(_lazyImageBlock = StreamMemoryBlockProvider.ReadMemoryBlockNoLock(P_0, position, andValidateSize));
					_peImage = new ExternalMemoryBlockProvider(nativeHeapMemoryBlock.Pointer, nativeHeapMemoryBlock.Size);
					if ((P_1 & PEStreamOptions.PrefetchMetadata) != 0)
					{
						InitializePEHeaders();
					}
				}
				else
				{
					_lazyPEHeaders = new PEHeaders(P_0, andValidateSize, IsLoadedImage);
					_lazyMetadataBlock = StreamMemoryBlockProvider.ReadMemoryBlockNoLock(P_0, _lazyPEHeaders.MetadataStartOffset, _lazyPEHeaders.MetadataSize);
				}
			}
			finally
			{
				if (flag && (P_1 & PEStreamOptions.LeaveOpen) == 0)
				{
					P_0.Dispose();
				}
			}
		}

		public void Dispose()
		{
			_lazyPEHeaders = null;
			_peImage?.Dispose();
			_peImage = null;
			_lazyImageBlock?.Dispose();
			_lazyImageBlock = null;
			_lazyMetadataBlock?.Dispose();
			_lazyMetadataBlock = null;
			AbstractMemoryBlock[] lazyPESectionBlocks = _lazyPESectionBlocks;
			if (lazyPESectionBlocks != null)
			{
				AbstractMemoryBlock[] array = lazyPESectionBlocks;
				for (int i = 0; i < array.Length; i++)
				{
					array[i]?.Dispose();
				}
				_lazyPESectionBlocks = null;
			}
		}

		private MemoryBlockProvider GetPEImage()
		{
			MemoryBlockProvider peImage = _peImage;
			if (peImage == null)
			{
				if (_lazyPEHeaders == null)
				{
					Throw.PEReaderDisposed();
				}
				Throw.InvalidOperation_PEImageNotAvailable();
			}
			return peImage;
		}

		private void InitializePEHeaders()
		{
			StreamConstraints streamConstraints;
			Stream stream = GetPEImage().GetStream(out streamConstraints);
			PEHeaders pEHeaders;
			if (streamConstraints.GuardOpt != null)
			{
				lock (streamConstraints.GuardOpt)
				{
					pEHeaders = ReadPEHeadersNoLock(stream, streamConstraints.ImageStart, streamConstraints.ImageSize, IsLoadedImage);
				}
			}
			else
			{
				pEHeaders = ReadPEHeadersNoLock(stream, streamConstraints.ImageStart, streamConstraints.ImageSize, IsLoadedImage);
			}
			Interlocked.CompareExchange<PEHeaders>(ref _lazyPEHeaders, pEHeaders, (PEHeaders)null);
		}

		private static PEHeaders ReadPEHeadersNoLock(Stream P_0, long P_1, int P_2, bool P_3)
		{
			P_0.Seek(P_1, (SeekOrigin)0);
			return new PEHeaders(P_0, P_2, P_3);
		}

		public ImmutableArray<DebugDirectoryEntry> ReadDebugDirectory()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			DirectoryEntry debugTableDirectory = PEHeaders.PEHeader.DebugTableDirectory;
			if (debugTableDirectory.Size == 0)
			{
				return ImmutableArray<DebugDirectoryEntry>.Empty;
			}
			if (!PEHeaders.TryGetDirectoryOffset(debugTableDirectory, out var num))
			{
				throw new BadImageFormatException(SR.InvalidDirectoryRVA);
			}
			if (debugTableDirectory.Size % 28 != 0)
			{
				throw new BadImageFormatException(SR.InvalidDirectorySize);
			}
			using AbstractMemoryBlock abstractMemoryBlock = GetPEImage().GetMemoryBlock(num, debugTableDirectory.Size);
			return ReadDebugDirectoryEntries(abstractMemoryBlock.GetReader());
		}

		internal static ImmutableArray<DebugDirectoryEntry> ReadDebugDirectoryEntries(BlobReader P_0)
		{
			//IL_008d: 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)
			int num = P_0.Length / 28;
			Builder<DebugDirectoryEntry> val = ImmutableArray.CreateBuilder<DebugDirectoryEntry>(num);
			for (int i = 0; i < num; i++)
			{
				if (P_0.ReadInt32() != 0)
				{
					throw new BadImageFormatException(SR.InvalidDebugDirectoryEntryCharacteristics);
				}
				uint num2 = P_0.ReadUInt32();
				ushort num3 = P_0.ReadUInt16();
				ushort num4 = P_0.ReadUInt16();
				DebugDirectoryEntryType debugDirectoryEntryType = (DebugDirectoryEntryType)P_0.ReadInt32();
				int num5 = P_0.ReadInt32();
				int num6 = P_0.ReadInt32();
				int num7 = P_0.ReadInt32();
				val.Add(new DebugDirectoryEntry(num2, num3, num4, debugDirectoryEntryType, num5, num6, num7));
			}
			return val.MoveToImmutable();
		}

		private AbstractMemoryBlock GetDebugDirectoryEntryDataBlock(DebugDirectoryEntry P_0)
		{
			int num = (IsLoadedImage ? P_0.DataRelativeVirtualAddress : P_0.DataPointer);
			return GetPEImage().GetMemoryBlock(num, P_0.DataSize);
		}

		public CodeViewDebugDirectoryData ReadCodeViewDebugDirectoryData(DebugDirectoryEntry P_0)
		{
			if (P_0.Type != DebugDirectoryEntryType.CodeView)
			{
				Throw.InvalidArgument(SR.Format(SR.UnexpectedDebugDirectoryType, "CodeView"), "entry");
			}
			using AbstractMemoryBlock abstractMemoryBlock = GetDebugDirectoryEntryDataBlock(P_0);
			return DecodeCodeViewDebugDirectoryData(abstractMemoryBlock);
		}

		internal static CodeViewDebugDirectoryData DecodeCodeViewDebugDirectoryData(AbstractMemoryBlock P_0)
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			BlobReader reader = P_0.GetReader();
			if (reader.ReadByte() != 82 || reader.ReadByte() != 83 || reader.ReadByte() != 68 || reader.ReadByte() != 83)
			{
				throw new BadImageFormatException(SR.UnexpectedCodeViewDataSignature);
			}
			Guid val = reader.ReadGuid();
			int num = reader.ReadInt32();
			string text = reader.ReadUtf8NullTerminated();
			return new CodeViewDebugDirectoryData(val, num, text);
		}

		public bool TryOpenAssociatedPortablePdb(string P_0, Func<string, Stream?> P_1, out MetadataReaderProvider? P_2, out string? P_3)
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			if (P_0 == null)
			{
				Throw.ArgumentNull("peImagePath");
			}
			if (P_1 == null)
			{
				Throw.ArgumentNull("pdbFileStreamProvider");
			}
			P_2 = null;
			P_3 = null;
			string directoryName;
			try
			{
				directoryName = Path.GetDirectoryName(P_0);
			}
			catch (System.Exception ex)
			{
				throw new ArgumentException(ex.Message, "peImagePath", ex);
			}
			System.Exception ex2 = null;
			ImmutableArray<DebugDirectoryEntry> val = ReadDebugDirectory();
			DebugDirectoryEntry debugDirectoryEntry = ImmutableArrayExtensions.FirstOrDefault<DebugDirectoryEntry>(val, (Func<DebugDirectoryEntry, bool>)((DebugDirectoryEntry e) => e.IsPortableCodeView));
			if (debugDirectoryEntry.DataSize != 0 && TryOpenCodeViewPortablePdb(debugDirectoryEntry, directoryName, P_1, out P_2, out P_3, ref ex2))
			{
				return true;
			}
			DebugDirectoryEntry debugDirectoryEntry2 = ImmutableArrayExtensions.FirstOrDefault<DebugDirectoryEntry>(val, (Func<DebugDirectoryEntry, bool>)((DebugDirectoryEntry e) => e.Type == DebugDirectoryEntryType.EmbeddedPortablePdb));
			if (debugDirectoryEntry2.DataSize != 0)
			{
				bool flag = false;
				P_2 = null;
				TryOpenEmbeddedPortablePdb(debugDirectoryEntry2, ref flag, ref P_2, ref ex2);
				if (flag)
				{
					return true;
				}
			}
			if (ex2 != null)
			{
				ExceptionDispatchInfo.Capture(ex2).Throw();
			}
			return false;
		}

		private bool TryOpenCodeViewPortablePdb(DebugDirectoryEntry P_0, string P_1, Func<string, Stream> P_2, out MetadataReaderProvider P_3, out string P_4, ref System.Exception P_5)
		{
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			P_4 = null;
			P_3 = null;
			CodeViewDebugDirectoryData codeViewDebugDirectoryData;
			try
			{
				codeViewDebugDirectoryData = ReadCodeViewDebugDirectoryData(P_0);
			}
			catch (System.Exception ex) when (ex is BadImageFormatException || ex is IOException)
			{
				if (P_5 == null)
				{
					P_5 = ex;
				}
				return false;
			}
			BlobContentId blobContentId = new BlobContentId(codeViewDebugDirectoryData.Guid, P_0.Stamp);
			string text = PathUtilities.CombinePathWithRelativePath(P_1, PathUtilities.GetFileName(codeViewDebugDirectoryData.Path));
			if (TryOpenPortablePdbFile(text, blobContentId, P_2, out P_3, ref P_5))
			{
				P_4 = text;
				return true;
			}
			return false;
		}

		private static bool TryOpenPortablePdbFile(string P_0, BlobContentId P_1, Func<string, Stream> P_2, out MetadataReaderProvider P_3, ref System.Exception P_4)
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			P_3 = null;
			MetadataReaderProvider metadataReaderProvider = null;
			try
			{
				Stream val;
				try
				{
					val = P_2.Invoke(P_0);
				}
				catch (FileNotFoundException)
				{
					val = null;
				}
				if (val == null)
				{
					return false;
				}
				if (!val.CanRead || !val.CanSeek)
				{
					throw new InvalidOperationException(SR.StreamMustSupportReadAndSeek);
				}
				metadataReaderProvider = MetadataReaderProvider.FromPortablePdbStream(val);
				if (new BlobContentId(metadataReaderProvider.GetMetadataReader().DebugMetadataHeader.Id) != P_1)
				{
					return false;
				}
				P_3 = metadataReaderProvider;
				return true;
			}
			catch (System.Exception ex) when (ex is BadImageFormatException || ex is IOException)
			{
				if (P_4 == null)
				{
					P_4 = ex;
				}
				return false;
			}
			finally
			{
				if (P_3 == null)
				{
					metadataReaderProvider?.Dispose();
				}
			}
		}

		private void TryOpenEmbeddedPortablePdb(DebugDirectoryEntry P_0, ref bool P_1, ref MetadataReaderProvider P_2, ref System.Exception P_3)
		{
			P_2 = null;
			MetadataReaderProvider metadataReaderProvider = null;
			try
			{
				metadataReaderProvider = ReadEmbeddedPortablePdbDebugDirectoryData(P_0);
				metadataReaderProvider.GetMetadataReader();
				P_2 = metadataReaderProvider;
				P_1 = true;
			}
			catch (System.Exception ex) when (ex is BadImageFormatException || ex is IOException)
			{
				if (P_3 == null)
				{
					P_3 = ex;
				}
				P_1 = false;
			}
			finally
			{
				if (P_2 == null)
				{
					metadataReaderProvider?.Dispose();
				}
			}
		}

		public MetadataReaderProvider ReadEmbeddedPortablePdbDebugDirectoryData(DebugDirectoryEntry P_0)
		{
			if (P_0.Type != DebugDirectoryEntryType.EmbeddedPortablePdb)
			{
				Throw.InvalidArgument(SR.Format(SR.UnexpectedDebugDirectoryType, "EmbeddedPortablePdb"), "entry");
			}
			ValidateEmbeddedPortablePdbVersion(P_0);
			using AbstractMemoryBlock abstractMemoryBlock = GetDebugDirectoryEntryDataBlock(P_0);
			return new MetadataReaderProvider(DecodeEmbeddedPortablePdbDebugDirectoryData(abstractMemoryBlock));
		}

		internal static void ValidateEmbeddedPortablePdbVersion(DebugDirectoryEntry P_0)
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			ushort majorVersion = P_0.MajorVersion;
			if (majorVersion < 256)
			{
				throw new BadImageFormatException(SR.Format(SR.UnsupportedFormatVersion, PortablePdbVersions.Format(majorVersion)));
			}
			ushort minorVersion = P_0.MinorVersion;
			if (minorVersion != 256)
			{
				throw new BadImageFormatException(SR.Format(SR.UnsupportedFormatVersion, PortablePdbVersions.Format(minorVersion)));
			}
		}

		internal unsafe static NativeHeapMemoryBlock DecodeEmbeddedPortablePdbDebugDirectoryData(AbstractMemoryBlock P_0)
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Expected O, but got Unknown
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			BlobReader reader = P_0.GetReader();
			if (reader.ReadUInt32() != 1111773261)
			{
				throw new BadImageFormatException(SR.UnexpectedEmbeddedPortablePdbDataSignature);
			}
			int num = reader.ReadInt32();
			NativeHeapMemoryBlock nativeHeapMemoryBlock;
			try
			{
				nativeHeapMemoryBlock = new NativeHeapMemoryBlock(num);
			}
			catch (System.Exception ex)
			{
				throw new BadImageFormatException(SR.DataTooBig, ex);
			}
			bool flag = false;
			try
			{
				ReadOnlyUnmanagedMemoryStream readOnlyUnmanagedMemoryStream = new ReadOnlyUnmanagedMemoryStream(reader.CurrentPointer, reader.RemainingBytes);
				DeflateStream val = new DeflateStream((Stream)(object)readOnlyUnmanagedMemoryStream, (CompressionMode)0, true);
				try
				{
					if (num > 0)
					{
						int num2;
						try
						{
							num2 = ((Stream)(object)val).TryReadAll(new System.Span<byte>((void*)nativeHeapMemoryBlock.Pointer, nativeHeapMemoryBlock.Size));
						}
						catch (System.Exception ex2)
						{
							throw new BadImageFormatException(ex2.Message, ex2);
						}
						if (num2 != nativeHeapMemoryBlock.Size)
						{
							throw new BadImageFormatException(SR.SizeMismatch);
						}
					}
					if (((Stream)val).ReadByte() != -1)
					{
						throw new BadImageFormatException(SR.SizeMismatch);
					}
					flag = true;
				}
				finally
				{
					((System.IDisposable)val)?.Dispose();
				}
			}
			finally
			{
				if (!flag)
				{
					nativeHeapMemoryBlock.Dispose();
				}
			}
			return nativeHeapMemoryBlock;
		}
	}
	[Flags]
	public enum PEStreamOptions
	{
		Default = 0,
		LeaveOpen = 1,
		PrefetchMetadata = 2,
		PrefetchEntireImage = 4,
		IsLoadedImage = 8
	}
	internal static class PEStreamOptionsExtensions
	{
		public static bool IsValid(this PEStreamOptions P_0)
		{
			return (P_0 & ~(PEStreamOptions.LeaveOpen | PEStreamOptions.PrefetchMetadata | PEStreamOptions.PrefetchEntireImage | PEStreamOptions.IsLoadedImage)) == 0;
		}
	}
	public readonly struct SectionHeader
	{
		[CompilerGenerated]
		private readonly int <PointerToRelocations>k__BackingField;

		[CompilerGenerated]
		private readonly int <PointerToLineNumbers>k__BackingField;

		[CompilerGenerated]
		private readonly ushort <NumberOfRelocations>k__BackingField;

		[CompilerGenerated]
		private readonly ushort <NumberOfLineNumbers>k__BackingField;

		[CompilerGenerated]
		private readonly SectionCharacteristics <SectionCharacteristics>k__BackingField;

		[field: CompilerGenerated]
		public string Name
		{
			[CompilerGenerated]
			get;
		}

		[field: CompilerGenerated]
		public int VirtualSize
		{
			[CompilerGenerated]
			get;
		}

		[field: CompilerGenerated]
		public int VirtualAddress
		{
			[CompilerGenerated]
			get;
		}

		[field: CompilerGenerated]
		public int SizeOfRawData
		{
			[CompilerGenerated]
			get;
		}

		[field: CompilerGenerated]
		public int PointerToRawData
		{
			[CompilerGenerated]
			get;
		}

		internal SectionHeader(ref PEBinaryReader P_0)
		{
			Name = P_0.ReadNullPaddedUTF8(8);
			VirtualSize = P_0.ReadInt32();
			VirtualAddress = P_0.ReadInt32();
			SizeOfRawData = P_0.ReadInt32();
			PointerToRawData = P_0.ReadInt32();
			<PointerToRelocations>k__BackingField = P_0.ReadInt32();
			<PointerToLineNumbers>k__BackingField = P_0.ReadInt32();
			<NumberOfRelocations>k__BackingField = P_0.ReadUInt16();
			<NumberOfLineNumbers>k__BackingField = P_0.ReadUInt16();
			<SectionCharacteristics>k__BackingField = (SectionCharacteristics)P_0.ReadUInt32();
		}
	}
}
namespace System.Reflection.Metadata
{
	internal static class PathUtilities
	{
		private static string s_platformSpecificDirectorySeparator;

		private static string PlatformSpecificDirectorySeparator => s_platformSpecificDirectorySeparator ?? (s_platformSpecificDirectorySeparator = ((System.Array.IndexOf<char>(Path.GetInvalidFileNameChars(), '*') >= 0) ? '\\' : '/').ToString());

		internal static int IndexOfFileName(string P_0)
		{
			if (P_0 == null)
			{
				return -1;
			}
			for (int num = P_0.Length - 1; num >= 0; num--)
			{
				char c = P_0[num];
				if (c == '\\' || c == '/' || c == ':')
				{
					return num + 1;
				}
			}
			return 0;
		}

		internal static string GetFileName(string P_0)
		{
			int num = IndexOfFileName(P_0);
			if (num > 0)
			{
				return P_0.Substring(num);
			}
			return P_0;
		}

		internal static string CombinePathWithRelativePath(string P_0, string P_1)
		{
			if (P_0.Length == 0)
			{
				return P_1;
			}
			char c = P_0[P_0.Length - 1];
			if (c == '\\' || c == '/' || c == ':')
			{
				return P_0 + P_1;
			}
			return P_0 + PlatformSpecificDirectorySeparator + P_1;
		}
	}
	internal static class PortablePdbVersions
	{
		internal static string Format(ushort P_0)
		{
			return (P_0 >> 8) + "." + (P_0 & 0xFF);
		}
	}
	[Flags]
	public enum MetadataStreamOptions
	{
		Default = 0,
		LeaveOpen = 1,
		PrefetchMetadata = 2
	}
	internal static class MetadataStreamOptionsExtensions
	{
		public static bool IsValid(this MetadataStreamOptions P_0)
		{
			return (P_0 & ~(MetadataStreamOptions.LeaveOpen | MetadataStreamOptions.PrefetchMetadata)) == 0;
		}
	}
	public sealed class MetadataReaderProvider : System.IDisposable
	{
		private MemoryBlockProvider _blockProviderOpt;

		private AbstractMemoryBlock _lazyMetadataBlock;

		private MetadataReader _lazyMetadataReader;

		private readonly object _metadataReaderGuard = new object();

		internal MetadataReaderProvider(AbstractMemoryBlock P_0)
		{
			_lazyMetadataBlock = P_0;
		}

		private MetadataReaderProvider(MemoryBlockProvider P_0)
		{
			_blockProviderOpt = P_0;
		}

		public unsafe static MetadataReaderProvider FromMetadataImage(byte* P_0, int P_1)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			if (P_0 == null)
			{
				Throw.ArgumentNull("start");
			}
			if (P_1 < 0)
			{
				throw new ArgumentOutOfRangeException("size");
			}
			return new MetadataReaderProvider(new ExternalMemoryBlockProvider(P_0, P_1));
		}

		public static MetadataReaderProvider FromPortablePdbStream(Stream P_0, MetadataStreamOptions P_1 = MetadataStreamOptions.Default, int P_2 = 0)
		{
			return FromMetadataStream(P_0, P_1, P_2);
		}

		public static MetadataReaderProvider FromMetadataStream(Stream P_0, MetadataStreamOptions P_1 = MetadataStreamOptions.Default, int P_2 = 0)
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			if (P_0 == null)
			{
				Throw.ArgumentNull("stream");
			}
			if (!P_0.CanRead || !P_0.CanSeek)
			{
				throw new ArgumentException(SR.StreamMustSupportReadAndSeek, "stream");
			}
			if (!P_1.IsValid())
			{
				throw new ArgumentOutOfRangeException("options");
			}
			long position = P_0.Position;
			int andValidateSize = StreamExtensions.GetAndValidateSize(P_0, P_2, "stream");
			bool flag = true;
			MetadataReaderProvider result;
			try
			{
				if ((P_1 & MetadataStreamOptions.PrefetchMetadata) == 0)
				{
					result = new MetadataReaderProvider(new StreamMemoryBlockProvider(P_0, position, andValidateSize, (P_1 & MetadataStreamOptions.LeaveOpen) != 0));
					flag = false;
				}
				else
				{
					result = new MetadataReaderProvider(StreamMemoryBlockProvider.ReadMemoryBlockNoLock(P_0, position, andValidateSize));
				}
			}
			finally
			{
				if (flag && (P_1 & MetadataStreamOptions.LeaveOpen) == 0)
				{
					P_0.Dispose();
				}
			}
			return result;
		}

		public void Dispose()
		{
			_blockProviderOpt?.Dispose();
			_blockProviderOpt = null;
			_lazyMetadataBlock?.Dispose();
			_lazyMetadataBlock = null;
			_lazyMetadataReader = null;
		}

		public unsafe MetadataReader GetMetadataReader(MetadataReaderOptions P_0 = MetadataReaderOptions.Default, MetadataStringDecoder? P_1 = null)
		{
			MetadataReader lazyMetadataReader = _lazyMetadataReader;
			if (CanReuseReader(lazyMetadataReader, P_0, P_1))
			{
				return lazyMetadataReader;
			}
			lock (_metadataReaderGuard)
			{
				lazyMetadataReader = _lazyMetadataReader;
				if (CanReuseReader(lazyMetadataReader, P_0, P_1))
				{
					return lazyMetadataReader;
				}
				AbstractMemoryBlock metadataBlock = GetMetadataBlock();
				return _lazyMetadataReader = new MetadataReader(metadataBlock.Pointer, metadataBlock.Size, P_0, P_1, this);
			}
		}

		private static bool CanReuseReader(MetadataReader P_0, MetadataReaderOptions P_1, MetadataStringDecoder P_2)
		{
			if (P_0 != null && P_0.Options == P_1)
			{
				return P_0.UTF8Decoder == (P_2 ?? MetadataStringDecoder.DefaultUTF8);
			}
			return false;
		}

		internal AbstractMemoryBlock GetMetadataBlock()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			if (_lazyMetadataBlock == null)
			{
				if (_blockProviderOpt == null)
				{
					throw new ObjectDisposedException("MetadataReaderProvider");
				}
				AbstractMemoryBlock memoryBlock = _blockProviderOpt.GetMemoryBlock(0, _blockProviderOpt.Size);
				if (Interlocked.CompareExchange<AbstractMemoryBlock>(ref _lazyMetadataBlock, memoryBlock, (AbstractMemoryBlock)null) != null)
				{
					memoryBlock.Dispose();
				}
			}
			return _lazyMetadataBlock;
		}
	}
	public readonly struct BlobContentId : IEquatable<BlobContentId>
	{
		private readonly Guid _guid;

		private readonly uint _stamp;

		public Guid Guid => _guid;

		public uint Stamp => _stamp;

		public BlobContentId(Guid P_0, uint P_1)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			_guid = P_0;
			_stamp = P_1;
		}

		public BlobContentId(ImmutableArray<byte> P_0)
		{
			if (P_0.IsDefault)
			{
				Throw.ArgumentNull("id");
			}
			Initialize(P_0.AsSpan(), out _guid, out _stamp);
		}

		private unsafe static void Initialize(System.ReadOnlySpan<byte> P_0, out Guid P_1, out uint P_2)
		{
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: 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)
			if (P_0.Length != 20)
			{
				throw new ArgumentException(SR.Format(SR.UnexpectedArrayLength, 20), "id");
			}
			fixed (byte* ptr = P_0[0])
			{
				BlobReader blobReader = new BlobReader(ptr, P_0.Length);
				P_1 = blobReader.ReadGuid();
				P_2 = blobReader.ReadUInt32();
			}
		}

		public bool Equals(BlobContentId P_0)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			if (Guid == P_0.Guid)
			{
				return Stamp == P_0.Stamp;
			}
			return false;
		}

		public override bool Equals([NotNullWhen(true)] object? P_0)
		{
			if (P_0 is BlobContentId blobContentId)
			{
				return Equals(blobContentId);
			}
			return false;
		}

		public override int GetHashCode()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			uint stamp = Stamp;
			Guid guid = Guid;
			return Hash.Combine(stamp, ((object)(Guid)(ref guid)).GetHashCode());
		}

		public static bool operator !=(BlobContentId P_0, BlobContentId P_1)
		{
			return !P_0.Equals(P_1);
		}
	}
	public readonly struct ModuleDefinitionHandle : IEquatable<ModuleDefinitionHandle>
	{
		private readonly int _rowId;

		internal ModuleDefinitionHandle(int P_0)
		{
			_rowId = P_0;
		}

		public override bool Equals(object? P_0)
		{
			if (P_0 is ModuleDefinitionHandle moduleDefinitionHandle)
			{
				return moduleDefinitionHandle._rowId == _rowId;
			}
			return false;
		}

		public bool Equals(ModuleDefinitionHandle P_0)
		{
			return _rowId == P_0._rowId;
		}

		public override int GetHashCode()
		{
			return _rowId.GetHashCode();
		}
	}
	public readonly struct AssemblyDefinitionHandle : IEquatable<AssemblyDefinitionHandle>
	{
		private readonly int _rowId;

		internal AssemblyDefinitionHandle(int P_0)
		{
			_rowId = P_0;
		}

		public override bool Equals(object? P_0)
		{
			if (P_0 is AssemblyDefinitionHandle)
			{
				return ((AssemblyDefinitionHandle)P_0)._rowId == _rowId;
			}
			return false;
		}

		public bool Equals(AssemblyDefinitionHandle P_0)
		{
			return _rowId == P_0._rowId;
		}

		public override int GetHashCode()
		{
			return _rowId.GetHashCode();
		}
	}
	public readonly struct MethodDefinitionHandle : IEquatable<MethodDefinitionHandle>
	{
		private readonly int _rowId;

		private MethodDefinitionHandle(int P_0)
		{
			_rowId = P_0;
		}

		internal static MethodDefinitionHandle FromRowId(int P_0)
		{
			return new MethodDefinitionHandle(P_0);
		}

		public static explicit operator MethodDefinitionHandle(Handle P_0)
		{
			if (P_0.VType != 6)
			{
				Throw.InvalidCast();
			}
			return new MethodDefinitionHandle(P_0.RowId);
		}

		public override bool Equals(object? P_0)
		{
			if (P_0 is MethodDefinitionHandle)
			{
				return ((MethodDefinitionHandle)P_0)._rowId == _rowId;
			}
			return false;
		}

		public bool Equals(MethodDefinitionHandle P_0)
		{
			return _rowId == P_0._rowId;
		}

		public override int GetHashCode()
		{
			return _rowId.GetHashCode();
		}

		public MethodDebugInformationHandle ToDebugInformationHandle()
		{
			return MethodDebugInformationHandle.FromRowId(_rowId);
		}
	}
	public readonly struct StringHandle : IEquatable<StringHandle>
	{
		private readonly uint _value;

		private StringHandle(uint P_0)
		{
			_value = P_0;
		}

		internal static StringHandle FromOffset(int P_0)
		{
			return new StringHandle(0u | (uint)P_0);
		}

		internal int GetHeapOffset()
		{
			return (int)(_value & 0x1FFFFFFF);
		}

		public override bool Equals(object? P_0)
		{
			if (P_0 is StringHandle)
			{
				return Equals((StringHandle)P_0);
			}
			return false;
		}

		public bool Equals(StringHandle P_0)
		{
			return _value == P_0._value;
		}

		public override int GetHashCode()
		{
			return (int)_value;
		}
	}
	public readonly struct BlobHandle : IEquatable<BlobHandle>
	{
		internal enum VirtualIndex : byte
		{
			Nil,
			ContractPublicKeyToken,
			ContractPublicKey,
			AttributeUsage_AllowSingle,
			AttributeUsage_AllowMultiple,
			Count
		}

		private readonly uint _value;

		internal uint RawValue => _value;

		public bool IsNil => _value == 0;

		internal bool IsVirtual => (_value & 0x80000000u) != 0;

		private ushort VirtualValue => (ushort)(_value >> 8);

		private BlobHandle(uint P_0)
		{
			_value = P_0;
		}

		internal static BlobHandle FromOffset(int P_0)
		{
			return new BlobHandle((uint)P_0);
		}

		internal unsafe void SubstituteTemplateParameters(byte[] P_0)
		{
			fixed (byte* ptr = &P_0[2])
			{
				*(int*)ptr = VirtualValue;
			}
		}

		internal int GetHeapOffset()
		{
			return (int)_value;
		}

		internal VirtualIndex GetVirtualIndex()
		{
			return (VirtualIndex)(_value & 0xFFu);
		}

		public override bool Equals([NotNullWhen(true)] object? P_0)
		{
			if (P_0 is BlobHandle blobHandle)
			{
				return Equals(blobHandle);
			}
			return false;
		}

		public bool Equals(BlobHandle P_0)
		{
			return _value == P_0._value;
		}

		public override int GetHashCode()
		{
			return (int)_value;
		}
	}
	[DebuggerDisplay("{GetDebuggerDisplay(),nq}")]
	public struct BlobReader
	{
		private readonly MemoryBlock _block;

		private unsafe readonly byte* _endPointer;

		private unsafe byte* _currentPointer;

		public unsafe byte* CurrentPointer => _currentPointer;

		public int Length => _block.Length;

		public unsafe int Offset
		{
			get
			{
				return (int)(_currentPointer - _block.Pointer);
			}
			set
			{
				if ((uint)value > (uint)_block.Length)
				{
					Throw.OutOfBounds();
				}
				_currentPointer = _block.Pointer + value;
			}
		}

		public unsafe int RemainingBytes => (int)(_endPointer - _currentPointer);

		public unsafe BlobReader(byte* P_0, int P_1)
			: this(MemoryBlock.CreateChecked(P_0, P_1))
		{
		}

		internal unsafe BlobReader(MemoryBlock P_0)
		{
			_block = P_0;
			_currentPointer = P_0.Pointer;
			_endPointer = P_0.Pointer + P_0.Length;
		}

		internal unsafe string GetDebuggerDisplay()
		{
			if (_block.Pointer == null)
			{
				return "<null>";
			}
			int num;
			string debuggerDisplay = _block.GetDebuggerDisplay(out num);
			if (Offset < num)
			{
				return debuggerDisplay.Insert(Offset * 3, "*");
			}
			if (num == _block.Length)
			{
				return debuggerDisplay + "*";
			}
			return debuggerDisplay + "*...";
		}

		public unsafe void Reset()
		{
			_currentPointer = _block.Pointer;
		}

		internal unsafe bool TryAlign(byte P_0)
		{
			int num = Offset & (P_0 - 1);
			if (num != 0)
			{
				int num2 = P_0 - num;
				if (num2 > RemainingBytes)
				{
					return false;
				}
				_currentPointer += num2;
			}
			return true;
		}

		internal unsafe MemoryBlock GetMemoryBlockAt(int P_0, int P_1)
		{
			CheckBounds(P_0, P_1);
			return new MemoryBlock(_currentPointer + P_0, P_1);
		}

		[MethodImpl(256)]
		private unsafe void CheckBounds(int P_0, int P_1)
		{
			if ((ulong)((long)(uint)P_0 + (long)(uint)P_1) > (ulong)(_endPointer - _currentPointer))
			{
				Throw.OutOfBounds();
			}
		}

		[MethodImpl(256)]
		private unsafe byte* GetCurrentPointerAndAdvance(int P_0)
		{
			byte* currentPointer = _currentPointer;
			if ((uint)P_0 > (uint)(_endPointer - currentPointer))
			{
				Throw.OutOfBounds();
			}
			_currentPointer = currentPointer + P_0;
			return currentPointer;
		}

		[MethodImpl(256)]
		private unsafe byte* GetCurrentPointerAndAdvance1()
		{
			byte* currentPointer = _currentPointer;
			if (currentPointer == _endPointer)
			{
				Throw.OutOfBounds();
			}
			_currentPointer = currentPointer + 1;
			return currentPointer;
		}

		public unsafe byte ReadByte()
		{
			return *GetCurrentPointerAndAdvance1();
		}

		public unsafe short ReadInt16()
		{
			byte* currentPointerAndAdvance = GetCurrentPointerAndAdvance(2);
			return (short)(*currentPointerAndAdvance + (currentPointerAndAdvance[1] << 8));
		}

		public unsafe ushort ReadUInt16()
		{
			byte* currentPointerAndAdvance = GetCurrentPointerAndAdvance(2);
			return (ushort)(*currentPointerAndAdvance + (currentPointerAndAdvance[1] << 8));
		}

		public unsafe int ReadInt32()
		{
			byte* currentPointerAndAdvance = GetCurrentPointerAndAdvance(4);
			return *currentPointerAndAdvance + (currentPointerAndAdvance[1] << 8) + (currentPointerAndAdvance[2] << 16) + (currentPointerAndAdvance[3] << 24);
		}

		public unsafe uint ReadUInt32()
		{
			byte* currentPointerAndAdvance = GetCurrentPointerAndAdvance(4);
			return (uint)(*currentPointerAndAdvance + (currentPointerAndAdvance[1] << 8) + (currentPointerAndAdvance[2] << 16) + (currentPointerAndAdvance[3] << 24));
		}

		public unsafe long ReadInt64()
		{
			byte* currentPointerAndAdvance = GetCurrentPointerAndAdvance(8);
			uint num = (uint)(*currentPointerAndAdvance + (currentPointerAndAdvance[1] << 8) + (currentPointerAndAdvance[2] << 16) + (currentPointerAndAdvance[3] << 24));
			uint num2 = (uint)(currentPointerAndAdvance[4] + (currentPointerAndAdvance[5] << 8) + (currentPointerAndAdvance[6] << 16) + (currentPointerAndAdvance[7] << 24));
			return (long)(num + ((ulong)num2 << 32));
		}

		public ulong ReadUInt64()
		{
			return (ulong)ReadInt64();
		}

		public unsafe Guid ReadGuid()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			byte* currentPointerAndAdvance = GetCurrentPointerAndAdvance(16);
			_ = BitConverter.IsLittleEndian;
			return (Guid)(*currentPointerAndAdvance);
		}

		public unsafe string ReadUTF8(int P_0)
		{
			string result = _block.PeekUtf8(Offset, P_0);
			_currentPointer += P_0;
			return result;
		}

		public unsafe byte[] ReadBytes(int P_0)
		{
			byte[] result = _block.PeekBytes(Offset, P_0);
			_currentPointer += P_0;
			return result;
		}

		internal unsafe string ReadUtf8NullTerminated()
		{
			int num;
			string result = _block.PeekUtf8NullTerminated(Offset, null, MetadataStringDecoder.DefaultUTF8, out num);
			_currentPointer += num;
			return result;
		}

		private unsafe int ReadCompressedIntegerOrInvalid()
		{
			int num;
			int result = _block.PeekCompressedInteger(Offset, out num);
			_currentPointer += num;
			return result;
		}

		public bool TryReadCompressedInteger(out int P_0)
		{
			P_0 = ReadCompressedIntegerOrInvalid();
			return P_0 != 2147483647;
		}

		public int ReadCompressedInteger()
		{
			if (!TryReadCompressedInteger(out var result))
			{
				Throw.InvalidCompressedInteger();
			}
			return result;
		}

		public unsafe bool TryReadCompressedSignedInteger(out int P_0)
		{
			P_0 = _block.PeekCompressedInteger(Offset, out var num);
			if (P_0 == 2147483647)
			{
				return false;
			}
			bool flag = (P_0 & 1) != 0;
			P_0 >>= 1;
			if (flag)
			{
				switch (num)
				{
				case 1:
					P_0 |= -64;
					break;
				case 2:
					P_0 |= -8192;
					break;
				default:
					P_0 |= -268435456;
					break;
				}
			}
			_currentPointer += num;
			return true;
		}

		public int ReadCompressedSignedInteger()
		{
			if (!TryReadCompressedSignedInteger(out var result))
			{
				Throw.InvalidCompressedInteger();
			}
			return result;
		}

		public BlobHandle ReadBlobHandle()
		{
			return BlobHandle.FromOffset(ReadCompressedInteger());
		}
	}
	public enum HandleKind : byte
	{
		ModuleDefinition = 0,
		TypeReference = 1,
		TypeDefinition = 2,
		FieldDefinition = 4,
		MethodDefinition = 6,
		Parameter = 8,
		InterfaceImplementation = 9,
		MemberReference = 10,
		Constant = 11,
		CustomAttribute = 12,
		DeclarativeSecurityAttribute = 14,
		StandaloneSignature = 17,
		EventDefinition = 20,
		PropertyDefinition = 23,
		MethodImplementation = 25,
		ModuleReference = 26,
		TypeSpecification = 27,
		AssemblyDefinition = 32,
		AssemblyFile = 38,
		AssemblyReference = 35,
		ExportedType = 39,
		GenericParameter = 42,
		MethodSpecification = 43,
		GenericParameterConstraint = 44,
		ManifestResource = 40,
		Document = 48,
		MethodDebugInformation = 49,
		LocalScope = 50,
		LocalVariable = 51,
		LocalConstant = 52,
		ImportScope = 53,
		CustomDebugInformation = 55,
		NamespaceDefinition = 124,
		UserString = 112,
		String = 120,
		Blob = 113,
		Guid = 114
	}
	public readonly struct Handle : IEquatable<Handle>
	{
		private readonly int _value;

		private readonly byte _vType;

		public static readonly ModuleDefinitionHandle ModuleDefinition = new ModuleDefinitionHandle(1);

		public static readonly AssemblyDefinitionHandle AssemblyDefinition = new AssemblyDefinitionHandle(1);

		internal int RowId => _value;

		internal uint Type => _vType & 0x7Fu;

		internal byte VType => _vType;

		public HandleKind Kind
		{
			get
			{
				uint type = Type;
				if ((type & 0xFFFFFFFCu) == 120)
				{
					return HandleKind.String;
				}
				return (HandleKind)type;
			}
		}

		internal static Handle FromVToken(uint P_0)
		{
			return new Handle((byte)(P_0 >> 24), (int)(P_0 & 0xFFFFFF));
		}

		internal Handle(byte P_0, int P_1)
		{
			_vType = P_0;
			_value = P_1;
		}

		public override bool Equals([NotNullWhen(true)] object? P_0)
		{
			if (P_0 is Handle handle)
			{
				return Equals(handle);
			}
			return false;
		}

		public bool Equals(Handle P_0)
		{
			if (_value == P_0._value)
			{
				return _vType == P_0._vType;
			}
			return false;
		}

		public override int GetHashCode()
		{
			return _value ^ (_vType << 24);
		}
	}
	public enum MetadataKind
	{
		Ecma335,
		WindowsMetadata,
		ManagedWindowsMetadata
	}
	public sealed class MetadataReader
	{
		internal readonly NamespaceCache NamespaceCache;

		internal readonly MemoryBlock Block;

		internal readonly int WinMDMscorlibRef;

		private readonly object _memoryOwnerObj;

		private readonly MetadataReaderOptions _options;

		private readonly string _versionString;

		private readonly MetadataKind _metadataKind;

		private readonly MetadataStreamKind _metadataStreamKind;

		private readonly DebugMetadataHeader _debugMetadataHeader;

		internal StringHeap StringHeap;

		internal BlobHeap BlobHeap;

		internal GuidHeap GuidHeap;

		internal UserStringHeap UserStringHeap;

		internal bool IsMinimalDelta;

		private readonly TableMask _sortedTables;

		internal int[] TableRowCounts;

		internal ModuleTableReader ModuleTable;

		internal TypeRefTableReader TypeRefTable;

		internal TypeDefTableReader TypeDefTable;

		internal FieldPtrTableReader FieldPtrTable;

		internal FieldTableReader FieldTable;

		internal MethodPtrTableReader MethodPtrTable;

		internal MethodTableReader MethodDefTable;

		internal ParamPtrTableReader ParamPtrTable;

		internal ParamTableReader ParamTable;

		internal InterfaceImplTableReader InterfaceImplTable;

		internal MemberRefTableReader MemberRefTable;

		internal ConstantTableReader ConstantTable;

		internal CustomAttributeTableReader CustomAttributeTable;

		internal FieldMarshalTableReader FieldMarshalTable;

		internal DeclSecurityTableReader DeclSecurityTable;

		internal ClassLayoutTableReader ClassLayoutTable;

		internal FieldLayoutTableReader FieldLayoutTable;

		internal StandAloneSigTableReader StandAloneSigTable;

		internal EventMapTableReader EventMapTable;

		internal EventPtrTableReader EventPtrTable;

		internal EventTableReader EventTable;

		internal PropertyMapTableReader PropertyMapTable;

		internal PropertyPtrTableReader PropertyPtrTable;

		internal PropertyTableReader PropertyTable;

		internal MethodSemanticsTableReader MethodSemanticsTable;

		internal MethodImplTableReader MethodImplTable;

		internal ModuleRefTableReader ModuleRefTable;

		internal TypeSpecTableReader TypeSpecTable;

		internal ImplMapTableReader ImplMapTable;

		internal FieldRVATableReader FieldRvaTable;

		internal EnCLogTableReader EncLogTable;

		internal EnCMapTableReader EncMapTable;

		internal AssemblyTableReader AssemblyTable;

		internal AssemblyProcessorTableReader AssemblyProcessorTable;

		internal AssemblyOSTableReader AssemblyOSTable;

		internal AssemblyRefTableReader AssemblyRefTable;

		internal AssemblyRefProcessorTableReader AssemblyRefProcessorTable;

		internal AssemblyRefOSTableReader AssemblyRefOSTable;

		internal FileTableReader FileTable;

		internal ExportedTypeTableReader ExportedTypeTable;

		internal ManifestResourceTableReader ManifestResourceTable;

		internal NestedClassTableReader NestedClassTable;

		internal GenericParamTableReader GenericParamTable;

		internal MethodSpecTableReader MethodSpecTable;

		internal GenericParamConstraintTableReader GenericParamConstraintTable;

		internal DocumentTableReader DocumentTable;

		internal MethodDebugInformationTableReader MethodDebugInformationTable;

		internal LocalScopeTableReader LocalScopeTable;

		internal LocalVariableTableReader LocalVariableTable;

		internal LocalConstantTableReader LocalConstantTable;

		internal ImportScopeTableReader ImportScopeTable;

		internal StateMachineMethodTableReader StateMachineMethodTable;

		internal CustomDebugInformationTableReader CustomDebugInformationTable;

		internal static readonly byte[] WinRTPrefix = "<WinRT>"u8.ToArray();

		public MetadataReaderOptions Options => _options;

		public DebugMetadataHeader? DebugMetadataHeader => _debugMetadataHeader;

		[field: CompilerGenerated]
		public MetadataStringDecoder UTF8Decoder
		{
			[CompilerGenerated]
			get;
		}

		internal unsafe MetadataReader(byte* P_0, int P_1, MetadataReaderOptions P_2, MetadataStringDecoder? P_3, object? P_4)
		{
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			if (P_1 < 0)
			{
				Throw.ArgumentOutOfRange("length");
			}
			if (P_0 == null)
			{
				Throw.ArgumentNull("metadata");
			}
			if (P_3 == null)
			{
				P_3 = MetadataStringDecoder.DefaultUTF8;
			}
			if (!(P_3.Encoding is UTF8Encoding))
			{
				Throw.InvalidArgument(SR.MetadataStringDecoderEncodingMustBeUtf8, "utf8Decoder");
			}
			Block = new MemoryBlock(P_0, P_1);
			_memoryOwnerObj = P_4;
			_options = P_2;
			UTF8Decoder = P_3;
			BlobReader blobReader = new BlobReader(Block);
			ReadMetadataHeader(ref blobReader, out _versionString);
			_metadataKind = GetMetadataKind(_versionString);
			StreamHeader[] array = ReadStreamHeaders(ref blobReader);
			InitializeStreamReaders(in Block, array, out _metadataStreamKind, out var memoryBlock, out var memoryBlock2);
			int[] array2;
			if (memoryBlock2.Length > 0)
			{
				int num = (int)(memoryBlock2.Pointer - P_0);
				ReadStandalonePortablePdbStream(memoryBlock2, num, out _debugMetadataHeader, out array2);
			}
			else
			{
				array2 = null;
			}
			BlobReader blobReader2 = new BlobReader(memoryBlock);
			ReadMetadataTableHeader(ref blobReader2, out var heapSizes, out var array3, out _sortedTables);
			InitializeTableReaders(blobReader2.GetMemoryBlockAt(0, blobReader2.RemainingBytes), heapSizes, array3, array2);
			if (memoryBlock2.Length == 0 && ModuleTable.NumberOfRows < 1)
			{
				throw new BadImageFormatException(SR.Format(SR.ModuleTableInvalidNumberOfRows, ModuleTable.NumberOfRows));
			}
			NamespaceCache = new NamespaceCache(this);
			if (_metadataKind != 0)
			{
				WinMDMscorlibRef = FindMscorlibAssemblyRefNoProjection();
			}
		}

		private void ReadMetadataHeader(ref BlobReader P_0, out string P_1)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			if (P_0.RemainingBytes < 16)
			{
				throw new BadImageFormatException(SR.MetadataHeaderTooSmall);
			}
			uint num = P_0.ReadUInt32();
			if (num != 1112167234)
			{
				throw new BadImageFormatException(SR.MetadataSignature);
			}
			P_0.ReadUInt16();
			P_0.ReadUInt16();
			P_0.ReadUInt32();
			int num2 = P_0.ReadInt32();
			if (P_0.RemainingBytes < num2)
			{
				throw new BadImageFormatException(SR.NotEnoughSpaceForVersionString);
			}
			P_1 = P_0.GetMemoryBlockAt(0, num2).PeekUtf8NullTerminated(0, null, UTF8Decoder, out var _);
			P_0.Offset += num2;
		}

		private MetadataKind GetMetadataKind(string P_0)
		{
			if ((_options & MetadataReaderOptions.Default) == 0)
			{
				return MetadataKind.Ecma335;
			}
			if (!P_0.Contains("WindowsRuntime"))
			{
				return MetadataKind.Ecma335;
			}
			if (P_0.Contains("CLR"))
			{
				return MetadataKind.ManagedWindowsMetadata;
			}
			return MetadataKind.WindowsMetadata;
		}

		private static StreamHeader[] ReadStreamHeaders(ref BlobReader P_0)
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			P_0.ReadUInt16();
			int num = P_0.ReadInt16();
			StreamHeader[] array = new StreamHeader[num];
			for (int i = 0; i < array.Length; i++)
			{
				if (P_0.RemainingBytes < 8)
				{
					throw new BadImageFormatException(SR.StreamHeaderTooSmall);
				}
				array[i].Offset = P_0.ReadUInt32();
				array[i].Size = P_0.ReadInt32();
				array[i].Name = P_0.ReadUtf8NullTerminated();
				if (!P_0.TryAlign(4) || P_0.RemainingBytes == 0)
				{
					throw new BadImageFormatException(SR.NotEnoughSpaceForStreamHeaderName);
				}
			}
			return array;
		}

		private void InitializeStreamReaders(in MemoryBlock P_0, StreamHeader[] P_1, out MetadataStreamKind P_2, out MemoryBlock P_3, out MemoryBlock P_4)
		{
			//IL_038e: Unknown result type (might be due to invalid IL or missing references)
			//IL_025a: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0324: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_029f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0350: Unknown result type (might be due to invalid IL or missing references)
			//IL_0215: Unknown result type (might be due to invalid IL or missing references)
			P_3 = default(MemoryBlock);
			P_4 = default(MemoryBlock);
			P_2 = MetadataStreamKind.Illegal;
			for (int i = 0; i < P_1.Length; i++)
			{
				StreamHeader streamHeader = P_1[i];
				string name = streamHeader.Name;
				if (name == null)
				{
					continue;
				}
				switch (name.Length)
				{
				case 5:
					switch (name[1])
					{
					case 'B':
						if (name == "#Blob")
						{
							if (P_0.Length < streamHeader.Offset + streamHeader.Size)
							{
								throw new BadImageFormatException(SR.NotEnoughSpaceForBlobStream);
							}
							BlobHeap = new BlobHeap(P_0.GetMemoryBlockAt((int)streamHeader.Offset, streamHeader.Size), _metadataKind);
						}
						break;
					case 'G':
						if (name == "#GUID")
						{
							if (P_0.Length < streamHeader.Offset + streamHeader.Size)
							{
								throw new BadImageFormatException(SR.NotEnoughSpaceForGUIDStream);
							}
							GuidHeap = new GuidHeap(P_0.GetMemoryBlockAt((int)streamHeader.Offset, streamHeader.Size));
						}
						break;
					}
					break;
				case 2:
					switch (name[1])
					{
					case '~':
						if (name == "#~")
						{
							if (P_0.Length < streamHeader.Offset + streamHeader.Size)
							{
								throw new BadImageFormatException(SR.NotEnoughSpaceForMetadataStream);
							}
							P_2 = MetadataStreamKind.Compressed;
							P_3 = P_0.GetMemoryBlockAt((int)streamHeader.Offset, streamHeader.Size);
						}
						break;
					case '-':
						if (name == "#-")
						{
							if (P_0.Length < streamHeader.Offset + streamHeader.Size)
							{
								throw new BadImageFormatException(SR.NotEnoughSpaceForMetadataStream);
							}
							P_2 = MetadataStreamKind.Uncompressed;
							P_3 = P_0.GetMemoryBlockAt((int)streamHeader.Offset, streamHeader.Size);
						}
						break;
					}
					break;
				case 4:
					switch (name[1])
					{
					case 'J':
						if (name == "#JTD")
						{
							if (P_0.Length < streamHeader.Offset + streamHeader.Size)
							{
								throw new BadImageFormatException(SR.NotEnoughSpaceForMetadataStream);
							}
							IsMinimalDelta = true;
						}
						break;
					case 'P':
						if (name == "#Pdb")
						{
							if (P_0.Length < streamHeader.Offset + streamHeader.Size)
							{
								throw new BadImageFormatException(SR.NotEnoughSpaceForMetadataStream);
							}
							P_4 = P_0.GetMemoryBlockAt((int)streamHeader.Offset, streamHeader.Size);
						}
						break;
					}
					break;
				case 8:
					if (name == "#Strings")
					{
						if (P_0.Length < streamHeader.Offset + streamHeader.Size)
						{
							throw new BadImageFormatException(SR.NotEnoughSpaceForStringStream);
						}
						StringHeap = new StringHeap(P_0.GetMemoryBlockAt((int)streamHeader.Offset, streamHeader.Size), _metadataKind);
					}
					break;
				case 3:
					if (name == "#US")
					{
						if (P_0.Length < streamHeader.Offset + streamHeader.Size)
						{
							throw new BadImageFormatException(SR.NotEnoughSpaceForBlobStream);
						}
						UserStringHeap = new UserStringHeap(P_0.GetMemoryBlockAt((int)streamHeader.Offset, streamHeader.Size));
					}
					break;
				}
			}
			if (IsMinimalDelta && P_2 != MetadataStreamKind.Uncompressed)
			{
				throw new BadImageFormatException(SR.InvalidMetadataStreamFormat);
			}
		}

		private void ReadMetadataTableHeader(ref BlobReader P_0, out HeapSizes P_1, out int[] P_2, out TableMask P_3)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			if (P_0.RemainingBytes < 24)
			{
				throw new BadImageFormatException(SR.MetadataTableHeaderTooSmall);
			}
			P_0.ReadUInt32();
			P_0.ReadByte();
			P_0.ReadByte();
			P_1 = (HeapSizes)P_0.ReadByte();
			P_0.ReadByte();
			ulong num = P_0.ReadUInt64();
			P_3 = (TableMask)P_0.ReadUInt64();
			ulong num2 = 71811071505072127uL;
			if ((num & ~num2) != 0L)
			{
				throw new BadImageFormatException(SR.Format(SR.UnknownTables, num));
			}
			if (_metadataStreamKind == MetadataStreamKind.Compressed && (num & 0x804800A8u) != 0L)
			{
				throw new BadImageFormatException(SR.IllegalTablesInCompressedMetadataStream);
			}
			P_2 = ReadMetadataTableRowCounts(ref P_0, num);
			if ((P_1 & HeapSizes.ExtraData) == HeapSizes.ExtraData)
			{
				P_0.ReadUInt32();
			}
		}

		private static int[] ReadMetadataTableRowCounts(ref BlobReader P_0, ulong P_1)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			ulong num = 1uL;
			int[] array = new int[MetadataTokens.TableCount];
			for (int i = 0; i < array.Length; i++)
			{
				if ((P_1 & num) != 0L)
				{
					if (P_0.RemainingBytes < 4)
					{
						throw new BadImageFormatException(SR.TableRowCountSpaceTooSmall);
					}
					uint num2 = P_0.ReadUInt32();
					if (num2 > 16777215)
					{
						throw new BadImageFormatException(SR.Format(SR.InvalidRowCount, num2));
					}
					array[i] = (int)num2;
				}
				num <<= 1;
			}
			return array;
		}

		internal static void ReadStandalonePortablePdbStream(MemoryBlock P_0, int P_1, out DebugMetadataHeader P_2, out int[] P_3)
		{
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			BlobReader blobReader = new BlobReader(P_0);
			byte[] array = blobReader.ReadBytes(20);
			uint num = blobReader.ReadUInt32();
			int num2 = (int)(num & 0xFFFFFF);
			if (num != 0 && ((num & 0x7F000000) != 100663296 || num2 == 0))
			{
				throw new BadImageFormatException(SR.Format(SR.InvalidEntryPointToken, num));
			}
			ulong num3 = blobReader.ReadUInt64();
			if ((num3 & 0xFFFFE036C04800A8uL) != 0L)
			{
				throw new BadImageFormatException(SR.Format(SR.UnknownTables, num3));
			}
			P_3 = ReadMetadataTableRowCounts(ref blobReader, num3);
			P_2 = new DebugMetadataHeader(ImmutableCollectionsMarshal.AsImmutableArray<byte>(array), MethodDefinitionHandle.FromRowId(num2), P_1);
		}

		private int GetReferenceSize(int[] P_0, TableIndex P_1)
		{
			if ((long)P_0[(uint)P_1] >= 65536L || IsMinimalDelta)
			{
				return 4;
			}
			return 2;
		}

		private void InitializeTableReaders(MemoryBlock P_0, HeapSizes P_1, int[] P_2, int[] P_3)
		{
			//IL_0c2e: Unknown result type (might be due to invalid IL or missing references)
			TableRowCounts = P_2;
			int num = ((GetReferenceSize(P_2, TableIndex.FieldPtr) > 2) ? 4 : GetReferenceSize(P_2, TableIndex.Field));
			int num2 = ((GetReferenceSize(P_2, TableIndex.MethodPtr) > 2) ? 4 : GetReferenceSize(P_2, TableIndex.MethodDef));
			int num3 = ((GetReferenceSize(P_2, TableIndex.ParamPtr) > 2) ? 4 : GetReferenceSize(P_2, TableIndex.Param));
			int num4 = ((GetReferenceSize(P_2, TableIndex.EventPtr) > 2) ? 4 : GetReferenceSize(P_2, TableIndex.Event));
			int num5 = ((GetReferenceSize(P_2, TableIndex.PropertyPtr) > 2) ? 4 : GetReferenceSize(P_2, TableIndex.Property));
			int num6 = ComputeCodedTokenSize(16384, P_2, TableMask.TypeRef | TableMask.TypeDef | TableMask.TypeSpec);
			int num7 = ComputeCodedTokenSize(16384, P_2, TableMask.Field | TableMask.Param | TableMask.Property);
			int num8 = ComputeCodedTokenSize(2048, P_2, TableMask.Module | TableMask.TypeRef | TableMask.TypeDef | TableMask.Field | TableMask.MethodDef | TableMask.Param | TableMask.InterfaceImpl | TableMask.MemberRef | TableMask.DeclSecurity | TableMask.StandAloneSig | TableMask.Event | TableMask.Property | TableMask.ModuleRef | TableMask.TypeSpec | TableMask.Assembly | TableMask.AssemblyRef | TableMask.File | TableMask.ExportedType | TableMask.ManifestResource | TableMask.GenericParam | TableMask.MethodSpec | TableMask.GenericParamConstraint);
			int num9 = ComputeCodedTokenSize(32768, P_2, TableMask.Field | TableMask.Param);
			int num10 = ComputeCodedTokenSize(16384, P_2, TableMask.TypeDef | TableMask.MethodDef | TableMask.Assembly);
			int num11 = ComputeCodedTokenSize(8192, P_2, TableMask.TypeRef | TableMask.TypeDef | TableMask.MethodDef | TableMask.ModuleRef | TableMask.TypeSpec);
			int num12 = ComputeCodedTokenSize(32768, P_2, TableMask.Event | TableMask.Property);
			int num13 = ComputeCodedTokenSize(32768, P_2, TableMask.MethodDef | TableMask.MemberRef);
			int num14 = ComputeCodedTokenSize(32768, P_2, TableMask.Field | TableMask.MethodDef);
			int num15 = ComputeCodedTokenSize(16384, P_2, TableMask.AssemblyRef | TableMask.File | TableMask.ExportedType);
			int num16 = ComputeCodedTokenSize(8192, P_2, TableMask.MethodDef | TableMask.MemberRef);
			int num17 = ComputeCodedTokenSize(16384, P_2, TableMask.Module | TableMask.TypeRef | TableMask.ModuleRef | TableMask.AssemblyRef);
			int num18 = ComputeCodedTokenSize(32768, P_2, TableMask.TypeDef | TableMask.MethodDef);
			int num19 = (((P_1 & HeapSizes.StringHeapLarge) == HeapSizes.StringHeapLarge) ? 4 : 2);
			int num20 = (((P_1 & HeapSizes.GuidHeapLarge) == HeapSizes.GuidHeapLarge) ? 4 : 2);
			int num21 = (((P_1 & HeapSizes.BlobHeapLarge) == HeapSizes.BlobHeapLarge) ? 4 : 2);
			int num22 = 0;
			ModuleTable = new ModuleTableReader(P_2[0], num19, num20, P_0, num22);
			num22 += ModuleTable.Block.Length;
			TypeRefTable = new TypeRefTableReader(P_2[1], num17, num19, P_0, num22);
			num22 += TypeRefTable.Block.Length;
			TypeDefTable = new TypeDefTableReader(P_2[2], num, num2, num6, num19, P_0, num22);
			num22 += TypeDefTable.Block.Length;
			FieldPtrTable = new FieldPtrTableReader(P_2[3], GetReferenceSize(P_2, TableIndex.Field), P_0, num22);
			num22 += FieldPtrTable.Block.Length;
			FieldTable = new FieldTableReader(P_2[4], num19, num21, P_0, num22);
			num22 += FieldTable.Block.Length;
			MethodPtrTable = new MethodPtrTableReader(P_2[5], GetReferenceSize(P_2, TableIndex.MethodDef), P_0, num22);
			num22 += MethodPtrTable.Block.Length;
			MethodDefTable = new MethodTableReader(P_2[6], num3, num19, num21, P_0, num22);
			num22 += MethodDefTable.Block.Length;
			ParamPtrTable = new ParamPtrTableReader(P_2[7], GetReferenceSize(P_2, TableIndex.Param), P_0, num22);
			num22 += ParamPtrTable.Block.Length;
			ParamTable = new ParamTableReader(P_2[8], num19, P_0, num22);
			num22 += ParamTable.Block.Length;
			InterfaceImplTable = new InterfaceImplTableReader(P_2[9], IsDeclaredSorted(TableMask.InterfaceImpl), GetReferenceSize(P_2, TableIndex.TypeDef), num6, P_0, num22);
			num22 += InterfaceImplTable.Block.Length;
			MemberRefTable = new MemberRefTableReader(P_2[10], num11, num19, num21, P_0, num22);
			num22 += MemberRefTable.Block.Length;
			ConstantTable = new ConstantTableReader(P_2[11], IsDeclaredSorted(TableMask.Constant), num7, num21, P_0, num22);
			num22 += ConstantTable.Block.Length;
			CustomAttributeTable = new CustomAttributeTableReader(P_2[12], IsDeclaredSorted(TableMask.CustomAttribute), num8, num16, num21, P_0, num22);
			num22 += CustomAttributeTable.Block.Length;
			FieldMarshalTable = new FieldMarshalTableReader(P_2[13], IsDeclaredSorted(TableMask.FieldMarshal), num9, num21, P_0, num22);
			num22 += FieldMarshalTable.Block.Length;
			DeclSecurityTable = new DeclSecurityTableReader(P_2[14], IsDeclaredSorted(TableMask.DeclSecurity), num10, num21, P_0, num22);
			num22 += DeclSecurityTable.Block.Length;
			ClassLayoutTable = new ClassLayoutTableReader(P_2[15], IsDeclaredSorted(TableMask.ClassLayout), GetReferenceSize(P_2, TableIndex.TypeDef), P_0, num22);
			num22 += ClassLayoutTable.Block.Length;
			FieldLayoutTable = new FieldLayoutTableReader(P_2[16], IsDeclaredSorted(TableMask.FieldLayout), GetReferenceSize(P_2, TableIndex.Field), P_0, num22);
			num22 += FieldLayoutTable.Block.Length;
			StandAloneSigTable = new StandAloneSigTableReader(P_2[17], num21, P_0, num22);
			num22 += StandAloneSigTable.Block.Length;
			EventMapTable = new EventMapTableReader(P_2[18], GetReferenceSize(P_2, TableIndex.TypeDef), num4, P_0, num22);
			num22 += EventMapTable.Block.Length;
			EventPtrTable = new EventPtrTableReader(P_2[19], GetReferenceSize(P_2, TableIndex.Event), P_0, num22);
			num22 += EventPtrTable.Block.Length;
			EventTable = new EventTableReader(P_2[20], num6, num19, P_0, num22);
			num22 += EventTable.Block.Length;
			PropertyMapTable = new PropertyMapTableReader(P_2[21], GetReferenceSize(P_2, TableIndex.TypeDef), num5, P_0, num22);
			num22 += PropertyMapTable.Block.Length;
			PropertyPtrTable = new PropertyPtrTableReader(P_2[22], GetReferenceSize(P_2, TableIndex.Property), P_0, num22);
			num22 += PropertyPtrTable.Block.Length;
			PropertyTable = new PropertyTableReader(P_2[23], num19, num21, P_0, num22);
			num22 += PropertyTable.Block.Length;
			MethodSemanticsTable = new MethodSemanticsTableReader(P_2[24], IsDeclaredSorted(TableMask.MethodSemantics), GetReferenceSize(P_2, TableIndex.MethodDef), num12, P_0, num22);
			num22 += MethodSemanticsTable.Block.Length;
			MethodImplTable = new MethodImplTableReader(P_2[25], IsDeclaredSorted(TableMask.MethodImpl), GetReferenceSize(P_2, TableIndex.TypeDef), num13, P_0, num22);
			num22 += MethodImplTable.Block.Length;
			ModuleRefTable = new ModuleRefTableReader(P_2[26], num19, P_0, num22);
			num22 += ModuleRefTable.Block.Length;
			TypeSpecTable = new TypeSpecTableReader(P_2[27], num21, P_0, num22);
			num22 += TypeSpecTable.Block.Length;
			ImplMapTable = new ImplMapTableReader(P_2[28], IsDeclaredSorted(TableMask.ImplMap), GetReferenceSize(P_2, TableIndex.ModuleRef), num14, num19, P_0, num22);
			num22 += ImplMapTable.Block.Length;
			FieldRvaTable = new FieldRVATableReader(P_2[29], IsDeclaredSorted(TableMask.FieldRva), GetReferenceSize(P_2, TableIndex.Field), P_0, num22);
			num22 += FieldRvaTable.Block.Length;
			EncLogTable = new EnCLogTableReader(P_2[30], P_0, num22, _metadataStreamKind);
			num22 += EncLogTable.Block.Length;
			EncMapTable = new EnCMapTableReader(P_2[31], P_0, num22);
			num22 += EncMapTable.Block.Length;
			AssemblyTable = new AssemblyTableReader(P_2[32], num19, num21, P_0, num22);
			num22 += AssemblyTable.Block.Length;
			AssemblyProcessorTable = new AssemblyProcessorTableReader(P_2[33], P_0, num22);
			num22 += AssemblyProcessorTable.Block.Length;
			AssemblyOSTable = new AssemblyOSTableReader(P_2[34], P_0, num22);
			num22 += AssemblyOSTable.Block.Length;
			AssemblyRefTable = new AssemblyRefTableReader(P_2[35], num19, num21, P_0, num22, _metadataKind);
			num22 += AssemblyRefTable.Block.Length;
			AssemblyRefProcessorTable = new AssemblyRefProcessorTableReader(P_2[36], GetReferenceSize(P_2, TableIndex.AssemblyRef), P_0, num22);
			num22 += AssemblyRefProcessorTable.Block.Length;
			AssemblyRefOSTable = new AssemblyRefOSTableReader(P_2[37], GetReferenceSize(P_2, TableIndex.AssemblyRef), P_0, num22);
			num22 += AssemblyRefOSTable.Block.Length;
			FileTable = new FileTableReader(P_2[38], num19, num21, P_0, num22);
			num22 += FileTable.Block.Length;
			ExportedTypeTable = new ExportedTypeTableReader(P_2[39], num15, num19, P_0, num22);
			num22 += ExportedTypeTable.Block.Length;
			ManifestResourceTable = new ManifestResourceTableReader(P_2[40], num15, num19, P_0, num22);
			num22 += ManifestResourceTable.Block.Length;
			NestedClassTable = new NestedClassTableReader(P_2[41], IsDeclaredSorted(TableMask.NestedClass), GetReferenceSize(P_2, TableIndex.TypeDef), P_0, num22);
			num22 += NestedClassTable.Block.Length;
			GenericParamTable = new GenericParamTableReader(P_2[42], IsDeclaredSorted(TableMask.GenericParam), num18, num19, P_0, num22);
			num22 += GenericParamTable.Block.Length;
			MethodSpecTable = new MethodSpecTableReader(P_2[43], num13, num21, P_0, num22);
			num22 += MethodSpecTable.Block.Length;
			GenericParamConstraintTable = new GenericParamConstraintTableReader(P_2[44], IsDeclaredSorted(TableMask.GenericParamConstraint), GetReferenceSize(P_2, TableIndex.GenericParam), num6, P_0, num22);
			num22 += GenericParamConstraintTable.Block.Length;
			int[] array = ((P_3 != null) ? CombineRowCounts(P_2, P_3, TableIndex.Document) : P_2);
			int referenceSize = GetReferenceSize(array, TableIndex.MethodDef);
			int num23 = ComputeCodedTokenSize(2048, array, TableMask.Module | TableMask.TypeRef | TableMask.TypeDef | TableMask.Field | TableMask.MethodDef | TableMask.Param | TableMask.InterfaceImpl | TableMask.MemberRef | TableMask.DeclSecurity | TableMask.StandAloneSig | TableMask.Event | TableMask.Property | TableMask.ModuleRef | TableMask.TypeSpec | TableMask.Assembly | TableMask.AssemblyRef | TableMask.File | TableMask.ExportedType | TableMask.ManifestResource | TableMask.GenericParam | TableMask.MethodSpec | TableMask.GenericParamConstraint | TableMask.Document | TableMask.LocalScope | TableMask.LocalVariable | TableMask.LocalConstant | TableMask.ImportScope);
			DocumentTable = new DocumentTableReader(P_2[48], num20, num21, P_0, num22);
			num22 += DocumentTable.Block.Length;
			MethodDebugInformationTable = new MethodDebugInformationTableReader(P_2[49], GetReferenceSize(P_2, TableIndex.Document), num21, P_0, num22);
			num22 += MethodDebugInformationTable.Block.Length;
			LocalScopeTable = new LocalScopeTableReader(P_2[50], IsDeclaredSorted(TableMask.LocalScope), referenceSize, GetReferenceSize(P_2, TableIndex.ImportScope), GetReferenceSize(P_2, TableIndex.LocalVariable), GetReferenceSize(P_2, TableIndex.LocalConstant), P_0, num22);
			num22 += LocalScopeTable.Block.Length;
			LocalVariableTable = new LocalVariableTableReader(P_2[51], num19, P_0, num22);
		

UnityEngine.PhysicsModule.dll

Decompiled 8 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security;
using System.Security.Permissions;
using Unity.Collections;
using Unity.Collections.LowLevel.Unsafe;
using Unity.Jobs;
using Unity.Jobs.LowLevel.Unsafe;
using UnityEngine;
using UnityEngine.Bindings;
using UnityEngine.Internal;
using UnityEngine.SceneManagement;
using UnityEngine.Scripting;

[assembly: InternalsVisibleTo("UnityEngine.UnityTestProtocolModule")]
[assembly: InternalsVisibleTo("UnityEngine.UnityCurlModule")]
[assembly: InternalsVisibleTo("UnityEngine.UmbraModule")]
[assembly: InternalsVisibleTo("UnityEngine.UIElementsModule")]
[assembly: InternalsVisibleTo("UnityEngine.UIModule")]
[assembly: InternalsVisibleTo("UnityEngine.TilemapModule")]
[assembly: InternalsVisibleTo("UnityEngine.TerrainPhysicsModule")]
[assembly: InternalsVisibleTo("UnityEngine.TerrainModule")]
[assembly: InternalsVisibleTo("UnityEngine.SubsystemsModule")]
[assembly: InternalsVisibleTo("UnityEngine.SubstanceModule")]
[assembly: InternalsVisibleTo("UnityEngine.StreamingModule")]
[assembly: InternalsVisibleTo("UnityEngine.SpriteShapeModule")]
[assembly: InternalsVisibleTo("UnityEngine.SpriteMaskModule")]
[assembly: InternalsVisibleTo("UnityEngine.ScreenCaptureModule")]
[assembly: InternalsVisibleTo("UnityEngine.RuntimeInitializeOnLoadManagerInitializerModule")]
[assembly: InternalsVisibleTo("UnityEngine.PropertiesModule")]
[assembly: InternalsVisibleTo("UnityEngine.ProfilerModule")]
[assembly: InternalsVisibleTo("UnityEngine.UnityWebRequestAssetBundleModule")]
[assembly: InternalsVisibleTo("UnityEngine.Physics2DModule")]
[assembly: InternalsVisibleTo("UnityEngine.UnityWebRequestAudioModule")]
[assembly: InternalsVisibleTo("UnityEngine.UnityWebRequestWWWModule")]
[assembly: InternalsVisibleTo("Unity.Analytics")]
[assembly: InternalsVisibleTo("UnityEngine.Cloud.Service")]
[assembly: InternalsVisibleTo("UnityEngine.Cloud")]
[assembly: InternalsVisibleTo("UnityEngine.Networking")]
[assembly: InternalsVisibleTo("UnityEngine.PS5VRModule")]
[assembly: InternalsVisibleTo("UnityEngine.PS5Module")]
[assembly: InternalsVisibleTo("UnityEngine.PS4VRModule")]
[assembly: InternalsVisibleTo("UnityEngine.PS4Module")]
[assembly: InternalsVisibleTo("UnityEngine.XboxOneModule")]
[assembly: InternalsVisibleTo("UnityEngine.SwitchModule")]
[assembly: InternalsVisibleTo("UnityEngine.WindModule")]
[assembly: InternalsVisibleTo("UnityEngine.VirtualTexturingModule")]
[assembly: InternalsVisibleTo("UnityEngine.VideoModule")]
[assembly: InternalsVisibleTo("UnityEngine.VehiclesModule")]
[assembly: InternalsVisibleTo("UnityEngine.VRModule")]
[assembly: InternalsVisibleTo("UnityEngine.XRModule")]
[assembly: InternalsVisibleTo("UnityEngine.VFXModule")]
[assembly: InternalsVisibleTo("UnityEngine.UnityWebRequestTextureModule")]
[assembly: InternalsVisibleTo("UnityEngine.PerformanceReportingModule")]
[assembly: InternalsVisibleTo("UnityEngine.ParticleSystemModule")]
[assembly: InternalsVisibleTo("UnityEngine.NVIDIAModule")]
[assembly: InternalsVisibleTo("UnityEngine.AudioModule")]
[assembly: InternalsVisibleTo("UnityEngine.AssetBundleModule")]
[assembly: InternalsVisibleTo("UnityEngine.HotReloadModule")]
[assembly: InternalsVisibleTo("UnityEngine.AnimationModule")]
[assembly: InternalsVisibleTo("UnityEngine.AndroidJNIModule")]
[assembly: InternalsVisibleTo("UnityEngine.AccessibilityModule")]
[assembly: InternalsVisibleTo("UnityEngine.ARModule")]
[assembly: InternalsVisibleTo("UnityEngine.InputModule")]
[assembly: InternalsVisibleTo("UnityEngine.JSONSerializeModule")]
[assembly: InternalsVisibleTo("UnityEngine.PhysicsModule")]
[assembly: InternalsVisibleTo("UnityEngine.AIModule")]
[assembly: InternalsVisibleTo("UnityEngine.CoreModule")]
[assembly: InternalsVisibleTo("UnityEngine.SharedInternalsModule")]
[assembly: InternalsVisibleTo("UnityEngine")]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: CompilationRelaxations(8)]
[assembly: InternalsVisibleTo("UnityEngine.ClothModule")]
[assembly: InternalsVisibleTo("UnityEngine.ClusterInputModule")]
[assembly: InternalsVisibleTo("UnityEngine.ClusterRendererModule")]
[assembly: InternalsVisibleTo("UnityEngine.ContentLoadModule")]
[assembly: InternalsVisibleTo("UnityEngine.LocalizationModule")]
[assembly: InternalsVisibleTo("UnityEngine.IMGUIModule")]
[assembly: InternalsVisibleTo("UnityEngine.TextCoreTextEngineModule")]
[assembly: InternalsVisibleTo("UnityEngine.TextCoreFontEngineModule")]
[assembly: InternalsVisibleTo("UnityEngine.InputLegacyModule")]
[assembly: InternalsVisibleTo("UnityEngine.TextRenderingModule")]
[assembly: InternalsVisibleTo("UnityEngine.GridModule")]
[assembly: InternalsVisibleTo("UnityEngine.GameCenterModule")]
[assembly: InternalsVisibleTo("UnityEngine.Analytics")]
[assembly: InternalsVisibleTo("UnityEngine.ImageConversionModule")]
[assembly: InternalsVisibleTo("UnityEngine.DirectorModule")]
[assembly: InternalsVisibleTo("UnityEngine.DSPGraphModule")]
[assembly: InternalsVisibleTo("UnityEngine.CrashReportingModule")]
[assembly: InternalsVisibleTo("UnityEngine.UnityAnalyticsModule")]
[assembly: InternalsVisibleTo("UnityEngine.UnityWebRequestModule")]
[assembly: InternalsVisibleTo("UnityEngine.TLSModule")]
[assembly: InternalsVisibleTo("UnityEngine.UnityAnalyticsCommonModule")]
[assembly: InternalsVisibleTo("UnityEngine.UnityConnectModule")]
[assembly: InternalsVisibleTo("UnityEngine.GIModule")]
[assembly: InternalsVisibleTo("UnityEngine.UnityAnalyticsCommon")]
[assembly: InternalsVisibleTo("UnityEngine.Purchasing")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.011")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.010")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.009")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.008")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.007")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.006")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.005")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.004")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.003")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.002")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.001")]
[assembly: InternalsVisibleTo("UnityEngine.Core.Runtime.Tests")]
[assembly: InternalsVisibleTo("UnityEngine.Advertisements")]
[assembly: InternalsVisibleTo("Unity.Runtime")]
[assembly: InternalsVisibleTo("Unity.Collections")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.012")]
[assembly: InternalsVisibleTo("Unity.Entities.Tests")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.013")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.015")]
[assembly: InternalsVisibleTo("Unity.Subsystem.Registration")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridgeDev.005")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridgeDev.004")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridgeDev.003")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridgeDev.002")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridgeDev.001")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.024")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.023")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.022")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.021")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.020")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.019")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.018")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.017")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.016")]
[assembly: InternalsVisibleTo("Unity.InternalAPIEngineBridge.014")]
[assembly: InternalsVisibleTo("Unity.Entities")]
[assembly: InternalsVisibleTo("Unity.Core")]
[assembly: InternalsVisibleTo("Unity.Services.QoS")]
[assembly: InternalsVisibleTo("Unity.Timeline")]
[assembly: InternalsVisibleTo("Unity.RuntimeTests.AllIn1Runner")]
[assembly: InternalsVisibleTo("Unity.Logging")]
[assembly: InternalsVisibleTo("Unity.RuntimeTests.Framework.Tests")]
[assembly: InternalsVisibleTo("Unity.RuntimeTests.Framework")]
[assembly: InternalsVisibleTo("Unity.RuntimeTests")]
[assembly: InternalsVisibleTo("Unity.IntegrationTests.Framework")]
[assembly: InternalsVisibleTo("Unity.IntegrationTests.Timeline")]
[assembly: InternalsVisibleTo("Unity.IntegrationTests.UnityAnalytics")]
[assembly: InternalsVisibleTo("Unity.IntegrationTests")]
[assembly: InternalsVisibleTo("Unity.DeploymentTests.Services")]
[assembly: InternalsVisibleTo("Unity.Burst.Editor")]
[assembly: InternalsVisibleTo("Unity.Burst")]
[assembly: InternalsVisibleTo("Unity.Automation")]
[assembly: InternalsVisibleTo("UnityEngine.TestRunner")]
[assembly: InternalsVisibleTo("Assembly-CSharp-testable")]
[assembly: InternalsVisibleTo("Assembly-CSharp-firstpass-testable")]
[assembly: InternalsVisibleTo("Unity.PerformanceTests.RuntimeTestRunner.Tests")]
[assembly: InternalsVisibleTo("GoogleAR.UnityNative")]
[assembly: InternalsVisibleTo("Unity.ucg.QoS")]
[assembly: InternalsVisibleTo("Unity.Networking.Transport")]
[assembly: InternalsVisibleTo("UnityEngine.UI")]
[assembly: InternalsVisibleTo("UnityEngine.SpatialTracking")]
[assembly: InternalsVisibleTo("UnityEngine.UIElements.Tests")]
[assembly: InternalsVisibleTo("Unity.UIElements.PlayModeTests")]
[assembly: InternalsVisibleTo("Unity.UIElements.Editor")]
[assembly: InternalsVisibleTo("Unity.UIElements.EditorTests")]
[assembly: InternalsVisibleTo("Unity.UIElements")]
[assembly: InternalsVisibleTo("Unity.WindowsMRAutomation")]
[assembly: InternalsVisibleTo("Unity.2D.Sprite.Editor")]
[assembly: InternalsVisibleTo("UnityEngine.UIElementsGameObjectsModule")]
[assembly: InternalsVisibleTo("Unity.2D.Sprite.EditorTests")]
[assembly: UnityEngineModuleAssembly]
[assembly: InternalsVisibleTo("UnityEditor.UIBuilderModule")]
[assembly: InternalsVisibleTo("Unity.UI.Builder.EditorTests")]
[assembly: InternalsVisibleTo("Unity.UI.Builder.Editor")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
namespace UnityEngine;

public enum RigidbodyConstraints
{
	None = 0,
	FreezePositionX = 2,
	FreezePositionY = 4,
	FreezePositionZ = 8,
	FreezeRotationX = 16,
	FreezeRotationY = 32,
	FreezeRotationZ = 64,
	FreezePosition = 14,
	FreezeRotation = 112,
	FreezeAll = 126
}
public enum ForceMode
{
	Force = 0,
	Acceleration = 5,
	Impulse = 1,
	VelocityChange = 2
}
public enum JointProjectionMode
{
	None,
	PositionAndRotation,
	[EditorBrowsable(EditorBrowsableState.Never)]
	[Obsolete("JointProjectionMode.PositionOnly is no longer supported", true)]
	PositionOnly
}
[Flags]
public enum MeshColliderCookingOptions
{
	None = 0,
	[Obsolete("No longer used because the problem this was trying to solve is gone since Unity 2018.3", true)]
	InflateConvexMesh = 1,
	CookForFasterSimulation = 2,
	EnableMeshCleaning = 4,
	WeldColocatedVertices = 8,
	UseFastMidphase = 0x10
}
public struct WheelFrictionCurve
{
	private float m_ExtremumSlip;

	private float m_ExtremumValue;

	private float m_AsymptoteSlip;

	private float m_AsymptoteValue;

	private float m_Stiffness;

	public float extremumSlip
	{
		get
		{
			return m_ExtremumSlip;
		}
		set
		{
			m_ExtremumSlip = value;
		}
	}

	public float extremumValue
	{
		get
		{
			return m_ExtremumValue;
		}
		set
		{
			m_ExtremumValue = value;
		}
	}

	public float asymptoteSlip
	{
		get
		{
			return m_AsymptoteSlip;
		}
		set
		{
			m_AsymptoteSlip = value;
		}
	}

	public float asymptoteValue
	{
		get
		{
			return m_AsymptoteValue;
		}
		set
		{
			m_AsymptoteValue = value;
		}
	}

	public float stiffness
	{
		get
		{
			return m_Stiffness;
		}
		set
		{
			m_Stiffness = value;
		}
	}
}
public struct SoftJointLimit
{
	private float m_Limit;

	private float m_Bounciness;

	private float m_ContactDistance;

	public float limit
	{
		get
		{
			return m_Limit;
		}
		set
		{
			m_Limit = value;
		}
	}

	public float bounciness
	{
		get
		{
			return m_Bounciness;
		}
		set
		{
			m_Bounciness = value;
		}
	}

	public float contactDistance
	{
		get
		{
			return m_ContactDistance;
		}
		set
		{
			m_ContactDistance = value;
		}
	}

	[Obsolete("Spring has been moved to SoftJointLimitSpring class in Unity 5", true)]
	[EditorBrowsable(EditorBrowsableState.Never)]
	public float spring
	{
		get
		{
			return 0f;
		}
		set
		{
		}
	}

	[Obsolete("Damper has been moved to SoftJointLimitSpring class in Unity 5", true)]
	[EditorBrowsable(EditorBrowsableState.Never)]
	public float damper
	{
		get
		{
			return 0f;
		}
		set
		{
		}
	}

	[Obsolete("Use SoftJointLimit.bounciness instead", true)]
	[EditorBrowsable(EditorBrowsableState.Never)]
	public float bouncyness
	{
		get
		{
			return m_Bounciness;
		}
		set
		{
			m_Bounciness = value;
		}
	}
}
public struct SoftJointLimitSpring
{
	private float m_Spring;

	private float m_Damper;

	public float spring
	{
		get
		{
			return m_Spring;
		}
		set
		{
			m_Spring = value;
		}
	}

	public float damper
	{
		get
		{
			return m_Damper;
		}
		set
		{
			m_Damper = value;
		}
	}
}
public struct JointDrive
{
	private float m_PositionSpring;

	private float m_PositionDamper;

	private float m_MaximumForce;

	private int m_UseAcceleration;

	public float positionSpring
	{
		get
		{
			return m_PositionSpring;
		}
		set
		{
			m_PositionSpring = value;
		}
	}

	public float positionDamper
	{
		get
		{
			return m_PositionDamper;
		}
		set
		{
			m_PositionDamper = value;
		}
	}

	public float maximumForce
	{
		get
		{
			return m_MaximumForce;
		}
		set
		{
			m_MaximumForce = value;
		}
	}

	public bool useAcceleration
	{
		get
		{
			return m_UseAcceleration == 1;
		}
		set
		{
			m_UseAcceleration = (value ? 1 : 0);
		}
	}

	[Obsolete("JointDriveMode is obsolete")]
	public JointDriveMode mode
	{
		get
		{
			return JointDriveMode.None;
		}
		set
		{
		}
	}
}
public enum RigidbodyInterpolation
{
	None,
	Interpolate,
	Extrapolate
}
public struct JointMotor
{
	private float m_TargetVelocity;

	private float m_Force;

	private int m_FreeSpin;

	public float targetVelocity
	{
		get
		{
			return m_TargetVelocity;
		}
		set
		{
			m_TargetVelocity = value;
		}
	}

	public float force
	{
		get
		{
			return m_Force;
		}
		set
		{
			m_Force = value;
		}
	}

	public bool freeSpin
	{
		get
		{
			return m_FreeSpin == 1;
		}
		set
		{
			m_FreeSpin = (value ? 1 : 0);
		}
	}
}
public struct JointSpring
{
	public float spring;

	public float damper;

	public float targetPosition;
}
public struct JointLimits
{
	private float m_Min;

	private float m_Max;

	private float m_Bounciness;

	private float m_BounceMinVelocity;

	private float m_ContactDistance;

	[Obsolete("minBounce and maxBounce are replaced by a single JointLimits.bounciness for both limit ends.", true)]
	[EditorBrowsable(EditorBrowsableState.Never)]
	public float minBounce;

	[Obsolete("minBounce and maxBounce are replaced by a single JointLimits.bounciness for both limit ends.", true)]
	[EditorBrowsable(EditorBrowsableState.Never)]
	public float maxBounce;

	public float min
	{
		get
		{
			return m_Min;
		}
		set
		{
			m_Min = value;
		}
	}

	public float max
	{
		get
		{
			return m_Max;
		}
		set
		{
			m_Max = value;
		}
	}

	public float bounciness
	{
		get
		{
			return m_Bounciness;
		}
		set
		{
			m_Bounciness = value;
		}
	}

	public float bounceMinVelocity
	{
		get
		{
			return m_BounceMinVelocity;
		}
		set
		{
			m_BounceMinVelocity = value;
		}
	}

	public float contactDistance
	{
		get
		{
			return m_ContactDistance;
		}
		set
		{
			m_ContactDistance = value;
		}
	}
}
[StructLayout(LayoutKind.Sequential)]
[RequiredByNativeCode]
public class ControllerColliderHit
{
	internal CharacterController m_Controller;

	internal Collider m_Collider;

	internal Vector3 m_Point;

	internal Vector3 m_Normal;

	internal Vector3 m_MoveDirection;

	internal float m_MoveLength;

	internal int m_Push;

	public CharacterController controller => m_Controller;

	public Collider collider => m_Collider;

	public Rigidbody rigidbody => m_Collider.attachedRigidbody;

	public GameObject gameObject => ((Component)m_Collider).gameObject;

	public Transform transform => ((Component)m_Collider).transform;

	public Vector3 point => m_Point;

	public Vector3 normal => m_Normal;

	public Vector3 moveDirection => m_MoveDirection;

	public float moveLength => m_MoveLength;

	private bool push
	{
		get
		{
			return m_Push != 0;
		}
		set
		{
			m_Push = (value ? 1 : 0);
		}
	}
}
public enum PhysicMaterialCombine
{
	Average = 0,
	Minimum = 2,
	Multiply = 1,
	Maximum = 3
}
public class Collision
{
	private ContactPairHeader m_Header;

	private ContactPair m_Pair;

	private bool m_Flipped;

	private ContactPoint[] m_LegacyContacts = null;

	public Vector3 impulse => m_Pair.ImpulseSum;

	public Vector3 relativeVelocity => m_Flipped ? m_Header.m_RelativeVelocity : (-m_Header.m_RelativeVelocity);

	public Rigidbody rigidbody => body as Rigidbody;

	public ArticulationBody articulationBody => body as ArticulationBody;

	public Component body => m_Flipped ? m_Header.Body : m_Header.OtherBody;

	public Collider collider => m_Flipped ? m_Pair.Collider : m_Pair.OtherCollider;

	public Transform transform => ((Object)(object)rigidbody != (Object)null) ? ((Component)rigidbody).transform : ((Component)collider).transform;

	public GameObject gameObject => ((Object)(object)body != (Object)null) ? body.gameObject : ((Component)collider).gameObject;

	internal bool Flipped
	{
		get
		{
			return m_Flipped;
		}
		set
		{
			m_Flipped = value;
		}
	}

	public int contactCount => (int)m_Pair.m_NbPoints;

	public ContactPoint[] contacts
	{
		get
		{
			if (m_LegacyContacts == null)
			{
				m_LegacyContacts = new ContactPoint[m_Pair.m_NbPoints];
				m_Pair.ExtractContactsArray(m_LegacyContacts, m_Flipped);
			}
			return m_LegacyContacts;
		}
	}

	[Obsolete("Use Collision.relativeVelocity instead. (UnityUpgradable) -> relativeVelocity", false)]
	[EditorBrowsable(EditorBrowsableState.Never)]
	public Vector3 impactForceSum => Vector3.zero;

	[EditorBrowsable(EditorBrowsableState.Never)]
	[Obsolete("Will always return zero.", true)]
	public Vector3 frictionForceSum => Vector3.zero;

	[Obsolete("Please use Collision.rigidbody, Collision.transform or Collision.collider instead", false)]
	[EditorBrowsable(EditorBrowsableState.Never)]
	public Component other => (Component)(object)(((Object)(object)body != (Object)null) ? ((Collider)(object)body) : collider);

	public Collision()
	{
		m_Header = default(ContactPairHeader);
		m_Pair = default(ContactPair);
		m_Flipped = false;
		m_LegacyContacts = null;
	}

	internal Collision(in ContactPairHeader header, in ContactPair pair, bool flipped)
	{
		m_LegacyContacts = new ContactPoint[pair.m_NbPoints];
		pair.ExtractContactsArray(m_LegacyContacts, flipped);
		m_Header = header;
		m_Pair = pair;
		m_Flipped = flipped;
	}

	internal void Reuse(in ContactPairHeader header, in ContactPair pair)
	{
		m_Header = header;
		m_Pair = pair;
		m_LegacyContacts = null;
		m_Flipped = false;
	}

	public unsafe ContactPoint GetContact(int index)
	{
		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0082: Unknown result type (might be due to invalid IL or missing references)
		//IL_0088: Unknown result type (might be due to invalid IL or missing references)
		//IL_008e: Unknown result type (might be due to invalid IL or missing references)
		if (index < 0 || index >= contactCount)
		{
			throw new ArgumentOutOfRangeException($"Cannot get contact at index {index}. There are {contactCount} contact(s).");
		}
		if (m_LegacyContacts != null)
		{
			return m_LegacyContacts[index];
		}
		float num = (m_Flipped ? (-1f) : 1f);
		ContactPairPoint* contactPoint_Internal = m_Pair.GetContactPoint_Internal(index);
		return new ContactPoint(contactPoint_Internal->m_Position, contactPoint_Internal->m_Normal * num, contactPoint_Internal->m_Impulse, contactPoint_Internal->m_Separation, m_Flipped ? m_Pair.OtherColliderInstanceID : m_Pair.ColliderInstanceID, m_Flipped ? m_Pair.ColliderInstanceID : m_Pair.OtherColliderInstanceID);
	}

	public int GetContacts(ContactPoint[] contacts)
	{
		if (contacts == null)
		{
			throw new NullReferenceException("Cannot get contacts as the provided array is NULL.");
		}
		if (m_LegacyContacts != null)
		{
			int num = Mathf.Min(m_LegacyContacts.Length, contacts.Length);
			Array.Copy(m_LegacyContacts, contacts, num);
			return num;
		}
		return m_Pair.ExtractContactsArray(contacts, m_Flipped);
	}

	public int GetContacts(List<ContactPoint> contacts)
	{
		if (contacts == null)
		{
			throw new NullReferenceException("Cannot get contacts as the provided list is NULL.");
		}
		contacts.Clear();
		if (m_LegacyContacts != null)
		{
			contacts.AddRange(m_LegacyContacts);
			return m_LegacyContacts.Length;
		}
		int nbPoints = (int)m_Pair.m_NbPoints;
		if (nbPoints == 0)
		{
			return 0;
		}
		if (contacts.Capacity < nbPoints)
		{
			contacts.Capacity = nbPoints;
		}
		return m_Pair.ExtractContacts(contacts, m_Flipped);
	}

	[Obsolete("Do not use Collision.GetEnumerator(), enumerate using non-allocating array returned by Collision.GetContacts() or enumerate using Collision.GetContact(index) instead.", false)]
	[EditorBrowsable(EditorBrowsableState.Never)]
	public virtual IEnumerator GetEnumerator()
	{
		return contacts.GetEnumerator();
	}
}
public enum CollisionFlags
{
	None = 0,
	Sides = 1,
	Above = 2,
	Below = 4,
	CollidedSides = 1,
	CollidedAbove = 2,
	CollidedBelow = 4
}
public enum QueryTriggerInteraction
{
	UseGlobal,
	Ignore,
	Collide
}
public enum CollisionDetectionMode
{
	Discrete,
	Continuous,
	ContinuousDynamic,
	ContinuousSpeculative
}
public enum ConfigurableJointMotion
{
	Locked,
	Limited,
	Free
}
public enum RotationDriveMode
{
	XYAndZ,
	Slerp
}
public enum ArticulationJointType
{
	FixedJoint,
	PrismaticJoint,
	RevoluteJoint,
	SphericalJoint
}
public enum ArticulationDofLock
{
	LockedMotion,
	LimitedMotion,
	FreeMotion
}
public enum ArticulationDriveType
{
	Force,
	Acceleration,
	Target,
	Velocity
}
[NativeHeader("Modules/Physics/ArticulationBody.h")]
public struct ArticulationDrive
{
	public float lowerLimit;

	public float upperLimit;

	public float stiffness;

	public float damping;

	public float forceLimit;

	public float target;

	public float targetVelocity;

	public ArticulationDriveType driveType;
}
[NativeHeader("Modules/Physics/ArticulationBody.h")]
public struct ArticulationReducedSpace
{
	private unsafe fixed float x[3];

	public int dofCount;

	public unsafe float this[int i]
	{
		get
		{
			if (i < 0 || i >= dofCount)
			{
				throw new IndexOutOfRangeException();
			}
			return x[i];
		}
		set
		{
			if (i < 0 || i >= dofCount)
			{
				throw new IndexOutOfRangeException();
			}
			x[i] = value;
		}
	}

	public unsafe ArticulationReducedSpace(float a)
	{
		x[0] = a;
		dofCount = 1;
	}

	public unsafe ArticulationReducedSpace(float a, float b)
	{
		x[0] = a;
		x[1] = b;
		dofCount = 2;
	}

	public unsafe ArticulationReducedSpace(float a, float b, float c)
	{
		x[0] = a;
		x[1] = b;
		x[2] = c;
		dofCount = 3;
	}
}
[NativeHeader("Modules/Physics/ArticulationBody.h")]
public struct ArticulationJacobian
{
	private int rowsCount;

	private int colsCount;

	private List<float> matrixData;

	public float this[int row, int col]
	{
		get
		{
			if (row < 0 || row >= rowsCount)
			{
				throw new IndexOutOfRangeException();
			}
			if (col < 0 || col >= colsCount)
			{
				throw new IndexOutOfRangeException();
			}
			return matrixData[row * colsCount + col];
		}
		set
		{
			if (row < 0 || row >= rowsCount)
			{
				throw new IndexOutOfRangeException();
			}
			if (col < 0 || col >= colsCount)
			{
				throw new IndexOutOfRangeException();
			}
			matrixData[row * colsCount + col] = value;
		}
	}

	public int rows
	{
		get
		{
			return rowsCount;
		}
		set
		{
			rowsCount = value;
		}
	}

	public int columns
	{
		get
		{
			return colsCount;
		}
		set
		{
			colsCount = value;
		}
	}

	public List<float> elements
	{
		get
		{
			return matrixData;
		}
		set
		{
			matrixData = value;
		}
	}

	public ArticulationJacobian(int rows, int cols)
	{
		rowsCount = rows;
		colsCount = cols;
		matrixData = new List<float>(rows * cols);
		for (int i = 0; i < rows * cols; i++)
		{
			matrixData.Add(0f);
		}
	}
}
public enum ArticulationDriveAxis
{
	X,
	Y,
	Z
}
[NativeHeader("Modules/Physics/ArticulationBody.h")]
[NativeClass("Unity::ArticulationBody")]
public class ArticulationBody : Behaviour
{
	public extern ArticulationJointType jointType
	{
		[MethodImpl(MethodImplOptions.InternalCall)]
		get;
		[MethodImpl(MethodImplOptions.InternalCall)]
		set;
	}

	public Vector3 anchorPosition
	{
		get
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			get_anchorPosition_Injected(out var ret);
			return ret;
		}
		set
		{
			set_anchorPosition_Injected(ref value);
		}
	}

	public Vector3 parentAnchorPosition
	{
		get
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			get_parentAnchorPosition_Injected(out var ret);
			return ret;
		}
		set
		{
			set_parentAnchorPosition_Injected(ref value);
		}
	}

	public Quaternion anchorRotation
	{
		get
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			get_anchorRotation_Injected(out var ret);
			return ret;
		}
		set
		{
			set_anchorRotation_Injected(ref value);
		}
	}

	public Quaternion parentAnchorRotation
	{
		get
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			get_parentAnchorRotation_Injected(out var ret);
			return ret;
		}
		set
		{
			set_parentAnchorRotation_Injected(ref value);
		}
	}

	public extern bool isRoot
	{
		[MethodImpl(MethodImplOptions.InternalCall)]
		get;
	}

	public extern bool matchAnchors
	{
		[MethodImpl(MethodImplOptions.InternalCall)]
		get;
		[MethodImpl(MethodImplOptions.InternalCall)]
		set;
	}

	public extern ArticulationDofLock linearLockX
	{
		[MethodImpl(MethodImplOptions.InternalCall)]
		get;
		[MethodImpl(MethodImplOptions.InternalCall)]
		set;
	}

	public extern ArticulationDofLock linearLockY
	{
		[MethodImpl(MethodImplOptions.InternalCall)]
		get;
		[MethodImpl(MethodImplOptions.InternalCall)]
		set;
	}

	public extern ArticulationDofLock linearLockZ
	{
		[MethodImpl(MethodImplOptions.InternalCall)]
		get;
		[MethodImpl(MethodImplOptions.InternalCall)]
		set;
	}

	public extern ArticulationDofLock swingYLock
	{
		[MethodImpl(MethodImplOptions.InternalCall)]
		get;
		[MethodImpl(MethodImplOptions.InternalCall)]
		set;
	}

	public extern ArticulationDofLock swingZLock
	{
		[MethodImpl(MethodImplOptions.InternalCall)]
		get;
		[MethodImpl(MethodImplOptions.InternalCall)]
		set;
	}

	public extern ArticulationDofLock twistLock
	{
		[MethodImpl(MethodImplOptions.InternalCall)]
		get;
		[MethodImpl(MethodImplOptions.InternalCall)]
		set;
	}

	public ArticulationDrive xDrive
	{
		get
		{
			get_xDrive_Injected(out var ret);
			return ret;
		}
		set
		{
			set_xDrive_Injected(ref value);
		}
	}

	public ArticulationDrive yDrive
	{
		get
		{
			get_yDrive_Injected(out var ret);
			return ret;
		}
		set
		{
			set_yDrive_Injected(ref value);
		}
	}

	public ArticulationDrive zDrive
	{
		get
		{
			get_zDrive_Injected(out var ret);
			return ret;
		}
		set
		{
			set_zDrive_Injected(ref value);
		}
	}

	public extern bool immovable
	{
		[MethodImpl(MethodImplOptions.InternalCall)]
		get;
		[MethodImpl(MethodImplOptions.InternalCall)]
		set;
	}

	public extern bool useGravity
	{
		[MethodImpl(MethodImplOptions.InternalCall)]
		get;
		[MethodImpl(MethodImplOptions.InternalCall)]
		set;
	}

	public extern float linearDamping
	{
		[MethodImpl(MethodImplOptions.InternalCall)]
		get;
		[MethodImpl(MethodImplOptions.InternalCall)]
		set;
	}

	public extern float angularDamping
	{
		[MethodImpl(MethodImplOptions.InternalCall)]
		get;
		[MethodImpl(MethodImplOptions.InternalCall)]
		set;
	}

	public extern float jointFriction
	{
		[MethodImpl(MethodImplOptions.InternalCall)]
		get;
		[MethodImpl(MethodImplOptions.InternalCall)]
		set;
	}

	public LayerMask excludeLayers
	{
		get
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			get_excludeLayers_Injected(out var ret);
			return ret;
		}
		set
		{
			set_excludeLayers_Injected(ref value);
		}
	}

	public LayerMask includeLayers
	{
		get
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			get_includeLayers_Injected(out var ret);
			return ret;
		}
		set
		{
			set_includeLayers_Injected(ref value);
		}
	}

	public Vector3 velocity
	{
		get
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			get_velocity_Injected(out var ret);
			return ret;
		}
		set
		{
			set_velocity_Injected(ref value);
		}
	}

	public Vector3 angularVelocity
	{
		get
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			get_angularVelocity_Injected(out var ret);
			return ret;
		}
		set
		{
			set_angularVelocity_Injected(ref value);
		}
	}

	public extern float mass
	{
		[MethodImpl(MethodImplOptions.InternalCall)]
		get;
		[MethodImpl(MethodImplOptions.InternalCall)]
		set;
	}

	public extern bool automaticCenterOfMass
	{
		[MethodImpl(MethodImplOptions.InternalCall)]
		get;
		[MethodImpl(MethodImplOptions.InternalCall)]
		set;
	}

	public Vector3 centerOfMass
	{
		get
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			get_centerOfMass_Injected(out var ret);
			return ret;
		}
		set
		{
			set_centerOfMass_Injected(ref value);
		}
	}

	public Vector3 worldCenterOfMass
	{
		get
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			get_worldCenterOfMass_Injected(out var ret);
			return ret;
		}
	}

	public extern bool automaticInertiaTensor
	{
		[MethodImpl(MethodImplOptions.InternalCall)]
		get;
		[MethodImpl(MethodImplOptions.InternalCall)]
		set;
	}

	public Vector3 inertiaTensor
	{
		get
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			get_inertiaTensor_Injected(out var ret);
			return ret;
		}
		set
		{
			set_inertiaTensor_Injected(ref value);
		}
	}

	public Quaternion inertiaTensorRotation
	{
		get
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			get_inertiaTensorRotation_Injected(out var ret);
			return ret;
		}
		set
		{
			set_inertiaTensorRotation_Injected(ref value);
		}
	}

	public extern float sleepThreshold
	{
		[MethodImpl(MethodImplOptions.InternalCall)]
		get;
		[MethodImpl(MethodImplOptions.InternalCall)]
		set;
	}

	public extern int solverIterations
	{
		[MethodImpl(MethodImplOptions.InternalCall)]
		get;
		[MethodImpl(MethodImplOptions.InternalCall)]
		set;
	}

	public extern int solverVelocityIterations
	{
		[MethodImpl(MethodImplOptions.InternalCall)]
		get;
		[MethodImpl(MethodImplOptions.InternalCall)]
		set;
	}

	public extern float maxAngularVelocity
	{
		[MethodImpl(MethodImplOptions.InternalCall)]
		get;
		[MethodImpl(MethodImplOptions.InternalCall)]
		set;
	}

	public extern float maxLinearVelocity
	{
		[MethodImpl(MethodImplOptions.InternalCall)]
		get;
		[MethodImpl(MethodImplOptions.InternalCall)]
		set;
	}

	public extern float maxJointVelocity
	{
		[MethodImpl(MethodImplOptions.InternalCall)]
		get;
		[MethodImpl(MethodImplOptions.InternalCall)]
		set;
	}

	public extern float maxDepenetrationVelocity
	{
		[MethodImpl(MethodImplOptions.InternalCall)]
		get;
		[MethodImpl(MethodImplOptions.InternalCall)]
		set;
	}

	public ArticulationReducedSpace jointPosition
	{
		get
		{
			get_jointPosition_Injected(out var ret);
			return ret;
		}
		set
		{
			set_jointPosition_Injected(ref value);
		}
	}

	public ArticulationReducedSpace jointVelocity
	{
		get
		{
			get_jointVelocity_Injected(out var ret);
			return ret;
		}
		set
		{
			set_jointVelocity_Injected(ref value);
		}
	}

	public ArticulationReducedSpace jointAcceleration
	{
		get
		{
			get_jointAcceleration_Injected(out var ret);
			return ret;
		}
		[Obsolete("Setting joint accelerations is not supported in forward kinematics. To have inverse dynamics take acceleration into account, use GetJointForcesForAcceleration instead", true)]
		set
		{
			set_jointAcceleration_Injected(ref value);
		}
	}

	public ArticulationReducedSpace jointForce
	{
		get
		{
			get_jointForce_Injected(out var ret);
			return ret;
		}
		set
		{
			set_jointForce_Injected(ref value);
		}
	}

	public ArticulationReducedSpace driveForce
	{
		get
		{
			get_driveForce_Injected(out var ret);
			return ret;
		}
	}

	public extern int dofCount
	{
		[MethodImpl(MethodImplOptions.InternalCall)]
		get;
	}

	public extern int index
	{
		[MethodImpl(MethodImplOptions.InternalCall)]
		[NativeMethod("GetBodyIndex")]
		get;
	}

	public extern CollisionDetectionMode collisionDetectionMode
	{
		[MethodImpl(MethodImplOptions.InternalCall)]
		get;
		[MethodImpl(MethodImplOptions.InternalCall)]
		set;
	}

	[Obsolete("computeParentAnchor has been renamed to matchAnchors (UnityUpgradable) -> matchAnchors")]
	public bool computeParentAnchor
	{
		get
		{
			return matchAnchors;
		}
		set
		{
			matchAnchors = value;
		}
	}

	public Vector3 GetAccumulatedForce([DefaultValue("Time.fixedDeltaTime")] float step)
	{
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		GetAccumulatedForce_Injected(step, out var ret);
		return ret;
	}

	[ExcludeFromDocs]
	public Vector3 GetAccumulatedForce()
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		return GetAccumulatedForce(Time.fixedDeltaTime);
	}

	public Vector3 GetAccumulatedTorque([DefaultValue("Time.fixedDeltaTime")] float step)
	{
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		GetAccumulatedTorque_Injected(step, out var ret);
		return ret;
	}

	[ExcludeFromDocs]
	public Vector3 GetAccumulatedTorque()
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		return GetAccumulatedTorque(Time.fixedDeltaTime);
	}

	public void AddForce(Vector3 force, [DefaultValue("ForceMode.Force")] ForceMode mode)
	{
		AddForce_Injected(ref force, mode);
	}

	[ExcludeFromDocs]
	public void AddForce(Vector3 force)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		AddForce(force, ForceMode.Force);
	}

	public void AddRelativeForce(Vector3 force, [DefaultValue("ForceMode.Force")] ForceMode mode)
	{
		AddRelativeForce_Injected(ref force, mode);
	}

	[ExcludeFromDocs]
	public void AddRelativeForce(Vector3 force)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		AddRelativeForce(force, ForceMode.Force);
	}

	public void AddTorque(Vector3 torque, [DefaultValue("ForceMode.Force")] ForceMode mode)
	{
		AddTorque_Injected(ref torque, mode);
	}

	[ExcludeFromDocs]
	public void AddTorque(Vector3 torque)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		AddTorque(torque, ForceMode.Force);
	}

	public void AddRelativeTorque(Vector3 torque, [DefaultValue("ForceMode.Force")] ForceMode mode)
	{
		AddRelativeTorque_Injected(ref torque, mode);
	}

	[ExcludeFromDocs]
	public void AddRelativeTorque(Vector3 torque)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		AddRelativeTorque(torque, ForceMode.Force);
	}

	public void AddForceAtPosition(Vector3 force, Vector3 position, [DefaultValue("ForceMode.Force")] ForceMode mode)
	{
		AddForceAtPosition_Injected(ref force, ref position, mode);
	}

	[ExcludeFromDocs]
	public void AddForceAtPosition(Vector3 force, Vector3 position)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0003: Unknown result type (might be due to invalid IL or missing references)
		AddForceAtPosition(force, position, ForceMode.Force);
	}

	[MethodImpl(MethodImplOptions.InternalCall)]
	public extern void ResetCenterOfMass();

	[MethodImpl(MethodImplOptions.InternalCall)]
	public extern void ResetInertiaTensor();

	[MethodImpl(MethodImplOptions.InternalCall)]
	public extern void Sleep();

	[MethodImpl(MethodImplOptions.InternalCall)]
	public extern bool IsSleeping();

	[MethodImpl(MethodImplOptions.InternalCall)]
	public extern void WakeUp();

	public void TeleportRoot(Vector3 position, Quaternion rotation)
	{
		TeleportRoot_Injected(ref position, ref rotation);
	}

	public Vector3 GetClosestPoint(Vector3 point)
	{
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		GetClosestPoint_Injected(ref point, out var ret);
		return ret;
	}

	public Vector3 GetRelativePointVelocity(Vector3 relativePoint)
	{
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		GetRelativePointVelocity_Injected(ref relativePoint, out var ret);
		return ret;
	}

	public Vector3 GetPointVelocity(Vector3 worldPoint)
	{
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		GetPointVelocity_Injected(ref worldPoint, out var ret);
		return ret;
	}

	[MethodImpl(MethodImplOptions.InternalCall)]
	[NativeMethod("GetDenseJacobian")]
	private extern int GetDenseJacobian_Internal(ref ArticulationJacobian jacobian);

	public int GetDenseJacobian(ref ArticulationJacobian jacobian)
	{
		if (jacobian.elements == null)
		{
			jacobian.elements = new List<float>();
		}
		return GetDenseJacobian_Internal(ref jacobian);
	}

	[MethodImpl(MethodImplOptions.InternalCall)]
	public extern int GetJointPositions(List<float> positions);

	[MethodImpl(MethodImplOptions.InternalCall)]
	public extern void SetJointPositions(List<float> positions);

	[MethodImpl(MethodImplOptions.InternalCall)]
	public extern int GetJointVelocities(List<float> velocities);

	[MethodImpl(MethodImplOptions.InternalCall)]
	public extern void SetJointVelocities(List<float> velocities);

	[MethodImpl(MethodImplOptions.InternalCall)]
	public extern int GetJointAccelerations(List<float> accelerations);

	[MethodImpl(MethodImplOptions.InternalCall)]
	public extern int GetJointForces(List<float> forces);

	[MethodImpl(MethodImplOptions.InternalCall)]
	public extern void SetJointForces(List<float> forces);

	public ArticulationReducedSpace GetJointForcesForAcceleration(ArticulationReducedSpace acceleration)
	{
		GetJointForcesForAcceleration_Injected(ref acceleration, out var ret);
		return ret;
	}

	[MethodImpl(MethodImplOptions.InternalCall)]
	public extern int GetDriveForces(List<float> forces);

	[MethodImpl(MethodImplOptions.InternalCall)]
	public extern int GetJointGravityForces(List<float> forces);

	[MethodImpl(MethodImplOptions.InternalCall)]
	public extern int GetJointCoriolisCentrifugalForces(List<float> forces);

	[MethodImpl(MethodImplOptions.InternalCall)]
	public extern int GetJointExternalForces(List<float> forces, float step);

	[MethodImpl(MethodImplOptions.InternalCall)]
	public extern int GetDriveTargets(List<float> targets);

	[MethodImpl(MethodImplOptions.InternalCall)]
	public extern void SetDriveTargets(List<float> targets);

	[MethodImpl(MethodImplOptions.InternalCall)]
	public extern int GetDriveTargetVelocities(List<float> targetVelocities);

	[MethodImpl(MethodImplOptions.InternalCall)]
	public extern void SetDriveTargetVelocities(List<float> targetVelocities);

	[MethodImpl(MethodImplOptions.InternalCall)]
	public extern int GetDofStartIndices(List<int> dofStartIndices);

	[MethodImpl(MethodImplOptions.InternalCall)]
	public extern void SetDriveTarget(ArticulationDriveAxis axis, float value);

	[MethodImpl(MethodImplOptions.InternalCall)]
	public extern void SetDriveTargetVelocity(ArticulationDriveAxis axis, float value);

	[MethodImpl(MethodImplOptions.InternalCall)]
	public extern void SetDriveLimits(ArticulationDriveAxis axis, float lower, float upper);

	[MethodImpl(MethodImplOptions.InternalCall)]
	public extern void SetDriveStiffness(ArticulationDriveAxis axis, float value);

	[MethodImpl(MethodImplOptions.InternalCall)]
	public extern void SetDriveDamping(ArticulationDriveAxis axis, float value);

	[MethodImpl(MethodImplOptions.InternalCall)]
	public extern void SetDriveForceLimit(ArticulationDriveAxis axis, float value);

	public void SnapAnchorToClosestContact()
	{
		//IL_006f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0074: Unknown result type (might be due to invalid IL or missing references)
		//IL_0076: Unknown result type (might be due to invalid IL or missing references)
		//IL_0077: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0084: Unknown result type (might be due to invalid IL or missing references)
		//IL_0085: Unknown result type (might be due to invalid IL or missing references)
		//IL_0091: Unknown result type (might be due to invalid IL or missing references)
		//IL_009c: Unknown result type (might be due to invalid IL or missing references)
		//IL_009d: Unknown result type (might be due to invalid IL or missing references)
		//IL_009e: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
		if (Object.op_Implicit((Object)(object)((Component)this).transform.parent))
		{
			ArticulationBody componentInParent = ((Component)((Component)this).transform.parent).GetComponentInParent<ArticulationBody>();
			while (Object.op_Implicit((Object)(object)componentInParent) && !((Behaviour)componentInParent).enabled)
			{
				componentInParent = ((Component)((Component)componentInParent).transform.parent).GetComponentInParent<ArticulationBody>();
			}
			if (Object.op_Implicit((Object)(object)componentInParent))
			{
				Vector3 val = componentInParent.worldCenterOfMass;
				Vector3 closestPoint = GetClosestPoint(val);
				anchorPosition = ((Component)this).transform.InverseTransformPoint(closestPoint);
				Vector3 right = Vector3.right;
				Vector3 val2 = ((Component)this).transform.InverseTransformDirection(val - closestPoint);
				anchorRotation = Quaternion.FromToRotation(right, ((Vector3)(ref val2)).normalized);
			}
		}
	}

	[MethodImpl(MethodImplOptions.InternalCall)]
	[Obsolete("Setting joint accelerations is not supported in forward kinematics. To have inverse dynamics take acceleration into account, use GetJointForcesForAcceleration instead", true)]
	public extern void SetJointAccelerations(List<float> accelerations);

	[MethodImpl(MethodImplOptions.InternalCall)]
	[SpecialName]
	private extern void get_anchorPosition_Injected(out Vector3 ret);

	[MethodImpl(MethodImplOptions.InternalCall)]
	[SpecialName]
	private extern void set_anchorPosition_Injected(ref Vector3 value);

	[MethodImpl(MethodImplOptions.InternalCall)]
	[SpecialName]
	private extern void get_parentAnchorPosition_Injected(out Vector3 ret);

	[MethodImpl(MethodImplOptions.InternalCall)]
	[SpecialName]
	private extern void set_parentAnchorPosition_Injected(ref Vector3 value);

	[MethodImpl(MethodImplOptions.InternalCall)]
	[SpecialName]
	private extern void get_anchorRotation_Injected(out Quaternion ret);

	[MethodImpl(MethodImplOptions.InternalCall)]
	[SpecialName]
	private extern void set_anchorRotation_Injected(ref Quaternion value);

	[MethodImpl(MethodImplOptions.InternalCall)]
	[SpecialName]
	private extern void get_parentAnchorRotation_Injected(out Quaternion ret);

	[MethodImpl(MethodImplOptions.InternalCall)]
	[SpecialName]
	private extern void set_parentAnchorRotation_Injected(ref Quaternion value);

	[MethodImpl(MethodImplOptions.InternalCall)]
	[SpecialName]
	private extern void get_xDrive_Injected(out ArticulationDrive ret);

	[MethodImpl(MethodImplOptions.InternalCall)]
	[SpecialName]
	private extern void set_xDrive_Injected(ref ArticulationDrive value);

	[MethodImpl(MethodImplOptions.InternalCall)]
	[SpecialName]
	private extern void get_yDrive_Injected(out ArticulationDrive ret);

	[MethodImpl(MethodImplOptions.InternalCall)]
	[SpecialName]
	private extern void set_yDrive_Injected(ref ArticulationDrive value);

	[MethodImpl(MethodImplOptions.InternalCall)]
	[SpecialName]
	private extern void get_zDrive_Injected(out ArticulationDrive ret);

	[MethodImpl(MethodImplOptions.InternalCall)]
	[SpecialName]
	private extern void set_zDrive_Injected(ref ArticulationDrive value);

	[MethodImpl(MethodImplOptions.InternalCall)]
	[SpecialName]
	private extern void get_excludeLayers_Injected(out LayerMask ret);

	[MethodImpl(MethodImplOptions.InternalCall)]
	[SpecialName]
	private extern void set_excludeLayers_Injected(ref LayerMask value);

	[MethodImpl(MethodImplOptions.InternalCall)]
	[SpecialName]
	private extern void get_includeLayers_Injected(out LayerMask ret);

	[MethodImpl(MethodImplOptions.InternalCall)]
	[SpecialName]
	private extern void set_includeLayers_Injected(ref LayerMask value);

	[MethodImpl(MethodImplOptions.InternalCall)]
	private extern void GetAccumulatedForce_Injected([DefaultValue("Time.fixedDeltaTime")] float step, out Vector3 ret);

	[MethodImpl(MethodImplOptions.InternalCall)]
	private extern void GetAccumulatedTorque_Injected([DefaultValue("Time.fixedDeltaTime")] float step, out Vector3 ret);

	[MethodImpl(MethodImplOptions.InternalCall)]
	private extern void AddForce_Injected(ref Vector3 force, [DefaultValue("ForceMode.Force")] ForceMode mode);

	[MethodImpl(MethodImplOptions.InternalCall)]
	private extern void AddRelativeForce_Injected(ref Vector3 force, [DefaultValue("ForceMode.Force")] ForceMode mode);

	[MethodImpl(MethodImplOptions.InternalCall)]
	private extern void AddTorque_Injected(ref Vector3 torque, [DefaultValue("ForceMode.Force")] ForceMode mode);

	[MethodImpl(MethodImplOptions.InternalCall)]
	private extern void AddRelativeTorque_Injected(ref Vector3 torque, [DefaultValue("ForceMode.Force")] ForceMode mode);

	[MethodImpl(MethodImplOptions.InternalCall)]
	private extern void AddForceAtPosition_Injected(ref Vector3 force, ref Vector3 position, [DefaultValue("ForceMode.Force")] ForceMode mode);

	[MethodImpl(MethodImplOptions.InternalCall)]
	[SpecialName]
	private extern void get_velocity_Injected(out Vector3 ret);

	[MethodImpl(MethodImplOptions.InternalCall)]
	[SpecialName]
	private extern void set_velocity_Injected(ref Vector3 value);

	[MethodImpl(MethodImplOptions.InternalCall)]
	[SpecialName]
	private extern void get_angularVelocity_Injected(out Vector3 ret);

	[MethodImpl(MethodImplOptions.InternalCall)]
	[SpecialName]
	private extern void set_angularVelocity_Injected(ref Vector3 value);

	[MethodImpl(MethodImplOptions.InternalCall)]
	[SpecialName]
	private extern void get_centerOfMass_Injected(out Vector3 ret);

	[MethodImpl(MethodImplOptions.InternalCall)]
	[SpecialName]
	private extern void set_centerOfMass_Injected(ref Vector3 value);

	[MethodImpl(MethodImplOptions.InternalCall)]
	[SpecialName]
	private extern void get_worldCenterOfMass_Injected(out Vector3 ret);

	[MethodImpl(MethodImplOptions.InternalCall)]
	[SpecialName]
	private extern void get_inertiaTensor_Injected(out Vector3 ret);

	[MethodImpl(MethodImplOptions.InternalCall)]
	[SpecialName]
	private extern void set_inertiaTensor_Injected(ref Vector3 value);

	[MethodImpl(MethodImplOptions.InternalCall)]
	[SpecialName]
	private extern void get_inertiaTensorRotation_Injected(out Quaternion ret);

	[MethodImpl(MethodImplOptions.InternalCall)]
	[SpecialName]
	private extern void set_inertiaTensorRotation_Injected(ref Quaternion value);

	[MethodImpl(MethodImplOptions.InternalCall)]
	[SpecialName]
	private extern void get_jointPosition_Injected(out ArticulationReducedSpace ret);

	[MethodImpl(MethodImplOptions.InternalCall)]
	[SpecialName]
	private extern void set_jointPosition_Injected(ref ArticulationReducedSpace value);

	[MethodImpl(MethodImplOptions.InternalCall)]
	[SpecialName]
	private extern void get_jointVelocity_Injected(out ArticulationReducedSpace ret);

	[MethodImpl(MethodImplOptions.InternalCall)]
	[SpecialName]
	private extern void set_jointVelocity_Injected(ref ArticulationReducedSpace value);

	[MethodImpl(MethodImplOptions.InternalCall)]
	[SpecialName]
	private extern void get_jointAcceleration_Injected(out ArticulationReducedSpace ret);

	[MethodImpl(MethodImplOptions.InternalCall)]
	[SpecialName]
	private extern void set_jointAcceleration_Injected(ref ArticulationReducedSpace value);

	[MethodImpl(MethodImplOptions.InternalCall)]
	[SpecialName]
	private extern void get_jointForce_Injected(out ArticulationReducedSpace ret);

	[MethodImpl(MethodImplOptions.InternalCall)]
	[SpecialName]
	private extern void set_jointForce_Injected(ref ArticulationReducedSpace value);

	[MethodImpl(MethodImplOptions.InternalCall)]
	[SpecialName]
	private extern void get_driveForce_Injected(out ArticulationReducedSpace ret);

	[MethodImpl(MethodImplOptions.InternalCall)]
	private extern void TeleportRoot_Injected(ref Vector3 position, ref Quaternion rotation);

	[MethodImpl(MethodImplOptions.InternalCall)]
	private extern void GetClosestPoint_Injected(ref Vector3 point, out Vector3 ret);

	[MethodImpl(MethodImplOptions.InternalCall)]
	private extern void GetRelativePointVelocity_Injected(ref Vector3 relativePoint, out Vector3 ret);

	[MethodImpl(MethodImplOptions.InternalCall)]
	private extern void GetPointVelocity_Injected(ref Vector3 worldPoint, out Vector3 ret);

	[MethodImpl(MethodImplOptions.InternalCall)]
	private extern void GetJointForcesForAcceleration_Injected(ref ArticulationReducedSpace acceleration, out ArticulationReducedSpace ret);
}
[NativeHeader("Modules/Physics/PhysicsManager.h")]
[StaticAccessor(/*Could not decode attribute arguments.*/)]
public class Physics
{
	public delegate void ContactEventDelegate(PhysicsScene scene, ReadOnly<ContactPairHeader> headerArray);

	internal const float k_MaxFloatMinusEpsilon = 3.4028233E+38f;

	public const int IgnoreRaycastLayer = 4;

	public const int DefaultRaycastLayers = -5;

	public const int AllLayers = -1;

	[EditorBrowsable(EditorBrowsableState.Never)]
	[Obsolete("Please use Physics.IgnoreRaycastLayer instead. (UnityUpgradable) -> IgnoreRaycastLayer", true)]
	public const int kIgnoreRaycastLayer = 4;

	[Obsolete("Please use Physics.DefaultRaycastLayers instead. (UnityUpgradable) -> DefaultRaycastLayers", true)]
	[EditorBrowsable(EditorBrowsableState.Never)]
	public const int kDefaultRaycastLayers = -5;

	[Obsolete("Please use Physics.AllLayers instead. (UnityUpgradable) -> AllLayers", true)]
	[EditorBrowsable(EditorBrowsableState.Never)]
	public const int kAllLayers = -1;

	private static readonly Collision s_ReusableCollision = new Collision();

	public static Vector3 gravity
	{
		[ThreadSafe]
		get
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			get_gravity_Injected(out var ret);
			return ret;
		}
		set
		{
			set_gravity_Injected(ref value);
		}
	}

	public static extern float defaultContactOffset
	{
		[MethodImpl(MethodImplOptions.InternalCall)]
		get;
		[MethodImpl(MethodImplOptions.InternalCall)]
		set;
	}

	public static extern float sleepThreshold
	{
		[MethodImpl(MethodImplOptions.InternalCall)]
		get;
		[MethodImpl(MethodImplOptions.InternalCall)]
		set;
	}

	public static extern bool queriesHitTriggers
	{
		[MethodImpl(MethodImplOptions.InternalCall)]
		get;
		[MethodImpl(MethodImplOptions.InternalCall)]
		set;
	}

	public static extern bool queriesHitBackfaces
	{
		[MethodImpl(MethodImplOptions.InternalCall)]
		get;
		[MethodImpl(MethodImplOptions.InternalCall)]
		set;
	}

	public static extern float bounceThreshold
	{
		[MethodImpl(MethodImplOptions.InternalCall)]
		get;
		[MethodImpl(MethodImplOptions.InternalCall)]
		set;
	}

	public static extern float defaultMaxDepenetrationVelocity
	{
		[MethodImpl(MethodImplOptions.InternalCall)]
		get;
		[MethodImpl(MethodImplOptions.InternalCall)]
		set;
	}

	public static extern int defaultSolverIterations
	{
		[MethodImpl(MethodImplOptions.InternalCall)]
		get;
		[MethodImpl(MethodImplOptions.InternalCall)]
		set;
	}

	public static extern int defaultSolverVelocityIterations
	{
		[MethodImpl(MethodImplOptions.InternalCall)]
		get;
		[MethodImpl(MethodImplOptions.InternalCall)]
		set;
	}

	public static extern SimulationMode simulationMode
	{
		[MethodImpl(MethodImplOptions.InternalCall)]
		get;
		[MethodImpl(MethodImplOptions.InternalCall)]
		set;
	}

	public static extern float defaultMaxAngularSpeed
	{
		[MethodImpl(MethodImplOptions.InternalCall)]
		get;
		[MethodImpl(MethodImplOptions.InternalCall)]
		set;
	}

	public static extern bool improvedPatchFriction
	{
		[MethodImpl(MethodImplOptions.InternalCall)]
		get;
		[MethodImpl(MethodImplOptions.InternalCall)]
		set;
	}

	public static extern bool invokeCollisionCallbacks
	{
		[MethodImpl(MethodImplOptions.InternalCall)]
		get;
		[MethodImpl(MethodImplOptions.InternalCall)]
		set;
	}

	[NativeProperty(/*Could not decode attribute arguments.*/)]
	public static PhysicsScene defaultPhysicsScene
	{
		get
		{
			get_defaultPhysicsScene_Injected(out var ret);
			return ret;
		}
	}

	public static extern bool autoSyncTransforms
	{
		[MethodImpl(MethodImplOptions.InternalCall)]
		get;
		[MethodImpl(MethodImplOptions.InternalCall)]
		set;
	}

	public static extern bool reuseCollisionCallbacks
	{
		[MethodImpl(MethodImplOptions.InternalCall)]
		get;
		[MethodImpl(MethodImplOptions.InternalCall)]
		set;
	}

	[StaticAccessor("GetPhysicsManager()")]
	public static extern float interCollisionDistance
	{
		[MethodImpl(MethodImplOptions.InternalCall)]
		[NativeName("GetClothInterCollisionDistance")]
		get;
		[MethodImpl(MethodImplOptions.InternalCall)]
		[NativeName("SetClothInterCollisionDistance")]
		set;
	}

	[StaticAccessor("GetPhysicsManager()")]
	public static extern float interCollisionStiffness
	{
		[MethodImpl(MethodImplOptions.InternalCall)]
		[NativeName("GetClothInterCollisionStiffness")]
		get;
		[MethodImpl(MethodImplOptions.InternalCall)]
		[NativeName("SetClothInterCollisionStiffness")]
		set;
	}

	[StaticAccessor("GetPhysicsManager()")]
	public static extern bool interCollisionSettingsToggle
	{
		[MethodImpl(MethodImplOptions.InternalCall)]
		[NativeName("GetClothInterCollisionSettingsToggle")]
		get;
		[MethodImpl(MethodImplOptions.InternalCall)]
		[NativeName("SetClothInterCollisionSettingsToggle")]
		set;
	}

	public static Vector3 clothGravity
	{
		[ThreadSafe]
		get
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			get_clothGravity_Injected(out var ret);
			return ret;
		}
		set
		{
			set_clothGravity_Injected(ref value);
		}
	}

	[EditorBrowsable(EditorBrowsableState.Never)]
	[Obsolete("Use Physics.defaultContactOffset or Collider.contactOffset instead.", true)]
	public static float minPenetrationForPenalty
	{
		get
		{
			return 0f;
		}
		set
		{
		}
	}

	[Obsolete("Please use bounceThreshold instead. (UnityUpgradable) -> bounceThreshold")]
	public static float bounceTreshold
	{
		get
		{
			return bounceThreshold;
		}
		set
		{
			bounceThreshold = value;
		}
	}

	[EditorBrowsable(EditorBrowsableState.Never)]
	[Obsolete("The sleepVelocity is no longer supported. Use sleepThreshold. Note that sleepThreshold is energy but not velocity.", true)]
	public static float sleepVelocity
	{
		get
		{
			return 0f;
		}
		set
		{
		}
	}

	[EditorBrowsable(EditorBrowsableState.Never)]
	[Obsolete("The sleepAngularVelocity is no longer supported. Use sleepThreshold. Note that sleepThreshold is energy but not velocity.", true)]
	public static float sleepAngularVelocity
	{
		get
		{
			return 0f;
		}
		set
		{
		}
	}

	[EditorBrowsable(EditorBrowsableState.Never)]
	[Obsolete("Use Rigidbody.maxAngularVelocity instead.", true)]
	public static float maxAngularVelocity
	{
		get
		{
			return 0f;
		}
		set
		{
		}
	}

	[Obsolete("Please use Physics.defaultSolverIterations instead. (UnityUpgradable) -> defaultSolverIterations")]
	public static int solverIterationCount
	{
		get
		{
			return defaultSolverIterations;
		}
		set
		{
			defaultSolverIterations = value;
		}
	}

	[Obsolete("Please use Physics.defaultSolverVelocityIterations instead. (UnityUpgradable) -> defaultSolverVelocityIterations")]
	public static int solverVelocityIterationCount
	{
		get
		{
			return defaultSolverVelocityIterations;
		}
		set
		{
			defaultSolverVelocityIterations = value;
		}
	}

	[Obsolete("penetrationPenaltyForce has no effect.", true)]
	[EditorBrowsable(EditorBrowsableState.Never)]
	public static float penetrationPenaltyForce
	{
		get
		{
			return 0f;
		}
		set
		{
		}
	}

	[EditorBrowsable(EditorBrowsableState.Never)]
	[Obsolete("Physics.autoSimulation has been replaced by Physics.simulationMode", false)]
	public static bool autoSimulation
	{
		get
		{
			return simulationMode != SimulationMode.Script;
		}
		set
		{
			simulationMode = ((!value) ? SimulationMode.Script : SimulationMode.FixedUpdate);
		}
	}

	public static event Action<PhysicsScene, NativeArray<ModifiableContactPair>> ContactModifyEvent;

	public static event Action<PhysicsScene, NativeArray<ModifiableContactPair>> ContactModifyEventCCD;

	public static event ContactEventDelegate ContactEvent;

	[RequiredByNativeCode]
	private unsafe static void OnSceneContactModify(PhysicsScene scene, IntPtr buffer, int count, bool isCCD)
	{
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		NativeArray<ModifiableContactPair> arg = NativeArrayUnsafeUtility.ConvertExistingDataToNativeArray<ModifiableContactPair>(buffer.ToPointer(), count, (Allocator)1);
		if (!isCCD)
		{
			Physics.ContactModifyEvent?.Invoke(scene, arg);
		}
		else
		{
			Physics.ContactModifyEventCCD?.Invoke(scene, arg);
		}
	}

	[MethodImpl(MethodImplOptions.InternalCall)]
	public static extern void IgnoreCollision([NotNull("NullExceptionObject")] Collider collider1, [NotNull("NullExceptionObject")] Collider collider2, [DefaultValue("true")] bool ignore);

	[ExcludeFromDocs]
	public static void IgnoreCollision(Collider collider1, Collider collider2)
	{
		IgnoreCollision(collider1, collider2, ignore: true);
	}

	[MethodImpl(MethodImplOptions.InternalCall)]
	[NativeName("IgnoreCollision")]
	public static extern void IgnoreLayerCollision(int layer1, int layer2, [DefaultValue("true")] bool ignore);

	[ExcludeFromDocs]
	public static void IgnoreLayerCollision(int layer1, int layer2)
	{
		IgnoreLayerCollision(layer1, layer2, ignore: true);
	}

	[MethodImpl(MethodImplOptions.InternalCall)]
	public static extern bool GetIgnoreLayerCollision(int layer1, int layer2);

	[MethodImpl(MethodImplOptions.InternalCall)]
	public static extern bool GetIgnoreCollision([NotNull("NullExceptionObject")] Collider collider1, [NotNull("NullExceptionObject")] Collider collider2);

	public static bool Raycast(Vector3 origin, Vector3 direction, [DefaultValue("Mathf.Infinity")] float maxDistance, [DefaultValue("DefaultRaycastLayers")] int layerMask, [DefaultValue("QueryTriggerInteraction.UseGlobal")] QueryTriggerInteraction queryTriggerInteraction)
	{
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		return defaultPhysicsScene.Raycast(origin, direction, maxDistance, layerMask, queryTriggerInteraction);
	}

	[ExcludeFromDocs]
	public static bool Raycast(Vector3 origin, Vector3 direction, float maxDistance, int layerMask)
	{
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		return defaultPhysicsScene.Raycast(origin, direction, maxDistance, layerMask);
	}

	[ExcludeFromDocs]
	public static bool Raycast(Vector3 origin, Vector3 direction, float maxDistance)
	{
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		return defaultPhysicsScene.Raycast(origin, direction, maxDistance);
	}

	[ExcludeFromDocs]
	public static bool Raycast(Vector3 origin, Vector3 direction)
	{
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		return defaultPhysicsScene.Raycast(origin, direction);
	}

	public static bool Raycast(Vector3 origin, Vector3 direction, out RaycastHit hitInfo, float maxDistance, int layerMask, QueryTriggerInteraction queryTriggerInteraction)
	{
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		return defaultPhysicsScene.Raycast(origin, direction, out hitInfo, maxDistance, layerMask, queryTriggerInteraction);
	}

	[RequiredByNativeCode]
	[ExcludeFromDocs]
	public static bool Raycast(Vector3 origin, Vector3 direction, out RaycastHit hitInfo, float maxDistance, int layerMask)
	{
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		return defaultPhysicsScene.Raycast(origin, direction, out hitInfo, maxDistance, layerMask);
	}

	[ExcludeFromDocs]
	public static bool Raycast(Vector3 origin, Vector3 direction, out RaycastHit hitInfo, float maxDistance)
	{
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		return defaultPhysicsScene.Raycast(origin, direction, out hitInfo, maxDistance);
	}

	[ExcludeFromDocs]
	public static bool Raycast(Vector3 origin, Vector3 direction, out RaycastHit hitInfo)
	{
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		return defaultPhysicsScene.Raycast(origin, direction, out hitInfo);
	}

	public static bool Raycast(Ray ray, [DefaultValue("Mathf.Infinity")] float maxDistance, [DefaultValue("DefaultRaycastLayers")] int layerMask, [DefaultValue("QueryTriggerInteraction.UseGlobal")] QueryTriggerInteraction queryTriggerInteraction)
	{
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		return defaultPhysicsScene.Raycast(((Ray)(ref ray)).origin, ((Ray)(ref ray)).direction, maxDistance, layerMask, queryTriggerInteraction);
	}

	[ExcludeFromDocs]
	public static bool Raycast(Ray ray, float maxDistance, int layerMask)
	{
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		return defaultPhysicsScene.Raycast(((Ray)(ref ray)).origin, ((Ray)(ref ray)).direction, maxDistance, layerMask);
	}

	[ExcludeFromDocs]
	public static bool Raycast(Ray ray, float maxDistance)
	{
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		return defaultPhysicsScene.Raycast(((Ray)(ref ray)).origin, ((Ray)(ref ray)).direction, maxDistance);
	}

	[ExcludeFromDocs]
	public static bool Raycast(Ray ray)
	{
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		return defaultPhysicsScene.Raycast(((Ray)(ref ray)).origin, ((Ray)(ref ray)).direction);
	}

	public static bool Raycast(Ray ray, out RaycastHit hitInfo, [DefaultValue("Mathf.Infinity")] float maxDistance, [DefaultValue("DefaultRaycastLayers")] int layerMask, [DefaultValue("QueryTriggerInteraction.UseGlobal")] QueryTriggerInteraction queryTriggerInteraction)
	{
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		return defaultPhysicsScene.Raycast(((Ray)(ref ray)).origin, ((Ray)(ref ray)).direction, out hitInfo, maxDistance, layerMask, queryTriggerInteraction);
	}

	[ExcludeFromDocs]
	public static bool Raycast(Ray ray, out RaycastHit hitInfo, float maxDistance, int layerMask)
	{
		//IL_0003: Unknown result type (might be due to invalid IL or missing references)
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		return Raycast(((Ray)(ref ray)).origin, ((Ray)(ref ray)).direction, out hitInfo, maxDistance, layerMask, QueryTriggerInteraction.UseGlobal);
	}

	[ExcludeFromDocs]
	public static bool Raycast(Ray ray, out RaycastHit hitInfo, float maxDistance)
	{
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		return defaultPhysicsScene.Raycast(((Ray)(ref ray)).origin, ((Ray)(ref ray)).direction, out hitInfo, maxDistance);
	}

	[ExcludeFromDocs]
	public static bool Raycast(Ray ray, out RaycastHit hitInfo)
	{
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		return defaultPhysicsScene.Raycast(((Ray)(ref ray)).origin, ((Ray)(ref ray)).direction, out hitInfo);
	}

	public static bool Linecast(Vector3 start, Vector3 end, [DefaultValue("DefaultRaycastLayers")] int layerMask, [DefaultValue("QueryTriggerInteraction.UseGlobal")] QueryTriggerInteraction queryTriggerInteraction)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0003: Unknown result type (might be due to invalid IL or missing references)
		//IL_0008: 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_0012: Unknown result type (might be due to invalid IL or missing references)
		Vector3 direction = end - start;
		return defaultPhysicsScene.Raycast(start, direction, ((Vector3)(ref direction)).magnitude, layerMask, queryTriggerInteraction);
	}

	[ExcludeFromDocs]
	public static bool Linecast(Vector3 start, Vector3 end, int layerMask)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		return Linecast(start, end, layerMask, QueryTriggerInteraction.UseGlobal);
	}

	[ExcludeFromDocs]
	public static bool Linecast(Vector3 start, Vector3 end)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		return Linecast(start, end, -5, QueryTriggerInteraction.UseGlobal);
	}

	public static bool Linecast(Vector3 start, Vector3 end, out RaycastHit hitInfo, [DefaultValue("DefaultRaycastLayers")] int layerMask, [DefaultValue("QueryTriggerInteraction.UseGlobal")] QueryTriggerInteraction queryTriggerInteraction)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0003: Unknown result type (might be due to invalid IL or missing references)
		//IL_0008: 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_0012: Unknown result type (might be due to invalid IL or missing references)
		Vector3 direction = end - start;
		return defaultPhysicsScene.Raycast(start, direction, out hitInfo, ((Vector3)(ref direction)).magnitude, layerMask, queryTriggerInteraction);
	}

	[ExcludeFromDocs]
	public static bool Linecast(Vector3 start, Vector3 end, out RaycastHit hitInfo, int layerMask)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		return Linecast(start, end, out hitInfo, layerMask, QueryTriggerInteraction.UseGlobal);
	}

	[ExcludeFromDocs]
	public static bool Linecast(Vector3 start, Vector3 end, out RaycastHit hitInfo)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		return Linecast(start, end, out hitInfo, -5, QueryTriggerInteraction.UseGlobal);
	}

	public static bool CapsuleCast(Vector3 point1, Vector3 point2, float radius, Vector3 direction, [DefaultValue("Mathf.Infinity")] float maxDistance, [DefaultValue("DefaultRaycastLayers")] int layerMask, [DefaultValue("QueryTriggerInteraction.UseGlobal")] QueryTriggerInteraction queryTriggerInteraction)
	{
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		RaycastHit hitInfo;
		return defaultPhysicsScene.CapsuleCast(point1, point2, radius, direction, out hitInfo, maxDistance, layerMask, queryTriggerInteraction);
	}

	[ExcludeFromDocs]
	public static bool CapsuleCast(Vector3 point1, Vector3 point2, float radius, Vector3 direction, float maxDistance, int layerMask)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0004: Unknown result type (might be due to invalid IL or missing references)
		return CapsuleCast(point1, point2, radius, direction, maxDistance, layerMask, QueryTriggerInteraction.UseGlobal);
	}

	[ExcludeFromDocs]
	public static bool CapsuleCast(Vector3 point1, Vector3 point2, float radius, Vector3 direction, float maxDistance)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0004: Unknown result type (might be due to invalid IL or missing references)
		return CapsuleCast(point1, point2, radius, direction, maxDistance, -5, QueryTriggerInteraction.UseGlobal);
	}

	[ExcludeFromDocs]
	public static bool CapsuleCast(Vector3 point1, Vector3 point2, float radius, Vector3 direction)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0004: Unknown result type (might be due to invalid IL or missing references)
		return CapsuleCast(point1, point2, radius, direction, float.PositiveInfinity, -5, QueryTriggerInteraction.UseGlobal);
	}

	public static bool CapsuleCast(Vector3 point1, Vector3 point2, float radius, Vector3 direction, out RaycastHit hitInfo, [DefaultValue("Mathf.Infinity")] float maxDistance, [DefaultValue("DefaultRaycastLayers")] int layerMask, [DefaultValue("QueryTriggerInteraction.UseGlobal")] QueryTriggerInteraction queryTriggerInteraction)
	{
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		return defaultPhysicsScene.CapsuleCast(point1, point2, radius, direction, out hitInfo, maxDistance, layerMask, queryTriggerInteraction);
	}

	[ExcludeFromDocs]
	public static bool CapsuleCast(Vector3 point1, Vector3 point2, float radius, Vector3 direction, out RaycastHit hitInfo, float maxDistance, int layerMask)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0004: Unknown result type (might be due to invalid IL or missing references)
		return CapsuleCast(point1, point2, radius, direction, out hitInfo, maxDistance, layerMask, QueryTriggerInteraction.UseGlobal);
	}

	[ExcludeFromDocs]
	public static bool CapsuleCast(Vector3 point1, Vector3 point2, float radius, Vector3 direction, out RaycastHit hitInfo, float maxDistance)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0004: Unknown result type (might be due to invalid IL or missing references)
		return CapsuleCast(point1, point2, radius, direction, out hitInfo, maxDistance, -5, QueryTriggerInteraction.UseGlobal);
	}

	[ExcludeFromDocs]
	public static bool CapsuleCast(Vector3 point1, Vector3 point2, float radius, Vector3 direction, out RaycastHit hitInfo)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0004: Unknown result type (might be due to invalid IL or missing references)
		return CapsuleCast(point1, point2, radius, direction, out hitInfo, float.PositiveInfinity, -5, QueryTriggerInteraction.UseGlobal);
	}

	public static bool SphereCast(Vector3 origin, float radius, Vector3 direction, out RaycastHit hitInfo, [DefaultValue("Mathf.Infinity")] float maxDistance, [DefaultValue("DefaultRaycastLayers")] int layerMask, [DefaultValue("QueryTriggerInteraction.UseGlobal")] QueryTriggerInteraction queryTriggerInteraction)
	{
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		return defaultPhysicsScene.SphereCast(origin, radius, direction, out hitInfo, maxDistance, layerMask, queryTriggerInteraction);
	}

	[ExcludeFromDocs]
	public static bool SphereCast(Vector3 origin, float radius, Vector3 direction, out RaycastHit hitInfo, float maxDistance, int layerMask)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0003: Unknown result type (might be due to invalid IL or missing references)
		return SphereCast(origin, radius, direction, out hitInfo, maxDistance, layerMask, QueryTriggerInteraction.UseGlobal);
	}

	[ExcludeFromDocs]
	public static bool SphereCast(Vector3 origin, float radius, Vector3 direction, out RaycastHit hitInfo, float maxDistance)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0003: Unknown result type (might be due to invalid IL or missing references)
		return SphereCast(origin, radius, direction, out hitInfo, maxDistance, -5, QueryTriggerInteraction.UseGlobal);
	}

	[ExcludeFromDocs]
	public static bool SphereCast(Vector3 origin, float radius, Vector3 direction, out RaycastHit hitInfo)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0003: Unknown result type (might be due to invalid IL or missing references)
		return SphereCast(origin, radius, direction, out hitInfo, float.PositiveInfinity, -5, QueryTriggerInteraction.UseGlobal);
	}

	public static bool SphereCast(Ray ray, float radius, [DefaultValue("Mathf.Infinity")] float maxDistance, [DefaultValue("DefaultRaycastLayers")] int layerMask, [DefaultValue("QueryTriggerInteraction.UseGlobal")] QueryTriggerInteraction queryTriggerInteraction)
	{
		//IL_0003: Unknown result type (might be due to invalid IL or missing references)
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		RaycastHit hitInfo;
		return SphereCast(((Ray)(ref ray)).origin, radius, ((Ray)(ref ray)).direction, out hitInfo, maxDistance, layerMask, queryTriggerInteraction);
	}

	[ExcludeFromDocs]
	public static bool SphereCast(Ray ray, float radius, float maxDistance, int layerMask)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		return SphereCast(ray, radius, maxDistance, layerMask, QueryTriggerInteraction.UseGlobal);
	}

	[ExcludeFromDocs]
	public static bool SphereCast(Ray ray, float radius, float maxDistance)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		return SphereCast(ray, radius, maxDistance, -5, QueryTriggerInteraction.UseGlobal);
	}

	[ExcludeFromDocs]
	public static bool SphereCast(Ray ray, float radius)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		return SphereCast(ray, radius, float.PositiveInfinity, -5, QueryTriggerInteraction.UseGlobal);
	}

	public static bool SphereCast(Ray ray, float radius, out RaycastHit hitInfo, [DefaultValue("Mathf.Infinity")] float maxDistance, [DefaultValue("DefaultRaycastLayers")] int layerMask, [DefaultValue("QueryTriggerInteraction.UseGlobal")] QueryTriggerInteraction queryTriggerInteraction)
	{
		//IL_0003: Unknown result type (might be due to invalid IL or missing references)
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		return SphereCast(((Ray)(ref ray)).origin, radius, ((Ray)(ref ray)).direction, out hitInfo, maxDistance, layerMask, queryTriggerInteraction);
	}

	[ExcludeFromDocs]
	public static bool SphereCast(Ray ray, float radius, out RaycastHit hitInfo, float maxDistance, int layerMask)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		return SphereCast(ray, radius, out hitInfo, maxDistance, layerMask, QueryTriggerInteraction.UseGlobal);
	}

	[ExcludeFromDocs]
	public static bool SphereCast(Ray ray, float radius, out RaycastHit hitInfo, float maxDistance)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		return SphereCast(ray, radius, out hitInfo, maxDistance, -5, QueryTriggerInteraction.UseGlobal);
	}

	[ExcludeFromDocs]
	public static bool SphereCast(Ray ray, float radius, out RaycastHit hitInfo)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		return SphereCast(ray, radius, out hitInfo, float.PositiveInfinity, -5, QueryTriggerInteraction.UseGlobal);
	}

	public static bool BoxCast(Vector3 center, Vector3 halfExtents, Vector3 direction, [DefaultValue("Quaternion.identity")] Quaternion orientation, [DefaultValue("Mathf.Infinity")] float maxDistance, [DefaultValue("DefaultRaycastLayers")] int layerMask, [DefaultValue("QueryTriggerInteraction.UseGlobal")] QueryTriggerInteraction queryTriggerInteraction)
	{
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		RaycastHit hitInfo;
		return defaultPhysicsScene.BoxCast(center, halfExtents, direction, out hitInfo, orientation, maxDistance, layerMask, queryTriggerInteraction);
	}

	[ExcludeFromDocs]
	public static bool BoxCast(Vector3 center, Vector3 halfExtents, Vector3 direction, Quaternion orientation, float maxDistance, int layerMask)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0003: Unknown result type (might be due to invalid IL or missing references)
		//IL_0004: Unknown result type (might be due to invalid IL or missing references)
		return BoxCast(center, halfExtents, direction, orientation, maxDistance, layerMask, QueryTriggerInteraction.UseGlobal);
	}

	[ExcludeFromDocs]
	public static bool BoxCast(Vector3 center, Vector3 halfExtents, Vector3 direction, Quaternion orientation, float maxDistance)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0003: Unknown result type (might be due to invalid IL or missing references)
		//IL_0004: Unknown result type (might be due to invalid IL or missing references)
		return BoxCast(center, halfExtents, direction, orientation, maxDistance, -5, QueryTriggerInteraction.UseGlobal);
	}

	[ExcludeFromDocs]
	public static bool BoxCast(Vector3 center, Vector3 halfExtents, Vector3 direction, Quaternion orientation)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0003: Unknown result type (might be due to invalid IL or missing references)
		//IL_0004: Unknown result type (might be due to invalid IL or missing references)
		return BoxCast(center, halfExtents, direction, orientation, float.PositiveInfinity, -5, QueryTriggerInteraction.UseGlobal);
	}

	[ExcludeFromDocs]
	public static bool BoxCast(Vector3 center, Vector3 halfExtents, Vector3 direction)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0003: Unknown result type (might be due to invalid IL or missing references)
		//IL_0004: Unknown result type (might be due to invalid IL or missing references)
		return BoxCast(center, halfExtents, direction, Quaternion.identity, float.PositiveInfinity, -5, QueryTriggerInteraction.UseGlobal);
	}

	public static bool BoxCast(Vector3 center, Vector3 halfExtents, Vector3 direction, out RaycastHit hitInfo, [DefaultValue("Quaternion.identity")] Quaternion orientation, [DefaultValue("Mathf.Infinity")] float maxDistance, [DefaultValue("DefaultRaycastLayers")] int layerMask, [DefaultValue("QueryTriggerInteraction.UseGlobal")] QueryTriggerInteraction queryTriggerInteraction)
	{
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		return defaultPhysicsScene.BoxCast(center, halfExtents, direction, out hitInfo, orientation, maxDistance, layerMask, queryTriggerInteraction);
	}

	[ExcludeFromDocs]
	public static bool BoxCast(Vector3 center, Vector3 halfExtents, Vector3 direction, out RaycastHit hitInfo, Quaternion orientation, float maxDistance, int layerMask)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0003: Unknown result type (might be due to invalid IL or missing references)
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		return BoxCast(center, halfExtents, direction, out hitInfo, orientation, maxDistance, layerMask, QueryTriggerInteraction.UseGlobal);
	}

	[ExcludeFromDocs]
	public static bool BoxCast(Vector3 center, Vector3 halfExtents, Vector3 direction, out RaycastHit hitInfo, Quaternion orientation, float maxDistance)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0003: Unknown result type (might be due to invalid IL or missing references)
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		return BoxCast(center, halfExtents, direction, out hitInfo, orientation, maxDistance, -5, QueryTriggerInteraction.UseGlobal);
	}

	[ExcludeFromDocs]
	public static bool BoxCast(Vector3 center, Vector3 halfExtents, Vector3 direction, out RaycastHit hitInfo, Quaternion orientation)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0003: Unknown result type (might be due to invalid IL or missing references)
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		return BoxCast(center, halfExtents, direction, out hitInfo, orientation, float.PositiveInfinity, -5, QueryTriggerInteraction.UseGlobal);
	}

	[ExcludeFromDocs]
	public static bool BoxCast(Vector3 center, Vector3 halfExtents, Vector3 direction, out RaycastHit hitInfo)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0003: Unknown result type (might be due to invalid IL or missing references)
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		return BoxCast(center, halfExtents, direction, out hitInfo, Quaternion.identity, float.PositiveInfinity, -5, QueryTriggerInteraction.UseGlobal);
	}

	[StaticAccessor(/*Could not decode attribute arguments.*/)]
	[NativeName("RaycastAll")]
	private static RaycastHit[] Internal_RaycastAll(PhysicsScene physicsScene, Ray ray, float maxDistance, int mask, QueryTriggerInteraction queryTriggerInteraction)
	{
		return Internal_RaycastAll_Injected(ref physicsScene, ref ray, maxDistance, mask, queryTriggerInteraction);
	}

	public static RaycastHit[] RaycastAll(Vector3 origin, Vector3 direction, [DefaultValue("Mathf.Infinity")] float maxDistance, [DefaultValue("DefaultRaycastLayers")] int layerMask, [DefaultValue("QueryTriggerInteraction.UseGlobal")] QueryTriggerInteraction queryTriggerInteraction)
	{
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_0018: 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_0020: 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_002c: Unknown result type (might be due to invalid IL or missing references)
		float magnitude = ((Vector3)(ref direction)).magnitude;
		if (magnitude > float.Epsilon)
		{
			Vector3 val = direction / magnitude;
			Ray ray = default(Ray);
			((Ray)(ref ray))..ctor(origin, val);
			return Internal_RaycastAll(defaultPhysicsScene, ray, maxDistance, layerMask, queryTriggerInteraction);
		}
		return new RaycastHit[0];
	}

	[ExcludeFromDocs]
	public static RaycastHit[] RaycastAll(Vector3 origin, Vector3 direction, float maxDistance, int layerMask)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		return RaycastAll(origin, direction, maxDistance, layerMask, QueryTriggerInteraction.UseGlobal);
	}

	[ExcludeFromDocs]
	public static RaycastHit[] RaycastAll(Vector3 origin, Vector3 direction, float maxDistance)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		return RaycastAll(origin, direction, maxDistance, -5, QueryTriggerInteraction.UseGlobal);
	}

	[ExcludeFromDocs]
	public static RaycastHit[] RaycastAll(Vector3 origin, Vector3 direction)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		return RaycastAll(origin, direction, float.PositiveInfinity, -5, QueryTriggerInteraction.UseGlobal);
	}

	public static RaycastHit[] RaycastAll(Ray ray, [DefaultValue("Mathf.Infinity")] float maxDistance, [DefaultValue("DefaultRaycastLayers")] int layerMask, [DefaultValue("QueryTriggerInteraction.UseGlobal")] QueryTriggerInteraction queryTriggerInteraction)
	{
		//IL_0003: Unknown result type (might be due to invalid IL or missing references)
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		return RaycastAll(((Ray)(ref ray)).origin, ((Ray)(ref ray)).direction, maxDistance, layerMask, queryTriggerInteraction);
	}

	[ExcludeFromDocs]
	[RequiredByNativeCode]
	public static RaycastHit[] RaycastAll(Ray ray, float maxDistance, int layerMask)
	{
		//IL_0003: Unknown result type (might be due to invalid IL or missing references)
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		return RaycastAll(((Ray)(ref ray)).origin, ((Ray)(ref ray)).direction, maxDistance, layerMask, QueryTriggerInteraction.UseGlobal);
	}

	[ExcludeFromDocs]
	public static RaycastHit[] RaycastAll(Ray ray, float maxDistance)
	{
		//IL_0003: Unknown result type (might be due to invalid IL or missing references)
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		return RaycastAll(((Ray)(ref ray)).origin, ((Ray)(ref ray)).direction, maxDistance, -5, QueryTriggerInteraction.UseGlobal);
	}

	[ExcludeFromDocs]
	public static RaycastHit[] RaycastAll(Ray ray)
	{
		//IL_0003: Unknown result type (might be due to invalid IL or missing references)
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		return RaycastAll(((Ray)(ref ray)).origin, ((Ray)(ref ray)).direction, float.PositiveInfinity, -5, QueryTriggerInteraction.UseGlobal);
	}

	public static int RaycastNonAlloc(Ray ray, RaycastHit[] results, [DefaultValue("Mathf.Infinity")] float maxDistance, [DefaultValue("DefaultRaycastLayers")] int layerMask, [DefaultValue("QueryTriggerInteraction.UseGlobal")] QueryTriggerInteraction queryTriggerInteraction)
	{
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		return defaultPhysicsScene.Raycast(((Ray)(ref ray)).origin, ((Ray)(ref ray)).direction, results, maxDistance, layerMask, queryTriggerInteraction);
	}

	[RequiredByNativeCode]
	[ExcludeFromDocs]
	public static int RaycastNonAlloc(Ray ray, RaycastHit[] results, float maxDistance, int layerMask)
	{
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		return defaultPhysicsScene.Raycast(((Ray)(ref ray)).origin, ((Ray)(ref ray)).direction, results, maxDistance, layerMask);
	}

	[ExcludeFromDocs]
	public static int RaycastNonAlloc(Ray ray, RaycastHit[] results, float maxDistance)
	{
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		return defaultPhysicsScene.Raycast(((Ray)(ref ray)).origin, ((Ray)(ref ray)).direction, results, maxDistance);
	}

	[ExcludeFromDocs]
	public static int RaycastNonAlloc(Ray ray, RaycastHit[] results)
	{
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		return defaultPhysicsScene.Raycast(((Ray)(ref ray)).origin, ((Ray)(ref ray)).direction, results);
	}

	public static int RaycastNonAlloc(Vector3 origin, Vector3 direction, RaycastHit[] results, [DefaultValue("Mathf.Infinity")] float maxDistance, [DefaultValue("DefaultRaycastLayers")] int layerMask, [DefaultValue("QueryTriggerInteraction.UseGlobal")] QueryTriggerInteraction queryTriggerInteraction)
	{
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		return defaultPhysicsScene.Raycast(origin, direction, results, maxDistance, layerMask, queryTriggerInteraction);
	}

	[ExcludeFromDocs]
	public static int RaycastNonAlloc(Vector3 origin, Vector3 direction, RaycastHit[] results, float maxDistance, int layerMask)
	{
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		return defaultPhysicsScene.Raycast(origin, direction, results, maxDistance, layerMask);
	}

	[ExcludeFromDocs]
	public static int RaycastNonAlloc(Vector3 origin, Vector3 direction, RaycastHit[] results, float maxDistance)
	{
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		return defaultPhysicsScene.Raycast(origin, direction, results, maxDistance);
	}

	[ExcludeFromDocs]
	public static int RaycastNonAlloc(Vector3 origin, Vector3 direction, RaycastHit[] results)
	{
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		return defaultPhysicsScene.Raycast(origin, direction, results);
	}

	[NativeName("CapsuleCastAll")]
	[StaticAccessor(/*Could not decode attribute arguments.*/)]
	private static RaycastHit[] Query_CapsuleCastAll(PhysicsScene physicsScene, Vector3 p0, Vector3 p1, float radius, Vector3 direction, float maxDistance, int mask, QueryTriggerInteraction queryTriggerInteraction)
	{
		return Query_CapsuleCastAll_Injected(ref physicsScene, ref p0, ref p1, radius, ref direction, maxDistance, mask, queryTriggerInteraction);
	}

	public static RaycastHit[] CapsuleCastAll(Vector3 point1, Vector3 point2, float radius, Vector3 direction, [DefaultValue("Mathf.Infinity")] float maxDistance, [DefaultValue("DefaultRaycastLayers")] int layerMask, [DefaultValue("QueryTriggerInteraction.UseGlobal")] QueryTriggerInteraction queryTriggerInteraction)
	{
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_0018: 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_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: 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)
		float magnitude = ((Vector3)(ref direction)).magnitude;
		if (magnitude > float.Epsilon)
		{
			Vector3 direction2 = direction / magnitude;
			return Query_CapsuleCastAll(defaultPhysicsScene, point1, point2, radius, direction2, maxDistance, layerMask, queryTriggerInteraction);
		}
		return new RaycastHit[0];
	}

	[ExcludeFromDocs]
	public static RaycastHit[] CapsuleCastAll(Vector3 point1, Vector3 point2, float radius, Vector3 direction, float maxDistance, int layerMask)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0004: Unknown result type (might be due to invalid IL or missing references)
		return CapsuleCastAll(point1, point2, radius, direction, maxDistance, layerMask, QueryTriggerInteraction.UseGlobal);
	}

	[ExcludeFromDocs]
	public static RaycastHit[] CapsuleCastAll(Vector3 point1, Vector3 point2, float radius, Vector3 direction, float maxDistance)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0004: Unknown result type (might be due to invalid IL or missing references)
		return CapsuleCastAll(point1, point2, radius, direction, maxDistance, -5, QueryTriggerInteraction.UseGlobal);
	}

	[ExcludeFromDocs]
	public static RaycastHit[] CapsuleCastAll(Vector3 point1, Vector3 point2, float radius, Vector3 direction)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0004: Unknown result type (might be due to invalid IL or missing references)
		return CapsuleCastAll(point1, point2, radius, direction, float.PositiveInfinity, -5, QueryTriggerInteraction.UseGlobal);
	}

	[StaticAccessor(/*Could not decode attribute arguments.*/)]
	[NativeName("SphereCastAll")]
	private static RaycastHit[] Query_SphereCastAll(PhysicsScene physicsScene, Vector3 origin, float radius, Vector3 direction, float maxDistance, int mask, QueryTriggerInteraction queryTriggerInteraction)
	{
		return Query_SphereCastAll_Injected(ref physicsScene, ref origin, radius, ref direction, maxDistance, mask, queryTriggerInteraction);
	}

	public static RaycastHit[] SphereCastAll(Vector3 origin, float radius, Vector3 direction, [DefaultValue("Mathf.Infinity")] float maxDistance, [DefaultValue("DefaultRaycastLayers")] int layerMask, [DefaultValue("QueryTriggerInteraction.UseGlobal")] QueryTriggerInteraction queryTriggerInteraction)
	{
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_0018: 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_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		float magnitude = ((Vector3)(ref direction)).magnitude;
		if (magnitude > float.Epsilon)
		{
			Vector3 direction2 = direction / magnitude;
			return Query_SphereCastAll(defaultPhysicsScene, origin, radius, direction2, maxDistance, layerMask, queryTriggerInteraction);
		}
		return new RaycastHit[0];
	}

	[ExcludeFromDocs]
	public static RaycastHit[] SphereCastAll(Vector3 origin, float radius, Vector3 direction, float maxDistance, int layerMask)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0003: Unknown result type (might be due to invalid IL or missing references)
		return SphereCastAll(origin, radius, direction, maxDistance, layerMask, QueryTriggerInteraction.UseGlobal);
	}

	[ExcludeFromDocs]
	public static RaycastHit[] SphereCastAll(Vector3 origin, float radius, Vector3 direction, float maxDistance)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0003: Unknown result type (might be due to invalid IL or missing references)
		return SphereCastAll(origin, radius, direction, maxDistance, -5, QueryTriggerInteraction.UseGlobal);
	}

	[ExcludeFromDocs]
	public static RaycastHit[] SphereCastAll(Vector3 origin, float radius, Vector3 direction)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0003: Unknown result type (might be due to invalid IL or missing references)
		return SphereCastAll(origin, radius, direction, float.PositiveInfinity, -5, QueryTriggerInteraction.UseGlobal);
	}

	public static RaycastHit[] SphereCastAll(Ray ray, float radius, [DefaultValue("Mathf.Infinity")] float maxDistance, [DefaultValue("DefaultRaycastLayers")] int layerMask, [DefaultValue("QueryTriggerInteraction.UseGlobal")] QueryTriggerInteraction queryTriggerInteraction)
	{
		//IL_0003: Unknown result type (might be due to invalid IL or missing references)
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		return SphereCastAll(((Ray)(ref ray)).origin, radius, ((Ray)(ref ray)).direction, maxDistance, layerMask, queryTriggerInteraction);
	}

	[ExcludeFromDocs]
	public static RaycastHit[] SphereCastAll(Ray ray, float radius, float maxDistance, int layerMask)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		return SphereCastAll(ray, radius, maxDistance, layerMask, QueryTriggerInteraction.UseGlobal);
	}

	[ExcludeFromDocs]
	public static RaycastHit[] SphereCastAll(Ray ray, float radius, float maxDistance)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		return SphereCastAll(ray, radius, maxDistance, -5, QueryTriggerInteraction.UseGlobal);
	}

	[ExcludeFromDocs]
	public static RaycastHit[] SphereCastAll(Ray ray, float radius)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		return SphereCastAll(ray, radius, float.PositiveInfinity, -5, QueryTriggerInteraction.UseGlobal);
	}

	[NativeName("OverlapCapsule")]
	[StaticAccessor(/*Could not decode attribute arguments.*/)]
	private static Collider[] OverlapCapsule_Internal(PhysicsScene physicsScene, Vector3 point0, Vector3 point1, float radius, int layerMask, QueryTriggerInteraction queryTriggerInteraction)
	{
		return OverlapCapsule_Internal_Injected(ref physicsScene, ref point0, ref point1, radius, layerMask, queryTriggerInteraction);
	}

	public static Collider[] OverlapCapsule(Vector3 point0, Vector3 point1, float radius, [DefaultValue("AllLayers")] int layerMask, [DefaultValue("QueryTriggerInteraction.UseGlobal")] QueryTriggerInteraction queryTriggerInteraction)
	{
		//IL_0006: 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)
		return