Decompiled source of SlopCrew v2.2.1

BepInEx/plugins/SlopCrew.Plugin/CrewBoomAPI.dll

Decompiled 8 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using Microsoft.CodeAnalysis;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.6", FrameworkDisplayName = ".NET Framework 4.6")]
[assembly: AssemblyCompany("CrewBoomAPI")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("API to interact with Crew Boom.")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: AssemblyInformationalVersion("1.0.1+1069d195e0cb08bb95407551b4c19397823315f8")]
[assembly: AssemblyProduct("CrewBoomAPI")]
[assembly: AssemblyTitle("CrewBoomAPI")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.1.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace CrewBoomAPI
{
	public class CharacterInfo
	{
		public readonly string Name;

		public readonly string GraffitiName;

		public CharacterInfo(string name, string graffitiName)
		{
			Name = name;
			GraffitiName = graffitiName;
		}
	}
	public static class CrewBoomAPIDatabase
	{
		private static Dictionary<int, Guid> _userCharacters;

		public static bool IsInitialized { get; private set; }

		public static CharacterInfo PlayerCharacterInfo { get; private set; }

		public static event Action OnInitialized;

		public static event Action<Guid> OnOverride;

		public static event Action<CharacterInfo> OnPlayerCharacterInfoChanged;

		public static void Initialize(Dictionary<int, Guid> userCharacters)
		{
			_userCharacters = userCharacters;
			CrewBoomAPIDatabase.OnInitialized?.Invoke();
			IsInitialized = true;
		}

		public static void UpdatePlayerCharacter(CharacterInfo characterInfo)
		{
			PlayerCharacterInfo = characterInfo;
			CrewBoomAPIDatabase.OnPlayerCharacterInfoChanged?.Invoke(characterInfo);
		}

		public static bool GetUserGuidForCharacter(int character, out Guid guid)
		{
			guid = Guid.Empty;
			if (_userCharacters.TryGetValue(character, out guid))
			{
				return true;
			}
			return false;
		}

		public static void OverrideNextCharacterLoadedWithGuid(Guid guid)
		{
			CrewBoomAPIDatabase.OnOverride?.Invoke(guid);
		}
	}
}

BepInEx/plugins/SlopCrew.Plugin/Google.Protobuf.dll

Decompiled 8 months ago
using System;
using System.Buffers;
using System.Buffers.Binary;
using System.CodeDom.Compiler;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using Google.Protobuf.Collections;
using Google.Protobuf.Reflection;
using Google.Protobuf.WellKnownTypes;
using Microsoft.CodeAnalysis;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AllowPartiallyTrustedCallers]
[assembly: InternalsVisibleTo("Google.Protobuf.Test, PublicKey=002400000480000094000000060200000024000052534131000400000100010025800fbcfc63a17c66b303aae80b03a6beaa176bb6bef883be436f2a1579edd80ce23edf151a1f4ced97af83abcd981207041fd5b2da3b498346fcfcd94910d52f25537c4a43ce3fbe17dc7d43e6cbdb4d8f1242dcb6bd9b5906be74da8daa7d7280f97130f318a16c07baf118839b156299a48522f9fae2371c9665c5ae9cb6")]
[assembly: TargetFramework(".NETFramework,Version=v4.5", FrameworkDisplayName = ".NET Framework 4.5")]
[assembly: AssemblyMetadata("IsTrimmable", "True")]
[assembly: AssemblyCompany("Google Inc.")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyCopyright("Copyright 2015, Google Inc.")]
[assembly: AssemblyDescription("C# runtime library for Protocol Buffers - Google's data interchange format.")]
[assembly: AssemblyFileVersion("3.25.0.0")]
[assembly: AssemblyInformationalVersion("3.25.0+7203caaae76f7a0fef892ece10aeae90959794db")]
[assembly: AssemblyProduct("Google.Protobuf")]
[assembly: AssemblyTitle("Google Protocol Buffers")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/protocolbuffers/protobuf.git")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("3.25.0.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class IsReadOnlyAttribute : Attribute
	{
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class IsByRefLikeAttribute : Attribute
	{
	}
}
namespace System.Diagnostics.CodeAnalysis
{
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Interface | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, Inherited = false)]
	internal sealed class DynamicallyAccessedMembersAttribute : Attribute
	{
		public DynamicallyAccessedMemberTypes MemberTypes { get; }

		public DynamicallyAccessedMembersAttribute(DynamicallyAccessedMemberTypes memberTypes)
		{
			MemberTypes = memberTypes;
		}
	}
	[Flags]
	internal enum DynamicallyAccessedMemberTypes
	{
		None = 0,
		PublicParameterlessConstructor = 1,
		PublicConstructors = 3,
		NonPublicConstructors = 4,
		PublicMethods = 8,
		NonPublicMethods = 0x10,
		PublicFields = 0x20,
		NonPublicFields = 0x40,
		PublicNestedTypes = 0x80,
		NonPublicNestedTypes = 0x100,
		PublicProperties = 0x200,
		NonPublicProperties = 0x400,
		PublicEvents = 0x800,
		NonPublicEvents = 0x1000,
		Interfaces = 0x2000,
		All = -1
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Constructor | AttributeTargets.Method, Inherited = false)]
	internal sealed class RequiresUnreferencedCodeAttribute : Attribute
	{
		public string Message { get; }

		public string Url { get; set; }

		public RequiresUnreferencedCodeAttribute(string message)
		{
			Message = message;
		}
	}
	[AttributeUsage(AttributeTargets.All, Inherited = false, AllowMultiple = true)]
	internal sealed class UnconditionalSuppressMessageAttribute : Attribute
	{
		public string Category { get; }

		public string CheckId { get; }

		public string Scope { get; set; }

		public string Target { get; set; }

		public string MessageId { get; set; }

		public string Justification { get; set; }

		public UnconditionalSuppressMessageAttribute(string category, string checkId)
		{
			Category = category;
			CheckId = checkId;
		}
	}
}
namespace Google.Protobuf
{
	internal static class ByteArray
	{
		private const int CopyThreshold = 12;

		internal static void Copy(byte[] src, int srcOffset, byte[] dst, int dstOffset, int count)
		{
			if (count > 12)
			{
				Buffer.BlockCopy(src, srcOffset, dst, dstOffset, count);
				return;
			}
			int num = srcOffset + count;
			for (int i = srcOffset; i < num; i++)
			{
				dst[dstOffset++] = src[i];
			}
		}

		internal static void Reverse(byte[] bytes)
		{
			int num = 0;
			int num2 = bytes.Length - 1;
			while (num < num2)
			{
				byte b = bytes[num];
				bytes[num] = bytes[num2];
				bytes[num2] = b;
				num++;
				num2--;
			}
		}
	}
	[SecuritySafeCritical]
	[DebuggerDisplay("Length = {Length}")]
	[DebuggerTypeProxy(typeof(ByteStringDebugView))]
	public sealed class ByteString : IEnumerable<byte>, IEnumerable, IEquatable<ByteString>
	{
		private sealed class ByteStringDebugView
		{
			private readonly ByteString data;

			[DebuggerBrowsable(DebuggerBrowsableState.RootHidden)]
			public byte[] Items => data.bytes.ToArray();

			public ByteStringDebugView(ByteString data)
			{
				this.data = data;
			}
		}

		private static readonly ByteString empty = new ByteString(new byte[0]);

		private readonly ReadOnlyMemory<byte> bytes;

		public static ByteString Empty => empty;

		public int Length => bytes.Length;

		public bool IsEmpty => Length == 0;

		public ReadOnlySpan<byte> Span => bytes.Span;

		public ReadOnlyMemory<byte> Memory => bytes;

		public byte this[int index] => bytes.Span[index];

		internal static ByteString AttachBytes(ReadOnlyMemory<byte> bytes)
		{
			return new ByteString(bytes);
		}

		internal static ByteString AttachBytes(byte[] bytes)
		{
			return AttachBytes(bytes.AsMemory());
		}

		private ByteString(ReadOnlyMemory<byte> bytes)
		{
			this.bytes = bytes;
		}

		public byte[] ToByteArray()
		{
			return bytes.ToArray();
		}

		public string ToBase64()
		{
			if (MemoryMarshal.TryGetArray(bytes, out var segment))
			{
				return Convert.ToBase64String(segment.Array, segment.Offset, segment.Count);
			}
			return Convert.ToBase64String(bytes.ToArray());
		}

		public static ByteString FromBase64(string bytes)
		{
			if (!(bytes == ""))
			{
				return new ByteString(Convert.FromBase64String(bytes));
			}
			return Empty;
		}

		public static ByteString FromStream(Stream stream)
		{
			ProtoPreconditions.CheckNotNull(stream, "stream");
			MemoryStream memoryStream = new MemoryStream(stream.CanSeek ? checked((int)(stream.Length - stream.Position)) : 0);
			stream.CopyTo(memoryStream);
			return AttachBytes((memoryStream.Length == memoryStream.Capacity) ? memoryStream.GetBuffer() : memoryStream.ToArray());
		}

		public static Task<ByteString> FromStreamAsync(Stream stream, CancellationToken cancellationToken = default(CancellationToken))
		{
			ProtoPreconditions.CheckNotNull(stream, "stream");
			return ByteStringAsync.FromStreamAsyncCore(stream, cancellationToken);
		}

		public static ByteString CopyFrom(params byte[] bytes)
		{
			return new ByteString((byte[])bytes.Clone());
		}

		public static ByteString CopyFrom(byte[] bytes, int offset, int count)
		{
			byte[] array = new byte[count];
			ByteArray.Copy(bytes, offset, array, 0, count);
			return new ByteString(array);
		}

		public static ByteString CopyFrom(ReadOnlySpan<byte> bytes)
		{
			return new ByteString(bytes.ToArray());
		}

		public static ByteString CopyFrom(string text, Encoding encoding)
		{
			return new ByteString(encoding.GetBytes(text));
		}

		public static ByteString CopyFromUtf8(string text)
		{
			return CopyFrom(text, Encoding.UTF8);
		}

		public string ToString(Encoding encoding)
		{
			if (MemoryMarshal.TryGetArray(bytes, out var segment))
			{
				return encoding.GetString(segment.Array, segment.Offset, segment.Count);
			}
			byte[] array = bytes.ToArray();
			return encoding.GetString(array, 0, array.Length);
		}

		public string ToStringUtf8()
		{
			return ToString(Encoding.UTF8);
		}

		[SecuritySafeCritical]
		public IEnumerator<byte> GetEnumerator()
		{
			return MemoryMarshal.ToEnumerable(bytes).GetEnumerator();
		}

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

		public CodedInputStream CreateCodedInput()
		{
			if (MemoryMarshal.TryGetArray(bytes, out var segment) && segment.Count == bytes.Length)
			{
				return new CodedInputStream(segment.Array, segment.Offset, segment.Count);
			}
			return new CodedInputStream(bytes.ToArray());
		}

		public static bool operator ==(ByteString lhs, ByteString rhs)
		{
			if ((object)lhs == rhs)
			{
				return true;
			}
			if ((object)lhs == null || (object)rhs == null)
			{
				return false;
			}
			return lhs.bytes.Span.SequenceEqual(rhs.bytes.Span);
		}

		public static bool operator !=(ByteString lhs, ByteString rhs)
		{
			return !(lhs == rhs);
		}

		[SecuritySafeCritical]
		public override bool Equals(object obj)
		{
			return this == obj as ByteString;
		}

		[SecuritySafeCritical]
		public override int GetHashCode()
		{
			ReadOnlySpan<byte> span = bytes.Span;
			int num = 23;
			for (int i = 0; i < span.Length; i++)
			{
				num = num * 31 + span[i];
			}
			return num;
		}

		public bool Equals(ByteString other)
		{
			return this == other;
		}

		public void CopyTo(byte[] array, int position)
		{
			bytes.CopyTo(array.AsMemory(position));
		}

		public void WriteTo(Stream outputStream)
		{
			if (MemoryMarshal.TryGetArray(bytes, out var segment))
			{
				outputStream.Write(segment.Array, segment.Offset, segment.Count);
				return;
			}
			byte[] array = bytes.ToArray();
			outputStream.Write(array, 0, array.Length);
		}
	}
	internal static class ByteStringAsync
	{
		internal static async Task<ByteString> FromStreamAsyncCore(Stream stream, CancellationToken cancellationToken)
		{
			int capacity = (stream.CanSeek ? checked((int)(stream.Length - stream.Position)) : 0);
			MemoryStream memoryStream = new MemoryStream(capacity);
			await stream.CopyToAsync(memoryStream, 81920, cancellationToken);
			return ByteString.AttachBytes((memoryStream.Length == memoryStream.Capacity) ? memoryStream.GetBuffer() : memoryStream.ToArray());
		}
	}
	[SecuritySafeCritical]
	public sealed class CodedInputStream : IDisposable
	{
		private readonly bool leaveOpen;

		private readonly byte[] buffer;

		private readonly Stream input;

		private ParserInternalState state;

		internal const int DefaultRecursionLimit = 100;

		internal const int DefaultSizeLimit = int.MaxValue;

		internal const int BufferSize = 4096;

		public long Position
		{
			get
			{
				if (input != null)
				{
					return input.Position - (state.bufferSize + state.bufferSizeAfterLimit - state.bufferPos);
				}
				return state.bufferPos;
			}
		}

		internal uint LastTag => state.lastTag;

		public int SizeLimit => state.sizeLimit;

		public int RecursionLimit => state.recursionLimit;

		internal bool DiscardUnknownFields
		{
			get
			{
				return state.DiscardUnknownFields;
			}
			set
			{
				state.DiscardUnknownFields = value;
			}
		}

		internal ExtensionRegistry ExtensionRegistry
		{
			get
			{
				return state.ExtensionRegistry;
			}
			set
			{
				state.ExtensionRegistry = value;
			}
		}

		internal byte[] InternalBuffer => buffer;

		internal Stream InternalInputStream => input;

		internal ref ParserInternalState InternalState => ref state;

		internal bool ReachedLimit => SegmentedBufferHelper.IsReachedLimit(ref state);

		public bool IsAtEnd
		{
			get
			{
				ReadOnlySpan<byte> readOnlySpan = new ReadOnlySpan<byte>(buffer);
				return SegmentedBufferHelper.IsAtEnd(ref readOnlySpan, ref state);
			}
		}

		public CodedInputStream(byte[] buffer)
			: this(null, ProtoPreconditions.CheckNotNull(buffer, "buffer"), 0, buffer.Length, leaveOpen: true)
		{
		}

		public CodedInputStream(byte[] buffer, int offset, int length)
			: this(null, ProtoPreconditions.CheckNotNull(buffer, "buffer"), offset, offset + length, leaveOpen: true)
		{
			if (offset < 0 || offset > buffer.Length)
			{
				throw new ArgumentOutOfRangeException("offset", "Offset must be within the buffer");
			}
			if (length < 0 || offset + length > buffer.Length)
			{
				throw new ArgumentOutOfRangeException("length", "Length must be non-negative and within the buffer");
			}
		}

		public CodedInputStream(Stream input)
			: this(input, leaveOpen: false)
		{
		}

		public CodedInputStream(Stream input, bool leaveOpen)
			: this(ProtoPreconditions.CheckNotNull(input, "input"), new byte[4096], 0, 0, leaveOpen)
		{
		}

		internal CodedInputStream(Stream input, byte[] buffer, int bufferPos, int bufferSize, bool leaveOpen)
		{
			this.input = input;
			this.buffer = buffer;
			state.bufferPos = bufferPos;
			state.bufferSize = bufferSize;
			state.sizeLimit = int.MaxValue;
			state.recursionLimit = 100;
			SegmentedBufferHelper.Initialize(this, out state.segmentedBufferHelper);
			this.leaveOpen = leaveOpen;
			state.currentLimit = int.MaxValue;
		}

		internal CodedInputStream(Stream input, byte[] buffer, int bufferPos, int bufferSize, int sizeLimit, int recursionLimit, bool leaveOpen)
			: this(input, buffer, bufferPos, bufferSize, leaveOpen)
		{
			if (sizeLimit <= 0)
			{
				throw new ArgumentOutOfRangeException("sizeLimit", "Size limit must be positive");
			}
			if (recursionLimit <= 0)
			{
				throw new ArgumentOutOfRangeException("recursionLimit!", "Recursion limit must be positive");
			}
			state.sizeLimit = sizeLimit;
			state.recursionLimit = recursionLimit;
		}

		public static CodedInputStream CreateWithLimits(Stream input, int sizeLimit, int recursionLimit)
		{
			return new CodedInputStream(input, new byte[4096], 0, 0, sizeLimit, recursionLimit, leaveOpen: false);
		}

		public void Dispose()
		{
			if (!leaveOpen)
			{
				input.Dispose();
			}
		}

		internal void CheckReadEndOfStreamTag()
		{
			ParsingPrimitivesMessages.CheckReadEndOfStreamTag(ref state);
		}

		public uint PeekTag()
		{
			ReadOnlySpan<byte> readOnlySpan = new ReadOnlySpan<byte>(buffer);
			return ParsingPrimitives.PeekTag(ref readOnlySpan, ref state);
		}

		public uint ReadTag()
		{
			ReadOnlySpan<byte> readOnlySpan = new ReadOnlySpan<byte>(buffer);
			return ParsingPrimitives.ParseTag(ref readOnlySpan, ref state);
		}

		public void SkipLastField()
		{
			ReadOnlySpan<byte> readOnlySpan = new ReadOnlySpan<byte>(buffer);
			ParsingPrimitivesMessages.SkipLastField(ref readOnlySpan, ref state);
		}

		internal void SkipGroup(uint startGroupTag)
		{
			ReadOnlySpan<byte> readOnlySpan = new ReadOnlySpan<byte>(buffer);
			ParsingPrimitivesMessages.SkipGroup(ref readOnlySpan, ref state, startGroupTag);
		}

		public double ReadDouble()
		{
			ReadOnlySpan<byte> readOnlySpan = new ReadOnlySpan<byte>(buffer);
			return ParsingPrimitives.ParseDouble(ref readOnlySpan, ref state);
		}

		public float ReadFloat()
		{
			ReadOnlySpan<byte> readOnlySpan = new ReadOnlySpan<byte>(buffer);
			return ParsingPrimitives.ParseFloat(ref readOnlySpan, ref state);
		}

		public ulong ReadUInt64()
		{
			return ReadRawVarint64();
		}

		public long ReadInt64()
		{
			return (long)ReadRawVarint64();
		}

		public int ReadInt32()
		{
			return (int)ReadRawVarint32();
		}

		public ulong ReadFixed64()
		{
			return ReadRawLittleEndian64();
		}

		public uint ReadFixed32()
		{
			return ReadRawLittleEndian32();
		}

		public bool ReadBool()
		{
			return ReadRawVarint64() != 0;
		}

		public string ReadString()
		{
			ReadOnlySpan<byte> readOnlySpan = new ReadOnlySpan<byte>(buffer);
			return ParsingPrimitives.ReadString(ref readOnlySpan, ref state);
		}

		public void ReadMessage(IMessage builder)
		{
			ParseContext.Initialize(buffer.AsSpan(), ref state, out var ctx);
			try
			{
				ParsingPrimitivesMessages.ReadMessage(ref ctx, builder);
			}
			finally
			{
				ctx.CopyStateTo(this);
			}
		}

		public void ReadGroup(IMessage builder)
		{
			ParseContext.Initialize(this, out var ctx);
			try
			{
				ParsingPrimitivesMessages.ReadGroup(ref ctx, builder);
			}
			finally
			{
				ctx.CopyStateTo(this);
			}
		}

		public ByteString ReadBytes()
		{
			ReadOnlySpan<byte> readOnlySpan = new ReadOnlySpan<byte>(buffer);
			return ParsingPrimitives.ReadBytes(ref readOnlySpan, ref state);
		}

		public uint ReadUInt32()
		{
			return ReadRawVarint32();
		}

		public int ReadEnum()
		{
			return (int)ReadRawVarint32();
		}

		public int ReadSFixed32()
		{
			return (int)ReadRawLittleEndian32();
		}

		public long ReadSFixed64()
		{
			return (long)ReadRawLittleEndian64();
		}

		public int ReadSInt32()
		{
			return ParsingPrimitives.DecodeZigZag32(ReadRawVarint32());
		}

		public long ReadSInt64()
		{
			return ParsingPrimitives.DecodeZigZag64(ReadRawVarint64());
		}

		public int ReadLength()
		{
			ReadOnlySpan<byte> readOnlySpan = new ReadOnlySpan<byte>(buffer);
			return ParsingPrimitives.ParseLength(ref readOnlySpan, ref state);
		}

		public bool MaybeConsumeTag(uint tag)
		{
			ReadOnlySpan<byte> readOnlySpan = new ReadOnlySpan<byte>(buffer);
			return ParsingPrimitives.MaybeConsumeTag(ref readOnlySpan, ref state, tag);
		}

		internal uint ReadRawVarint32()
		{
			ReadOnlySpan<byte> readOnlySpan = new ReadOnlySpan<byte>(buffer);
			return ParsingPrimitives.ParseRawVarint32(ref readOnlySpan, ref state);
		}

		internal static uint ReadRawVarint32(Stream input)
		{
			return ParsingPrimitives.ReadRawVarint32(input);
		}

		internal ulong ReadRawVarint64()
		{
			ReadOnlySpan<byte> readOnlySpan = new ReadOnlySpan<byte>(buffer);
			return ParsingPrimitives.ParseRawVarint64(ref readOnlySpan, ref state);
		}

		internal uint ReadRawLittleEndian32()
		{
			ReadOnlySpan<byte> readOnlySpan = new ReadOnlySpan<byte>(buffer);
			return ParsingPrimitives.ParseRawLittleEndian32(ref readOnlySpan, ref state);
		}

		internal ulong ReadRawLittleEndian64()
		{
			ReadOnlySpan<byte> readOnlySpan = new ReadOnlySpan<byte>(buffer);
			return ParsingPrimitives.ParseRawLittleEndian64(ref readOnlySpan, ref state);
		}

		internal int PushLimit(int byteLimit)
		{
			return SegmentedBufferHelper.PushLimit(ref state, byteLimit);
		}

		internal void PopLimit(int oldLimit)
		{
			SegmentedBufferHelper.PopLimit(ref state, oldLimit);
		}

		internal byte[] ReadRawBytes(int size)
		{
			ReadOnlySpan<byte> readOnlySpan = new ReadOnlySpan<byte>(buffer);
			return ParsingPrimitives.ReadRawBytes(ref readOnlySpan, ref state, size);
		}

		public void ReadRawMessage(IMessage message)
		{
			ParseContext.Initialize(this, out var ctx);
			try
			{
				ParsingPrimitivesMessages.ReadRawMessage(ref ctx, message);
			}
			finally
			{
				ctx.CopyStateTo(this);
			}
		}
	}
	[SecuritySafeCritical]
	public sealed class CodedOutputStream : IDisposable
	{
		public sealed class OutOfSpaceException : IOException
		{
			internal OutOfSpaceException()
				: base("CodedOutputStream was writing to a flat byte array and ran out of space.")
			{
			}
		}

		private const int LittleEndian64Size = 8;

		private const int LittleEndian32Size = 4;

		internal const int DoubleSize = 8;

		internal const int FloatSize = 4;

		internal const int BoolSize = 1;

		public static readonly int DefaultBufferSize = 4096;

		private readonly bool leaveOpen;

		private readonly byte[] buffer;

		private WriterInternalState state;

		private readonly Stream output;

		public long Position
		{
			get
			{
				if (output != null)
				{
					return output.Position + state.position;
				}
				return state.position;
			}
		}

		public bool Deterministic { get; set; }

		public int SpaceLeft => WriteBufferHelper.GetSpaceLeft(ref state);

		internal byte[] InternalBuffer => buffer;

		internal Stream InternalOutputStream => output;

		internal ref WriterInternalState InternalState => ref state;

		public static int ComputeDoubleSize(double value)
		{
			return 8;
		}

		public static int ComputeFloatSize(float value)
		{
			return 4;
		}

		public static int ComputeUInt64Size(ulong value)
		{
			return ComputeRawVarint64Size(value);
		}

		public static int ComputeInt64Size(long value)
		{
			return ComputeRawVarint64Size((ulong)value);
		}

		public static int ComputeInt32Size(int value)
		{
			if (value >= 0)
			{
				return ComputeRawVarint32Size((uint)value);
			}
			return 10;
		}

		public static int ComputeFixed64Size(ulong value)
		{
			return 8;
		}

		public static int ComputeFixed32Size(uint value)
		{
			return 4;
		}

		public static int ComputeBoolSize(bool value)
		{
			return 1;
		}

		public static int ComputeStringSize(string value)
		{
			int byteCount = WritingPrimitives.Utf8Encoding.GetByteCount(value);
			return ComputeLengthSize(byteCount) + byteCount;
		}

		public static int ComputeGroupSize(IMessage value)
		{
			return value.CalculateSize();
		}

		public static int ComputeMessageSize(IMessage value)
		{
			int num = value.CalculateSize();
			return ComputeLengthSize(num) + num;
		}

		public static int ComputeBytesSize(ByteString value)
		{
			return ComputeLengthSize(value.Length) + value.Length;
		}

		public static int ComputeUInt32Size(uint value)
		{
			return ComputeRawVarint32Size(value);
		}

		public static int ComputeEnumSize(int value)
		{
			return ComputeInt32Size(value);
		}

		public static int ComputeSFixed32Size(int value)
		{
			return 4;
		}

		public static int ComputeSFixed64Size(long value)
		{
			return 8;
		}

		public static int ComputeSInt32Size(int value)
		{
			return ComputeRawVarint32Size(WritingPrimitives.EncodeZigZag32(value));
		}

		public static int ComputeSInt64Size(long value)
		{
			return ComputeRawVarint64Size(WritingPrimitives.EncodeZigZag64(value));
		}

		public static int ComputeLengthSize(int length)
		{
			return ComputeRawVarint32Size((uint)length);
		}

		public static int ComputeRawVarint32Size(uint value)
		{
			if ((value & 0xFFFFFF80u) == 0)
			{
				return 1;
			}
			if ((value & 0xFFFFC000u) == 0)
			{
				return 2;
			}
			if ((value & 0xFFE00000u) == 0)
			{
				return 3;
			}
			if ((value & 0xF0000000u) == 0)
			{
				return 4;
			}
			return 5;
		}

		public static int ComputeRawVarint64Size(ulong value)
		{
			if ((value & 0xFFFFFFFFFFFFFF80uL) == 0L)
			{
				return 1;
			}
			if ((value & 0xFFFFFFFFFFFFC000uL) == 0L)
			{
				return 2;
			}
			if ((value & 0xFFFFFFFFFFE00000uL) == 0L)
			{
				return 3;
			}
			if ((value & 0xFFFFFFFFF0000000uL) == 0L)
			{
				return 4;
			}
			if ((value & 0xFFFFFFF800000000uL) == 0L)
			{
				return 5;
			}
			if ((value & 0xFFFFFC0000000000uL) == 0L)
			{
				return 6;
			}
			if ((value & 0xFFFE000000000000uL) == 0L)
			{
				return 7;
			}
			if ((value & 0xFF00000000000000uL) == 0L)
			{
				return 8;
			}
			if ((value & 0x8000000000000000uL) == 0L)
			{
				return 9;
			}
			return 10;
		}

		public static int ComputeTagSize(int fieldNumber)
		{
			return ComputeRawVarint32Size(WireFormat.MakeTag(fieldNumber, WireFormat.WireType.Varint));
		}

		public CodedOutputStream(byte[] flatArray)
			: this(flatArray, 0, flatArray.Length)
		{
		}

		private CodedOutputStream(byte[] buffer, int offset, int length)
		{
			output = null;
			this.buffer = ProtoPreconditions.CheckNotNull(buffer, "buffer");
			state.position = offset;
			state.limit = offset + length;
			WriteBufferHelper.Initialize(this, out state.writeBufferHelper);
			leaveOpen = true;
		}

		private CodedOutputStream(Stream output, byte[] buffer, bool leaveOpen)
		{
			this.output = ProtoPreconditions.CheckNotNull(output, "output");
			this.buffer = buffer;
			state.position = 0;
			state.limit = buffer.Length;
			WriteBufferHelper.Initialize(this, out state.writeBufferHelper);
			this.leaveOpen = leaveOpen;
		}

		public CodedOutputStream(Stream output)
			: this(output, DefaultBufferSize, leaveOpen: false)
		{
		}

		public CodedOutputStream(Stream output, int bufferSize)
			: this(output, new byte[bufferSize], leaveOpen: false)
		{
		}

		public CodedOutputStream(Stream output, bool leaveOpen)
			: this(output, DefaultBufferSize, leaveOpen)
		{
		}

		public CodedOutputStream(Stream output, int bufferSize, bool leaveOpen)
			: this(output, new byte[bufferSize], leaveOpen)
		{
		}

		public void WriteDouble(double value)
		{
			Span<byte> span = new Span<byte>(buffer);
			WritingPrimitives.WriteDouble(ref span, ref state, value);
		}

		public void WriteFloat(float value)
		{
			Span<byte> span = new Span<byte>(buffer);
			WritingPrimitives.WriteFloat(ref span, ref state, value);
		}

		public void WriteUInt64(ulong value)
		{
			Span<byte> span = new Span<byte>(buffer);
			WritingPrimitives.WriteUInt64(ref span, ref state, value);
		}

		public void WriteInt64(long value)
		{
			Span<byte> span = new Span<byte>(buffer);
			WritingPrimitives.WriteInt64(ref span, ref state, value);
		}

		public void WriteInt32(int value)
		{
			Span<byte> span = new Span<byte>(buffer);
			WritingPrimitives.WriteInt32(ref span, ref state, value);
		}

		public void WriteFixed64(ulong value)
		{
			Span<byte> span = new Span<byte>(buffer);
			WritingPrimitives.WriteFixed64(ref span, ref state, value);
		}

		public void WriteFixed32(uint value)
		{
			Span<byte> span = new Span<byte>(buffer);
			WritingPrimitives.WriteFixed32(ref span, ref state, value);
		}

		public void WriteBool(bool value)
		{
			Span<byte> span = new Span<byte>(buffer);
			WritingPrimitives.WriteBool(ref span, ref state, value);
		}

		public void WriteString(string value)
		{
			Span<byte> span = new Span<byte>(buffer);
			WritingPrimitives.WriteString(ref span, ref state, value);
		}

		public void WriteMessage(IMessage value)
		{
			Span<byte> span = new Span<byte>(buffer);
			WriteContext.Initialize(ref span, ref state, out var ctx);
			try
			{
				WritingPrimitivesMessages.WriteMessage(ref ctx, value);
			}
			finally
			{
				ctx.CopyStateTo(this);
			}
		}

		public void WriteRawMessage(IMessage value)
		{
			Span<byte> span = new Span<byte>(buffer);
			WriteContext.Initialize(ref span, ref state, out var ctx);
			try
			{
				WritingPrimitivesMessages.WriteRawMessage(ref ctx, value);
			}
			finally
			{
				ctx.CopyStateTo(this);
			}
		}

		public void WriteGroup(IMessage value)
		{
			Span<byte> span = new Span<byte>(buffer);
			WriteContext.Initialize(ref span, ref state, out var ctx);
			try
			{
				WritingPrimitivesMessages.WriteGroup(ref ctx, value);
			}
			finally
			{
				ctx.CopyStateTo(this);
			}
		}

		public void WriteBytes(ByteString value)
		{
			Span<byte> span = new Span<byte>(buffer);
			WritingPrimitives.WriteBytes(ref span, ref state, value);
		}

		public void WriteUInt32(uint value)
		{
			Span<byte> span = new Span<byte>(buffer);
			WritingPrimitives.WriteUInt32(ref span, ref state, value);
		}

		public void WriteEnum(int value)
		{
			Span<byte> span = new Span<byte>(buffer);
			WritingPrimitives.WriteEnum(ref span, ref state, value);
		}

		public void WriteSFixed32(int value)
		{
			Span<byte> span = new Span<byte>(buffer);
			WritingPrimitives.WriteSFixed32(ref span, ref state, value);
		}

		public void WriteSFixed64(long value)
		{
			Span<byte> span = new Span<byte>(buffer);
			WritingPrimitives.WriteSFixed64(ref span, ref state, value);
		}

		public void WriteSInt32(int value)
		{
			Span<byte> span = new Span<byte>(buffer);
			WritingPrimitives.WriteSInt32(ref span, ref state, value);
		}

		public void WriteSInt64(long value)
		{
			Span<byte> span = new Span<byte>(buffer);
			WritingPrimitives.WriteSInt64(ref span, ref state, value);
		}

		public void WriteLength(int length)
		{
			Span<byte> span = new Span<byte>(buffer);
			WritingPrimitives.WriteLength(ref span, ref state, length);
		}

		public void WriteTag(int fieldNumber, WireFormat.WireType type)
		{
			Span<byte> span = new Span<byte>(buffer);
			WritingPrimitives.WriteTag(ref span, ref state, fieldNumber, type);
		}

		public void WriteTag(uint tag)
		{
			Span<byte> span = new Span<byte>(buffer);
			WritingPrimitives.WriteTag(ref span, ref state, tag);
		}

		public void WriteRawTag(byte b1)
		{
			Span<byte> span = new Span<byte>(buffer);
			WritingPrimitives.WriteRawTag(ref span, ref state, b1);
		}

		public void WriteRawTag(byte b1, byte b2)
		{
			Span<byte> span = new Span<byte>(buffer);
			WritingPrimitives.WriteRawTag(ref span, ref state, b1, b2);
		}

		public void WriteRawTag(byte b1, byte b2, byte b3)
		{
			Span<byte> span = new Span<byte>(buffer);
			WritingPrimitives.WriteRawTag(ref span, ref state, b1, b2, b3);
		}

		public void WriteRawTag(byte b1, byte b2, byte b3, byte b4)
		{
			Span<byte> span = new Span<byte>(buffer);
			WritingPrimitives.WriteRawTag(ref span, ref state, b1, b2, b3, b4);
		}

		public void WriteRawTag(byte b1, byte b2, byte b3, byte b4, byte b5)
		{
			Span<byte> span = new Span<byte>(buffer);
			WritingPrimitives.WriteRawTag(ref span, ref state, b1, b2, b3, b4, b5);
		}

		internal void WriteRawVarint32(uint value)
		{
			Span<byte> span = new Span<byte>(buffer);
			WritingPrimitives.WriteRawVarint32(ref span, ref state, value);
		}

		internal void WriteRawVarint64(ulong value)
		{
			Span<byte> span = new Span<byte>(buffer);
			WritingPrimitives.WriteRawVarint64(ref span, ref state, value);
		}

		internal void WriteRawLittleEndian32(uint value)
		{
			Span<byte> span = new Span<byte>(buffer);
			WritingPrimitives.WriteRawLittleEndian32(ref span, ref state, value);
		}

		internal void WriteRawLittleEndian64(ulong value)
		{
			Span<byte> span = new Span<byte>(buffer);
			WritingPrimitives.WriteRawLittleEndian64(ref span, ref state, value);
		}

		internal void WriteRawBytes(byte[] value)
		{
			WriteRawBytes(value, 0, value.Length);
		}

		internal void WriteRawBytes(byte[] value, int offset, int length)
		{
			Span<byte> span = new Span<byte>(buffer);
			WritingPrimitives.WriteRawBytes(ref span, ref state, value, offset, length);
		}

		public void Dispose()
		{
			Flush();
			if (!leaveOpen)
			{
				output.Dispose();
			}
		}

		public void Flush()
		{
			Span<byte> span = new Span<byte>(buffer);
			WriteBufferHelper.Flush(ref span, ref state);
		}

		public void CheckNoSpaceLeft()
		{
			WriteBufferHelper.CheckNoSpaceLeft(ref state);
		}
	}
	public abstract class Extension
	{
		internal abstract System.Type TargetType { get; }

		public int FieldNumber { get; }

		internal abstract bool IsRepeated { get; }

		protected Extension(int fieldNumber)
		{
			FieldNumber = fieldNumber;
		}

		internal abstract IExtensionValue CreateValue();
	}
	public sealed class Extension<TTarget, TValue> : Extension where TTarget : IExtendableMessage<TTarget>
	{
		private readonly FieldCodec<TValue> codec;

		internal TValue DefaultValue
		{
			get
			{
				if (codec == null)
				{
					return default(TValue);
				}
				return codec.DefaultValue;
			}
		}

		internal override System.Type TargetType => typeof(TTarget);

		internal override bool IsRepeated => false;

		public Extension(int fieldNumber, FieldCodec<TValue> codec)
			: base(fieldNumber)
		{
			this.codec = codec;
		}

		internal override IExtensionValue CreateValue()
		{
			return new ExtensionValue<TValue>(codec);
		}
	}
	public sealed class RepeatedExtension<TTarget, TValue> : Extension where TTarget : IExtendableMessage<TTarget>
	{
		private readonly FieldCodec<TValue> codec;

		internal override System.Type TargetType => typeof(TTarget);

		internal override bool IsRepeated => true;

		public RepeatedExtension(int fieldNumber, FieldCodec<TValue> codec)
			: base(fieldNumber)
		{
			this.codec = codec;
		}

		internal override IExtensionValue CreateValue()
		{
			return new RepeatedExtensionValue<TValue>(codec);
		}
	}
	public sealed class ExtensionRegistry : ICollection<Extension>, IEnumerable<Extension>, IEnumerable, IDeepCloneable<ExtensionRegistry>
	{
		internal sealed class ExtensionComparer : IEqualityComparer<Extension>
		{
			internal static ExtensionComparer Instance = new ExtensionComparer();

			public bool Equals(Extension a, Extension b)
			{
				return new ObjectIntPair<System.Type>(a.TargetType, a.FieldNumber).Equals(new ObjectIntPair<System.Type>(b.TargetType, b.FieldNumber));
			}

			public int GetHashCode(Extension a)
			{
				return new ObjectIntPair<System.Type>(a.TargetType, a.FieldNumber).GetHashCode();
			}
		}

		private readonly IDictionary<ObjectIntPair<System.Type>, Extension> extensions;

		public int Count => extensions.Count;

		bool ICollection<Extension>.IsReadOnly => false;

		public ExtensionRegistry()
		{
			extensions = new Dictionary<ObjectIntPair<System.Type>, Extension>();
		}

		private ExtensionRegistry(IDictionary<ObjectIntPair<System.Type>, Extension> collection)
		{
			extensions = collection.ToDictionary((KeyValuePair<ObjectIntPair<System.Type>, Extension> k) => k.Key, (KeyValuePair<ObjectIntPair<System.Type>, Extension> v) => v.Value);
		}

		internal bool ContainsInputField(uint lastTag, System.Type target, out Extension extension)
		{
			return extensions.TryGetValue(new ObjectIntPair<System.Type>(target, WireFormat.GetTagFieldNumber(lastTag)), out extension);
		}

		public void Add(Extension extension)
		{
			ProtoPreconditions.CheckNotNull(extension, "extension");
			extensions.Add(new ObjectIntPair<System.Type>(extension.TargetType, extension.FieldNumber), extension);
		}

		public void AddRange(IEnumerable<Extension> extensions)
		{
			ProtoPreconditions.CheckNotNull(extensions, "extensions");
			foreach (Extension extension in extensions)
			{
				Add(extension);
			}
		}

		public void Clear()
		{
			extensions.Clear();
		}

		public bool Contains(Extension item)
		{
			ProtoPreconditions.CheckNotNull(item, "item");
			return extensions.ContainsKey(new ObjectIntPair<System.Type>(item.TargetType, item.FieldNumber));
		}

		void ICollection<Extension>.CopyTo(Extension[] array, int arrayIndex)
		{
			ProtoPreconditions.CheckNotNull(array, "array");
			if (arrayIndex < 0 || arrayIndex >= array.Length)
			{
				throw new ArgumentOutOfRangeException("arrayIndex");
			}
			if (array.Length - arrayIndex < Count)
			{
				throw new ArgumentException("The provided array is shorter than the number of elements in the registry");
			}
			foreach (Extension extension in array)
			{
				extensions.Add(new ObjectIntPair<System.Type>(extension.TargetType, extension.FieldNumber), extension);
			}
		}

		public IEnumerator<Extension> GetEnumerator()
		{
			return extensions.Values.GetEnumerator();
		}

		public bool Remove(Extension item)
		{
			ProtoPreconditions.CheckNotNull(item, "item");
			return extensions.Remove(new ObjectIntPair<System.Type>(item.TargetType, item.FieldNumber));
		}

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

		public ExtensionRegistry Clone()
		{
			return new ExtensionRegistry(extensions);
		}
	}
	public static class ExtensionSet
	{
		private static bool TryGetValue<TTarget>(ref ExtensionSet<TTarget> set, Extension extension, out IExtensionValue value) where TTarget : IExtendableMessage<TTarget>
		{
			if (set == null)
			{
				value = null;
				return false;
			}
			return set.ValuesByNumber.TryGetValue(extension.FieldNumber, out value);
		}

		public static TValue Get<TTarget, TValue>(ref ExtensionSet<TTarget> set, Extension<TTarget, TValue> extension) where TTarget : IExtendableMessage<TTarget>
		{
			if (TryGetValue(ref set, extension, out var value))
			{
				if (value is ExtensionValue<TValue> extensionValue)
				{
					return extensionValue.GetValue();
				}
				object value2 = value.GetValue();
				if (value2 is TValue)
				{
					return (TValue)value2;
				}
				TypeInfo typeInfo = value.GetType().GetTypeInfo();
				if (typeInfo.IsGenericType && typeInfo.GetGenericTypeDefinition() == typeof(ExtensionValue<>))
				{
					System.Type type = typeInfo.GenericTypeArguments[0];
					throw new InvalidOperationException("The stored extension value has a type of '" + type.AssemblyQualifiedName + "'. This a different from the requested type of '" + typeof(TValue).AssemblyQualifiedName + "'.");
				}
				throw new InvalidOperationException("Unexpected extension value type: " + typeInfo.AssemblyQualifiedName);
			}
			return extension.DefaultValue;
		}

		public static RepeatedField<TValue> Get<TTarget, TValue>(ref ExtensionSet<TTarget> set, RepeatedExtension<TTarget, TValue> extension) where TTarget : IExtendableMessage<TTarget>
		{
			if (TryGetValue(ref set, extension, out var value))
			{
				if (value is RepeatedExtensionValue<TValue> repeatedExtensionValue)
				{
					return repeatedExtensionValue.GetValue();
				}
				TypeInfo typeInfo = value.GetType().GetTypeInfo();
				if (typeInfo.IsGenericType && typeInfo.GetGenericTypeDefinition() == typeof(RepeatedExtensionValue<>))
				{
					System.Type type = typeInfo.GenericTypeArguments[0];
					throw new InvalidOperationException("The stored extension value has a type of '" + type.AssemblyQualifiedName + "'. This a different from the requested type of '" + typeof(TValue).AssemblyQualifiedName + "'.");
				}
				throw new InvalidOperationException("Unexpected extension value type: " + typeInfo.AssemblyQualifiedName);
			}
			return null;
		}

		public static RepeatedField<TValue> GetOrInitialize<TTarget, TValue>(ref ExtensionSet<TTarget> set, RepeatedExtension<TTarget, TValue> extension) where TTarget : IExtendableMessage<TTarget>
		{
			IExtensionValue value;
			if (set == null)
			{
				value = extension.CreateValue();
				set = new ExtensionSet<TTarget>();
				set.ValuesByNumber.Add(extension.FieldNumber, value);
			}
			else if (!set.ValuesByNumber.TryGetValue(extension.FieldNumber, out value))
			{
				value = extension.CreateValue();
				set.ValuesByNumber.Add(extension.FieldNumber, value);
			}
			return ((RepeatedExtensionValue<TValue>)value).GetValue();
		}

		public static void Set<TTarget, TValue>(ref ExtensionSet<TTarget> set, Extension<TTarget, TValue> extension, TValue value) where TTarget : IExtendableMessage<TTarget>
		{
			ProtoPreconditions.CheckNotNullUnconstrained(value, "value");
			IExtensionValue value2;
			if (set == null)
			{
				value2 = extension.CreateValue();
				set = new ExtensionSet<TTarget>();
				set.ValuesByNumber.Add(extension.FieldNumber, value2);
			}
			else if (!set.ValuesByNumber.TryGetValue(extension.FieldNumber, out value2))
			{
				value2 = extension.CreateValue();
				set.ValuesByNumber.Add(extension.FieldNumber, value2);
			}
			((ExtensionValue<TValue>)value2).SetValue(value);
		}

		public static bool Has<TTarget, TValue>(ref ExtensionSet<TTarget> set, Extension<TTarget, TValue> extension) where TTarget : IExtendableMessage<TTarget>
		{
			IExtensionValue value;
			return TryGetValue(ref set, extension, out value);
		}

		public static void Clear<TTarget, TValue>(ref ExtensionSet<TTarget> set, Extension<TTarget, TValue> extension) where TTarget : IExtendableMessage<TTarget>
		{
			if (set != null)
			{
				set.ValuesByNumber.Remove(extension.FieldNumber);
				if (set.ValuesByNumber.Count == 0)
				{
					set = null;
				}
			}
		}

		public static void Clear<TTarget, TValue>(ref ExtensionSet<TTarget> set, RepeatedExtension<TTarget, TValue> extension) where TTarget : IExtendableMessage<TTarget>
		{
			if (set != null)
			{
				set.ValuesByNumber.Remove(extension.FieldNumber);
				if (set.ValuesByNumber.Count == 0)
				{
					set = null;
				}
			}
		}

		public static bool TryMergeFieldFrom<TTarget>(ref ExtensionSet<TTarget> set, CodedInputStream stream) where TTarget : IExtendableMessage<TTarget>
		{
			ParseContext.Initialize(stream, out var ctx);
			try
			{
				return TryMergeFieldFrom(ref set, ref ctx);
			}
			finally
			{
				ctx.CopyStateTo(stream);
			}
		}

		public static bool TryMergeFieldFrom<TTarget>(ref ExtensionSet<TTarget> set, ref ParseContext ctx) where TTarget : IExtendableMessage<TTarget>
		{
			int tagFieldNumber = WireFormat.GetTagFieldNumber(ctx.LastTag);
			if (set != null && set.ValuesByNumber.TryGetValue(tagFieldNumber, out var value))
			{
				value.MergeFrom(ref ctx);
				return true;
			}
			if (ctx.ExtensionRegistry != null && ctx.ExtensionRegistry.ContainsInputField(ctx.LastTag, typeof(TTarget), out var extension))
			{
				IExtensionValue extensionValue = extension.CreateValue();
				extensionValue.MergeFrom(ref ctx);
				if (set == null)
				{
					set = new ExtensionSet<TTarget>();
				}
				set.ValuesByNumber.Add(extension.FieldNumber, extensionValue);
				return true;
			}
			return false;
		}

		public static void MergeFrom<TTarget>(ref ExtensionSet<TTarget> first, ExtensionSet<TTarget> second) where TTarget : IExtendableMessage<TTarget>
		{
			if (second == null)
			{
				return;
			}
			if (first == null)
			{
				first = new ExtensionSet<TTarget>();
			}
			foreach (KeyValuePair<int, IExtensionValue> item in second.ValuesByNumber)
			{
				if (first.ValuesByNumber.TryGetValue(item.Key, out var value))
				{
					value.MergeFrom(item.Value);
					continue;
				}
				IExtensionValue value2 = item.Value.Clone();
				first.ValuesByNumber[item.Key] = value2;
			}
		}

		public static ExtensionSet<TTarget> Clone<TTarget>(ExtensionSet<TTarget> set) where TTarget : IExtendableMessage<TTarget>
		{
			if (set == null)
			{
				return null;
			}
			ExtensionSet<TTarget> extensionSet = new ExtensionSet<TTarget>();
			foreach (KeyValuePair<int, IExtensionValue> item in set.ValuesByNumber)
			{
				IExtensionValue value = item.Value.Clone();
				extensionSet.ValuesByNumber[item.Key] = value;
			}
			return extensionSet;
		}
	}
	public sealed class ExtensionSet<TTarget> where TTarget : IExtendableMessage<TTarget>
	{
		internal Dictionary<int, IExtensionValue> ValuesByNumber { get; } = new Dictionary<int, IExtensionValue>();


		public override int GetHashCode()
		{
			int num = typeof(TTarget).GetHashCode();
			foreach (KeyValuePair<int, IExtensionValue> item in ValuesByNumber)
			{
				int num2 = item.Key.GetHashCode() ^ item.Value.GetHashCode();
				num ^= num2;
			}
			return num;
		}

		public override bool Equals(object other)
		{
			if (this == other)
			{
				return true;
			}
			ExtensionSet<TTarget> extensionSet = other as ExtensionSet<TTarget>;
			if (ValuesByNumber.Count != extensionSet.ValuesByNumber.Count)
			{
				return false;
			}
			foreach (KeyValuePair<int, IExtensionValue> item in ValuesByNumber)
			{
				if (!extensionSet.ValuesByNumber.TryGetValue(item.Key, out var value))
				{
					return false;
				}
				if (!item.Value.Equals(value))
				{
					return false;
				}
			}
			return true;
		}

		public int CalculateSize()
		{
			int num = 0;
			foreach (IExtensionValue value in ValuesByNumber.Values)
			{
				num += value.CalculateSize();
			}
			return num;
		}

		public void WriteTo(CodedOutputStream stream)
		{
			WriteContext.Initialize(stream, out var ctx);
			try
			{
				WriteTo(ref ctx);
			}
			finally
			{
				ctx.CopyStateTo(stream);
			}
		}

		[SecuritySafeCritical]
		public void WriteTo(ref WriteContext ctx)
		{
			foreach (IExtensionValue value in ValuesByNumber.Values)
			{
				value.WriteTo(ref ctx);
			}
		}

		internal bool IsInitialized()
		{
			return ValuesByNumber.Values.All((IExtensionValue v) => v.IsInitialized());
		}
	}
	internal interface IExtensionValue : IEquatable<IExtensionValue>, IDeepCloneable<IExtensionValue>
	{
		void MergeFrom(ref ParseContext ctx);

		void MergeFrom(IExtensionValue value);

		void WriteTo(ref WriteContext ctx);

		int CalculateSize();

		bool IsInitialized();

		object GetValue();
	}
	internal sealed class ExtensionValue<T> : IExtensionValue, IEquatable<IExtensionValue>, IDeepCloneable<IExtensionValue>
	{
		private T field;

		private readonly FieldCodec<T> codec;

		internal ExtensionValue(FieldCodec<T> codec)
		{
			this.codec = codec;
			field = codec.DefaultValue;
		}

		public int CalculateSize()
		{
			return codec.CalculateUnconditionalSizeWithTag(field);
		}

		public IExtensionValue Clone()
		{
			return new ExtensionValue<T>(codec)
			{
				field = ((field is IDeepCloneable<T>) ? (field as IDeepCloneable<T>).Clone() : field)
			};
		}

		public bool Equals(IExtensionValue other)
		{
			if (this == other)
			{
				return true;
			}
			if (other is ExtensionValue<T> && codec.Equals((other as ExtensionValue<T>).codec))
			{
				return object.Equals(field, (other as ExtensionValue<T>).field);
			}
			return false;
		}

		public override int GetHashCode()
		{
			return (17 * 31 + field.GetHashCode()) * 31 + codec.GetHashCode();
		}

		public void MergeFrom(ref ParseContext ctx)
		{
			codec.ValueMerger(ref ctx, ref field);
		}

		public void MergeFrom(IExtensionValue value)
		{
			if (value is ExtensionValue<T>)
			{
				ExtensionValue<T> extensionValue = value as ExtensionValue<T>;
				codec.FieldMerger(ref field, extensionValue.field);
			}
		}

		public void WriteTo(ref WriteContext ctx)
		{
			ctx.WriteTag(codec.Tag);
			codec.ValueWriter(ref ctx, field);
			if (codec.EndTag != 0)
			{
				ctx.WriteTag(codec.EndTag);
			}
		}

		public T GetValue()
		{
			return field;
		}

		object IExtensionValue.GetValue()
		{
			return field;
		}

		public void SetValue(T value)
		{
			field = value;
		}

		public bool IsInitialized()
		{
			if (field is IMessage)
			{
				return (field as IMessage).IsInitialized();
			}
			return true;
		}
	}
	internal sealed class RepeatedExtensionValue<T> : IExtensionValue, IEquatable<IExtensionValue>, IDeepCloneable<IExtensionValue>
	{
		private RepeatedField<T> field;

		private readonly FieldCodec<T> codec;

		internal RepeatedExtensionValue(FieldCodec<T> codec)
		{
			this.codec = codec;
			field = new RepeatedField<T>();
		}

		public int CalculateSize()
		{
			return field.CalculateSize(codec);
		}

		public IExtensionValue Clone()
		{
			return new RepeatedExtensionValue<T>(codec)
			{
				field = field.Clone()
			};
		}

		public bool Equals(IExtensionValue other)
		{
			if (this == other)
			{
				return true;
			}
			if (other is RepeatedExtensionValue<T> && field.Equals((other as RepeatedExtensionValue<T>).field))
			{
				return codec.Equals((other as RepeatedExtensionValue<T>).codec);
			}
			return false;
		}

		public override int GetHashCode()
		{
			return (17 * 31 + field.GetHashCode()) * 31 + codec.GetHashCode();
		}

		public void MergeFrom(ref ParseContext ctx)
		{
			field.AddEntriesFrom(ref ctx, codec);
		}

		public void MergeFrom(IExtensionValue value)
		{
			if (value is RepeatedExtensionValue<T>)
			{
				field.Add((value as RepeatedExtensionValue<T>).field);
			}
		}

		public void WriteTo(ref WriteContext ctx)
		{
			field.WriteTo(ref ctx, codec);
		}

		public RepeatedField<T> GetValue()
		{
			return field;
		}

		object IExtensionValue.GetValue()
		{
			return field;
		}

		public bool IsInitialized()
		{
			for (int i = 0; i < field.Count; i++)
			{
				T val = field[i];
				if (!(val is IMessage))
				{
					break;
				}
				if (!(val as IMessage).IsInitialized())
				{
					return false;
				}
			}
			return true;
		}
	}
	public static class FieldCodec
	{
		private static class WrapperCodecs
		{
			private static readonly Dictionary<System.Type, object> Codecs = new Dictionary<System.Type, object>
			{
				{
					typeof(bool),
					ForBool(WireFormat.MakeTag(1, WireFormat.WireType.Varint))
				},
				{
					typeof(int),
					ForInt32(WireFormat.MakeTag(1, WireFormat.WireType.Varint))
				},
				{
					typeof(long),
					ForInt64(WireFormat.MakeTag(1, WireFormat.WireType.Varint))
				},
				{
					typeof(uint),
					ForUInt32(WireFormat.MakeTag(1, WireFormat.WireType.Varint))
				},
				{
					typeof(ulong),
					ForUInt64(WireFormat.MakeTag(1, WireFormat.WireType.Varint))
				},
				{
					typeof(float),
					ForFloat(WireFormat.MakeTag(1, WireFormat.WireType.Fixed32))
				},
				{
					typeof(double),
					ForDouble(WireFormat.MakeTag(1, WireFormat.WireType.Fixed64))
				},
				{
					typeof(string),
					ForString(WireFormat.MakeTag(1, WireFormat.WireType.LengthDelimited))
				},
				{
					typeof(ByteString),
					ForBytes(WireFormat.MakeTag(1, WireFormat.WireType.LengthDelimited))
				}
			};

			private static readonly Dictionary<System.Type, object> Readers = new Dictionary<System.Type, object>
			{
				{
					typeof(bool),
					new ValueReader<bool?>(ParsingPrimitivesWrappers.ReadBoolWrapper)
				},
				{
					typeof(int),
					new ValueReader<int?>(ParsingPrimitivesWrappers.ReadInt32Wrapper)
				},
				{
					typeof(long),
					new ValueReader<long?>(ParsingPrimitivesWrappers.ReadInt64Wrapper)
				},
				{
					typeof(uint),
					new ValueReader<uint?>(ParsingPrimitivesWrappers.ReadUInt32Wrapper)
				},
				{
					typeof(ulong),
					new ValueReader<ulong?>(ParsingPrimitivesWrappers.ReadUInt64Wrapper)
				},
				{
					typeof(float),
					BitConverter.IsLittleEndian ? new ValueReader<float?>(ParsingPrimitivesWrappers.ReadFloatWrapperLittleEndian) : new ValueReader<float?>(ParsingPrimitivesWrappers.ReadFloatWrapperSlow)
				},
				{
					typeof(double),
					BitConverter.IsLittleEndian ? new ValueReader<double?>(ParsingPrimitivesWrappers.ReadDoubleWrapperLittleEndian) : new ValueReader<double?>(ParsingPrimitivesWrappers.ReadDoubleWrapperSlow)
				},
				{
					typeof(string),
					null
				},
				{
					typeof(ByteString),
					null
				}
			};

			internal static FieldCodec<T> GetCodec<T>()
			{
				if (!Codecs.TryGetValue(typeof(T), out var value))
				{
					throw new InvalidOperationException("Invalid type argument requested for wrapper codec: " + typeof(T));
				}
				return (FieldCodec<T>)value;
			}

			internal static ValueReader<T?> GetReader<T>() where T : struct
			{
				if (!Readers.TryGetValue(typeof(T), out var value))
				{
					throw new InvalidOperationException("Invalid type argument requested for wrapper reader: " + typeof(T));
				}
				if (value == null)
				{
					FieldCodec<T> nestedCoded = GetCodec<T>();
					return delegate(ref ParseContext ctx)
					{
						return Read(ref ctx, nestedCoded);
					};
				}
				return (ValueReader<T?>)value;
			}

			[SecuritySafeCritical]
			internal static T Read<T>(ref ParseContext ctx, FieldCodec<T> codec)
			{
				int byteLimit = ctx.ReadLength();
				int oldLimit = SegmentedBufferHelper.PushLimit(ref ctx.state, byteLimit);
				T result = codec.DefaultValue;
				uint num;
				while ((num = ctx.ReadTag()) != 0)
				{
					if (num == codec.Tag)
					{
						result = codec.Read(ref ctx);
					}
					else
					{
						ParsingPrimitivesMessages.SkipLastField(ref ctx.buffer, ref ctx.state);
					}
				}
				ParsingPrimitivesMessages.CheckReadEndOfStreamTag(ref ctx.state);
				SegmentedBufferHelper.PopLimit(ref ctx.state, oldLimit);
				return result;
			}

			internal static void Write<T>(ref WriteContext ctx, T value, FieldCodec<T> codec)
			{
				ctx.WriteLength(codec.CalculateSizeWithTag(value));
				codec.WriteTagAndValue(ref ctx, value);
			}

			internal static int CalculateSize<T>(T value, FieldCodec<T> codec)
			{
				int num = codec.CalculateSizeWithTag(value);
				return CodedOutputStream.ComputeLengthSize(num) + num;
			}
		}

		public static FieldCodec<string> ForString(uint tag)
		{
			return ForString(tag, "");
		}

		public static FieldCodec<ByteString> ForBytes(uint tag)
		{
			return ForBytes(tag, ByteString.Empty);
		}

		public static FieldCodec<bool> ForBool(uint tag)
		{
			return ForBool(tag, defaultValue: false);
		}

		public static FieldCodec<int> ForInt32(uint tag)
		{
			return ForInt32(tag, 0);
		}

		public static FieldCodec<int> ForSInt32(uint tag)
		{
			return ForSInt32(tag, 0);
		}

		public static FieldCodec<uint> ForFixed32(uint tag)
		{
			return ForFixed32(tag, 0u);
		}

		public static FieldCodec<int> ForSFixed32(uint tag)
		{
			return ForSFixed32(tag, 0);
		}

		public static FieldCodec<uint> ForUInt32(uint tag)
		{
			return ForUInt32(tag, 0u);
		}

		public static FieldCodec<long> ForInt64(uint tag)
		{
			return ForInt64(tag, 0L);
		}

		public static FieldCodec<long> ForSInt64(uint tag)
		{
			return ForSInt64(tag, 0L);
		}

		public static FieldCodec<ulong> ForFixed64(uint tag)
		{
			return ForFixed64(tag, 0uL);
		}

		public static FieldCodec<long> ForSFixed64(uint tag)
		{
			return ForSFixed64(tag, 0L);
		}

		public static FieldCodec<ulong> ForUInt64(uint tag)
		{
			return ForUInt64(tag, 0uL);
		}

		public static FieldCodec<float> ForFloat(uint tag)
		{
			return ForFloat(tag, 0f);
		}

		public static FieldCodec<double> ForDouble(uint tag)
		{
			return ForDouble(tag, 0.0);
		}

		public static FieldCodec<T> ForEnum<T>(uint tag, Func<T, int> toInt32, Func<int, T> fromInt32)
		{
			return ForEnum(tag, toInt32, fromInt32, default(T));
		}

		public static FieldCodec<string> ForString(uint tag, string defaultValue)
		{
			return new FieldCodec<string>(delegate(ref ParseContext ctx)
			{
				return ctx.ReadString();
			}, delegate(ref WriteContext ctx, string value)
			{
				ctx.WriteString(value);
			}, CodedOutputStream.ComputeStringSize, tag, defaultValue);
		}

		public static FieldCodec<ByteString> ForBytes(uint tag, ByteString defaultValue)
		{
			return new FieldCodec<ByteString>(delegate(ref ParseContext ctx)
			{
				return ctx.ReadBytes();
			}, delegate(ref WriteContext ctx, ByteString value)
			{
				ctx.WriteBytes(value);
			}, CodedOutputStream.ComputeBytesSize, tag, defaultValue);
		}

		public static FieldCodec<bool> ForBool(uint tag, bool defaultValue)
		{
			return new FieldCodec<bool>(delegate(ref ParseContext ctx)
			{
				return ctx.ReadBool();
			}, delegate(ref WriteContext ctx, bool value)
			{
				ctx.WriteBool(value);
			}, 1, tag, defaultValue);
		}

		public static FieldCodec<int> ForInt32(uint tag, int defaultValue)
		{
			return new FieldCodec<int>(delegate(ref ParseContext ctx)
			{
				return ctx.ReadInt32();
			}, delegate(ref WriteContext output, int value)
			{
				output.WriteInt32(value);
			}, CodedOutputStream.ComputeInt32Size, tag, defaultValue);
		}

		public static FieldCodec<int> ForSInt32(uint tag, int defaultValue)
		{
			return new FieldCodec<int>(delegate(ref ParseContext ctx)
			{
				return ctx.ReadSInt32();
			}, delegate(ref WriteContext output, int value)
			{
				output.WriteSInt32(value);
			}, CodedOutputStream.ComputeSInt32Size, tag, defaultValue);
		}

		public static FieldCodec<uint> ForFixed32(uint tag, uint defaultValue)
		{
			return new FieldCodec<uint>(delegate(ref ParseContext ctx)
			{
				return ctx.ReadFixed32();
			}, delegate(ref WriteContext output, uint value)
			{
				output.WriteFixed32(value);
			}, 4, tag, defaultValue);
		}

		public static FieldCodec<int> ForSFixed32(uint tag, int defaultValue)
		{
			return new FieldCodec<int>(delegate(ref ParseContext ctx)
			{
				return ctx.ReadSFixed32();
			}, delegate(ref WriteContext output, int value)
			{
				output.WriteSFixed32(value);
			}, 4, tag, defaultValue);
		}

		public static FieldCodec<uint> ForUInt32(uint tag, uint defaultValue)
		{
			return new FieldCodec<uint>(delegate(ref ParseContext ctx)
			{
				return ctx.ReadUInt32();
			}, delegate(ref WriteContext output, uint value)
			{
				output.WriteUInt32(value);
			}, CodedOutputStream.ComputeUInt32Size, tag, defaultValue);
		}

		public static FieldCodec<long> ForInt64(uint tag, long defaultValue)
		{
			return new FieldCodec<long>(delegate(ref ParseContext ctx)
			{
				return ctx.ReadInt64();
			}, delegate(ref WriteContext output, long value)
			{
				output.WriteInt64(value);
			}, CodedOutputStream.ComputeInt64Size, tag, defaultValue);
		}

		public static FieldCodec<long> ForSInt64(uint tag, long defaultValue)
		{
			return new FieldCodec<long>(delegate(ref ParseContext ctx)
			{
				return ctx.ReadSInt64();
			}, delegate(ref WriteContext output, long value)
			{
				output.WriteSInt64(value);
			}, CodedOutputStream.ComputeSInt64Size, tag, defaultValue);
		}

		public static FieldCodec<ulong> ForFixed64(uint tag, ulong defaultValue)
		{
			return new FieldCodec<ulong>(delegate(ref ParseContext ctx)
			{
				return ctx.ReadFixed64();
			}, delegate(ref WriteContext output, ulong value)
			{
				output.WriteFixed64(value);
			}, 8, tag, defaultValue);
		}

		public static FieldCodec<long> ForSFixed64(uint tag, long defaultValue)
		{
			return new FieldCodec<long>(delegate(ref ParseContext ctx)
			{
				return ctx.ReadSFixed64();
			}, delegate(ref WriteContext output, long value)
			{
				output.WriteSFixed64(value);
			}, 8, tag, defaultValue);
		}

		public static FieldCodec<ulong> ForUInt64(uint tag, ulong defaultValue)
		{
			return new FieldCodec<ulong>(delegate(ref ParseContext ctx)
			{
				return ctx.ReadUInt64();
			}, delegate(ref WriteContext output, ulong value)
			{
				output.WriteUInt64(value);
			}, CodedOutputStream.ComputeUInt64Size, tag, defaultValue);
		}

		public static FieldCodec<float> ForFloat(uint tag, float defaultValue)
		{
			return new FieldCodec<float>(delegate(ref ParseContext ctx)
			{
				return ctx.ReadFloat();
			}, delegate(ref WriteContext output, float value)
			{
				output.WriteFloat(value);
			}, 4, tag, defaultValue);
		}

		public static FieldCodec<double> ForDouble(uint tag, double defaultValue)
		{
			return new FieldCodec<double>(delegate(ref ParseContext ctx)
			{
				return ctx.ReadDouble();
			}, delegate(ref WriteContext output, double value)
			{
				output.WriteDouble(value);
			}, 8, tag, defaultValue);
		}

		public static FieldCodec<T> ForEnum<T>(uint tag, Func<T, int> toInt32, Func<int, T> fromInt32, T defaultValue)
		{
			return new FieldCodec<T>(delegate(ref ParseContext ctx)
			{
				return fromInt32(ctx.ReadEnum());
			}, delegate(ref WriteContext output, T value)
			{
				output.WriteEnum(toInt32(value));
			}, (T value) => CodedOutputStream.ComputeEnumSize(toInt32(value)), tag, defaultValue);
		}

		public static FieldCodec<T> ForMessage<T>(uint tag, MessageParser<T> parser) where T : class, IMessage<T>
		{
			return new FieldCodec<T>(delegate(ref ParseContext ctx)
			{
				T val = parser.CreateTemplate();
				ctx.ReadMessage(val);
				return val;
			}, delegate(ref WriteContext output, T value)
			{
				output.WriteMessage(value);
			}, delegate(ref ParseContext ctx, ref T v)
			{
				if (v == null)
				{
					v = parser.CreateTemplate();
				}
				ctx.ReadMessage(v);
			}, delegate(ref T v, T v2)
			{
				if (v2 == null)
				{
					return false;
				}
				if (v == null)
				{
					v = v2.Clone();
				}
				else
				{
					v.MergeFrom(v2);
				}
				return true;
			}, (T message) => CodedOutputStream.ComputeMessageSize(message), tag);
		}

		public static FieldCodec<T> ForGroup<T>(uint startTag, uint endTag, MessageParser<T> parser) where T : class, IMessage<T>
		{
			return new FieldCodec<T>(delegate(ref ParseContext ctx)
			{
				T val = parser.CreateTemplate();
				ctx.ReadGroup(val);
				return val;
			}, delegate(ref WriteContext output, T value)
			{
				output.WriteGroup(value);
			}, delegate(ref ParseContext ctx, ref T v)
			{
				if (v == null)
				{
					v = parser.CreateTemplate();
				}
				ctx.ReadGroup(v);
			}, delegate(ref T v, T v2)
			{
				if (v2 == null)
				{
					return v == null;
				}
				if (v == null)
				{
					v = v2.Clone();
				}
				else
				{
					v.MergeFrom(v2);
				}
				return true;
			}, (T message) => CodedOutputStream.ComputeGroupSize(message), startTag, endTag);
		}

		public static FieldCodec<T> ForClassWrapper<T>(uint tag) where T : class
		{
			FieldCodec<T> nestedCodec = WrapperCodecs.GetCodec<T>();
			return new FieldCodec<T>(delegate(ref ParseContext ctx)
			{
				return WrapperCodecs.Read(ref ctx, nestedCodec);
			}, delegate(ref WriteContext output, T value)
			{
				WrapperCodecs.Write(ref output, value, nestedCodec);
			}, delegate(ref ParseContext ctx, ref T v)
			{
				v = WrapperCodecs.Read(ref ctx, nestedCodec);
			}, delegate(ref T v, T v2)
			{
				v = v2;
				return v == null;
			}, (T value) => WrapperCodecs.CalculateSize(value, nestedCodec), tag, 0u, null);
		}

		public static FieldCodec<T?> ForStructWrapper<T>(uint tag) where T : struct
		{
			FieldCodec<T> nestedCodec = WrapperCodecs.GetCodec<T>();
			return new FieldCodec<T?>(WrapperCodecs.GetReader<T>(), delegate(ref WriteContext output, T? value)
			{
				WrapperCodecs.Write(ref output, value.Value, nestedCodec);
			}, delegate(ref ParseContext ctx, ref T? v)
			{
				v = WrapperCodecs.Read(ref ctx, nestedCodec);
			}, delegate(ref T? v, T? v2)
			{
				if (v2.HasValue)
				{
					v = v2;
				}
				return v.HasValue;
			}, (T? value) => value.HasValue ? WrapperCodecs.CalculateSize(value.Value, nestedCodec) : 0, tag, 0u, null);
		}
	}
	internal delegate TValue ValueReader<out TValue>(ref ParseContext ctx);
	internal delegate void ValueWriter<T>(ref WriteContext ctx, T value);
	public sealed class FieldCodec<T>
	{
		internal delegate void InputMerger(ref ParseContext ctx, ref T value);

		internal delegate bool ValuesMerger(ref T value, T other);

		private static readonly EqualityComparer<T> EqualityComparer;

		private static readonly T DefaultDefault;

		private static readonly bool TypeSupportsPacking;

		private readonly int tagSize;

		internal bool PackedRepeatedField { get; }

		internal ValueWriter<T> ValueWriter { get; }

		internal Func<T, int> ValueSizeCalculator { get; }

		internal ValueReader<T> ValueReader { get; }

		internal InputMerger ValueMerger { get; }

		internal ValuesMerger FieldMerger { get; }

		internal int FixedSize { get; }

		internal uint Tag { get; }

		internal uint EndTag { get; }

		internal T DefaultValue { get; }

		static FieldCodec()
		{
			EqualityComparer = ProtobufEqualityComparers.GetEqualityComparer<T>();
			TypeSupportsPacking = default(T) != null;
			if (typeof(T) == typeof(string))
			{
				DefaultDefault = (T)(object)"";
			}
			else if (typeof(T) == typeof(ByteString))
			{
				DefaultDefault = (T)(object)ByteString.Empty;
			}
		}

		internal static bool IsPackedRepeatedField(uint tag)
		{
			if (TypeSupportsPacking)
			{
				return WireFormat.GetTagWireType(tag) == WireFormat.WireType.LengthDelimited;
			}
			return false;
		}

		internal FieldCodec(ValueReader<T> reader, ValueWriter<T> writer, int fixedSize, uint tag, T defaultValue)
			: this(reader, writer, (Func<T, int>)((T _) => fixedSize), tag, defaultValue)
		{
			FixedSize = fixedSize;
		}

		internal FieldCodec(ValueReader<T> reader, ValueWriter<T> writer, Func<T, int> sizeCalculator, uint tag, T defaultValue)
			: this(reader, writer, (InputMerger)delegate(ref ParseContext ctx, ref T v)
			{
				v = reader(ref ctx);
			}, (ValuesMerger)delegate(ref T v, T v2)
			{
				v = v2;
				return true;
			}, sizeCalculator, tag, 0u, defaultValue)
		{
		}

		internal FieldCodec(ValueReader<T> reader, ValueWriter<T> writer, InputMerger inputMerger, ValuesMerger valuesMerger, Func<T, int> sizeCalculator, uint tag, uint endTag = 0u)
			: this(reader, writer, inputMerger, valuesMerger, sizeCalculator, tag, endTag, DefaultDefault)
		{
		}

		internal FieldCodec(ValueReader<T> reader, ValueWriter<T> writer, InputMerger inputMerger, ValuesMerger valuesMerger, Func<T, int> sizeCalculator, uint tag, uint endTag, T defaultValue)
		{
			ValueReader = reader;
			ValueWriter = writer;
			ValueMerger = inputMerger;
			FieldMerger = valuesMerger;
			ValueSizeCalculator = sizeCalculator;
			FixedSize = 0;
			Tag = tag;
			EndTag = endTag;
			DefaultValue = defaultValue;
			tagSize = CodedOutputStream.ComputeRawVarint32Size(tag);
			if (endTag != 0)
			{
				tagSize += CodedOutputStream.ComputeRawVarint32Size(endTag);
			}
			PackedRepeatedField = IsPackedRepeatedField(tag);
		}

		public void WriteTagAndValue(CodedOutputStream output, T value)
		{
			WriteContext.Initialize(output, out var ctx);
			try
			{
				WriteTagAndValue(ref ctx, value);
			}
			finally
			{
				ctx.CopyStateTo(output);
			}
		}

		public void WriteTagAndValue(ref WriteContext ctx, T value)
		{
			if (!IsDefault(value))
			{
				ctx.WriteTag(Tag);
				ValueWriter(ref ctx, value);
				if (EndTag != 0)
				{
					ctx.WriteTag(EndTag);
				}
			}
		}

		public T Read(CodedInputStream input)
		{
			ParseContext.Initialize(input, out var ctx);
			try
			{
				return ValueReader(ref ctx);
			}
			finally
			{
				ctx.CopyStateTo(input);
			}
		}

		public T Read(ref ParseContext ctx)
		{
			return ValueReader(ref ctx);
		}

		public int CalculateSizeWithTag(T value)
		{
			if (!IsDefault(value))
			{
				return ValueSizeCalculator(value) + tagSize;
			}
			return 0;
		}

		internal int CalculateUnconditionalSizeWithTag(T value)
		{
			return ValueSizeCalculator(value) + tagSize;
		}

		private bool IsDefault(T value)
		{
			return EqualityComparer.Equals(value, DefaultValue);
		}
	}
	internal sealed class FieldMaskTree
	{
		internal sealed class Node
		{
			public Dictionary<string, Node> Children { get; } = new Dictionary<string, Node>();

		}

		private const char FIELD_PATH_SEPARATOR = '.';

		private readonly Node root = new Node();

		public FieldMaskTree()
		{
		}

		public FieldMaskTree(FieldMask mask)
		{
			MergeFromFieldMask(mask);
		}

		public override string ToString()
		{
			return ToFieldMask().ToString();
		}

		public FieldMaskTree AddFieldPath(string path)
		{
			string[] array = path.Split(new char[1] { '.' });
			if (array.Length == 0)
			{
				return this;
			}
			Node node = root;
			bool flag = false;
			string[] array2 = array;
			foreach (string key in array2)
			{
				if (!flag && node != root && node.Children.Count == 0)
				{
					return this;
				}
				if (!node.Children.TryGetValue(key, out var value))
				{
					flag = true;
					value = new Node();
					node.Children.Add(key, value);
				}
				node = value;
			}
			node.Children.Clear();
			return this;
		}

		public FieldMaskTree MergeFromFieldMask(FieldMask mask)
		{
			foreach (string path in mask.Paths)
			{
				AddFieldPath(path);
			}
			return this;
		}

		public FieldMask ToFieldMask()
		{
			FieldMask fieldMask = new FieldMask();
			if (root.Children.Count != 0)
			{
				List<string> list = new List<string>();
				GetFieldPaths(root, "", list);
				fieldMask.Paths.AddRange(list);
			}
			return fieldMask;
		}

		private void GetFieldPaths(Node node, string path, List<string> paths)
		{
			if (node.Children.Count == 0)
			{
				paths.Add(path);
				return;
			}
			foreach (KeyValuePair<string, Node> child in node.Children)
			{
				string path2 = ((path.Length == 0) ? child.Key : (path + "." + child.Key));
				GetFieldPaths(child.Value, path2, paths);
			}
		}

		public void IntersectFieldPath(string path, FieldMaskTree output)
		{
			if (root.Children.Count == 0)
			{
				return;
			}
			string[] array = path.Split(new char[1] { '.' });
			if (array.Length == 0)
			{
				return;
			}
			Node value = root;
			string[] array2 = array;
			foreach (string key in array2)
			{
				if (value != root && value.Children.Count == 0)
				{
					output.AddFieldPath(path);
					return;
				}
				if (!value.Children.TryGetValue(key, out value))
				{
					return;
				}
			}
			List<string> list = new List<string>();
			GetFieldPaths(value, path, list);
			foreach (string item in list)
			{
				output.AddFieldPath(item);
			}
		}

		public void Merge(IMessage source, IMessage destination, FieldMask.MergeOptions options)
		{
			if (source.Descriptor != destination.Descriptor)
			{
				throw new InvalidProtocolBufferException("Cannot merge messages of different types.");
			}
			if (root.Children.Count != 0)
			{
				Merge(root, "", source, destination, options);
			}
		}

		private void Merge(Node node, string path, IMessage source, IMessage destination, FieldMask.MergeOptions options)
		{
			if (source.Descriptor != destination.Descriptor)
			{
				throw new InvalidProtocolBufferException($"source ({source.Descriptor}) and destination ({destination.Descriptor}) descriptor must be equal");
			}
			MessageDescriptor descriptor = source.Descriptor;
			foreach (KeyValuePair<string, Node> child in node.Children)
			{
				FieldDescriptor fieldDescriptor = descriptor.FindFieldByName(child.Key);
				if (fieldDescriptor == null)
				{
					continue;
				}
				if (child.Value.Children.Count != 0)
				{
					if (fieldDescriptor.IsRepeated || fieldDescriptor.FieldType != FieldType.Message)
					{
						continue;
					}
					object value = fieldDescriptor.Accessor.GetValue(source);
					object obj = fieldDescriptor.Accessor.GetValue(destination);
					if (value != null || obj != null)
					{
						if (obj == null)
						{
							obj = fieldDescriptor.MessageType.Parser.CreateTemplate();
							fieldDescriptor.Accessor.SetValue(destination, obj);
						}
						string path2 = ((path.Length == 0) ? child.Key : (path + "." + child.Key));
						Merge(child.Value, path2, (IMessage)value, (IMessage)obj, options);
					}
					continue;
				}
				if (fieldDescriptor.IsRepeated)
				{
					if (options.ReplaceRepeatedFields)
					{
						fieldDescriptor.Accessor.Clear(destination);
					}
					IList obj2 = (IList)fieldDescriptor.Accessor.GetValue(source);
					IList list = (IList)fieldDescriptor.Accessor.GetValue(destination);
					foreach (object item in obj2)
					{
						list.Add(item);
					}
					continue;
				}
				object value2 = fieldDescriptor.Accessor.GetValue(source);
				if (fieldDescriptor.FieldType == FieldType.Message)
				{
					if (options.ReplaceMessageFields)
					{
						if (value2 == null)
						{
							fieldDescriptor.Accessor.Clear(destination);
						}
						else
						{
							fieldDescriptor.Accessor.SetValue(destination, value2);
						}
					}
					else
					{
						if (value2 == null)
						{
							continue;
						}
						if (fieldDescriptor.MessageType.IsWrapperType)
						{
							fieldDescriptor.Accessor.SetValue(destination, value2);
							continue;
						}
						ByteString data = ((IMessage)value2).ToByteString();
						IMessage message = (IMessage)fieldDescriptor.Accessor.GetValue(destination);
						if (message != null)
						{
							message.MergeFrom(data);
						}
						else
						{
							fieldDescriptor.Accessor.SetValue(destination, fieldDescriptor.MessageType.Parser.ParseFrom(data));
						}
					}
				}
				else if (value2 != null || !options.ReplacePrimitiveFields)
				{
					fieldDescriptor.Accessor.SetValue(destination, value2);
				}
				else
				{
					fieldDescriptor.Accessor.Clear(destination);
				}
			}
		}
	}
	internal static class FrameworkPortability
	{
		internal static readonly RegexOptions CompiledRegexWhereAvailable = (System.Enum.IsDefined(typeof(RegexOptions), 8) ? RegexOptions.Compiled : RegexOptions.None);
	}
	public interface IBufferMessage : IMessage
	{
		void InternalMergeFrom(ref ParseContext ctx);

		void InternalWriteTo(ref WriteContext ctx);
	}
	public interface ICustomDiagnosticMessage : IMessage
	{
		string ToDiagnosticString();
	}
	public interface IDeepCloneable<T>
	{
		T Clone();
	}
	public interface IExtendableMessage<T> : IMessage<T>, IMessage, IEquatable<T>, IDeepCloneable<T> where T : IExtendableMessage<T>
	{
		TValue GetExtension<TValue>(Extension<T, TValue> extension);

		RepeatedField<TValue> GetExtension<TValue>(RepeatedExtension<T, TValue> extension);

		RepeatedField<TValue> GetOrInitializeExtension<TValue>(RepeatedExtension<T, TValue> extension);

		void SetExtension<TValue>(Extension<T, TValue> extension, TValue value);

		bool HasExtension<TValue>(Extension<T, TValue> extension);

		void ClearExtension<TValue>(Extension<T, TValue> extension);

		void ClearExtension<TValue>(RepeatedExtension<T, TValue> extension);
	}
	public interface IMessage
	{
		MessageDescriptor Descriptor { get; }

		void MergeFrom(CodedInputStream input);

		void WriteTo(CodedOutputStream output);

		int CalculateSize();
	}
	public interface IMessage<T> : IMessage, IEquatable<T>, IDeepCloneable<T> where T : IMessage<T>
	{
		void MergeFrom(T message);
	}
	public sealed class InvalidJsonException : IOException
	{
		internal InvalidJsonException(string message)
			: base(message)
		{
		}
	}
	public sealed class InvalidProtocolBufferException : IOException
	{
		internal InvalidProtocolBufferException(string message)
			: base(message)
		{
		}

		internal InvalidProtocolBufferException(string message, Exception innerException)
			: base(message, innerException)
		{
		}

		internal static InvalidProtocolBufferException MoreDataAvailable()
		{
			return new InvalidProtocolBufferException("Completed reading a message while more data was available in the stream.");
		}

		internal static InvalidProtocolBufferException TruncatedMessage()
		{
			return new InvalidProtocolBufferException("While parsing a protocol message, the input ended unexpectedly in the middle of a field.  This could mean either that the input has been truncated or that an embedded message misreported its own length.");
		}

		internal static InvalidProtocolBufferException NegativeSize()
		{
			return new InvalidProtocolBufferException("CodedInputStream encountered an embedded string or message which claimed to have negative size.");
		}

		internal static InvalidProtocolBufferException MalformedVarint()
		{
			return new InvalidProtocolBufferException("CodedInputStream encountered a malformed varint.");
		}

		internal static InvalidProtocolBufferException InvalidTag()
		{
			return new InvalidProtocolBufferException("Protocol message contained an invalid tag (zero).");
		}

		internal static InvalidProtocolBufferException InvalidWireType()
		{
			return new InvalidProtocolBufferException("Protocol message contained a tag with an invalid wire type.");
		}

		internal static InvalidProtocolBufferException InvalidBase64(Exception innerException)
		{
			return new InvalidProtocolBufferException("Invalid base64 data", innerException);
		}

		internal static InvalidProtocolBufferException InvalidEndTag()
		{
			return new InvalidProtocolBufferException("Protocol message end-group tag did not match expected tag.");
		}

		internal static InvalidProtocolBufferException RecursionLimitExceeded()
		{
			return new InvalidProtocolBufferException("Protocol message had too many levels of nesting.  May be malicious.  Use CodedInputStream.SetRecursionLimit() to increase the depth limit.");
		}

		internal static InvalidProtocolBufferException JsonRecursionLimitExceeded()
		{
			return new InvalidProtocolBufferException("Protocol message had too many levels of nesting.  May be malicious.  Use JsonParser.Settings to increase the depth limit.");
		}

		internal static InvalidProtocolBufferException SizeLimitExceeded()
		{
			return new InvalidProtocolBufferException("Protocol message was too large.  May be malicious.  Use CodedInputStream.SetSizeLimit() to increase the size limit.");
		}

		internal static InvalidProtocolBufferException InvalidMessageStreamTag()
		{
			return new InvalidProtocolBufferException("Stream of protocol messages had invalid tag. Expected tag is length-delimited field 1.");
		}

		internal static InvalidProtocolBufferException MissingFields()
		{
			return new InvalidProtocolBufferException("Message was missing required fields");
		}
	}
	public sealed class JsonFormatter
	{
		public sealed class Settings
		{
			public static Settings Default { get; }

			public bool FormatDefaultValues { get; }

			public TypeRegistry TypeRegistry { get; }

			public bool FormatEnumsAsIntegers { get; }

			public bool PreserveProtoFieldNames { get; }

			public string Indentation { get; }

			static Settings()
			{
				Default = new Settings(formatDefaultValues: false);
			}

			public Settings(bool formatDefaultValues)
				: this(formatDefaultValues, TypeRegistry.Empty)
			{
			}

			public Settings(bool formatDefaultValues, TypeRegistry typeRegistry)
				: this(formatDefaultValues, typeRegistry, formatEnumsAsIntegers: false, preserveProtoFieldNames: false)
			{
			}

			private Settings(bool formatDefaultValues, TypeRegistry typeRegistry, bool formatEnumsAsIntegers, bool preserveProtoFieldNames, string indentation = null)
			{
				FormatDefaultValues = formatDefaultValues;
				TypeRegistry = typeRegistry ?? TypeRegistry.Empty;
				FormatEnumsAsIntegers = formatEnumsAsIntegers;
				PreserveProtoFieldNames = preserveProtoFieldNames;
				Indentation = indentation;
			}

			public Settings WithFormatDefaultValues(bool formatDefaultValues)
			{
				return new Settings(formatDefaultValues, TypeRegistry, FormatEnumsAsIntegers, PreserveProtoFieldNames, Indentation);
			}

			public Settings WithTypeRegistry(TypeRegistry typeRegistry)
			{
				return new Settings(FormatDefaultValues, typeRegistry, FormatEnumsAsIntegers, PreserveProtoFieldNames, Indentation);
			}

			public Settings WithFormatEnumsAsIntegers(bool formatEnumsAsIntegers)
			{
				return new Settings(FormatDefaultValues, TypeRegistry, formatEnumsAsIntegers, PreserveProtoFieldNames, Indentation);
			}

			public Settings WithPreserveProtoFieldNames(bool preserveProtoFieldNames)
			{
				return new Settings(FormatDefaultValues, TypeRegistry, FormatEnumsAsIntegers, preserveProtoFieldNames, Indentation);
			}

			public Settings WithIndentation(string indentation = "  ")
			{
				return new Settings(FormatDefaultValues, TypeRegistry, FormatEnumsAsIntegers, PreserveProtoFieldNames, indentation);
			}
		}

		private static class OriginalEnumValueHelper
		{
			private static readonly ConcurrentDictionary<System.Type, Dictionary<object, string>> dictionaries = new ConcurrentDictionary<System.Type, Dictionary<object, string>>();

			[UnconditionalSuppressMessage("Trimming", "IL2072", Justification = "The field for the value must still be present. It will be returned by reflection, will be in this collection, and its name can be resolved.")]
			internal static string GetOriginalName(object value)
			{
				dictionaries.GetOrAdd(value.GetType(), (System.Type t) => GetNameMapping(t)).TryGetValue(value, out var value2);
				return value2;
			}

			private static Dictionary<object, string> GetNameMapping([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields)] System.Type enumType)
			{
				return (from f in enumType.GetTypeInfo().DeclaredFields
					where f.IsStatic
					where f.GetCustomAttributes<OriginalNameAttribute>().FirstOrDefault()?.PreferredAlias ?? true
					select f).ToDictionary((FieldInfo f) => f.GetValue(null), (FieldInfo f) => f.GetCustomAttributes<OriginalNameAttribute>().FirstOrDefault()?.Name ?? f.Name);
			}
		}

		internal const string AnyTypeUrlField = "@type";

		internal const string AnyDiagnosticValueField = "@value";

		internal const string AnyWellKnownTypeValueField = "value";

		private const string NameValueSeparator = ": ";

		private const string ValueSeparator = ", ";

		private const string MultilineValueSeparator = ",";

		private const char ObjectOpenBracket = '{';

		private const char ObjectCloseBracket = '}';

		private const char ListBracketOpen = '[';

		private const char ListBracketClose = ']';

		private static readonly JsonFormatter diagnosticFormatter;

		private static readonly string[] CommonRepresentations;

		private readonly Settings settings;

		private const string Hex = "0123456789abcdef";

		public static JsonFormatter Default { get; }

		private bool DiagnosticOnly => this == diagnosticFormatter;

		static JsonFormatter()
		{
			Default = new JsonFormatter(Settings.Default);
			diagnosticFormatter = new JsonFormatter(Settings.Default);
			CommonRepresentations = new string[160]
			{
				"\\u0000", "\\u0001", "\\u0002", "\\u0003", "\\u0004", "\\u0005", "\\u0006", "\\u0007", "\\b", "\\t",
				"\\n", "\\u000b", "\\f", "\\r", "\\u000e", "\\u000f", "\\u0010", "\\u0011", "\\u0012", "\\u0013",
				"\\u0014", "\\u0015", "\\u0016", "\\u0017", "\\u0018", "\\u0019", "\\u001a", "\\u001b", "\\u001c", "\\u001d",
				"\\u001e", "\\u001f", "", "", "\\\"", "", "", "", "", "",
				"", "", "", "", "", "", "", "", "", "",
				"", "", "", "", "", "", "", "", "", "",
				"\\u003c", "", "\\u003e", "", "", "", "", "", "", "",
				"", "", "", "", "", "", "", "", "", "",
				"", "", "", "", "", "", "", "", "", "",
				"", "", "\\\\", "", "", "", "", "", "", "",
				"", "", "", "", "", "", "", "", "", "",
				"", "", "", "", "", "", "", "", "", "",
				"", "", "", "", "", "", "", "\\u007f", "\\u0080", "\\u0081",
				"\\u0082", "\\u0083", "\\u0084", "\\u0085", "\\u0086", "\\u0087", "\\u0088", "\\u0089", "\\u008a", "\\u008b",
				"\\u008c", "\\u008d", "\\u008e", "\\u008f", "\\u0090", "\\u0091", "\\u0092", "\\u0093", "\\u0094", "\\u0095",
				"\\u0096", "\\u0097", "\\u0098", "\\u0099", "\\u009a", "\\u009b", "\\u009c", "\\u009d", "\\u009e", "\\u009f"
			};
			for (int i = 0; i < CommonRepresentations.Length; i++)
			{
				if (CommonRepresentations[i] == "")
				{
					CommonRepresentations[i] = ((char)i).ToString();
				}
			}
		}

		public JsonFormatter(Settings settings)
		{
			this.settings = ProtoPreconditions.CheckNotNull(settings, "settings");
		}

		public string Format(IMessage message)
		{
			return Format(message, 0);
		}

		public string Format(IMessage message, int indentationLevel)
		{
			StringWriter stringWriter = new StringWriter();
			Format(message, stringWriter, indentationLevel);
			return stringWriter.ToString();
		}

		public void Format(IMessage message, TextWriter writer)
		{
			Format(message, writer, 0);
		}

		public void Format(IMessage message, TextWriter writer, int indentationLevel)
		{
			ProtoPreconditions.CheckNotNull(message, "message");
			ProtoPreconditions.CheckNotNull(writer, "writer");
			if (message.Descriptor.IsWellKnownType)
			{
				WriteWellKnownTypeValue(writer, message.Descriptor, message, indentationLevel);
			}
			else
			{
				WriteMessage(writer, message, indentationLevel);
			}
		}

		public static string ToDiagnosticString(IMessage message)
		{
			ProtoPreconditions.CheckNotNull(message, "message");
			return diagnosticFormatter.Format(message);
		}

		private void WriteMessage(TextWriter writer, IMessage message, int indentationLevel)
		{
			if (message == null)
			{
				WriteNull(writer);
				return;
			}
			if (DiagnosticOnly && message is ICustomDiagnosticMessage customDiagnosticMessage)
			{
				writer.Write(customDiagnosticMessage.ToDiagnosticString());
				return;
			}
			WriteBracketOpen(writer, '{');
			bool hasFields = WriteMessageFields(writer, message, assumeFirstFieldWritten: false, indentationLevel + 1);
			WriteBracketClose(writer, '}', hasFields, indentationLevel);
		}

		private bool WriteMessageFields(TextWriter writer, IMessage message, bool assumeFirstFieldWritten, int indentationLevel)
		{
			MessageDescriptor.FieldCollection fields = message.Descriptor.Fields;
			bool flag = !assumeFirstFieldWritten;
			foreach (FieldDescriptor item in fields.InFieldNumberOrder())
			{
				IFieldAccessor accessor = item.Accessor;
				object value = accessor.GetValue(message);
				if (ShouldFormatFieldValue(message, item, value))
				{
					MaybeWriteValueSeparator(writer, flag);
					MaybeWriteValueWhitespace(writer, indentationLevel);
					if (settings.PreserveProtoFieldNames)
					{
						WriteString(writer, accessor.Descriptor.Name);
					}
					else
					{
						WriteString(writer, accessor.Descriptor.JsonName);
					}
					writer.Write(": ");
					WriteValue(writer, value, indentationLevel);
					flag = false;
				}
			}
			return !flag;
		}

		private void MaybeWriteValueSeparator(TextWriter writer, bool first)
		{
			if (!first)
			{
				writer.Write((settings.Indentation == null) ? ", " : ",");
			}
		}

		private bool ShouldFormatFieldValue(IMessage message, FieldDescriptor field, object value)
		{
			if (!field.HasPresence)
			{
				if (!settings.FormatDefaultValues)
				{
					return !IsDefaultValue(field, value);
				}
				return true;
			}
			return field.Accessor.HasValue(message);
		}

		internal static string ToJsonName(string name)
		{
			StringBuilder stringBuilder = new StringBuilder(name.Length);
			bool flag = false;
			foreach (char c in name)
			{
				if (c == '_')
				{
					flag = true;
				}
				else if (flag)
				{
					stringBuilder.Append(char.ToUpperInvariant(c));
					flag = false;
				}
				else
				{
					stringBuilder.Append(c);
				}
			}
			return stringBuilder.ToString();
		}

		internal static string FromJsonName(string name)
		{
			StringBuilder stringBuilder = new StringBuilder(name.Length);
			foreach (char c in name)
			{
				if (char.IsUpper(c))
				{
					stringBuilder.Append('_');
					stringBuilder.Append(char.ToLowerInvariant(c));
				}
				else
				{
					stringBuilder.Append(c);
				}
			}
			return stringBuilder.ToString();
		}

		private static void WriteNull(TextWriter writer)
		{
			writer.Write("null");
		}

		private static bool IsDefaultValue(FieldDescriptor descriptor, object value)
		{
			if (descriptor.IsMap)
			{
				return ((IDictionary)value).Count == 0;
			}
			if (descriptor.IsRepeated)
			{
				return ((IList)value).Count == 0;
			}
			switch (descriptor.FieldType)
			{
			case FieldType.Bool:
				return !(bool)value;
			case FieldType.Bytes:
				return (ByteString)value == ByteString.Empty;
			case FieldType.String:
				return (string)value == "";
			case FieldType.Double:
				return (double)value == 0.0;
			case FieldType.Int32:
			case FieldType.SFixed32:
			case FieldType.SInt32:
			case FieldType.Enum:
				return (int)value == 0;
			case FieldType.Fixed32:
			case FieldType.UInt32:
				return (uint)value == 0;
			case FieldType.UInt64:
			case FieldType.Fixed64:
				return (ulong)value == 0;
			case FieldType.Int64:
			case FieldType.SFixed64:
			case FieldType.SInt64:
				return (long)value == 0;
			case FieldType.Float:
				return (float)value == 0f;
			case FieldType.Group:
			case FieldType.Message:
				return value == null;
			default:
				throw new ArgumentException("Invalid field type");
			}
		}

		public void WriteValue(TextWriter writer, object value)
		{
			WriteValue(writer, value, 0);
		}

		public void WriteValue(TextWriter writer, object value, int indentationLevel)
		{
			if (value == null || value is NullValue)
			{
				WriteNull(writer);
			}
			else if (value is bool flag)
			{
				writer.Write(flag ? "true" : "false");
			}
			else if (value is ByteString byteString)
			{
				writer.Write('"');
				writer.Write(byteString.ToBase64());
				writer.Write('"');
			}
			else if (value is string text)
			{
				WriteString(writer, text);
			}
			else if (value is IDictionary dictionary)
			{
				WriteDictionary(writer, dictionary, indentationLevel);
			}
			else if (value is IList list)
			{
				WriteList(writer, list, indentationLevel);
			}
			else if (value is int || value is uint)
			{
				IFormattable formattable = (IFormattable)value;
				writer.Write(formattable.ToString("d", CultureInfo.InvariantCulture));
			}
			else if (value is long || value is ulong)
			{
				writer.Write('"');
				IFormattable formattable2 = (IFormattable)value;
				writer.Write(formattable2.ToString("d", CultureInfo.InvariantCulture));
				writer.Write('"');
			}
			else if (value is System.Enum)
			{
				if (settings.FormatEnumsAsIntegers)
				{
					WriteValue(writer, (int)value);
					return;
				}
				string originalName = OriginalEnumValueHelper.GetOriginalName(value);
				if (originalName != null)
				{
					WriteString(writer, originalName);
				}
				else
				{
					WriteValue(writer, (int)value);
				}
			}
			else if (value is float || value is double)
			{
				string text2 = ((IFormattable)value).ToString("r", CultureInfo.InvariantCulture);
				switch (text2)
				{
				case "NaN":
				case "Infinity":
				case "-Infinity":
					writer.Write('"');
					writer.Write(text2);
					writer.Write('"');
					break;
				default:
					writer.Write(text2);
					break;
				}
			}
			else
			{
				if (!(value is IMessage message))
				{
					throw new ArgumentException("Unable to format value of type " + value.GetType());
				}
				Format(message, writer, indentationLevel);
			}
		}

		private void WriteWellKnownTypeValue(TextWriter writer, MessageDescriptor descriptor, object value, int indentationLevel)
		{
			if (value == null)
			{
				WriteNull(writer);
			}
			else if (descriptor.IsWrapperType)
			{
				if (value is IMessage message)
				{
					value = message.Descriptor.Fields[1].Accessor.GetValue(message);
				}
				WriteValue(writer, value);
			}
			else if (descriptor.FullName == Timestamp.Descriptor.FullName)
			{
				WriteTimestamp(writer, (IMessage)value);
			}
			else if (descriptor.FullName == Duration.Descriptor.FullName)
			{
				WriteDuration(writer, (IMessage)value);
			}
			else if (descriptor.FullName == FieldMask.Descriptor.FullName)
			{
				WriteFieldMask(writer, (IMessage)value);
			}
			else if (descriptor.FullName == Struct.Descriptor.FullName)
			{
				WriteStruct(writer, (IMessage)value, indentationLevel);
			}
			else if (descriptor.FullName == ListValue.Descriptor.FullName)
			{
				IFieldAccessor accessor = descriptor.Fields[1].Accessor;
				WriteList(writer, (IList)accessor.GetValue((IMessage)value), indentationLevel);
			}
			else if (descriptor.FullName == Value.Descriptor.FullName)
			{
				WriteStructFieldValue(writer, (IMessage)value, indentationLevel);
			}
			else if (descriptor.FullName == Any.Descriptor.FullName)
			{
				WriteAny(writer, (IMessage)value, indentationLevel);
			}
			else
			{
				WriteMessage(writer, (IMessage)value, indentationLevel);
			}
		}

		private void WriteTimestamp(TextWriter writer, IMessage value)
		{
			int nanoseconds = (int)value.Descriptor.Fields[2].Accessor.GetValue(value);
			long seconds = (long)value.Descriptor.Fields[1].Accessor.GetValue(value);
			writer.Write(Timestamp.ToJson(seconds, nanoseconds, DiagnosticOnly));
		}

		private void WriteDuration(TextWriter writer, IMessage value)
		{
			int nanoseconds = (int)value.Descriptor.Fields[2].Accessor.GetValue(value);
			long seconds = (long)value.Descriptor.Fields[1].Accessor.GetValue(value);
			writer.Write(Duration.ToJson(seconds, nanoseconds, DiagnosticOnly));
		}

		private void WriteFieldMask(TextWriter writer, IMessage value)
		{
			IList<string> paths = (IList<string>)value.Descriptor.Fields[1].Accessor.GetValue(value);
			writer.Write(FieldMask.ToJson(paths, DiagnosticOnly));
		}

		private void WriteAny(TextWriter writer, IMessage value, int indentationLevel)
		{
			if (DiagnosticOnly)
			{
				WriteDiagnosticOnlyAny(writer, value);
				return;
			}
			string text = (string)value.Descriptor.Fields[1].Accessor.GetValue(value);
			ByteString data = (ByteString)value.Descriptor.Fields[2].Accessor.GetValue(value);
			string typeName = Any.GetTypeName(text);
			MessageDescriptor messageDescriptor = settings.TypeRegistry.Find(typeName);
			if (messageDescriptor == null)
			{
				throw new InvalidOperationException("Type registry has no descriptor for type name '" + typeName + "'");
			}
			IMessage message = messageDescriptor.Parser.ParseFrom(data);
			WriteBracketOpen(writer, '{');
			WriteString(writer, "@type");
			writer.Write(": ");
			WriteString(writer, text);
			if (messageDescriptor.IsWellKnownType)
			{
				writer.Write(", ");
				WriteString(writer, "value");
				writer.Write(": ");
				WriteWellKnownTypeValue(writer, messageDescriptor, message, indentationLevel);
			}
			else
			{
				WriteMessageFields(writer, message, assumeFirstFieldWritten: true, indentationLevel);
			}
			WriteBracketClose(writer, '}', hasFields: true, indentationLevel);
		}

		private void WriteDiagnosticOnlyAny(TextWriter writer, IMessage value)
		{
			string text = (string)value.Descriptor.Fields[1].Accessor.GetValue(value);
			ByteString byteString = (ByteString)value.Descriptor.Fields[2].Accessor.GetValue(value);
			writer.Write("{ ");
			WriteString(writer, "@type");
			writer.Write(": ");
			WriteString(writer, text);
			writer.Write(", ");
			WriteString(writer, "@value");
			writer.Write(": ");
			writer.Write('"');
			writer.Write(byteString.ToBase64());
			writer.Write('"');
			writer.Write(" }");
		}

		private void WriteStruct(TextWriter writer, IMessage message, int indentationLevel)
		{
			WriteBracketOpen(writer, '{');
			IDictionary obj = (IDictionary)message.Descriptor.Fields[1].Accessor.GetValue(message);
			bool flag = true;
			foreach (DictionaryEntry item in obj)
			{
				string text = (string)item.Key;
				IMessage message2 = (IMessage)item.Value;
				if (string.IsNullOrEmpty(text) || message2 == null)
				{
					throw new InvalidOperationException("Struct fields cannot have an empty key or a null value.");
				}
				MaybeWriteValueSeparator(writer, flag);
				MaybeWriteValueWhitespace(writer, indentationLevel + 1);
				WriteString(writer, text);
				writer.Write(": ");
				WriteStructFieldValue(writer, message2, indentationLevel + 1);
				flag = false;
			}
			WriteBracketClose(writer, '}', !flag, indentationLevel);
		}

		private void WriteStructFieldValue(TextWriter writer, IMessage message, int indentationLevel)
		{
			FieldDescriptor caseFieldDescriptor = message.Descriptor.Oneofs[0].Accessor.GetCaseFieldDescriptor(message);
			if (caseFieldDescriptor == null)
			{
				throw new InvalidOperationException("Value message must contain a value for the oneof.");
			}
			object value = caseFieldDescriptor.Accessor.GetValue(message);
			switch (caseFieldDescriptor.FieldNumber)
			{
			case 2:
			case 3:
			case 4:
				WriteValue(writer, value);
				break;
			case 5:
			case 6:
			{
				IMessage message2 = (IMessage)caseFieldDescriptor.Accessor.GetValue(message);
				WriteWellKnownTypeValue(writer, message2.Descriptor, message2, indentationLevel);
				break;
			}
			case 1:
				WriteNull(writer);
				break;
			default:
				throw new InvalidOperationException("Unexpected case in struct field: " + caseFieldDescriptor.FieldNumber);
			}
		}

		internal void WriteList(TextWriter writer, IList list, int indentationLevel = 0)
		{
			WriteBracketOpen(writer, '[');
			bool flag = true;
			foreach (object item in list)
			{
				MaybeWriteValueSeparator(writer, flag);
				MaybeWriteValueWhitespace(writer, indentationLevel + 1);
				WriteValue(writer, item, indentationLevel + 1);
				flag = false;
			}
			WriteBracketClose(writer, ']', !flag, indentationLevel);
		}

		internal void WriteDictionary(TextWriter writer, IDictionary dictionary, int indentationLevel = 0)
		{
			WriteBracketOpen(writer, '{');
			bool flag = true;
			foreach (DictionaryEntry item in dictionary)
			{
				string text2;
				if (item.Key is string text)
				{
					text2 = text;
				}
				else
				{
					object key = item.Key;
					if (key is bool)
					{
						text2 = (((bool)key) ? "true" : "false");
					}
					else
					{
						if (!(item.Key is int) && !(item.Key is uint) && !(item.Key is long) && !(item.Key is ulong))
						{
							if (item.Key == null)
							{
								throw new ArgumentException("Dictionary has entry with null key");
							}
							throw new ArgumentException("Unhandled dictionary key type: " + item.Key.GetType());
						}
						text2 = ((IFormattable)item.Key).ToString("d", CultureInfo.InvariantCulture);
					}
				}
				MaybeWriteValueSeparator(writer, flag);
				MaybeWriteValueWhitespace(writer, indentationLevel + 1);
				WriteString(writer, text2);
				writer.Write(": ");
				WriteValue(writer, item.Value);
				flag = false;
			}
			WriteBracketClose(writer, '}', !flag, indentationLevel);
		}

		internal static void WriteString(TextWriter writer, string text)
		{
			writer.Write('"');
			for (int i = 0; i < text.Length; i++)
			{
				char c = text[i];
				if (c < '\u00a0')
				{
					writer.Write(CommonRepresentations[(uint)c]);
					continue;
				}
				if (char.IsHighSurrogate(c))
				{
					i++;
					if (i == text.Length || !char.IsLowSurrogate(text[i]))
					{
						throw new ArgumentException("String contains low surrogate not followed by high surrogate");
					}
					HexEncodeUtf16CodeUnit(writer, c);
					HexEncodeUtf16CodeUnit(writer, text[i]);
					continue;
				}
				if (char.IsLowSurrogate(c))
				{
					throw new ArgumentException("String contains high surrogate not preceded by low surrogate");
				}
				switch (c)
				{
				case '\u00ad':
				case '\u06dd':
				case '\u070f':
				case '\u17b4':
				case '\u17b5':
				case '\ufeff':
				case '\ufff9':
				case '\ufffa':
				case '\ufffb':
					HexEncodeUtf16CodeUnit(writer, c);
					continue;
				}
				if ((c >= '\u0600' && c <= '\u0603') || (c >= '\u200b' && c <= '\u200f') || (c >= '\u2028' && c <= '\u202e') || (c >= '\u2060' && c <= '\u2064') || (c >= '\u206a' && c <= '\u206f'))
				{
					HexEncodeUtf16CodeUnit(writer, c);
				}
				else
				{
					writer.Write(c);
				}
			}
			writer.Write('"');
		}

		private static void HexEncodeUtf16CodeUnit(TextWriter writer, char c)
		{
			writer.Write("\\u");
			writer.Write("0123456789abcdef"[((int)c >> 12) & 0xF]);
			writer.Write("0123456789abcdef"[((int)c >> 8) & 0xF]);
			writer.Write("0123456789abcdef"[((int)c >> 4) & 0xF]);
			writer.Write("0123456789abcdef"[c & 0xF]);
		}

		private void WriteBracketOpen(TextWriter writer, char openChar)
		{
			writer.Write(openChar);
			if (settings.Indentation == null)
			{
				writer.Write(' ');
			}
		}

		private void WriteBracketClose(TextWriter writer, char closeChar, bool hasFields, int indentationLevel)
		{
			if (hasFields)
			{
				if (settings.Indentation != null)
				{
					writer.WriteLine();
					WriteIndentation(writer, indentationLevel);
				}
				else
				{
					writer.Write(" ");
				}
			}
			writer.Write(closeChar);
		}

		private void MaybeWriteValueWhitespace(TextWriter writer, int indentationLevel)
		{
			if (settings.Indentation != null)
			{
				writer.WriteLine();
				WriteIndentation(writer, indentationLevel);
			}
		}

		private void WriteIndentation(TextWriter writer, int indentationLevel)
		{
			for (int i = 0; i < indentationLevel; i++)
			{
				writer.Write(settings.Indentation);
			}
		}
	}
	public sealed class JsonParser
	{
		public sealed class Settings
		{
			public static Settings Default { get; }

			public int RecursionLimit { get; }

			public TypeRegistry TypeRegistry { get; }

			public bool IgnoreUnknownFields { get; }

			static Settings()
			{
				Default = new Settings(100);
			}

			private Settings(int recursionLimit, TypeRegistry typeRegistry, bool ignoreUnknownFields)
			{
				RecursionLimit = recursionLimit;
				TypeRegistry = ProtoPreconditions.CheckNotNull(typeRegistry, "typeRegistry");
				IgnoreUnknownFields = ignoreUnknownFields;
			}

			public Settings(int recursionLimit)
				: this(recursionLimit, TypeRegistry.Empty)
			{
			}

			public Settings(int recursionLimit, TypeRegistry typeRegistry)
				: this(recursionLimit, typeRegistry, ignoreUnknownFields: false)
			{
			}

			public Settings WithIgnoreUnknownFields(bool ignoreUnknownFields)
			{
				return new Settings(RecursionLimit, TypeRegistry, ignoreUnknownFields);
			}

			public Settings WithRecursionLimit(int recursionLimit)
			{
				return new Settings(recursionLimit, TypeRegistry, IgnoreUnknownFields);
			}

			public Settings WithTypeRegistry(TypeRegistry typeRegistry)
			{
				return new Settings(RecursionLimit, ProtoPreconditions.CheckNotNull(typeRegistry, "typeRegistry"), IgnoreUnknownFields);
			}
		}

		private static readonly Regex TimestampRegex = new Regex("^(?<datetime>[0-9]{4}-[01][0-9]-[0-3][0-9]T[012][0-9]:[0-5][0-9]:[0-5][0-9])(?<subseconds>\\.[0-9]{1,9})?(?<offset>(Z|[+-][0-1][0-9]:[0-5][0-9]))$", FrameworkPortability.CompiledRegexWhereAvailable);

		private static readonly Regex DurationRegex = new Regex("^(?<sign>-)?(?<int>[0-9]{1,12})(?<subseconds>\\.[0-9]{1,9})?s$", FrameworkPortability.CompiledRegexWhereAvailable);

		private static readonly int[] SubsecondScalingFactors = new int[11]
		{
			0, 100000000, 100000000, 10000000, 1000000, 100000, 10000, 1000, 100, 10,
			1
		};

		private static readonly char[] FieldMaskPathSeparators = new char[1] { ',' };

		private static readonly EnumDescriptor NullValueDescriptor = StructReflection.Descriptor.EnumTypes.Single((EnumDescriptor ed) => ed.ClrType == typeof(NullValue));

		private static readonly JsonParser defaultInstance = new JsonParser(Settings.Default);

		private static readonly Dictionary<string, Action<JsonParser, IMessage, JsonTokenizer>> WellKnownTypeHandlers = new Dictionary<string, Action<JsonParser, IMessage, JsonTokenizer>>
		{
			{
				Timestamp.Descriptor.FullName,
				delegate(JsonParser parser, IMessage message, JsonTokenizer tokenizer)
				{
					MergeTimestamp(message, tokenizer.Next());
				}
			},
			{
				Duration.Descriptor.FullName,
				delegate(JsonParser parser, IMessage message, JsonTokenizer tokenizer)
				{
					MergeDuration(message, tokenizer.Next());
				}
			},
			{
				Value.Descriptor.FullName,
				delegate(JsonParser parser, IMessage message, JsonTokenizer tokenizer)
				{
					parser.MergeStructValue(message, tokenizer);
				}
			},
			{
				ListValue.Descriptor.FullName,
				delegate(JsonParser parser, IMessage message, JsonTokenizer tokenizer)
				{
					parser.MergeRepeatedField(message, message.Descriptor.Fields[1], tokenizer);
				}
			},
			{
				Struct.Descriptor.FullName,
				delegate(JsonParser parser, IMessage message, JsonTokenizer tokenizer)
				{
					parser.MergeStruct(message, tokenizer);
				}
			},
			{
				Any.Descriptor.FullName,
				delegate(JsonParser parser, IMessage message, JsonTokenizer tokenizer)
				{
					parser.MergeAny(message, tokenizer);
				}
			},
			{
				FieldMask.Descriptor.FullName,
				delegate(JsonParser parser, IMessage message, JsonTokenizer tokenizer)
				{
					MergeFieldMask(message, tokenizer.Next());
				}
			},
			{
				Int32Value.Descriptor.FullName,
				MergeWrapperField
			},
			{
				Int64Value.Descriptor.FullName,
				MergeWrapperField
			},
			{
				UInt32Value.Descriptor.FullName,
				MergeWrapperField
			},
			{
				UInt64Value.Descriptor.FullName,
				MergeWrapperField
			},
			{
				FloatValue.Descriptor.FullName,
				MergeWrapperField
			},
			{
				DoubleValue.Descriptor.FullName,
				MergeWrapperField
			},
			{
				BytesValue.Descriptor.FullName,
				MergeWrapperField
	

BepInEx/plugins/SlopCrew.Plugin/Microsoft.Bcl.AsyncInterfaces.dll

Decompiled 8 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.ExceptionServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: AssemblyMetadata(".NETFrameworkAssembly", "")]
[assembly: AssemblyMetadata("Serviceable", "True")]
[assembly: AssemblyMetadata("PreferInbox", "True")]
[assembly: AssemblyDefaultAlias("Microsoft.Bcl.AsyncInterfaces")]
[assembly: CLSCompliant(true)]
[assembly: AssemblyMetadata("IsTrimmable", "True")]
[assembly: DefaultDllImportSearchPaths(DllImportSearchPath.System32 | DllImportSearchPath.AssemblyDirectory)]
[assembly: AssemblyCompany("Microsoft Corporation")]
[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")]
[assembly: AssemblyDescription("Provides the IAsyncEnumerable<T> and IAsyncDisposable interfaces and helper types for .NET Standard 2.0. This package is not required starting with .NET Standard 2.1 and .NET Core 3.0.\r\n\r\nCommonly Used Types:\r\nSystem.IAsyncDisposable\r\nSystem.Collections.Generic.IAsyncEnumerable\r\nSystem.Collections.Generic.IAsyncEnumerator")]
[assembly: AssemblyFileVersion("7.0.22.51805")]
[assembly: AssemblyInformationalVersion("7.0.0+d099f075e45d2aa6007a22b71b45a08758559f80")]
[assembly: AssemblyProduct("Microsoft® .NET")]
[assembly: AssemblyTitle("Microsoft.Bcl.AsyncInterfaces")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/dotnet/runtime")]
[assembly: AssemblyVersion("7.0.0.0")]
[module: RefSafetyRules(11)]
[module: System.Runtime.CompilerServices.NullablePublicOnly(false)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class IsReadOnlyAttribute : Attribute
	{
	}
	[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 NullablePublicOnlyAttribute : Attribute
	{
		public readonly bool IncludesInternals;

		public NullablePublicOnlyAttribute(bool P_0)
		{
			IncludesInternals = 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 System
{
	public interface IAsyncDisposable
	{
		ValueTask DisposeAsync();
	}
}
namespace System.Diagnostics.CodeAnalysis
{
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)]
	internal sealed class AllowNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)]
	internal sealed class DisallowNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)]
	internal sealed class MaybeNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)]
	internal sealed class NotNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class MaybeNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public MaybeNullWhenAttribute(bool returnValue)
		{
			ReturnValue = returnValue;
		}
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class NotNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public NotNullWhenAttribute(bool returnValue)
		{
			ReturnValue = returnValue;
		}
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = true, Inherited = false)]
	internal sealed class NotNullIfNotNullAttribute : Attribute
	{
		public string ParameterName { get; }

		public NotNullIfNotNullAttribute(string parameterName)
		{
			ParameterName = parameterName;
		}
	}
	[AttributeUsage(AttributeTargets.Method, Inherited = false)]
	internal sealed class DoesNotReturnAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class DoesNotReturnIfAttribute : Attribute
	{
		public bool ParameterValue { get; }

		public DoesNotReturnIfAttribute(bool parameterValue)
		{
			ParameterValue = parameterValue;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	internal sealed class MemberNotNullAttribute : Attribute
	{
		public string[] Members { get; }

		public MemberNotNullAttribute(string member)
		{
			Members = new string[1] { member };
		}

		public MemberNotNullAttribute(params string[] members)
		{
			Members = members;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	internal sealed class MemberNotNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public string[] Members { get; }

		public MemberNotNullWhenAttribute(bool returnValue, string member)
		{
			ReturnValue = returnValue;
			Members = new string[1] { member };
		}

		public MemberNotNullWhenAttribute(bool returnValue, params string[] members)
		{
			ReturnValue = returnValue;
			Members = members;
		}
	}
}
namespace System.Collections.Generic
{
	public interface IAsyncEnumerable<out T>
	{
		IAsyncEnumerator<T> GetAsyncEnumerator(CancellationToken cancellationToken = default(CancellationToken));
	}
	public interface IAsyncEnumerator<out T> : IAsyncDisposable
	{
		T Current { get; }

		ValueTask<bool> MoveNextAsync();
	}
}
namespace System.Runtime.InteropServices
{
	[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
	internal sealed class LibraryImportAttribute : Attribute
	{
		public string LibraryName { get; }

		public string EntryPoint { get; set; }

		public StringMarshalling StringMarshalling { get; set; }

		public Type StringMarshallingCustomType { get; set; }

		public bool SetLastError { get; set; }

		public LibraryImportAttribute(string libraryName)
		{
			LibraryName = libraryName;
		}
	}
	internal enum StringMarshalling
	{
		Custom,
		Utf8,
		Utf16
	}
}
namespace System.Runtime.CompilerServices
{
	[StructLayout(LayoutKind.Auto)]
	public struct AsyncIteratorMethodBuilder
	{
		private AsyncTaskMethodBuilder _methodBuilder;

		private object _id;

		internal object ObjectIdForDebugger => _id ?? Interlocked.CompareExchange(ref _id, new object(), null) ?? _id;

		public static AsyncIteratorMethodBuilder Create()
		{
			AsyncIteratorMethodBuilder result = default(AsyncIteratorMethodBuilder);
			result._methodBuilder = AsyncTaskMethodBuilder.Create();
			return result;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public void MoveNext<TStateMachine>(ref TStateMachine stateMachine) where TStateMachine : IAsyncStateMachine
		{
			_methodBuilder.Start(ref stateMachine);
		}

		public void AwaitOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : INotifyCompletion where TStateMachine : IAsyncStateMachine
		{
			_methodBuilder.AwaitOnCompleted(ref awaiter, ref stateMachine);
		}

		public void AwaitUnsafeOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : ICriticalNotifyCompletion where TStateMachine : IAsyncStateMachine
		{
			_methodBuilder.AwaitUnsafeOnCompleted(ref awaiter, ref stateMachine);
		}

		public void Complete()
		{
			_methodBuilder.SetResult();
		}
	}
	[AttributeUsage(AttributeTargets.Method, Inherited = false, AllowMultiple = false)]
	public sealed class AsyncIteratorStateMachineAttribute : StateMachineAttribute
	{
		public AsyncIteratorStateMachineAttribute(Type stateMachineType)
			: base(stateMachineType)
		{
		}
	}
	[StructLayout(LayoutKind.Auto)]
	public readonly struct ConfiguredAsyncDisposable
	{
		private readonly IAsyncDisposable _source;

		private readonly bool _continueOnCapturedContext;

		internal ConfiguredAsyncDisposable(IAsyncDisposable source, bool continueOnCapturedContext)
		{
			_source = source;
			_continueOnCapturedContext = continueOnCapturedContext;
		}

		public ConfiguredValueTaskAwaitable DisposeAsync()
		{
			return _source.DisposeAsync().ConfigureAwait(_continueOnCapturedContext);
		}
	}
	[StructLayout(LayoutKind.Auto)]
	public readonly struct ConfiguredCancelableAsyncEnumerable<T>
	{
		[StructLayout(LayoutKind.Auto)]
		public readonly struct Enumerator
		{
			private readonly IAsyncEnumerator<T> _enumerator;

			private readonly bool _continueOnCapturedContext;

			public T Current => _enumerator.Current;

			internal Enumerator(IAsyncEnumerator<T> enumerator, bool continueOnCapturedContext)
			{
				_enumerator = enumerator;
				_continueOnCapturedContext = continueOnCapturedContext;
			}

			public ConfiguredValueTaskAwaitable<bool> MoveNextAsync()
			{
				return _enumerator.MoveNextAsync().ConfigureAwait(_continueOnCapturedContext);
			}

			public ConfiguredValueTaskAwaitable DisposeAsync()
			{
				return _enumerator.DisposeAsync().ConfigureAwait(_continueOnCapturedContext);
			}
		}

		private readonly IAsyncEnumerable<T> _enumerable;

		private readonly CancellationToken _cancellationToken;

		private readonly bool _continueOnCapturedContext;

		internal ConfiguredCancelableAsyncEnumerable(IAsyncEnumerable<T> enumerable, bool continueOnCapturedContext, CancellationToken cancellationToken)
		{
			_enumerable = enumerable;
			_continueOnCapturedContext = continueOnCapturedContext;
			_cancellationToken = cancellationToken;
		}

		public ConfiguredCancelableAsyncEnumerable<T> ConfigureAwait(bool continueOnCapturedContext)
		{
			return new ConfiguredCancelableAsyncEnumerable<T>(_enumerable, continueOnCapturedContext, _cancellationToken);
		}

		public ConfiguredCancelableAsyncEnumerable<T> WithCancellation(CancellationToken cancellationToken)
		{
			return new ConfiguredCancelableAsyncEnumerable<T>(_enumerable, _continueOnCapturedContext, cancellationToken);
		}

		public Enumerator GetAsyncEnumerator()
		{
			return new Enumerator(_enumerable.GetAsyncEnumerator(_cancellationToken), _continueOnCapturedContext);
		}
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	public sealed class EnumeratorCancellationAttribute : Attribute
	{
	}
}
namespace System.Threading.Tasks
{
	public static class TaskAsyncEnumerableExtensions
	{
		public static ConfiguredAsyncDisposable ConfigureAwait(this IAsyncDisposable source, bool continueOnCapturedContext)
		{
			return new ConfiguredAsyncDisposable(source, continueOnCapturedContext);
		}

		public static ConfiguredCancelableAsyncEnumerable<T> ConfigureAwait<T>(this IAsyncEnumerable<T> source, bool continueOnCapturedContext)
		{
			return new ConfiguredCancelableAsyncEnumerable<T>(source, continueOnCapturedContext, default(CancellationToken));
		}

		public static ConfiguredCancelableAsyncEnumerable<T> WithCancellation<T>(this IAsyncEnumerable<T> source, CancellationToken cancellationToken)
		{
			return new ConfiguredCancelableAsyncEnumerable<T>(source, continueOnCapturedContext: true, cancellationToken);
		}
	}
}
namespace System.Threading.Tasks.Sources
{
	[StructLayout(LayoutKind.Auto)]
	public struct ManualResetValueTaskSourceCore<TResult>
	{
		private Action<object> _continuation;

		private object _continuationState;

		private ExecutionContext _executionContext;

		private object _capturedContext;

		private bool _completed;

		private TResult _result;

		private ExceptionDispatchInfo _error;

		private short _version;

		public bool RunContinuationsAsynchronously { get; set; }

		public short Version => _version;

		public void Reset()
		{
			_version++;
			_completed = false;
			_result = default(TResult);
			_error = null;
			_executionContext = null;
			_capturedContext = null;
			_continuation = null;
			_continuationState = null;
		}

		public void SetResult(TResult result)
		{
			_result = result;
			SignalCompletion();
		}

		public void SetException(Exception error)
		{
			_error = ExceptionDispatchInfo.Capture(error);
			SignalCompletion();
		}

		public ValueTaskSourceStatus GetStatus(short token)
		{
			ValidateToken(token);
			if (_continuation != null && _completed)
			{
				if (_error != null)
				{
					if (!(_error.SourceException is OperationCanceledException))
					{
						return ValueTaskSourceStatus.Faulted;
					}
					return ValueTaskSourceStatus.Canceled;
				}
				return ValueTaskSourceStatus.Succeeded;
			}
			return ValueTaskSourceStatus.Pending;
		}

		public TResult GetResult(short token)
		{
			ValidateToken(token);
			if (!_completed)
			{
				throw new InvalidOperationException();
			}
			_error?.Throw();
			return _result;
		}

		public void OnCompleted(Action<object?> continuation, object? state, short token, ValueTaskSourceOnCompletedFlags flags)
		{
			if (continuation == null)
			{
				throw new ArgumentNullException("continuation");
			}
			ValidateToken(token);
			if ((flags & ValueTaskSourceOnCompletedFlags.FlowExecutionContext) != 0)
			{
				_executionContext = ExecutionContext.Capture();
			}
			if ((flags & ValueTaskSourceOnCompletedFlags.UseSchedulingContext) != 0)
			{
				SynchronizationContext current = SynchronizationContext.Current;
				if (current != null && current.GetType() != typeof(SynchronizationContext))
				{
					_capturedContext = current;
				}
				else
				{
					TaskScheduler current2 = TaskScheduler.Current;
					if (current2 != TaskScheduler.Default)
					{
						_capturedContext = current2;
					}
				}
			}
			object obj = _continuation;
			if (obj == null)
			{
				_continuationState = state;
				obj = Interlocked.CompareExchange(ref _continuation, continuation, null);
			}
			if (obj == null)
			{
				return;
			}
			if (obj != System.Threading.Tasks.Sources.ManualResetValueTaskSourceCoreShared.s_sentinel)
			{
				throw new InvalidOperationException();
			}
			object capturedContext = _capturedContext;
			if (capturedContext != null)
			{
				if (!(capturedContext is SynchronizationContext synchronizationContext))
				{
					if (capturedContext is TaskScheduler scheduler)
					{
						Task.Factory.StartNew(continuation, state, CancellationToken.None, TaskCreationOptions.DenyChildAttach, scheduler);
					}
				}
				else
				{
					synchronizationContext.Post(delegate(object s)
					{
						Tuple<Action<object>, object> tuple = (Tuple<Action<object>, object>)s;
						tuple.Item1(tuple.Item2);
					}, Tuple.Create(continuation, state));
				}
			}
			else
			{
				Task.Factory.StartNew(continuation, state, CancellationToken.None, TaskCreationOptions.DenyChildAttach, TaskScheduler.Default);
			}
		}

		private void ValidateToken(short token)
		{
			if (token != _version)
			{
				throw new InvalidOperationException();
			}
		}

		private void SignalCompletion()
		{
			if (_completed)
			{
				throw new InvalidOperationException();
			}
			_completed = true;
			if (_continuation == null && Interlocked.CompareExchange(ref _continuation, System.Threading.Tasks.Sources.ManualResetValueTaskSourceCoreShared.s_sentinel, null) == null)
			{
				return;
			}
			if (_executionContext != null)
			{
				ExecutionContext.Run(_executionContext, delegate(object s)
				{
					((ManualResetValueTaskSourceCore<TResult>)s).InvokeContinuation();
				}, this);
			}
			else
			{
				InvokeContinuation();
			}
		}

		private void InvokeContinuation()
		{
			object capturedContext = _capturedContext;
			if (capturedContext != null)
			{
				if (!(capturedContext is SynchronizationContext synchronizationContext))
				{
					if (capturedContext is TaskScheduler scheduler)
					{
						Task.Factory.StartNew(_continuation, _continuationState, CancellationToken.None, TaskCreationOptions.DenyChildAttach, scheduler);
					}
				}
				else
				{
					synchronizationContext.Post(delegate(object s)
					{
						Tuple<Action<object>, object> tuple = (Tuple<Action<object>, object>)s;
						tuple.Item1(tuple.Item2);
					}, Tuple.Create(_continuation, _continuationState));
				}
			}
			else if (RunContinuationsAsynchronously)
			{
				Task.Factory.StartNew(_continuation, _continuationState, CancellationToken.None, TaskCreationOptions.DenyChildAttach, TaskScheduler.Default);
			}
			else
			{
				_continuation(_continuationState);
			}
		}
	}
	internal static class ManualResetValueTaskSourceCoreShared
	{
		internal static readonly Action<object> s_sentinel = CompletionSentinel;

		private static void CompletionSentinel(object _)
		{
			throw new InvalidOperationException();
		}
	}
}

BepInEx/plugins/SlopCrew.Plugin/Microsoft.Extensions.Configuration.Abstractions.dll

Decompiled 8 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Text;
using FxResources.Microsoft.Extensions.Configuration.Abstractions;
using Microsoft.CodeAnalysis;
using Microsoft.Extensions.Primitives;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: AssemblyMetadata(".NETFrameworkAssembly", "")]
[assembly: AssemblyMetadata("Serviceable", "True")]
[assembly: AssemblyMetadata("PreferInbox", "True")]
[assembly: AssemblyDefaultAlias("Microsoft.Extensions.Configuration.Abstractions")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: CLSCompliant(true)]
[assembly: AssemblyMetadata("IsTrimmable", "True")]
[assembly: DefaultDllImportSearchPaths(DllImportSearchPath.System32 | DllImportSearchPath.AssemblyDirectory)]
[assembly: AssemblyCompany("Microsoft Corporation")]
[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")]
[assembly: AssemblyDescription("Abstractions of key-value pair based configuration.\r\n\r\nCommonly Used Types:\r\nMicrosoft.Extensions.Configuration.IConfiguration\r\nMicrosoft.Extensions.Configuration.IConfigurationBuilder\r\nMicrosoft.Extensions.Configuration.IConfigurationProvider\r\nMicrosoft.Extensions.Configuration.IConfigurationRoot\r\nMicrosoft.Extensions.Configuration.IConfigurationSection")]
[assembly: AssemblyFileVersion("7.0.22.51805")]
[assembly: AssemblyInformationalVersion("7.0.0+d099f075e45d2aa6007a22b71b45a08758559f80")]
[assembly: AssemblyProduct("Microsoft® .NET")]
[assembly: AssemblyTitle("Microsoft.Extensions.Configuration.Abstractions")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/dotnet/runtime")]
[assembly: AssemblyVersion("7.0.0.0")]
[module: RefSafetyRules(11)]
[module: System.Runtime.CompilerServices.NullablePublicOnly(false)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class IsReadOnlyAttribute : Attribute
	{
	}
	[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 NullablePublicOnlyAttribute : Attribute
	{
		public readonly bool IncludesInternals;

		public NullablePublicOnlyAttribute(bool P_0)
		{
			IncludesInternals = 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 FxResources.Microsoft.Extensions.Configuration.Abstractions
{
	internal static class SR
	{
	}
}
namespace System
{
	internal static class ThrowHelper
	{
		internal static void ThrowIfNull(object argument, [CallerArgumentExpression("argument")] string paramName = null)
		{
			if (argument == null)
			{
				Throw(paramName);
			}
		}

		private static void Throw(string paramName)
		{
			throw new ArgumentNullException(paramName);
		}
	}
	internal static class SR
	{
		private static readonly bool s_usingResourceKeys = AppContext.TryGetSwitch("System.Resources.UseSystemResourceKeys", out var isEnabled) && isEnabled;

		private static ResourceManager s_resourceManager;

		internal static ResourceManager ResourceManager => s_resourceManager ?? (s_resourceManager = new ResourceManager(typeof(SR)));

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

		private static bool UsingResourceKeys()
		{
			return s_usingResourceKeys;
		}

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

		internal static string GetResourceString(string resourceKey, string defaultString)
		{
			string resourceString = GetResourceString(resourceKey);
			if (!(resourceKey == resourceString) && resourceString != null)
			{
				return resourceString;
			}
			return defaultString;
		}

		internal static string Format(string resourceFormat, object p1)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1);
			}
			return string.Format(resourceFormat, p1);
		}

		internal static string Format(string resourceFormat, object p1, object p2)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2);
			}
			return string.Format(resourceFormat, p1, p2);
		}

		internal static string Format(string resourceFormat, object p1, object p2, object p3)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2, p3);
			}
			return string.Format(resourceFormat, p1, p2, p3);
		}

		internal static string Format(string resourceFormat, params object[] args)
		{
			if (args != null)
			{
				if (UsingResourceKeys())
				{
					return resourceFormat + ", " + string.Join(", ", args);
				}
				return string.Format(resourceFormat, args);
			}
			return resourceFormat;
		}

		internal static string Format(IFormatProvider provider, string resourceFormat, object p1)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1);
			}
			return string.Format(provider, resourceFormat, p1);
		}

		internal static string Format(IFormatProvider provider, string resourceFormat, object p1, object p2)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2);
			}
			return string.Format(provider, resourceFormat, p1, p2);
		}

		internal static string Format(IFormatProvider provider, string resourceFormat, object p1, object p2, object p3)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2, p3);
			}
			return string.Format(provider, resourceFormat, p1, p2, p3);
		}

		internal static string Format(IFormatProvider provider, string resourceFormat, params object[] args)
		{
			if (args != null)
			{
				if (UsingResourceKeys())
				{
					return resourceFormat + ", " + string.Join(", ", args);
				}
				return string.Format(provider, resourceFormat, args);
			}
			return resourceFormat;
		}
	}
}
namespace System.Diagnostics.CodeAnalysis
{
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)]
	internal sealed class AllowNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)]
	internal sealed class DisallowNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)]
	internal sealed class MaybeNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)]
	internal sealed class NotNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class MaybeNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public MaybeNullWhenAttribute(bool returnValue)
		{
			ReturnValue = returnValue;
		}
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class NotNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public NotNullWhenAttribute(bool returnValue)
		{
			ReturnValue = returnValue;
		}
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = true, Inherited = false)]
	internal sealed class NotNullIfNotNullAttribute : Attribute
	{
		public string ParameterName { get; }

		public NotNullIfNotNullAttribute(string parameterName)
		{
			ParameterName = parameterName;
		}
	}
	[AttributeUsage(AttributeTargets.Method, Inherited = false)]
	internal sealed class DoesNotReturnAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class DoesNotReturnIfAttribute : Attribute
	{
		public bool ParameterValue { get; }

		public DoesNotReturnIfAttribute(bool parameterValue)
		{
			ParameterValue = parameterValue;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	internal sealed class MemberNotNullAttribute : Attribute
	{
		public string[] Members { get; }

		public MemberNotNullAttribute(string member)
		{
			Members = new string[1] { member };
		}

		public MemberNotNullAttribute(params string[] members)
		{
			Members = members;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	internal sealed class MemberNotNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public string[] Members { get; }

		public MemberNotNullWhenAttribute(bool returnValue, string member)
		{
			ReturnValue = returnValue;
			Members = new string[1] { member };
		}

		public MemberNotNullWhenAttribute(bool returnValue, params string[] members)
		{
			ReturnValue = returnValue;
			Members = members;
		}
	}
}
namespace System.Runtime.InteropServices
{
	[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
	internal sealed class LibraryImportAttribute : Attribute
	{
		public string LibraryName { get; }

		public string EntryPoint { get; set; }

		public StringMarshalling StringMarshalling { get; set; }

		public Type StringMarshallingCustomType { get; set; }

		public bool SetLastError { get; set; }

		public LibraryImportAttribute(string libraryName)
		{
			LibraryName = libraryName;
		}
	}
	internal enum StringMarshalling
	{
		Custom,
		Utf8,
		Utf16
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
	internal sealed class CallerArgumentExpressionAttribute : Attribute
	{
		public string ParameterName { get; }

		public CallerArgumentExpressionAttribute(string parameterName)
		{
			ParameterName = parameterName;
		}
	}
}
namespace Microsoft.Extensions.Configuration
{
	public readonly struct ConfigurationDebugViewContext
	{
		public string Path { get; }

		public string Key { get; }

		public string? Value { get; }

		public IConfigurationProvider ConfigurationProvider { get; }

		public ConfigurationDebugViewContext(string path, string key, string? value, IConfigurationProvider configurationProvider)
		{
			Path = path;
			Key = key;
			Value = value;
			ConfigurationProvider = configurationProvider;
		}
	}
	public static class ConfigurationExtensions
	{
		public static IConfigurationBuilder Add<TSource>(this IConfigurationBuilder builder, Action<TSource>? configureSource) where TSource : IConfigurationSource, new()
		{
			TSource val = new TSource();
			configureSource?.Invoke(val);
			return builder.Add(val);
		}

		public static string? GetConnectionString(this IConfiguration configuration, string name)
		{
			return configuration?.GetSection("ConnectionStrings")[name];
		}

		public static IEnumerable<KeyValuePair<string, string?>> AsEnumerable(this IConfiguration configuration)
		{
			return configuration.AsEnumerable(makePathsRelative: false);
		}

		public static IEnumerable<KeyValuePair<string, string?>> AsEnumerable(this IConfiguration configuration, bool makePathsRelative)
		{
			Stack<IConfiguration> stack = new Stack<IConfiguration>();
			stack.Push(configuration);
			int prefixLength = ((makePathsRelative && configuration is IConfigurationSection configurationSection) ? (configurationSection.Path.Length + 1) : 0);
			while (stack.Count > 0)
			{
				IConfiguration config = stack.Pop();
				if (config is IConfigurationSection configurationSection2 && (!makePathsRelative || config != configuration))
				{
					yield return new KeyValuePair<string, string>(configurationSection2.Path.Substring(prefixLength), configurationSection2.Value);
				}
				foreach (IConfigurationSection child in config.GetChildren())
				{
					stack.Push(child);
				}
			}
		}

		public static bool Exists([NotNullWhen(true)] this IConfigurationSection? section)
		{
			if (section == null)
			{
				return false;
			}
			if (section.Value == null)
			{
				return section.GetChildren().Any();
			}
			return true;
		}

		public static IConfigurationSection GetRequiredSection(this IConfiguration configuration, string key)
		{
			System.ThrowHelper.ThrowIfNull(configuration, "configuration");
			IConfigurationSection section = configuration.GetSection(key);
			if (section.Exists())
			{
				return section;
			}
			throw new InvalidOperationException(System.SR.Format(System.SR.InvalidSectionName, key));
		}
	}
	[AttributeUsage(AttributeTargets.Property)]
	public sealed class ConfigurationKeyNameAttribute : Attribute
	{
		public string Name { get; }

		public ConfigurationKeyNameAttribute(string name)
		{
			Name = name;
		}
	}
	public static class ConfigurationPath
	{
		public static readonly string KeyDelimiter = ":";

		public static string Combine(params string[] pathSegments)
		{
			System.ThrowHelper.ThrowIfNull(pathSegments, "pathSegments");
			return string.Join(KeyDelimiter, pathSegments);
		}

		public static string Combine(IEnumerable<string> pathSegments)
		{
			System.ThrowHelper.ThrowIfNull(pathSegments, "pathSegments");
			return string.Join(KeyDelimiter, pathSegments);
		}

		[return: NotNullIfNotNull("path")]
		public static string? GetSectionKey(string? path)
		{
			if (string.IsNullOrEmpty(path))
			{
				return path;
			}
			int num = path.LastIndexOf(KeyDelimiter, StringComparison.OrdinalIgnoreCase);
			if (num != -1)
			{
				return path.Substring(num + 1);
			}
			return path;
		}

		public static string? GetParentPath(string? path)
		{
			if (string.IsNullOrEmpty(path))
			{
				return null;
			}
			int num = path.LastIndexOf(KeyDelimiter, StringComparison.OrdinalIgnoreCase);
			if (num != -1)
			{
				return path.Substring(0, num);
			}
			return null;
		}
	}
	public static class ConfigurationRootExtensions
	{
		public static string GetDebugView(this IConfigurationRoot root)
		{
			return root.GetDebugView(null);
		}

		public static string GetDebugView(this IConfigurationRoot root, Func<ConfigurationDebugViewContext, string>? processValue)
		{
			IConfigurationRoot root2 = root;
			Func<ConfigurationDebugViewContext, string> processValue2 = processValue;
			StringBuilder stringBuilder2 = new StringBuilder();
			RecurseChildren(stringBuilder2, root2.GetChildren(), "");
			return stringBuilder2.ToString();
			void RecurseChildren(StringBuilder stringBuilder, IEnumerable<IConfigurationSection> children, string indent)
			{
				foreach (IConfigurationSection child in children)
				{
					(string, IConfigurationProvider) valueAndProvider = GetValueAndProvider(root2, child.Path);
					if (valueAndProvider.Item2 != null)
					{
						string text;
						if (processValue2 == null)
						{
							(text, _) = valueAndProvider;
						}
						else
						{
							text = processValue2(new ConfigurationDebugViewContext(child.Key, child.Path, valueAndProvider.Item1, valueAndProvider.Item2));
						}
						string value = text;
						stringBuilder.Append(indent).Append(child.Key).Append('=')
							.Append(value)
							.Append(" (")
							.Append(valueAndProvider.Item2)
							.AppendLine(")");
					}
					else
					{
						stringBuilder.Append(indent).Append(child.Key).AppendLine(":");
					}
					RecurseChildren(stringBuilder, child.GetChildren(), indent + "  ");
				}
			}
		}

		private static (string Value, IConfigurationProvider Provider) GetValueAndProvider(IConfigurationRoot root, string key)
		{
			foreach (IConfigurationProvider item in root.Providers.Reverse())
			{
				if (item.TryGet(key, out string value))
				{
					return (value, item);
				}
			}
			return (null, null);
		}
	}
	public interface IConfiguration
	{
		string? this[string key] { get; set; }

		IConfigurationSection GetSection(string key);

		IEnumerable<IConfigurationSection> GetChildren();

		IChangeToken GetReloadToken();
	}
	public interface IConfigurationBuilder
	{
		IDictionary<string, object> Properties { get; }

		IList<IConfigurationSource> Sources { get; }

		IConfigurationBuilder Add(IConfigurationSource source);

		IConfigurationRoot Build();
	}
	public interface IConfigurationProvider
	{
		bool TryGet(string key, out string? value);

		void Set(string key, string? value);

		IChangeToken GetReloadToken();

		void Load();

		IEnumerable<string> GetChildKeys(IEnumerable<string> earlierKeys, string? parentPath);
	}
	public interface IConfigurationRoot : IConfiguration
	{
		IEnumerable<IConfigurationProvider> Providers { get; }

		void Reload();
	}
	public interface IConfigurationSection : IConfiguration
	{
		string Key { get; }

		string Path { get; }

		string? Value { get; set; }
	}
	public interface IConfigurationSource
	{
		IConfigurationProvider Build(IConfigurationBuilder builder);
	}
}

BepInEx/plugins/SlopCrew.Plugin/Microsoft.Extensions.Configuration.Binder.dll

Decompiled 8 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Runtime.Versioning;
using FxResources.Microsoft.Extensions.Configuration.Binder;
using Microsoft.CodeAnalysis;
using Microsoft.Extensions.Internal;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: InternalsVisibleTo("Microsoft.Extensions.Configuration.Binder.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: AssemblyMetadata(".NETFrameworkAssembly", "")]
[assembly: AssemblyMetadata("Serviceable", "True")]
[assembly: AssemblyMetadata("PreferInbox", "True")]
[assembly: AssemblyDefaultAlias("Microsoft.Extensions.Configuration.Binder")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: CLSCompliant(true)]
[assembly: AssemblyMetadata("IsTrimmable", "True")]
[assembly: DefaultDllImportSearchPaths(DllImportSearchPath.System32 | DllImportSearchPath.AssemblyDirectory)]
[assembly: AssemblyCompany("Microsoft Corporation")]
[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")]
[assembly: AssemblyDescription("Functionality to bind an object to data in configuration providers for Microsoft.Extensions.Configuration.")]
[assembly: AssemblyFileVersion("7.0.323.6910")]
[assembly: AssemblyInformationalVersion("7.0.3+0a2bda10e81d901396c3cff95533529e3a93ad47")]
[assembly: AssemblyProduct("Microsoft® .NET")]
[assembly: AssemblyTitle("Microsoft.Extensions.Configuration.Binder")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/dotnet/runtime")]
[assembly: AssemblyVersion("7.0.0.3")]
[module: RefSafetyRules(11)]
[module: System.Runtime.CompilerServices.NullablePublicOnly(true)]
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 NullablePublicOnlyAttribute : Attribute
	{
		public readonly bool IncludesInternals;

		public NullablePublicOnlyAttribute(bool P_0)
		{
			IncludesInternals = 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 FxResources.Microsoft.Extensions.Configuration.Binder
{
	internal static class SR
	{
	}
}
namespace System
{
	internal static class ThrowHelper
	{
		internal static void ThrowIfNull(object? argument, [CallerArgumentExpression("argument")] string? paramName = null)
		{
			if (argument == null)
			{
				Throw(paramName);
			}
		}

		private static void Throw(string paramName)
		{
			throw new ArgumentNullException(paramName);
		}
	}
	internal static class SR
	{
		private static readonly bool s_usingResourceKeys = AppContext.TryGetSwitch("System.Resources.UseSystemResourceKeys", out var isEnabled) && isEnabled;

		private static ResourceManager s_resourceManager;

		internal static ResourceManager ResourceManager => s_resourceManager ?? (s_resourceManager = new ResourceManager(typeof(SR)));

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

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

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

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

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

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

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

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

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

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

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

		private static bool UsingResourceKeys()
		{
			return s_usingResourceKeys;
		}

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

		internal static string GetResourceString(string resourceKey, string defaultString)
		{
			string resourceString = GetResourceString(resourceKey);
			if (!(resourceKey == resourceString) && resourceString != null)
			{
				return resourceString;
			}
			return defaultString;
		}

		internal static string Format(string resourceFormat, object? p1)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1);
			}
			return string.Format(resourceFormat, p1);
		}

		internal static string Format(string resourceFormat, object? p1, object? p2)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2);
			}
			return string.Format(resourceFormat, p1, p2);
		}

		internal static string Format(string resourceFormat, object? p1, object? p2, object? p3)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2, p3);
			}
			return string.Format(resourceFormat, p1, p2, p3);
		}

		internal static string Format(string resourceFormat, params object?[]? args)
		{
			if (args != null)
			{
				if (UsingResourceKeys())
				{
					return resourceFormat + ", " + string.Join(", ", args);
				}
				return string.Format(resourceFormat, args);
			}
			return resourceFormat;
		}

		internal static string Format(IFormatProvider? provider, string resourceFormat, object? p1)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1);
			}
			return string.Format(provider, resourceFormat, p1);
		}

		internal static string Format(IFormatProvider? provider, string resourceFormat, object? p1, object? p2)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2);
			}
			return string.Format(provider, resourceFormat, p1, p2);
		}

		internal static string Format(IFormatProvider? provider, string resourceFormat, object? p1, object? p2, object? p3)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2, p3);
			}
			return string.Format(provider, resourceFormat, p1, p2, p3);
		}

		internal static string Format(IFormatProvider? provider, string resourceFormat, params object?[]? args)
		{
			if (args != null)
			{
				if (UsingResourceKeys())
				{
					return resourceFormat + ", " + string.Join(", ", args);
				}
				return string.Format(provider, resourceFormat, args);
			}
			return resourceFormat;
		}
	}
}
namespace System.Diagnostics.CodeAnalysis
{
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Interface | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, Inherited = false)]
	internal sealed class DynamicallyAccessedMembersAttribute : Attribute
	{
		public DynamicallyAccessedMemberTypes MemberTypes { get; }

		public DynamicallyAccessedMembersAttribute(DynamicallyAccessedMemberTypes memberTypes)
		{
			MemberTypes = memberTypes;
		}
	}
	[Flags]
	internal enum DynamicallyAccessedMemberTypes
	{
		None = 0,
		PublicParameterlessConstructor = 1,
		PublicConstructors = 3,
		NonPublicConstructors = 4,
		PublicMethods = 8,
		NonPublicMethods = 0x10,
		PublicFields = 0x20,
		NonPublicFields = 0x40,
		PublicNestedTypes = 0x80,
		NonPublicNestedTypes = 0x100,
		PublicProperties = 0x200,
		NonPublicProperties = 0x400,
		PublicEvents = 0x800,
		NonPublicEvents = 0x1000,
		Interfaces = 0x2000,
		All = -1
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Constructor | AttributeTargets.Method, Inherited = false)]
	internal sealed class RequiresUnreferencedCodeAttribute : Attribute
	{
		public string Message { get; }

		public string? Url { get; set; }

		public RequiresUnreferencedCodeAttribute(string message)
		{
			Message = message;
		}
	}
	[AttributeUsage(AttributeTargets.All, Inherited = false, AllowMultiple = true)]
	internal sealed class UnconditionalSuppressMessageAttribute : Attribute
	{
		public string Category { get; }

		public string CheckId { get; }

		public string? Scope { get; set; }

		public string? Target { get; set; }

		public string? MessageId { get; set; }

		public string? Justification { get; set; }

		public UnconditionalSuppressMessageAttribute(string category, string checkId)
		{
			Category = category;
			CheckId = checkId;
		}
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Constructor | AttributeTargets.Method, Inherited = false)]
	internal sealed class RequiresDynamicCodeAttribute : Attribute
	{
		public string Message { get; }

		public string? Url { get; set; }

		public RequiresDynamicCodeAttribute(string message)
		{
			Message = message;
		}
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)]
	internal sealed class AllowNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)]
	internal sealed class DisallowNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)]
	internal sealed class MaybeNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)]
	internal sealed class NotNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class MaybeNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public MaybeNullWhenAttribute(bool returnValue)
		{
			ReturnValue = returnValue;
		}
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class NotNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public NotNullWhenAttribute(bool returnValue)
		{
			ReturnValue = returnValue;
		}
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = true, Inherited = false)]
	internal sealed class NotNullIfNotNullAttribute : Attribute
	{
		public string ParameterName { get; }

		public NotNullIfNotNullAttribute(string parameterName)
		{
			ParameterName = parameterName;
		}
	}
	[AttributeUsage(AttributeTargets.Method, Inherited = false)]
	internal sealed class DoesNotReturnAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class DoesNotReturnIfAttribute : Attribute
	{
		public bool ParameterValue { get; }

		public DoesNotReturnIfAttribute(bool parameterValue)
		{
			ParameterValue = parameterValue;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	internal sealed class MemberNotNullAttribute : Attribute
	{
		public string[] Members { get; }

		public MemberNotNullAttribute(string member)
		{
			Members = new string[1] { member };
		}

		public MemberNotNullAttribute(params string[] members)
		{
			Members = members;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	internal sealed class MemberNotNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public string[] Members { get; }

		public MemberNotNullWhenAttribute(bool returnValue, string member)
		{
			ReturnValue = returnValue;
			Members = new string[1] { member };
		}

		public MemberNotNullWhenAttribute(bool returnValue, params string[] members)
		{
			ReturnValue = returnValue;
			Members = members;
		}
	}
}
namespace System.Runtime.InteropServices
{
	[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
	internal sealed class LibraryImportAttribute : Attribute
	{
		public string LibraryName { get; }

		public string? EntryPoint { get; set; }

		public StringMarshalling StringMarshalling { get; set; }

		public Type? StringMarshallingCustomType { get; set; }

		public bool SetLastError { get; set; }

		public LibraryImportAttribute(string libraryName)
		{
			LibraryName = libraryName;
		}
	}
	internal enum StringMarshalling
	{
		Custom,
		Utf8,
		Utf16
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
	internal sealed class CallerArgumentExpressionAttribute : Attribute
	{
		public string ParameterName { get; }

		public CallerArgumentExpressionAttribute(string parameterName)
		{
			ParameterName = parameterName;
		}
	}
}
namespace Microsoft.Extensions.Internal
{
	internal static class ParameterDefaultValue
	{
		public static bool TryGetDefaultValue(ParameterInfo parameter, out object? defaultValue)
		{
			bool tryToGetDefaultValue;
			bool flag = CheckHasDefaultValue(parameter, out tryToGetDefaultValue);
			defaultValue = null;
			if (flag)
			{
				if (tryToGetDefaultValue)
				{
					defaultValue = parameter.DefaultValue;
				}
				bool flag2 = parameter.ParameterType.IsGenericType && parameter.ParameterType.GetGenericTypeDefinition() == typeof(Nullable<>);
				if (defaultValue == null && parameter.ParameterType.IsValueType && !flag2)
				{
					defaultValue = CreateValueType(parameter.ParameterType);
				}
				if (defaultValue != null && flag2)
				{
					Type underlyingType = Nullable.GetUnderlyingType(parameter.ParameterType);
					if (underlyingType != null && underlyingType.IsEnum)
					{
						defaultValue = Enum.ToObject(underlyingType, defaultValue);
					}
				}
			}
			return flag;
			[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2067:UnrecognizedReflectionPattern", Justification = "CreateValueType is only called on a ValueType. You can always create an instance of a ValueType.")]
			static object? CreateValueType(Type t)
			{
				return FormatterServices.GetUninitializedObject(t);
			}
		}

		public static bool CheckHasDefaultValue(ParameterInfo parameter, out bool tryToGetDefaultValue)
		{
			tryToGetDefaultValue = true;
			try
			{
				return parameter.HasDefaultValue;
			}
			catch (FormatException) when (parameter.ParameterType == typeof(DateTime))
			{
				tryToGetDefaultValue = false;
				return true;
			}
		}
	}
}
namespace Microsoft.Extensions.Configuration
{
	public class BinderOptions
	{
		public bool BindNonPublicProperties { get; set; }

		public bool ErrorOnUnknownConfiguration { get; set; }
	}
	internal sealed class BindingPoint
	{
		private readonly Func<object> _initialValueProvider;

		private object _initialValue;

		private object _setValue;

		private bool _valueSet;

		public bool IsReadOnly { get; }

		public bool HasNewValue
		{
			get
			{
				if (IsReadOnly)
				{
					return false;
				}
				if (_valueSet)
				{
					return true;
				}
				Type type = _initialValue?.GetType();
				if ((object)type != null && type.IsValueType)
				{
					return !type.IsPrimitive;
				}
				return false;
			}
		}

		public object? Value
		{
			get
			{
				object obj;
				if (!_valueSet)
				{
					obj = _initialValue;
					if (obj == null)
					{
						return _initialValue = _initialValueProvider?.Invoke();
					}
				}
				else
				{
					obj = _setValue;
				}
				return obj;
			}
		}

		public BindingPoint(object? initialValue = null, bool isReadOnly = false)
		{
			_initialValue = initialValue;
			IsReadOnly = isReadOnly;
		}

		public BindingPoint(Func<object?> initialValueProvider, bool isReadOnly)
		{
			_initialValueProvider = initialValueProvider;
			IsReadOnly = isReadOnly;
		}

		public void SetValue(object? newValue)
		{
			_setValue = newValue;
			_valueSet = true;
		}

		public void TrySetValue(object? newValue)
		{
			if (!IsReadOnly)
			{
				SetValue(newValue);
			}
		}
	}
	public static class ConfigurationBinder
	{
		private const BindingFlags DeclaredOnlyLookup = BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic;

		private const string DynamicCodeWarningMessage = "Binding strongly typed objects to configuration values requires generating dynamic code at runtime, for example instantiating generic types.";

		private const string TrimmingWarningMessage = "In case the type is non-primitive, the trimmer cannot statically analyze the object's type so its members may be trimmed.";

		private const string InstanceGetTypeTrimmingWarningMessage = "Cannot statically analyze the type of instance so its members may be trimmed";

		private const string PropertyTrimmingWarningMessage = "Cannot statically analyze property.PropertyType so its members may be trimmed.";

		[RequiresDynamicCode("Binding strongly typed objects to configuration values requires generating dynamic code at runtime, for example instantiating generic types.")]
		[RequiresUnreferencedCode("In case the type is non-primitive, the trimmer cannot statically analyze the object's type so its members may be trimmed.")]
		public static T? Get<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] T>(this IConfiguration configuration)
		{
			return configuration.Get<T>(delegate
			{
			});
		}

		[RequiresDynamicCode("Binding strongly typed objects to configuration values requires generating dynamic code at runtime, for example instantiating generic types.")]
		[RequiresUnreferencedCode("In case the type is non-primitive, the trimmer cannot statically analyze the object's type so its members may be trimmed.")]
		public static T? Get<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] T>(this IConfiguration configuration, Action<BinderOptions>? configureOptions)
		{
			System.ThrowHelper.ThrowIfNull(configuration, "configuration");
			object obj = configuration.Get(typeof(T), configureOptions);
			if (obj == null)
			{
				return default(T);
			}
			return (T)obj;
		}

		[RequiresDynamicCode("Binding strongly typed objects to configuration values requires generating dynamic code at runtime, for example instantiating generic types.")]
		[RequiresUnreferencedCode("In case the type is non-primitive, the trimmer cannot statically analyze the object's type so its members may be trimmed.")]
		public static object? Get(this IConfiguration configuration, Type type)
		{
			return configuration.Get(type, delegate
			{
			});
		}

		[RequiresDynamicCode("Binding strongly typed objects to configuration values requires generating dynamic code at runtime, for example instantiating generic types.")]
		[RequiresUnreferencedCode("In case the type is non-primitive, the trimmer cannot statically analyze the object's type so its members may be trimmed.")]
		public static object? Get(this IConfiguration configuration, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type type, Action<BinderOptions>? configureOptions)
		{
			System.ThrowHelper.ThrowIfNull(configuration, "configuration");
			BinderOptions binderOptions = new BinderOptions();
			configureOptions?.Invoke(binderOptions);
			BindingPoint bindingPoint = new BindingPoint();
			BindInstance(type, bindingPoint, configuration, binderOptions);
			return bindingPoint.Value;
		}

		[RequiresDynamicCode("Binding strongly typed objects to configuration values requires generating dynamic code at runtime, for example instantiating generic types.")]
		[RequiresUnreferencedCode("Cannot statically analyze the type of instance so its members may be trimmed")]
		public static void Bind(this IConfiguration configuration, string key, object? instance)
		{
			((IConfiguration)(object)configuration.GetSection(key)).Bind(instance);
		}

		[RequiresDynamicCode("Binding strongly typed objects to configuration values requires generating dynamic code at runtime, for example instantiating generic types.")]
		[RequiresUnreferencedCode("Cannot statically analyze the type of instance so its members may be trimmed")]
		public static void Bind(this IConfiguration configuration, object? instance)
		{
			configuration.Bind(instance, delegate
			{
			});
		}

		[RequiresDynamicCode("Binding strongly typed objects to configuration values requires generating dynamic code at runtime, for example instantiating generic types.")]
		[RequiresUnreferencedCode("Cannot statically analyze the type of instance so its members may be trimmed")]
		public static void Bind(this IConfiguration configuration, object? instance, Action<BinderOptions>? configureOptions)
		{
			System.ThrowHelper.ThrowIfNull(configuration, "configuration");
			if (instance != null)
			{
				BinderOptions binderOptions = new BinderOptions();
				configureOptions?.Invoke(binderOptions);
				BindingPoint bindingPoint = new BindingPoint(instance, isReadOnly: true);
				BindInstance(instance.GetType(), bindingPoint, configuration, binderOptions);
			}
		}

		[RequiresUnreferencedCode("In case the type is non-primitive, the trimmer cannot statically analyze the object's type so its members may be trimmed.")]
		public static T? GetValue<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] T>(this IConfiguration configuration, string key)
		{
			return configuration.GetValue(key, default(T));
		}

		[RequiresUnreferencedCode("In case the type is non-primitive, the trimmer cannot statically analyze the object's type so its members may be trimmed.")]
		public static T? GetValue<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] T>(this IConfiguration configuration, string key, T defaultValue)
		{
			return (T)configuration.GetValue(typeof(T), key, defaultValue);
		}

		[RequiresUnreferencedCode("In case the type is non-primitive, the trimmer cannot statically analyze the object's type so its members may be trimmed.")]
		public static object? GetValue(this IConfiguration configuration, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type type, string key)
		{
			return configuration.GetValue(type, key, null);
		}

		[RequiresUnreferencedCode("In case the type is non-primitive, the trimmer cannot statically analyze the object's type so its members may be trimmed.")]
		public static object? GetValue(this IConfiguration configuration, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type type, string key, object? defaultValue)
		{
			IConfigurationSection section = configuration.GetSection(key);
			string value = section.Value;
			if (value != null)
			{
				return ConvertValue(type, value, section.Path);
			}
			return defaultValue;
		}

		[RequiresDynamicCode("Binding strongly typed objects to configuration values requires generating dynamic code at runtime, for example instantiating generic types.")]
		[RequiresUnreferencedCode("Cannot statically analyze property.PropertyType so its members may be trimmed.")]
		private static void BindProperties(object instance, IConfiguration configuration, BinderOptions options)
		{
			List<PropertyInfo> allProperties = GetAllProperties(instance.GetType());
			if (options.ErrorOnUnknownConfiguration)
			{
				HashSet<string> propertyNames = new HashSet<string>(allProperties.Select((PropertyInfo mp) => mp.Name), StringComparer.OrdinalIgnoreCase);
				IEnumerable<IConfigurationSection> children = configuration.GetChildren();
				List<string> list = (from cs in children
					where !propertyNames.Contains(cs.Key)
					select cs into mp
					select "'" + mp.Key + "'").ToList();
				if (list.Count > 0)
				{
					throw new InvalidOperationException(System.SR.Format(System.SR.Error_MissingConfig, "ErrorOnUnknownConfiguration", "BinderOptions", instance.GetType(), string.Join(", ", list)));
				}
			}
			foreach (PropertyInfo item in allProperties)
			{
				BindProperty(item, instance, configuration, options);
			}
		}

		[RequiresDynamicCode("Binding strongly typed objects to configuration values requires generating dynamic code at runtime, for example instantiating generic types.")]
		[RequiresUnreferencedCode("Cannot statically analyze property.PropertyType so its members may be trimmed.")]
		private static void BindProperty(PropertyInfo property, object instance, IConfiguration config, BinderOptions options)
		{
			if (!(property.GetMethod == null) && (options.BindNonPublicProperties || property.GetMethod.IsPublic) && property.GetMethod.GetParameters().Length == 0)
			{
				BindingPoint bindingPoint = new BindingPoint(() => property.GetValue(instance), (object)property.SetMethod == null || (!property.SetMethod.IsPublic && !options.BindNonPublicProperties));
				BindInstance(property.PropertyType, bindingPoint, (IConfiguration)(object)config.GetSection(GetPropertyName(property)), options);
				if (!bindingPoint.IsReadOnly && bindingPoint.Value != null)
				{
					property.SetValue(instance, bindingPoint.Value);
				}
			}
		}

		[RequiresDynamicCode("Binding strongly typed objects to configuration values requires generating dynamic code at runtime, for example instantiating generic types.")]
		[RequiresUnreferencedCode("In case the type is non-primitive, the trimmer cannot statically analyze the object's type so its members may be trimmed.")]
		private static void BindInstance([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type type, BindingPoint bindingPoint, IConfiguration config, BinderOptions options)
		{
			if (type == typeof(IConfigurationSection))
			{
				bindingPoint.TrySetValue(config);
				return;
			}
			IConfigurationSection val = (IConfigurationSection)(object)((config is IConfigurationSection) ? config : null);
			string text = ((val != null) ? val.Value : null);
			if (text != null && TryConvertValue(type, text, (val != null) ? val.Path : null, out var result, out var error))
			{
				if (error != null)
				{
					throw error;
				}
				bindingPoint.TrySetValue(result);
			}
			else
			{
				if (config == null || !config.GetChildren().Any())
				{
					return;
				}
				if (type.IsArray || IsImmutableArrayCompatibleInterface(type))
				{
					if (!bindingPoint.IsReadOnly)
					{
						bindingPoint.SetValue(BindArray(type, (IEnumerable)bindingPoint.Value, config, options));
					}
					return;
				}
				if (TypeIsASetInterface(type) && !bindingPoint.IsReadOnly)
				{
					object obj = BindSet(type, (IEnumerable)bindingPoint.Value, config, options);
					if (obj != null)
					{
						bindingPoint.SetValue(obj);
					}
					return;
				}
				if (TypeIsADictionaryInterface(type) && !bindingPoint.IsReadOnly)
				{
					object obj2 = BindDictionaryInterface(bindingPoint.Value, type, config, options);
					if (obj2 != null)
					{
						bindingPoint.SetValue(obj2);
					}
					return;
				}
				if (bindingPoint.Value == null)
				{
					if (bindingPoint.IsReadOnly)
					{
						return;
					}
					Type type2 = ((type.IsInterface && type.IsConstructedGenericType) ? type.GetGenericTypeDefinition() : null);
					if ((object)type2 != null && (type2 == typeof(ICollection<>) || type2 == typeof(IList<>)))
					{
						Type type3 = typeof(List<>).MakeGenericType(type.GenericTypeArguments[0]);
						bindingPoint.SetValue(Activator.CreateInstance(type3));
					}
					else
					{
						bindingPoint.SetValue(CreateInstance(type, config, options));
					}
				}
				Type type4 = FindOpenGenericInterface(typeof(IDictionary<, >), type);
				if (type4 != null)
				{
					BindDictionary(bindingPoint.Value, type4, config, options);
					return;
				}
				Type type5 = FindOpenGenericInterface(typeof(ICollection<>), type);
				if (type5 != null)
				{
					BindCollection(bindingPoint.Value, type5, config, options);
				}
				else
				{
					BindProperties(bindingPoint.Value, config, options);
				}
			}
		}

		[RequiresDynamicCode("Binding strongly typed objects to configuration values requires generating dynamic code at runtime, for example instantiating generic types.")]
		[RequiresUnreferencedCode("In case type is a Nullable<T>, cannot statically analyze what the underlying type is so its members may be trimmed.")]
		private static object CreateInstance([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)] Type type, IConfiguration config, BinderOptions options)
		{
			if (type.IsInterface || type.IsAbstract)
			{
				throw new InvalidOperationException(System.SR.Format(System.SR.Error_CannotActivateAbstractOrInterface, type));
			}
			ConstructorInfo[] constructors = type.GetConstructors(BindingFlags.Instance | BindingFlags.Public);
			bool flag = type.IsValueType || constructors.Any((ConstructorInfo ctor) => ctor.GetParameters().Length == 0);
			if (!type.IsValueType && constructors.Length == 0)
			{
				throw new InvalidOperationException(System.SR.Format(System.SR.Error_MissingPublicInstanceConstructor, type));
			}
			if (constructors.Length > 1 && !flag)
			{
				throw new InvalidOperationException(System.SR.Format(System.SR.Error_MultipleParameterizedConstructors, type));
			}
			if (constructors.Length == 1 && !flag)
			{
				ConstructorInfo constructorInfo = constructors[0];
				ParameterInfo[] parameters = constructorInfo.GetParameters();
				if (!CanBindToTheseConstructorParameters(parameters, out var nameOfInvalidParameter))
				{
					throw new InvalidOperationException(System.SR.Format(System.SR.Error_CannotBindToConstructorParameter, type, nameOfInvalidParameter));
				}
				List<PropertyInfo> allProperties = GetAllProperties(type);
				if (!DoAllParametersHaveEquivalentProperties(parameters, allProperties, out var missing))
				{
					throw new InvalidOperationException(System.SR.Format(System.SR.Error_ConstructorParametersDoNotMatchProperties, type, missing));
				}
				object[] array = new object[parameters.Length];
				for (int i = 0; i < parameters.Length; i++)
				{
					array[i] = BindParameter(parameters[i], type, config, options);
				}
				return constructorInfo.Invoke(array);
			}
			object obj;
			try
			{
				obj = Activator.CreateInstance(Nullable.GetUnderlyingType(type) ?? type);
			}
			catch (Exception innerException)
			{
				throw new InvalidOperationException(System.SR.Format(System.SR.Error_FailedToActivate, type), innerException);
			}
			return obj ?? throw new InvalidOperationException(System.SR.Format(System.SR.Error_FailedToActivate, type));
		}

		private static bool DoAllParametersHaveEquivalentProperties(ParameterInfo[] parameters, List<PropertyInfo> properties, out string missing)
		{
			HashSet<string> hashSet = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
			foreach (PropertyInfo property in properties)
			{
				hashSet.Add(property.Name);
			}
			List<string> list = new List<string>();
			foreach (ParameterInfo parameterInfo in parameters)
			{
				string name = parameterInfo.Name;
				if (!hashSet.Contains(name))
				{
					list.Add(name);
				}
			}
			missing = string.Join(",", list);
			return missing.Length == 0;
		}

		private static bool CanBindToTheseConstructorParameters(ParameterInfo[] constructorParameters, out string nameOfInvalidParameter)
		{
			nameOfInvalidParameter = string.Empty;
			foreach (ParameterInfo parameterInfo in constructorParameters)
			{
				if (parameterInfo.IsOut || parameterInfo.IsIn || parameterInfo.ParameterType.IsByRef)
				{
					nameOfInvalidParameter = parameterInfo.Name;
					return false;
				}
			}
			return true;
		}

		[RequiresDynamicCode("Binding strongly typed objects to configuration values requires generating dynamic code at runtime, for example instantiating generic types.")]
		[RequiresUnreferencedCode("Cannot statically analyze what the element type is of the value objects in the dictionary so its members may be trimmed.")]
		private static object BindDictionaryInterface(object source, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties)] Type dictionaryType, IConfiguration config, BinderOptions options)
		{
			Type type = dictionaryType.GenericTypeArguments[0];
			Type type2 = dictionaryType.GenericTypeArguments[1];
			bool isEnum = type.IsEnum;
			bool flag = type == typeof(sbyte) || type == typeof(byte) || type == typeof(short) || type == typeof(ushort) || type == typeof(int) || type == typeof(uint) || type == typeof(long) || type == typeof(ulong);
			if (type != typeof(string) && !isEnum && !flag)
			{
				return null;
			}
			Type type3 = typeof(Dictionary<, >).MakeGenericType(type, type2);
			MethodInfo method = type3.GetMethod("Add", BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
			Type type4 = typeof(KeyValuePair<, >).MakeGenericType(type, type2);
			PropertyInfo property = type4.GetProperty("Key", BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
			PropertyInfo property2 = type4.GetProperty("Value", BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
			object obj = Activator.CreateInstance(type3);
			IEnumerable enumerable = source as IEnumerable;
			object[] array = new object[2];
			if (enumerable != null)
			{
				foreach (object item in enumerable)
				{
					object obj2 = property.GetMethod.Invoke(item, null);
					object obj3 = property2.GetMethod.Invoke(item, null);
					array[0] = obj2;
					array[1] = obj3;
					method.Invoke(obj, array);
				}
			}
			BindDictionary(obj, type3, config, options);
			return obj;
		}

		[RequiresDynamicCode("Binding strongly typed objects to configuration values requires generating dynamic code at runtime, for example instantiating generic types.")]
		[RequiresUnreferencedCode("Cannot statically analyze what the element type is of the value objects in the dictionary so its members may be trimmed.")]
		private static void BindDictionary(object dictionary, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties)] Type dictionaryType, IConfiguration config, BinderOptions options)
		{
			Type type = dictionaryType.GenericTypeArguments[0];
			Type type2 = dictionaryType.GenericTypeArguments[1];
			bool isEnum = type.IsEnum;
			bool flag = type == typeof(sbyte) || type == typeof(byte) || type == typeof(short) || type == typeof(ushort) || type == typeof(int) || type == typeof(uint) || type == typeof(long) || type == typeof(ulong);
			if (type != typeof(string) && !isEnum && !flag)
			{
				return;
			}
			MethodInfo tryGetValue = dictionaryType.GetMethod("TryGetValue", BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
			PropertyInfo property = dictionaryType.GetProperty("Item", BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
			if ((object)property == null || !property.CanWrite)
			{
				return;
			}
			foreach (IConfigurationSection child in config.GetChildren())
			{
				try
				{
					object key = (isEnum ? Enum.Parse(type, child.Key, ignoreCase: true) : (flag ? Convert.ChangeType(child.Key, type) : child.Key));
					BindingPoint bindingPoint = new BindingPoint(delegate
					{
						object[] array = new object[2] { key, null };
						return (!(bool)tryGetValue.Invoke(dictionary, array)) ? null : array[1];
					}, isReadOnly: false);
					BindInstance(type2, bindingPoint, (IConfiguration)(object)child, options);
					if (bindingPoint.HasNewValue)
					{
						property.SetValue(dictionary, bindingPoint.Value, new object[1] { key });
					}
				}
				catch
				{
				}
			}
		}

		[RequiresDynamicCode("Binding strongly typed objects to configuration values requires generating dynamic code at runtime, for example instantiating generic types.")]
		[RequiresUnreferencedCode("Cannot statically analyze what the element type is of the object collection so its members may be trimmed.")]
		private static void BindCollection(object collection, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.NonPublicMethods)] Type collectionType, IConfiguration config, BinderOptions options)
		{
			Type type = collectionType.GenericTypeArguments[0];
			MethodInfo method = collectionType.GetMethod("Add", BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
			foreach (IConfigurationSection child in config.GetChildren())
			{
				try
				{
					BindingPoint bindingPoint = new BindingPoint();
					BindInstance(type, bindingPoint, (IConfiguration)(object)child, options);
					if (bindingPoint.HasNewValue)
					{
						method?.Invoke(collection, new object[1] { bindingPoint.Value });
					}
				}
				catch
				{
				}
			}
		}

		[RequiresDynamicCode("Binding strongly typed objects to configuration values requires generating dynamic code at runtime, for example instantiating generic types.")]
		[RequiresUnreferencedCode("Cannot statically analyze what the element type is of the Array so its members may be trimmed.")]
		private static Array BindArray(Type type, IEnumerable source, IConfiguration config, BinderOptions options)
		{
			Type type2;
			if (type.IsArray)
			{
				if (type.GetArrayRank() > 1)
				{
					throw new InvalidOperationException(System.SR.Format(System.SR.Error_UnsupportedMultidimensionalArray, type));
				}
				type2 = type.GetElementType();
			}
			else
			{
				type2 = type.GetGenericArguments()[0];
			}
			IList list = new List<object>();
			if (source != null)
			{
				foreach (object item in source)
				{
					list.Add(item);
				}
			}
			foreach (IConfigurationSection child in config.GetChildren())
			{
				BindingPoint bindingPoint = new BindingPoint();
				try
				{
					BindInstance(type2, bindingPoint, (IConfiguration)(object)child, options);
					if (bindingPoint.HasNewValue)
					{
						list.Add(bindingPoint.Value);
					}
				}
				catch
				{
				}
			}
			Array array = Array.CreateInstance(type2, list.Count);
			list.CopyTo(array, 0);
			return array;
		}

		[RequiresDynamicCode("Binding strongly typed objects to configuration values requires generating dynamic code at runtime, for example instantiating generic types.")]
		[RequiresUnreferencedCode("Cannot statically analyze what the element type is of the Array so its members may be trimmed.")]
		private static object BindSet(Type type, IEnumerable source, IConfiguration config, BinderOptions options)
		{
			Type type2 = type.GetGenericArguments()[0];
			Type type3 = type.GenericTypeArguments[0];
			bool isEnum = type3.IsEnum;
			if (type3 != typeof(string) && !isEnum)
			{
				return null;
			}
			Type type4 = typeof(HashSet<>).MakeGenericType(type3);
			object obj = Activator.CreateInstance(type4);
			MethodInfo method = type4.GetMethod("Add", BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
			object[] array = new object[1];
			if (source != null)
			{
				foreach (object item in source)
				{
					array[0] = item;
					method.Invoke(obj, array);
				}
			}
			foreach (IConfigurationSection child in config.GetChildren())
			{
				BindingPoint bindingPoint = new BindingPoint();
				try
				{
					BindInstance(type2, bindingPoint, (IConfiguration)(object)child, options);
					if (bindingPoint.HasNewValue)
					{
						array[0] = bindingPoint.Value;
						method.Invoke(obj, array);
					}
				}
				catch
				{
				}
			}
			return obj;
		}

		[RequiresUnreferencedCode("In case the type is non-primitive, the trimmer cannot statically analyze the object's type so its members may be trimmed.")]
		private static bool TryConvertValue([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type type, string value, string path, out object result, out Exception error)
		{
			error = null;
			result = null;
			if (type == typeof(object))
			{
				result = value;
				return true;
			}
			if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>))
			{
				if (string.IsNullOrEmpty(value))
				{
					return true;
				}
				return TryConvertValue(Nullable.GetUnderlyingType(type), value, path, out result, out error);
			}
			TypeConverter converter = TypeDescriptor.GetConverter(type);
			if (converter.CanConvertFrom(typeof(string)))
			{
				try
				{
					result = converter.ConvertFromInvariantString(value);
				}
				catch (Exception innerException)
				{
					error = new InvalidOperationException(System.SR.Format(System.SR.Error_FailedBinding, path, type), innerException);
				}
				return true;
			}
			if (type == typeof(byte[]))
			{
				try
				{
					result = Convert.FromBase64String(value);
				}
				catch (FormatException innerException2)
				{
					error = new InvalidOperationException(System.SR.Format(System.SR.Error_FailedBinding, path, type), innerException2);
				}
				return true;
			}
			return false;
		}

		[RequiresUnreferencedCode("In case the type is non-primitive, the trimmer cannot statically analyze the object's type so its members may be trimmed.")]
		private static object ConvertValue([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type type, string value, string path)
		{
			TryConvertValue(type, value, path, out var result, out var error);
			if (error != null)
			{
				throw error;
			}
			return result;
		}

		private static bool TypeIsADictionaryInterface(Type type)
		{
			if (!type.IsInterface || !type.IsConstructedGenericType)
			{
				return false;
			}
			Type genericTypeDefinition = type.GetGenericTypeDefinition();
			if (!(genericTypeDefinition == typeof(IDictionary<, >)))
			{
				return genericTypeDefinition == typeof(IReadOnlyDictionary<, >);
			}
			return true;
		}

		private static bool IsImmutableArrayCompatibleInterface(Type type)
		{
			if (!type.IsInterface || !type.IsConstructedGenericType)
			{
				return false;
			}
			Type genericTypeDefinition = type.GetGenericTypeDefinition();
			if (!(genericTypeDefinition == typeof(IEnumerable<>)) && !(genericTypeDefinition == typeof(IReadOnlyCollection<>)))
			{
				return genericTypeDefinition == typeof(IReadOnlyList<>);
			}
			return true;
		}

		private static bool TypeIsASetInterface(Type type)
		{
			if (!type.IsInterface || !type.IsConstructedGenericType)
			{
				return false;
			}
			Type genericTypeDefinition = type.GetGenericTypeDefinition();
			return genericTypeDefinition == typeof(ISet<>);
		}

		private static Type FindOpenGenericInterface(Type expected, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.Interfaces)] Type actual)
		{
			if (actual.IsGenericType && actual.GetGenericTypeDefinition() == expected)
			{
				return actual;
			}
			Type[] interfaces = actual.GetInterfaces();
			Type[] array = interfaces;
			foreach (Type type in array)
			{
				if (type.IsGenericType && type.GetGenericTypeDefinition() == expected)
				{
					return type;
				}
			}
			return null;
		}

		private static List<PropertyInfo> GetAllProperties([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type type)
		{
			List<PropertyInfo> list = new List<PropertyInfo>();
			Type type2 = type;
			while (type2 != typeof(object))
			{
				PropertyInfo[] properties = type2.GetProperties(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
				PropertyInfo[] array = properties;
				foreach (PropertyInfo propertyInfo in array)
				{
					MethodInfo setMethod = propertyInfo.GetSetMethod(nonPublic: true);
					if ((object)setMethod == null || !setMethod.IsVirtual || setMethod == setMethod.GetBaseDefinition())
					{
						list.Add(propertyInfo);
					}
				}
				type2 = type2.BaseType;
			}
			return list;
		}

		[RequiresDynamicCode("Binding strongly typed objects to configuration values requires generating dynamic code at runtime, for example instantiating generic types.")]
		[RequiresUnreferencedCode("Cannot statically analyze property.PropertyType so its members may be trimmed.")]
		private static object BindParameter(ParameterInfo parameter, Type type, IConfiguration config, BinderOptions options)
		{
			string name = parameter.Name;
			if (name == null)
			{
				throw new InvalidOperationException(System.SR.Format(System.SR.Error_ParameterBeingBoundToIsUnnamed, type));
			}
			BindingPoint bindingPoint = new BindingPoint(config.GetSection(name).Value);
			if (bindingPoint.Value == null)
			{
				if (!ParameterDefaultValue.TryGetDefaultValue(parameter, out object defaultValue))
				{
					throw new InvalidOperationException(System.SR.Format(System.SR.Error_ParameterHasNoMatchingConfig, type, name));
				}
				bindingPoint.SetValue(defaultValue);
			}
			BindInstance(parameter.ParameterType, bindingPoint, (IConfiguration)(object)config.GetSection(name), options);
			return bindingPoint.Value;
		}

		private static string GetPropertyName(MemberInfo property)
		{
			System.ThrowHelper.ThrowIfNull(property, "property");
			foreach (CustomAttributeData customAttributesDatum in property.GetCustomAttributesData())
			{
				if (!(customAttributesDatum.AttributeType != typeof(ConfigurationKeyNameAttribute)))
				{
					if (customAttributesDatum.ConstructorArguments.Count != 1)
					{
						break;
					}
					string text = customAttributesDatum.ConstructorArguments[0].Value?.ToString();
					return (!string.IsNullOrWhiteSpace(text)) ? text : property.Name;
				}
			}
			return property.Name;
		}
	}
}

BepInEx/plugins/SlopCrew.Plugin/Microsoft.Extensions.Configuration.CommandLine.dll

Decompiled 8 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using FxResources.Microsoft.Extensions.Configuration.CommandLine;
using Microsoft.CodeAnalysis;
using Microsoft.Extensions.Configuration.CommandLine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: InternalsVisibleTo("Microsoft.Extensions.Configuration.CommandLine.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: AssemblyMetadata(".NETFrameworkAssembly", "")]
[assembly: AssemblyMetadata("Serviceable", "True")]
[assembly: AssemblyMetadata("PreferInbox", "True")]
[assembly: AssemblyDefaultAlias("Microsoft.Extensions.Configuration.CommandLine")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: CLSCompliant(true)]
[assembly: AssemblyMetadata("IsTrimmable", "True")]
[assembly: DefaultDllImportSearchPaths(DllImportSearchPath.System32 | DllImportSearchPath.AssemblyDirectory)]
[assembly: AssemblyCompany("Microsoft Corporation")]
[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")]
[assembly: AssemblyDescription("Command line configuration provider implementation for Microsoft.Extensions.Configuration.")]
[assembly: AssemblyFileVersion("7.0.22.51805")]
[assembly: AssemblyInformationalVersion("7.0.0+d099f075e45d2aa6007a22b71b45a08758559f80")]
[assembly: AssemblyProduct("Microsoft® .NET")]
[assembly: AssemblyTitle("Microsoft.Extensions.Configuration.CommandLine")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/dotnet/runtime")]
[assembly: AssemblyVersion("7.0.0.0")]
[module: RefSafetyRules(11)]
[module: System.Runtime.CompilerServices.NullablePublicOnly(true)]
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 NullablePublicOnlyAttribute : Attribute
	{
		public readonly bool IncludesInternals;

		public NullablePublicOnlyAttribute(bool P_0)
		{
			IncludesInternals = 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 FxResources.Microsoft.Extensions.Configuration.CommandLine
{
	internal static class SR
	{
	}
}
namespace System
{
	internal static class ThrowHelper
	{
		internal static void ThrowIfNull(object? argument, [CallerArgumentExpression("argument")] string? paramName = null)
		{
			if (argument == null)
			{
				Throw(paramName);
			}
		}

		private static void Throw(string paramName)
		{
			throw new ArgumentNullException(paramName);
		}
	}
	internal static class SR
	{
		private static readonly bool s_usingResourceKeys = AppContext.TryGetSwitch("System.Resources.UseSystemResourceKeys", out var isEnabled) && isEnabled;

		private static ResourceManager s_resourceManager;

		internal static ResourceManager ResourceManager => s_resourceManager ?? (s_resourceManager = new ResourceManager(typeof(SR)));

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

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

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

		private static bool UsingResourceKeys()
		{
			return s_usingResourceKeys;
		}

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

		internal static string GetResourceString(string resourceKey, string defaultString)
		{
			string resourceString = GetResourceString(resourceKey);
			if (!(resourceKey == resourceString) && resourceString != null)
			{
				return resourceString;
			}
			return defaultString;
		}

		internal static string Format(string resourceFormat, object? p1)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1);
			}
			return string.Format(resourceFormat, p1);
		}

		internal static string Format(string resourceFormat, object? p1, object? p2)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2);
			}
			return string.Format(resourceFormat, p1, p2);
		}

		internal static string Format(string resourceFormat, object? p1, object? p2, object? p3)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2, p3);
			}
			return string.Format(resourceFormat, p1, p2, p3);
		}

		internal static string Format(string resourceFormat, params object?[]? args)
		{
			if (args != null)
			{
				if (UsingResourceKeys())
				{
					return resourceFormat + ", " + string.Join(", ", args);
				}
				return string.Format(resourceFormat, args);
			}
			return resourceFormat;
		}

		internal static string Format(IFormatProvider? provider, string resourceFormat, object? p1)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1);
			}
			return string.Format(provider, resourceFormat, p1);
		}

		internal static string Format(IFormatProvider? provider, string resourceFormat, object? p1, object? p2)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2);
			}
			return string.Format(provider, resourceFormat, p1, p2);
		}

		internal static string Format(IFormatProvider? provider, string resourceFormat, object? p1, object? p2, object? p3)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2, p3);
			}
			return string.Format(provider, resourceFormat, p1, p2, p3);
		}

		internal static string Format(IFormatProvider? provider, string resourceFormat, params object?[]? args)
		{
			if (args != null)
			{
				if (UsingResourceKeys())
				{
					return resourceFormat + ", " + string.Join(", ", args);
				}
				return string.Format(provider, resourceFormat, args);
			}
			return resourceFormat;
		}
	}
}
namespace System.Diagnostics.CodeAnalysis
{
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)]
	internal sealed class AllowNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)]
	internal sealed class DisallowNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)]
	internal sealed class MaybeNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)]
	internal sealed class NotNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class MaybeNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public MaybeNullWhenAttribute(bool returnValue)
		{
			ReturnValue = returnValue;
		}
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class NotNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public NotNullWhenAttribute(bool returnValue)
		{
			ReturnValue = returnValue;
		}
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = true, Inherited = false)]
	internal sealed class NotNullIfNotNullAttribute : Attribute
	{
		public string ParameterName { get; }

		public NotNullIfNotNullAttribute(string parameterName)
		{
			ParameterName = parameterName;
		}
	}
	[AttributeUsage(AttributeTargets.Method, Inherited = false)]
	internal sealed class DoesNotReturnAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class DoesNotReturnIfAttribute : Attribute
	{
		public bool ParameterValue { get; }

		public DoesNotReturnIfAttribute(bool parameterValue)
		{
			ParameterValue = parameterValue;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	internal sealed class MemberNotNullAttribute : Attribute
	{
		public string[] Members { get; }

		public MemberNotNullAttribute(string member)
		{
			Members = new string[1] { member };
		}

		public MemberNotNullAttribute(params string[] members)
		{
			Members = members;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	internal sealed class MemberNotNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public string[] Members { get; }

		public MemberNotNullWhenAttribute(bool returnValue, string member)
		{
			ReturnValue = returnValue;
			Members = new string[1] { member };
		}

		public MemberNotNullWhenAttribute(bool returnValue, params string[] members)
		{
			ReturnValue = returnValue;
			Members = members;
		}
	}
}
namespace System.Runtime.InteropServices
{
	[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
	internal sealed class LibraryImportAttribute : Attribute
	{
		public string LibraryName { get; }

		public string? EntryPoint { get; set; }

		public StringMarshalling StringMarshalling { get; set; }

		public Type? StringMarshallingCustomType { get; set; }

		public bool SetLastError { get; set; }

		public LibraryImportAttribute(string libraryName)
		{
			LibraryName = libraryName;
		}
	}
	internal enum StringMarshalling
	{
		Custom,
		Utf8,
		Utf16
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
	internal sealed class CallerArgumentExpressionAttribute : Attribute
	{
		public string ParameterName { get; }

		public CallerArgumentExpressionAttribute(string parameterName)
		{
			ParameterName = parameterName;
		}
	}
}
namespace Microsoft.Extensions.Configuration
{
	public static class CommandLineConfigurationExtensions
	{
		public static IConfigurationBuilder AddCommandLine(this IConfigurationBuilder configurationBuilder, string[] args)
		{
			return configurationBuilder.AddCommandLine(args, null);
		}

		public static IConfigurationBuilder AddCommandLine(this IConfigurationBuilder configurationBuilder, string[] args, IDictionary<string, string>? switchMappings)
		{
			configurationBuilder.Add((IConfigurationSource)(object)new CommandLineConfigurationSource
			{
				Args = args,
				SwitchMappings = switchMappings
			});
			return configurationBuilder;
		}

		public static IConfigurationBuilder AddCommandLine(this IConfigurationBuilder builder, Action<CommandLineConfigurationSource>? configureSource)
		{
			return ConfigurationExtensions.Add<CommandLineConfigurationSource>(builder, configureSource);
		}
	}
}
namespace Microsoft.Extensions.Configuration.CommandLine
{
	public class CommandLineConfigurationProvider : ConfigurationProvider
	{
		private readonly Dictionary<string, string> _switchMappings;

		protected IEnumerable<string> Args { get; private set; }

		public CommandLineConfigurationProvider(IEnumerable<string> args, IDictionary<string, string>? switchMappings = null)
		{
			System.ThrowHelper.ThrowIfNull(args, "args");
			Args = args;
			if (switchMappings != null)
			{
				_switchMappings = GetValidatedSwitchMappingsCopy(switchMappings);
			}
		}

		public override void Load()
		{
			Dictionary<string, string> dictionary = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
			using (IEnumerator<string> enumerator = Args.GetEnumerator())
			{
				while (enumerator.MoveNext())
				{
					string text = enumerator.Current;
					int num = 0;
					if (text.StartsWith("--"))
					{
						num = 2;
					}
					else if (text.StartsWith("-"))
					{
						num = 1;
					}
					else if (text.StartsWith("/"))
					{
						text = "--" + text.Substring(1);
						num = 2;
					}
					int num2 = text.IndexOf('=');
					string key;
					string value2;
					if (num2 < 0)
					{
						if (num == 0)
						{
							continue;
						}
						if (_switchMappings != null && _switchMappings.TryGetValue(text, out var value))
						{
							key = value;
						}
						else
						{
							if (num == 1)
							{
								continue;
							}
							key = text.Substring(num);
						}
						if (!enumerator.MoveNext())
						{
							continue;
						}
						value2 = enumerator.Current;
					}
					else
					{
						string key2 = text.Substring(0, num2);
						if (_switchMappings != null && _switchMappings.TryGetValue(key2, out var value3))
						{
							key = value3;
						}
						else
						{
							if (num == 1)
							{
								throw new FormatException(System.SR.Format(System.SR.Error_ShortSwitchNotDefined, text));
							}
							key = text.Substring(num, num2 - num);
						}
						value2 = text.Substring(num2 + 1);
					}
					dictionary[key] = value2;
				}
			}
			((ConfigurationProvider)this).Data = dictionary;
		}

		private static Dictionary<string, string> GetValidatedSwitchMappingsCopy(IDictionary<string, string> switchMappings)
		{
			Dictionary<string, string> dictionary = new Dictionary<string, string>(switchMappings.Count, StringComparer.OrdinalIgnoreCase);
			foreach (KeyValuePair<string, string> switchMapping in switchMappings)
			{
				if (!switchMapping.Key.StartsWith("-") && !switchMapping.Key.StartsWith("--"))
				{
					throw new ArgumentException(System.SR.Format(System.SR.Error_InvalidSwitchMapping, switchMapping.Key), "switchMappings");
				}
				if (dictionary.ContainsKey(switchMapping.Key))
				{
					throw new ArgumentException(System.SR.Format(System.SR.Error_DuplicatedKeyInSwitchMappings, switchMapping.Key), "switchMappings");
				}
				dictionary.Add(switchMapping.Key, switchMapping.Value);
			}
			return dictionary;
		}
	}
	public class CommandLineConfigurationSource : IConfigurationSource
	{
		public IDictionary<string, string>? SwitchMappings { get; set; }

		public IEnumerable<string> Args { get; set; } = Array.Empty<string>();


		public IConfigurationProvider Build(IConfigurationBuilder builder)
		{
			return (IConfigurationProvider)(object)new CommandLineConfigurationProvider(Args, SwitchMappings);
		}
	}
}

BepInEx/plugins/SlopCrew.Plugin/Microsoft.Extensions.Configuration.dll

Decompiled 8 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Threading;
using FxResources.Microsoft.Extensions.Configuration;
using Microsoft.CodeAnalysis;
using Microsoft.Extensions.Configuration.Memory;
using Microsoft.Extensions.Primitives;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: InternalsVisibleTo("Microsoft.Extensions.Configuration.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: AssemblyMetadata(".NETFrameworkAssembly", "")]
[assembly: AssemblyMetadata("Serviceable", "True")]
[assembly: AssemblyMetadata("PreferInbox", "True")]
[assembly: AssemblyDefaultAlias("Microsoft.Extensions.Configuration")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: CLSCompliant(true)]
[assembly: AssemblyMetadata("IsTrimmable", "True")]
[assembly: DefaultDllImportSearchPaths(DllImportSearchPath.System32 | DllImportSearchPath.AssemblyDirectory)]
[assembly: AssemblyCompany("Microsoft Corporation")]
[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")]
[assembly: AssemblyDescription("Implementation of key-value pair based configuration for Microsoft.Extensions.Configuration. Includes the memory configuration provider.")]
[assembly: AssemblyFileVersion("7.0.22.51805")]
[assembly: AssemblyInformationalVersion("7.0.0+d099f075e45d2aa6007a22b71b45a08758559f80")]
[assembly: AssemblyProduct("Microsoft® .NET")]
[assembly: AssemblyTitle("Microsoft.Extensions.Configuration")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/dotnet/runtime")]
[assembly: AssemblyVersion("7.0.0.0")]
[module: RefSafetyRules(11)]
[module: System.Runtime.CompilerServices.NullablePublicOnly(true)]
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 NullablePublicOnlyAttribute : Attribute
	{
		public readonly bool IncludesInternals;

		public NullablePublicOnlyAttribute(bool P_0)
		{
			IncludesInternals = 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 FxResources.Microsoft.Extensions.Configuration
{
	internal static class SR
	{
	}
}
namespace System
{
	internal static class ThrowHelper
	{
		internal static void ThrowIfNull(object? argument, [CallerArgumentExpression("argument")] string? paramName = null)
		{
			if (argument == null)
			{
				Throw(paramName);
			}
		}

		private static void Throw(string paramName)
		{
			throw new ArgumentNullException(paramName);
		}
	}
	internal static class SR
	{
		private static readonly bool s_usingResourceKeys = AppContext.TryGetSwitch("System.Resources.UseSystemResourceKeys", out var isEnabled) && isEnabled;

		private static ResourceManager s_resourceManager;

		internal static ResourceManager ResourceManager => s_resourceManager ?? (s_resourceManager = new ResourceManager(typeof(SR)));

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

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

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

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

		private static bool UsingResourceKeys()
		{
			return s_usingResourceKeys;
		}

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

		internal static string GetResourceString(string resourceKey, string defaultString)
		{
			string resourceString = GetResourceString(resourceKey);
			if (!(resourceKey == resourceString) && resourceString != null)
			{
				return resourceString;
			}
			return defaultString;
		}

		internal static string Format(string resourceFormat, object? p1)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1);
			}
			return string.Format(resourceFormat, p1);
		}

		internal static string Format(string resourceFormat, object? p1, object? p2)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2);
			}
			return string.Format(resourceFormat, p1, p2);
		}

		internal static string Format(string resourceFormat, object? p1, object? p2, object? p3)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2, p3);
			}
			return string.Format(resourceFormat, p1, p2, p3);
		}

		internal static string Format(string resourceFormat, params object?[]? args)
		{
			if (args != null)
			{
				if (UsingResourceKeys())
				{
					return resourceFormat + ", " + string.Join(", ", args);
				}
				return string.Format(resourceFormat, args);
			}
			return resourceFormat;
		}

		internal static string Format(IFormatProvider? provider, string resourceFormat, object? p1)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1);
			}
			return string.Format(provider, resourceFormat, p1);
		}

		internal static string Format(IFormatProvider? provider, string resourceFormat, object? p1, object? p2)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2);
			}
			return string.Format(provider, resourceFormat, p1, p2);
		}

		internal static string Format(IFormatProvider? provider, string resourceFormat, object? p1, object? p2, object? p3)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2, p3);
			}
			return string.Format(provider, resourceFormat, p1, p2, p3);
		}

		internal static string Format(IFormatProvider? provider, string resourceFormat, params object?[]? args)
		{
			if (args != null)
			{
				if (UsingResourceKeys())
				{
					return resourceFormat + ", " + string.Join(", ", args);
				}
				return string.Format(provider, resourceFormat, args);
			}
			return resourceFormat;
		}
	}
}
namespace System.Diagnostics.CodeAnalysis
{
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)]
	internal sealed class AllowNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)]
	internal sealed class DisallowNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)]
	internal sealed class MaybeNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)]
	internal sealed class NotNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class MaybeNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public MaybeNullWhenAttribute(bool returnValue)
		{
			ReturnValue = returnValue;
		}
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class NotNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public NotNullWhenAttribute(bool returnValue)
		{
			ReturnValue = returnValue;
		}
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = true, Inherited = false)]
	internal sealed class NotNullIfNotNullAttribute : Attribute
	{
		public string ParameterName { get; }

		public NotNullIfNotNullAttribute(string parameterName)
		{
			ParameterName = parameterName;
		}
	}
	[AttributeUsage(AttributeTargets.Method, Inherited = false)]
	internal sealed class DoesNotReturnAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class DoesNotReturnIfAttribute : Attribute
	{
		public bool ParameterValue { get; }

		public DoesNotReturnIfAttribute(bool parameterValue)
		{
			ParameterValue = parameterValue;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	internal sealed class MemberNotNullAttribute : Attribute
	{
		public string[] Members { get; }

		public MemberNotNullAttribute(string member)
		{
			Members = new string[1] { member };
		}

		public MemberNotNullAttribute(params string[] members)
		{
			Members = members;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	internal sealed class MemberNotNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public string[] Members { get; }

		public MemberNotNullWhenAttribute(bool returnValue, string member)
		{
			ReturnValue = returnValue;
			Members = new string[1] { member };
		}

		public MemberNotNullWhenAttribute(bool returnValue, params string[] members)
		{
			ReturnValue = returnValue;
			Members = members;
		}
	}
}
namespace System.Runtime.InteropServices
{
	[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
	internal sealed class LibraryImportAttribute : Attribute
	{
		public string LibraryName { get; }

		public string? EntryPoint { get; set; }

		public StringMarshalling StringMarshalling { get; set; }

		public Type? StringMarshallingCustomType { get; set; }

		public bool SetLastError { get; set; }

		public LibraryImportAttribute(string libraryName)
		{
			LibraryName = libraryName;
		}
	}
	internal enum StringMarshalling
	{
		Custom,
		Utf8,
		Utf16
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
	internal sealed class CallerArgumentExpressionAttribute : Attribute
	{
		public string ParameterName { get; }

		public CallerArgumentExpressionAttribute(string parameterName)
		{
			ParameterName = parameterName;
		}
	}
}
namespace Microsoft.Extensions.Configuration
{
	public static class ChainedBuilderExtensions
	{
		public static IConfigurationBuilder AddConfiguration(this IConfigurationBuilder configurationBuilder, IConfiguration config)
		{
			return configurationBuilder.AddConfiguration(config, shouldDisposeConfiguration: false);
		}

		public static IConfigurationBuilder AddConfiguration(this IConfigurationBuilder configurationBuilder, IConfiguration config, bool shouldDisposeConfiguration)
		{
			System.ThrowHelper.ThrowIfNull(configurationBuilder, "configurationBuilder");
			System.ThrowHelper.ThrowIfNull(config, "config");
			configurationBuilder.Add((IConfigurationSource)(object)new ChainedConfigurationSource
			{
				Configuration = config,
				ShouldDisposeConfiguration = shouldDisposeConfiguration
			});
			return configurationBuilder;
		}
	}
	public class ChainedConfigurationProvider : IConfigurationProvider, IDisposable
	{
		private readonly IConfiguration _config;

		private readonly bool _shouldDisposeConfig;

		public IConfiguration Configuration => _config;

		public ChainedConfigurationProvider(ChainedConfigurationSource source)
		{
			System.ThrowHelper.ThrowIfNull(source, "source");
			_config = source.Configuration ?? throw new ArgumentException(System.SR.Format(System.SR.InvalidNullArgument, "source.Configuration"), "source");
			_shouldDisposeConfig = source.ShouldDisposeConfiguration;
		}

		public bool TryGet(string key, out string? value)
		{
			value = _config[key];
			return !string.IsNullOrEmpty(value);
		}

		public void Set(string key, string? value)
		{
			_config[key] = value;
		}

		public IChangeToken GetReloadToken()
		{
			return _config.GetReloadToken();
		}

		public void Load()
		{
		}

		public IEnumerable<string> GetChildKeys(IEnumerable<string> earlierKeys, string? parentPath)
		{
			IConfiguration obj;
			if (parentPath != null)
			{
				IConfiguration section = (IConfiguration)(object)_config.GetSection(parentPath);
				obj = section;
			}
			else
			{
				obj = _config;
			}
			IConfiguration val = obj;
			List<string> list = new List<string>();
			foreach (IConfigurationSection child in val.GetChildren())
			{
				list.Add(child.Key);
			}
			list.AddRange(earlierKeys);
			list.Sort(ConfigurationKeyComparer.Comparison);
			return list;
		}

		public void Dispose()
		{
			if (_shouldDisposeConfig)
			{
				(_config as IDisposable)?.Dispose();
			}
		}
	}
	public class ChainedConfigurationSource : IConfigurationSource
	{
		public IConfiguration? Configuration
		{
			get; [param: DisallowNull]
			set;
		}

		public bool ShouldDisposeConfiguration { get; set; }

		public IConfigurationProvider Build(IConfigurationBuilder builder)
		{
			return (IConfigurationProvider)(object)new ChainedConfigurationProvider(this);
		}
	}
	public class ConfigurationBuilder : IConfigurationBuilder
	{
		public IList<IConfigurationSource> Sources { get; } = new List<IConfigurationSource>();


		public IDictionary<string, object> Properties { get; } = new Dictionary<string, object>();


		public IConfigurationBuilder Add(IConfigurationSource source)
		{
			System.ThrowHelper.ThrowIfNull(source, "source");
			Sources.Add(source);
			return (IConfigurationBuilder)(object)this;
		}

		public IConfigurationRoot Build()
		{
			List<IConfigurationProvider> list = new List<IConfigurationProvider>();
			foreach (IConfigurationSource source in Sources)
			{
				IConfigurationProvider item = source.Build((IConfigurationBuilder)(object)this);
				list.Add(item);
			}
			return (IConfigurationRoot)(object)new ConfigurationRoot(list);
		}
	}
	public class ConfigurationKeyComparer : IComparer<string>
	{
		private const char KeyDelimiter = ':';

		public static ConfigurationKeyComparer Instance { get; } = new ConfigurationKeyComparer();


		internal static Comparison<string> Comparison { get; } = Instance.Compare;


		public int Compare(string? x, string? y)
		{
			ReadOnlySpan<char> readOnlySpan = x.AsSpan();
			ReadOnlySpan<char> readOnlySpan2 = y.AsSpan();
			readOnlySpan = SkipAheadOnDelimiter(readOnlySpan);
			readOnlySpan2 = SkipAheadOnDelimiter(readOnlySpan2);
			while (!readOnlySpan.IsEmpty && !readOnlySpan2.IsEmpty)
			{
				int num = readOnlySpan.IndexOf(':');
				int num2 = readOnlySpan2.IndexOf(':');
				int num3 = Compare((num == -1) ? readOnlySpan : readOnlySpan.Slice(0, num), (num2 == -1) ? readOnlySpan2 : readOnlySpan2.Slice(0, num2));
				if (num3 != 0)
				{
					return num3;
				}
				readOnlySpan = ((num == -1) ? default(ReadOnlySpan<char>) : SkipAheadOnDelimiter(readOnlySpan.Slice(num + 1)));
				readOnlySpan2 = ((num2 == -1) ? default(ReadOnlySpan<char>) : SkipAheadOnDelimiter(readOnlySpan2.Slice(num2 + 1)));
			}
			if (!readOnlySpan.IsEmpty)
			{
				return 1;
			}
			if (!readOnlySpan2.IsEmpty)
			{
				return -1;
			}
			return 0;
			static int Compare(ReadOnlySpan<char> a, ReadOnlySpan<char> b)
			{
				int result;
				bool flag = int.TryParse(a.ToString(), out result);
				int result2;
				bool flag2 = int.TryParse(b.ToString(), out result2);
				if (!flag && !flag2)
				{
					return a.CompareTo(b, StringComparison.OrdinalIgnoreCase);
				}
				if (flag && flag2)
				{
					return result - result2;
				}
				return (!flag) ? 1 : (-1);
			}
			static ReadOnlySpan<char> SkipAheadOnDelimiter(ReadOnlySpan<char> a)
			{
				while (!a.IsEmpty && a[0] == ':')
				{
					a = a.Slice(1);
				}
				return a;
			}
		}
	}
	public sealed class ConfigurationManager : IConfigurationBuilder, IConfigurationRoot, IConfiguration, IDisposable
	{
		private sealed class ConfigurationSources : IList<IConfigurationSource>, ICollection<IConfigurationSource>, IEnumerable<IConfigurationSource>, IEnumerable
		{
			private readonly List<IConfigurationSource> _sources = new List<IConfigurationSource>();

			private readonly ConfigurationManager _config;

			public IConfigurationSource this[int index]
			{
				get
				{
					return _sources[index];
				}
				set
				{
					_sources[index] = value;
					_config.ReloadSources();
				}
			}

			public int Count => _sources.Count;

			public bool IsReadOnly => false;

			public ConfigurationSources(ConfigurationManager config)
			{
				_config = config;
			}

			public void Add(IConfigurationSource source)
			{
				_sources.Add(source);
				_config.AddSource(source);
			}

			public void Clear()
			{
				_sources.Clear();
				_config.ReloadSources();
			}

			public bool Contains(IConfigurationSource source)
			{
				return _sources.Contains(source);
			}

			public void CopyTo(IConfigurationSource[] array, int arrayIndex)
			{
				_sources.CopyTo(array, arrayIndex);
			}

			public IEnumerator<IConfigurationSource> GetEnumerator()
			{
				return _sources.GetEnumerator();
			}

			public int IndexOf(IConfigurationSource source)
			{
				return _sources.IndexOf(source);
			}

			public void Insert(int index, IConfigurationSource source)
			{
				_sources.Insert(index, source);
				_config.ReloadSources();
			}

			public bool Remove(IConfigurationSource source)
			{
				bool result = _sources.Remove(source);
				_config.ReloadSources();
				return result;
			}

			public void RemoveAt(int index)
			{
				_sources.RemoveAt(index);
				_config.ReloadSources();
			}

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

		private sealed class ConfigurationBuilderProperties : IDictionary<string, object>, ICollection<KeyValuePair<string, object>>, IEnumerable<KeyValuePair<string, object>>, IEnumerable
		{
			private readonly Dictionary<string, object> _properties = new Dictionary<string, object>();

			private readonly ConfigurationManager _config;

			public object this[string key]
			{
				get
				{
					return _properties[key];
				}
				set
				{
					_properties[key] = value;
					_config.ReloadSources();
				}
			}

			public ICollection<string> Keys => _properties.Keys;

			public ICollection<object> Values => _properties.Values;

			public int Count => _properties.Count;

			public bool IsReadOnly => false;

			public ConfigurationBuilderProperties(ConfigurationManager config)
			{
				_config = config;
			}

			public void Add(string key, object value)
			{
				_properties.Add(key, value);
				_config.ReloadSources();
			}

			public void Add(KeyValuePair<string, object> item)
			{
				((ICollection<KeyValuePair<string, object>>)_properties).Add(item);
				_config.ReloadSources();
			}

			public void Clear()
			{
				_properties.Clear();
				_config.ReloadSources();
			}

			public bool Contains(KeyValuePair<string, object> item)
			{
				return _properties.Contains(item);
			}

			public bool ContainsKey(string key)
			{
				return _properties.ContainsKey(key);
			}

			public void CopyTo(KeyValuePair<string, object>[] array, int arrayIndex)
			{
				((ICollection<KeyValuePair<string, object>>)_properties).CopyTo(array, arrayIndex);
			}

			public IEnumerator<KeyValuePair<string, object>> GetEnumerator()
			{
				return _properties.GetEnumerator();
			}

			public bool Remove(string key)
			{
				bool result = _properties.Remove(key);
				_config.ReloadSources();
				return result;
			}

			public bool Remove(KeyValuePair<string, object> item)
			{
				bool result = ((ICollection<KeyValuePair<string, object>>)_properties).Remove(item);
				_config.ReloadSources();
				return result;
			}

			public bool TryGetValue(string key, [NotNullWhen(true)] out object value)
			{
				return _properties.TryGetValue(key, out value);
			}

			IEnumerator IEnumerable.GetEnumerator()
			{
				return _properties.GetEnumerator();
			}
		}

		private readonly ConfigurationSources _sources;

		private readonly ConfigurationBuilderProperties _properties;

		private readonly ReferenceCountedProviderManager _providerManager = new ReferenceCountedProviderManager();

		private readonly List<IDisposable> _changeTokenRegistrations = new List<IDisposable>();

		private ConfigurationReloadToken _changeToken = new ConfigurationReloadToken();

		public string? this[string key]
		{
			get
			{
				using ReferenceCountedProviders referenceCountedProviders = _providerManager.GetReference();
				return ConfigurationRoot.GetConfiguration(referenceCountedProviders.Providers, key);
			}
			set
			{
				using ReferenceCountedProviders referenceCountedProviders = _providerManager.GetReference();
				ConfigurationRoot.SetConfiguration(referenceCountedProviders.Providers, key, value);
			}
		}

		IDictionary<string, object> IConfigurationBuilder.Properties => _properties;

		public IList<IConfigurationSource> Sources => _sources;

		IEnumerable<IConfigurationProvider> IConfigurationRoot.Providers => _providerManager.NonReferenceCountedProviders;

		public ConfigurationManager()
		{
			_sources = new ConfigurationSources(this);
			_properties = new ConfigurationBuilderProperties(this);
			_sources.Add((IConfigurationSource)(object)new MemoryConfigurationSource());
		}

		public IConfigurationSection GetSection(string key)
		{
			return (IConfigurationSection)(object)new ConfigurationSection((IConfigurationRoot)(object)this, key);
		}

		public IEnumerable<IConfigurationSection> GetChildren()
		{
			return ((IConfigurationRoot)(object)this).GetChildrenImplementation(null);
		}

		public void Dispose()
		{
			DisposeRegistrations();
			_providerManager.Dispose();
		}

		IConfigurationBuilder IConfigurationBuilder.Add(IConfigurationSource source)
		{
			System.ThrowHelper.ThrowIfNull(source, "source");
			_sources.Add(source);
			return (IConfigurationBuilder)(object)this;
		}

		IConfigurationRoot IConfigurationBuilder.Build()
		{
			return (IConfigurationRoot)(object)this;
		}

		IChangeToken IConfiguration.GetReloadToken()
		{
			return (IChangeToken)(object)_changeToken;
		}

		void IConfigurationRoot.Reload()
		{
			using (ReferenceCountedProviders referenceCountedProviders = _providerManager.GetReference())
			{
				foreach (IConfigurationProvider provider in referenceCountedProviders.Providers)
				{
					provider.Load();
				}
			}
			RaiseChanged();
		}

		internal ReferenceCountedProviders GetProvidersReference()
		{
			return _providerManager.GetReference();
		}

		private void RaiseChanged()
		{
			ConfigurationReloadToken configurationReloadToken = Interlocked.Exchange(ref _changeToken, new ConfigurationReloadToken());
			configurationReloadToken.OnReload();
		}

		private void AddSource(IConfigurationSource source)
		{
			IConfigurationProvider val = source.Build((IConfigurationBuilder)(object)this);
			val.Load();
			_changeTokenRegistrations.Add(ChangeToken.OnChange((Func<IChangeToken>)val.GetReloadToken, (Action)RaiseChanged));
			_providerManager.AddProvider(val);
			RaiseChanged();
		}

		private void ReloadSources()
		{
			DisposeRegistrations();
			_changeTokenRegistrations.Clear();
			List<IConfigurationProvider> list = new List<IConfigurationProvider>();
			foreach (IConfigurationSource source in _sources)
			{
				list.Add(source.Build((IConfigurationBuilder)(object)this));
			}
			foreach (IConfigurationProvider item in list)
			{
				item.Load();
				_changeTokenRegistrations.Add(ChangeToken.OnChange((Func<IChangeToken>)item.GetReloadToken, (Action)RaiseChanged));
			}
			_providerManager.ReplaceProviders(list);
			RaiseChanged();
		}

		private void DisposeRegistrations()
		{
			foreach (IDisposable changeTokenRegistration in _changeTokenRegistrations)
			{
				changeTokenRegistration.Dispose();
			}
		}
	}
	public abstract class ConfigurationProvider : IConfigurationProvider
	{
		private ConfigurationReloadToken _reloadToken = new ConfigurationReloadToken();

		protected IDictionary<string, string?> Data { get; set; }

		protected ConfigurationProvider()
		{
			Data = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
		}

		public virtual bool TryGet(string key, out string? value)
		{
			return Data.TryGetValue(key, out value);
		}

		public virtual void Set(string key, string? value)
		{
			Data[key] = value;
		}

		public virtual void Load()
		{
		}

		public virtual IEnumerable<string> GetChildKeys(IEnumerable<string> earlierKeys, string? parentPath)
		{
			List<string> list = new List<string>();
			if (parentPath == null)
			{
				foreach (KeyValuePair<string, string> datum in Data)
				{
					list.Add(Segment(datum.Key, 0));
				}
			}
			else
			{
				foreach (KeyValuePair<string, string> datum2 in Data)
				{
					if (datum2.Key.Length > parentPath.Length && datum2.Key.StartsWith(parentPath, StringComparison.OrdinalIgnoreCase) && datum2.Key[parentPath.Length] == ':')
					{
						list.Add(Segment(datum2.Key, parentPath.Length + 1));
					}
				}
			}
			list.AddRange(earlierKeys);
			list.Sort(ConfigurationKeyComparer.Comparison);
			return list;
		}

		private static string Segment(string key, int prefixLength)
		{
			int num = key.IndexOf(ConfigurationPath.KeyDelimiter, prefixLength, StringComparison.OrdinalIgnoreCase);
			if (num >= 0)
			{
				return key.Substring(prefixLength, num - prefixLength);
			}
			return key.Substring(prefixLength);
		}

		public IChangeToken GetReloadToken()
		{
			return (IChangeToken)(object)_reloadToken;
		}

		protected void OnReload()
		{
			ConfigurationReloadToken configurationReloadToken = Interlocked.Exchange(ref _reloadToken, new ConfigurationReloadToken());
			configurationReloadToken.OnReload();
		}

		public override string ToString()
		{
			return GetType().Name ?? "";
		}
	}
	public class ConfigurationReloadToken : IChangeToken
	{
		private CancellationTokenSource _cts = new CancellationTokenSource();

		public bool ActiveChangeCallbacks => true;

		public bool HasChanged => _cts.IsCancellationRequested;

		public IDisposable RegisterChangeCallback(Action<object?> callback, object? state)
		{
			return _cts.Token.Register(callback, state);
		}

		public void OnReload()
		{
			_cts.Cancel();
		}
	}
	public class ConfigurationRoot : IConfigurationRoot, IConfiguration, IDisposable
	{
		private readonly IList<IConfigurationProvider> _providers;

		private readonly IList<IDisposable> _changeTokenRegistrations;

		private ConfigurationReloadToken _changeToken = new ConfigurationReloadToken();

		public IEnumerable<IConfigurationProvider> Providers => _providers;

		public string? this[string key]
		{
			get
			{
				return GetConfiguration(_providers, key);
			}
			set
			{
				SetConfiguration(_providers, key, value);
			}
		}

		public ConfigurationRoot(IList<IConfigurationProvider> providers)
		{
			System.ThrowHelper.ThrowIfNull(providers, "providers");
			_providers = providers;
			_changeTokenRegistrations = new List<IDisposable>(providers.Count);
			foreach (IConfigurationProvider provider in providers)
			{
				provider.Load();
				_changeTokenRegistrations.Add(ChangeToken.OnChange((Func<IChangeToken>)provider.GetReloadToken, (Action)RaiseChanged));
			}
		}

		public IEnumerable<IConfigurationSection> GetChildren()
		{
			return ((IConfigurationRoot)(object)this).GetChildrenImplementation(null);
		}

		public IChangeToken GetReloadToken()
		{
			return (IChangeToken)(object)_changeToken;
		}

		public IConfigurationSection GetSection(string key)
		{
			return (IConfigurationSection)(object)new ConfigurationSection((IConfigurationRoot)(object)this, key);
		}

		public void Reload()
		{
			foreach (IConfigurationProvider provider in _providers)
			{
				provider.Load();
			}
			RaiseChanged();
		}

		private void RaiseChanged()
		{
			ConfigurationReloadToken configurationReloadToken = Interlocked.Exchange(ref _changeToken, new ConfigurationReloadToken());
			configurationReloadToken.OnReload();
		}

		public void Dispose()
		{
			foreach (IDisposable changeTokenRegistration in _changeTokenRegistrations)
			{
				changeTokenRegistration.Dispose();
			}
			foreach (IConfigurationProvider provider in _providers)
			{
				(provider as IDisposable)?.Dispose();
			}
		}

		internal static string? GetConfiguration(IList<IConfigurationProvider> providers, string key)
		{
			string result = default(string);
			for (int num = providers.Count - 1; num >= 0; num--)
			{
				IConfigurationProvider val = providers[num];
				if (val.TryGet(key, ref result))
				{
					return result;
				}
			}
			return null;
		}

		internal static void SetConfiguration(IList<IConfigurationProvider> providers, string key, string? value)
		{
			if (providers.Count == 0)
			{
				throw new InvalidOperationException(System.SR.Error_NoSources);
			}
			foreach (IConfigurationProvider provider in providers)
			{
				provider.Set(key, value);
			}
		}
	}
	public class ConfigurationSection : IConfigurationSection, IConfiguration
	{
		private readonly IConfigurationRoot _root;

		private readonly string _path;

		private string _key;

		public string Path => _path;

		public string Key => _key ?? (_key = ConfigurationPath.GetSectionKey(_path));

		public string? Value
		{
			get
			{
				return ((IConfiguration)_root)[Path];
			}
			set
			{
				((IConfiguration)_root)[Path] = value;
			}
		}

		public string? this[string key]
		{
			get
			{
				return ((IConfiguration)_root)[ConfigurationPath.Combine(new string[2] { Path, key })];
			}
			set
			{
				((IConfiguration)_root)[ConfigurationPath.Combine(new string[2] { Path, key })] = value;
			}
		}

		public ConfigurationSection(IConfigurationRoot root, string path)
		{
			System.ThrowHelper.ThrowIfNull(root, "root");
			System.ThrowHelper.ThrowIfNull(path, "path");
			_root = root;
			_path = path;
		}

		public IConfigurationSection GetSection(string key)
		{
			return ((IConfiguration)_root).GetSection(ConfigurationPath.Combine(new string[2] { Path, key }));
		}

		public IEnumerable<IConfigurationSection> GetChildren()
		{
			return _root.GetChildrenImplementation(Path);
		}

		public IChangeToken GetReloadToken()
		{
			return ((IConfiguration)_root).GetReloadToken();
		}
	}
	internal static class InternalConfigurationRootExtensions
	{
		internal static IEnumerable<IConfigurationSection> GetChildrenImplementation(this IConfigurationRoot root, string? path)
		{
			string path2 = path;
			IConfigurationRoot root2 = root;
			using ReferenceCountedProviders referenceCountedProviders = (root2 as ConfigurationManager)?.GetProvidersReference();
			IEnumerable<IConfigurationProvider> enumerable = referenceCountedProviders?.Providers;
			IEnumerable<IConfigurationProvider> source2 = enumerable ?? root2.Providers;
			IEnumerable<IConfigurationSection> enumerable2 = from key in source2.Aggregate(Enumerable.Empty<string>(), (IEnumerable<string> seed, IConfigurationProvider source) => source.GetChildKeys(seed, path2)).Distinct<string>(StringComparer.OrdinalIgnoreCase)
				select ((IConfiguration)root2).GetSection((path2 == null) ? key : ConfigurationPath.Combine(new string[2] { path2, key }));
			if (referenceCountedProviders == null)
			{
				return enumerable2;
			}
			return enumerable2.ToList();
		}
	}
	public static class MemoryConfigurationBuilderExtensions
	{
		public static IConfigurationBuilder AddInMemoryCollection(this IConfigurationBuilder configurationBuilder)
		{
			System.ThrowHelper.ThrowIfNull(configurationBuilder, "configurationBuilder");
			configurationBuilder.Add((IConfigurationSource)(object)new MemoryConfigurationSource());
			return configurationBuilder;
		}

		public static IConfigurationBuilder AddInMemoryCollection(this IConfigurationBuilder configurationBuilder, IEnumerable<KeyValuePair<string, string?>>? initialData)
		{
			System.ThrowHelper.ThrowIfNull(configurationBuilder, "configurationBuilder");
			configurationBuilder.Add((IConfigurationSource)(object)new MemoryConfigurationSource
			{
				InitialData = initialData
			});
			return configurationBuilder;
		}
	}
	internal abstract class ReferenceCountedProviders : IDisposable
	{
		private sealed class ActiveReferenceCountedProviders : ReferenceCountedProviders
		{
			private long _refCount = 1L;

			private volatile List<IConfigurationProvider> _providers;

			public override List<IConfigurationProvider> Providers
			{
				get
				{
					return _providers;
				}
				set
				{
					_providers = value;
				}
			}

			public override List<IConfigurationProvider> NonReferenceCountedProviders => _providers;

			public ActiveReferenceCountedProviders(List<IConfigurationProvider> providers)
			{
				_providers = providers;
			}

			public override void AddReference()
			{
				Interlocked.Increment(ref _refCount);
			}

			public override void Dispose()
			{
				if (Interlocked.Decrement(ref _refCount) != 0L)
				{
					return;
				}
				foreach (IConfigurationProvider provider in _providers)
				{
					(provider as IDisposable)?.Dispose();
				}
			}
		}

		private sealed class DisposedReferenceCountedProviders : ReferenceCountedProviders
		{
			public override List<IConfigurationProvider> Providers { get; set; }

			public override List<IConfigurationProvider> NonReferenceCountedProviders => Providers;

			public DisposedReferenceCountedProviders(List<IConfigurationProvider> providers)
			{
				Providers = providers;
			}

			public override void AddReference()
			{
			}

			public override void Dispose()
			{
			}
		}

		public abstract List<IConfigurationProvider> Providers { get; set; }

		public abstract List<IConfigurationProvider> NonReferenceCountedProviders { get; }

		public static ReferenceCountedProviders Create(List<IConfigurationProvider> providers)
		{
			return new ActiveReferenceCountedProviders(providers);
		}

		public static ReferenceCountedProviders CreateDisposed(List<IConfigurationProvider> providers)
		{
			return new DisposedReferenceCountedProviders(providers);
		}

		public abstract void AddReference();

		public abstract void Dispose();
	}
	internal sealed class ReferenceCountedProviderManager : IDisposable
	{
		private readonly object _replaceProvidersLock = new object();

		private ReferenceCountedProviders _refCountedProviders = ReferenceCountedProviders.Create(new List<IConfigurationProvider>());

		private bool _disposed;

		public IEnumerable<IConfigurationProvider> NonReferenceCountedProviders => _refCountedProviders.NonReferenceCountedProviders;

		public ReferenceCountedProviders GetReference()
		{
			lock (_replaceProvidersLock)
			{
				if (_disposed)
				{
					return ReferenceCountedProviders.CreateDisposed(_refCountedProviders.NonReferenceCountedProviders);
				}
				_refCountedProviders.AddReference();
				return _refCountedProviders;
			}
		}

		public void ReplaceProviders(List<IConfigurationProvider> providers)
		{
			ReferenceCountedProviders refCountedProviders = _refCountedProviders;
			lock (_replaceProvidersLock)
			{
				if (_disposed)
				{
					throw new ObjectDisposedException("ConfigurationManager");
				}
				_refCountedProviders = ReferenceCountedProviders.Create(providers);
			}
			refCountedProviders.Dispose();
		}

		public void AddProvider(IConfigurationProvider provider)
		{
			lock (_replaceProvidersLock)
			{
				if (_disposed)
				{
					throw new ObjectDisposedException("ConfigurationManager");
				}
				_refCountedProviders.Providers = new List<IConfigurationProvider>(_refCountedProviders.Providers) { provider };
			}
		}

		public void Dispose()
		{
			ReferenceCountedProviders refCountedProviders = _refCountedProviders;
			lock (_replaceProvidersLock)
			{
				_disposed = true;
			}
			refCountedProviders.Dispose();
		}
	}
	public abstract class StreamConfigurationProvider : ConfigurationProvider
	{
		private bool _loaded;

		public StreamConfigurationSource Source { get; }

		public StreamConfigurationProvider(StreamConfigurationSource source)
		{
			System.ThrowHelper.ThrowIfNull(source, "source");
			Source = source;
		}

		public abstract void Load(Stream stream);

		public override void Load()
		{
			if (_loaded)
			{
				throw new InvalidOperationException(System.SR.StreamConfigurationProvidersAlreadyLoaded);
			}
			if (Source.Stream == null)
			{
				throw new InvalidOperationException(System.SR.StreamConfigurationSourceStreamCannotBeNull);
			}
			Load(Source.Stream);
			_loaded = true;
		}
	}
	public abstract class StreamConfigurationSource : IConfigurationSource
	{
		public Stream? Stream
		{
			get; [param: DisallowNull]
			set;
		}

		public abstract IConfigurationProvider Build(IConfigurationBuilder builder);
	}
}
namespace Microsoft.Extensions.Configuration.Memory
{
	public class MemoryConfigurationProvider : ConfigurationProvider, IEnumerable<KeyValuePair<string, string?>>, IEnumerable
	{
		private readonly MemoryConfigurationSource _source;

		public MemoryConfigurationProvider(MemoryConfigurationSource source)
		{
			System.ThrowHelper.ThrowIfNull(source, "source");
			_source = source;
			if (_source.InitialData == null)
			{
				return;
			}
			foreach (KeyValuePair<string, string> initialDatum in _source.InitialData)
			{
				base.Data.Add(initialDatum.Key, initialDatum.Value);
			}
		}

		public void Add(string key, string? value)
		{
			base.Data.Add(key, value);
		}

		public IEnumerator<KeyValuePair<string, string?>> GetEnumerator()
		{
			return base.Data.GetEnumerator();
		}

		IEnumerator IEnumerable.GetEnumerator()
		{
			return GetEnumerator();
		}
	}
	public class MemoryConfigurationSource : IConfigurationSource
	{
		public IEnumerable<KeyValuePair<string, string?>>? InitialData { get; set; }

		public IConfigurationProvider Build(IConfigurationBuilder builder)
		{
			return (IConfigurationProvider)(object)new MemoryConfigurationProvider(this);
		}
	}
}

BepInEx/plugins/SlopCrew.Plugin/Microsoft.Extensions.Configuration.EnvironmentVariables.dll

Decompiled 8 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using Microsoft.CodeAnalysis;
using Microsoft.Extensions.Configuration.EnvironmentVariables;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: InternalsVisibleTo("Microsoft.Extensions.Configuration.EnvironmentVariables.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: AssemblyMetadata(".NETFrameworkAssembly", "")]
[assembly: AssemblyMetadata("Serviceable", "True")]
[assembly: AssemblyMetadata("PreferInbox", "True")]
[assembly: AssemblyDefaultAlias("Microsoft.Extensions.Configuration.EnvironmentVariables")]
[assembly: CLSCompliant(true)]
[assembly: AssemblyMetadata("IsTrimmable", "True")]
[assembly: DefaultDllImportSearchPaths(DllImportSearchPath.System32 | DllImportSearchPath.AssemblyDirectory)]
[assembly: AssemblyCompany("Microsoft Corporation")]
[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")]
[assembly: AssemblyDescription("Environment variables configuration provider implementation for Microsoft.Extensions.Configuration.")]
[assembly: AssemblyFileVersion("7.0.22.51805")]
[assembly: AssemblyInformationalVersion("7.0.0+d099f075e45d2aa6007a22b71b45a08758559f80")]
[assembly: AssemblyProduct("Microsoft® .NET")]
[assembly: AssemblyTitle("Microsoft.Extensions.Configuration.EnvironmentVariables")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/dotnet/runtime")]
[assembly: AssemblyVersion("7.0.0.0")]
[module: RefSafetyRules(11)]
[module: System.Runtime.CompilerServices.NullablePublicOnly(true)]
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 NullablePublicOnlyAttribute : Attribute
	{
		public readonly bool IncludesInternals;

		public NullablePublicOnlyAttribute(bool P_0)
		{
			IncludesInternals = 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 System.Diagnostics.CodeAnalysis
{
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)]
	internal sealed class AllowNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)]
	internal sealed class DisallowNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)]
	internal sealed class MaybeNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)]
	internal sealed class NotNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class MaybeNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public MaybeNullWhenAttribute(bool returnValue)
		{
			ReturnValue = returnValue;
		}
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class NotNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public NotNullWhenAttribute(bool returnValue)
		{
			ReturnValue = returnValue;
		}
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = true, Inherited = false)]
	internal sealed class NotNullIfNotNullAttribute : Attribute
	{
		public string ParameterName { get; }

		public NotNullIfNotNullAttribute(string parameterName)
		{
			ParameterName = parameterName;
		}
	}
	[AttributeUsage(AttributeTargets.Method, Inherited = false)]
	internal sealed class DoesNotReturnAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class DoesNotReturnIfAttribute : Attribute
	{
		public bool ParameterValue { get; }

		public DoesNotReturnIfAttribute(bool parameterValue)
		{
			ParameterValue = parameterValue;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	internal sealed class MemberNotNullAttribute : Attribute
	{
		public string[] Members { get; }

		public MemberNotNullAttribute(string member)
		{
			Members = new string[1] { member };
		}

		public MemberNotNullAttribute(params string[] members)
		{
			Members = members;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	internal sealed class MemberNotNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public string[] Members { get; }

		public MemberNotNullWhenAttribute(bool returnValue, string member)
		{
			ReturnValue = returnValue;
			Members = new string[1] { member };
		}

		public MemberNotNullWhenAttribute(bool returnValue, params string[] members)
		{
			ReturnValue = returnValue;
			Members = members;
		}
	}
}
namespace System.Runtime.InteropServices
{
	[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
	internal sealed class LibraryImportAttribute : Attribute
	{
		public string LibraryName { get; }

		public string? EntryPoint { get; set; }

		public StringMarshalling StringMarshalling { get; set; }

		public Type? StringMarshallingCustomType { get; set; }

		public bool SetLastError { get; set; }

		public LibraryImportAttribute(string libraryName)
		{
			LibraryName = libraryName;
		}
	}
	internal enum StringMarshalling
	{
		Custom,
		Utf8,
		Utf16
	}
}
namespace Microsoft.Extensions.Configuration
{
	public static class EnvironmentVariablesExtensions
	{
		public static IConfigurationBuilder AddEnvironmentVariables(this IConfigurationBuilder configurationBuilder)
		{
			configurationBuilder.Add((IConfigurationSource)(object)new EnvironmentVariablesConfigurationSource());
			return configurationBuilder;
		}

		public static IConfigurationBuilder AddEnvironmentVariables(this IConfigurationBuilder configurationBuilder, string? prefix)
		{
			configurationBuilder.Add((IConfigurationSource)(object)new EnvironmentVariablesConfigurationSource
			{
				Prefix = prefix
			});
			return configurationBuilder;
		}

		public static IConfigurationBuilder AddEnvironmentVariables(this IConfigurationBuilder builder, Action<EnvironmentVariablesConfigurationSource>? configureSource)
		{
			return ConfigurationExtensions.Add<EnvironmentVariablesConfigurationSource>(builder, configureSource);
		}
	}
}
namespace Microsoft.Extensions.Configuration.EnvironmentVariables
{
	public class EnvironmentVariablesConfigurationProvider : ConfigurationProvider
	{
		private const string MySqlServerPrefix = "MYSQLCONNSTR_";

		private const string SqlAzureServerPrefix = "SQLAZURECONNSTR_";

		private const string SqlServerPrefix = "SQLCONNSTR_";

		private const string CustomConnectionStringPrefix = "CUSTOMCONNSTR_";

		private readonly string _prefix;

		private readonly string _normalizedPrefix;

		public EnvironmentVariablesConfigurationProvider()
		{
			_prefix = string.Empty;
			_normalizedPrefix = string.Empty;
		}

		public EnvironmentVariablesConfigurationProvider(string? prefix)
		{
			_prefix = prefix ?? string.Empty;
			_normalizedPrefix = Normalize(_prefix);
		}

		public override void Load()
		{
			Load(Environment.GetEnvironmentVariables());
		}

		public override string ToString()
		{
			return ((object)this).GetType().Name + " Prefix: '" + _prefix + "'";
		}

		internal void Load(IDictionary envVariables)
		{
			Dictionary<string, string> data = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
			IDictionaryEnumerator dictionaryEnumerator = envVariables.GetEnumerator();
			try
			{
				while (dictionaryEnumerator.MoveNext())
				{
					string text = (string)dictionaryEnumerator.Entry.Key;
					string value = (string)dictionaryEnumerator.Entry.Value;
					if (text.StartsWith("MYSQLCONNSTR_", StringComparison.OrdinalIgnoreCase))
					{
						HandleMatchedConnectionStringPrefix(data, "MYSQLCONNSTR_", "MySql.Data.MySqlClient", text, value);
					}
					else if (text.StartsWith("SQLAZURECONNSTR_", StringComparison.OrdinalIgnoreCase))
					{
						HandleMatchedConnectionStringPrefix(data, "SQLAZURECONNSTR_", "System.Data.SqlClient", text, value);
					}
					else if (text.StartsWith("SQLCONNSTR_", StringComparison.OrdinalIgnoreCase))
					{
						HandleMatchedConnectionStringPrefix(data, "SQLCONNSTR_", "System.Data.SqlClient", text, value);
					}
					else if (text.StartsWith("CUSTOMCONNSTR_", StringComparison.OrdinalIgnoreCase))
					{
						HandleMatchedConnectionStringPrefix(data, "CUSTOMCONNSTR_", null, text, value);
					}
					else
					{
						AddIfNormalizedKeyMatchesPrefix(data, Normalize(text), value);
					}
				}
			}
			finally
			{
				IDisposable disposable = dictionaryEnumerator as IDisposable;
				if (disposable != null)
				{
					disposable.Dispose();
				}
			}
			((ConfigurationProvider)this).Data = data;
		}

		private void HandleMatchedConnectionStringPrefix(Dictionary<string, string> data, string connectionStringPrefix, string provider, string fullKey, string value)
		{
			string text = Normalize(fullKey.Substring(connectionStringPrefix.Length));
			AddIfNormalizedKeyMatchesPrefix(data, "ConnectionStrings:" + text, value);
			if (provider != null)
			{
				AddIfNormalizedKeyMatchesPrefix(data, "ConnectionStrings:" + text + "_ProviderName", provider);
			}
		}

		private void AddIfNormalizedKeyMatchesPrefix(Dictionary<string, string> data, string normalizedKey, string value)
		{
			if (normalizedKey.StartsWith(_normalizedPrefix, StringComparison.OrdinalIgnoreCase))
			{
				data[normalizedKey.Substring(_normalizedPrefix.Length)] = value;
			}
		}

		private static string Normalize(string key)
		{
			return key.Replace("__", ConfigurationPath.KeyDelimiter);
		}
	}
	public class EnvironmentVariablesConfigurationSource : IConfigurationSource
	{
		public string? Prefix { get; set; }

		public IConfigurationProvider Build(IConfigurationBuilder builder)
		{
			return (IConfigurationProvider)(object)new EnvironmentVariablesConfigurationProvider(Prefix);
		}
	}
}

BepInEx/plugins/SlopCrew.Plugin/Microsoft.Extensions.Configuration.FileExtensions.dll

Decompiled 8 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.ExceptionServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Text;
using System.Threading;
using FxResources.Microsoft.Extensions.Configuration.FileExtensions;
using Microsoft.CodeAnalysis;
using Microsoft.Extensions.FileProviders;
using Microsoft.Extensions.Primitives;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: InternalsVisibleTo("Microsoft.Extensions.Configuration.FileExtensions.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: AssemblyMetadata(".NETFrameworkAssembly", "")]
[assembly: AssemblyMetadata("Serviceable", "True")]
[assembly: AssemblyMetadata("PreferInbox", "True")]
[assembly: AssemblyDefaultAlias("Microsoft.Extensions.Configuration.FileExtensions")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: CLSCompliant(true)]
[assembly: AssemblyMetadata("IsTrimmable", "True")]
[assembly: DefaultDllImportSearchPaths(DllImportSearchPath.System32 | DllImportSearchPath.AssemblyDirectory)]
[assembly: AssemblyCompany("Microsoft Corporation")]
[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")]
[assembly: AssemblyDescription("Extension methods for configuring file-based configuration providers for Microsoft.Extensions.Configuration.")]
[assembly: AssemblyFileVersion("7.0.22.51805")]
[assembly: AssemblyInformationalVersion("7.0.0+d099f075e45d2aa6007a22b71b45a08758559f80")]
[assembly: AssemblyProduct("Microsoft® .NET")]
[assembly: AssemblyTitle("Microsoft.Extensions.Configuration.FileExtensions")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/dotnet/runtime")]
[assembly: AssemblyVersion("7.0.0.0")]
[module: RefSafetyRules(11)]
[module: System.Runtime.CompilerServices.NullablePublicOnly(true)]
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 NullablePublicOnlyAttribute : Attribute
	{
		public readonly bool IncludesInternals;

		public NullablePublicOnlyAttribute(bool P_0)
		{
			IncludesInternals = 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 FxResources.Microsoft.Extensions.Configuration.FileExtensions
{
	internal static class SR
	{
	}
}
namespace System
{
	internal static class ThrowHelper
	{
		internal static void ThrowIfNull(object? argument, [CallerArgumentExpression("argument")] string? paramName = null)
		{
			if (argument == null)
			{
				Throw(paramName);
			}
		}

		private static void Throw(string paramName)
		{
			throw new ArgumentNullException(paramName);
		}
	}
	internal static class SR
	{
		private static readonly bool s_usingResourceKeys = AppContext.TryGetSwitch("System.Resources.UseSystemResourceKeys", out var isEnabled) && isEnabled;

		private static ResourceManager s_resourceManager;

		internal static ResourceManager ResourceManager => s_resourceManager ?? (s_resourceManager = new ResourceManager(typeof(SR)));

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

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

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

		private static bool UsingResourceKeys()
		{
			return s_usingResourceKeys;
		}

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

		internal static string GetResourceString(string resourceKey, string defaultString)
		{
			string resourceString = GetResourceString(resourceKey);
			if (!(resourceKey == resourceString) && resourceString != null)
			{
				return resourceString;
			}
			return defaultString;
		}

		internal static string Format(string resourceFormat, object? p1)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1);
			}
			return string.Format(resourceFormat, p1);
		}

		internal static string Format(string resourceFormat, object? p1, object? p2)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2);
			}
			return string.Format(resourceFormat, p1, p2);
		}

		internal static string Format(string resourceFormat, object? p1, object? p2, object? p3)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2, p3);
			}
			return string.Format(resourceFormat, p1, p2, p3);
		}

		internal static string Format(string resourceFormat, params object?[]? args)
		{
			if (args != null)
			{
				if (UsingResourceKeys())
				{
					return resourceFormat + ", " + string.Join(", ", args);
				}
				return string.Format(resourceFormat, args);
			}
			return resourceFormat;
		}

		internal static string Format(IFormatProvider? provider, string resourceFormat, object? p1)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1);
			}
			return string.Format(provider, resourceFormat, p1);
		}

		internal static string Format(IFormatProvider? provider, string resourceFormat, object? p1, object? p2)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2);
			}
			return string.Format(provider, resourceFormat, p1, p2);
		}

		internal static string Format(IFormatProvider? provider, string resourceFormat, object? p1, object? p2, object? p3)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2, p3);
			}
			return string.Format(provider, resourceFormat, p1, p2, p3);
		}

		internal static string Format(IFormatProvider? provider, string resourceFormat, params object?[]? args)
		{
			if (args != null)
			{
				if (UsingResourceKeys())
				{
					return resourceFormat + ", " + string.Join(", ", args);
				}
				return string.Format(provider, resourceFormat, args);
			}
			return resourceFormat;
		}
	}
}
namespace System.Diagnostics.CodeAnalysis
{
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)]
	internal sealed class AllowNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)]
	internal sealed class DisallowNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)]
	internal sealed class MaybeNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)]
	internal sealed class NotNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class MaybeNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public MaybeNullWhenAttribute(bool returnValue)
		{
			ReturnValue = returnValue;
		}
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class NotNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public NotNullWhenAttribute(bool returnValue)
		{
			ReturnValue = returnValue;
		}
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = true, Inherited = false)]
	internal sealed class NotNullIfNotNullAttribute : Attribute
	{
		public string ParameterName { get; }

		public NotNullIfNotNullAttribute(string parameterName)
		{
			ParameterName = parameterName;
		}
	}
	[AttributeUsage(AttributeTargets.Method, Inherited = false)]
	internal sealed class DoesNotReturnAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class DoesNotReturnIfAttribute : Attribute
	{
		public bool ParameterValue { get; }

		public DoesNotReturnIfAttribute(bool parameterValue)
		{
			ParameterValue = parameterValue;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	internal sealed class MemberNotNullAttribute : Attribute
	{
		public string[] Members { get; }

		public MemberNotNullAttribute(string member)
		{
			Members = new string[1] { member };
		}

		public MemberNotNullAttribute(params string[] members)
		{
			Members = members;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	internal sealed class MemberNotNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public string[] Members { get; }

		public MemberNotNullWhenAttribute(bool returnValue, string member)
		{
			ReturnValue = returnValue;
			Members = new string[1] { member };
		}

		public MemberNotNullWhenAttribute(bool returnValue, params string[] members)
		{
			ReturnValue = returnValue;
			Members = members;
		}
	}
}
namespace System.Runtime.InteropServices
{
	[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
	internal sealed class LibraryImportAttribute : Attribute
	{
		public string LibraryName { get; }

		public string? EntryPoint { get; set; }

		public StringMarshalling StringMarshalling { get; set; }

		public Type? StringMarshallingCustomType { get; set; }

		public bool SetLastError { get; set; }

		public LibraryImportAttribute(string libraryName)
		{
			LibraryName = libraryName;
		}
	}
	internal enum StringMarshalling
	{
		Custom,
		Utf8,
		Utf16
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
	internal sealed class CallerArgumentExpressionAttribute : Attribute
	{
		public string ParameterName { get; }

		public CallerArgumentExpressionAttribute(string parameterName)
		{
			ParameterName = parameterName;
		}
	}
}
namespace Microsoft.Extensions.Configuration
{
	public static class FileConfigurationExtensions
	{
		private static string FileProviderKey = "FileProvider";

		private static string FileLoadExceptionHandlerKey = "FileLoadExceptionHandler";

		public static IConfigurationBuilder SetFileProvider(this IConfigurationBuilder builder, IFileProvider fileProvider)
		{
			System.ThrowHelper.ThrowIfNull(builder, "builder");
			System.ThrowHelper.ThrowIfNull(fileProvider, "fileProvider");
			builder.Properties[FileProviderKey] = fileProvider;
			return builder;
		}

		public static IFileProvider GetFileProvider(this IConfigurationBuilder builder)
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Expected O, but got Unknown
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			System.ThrowHelper.ThrowIfNull(builder, "builder");
			if (!builder.Properties.TryGetValue(FileProviderKey, out var value))
			{
				return (IFileProvider)new PhysicalFileProvider(AppContext.BaseDirectory ?? string.Empty);
			}
			return (IFileProvider)value;
		}

		public static IConfigurationBuilder SetBasePath(this IConfigurationBuilder builder, string basePath)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			System.ThrowHelper.ThrowIfNull(builder, "builder");
			System.ThrowHelper.ThrowIfNull(basePath, "basePath");
			return builder.SetFileProvider((IFileProvider)new PhysicalFileProvider(basePath));
		}

		public static IConfigurationBuilder SetFileLoadExceptionHandler(this IConfigurationBuilder builder, Action<FileLoadExceptionContext> handler)
		{
			System.ThrowHelper.ThrowIfNull(builder, "builder");
			builder.Properties[FileLoadExceptionHandlerKey] = handler;
			return builder;
		}

		public static Action<FileLoadExceptionContext>? GetFileLoadExceptionHandler(this IConfigurationBuilder builder)
		{
			System.ThrowHelper.ThrowIfNull(builder, "builder");
			if (builder.Properties.TryGetValue(FileLoadExceptionHandlerKey, out var value))
			{
				return value as Action<FileLoadExceptionContext>;
			}
			return null;
		}
	}
	public abstract class FileConfigurationProvider : ConfigurationProvider, IDisposable
	{
		private readonly IDisposable _changeTokenRegistration;

		public FileConfigurationSource Source { get; }

		public FileConfigurationProvider(FileConfigurationSource source)
		{
			System.ThrowHelper.ThrowIfNull(source, "source");
			Source = source;
			if (Source.ReloadOnChange && Source.FileProvider != null)
			{
				_changeTokenRegistration = ChangeToken.OnChange((Func<IChangeToken>)(() => Source.FileProvider.Watch(Source.Path)), (Action)delegate
				{
					Thread.Sleep(Source.ReloadDelay);
					Load(reload: true);
				});
			}
		}

		public override string ToString()
		{
			return ((object)this).GetType().Name + " for '" + Source.Path + "' (" + (Source.Optional ? "Optional" : "Required") + ")";
		}

		private void Load(bool reload)
		{
			IFileProvider? fileProvider = Source.FileProvider;
			IFileInfo val = ((fileProvider != null) ? fileProvider.GetFileInfo(Source.Path ?? string.Empty) : null);
			if (val == null || !val.Exists)
			{
				if (Source.Optional || reload)
				{
					((ConfigurationProvider)this).Data = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
				}
				else
				{
					StringBuilder stringBuilder = new StringBuilder(System.SR.Format(System.SR.Error_FileNotFound, Source.Path));
					if (!string.IsNullOrEmpty((val != null) ? val.PhysicalPath : null))
					{
						stringBuilder.Append(System.SR.Format(System.SR.Error_ExpectedPhysicalPath, val.PhysicalPath));
					}
					HandleException(ExceptionDispatchInfo.Capture(new FileNotFoundException(stringBuilder.ToString())));
				}
			}
			else
			{
				using Stream stream = OpenRead(val);
				try
				{
					Load(stream);
				}
				catch (Exception innerException)
				{
					if (reload)
					{
						((ConfigurationProvider)this).Data = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
					}
					InvalidDataException source = new InvalidDataException(System.SR.Format(System.SR.Error_FailedToLoad, val.PhysicalPath), innerException);
					HandleException(ExceptionDispatchInfo.Capture(source));
				}
			}
			((ConfigurationProvider)this).OnReload();
			static Stream OpenRead(IFileInfo fileInfo)
			{
				if (fileInfo.PhysicalPath != null)
				{
					return new FileStream(fileInfo.PhysicalPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite, 1, FileOptions.SequentialScan);
				}
				return fileInfo.CreateReadStream();
			}
		}

		public override void Load()
		{
			Load(reload: false);
		}

		public abstract void Load(Stream stream);

		private void HandleException(ExceptionDispatchInfo info)
		{
			bool flag = false;
			if (Source.OnLoadException != null)
			{
				FileLoadExceptionContext fileLoadExceptionContext = new FileLoadExceptionContext
				{
					Provider = this,
					Exception = info.SourceException
				};
				Source.OnLoadException(fileLoadExceptionContext);
				flag = fileLoadExceptionContext.Ignore;
			}
			if (!flag)
			{
				info.Throw();
			}
		}

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

		protected virtual void Dispose(bool disposing)
		{
			_changeTokenRegistration?.Dispose();
		}
	}
	public abstract class FileConfigurationSource : IConfigurationSource
	{
		public IFileProvider? FileProvider { get; set; }

		public string? Path
		{
			get; [param: DisallowNull]
			set;
		}

		public bool Optional { get; set; }

		public bool ReloadOnChange { get; set; }

		public int ReloadDelay { get; set; } = 250;


		public Action<FileLoadExceptionContext>? OnLoadException { get; set; }

		public abstract IConfigurationProvider Build(IConfigurationBuilder builder);

		public void EnsureDefaults(IConfigurationBuilder builder)
		{
			if (FileProvider == null)
			{
				IFileProvider val = (FileProvider = builder.GetFileProvider());
			}
			if (OnLoadException == null)
			{
				Action<FileLoadExceptionContext> action = (OnLoadException = builder.GetFileLoadExceptionHandler());
			}
		}

		public void ResolveFileProvider()
		{
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Expected O, but got Unknown
			if (FileProvider == null && !string.IsNullOrEmpty(Path) && System.IO.Path.IsPathRooted(Path))
			{
				string directoryName = System.IO.Path.GetDirectoryName(Path);
				string text = System.IO.Path.GetFileName(Path);
				while (!string.IsNullOrEmpty(directoryName) && !Directory.Exists(directoryName))
				{
					text = System.IO.Path.Combine(System.IO.Path.GetFileName(directoryName), text);
					directoryName = System.IO.Path.GetDirectoryName(directoryName);
				}
				if (Directory.Exists(directoryName))
				{
					FileProvider = (IFileProvider?)new PhysicalFileProvider(directoryName);
					Path = text;
				}
			}
		}
	}
	public class FileLoadExceptionContext
	{
		public FileConfigurationProvider Provider { get; set; }

		public Exception Exception { get; set; }

		public bool Ignore { get; set; }
	}
}

BepInEx/plugins/SlopCrew.Plugin/Microsoft.Extensions.Configuration.Json.dll

Decompiled 8 months ago
using System;
using System.Collections.Generic;
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.Security;
using System.Security.Permissions;
using System.Text.Json;
using FxResources.Microsoft.Extensions.Configuration.Json;
using Microsoft.CodeAnalysis;
using Microsoft.Extensions.Configuration.Json;
using Microsoft.Extensions.FileProviders;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: InternalsVisibleTo("Microsoft.Extensions.Configuration.Json.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: AssemblyMetadata(".NETFrameworkAssembly", "")]
[assembly: AssemblyMetadata("Serviceable", "True")]
[assembly: AssemblyMetadata("PreferInbox", "True")]
[assembly: AssemblyDefaultAlias("Microsoft.Extensions.Configuration.Json")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: CLSCompliant(true)]
[assembly: AssemblyMetadata("IsTrimmable", "True")]
[assembly: DefaultDllImportSearchPaths(DllImportSearchPath.System32 | DllImportSearchPath.AssemblyDirectory)]
[assembly: AssemblyCompany("Microsoft Corporation")]
[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")]
[assembly: AssemblyDescription("JSON configuration provider implementation for Microsoft.Extensions.Configuration.")]
[assembly: AssemblyFileVersion("7.0.22.51805")]
[assembly: AssemblyInformationalVersion("7.0.0+d099f075e45d2aa6007a22b71b45a08758559f80")]
[assembly: AssemblyProduct("Microsoft® .NET")]
[assembly: AssemblyTitle("Microsoft.Extensions.Configuration.Json")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/dotnet/runtime")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("7.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: System.Runtime.CompilerServices.NullablePublicOnly(true)]
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 NullablePublicOnlyAttribute : Attribute
	{
		public readonly bool IncludesInternals;

		public NullablePublicOnlyAttribute(bool P_0)
		{
			IncludesInternals = 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 FxResources.Microsoft.Extensions.Configuration.Json
{
	internal static class SR
	{
	}
}
namespace System
{
	internal static class ThrowHelper
	{
		internal static void ThrowIfNull(object? argument, [CallerArgumentExpression("argument")] string? paramName = null)
		{
			if (argument == null)
			{
				Throw(paramName);
			}
		}

		private static void Throw(string paramName)
		{
			throw new ArgumentNullException(paramName);
		}
	}
	internal static class SR
	{
		private static readonly bool s_usingResourceKeys = AppContext.TryGetSwitch("System.Resources.UseSystemResourceKeys", out var isEnabled) && isEnabled;

		private static ResourceManager s_resourceManager;

		internal static ResourceManager ResourceManager => s_resourceManager ?? (s_resourceManager = new ResourceManager(typeof(SR)));

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

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

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

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

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

		private static bool UsingResourceKeys()
		{
			return s_usingResourceKeys;
		}

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

		internal static string GetResourceString(string resourceKey, string defaultString)
		{
			string resourceString = GetResourceString(resourceKey);
			if (!(resourceKey == resourceString) && resourceString != null)
			{
				return resourceString;
			}
			return defaultString;
		}

		internal static string Format(string resourceFormat, object? p1)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1);
			}
			return string.Format(resourceFormat, p1);
		}

		internal static string Format(string resourceFormat, object? p1, object? p2)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2);
			}
			return string.Format(resourceFormat, p1, p2);
		}

		internal static string Format(string resourceFormat, object? p1, object? p2, object? p3)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2, p3);
			}
			return string.Format(resourceFormat, p1, p2, p3);
		}

		internal static string Format(string resourceFormat, params object?[]? args)
		{
			if (args != null)
			{
				if (UsingResourceKeys())
				{
					return resourceFormat + ", " + string.Join(", ", args);
				}
				return string.Format(resourceFormat, args);
			}
			return resourceFormat;
		}

		internal static string Format(IFormatProvider? provider, string resourceFormat, object? p1)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1);
			}
			return string.Format(provider, resourceFormat, p1);
		}

		internal static string Format(IFormatProvider? provider, string resourceFormat, object? p1, object? p2)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2);
			}
			return string.Format(provider, resourceFormat, p1, p2);
		}

		internal static string Format(IFormatProvider? provider, string resourceFormat, object? p1, object? p2, object? p3)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2, p3);
			}
			return string.Format(provider, resourceFormat, p1, p2, p3);
		}

		internal static string Format(IFormatProvider? provider, string resourceFormat, params object?[]? args)
		{
			if (args != null)
			{
				if (UsingResourceKeys())
				{
					return resourceFormat + ", " + string.Join(", ", args);
				}
				return string.Format(provider, resourceFormat, args);
			}
			return resourceFormat;
		}
	}
}
namespace System.Diagnostics.CodeAnalysis
{
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)]
	internal sealed class AllowNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)]
	internal sealed class DisallowNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)]
	internal sealed class MaybeNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)]
	internal sealed class NotNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class MaybeNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public MaybeNullWhenAttribute(bool returnValue)
		{
			ReturnValue = returnValue;
		}
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class NotNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public NotNullWhenAttribute(bool returnValue)
		{
			ReturnValue = returnValue;
		}
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = true, Inherited = false)]
	internal sealed class NotNullIfNotNullAttribute : Attribute
	{
		public string ParameterName { get; }

		public NotNullIfNotNullAttribute(string parameterName)
		{
			ParameterName = parameterName;
		}
	}
	[AttributeUsage(AttributeTargets.Method, Inherited = false)]
	internal sealed class DoesNotReturnAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class DoesNotReturnIfAttribute : Attribute
	{
		public bool ParameterValue { get; }

		public DoesNotReturnIfAttribute(bool parameterValue)
		{
			ParameterValue = parameterValue;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	internal sealed class MemberNotNullAttribute : Attribute
	{
		public string[] Members { get; }

		public MemberNotNullAttribute(string member)
		{
			Members = new string[1] { member };
		}

		public MemberNotNullAttribute(params string[] members)
		{
			Members = members;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	internal sealed class MemberNotNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public string[] Members { get; }

		public MemberNotNullWhenAttribute(bool returnValue, string member)
		{
			ReturnValue = returnValue;
			Members = new string[1] { member };
		}

		public MemberNotNullWhenAttribute(bool returnValue, params string[] members)
		{
			ReturnValue = returnValue;
			Members = members;
		}
	}
}
namespace System.Runtime.InteropServices
{
	[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
	internal sealed class LibraryImportAttribute : Attribute
	{
		public string LibraryName { get; }

		public string? EntryPoint { get; set; }

		public StringMarshalling StringMarshalling { get; set; }

		public Type? StringMarshallingCustomType { get; set; }

		public bool SetLastError { get; set; }

		public LibraryImportAttribute(string libraryName)
		{
			LibraryName = libraryName;
		}
	}
	internal enum StringMarshalling
	{
		Custom,
		Utf8,
		Utf16
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
	internal sealed class CallerArgumentExpressionAttribute : Attribute
	{
		public string ParameterName { get; }

		public CallerArgumentExpressionAttribute(string parameterName)
		{
			ParameterName = parameterName;
		}
	}
}
namespace Microsoft.Extensions.Configuration
{
	public static class JsonConfigurationExtensions
	{
		public static IConfigurationBuilder AddJsonFile(this IConfigurationBuilder builder, string path)
		{
			return builder.AddJsonFile(null, path, optional: false, reloadOnChange: false);
		}

		public static IConfigurationBuilder AddJsonFile(this IConfigurationBuilder builder, string path, bool optional)
		{
			return builder.AddJsonFile(null, path, optional, reloadOnChange: false);
		}

		public static IConfigurationBuilder AddJsonFile(this IConfigurationBuilder builder, string path, bool optional, bool reloadOnChange)
		{
			return builder.AddJsonFile(null, path, optional, reloadOnChange);
		}

		public static IConfigurationBuilder AddJsonFile(this IConfigurationBuilder builder, IFileProvider? provider, string path, bool optional, bool reloadOnChange)
		{
			IFileProvider provider2 = provider;
			string path2 = path;
			System.ThrowHelper.ThrowIfNull(builder, "builder");
			if (string.IsNullOrEmpty(path2))
			{
				throw new ArgumentException(System.SR.Error_InvalidFilePath, "path");
			}
			return builder.AddJsonFile(delegate(JsonConfigurationSource s)
			{
				((FileConfigurationSource)s).FileProvider = provider2;
				((FileConfigurationSource)s).Path = path2;
				((FileConfigurationSource)s).Optional = optional;
				((FileConfigurationSource)s).ReloadOnChange = reloadOnChange;
				((FileConfigurationSource)s).ResolveFileProvider();
			});
		}

		public static IConfigurationBuilder AddJsonFile(this IConfigurationBuilder builder, Action<JsonConfigurationSource>? configureSource)
		{
			return ConfigurationExtensions.Add<JsonConfigurationSource>(builder, configureSource);
		}

		public static IConfigurationBuilder AddJsonStream(this IConfigurationBuilder builder, Stream stream)
		{
			Stream stream2 = stream;
			System.ThrowHelper.ThrowIfNull(builder, "builder");
			return ConfigurationExtensions.Add<JsonStreamConfigurationSource>(builder, (Action<JsonStreamConfigurationSource>)delegate(JsonStreamConfigurationSource s)
			{
				((StreamConfigurationSource)s).Stream = stream2;
			});
		}
	}
}
namespace Microsoft.Extensions.Configuration.Json
{
	internal sealed class JsonConfigurationFileParser
	{
		private readonly Dictionary<string, string> _data = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);

		private readonly Stack<string> _paths = new Stack<string>();

		private JsonConfigurationFileParser()
		{
		}

		public static IDictionary<string, string?> Parse(Stream input)
		{
			return new JsonConfigurationFileParser().ParseStream(input);
		}

		private IDictionary<string, string> ParseStream(Stream input)
		{
			//IL_0002: 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)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: 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_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Invalid comparison between Unknown and I4
			//IL_0066: 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)
			//IL_004b: 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)
			JsonDocumentOptions val = default(JsonDocumentOptions);
			((JsonDocumentOptions)(ref val)).CommentHandling = (JsonCommentHandling)1;
			((JsonDocumentOptions)(ref val)).AllowTrailingCommas = true;
			JsonDocumentOptions val2 = val;
			using (StreamReader streamReader = new StreamReader(input))
			{
				JsonDocument val3 = JsonDocument.Parse(streamReader.ReadToEnd(), val2);
				try
				{
					JsonElement rootElement = val3.RootElement;
					if ((int)((JsonElement)(ref rootElement)).ValueKind != 1)
					{
						string error_InvalidTopLevelJSONElement = System.SR.Error_InvalidTopLevelJSONElement;
						rootElement = val3.RootElement;
						throw new FormatException(System.SR.Format(error_InvalidTopLevelJSONElement, ((JsonElement)(ref rootElement)).ValueKind));
					}
					VisitObjectElement(val3.RootElement);
				}
				finally
				{
					((IDisposable)val3)?.Dispose();
				}
			}
			return _data;
		}

		private void VisitObjectElement(JsonElement element)
		{
			//IL_0004: 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_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)
			//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)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			bool nullIfElementIsEmpty = true;
			ObjectEnumerator val = ((JsonElement)(ref element)).EnumerateObject();
			ObjectEnumerator enumerator = ((ObjectEnumerator)(ref val)).GetEnumerator();
			try
			{
				while (((ObjectEnumerator)(ref enumerator)).MoveNext())
				{
					JsonProperty current = ((ObjectEnumerator)(ref enumerator)).Current;
					nullIfElementIsEmpty = false;
					EnterContext(((JsonProperty)(ref current)).Name);
					VisitValue(((JsonProperty)(ref current)).Value);
					ExitContext();
				}
			}
			finally
			{
				((IDisposable)(ObjectEnumerator)(ref enumerator)).Dispose();
			}
			SetNullIfElementIsEmpty(nullIfElementIsEmpty);
		}

		private void VisitArrayElement(JsonElement element)
		{
			//IL_0004: 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_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)
			//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)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			int num = 0;
			ArrayEnumerator val = ((JsonElement)(ref element)).EnumerateArray();
			ArrayEnumerator enumerator = ((ArrayEnumerator)(ref val)).GetEnumerator();
			try
			{
				while (((ArrayEnumerator)(ref enumerator)).MoveNext())
				{
					JsonElement current = ((ArrayEnumerator)(ref enumerator)).Current;
					EnterContext(num.ToString());
					VisitValue(current);
					ExitContext();
					num++;
				}
			}
			finally
			{
				((IDisposable)(ArrayEnumerator)(ref enumerator)).Dispose();
			}
			SetNullIfElementIsEmpty(num == 0);
		}

		private void SetNullIfElementIsEmpty(bool isEmpty)
		{
			if (isEmpty && _paths.Count > 0)
			{
				_data[_paths.Peek()] = null;
			}
		}

		private void VisitValue(JsonElement value)
		{
			//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_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)
			//IL_002c: Expected I4, but got Unknown
			//IL_002f: 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)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			JsonValueKind valueKind = ((JsonElement)(ref value)).ValueKind;
			switch (valueKind - 1)
			{
			case 0:
				VisitObjectElement(value);
				break;
			case 1:
				VisitArrayElement(value);
				break;
			case 2:
			case 3:
			case 4:
			case 5:
			case 6:
			{
				string text = _paths.Peek();
				if (_data.ContainsKey(text))
				{
					throw new FormatException(System.SR.Format(System.SR.Error_KeyIsDuplicated, text));
				}
				_data[text] = ((object)(JsonElement)(ref value)).ToString();
				break;
			}
			default:
				throw new FormatException(System.SR.Format(System.SR.Error_UnsupportedJSONToken, ((JsonElement)(ref value)).ValueKind));
			}
		}

		private void EnterContext(string context)
		{
			_paths.Push((_paths.Count > 0) ? (_paths.Peek() + ConfigurationPath.KeyDelimiter + context) : context);
		}

		private void ExitContext()
		{
			_paths.Pop();
		}
	}
	public class JsonConfigurationProvider : FileConfigurationProvider
	{
		public JsonConfigurationProvider(JsonConfigurationSource source)
			: base((FileConfigurationSource)(object)source)
		{
		}

		public override void Load(Stream stream)
		{
			//IL_000f: Expected O, but got Unknown
			try
			{
				((ConfigurationProvider)this).Data = JsonConfigurationFileParser.Parse(stream);
			}
			catch (JsonException val)
			{
				JsonException innerException = val;
				throw new FormatException(System.SR.Error_JSONParseError, (Exception?)(object)innerException);
			}
		}
	}
	public class JsonConfigurationSource : FileConfigurationSource
	{
		public override IConfigurationProvider Build(IConfigurationBuilder builder)
		{
			((FileConfigurationSource)this).EnsureDefaults(builder);
			return (IConfigurationProvider)(object)new JsonConfigurationProvider(this);
		}
	}
	public class JsonStreamConfigurationProvider : StreamConfigurationProvider
	{
		public JsonStreamConfigurationProvider(JsonStreamConfigurationSource source)
			: base((StreamConfigurationSource)(object)source)
		{
		}

		public override void Load(Stream stream)
		{
			((ConfigurationProvider)this).Data = JsonConfigurationFileParser.Parse(stream);
		}
	}
	public class JsonStreamConfigurationSource : StreamConfigurationSource
	{
		public override IConfigurationProvider Build(IConfigurationBuilder builder)
		{
			return (IConfigurationProvider)(object)new JsonStreamConfigurationProvider(this);
		}
	}
}

BepInEx/plugins/SlopCrew.Plugin/Microsoft.Extensions.Configuration.UserSecrets.dll

Decompiled 8 months ago
using System;
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 FxResources.Microsoft.Extensions.Configuration.UserSecrets;
using Microsoft.CodeAnalysis;
using Microsoft.Extensions.Configuration.UserSecrets;
using Microsoft.Extensions.FileProviders;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: InternalsVisibleTo("Microsoft.Extensions.Configuration.UserSecrets.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: AssemblyMetadata(".NETFrameworkAssembly", "")]
[assembly: AssemblyMetadata("Serviceable", "True")]
[assembly: AssemblyMetadata("PreferInbox", "True")]
[assembly: AssemblyDefaultAlias("Microsoft.Extensions.Configuration.UserSecrets")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: CLSCompliant(true)]
[assembly: AssemblyMetadata("IsTrimmable", "True")]
[assembly: DefaultDllImportSearchPaths(DllImportSearchPath.System32 | DllImportSearchPath.AssemblyDirectory)]
[assembly: AssemblyCompany("Microsoft Corporation")]
[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")]
[assembly: AssemblyDescription("User secrets configuration provider implementation for Microsoft.Extensions.Configuration.")]
[assembly: AssemblyFileVersion("7.0.22.51805")]
[assembly: AssemblyInformationalVersion("7.0.0+d099f075e45d2aa6007a22b71b45a08758559f80")]
[assembly: AssemblyProduct("Microsoft® .NET")]
[assembly: AssemblyTitle("Microsoft.Extensions.Configuration.UserSecrets")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/dotnet/runtime")]
[assembly: AssemblyVersion("7.0.0.0")]
[module: RefSafetyRules(11)]
[module: System.Runtime.CompilerServices.NullablePublicOnly(true)]
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 NullablePublicOnlyAttribute : Attribute
	{
		public readonly bool IncludesInternals;

		public NullablePublicOnlyAttribute(bool P_0)
		{
			IncludesInternals = 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 FxResources.Microsoft.Extensions.Configuration.UserSecrets
{
	internal static class SR
	{
	}
}
namespace System
{
	internal static class ThrowHelper
	{
		internal static void ThrowIfNull(object? argument, [CallerArgumentExpression("argument")] string? paramName = null)
		{
			if (argument == null)
			{
				Throw(paramName);
			}
		}

		private static void Throw(string paramName)
		{
			throw new ArgumentNullException(paramName);
		}
	}
	internal static class SR
	{
		private static readonly bool s_usingResourceKeys = AppContext.TryGetSwitch("System.Resources.UseSystemResourceKeys", out var isEnabled) && isEnabled;

		private static ResourceManager s_resourceManager;

		internal static ResourceManager ResourceManager => s_resourceManager ?? (s_resourceManager = new ResourceManager(typeof(SR)));

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

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

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

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

		private static bool UsingResourceKeys()
		{
			return s_usingResourceKeys;
		}

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

		internal static string GetResourceString(string resourceKey, string defaultString)
		{
			string resourceString = GetResourceString(resourceKey);
			if (!(resourceKey == resourceString) && resourceString != null)
			{
				return resourceString;
			}
			return defaultString;
		}

		internal static string Format(string resourceFormat, object? p1)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1);
			}
			return string.Format(resourceFormat, p1);
		}

		internal static string Format(string resourceFormat, object? p1, object? p2)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2);
			}
			return string.Format(resourceFormat, p1, p2);
		}

		internal static string Format(string resourceFormat, object? p1, object? p2, object? p3)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2, p3);
			}
			return string.Format(resourceFormat, p1, p2, p3);
		}

		internal static string Format(string resourceFormat, params object?[]? args)
		{
			if (args != null)
			{
				if (UsingResourceKeys())
				{
					return resourceFormat + ", " + string.Join(", ", args);
				}
				return string.Format(resourceFormat, args);
			}
			return resourceFormat;
		}

		internal static string Format(IFormatProvider? provider, string resourceFormat, object? p1)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1);
			}
			return string.Format(provider, resourceFormat, p1);
		}

		internal static string Format(IFormatProvider? provider, string resourceFormat, object? p1, object? p2)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2);
			}
			return string.Format(provider, resourceFormat, p1, p2);
		}

		internal static string Format(IFormatProvider? provider, string resourceFormat, object? p1, object? p2, object? p3)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2, p3);
			}
			return string.Format(provider, resourceFormat, p1, p2, p3);
		}

		internal static string Format(IFormatProvider? provider, string resourceFormat, params object?[]? args)
		{
			if (args != null)
			{
				if (UsingResourceKeys())
				{
					return resourceFormat + ", " + string.Join(", ", args);
				}
				return string.Format(provider, resourceFormat, args);
			}
			return resourceFormat;
		}
	}
}
namespace System.Diagnostics.CodeAnalysis
{
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)]
	internal sealed class AllowNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)]
	internal sealed class DisallowNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)]
	internal sealed class MaybeNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)]
	internal sealed class NotNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class MaybeNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public MaybeNullWhenAttribute(bool returnValue)
		{
			ReturnValue = returnValue;
		}
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class NotNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public NotNullWhenAttribute(bool returnValue)
		{
			ReturnValue = returnValue;
		}
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = true, Inherited = false)]
	internal sealed class NotNullIfNotNullAttribute : Attribute
	{
		public string ParameterName { get; }

		public NotNullIfNotNullAttribute(string parameterName)
		{
			ParameterName = parameterName;
		}
	}
	[AttributeUsage(AttributeTargets.Method, Inherited = false)]
	internal sealed class DoesNotReturnAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class DoesNotReturnIfAttribute : Attribute
	{
		public bool ParameterValue { get; }

		public DoesNotReturnIfAttribute(bool parameterValue)
		{
			ParameterValue = parameterValue;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	internal sealed class MemberNotNullAttribute : Attribute
	{
		public string[] Members { get; }

		public MemberNotNullAttribute(string member)
		{
			Members = new string[1] { member };
		}

		public MemberNotNullAttribute(params string[] members)
		{
			Members = members;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	internal sealed class MemberNotNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public string[] Members { get; }

		public MemberNotNullWhenAttribute(bool returnValue, string member)
		{
			ReturnValue = returnValue;
			Members = new string[1] { member };
		}

		public MemberNotNullWhenAttribute(bool returnValue, params string[] members)
		{
			ReturnValue = returnValue;
			Members = members;
		}
	}
}
namespace System.Runtime.InteropServices
{
	[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
	internal sealed class LibraryImportAttribute : Attribute
	{
		public string LibraryName { get; }

		public string? EntryPoint { get; set; }

		public StringMarshalling StringMarshalling { get; set; }

		public Type? StringMarshallingCustomType { get; set; }

		public bool SetLastError { get; set; }

		public LibraryImportAttribute(string libraryName)
		{
			LibraryName = libraryName;
		}
	}
	internal enum StringMarshalling
	{
		Custom,
		Utf8,
		Utf16
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
	internal sealed class CallerArgumentExpressionAttribute : Attribute
	{
		public string ParameterName { get; }

		public CallerArgumentExpressionAttribute(string parameterName)
		{
			ParameterName = parameterName;
		}
	}
}
namespace Microsoft.Extensions.Configuration
{
	public static class UserSecretsConfigurationExtensions
	{
		public static IConfigurationBuilder AddUserSecrets<T>(this IConfigurationBuilder configuration) where T : class
		{
			return configuration.AddUserSecrets(typeof(T).Assembly, optional: true, reloadOnChange: false);
		}

		public static IConfigurationBuilder AddUserSecrets<T>(this IConfigurationBuilder configuration, bool optional) where T : class
		{
			return configuration.AddUserSecrets(typeof(T).Assembly, optional, reloadOnChange: false);
		}

		public static IConfigurationBuilder AddUserSecrets<T>(this IConfigurationBuilder configuration, bool optional, bool reloadOnChange) where T : class
		{
			return configuration.AddUserSecrets(typeof(T).Assembly, optional, reloadOnChange);
		}

		public static IConfigurationBuilder AddUserSecrets(this IConfigurationBuilder configuration, Assembly assembly)
		{
			return configuration.AddUserSecrets(assembly, optional: true, reloadOnChange: false);
		}

		public static IConfigurationBuilder AddUserSecrets(this IConfigurationBuilder configuration, Assembly assembly, bool optional)
		{
			return configuration.AddUserSecrets(assembly, optional, reloadOnChange: false);
		}

		public static IConfigurationBuilder AddUserSecrets(this IConfigurationBuilder configuration, Assembly assembly, bool optional, bool reloadOnChange)
		{
			System.ThrowHelper.ThrowIfNull(configuration, "configuration");
			System.ThrowHelper.ThrowIfNull(assembly, "assembly");
			UserSecretsIdAttribute customAttribute = assembly.GetCustomAttribute<UserSecretsIdAttribute>();
			if (customAttribute != null)
			{
				return AddUserSecretsInternal(configuration, customAttribute.UserSecretsId, optional, reloadOnChange);
			}
			if (!optional)
			{
				throw new InvalidOperationException(System.SR.Format(System.SR.Error_Missing_UserSecretsIdAttribute, assembly.GetName().Name));
			}
			return configuration;
		}

		public static IConfigurationBuilder AddUserSecrets(this IConfigurationBuilder configuration, string userSecretsId)
		{
			return configuration.AddUserSecrets(userSecretsId, reloadOnChange: false);
		}

		public static IConfigurationBuilder AddUserSecrets(this IConfigurationBuilder configuration, string userSecretsId, bool reloadOnChange)
		{
			return AddUserSecretsInternal(configuration, userSecretsId, optional: true, reloadOnChange);
		}

		private static IConfigurationBuilder AddUserSecretsInternal(IConfigurationBuilder configuration, string userSecretsId, bool optional, bool reloadOnChange)
		{
			System.ThrowHelper.ThrowIfNull(configuration, "configuration");
			System.ThrowHelper.ThrowIfNull(userSecretsId, "userSecretsId");
			return AddSecretsFile(configuration, PathHelper.InternalGetSecretsPathFromSecretsId(userSecretsId, !optional), optional, reloadOnChange);
		}

		private static IConfigurationBuilder AddSecretsFile(IConfigurationBuilder configuration, string secretPath, bool optional, bool reloadOnChange)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			if (string.IsNullOrEmpty(secretPath))
			{
				return configuration;
			}
			string directoryName = Path.GetDirectoryName(secretPath);
			PhysicalFileProvider val = ((!Directory.Exists(directoryName)) ? ((PhysicalFileProvider)null) : new PhysicalFileProvider(directoryName));
			return JsonConfigurationExtensions.AddJsonFile(configuration, (IFileProvider)(object)val, "secrets.json", optional, reloadOnChange);
		}
	}
}
namespace Microsoft.Extensions.Configuration.UserSecrets
{
	public class PathHelper
	{
		internal const string SecretsFileName = "secrets.json";

		public static string GetSecretsPathFromSecretsId(string userSecretsId)
		{
			return InternalGetSecretsPathFromSecretsId(userSecretsId, throwIfNoRoot: true);
		}

		internal static string InternalGetSecretsPathFromSecretsId(string userSecretsId, bool throwIfNoRoot)
		{
			if (string.IsNullOrEmpty(userSecretsId))
			{
				throw new ArgumentException(System.SR.Common_StringNullOrEmpty, "userSecretsId");
			}
			int num = userSecretsId.IndexOfAny(Path.GetInvalidFileNameChars());
			if (num != -1)
			{
				throw new InvalidOperationException(string.Format(System.SR.Error_Invalid_Character_In_UserSecrets_Id, userSecretsId[num], num));
			}
			string environmentVariable = Environment.GetEnvironmentVariable("APPDATA");
			string text = environmentVariable ?? Environment.GetEnvironmentVariable("HOME") ?? Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) ?? Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) ?? Environment.GetEnvironmentVariable("DOTNET_USER_SECRETS_FALLBACK_DIR");
			if (string.IsNullOrEmpty(text))
			{
				if (throwIfNoRoot)
				{
					throw new InvalidOperationException(System.SR.Format(System.SR.Error_Missing_UserSecretsLocation, "DOTNET_USER_SECRETS_FALLBACK_DIR"));
				}
				return string.Empty;
			}
			if (string.IsNullOrEmpty(environmentVariable))
			{
				return Path.Combine(text, ".microsoft", "usersecrets", userSecretsId, "secrets.json");
			}
			return Path.Combine(text, "Microsoft", "UserSecrets", userSecretsId, "secrets.json");
		}
	}
	[AttributeUsage(AttributeTargets.Assembly, Inherited = false, AllowMultiple = false)]
	public class UserSecretsIdAttribute : Attribute
	{
		public string UserSecretsId { get; }

		public UserSecretsIdAttribute(string userSecretId)
		{
			if (string.IsNullOrEmpty(userSecretId))
			{
				throw new ArgumentException(System.SR.Common_StringNullOrEmpty, "userSecretId");
			}
			UserSecretsId = userSecretId;
		}
	}
}

BepInEx/plugins/SlopCrew.Plugin/Microsoft.Extensions.DependencyInjection.Abstractions.dll

Decompiled 8 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Linq.Expressions;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.ExceptionServices;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Runtime.Versioning;
using System.Threading.Tasks;
using FxResources.Microsoft.Extensions.DependencyInjection.Abstractions;
using Microsoft.CodeAnalysis;
using Microsoft.Extensions.Internal;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: InternalsVisibleTo("Microsoft.Extensions.DependencyInjection.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: AssemblyMetadata(".NETFrameworkAssembly", "")]
[assembly: AssemblyMetadata("Serviceable", "True")]
[assembly: AssemblyMetadata("PreferInbox", "True")]
[assembly: AssemblyDefaultAlias("Microsoft.Extensions.DependencyInjection.Abstractions")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: CLSCompliant(true)]
[assembly: AssemblyMetadata("IsTrimmable", "True")]
[assembly: DefaultDllImportSearchPaths(DllImportSearchPath.System32 | DllImportSearchPath.AssemblyDirectory)]
[assembly: AssemblyCompany("Microsoft Corporation")]
[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")]
[assembly: AssemblyDescription("Abstractions for dependency injection.\r\n\r\nCommonly Used Types:\r\nMicrosoft.Extensions.DependencyInjection.IServiceCollection")]
[assembly: AssemblyFileVersion("7.0.22.51805")]
[assembly: AssemblyInformationalVersion("7.0.0+d099f075e45d2aa6007a22b71b45a08758559f80")]
[assembly: AssemblyProduct("Microsoft® .NET")]
[assembly: AssemblyTitle("Microsoft.Extensions.DependencyInjection.Abstractions")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/dotnet/runtime")]
[assembly: AssemblyVersion("7.0.0.0")]
[module: RefSafetyRules(11)]
[module: System.Runtime.CompilerServices.NullablePublicOnly(true)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class IsReadOnlyAttribute : Attribute
	{
	}
	[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 NullablePublicOnlyAttribute : Attribute
	{
		public readonly bool IncludesInternals;

		public NullablePublicOnlyAttribute(bool P_0)
		{
			IncludesInternals = 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 FxResources.Microsoft.Extensions.DependencyInjection.Abstractions
{
	internal static class SR
	{
	}
}
namespace System
{
	internal static class ThrowHelper
	{
		internal static void ThrowIfNull(object? argument, [CallerArgumentExpression("argument")] string? paramName = null)
		{
			if (argument == null)
			{
				Throw(paramName);
			}
		}

		private static void Throw(string paramName)
		{
			throw new ArgumentNullException(paramName);
		}
	}
	internal static class SR
	{
		private static readonly bool s_usingResourceKeys = AppContext.TryGetSwitch("System.Resources.UseSystemResourceKeys", out var isEnabled) && isEnabled;

		private static ResourceManager s_resourceManager;

		internal static ResourceManager ResourceManager => s_resourceManager ?? (s_resourceManager = new ResourceManager(typeof(SR)));

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

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

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

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

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

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

		private static bool UsingResourceKeys()
		{
			return s_usingResourceKeys;
		}

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

		internal static string GetResourceString(string resourceKey, string defaultString)
		{
			string resourceString = GetResourceString(resourceKey);
			if (!(resourceKey == resourceString) && resourceString != null)
			{
				return resourceString;
			}
			return defaultString;
		}

		internal static string Format(string resourceFormat, object? p1)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1);
			}
			return string.Format(resourceFormat, p1);
		}

		internal static string Format(string resourceFormat, object? p1, object? p2)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2);
			}
			return string.Format(resourceFormat, p1, p2);
		}

		internal static string Format(string resourceFormat, object? p1, object? p2, object? p3)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2, p3);
			}
			return string.Format(resourceFormat, p1, p2, p3);
		}

		internal static string Format(string resourceFormat, params object?[]? args)
		{
			if (args != null)
			{
				if (UsingResourceKeys())
				{
					return resourceFormat + ", " + string.Join(", ", args);
				}
				return string.Format(resourceFormat, args);
			}
			return resourceFormat;
		}

		internal static string Format(IFormatProvider? provider, string resourceFormat, object? p1)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1);
			}
			return string.Format(provider, resourceFormat, p1);
		}

		internal static string Format(IFormatProvider? provider, string resourceFormat, object? p1, object? p2)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2);
			}
			return string.Format(provider, resourceFormat, p1, p2);
		}

		internal static string Format(IFormatProvider? provider, string resourceFormat, object? p1, object? p2, object? p3)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2, p3);
			}
			return string.Format(provider, resourceFormat, p1, p2, p3);
		}

		internal static string Format(IFormatProvider? provider, string resourceFormat, params object?[]? args)
		{
			if (args != null)
			{
				if (UsingResourceKeys())
				{
					return resourceFormat + ", " + string.Join(", ", args);
				}
				return string.Format(provider, resourceFormat, args);
			}
			return resourceFormat;
		}
	}
}
namespace System.Diagnostics.CodeAnalysis
{
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Interface | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, Inherited = false)]
	internal sealed class DynamicallyAccessedMembersAttribute : Attribute
	{
		public DynamicallyAccessedMemberTypes MemberTypes { get; }

		public DynamicallyAccessedMembersAttribute(DynamicallyAccessedMemberTypes memberTypes)
		{
			MemberTypes = memberTypes;
		}
	}
	[Flags]
	internal enum DynamicallyAccessedMemberTypes
	{
		None = 0,
		PublicParameterlessConstructor = 1,
		PublicConstructors = 3,
		NonPublicConstructors = 4,
		PublicMethods = 8,
		NonPublicMethods = 0x10,
		PublicFields = 0x20,
		NonPublicFields = 0x40,
		PublicNestedTypes = 0x80,
		NonPublicNestedTypes = 0x100,
		PublicProperties = 0x200,
		NonPublicProperties = 0x400,
		PublicEvents = 0x800,
		NonPublicEvents = 0x1000,
		Interfaces = 0x2000,
		All = -1
	}
	[AttributeUsage(AttributeTargets.All, Inherited = false, AllowMultiple = true)]
	internal sealed class UnconditionalSuppressMessageAttribute : Attribute
	{
		public string Category { get; }

		public string CheckId { get; }

		public string? Scope { get; set; }

		public string? Target { get; set; }

		public string? MessageId { get; set; }

		public string? Justification { get; set; }

		public UnconditionalSuppressMessageAttribute(string category, string checkId)
		{
			Category = category;
			CheckId = checkId;
		}
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Constructor | AttributeTargets.Method, Inherited = false)]
	internal sealed class RequiresDynamicCodeAttribute : Attribute
	{
		public string Message { get; }

		public string? Url { get; set; }

		public RequiresDynamicCodeAttribute(string message)
		{
			Message = message;
		}
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)]
	internal sealed class AllowNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)]
	internal sealed class DisallowNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)]
	internal sealed class MaybeNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)]
	internal sealed class NotNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class MaybeNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public MaybeNullWhenAttribute(bool returnValue)
		{
			ReturnValue = returnValue;
		}
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class NotNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public NotNullWhenAttribute(bool returnValue)
		{
			ReturnValue = returnValue;
		}
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = true, Inherited = false)]
	internal sealed class NotNullIfNotNullAttribute : Attribute
	{
		public string ParameterName { get; }

		public NotNullIfNotNullAttribute(string parameterName)
		{
			ParameterName = parameterName;
		}
	}
	[AttributeUsage(AttributeTargets.Method, Inherited = false)]
	internal sealed class DoesNotReturnAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class DoesNotReturnIfAttribute : Attribute
	{
		public bool ParameterValue { get; }

		public DoesNotReturnIfAttribute(bool parameterValue)
		{
			ParameterValue = parameterValue;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	internal sealed class MemberNotNullAttribute : Attribute
	{
		public string[] Members { get; }

		public MemberNotNullAttribute(string member)
		{
			Members = new string[1] { member };
		}

		public MemberNotNullAttribute(params string[] members)
		{
			Members = members;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	internal sealed class MemberNotNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public string[] Members { get; }

		public MemberNotNullWhenAttribute(bool returnValue, string member)
		{
			ReturnValue = returnValue;
			Members = new string[1] { member };
		}

		public MemberNotNullWhenAttribute(bool returnValue, params string[] members)
		{
			ReturnValue = returnValue;
			Members = members;
		}
	}
}
namespace System.Runtime.InteropServices
{
	[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
	internal sealed class LibraryImportAttribute : Attribute
	{
		public string LibraryName { get; }

		public string? EntryPoint { get; set; }

		public StringMarshalling StringMarshalling { get; set; }

		public Type? StringMarshallingCustomType { get; set; }

		public bool SetLastError { get; set; }

		public LibraryImportAttribute(string libraryName)
		{
			LibraryName = libraryName;
		}
	}
	internal enum StringMarshalling
	{
		Custom,
		Utf8,
		Utf16
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
	internal sealed class CallerArgumentExpressionAttribute : Attribute
	{
		public string ParameterName { get; }

		public CallerArgumentExpressionAttribute(string parameterName)
		{
			ParameterName = parameterName;
		}
	}
}
namespace Microsoft.Extensions.Internal
{
	internal static class ParameterDefaultValue
	{
		public static bool TryGetDefaultValue(ParameterInfo parameter, out object? defaultValue)
		{
			bool tryToGetDefaultValue;
			bool flag = CheckHasDefaultValue(parameter, out tryToGetDefaultValue);
			defaultValue = null;
			if (flag)
			{
				if (tryToGetDefaultValue)
				{
					defaultValue = parameter.DefaultValue;
				}
				bool flag2 = parameter.ParameterType.IsGenericType && parameter.ParameterType.GetGenericTypeDefinition() == typeof(Nullable<>);
				if (defaultValue == null && parameter.ParameterType.IsValueType && !flag2)
				{
					defaultValue = CreateValueType(parameter.ParameterType);
				}
				if (defaultValue != null && flag2)
				{
					Type underlyingType = Nullable.GetUnderlyingType(parameter.ParameterType);
					if (underlyingType != null && underlyingType.IsEnum)
					{
						defaultValue = Enum.ToObject(underlyingType, defaultValue);
					}
				}
			}
			return flag;
			[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2067:UnrecognizedReflectionPattern", Justification = "CreateValueType is only called on a ValueType. You can always create an instance of a ValueType.")]
			static object? CreateValueType(Type t)
			{
				return FormatterServices.GetUninitializedObject(t);
			}
		}

		public static bool CheckHasDefaultValue(ParameterInfo parameter, out bool tryToGetDefaultValue)
		{
			tryToGetDefaultValue = true;
			try
			{
				return parameter.HasDefaultValue;
			}
			catch (FormatException) when (parameter.ParameterType == typeof(DateTime))
			{
				tryToGetDefaultValue = false;
				return true;
			}
		}
	}
}
namespace Microsoft.Extensions.DependencyInjection
{
	public static class ActivatorUtilities
	{
		private struct ConstructorMatcher
		{
			private readonly ConstructorInfo _constructor;

			private readonly ParameterInfo[] _parameters;

			private readonly object[] _parameterValues;

			public ConstructorMatcher(ConstructorInfo constructor)
			{
				_constructor = constructor;
				_parameters = _constructor.GetParameters();
				_parameterValues = new object[_parameters.Length];
			}

			public int Match(object[] givenParameters)
			{
				int num = 0;
				int result = 0;
				for (int i = 0; i != givenParameters.Length; i++)
				{
					Type c = givenParameters[i]?.GetType();
					bool flag = false;
					int num2 = num;
					while (!flag && num2 != _parameters.Length)
					{
						if (_parameterValues[num2] == null && _parameters[num2].ParameterType.IsAssignableFrom(c))
						{
							flag = true;
							_parameterValues[num2] = givenParameters[i];
							if (num == num2)
							{
								num++;
								if (num2 == i)
								{
									result = num2;
								}
							}
						}
						num2++;
					}
					if (!flag)
					{
						return -1;
					}
				}
				return result;
			}

			public object CreateInstance(IServiceProvider provider)
			{
				for (int i = 0; i != _parameters.Length; i++)
				{
					if (_parameterValues[i] != null)
					{
						continue;
					}
					object service = provider.GetService(_parameters[i].ParameterType);
					if (service == null)
					{
						if (!ParameterDefaultValue.TryGetDefaultValue(_parameters[i], out object defaultValue))
						{
							throw new InvalidOperationException($"Unable to resolve service for type '{_parameters[i].ParameterType}' while attempting to activate '{_constructor.DeclaringType}'.");
						}
						_parameterValues[i] = defaultValue;
					}
					else
					{
						_parameterValues[i] = service;
					}
				}
				try
				{
					return _constructor.Invoke(_parameterValues);
				}
				catch (TargetInvocationException ex) when (ex.InnerException != null)
				{
					ExceptionDispatchInfo.Capture(ex.InnerException).Throw();
					throw;
				}
			}
		}

		private static readonly MethodInfo GetServiceInfo = GetMethodInfo<Func<IServiceProvider, Type, Type, bool, object>>((IServiceProvider sp, Type t, Type r, bool c) => GetService(sp, t, r, c));

		public static object CreateInstance(IServiceProvider provider, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type instanceType, params object[] parameters)
		{
			int num = -1;
			bool flag = false;
			ConstructorMatcher constructorMatcher = default(ConstructorMatcher);
			if (!instanceType.IsAbstract)
			{
				ConstructorInfo[] constructors = instanceType.GetConstructors();
				foreach (ConstructorInfo constructorInfo in constructors)
				{
					ConstructorMatcher constructorMatcher2 = new ConstructorMatcher(constructorInfo);
					bool flag2 = constructorInfo.IsDefined(typeof(ActivatorUtilitiesConstructorAttribute), inherit: false);
					int num2 = constructorMatcher2.Match(parameters);
					if (flag2)
					{
						if (flag)
						{
							ThrowMultipleCtorsMarkedWithAttributeException();
						}
						if (num2 == -1)
						{
							ThrowMarkedCtorDoesNotTakeAllProvidedArguments();
						}
					}
					if (flag2 || num < num2)
					{
						num = num2;
						constructorMatcher = constructorMatcher2;
					}
					flag = flag || flag2;
				}
			}
			if (num == -1)
			{
				string message = $"A suitable constructor for type '{instanceType}' could not be located. Ensure the type is concrete and all parameters of a public constructor are either registered as services or passed as arguments. Also ensure no extraneous arguments are provided.";
				throw new InvalidOperationException(message);
			}
			return constructorMatcher.CreateInstance(provider);
		}

		public static ObjectFactory CreateFactory([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type instanceType, Type[] argumentTypes)
		{
			FindApplicableConstructor(instanceType, argumentTypes, out var matchingConstructor, out var matchingParameterMap);
			ParameterExpression parameterExpression = Expression.Parameter(typeof(IServiceProvider), "provider");
			ParameterExpression parameterExpression2 = Expression.Parameter(typeof(object[]), "argumentArray");
			Expression body = BuildFactoryExpression(matchingConstructor, matchingParameterMap, parameterExpression, parameterExpression2);
			Expression<Func<IServiceProvider, object[], object>> expression = Expression.Lambda<Func<IServiceProvider, object[], object>>(body, new ParameterExpression[2] { parameterExpression, parameterExpression2 });
			Func<IServiceProvider, object[], object> @object = expression.Compile();
			return @object.Invoke;
		}

		public static T CreateInstance<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] T>(IServiceProvider provider, params object[] parameters)
		{
			return (T)CreateInstance(provider, typeof(T), parameters);
		}

		public static T GetServiceOrCreateInstance<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] T>(IServiceProvider provider)
		{
			return (T)GetServiceOrCreateInstance(provider, typeof(T));
		}

		public static object GetServiceOrCreateInstance(IServiceProvider provider, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type type)
		{
			return provider.GetService(type) ?? CreateInstance(provider, type);
		}

		private static MethodInfo GetMethodInfo<T>(Expression<T> expr)
		{
			MethodCallExpression methodCallExpression = (MethodCallExpression)expr.Body;
			return methodCallExpression.Method;
		}

		private static object GetService(IServiceProvider sp, Type type, Type requiredBy, bool isDefaultParameterRequired)
		{
			object service = sp.GetService(type);
			if (service == null && !isDefaultParameterRequired)
			{
				string message = $"Unable to resolve service for type '{type}' while attempting to activate '{requiredBy}'.";
				throw new InvalidOperationException(message);
			}
			return service;
		}

		private static Expression BuildFactoryExpression(ConstructorInfo constructor, int?[] parameterMap, Expression serviceProvider, Expression factoryArgumentArray)
		{
			ParameterInfo[] parameters = constructor.GetParameters();
			Expression[] array = new Expression[parameters.Length];
			for (int i = 0; i < parameters.Length; i++)
			{
				ParameterInfo parameterInfo = parameters[i];
				Type parameterType = parameterInfo.ParameterType;
				object defaultValue;
				bool flag = ParameterDefaultValue.TryGetDefaultValue(parameterInfo, out defaultValue);
				if (parameterMap[i].HasValue)
				{
					array[i] = Expression.ArrayAccess(factoryArgumentArray, Expression.Constant(parameterMap[i]));
				}
				else
				{
					Expression[] arguments = new Expression[4]
					{
						serviceProvider,
						Expression.Constant(parameterType, typeof(Type)),
						Expression.Constant(constructor.DeclaringType, typeof(Type)),
						Expression.Constant(flag)
					};
					array[i] = Expression.Call(GetServiceInfo, arguments);
				}
				if (flag)
				{
					ConstantExpression right = Expression.Constant(defaultValue);
					array[i] = Expression.Coalesce(array[i], right);
				}
				array[i] = Expression.Convert(array[i], parameterType);
			}
			return Expression.New(constructor, array);
		}

		private static void FindApplicableConstructor([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type instanceType, Type[] argumentTypes, out ConstructorInfo matchingConstructor, out int?[] matchingParameterMap)
		{
			ConstructorInfo matchingConstructor2 = null;
			int?[] parameterMap = null;
			if (!TryFindPreferredConstructor(instanceType, argumentTypes, ref matchingConstructor2, ref parameterMap) && !TryFindMatchingConstructor(instanceType, argumentTypes, ref matchingConstructor2, ref parameterMap))
			{
				string message = $"A suitable constructor for type '{instanceType}' could not be located. Ensure the type is concrete and all parameters of a public constructor are either registered as services or passed as arguments. Also ensure no extraneous arguments are provided.";
				throw new InvalidOperationException(message);
			}
			matchingConstructor = matchingConstructor2;
			matchingParameterMap = parameterMap;
		}

		private static bool TryFindMatchingConstructor([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type instanceType, Type[] argumentTypes, [NotNullWhen(true)] ref ConstructorInfo matchingConstructor, [NotNullWhen(true)] ref int?[] parameterMap)
		{
			ConstructorInfo[] constructors = instanceType.GetConstructors();
			foreach (ConstructorInfo constructorInfo in constructors)
			{
				if (TryCreateParameterMap(constructorInfo.GetParameters(), argumentTypes, out var parameterMap2))
				{
					if (matchingConstructor != null)
					{
						throw new InvalidOperationException($"Multiple constructors accepting all given argument types have been found in type '{instanceType}'. There should only be one applicable constructor.");
					}
					matchingConstructor = constructorInfo;
					parameterMap = parameterMap2;
				}
			}
			if (matchingConstructor != null)
			{
				return true;
			}
			return false;
		}

		private static bool TryFindPreferredConstructor([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type instanceType, Type[] argumentTypes, [NotNullWhen(true)] ref ConstructorInfo matchingConstructor, [NotNullWhen(true)] ref int?[] parameterMap)
		{
			bool flag = false;
			ConstructorInfo[] constructors = instanceType.GetConstructors();
			foreach (ConstructorInfo constructorInfo in constructors)
			{
				if (constructorInfo.IsDefined(typeof(ActivatorUtilitiesConstructorAttribute), inherit: false))
				{
					if (flag)
					{
						ThrowMultipleCtorsMarkedWithAttributeException();
					}
					if (!TryCreateParameterMap(constructorInfo.GetParameters(), argumentTypes, out var parameterMap2))
					{
						ThrowMarkedCtorDoesNotTakeAllProvidedArguments();
					}
					matchingConstructor = constructorInfo;
					parameterMap = parameterMap2;
					flag = true;
				}
			}
			if (matchingConstructor != null)
			{
				return true;
			}
			return false;
		}

		private static bool TryCreateParameterMap(ParameterInfo[] constructorParameters, Type[] argumentTypes, out int?[] parameterMap)
		{
			parameterMap = new int?[constructorParameters.Length];
			for (int i = 0; i < argumentTypes.Length; i++)
			{
				bool flag = false;
				Type c = argumentTypes[i];
				for (int j = 0; j < constructorParameters.Length; j++)
				{
					if (!parameterMap[j].HasValue && constructorParameters[j].ParameterType.IsAssignableFrom(c))
					{
						flag = true;
						parameterMap[j] = i;
						break;
					}
				}
				if (!flag)
				{
					return false;
				}
			}
			return true;
		}

		private static void ThrowMultipleCtorsMarkedWithAttributeException()
		{
			throw new InvalidOperationException("Multiple constructors were marked with ActivatorUtilitiesConstructorAttribute.");
		}

		private static void ThrowMarkedCtorDoesNotTakeAllProvidedArguments()
		{
			throw new InvalidOperationException("Constructor marked with ActivatorUtilitiesConstructorAttribute does not accept all given argument types.");
		}
	}
	[AttributeUsage(AttributeTargets.All)]
	public class ActivatorUtilitiesConstructorAttribute : Attribute
	{
	}
	public readonly struct AsyncServiceScope : IServiceScope, IDisposable, IAsyncDisposable
	{
		private readonly IServiceScope _serviceScope;

		public IServiceProvider ServiceProvider => _serviceScope.ServiceProvider;

		public AsyncServiceScope(IServiceScope serviceScope)
		{
			System.ThrowHelper.ThrowIfNull(serviceScope, "serviceScope");
			_serviceScope = serviceScope;
		}

		public void Dispose()
		{
			_serviceScope.Dispose();
		}

		public ValueTask DisposeAsync()
		{
			if (_serviceScope is IAsyncDisposable asyncDisposable)
			{
				return asyncDisposable.DisposeAsync();
			}
			_serviceScope.Dispose();
			return default(ValueTask);
		}
	}
	public interface IServiceCollection : IList<ServiceDescriptor>, ICollection<ServiceDescriptor>, IEnumerable<ServiceDescriptor>, IEnumerable
	{
	}
	public interface IServiceProviderFactory<TContainerBuilder> where TContainerBuilder : notnull
	{
		TContainerBuilder CreateBuilder(IServiceCollection services);

		IServiceProvider CreateServiceProvider(TContainerBuilder containerBuilder);
	}
	public interface IServiceProviderIsService
	{
		bool IsService(Type serviceType);
	}
	public interface IServiceScope : IDisposable
	{
		IServiceProvider ServiceProvider { get; }
	}
	public interface IServiceScopeFactory
	{
		IServiceScope CreateScope();
	}
	public interface ISupportRequiredService
	{
		object GetRequiredService(Type serviceType);
	}
	public delegate object ObjectFactory(IServiceProvider serviceProvider, object?[]? arguments);
	public class ServiceCollection : IServiceCollection, IList<ServiceDescriptor>, ICollection<ServiceDescriptor>, IEnumerable<ServiceDescriptor>, IEnumerable
	{
		private readonly List<ServiceDescriptor> _descriptors = new List<ServiceDescriptor>();

		private bool _isReadOnly;

		public int Count => _descriptors.Count;

		public bool IsReadOnly => _isReadOnly;

		public ServiceDescriptor this[int index]
		{
			get
			{
				return _descriptors[index];
			}
			set
			{
				CheckReadOnly();
				_descriptors[index] = value;
			}
		}

		public void Clear()
		{
			CheckReadOnly();
			_descriptors.Clear();
		}

		public bool Contains(ServiceDescriptor item)
		{
			return _descriptors.Contains(item);
		}

		public void CopyTo(ServiceDescriptor[] array, int arrayIndex)
		{
			_descriptors.CopyTo(array, arrayIndex);
		}

		public bool Remove(ServiceDescriptor item)
		{
			CheckReadOnly();
			return _descriptors.Remove(item);
		}

		public IEnumerator<ServiceDescriptor> GetEnumerator()
		{
			return _descriptors.GetEnumerator();
		}

		void ICollection<ServiceDescriptor>.Add(ServiceDescriptor item)
		{
			CheckReadOnly();
			_descriptors.Add(item);
		}

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

		public int IndexOf(ServiceDescriptor item)
		{
			return _descriptors.IndexOf(item);
		}

		public void Insert(int index, ServiceDescriptor item)
		{
			CheckReadOnly();
			_descriptors.Insert(index, item);
		}

		public void RemoveAt(int index)
		{
			CheckReadOnly();
			_descriptors.RemoveAt(index);
		}

		public void MakeReadOnly()
		{
			_isReadOnly = true;
		}

		private void CheckReadOnly()
		{
			if (_isReadOnly)
			{
				ThrowReadOnlyException();
			}
		}

		private static void ThrowReadOnlyException()
		{
			throw new InvalidOperationException(System.SR.ServiceCollectionReadOnly);
		}
	}
	public static class ServiceCollectionServiceExtensions
	{
		public static IServiceCollection AddTransient(this IServiceCollection services, Type serviceType, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type implementationType)
		{
			System.ThrowHelper.ThrowIfNull(services, "services");
			System.ThrowHelper.ThrowIfNull(serviceType, "serviceType");
			System.ThrowHelper.ThrowIfNull(implementationType, "implementationType");
			return Add(services, serviceType, implementationType, ServiceLifetime.Transient);
		}

		public static IServiceCollection AddTransient(this IServiceCollection services, Type serviceType, Func<IServiceProvider, object> implementationFactory)
		{
			System.ThrowHelper.ThrowIfNull(services, "services");
			System.ThrowHelper.ThrowIfNull(serviceType, "serviceType");
			System.ThrowHelper.ThrowIfNull(implementationFactory, "implementationFactory");
			return Add(services, serviceType, implementationFactory, ServiceLifetime.Transient);
		}

		public static IServiceCollection AddTransient<TService, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TImplementation>(this IServiceCollection services) where TService : class where TImplementation : class, TService
		{
			System.ThrowHelper.ThrowIfNull(services, "services");
			return services.AddTransient(typeof(TService), typeof(TImplementation));
		}

		public static IServiceCollection AddTransient(this IServiceCollection services, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type serviceType)
		{
			System.ThrowHelper.ThrowIfNull(services, "services");
			System.ThrowHelper.ThrowIfNull(serviceType, "serviceType");
			return services.AddTransient(serviceType, serviceType);
		}

		public static IServiceCollection AddTransient<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TService>(this IServiceCollection services) where TService : class
		{
			System.ThrowHelper.ThrowIfNull(services, "services");
			return services.AddTransient(typeof(TService));
		}

		public static IServiceCollection AddTransient<TService>(this IServiceCollection services, Func<IServiceProvider, TService> implementationFactory) where TService : class
		{
			System.ThrowHelper.ThrowIfNull(services, "services");
			System.ThrowHelper.ThrowIfNull(implementationFactory, "implementationFactory");
			return services.AddTransient(typeof(TService), implementationFactory);
		}

		public static IServiceCollection AddTransient<TService, TImplementation>(this IServiceCollection services, Func<IServiceProvider, TImplementation> implementationFactory) where TService : class where TImplementation : class, TService
		{
			System.ThrowHelper.ThrowIfNull(services, "services");
			System.ThrowHelper.ThrowIfNull(implementationFactory, "implementationFactory");
			return services.AddTransient(typeof(TService), implementationFactory);
		}

		public static IServiceCollection AddScoped(this IServiceCollection services, Type serviceType, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type implementationType)
		{
			System.ThrowHelper.ThrowIfNull(services, "services");
			System.ThrowHelper.ThrowIfNull(serviceType, "serviceType");
			System.ThrowHelper.ThrowIfNull(implementationType, "implementationType");
			return Add(services, serviceType, implementationType, ServiceLifetime.Scoped);
		}

		public static IServiceCollection AddScoped(this IServiceCollection services, Type serviceType, Func<IServiceProvider, object> implementationFactory)
		{
			System.ThrowHelper.ThrowIfNull(services, "services");
			System.ThrowHelper.ThrowIfNull(serviceType, "serviceType");
			System.ThrowHelper.ThrowIfNull(implementationFactory, "implementationFactory");
			return Add(services, serviceType, implementationFactory, ServiceLifetime.Scoped);
		}

		public static IServiceCollection AddScoped<TService, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TImplementation>(this IServiceCollection services) where TService : class where TImplementation : class, TService
		{
			System.ThrowHelper.ThrowIfNull(services, "services");
			return services.AddScoped(typeof(TService), typeof(TImplementation));
		}

		public static IServiceCollection AddScoped(this IServiceCollection services, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type serviceType)
		{
			System.ThrowHelper.ThrowIfNull(services, "services");
			System.ThrowHelper.ThrowIfNull(serviceType, "serviceType");
			return services.AddScoped(serviceType, serviceType);
		}

		public static IServiceCollection AddScoped<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TService>(this IServiceCollection services) where TService : class
		{
			System.ThrowHelper.ThrowIfNull(services, "services");
			return services.AddScoped(typeof(TService));
		}

		public static IServiceCollection AddScoped<TService>(this IServiceCollection services, Func<IServiceProvider, TService> implementationFactory) where TService : class
		{
			System.ThrowHelper.ThrowIfNull(services, "services");
			System.ThrowHelper.ThrowIfNull(implementationFactory, "implementationFactory");
			return services.AddScoped(typeof(TService), implementationFactory);
		}

		public static IServiceCollection AddScoped<TService, TImplementation>(this IServiceCollection services, Func<IServiceProvider, TImplementation> implementationFactory) where TService : class where TImplementation : class, TService
		{
			System.ThrowHelper.ThrowIfNull(services, "services");
			System.ThrowHelper.ThrowIfNull(implementationFactory, "implementationFactory");
			return services.AddScoped(typeof(TService), implementationFactory);
		}

		public static IServiceCollection AddSingleton(this IServiceCollection services, Type serviceType, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type implementationType)
		{
			System.ThrowHelper.ThrowIfNull(services, "services");
			System.ThrowHelper.ThrowIfNull(serviceType, "serviceType");
			System.ThrowHelper.ThrowIfNull(implementationType, "implementationType");
			return Add(services, serviceType, implementationType, ServiceLifetime.Singleton);
		}

		public static IServiceCollection AddSingleton(this IServiceCollection services, Type serviceType, Func<IServiceProvider, object> implementationFactory)
		{
			System.ThrowHelper.ThrowIfNull(services, "services");
			System.ThrowHelper.ThrowIfNull(serviceType, "serviceType");
			System.ThrowHelper.ThrowIfNull(implementationFactory, "implementationFactory");
			return Add(services, serviceType, implementationFactory, ServiceLifetime.Singleton);
		}

		public static IServiceCollection AddSingleton<TService, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TImplementation>(this IServiceCollection services) where TService : class where TImplementation : class, TService
		{
			System.ThrowHelper.ThrowIfNull(services, "services");
			return services.AddSingleton(typeof(TService), typeof(TImplementation));
		}

		public static IServiceCollection AddSingleton(this IServiceCollection services, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type serviceType)
		{
			System.ThrowHelper.ThrowIfNull(services, "services");
			System.ThrowHelper.ThrowIfNull(serviceType, "serviceType");
			return services.AddSingleton(serviceType, serviceType);
		}

		public static IServiceCollection AddSingleton<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TService>(this IServiceCollection services) where TService : class
		{
			System.ThrowHelper.ThrowIfNull(services, "services");
			return services.AddSingleton(typeof(TService));
		}

		public static IServiceCollection AddSingleton<TService>(this IServiceCollection services, Func<IServiceProvider, TService> implementationFactory) where TService : class
		{
			System.ThrowHelper.ThrowIfNull(services, "services");
			System.ThrowHelper.ThrowIfNull(implementationFactory, "implementationFactory");
			return services.AddSingleton(typeof(TService), implementationFactory);
		}

		public static IServiceCollection AddSingleton<TService, TImplementation>(this IServiceCollection services, Func<IServiceProvider, TImplementation> implementationFactory) where TService : class where TImplementation : class, TService
		{
			System.ThrowHelper.ThrowIfNull(services, "services");
			System.ThrowHelper.ThrowIfNull(implementationFactory, "implementationFactory");
			return services.AddSingleton(typeof(TService), implementationFactory);
		}

		public static IServiceCollection AddSingleton(this IServiceCollection services, Type serviceType, object implementationInstance)
		{
			System.ThrowHelper.ThrowIfNull(services, "services");
			System.ThrowHelper.ThrowIfNull(serviceType, "serviceType");
			System.ThrowHelper.ThrowIfNull(implementationInstance, "implementationInstance");
			ServiceDescriptor item = new ServiceDescriptor(serviceType, implementationInstance);
			services.Add(item);
			return services;
		}

		public static IServiceCollection AddSingleton<TService>(this IServiceCollection services, TService implementationInstance) where TService : class
		{
			System.ThrowHelper.ThrowIfNull(services, "services");
			System.ThrowHelper.ThrowIfNull(implementationInstance, "implementationInstance");
			return services.AddSingleton(typeof(TService), implementationInstance);
		}

		private static IServiceCollection Add(IServiceCollection collection, Type serviceType, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type implementationType, ServiceLifetime lifetime)
		{
			ServiceDescriptor item = new ServiceDescriptor(serviceType, implementationType, lifetime);
			collection.Add(item);
			return collection;
		}

		private static IServiceCollection Add(IServiceCollection collection, Type serviceType, Func<IServiceProvider, object> implementationFactory, ServiceLifetime lifetime)
		{
			ServiceDescriptor item = new ServiceDescriptor(serviceType, implementationFactory, lifetime);
			collection.Add(item);
			return collection;
		}
	}
	[DebuggerDisplay("Lifetime = {Lifetime}, ServiceType = {ServiceType}, ImplementationType = {ImplementationType}")]
	public class ServiceDescriptor
	{
		public ServiceLifetime Lifetime { get; }

		public Type ServiceType { get; }

		[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)]
		public Type? ImplementationType { get; }

		public object? ImplementationInstance { get; }

		public Func<IServiceProvider, object>? ImplementationFactory { get; }

		public ServiceDescriptor(Type serviceType, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type implementationType, ServiceLifetime lifetime)
			: this(serviceType, lifetime)
		{
			System.ThrowHelper.ThrowIfNull(serviceType, "serviceType");
			System.ThrowHelper.ThrowIfNull(implementationType, "implementationType");
			ImplementationType = implementationType;
		}

		public ServiceDescriptor(Type serviceType, object instance)
			: this(serviceType, ServiceLifetime.Singleton)
		{
			System.ThrowHelper.ThrowIfNull(serviceType, "serviceType");
			System.ThrowHelper.ThrowIfNull(instance, "instance");
			ImplementationInstance = instance;
		}

		public ServiceDescriptor(Type serviceType, Func<IServiceProvider, object> factory, ServiceLifetime lifetime)
			: this(serviceType, lifetime)
		{
			System.ThrowHelper.ThrowIfNull(serviceType, "serviceType");
			System.ThrowHelper.ThrowIfNull(factory, "factory");
			ImplementationFactory = factory;
		}

		private ServiceDescriptor(Type serviceType, ServiceLifetime lifetime)
		{
			Lifetime = lifetime;
			ServiceType = serviceType;
		}

		public override string ToString()
		{
			string text = string.Format("{0}: {1} {2}: {3} ", "ServiceType", ServiceType, "Lifetime", Lifetime);
			if (ImplementationType != null)
			{
				return text + string.Format("{0}: {1}", "ImplementationType", ImplementationType);
			}
			if (ImplementationFactory != null)
			{
				return text + string.Format("{0}: {1}", "ImplementationFactory", ImplementationFactory.Method);
			}
			return text + string.Format("{0}: {1}", "ImplementationInstance", ImplementationInstance);
		}

		internal Type GetImplementationType()
		{
			if (ImplementationType != null)
			{
				return ImplementationType;
			}
			if (ImplementationInstance != null)
			{
				return ImplementationInstance.GetType();
			}
			if (ImplementationFactory != null)
			{
				Type[] genericTypeArguments = ImplementationFactory.GetType().GenericTypeArguments;
				return genericTypeArguments[1];
			}
			return null;
		}

		public static ServiceDescriptor Transient<TService, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TImplementation>() where TService : class where TImplementation : class, TService
		{
			return Describe<TService, TImplementation>(ServiceLifetime.Transient);
		}

		public static ServiceDescriptor Transient(Type service, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type implementationType)
		{
			System.ThrowHelper.ThrowIfNull(service, "service");
			System.ThrowHelper.ThrowIfNull(implementationType, "implementationType");
			return Describe(service, implementationType, ServiceLifetime.Transient);
		}

		public static ServiceDescriptor Transient<TService, TImplementation>(Func<IServiceProvider, TImplementation> implementationFactory) where TService : class where TImplementation : class, TService
		{
			System.ThrowHelper.ThrowIfNull(implementationFactory, "implementationFactory");
			return Describe(typeof(TService), implementationFactory, ServiceLifetime.Transient);
		}

		public static ServiceDescriptor Transient<TService>(Func<IServiceProvider, TService> implementationFactory) where TService : class
		{
			System.ThrowHelper.ThrowIfNull(implementationFactory, "implementationFactory");
			return Describe(typeof(TService), implementationFactory, ServiceLifetime.Transient);
		}

		public static ServiceDescriptor Transient(Type service, Func<IServiceProvider, object> implementationFactory)
		{
			System.ThrowHelper.ThrowIfNull(service, "service");
			System.ThrowHelper.ThrowIfNull(implementationFactory, "implementationFactory");
			return Describe(service, implementationFactory, ServiceLifetime.Transient);
		}

		public static ServiceDescriptor Scoped<TService, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TImplementation>() where TService : class where TImplementation : class, TService
		{
			return Describe<TService, TImplementation>(ServiceLifetime.Scoped);
		}

		public static ServiceDescriptor Scoped(Type service, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type implementationType)
		{
			return Describe(service, implementationType, ServiceLifetime.Scoped);
		}

		public static ServiceDescriptor Scoped<TService, TImplementation>(Func<IServiceProvider, TImplementation> implementationFactory) where TService : class where TImplementation : class, TService
		{
			System.ThrowHelper.ThrowIfNull(implementationFactory, "implementationFactory");
			return Describe(typeof(TService), implementationFactory, ServiceLifetime.Scoped);
		}

		public static ServiceDescriptor Scoped<TService>(Func<IServiceProvider, TService> implementationFactory) where TService : class
		{
			System.ThrowHelper.ThrowIfNull(implementationFactory, "implementationFactory");
			return Describe(typeof(TService), implementationFactory, ServiceLifetime.Scoped);
		}

		public static ServiceDescriptor Scoped(Type service, Func<IServiceProvider, object> implementationFactory)
		{
			System.ThrowHelper.ThrowIfNull(service, "service");
			System.ThrowHelper.ThrowIfNull(implementationFactory, "implementationFactory");
			return Describe(service, implementationFactory, ServiceLifetime.Scoped);
		}

		public static ServiceDescriptor Singleton<TService, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TImplementation>() where TService : class where TImplementation : class, TService
		{
			return Describe<TService, TImplementation>(ServiceLifetime.Singleton);
		}

		public static ServiceDescriptor Singleton(Type service, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type implementationType)
		{
			System.ThrowHelper.ThrowIfNull(service, "service");
			System.ThrowHelper.ThrowIfNull(implementationType, "implementationType");
			return Describe(service, implementationType, ServiceLifetime.Singleton);
		}

		public static ServiceDescriptor Singleton<TService, TImplementation>(Func<IServiceProvider, TImplementation> implementationFactory) where TService : class where TImplementation : class, TService
		{
			System.ThrowHelper.ThrowIfNull(implementationFactory, "implementationFactory");
			return Describe(typeof(TService), implementationFactory, ServiceLifetime.Singleton);
		}

		public static ServiceDescriptor Singleton<TService>(Func<IServiceProvider, TService> implementationFactory) where TService : class
		{
			System.ThrowHelper.ThrowIfNull(implementationFactory, "implementationFactory");
			return Describe(typeof(TService), implementationFactory, ServiceLifetime.Singleton);
		}

		public static ServiceDescriptor Singleton(Type serviceType, Func<IServiceProvider, object> implementationFactory)
		{
			System.ThrowHelper.ThrowIfNull(serviceType, "serviceType");
			System.ThrowHelper.ThrowIfNull(implementationFactory, "implementationFactory");
			return Describe(serviceType, implementationFactory, ServiceLifetime.Singleton);
		}

		public static ServiceDescriptor Singleton<TService>(TService implementationInstance) where TService : class
		{
			System.ThrowHelper.ThrowIfNull(implementationInstance, "implementationInstance");
			return Singleton(typeof(TService), implementationInstance);
		}

		public static ServiceDescriptor Singleton(Type serviceType, object implementationInstance)
		{
			System.ThrowHelper.ThrowIfNull(serviceType, "serviceType");
			System.ThrowHelper.ThrowIfNull(implementationInstance, "implementationInstance");
			return new ServiceDescriptor(serviceType, implementationInstance);
		}

		private static ServiceDescriptor Describe<TService, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TImplementation>(ServiceLifetime lifetime) where TService : class where TImplementation : class, TService
		{
			return Describe(typeof(TService), typeof(TImplementation), lifetime);
		}

		public static ServiceDescriptor Describe(Type serviceType, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type implementationType, ServiceLifetime lifetime)
		{
			return new ServiceDescriptor(serviceType, implementationType, lifetime);
		}

		public static ServiceDescriptor Describe(Type serviceType, Func<IServiceProvider, object> implementationFactory, ServiceLifetime lifetime)
		{
			return new ServiceDescriptor(serviceType, implementationFactory, lifetime);
		}
	}
	public enum ServiceLifetime
	{
		Singleton,
		Scoped,
		Transient
	}
	public static class ServiceProviderServiceExtensions
	{
		public static T? GetService<T>(this IServiceProvider provider)
		{
			System.ThrowHelper.ThrowIfNull(provider, "provider");
			return (T)provider.GetService(typeof(T));
		}

		public static object GetRequiredService(this IServiceProvider provider, Type serviceType)
		{
			System.ThrowHelper.ThrowIfNull(provider, "provider");
			System.ThrowHelper.ThrowIfNull(serviceType, "serviceType");
			if (provider is ISupportRequiredService supportRequiredService)
			{
				return supportRequiredService.GetRequiredService(serviceType);
			}
			object service = provider.GetService(serviceType);
			if (service == null)
			{
				throw new InvalidOperationException(System.SR.Format(System.SR.NoServiceRegistered, serviceType));
			}
			return service;
		}

		public static T GetRequiredService<T>(this IServiceProvider provider) where T : notnull
		{
			System.ThrowHelper.ThrowIfNull(provider, "provider");
			return (T)provider.GetRequiredService(typeof(T));
		}

		public static IEnumerable<T> GetServices<T>(this IServiceProvider provider)
		{
			System.ThrowHelper.ThrowIfNull(provider, "provider");
			return provider.GetRequiredService<IEnumerable<T>>();
		}

		[RequiresDynamicCode("The native code for an IEnumerable<serviceType> might not be available at runtime.")]
		public static IEnumerable<object?> GetServices(this IServiceProvider provider, Type serviceType)
		{
			System.ThrowHelper.ThrowIfNull(provider, "provider");
			System.ThrowHelper.ThrowIfNull(serviceType, "serviceType");
			Type serviceType2 = typeof(IEnumerable<>).MakeGenericType(serviceType);
			return (IEnumerable<object>)provider.GetRequiredService(serviceType2);
		}

		public static IServiceScope CreateScope(this IServiceProvider provider)
		{
			return provider.GetRequiredService<IServiceScopeFactory>().CreateScope();
		}

		public static AsyncServiceScope CreateAsyncScope(this IServiceProvider provider)
		{
			return new AsyncServiceScope(provider.CreateScope());
		}

		public static AsyncServiceScope CreateAsyncScope(this IServiceScopeFactory serviceScopeFactory)
		{
			return new AsyncServiceScope(serviceScopeFactory.CreateScope());
		}
	}
}
namespace Microsoft.Extensions.DependencyInjection.Extensions
{
	public static class ServiceCollectionDescriptorExtensions
	{
		public static IServiceCollection Add(this IServiceCollection collection, ServiceDescriptor descriptor)
		{
			System.ThrowHelper.ThrowIfNull(collection, "collection");
			System.ThrowHelper.ThrowIfNull(descriptor, "descriptor");
			collection.Add(descriptor);
			return collection;
		}

		public static IServiceCollection Add(this IServiceCollection collection, IEnumerable<ServiceDescriptor> descriptors)
		{
			System.ThrowHelper.ThrowIfNull(collection, "collection");
			System.ThrowHelper.ThrowIfNull(descriptors, "descriptors");
			foreach (ServiceDescriptor descriptor in descriptors)
			{
				collection.Add(descriptor);
			}
			return collection;
		}

		public static void TryAdd(this IServiceCollection collection, ServiceDescriptor descriptor)
		{
			System.ThrowHelper.ThrowIfNull(collection, "collection");
			System.ThrowHelper.ThrowIfNull(descriptor, "descriptor");
			int count = collection.Count;
			for (int i = 0; i < count; i++)
			{
				if (collection[i].ServiceType == descriptor.ServiceType)
				{
					return;
				}
			}
			collection.Add(descriptor);
		}

		public static void TryAdd(this IServiceCollection collection, IEnumerable<ServiceDescriptor> descriptors)
		{
			System.ThrowHelper.ThrowIfNull(collection, "collection");
			System.ThrowHelper.ThrowIfNull(descriptors, "descriptors");
			foreach (ServiceDescriptor descriptor in descriptors)
			{
				collection.TryAdd(descriptor);
			}
		}

		public static void TryAddTransient(this IServiceCollection collection, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type service)
		{
			System.ThrowHelper.ThrowIfNull(collection, "collection");
			System.ThrowHelper.ThrowIfNull(service, "service");
			ServiceDescriptor descriptor = ServiceDescriptor.Transient(service, service);
			collection.TryAdd(descriptor);
		}

		public static void TryAddTransient(this IServiceCollection collection, Type service, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type implementationType)
		{
			System.ThrowHelper.ThrowIfNull(collection, "collection");
			System.ThrowHelper.ThrowIfNull(service, "service");
			System.ThrowHelper.ThrowIfNull(implementationType, "implementationType");
			ServiceDescriptor descriptor = ServiceDescriptor.Transient(service, implementationType);
			collection.TryAdd(descriptor);
		}

		public static void TryAddTransient(this IServiceCollection collection, Type service, Func<IServiceProvider, object> implementationFactory)
		{
			System.ThrowHelper.ThrowIfNull(collection, "collection");
			System.ThrowHelper.ThrowIfNull(service, "service");
			System.ThrowHelper.ThrowIfNull(implementationFactory, "implementationFactory");
			ServiceDescriptor descriptor = ServiceDescriptor.Transient(service, implementationFactory);
			collection.TryAdd(descriptor);
		}

		public static void TryAddTransient<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TService>(this IServiceCollection collection) where TService : class
		{
			System.ThrowHelper.ThrowIfNull(collection, "collection");
			collection.TryAddTransient(typeof(TService), typeof(TService));
		}

		public static void TryAddTransient<TService, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TImplementation>(this IServiceCollection collection) where TService : class where TImplementation : class, TService
		{
			System.ThrowHelper.ThrowIfNull(collection, "collection");
			collection.TryAddTransient(typeof(TService), typeof(TImplementation));
		}

		public static void TryAddTransient<TService>(this IServiceCollection services, Func<IServiceProvider, TService> implementationFactory) where TService : class
		{
			services.TryAdd(ServiceDescriptor.Transient(implementationFactory));
		}

		public static void TryAddScoped(this IServiceCollection collection, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type service)
		{
			System.ThrowHelper.ThrowIfNull(collection, "collection");
			System.ThrowHelper.ThrowIfNull(service, "service");
			ServiceDescriptor descriptor = ServiceDescriptor.Scoped(service, service);
			collection.TryAdd(descriptor);
		}

		public static void TryAddScoped(this IServiceCollection collection, Type service, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type implementationType)
		{
			System.ThrowHelper.ThrowIfNull(collection, "collection");
			System.ThrowHelper.ThrowIfNull(service, "service");
			System.ThrowHelper.ThrowIfNull(implementationType, "implementationType");
			ServiceDescriptor descriptor = ServiceDescriptor.Scoped(service, implementationType);
			collection.TryAdd(descriptor);
		}

		public static void TryAddScoped(this IServiceCollection collection, Type service, Func<IServiceProvider, object> implementationFactory)
		{
			System.ThrowHelper.ThrowIfNull(collection, "collection");
			System.ThrowHelper.ThrowIfNull(service, "service");
			System.ThrowHelper.ThrowIfNull(implementationFactory, "implementationFactory");
			ServiceDescriptor descriptor = ServiceDescriptor.Scoped(service, implementationFactory);
			collection.TryAdd(descriptor);
		}

		public static void TryAddScoped<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TService>(this IServiceCollection collection) where TService : class
		{
			System.ThrowHelper.ThrowIfNull(collection, "collection");
			collection.TryAddScoped(typeof(TService), typeof(TService));
		}

		public static void TryAddScoped<TService, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TImplementation>(this IServiceCollection collection) where TService : class where TImplementation : class, TService
		{
			System.ThrowHelper.ThrowIfNull(collection, "collection");
			collection.TryAddScoped(typeof(TService), typeof(TImplementation));
		}

		public static void TryAddScoped<TService>(this IServiceCollection services, Func<IServiceProvider, TService> implementationFactory) where TService : class
		{
			services.TryAdd(ServiceDescriptor.Scoped(implementationFactory));
		}

		public static void TryAddSingleton(this IServiceCollection collection, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type service)
		{
			System.ThrowHelper.ThrowIfNull(collection, "collection");
			System.ThrowHelper.ThrowIfNull(service, "service");
			ServiceDescriptor descriptor = ServiceDescriptor.Singleton(service, service);
			collection.TryAdd(descriptor);
		}

		public static void TryAddSingleton(this IServiceCollection collection, Type service, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type implementationType)
		{
			System.ThrowHelper.ThrowIfNull(collection, "collection");
			System.ThrowHelper.ThrowIfNull(service, "service");
			System.ThrowHelper.ThrowIfNull(implementationType, "implementationType");
			ServiceDescriptor descriptor = ServiceDescriptor.Singleton(service, implementationType);
			collection.TryAdd(descriptor);
		}

		public static void TryAddSingleton(this IServiceCollection collection, Type service, Func<IServiceProvider, object> implementationFactory)
		{
			System.ThrowHelper.ThrowIfNull(collection, "collection");
			System.ThrowHelper.ThrowIfNull(service, "service");
			System.ThrowHelper.ThrowIfNull(implementationFactory, "implementationFactory");
			ServiceDescriptor descriptor = ServiceDescriptor.Singleton(service, implementationFactory);
			collection.TryAdd(descriptor);
		}

		public static void TryAddSingleton<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TService>(this IServiceCollection collection) where TService : class
		{
			System.ThrowHelper.ThrowIfNull(collection, "collection");
			collection.TryAddSingleton(typeof(TService), typeof(TService));
		}

		public static void TryAddSingleton<TService, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TImplementation>(this IServiceCollection collection) where TService : class where TImplementation : class, TService
		{
			System.ThrowHelper.ThrowIfNull(collection, "collection");
			collection.TryAddSingleton(typeof(TService), typeof(TImplementation));
		}

		public static void TryAddSingleton<TService>(this IServiceCollection collection, TService instance) where TService : class
		{
			System.ThrowHelper.ThrowIfNull(collection, "collection");
			System.ThrowHelper.ThrowIfNull(instance, "instance");
			ServiceDescriptor descriptor = ServiceDescriptor.Singleton(typeof(TService), instance);
			collection.TryAdd(descriptor);
		}

		public static void TryAddSingleton<TService>(this IServiceCollection services, Func<IServiceProvider, TService> implementationFactory) where TService : class
		{
			services.TryAdd(ServiceDescriptor.Singleton(implementationFactory));
		}

		public static void TryAddEnumerable(this IServiceCollection services, ServiceDescriptor descriptor)
		{
			System.ThrowHelper.ThrowIfNull(services, "services");
			System.ThrowHelper.ThrowIfNull(descriptor, "descriptor");
			Type implementationType = descriptor.GetImplementationType();
			if (implementationType == typeof(object) || implementationType == descriptor.ServiceType)
			{
				throw new ArgumentException(System.SR.Format(System.SR.TryAddIndistinguishableTypeToEnumerable, implementationType, descriptor.ServiceType), "descriptor");
			}
			int count = services.Count;
			for (int i = 0; i < count; i++)
			{
				ServiceDescriptor serviceDescriptor = services[i];
				if (serviceDescriptor.ServiceType == descriptor.ServiceType && serviceDescriptor.GetImplementationType() == implementationType)
				{
					return;
				}
			}
			services.Add(descriptor);
		}

		public static void TryAddEnumerable(this IServiceCollection services, IEnumerable<ServiceDescriptor> descriptors)
		{
			System.ThrowHelper.ThrowIfNull(services, "services");
			System.ThrowHelper.ThrowIfNull(descriptors, "descriptors");
			foreach (ServiceDescriptor descriptor in descriptors)
			{
				services.TryAddEnumerable(descriptor);
			}
		}

		public static IServiceCollection Replace(this IServiceCollection collection, ServiceDescriptor descriptor)
		{
			System.ThrowHelper.ThrowIfNull(collection, "collection");
			System.ThrowHelper.ThrowIfNull(descriptor, "descriptor");
			int count = collection.Count;
			for (int i = 0; i < count; i++)
			{
				if (collection[i].ServiceType == descriptor.ServiceType)
				{
					collection.RemoveAt(i);
					break;
				}
			}
			collection.Add(descriptor);
			return collection;
		}

		public static IServiceCollection RemoveAll<T>(this IServiceCollection collection)
		{
			return collection.RemoveAll(typeof(T));
		}

		public static IServiceCollection RemoveAll(this IServiceCollection collection, Type serviceType)
		{
			System.ThrowHelper.ThrowIfNull(serviceType, "serviceType");
			for (int num = collection.Count - 1; num >= 0; num--)
			{
				ServiceDescriptor serviceDescriptor = collection[num];
				if (serviceDescriptor.ServiceType == serviceType)
				{
					collection.RemoveAt(num);
				}
			}
			return collection;
		}
	}
}

BepInEx/plugins/SlopCrew.Plugin/Microsoft.Extensions.DependencyInjection.dll

Decompiled 8 months ago
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Diagnostics.Tracing;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Reflection.Emit;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.ExceptionServices;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Runtime.Versioning;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using FxResources.Microsoft.Extensions.DependencyInjection;
using Microsoft.CodeAnalysis;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.ServiceLookup;
using Microsoft.Extensions.Internal;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: InternalsVisibleTo("Microsoft.Extensions.DependencyInjection.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("MicroBenchmarks, PublicKey=00240000048000009400000006020000002400005253413100040000010001004b86c4cb78549b34bab61a3b1800e23bfeb5b3ec390074041536a7e3cbd97f5f04cf0f857155a8928eaa29ebfd11cfbbad3ba70efea7bda3226c6a8d370a4cd303f714486b6ebc225985a638471e6ef571cc92a4613c00b8fa65d61ccee0cbe5f36330c9a01f4183559f1bef24cc2917c6d913e3a541333a1d05d9bed22b38cb")]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: AssemblyMetadata(".NETFrameworkAssembly", "")]
[assembly: AssemblyMetadata("Serviceable", "True")]
[assembly: AssemblyMetadata("PreferInbox", "True")]
[assembly: AssemblyDefaultAlias("Microsoft.Extensions.DependencyInjection")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: CLSCompliant(true)]
[assembly: AssemblyMetadata("IsTrimmable", "True")]
[assembly: DefaultDllImportSearchPaths(DllImportSearchPath.System32 | DllImportSearchPath.AssemblyDirectory)]
[assembly: AssemblyCompany("Microsoft Corporation")]
[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")]
[assembly: AssemblyDescription("Default implementation of dependency injection for Microsoft.Extensions.DependencyInjection.")]
[assembly: AssemblyFileVersion("7.0.22.51805")]
[assembly: AssemblyInformationalVersion("7.0.0+d099f075e45d2aa6007a22b71b45a08758559f80")]
[assembly: AssemblyProduct("Microsoft® .NET")]
[assembly: AssemblyTitle("Microsoft.Extensions.DependencyInjection")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/dotnet/runtime")]
[assembly: AssemblyVersion("7.0.0.0")]
[assembly: TypeForwardedTo(typeof(ServiceCollection))]
[module: RefSafetyRules(11)]
[module: System.Runtime.CompilerServices.NullablePublicOnly(true)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class IsReadOnlyAttribute : Attribute
	{
	}
	[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 NullablePublicOnlyAttribute : Attribute
	{
		public readonly bool IncludesInternals;

		public NullablePublicOnlyAttribute(bool P_0)
		{
			IncludesInternals = 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 FxResources.Microsoft.Extensions.DependencyInjection
{
	internal static class SR
	{
	}
}
namespace System
{
	internal static class SR
	{
		private static readonly bool s_usingResourceKeys = AppContext.TryGetSwitch("System.Resources.UseSystemResourceKeys", out var isEnabled) && isEnabled;

		private static ResourceManager s_resourceManager;

		internal static ResourceManager ResourceManager => s_resourceManager ?? (s_resourceManager = new ResourceManager(typeof(SR)));

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

		private static bool UsingResourceKeys()
		{
			return s_usingResourceKeys;
		}

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

		internal static string GetResourceString(string resourceKey, string defaultString)
		{
			string resourceString = GetResourceString(resourceKey);
			if (!(resourceKey == resourceString) && resourceString != null)
			{
				return resourceString;
			}
			return defaultString;
		}

		internal static string Format(string resourceFormat, object? p1)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1);
			}
			return string.Format(resourceFormat, p1);
		}

		internal static string Format(string resourceFormat, object? p1, object? p2)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2);
			}
			return string.Format(resourceFormat, p1, p2);
		}

		internal static string Format(string resourceFormat, object? p1, object? p2, object? p3)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2, p3);
			}
			return string.Format(resourceFormat, p1, p2, p3);
		}

		internal static string Format(string resourceFormat, params object?[]? args)
		{
			if (args != null)
			{
				if (UsingResourceKeys())
				{
					return resourceFormat + ", " + string.Join(", ", args);
				}
				return string.Format(resourceFormat, args);
			}
			return resourceFormat;
		}

		internal static string Format(IFormatProvider? provider, string resourceFormat, object? p1)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1);
			}
			return string.Format(provider, resourceFormat, p1);
		}

		internal static string Format(IFormatProvider? provider, string resourceFormat, object? p1, object? p2)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2);
			}
			return string.Format(provider, resourceFormat, p1, p2);
		}

		internal static string Format(IFormatProvider? provider, string resourceFormat, object? p1, object? p2, object? p3)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2, p3);
			}
			return string.Format(provider, resourceFormat, p1, p2, p3);
		}

		internal static string Format(IFormatProvider? provider, string resourceFormat, params object?[]? args)
		{
			if (args != null)
			{
				if (UsingResourceKeys())
				{
					return resourceFormat + ", " + string.Join(", ", args);
				}
				return string.Format(provider, resourceFormat, args);
			}
			return resourceFormat;
		}
	}
}
namespace System.Runtime.InteropServices
{
	[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
	internal sealed class LibraryImportAttribute : Attribute
	{
		public string LibraryName { get; }

		public string? EntryPoint { get; set; }

		public StringMarshalling StringMarshalling { get; set; }

		public Type? StringMarshallingCustomType { get; set; }

		public bool SetLastError { get; set; }

		public LibraryImportAttribute(string libraryName)
		{
			LibraryName = libraryName;
		}
	}
	internal enum StringMarshalling
	{
		Custom,
		Utf8,
		Utf16
	}
}
namespace System.Diagnostics.CodeAnalysis
{
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Interface | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, Inherited = false)]
	internal sealed class DynamicallyAccessedMembersAttribute : Attribute
	{
		public DynamicallyAccessedMemberTypes MemberTypes { get; }

		public DynamicallyAccessedMembersAttribute(DynamicallyAccessedMemberTypes memberTypes)
		{
			MemberTypes = memberTypes;
		}
	}
	[Flags]
	internal enum DynamicallyAccessedMemberTypes
	{
		None = 0,
		PublicParameterlessConstructor = 1,
		PublicConstructors = 3,
		NonPublicConstructors = 4,
		PublicMethods = 8,
		NonPublicMethods = 0x10,
		PublicFields = 0x20,
		NonPublicFields = 0x40,
		PublicNestedTypes = 0x80,
		NonPublicNestedTypes = 0x100,
		PublicProperties = 0x200,
		NonPublicProperties = 0x400,
		PublicEvents = 0x800,
		NonPublicEvents = 0x1000,
		Interfaces = 0x2000,
		All = -1
	}
	[AttributeUsage(AttributeTargets.All, Inherited = false, AllowMultiple = true)]
	internal sealed class UnconditionalSuppressMessageAttribute : Attribute
	{
		public string Category { get; }

		public string CheckId { get; }

		public string? Scope { get; set; }

		public string? Target { get; set; }

		public string? MessageId { get; set; }

		public string? Justification { get; set; }

		public UnconditionalSuppressMessageAttribute(string category, string checkId)
		{
			Category = category;
			CheckId = checkId;
		}
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Constructor | AttributeTargets.Method, Inherited = false)]
	internal sealed class RequiresDynamicCodeAttribute : Attribute
	{
		public string Message { get; }

		public string? Url { get; set; }

		public RequiresDynamicCodeAttribute(string message)
		{
			Message = message;
		}
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)]
	internal sealed class AllowNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)]
	internal sealed class DisallowNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)]
	internal sealed class MaybeNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)]
	internal sealed class NotNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class MaybeNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public MaybeNullWhenAttribute(bool returnValue)
		{
			ReturnValue = returnValue;
		}
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class NotNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public NotNullWhenAttribute(bool returnValue)
		{
			ReturnValue = returnValue;
		}
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = true, Inherited = false)]
	internal sealed class NotNullIfNotNullAttribute : Attribute
	{
		public string ParameterName { get; }

		public NotNullIfNotNullAttribute(string parameterName)
		{
			ParameterName = parameterName;
		}
	}
	[AttributeUsage(AttributeTargets.Method, Inherited = false)]
	internal sealed class DoesNotReturnAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class DoesNotReturnIfAttribute : Attribute
	{
		public bool ParameterValue { get; }

		public DoesNotReturnIfAttribute(bool parameterValue)
		{
			ParameterValue = parameterValue;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	internal sealed class MemberNotNullAttribute : Attribute
	{
		public string[] Members { get; }

		public MemberNotNullAttribute(string member)
		{
			Members = new string[1] { member };
		}

		public MemberNotNullAttribute(params string[] members)
		{
			Members = members;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	internal sealed class MemberNotNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public string[] Members { get; }

		public MemberNotNullWhenAttribute(bool returnValue, string member)
		{
			ReturnValue = returnValue;
			Members = new string[1] { member };
		}

		public MemberNotNullWhenAttribute(bool returnValue, params string[] members)
		{
			ReturnValue = returnValue;
			Members = members;
		}
	}
}
namespace Microsoft.Extensions.DependencyInjection
{
	internal sealed class CallSiteJsonFormatter : CallSiteVisitor<CallSiteJsonFormatter.CallSiteFormatterContext, object?>
	{
		internal struct CallSiteFormatterContext
		{
			private readonly HashSet<ServiceCallSite> _processedCallSites;

			private bool _firstItem;

			public int Offset { get; }

			public StringBuilder Builder { get; }

			public CallSiteFormatterContext(StringBuilder builder, int offset, HashSet<ServiceCallSite> processedCallSites)
			{
				Builder = builder;
				Offset = offset;
				_processedCallSites = processedCallSites;
				_firstItem = true;
			}

			public bool ShouldFormat(ServiceCallSite serviceCallSite)
			{
				return _processedCallSites.Add(serviceCallSite);
			}

			public CallSiteFormatterContext IncrementOffset()
			{
				CallSiteFormatterContext result = new CallSiteFormatterContext(Builder, Offset + 4, _processedCallSites);
				result._firstItem = true;
				return result;
			}

			public CallSiteFormatterContext StartObject()
			{
				Builder.Append('{');
				return IncrementOffset();
			}

			public void EndObject()
			{
				Builder.Append('}');
			}

			public void StartProperty(string name)
			{
				if (!_firstItem)
				{
					Builder.Append(',');
				}
				else
				{
					_firstItem = false;
				}
				Builder.AppendFormat("\"{0}\":", name);
			}

			public void StartArrayItem()
			{
				if (!_firstItem)
				{
					Builder.Append(',');
				}
				else
				{
					_firstItem = false;
				}
			}

			public void WriteProperty(string name, object? value)
			{
				StartProperty(name);
				if (value != null)
				{
					Builder.AppendFormat(" \"{0}\"", value);
				}
				else
				{
					Builder.Append("null");
				}
			}

			public CallSiteFormatterContext StartArray()
			{
				Builder.Append('[');
				return IncrementOffset();
			}

			public void EndArray()
			{
				Builder.Append(']');
			}
		}

		internal static CallSiteJsonFormatter Instance = new CallSiteJsonFormatter();

		private CallSiteJsonFormatter()
		{
		}

		public string Format(ServiceCallSite callSite)
		{
			StringBuilder stringBuilder = new StringBuilder();
			CallSiteFormatterContext argument = new CallSiteFormatterContext(stringBuilder, 0, new HashSet<ServiceCallSite>());
			VisitCallSite(callSite, argument);
			return stringBuilder.ToString();
		}

		protected override object? VisitConstructor(ConstructorCallSite constructorCallSite, CallSiteFormatterContext argument)
		{
			argument.WriteProperty("implementationType", constructorCallSite.ImplementationType);
			if (constructorCallSite.ParameterCallSites.Length != 0)
			{
				argument.StartProperty("arguments");
				CallSiteFormatterContext argument2 = argument.StartArray();
				ServiceCallSite[] parameterCallSites = constructorCallSite.ParameterCallSites;
				foreach (ServiceCallSite callSite in parameterCallSites)
				{
					argument2.StartArrayItem();
					VisitCallSite(callSite, argument2);
				}
				argument.EndArray();
			}
			return null;
		}

		protected override object? VisitCallSiteMain(ServiceCallSite callSite, CallSiteFormatterContext argument)
		{
			if (argument.ShouldFormat(callSite))
			{
				CallSiteFormatterContext argument2 = argument.StartObject();
				argument2.WriteProperty("serviceType", callSite.ServiceType);
				argument2.WriteProperty("kind", callSite.Kind);
				argument2.WriteProperty("cache", callSite.Cache.Location);
				base.VisitCallSiteMain(callSite, argument2);
				argument.EndObject();
			}
			else
			{
				argument.StartObject().WriteProperty("ref", callSite.ServiceType);
				argument.EndObject();
			}
			return null;
		}

		protected override object? VisitConstant(ConstantCallSite constantCallSite, CallSiteFormatterContext argument)
		{
			argument.WriteProperty("value", constantCallSite.DefaultValue ?? "");
			return null;
		}

		protected override object? VisitServiceProvider(ServiceProviderCallSite serviceProviderCallSite, CallSiteFormatterContext argument)
		{
			return null;
		}

		protected override object? VisitIEnumerable(IEnumerableCallSite enumerableCallSite, CallSiteFormatterContext argument)
		{
			argument.WriteProperty("itemType", enumerableCallSite.ItemType);
			argument.WriteProperty("size", enumerableCallSite.ServiceCallSites.Length);
			if (enumerableCallSite.ServiceCallSites.Length != 0)
			{
				argument.StartProperty("items");
				CallSiteFormatterContext argument2 = argument.StartArray();
				ServiceCallSite[] serviceCallSites = enumerableCallSite.ServiceCallSites;
				foreach (ServiceCallSite callSite in serviceCallSites)
				{
					argument2.StartArrayItem();
					VisitCallSite(callSite, argument2);
				}
				argument.EndArray();
			}
			return null;
		}

		protected override object? VisitFactory(FactoryCallSite factoryCallSite, CallSiteFormatterContext argument)
		{
			argument.WriteProperty("method", factoryCallSite.Factory.Method);
			return null;
		}
	}
	[RequiresDynamicCode("Using Microsoft.Extensions.DependencyInjection requires generating code dynamically at runtime. For example, when using enumerable and generic ValueType services.")]
	public class DefaultServiceProviderFactory : IServiceProviderFactory<IServiceCollection>
	{
		private readonly ServiceProviderOptions _options;

		public DefaultServiceProviderFactory()
			: this(ServiceProviderOptions.Default)
		{
		}

		public DefaultServiceProviderFactory(ServiceProviderOptions options)
		{
			_options = options ?? throw new ArgumentNullException("options");
		}

		public IServiceCollection CreateBuilder(IServiceCollection services)
		{
			return services;
		}

		public IServiceProvider CreateServiceProvider(IServiceCollection containerBuilder)
		{
			return containerBuilder.BuildServiceProvider(_options);
		}
	}
	[EventSource(Name = "Microsoft-Extensions-DependencyInjection")]
	internal sealed class DependencyInjectionEventSource : EventSource
	{
		public static class Keywords
		{
			public const EventKeywords ServiceProviderInitialized = (EventKeywords)1L;
		}

		public static readonly DependencyInjectionEventSource Log = new DependencyInjectionEventSource();

		private const int MaxChunkSize = 10240;

		private readonly List<WeakReference<ServiceProvider>> _providers = new List<WeakReference<ServiceProvider>>();

		private DependencyInjectionEventSource()
			: base(EventSourceSettings.EtwSelfDescribingEventFormat)
		{
		}

		[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode", Justification = "Parameters to this method are primitive and are trimmer safe.")]
		[Event(1, Level = EventLevel.Verbose)]
		private void CallSiteBuilt(string serviceType, string callSite, int chunkIndex, int chunkCount, int serviceProviderHashCode)
		{
			WriteEvent(1, serviceType, callSite, chunkIndex, chunkCount, serviceProviderHashCode);
		}

		[Event(2, Level = EventLevel.Verbose)]
		public void ServiceResolved(string serviceType, int serviceProviderHashCode)
		{
			WriteEvent(2, serviceType, serviceProviderHashCode);
		}

		[Event(3, Level = EventLevel.Verbose)]
		public void ExpressionTreeGenerated(string serviceType, int nodeCount, int serviceProviderHashCode)
		{
			WriteEvent(3, serviceType, nodeCount, serviceProviderHashCode);
		}

		[Event(4, Level = EventLevel.Verbose)]
		public void DynamicMethodBuilt(string serviceType, int methodSize, int serviceProviderHashCode)
		{
			WriteEvent(4, serviceType, methodSize, serviceProviderHashCode);
		}

		[Event(5, Level = EventLevel.Verbose)]
		public void ScopeDisposed(int serviceProviderHashCode, int scopedServicesResolved, int disposableServices)
		{
			WriteEvent(5, serviceProviderHashCode, scopedServicesResolved, disposableServices);
		}

		[Event(6, Level = EventLevel.Error)]
		public void ServiceRealizationFailed(string? exceptionMessage, int serviceProviderHashCode)
		{
			WriteEvent(6, exceptionMessage, serviceProviderHashCode);
		}

		[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode", Justification = "Parameters to this method are primitive and are trimmer safe.")]
		[Event(7, Level = EventLevel.Informational, Keywords = (EventKeywords)1L)]
		private void ServiceProviderBuilt(int serviceProviderHashCode, int singletonServices, int scopedServices, int transientServices, int closedGenericsServices, int openGenericsServices)
		{
			WriteEvent(7, serviceProviderHashCode, singletonServices, scopedServices, transientServices, closedGenericsServices, openGenericsServices);
		}

		[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode", Justification = "Parameters to this method are primitive and are trimmer safe.")]
		[Event(8, Level = EventLevel.Informational, Keywords = (EventKeywords)1L)]
		private void ServiceProviderDescriptors(int serviceProviderHashCode, string descriptors, int chunkIndex, int chunkCount)
		{
			WriteEvent(8, serviceProviderHashCode, descriptors, chunkIndex, chunkCount);
		}

		[NonEvent]
		public void ServiceResolved(ServiceProvider provider, Type serviceType)
		{
			if (IsEnabled(EventLevel.Verbose, EventKeywords.All))
			{
				ServiceResolved(serviceType.ToString(), provider.GetHashCode());
			}
		}

		[NonEvent]
		public void CallSiteBuilt(ServiceProvider provider, Type serviceType, ServiceCallSite callSite)
		{
			if (IsEnabled(EventLevel.Verbose, EventKeywords.All))
			{
				string text = CallSiteJsonFormatter.Instance.Format(callSite);
				int num = text.Length / 10240 + ((text.Length % 10240 > 0) ? 1 : 0);
				int hashCode = provider.GetHashCode();
				for (int i = 0; i < num; i++)
				{
					CallSiteBuilt(serviceType.ToString(), text.Substring(i * 10240, Math.Min(10240, text.Length - i * 10240)), i, num, hashCode);
				}
			}
		}

		[NonEvent]
		public void DynamicMethodBuilt(ServiceProvider provider, Type serviceType, int methodSize)
		{
			if (IsEnabled(EventLevel.Verbose, EventKeywords.All))
			{
				DynamicMethodBuilt(serviceType.ToString(), methodSize, provider.GetHashCode());
			}
		}

		[NonEvent]
		public void ServiceRealizationFailed(Exception exception, int serviceProviderHashCode)
		{
			if (IsEnabled(EventLevel.Error, EventKeywords.All))
			{
				ServiceRealizationFailed(exception.ToString(), serviceProviderHashCode);
			}
		}

		[NonEvent]
		public void ServiceProviderBuilt(ServiceProvider provider)
		{
			lock (_providers)
			{
				_providers.Add(new WeakReference<ServiceProvider>(provider));
			}
			WriteServiceProviderBuilt(provider);
		}

		[NonEvent]
		public void ServiceProviderDisposed(ServiceProvider provider)
		{
			lock (_providers)
			{
				for (int num = _providers.Count - 1; num >= 0; num--)
				{
					WeakReference<ServiceProvider> weakReference = _providers[num];
					if (!weakReference.TryGetTarget(out var target) || target == provider)
					{
						_providers.RemoveAt(num);
					}
				}
			}
		}

		[NonEvent]
		private void WriteServiceProviderBuilt(ServiceProvider provider)
		{
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Expected I4, but got Unknown
			if (!IsEnabled(EventLevel.Informational, (EventKeywords)1L))
			{
				return;
			}
			int num = 0;
			int num2 = 0;
			int num3 = 0;
			int num4 = 0;
			int num5 = 0;
			StringBuilder stringBuilder = new StringBuilder("{ \"descriptors\":[ ");
			bool flag = true;
			ServiceDescriptor[] descriptors = provider.CallSiteFactory.Descriptors;
			foreach (ServiceDescriptor val in descriptors)
			{
				if (flag)
				{
					flag = false;
				}
				else
				{
					stringBuilder.Append(", ");
				}
				AppendServiceDescriptor(stringBuilder, val);
				ServiceLifetime lifetime = val.Lifetime;
				switch ((int)lifetime)
				{
				case 0:
					num++;
					break;
				case 1:
					num2++;
					break;
				case 2:
					num3++;
					break;
				}
				if (val.ServiceType.IsGenericType)
				{
					if (val.ServiceType.IsConstructedGenericType)
					{
						num4++;
					}
					else
					{
						num5++;
					}
				}
			}
			stringBuilder.Append(" ] }");
			int hashCode = provider.GetHashCode();
			ServiceProviderBuilt(hashCode, num, num2, num3, num4, num5);
			string text = stringBuilder.ToString();
			int num6 = text.Length / 10240 + ((text.Length % 10240 > 0) ? 1 : 0);
			for (int j = 0; j < num6; j++)
			{
				ServiceProviderDescriptors(hashCode, text.Substring(j * 10240, Math.Min(10240, text.Length - j * 10240)), j, num6);
			}
		}

		[NonEvent]
		private static void AppendServiceDescriptor(StringBuilder builder, ServiceDescriptor descriptor)
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			builder.Append("{ \"serviceType\": \"");
			builder.Append(descriptor.ServiceType);
			builder.Append("\", \"lifetime\": \"");
			builder.Append(descriptor.Lifetime);
			builder.Append("\", ");
			if ((object)descriptor.ImplementationType != null)
			{
				builder.Append("\"implementationType\": \"");
				builder.Append(descriptor.ImplementationType);
			}
			else if (descriptor.ImplementationFactory != null)
			{
				builder.Append("\"implementationFactory\": \"");
				builder.Append(descriptor.ImplementationFactory.Method);
			}
			else if (descriptor.ImplementationInstance != null)
			{
				builder.Append("\"implementationInstance\": \"");
				builder.Append(descriptor.ImplementationInstance.GetType());
				builder.Append(" (instance)");
			}
			else
			{
				builder.Append("\"unknown\": \"");
			}
			builder.Append("\" }");
		}

		protected override void OnEventCommand(EventCommandEventArgs command)
		{
			if (command.Command != EventCommand.Enable)
			{
				return;
			}
			lock (_providers)
			{
				foreach (WeakReference<ServiceProvider> provider in _providers)
				{
					if (provider.TryGetTarget(out var target))
					{
						WriteServiceProviderBuilt(target);
					}
				}
			}
		}
	}
	internal static class DependencyInjectionEventSourceExtensions
	{
		private sealed class NodeCountingVisitor : ExpressionVisitor
		{
			public int NodeCount { get; private set; }

			[return: NotNullIfNotNull("e")]
			public override Expression Visit(Expression e)
			{
				base.Visit(e);
				NodeCount++;
				return e;
			}
		}

		public static void ExpressionTreeGenerated(this DependencyInjectionEventSource source, ServiceProvider provider, Type serviceType, Expression expression)
		{
			if (source.IsEnabled(EventLevel.Verbose, EventKeywords.All))
			{
				NodeCountingVisitor nodeCountingVisitor = new NodeCountingVisitor();
				nodeCountingVisitor.Visit(expression);
				source.ExpressionTreeGenerated(serviceType.ToString(), nodeCountingVisitor.NodeCount, provider.GetHashCode());
			}
		}
	}
	public static class ServiceCollectionContainerBuilderExtensions
	{
		[RequiresDynamicCode("Using Microsoft.Extensions.DependencyInjection requires generating code dynamically at runtime. For example, when using enumerable and generic ValueType services.")]
		public static ServiceProvider BuildServiceProvider(this IServiceCollection services)
		{
			return services.BuildServiceProvider(ServiceProviderOptions.Default);
		}

		[RequiresDynamicCode("Using Microsoft.Extensions.DependencyInjection requires generating code dynamically at runtime. For example, when using enumerable and generic ValueType services.")]
		public static ServiceProvider BuildServiceProvider(this IServiceCollection services, bool validateScopes)
		{
			return services.BuildServiceProvider(new ServiceProviderOptions
			{
				ValidateScopes = validateScopes
			});
		}

		[RequiresDynamicCode("Using Microsoft.Extensions.DependencyInjection requires generating code dynamically at runtime. For example, when using enumerable and generic ValueType services.")]
		public static ServiceProvider BuildServiceProvider(this IServiceCollection services, ServiceProviderOptions options)
		{
			if (services == null)
			{
				throw new ArgumentNullException("services");
			}
			if (options == null)
			{
				throw new ArgumentNullException("options");
			}
			return new ServiceProvider((ICollection<ServiceDescriptor>)services, options);
		}
	}
	public sealed class ServiceProvider : IServiceProvider, IDisposable, IAsyncDisposable
	{
		internal const string RequiresDynamicCodeMessage = "Using Microsoft.Extensions.DependencyInjection requires generating code dynamically at runtime. For example, when using enumerable and generic ValueType services.";

		private readonly CallSiteValidator _callSiteValidator;

		private readonly Func<Type, Func<ServiceProviderEngineScope, object>> _createServiceAccessor;

		internal ServiceProviderEngine _engine;

		private bool _disposed;

		private ConcurrentDictionary<Type, Func<ServiceProviderEngineScope, object>> _realizedServices;

		internal CallSiteFactory CallSiteFactory { get; }

		internal ServiceProviderEngineScope Root { get; }

		internal static bool VerifyOpenGenericServiceTrimmability { get; } = AppContext.TryGetSwitch("Microsoft.Extensions.DependencyInjection.VerifyOpenGenericServiceTrimmability", out var isEnabled) && isEnabled;


		[RequiresDynamicCode("Using Microsoft.Extensions.DependencyInjection requires generating code dynamically at runtime. For example, when using enumerable and generic ValueType services.")]
		internal ServiceProvider(ICollection<ServiceDescriptor> serviceDescriptors, ServiceProviderOptions options)
		{
			Root = new ServiceProviderEngineScope(this, isRootScope: true);
			_engine = GetEngine();
			_createServiceAccessor = CreateServiceAccessor;
			_realizedServices = new ConcurrentDictionary<Type, Func<ServiceProviderEngineScope, object>>();
			CallSiteFactory = new CallSiteFactory(serviceDescriptors);
			CallSiteFactory.Add(typeof(IServiceProvider), new ServiceProviderCallSite());
			CallSiteFactory.Add(typeof(IServiceScopeFactory), new ConstantCallSite(typeof(IServiceScopeFactory), Root));
			CallSiteFactory.Add(typeof(IServiceProviderIsService), new ConstantCallSite(typeof(IServiceProviderIsService), CallSiteFactory));
			if (options.ValidateScopes)
			{
				_callSiteValidator = new CallSiteValidator();
			}
			if (options.ValidateOnBuild)
			{
				List<Exception> list = null;
				foreach (ServiceDescriptor serviceDescriptor in serviceDescriptors)
				{
					try
					{
						ValidateService(serviceDescriptor);
					}
					catch (Exception item)
					{
						if (list == null)
						{
							list = new List<Exception>();
						}
						list.Add(item);
					}
				}
				if (list != null)
				{
					throw new AggregateException("Some services are not able to be constructed", list.ToArray());
				}
			}
			DependencyInjectionEventSource.Log.ServiceProviderBuilt(this);
		}

		public object? GetService(Type serviceType)
		{
			return GetService(serviceType, Root);
		}

		internal bool IsDisposed()
		{
			return _disposed;
		}

		public void Dispose()
		{
			DisposeCore();
			Root.Dispose();
		}

		public ValueTask DisposeAsync()
		{
			DisposeCore();
			return Root.DisposeAsync();
		}

		private void DisposeCore()
		{
			_disposed = true;
			DependencyInjectionEventSource.Log.ServiceProviderDisposed(this);
		}

		private void OnCreate(ServiceCallSite callSite)
		{
			_callSiteValidator?.ValidateCallSite(callSite);
		}

		private void OnResolve(Type serviceType, IServiceScope scope)
		{
			_callSiteValidator?.ValidateResolution(serviceType, scope, (IServiceScope)(object)Root);
		}

		internal object? GetService(Type serviceType, ServiceProviderEngineScope serviceProviderEngineScope)
		{
			if (_disposed)
			{
				ThrowHelper.ThrowObjectDisposedException();
			}
			Func<ServiceProviderEngineScope, object> orAdd = _realizedServices.GetOrAdd(serviceType, _createServiceAccessor);
			OnResolve(serviceType, (IServiceScope)(object)serviceProviderEngineScope);
			DependencyInjectionEventSource.Log.ServiceResolved(this, serviceType);
			return orAdd(serviceProviderEngineScope);
		}

		private void ValidateService(ServiceDescriptor descriptor)
		{
			if (descriptor.ServiceType.IsGenericType && !descriptor.ServiceType.IsConstructedGenericType)
			{
				return;
			}
			try
			{
				ServiceCallSite callSite = CallSiteFactory.GetCallSite(descriptor, new CallSiteChain());
				if (callSite != null)
				{
					OnCreate(callSite);
				}
			}
			catch (Exception ex)
			{
				throw new InvalidOperationException($"Error while validating the service descriptor '{descriptor}': {ex.Message}", ex);
			}
		}

		[RequiresDynamicCode("Using Microsoft.Extensions.DependencyInjection requires generating code dynamically at runtime. For example, when using enumerable and generic ValueType services.")]
		private Func<ServiceProviderEngineScope, object> CreateServiceAccessor(Type serviceType)
		{
			ServiceCallSite callSite = CallSiteFactory.GetCallSite(serviceType, new CallSiteChain());
			if (callSite != null)
			{
				DependencyInjectionEventSource.Log.CallSiteBuilt(this, serviceType, callSite);
				OnCreate(callSite);
				if (callSite.Cache.Location == CallSiteResultCacheLocation.Root)
				{
					object value = CallSiteRuntimeResolver.Instance.Resolve(callSite, Root);
					return (ServiceProviderEngineScope scope) => value;
				}
				return _engine.RealizeService(callSite);
			}
			return (ServiceProviderEngineScope _) => null;
		}

		internal void ReplaceServiceAccessor(ServiceCallSite callSite, Func<ServiceProviderEngineScope, object?> accessor)
		{
			_realizedServices[callSite.ServiceType] = accessor;
		}

		internal IServiceScope CreateScope()
		{
			if (_disposed)
			{
				ThrowHelper.ThrowObjectDisposedException();
			}
			return (IServiceScope)(object)new ServiceProviderEngineScope(this, isRootScope: false);
		}

		[RequiresDynamicCode("Using Microsoft.Extensions.DependencyInjection requires generating code dynamically at runtime. For example, when using enumerable and generic ValueType services.")]
		private ServiceProviderEngine GetEngine()
		{
			return new DynamicServiceProviderEngine(this);
		}
	}
	public class ServiceProviderOptions
	{
		internal static readonly ServiceProviderOptions Default = new ServiceProviderOptions();

		public bool ValidateScopes { get; set; }

		public bool ValidateOnBuild { get; set; }
	}
}
namespace Microsoft.Extensions.DependencyInjection.ServiceLookup
{
	internal sealed class CallSiteChain
	{
		private readonly struct ChainItemInfo
		{
			public int Order { get; }

			public Type ImplementationType { get; }

			public ChainItemInfo(int order, Type implementationType)
			{
				Order = order;
				ImplementationType = implementationType;
			}
		}

		private readonly Dictionary<Type, ChainItemInfo> _callSiteChain;

		public CallSiteChain()
		{
			_callSiteChain = new Dictionary<Type, ChainItemInfo>();
		}

		public void CheckCircularDependency(Type serviceType)
		{
			if (_callSiteChain.ContainsKey(serviceType))
			{
				throw new InvalidOperationException(CreateCircularDependencyExceptionMessage(serviceType));
			}
		}

		public void Remove(Type serviceType)
		{
			_callSiteChain.Remove(serviceType);
		}

		public void Add(Type serviceType, Type? implementationType = null)
		{
			_callSiteChain[serviceType] = new ChainItemInfo(_callSiteChain.Count, implementationType);
		}

		private string CreateCircularDependencyExceptionMessage(Type type)
		{
			StringBuilder stringBuilder = new StringBuilder();
			stringBuilder.Append(System.SR.Format(System.SR.CircularDependencyException, TypeNameHelper.GetTypeDisplayName(type)));
			stringBuilder.AppendLine();
			AppendResolutionPath(stringBuilder, type);
			return stringBuilder.ToString();
		}

		private void AppendResolutionPath(StringBuilder builder, Type currentlyResolving)
		{
			List<KeyValuePair<Type, ChainItemInfo>> list = new List<KeyValuePair<Type, ChainItemInfo>>(_callSiteChain);
			list.Sort((KeyValuePair<Type, ChainItemInfo> a, KeyValuePair<Type, ChainItemInfo> b) => a.Value.Order.CompareTo(b.Value.Order));
			foreach (KeyValuePair<Type, ChainItemInfo> item in list)
			{
				Type key = item.Key;
				Type implementationType = item.Value.ImplementationType;
				if (implementationType == null || key == implementationType)
				{
					builder.Append(TypeNameHelper.GetTypeDisplayName(key));
				}
				else
				{
					builder.AppendFormat("{0}({1})", TypeNameHelper.GetTypeDisplayName(key), TypeNameHelper.GetTypeDisplayName(implementationType));
				}
				builder.Append(" -> ");
			}
			builder.Append(TypeNameHelper.GetTypeDisplayName(currentlyResolving));
		}
	}
	[RequiresDynamicCode("Using Microsoft.Extensions.DependencyInjection requires generating code dynamically at runtime. For example, when using enumerable and generic ValueType services.")]
	internal sealed class CallSiteFactory : IServiceProviderIsService
	{
		private struct ServiceDescriptorCacheItem
		{
			[DisallowNull]
			private ServiceDescriptor _item;

			[DisallowNull]
			private List<ServiceDescriptor> _items;

			public ServiceDescriptor Last
			{
				get
				{
					if (_items != null && _items.Count > 0)
					{
						return _items[_items.Count - 1];
					}
					return _item;
				}
			}

			public int Count
			{
				get
				{
					if (_item == null)
					{
						return 0;
					}
					return 1 + (_items?.Count ?? 0);
				}
			}

			public ServiceDescriptor this[int index]
			{
				get
				{
					if (index >= Count)
					{
						throw new ArgumentOutOfRangeException("index");
					}
					if (index == 0)
					{
						return _item;
					}
					return _items[index - 1];
				}
			}

			public int GetSlot(ServiceDescriptor descriptor)
			{
				if (descriptor == _item)
				{
					return Count - 1;
				}
				if (_items != null)
				{
					int num = _items.IndexOf(descriptor);
					if (num != -1)
					{
						return _items.Count - (num + 1);
					}
				}
				throw new InvalidOperationException(System.SR.ServiceDescriptorNotExist);
			}

			public ServiceDescriptorCacheItem Add(ServiceDescriptor descriptor)
			{
				ServiceDescriptorCacheItem result = default(ServiceDescriptorCacheItem);
				if (_item == null)
				{
					result._item = descriptor;
				}
				else
				{
					result._item = _item;
					result._items = _items ?? new List<ServiceDescriptor>();
					result._items.Add(descriptor);
				}
				return result;
			}
		}

		private const int DefaultSlot = 0;

		private readonly ServiceDescriptor[] _descriptors;

		private readonly ConcurrentDictionary<ServiceCacheKey, ServiceCallSite> _callSiteCache = new ConcurrentDictionary<ServiceCacheKey, ServiceCallSite>();

		private readonly Dictionary<Type, ServiceDescriptorCacheItem> _descriptorLookup = new Dictionary<Type, ServiceDescriptorCacheItem>();

		private readonly ConcurrentDictionary<Type, object> _callSiteLocks = new ConcurrentDictionary<Type, object>();

		private readonly StackGuard _stackGuard;

		internal ServiceDescriptor[] Descriptors => _descriptors;

		public CallSiteFactory(ICollection<ServiceDescriptor> descriptors)
		{
			_stackGuard = new StackGuard();
			_descriptors = (ServiceDescriptor[])(object)new ServiceDescriptor[descriptors.Count];
			descriptors.CopyTo(_descriptors, 0);
			Populate();
		}

		private void Populate()
		{
			ServiceDescriptor[] descriptors = _descriptors;
			foreach (ServiceDescriptor val in descriptors)
			{
				Type serviceType = val.ServiceType;
				if (serviceType.IsGenericTypeDefinition)
				{
					Type implementationType = val.ImplementationType;
					if (implementationType == null || !implementationType.IsGenericTypeDefinition)
					{
						throw new ArgumentException(System.SR.Format(System.SR.OpenGenericServiceRequiresOpenGenericImplementation, serviceType), "descriptors");
					}
					if (implementationType.IsAbstract || implementationType.IsInterface)
					{
						throw new ArgumentException(System.SR.Format(System.SR.TypeCannotBeActivated, implementationType, serviceType));
					}
					Type[] genericArguments = serviceType.GetGenericArguments();
					Type[] genericArguments2 = implementationType.GetGenericArguments();
					if (genericArguments.Length != genericArguments2.Length)
					{
						throw new ArgumentException(System.SR.Format(System.SR.ArityOfOpenGenericServiceNotEqualArityOfOpenGenericImplementation, serviceType, implementationType), "descriptors");
					}
					if (ServiceProvider.VerifyOpenGenericServiceTrimmability)
					{
						ValidateTrimmingAnnotations(serviceType, genericArguments, implementationType, genericArguments2);
					}
				}
				else if (val.ImplementationInstance == null && val.ImplementationFactory == null)
				{
					Type implementationType2 = val.ImplementationType;
					if (implementationType2.IsGenericTypeDefinition || implementationType2.IsAbstract || implementationType2.IsInterface)
					{
						throw new ArgumentException(System.SR.Format(System.SR.TypeCannotBeActivated, implementationType2, serviceType));
					}
				}
				Type key = serviceType;
				_descriptorLookup.TryGetValue(key, out var value);
				_descriptorLookup[key] = value.Add(val);
			}
		}

		private static void ValidateTrimmingAnnotations(Type serviceType, Type[] serviceTypeGenericArguments, Type implementationType, Type[] implementationTypeGenericArguments)
		{
			for (int i = 0; i < serviceTypeGenericArguments.Length; i++)
			{
				Type type = serviceTypeGenericArguments[i];
				Type type2 = implementationTypeGenericArguments[i];
				DynamicallyAccessedMemberTypes dynamicallyAccessedMemberTypes = GetDynamicallyAccessedMemberTypes(type);
				DynamicallyAccessedMemberTypes dynamicallyAccessedMemberTypes2 = GetDynamicallyAccessedMemberTypes(type2);
				if (!AreCompatible(dynamicallyAccessedMemberTypes, dynamicallyAccessedMemberTypes2))
				{
					throw new ArgumentException(System.SR.Format(System.SR.TrimmingAnnotationsDoNotMatch, implementationType.FullName, serviceType.FullName));
				}
				bool flag = type.GenericParameterAttributes.HasFlag(GenericParameterAttributes.DefaultConstructorConstraint);
				if (type2.GenericParameterAttributes.HasFlag(GenericParameterAttributes.DefaultConstructorConstraint) && !flag)
				{
					throw new ArgumentException(System.SR.Format(System.SR.TrimmingAnnotationsDoNotMatch_NewConstraint, implementationType.FullName, serviceType.FullName));
				}
			}
		}

		private static DynamicallyAccessedMemberTypes GetDynamicallyAccessedMemberTypes(Type serviceGenericType)
		{
			foreach (CustomAttributeData customAttributesDatum in serviceGenericType.GetCustomAttributesData())
			{
				if (customAttributesDatum.AttributeType.FullName == "System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute" && customAttributesDatum.ConstructorArguments.Count == 1 && customAttributesDatum.ConstructorArguments[0].ArgumentType.FullName == "System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes")
				{
					return (DynamicallyAccessedMemberTypes)(int)customAttributesDatum.ConstructorArguments[0].Value;
				}
			}
			return DynamicallyAccessedMemberTypes.None;
		}

		private static bool AreCompatible(DynamicallyAccessedMemberTypes serviceDynamicallyAccessedMembers, DynamicallyAccessedMemberTypes implementationDynamicallyAccessedMembers)
		{
			return serviceDynamicallyAccessedMembers.HasFlag(implementationDynamicallyAccessedMembers);
		}

		internal int? GetSlot(ServiceDescriptor serviceDescriptor)
		{
			if (_descriptorLookup.TryGetValue(serviceDescriptor.ServiceType, out var value))
			{
				return value.GetSlot(serviceDescriptor);
			}
			return null;
		}

		internal ServiceCallSite? GetCallSite(Type serviceType, CallSiteChain callSiteChain)
		{
			if (!_callSiteCache.TryGetValue(new ServiceCacheKey(serviceType, 0), out var value))
			{
				return CreateCallSite(serviceType, callSiteChain);
			}
			return value;
		}

		internal ServiceCallSite? GetCallSite(ServiceDescriptor serviceDescriptor, CallSiteChain callSiteChain)
		{
			if (_descriptorLookup.TryGetValue(serviceDescriptor.ServiceType, out var value))
			{
				return TryCreateExact(serviceDescriptor, serviceDescriptor.ServiceType, callSiteChain, value.GetSlot(serviceDescriptor));
			}
			return null;
		}

		private ServiceCallSite CreateCallSite(Type serviceType, CallSiteChain callSiteChain)
		{
			if (!_stackGuard.TryEnterOnCurrentStack())
			{
				return _stackGuard.RunOnEmptyStack(CreateCallSite, serviceType, callSiteChain);
			}
			object orAdd = _callSiteLocks.GetOrAdd(serviceType, (Type _) => new object());
			lock (orAdd)
			{
				callSiteChain.CheckCircularDependency(serviceType);
				return TryCreateExact(serviceType, callSiteChain) ?? TryCreateOpenGeneric(serviceType, callSiteChain) ?? TryCreateEnumerable(serviceType, callSiteChain);
			}
		}

		private ServiceCallSite TryCreateExact(Type serviceType, CallSiteChain callSiteChain)
		{
			if (_descriptorLookup.TryGetValue(serviceType, out var value))
			{
				return TryCreateExact(value.Last, serviceType, callSiteChain, 0);
			}
			return null;
		}

		private ServiceCallSite TryCreateOpenGeneric(Type serviceType, CallSiteChain callSiteChain)
		{
			if (serviceType.IsConstructedGenericType && _descriptorLookup.TryGetValue(serviceType.GetGenericTypeDefinition(), out var value))
			{
				return TryCreateOpenGeneric(value.Last, serviceType, callSiteChain, 0, throwOnConstraintViolation: true);
			}
			return null;
		}

		private ServiceCallSite TryCreateEnumerable(Type serviceType, CallSiteChain callSiteChain)
		{
			ServiceCacheKey serviceCacheKey = new ServiceCacheKey(serviceType, 0);
			if (_callSiteCache.TryGetValue(serviceCacheKey, out var value))
			{
				return value;
			}
			ServiceCallSite serviceCallSite4;
			try
			{
				callSiteChain.Add(serviceType);
				if (serviceType.IsConstructedGenericType && serviceType.GetGenericTypeDefinition() == typeof(IEnumerable<>))
				{
					Type type = serviceType.GenericTypeArguments[0];
					CallSiteResultCacheLocation callSiteResultCacheLocation = CallSiteResultCacheLocation.Root;
					List<ServiceCallSite> list = new List<ServiceCallSite>();
					if (!type.IsConstructedGenericType && _descriptorLookup.TryGetValue(type, out var value2))
					{
						for (int i = 0; i < value2.Count; i++)
						{
							ServiceDescriptor descriptor = value2[i];
							int slot = value2.Count - i - 1;
							ServiceCallSite serviceCallSite = TryCreateExact(descriptor, type, callSiteChain, slot);
							callSiteResultCacheLocation = GetCommonCacheLocation(callSiteResultCacheLocation, serviceCallSite.Cache.Location);
							list.Add(serviceCallSite);
						}
					}
					else
					{
						int num = 0;
						for (int num2 = _descriptors.Length - 1; num2 >= 0; num2--)
						{
							ServiceDescriptor descriptor2 = _descriptors[num2];
							ServiceCallSite serviceCallSite2 = TryCreateExact(descriptor2, type, callSiteChain, num) ?? TryCreateOpenGeneric(descriptor2, type, callSiteChain, num, throwOnConstraintViolation: false);
							if (serviceCallSite2 != null)
							{
								num++;
								callSiteResultCacheLocation = GetCommonCacheLocation(callSiteResultCacheLocation, serviceCallSite2.Cache.Location);
								list.Add(serviceCallSite2);
							}
						}
						list.Reverse();
					}
					ResultCache cache = ResultCache.None;
					if (callSiteResultCacheLocation == CallSiteResultCacheLocation.Scope || callSiteResultCacheLocation == CallSiteResultCacheLocation.Root)
					{
						cache = new ResultCache(callSiteResultCacheLocation, serviceCacheKey);
					}
					serviceCallSite4 = (_callSiteCache[serviceCacheKey] = new IEnumerableCallSite(cache, type, list.ToArray()));
					serviceCallSite4 = serviceCallSite4;
				}
				else
				{
					serviceCallSite4 = null;
				}
			}
			finally
			{
				callSiteChain.Remove(serviceType);
			}
			return serviceCallSite4;
		}

		private static CallSiteResultCacheLocation GetCommonCacheLocation(CallSiteResultCacheLocation locationA, CallSiteResultCacheLocation locationB)
		{
			return (CallSiteResultCacheLocation)Math.Max((int)locationA, (int)locationB);
		}

		private ServiceCallSite TryCreateExact(ServiceDescriptor descriptor, Type serviceType, CallSiteChain callSiteChain, int slot)
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			if (serviceType == descriptor.ServiceType)
			{
				ServiceCacheKey key = new ServiceCacheKey(serviceType, slot);
				if (_callSiteCache.TryGetValue(key, out var value))
				{
					return value;
				}
				ResultCache resultCache = new ResultCache(descriptor.Lifetime, serviceType, slot);
				ServiceCallSite serviceCallSite;
				if (descriptor.ImplementationInstance != null)
				{
					serviceCallSite = new ConstantCallSite(descriptor.ServiceType, descriptor.ImplementationInstance);
				}
				else if (descriptor.ImplementationFactory != null)
				{
					serviceCallSite = new FactoryCallSite(resultCache, descriptor.ServiceType, descriptor.ImplementationFactory);
				}
				else
				{
					if (!(descriptor.ImplementationType != null))
					{
						throw new InvalidOperationException(System.SR.InvalidServiceDescriptor);
					}
					serviceCallSite = CreateConstructorCallSite(resultCache, descriptor.ServiceType, descriptor.ImplementationType, callSiteChain);
				}
				return _callSiteCache[key] = serviceCallSite;
			}
			return null;
		}

		[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2055:MakeGenericType", Justification = "MakeGenericType here is used to create a closed generic implementation type given the closed service type. Trimming annotations on the generic types are verified when 'Microsoft.Extensions.DependencyInjection.VerifyOpenGenericServiceTrimmability' is set, which is set by default when PublishTrimmed=true. That check informs developers when these generic types don't have compatible trimming annotations.")]
		private ServiceCallSite TryCreateOpenGeneric(ServiceDescriptor descriptor, Type serviceType, CallSiteChain callSiteChain, int slot, bool throwOnConstraintViolation)
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			if (serviceType.IsConstructedGenericType && serviceType.GetGenericTypeDefinition() == descriptor.ServiceType)
			{
				ServiceCacheKey key = new ServiceCacheKey(serviceType, slot);
				if (_callSiteCache.TryGetValue(key, out var value))
				{
					return value;
				}
				ResultCache lifetime = new ResultCache(descriptor.Lifetime, serviceType, slot);
				Type implementationType;
				try
				{
					implementationType = descriptor.ImplementationType.MakeGenericType(serviceType.GenericTypeArguments);
				}
				catch (ArgumentException)
				{
					if (throwOnConstraintViolation)
					{
						throw;
					}
					return null;
				}
				return _callSiteCache[key] = CreateConstructorCallSite(lifetime, serviceType, implementationType, callSiteChain);
			}
			return null;
		}

		private ServiceCallSite CreateConstructorCallSite(ResultCache lifetime, Type serviceType, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type implementationType, CallSiteChain callSiteChain)
		{
			try
			{
				callSiteChain.Add(serviceType, implementationType);
				ConstructorInfo[] constructors = implementationType.GetConstructors();
				ServiceCallSite[] parameterCallSites = null;
				if (constructors.Length == 0)
				{
					throw new InvalidOperationException(System.SR.Format(System.SR.NoConstructorMatch, implementationType));
				}
				if (constructors.Length == 1)
				{
					ConstructorInfo constructorInfo = constructors[0];
					ParameterInfo[] parameters = constructorInfo.GetParameters();
					if (parameters.Length == 0)
					{
						return new ConstructorCallSite(lifetime, serviceType, constructorInfo);
					}
					parameterCallSites = CreateArgumentCallSites(implementationType, callSiteChain, parameters, throwIfCallSiteNotFound: true);
					return new ConstructorCallSite(lifetime, serviceType, constructorInfo, parameterCallSites);
				}
				Array.Sort(constructors, (ConstructorInfo a, ConstructorInfo b) => b.GetParameters().Length.CompareTo(a.GetParameters().Length));
				ConstructorInfo constructorInfo2 = null;
				HashSet<Type> hashSet = null;
				for (int i = 0; i < constructors.Length; i++)
				{
					ParameterInfo[] parameters2 = constructors[i].GetParameters();
					ServiceCallSite[] array = CreateArgumentCallSites(implementationType, callSiteChain, parameters2, throwIfCallSiteNotFound: false);
					if (array == null)
					{
						continue;
					}
					if (constructorInfo2 == null)
					{
						constructorInfo2 = constructors[i];
						parameterCallSites = array;
						continue;
					}
					if (hashSet == null)
					{
						hashSet = new HashSet<Type>();
						ParameterInfo[] parameters3 = constructorInfo2.GetParameters();
						foreach (ParameterInfo parameterInfo in parameters3)
						{
							hashSet.Add(parameterInfo.ParameterType);
						}
					}
					ParameterInfo[] array2 = parameters2;
					foreach (ParameterInfo parameterInfo2 in array2)
					{
						if (!hashSet.Contains(parameterInfo2.ParameterType))
						{
							throw new InvalidOperationException(string.Join(Environment.NewLine, System.SR.Format(System.SR.AmbiguousConstructorException, implementationType), constructorInfo2, constructors[i]));
						}
					}
				}
				if (constructorInfo2 == null)
				{
					throw new InvalidOperationException(System.SR.Format(System.SR.UnableToActivateTypeException, implementationType));
				}
				return new ConstructorCallSite(lifetime, serviceType, constructorInfo2, parameterCallSites);
			}
			finally
			{
				callSiteChain.Remove(serviceType);
			}
		}

		private ServiceCallSite[] CreateArgumentCallSites(Type implementationType, CallSiteChain callSiteChain, ParameterInfo[] parameters, bool throwIfCallSiteNotFound)
		{
			ServiceCallSite[] array = new ServiceCallSite[parameters.Length];
			for (int i = 0; i < parameters.Length; i++)
			{
				Type parameterType = parameters[i].ParameterType;
				ServiceCallSite serviceCallSite = GetCallSite(parameterType, callSiteChain);
				if (serviceCallSite == null && ParameterDefaultValue.TryGetDefaultValue(parameters[i], out object defaultValue))
				{
					serviceCallSite = new ConstantCallSite(parameterType, defaultValue);
				}
				if (serviceCallSite == null)
				{
					if (throwIfCallSiteNotFound)
					{
						throw new InvalidOperationException(System.SR.Format(System.SR.CannotResolveService, parameterType, implementationType));
					}
					return null;
				}
				array[i] = serviceCallSite;
			}
			return array;
		}

		public void Add(Type type, ServiceCallSite serviceCallSite)
		{
			_callSiteCache[new ServiceCacheKey(type, 0)] = serviceCallSite;
		}

		public bool IsService(Type serviceType)
		{
			if ((object)serviceType == null)
			{
				throw new ArgumentNullException("serviceType");
			}
			if (serviceType.IsGenericTypeDefinition)
			{
				return false;
			}
			if (_descriptorLookup.ContainsKey(serviceType))
			{
				return true;
			}
			if (serviceType.IsConstructedGenericType)
			{
				Type genericTypeDefinition = serviceType.GetGenericTypeDefinition();
				if ((object)genericTypeDefinition != null)
				{
					if (!(genericTypeDefinition == typeof(IEnumerable<>)))
					{
						return _descriptorLookup.ContainsKey(genericTypeDefinition);
					}
					return true;
				}
			}
			if (!(serviceType == typeof(IServiceProvider)) && !(serviceType == typeof(IServiceScopeFactory)))
			{
				return serviceType == typeof(IServiceProviderIsService);
			}
			return true;
		}
	}
	internal enum CallSiteKind
	{
		Factory,
		Constructor,
		Constant,
		IEnumerable,
		ServiceProvider
	}
	internal enum CallSiteResultCacheLocation
	{
		Root,
		Scope,
		Dispose,
		None
	}
	[RequiresDynamicCode("Using Microsoft.Extensions.DependencyInjection requires generating code dynamically at runtime. For example, when using enumerable and generic ValueType services.")]
	internal sealed class CallSiteRuntimeResolver : CallSiteVisitor<RuntimeResolverContext, object?>
	{
		public static CallSiteRuntimeResolver Instance { get; } = new CallSiteRuntimeResolver();


		private CallSiteRuntimeResolver()
		{
		}

		public object? Resolve(ServiceCallSite callSite, ServiceProviderEngineScope scope)
		{
			if (scope.IsRootScope)
			{
				object value = callSite.Value;
				if (value != null)
				{
					return value;
				}
			}
			return VisitCallSite(callSite, new RuntimeResolverContext
			{
				Scope = scope
			});
		}

		protected override object? VisitDisposeCache(ServiceCallSite transientCallSite, RuntimeResolverContext context)
		{
			return context.Scope.CaptureDisposable(VisitCallSiteMain(transientCallSite, context));
		}

		protected override object VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context)
		{
			object[] array;
			if (constructorCallSite.ParameterCallSites.Length == 0)
			{
				array = Array.Empty<object>();
			}
			else
			{
				array = new object[constructorCallSite.ParameterCallSites.Length];
				for (int i = 0; i < array.Length; i++)
				{
					array[i] = VisitCallSite(constructorCallSite.ParameterCallSites[i], context);
				}
			}
			try
			{
				return constructorCallSite.ConstructorInfo.Invoke(array);
			}
			catch (Exception ex) when (ex.InnerException != null)
			{
				ExceptionDispatchInfo.Capture(ex.InnerException).Throw();
				throw;
			}
		}

		protected override object? VisitRootCache(ServiceCallSite callSite, RuntimeResolverContext context)
		{
			object value = callSite.Value;
			if (value != null)
			{
				return value;
			}
			RuntimeResolverLock runtimeResolverLock = RuntimeResolverLock.Root;
			ServiceProviderEngineScope root = context.Scope.RootProvider.Root;
			lock (callSite)
			{
				object value2 = callSite.Value;
				if (value2 != null)
				{
					return value2;
				}
				object obj = VisitCallSiteMain(callSite, new RuntimeResolverContext
				{
					Scope = root,
					AcquiredLocks = (context.AcquiredLocks | runtimeResolverLock)
				});
				root.CaptureDisposable(obj);
				callSite.Value = obj;
				return obj;
			}
		}

		protected override object? VisitScopeCache(ServiceCallSite callSite, RuntimeResolverContext context)
		{
			if (!context.Scope.IsRootScope)
			{
				return VisitCache(callSite, context, context.Scope, RuntimeResolverLock.Scope);
			}
			return VisitRootCache(callSite, context);
		}

		private object VisitCache(ServiceCallSite callSite, RuntimeResolverContext context, ServiceProviderEngineScope serviceProviderEngine, RuntimeResolverLock lockType)
		{
			bool lockTaken = false;
			object sync = serviceProviderEngine.Sync;
			Dictionary<ServiceCacheKey, object> resolvedServices = serviceProviderEngine.ResolvedServices;
			if ((context.AcquiredLocks & lockType) == 0)
			{
				Monitor.Enter(sync, ref lockTaken);
			}
			try
			{
				if (resolvedServices.TryGetValue(callSite.Cache.Key, out var value))
				{
					return value;
				}
				value = VisitCallSiteMain(callSite, new RuntimeResolverContext
				{
					Scope = serviceProviderEngine,
					AcquiredLocks = (context.AcquiredLocks | lockType)
				});
				serviceProviderEngine.CaptureDisposable(value);
				resolvedServices.Add(callSite.Cache.Key, value);
				return value;
			}
			finally
			{
				if (lockTaken)
				{
					Monitor.Exit(sync);
				}
			}
		}

		protected override object? VisitConstant(ConstantCallSite constantCallSite, RuntimeResolverContext context)
		{
			return constantCallSite.DefaultValue;
		}

		protected override object VisitServiceProvider(ServiceProviderCallSite serviceProviderCallSite, RuntimeResolverContext context)
		{
			return context.Scope;
		}

		protected override object VisitIEnumerable(IEnumerableCallSite enumerableCallSite, RuntimeResolverContext context)
		{
			Array array = Array.CreateInstance(enumerableCallSite.ItemType, enumerableCallSite.ServiceCallSites.Length);
			for (int i = 0; i < enumerableCallSite.ServiceCallSites.Length; i++)
			{
				object value = VisitCallSite(enumerableCallSite.ServiceCallSites[i], context);
				array.SetValue(value, i);
			}
			return array;
		}

		protected override object VisitFactory(FactoryCallSite factoryCallSite, RuntimeResolverContext context)
		{
			return factoryCallSite.Factory(context.Scope);
		}
	}
	internal struct RuntimeResolverContext
	{
		public ServiceProviderEngineScope Scope { get; set; }

		public RuntimeResolverLock AcquiredLocks { get; set; }
	}
	[Flags]
	internal enum RuntimeResolverLock
	{
		Scope = 1,
		Root = 2
	}
	internal sealed class CallSiteValidator : CallSiteVisitor<CallSiteValidator.CallSiteValidatorState, Type?>
	{
		internal struct CallSiteValidatorState
		{
			public ServiceCallSite? Singleton
			{
				get; [param: DisallowNull]
				set;
			}
		}

		private readonly ConcurrentDictionary<Type, Type> _scopedServices = new ConcurrentDictionary<Type, Type>();

		public void ValidateCallSite(ServiceCallSite callSite)
		{
			Type type = VisitCallSite(callSite, default(CallSiteValidatorState));
			if (type != null)
			{
				_scopedServices[callSite.ServiceType] = type;
			}
		}

		public void ValidateResolution(Type serviceType, IServiceScope scope, IServiceScope rootScope)
		{
			if (scope == rootScope && _scopedServices.TryGetValue(serviceType, out var value))
			{
				if (serviceType == value)
				{
					throw new InvalidOperationException(System.SR.Format(System.SR.DirectScopedResolvedFromRootException, serviceType, "Scoped".ToLowerInvariant()));
				}
				throw new InvalidOperationException(System.SR.Format(System.SR.ScopedResolvedFromRootException, serviceType, value, "Scoped".ToLowerInvariant()));
			}
		}

		protected override Type? VisitConstructor(ConstructorCallSite constructorCallSite, CallSiteValidatorState state)
		{
			Type type = null;
			ServiceCallSite[] parameterCallSites = constructorCallSite.ParameterCallSites;
			foreach (ServiceCallSite callSite in parameterCallSites)
			{
				Type type2 = VisitCallSite(callSite, state);
				if ((object)type == null)
				{
					type = type2;
				}
			}
			return type;
		}

		protected override Type? VisitIEnumerable(IEnumerableCallSite enumerableCallSite, CallSiteValidatorState state)
		{
			Type type = null;
			ServiceCallSite[] serviceCallSites = enumerableCallSite.ServiceCallSites;
			foreach (ServiceCallSite callSite in serviceCallSites)
			{
				Type type2 = VisitCallSite(callSite, state);
				if ((object)type == null)
				{
					type = type2;
				}
			}
			return type;
		}

		protected override Type? VisitRootCache(ServiceCallSite singletonCallSite, CallSiteValidatorState state)
		{
			state.Singleton = singletonCallSite;
			return VisitCallSiteMain(singletonCallSite, state);
		}

		protected override Type? VisitScopeCache(ServiceCallSite scopedCallSite, CallSiteValidatorState state)
		{
			if (scopedCallSite.ServiceType == typeof(IServiceScopeFactory))
			{
				return null;
			}
			if (state.Singleton != null)
			{
				throw new InvalidOperationException(System.SR.Format(System.SR.ScopedInSingletonException, scopedCallSite.ServiceType, state.Singleton.ServiceType, "Scoped".ToLowerInvariant(), "Singleton".ToLowerInvariant()));
			}
			VisitCallSiteMain(scopedCallSite, state);
			return scopedCallSite.ServiceType;
		}

		protected override Type? VisitConstant(ConstantCallSite constantCallSite, CallSiteValidatorState state)
		{
			return null;
		}

		protected override Type? VisitServiceProvider(ServiceProviderCallSite serviceProviderCallSite, CallSiteValidatorState state)
		{
			return null;
		}

		protected override Type? VisitFactory(FactoryCallSite factoryCallSite, CallSiteValidatorState state)
		{
			return null;
		}
	}
	internal abstract class CallSiteVisitor<TArgument, TResult>
	{
		private readonly StackGuard _stackGuard;

		protected CallSiteVisitor()
		{
			_stackGuard = new StackGuard();
		}

		protected virtual TResult VisitCallSite(ServiceCallSite callSite, TArgument argument)
		{
			if (!_stackGuard.TryEnterOnCurrentStack())
			{
				return _stackGuard.RunOnEmptyStack(VisitCallSite, callSite, argument);
			}
			return callSite.Cache.Location switch
			{
				CallSiteResultCacheLocation.Root => VisitRootCache(callSite, argument), 
				CallSiteResultCacheLocation.Scope => VisitScopeCache(callSite, argument), 
				CallSiteResultCacheLocation.Dispose => VisitDisposeCache(callSite, argument), 
				CallSiteResultCacheLocation.None => VisitNoCache(callSite, argument), 
				_ => throw new ArgumentOutOfRangeException(), 
			};
		}

		protected virtual TResult VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)
		{
			return callSite.Kind switch
			{
				CallSiteKind.Factory => VisitFactory((FactoryCallSite)callSite, argument), 
				CallSiteKind.IEnumerable => VisitIEnumerable((IEnumerableCallSite)callSite, argument), 
				CallSiteKind.Constructor => VisitConstructor((ConstructorCallSite)callSite, argument), 
				CallSiteKind.Constant => VisitConstant((ConstantCallSite)callSite, argument), 
				CallSiteKind.ServiceProvider => VisitServiceProvider((ServiceProviderCallSite)callSite, argument), 
				_ => throw new NotSupportedException(System.SR.Format(System.SR.CallSiteTypeNotSupported, callSite.GetType())), 
			};
		}

		protected virtual TResult VisitNoCache(ServiceCallSite callSite, TArgument argument)
		{
			return VisitCallSiteMain(callSite, argument);
		}

		protected virtual TResult VisitDisposeCache(ServiceCallSite callSite, TArgument argument)
		{
			return VisitCallSiteMain(callSite, argument);
		}

		protected virtual TResult VisitRootCache(ServiceCallSite callSite, TArgument argument)
		{
			return VisitCallSiteMain(callSite, argument);
		}

		protected virtual TResult VisitScopeCache(ServiceCallSite callSite, TArgument argument)
		{
			return VisitCallSiteMain(callSite, argument);
		}

		protected abstract TResult VisitConstructor(ConstructorCallSite constructorCallSite, TArgument argument);

		protected abstract TResult VisitConstant(ConstantCallSite constantCallSite, TArgument argument);

		protected abstract TResult VisitServiceProvider(ServiceProviderCallSite serviceProviderCallSite, TArgument argument);

		protected abstract TResult VisitIEnumerable(IEnumerableCallSite enumerableCallSite, TArgument argument);

		protected abstract TResult VisitFactory(FactoryCallSite factoryCallSite, TArgument argument);
	}
	internal abstract class CompiledServiceProviderEngine : ServiceProviderEngine
	{
		public ILEmitResolverBuilder ResolverBuilder { get; }

		[RequiresDynamicCode("Creates DynamicMethods")]
		public CompiledServiceProviderEngine(ServiceProvider provider)
		{
			ResolverBuilder = new ILEmitResolverBuilder(provider);
		}

		public override Func<ServiceProviderEngineScope, object?> RealizeService(ServiceCallSite callSite)
		{
			return ResolverBuilder.Build(callSite);
		}
	}
	internal sealed class ConstantCallSite : ServiceCallSite
	{
		private readonly Type _serviceType;

		internal object? DefaultValue => base.Value;

		public override Type ServiceType => _serviceType;

		public override Type ImplementationType => DefaultValue?.GetType() ?? _serviceType;

		public override CallSiteKind Kind { get; } = CallSiteKind.Constant;


		public ConstantCallSite(Type serviceType, object? defaultValue)
			: base(ResultCache.None)
		{
			_serviceType = serviceType ?? throw new ArgumentNullException("serviceType");
			if (defaultValue != null && !serviceType.IsInstanceOfType(defaultValue))
			{
				throw new ArgumentException(System.SR.Format(System.SR.ConstantCantBeConvertedToServiceType, defaultValue.GetType(), serviceType));
			}
			base.Value = defaultValue;
		}
	}
	internal sealed class ConstructorCallSite : ServiceCallSite
	{
		internal ConstructorInfo ConstructorInfo { get; }

		internal ServiceCallSite[] ParameterCallSites { get; }

		public override Type ServiceType { get; }

		public override Type? ImplementationType => ConstructorInfo.DeclaringType;

		public override CallSiteKind Kind { get; } = CallSiteKind.Constructor;


		public ConstructorCallSite(ResultCache cache, Type serviceType, ConstructorInfo constructorInfo)
			: this(cache, serviceType, constructorInfo, Array.Empty<ServiceCallSite>())
		{
		}

		public ConstructorCallSite(ResultCache cache, Type serviceType, ConstructorInfo constructorInfo, ServiceCallSite[] parameterCallSites)
			: base(cache)
		{
			if (!serviceType.IsAssignableFrom(constructorInfo.DeclaringType))
			{
				throw new ArgumentException(System.SR.Format(System.SR.ImplementationTypeCantBeConvertedToServiceType, constructorInfo.DeclaringType, serviceType));
			}
			ServiceType = serviceType;
			ConstructorInfo = constructorInfo;
			ParameterCallSites = parameterCallSites;
		}
	}
	[RequiresDynamicCode("Using Microsoft.Extensions.DependencyInjection requires generating code dynamically at runtime. For example, when using enumerable and generic ValueType services.")]
	internal sealed class DynamicServiceProviderEngine : CompiledServiceProviderEngine
	{
		private readonly ServiceProvider _serviceProvider;

		public DynamicServiceProviderEngine(ServiceProvider serviceProvider)
			: base(serviceProvider)
		{
			_serviceProvider = serviceProvider;
		}

		public override Func<ServiceProviderEngineScope, object?> RealizeService(ServiceCallSite callSite)
		{
			ServiceCallSite callSite2 = callSite;
			int callCount = 0;
			return delegate(ServiceProviderEngineScope scope)
			{
				object result = CallSiteRuntimeResolver.Instance.Resolve(callSite2, scope);
				if (Interlocked.Increment(ref callCount) == 2)
				{
					ThreadPool.UnsafeQueueUserWorkItem(delegate
					{
						try
						{
							_serviceProvider.ReplaceServiceAccessor(callSite2, base.RealizeService(callSite2));
						}
						catch (Exception exception)
						{
							DependencyInjectionEventSource.Log.ServiceRealizationFailed(exception, _serviceProvider.GetHashCode());
						}
					}, null);
				}
				return result;
			};
		}
	}
	[RequiresDynamicCode("Using Microsoft.Extensions.DependencyInjection requires generating code dynamically at runtime. For example, when using enumerable and generic ValueType services.")]
	internal sealed class ExpressionResolverBuilder : CallSiteVisitor<object?, Expression>
	{
		private static readonly ParameterExpression ScopeParameter = Expression.Parameter(typeof(ServiceProviderEngineScope));

		private static readonly ParameterExpression ResolvedServices = Expression.Variable(typeof(IDictionary<ServiceCacheKey, object>), ScopeParameter.Name + "resolvedServices");

		private static readonly ParameterExpression Sync = Expression.Variable(typeof(object), ScopeParameter.Name + "sync");

		private static readonly BinaryExpression ResolvedServicesVariableAssignment = Expression.Assign(ResolvedServices, Expression.Property(ScopeParameter, typeof(ServiceProviderEngineScope).GetProperty("ResolvedServices", BindingFlags.Instance | BindingFlags.NonPublic)));

		private static readonly BinaryExpression SyncVariableAssignment = Expression.Assign(Sync, Expression.Property(ScopeParameter, typeof(ServiceProviderEngineScope).GetProperty("Sync", BindingFlags.Instance | BindingFlags.NonPublic)));

		private static readonly ParameterExpression CaptureDisposableParameter = Expression.Parameter(typeof(object));

		private static readonly LambdaExpression CaptureDisposable = Expression.Lambda(Expression.Call(ScopeParameter, ServiceLookupHelpers.CaptureDisposableMethodInfo, CaptureDisposableParameter), CaptureDisposableParameter);

		private static readonly ConstantExpression CallSiteRuntimeResolverInstanceExpression = Expression.Constant(CallSiteRuntimeResolver.Instance, typeof(CallSiteRuntimeResolver));

		private readonly ServiceProviderEngineScope _rootScope;

		private readonly ConcurrentDictionary<ServiceCacheKey, Func<ServiceProviderEngineScope, object>> _scopeResolverCache;

		private readonly Func<ServiceCacheKey, ServiceCallSite, Func<ServiceProviderEngineScope, object>> _buildTypeDelegate;

		public ExpressionResolverBuilder(ServiceProvider serviceProvider)
		{
			_rootScope = serviceProvider.Root;
			_scopeResolverCache = new ConcurrentDictionary<ServiceCacheKey, Func<ServiceProviderEngineScope, object>>();
			_buildTypeDelegate = (ServiceCacheKey key, ServiceCallSite cs) => BuildNoCache(cs);
		}

		public Func<ServiceProviderEngineScope, object> Build(ServiceCallSite callSite)
		{
			ServiceCallSite callSite2 = callSite;
			if (callSite2.Cache.Location == CallSiteResultCacheLocation.Scope)
			{
				return _scopeResolverCache.GetOrAdd(callSite2.Cache.Key, (ServiceCacheKey key) => _buildTypeDelegate(key, callSite2));
			}
			return BuildNoCache(callSite2);
		}

		public Func<ServiceProviderEngineScope, object> BuildNoCache(ServiceCallSite callSite)
		{
			Expression<Func<ServiceProviderEngineScope, object>> expression = BuildExpression(callSite);
			DependencyInjectionEventSource.Log.ExpressionTreeGenerated(_rootScope.RootProvider, callSite.ServiceType, expression);
			return expression.Compile();
		}

		private Expression<Func<ServiceProviderEngineScope, object>> BuildExpression(ServiceCallSite callSite)
		{
			if (callSite.Cache.Location == CallSiteResultCacheLocation.Scope)
			{
				return Expression.Lambda<Func<ServiceProviderEngineScope, object>>(Expression.Block(new ParameterExpression[2] { ResolvedServices, Sync }, ResolvedServicesVariableAssignment, SyncVariableAssignment, BuildScopedExpression(callSite)), new ParameterExpression[1] { ScopeParameter });
			}
			return Expression.Lambda<Func<ServiceProviderEngineScope, object>>(Convert(VisitCallSite(callSite, null), typeof(object), forceValueTypeConversion: true), new ParameterExpression[1] { ScopeParameter });
		}

		protected override Expression VisitRootCache(ServiceCallSite singletonCallSite, object? context)
		{
			return Expression.Constant(CallSiteRuntimeResolver.Instance.Resolve(singletonCallSite, _rootScope));
		}

		protected override Expression VisitConstant(ConstantCallSite constantCallSite, object? context)
		{
			return Expression.Constant(constantCallSite.DefaultValue);
		}

		protected override Expression VisitServiceProvider(ServiceProviderCallSite serviceProviderCallSite, object? context)
		{
			return ScopeParameter;
		}

		protected override Expression VisitFactory(FactoryCallSite factoryCallSite, object? context)
		{
			return Expression.Invoke(Expression.Constant(factoryCallSite.Factory), ScopeParameter);
		}

		protected override Expression VisitIEnumerable(IEnumerableCallSite callSite, object? context)
		{
			object context2 = context;
			IEnumerableCallSite callSite2 = callSite;
			if (callSite2.ServiceCallSites.Length == 0)
			{
				return Expression.Constant(ServiceLookupHelpers.GetArrayEmptyMethodInfo(callSite2.ItemType).Invoke(null, Array.Empty<object>()));
			}
			return Expression.NewArrayInit(callSite2.ItemType, callSite2.ServiceCallSites.Select((ServiceCallSite cs) => Convert(VisitCallSite(cs, context2), callSite2.ItemType)));
		}

		protected override Expression VisitDisposeCache(ServiceCallSite callSite, object? context)
		{
			return TryCaptureDisposable(callSite, ScopeParameter, VisitCallSiteMain(callSite, context));
		}

		private static Expression TryCaptureDisposable(ServiceCallSite callSite, ParameterExpression scope, Expression service)
		{
			if (!callSite.CaptureDisposable)
			{
				return service;
			}
			return Expression.Invoke(GetCaptureDisposable(scope), service);
		}

		protected override Expression VisitConstructor(ConstructorCallSite callSite, object? context)
		{
			ParameterInfo[] parameters = callSite.ConstructorInfo.GetParameters();
			Expression[] array;
			if (callSite.ParameterCallSites.Length == 0)
			{
				array = Array.Empty<Expression>();
			}
			else
			{
				array = new Expression[callSite.ParameterCallSites.Length];
				for (int i = 0; i < array.Length; i++)
				{
					array[i] = Convert(VisitCallSite(callSite.ParameterCallSites[i], context), parameters[i].ParameterType);
				}
			}
			Expression expression = Expression.New(callSite.ConstructorInfo, array);
			if (callSite.ImplementationType.IsValueType)
			{
				expression = Expression.Convert(expression, typeof(object));
			}
			return expression;
		}

		private static Expression Convert(Expression expression, Type type, bool forceValueTypeConversion = false)
		{
			if (type.IsAssignableFrom(expression.Type) && (!expression.Type.IsValueType || !forceValueTypeConversion))
			{
				return expression;
			}
			return Expression.Convert(expression, type);
		}

		protected override Expression VisitScopeCache(ServiceCallSite callSite, object? context)
		{
			Func<ServiceProviderEngineScope, object> value = Build(callSite);
			return Expression.Invoke(Expression.Constant(value), ScopeParameter);
		}

		private Expression BuildScopedExpression(ServiceCallSite callSite)
		{
			ConstantExpression arg = Expression.Constant(callSite, typeof(ServiceCallSite));
			MethodCallExpression ifTrue = Expression.Call(CallSiteRuntimeResolverInstanceExpression, ServiceLookupHelpers.ResolveCallSiteAndScopeMethodInfo, arg, ScopeParameter);
			ConstantExpression arg2 = Expression.Constant(callSite.Cache.Key, typeof(ServiceCacheKey));
			ParameterExpression parameterExpression = Expression.Variable(typeof(object), "resolved");
			ParameterExpression resolvedServices = ResolvedServices;
			MethodCallExpression expression = Expression.Call(resolvedServices, ServiceLookupHelpers.TryGetValueMethodInfo, arg2, parameterExpression);
			Expression right = TryCaptureDisposable(callSite, ScopeParameter, VisitCallSiteMain(callSite, null));
			BinaryExpression arg3 = Expression.Assign(parameterExpression, right);
			MethodCallExpression arg4 = Expression.Call(resolvedServices, ServiceLookupHelpers.AddMethodInfo, arg2, parameterExpression);
			BlockExpression arg5 = Expression.Block(typeof(object), new ParameterExpression[1] { parameterExpression }, Expression.IfThen(Expression.Not(expression), Expression.Block(arg3, arg4)), parameterExpression);
			ParameterExpression parameterExpression2 = Expression.Variable(typeof(bool), "lockWasTaken");
			ParameterExpression sync = Sync;
			MethodCallExpression arg6 = Expression.Call(ServiceLookupHelpers.MonitorEnterMethodInfo, sync, parameterExpression2);
			MethodCallExpression ifTrue2 = Expression.Call(ServiceLookupHelpers.MonitorExitMethodInfo, sync);
			BlockExpression body = Expression.Block(arg6, arg5);
			ConditionalExpression @finally = Expression.IfThen(parameterExpression2, ifTrue2);
			return Expression.Condition(Expression.Property(ScopeParameter, typeof(ServiceProviderEngineScope).GetProperty("IsRootScope", BindingFlags.Instance | BindingFlags.Public)), ifTrue, Expression.Block(typeof(object), new ParameterExpression[1] { parameterExpression2 }, Expression.TryFinally(body, @finally)));
		}

		public static Expression GetCaptureDisposable(ParameterExpression scope)
		{
			if (scope != ScopeParameter)
			{
				throw new NotSupportedException(System.SR.GetCaptureDisposableNotSupported);
			}
			return CaptureDisposable;
		}
	}
	internal sealed class ExpressionsServiceProviderEngine : ServiceProviderEngine
	{
		private readonly ExpressionResolverBuilder _expressionResolverBuilder;

		[RequiresDynamicCode("Using Microsoft.Extensions.DependencyInjection requires generating code dynamically at runtime. For example, when using enumerable and generic ValueType services.")]
		public ExpressionsServiceProviderEngine(ServiceProvider serviceProvider)
		{
			_expressionResolverBuilder = new ExpressionResolverBuilder(serviceProvider);
		}

		public override Func<ServiceProviderEngineScope, object> RealizeService(ServiceCallSite callSite)
		{
			return _expressionResolverBuilder.Build(callSite);
		}
	}
	internal sealed class FactoryCallSite : ServiceCallSite
	{
		public Func<IServiceProvider, object> Factory { get; }

		public override Type ServiceType { get; }

		public override Type? ImplementationType => null;

		public override CallSiteKind Kind { get; }

		public FactoryCallSite(ResultCache cache, Type serviceType, Func<IServiceProvider, object> factory)
			: base(cache)
		{
			Factory = factory;
			ServiceType = serviceType;
		}
	}
	[RequiresDynamicCode("Using Microsoft.Extensions.DependencyInjection requires generating code dynamically at runtime. For example, when using enumerable and generic ValueType services.")]
	internal sealed class IEnumerableCallSite : ServiceCallSite
	{
		internal Type ItemType { get; }

		internal ServiceCallSite[] ServiceCallSites { get; }

		public override Type ServiceType => typeof(IEnumerable<>).MakeGenericType(ItemType);

		public override Type ImplementationType => ItemType.MakeArrayType();

		public override CallSiteKind Kind { get; } = CallSiteKind.IEnumerable;


		public IEnumerableCallSite(ResultCache cache, Type itemType, ServiceCallSite[] serviceCallSites)
			: base(cache)
		{
			ItemType = itemType;
			ServiceCallSites = serviceCallSites;
		}
	}
	internal struct ResultCache
	{
		public static ResultCache None { get; } = new ResultCache(CallSiteResultCacheLocation.None, ServiceCacheKey.Empty);


		public CallSiteResultCacheLocation Location { get; set; }

		public ServiceCacheKey Key { get; set; }

		internal ResultCache(CallSiteResultCacheLocation lifetime, ServiceCacheKey cacheKey)
		{
			Location = lifetime;
			Key = cacheKey;
		}

		public ResultCache(ServiceLifetime lifetime, Type? type, int slot)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected I4, but got Unknown
			switch ((int)lifetime)
			{
			case 0:
				Location = CallSiteResultCacheLocation.Root;
				break;
			case 1:
				Location = CallSiteResultCacheLocation.Scope;
				break;
			case 2:
				Location = CallSiteResultCacheLocation.Dispose;
				break;
			default:
				Location = CallSiteResultCacheLocation.None;
				break;
			}
			Key = new ServiceCacheKey(type, slot);
		}
	}
	[RequiresDynamicCode("Using Microsoft.Extensions.DependencyInjection requires generating code dynamically at runtime. For example, when using enumerable and generic ValueType services.")]
	internal sealed class RuntimeServiceProviderEngine : ServiceProviderEngine
	{
		public static RuntimeServiceProviderEngine Instance { get; } = new RuntimeServiceProviderEngine();


		private RuntimeServiceProviderEngine()
		{
		}

		public override Func<ServiceProviderEngineScope, object?> RealizeService(ServiceCallSite callSite)
		{
			ServiceCallSite callSite2 = callSite;
			return (ServiceProviderEngineScope scope) => CallSiteRuntimeResolver.Instance.Resolve(callSite2, scope);
		}
	}
	internal readonly struct ServiceCacheKey : IEquatable<ServiceCacheKey>
	{
		public static ServiceCacheKey Empty { get; } = new ServiceCacheKey(null, 0);


		public Type? Type { get; }

		public int Slot { get; }

		public ServiceCacheKey(Type? type, int slot)
		{
			Type = type;
			Slot = slot;
		}

		public bool Equals(ServiceCacheKey other)
		{
			if (Type == other.Type)
			{
				return Slot == other.Slot;
			}
			return false;
		}

		public override bool Equals([NotNullWhen(true)] object? obj)
		{
			if (obj is ServiceCacheKey other)
			{
				return Equals(other);
			}
			return false;
		}

		public override int GetHashCode()
		{
			return ((Type?.GetHashCode() ?? 23) * 397) ^ Slot;
		}
	}
	internal abstract class ServiceCallSite
	{
		public abstract Type ServiceType { get; }

		public abstract Type? ImplementationType { get; }

		public abstract CallSiteKind Kind { get; }

		public ResultCache Cache { get; }

		public object? Value { get; set; }

		public bool CaptureDisposable
		{
			get
			{
				if (!(ImplementationType == null) && !typeof(IDisposable).IsAssignableFrom(ImplementationType))
				{
					return typeof(IAsyncDisposable).IsAssignableFrom(ImplementationType);
				}
				return true;
			}
		}

		protected ServiceCallSite(ResultCache cache)
		{
			Cache = cache;
		}
	}
	internal static class ServiceLookupHelpers
	{
		private const BindingFlags LookupFlags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;

		private static readonly MethodInfo ArrayEmptyMethodInfo = typeof(Array).GetMethod("Empty");

		internal static readonly MethodInfo InvokeFactoryMethodInfo = typeof(Func<IServiceProvider, object>).GetMethod("Invoke", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);

		internal static readonly MethodInfo CaptureDisposableMethodInfo = typeof(ServiceProviderEngineScope).GetMethod("CaptureDisposable", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);

		internal static readonly MethodInfo TryGetValueMethodInfo = typeof(IDictionary<ServiceCacheKey, object>).GetMethod("TryGetValue", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);

		internal static readonly MethodInfo ResolveCallSiteAndScopeMethodInfo = typeof(CallSiteRuntimeResolver).GetMethod("Resolve", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);

		internal static readonly MethodInfo AddMethodInfo = typeof(IDictionary<ServiceCacheKey, object>).GetMethod("Add", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);

		internal static readonly MethodInfo MonitorEnterMethodInfo = typeof(Monitor).GetMethod("Enter", BindingFlags.Static | BindingFlags.Public, null, new Type[2]
		{
			typeof(object),
			typeof(bool).MakeByRefType()
		}, null);

		internal static readonly MethodInfo MonitorExitMethodInfo = typeof(Monitor).GetMethod("Exit", BindingFlags.Static | BindingFlags.Public, null, new Type[1] { typeof(object) }, null);

		[RequiresDynamicCode("The code for an array of the specified type might not be available.")]
		[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2060:MakeGenericMethod", Justification = "Calling Array.Empty<T>() is safe since the T doesn't have trimming annotations.")]
		internal static MethodInfo GetArrayEmptyMethodInfo(Type itemType)
		{
			return ArrayEmptyMethodInfo.MakeGenericMethod(itemType);
		}
	}
	internal sealed class ServiceProviderCallSite : ServiceCallSite
	{
		public override Type ServiceType { get; } = typeof(IServiceProvider);


		public override Type ImplementationType { get; } = typeof(ServiceProvider);


		public override CallSiteKind Kind { get; } = CallSiteKind.ServiceProvider;


		public ServiceProviderCallSite()
			: base(ResultCache.None)
		{
		}
	}
	internal abstract class ServiceProviderEngine
	{
		public abstract Func<ServiceProviderEngineScope, object?> RealizeService(ServiceCallSite callSite);
	}
	internal sealed class ServiceProviderEngineScope : IServiceScope, IDisposable, IServiceProvider, IAsyncDisposable, IServiceScopeFactory
	{
		private bool _disposed;

		private List<object> _disposables;

		internal IList<object> Disposables
		{
			get
			{
				IList<object> disposables = _disposables;
				return disposables ?? Array.Empty<object>();
			}
		}

		internal Dictionary<ServiceCacheKey, object?> ResolvedServices { get; }

		internal object Sync => ResolvedServices;

		public bool IsRootScope { get; }

		internal ServiceProvider RootProvider { get; }

		public IServiceProvider ServiceProvider => this;

		public ServiceProviderEngineScope(ServiceProvider provider, bool isRootScope)
		{
			ResolvedServices = new Dictionary<ServiceCacheKey, object>();
			RootProvider = provider;
			IsRootScope = isRootScope;
		}

		public object? GetService(Type serviceType)
		{
			if (_disposed)
			{
				ThrowHelper.ThrowObjectDisposedException();
			}
			return RootProvider.GetService(serviceType, this);
		}

		public IServiceScope CreateScope()
		{
			return RootProvider.CreateScope();
		}

		[return: NotNullIfNotNull("service")]
		internal object? CaptureDisposable(object? service)
		{
			object service2 = service;
			if (this == service2 || (!(service2 is IDisposable) && !(service2 is IAsyncDisposable)))
			{
				return service2;
			}
			bool flag = false;
			lock (Sync)
			{
				if (_disposed)
				{
					flag = true;
				}
				else
				{
					if (_disposables == null)
					{
						_disposables = new List<object>();
					}
					_disposables.Add(service2);
				}
			}
			if (flag)
			{
				if (service2 is IDisposable disposable)
				{
					disposable.Dispose();
				}
				else
				{
					Task.Run(() => ((IAsyncDisposable)service2).DisposeAsync().AsTask()).GetAwaiter().GetResult();
				}
				ThrowHelper.ThrowObjectDisposedException();
			}
			return service2;
		}

		public void Dispose()
		{
			List<object> list = BeginDispose();
			if (list == null)
			{
				return;
			}
			int num = list.Count - 1;
			while (num >= 0)
			{
				if (list[num] is IDisposable disposable)
				{
					disposable.Dispose();
					num--;
					continue;
				}
				throw new InvalidOperationException(System.SR.Format(System.SR.AsyncDisposableServiceDispose, TypeNameHelper.GetTypeDisplayName(list[num])));
			}
		}

		public ValueTask DisposeAsync()
		{
			List<object> list = BeginDispose();
			if (list != null)
			{
				try
				{
					for (int num = list.Count - 1; num >= 0; num--)
					{
						object obj = list[num];
						if (obj is IAsyncDisposable asyncDisposable)
						{
							ValueTask vt2 = asyncDisposable.DisposeAsync();
							if (!vt2.IsCompletedSuccessfully)
							{
								return Await(num, vt2, list);
							}
							vt2.GetAwaiter().GetResult();
						}
						else
						{
							((IDisposable)obj).Dispose();
						}
					}
				}
				catch (Exception exception)
				{
					return new ValueTask(Task.FromException(exception));
				}
			}
			return default(ValueTask);
			static async ValueTask Await(int i, ValueTask vt, List<object> toDispose)
			{
				await vt.ConfigureAwait(continueOnCapturedContext: false);
				i--;
				while (i >= 0)
				{
					object obj2 = toDispose[i];
					if (obj2 is IAsyncDisposable asyncDisposable2)
					{
						await asyncDisposable2.DisposeAsync().ConfigureAwait(continueOnCapturedContext: false);
					}
					else
					{
						((IDisposable)obj2).Dispose();
					}
					i--;
				}
			}
		}

		private List<object> BeginDispose()
		{
			lock (Sync)
			{
				if (_disposed)
				{
					return null;
				}
				DependencyInjectionEventSource.Log.ScopeDisposed(RootProvider.GetHashCode(), ResolvedServices.Count, _disposables?.Count ?? 0);
				_disposed = true;
			}
			if (IsRootScope && !RootProvider.IsDisposed())
			{
				RootProvider.Dispose();
			}
			return _disposables;
		}
	}
	internal sealed class StackGuard
	{
		private const int MaxExecutionStackCount = 1024;

		private int _executionStackCount;

		public bool TryEnterOnCurrentStack()
		{
			try
			{
				RuntimeHelpers.EnsureSufficientExecutionStack();
				return true;
			}
			catch (InsufficientExecutionStackException)
			{
			}
			if (_executionStackCount < 1024)
			{
				return false;
			}
			throw new InsufficientExecutionStackException();
		}

		public TR RunOnEmptyStack<T1, T2, TR>(Func<T1, T2, TR> action, T1 arg1, T2 arg2)
		{
			return RunOnEmptyStackCore(delegate(object s)
			{
				Tuple<Func<T1, T2, TR>, T1, T2> tuple = (Tuple<Func<T1, T2, TR>, T1, T2>)s;
				return tuple.Item1(tuple.Item2, tuple.Item3);
			}, Tuple.Create(action, arg1, arg2));
		}

		private R RunOnEmptyStackCore<R>(Func<object, R> action, object state)
		{
			_executionStackCount++;
			try
			{
				Task<R> task = Task.Factory.StartNew(action, state, CancellationToken.None, TaskCreationOptions.DenyChildAttach, TaskScheduler.Default);
				if (!task.IsCompleted)
				{
					((IAsyncResult)task).AsyncWaitHandle.WaitOne();
				}
				return task.GetAwaiter().GetResult();
			}
			finally
			{
				_executionStackCount--;
			}
		}
	}
	internal static class ThrowHelper
	{
		[MethodImpl(MethodImplOptions.NoInlining)]
		[DoesNotReturn]
		internal static void ThrowObjectDisposedException()
		{
			throw new ObjectDisposedException("IServiceProvider");
		}
	}
	[RequiresDynamicCode("Creates DynamicMethods")]
	internal sealed class ILEmitResolverBuilder : CallSiteVisitor<ILEmitResolverBuilderContext, object?>
	{
		private sealed class ILEmitResolverBuilderRuntimeContext
		{
			public object[] Constants;

			public Func<IServiceProvider, object>[] Factories;
		}

		private struct GeneratedMethod
		{
			public Func<ServiceProviderEngineScope, object> Lambda;

			public ILEmitResolverBuilderRuntimeContext Context;

			public DynamicMethod DynamicMethod;
		}

		private static readonly MethodInfo ResolvedServicesGetter = typeof(ServiceProviderEngineScope).GetProperty("ResolvedServices", BindingFlags.Instance | BindingFlags.NonPublic).GetMethod;

		private static readonly MethodInfo ScopeLockGetter = typeof(ServiceProviderEngineScope).GetProperty("Sync", BindingFlags.Instance | BindingFlags.NonPublic).GetMethod;

		private static readonly MethodInfo ScopeIsRootScope = typeof(ServiceProviderEngineScope).GetProperty("IsRootScope", BindingFlags.Instance | BindingFlags.Public).GetMethod;

		private static readonly MethodInfo CallSiteRuntimeResolverResolveMethod = typeof(CallSiteRuntimeResolver).GetMethod("Resolve", BindingFlags.Instance | BindingFlags.Public);

		private static readonly MethodInfo CallSiteRuntimeResolverInstanceField = typeof(CallSiteRuntimeResolver).GetProperty("Instance", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public).GetMethod;

		private static readonly FieldInfo FactoriesField = typeof(ILEmitResolverBuilderRuntimeContext).GetField("Factories");

		private static readonly FieldInfo ConstantsField = typeof(ILEmitResolverBuilderRuntimeContext).GetField("Constants");

		private static readonly MethodInfo GetTypeFromHandleMethod = typeof(Type).GetMethod("GetTypeFromHandle");

		private static readonly ConstructorInfo CacheKeyCtor = typeof(ServiceCacheKey).GetConstructors()[0];

		private readonly ServiceProviderEngineScope _rootScope;

		private readonly ConcurrentDictionary<ServiceCacheKey, GeneratedMethod> _scopeResolverCache;

		private readonly Func<ServiceCacheKey, ServiceCallSite, GeneratedMethod> _buildTypeDelegate;

		public ILEmitResolverBuilder(ServiceProvider serviceProvider)
		{
			_rootScope = serviceProvider.Root;
			_scopeResolverCache = new ConcurrentDictionary<ServiceCacheKey, GeneratedMethod>();
			_buildTypeDelegate = (ServiceCacheKey key, ServiceCallSite cs) => BuildTypeNoCache(cs);
		}

		public Func<ServiceProviderEngineScope, object?> Build(ServiceCallSite callSite)
		{
			return BuildType(callSite).Lambda;
		}

		private GeneratedMethod BuildType(ServiceCallSite callSite)
		{
			if (callSite.Cache.Location == CallSiteResultCacheLocation.Scope)
			{
				return _scopeResolverCache.GetOrAdd(callSite.Cache.Key, (ServiceCacheKey key) => _buildTypeDelegate(key, callSite));
			}
			return BuildTypeNoCache(callSite);
		}

		private GeneratedMethod BuildTypeNoCache(ServiceCallSite callSite)
		{
			DynamicMethod dynamicMethod = new DynamicMethod("ResolveService", MethodAttributes.Public | MethodAttributes.Static, CallingConventions.Standard, typeof(object), new Type[2]
			{
				typeof(ILEmitResolverBuilderRuntimeContext),
				typeof(ServiceProviderEngineScope)
			}, GetType(), skipVisibility: true);
			ILGenerator iLGenerator = dynamicMethod.GetILGenerator(512);
			ILEmitResolverBuilderRuntimeContext iLEmitResolverBuilderRuntimeContext = GenerateMethodBody(callSite, iLGenerator);
			DependencyInjectionEventSource.Log.DynamicMethodBuilt(_rootScope.RootProvider, callSite.ServiceType, iLGenerator.ILOffset);
			GeneratedMethod result = default(GeneratedMethod);
			result.Lambda = (Func<ServiceProviderEngineScope, object>)dynamicMethod.CreateDelegate(typeof(Func<ServiceProviderEngineScope, object>), iLEmitResolverBuilderRuntimeContext);
			result.Context = iLEmitResolverBuilderRuntimeContext;
			result.DynamicMethod = dynamicMethod;
			return result;
		}

		protected override object? VisitDisposeCache(ServiceCallSite transientCallSite, ILEmitResolverBuilderContext argument)
		{
			if (transientCallSite.CaptureDisposable)
			{
				BeginCaptureDisposable(argument);
				VisitCallSiteMain(transientCallSite, argument);
				EndCaptureDisposable(argument);
			}
			else
			{
				VisitCallSiteMain(transientCallSite, argument);
			}
			return null;
		}

		protected override object? VisitConstructor(ConstructorCallSite constructorCallSite, ILEmitResolverBuilderContext argument)
		{
			ServiceCallSite[] parameterCallSites = constructorCallSite.ParameterCallSites;
			foreach (ServiceCallSite serviceCallSite in parameterCallSites)
			{
				VisitCallSite(serviceCallSite, argument);
				if (serviceCallSite.ServiceType.IsValueType)
				{
					argument.Generator.Emit(OpCodes.Unbox_Any, serviceCallSite.ServiceType);
				}
			}
			argument.Generator.Emit(OpCodes.Newobj, constructorCallSite.ConstructorInfo);
			if (constructorCallSite.ImplementationType.IsValueType)
			{
				argument.Generator.Emit(OpCodes.Box, constructorCallSite.ImplementationType);
			}
			return null;
		}

		protected override object? VisitRootCache(ServiceCallSite callSite, ILEmitResolverBuilderContext argument)
		{
			AddConstant(argument, CallSiteRuntimeResolver.Instance.Resolve(callSite, _rootScope));
			return null;
		}

		protected override object? VisitScopeCache(ServiceCallSite scopedCallSite, ILEmitResolverBuilderContext argument)
		{
			GeneratedMethod generatedMethod = BuildType(scopedCallSite);
			AddConstant(argument, generatedMethod.Context);
			argument.Generator.Emit(OpCodes.Ldarg_1);
			argument.Generator.Emit(OpCodes.Call, generatedMethod.DynamicMethod);
			return null;
		}

		protected override object? VisitConstant(ConstantCallSite constantCallSite, ILEmitResolverBuilderContext argument)
		{
			AddConstant(argument, constantCallSite.DefaultValue);
			return null;
		}

		protected override object? VisitServiceProvider(ServiceProviderCallSite serviceProviderCallSite, ILEmitResolverBuilderContext argument)
		{
			argument.Generator.Emit(OpCodes.Ldarg_1);
			return null;
		}

		protected override object? VisitIEnumerable(IEnumerableCallSite enumerableCallSite, ILEmitResolverBuilderContext argument)
		{
			if (enumerableCallSite.ServiceCallSites.Length == 0)
			{
				argument.Generator.Emit(OpCodes.Call, ServiceLookupHelpers.GetArrayEmptyMethodInfo(enumerableCallSite.ItemType));
			}
			else
			{
				argument.Generator.Emit(OpCodes.Ldc_I4, enumerableCallSite.ServiceCallSites.Length);
				argument.Generator.Emit(OpCodes.Newarr, enumerableCallSite.ItemType);
				for (int i = 0; i < enumerableCallSite.ServiceCallSites.Length; i++)
				{
					argument.Generator.Emit(OpCodes.Dup);
					argument.Generator.Emit(OpCodes.Ldc_I4, i);
					ServiceCallSite serviceCallSite = enumerableCallSite.ServiceCallSites[i];
					VisitCal

BepInEx/plugins/SlopCrew.Plugin/Microsoft.Extensions.FileProviders.Abstractions.dll

Decompiled 8 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using FxResources.Microsoft.Extensions.FileProviders.Abstractions;
using Microsoft.CodeAnalysis;
using Microsoft.Extensions.Primitives;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: AssemblyMetadata(".NETFrameworkAssembly", "")]
[assembly: AssemblyMetadata("Serviceable", "True")]
[assembly: AssemblyMetadata("PreferInbox", "True")]
[assembly: AssemblyDefaultAlias("Microsoft.Extensions.FileProviders.Abstractions")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: CLSCompliant(true)]
[assembly: AssemblyMetadata("IsTrimmable", "True")]
[assembly: DefaultDllImportSearchPaths(DllImportSearchPath.System32 | DllImportSearchPath.AssemblyDirectory)]
[assembly: AssemblyCompany("Microsoft Corporation")]
[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")]
[assembly: AssemblyDescription("Abstractions of files and directories.\r\n\r\nCommonly Used Types:\r\nMicrosoft.Extensions.FileProviders.IDirectoryContents\r\nMicrosoft.Extensions.FileProviders.IFileInfo\r\nMicrosoft.Extensions.FileProviders.IFileProvider")]
[assembly: AssemblyFileVersion("7.0.22.51805")]
[assembly: AssemblyInformationalVersion("7.0.0+d099f075e45d2aa6007a22b71b45a08758559f80")]
[assembly: AssemblyProduct("Microsoft® .NET")]
[assembly: AssemblyTitle("Microsoft.Extensions.FileProviders.Abstractions")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/dotnet/runtime")]
[assembly: AssemblyVersion("7.0.0.0")]
[module: RefSafetyRules(11)]
[module: System.Runtime.CompilerServices.NullablePublicOnly(false)]
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 NullablePublicOnlyAttribute : Attribute
	{
		public readonly bool IncludesInternals;

		public NullablePublicOnlyAttribute(bool P_0)
		{
			IncludesInternals = 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 FxResources.Microsoft.Extensions.FileProviders.Abstractions
{
	internal static class SR
	{
	}
}
namespace System
{
	internal static class SR
	{
		private static readonly bool s_usingResourceKeys = AppContext.TryGetSwitch("System.Resources.UseSystemResourceKeys", out var isEnabled) && isEnabled;

		private static ResourceManager s_resourceManager;

		internal static ResourceManager ResourceManager => s_resourceManager ?? (s_resourceManager = new ResourceManager(typeof(SR)));

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

		private static bool UsingResourceKeys()
		{
			return s_usingResourceKeys;
		}

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

		internal static string GetResourceString(string resourceKey, string defaultString)
		{
			string resourceString = GetResourceString(resourceKey);
			if (!(resourceKey == resourceString) && resourceString != null)
			{
				return resourceString;
			}
			return defaultString;
		}

		internal static string Format(string resourceFormat, object p1)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1);
			}
			return string.Format(resourceFormat, p1);
		}

		internal static string Format(string resourceFormat, object p1, object p2)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2);
			}
			return string.Format(resourceFormat, p1, p2);
		}

		internal static string Format(string resourceFormat, object p1, object p2, object p3)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2, p3);
			}
			return string.Format(resourceFormat, p1, p2, p3);
		}

		internal static string Format(string resourceFormat, params object[] args)
		{
			if (args != null)
			{
				if (UsingResourceKeys())
				{
					return resourceFormat + ", " + string.Join(", ", args);
				}
				return string.Format(resourceFormat, args);
			}
			return resourceFormat;
		}

		internal static string Format(IFormatProvider provider, string resourceFormat, object p1)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1);
			}
			return string.Format(provider, resourceFormat, p1);
		}

		internal static string Format(IFormatProvider provider, string resourceFormat, object p1, object p2)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2);
			}
			return string.Format(provider, resourceFormat, p1, p2);
		}

		internal static string Format(IFormatProvider provider, string resourceFormat, object p1, object p2, object p3)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2, p3);
			}
			return string.Format(provider, resourceFormat, p1, p2, p3);
		}

		internal static string Format(IFormatProvider provider, string resourceFormat, params object[] args)
		{
			if (args != null)
			{
				if (UsingResourceKeys())
				{
					return resourceFormat + ", " + string.Join(", ", args);
				}
				return string.Format(provider, resourceFormat, args);
			}
			return resourceFormat;
		}
	}
}
namespace System.Diagnostics.CodeAnalysis
{
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)]
	internal sealed class AllowNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)]
	internal sealed class DisallowNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)]
	internal sealed class MaybeNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)]
	internal sealed class NotNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class MaybeNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public MaybeNullWhenAttribute(bool returnValue)
		{
			ReturnValue = returnValue;
		}
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class NotNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public NotNullWhenAttribute(bool returnValue)
		{
			ReturnValue = returnValue;
		}
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = true, Inherited = false)]
	internal sealed class NotNullIfNotNullAttribute : Attribute
	{
		public string ParameterName { get; }

		public NotNullIfNotNullAttribute(string parameterName)
		{
			ParameterName = parameterName;
		}
	}
	[AttributeUsage(AttributeTargets.Method, Inherited = false)]
	internal sealed class DoesNotReturnAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class DoesNotReturnIfAttribute : Attribute
	{
		public bool ParameterValue { get; }

		public DoesNotReturnIfAttribute(bool parameterValue)
		{
			ParameterValue = parameterValue;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	internal sealed class MemberNotNullAttribute : Attribute
	{
		public string[] Members { get; }

		public MemberNotNullAttribute(string member)
		{
			Members = new string[1] { member };
		}

		public MemberNotNullAttribute(params string[] members)
		{
			Members = members;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	internal sealed class MemberNotNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public string[] Members { get; }

		public MemberNotNullWhenAttribute(bool returnValue, string member)
		{
			ReturnValue = returnValue;
			Members = new string[1] { member };
		}

		public MemberNotNullWhenAttribute(bool returnValue, params string[] members)
		{
			ReturnValue = returnValue;
			Members = members;
		}
	}
}
namespace System.Runtime.InteropServices
{
	[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
	internal sealed class LibraryImportAttribute : Attribute
	{
		public string LibraryName { get; }

		public string EntryPoint { get; set; }

		public StringMarshalling StringMarshalling { get; set; }

		public Type StringMarshallingCustomType { get; set; }

		public bool SetLastError { get; set; }

		public LibraryImportAttribute(string libraryName)
		{
			LibraryName = libraryName;
		}
	}
	internal enum StringMarshalling
	{
		Custom,
		Utf8,
		Utf16
	}
}
namespace Microsoft.Extensions.FileProviders
{
	public interface IDirectoryContents : IEnumerable<IFileInfo>, IEnumerable
	{
		bool Exists { get; }
	}
	public interface IFileInfo
	{
		bool Exists { get; }

		long Length { get; }

		string? PhysicalPath { get; }

		string Name { get; }

		DateTimeOffset LastModified { get; }

		bool IsDirectory { get; }

		Stream CreateReadStream();
	}
	public interface IFileProvider
	{
		IFileInfo GetFileInfo(string subpath);

		IDirectoryContents GetDirectoryContents(string subpath);

		IChangeToken Watch(string filter);
	}
	public class NotFoundDirectoryContents : IDirectoryContents, IEnumerable<IFileInfo>, IEnumerable
	{
		public static NotFoundDirectoryContents Singleton { get; } = new NotFoundDirectoryContents();


		public bool Exists => false;

		public IEnumerator<IFileInfo> GetEnumerator()
		{
			return Enumerable.Empty<IFileInfo>().GetEnumerator();
		}

		IEnumerator IEnumerable.GetEnumerator()
		{
			return GetEnumerator();
		}
	}
	public class NotFoundFileInfo : IFileInfo
	{
		public bool Exists => false;

		public bool IsDirectory => false;

		public DateTimeOffset LastModified => DateTimeOffset.MinValue;

		public long Length => -1L;

		public string Name { get; }

		public string? PhysicalPath => null;

		public NotFoundFileInfo(string name)
		{
			Name = name;
		}

		[DoesNotReturn]
		public Stream CreateReadStream()
		{
			throw new FileNotFoundException(System.SR.Format(System.SR.FileNotExists, Name));
		}
	}
	public class NullChangeToken : IChangeToken
	{
		public static NullChangeToken Singleton { get; } = new NullChangeToken();


		public bool HasChanged => false;

		public bool ActiveChangeCallbacks => false;

		private NullChangeToken()
		{
		}

		public IDisposable RegisterChangeCallback(Action<object?> callback, object? state)
		{
			return EmptyDisposable.Instance;
		}
	}
	public class NullFileProvider : IFileProvider
	{
		public IDirectoryContents GetDirectoryContents(string subpath)
		{
			return NotFoundDirectoryContents.Singleton;
		}

		public IFileInfo GetFileInfo(string subpath)
		{
			return new NotFoundFileInfo(subpath);
		}

		public IChangeToken Watch(string filter)
		{
			return (IChangeToken)(object)NullChangeToken.Singleton;
		}
	}
	internal sealed class EmptyDisposable : IDisposable
	{
		public static EmptyDisposable Instance { get; } = new EmptyDisposable();


		private EmptyDisposable()
		{
		}

		public void Dispose()
		{
		}
	}
}

BepInEx/plugins/SlopCrew.Plugin/Microsoft.Extensions.FileProviders.Physical.dll

Decompiled 8 months ago
using System;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Cryptography;
using System.Security.Permissions;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using FxResources.Microsoft.Extensions.FileProviders.Physical;
using Microsoft.CodeAnalysis;
using Microsoft.Extensions.FileProviders.Internal;
using Microsoft.Extensions.FileProviders.Physical;
using Microsoft.Extensions.FileProviders.Physical.Internal;
using Microsoft.Extensions.FileSystemGlobbing;
using Microsoft.Extensions.FileSystemGlobbing.Abstractions;
using Microsoft.Extensions.Internal;
using Microsoft.Extensions.Primitives;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: InternalsVisibleTo("Microsoft.Extensions.FileProviders.Physical.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: AssemblyMetadata(".NETFrameworkAssembly", "")]
[assembly: AssemblyMetadata("Serviceable", "True")]
[assembly: AssemblyMetadata("PreferInbox", "True")]
[assembly: AssemblyDefaultAlias("Microsoft.Extensions.FileProviders.Physical")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: CLSCompliant(true)]
[assembly: AssemblyMetadata("IsTrimmable", "True")]
[assembly: DefaultDllImportSearchPaths(DllImportSearchPath.System32 | DllImportSearchPath.AssemblyDirectory)]
[assembly: AssemblyCompany("Microsoft Corporation")]
[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")]
[assembly: AssemblyDescription("File provider for physical files for Microsoft.Extensions.FileProviders.")]
[assembly: AssemblyFileVersion("7.0.22.51805")]
[assembly: AssemblyInformationalVersion("7.0.0+d099f075e45d2aa6007a22b71b45a08758559f80")]
[assembly: AssemblyProduct("Microsoft® .NET")]
[assembly: AssemblyTitle("Microsoft.Extensions.FileProviders.Physical")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/dotnet/runtime")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("7.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: System.Runtime.CompilerServices.NullablePublicOnly(true)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class IsReadOnlyAttribute : Attribute
	{
	}
	[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 NullablePublicOnlyAttribute : Attribute
	{
		public readonly bool IncludesInternals;

		public NullablePublicOnlyAttribute(bool P_0)
		{
			IncludesInternals = 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 FxResources.Microsoft.Extensions.FileProviders.Physical
{
	internal static class SR
	{
	}
}
namespace System
{
	internal static class ThrowHelper
	{
		internal static void ThrowIfNull(object? argument, [CallerArgumentExpression("argument")] string? paramName = null)
		{
			if (argument == null)
			{
				Throw(paramName);
			}
		}

		private static void Throw(string paramName)
		{
			throw new ArgumentNullException(paramName);
		}
	}
	internal static class SR
	{
		private static readonly bool s_usingResourceKeys = AppContext.TryGetSwitch("System.Resources.UseSystemResourceKeys", out var isEnabled) && isEnabled;

		private static ResourceManager s_resourceManager;

		internal static ResourceManager ResourceManager => s_resourceManager ?? (s_resourceManager = new ResourceManager(typeof(SR)));

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

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

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

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

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

		private static bool UsingResourceKeys()
		{
			return s_usingResourceKeys;
		}

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

		internal static string GetResourceString(string resourceKey, string defaultString)
		{
			string resourceString = GetResourceString(resourceKey);
			if (!(resourceKey == resourceString) && resourceString != null)
			{
				return resourceString;
			}
			return defaultString;
		}

		internal static string Format(string resourceFormat, object? p1)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1);
			}
			return string.Format(resourceFormat, p1);
		}

		internal static string Format(string resourceFormat, object? p1, object? p2)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2);
			}
			return string.Format(resourceFormat, p1, p2);
		}

		internal static string Format(string resourceFormat, object? p1, object? p2, object? p3)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2, p3);
			}
			return string.Format(resourceFormat, p1, p2, p3);
		}

		internal static string Format(string resourceFormat, params object?[]? args)
		{
			if (args != null)
			{
				if (UsingResourceKeys())
				{
					return resourceFormat + ", " + string.Join(", ", args);
				}
				return string.Format(resourceFormat, args);
			}
			return resourceFormat;
		}

		internal static string Format(IFormatProvider? provider, string resourceFormat, object? p1)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1);
			}
			return string.Format(provider, resourceFormat, p1);
		}

		internal static string Format(IFormatProvider? provider, string resourceFormat, object? p1, object? p2)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2);
			}
			return string.Format(provider, resourceFormat, p1, p2);
		}

		internal static string Format(IFormatProvider? provider, string resourceFormat, object? p1, object? p2, object? p3)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2, p3);
			}
			return string.Format(provider, resourceFormat, p1, p2, p3);
		}

		internal static string Format(IFormatProvider? provider, string resourceFormat, params object?[]? args)
		{
			if (args != null)
			{
				if (UsingResourceKeys())
				{
					return resourceFormat + ", " + string.Join(", ", args);
				}
				return string.Format(provider, resourceFormat, args);
			}
			return resourceFormat;
		}
	}
}
namespace System.Diagnostics.CodeAnalysis
{
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)]
	internal sealed class AllowNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)]
	internal sealed class DisallowNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)]
	internal sealed class MaybeNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)]
	internal sealed class NotNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class MaybeNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public MaybeNullWhenAttribute(bool returnValue)
		{
			ReturnValue = returnValue;
		}
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class NotNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public NotNullWhenAttribute(bool returnValue)
		{
			ReturnValue = returnValue;
		}
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = true, Inherited = false)]
	internal sealed class NotNullIfNotNullAttribute : Attribute
	{
		public string ParameterName { get; }

		public NotNullIfNotNullAttribute(string parameterName)
		{
			ParameterName = parameterName;
		}
	}
	[AttributeUsage(AttributeTargets.Method, Inherited = false)]
	internal sealed class DoesNotReturnAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class DoesNotReturnIfAttribute : Attribute
	{
		public bool ParameterValue { get; }

		public DoesNotReturnIfAttribute(bool parameterValue)
		{
			ParameterValue = parameterValue;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	internal sealed class MemberNotNullAttribute : Attribute
	{
		public string[] Members { get; }

		public MemberNotNullAttribute(string member)
		{
			Members = new string[1] { member };
		}

		public MemberNotNullAttribute(params string[] members)
		{
			Members = members;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	internal sealed class MemberNotNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public string[] Members { get; }

		public MemberNotNullWhenAttribute(bool returnValue, string member)
		{
			ReturnValue = returnValue;
			Members = new string[1] { member };
		}

		public MemberNotNullWhenAttribute(bool returnValue, params string[] members)
		{
			ReturnValue = returnValue;
			Members = members;
		}
	}
}
namespace System.Runtime.Versioning
{
	internal abstract class OSPlatformAttribute : Attribute
	{
		public string PlatformName { get; }

		private protected OSPlatformAttribute(string platformName)
		{
			PlatformName = platformName;
		}
	}
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false, Inherited = false)]
	internal sealed class TargetPlatformAttribute : OSPlatformAttribute
	{
		public TargetPlatformAttribute(string platformName)
			: base(platformName)
		{
		}
	}
	[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface, AllowMultiple = true, Inherited = false)]
	internal sealed class SupportedOSPlatformAttribute : OSPlatformAttribute
	{
		public SupportedOSPlatformAttribute(string platformName)
			: base(platformName)
		{
		}
	}
	[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface, AllowMultiple = true, Inherited = false)]
	internal sealed class UnsupportedOSPlatformAttribute : OSPlatformAttribute
	{
		public string? Message { get; }

		public UnsupportedOSPlatformAttribute(string platformName)
			: base(platformName)
		{
		}

		public UnsupportedOSPlatformAttribute(string platformName, string? message)
			: base(platformName)
		{
			Message = message;
		}
	}
	[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface, AllowMultiple = true, Inherited = false)]
	internal sealed class ObsoletedOSPlatformAttribute : OSPlatformAttribute
	{
		public string? Message { get; }

		public string? Url { get; set; }

		public ObsoletedOSPlatformAttribute(string platformName)
			: base(platformName)
		{
		}

		public ObsoletedOSPlatformAttribute(string platformName, string? message)
			: base(platformName)
		{
			Message = message;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = true, Inherited = false)]
	internal sealed class SupportedOSPlatformGuardAttribute : OSPlatformAttribute
	{
		public SupportedOSPlatformGuardAttribute(string platformName)
			: base(platformName)
		{
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = true, Inherited = false)]
	internal sealed class UnsupportedOSPlatformGuardAttribute : OSPlatformAttribute
	{
		public UnsupportedOSPlatformGuardAttribute(string platformName)
			: base(platformName)
		{
		}
	}
}
namespace System.Runtime.InteropServices
{
	[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
	internal sealed class LibraryImportAttribute : Attribute
	{
		public string LibraryName { get; }

		public string? EntryPoint { get; set; }

		public StringMarshalling StringMarshalling { get; set; }

		public Type? StringMarshallingCustomType { get; set; }

		public bool SetLastError { get; set; }

		public LibraryImportAttribute(string libraryName)
		{
			LibraryName = libraryName;
		}
	}
	internal enum StringMarshalling
	{
		Custom,
		Utf8,
		Utf16
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
	internal sealed class CallerArgumentExpressionAttribute : Attribute
	{
		public string ParameterName { get; }

		public CallerArgumentExpressionAttribute(string parameterName)
		{
			ParameterName = parameterName;
		}
	}
}
namespace Microsoft.Extensions.Internal
{
	internal static class NonCapturingTimer
	{
		public static Timer Create(TimerCallback callback, object state, TimeSpan dueTime, TimeSpan period)
		{
			if (callback == null)
			{
				throw new ArgumentNullException("callback");
			}
			bool flag = false;
			try
			{
				if (!ExecutionContext.IsFlowSuppressed())
				{
					ExecutionContext.SuppressFlow();
					flag = true;
				}
				return new Timer(callback, state, dueTime, period);
			}
			finally
			{
				if (flag)
				{
					ExecutionContext.RestoreFlow();
				}
			}
		}
	}
}
namespace Microsoft.Extensions.FileProviders
{
	internal interface IPollingChangeToken : IChangeToken
	{
		CancellationTokenSource? CancellationTokenSource { get; }
	}
	public class PhysicalFileProvider : IFileProvider, IDisposable
	{
		private const string PollingEnvironmentKey = "DOTNET_USE_POLLING_FILE_WATCHER";

		private static readonly char[] _pathSeparators = new char[2]
		{
			Path.DirectorySeparatorChar,
			Path.AltDirectorySeparatorChar
		};

		private readonly ExclusionFilters _filters;

		private readonly Func<PhysicalFilesWatcher> _fileWatcherFactory;

		private PhysicalFilesWatcher _fileWatcher;

		private bool _fileWatcherInitialized;

		private object _fileWatcherLock = new object();

		private bool? _usePollingFileWatcher;

		private bool? _useActivePolling;

		private bool _disposed;

		public bool UsePollingFileWatcher
		{
			get
			{
				if (_fileWatcher != null)
				{
					return false;
				}
				if (!_usePollingFileWatcher.HasValue)
				{
					ReadPollingEnvironmentVariables();
				}
				return _usePollingFileWatcher.GetValueOrDefault();
			}
			set
			{
				if (_fileWatcher != null)
				{
					throw new InvalidOperationException(System.SR.Format(System.SR.CannotModifyWhenFileWatcherInitialized, "UsePollingFileWatcher"));
				}
				_usePollingFileWatcher = value;
			}
		}

		public bool UseActivePolling
		{
			get
			{
				if (!_useActivePolling.HasValue)
				{
					ReadPollingEnvironmentVariables();
				}
				return _useActivePolling.Value;
			}
			set
			{
				_useActivePolling = value;
			}
		}

		internal PhysicalFilesWatcher FileWatcher
		{
			get
			{
				return LazyInitializer.EnsureInitialized(ref _fileWatcher, ref _fileWatcherInitialized, ref _fileWatcherLock, _fileWatcherFactory);
			}
			set
			{
				_fileWatcherInitialized = true;
				_fileWatcher = value;
			}
		}

		public string Root { get; }

		public PhysicalFileProvider(string root)
			: this(root, ExclusionFilters.Sensitive)
		{
		}

		public PhysicalFileProvider(string root, ExclusionFilters filters)
		{
			if (!Path.IsPathRooted(root))
			{
				throw new ArgumentException("The path must be absolute.", "root");
			}
			string fullPath = Path.GetFullPath(root);
			Root = PathUtils.EnsureTrailingSlash(fullPath);
			if (!Directory.Exists(Root))
			{
				throw new DirectoryNotFoundException(Root);
			}
			_filters = filters;
			_fileWatcherFactory = CreateFileWatcher;
		}

		internal PhysicalFilesWatcher CreateFileWatcher()
		{
			string text = PathUtils.EnsureTrailingSlash(Path.GetFullPath(Root));
			FileSystemWatcher fileSystemWatcher = ((UsePollingFileWatcher && UseActivePolling) ? null : new FileSystemWatcher(text));
			return new PhysicalFilesWatcher(text, fileSystemWatcher, UsePollingFileWatcher, _filters)
			{
				UseActivePolling = UseActivePolling
			};
		}

		[MemberNotNull("_usePollingFileWatcher")]
		[MemberNotNull("_useActivePolling")]
		private void ReadPollingEnvironmentVariables()
		{
			string environmentVariable = Environment.GetEnvironmentVariable("DOTNET_USE_POLLING_FILE_WATCHER");
			bool value = string.Equals(environmentVariable, "1", StringComparison.Ordinal) || string.Equals(environmentVariable, "true", StringComparison.OrdinalIgnoreCase);
			_usePollingFileWatcher = value;
			_useActivePolling = value;
		}

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

		protected virtual void Dispose(bool disposing)
		{
			if (!_disposed)
			{
				if (disposing)
				{
					_fileWatcher?.Dispose();
				}
				_disposed = true;
			}
		}

		private string GetFullPath(string path)
		{
			if (PathUtils.PathNavigatesAboveRoot(path))
			{
				return null;
			}
			string fullPath;
			try
			{
				fullPath = Path.GetFullPath(Path.Combine(Root, path));
			}
			catch
			{
				return null;
			}
			if (!IsUnderneathRoot(fullPath))
			{
				return null;
			}
			return fullPath;
		}

		private bool IsUnderneathRoot(string fullPath)
		{
			return fullPath.StartsWith(Root, StringComparison.OrdinalIgnoreCase);
		}

		public IFileInfo GetFileInfo(string subpath)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Expected O, but got Unknown
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Expected O, but got Unknown
			if (string.IsNullOrEmpty(subpath) || PathUtils.HasInvalidPathChars(subpath))
			{
				return (IFileInfo)new NotFoundFileInfo(subpath);
			}
			subpath = subpath.TrimStart(_pathSeparators);
			if (Path.IsPathRooted(subpath))
			{
				return (IFileInfo)new NotFoundFileInfo(subpath);
			}
			string fullPath = GetFullPath(subpath);
			if (fullPath == null)
			{
				return (IFileInfo)new NotFoundFileInfo(subpath);
			}
			FileInfo fileInfo = new FileInfo(fullPath);
			if (FileSystemInfoHelper.IsExcluded(fileInfo, _filters))
			{
				return (IFileInfo)new NotFoundFileInfo(subpath);
			}
			return (IFileInfo)(object)new PhysicalFileInfo(fileInfo);
		}

		public IDirectoryContents GetDirectoryContents(string subpath)
		{
			try
			{
				if (subpath == null || PathUtils.HasInvalidPathChars(subpath))
				{
					return (IDirectoryContents)(object)NotFoundDirectoryContents.Singleton;
				}
				subpath = subpath.TrimStart(_pathSeparators);
				if (Path.IsPathRooted(subpath))
				{
					return (IDirectoryContents)(object)NotFoundDirectoryContents.Singleton;
				}
				string fullPath = GetFullPath(subpath);
				if (fullPath == null || !Directory.Exists(fullPath))
				{
					return (IDirectoryContents)(object)NotFoundDirectoryContents.Singleton;
				}
				return (IDirectoryContents)(object)new PhysicalDirectoryContents(fullPath, _filters);
			}
			catch (DirectoryNotFoundException)
			{
			}
			catch (IOException)
			{
			}
			return (IDirectoryContents)(object)NotFoundDirectoryContents.Singleton;
		}

		public IChangeToken Watch(string filter)
		{
			if (filter == null || PathUtils.HasInvalidFilterChars(filter))
			{
				return (IChangeToken)(object)NullChangeToken.Singleton;
			}
			filter = filter.TrimStart(_pathSeparators);
			return FileWatcher.CreateFileChangeToken(filter);
		}
	}
	internal sealed class EmptyDisposable : IDisposable
	{
		public static EmptyDisposable Instance { get; } = new EmptyDisposable();


		private EmptyDisposable()
		{
		}

		public void Dispose()
		{
		}
	}
}
namespace Microsoft.Extensions.FileProviders.Internal
{
	public class PhysicalDirectoryContents : IDirectoryContents, IEnumerable<IFileInfo>, IEnumerable
	{
		private IEnumerable<IFileInfo> _entries;

		private readonly string _directory;

		private readonly ExclusionFilters _filters;

		public bool Exists => Directory.Exists(_directory);

		public PhysicalDirectoryContents(string directory)
			: this(directory, ExclusionFilters.Sensitive)
		{
		}

		public PhysicalDirectoryContents(string directory, ExclusionFilters filters)
		{
			System.ThrowHelper.ThrowIfNull(directory, "directory");
			_directory = directory;
			_filters = filters;
		}

		public IEnumerator<IFileInfo> GetEnumerator()
		{
			EnsureInitialized();
			return _entries.GetEnumerator();
		}

		IEnumerator IEnumerable.GetEnumerator()
		{
			EnsureInitialized();
			return _entries.GetEnumerator();
		}

		[MemberNotNull("_entries")]
		private void EnsureInitialized()
		{
			try
			{
				_entries = (from info in new DirectoryInfo(_directory).EnumerateFileSystemInfos()
					where !FileSystemInfoHelper.IsExcluded(info, _filters)
					select info).Select((Func<FileSystemInfo, IFileInfo>)delegate(FileSystemInfo info)
				{
					if (info is FileInfo info2)
					{
						return (IFileInfo)(object)new PhysicalFileInfo(info2);
					}
					if (info is DirectoryInfo info3)
					{
						return (IFileInfo)(object)new PhysicalDirectoryInfo(info3);
					}
					throw new InvalidOperationException(System.SR.UnexpectedFileSystemInfo);
				});
			}
			catch (Exception ex) when (ex is DirectoryNotFoundException || ex is IOException)
			{
				_entries = Enumerable.Empty<IFileInfo>();
			}
		}
	}
}
namespace Microsoft.Extensions.FileProviders.Physical
{
	[Flags]
	public enum ExclusionFilters
	{
		Sensitive = 7,
		DotPrefixed = 1,
		Hidden = 2,
		System = 4,
		None = 0
	}
	internal sealed class Clock : IClock
	{
		public static readonly Clock Instance = new Clock();

		public DateTime UtcNow => DateTime.UtcNow;

		private Clock()
		{
		}
	}
	internal static class FileSystemInfoHelper
	{
		public static bool IsExcluded(FileSystemInfo fileSystemInfo, ExclusionFilters filters)
		{
			if (filters == ExclusionFilters.None)
			{
				return false;
			}
			if (fileSystemInfo.Name.StartsWith(".", StringComparison.Ordinal) && (filters & ExclusionFilters.DotPrefixed) != 0)
			{
				return true;
			}
			if (fileSystemInfo.Exists && (((fileSystemInfo.Attributes & FileAttributes.Hidden) != 0 && (filters & ExclusionFilters.Hidden) != 0) || ((fileSystemInfo.Attributes & FileAttributes.System) != 0 && (filters & ExclusionFilters.System) != 0)))
			{
				return true;
			}
			return false;
		}

		public static DateTime? GetFileLinkTargetLastWriteTimeUtc(string filePath)
		{
			return null;
		}

		public static DateTime? GetFileLinkTargetLastWriteTimeUtc(FileInfo fileInfo)
		{
			return null;
		}
	}
	internal interface IClock
	{
		DateTime UtcNow { get; }
	}
	public class PhysicalDirectoryInfo : IFileInfo
	{
		private readonly DirectoryInfo _info;

		public bool Exists => _info.Exists;

		public long Length => -1L;

		public string PhysicalPath => _info.FullName;

		public string Name => _info.Name;

		public DateTimeOffset LastModified => _info.LastWriteTimeUtc;

		public bool IsDirectory => true;

		public PhysicalDirectoryInfo(DirectoryInfo info)
		{
			_info = info;
		}

		public Stream CreateReadStream()
		{
			throw new InvalidOperationException(System.SR.CannotCreateStream);
		}
	}
	public class PhysicalFileInfo : IFileInfo
	{
		private readonly FileInfo _info;

		public bool Exists => _info.Exists;

		public long Length => _info.Length;

		public string PhysicalPath => _info.FullName;

		public string Name => _info.Name;

		public DateTimeOffset LastModified => _info.LastWriteTimeUtc;

		public bool IsDirectory => false;

		public PhysicalFileInfo(FileInfo info)
		{
			_info = info;
		}

		public Stream CreateReadStream()
		{
			int bufferSize = 1;
			return new FileStream(PhysicalPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite, bufferSize, FileOptions.Asynchronous | FileOptions.SequentialScan);
		}
	}
	public class PhysicalFilesWatcher : IDisposable
	{
		private readonly struct ChangeTokenInfo
		{
			public CancellationTokenSource TokenSource { get; }

			public CancellationChangeToken ChangeToken { get; }

			public Matcher Matcher { get; }

			public ChangeTokenInfo(CancellationTokenSource tokenSource, CancellationChangeToken changeToken)
				: this(tokenSource, changeToken, null)
			{
			}

			public ChangeTokenInfo(CancellationTokenSource tokenSource, CancellationChangeToken changeToken, Matcher matcher)
			{
				TokenSource = tokenSource;
				ChangeToken = changeToken;
				Matcher = matcher;
			}
		}

		private static readonly Action<object> _cancelTokenSource = delegate(object state)
		{
			((CancellationTokenSource)state).Cancel();
		};

		internal static TimeSpan DefaultPollingInterval = TimeSpan.FromSeconds(4.0);

		private readonly ConcurrentDictionary<string, ChangeTokenInfo> _filePathTokenLookup = new ConcurrentDictionary<string, ChangeTokenInfo>(StringComparer.OrdinalIgnoreCase);

		private readonly ConcurrentDictionary<string, ChangeTokenInfo> _wildcardTokenLookup = new ConcurrentDictionary<string, ChangeTokenInfo>(StringComparer.OrdinalIgnoreCase);

		private readonly FileSystemWatcher _fileWatcher;

		private readonly object _fileWatcherLock = new object();

		private readonly string _root;

		private readonly ExclusionFilters _filters;

		private Timer _timer;

		private bool _timerInitialized;

		private object _timerLock = new object();

		private Func<Timer> _timerFactory;

		private bool _disposed;

		internal bool PollForChanges { get; }

		internal bool UseActivePolling { get; set; }

		internal ConcurrentDictionary<IPollingChangeToken, IPollingChangeToken> PollingChangeTokens { get; }

		public PhysicalFilesWatcher(string root, FileSystemWatcher? fileSystemWatcher, bool pollForChanges)
			: this(root, fileSystemWatcher, pollForChanges, ExclusionFilters.Sensitive)
		{
		}

		public PhysicalFilesWatcher(string root, FileSystemWatcher? fileSystemWatcher, bool pollForChanges, ExclusionFilters filters)
		{
			if (fileSystemWatcher == null && !pollForChanges)
			{
				throw new ArgumentNullException("fileSystemWatcher", System.SR.Error_FileSystemWatcherRequiredWithoutPolling);
			}
			_root = root;
			if (fileSystemWatcher != null)
			{
				_fileWatcher = fileSystemWatcher;
				_fileWatcher.IncludeSubdirectories = true;
				_fileWatcher.Created += OnChanged;
				_fileWatcher.Changed += OnChanged;
				_fileWatcher.Renamed += OnRenamed;
				_fileWatcher.Deleted += OnChanged;
				_fileWatcher.Error += OnError;
			}
			PollForChanges = pollForChanges;
			_filters = filters;
			PollingChangeTokens = new ConcurrentDictionary<IPollingChangeToken, IPollingChangeToken>();
			_timerFactory = () => NonCapturingTimer.Create(RaiseChangeEvents, PollingChangeTokens, TimeSpan.Zero, DefaultPollingInterval);
		}

		public IChangeToken CreateFileChangeToken(string filter)
		{
			System.ThrowHelper.ThrowIfNull(filter, "filter");
			filter = NormalizePath(filter);
			if (Path.IsPathRooted(filter) || PathUtils.PathNavigatesAboveRoot(filter))
			{
				return (IChangeToken)(object)NullChangeToken.Singleton;
			}
			IChangeToken orAddChangeToken = GetOrAddChangeToken(filter);
			TryEnableFileSystemWatcher();
			return orAddChangeToken;
		}

		private IChangeToken GetOrAddChangeToken(string pattern)
		{
			if (UseActivePolling)
			{
				LazyInitializer.EnsureInitialized(ref _timer, ref _timerInitialized, ref _timerLock, _timerFactory);
			}
			if (pattern.IndexOf('*') != -1 || IsDirectoryPath(pattern))
			{
				return GetOrAddWildcardChangeToken(pattern);
			}
			return GetOrAddFilePathChangeToken(pattern);
		}

		internal IChangeToken GetOrAddFilePathChangeToken(string filePath)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Expected O, but got Unknown
			if (!_filePathTokenLookup.TryGetValue(filePath, out var value))
			{
				CancellationTokenSource cancellationTokenSource = new CancellationTokenSource();
				CancellationChangeToken changeToken = new CancellationChangeToken(cancellationTokenSource.Token);
				value = new ChangeTokenInfo(cancellationTokenSource, changeToken);
				value = _filePathTokenLookup.GetOrAdd(filePath, value);
			}
			IChangeToken val = (IChangeToken)(object)value.ChangeToken;
			if (PollForChanges)
			{
				PollingFileChangeToken pollingFileChangeToken = new PollingFileChangeToken(new FileInfo(Path.Combine(_root, filePath)));
				if (UseActivePolling)
				{
					pollingFileChangeToken.ActiveChangeCallbacks = true;
					pollingFileChangeToken.CancellationTokenSource = new CancellationTokenSource();
					PollingChangeTokens.TryAdd(pollingFileChangeToken, pollingFileChangeToken);
				}
				val = (IChangeToken)new CompositeChangeToken((IReadOnlyList<IChangeToken>)(object)new IChangeToken[2] { val, pollingFileChangeToken });
			}
			return val;
		}

		internal IChangeToken GetOrAddWildcardChangeToken(string pattern)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Expected O, but got Unknown
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Expected O, but got Unknown
			if (!_wildcardTokenLookup.TryGetValue(pattern, out var value))
			{
				CancellationTokenSource cancellationTokenSource = new CancellationTokenSource();
				CancellationChangeToken changeToken = new CancellationChangeToken(cancellationTokenSource.Token);
				Matcher val = new Matcher(StringComparison.OrdinalIgnoreCase);
				val.AddInclude(pattern);
				value = new ChangeTokenInfo(cancellationTokenSource, changeToken, val);
				value = _wildcardTokenLookup.GetOrAdd(pattern, value);
			}
			IChangeToken val2 = (IChangeToken)(object)value.ChangeToken;
			if (PollForChanges)
			{
				PollingWildCardChangeToken pollingWildCardChangeToken = new PollingWildCardChangeToken(_root, pattern);
				if (UseActivePolling)
				{
					pollingWildCardChangeToken.ActiveChangeCallbacks = true;
					pollingWildCardChangeToken.CancellationTokenSource = new CancellationTokenSource();
					PollingChangeTokens.TryAdd(pollingWildCardChangeToken, pollingWildCardChangeToken);
				}
				val2 = (IChangeToken)new CompositeChangeToken((IReadOnlyList<IChangeToken>)(object)new IChangeToken[2] { val2, pollingWildCardChangeToken });
			}
			return val2;
		}

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

		protected virtual void Dispose(bool disposing)
		{
			if (!_disposed)
			{
				if (disposing)
				{
					_fileWatcher?.Dispose();
					_timer?.Dispose();
				}
				_disposed = true;
			}
		}

		[UnsupportedOSPlatform("browser")]
		[UnsupportedOSPlatform("ios")]
		[UnsupportedOSPlatform("tvos")]
		[SupportedOSPlatform("maccatalyst")]
		private void OnRenamed(object sender, RenamedEventArgs e)
		{
			OnFileSystemEntryChange(e.OldFullPath);
			OnFileSystemEntryChange(e.FullPath);
			if (!Directory.Exists(e.FullPath))
			{
				return;
			}
			try
			{
				foreach (string item in Directory.EnumerateFileSystemEntries(e.FullPath, "*", SearchOption.AllDirectories))
				{
					string fullPath = Path.Combine(e.OldFullPath, item.Substring(e.FullPath.Length + 1));
					OnFileSystemEntryChange(fullPath);
					OnFileSystemEntryChange(item);
				}
			}
			catch (Exception ex) when (ex is IOException || ex is SecurityException || ex is DirectoryNotFoundException || ex is UnauthorizedAccessException)
			{
			}
		}

		[UnsupportedOSPlatform("browser")]
		[UnsupportedOSPlatform("ios")]
		[UnsupportedOSPlatform("tvos")]
		[SupportedOSPlatform("maccatalyst")]
		private void OnChanged(object sender, FileSystemEventArgs e)
		{
			OnFileSystemEntryChange(e.FullPath);
		}

		[UnsupportedOSPlatform("browser")]
		[UnsupportedOSPlatform("ios")]
		[UnsupportedOSPlatform("tvos")]
		[SupportedOSPlatform("maccatalyst")]
		private void OnError(object sender, ErrorEventArgs e)
		{
			foreach (string key in _filePathTokenLookup.Keys)
			{
				ReportChangeForMatchedEntries(key);
			}
		}

		[UnsupportedOSPlatform("browser")]
		[UnsupportedOSPlatform("ios")]
		[UnsupportedOSPlatform("tvos")]
		[SupportedOSPlatform("maccatalyst")]
		private void OnFileSystemEntryChange(string fullPath)
		{
			try
			{
				FileInfo fileSystemInfo = new FileInfo(fullPath);
				if (!FileSystemInfoHelper.IsExcluded(fileSystemInfo, _filters))
				{
					string path = fullPath.Substring(_root.Length);
					ReportChangeForMatchedEntries(path);
				}
			}
			catch (Exception ex) when (ex is IOException || ex is SecurityException || ex is UnauthorizedAccessException)
			{
			}
		}

		[UnsupportedOSPlatform("browser")]
		[UnsupportedOSPlatform("ios")]
		[UnsupportedOSPlatform("tvos")]
		[SupportedOSPlatform("maccatalyst")]
		private void ReportChangeForMatchedEntries(string path)
		{
			if (string.IsNullOrEmpty(path))
			{
				return;
			}
			path = NormalizePath(path);
			bool flag = false;
			if (_filePathTokenLookup.TryRemove(path, out var value))
			{
				CancelToken(value);
				flag = true;
			}
			foreach (KeyValuePair<string, ChangeTokenInfo> item in _wildcardTokenLookup)
			{
				PatternMatchingResult val = MatcherExtensions.Match(item.Value.Matcher, path);
				if (val.HasMatches && _wildcardTokenLookup.TryRemove(item.Key, out value))
				{
					CancelToken(value);
					flag = true;
				}
			}
			if (flag)
			{
				TryDisableFileSystemWatcher();
			}
		}

		[UnsupportedOSPlatform("browser")]
		[UnsupportedOSPlatform("ios")]
		[UnsupportedOSPlatform("tvos")]
		[SupportedOSPlatform("maccatalyst")]
		private void TryDisableFileSystemWatcher()
		{
			if (_fileWatcher == null)
			{
				return;
			}
			lock (_fileWatcherLock)
			{
				if (_filePathTokenLookup.IsEmpty && _wildcardTokenLookup.IsEmpty && _fileWatcher.EnableRaisingEvents)
				{
					_fileWatcher.EnableRaisingEvents = false;
				}
			}
		}

		[UnsupportedOSPlatform("browser")]
		[UnsupportedOSPlatform("ios")]
		[UnsupportedOSPlatform("tvos")]
		[SupportedOSPlatform("maccatalyst")]
		private void TryEnableFileSystemWatcher()
		{
			if (_fileWatcher == null)
			{
				return;
			}
			lock (_fileWatcherLock)
			{
				if ((!_filePathTokenLookup.IsEmpty || !_wildcardTokenLookup.IsEmpty) && !_fileWatcher.EnableRaisingEvents)
				{
					_fileWatcher.EnableRaisingEvents = true;
				}
			}
		}

		private static string NormalizePath(string filter)
		{
			return filter.Replace('\\', '/');
		}

		private static bool IsDirectoryPath(string path)
		{
			if (path.Length > 0)
			{
				if (path[path.Length - 1] != Path.DirectorySeparatorChar)
				{
					return path[path.Length - 1] == Path.AltDirectorySeparatorChar;
				}
				return true;
			}
			return false;
		}

		private static void CancelToken(ChangeTokenInfo matchInfo)
		{
			if (!matchInfo.TokenSource.IsCancellationRequested)
			{
				Task.Factory.StartNew(_cancelTokenSource, matchInfo.TokenSource, CancellationToken.None, TaskCreationOptions.DenyChildAttach, TaskScheduler.Default);
			}
		}

		internal static void RaiseChangeEvents(object? state)
		{
			ConcurrentDictionary<IPollingChangeToken, IPollingChangeToken> concurrentDictionary = (ConcurrentDictionary<IPollingChangeToken, IPollingChangeToken>)state;
			foreach (KeyValuePair<IPollingChangeToken, IPollingChangeToken> item in concurrentDictionary)
			{
				IPollingChangeToken key = item.Key;
				if (((IChangeToken)key).HasChanged && concurrentDictionary.TryRemove(key, out var _))
				{
					try
					{
						key.CancellationTokenSource.Cancel();
					}
					catch
					{
					}
				}
			}
		}
	}
	public class PollingFileChangeToken : IPollingChangeToken, IChangeToken
	{
		private readonly FileInfo _fileInfo;

		private DateTime _previousWriteTimeUtc;

		private DateTime _lastCheckedTimeUtc;

		private bool _hasChanged;

		private CancellationTokenSource _tokenSource;

		private CancellationChangeToken _changeToken;

		internal static TimeSpan PollingInterval { get; set; } = PhysicalFilesWatcher.DefaultPollingInterval;


		public bool ActiveChangeCallbacks { get; internal set; }

		internal CancellationTokenSource? CancellationTokenSource
		{
			get
			{
				return _tokenSource;
			}
			[param: DisallowNull]
			set
			{
				//IL_0013: Unknown result type (might be due to invalid IL or missing references)
				//IL_001d: Expected O, but got Unknown
				_tokenSource = value;
				_changeToken = new CancellationChangeToken(_tokenSource.Token);
			}
		}

		CancellationTokenSource? IPollingChangeToken.CancellationTokenSource => CancellationTokenSource;

		public bool HasChanged
		{
			get
			{
				if (_hasChanged)
				{
					return _hasChanged;
				}
				DateTime utcNow = DateTime.UtcNow;
				if (utcNow - _lastCheckedTimeUtc < PollingInterval)
				{
					return _hasChanged;
				}
				DateTime lastWriteTimeUtc = GetLastWriteTimeUtc();
				if (_previousWriteTimeUtc != lastWriteTimeUtc)
				{
					_previousWriteTimeUtc = lastWriteTimeUtc;
					_hasChanged = true;
				}
				_lastCheckedTimeUtc = utcNow;
				return _hasChanged;
			}
		}

		public PollingFileChangeToken(FileInfo fileInfo)
		{
			_fileInfo = fileInfo;
			_previousWriteTimeUtc = GetLastWriteTimeUtc();
		}

		private DateTime GetLastWriteTimeUtc()
		{
			_fileInfo.Refresh();
			if (!_fileInfo.Exists)
			{
				return DateTime.MinValue;
			}
			return FileSystemInfoHelper.GetFileLinkTargetLastWriteTimeUtc(_fileInfo) ?? _fileInfo.LastWriteTimeUtc;
		}

		public IDisposable RegisterChangeCallback(Action<object?> callback, object? state)
		{
			if (!ActiveChangeCallbacks)
			{
				return EmptyDisposable.Instance;
			}
			return _changeToken.RegisterChangeCallback(callback, state);
		}
	}
	public class PollingWildCardChangeToken : IPollingChangeToken, IChangeToken
	{
		private static readonly byte[] Separator = Encoding.Unicode.GetBytes("|");

		private readonly object _enumerationLock = new object();

		private readonly DirectoryInfoBase _directoryInfo;

		private readonly Matcher _matcher;

		private bool _changed;

		private DateTime? _lastScanTimeUtc;

		private byte[] _byteBuffer;

		private byte[] _previousHash;

		private CancellationTokenSource _tokenSource;

		private CancellationChangeToken _changeToken;

		public bool ActiveChangeCallbacks { get; internal set; }

		internal TimeSpan PollingInterval { get; set; } = PhysicalFilesWatcher.DefaultPollingInterval;


		internal CancellationTokenSource? CancellationTokenSource
		{
			get
			{
				return _tokenSource;
			}
			[param: DisallowNull]
			set
			{
				//IL_0013: Unknown result type (might be due to invalid IL or missing references)
				//IL_001d: Expected O, but got Unknown
				_tokenSource = value;
				_changeToken = new CancellationChangeToken(_tokenSource.Token);
			}
		}

		CancellationTokenSource? IPollingChangeToken.CancellationTokenSource => CancellationTokenSource;

		private IClock Clock { get; }

		public bool HasChanged
		{
			get
			{
				if (_changed)
				{
					return _changed;
				}
				DateTime utcNow = Clock.UtcNow;
				DateTime? lastScanTimeUtc = _lastScanTimeUtc;
				if (utcNow - lastScanTimeUtc >= PollingInterval)
				{
					lock (_enumerationLock)
					{
						_changed = CalculateChanges();
					}
				}
				return _changed;
			}
		}

		public PollingWildCardChangeToken(string root, string pattern)
			: this((DirectoryInfoBase)new DirectoryInfoWrapper(new DirectoryInfo(root)), pattern, Microsoft.Extensions.FileProviders.Physical.Clock.Instance)
		{
		}//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: Expected O, but got Unknown


		internal PollingWildCardChangeToken(DirectoryInfoBase directoryInfo, string pattern, IClock clock)
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			_directoryInfo = directoryInfo;
			Clock = clock;
			_matcher = new Matcher(StringComparison.OrdinalIgnoreCase);
			_matcher.AddInclude(pattern);
			CalculateChanges();
		}

		private bool CalculateChanges()
		{
			//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)
			PatternMatchingResult val = _matcher.Execute(_directoryInfo);
			IOrderedEnumerable<FilePatternMatch> orderedEnumerable = val.Files.OrderBy<FilePatternMatch, string>((FilePatternMatch f) => ((FilePatternMatch)(ref f)).Path, StringComparer.Ordinal);
			using (IncrementalHash incrementalHash = IncrementalHash.CreateHash(HashAlgorithmName.SHA256))
			{
				foreach (FilePatternMatch item in orderedEnumerable)
				{
					FilePatternMatch current = item;
					DateTime lastWriteUtc = GetLastWriteUtc(((FilePatternMatch)(ref current)).Path);
					if (_lastScanTimeUtc.HasValue && _lastScanTimeUtc < lastWriteUtc)
					{
						return true;
					}
					ComputeHash(incrementalHash, ((FilePatternMatch)(ref current)).Path, lastWriteUtc);
				}
				byte[] hashAndReset = incrementalHash.GetHashAndReset();
				if (!ArrayEquals(_previousHash, hashAndReset))
				{
					return true;
				}
				_previousHash = hashAndReset;
				_lastScanTimeUtc = Clock.UtcNow;
			}
			return false;
		}

		protected virtual DateTime GetLastWriteUtc(string path)
		{
			string text = Path.Combine(((FileSystemInfoBase)_directoryInfo).FullName, path);
			return FileSystemInfoHelper.GetFileLinkTargetLastWriteTimeUtc(text) ?? File.GetLastWriteTimeUtc(text);
		}

		private static bool ArrayEquals(byte[] previousHash, byte[] currentHash)
		{
			return previousHash?.AsSpan().SequenceEqual(currentHash.AsSpan()) ?? true;
		}

		private unsafe void ComputeHash(IncrementalHash sha256, string path, DateTime lastChangedUtc)
		{
			int byteCount = Encoding.Unicode.GetByteCount(path);
			if (_byteBuffer == null || byteCount > _byteBuffer.Length)
			{
				_byteBuffer = new byte[Math.Max(byteCount, 256)];
			}
			int bytes = Encoding.Unicode.GetBytes(path, 0, path.Length, _byteBuffer, 0);
			sha256.AppendData(_byteBuffer, 0, bytes);
			sha256.AppendData(Separator, 0, Separator.Length);
			fixed (byte* ptr = _byteBuffer)
			{
				*(long*)ptr = lastChangedUtc.Ticks;
			}
			sha256.AppendData(_byteBuffer, 0, 8);
			sha256.AppendData(Separator, 0, Separator.Length);
		}

		IDisposable IChangeToken.RegisterChangeCallback(Action<object> callback, object state)
		{
			if (!ActiveChangeCallbacks)
			{
				return EmptyDisposable.Instance;
			}
			return _changeToken.RegisterChangeCallback(callback, state);
		}
	}
}
namespace Microsoft.Extensions.FileProviders.Physical.Internal
{
	internal static class PathUtils
	{
		private static readonly char[] _invalidFileNameChars = (from c in Path.GetInvalidFileNameChars()
			where c != Path.DirectorySeparatorChar && c != Path.AltDirectorySeparatorChar
			select c).ToArray();

		private static readonly char[] _invalidFilterChars = _invalidFileNameChars.Where((char c) => c != '*' && c != '|' && c != '?').ToArray();

		private static readonly char[] _pathSeparators = new char[2]
		{
			Path.DirectorySeparatorChar,
			Path.AltDirectorySeparatorChar
		};

		internal static bool HasInvalidPathChars(string path)
		{
			return path.IndexOfAny(_invalidFileNameChars) != -1;
		}

		internal static bool HasInvalidFilterChars(string path)
		{
			return path.IndexOfAny(_invalidFilterChars) != -1;
		}

		internal static string EnsureTrailingSlash(string path)
		{
			if (!string.IsNullOrEmpty(path) && path[path.Length - 1] != Path.DirectorySeparatorChar)
			{
				char directorySeparatorChar = Path.DirectorySeparatorChar;
				return path + directorySeparatorChar;
			}
			return path;
		}

		internal static bool PathNavigatesAboveRoot(string path)
		{
			//IL_0011: 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)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			StringTokenizer val = default(StringTokenizer);
			((StringTokenizer)(ref val))..ctor(path, _pathSeparators);
			int num = 0;
			Enumerator enumerator = ((StringTokenizer)(ref val)).GetEnumerator();
			try
			{
				while (((Enumerator)(ref enumerator)).MoveNext())
				{
					StringSegment current = ((Enumerator)(ref enumerator)).Current;
					if (((StringSegment)(ref current)).Equals(".") || ((StringSegment)(ref current)).Equals(""))
					{
						continue;
					}
					if (((StringSegment)(ref current)).Equals(".."))
					{
						num--;
						if (num == -1)
						{
							return true;
						}
					}
					else
					{
						num++;
					}
				}
			}
			finally
			{
				((IDisposable)(Enumerator)(ref enumerator)).Dispose();
			}
			return false;
		}
	}
}

BepInEx/plugins/SlopCrew.Plugin/Microsoft.Extensions.FileSystemGlobbing.dll

Decompiled 8 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Linq;
using System.Numerics.Hashing;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using FxResources.Microsoft.Extensions.FileSystemGlobbing;
using Microsoft.CodeAnalysis;
using Microsoft.Extensions.FileSystemGlobbing.Abstractions;
using Microsoft.Extensions.FileSystemGlobbing.Internal;
using Microsoft.Extensions.FileSystemGlobbing.Internal.PathSegments;
using Microsoft.Extensions.FileSystemGlobbing.Internal.PatternContexts;
using Microsoft.Extensions.FileSystemGlobbing.Internal.Patterns;
using Microsoft.Extensions.FileSystemGlobbing.Util;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: InternalsVisibleTo("Microsoft.Extensions.FileSystemGlobbing.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: AssemblyMetadata(".NETFrameworkAssembly", "")]
[assembly: AssemblyMetadata("Serviceable", "True")]
[assembly: AssemblyMetadata("PreferInbox", "True")]
[assembly: AssemblyDefaultAlias("Microsoft.Extensions.FileSystemGlobbing")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: CLSCompliant(true)]
[assembly: AssemblyMetadata("IsTrimmable", "True")]
[assembly: DefaultDllImportSearchPaths(DllImportSearchPath.System32 | DllImportSearchPath.AssemblyDirectory)]
[assembly: AssemblyCompany("Microsoft Corporation")]
[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")]
[assembly: AssemblyDescription("File system globbing to find files matching a specified pattern.")]
[assembly: AssemblyFileVersion("7.0.22.51805")]
[assembly: AssemblyInformationalVersion("7.0.0+d099f075e45d2aa6007a22b71b45a08758559f80")]
[assembly: AssemblyProduct("Microsoft® .NET")]
[assembly: AssemblyTitle("Microsoft.Extensions.FileSystemGlobbing")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/dotnet/runtime")]
[assembly: AssemblyVersion("7.0.0.0")]
[module: RefSafetyRules(11)]
[module: System.Runtime.CompilerServices.NullablePublicOnly(true)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class IsReadOnlyAttribute : Attribute
	{
	}
	[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 NullablePublicOnlyAttribute : Attribute
	{
		public readonly bool IncludesInternals;

		public NullablePublicOnlyAttribute(bool P_0)
		{
			IncludesInternals = 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 FxResources.Microsoft.Extensions.FileSystemGlobbing
{
	internal static class SR
	{
	}
}
namespace System
{
	internal static class ThrowHelper
	{
		internal static void ThrowIfNull(object? argument, [CallerArgumentExpression("argument")] string? paramName = null)
		{
			if (argument == null)
			{
				Throw(paramName);
			}
		}

		private static void Throw(string paramName)
		{
			throw new ArgumentNullException(paramName);
		}
	}
	internal static class SR
	{
		private static readonly bool s_usingResourceKeys = AppContext.TryGetSwitch("System.Resources.UseSystemResourceKeys", out var isEnabled) && isEnabled;

		private static ResourceManager s_resourceManager;

		internal static ResourceManager ResourceManager => s_resourceManager ?? (s_resourceManager = new ResourceManager(typeof(SR)));

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

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

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

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

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

		private static bool UsingResourceKeys()
		{
			return s_usingResourceKeys;
		}

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

		internal static string GetResourceString(string resourceKey, string defaultString)
		{
			string resourceString = GetResourceString(resourceKey);
			if (!(resourceKey == resourceString) && resourceString != null)
			{
				return resourceString;
			}
			return defaultString;
		}

		internal static string Format(string resourceFormat, object? p1)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1);
			}
			return string.Format(resourceFormat, p1);
		}

		internal static string Format(string resourceFormat, object? p1, object? p2)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2);
			}
			return string.Format(resourceFormat, p1, p2);
		}

		internal static string Format(string resourceFormat, object? p1, object? p2, object? p3)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2, p3);
			}
			return string.Format(resourceFormat, p1, p2, p3);
		}

		internal static string Format(string resourceFormat, params object?[]? args)
		{
			if (args != null)
			{
				if (UsingResourceKeys())
				{
					return resourceFormat + ", " + string.Join(", ", args);
				}
				return string.Format(resourceFormat, args);
			}
			return resourceFormat;
		}

		internal static string Format(IFormatProvider? provider, string resourceFormat, object? p1)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1);
			}
			return string.Format(provider, resourceFormat, p1);
		}

		internal static string Format(IFormatProvider? provider, string resourceFormat, object? p1, object? p2)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2);
			}
			return string.Format(provider, resourceFormat, p1, p2);
		}

		internal static string Format(IFormatProvider? provider, string resourceFormat, object? p1, object? p2, object? p3)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2, p3);
			}
			return string.Format(provider, resourceFormat, p1, p2, p3);
		}

		internal static string Format(IFormatProvider? provider, string resourceFormat, params object?[]? args)
		{
			if (args != null)
			{
				if (UsingResourceKeys())
				{
					return resourceFormat + ", " + string.Join(", ", args);
				}
				return string.Format(provider, resourceFormat, args);
			}
			return resourceFormat;
		}
	}
}
namespace System.Diagnostics.CodeAnalysis
{
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)]
	internal sealed class AllowNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)]
	internal sealed class DisallowNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)]
	internal sealed class MaybeNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)]
	internal sealed class NotNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class MaybeNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public MaybeNullWhenAttribute(bool returnValue)
		{
			ReturnValue = returnValue;
		}
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class NotNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public NotNullWhenAttribute(bool returnValue)
		{
			ReturnValue = returnValue;
		}
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = true, Inherited = false)]
	internal sealed class NotNullIfNotNullAttribute : Attribute
	{
		public string ParameterName { get; }

		public NotNullIfNotNullAttribute(string parameterName)
		{
			ParameterName = parameterName;
		}
	}
	[AttributeUsage(AttributeTargets.Method, Inherited = false)]
	internal sealed class DoesNotReturnAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class DoesNotReturnIfAttribute : Attribute
	{
		public bool ParameterValue { get; }

		public DoesNotReturnIfAttribute(bool parameterValue)
		{
			ParameterValue = parameterValue;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	internal sealed class MemberNotNullAttribute : Attribute
	{
		public string[] Members { get; }

		public MemberNotNullAttribute(string member)
		{
			Members = new string[1] { member };
		}

		public MemberNotNullAttribute(params string[] members)
		{
			Members = members;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	internal sealed class MemberNotNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public string[] Members { get; }

		public MemberNotNullWhenAttribute(bool returnValue, string member)
		{
			ReturnValue = returnValue;
			Members = new string[1] { member };
		}

		public MemberNotNullWhenAttribute(bool returnValue, params string[] members)
		{
			ReturnValue = returnValue;
			Members = members;
		}
	}
}
namespace System.Runtime.InteropServices
{
	[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
	internal sealed class LibraryImportAttribute : Attribute
	{
		public string LibraryName { get; }

		public string? EntryPoint { get; set; }

		public StringMarshalling StringMarshalling { get; set; }

		public Type? StringMarshallingCustomType { get; set; }

		public bool SetLastError { get; set; }

		public LibraryImportAttribute(string libraryName)
		{
			LibraryName = libraryName;
		}
	}
	internal enum StringMarshalling
	{
		Custom,
		Utf8,
		Utf16
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
	internal sealed class CallerArgumentExpressionAttribute : Attribute
	{
		public string ParameterName { get; }

		public CallerArgumentExpressionAttribute(string parameterName)
		{
			ParameterName = parameterName;
		}
	}
}
namespace System.Numerics.Hashing
{
	internal static class HashHelpers
	{
		public static int Combine(int h1, int h2)
		{
			uint num = (uint)(h1 << 5) | ((uint)h1 >> 27);
			return ((int)num + h1) ^ h2;
		}
	}
}
namespace Microsoft.Extensions.FileSystemGlobbing
{
	public struct FilePatternMatch : IEquatable<FilePatternMatch>
	{
		public string Path { get; }

		public string? Stem { get; }

		public FilePatternMatch(string path, string? stem)
		{
			System.ThrowHelper.ThrowIfNull(path, "path");
			Path = path;
			Stem = stem;
		}

		public bool Equals(FilePatternMatch other)
		{
			if (string.Equals(other.Path, Path, StringComparison.OrdinalIgnoreCase))
			{
				return string.Equals(other.Stem, Stem, StringComparison.OrdinalIgnoreCase);
			}
			return false;
		}

		public override bool Equals([NotNullWhen(true)] object? obj)
		{
			if (obj is FilePatternMatch other)
			{
				return Equals(other);
			}
			return false;
		}

		public override int GetHashCode()
		{
			return HashHelpers.Combine(GetHashCode(Path), GetHashCode(Stem));
		}

		private static int GetHashCode(string value)
		{
			if (value == null)
			{
				return 0;
			}
			return StringComparer.OrdinalIgnoreCase.GetHashCode(value);
		}
	}
	public class InMemoryDirectoryInfo : DirectoryInfoBase
	{
		private static readonly char[] DirectorySeparators = new char[2]
		{
			Path.DirectorySeparatorChar,
			Path.AltDirectorySeparatorChar
		};

		private readonly IEnumerable<string> _files;

		public override string FullName { get; }

		public override string Name { get; }

		public override DirectoryInfoBase? ParentDirectory => new InMemoryDirectoryInfo(Path.GetDirectoryName(FullName), _files, normalized: true);

		public InMemoryDirectoryInfo(string rootDir, IEnumerable<string>? files)
			: this(rootDir, files, normalized: false)
		{
		}

		private InMemoryDirectoryInfo(string rootDir, IEnumerable<string> files, bool normalized)
		{
			if (string.IsNullOrEmpty(rootDir))
			{
				throw new ArgumentNullException("rootDir");
			}
			if (files == null)
			{
				files = new List<string>();
			}
			Name = Path.GetFileName(rootDir);
			if (normalized)
			{
				_files = files;
				FullName = rootDir;
				return;
			}
			List<string> list = new List<string>(files.Count());
			foreach (string file in files)
			{
				list.Add(Path.GetFullPath(file.Replace(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar)));
			}
			_files = list;
			FullName = Path.GetFullPath(rootDir.Replace(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar));
		}

		public override IEnumerable<FileSystemInfoBase> EnumerateFileSystemInfos()
		{
			Dictionary<string, List<string>> dict = new Dictionary<string, List<string>>();
			foreach (string file in _files)
			{
				if (!IsRootDirectory(FullName, file))
				{
					continue;
				}
				int length = file.Length;
				int num = FullName.Length + 1;
				int num2 = file.IndexOfAny(DirectorySeparators, num, length - num);
				if (num2 == -1)
				{
					yield return new InMemoryFileInfo(file, this);
					continue;
				}
				string key = file.Substring(0, num2);
				if (!dict.TryGetValue(key, out var value))
				{
					dict[key] = new List<string> { file };
				}
				else
				{
					value.Add(file);
				}
			}
			foreach (KeyValuePair<string, List<string>> item in dict)
			{
				yield return new InMemoryDirectoryInfo(item.Key, item.Value, normalized: true);
			}
		}

		private static bool IsRootDirectory(string rootDir, string filePath)
		{
			int length = rootDir.Length;
			if (filePath.StartsWith(rootDir, StringComparison.Ordinal))
			{
				if (rootDir[length - 1] != Path.DirectorySeparatorChar)
				{
					return filePath.IndexOf(Path.DirectorySeparatorChar, length) == length;
				}
				return true;
			}
			return false;
		}

		public override DirectoryInfoBase GetDirectory(string path)
		{
			if (string.Equals(path, "..", StringComparison.Ordinal))
			{
				return new InMemoryDirectoryInfo(Path.Combine(FullName, path), _files, normalized: true);
			}
			string fullPath = Path.GetFullPath(path.Replace(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar));
			return new InMemoryDirectoryInfo(fullPath, _files, normalized: true);
		}

		public override FileInfoBase? GetFile(string path)
		{
			string fullPath = Path.GetFullPath(path.Replace(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar));
			foreach (string file in _files)
			{
				if (string.Equals(file, fullPath))
				{
					return new InMemoryFileInfo(file, this);
				}
			}
			return null;
		}
	}
	public class Matcher
	{
		private readonly IList<IPattern> _includePatterns = new List<IPattern>();

		private readonly IList<IPattern> _excludePatterns = new List<IPattern>();

		private readonly PatternBuilder _builder;

		private readonly StringComparison _comparison;

		public Matcher()
			: this(StringComparison.OrdinalIgnoreCase)
		{
		}

		public Matcher(StringComparison comparisonType)
		{
			_comparison = comparisonType;
			_builder = new PatternBuilder(comparisonType);
		}

		public virtual Matcher AddInclude(string pattern)
		{
			_includePatterns.Add(_builder.Build(pattern));
			return this;
		}

		public virtual Matcher AddExclude(string pattern)
		{
			_excludePatterns.Add(_builder.Build(pattern));
			return this;
		}

		public virtual PatternMatchingResult Execute(DirectoryInfoBase directoryInfo)
		{
			System.ThrowHelper.ThrowIfNull(directoryInfo, "directoryInfo");
			MatcherContext matcherContext = new MatcherContext(_includePatterns, _excludePatterns, directoryInfo, _comparison);
			return matcherContext.Execute();
		}
	}
	public static class MatcherExtensions
	{
		public static void AddExcludePatterns(this Matcher matcher, params IEnumerable<string>[] excludePatternsGroups)
		{
			foreach (IEnumerable<string> enumerable in excludePatternsGroups)
			{
				foreach (string item in enumerable)
				{
					matcher.AddExclude(item);
				}
			}
		}

		public static void AddIncludePatterns(this Matcher matcher, params IEnumerable<string>[] includePatternsGroups)
		{
			foreach (IEnumerable<string> enumerable in includePatternsGroups)
			{
				foreach (string item in enumerable)
				{
					matcher.AddInclude(item);
				}
			}
		}

		public static IEnumerable<string> GetResultsInFullPath(this Matcher matcher, string directoryPath)
		{
			string directoryPath2 = directoryPath;
			IEnumerable<FilePatternMatch> files = matcher.Execute(new DirectoryInfoWrapper(new DirectoryInfo(directoryPath2))).Files;
			return files.Select((FilePatternMatch match) => Path.GetFullPath(Path.Combine(directoryPath2, match.Path))).ToArray();
		}

		public static PatternMatchingResult Match(this Matcher matcher, string file)
		{
			return matcher.Match(Directory.GetCurrentDirectory(), new List<string> { file });
		}

		public static PatternMatchingResult Match(this Matcher matcher, string rootDir, string file)
		{
			return matcher.Match(rootDir, new List<string> { file });
		}

		public static PatternMatchingResult Match(this Matcher matcher, IEnumerable<string>? files)
		{
			return matcher.Match(Directory.GetCurrentDirectory(), files);
		}

		public static PatternMatchingResult Match(this Matcher matcher, string rootDir, IEnumerable<string>? files)
		{
			System.ThrowHelper.ThrowIfNull(matcher, "matcher");
			return matcher.Execute(new InMemoryDirectoryInfo(rootDir, files));
		}
	}
	public class PatternMatchingResult
	{
		public IEnumerable<FilePatternMatch> Files { get; set; }

		public bool HasMatches { get; }

		public PatternMatchingResult(IEnumerable<FilePatternMatch> files)
			: this(files, files.Any())
		{
			Files = files;
		}

		public PatternMatchingResult(IEnumerable<FilePatternMatch> files, bool hasMatches)
		{
			System.ThrowHelper.ThrowIfNull(files, "files");
			Files = files;
			HasMatches = hasMatches;
		}
	}
}
namespace Microsoft.Extensions.FileSystemGlobbing.Util
{
	internal static class StringComparisonHelper
	{
		public static StringComparer GetStringComparer(StringComparison comparisonType)
		{
			return comparisonType switch
			{
				StringComparison.CurrentCulture => StringComparer.CurrentCulture, 
				StringComparison.CurrentCultureIgnoreCase => StringComparer.CurrentCultureIgnoreCase, 
				StringComparison.Ordinal => StringComparer.Ordinal, 
				StringComparison.OrdinalIgnoreCase => StringComparer.OrdinalIgnoreCase, 
				StringComparison.InvariantCulture => StringComparer.InvariantCulture, 
				StringComparison.InvariantCultureIgnoreCase => StringComparer.InvariantCultureIgnoreCase, 
				_ => throw new InvalidOperationException(System.SR.Format(System.SR.UnexpectedStringComparisonType, comparisonType)), 
			};
		}
	}
}
namespace Microsoft.Extensions.FileSystemGlobbing.Internal
{
	public interface ILinearPattern : IPattern
	{
		IList<IPathSegment> Segments { get; }
	}
	internal sealed class InMemoryFileInfo : FileInfoBase
	{
		private InMemoryDirectoryInfo _parent;

		public override string FullName { get; }

		public override string Name { get; }

		public override DirectoryInfoBase ParentDirectory => _parent;

		public InMemoryFileInfo(string file, InMemoryDirectoryInfo parent)
		{
			FullName = file;
			Name = Path.GetFileName(file);
			_parent = parent;
		}
	}
	public interface IPathSegment
	{
		bool CanProduceStem { get; }

		bool Match(string value);
	}
	public interface IPattern
	{
		IPatternContext CreatePatternContextForInclude();

		IPatternContext CreatePatternContextForExclude();
	}
	public interface IPatternContext
	{
		void Declare(Action<IPathSegment, bool> onDeclare);

		bool Test(DirectoryInfoBase directory);

		PatternTestResult Test(FileInfoBase file);

		void PushDirectory(DirectoryInfoBase directory);

		void PopDirectory();
	}
	public interface IRaggedPattern : IPattern
	{
		IList<IPathSegment> Segments { get; }

		IList<IPathSegment> StartsWith { get; }

		IList<IList<IPathSegment>> Contains { get; }

		IList<IPathSegment> EndsWith { get; }
	}
	public class MatcherContext
	{
		private readonly DirectoryInfoBase _root;

		private readonly List<IPatternContext> _includePatternContexts;

		private readonly List<IPatternContext> _excludePatternContexts;

		private readonly List<FilePatternMatch> _files;

		private readonly HashSet<string> _declaredLiteralFolderSegmentInString;

		private readonly HashSet<LiteralPathSegment> _declaredLiteralFileSegments = new HashSet<LiteralPathSegment>();

		private bool _declaredParentPathSegment;

		private bool _declaredWildcardPathSegment;

		private readonly StringComparison _comparisonType;

		public MatcherContext(IEnumerable<IPattern> includePatterns, IEnumerable<IPattern> excludePatterns, DirectoryInfoBase directoryInfo, StringComparison comparison)
		{
			_root = directoryInfo;
			_files = new List<FilePatternMatch>();
			_comparisonType = comparison;
			_includePatternContexts = includePatterns.Select((IPattern pattern) => pattern.CreatePatternContextForInclude()).ToList();
			_excludePatternContexts = excludePatterns.Select((IPattern pattern) => pattern.CreatePatternContextForExclude()).ToList();
			_declaredLiteralFolderSegmentInString = new HashSet<string>(StringComparisonHelper.GetStringComparer(comparison));
		}

		public PatternMatchingResult Execute()
		{
			_files.Clear();
			Match(_root, null);
			return new PatternMatchingResult(_files, _files.Count > 0);
		}

		private void Match(DirectoryInfoBase directory, string parentRelativePath)
		{
			PushDirectory(directory);
			Declare();
			List<FileSystemInfoBase> list = new List<FileSystemInfoBase>();
			if (_declaredWildcardPathSegment || _declaredLiteralFileSegments.Any())
			{
				list.AddRange(directory.EnumerateFileSystemInfos());
			}
			else
			{
				IEnumerable<DirectoryInfoBase> enumerable = directory.EnumerateFileSystemInfos().OfType<DirectoryInfoBase>();
				foreach (DirectoryInfoBase item in enumerable)
				{
					if (_declaredLiteralFolderSegmentInString.Contains(item.Name))
					{
						list.Add(item);
					}
				}
			}
			if (_declaredParentPathSegment)
			{
				list.Add(directory.GetDirectory(".."));
			}
			List<DirectoryInfoBase> list2 = new List<DirectoryInfoBase>();
			foreach (FileSystemInfoBase item2 in list)
			{
				if (item2 is FileInfoBase fileInfoBase)
				{
					PatternTestResult patternTestResult = MatchPatternContexts(fileInfoBase, (IPatternContext pattern, FileInfoBase file) => pattern.Test(file));
					if (patternTestResult.IsSuccessful)
					{
						_files.Add(new FilePatternMatch(CombinePath(parentRelativePath, fileInfoBase.Name), patternTestResult.Stem));
					}
				}
				else if (item2 is DirectoryInfoBase directoryInfoBase && MatchPatternContexts(directoryInfoBase, (IPatternContext pattern, DirectoryInfoBase dir) => pattern.Test(dir)))
				{
					list2.Add(directoryInfoBase);
				}
			}
			foreach (DirectoryInfoBase item3 in list2)
			{
				string parentRelativePath2 = CombinePath(parentRelativePath, item3.Name);
				Match(item3, parentRelativePath2);
			}
			PopDirectory();
		}

		private void Declare()
		{
			_declaredLiteralFileSegments.Clear();
			_declaredParentPathSegment = false;
			_declaredWildcardPathSegment = false;
			foreach (IPatternContext includePatternContext in _includePatternContexts)
			{
				includePatternContext.Declare(DeclareInclude);
			}
		}

		private void DeclareInclude(IPathSegment patternSegment, bool isLastSegment)
		{
			if (patternSegment is LiteralPathSegment literalPathSegment)
			{
				if (isLastSegment)
				{
					_declaredLiteralFileSegments.Add(literalPathSegment);
				}
				else
				{
					_declaredLiteralFolderSegmentInString.Add(literalPathSegment.Value);
				}
			}
			else if (patternSegment is ParentPathSegment)
			{
				_declaredParentPathSegment = true;
			}
			else if (patternSegment is WildcardPathSegment)
			{
				_declaredWildcardPathSegment = true;
			}
		}

		internal static string CombinePath(string? left, string right)
		{
			if (string.IsNullOrEmpty(left))
			{
				return right;
			}
			return left + "/" + right;
		}

		private bool MatchPatternContexts<TFileInfoBase>(TFileInfoBase fileinfo, Func<IPatternContext, TFileInfoBase, bool> test)
		{
			return MatchPatternContexts(fileinfo, (IPatternContext ctx, TFileInfoBase file) => test(ctx, file) ? PatternTestResult.Success(string.Empty) : PatternTestResult.Failed).IsSuccessful;
		}

		private PatternTestResult MatchPatternContexts<TFileInfoBase>(TFileInfoBase fileinfo, Func<IPatternContext, TFileInfoBase, PatternTestResult> test)
		{
			PatternTestResult result = PatternTestResult.Failed;
			foreach (IPatternContext includePatternContext in _includePatternContexts)
			{
				PatternTestResult patternTestResult = test(includePatternContext, fileinfo);
				if (patternTestResult.IsSuccessful)
				{
					result = patternTestResult;
					break;
				}
			}
			if (!result.IsSuccessful)
			{
				return PatternTestResult.Failed;
			}
			foreach (IPatternContext excludePatternContext in _excludePatternContexts)
			{
				if (test(excludePatternContext, fileinfo).IsSuccessful)
				{
					return PatternTestResult.Failed;
				}
			}
			return result;
		}

		private void PopDirectory()
		{
			foreach (IPatternContext excludePatternContext in _excludePatternContexts)
			{
				excludePatternContext.PopDirectory();
			}
			foreach (IPatternContext includePatternContext in _includePatternContexts)
			{
				includePatternContext.PopDirectory();
			}
		}

		private void PushDirectory(DirectoryInfoBase directory)
		{
			foreach (IPatternContext includePatternContext in _includePatternContexts)
			{
				includePatternContext.PushDirectory(directory);
			}
			foreach (IPatternContext excludePatternContext in _excludePatternContexts)
			{
				excludePatternContext.PushDirectory(directory);
			}
		}
	}
	public struct PatternTestResult
	{
		public static readonly PatternTestResult Failed = new PatternTestResult(isSuccessful: false, null);

		public bool IsSuccessful { get; }

		public string? Stem { get; }

		private PatternTestResult(bool isSuccessful, string stem)
		{
			IsSuccessful = isSuccessful;
			Stem = stem;
		}

		public static PatternTestResult Success(string? stem)
		{
			return new PatternTestResult(isSuccessful: true, stem);
		}
	}
}
namespace Microsoft.Extensions.FileSystemGlobbing.Internal.Patterns
{
	public class PatternBuilder
	{
		private sealed class LinearPattern : ILinearPattern, IPattern
		{
			public IList<IPathSegment> Segments { get; }

			public LinearPattern(List<IPathSegment> allSegments)
			{
				Segments = allSegments;
			}

			public IPatternContext CreatePatternContextForInclude()
			{
				return new PatternContextLinearInclude(this);
			}

			public IPatternContext CreatePatternContextForExclude()
			{
				return new PatternContextLinearExclude(this);
			}
		}

		private sealed class RaggedPattern : IRaggedPattern, IPattern
		{
			public IList<IList<IPathSegment>> Contains { get; }

			public IList<IPathSegment> EndsWith { get; }

			public IList<IPathSegment> Segments { get; }

			public IList<IPathSegment> StartsWith { get; }

			public RaggedPattern(List<IPathSegment> allSegments, IList<IPathSegment> segmentsPatternStartsWith, IList<IPathSegment> segmentsPatternEndsWith, IList<IList<IPathSegment>> segmentsPatternContains)
			{
				Segments = allSegments;
				StartsWith = segmentsPatternStartsWith;
				Contains = segmentsPatternContains;
				EndsWith = segmentsPatternEndsWith;
			}

			public IPatternContext CreatePatternContextForInclude()
			{
				return new PatternContextRaggedInclude(this);
			}

			public IPatternContext CreatePatternContextForExclude()
			{
				return new PatternContextRaggedExclude(this);
			}
		}

		private static readonly char[] _slashes = new char[2] { '/', '\\' };

		private static readonly char[] _star = new char[1] { '*' };

		public StringComparison ComparisonType { get; }

		public PatternBuilder()
		{
			ComparisonType = StringComparison.OrdinalIgnoreCase;
		}

		public PatternBuilder(StringComparison comparisonType)
		{
			ComparisonType = comparisonType;
		}

		public IPattern Build(string pattern)
		{
			System.ThrowHelper.ThrowIfNull(pattern, "pattern");
			pattern = pattern.TrimStart(_slashes);
			if (pattern.TrimEnd(_slashes).Length < pattern.Length)
			{
				pattern = pattern.TrimEnd(_slashes) + "/**";
			}
			List<IPathSegment> list = new List<IPathSegment>();
			bool flag = true;
			IList<IPathSegment> list2 = null;
			IList<IList<IPathSegment>> list3 = null;
			IList<IPathSegment> list4 = null;
			int length = pattern.Length;
			int num = 0;
			while (num < length)
			{
				int num2 = num;
				int num3 = NextIndex(pattern, _slashes, num, length);
				IPathSegment pathSegment = null;
				if (pathSegment == null && num3 - num2 == 3 && pattern[num2] == '*' && pattern[num2 + 1] == '.' && pattern[num2 + 2] == '*')
				{
					num2 += 2;
				}
				if (pathSegment == null && num3 - num2 == 2)
				{
					if (pattern[num2] == '*' && pattern[num2 + 1] == '*')
					{
						pathSegment = new RecursiveWildcardSegment();
					}
					else if (pattern[num2] == '.' && pattern[num2 + 1] == '.')
					{
						if (!flag)
						{
							throw new ArgumentException("\"..\" can be only added at the beginning of the pattern.");
						}
						pathSegment = new ParentPathSegment();
					}
				}
				if (pathSegment == null && num3 - num2 == 1 && pattern[num2] == '.')
				{
					pathSegment = new CurrentPathSegment();
				}
				if (pathSegment == null && num3 - num2 > 2 && pattern[num2] == '*' && pattern[num2 + 1] == '*' && pattern[num2 + 2] == '.')
				{
					pathSegment = new RecursiveWildcardSegment();
					num3 = num2;
				}
				if (pathSegment == null)
				{
					string beginsWith = string.Empty;
					List<string> list5 = new List<string>();
					string endsWith = string.Empty;
					int num4 = num2;
					while (num4 < num3)
					{
						int num5 = num4;
						int num6 = NextIndex(pattern, _star, num4, num3);
						if (num5 == num2)
						{
							if (num6 == num3)
							{
								pathSegment = new LiteralPathSegment(Portion(pattern, num5, num6), ComparisonType);
							}
							else
							{
								beginsWith = Portion(pattern, num5, num6);
							}
						}
						else if (num6 == num3)
						{
							endsWith = Portion(pattern, num5, num6);
						}
						else if (num5 != num6)
						{
							list5.Add(Portion(pattern, num5, num6));
						}
						num4 = num6 + 1;
					}
					if (pathSegment == null)
					{
						pathSegment = new WildcardPathSegment(beginsWith, list5, endsWith, ComparisonType);
					}
				}
				if (!(pathSegment is ParentPathSegment))
				{
					flag = false;
				}
				if (!(pathSegment is CurrentPathSegment))
				{
					if (pathSegment is RecursiveWildcardSegment)
					{
						if (list2 == null)
						{
							list2 = new List<IPathSegment>(list);
							list4 = new List<IPathSegment>();
							list3 = new List<IList<IPathSegment>>();
						}
						else if (list4.Count != 0)
						{
							list3.Add(list4);
							list4 = new List<IPathSegment>();
						}
					}
					else
					{
						list4?.Add(pathSegment);
					}
					list.Add(pathSegment);
				}
				num = num3 + 1;
			}
			if (list2 == null)
			{
				return new LinearPattern(list);
			}
			return new RaggedPattern(list, list2, list4, list3);
		}

		private static int NextIndex(string pattern, char[] anyOf, int beginIndex, int endIndex)
		{
			int num = pattern.IndexOfAny(anyOf, beginIndex, endIndex - beginIndex);
			if (num != -1)
			{
				return num;
			}
			return endIndex;
		}

		private static string Portion(string pattern, int beginIndex, int endIndex)
		{
			return pattern.Substring(beginIndex, endIndex - beginIndex);
		}
	}
}
namespace Microsoft.Extensions.FileSystemGlobbing.Internal.PatternContexts
{
	public abstract class PatternContext<TFrame> : IPatternContext where TFrame : struct
	{
		private Stack<TFrame> _stack = new Stack<TFrame>();

		protected TFrame Frame;

		public virtual void Declare(Action<IPathSegment, bool> declare)
		{
		}

		public abstract PatternTestResult Test(FileInfoBase file);

		public abstract bool Test(DirectoryInfoBase directory);

		public abstract void PushDirectory(DirectoryInfoBase directory);

		public virtual void PopDirectory()
		{
			Frame = _stack.Pop();
		}

		protected void PushDataFrame(TFrame frame)
		{
			_stack.Push(Frame);
			Frame = frame;
		}

		protected bool IsStackEmpty()
		{
			return _stack.Count == 0;
		}
	}
	public abstract class PatternContextLinear : PatternContext<PatternContextLinear.FrameData>
	{
		public struct FrameData
		{
			public bool IsNotApplicable;

			public int SegmentIndex;

			public bool InStem;

			private IList<string> _stemItems;

			public IList<string> StemItems => _stemItems ?? (_stemItems = new List<string>());

			public string? Stem
			{
				get
				{
					if (_stemItems != null)
					{
						return string.Join("/", _stemItems);
					}
					return null;
				}
			}
		}

		protected ILinearPattern Pattern { get; }

		public PatternContextLinear(ILinearPattern pattern)
		{
			System.ThrowHelper.ThrowIfNull(pattern, "pattern");
			Pattern = pattern;
		}

		public override PatternTestResult Test(FileInfoBase file)
		{
			if (IsStackEmpty())
			{
				throw new InvalidOperationException(System.SR.CannotTestFile);
			}
			if (!Frame.IsNotApplicable && IsLastSegment() && TestMatchingSegment(file.Name))
			{
				return PatternTestResult.Success(CalculateStem(file));
			}
			return PatternTestResult.Failed;
		}

		public override void PushDirectory(DirectoryInfoBase directory)
		{
			FrameData frame = Frame;
			if (!IsStackEmpty() && !Frame.IsNotApplicable)
			{
				if (!TestMatchingSegment(directory.Name))
				{
					frame.IsNotApplicable = true;
				}
				else
				{
					IPathSegment pathSegment = Pattern.Segments[Frame.SegmentIndex];
					if (frame.InStem || pathSegment.CanProduceStem)
					{
						frame.InStem = true;
						frame.StemItems.Add(directory.Name);
					}
					frame.SegmentIndex++;
				}
			}
			PushDataFrame(frame);
		}

		protected bool IsLastSegment()
		{
			return Frame.SegmentIndex == Pattern.Segments.Count - 1;
		}

		protected bool TestMatchingSegment(string value)
		{
			if (Frame.SegmentIndex >= Pattern.Segments.Count)
			{
				return false;
			}
			return Pattern.Segments[Frame.SegmentIndex].Match(value);
		}

		protected string CalculateStem(FileInfoBase matchedFile)
		{
			return MatcherContext.CombinePath(Frame.Stem, matchedFile.Name);
		}
	}
	public class PatternContextLinearExclude : PatternContextLinear
	{
		public PatternContextLinearExclude(ILinearPattern pattern)
			: base(pattern)
		{
		}

		public override bool Test(DirectoryInfoBase directory)
		{
			if (IsStackEmpty())
			{
				throw new InvalidOperationException(System.SR.CannotTestDirectory);
			}
			if (Frame.IsNotApplicable)
			{
				return false;
			}
			if (IsLastSegment())
			{
				return TestMatchingSegment(directory.Name);
			}
			return false;
		}
	}
	public class PatternContextLinearInclude : PatternContextLinear
	{
		public PatternContextLinearInclude(ILinearPattern pattern)
			: base(pattern)
		{
		}

		public override void Declare(Action<IPathSegment, bool> onDeclare)
		{
			if (IsStackEmpty())
			{
				throw new InvalidOperationException(System.SR.CannotDeclarePathSegment);
			}
			if (!Frame.IsNotApplicable && Frame.SegmentIndex < base.Pattern.Segments.Count)
			{
				onDeclare(base.Pattern.Segments[Frame.SegmentIndex], IsLastSegment());
			}
		}

		public override bool Test(DirectoryInfoBase directory)
		{
			if (IsStackEmpty())
			{
				throw new InvalidOperationException(System.SR.CannotTestDirectory);
			}
			if (Frame.IsNotApplicable)
			{
				return false;
			}
			if (!IsLastSegment())
			{
				return TestMatchingSegment(directory.Name);
			}
			return false;
		}
	}
	public abstract class PatternContextRagged : PatternContext<PatternContextRagged.FrameData>
	{
		public struct FrameData
		{
			public bool IsNotApplicable;

			public int SegmentGroupIndex;

			public IList<IPathSegment> SegmentGroup;

			public int BacktrackAvailable;

			public int SegmentIndex;

			public bool InStem;

			private IList<string> _stemItems;

			public IList<string> StemItems => _stemItems ?? (_stemItems = new List<string>());

			public string? Stem
			{
				get
				{
					if (_stemItems != null)
					{
						return string.Join("/", _stemItems);
					}
					return null;
				}
			}
		}

		protected IRaggedPattern Pattern { get; }

		public PatternContextRagged(IRaggedPattern pattern)
		{
			System.ThrowHelper.ThrowIfNull(pattern, "pattern");
			Pattern = pattern;
		}

		public override PatternTestResult Test(FileInfoBase file)
		{
			if (IsStackEmpty())
			{
				throw new InvalidOperationException(System.SR.CannotTestFile);
			}
			if (!Frame.IsNotApplicable && IsEndingGroup() && TestMatchingGroup(file))
			{
				return PatternTestResult.Success(CalculateStem(file));
			}
			return PatternTestResult.Failed;
		}

		public sealed override void PushDirectory(DirectoryInfoBase directory)
		{
			FrameData frame = Frame;
			if (IsStackEmpty())
			{
				frame.SegmentGroupIndex = -1;
				frame.SegmentGroup = Pattern.StartsWith;
			}
			else if (!Frame.IsNotApplicable)
			{
				if (IsStartingGroup())
				{
					if (!TestMatchingSegment(directory.Name))
					{
						frame.IsNotApplicable = true;
					}
					else
					{
						frame.SegmentIndex++;
					}
				}
				else if (!IsStartingGroup() && directory.Name == "..")
				{
					frame.IsNotApplicable = true;
				}
				else if (!IsStartingGroup() && !IsEndingGroup() && TestMatchingGroup(directory))
				{
					frame.SegmentIndex = Frame.SegmentGroup.Count;
					frame.BacktrackAvailable = 0;
				}
				else
				{
					frame.BacktrackAvailable++;
				}
			}
			if (frame.InStem)
			{
				frame.StemItems.Add(directory.Name);
			}
			while (frame.SegmentIndex == frame.SegmentGroup.Count && frame.SegmentGroupIndex != Pattern.Contains.Count)
			{
				frame.SegmentGroupIndex++;
				frame.SegmentIndex = 0;
				if (frame.SegmentGroupIndex < Pattern.Contains.Count)
				{
					frame.SegmentGroup = Pattern.Contains[frame.SegmentGroupIndex];
				}
				else
				{
					frame.SegmentGroup = Pattern.EndsWith;
				}
				frame.InStem = true;
			}
			PushDataFrame(frame);
		}

		public override void PopDirectory()
		{
			base.PopDirectory();
			if (Frame.StemItems.Count > 0)
			{
				Frame.StemItems.RemoveAt(Frame.StemItems.Count - 1);
			}
		}

		protected bool IsStartingGroup()
		{
			return Frame.SegmentGroupIndex == -1;
		}

		protected bool IsEndingGroup()
		{
			return Frame.SegmentGroupIndex == Pattern.Contains.Count;
		}

		protected bool TestMatchingSegment(string value)
		{
			if (Frame.SegmentIndex >= Frame.SegmentGroup.Count)
			{
				return false;
			}
			return Frame.SegmentGroup[Frame.SegmentIndex].Match(value);
		}

		protected bool TestMatchingGroup(FileSystemInfoBase value)
		{
			int count = Frame.SegmentGroup.Count;
			int num = Frame.BacktrackAvailable + 1;
			if (num < count)
			{
				return false;
			}
			FileSystemInfoBase fileSystemInfoBase = value;
			for (int i = 0; i != count; i++)
			{
				IPathSegment pathSegment = Frame.SegmentGroup[count - i - 1];
				if (fileSystemInfoBase == null || !pathSegment.Match(fileSystemInfoBase.Name))
				{
					return false;
				}
				fileSystemInfoBase = fileSystemInfoBase.ParentDirectory;
			}
			return true;
		}

		protected string CalculateStem(FileInfoBase matchedFile)
		{
			return MatcherContext.CombinePath(Frame.Stem, matchedFile.Name);
		}
	}
	public class PatternContextRaggedExclude : PatternContextRagged
	{
		public PatternContextRaggedExclude(IRaggedPattern pattern)
			: base(pattern)
		{
		}

		public override bool Test(DirectoryInfoBase directory)
		{
			if (IsStackEmpty())
			{
				throw new InvalidOperationException(System.SR.CannotTestDirectory);
			}
			if (Frame.IsNotApplicable)
			{
				return false;
			}
			if (IsEndingGroup() && TestMatchingGroup(directory))
			{
				return true;
			}
			if (base.Pattern.EndsWith.Count == 0 && Frame.SegmentGroupIndex == base.Pattern.Contains.Count - 1 && TestMatchingGroup(directory))
			{
				return true;
			}
			return false;
		}
	}
	public class PatternContextRaggedInclude : PatternContextRagged
	{
		public PatternContextRaggedInclude(IRaggedPattern pattern)
			: base(pattern)
		{
		}

		public override void Declare(Action<IPathSegment, bool> onDeclare)
		{
			if (IsStackEmpty())
			{
				throw new InvalidOperationException(System.SR.CannotDeclarePathSegment);
			}
			if (!Frame.IsNotApplicable)
			{
				if (IsStartingGroup() && Frame.SegmentIndex < Frame.SegmentGroup.Count)
				{
					onDeclare(Frame.SegmentGroup[Frame.SegmentIndex], arg2: false);
				}
				else
				{
					onDeclare(WildcardPathSegment.MatchAll, arg2: false);
				}
			}
		}

		public override bool Test(DirectoryInfoBase directory)
		{
			if (IsStackEmpty())
			{
				throw new InvalidOperationException(System.SR.CannotTestDirectory);
			}
			if (Frame.IsNotApplicable)
			{
				return false;
			}
			if (IsStartingGroup() && !TestMatchingSegment(directory.Name))
			{
				return false;
			}
			return true;
		}
	}
}
namespace Microsoft.Extensions.FileSystemGlobbing.Internal.PathSegments
{
	public class CurrentPathSegment : IPathSegment
	{
		public bool CanProduceStem => false;

		public bool Match(string value)
		{
			return false;
		}
	}
	public class LiteralPathSegment : IPathSegment
	{
		private readonly StringComparison _comparisonType;

		public bool CanProduceStem => false;

		public string Value { get; }

		public LiteralPathSegment(string value, StringComparison comparisonType)
		{
			System.ThrowHelper.ThrowIfNull(value, "value");
			Value = value;
			_comparisonType = comparisonType;
		}

		public bool Match(string value)
		{
			return string.Equals(Value, value, _comparisonType);
		}

		public override bool Equals([NotNullWhen(true)] object? obj)
		{
			if (obj is LiteralPathSegment literalPathSegment && _comparisonType == literalPathSegment._comparisonType)
			{
				return string.Equals(literalPathSegment.Value, Value, _comparisonType);
			}
			return false;
		}

		public override int GetHashCode()
		{
			return StringComparisonHelper.GetStringComparer(_comparisonType).GetHashCode(Value);
		}
	}
	public class ParentPathSegment : IPathSegment
	{
		private const string LiteralParent = "..";

		public bool CanProduceStem => false;

		public bool Match(string value)
		{
			return string.Equals("..", value, StringComparison.Ordinal);
		}
	}
	public class RecursiveWildcardSegment : IPathSegment
	{
		public bool CanProduceStem => true;

		public bool Match(string value)
		{
			return false;
		}
	}
	public class WildcardPathSegment : IPathSegment
	{
		public static readonly WildcardPathSegment MatchAll = new WildcardPathSegment(string.Empty, new List<string>(), string.Empty, StringComparison.OrdinalIgnoreCase);

		private readonly StringComparison _comparisonType;

		public bool CanProduceStem => true;

		public string BeginsWith { get; }

		public List<string> Contains { get; }

		public string EndsWith { get; }

		public WildcardPathSegment(string beginsWith, List<string> contains, string endsWith, StringComparison comparisonType)
		{
			System.ThrowHelper.ThrowIfNull(beginsWith, "beginsWith");
			System.ThrowHelper.ThrowIfNull(contains, "contains");
			System.ThrowHelper.ThrowIfNull(endsWith, "endsWith");
			if ((uint)(comparisonType - 4) > 1u)
			{
				throw new InvalidOperationException(System.SR.Format(System.SR.StringComparisonTypeShouldBeOrdinal, comparisonType));
			}
			_comparisonType = comparisonType;
			BeginsWith = beginsWith;
			Contains = contains;
			EndsWith = endsWith;
		}

		public bool Match(string value)
		{
			if (value.Length < BeginsWith.Length + EndsWith.Length)
			{
				return false;
			}
			if (!value.StartsWith(BeginsWith, _comparisonType))
			{
				return false;
			}
			if (!value.EndsWith(EndsWith, _comparisonType))
			{
				return false;
			}
			int num = BeginsWith.Length;
			int num2 = value.Length - EndsWith.Length;
			for (int i = 0; i != Contains.Count; i++)
			{
				string text = Contains[i];
				int num3 = value.IndexOf(text, num, num2 - num, _comparisonType);
				if (num3 == -1)
				{
					return false;
				}
				num = num3 + text.Length;
			}
			return true;
		}
	}
}
namespace Microsoft.Extensions.FileSystemGlobbing.Abstractions
{
	public abstract class DirectoryInfoBase : FileSystemInfoBase
	{
		public abstract IEnumerable<FileSystemInfoBase> EnumerateFileSystemInfos();

		public abstract DirectoryInfoBase? GetDirectory(string path);

		public abstract FileInfoBase? GetFile(string path);
	}
	public class DirectoryInfoWrapper : DirectoryInfoBase
	{
		private readonly DirectoryInfo _directoryInfo;

		private readonly bool _isParentPath;

		public override string Name
		{
			get
			{
				if (!_isParentPath)
				{
					return _directoryInfo.Name;
				}
				return "..";
			}
		}

		public override string FullName => _directoryInfo.FullName;

		public override DirectoryInfoBase? ParentDirectory => new DirectoryInfoWrapper(_directoryInfo.Parent);

		public DirectoryInfoWrapper(DirectoryInfo directoryInfo)
			: this(directoryInfo, isParentPath: false)
		{
		}

		private DirectoryInfoWrapper(DirectoryInfo directoryInfo, bool isParentPath)
		{
			_directoryInfo = directoryInfo;
			_isParentPath = isParentPath;
		}

		public override IEnumerable<FileSystemInfoBase> EnumerateFileSystemInfos()
		{
			if (!_directoryInfo.Exists)
			{
				yield break;
			}
			IEnumerable<FileSystemInfo> enumerable;
			try
			{
				enumerable = _directoryInfo.EnumerateFileSystemInfos("*", SearchOption.TopDirectoryOnly);
			}
			catch (DirectoryNotFoundException)
			{
				yield break;
			}
			foreach (FileSystemInfo item in enumerable)
			{
				if (item is DirectoryInfo directoryInfo)
				{
					yield return new DirectoryInfoWrapper(directoryInfo);
				}
				else
				{
					yield return new FileInfoWrapper((FileInfo)item);
				}
			}
		}

		public override DirectoryInfoBase? GetDirectory(string name)
		{
			bool flag = string.Equals(name, "..", StringComparison.Ordinal);
			if (flag)
			{
				return new DirectoryInfoWrapper(new DirectoryInfo(Path.Combine(_directoryInfo.FullName, name)), flag);
			}
			DirectoryInfo[] directories = _directoryInfo.GetDirectories(name);
			if (directories.Length == 1)
			{
				return new DirectoryInfoWrapper(directories[0], flag);
			}
			if (directories.Length == 0)
			{
				return null;
			}
			throw new InvalidOperationException("More than one sub directories are found under " + _directoryInfo.FullName + " with name " + name + ".");
		}

		public override FileInfoBase GetFile(string name)
		{
			return new FileInfoWrapper(new FileInfo(Path.Combine(_directoryInfo.FullName, name)));
		}
	}
	public abstract class FileInfoBase : FileSystemInfoBase
	{
	}
	public class FileInfoWrapper : FileInfoBase
	{
		private readonly FileInfo _fileInfo;

		public override string Name => _fileInfo.Name;

		public override string FullName => _fileInfo.FullName;

		public override DirectoryInfoBase? ParentDirectory => new DirectoryInfoWrapper(_fileInfo.Directory);

		public FileInfoWrapper(FileInfo fileInfo)
		{
			System.ThrowHelper.ThrowIfNull(fileInfo, "fileInfo");
			_fileInfo = fileInfo;
		}
	}
	public abstract class FileSystemInfoBase
	{
		public abstract string Name { get; }

		public abstract string FullName { get; }

		public abstract DirectoryInfoBase? ParentDirectory { get; }
	}
}

BepInEx/plugins/SlopCrew.Plugin/Microsoft.Extensions.Hosting.Abstractions.dll

Decompiled 8 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Runtime.Versioning;
using System.Threading;
using System.Threading.Tasks;
using FxResources.Microsoft.Extensions.Hosting.Abstractions;
using Microsoft.CodeAnalysis;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.Extensions.FileProviders;
using Microsoft.Extensions.Hosting;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: AssemblyMetadata(".NETFrameworkAssembly", "")]
[assembly: AssemblyMetadata("Serviceable", "True")]
[assembly: AssemblyMetadata("PreferInbox", "True")]
[assembly: AssemblyDefaultAlias("Microsoft.Extensions.Hosting.Abstractions")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: CLSCompliant(true)]
[assembly: AssemblyMetadata("IsTrimmable", "True")]
[assembly: DefaultDllImportSearchPaths(DllImportSearchPath.System32 | DllImportSearchPath.AssemblyDirectory)]
[assembly: AssemblyCompany("Microsoft Corporation")]
[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")]
[assembly: AssemblyDescription("Hosting and startup abstractions for applications.")]
[assembly: AssemblyFileVersion("7.0.22.51805")]
[assembly: AssemblyInformationalVersion("7.0.0+d099f075e45d2aa6007a22b71b45a08758559f80")]
[assembly: AssemblyProduct("Microsoft® .NET")]
[assembly: AssemblyTitle("Microsoft.Extensions.Hosting.Abstractions")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/dotnet/runtime")]
[assembly: AssemblyVersion("7.0.0.0")]
[module: RefSafetyRules(11)]
[module: System.Runtime.CompilerServices.NullablePublicOnly(false)]
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 NullablePublicOnlyAttribute : Attribute
	{
		public readonly bool IncludesInternals;

		public NullablePublicOnlyAttribute(bool P_0)
		{
			IncludesInternals = 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 FxResources.Microsoft.Extensions.Hosting.Abstractions
{
	internal static class SR
	{
	}
}
namespace System
{
	internal static class ThrowHelper
	{
		internal static void ThrowIfNull(object argument, [CallerArgumentExpression("argument")] string paramName = null)
		{
			if (argument == null)
			{
				Throw(paramName);
			}
		}

		private static void Throw(string paramName)
		{
			throw new ArgumentNullException(paramName);
		}
	}
	internal static class SR
	{
		private static readonly bool s_usingResourceKeys = AppContext.TryGetSwitch("System.Resources.UseSystemResourceKeys", out var isEnabled) && isEnabled;

		private static ResourceManager s_resourceManager;

		internal static ResourceManager ResourceManager => s_resourceManager ?? (s_resourceManager = new ResourceManager(typeof(SR)));

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

		private static bool UsingResourceKeys()
		{
			return s_usingResourceKeys;
		}

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

		internal static string GetResourceString(string resourceKey, string defaultString)
		{
			string resourceString = GetResourceString(resourceKey);
			if (!(resourceKey == resourceString) && resourceString != null)
			{
				return resourceString;
			}
			return defaultString;
		}

		internal static string Format(string resourceFormat, object p1)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1);
			}
			return string.Format(resourceFormat, p1);
		}

		internal static string Format(string resourceFormat, object p1, object p2)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2);
			}
			return string.Format(resourceFormat, p1, p2);
		}

		internal static string Format(string resourceFormat, object p1, object p2, object p3)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2, p3);
			}
			return string.Format(resourceFormat, p1, p2, p3);
		}

		internal static string Format(string resourceFormat, params object[] args)
		{
			if (args != null)
			{
				if (UsingResourceKeys())
				{
					return resourceFormat + ", " + string.Join(", ", args);
				}
				return string.Format(resourceFormat, args);
			}
			return resourceFormat;
		}

		internal static string Format(IFormatProvider provider, string resourceFormat, object p1)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1);
			}
			return string.Format(provider, resourceFormat, p1);
		}

		internal static string Format(IFormatProvider provider, string resourceFormat, object p1, object p2)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2);
			}
			return string.Format(provider, resourceFormat, p1, p2);
		}

		internal static string Format(IFormatProvider provider, string resourceFormat, object p1, object p2, object p3)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2, p3);
			}
			return string.Format(provider, resourceFormat, p1, p2, p3);
		}

		internal static string Format(IFormatProvider provider, string resourceFormat, params object[] args)
		{
			if (args != null)
			{
				if (UsingResourceKeys())
				{
					return resourceFormat + ", " + string.Join(", ", args);
				}
				return string.Format(provider, resourceFormat, args);
			}
			return resourceFormat;
		}
	}
}
namespace System.Diagnostics.CodeAnalysis
{
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Interface | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, Inherited = false)]
	internal sealed class DynamicallyAccessedMembersAttribute : Attribute
	{
		public DynamicallyAccessedMemberTypes MemberTypes { get; }

		public DynamicallyAccessedMembersAttribute(DynamicallyAccessedMemberTypes memberTypes)
		{
			MemberTypes = memberTypes;
		}
	}
	[Flags]
	internal enum DynamicallyAccessedMemberTypes
	{
		None = 0,
		PublicParameterlessConstructor = 1,
		PublicConstructors = 3,
		NonPublicConstructors = 4,
		PublicMethods = 8,
		NonPublicMethods = 0x10,
		PublicFields = 0x20,
		NonPublicFields = 0x40,
		PublicNestedTypes = 0x80,
		NonPublicNestedTypes = 0x100,
		PublicProperties = 0x200,
		NonPublicProperties = 0x400,
		PublicEvents = 0x800,
		NonPublicEvents = 0x1000,
		Interfaces = 0x2000,
		All = -1
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)]
	internal sealed class AllowNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)]
	internal sealed class DisallowNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)]
	internal sealed class MaybeNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)]
	internal sealed class NotNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class MaybeNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public MaybeNullWhenAttribute(bool returnValue)
		{
			ReturnValue = returnValue;
		}
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class NotNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public NotNullWhenAttribute(bool returnValue)
		{
			ReturnValue = returnValue;
		}
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = true, Inherited = false)]
	internal sealed class NotNullIfNotNullAttribute : Attribute
	{
		public string ParameterName { get; }

		public NotNullIfNotNullAttribute(string parameterName)
		{
			ParameterName = parameterName;
		}
	}
	[AttributeUsage(AttributeTargets.Method, Inherited = false)]
	internal sealed class DoesNotReturnAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class DoesNotReturnIfAttribute : Attribute
	{
		public bool ParameterValue { get; }

		public DoesNotReturnIfAttribute(bool parameterValue)
		{
			ParameterValue = parameterValue;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	internal sealed class MemberNotNullAttribute : Attribute
	{
		public string[] Members { get; }

		public MemberNotNullAttribute(string member)
		{
			Members = new string[1] { member };
		}

		public MemberNotNullAttribute(params string[] members)
		{
			Members = members;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	internal sealed class MemberNotNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public string[] Members { get; }

		public MemberNotNullWhenAttribute(bool returnValue, string member)
		{
			ReturnValue = returnValue;
			Members = new string[1] { member };
		}

		public MemberNotNullWhenAttribute(bool returnValue, params string[] members)
		{
			ReturnValue = returnValue;
			Members = members;
		}
	}
}
namespace System.Runtime.InteropServices
{
	[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
	internal sealed class LibraryImportAttribute : Attribute
	{
		public string LibraryName { get; }

		public string EntryPoint { get; set; }

		public StringMarshalling StringMarshalling { get; set; }

		public Type StringMarshallingCustomType { get; set; }

		public bool SetLastError { get; set; }

		public LibraryImportAttribute(string libraryName)
		{
			LibraryName = libraryName;
		}
	}
	internal enum StringMarshalling
	{
		Custom,
		Utf8,
		Utf16
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
	internal sealed class CallerArgumentExpressionAttribute : Attribute
	{
		public string ParameterName { get; }

		public CallerArgumentExpressionAttribute(string parameterName)
		{
			ParameterName = parameterName;
		}
	}
}
namespace Microsoft.Extensions.DependencyInjection
{
	public static class ServiceCollectionHostedServiceExtensions
	{
		public static IServiceCollection AddHostedService<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] THostedService>(this IServiceCollection services) where THostedService : class, IHostedService
		{
			ServiceCollectionDescriptorExtensions.TryAddEnumerable(services, ServiceDescriptor.Singleton<IHostedService, THostedService>());
			return services;
		}

		public static IServiceCollection AddHostedService<THostedService>(this IServiceCollection services, Func<IServiceProvider, THostedService> implementationFactory) where THostedService : class, IHostedService
		{
			ServiceCollectionDescriptorExtensions.TryAddEnumerable(services, ServiceDescriptor.Singleton<IHostedService>((Func<IServiceProvider, IHostedService>)implementationFactory));
			return services;
		}
	}
}
namespace Microsoft.Extensions.Hosting
{
	public abstract class BackgroundService : IHostedService, IDisposable
	{
		private Task _executeTask;

		private CancellationTokenSource _stoppingCts;

		public virtual Task? ExecuteTask => _executeTask;

		protected abstract Task ExecuteAsync(CancellationToken stoppingToken);

		public virtual Task StartAsync(CancellationToken cancellationToken)
		{
			_stoppingCts = CancellationTokenSource.CreateLinkedTokenSource(new CancellationToken[1] { cancellationToken });
			_executeTask = ExecuteAsync(_stoppingCts.Token);
			if (_executeTask.IsCompleted)
			{
				return _executeTask;
			}
			return Task.CompletedTask;
		}

		public virtual async Task StopAsync(CancellationToken cancellationToken)
		{
			if (_executeTask != null)
			{
				try
				{
					_stoppingCts.Cancel();
				}
				finally
				{
					await Task.WhenAny(new Task[2]
					{
						_executeTask,
						Task.Delay(-1, cancellationToken)
					}).ConfigureAwait(continueOnCapturedContext: false);
				}
			}
		}

		public virtual void Dispose()
		{
			_stoppingCts?.Cancel();
		}
	}
	[Obsolete("EnvironmentName has been deprecated. Use Microsoft.Extensions.Hosting.Environments instead.")]
	public static class EnvironmentName
	{
		public static readonly string Development = "Development";

		public static readonly string Staging = "Staging";

		public static readonly string Production = "Production";
	}
	public static class Environments
	{
		public static readonly string Development = "Development";

		public static readonly string Staging = "Staging";

		public static readonly string Production = "Production";
	}
	[Serializable]
	public sealed class HostAbortedException : Exception
	{
		private HostAbortedException(SerializationInfo info, StreamingContext context)
			: base(info, context)
		{
		}

		public HostAbortedException()
			: base(System.SR.HostAbortedExceptionMessage)
		{
		}

		public HostAbortedException(string? message)
			: base(message)
		{
		}

		public HostAbortedException(string? message, Exception? innerException)
			: base(message, innerException)
		{
		}
	}
	public class HostBuilderContext
	{
		public IHostEnvironment HostingEnvironment { get; set; }

		public IConfiguration Configuration { get; set; }

		public IDictionary<object, object> Properties { get; }

		public HostBuilderContext(IDictionary<object, object> properties)
		{
			System.ThrowHelper.ThrowIfNull(properties, "properties");
			Properties = properties;
		}
	}
	public static class HostDefaults
	{
		public static readonly string ApplicationKey = "applicationName";

		public static readonly string EnvironmentKey = "environment";

		public static readonly string ContentRootKey = "contentRoot";
	}
	public static class HostEnvironmentEnvExtensions
	{
		public static bool IsDevelopment(this IHostEnvironment hostEnvironment)
		{
			System.ThrowHelper.ThrowIfNull(hostEnvironment, "hostEnvironment");
			return hostEnvironment.IsEnvironment(Environments.Development);
		}

		public static bool IsStaging(this IHostEnvironment hostEnvironment)
		{
			System.ThrowHelper.ThrowIfNull(hostEnvironment, "hostEnvironment");
			return hostEnvironment.IsEnvironment(Environments.Staging);
		}

		public static bool IsProduction(this IHostEnvironment hostEnvironment)
		{
			System.ThrowHelper.ThrowIfNull(hostEnvironment, "hostEnvironment");
			return hostEnvironment.IsEnvironment(Environments.Production);
		}

		public static bool IsEnvironment(this IHostEnvironment hostEnvironment, string environmentName)
		{
			System.ThrowHelper.ThrowIfNull(hostEnvironment, "hostEnvironment");
			return string.Equals(hostEnvironment.EnvironmentName, environmentName, StringComparison.OrdinalIgnoreCase);
		}
	}
	public static class HostingAbstractionsHostBuilderExtensions
	{
		public static IHost Start(this IHostBuilder hostBuilder)
		{
			return hostBuilder.StartAsync().GetAwaiter().GetResult();
		}

		public static async Task<IHost> StartAsync(this IHostBuilder hostBuilder, CancellationToken cancellationToken = default(CancellationToken))
		{
			IHost host = hostBuilder.Build();
			await host.StartAsync(cancellationToken).ConfigureAwait(continueOnCapturedContext: false);
			return host;
		}
	}
	public static class HostingAbstractionsHostExtensions
	{
		public static void Start(this IHost host)
		{
			host.StartAsync().GetAwaiter().GetResult();
		}

		public static async Task StopAsync(this IHost host, TimeSpan timeout)
		{
			using CancellationTokenSource cts = new CancellationTokenSource(timeout);
			await host.StopAsync(cts.Token).ConfigureAwait(continueOnCapturedContext: false);
		}

		public static void WaitForShutdown(this IHost host)
		{
			host.WaitForShutdownAsync().GetAwaiter().GetResult();
		}

		public static void Run(this IHost host)
		{
			host.RunAsync().GetAwaiter().GetResult();
		}

		public static async Task RunAsync(this IHost host, CancellationToken token = default(CancellationToken))
		{
			try
			{
				await host.StartAsync(token).ConfigureAwait(continueOnCapturedContext: false);
				await host.WaitForShutdownAsync(token).ConfigureAwait(continueOnCapturedContext: false);
			}
			finally
			{
				if (host is IAsyncDisposable asyncDisposable)
				{
					await asyncDisposable.DisposeAsync().ConfigureAwait(continueOnCapturedContext: false);
				}
				else
				{
					host.Dispose();
				}
			}
		}

		public static async Task WaitForShutdownAsync(this IHost host, CancellationToken token = default(CancellationToken))
		{
			IHostApplicationLifetime requiredService = ServiceProviderServiceExtensions.GetRequiredService<IHostApplicationLifetime>(host.Services);
			token.Register(delegate(object state)
			{
				((IHostApplicationLifetime)state).StopApplication();
			}, requiredService);
			TaskCompletionSource<object> taskCompletionSource = new TaskCompletionSource<object>(TaskCreationOptions.RunContinuationsAsynchronously);
			requiredService.ApplicationStopping.Register(delegate(object obj)
			{
				TaskCompletionSource<object> taskCompletionSource2 = (TaskCompletionSource<object>)obj;
				taskCompletionSource2.TrySetResult(null);
			}, taskCompletionSource);
			await taskCompletionSource.Task.ConfigureAwait(continueOnCapturedContext: false);
			await host.StopAsync(CancellationToken.None).ConfigureAwait(continueOnCapturedContext: false);
		}
	}
	public static class HostingEnvironmentExtensions
	{
		public static bool IsDevelopment(this IHostingEnvironment hostingEnvironment)
		{
			System.ThrowHelper.ThrowIfNull(hostingEnvironment, "hostingEnvironment");
			return hostingEnvironment.IsEnvironment(EnvironmentName.Development);
		}

		public static bool IsStaging(this IHostingEnvironment hostingEnvironment)
		{
			System.ThrowHelper.ThrowIfNull(hostingEnvironment, "hostingEnvironment");
			return hostingEnvironment.IsEnvironment(EnvironmentName.Staging);
		}

		public static bool IsProduction(this IHostingEnvironment hostingEnvironment)
		{
			System.ThrowHelper.ThrowIfNull(hostingEnvironment, "hostingEnvironment");
			return hostingEnvironment.IsEnvironment(EnvironmentName.Production);
		}

		public static bool IsEnvironment(this IHostingEnvironment hostingEnvironment, string environmentName)
		{
			System.ThrowHelper.ThrowIfNull(hostingEnvironment, "hostingEnvironment");
			return string.Equals(hostingEnvironment.EnvironmentName, environmentName, StringComparison.OrdinalIgnoreCase);
		}
	}
	[Obsolete("IApplicationLifetime has been deprecated. Use Microsoft.Extensions.Hosting.IHostApplicationLifetime instead.")]
	public interface IApplicationLifetime
	{
		CancellationToken ApplicationStarted { get; }

		CancellationToken ApplicationStopping { get; }

		CancellationToken ApplicationStopped { get; }

		void StopApplication();
	}
	public interface IHost : IDisposable
	{
		IServiceProvider Services { get; }

		Task StartAsync(CancellationToken cancellationToken = default(CancellationToken));

		Task StopAsync(CancellationToken cancellationToken = default(CancellationToken));
	}
	public interface IHostApplicationLifetime
	{
		CancellationToken ApplicationStarted { get; }

		CancellationToken ApplicationStopping { get; }

		CancellationToken ApplicationStopped { get; }

		void StopApplication();
	}
	public interface IHostBuilder
	{
		IDictionary<object, object> Properties { get; }

		IHostBuilder ConfigureHostConfiguration(Action<IConfigurationBuilder> configureDelegate);

		IHostBuilder ConfigureAppConfiguration(Action<HostBuilderContext, IConfigurationBuilder> configureDelegate);

		IHostBuilder ConfigureServices(Action<HostBuilderContext, IServiceCollection> configureDelegate);

		IHostBuilder UseServiceProviderFactory<TContainerBuilder>(IServiceProviderFactory<TContainerBuilder> factory) where TContainerBuilder : notnull;

		IHostBuilder UseServiceProviderFactory<TContainerBuilder>(Func<HostBuilderContext, IServiceProviderFactory<TContainerBuilder>> factory) where TContainerBuilder : notnull;

		IHostBuilder ConfigureContainer<TContainerBuilder>(Action<HostBuilderContext, TContainerBuilder> configureDelegate);

		IHost Build();
	}
	public interface IHostedService
	{
		Task StartAsync(CancellationToken cancellationToken);

		Task StopAsync(CancellationToken cancellationToken);
	}
	public interface IHostEnvironment
	{
		string EnvironmentName { get; set; }

		string ApplicationName { get; set; }

		string ContentRootPath { get; set; }

		IFileProvider ContentRootFileProvider { get; set; }
	}
	[Obsolete("IHostingEnvironment has been deprecated. Use Microsoft.Extensions.Hosting.IHostEnvironment instead.")]
	public interface IHostingEnvironment
	{
		string EnvironmentName { get; set; }

		string ApplicationName { get; set; }

		string ContentRootPath { get; set; }

		IFileProvider ContentRootFileProvider { get; set; }
	}
	public interface IHostLifetime
	{
		Task WaitForStartAsync(CancellationToken cancellationToken);

		Task StopAsync(CancellationToken cancellationToken);
	}
}

BepInEx/plugins/SlopCrew.Plugin/Microsoft.Extensions.Hosting.dll

Decompiled 8 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.ExceptionServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Threading;
using System.Threading.Tasks;
using FxResources.Microsoft.Extensions.Hosting;
using Microsoft.CodeAnalysis;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.FileProviders;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Hosting.Internal;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
using Microsoft.Extensions.Logging.EventLog;
using Microsoft.Extensions.Options;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: AssemblyMetadata(".NETFrameworkAssembly", "")]
[assembly: AssemblyMetadata("Serviceable", "True")]
[assembly: AssemblyMetadata("PreferInbox", "True")]
[assembly: AssemblyDefaultAlias("Microsoft.Extensions.Hosting")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: CLSCompliant(true)]
[assembly: AssemblyMetadata("IsTrimmable", "True")]
[assembly: DefaultDllImportSearchPaths(DllImportSearchPath.System32 | DllImportSearchPath.AssemblyDirectory)]
[assembly: AssemblyCompany("Microsoft Corporation")]
[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")]
[assembly: AssemblyDescription("Hosting and startup infrastructures for applications.")]
[assembly: AssemblyFileVersion("7.0.323.6910")]
[assembly: AssemblyInformationalVersion("7.0.3+0a2bda10e81d901396c3cff95533529e3a93ad47")]
[assembly: AssemblyProduct("Microsoft® .NET")]
[assembly: AssemblyTitle("Microsoft.Extensions.Hosting")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/dotnet/runtime")]
[assembly: AssemblyVersion("7.0.0.1")]
[module: RefSafetyRules(11)]
[module: System.Runtime.CompilerServices.NullablePublicOnly(false)]
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 NullablePublicOnlyAttribute : Attribute
	{
		public readonly bool IncludesInternals;

		public NullablePublicOnlyAttribute(bool P_0)
		{
			IncludesInternals = 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 FxResources.Microsoft.Extensions.Hosting
{
	internal static class SR
	{
	}
}
namespace System
{
	internal static class ThrowHelper
	{
		internal static void ThrowIfNull(object argument, [CallerArgumentExpression("argument")] string paramName = null)
		{
			if (argument == null)
			{
				Throw(paramName);
			}
		}

		private static void Throw(string paramName)
		{
			throw new ArgumentNullException(paramName);
		}
	}
	internal static class SR
	{
		private static readonly bool s_usingResourceKeys = AppContext.TryGetSwitch("System.Resources.UseSystemResourceKeys", out var isEnabled) && isEnabled;

		private static ResourceManager s_resourceManager;

		internal static ResourceManager ResourceManager => s_resourceManager ?? (s_resourceManager = new ResourceManager(typeof(SR)));

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

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

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

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

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

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

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

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

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

		private static bool UsingResourceKeys()
		{
			return s_usingResourceKeys;
		}

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

		internal static string GetResourceString(string resourceKey, string defaultString)
		{
			string resourceString = GetResourceString(resourceKey);
			if (!(resourceKey == resourceString) && resourceString != null)
			{
				return resourceString;
			}
			return defaultString;
		}

		internal static string Format(string resourceFormat, object p1)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1);
			}
			return string.Format(resourceFormat, p1);
		}

		internal static string Format(string resourceFormat, object p1, object p2)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2);
			}
			return string.Format(resourceFormat, p1, p2);
		}

		internal static string Format(string resourceFormat, object p1, object p2, object p3)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2, p3);
			}
			return string.Format(resourceFormat, p1, p2, p3);
		}

		internal static string Format(string resourceFormat, params object[] args)
		{
			if (args != null)
			{
				if (UsingResourceKeys())
				{
					return resourceFormat + ", " + string.Join(", ", args);
				}
				return string.Format(resourceFormat, args);
			}
			return resourceFormat;
		}

		internal static string Format(IFormatProvider provider, string resourceFormat, object p1)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1);
			}
			return string.Format(provider, resourceFormat, p1);
		}

		internal static string Format(IFormatProvider provider, string resourceFormat, object p1, object p2)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2);
			}
			return string.Format(provider, resourceFormat, p1, p2);
		}

		internal static string Format(IFormatProvider provider, string resourceFormat, object p1, object p2, object p3)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2, p3);
			}
			return string.Format(provider, resourceFormat, p1, p2, p3);
		}

		internal static string Format(IFormatProvider provider, string resourceFormat, params object[] args)
		{
			if (args != null)
			{
				if (UsingResourceKeys())
				{
					return resourceFormat + ", " + string.Join(", ", args);
				}
				return string.Format(provider, resourceFormat, args);
			}
			return resourceFormat;
		}
	}
}
namespace System.Diagnostics.CodeAnalysis
{
	[AttributeUsage(AttributeTargets.All, Inherited = false, AllowMultiple = true)]
	internal sealed class UnconditionalSuppressMessageAttribute : Attribute
	{
		public string Category { get; }

		public string CheckId { get; }

		public string Scope { get; set; }

		public string Target { get; set; }

		public string MessageId { get; set; }

		public string Justification { get; set; }

		public UnconditionalSuppressMessageAttribute(string category, string checkId)
		{
			Category = category;
			CheckId = checkId;
		}
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Interface | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, Inherited = false)]
	internal sealed class DynamicallyAccessedMembersAttribute : Attribute
	{
		public DynamicallyAccessedMemberTypes MemberTypes { get; }

		public DynamicallyAccessedMembersAttribute(DynamicallyAccessedMemberTypes memberTypes)
		{
			MemberTypes = memberTypes;
		}
	}
	[Flags]
	internal enum DynamicallyAccessedMemberTypes
	{
		None = 0,
		PublicParameterlessConstructor = 1,
		PublicConstructors = 3,
		NonPublicConstructors = 4,
		PublicMethods = 8,
		NonPublicMethods = 0x10,
		PublicFields = 0x20,
		NonPublicFields = 0x40,
		PublicNestedTypes = 0x80,
		NonPublicNestedTypes = 0x100,
		PublicProperties = 0x200,
		NonPublicProperties = 0x400,
		PublicEvents = 0x800,
		NonPublicEvents = 0x1000,
		Interfaces = 0x2000,
		All = -1
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Constructor | AttributeTargets.Method, Inherited = false)]
	internal sealed class RequiresDynamicCodeAttribute : Attribute
	{
		public string Message { get; }

		public string Url { get; set; }

		public RequiresDynamicCodeAttribute(string message)
		{
			Message = message;
		}
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)]
	internal sealed class AllowNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)]
	internal sealed class DisallowNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)]
	internal sealed class MaybeNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)]
	internal sealed class NotNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class MaybeNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public MaybeNullWhenAttribute(bool returnValue)
		{
			ReturnValue = returnValue;
		}
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class NotNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public NotNullWhenAttribute(bool returnValue)
		{
			ReturnValue = returnValue;
		}
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = true, Inherited = false)]
	internal sealed class NotNullIfNotNullAttribute : Attribute
	{
		public string ParameterName { get; }

		public NotNullIfNotNullAttribute(string parameterName)
		{
			ParameterName = parameterName;
		}
	}
	[AttributeUsage(AttributeTargets.Method, Inherited = false)]
	internal sealed class DoesNotReturnAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class DoesNotReturnIfAttribute : Attribute
	{
		public bool ParameterValue { get; }

		public DoesNotReturnIfAttribute(bool parameterValue)
		{
			ParameterValue = parameterValue;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	internal sealed class MemberNotNullAttribute : Attribute
	{
		public string[] Members { get; }

		public MemberNotNullAttribute(string member)
		{
			Members = new string[1] { member };
		}

		public MemberNotNullAttribute(params string[] members)
		{
			Members = members;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	internal sealed class MemberNotNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public string[] Members { get; }

		public MemberNotNullWhenAttribute(bool returnValue, string member)
		{
			ReturnValue = returnValue;
			Members = new string[1] { member };
		}

		public MemberNotNullWhenAttribute(bool returnValue, params string[] members)
		{
			ReturnValue = returnValue;
			Members = members;
		}
	}
}
namespace System.Runtime.Versioning
{
	internal abstract class OSPlatformAttribute : Attribute
	{
		public string PlatformName { get; }

		private protected OSPlatformAttribute(string platformName)
		{
			PlatformName = platformName;
		}
	}
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false, Inherited = false)]
	internal sealed class TargetPlatformAttribute : OSPlatformAttribute
	{
		public TargetPlatformAttribute(string platformName)
			: base(platformName)
		{
		}
	}
	[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface, AllowMultiple = true, Inherited = false)]
	internal sealed class SupportedOSPlatformAttribute : OSPlatformAttribute
	{
		public SupportedOSPlatformAttribute(string platformName)
			: base(platformName)
		{
		}
	}
	[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface, AllowMultiple = true, Inherited = false)]
	internal sealed class UnsupportedOSPlatformAttribute : OSPlatformAttribute
	{
		public string Message { get; }

		public UnsupportedOSPlatformAttribute(string platformName)
			: base(platformName)
		{
		}

		public UnsupportedOSPlatformAttribute(string platformName, string message)
			: base(platformName)
		{
			Message = message;
		}
	}
	[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface, AllowMultiple = true, Inherited = false)]
	internal sealed class ObsoletedOSPlatformAttribute : OSPlatformAttribute
	{
		public string Message { get; }

		public string Url { get; set; }

		public ObsoletedOSPlatformAttribute(string platformName)
			: base(platformName)
		{
		}

		public ObsoletedOSPlatformAttribute(string platformName, string message)
			: base(platformName)
		{
			Message = message;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = true, Inherited = false)]
	internal sealed class SupportedOSPlatformGuardAttribute : OSPlatformAttribute
	{
		public SupportedOSPlatformGuardAttribute(string platformName)
			: base(platformName)
		{
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = true, Inherited = false)]
	internal sealed class UnsupportedOSPlatformGuardAttribute : OSPlatformAttribute
	{
		public UnsupportedOSPlatformGuardAttribute(string platformName)
			: base(platformName)
		{
		}
	}
}
namespace System.Runtime.InteropServices
{
	[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
	internal sealed class LibraryImportAttribute : Attribute
	{
		public string LibraryName { get; }

		public string EntryPoint { get; set; }

		public StringMarshalling StringMarshalling { get; set; }

		public Type StringMarshallingCustomType { get; set; }

		public bool SetLastError { get; set; }

		public LibraryImportAttribute(string libraryName)
		{
			LibraryName = libraryName;
		}
	}
	internal enum StringMarshalling
	{
		Custom,
		Utf8,
		Utf16
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
	internal sealed class CallerArgumentExpressionAttribute : Attribute
	{
		public string ParameterName { get; }

		public CallerArgumentExpressionAttribute(string parameterName)
		{
			ParameterName = parameterName;
		}
	}
}
namespace Microsoft.Extensions.DependencyInjection
{
	[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2091:UnrecognizedReflectionPattern", Justification = "Workaround for https://github.com/mono/linker/issues/1416. Outer method has been annotated with DynamicallyAccessedMembers.")]
	public static class OptionsBuilderExtensions
	{
		public static OptionsBuilder<TOptions> ValidateOnStart<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] TOptions>(this OptionsBuilder<TOptions> optionsBuilder) where TOptions : class
		{
			OptionsBuilder<TOptions> optionsBuilder2 = optionsBuilder;
			System.ThrowHelper.ThrowIfNull(optionsBuilder2, "optionsBuilder");
			ServiceCollectionHostedServiceExtensions.AddHostedService<ValidationHostedService>(optionsBuilder2.Services);
			OptionsServiceCollectionExtensions.AddOptions<ValidatorOptions>(optionsBuilder2.Services).Configure<IOptionsMonitor<TOptions>>((Action<ValidatorOptions, IOptionsMonitor<TOptions>>)delegate(ValidatorOptions vo, IOptionsMonitor<TOptions> options)
			{
				vo.Validators[(typeof(TOptions), optionsBuilder2.Name)] = delegate
				{
					options.Get(optionsBuilder2.Name);
				};
			});
			return optionsBuilder2;
		}
	}
	internal sealed class ValidationHostedService : IHostedService
	{
		private readonly IDictionary<(Type, string), Action> _validators;

		public ValidationHostedService(IOptions<ValidatorOptions> validatorOptions)
		{
			_validators = validatorOptions?.Value?.Validators ?? throw new ArgumentNullException("validatorOptions");
		}

		public Task StartAsync(CancellationToken cancellationToken)
		{
			//IL_0029: Expected O, but got Unknown
			List<Exception> list = new List<Exception>();
			foreach (Action value in _validators.Values)
			{
				try
				{
					value();
				}
				catch (OptionsValidationException val)
				{
					OptionsValidationException item = val;
					list.Add((Exception)(object)item);
				}
			}
			if (list.Count == 1)
			{
				ExceptionDispatchInfo.Capture(list[0]).Throw();
			}
			if (list.Count > 1)
			{
				throw new AggregateException(list);
			}
			return Task.CompletedTask;
		}

		public Task StopAsync(CancellationToken cancellationToken)
		{
			return Task.CompletedTask;
		}
	}
	internal sealed class ValidatorOptions
	{
		public IDictionary<(Type optionsType, string optionsName), Action> Validators { get; } = new Dictionary<(Type, string), Action>();

	}
}
namespace Microsoft.Extensions.Hosting
{
	public enum BackgroundServiceExceptionBehavior
	{
		StopHost,
		Ignore
	}
	public class ConsoleLifetimeOptions
	{
		public bool SuppressStatusMessages { get; set; }
	}
	public static class Host
	{
		internal const string RequiresDynamicCodeMessage = "Hosting uses Microsoft.Extensions.DependencyInjection, which may require generating code dynamically at runtime.";

		[RequiresDynamicCode("Hosting uses Microsoft.Extensions.DependencyInjection, which may require generating code dynamically at runtime.")]
		public static IHostBuilder CreateDefaultBuilder()
		{
			return CreateDefaultBuilder(null);
		}

		[RequiresDynamicCode("Hosting uses Microsoft.Extensions.DependencyInjection, which may require generating code dynamically at runtime.")]
		public static IHostBuilder CreateDefaultBuilder(string[]? args)
		{
			HostBuilder builder = new HostBuilder();
			return ((IHostBuilder)(object)builder).ConfigureDefaults(args);
		}

		[RequiresDynamicCode("Hosting uses Microsoft.Extensions.DependencyInjection, which may require generating code dynamically at runtime.")]
		public static HostApplicationBuilder CreateApplicationBuilder()
		{
			return new HostApplicationBuilder();
		}

		[RequiresDynamicCode("Hosting uses Microsoft.Extensions.DependencyInjection, which may require generating code dynamically at runtime.")]
		public static HostApplicationBuilder CreateApplicationBuilder(string[]? args)
		{
			return new HostApplicationBuilder(args);
		}
	}
	public sealed class HostApplicationBuilder
	{
		private sealed class HostBuilderAdapter : IHostBuilder
		{
			private readonly HostApplicationBuilder _hostApplicationBuilder;

			private readonly List<Action<IConfigurationBuilder>> _configureHostConfigActions = new List<Action<IConfigurationBuilder>>();

			private readonly List<Action<HostBuilderContext, IConfigurationBuilder>> _configureAppConfigActions = new List<Action<HostBuilderContext, IConfigurationBuilder>>();

			private readonly List<IConfigureContainerAdapter> _configureContainerActions = new List<IConfigureContainerAdapter>();

			private readonly List<Action<HostBuilderContext, IServiceCollection>> _configureServicesActions = new List<Action<HostBuilderContext, IServiceCollection>>();

			private IServiceFactoryAdapter _serviceProviderFactory;

			public IDictionary<object, object> Properties => _hostApplicationBuilder._hostBuilderContext.Properties;

			public HostBuilderAdapter(HostApplicationBuilder hostApplicationBuilder)
			{
				_hostApplicationBuilder = hostApplicationBuilder;
			}

			public void ApplyChanges()
			{
				ConfigurationManager configuration = _hostApplicationBuilder.Configuration;
				if (_configureHostConfigActions.Count > 0)
				{
					string text = configuration[HostDefaults.ApplicationKey];
					string text2 = configuration[HostDefaults.EnvironmentKey];
					string text3 = configuration[HostDefaults.ContentRootKey];
					string contentRootPath = _hostApplicationBuilder._hostBuilderContext.HostingEnvironment.ContentRootPath;
					foreach (Action<IConfigurationBuilder> configureHostConfigAction in _configureHostConfigActions)
					{
						configureHostConfigAction((IConfigurationBuilder)(object)configuration);
					}
					if (!string.Equals(text, configuration[HostDefaults.ApplicationKey], StringComparison.OrdinalIgnoreCase))
					{
						throw new NotSupportedException(System.SR.Format(System.SR.ApplicationNameChangeNotSupported, text, configuration[HostDefaults.ApplicationKey]));
					}
					if (!string.Equals(text2, configuration[HostDefaults.EnvironmentKey], StringComparison.OrdinalIgnoreCase))
					{
						throw new NotSupportedException(System.SR.Format(System.SR.EnvironmentNameChangeNotSupoprted, text2, configuration[HostDefaults.EnvironmentKey]));
					}
					string text4 = configuration[HostDefaults.ContentRootKey];
					if (!string.Equals(text3, text4, StringComparison.OrdinalIgnoreCase) && !string.Equals(contentRootPath, HostBuilder.ResolveContentRootPath(text4, AppContext.BaseDirectory), StringComparison.OrdinalIgnoreCase))
					{
						throw new NotSupportedException(System.SR.Format(System.SR.ContentRootChangeNotSupported, text3, text4));
					}
				}
				foreach (Action<HostBuilderContext, IConfigurationBuilder> configureAppConfigAction in _configureAppConfigActions)
				{
					configureAppConfigAction(_hostApplicationBuilder._hostBuilderContext, (IConfigurationBuilder)(object)configuration);
				}
				foreach (Action<HostBuilderContext, IServiceCollection> configureServicesAction in _configureServicesActions)
				{
					configureServicesAction(_hostApplicationBuilder._hostBuilderContext, _hostApplicationBuilder.Services);
				}
				if (_configureContainerActions.Count > 0)
				{
					Action<object> previousConfigureContainer = _hostApplicationBuilder._configureContainer;
					_hostApplicationBuilder._configureContainer = delegate(object containerBuilder)
					{
						previousConfigureContainer(containerBuilder);
						foreach (IConfigureContainerAdapter configureContainerAction in _configureContainerActions)
						{
							configureContainerAction.ConfigureContainer(_hostApplicationBuilder._hostBuilderContext, containerBuilder);
						}
					};
				}
				if (_serviceProviderFactory != null)
				{
					_hostApplicationBuilder._createServiceProvider = delegate
					{
						object obj = _serviceProviderFactory.CreateBuilder(_hostApplicationBuilder.Services);
						_hostApplicationBuilder._configureContainer(obj);
						return _serviceProviderFactory.CreateServiceProvider(obj);
					};
				}
			}

			public IHost Build()
			{
				throw new NotSupportedException();
			}

			public IHostBuilder ConfigureHostConfiguration(Action<IConfigurationBuilder> configureDelegate)
			{
				System.ThrowHelper.ThrowIfNull(configureDelegate, "configureDelegate");
				_configureHostConfigActions.Add(configureDelegate);
				return (IHostBuilder)(object)this;
			}

			public IHostBuilder ConfigureAppConfiguration(Action<HostBuilderContext, IConfigurationBuilder> configureDelegate)
			{
				System.ThrowHelper.ThrowIfNull(configureDelegate, "configureDelegate");
				_configureAppConfigActions.Add(configureDelegate);
				return (IHostBuilder)(object)this;
			}

			public IHostBuilder ConfigureServices(Action<HostBuilderContext, IServiceCollection> configureDelegate)
			{
				System.ThrowHelper.ThrowIfNull(configureDelegate, "configureDelegate");
				_configureServicesActions.Add(configureDelegate);
				return (IHostBuilder)(object)this;
			}

			public IHostBuilder UseServiceProviderFactory<TContainerBuilder>(IServiceProviderFactory<TContainerBuilder> factory)
			{
				System.ThrowHelper.ThrowIfNull(factory, "factory");
				_serviceProviderFactory = new ServiceFactoryAdapter<TContainerBuilder>(factory);
				return (IHostBuilder)(object)this;
			}

			public IHostBuilder UseServiceProviderFactory<TContainerBuilder>(Func<HostBuilderContext, IServiceProviderFactory<TContainerBuilder>> factory)
			{
				System.ThrowHelper.ThrowIfNull(factory, "factory");
				_serviceProviderFactory = new ServiceFactoryAdapter<TContainerBuilder>(() => _hostApplicationBuilder._hostBuilderContext, factory);
				return (IHostBuilder)(object)this;
			}

			public IHostBuilder ConfigureContainer<TContainerBuilder>(Action<HostBuilderContext, TContainerBuilder> configureDelegate)
			{
				System.ThrowHelper.ThrowIfNull(configureDelegate, "configureDelegate");
				_configureContainerActions.Add(new ConfigureContainerAdapter<TContainerBuilder>(configureDelegate));
				return (IHostBuilder)(object)this;
			}
		}

		private sealed class LoggingBuilder : ILoggingBuilder
		{
			public IServiceCollection Services { get; }

			public LoggingBuilder(IServiceCollection services)
			{
				Services = services;
			}
		}

		private readonly HostBuilderContext _hostBuilderContext;

		private readonly ServiceCollection _serviceCollection = new ServiceCollection();

		private Func<IServiceProvider> _createServiceProvider;

		private Action<object> _configureContainer = delegate
		{
		};

		private HostBuilderAdapter _hostBuilderAdapter;

		private IServiceProvider _appServices;

		private bool _hostBuilt;

		public IHostEnvironment Environment { get; }

		public ConfigurationManager Configuration { get; }

		public IServiceCollection Services => (IServiceCollection)(object)_serviceCollection;

		public ILoggingBuilder Logging { get; }

		[RequiresDynamicCode("Hosting uses Microsoft.Extensions.DependencyInjection, which may require generating code dynamically at runtime.")]
		public HostApplicationBuilder()
			: this((string[]?)null)
		{
		}

		[RequiresDynamicCode("Hosting uses Microsoft.Extensions.DependencyInjection, which may require generating code dynamically at runtime.")]
		public HostApplicationBuilder(string[]? args)
			: this(new HostApplicationBuilderSettings
			{
				Args = args
			})
		{
		}

		[RequiresDynamicCode("Hosting uses Microsoft.Extensions.DependencyInjection, which may require generating code dynamically at runtime.")]
		public HostApplicationBuilder(HostApplicationBuilderSettings? settings)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Expected O, but got Unknown
			if (settings == null)
			{
				settings = new HostApplicationBuilderSettings();
			}
			Configuration = (ConfigurationManager)(((object)settings.Configuration) ?? ((object)new ConfigurationManager()));
			if (!settings.DisableDefaults)
			{
				if (settings.ContentRootPath == null && Configuration[HostDefaults.ContentRootKey] == null)
				{
					HostingHostBuilderExtensions.SetDefaultContentRoot((IConfigurationBuilder)(object)Configuration);
				}
				HostingHostBuilderExtensions.AddDefaultHostConfigurationSources((IConfigurationBuilder)(object)Configuration, settings.Args);
			}
			List<KeyValuePair<string, string>> list = null;
			if (settings.ApplicationName != null)
			{
				if (list == null)
				{
					list = new List<KeyValuePair<string, string>>();
				}
				list.Add(new KeyValuePair<string, string>(HostDefaults.ApplicationKey, settings.ApplicationName));
			}
			if (settings.EnvironmentName != null)
			{
				if (list == null)
				{
					list = new List<KeyValuePair<string, string>>();
				}
				list.Add(new KeyValuePair<string, string>(HostDefaults.EnvironmentKey, settings.EnvironmentName));
			}
			if (settings.ContentRootPath != null)
			{
				if (list == null)
				{
					list = new List<KeyValuePair<string, string>>();
				}
				list.Add(new KeyValuePair<string, string>(HostDefaults.ContentRootKey, settings.ContentRootPath));
			}
			if (list != null)
			{
				MemoryConfigurationBuilderExtensions.AddInMemoryCollection((IConfigurationBuilder)(object)Configuration, (IEnumerable<KeyValuePair<string, string>>)list);
			}
			var (hostingEnvironment, val) = HostBuilder.CreateHostingEnvironment((IConfiguration)(object)Configuration);
			FileConfigurationExtensions.SetFileProvider((IConfigurationBuilder)(object)Configuration, (IFileProvider)(object)val);
			_hostBuilderContext = new HostBuilderContext((IDictionary<object, object>)new Dictionary<object, object>())
			{
				HostingEnvironment = (IHostEnvironment)(object)hostingEnvironment,
				Configuration = (IConfiguration)(object)Configuration
			};
			Environment = (IHostEnvironment)(object)hostingEnvironment;
			HostBuilder.PopulateServiceCollection(Services, _hostBuilderContext, hostingEnvironment, val, (IConfiguration)(object)Configuration, () => _appServices);
			Logging = (ILoggingBuilder)(object)new LoggingBuilder(Services);
			ServiceProviderOptions serviceProviderOptions = null;
			if (!settings.DisableDefaults)
			{
				HostingHostBuilderExtensions.ApplyDefaultAppConfiguration(_hostBuilderContext, (IConfigurationBuilder)(object)Configuration, settings.Args);
				HostingHostBuilderExtensions.AddDefaultServices(_hostBuilderContext, Services);
				serviceProviderOptions = HostingHostBuilderExtensions.CreateDefaultServiceProviderOptions(_hostBuilderContext);
			}
			_createServiceProvider = delegate
			{
				_configureContainer(Services);
				return (IServiceProvider)((serviceProviderOptions != null) ? ServiceCollectionContainerBuilderExtensions.BuildServiceProvider(Services, serviceProviderOptions) : ServiceCollectionContainerBuilderExtensions.BuildServiceProvider(Services));
			};
		}

		public void ConfigureContainer<TContainerBuilder>(IServiceProviderFactory<TContainerBuilder> factory, Action<TContainerBuilder>? configure = null) where TContainerBuilder : notnull
		{
			IServiceProviderFactory<TContainerBuilder> factory2 = factory;
			Action<TContainerBuilder> configure2 = configure;
			_createServiceProvider = delegate
			{
				TContainerBuilder val = factory2.CreateBuilder(Services);
				_configureContainer(val);
				return factory2.CreateServiceProvider(val);
			};
			_configureContainer = delegate(object containerBuilder)
			{
				configure2?.Invoke((TContainerBuilder)containerBuilder);
			};
		}

		public IHost Build()
		{
			if (_hostBuilt)
			{
				throw new InvalidOperationException(System.SR.BuildCalled);
			}
			_hostBuilt = true;
			DiagnosticListener val = HostBuilder.LogHostBuilding(this);
			try
			{
				_hostBuilderAdapter?.ApplyChanges();
				_appServices = _createServiceProvider();
				_serviceCollection.MakeReadOnly();
				return HostBuilder.ResolveHost(_appServices, val);
			}
			finally
			{
				((IDisposable)val)?.Dispose();
			}
		}

		internal IHostBuilder AsHostBuilder()
		{
			return (IHostBuilder)(object)(_hostBuilderAdapter ?? (_hostBuilderAdapter = new HostBuilderAdapter(this)));
		}
	}
	public sealed class HostApplicationBuilderSettings
	{
		public bool DisableDefaults { get; set; }

		public string[]? Args { get; set; }

		public ConfigurationManager? Configuration { get; set; }

		public string? EnvironmentName { get; set; }

		public string? ApplicationName { get; set; }

		public string? ContentRootPath { get; set; }
	}
	public class HostBuilder : IHostBuilder
	{
		private const string HostBuildingDiagnosticListenerName = "Microsoft.Extensions.Hosting";

		private const string HostBuildingEventName = "HostBuilding";

		private const string HostBuiltEventName = "HostBuilt";

		private List<Action<IConfigurationBuilder>> _configureHostConfigActions = new List<Action<IConfigurationBuilder>>();

		private List<Action<HostBuilderContext, IConfigurationBuilder>> _configureAppConfigActions = new List<Action<HostBuilderContext, IConfigurationBuilder>>();

		private List<Action<HostBuilderContext, IServiceCollection>> _configureServicesActions = new List<Action<HostBuilderContext, IServiceCollection>>();

		private List<IConfigureContainerAdapter> _configureContainerActions = new List<IConfigureContainerAdapter>();

		private IServiceFactoryAdapter _serviceProviderFactory;

		private bool _hostBuilt;

		private IConfiguration _hostConfiguration;

		private IConfiguration _appConfiguration;

		private HostBuilderContext _hostBuilderContext;

		private HostingEnvironment _hostingEnvironment;

		private IServiceProvider _appServices;

		private PhysicalFileProvider _defaultProvider;

		public IDictionary<object, object> Properties { get; } = new Dictionary<object, object>();


		[RequiresDynamicCode("Hosting uses Microsoft.Extensions.DependencyInjection, which may require generating code dynamically at runtime.")]
		public HostBuilder()
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Expected O, but got Unknown
			_serviceProviderFactory = new ServiceFactoryAdapter<IServiceCollection>((IServiceProviderFactory<IServiceCollection>)new DefaultServiceProviderFactory());
		}

		public IHostBuilder ConfigureHostConfiguration(Action<IConfigurationBuilder> configureDelegate)
		{
			System.ThrowHelper.ThrowIfNull(configureDelegate, "configureDelegate");
			_configureHostConfigActions.Add(configureDelegate);
			return (IHostBuilder)(object)this;
		}

		public IHostBuilder ConfigureAppConfiguration(Action<HostBuilderContext, IConfigurationBuilder> configureDelegate)
		{
			System.ThrowHelper.ThrowIfNull(configureDelegate, "configureDelegate");
			_configureAppConfigActions.Add(configureDelegate);
			return (IHostBuilder)(object)this;
		}

		public IHostBuilder ConfigureServices(Action<HostBuilderContext, IServiceCollection> configureDelegate)
		{
			System.ThrowHelper.ThrowIfNull(configureDelegate, "configureDelegate");
			_configureServicesActions.Add(configureDelegate);
			return (IHostBuilder)(object)this;
		}

		public IHostBuilder UseServiceProviderFactory<TContainerBuilder>(IServiceProviderFactory<TContainerBuilder> factory) where TContainerBuilder : notnull
		{
			System.ThrowHelper.ThrowIfNull(factory, "factory");
			_serviceProviderFactory = new ServiceFactoryAdapter<TContainerBuilder>(factory);
			return (IHostBuilder)(object)this;
		}

		public IHostBuilder UseServiceProviderFactory<TContainerBuilder>(Func<HostBuilderContext, IServiceProviderFactory<TContainerBuilder>> factory) where TContainerBuilder : notnull
		{
			System.ThrowHelper.ThrowIfNull(factory, "factory");
			_serviceProviderFactory = new ServiceFactoryAdapter<TContainerBuilder>(() => _hostBuilderContext, factory);
			return (IHostBuilder)(object)this;
		}

		public IHostBuilder ConfigureContainer<TContainerBuilder>(Action<HostBuilderContext, TContainerBuilder> configureDelegate)
		{
			System.ThrowHelper.ThrowIfNull(configureDelegate, "configureDelegate");
			_configureContainerActions.Add(new ConfigureContainerAdapter<TContainerBuilder>(configureDelegate));
			return (IHostBuilder)(object)this;
		}

		public IHost Build()
		{
			if (_hostBuilt)
			{
				throw new InvalidOperationException(System.SR.BuildCalled);
			}
			_hostBuilt = true;
			DiagnosticListener val = LogHostBuilding((IHostBuilder)(object)this);
			try
			{
				InitializeHostConfiguration();
				InitializeHostingEnvironment();
				InitializeHostBuilderContext();
				InitializeAppConfiguration();
				InitializeServiceProvider();
				return ResolveHost(_appServices, val);
			}
			finally
			{
				((IDisposable)val)?.Dispose();
			}
		}

		private static DiagnosticListener LogHostBuilding(IHostBuilder hostBuilder)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			DiagnosticListener val = new DiagnosticListener("Microsoft.Extensions.Hosting");
			if (val.IsEnabled() && ((DiagnosticSource)val).IsEnabled("HostBuilding"))
			{
				Write<IHostBuilder>((DiagnosticSource)(object)val, "HostBuilding", hostBuilder);
			}
			return val;
		}

		internal static DiagnosticListener LogHostBuilding(HostApplicationBuilder hostApplicationBuilder)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			DiagnosticListener val = new DiagnosticListener("Microsoft.Extensions.Hosting");
			if (val.IsEnabled() && ((DiagnosticSource)val).IsEnabled("HostBuilding"))
			{
				Write<IHostBuilder>((DiagnosticSource)(object)val, "HostBuilding", hostApplicationBuilder.AsHostBuilder());
			}
			return val;
		}

		[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:UnrecognizedReflectionPattern", Justification = "The values being passed into Write are being consumed by the application already.")]
		private static void Write<T>(DiagnosticSource diagnosticSource, string name, T value)
		{
			diagnosticSource.Write(name, (object)value);
		}

		[MemberNotNull("_hostConfiguration")]
		private void InitializeHostConfiguration()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Expected O, but got Unknown
			IConfigurationBuilder val = MemoryConfigurationBuilderExtensions.AddInMemoryCollection((IConfigurationBuilder)new ConfigurationBuilder());
			foreach (Action<IConfigurationBuilder> configureHostConfigAction in _configureHostConfigActions)
			{
				configureHostConfigAction(val);
			}
			_hostConfiguration = (IConfiguration)(object)val.Build();
		}

		[MemberNotNull("_defaultProvider")]
		[MemberNotNull("_hostingEnvironment")]
		private void InitializeHostingEnvironment()
		{
			(_hostingEnvironment, _defaultProvider) = CreateHostingEnvironment(_hostConfiguration);
		}

		internal static (HostingEnvironment, PhysicalFileProvider) CreateHostingEnvironment(IConfiguration hostConfiguration)
		{
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Expected O, but got Unknown
			HostingEnvironment hostingEnvironment = new HostingEnvironment
			{
				EnvironmentName = (hostConfiguration[HostDefaults.EnvironmentKey] ?? Environments.Production),
				ContentRootPath = ResolveContentRootPath(hostConfiguration[HostDefaults.ContentRootKey], AppContext.BaseDirectory)
			};
			string text = hostConfiguration[HostDefaults.ApplicationKey];
			if (string.IsNullOrEmpty(text))
			{
				text = Assembly.GetEntryAssembly()?.GetName().Name;
			}
			if (text != null)
			{
				hostingEnvironment.ApplicationName = text;
			}
			PhysicalFileProvider item = (PhysicalFileProvider)(object)(hostingEnvironment.ContentRootFileProvider = (IFileProvider)new PhysicalFileProvider(hostingEnvironment.ContentRootPath));
			return (hostingEnvironment, item);
		}

		internal static string ResolveContentRootPath(string contentRootPath, string basePath)
		{
			if (string.IsNullOrEmpty(contentRootPath))
			{
				return basePath;
			}
			if (Path.IsPathRooted(contentRootPath))
			{
				return contentRootPath;
			}
			return Path.Combine(Path.GetFullPath(basePath), contentRootPath);
		}

		[MemberNotNull("_hostBuilderContext")]
		private void InitializeHostBuilderContext()
		{
			//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_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Expected O, but got Unknown
			_hostBuilderContext = new HostBuilderContext(Properties)
			{
				HostingEnvironment = (IHostEnvironment)(object)_hostingEnvironment,
				Configuration = _hostConfiguration
			};
		}

		[MemberNotNull("_appConfiguration")]
		private void InitializeAppConfiguration()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Expected O, but got Unknown
			IConfigurationBuilder val = ChainedBuilderExtensions.AddConfiguration(FileConfigurationExtensions.SetBasePath((IConfigurationBuilder)new ConfigurationBuilder(), _hostingEnvironment.ContentRootPath), _hostConfiguration, true);
			foreach (Action<HostBuilderContext, IConfigurationBuilder> configureAppConfigAction in _configureAppConfigActions)
			{
				configureAppConfigAction(_hostBuilderContext, val);
			}
			_appConfiguration = (IConfiguration)(object)val.Build();
			_hostBuilderContext.Configuration = _appConfiguration;
		}

		[MemberNotNull("_appServices")]
		internal static void PopulateServiceCollection(IServiceCollection services, HostBuilderContext hostBuilderContext, HostingEnvironment hostingEnvironment, PhysicalFileProvider defaultFileProvider, IConfiguration appConfiguration, Func<IServiceProvider> serviceProviderGetter)
		{
			ServiceCollectionServiceExtensions.AddSingleton<IHostingEnvironment>(services, (IHostingEnvironment)(object)hostingEnvironment);
			ServiceCollectionServiceExtensions.AddSingleton<IHostEnvironment>(services, (IHostEnvironment)(object)hostingEnvironment);
			ServiceCollectionServiceExtensions.AddSingleton<HostBuilderContext>(services, hostBuilderContext);
			ServiceCollectionServiceExtensions.AddSingleton<IConfiguration>(services, (Func<IServiceProvider, IConfiguration>)((IServiceProvider _) => appConfiguration));
			ServiceCollectionServiceExtensions.AddSingleton<IApplicationLifetime>(services, (Func<IServiceProvider, IApplicationLifetime>)((IServiceProvider s) => (IApplicationLifetime)ServiceProviderServiceExtensions.GetRequiredService<IHostApplicationLifetime>(s)));
			ServiceCollectionServiceExtensions.AddSingleton<IHostApplicationLifetime, ApplicationLifetime>(services);
			AddLifetime(services);
			ServiceCollectionServiceExtensions.AddSingleton<IHost>(services, (Func<IServiceProvider, IHost>)delegate
			{
				IServiceProvider serviceProvider = serviceProviderGetter();
				return (IHost)(object)new Microsoft.Extensions.Hosting.Internal.Host(serviceProvider, (IHostEnvironment)(object)hostingEnvironment, defaultFileProvider, ServiceProviderServiceExtensions.GetRequiredService<IHostApplicationLifetime>(serviceProvider), ServiceProviderServiceExtensions.GetRequiredService<ILogger<Microsoft.Extensions.Hosting.Internal.Host>>(serviceProvider), ServiceProviderServiceExtensions.GetRequiredService<IHostLifetime>(serviceProvider), ServiceProviderServiceExtensions.GetRequiredService<IOptions<HostOptions>>(serviceProvider));
			});
			OptionsServiceCollectionExtensions.Configure<HostOptions>(OptionsServiceCollectionExtensions.AddOptions(services), (Action<HostOptions>)delegate(HostOptions options)
			{
				options.Initialize(hostBuilderContext.Configuration);
			});
			LoggingServiceCollectionExtensions.AddLogging(services);
		}

		[MemberNotNull("_appServices")]
		private void InitializeServiceProvider()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Expected O, but got Unknown
			ServiceCollection val = new ServiceCollection();
			PopulateServiceCollection((IServiceCollection)(object)val, _hostBuilderContext, _hostingEnvironment, _defaultProvider, _appConfiguration, () => _appServices);
			foreach (Action<HostBuilderContext, IServiceCollection> configureServicesAction in _configureServicesActions)
			{
				configureServicesAction(_hostBuilderContext, (IServiceCollection)(object)val);
			}
			object containerBuilder = _serviceProviderFactory.CreateBuilder((IServiceCollection)(object)val);
			foreach (IConfigureContainerAdapter configureContainerAction in _configureContainerActions)
			{
				configureContainerAction.ConfigureContainer(_hostBuilderContext, containerBuilder);
			}
			_appServices = _serviceProviderFactory.CreateServiceProvider(containerBuilder);
		}

		internal static IHost ResolveHost(IServiceProvider serviceProvider, DiagnosticListener diagnosticListener)
		{
			if (serviceProvider == null)
			{
				throw new InvalidOperationException(System.SR.NullIServiceProvider);
			}
			ServiceProviderServiceExtensions.GetService<IConfiguration>(serviceProvider);
			IHost requiredService = ServiceProviderServiceExtensions.GetRequiredService<IHost>(serviceProvider);
			if (diagnosticListener.IsEnabled() && ((DiagnosticSource)diagnosticListener).IsEnabled("HostBuilt"))
			{
				Write<IHost>((DiagnosticSource)(object)diagnosticListener, "HostBuilt", requiredService);
			}
			return requiredService;
		}

		private static void AddLifetime(IServiceCollection services)
		{
			ServiceCollectionServiceExtensions.AddSingleton<IHostLifetime, ConsoleLifetime>(services);
		}
	}
	public static class HostingHostBuilderExtensions
	{
		public static IHostBuilder UseEnvironment(this IHostBuilder hostBuilder, string environment)
		{
			string environment2 = environment;
			return hostBuilder.ConfigureHostConfiguration((Action<IConfigurationBuilder>)delegate(IConfigurationBuilder configBuilder)
			{
				System.ThrowHelper.ThrowIfNull(environment2, "environment");
				MemoryConfigurationBuilderExtensions.AddInMemoryCollection(configBuilder, (IEnumerable<KeyValuePair<string, string>>)new KeyValuePair<string, string>[1]
				{
					new KeyValuePair<string, string>(HostDefaults.EnvironmentKey, environment2)
				});
			});
		}

		public static IHostBuilder UseContentRoot(this IHostBuilder hostBuilder, string contentRoot)
		{
			string contentRoot2 = contentRoot;
			return hostBuilder.ConfigureHostConfiguration((Action<IConfigurationBuilder>)delegate(IConfigurationBuilder configBuilder)
			{
				System.ThrowHelper.ThrowIfNull(contentRoot2, "contentRoot");
				MemoryConfigurationBuilderExtensions.AddInMemoryCollection(configBuilder, (IEnumerable<KeyValuePair<string, string>>)new KeyValuePair<string, string>[1]
				{
					new KeyValuePair<string, string>(HostDefaults.ContentRootKey, contentRoot2)
				});
			});
		}

		[RequiresDynamicCode("Hosting uses Microsoft.Extensions.DependencyInjection, which may require generating code dynamically at runtime.")]
		public static IHostBuilder UseDefaultServiceProvider(this IHostBuilder hostBuilder, Action<ServiceProviderOptions> configure)
		{
			Action<ServiceProviderOptions> configure2 = configure;
			return hostBuilder.UseDefaultServiceProvider(delegate(HostBuilderContext context, ServiceProviderOptions options)
			{
				configure2(options);
			});
		}

		[RequiresDynamicCode("Hosting uses Microsoft.Extensions.DependencyInjection, which may require generating code dynamically at runtime.")]
		public static IHostBuilder UseDefaultServiceProvider(this IHostBuilder hostBuilder, Action<HostBuilderContext, ServiceProviderOptions> configure)
		{
			Action<HostBuilderContext, ServiceProviderOptions> configure2 = configure;
			return hostBuilder.UseServiceProviderFactory<IServiceCollection>((Func<HostBuilderContext, IServiceProviderFactory<IServiceCollection>>)delegate(HostBuilderContext context)
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				//IL_0006: Expected O, but got Unknown
				//IL_0014: Unknown result type (might be due to invalid IL or missing references)
				//IL_001a: Expected O, but got Unknown
				ServiceProviderOptions val = new ServiceProviderOptions();
				configure2(context, val);
				return (IServiceProviderFactory<IServiceCollection>)new DefaultServiceProviderFactory(val);
			});
		}

		public static IHostBuilder ConfigureLogging(this IHostBuilder hostBuilder, Action<HostBuilderContext, ILoggingBuilder> configureLogging)
		{
			Action<HostBuilderContext, ILoggingBuilder> configureLogging2 = configureLogging;
			return hostBuilder.ConfigureServices((Action<HostBuilderContext, IServiceCollection>)delegate(HostBuilderContext context, IServiceCollection collection)
			{
				LoggingServiceCollectionExtensions.AddLogging(collection, (Action<ILoggingBuilder>)delegate(ILoggingBuilder builder)
				{
					configureLogging2(context, builder);
				});
			});
		}

		public static IHostBuilder ConfigureLogging(this IHostBuilder hostBuilder, Action<ILoggingBuilder> configureLogging)
		{
			Action<ILoggingBuilder> configureLogging2 = configureLogging;
			return hostBuilder.ConfigureServices((Action<HostBuilderContext, IServiceCollection>)delegate(HostBuilderContext context, IServiceCollection collection)
			{
				LoggingServiceCollectionExtensions.AddLogging(collection, (Action<ILoggingBuilder>)delegate(ILoggingBuilder builder)
				{
					configureLogging2(builder);
				});
			});
		}

		public static IHostBuilder ConfigureHostOptions(this IHostBuilder hostBuilder, Action<HostBuilderContext, HostOptions> configureOptions)
		{
			Action<HostBuilderContext, HostOptions> configureOptions2 = configureOptions;
			return hostBuilder.ConfigureServices((Action<HostBuilderContext, IServiceCollection>)delegate(HostBuilderContext context, IServiceCollection collection)
			{
				OptionsServiceCollectionExtensions.Configure<HostOptions>(collection, (Action<HostOptions>)delegate(HostOptions options)
				{
					configureOptions2(context, options);
				});
			});
		}

		public static IHostBuilder ConfigureHostOptions(this IHostBuilder hostBuilder, Action<HostOptions> configureOptions)
		{
			Action<HostOptions> configureOptions2 = configureOptions;
			return hostBuilder.ConfigureServices(delegate(IServiceCollection collection)
			{
				OptionsServiceCollectionExtensions.Configure<HostOptions>(collection, configureOptions2);
			});
		}

		public static IHostBuilder ConfigureAppConfiguration(this IHostBuilder hostBuilder, Action<IConfigurationBuilder> configureDelegate)
		{
			Action<IConfigurationBuilder> configureDelegate2 = configureDelegate;
			return hostBuilder.ConfigureAppConfiguration((Action<HostBuilderContext, IConfigurationBuilder>)delegate(HostBuilderContext context, IConfigurationBuilder builder)
			{
				configureDelegate2(builder);
			});
		}

		public static IHostBuilder ConfigureServices(this IHostBuilder hostBuilder, Action<IServiceCollection> configureDelegate)
		{
			Action<IServiceCollection> configureDelegate2 = configureDelegate;
			return hostBuilder.ConfigureServices((Action<HostBuilderContext, IServiceCollection>)delegate(HostBuilderContext context, IServiceCollection collection)
			{
				configureDelegate2(collection);
			});
		}

		public static IHostBuilder ConfigureContainer<TContainerBuilder>(this IHostBuilder hostBuilder, Action<TContainerBuilder> configureDelegate)
		{
			Action<TContainerBuilder> configureDelegate2 = configureDelegate;
			return hostBuilder.ConfigureContainer<TContainerBuilder>((Action<HostBuilderContext, TContainerBuilder>)delegate(HostBuilderContext context, TContainerBuilder builder)
			{
				configureDelegate2(builder);
			});
		}

		[RequiresDynamicCode("Hosting uses Microsoft.Extensions.DependencyInjection, which may require generating code dynamically at runtime.")]
		public static IHostBuilder ConfigureDefaults(this IHostBuilder builder, string[]? args)
		{
			string[] args2 = args;
			return builder.ConfigureHostConfiguration((Action<IConfigurationBuilder>)delegate(IConfigurationBuilder config)
			{
				ApplyDefaultHostConfiguration(config, args2);
			}).ConfigureAppConfiguration((Action<HostBuilderContext, IConfigurationBuilder>)delegate(HostBuilderContext hostingContext, IConfigurationBuilder config)
			{
				ApplyDefaultAppConfiguration(hostingContext, config, args2);
			}).ConfigureServices((Action<HostBuilderContext, IServiceCollection>)AddDefaultServices)
				.UseServiceProviderFactory<IServiceCollection>((Func<HostBuilderContext, IServiceProviderFactory<IServiceCollection>>)((HostBuilderContext context) => (IServiceProviderFactory<IServiceCollection>)new DefaultServiceProviderFactory(CreateDefaultServiceProviderOptions(context))));
		}

		private static void ApplyDefaultHostConfiguration(IConfigurationBuilder hostConfigBuilder, string[] args)
		{
			SetDefaultContentRoot(hostConfigBuilder);
			AddDefaultHostConfigurationSources(hostConfigBuilder, args);
		}

		internal static void SetDefaultContentRoot(IConfigurationBuilder hostConfigBuilder)
		{
			string currentDirectory = Environment.CurrentDirectory;
			if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows) || !string.Equals(currentDirectory, Environment.GetFolderPath(Environment.SpecialFolder.System), StringComparison.OrdinalIgnoreCase))
			{
				MemoryConfigurationBuilderExtensions.AddInMemoryCollection(hostConfigBuilder, (IEnumerable<KeyValuePair<string, string>>)new KeyValuePair<string, string>[1]
				{
					new KeyValuePair<string, string>(HostDefaults.ContentRootKey, currentDirectory)
				});
			}
		}

		internal static void AddDefaultHostConfigurationSources(IConfigurationBuilder hostConfigBuilder, string[] args)
		{
			EnvironmentVariablesExtensions.AddEnvironmentVariables(hostConfigBuilder, "DOTNET_");
			if (args != null && args.Length > 0)
			{
				CommandLineConfigurationExtensions.AddCommandLine(hostConfigBuilder, args);
			}
		}

		internal static void ApplyDefaultAppConfiguration(HostBuilderContext hostingContext, IConfigurationBuilder appConfigBuilder, string[] args)
		{
			IHostEnvironment hostingEnvironment = hostingContext.HostingEnvironment;
			bool flag = GetReloadConfigOnChangeValue(hostingContext);
			JsonConfigurationExtensions.AddJsonFile(JsonConfigurationExtensions.AddJsonFile(appConfigBuilder, "appsettings.json", true, flag), "appsettings." + hostingEnvironment.EnvironmentName + ".json", true, flag);
			if (HostEnvironmentEnvExtensions.IsDevelopment(hostingEnvironment))
			{
				string applicationName = hostingEnvironment.ApplicationName;
				if (applicationName != null && applicationName.Length > 0)
				{
					Assembly assembly = Assembly.Load(new AssemblyName(hostingEnvironment.ApplicationName));
					if ((object)assembly != null)
					{
						UserSecretsConfigurationExtensions.AddUserSecrets(appConfigBuilder, assembly, true, flag);
					}
				}
			}
			EnvironmentVariablesExtensions.AddEnvironmentVariables(appConfigBuilder);
			if (args != null && args.Length > 0)
			{
				CommandLineConfigurationExtensions.AddCommandLine(appConfigBuilder, args);
			}
			[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode", Justification = "Calling IConfiguration.GetValue is safe when the T is bool.")]
			static bool GetReloadConfigOnChangeValue(HostBuilderContext hostingContext)
			{
				return ConfigurationBinder.GetValue<bool>(hostingContext.Configuration, "hostBuilder:reloadConfigOnChange", true);
			}
		}

		internal static void AddDefaultServices(HostBuilderContext hostingContext, IServiceCollection services)
		{
			LoggingServiceCollectionExtensions.AddLogging(services, (Action<ILoggingBuilder>)delegate(ILoggingBuilder logging)
			{
				bool flag = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
				if (flag)
				{
					FilterLoggingBuilderExtensions.AddFilter<EventLogLoggerProvider>(logging, (Func<LogLevel, bool>)((LogLevel level) => (int)level >= 3));
				}
				LoggingBuilderExtensions.AddConfiguration(logging, (IConfiguration)(object)hostingContext.Configuration.GetSection("Logging"));
				ConsoleLoggerExtensions.AddConsole(logging);
				DebugLoggerFactoryExtensions.AddDebug(logging);
				EventSourceLoggerFactoryExtensions.AddEventSourceLogger(logging);
				if (flag)
				{
					EventLoggerFactoryExtensions.AddEventLog(logging);
				}
				LoggingBuilderExtensions.Configure(logging, (Action<LoggerFactoryOptions>)delegate(LoggerFactoryOptions options)
				{
					options.ActivityTrackingOptions = (ActivityTrackingOptions)7;
				});
			});
		}

		internal static ServiceProviderOptions CreateDefaultServiceProviderOptions(HostBuilderContext context)
		{
			//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)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected O, but got Unknown
			bool flag = HostEnvironmentEnvExtensions.IsDevelopment(context.HostingEnvironment);
			return new ServiceProviderOptions
			{
				ValidateScopes = flag,
				ValidateOnBuild = flag
			};
		}

		[UnsupportedOSPlatform("android")]
		[UnsupportedOSPlatform("browser")]
		[UnsupportedOSPlatform("ios")]
		[UnsupportedOSPlatform("tvos")]
		public static IHostBuilder UseConsoleLifetime(this IHostBuilder hostBuilder)
		{
			return hostBuilder.ConfigureServices(delegate(IServiceCollection collection)
			{
				ServiceCollectionServiceExtensions.AddSingleton<IHostLifetime, ConsoleLifetime>(collection);
			});
		}

		[UnsupportedOSPlatform("android")]
		[UnsupportedOSPlatform("browser")]
		[UnsupportedOSPlatform("ios")]
		[UnsupportedOSPlatform("tvos")]
		public static IHostBuilder UseConsoleLifetime(this IHostBuilder hostBuilder, Action<ConsoleLifetimeOptions> configureOptions)
		{
			Action<ConsoleLifetimeOptions> configureOptions2 = configureOptions;
			return hostBuilder.ConfigureServices(delegate(IServiceCollection collection)
			{
				ServiceCollectionServiceExtensions.AddSingleton<IHostLifetime, ConsoleLifetime>(collection);
				OptionsServiceCollectionExtensions.Configure<ConsoleLifetimeOptions>(collection, configureOptions2);
			});
		}

		[UnsupportedOSPlatform("android")]
		[UnsupportedOSPlatform("browser")]
		[UnsupportedOSPlatform("ios")]
		[UnsupportedOSPlatform("tvos")]
		public static Task RunConsoleAsync(this IHostBuilder hostBuilder, CancellationToken cancellationToken = default(CancellationToken))
		{
			return HostingAbstractionsHostExtensions.RunAsync(hostBuilder.UseConsoleLifetime().Build(), cancellationToken);
		}

		[UnsupportedOSPlatform("android")]
		[UnsupportedOSPlatform("browser")]
		[UnsupportedOSPlatform("ios")]
		[UnsupportedOSPlatform("tvos")]
		public static Task RunConsoleAsync(this IHostBuilder hostBuilder, Action<ConsoleLifetimeOptions> configureOptions, CancellationToken cancellationToken = default(CancellationToken))
		{
			return HostingAbstractionsHostExtensions.RunAsync(hostBuilder.UseConsoleLifetime(configureOptions).Build(), cancellationToken);
		}
	}
	public class HostOptions
	{
		public TimeSpan ShutdownTimeout { get; set; } = TimeSpan.FromSeconds(30.0);


		public BackgroundServiceExceptionBehavior BackgroundServiceExceptionBehavior { get; set; }

		internal void Initialize(IConfiguration configuration)
		{
			string text = configuration["shutdownTimeoutSeconds"];
			if (!string.IsNullOrEmpty(text) && int.TryParse(text, NumberStyles.None, CultureInfo.InvariantCulture, out var result))
			{
				ShutdownTimeout = TimeSpan.FromSeconds(result);
			}
		}
	}
}
namespace Microsoft.Extensions.Hosting.Internal
{
	public class ApplicationLifetime : IApplicationLifetime, IHostApplicationLifetime
	{
		private readonly CancellationTokenSource _startedSource = new CancellationTokenSource();

		private readonly CancellationTokenSource _stoppingSource = new CancellationTokenSource();

		private readonly CancellationTokenSource _stoppedSource = new CancellationTokenSource();

		private readonly ILogger<ApplicationLifetime> _logger;

		public CancellationToken ApplicationStarted => _startedSource.Token;

		public CancellationToken ApplicationStopping => _stoppingSource.Token;

		public CancellationToken ApplicationStopped => _stoppedSource.Token;

		public ApplicationLifetime(ILogger<ApplicationLifetime> logger)
		{
			_logger = logger;
		}

		public void StopApplication()
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			lock (_stoppingSource)
			{
				try
				{
					ExecuteHandlers(_stoppingSource);
				}
				catch (Exception exception)
				{
					((ILogger)(object)_logger).ApplicationError(LoggerEventIds.ApplicationStoppingException, "An error occurred stopping the application", exception);
				}
			}
		}

		public void NotifyStarted()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				ExecuteHandlers(_startedSource);
			}
			catch (Exception exception)
			{
				((ILogger)(object)_logger).ApplicationError(LoggerEventIds.ApplicationStartupException, "An error occurred starting the application", exception);
			}
		}

		public void NotifyStopped()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				ExecuteHandlers(_stoppedSource);
			}
			catch (Exception exception)
			{
				((ILogger)(object)_logger).ApplicationError(LoggerEventIds.ApplicationStoppedException, "An error occurred stopping the application", exception);
			}
		}

		private static void ExecuteHandlers(CancellationTokenSource cancel)
		{
			if (!cancel.IsCancellationRequested)
			{
				cancel.Cancel(throwOnFirstException: false);
			}
		}
	}
	internal sealed class ConfigureContainerAdapter<TContainerBuilder> : IConfigureContainerAdapter
	{
		private Action<HostBuilderContext, TContainerBuilder> _action;

		public ConfigureContainerAdapter(Action<HostBuilderContext, TContainerBuilder> action)
		{
			System.ThrowHelper.ThrowIfNull(action, "action");
			_action = action;
		}

		public void ConfigureContainer(HostBuilderContext hostContext, object containerBuilder)
		{
			_action(hostContext, (TContainerBuilder)containerBuilder);
		}
	}
	[UnsupportedOSPlatform("android")]
	[UnsupportedOSPlatform("browser")]
	[UnsupportedOSPlatform("ios")]
	[UnsupportedOSPlatform("tvos")]
	public class ConsoleLifetime : IHostLifetime, IDisposable
	{
		private CancellationTokenRegistration _applicationStartedRegistration;

		private CancellationTokenRegistration _applicationStoppingRegistration;

		private readonly ManualResetEvent _shutdownBlock = new ManualResetEvent(initialState: false);

		private ConsoleLifetimeOptions Options { get; }

		private IHostEnvironment Environment { get; }

		private IHostApplicationLifetime ApplicationLifetime { get; }

		private HostOptions HostOptions { get; }

		private ILogger Logger { get; }

		public ConsoleLifetime(IOptions<ConsoleLifetimeOptions> options, IHostEnvironment environment, IHostApplicationLifetime applicationLifetime, IOptions<HostOptions> hostOptions)
			: this(options, environment, applicationLifetime, hostOptions, (ILoggerFactory)(object)NullLoggerFactory.Instance)
		{
		}

		public ConsoleLifetime(IOptions<ConsoleLifetimeOptions> options, IHostEnvironment environment, IHostApplicationLifetime applicationLifetime, IOptions<HostOptions> hostOptions, ILoggerFactory loggerFactory)
		{
			System.ThrowHelper.ThrowIfNull(options?.Value, "options");
			System.ThrowHelper.ThrowIfNull(applicationLifetime, "applicationLifetime");
			System.ThrowHelper.ThrowIfNull(environment, "environment");
			System.ThrowHelper.ThrowIfNull(hostOptions?.Value, "hostOptions");
			Options = options.Value;
			Environment = environment;
			ApplicationLifetime = applicationLifetime;
			HostOptions = hostOptions.Value;
			Logger = loggerFactory.CreateLogger("Microsoft.Hosting.Lifetime");
		}

		public Task WaitForStartAsync(CancellationToken cancellationToken)
		{
			if (!Options.SuppressStatusMessages)
			{
				_applicationStartedRegistration = ApplicationLifetime.ApplicationStarted.Register(delegate(object state)
				{
					((ConsoleLifetime)state).OnApplicationStarted();
				}, this);
				_applicationStoppingRegistration = ApplicationLifetime.ApplicationStopping.Register(delegate(object state)
				{
					((ConsoleLifetime)state).OnApplicationStopping();
				}, this);
			}
			RegisterShutdownHandlers();
			return Task.CompletedTask;
		}

		private void RegisterShutdownHandlers()
		{
			AppDomain.CurrentDomain.ProcessExit += OnProcessExit;
			Console.CancelKeyPress += OnCancelKeyPress;
		}

		private void OnApplicationStarted()
		{
			LoggerExtensions.LogInformation(Logger, "Application started. Press Ctrl+C to shut down.", Array.Empty<object>());
			LoggerExtensions.LogInformation(Logger, "Hosting environment: {EnvName}", new object[1] { Environment.EnvironmentName });
			LoggerExtensions.LogInformation(Logger, "Content root path: {ContentRoot}", new object[1] { Environment.ContentRootPath });
		}

		private void OnApplicationStopping()
		{
			LoggerExtensions.LogInformation(Logger, "Application is shutting down...", Array.Empty<object>());
		}

		public Task StopAsync(CancellationToken cancellationToken)
		{
			return Task.CompletedTask;
		}

		public void Dispose()
		{
			UnregisterShutdownHandlers();
			_applicationStartedRegistration.Dispose();
			_applicationStoppingRegistration.Dispose();
		}

		private void UnregisterShutdownHandlers()
		{
			_shutdownBlock.Set();
			AppDomain.CurrentDomain.ProcessExit -= OnProcessExit;
			Console.CancelKeyPress -= OnCancelKeyPress;
		}

		private void OnCancelKeyPress(object sender, ConsoleCancelEventArgs e)
		{
			e.Cancel = true;
			ApplicationLifetime.StopApplication();
			_shutdownBlock.Set();
		}

		private void OnProcessExit(object sender, EventArgs e)
		{
			ApplicationLifetime.StopApplication();
			if (!_shutdownBlock.WaitOne(HostOptions.ShutdownTimeout))
			{
				LoggerExtensions.LogInformation(Logger, "Waiting for the host to be disposed. Ensure all 'IHost' instances are wrapped in 'using' blocks.", Array.Empty<object>());
			}
			_shutdownBlock.WaitOne(HostOptions.ShutdownTimeout);
			System.Environment.ExitCode = 0;
		}
	}
	internal sealed class Host : IHost, IDisposable, IAsyncDisposable
	{
		private readonly ILogger<Host> _logger;

		private readonly IHostLifetime _hostLifetime;

		private readonly ApplicationLifetime _applicationLifetime;

		private readonly HostOptions _options;

		private readonly IHostEnvironment _hostEnvironment;

		private readonly PhysicalFileProvider _defaultProvider;

		private IEnumerable<IHostedService> _hostedServices;

		private volatile bool _stopCalled;

		public IServiceProvider Services { get; }

		public Host(IServiceProvider services, IHostEnvironment hostEnvironment, PhysicalFileProvider defaultProvider, IHostApplicationLifetime applicationLifetime, ILogger<Host> logger, IHostLifetime hostLifetime, IOptions<HostOptions> options)
		{
			System.ThrowHelper.ThrowIfNull(services, "services");
			System.ThrowHelper.ThrowIfNull(applicationLifetime, "applicationLifetime");
			System.ThrowHelper.ThrowIfNull(logger, "logger");
			System.ThrowHelper.ThrowIfNull(hostLifetime, "hostLifetime");
			Services = services;
			_applicationLifetime = applicationLifetime as ApplicationLifetime;
			_hostEnvironment = hostEnvironment;
			_defaultProvider = defaultProvider;
			if (_applicationLifetime == null)
			{
				throw new ArgumentException(System.SR.IHostApplicationLifetimeReplacementNotSupported, "applicationLifetime");
			}
			_logger = logger;
			_hostLifetime = hostLifetime;
			_options = options?.Value ?? throw new ArgumentNullException("options");
		}

		public async Task StartAsync(CancellationToken cancellationToken = default(CancellationToken))
		{
			((ILogger)(object)_logger).Starting();
			using CancellationTokenSource combinedCancellationTokenSource = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, _applicationLifetime.ApplicationStopping);
			CancellationToken combinedCancellationToken = combinedCancellationTokenSource.Token;
			await _hostLifetime.WaitForStartAsync(combinedCancellationToken).ConfigureAwait(continueOnCapturedContext: false);
			combinedCancellationToken.ThrowIfCancellationRequested();
			_hostedServices = ServiceProviderServiceExtensions.GetRequiredService<IEnumerable<IHostedService>>(Services);
			foreach (IHostedService hostedService in _hostedServices)
			{
				await hostedService.StartAsync(combinedCancellationToken).ConfigureAwait(continueOnCapturedContext: false);
				BackgroundService val = (BackgroundService)(object)((hostedService is BackgroundService) ? hostedService : null);
				if (val != null)
				{
					TryExecuteBackgroundServiceAsync(val);
				}
			}
			_applicationLifetime.NotifyStarted();
			((ILogger)(object)_logger).Started();
		}

		private async Task TryExecuteBackgroundServiceAsync(BackgroundService backgroundService)
		{
			Task backgroundTask = backgroundService.ExecuteTask;
			if (backgroundTask == null)
			{
				return;
			}
			try
			{
				await backgroundTask.ConfigureAwait(continueOnCapturedContext: false);
			}
			catch (Exception ex)
			{
				if (!_stopCalled || !backgroundTask.IsCanceled || !(ex is OperationCanceledException))
				{
					((ILogger)(object)_logger).BackgroundServiceFaulted(ex);
					if (_options.BackgroundServiceExceptionBehavior == BackgroundServiceExceptionBehavior.StopHost)
					{
						((ILogger)(object)_logger).BackgroundServiceStoppingHost(ex);
						_applicationLifetime.StopApplication();
					}
				}
			}
		}

		public async Task StopAsync(CancellationToken cancellationToken = default(CancellationToken))
		{
			_stopCalled = true;
			((ILogger)(object)_logger).Stopping();
			using (CancellationTokenSource cts = new CancellationTokenSource(_options.ShutdownTimeout))
			{
				using CancellationTokenSource linkedCts = CancellationTokenSource.CreateLinkedTokenSource(cts.Token, cancellationToken);
				CancellationToken token = linkedCts.Token;
				_applicationLifetime.StopApplication();
				IList<Exception> exceptions = new List<Exception>();
				if (_hostedServices != null)
				{
					foreach (IHostedService item3 in _hostedServices.Reverse())
					{
						try
						{
							await item3.StopAsync(token).ConfigureAwait(continueOnCapturedContext: false);
						}
						catch (Exception item)
						{
							exceptions.Add(item);
						}
					}
				}
				_applicationLifetime.NotifyStopped();
				try
				{
					await _hostLifetime.StopAsync(token).ConfigureAwait(continueOnCapturedContext: false);
				}
				catch (Exception item2)
				{
					exceptions.Add(item2);
				}
				if (exceptions.Count > 0)
				{
					AggregateException ex = new AggregateException("One or more hosted services failed to stop.", exceptions);
					((ILogger)(object)_logger).StoppedWithException(ex);
					throw ex;
				}
			}
			((ILogger)(object)_logger).Stopped();
		}

		public void Dispose()
		{
			DisposeAsync().AsTask().GetAwaiter().GetResult();
		}

		public async ValueTask DisposeAsync()
		{
			if (_hostEnvironment.ContentRootFileProvider != _defaultProvider)
			{
				await DisposeAsync(_hostEnvironment.ContentRootFileProvider).ConfigureAwait(continueOnCapturedContext: false);
				await DisposeAsync(_defaultProvider).ConfigureAwait(continueOnCapturedContext: false);
			}
			else
			{
				await DisposeAsync(_hostEnvironment.ContentRootFileProvider).ConfigureAwait(continueOnCapturedContext: false);
			}
			await DisposeAsync(Services).ConfigureAwait(continueOnCapturedContext: false);
			static async ValueTask DisposeAsync(object o)
			{
				if (!(o is IAsyncDisposable asyncDisposable))
				{
					if (o is IDisposable disposable)
					{
						disposable.Dispose();
					}
				}
				else
				{
					await asyncDisposable.DisposeAsync().ConfigureAwait(continueOnCapturedContext: false);
				}
			}
		}
	}
	public class HostingEnvironment : IHostingEnvironment, IHostEnvironment
	{
		public string EnvironmentName { get; set; } = string.Empty;


		public string ApplicationName { get; set; } = string.Empty;


		public string ContentRootPath { get; set; } = string.Empty;


		public IFileProvider ContentRootFileProvider { get; set; }
	}
	internal static class HostingLoggerExtensions
	{
		public static void ApplicationError(this ILogger logger, EventId eventId, string message, Exception exception)
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			if (exception is ReflectionTypeLoadException ex)
			{
				Exception[] loaderExceptions = ex.LoaderExceptions;
				foreach (Exception ex2 in loaderExceptions)
				{
					if (ex2 != null)
					{
						message = message + Environment.NewLine + ex2.Message;
					}
				}
			}
			string text = message;
			LoggerExtensions.LogCritical(logger, eventId, exception, text, Array.Empty<object>());
		}

		public static void Starting(this ILogger logger)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			if (logger.IsEnabled((LogLevel)1))
			{
				LoggerExtensions.LogDebug(logger, LoggerEventIds.Starting, "Hosting starting", Array.Empty<object>());
			}
		}

		public static void Started(this ILogger logger)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			if (logger.IsEnabled((LogLevel)1))
			{
				LoggerExtensions.LogDebug(logger, LoggerEventIds.Started, "Hosting started", Array.Empty<object>());
			}
		}

		public static void Stopping(this ILogger logger)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			if (logger.IsEnabled((LogLevel)1))
			{
				LoggerExtensions.LogDebug(logger, LoggerEventIds.Stopping, "Hosting stopping", Array.Empty<object>());
			}
		}

		public static void Stopped(this ILogger logger)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			if (logger.IsEnabled((LogLevel)1))
			{
				LoggerExtensions.LogDebug(logger, LoggerEventIds.Stopped, "Hosting stopped", Array.Empty<object>());
			}
		}

		public static void StoppedWithException(this ILogger logger, Exception ex)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			if (logger.IsEnabled((LogLevel)1))
			{
				LoggerExtensions.LogDebug(logger, LoggerEventIds.StoppedWithException, ex, "Hosting shutdown exception", Array.Empty<object>());
			}
		}

		public static void BackgroundServiceFaulted(this ILogger logger, Exception ex)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			if (logger.IsEnabled((LogLevel)4))
			{
				LoggerExtensions.LogError(logger, LoggerEventIds.BackgroundServiceFaulted, ex, "BackgroundService failed", Array.Empty<object>());
			}
		}

		public static void BackgroundServiceStoppingHost(this ILogger logger, Exception ex)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			if (logger.IsEnabled((LogLevel)5))
			{
				LoggerExtensions.LogCritical(logger, LoggerEventIds.BackgroundServiceStoppingHost, ex, System.SR.BackgroundServiceExceptionStoppedHost, Array.Empty<object>());
			}
		}
	}
	internal interface IConfigureContainerAdapter
	{
		void ConfigureContainer(HostBuilderContext hostContext, object containerBuilder);
	}
	internal interface IServiceFactoryAdapter
	{
		object CreateBuilder(IServiceCollection services);

		IServiceProvider CreateServiceProvider(object containerBuilder);
	}
	internal static class LoggerEventIds
	{
		public static readonly EventId Starting = new EventId(1, "Starting");

		public static readonly EventId Started = new EventId(2, "Started");

		public static readonly EventId Stopping = new EventId(3, "Stopping");

		public static readonly EventId Stopped = new EventId(4, "Stopped");

		public static readonly EventId StoppedWithException = new EventId(5, "StoppedWithException");

		public static readonly EventId ApplicationStartupException = new EventId(6, "ApplicationStartupException");

		public static readonly EventId ApplicationStoppingException = new EventId(7, "ApplicationStoppingException");

		public static readonly EventId ApplicationStoppedException = new EventId(8, "ApplicationStoppedException");

		public static readonly EventId BackgroundServiceFaulted = new EventId(9, "BackgroundServiceFaulted");

		public static readonly EventId BackgroundServiceStoppingHost = new EventId(10, "BackgroundServiceStoppingHost");
	}
	internal sealed class NullLifetime : IHostLifetime
	{
		public Task WaitForStartAsync(CancellationToken cancellationToken)
		{
			return Task.CompletedTask;
		}

		public Task StopAsync(CancellationToken cancellationToken)
		{
			return Task.CompletedTask;
		}
	}
	internal sealed class ServiceFactoryAdapter<TContainerBuilder> : IServiceFactoryAdapter
	{
		private IServiceProviderFactory<TContainerBuilder> _serviceProviderFactory;

		private readonly Func<HostBuilderContext> _contextResolver;

		private Func<HostBuilderContext, IServiceProviderFactory<TContainerBuilder>> _factoryResolver;

		public ServiceFactoryAdapter(IServiceProviderFactory<TContainerBuilder> serviceProviderFactory)
		{
			System.ThrowHelper.ThrowIfNull(serviceProviderFactory, "serviceProviderFactory");
			_serviceProviderFactory = serviceProviderFactory;
		}

		public ServiceFactoryAdapter(Func<HostBuilderContext> contextResolver, Func<HostBuilderContext, IServiceProviderFactory<TContainerBuilder>> factoryResolver)
		{
			System.ThrowHelper.ThrowIfNull(contextResolver, "contextResolver");
			System.ThrowHelper.ThrowIfNull(factoryResolver, "factoryResolver");
			_contextResolver = contextResolver;
			_factoryResolver = factoryResolver;
		}

		public object CreateBuilder(IServiceCollection services)
		{
			if (_serviceProviderFactory == null)
			{
				_serviceProviderFactory = _factoryResolver(_contextResolver());
				if (_serviceProviderFactory == null)
				{
					throw new InvalidOperationException(System.SR.ResolverReturnedNull);
				}
			}
			return _serviceProviderFactory.CreateBuilder(services);
		}

		public IServiceProvider CreateServiceProvider(object containerBuilder)
		{
			if (_serviceProviderFactory == null)
			{
				throw new InvalidOperationException(System.SR.CreateBuilderCallBeforeCreateServiceProvider);
			}
			return _serviceProviderFactory.CreateServiceProvider((TContainerBuilder)containerBuilder);
		}
	}
}

BepInEx/plugins/SlopCrew.Plugin/Microsoft.Extensions.Logging.Abstractions.dll

Decompiled 8 months ago
using System;
using System.Buffers;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Threading;
using FxResources.Microsoft.Extensions.Logging.Abstractions;
using Microsoft.CodeAnalysis;
using Microsoft.Extensions.Internal;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: InternalsVisibleTo("Microsoft.Extensions.Logging.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: AssemblyMetadata(".NETFrameworkAssembly", "")]
[assembly: AssemblyMetadata("Serviceable", "True")]
[assembly: AssemblyMetadata("PreferInbox", "True")]
[assembly: AssemblyDefaultAlias("Microsoft.Extensions.Logging.Abstractions")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: CLSCompliant(true)]
[assembly: AssemblyMetadata("IsTrimmable", "True")]
[assembly: DefaultDllImportSearchPaths(DllImportSearchPath.System32 | DllImportSearchPath.AssemblyDirectory)]
[assembly: AssemblyCompany("Microsoft Corporation")]
[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")]
[assembly: AssemblyDescription("Logging abstractions for Microsoft.Extensions.Logging.\r\n\r\nCommonly Used Types:\r\nMicrosoft.Extensions.Logging.ILogger\r\nMicrosoft.Extensions.Logging.ILoggerFactory\r\nMicrosoft.Extensions.Logging.ILogger<TCategoryName>\r\nMicrosoft.Extensions.Logging.LogLevel\r\nMicrosoft.Extensions.Logging.Logger<T>\r\nMicrosoft.Extensions.Logging.LoggerMessage\r\nMicrosoft.Extensions.Logging.Abstractions.NullLogger")]
[assembly: AssemblyFileVersion("7.0.22.51805")]
[assembly: AssemblyInformationalVersion("7.0.0+d099f075e45d2aa6007a22b71b45a08758559f80")]
[assembly: AssemblyProduct("Microsoft® .NET")]
[assembly: AssemblyTitle("Microsoft.Extensions.Logging.Abstractions")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/dotnet/runtime")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("7.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: System.Runtime.CompilerServices.NullablePublicOnly(true)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class IsReadOnlyAttribute : Attribute
	{
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class IsByRefLikeAttribute : Attribute
	{
	}
	[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 NullablePublicOnlyAttribute : Attribute
	{
		public readonly bool IncludesInternals;

		public NullablePublicOnlyAttribute(bool P_0)
		{
			IncludesInternals = 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 FxResources.Microsoft.Extensions.Logging.Abstractions
{
	internal static class SR
	{
	}
}
namespace System
{
	internal static class ThrowHelper
	{
		internal static void ThrowIfNull(object? argument, [CallerArgumentExpression("argument")] string? paramName = null)
		{
			if (argument == null)
			{
				Throw(paramName);
			}
		}

		private static void Throw(string paramName)
		{
			throw new ArgumentNullException(paramName);
		}
	}
	internal static class SR
	{
		private static readonly bool s_usingResourceKeys = AppContext.TryGetSwitch("System.Resources.UseSystemResourceKeys", out var isEnabled) && isEnabled;

		private static ResourceManager s_resourceManager;

		internal static ResourceManager ResourceManager => s_resourceManager ?? (s_resourceManager = new ResourceManager(typeof(SR)));

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

		private static bool UsingResourceKeys()
		{
			return s_usingResourceKeys;
		}

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

		internal static string GetResourceString(string resourceKey, string defaultString)
		{
			string resourceString = GetResourceString(resourceKey);
			if (!(resourceKey == resourceString) && resourceString != null)
			{
				return resourceString;
			}
			return defaultString;
		}

		internal static string Format(string resourceFormat, object? p1)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1);
			}
			return string.Format(resourceFormat, p1);
		}

		internal static string Format(string resourceFormat, object? p1, object? p2)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2);
			}
			return string.Format(resourceFormat, p1, p2);
		}

		internal static string Format(string resourceFormat, object? p1, object? p2, object? p3)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2, p3);
			}
			return string.Format(resourceFormat, p1, p2, p3);
		}

		internal static string Format(string resourceFormat, params object?[]? args)
		{
			if (args != null)
			{
				if (UsingResourceKeys())
				{
					return resourceFormat + ", " + string.Join(", ", args);
				}
				return string.Format(resourceFormat, args);
			}
			return resourceFormat;
		}

		internal static string Format(IFormatProvider? provider, string resourceFormat, object? p1)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1);
			}
			return string.Format(provider, resourceFormat, p1);
		}

		internal static string Format(IFormatProvider? provider, string resourceFormat, object? p1, object? p2)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2);
			}
			return string.Format(provider, resourceFormat, p1, p2);
		}

		internal static string Format(IFormatProvider? provider, string resourceFormat, object? p1, object? p2, object? p3)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2, p3);
			}
			return string.Format(provider, resourceFormat, p1, p2, p3);
		}

		internal static string Format(IFormatProvider? provider, string resourceFormat, params object?[]? args)
		{
			if (args != null)
			{
				if (UsingResourceKeys())
				{
					return resourceFormat + ", " + string.Join(", ", args);
				}
				return string.Format(provider, resourceFormat, args);
			}
			return resourceFormat;
		}
	}
}
namespace System.Diagnostics.CodeAnalysis
{
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)]
	internal sealed class AllowNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)]
	internal sealed class DisallowNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)]
	internal sealed class MaybeNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)]
	internal sealed class NotNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class MaybeNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public MaybeNullWhenAttribute(bool returnValue)
		{
			ReturnValue = returnValue;
		}
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class NotNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public NotNullWhenAttribute(bool returnValue)
		{
			ReturnValue = returnValue;
		}
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = true, Inherited = false)]
	internal sealed class NotNullIfNotNullAttribute : Attribute
	{
		public string ParameterName { get; }

		public NotNullIfNotNullAttribute(string parameterName)
		{
			ParameterName = parameterName;
		}
	}
	[AttributeUsage(AttributeTargets.Method, Inherited = false)]
	internal sealed class DoesNotReturnAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class DoesNotReturnIfAttribute : Attribute
	{
		public bool ParameterValue { get; }

		public DoesNotReturnIfAttribute(bool parameterValue)
		{
			ParameterValue = parameterValue;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	internal sealed class MemberNotNullAttribute : Attribute
	{
		public string[] Members { get; }

		public MemberNotNullAttribute(string member)
		{
			Members = new string[1] { member };
		}

		public MemberNotNullAttribute(params string[] members)
		{
			Members = members;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	internal sealed class MemberNotNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public string[] Members { get; }

		public MemberNotNullWhenAttribute(bool returnValue, string member)
		{
			ReturnValue = returnValue;
			Members = new string[1] { member };
		}

		public MemberNotNullWhenAttribute(bool returnValue, params string[] members)
		{
			ReturnValue = returnValue;
			Members = members;
		}
	}
}
namespace System.Runtime.InteropServices
{
	[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
	internal sealed class LibraryImportAttribute : Attribute
	{
		public string LibraryName { get; }

		public string? EntryPoint { get; set; }

		public StringMarshalling StringMarshalling { get; set; }

		public Type? StringMarshallingCustomType { get; set; }

		public bool SetLastError { get; set; }

		public LibraryImportAttribute(string libraryName)
		{
			LibraryName = libraryName;
		}
	}
	internal enum StringMarshalling
	{
		Custom,
		Utf8,
		Utf16
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
	internal sealed class CallerArgumentExpressionAttribute : Attribute
	{
		public string ParameterName { get; }

		public CallerArgumentExpressionAttribute(string parameterName)
		{
			ParameterName = parameterName;
		}
	}
}
namespace System.Text
{
	internal ref struct ValueStringBuilder
	{
		private char[] _arrayToReturnToPool;

		private Span<char> _chars;

		private int _pos;

		public int Length
		{
			get
			{
				return _pos;
			}
			set
			{
				_pos = value;
			}
		}

		public int Capacity => _chars.Length;

		public ref char this[int index] => ref _chars[index];

		public Span<char> RawChars => _chars;

		public ValueStringBuilder(Span<char> initialBuffer)
		{
			_arrayToReturnToPool = null;
			_chars = initialBuffer;
			_pos = 0;
		}

		public ValueStringBuilder(int initialCapacity)
		{
			_arrayToReturnToPool = ArrayPool<char>.Shared.Rent(initialCapacity);
			_chars = _arrayToReturnToPool;
			_pos = 0;
		}

		public void EnsureCapacity(int capacity)
		{
			if ((uint)capacity > (uint)_chars.Length)
			{
				Grow(capacity - _pos);
			}
		}

		public ref char GetPinnableReference()
		{
			return ref MemoryMarshal.GetReference(_chars);
		}

		public ref char GetPinnableReference(bool terminate)
		{
			if (terminate)
			{
				EnsureCapacity(Length + 1);
				_chars[Length] = '\0';
			}
			return ref MemoryMarshal.GetReference(_chars);
		}

		public override string ToString()
		{
			string result = _chars.Slice(0, _pos).ToString();
			Dispose();
			return result;
		}

		public ReadOnlySpan<char> AsSpan(bool terminate)
		{
			if (terminate)
			{
				EnsureCapacity(Length + 1);
				_chars[Length] = '\0';
			}
			return _chars.Slice(0, _pos);
		}

		public ReadOnlySpan<char> AsSpan()
		{
			return _chars.Slice(0, _pos);
		}

		public ReadOnlySpan<char> AsSpan(int start)
		{
			return _chars.Slice(start, _pos - start);
		}

		public ReadOnlySpan<char> AsSpan(int start, int length)
		{
			return _chars.Slice(start, length);
		}

		public bool TryCopyTo(Span<char> destination, out int charsWritten)
		{
			if (_chars.Slice(0, _pos).TryCopyTo(destination))
			{
				charsWritten = _pos;
				Dispose();
				return true;
			}
			charsWritten = 0;
			Dispose();
			return false;
		}

		public void Insert(int index, char value, int count)
		{
			if (_pos > _chars.Length - count)
			{
				Grow(count);
			}
			int length = _pos - index;
			_chars.Slice(index, length).CopyTo(_chars.Slice(index + count));
			_chars.Slice(index, count).Fill(value);
			_pos += count;
		}

		public void Insert(int index, string? s)
		{
			if (s != null)
			{
				int length = s.Length;
				if (_pos > _chars.Length - length)
				{
					Grow(length);
				}
				int length2 = _pos - index;
				_chars.Slice(index, length2).CopyTo(_chars.Slice(index + length));
				s.AsSpan().CopyTo(_chars.Slice(index));
				_pos += length;
			}
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public void Append(char c)
		{
			int pos = _pos;
			if ((uint)pos < (uint)_chars.Length)
			{
				_chars[pos] = c;
				_pos = pos + 1;
			}
			else
			{
				GrowAndAppend(c);
			}
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public void Append(string? s)
		{
			if (s != null)
			{
				int pos = _pos;
				if (s.Length == 1 && (uint)pos < (uint)_chars.Length)
				{
					_chars[pos] = s[0];
					_pos = pos + 1;
				}
				else
				{
					AppendSlow(s);
				}
			}
		}

		private void AppendSlow(string s)
		{
			int pos = _pos;
			if (pos > _chars.Length - s.Length)
			{
				Grow(s.Length);
			}
			s.AsSpan().CopyTo(_chars.Slice(pos));
			_pos += s.Length;
		}

		public void Append(char c, int count)
		{
			if (_pos > _chars.Length - count)
			{
				Grow(count);
			}
			Span<char> span = _chars.Slice(_pos, count);
			for (int i = 0; i < span.Length; i++)
			{
				span[i] = c;
			}
			_pos += count;
		}

		public unsafe void Append(char* value, int length)
		{
			int pos = _pos;
			if (pos > _chars.Length - length)
			{
				Grow(length);
			}
			Span<char> span = _chars.Slice(_pos, length);
			for (int i = 0; i < span.Length; i++)
			{
				span[i] = *(value++);
			}
			_pos += length;
		}

		public void Append(ReadOnlySpan<char> value)
		{
			int pos = _pos;
			if (pos > _chars.Length - value.Length)
			{
				Grow(value.Length);
			}
			value.CopyTo(_chars.Slice(_pos));
			_pos += value.Length;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public Span<char> AppendSpan(int length)
		{
			int pos = _pos;
			if (pos > _chars.Length - length)
			{
				Grow(length);
			}
			_pos = pos + length;
			return _chars.Slice(pos, length);
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		private void GrowAndAppend(char c)
		{
			Grow(1);
			Append(c);
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		private void Grow(int additionalCapacityBeyondPos)
		{
			int minimumLength = (int)Math.Max((uint)(_pos + additionalCapacityBeyondPos), Math.Min((uint)(_chars.Length * 2), 2147483591u));
			char[] array = ArrayPool<char>.Shared.Rent(minimumLength);
			_chars.Slice(0, _pos).CopyTo(array);
			char[] arrayToReturnToPool = _arrayToReturnToPool;
			_chars = (_arrayToReturnToPool = array);
			if (arrayToReturnToPool != null)
			{
				ArrayPool<char>.Shared.Return(arrayToReturnToPool);
			}
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public void Dispose()
		{
			char[] arrayToReturnToPool = _arrayToReturnToPool;
			this = default(System.Text.ValueStringBuilder);
			if (arrayToReturnToPool != null)
			{
				ArrayPool<char>.Shared.Return(arrayToReturnToPool);
			}
		}
	}
}
namespace Microsoft.Extensions.Internal
{
	internal static class TypeNameHelper
	{
		private readonly struct DisplayNameOptions
		{
			public bool FullName { get; }

			public bool IncludeGenericParameters { get; }

			public bool IncludeGenericParameterNames { get; }

			public char NestedTypeDelimiter { get; }

			public DisplayNameOptions(bool fullName, bool includeGenericParameterNames, bool includeGenericParameters, char nestedTypeDelimiter)
			{
				FullName = fullName;
				IncludeGenericParameters = includeGenericParameters;
				IncludeGenericParameterNames = includeGenericParameterNames;
				NestedTypeDelimiter = nestedTypeDelimiter;
			}
		}

		private const char DefaultNestedTypeDelimiter = '+';

		private static readonly Dictionary<Type, string> _builtInTypeNames = new Dictionary<Type, string>
		{
			{
				typeof(void),
				"void"
			},
			{
				typeof(bool),
				"bool"
			},
			{
				typeof(byte),
				"byte"
			},
			{
				typeof(char),
				"char"
			},
			{
				typeof(decimal),
				"decimal"
			},
			{
				typeof(double),
				"double"
			},
			{
				typeof(float),
				"float"
			},
			{
				typeof(int),
				"int"
			},
			{
				typeof(long),
				"long"
			},
			{
				typeof(object),
				"object"
			},
			{
				typeof(sbyte),
				"sbyte"
			},
			{
				typeof(short),
				"short"
			},
			{
				typeof(string),
				"string"
			},
			{
				typeof(uint),
				"uint"
			},
			{
				typeof(ulong),
				"ulong"
			},
			{
				typeof(ushort),
				"ushort"
			}
		};

		[return: NotNullIfNotNull("item")]
		public static string? GetTypeDisplayName(object? item, bool fullName = true)
		{
			if (item != null)
			{
				return GetTypeDisplayName(item.GetType(), fullName);
			}
			return null;
		}

		public static string GetTypeDisplayName(Type type, bool fullName = true, bool includeGenericParameterNames = false, bool includeGenericParameters = true, char nestedTypeDelimiter = '+')
		{
			StringBuilder stringBuilder = new StringBuilder();
			DisplayNameOptions options = new DisplayNameOptions(fullName, includeGenericParameterNames, includeGenericParameters, nestedTypeDelimiter);
			ProcessType(stringBuilder, type, in options);
			return stringBuilder.ToString();
		}

		private static void ProcessType(StringBuilder builder, Type type, in DisplayNameOptions options)
		{
			if (type.IsGenericType)
			{
				Type[] genericArguments = type.GetGenericArguments();
				ProcessGenericType(builder, type, genericArguments, genericArguments.Length, in options);
				return;
			}
			if (type.IsArray)
			{
				ProcessArrayType(builder, type, in options);
				return;
			}
			if (_builtInTypeNames.TryGetValue(type, out var value))
			{
				builder.Append(value);
				return;
			}
			if (type.IsGenericParameter)
			{
				if (options.IncludeGenericParameterNames)
				{
					builder.Append(type.Name);
				}
				return;
			}
			string text = (options.FullName ? type.FullName : type.Name);
			builder.Append(text);
			if (options.NestedTypeDelimiter != '+')
			{
				builder.Replace('+', options.NestedTypeDelimiter, builder.Length - text.Length, text.Length);
			}
		}

		private static void ProcessArrayType(StringBuilder builder, Type type, in DisplayNameOptions options)
		{
			Type type2 = type;
			while (type2.IsArray)
			{
				type2 = type2.GetElementType();
			}
			ProcessType(builder, type2, in options);
			while (type.IsArray)
			{
				builder.Append('[');
				builder.Append(',', type.GetArrayRank() - 1);
				builder.Append(']');
				type = type.GetElementType();
			}
		}

		private static void ProcessGenericType(StringBuilder builder, Type type, Type[] genericArguments, int length, in DisplayNameOptions options)
		{
			int num = 0;
			if (type.IsNested)
			{
				num = type.DeclaringType.GetGenericArguments().Length;
			}
			if (options.FullName)
			{
				if (type.IsNested)
				{
					ProcessGenericType(builder, type.DeclaringType, genericArguments, num, in options);
					builder.Append(options.NestedTypeDelimiter);
				}
				else if (!string.IsNullOrEmpty(type.Namespace))
				{
					builder.Append(type.Namespace);
					builder.Append('.');
				}
			}
			int num2 = type.Name.IndexOf('`');
			if (num2 <= 0)
			{
				builder.Append(type.Name);
				return;
			}
			builder.Append(type.Name, 0, num2);
			if (!options.IncludeGenericParameters)
			{
				return;
			}
			builder.Append('<');
			for (int i = num; i < length; i++)
			{
				ProcessType(builder, genericArguments[i], in options);
				if (i + 1 != length)
				{
					builder.Append(',');
					if (options.IncludeGenericParameterNames || !genericArguments[i + 1].IsGenericParameter)
					{
						builder.Append(' ');
					}
				}
			}
			builder.Append('>');
		}
	}
}
namespace Microsoft.Extensions.Logging
{
	public readonly struct EventId : IEquatable<EventId>
	{
		public int Id { get; }

		public string? Name { get; }

		public static implicit operator EventId(int i)
		{
			return new EventId(i);
		}

		public static bool operator ==(EventId left, EventId right)
		{
			return left.Equals(right);
		}

		public static bool operator !=(EventId left, EventId right)
		{
			return !left.Equals(right);
		}

		public EventId(int id, string? name = null)
		{
			Id = id;
			Name = name;
		}

		public override string ToString()
		{
			return Name ?? Id.ToString();
		}

		public bool Equals(EventId other)
		{
			return Id == other.Id;
		}

		public override bool Equals([NotNullWhen(true)] object? obj)
		{
			if (obj == null)
			{
				return false;
			}
			if (obj is EventId other)
			{
				return Equals(other);
			}
			return false;
		}

		public override int GetHashCode()
		{
			return Id;
		}
	}
	internal readonly struct FormattedLogValues : IReadOnlyList<KeyValuePair<string, object?>>, IReadOnlyCollection<KeyValuePair<string, object?>>, IEnumerable<KeyValuePair<string, object?>>, IEnumerable
	{
		internal const int MaxCachedFormatters = 1024;

		private const string NullFormat = "[null]";

		private static int _count;

		private static ConcurrentDictionary<string, LogValuesFormatter> _formatters = new ConcurrentDictionary<string, LogValuesFormatter>();

		private readonly LogValuesFormatter _formatter;

		private readonly object[] _values;

		private readonly string _originalMessage;

		internal LogValuesFormatter? Formatter => _formatter;

		public KeyValuePair<string, object?> this[int index]
		{
			get
			{
				if (index < 0 || index >= Count)
				{
					throw new IndexOutOfRangeException("index");
				}
				if (index == Count - 1)
				{
					return new KeyValuePair<string, object>("{OriginalFormat}", _originalMessage);
				}
				return _formatter.GetValue(_values, index);
			}
		}

		public int Count
		{
			get
			{
				if (_formatter == null)
				{
					return 1;
				}
				return _formatter.ValueNames.Count + 1;
			}
		}

		public FormattedLogValues(string? format, params object?[]? values)
		{
			if (values != null && values.Length != 0 && format != null)
			{
				if (_count >= 1024)
				{
					if (!_formatters.TryGetValue(format, out _formatter))
					{
						_formatter = new LogValuesFormatter(format);
					}
				}
				else
				{
					_formatter = _formatters.GetOrAdd(format, delegate(string f)
					{
						Interlocked.Increment(ref _count);
						return new LogValuesFormatter(f);
					});
				}
			}
			else
			{
				_formatter = null;
			}
			_originalMessage = format ?? "[null]";
			_values = values;
		}

		public IEnumerator<KeyValuePair<string, object?>> GetEnumerator()
		{
			int i = 0;
			while (i < Count)
			{
				yield return this[i];
				int num = i + 1;
				i = num;
			}
		}

		public override string ToString()
		{
			if (_formatter == null)
			{
				return _originalMessage;
			}
			return _formatter.Format(_values);
		}

		IEnumerator IEnumerable.GetEnumerator()
		{
			return GetEnumerator();
		}
	}
	public interface IExternalScopeProvider
	{
		void ForEachScope<TState>(Action<object?, TState> callback, TState state);

		IDisposable Push(object? state);
	}
	public interface ILogger
	{
		void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception? exception, Func<TState, Exception?, string> formatter);

		bool IsEnabled(LogLevel logLevel);

		IDisposable? BeginScope<TState>(TState state) where TState : notnull;
	}
	public interface ILoggerFactory : IDisposable
	{
		ILogger CreateLogger(string categoryName);

		void AddProvider(ILoggerProvider provider);
	}
	public interface ILoggerProvider : IDisposable
	{
		ILogger CreateLogger(string categoryName);
	}
	public interface ILogger<out TCategoryName> : ILogger
	{
	}
	public interface ISupportExternalScope
	{
		void SetScopeProvider(IExternalScopeProvider scopeProvider);
	}
	public class LogDefineOptions
	{
		public bool SkipEnabledCheck { get; set; }
	}
	public static class LoggerExtensions
	{
		private static readonly Func<FormattedLogValues, Exception, string> _messageFormatter = MessageFormatter;

		public static void LogDebug(this ILogger logger, EventId eventId, Exception? exception, string? message, params object?[] args)
		{
			logger.Log(LogLevel.Debug, eventId, exception, message, args);
		}

		public static void LogDebug(this ILogger logger, EventId eventId, string? message, params object?[] args)
		{
			logger.Log(LogLevel.Debug, eventId, message, args);
		}

		public static void LogDebug(this ILogger logger, Exception? exception, string? message, params object?[] args)
		{
			logger.Log(LogLevel.Debug, exception, message, args);
		}

		public static void LogDebug(this ILogger logger, string? message, params object?[] args)
		{
			logger.Log(LogLevel.Debug, message, args);
		}

		public static void LogTrace(this ILogger logger, EventId eventId, Exception? exception, string? message, params object?[] args)
		{
			logger.Log(LogLevel.Trace, eventId, exception, message, args);
		}

		public static void LogTrace(this ILogger logger, EventId eventId, string? message, params object?[] args)
		{
			logger.Log(LogLevel.Trace, eventId, message, args);
		}

		public static void LogTrace(this ILogger logger, Exception? exception, string? message, params object?[] args)
		{
			logger.Log(LogLevel.Trace, exception, message, args);
		}

		public static void LogTrace(this ILogger logger, string? message, params object?[] args)
		{
			logger.Log(LogLevel.Trace, message, args);
		}

		public static void LogInformation(this ILogger logger, EventId eventId, Exception? exception, string? message, params object?[] args)
		{
			logger.Log(LogLevel.Information, eventId, exception, message, args);
		}

		public static void LogInformation(this ILogger logger, EventId eventId, string? message, params object?[] args)
		{
			logger.Log(LogLevel.Information, eventId, message, args);
		}

		public static void LogInformation(this ILogger logger, Exception? exception, string? message, params object?[] args)
		{
			logger.Log(LogLevel.Information, exception, message, args);
		}

		public static void LogInformation(this ILogger logger, string? message, params object?[] args)
		{
			logger.Log(LogLevel.Information, message, args);
		}

		public static void LogWarning(this ILogger logger, EventId eventId, Exception? exception, string? message, params object?[] args)
		{
			logger.Log(LogLevel.Warning, eventId, exception, message, args);
		}

		public static void LogWarning(this ILogger logger, EventId eventId, string? message, params object?[] args)
		{
			logger.Log(LogLevel.Warning, eventId, message, args);
		}

		public static void LogWarning(this ILogger logger, Exception? exception, string? message, params object?[] args)
		{
			logger.Log(LogLevel.Warning, exception, message, args);
		}

		public static void LogWarning(this ILogger logger, string? message, params object?[] args)
		{
			logger.Log(LogLevel.Warning, message, args);
		}

		public static void LogError(this ILogger logger, EventId eventId, Exception? exception, string? message, params object?[] args)
		{
			logger.Log(LogLevel.Error, eventId, exception, message, args);
		}

		public static void LogError(this ILogger logger, EventId eventId, string? message, params object?[] args)
		{
			logger.Log(LogLevel.Error, eventId, message, args);
		}

		public static void LogError(this ILogger logger, Exception? exception, string? message, params object?[] args)
		{
			logger.Log(LogLevel.Error, exception, message, args);
		}

		public static void LogError(this ILogger logger, string? message, params object?[] args)
		{
			logger.Log(LogLevel.Error, message, args);
		}

		public static void LogCritical(this ILogger logger, EventId eventId, Exception? exception, string? message, params object?[] args)
		{
			logger.Log(LogLevel.Critical, eventId, exception, message, args);
		}

		public static void LogCritical(this ILogger logger, EventId eventId, string? message, params object?[] args)
		{
			logger.Log(LogLevel.Critical, eventId, message, args);
		}

		public static void LogCritical(this ILogger logger, Exception? exception, string? message, params object?[] args)
		{
			logger.Log(LogLevel.Critical, exception, message, args);
		}

		public static void LogCritical(this ILogger logger, string? message, params object?[] args)
		{
			logger.Log(LogLevel.Critical, message, args);
		}

		public static void Log(this ILogger logger, LogLevel logLevel, string? message, params object?[] args)
		{
			logger.Log(logLevel, 0, null, message, args);
		}

		public static void Log(this ILogger logger, LogLevel logLevel, EventId eventId, string? message, params object?[] args)
		{
			logger.Log(logLevel, eventId, null, message, args);
		}

		public static void Log(this ILogger logger, LogLevel logLevel, Exception? exception, string? message, params object?[] args)
		{
			logger.Log(logLevel, 0, exception, message, args);
		}

		public static void Log(this ILogger logger, LogLevel logLevel, EventId eventId, Exception? exception, string? message, params object?[] args)
		{
			System.ThrowHelper.ThrowIfNull(logger, "logger");
			logger.Log(logLevel, eventId, new FormattedLogValues(message, args), exception, _messageFormatter);
		}

		public static IDisposable? BeginScope(this ILogger logger, string messageFormat, params object?[] args)
		{
			System.ThrowHelper.ThrowIfNull(logger, "logger");
			return logger.BeginScope(new FormattedLogValues(messageFormat, args));
		}

		private static string MessageFormatter(FormattedLogValues state, Exception error)
		{
			return state.ToString();
		}
	}
	public class LoggerExternalScopeProvider : IExternalScopeProvider
	{
		private sealed class Scope : IDisposable
		{
			private readonly LoggerExternalScopeProvider _provider;

			private bool _isDisposed;

			public Scope Parent { get; }

			public object State { get; }

			internal Scope(LoggerExternalScopeProvider provider, object state, Scope parent)
			{
				_provider = provider;
				State = state;
				Parent = parent;
			}

			public override string ToString()
			{
				return State?.ToString();
			}

			public void Dispose()
			{
				if (!_isDisposed)
				{
					_provider._currentScope.Value = Parent;
					_isDisposed = true;
				}
			}
		}

		private readonly AsyncLocal<Scope> _currentScope = new AsyncLocal<Scope>();

		public void ForEachScope<TState>(Action<object?, TState> callback, TState state)
		{
			Action<object, TState> callback2 = callback;
			TState state2 = state;
			Report(_currentScope.Value);
			void Report(Scope? current)
			{
				if (current != null)
				{
					Report(current.Parent);
					callback2(current.State, state2);
				}
			}
		}

		public IDisposable Push(object? state)
		{
			Scope value = _currentScope.Value;
			Scope scope = new Scope(this, state, value);
			_currentScope.Value = scope;
			return scope;
		}
	}
	public static class LoggerFactoryExtensions
	{
		public static ILogger<T> CreateLogger<T>(this ILoggerFactory factory)
		{
			System.ThrowHelper.ThrowIfNull(factory, "factory");
			return new Logger<T>(factory);
		}

		public static ILogger CreateLogger(this ILoggerFactory factory, Type type)
		{
			System.ThrowHelper.ThrowIfNull(factory, "factory");
			System.ThrowHelper.ThrowIfNull(type, "type");
			return factory.CreateLogger(TypeNameHelper.GetTypeDisplayName(type, fullName: true, includeGenericParameterNames: false, includeGenericParameters: false, '.'));
		}
	}
	public static class LoggerMessage
	{
		private readonly struct LogValues : IReadOnlyList<KeyValuePair<string, object>>, IReadOnlyCollection<KeyValuePair<string, object>>, IEnumerable<KeyValuePair<string, object>>, IEnumerable
		{
			public static readonly Func<LogValues, Exception, string> Callback = (LogValues state, Exception exception) => state.ToString();

			private readonly LogValuesFormatter _formatter;

			public KeyValuePair<string, object> this[int index]
			{
				get
				{
					if (index == 0)
					{
						return new KeyValuePair<string, object>("{OriginalFormat}", _formatter.OriginalFormat);
					}
					throw new IndexOutOfRangeException("index");
				}
			}

			public int Count => 1;

			public LogValues(LogValuesFormatter formatter)
			{
				_formatter = formatter;
			}

			public IEnumerator<KeyValuePair<string, object>> GetEnumerator()
			{
				yield return this[0];
			}

			public override string ToString()
			{
				return _formatter.Format();
			}

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

		private readonly struct LogValues<T0> : IReadOnlyList<KeyValuePair<string, object>>, IReadOnlyCollection<KeyValuePair<string, object>>, IEnumerable<KeyValuePair<string, object>>, IEnumerable
		{
			public static readonly Func<LogValues<T0>, Exception, string> Callback = (LogValues<T0> state, Exception exception) => state.ToString();

			private readonly LogValuesFormatter _formatter;

			private readonly T0 _value0;

			public KeyValuePair<string, object> this[int index] => index switch
			{
				0 => new KeyValuePair<string, object>(_formatter.ValueNames[0], _value0), 
				1 => new KeyValuePair<string, object>("{OriginalFormat}", _formatter.OriginalFormat), 
				_ => throw new IndexOutOfRangeException("index"), 
			};

			public int Count => 2;

			public LogValues(LogValuesFormatter formatter, T0 value0)
			{
				_formatter = formatter;
				_value0 = value0;
			}

			public IEnumerator<KeyValuePair<string, object>> GetEnumerator()
			{
				int i = 0;
				while (i < Count)
				{
					yield return this[i];
					int num = i + 1;
					i = num;
				}
			}

			public override string ToString()
			{
				return _formatter.Format(_value0);
			}

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

		private readonly struct LogValues<T0, T1> : IReadOnlyList<KeyValuePair<string, object>>, IReadOnlyCollection<KeyValuePair<string, object>>, IEnumerable<KeyValuePair<string, object>>, IEnumerable
		{
			public static readonly Func<LogValues<T0, T1>, Exception, string> Callback = (LogValues<T0, T1> state, Exception exception) => state.ToString();

			private readonly LogValuesFormatter _formatter;

			private readonly T0 _value0;

			private readonly T1 _value1;

			public KeyValuePair<string, object> this[int index] => index switch
			{
				0 => new KeyValuePair<string, object>(_formatter.ValueNames[0], _value0), 
				1 => new KeyValuePair<string, object>(_formatter.ValueNames[1], _value1), 
				2 => new KeyValuePair<string, object>("{OriginalFormat}", _formatter.OriginalFormat), 
				_ => throw new IndexOutOfRangeException("index"), 
			};

			public int Count => 3;

			public LogValues(LogValuesFormatter formatter, T0 value0, T1 value1)
			{
				_formatter = formatter;
				_value0 = value0;
				_value1 = value1;
			}

			public IEnumerator<KeyValuePair<string, object>> GetEnumerator()
			{
				int i = 0;
				while (i < Count)
				{
					yield return this[i];
					int num = i + 1;
					i = num;
				}
			}

			public override string ToString()
			{
				return _formatter.Format(_value0, _value1);
			}

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

		private readonly struct LogValues<T0, T1, T2> : IReadOnlyList<KeyValuePair<string, object>>, IReadOnlyCollection<KeyValuePair<string, object>>, IEnumerable<KeyValuePair<string, object>>, IEnumerable
		{
			public static readonly Func<LogValues<T0, T1, T2>, Exception, string> Callback = (LogValues<T0, T1, T2> state, Exception exception) => state.ToString();

			private readonly LogValuesFormatter _formatter;

			private readonly T0 _value0;

			private readonly T1 _value1;

			private readonly T2 _value2;

			public int Count => 4;

			public KeyValuePair<string, object> this[int index] => index switch
			{
				0 => new KeyValuePair<string, object>(_formatter.ValueNames[0], _value0), 
				1 => new KeyValuePair<string, object>(_formatter.ValueNames[1], _value1), 
				2 => new KeyValuePair<string, object>(_formatter.ValueNames[2], _value2), 
				3 => new KeyValuePair<string, object>("{OriginalFormat}", _formatter.OriginalFormat), 
				_ => throw new IndexOutOfRangeException("index"), 
			};

			public LogValues(LogValuesFormatter formatter, T0 value0, T1 value1, T2 value2)
			{
				_formatter = formatter;
				_value0 = value0;
				_value1 = value1;
				_value2 = value2;
			}

			public override string ToString()
			{
				return _formatter.Format(_value0, _value1, _value2);
			}

			public IEnumerator<KeyValuePair<string, object>> GetEnumerator()
			{
				int i = 0;
				while (i < Count)
				{
					yield return this[i];
					int num = i + 1;
					i = num;
				}
			}

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

		private readonly struct LogValues<T0, T1, T2, T3> : IReadOnlyList<KeyValuePair<string, object>>, IReadOnlyCollection<KeyValuePair<string, object>>, IEnumerable<KeyValuePair<string, object>>, IEnumerable
		{
			public static readonly Func<LogValues<T0, T1, T2, T3>, Exception, string> Callback = (LogValues<T0, T1, T2, T3> state, Exception exception) => state.ToString();

			private readonly LogValuesFormatter _formatter;

			private readonly T0 _value0;

			private readonly T1 _value1;

			private readonly T2 _value2;

			private readonly T3 _value3;

			public int Count => 5;

			public KeyValuePair<string, object> this[int index] => index switch
			{
				0 => new KeyValuePair<string, object>(_formatter.ValueNames[0], _value0), 
				1 => new KeyValuePair<string, object>(_formatter.ValueNames[1], _value1), 
				2 => new KeyValuePair<string, object>(_formatter.ValueNames[2], _value2), 
				3 => new KeyValuePair<string, object>(_formatter.ValueNames[3], _value3), 
				4 => new KeyValuePair<string, object>("{OriginalFormat}", _formatter.OriginalFormat), 
				_ => throw new IndexOutOfRangeException("index"), 
			};

			public LogValues(LogValuesFormatter formatter, T0 value0, T1 value1, T2 value2, T3 value3)
			{
				_formatter = formatter;
				_value0 = value0;
				_value1 = value1;
				_value2 = value2;
				_value3 = value3;
			}

			private object[] ToArray()
			{
				return new object[4] { _value0, _value1, _value2, _value3 };
			}

			public override string ToString()
			{
				return _formatter.FormatWithOverwrite(ToArray());
			}

			public IEnumerator<KeyValuePair<string, object>> GetEnumerator()
			{
				int i = 0;
				while (i < Count)
				{
					yield return this[i];
					int num = i + 1;
					i = num;
				}
			}

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

		private readonly struct LogValues<T0, T1, T2, T3, T4> : IReadOnlyList<KeyValuePair<string, object>>, IReadOnlyCollection<KeyValuePair<string, object>>, IEnumerable<KeyValuePair<string, object>>, IEnumerable
		{
			public static readonly Func<LogValues<T0, T1, T2, T3, T4>, Exception, string> Callback = (LogValues<T0, T1, T2, T3, T4> state, Exception exception) => state.ToString();

			private readonly LogValuesFormatter _formatter;

			private readonly T0 _value0;

			private readonly T1 _value1;

			private readonly T2 _value2;

			private readonly T3 _value3;

			private readonly T4 _value4;

			public int Count => 6;

			public KeyValuePair<string, object> this[int index] => index switch
			{
				0 => new KeyValuePair<string, object>(_formatter.ValueNames[0], _value0), 
				1 => new KeyValuePair<string, object>(_formatter.ValueNames[1], _value1), 
				2 => new KeyValuePair<string, object>(_formatter.ValueNames[2], _value2), 
				3 => new KeyValuePair<string, object>(_formatter.ValueNames[3], _value3), 
				4 => new KeyValuePair<string, object>(_formatter.ValueNames[4], _value4), 
				5 => new KeyValuePair<string, object>("{OriginalFormat}", _formatter.OriginalFormat), 
				_ => throw new IndexOutOfRangeException("index"), 
			};

			public LogValues(LogValuesFormatter formatter, T0 value0, T1 value1, T2 value2, T3 value3, T4 value4)
			{
				_formatter = formatter;
				_value0 = value0;
				_value1 = value1;
				_value2 = value2;
				_value3 = value3;
				_value4 = value4;
			}

			private object[] ToArray()
			{
				return new object[5] { _value0, _value1, _value2, _value3, _value4 };
			}

			public override string ToString()
			{
				return _formatter.FormatWithOverwrite(ToArray());
			}

			public IEnumerator<KeyValuePair<string, object>> GetEnumerator()
			{
				int i = 0;
				while (i < Count)
				{
					yield return this[i];
					int num = i + 1;
					i = num;
				}
			}

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

		private readonly struct LogValues<T0, T1, T2, T3, T4, T5> : IReadOnlyList<KeyValuePair<string, object>>, IReadOnlyCollection<KeyValuePair<string, object>>, IEnumerable<KeyValuePair<string, object>>, IEnumerable
		{
			public static readonly Func<LogValues<T0, T1, T2, T3, T4, T5>, Exception, string> Callback = (LogValues<T0, T1, T2, T3, T4, T5> state, Exception exception) => state.ToString();

			private readonly LogValuesFormatter _formatter;

			private readonly T0 _value0;

			private readonly T1 _value1;

			private readonly T2 _value2;

			private readonly T3 _value3;

			private readonly T4 _value4;

			private readonly T5 _value5;

			public int Count => 7;

			public KeyValuePair<string, object> this[int index] => index switch
			{
				0 => new KeyValuePair<string, object>(_formatter.ValueNames[0], _value0), 
				1 => new KeyValuePair<string, object>(_formatter.ValueNames[1], _value1), 
				2 => new KeyValuePair<string, object>(_formatter.ValueNames[2], _value2), 
				3 => new KeyValuePair<string, object>(_formatter.ValueNames[3], _value3), 
				4 => new KeyValuePair<string, object>(_formatter.ValueNames[4], _value4), 
				5 => new KeyValuePair<string, object>(_formatter.ValueNames[5], _value5), 
				6 => new KeyValuePair<string, object>("{OriginalFormat}", _formatter.OriginalFormat), 
				_ => throw new IndexOutOfRangeException("index"), 
			};

			public LogValues(LogValuesFormatter formatter, T0 value0, T1 value1, T2 value2, T3 value3, T4 value4, T5 value5)
			{
				_formatter = formatter;
				_value0 = value0;
				_value1 = value1;
				_value2 = value2;
				_value3 = value3;
				_value4 = value4;
				_value5 = value5;
			}

			private object[] ToArray()
			{
				return new object[6] { _value0, _value1, _value2, _value3, _value4, _value5 };
			}

			public override string ToString()
			{
				return _formatter.FormatWithOverwrite(ToArray());
			}

			public IEnumerator<KeyValuePair<string, object>> GetEnumerator()
			{
				int i = 0;
				while (i < Count)
				{
					yield return this[i];
					int num = i + 1;
					i = num;
				}
			}

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

		public static Func<ILogger, IDisposable?> DefineScope(string formatString)
		{
			LogValuesFormatter formatter = CreateLogValuesFormatter(formatString, 0);
			LogValues logValues = new LogValues(formatter);
			return (ILogger logger) => logger.BeginScope(logValues);
		}

		public static Func<ILogger, T1, IDisposable?> DefineScope<T1>(string formatString)
		{
			LogValuesFormatter formatter = CreateLogValuesFormatter(formatString, 1);
			return (ILogger logger, T1 arg1) => logger.BeginScope(new LogValues<T1>(formatter, arg1));
		}

		public static Func<ILogger, T1, T2, IDisposable?> DefineScope<T1, T2>(string formatString)
		{
			LogValuesFormatter formatter = CreateLogValuesFormatter(formatString, 2);
			return (ILogger logger, T1 arg1, T2 arg2) => logger.BeginScope(new LogValues<T1, T2>(formatter, arg1, arg2));
		}

		public static Func<ILogger, T1, T2, T3, IDisposable?> DefineScope<T1, T2, T3>(string formatString)
		{
			LogValuesFormatter formatter = CreateLogValuesFormatter(formatString, 3);
			return (ILogger logger, T1 arg1, T2 arg2, T3 arg3) => logger.BeginScope(new LogValues<T1, T2, T3>(formatter, arg1, arg2, arg3));
		}

		public static Func<ILogger, T1, T2, T3, T4, IDisposable?> DefineScope<T1, T2, T3, T4>(string formatString)
		{
			LogValuesFormatter formatter = CreateLogValuesFormatter(formatString, 4);
			return (ILogger logger, T1 arg1, T2 arg2, T3 arg3, T4 arg4) => logger.BeginScope(new LogValues<T1, T2, T3, T4>(formatter, arg1, arg2, arg3, arg4));
		}

		public static Func<ILogger, T1, T2, T3, T4, T5, IDisposable?> DefineScope<T1, T2, T3, T4, T5>(string formatString)
		{
			LogValuesFormatter formatter = CreateLogValuesFormatter(formatString, 5);
			return (ILogger logger, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5) => logger.BeginScope(new LogValues<T1, T2, T3, T4, T5>(formatter, arg1, arg2, arg3, arg4, arg5));
		}

		public static Func<ILogger, T1, T2, T3, T4, T5, T6, IDisposable?> DefineScope<T1, T2, T3, T4, T5, T6>(string formatString)
		{
			LogValuesFormatter formatter = CreateLogValuesFormatter(formatString, 6);
			return (ILogger logger, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6) => logger.BeginScope(new LogValues<T1, T2, T3, T4, T5, T6>(formatter, arg1, arg2, arg3, arg4, arg5, arg6));
		}

		public static Action<ILogger, Exception?> Define(LogLevel logLevel, EventId eventId, string formatString)
		{
			return Define(logLevel, eventId, formatString, null);
		}

		public static Action<ILogger, Exception?> Define(LogLevel logLevel, EventId eventId, string formatString, LogDefineOptions? options)
		{
			LogValuesFormatter formatter = CreateLogValuesFormatter(formatString, 0);
			if (options != null && options.SkipEnabledCheck)
			{
				return Log;
			}
			return delegate(ILogger logger, Exception exception)
			{
				if (logger.IsEnabled(logLevel))
				{
					Log(logger, exception);
				}
			};
			void Log(ILogger logger, Exception exception)
			{
				logger.Log(logLevel, eventId, new LogValues(formatter), exception, LogValues.Callback);
			}
		}

		public static Action<ILogger, T1, Exception?> Define<T1>(LogLevel logLevel, EventId eventId, string formatString)
		{
			return Define<T1>(logLevel, eventId, formatString, null);
		}

		public static Action<ILogger, T1, Exception?> Define<T1>(LogLevel logLevel, EventId eventId, string formatString, LogDefineOptions? options)
		{
			LogValuesFormatter formatter = CreateLogValuesFormatter(formatString, 1);
			if (options != null && options.SkipEnabledCheck)
			{
				return Log;
			}
			return delegate(ILogger logger, T1 arg1, Exception exception)
			{
				if (logger.IsEnabled(logLevel))
				{
					Log(logger, arg1, exception);
				}
			};
			void Log(ILogger logger, T1 arg1, Exception exception)
			{
				logger.Log(logLevel, eventId, new LogValues<T1>(formatter, arg1), exception, LogValues<T1>.Callback);
			}
		}

		public static Action<ILogger, T1, T2, Exception?> Define<T1, T2>(LogLevel logLevel, EventId eventId, string formatString)
		{
			return Define<T1, T2>(logLevel, eventId, formatString, null);
		}

		public static Action<ILogger, T1, T2, Exception?> Define<T1, T2>(LogLevel logLevel, EventId eventId, string formatString, LogDefineOptions? options)
		{
			LogValuesFormatter formatter = CreateLogValuesFormatter(formatString, 2);
			if (options != null && options.SkipEnabledCheck)
			{
				return Log;
			}
			return delegate(ILogger logger, T1 arg1, T2 arg2, Exception exception)
			{
				if (logger.IsEnabled(logLevel))
				{
					Log(logger, arg1, arg2, exception);
				}
			};
			void Log(ILogger logger, T1 arg1, T2 arg2, Exception exception)
			{
				logger.Log(logLevel, eventId, new LogValues<T1, T2>(formatter, arg1, arg2), exception, LogValues<T1, T2>.Callback);
			}
		}

		public static Action<ILogger, T1, T2, T3, Exception?> Define<T1, T2, T3>(LogLevel logLevel, EventId eventId, string formatString)
		{
			return Define<T1, T2, T3>(logLevel, eventId, formatString, null);
		}

		public static Action<ILogger, T1, T2, T3, Exception?> Define<T1, T2, T3>(LogLevel logLevel, EventId eventId, string formatString, LogDefineOptions? options)
		{
			LogValuesFormatter formatter = CreateLogValuesFormatter(formatString, 3);
			if (options != null && options.SkipEnabledCheck)
			{
				return Log;
			}
			return delegate(ILogger logger, T1 arg1, T2 arg2, T3 arg3, Exception exception)
			{
				if (logger.IsEnabled(logLevel))
				{
					Log(logger, arg1, arg2, arg3, exception);
				}
			};
			void Log(ILogger logger, T1 arg1, T2 arg2, T3 arg3, Exception exception)
			{
				logger.Log(logLevel, eventId, new LogValues<T1, T2, T3>(formatter, arg1, arg2, arg3), exception, LogValues<T1, T2, T3>.Callback);
			}
		}

		public static Action<ILogger, T1, T2, T3, T4, Exception?> Define<T1, T2, T3, T4>(LogLevel logLevel, EventId eventId, string formatString)
		{
			return Define<T1, T2, T3, T4>(logLevel, eventId, formatString, null);
		}

		public static Action<ILogger, T1, T2, T3, T4, Exception?> Define<T1, T2, T3, T4>(LogLevel logLevel, EventId eventId, string formatString, LogDefineOptions? options)
		{
			LogValuesFormatter formatter = CreateLogValuesFormatter(formatString, 4);
			if (options != null && options.SkipEnabledCheck)
			{
				return Log;
			}
			return delegate(ILogger logger, T1 arg1, T2 arg2, T3 arg3, T4 arg4, Exception exception)
			{
				if (logger.IsEnabled(logLevel))
				{
					Log(logger, arg1, arg2, arg3, arg4, exception);
				}
			};
			void Log(ILogger logger, T1 arg1, T2 arg2, T3 arg3, T4 arg4, Exception exception)
			{
				logger.Log(logLevel, eventId, new LogValues<T1, T2, T3, T4>(formatter, arg1, arg2, arg3, arg4), exception, LogValues<T1, T2, T3, T4>.Callback);
			}
		}

		public static Action<ILogger, T1, T2, T3, T4, T5, Exception?> Define<T1, T2, T3, T4, T5>(LogLevel logLevel, EventId eventId, string formatString)
		{
			return Define<T1, T2, T3, T4, T5>(logLevel, eventId, formatString, null);
		}

		public static Action<ILogger, T1, T2, T3, T4, T5, Exception?> Define<T1, T2, T3, T4, T5>(LogLevel logLevel, EventId eventId, string formatString, LogDefineOptions? options)
		{
			LogValuesFormatter formatter = CreateLogValuesFormatter(formatString, 5);
			if (options != null && options.SkipEnabledCheck)
			{
				return Log;
			}
			return delegate(ILogger logger, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, Exception exception)
			{
				if (logger.IsEnabled(logLevel))
				{
					Log(logger, arg1, arg2, arg3, arg4, arg5, exception);
				}
			};
			void Log(ILogger logger, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, Exception exception)
			{
				logger.Log(logLevel, eventId, new LogValues<T1, T2, T3, T4, T5>(formatter, arg1, arg2, arg3, arg4, arg5), exception, LogValues<T1, T2, T3, T4, T5>.Callback);
			}
		}

		public static Action<ILogger, T1, T2, T3, T4, T5, T6, Exception?> Define<T1, T2, T3, T4, T5, T6>(LogLevel logLevel, EventId eventId, string formatString)
		{
			return Define<T1, T2, T3, T4, T5, T6>(logLevel, eventId, formatString, null);
		}

		public static Action<ILogger, T1, T2, T3, T4, T5, T6, Exception?> Define<T1, T2, T3, T4, T5, T6>(LogLevel logLevel, EventId eventId, string formatString, LogDefineOptions? options)
		{
			LogValuesFormatter formatter = CreateLogValuesFormatter(formatString, 6);
			if (options != null && options.SkipEnabledCheck)
			{
				return Log;
			}
			return delegate(ILogger logger, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, Exception exception)
			{
				if (logger.IsEnabled(logLevel))
				{
					Log(logger, arg1, arg2, arg3, arg4, arg5, arg6, exception);
				}
			};
			void Log(ILogger logger, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, Exception exception)
			{
				logger.Log(logLevel, eventId, new LogValues<T1, T2, T3, T4, T5, T6>(formatter, arg1, arg2, arg3, arg4, arg5, arg6), exception, LogValues<T1, T2, T3, T4, T5, T6>.Callback);
			}
		}

		private static LogValuesFormatter CreateLogValuesFormatter(string formatString, int expectedNamedParameterCount)
		{
			LogValuesFormatter logValuesFormatter = new LogValuesFormatter(formatString);
			int count = logValuesFormatter.ValueNames.Count;
			if (count != expectedNamedParameterCount)
			{
				throw new ArgumentException(System.SR.Format(System.SR.UnexpectedNumberOfNamedParameters, formatString, expectedNamedParameterCount, count));
			}
			return logValuesFormatter;
		}
	}
	[AttributeUsage(AttributeTargets.Method)]
	public sealed class LoggerMessageAttribute : Attribute
	{
		public int EventId { get; set; } = -1;


		public string? EventName { get; set; }

		public LogLevel Level { get; set; } = LogLevel.None;


		public string Message { get; set; } = "";


		public bool SkipEnabledCheck { get; set; }

		public LoggerMessageAttribute()
		{
		}

		public LoggerMessageAttribute(int eventId, LogLevel level, string message)
		{
			EventId = eventId;
			Level = level;
			Message = message;
		}
	}
	public class Logger<T> : ILogger<T>, ILogger
	{
		private readonly ILogger _logger;

		public Logger(ILoggerFactory factory)
		{
			System.ThrowHelper.ThrowIfNull(factory, "factory");
			_logger = factory.CreateLogger(TypeNameHelper.GetTypeDisplayName(typeof(T), fullName: true, includeGenericParameterNames: false, includeGenericParameters: false, '.'));
		}

		IDisposable ILogger.BeginScope<TState>(TState state)
		{
			return _logger.BeginScope(state);
		}

		bool ILogger.IsEnabled(LogLevel logLevel)
		{
			return _logger.IsEnabled(logLevel);
		}

		void ILogger.Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func<TState, Exception, string> formatter)
		{
			_logger.Log(logLevel, eventId, state, exception, formatter);
		}
	}
	public enum LogLevel
	{
		Trace,
		Debug,
		Information,
		Warning,
		Error,
		Critical,
		None
	}
	internal sealed class LogValuesFormatter
	{
		private const string NullValue = "(null)";

		private static readonly char[] FormatDelimiters = new char[2] { ',', ':' };

		private readonly string _format;

		private readonly List<string> _valueNames = new List<string>();

		public string OriginalFormat { get; private set; }

		public List<string> ValueNames => _valueNames;

		public LogValuesFormatter(string format)
		{
			System.ThrowHelper.ThrowIfNull(format, "format");
			OriginalFormat = format;
			Span<char> initialBuffer = stackalloc char[256];
			System.Text.ValueStringBuilder valueStringBuilder = new System.Text.ValueStringBuilder(initialBuffer);
			int num = 0;
			int length = format.Length;
			while (num < length)
			{
				int num2 = FindBraceIndex(format, '{', num, length);
				if (num == 0 && num2 == length)
				{
					_format = format;
					return;
				}
				int num3 = FindBraceIndex(format, '}', num2, length);
				if (num3 == length)
				{
					valueStringBuilder.Append(format.AsSpan(num, length - num));
					num = length;
					continue;
				}
				int num4 = FindIndexOfAny(format, FormatDelimiters, num2, num3);
				valueStringBuilder.Append(format.AsSpan(num, num2 - num + 1));
				valueStringBuilder.Append(_valueNames.Count.ToString());
				_valueNames.Add(format.Substring(num2 + 1, num4 - num2 - 1));
				valueStringBuilder.Append(format.AsSpan(num4, num3 - num4 + 1));
				num = num3 + 1;
			}
			_format = valueStringBuilder.ToString();
		}

		private static int FindBraceIndex(string format, char brace, int startIndex, int endIndex)
		{
			int result = endIndex;
			int i = startIndex;
			int num = 0;
			for (; i < endIndex; i++)
			{
				if (num > 0 && format[i] != brace)
				{
					if (num % 2 != 0)
					{
						break;
					}
					num = 0;
					result = endIndex;
				}
				else
				{
					if (format[i] != brace)
					{
						continue;
					}
					if (brace == '}')
					{
						if (num == 0)
						{
							result = i;
						}
					}
					else
					{
						result = i;
					}
					num++;
				}
			}
			return result;
		}

		private static int FindIndexOfAny(string format, char[] chars, int startIndex, int endIndex)
		{
			int num = format.IndexOfAny(chars, startIndex, endIndex - startIndex);
			if (num != -1)
			{
				return num;
			}
			return endIndex;
		}

		public string Format(object?[]? values)
		{
			object[] array = values;
			if (values != null)
			{
				for (int i = 0; i < values.Length; i++)
				{
					object obj = FormatArgument(values[i]);
					if (obj != values[i])
					{
						array = new object[values.Length];
						Array.Copy(values, array, i);
						array[i++] = obj;
						for (; i < values.Length; i++)
						{
							array[i] = FormatArgument(values[i]);
						}
						break;
					}
				}
			}
			return string.Format(CultureInfo.InvariantCulture, _format, array ?? Array.Empty<object>());
		}

		internal string FormatWithOverwrite(object?[]? values)
		{
			if (values != null)
			{
				for (int i = 0; i < values.Length; i++)
				{
					values[i] = FormatArgument(values[i]);
				}
			}
			return string.Format(CultureInfo.InvariantCulture, _format, values ?? Array.Empty<object>());
		}

		internal string Format()
		{
			return _format;
		}

		internal string Format(object? arg0)
		{
			return string.Format(CultureInfo.InvariantCulture, _format, FormatArgument(arg0));
		}

		internal string Format(object? arg0, object? arg1)
		{
			return string.Format(CultureInfo.InvariantCulture, _format, FormatArgument(arg0), FormatArgument(arg1));
		}

		internal string Format(object? arg0, object? arg1, object? arg2)
		{
			return string.Format(CultureInfo.InvariantCulture, _format, FormatArgument(arg0), FormatArgument(arg1), FormatArgument(arg2));
		}

		public KeyValuePair<string, object?> GetValue(object?[] values, int index)
		{
			if (index < 0 || index > _valueNames.Count)
			{
				throw new IndexOutOfRangeException("index");
			}
			if (_valueNames.Count > index)
			{
				return new KeyValuePair<string, object>(_valueNames[index], values[index]);
			}
			return new KeyValuePair<string, object>("{OriginalFormat}", OriginalFormat);
		}

		public IEnumerable<KeyValuePair<string, object?>> GetValues(object[] values)
		{
			KeyValuePair<string, object>[] array = new KeyValuePair<string, object>[values.Length + 1];
			for (int i = 0; i != _valueNames.Count; i++)
			{
				array[i] = new KeyValuePair<string, object>(_valueNames[i], values[i]);
			}
			array[^1] = new KeyValuePair<string, object>("{OriginalFormat}", OriginalFormat);
			return array;
		}

		private object FormatArgument(object value)
		{
			if (value == null)
			{
				return "(null)";
			}
			if (value is string)
			{
				return value;
			}
			if (value is IEnumerable enumerable)
			{
				Span<char> initialBuffer = stackalloc char[256];
				System.Text.ValueStringBuilder valueStringBuilder = new System.Text.ValueStringBuilder(initialBuffer);
				bool flag = true;
				foreach (object item in enumerable)
				{
					if (!flag)
					{
						valueStringBuilder.Append(", ");
					}
					valueStringBuilder.Append((item != null) ? item.ToString() : "(null)");
					flag = false;
				}
				return valueStringBuilder.ToString();
			}
			return value;
		}
	}
	internal sealed class NullExternalScopeProvider : IExternalScopeProvider
	{
		public static IExternalScopeProvider Instance { get; } = new NullExternalScopeProvider();


		private NullExternalScopeProvider()
		{
		}

		void IExternalScopeProvider.ForEachScope<TState>(Action<object, TState> callback, TState state)
		{
		}

		IDisposable IExternalScopeProvider.Push(object state)
		{
			return NullScope.Instance;
		}
	}
	internal sealed class NullScope : IDisposable
	{
		public static NullScope Instance { get; } = new NullScope();


		private NullScope()
		{
		}

		public void Dispose()
		{
		}
	}
}
namespace Microsoft.Extensions.Logging.Abstractions
{
	public readonly struct LogEntry<TState>
	{
		public LogLevel LogLevel { get; }

		public string Category { get; }

		public EventId EventId { get; }

		public TState State { get; }

		public Exception? Exception { get; }

		public Func<TState, Exception?, string> Formatter { get; }

		public LogEntry(LogLevel logLevel, string category, EventId eventId, TState state, Exception? exception, Func<TState, Exception?, string> formatter)
		{
			LogLevel = logLevel;
			Category = category;
			EventId = eventId;
			State = state;
			Exception = exception;
			Formatter = formatter;
		}
	}
	public class NullLogger : ILogger
	{
		public static NullLogger Instance { get; } = new NullLogger();


		private NullLogger()
		{
		}

		public IDisposable BeginScope<TState>(TState state) where TState : notnull
		{
			return NullScope.Instance;
		}

		public bool IsEnabled(LogLevel logLevel)
		{
			return false;
		}

		public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception? exception, Func<TState, Exception?, string> formatter)
		{
		}
	}
	public class NullLoggerFactory : ILoggerFactory, IDisposable
	{
		public static readonly NullLoggerFactory Instance = new NullLoggerFactory();

		public ILogger CreateLogger(string name)
		{
			return NullLogger.Instance;
		}

		public void AddProvider(ILoggerProvider provider)
		{
		}

		public void Dispose()
		{
		}
	}
	public class NullLoggerProvider : ILoggerProvider, IDisposable
	{
		public static NullLoggerProvider Instance { get; } = new NullLoggerProvider();


		private NullLoggerProvider()
		{
		}

		public ILogger CreateLogger(string categoryName)
		{
			return NullLogger.Instance;
		}

		public void Dispose()
		{
		}
	}
	public class NullLogger<T> : ILogger<T>, ILogger
	{
		public static readonly NullLogger<T> Instance = new NullLogger<T>();

		public IDisposable BeginScope<TState>(TState state) where TState : notnull
		{
			return NullScope.Instance;
		}

		public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception? exception, Func<TState, Exception?, string> formatter)
		{
		}

		public bool IsEnabled(LogLevel logLevel)
		{
			return false;
		}
	}
}

BepInEx/plugins/SlopCrew.Plugin/Microsoft.Extensions.Logging.Configuration.dll

Decompiled 8 months ago
using System;
using System.Collections.Generic;
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.Microsoft.Extensions.Logging.Configuration;
using Microsoft.CodeAnalysis;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.Extensions.Logging.Configuration;
using Microsoft.Extensions.Options;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: AssemblyMetadata(".NETFrameworkAssembly", "")]
[assembly: AssemblyMetadata("Serviceable", "True")]
[assembly: AssemblyMetadata("PreferInbox", "True")]
[assembly: AssemblyDefaultAlias("Microsoft.Extensions.Logging.Configuration")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: CLSCompliant(true)]
[assembly: AssemblyMetadata("IsTrimmable", "True")]
[assembly: DefaultDllImportSearchPaths(DllImportSearchPath.System32 | DllImportSearchPath.AssemblyDirectory)]
[assembly: AssemblyCompany("Microsoft Corporation")]
[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")]
[assembly: AssemblyDescription("Configuration support for Microsoft.Extensions.Logging.")]
[assembly: AssemblyFileVersion("7.0.22.51805")]
[assembly: AssemblyInformationalVersion("7.0.0+d099f075e45d2aa6007a22b71b45a08758559f80")]
[assembly: AssemblyProduct("Microsoft® .NET")]
[assembly: AssemblyTitle("Microsoft.Extensions.Logging.Configuration")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/dotnet/runtime")]
[assembly: AssemblyVersion("7.0.0.0")]
[module: RefSafetyRules(11)]
[module: System.Runtime.CompilerServices.NullablePublicOnly(false)]
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 NullablePublicOnlyAttribute : Attribute
	{
		public readonly bool IncludesInternals;

		public NullablePublicOnlyAttribute(bool P_0)
		{
			IncludesInternals = 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 FxResources.Microsoft.Extensions.Logging.Configuration
{
	internal static class SR
	{
	}
}
namespace System
{
	internal static class ThrowHelper
	{
		internal static void ThrowIfNull(object argument, [CallerArgumentExpression("argument")] string paramName = null)
		{
			if (argument == null)
			{
				Throw(paramName);
			}
		}

		private static void Throw(string paramName)
		{
			throw new ArgumentNullException(paramName);
		}
	}
	internal static class SR
	{
		private static readonly bool s_usingResourceKeys = AppContext.TryGetSwitch("System.Resources.UseSystemResourceKeys", out var isEnabled) && isEnabled;

		private static ResourceManager s_resourceManager;

		internal static ResourceManager ResourceManager => s_resourceManager ?? (s_resourceManager = new ResourceManager(typeof(SR)));

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

		private static bool UsingResourceKeys()
		{
			return s_usingResourceKeys;
		}

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

		internal static string GetResourceString(string resourceKey, string defaultString)
		{
			string resourceString = GetResourceString(resourceKey);
			if (!(resourceKey == resourceString) && resourceString != null)
			{
				return resourceString;
			}
			return defaultString;
		}

		internal static string Format(string resourceFormat, object p1)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1);
			}
			return string.Format(resourceFormat, p1);
		}

		internal static string Format(string resourceFormat, object p1, object p2)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2);
			}
			return string.Format(resourceFormat, p1, p2);
		}

		internal static string Format(string resourceFormat, object p1, object p2, object p3)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2, p3);
			}
			return string.Format(resourceFormat, p1, p2, p3);
		}

		internal static string Format(string resourceFormat, params object[] args)
		{
			if (args != null)
			{
				if (UsingResourceKeys())
				{
					return resourceFormat + ", " + string.Join(", ", args);
				}
				return string.Format(resourceFormat, args);
			}
			return resourceFormat;
		}

		internal static string Format(IFormatProvider provider, string resourceFormat, object p1)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1);
			}
			return string.Format(provider, resourceFormat, p1);
		}

		internal static string Format(IFormatProvider provider, string resourceFormat, object p1, object p2)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2);
			}
			return string.Format(provider, resourceFormat, p1, p2);
		}

		internal static string Format(IFormatProvider provider, string resourceFormat, object p1, object p2, object p3)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2, p3);
			}
			return string.Format(provider, resourceFormat, p1, p2, p3);
		}

		internal static string Format(IFormatProvider provider, string resourceFormat, params object[] args)
		{
			if (args != null)
			{
				if (UsingResourceKeys())
				{
					return resourceFormat + ", " + string.Join(", ", args);
				}
				return string.Format(provider, resourceFormat, args);
			}
			return resourceFormat;
		}
	}
}
namespace System.Diagnostics.CodeAnalysis
{
	[AttributeUsage(AttributeTargets.All, Inherited = false, AllowMultiple = true)]
	internal sealed class UnconditionalSuppressMessageAttribute : Attribute
	{
		public string Category { get; }

		public string CheckId { get; }

		public string Scope { get; set; }

		public string Target { get; set; }

		public string MessageId { get; set; }

		public string Justification { get; set; }

		public UnconditionalSuppressMessageAttribute(string category, string checkId)
		{
			Category = category;
			CheckId = checkId;
		}
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Interface | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, Inherited = false)]
	internal sealed class DynamicallyAccessedMembersAttribute : Attribute
	{
		public DynamicallyAccessedMemberTypes MemberTypes { get; }

		public DynamicallyAccessedMembersAttribute(DynamicallyAccessedMemberTypes memberTypes)
		{
			MemberTypes = memberTypes;
		}
	}
	[Flags]
	internal enum DynamicallyAccessedMemberTypes
	{
		None = 0,
		PublicParameterlessConstructor = 1,
		PublicConstructors = 3,
		NonPublicConstructors = 4,
		PublicMethods = 8,
		NonPublicMethods = 0x10,
		PublicFields = 0x20,
		NonPublicFields = 0x40,
		PublicNestedTypes = 0x80,
		NonPublicNestedTypes = 0x100,
		PublicProperties = 0x200,
		NonPublicProperties = 0x400,
		PublicEvents = 0x800,
		NonPublicEvents = 0x1000,
		Interfaces = 0x2000,
		All = -1
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Constructor | AttributeTargets.Method, Inherited = false)]
	internal sealed class RequiresUnreferencedCodeAttribute : Attribute
	{
		public string Message { get; }

		public string Url { get; set; }

		public RequiresUnreferencedCodeAttribute(string message)
		{
			Message = message;
		}
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Constructor | AttributeTargets.Method, Inherited = false)]
	internal sealed class RequiresDynamicCodeAttribute : Attribute
	{
		public string Message { get; }

		public string Url { get; set; }

		public RequiresDynamicCodeAttribute(string message)
		{
			Message = message;
		}
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)]
	internal sealed class AllowNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)]
	internal sealed class DisallowNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)]
	internal sealed class MaybeNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)]
	internal sealed class NotNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class MaybeNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public MaybeNullWhenAttribute(bool returnValue)
		{
			ReturnValue = returnValue;
		}
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class NotNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public NotNullWhenAttribute(bool returnValue)
		{
			ReturnValue = returnValue;
		}
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = true, Inherited = false)]
	internal sealed class NotNullIfNotNullAttribute : Attribute
	{
		public string ParameterName { get; }

		public NotNullIfNotNullAttribute(string parameterName)
		{
			ParameterName = parameterName;
		}
	}
	[AttributeUsage(AttributeTargets.Method, Inherited = false)]
	internal sealed class DoesNotReturnAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class DoesNotReturnIfAttribute : Attribute
	{
		public bool ParameterValue { get; }

		public DoesNotReturnIfAttribute(bool parameterValue)
		{
			ParameterValue = parameterValue;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	internal sealed class MemberNotNullAttribute : Attribute
	{
		public string[] Members { get; }

		public MemberNotNullAttribute(string member)
		{
			Members = new string[1] { member };
		}

		public MemberNotNullAttribute(params string[] members)
		{
			Members = members;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	internal sealed class MemberNotNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public string[] Members { get; }

		public MemberNotNullWhenAttribute(bool returnValue, string member)
		{
			ReturnValue = returnValue;
			Members = new string[1] { member };
		}

		public MemberNotNullWhenAttribute(bool returnValue, params string[] members)
		{
			ReturnValue = returnValue;
			Members = members;
		}
	}
}
namespace System.Runtime.InteropServices
{
	[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
	internal sealed class LibraryImportAttribute : Attribute
	{
		public string LibraryName { get; }

		public string EntryPoint { get; set; }

		public StringMarshalling StringMarshalling { get; set; }

		public Type StringMarshallingCustomType { get; set; }

		public bool SetLastError { get; set; }

		public LibraryImportAttribute(string libraryName)
		{
			LibraryName = libraryName;
		}
	}
	internal enum StringMarshalling
	{
		Custom,
		Utf8,
		Utf16
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
	internal sealed class CallerArgumentExpressionAttribute : Attribute
	{
		public string ParameterName { get; }

		public CallerArgumentExpressionAttribute(string parameterName)
		{
			ParameterName = parameterName;
		}
	}
}
namespace Microsoft.Extensions.Logging
{
	internal sealed class LoggerFilterConfigureOptions : IConfigureOptions<LoggerFilterOptions>
	{
		private const string LogLevelKey = "LogLevel";

		private const string DefaultCategory = "Default";

		private readonly IConfiguration _configuration;

		public LoggerFilterConfigureOptions(IConfiguration configuration)
		{
			_configuration = configuration;
		}

		public void Configure(LoggerFilterOptions options)
		{
			LoadDefaultConfigValues(options);
		}

		private void LoadDefaultConfigValues(LoggerFilterOptions options)
		{
			if (_configuration == null)
			{
				return;
			}
			options.CaptureScopes = GetCaptureScopesValue(options);
			foreach (IConfigurationSection child in _configuration.GetChildren())
			{
				if (child.Key.Equals("LogLevel", StringComparison.OrdinalIgnoreCase))
				{
					LoadRules(options, child, null);
					continue;
				}
				IConfigurationSection section = ((IConfiguration)child).GetSection("LogLevel");
				if (section != null)
				{
					string key = child.Key;
					LoadRules(options, section, key);
				}
			}
			[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode", Justification = "IConfiguration.GetValue is safe when T is a bool.")]
			bool GetCaptureScopesValue(LoggerFilterOptions options)
			{
				return ConfigurationBinder.GetValue<bool>(_configuration, "CaptureScopes", options.CaptureScopes);
			}
		}

		private static void LoadRules(LoggerFilterOptions options, IConfigurationSection configurationSection, string logger)
		{
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Expected O, but got Unknown
			foreach (KeyValuePair<string, string> item2 in ConfigurationExtensions.AsEnumerable((IConfiguration)(object)configurationSection, true))
			{
				if (TryGetSwitch(item2.Value, out var level))
				{
					string text = item2.Key;
					if (text.Equals("Default", StringComparison.OrdinalIgnoreCase))
					{
						text = null;
					}
					LoggerFilterRule item = new LoggerFilterRule(logger, text, (LogLevel?)level, (Func<string, string, LogLevel, bool>)null);
					options.Rules.Add(item);
				}
			}
		}

		private static bool TryGetSwitch(string value, out LogLevel level)
		{
			if (string.IsNullOrEmpty(value))
			{
				level = (LogLevel)6;
				return false;
			}
			if (Enum.TryParse<LogLevel>(value, ignoreCase: true, out level))
			{
				return true;
			}
			throw new InvalidOperationException(System.SR.Format(System.SR.ValueNotSupported, value));
		}
	}
	public static class LoggingBuilderExtensions
	{
		public static ILoggingBuilder AddConfiguration(this ILoggingBuilder builder, IConfiguration configuration)
		{
			builder.AddConfiguration();
			ServiceCollectionServiceExtensions.AddSingleton<IConfigureOptions<LoggerFilterOptions>>(builder.Services, (IConfigureOptions<LoggerFilterOptions>)new LoggerFilterConfigureOptions(configuration));
			ServiceCollectionServiceExtensions.AddSingleton<IOptionsChangeTokenSource<LoggerFilterOptions>>(builder.Services, (IOptionsChangeTokenSource<LoggerFilterOptions>)(object)new ConfigurationChangeTokenSource<LoggerFilterOptions>(configuration));
			ServiceCollectionServiceExtensions.AddSingleton<LoggingConfiguration>(builder.Services, new LoggingConfiguration(configuration));
			return builder;
		}
	}
	internal static class ProviderAliasUtilities
	{
		private const string AliasAttributeTypeFullName = "Microsoft.Extensions.Logging.ProviderAliasAttribute";

		internal static string GetAlias(Type providerType)
		{
			IList<CustomAttributeData> customAttributes = CustomAttributeData.GetCustomAttributes(providerType);
			for (int i = 0; i < customAttributes.Count; i++)
			{
				CustomAttributeData customAttributeData = customAttributes[i];
				if (customAttributeData.AttributeType.FullName == "Microsoft.Extensions.Logging.ProviderAliasAttribute" && customAttributeData.ConstructorArguments.Count > 0)
				{
					return customAttributeData.ConstructorArguments[0].Value?.ToString();
				}
			}
			return null;
		}
	}
}
namespace Microsoft.Extensions.Logging.Configuration
{
	public interface ILoggerProviderConfiguration<T>
	{
		IConfiguration Configuration { get; }
	}
	public interface ILoggerProviderConfigurationFactory
	{
		IConfiguration GetConfiguration(Type providerType);
	}
	internal sealed class LoggerProviderConfiguration<T> : ILoggerProviderConfiguration<T>
	{
		public IConfiguration Configuration { get; }

		public LoggerProviderConfiguration(ILoggerProviderConfigurationFactory providerConfigurationFactory)
		{
			Configuration = providerConfigurationFactory.GetConfiguration(typeof(T));
		}
	}
	public static class LoggerProviderOptions
	{
		internal const string RequiresDynamicCodeMessage = "Binding TOptions to configuration values may require generating dynamic code at runtime.";

		internal const string TrimmingRequiresUnreferencedCodeMessage = "TOptions's dependent types may have their members trimmed. Ensure all required members are preserved.";

		[RequiresDynamicCode("Binding TOptions to configuration values may require generating dynamic code at runtime.")]
		[RequiresUnreferencedCode("TOptions's dependent types may have their members trimmed. Ensure all required members are preserved.")]
		public static void RegisterProviderOptions<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] TOptions, TProvider>(IServiceCollection services) where TOptions : class
		{
			ServiceCollectionDescriptorExtensions.TryAddEnumerable(services, ServiceDescriptor.Singleton<IConfigureOptions<TOptions>, LoggerProviderConfigureOptions<TOptions, TProvider>>());
			ServiceCollectionDescriptorExtensions.TryAddEnumerable(services, ServiceDescriptor.Singleton<IOptionsChangeTokenSource<TOptions>, LoggerProviderOptionsChangeTokenSource<TOptions, TProvider>>());
		}
	}
	internal sealed class LoggerProviderConfigurationFactory : ILoggerProviderConfigurationFactory
	{
		private readonly IEnumerable<LoggingConfiguration> _configurations;

		public LoggerProviderConfigurationFactory(IEnumerable<LoggingConfiguration> configurations)
		{
			_configurations = configurations;
		}

		public IConfiguration GetConfiguration(Type providerType)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			System.ThrowHelper.ThrowIfNull(providerType, "providerType");
			string fullName = providerType.FullName;
			string alias = ProviderAliasUtilities.GetAlias(providerType);
			ConfigurationBuilder val = new ConfigurationBuilder();
			foreach (LoggingConfiguration configuration in _configurations)
			{
				IConfigurationSection section = configuration.Configuration.GetSection(fullName);
				ChainedBuilderExtensions.AddConfiguration((IConfigurationBuilder)(object)val, (IConfiguration)(object)section);
				if (!string.IsNullOrWhiteSpace(alias))
				{
					IConfigurationSection section2 = configuration.Configuration.GetSection(alias);
					ChainedBuilderExtensions.AddConfiguration((IConfigurationBuilder)(object)val, (IConfiguration)(object)section2);
				}
			}
			return (IConfiguration)(object)val.Build();
		}
	}
	internal sealed class LoggerProviderConfigureOptions<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] TOptions, TProvider> : ConfigureFromConfigurationOptions<TOptions> where TOptions : class
	{
		[RequiresDynamicCode("Binding TOptions to configuration values may require generating dynamic code at runtime.")]
		[RequiresUnreferencedCode("TOptions's dependent types may have their members trimmed. Ensure all required members are preserved.")]
		public LoggerProviderConfigureOptions(ILoggerProviderConfiguration<TProvider> providerConfiguration)
			: base(providerConfiguration.Configuration)
		{
		}
	}
	public class LoggerProviderOptionsChangeTokenSource<TOptions, TProvider> : ConfigurationChangeTokenSource<TOptions>
	{
		public LoggerProviderOptionsChangeTokenSource(ILoggerProviderConfiguration<TProvider> providerConfiguration)
			: base(providerConfiguration.Configuration)
		{
		}
	}
	public static class LoggingBuilderConfigurationExtensions
	{
		public static void AddConfiguration(this ILoggingBuilder builder)
		{
			ServiceCollectionDescriptorExtensions.TryAddSingleton<ILoggerProviderConfigurationFactory, LoggerProviderConfigurationFactory>(builder.Services);
			ServiceCollectionDescriptorExtensions.TryAddSingleton(builder.Services, typeof(ILoggerProviderConfiguration<>), typeof(LoggerProviderConfiguration<>));
		}
	}
	internal sealed class LoggingConfiguration
	{
		public IConfiguration Configuration { get; }

		public LoggingConfiguration(IConfiguration configuration)
		{
			Configuration = configuration;
		}
	}
}

BepInEx/plugins/SlopCrew.Plugin/Microsoft.Extensions.Logging.Console.dll

Decompiled 8 months ago
using System;
using System.Buffers;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.IO;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Text.Json;
using System.Threading;
using System.Threading.Tasks;
using FxResources.Microsoft.Extensions.Logging.Console;
using Microsoft.CodeAnalysis;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.Extensions.Logging.Abstractions;
using Microsoft.Extensions.Logging.Configuration;
using Microsoft.Extensions.Logging.Console;
using Microsoft.Extensions.Options;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: InternalsVisibleTo("Microsoft.Extensions.Logging.Console.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: AssemblyMetadata(".NETFrameworkAssembly", "")]
[assembly: AssemblyMetadata("Serviceable", "True")]
[assembly: AssemblyMetadata("PreferInbox", "True")]
[assembly: AssemblyDefaultAlias("Microsoft.Extensions.Logging.Console")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: CLSCompliant(true)]
[assembly: AssemblyMetadata("IsTrimmable", "True")]
[assembly: DefaultDllImportSearchPaths(DllImportSearchPath.System32 | DllImportSearchPath.AssemblyDirectory)]
[assembly: AssemblyCompany("Microsoft Corporation")]
[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")]
[assembly: AssemblyDescription("Console logger provider implementation for Microsoft.Extensions.Logging.")]
[assembly: AssemblyFileVersion("7.0.22.51805")]
[assembly: AssemblyInformationalVersion("7.0.0+d099f075e45d2aa6007a22b71b45a08758559f80")]
[assembly: AssemblyProduct("Microsoft® .NET")]
[assembly: AssemblyTitle("Microsoft.Extensions.Logging.Console")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/dotnet/runtime")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("7.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: System.Runtime.CompilerServices.NullablePublicOnly(true)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class IsReadOnlyAttribute : Attribute
	{
	}
	[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 NullablePublicOnlyAttribute : Attribute
	{
		public readonly bool IncludesInternals;

		public NullablePublicOnlyAttribute(bool P_0)
		{
			IncludesInternals = 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;
		}
	}
}
internal static class Interop
{
	internal static class Libraries
	{
		internal const string Activeds = "activeds.dll";

		internal const string Advapi32 = "advapi32.dll";

		internal const string Authz = "authz.dll";

		internal const string BCrypt = "BCrypt.dll";

		internal const string Credui = "credui.dll";

		internal const string Crypt32 = "crypt32.dll";

		internal const string CryptUI = "cryptui.dll";

		internal const string Dnsapi = "dnsapi.dll";

		internal const string Dsrole = "dsrole.dll";

		internal const string Gdi32 = "gdi32.dll";

		internal const string HttpApi = "httpapi.dll";

		internal const string IpHlpApi = "iphlpapi.dll";

		internal const string Kernel32 = "kernel32.dll";

		internal const string Logoncli = "logoncli.dll";

		internal const string Mswsock = "mswsock.dll";

		internal const string NCrypt = "ncrypt.dll";

		internal const string Netapi32 = "netapi32.dll";

		internal const string Netutils = "netutils.dll";

		internal const string NtDll = "ntdll.dll";

		internal const string Odbc32 = "odbc32.dll";

		internal const string Ole32 = "ole32.dll";

		internal const string OleAut32 = "oleaut32.dll";

		internal const string Pdh = "pdh.dll";

		internal const string Secur32 = "secur32.dll";

		internal const string Shell32 = "shell32.dll";

		internal const string SspiCli = "sspicli.dll";

		internal const string User32 = "user32.dll";

		internal const string Version = "version.dll";

		internal const string WebSocket = "websocket.dll";

		internal const string Wevtapi = "wevtapi.dll";

		internal const string WinHttp = "winhttp.dll";

		internal const string WinMM = "winmm.dll";

		internal const string Wkscli = "wkscli.dll";

		internal const string Wldap32 = "wldap32.dll";

		internal const string Ws2_32 = "ws2_32.dll";

		internal const string Wtsapi32 = "wtsapi32.dll";

		internal const string CompressionNative = "System.IO.Compression.Native";

		internal const string GlobalizationNative = "System.Globalization.Native";

		internal const string MsQuic = "msquic.dll";

		internal const string HostPolicy = "hostpolicy.dll";

		internal const string Ucrtbase = "ucrtbase.dll";

		internal const string Xolehlp = "xolehlp.dll";
	}

	internal static class Kernel32
	{
		internal const int ENABLE_PROCESSED_INPUT = 1;

		internal const uint ENABLE_VIRTUAL_TERMINAL_PROCESSING = 4u;

		internal const int STD_OUTPUT_HANDLE = -11;

		[DllImport("kernel32.dll", ExactSpelling = true, SetLastError = true)]
		[LibraryImport("kernel32.dll", SetLastError = true)]
		[return: MarshalAs(UnmanagedType.Bool)]
		internal static extern bool GetConsoleMode(IntPtr handle, out int mode);

		internal static bool IsGetConsoleModeCallSuccessful(IntPtr handle)
		{
			int mode;
			return GetConsoleMode(handle, out mode);
		}

		[DllImport("kernel32.dll", ExactSpelling = true, SetLastError = true)]
		[LibraryImport("kernel32.dll", SetLastError = true)]
		[return: MarshalAs(UnmanagedType.Bool)]
		internal static extern bool SetConsoleMode(IntPtr handle, int mode);

		[DllImport("kernel32.dll", ExactSpelling = true)]
		[LibraryImport("kernel32.dll")]
		internal static extern IntPtr GetStdHandle(int nStdHandle);
	}
}
namespace FxResources.Microsoft.Extensions.Logging.Console
{
	internal static class SR
	{
	}
}
namespace System
{
	internal static class ThrowHelper
	{
		internal static void ThrowIfNull(object? argument, [CallerArgumentExpression("argument")] string? paramName = null)
		{
			if (argument == null)
			{
				Throw(paramName);
			}
		}

		private static void Throw(string paramName)
		{
			throw new ArgumentNullException(paramName);
		}
	}
	internal static class ConsoleUtils
	{
		private static volatile int s_emitAnsiColorCodes = -1;

		private static volatile int s_useNet6KeyParser = -1;

		public static bool EmitAnsiColorCodes
		{
			get
			{
				int num = s_emitAnsiColorCodes;
				if (num != -1)
				{
					return Convert.ToBoolean(num);
				}
				bool flag;
				if (!Console.IsOutputRedirected)
				{
					flag = Environment.GetEnvironmentVariable("NO_COLOR") == null;
				}
				else
				{
					string environmentVariable = Environment.GetEnvironmentVariable("DOTNET_SYSTEM_CONSOLE_ALLOW_ANSI_COLOR_REDIRECTION");
					flag = environmentVariable != null && (environmentVariable == "1" || environmentVariable.Equals("true", StringComparison.OrdinalIgnoreCase));
				}
				s_emitAnsiColorCodes = Convert.ToInt32(flag);
				return flag;
			}
		}

		internal static bool UseNet6KeyParser
		{
			get
			{
				int num = s_useNet6KeyParser;
				if (num == -1)
				{
					num = (s_useNet6KeyParser = (GetNet6CompatReadKeySetting() ? 1 : 0));
				}
				return num == 1;
				static bool GetNet6CompatReadKeySetting()
				{
					if (AppContext.TryGetSwitch("System.Console.UseNet6CompatReadKey", out var isEnabled))
					{
						return isEnabled;
					}
					string environmentVariable = Environment.GetEnvironmentVariable("DOTNET_SYSTEM_CONSOLE_USENET6COMPATREADKEY");
					if (environmentVariable != null)
					{
						if (!(environmentVariable == "1"))
						{
							return environmentVariable.Equals("true", StringComparison.OrdinalIgnoreCase);
						}
						return true;
					}
					return false;
				}
			}
		}
	}
	internal static class SR
	{
		private static readonly bool s_usingResourceKeys = AppContext.TryGetSwitch("System.Resources.UseSystemResourceKeys", out var isEnabled) && isEnabled;

		private static ResourceManager s_resourceManager;

		internal static ResourceManager ResourceManager => s_resourceManager ?? (s_resourceManager = new ResourceManager(typeof(SR)));

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

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

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

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

		private static bool UsingResourceKeys()
		{
			return s_usingResourceKeys;
		}

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

		internal static string GetResourceString(string resourceKey, string defaultString)
		{
			string resourceString = GetResourceString(resourceKey);
			if (!(resourceKey == resourceString) && resourceString != null)
			{
				return resourceString;
			}
			return defaultString;
		}

		internal static string Format(string resourceFormat, object? p1)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1);
			}
			return string.Format(resourceFormat, p1);
		}

		internal static string Format(string resourceFormat, object? p1, object? p2)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2);
			}
			return string.Format(resourceFormat, p1, p2);
		}

		internal static string Format(string resourceFormat, object? p1, object? p2, object? p3)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2, p3);
			}
			return string.Format(resourceFormat, p1, p2, p3);
		}

		internal static string Format(string resourceFormat, params object?[]? args)
		{
			if (args != null)
			{
				if (UsingResourceKeys())
				{
					return resourceFormat + ", " + string.Join(", ", args);
				}
				return string.Format(resourceFormat, args);
			}
			return resourceFormat;
		}

		internal static string Format(IFormatProvider? provider, string resourceFormat, object? p1)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1);
			}
			return string.Format(provider, resourceFormat, p1);
		}

		internal static string Format(IFormatProvider? provider, string resourceFormat, object? p1, object? p2)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2);
			}
			return string.Format(provider, resourceFormat, p1, p2);
		}

		internal static string Format(IFormatProvider? provider, string resourceFormat, object? p1, object? p2, object? p3)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2, p3);
			}
			return string.Format(provider, resourceFormat, p1, p2, p3);
		}

		internal static string Format(IFormatProvider? provider, string resourceFormat, params object?[]? args)
		{
			if (args != null)
			{
				if (UsingResourceKeys())
				{
					return resourceFormat + ", " + string.Join(", ", args);
				}
				return string.Format(provider, resourceFormat, args);
			}
			return resourceFormat;
		}
	}
}
namespace System.Diagnostics.CodeAnalysis
{
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Interface | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, Inherited = false)]
	internal sealed class DynamicallyAccessedMembersAttribute : Attribute
	{
		public DynamicallyAccessedMemberTypes MemberTypes { get; }

		public DynamicallyAccessedMembersAttribute(DynamicallyAccessedMemberTypes memberTypes)
		{
			MemberTypes = memberTypes;
		}
	}
	[Flags]
	internal enum DynamicallyAccessedMemberTypes
	{
		None = 0,
		PublicParameterlessConstructor = 1,
		PublicConstructors = 3,
		NonPublicConstructors = 4,
		PublicMethods = 8,
		NonPublicMethods = 0x10,
		PublicFields = 0x20,
		NonPublicFields = 0x40,
		PublicNestedTypes = 0x80,
		NonPublicNestedTypes = 0x100,
		PublicProperties = 0x200,
		NonPublicProperties = 0x400,
		PublicEvents = 0x800,
		NonPublicEvents = 0x1000,
		Interfaces = 0x2000,
		All = -1
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Constructor | AttributeTargets.Method, Inherited = false)]
	internal sealed class RequiresUnreferencedCodeAttribute : Attribute
	{
		public string Message { get; }

		public string? Url { get; set; }

		public RequiresUnreferencedCodeAttribute(string message)
		{
			Message = message;
		}
	}
	[AttributeUsage(AttributeTargets.All, Inherited = false, AllowMultiple = true)]
	internal sealed class UnconditionalSuppressMessageAttribute : Attribute
	{
		public string Category { get; }

		public string CheckId { get; }

		public string? Scope { get; set; }

		public string? Target { get; set; }

		public string? MessageId { get; set; }

		public string? Justification { get; set; }

		public UnconditionalSuppressMessageAttribute(string category, string checkId)
		{
			Category = category;
			CheckId = checkId;
		}
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Constructor | AttributeTargets.Method, Inherited = false)]
	internal sealed class RequiresDynamicCodeAttribute : Attribute
	{
		public string Message { get; }

		public string? Url { get; set; }

		public RequiresDynamicCodeAttribute(string message)
		{
			Message = message;
		}
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
	internal sealed class StringSyntaxAttribute : Attribute
	{
		public const string CompositeFormat = "CompositeFormat";

		public const string DateOnlyFormat = "DateOnlyFormat";

		public const string DateTimeFormat = "DateTimeFormat";

		public const string EnumFormat = "EnumFormat";

		public const string GuidFormat = "GuidFormat";

		public const string Json = "Json";

		public const string NumericFormat = "NumericFormat";

		public const string Regex = "Regex";

		public const string TimeOnlyFormat = "TimeOnlyFormat";

		public const string TimeSpanFormat = "TimeSpanFormat";

		public const string Uri = "Uri";

		public const string Xml = "Xml";

		public string Syntax { get; }

		public object?[] Arguments { get; }

		public StringSyntaxAttribute(string syntax)
		{
			Syntax = syntax;
			Arguments = Array.Empty<object>();
		}

		public StringSyntaxAttribute(string syntax, params object?[] arguments)
		{
			Syntax = syntax;
			Arguments = arguments;
		}
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)]
	internal sealed class AllowNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)]
	internal sealed class DisallowNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)]
	internal sealed class MaybeNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)]
	internal sealed class NotNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class MaybeNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public MaybeNullWhenAttribute(bool returnValue)
		{
			ReturnValue = returnValue;
		}
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class NotNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public NotNullWhenAttribute(bool returnValue)
		{
			ReturnValue = returnValue;
		}
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = true, Inherited = false)]
	internal sealed class NotNullIfNotNullAttribute : Attribute
	{
		public string ParameterName { get; }

		public NotNullIfNotNullAttribute(string parameterName)
		{
			ParameterName = parameterName;
		}
	}
	[AttributeUsage(AttributeTargets.Method, Inherited = false)]
	internal sealed class DoesNotReturnAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class DoesNotReturnIfAttribute : Attribute
	{
		public bool ParameterValue { get; }

		public DoesNotReturnIfAttribute(bool parameterValue)
		{
			ParameterValue = parameterValue;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	internal sealed class MemberNotNullAttribute : Attribute
	{
		public string[] Members { get; }

		public MemberNotNullAttribute(string member)
		{
			Members = new string[1] { member };
		}

		public MemberNotNullAttribute(params string[] members)
		{
			Members = members;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	internal sealed class MemberNotNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public string[] Members { get; }

		public MemberNotNullWhenAttribute(bool returnValue, string member)
		{
			ReturnValue = returnValue;
			Members = new string[1] { member };
		}

		public MemberNotNullWhenAttribute(bool returnValue, params string[] members)
		{
			ReturnValue = returnValue;
			Members = members;
		}
	}
}
namespace System.Runtime.Versioning
{
	internal abstract class OSPlatformAttribute : Attribute
	{
		public string PlatformName { get; }

		private protected OSPlatformAttribute(string platformName)
		{
			PlatformName = platformName;
		}
	}
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false, Inherited = false)]
	internal sealed class TargetPlatformAttribute : OSPlatformAttribute
	{
		public TargetPlatformAttribute(string platformName)
			: base(platformName)
		{
		}
	}
	[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface, AllowMultiple = true, Inherited = false)]
	internal sealed class SupportedOSPlatformAttribute : OSPlatformAttribute
	{
		public SupportedOSPlatformAttribute(string platformName)
			: base(platformName)
		{
		}
	}
	[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface, AllowMultiple = true, Inherited = false)]
	internal sealed class UnsupportedOSPlatformAttribute : OSPlatformAttribute
	{
		public string? Message { get; }

		public UnsupportedOSPlatformAttribute(string platformName)
			: base(platformName)
		{
		}

		public UnsupportedOSPlatformAttribute(string platformName, string? message)
			: base(platformName)
		{
			Message = message;
		}
	}
	[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface, AllowMultiple = true, Inherited = false)]
	internal sealed class ObsoletedOSPlatformAttribute : OSPlatformAttribute
	{
		public string? Message { get; }

		public string? Url { get; set; }

		public ObsoletedOSPlatformAttribute(string platformName)
			: base(platformName)
		{
		}

		public ObsoletedOSPlatformAttribute(string platformName, string? message)
			: base(platformName)
		{
			Message = message;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = true, Inherited = false)]
	internal sealed class SupportedOSPlatformGuardAttribute : OSPlatformAttribute
	{
		public SupportedOSPlatformGuardAttribute(string platformName)
			: base(platformName)
		{
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = true, Inherited = false)]
	internal sealed class UnsupportedOSPlatformGuardAttribute : OSPlatformAttribute
	{
		public UnsupportedOSPlatformGuardAttribute(string platformName)
			: base(platformName)
		{
		}
	}
}
namespace System.Runtime.InteropServices
{
	[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
	internal sealed class LibraryImportAttribute : Attribute
	{
		public string LibraryName { get; }

		public string? EntryPoint { get; set; }

		public StringMarshalling StringMarshalling { get; set; }

		public Type? StringMarshallingCustomType { get; set; }

		public bool SetLastError { get; set; }

		public LibraryImportAttribute(string libraryName)
		{
			LibraryName = libraryName;
		}
	}
	internal enum StringMarshalling
	{
		Custom,
		Utf8,
		Utf16
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
	internal sealed class CallerArgumentExpressionAttribute : Attribute
	{
		public string ParameterName { get; }

		public CallerArgumentExpressionAttribute(string parameterName)
		{
			ParameterName = parameterName;
		}
	}
}
namespace System.Text.Json
{
	internal sealed class PooledByteBufferWriter : IBufferWriter<byte>, IDisposable
	{
		private byte[] _rentedBuffer;

		private int _index;

		private const int MinimumBufferSize = 256;

		public ReadOnlyMemory<byte> WrittenMemory => _rentedBuffer.AsMemory(0, _index);

		public int WrittenCount => _index;

		public int Capacity => _rentedBuffer.Length;

		public int FreeCapacity => _rentedBuffer.Length - _index;

		private PooledByteBufferWriter()
		{
		}

		public PooledByteBufferWriter(int initialCapacity)
		{
			_rentedBuffer = ArrayPool<byte>.Shared.Rent(initialCapacity);
			_index = 0;
		}

		public void Clear()
		{
			ClearHelper();
		}

		public void ClearAndReturnBuffers()
		{
			ClearHelper();
			byte[] rentedBuffer = _rentedBuffer;
			_rentedBuffer = null;
			ArrayPool<byte>.Shared.Return(rentedBuffer);
		}

		private void ClearHelper()
		{
			_rentedBuffer.AsSpan(0, _index).Clear();
			_index = 0;
		}

		public void Dispose()
		{
			if (_rentedBuffer != null)
			{
				ClearHelper();
				byte[] rentedBuffer = _rentedBuffer;
				_rentedBuffer = null;
				ArrayPool<byte>.Shared.Return(rentedBuffer);
			}
		}

		public void InitializeEmptyInstance(int initialCapacity)
		{
			_rentedBuffer = ArrayPool<byte>.Shared.Rent(initialCapacity);
			_index = 0;
		}

		public static PooledByteBufferWriter CreateEmptyInstanceForCaching()
		{
			return new PooledByteBufferWriter();
		}

		public void Advance(int count)
		{
			_index += count;
		}

		public Memory<byte> GetMemory(int sizeHint = 0)
		{
			CheckAndResizeBuffer(sizeHint);
			return _rentedBuffer.AsMemory(_index);
		}

		public Span<byte> GetSpan(int sizeHint = 0)
		{
			CheckAndResizeBuffer(sizeHint);
			return _rentedBuffer.AsSpan(_index);
		}

		internal Task WriteToStreamAsync(Stream destination, CancellationToken cancellationToken)
		{
			return destination.WriteAsync(_rentedBuffer, 0, _index, cancellationToken);
		}

		internal void WriteToStream(Stream destination)
		{
			destination.Write(_rentedBuffer, 0, _index);
		}

		private void CheckAndResizeBuffer(int sizeHint)
		{
			if (sizeHint == 0)
			{
				sizeHint = 256;
			}
			int num = _rentedBuffer.Length - _index;
			if (sizeHint <= num)
			{
				return;
			}
			int num2 = _rentedBuffer.Length;
			int num3 = Math.Max(sizeHint, num2);
			int num4 = num2 + num3;
			if ((uint)num4 > 2147483647u)
			{
				num4 = num2 + sizeHint;
				if ((uint)num4 > 2147483647u)
				{
					ThrowHelper.ThrowOutOfMemoryException_BufferMaximumSizeExceeded((uint)num4);
				}
			}
			byte[] rentedBuffer = _rentedBuffer;
			_rentedBuffer = ArrayPool<byte>.Shared.Rent(num4);
			Span<byte> span = rentedBuffer.AsSpan(0, _index);
			span.CopyTo(_rentedBuffer);
			span.Clear();
			ArrayPool<byte>.Shared.Return(rentedBuffer);
		}
	}
	internal static class ThrowHelper
	{
		[MethodImpl(MethodImplOptions.NoInlining)]
		[DoesNotReturn]
		public static void ThrowOutOfMemoryException_BufferMaximumSizeExceeded(uint capacity)
		{
			throw new OutOfMemoryException(System.SR.Format(System.SR.BufferMaximumSizeExceeded, capacity));
		}
	}
}
namespace Microsoft.Extensions.Logging
{
	[UnsupportedOSPlatform("browser")]
	public static class ConsoleLoggerExtensions
	{
		internal const string RequiresDynamicCodeMessage = "Binding TOptions to configuration values may require generating dynamic code at runtime.";

		internal const string TrimmingRequiresUnreferencedCodeMessage = "TOptions's dependent types may have their members trimmed. Ensure all required members are preserved.";

		[UnconditionalSuppressMessage("AotAnalysis", "IL3050:RequiresDynamicCode", Justification = "AddConsoleFormatter and RegisterProviderOptions are only called with Options types which only have simple properties.")]
		[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode", Justification = "AddConsoleFormatter and RegisterProviderOptions are only dangerous when the Options type cannot be statically analyzed, but that is not the case here. The DynamicallyAccessedMembers annotations on them will make sure to preserve the right members from the different options objects.")]
		public static ILoggingBuilder AddConsole(this ILoggingBuilder builder)
		{
			LoggingBuilderConfigurationExtensions.AddConfiguration(builder);
			builder.AddConsoleFormatter<JsonConsoleFormatter, JsonConsoleFormatterOptions>();
			builder.AddConsoleFormatter<SystemdConsoleFormatter, ConsoleFormatterOptions>();
			builder.AddConsoleFormatter<SimpleConsoleFormatter, SimpleConsoleFormatterOptions>();
			ServiceCollectionDescriptorExtensions.TryAddEnumerable(builder.Services, ServiceDescriptor.Singleton<ILoggerProvider, ConsoleLoggerProvider>());
			LoggerProviderOptions.RegisterProviderOptions<ConsoleLoggerOptions, ConsoleLoggerProvider>(builder.Services);
			return builder;
		}

		public static ILoggingBuilder AddConsole(this ILoggingBuilder builder, Action<ConsoleLoggerOptions> configure)
		{
			System.ThrowHelper.ThrowIfNull(configure, "configure");
			builder.AddConsole();
			OptionsServiceCollectionExtensions.Configure<ConsoleLoggerOptions>(builder.Services, configure);
			return builder;
		}

		public static ILoggingBuilder AddSimpleConsole(this ILoggingBuilder builder)
		{
			return builder.AddFormatterWithName("simple");
		}

		public static ILoggingBuilder AddSimpleConsole(this ILoggingBuilder builder, Action<SimpleConsoleFormatterOptions> configure)
		{
			return builder.AddConsoleWithFormatter("simple", configure);
		}

		public static ILoggingBuilder AddJsonConsole(this ILoggingBuilder builder)
		{
			return builder.AddFormatterWithName("json");
		}

		public static ILoggingBuilder AddJsonConsole(this ILoggingBuilder builder, Action<JsonConsoleFormatterOptions> configure)
		{
			return builder.AddConsoleWithFormatter("json", configure);
		}

		public static ILoggingBuilder AddSystemdConsole(this ILoggingBuilder builder, Action<ConsoleFormatterOptions> configure)
		{
			return builder.AddConsoleWithFormatter("systemd", configure);
		}

		public static ILoggingBuilder AddSystemdConsole(this ILoggingBuilder builder)
		{
			return builder.AddFormatterWithName("systemd");
		}

		internal static ILoggingBuilder AddConsoleWithFormatter<TOptions>(this ILoggingBuilder builder, string name, Action<TOptions> configure) where TOptions : ConsoleFormatterOptions
		{
			System.ThrowHelper.ThrowIfNull(configure, "configure");
			builder.AddFormatterWithName(name);
			OptionsServiceCollectionExtensions.Configure<TOptions>(builder.Services, configure);
			return builder;
		}

		private static ILoggingBuilder AddFormatterWithName(this ILoggingBuilder builder, string name)
		{
			return builder.AddConsole(delegate(ConsoleLoggerOptions options)
			{
				options.FormatterName = name;
			});
		}

		[RequiresDynamicCode("Binding TOptions to configuration values may require generating dynamic code at runtime.")]
		[RequiresUnreferencedCode("TOptions's dependent types may have their members trimmed. Ensure all required members are preserved.")]
		public static ILoggingBuilder AddConsoleFormatter<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TFormatter, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] TOptions>(this ILoggingBuilder builder) where TFormatter : ConsoleFormatter where TOptions : ConsoleFormatterOptions
		{
			LoggingBuilderConfigurationExtensions.AddConfiguration(builder);
			ServiceCollectionDescriptorExtensions.TryAddEnumerable(builder.Services, ServiceDescriptor.Singleton<ConsoleFormatter, TFormatter>());
			ServiceCollectionDescriptorExtensions.TryAddEnumerable(builder.Services, ServiceDescriptor.Singleton<IConfigureOptions<TOptions>, ConsoleLoggerFormatterConfigureOptions<TFormatter, TOptions>>());
			ServiceCollectionDescriptorExtensions.TryAddEnumerable(builder.Services, ServiceDescriptor.Singleton<IOptionsChangeTokenSource<TOptions>, ConsoleLoggerFormatterOptionsChangeTokenSource<TFormatter, TOptions>>());
			return builder;
		}

		[RequiresDynamicCode("Binding TOptions to configuration values may require generating dynamic code at runtime.")]
		[RequiresUnreferencedCode("TOptions's dependent types may have their members trimmed. Ensure all required members are preserved.")]
		public static ILoggingBuilder AddConsoleFormatter<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TFormatter, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] TOptions>(this ILoggingBuilder builder, Action<TOptions> configure) where TFormatter : ConsoleFormatter where TOptions : ConsoleFormatterOptions
		{
			System.ThrowHelper.ThrowIfNull(configure, "configure");
			builder.AddConsoleFormatter<TFormatter, TOptions>();
			OptionsServiceCollectionExtensions.Configure<TOptions>(builder.Services, configure);
			return builder;
		}
	}
	[UnsupportedOSPlatform("browser")]
	internal sealed class ConsoleLoggerFormatterConfigureOptions<TFormatter, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] TOptions> : ConfigureFromConfigurationOptions<TOptions> where TFormatter : ConsoleFormatter where TOptions : ConsoleFormatterOptions
	{
		[RequiresDynamicCode("Binding TOptions to configuration values may require generating dynamic code at runtime.")]
		[RequiresUnreferencedCode("TOptions's dependent types may have their members trimmed. Ensure all required members are preserved.")]
		public ConsoleLoggerFormatterConfigureOptions(ILoggerProviderConfiguration<ConsoleLoggerProvider> providerConfiguration)
		{
			((ConfigureFromConfigurationOptions<?>)(object)this)..ctor((IConfiguration)(object)providerConfiguration.Configuration.GetSection("FormatterOptions"));
		}
	}
	[UnsupportedOSPlatform("browser")]
	internal sealed class ConsoleLoggerFormatterOptionsChangeTokenSource<TFormatter, TOptions> : ConfigurationChangeTokenSource<TOptions> where TFormatter : ConsoleFormatter where TOptions : ConsoleFormatterOptions
	{
		public ConsoleLoggerFormatterOptionsChangeTokenSource(ILoggerProviderConfiguration<ConsoleLoggerProvider> providerConfiguration)
		{
			((ConfigurationChangeTokenSource<?>)(object)this)..ctor((IConfiguration)(object)providerConfiguration.Configuration.GetSection("FormatterOptions"));
		}
	}
	internal sealed class NullExternalScopeProvider : IExternalScopeProvider
	{
		public static IExternalScopeProvider Instance { get; } = (IExternalScopeProvider)(object)new NullExternalScopeProvider();


		private NullExternalScopeProvider()
		{
		}

		void IExternalScopeProvider.ForEachScope<TState>(Action<object, TState> callback, TState state)
		{
		}

		IDisposable IExternalScopeProvider.Push(object state)
		{
			return NullScope.Instance;
		}
	}
	internal sealed class NullScope : IDisposable
	{
		public static NullScope Instance { get; } = new NullScope();


		private NullScope()
		{
		}

		public void Dispose()
		{
		}
	}
}
namespace Microsoft.Extensions.Logging.Console
{
	internal sealed class AnsiLogConsole : IConsole
	{
		private readonly TextWriter _textWriter;

		public AnsiLogConsole(bool stdErr = false)
		{
			_textWriter = (stdErr ? System.Console.Error : System.Console.Out);
		}

		public void Write(string message)
		{
			_textWriter.Write(message);
		}
	}
	internal sealed class AnsiParser
	{
		private readonly Action<string, int, int, ConsoleColor?, ConsoleColor?> _onParseWrite;

		internal const string DefaultForegroundColor = "\u001b[39m\u001b[22m";

		internal const string DefaultBackgroundColor = "\u001b[49m";

		public AnsiParser(Action<string, int, int, ConsoleColor?, ConsoleColor?> onParseWrite)
		{
			System.ThrowHelper.ThrowIfNull(onParseWrite, "onParseWrite");
			_onParseWrite = onParseWrite;
		}

		public void Parse(string message)
		{
			int num = -1;
			int arg = 0;
			ConsoleColor? arg2 = null;
			ConsoleColor? arg3 = null;
			ReadOnlySpan<char> readOnlySpan = message.AsSpan();
			ConsoleColor? color = null;
			bool isBright = false;
			int num2;
			for (num2 = 0; num2 < readOnlySpan.Length; num2++)
			{
				if (readOnlySpan[num2] == '\u001b' && readOnlySpan.Length >= num2 + 4 && readOnlySpan[num2 + 1] == '[')
				{
					if (readOnlySpan[num2 + 3] == 'm')
					{
						if (IsDigit(readOnlySpan[num2 + 2]))
						{
							int num3 = readOnlySpan[num2 + 2] - 48;
							if (num != -1)
							{
								_onParseWrite(message, num, arg, arg3, arg2);
								num = -1;
								arg = 0;
							}
							if (num3 == 1)
							{
								isBright = true;
							}
							num2 += 3;
							continue;
						}
					}
					else if (readOnlySpan.Length >= num2 + 5 && readOnlySpan[num2 + 4] == 'm' && IsDigit(readOnlySpan[num2 + 2]) && IsDigit(readOnlySpan[num2 + 3]))
					{
						int num3 = (readOnlySpan[num2 + 2] - 48) * 10 + (readOnlySpan[num2 + 3] - 48);
						if (num != -1)
						{
							_onParseWrite(message, num, arg, arg3, arg2);
							num = -1;
							arg = 0;
						}
						if (TryGetForegroundColor(num3, isBright, out color))
						{
							arg2 = color;
							isBright = false;
						}
						else if (TryGetBackgroundColor(num3, out color))
						{
							arg3 = color;
						}
						num2 += 4;
						continue;
					}
				}
				if (num == -1)
				{
					num = num2;
				}
				int num4 = -1;
				if (num2 < message.Length - 1)
				{
					num4 = message.IndexOf('\u001b', num2 + 1);
				}
				if (num4 < 0)
				{
					arg = message.Length - num;
					break;
				}
				arg = num4 - num;
				num2 = num4 - 1;
			}
			if (num != -1)
			{
				_onParseWrite(message, num, arg, arg3, arg2);
			}
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		private static bool IsDigit(char c)
		{
			return (uint)(c - 48) <= 9u;
		}

		internal static string GetForegroundColorEscapeCode(ConsoleColor color)
		{
			return color switch
			{
				ConsoleColor.Black => "\u001b[30m", 
				ConsoleColor.DarkRed => "\u001b[31m", 
				ConsoleColor.DarkGreen => "\u001b[32m", 
				ConsoleColor.DarkYellow => "\u001b[33m", 
				ConsoleColor.DarkBlue => "\u001b[34m", 
				ConsoleColor.DarkMagenta => "\u001b[35m", 
				ConsoleColor.DarkCyan => "\u001b[36m", 
				ConsoleColor.Gray => "\u001b[37m", 
				ConsoleColor.Red => "\u001b[1m\u001b[31m", 
				ConsoleColor.Green => "\u001b[1m\u001b[32m", 
				ConsoleColor.Yellow => "\u001b[1m\u001b[33m", 
				ConsoleColor.Blue => "\u001b[1m\u001b[34m", 
				ConsoleColor.Magenta => "\u001b[1m\u001b[35m", 
				ConsoleColor.Cyan => "\u001b[1m\u001b[36m", 
				ConsoleColor.White => "\u001b[1m\u001b[37m", 
				_ => "\u001b[39m\u001b[22m", 
			};
		}

		internal static string GetBackgroundColorEscapeCode(ConsoleColor color)
		{
			return color switch
			{
				ConsoleColor.Black => "\u001b[40m", 
				ConsoleColor.DarkRed => "\u001b[41m", 
				ConsoleColor.DarkGreen => "\u001b[42m", 
				ConsoleColor.DarkYellow => "\u001b[43m", 
				ConsoleColor.DarkBlue => "\u001b[44m", 
				ConsoleColor.DarkMagenta => "\u001b[45m", 
				ConsoleColor.DarkCyan => "\u001b[46m", 
				ConsoleColor.Gray => "\u001b[47m", 
				_ => "\u001b[49m", 
			};
		}

		private static bool TryGetForegroundColor(int number, bool isBright, out ConsoleColor? color)
		{
			color = number switch
			{
				30 => ConsoleColor.Black, 
				31 => isBright ? ConsoleColor.Red : ConsoleColor.DarkRed, 
				32 => isBright ? ConsoleColor.Green : ConsoleColor.DarkGreen, 
				33 => isBright ? ConsoleColor.Yellow : ConsoleColor.DarkYellow, 
				34 => (!isBright) ? ConsoleColor.DarkBlue : ConsoleColor.Blue, 
				35 => isBright ? ConsoleColor.Magenta : ConsoleColor.DarkMagenta, 
				36 => isBright ? ConsoleColor.Cyan : ConsoleColor.DarkCyan, 
				37 => isBright ? ConsoleColor.White : ConsoleColor.Gray, 
				_ => null, 
			};
			if (!color.HasValue)
			{
				return number == 39;
			}
			return true;
		}

		private static bool TryGetBackgroundColor(int number, out ConsoleColor? color)
		{
			color = number switch
			{
				40 => ConsoleColor.Black, 
				41 => ConsoleColor.DarkRed, 
				42 => ConsoleColor.DarkGreen, 
				43 => ConsoleColor.DarkYellow, 
				44 => ConsoleColor.DarkBlue, 
				45 => ConsoleColor.DarkMagenta, 
				46 => ConsoleColor.DarkCyan, 
				47 => ConsoleColor.Gray, 
				_ => null, 
			};
			if (!color.HasValue)
			{
				return number == 49;
			}
			return true;
		}
	}
	[UnsupportedOSPlatform("android")]
	[UnsupportedOSPlatform("browser")]
	[UnsupportedOSPlatform("ios")]
	[UnsupportedOSPlatform("tvos")]
	internal sealed class AnsiParsingLogConsole : IConsole
	{
		private readonly TextWriter _textWriter;

		private readonly AnsiParser _parser;

		public AnsiParsingLogConsole(bool stdErr = false)
		{
			_textWriter = (stdErr ? System.Console.Error : System.Console.Out);
			_parser = new AnsiParser(WriteToConsole);
		}

		public void Write(string message)
		{
			_parser.Parse(message);
		}

		private static bool SetColor(ConsoleColor? background, ConsoleColor? foreground)
		{
			bool flag = SetBackgroundColor(background);
			return SetForegroundColor(foreground) || flag;
		}

		private static bool SetBackgroundColor(ConsoleColor? background)
		{
			if (background.HasValue)
			{
				System.Console.BackgroundColor = background.Value;
				return true;
			}
			return false;
		}

		private static bool SetForegroundColor(ConsoleColor? foreground)
		{
			if (foreground.HasValue)
			{
				System.Console.ForegroundColor = foreground.Value;
				return true;
			}
			return false;
		}

		private static void ResetColor()
		{
			System.Console.ResetColor();
		}

		private void WriteToConsole(string message, int startIndex, int length, ConsoleColor? background, ConsoleColor? foreground)
		{
			ReadOnlySpan<char> readOnlySpan = message.AsSpan(startIndex, length);
			bool flag = SetColor(background, foreground);
			_textWriter.Write(readOnlySpan.ToString());
			if (flag)
			{
				ResetColor();
			}
		}
	}
	public abstract class ConsoleFormatter
	{
		public string Name { get; }

		protected ConsoleFormatter(string name)
		{
			System.ThrowHelper.ThrowIfNull(name, "name");
			Name = name;
		}

		public abstract void Write<TState>(in LogEntry<TState> logEntry, IExternalScopeProvider? scopeProvider, TextWriter textWriter);
	}
	public static class ConsoleFormatterNames
	{
		public const string Simple = "simple";

		public const string Json = "json";

		public const string Systemd = "systemd";
	}
	public class ConsoleFormatterOptions
	{
		public bool IncludeScopes { get; set; }

		[StringSyntax("DateTimeFormat")]
		public string? TimestampFormat { get; set; }

		public bool UseUtcTimestamp { get; set; }
	}
	[UnsupportedOSPlatform("browser")]
	internal sealed class ConsoleLogger : ILogger
	{
		private readonly string _name;

		private readonly ConsoleLoggerProcessor _queueProcessor;

		[ThreadStatic]
		private static StringWriter t_stringWriter;

		internal ConsoleFormatter Formatter { get; set; }

		internal IExternalScopeProvider? ScopeProvider { get; set; }

		internal ConsoleLoggerOptions Options { get; set; }

		internal ConsoleLogger(string name, ConsoleLoggerProcessor loggerProcessor, ConsoleFormatter formatter, IExternalScopeProvider? scopeProvider, ConsoleLoggerOptions options)
		{
			System.ThrowHelper.ThrowIfNull(name, "name");
			_name = name;
			_queueProcessor = loggerProcessor;
			Formatter = formatter;
			ScopeProvider = scopeProvider;
			Options = options;
		}

		public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception? exception, Func<TState, Exception?, string> formatter)
		{
			//IL_0001: 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_0030: 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_009b: Unknown result type (might be due to invalid IL or missing references)
			if (!IsEnabled(logLevel))
			{
				return;
			}
			System.ThrowHelper.ThrowIfNull(formatter, "formatter");
			if (t_stringWriter == null)
			{
				t_stringWriter = new StringWriter();
			}
			LogEntry<TState> logEntry = default(LogEntry<TState>);
			logEntry..ctor(logLevel, _name, eventId, state, exception, formatter);
			Formatter.Write(in logEntry, ScopeProvider, t_stringWriter);
			StringBuilder stringBuilder = t_stringWriter.GetStringBuilder();
			if (stringBuilder.Length != 0)
			{
				string message = stringBuilder.ToString();
				stringBuilder.Clear();
				if (stringBuilder.Capacity > 1024)
				{
					stringBuilder.Capacity = 1024;
				}
				_queueProcessor.EnqueueMessage(new LogMessageEntry(message, logLevel >= Options.LogToStandardErrorThreshold));
			}
		}

		public bool IsEnabled(LogLevel logLevel)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Invalid comparison between Unknown and I4
			return (int)logLevel != 6;
		}

		public IDisposable BeginScope<TState>(TState state) where TState : notnull
		{
			IExternalScopeProvider? scopeProvider = ScopeProvider;
			return ((scopeProvider != null) ? scopeProvider.Push((object)state) : null) ?? NullScope.Instance;
		}
	}
	[Obsolete("ConsoleLoggerFormat has been deprecated.")]
	public enum ConsoleLoggerFormat
	{
		Default,
		Systemd
	}
	public class ConsoleLoggerOptions
	{
		private ConsoleLoggerFormat _format;

		private ConsoleLoggerQueueFullMode _queueFullMode;

		internal const int DefaultMaxQueueLengthValue = 2500;

		private int _maxQueuedMessages = 2500;

		[Obsolete("ConsoleLoggerOptions.DisableColors has been deprecated. Use SimpleConsoleFormatterOptions.ColorBehavior instead.")]
		public bool DisableColors { get; set; }

		[Obsolete("ConsoleLoggerOptions.Format has been deprecated. Use ConsoleLoggerOptions.FormatterName instead.")]
		public ConsoleLoggerFormat Format
		{
			get
			{
				return _format;
			}
			set
			{
				if (value < ConsoleLoggerFormat.Default || value > ConsoleLoggerFormat.Systemd)
				{
					throw new ArgumentOutOfRangeException("value");
				}
				_format = value;
			}
		}

		public string? FormatterName { get; set; }

		[Obsolete("ConsoleLoggerOptions.IncludeScopes has been deprecated. Use ConsoleFormatterOptions.IncludeScopes instead.")]
		public bool IncludeScopes { get; set; }

		public LogLevel LogToStandardErrorThreshold { get; set; } = (LogLevel)6;


		[Obsolete("ConsoleLoggerOptions.TimestampFormat has been deprecated. Use ConsoleFormatterOptions.TimestampFormat instead.")]
		public string? TimestampFormat { get; set; }

		[Obsolete("ConsoleLoggerOptions.UseUtcTimestamp has been deprecated. Use ConsoleFormatterOptions.UseUtcTimestamp instead.")]
		public bool UseUtcTimestamp { get; set; }

		public ConsoleLoggerQueueFullMode QueueFullMode
		{
			get
			{
				return _queueFullMode;
			}
			set
			{
				if (value != 0 && value != ConsoleLoggerQueueFullMode.DropWrite)
				{
					throw new ArgumentOutOfRangeException(System.SR.Format(System.SR.QueueModeNotSupported, "value"));
				}
				_queueFullMode = value;
			}
		}

		public int MaxQueueLength
		{
			get
			{
				return _maxQueuedMessages;
			}
			set
			{
				if (value <= 0)
				{
					throw new ArgumentOutOfRangeException(System.SR.Format(System.SR.MaxQueueLengthBadValue, "value"));
				}
				_maxQueuedMessages = value;
			}
		}
	}
	[UnsupportedOSPlatform("browser")]
	internal class ConsoleLoggerProcessor : IDisposable
	{
		private readonly Queue<LogMessageEntry> _messageQueue;

		private volatile int _messagesDropped;

		private bool _isAddingCompleted;

		private int _maxQueuedMessages = 2500;

		private ConsoleLoggerQueueFullMode _fullMode;

		private readonly Thread _outputThread;

		public int MaxQueueLength
		{
			get
			{
				return _maxQueuedMessages;
			}
			set
			{
				if (value <= 0)
				{
					throw new ArgumentOutOfRangeException(System.SR.Format(System.SR.MaxQueueLengthBadValue, "value"));
				}
				lock (_messageQueue)
				{
					_maxQueuedMessages = value;
					Monitor.PulseAll(_messageQueue);
				}
			}
		}

		public ConsoleLoggerQueueFullMode FullMode
		{
			get
			{
				return _fullMode;
			}
			set
			{
				if (value != 0 && value != ConsoleLoggerQueueFullMode.DropWrite)
				{
					throw new ArgumentOutOfRangeException(System.SR.Format(System.SR.QueueModeNotSupported, "value"));
				}
				lock (_messageQueue)
				{
					_fullMode = value;
					Monitor.PulseAll(_messageQueue);
				}
			}
		}

		public IConsole Console { get; }

		public IConsole ErrorConsole { get; }

		public ConsoleLoggerProcessor(IConsole console, IConsole errorConsole, ConsoleLoggerQueueFullMode fullMode, int maxQueueLength)
		{
			_messageQueue = new Queue<LogMessageEntry>();
			FullMode = fullMode;
			MaxQueueLength = maxQueueLength;
			Console = console;
			ErrorConsole = errorConsole;
			_outputThread = new Thread(ProcessLogQueue)
			{
				IsBackground = true,
				Name = "Console logger queue processing thread"
			};
			_outputThread.Start();
		}

		public virtual void EnqueueMessage(LogMessageEntry message)
		{
			if (!Enqueue(message))
			{
				WriteMessage(message);
			}
		}

		internal void WriteMessage(LogMessageEntry entry)
		{
			try
			{
				IConsole console = (entry.LogAsError ? ErrorConsole : Console);
				console.Write(entry.Message);
			}
			catch
			{
				CompleteAdding();
			}
		}

		private void ProcessLogQueue()
		{
			LogMessageEntry item;
			while (TryDequeue(out item))
			{
				WriteMessage(item);
			}
		}

		public bool Enqueue(LogMessageEntry item)
		{
			lock (_messageQueue)
			{
				while (_messageQueue.Count >= MaxQueueLength && !_isAddingCompleted)
				{
					if (FullMode == ConsoleLoggerQueueFullMode.DropWrite)
					{
						_messagesDropped++;
						return true;
					}
					Monitor.Wait(_messageQueue);
				}
				if (!_isAddingCompleted)
				{
					bool flag = _messageQueue.Count == 0;
					if (_messagesDropped > 0)
					{
						_messageQueue.Enqueue(new LogMessageEntry(System.SR.Format(System.SR.WarningMessageOnDrop + Environment.NewLine, _messagesDropped), logAsError: true));
						_messagesDropped = 0;
					}
					_messageQueue.Enqueue(item);
					if (flag)
					{
						Monitor.PulseAll(_messageQueue);
					}
					return true;
				}
			}
			return false;
		}

		public bool TryDequeue(out LogMessageEntry item)
		{
			lock (_messageQueue)
			{
				while (_messageQueue.Count == 0 && !_isAddingCompleted)
				{
					Monitor.Wait(_messageQueue);
				}
				if (_messageQueue.Count > 0 && !_isAddingCompleted)
				{
					item = _messageQueue.Dequeue();
					if (_messageQueue.Count == MaxQueueLength - 1)
					{
						Monitor.PulseAll(_messageQueue);
					}
					return true;
				}
				item = default(LogMessageEntry);
				return false;
			}
		}

		public void Dispose()
		{
			CompleteAdding();
			try
			{
				_outputThread.Join(1500);
			}
			catch (ThreadStateException)
			{
			}
		}

		private void CompleteAdding()
		{
			lock (_messageQueue)
			{
				_isAddingCompleted = true;
				Monitor.PulseAll(_messageQueue);
			}
		}
	}
	[UnsupportedOSPlatform("browser")]
	[ProviderAlias("Console")]
	public class ConsoleLoggerProvider : ILoggerProvider, IDisposable, ISupportExternalScope
	{
		private readonly IOptionsMonitor<ConsoleLoggerOptions> _options;

		private readonly ConcurrentDictionary<string, ConsoleLogger> _loggers;

		private ConcurrentDictionary<string, ConsoleFormatter> _formatters;

		private readonly ConsoleLoggerProcessor _messageQueue;

		private IDisposable _optionsReloadToken;

		private IExternalScopeProvider _scopeProvider = NullExternalScopeProvider.Instance;

		public ConsoleLoggerProvider(IOptionsMonitor<ConsoleLoggerOptions> options)
			: this(options, Array.Empty<ConsoleFormatter>())
		{
		}

		public ConsoleLoggerProvider(IOptionsMonitor<ConsoleLoggerOptions> options, IEnumerable<ConsoleFormatter>? formatters)
		{
			_options = options;
			_loggers = new ConcurrentDictionary<string, ConsoleLogger>();
			SetFormatters(formatters);
			IConsole console;
			IConsole errorConsole;
			if (DoesConsoleSupportAnsi())
			{
				console = new AnsiLogConsole();
				errorConsole = new AnsiLogConsole(stdErr: true);
			}
			else
			{
				console = new AnsiParsingLogConsole();
				errorConsole = new AnsiParsingLogConsole(stdErr: true);
			}
			_messageQueue = new ConsoleLoggerProcessor(console, errorConsole, options.CurrentValue.QueueFullMode, options.CurrentValue.MaxQueueLength);
			ReloadLoggerOptions(options.CurrentValue);
			_optionsReloadToken = OptionsMonitorExtensions.OnChange<ConsoleLoggerOptions>(_options, (Action<ConsoleLoggerOptions>)ReloadLoggerOptions);
		}

		[UnsupportedOSPlatformGuard("windows")]
		private static bool DoesConsoleSupportAnsi()
		{
			if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
			{
				return true;
			}
			IntPtr stdHandle = global::Interop.Kernel32.GetStdHandle(-11);
			if (!global::Interop.Kernel32.GetConsoleMode(stdHandle, out var mode))
			{
				return false;
			}
			return ((ulong)mode & 4uL) == 4;
		}

		[MemberNotNull("_formatters")]
		private void SetFormatters(IEnumerable<ConsoleFormatter> formatters = null)
		{
			ConcurrentDictionary<string, ConsoleFormatter> concurrentDictionary = new ConcurrentDictionary<string, ConsoleFormatter>(StringComparer.OrdinalIgnoreCase);
			bool flag = false;
			if (formatters != null)
			{
				foreach (ConsoleFormatter formatter in formatters)
				{
					concurrentDictionary.TryAdd(formatter.Name, formatter);
					flag = true;
				}
			}
			if (!flag)
			{
				concurrentDictionary.TryAdd("simple", new SimpleConsoleFormatter((IOptionsMonitor<SimpleConsoleFormatterOptions>)(object)new FormatterOptionsMonitor<SimpleConsoleFormatterOptions>(new SimpleConsoleFormatterOptions())));
				concurrentDictionary.TryAdd("systemd", new SystemdConsoleFormatter((IOptionsMonitor<ConsoleFormatterOptions>)(object)new FormatterOptionsMonitor<ConsoleFormatterOptions>(new ConsoleFormatterOptions())));
				concurrentDictionary.TryAdd("json", new JsonConsoleFormatter((IOptionsMonitor<JsonConsoleFormatterOptions>)(object)new FormatterOptionsMonitor<JsonConsoleFormatterOptions>(new JsonConsoleFormatterOptions())));
			}
			_formatters = concurrentDictionary;
		}

		private void ReloadLoggerOptions(ConsoleLoggerOptions options)
		{
			if (options.FormatterName == null || !_formatters.TryGetValue(options.FormatterName, out var value))
			{
				ConsoleLoggerFormat format = options.Format;
				ConsoleFormatter consoleFormatter = ((format != ConsoleLoggerFormat.Systemd) ? _formatters["simple"] : _formatters["systemd"]);
				value = consoleFormatter;
				if (options.FormatterName == null)
				{
					UpdateFormatterOptions(value, options);
				}
			}
			_messageQueue.FullMode = options.QueueFullMode;
			_messageQueue.MaxQueueLength = options.MaxQueueLength;
			foreach (KeyValuePair<string, ConsoleLogger> logger in _loggers)
			{
				logger.Value.Options = options;
				logger.Value.Formatter = value;
			}
		}

		public ILogger CreateLogger(string name)
		{
			if (_options.CurrentValue.FormatterName == null || !_formatters.TryGetValue(_options.CurrentValue.FormatterName, out var value))
			{
				ConsoleLoggerFormat format = _options.CurrentValue.Format;
				ConsoleFormatter consoleFormatter = ((format != ConsoleLoggerFormat.Systemd) ? _formatters["simple"] : _formatters["systemd"]);
				value = consoleFormatter;
				if (_options.CurrentValue.FormatterName == null)
				{
					UpdateFormatterOptions(value, _options.CurrentValue);
				}
			}
			if (!_loggers.TryGetValue(name, out var value2))
			{
				return (ILogger)(object)_loggers.GetOrAdd(name, new ConsoleLogger(name, _messageQueue, value, _scopeProvider, _options.CurrentValue));
			}
			return (ILogger)(object)value2;
		}

		private static void UpdateFormatterOptions(ConsoleFormatter formatter, ConsoleLoggerOptions deprecatedFromOptions)
		{
			if (formatter is SimpleConsoleFormatter simpleConsoleFormatter)
			{
				simpleConsoleFormatter.FormatterOptions = new SimpleConsoleFormatterOptions
				{
					ColorBehavior = (deprecatedFromOptions.DisableColors ? LoggerColorBehavior.Disabled : LoggerColorBehavior.Default),
					IncludeScopes = deprecatedFromOptions.IncludeScopes,
					TimestampFormat = deprecatedFromOptions.TimestampFormat,
					UseUtcTimestamp = deprecatedFromOptions.UseUtcTimestamp
				};
			}
			else if (formatter is SystemdConsoleFormatter systemdConsoleFormatter)
			{
				systemdConsoleFormatter.FormatterOptions = new ConsoleFormatterOptions
				{
					IncludeScopes = deprecatedFromOptions.IncludeScopes,
					TimestampFormat = deprecatedFromOptions.TimestampFormat,
					UseUtcTimestamp = deprecatedFromOptions.UseUtcTimestamp
				};
			}
		}

		public void Dispose()
		{
			_optionsReloadToken?.Dispose();
			_messageQueue.Dispose();
		}

		public void SetScopeProvider(IExternalScopeProvider scopeProvider)
		{
			_scopeProvider = scopeProvider;
			foreach (KeyValuePair<string, ConsoleLogger> logger in _loggers)
			{
				logger.Value.ScopeProvider = _scopeProvider;
			}
		}
	}
	public enum ConsoleLoggerQueueFullMode
	{
		Wait,
		DropWrite
	}
	internal sealed class FormatterOptionsMonitor<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] TOptions> : IOptionsMonitor<TOptions> where TOptions : ConsoleFormatterOptions
	{
		private TOptions _options;

		public TOptions CurrentValue => _options;

		public FormatterOptionsMonitor(TOptions options)
		{
			_options = options;
		}

		public TOptions Get(string? name)
		{
			return _options;
		}

		public IDisposable? OnChange(Action<TOptions, string> listener)
		{
			return null;
		}
	}
	internal interface IConsole
	{
		void Write(string message);
	}
	internal sealed class JsonConsoleFormatter : ConsoleFormatter, IDisposable
	{
		private IDisposable _optionsReloadToken;

		internal JsonConsoleFormatterOptions FormatterOptions { get; set; }

		public JsonConsoleFormatter(IOptionsMonitor<JsonConsoleFormatterOptions> options)
			: base("json")
		{
			ReloadLoggerOptions(options.CurrentValue);
			_optionsReloadToken = OptionsMonitorExtensions.OnChange<JsonConsoleFormatterOptions>(options, (Action<JsonConsoleFormatterOptions>)ReloadLoggerOptions);
		}

		public override void Write<TState>(in LogEntry<TState> logEntry, IExternalScopeProvider? scopeProvider, TextWriter textWriter)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: 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_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Expected O, but got Unknown
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			string text = logEntry.Formatter(logEntry.State, logEntry.Exception);
			if (logEntry.Exception == null && text == null)
			{
				return;
			}
			LogLevel logLevel = logEntry.LogLevel;
			string category = logEntry.Category;
			EventId eventId = logEntry.EventId;
			int id = ((EventId)(ref eventId)).Id;
			Exception exception = logEntry.Exception;
			using (PooledByteBufferWriter pooledByteBufferWriter = new PooledByteBufferWriter(1024))
			{
				Utf8JsonWriter val = new Utf8JsonWriter((IBufferWriter<byte>)pooledByteBufferWriter, FormatterOptions.JsonWriterOptions);
				try
				{
					val.WriteStartObject();
					string timestampFormat = FormatterOptions.TimestampFormat;
					if (timestampFormat != null)
					{
						val.WriteString("Timestamp", (FormatterOptions.UseUtcTimestamp ? DateTimeOffset.UtcNow : DateTimeOffset.Now).ToString(timestampFormat));
					}
					val.WriteNumber("EventId", id);
					val.WriteString("LogLevel", GetLogLevelString(logLevel));
					val.WriteString("Category", category);
					val.WriteString("Message", text);
					if (exception != null)
					{
						string text2 = exception.ToString();
						JsonWriterOptions jsonWriterOptions = FormatterOptions.JsonWriterOptions;
						if (!((JsonWriterOptions)(ref jsonWriterOptions)).Indented)
						{
							text2 = text2.Replace(Environment.NewLine, " ");
						}
						val.WriteString("Exception", text2);
					}
					if (logEntry.State != null)
					{
						val.WriteStartObject("State");
						val.WriteString("Message", logEntry.State.ToString());
						if ((object)logEntry.State is IReadOnlyCollection<KeyValuePair<string, object>> readOnlyCollection)
						{
							foreach (KeyValuePair<string, object> item in readOnlyCollection)
							{
								WriteItem(val, item);
							}
						}
						val.WriteEndObject();
					}
					WriteScopeInformation(val, scopeProvider);
					val.WriteEndObject();
					val.Flush();
				}
				finally
				{
					((IDisposable)val)?.Dispose();
				}
				textWriter.Write(Encoding.UTF8.GetString(pooledByteBufferWriter.WrittenMemory.Span.ToArray()));
			}
			textWriter.Write(Environment.NewLine);
		}

		private static string GetLogLevelString(LogLevel logLevel)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected I4, but got Unknown
			return (int)logLevel switch
			{
				0 => "Trace", 
				1 => "Debug", 
				2 => "Information", 
				3 => "Warning", 
				4 => "Error", 
				5 => "Critical", 
				_ => throw new ArgumentOutOfRangeException("logLevel"), 
			};
		}

		private void WriteScopeInformation(Utf8JsonWriter writer, IExternalScopeProvider scopeProvider)
		{
			if (!FormatterOptions.IncludeScopes || scopeProvider == null)
			{
				return;
			}
			writer.WriteStartArray("Scopes");
			scopeProvider.ForEachScope<Utf8JsonWriter>((Action<object, Utf8JsonWriter>)delegate(object scope, Utf8JsonWriter state)
			{
				if (scope is IEnumerable<KeyValuePair<string, object>> enumerable)
				{
					state.WriteStartObject();
					state.WriteString("Message", scope.ToString());
					foreach (KeyValuePair<string, object> item in enumerable)
					{
						WriteItem(state, item);
					}
					state.WriteEndObject();
				}
				else
				{
					state.WriteStringValue(ToInvariantString(scope));
				}
			}, writer);
			writer.WriteEndArray();
		}

		private static void WriteItem(Utf8JsonWriter writer, KeyValuePair<string, object> item)
		{
			string key = item.Key;
			object value = item.Value;
			if (!(value is bool flag))
			{
				if (!(value is byte b))
				{
					if (!(value is sbyte b2))
					{
						if (!(value is char c))
						{
							if (!(value is decimal num))
							{
								if (!(value is double num2))
								{
									if (!(value is float num3))
									{
										if (!(value is int num4))
										{
											if (!(value is uint num5))
											{
												if (!(value is long num6))
												{
													if (!(value is ulong num7))
													{
														if (!(value is short num8))
														{
															if (!(value is ushort num9))
															{
																if (value == null)
																{
																	writer.WriteNull(key);
																}
																else
																{
																	writer.WriteString(key, ToInvariantString(item.Value));
																}
															}
															else
															{
																writer.WriteNumber(key, (int)num9);
															}
														}
														else
														{
															writer.WriteNumber(key, (int)num8);
														}
													}
													else
													{
														writer.WriteNumber(key, num7);
													}
												}
												else
												{
													writer.WriteNumber(key, num6);
												}
											}
											else
											{
												writer.WriteNumber(key, num5);
											}
										}
										else
										{
											writer.WriteNumber(key, num4);
										}
									}
									else
									{
										writer.WriteNumber(key, num3);
									}
								}
								else
								{
									writer.WriteNumber(key, num2);
								}
							}
							else
							{
								writer.WriteNumber(key, num);
							}
						}
						else
						{
							writer.WriteString(key, c.ToString());
						}
					}
					else
					{
						writer.WriteNumber(key, (int)b2);
					}
				}
				else
				{
					writer.WriteNumber(key, (int)b);
				}
			}
			else
			{
				writer.WriteBoolean(key, flag);
			}
		}

		private static string ToInvariantString(object obj)
		{
			return Convert.ToString(obj, CultureInfo.InvariantCulture);
		}

		[MemberNotNull("FormatterOptions")]
		private void ReloadLoggerOptions(JsonConsoleFormatterOptions options)
		{
			FormatterOptions = options;
		}

		public void Dispose()
		{
			_optionsReloadToken?.Dispose();
		}
	}
	public class JsonConsoleFormatterOptions : ConsoleFormatterOptions
	{
		public JsonWriterOptions JsonWriterOptions { get; set; }
	}
	public enum LoggerColorBehavior
	{
		Default,
		Enabled,
		Disabled
	}
	internal readonly struct LogMessageEntry
	{
		public readonly string Message;

		public readonly bool LogAsError;

		public LogMessageEntry(string message, bool logAsError = false)
		{
			Message = message;
			LogAsError = logAsError;
		}
	}
	internal sealed class SimpleConsoleFormatter : ConsoleFormatter, IDisposable
	{
		private readonly struct ConsoleColors
		{
			public ConsoleColor? Foreground { get; }

			public ConsoleColor? Background { get; }

			public ConsoleColors(ConsoleColor? foreground, ConsoleColor? background)
			{
				Foreground = foreground;
				Background = background;
			}
		}

		private const string LoglevelPadding = ": ";

		private static readonly string _messagePadding = new string(' ', GetLogLevelString((LogLevel)2).Length + ": ".Length);

		private static readonly string _newLineWithMessagePadding = Environment.NewLine + _messagePadding;

		private IDisposable _optionsReloadToken;

		internal SimpleConsoleFormatterOptions FormatterOptions { get; set; }

		public SimpleConsoleFormatter(IOptionsMonitor<SimpleConsoleFormatterOptions> options)
			: base("simple")
		{
			ReloadLoggerOptions(options.CurrentValue);
			_optionsReloadToken = OptionsMonitorExtensions.OnChange<SimpleConsoleFormatterOptions>(options, (Action<SimpleConsoleFormatterOptions>)ReloadLoggerOptions);
		}

		[MemberNotNull("FormatterOptions")]
		private void ReloadLoggerOptions(SimpleConsoleFormatterOptions options)
		{
			FormatterOptions = options;
		}

		public void Dispose()
		{
			_optionsReloadToken?.Dispose();
		}

		public override void Write<TState>(in LogEntry<TState> logEntry, IExternalScopeProvider? scopeProvider, TextWriter textWriter)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: 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_0033: Unknown result type (might be due to invalid IL or missing references)
			string text = logEntry.Formatter(logEntry.State, logEntry.Exception);
			if (logEntry.Exception != null || text != null)
			{
				LogLevel logLevel = logEntry.LogLevel;
				ConsoleColors logLevelConsoleColors = GetLogLevelConsoleColors(logLevel);
				string logLevelString = GetLogLevelString(logLevel);
				string text2 = null;
				string timestampFormat = FormatterOptions.TimestampFormat;
				if (timestampFormat != null)
				{
					text2 = GetCurrentDateTime().ToString(timestampFormat);
				}
				if (text2 != null)
				{
					textWriter.Write(text2);
				}
				if (logLevelString != null)
				{
					textWriter.WriteColoredMessage(logLevelString, logLevelConsoleColors.Background, logLevelConsoleColors.Foreground);
				}
				CreateDefaultLogMessage(textWriter, in logEntry, text, scopeProvider);
			}
		}

		private void CreateDefaultLogMessage<TState>(TextWriter textWriter, in LogEntry<TState> logEntry, string message, IExternalScopeProvider scopeProvider)
		{
			//IL_000d: 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)
			bool singleLine = FormatterOptions.SingleLine;
			EventId eventId = logEntry.EventId;
			int id = ((EventId)(ref eventId)).Id;
			Exception exception = logEntry.Exception;
			textWriter.Write(": ");
			textWriter.Write(logEntry.Category);
			textWriter.Write('[');
			textWriter.Write(id.ToString());
			textWriter.Write(']');
			if (!singleLine)
			{
				textWriter.Write(Environment.NewLine);
			}
			WriteScopeInformation(textWriter, scopeProvider, singleLine);
			WriteMessage(textWriter, message, singleLine);
			if (exception != null)
			{
				WriteMessage(textWriter, exception.ToString(), singleLine);
			}
			if (singleLine)
			{
				textWriter.Write(Environment.NewLine);
			}
		}

		private static void WriteMessage(TextWriter textWriter, string message, bool singleLine)
		{
			if (!string.IsNullOrEmpty(message))
			{
				if (singleLine)
				{
					textWriter.Write(' ');
					WriteReplacing(textWriter, Environment.NewLine, " ", message);
				}
				else
				{
					textWriter.Write(_messagePadding);
					WriteReplacing(textWriter, Environment.NewLine, _newLineWithMessagePadding, message);
					textWriter.Write(Environment.NewLine);
				}
			}
			static void WriteReplacing(TextWriter writer, string oldValue, string newValue, string message)
			{
				string value = message.Replace(oldValue, newValue);
				writer.Write(value);
			}
		}

		private DateTimeOffset GetCurrentDateTime()
		{
			if (!FormatterOptions.UseUtcTimestamp)
			{
				return DateTimeOffset.Now;
			}
			return DateTimeOffset.UtcNow;
		}

		private static string GetLogLevelString(LogLevel logLevel)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected I4, but got Unknown
			return (int)logLevel switch
			{
				0 => "trce", 
				1 => "dbug", 
				2 => "info", 
				3 => "warn", 
				4 => "fail", 
				5 => "crit", 
				_ => throw new ArgumentOutOfRangeException("logLevel"), 
			};
		}

		private ConsoleColors GetLogLevelConsoleColors(LogLevel logLevel)
		{
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Expected I4, but got Unknown
			if (FormatterOptions.ColorBehavior == LoggerColorBehavior.Disabled || (FormatterOptions.ColorBehavior == LoggerColorBehavior.Default && !ConsoleUtils.EmitAnsiColorCodes))
			{
				return new ConsoleColors(null, null);
			}
			return (int)logLevel switch
			{
				0 => new ConsoleColors(ConsoleColor.Gray, ConsoleColor.Black), 
				1 => new ConsoleColors(ConsoleColor.Gray, ConsoleColor.Black), 
				2 => new ConsoleColors(ConsoleColor.DarkGreen, ConsoleColor.Black), 
				3 => new ConsoleColors(ConsoleColor.Yellow, ConsoleColor.Black), 
				4 => new ConsoleColors(ConsoleColor.Black, ConsoleColor.DarkRed), 
				5 => new ConsoleColors(ConsoleColor.White, ConsoleColor.DarkRed), 
				_ => new ConsoleColors(null, null), 
			};
		}

		private void WriteScopeInformation(TextWriter textWriter, IExternalScopeProvider scopeProvider, bool singleLine)
		{
			if (!FormatterOptions.IncludeScopes || scopeProvider == null)
			{
				return;
			}
			bool paddingNeeded = !singleLine;
			scopeProvider.ForEachScope<TextWriter>((Action<object, TextWriter>)delegate(object scope, TextWriter state)
			{
				if (paddingNeeded)
				{
					paddingNeeded = false;
					state.Write(_messagePadding);
					state.Write("=> ");
				}
				else
				{
					state.Write(" => ");
				}
				state.Write(scope);
			}, textWriter);
			if (!paddingNeeded && !singleLine)
			{
				textWriter.Write(Environment.NewLine);
			}
		}
	}
	public class SimpleConsoleFormatterOptions : ConsoleFormatterOptions
	{
		public LoggerColorBehavior ColorBehavior { get; set; }

		public bool SingleLine { get; set; }
	}
	internal sealed class SystemdConsoleFormatter : ConsoleFormatter, IDisposable
	{
		private IDisposable _optionsReloadToken;

		internal ConsoleFormatterOptions FormatterOptions { get; set; }

		public SystemdConsoleFormatter(IOptionsMonitor<ConsoleFormatterOptions> options)
			: base("systemd")
		{
			ReloadLoggerOptions(options.CurrentValue);
			_optionsReloadToken = OptionsMonitorExtensions.OnChange<ConsoleFormatterOptions>(options, (Action<ConsoleFormatterOptions>)ReloadLoggerOptions);
		}

		[MemberNotNull("FormatterOptions")]
		private void ReloadLoggerOptions(ConsoleFormatterOptions options)
		{
			FormatterOptions = options;
		}

		public void Dispose()
		{
			_optionsReloadToken?.Dispose();
		}

		public override void Write<TState>(in LogEntry<TState> logEntry, IExternalScopeProvider? scopeProvider, TextWriter textWriter)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: 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_004a: Unknown result type (might be due to invalid IL or missing references)
			string text = logEntry.Formatter(logEntry.State, logEntry.Exception);
			if (logEntry.Exception != null || text != null)
			{
				LogLevel logLevel = logEntry.LogLevel;
				string category = logEntry.Category;
				EventId eventId = logEntry.EventId;
				int id = ((EventId)(ref eventId)).Id;
				Exception exception = logEntry.Exception;
				string syslogSeverityString = GetSyslogSeverityString(logLevel);
				textWriter.Write(syslogSeverityString);
				string timestampFormat = FormatterOptions.TimestampFormat;
				if (timestampFormat != null)
				{
					textWriter.Write(GetCurrentDateTime().ToString(timestampFormat));
				}
				textWriter.Write(category);
				textWriter.Write('[');
				textWriter.Write(id);
				textWriter.Write(']');
				WriteScopeInformation(textWriter, scopeProvider);
				if (!string.IsNullOrEmpty(text))
				{
					textWriter.Write(' ');
					WriteReplacingNewLine(textWriter, text);
				}
				if (exception != null)
				{
					textWriter.Write(' ');
					WriteReplacingNewLine(textWriter, exception.ToString());
				}
				textWriter.Write(Environment.NewLine);
			}
			static void WriteReplacingNewLine(TextWriter writer, string message)
			{
				string value = message.Replace(Environment.NewLine, " ");
				writer.Write(value);
			}
		}

		private DateTimeOffset GetCurrentDateTime()
		{
			if (!FormatterOptions.UseUtcTimestamp)
			{
				return DateTimeOffset.Now;
			}
			return DateTimeOffset.UtcNow;
		}

		private static string GetSyslogSeverityString(LogLevel logLevel)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected I4, but got Unknown
			return (int)logLevel switch
			{
				0 => "<7>", 
				1 => "<7>", 
				2 => "<6>", 
				3 => "<4>", 
				4 => "<3>", 
				5 => "<2>", 
				_ => throw new ArgumentOutOfRangeException("logLevel"), 
			};
		}

		private void WriteScopeInformation(TextWriter textWriter, IExternalScopeProvider scopeProvider)
		{
			if (FormatterOptions.IncludeScopes && scopeProvider != null)
			{
				scopeProvider.ForEachScope<TextWriter>((Action<object, TextWriter>)delegate(object scope, TextWriter state)
				{
					state.Write(" => ");
					state.Write(scope);
				}, textWriter);
			}
		}
	}
	internal static class TextWriterExtensions
	{
		public static void WriteColoredMessage(this TextWriter textWriter, string message, ConsoleColor? background, ConsoleColor? foreground)
		{
			if (background.HasValue)
			{
				textWriter.Write(AnsiParser.GetBackgroundColorEscapeCode(background.Value));
			}
			if (foreground.HasValue)
			{
				textWriter.Write(AnsiParser.GetForegroundColorEscapeCode(foreground.Value));
			}
			textWriter.Write(message);
			if (foreground.HasValue)
			{
				textWriter.Write("\u001b[39m\u001b[22m");
			}
			if (background.HasValue)
			{
				textWriter.Write("\u001b[49m");
			}
		}
	}
}

BepInEx/plugins/SlopCrew.Plugin/Microsoft.Extensions.Logging.Debug.dll

Decompiled 8 months ago
#define DEBUG
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using Microsoft.CodeAnalysis;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.Extensions.Logging.Debug;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: AssemblyMetadata(".NETFrameworkAssembly", "")]
[assembly: AssemblyMetadata("Serviceable", "True")]
[assembly: AssemblyMetadata("PreferInbox", "True")]
[assembly: AssemblyDefaultAlias("Microsoft.Extensions.Logging.Debug")]
[assembly: CLSCompliant(true)]
[assembly: AssemblyMetadata("IsTrimmable", "True")]
[assembly: DefaultDllImportSearchPaths(DllImportSearchPath.System32 | DllImportSearchPath.AssemblyDirectory)]
[assembly: AssemblyCompany("Microsoft Corporation")]
[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")]
[assembly: AssemblyDescription("Debug output logger provider implementation for Microsoft.Extensions.Logging. This logger logs messages to a debugger monitor by writing messages with System.Diagnostics.Debug.WriteLine().")]
[assembly: AssemblyFileVersion("7.0.22.51805")]
[assembly: AssemblyInformationalVersion("7.0.0+d099f075e45d2aa6007a22b71b45a08758559f80")]
[assembly: AssemblyProduct("Microsoft® .NET")]
[assembly: AssemblyTitle("Microsoft.Extensions.Logging.Debug")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/dotnet/runtime")]
[assembly: AssemblyVersion("7.0.0.0")]
[module: RefSafetyRules(11)]
[module: System.Runtime.CompilerServices.NullablePublicOnly(false)]
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 NullablePublicOnlyAttribute : Attribute
	{
		public readonly bool IncludesInternals;

		public NullablePublicOnlyAttribute(bool P_0)
		{
			IncludesInternals = 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 System
{
	internal static class ThrowHelper
	{
		internal static void ThrowIfNull(object argument, [CallerArgumentExpression("argument")] string paramName = null)
		{
			if (argument == null)
			{
				Throw(paramName);
			}
		}

		private static void Throw(string paramName)
		{
			throw new ArgumentNullException(paramName);
		}
	}
}
namespace System.Diagnostics.CodeAnalysis
{
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)]
	internal sealed class AllowNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)]
	internal sealed class DisallowNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)]
	internal sealed class MaybeNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)]
	internal sealed class NotNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class MaybeNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public MaybeNullWhenAttribute(bool returnValue)
		{
			ReturnValue = returnValue;
		}
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class NotNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public NotNullWhenAttribute(bool returnValue)
		{
			ReturnValue = returnValue;
		}
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = true, Inherited = false)]
	internal sealed class NotNullIfNotNullAttribute : Attribute
	{
		public string ParameterName { get; }

		public NotNullIfNotNullAttribute(string parameterName)
		{
			ParameterName = parameterName;
		}
	}
	[AttributeUsage(AttributeTargets.Method, Inherited = false)]
	internal sealed class DoesNotReturnAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class DoesNotReturnIfAttribute : Attribute
	{
		public bool ParameterValue { get; }

		public DoesNotReturnIfAttribute(bool parameterValue)
		{
			ParameterValue = parameterValue;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	internal sealed class MemberNotNullAttribute : Attribute
	{
		public string[] Members { get; }

		public MemberNotNullAttribute(string member)
		{
			Members = new string[1] { member };
		}

		public MemberNotNullAttribute(params string[] members)
		{
			Members = members;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	internal sealed class MemberNotNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public string[] Members { get; }

		public MemberNotNullWhenAttribute(bool returnValue, string member)
		{
			ReturnValue = returnValue;
			Members = new string[1] { member };
		}

		public MemberNotNullWhenAttribute(bool returnValue, params string[] members)
		{
			ReturnValue = returnValue;
			Members = members;
		}
	}
}
namespace System.Runtime.InteropServices
{
	[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
	internal sealed class LibraryImportAttribute : Attribute
	{
		public string LibraryName { get; }

		public string EntryPoint { get; set; }

		public StringMarshalling StringMarshalling { get; set; }

		public Type StringMarshallingCustomType { get; set; }

		public bool SetLastError { get; set; }

		public LibraryImportAttribute(string libraryName)
		{
			LibraryName = libraryName;
		}
	}
	internal enum StringMarshalling
	{
		Custom,
		Utf8,
		Utf16
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
	internal sealed class CallerArgumentExpressionAttribute : Attribute
	{
		public string ParameterName { get; }

		public CallerArgumentExpressionAttribute(string parameterName)
		{
			ParameterName = parameterName;
		}
	}
}
namespace Microsoft.Extensions.Logging
{
	public static class DebugLoggerFactoryExtensions
	{
		public static ILoggingBuilder AddDebug(this ILoggingBuilder builder)
		{
			ServiceCollectionDescriptorExtensions.TryAddEnumerable(builder.Services, ServiceDescriptor.Singleton<ILoggerProvider, DebugLoggerProvider>());
			return builder;
		}
	}
	internal sealed class NullExternalScopeProvider : IExternalScopeProvider
	{
		public static IExternalScopeProvider Instance { get; } = (IExternalScopeProvider)(object)new NullExternalScopeProvider();


		private NullExternalScopeProvider()
		{
		}

		void IExternalScopeProvider.ForEachScope<TState>(Action<object, TState> callback, TState state)
		{
		}

		IDisposable IExternalScopeProvider.Push(object state)
		{
			return NullScope.Instance;
		}
	}
	internal sealed class NullScope : IDisposable
	{
		public static NullScope Instance { get; } = new NullScope();


		private NullScope()
		{
		}

		public void Dispose()
		{
		}
	}
}
namespace Microsoft.Extensions.Logging.Debug
{
	internal sealed class DebugLogger : ILogger
	{
		private readonly string _name;

		public DebugLogger(string name)
		{
			_name = name;
		}

		public IDisposable BeginScope<TState>(TState state)
		{
			return NullScope.Instance;
		}

		public bool IsEnabled(LogLevel logLevel)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Invalid comparison between Unknown and I4
			if (Debugger.IsAttached)
			{
				return (int)logLevel != 6;
			}
			return false;
		}

		public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func<TState, Exception, string> formatter)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			if (!IsEnabled(logLevel))
			{
				return;
			}
			System.ThrowHelper.ThrowIfNull(formatter, "formatter");
			string text = formatter(state, exception);
			if (!string.IsNullOrEmpty(text))
			{
				text = $"{logLevel}: {text}";
				if (exception != null)
				{
					text = text + Environment.NewLine + Environment.NewLine + exception;
				}
				DebugWriteLine(text, _name);
			}
		}

		private static void DebugWriteLine(string message, string name)
		{
			System.Diagnostics.Debug.WriteLine(message, name);
		}
	}
	[ProviderAlias("Debug")]
	public class DebugLoggerProvider : ILoggerProvider, IDisposable
	{
		public ILogger CreateLogger(string name)
		{
			return (ILogger)(object)new DebugLogger(name);
		}

		public void Dispose()
		{
		}
	}
}

BepInEx/plugins/SlopCrew.Plugin/Microsoft.Extensions.Logging.dll

Decompiled 8 months ago
using System;
using System.Collections;
using System.Collections.Generic;
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 System.Text;
using System.Threading;
using FxResources.Microsoft.Extensions.Logging;
using Microsoft.CodeAnalysis;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: AssemblyMetadata(".NETFrameworkAssembly", "")]
[assembly: AssemblyMetadata("Serviceable", "True")]
[assembly: AssemblyMetadata("PreferInbox", "True")]
[assembly: AssemblyDefaultAlias("Microsoft.Extensions.Logging")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: CLSCompliant(true)]
[assembly: AssemblyMetadata("IsTrimmable", "True")]
[assembly: DefaultDllImportSearchPaths(DllImportSearchPath.System32 | DllImportSearchPath.AssemblyDirectory)]
[assembly: AssemblyCompany("Microsoft Corporation")]
[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")]
[assembly: AssemblyDescription("Logging infrastructure default implementation for Microsoft.Extensions.Logging.")]
[assembly: AssemblyFileVersion("7.0.22.51805")]
[assembly: AssemblyInformationalVersion("7.0.0+d099f075e45d2aa6007a22b71b45a08758559f80")]
[assembly: AssemblyProduct("Microsoft® .NET")]
[assembly: AssemblyTitle("Microsoft.Extensions.Logging")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/dotnet/runtime")]
[assembly: AssemblyVersion("7.0.0.0")]
[module: RefSafetyRules(11)]
[module: System.Runtime.CompilerServices.NullablePublicOnly(false)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class IsReadOnlyAttribute : Attribute
	{
	}
	[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 NullablePublicOnlyAttribute : Attribute
	{
		public readonly bool IncludesInternals;

		public NullablePublicOnlyAttribute(bool P_0)
		{
			IncludesInternals = 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 FxResources.Microsoft.Extensions.Logging
{
	internal static class SR
	{
	}
}
namespace System
{
	internal static class ThrowHelper
	{
		internal static void ThrowIfNull(object argument, [CallerArgumentExpression("argument")] string paramName = null)
		{
			if (argument == null)
			{
				Throw(paramName);
			}
		}

		private static void Throw(string paramName)
		{
			throw new ArgumentNullException(paramName);
		}
	}
	internal static class SR
	{
		private static readonly bool s_usingResourceKeys = AppContext.TryGetSwitch("System.Resources.UseSystemResourceKeys", out var isEnabled) && isEnabled;

		private static ResourceManager s_resourceManager;

		internal static ResourceManager ResourceManager => s_resourceManager ?? (s_resourceManager = new ResourceManager(typeof(SR)));

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

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

		private static bool UsingResourceKeys()
		{
			return s_usingResourceKeys;
		}

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

		internal static string GetResourceString(string resourceKey, string defaultString)
		{
			string resourceString = GetResourceString(resourceKey);
			if (!(resourceKey == resourceString) && resourceString != null)
			{
				return resourceString;
			}
			return defaultString;
		}

		internal static string Format(string resourceFormat, object p1)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1);
			}
			return string.Format(resourceFormat, p1);
		}

		internal static string Format(string resourceFormat, object p1, object p2)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2);
			}
			return string.Format(resourceFormat, p1, p2);
		}

		internal static string Format(string resourceFormat, object p1, object p2, object p3)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2, p3);
			}
			return string.Format(resourceFormat, p1, p2, p3);
		}

		internal static string Format(string resourceFormat, params object[] args)
		{
			if (args != null)
			{
				if (UsingResourceKeys())
				{
					return resourceFormat + ", " + string.Join(", ", args);
				}
				return string.Format(resourceFormat, args);
			}
			return resourceFormat;
		}

		internal static string Format(IFormatProvider provider, string resourceFormat, object p1)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1);
			}
			return string.Format(provider, resourceFormat, p1);
		}

		internal static string Format(IFormatProvider provider, string resourceFormat, object p1, object p2)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2);
			}
			return string.Format(provider, resourceFormat, p1, p2);
		}

		internal static string Format(IFormatProvider provider, string resourceFormat, object p1, object p2, object p3)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2, p3);
			}
			return string.Format(provider, resourceFormat, p1, p2, p3);
		}

		internal static string Format(IFormatProvider provider, string resourceFormat, params object[] args)
		{
			if (args != null)
			{
				if (UsingResourceKeys())
				{
					return resourceFormat + ", " + string.Join(", ", args);
				}
				return string.Format(provider, resourceFormat, args);
			}
			return resourceFormat;
		}
	}
}
namespace System.Diagnostics.CodeAnalysis
{
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Constructor | AttributeTargets.Method, Inherited = false)]
	internal sealed class RequiresDynamicCodeAttribute : Attribute
	{
		public string Message { get; }

		public string Url { get; set; }

		public RequiresDynamicCodeAttribute(string message)
		{
			Message = message;
		}
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)]
	internal sealed class AllowNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)]
	internal sealed class DisallowNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)]
	internal sealed class MaybeNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)]
	internal sealed class NotNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class MaybeNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public MaybeNullWhenAttribute(bool returnValue)
		{
			ReturnValue = returnValue;
		}
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class NotNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public NotNullWhenAttribute(bool returnValue)
		{
			ReturnValue = returnValue;
		}
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = true, Inherited = false)]
	internal sealed class NotNullIfNotNullAttribute : Attribute
	{
		public string ParameterName { get; }

		public NotNullIfNotNullAttribute(string parameterName)
		{
			ParameterName = parameterName;
		}
	}
	[AttributeUsage(AttributeTargets.Method, Inherited = false)]
	internal sealed class DoesNotReturnAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class DoesNotReturnIfAttribute : Attribute
	{
		public bool ParameterValue { get; }

		public DoesNotReturnIfAttribute(bool parameterValue)
		{
			ParameterValue = parameterValue;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	internal sealed class MemberNotNullAttribute : Attribute
	{
		public string[] Members { get; }

		public MemberNotNullAttribute(string member)
		{
			Members = new string[1] { member };
		}

		public MemberNotNullAttribute(params string[] members)
		{
			Members = members;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	internal sealed class MemberNotNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public string[] Members { get; }

		public MemberNotNullWhenAttribute(bool returnValue, string member)
		{
			ReturnValue = returnValue;
			Members = new string[1] { member };
		}

		public MemberNotNullWhenAttribute(bool returnValue, params string[] members)
		{
			ReturnValue = returnValue;
			Members = members;
		}
	}
}
namespace System.Runtime.InteropServices
{
	[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
	internal sealed class LibraryImportAttribute : Attribute
	{
		public string LibraryName { get; }

		public string EntryPoint { get; set; }

		public StringMarshalling StringMarshalling { get; set; }

		public Type StringMarshallingCustomType { get; set; }

		public bool SetLastError { get; set; }

		public LibraryImportAttribute(string libraryName)
		{
			LibraryName = libraryName;
		}
	}
	internal enum StringMarshalling
	{
		Custom,
		Utf8,
		Utf16
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
	internal sealed class CallerArgumentExpressionAttribute : Attribute
	{
		public string ParameterName { get; }

		public CallerArgumentExpressionAttribute(string parameterName)
		{
			ParameterName = parameterName;
		}
	}
}
namespace Microsoft.Extensions.DependencyInjection
{
	public static class LoggingServiceCollectionExtensions
	{
		public static IServiceCollection AddLogging(this IServiceCollection services)
		{
			return services.AddLogging(delegate
			{
			});
		}

		public static IServiceCollection AddLogging(this IServiceCollection services, Action<ILoggingBuilder> configure)
		{
			System.ThrowHelper.ThrowIfNull(services, "services");
			OptionsServiceCollectionExtensions.AddOptions(services);
			ServiceCollectionDescriptorExtensions.TryAdd(services, ServiceDescriptor.Singleton<ILoggerFactory, LoggerFactory>());
			ServiceCollectionDescriptorExtensions.TryAdd(services, ServiceDescriptor.Singleton(typeof(ILogger<>), typeof(Logger<>)));
			ServiceCollectionDescriptorExtensions.TryAddEnumerable(services, ServiceDescriptor.Singleton<IConfigureOptions<LoggerFilterOptions>>((IConfigureOptions<LoggerFilterOptions>)(object)new DefaultLoggerLevelConfigureOptions((LogLevel)2)));
			configure(new LoggingBuilder(services));
			return services;
		}
	}
}
namespace Microsoft.Extensions.Logging
{
	[Flags]
	public enum ActivityTrackingOptions
	{
		None = 0,
		SpanId = 1,
		TraceId = 2,
		ParentId = 4,
		TraceState = 8,
		TraceFlags = 0x10,
		Tags = 0x20,
		Baggage = 0x40
	}
	internal sealed class DefaultLoggerLevelConfigureOptions : ConfigureOptions<LoggerFilterOptions>
	{
		public DefaultLoggerLevelConfigureOptions(LogLevel level)
			: base((Action<LoggerFilterOptions>)delegate(LoggerFilterOptions options)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				options.MinLevel = level;
			})
		{
		}//IL_0007: 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)

	}
	public static class FilterLoggingBuilderExtensions
	{
		public static ILoggingBuilder AddFilter(this ILoggingBuilder builder, Func<string?, string?, LogLevel, bool> filter)
		{
			Func<string, string, LogLevel, bool> filter2 = filter;
			return builder.ConfigureFilter(delegate(LoggerFilterOptions options)
			{
				options.AddFilter(filter2);
			});
		}

		public static ILoggingBuilder AddFilter(this ILoggingBuilder builder, Func<string?, LogLevel, bool> categoryLevelFilter)
		{
			Func<string, LogLevel, bool> categoryLevelFilter2 = categoryLevelFilter;
			return builder.ConfigureFilter(delegate(LoggerFilterOptions options)
			{
				options.AddFilter(categoryLevelFilter2);
			});
		}

		public static ILoggingBuilder AddFilter<T>(this ILoggingBuilder builder, Func<string?, LogLevel, bool> categoryLevelFilter) where T : ILoggerProvider
		{
			Func<string, LogLevel, bool> categoryLevelFilter2 = categoryLevelFilter;
			return builder.ConfigureFilter(delegate(LoggerFilterOptions options)
			{
				options.AddFilter<T>(categoryLevelFilter2);
			});
		}

		public static ILoggingBuilder AddFilter(this ILoggingBuilder builder, Func<LogLevel, bool> levelFilter)
		{
			Func<LogLevel, bool> levelFilter2 = levelFilter;
			return builder.ConfigureFilter(delegate(LoggerFilterOptions options)
			{
				options.AddFilter(levelFilter2);
			});
		}

		public static ILoggingBuilder AddFilter<T>(this ILoggingBuilder builder, Func<LogLevel, bool> levelFilter) where T : ILoggerProvider
		{
			Func<LogLevel, bool> levelFilter2 = levelFilter;
			return builder.ConfigureFilter(delegate(LoggerFilterOptions options)
			{
				options.AddFilter<T>(levelFilter2);
			});
		}

		public static ILoggingBuilder AddFilter(this ILoggingBuilder builder, string? category, LogLevel level)
		{
			//IL_000e: 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)
			string category2 = category;
			return builder.ConfigureFilter(delegate(LoggerFilterOptions options)
			{
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				options.AddFilter(category2, level);
			});
		}

		public static ILoggingBuilder AddFilter<T>(this ILoggingBuilder builder, string? category, LogLevel level) where T : ILoggerProvider
		{
			//IL_000e: 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)
			string category2 = category;
			return builder.ConfigureFilter(delegate(LoggerFilterOptions options)
			{
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				options.AddFilter<T>(category2, level);
			});
		}

		public static ILoggingBuilder AddFilter(this ILoggingBuilder builder, string? category, Func<LogLevel, bool> levelFilter)
		{
			string category2 = category;
			Func<LogLevel, bool> levelFilter2 = levelFilter;
			return builder.ConfigureFilter(delegate(LoggerFilterOptions options)
			{
				options.AddFilter(category2, levelFilter2);
			});
		}

		public static ILoggingBuilder AddFilter<T>(this ILoggingBuilder builder, string? category, Func<LogLevel, bool> levelFilter) where T : ILoggerProvider
		{
			string category2 = category;
			Func<LogLevel, bool> levelFilter2 = levelFilter;
			return builder.ConfigureFilter(delegate(LoggerFilterOptions options)
			{
				options.AddFilter<T>(category2, levelFilter2);
			});
		}

		public static LoggerFilterOptions AddFilter(this LoggerFilterOptions builder, Func<string?, string?, LogLevel, bool> filter)
		{
			return AddRule(builder, null, null, null, filter);
		}

		public static LoggerFilterOptions AddFilter(this LoggerFilterOptions builder, Func<string?, LogLevel, bool> categoryLevelFilter)
		{
			Func<string, LogLevel, bool> categoryLevelFilter2 = categoryLevelFilter;
			return AddRule(builder, null, null, null, (string type, string name, LogLevel level) => categoryLevelFilter2(name, level));
		}

		public static LoggerFilterOptions AddFilter<T>(this LoggerFilterOptions builder, Func<string?, LogLevel, bool> categoryLevelFilter) where T : ILoggerProvider
		{
			Func<string, LogLevel, bool> categoryLevelFilter2 = categoryLevelFilter;
			return AddRule(builder, typeof(T).FullName, null, null, (string type, string name, LogLevel level) => categoryLevelFilter2(name, level));
		}

		public static LoggerFilterOptions AddFilter(this LoggerFilterOptions builder, Func<LogLevel, bool> levelFilter)
		{
			Func<LogLevel, bool> levelFilter2 = levelFilter;
			return AddRule(builder, null, null, null, (string type, string name, LogLevel level) => levelFilter2(level));
		}

		public static LoggerFilterOptions AddFilter<T>(this LoggerFilterOptions builder, Func<LogLevel, bool> levelFilter) where T : ILoggerProvider
		{
			Func<LogLevel, bool> levelFilter2 = levelFilter;
			return AddRule(builder, typeof(T).FullName, null, null, (string type, string name, LogLevel level) => levelFilter2(level));
		}

		public static LoggerFilterOptions AddFilter(this LoggerFilterOptions builder, string? category, LogLevel level)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			return AddRule(builder, null, category, level);
		}

		public static LoggerFilterOptions AddFilter<T>(this LoggerFilterOptions builder, string? category, LogLevel level) where T : ILoggerProvider
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			return AddRule(builder, typeof(T).FullName, category, level);
		}

		public static LoggerFilterOptions AddFilter(this LoggerFilterOptions builder, string? category, Func<LogLevel, bool> levelFilter)
		{
			Func<LogLevel, bool> levelFilter2 = levelFilter;
			return AddRule(builder, null, category, null, (string type, string name, LogLevel level) => levelFilter2(level));
		}

		public static LoggerFilterOptions AddFilter<T>(this LoggerFilterOptions builder, string? category, Func<LogLevel, bool> levelFilter) where T : ILoggerProvider
		{
			Func<LogLevel, bool> levelFilter2 = levelFilter;
			return AddRule(builder, typeof(T).FullName, category, null, (string type, string name, LogLevel level) => levelFilter2(level));
		}

		private static ILoggingBuilder ConfigureFilter(this ILoggingBuilder builder, Action<LoggerFilterOptions> configureOptions)
		{
			OptionsServiceCollectionExtensions.Configure<LoggerFilterOptions>(builder.Services, configureOptions);
			return builder;
		}

		private static LoggerFilterOptions AddRule(LoggerFilterOptions options, string type = null, string category = null, LogLevel? level = null, Func<string, string, LogLevel, bool> filter = null)
		{
			options.Rules.Add(new LoggerFilterRule(type, category, level, filter));
			return options;
		}
	}
	public interface ILoggingBuilder
	{
		IServiceCollection Services { get; }
	}
	internal sealed class Logger : ILogger
	{
		private sealed class Scope : IDisposable
		{
			private bool _isDisposed;

			private IDisposable _disposable0;

			private IDisposable _disposable1;

			private readonly IDisposable[] _disposable;

			public Scope(int count)
			{
				if (count > 2)
				{
					_disposable = new IDisposable[count - 2];
				}
			}

			public void SetDisposable(int index, IDisposable disposable)
			{
				switch (index)
				{
				case 0:
					_disposable0 = disposable;
					break;
				case 1:
					_disposable1 = disposable;
					break;
				default:
					_disposable[index - 2] = disposable;
					break;
				}
			}

			public void Dispose()
			{
				if (_isDisposed)
				{
					return;
				}
				_disposable0?.Dispose();
				_disposable1?.Dispose();
				if (_disposable != null)
				{
					int num = _disposable.Length;
					for (int i = 0; i != num; i++)
					{
						_disposable[i]?.Dispose();
					}
				}
				_isDisposed = true;
			}
		}

		public LoggerInformation[] Loggers { get; set; }

		public MessageLogger[] MessageLoggers { get; set; }

		public ScopeLogger[] ScopeLoggers { get; set; }

		public Logger(LoggerInformation[] loggers)
		{
			Loggers = loggers;
		}

		public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func<TState, Exception, string> formatter)
		{
			//IL_001a: 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_0023: Unknown result type (might be due to invalid IL or missing references)
			MessageLogger[] messageLoggers = MessageLoggers;
			if (messageLoggers == null)
			{
				return;
			}
			List<Exception> exceptions2 = null;
			for (int i = 0; i < messageLoggers.Length; i++)
			{
				ref MessageLogger reference = ref messageLoggers[i];
				if (reference.IsEnabled(logLevel))
				{
					LoggerLog(logLevel, eventId, reference.Logger, exception, formatter, ref exceptions2, in state);
				}
			}
			if (exceptions2 != null && exceptions2.Count > 0)
			{
				ThrowLoggingError(exceptions2);
			}
			static void LoggerLog(LogLevel logLevel, EventId eventId, ILogger logger, Exception exception, Func<TState, Exception, string> formatter, ref List<Exception> exceptions, in TState state)
			{
				//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)
				try
				{
					logger.Log<TState>(logLevel, eventId, state, exception, formatter);
				}
				catch (Exception item)
				{
					if (exceptions == null)
					{
						exceptions = new List<Exception>();
					}
					exceptions.Add(item);
				}
			}
		}

		public bool IsEnabled(LogLevel logLevel)
		{
			//IL_001b: 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)
			MessageLogger[] messageLoggers = MessageLoggers;
			if (messageLoggers == null)
			{
				return false;
			}
			List<Exception> exceptions2 = null;
			int i;
			for (i = 0; i < messageLoggers.Length; i++)
			{
				ref MessageLogger reference = ref messageLoggers[i];
				if (reference.IsEnabled(logLevel) && LoggerIsEnabled(logLevel, reference.Logger, ref exceptions2))
				{
					break;
				}
			}
			if (exceptions2 != null && exceptions2.Count > 0)
			{
				ThrowLoggingError(exceptions2);
			}
			if (i >= messageLoggers.Length)
			{
				return false;
			}
			return true;
			static bool LoggerIsEnabled(LogLevel logLevel, ILogger logger, ref List<Exception> exceptions)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				try
				{
					if (logger.IsEnabled(logLevel))
					{
						return true;
					}
				}
				catch (Exception item)
				{
					if (exceptions == null)
					{
						exceptions = new List<Exception>();
					}
					exceptions.Add(item);
				}
				return false;
			}
		}

		public IDisposable BeginScope<TState>(TState state)
		{
			ScopeLogger[] scopeLoggers = ScopeLoggers;
			if (scopeLoggers == null)
			{
				return NullScope.Instance;
			}
			if (scopeLoggers.Length == 1)
			{
				return scopeLoggers[0].CreateScope(state);
			}
			Scope scope = new Scope(scopeLoggers.Length);
			List<Exception> list = null;
			for (int i = 0; i < scopeLoggers.Length; i++)
			{
				ref ScopeLogger reference = ref scopeLoggers[i];
				try
				{
					scope.SetDisposable(i, reference.CreateScope(state));
				}
				catch (Exception item)
				{
					if (list == null)
					{
						list = new List<Exception>();
					}
					list.Add(item);
				}
			}
			if (list != null && list.Count > 0)
			{
				ThrowLoggingError(list);
			}
			return scope;
		}

		private static void ThrowLoggingError(List<Exception> exceptions)
		{
			throw new AggregateException("An error occurred while writing to logger(s).", exceptions);
		}
	}
	public class LoggerFactory : ILoggerFactory, IDisposable
	{
		private struct ProviderRegistration
		{
			public ILoggerProvider Provider;

			public bool ShouldDispose;
		}

		private sealed class DisposingLoggerFactory : ILoggerFactory, IDisposable
		{
			private readonly ILoggerFactory _loggerFactory;

			private readonly ServiceProvider _serviceProvider;

			public DisposingLoggerFactory(ILoggerFactory loggerFactory, ServiceProvider serviceProvider)
			{
				_loggerFactory = loggerFactory;
				_serviceProvider = serviceProvider;
			}

			public void Dispose()
			{
				_serviceProvider.Dispose();
			}

			public ILogger CreateLogger(string categoryName)
			{
				return _loggerFactory.CreateLogger(categoryName);
			}

			public void AddProvider(ILoggerProvider provider)
			{
				_loggerFactory.AddProvider(provider);
			}
		}

		private readonly Dictionary<string, Logger> _loggers = new Dictionary<string, Logger>(StringComparer.Ordinal);

		private readonly List<ProviderRegistration> _providerRegistrations = new List<ProviderRegistration>();

		private readonly object _sync = new object();

		private volatile bool _disposed;

		private IDisposable _changeTokenRegistration;

		private LoggerFilterOptions _filterOptions;

		private IExternalScopeProvider _scopeProvider;

		private LoggerFactoryOptions _factoryOptions;

		public LoggerFactory()
			: this(Array.Empty<ILoggerProvider>())
		{
		}

		public LoggerFactory(IEnumerable<ILoggerProvider> providers)
			: this(providers, (IOptionsMonitor<LoggerFilterOptions>)(object)new StaticFilterOptionsMonitor(new LoggerFilterOptions()))
		{
		}

		public LoggerFactory(IEnumerable<ILoggerProvider> providers, LoggerFilterOptions filterOptions)
			: this(providers, (IOptionsMonitor<LoggerFilterOptions>)(object)new StaticFilterOptionsMonitor(filterOptions))
		{
		}

		public LoggerFactory(IEnumerable<ILoggerProvider> providers, IOptionsMonitor<LoggerFilterOptions> filterOption)
			: this(providers, filterOption, null)
		{
		}

		public LoggerFactory(IEnumerable<ILoggerProvider> providers, IOptionsMonitor<LoggerFilterOptions> filterOption, IOptions<LoggerFactoryOptions>? options)
			: this(providers, filterOption, options, null)
		{
		}

		public LoggerFactory(IEnumerable<ILoggerProvider> providers, IOptionsMonitor<LoggerFilterOptions> filterOption, IOptions<LoggerFactoryOptions>? options = null, IExternalScopeProvider? scopeProvider = null)
		{
			_scopeProvider = scopeProvider;
			_factoryOptions = ((options == null || options.Value == null) ? new LoggerFactoryOptions() : options.Value);
			if (((uint)_factoryOptions.ActivityTrackingOptions & 0xFFFFFF80u) != 0)
			{
				throw new ArgumentException(System.SR.Format(System.SR.InvalidActivityTrackingOptions, _factoryOptions.ActivityTrackingOptions), "options");
			}
			foreach (ILoggerProvider provider in providers)
			{
				AddProviderRegistration(provider, dispose: false);
			}
			_changeTokenRegistration = OptionsMonitorExtensions.OnChange<LoggerFilterOptions>(filterOption, (Action<LoggerFilterOptions>)RefreshFilters);
			RefreshFilters(filterOption.CurrentValue);
		}

		[RequiresDynamicCode("LoggerFactory.Create uses Microsoft.Extensions.DependencyInjection, which may require generating code dynamically at runtime.")]
		public static ILoggerFactory Create(Action<ILoggingBuilder> configure)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Expected O, but got Unknown
			ServiceCollection val = new ServiceCollection();
			((IServiceCollection)(object)val).AddLogging(configure);
			ServiceProvider val2 = ServiceCollectionContainerBuilderExtensions.BuildServiceProvider((IServiceCollection)(object)val);
			ILoggerFactory requiredService = ServiceProviderServiceExtensions.GetRequiredService<ILoggerFactory>((IServiceProvider)val2);
			return (ILoggerFactory)(object)new DisposingLoggerFactory(requiredService, val2);
		}

		[MemberNotNull("_filterOptions")]
		private void RefreshFilters(LoggerFilterOptions filterOptions)
		{
			lock (_sync)
			{
				_filterOptions = filterOptions;
				foreach (KeyValuePair<string, Logger> logger2 in _loggers)
				{
					Logger value = logger2.Value;
					(value.MessageLoggers, value.ScopeLoggers) = ApplyFilters(value.Loggers);
				}
			}
		}

		public ILogger CreateLogger(string categoryName)
		{
			if (CheckDisposed())
			{
				throw new ObjectDisposedException("LoggerFactory");
			}
			lock (_sync)
			{
				if (!_loggers.TryGetValue(categoryName, out var value))
				{
					value = new Logger(CreateLoggers(categoryName));
					(value.MessageLoggers, value.ScopeLoggers) = ApplyFilters(value.Loggers);
					_loggers[categoryName] = value;
				}
				return (ILogger)(object)value;
			}
		}

		public void AddProvider(ILoggerProvider provider)
		{
			if (CheckDisposed())
			{
				throw new ObjectDisposedException("LoggerFactory");
			}
			System.ThrowHelper.ThrowIfNull(provider, "provider");
			lock (_sync)
			{
				AddProviderRegistration(provider, dispose: true);
				foreach (KeyValuePair<string, Logger> logger2 in _loggers)
				{
					Logger value = logger2.Value;
					LoggerInformation[] array = value.Loggers;
					int num = array.Length;
					Array.Resize(ref array, array.Length + 1);
					array[num] = new LoggerInformation(provider, logger2.Key);
					value.Loggers = array;
					(value.MessageLoggers, value.ScopeLoggers) = ApplyFilters(value.Loggers);
				}
			}
		}

		private void AddProviderRegistration(ILoggerProvider provider, bool dispose)
		{
			_providerRegistrations.Add(new ProviderRegistration
			{
				Provider = provider,
				ShouldDispose = dispose
			});
			ISupportExternalScope val = (ISupportExternalScope)(object)((provider is ISupportExternalScope) ? provider : null);
			if (val != null)
			{
				if (_scopeProvider == null)
				{
					_scopeProvider = (IExternalScopeProvider)(object)new LoggerFactoryScopeProvider(_factoryOptions.ActivityTrackingOptions);
				}
				val.SetScopeProvider(_scopeProvider);
			}
		}

		private LoggerInformation[] CreateLoggers(string categoryName)
		{
			LoggerInformation[] array = new LoggerInformation[_providerRegistrations.Count];
			for (int i = 0; i < _providerRegistrations.Count; i++)
			{
				array[i] = new LoggerInformation(_providerRegistrations[i].Provider, categoryName);
			}
			return array;
		}

		private (MessageLogger[] MessageLoggers, ScopeLogger[] ScopeLoggers) ApplyFilters(LoggerInformation[] loggers)
		{
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Invalid comparison between Unknown and I4
			List<MessageLogger> list = new List<MessageLogger>();
			List<ScopeLogger> list2 = (_filterOptions.CaptureScopes ? new List<ScopeLogger>() : null);
			for (int i = 0; i < loggers.Length; i++)
			{
				LoggerInformation loggerInformation = loggers[i];
				LoggerRuleSelector.Select(_filterOptions, loggerInformation.ProviderType, loggerInformation.Category, out var minLevel, out var filter);
				if (!minLevel.HasValue || (int)minLevel.GetValueOrDefault() <= 5)
				{
					list.Add(new MessageLogger(loggerInformation.Logger, loggerInformation.Category, loggerInformation.ProviderType.FullName, minLevel, filter));
					if (!loggerInformation.ExternalScope)
					{
						list2?.Add(new ScopeLogger(loggerInformation.Logger, null));
					}
				}
			}
			if (_scopeProvider != null)
			{
				list2?.Add(new ScopeLogger(null, _scopeProvider));
			}
			return (list.ToArray(), list2?.ToArray());
		}

		protected virtual bool CheckDisposed()
		{
			return _disposed;
		}

		public void Dispose()
		{
			if (_disposed)
			{
				return;
			}
			_disposed = true;
			_changeTokenRegistration?.Dispose();
			foreach (ProviderRegistration providerRegistration in _providerRegistrations)
			{
				try
				{
					if (providerRegistration.ShouldDispose)
					{
						((IDisposable)providerRegistration.Provider).Dispose();
					}
				}
				catch
				{
				}
			}
		}
	}
	public class LoggerFactoryOptions
	{
		public ActivityTrackingOptions ActivityTrackingOptions { get; set; }
	}
	internal sealed class LoggerFactoryScopeProvider : IExternalScopeProvider
	{
		private sealed class Scope : IDisposable
		{
			private readonly LoggerFactoryScopeProvider _provider;

			private bool _isDisposed;

			public Scope Parent { get; }

			public object State { get; }

			internal Scope(LoggerFactoryScopeProvider provider, object state, Scope parent)
			{
				_provider = provider;
				State = state;
				Parent = parent;
			}

			public override string ToString()
			{
				return State?.ToString();
			}

			public void Dispose()
			{
				if (!_isDisposed)
				{
					_provider._currentScope.Value = Parent;
					_isDisposed = true;
				}
			}
		}

		private sealed class ActivityLogScope : IReadOnlyList<KeyValuePair<string, object>>, IReadOnlyCollection<KeyValuePair<string, object>>, IEnumerable<KeyValuePair<string, object>>, IEnumerable
		{
			private string _cachedToString;

			private const int MaxItems = 5;

			private KeyValuePair<string, object>[] _items = new KeyValuePair<string, object>[5];

			public int Count { get; }

			public KeyValuePair<string, object> this[int index]
			{
				get
				{
					if (index >= Count)
					{
						throw new ArgumentOutOfRangeException("index");
					}
					return _items[index];
				}
			}

			public ActivityLogScope(Activity activity, ActivityTrackingOptions activityTrackingOption)
			{
				//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
				int num = 0;
				if ((activityTrackingOption & ActivityTrackingOptions.SpanId) != 0)
				{
					_items[num++] = new KeyValuePair<string, object>("SpanId", activity.GetSpanId());
				}
				if ((activityTrackingOption & ActivityTrackingOptions.TraceId) != 0)
				{
					_items[num++] = new KeyValuePair<string, object>("TraceId", activity.GetTraceId());
				}
				if ((activityTrackingOption & ActivityTrackingOptions.ParentId) != 0)
				{
					_items[num++] = new KeyValuePair<string, object>("ParentId", activity.GetParentId());
				}
				if ((activityTrackingOption & ActivityTrackingOptions.TraceState) != 0)
				{
					_items[num++] = new KeyValuePair<string, object>("TraceState", activity.TraceStateString);
				}
				if ((activityTrackingOption & ActivityTrackingOptions.TraceFlags) != 0)
				{
					_items[num++] = new KeyValuePair<string, object>("TraceFlags", activity.ActivityTraceFlags);
				}
				Count = num;
			}

			public override string ToString()
			{
				if (_cachedToString == null)
				{
					StringBuilder stringBuilder = new StringBuilder();
					stringBuilder.Append(_items[0].Key);
					stringBuilder.Append(':');
					stringBuilder.Append(_items[0].Value);
					for (int i = 1; i < Count; i++)
					{
						stringBuilder.Append(", ");
						stringBuilder.Append(_items[i].Key);
						stringBuilder.Append(':');
						stringBuilder.Append(_items[i].Value);
					}
					_cachedToString = stringBuilder.ToString();
				}
				return _cachedToString;
			}

			public IEnumerator<KeyValuePair<string, object>> GetEnumerator()
			{
				int i = 0;
				while (i < Count)
				{
					yield return this[i];
					int num = i + 1;
					i = num;
				}
			}

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

		private sealed class ActivityBaggageLogScopeWrapper : IEnumerable<KeyValuePair<string, string>>, IEnumerable
		{
			private readonly IEnumerable<KeyValuePair<string, string>> _items;

			private StringBuilder _stringBuilder;

			public ActivityBaggageLogScopeWrapper(IEnumerable<KeyValuePair<string, string>> items)
			{
				_items = items;
			}

			public IEnumerator<KeyValuePair<string, string>> GetEnumerator()
			{
				return _items.GetEnumerator();
			}

			IEnumerator IEnumerable.GetEnumerator()
			{
				return _items.GetEnumerator();
			}

			public override string ToString()
			{
				lock (this)
				{
					IEnumerator<KeyValuePair<string, string>> enumerator = _items.GetEnumerator();
					if (!enumerator.MoveNext())
					{
						return string.Empty;
					}
					if (_stringBuilder == null)
					{
						_stringBuilder = new StringBuilder();
					}
					_stringBuilder.Append(enumerator.Current.Key);
					_stringBuilder.Append(':');
					_stringBuilder.Append(enumerator.Current.Value);
					while (enumerator.MoveNext())
					{
						_stringBuilder.Append(", ");
						_stringBuilder.Append(enumerator.Current.Key);
						_stringBuilder.Append(':');
						_stringBuilder.Append(enumerator.Current.Value);
					}
					string result = _stringBuilder.ToString();
					_stringBuilder.Clear();
					return result;
				}
			}
		}

		private readonly AsyncLocal<Scope> _currentScope = new AsyncLocal<Scope>();

		private readonly ActivityTrackingOptions _activityTrackingOption;

		public LoggerFactoryScopeProvider(ActivityTrackingOptions activityTrackingOption)
		{
			_activityTrackingOption = activityTrackingOption;
		}

		public void ForEachScope<TState>(Action<object, TState> callback, TState state)
		{
			if (_activityTrackingOption != 0)
			{
				Activity current2 = Activity.Current;
				if (current2 != null)
				{
					ActivityLogScope activityLogScope = current2.GetCustomProperty("__ActivityLogScope__") as ActivityLogScope;
					if (activityLogScope == null)
					{
						activityLogScope = new ActivityLogScope(current2, _activityTrackingOption);
						current2.SetCustomProperty("__ActivityLogScope__", (object)activityLogScope);
					}
					callback(activityLogScope, state);
					if ((_activityTrackingOption & ActivityTrackingOptions.Tags) != 0 && current2.TagObjects.GetEnumerator().MoveNext())
					{
						callback(current2.TagObjects, state);
					}
					if ((_activityTrackingOption & ActivityTrackingOptions.Baggage) != 0)
					{
						IEnumerable<KeyValuePair<string, string>> baggage = current2.Baggage;
						if (baggage.GetEnumerator().MoveNext())
						{
							ActivityBaggageLogScopeWrapper orCreateActivityBaggageLogScopeWrapper = GetOrCreateActivityBaggageLogScopeWrapper(current2, baggage);
							callback(orCreateActivityBaggageLogScopeWrapper, state);
						}
					}
				}
			}
			Report(_currentScope.Value);
			void Report(Scope current)
			{
				if (current != null)
				{
					Report(current.Parent);
					callback(current.State, state);
				}
			}
		}

		private static ActivityBaggageLogScopeWrapper GetOrCreateActivityBaggageLogScopeWrapper(Activity activity, IEnumerable<KeyValuePair<string, string>> items)
		{
			ActivityBaggageLogScopeWrapper activityBaggageLogScopeWrapper = activity.GetCustomProperty("__ActivityBaggageItemsLogScope__") as ActivityBaggageLogScopeWrapper;
			if (activityBaggageLogScopeWrapper == null)
			{
				activityBaggageLogScopeWrapper = new ActivityBaggageLogScopeWrapper(items);
				activity.SetCustomProperty("__ActivityBaggageItemsLogScope__", (object)activityBaggageLogScopeWrapper);
			}
			return activityBaggageLogScopeWrapper;
		}

		public IDisposable Push(object state)
		{
			Scope value = _currentScope.Value;
			Scope scope = new Scope(this, state, value);
			_currentScope.Value = scope;
			return scope;
		}
	}
	internal static class ActivityExtensions
	{
		public static string GetSpanId(this Activity activity)
		{
			//IL_0001: 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_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Invalid comparison between Unknown and I4
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Invalid comparison between Unknown and I4
			//IL_001b: 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)
			ActivityIdFormat idFormat = activity.IdFormat;
			string text;
			if ((int)idFormat != 1)
			{
				if ((int)idFormat == 2)
				{
					ActivitySpanId spanId = activity.SpanId;
					text = ((ActivitySpanId)(ref spanId)).ToHexString();
				}
				else
				{
					text = null;
				}
			}
			else
			{
				text = activity.Id;
			}
			return text ?? string.Empty;
		}

		public static string GetTraceId(this Activity activity)
		{
			//IL_0001: 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_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Invalid comparison between Unknown and I4
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Invalid comparison between Unknown and I4
			//IL_001b: 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)
			ActivityIdFormat idFormat = activity.IdFormat;
			string text;
			if ((int)idFormat != 1)
			{
				if ((int)idFormat == 2)
				{
					ActivityTraceId traceId = activity.TraceId;
					text = ((ActivityTraceId)(ref traceId)).ToHexString();
				}
				else
				{
					text = null;
				}
			}
			else
			{
				text = activity.RootId;
			}
			return text ?? string.Empty;
		}

		public static string GetParentId(this Activity activity)
		{
			//IL_0001: 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_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Invalid comparison between Unknown and I4
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Invalid comparison between Unknown and I4
			//IL_001b: 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)
			ActivityIdFormat idFormat = activity.IdFormat;
			string text;
			if ((int)idFormat != 1)
			{
				if ((int)idFormat == 2)
				{
					ActivitySpanId parentSpanId = activity.ParentSpanId;
					text = ((ActivitySpanId)(ref parentSpanId)).ToHexString();
				}
				else
				{
					text = null;
				}
			}
			else
			{
				text = activity.ParentId;
			}
			return text ?? string.Empty;
		}
	}
	public class LoggerFilterOptions
	{
		public bool CaptureScopes { get; set; } = true;


		public LogLevel MinLevel { get; set; }

		public IList<LoggerFilterRule> Rules => RulesInternal;

		internal List<LoggerFilterRule> RulesInternal { get; } = new List<LoggerFilterRule>();

	}
	public class LoggerFilterRule
	{
		public string? ProviderName { get; }

		public string? CategoryName { get; }

		public LogLevel? LogLevel { get; }

		public Func<string?, string?, LogLevel, bool>? Filter { get; }

		public LoggerFilterRule(string? providerName, string? categoryName, LogLevel? logLevel, Func<string?, string?, LogLevel, bool>? filter)
		{
			ProviderName = providerName;
			CategoryName = categoryName;
			LogLevel = logLevel;
			Filter = filter;
		}

		public override string ToString()
		{
			return string.Format("{0}: '{1}', {2}: '{3}', {4}: '{5}', {6}: '{7}'", "ProviderName", ProviderName, "CategoryName", CategoryName, "LogLevel", LogLevel, "Filter", Filter);
		}
	}
	internal readonly struct MessageLogger
	{
		public ILogger Logger { get; }

		public string Category { get; }

		private string ProviderTypeFullName { get; }

		public LogLevel? MinLevel { get; }

		public Func<string, string, LogLevel, bool> Filter { get; }

		public MessageLogger(ILogger logger, string category, string providerTypeFullName, LogLevel? minLevel, Func<string, string, LogLevel, bool> filter)
		{
			Logger = logger;
			Category = category;
			ProviderTypeFullName = providerTypeFullName;
			MinLevel = minLevel;
			Filter = filter;
		}

		public bool IsEnabled(LogLevel level)
		{
			//IL_0010: 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_0047: Unknown result type (might be due to invalid IL or missing references)
			if (MinLevel.HasValue && level < MinLevel)
			{
				return false;
			}
			if (Filter != null)
			{
				return Filter(ProviderTypeFullName, Category, level);
			}
			return true;
		}
	}
	internal readonly struct ScopeLogger
	{
		public ILogger Logger { get; }

		public IExternalScopeProvider ExternalScopeProvider { get; }

		public ScopeLogger(ILogger logger, IExternalScopeProvider externalScopeProvider)
		{
			Logger = logger;
			ExternalScopeProvider = externalScopeProvider;
		}

		public IDisposable CreateScope<TState>(TState state)
		{
			if (ExternalScopeProvider != null)
			{
				return ExternalScopeProvider.Push((object)state);
			}
			return Logger.BeginScope<TState>(state);
		}
	}
	internal readonly struct LoggerInformation
	{
		public ILogger Logger { get; }

		public string Category { get; }

		public Type ProviderType { get; }

		public bool ExternalScope { get; }

		public LoggerInformation(ILoggerProvider provider, string category)
		{
			this = default(LoggerInformation);
			ProviderType = ((object)provider).GetType();
			Logger = provider.CreateLogger(category);
			Category = category;
			ExternalScope = provider is ISupportExternalScope;
		}
	}
	internal static class LoggerRuleSelector
	{
		public static void Select(LoggerFilterOptions options, Type providerType, string category, out LogLevel? minLevel, out Func<string, string, LogLevel, bool> filter)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			filter = null;
			minLevel = options.MinLevel;
			string alias = ProviderAliasUtilities.GetAlias(providerType);
			LoggerFilterRule loggerFilterRule = null;
			foreach (LoggerFilterRule item in options.RulesInternal)
			{
				if (IsBetter(item, loggerFilterRule, providerType.FullName, category) || (!string.IsNullOrEmpty(alias) && IsBetter(item, loggerFilterRule, alias, category)))
				{
					loggerFilterRule = item;
				}
			}
			if (loggerFilterRule != null)
			{
				filter = loggerFilterRule.Filter;
				minLevel = loggerFilterRule.LogLevel;
			}
		}

		private static bool IsBetter(LoggerFilterRule rule, LoggerFilterRule current, string logger, string category)
		{
			if (rule.ProviderName != null && rule.ProviderName != logger)
			{
				return false;
			}
			string categoryName = rule.CategoryName;
			if (categoryName != null)
			{
				int num = categoryName.IndexOf('*');
				if (num != -1 && categoryName.IndexOf('*', num + 1) != -1)
				{
					throw new InvalidOperationException(System.SR.MoreThanOneWildcard);
				}
				ReadOnlySpan<char> value;
				ReadOnlySpan<char> value2;
				if (num == -1)
				{
					value = categoryName.AsSpan();
					value2 = default(ReadOnlySpan<char>);
				}
				else
				{
					value = categoryName.AsSpan(0, num);
					value2 = categoryName.AsSpan(num + 1);
				}
				if (!category.AsSpan().StartsWith(value, StringComparison.OrdinalIgnoreCase) || !category.AsSpan().EndsWith(value2, StringComparison.OrdinalIgnoreCase))
				{
					return false;
				}
			}
			if (current != null && current.ProviderName != null)
			{
				if (rule.ProviderName == null)
				{
					return false;
				}
			}
			else if (rule.ProviderName != null)
			{
				return true;
			}
			if (current != null && current.CategoryName != null)
			{
				if (rule.CategoryName == null)
				{
					return false;
				}
				if (current.CategoryName.Length > rule.CategoryName.Length)
				{
					return false;
				}
			}
			return true;
		}
	}
	internal sealed class LoggingBuilder : ILoggingBuilder
	{
		public IServiceCollection Services { get; }

		public LoggingBuilder(IServiceCollection services)
		{
			Services = services;
		}
	}
	public static class LoggingBuilderExtensions
	{
		public static ILoggingBuilder SetMinimumLevel(this ILoggingBuilder builder, LogLevel level)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			((ICollection<ServiceDescriptor>)builder.Services).Add(ServiceDescriptor.Singleton<IConfigureOptions<LoggerFilterOptions>>((IConfigureOptions<LoggerFilterOptions>)(object)new DefaultLoggerLevelConfigureOptions(level)));
			return builder;
		}

		public static ILoggingBuilder AddProvider(this ILoggingBuilder builder, ILoggerProvider provider)
		{
			ServiceCollectionServiceExtensions.AddSingleton<ILoggerProvider>(builder.Services, provider);
			return builder;
		}

		public static ILoggingBuilder ClearProviders(this ILoggingBuilder builder)
		{
			ServiceCollectionDescriptorExtensions.RemoveAll<ILoggerProvider>(builder.Services);
			return builder;
		}

		public static ILoggingBuilder Configure(this ILoggingBuilder builder, Action<LoggerFactoryOptions> action)
		{
			OptionsServiceCollectionExtensions.Configure<LoggerFactoryOptions>(builder.Services, action);
			return builder;
		}
	}
	[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)]
	public class ProviderAliasAttribute : Attribute
	{
		public string Alias { get; }

		public ProviderAliasAttribute(string alias)
		{
			Alias = alias;
		}
	}
	internal sealed class StaticFilterOptionsMonitor : IOptionsMonitor<LoggerFilterOptions>
	{
		public LoggerFilterOptions CurrentValue { get; }

		public StaticFilterOptionsMonitor(LoggerFilterOptions currentValue)
		{
			CurrentValue = currentValue;
		}

		public IDisposable OnChange(Action<LoggerFilterOptions, string> listener)
		{
			return null;
		}

		public LoggerFilterOptions Get(string name)
		{
			return CurrentValue;
		}
	}
	internal static class ProviderAliasUtilities
	{
		private const string AliasAttributeTypeFullName = "Microsoft.Extensions.Logging.ProviderAliasAttribute";

		internal static string GetAlias(Type providerType)
		{
			IList<CustomAttributeData> customAttributes = CustomAttributeData.GetCustomAttributes(providerType);
			for (int i = 0; i < customAttributes.Count; i++)
			{
				CustomAttributeData customAttributeData = customAttributes[i];
				if (customAttributeData.AttributeType.FullName == "Microsoft.Extensions.Logging.ProviderAliasAttribute" && customAttributeData.ConstructorArguments.Count > 0)
				{
					return customAttributeData.ConstructorArguments[0].Value?.ToString();
				}
			}
			return null;
		}
	}
	internal sealed class NullExternalScopeProvider : IExternalScopeProvider
	{
		public static IExternalScopeProvider Instance { get; } = (IExternalScopeProvider)(object)new NullExternalScopeProvider();


		private NullExternalScopeProvider()
		{
		}

		void IExternalScopeProvider.ForEachScope<TState>(Action<object, TState> callback, TState state)
		{
		}

		IDisposable IExternalScopeProvider.Push(object state)
		{
			return NullScope.Instance;
		}
	}
	internal sealed class NullScope : IDisposable
	{
		public static NullScope Instance { get; } = new NullScope();


		private NullScope()
		{
		}

		public void Dispose()
		{
		}
	}
}

BepInEx/plugins/SlopCrew.Plugin/Microsoft.Extensions.Logging.EventLog.dll

Decompiled 8 months ago
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Text;
using Microsoft.CodeAnalysis;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.Extensions.Logging.EventLog;
using Microsoft.Extensions.Options;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: InternalsVisibleTo("Microsoft.Extensions.Logging.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: AssemblyMetadata(".NETFrameworkAssembly", "")]
[assembly: AssemblyMetadata("Serviceable", "True")]
[assembly: AssemblyMetadata("PreferInbox", "True")]
[assembly: AssemblyDefaultAlias("Microsoft.Extensions.Logging.EventLog")]
[assembly: CLSCompliant(true)]
[assembly: AssemblyMetadata("IsTrimmable", "True")]
[assembly: DefaultDllImportSearchPaths(DllImportSearchPath.System32 | DllImportSearchPath.AssemblyDirectory)]
[assembly: AssemblyCompany("Microsoft Corporation")]
[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")]
[assembly: AssemblyDescription("Windows Event Log logger provider implementation for Microsoft.Extensions.Logging.")]
[assembly: AssemblyFileVersion("7.0.22.51805")]
[assembly: AssemblyInformationalVersion("7.0.0+d099f075e45d2aa6007a22b71b45a08758559f80")]
[assembly: AssemblyProduct("Microsoft® .NET")]
[assembly: AssemblyTitle("Microsoft.Extensions.Logging.EventLog")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/dotnet/runtime")]
[assembly: AssemblyVersion("7.0.0.0")]
[module: RefSafetyRules(11)]
[module: System.Runtime.CompilerServices.NullablePublicOnly(true)]
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 NullablePublicOnlyAttribute : Attribute
	{
		public readonly bool IncludesInternals;

		public NullablePublicOnlyAttribute(bool P_0)
		{
			IncludesInternals = 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 System
{
	internal static class ThrowHelper
	{
		internal static void ThrowIfNull(object? argument, [CallerArgumentExpression("argument")] string? paramName = null)
		{
			if (argument == null)
			{
				Throw(paramName);
			}
		}

		private static void Throw(string paramName)
		{
			throw new ArgumentNullException(paramName);
		}
	}
}
namespace System.Diagnostics.CodeAnalysis
{
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)]
	internal sealed class AllowNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)]
	internal sealed class DisallowNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)]
	internal sealed class MaybeNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)]
	internal sealed class NotNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class MaybeNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public MaybeNullWhenAttribute(bool returnValue)
		{
			ReturnValue = returnValue;
		}
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class NotNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public NotNullWhenAttribute(bool returnValue)
		{
			ReturnValue = returnValue;
		}
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = true, Inherited = false)]
	internal sealed class NotNullIfNotNullAttribute : Attribute
	{
		public string ParameterName { get; }

		public NotNullIfNotNullAttribute(string parameterName)
		{
			ParameterName = parameterName;
		}
	}
	[AttributeUsage(AttributeTargets.Method, Inherited = false)]
	internal sealed class DoesNotReturnAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class DoesNotReturnIfAttribute : Attribute
	{
		public bool ParameterValue { get; }

		public DoesNotReturnIfAttribute(bool parameterValue)
		{
			ParameterValue = parameterValue;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	internal sealed class MemberNotNullAttribute : Attribute
	{
		public string[] Members { get; }

		public MemberNotNullAttribute(string member)
		{
			Members = new string[1] { member };
		}

		public MemberNotNullAttribute(params string[] members)
		{
			Members = members;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	internal sealed class MemberNotNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public string[] Members { get; }

		public MemberNotNullWhenAttribute(bool returnValue, string member)
		{
			ReturnValue = returnValue;
			Members = new string[1] { member };
		}

		public MemberNotNullWhenAttribute(bool returnValue, params string[] members)
		{
			ReturnValue = returnValue;
			Members = members;
		}
	}
}
namespace System.Runtime.Versioning
{
	internal abstract class OSPlatformAttribute : Attribute
	{
		public string PlatformName { get; }

		private protected OSPlatformAttribute(string platformName)
		{
			PlatformName = platformName;
		}
	}
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false, Inherited = false)]
	internal sealed class TargetPlatformAttribute : OSPlatformAttribute
	{
		public TargetPlatformAttribute(string platformName)
			: base(platformName)
		{
		}
	}
	[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface, AllowMultiple = true, Inherited = false)]
	internal sealed class SupportedOSPlatformAttribute : OSPlatformAttribute
	{
		public SupportedOSPlatformAttribute(string platformName)
			: base(platformName)
		{
		}
	}
	[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface, AllowMultiple = true, Inherited = false)]
	internal sealed class UnsupportedOSPlatformAttribute : OSPlatformAttribute
	{
		public string? Message { get; }

		public UnsupportedOSPlatformAttribute(string platformName)
			: base(platformName)
		{
		}

		public UnsupportedOSPlatformAttribute(string platformName, string? message)
			: base(platformName)
		{
			Message = message;
		}
	}
	[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface, AllowMultiple = true, Inherited = false)]
	internal sealed class ObsoletedOSPlatformAttribute : OSPlatformAttribute
	{
		public string? Message { get; }

		public string? Url { get; set; }

		public ObsoletedOSPlatformAttribute(string platformName)
			: base(platformName)
		{
		}

		public ObsoletedOSPlatformAttribute(string platformName, string? message)
			: base(platformName)
		{
			Message = message;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = true, Inherited = false)]
	internal sealed class SupportedOSPlatformGuardAttribute : OSPlatformAttribute
	{
		public SupportedOSPlatformGuardAttribute(string platformName)
			: base(platformName)
		{
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = true, Inherited = false)]
	internal sealed class UnsupportedOSPlatformGuardAttribute : OSPlatformAttribute
	{
		public UnsupportedOSPlatformGuardAttribute(string platformName)
			: base(platformName)
		{
		}
	}
}
namespace System.Runtime.InteropServices
{
	[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
	internal sealed class LibraryImportAttribute : Attribute
	{
		public string LibraryName { get; }

		public string? EntryPoint { get; set; }

		public StringMarshalling StringMarshalling { get; set; }

		public Type? StringMarshallingCustomType { get; set; }

		public bool SetLastError { get; set; }

		public LibraryImportAttribute(string libraryName)
		{
			LibraryName = libraryName;
		}
	}
	internal enum StringMarshalling
	{
		Custom,
		Utf8,
		Utf16
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
	internal sealed class CallerArgumentExpressionAttribute : Attribute
	{
		public string ParameterName { get; }

		public CallerArgumentExpressionAttribute(string parameterName)
		{
			ParameterName = parameterName;
		}
	}
}
namespace Microsoft.Extensions.Logging
{
	public static class EventLoggerFactoryExtensions
	{
		public static ILoggingBuilder AddEventLog(this ILoggingBuilder builder)
		{
			System.ThrowHelper.ThrowIfNull(builder, "builder");
			ServiceCollectionDescriptorExtensions.TryAddEnumerable(builder.Services, ServiceDescriptor.Singleton<ILoggerProvider, EventLogLoggerProvider>());
			return builder;
		}

		public static ILoggingBuilder AddEventLog(this ILoggingBuilder builder, EventLogSettings settings)
		{
			System.ThrowHelper.ThrowIfNull(builder, "builder");
			System.ThrowHelper.ThrowIfNull(settings, "settings");
			ServiceCollectionDescriptorExtensions.TryAddEnumerable(builder.Services, ServiceDescriptor.Singleton<ILoggerProvider>((ILoggerProvider)(object)new EventLogLoggerProvider(settings)));
			return builder;
		}

		public static ILoggingBuilder AddEventLog(this ILoggingBuilder builder, Action<EventLogSettings> configure)
		{
			System.ThrowHelper.ThrowIfNull(configure, "configure");
			builder.AddEventLog();
			OptionsServiceCollectionExtensions.Configure<EventLogSettings>(builder.Services, configure);
			return builder;
		}
	}
	internal sealed class NullExternalScopeProvider : IExternalScopeProvider
	{
		public static IExternalScopeProvider Instance { get; } = (IExternalScopeProvider)(object)new NullExternalScopeProvider();


		private NullExternalScopeProvider()
		{
		}

		void IExternalScopeProvider.ForEachScope<TState>(Action<object, TState> callback, TState state)
		{
		}

		IDisposable IExternalScopeProvider.Push(object state)
		{
			return NullScope.Instance;
		}
	}
	internal sealed class NullScope : IDisposable
	{
		public static NullScope Instance { get; } = new NullScope();


		private NullScope()
		{
		}

		public void Dispose()
		{
		}
	}
}
namespace Microsoft.Extensions.Logging.EventLog
{
	internal sealed class EventLogLogger : ILogger
	{
		private readonly string _name;

		private readonly EventLogSettings _settings;

		private readonly IExternalScopeProvider _externalScopeProvider;

		private const string ContinuationString = "...";

		private readonly int _beginOrEndMessageSegmentSize;

		private readonly int _intermediateMessageSegmentSize;

		public IEventLog EventLog { get; }

		public EventLogLogger(string name, EventLogSettings settings, IExternalScopeProvider? externalScopeProvider)
		{
			System.ThrowHelper.ThrowIfNull(name, "name");
			System.ThrowHelper.ThrowIfNull(settings, "settings");
			_name = name;
			_settings = settings;
			_externalScopeProvider = externalScopeProvider;
			EventLog = settings.EventLog;
			_beginOrEndMessageSegmentSize = EventLog.MaxMessageSize - "...".Length;
			_intermediateMessageSegmentSize = EventLog.MaxMessageSize - 2 * "...".Length;
		}

		public IDisposable? BeginScope<TState>(TState state) where TState : notnull
		{
			IExternalScopeProvider externalScopeProvider = _externalScopeProvider;
			if (externalScopeProvider == null)
			{
				return null;
			}
			return externalScopeProvider.Push((object)state);
		}

		public bool IsEnabled(LogLevel logLevel)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Invalid comparison between Unknown and I4
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			if ((int)logLevel != 6)
			{
				if (_settings.Filter != null)
				{
					return _settings.Filter(_name, logLevel);
				}
				return true;
			}
			return false;
		}

		public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception? exception, Func<TState, Exception?, string> formatter)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			if (!IsEnabled(logLevel))
			{
				return;
			}
			System.ThrowHelper.ThrowIfNull(formatter, "formatter");
			string value = formatter(state, exception);
			if (string.IsNullOrEmpty(value))
			{
				return;
			}
			StringBuilder stringBuilder = new StringBuilder().Append("Category: ").AppendLine(_name).Append("EventId: ")
				.Append(((EventId)(ref eventId)).Id)
				.AppendLine();
			IExternalScopeProvider externalScopeProvider = _externalScopeProvider;
			if (externalScopeProvider != null)
			{
				externalScopeProvider.ForEachScope<StringBuilder>((Action<object, StringBuilder>)delegate(object scope, StringBuilder sb)
				{
					if (scope is IEnumerable<KeyValuePair<string, object>> enumerable)
					{
						{
							foreach (KeyValuePair<string, object> item in enumerable)
							{
								sb.Append(item.Key).Append(": ").AppendLine(item.Value?.ToString());
							}
							return;
						}
					}
					if (scope != null)
					{
						sb.AppendLine(scope.ToString());
					}
				}, stringBuilder);
			}
			stringBuilder.AppendLine().AppendLine(value);
			if (exception != null)
			{
				stringBuilder.AppendLine().AppendLine("Exception: ").Append(exception)
					.AppendLine();
			}
			WriteMessage(stringBuilder.ToString(), GetEventLogEntryType(logLevel), EventLog.DefaultEventId ?? ((EventId)(ref eventId)).Id);
		}

		private void WriteMessage(string message, EventLogEntryType eventLogEntryType, int eventId)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			if (message.Length <= EventLog.MaxMessageSize)
			{
				EventLog.WriteEntry(message, eventLogEntryType, eventId, 0);
				return;
			}
			int num = 0;
			string text = null;
			while (true)
			{
				if (num == 0)
				{
					text = message.Substring(num, _beginOrEndMessageSegmentSize) + "...";
					num += _beginOrEndMessageSegmentSize;
				}
				else
				{
					if (message.Length - (num + 1) <= _beginOrEndMessageSegmentSize)
					{
						break;
					}
					text = "..." + message.Substring(num, _intermediateMessageSegmentSize) + "...";
					num += _intermediateMessageSegmentSize;
				}
				EventLog.WriteEntry(text, eventLogEntryType, eventId, 0);
			}
			text = "..." + message.Substring(num);
			EventLog.WriteEntry(text, eventLogEntryType, eventId, 0);
		}

		private static EventLogEntryType GetEventLogEntryType(LogLevel level)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected I4, but got Unknown
			switch ((int)level)
			{
			case 0:
			case 1:
			case 2:
				return (EventLogEntryType)4;
			case 3:
				return (EventLogEntryType)2;
			case 4:
			case 5:
				return (EventLogEntryType)1;
			default:
				return (EventLogEntryType)4;
			}
		}
	}
	[ProviderAlias("EventLog")]
	public class EventLogLoggerProvider : ILoggerProvider, IDisposable, ISupportExternalScope
	{
		internal readonly EventLogSettings _settings;

		private IExternalScopeProvider _scopeProvider;

		public EventLogLoggerProvider()
			: this((EventLogSettings?)null)
		{
		}

		public EventLogLoggerProvider(EventLogSettings? settings)
		{
			_settings = settings ?? new EventLogSettings();
		}

		public EventLogLoggerProvider(IOptions<EventLogSettings> options)
			: this(options.Value)
		{
		}

		public ILogger CreateLogger(string name)
		{
			return (ILogger)(object)new EventLogLogger(name, _settings, _scopeProvider);
		}

		public void Dispose()
		{
			if (_settings.EventLog is WindowsEventLog windowsEventLog)
			{
				((Component)(object)windowsEventLog.DiagnosticsEventLog).Dispose();
			}
		}

		public void SetScopeProvider(IExternalScopeProvider scopeProvider)
		{
			_scopeProvider = scopeProvider;
		}
	}
	public class EventLogSettings
	{
		private IEventLog _eventLog;

		public string? LogName { get; set; }

		public string? SourceName { get; set; }

		public string? MachineName { get; set; }

		public Func<string, LogLevel, bool>? Filter { get; set; }

		internal IEventLog EventLog
		{
			get
			{
				return _eventLog ?? (_eventLog = CreateDefaultEventLog());
			}
			set
			{
				_eventLog = value;
			}
		}

		private IEventLog CreateDefaultEventLog()
		{
			string logName = (string.IsNullOrEmpty(LogName) ? "Application" : LogName);
			string machineName = (string.IsNullOrEmpty(MachineName) ? "." : MachineName);
			string sourceName = (string.IsNullOrEmpty(SourceName) ? ".NET Runtime" : SourceName);
			int? defaultEventId = null;
			if (string.IsNullOrEmpty(SourceName))
			{
				sourceName = ".NET Runtime";
				defaultEventId = 1000;
			}
			return new WindowsEventLog(logName, machineName, sourceName)
			{
				DefaultEventId = defaultEventId
			};
		}
	}
	internal interface IEventLog
	{
		int? DefaultEventId { get; }

		int MaxMessageSize { get; }

		void WriteEntry(string message, EventLogEntryType type, int eventID, short category);
	}
	[SupportedOSPlatform("windows")]
	internal sealed class WindowsEventLog : IEventLog
	{
		private const int MaximumMessageSize = 31839;

		private bool _enabled = true;

		public EventLog DiagnosticsEventLog { get; }

		public int MaxMessageSize => 31839;

		public int? DefaultEventId { get; set; }

		public WindowsEventLog(string logName, string machineName, string sourceName)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			DiagnosticsEventLog = new EventLog(logName, machineName, sourceName);
		}

		public void WriteEntry(string message, EventLogEntryType type, int eventID, short category)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Expected O, but got Unknown
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Expected O, but got Unknown
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Expected O, but got Unknown
			try
			{
				if (_enabled)
				{
					DiagnosticsEventLog.WriteEvent(new EventInstance((long)eventID, (int)category, type), new object[1] { message });
				}
			}
			catch (SecurityException ex)
			{
				_enabled = false;
				try
				{
					EventLog val = new EventLog("Application", ".", "Application");
					try
					{
						val.WriteEvent(new EventInstance(0L, 0, (EventLogEntryType)1), new object[1] { "Unable to log .NET application events. " + ex.Message });
					}
					finally
					{
						((IDisposable)val)?.Dispose();
					}
				}
				catch (Exception)
				{
				}
			}
		}
	}
}

BepInEx/plugins/SlopCrew.Plugin/Microsoft.Extensions.Logging.EventSource.dll

Decompiled 8 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Diagnostics.Tracing;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Text.Json;
using System.Threading;
using Microsoft.CodeAnalysis;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.Extensions.Logging.EventSource;
using Microsoft.Extensions.Options;
using Microsoft.Extensions.Primitives;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: InternalsVisibleTo("Microsoft.Extensions.Logging.EventSource.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: AssemblyMetadata(".NETFrameworkAssembly", "")]
[assembly: AssemblyMetadata("Serviceable", "True")]
[assembly: AssemblyMetadata("PreferInbox", "True")]
[assembly: AssemblyDefaultAlias("Microsoft.Extensions.Logging.EventSource")]
[assembly: CLSCompliant(true)]
[assembly: AssemblyMetadata("IsTrimmable", "True")]
[assembly: DefaultDllImportSearchPaths(DllImportSearchPath.System32 | DllImportSearchPath.AssemblyDirectory)]
[assembly: AssemblyCompany("Microsoft Corporation")]
[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")]
[assembly: AssemblyDescription("EventSource/EventListener logger provider implementation for Microsoft.Extensions.Logging.")]
[assembly: AssemblyFileVersion("7.0.22.51805")]
[assembly: AssemblyInformationalVersion("7.0.0+d099f075e45d2aa6007a22b71b45a08758559f80")]
[assembly: AssemblyProduct("Microsoft® .NET")]
[assembly: AssemblyTitle("Microsoft.Extensions.Logging.EventSource")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/dotnet/runtime")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("7.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: System.Runtime.CompilerServices.NullablePublicOnly(true)]
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 NullablePublicOnlyAttribute : Attribute
	{
		public readonly bool IncludesInternals;

		public NullablePublicOnlyAttribute(bool P_0)
		{
			IncludesInternals = 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 System
{
	internal static class ThrowHelper
	{
		internal static void ThrowIfNull(object? argument, [CallerArgumentExpression("argument")] string? paramName = null)
		{
			if (argument == null)
			{
				Throw(paramName);
			}
		}

		private static void Throw(string paramName)
		{
			throw new ArgumentNullException(paramName);
		}
	}
}
namespace System.Diagnostics.CodeAnalysis
{
	[AttributeUsage(AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Field, AllowMultiple = true, Inherited = false)]
	internal sealed class DynamicDependencyAttribute : Attribute
	{
		public string? MemberSignature { get; }

		public DynamicallyAccessedMemberTypes MemberTypes { get; }

		public Type? Type { get; }

		public string? TypeName { get; }

		public string? AssemblyName { get; }

		public string? Condition { get; set; }

		public DynamicDependencyAttribute(string memberSignature)
		{
			MemberSignature = memberSignature;
		}

		public DynamicDependencyAttribute(string memberSignature, Type type)
		{
			MemberSignature = memberSignature;
			Type = type;
		}

		public DynamicDependencyAttribute(string memberSignature, string typeName, string assemblyName)
		{
			MemberSignature = memberSignature;
			TypeName = typeName;
			AssemblyName = assemblyName;
		}

		public DynamicDependencyAttribute(DynamicallyAccessedMemberTypes memberTypes, Type type)
		{
			MemberTypes = memberTypes;
			Type = type;
		}

		public DynamicDependencyAttribute(DynamicallyAccessedMemberTypes memberTypes, string typeName, string assemblyName)
		{
			MemberTypes = memberTypes;
			TypeName = typeName;
			AssemblyName = assemblyName;
		}
	}
	[Flags]
	internal enum DynamicallyAccessedMemberTypes
	{
		None = 0,
		PublicParameterlessConstructor = 1,
		PublicConstructors = 3,
		NonPublicConstructors = 4,
		PublicMethods = 8,
		NonPublicMethods = 0x10,
		PublicFields = 0x20,
		NonPublicFields = 0x40,
		PublicNestedTypes = 0x80,
		NonPublicNestedTypes = 0x100,
		PublicProperties = 0x200,
		NonPublicProperties = 0x400,
		PublicEvents = 0x800,
		NonPublicEvents = 0x1000,
		Interfaces = 0x2000,
		All = -1
	}
	[AttributeUsage(AttributeTargets.All, Inherited = false, AllowMultiple = true)]
	internal sealed class UnconditionalSuppressMessageAttribute : Attribute
	{
		public string Category { get; }

		public string CheckId { get; }

		public string? Scope { get; set; }

		public string? Target { get; set; }

		public string? MessageId { get; set; }

		public string? Justification { get; set; }

		public UnconditionalSuppressMessageAttribute(string category, string checkId)
		{
			Category = category;
			CheckId = checkId;
		}
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)]
	internal sealed class AllowNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)]
	internal sealed class DisallowNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)]
	internal sealed class MaybeNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)]
	internal sealed class NotNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class MaybeNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public MaybeNullWhenAttribute(bool returnValue)
		{
			ReturnValue = returnValue;
		}
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class NotNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public NotNullWhenAttribute(bool returnValue)
		{
			ReturnValue = returnValue;
		}
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = true, Inherited = false)]
	internal sealed class NotNullIfNotNullAttribute : Attribute
	{
		public string ParameterName { get; }

		public NotNullIfNotNullAttribute(string parameterName)
		{
			ParameterName = parameterName;
		}
	}
	[AttributeUsage(AttributeTargets.Method, Inherited = false)]
	internal sealed class DoesNotReturnAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class DoesNotReturnIfAttribute : Attribute
	{
		public bool ParameterValue { get; }

		public DoesNotReturnIfAttribute(bool parameterValue)
		{
			ParameterValue = parameterValue;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	internal sealed class MemberNotNullAttribute : Attribute
	{
		public string[] Members { get; }

		public MemberNotNullAttribute(string member)
		{
			Members = new string[1] { member };
		}

		public MemberNotNullAttribute(params string[] members)
		{
			Members = members;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	internal sealed class MemberNotNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public string[] Members { get; }

		public MemberNotNullWhenAttribute(bool returnValue, string member)
		{
			ReturnValue = returnValue;
			Members = new string[1] { member };
		}

		public MemberNotNullWhenAttribute(bool returnValue, params string[] members)
		{
			ReturnValue = returnValue;
			Members = members;
		}
	}
}
namespace System.Runtime.InteropServices
{
	[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
	internal sealed class LibraryImportAttribute : Attribute
	{
		public string LibraryName { get; }

		public string? EntryPoint { get; set; }

		public StringMarshalling StringMarshalling { get; set; }

		public Type? StringMarshallingCustomType { get; set; }

		public bool SetLastError { get; set; }

		public LibraryImportAttribute(string libraryName)
		{
			LibraryName = libraryName;
		}
	}
	internal enum StringMarshalling
	{
		Custom,
		Utf8,
		Utf16
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
	internal sealed class CallerArgumentExpressionAttribute : Attribute
	{
		public string ParameterName { get; }

		public CallerArgumentExpressionAttribute(string parameterName)
		{
			ParameterName = parameterName;
		}
	}
}
namespace Microsoft.Extensions.Logging
{
	internal sealed class EventLogFiltersConfigureOptions : IConfigureOptions<LoggerFilterOptions>
	{
		private readonly LoggingEventSource _eventSource;

		public EventLogFiltersConfigureOptions(LoggingEventSource eventSource)
		{
			_eventSource = eventSource;
		}

		public void Configure(LoggerFilterOptions options)
		{
			LoggerFilterRule[] filterRules = _eventSource.GetFilterRules();
			foreach (LoggerFilterRule item in filterRules)
			{
				options.Rules.Add(item);
			}
		}
	}
	internal sealed class EventLogFiltersConfigureOptionsChangeSource : IOptionsChangeTokenSource<LoggerFilterOptions>
	{
		private readonly LoggingEventSource _eventSource;

		public string? Name { get; }

		public EventLogFiltersConfigureOptionsChangeSource(LoggingEventSource eventSource)
		{
			_eventSource = eventSource;
		}

		public IChangeToken GetChangeToken()
		{
			return _eventSource.GetFilterChangeToken();
		}
	}
	public static class EventSourceLoggerFactoryExtensions
	{
		public static ILoggingBuilder AddEventSourceLogger(this ILoggingBuilder builder)
		{
			System.ThrowHelper.ThrowIfNull(builder, "builder");
			ServiceCollectionDescriptorExtensions.TryAddSingleton<LoggingEventSource>(builder.Services, LoggingEventSource.Instance);
			ServiceCollectionDescriptorExtensions.TryAddEnumerable(builder.Services, ServiceDescriptor.Singleton<ILoggerProvider, EventSourceLoggerProvider>());
			ServiceCollectionDescriptorExtensions.TryAddEnumerable(builder.Services, ServiceDescriptor.Singleton<IConfigureOptions<LoggerFilterOptions>, EventLogFiltersConfigureOptions>());
			ServiceCollectionDescriptorExtensions.TryAddEnumerable(builder.Services, ServiceDescriptor.Singleton<IOptionsChangeTokenSource<LoggerFilterOptions>, EventLogFiltersConfigureOptionsChangeSource>());
			return builder;
		}
	}
	internal sealed class NullExternalScopeProvider : IExternalScopeProvider
	{
		public static IExternalScopeProvider Instance { get; } = (IExternalScopeProvider)(object)new NullExternalScopeProvider();


		private NullExternalScopeProvider()
		{
		}

		void IExternalScopeProvider.ForEachScope<TState>(Action<object, TState> callback, TState state)
		{
		}

		IDisposable IExternalScopeProvider.Push(object state)
		{
			return NullScope.Instance;
		}
	}
	internal sealed class NullScope : IDisposable
	{
		public static NullScope Instance { get; } = new NullScope();


		private NullScope()
		{
		}

		public void Dispose()
		{
		}
	}
}
namespace Microsoft.Extensions.Logging.EventSource
{
	internal sealed class EventSourceLogger : ILogger
	{
		private sealed class ActivityScope : IDisposable
		{
			private readonly string _categoryName;

			private readonly int _activityID;

			private readonly int _factoryID;

			private readonly bool _isJsonStop;

			private readonly LoggingEventSource _eventSource;

			public ActivityScope(LoggingEventSource eventSource, string categoryName, int activityID, int factoryID, bool isJsonStop)
			{
				_categoryName = categoryName;
				_activityID = activityID;
				_factoryID = factoryID;
				_isJsonStop = isJsonStop;
				_eventSource = eventSource;
			}

			public void Dispose()
			{
				if (_isJsonStop)
				{
					_eventSource.ActivityJsonStop(_activityID, _factoryID, _categoryName);
				}
				else
				{
					_eventSource.ActivityStop(_activityID, _factoryID, _categoryName);
				}
			}
		}

		private static int _activityIds;

		private readonly LoggingEventSource _eventSource;

		private readonly int _factoryID;

		public string CategoryName { get; }

		public LogLevel Level { get; set; }

		public EventSourceLogger? Next { get; }

		public EventSourceLogger(string categoryName, int factoryID, LoggingEventSource eventSource, EventSourceLogger? next)
		{
			CategoryName = categoryName;
			Level = (LogLevel)0;
			_factoryID = factoryID;
			_eventSource = eventSource;
			Next = next;
		}

		public bool IsEnabled(LogLevel logLevel)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Invalid comparison between Unknown and I4
			//IL_0004: 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)
			if ((int)logLevel != 6)
			{
				return logLevel >= Level;
			}
			return false;
		}

		public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception? exception, Func<TState, Exception?, string> formatter)
		{
			//IL_0001: 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_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			if (!IsEnabled(logLevel))
			{
				return;
			}
			string text = null;
			if (_eventSource.IsEnabled(EventLevel.Critical, (EventKeywords)4L))
			{
				text = formatter(state, exception);
				_eventSource.FormattedMessage(logLevel, _factoryID, CategoryName, ((EventId)(ref eventId)).Id, ((EventId)(ref eventId)).Name, text);
			}
			if (_eventSource.IsEnabled(EventLevel.Critical, (EventKeywords)2L))
			{
				ExceptionInfo exceptionInfo = GetExceptionInfo(exception);
				IReadOnlyList<KeyValuePair<string, string>> properties = GetProperties(state);
				_eventSource.Message(logLevel, _factoryID, CategoryName, ((EventId)(ref eventId)).Id, ((EventId)(ref eventId)).Name, exceptionInfo, properties);
			}
			if (_eventSource.IsEnabled(EventLevel.Critical, (EventKeywords)8L))
			{
				string exceptionJson = "{}";
				if (exception != null)
				{
					ExceptionInfo exceptionInfo2 = GetExceptionInfo(exception);
					KeyValuePair<string, string>[] keyValues = new KeyValuePair<string, string>[4]
					{
						new KeyValuePair<string, string>("TypeName", exceptionInfo2.TypeName),
						new KeyValuePair<string, string>("Message", exceptionInfo2.Message),
						new KeyValuePair<string, string>("HResult", exceptionInfo2.HResult.ToString()),
						new KeyValuePair<string, string>("VerboseMessage", exceptionInfo2.VerboseMessage)
					};
					exceptionJson = ToJson(keyValues);
				}
				IReadOnlyList<KeyValuePair<string, string>> properties2 = GetProperties(state);
				if (text == null)
				{
					text = formatter(state, exception);
				}
				_eventSource.MessageJson(logLevel, _factoryID, CategoryName, ((EventId)(ref eventId)).Id, ((EventId)(ref eventId)).Name, exceptionJson, ToJson(properties2), text);
			}
		}

		public IDisposable BeginScope<TState>(TState state) where TState : notnull
		{
			if (!IsEnabled((LogLevel)5))
			{
				return NullScope.Instance;
			}
			int num = Interlocked.Increment(ref _activityIds);
			if (_eventSource.IsEnabled(EventLevel.Critical, (EventKeywords)8L))
			{
				IReadOnlyList<KeyValuePair<string, string>> properties = GetProperties(state);
				_eventSource.ActivityJsonStart(num, _factoryID, CategoryName, ToJson(properties));
				return new ActivityScope(_eventSource, CategoryName, num, _factoryID, isJsonStop: true);
			}
			if (_eventSource.IsEnabled(EventLevel.Critical, (EventKeywords)2L) || _eventSource.IsEnabled(EventLevel.Critical, (EventKeywords)4L))
			{
				IReadOnlyList<KeyValuePair<string, string>> properties2 = GetProperties(state);
				_eventSource.ActivityStart(num, _factoryID, CategoryName, properties2);
				return new ActivityScope(_eventSource, CategoryName, num, _factoryID, isJsonStop: false);
			}
			return NullScope.Instance;
		}

		private static ExceptionInfo GetExceptionInfo(Exception exception)
		{
			if (exception == null)
			{
				return ExceptionInfo.Empty;
			}
			return new ExceptionInfo(exception);
		}

		private static IReadOnlyList<KeyValuePair<string, string>> GetProperties(object state)
		{
			if (state is IReadOnlyList<KeyValuePair<string, object>> readOnlyList)
			{
				KeyValuePair<string, string>[] array = new KeyValuePair<string, string>[readOnlyList.Count];
				for (int i = 0; i < readOnlyList.Count; i++)
				{
					KeyValuePair<string, object> keyValuePair = readOnlyList[i];
					array[i] = new KeyValuePair<string, string>(keyValuePair.Key, keyValuePair.Value?.ToString());
				}
				return array;
			}
			return Array.Empty<KeyValuePair<string, string>>();
		}

		private static string ToJson(IReadOnlyList<KeyValuePair<string, string>> keyValues)
		{
			//IL_0009: 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_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			using MemoryStream memoryStream = new MemoryStream();
			Utf8JsonWriter val = new Utf8JsonWriter((Stream)memoryStream, default(JsonWriterOptions));
			try
			{
				val.WriteStartObject();
				foreach (KeyValuePair<string, string> keyValue in keyValues)
				{
					val.WriteString(keyValue.Key, keyValue.Value);
				}
				val.WriteEndObject();
				val.Flush();
				if (!memoryStream.TryGetBuffer(out var buffer))
				{
					buffer = new ArraySegment<byte>(memoryStream.ToArray());
				}
				return Encoding.UTF8.GetString(buffer.Array, buffer.Offset, buffer.Count);
			}
			finally
			{
				((IDisposable)val)?.Dispose();
			}
		}
	}
	[ProviderAlias("EventSource")]
	public class EventSourceLoggerProvider : ILoggerProvider, IDisposable
	{
		private static int _globalFactoryID;

		private readonly int _factoryID;

		private EventSourceLogger _loggers;

		private readonly LoggingEventSource _eventSource;

		public EventSourceLoggerProvider(LoggingEventSource eventSource)
		{
			System.ThrowHelper.ThrowIfNull(eventSource, "eventSource");
			_eventSource = eventSource;
			_factoryID = Interlocked.Increment(ref _globalFactoryID);
		}

		public ILogger CreateLogger(string categoryName)
		{
			return (ILogger)(object)(_loggers = new EventSourceLogger(categoryName, _factoryID, _eventSource, _loggers));
		}

		public void Dispose()
		{
			for (EventSourceLogger eventSourceLogger = _loggers; eventSourceLogger != null; eventSourceLogger = eventSourceLogger.Next)
			{
				eventSourceLogger.Level = (LogLevel)6;
			}
		}
	}
	[EventData(Name = "ExceptionInfo")]
	internal sealed class ExceptionInfo
	{
		public static ExceptionInfo Empty { get; } = new ExceptionInfo();


		public string? TypeName { get; }

		public string? Message { get; }

		public int HResult { get; }

		public string? VerboseMessage { get; }

		private ExceptionInfo()
		{
		}

		public ExceptionInfo(Exception exception)
		{
			TypeName = exception.GetType().FullName;
			Message = exception.Message;
			HResult = exception.HResult;
			VerboseMessage = exception.ToString();
		}
	}
	[EventSource(Name = "Microsoft-Extensions-Logging")]
	public sealed class LoggingEventSource : System.Diagnostics.Tracing.EventSource
	{
		public static class Keywords
		{
			public const EventKeywords Meta = (EventKeywords)1L;

			public const EventKeywords Message = (EventKeywords)2L;

			public const EventKeywords FormattedMessage = (EventKeywords)4L;

			public const EventKeywords JsonMessage = (EventKeywords)8L;
		}

		internal static readonly LoggingEventSource Instance = new LoggingEventSource();

		private LoggerFilterRule[] _filterSpec = Array.Empty<LoggerFilterRule>();

		private CancellationTokenSource _cancellationTokenSource;

		private const string UseAppFilters = "UseAppFilters";

		private const string WriteEventCoreSuppressionJustification = "WriteEventCore is safe when eventData object is a primitive type which is in this case.";

		private const string WriteEventDynamicDependencySuppressionJustification = "DynamicDependency attribute will ensure that the required properties are not trimmed.";

		private LoggingEventSource()
			: base(EventSourceSettings.EtwSelfDescribingEventFormat)
		{
		}

		[Event(1, Keywords = (EventKeywords)4L, Level = EventLevel.LogAlways)]
		[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode", Justification = "WriteEventCore is safe when eventData object is a primitive type which is in this case.")]
		internal unsafe void FormattedMessage(LogLevel Level, int FactoryID, string LoggerName, int EventId, string? EventName, string FormattedMessage)
		{
			if (!IsEnabled())
			{
				return;
			}
			if (LoggerName == null)
			{
				LoggerName = "";
			}
			if (EventName == null)
			{
				EventName = "";
			}
			if (FormattedMessage == null)
			{
				FormattedMessage = "";
			}
			fixed (char* pinnedString = LoggerName)
			{
				fixed (char* pinnedString2 = EventName)
				{
					fixed (char* pinnedString3 = FormattedMessage)
					{
						EventData* ptr = stackalloc EventData[6];
						SetEventData(ref *ptr, ref Level, null);
						SetEventData(ref ptr[1], ref FactoryID, null);
						SetEventData(ref ptr[2], ref LoggerName, pinnedString);
						SetEventData(ref ptr[3], ref EventId, null);
						SetEventData(ref ptr[4], ref EventName, pinnedString2);
						SetEventData(ref ptr[5], ref FormattedMessage, pinnedString3);
						WriteEventCore(1, 6, ptr);
					}
				}
			}
		}

		[Event(2, Keywords = (EventKeywords)2L, Level = EventLevel.LogAlways)]
		[DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(KeyValuePair<string, string>))]
		[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode", Justification = "DynamicDependency attribute will ensure that the required properties are not trimmed.")]
		internal void Message(LogLevel Level, int FactoryID, string LoggerName, int EventId, string? EventName, ExceptionInfo Exception, IEnumerable<KeyValuePair<string, string?>> Arguments)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			if (IsEnabled())
			{
				WriteEvent(2, Level, FactoryID, LoggerName, EventId, EventName, Exception, Arguments);
			}
		}

		[Event(3, Keywords = (EventKeywords)6L, Level = EventLevel.LogAlways, ActivityOptions = EventActivityOptions.Recursive)]
		[DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(KeyValuePair<string, string>))]
		[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode", Justification = "DynamicDependency attribute will ensure that the required properties are not trimmed.")]
		internal void ActivityStart(int ID, int FactoryID, string LoggerName, IEnumerable<KeyValuePair<string, string?>> Arguments)
		{
			if (IsEnabled())
			{
				WriteEvent(3, ID, FactoryID, LoggerName, Arguments);
			}
		}

		[Event(4, Keywords = (EventKeywords)6L, Level = EventLevel.LogAlways)]
		[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode", Justification = "WriteEventCore is safe when eventData object is a primitive type which is in this case.")]
		internal unsafe void ActivityStop(int ID, int FactoryID, string LoggerName)
		{
			if (IsEnabled())
			{
				if (LoggerName == null)
				{
					LoggerName = "";
				}
				fixed (char* pinnedString = LoggerName)
				{
					EventData* ptr = stackalloc EventData[3];
					SetEventData(ref *ptr, ref ID, null);
					SetEventData(ref ptr[1], ref FactoryID, null);
					SetEventData(ref ptr[2], ref LoggerName, pinnedString);
					WriteEventCore(4, 3, ptr);
				}
			}
		}

		[Event(5, Keywords = (EventKeywords)8L, Level = EventLevel.LogAlways)]
		[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode", Justification = "WriteEventCore is safe when eventData object is a primitive type which is in this case.")]
		internal unsafe void MessageJson(LogLevel Level, int FactoryID, string LoggerName, int EventId, string? EventName, string ExceptionJson, string ArgumentsJson, string FormattedMessage)
		{
			if (!IsEnabled())
			{
				return;
			}
			if (LoggerName == null)
			{
				LoggerName = "";
			}
			if (EventName == null)
			{
				EventName = "";
			}
			if (ExceptionJson == null)
			{
				ExceptionJson = "";
			}
			if (ArgumentsJson == null)
			{
				ArgumentsJson = "";
			}
			if (FormattedMessage == null)
			{
				FormattedMessage = "";
			}
			fixed (char* pinnedString = LoggerName)
			{
				fixed (char* pinnedString2 = EventName)
				{
					fixed (char* pinnedString3 = ExceptionJson)
					{
						fixed (char* pinnedString4 = ArgumentsJson)
						{
							fixed (char* pinnedString5 = FormattedMessage)
							{
								EventData* ptr = stackalloc EventData[8];
								SetEventData(ref *ptr, ref Level, null);
								SetEventData(ref ptr[1], ref FactoryID, null);
								SetEventData(ref ptr[2], ref LoggerName, pinnedString);
								SetEventData(ref ptr[3], ref EventId, null);
								SetEventData(ref ptr[4], ref EventName, pinnedString2);
								SetEventData(ref ptr[5], ref ExceptionJson, pinnedString3);
								SetEventData(ref ptr[6], ref ArgumentsJson, pinnedString4);
								SetEventData(ref ptr[7], ref FormattedMessage, pinnedString5);
								WriteEventCore(5, 8, ptr);
							}
						}
					}
				}
			}
		}

		[Event(6, Keywords = (EventKeywords)12L, Level = EventLevel.LogAlways, ActivityOptions = EventActivityOptions.Recursive)]
		[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode", Justification = "WriteEventCore is safe when eventData object is a primitive type which is in this case.")]
		internal unsafe void ActivityJsonStart(int ID, int FactoryID, string LoggerName, string ArgumentsJson)
		{
			if (!IsEnabled())
			{
				return;
			}
			if (LoggerName == null)
			{
				LoggerName = "";
			}
			if (ArgumentsJson == null)
			{
				ArgumentsJson = "";
			}
			fixed (char* pinnedString = LoggerName)
			{
				fixed (char* pinnedString2 = ArgumentsJson)
				{
					EventData* ptr = stackalloc EventData[4];
					SetEventData(ref *ptr, ref ID, null);
					SetEventData(ref ptr[1], ref FactoryID, null);
					SetEventData(ref ptr[2], ref LoggerName, pinnedString);
					SetEventData(ref ptr[3], ref ArgumentsJson, pinnedString2);
					WriteEventCore(6, 4, ptr);
				}
			}
		}

		[Event(7, Keywords = (EventKeywords)12L, Level = EventLevel.LogAlways)]
		[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode", Justification = "WriteEventCore is safe when eventData object is a primitive type which is in this case.")]
		internal unsafe void ActivityJsonStop(int ID, int FactoryID, string LoggerName)
		{
			if (IsEnabled())
			{
				if (LoggerName == null)
				{
					LoggerName = "";
				}
				fixed (char* pinnedString = LoggerName)
				{
					EventData* ptr = stackalloc EventData[3];
					SetEventData(ref *ptr, ref ID, null);
					SetEventData(ref ptr[1], ref FactoryID, null);
					SetEventData(ref ptr[2], ref LoggerName, pinnedString);
					WriteEventCore(7, 3, ptr);
				}
			}
		}

		protected override void OnEventCommand(EventCommandEventArgs command)
		{
			EventCommand command2 = command.Command;
			if (command2 == EventCommand.Update || command2 == EventCommand.Enable)
			{
				if (!command.Arguments.TryGetValue("FilterSpecs", out string value))
				{
					value = string.Empty;
				}
				SetFilterSpec(value);
			}
			else if (command.Command == EventCommand.Disable)
			{
				SetFilterSpec(null);
			}
		}

		[NonEvent]
		private void SetFilterSpec(string filterSpec)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			_filterSpec = ParseFilterSpec(filterSpec, GetDefaultLevel());
			FireChangeToken();
		}

		[NonEvent]
		internal IChangeToken GetFilterChangeToken()
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Expected O, but got Unknown
			CancellationTokenSource cancellationTokenSource = LazyInitializer.EnsureInitialized(ref _cancellationTokenSource, () => new CancellationTokenSource());
			return (IChangeToken)new CancellationChangeToken(cancellationTokenSource.Token);
		}

		[NonEvent]
		private void FireChangeToken()
		{
			Interlocked.Exchange(ref _cancellationTokenSource, null)?.Cancel();
		}

		[NonEvent]
		private static LoggerFilterRule[] ParseFilterSpec(string filterSpec, LogLevel defaultLevel)
		{
			//IL_0025: 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_0032: Expected O, but got Unknown
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Expected O, but got Unknown
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Expected O, but got Unknown
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Expected O, but got Unknown
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			if (filterSpec == string.Empty)
			{
				return (LoggerFilterRule[])(object)new LoggerFilterRule[1]
				{
					new LoggerFilterRule(typeof(EventSourceLoggerProvider).FullName, (string)null, (LogLevel?)defaultLevel, (Func<string, string, LogLevel, bool>)null)
				};
			}
			if (filterSpec == null)
			{
				return (LoggerFilterRule[])(object)new LoggerFilterRule[1]
				{
					new LoggerFilterRule(typeof(EventSourceLoggerProvider).FullName, (string)null, (LogLevel?)(LogLevel)6, (Func<string, string, LogLevel, bool>)null)
				};
			}
			List<LoggerFilterRule> list = new List<LoggerFilterRule>();
			int num = 0;
			string[] array = filterSpec.Split(new char[1] { ';' }, StringSplitOptions.RemoveEmptyEntries);
			if (array.Length != 0 && array[0].Equals("UseAppFilters", StringComparison.OrdinalIgnoreCase))
			{
				num = 1;
			}
			else
			{
				list.Add(new LoggerFilterRule(typeof(EventSourceLoggerProvider).FullName, (string)null, (LogLevel?)(LogLevel)6, (Func<string, string, LogLevel, bool>)null));
			}
			for (int i = num; i < array.Length; i++)
			{
				string text = array[i];
				LogLevel ret = defaultLevel;
				string[] array2 = text.Split(new char[1] { ':' }, 2);
				string text2 = array2[0];
				if (text2.Length != 0)
				{
					if (text2[text2.Length - 1] == '*')
					{
						text2 = text2.Substring(0, text2.Length - 1);
					}
					if (array2.Length != 2 || TryParseLevel(defaultLevel, array2[1], out ret))
					{
						list.Add(new LoggerFilterRule(typeof(EventSourceLoggerProvider).FullName, text2, (LogLevel?)ret, (Func<string, string, LogLevel, bool>)null));
					}
				}
			}
			return list.ToArray();
		}

		[NonEvent]
		private static bool TryParseLevel(LogLevel defaultLevel, string levelString, out LogLevel ret)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Expected I4, but got Unknown
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Expected I4, but got Unknown
			ret = (LogLevel)(int)defaultLevel;
			if (levelString.Length == 0)
			{
				ret = (LogLevel)(int)defaultLevel;
				return true;
			}
			switch (levelString)
			{
			case "Trace":
				ret = (LogLevel)0;
				break;
			case "Debug":
				ret = (LogLevel)1;
				break;
			case "Information":
				ret = (LogLevel)2;
				break;
			case "Warning":
				ret = (LogLevel)3;
				break;
			case "Error":
				ret = (LogLevel)4;
				break;
			case "Critical":
				ret = (LogLevel)5;
				break;
			default:
			{
				if (!int.TryParse(levelString, out var result))
				{
					return false;
				}
				if (0 > result || result > 6)
				{
					return false;
				}
				ret = (LogLevel)result;
				break;
			}
			}
			return true;
		}

		[NonEvent]
		private LogLevel GetDefaultLevel()
		{
			EventKeywords keywords = (EventKeywords)14L;
			if (!IsEnabled(EventLevel.Verbose, keywords))
			{
				if (!IsEnabled(EventLevel.Informational, keywords))
				{
					if (!IsEnabled(EventLevel.Warning, keywords))
					{
						if (!IsEnabled(EventLevel.Error, keywords))
						{
							return (LogLevel)5;
						}
						return (LogLevel)4;
					}
					return (LogLevel)3;
				}
				return (LogLevel)2;
			}
			return (LogLevel)1;
		}

		[NonEvent]
		internal LoggerFilterRule[] GetFilterRules()
		{
			return _filterSpec;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		[NonEvent]
		private unsafe static void SetEventData<T>(ref EventData eventData, ref T value, void* pinnedString = null)
		{
			if (typeof(T) == typeof(string))
			{
				string text = value as string;
				eventData.DataPointer = (IntPtr)pinnedString;
				eventData.Size = checked((text.Length + 1) * 2);
			}
			else
			{
				eventData.DataPointer = (IntPtr)System.Runtime.CompilerServices.Unsafe.AsPointer<T>(ref value);
				eventData.Size = System.Runtime.CompilerServices.Unsafe.SizeOf<T>();
			}
		}
	}
}

BepInEx/plugins/SlopCrew.Plugin/Microsoft.Extensions.Options.ConfigurationExtensions.dll

Decompiled 8 months ago
using System;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using Microsoft.CodeAnalysis;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Options;
using Microsoft.Extensions.Primitives;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: AssemblyMetadata(".NETFrameworkAssembly", "")]
[assembly: AssemblyMetadata("Serviceable", "True")]
[assembly: AssemblyMetadata("PreferInbox", "True")]
[assembly: AssemblyDefaultAlias("Microsoft.Extensions.Options.ConfigurationExtensions")]
[assembly: CLSCompliant(true)]
[assembly: AssemblyMetadata("IsTrimmable", "True")]
[assembly: DefaultDllImportSearchPaths(DllImportSearchPath.System32 | DllImportSearchPath.AssemblyDirectory)]
[assembly: AssemblyCompany("Microsoft Corporation")]
[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")]
[assembly: AssemblyDescription("Provides additional configuration specific functionality related to Options.")]
[assembly: AssemblyFileVersion("7.0.22.51805")]
[assembly: AssemblyInformationalVersion("7.0.0+d099f075e45d2aa6007a22b71b45a08758559f80")]
[assembly: AssemblyProduct("Microsoft® .NET")]
[assembly: AssemblyTitle("Microsoft.Extensions.Options.ConfigurationExtensions")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/dotnet/runtime")]
[assembly: AssemblyVersion("7.0.0.0")]
[module: RefSafetyRules(11)]
[module: System.Runtime.CompilerServices.NullablePublicOnly(false)]
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 NullablePublicOnlyAttribute : Attribute
	{
		public readonly bool IncludesInternals;

		public NullablePublicOnlyAttribute(bool P_0)
		{
			IncludesInternals = 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 System
{
	internal static class ThrowHelper
	{
		internal static void ThrowIfNull(object argument, [CallerArgumentExpression("argument")] string paramName = null)
		{
			if (argument == null)
			{
				Throw(paramName);
			}
		}

		private static void Throw(string paramName)
		{
			throw new ArgumentNullException(paramName);
		}
	}
}
namespace System.Diagnostics.CodeAnalysis
{
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Interface | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, Inherited = false)]
	internal sealed class DynamicallyAccessedMembersAttribute : Attribute
	{
		public DynamicallyAccessedMemberTypes MemberTypes { get; }

		public DynamicallyAccessedMembersAttribute(DynamicallyAccessedMemberTypes memberTypes)
		{
			MemberTypes = memberTypes;
		}
	}
	[Flags]
	internal enum DynamicallyAccessedMemberTypes
	{
		None = 0,
		PublicParameterlessConstructor = 1,
		PublicConstructors = 3,
		NonPublicConstructors = 4,
		PublicMethods = 8,
		NonPublicMethods = 0x10,
		PublicFields = 0x20,
		NonPublicFields = 0x40,
		PublicNestedTypes = 0x80,
		NonPublicNestedTypes = 0x100,
		PublicProperties = 0x200,
		NonPublicProperties = 0x400,
		PublicEvents = 0x800,
		NonPublicEvents = 0x1000,
		Interfaces = 0x2000,
		All = -1
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Constructor | AttributeTargets.Method, Inherited = false)]
	internal sealed class RequiresUnreferencedCodeAttribute : Attribute
	{
		public string Message { get; }

		public string Url { get; set; }

		public RequiresUnreferencedCodeAttribute(string message)
		{
			Message = message;
		}
	}
	[AttributeUsage(AttributeTargets.All, Inherited = false, AllowMultiple = true)]
	internal sealed class UnconditionalSuppressMessageAttribute : Attribute
	{
		public string Category { get; }

		public string CheckId { get; }

		public string Scope { get; set; }

		public string Target { get; set; }

		public string MessageId { get; set; }

		public string Justification { get; set; }

		public UnconditionalSuppressMessageAttribute(string category, string checkId)
		{
			Category = category;
			CheckId = checkId;
		}
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Constructor | AttributeTargets.Method, Inherited = false)]
	internal sealed class RequiresDynamicCodeAttribute : Attribute
	{
		public string Message { get; }

		public string Url { get; set; }

		public RequiresDynamicCodeAttribute(string message)
		{
			Message = message;
		}
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)]
	internal sealed class AllowNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)]
	internal sealed class DisallowNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)]
	internal sealed class MaybeNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)]
	internal sealed class NotNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class MaybeNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public MaybeNullWhenAttribute(bool returnValue)
		{
			ReturnValue = returnValue;
		}
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class NotNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public NotNullWhenAttribute(bool returnValue)
		{
			ReturnValue = returnValue;
		}
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = true, Inherited = false)]
	internal sealed class NotNullIfNotNullAttribute : Attribute
	{
		public string ParameterName { get; }

		public NotNullIfNotNullAttribute(string parameterName)
		{
			ParameterName = parameterName;
		}
	}
	[AttributeUsage(AttributeTargets.Method, Inherited = false)]
	internal sealed class DoesNotReturnAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class DoesNotReturnIfAttribute : Attribute
	{
		public bool ParameterValue { get; }

		public DoesNotReturnIfAttribute(bool parameterValue)
		{
			ParameterValue = parameterValue;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	internal sealed class MemberNotNullAttribute : Attribute
	{
		public string[] Members { get; }

		public MemberNotNullAttribute(string member)
		{
			Members = new string[1] { member };
		}

		public MemberNotNullAttribute(params string[] members)
		{
			Members = members;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	internal sealed class MemberNotNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public string[] Members { get; }

		public MemberNotNullWhenAttribute(bool returnValue, string member)
		{
			ReturnValue = returnValue;
			Members = new string[1] { member };
		}

		public MemberNotNullWhenAttribute(bool returnValue, params string[] members)
		{
			ReturnValue = returnValue;
			Members = members;
		}
	}
}
namespace System.Runtime.InteropServices
{
	[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
	internal sealed class LibraryImportAttribute : Attribute
	{
		public string LibraryName { get; }

		public string EntryPoint { get; set; }

		public StringMarshalling StringMarshalling { get; set; }

		public Type StringMarshallingCustomType { get; set; }

		public bool SetLastError { get; set; }

		public LibraryImportAttribute(string libraryName)
		{
			LibraryName = libraryName;
		}
	}
	internal enum StringMarshalling
	{
		Custom,
		Utf8,
		Utf16
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
	internal sealed class CallerArgumentExpressionAttribute : Attribute
	{
		public string ParameterName { get; }

		public CallerArgumentExpressionAttribute(string parameterName)
		{
			ParameterName = parameterName;
		}
	}
}
namespace Microsoft.Extensions.DependencyInjection
{
	public static class OptionsBuilderConfigurationExtensions
	{
		internal const string RequiresDynamicCodeMessage = "Binding strongly typed objects to configuration values may require generating dynamic code at runtime.";

		internal const string TrimmingRequiredUnreferencedCodeMessage = "TOptions's dependent types may have their members trimmed. Ensure all required members are preserved.";

		[RequiresDynamicCode("Binding strongly typed objects to configuration values may require generating dynamic code at runtime.")]
		[RequiresUnreferencedCode("TOptions's dependent types may have their members trimmed. Ensure all required members are preserved.")]
		public static OptionsBuilder<TOptions> Bind<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] TOptions>(this OptionsBuilder<TOptions> optionsBuilder, IConfiguration config) where TOptions : class
		{
			return optionsBuilder.Bind<TOptions>(config, delegate
			{
			});
		}

		[RequiresDynamicCode("Binding strongly typed objects to configuration values may require generating dynamic code at runtime.")]
		[RequiresUnreferencedCode("TOptions's dependent types may have their members trimmed. Ensure all required members are preserved.")]
		public static OptionsBuilder<TOptions> Bind<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] TOptions>(this OptionsBuilder<TOptions> optionsBuilder, IConfiguration config, Action<BinderOptions>? configureBinder) where TOptions : class
		{
			System.ThrowHelper.ThrowIfNull(optionsBuilder, "optionsBuilder");
			optionsBuilder.Services.Configure<TOptions>(optionsBuilder.Name, config, configureBinder);
			return optionsBuilder;
		}

		[RequiresDynamicCode("Binding strongly typed objects to configuration values may require generating dynamic code at runtime.")]
		[RequiresUnreferencedCode("TOptions's dependent types may have their members trimmed. Ensure all required members are preserved.")]
		public static OptionsBuilder<TOptions> BindConfiguration<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] TOptions>(this OptionsBuilder<TOptions> optionsBuilder, string configSectionPath, Action<BinderOptions>? configureBinder = null) where TOptions : class
		{
			string configSectionPath2 = configSectionPath;
			Action<BinderOptions> configureBinder2 = configureBinder;
			System.ThrowHelper.ThrowIfNull(optionsBuilder, "optionsBuilder");
			System.ThrowHelper.ThrowIfNull(configSectionPath2, "configSectionPath");
			((OptionsBuilder<IConfiguration>)(object)optionsBuilder).Configure<IConfiguration>((Action<IConfiguration, IConfiguration>)(Action<TOptions, IConfiguration>)delegate(TOptions opts, IConfiguration config)
			{
				IConfiguration obj;
				if (!string.Equals("", configSectionPath2, StringComparison.OrdinalIgnoreCase))
				{
					IConfiguration section = (IConfiguration)(object)config.GetSection(configSectionPath2);
					obj = section;
				}
				else
				{
					obj = config;
				}
				IConfiguration val = obj;
				ConfigurationBinder.Bind(val, (object)opts, configureBinder2);
			});
			ServiceCollectionServiceExtensions.AddSingleton<IOptionsChangeTokenSource<TOptions>, ConfigurationChangeTokenSource<TOptions>>(optionsBuilder.Services);
			return optionsBuilder;
		}
	}
	public static class OptionsConfigurationServiceCollectionExtensions
	{
		[RequiresDynamicCode("Binding strongly typed objects to configuration values may require generating dynamic code at runtime.")]
		[RequiresUnreferencedCode("TOptions's dependent types may have their members trimmed. Ensure all required members are preserved.")]
		public static IServiceCollection Configure<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] TOptions>(this IServiceCollection services, IConfiguration config) where TOptions : class
		{
			return services.Configure<TOptions>(Options.DefaultName, config);
		}

		[RequiresDynamicCode("Binding strongly typed objects to configuration values may require generating dynamic code at runtime.")]
		[RequiresUnreferencedCode("TOptions's dependent types may have their members trimmed. Ensure all required members are preserved.")]
		public static IServiceCollection Configure<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] TOptions>(this IServiceCollection services, string? name, IConfiguration config) where TOptions : class
		{
			return services.Configure<TOptions>(name, config, delegate
			{
			});
		}

		[RequiresDynamicCode("Binding strongly typed objects to configuration values may require generating dynamic code at runtime.")]
		[RequiresUnreferencedCode("TOptions's dependent types may have their members trimmed. Ensure all required members are preserved.")]
		public static IServiceCollection Configure<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] TOptions>(this IServiceCollection services, IConfiguration config, Action<BinderOptions>? configureBinder) where TOptions : class
		{
			return services.Configure<TOptions>(Options.DefaultName, config, configureBinder);
		}

		[RequiresDynamicCode("Binding strongly typed objects to configuration values may require generating dynamic code at runtime.")]
		[RequiresUnreferencedCode("TOptions's dependent types may have their members trimmed. Ensure all required members are preserved.")]
		public static IServiceCollection Configure<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] TOptions>(this IServiceCollection services, string? name, IConfiguration config, Action<BinderOptions>? configureBinder) where TOptions : class
		{
			System.ThrowHelper.ThrowIfNull(services, "services");
			System.ThrowHelper.ThrowIfNull(config, "config");
			OptionsServiceCollectionExtensions.AddOptions(services);
			ServiceCollectionServiceExtensions.AddSingleton<IOptionsChangeTokenSource<TOptions>>(services, (IOptionsChangeTokenSource<TOptions>)new ConfigurationChangeTokenSource<TOptions>(name, config));
			return ServiceCollectionServiceExtensions.AddSingleton<IConfigureOptions<TOptions>>(services, (IConfigureOptions<TOptions>)(object)new NamedConfigureFromConfigurationOptions<TOptions>(name, config, configureBinder));
		}
	}
}
namespace Microsoft.Extensions.Options
{
	public class ConfigurationChangeTokenSource<TOptions> : IOptionsChangeTokenSource<TOptions>
	{
		private IConfiguration _config;

		public string Name { get; }

		public ConfigurationChangeTokenSource(IConfiguration config)
			: this(Options.DefaultName, config)
		{
		}

		public ConfigurationChangeTokenSource(string? name, IConfiguration config)
		{
			System.ThrowHelper.ThrowIfNull(config, "config");
			_config = config;
			Name = name ?? Options.DefaultName;
		}

		public IChangeToken GetChangeToken()
		{
			return _config.GetReloadToken();
		}
	}
	public class ConfigureFromConfigurationOptions<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] TOptions> : ConfigureOptions<TOptions> where TOptions : class
	{
		[RequiresDynamicCode("Binding strongly typed objects to configuration values may require generating dynamic code at runtime.")]
		[RequiresUnreferencedCode("TOptions's dependent types may have their members trimmed. Ensure all required members are preserved.")]
		public ConfigureFromConfigurationOptions(IConfiguration config)
		{
			IConfiguration config2 = config;
			base..ctor((Action<TOptions>)delegate(TOptions options)
			{
				ConfigurationBinder.Bind(config2, (object)options);
			});
			System.ThrowHelper.ThrowIfNull(config2, "config");
		}
	}
	public class NamedConfigureFromConfigurationOptions<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] TOptions> : ConfigureNamedOptions<TOptions> where TOptions : class
	{
		[RequiresDynamicCode("Binding strongly typed objects to configuration values may require generating dynamic code at runtime.")]
		[RequiresUnreferencedCode("TOptions's dependent types may have their members trimmed. Ensure all required members are preserved.")]
		public NamedConfigureFromConfigurationOptions(string? name, IConfiguration config)
			: this(name, config, (Action<BinderOptions>?)delegate
			{
			})
		{
		}

		[RequiresDynamicCode("Binding strongly typed objects to configuration values may require generating dynamic code at runtime.")]
		[RequiresUnreferencedCode("TOptions's dependent types may have their members trimmed. Ensure all required members are preserved.")]
		public NamedConfigureFromConfigurationOptions(string? name, IConfiguration config, Action<BinderOptions>? configureBinder)
		{
			IConfiguration config2 = config;
			Action<BinderOptions> configureBinder2 = configureBinder;
			base..ctor(name, (Action<TOptions>)delegate(TOptions options)
			{
				ConfigurationBinder.Bind(config2, (object)options, configureBinder2);
			});
			System.ThrowHelper.ThrowIfNull(config2, "config");
		}
	}
}

BepInEx/plugins/SlopCrew.Plugin/Microsoft.Extensions.Options.dll

Decompiled 8 months ago
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
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 System.Threading;
using FxResources.Microsoft.Extensions.Options;
using Microsoft.CodeAnalysis;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.Extensions.Options;
using Microsoft.Extensions.Primitives;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: InternalsVisibleTo("Microsoft.Extensions.Options.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: AssemblyMetadata(".NETFrameworkAssembly", "")]
[assembly: AssemblyMetadata("Serviceable", "True")]
[assembly: AssemblyMetadata("PreferInbox", "True")]
[assembly: AssemblyDefaultAlias("Microsoft.Extensions.Options")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: CLSCompliant(true)]
[assembly: AssemblyMetadata("IsTrimmable", "True")]
[assembly: DefaultDllImportSearchPaths(DllImportSearchPath.System32 | DllImportSearchPath.AssemblyDirectory)]
[assembly: AssemblyCompany("Microsoft Corporation")]
[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")]
[assembly: AssemblyDescription("Provides a strongly typed way of specifying and accessing settings using dependency injection.")]
[assembly: AssemblyFileVersion("7.0.323.6910")]
[assembly: AssemblyInformationalVersion("7.0.3+0a2bda10e81d901396c3cff95533529e3a93ad47")]
[assembly: AssemblyProduct("Microsoft® .NET")]
[assembly: AssemblyTitle("Microsoft.Extensions.Options")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/dotnet/runtime")]
[assembly: AssemblyVersion("7.0.0.1")]
[module: RefSafetyRules(11)]
[module: System.Runtime.CompilerServices.NullablePublicOnly(true)]
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 NullablePublicOnlyAttribute : Attribute
	{
		public readonly bool IncludesInternals;

		public NullablePublicOnlyAttribute(bool P_0)
		{
			IncludesInternals = 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 FxResources.Microsoft.Extensions.Options
{
	internal static class SR
	{
	}
}
namespace System
{
	internal static class ThrowHelper
	{
		internal static void ThrowIfNull(object? argument, [CallerArgumentExpression("argument")] string? paramName = null)
		{
			if (argument == null)
			{
				Throw(paramName);
			}
		}

		private static void Throw(string paramName)
		{
			throw new ArgumentNullException(paramName);
		}
	}
	internal static class SR
	{
		private static readonly bool s_usingResourceKeys = AppContext.TryGetSwitch("System.Resources.UseSystemResourceKeys", out var isEnabled) && isEnabled;

		private static ResourceManager s_resourceManager;

		internal static ResourceManager ResourceManager => s_resourceManager ?? (s_resourceManager = new ResourceManager(typeof(SR)));

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

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

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

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

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

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

		private static bool UsingResourceKeys()
		{
			return s_usingResourceKeys;
		}

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

		internal static string GetResourceString(string resourceKey, string defaultString)
		{
			string resourceString = GetResourceString(resourceKey);
			if (!(resourceKey == resourceString) && resourceString != null)
			{
				return resourceString;
			}
			return defaultString;
		}

		internal static string Format(string resourceFormat, object? p1)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1);
			}
			return string.Format(resourceFormat, p1);
		}

		internal static string Format(string resourceFormat, object? p1, object? p2)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2);
			}
			return string.Format(resourceFormat, p1, p2);
		}

		internal static string Format(string resourceFormat, object? p1, object? p2, object? p3)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2, p3);
			}
			return string.Format(resourceFormat, p1, p2, p3);
		}

		internal static string Format(string resourceFormat, params object?[]? args)
		{
			if (args != null)
			{
				if (UsingResourceKeys())
				{
					return resourceFormat + ", " + string.Join(", ", args);
				}
				return string.Format(resourceFormat, args);
			}
			return resourceFormat;
		}

		internal static string Format(IFormatProvider? provider, string resourceFormat, object? p1)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1);
			}
			return string.Format(provider, resourceFormat, p1);
		}

		internal static string Format(IFormatProvider? provider, string resourceFormat, object? p1, object? p2)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2);
			}
			return string.Format(provider, resourceFormat, p1, p2);
		}

		internal static string Format(IFormatProvider? provider, string resourceFormat, object? p1, object? p2, object? p3)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2, p3);
			}
			return string.Format(provider, resourceFormat, p1, p2, p3);
		}

		internal static string Format(IFormatProvider? provider, string resourceFormat, params object?[]? args)
		{
			if (args != null)
			{
				if (UsingResourceKeys())
				{
					return resourceFormat + ", " + string.Join(", ", args);
				}
				return string.Format(provider, resourceFormat, args);
			}
			return resourceFormat;
		}
	}
}
namespace System.Diagnostics.CodeAnalysis
{
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Interface | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, Inherited = false)]
	internal sealed class DynamicallyAccessedMembersAttribute : Attribute
	{
		public DynamicallyAccessedMemberTypes MemberTypes { get; }

		public DynamicallyAccessedMembersAttribute(DynamicallyAccessedMemberTypes memberTypes)
		{
			MemberTypes = memberTypes;
		}
	}
	[Flags]
	internal enum DynamicallyAccessedMemberTypes
	{
		None = 0,
		PublicParameterlessConstructor = 1,
		PublicConstructors = 3,
		NonPublicConstructors = 4,
		PublicMethods = 8,
		NonPublicMethods = 0x10,
		PublicFields = 0x20,
		NonPublicFields = 0x40,
		PublicNestedTypes = 0x80,
		NonPublicNestedTypes = 0x100,
		PublicProperties = 0x200,
		NonPublicProperties = 0x400,
		PublicEvents = 0x800,
		NonPublicEvents = 0x1000,
		Interfaces = 0x2000,
		All = -1
	}
	[AttributeUsage(AttributeTargets.All, Inherited = false, AllowMultiple = true)]
	internal sealed class UnconditionalSuppressMessageAttribute : Attribute
	{
		public string Category { get; }

		public string CheckId { get; }

		public string? Scope { get; set; }

		public string? Target { get; set; }

		public string? MessageId { get; set; }

		public string? Justification { get; set; }

		public UnconditionalSuppressMessageAttribute(string category, string checkId)
		{
			Category = category;
			CheckId = checkId;
		}
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)]
	internal sealed class AllowNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)]
	internal sealed class DisallowNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)]
	internal sealed class MaybeNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)]
	internal sealed class NotNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class MaybeNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public MaybeNullWhenAttribute(bool returnValue)
		{
			ReturnValue = returnValue;
		}
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class NotNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public NotNullWhenAttribute(bool returnValue)
		{
			ReturnValue = returnValue;
		}
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = true, Inherited = false)]
	internal sealed class NotNullIfNotNullAttribute : Attribute
	{
		public string ParameterName { get; }

		public NotNullIfNotNullAttribute(string parameterName)
		{
			ParameterName = parameterName;
		}
	}
	[AttributeUsage(AttributeTargets.Method, Inherited = false)]
	internal sealed class DoesNotReturnAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class DoesNotReturnIfAttribute : Attribute
	{
		public bool ParameterValue { get; }

		public DoesNotReturnIfAttribute(bool parameterValue)
		{
			ParameterValue = parameterValue;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	internal sealed class MemberNotNullAttribute : Attribute
	{
		public string[] Members { get; }

		public MemberNotNullAttribute(string member)
		{
			Members = new string[1] { member };
		}

		public MemberNotNullAttribute(params string[] members)
		{
			Members = members;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	internal sealed class MemberNotNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public string[] Members { get; }

		public MemberNotNullWhenAttribute(bool returnValue, string member)
		{
			ReturnValue = returnValue;
			Members = new string[1] { member };
		}

		public MemberNotNullWhenAttribute(bool returnValue, params string[] members)
		{
			ReturnValue = returnValue;
			Members = members;
		}
	}
}
namespace System.Runtime.InteropServices
{
	[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
	internal sealed class LibraryImportAttribute : Attribute
	{
		public string LibraryName { get; }

		public string? EntryPoint { get; set; }

		public StringMarshalling StringMarshalling { get; set; }

		public Type? StringMarshallingCustomType { get; set; }

		public bool SetLastError { get; set; }

		public LibraryImportAttribute(string libraryName)
		{
			LibraryName = libraryName;
		}
	}
	internal enum StringMarshalling
	{
		Custom,
		Utf8,
		Utf16
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
	internal sealed class CallerArgumentExpressionAttribute : Attribute
	{
		public string ParameterName { get; }

		public CallerArgumentExpressionAttribute(string parameterName)
		{
			ParameterName = parameterName;
		}
	}
}
namespace Microsoft.Extensions.DependencyInjection
{
	public static class OptionsServiceCollectionExtensions
	{
		public static IServiceCollection AddOptions(this IServiceCollection services)
		{
			System.ThrowHelper.ThrowIfNull(services, "services");
			ServiceCollectionDescriptorExtensions.TryAdd(services, ServiceDescriptor.Singleton(typeof(IOptions<>), typeof(UnnamedOptionsManager<>)));
			ServiceCollectionDescriptorExtensions.TryAdd(services, ServiceDescriptor.Scoped(typeof(IOptionsSnapshot<>), typeof(OptionsManager<>)));
			ServiceCollectionDescriptorExtensions.TryAdd(services, ServiceDescriptor.Singleton(typeof(IOptionsMonitor<>), typeof(OptionsMonitor<>)));
			ServiceCollectionDescriptorExtensions.TryAdd(services, ServiceDescriptor.Transient(typeof(IOptionsFactory<>), typeof(OptionsFactory<>)));
			ServiceCollectionDescriptorExtensions.TryAdd(services, ServiceDescriptor.Singleton(typeof(IOptionsMonitorCache<>), typeof(OptionsCache<>)));
			return services;
		}

		public static IServiceCollection Configure<TOptions>(this IServiceCollection services, Action<TOptions> configureOptions) where TOptions : class
		{
			return services.Configure(Microsoft.Extensions.Options.Options.DefaultName, configureOptions);
		}

		public static IServiceCollection Configure<TOptions>(this IServiceCollection services, string? name, Action<TOptions> configureOptions) where TOptions : class
		{
			System.ThrowHelper.ThrowIfNull(services, "services");
			System.ThrowHelper.ThrowIfNull(configureOptions, "configureOptions");
			services.AddOptions();
			ServiceCollectionServiceExtensions.AddSingleton<IConfigureOptions<TOptions>>(services, (IConfigureOptions<TOptions>)new ConfigureNamedOptions<TOptions>(name, configureOptions));
			return services;
		}

		public static IServiceCollection ConfigureAll<TOptions>(this IServiceCollection services, Action<TOptions> configureOptions) where TOptions : class
		{
			return services.Configure(null, configureOptions);
		}

		public static IServiceCollection PostConfigure<TOptions>(this IServiceCollection services, Action<TOptions> configureOptions) where TOptions : class
		{
			return services.PostConfigure(Microsoft.Extensions.Options.Options.DefaultName, configureOptions);
		}

		public static IServiceCollection PostConfigure<TOptions>(this IServiceCollection services, string? name, Action<TOptions> configureOptions) where TOptions : class
		{
			System.ThrowHelper.ThrowIfNull(services, "services");
			System.ThrowHelper.ThrowIfNull(configureOptions, "configureOptions");
			services.AddOptions();
			ServiceCollectionServiceExtensions.AddSingleton<IPostConfigureOptions<TOptions>>(services, (IPostConfigureOptions<TOptions>)new PostConfigureOptions<TOptions>(name, configureOptions));
			return services;
		}

		public static IServiceCollection PostConfigureAll<TOptions>(this IServiceCollection services, Action<TOptions> configureOptions) where TOptions : class
		{
			return services.PostConfigure(null, configureOptions);
		}

		public static IServiceCollection ConfigureOptions<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TConfigureOptions>(this IServiceCollection services) where TConfigureOptions : class
		{
			return services.ConfigureOptions(typeof(TConfigureOptions));
		}

		private static IEnumerable<Type> FindConfigurationServices(Type type)
		{
			Type[] array = GetInterfacesOnType(type);
			foreach (Type type2 in array)
			{
				if (type2.IsGenericType)
				{
					Type genericTypeDefinition = type2.GetGenericTypeDefinition();
					if (genericTypeDefinition == typeof(IConfigureOptions<>) || genericTypeDefinition == typeof(IPostConfigureOptions<>) || genericTypeDefinition == typeof(IValidateOptions<>))
					{
						yield return type2;
					}
				}
			}
			[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2070:UnrecognizedReflectionPattern", Justification = "This method only looks for interfaces referenced in its code. The trimmer will keep the interface and thus all of its implementations in that case. The call to GetInterfaces may return less results in trimmed apps, but it will include the interfaces this method looks for if they should be there.")]
			static Type[] GetInterfacesOnType(Type t)
			{
				return t.GetInterfaces();
			}
		}

		private static void ThrowNoConfigServices(Type type)
		{
			throw new InvalidOperationException((type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Action<>)) ? System.SR.Error_NoConfigurationServicesAndAction : System.SR.Error_NoConfigurationServices);
		}

		public static IServiceCollection ConfigureOptions(this IServiceCollection services, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type configureType)
		{
			services.AddOptions();
			bool flag = false;
			foreach (Type item in FindConfigurationServices(configureType))
			{
				ServiceCollectionServiceExtensions.AddTransient(services, item, configureType);
				flag = true;
			}
			if (!flag)
			{
				ThrowNoConfigServices(configureType);
			}
			return services;
		}

		public static IServiceCollection ConfigureOptions(this IServiceCollection services, object configureInstance)
		{
			services.AddOptions();
			Type type = configureInstance.GetType();
			bool flag = false;
			foreach (Type item in FindConfigurationServices(type))
			{
				ServiceCollectionServiceExtensions.AddSingleton(services, item, configureInstance);
				flag = true;
			}
			if (!flag)
			{
				ThrowNoConfigServices(type);
			}
			return services;
		}

		public static OptionsBuilder<TOptions> AddOptions<TOptions>(this IServiceCollection services) where TOptions : class
		{
			return services.AddOptions<TOptions>(Microsoft.Extensions.Options.Options.DefaultName);
		}

		public static OptionsBuilder<TOptions> AddOptions<TOptions>(this IServiceCollection services, string? name) where TOptions : class
		{
			System.ThrowHelper.ThrowIfNull(services, "services");
			services.AddOptions();
			return new OptionsBuilder<TOptions>(services, name);
		}
	}
}
namespace Microsoft.Extensions.Options
{
	public class ConfigureNamedOptions<TOptions> : IConfigureNamedOptions<TOptions>, IConfigureOptions<TOptions> where TOptions : class
	{
		public string? Name { get; }

		public Action<TOptions>? Action { get; }

		public ConfigureNamedOptions(string? name, Action<TOptions>? action)
		{
			Name = name;
			Action = action;
		}

		public virtual void Configure(string? name, TOptions options)
		{
			System.ThrowHelper.ThrowIfNull(options, "options");
			if (Name == null || name == Name)
			{
				Action?.Invoke(options);
			}
		}

		public void Configure(TOptions options)
		{
			Configure(Options.DefaultName, options);
		}
	}
	public class ConfigureNamedOptions<TOptions, TDep> : IConfigureNamedOptions<TOptions>, IConfigureOptions<TOptions> where TOptions : class where TDep : class
	{
		public string? Name { get; }

		public Action<TOptions, TDep>? Action { get; }

		public TDep Dependency { get; }

		public ConfigureNamedOptions(string? name, TDep dependency, Action<TOptions, TDep>? action)
		{
			Name = name;
			Action = action;
			Dependency = dependency;
		}

		public virtual void Configure(string? name, TOptions options)
		{
			System.ThrowHelper.ThrowIfNull(options, "options");
			if (Name == null || name == Name)
			{
				Action?.Invoke(options, Dependency);
			}
		}

		public void Configure(TOptions options)
		{
			Configure(Options.DefaultName, options);
		}
	}
	public class ConfigureNamedOptions<TOptions, TDep1, TDep2> : IConfigureNamedOptions<TOptions>, IConfigureOptions<TOptions> where TOptions : class where TDep1 : class where TDep2 : class
	{
		public string? Name { get; }

		public Action<TOptions, TDep1, TDep2>? Action { get; }

		public TDep1 Dependency1 { get; }

		public TDep2 Dependency2 { get; }

		public ConfigureNamedOptions(string? name, TDep1 dependency, TDep2 dependency2, Action<TOptions, TDep1, TDep2>? action)
		{
			Name = name;
			Action = action;
			Dependency1 = dependency;
			Dependency2 = dependency2;
		}

		public virtual void Configure(string? name, TOptions options)
		{
			System.ThrowHelper.ThrowIfNull(options, "options");
			if (Name == null || name == Name)
			{
				Action?.Invoke(options, Dependency1, Dependency2);
			}
		}

		public void Configure(TOptions options)
		{
			Configure(Options.DefaultName, options);
		}
	}
	public class ConfigureNamedOptions<TOptions, TDep1, TDep2, TDep3> : IConfigureNamedOptions<TOptions>, IConfigureOptions<TOptions> where TOptions : class where TDep1 : class where TDep2 : class where TDep3 : class
	{
		public string? Name { get; }

		public Action<TOptions, TDep1, TDep2, TDep3>? Action { get; }

		public TDep1 Dependency1 { get; }

		public TDep2 Dependency2 { get; }

		public TDep3 Dependency3 { get; }

		public ConfigureNamedOptions(string? name, TDep1 dependency, TDep2 dependency2, TDep3 dependency3, Action<TOptions, TDep1, TDep2, TDep3>? action)
		{
			Name = name;
			Action = action;
			Dependency1 = dependency;
			Dependency2 = dependency2;
			Dependency3 = dependency3;
		}

		public virtual void Configure(string? name, TOptions options)
		{
			System.ThrowHelper.ThrowIfNull(options, "options");
			if (Name == null || name == Name)
			{
				Action?.Invoke(options, Dependency1, Dependency2, Dependency3);
			}
		}

		public void Configure(TOptions options)
		{
			Configure(Options.DefaultName, options);
		}
	}
	public class ConfigureNamedOptions<TOptions, TDep1, TDep2, TDep3, TDep4> : IConfigureNamedOptions<TOptions>, IConfigureOptions<TOptions> where TOptions : class where TDep1 : class where TDep2 : class where TDep3 : class where TDep4 : class
	{
		public string? Name { get; }

		public Action<TOptions, TDep1, TDep2, TDep3, TDep4>? Action { get; }

		public TDep1 Dependency1 { get; }

		public TDep2 Dependency2 { get; }

		public TDep3 Dependency3 { get; }

		public TDep4 Dependency4 { get; }

		public ConfigureNamedOptions(string? name, TDep1 dependency1, TDep2 dependency2, TDep3 dependency3, TDep4 dependency4, Action<TOptions, TDep1, TDep2, TDep3, TDep4>? action)
		{
			Name = name;
			Action = action;
			Dependency1 = dependency1;
			Dependency2 = dependency2;
			Dependency3 = dependency3;
			Dependency4 = dependency4;
		}

		public virtual void Configure(string? name, TOptions options)
		{
			System.ThrowHelper.ThrowIfNull(options, "options");
			if (Name == null || name == Name)
			{
				Action?.Invoke(options, Dependency1, Dependency2, Dependency3, Dependency4);
			}
		}

		public void Configure(TOptions options)
		{
			Configure(Options.DefaultName, options);
		}
	}
	public class ConfigureNamedOptions<TOptions, TDep1, TDep2, TDep3, TDep4, TDep5> : IConfigureNamedOptions<TOptions>, IConfigureOptions<TOptions> where TOptions : class where TDep1 : class where TDep2 : class where TDep3 : class where TDep4 : class where TDep5 : class
	{
		public string? Name { get; }

		public Action<TOptions, TDep1, TDep2, TDep3, TDep4, TDep5>? Action { get; }

		public TDep1 Dependency1 { get; }

		public TDep2 Dependency2 { get; }

		public TDep3 Dependency3 { get; }

		public TDep4 Dependency4 { get; }

		public TDep5 Dependency5 { get; }

		public ConfigureNamedOptions(string? name, TDep1 dependency1, TDep2 dependency2, TDep3 dependency3, TDep4 dependency4, TDep5 dependency5, Action<TOptions, TDep1, TDep2, TDep3, TDep4, TDep5>? action)
		{
			Name = name;
			Action = action;
			Dependency1 = dependency1;
			Dependency2 = dependency2;
			Dependency3 = dependency3;
			Dependency4 = dependency4;
			Dependency5 = dependency5;
		}

		public virtual void Configure(string? name, TOptions options)
		{
			System.ThrowHelper.ThrowIfNull(options, "options");
			if (Name == null || name == Name)
			{
				Action?.Invoke(options, Dependency1, Dependency2, Dependency3, Dependency4, Dependency5);
			}
		}

		public void Configure(TOptions options)
		{
			Configure(Options.DefaultName, options);
		}
	}
	public class ConfigureOptions<TOptions> : IConfigureOptions<TOptions> where TOptions : class
	{
		public Action<TOptions>? Action { get; }

		public ConfigureOptions(Action<TOptions>? action)
		{
			Action = action;
		}

		public virtual void Configure(TOptions options)
		{
			System.ThrowHelper.ThrowIfNull(options, "options");
			Action?.Invoke(options);
		}
	}
	public interface IConfigureNamedOptions<in TOptions> : IConfigureOptions<TOptions> where TOptions : class
	{
		void Configure(string? name, TOptions options);
	}
	public interface IConfigureOptions<in TOptions> where TOptions : class
	{
		void Configure(TOptions options);
	}
	public interface IOptions<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] out TOptions> where TOptions : class
	{
		TOptions Value { get; }
	}
	public interface IOptionsChangeTokenSource<out TOptions>
	{
		string? Name { get; }

		IChangeToken GetChangeToken();
	}
	public interface IOptionsFactory<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] TOptions> where TOptions : class
	{
		TOptions Create(string name);
	}
	public interface IOptionsMonitor<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] out TOptions>
	{
		TOptions CurrentValue { get; }

		TOptions Get(string? name);

		IDisposable? OnChange(Action<TOptions, string?> listener);
	}
	public interface IOptionsMonitorCache<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] TOptions> where TOptions : class
	{
		TOptions GetOrAdd(string? name, Func<TOptions> createOptions);

		bool TryAdd(string? name, TOptions options);

		bool TryRemove(string? name);

		void Clear();
	}
	public interface IOptionsSnapshot<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] out TOptions> : IOptions<TOptions> where TOptions : class
	{
		TOptions Get(string? name);
	}
	public interface IPostConfigureOptions<in TOptions> where TOptions : class
	{
		void PostConfigure(string? name, TOptions options);
	}
	public interface IValidateOptions<TOptions> where TOptions : class
	{
		ValidateOptionsResult Validate(string? name, TOptions options);
	}
	public static class Options
	{
		internal const DynamicallyAccessedMemberTypes DynamicallyAccessedMembers = DynamicallyAccessedMemberTypes.PublicParameterlessConstructor;

		public static readonly string DefaultName = string.Empty;

		public static IOptions<TOptions> Create<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] TOptions>(TOptions options) where TOptions : class
		{
			return new OptionsWrapper<TOptions>(options);
		}
	}
	public class OptionsBuilder<TOptions> where TOptions : class
	{
		private const string DefaultValidationFailureMessage = "A validation error has occurred.";

		public string Name { get; }

		public IServiceCollection Services { get; }

		public OptionsBuilder(IServiceCollection services, string? name)
		{
			System.ThrowHelper.ThrowIfNull(services, "services");
			Services = services;
			Name = name ?? Options.DefaultName;
		}

		public virtual OptionsBuilder<TOptions> Configure(Action<TOptions> configureOptions)
		{
			System.ThrowHelper.ThrowIfNull(configureOptions, "configureOptions");
			ServiceCollectionServiceExtensions.AddSingleton<IConfigureOptions<TOptions>>(Services, (IConfigureOptions<TOptions>)new ConfigureNamedOptions<TOptions>(Name, configureOptions));
			return this;
		}

		public virtual OptionsBuilder<TOptions> Configure<TDep>(Action<TOptions, TDep> configureOptions) where TDep : class
		{
			Action<TOptions, TDep> configureOptions2 = configureOptions;
			System.ThrowHelper.ThrowIfNull(configureOptions2, "configureOptions");
			ServiceCollectionServiceExtensions.AddTransient<IConfigureOptions<TOptions>>(Services, (Func<IServiceProvider, IConfigureOptions<TOptions>>)((IServiceProvider sp) => new ConfigureNamedOptions<TOptions, TDep>(Name, ServiceProviderServiceExtensions.GetRequiredService<TDep>(sp), configureOptions2)));
			return this;
		}

		public virtual OptionsBuilder<TOptions> Configure<TDep1, TDep2>(Action<TOptions, TDep1, TDep2> configureOptions) where TDep1 : class where TDep2 : class
		{
			Action<TOptions, TDep1, TDep2> configureOptions2 = configureOptions;
			System.ThrowHelper.ThrowIfNull(configureOptions2, "configureOptions");
			ServiceCollectionServiceExtensions.AddTransient<IConfigureOptions<TOptions>>(Services, (Func<IServiceProvider, IConfigureOptions<TOptions>>)((IServiceProvider sp) => new ConfigureNamedOptions<TOptions, TDep1, TDep2>(Name, ServiceProviderServiceExtensions.GetRequiredService<TDep1>(sp), ServiceProviderServiceExtensions.GetRequiredService<TDep2>(sp), configureOptions2)));
			return this;
		}

		public virtual OptionsBuilder<TOptions> Configure<TDep1, TDep2, TDep3>(Action<TOptions, TDep1, TDep2, TDep3> configureOptions) where TDep1 : class where TDep2 : class where TDep3 : class
		{
			Action<TOptions, TDep1, TDep2, TDep3> configureOptions2 = configureOptions;
			System.ThrowHelper.ThrowIfNull(configureOptions2, "configureOptions");
			ServiceCollectionServiceExtensions.AddTransient<IConfigureOptions<TOptions>>(Services, (Func<IServiceProvider, IConfigureOptions<TOptions>>)((IServiceProvider sp) => new ConfigureNamedOptions<TOptions, TDep1, TDep2, TDep3>(Name, ServiceProviderServiceExtensions.GetRequiredService<TDep1>(sp), ServiceProviderServiceExtensions.GetRequiredService<TDep2>(sp), ServiceProviderServiceExtensions.GetRequiredService<TDep3>(sp), configureOptions2)));
			return this;
		}

		public virtual OptionsBuilder<TOptions> Configure<TDep1, TDep2, TDep3, TDep4>(Action<TOptions, TDep1, TDep2, TDep3, TDep4> configureOptions) where TDep1 : class where TDep2 : class where TDep3 : class where TDep4 : class
		{
			Action<TOptions, TDep1, TDep2, TDep3, TDep4> configureOptions2 = configureOptions;
			System.ThrowHelper.ThrowIfNull(configureOptions2, "configureOptions");
			ServiceCollectionServiceExtensions.AddTransient<IConfigureOptions<TOptions>>(Services, (Func<IServiceProvider, IConfigureOptions<TOptions>>)((IServiceProvider sp) => new ConfigureNamedOptions<TOptions, TDep1, TDep2, TDep3, TDep4>(Name, ServiceProviderServiceExtensions.GetRequiredService<TDep1>(sp), ServiceProviderServiceExtensions.GetRequiredService<TDep2>(sp), ServiceProviderServiceExtensions.GetRequiredService<TDep3>(sp), ServiceProviderServiceExtensions.GetRequiredService<TDep4>(sp), configureOptions2)));
			return this;
		}

		public virtual OptionsBuilder<TOptions> Configure<TDep1, TDep2, TDep3, TDep4, TDep5>(Action<TOptions, TDep1, TDep2, TDep3, TDep4, TDep5> configureOptions) where TDep1 : class where TDep2 : class where TDep3 : class where TDep4 : class where TDep5 : class
		{
			Action<TOptions, TDep1, TDep2, TDep3, TDep4, TDep5> configureOptions2 = configureOptions;
			System.ThrowHelper.ThrowIfNull(configureOptions2, "configureOptions");
			ServiceCollectionServiceExtensions.AddTransient<IConfigureOptions<TOptions>>(Services, (Func<IServiceProvider, IConfigureOptions<TOptions>>)((IServiceProvider sp) => new ConfigureNamedOptions<TOptions, TDep1, TDep2, TDep3, TDep4, TDep5>(Name, ServiceProviderServiceExtensions.GetRequiredService<TDep1>(sp), ServiceProviderServiceExtensions.GetRequiredService<TDep2>(sp), ServiceProviderServiceExtensions.GetRequiredService<TDep3>(sp), ServiceProviderServiceExtensions.GetRequiredService<TDep4>(sp), ServiceProviderServiceExtensions.GetRequiredService<TDep5>(sp), configureOptions2)));
			return this;
		}

		public virtual OptionsBuilder<TOptions> PostConfigure(Action<TOptions> configureOptions)
		{
			System.ThrowHelper.ThrowIfNull(configureOptions, "configureOptions");
			ServiceCollectionServiceExtensions.AddSingleton<IPostConfigureOptions<TOptions>>(Services, (IPostConfigureOptions<TOptions>)new PostConfigureOptions<TOptions>(Name, configureOptions));
			return this;
		}

		public virtual OptionsBuilder<TOptions> PostConfigure<TDep>(Action<TOptions, TDep> configureOptions) where TDep : class
		{
			Action<TOptions, TDep> configureOptions2 = configureOptions;
			System.ThrowHelper.ThrowIfNull(configureOptions2, "configureOptions");
			ServiceCollectionServiceExtensions.AddTransient<IPostConfigureOptions<TOptions>>(Services, (Func<IServiceProvider, IPostConfigureOptions<TOptions>>)((IServiceProvider sp) => new PostConfigureOptions<TOptions, TDep>(Name, ServiceProviderServiceExtensions.GetRequiredService<TDep>(sp), configureOptions2)));
			return this;
		}

		public virtual OptionsBuilder<TOptions> PostConfigure<TDep1, TDep2>(Action<TOptions, TDep1, TDep2> configureOptions) where TDep1 : class where TDep2 : class
		{
			Action<TOptions, TDep1, TDep2> configureOptions2 = configureOptions;
			System.ThrowHelper.ThrowIfNull(configureOptions2, "configureOptions");
			ServiceCollectionServiceExtensions.AddTransient<IPostConfigureOptions<TOptions>>(Services, (Func<IServiceProvider, IPostConfigureOptions<TOptions>>)((IServiceProvider sp) => new PostConfigureOptions<TOptions, TDep1, TDep2>(Name, ServiceProviderServiceExtensions.GetRequiredService<TDep1>(sp), ServiceProviderServiceExtensions.GetRequiredService<TDep2>(sp), configureOptions2)));
			return this;
		}

		public virtual OptionsBuilder<TOptions> PostConfigure<TDep1, TDep2, TDep3>(Action<TOptions, TDep1, TDep2, TDep3> configureOptions) where TDep1 : class where TDep2 : class where TDep3 : class
		{
			Action<TOptions, TDep1, TDep2, TDep3> configureOptions2 = configureOptions;
			System.ThrowHelper.ThrowIfNull(configureOptions2, "configureOptions");
			ServiceCollectionServiceExtensions.AddTransient<IPostConfigureOptions<TOptions>>(Services, (Func<IServiceProvider, IPostConfigureOptions<TOptions>>)((IServiceProvider sp) => new PostConfigureOptions<TOptions, TDep1, TDep2, TDep3>(Name, ServiceProviderServiceExtensions.GetRequiredService<TDep1>(sp), ServiceProviderServiceExtensions.GetRequiredService<TDep2>(sp), ServiceProviderServiceExtensions.GetRequiredService<TDep3>(sp), configureOptions2)));
			return this;
		}

		public virtual OptionsBuilder<TOptions> PostConfigure<TDep1, TDep2, TDep3, TDep4>(Action<TOptions, TDep1, TDep2, TDep3, TDep4> configureOptions) where TDep1 : class where TDep2 : class where TDep3 : class where TDep4 : class
		{
			Action<TOptions, TDep1, TDep2, TDep3, TDep4> configureOptions2 = configureOptions;
			System.ThrowHelper.ThrowIfNull(configureOptions2, "configureOptions");
			ServiceCollectionServiceExtensions.AddTransient<IPostConfigureOptions<TOptions>>(Services, (Func<IServiceProvider, IPostConfigureOptions<TOptions>>)((IServiceProvider sp) => new PostConfigureOptions<TOptions, TDep1, TDep2, TDep3, TDep4>(Name, ServiceProviderServiceExtensions.GetRequiredService<TDep1>(sp), ServiceProviderServiceExtensions.GetRequiredService<TDep2>(sp), ServiceProviderServiceExtensions.GetRequiredService<TDep3>(sp), ServiceProviderServiceExtensions.GetRequiredService<TDep4>(sp), configureOptions2)));
			return this;
		}

		public virtual OptionsBuilder<TOptions> PostConfigure<TDep1, TDep2, TDep3, TDep4, TDep5>(Action<TOptions, TDep1, TDep2, TDep3, TDep4, TDep5> configureOptions) where TDep1 : class where TDep2 : class where TDep3 : class where TDep4 : class where TDep5 : class
		{
			Action<TOptions, TDep1, TDep2, TDep3, TDep4, TDep5> configureOptions2 = configureOptions;
			System.ThrowHelper.ThrowIfNull(configureOptions2, "configureOptions");
			ServiceCollectionServiceExtensions.AddTransient<IPostConfigureOptions<TOptions>>(Services, (Func<IServiceProvider, IPostConfigureOptions<TOptions>>)((IServiceProvider sp) => new PostConfigureOptions<TOptions, TDep1, TDep2, TDep3, TDep4, TDep5>(Name, ServiceProviderServiceExtensions.GetRequiredService<TDep1>(sp), ServiceProviderServiceExtensions.GetRequiredService<TDep2>(sp), ServiceProviderServiceExtensions.GetRequiredService<TDep3>(sp), ServiceProviderServiceExtensions.GetRequiredService<TDep4>(sp), ServiceProviderServiceExtensions.GetRequiredService<TDep5>(sp), configureOptions2)));
			return this;
		}

		public virtual OptionsBuilder<TOptions> Validate(Func<TOptions, bool> validation)
		{
			return Validate(validation, "A validation error has occurred.");
		}

		public virtual OptionsBuilder<TOptions> Validate(Func<TOptions, bool> validation, string failureMessage)
		{
			System.ThrowHelper.ThrowIfNull(validation, "validation");
			ServiceCollectionServiceExtensions.AddSingleton<IValidateOptions<TOptions>>(Services, (IValidateOptions<TOptions>)new ValidateOptions<TOptions>(Name, validation, failureMessage));
			return this;
		}

		public virtual OptionsBuilder<TOptions> Validate<TDep>(Func<TOptions, TDep, bool> validation) where TDep : notnull
		{
			return Validate(validation, "A validation error has occurred.");
		}

		public virtual OptionsBuilder<TOptions> Validate<TDep>(Func<TOptions, TDep, bool> validation, string failureMessage) where TDep : notnull
		{
			Func<TOptions, TDep, bool> validation2 = validation;
			string failureMessage2 = failureMessage;
			System.ThrowHelper.ThrowIfNull(validation2, "validation");
			ServiceCollectionServiceExtensions.AddTransient<IValidateOptions<TOptions>>(Services, (Func<IServiceProvider, IValidateOptions<TOptions>>)((IServiceProvider sp) => new ValidateOptions<TOptions, TDep>(Name, ServiceProviderServiceExtensions.GetRequiredService<TDep>(sp), validation2, failureMessage2)));
			return this;
		}

		public virtual OptionsBuilder<TOptions> Validate<TDep1, TDep2>(Func<TOptions, TDep1, TDep2, bool> validation) where TDep1 : notnull where TDep2 : notnull
		{
			return Validate(validation, "A validation error has occurred.");
		}

		public virtual OptionsBuilder<TOptions> Validate<TDep1, TDep2>(Func<TOptions, TDep1, TDep2, bool> validation, string failureMessage) where TDep1 : notnull where TDep2 : notnull
		{
			Func<TOptions, TDep1, TDep2, bool> validation2 = validation;
			string failureMessage2 = failureMessage;
			System.ThrowHelper.ThrowIfNull(validation2, "validation");
			ServiceCollectionServiceExtensions.AddTransient<IValidateOptions<TOptions>>(Services, (Func<IServiceProvider, IValidateOptions<TOptions>>)((IServiceProvider sp) => new ValidateOptions<TOptions, TDep1, TDep2>(Name, ServiceProviderServiceExtensions.GetRequiredService<TDep1>(sp), ServiceProviderServiceExtensions.GetRequiredService<TDep2>(sp), validation2, failureMessage2)));
			return this;
		}

		public virtual OptionsBuilder<TOptions> Validate<TDep1, TDep2, TDep3>(Func<TOptions, TDep1, TDep2, TDep3, bool> validation) where TDep1 : notnull where TDep2 : notnull where TDep3 : notnull
		{
			return Validate(validation, "A validation error has occurred.");
		}

		public virtual OptionsBuilder<TOptions> Validate<TDep1, TDep2, TDep3>(Func<TOptions, TDep1, TDep2, TDep3, bool> validation, string failureMessage) where TDep1 : notnull where TDep2 : notnull where TDep3 : notnull
		{
			Func<TOptions, TDep1, TDep2, TDep3, bool> validation2 = validation;
			string failureMessage2 = failureMessage;
			System.ThrowHelper.ThrowIfNull(validation2, "validation");
			ServiceCollectionServiceExtensions.AddTransient<IValidateOptions<TOptions>>(Services, (Func<IServiceProvider, IValidateOptions<TOptions>>)((IServiceProvider sp) => new ValidateOptions<TOptions, TDep1, TDep2, TDep3>(Name, ServiceProviderServiceExtensions.GetRequiredService<TDep1>(sp), ServiceProviderServiceExtensions.GetRequiredService<TDep2>(sp), ServiceProviderServiceExtensions.GetRequiredService<TDep3>(sp), validation2, failureMessage2)));
			return this;
		}

		public virtual OptionsBuilder<TOptions> Validate<TDep1, TDep2, TDep3, TDep4>(Func<TOptions, TDep1, TDep2, TDep3, TDep4, bool> validation) where TDep1 : notnull where TDep2 : notnull where TDep3 : notnull where TDep4 : notnull
		{
			return Validate(validation, "A validation error has occurred.");
		}

		public virtual OptionsBuilder<TOptions> Validate<TDep1, TDep2, TDep3, TDep4>(Func<TOptions, TDep1, TDep2, TDep3, TDep4, bool> validation, string failureMessage) where TDep1 : notnull where TDep2 : notnull where TDep3 : notnull where TDep4 : notnull
		{
			Func<TOptions, TDep1, TDep2, TDep3, TDep4, bool> validation2 = validation;
			string failureMessage2 = failureMessage;
			System.ThrowHelper.ThrowIfNull(validation2, "validation");
			ServiceCollectionServiceExtensions.AddTransient<IValidateOptions<TOptions>>(Services, (Func<IServiceProvider, IValidateOptions<TOptions>>)((IServiceProvider sp) => new ValidateOptions<TOptions, TDep1, TDep2, TDep3, TDep4>(Name, ServiceProviderServiceExtensions.GetRequiredService<TDep1>(sp), ServiceProviderServiceExtensions.GetRequiredService<TDep2>(sp), ServiceProviderServiceExtensions.GetRequiredService<TDep3>(sp), ServiceProviderServiceExtensions.GetRequiredService<TDep4>(sp), validation2, failureMessage2)));
			return this;
		}

		public virtual OptionsBuilder<TOptions> Validate<TDep1, TDep2, TDep3, TDep4, TDep5>(Func<TOptions, TDep1, TDep2, TDep3, TDep4, TDep5, bool> validation) where TDep1 : notnull where TDep2 : notnull where TDep3 : notnull where TDep4 : notnull where TDep5 : notnull
		{
			return Validate(validation, "A validation error has occurred.");
		}

		public virtual OptionsBuilder<TOptions> Validate<TDep1, TDep2, TDep3, TDep4, TDep5>(Func<TOptions, TDep1, TDep2, TDep3, TDep4, TDep5, bool> validation, string failureMessage) where TDep1 : notnull where TDep2 : notnull where TDep3 : notnull where TDep4 : notnull where TDep5 : notnull
		{
			Func<TOptions, TDep1, TDep2, TDep3, TDep4, TDep5, bool> validation2 = validation;
			string failureMessage2 = failureMessage;
			System.ThrowHelper.ThrowIfNull(validation2, "validation");
			ServiceCollectionServiceExtensions.AddTransient<IValidateOptions<TOptions>>(Services, (Func<IServiceProvider, IValidateOptions<TOptions>>)((IServiceProvider sp) => new ValidateOptions<TOptions, TDep1, TDep2, TDep3, TDep4, TDep5>(Name, ServiceProviderServiceExtensions.GetRequiredService<TDep1>(sp), ServiceProviderServiceExtensions.GetRequiredService<TDep2>(sp), ServiceProviderServiceExtensions.GetRequiredService<TDep3>(sp), ServiceProviderServiceExtensions.GetRequiredService<TDep4>(sp), ServiceProviderServiceExtensions.GetRequiredService<TDep5>(sp), validation2, failureMessage2)));
			return this;
		}
	}
	public class OptionsCache<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] TOptions> : IOptionsMonitorCache<TOptions> where TOptions : class
	{
		private readonly ConcurrentDictionary<string, Lazy<TOptions>> _cache = new ConcurrentDictionary<string, Lazy<TOptions>>(1, 31, StringComparer.Ordinal);

		public void Clear()
		{
			_cache.Clear();
		}

		public virtual TOptions GetOrAdd(string? name, Func<TOptions> createOptions)
		{
			System.ThrowHelper.ThrowIfNull(createOptions, "createOptions");
			if (name == null)
			{
				name = Options.DefaultName;
			}
			if (!_cache.TryGetValue(name, out var value))
			{
				value = _cache.GetOrAdd(name, new Lazy<TOptions>(createOptions));
			}
			return value.Value;
		}

		internal TOptions GetOrAdd<TArg>(string? name, Func<string, TArg, TOptions> createOptions, TArg factoryArgument)
		{
			string localName = name;
			Func<string, TArg, TOptions> localCreateOptions = createOptions;
			TArg localFactoryArgument = factoryArgument;
			return GetOrAdd(name, () => localCreateOptions(localName ?? Options.DefaultName, localFactoryArgument));
		}

		internal bool TryGetValue(string? name, [MaybeNullWhen(false)] out TOptions options)
		{
			if (_cache.TryGetValue(name ?? Options.DefaultName, out var value))
			{
				options = value.Value;
				return true;
			}
			options = null;
			return false;
		}

		public virtual bool TryAdd(string? name, TOptions options)
		{
			TOptions options2 = options;
			System.ThrowHelper.ThrowIfNull(options2, "options");
			return _cache.TryAdd(name ?? Options.DefaultName, new Lazy<TOptions>(() => options2));
		}

		public virtual bool TryRemove(string? name)
		{
			Lazy<TOptions> value;
			return _cache.TryRemove(name ?? Options.DefaultName, out value);
		}
	}
	public class OptionsFactory<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] TOptions> : IOptionsFactory<TOptions> where TOptions : class
	{
		private readonly IConfigureOptions<TOptions>[] _setups;

		private readonly IPostConfigureOptions<TOptions>[] _postConfigures;

		private readonly IValidateOptions<TOptions>[] _validations;

		public OptionsFactory(IEnumerable<IConfigureOptions<TOptions>> setups, IEnumerable<IPostConfigureOptions<TOptions>> postConfigures)
			: this(setups, postConfigures, (IEnumerable<IValidateOptions<TOptions>>)Array.Empty<IValidateOptions<TOptions>>())
		{
		}

		public OptionsFactory(IEnumerable<IConfigureOptions<TOptions>> setups, IEnumerable<IPostConfigureOptions<TOptions>> postConfigures, IEnumerable<IValidateOptions<TOptions>> validations)
		{
			_setups = (setups as IConfigureOptions<TOptions>[]) ?? new List<IConfigureOptions<TOptions>>(setups).ToArray();
			_postConfigures = (postConfigures as IPostConfigureOptions<TOptions>[]) ?? new List<IPostConfigureOptions<TOptions>>(postConfigures).ToArray();
			_validations = (validations as IValidateOptions<TOptions>[]) ?? new List<IValidateOptions<TOptions>>(validations).ToArray();
		}

		public TOptions Create(string name)
		{
			TOptions val = CreateInstance(name);
			IConfigureOptions<TOptions>[] setups = _setups;
			foreach (IConfigureOptions<TOptions> configureOptions in setups)
			{
				if (configureOptions is IConfigureNamedOptions<TOptions> configureNamedOptions)
				{
					configureNamedOptions.Configure(name, val);
				}
				else if (name == Options.DefaultName)
				{
					configureOptions.Configure(val);
				}
			}
			IPostConfigureOptions<TOptions>[] postConfigures = _postConfigures;
			foreach (IPostConfigureOptions<TOptions> postConfigureOptions in postConfigures)
			{
				postConfigureOptions.PostConfigure(name, val);
			}
			if (_validations.Length != 0)
			{
				List<string> list = new List<string>();
				IValidateOptions<TOptions>[] validations = _validations;
				foreach (IValidateOptions<TOptions> validateOptions in validations)
				{
					ValidateOptionsResult validateOptionsResult = validateOptions.Validate(name, val);
					if (validateOptionsResult != null && validateOptionsResult.Failed)
					{
						list.AddRange(validateOptionsResult.Failures);
					}
				}
				if (list.Count > 0)
				{
					throw new OptionsValidationException(name, typeof(TOptions), list);
				}
			}
			return val;
		}

		protected virtual TOptions CreateInstance(string name)
		{
			return Activator.CreateInstance<TOptions>();
		}
	}
	public class OptionsManager<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] TOptions> : IOptions<TOptions>, IOptionsSnapshot<TOptions> where TOptions : class
	{
		private readonly IOptionsFactory<TOptions> _factory;

		private readonly OptionsCache<TOptions> _cache = new OptionsCache<TOptions>();

		public TOptions Value => Get(Options.DefaultName);

		public OptionsManager(IOptionsFactory<TOptions> factory)
		{
			_factory = factory;
		}

		public virtual TOptions Get(string? name)
		{
			if (name == null)
			{
				name = Options.DefaultName;
			}
			if (!_cache.TryGetValue(name, out var options))
			{
				IOptionsFactory<TOptions> localFactory = _factory;
				string localName = name;
				return _cache.GetOrAdd(name, () => localFactory.Create(localName));
			}
			return options;
		}
	}
	public class OptionsMonitor<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] TOptions> : IOptionsMonitor<TOptions>, IDisposable where TOptions : class
	{
		internal sealed class ChangeTrackerDisposable : IDisposable
		{
			private readonly Action<TOptions, string> _listener;

			private readonly OptionsMonitor<TOptions> _monitor;

			public ChangeTrackerDisposable(OptionsMonitor<TOptions> monitor, Action<TOptions, string> listener)
			{
				_listener = listener;
				_monitor = monitor;
			}

			public void OnChange(TOptions options, string name)
			{
				_listener(options, name);
			}

			public void Dispose()
			{
				_monitor._onChange -= OnChange;
			}
		}

		private readonly IOptionsMonitorCache<TOptions> _cache;

		private readonly IOptionsFactory<TOptions> _factory;

		private readonly List<IDisposable> _registrations = new List<IDisposable>();

		public TOptions CurrentValue => Get(Options.DefaultName);

		internal event Action<TOptions, string>? _onChange;

		public OptionsMonitor(IOptionsFactory<TOptions> factory, IEnumerable<IOptionsChangeTokenSource<TOptions>> sources, IOptionsMonitorCache<TOptions> cache)
		{
			_factory = factory;
			_cache = cache;
			if (sources is IOptionsChangeTokenSource<TOptions>[] array)
			{
				IOptionsChangeTokenSource<TOptions>[] array2 = array;
				foreach (IOptionsChangeTokenSource<TOptions> source2 in array2)
				{
					RegisterSource(source2);
					void RegisterSource(IOptionsChangeTokenSource<TOptions> source)
					{
						IDisposable item = ChangeToken.OnChange<string>((Func<IChangeToken>)source.GetChangeToken, (Action<string>)InvokeChanged, source.Name);
						_registrations.Add(item);
					}
				}
				return;
			}
			foreach (IOptionsChangeTokenSource<TOptions> source3 in sources)
			{
				RegisterSource(source3);
			}
		}

		private void InvokeChanged(string name)
		{
			if (name == null)
			{
				name = Options.DefaultName;
			}
			_cache.TryRemove(name);
			TOptions arg = Get(name);
			this._onChange?.Invoke(arg, name);
		}

		public virtual TOptions Get(string? name)
		{
			if (!(_cache is OptionsCache<TOptions> optionsCache))
			{
				string localName = name ?? Options.DefaultName;
				IOptionsFactory<TOptions> localFactory = _factory;
				return _cache.GetOrAdd(localName, () => localFactory.Create(localName));
			}
			return optionsCache.GetOrAdd(name, (string name, IOptionsFactory<TOptions> factory) => factory.Create(name), _factory);
		}

		public IDisposable OnChange(Action<TOptions, string> listener)
		{
			ChangeTrackerDisposable changeTrackerDisposable = new ChangeTrackerDisposable(this, listener);
			_onChange += changeTrackerDisposable.OnChange;
			return changeTrackerDisposable;
		}

		public void Dispose()
		{
			foreach (IDisposable registration in _registrations)
			{
				registration.Dispose();
			}
			_registrations.Clear();
		}
	}
	public static class OptionsMonitorExtensions
	{
		public static IDisposable? OnChange<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] TOptions>(this IOptionsMonitor<TOptions> monitor, Action<TOptions> listener)
		{
			Action<TOptions> listener2 = listener;
			return monitor.OnChange(delegate(TOptions o, string _)
			{
				listener2(o);
			});
		}
	}
	public class OptionsValidationException : Exception
	{
		public string OptionsName { get; }

		public Type OptionsType { get; }

		public IEnumerable<string> Failures { get; }

		public override string Message => string.Join("; ", Failures);

		public OptionsValidationException(string optionsName, Type optionsType, IEnumerable<string>? failureMessages)
		{
			System.ThrowHelper.ThrowIfNull(optionsName, "optionsName");
			System.ThrowHelper.ThrowIfNull(optionsType, "optionsType");
			Failures = failureMessages ?? new List<string>();
			OptionsType = optionsType;
			OptionsName = optionsName;
		}
	}
	public class OptionsWrapper<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] TOptions> : IOptions<TOptions> where TOptions : class
	{
		public TOptions Value { get; }

		public OptionsWrapper(TOptions options)
		{
			Value = options;
		}
	}
	public class PostConfigureOptions<TOptions> : IPostConfigureOptions<TOptions> where TOptions : class
	{
		public string? Name { get; }

		public Action<TOptions>? Action { get; }

		public PostConfigureOptions(string? name, Action<TOptions>? action)
		{
			Name = name;
			Action = action;
		}

		public virtual void PostConfigure(string? name, TOptions options)
		{
			System.ThrowHelper.ThrowIfNull(options, "options");
			if (Name == null || name == Name)
			{
				Action?.Invoke(options);
			}
		}
	}
	public class PostConfigureOptions<TOptions, TDep> : IPostConfigureOptions<TOptions> where TOptions : class where TDep : class
	{
		public string? Name { get; }

		public Action<TOptions, TDep>? Action { get; }

		public TDep Dependency { get; }

		public PostConfigureOptions(string? name, TDep dependency, Action<TOptions, TDep>? action)
		{
			Name = name;
			Action = action;
			Dependency = dependency;
		}

		public virtual void PostConfigure(string? name, TOptions options)
		{
			System.ThrowHelper.ThrowIfNull(options, "options");
			if (Name == null || name == Name)
			{
				Action?.Invoke(options, Dependency);
			}
		}

		public void PostConfigure(TOptions options)
		{
			PostConfigure(Options.DefaultName, options);
		}
	}
	public class PostConfigureOptions<TOptions, TDep1, TDep2> : IPostConfigureOptions<TOptions> where TOptions : class where TDep1 : class where TDep2 : class
	{
		public string? Name { get; }

		public Action<TOptions, TDep1, TDep2>? Action { get; }

		public TDep1 Dependency1 { get; }

		public TDep2 Dependency2 { get; }

		public PostConfigureOptions(string? name, TDep1 dependency, TDep2 dependency2, Action<TOptions, TDep1, TDep2>? action)
		{
			Name = name;
			Action = action;
			Dependency1 = dependency;
			Dependency2 = dependency2;
		}

		public virtual void PostConfigure(string? name, TOptions options)
		{
			System.ThrowHelper.ThrowIfNull(options, "options");
			if (Name == null || name == Name)
			{
				Action?.Invoke(options, Dependency1, Dependency2);
			}
		}

		public void PostConfigure(TOptions options)
		{
			PostConfigure(Options.DefaultName, options);
		}
	}
	public class PostConfigureOptions<TOptions, TDep1, TDep2, TDep3> : IPostConfigureOptions<TOptions> where TOptions : class where TDep1 : class where TDep2 : class where TDep3 : class
	{
		public string? Name { get; }

		public Action<TOptions, TDep1, TDep2, TDep3>? Action { get; }

		public TDep1 Dependency1 { get; }

		public TDep2 Dependency2 { get; }

		public TDep3 Dependency3 { get; }

		public PostConfigureOptions(string? name, TDep1 dependency, TDep2 dependency2, TDep3 dependency3, Action<TOptions, TDep1, TDep2, TDep3>? action)
		{
			Name = name;
			Action = action;
			Dependency1 = dependency;
			Dependency2 = dependency2;
			Dependency3 = dependency3;
		}

		public virtual void PostConfigure(string? name, TOptions options)
		{
			System.ThrowHelper.ThrowIfNull(options, "options");
			if (Name == null || name == Name)
			{
				Action?.Invoke(options, Dependency1, Dependency2, Dependency3);
			}
		}

		public void PostConfigure(TOptions options)
		{
			PostConfigure(Options.DefaultName, options);
		}
	}
	public class PostConfigureOptions<TOptions, TDep1, TDep2, TDep3, TDep4> : IPostConfigureOptions<TOptions> where TOptions : class where TDep1 : class where TDep2 : class where TDep3 : class where TDep4 : class
	{
		public string? Name { get; }

		public Action<TOptions, TDep1, TDep2, TDep3, TDep4>? Action { get; }

		public TDep1 Dependency1 { get; }

		public TDep2 Dependency2 { get; }

		public TDep3 Dependency3 { get; }

		public TDep4 Dependency4 { get; }

		public PostConfigureOptions(string? name, TDep1 dependency1, TDep2 dependency2, TDep3 dependency3, TDep4 dependency4, Action<TOptions, TDep1, TDep2, TDep3, TDep4>? action)
		{
			Name = name;
			Action = action;
			Dependency1 = dependency1;
			Dependency2 = dependency2;
			Dependency3 = dependency3;
			Dependency4 = dependency4;
		}

		public virtual void PostConfigure(string? name, TOptions options)
		{
			System.ThrowHelper.ThrowIfNull(options, "options");
			if (Name == null || name == Name)
			{
				Action?.Invoke(options, Dependency1, Dependency2, Dependency3, Dependency4);
			}
		}

		public void PostConfigure(TOptions options)
		{
			PostConfigure(Options.DefaultName, options);
		}
	}
	public class PostConfigureOptions<TOptions, TDep1, TDep2, TDep3, TDep4, TDep5> : IPostConfigureOptions<TOptions> where TOptions : class where TDep1 : class where TDep2 : class where TDep3 : class where TDep4 : class where TDep5 : class
	{
		public string? Name { get; }

		public Action<TOptions, TDep1, TDep2, TDep3, TDep4, TDep5>? Action { get; }

		public TDep1 Dependency1 { get; }

		public TDep2 Dependency2 { get; }

		public TDep3 Dependency3 { get; }

		public TDep4 Dependency4 { get; }

		public TDep5 Dependency5 { get; }

		public PostConfigureOptions(string? name, TDep1 dependency1, TDep2 dependency2, TDep3 dependency3, TDep4 dependency4, TDep5 dependency5, Action<TOptions, TDep1, TDep2, TDep3, TDep4, TDep5>? action)
		{
			Name = name;
			Action = action;
			Dependency1 = dependency1;
			Dependency2 = dependency2;
			Dependency3 = dependency3;
			Dependency4 = dependency4;
			Dependency5 = dependency5;
		}

		public virtual void PostConfigure(string? name, TOptions options)
		{
			System.ThrowHelper.ThrowIfNull(options, "options");
			if (Name == null || name == Name)
			{
				Action?.Invoke(options, Dependency1, Dependency2, Dependency3, Dependency4, Dependency5);
			}
		}

		public void PostConfigure(TOptions options)
		{
			PostConfigure(Options.DefaultName, options);
		}
	}
	internal sealed class UnnamedOptionsManager<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] TOptions> : IOptions<TOptions> where TOptions : class
	{
		private readonly IOptionsFactory<TOptions> _factory;

		private volatile object _syncObj;

		private volatile TOptions _value;

		public TOptions Value
		{
			get
			{
				TOptions value = _value;
				if (value != null)
				{
					return value;
				}
				lock (_syncObj ?? Interlocked.CompareExchange(ref _syncObj, new object(), null) ?? _syncObj)
				{
					return _value ?? (_value = _factory.Create(Options.DefaultName));
				}
			}
		}

		public UnnamedOptionsManager(IOptionsFactory<TOptions> factory)
		{
			_factory = factory;
		}
	}
	public class ValidateOptions<TOptions> : IValidateOptions<TOptions> where TOptions : class
	{
		public string? Name { get; }

		public Func<TOptions, bool> Validation { get; }

		public string FailureMessage { get; }

		public ValidateOptions(string? name, Func<TOptions, bool> validation, string failureMessage)
		{
			System.ThrowHelper.ThrowIfNull(validation, "validation");
			Name = name;
			Validation = validation;
			FailureMessage = failureMessage;
		}

		public ValidateOptionsResult Validate(string? name, TOptions options)
		{
			if (Name == null || name == Name)
			{
				if (Validation(options))
				{
					return ValidateOptionsResult.Success;
				}
				return ValidateOptionsResult.Fail(FailureMessage);
			}
			return ValidateOptionsResult.Skip;
		}
	}
	public class ValidateOptions<TOptions, TDep> : IValidateOptions<TOptions> where TOptions : class
	{
		public string? Name { get; }

		public Func<TOptions, TDep, bool> Validation { get; }

		public string FailureMessage { get; }

		public TDep Dependency { get; }

		public ValidateOptions(string? name, TDep dependency, Func<TOptions, TDep, bool> validation, string failureMessage)
		{
			System.ThrowHelper.ThrowIfNull(validation, "validation");
			Name = name;
			Validation = validation;
			FailureMessage = failureMessage;
			Dependency = dependency;
		}

		public ValidateOptionsResult Validate(string? name, TOptions options)
		{
			if (Name == null || name == Name)
			{
				if (Validation(options, Dependency))
				{
					return ValidateOptionsResult.Success;
				}
				return ValidateOptionsResult.Fail(FailureMessage);
			}
			return ValidateOptionsResult.Skip;
		}
	}
	public class ValidateOptions<TOptions, TDep1, TDep2> : IValidateOptions<TOptions> where TOptions : class
	{
		public string? Name { get; }

		public Func<TOptions, TDep1, TDep2, bool> Validation { get; }

		public string FailureMessage { get; }

		public TDep1 Dependency1 { get; }

		public TDep2 Dependency2 { get; }

		public ValidateOptions(string? name, TDep1 dependency1, TDep2 dependency2, Func<TOptions, TDep1, TDep2, bool> validation, string failureMessage)
		{
			System.ThrowHelper.ThrowIfNull(validation, "validation");
			Name = name;
			Validation = validation;
			FailureMessage = failureMessage;
			Dependency1 = dependency1;
			Dependency2 = dependency2;
		}

		public ValidateOptionsResult Validate(string? name, TOptions options)
		{
			if (Name == null || name == Name)
			{
				if (Validation(options, Dependency1, Dependency2))
				{
					return ValidateOptionsResult.Success;
				}
				return ValidateOptionsResult.Fail(FailureMessage);
			}
			return ValidateOptionsResult.Skip;
		}
	}
	public class ValidateOptions<TOptions, TDep1, TDep2, TDep3> : IValidateOptions<TOptions> where TOptions : class
	{
		public string? Name { get; }

		public Func<TOptions, TDep1, TDep2, TDep3, bool> Validation { get; }

		public string FailureMessage { get; }

		public TDep1 Dependency1 { get; }

		public TDep2 Dependency2 { get; }

		public TDep3 Dependency3 { get; }

		public ValidateOptions(string? name, TDep1 dependency1, TDep2 dependency2, TDep3 dependency3, Func<TOptions, TDep1, TDep2, TDep3, bool> validation, string failureMessage)
		{
			System.ThrowHelper.ThrowIfNull(validation, "validation");
			Name = name;
			Validation = validation;
			FailureMessage = failureMessage;
			Dependency1 = dependency1;
			Dependency2 = dependency2;
			Dependency3 = dependency3;
		}

		public ValidateOptionsResult Validate(string? name, TOptions options)
		{
			if (Name == null || name == Name)
			{
				if (Validation(options, Dependency1, Dependency2, Dependency3))
				{
					return ValidateOptionsResult.Success;
				}
				return ValidateOptionsResult.Fail(FailureMessage);
			}
			return ValidateOptionsResult.Skip;
		}
	}
	public class ValidateOptions<TOptions, TDep1, TDep2, TDep3, TDep4> : IValidateOptions<TOptions> where TOptions : class
	{
		public string? Name { get; }

		public Func<TOptions, TDep1, TDep2, TDep3, TDep4, bool> Validation { get; }

		public string FailureMessage { get; }

		public TDep1 Dependency1 { get; }

		public TDep2 Dependency2 { get; }

		public TDep3 Dependency3 { get; }

		public TDep4 Dependency4 { get; }

		public ValidateOptions(string? name, TDep1 dependency1, TDep2 dependency2, TDep3 dependency3, TDep4 dependency4, Func<TOptions, TDep1, TDep2, TDep3, TDep4, bool> validation, string failureMessage)
		{
			System.ThrowHelper.ThrowIfNull(validation, "validation");
			Name = name;
			Validation = validation;
			FailureMessage = failureMessage;
			Dependency1 = dependency1;
			Dependency2 = dependency2;
			Dependency3 = dependency3;
			Dependency4 = dependency4;
		}

		public ValidateOptionsResult Validate(string? name, TOptions options)
		{
			if (Name == null || name == Name)
			{
				if (Validation(options, Dependency1, Dependency2, Dependency3, Dependency4))
				{
					return ValidateOptionsResult.Success;
				}
				return ValidateOptionsResult.Fail(FailureMessage);
			}
			return ValidateOptionsResult.Skip;
		}
	}
	public class ValidateOptions<TOptions, TDep1, TDep2, TDep3, TDep4, TDep5> : IValidateOptions<TOptions> where TOptions : class
	{
		public string? Name { get; }

		public Func<TOptions, TDep1, TDep2, TDep3, TDep4, TDep5, bool> Validation { get; }

		public string FailureMessage { get; }

		public TDep1 Dependency1 { get; }

		public TDep2 Dependency2 { get; }

		public TDep3 Dependency3 { get; }

		public TDep4 Dependency4 { get; }

		public TDep5 Dependency5 { get; }

		public ValidateOptions(string? name, TDep1 dependency1, TDep2 dependency2, TDep3 dependency3, TDep4 dependency4, TDep5 dependency5, Func<TOptions, TDep1, TDep2, TDep3, TDep4, TDep5, bool> validation, string failureMessage)
		{
			System.ThrowHelper.ThrowIfNull(validation, "validation");
			Name = name;
			Validation = validation;
			FailureMessage = failureMessage;
			Dependency1 = dependency1;
			Dependency2 = dependency2;
			Dependency3 = dependency3;
			Dependency4 = dependency4;
			Dependency5 = dependency5;
		}

		public ValidateOptionsResult Validate(string? name, TOptions options)
		{
			if (Name == null || name == Name)
			{
				if (Validation(options, Dependency1, Dependency2, Dependency3, Dependency4, Dependency5))
				{
					return ValidateOptionsResult.Success;
				}
				return ValidateOptionsResult.Fail(FailureMessage);
			}
			return ValidateOptionsResult.Skip;
		}
	}
	public class ValidateOptionsResult
	{
		public static readonly ValidateOptionsResult Skip = new ValidateOptionsResult
		{
			Skipped = true
		};

		public static readonly ValidateOptionsResult Success = new ValidateOptionsResult
		{
			Succeeded = true
		};

		public bool Succeeded { get; protected set; }

		public bool Skipped { get; protected set; }

		[MemberNotNullWhen(true, "Failures")]
		[MemberNotNullWhen(true, "FailureMessage")]
		public bool Failed
		{
			[MemberNotNullWhen(true, "Failures")]
			[MemberNotNullWhen(true, "FailureMessage")]
			get;
			[MemberNotNullWhen(true, "Failures")]
			[MemberNotNullWhen(true, "FailureMessage")]
			protected set;
		}

		public string? FailureMessage { get; protected set; }

		public IEnumerable<string>? Failures { get; protected set; }

		public static ValidateOptionsResult Fail(string failureMessage)
		{
			ValidateOptionsResult validateOptionsResult = new ValidateOptionsResult();
			validateOptionsResult.Failed = true;
			validateOptionsResult.FailureMessage = failureMessage;
			validateOptionsResult.Failures = new string[1] { failureMessage };
			return validateOptionsResult;
		}

		public static ValidateOptionsResult Fail(IEnumerable<string> failures)
		{
			return new ValidateOptionsResult
			{
				Failed = true,
				FailureMessage = string.Join("; ", failures),
				Failures = failures
			};
		}
	}
}

BepInEx/plugins/SlopCrew.Plugin/Microsoft.Extensions.Primitives.dll

Decompiled 8 months ago
using System;
using System.Buffers;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Numerics.Hashing;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Threading;
using FxResources.Microsoft.Extensions.Primitives;
using Microsoft.CodeAnalysis;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: AssemblyMetadata(".NETFrameworkAssembly", "")]
[assembly: AssemblyMetadata("Serviceable", "True")]
[assembly: AssemblyMetadata("PreferInbox", "True")]
[assembly: AssemblyDefaultAlias("Microsoft.Extensions.Primitives")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: CLSCompliant(true)]
[assembly: AssemblyMetadata("IsTrimmable", "True")]
[assembly: DefaultDllImportSearchPaths(DllImportSearchPath.System32 | DllImportSearchPath.AssemblyDirectory)]
[assembly: AssemblyCompany("Microsoft Corporation")]
[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")]
[assembly: AssemblyDescription("Primitives shared by framework extensions. Commonly used types include:\r\n\r\nCommonly Used Types:\r\nMicrosoft.Extensions.Primitives.IChangeToken\r\nMicrosoft.Extensions.Primitives.StringValues\r\nMicrosoft.Extensions.Primitives.StringSegment")]
[assembly: AssemblyFileVersion("7.0.22.51805")]
[assembly: AssemblyInformationalVersion("7.0.0+d099f075e45d2aa6007a22b71b45a08758559f80")]
[assembly: AssemblyProduct("Microsoft® .NET")]
[assembly: AssemblyTitle("Microsoft.Extensions.Primitives")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/dotnet/runtime")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("7.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: System.Runtime.CompilerServices.NullablePublicOnly(false)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class IsReadOnlyAttribute : Attribute
	{
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class IsByRefLikeAttribute : Attribute
	{
	}
	[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 NullablePublicOnlyAttribute : Attribute
	{
		public readonly bool IncludesInternals;

		public NullablePublicOnlyAttribute(bool P_0)
		{
			IncludesInternals = 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 FxResources.Microsoft.Extensions.Primitives
{
	internal static class SR
	{
	}
}
namespace System
{
	internal static class SR
	{
		private static readonly bool s_usingResourceKeys = AppContext.TryGetSwitch("System.Resources.UseSystemResourceKeys", out var isEnabled) && isEnabled;

		private static ResourceManager s_resourceManager;

		internal static ResourceManager ResourceManager => s_resourceManager ?? (s_resourceManager = new ResourceManager(typeof(SR)));

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

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

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

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

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

		private static bool UsingResourceKeys()
		{
			return s_usingResourceKeys;
		}

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

		internal static string GetResourceString(string resourceKey, string defaultString)
		{
			string resourceString = GetResourceString(resourceKey);
			if (!(resourceKey == resourceString) && resourceString != null)
			{
				return resourceString;
			}
			return defaultString;
		}

		internal static string Format(string resourceFormat, object p1)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1);
			}
			return string.Format(resourceFormat, p1);
		}

		internal static string Format(string resourceFormat, object p1, object p2)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2);
			}
			return string.Format(resourceFormat, p1, p2);
		}

		internal static string Format(string resourceFormat, object p1, object p2, object p3)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2, p3);
			}
			return string.Format(resourceFormat, p1, p2, p3);
		}

		internal static string Format(string resourceFormat, params object[] args)
		{
			if (args != null)
			{
				if (UsingResourceKeys())
				{
					return resourceFormat + ", " + string.Join(", ", args);
				}
				return string.Format(resourceFormat, args);
			}
			return resourceFormat;
		}

		internal static string Format(IFormatProvider provider, string resourceFormat, object p1)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1);
			}
			return string.Format(provider, resourceFormat, p1);
		}

		internal static string Format(IFormatProvider provider, string resourceFormat, object p1, object p2)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2);
			}
			return string.Format(provider, resourceFormat, p1, p2);
		}

		internal static string Format(IFormatProvider provider, string resourceFormat, object p1, object p2, object p3)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2, p3);
			}
			return string.Format(provider, resourceFormat, p1, p2, p3);
		}

		internal static string Format(IFormatProvider provider, string resourceFormat, params object[] args)
		{
			if (args != null)
			{
				if (UsingResourceKeys())
				{
					return resourceFormat + ", " + string.Join(", ", args);
				}
				return string.Format(provider, resourceFormat, args);
			}
			return resourceFormat;
		}
	}
}
namespace System.Diagnostics.CodeAnalysis
{
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)]
	internal sealed class AllowNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)]
	internal sealed class DisallowNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)]
	internal sealed class MaybeNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)]
	internal sealed class NotNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class MaybeNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public MaybeNullWhenAttribute(bool returnValue)
		{
			ReturnValue = returnValue;
		}
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class NotNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public NotNullWhenAttribute(bool returnValue)
		{
			ReturnValue = returnValue;
		}
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = true, Inherited = false)]
	internal sealed class NotNullIfNotNullAttribute : Attribute
	{
		public string ParameterName { get; }

		public NotNullIfNotNullAttribute(string parameterName)
		{
			ParameterName = parameterName;
		}
	}
	[AttributeUsage(AttributeTargets.Method, Inherited = false)]
	internal sealed class DoesNotReturnAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class DoesNotReturnIfAttribute : Attribute
	{
		public bool ParameterValue { get; }

		public DoesNotReturnIfAttribute(bool parameterValue)
		{
			ParameterValue = parameterValue;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	internal sealed class MemberNotNullAttribute : Attribute
	{
		public string[] Members { get; }

		public MemberNotNullAttribute(string member)
		{
			Members = new string[1] { member };
		}

		public MemberNotNullAttribute(params string[] members)
		{
			Members = members;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	internal sealed class MemberNotNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public string[] Members { get; }

		public MemberNotNullWhenAttribute(bool returnValue, string member)
		{
			ReturnValue = returnValue;
			Members = new string[1] { member };
		}

		public MemberNotNullWhenAttribute(bool returnValue, params string[] members)
		{
			ReturnValue = returnValue;
			Members = members;
		}
	}
}
namespace System.Runtime.InteropServices
{
	[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
	internal sealed class LibraryImportAttribute : Attribute
	{
		public string LibraryName { get; }

		public string EntryPoint { get; set; }

		public StringMarshalling StringMarshalling { get; set; }

		public Type StringMarshallingCustomType { get; set; }

		public bool SetLastError { get; set; }

		public LibraryImportAttribute(string libraryName)
		{
			LibraryName = libraryName;
		}
	}
	internal enum StringMarshalling
	{
		Custom,
		Utf8,
		Utf16
	}
}
namespace System.Text
{
	internal ref struct ValueStringBuilder
	{
		private char[] _arrayToReturnToPool;

		private Span<char> _chars;

		private int _pos;

		public int Length
		{
			get
			{
				return _pos;
			}
			set
			{
				_pos = value;
			}
		}

		public int Capacity => _chars.Length;

		public ref char this[int index] => ref _chars[index];

		public Span<char> RawChars => _chars;

		public ValueStringBuilder(Span<char> initialBuffer)
		{
			_arrayToReturnToPool = null;
			_chars = initialBuffer;
			_pos = 0;
		}

		public ValueStringBuilder(int initialCapacity)
		{
			_arrayToReturnToPool = ArrayPool<char>.Shared.Rent(initialCapacity);
			_chars = _arrayToReturnToPool;
			_pos = 0;
		}

		public void EnsureCapacity(int capacity)
		{
			if ((uint)capacity > (uint)_chars.Length)
			{
				Grow(capacity - _pos);
			}
		}

		public ref char GetPinnableReference()
		{
			return ref MemoryMarshal.GetReference(_chars);
		}

		public ref char GetPinnableReference(bool terminate)
		{
			if (terminate)
			{
				EnsureCapacity(Length + 1);
				_chars[Length] = '\0';
			}
			return ref MemoryMarshal.GetReference(_chars);
		}

		public override string ToString()
		{
			string result = _chars.Slice(0, _pos).ToString();
			Dispose();
			return result;
		}

		public ReadOnlySpan<char> AsSpan(bool terminate)
		{
			if (terminate)
			{
				EnsureCapacity(Length + 1);
				_chars[Length] = '\0';
			}
			return _chars.Slice(0, _pos);
		}

		public ReadOnlySpan<char> AsSpan()
		{
			return _chars.Slice(0, _pos);
		}

		public ReadOnlySpan<char> AsSpan(int start)
		{
			return _chars.Slice(start, _pos - start);
		}

		public ReadOnlySpan<char> AsSpan(int start, int length)
		{
			return _chars.Slice(start, length);
		}

		public bool TryCopyTo(Span<char> destination, out int charsWritten)
		{
			if (_chars.Slice(0, _pos).TryCopyTo(destination))
			{
				charsWritten = _pos;
				Dispose();
				return true;
			}
			charsWritten = 0;
			Dispose();
			return false;
		}

		public void Insert(int index, char value, int count)
		{
			if (_pos > _chars.Length - count)
			{
				Grow(count);
			}
			int length = _pos - index;
			_chars.Slice(index, length).CopyTo(_chars.Slice(index + count));
			_chars.Slice(index, count).Fill(value);
			_pos += count;
		}

		public void Insert(int index, string s)
		{
			if (s != null)
			{
				int length = s.Length;
				if (_pos > _chars.Length - length)
				{
					Grow(length);
				}
				int length2 = _pos - index;
				_chars.Slice(index, length2).CopyTo(_chars.Slice(index + length));
				s.AsSpan().CopyTo(_chars.Slice(index));
				_pos += length;
			}
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public void Append(char c)
		{
			int pos = _pos;
			if ((uint)pos < (uint)_chars.Length)
			{
				_chars[pos] = c;
				_pos = pos + 1;
			}
			else
			{
				GrowAndAppend(c);
			}
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public void Append(string s)
		{
			if (s != null)
			{
				int pos = _pos;
				if (s.Length == 1 && (uint)pos < (uint)_chars.Length)
				{
					_chars[pos] = s[0];
					_pos = pos + 1;
				}
				else
				{
					AppendSlow(s);
				}
			}
		}

		private void AppendSlow(string s)
		{
			int pos = _pos;
			if (pos > _chars.Length - s.Length)
			{
				Grow(s.Length);
			}
			s.AsSpan().CopyTo(_chars.Slice(pos));
			_pos += s.Length;
		}

		public void Append(char c, int count)
		{
			if (_pos > _chars.Length - count)
			{
				Grow(count);
			}
			Span<char> span = _chars.Slice(_pos, count);
			for (int i = 0; i < span.Length; i++)
			{
				span[i] = c;
			}
			_pos += count;
		}

		public unsafe void Append(char* value, int length)
		{
			int pos = _pos;
			if (pos > _chars.Length - length)
			{
				Grow(length);
			}
			Span<char> span = _chars.Slice(_pos, length);
			for (int i = 0; i < span.Length; i++)
			{
				span[i] = *(value++);
			}
			_pos += length;
		}

		public void Append(ReadOnlySpan<char> value)
		{
			int pos = _pos;
			if (pos > _chars.Length - value.Length)
			{
				Grow(value.Length);
			}
			value.CopyTo(_chars.Slice(_pos));
			_pos += value.Length;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public Span<char> AppendSpan(int length)
		{
			int pos = _pos;
			if (pos > _chars.Length - length)
			{
				Grow(length);
			}
			_pos = pos + length;
			return _chars.Slice(pos, length);
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		private void GrowAndAppend(char c)
		{
			Grow(1);
			Append(c);
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		private void Grow(int additionalCapacityBeyondPos)
		{
			int minimumLength = (int)Math.Max((uint)(_pos + additionalCapacityBeyondPos), Math.Min((uint)(_chars.Length * 2), 2147483591u));
			char[] array = ArrayPool<char>.Shared.Rent(minimumLength);
			_chars.Slice(0, _pos).CopyTo(array);
			char[] arrayToReturnToPool = _arrayToReturnToPool;
			_chars = (_arrayToReturnToPool = array);
			if (arrayToReturnToPool != null)
			{
				ArrayPool<char>.Shared.Return(arrayToReturnToPool);
			}
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public void Dispose()
		{
			char[] arrayToReturnToPool = _arrayToReturnToPool;
			this = default(System.Text.ValueStringBuilder);
			if (arrayToReturnToPool != null)
			{
				ArrayPool<char>.Shared.Return(arrayToReturnToPool);
			}
		}
	}
}
namespace System.Numerics.Hashing
{
	internal static class HashHelpers
	{
		public static int Combine(int h1, int h2)
		{
			uint num = (uint)(h1 << 5) | ((uint)h1 >> 27);
			return ((int)num + h1) ^ h2;
		}
	}
}
namespace Microsoft.Extensions.Primitives
{
	public class CancellationChangeToken : IChangeToken
	{
		private sealed class NullDisposable : IDisposable
		{
			public static readonly NullDisposable Instance = new NullDisposable();

			public void Dispose()
			{
			}
		}

		public bool ActiveChangeCallbacks { get; private set; } = true;


		public bool HasChanged => Token.IsCancellationRequested;

		private CancellationToken Token { get; }

		public CancellationChangeToken(CancellationToken cancellationToken)
		{
			Token = cancellationToken;
		}

		public IDisposable RegisterChangeCallback(Action<object?> callback, object? state)
		{
			bool flag = false;
			if (!ExecutionContext.IsFlowSuppressed())
			{
				ExecutionContext.SuppressFlow();
				flag = true;
			}
			try
			{
				return Token.Register(callback, state);
			}
			catch (ObjectDisposedException)
			{
				ActiveChangeCallbacks = false;
			}
			finally
			{
				if (flag)
				{
					ExecutionContext.RestoreFlow();
				}
			}
			return NullDisposable.Instance;
		}
	}
	public static class ChangeToken
	{
		private sealed class ChangeTokenRegistration<TState> : IDisposable
		{
			private sealed class NoopDisposable : IDisposable
			{
				public void Dispose()
				{
				}
			}

			private readonly Func<IChangeToken> _changeTokenProducer;

			private readonly Action<TState> _changeTokenConsumer;

			private readonly TState _state;

			private IDisposable _disposable;

			private static readonly NoopDisposable _disposedSentinel = new NoopDisposable();

			public ChangeTokenRegistration(Func<IChangeToken> changeTokenProducer, Action<TState> changeTokenConsumer, TState state)
			{
				_changeTokenProducer = changeTokenProducer;
				_changeTokenConsumer = changeTokenConsumer;
				_state = state;
				IChangeToken token = changeTokenProducer();
				RegisterChangeTokenCallback(token);
			}

			private void OnChangeTokenFired()
			{
				IChangeToken token = _changeTokenProducer();
				try
				{
					_changeTokenConsumer(_state);
				}
				finally
				{
					RegisterChangeTokenCallback(token);
				}
			}

			private void RegisterChangeTokenCallback(IChangeToken token)
			{
				if (token != null)
				{
					IDisposable disposable = token.RegisterChangeCallback(delegate(object s)
					{
						((ChangeTokenRegistration<TState>)s).OnChangeTokenFired();
					}, this);
					SetDisposable(disposable);
				}
			}

			private void SetDisposable(IDisposable disposable)
			{
				IDisposable disposable2 = Volatile.Read(ref _disposable);
				if (disposable2 == _disposedSentinel)
				{
					disposable.Dispose();
					return;
				}
				IDisposable disposable3 = Interlocked.CompareExchange(ref _disposable, disposable, disposable2);
				if (disposable3 == _disposedSentinel)
				{
					disposable.Dispose();
				}
				else if (disposable3 != disposable2)
				{
					throw new InvalidOperationException("Somebody else set the _disposable field");
				}
			}

			public void Dispose()
			{
				Interlocked.Exchange(ref _disposable, _disposedSentinel)?.Dispose();
			}
		}

		public static IDisposable OnChange(Func<IChangeToken?> changeTokenProducer, Action changeTokenConsumer)
		{
			if (changeTokenProducer == null)
			{
				ThrowHelper.ThrowArgumentNullException(ExceptionArgument.changeTokenProducer);
			}
			if (changeTokenConsumer == null)
			{
				ThrowHelper.ThrowArgumentNullException(ExceptionArgument.changeTokenConsumer);
			}
			return new ChangeTokenRegistration<Action>(changeTokenProducer, delegate(Action callback)
			{
				callback();
			}, changeTokenConsumer);
		}

		public static IDisposable OnChange<TState>(Func<IChangeToken?> changeTokenProducer, Action<TState> changeTokenConsumer, TState state)
		{
			if (changeTokenProducer == null)
			{
				ThrowHelper.ThrowArgumentNullException(ExceptionArgument.changeTokenProducer);
			}
			if (changeTokenConsumer == null)
			{
				ThrowHelper.ThrowArgumentNullException(ExceptionArgument.changeTokenConsumer);
			}
			return new ChangeTokenRegistration<TState>(changeTokenProducer, changeTokenConsumer, state);
		}
	}
	public class CompositeChangeToken : IChangeToken
	{
		private static readonly Action<object> _onChangeDelegate = OnChange;

		private readonly object _callbackLock = new object();

		private CancellationTokenSource _cancellationTokenSource;

		private List<IDisposable> _disposables;

		[MemberNotNullWhen(true, "_cancellationTokenSource")]
		[MemberNotNullWhen(true, "_disposables")]
		private bool RegisteredCallbackProxy
		{
			[MemberNotNullWhen(true, "_cancellationTokenSource")]
			[MemberNotNullWhen(true, "_disposables")]
			get;
			[MemberNotNullWhen(true, "_cancellationTokenSource")]
			[MemberNotNullWhen(true, "_disposables")]
			set;
		}

		public IReadOnlyList<IChangeToken> ChangeTokens { get; }

		public bool HasChanged
		{
			get
			{
				if (_cancellationTokenSource != null && _cancellationTokenSource.Token.IsCancellationRequested)
				{
					return true;
				}
				for (int i = 0; i < ChangeTokens.Count; i++)
				{
					if (ChangeTokens[i].HasChanged)
					{
						OnChange(this);
						return true;
					}
				}
				return false;
			}
		}

		public bool ActiveChangeCallbacks { get; }

		public CompositeChangeToken(IReadOnlyList<IChangeToken> changeTokens)
		{
			if (changeTokens == null)
			{
				ThrowHelper.ThrowArgumentNullException(ExceptionArgument.changeTokens);
			}
			ChangeTokens = changeTokens;
			for (int i = 0; i < ChangeTokens.Count; i++)
			{
				if (ChangeTokens[i].ActiveChangeCallbacks)
				{
					ActiveChangeCallbacks = true;
					break;
				}
			}
		}

		public IDisposable RegisterChangeCallback(Action<object?> callback, object? state)
		{
			EnsureCallbacksInitialized();
			return _cancellationTokenSource.Token.Register(callback, state);
		}

		[MemberNotNull("_cancellationTokenSource")]
		[MemberNotNull("_disposables")]
		private void EnsureCallbacksInitialized()
		{
			if (RegisteredCallbackProxy)
			{
				return;
			}
			lock (_callbackLock)
			{
				if (RegisteredCallbackProxy)
				{
					return;
				}
				_cancellationTokenSource = new CancellationTokenSource();
				_disposables = new List<IDisposable>();
				for (int i = 0; i < ChangeTokens.Count; i++)
				{
					if (ChangeTokens[i].ActiveChangeCallbacks)
					{
						IDisposable disposable = ChangeTokens[i].RegisterChangeCallback(_onChangeDelegate, this);
						if (_cancellationTokenSource.IsCancellationRequested)
						{
							disposable.Dispose();
							break;
						}
						_disposables.Add(disposable);
					}
				}
				RegisteredCallbackProxy = true;
			}
		}

		private static void OnChange(object state)
		{
			CompositeChangeToken compositeChangeToken = (CompositeChangeToken)state;
			if (compositeChangeToken._cancellationTokenSource == null)
			{
				return;
			}
			lock (compositeChangeToken._callbackLock)
			{
				try
				{
					compositeChangeToken._cancellationTokenSource.Cancel();
				}
				catch
				{
				}
			}
			List<IDisposable> disposables = compositeChangeToken._disposables;
			for (int i = 0; i < disposables.Count; i++)
			{
				disposables[i].Dispose();
			}
		}
	}
	public static class Extensions
	{
		public static StringBuilder Append(this StringBuilder builder, StringSegment segment)
		{
			return builder.Append(segment.Buffer, segment.Offset, segment.Length);
		}
	}
	public interface IChangeToken
	{
		bool HasChanged { get; }

		bool ActiveChangeCallbacks { get; }

		IDisposable RegisterChangeCallback(Action<object?> callback, object? state);
	}
	public readonly struct StringSegment : IEquatable<StringSegment>, IEquatable<string?>
	{
		public static readonly StringSegment Empty = string.Empty;

		public string? Buffer { get; }

		public int Offset { get; }

		public int Length { get; }

		public string? Value
		{
			get
			{
				if (!HasValue)
				{
					return null;
				}
				return Buffer.Substring(Offset, Length);
			}
		}

		[MemberNotNullWhen(true, "Buffer")]
		[MemberNotNullWhen(true, "Value")]
		public bool HasValue
		{
			[MemberNotNullWhen(true, "Buffer")]
			[MemberNotNullWhen(true, "Value")]
			get
			{
				return Buffer != null;
			}
		}

		public char this[int index]
		{
			get
			{
				if ((uint)index >= (uint)Length)
				{
					ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.index);
				}
				return Buffer[Offset + index];
			}
		}

		public StringSegment(string? buffer)
		{
			Buffer = buffer;
			Offset = 0;
			Length = buffer?.Length ?? 0;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public StringSegment(string buffer, int offset, int length)
		{
			if (buffer == null || (uint)offset > (uint)buffer.Length || (uint)length > (uint)(buffer.Length - offset))
			{
				ThrowInvalidArguments(buffer, offset, length);
			}
			Buffer = buffer;
			Offset = offset;
			Length = length;
		}

		public ReadOnlySpan<char> AsSpan()
		{
			return Buffer.AsSpan(Offset, Length);
		}

		public ReadOnlySpan<char> AsSpan(int start)
		{
			if (!HasValue || start < 0)
			{
				ThrowInvalidArguments(start, Length - start, ExceptionArgument.start);
			}
			return Buffer.AsSpan(Offset + start, Length - start);
		}

		public ReadOnlySpan<char> AsSpan(int start, int length)
		{
			if (!HasValue || start < 0 || length < 0 || (uint)(start + length) > (uint)Length)
			{
				ThrowInvalidArguments(start, length, ExceptionArgument.start);
			}
			return Buffer.AsSpan(Offset + start, length);
		}

		public ReadOnlyMemory<char> AsMemory()
		{
			return Buffer.AsMemory(Offset, Length);
		}

		public static int Compare(StringSegment a, StringSegment b, StringComparison comparisonType)
		{
			if (a.HasValue && b.HasValue)
			{
				return a.AsSpan().CompareTo(b.AsSpan(), comparisonType);
			}
			CheckStringComparison(comparisonType);
			if (a.HasValue)
			{
				return 1;
			}
			if (!b.HasValue)
			{
				return 0;
			}
			return -1;
		}

		public override bool Equals([NotNullWhen(true)] object? obj)
		{
			if (obj is StringSegment other)
			{
				return Equals(other);
			}
			return false;
		}

		public bool Equals(StringSegment other)
		{
			return Equals(other, StringComparison.Ordinal);
		}

		public bool Equals(StringSegment other, StringComparison comparisonType)
		{
			if (HasValue && other.HasValue)
			{
				return MemoryExtensions.Equals(AsSpan(), other.AsSpan(), comparisonType);
			}
			CheckStringComparison(comparisonType);
			if (!HasValue)
			{
				return !other.HasValue;
			}
			return false;
		}

		public static bool Equals(StringSegment a, StringSegment b, StringComparison comparisonType)
		{
			return a.Equals(b, comparisonType);
		}

		public bool Equals(string? text)
		{
			return Equals(text, StringComparison.Ordinal);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public bool Equals(string? text, StringComparison comparisonType)
		{
			if (!HasValue || text == null)
			{
				CheckStringComparison(comparisonType);
				return text == Buffer;
			}
			return MemoryExtensions.Equals(AsSpan(), text.AsSpan(), comparisonType);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public override int GetHashCode()
		{
			return Value?.GetHashCode() ?? 0;
		}

		public static bool operator ==(StringSegment left, StringSegment right)
		{
			return left.Equals(right);
		}

		public static bool operator !=(StringSegment left, StringSegment right)
		{
			return !left.Equals(right);
		}

		public static implicit operator StringSegment(string? value)
		{
			return new StringSegment(value);
		}

		public static implicit operator ReadOnlySpan<char>(StringSegment segment)
		{
			return segment.AsSpan();
		}

		public static implicit operator ReadOnlyMemory<char>(StringSegment segment)
		{
			return segment.AsMemory();
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public bool StartsWith(string text, StringComparison comparisonType)
		{
			if (text == null)
			{
				ThrowHelper.ThrowArgumentNullException(ExceptionArgument.text);
			}
			if (!HasValue)
			{
				CheckStringComparison(comparisonType);
				return false;
			}
			return AsSpan().StartsWith(text.AsSpan(), comparisonType);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public bool EndsWith(string text, StringComparison comparisonType)
		{
			if (text == null)
			{
				ThrowHelper.ThrowArgumentNullException(ExceptionArgument.text);
			}
			if (!HasValue)
			{
				CheckStringComparison(comparisonType);
				return false;
			}
			return AsSpan().EndsWith(text.AsSpan(), comparisonType);
		}

		public string Substring(int offset)
		{
			return Substring(offset, Length - offset);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public string Substring(int offset, int length)
		{
			if (!HasValue || offset < 0 || length < 0 || (uint)(offset + length) > (uint)Length)
			{
				ThrowInvalidArguments(offset, length, ExceptionArgument.offset);
			}
			return Buffer.Substring(Offset + offset, length);
		}

		public StringSegment Subsegment(int offset)
		{
			return Subsegment(offset, Length - offset);
		}

		public StringSegment Subsegment(int offset, int length)
		{
			if (!HasValue || offset < 0 || length < 0 || (uint)(offset + length) > (uint)Length)
			{
				ThrowInvalidArguments(offset, length, ExceptionArgument.offset);
			}
			return new StringSegment(Buffer, Offset + offset, length);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public int IndexOf(char c, int start, int count)
		{
			int num = -1;
			if (HasValue)
			{
				if ((uint)start > (uint)Length)
				{
					ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.start);
				}
				if ((uint)count > (uint)(Length - start))
				{
					ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.count);
				}
				num = AsSpan(start, count).IndexOf(c);
				if (num >= 0)
				{
					num += start;
				}
			}
			return num;
		}

		public int IndexOf(char c, int start)
		{
			return IndexOf(c, start, Length - start);
		}

		public int IndexOf(char c)
		{
			return IndexOf(c, 0, Length);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public int IndexOfAny(char[] anyOf, int startIndex, int count)
		{
			int num = -1;
			if (HasValue)
			{
				if ((uint)startIndex > (uint)Length)
				{
					ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.start);
				}
				if ((uint)count > (uint)(Length - startIndex))
				{
					ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.count);
				}
				num = Buffer.IndexOfAny(anyOf, Offset + startIndex, count);
				if (num != -1)
				{
					num -= Offset;
				}
			}
			return num;
		}

		public int IndexOfAny(char[] anyOf, int startIndex)
		{
			return IndexOfAny(anyOf, startIndex, Length - startIndex);
		}

		public int IndexOfAny(char[] anyOf)
		{
			return IndexOfAny(anyOf, 0, Length);
		}

		public int LastIndexOf(char value)
		{
			return AsSpan().LastIndexOf(value);
		}

		public StringSegment Trim()
		{
			return TrimStart().TrimEnd();
		}

		public StringSegment TrimStart()
		{
			ReadOnlySpan<char> readOnlySpan = AsSpan();
			int i;
			for (i = 0; i < readOnlySpan.Length && char.IsWhiteSpace(readOnlySpan[i]); i++)
			{
			}
			return Subsegment(i);
		}

		public StringSegment TrimEnd()
		{
			ReadOnlySpan<char> readOnlySpan = AsSpan();
			int num = readOnlySpan.Length - 1;
			while (num >= 0 && char.IsWhiteSpace(readOnlySpan[num]))
			{
				num--;
			}
			return Subsegment(0, num + 1);
		}

		public StringTokenizer Split(char[] chars)
		{
			return new StringTokenizer(this, chars);
		}

		public static bool IsNullOrEmpty(StringSegment value)
		{
			bool result = false;
			if (!value.HasValue || value.Length == 0)
			{
				result = true;
			}
			return result;
		}

		public override string ToString()
		{
			return Value ?? string.Empty;
		}

		private static void CheckStringComparison(StringComparison comparisonType)
		{
			if ((uint)comparisonType > 5u)
			{
				ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.comparisonType);
			}
		}

		[DoesNotReturn]
		private static void ThrowInvalidArguments(string buffer, int offset, int length)
		{
			throw GetInvalidArgumentsException();
			Exception GetInvalidArgumentsException()
			{
				if (buffer == null)
				{
					return ThrowHelper.GetArgumentNullException(ExceptionArgument.buffer);
				}
				if (offset < 0)
				{
					return ThrowHelper.GetArgumentOutOfRangeException(ExceptionArgument.offset);
				}
				if (length < 0)
				{
					return ThrowHelper.GetArgumentOutOfRangeException(ExceptionArgument.length);
				}
				return ThrowHelper.GetArgumentException(ExceptionResource.Argument_InvalidOffsetLength);
			}
		}

		[DoesNotReturn]
		private void ThrowInvalidArguments(int offset, int length, ExceptionArgument offsetOrStart)
		{
			throw GetInvalidArgumentsException(HasValue);
			Exception GetInvalidArgumentsException(bool hasValue)
			{
				if (!hasValue)
				{
					return ThrowHelper.GetArgumentOutOfRangeException(offsetOrStart);
				}
				if (offset < 0)
				{
					return ThrowHelper.GetArgumentOutOfRangeException(offsetOrStart);
				}
				if (length < 0)
				{
					return ThrowHelper.GetArgumentOutOfRangeException(ExceptionArgument.length);
				}
				return ThrowHelper.GetArgumentException(ExceptionResource.Argument_InvalidOffsetLengthStringSegment);
			}
		}
	}
	public class StringSegmentComparer : IComparer<StringSegment>, IEqualityComparer<StringSegment>
	{
		public static StringSegmentComparer Ordinal { get; } = new StringSegmentComparer(StringComparison.Ordinal, StringComparer.Ordinal);


		public static StringSegmentComparer OrdinalIgnoreCase { get; } = new StringSegmentComparer(StringComparison.OrdinalIgnoreCase, StringComparer.OrdinalIgnoreCase);


		private StringComparison Comparison { get; }

		private StringComparer Comparer { get; }

		private StringSegmentComparer(StringComparison comparison, StringComparer comparer)
		{
			Comparison = comparison;
			Comparer = comparer;
		}

		public int Compare(StringSegment x, StringSegment y)
		{
			return StringSegment.Compare(x, y, Comparison);
		}

		public bool Equals(StringSegment x, StringSegment y)
		{
			return StringSegment.Equals(x, y, Comparison);
		}

		public int GetHashCode(StringSegment obj)
		{
			if (!obj.HasValue)
			{
				return 0;
			}
			return Comparer.GetHashCode(obj.Value);
		}
	}
	public readonly struct StringTokenizer : IEnumerable<StringSegment>, IEnumerable
	{
		public struct Enumerator : IEnumerator<StringSegment>, IDisposable, IEnumerator
		{
			private readonly StringSegment _value;

			private readonly char[] _separators;

			private int _index;

			public StringSegment Current { get; private set; }

			object IEnumerator.Current => Current;

			internal Enumerator(in StringSegment value, char[] separators)
			{
				_value = value;
				_separators = separators;
				Current = default(StringSegment);
				_index = 0;
			}

			public Enumerator(ref StringTokenizer tokenizer)
			{
				_value = tokenizer._value;
				_separators = tokenizer._separators;
				Current = default(StringSegment);
				_index = 0;
			}

			public void Dispose()
			{
			}

			public bool MoveNext()
			{
				if (!_value.HasValue || _index > _value.Length)
				{
					Current = default(StringSegment);
					return false;
				}
				int num = _value.IndexOfAny(_separators, _index);
				if (num == -1)
				{
					num = _value.Length;
				}
				Current = _value.Subsegment(_index, num - _index);
				_index = num + 1;
				return true;
			}

			public void Reset()
			{
				Current = default(StringSegment);
				_index = 0;
			}
		}

		private readonly StringSegment _value;

		private readonly char[] _separators;

		public StringTokenizer(string value, char[] separators)
		{
			if (value == null)
			{
				ThrowHelper.ThrowArgumentNullException(ExceptionArgument.value);
			}
			if (separators == null)
			{
				ThrowHelper.ThrowArgumentNullException(ExceptionArgument.separators);
			}
			_value = value;
			_separators = separators;
		}

		public StringTokenizer(StringSegment value, char[] separators)
		{
			if (!value.HasValue)
			{
				ThrowHelper.ThrowArgumentNullException(ExceptionArgument.value);
			}
			if (separators == null)
			{
				ThrowHelper.ThrowArgumentNullException(ExceptionArgument.separators);
			}
			_value = value;
			_separators = separators;
		}

		public Enumerator GetEnumerator()
		{
			return new Enumerator(in _value, _separators);
		}

		IEnumerator<StringSegment> IEnumerable<StringSegment>.GetEnumerator()
		{
			return GetEnumerator();
		}

		IEnumerator IEnumerable.GetEnumerator()
		{
			return GetEnumerator();
		}
	}
	public readonly struct StringValues : IList<string?>, ICollection<string?>, IEnumerable<string?>, IEnumerable, IReadOnlyList<string?>, IReadOnlyCollection<string?>, IEquatable<StringValues>, IEquatable<string?>, IEquatable<string?[]?>
	{
		public struct Enumerator : IEnumerator<string?>, IDisposable, IEnumerator
		{
			private readonly string[] _values;

			private int _index;

			private string _current;

			public string? Current => _current;

			object? IEnumerator.Current => _current;

			internal Enumerator(object value)
			{
				if (value is string current)
				{
					_values = null;
					_current = current;
				}
				else
				{
					_current = null;
					_values = System.Runtime.CompilerServices.Unsafe.As<string[]>(value);
				}
				_index = 0;
			}

			public Enumerator(ref StringValues values)
				: this(values._values)
			{
			}

			public bool MoveNext()
			{
				int index = _index;
				if (index < 0)
				{
					return false;
				}
				string[] values = _values;
				if (values != null)
				{
					if ((uint)index < (uint)values.Length)
					{
						_index = index + 1;
						_current = values[index];
						return true;
					}
					_index = -1;
					return false;
				}
				_index = -1;
				return _current != null;
			}

			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}

			public void Dispose()
			{
			}
		}

		public static readonly StringValues Empty = new StringValues(Array.Empty<string>());

		private readonly object _values;

		public int Count
		{
			[MethodImpl(MethodImplOptions.AggressiveInlining)]
			get
			{
				object values = _values;
				if (values == null)
				{
					return 0;
				}
				if (values is string)
				{
					return 1;
				}
				return System.Runtime.CompilerServices.Unsafe.As<string[]>(values).Length;
			}
		}

		bool ICollection<string>.IsReadOnly => true;

		string? IList<string>.this[int index]
		{
			get
			{
				return this[index];
			}
			set
			{
				throw new NotSupportedException();
			}
		}

		public string? this[int index]
		{
			[MethodImpl(MethodImplOptions.AggressiveInlining)]
			get
			{
				object values = _values;
				if (values is string result)
				{
					if (index == 0)
					{
						return result;
					}
				}
				else if (values != null)
				{
					return System.Runtime.CompilerServices.Unsafe.As<string[]>(values)[index];
				}
				return OutOfBounds();
			}
		}

		public StringValues(string? value)
		{
			_values = value;
		}

		public StringValues(string?[]? values)
		{
			_values = values;
		}

		public static implicit operator StringValues(string? value)
		{
			return new StringValues(value);
		}

		public static implicit operator StringValues(string?[]? values)
		{
			return new StringValues(values);
		}

		public static implicit operator string?(StringValues values)
		{
			return values.GetStringValue();
		}

		public static implicit operator string?[]?(StringValues value)
		{
			return value.GetArrayValue();
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		private static string OutOfBounds()
		{
			return Array.Empty<string>()[0];
		}

		public override string ToString()
		{
			return GetStringValue() ?? string.Empty;
		}

		private string GetStringValue()
		{
			object values2 = _values;
			if (values2 is string result)
			{
				return result;
			}
			return GetStringValueFromArray(values2);
			static string GetJoinedStringValueFromArray(string[] values)
			{
				int num = 0;
				foreach (string text in values)
				{
					if (text != null && text.Length > 0)
					{
						if (num > 0)
						{
							num++;
						}
						num += text.Length;
					}
				}
				System.Text.ValueStringBuilder valueStringBuilder = new System.Text.ValueStringBuilder(num);
				bool flag = false;
				foreach (string text2 in values)
				{
					if (text2 != null && text2.Length > 0)
					{
						if (flag)
						{
							valueStringBuilder.Append(',');
						}
						valueStringBuilder.Append(text2);
						flag = true;
					}
				}
				return valueStringBuilder.ToString();
			}
			static string GetStringValueFromArray(object value)
			{
				if (value == null)
				{
					return null;
				}
				string[] array = System.Runtime.CompilerServices.Unsafe.As<string[]>(value);
				return array.Length switch
				{
					0 => null, 
					1 => array[0], 
					_ => GetJoinedStringValueFromArray(array), 
				};
			}
		}

		public string?[] ToArray()
		{
			return GetArrayValue() ?? Array.Empty<string>();
		}

		private string[] GetArrayValue()
		{
			object values = _values;
			if (values is string[] result)
			{
				return result;
			}
			if (values != null)
			{
				return new string[1] { System.Runtime.CompilerServices.Unsafe.As<string>(values) };
			}
			return null;
		}

		int IList<string>.IndexOf(string item)
		{
			return IndexOf(item);
		}

		private int IndexOf(string item)
		{
			object values = _values;
			if (values is string[] array)
			{
				for (int i = 0; i < array.Length; i++)
				{
					if (string.Equals(array[i], item, StringComparison.Ordinal))
					{
						return i;
					}
				}
				return -1;
			}
			if (values != null)
			{
				if (!string.Equals(System.Runtime.CompilerServices.Unsafe.As<string>(values), item, StringComparison.Ordinal))
				{
					return -1;
				}
				return 0;
			}
			return -1;
		}

		bool ICollection<string>.Contains(string item)
		{
			return IndexOf(item) >= 0;
		}

		void ICollection<string>.CopyTo(string[] array, int arrayIndex)
		{
			CopyTo(array, arrayIndex);
		}

		private void CopyTo(string[] array, int arrayIndex)
		{
			object values = _values;
			if (values is string[] array2)
			{
				Array.Copy(array2, 0, array, arrayIndex, array2.Length);
			}
			else if (values != null)
			{
				if (array == null)
				{
					ThrowHelper.ThrowArgumentNullException(ExceptionArgument.array);
				}
				if (arrayIndex < 0)
				{
					throw new ArgumentOutOfRangeException("arrayIndex");
				}
				if (array.Length - arrayIndex < 1)
				{
					throw new ArgumentException("'array' is not long enough to copy all the items in the collection. Check 'arrayIndex' and 'array' length.");
				}
				array[arrayIndex] = System.Runtime.CompilerServices.Unsafe.As<string>(values);
			}
		}

		void ICollection<string>.Add(string item)
		{
			throw new NotSupportedException();
		}

		void IList<string>.Insert(int index, string item)
		{
			throw new NotSupportedException();
		}

		bool ICollection<string>.Remove(string item)
		{
			throw new NotSupportedException();
		}

		void IList<string>.RemoveAt(int index)
		{
			throw new NotSupportedException();
		}

		void ICollection<string>.Clear()
		{
			throw new NotSupportedException();
		}

		public Enumerator GetEnumerator()
		{
			return new Enumerator(_values);
		}

		IEnumerator<string> IEnumerable<string>.GetEnumerator()
		{
			return GetEnumerator();
		}

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

		public static bool IsNullOrEmpty(StringValues value)
		{
			object values = value._values;
			if (values == null)
			{
				return true;
			}
			if (values is string[] array)
			{
				return array.Length switch
				{
					0 => true, 
					1 => string.IsNullOrEmpty(array[0]), 
					_ => false, 
				};
			}
			return string.IsNullOrEmpty(System.Runtime.CompilerServices.Unsafe.As<string>(values));
		}

		public static StringValues Concat(StringValues values1, StringValues values2)
		{
			int count = values1.Count;
			int count2 = values2.Count;
			if (count == 0)
			{
				return values2;
			}
			if (count2 == 0)
			{
				return values1;
			}
			string[] array = new string[count + count2];
			values1.CopyTo(array, 0);
			values2.CopyTo(array, count);
			return new StringValues(array);
		}

		public static StringValues Concat(in StringValues values, string? value)
		{
			if (value == null)
			{
				return values;
			}
			int count = values.Count;
			if (count == 0)
			{
				return new StringValues(value);
			}
			string[] array = new string[count + 1];
			values.CopyTo(array, 0);
			array[count] = value;
			return new StringValues(array);
		}

		public static StringValues Concat(string? value, in StringValues values)
		{
			if (value == null)
			{
				return values;
			}
			int count = values.Count;
			if (count == 0)
			{
				return new StringValues(value);
			}
			string[] array = new string[count + 1];
			array[0] = value;
			values.CopyTo(array, 1);
			return new StringValues(array);
		}

		public static bool Equals(StringValues left, StringValues right)
		{
			int count = left.Count;
			if (count != right.Count)
			{
				return false;
			}
			for (int i = 0; i < count; i++)
			{
				if (left[i] != right[i])
				{
					return false;
				}
			}
			return true;
		}

		public static bool operator ==(StringValues left, StringValues right)
		{
			return Equals(left, right);
		}

		public static bool operator !=(StringValues left, StringValues right)
		{
			return !Equals(left, right);
		}

		public bool Equals(StringValues other)
		{
			return Equals(this, other);
		}

		public static bool Equals(string? left, StringValues right)
		{
			return Equals(new StringValues(left), right);
		}

		public static bool Equals(StringValues left, string? right)
		{
			return Equals(left, new StringValues(right));
		}

		public bool Equals(string? other)
		{
			return Equals(this, new StringValues(other));
		}

		public static bool Equals(string?[]? left, StringValues right)
		{
			return Equals(new StringValues(left), right);
		}

		public static bool Equals(StringValues left, string?[]? right)
		{
			return Equals(left, new StringValues(right));
		}

		public bool Equals(string?[]? other)
		{
			return Equals(this, new StringValues(other));
		}

		public static bool operator ==(StringValues left, string? right)
		{
			return Equals(left, new StringValues(right));
		}

		public static bool operator !=(StringValues left, string? right)
		{
			return !Equals(left, new StringValues(right));
		}

		public static bool operator ==(string? left, StringValues right)
		{
			return Equals(new StringValues(left), right);
		}

		public static bool operator !=(string? left, StringValues right)
		{
			return !Equals(new StringValues(left), right);
		}

		public static bool operator ==(StringValues left, string?[]? right)
		{
			return Equals(left, new StringValues(right));
		}

		public static bool operator !=(StringValues left, string?[]? right)
		{
			return !Equals(left, new StringValues(right));
		}

		public static bool operator ==(string?[]? left, StringValues right)
		{
			return Equals(new StringValues(left), right);
		}

		public static bool operator !=(string?[]? left, StringValues right)
		{
			return !Equals(new StringValues(left), right);
		}

		public static bool operator ==(StringValues left, object? right)
		{
			return left.Equals(right);
		}

		public static bool operator !=(StringValues left, object? right)
		{
			return !left.Equals(right);
		}

		public static bool operator ==(object? left, StringValues right)
		{
			return right.Equals(left);
		}

		public static bool operator !=(object? left, StringValues right)
		{
			return !right.Equals(left);
		}

		public override bool Equals(object? obj)
		{
			if (obj == null)
			{
				return Equals(this, Empty);
			}
			if (obj is string right)
			{
				return Equals(this, right);
			}
			if (obj is string[] right2)
			{
				return Equals(this, right2);
			}
			if (obj is StringValues right3)
			{
				return Equals(this, right3);
			}
			return false;
		}

		public override int GetHashCode()
		{
			object values = _values;
			if (values is string[] array)
			{
				if (Count == 1)
				{
					return System.Runtime.CompilerServices.Unsafe.As<string>((object)this[0])?.GetHashCode() ?? Count.GetHashCode();
				}
				int num = 0;
				for (int i = 0; i < array.Length; i++)
				{
					num = HashHelpers.Combine(num, array[i]?.GetHashCode() ?? 0);
				}
				return num;
			}
			return System.Runtime.CompilerServices.Unsafe.As<string>(values)?.GetHashCode() ?? Count.GetHashCode();
		}
	}
	internal static class ThrowHelper
	{
		[DoesNotReturn]
		internal static void ThrowArgumentNullException(ExceptionArgument argument)
		{
			throw new ArgumentNullException(GetArgumentName(argument));
		}

		[DoesNotReturn]
		internal static void ThrowArgumentOutOfRangeException(ExceptionArgument argument)
		{
			throw new ArgumentOutOfRangeException(GetArgumentName(argument));
		}

		[DoesNotReturn]
		internal static void ThrowArgumentException(ExceptionResource resource)
		{
			throw new ArgumentException(GetResourceText(resource));
		}

		[DoesNotReturn]
		internal static void ThrowInvalidOperationException(ExceptionResource resource)
		{
			throw new InvalidOperationException(GetResourceText(resource));
		}

		[DoesNotReturn]
		internal static void ThrowInvalidOperationException(ExceptionResource resource, params object[] args)
		{
			string message = string.Format(GetResourceText(resource), args);
			throw new InvalidOperationException(message);
		}

		internal static ArgumentNullException GetArgumentNullException(ExceptionArgument argument)
		{
			return new ArgumentNullException(GetArgumentName(argument));
		}

		internal static ArgumentOutOfRangeException GetArgumentOutOfRangeException(ExceptionArgument argument)
		{
			return new ArgumentOutOfRangeException(GetArgumentName(argument));
		}

		internal static ArgumentException GetArgumentException(ExceptionResource resource)
		{
			return new ArgumentException(GetResourceText(resource));
		}

		private static string GetResourceText(ExceptionResource resource)
		{
			return System.SR.GetResourceString(GetResourceName(resource));
		}

		private static string GetArgumentName(ExceptionArgument argument)
		{
			return argument.ToString();
		}

		private static string GetResourceName(ExceptionResource resource)
		{
			return resource.ToString();
		}
	}
	internal enum ExceptionArgument
	{
		buffer,
		offset,
		length,
		text,
		start,
		count,
		index,
		value,
		capacity,
		separators,
		comparisonType,
		changeTokens,
		changeTokenProducer,
		changeTokenConsumer,
		array
	}
	internal enum ExceptionResource
	{
		Argument_InvalidOffsetLength,
		Argument_InvalidOffsetLengthStringSegment,
		Capacity_CannotChangeAfterWriteStarted,
		Capacity_NotEnough,
		Capacity_NotUsedEntirely
	}
}

BepInEx/plugins/SlopCrew.Plugin/SlopCrew.API.dll

Decompiled 8 months ago
using System;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using Microsoft.CodeAnalysis;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: AssemblyCompany("SlopCrew.API")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.1.2.0")]
[assembly: AssemblyInformationalVersion("1.1.2+674acc4b21cf01518f4afa48c5dd0a05dce797fc")]
[assembly: AssemblyProduct("SlopCrew")]
[assembly: AssemblyTitle("SlopCrew.API")]
[assembly: AssemblyVersion("1.1.2.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace SlopCrew.API
{
	public class APIManager
	{
		public static ISlopCrewAPI? API;

		public static event Action<ISlopCrewAPI>? OnAPIRegistered;

		public static void RegisterAPI(ISlopCrewAPI api)
		{
			API = api;
			APIManager.OnAPIRegistered?.Invoke(api);
		}
	}
	public interface ISlopCrewAPI
	{
		string ServerAddress { get; }

		int PlayerCount { get; }

		bool Connected { get; }

		ulong Latency { get; }

		int TickRate { get; }

		int? StageOverride { get; set; }

		string? PlayerName { get; }

		ReadOnlyCollection<uint>? Players { get; }

		event Action<int> OnPlayerCountChanged;

		event Action OnConnected;

		event Action OnDisconnected;

		event Action<uint, string, byte[]> OnCustomPacketReceived;

		event Action<uint, string, byte[]> OnCustomCharacterInfoReceived;

		event Action<ulong> OnServerTickReceived;

		string? GetGameObjectPathForPlayerID(uint playerId);

		uint? GetPlayerIDForGameObjectPath(string gameObjectPath);

		bool? PlayerIDExists(uint playerId);

		string? GetPlayerName(uint playerId);

		void SendCustomPacket(string id, byte[] data);

		void SetCustomCharacterInfo(string id, byte[]? data);
	}
}

BepInEx/plugins/SlopCrew.Plugin/SlopCrew.Common.dll

Decompiled 8 months ago
using System;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Numerics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Text;
using System.Text.RegularExpressions;
using Google.Protobuf;
using Google.Protobuf.Collections;
using Google.Protobuf.Reflection;
using Microsoft.CodeAnalysis;
using MonoMod.Utils;
using SlopCrew.Common.Proto;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: AssemblyCompany("SlopCrew.Common")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+674acc4b21cf01518f4afa48c5dd0a05dce797fc")]
[assembly: AssemblyProduct("SlopCrew.Common")]
[assembly: AssemblyTitle("SlopCrew.Common")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace SlopCrew.Common
{
	public class Constants
	{
		public const uint NetworkVersion = 5u;

		public const int MaxCustomCharacterInfo = 5;

		public const int MaxCustomPacketSize = 512;

		public const string DefaultName = "Big Slopper";

		public const string CensoredName = "Punished Slopper";

		public const int NameLimit = 32;

		public const int PingFrequency = 5000;

		public const int ReconnectFrequency = 5000;

		public const int SimpleEncounterStartTime = 3;

		public const int SimpleEncounterEndTime = 5;

		public const int LobbyMaxWaitTime = 30;

		public const int LobbyIncrementWaitTime = 5;

		public const int RaceEncounterStartTime = 3;

		public const int MaxRaceTime = 120;

		public static Dictionary<QuickChatCategory, List<string>> QuickChatMessages = new Dictionary<QuickChatCategory, List<string>>
		{
			{
				QuickChatCategory.General,
				new List<string>(9) { "Heya!", "Goodbye!", "Good game!", "OK.", "No thanks.", "Nice!", "I'm using tilt controls!", "Wait a sec!", "Thank you!" }
			},
			{
				QuickChatCategory.Actions,
				new List<string>(6) { "Let's chill!", "Let's skate!", "Let's score battle!", "Let's combo battle!", "Let's race!", "Follow me!" }
			},
			{
				QuickChatCategory.Places,
				new List<string>(9) { "Police Station", "Hideout", "Versum Hill", "Millenium Square", "Brink Terminal", "Millenium Mall", "Mataan", "Pyramid Island", "Jakes" }
			},
			{
				QuickChatCategory.Emojis,
				new List<string>(16)
				{
					"<sprite=0>", "<sprite=1>", "<sprite=2>", "<sprite=3>", "<sprite=4>", "<sprite=5>", "<sprite=6>", "<sprite=7>", "<sprite=8>", "<sprite=9>",
					"<sprite=10>", "<sprite=11>", "<sprite=12>", "<sprite=13>", "<sprite=14>", "<sprite=15>"
				}
			}
		};
	}
	public class PlayerNameFilter
	{
		private static List<string> BannedWords = LoadBannedWords();

		private static List<string> BasedNames = new List<string> { "gangbangeronline", "<#00ff37>DICK <#f4fff2>GRIPPA", "undies", "[JKS]<#FF0>K1LL<#000>B1LL", "[JKS] <color=lightblue>SpookPPL", "Start9", "Jazzy Senpai", "Itz Vexx", "<color=#F00>Humongous Slopper" };

		private static List<Regex> Regexes = new List<Regex>
		{
			new Regex("<a href*?>"),
			new Regex("<alpha*?>"),
			new Regex("<br>"),
			new Regex("<cspace.*?>"),
			new Regex("<font .*?>"),
			new Regex("<indent.*?>"),
			new Regex("<line-.*?>"),
			new Regex("<margin.*?>"),
			new Regex("<mark.*?>"),
			new Regex("<mspace.*?>"),
			new Regex("<pos.*?>"),
			new Regex("<rotate.*?>"),
			new Regex("<size.*?>"),
			new Regex("<space.*?>"),
			new Regex("<style.*?>"),
			new Regex("<voffset.*?>"),
			new Regex("<width.*?>")
		};

		private static readonly string[] ClosingTags = new string[14]
		{
			"</align>", "</color>", "</b>", "</i>", "</link>", "</lowercase>", "</uppercase>", "</smallcaps>", "</noparse>", "</nobr>",
			"</s>", "</u>", "</sub>", "</sup>"
		};

		private static List<string> LoadBannedWords()
		{
			List<string> list = new List<string>();
			string[] array = new StreamReader(Assembly.GetExecutingAssembly().GetManifestResourceStream("SlopCrew.Common.res.profanity.txt") ?? throw new Exception("Could not load profanity filter")).ReadToEnd().Split(new char[1] { '\n' });
			for (int i = 0; i < array.Length; i++)
			{
				string text = array[i].Trim();
				if (!text.StartsWith("#"))
				{
					list.Add(text);
				}
			}
			return list;
		}

		public static string DoFilter(string name)
		{
			if (HitsFilter(name))
			{
				return "Punished Slopper";
			}
			string text = name;
			foreach (Regex regex in Regexes)
			{
				text = regex.Replace(text, "");
			}
			return text[..Math.Min(32, text.Length)];
		}

		public static string CloseAll(string name)
		{
			StringBuilder stringBuilder = new StringBuilder(name);
			string[] closingTags = ClosingTags;
			foreach (string value in closingTags)
			{
				stringBuilder.Append(value);
			}
			return stringBuilder.ToString();
		}

		public static bool HitsFilter(string name)
		{
			if (BasedNames.Contains(name))
			{
				return false;
			}
			return ContainsProfanity(name);
		}

		public static bool ContainsProfanity(string text)
		{
			foreach (string bannedWord in BannedWords)
			{
				if (text.ToLower().Contains(bannedWord.ToLower()))
				{
					return true;
				}
			}
			return false;
		}
	}
	[Flags]
	public enum SendFlags
	{
		Unreliable = 0,
		NoNagle = 1,
		NoDelay = 4,
		Reliable = 8
	}
	public enum IdentityType
	{
		Invalid = 0,
		SteamID = 16,
		IPAddress = 1,
		GenericString = 2,
		GenericBytes = 3
	}
	public enum ConnectionState
	{
		None,
		Connecting,
		FindingRoute,
		Connected,
		ClosedByPeer,
		ProblemDetectedLocally
	}
	public enum ConfigurationScope
	{
		Global = 1,
		SocketsInterface,
		ListenSocket,
		Connection
	}
	public enum ConfigurationDataType
	{
		Int32 = 1,
		Int64,
		Float,
		String,
		FunctionPtr
	}
	public enum ConfigurationValue
	{
		Invalid = 0,
		FakePacketLossSend = 2,
		FakePacketLossRecv = 3,
		FakePacketLagSend = 4,
		FakePacketLagRecv = 5,
		FakePacketReorderSend = 6,
		FakePacketReorderRecv = 7,
		FakePacketReorderTime = 8,
		FakePacketDupSend = 26,
		FakePacketDupRecv = 27,
		FakePacketDupTimeMax = 28,
		TimeoutInitial = 24,
		TimeoutConnected = 25,
		SendBufferSize = 9,
		SendRateMin = 10,
		SendRateMax = 11,
		NagleTime = 12,
		IPAllowWithoutAuth = 23,
		MTUPacketSize = 32,
		MTUDataSize = 33,
		Unencrypted = 34,
		EnumerateDevVars = 35,
		SymmetricConnect = 37,
		LocalVirtualPort = 38,
		ConnectionStatusChanged = 201,
		AuthStatusChanged = 202,
		RelayNetworkStatusChanged = 203,
		MessagesSessionRequest = 204,
		MessagesSessionFailed = 205,
		P2PSTUNServerList = 103,
		P2PTransportICEEnable = 104,
		P2PTransportICEPenalty = 105,
		P2PTransportSDRPenalty = 106,
		SDRClientConsecutitivePingTimeoutsFailInitial = 19,
		SDRClientConsecutitivePingTimeoutsFail = 20,
		SDRClientMinPingsBeforePingAccurate = 21,
		SDRClientSingleSocket = 22,
		SDRClientForceRelayCluster = 29,
		SDRClientDebugTicketAddress = 30,
		SDRClientForceProxyAddr = 31,
		SDRClientFakeClusterPing = 36,
		LogLevelAckRTT = 13,
		LogLevelPacketDecode = 14,
		LogLevelMessage = 15,
		LogLevelPacketGaps = 16,
		LogLevelP2PRendezvous = 17,
		LogLevelSDRRelayPings = 18
	}
	public enum ConfigurationValueResult
	{
		BadValue = -1,
		BadScopeObject = -2,
		BufferTooSmall = -3,
		OK = 1,
		OKInherited = 2
	}
	public enum DebugType
	{
		None,
		Bug,
		Error,
		Important,
		Warning,
		Message,
		Verbose,
		Debug,
		Everything
	}
	public enum Result
	{
		OK = 1,
		Fail = 2,
		NoConnection = 3,
		InvalidPassword = 5,
		LoggedInElsewhere = 6,
		InvalidProtocolVer = 7,
		InvalidParam = 8,
		FileNotFound = 9,
		Busy = 10,
		InvalidState = 11,
		InvalidName = 12,
		InvalidEmail = 13,
		DuplicateName = 14,
		AccessDenied = 15,
		Timeout = 16,
		Banned = 17,
		AccountNotFound = 18,
		InvalidSteamID = 19,
		ServiceUnavailable = 20,
		NotLoggedOn = 21,
		Pending = 22,
		EncryptionFailure = 23,
		InsufficientPrivilege = 24,
		LimitExceeded = 25,
		Revoked = 26,
		Expired = 27,
		AlreadyRedeemed = 28,
		DuplicateRequest = 29,
		AlreadyOwned = 30,
		IPNotFound = 31,
		PersistFailed = 32,
		LockingFailed = 33,
		LogonSessionReplaced = 34,
		ConnectFailed = 35,
		HandshakeFailed = 36,
		IOFailure = 37,
		RemoteDisconnect = 38,
		ShoppingCartNotFound = 39,
		Blocked = 40,
		Ignored = 41,
		NoMatch = 42,
		AccountDisabled = 43,
		ServiceReadOnly = 44,
		AccountNotFeatured = 45,
		AdministratorOK = 46,
		ContentVersion = 47,
		TryAnotherCM = 48,
		PasswordRequiredToKickSession = 49,
		AlreadyLoggedInElsewhere = 50,
		Suspended = 51,
		Cancelled = 52,
		DataCorruption = 53,
		DiskFull = 54,
		RemoteCallFailed = 55,
		PasswordUnset = 56,
		ExternalAccountUnlinked = 57,
		PSNTicketInvalid = 58,
		ExternalAccountAlreadyLinked = 59,
		RemoteFileConflict = 60,
		IllegalPassword = 61,
		SameAsPreviousValue = 62,
		AccountLogonDenied = 63,
		CannotUseOldPassword = 64,
		InvalidLoginAuthCode = 65,
		AccountLogonDeniedNoMail = 66,
		HardwareNotCapableOfIPT = 67,
		IPTInitError = 68,
		ParentalControlRestricted = 69,
		FacebookQueryError = 70,
		ExpiredLoginAuthCode = 71,
		IPLoginRestrictionFailed = 72,
		AccountLockedDown = 73,
		AccountLogonDeniedVerifiedEmailRequired = 74,
		NoMatchingURL = 75,
		BadResponse = 76,
		RequirePasswordReEntry = 77,
		ValueOutOfRange = 78,
		UnexpectedError = 79,
		Disabled = 80,
		InvalidCEGSubmission = 81,
		RestrictedDevice = 82,
		RegionLocked = 83,
		RateLimitExceeded = 84,
		AccountLoginDeniedNeedTwoFactor = 85,
		ItemDeleted = 86,
		AccountLoginDeniedThrottle = 87,
		TwoFactorCodeMismatch = 88,
		TwoFactorActivationCodeMismatch = 89,
		AccountAssociatedToMultiplePartners = 90,
		NotModified = 91,
		NoMobileDevice = 92,
		TimeNotSynced = 93,
		SmsCodeFailed = 94,
		AccountLimitExceeded = 95,
		AccountActivityLimitExceeded = 96,
		PhoneActivityLimitExceeded = 97,
		RefundToWallet = 98,
		EmailSendFailure = 99,
		NotSettled = 100,
		NeedCaptcha = 101,
		GSLTDenied = 102,
		GSOwnerDenied = 103,
		InvalidItemType = 104,
		IPBanned = 105,
		GSLTExpired = 106,
		InsufficientFunds = 107,
		TooManyPending = 108,
		NoSiteLicensesFound = 109,
		WGNetworkSendExceeded = 110
	}
	public struct Address : IEquatable<Address>
	{
		[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
		public byte[] ip;

		public ushort port;

		public bool IsLocalHost => Native.SteamAPI_SteamNetworkingIPAddr_IsLocalHost(ref this);

		public string GetIP()
		{
			return ip.ParseIP();
		}

		public void SetLocalHost(ushort port)
		{
			Native.SteamAPI_SteamNetworkingIPAddr_SetIPv6LocalHost(ref this, port);
		}

		public void SetAddress(string ip, ushort port)
		{
			if (!ip.Contains(":"))
			{
				Native.SteamAPI_SteamNetworkingIPAddr_SetIPv4(ref this, ip.ParseIPv4(), port);
			}
			else
			{
				Native.SteamAPI_SteamNetworkingIPAddr_SetIPv6(ref this, ip.ParseIPv6(), port);
			}
		}

		public bool Equals(Address other)
		{
			return Native.SteamAPI_SteamNetworkingIPAddr_IsEqualTo(ref this, ref other);
		}
	}
	public struct Configuration
	{
		[StructLayout(LayoutKind.Explicit)]
		public struct ConfigurationData
		{
			[FieldOffset(0)]
			public int Int32;

			[FieldOffset(0)]
			public long Int64;

			[FieldOffset(0)]
			public float Float;

			[FieldOffset(0)]
			public IntPtr String;

			[FieldOffset(0)]
			public IntPtr FunctionPtr;
		}

		public ConfigurationValue value;

		public ConfigurationDataType dataType;

		public ConfigurationData data;
	}
	[StructLayout(LayoutKind.Sequential, Pack = 8)]
	public struct StatusInfo
	{
		private const int callback = 1221;

		public uint connection;

		public ConnectionInfo connectionInfo;

		private ConnectionState oldState;
	}
	public struct ConnectionInfo
	{
		public NetworkingIdentity identity;

		public long userData;

		public uint listenSocket;

		public Address address;

		private ushort pad;

		private uint popRemote;

		private uint popRelay;

		public ConnectionState state;

		public int endReason;

		[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)]
		public string endDebug;

		[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)]
		public string connectionDescription;

		[MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)]
		private uint[] reserved;
	}
	public struct ConnectionStatus
	{
		public ConnectionState state;

		public int ping;

		public float connectionQualityLocal;

		public float connectionQualityRemote;

		public float outPacketsPerSecond;

		public float outBytesPerSecond;

		public float inPacketsPerSecond;

		public float inBytesPerSecond;

		public int sendRateBytesPerSecond;

		public int pendingUnreliable;

		public int pendingReliable;

		public int sentUnackedReliable;

		public long queueTime;

		[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
		private uint[] reserved;
	}
	[StructLayout(LayoutKind.Explicit, Size = 136)]
	public struct NetworkingIdentity
	{
		[FieldOffset(0)]
		public IdentityType type;

		public bool IsInvalid => Native.SteamAPI_SteamNetworkingIdentity_IsInvalid(ref this);

		public ulong GetSteamID()
		{
			return Native.SteamAPI_SteamNetworkingIdentity_GetSteamID64(ref this);
		}

		public void SetSteamID(ulong steamID)
		{
			Native.SteamAPI_SteamNetworkingIdentity_SetSteamID64(ref this, steamID);
		}
	}
	public struct NetworkingMessage
	{
		public IntPtr data;

		public int length;

		public uint connection;

		public NetworkingIdentity identity;

		public long connectionUserData;

		public long timeReceived;

		public long messageNumber;

		internal IntPtr freeData;

		internal IntPtr release;

		public int channel;

		public int flags;

		public long userData;

		public void CopyTo(byte[] destination)
		{
			if (destination == null)
			{
				throw new ArgumentNullException("destination");
			}
			Marshal.Copy(data, destination, 0, length);
		}

		public void Destroy()
		{
			if (release == IntPtr.Zero)
			{
				throw new InvalidOperationException("Message not created");
			}
			Native.SteamAPI_SteamNetworkingMessage_t_Release(release);
		}
	}
	public delegate void StatusCallback(ref StatusInfo info);
	public delegate void DebugCallback(DebugType type, string message);
	internal static class ArrayPool
	{
		[ThreadStatic]
		private static IntPtr[] pointerBuffer;

		public static IntPtr[] GetPointerBuffer()
		{
			if (pointerBuffer == null)
			{
				pointerBuffer = new IntPtr[256];
			}
			return pointerBuffer;
		}
	}
	public class NetworkingSockets
	{
		private IntPtr nativeSockets;

		public NetworkingSockets()
		{
			nativeSockets = Native.SteamAPI_SteamNetworkingSockets_v009();
			if (nativeSockets == IntPtr.Zero)
			{
				throw new InvalidOperationException("Networking sockets not created");
			}
		}

		public uint CreateListenSocket(ref Address address)
		{
			return Native.SteamAPI_ISteamNetworkingSockets_CreateListenSocketIP(nativeSockets, ref address, 0, IntPtr.Zero);
		}

		public uint CreateListenSocket(ref Address address, Configuration[] configurations)
		{
			if (configurations == null)
			{
				throw new ArgumentNullException("configurations");
			}
			return Native.SteamAPI_ISteamNetworkingSockets_CreateListenSocketIP2(nativeSockets, ref address, configurations.Length, configurations);
		}

		public uint Connect(ref Address address)
		{
			return Native.SteamAPI_ISteamNetworkingSockets_ConnectByIPAddress(nativeSockets, ref address, 0, IntPtr.Zero);
		}

		public uint Connect(ref Address address, Configuration[] configurations)
		{
			if (configurations == null)
			{
				throw new ArgumentNullException("configurations");
			}
			return Native.SteamAPI_ISteamNetworkingSockets_ConnectByIPAddress2(nativeSockets, ref address, configurations.Length, configurations);
		}

		public Result AcceptConnection(uint connection)
		{
			return Native.SteamAPI_ISteamNetworkingSockets_AcceptConnection(nativeSockets, connection);
		}

		public bool CloseConnection(uint connection)
		{
			return CloseConnection(connection, 0, string.Empty, enableLinger: false);
		}

		public bool CloseConnection(uint connection, int reason, string debug, bool enableLinger)
		{
			if (debug.Length > 128)
			{
				throw new ArgumentOutOfRangeException("debug");
			}
			return Native.SteamAPI_ISteamNetworkingSockets_CloseConnection(nativeSockets, connection, reason, debug, enableLinger);
		}

		public bool CloseListenSocket(uint socket)
		{
			return Native.SteamAPI_ISteamNetworkingSockets_CloseListenSocket(nativeSockets, socket);
		}

		public bool SetConnectionUserData(uint peer, long userData)
		{
			return Native.SteamAPI_ISteamNetworkingSockets_SetConnectionUserData(nativeSockets, peer, userData);
		}

		public long GetConnectionUserData(uint peer)
		{
			return Native.SteamAPI_ISteamNetworkingSockets_GetConnectionUserData(nativeSockets, peer);
		}

		public void SetConnectionName(uint peer, string name)
		{
			Native.SteamAPI_ISteamNetworkingSockets_SetConnectionName(nativeSockets, peer, name);
		}

		public bool GetConnectionName(uint peer, StringBuilder name, int maxLength)
		{
			return Native.SteamAPI_ISteamNetworkingSockets_GetConnectionName(nativeSockets, peer, name, maxLength);
		}

		public Result SendMessageToConnection(uint connection, IntPtr data, uint length)
		{
			return SendMessageToConnection(connection, data, length, SendFlags.Unreliable);
		}

		public Result SendMessageToConnection(uint connection, IntPtr data, uint length, SendFlags flags)
		{
			return Native.SteamAPI_ISteamNetworkingSockets_SendMessageToConnection(nativeSockets, connection, data, length, flags, IntPtr.Zero);
		}

		public Result SendMessageToConnection(uint connection, IntPtr data, int length, SendFlags flags)
		{
			return SendMessageToConnection(connection, data, (uint)length, flags);
		}

		public Result SendMessageToConnection(uint connection, byte[] data)
		{
			if (data == null)
			{
				throw new ArgumentNullException("data");
			}
			return SendMessageToConnection(connection, data, data.Length, SendFlags.Unreliable);
		}

		public Result SendMessageToConnection(uint connection, byte[] data, SendFlags flags)
		{
			if (data == null)
			{
				throw new ArgumentNullException("data");
			}
			return SendMessageToConnection(connection, data, data.Length, flags);
		}

		public Result SendMessageToConnection(uint connection, byte[] data, int length, SendFlags flags)
		{
			if (data == null)
			{
				throw new ArgumentNullException("data");
			}
			return Native.SteamAPI_ISteamNetworkingSockets_SendMessageToConnection2(nativeSockets, connection, data, (uint)length, flags, IntPtr.Zero);
		}

		public Result FlushMessagesOnConnection(uint connection)
		{
			return Native.SteamAPI_ISteamNetworkingSockets_FlushMessagesOnConnection(nativeSockets, connection);
		}

		public bool GetConnectionInfo(uint connection, ref ConnectionInfo info)
		{
			return Native.SteamAPI_ISteamNetworkingSockets_GetConnectionInfo(nativeSockets, connection, ref info);
		}

		public bool GetQuickConnectionStatus(uint connection, ref ConnectionStatus status)
		{
			return Native.SteamAPI_ISteamNetworkingSockets_GetQuickConnectionStatus(nativeSockets, connection, ref status);
		}

		public int GetDetailedConnectionStatus(uint connection, StringBuilder status, int statusLength)
		{
			return Native.SteamAPI_ISteamNetworkingSockets_GetDetailedConnectionStatus(nativeSockets, connection, status, statusLength);
		}

		public bool GetListenSocketAddress(uint socket, ref Address address)
		{
			return Native.SteamAPI_ISteamNetworkingSockets_GetListenSocketAddress(nativeSockets, socket, ref address);
		}

		public bool CreateSocketPair(uint connectionLeft, uint connectionRight, bool useNetworkLoopback, ref NetworkingIdentity identityLeft, ref NetworkingIdentity identityRight)
		{
			return Native.SteamAPI_ISteamNetworkingSockets_CreateSocketPair(nativeSockets, connectionLeft, connectionRight, useNetworkLoopback, ref identityLeft, ref identityRight);
		}

		public bool GetIdentity(ref NetworkingIdentity identity)
		{
			return Native.SteamAPI_ISteamNetworkingSockets_GetIdentity(nativeSockets, ref identity);
		}

		public uint CreatePollGroup()
		{
			return Native.SteamAPI_ISteamNetworkingSockets_CreatePollGroup(nativeSockets);
		}

		public bool DestroyPollGroup(uint pollGroup)
		{
			return Native.SteamAPI_ISteamNetworkingSockets_DestroyPollGroup(nativeSockets, pollGroup);
		}

		public bool SetConnectionPollGroup(uint pollGroup, uint connection)
		{
			return Native.SteamAPI_ISteamNetworkingSockets_SetConnectionPollGroup(nativeSockets, connection, pollGroup);
		}

		public void RunCallbacks()
		{
			Native.SteamAPI_ISteamNetworkingSockets_RunCallbacks(nativeSockets);
		}

		public void Poll(int msMaxWaitTime)
		{
			Native.SteamNetworkingSockets_Poll(msMaxWaitTime);
		}

		public void SetManualPollMode(bool bFlag)
		{
			Native.SteamNetworkingSockets_SetManualPollMode(bFlag);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public int ReceiveMessagesOnConnection(uint connection, NetworkingMessage[] messages, int maxMessages)
		{
			if (messages == null)
			{
				throw new ArgumentNullException("messages");
			}
			if (maxMessages > 256)
			{
				throw new ArgumentOutOfRangeException("maxMessages");
			}
			IntPtr[] pointerBuffer = ArrayPool.GetPointerBuffer();
			int num = Native.SteamAPI_ISteamNetworkingSockets_ReceiveMessagesOnConnection(nativeSockets, connection, pointerBuffer, maxMessages);
			for (int i = 0; i < num; i++)
			{
				messages[i] = (NetworkingMessage)Marshal.PtrToStructure(pointerBuffer[i], typeof(NetworkingMessage));
				messages[i].release = pointerBuffer[i];
			}
			return num;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public int ReceiveMessagesOnPollGroup(uint pollGroup, NetworkingMessage[] messages, int maxMessages)
		{
			if (messages == null)
			{
				throw new ArgumentNullException("messages");
			}
			if (maxMessages > 256)
			{
				throw new ArgumentOutOfRangeException("maxMessages");
			}
			IntPtr[] pointerBuffer = ArrayPool.GetPointerBuffer();
			int num = Native.SteamAPI_ISteamNetworkingSockets_ReceiveMessagesOnPollGroup(nativeSockets, pollGroup, pointerBuffer, maxMessages);
			for (int i = 0; i < num; i++)
			{
				messages[i] = (NetworkingMessage)Marshal.PtrToStructure(pointerBuffer[i], typeof(NetworkingMessage));
				messages[i].release = pointerBuffer[i];
			}
			return num;
		}
	}
	public class NetworkingUtils : IDisposable
	{
		private IntPtr nativeUtils;

		public long Time => Native.SteamAPI_ISteamNetworkingUtils_GetLocalTimestamp(nativeUtils);

		public ConfigurationValue FirstConfigurationValue => Native.SteamAPI_ISteamNetworkingUtils_GetFirstConfigValue(nativeUtils);

		public NetworkingUtils()
		{
			nativeUtils = Native.SteamAPI_SteamNetworkingUtils_v003();
			if (nativeUtils == IntPtr.Zero)
			{
				throw new InvalidOperationException("Networking utils not created");
			}
		}

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

		protected virtual void Dispose(bool disposing)
		{
			if (nativeUtils != IntPtr.Zero)
			{
				Native.SteamAPI_ISteamNetworkingUtils_SetGlobalCallback_SteamNetConnectionStatusChanged(nativeUtils, IntPtr.Zero);
				Native.SteamAPI_ISteamNetworkingUtils_SetDebugOutputFunction(nativeUtils, DebugType.None, IntPtr.Zero);
				nativeUtils = IntPtr.Zero;
			}
		}

		public bool SetStatusCallback(StatusCallback callback)
		{
			return Native.SteamAPI_ISteamNetworkingUtils_SetGlobalCallback_SteamNetConnectionStatusChanged2(nativeUtils, callback);
		}

		public void SetDebugCallback(DebugType detailLevel, DebugCallback callback)
		{
			Native.SteamAPI_ISteamNetworkingUtils_SetDebugOutputFunction2(nativeUtils, detailLevel, callback);
		}

		public bool SetConfigurationValue(ConfigurationValue configurationValue, ConfigurationScope configurationScope, IntPtr scopeObject, ConfigurationDataType dataType, IntPtr value)
		{
			return Native.SteamAPI_ISteamNetworkingUtils_SetConfigValue(nativeUtils, configurationValue, configurationScope, scopeObject, dataType, value);
		}

		public bool SetConfigurationValue(Configuration configuration, ConfigurationScope configurationScope, IntPtr scopeObject)
		{
			return Native.SteamAPI_ISteamNetworkingUtils_SetConfigValueStruct(nativeUtils, configuration, configurationScope, scopeObject);
		}

		public ConfigurationValueResult GetConfigurationValue(ConfigurationValue configurationValue, ConfigurationScope configurationScope, IntPtr scopeObject, ref ConfigurationDataType dataType, ref IntPtr result, ref IntPtr resultLength)
		{
			return Native.SteamAPI_ISteamNetworkingUtils_GetConfigValue(nativeUtils, configurationValue, configurationScope, scopeObject, ref dataType, ref result, ref resultLength);
		}
	}
	public static class Extensions
	{
		public static uint ParseIPv4(this string ip)
		{
			IPAddress address = null;
			if (IPAddress.TryParse(ip, out address) && address.AddressFamily != AddressFamily.InterNetwork)
			{
				throw new Exception("Incorrect format of an IPv4 address");
			}
			byte[] addressBytes = address.GetAddressBytes();
			Array.Reverse((Array)addressBytes);
			return BitConverter.ToUInt32(addressBytes, 0);
		}

		public static byte[] ParseIPv6(this string ip)
		{
			IPAddress address = null;
			if (IPAddress.TryParse(ip, out address) && address.AddressFamily != AddressFamily.InterNetworkV6)
			{
				throw new Exception("Incorrect format of an IPv6 address");
			}
			return address.GetAddressBytes();
		}

		public static string ParseIP(this byte[] ip)
		{
			IPAddress iPAddress = new IPAddress(ip);
			string text = iPAddress.ToString();
			if (text.Length > 7 && text.Remove(7) == "::ffff:")
			{
				Address address = default(Address);
				address.ip = ip;
				byte[] bytes = BitConverter.GetBytes(Native.SteamAPI_SteamNetworkingIPAddr_GetIPv4(ref address));
				Array.Reverse((Array)bytes);
				iPAddress = new IPAddress(bytes);
			}
			return iPAddress.ToString();
		}
	}
	public static class Library
	{
		public const int maxCloseMessageLength = 128;

		public const int maxErrorMessageLength = 1024;

		public const int maxMessagesPerBatch = 256;

		public const int maxMessageSize = 524288;

		public const int socketsCallbacks = 1220;

		private static bool initialized;

		public static bool Initialize()
		{
			if (initialized)
			{
				return false;
			}
			return Initialize(null);
		}

		public static bool Initialize(StringBuilder errorMessage)
		{
			if (initialized)
			{
				return false;
			}
			if (errorMessage != null && errorMessage.Capacity != 1024)
			{
				throw new ArgumentOutOfRangeException("Capacity of the error message must be equal to " + 1024);
			}
			initialized = Native.GameNetworkingSockets_Init(IntPtr.Zero, errorMessage);
			return initialized;
		}

		public static bool Initialize(ref NetworkingIdentity identity, StringBuilder errorMessage)
		{
			if (initialized)
			{
				return false;
			}
			if (errorMessage != null && errorMessage.Capacity != 1024)
			{
				throw new ArgumentOutOfRangeException("Capacity of the error message must be equal to " + 1024);
			}
			if (object.Equals(identity, null))
			{
				throw new ArgumentNullException("identity");
			}
			initialized = Native.GameNetworkingSockets_Init2(ref identity, errorMessage);
			return initialized;
		}

		public static void Deinitialize()
		{
			if (initialized)
			{
				initialized = false;
				Native.GameNetworkingSockets_Kill();
			}
		}
	}
	[SuppressUnmanagedCodeSecurity]
	internal static class Native
	{
		internal delegate bool GameNetworkingSockets_Init_Delegate(IntPtr identity, StringBuilder errorMessage);

		internal delegate bool GameNetworkingSockets_Init_Delegate2(ref NetworkingIdentity identity, StringBuilder errorMessage);

		internal delegate void GameNetworkingSockets_Kill_Delegate();

		internal delegate IntPtr SteamAPI_SteamNetworkingSockets_v009_Delegate();

		internal delegate IntPtr SteamAPI_SteamNetworkingUtils_v003_Delegate();

		internal delegate uint SteamAPI_ISteamNetworkingSockets_CreateListenSocketIP_Delegate(IntPtr sockets, ref Address address, int configurationsCount, IntPtr configurations);

		internal delegate uint SteamAPI_ISteamNetworkingSockets_CreateListenSocketIP_Delegate2(IntPtr sockets, ref Address address, int configurationsCount, Configuration[] configurations);

		internal delegate uint SteamAPI_ISteamNetworkingSockets_ConnectByIPAddress_Delegate(IntPtr sockets, ref Address address, int configurationsCount, IntPtr configurations);

		internal delegate uint SteamAPI_ISteamNetworkingSockets_ConnectByIPAddress_Delegate2(IntPtr sockets, ref Address address, int configurationsCount, Configuration[] configurations);

		internal delegate Result SteamAPI_ISteamNetworkingSockets_AcceptConnection_Delegate(IntPtr sockets, uint connection);

		internal delegate bool SteamAPI_ISteamNetworkingSockets_CloseConnection_Delegate(IntPtr sockets, uint peer, int reason, string debug, bool enableLinger);

		internal delegate bool SteamAPI_ISteamNetworkingSockets_CloseListenSocket_Delegate(IntPtr sockets, uint socket);

		internal delegate bool SteamAPI_ISteamNetworkingSockets_SetConnectionUserData_Delegate(IntPtr sockets, uint peer, long userData);

		internal delegate long SteamAPI_ISteamNetworkingSockets_GetConnectionUserData_Delegate(IntPtr sockets, uint peer);

		internal delegate void SteamAPI_ISteamNetworkingSockets_SetConnectionName_Delegate(IntPtr sockets, uint peer, string name);

		internal delegate bool SteamAPI_ISteamNetworkingSockets_GetConnectionName_Delegate(IntPtr sockets, uint peer, StringBuilder name, int maxLength);

		internal delegate Result SteamAPI_ISteamNetworkingSockets_SendMessageToConnection_Delegate(IntPtr sockets, uint connection, IntPtr data, uint length, SendFlags flags, IntPtr outMessageNumber);

		internal delegate Result SteamAPI_ISteamNetworkingSockets_SendMessageToConnection_Delegate2(IntPtr sockets, uint connection, byte[] data, uint length, SendFlags flags, IntPtr outMessageNumber);

		internal delegate Result SteamAPI_ISteamNetworkingSockets_FlushMessagesOnConnection_Delegate(IntPtr sockets, uint connection);

		internal delegate int SteamAPI_ISteamNetworkingSockets_ReceiveMessagesOnConnection_Delegate(IntPtr sockets, uint connection, IntPtr[] messages, int maxMessages);

		internal delegate bool SteamAPI_ISteamNetworkingSockets_GetConnectionInfo_Delegate(IntPtr sockets, uint connection, ref ConnectionInfo info);

		internal delegate bool SteamAPI_ISteamNetworkingSockets_GetQuickConnectionStatus_Delegate(IntPtr sockets, uint connection, ref ConnectionStatus status);

		internal delegate int SteamAPI_ISteamNetworkingSockets_GetDetailedConnectionStatus_Delegate(IntPtr sockets, uint connection, StringBuilder status, int statusLength);

		internal delegate bool SteamAPI_ISteamNetworkingSockets_GetListenSocketAddress_Delegate(IntPtr sockets, uint socket, ref Address address);

		internal delegate void SteamAPI_ISteamNetworkingSockets_RunCallbacks_Delegate(IntPtr sockets);

		internal delegate bool SteamAPI_ISteamNetworkingSockets_CreateSocketPair_Delegate(IntPtr sockets, uint connectionLeft, uint connectionRight, bool useNetworkLoopback, ref NetworkingIdentity identityLeft, ref NetworkingIdentity identityRight);

		internal delegate bool SteamAPI_ISteamNetworkingSockets_GetIdentity_Delegate(IntPtr sockets, ref NetworkingIdentity identity);

		internal delegate uint SteamAPI_ISteamNetworkingSockets_CreatePollGroup_Delegate(IntPtr sockets);

		internal delegate bool SteamAPI_ISteamNetworkingSockets_DestroyPollGroup_Delegate(IntPtr sockets, uint pollGroup);

		internal delegate bool SteamAPI_ISteamNetworkingSockets_SetConnectionPollGroup_Delegate(IntPtr sockets, uint connection, uint pollGroup);

		internal delegate int SteamAPI_ISteamNetworkingSockets_ReceiveMessagesOnPollGroup_Delegate(IntPtr sockets, uint pollGroup, IntPtr[] messages, int maxMessages);

		internal delegate void SteamAPI_SteamNetworkingIPAddr_SetIPv6_Delegate(ref Address address, byte[] ip, ushort port);

		internal delegate void SteamAPI_SteamNetworkingIPAddr_SetIPv4_Delegate(ref Address address, uint ip, ushort port);

		internal delegate uint SteamAPI_SteamNetworkingIPAddr_GetIPv4_Delegate(ref Address address);

		internal delegate void SteamAPI_SteamNetworkingIPAddr_SetIPv6LocalHost_Delegate(ref Address address, ushort port);

		internal delegate bool SteamAPI_SteamNetworkingIPAddr_IsLocalHost_Delegate(ref Address address);

		internal delegate bool SteamAPI_SteamNetworkingIPAddr_IsEqualTo_Delegate(ref Address address, ref Address other);

		internal delegate bool SteamAPI_SteamNetworkingIdentity_IsInvalid_Delegate(ref NetworkingIdentity identity);

		internal delegate void SteamAPI_SteamNetworkingIdentity_SetSteamID64_Delegate(ref NetworkingIdentity identity, ulong steamID);

		internal delegate ulong SteamAPI_SteamNetworkingIdentity_GetSteamID64_Delegate(ref NetworkingIdentity identity);

		internal delegate long SteamAPI_ISteamNetworkingUtils_GetLocalTimestamp_Delegate(IntPtr utils);

		internal delegate bool SteamAPI_ISteamNetworkingUtils_SetGlobalCallback_SteamNetConnectionStatusChanged_Delegate(IntPtr utils, IntPtr callback);

		internal delegate bool SteamAPI_ISteamNetworkingUtils_SetGlobalCallback_SteamNetConnectionStatusChanged_Delegate2(IntPtr utils, StatusCallback callback);

		internal delegate void SteamAPI_ISteamNetworkingUtils_SetDebugOutputFunction_Delegate(IntPtr utils, DebugType detailLevel, IntPtr callback);

		internal delegate void SteamAPI_ISteamNetworkingUtils_SetDebugOutputFunction_Delegate2(IntPtr utils, DebugType detailLevel, DebugCallback callback);

		internal delegate bool SteamAPI_ISteamNetworkingUtils_SetConfigValue_Delegate(IntPtr utils, ConfigurationValue configurationValue, ConfigurationScope configurationScope, IntPtr scopeObject, ConfigurationDataType dataType, IntPtr value);

		internal delegate bool SteamAPI_ISteamNetworkingUtils_SetConfigValueStruct_Delegate(IntPtr utils, Configuration configuration, ConfigurationScope configurationScope, IntPtr scopeObject);

		internal delegate ConfigurationValueResult SteamAPI_ISteamNetworkingUtils_GetConfigValue_Delegate(IntPtr utils, ConfigurationValue configurationValue, ConfigurationScope configurationScope, IntPtr scopeObject, ref ConfigurationDataType dataType, ref IntPtr result, ref IntPtr resultLength);

		internal delegate ConfigurationValue SteamAPI_ISteamNetworkingUtils_GetFirstConfigValue_Delegate(IntPtr utils);

		internal delegate void SteamAPI_SteamNetworkingMessage_t_Release_Delegate(IntPtr nativeMessage);

		internal delegate void SteamNetworkingSockets_Poll_Delegate(int msMaxWaitTime);

		internal delegate void SteamNetworkingSockets_SetManualPollMode_Delegate(bool bFlag);

		private const string nativeLibrary = "GameNetworkingSockets.dll";

		public const int PackSize = 8;

		[DynDllImport("GameNetworkingSockets.dll", new string[] { })]
		internal static GameNetworkingSockets_Init_Delegate GameNetworkingSockets_Init;

		[DynDllImport("GameNetworkingSockets.dll", new string[] { }, EntryPoints = new string[] { "GameNetworkingSockets_Init" })]
		internal static GameNetworkingSockets_Init_Delegate2 GameNetworkingSockets_Init2;

		[DynDllImport("GameNetworkingSockets.dll", new string[] { })]
		internal static GameNetworkingSockets_Kill_Delegate GameNetworkingSockets_Kill;

		[DynDllImport("GameNetworkingSockets.dll", new string[] { })]
		internal static SteamAPI_SteamNetworkingSockets_v009_Delegate SteamAPI_SteamNetworkingSockets_v009;

		[DynDllImport("GameNetworkingSockets.dll", new string[] { })]
		internal static SteamAPI_SteamNetworkingUtils_v003_Delegate SteamAPI_SteamNetworkingUtils_v003;

		[DynDllImport("GameNetworkingSockets.dll", new string[] { })]
		internal static SteamAPI_ISteamNetworkingSockets_CreateListenSocketIP_Delegate SteamAPI_ISteamNetworkingSockets_CreateListenSocketIP;

		[DynDllImport("GameNetworkingSockets.dll", new string[] { }, EntryPoints = new string[] { "SteamAPI_ISteamNetworkingSockets_CreateListenSocketIP" })]
		internal static SteamAPI_ISteamNetworkingSockets_CreateListenSocketIP_Delegate2 SteamAPI_ISteamNetworkingSockets_CreateListenSocketIP2;

		[DynDllImport("GameNetworkingSockets.dll", new string[] { })]
		internal static SteamAPI_ISteamNetworkingSockets_ConnectByIPAddress_Delegate SteamAPI_ISteamNetworkingSockets_ConnectByIPAddress;

		[DynDllImport("GameNetworkingSockets.dll", new string[] { }, EntryPoints = new string[] { "SteamAPI_ISteamNetworkingSockets_ConnectByIPAddress" })]
		internal static SteamAPI_ISteamNetworkingSockets_ConnectByIPAddress_Delegate2 SteamAPI_ISteamNetworkingSockets_ConnectByIPAddress2;

		[DynDllImport("GameNetworkingSockets.dll", new string[] { })]
		internal static SteamAPI_ISteamNetworkingSockets_AcceptConnection_Delegate SteamAPI_ISteamNetworkingSockets_AcceptConnection;

		[DynDllImport("GameNetworkingSockets.dll", new string[] { })]
		internal static SteamAPI_ISteamNetworkingSockets_CloseConnection_Delegate SteamAPI_ISteamNetworkingSockets_CloseConnection;

		[DynDllImport("GameNetworkingSockets.dll", new string[] { })]
		internal static SteamAPI_ISteamNetworkingSockets_CloseListenSocket_Delegate SteamAPI_ISteamNetworkingSockets_CloseListenSocket;

		[DynDllImport("GameNetworkingSockets.dll", new string[] { })]
		internal static SteamAPI_ISteamNetworkingSockets_SetConnectionUserData_Delegate SteamAPI_ISteamNetworkingSockets_SetConnectionUserData;

		[DynDllImport("GameNetworkingSockets.dll", new string[] { })]
		internal static SteamAPI_ISteamNetworkingSockets_GetConnectionUserData_Delegate SteamAPI_ISteamNetworkingSockets_GetConnectionUserData;

		[DynDllImport("GameNetworkingSockets.dll", new string[] { })]
		internal static SteamAPI_ISteamNetworkingSockets_SetConnectionName_Delegate SteamAPI_ISteamNetworkingSockets_SetConnectionName;

		[DynDllImport("GameNetworkingSockets.dll", new string[] { })]
		internal static SteamAPI_ISteamNetworkingSockets_GetConnectionName_Delegate SteamAPI_ISteamNetworkingSockets_GetConnectionName;

		[DynDllImport("GameNetworkingSockets.dll", new string[] { })]
		internal static SteamAPI_ISteamNetworkingSockets_SendMessageToConnection_Delegate SteamAPI_ISteamNetworkingSockets_SendMessageToConnection;

		[DynDllImport("GameNetworkingSockets.dll", new string[] { }, EntryPoints = new string[] { "SteamAPI_ISteamNetworkingSockets_SendMessageToConnection" })]
		internal static SteamAPI_ISteamNetworkingSockets_SendMessageToConnection_Delegate2 SteamAPI_ISteamNetworkingSockets_SendMessageToConnection2;

		[DynDllImport("GameNetworkingSockets.dll", new string[] { })]
		internal static SteamAPI_ISteamNetworkingSockets_FlushMessagesOnConnection_Delegate SteamAPI_ISteamNetworkingSockets_FlushMessagesOnConnection;

		[DynDllImport("GameNetworkingSockets.dll", new string[] { })]
		internal static SteamAPI_ISteamNetworkingSockets_ReceiveMessagesOnConnection_Delegate SteamAPI_ISteamNetworkingSockets_ReceiveMessagesOnConnection;

		[DynDllImport("GameNetworkingSockets.dll", new string[] { })]
		internal static SteamAPI_ISteamNetworkingSockets_GetConnectionInfo_Delegate SteamAPI_ISteamNetworkingSockets_GetConnectionInfo;

		[DynDllImport("GameNetworkingSockets.dll", new string[] { })]
		internal static SteamAPI_ISteamNetworkingSockets_GetQuickConnectionStatus_Delegate SteamAPI_ISteamNetworkingSockets_GetQuickConnectionStatus;

		[DynDllImport("GameNetworkingSockets.dll", new string[] { })]
		internal static SteamAPI_ISteamNetworkingSockets_GetDetailedConnectionStatus_Delegate SteamAPI_ISteamNetworkingSockets_GetDetailedConnectionStatus;

		[DynDllImport("GameNetworkingSockets.dll", new string[] { })]
		internal static SteamAPI_ISteamNetworkingSockets_GetListenSocketAddress_Delegate SteamAPI_ISteamNetworkingSockets_GetListenSocketAddress;

		[DynDllImport("GameNetworkingSockets.dll", new string[] { })]
		internal static SteamAPI_ISteamNetworkingSockets_RunCallbacks_Delegate SteamAPI_ISteamNetworkingSockets_RunCallbacks;

		[DynDllImport("GameNetworkingSockets.dll", new string[] { })]
		internal static SteamAPI_ISteamNetworkingSockets_CreateSocketPair_Delegate SteamAPI_ISteamNetworkingSockets_CreateSocketPair;

		[DynDllImport("GameNetworkingSockets.dll", new string[] { })]
		internal static SteamAPI_ISteamNetworkingSockets_GetIdentity_Delegate SteamAPI_ISteamNetworkingSockets_GetIdentity;

		[DynDllImport("GameNetworkingSockets.dll", new string[] { })]
		internal static SteamAPI_ISteamNetworkingSockets_CreatePollGroup_Delegate SteamAPI_ISteamNetworkingSockets_CreatePollGroup;

		[DynDllImport("GameNetworkingSockets.dll", new string[] { })]
		internal static SteamAPI_ISteamNetworkingSockets_DestroyPollGroup_Delegate SteamAPI_ISteamNetworkingSockets_DestroyPollGroup;

		[DynDllImport("GameNetworkingSockets.dll", new string[] { })]
		internal static SteamAPI_ISteamNetworkingSockets_SetConnectionPollGroup_Delegate SteamAPI_ISteamNetworkingSockets_SetConnectionPollGroup;

		[DynDllImport("GameNetworkingSockets.dll", new string[] { })]
		internal static SteamAPI_ISteamNetworkingSockets_ReceiveMessagesOnPollGroup_Delegate SteamAPI_ISteamNetworkingSockets_ReceiveMessagesOnPollGroup;

		[DynDllImport("GameNetworkingSockets.dll", new string[] { })]
		internal static SteamAPI_SteamNetworkingIPAddr_SetIPv6_Delegate SteamAPI_SteamNetworkingIPAddr_SetIPv6;

		[DynDllImport("GameNetworkingSockets.dll", new string[] { })]
		internal static SteamAPI_SteamNetworkingIPAddr_SetIPv4_Delegate SteamAPI_SteamNetworkingIPAddr_SetIPv4;

		[DynDllImport("GameNetworkingSockets.dll", new string[] { })]
		internal static SteamAPI_SteamNetworkingIPAddr_GetIPv4_Delegate SteamAPI_SteamNetworkingIPAddr_GetIPv4;

		[DynDllImport("GameNetworkingSockets.dll", new string[] { })]
		internal static SteamAPI_SteamNetworkingIPAddr_SetIPv6LocalHost_Delegate SteamAPI_SteamNetworkingIPAddr_SetIPv6LocalHost;

		[DynDllImport("GameNetworkingSockets.dll", new string[] { })]
		internal static SteamAPI_SteamNetworkingIPAddr_IsLocalHost_Delegate SteamAPI_SteamNetworkingIPAddr_IsLocalHost;

		[DynDllImport("GameNetworkingSockets.dll", new string[] { })]
		internal static SteamAPI_SteamNetworkingIPAddr_IsEqualTo_Delegate SteamAPI_SteamNetworkingIPAddr_IsEqualTo;

		[DynDllImport("GameNetworkingSockets.dll", new string[] { })]
		internal static SteamAPI_SteamNetworkingIdentity_IsInvalid_Delegate SteamAPI_SteamNetworkingIdentity_IsInvalid;

		[DynDllImport("GameNetworkingSockets.dll", new string[] { })]
		internal static SteamAPI_SteamNetworkingIdentity_SetSteamID64_Delegate SteamAPI_SteamNetworkingIdentity_SetSteamID64;

		[DynDllImport("GameNetworkingSockets.dll", new string[] { })]
		internal static SteamAPI_SteamNetworkingIdentity_GetSteamID64_Delegate SteamAPI_SteamNetworkingIdentity_GetSteamID64;

		[DynDllImport("GameNetworkingSockets.dll", new string[] { })]
		internal static SteamAPI_ISteamNetworkingUtils_GetLocalTimestamp_Delegate SteamAPI_ISteamNetworkingUtils_GetLocalTimestamp;

		[DynDllImport("GameNetworkingSockets.dll", new string[] { })]
		internal static SteamAPI_ISteamNetworkingUtils_SetGlobalCallback_SteamNetConnectionStatusChanged_Delegate SteamAPI_ISteamNetworkingUtils_SetGlobalCallback_SteamNetConnectionStatusChanged;

		[DynDllImport("GameNetworkingSockets.dll", new string[] { }, EntryPoints = new string[] { "SteamAPI_ISteamNetworkingUtils_SetGlobalCallback_SteamNetConnectionStatusChanged" })]
		internal static SteamAPI_ISteamNetworkingUtils_SetGlobalCallback_SteamNetConnectionStatusChanged_Delegate2 SteamAPI_ISteamNetworkingUtils_SetGlobalCallback_SteamNetConnectionStatusChanged2;

		[DynDllImport("GameNetworkingSockets.dll", new string[] { })]
		internal static SteamAPI_ISteamNetworkingUtils_SetDebugOutputFunction_Delegate SteamAPI_ISteamNetworkingUtils_SetDebugOutputFunction;

		[DynDllImport("GameNetworkingSockets.dll", new string[] { }, EntryPoints = new string[] { "SteamAPI_ISteamNetworkingUtils_SetDebugOutputFunction" })]
		internal static SteamAPI_ISteamNetworkingUtils_SetDebugOutputFunction_Delegate2 SteamAPI_ISteamNetworkingUtils_SetDebugOutputFunction2;

		[DynDllImport("GameNetworkingSockets.dll", new string[] { })]
		internal static SteamAPI_ISteamNetworkingUtils_SetConfigValue_Delegate SteamAPI_ISteamNetworkingUtils_SetConfigValue;

		[DynDllImport("GameNetworkingSockets.dll", new string[] { })]
		internal static SteamAPI_ISteamNetworkingUtils_SetConfigValueStruct_Delegate SteamAPI_ISteamNetworkingUtils_SetConfigValueStruct;

		[DynDllImport("GameNetworkingSockets.dll", new string[] { })]
		internal static SteamAPI_ISteamNetworkingUtils_GetConfigValue_Delegate SteamAPI_ISteamNetworkingUtils_GetConfigValue;

		[DynDllImport("GameNetworkingSockets.dll", new string[] { })]
		internal static SteamAPI_ISteamNetworkingUtils_GetFirstConfigValue_Delegate SteamAPI_ISteamNetworkingUtils_GetFirstConfigValue;

		[DynDllImport("GameNetworkingSockets.dll", new string[] { })]
		internal static SteamAPI_SteamNetworkingMessage_t_Release_Delegate SteamAPI_SteamNetworkingMessage_t_Release;

		[DynDllImport("GameNetworkingSockets.dll", new string[] { })]
		internal static SteamNetworkingSockets_Poll_Delegate SteamNetworkingSockets_Poll;

		[DynDllImport("GameNetworkingSockets.dll", new string[] { })]
		internal static SteamNetworkingSockets_SetManualPollMode_Delegate SteamNetworkingSockets_SetManualPollMode;

		[DllImport("kernel32", CharSet = CharSet.Unicode, SetLastError = true)]
		private static extern IntPtr LoadLibrary(string fileName);

		private static void LoadDependencies()
		{
			if (PlatformHelper.Is((Platform)37))
			{
				string? directoryName = Path.GetDirectoryName(typeof(Native).Assembly.Location);
				string text = Path.Combine(directoryName, "libcrypto-1_1-x64.dll");
				if (LoadLibrary(text) == IntPtr.Zero)
				{
					throw new IOException("Failed to load " + text + ", verify that the file exists and is not corrupted.");
				}
				text = Path.Combine(directoryName, "libprotobuf.dll");
				if (LoadLibrary(text) == IntPtr.Zero)
				{
					throw new IOException("Failed to load " + text + ", verify that the file exists and is not corrupted.");
				}
			}
		}

		static Native()
		{
			string location = Assembly.GetAssembly(typeof(Native)).Location;
			string path = string.Empty;
			LoadDependencies();
			if (!string.IsNullOrEmpty(location))
			{
				path = Path.GetDirectoryName(location);
			}
			Dictionary<string, List<DynDllMapping>> dictionary = new Dictionary<string, List<DynDllMapping>> { 
			{
				"GameNetworkingSockets.dll",
				new List<DynDllMapping>
				{
					DynDllMapping.op_Implicit("GameNetworkingSockets.dll"),
					DynDllMapping.op_Implicit(Path.Combine(path, "GameNetworkingSockets.dll"))
				}
			} };
			DynDll.ResolveDynDllImports(typeof(Native), dictionary);
		}
	}
}
namespace SlopCrew.Common.Proto
{
	public sealed class Quaternion : IMessage<Quaternion>, IMessage, IEquatable<Quaternion>, IDeepCloneable<Quaternion>, IBufferMessage
	{
		private static readonly MessageParser<Quaternion> _parser = new MessageParser<Quaternion>((Func<Quaternion>)(() => new Quaternion()));

		private UnknownFieldSet _unknownFields;

		public const int XFieldNumber = 1;

		private float x_;

		public const int YFieldNumber = 2;

		private float y_;

		public const int ZFieldNumber = 3;

		private float z_;

		public const int WFieldNumber = 4;

		private float w_;

		[DebuggerNonUserCode]
		[GeneratedCode("protoc", null)]
		public static MessageParser<Quaternion> Parser => _parser;

		[DebuggerNonUserCode]
		[GeneratedCode("protoc", null)]
		public static MessageDescriptor Descriptor => CommonReflection.Descriptor.MessageTypes[3];

		[DebuggerNonUserCode]
		[GeneratedCode("protoc", null)]
		MessageDescriptor IMessage.Descriptor => Descriptor;

		[DebuggerNonUserCode]
		[GeneratedCode("protoc", null)]
		public float X
		{
			get
			{
				return x_;
			}
			set
			{
				x_ = value;
			}
		}

		[DebuggerNonUserCode]
		[GeneratedCode("protoc", null)]
		public float Y
		{
			get
			{
				return y_;
			}
			set
			{
				y_ = value;
			}
		}

		[DebuggerNonUserCode]
		[GeneratedCode("protoc", null)]
		public float Z
		{
			get
			{
				return z_;
			}
			set
			{
				z_ = value;
			}
		}

		[DebuggerNonUserCode]
		[GeneratedCode("protoc", null)]
		public float W
		{
			get
			{
				return w_;
			}
			set
			{
				w_ = value;
			}
		}

		public Quaternion(System.Numerics.Quaternion quat)
		{
			X = quat.X;
			Y = quat.Y;
			Z = quat.Z;
			W = quat.W;
		}

		public static implicit operator System.Numerics.Quaternion(Quaternion quat)
		{
			return new System.Numerics.Quaternion(quat.X, quat.Y, quat.Z, quat.W);
		}

		[DebuggerNonUserCode]
		[GeneratedCode("protoc", null)]
		public Quaternion()
		{
		}

		[DebuggerNonUserCode]
		[GeneratedCode("protoc", null)]
		public Quaternion(Quaternion other)
			: this()
		{
			x_ = other.x_;
			y_ = other.y_;
			z_ = other.z_;
			w_ = other.w_;
			_unknownFields = UnknownFieldSet.Clone(other._unknownFields);
		}

		[DebuggerNonUserCode]
		[GeneratedCode("protoc", null)]
		public Quaternion Clone()
		{
			return new Quaternion(this);
		}

		[DebuggerNonUserCode]
		[GeneratedCode("protoc", null)]
		public override bool Equals(object other)
		{
			return Equals(other as Quaternion);
		}

		[DebuggerNonUserCode]
		[GeneratedCode("protoc", null)]
		public bool Equals(Quaternion other)
		{
			if (other == null)
			{
				return false;
			}
			if (other == this)
			{
				return true;
			}
			if (!ProtobufEqualityComparers.BitwiseSingleEqualityComparer.Equals(X, other.X))
			{
				return false;
			}
			if (!ProtobufEqualityComparers.BitwiseSingleEqualityComparer.Equals(Y, other.Y))
			{
				return false;
			}
			if (!ProtobufEqualityComparers.BitwiseSingleEqualityComparer.Equals(Z, other.Z))
			{
				return false;
			}
			if (!ProtobufEqualityComparers.BitwiseSingleEqualityComparer.Equals(W, other.W))
			{
				return false;
			}
			return object.Equals(_unknownFields, other._unknownFields);
		}

		[DebuggerNonUserCode]
		[GeneratedCode("protoc", null)]
		public override int GetHashCode()
		{
			int num = 1;
			if (X != 0f)
			{
				num ^= ProtobufEqualityComparers.BitwiseSingleEqualityComparer.GetHashCode(X);
			}
			if (Y != 0f)
			{
				num ^= ProtobufEqualityComparers.BitwiseSingleEqualityComparer.GetHashCode(Y);
			}
			if (Z != 0f)
			{
				num ^= ProtobufEqualityComparers.BitwiseSingleEqualityComparer.GetHashCode(Z);
			}
			if (W != 0f)
			{
				num ^= ProtobufEqualityComparers.BitwiseSingleEqualityComparer.GetHashCode(W);
			}
			if (_unknownFields != null)
			{
				num ^= ((object)_unknownFields).GetHashCode();
			}
			return num;
		}

		[DebuggerNonUserCode]
		[GeneratedCode("protoc", null)]
		public override string ToString()
		{
			return JsonFormatter.ToDiagnosticString((IMessage)(object)this);
		}

		[DebuggerNonUserCode]
		[GeneratedCode("protoc", null)]
		public void WriteTo(CodedOutputStream output)
		{
			output.WriteRawMessage((IMessage)(object)this);
		}

		[DebuggerNonUserCode]
		[GeneratedCode("protoc", null)]
		void IBufferMessage.InternalWriteTo(ref WriteContext output)
		{
			if (X != 0f)
			{
				((WriteContext)(ref output)).WriteRawTag((byte)13);
				((WriteContext)(ref output)).WriteFloat(X);
			}
			if (Y != 0f)
			{
				((WriteContext)(ref output)).WriteRawTag((byte)21);
				((WriteContext)(ref output)).WriteFloat(Y);
			}
			if (Z != 0f)
			{
				((WriteContext)(ref output)).WriteRawTag((byte)29);
				((WriteContext)(ref output)).WriteFloat(Z);
			}
			if (W != 0f)
			{
				((WriteContext)(ref output)).WriteRawTag((byte)37);
				((WriteContext)(ref output)).WriteFloat(W);
			}
			if (_unknownFields != null)
			{
				_unknownFields.WriteTo(ref output);
			}
		}

		[DebuggerNonUserCode]
		[GeneratedCode("protoc", null)]
		public int CalculateSize()
		{
			int num = 0;
			if (X != 0f)
			{
				num += 5;
			}
			if (Y != 0f)
			{
				num += 5;
			}
			if (Z != 0f)
			{
				num += 5;
			}
			if (W != 0f)
			{
				num += 5;
			}
			if (_unknownFields != null)
			{
				num += _unknownFields.CalculateSize();
			}
			return num;
		}

		[DebuggerNonUserCode]
		[GeneratedCode("protoc", null)]
		public void MergeFrom(Quaternion other)
		{
			if (other != null)
			{
				if (other.X != 0f)
				{
					X = other.X;
				}
				if (other.Y != 0f)
				{
					Y = other.Y;
				}
				if (other.Z != 0f)
				{
					Z = other.Z;
				}
				if (other.W != 0f)
				{
					W = other.W;
				}
				_unknownFields = UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
			}
		}

		[DebuggerNonUserCode]
		[GeneratedCode("protoc", null)]
		public void MergeFrom(CodedInputStream input)
		{
			input.ReadRawMessage((IMessage)(object)this);
		}

		[DebuggerNonUserCode]
		[GeneratedCode("protoc", null)]
		void IBufferMessage.InternalMergeFrom(ref ParseContext input)
		{
			uint num;
			while ((num = ((ParseContext)(ref input)).ReadTag()) != 0)
			{
				switch (num)
				{
				default:
					_unknownFields = UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
					break;
				case 13u:
					X = ((ParseContext)(ref input)).ReadFloat();
					break;
				case 21u:
					Y = ((ParseContext)(ref input)).ReadFloat();
					break;
				case 29u:
					Z = ((ParseContext)(ref input)).ReadFloat();
					break;
				case 37u:
					W = ((ParseContext)(ref input)).ReadFloat();
					break;
				}
			}
		}
	}
	public sealed class Vector3 : IMessage<Vector3>, IMessage, IEquatable<Vector3>, IDeepCloneable<Vector3>, IBufferMessage
	{
		private static readonly MessageParser<Vector3> _parser = new MessageParser<Vector3>((Func<Vector3>)(() => new Vector3()));

		private UnknownFieldSet _unknownFields;

		public const int XFieldNumber = 1;

		private float x_;

		public const int YFieldNumber = 2;

		private float y_;

		public const int ZFieldNumber = 3;

		private float z_;

		[DebuggerNonUserCode]
		[GeneratedCode("protoc", null)]
		public static MessageParser<Vector3> Parser => _parser;

		[DebuggerNonUserCode]
		[GeneratedCode("protoc", null)]
		public static MessageDescriptor Descriptor => CommonReflection.Descriptor.MessageTypes[2];

		[DebuggerNonUserCode]
		[GeneratedCode("protoc", null)]
		MessageDescriptor IMessage.Descriptor => Descriptor;

		[DebuggerNonUserCode]
		[GeneratedCode("protoc", null)]
		public float X
		{
			get
			{
				return x_;
			}
			set
			{
				x_ = value;
			}
		}

		[DebuggerNonUserCode]
		[GeneratedCode("protoc", null)]
		public float Y
		{
			get
			{
				return y_;
			}
			set
			{
				y_ = value;
			}
		}

		[DebuggerNonUserCode]
		[GeneratedCode("protoc", null)]
		public float Z
		{
			get
			{
				return z_;
			}
			set
			{
				z_ = value;
			}
		}

		public Vector3(System.Numerics.Vector3 vec)
		{
			X = vec.X;
			Y = vec.Y;
			Z = vec.Z;
		}

		public static implicit operator System.Numerics.Vector3(Vector3 vec)
		{
			return new System.Numerics.Vector3(vec.X, vec.Y, vec.Z);
		}

		[DebuggerNonUserCode]
		[GeneratedCode("protoc", null)]
		public Vector3()
		{
		}

		[DebuggerNonUserCode]
		[GeneratedCode("protoc", null)]
		public Vector3(Vector3 other)
			: this()
		{
			x_ = other.x_;
			y_ = other.y_;
			z_ = other.z_;
			_unknownFields = UnknownFieldSet.Clone(other._unknownFields);
		}

		[DebuggerNonUserCode]
		[GeneratedCode("protoc", null)]
		public Vector3 Clone()
		{
			return new Vector3(this);
		}

		[DebuggerNonUserCode]
		[GeneratedCode("protoc", null)]
		public override bool Equals(object other)
		{
			return Equals(other as Vector3);
		}

		[DebuggerNonUserCode]
		[GeneratedCode("protoc", null)]
		public bool Equals(Vector3 other)
		{
			if (other == null)
			{
				return false;
			}
			if (other == this)
			{
				return true;
			}
			if (!ProtobufEqualityComparers.BitwiseSingleEqualityComparer.Equals(X, other.X))
			{
				return false;
			}
			if (!ProtobufEqualityComparers.BitwiseSingleEqualityComparer.Equals(Y, other.Y))
			{
				return false;
			}
			if (!ProtobufEqualityComparers.BitwiseSingleEqualityComparer.Equals(Z, other.Z))
			{
				return false;
			}
			return object.Equals(_unknownFields, other._unknownFields);
		}

		[DebuggerNonUserCode]
		[GeneratedCode("protoc", null)]
		public override int GetHashCode()
		{
			int num = 1;
			if (X != 0f)
			{
				num ^= ProtobufEqualityComparers.BitwiseSingleEqualityComparer.GetHashCode(X);
			}
			if (Y != 0f)
			{
				num ^= ProtobufEqualityComparers.BitwiseSingleEqualityComparer.GetHashCode(Y);
			}
			if (Z != 0f)
			{
				num ^= ProtobufEqualityComparers.BitwiseSingleEqualityComparer.GetHashCode(Z);
			}
			if (_unknownFields != null)
			{
				num ^= ((object)_unknownFields).GetHashCode();
			}
			return num;
		}

		[DebuggerNonUserCode]
		[GeneratedCode("protoc", null)]
		public override string ToString()
		{
			return JsonFormatter.ToDiagnosticString((IMessage)(object)this);
		}

		[DebuggerNonUserCode]
		[GeneratedCode("protoc", null)]
		public void WriteTo(CodedOutputStream output)
		{
			output.WriteRawMessage((IMessage)(object)this);
		}

		[DebuggerNonUserCode]
		[GeneratedCode("protoc", null)]
		void IBufferMessage.InternalWriteTo(ref WriteContext output)
		{
			if (X != 0f)
			{
				((WriteContext)(ref output)).WriteRawTag((byte)13);
				((WriteContext)(ref output)).WriteFloat(X);
			}
			if (Y != 0f)
			{
				((WriteContext)(ref output)).WriteRawTag((byte)21);
				((WriteContext)(ref output)).WriteFloat(Y);
			}
			if (Z != 0f)
			{
				((WriteContext)(ref output)).WriteRawTag((byte)29);
				((WriteContext)(ref output)).WriteFloat(Z);
			}
			if (_unknownFields != null)
			{
				_unknownFields.WriteTo(ref output);
			}
		}

		[DebuggerNonUserCode]
		[GeneratedCode("protoc", null)]
		public int CalculateSize()
		{
			int num = 0;
			if (X != 0f)
			{
				num += 5;
			}
			if (Y != 0f)
			{
				num += 5;
			}
			if (Z != 0f)
			{
				num += 5;
			}
			if (_unknownFields != null)
			{
				num += _unknownFields.CalculateSize();
			}
			return num;
		}

		[DebuggerNonUserCode]
		[GeneratedCode("protoc", null)]
		public void MergeFrom(Vector3 other)
		{
			if (other != null)
			{
				if (other.X != 0f)
				{
					X = other.X;
				}
				if (other.Y != 0f)
				{
					Y = other.Y;
				}
				if (other.Z != 0f)
				{
					Z = other.Z;
				}
				_unknownFields = UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
			}
		}

		[DebuggerNonUserCode]
		[GeneratedCode("protoc", null)]
		public void MergeFrom(CodedInputStream input)
		{
			input.ReadRawMessage((IMessage)(object)this);
		}

		[DebuggerNonUserCode]
		[GeneratedCode("protoc", null)]
		void IBufferMessage.InternalMergeFrom(ref ParseContext input)
		{
			uint num;
			while ((num = ((ParseContext)(ref input)).ReadTag()) != 0)
			{
				switch (num)
				{
				default:
					_unknownFields = UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
					break;
				case 13u:
					X = ((ParseContext)(ref input)).ReadFloat();
					break;
				case 21u:
					Y = ((ParseContext)(ref input)).ReadFloat();
					break;
				case 29u:
					Z = ((ParseContext)(ref input)).ReadFloat();
					break;
				}
			}
		}
	}
	public static class ClientboundReflection
	{
		private static FileDescriptor descriptor;

		public static FileDescriptor Descriptor => descriptor;

		static ClientboundReflection()
		{
			//IL_02eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f1: Expected O, but got Unknown
			//IL_032c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0332: Expected O, but got Unknown
			//IL_0355: Unknown result type (might be due to invalid IL or missing references)
			//IL_035b: Expected O, but got Unknown
			//IL_037e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0384: Expected O, but got Unknown
			//IL_03af: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b5: Expected O, but got Unknown
			//IL_03d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03de: Expected O, but got Unknown
			//IL_0401: Unknown result type (might be due to invalid IL or missing references)
			//IL_0407: Expected O, but got Unknown
			//IL_043f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0445: Expected O, but got Unknown
			//IL_0485: Unknown result type (might be due to invalid IL or missing references)
			//IL_048b: Expected O, but got Unknown
			//IL_04af: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b5: Expected O, but got Unknown
			//IL_04d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_04df: Expected O, but got Unknown
			//IL_0520: Unknown result type (might be due to invalid IL or missing references)
			//IL_0526: Expected O, but got Unknown
			//IL_0577: Unknown result type (might be due to invalid IL or missing references)
			//IL_057d: Expected O, but got Unknown
			//IL_05a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a7: Expected O, but got Unknown
			//IL_05e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ee: Expected O, but got Unknown
			//IL_0622: Unknown result type (might be due to invalid IL or missing references)
			//IL_0628: Expected O, but got Unknown
			//IL_0654: Unknown result type (might be due to invalid IL or missing references)
			//IL_065a: Expected O, but got Unknown
			//IL_0686: Unknown result type (might be due to invalid IL or missing references)
			//IL_068c: Expected O, but got Unknown
			//IL_068c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0696: Expected O, but got Unknown
			descriptor = FileDescriptor.FromGeneratedCode(Convert.FromBase64String("ChFjbGllbnRib3VuZC5wcm90bxINY2x1Yi5zbG9wcGVycxoMY29tbW9uLnBy" + "b3RvIqMGChJDbGllbnRib3VuZE1lc3NhZ2USMAoFaGVsbG8YASABKAsyHy5j" + "bHViLnNsb3BwZXJzLkNsaWVudGJvdW5kSGVsbG9IABJBCg5wbGF5ZXJzX3Vw" + "ZGF0ZRgCIAEoCzInLmNsdWIuc2xvcHBlcnMuQ2xpZW50Ym91bmRQbGF5ZXJz" + "VXBkYXRlSAASQwoPcG9zaXRpb25fdXBkYXRlGAMgASgLMiguY2x1Yi5zbG9w" + "cGVycy5DbGllbnRib3VuZFBvc2l0aW9uVXBkYXRlSAASLgoEcG9uZxgEIAEo" + "CzIeLmNsdWIuc2xvcHBlcnMuQ2xpZW50Ym91bmRQb25nSAASPwoNdmlzdWFs" + "X3VwZGF0ZRgFIAEoCzImLmNsdWIuc2xvcHBlcnMuQ2xpZW50Ym91bmRWaXN1" + "YWxVcGRhdGVIABJFChBhbmltYXRpb25fdXBkYXRlGAYgASgLMikuY2x1Yi5z" + "bG9wcGVycy5DbGllbnRib3VuZEFuaW1hdGlvblVwZGF0ZUgAEkcKEWVuY291" + "bnRlcl9yZXF1ZXN0GAcgASgLMiouY2x1Yi5zbG9wcGVycy5DbGllbnRib3Vu" + "ZEVuY291bnRlclJlcXVlc3RIABJDCg9lbmNvdW50ZXJfc3RhcnQYCCABKAsy" + "KC5jbHViLnNsb3BwZXJzLkNsaWVudGJvdW5kRW5jb3VudGVyU3RhcnRIABJF" + "ChBlbmNvdW50ZXJfdXBkYXRlGAkgASgLMikuY2x1Yi5zbG9wcGVycy5DbGll" + "bnRib3VuZEVuY291bnRlclVwZGF0ZUgAEj8KDWVuY291bnRlcl9lbmQYCiAB" + "KAsyJi5jbHViLnNsb3BwZXJzLkNsaWVudGJvdW5kRW5jb3VudGVyRW5kSAAS" + "PwoNY3VzdG9tX3BhY2tldBgLIAEoCzImLmNsdWIuc2xvcHBlcnMuQ2xpZW50" + "Ym91bmRDdXN0b21QYWNrZXRIABI5CgpxdWlja19jaGF0GAwgASgLMiMuY2x1" + "Yi5zbG9wcGVycy5DbGllbnRib3VuZFF1aWNrQ2hhdEgAQgkKB21lc3NhZ2Ui" + "dwoQQ2xpZW50Ym91bmRIZWxsbxIRCgl0aWNrX3JhdGUYASABKAUSFgoOYmFu" + "bmVkX3BsdWdpbnMYAiADKAkSGwoTc2NvcmVfYmF0dGxlX2xlbmd0aBgDIAEo" + "DRIbChNjb21ib19iYXR0bGVfbGVuZ3RoGAQgASgNIkIKGENsaWVudGJvdW5k" + "UGxheWVyc1VwZGF0ZRImCgdwbGF5ZXJzGAEgAygLMhUuY2x1Yi5zbG9wcGVy" + "cy5QbGF5ZXIiSwoZQ2xpZW50Ym91bmRQb3NpdGlvblVwZGF0ZRIuCgd1cGRh" + "dGVzGAEgAygLMh0uY2x1Yi5zbG9wcGVycy5Qb3NpdGlvblVwZGF0ZSIrCg9D" + "bGllbnRib3VuZFBvbmcSCgoCaWQYASABKA0SDAoEdGljaxgCIAEoBCJHChdD" + "bGllbnRib3VuZFZpc3VhbFVwZGF0ZRIsCgd1cGRhdGVzGAEgAygLMhsuY2x1" + "Yi5zbG9wcGVycy5WaXN1YWxVcGRhdGUiTQoaQ2xpZW50Ym91bmRBbmltYXRp" + "b25VcGRhdGUSLwoHdXBkYXRlcxgBIAMoCzIeLmNsdWIuc2xvcHBlcnMuQW5p" + "bWF0aW9uVXBkYXRlIm8KG0NsaWVudGJvdW5kRW5jb3VudGVyUmVxdWVzdBIq" + "CgR0eXBlGAEgASgOMhwuY2x1Yi5zbG9wcGVycy5FbmNvdW50ZXJUeXBlEhYK" + "CXBsYXllcl9pZBgCIAEoDUgAiAEBQgwKCl9wbGF5ZXJfaWQiwQEKGUNsaWVu" + "dGJvdW5kRW5jb3VudGVyU3RhcnQSKgoEdHlwZRgBIAEoDjIcLmNsdWIuc2xv" + "cHBlcnMuRW5jb3VudGVyVHlwZRI5CgZzaW1wbGUYAiABKAsyJy5jbHViLnNs" + "b3BwZXJzLlNpbXBsZUVuY291bnRlclN0YXJ0RGF0YUgAEjUKBHJhY2UYAyAB" + "KAsyJS5jbHViLnNsb3BwZXJzLlJhY2VFbmNvdW50ZXJTdGFydERhdGFIAEIG" + "CgRkYXRhIi0KGFNpbXBsZUVuY291bnRlclN0YXJ0RGF0YRIRCglwbGF5ZXJf" + "aWQYASABKA0iQwoWUmFjZUVuY291bnRlclN0YXJ0RGF0YRIpCgZjb25maWcY" + "ASABKAsyGS5jbHViLnNsb3BwZXJzLlJhY2VDb25maWci2gEKGkNsaWVudGJv" + "dW5kRW5jb3VudGVyVXBkYXRlEioKBHR5cGUYASABKA4yHC5jbHViLnNsb3Bw" + "ZXJzLkVuY291bnRlclR5cGUSRQoGc2ltcGxlGAIgASgLMjMuY2x1Yi5zbG9w" + "cGVycy5DbGllbnRib3VuZFNpbXBsZUVuY291bnRlclVwZGF0ZURhdGFIABJB" + "CgRyYWNlGAMgASgLMjEuY2x1Yi5zbG9wcGVycy5DbGllbnRib3VuZFJhY2VF" + "bmNvdW50ZXJVcGRhdGVEYXRhSABCBgoEZGF0YSL2AQokQ2xpZW50Ym91bmRT" + "aW1wbGVFbmNvdW50ZXJVcGRhdGVEYXRhEigKCnlvdXJfc2NvcmUYASABKAsy" + "FC5jbHViLnNsb3BwZXJzLlNjb3JlEiwKDm9wcG9uZW50X3Njb3JlGAIgASgL" + "MhQuY2x1Yi5zbG9wcGVycy5TY29yZRIfChJ5b3VyX2NvbWJvX2Ryb3BwZWQY" + "AyABKAhIAIgBARIjChZvcHBvbmVudF9jb21ib19kcm9wcGVkGAQgASgISAGI" + "AQFCFQoTX3lvdXJfY29tYm9fZHJvcHBlZEIZChdfb3Bwb25lbnRfY29tYm9f" + "ZHJvcHBlZCJMCiJDbGllbnRib3VuZFJhY2VFbmNvdW50ZXJVcGRhdGVEYXRh" + "EiYKBXRpbWVzGAEgAygLMhcuY2x1Yi5zbG9wcGVycy5SYWNlVGltZSLJAQoX" + "Q2xpZW50Ym91bmRFbmNvdW50ZXJFbmQSKgoEdHlwZRgBIAEoDjIcLmNsdWIu" + "c2xvcHBlcnMuRW5jb3VudGVyVHlwZRI3CgZzaW1wbGUYAiABKAsyJS5jbHVi" + "LnNsb3BwZXJzLlNpbXBsZUVuY291bnRlckVuZERhdGFIABJBCgRyYWNlGAMg" + "ASgLMjEuY2x1Yi5zbG9wcGVycy5DbGllbnRib3VuZFJhY2VFbmNvdW50ZXJV" + "cGRhdGVEYXRhSABCBgoEZGF0YSKFAQoWU2ltcGxlRW5jb3VudGVyRW5kRGF0" + "YRITCgtlbmRlZF9lYXJseRgBIAEoCBIoCgp5b3VyX3Njb3JlGAIgASgLMhQu" + "Y2x1Yi5zbG9wcGVycy5TY29yZRIsCg5vcHBvbmVudF9zY29yZRgDIAEoCzIU" + "LmNsdWIuc2xvcHBlcnMuU2NvcmUiWQoXQ2xpZW50Ym91bmRDdXN0b21QYWNr" + "ZXQSEQoJcGxheWVyX2lkGAEgASgNEisKBnBhY2tldBgCIAEoCzIbLmNsdWIu" + "c2xvcHBlcnMuQ3VzdG9tUGFja2V0IlcKFENsaWVudGJvdW5kUXVpY2tDaGF0" + "EhEKCXBsYXllcl9pZBgBIAEoDRIsCgpxdWlja19jaGF0GAIgASgLMhguY2x1" + "Yi5zbG9wcGVycy5RdWlja0NoYXRCGKoCFVNsb3BDcmV3LkNvbW1vbi5Qcm90" + "b2IGcHJvdG8z"), (FileDescriptor[])(object)new FileDescriptor[1] { CommonReflection.Descriptor }, new GeneratedClrTypeInfo((Type[])null, (Extension[])null, (GeneratedClrTypeInfo[])(object)new GeneratedClrTypeInfo[18]
			{
				new GeneratedClrTypeInfo(typeof(ClientboundMessage), (MessageParser)(object)ClientboundMessage.Parser, new string[12]
				{
					"Hello", "PlayersUpdate", "PositionUpdate", "Pong", "VisualUpdate", "AnimationUpdate", "EncounterRequest", "EncounterStart", "EncounterUpdate", "EncounterEnd",
					"CustomPacket", "QuickChat"
				}, new string[1] { "Message" }, (Type[])null, (Extension[])null, (GeneratedClrTypeInfo[])null),
				new GeneratedClrTypeInfo(typeof(ClientboundHello), (MessageParser)(object)ClientboundHello.Parser, new string[4] { "TickRate", "BannedPlugins", "ScoreBattleLength", "ComboBattleLength" }, (string[])null, (Type[])null, (Extension[])null, (GeneratedClrTypeInfo[])null),
				new GeneratedClrTypeInfo(typeof(ClientboundPlayersUpdate), (MessageParser)(object)ClientboundPlayersUpdate.Parser, new string[1] { "Players" }, (string[])null, (Type[])null, (Extension[])null, (GeneratedClrTypeInfo[])null),
				new GeneratedClrTypeInfo(typeof(ClientboundPositionUpdate), (MessageParser)(object)ClientboundPositionUpdate.Parser, new string[1] { "Updates" }, (string[])null, (Type[])null, (Extension[])null, (GeneratedClrTypeInfo[])null),
				new GeneratedClrTypeInfo(typeof(ClientboundPong), (MessageParser)(object)ClientboundPong.Parser, new string[2] { "Id", "Tick" }, (string[])null, (Type[])null, (Extension[])null, (GeneratedClrTypeInfo[])null),
				new GeneratedClrTypeInfo(typeof(ClientboundVisualUpdate), (MessageParser)(object)ClientboundVisualUpdate.Parser, new string[1] { "Updates" }, (string[])null, (Type[])null, (Extension[])null, (GeneratedClrTypeInfo[])null),
				new GeneratedClrTypeInfo(typeof(ClientboundAnimationUpdate), (MessageParser)(object)ClientboundAnimationUpdate.Parser, new string[1] { "Updates" }, (string[])null, (Type[])null, (Extension[])null, (GeneratedClrTypeInfo[])null),
				new GeneratedClrTypeInfo(typeof(ClientboundEncounterRequest), (MessageParser)(object)ClientboundEncounterRequest.Parser, new string[2] { "Type", "PlayerId" }, new string[1] { "PlayerId" }, (Type[])null, (Extension[])null, (GeneratedClrTypeInfo[])null),
				new GeneratedClrTypeInfo(typeof(ClientboundEncounterStart), (MessageParser)(object)ClientboundEncounterStart.Parser, new string[3] { "Type", "Simple", "Race" }, new string[1] { "Data" }, (Type[])null, (Extension[])null, (GeneratedClrTypeInfo[])null),
				new GeneratedClrTypeInfo(typeof(SimpleEncounterStartData), (MessageParser)(object)SimpleEncounterStartData.Parser, new string[1] { "PlayerId" }, (string[])null, (Type[])null, (Extension[])null, (GeneratedClrTypeInfo[])null),
				new GeneratedClrTypeInfo(typeof(RaceEncounterStartData), (MessageParser)(object)RaceEncounterStartData.Parser, new string[1] { "Config" }, (string[])null, (Type[])null, (Extension[])null, (GeneratedClrTypeInfo[])null),
				new GeneratedClrTypeInfo(typeof(ClientboundEncounterUpdate), (MessageParser)(object)ClientboundEncounterUpdate.Parser, new string[3] { "Type", "Simple", "Race" }, new string[1] { "Data" }, (Type[])null, (Extension[])null, (GeneratedClrTypeInfo[])null),
				new GeneratedClrTypeInfo(typeof(ClientboundSimpleEncounterUpdateData), (MessageParser)(object)ClientboundSimpleEncounterUpdateData.Parser, new string[4] { "YourScore", "OpponentScore", "YourComboDropped", "OpponentComboDropped" }, new string[2] { "YourComboDropped", "OpponentComboDropped" }, (Type[])null, (Extension[])null, (GeneratedClrTypeInfo[])null),
				new GeneratedClrTypeInfo(typeof(ClientboundRaceEncounterUpdateData), (MessageParser)(object)ClientboundRaceEncounterUpdateData.Parser, new string[1] { "Times" }, (string[])null, (Type[])null, (Extension[])null, (GeneratedClrTypeInfo[])null),
				new GeneratedClrTypeInfo(typeof(ClientboundEncounterEnd), (MessageParser)(object)ClientboundEncounterEnd.Parser, new string[3] { "Type", "Simple", "Race" }, new string[1] { "Data" }, (Type[])null, (Extension[])null, (GeneratedClrTypeInfo[])null),
				new GeneratedClrTypeInfo(typeof(SimpleEncounterEndData), (MessageParser)(object)SimpleEncounterEndData.Parser, new string[3] { "EndedEarly", "YourScore", "OpponentScore" }, (string[])null, (Type[])null, (Extension[])null, (GeneratedClrTypeInfo[])null),
				new GeneratedClrTypeInfo(typeof(ClientboundCustomPacket), (MessageParser)(object)ClientboundCustomPacket.Parser, new string[2] { "PlayerId", "Packet" }, (string[])null, (Type[])null, (Extension[])null, (GeneratedClrTypeInfo[])null),
				new GeneratedClrTypeInfo(typeof(ClientboundQuickChat), (MessageParser)(object)ClientboundQuickChat.Parser, new string[2] { "PlayerId", "QuickChat" }, (string[])null, (Type[])null, (Extension[])null, (GeneratedClrTypeInfo[])null)
			}));
		}
	}
	public sealed class ClientboundMessage : IMessage<ClientboundMessage>, IMessage, IEquatable<ClientboundMessage>, IDeepCloneable<ClientboundMessage>, IBufferMessage
	{
		public enum MessageOneofCase
		{
			None,
			Hello,
			PlayersUpdate,
			PositionUpdate,
			Pong,
			VisualUpdate,
			AnimationUpdate,
			EncounterRequest,
			EncounterStart,
			EncounterUpdate,
			EncounterEnd,
			CustomPacket,
			QuickChat
		}

		private static readonly MessageParser<ClientboundMessage> _parser = new MessageParser<ClientboundMessage>((Func<ClientboundMessage>)(() => new ClientboundMessage()));

		private UnknownFieldSet _unknownFields;

		public const int HelloFieldNumber = 1;

		public const int PlayersUpdateFieldNumber = 2;

		public const int PositionUpdateFieldNumber = 3;

		public const int PongFieldNumber = 4;

		public const int VisualUpdateFieldNumber = 5;

		public const int AnimationUpdateFieldNumber = 6;

		public const int EncounterRequestFieldNumber = 7;

		public const int EncounterStartFieldNumber = 8;

		public const int EncounterUpdateFieldNumber = 9;

		public const int EncounterEndFieldNumber = 10;

		public const int CustomPacketFieldNumber = 11;

		public const int QuickChatFieldNumber = 12;

		private object message_;

		private MessageOneofCase messageCase_;

		[DebuggerNonUserCode]
		[GeneratedCode("protoc", null)]
		public static MessageParser<ClientboundMessage> Parser => _parser;

		[DebuggerNonUserCode]
		[GeneratedCode("protoc", null)]
		public static MessageDescriptor Descriptor => ClientboundReflection.Descriptor.MessageTypes[0];

		[DebuggerNonUserCode]
		[GeneratedCode("protoc", null)]
		MessageDescriptor IMessage.Descriptor => Descriptor;

		[DebuggerNonUserCode]
		[GeneratedCode("protoc", null)]
		public ClientboundHello Hello
		{
			get
			{
				if (messageCase_ != MessageOneofCase.Hello)
				{
					return null;
				}
				return (ClientboundHello)message_;
			}
			set
			{
				message_ = value;
				messageCase_ = ((value != null) ? MessageOneofCase.Hello : MessageOneofCase.None);
			}
		}

		[DebuggerNonUserCode]
		[GeneratedCode("protoc", null)]
		public ClientboundPlayersUpdate PlayersUpdate
		{
			get
			{
				if (messageCase_ != MessageOneofCase.PlayersUpdate)
				{
					return null;
				}
				return (ClientboundPlayersUpdate)message_;
			}
			set
			{
				message_ = value;
				messageCase_ = ((value != null) ? MessageOneofCase.PlayersUpdate : MessageOneofCase.None);
			}
		}

		[DebuggerNonUserCode]
		[GeneratedCode("protoc", null)]
		public ClientboundPositionUpdate PositionUpdate
		{
			get
			{
				if (messageCase_ != MessageOneofCase.PositionUpdate)
				{
					return null;
				}
				return (ClientboundPositionUpdate)message_;
			}
			set
			{
				message_ = value;
				messageCase_ = ((value != null) ? MessageOneofCase.PositionUpdate : MessageOneofCase.None);
			}
		}

		[DebuggerNonUserCode]
		[GeneratedCode("protoc", null)]
		public ClientboundPong Pong
		{
			get
			{
				if (messageCase_ != MessageOneofCase.Pong)
				{
					return null;
				}
				return (ClientboundPong)message_;
			}
			set
			{
				message_ = value;
				messageCase_ = ((value != null) ? MessageOneofCase.Pong : MessageOneofCase.None);
			}
		}

		[DebuggerNonUserCode]
		[GeneratedCode("protoc", null)]
		public ClientboundVisualUpdate VisualUpdate
		{
			get
			{
				if (messageCase_ != MessageOneofCase.VisualUpdate)
				{
					return null;
				}
				return (ClientboundVisualUpdate)message_;
			}
			set
			{
				message_ = value;
				messageCase_ = ((value != null) ? MessageOneofCase.VisualUpdate : MessageOneofCase.None);
			}
		}

		[DebuggerNonUserCode]
		[GeneratedCode("protoc", null)]
		public ClientboundAnimationUpdate AnimationUpdate
		{
			get
			{
				if (messageCase_ != MessageOneofCase.AnimationUpdate)
				{
					return null;
				}
				return (ClientboundAnimationUpdate)message_;
			}
			set
			{
				message_ = value;
				messageCase_ = ((value != null) ? MessageOneofCase.AnimationUpdate : MessageOneofCase.None);
			}
		}

		[DebuggerNonUserCode]
		[GeneratedCode("protoc", null)]
		public ClientboundEncounterRequest EncounterRequest
		{
			get
			{
				if (messageCase_ != MessageOneofCase.EncounterRequest)
				{
					return null;
				}
				return (ClientboundEncounterRequest)message_;
			}
			set
			{
				message_ = value;
				messageCase_ = ((value != null) ? MessageOneofCase.EncounterRequest : MessageOneofCase.None);
			}
		}

		[DebuggerNonUserCode]
		[GeneratedCode("protoc", null)]
		public ClientboundEncounterStart EncounterStart
		{
			get
			{
				if (messageCase_ != MessageOneofCase.EncounterStart)
				{
					return null;
				}
				return (ClientboundEncounterStart)message_;
			}
			set
			{
				message_ = value;
				messageCase_ = ((value != null) ? MessageOneofCase.EncounterStart : MessageOneofCase.None);
			}
		}

		[DebuggerNonUserCode]
		[GeneratedCode("protoc", null)]
		public ClientboundEncounterUpdate EncounterUpdate
		{
			get
			{
				if (messageCase_ != MessageOneofCase.EncounterUpdate)
				{
					return null;
				}
				return (ClientboundEncounterUpdate)message_;
			}
			set
			{
				message_ = value;
				messageCase_ = ((value != null) ? MessageOneofCase.EncounterUpdate : MessageOneofCase.None);
			}
		}

		[DebuggerNonUserCode]
		[GeneratedCode("protoc", null)]
		public ClientboundEncounterEnd EncounterEnd
		{
			get
			{
				if (messageCase_ != MessageOneofCase.EncounterEnd)
				{
					return null;
				}
				return (ClientboundEncounterEnd)message_;
			}
			set
			{
				message_ = value;
				messageCase_ = ((value != null) ? MessageOneofCase.EncounterEnd : MessageOneofCase.None);
			}
		}

		[DebuggerNonUserCode]
		[GeneratedCode("protoc", null)]
		public ClientboundCustomPacket CustomPacket
		{
			get
			{
				if (messageCase_ != MessageOneofCase.CustomPacket)
				{
					return null;
				}
				return (ClientboundCustomPacket)message_;
			}
			set
			{
				message_ = value;
				messageCase_ = ((value != null) ? MessageOneofCase.CustomPacket : MessageOneofCase.None);
			}
		}

		[DebuggerNonUserCode]
		[GeneratedCode("protoc", null)]
		public ClientboundQuickChat QuickChat
		{
			get
			{
				if (messageCase_ != MessageOneofCase.QuickChat)
				{
					return null;
				}
				return (ClientboundQuickChat)message_;
			}
			set
			{
				message_ = value;
				messageCase_ = ((value != null) ? MessageOneofCase.QuickChat : MessageOneofCase.None);
			}
		}

		[DebuggerNonUserCode]
		[GeneratedCode("protoc", null)]
		public MessageOneofCase MessageCase => messageCase_;

		[DebuggerNonUserCode]
		[GeneratedCode("protoc", null)]
		public ClientboundMessage()
		{
		}

		[DebuggerNonUserCode]
		[GeneratedCode("protoc", null)]
		public ClientboundMessage(ClientboundMessage other)
			: this()
		{
			switch (other.MessageCase)
			{
			case MessageOneofCase.Hello:
				Hello = other.Hello.Clone();
				break;
			case MessageOneofCase.PlayersUpdate:
				PlayersUpdate = other.PlayersUpdate.Clone();
				break;
			case MessageOneofCase.PositionUpdate:
				PositionUpdate = other.PositionUpdate.Clone();
				break;
			case MessageOneofCase.Pong:
				Pong = other.Pong.Clone();
				break;
			case MessageOneofCase.VisualUpdate:
				VisualUpdate = other.VisualUpdate.Clone();
				break;
			case MessageOneofCase.AnimationUpdate:
				AnimationUpdate = other.AnimationUpdate.Clone();
				break;
			case MessageOneofCase.EncounterRequest:
				EncounterRequest = other.EncounterRequest.Clone();
				break;
			case MessageOneofCase.EncounterStart:
				EncounterStart = other.EncounterStart.Clone();
				break;
			case MessageOneofCase.EncounterUpdate:
				EncounterUpdate = other.EncounterUpdate.Clone();
				break;
			case MessageOneofCase.EncounterEnd:
				EncounterEnd = other.EncounterEnd.Clone();
				break;
			case MessageOneofCase.CustomPacket:
				CustomPacket = other.CustomPacket.Clone();
				break;
			case MessageOneofCase.QuickChat:
				QuickChat = other.QuickChat.Clone();
				break;
			}
			_unknownFields = UnknownFieldSet.Clone(other._unknownFields);
		}

		[DebuggerNonUserCode]
		[GeneratedCode("protoc", null)]
		public ClientboundMessage Clone()
		{
			return new ClientboundMessage(this);
		}

		[DebuggerNonUserCode]
		[GeneratedCode("protoc", null)]
		public void ClearMessage()
		{
			messageCase_ = MessageOneofCase.None;
			message_ = null;
		}

		[DebuggerNonUserCode]
		[GeneratedCode("protoc", null)]
		public override bool Equals(object other)
		{
			return Equals(other as ClientboundMessage);
		}

		[DebuggerNonUserCode]
		[GeneratedCode("protoc", null)]
		public bool Equals(ClientboundMessage other)
		{
			if (other == null)
			{
				return false;
			}
			if (other == this)
			{
				return true;
			}
			if (!object.Equals(Hello, other.Hello))
			{
				return false;
			}
			if (!object.Equals(PlayersUpdate, other.PlayersUpdate))
			{
				return false;
			}
			if (!object.Equals(PositionUpdate, other.PositionUpdate))
			{
				return false;
			}
			if (!object.Equals(Pong, other.Pong))
			{
				return false;
			}
			if (!object.Equals(VisualUpdate, other.VisualUpdate))
			{
				return false;
			}
			if (!object.Equals(AnimationUpdate, other.AnimationUpdate))
			{
				return false;
			}
			if (!object.Equals(EncounterRequest, other.EncounterRequest))
			{
				return false;
			}
			if (!object.Equals(EncounterStart, other.EncounterStart))
			{
				return false;
			}
			if (!object.Equals(EncounterUpdate, other.EncounterUpdate))
			{
				return false;
			}
			if (!object.Equals(EncounterEnd, other.EncounterEnd))
			{
				return false;
			}
			if (!object.Equals(CustomPacket, other.CustomPacket))
			{
				return false;
			}
			if (!object.Equals(QuickChat, other.QuickChat))
			{
				return false;
			}
			if (MessageCase != other.MessageCase)
			{
				return false;
			}
			return object.Equals(_unknownFields, other._unknownFields);
		}

		[DebuggerNonUserCode]
		[GeneratedCode("protoc", null)]
		public override int GetHashCode()
		{
			int num = 1;
			if (messageCase_ == MessageOneofCase.Hello)
			{
				num ^= Hello.GetHashCode();
			}
			if (messageCase_ == MessageOneofCase.PlayersUpdate)
			{
				num ^= PlayersUpdate.GetHashCode();
			}
			if (messageCase_ == MessageOneofCase.PositionUpdate)
			{
				num ^= PositionUpdate.GetHashCode();
			}
			if (messageCase_ == MessageOneofCase.Pong)
			{
				num ^= Pong.GetHashCode();
			}
			if (messageCase_ == MessageOneofCase.VisualUpdate)
			{
				num ^= VisualUpdate.GetHashCode();
			}
			if (messageCase_ == MessageOneofCase.AnimationUpdate)
			{
				num ^= AnimationUpdate.GetHashCode();
			}
			if (messageCase_ == MessageOneofCase.EncounterRequest)
			{
				num ^= EncounterRequest.GetHashCode();
			}
			if (messageCase_ == MessageOneofCase.EncounterStart)
			{
				num ^= EncounterStart.GetHashCode();
			}
			if (messageCase_ == MessageOneofCase.EncounterUpdate)
			{
				num ^= EncounterUpdate.GetHashCode();
			}
			if (messageCase_ == MessageOneofCase.EncounterEnd)
			{
				num ^= EncounterEnd.GetHashCode();
			}
			if (messageCase_ == MessageOneofCase.CustomPacket)
			{
				num ^= CustomPacket.GetHashCode();
			}
			if (messageCase_ == MessageOneofCase.QuickChat)
			{
				num ^= QuickChat.GetHashCode();
			}
			num ^= (int)messageCase_;
			if (_unknownFields != null)
			{
				num ^= ((object)_unknownFields).GetHashCode();
			}
			return num;
		}

		[DebuggerNonUserCode]
		[GeneratedCode("protoc", null)]
		public override string ToString()
		{
			return JsonFormatter.ToDiagnosticString((IMessage)(object)this);
		}

		[DebuggerNonUserCode]
		[GeneratedCode("protoc", null)]
		public void WriteTo(CodedOutputStream output)
		{
			output.WriteRawMessage((IMessage)(object)this);
		}

		[DebuggerNonUserCode]
		[GeneratedCode("protoc", null)]
		void IBufferMessage.InternalWriteTo(ref WriteContext output)
		{
			if (messageCase_ == MessageOneofCase.Hello)
			{
				((WriteContext)(ref output)).WriteRawTag((byte)10);
				((WriteContext)(ref output)).WriteMessage((IMessage)(object)Hello);
			}
			if (messageCase_ == MessageOneofCase.PlayersUpdate)
			{
				((WriteContext)(ref output)).WriteRawTag((byte)18);
				((WriteContext)(ref output)).WriteMessage((IMessage)(object)PlayersUpdate);
			}
			if (messageCase_ == MessageOneofCase.PositionUpdate)
			{
				((WriteContext)(ref output)).WriteRawTag((byte)26);
				((WriteContext)(ref output)).WriteMessage((IMessage)(object)PositionUpdate);
			}
			if (messageCase_ == MessageOneofCase.Pong)
			{
				((WriteContext)(ref output)).WriteRawTag((byte)34);
				((WriteContext)(ref output)).WriteMessage((IMessage)(object)Pong);
			}
			if (messageCase_ == MessageOneofCase.VisualUpdate)
			{
				((WriteContext)(ref output)).WriteRawTag((byte)42);
				((WriteContext)(ref output)).WriteMessage((IMessage)(object)VisualUpdate);
			}
			if (messageCase_ == MessageOneofCase.AnimationUpdate)
			{
				((WriteContext)(ref output)).WriteRawTag((byte)50);
				((WriteContext)(ref output)).WriteMessage((IMessage)(object)AnimationUpdate);
			}
			if (messageCase_ == MessageOneofCase.EncounterRequest)
			{
				((WriteContext)(ref output)).WriteRawTag((byte)58);
				((WriteContext)(ref output)).WriteMessage((IMessage)(object)EncounterRequest);
			}
			if (messageCase_ == MessageOneofCase.EncounterStart)
			{
				((WriteContext)(ref output)).WriteRawTag((byte)66);
				((WriteContext)(ref output)).WriteMessage((IMessage)(object)EncounterStart);
			}
			if (messageCase_ == MessageOneofCase.EncounterUpdate)
			{
				((WriteContext)(ref output)).WriteRawTag((byte)74);
				((WriteContext)(ref output)).WriteMessage((IMessage)(object)EncounterUpdate);
			}
			if (messageCase_ == MessageOneofCase.EncounterEnd)
			{
				((WriteContext)(ref output)).WriteRawTag((byte)82);
				((WriteContext)(ref output)).WriteMessage((IMessage)(object)EncounterEnd);
			}
			if (messageCase_ == MessageOneofCase.CustomPacket)
			{
				((WriteContext)(ref output)).WriteRawTag((byte)90);
				((WriteContext)(ref output)).WriteMessage((IMessage)(object)CustomPacket);
			}
			if (messageCase_ == MessageOneofCase.QuickChat)
			{
				((WriteContext)(ref output)).WriteRawTag((byte)98);
				((WriteContext)(ref output)).WriteMessage((IMessage)(object)QuickChat);
			}
			if (_unknownFields != null)
			{
				_unknownFields.WriteTo(ref output);
			}
		}

		[DebuggerNonUserCode]
		[GeneratedCode("protoc", null)]
		public int CalculateSize()
		{
			int num = 0;
			if (messageCase_ == MessageOneofCase.Hello)
			{
				num += 1 + CodedOutputStream.ComputeMessageSize((IMessage)(object)Hello);
			}
			if (messageCase_ == MessageOneofCase.PlayersUpdate)
			{
				num += 1 + CodedOutputStream.ComputeMessageSize((IMessage)(object)PlayersUpdate);
			}
			if (messageCase_ == MessageOneofCase.PositionUpdate)
			{
				num += 1 + CodedOutputStream.ComputeMessageSize((IMessage)(object)PositionUpdate);
			}
			if (messageCase_ == MessageOneofCase.Pong)
			{
				num += 1 + CodedOutputStream.ComputeMessageSize((IMessage)(object)Pong);
			}
			if (messageCase_ == MessageOneofCase.VisualUpdate)
			{
				num += 1 + CodedOutputStream.ComputeMessageSize((IMessage)(object)VisualUpdate);
			}
			if (messageCase_ == MessageOneofCase.AnimationUpdate)
			{
				num += 1 + CodedOutputStream.ComputeMessageSize((IMessage)(object)AnimationUpdate);
			}
			if (messageCase_ == MessageOneofCase.EncounterRequest)
			{
				num += 1 + CodedOutputStream.ComputeMessageSize((IMessage)(object)EncounterRequest);
			}
			if (messageCase_ == MessageOneofCase.EncounterStart)
			{
				num += 1 + CodedOutputStream.ComputeMessageSize((IMessage)(object)EncounterStart);
			}
			if (messageCase_ == MessageOneofCase.EncounterUpdate)
			{
				num += 1 + CodedOutputStream.ComputeMessageSize((IMessage)(object)EncounterUpdate);
			}
			if (messageCase_ == MessageOneofCase.EncounterEnd)
			{
				num += 1 + CodedOutputStream.ComputeMessageSize((IMessage)(object)EncounterEnd);
			}
			if (messageCase_ == MessageOneofCase.CustomPacket)
			{
				num += 1 + CodedOutputStream.ComputeMessageSize((IMessage)(object)CustomPacket);
			}
			if (messageCase_ == MessageOneofCase.QuickChat)
			{
				num += 1 + CodedOutputStream.ComputeMessageSize((IMessage)(object)QuickChat);
			}
			if (_unknownFields != null)
			{
				num += _unknownFields.CalculateSize();
			}
			return num;
		}

		[DebuggerNonUserCode]
		[GeneratedCode("protoc", null)]
		public void MergeFrom(ClientboundMessage other)
		{
			if (other == null)
			{
				return;
			}
			switch (other.MessageCase)
			{
			case MessageOneofCase.Hello:
				if (Hello == null)
				{
					Hello = new ClientboundHello();
				}
				Hello.MergeFrom(other.Hello);
				break;
			case MessageOneofCase.PlayersUpdate:
				if (PlayersUpdate == null)
				{
					PlayersUpdate = new ClientboundPlayersUpdate();
				}
				PlayersUpdate.MergeFrom(other.PlayersUpdate);
				break;
			case MessageOneofCase.PositionUpdate:
				if (PositionUpdate == null)
				{
					PositionUpdate = new ClientboundPositionUpdate();
				}
				PositionUpdate.MergeFrom(other.PositionUpdate);
				break;
			case MessageOneofCase.Pong:
				if (Pong == null)
				{
					Pong = new ClientboundPong();
				}
				Pong.MergeFrom(other.Pong);
				break;
			case MessageOneofCase.VisualUpdate:
				if (VisualUpdate == null)
				{
					VisualUpdate = new ClientboundVisualUpdate();
				}
				VisualUpdate.MergeFrom(other.VisualUpdate);
				break;
			case MessageOneofCase.AnimationUpdate:
				if (AnimationUpdate == null)
				{
					AnimationUpdate = new ClientboundAnimationUpdate();
				}
				AnimationUpdate.MergeFrom(other.AnimationUpdate);
				break;
			case MessageOneofCase.EncounterRequest:
				if (EncounterRequest == null)
				{
					EncounterRequest = new ClientboundEncounterRequest();
				}
				EncounterRequest.MergeFrom(other.EncounterRequest);
				break;
			case MessageOneofCase.EncounterStart:
				if (EncounterStart == null)
				{
					EncounterStart = new ClientboundEncounterStart();
				}
				EncounterStart.MergeFrom(other.EncounterStart);
				break;
			case MessageOneofCase.EncounterUpdate:
				if (EncounterUpdate == null)
				{
					EncounterUpdate = new ClientboundEncounterUpdate();
				}
				EncounterUpdate.MergeFrom(other.EncounterUpdate);
				break;
			case MessageOneofCase.EncounterEnd:
				if (EncounterEnd == null)
				{
					EncounterEnd = new ClientboundEncounterEnd();
				}
				EncounterEnd.MergeFrom(other.EncounterEnd);
				break;
			case MessageOneofCase.CustomPacket:
				if (CustomPacket == null)
				{
					CustomPacket = new ClientboundCustomPacket();
				}
				CustomPacket.MergeFrom(other.CustomPacket);
				break;
			case MessageOneofCase.QuickChat:
				if (QuickChat == null)
				{
					QuickChat = new ClientboundQuickChat();
				}
				QuickChat.MergeFrom(other.QuickChat);
				break;
			}
			_unknownFields = UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
		}

		[DebuggerNonUserCode]
		[GeneratedCode("protoc", null)]
		public void MergeFrom(CodedInputStream input)
		{
			input.ReadRawMessage((IMessage)(object)this);
		}

		[DebuggerNonUserCode]
		[GeneratedCode("protoc", null)]
		void IBufferMessage.InternalMergeFrom(ref ParseContext input)
		{
			uint num;
			while ((num = ((ParseContext)(ref input)).ReadTag()) != 0)
			{
				switch (num)
				{
				default:
					_unknownFields = UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
					break;
				case 10u:
				{
					ClientboundHello clientboundHello = new ClientboundHello();
					if (messageCase_ == MessageOneofCase.Hello)
					{
						clientboundHello.MergeFrom(Hello);
					}
					((ParseContext)(ref input)).ReadMessage((IMessage)(object)clientboundHello);
					Hello = clientboundHello;
					break;
				}
				case 18u:
				{
					ClientboundPlayersUpdate clientboundPlayersUpdate = new ClientboundPlayersUpdate();
					if (messageCase_ == MessageOneofCase.PlayersUpdate)
					{
						clientboundPlayersUpdate.MergeFrom(PlayersUpdate);
					}
					((ParseContext)(ref input)).ReadMessage((IMessage)(object)clientboundPlayersUpdate);
					PlayersUpdate = clientboundPlayersUpdate;
					break;
				}
				case 26u:
				{
					ClientboundPositionUpdate clientboundPositionUpdate = new ClientboundPositionUpdate();
					if (messageCase_ == MessageOneofCase.PositionUpdate)
					{
						clientboundPositionUpdate.MergeFrom(PositionUpdate);
					}
					((ParseContext)(ref input)).ReadMessage((IMessage)(object)clientboundPositionUpdate);
					PositionUpdate = clientboundPositionUpdate;
					break;
				}
				case 34u:
				{
					ClientboundPong clientboundPong = new ClientboundPong();
					if (messageCase_ == MessageOneofCase.Pong)
					{
						clientboundPong.MergeFrom(Pong);
					}
					((ParseContext)(ref input)).ReadMessage((IMessage)(object)clientboundPong);
					Pong = clientboundPong;
					break;
				}
				case 42u:
				{
					ClientboundVisualUpdate clientboundVisualUpdate = new ClientboundVisualUpdate();
					if (messageCase_ == MessageOneofCase.VisualUpdate)
					{
						clientboundVisualUpdate.MergeFrom(VisualUpdate);
					}
					((ParseContext)(ref input)).ReadMessage((IMessage)(object)clientboundVisualUpdate);
					VisualUpdate = clientboundVisualUpdate;
					break;
				}
				case 50u:
				{
					ClientboundAnimationUpdate clientboundAnimationUpdate = new ClientboundAnimationUpdate();
					if (messageCase_ == MessageOneofCase.AnimationUpdate)
					{
						clientboundAnimationUpdate.MergeFrom(AnimationUpdate);
					}
					((ParseContext)(ref input)).ReadMessage((IMessage)(object)clientboundAnimationUpdate);
					AnimationUpdate = clientboundAnimationUpdate;
					break;
				}
				case 58u:
				{
					ClientboundEncounterRequest clientboundEncounterRequest = new ClientboundEncounterRequest();
					if (messageCase_ == MessageOneofCase.EncounterRequest)
					{
						clientboundEncounterRequest.MergeFrom(EncounterRequest);
					}
					((ParseContext)(ref input)).ReadMessage((IMessage)(object)clientboundEncounterRequest);
					EncounterRequest = clientboundEncounterRequest;
					break;
				}
				case 66u:
				{
					ClientboundEncounterStart clientboundEncounterStart = new ClientboundEncounterStart();
					if (messageCase_ == MessageOneofCase.EncounterStart)
					{
						clientboundEncounterStart.MergeFrom(EncounterStart);
					}
					((ParseContext)(ref input)).ReadMessage((IMessage)(object)clientboundEncounterStart);
					EncounterStart = clientboundEncounterStart;
					break;
				}
				case 74u:
				{
					ClientboundEncounterUpdate clientboundEncounterUpdate = new ClientboundEncounterUpdate();
					if (messageCase_ == MessageOneofCase.EncounterUpdate)
					{
						clientboundEncounterUpdate.MergeFrom(EncounterUpdate);
					}
					((ParseContext)(ref input)).ReadMessage((IMessage)(object)clientboundEncounterUpdate);
					EncounterUpdate = clientboundEncounterUpdate;
					break;
				}
				case 82u:
				{
					ClientboundEncounterEnd clientboundEncounterEnd = new ClientboundEncounterEnd();
					if (messageCase_ == MessageOneofCase.EncounterEnd)
					{
						clientboundEncounterEnd.MergeFrom(EncounterEnd);
					}
					((ParseContext)(ref input)).ReadMessage((IMessage)(object)clientboundEncounterEnd);
					EncounterEnd = clientboundEncounterEnd;
					break;
				}
				case 90u:
				{
					ClientboundCustomPacket clientboundCustomPacket = new ClientboundCustomPacket();
					if (messageCase_ == MessageOneofCase.CustomPacket)
					{
						clientboundCustomPacket.MergeFrom(CustomPacket);
					}
					((ParseContext)(ref input)).ReadMessage((IMessage)(object)clientboundCustomPacket);
					CustomPacket = clientboundCustomPacket;
					break;
				}
				case 98u:
				{
					ClientboundQuickChat clientboundQuickChat = new ClientboundQuickChat();
					if (messageCase_ == MessageOneofCase.QuickChat)
					{
						clientboundQuickChat.MergeFrom(QuickChat);
					}
					((ParseContext)(ref input)).ReadMessage((IMessage)(object)clientboundQuickChat);
					QuickChat = clientboundQuickChat;
					break;
				}
				}
			}
		}
	}
	public sealed class ClientboundHello : IMessage<ClientboundHello>, IMessage, IEquatable<ClientboundHello>, IDeepCloneable<ClientboundHello>, IBufferMessage
	{
		private static readonly MessageParser<ClientboundHello> _parser = new MessageParser<ClientboundHello>((Func<ClientboundHello>)(() => new ClientboundHello()));

		private UnknownFieldSet _unknownFields;

		public const int TickRateFieldNumber = 1;

		private int tickRate_;

		public const int BannedPluginsFieldNumber = 2;

		private static readonly FieldCodec<string> _repeated_bannedPlugins_codec = FieldCodec.ForString(18u);

		private readonly RepeatedField<string> bannedPlugins_ = new RepeatedField<string>();

		public const int ScoreBattleLengthFieldNumber = 3;

		private uint scoreBattleLength_;

		public const int ComboBattleLengthFieldNumber = 4;

		private uint comboBattleLength_;

		[DebuggerNonUserCode]
		[GeneratedCode("protoc", null)]
		public static MessageParser<ClientboundHello> Parser => _parser;

		[DebuggerNonUserCode]
		[GeneratedCode("protoc", null)]
		public static MessageDescriptor Descriptor => ClientboundReflection.Descriptor.MessageTypes[1];

		[DebuggerNonUserCode]
		[GeneratedCode("protoc", null)]
		MessageDescriptor IMessage.Descriptor => Descriptor;

		[DebuggerNonUserCode]
		[GeneratedCode("protoc", null)]
		public int TickRate
		{
			get
			{
				return tickRate_;
			}
			set
			{
				tickRate_ = value;
			}
		}

		[DebuggerNonUserCode]
		[GeneratedCode("protoc", null)]
		public RepeatedField<string> BannedPlugins => bannedPlugins_;

		[DebuggerNonUserCode]
		[GeneratedCode("protoc", null)]
		public uint ScoreBattleLength
		{
			get
			{
				return scoreBattleLength_;
			}
			set
			{
				scoreBattleLength_ = value;
			}
		}

		[DebuggerNonUserCode]
		[GeneratedCode("protoc", null)]
		public uint ComboBattleLength
		{
			get
			{
				return comboBattleLength_;
			}
			set
			{
				comboBattleLength_ = value;
			}
		}

		[DebuggerNonUserCode]
		[GeneratedCode("protoc", null)]
		public ClientboundHello()
		{
		}

		[DebuggerNonUserCode]
		[GeneratedCode("protoc", null)]
		public ClientboundHello(ClientboundHello other)
			: this()
		{
			tickRate_ = other.tickRate_;
			bannedPlugins_ = other.bannedPlugins_.Clone();
			scoreBattleLength_ = other.scoreBattleLength_;
			comboBattleLength_ = other.comboBattleLength_;
			_unknownFields = UnknownFieldSet.Clone(other._unknownFields);
		}

		[DebuggerNonUserCode]
		[GeneratedCode("protoc", null)]
		public ClientboundHello Clone()
		{
			return new ClientboundHello(this);
		}

		[DebuggerNonUserCode]
		[GeneratedCode("protoc", null)]
		public override bool Equals(object other)
		{
			return Equals(other as ClientboundHello);
		}

		[DebuggerNonUserCode]
		[GeneratedCode("protoc", null)]
		public bool Equals(ClientboundHello other)
		{
			if (other == null)
			{
				return false;
			}
			if (other == this)
			{
				return true;
			}
			if (TickRate != other.TickRate)
			{
				return false;
			}
			if (!bannedPlugins_.Equals(other.bannedPlugins_))
			{
				return false;
			}
			if (ScoreBattleLength != other.ScoreBattleLength)
			{
				return false;
			}
			if (ComboBattleLength != other.ComboBattleLength)
			{
				return false;
			}
			return object.Equals(_unknownFields, other._unknownFields);
		}

		[DebuggerNonUserCode]
		[GeneratedCode("protoc", null)]
		public override int GetHashCode()
		{
			int num = 1;
			if (TickRate != 0)
			{
				num ^= TickRate.GetHashCode();
			}
			num ^= ((object)bannedPlugins_).GetHashCode();
			if (ScoreBattleLength != 0)
			{
				num ^= ScoreBattleLength.GetHashCode();
			}
			if (ComboBattleLength != 0)
			{
				num ^= ComboBattleLength.GetHashCode();
			}
			if (_unknownFields != null)
			{
				num ^= ((object)_unknownFields).GetHashCode();
			}
			return num;
		}

		[DebuggerNonUserCode]
		[GeneratedCode("protoc", null)]
		public override string ToString()
		{
			return JsonFormatter.ToDiagnosticString((IMessage)(object)this);
		}

		[DebuggerNonUserCode]
		[GeneratedCode("protoc", null)]
		public void WriteTo(CodedOutputStream output)
		{
			output.WriteRawMessage((IMessage)(object)this);
		}

		[DebuggerNonUserCode]
		[GeneratedCode("protoc", null)]
		void IBufferMessage.InternalWriteTo(ref WriteContext output)
		{
			if (TickRate != 0)
			{
				((WriteContext)(ref output)).WriteRawTag((byte)8);
				((WriteContext)(ref output)).WriteInt32(TickRate);
			}
			bannedPlugins_.WriteTo(ref output, _repeated_bannedPlugins_codec);
			if (ScoreBattleLength != 0)
			{
				((WriteContext)(ref output)).WriteRawTag((byte)24);
				((WriteContext)(ref output)).WriteUInt32(ScoreBattleLength);
			}
			if (ComboBattleLength != 0)
			{
				((WriteContext)(ref output)).WriteRawTag((byte)32);
				((WriteContext)(ref output)).WriteUInt32(ComboBattleLength);
			}
			if (_unknownFields != null)
			{
				_unknownFields.WriteTo(ref output);
			}
		}

		[DebuggerNonUserCode]
		[GeneratedCode("protoc", null)]
		public int CalculateSize()
		{
			int num = 0;
			if (TickRate != 0)
			{
				num += 1 + CodedOutputStream.ComputeInt32Size(TickRate);
			}
			num += bannedPlugins_.CalculateSize(_repeated_bannedPlugins_codec);
			if (ScoreBattleLength != 0)
			{
				num += 1 + CodedOutputStream.ComputeUInt32Size(ScoreBattleLength);
			}
			if (ComboBattleLength != 0)
			{
				num += 1 + CodedOutputStream.ComputeUInt32Size(ComboBattleLength);
			}
			if (_unknownFields != null)
			{
				num += _unknownFields.CalculateSize();
			}
			return num;
		}

		[DebuggerNonUserCode]
		[GeneratedCode("protoc", null)]
		public void MergeFrom(ClientboundHello other)
		{
			if (other != null)
			{
				if (other.TickRate != 0)
				{
					TickRate = other.TickRate;
				}
				bannedPlugins_.Add((IEnumerable<string>)other.bannedPlugins_);
				if (other.ScoreBattleLength != 0)
				{
					ScoreBattleLength = other.ScoreBattleLength;
				}
				if (other.ComboBattleLength != 0)
				{
					ComboBattleLength = other.ComboBattleLength;
				}
				_unknownFields = UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
			}
		}

		[DebuggerNonUserCode]
		[GeneratedCode("protoc", null)]
		public void MergeFrom(CodedInputStream input)
		{
			input.ReadRawMessage((IMessage)(object)this);
		}

		[DebuggerNonUserCode]
		[GeneratedCode("protoc", null)]
		void IBufferMessage.Intern

BepInEx/plugins/SlopCrew.Plugin/SlopCrew.Plugin.dll

Decompiled 8 months ago
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Net;
using System.Numerics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Threading;
using System.Threading.Tasks;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using CrewBoomAPI;
using DG.Tweening;
using DG.Tweening.Core;
using DG.Tweening.Plugins.Options;
using Google.Protobuf;
using Google.Protobuf.Collections;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Reptile;
using Reptile.Phone;
using SlopCrew.API;
using SlopCrew.Common;
using SlopCrew.Common.Proto;
using SlopCrew.Plugin.Encounters;
using SlopCrew.Plugin.Encounters.Race;
using SlopCrew.Plugin.UI;
using SlopCrew.Plugin.UI.Phone;
using TMPro;
using UnityEngine;
using UnityEngine.TextCore;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: AssemblyCompany("NotNite")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("2.2.1.0")]
[assembly: AssemblyInformationalVersion("2.2.1+674acc4b21cf01518f4afa48c5dd0a05dce797fc")]
[assembly: AssemblyProduct("SlopCrew")]
[assembly: AssemblyTitle("SlopCrew.Plugin")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("2.2.1.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 SlopCrew.Plugin
{
	public class AssociatedPlayer : IDisposable
	{
		public Player SlopPlayer;

		public Player ReptilePlayer;

		public MapPin? MapPin;

		private PlayerManager playerManager;

		private ConnectionManager connectionManager;

		private Config config;

		private CharacterInfoManager characterInfoManager;

		private Vector3 velocity;

		private PositionUpdate? targetUpdate;

		private float? targetPosSpeed;

		private float? targetRotSpeed;

		private bool doTheFunny;

		public bool PhoneOut;

		private const float NameplateHeightFactor = 1.33f;

		public AssociatedPlayer(PlayerManager playerManager, ConnectionManager connectionManager, Config config, CharacterInfoManager characterInfoManager, Player slopPlayer)
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: 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_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: 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_0218: Expected O, but got Unknown
			//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
			this.playerManager = playerManager;
			this.connectionManager = connectionManager;
			this.config = config;
			this.characterInfoManager = characterInfoManager;
			SlopPlayer = slopPlayer;
			GameObject val = new GameObject("SlopCrew_EmptyGameObject");
			Transform transform = val.transform;
			transform.position = slopPlayer.Transform.Position.NetworkToUnity();
			transform.rotation = slopPlayer.Transform.Rotation.NetworkToUnity();
			Characters val2 = (Characters)slopPlayer.CharacterInfo.Character;
			int outfit = slopPlayer.CharacterInfo.Outfit;
			MoveStyle val3 = (MoveStyle)slopPlayer.CharacterInfo.MoveStyle;
			ProcessCharacterInfo(((IEnumerable<CustomCharacterInfo>)slopPlayer.CustomCharacterInfo).ToList());
			ReptilePlayer = WorldHandler.instance.SetupAIPlayerAt(transform, val2, (PlayerType)3, outfit, val3, (Crew)1);
			ReptilePlayer.motor.gravity = 0f;
			ReptilePlayer.motor.SetKinematic(true);
			((Behaviour)ReptilePlayer.motor).enabled = false;
			if (this.config.General.ShowPlayerNameplates.Value)
			{
				SpawnNameplate(playerManager.InterfaceUtility);
			}
			if (this.config.General.ShowPlayerMapPins.Value)
			{
				SpawnMapPin();
			}
			doTheFunny = DateTime.Now.Month == 4 && DateTime.Now.Day == 1;
			if (doTheFunny)
			{
				Assets assets = Core.Instance.Assets;
				if (!assets.availableBundles.ContainsKey("city_assets"))
				{
					assets.LoadAssetBundleByName("city_assets");
				}
				AssetBundle assetBundle = assets.availableBundles["city_assets"].AssetBundle;
				GameObject val4 = assetBundle.LoadAsset<GameObject>("Mascot_Polo_street");
				Material material = assetBundle.LoadAsset<Material>("MascotAtlas_MAT");
				GameObject obj = Object.Instantiate<GameObject>(val4, ReptilePlayer.tf);
				((Renderer)obj.GetComponent<MeshRenderer>()).material = material;
				obj.transform.localRotation = Quaternion.Euler(-90f, 180f, 0f);
				((Renderer)ReptilePlayer.characterVisual.mainRenderer).enabled = false;
			}
			Object.Destroy((Object)val);
		}

		public void ProcessCharacterInfo(List<CustomCharacterInfo> infos)
		{
			characterInfoManager.ProcessCharacterInfo(infos);
		}

		private void SpawnNameplate(InterfaceUtility interfaceUtility)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//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_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: 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_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: 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_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cb: 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)
			//IL_0239: Unknown result type (might be due to invalid IL or missing references)
			//IL_023e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0242: Unknown result type (might be due to invalid IL or missing references)
			//IL_0249: Unknown result type (might be due to invalid IL or missing references)
			//IL_024e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0252: Unknown result type (might be due to invalid IL or missing references)
			//IL_0257: Unknown result type (might be due to invalid IL or missing references)
			//IL_0259: Unknown result type (might be due to invalid IL or missing references)
			//IL_0266: Unknown result type (might be due to invalid IL or missing references)
			//IL_0281: 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)
			GameObject val = new GameObject("SlopCrew_NameplateContainer");
			GameObject val2 = new GameObject("SlopCrew_Nameplate");
			TextMeshPro val3 = val2.AddComponent<TextMeshPro>();
			val2.AddComponent<TextMeshProFilter>();
			((TMP_Text)val3).font = interfaceUtility.NameplateFont;
			((TMP_Text)val3).fontMaterial = interfaceUtility.NameplateFontMaterial;
			((TMP_Text)val3).alignment = (TextAlignmentOptions)4098;
			((TMP_Text)val3).fontSize = 2.5f;
			val3.sortingOrder = 1;
			((TMP_Text)val3).SetText(SlopPlayer.Name, true);
			val2.transform.parent = val.transform;
			if (SlopPlayer.IsCommunityContributor)
			{
				GameObject val4 = new GameObject("SlopCrew_DevIcon")
				{
					name = "SlopCrew_DevIcon"
				};
				val4.SetActive(true);
				SpriteRenderer obj = val4.AddComponent<SpriteRenderer>();
				GameplayUI gameplay = Core.Instance.UIManager.gameplay;
				obj.sprite = ((Component)gameplay.wanted1).GetComponent<Image>().sprite;
				((Renderer)obj).sortingOrder = 1;
				Vector3 localPosition = val4.transform.localPosition;
				localPosition -= new Vector3(0f, localPosition.y / 2f, 0f);
				val4.transform.localPosition = localPosition;
				val4.transform.parent = val.transform;
				val4.transform.localScale = new Vector3(0.1f, 0.1f, 0.1f);
				Transform transform = val4.transform;
				transform.position += new Vector3(0f, 0.25f, 0f);
				val4.AddComponent<UISpinny>();
			}
			val.transform.SetParent(((Component)ReptilePlayer.interactionCollider).transform, false);
			val2.transform.SetParent(val.transform, false);
			string representingCrew = SlopPlayer.RepresentingCrew;
			if (representingCrew != null)
			{
				GameObject val5 = new GameObject("SlopCrew_CrewTag");
				TextMeshPro val6 = val5.AddComponent<TextMeshPro>();
				val5.AddComponent<TextMeshProFilter>();
				((TMP_Text)val6).font = interfaceUtility.NameplateFont;
				((TMP_Text)val6).fontMaterial = interfaceUtility.NameplateFontMaterial;
				((TMP_Text)val6).alignment = (TextAlignmentOptions)4098;
				((TMP_Text)val6).fontSize = 1.5f;
				val6.sortingOrder = 1;
				((TMP_Text)val6).SetText(representingCrew, true);
				val5.transform.SetParent(val.transform, false);
				((TMP_Text)val3).ForceMeshUpdate(false, false);
				((TMP_Text)val6).ForceMeshUpdate(false, false);
				Bounds bounds = ((TMP_Text)val3).bounds;
				Vector3 size = ((Bounds)(ref bounds)).size;
				bounds = ((TMP_Text)val6).bounds;
				Vector3 size2 = ((Bounds)(ref bounds)).size;
				float num = (0f - size.x) / 2f + size2.x / 2f;
				float num2 = size.y / 2f + size2.y / 2f;
				val5.transform.localPosition = new Vector3(num, num2, 0f);
			}
			Collider interactionCollider = ReptilePlayer.interactionCollider;
			CapsuleCollider val7 = (CapsuleCollider)(object)((interactionCollider is CapsuleCollider) ? interactionCollider : null);
			val.transform.localPosition = Vector3.up * (val7.height * 1.33f);
			val.transform.Rotate(0f, 180f, 0f);
			if (config.General.BillboardNameplates.Value)
			{
				val.AddComponent<UIBillboard>();
			}
		}

		private void SpawnMapPin()
		{
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			Mapcontroller instance = Mapcontroller.Instance;
			MapPin = instance.CreatePin((PinType)2);
			MapPin.AssignGameplayEvent(((Component)ReptilePlayer).gameObject);
			MapPin.InitMapPin((PinType)2);
			MapPin.OnPinEnable();
			GameObject gameObject = ((Component)((Component)MapPin).transform.Find("InViewVisualization")).gameObject;
			Object.Destroy((Object)(object)((Component)gameObject.transform.Find("Particle System")).gameObject);
			GameObject gameObject2 = ((Component)((Component)MapPin).transform.Find("OutOfViewVisualization")).gameObject;
			ParticleSystem component = gameObject2.GetComponent<ParticleSystem>();
			ParticleSystemRenderer component2 = gameObject2.GetComponent<ParticleSystemRenderer>();
			Object.Destroy((Object)(object)component);
			Object.Destroy((Object)(object)component2);
			((Renderer)gameObject.GetComponent<MeshRenderer>()).material.color = new Color(1f, 1f, 0.85f);
		}

		public void Dispose()
		{
			if ((Object)(object)ReptilePlayer != (Object)null)
			{
				WorldHandler instance = WorldHandler.instance;
				if (instance != null)
				{
					SceneObjectsRegister sceneObjectsRegister = instance.SceneObjectsRegister;
					if (sceneObjectsRegister != null && sceneObjectsRegister.players != null)
					{
						instance.SceneObjectsRegister.players.Remove(ReptilePlayer);
					}
				}
				Object.Destroy((Object)(object)((Component)ReptilePlayer).gameObject);
			}
			if ((Object)(object)MapPin != (Object)null)
			{
				Object.Destroy((Object)(object)((Component)MapPin).gameObject);
			}
		}

		public void HandleVisualUpdate(VisualUpdate update)
		{
			//IL_0020: 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_002c: 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_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: 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)
			//IL_0087: 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_0092: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)ReptilePlayer == (Object)null))
			{
				CharacterVisual characterVisual = ReptilePlayer.characterVisual;
				SpraycanState spraycanState = ReptilePlayer.spraycanState;
				BoostpackEffectMode val = (BoostpackEffectMode)update.Boostpack;
				FrictionEffectMode frictionEffect = (FrictionEffectMode)update.Friction;
				bool spraycan = update.Spraycan;
				bool phone = update.Phone;
				SpraycanState val2 = (SpraycanState)update.SpraycanState;
				characterVisual.hasEffects = true;
				characterVisual.hasBoostPack = true;
				playerManager.SettingVisual = true;
				characterVisual.SetBoostpackEffect(val, -1f);
				characterVisual.SetFrictionEffect(frictionEffect);
				characterVisual.SetSpraycan(spraycan, (Characters)(-1));
				characterVisual.SetPhone(phone);
				if (spraycanState != val2)
				{
					ReptilePlayer.SetSpraycanState(val2);
				}
				PhoneOut = phone;
				playerManager.SettingVisual = false;
			}
		}

		public void HandleAnimationUpdate(AnimationUpdate update)
		{
			if (!((Object)(object)ReptilePlayer == (Object)null))
			{
				playerManager.PlayingAnimation = true;
				ReptilePlayer.PlayAnim(update.Animation, update.ForceOverwrite, update.Instant, update.Time);
				playerManager.PlayingAnimation = false;
			}
		}

		public void UpdateIfDifferent(Player player)
		{
			//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ac: Invalid comparison between Unknown and I4
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)ReptilePlayer == (Object)null)
			{
				return;
			}
			bool flag = player.CustomCharacterInfo.Count != SlopPlayer.CustomCharacterInfo.Count;
			foreach (CustomCharacterInfo info in player.CustomCharacterInfo)
			{
				CustomCharacterInfo val = ((IEnumerable<CustomCharacterInfo>)SlopPlayer.CustomCharacterInfo).FirstOrDefault((Func<CustomCharacterInfo, bool>)((CustomCharacterInfo i) => i.Id == info.Id));
				if (val == null || !val.Data.Equals(info.Data))
				{
					flag = true;
					break;
				}
			}
			bool flag2 = SlopPlayer.CharacterInfo.Character != player.CharacterInfo.Character || flag;
			bool flag3 = SlopPlayer.CharacterInfo.Outfit != player.CharacterInfo.Outfit;
			bool flag4 = SlopPlayer.CharacterInfo.MoveStyle != player.CharacterInfo.MoveStyle;
			if (!(flag2 || flag3 || flag4))
			{
				return;
			}
			if (flag3 && !flag2)
			{
				ReptilePlayer.SetOutfit(player.CharacterInfo.Outfit);
			}
			else if (flag2 || flag3)
			{
				ProcessCharacterInfo(((IEnumerable<CustomCharacterInfo>)player.CustomCharacterInfo).ToList());
				ReptilePlayer.SetCharacter((Characters)player.CharacterInfo.Character, player.CharacterInfo.Outfit);
				ReptilePlayer.InitVisual();
				if (doTheFunny)
				{
					((Renderer)ReptilePlayer.characterVisual.mainRenderer).enabled = false;
				}
			}
			if (flag4)
			{
				MoveStyle val2 = (MoveStyle)player.CharacterInfo.MoveStyle;
				bool flag5 = (int)val2 > 0;
				ReptilePlayer.SetCurrentMoveStyleEquipped(val2, true, true);
				ReptilePlayer.SwitchToEquippedMovestyle(flag5, false, true, true);
			}
			SlopPlayer = player;
		}

		public void QueuePositionUpdate(PositionUpdate newUpdate)
		{
			//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_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_005f: 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_006a: 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_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)ReptilePlayer == (Object)null))
			{
				targetUpdate = newUpdate;
				float num = (float)newUpdate.Latency / 1000f;
				float num2 = connectionManager.TickRate.Value + num;
				Vector3 position = ReptilePlayer.tf.position;
				Vector3 val = (targetUpdate.Transform.Position.NetworkToUnity() - position) / num2;
				Quaternion rotation = ReptilePlayer.tf.rotation;
				Quaternion val2 = targetUpdate.Transform.Rotation.NetworkToUnity();
				float value = Quaternion.Angle(rotation, val2) / num2;
				targetPosSpeed = ((Vector3)(ref val)).magnitude;
				targetRotSpeed = value;
			}
		}

		public void Update()
		{
			ProcessPositionUpdate();
			if ((Object)(object)MapPin != (Object)null)
			{
				MapPin.SetLocation();
			}
		}

		public void ProcessPositionUpdate()
		{
			//IL_0047: 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_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: 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_0079: 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_0096: 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_00b0: 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_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: 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_00ff: Unknown result type (might be due to invalid IL or missing references)
			if (targetUpdate != null && !((Object)(object)ReptilePlayer == (Object)null))
			{
				float num = (float)targetUpdate.Latency / 1000f;
				_ = connectionManager.TickRate.Value;
				Vector3 position = ReptilePlayer.tf.position;
				Vector3 val = targetUpdate.Transform.Position.NetworkToUnity();
				Vector3 position2 = Vector3.MoveTowards(position, val, targetPosSpeed.Value * Time.deltaTime);
				ReptilePlayer.tf.position = position2;
				Quaternion rotation = ReptilePlayer.tf.rotation;
				Quaternion val2 = targetUpdate.Transform.Rotation.NetworkToUnity();
				Quaternion rotation2 = Quaternion.RotateTowards(rotation, val2, targetRotSpeed.Value * Time.deltaTime);
				ReptilePlayer.tf.rotation = rotation2;
				if ((Object)(object)ReptilePlayer.characterVisual != (Object)null)
				{
					((Component)ReptilePlayer.characterVisual).transform.rotation = rotation2;
				}
			}
		}
	}
	public class CharacterInfoManager : IDisposable
	{
		private readonly SlopCrewAPI api;

		public readonly Dictionary<string, byte[]> CustomCharacterInfo = new Dictionary<string, byte[]>();

		public CharacterInfoManager(SlopCrewAPI api)
		{
			this.api = api;
			this.api.OnCustomCharacterInfoSet += OnCustomCharacterInfoSet;
		}

		public void Dispose()
		{
			api.OnCustomCharacterInfoSet -= OnCustomCharacterInfoSet;
		}

		private void OnCustomCharacterInfoSet(string id, byte[]? data)
		{
			if (data == null)
			{
				CustomCharacterInfo.Remove(id);
			}
			else
			{
				CustomCharacterInfo[id] = data;
			}
		}

		public List<CustomCharacterInfo> GetCharacterInfo(int character)
		{
			//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_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Expected O, but got Unknown
			//IL_0056: 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_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Expected O, but got Unknown
			List<CustomCharacterInfo> list = new List<CustomCharacterInfo>();
			Guid guid = default(Guid);
			if (CrewBoomAPIDatabase.IsInitialized && CrewBoomAPIDatabase.GetUserGuidForCharacter(character, ref guid))
			{
				list.Add(new CustomCharacterInfo
				{
					Id = "CrewBoom",
					Data = ByteString.CopyFrom(guid.ToByteArray())
				});
			}
			foreach (KeyValuePair<string, byte[]> item in CustomCharacterInfo)
			{
				list.Add(new CustomCharacterInfo
				{
					Id = item.Key,
					Data = ByteString.CopyFrom(item.Value)
				});
			}
			return list;
		}

		public void ProcessCharacterInfo(List<CustomCharacterInfo> infos)
		{
			foreach (CustomCharacterInfo info in infos)
			{
				if (info.Id == "CrewBoom")
				{
					CrewBoomAPIDatabase.OverrideNextCharacterLoadedWithGuid(new Guid(info.Data.ToByteArray()));
				}
			}
		}
	}
	public enum CharacterOverride
	{
		None = -1,
		Vinyl,
		Frank,
		Coil,
		Red,
		Tryce,
		Bel,
		Rave,
		DotExeMember,
		Solace,
		DjCyber,
		EclipseMember,
		DevilTheoryMember,
		FauxWithBoostPack,
		FleshPrince,
		Irene,
		Felix,
		OldHeadMember,
		Base,
		Jet,
		Mesh,
		FuturismMember,
		Rise,
		Shine,
		FauxWithoutBoostPack,
		DotExeBoss,
		FelixWithCyberHead
	}
	public class Config
	{
		public class ConfigGeneral
		{
			public ConfigEntry<string> Username = config.Bind<string>("General", "Username", "Big Slopper", "Username to show to other players.");

			public ConfigEntry<bool> ShowConnectionInfo = config.Bind<bool>("General", "ShowConnectionInfo", true, "Show current connection status and player count.");

			public ConfigEntry<bool> ShowPlayerNameplates = config.Bind<bool>("General", "ShowPlayerNameplates", true, "Show players' names above their heads.");

			public ConfigEntry<bool> BillboardNameplates = config.Bind<bool>("General", "BillboardNameplates", true, "Billboard nameplates (always face the camera).");

			public ConfigEntry<bool> OutlineNameplates = config.Bind<bool>("General", "OutlineNameplates", true, "Add a dark outline to nameplates for contrast.");

			public ConfigEntry<bool> ShowPlayerMapPins = config.Bind<bool>("General", "ShowPlayerMapPins", true, "Show players on the phone map.");

			public ConfigEntry<bool> ShowQuickChat = config.Bind<bool>("General", "ShowQuickChat", true, "Show quick chat messages.");

			public ConfigEntry<CharacterOverride> CharacterOverride = config.Bind<CharacterOverride>("General", "CharacterOverride", SlopCrew.Plugin.CharacterOverride.None, "Force a certain character to appear at all times. Useful if you are a CrewBoom user to avoid being Red for other players without your mod.");

			public ConfigEntry<int> OutfitOverride = config.Bind<int>("General", "OutfitOverride", -1, "Force a certain outfit to appear at all times. Only works if CharacterOverride is set. Values 0-3.");

			public ConfigGeneral(ConfigFile config)
			{
			}
		}

		public class ConfigFixes
		{
			public ConfigEntry<bool> FixBikeGate = config.Bind<bool>("Fixes", "FixBikeGate", true, "Fix other players being able to start bike gate cutscenes.");

			public ConfigEntry<bool> FixAmbientColors = config.Bind<bool>("Fixes", "FixAmbientColors", true, "Fix other players being able to change color grading.");

			public ConfigFixes(ConfigFile config)
			{
			}
		}

		public class ConfigPhone
		{
			public ConfigEntry<bool> ReceiveNotifications = config.Bind<bool>("Phone", "ReceiveNotifications", true, "Receive notifications to start encounters from other players.");

			public ConfigEntry<bool> StartEncountersOnRequest = config.Bind<bool>("Phone", "StartEncountersOnRequest", true, "Start encounters when opening a notification.");

			public ConfigPhone(ConfigFile config)
			{
			}
		}

		public class ConfigServer
		{
			public ConfigEntry<string> Host = config.Bind<string>("Server", "Host", "sloppers.club", "Host to connect to. This can be an IP address or domain name.");

			public ConfigEntry<ushort> Port = config.Bind<ushort>("Server", "Port", (ushort)42069, "Port to connect to.");

			public ConfigEntry<string> Key = config.Bind<string>("Server", "Key", "", "Authentication key to link your Discord account to Slop Crew. On the official Slop Crew server, this can be done at https://slopnet.sloppers.club/.");

			public ConfigServer(ConfigFile config)
			{
			}
		}

		public ConfigGeneral General = new ConfigGeneral(config);

		public ConfigFixes Fixes = new ConfigFixes(config);

		public ConfigPhone Phone = new ConfigPhone(config);

		public ConfigServer Server = new ConfigServer(config);

		public Config(ConfigFile config)
		{
		}
	}
	public class ConnectionManager : IHostedService
	{
		public ulong ServerTick;

		public ulong Latency;

		private Config config;

		private ManualLogSource logger;

		private SlopCrewAPI api;

		private NetworkingSockets client;

		private uint? connection;

		private Address address;

		private ConnectionState lastState;

		public Action<ClientboundMessage>? MessageReceived;

		public Action? Tick;

		public Action? Disconnected;

		public float? TickRate;

		private float tickTimer;

		private Task? pingTask;

		private CancellationTokenSource? pingTokenSource;

		private DateTime lastPing = DateTime.MinValue;

		private uint pingId;

		public ConnectionManager(Config config, ManualLogSource logger, SlopCrewAPI api)
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Expected O, but got Unknown
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Expected O, but got Unknown
			this.config = config;
			this.logger = logger;
			this.api = api;
			Library.Initialize();
			client = new NetworkingSockets();
			address = default(Address);
			try
			{
				((Address)(ref address)).SetAddress(this.config.Server.Host.Value, this.config.Server.Port.Value);
			}
			catch
			{
				((Address)(ref address)).SetAddress(LookupIP(this.config.Server.Host.Value), this.config.Server.Port.Value);
			}
			Core.OnUpdate += new OnUpdateHandler(Update);
			this.api.OnCustomPacketSent += SendCustomPacket;
		}

		private string LookupIP(string host)
		{
			try
			{
				IPHostEntry hostEntry = Dns.GetHostEntry("_slopcrew._udp." + host);
				if (hostEntry.AddressList.Length != 0)
				{
					return hostEntry.AddressList[0].ToString();
				}
			}
			catch
			{
			}
			try
			{
				IPHostEntry hostEntry2 = Dns.GetHostEntry(host);
				if (hostEntry2.AddressList.Length != 0)
				{
					return hostEntry2.AddressList[0].ToString();
				}
			}
			catch
			{
			}
			throw new Exception("Could not resolve host " + host);
		}

		public Task StartAsync(CancellationToken cancellationToken)
		{
			Connect();
			return Task.CompletedTask;
		}

		public void Connect()
		{
			connection = client.Connect(ref address);
			if (pingTask != null)
			{
				pingTokenSource.Cancel();
				pingTask.Wait();
			}
			pingTokenSource = new CancellationTokenSource();
			pingTask = Task.Run(async delegate
			{
				while (!pingTokenSource.IsCancellationRequested)
				{
					pingId = (uint)Random.Range(0, int.MaxValue);
					lastPing = DateTime.Now;
					ulong time = (ulong)(DateTime.UtcNow.ToFileTimeUtc() / 10000);
					SendMessage(new ServerboundMessage
					{
						Ping = new ServerboundPing
						{
							Id = pingId,
							Time = time
						}
					}, (SendFlags)8);
					await Task.Delay(5000, pingTokenSource.Token);
				}
			}, pingTokenSource.Token);
		}

		public Task StopAsync(CancellationToken cancellationToken)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			Core.OnUpdate -= new OnUpdateHandler(Update);
			uint? num = connection;
			if (num.HasValue)
			{
				client.CloseConnection(connection.Value);
			}
			Library.Deinitialize();
			return Task.CompletedTask;
		}

		private void Update()
		{
			//IL_0098: 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_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: 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_00f7: 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)
			float? tickRate = TickRate;
			if (tickRate.HasValue)
			{
				tickTimer += Time.deltaTime;
				if (tickTimer >= TickRate)
				{
					tickTimer -= TickRate.Value;
					ServerTick++;
					Tick?.Invoke();
				}
			}
			client.RunCallbacks();
			if (!connection.HasValue)
			{
				return;
			}
			ConnectionInfo val = default(ConnectionInfo);
			client.GetConnectionInfo(connection.Value, ref val);
			if (val.state != lastState)
			{
				logger.LogDebug((object)$"Connection state changed from {lastState} to {val.state}");
				lastState = val.state;
				HandleStateChange(val);
			}
			NetworkingMessage[] array = (NetworkingMessage[])(object)new NetworkingMessage[20];
			int num = client.ReceiveMessagesOnConnection(connection.Value, array, 20);
			if (num <= 0)
			{
				return;
			}
			for (int i = 0; i < num; i++)
			{
				ref NetworkingMessage reference = ref array[i];
				byte[] array2 = new byte[reference.length];
				Marshal.Copy(reference.data, array2, 0, reference.length);
				ClientboundMessage val2 = ClientboundMessage.Parser.ParseFrom(array2);
				if (val2 != null)
				{
					ProcessMessage(val2);
				}
				((NetworkingMessage)(ref reference)).Destroy();
			}
		}

		private void ProcessMessage(ClientboundMessage packet)
		{
			//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_0019: 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)
			//IL_0031: Expected I4, but got Unknown
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Invalid comparison between Unknown and I4
			MessageReceived?.Invoke(packet);
			MessageOneofCase messageCase = packet.MessageCase;
			switch (messageCase - 1)
			{
			default:
				if ((int)messageCase == 11)
				{
					api.DispatchCustomPacket(packet.CustomPacket.PlayerId, packet.CustomPacket.Packet.Id, packet.CustomPacket.Packet.Data.ToByteArray());
				}
				break;
			case 0:
				TickRate = 1f / (float)packet.Hello.TickRate;
				api.ChangeTickRate(packet.Hello.TickRate);
				break;
			case 3:
			{
				uint num = (uint)(DateTime.Now - lastPing).TotalMilliseconds;
				Latency = num;
				ServerTick = packet.Pong.Tick;
				api.ChangeLatency(Latency);
				api.DispatchServerTick(ServerTick);
				break;
			}
			case 1:
				api.ChangePlayerCount(packet.PlayersUpdate.Players.Count + 1);
				break;
			case 2:
				break;
			}
		}

		public void SendMessage(ServerboundMessage packet, SendFlags flags = 8)
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			uint? num = connection;
			if (!num.HasValue)
			{
				throw new Exception("Not connected");
			}
			byte[] array = MessageExtensions.ToByteArray((IMessage)(object)packet);
			client.SendMessageToConnection(connection.Value, array, flags);
		}

		private void HandleStateChange(ConnectionInfo connectionInfo)
		{
			//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_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)
			//IL_0009: Invalid comparison between Unknown and I4
			//IL_001f: 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_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: 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_0041: Expected O, but got Unknown
			//IL_0047: Expected O, but got Unknown
			//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)
			//IL_000f: Invalid comparison between Unknown and I4
			ConnectionState state = connectionInfo.state;
			if ((int)state != 3)
			{
				if (state - 4 <= 1)
				{
					OnDisconnect();
				}
			}
			else
			{
				api.ChangeConnected(value: true);
				SendMessage(new ServerboundMessage
				{
					Version = new ServerboundVersion
					{
						ProtocolVersion = 5u,
						PluginVersion = "2.2.1"
					}
				}, (SendFlags)8);
			}
		}

		private void OnDisconnect()
		{
			logger.LogWarning((object)"Disconnected - attempting to reconnect");
			Disconnected?.Invoke();
			TickRate = null;
			tickTimer = 0f;
			client.CloseConnection(connection.Value);
			pingTokenSource?.Cancel();
			api.ChangeConnected(value: false);
			Task.Delay(5000).ContinueWith(delegate
			{
				Connect();
			});
		}

		private void SendCustomPacket(string id, byte[] data)
		{
			//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)
			//IL_0012: 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_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_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Expected O, but got Unknown
			//IL_003a: Expected O, but got Unknown
			//IL_0040: Expected O, but got Unknown
			if (data.Length <= 512)
			{
				SendMessage(new ServerboundMessage
				{
					CustomPacket = new ServerboundCustomPacket
					{
						Packet = new CustomPacket
						{
							Id = id,
							Data = ByteString.CopyFrom(data)
						}
					}
				}, (SendFlags)8);
			}
		}
	}
	public class InputBlocker
	{
		private int shouldIgnoreInputInternal;

		public bool ShouldIgnoreInput
		{
			get
			{
				return Interlocked.CompareExchange(ref shouldIgnoreInputInternal, 0, 0) == 1;
			}
			set
			{
				Interlocked.Exchange(ref shouldIgnoreInputInternal, value ? 1 : 0);
			}
		}
	}
	public class LocalPlayerManager : IHostedService
	{
		[CompilerGenerated]
		private Config <config>P;

		[CompilerGenerated]
		private ConnectionManager <connectionManager>P;

		[CompilerGenerated]
		private CharacterInfoManager <characterInfoManager>P;

		[CompilerGenerated]
		private SlopCrewAPI <api>P;

		public bool HelloRefreshQueued;

		public bool VisualRefreshQueued;

		public int CurrentOutfit;

		private Transform? lastTransform;

		private int? lastAnimation;

		public LocalPlayerManager(Config config, ConnectionManager connectionManager, CharacterInfoManager characterInfoManager, SlopCrewAPI api)
		{
			<config>P = config;
			<connectionManager>P = connectionManager;
			<characterInfoManager>P = characterInfoManager;
			<api>P = api;
			base..ctor();
		}

		public Task StartAsync(CancellationToken cancellationToken)
		{
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Expected O, but got Unknown
			ConnectionManager connectionManager = <connectionManager>P;
			connectionManager.Tick = (Action)Delegate.Combine(connectionManager.Tick, new Action(Tick));
			ConnectionManager connectionManager2 = <connectionManager>P;
			connectionManager2.MessageReceived = (Action<ClientboundMessage>)Delegate.Combine(connectionManager2.MessageReceived, new Action<ClientboundMessage>(MessageReceived));
			SlopCrewAPI slopCrewAPI = <api>P;
			slopCrewAPI.OnGetLocalPlayerName = (Func<string>)Delegate.Combine(slopCrewAPI.OnGetLocalPlayerName, new Func<string>(OnGetLocalPlayerName));
			StageManager.OnStagePostInitialization += new OnStageInitializedDelegate(StagePostInit);
			return Task.CompletedTask;
		}

		public Task StopAsync(CancellationToken cancellationToken)
		{
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Expected O, but got Unknown
			ConnectionManager connectionManager = <connectionManager>P;
			connectionManager.Tick = (Action)Delegate.Remove(connectionManager.Tick, new Action(Tick));
			ConnectionManager connectionManager2 = <connectionManager>P;
			connectionManager2.MessageReceived = (Action<ClientboundMessage>)Delegate.Remove(connectionManager2.MessageReceived, new Action<ClientboundMessage>(MessageReceived));
			SlopCrewAPI slopCrewAPI = <api>P;
			slopCrewAPI.OnGetLocalPlayerName = (Func<string>)Delegate.Remove(slopCrewAPI.OnGetLocalPlayerName, new Func<string>(OnGetLocalPlayerName));
			StageManager.OnStagePostInitialization -= new OnStageInitializedDelegate(StagePostInit);
			return Task.CompletedTask;
		}

		private string OnGetLocalPlayerName()
		{
			return PlayerNameFilter.DoFilter(<config>P.General.Username.Value);
		}

		private void MessageReceived(ClientboundMessage message)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Invalid comparison between Unknown and I4
			if ((int)message.MessageCase == 1)
			{
				HelloRefreshQueued = true;
			}
		}

		private void Tick()
		{
			WorldHandler instance = WorldHandler.instance;
			if (!((Object)(object)instance == (Object)null))
			{
				Player currentPlayer = instance.GetCurrentPlayer();
				if (!((Object)(object)currentPlayer == (Object)null))
				{
					HandleRefreshes(currentPlayer);
					HandleMovement(currentPlayer);
				}
			}
		}

		private void HandleRefreshes(Player me)
		{
			//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cc: Expected I4, but got Unknown
			//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dd: Expected I4, but got Unknown
			//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0213: 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)
			//IL_021f: Expected I4, but got Unknown
			//IL_0224: Expected O, but got Unknown
			//IL_0229: Expected O, but got Unknown
			//IL_022f: Expected O, but got Unknown
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Expected I4, but got Unknown
			//IL_008e: 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_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: 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_00ba: 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_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Expected O, but got Unknown
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Expected O, but got Unknown
			//IL_00f6: 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_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Expected O, but got Unknown
			//IL_0116: Expected O, but got Unknown
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Expected I4, but got Unknown
			//IL_013b: Expected O, but got Unknown
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Expected O, but got Unknown
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Expected O, but got Unknown
			//IL_0192: Expected O, but got Unknown
			if (HelloRefreshQueued)
			{
				string key = <config>P.Server.Key.Value ?? string.Empty;
				int character = (int)me.character;
				int outfit = CurrentOutfit;
				List<CustomCharacterInfo> characterInfo = <characterInfoManager>P.GetCharacterInfo(character);
				CharacterOverride value = <config>P.General.CharacterOverride.Value;
				int value2 = <config>P.General.OutfitOverride.Value;
				if (value != CharacterOverride.None)
				{
					character = (int)value;
					if (value2 >= 0 && value2 <= 3)
					{
						outfit = value2;
					}
				}
				ConnectionManager connectionManager = <connectionManager>P;
				ServerboundMessage val = new ServerboundMessage();
				ServerboundHello val2 = new ServerboundHello();
				Player val3 = new Player
				{
					Name = <config>P.General.Username.Value,
					Transform = new Transform
					{
						Position = new Vector3(me.tf.position.UnityToSystem()),
						Rotation = new Quaternion(me.tf.rotation.UnityToSystem()),
						Velocity = new Vector3(me.motor.velocity.UnityToSystem())
					},
					CharacterInfo = new CharacterInfo
					{
						Character = character,
						Outfit = outfit,
						MoveStyle = (int)me.moveStyle
					}
				};
				val3.CustomCharacterInfo.Add((IEnumerable<CustomCharacterInfo>)characterInfo);
				val2.Player = val3;
				val2.Stage = <api>P.StageOverride ?? ((int)Core.instance.baseModule.CurrentStage);
				val2.Key = key;
				val.Hello = val2;
				connectionManager.SendMessage(val, (SendFlags)8);
				HelloRefreshQueued = false;
			}
			if (VisualRefreshQueued)
			{
				<connectionManager>P.SendMessage(new ServerboundMessage
				{
					VisualUpdate = new ServerboundVisualUpdate
					{
						Update = new VisualUpdate
						{
							Boostpack = (int)me.characterVisual.boostpackEffectMode,
							Friction = (int)me.characterVisual.frictionEffectMode,
							Spraycan = me.characterVisual.VFX.spraycan.activeSelf,
							Phone = me.characterVisual.VFX.phone.activeSelf,
							SpraycanState = (int)me.spraycanState
						}
					}
				}, (SendFlags)8);
				VisualRefreshQueued = false;
			}
		}

		private void HandleMovement(Player me)
		{
			//IL_0007: 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_0023: 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_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Expected O, but got Unknown
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Expected O, but got Unknown
			//IL_00a1: 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_00ad: Expected O, but got Unknown
			//IL_00af: Expected O, but got Unknown
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: 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_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Expected O, but got Unknown
			//IL_00fa: Expected O, but got Unknown
			//IL_0100: Expected O, but got Unknown
			Transform tf = me.tf;
			Vector3 vector = tf.position.UnityToSystem();
			Quaternion quaternion = tf.rotation.UnityToSystem();
			Vector3 vector2 = me.motor.velocity.UnityToSystem();
			if (lastTransform == null || (Vector3.op_Implicit(lastTransform.Position) - vector).LengthSquared() > 0.01f || (Quaternion.op_Implicit(lastTransform.Rotation) - quaternion).LengthSquared() > 0.01f)
			{
				Transform transform = new Transform
				{
					Position = new Vector3(vector),
					Rotation = new Quaternion(quaternion),
					Velocity = new Vector3(vector2)
				};
				<connectionManager>P.SendMessage(new ServerboundMessage
				{
					PositionUpdate = new ServerboundPositionUpdate
					{
						Update = new PositionUpdate
						{
							Transform = transform,
							Tick = <connectionManager>P.ServerTick,
							Latency = <connectionManager>P.Latency
						}
					}
				}, (SendFlags)0);
				lastTransform = transform;
			}
		}

		private void StagePostInit()
		{
			HelloRefreshQueued = true;
		}

		public void PlayAnim(int anim, bool forceOverwrite, bool instant, float atTime)
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0048: 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_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Expected O, but got Unknown
			//IL_0068: Expected O, but got Unknown
			//IL_006e: Expected O, but got Unknown
			if (lastAnimation != anim)
			{
				lastAnimation = anim;
				<connectionManager>P.SendMessage(new ServerboundMessage
				{
					AnimationUpdate = new ServerboundAnimationUpdate
					{
						Update = new AnimationUpdate
						{
							Animation = anim,
							ForceOverwrite = forceOverwrite,
							Instant = instant,
							Time = atTime
						}
					}
				}, (SendFlags)8);
			}
		}
	}
	public class PatchManager : IHostedService
	{
		private Harmony harmony = new Harmony("SlopCrew.Plugin.Harmony");

		public Task StartAsync(CancellationToken cancellationToken)
		{
			Type[] array = (from m in typeof(Plugin).Assembly.GetTypes()
				where m.GetCustomAttributes(typeof(HarmonyPatch), inherit: false).Length != 0
				select m).ToArray();
			foreach (Type type in array)
			{
				harmony.PatchAll(type);
			}
			return Task.CompletedTask;
		}

		public Task StopAsync(CancellationToken cancellationToken)
		{
			harmony.UnpatchSelf();
			return Task.CompletedTask;
		}
	}
	public class PlayerManager : IHostedService
	{
		[CompilerGenerated]
		private ConnectionManager <connectionManager>P;

		[CompilerGenerated]
		private Config <config>P;

		[CompilerGenerated]
		private CharacterInfoManager <characterInfoManager>P;

		[CompilerGenerated]
		private SlopCrewAPI <api>P;

		public Dictionary<uint, AssociatedPlayer> Players;

		public readonly InterfaceUtility InterfaceUtility;

		public bool SettingVisual;

		public bool PlayingAnimation;

		public List<AssociatedPlayer> AssociatedPlayers => Players.Values.ToList();

		public PlayerManager(ConnectionManager connectionManager, Config config, CharacterInfoManager characterInfoManager, InterfaceUtility interfaceUtility, ManualLogSource logger, SlopCrewAPI api)
		{
			<connectionManager>P = connectionManager;
			<config>P = config;
			<characterInfoManager>P = characterInfoManager;
			<api>P = api;
			Players = new Dictionary<uint, AssociatedPlayer>();
			InterfaceUtility = interfaceUtility;
			base..ctor();
		}

		public Task StartAsync(CancellationToken cancellationToken)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			StageManager.OnStageInitialized += new OnStageInitializedDelegate(StageInit);
			ConnectionManager connectionManager = <connectionManager>P;
			connectionManager.Disconnected = (Action)Delegate.Combine(connectionManager.Disconnected, new Action(Disconnected));
			ConnectionManager connectionManager2 = <connectionManager>P;
			connectionManager2.MessageReceived = (Action<ClientboundMessage>)Delegate.Combine(connectionManager2.MessageReceived, new Action<ClientboundMessage>(MessageReceived));
			<api>P.OnGetGameObjectPathForPlayerID += GetGameObjectPathForPlayerID;
			<api>P.OnGetPlayerIDForGameObjectPath += GetPlayerIDForGameObjectPath;
			<api>P.OnPlayerIDExists += PlayerIDExists;
			<api>P.OnGetPlayerName += GetPlayerName;
			<api>P.OnGetPlayerList += GetPlayerList;
			return Task.CompletedTask;
		}

		public Task StopAsync(CancellationToken cancellationToken)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			StageManager.OnStageInitialized -= new OnStageInitializedDelegate(StageInit);
			ConnectionManager connectionManager = <connectionManager>P;
			connectionManager.Disconnected = (Action)Delegate.Remove(connectionManager.Disconnected, new Action(Disconnected));
			ConnectionManager connectionManager2 = <connectionManager>P;
			connectionManager2.MessageReceived = (Action<ClientboundMessage>)Delegate.Remove(connectionManager2.MessageReceived, new Action<ClientboundMessage>(MessageReceived));
			<api>P.OnGetGameObjectPathForPlayerID -= GetGameObjectPathForPlayerID;
			<api>P.OnGetPlayerIDForGameObjectPath -= GetPlayerIDForGameObjectPath;
			<api>P.OnPlayerIDExists -= PlayerIDExists;
			<api>P.OnGetPlayerName -= GetPlayerName;
			<api>P.OnGetPlayerList -= GetPlayerList;
			CleanupPlayers();
			return Task.CompletedTask;
		}

		private ReadOnlyCollection<uint> GetPlayerList()
		{
			return Players.Keys.ToList().AsReadOnly();
		}

		private string? GetGameObjectPathForPlayerID(uint playerid)
		{
			if (!Players.TryGetValue(playerid, out AssociatedPlayer value))
			{
				return null;
			}
			return ((Component)value.ReptilePlayer).gameObject.GetPath();
		}

		private uint? GetPlayerIDForGameObjectPath(string gameObjectPath)
		{
			foreach (KeyValuePair<uint, AssociatedPlayer> player in Players)
			{
				if (((Component)player.Value.ReptilePlayer).gameObject.GetPath() == gameObjectPath)
				{
					return player.Key;
				}
			}
			return null;
		}

		private bool PlayerIDExists(uint playerid)
		{
			if (!Players.TryGetValue(playerid, out AssociatedPlayer _))
			{
				return false;
			}
			return true;
		}

		private string? GetPlayerName(uint playerid)
		{
			if (!Players.TryGetValue(playerid, out AssociatedPlayer value))
			{
				return null;
			}
			return PlayerNameFilter.DoFilter(value.SlopPlayer.Name);
		}

		public AssociatedPlayer? GetAssociatedPlayer(Player reptilePlayer)
		{
			foreach (AssociatedPlayer value in Players.Values)
			{
				if ((Object)(object)value.ReptilePlayer == (Object)(object)reptilePlayer)
				{
					return value;
				}
			}
			return null;
		}

		private void MessageReceived(ClientboundMessage packet)
		{
			//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)
			//IL_0015: 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_0031: Expected I4, but got Unknown
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Invalid comparison between Unknown and I4
			//IL_029a: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)WorldHandler.instance == (Object)null)
			{
				return;
			}
			MessageOneofCase messageCase = packet.MessageCase;
			switch (messageCase - 2)
			{
			default:
			{
				if ((int)messageCase == 12 && Players.TryGetValue(packet.QuickChat.PlayerId, out AssociatedPlayer value6) && <config>P.General.ShowQuickChat.Value)
				{
					QuickChat quickChat = packet.QuickChat.QuickChat;
					QuickChatUtility.SpawnQuickChat(value6.ReptilePlayer, quickChat.Category, quickChat.Index);
				}
				break;
			}
			case 0:
			{
				foreach (Player player in packet.PlayersUpdate.Players)
				{
					if (Players.TryGetValue(player.Id, out AssociatedPlayer value4))
					{
						value4.UpdateIfDifferent(player);
					}
					else
					{
						Players.Add(player.Id, new AssociatedPlayer(this, <connectionManager>P, <config>P, <characterInfoManager>P, player));
					}
				}
				List<uint> list = ((IEnumerable<Player>)packet.PlayersUpdate.Players).Select((Player p) => p.Id).ToList();
				{
					foreach (uint item in Players.Keys.ToList())
					{
						if (!list.Contains(item) && Players.TryGetValue(item, out AssociatedPlayer value5))
						{
							value5.Dispose();
							Players.Remove(item);
						}
					}
					break;
				}
			}
			case 1:
			{
				foreach (PositionUpdate update in packet.PositionUpdate.Updates)
				{
					if (Players.TryGetValue(update.PlayerId, out AssociatedPlayer value3))
					{
						value3.QueuePositionUpdate(update);
					}
				}
				break;
			}
			case 3:
			{
				foreach (VisualUpdate update2 in packet.VisualUpdate.Updates)
				{
					if (Players.TryGetValue(update2.PlayerId, out AssociatedPlayer value2))
					{
						value2.HandleVisualUpdate(update2);
					}
				}
				break;
			}
			case 4:
			{
				foreach (AnimationUpdate update3 in packet.AnimationUpdate.Updates)
				{
					if (Players.TryGetValue(update3.PlayerId, out AssociatedPlayer value))
					{
						value.HandleAnimationUpdate(update3);
					}
				}
				break;
			}
			case 2:
				break;
			}
		}

		private void Disconnected()
		{
			CleanupPlayers();
		}

		private void StageInit()
		{
			CleanupPlayers();
		}

		private void CleanupPlayers()
		{
			foreach (AssociatedPlayer value in Players.Values)
			{
				value.Dispose();
			}
			Players.Clear();
		}
	}
	[BepInPlugin("SlopCrew.Plugin", "SlopCrew", "2.2.1")]
	[BepInProcess("Bomb Rush Cyberfunk.exe")]
	public class Plugin : BaseUnityPlugin
	{
		public static IHost Host;

		private void Awake()
		{
			//IL_0000: 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)
			HostBuilder val = new HostBuilder();
			val.ConfigureServices((Action<HostBuilderContext, IServiceCollection>)delegate(HostBuilderContext hostContext, IServiceCollection services)
			{
				IServiceCollection services2 = services;
				ServiceCollectionServiceExtensions.AddSingleton<ManualLogSource>(services2, ((BaseUnityPlugin)this).Logger);
				AddSingletonHostedService<ConnectionManager>();
				AddSingletonHostedService<LocalPlayerManager>();
				AddSingletonHostedService<PlayerManager>();
				AddSingletonHostedService<PatchManager>();
				AddSingletonHostedService<EncounterManager>();
				AddSingletonHostedService<ServerConfig>();
				AddSingletonHostedService<InterfaceUtility>();
				ServiceCollectionServiceExtensions.AddSingleton<Config>(services2, new Config(((BaseUnityPlugin)this).Config));
				ServiceCollectionServiceExtensions.AddSingleton<SlopCrewAPI>(services2);
				ServiceCollectionServiceExtensions.AddSingleton<InputBlocker>(services2);
				ServiceCollectionServiceExtensions.AddSingleton<CharacterInfoManager>(services2);
				void AddSingletonHostedService<T>() where T : class, IHostedService
				{
					ServiceCollectionServiceExtensions.AddSingleton<T>(services2);
					ServiceCollectionHostedServiceExtensions.AddHostedService<T>(services2, (Func<IServiceProvider, T>)((IServiceProvider p) => ServiceProviderServiceExtensions.GetRequiredService<T>(p)));
				}
			});
			Host = val.Build();
			APIManager.RegisterAPI((ISlopCrewAPI)(object)ServiceProviderServiceExtensions.GetRequiredService<SlopCrewAPI>(Host.Services));
			HostingAbstractionsHostExtensions.Start(Host);
		}

		private void OnDestroy()
		{
			Host.StopAsync(default(CancellationToken)).GetAwaiter().GetResult();
			((IDisposable)Host).Dispose();
		}
	}
	public class ServerConfig : IHostedService
	{
		public ClientboundHello? Hello;

		private ConnectionManager connectionManager;

		public ServerConfig(ConnectionManager connectionManager)
		{
			this.connectionManager = connectionManager;
		}

		public Task StartAsync(CancellationToken cancellationToken)
		{
			ConnectionManager obj = connectionManager;
			obj.MessageReceived = (Action<ClientboundMessage>)Delegate.Combine(obj.MessageReceived, new Action<ClientboundMessage>(MessageReceived));
			ConnectionManager obj2 = connectionManager;
			obj2.Disconnected = (Action)Delegate.Combine(obj2.Disconnected, new Action(Disconnected));
			return Task.CompletedTask;
		}

		public Task StopAsync(CancellationToken cancellationToken)
		{
			ConnectionManager obj = connectionManager;
			obj.MessageReceived = (Action<ClientboundMessage>)Delegate.Remove(obj.MessageReceived, new Action<ClientboundMessage>(MessageReceived));
			ConnectionManager obj2 = connectionManager;
			obj2.Disconnected = (Action)Delegate.Remove(obj2.Disconnected, new Action(Disconnected));
			return Task.CompletedTask;
		}

		private void Disconnected()
		{
			Hello = null;
		}

		private void MessageReceived(ClientboundMessage message)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Invalid comparison between Unknown and I4
			if ((int)message.MessageCase == 1)
			{
				Hello = message.Hello;
			}
		}
	}
	public class SlopCrewAPI : ISlopCrewAPI
	{
		internal Func<string>? OnGetLocalPlayerName;

		public string ServerAddress { get; internal set; } = string.Empty;


		public int PlayerCount { get; internal set; }

		public bool Connected { get; internal set; }

		public ulong Latency { get; internal set; }

		public int TickRate { get; internal set; }

		public int? StageOverride { get; set; }

		public string? PlayerName => OnGetLocalPlayerName?.Invoke();

		public ReadOnlyCollection<uint>? Players => this.OnGetPlayerList?.Invoke();

		public event Action<int>? OnPlayerCountChanged;

		public event Action? OnConnected;

		public event Action? OnDisconnected;

		internal event Func<uint, string?>? OnGetGameObjectPathForPlayerID;

		internal event Func<string, uint?>? OnGetPlayerIDForGameObjectPath;

		internal event Func<uint, bool>? OnPlayerIDExists;

		internal event Func<uint, string?>? OnGetPlayerName;

		internal event Func<ReadOnlyCollection<uint>>? OnGetPlayerList;

		internal event Action<string, byte[]>? OnCustomPacketSent;

		internal event Action<string, byte[]?>? OnCustomCharacterInfoSet;

		public event Action<uint, string, byte[]>? OnCustomPacketReceived;

		public event Action<uint, string, byte[]>? OnCustomCharacterInfoReceived;

		public event Action<ulong>? OnServerTickReceived;

		public string? GetGameObjectPathForPlayerID(uint playerId)
		{
			return this.OnGetGameObjectPathForPlayerID?.Invoke(playerId);
		}

		public uint? GetPlayerIDForGameObjectPath(string gameObjectPath)
		{
			return this.OnGetPlayerIDForGameObjectPath?.Invoke(gameObjectPath);
		}

		public bool? PlayerIDExists(uint playerId)
		{
			return this.OnPlayerIDExists?.Invoke(playerId);
		}

		public string? GetPlayerName(uint playerId)
		{
			return this.OnGetPlayerName?.Invoke(playerId);
		}

		public void SendCustomPacket(string id, byte[] data)
		{
			this.OnCustomPacketSent?.Invoke(id, data);
		}

		public void SetCustomCharacterInfo(string id, byte[]? data)
		{
			this.OnCustomCharacterInfoSet?.Invoke(id, data);
		}

		internal void ChangeConnected(bool value)
		{
			if (Connected != value)
			{
				Connected = value;
				if (value)
				{
					this.OnConnected?.Invoke();
				}
				else
				{
					this.OnDisconnected?.Invoke();
				}
			}
		}

		internal void ChangeLatency(ulong latency)
		{
			Latency = latency;
		}

		internal void ChangeTickRate(int tickRate)
		{
			TickRate = tickRate;
		}

		internal void ChangePlayerCount(int count)
		{
			PlayerCount = count;
			this.OnPlayerCountChanged?.Invoke(count);
		}

		internal void DispatchCustomPacket(uint player, string id, byte[] data)
		{
			this.OnCustomPacketReceived?.Invoke(player, id, data);
		}

		internal void DispatchServerTick(ulong tick)
		{
			this.OnServerTickReceived?.Invoke(tick);
		}
	}
	public static class UnityExtensions
	{
		public static Vector3 UnityToSystem(this Vector3 vec)
		{
			//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_000c: Unknown result type (might be due to invalid IL or missing references)
			return new Vector3(vec.x, vec.y, vec.z);
		}

		public static Quaternion UnityToSystem(this Quaternion quat)
		{
			//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_000c: 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 new Quaternion(quat.x, quat.y, quat.z, quat.w);
		}

		public static Vector3 UnityToNetwork(this Vector3 vec)
		{
			//IL_0000: 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_0006: 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)
			//IL_001d: 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
			return new Vector3
			{
				X = vec.x,
				Y = vec.y,
				Z = vec.z
			};
		}

		public static Quaternion UnityToNetwork(this Quaternion quat)
		{
			//IL_0000: 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_0006: 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)
			//IL_001d: 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_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			return new Quaternion
			{
				X = quat.x,
				Y = quat.y,
				Z = quat.z,
				W = quat.w
			};
		}

		public static Vector3 SystemToUnity(this Vector3 vec)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			return new Vector3(vec.X, vec.Y, vec.Z);
		}

		public static Quaternion SystemToUnity(this Quaternion quat)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			return new Quaternion(quat.X, quat.Y, quat.Z, quat.W);
		}

		public static Vector3 SystemToNetwork(this Vector3 vec)
		{
			//IL_0000: 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_0011: 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_002a: Expected O, but got Unknown
			return new Vector3
			{
				X = vec.X,
				Y = vec.Y,
				Z = vec.Z
			};
		}

		public static Quaternion SystemToNetwork(this Quaternion quat)
		{
			//IL_0000: 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_0011: 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_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			return new Quaternion
			{
				X = quat.X,
				Y = quat.Y,
				Z = quat.Z,
				W = quat.W
			};
		}

		public static Vector3 NetworkToUnity(this Vector3 vec)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			return new Vector3(vec.X, vec.Y, vec.Z);
		}

		public static Quaternion NetworkToUnity(this Quaternion quat)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			return new Quaternion(quat.X, quat.Y, quat.Z, quat.W);
		}

		public static Vector3 NetworkToSystem(this Vector3 vec)
		{
			return new Vector3(vec.X, vec.Y, vec.Z);
		}

		public static Quaternion NetworkToSystem(this Quaternion quat)
		{
			return new Quaternion(quat.X, quat.Y, quat.Z, quat.W);
		}

		public static string GetPath(this GameObject gameObject)
		{
			string text = "/" + ((Object)gameObject).name;
			while ((Object)(object)gameObject.transform.parent != (Object)null)
			{
				gameObject = ((Component)gameObject.transform.parent).gameObject;
				text = "/" + ((Object)gameObject).name + text;
			}
			return text;
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "SlopCrew.Plugin";

		public const string PLUGIN_NAME = "SlopCrew";

		public const string PLUGIN_VERSION = "2.2.1";
	}
}
namespace SlopCrew.Plugin.UI
{
	public class InterfaceUtility : IHostedService
	{
		[CompilerGenerated]
		private Config <config>P;

		public static readonly Color NamePlateOutlineColor = new Color(0.1f, 0.1f, 0.1f, 1f);

		public TMP_FontAsset? NameplateFont { get; private set; }

		public TMP_FontAsset? QuickChatFont { get; private set; }

		public Material? NameplateFontMaterial { get; private set; }

		public TMP_SpriteAsset? EmojiAsset { get; private set; }

		public InterfaceUtility(Config config)
		{
			<config>P = config;
			base..ctor();
		}

		public void LoadAssets()
		{
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Expected O, but got Unknown
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0233: Unknown result type (might be due to invalid IL or missing references)
			//IL_0238: Unknown result type (might be due to invalid IL or missing references)
			//IL_0240: Unknown result type (might be due to invalid IL or missing references)
			//IL_025e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0266: Unknown result type (might be due to invalid IL or missing references)
			//IL_026e: Unknown result type (might be due to invalid IL or missing references)
			//IL_026f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0271: Unknown result type (might be due to invalid IL or missing references)
			//IL_0276: Unknown result type (might be due to invalid IL or missing references)
			//IL_0281: Unknown result type (might be due to invalid IL or missing references)
			//IL_028c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0295: Unknown result type (might be due to invalid IL or missing references)
			//IL_029e: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ab: Expected O, but got Unknown
			//IL_02f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0305: Expected O, but got Unknown
			//IL_0321: Unknown result type (might be due to invalid IL or missing references)
			//IL_0326: Unknown result type (might be due to invalid IL or missing references)
			//IL_0330: Expected O, but got Unknown
			Assets assets = Core.Instance.Assets;
			assets.LoadAssetBundleByName("in_game_assets");
			GameplayUI componentInChildren = assets.LoadAssetFromBundle<GameObject>("in_game_assets", "gameplayui").GetComponentInChildren<GameplayUI>(true);
			QuickChatFont = ((TMP_Text)componentInChildren.scoreTrickLabel).font;
			NameplateFont = ((TMP_Text)componentInChildren.trickNameLabel).font;
			NameplateFontMaterial = ((TMP_Text)componentInChildren.trickNameLabel).fontMaterial;
			if (<config>P.General.OutlineNameplates.Value)
			{
				NameplateFontMaterial.EnableKeyword(ShaderUtilities.Keyword_Outline);
				NameplateFontMaterial.SetColor(ShaderUtilities.ID_OutlineColor, NamePlateOutlineColor);
				NameplateFontMaterial.SetFloat(ShaderUtilities.ID_OutlineWidth, 0.1f);
				NameplateFontMaterial.EnableKeyword(ShaderUtilities.Keyword_Underlay);
				NameplateFontMaterial.SetColor(ShaderUtilities.ID_UnderlayColor, NamePlateOutlineColor);
				NameplateFontMaterial.SetFloat(ShaderUtilities.ID_UnderlayDilate, 0.1f);
				NameplateFontMaterial.SetFloat(ShaderUtilities.ID_UnderlayOffsetX, 0.2f);
				NameplateFontMaterial.SetFloat(ShaderUtilities.ID_UnderlayOffsetY, -0.2f);
				NameplateFontMaterial.SetFloat(ShaderUtilities.ID_UnderlaySoftness, 0f);
			}
			EmojiAsset = ScriptableObject.CreateInstance<TMP_SpriteAsset>();
			Texture2D val = TextureLoader.LoadResourceAsTexture("SlopCrew.Plugin.res.emojis.png", 2112, 2112, generateMipMaps: true, (TextureWrapMode)0);
			Material val2 = new Material(Shader.Find("TextMeshPro/Sprite"));
			val2.mainTexture = (Texture)(object)val;
			((TMP_Asset)EmojiAsset).material = val2;
			EmojiAsset.spriteSheet = (Texture)(object)val;
			EmojiAsset.spriteInfoList = new List<TMP_Sprite>();
			EmojiAsset.m_Version = "1.1.0";
			Rect val3 = default(Rect);
			Vector2 val4 = default(Vector2);
			GlyphMetrics val5 = default(GlyphMetrics);
			GlyphRect val6 = default(GlyphRect);
			for (int i = 0; i < 4; i++)
			{
				for (int j = 0; j < 4; j++)
				{
					((Rect)(ref val3))..ctor(1f / 66f + (float)j * (8f / 33f), 1f / 66f + (float)i * (8f / 33f), 8f / 33f, 8f / 33f);
					((Vector2)(ref val4))..ctor(0f, 0f);
					Sprite sprite = Sprite.Create(val, val3, val4);
					int num = i * 4 + j;
					int num2 = 128512 + num;
					int num3 = j * 512 + 32;
					int num4 = 2112 - i * 512 - 512 - 32;
					TMP_Sprite item = new TMP_Sprite
					{
						id = num,
						name = $"{j}_{i}",
						unicode = num2,
						sprite = sprite,
						pivot = val4,
						width = 512f,
						height = 512f,
						x = num3,
						y = num4,
						scale = 1.5f
					};
					EmojiAsset.spriteInfoList.Add(item);
					((GlyphMetrics)(ref val5))..ctor(512f, 512f, 0f, 448f, 512f);
					((GlyphRect)(ref val6))..ctor(num3, num4, 512, 512);
					TMP_SpriteGlyph val7 = new TMP_SpriteGlyph((uint)num, val5, val6, 1.5f, 0);
					EmojiAsset.spriteGlyphTable.Add(val7);
					TMP_SpriteCharacter item2 = new TMP_SpriteCharacter((uint)num2, EmojiAsset, val7)
					{
						glyphIndex = (uint)num
					};
					EmojiAsset.spriteCharacterTable.Add(item2);
				}
			}
			EmojiAsset.UpdateLookupTables();
			assets.UnloadAssetBundleByName("in_game_assets");
		}

		public Task StartAsync(CancellationToken cancellationToken)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			Core.OnCoreInitialized += new OnCoreInitializedHandler(LoadAssets);
			return Task.CompletedTask;
		}

		public Task StopAsync(CancellationToken cancellationToken)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			Core.OnCoreInitialized -= new OnCoreInitializedHandler(LoadAssets);
			return Task.CompletedTask;
		}
	}
	public static class QuickChatUtility
	{
		private const float QuickChatStartHeightFactor = 1f;

		private const float QuickChatRestHeightFactor = 1.5f;

		private const float QuickChatEndHeightFactor = 2f;

		private const float QuickChatIntroDuration = 0.5f;

		private const float QuickChatRestDuration = 3f;

		private const float QuickChatOutroDuration = 0.25f;

		public static void SpawnQuickChat(Player player, QuickChatCategory category, int index)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Expected O, but got Unknown
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: 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_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: 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_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0200: Unknown result type (might be due to invalid IL or missing references)
			//IL_020a: Expected O, but got Unknown
			if (!Constants.QuickChatMessages.TryGetValue(category, out var value) || index >= value.Count)
			{
				return;
			}
			string text = value[index];
			InterfaceUtility requiredService = ServiceProviderServiceExtensions.GetRequiredService<InterfaceUtility>(Plugin.Host.Services);
			GameObject quickChat = new GameObject("SlopCrewQuickChat");
			quickChat.AddComponent<UIBillboard>();
			TextMeshPro val = quickChat.AddComponent<TextMeshPro>();
			((TMP_Text)val).font = requiredService.QuickChatFont;
			((TMP_Text)val).alignment = (TextAlignmentOptions)4098;
			((TMP_Text)val).fontSize = 2.5f;
			((Graphic)val).color = new Color(1f, 1f, 1f, 0f);
			((TMP_Text)val).spriteAsset = requiredService.EmojiAsset;
			val.sortingOrder = 1;
			((TMP_Text)val).SetText(text, true);
			if ((Object)(object)player == (Object)null)
			{
				return;
			}
			Collider interactionCollider = player.interactionCollider;
			CapsuleCollider val2 = (CapsuleCollider)(object)((interactionCollider is CapsuleCollider) ? interactionCollider : null);
			if (!((Object)(object)val2 == (Object)null))
			{
				float height = val2.height;
				Vector3 localPosition = Vector3.up * (height * 1f);
				Vector3 val3 = Vector3.up * (height * 1.5f);
				Vector3 val4 = Vector3.up * (height * 2f);
				quickChat.transform.SetParent(((Component)val2).transform, false);
				quickChat.transform.localPosition = localPosition;
				Sequence obj = DOTween.Sequence();
				TweenSettingsExtensions.Append(obj, (Tween)(object)ShortcutExtensionsTMPText.DOFade((TMP_Text)(object)val, 1f, 0.5f));
				TweenerCore<Vector3, Vector3, VectorOptions> val5 = ShortcutExtensions.DOLocalMoveY(quickChat.transform, val3.y, 0.5f, false);
				TweenSettingsExtensions.SetEase<TweenerCore<Vector3, Vector3, VectorOptions>>(val5, (Ease)9);
				TweenSettingsExtensions.Join(obj, (Tween)(object)val5);
				TweenSettingsExtensions.AppendInterval(obj, 3f);
				TweenSettingsExtensions.Append(obj, (Tween)(object)ShortcutExtensionsTMPText.DOFade((TMP_Text)(object)val, 0f, 0.25f));
				TweenerCore<Vector3, Vector3, VectorOptions> val6 = ShortcutExtensions.DOLocalMoveY(quickChat.transform, val4.y, 0.25f, false);
				TweenSettingsExtensions.SetEase<TweenerCore<Vector3, Vector3, VectorOptions>>(val6, (Ease)8);
				TweenSettingsExtensions.Join(obj, (Tween)(object)val6);
				TweenSettingsExtensions.OnComplete<Sequence>(obj, (TweenCallback)delegate
				{
					Object.Destroy((Object)(object)quickChat);
				});
			}
		}
	}
	public static class RectTransformExtensions
	{
		public static void SetBounds(this RectTransform rect, float left, float top, float right, float bottom)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			rect.offsetMin = new Vector2(0f - left, 0f - top);
			rect.offsetMax = new Vector2(right, bottom);
		}

		public static void SetAnchor(this RectTransform rect, float x, float y)
		{
			//IL_000a: 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)
			Vector2 val = default(Vector2);
			((Vector2)(ref val))..ctor(x, y);
			rect.anchorMin = val;
			rect.anchorMax = val;
		}

		public static void SetPivot(this RectTransform rect, float x, float y)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			rect.pivot = new Vector2(x, y);
		}

		public static void SetAnchorAndPivot(this RectTransform rect, float x, float y)
		{
			//IL_000a: 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_0018: Unknown result type (might be due to invalid IL or missing references)
			Vector2 val = default(Vector2);
			((Vector2)(ref val))..ctor(x, y);
			rect.anchorMin = val;
			rect.anchorMax = val;
			rect.pivot = val;
		}

		public static void StretchToFillParent(this RectTransform rect)
		{
			//IL_0001: 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)
			rect.anchorMin = Vector2.zero;
			rect.anchorMax = Vector2.one;
			rect.SetBounds(0f, 0f, 0f, 0f);
		}
	}
	public class TextMeshProFilter : MonoBehaviour
	{
		private TMP_Text tmp;

		private bool checkedFilter;

		private void Awake()
		{
			tmp = ((Component)this).gameObject.GetComponent<TMP_Text>();
		}

		private void Update()
		{
			if (checkedFilter)
			{
				return;
			}
			string parsedText = tmp.GetParsedText();
			if (parsedText != null && parsedText != string.Empty)
			{
				if (PlayerNameFilter.HitsFilter(parsedText))
				{
					tmp.SetText("Punished Slopper", true);
				}
				checkedFilter = true;
			}
		}
	}
	public class TextureLoader
	{
		public static Texture2D LoadResourceAsTexture(string path, int width, int height, bool generateMipMaps = true, TextureWrapMode wrapMode = 0)
		{
			//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_0052: 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)
			//IL_0060: Expected O, but got Unknown
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Expected O, but got Unknown
			Stream manifestResourceStream = Assembly.GetExecutingAssembly().GetManifestResourceStream(path);
			if (manifestResourceStream == null)
			{
				throw new Exception("Could not load texture at path: " + path);
			}
			byte[] array = new byte[manifestResourceStream.Length];
			for (int i = 0; i < array.Length; i += manifestResourceStream.Read(array, i, array.Length - i))
			{
			}
			Texture2D val = new Texture2D(width, height, (TextureFormat)4, generateMipMaps, false)
			{
				wrapMode = wrapMode
			};
			ImageConversion.LoadImage(val, array);
			val.Apply();
			return val;
		}

		public static Sprite LoadResourceAsSprite(string path, int width, int height, float pivotX = 0.5f, float pivotY = 0.5f)
		{
			//IL_0024: 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)
			Texture2D val = LoadResourceAsTexture(path, width, height, generateMipMaps: false, (TextureWrapMode)1);
			return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(pivotX, pivotY), 100f);
		}
	}
	public class UIBillboard : MonoBehaviour
	{
		private void Update()
		{
			//IL_0015: 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_001f: 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_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: 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)
			Camera currentCamera = WorldHandler.instance.CurrentCamera;
			if (currentCamera != null)
			{
				Quaternion rotation = Quaternion.LookRotation(((Component)currentCamera).transform.forward, Vector3.up);
				rotation = Quaternion.Euler(0f, ((Quaternion)(ref rotation)).eulerAngles.y, 0f);
				((Component)this).gameObject.transform.rotation = rotation;
			}
		}
	}
	public class UIConnectionStatus : MonoBehaviour
	{
		private Image icon;

		private readonly Vector2 iconPos = new Vector2(0.875f, 0.335f);

		private TextMeshProUGUI tmp;

		private RectTransform tmpRectTransform;

		private readonly Vector2 counterPosMin = new Vector2(0.75f, 0.425f);

		private readonly Vector2 counterPosMax = new Vector2(1f, 0.425f);

		private readonly Vector2 warnPosMin = new Vector2(0f, 0.335f);

		private readonly Vector2 warnPosMax = new Vector2(1f, 0.335f);

		private bool showInfo = true;

		private void Awake()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Expected O, but got Unknown
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Expected O, but got Unknown
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			Sprite sprite = TextureLoader.LoadResourceAsSprite("SlopCrew.Plugin.res.player_icon.png", 128, 128);
			GameObject val = new GameObject("SlopCrew_UIConnectionStatus_Icon");
			icon = val.AddComponent<Image>();
			icon.sprite = sprite;
			GameObject val2 = new GameObject("SlopCrew_UIConnectionStatus_Counter");
			tmp = val2.AddComponent<TextMeshProUGUI>();
			TextMeshProUGUI repLabel = Core.Instance.UIManager.gameplay.repLabel;
			((Graphic)tmp).color = Color.white;
			((TMP_Text)tmp).font = ((TMP_Text)repLabel).font;
			((TMP_Text)tmp).fontSize = ((TMP_Text)repLabel).fontSize * 0.7f;
			((TMP_Text)tmp).fontMaterial = ((TMP_Text)repLabel).fontMaterial;
			((TMP_Text)tmp).alignment = (TextAlignmentOptions)1026;
			RectTransform obj = ComponentExtensions.RectTransform((Component)(object)icon);
			obj.anchorMin = iconPos;
			obj.anchorMax = iconPos;
			tmpRectTransform = ((TMP_Text)tmp).rectTransform;
			tmpRectTransform.anchorMin = counterPosMin;
			tmpRectTransform.anchorMax = counterPosMax;
			RectTransform value = Traverse.Create((object)Traverse.Create((object)WorldHandler.instance.GetCurrentPlayer()).Field<Phone>("phone").Value.AppInstances["AppHomeScreen"]).Field<RectTransform>("m_TopView").Value;
			((Transform)((TMP_Text)tmp).rectTransform).SetParent((Transform)(object)value, false);
			((Transform)((Graphic)icon).rectTransform).SetParent((Transform)(object)value, false);
		}

		private void Update()
		{
			//IL_0030: 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_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: 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)
			ISlopCrewAPI aPI = APIManager.API;
			if (!aPI.Connected && showInfo)
			{
				showInfo = false;
				((Behaviour)icon).enabled = false;
				tmpRectTransform.anchorMin = warnPosMin;
				tmpRectTransform.anchorMax = warnPosMax;
				((Graphic)tmp).color = Color.red;
				((TMP_Text)tmp).text = "Connection lost...";
				return;
			}
			if (aPI.Connected && !showInfo)
			{
				showInfo = true;
				((Behaviour)icon).enabled = true;
				tmpRectTransform.anchorMin = counterPosMin;
				tmpRectTransform.anchorMax = counterPosMax;
				((Graphic)tmp).color = Color.white;
			}
			if (showInfo)
			{
				((TMP_Text)tmp).text = $"{aPI.PlayerCount}";
			}
		}
	}
	public class UISpinny : MonoBehaviour
	{
		private void Update()
		{
			//IL_000f: 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)
			float deltaTime = Time.deltaTime;
			Transform transform = ((Component)this).transform;
			transform.RotateAround(transform.position, transform.forward, deltaTime * 360f * 0.25f);
		}
	}
}
namespace SlopCrew.Plugin.UI.Phone
{
	public class AppSlopCrew : App
	{
		public enum Category
		{
			Chat,
			Encounters
		}

		public static readonly int EncounterCount = Enum.GetValues(typeof(EncounterType)).Length;

		public static readonly int CategoryCount = Enum.GetValues(typeof(Category)).Length;

		public static readonly AppSpriteSheet SpriteSheet = new AppSpriteSheet(EncounterCount, CategoryCount);

		private SlopCrewScrollView? scrollView;

		public override void OnAppInit()
		{
			base.m_Unlockables = Array.Empty<AUnlockable>();
			scrollView = ExtendedPhoneScroll.Create<SlopCrewScrollView>("Categories", (App)(object)this, ((App)this).Content);
			AppUtility.CreateAppOverlay(((App)this).MyPhone.GetAppInstance<AppMusicPlayer>(), useFooter: false, ((App)this).Content, "Slop Crew", SpriteSheet.MainIcon, out RectTransform _, out RectTransform _, ComponentExtensions.RectTransform((Component)(object)scrollView));
		}

		public override void OnAppEnable()
		{
			PlayEnableAnimation();
		}

		private void PlayEnableAnimation()
		{
			//IL_002e: 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_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: 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)
			Sequence val = DOTween.Sequence();
			for (int i = 0; i < ((PhoneScroll)scrollView).GetScrollRange(); i++)
			{
				SlopCrewButton obj = (SlopCrewButton)(object)((PhoneScroll)scrollView).GetButtonByRelativeIndex(i);
				RectTransform val2 = ComponentExtensions.RectTransform((Component)(object)obj);
				Vector2 buttonPosition = scrollView.GetButtonPosition(i, val2);
				if (i != ((PhoneScroll)scrollView).GetSelectorPos())
				{
					buttonPosition.x = 70f;
				}
				obj.ToggleBackground(visible: true);
				val2.anchoredPosition = new Vector2(((App)this).MyPhone.ScreenSize.x, val2.anchoredPosition.y);
				TweenSettingsExtensions.Append(val, (Tween)(object)DOTweenModuleUI.DOAnchorPos(val2, buttonPosition, 0.08f, false));
			}
		}

		public override void OnPressUp()
		{
			((PhoneScroll)scrollView).Move((ScrollDirection)(-1), base.m_AudioManager);
		}

		public override void OnPressDown()
		{
			((PhoneScroll)scrollView).Move((ScrollDirection)1, base.m_AudioManager);
		}

		public override void OnPressRight()
		{
			if (!((Object)(object)((PhoneScroll)scrollView).SelectedButtton == (Object)null))
			{
				((PhoneScroll)scrollView).HoldAnimationSelectedButton();
			}
		}

		public override void OnReleaseRight()
		{
			Category contentIndex = (Category)((PhoneScroll)scrollView).GetContentIndex();
			PlayAppSelectedAnimation(contentIndex);
			((PhoneScroll)scrollView).ActivateAnimationSelectedButton();
			base.m_AudioManager.PlaySfxUI((SfxCollectionID)14, (AudioClipID)306, 0f);
		}

		private void PlayAppSelectedAnimation(Category selectedCategory)
		{
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Expected O, but got Unknown
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			Sequence val = DOTween.Sequence();
			for (int i = 0; i < ((PhoneScroll)scrollView).GetScrollRange(); i++)
			{
				SlopCrewButton slopCrewButton = (SlopCrewButton)(object)((PhoneScroll)scrollView).GetButtonByRelativeIndex(i);
				RectTransform val2 = ComponentExtensions.RectTransform((Component)(object)slopCrewButton);
				if (i != ((PhoneScroll)scrollView).GetSelectorPos())
				{
					slopCrewButton.ToggleBackground(visible: false);
					TweenSettingsExtensions.Append(val, (Tween)(object)DOTweenModuleUI.DOAnchorPosX(val2, 0f - ((App)this).MyPhone.ScreenSize.x, 0.1f, false));
				}
			}
			TweenSettingsExtensions.AppendCallback(val, (TweenCallback)delegate
			{
				OpenApp(selectedCategory);
			});
		}

		private void OpenApp(Category app)
		{
			switch (app)
			{
			case Category.Chat:
				((App)this).MyPhone.OpenApp(typeof(AppQuickChat));
				break;
			case Category.Encounters:
				((App)this).MyPhone.OpenApp(typeof(AppEncounters));
				break;
			}
		}
	}
	public class AppSpriteSheet
	{
		public static readonly Vector2Int SpriteSheetSize = new Vector2Int(1024, 1024);

		private const float SpriteSheetPadding = 16f;

		public static readonly Vector2 CategoryButtonSize = new Vector2(412f, 64f);

		public static readonly Vector2 CategoryIconSize = new Vector2(76f, 64f);

		public static readonly Vector2 EncounterButtonSize = new Vector2(512f, 167f);

		public static readonly Vector2 EncounterIconSize = new Vector2(116f, 101f);

		public static readonly Vector2 ChatButtonSize = new Vector2(427f, 62f);

		private static readonly float CategorySpriteHeight = (float)((Vector2Int)(ref SpriteSheetSize)).y - (ChatButtonSize.y + 16f) * 2f - CategoryButtonSize.y;

		private static readonly Vector2 CategoryIconGridStart = new Vector2(612f, (float)((Vector2Int)(ref SpriteSheetSize)).y - 316f - CategoryButtonSize.y);

		private static readonly float EncounterIconGridHeight = (float)((Vector2Int)(ref SpriteSheetSize)).y - (EncounterButtonSize.y + 16f) * 2f - EncounterIconSize.y;

		private const int EncounterIconColumnCount = 4;

		private const int CategoryIconColumnCount = 4;

		public readonly Sprite MainIcon = TextureLoader.LoadResourceAsSprite("SlopCrew.Plugin.res.phone_icon.png", 128, 128);

		private Sprite?[] encounterIcons;

		private Sprite?[] categoryIcons;

		public Sprite EncounterButtonSpriteNormal { get; private set; }

		public Sprite EncounterButtonSpriteSelected { get; private set; }

		public Sprite ChatSpriteNormal { get; private set; }

		public Sprite ChatSpriteSelected { get; private set; }

		public Sprite CategoryButtonNormal { get; private set; }

		public Sprite CategoryButtonSelected { get; private set; }

		public AppSpriteSheet(int encounterCount, int categoryCount)
		{
			//IL_002f: 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_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: 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_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)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: 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_01e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0233: Unknown result type (might be due to invalid IL or missing references)
			//IL_0238: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0191: Unknown result type (might be due to invalid IL or missing references)
			//IL_02dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fc: Unknown result type (might

BepInEx/plugins/SlopCrew.Plugin/System.Buffers.dll

Decompiled 8 months ago
using System;
using System.Diagnostics;
using System.Diagnostics.Tracing;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using System.Threading;
using FxResources.System.Buffers;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: AssemblyTitle("System.Buffers")]
[assembly: AssemblyDescription("System.Buffers")]
[assembly: AssemblyDefaultAlias("System.Buffers")]
[assembly: AssemblyCompany("Microsoft Corporation")]
[assembly: AssemblyProduct("Microsoft® .NET Framework")]
[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")]
[assembly: AssemblyFileVersion("4.6.28619.01")]
[assembly: AssemblyInformationalVersion("4.6.28619.01 @BuiltBy: dlab14-DDVSOWINAGE069 @Branch: release/2.1 @SrcCode: https://github.com/dotnet/corefx/tree/7601f4f6225089ffb291dc7d58293c7bbf5c5d4f")]
[assembly: CLSCompliant(true)]
[assembly: AssemblyMetadata(".NETFrameworkAssembly", "")]
[assembly: AssemblyMetadata("Serviceable", "True")]
[assembly: AssemblyMetadata("PreferInbox", "True")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("4.0.3.0")]
[module: UnverifiableCode]
namespace FxResources.System.Buffers
{
	internal static class SR
	{
	}
}
namespace System
{
	internal static class SR
	{
		private static ResourceManager s_resourceManager;

		private static ResourceManager ResourceManager => s_resourceManager ?? (s_resourceManager = new ResourceManager(ResourceType));

		internal static Type ResourceType { get; } = typeof(SR);


		internal static string ArgumentException_BufferNotFromPool => GetResourceString("ArgumentException_BufferNotFromPool", null);

		[MethodImpl(MethodImplOptions.NoInlining)]
		private static bool UsingResourceKeys()
		{
			return false;
		}

		internal static string GetResourceString(string resourceKey, string defaultString)
		{
			string text = null;
			try
			{
				text = ResourceManager.GetString(resourceKey);
			}
			catch (MissingManifestResourceException)
			{
			}
			if (defaultString != null && resourceKey.Equals(text, StringComparison.Ordinal))
			{
				return defaultString;
			}
			return text;
		}

		internal static string Format(string resourceFormat, params object[] args)
		{
			if (args != null)
			{
				if (UsingResourceKeys())
				{
					return resourceFormat + string.Join(", ", args);
				}
				return string.Format(resourceFormat, args);
			}
			return resourceFormat;
		}

		internal static string Format(string resourceFormat, object p1)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1);
			}
			return string.Format(resourceFormat, p1);
		}

		internal static string Format(string resourceFormat, object p1, object p2)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2);
			}
			return string.Format(resourceFormat, p1, p2);
		}

		internal static string Format(string resourceFormat, object p1, object p2, object p3)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2, p3);
			}
			return string.Format(resourceFormat, p1, p2, p3);
		}
	}
}
namespace System.Buffers
{
	public abstract class ArrayPool<T>
	{
		private static ArrayPool<T> s_sharedInstance;

		public static ArrayPool<T> Shared
		{
			[MethodImpl(MethodImplOptions.AggressiveInlining)]
			get
			{
				return Volatile.Read(ref s_sharedInstance) ?? EnsureSharedCreated();
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		private static ArrayPool<T> EnsureSharedCreated()
		{
			Interlocked.CompareExchange(ref s_sharedInstance, Create(), null);
			return s_sharedInstance;
		}

		public static ArrayPool<T> Create()
		{
			return new DefaultArrayPool<T>();
		}

		public static ArrayPool<T> Create(int maxArrayLength, int maxArraysPerBucket)
		{
			return new DefaultArrayPool<T>(maxArrayLength, maxArraysPerBucket);
		}

		public abstract T[] Rent(int minimumLength);

		public abstract void Return(T[] array, bool clearArray = false);
	}
	[EventSource(Name = "System.Buffers.ArrayPoolEventSource")]
	internal sealed class ArrayPoolEventSource : EventSource
	{
		internal enum BufferAllocatedReason
		{
			Pooled,
			OverMaximumSize,
			PoolExhausted
		}

		internal static readonly System.Buffers.ArrayPoolEventSource Log = new System.Buffers.ArrayPoolEventSource();

		[Event(1, Level = EventLevel.Verbose)]
		internal unsafe void BufferRented(int bufferId, int bufferSize, int poolId, int bucketId)
		{
			EventData* ptr = stackalloc EventData[4];
			*ptr = new EventData
			{
				Size = 4,
				DataPointer = (IntPtr)(&bufferId)
			};
			ptr[1] = new EventData
			{
				Size = 4,
				DataPointer = (IntPtr)(&bufferSize)
			};
			ptr[2] = new EventData
			{
				Size = 4,
				DataPointer = (IntPtr)(&poolId)
			};
			ptr[3] = new EventData
			{
				Size = 4,
				DataPointer = (IntPtr)(&bucketId)
			};
			WriteEventCore(1, 4, ptr);
		}

		[Event(2, Level = EventLevel.Informational)]
		internal unsafe void BufferAllocated(int bufferId, int bufferSize, int poolId, int bucketId, BufferAllocatedReason reason)
		{
			EventData* ptr = stackalloc EventData[5];
			*ptr = new EventData
			{
				Size = 4,
				DataPointer = (IntPtr)(&bufferId)
			};
			ptr[1] = new EventData
			{
				Size = 4,
				DataPointer = (IntPtr)(&bufferSize)
			};
			ptr[2] = new EventData
			{
				Size = 4,
				DataPointer = (IntPtr)(&poolId)
			};
			ptr[3] = new EventData
			{
				Size = 4,
				DataPointer = (IntPtr)(&bucketId)
			};
			ptr[4] = new EventData
			{
				Size = 4,
				DataPointer = (IntPtr)(&reason)
			};
			WriteEventCore(2, 5, ptr);
		}

		[Event(3, Level = EventLevel.Verbose)]
		internal void BufferReturned(int bufferId, int bufferSize, int poolId)
		{
			WriteEvent(3, bufferId, bufferSize, poolId);
		}
	}
	internal sealed class DefaultArrayPool<T> : ArrayPool<T>
	{
		private sealed class Bucket
		{
			internal readonly int _bufferLength;

			private readonly T[][] _buffers;

			private readonly int _poolId;

			private SpinLock _lock;

			private int _index;

			internal int Id => GetHashCode();

			internal Bucket(int bufferLength, int numberOfBuffers, int poolId)
			{
				_lock = new SpinLock(Debugger.IsAttached);
				_buffers = new T[numberOfBuffers][];
				_bufferLength = bufferLength;
				_poolId = poolId;
			}

			internal T[] Rent()
			{
				T[][] buffers = _buffers;
				T[] array = null;
				bool lockTaken = false;
				bool flag = false;
				try
				{
					_lock.Enter(ref lockTaken);
					if (_index < buffers.Length)
					{
						array = buffers[_index];
						buffers[_index++] = null;
						flag = array == null;
					}
				}
				finally
				{
					if (lockTaken)
					{
						_lock.Exit(useMemoryBarrier: false);
					}
				}
				if (flag)
				{
					array = new T[_bufferLength];
					System.Buffers.ArrayPoolEventSource log = System.Buffers.ArrayPoolEventSource.Log;
					if (log.IsEnabled())
					{
						log.BufferAllocated(array.GetHashCode(), _bufferLength, _poolId, Id, System.Buffers.ArrayPoolEventSource.BufferAllocatedReason.Pooled);
					}
				}
				return array;
			}

			internal void Return(T[] array)
			{
				if (array.Length != _bufferLength)
				{
					throw new ArgumentException(System.SR.ArgumentException_BufferNotFromPool, "array");
				}
				bool lockTaken = false;
				try
				{
					_lock.Enter(ref lockTaken);
					if (_index != 0)
					{
						_buffers[--_index] = array;
					}
				}
				finally
				{
					if (lockTaken)
					{
						_lock.Exit(useMemoryBarrier: false);
					}
				}
			}
		}

		private const int DefaultMaxArrayLength = 1048576;

		private const int DefaultMaxNumberOfArraysPerBucket = 50;

		private static T[] s_emptyArray;

		private readonly Bucket[] _buckets;

		private int Id => GetHashCode();

		internal DefaultArrayPool()
			: this(1048576, 50)
		{
		}

		internal DefaultArrayPool(int maxArrayLength, int maxArraysPerBucket)
		{
			if (maxArrayLength <= 0)
			{
				throw new ArgumentOutOfRangeException("maxArrayLength");
			}
			if (maxArraysPerBucket <= 0)
			{
				throw new ArgumentOutOfRangeException("maxArraysPerBucket");
			}
			if (maxArrayLength > 1073741824)
			{
				maxArrayLength = 1073741824;
			}
			else if (maxArrayLength < 16)
			{
				maxArrayLength = 16;
			}
			int id = Id;
			int num = System.Buffers.Utilities.SelectBucketIndex(maxArrayLength);
			Bucket[] array = new Bucket[num + 1];
			for (int i = 0; i < array.Length; i++)
			{
				array[i] = new Bucket(System.Buffers.Utilities.GetMaxSizeForBucket(i), maxArraysPerBucket, id);
			}
			_buckets = array;
		}

		public override T[] Rent(int minimumLength)
		{
			if (minimumLength < 0)
			{
				throw new ArgumentOutOfRangeException("minimumLength");
			}
			if (minimumLength == 0)
			{
				return s_emptyArray ?? (s_emptyArray = new T[0]);
			}
			System.Buffers.ArrayPoolEventSource log = System.Buffers.ArrayPoolEventSource.Log;
			T[] array = null;
			int num = System.Buffers.Utilities.SelectBucketIndex(minimumLength);
			if (num < _buckets.Length)
			{
				int num2 = num;
				do
				{
					array = _buckets[num2].Rent();
					if (array != null)
					{
						if (log.IsEnabled())
						{
							log.BufferRented(array.GetHashCode(), array.Length, Id, _buckets[num2].Id);
						}
						return array;
					}
				}
				while (++num2 < _buckets.Length && num2 != num + 2);
				array = new T[_buckets[num]._bufferLength];
			}
			else
			{
				array = new T[minimumLength];
			}
			if (log.IsEnabled())
			{
				int hashCode = array.GetHashCode();
				int bucketId = -1;
				log.BufferRented(hashCode, array.Length, Id, bucketId);
				log.BufferAllocated(hashCode, array.Length, Id, bucketId, (num >= _buckets.Length) ? System.Buffers.ArrayPoolEventSource.BufferAllocatedReason.OverMaximumSize : System.Buffers.ArrayPoolEventSource.BufferAllocatedReason.PoolExhausted);
			}
			return array;
		}

		public override void Return(T[] array, bool clearArray = false)
		{
			if (array == null)
			{
				throw new ArgumentNullException("array");
			}
			if (array.Length == 0)
			{
				return;
			}
			int num = System.Buffers.Utilities.SelectBucketIndex(array.Length);
			if (num < _buckets.Length)
			{
				if (clearArray)
				{
					Array.Clear(array, 0, array.Length);
				}
				_buckets[num].Return(array);
			}
			System.Buffers.ArrayPoolEventSource log = System.Buffers.ArrayPoolEventSource.Log;
			if (log.IsEnabled())
			{
				log.BufferReturned(array.GetHashCode(), array.Length, Id);
			}
		}
	}
	internal static class Utilities
	{
		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		internal static int SelectBucketIndex(int bufferSize)
		{
			uint num = (uint)(bufferSize - 1) >> 4;
			int num2 = 0;
			if (num > 65535)
			{
				num >>= 16;
				num2 = 16;
			}
			if (num > 255)
			{
				num >>= 8;
				num2 += 8;
			}
			if (num > 15)
			{
				num >>= 4;
				num2 += 4;
			}
			if (num > 3)
			{
				num >>= 2;
				num2 += 2;
			}
			if (num > 1)
			{
				num >>= 1;
				num2++;
			}
			return num2 + (int)num;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		internal static int GetMaxSizeForBucket(int binIndex)
		{
			return 16 << binIndex;
		}
	}
}

BepInEx/plugins/SlopCrew.Plugin/System.Diagnostics.DiagnosticSource.dll

Decompiled 8 months ago
using System;
using System.Buffers.Binary;
using System.Buffers.Text;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Diagnostics.Tracing;
using System.Globalization;
using System.Net;
using System.Reflection;
using System.Reflection.Emit;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Threading;
using FxResources.System.Diagnostics.DiagnosticSource;
using Microsoft.CodeAnalysis;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AllowPartiallyTrustedCallers]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: AssemblyMetadata(".NETFrameworkAssembly", "")]
[assembly: AssemblyMetadata("Serviceable", "True")]
[assembly: AssemblyMetadata("PreferInbox", "True")]
[assembly: AssemblyDefaultAlias("System.Diagnostics.DiagnosticSource")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: AssemblyMetadata("IsTrimmable", "True")]
[assembly: DefaultDllImportSearchPaths(DllImportSearchPath.System32 | DllImportSearchPath.AssemblyDirectory)]
[assembly: AssemblyCompany("Microsoft Corporation")]
[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")]
[assembly: AssemblyDescription("Provides Classes that allow you to decouple code logging rich (unserializable) diagnostics/telemetry (e.g. framework) from code that consumes it (e.g. tools)\r\n\r\nCommonly Used Types:\r\nSystem.Diagnostics.DiagnosticListener\r\nSystem.Diagnostics.DiagnosticSource")]
[assembly: AssemblyFileVersion("7.0.323.6910")]
[assembly: AssemblyInformationalVersion("7.0.3+0a2bda10e81d901396c3cff95533529e3a93ad47")]
[assembly: AssemblyProduct("Microsoft® .NET")]
[assembly: AssemblyTitle("System.Diagnostics.DiagnosticSource")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/dotnet/runtime")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("7.0.0.1")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: System.Runtime.CompilerServices.NullablePublicOnly(false)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class IsReadOnlyAttribute : Attribute
	{
	}
	[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 NullablePublicOnlyAttribute : Attribute
	{
		public readonly bool IncludesInternals;

		public NullablePublicOnlyAttribute(bool P_0)
		{
			IncludesInternals = 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 FxResources.System.Diagnostics.DiagnosticSource
{
	internal static class SR
	{
	}
}
namespace System
{
	internal static class HexConverter
	{
		public enum Casing : uint
		{
			Upper = 0u,
			Lower = 8224u
		}

		public static ReadOnlySpan<byte> CharToHexLookup => new byte[256]
		{
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 0, 1,
			2, 3, 4, 5, 6, 7, 8, 9, 255, 255,
			255, 255, 255, 255, 255, 10, 11, 12, 13, 14,
			15, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 10, 11, 12,
			13, 14, 15, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255
		};

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static void ToBytesBuffer(byte value, Span<byte> buffer, int startingIndex = 0, Casing casing = Casing.Upper)
		{
			uint num = (uint)(((value & 0xF0) << 4) + (value & 0xF) - 35209);
			uint num2 = ((((0 - num) & 0x7070) >> 4) + num + 47545) | (uint)casing;
			buffer[startingIndex + 1] = (byte)num2;
			buffer[startingIndex] = (byte)(num2 >> 8);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		[SecuritySafeCritical]
		public static void ToCharsBuffer(byte value, Span<char> buffer, int startingIndex = 0, Casing casing = Casing.Upper)
		{
			uint num = (uint)(((value & 0xF0) << 4) + (value & 0xF) - 35209);
			uint num2 = ((((0 - num) & 0x7070) >> 4) + num + 47545) | (uint)casing;
			buffer[startingIndex + 1] = (char)(num2 & 0xFFu);
			buffer[startingIndex] = (char)(num2 >> 8);
		}

		public static void EncodeToUtf16(ReadOnlySpan<byte> bytes, Span<char> chars, Casing casing = Casing.Upper)
		{
			for (int i = 0; i < bytes.Length; i++)
			{
				ToCharsBuffer(bytes[i], chars, i * 2, casing);
			}
		}

		[SecuritySafeCritical]
		public static string ToString(ReadOnlySpan<byte> bytes, Casing casing = Casing.Upper)
		{
			Span<char> span = ((bytes.Length <= 16) ? stackalloc char[bytes.Length * 2] : new char[bytes.Length * 2].AsSpan());
			Span<char> buffer = span;
			int num = 0;
			ReadOnlySpan<byte> readOnlySpan = bytes;
			for (int i = 0; i < readOnlySpan.Length; i++)
			{
				byte value = readOnlySpan[i];
				ToCharsBuffer(value, buffer, num, casing);
				num += 2;
			}
			return buffer.ToString();
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static char ToCharUpper(int value)
		{
			value &= 0xF;
			value += 48;
			if (value > 57)
			{
				value += 7;
			}
			return (char)value;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static char ToCharLower(int value)
		{
			value &= 0xF;
			value += 48;
			if (value > 57)
			{
				value += 39;
			}
			return (char)value;
		}

		public static bool TryDecodeFromUtf16(ReadOnlySpan<char> chars, Span<byte> bytes)
		{
			int charsProcessed;
			return TryDecodeFromUtf16(chars, bytes, out charsProcessed);
		}

		public static bool TryDecodeFromUtf16(ReadOnlySpan<char> chars, Span<byte> bytes, out int charsProcessed)
		{
			int num = 0;
			int num2 = 0;
			int num3 = 0;
			int num4 = 0;
			while (num2 < bytes.Length)
			{
				num3 = FromChar(chars[num + 1]);
				num4 = FromChar(chars[num]);
				if ((num3 | num4) == 255)
				{
					break;
				}
				bytes[num2++] = (byte)((num4 << 4) | num3);
				num += 2;
			}
			if (num3 == 255)
			{
				num++;
			}
			charsProcessed = num;
			return (num3 | num4) != 255;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static int FromChar(int c)
		{
			if (c < CharToHexLookup.Length)
			{
				return CharToHexLookup[c];
			}
			return 255;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static int FromUpperChar(int c)
		{
			if (c <= 71)
			{
				return CharToHexLookup[c];
			}
			return 255;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static int FromLowerChar(int c)
		{
			switch (c)
			{
			case 48:
			case 49:
			case 50:
			case 51:
			case 52:
			case 53:
			case 54:
			case 55:
			case 56:
			case 57:
				return c - 48;
			case 97:
			case 98:
			case 99:
			case 100:
			case 101:
			case 102:
				return c - 97 + 10;
			default:
				return 255;
			}
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static bool IsHexChar(int c)
		{
			if (IntPtr.Size == 8)
			{
				ulong num = (uint)(c - 48);
				ulong num2 = (ulong)(-17875860044349952L << (int)num);
				ulong num3 = num - 64;
				if ((long)(num2 & num3) >= 0L)
				{
					return false;
				}
				return true;
			}
			return FromChar(c) != 255;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static bool IsHexUpperChar(int c)
		{
			if ((uint)(c - 48) > 9u)
			{
				return (uint)(c - 65) <= 5u;
			}
			return true;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static bool IsHexLowerChar(int c)
		{
			if ((uint)(c - 48) > 9u)
			{
				return (uint)(c - 97) <= 5u;
			}
			return true;
		}
	}
	internal static class SR
	{
		private static readonly bool s_usingResourceKeys = AppContext.TryGetSwitch("System.Resources.UseSystemResourceKeys", out var isEnabled) && isEnabled;

		private static ResourceManager s_resourceManager;

		internal static ResourceManager ResourceManager => s_resourceManager ?? (s_resourceManager = new ResourceManager(typeof(SR)));

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

		private static bool UsingResourceKeys()
		{
			return s_usingResourceKeys;
		}

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

		internal static string GetResourceString(string resourceKey, string defaultString)
		{
			string resourceString = GetResourceString(resourceKey);
			if (!(resourceKey == resourceString) && resourceString != null)
			{
				return resourceString;
			}
			return defaultString;
		}

		internal static string Format(string resourceFormat, object p1)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1);
			}
			return string.Format(resourceFormat, p1);
		}

		internal static string Format(string resourceFormat, object p1, object p2)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2);
			}
			return string.Format(resourceFormat, p1, p2);
		}

		internal static string Format(string resourceFormat, object p1, object p2, object p3)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2, p3);
			}
			return string.Format(resourceFormat, p1, p2, p3);
		}

		internal static string Format(string resourceFormat, params object[] args)
		{
			if (args != null)
			{
				if (UsingResourceKeys())
				{
					return resourceFormat + ", " + string.Join(", ", args);
				}
				return string.Format(resourceFormat, args);
			}
			return resourceFormat;
		}

		internal static string Format(IFormatProvider provider, string resourceFormat, object p1)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1);
			}
			return string.Format(provider, resourceFormat, p1);
		}

		internal static string Format(IFormatProvider provider, string resourceFormat, object p1, object p2)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2);
			}
			return string.Format(provider, resourceFormat, p1, p2);
		}

		internal static string Format(IFormatProvider provider, string resourceFormat, object p1, object p2, object p3)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2, p3);
			}
			return string.Format(provider, resourceFormat, p1, p2, p3);
		}

		internal static string Format(IFormatProvider provider, string resourceFormat, params object[] args)
		{
			if (args != null)
			{
				if (UsingResourceKeys())
				{
					return resourceFormat + ", " + string.Join(", ", args);
				}
				return string.Format(provider, resourceFormat, args);
			}
			return resourceFormat;
		}
	}
}
namespace System.Runtime.Versioning
{
	internal abstract class OSPlatformAttribute : Attribute
	{
		public string PlatformName { get; }

		private protected OSPlatformAttribute(string platformName)
		{
			PlatformName = platformName;
		}
	}
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false, Inherited = false)]
	internal sealed class TargetPlatformAttribute : OSPlatformAttribute
	{
		public TargetPlatformAttribute(string platformName)
			: base(platformName)
		{
		}
	}
	[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface, AllowMultiple = true, Inherited = false)]
	internal sealed class SupportedOSPlatformAttribute : OSPlatformAttribute
	{
		public SupportedOSPlatformAttribute(string platformName)
			: base(platformName)
		{
		}
	}
	[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface, AllowMultiple = true, Inherited = false)]
	internal sealed class UnsupportedOSPlatformAttribute : OSPlatformAttribute
	{
		public string Message { get; }

		public UnsupportedOSPlatformAttribute(string platformName)
			: base(platformName)
		{
		}

		public UnsupportedOSPlatformAttribute(string platformName, string message)
			: base(platformName)
		{
			Message = message;
		}
	}
	[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface, AllowMultiple = true, Inherited = false)]
	internal sealed class ObsoletedOSPlatformAttribute : OSPlatformAttribute
	{
		public string Message { get; }

		public string Url { get; set; }

		public ObsoletedOSPlatformAttribute(string platformName)
			: base(platformName)
		{
		}

		public ObsoletedOSPlatformAttribute(string platformName, string message)
			: base(platformName)
		{
			Message = message;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = true, Inherited = false)]
	internal sealed class SupportedOSPlatformGuardAttribute : OSPlatformAttribute
	{
		public SupportedOSPlatformGuardAttribute(string platformName)
			: base(platformName)
		{
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = true, Inherited = false)]
	internal sealed class UnsupportedOSPlatformGuardAttribute : OSPlatformAttribute
	{
		public UnsupportedOSPlatformGuardAttribute(string platformName)
			: base(platformName)
		{
		}
	}
}
namespace System.Runtime.InteropServices
{
	[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
	internal sealed class LibraryImportAttribute : Attribute
	{
		public string LibraryName { get; }

		public string EntryPoint { get; set; }

		public StringMarshalling StringMarshalling { get; set; }

		public Type StringMarshallingCustomType { get; set; }

		public bool SetLastError { get; set; }

		public LibraryImportAttribute(string libraryName)
		{
			LibraryName = libraryName;
		}
	}
	internal enum StringMarshalling
	{
		Custom,
		Utf8,
		Utf16
	}
}
namespace System.Runtime.CompilerServices
{
	[EditorBrowsable(EditorBrowsableState.Never)]
	internal static class IsExternalInit
	{
	}
}
namespace System.Diagnostics
{
	[SecuritySafeCritical]
	public readonly struct ActivityChangedEventArgs
	{
		public Activity? Previous { get; init; }

		public Activity? Current { get; init; }

		internal ActivityChangedEventArgs(Activity previous, Activity current)
		{
			Previous = previous;
			Current = current;
		}
	}
	public class Activity : IDisposable
	{
		public struct Enumerator<T>
		{
			private static readonly DiagNode<T> s_Empty = new DiagNode<T>(default(T));

			private DiagNode<T> _nextNode;

			private DiagNode<T> _currentNode;

			public readonly ref T Current => ref _currentNode.Value;

			internal Enumerator(DiagNode<T> head)
			{
				_nextNode = head;
				_currentNode = s_Empty;
			}

			[EditorBrowsable(EditorBrowsableState.Never)]
			public readonly Enumerator<T> GetEnumerator()
			{
				return this;
			}

			public bool MoveNext()
			{
				if (_nextNode == null)
				{
					_currentNode = s_Empty;
					return false;
				}
				_currentNode = _nextNode;
				_nextNode = _nextNode.Next;
				return true;
			}
		}

		private sealed class BaggageLinkedList : IEnumerable<KeyValuePair<string, string>>, IEnumerable
		{
			private DiagNode<KeyValuePair<string, string>> _first;

			public DiagNode<KeyValuePair<string, string>> First => _first;

			public BaggageLinkedList(KeyValuePair<string, string> firstValue, bool set = false)
			{
				_first = ((set && firstValue.Value == null) ? null : new DiagNode<KeyValuePair<string, string>>(firstValue));
			}

			public void Add(KeyValuePair<string, string> value)
			{
				DiagNode<KeyValuePair<string, string>> diagNode = new DiagNode<KeyValuePair<string, string>>(value);
				lock (this)
				{
					diagNode.Next = _first;
					_first = diagNode;
				}
			}

			public void Set(KeyValuePair<string, string> value)
			{
				if (value.Value == null)
				{
					Remove(value.Key);
					return;
				}
				lock (this)
				{
					for (DiagNode<KeyValuePair<string, string>> diagNode = _first; diagNode != null; diagNode = diagNode.Next)
					{
						if (diagNode.Value.Key == value.Key)
						{
							diagNode.Value = value;
							return;
						}
					}
					DiagNode<KeyValuePair<string, string>> diagNode2 = new DiagNode<KeyValuePair<string, string>>(value);
					diagNode2.Next = _first;
					_first = diagNode2;
				}
			}

			public void Remove(string key)
			{
				lock (this)
				{
					if (_first == null)
					{
						return;
					}
					if (_first.Value.Key == key)
					{
						_first = _first.Next;
						return;
					}
					DiagNode<KeyValuePair<string, string>> diagNode = _first;
					while (diagNode.Next != null)
					{
						if (diagNode.Next.Value.Key == key)
						{
							diagNode.Next = diagNode.Next.Next;
							break;
						}
						diagNode = diagNode.Next;
					}
				}
			}

			public DiagEnumerator<KeyValuePair<string, string>> GetEnumerator()
			{
				return new DiagEnumerator<KeyValuePair<string, string>>(_first);
			}

			IEnumerator<KeyValuePair<string, string>> IEnumerable<KeyValuePair<string, string>>.GetEnumerator()
			{
				return GetEnumerator();
			}

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

		internal sealed class TagsLinkedList : IEnumerable<KeyValuePair<string, object>>, IEnumerable
		{
			private DiagNode<KeyValuePair<string, object>> _first;

			private DiagNode<KeyValuePair<string, object>> _last;

			private StringBuilder _stringBuilder;

			public DiagNode<KeyValuePair<string, object>> First => _first;

			public TagsLinkedList(KeyValuePair<string, object> firstValue, bool set = false)
			{
				_last = (_first = ((set && firstValue.Value == null) ? null : new DiagNode<KeyValuePair<string, object>>(firstValue)));
			}

			public TagsLinkedList(IEnumerator<KeyValuePair<string, object>> e)
			{
				_last = (_first = new DiagNode<KeyValuePair<string, object>>(e.Current));
				while (e.MoveNext())
				{
					_last.Next = new DiagNode<KeyValuePair<string, object>>(e.Current);
					_last = _last.Next;
				}
			}

			public TagsLinkedList(IEnumerable<KeyValuePair<string, object>> list)
			{
				Add(list);
			}

			public void Add(IEnumerable<KeyValuePair<string, object>> list)
			{
				IEnumerator<KeyValuePair<string, object>> enumerator = list.GetEnumerator();
				if (enumerator.MoveNext())
				{
					if (_first == null)
					{
						_last = (_first = new DiagNode<KeyValuePair<string, object>>(enumerator.Current));
					}
					else
					{
						_last.Next = new DiagNode<KeyValuePair<string, object>>(enumerator.Current);
						_last = _last.Next;
					}
					while (enumerator.MoveNext())
					{
						_last.Next = new DiagNode<KeyValuePair<string, object>>(enumerator.Current);
						_last = _last.Next;
					}
				}
			}

			public void Add(KeyValuePair<string, object> value)
			{
				DiagNode<KeyValuePair<string, object>> diagNode = new DiagNode<KeyValuePair<string, object>>(value);
				lock (this)
				{
					if (_first == null)
					{
						_first = (_last = diagNode);
						return;
					}
					_last.Next = diagNode;
					_last = diagNode;
				}
			}

			public object Get(string key)
			{
				for (DiagNode<KeyValuePair<string, object>> diagNode = _first; diagNode != null; diagNode = diagNode.Next)
				{
					if (diagNode.Value.Key == key)
					{
						return diagNode.Value.Value;
					}
				}
				return null;
			}

			public void Remove(string key)
			{
				lock (this)
				{
					if (_first == null)
					{
						return;
					}
					if (_first.Value.Key == key)
					{
						_first = _first.Next;
						if (_first == null)
						{
							_last = null;
						}
						return;
					}
					DiagNode<KeyValuePair<string, object>> diagNode = _first;
					while (diagNode.Next != null)
					{
						if (diagNode.Next.Value.Key == key)
						{
							if (_last == diagNode.Next)
							{
								_last = diagNode;
							}
							diagNode.Next = diagNode.Next.Next;
							break;
						}
						diagNode = diagNode.Next;
					}
				}
			}

			public void Set(KeyValuePair<string, object> value)
			{
				if (value.Value == null)
				{
					Remove(value.Key);
					return;
				}
				lock (this)
				{
					for (DiagNode<KeyValuePair<string, object>> diagNode = _first; diagNode != null; diagNode = diagNode.Next)
					{
						if (diagNode.Value.Key == value.Key)
						{
							diagNode.Value = value;
							return;
						}
					}
					DiagNode<KeyValuePair<string, object>> diagNode2 = new DiagNode<KeyValuePair<string, object>>(value);
					if (_first == null)
					{
						_first = (_last = diagNode2);
						return;
					}
					_last.Next = diagNode2;
					_last = diagNode2;
				}
			}

			public DiagEnumerator<KeyValuePair<string, object>> GetEnumerator()
			{
				return new DiagEnumerator<KeyValuePair<string, object>>(_first);
			}

			IEnumerator<KeyValuePair<string, object>> IEnumerable<KeyValuePair<string, object>>.GetEnumerator()
			{
				return GetEnumerator();
			}

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

			public IEnumerable<KeyValuePair<string, string>> EnumerateStringValues()
			{
				for (DiagNode<KeyValuePair<string, object>> current = _first; current != null; current = current.Next)
				{
					if (current.Value.Value is string || current.Value.Value == null)
					{
						yield return new KeyValuePair<string, string>(current.Value.Key, (string)current.Value.Value);
					}
				}
			}

			public override string ToString()
			{
				lock (this)
				{
					if (_first == null)
					{
						return string.Empty;
					}
					if (_stringBuilder == null)
					{
						_stringBuilder = new StringBuilder();
					}
					_stringBuilder.Append(_first.Value.Key);
					_stringBuilder.Append(':');
					_stringBuilder.Append(_first.Value.Value);
					for (DiagNode<KeyValuePair<string, object>> next = _first.Next; next != null; next = next.Next)
					{
						_stringBuilder.Append(", ");
						_stringBuilder.Append(next.Value.Key);
						_stringBuilder.Append(':');
						_stringBuilder.Append(next.Value.Value);
					}
					string result = _stringBuilder.ToString();
					_stringBuilder.Clear();
					return result;
				}
			}
		}

		[Flags]
		private enum State : byte
		{
			None = 0,
			FormatUnknown = 0,
			FormatHierarchical = 1,
			FormatW3C = 2,
			FormatFlags = 3,
			IsStopped = 0x80
		}

		private sealed class TimeSync
		{
			public readonly DateTime SyncUtcNow = DateTime.UtcNow;

			public readonly long SyncStopwatchTicks = Stopwatch.GetTimestamp();
		}

		private static readonly IEnumerable<KeyValuePair<string, string>> s_emptyBaggageTags = new KeyValuePair<string, string>[0];

		private static readonly IEnumerable<KeyValuePair<string, object>> s_emptyTagObjects = new KeyValuePair<string, object>[0];

		private static readonly IEnumerable<ActivityLink> s_emptyLinks = new ActivityLink[0];

		private static readonly IEnumerable<ActivityEvent> s_emptyEvents = new ActivityEvent[0];

		private static readonly ActivitySource s_defaultSource = new ActivitySource(string.Empty);

		private const byte ActivityTraceFlagsIsSet = 128;

		private const int RequestIdMaxLength = 1024;

		private static readonly string s_uniqSuffix = "-" + GetRandomNumber().ToString("x") + ".";

		private static long s_currentRootId = (uint)GetRandomNumber();

		private static ActivityIdFormat s_defaultIdFormat;

		private string _traceState;

		private State _state;

		private int _currentChildId;

		private string _id;

		private string _rootId;

		private string _parentId;

		private string _parentSpanId;

		private string _traceId;

		private string _spanId;

		private byte _w3CIdFlags;

		private byte _parentTraceFlags;

		private TagsLinkedList _tags;

		private BaggageLinkedList _baggage;

		private DiagLinkedList<ActivityLink> _links;

		private DiagLinkedList<ActivityEvent> _events;

		private Dictionary<string, object> _customProperties;

		private string _displayName;

		private ActivityStatusCode _statusCode;

		private string _statusDescription;

		private Activity _previousActiveActivity;

		private static readonly AsyncLocal<Activity> s_current = new AsyncLocal<Activity>();

		private static TimeSync timeSync = new TimeSync();

		private static readonly Timer syncTimeUpdater = InitializeSyncTimer();

		public static bool ForceDefaultIdFormat { get; set; }

		public ActivityStatusCode Status => _statusCode;

		public string? StatusDescription => _statusDescription;

		public bool HasRemoteParent { get; private set; }

		public ActivityKind Kind { get; private set; }

		public string OperationName { get; }

		public string DisplayName
		{
			get
			{
				return _displayName ?? OperationName;
			}
			set
			{
				_displayName = value ?? throw new ArgumentNullException("value");
			}
		}

		public ActivitySource Source { get; private set; }

		public Activity? Parent { get; private set; }

		public TimeSpan Duration { get; private set; }

		public DateTime StartTimeUtc { get; private set; }

		public string? Id
		{
			[SecuritySafeCritical]
			get
			{
				if (_id == null && _spanId != null)
				{
					Span<char> buffer = stackalloc char[2];
					System.HexConverter.ToCharsBuffer((byte)(0xFFFFFF7Fu & _w3CIdFlags), buffer, 0, System.HexConverter.Casing.Lower);
					string value = "00-" + _traceId + "-" + _spanId + "-" + buffer;
					Interlocked.CompareExchange(ref _id, value, null);
				}
				return _id;
			}
		}

		public string? ParentId
		{
			[SecuritySafeCritical]
			get
			{
				if (_parentId == null)
				{
					if (_parentSpanId != null)
					{
						Span<char> buffer = stackalloc char[2];
						System.HexConverter.ToCharsBuffer((byte)(0xFFFFFF7Fu & _parentTraceFlags), buffer, 0, System.HexConverter.Casing.Lower);
						string value = "00-" + _traceId + "-" + _parentSpanId + "-" + buffer;
						Interlocked.CompareExchange(ref _parentId, value, null);
					}
					else if (Parent != null)
					{
						Interlocked.CompareExchange(ref _parentId, Parent.Id, null);
					}
				}
				return _parentId;
			}
		}

		public string? RootId
		{
			get
			{
				if (_rootId == null)
				{
					string text = null;
					if (Id != null)
					{
						text = GetRootId(Id);
					}
					else if (ParentId != null)
					{
						text = GetRootId(ParentId);
					}
					if (text != null)
					{
						Interlocked.CompareExchange(ref _rootId, text, null);
					}
				}
				return _rootId;
			}
		}

		public IEnumerable<KeyValuePair<string, string?>> Tags => _tags?.EnumerateStringValues() ?? s_emptyBaggageTags;

		public IEnumerable<KeyValuePair<string, object?>> TagObjects
		{
			get
			{
				IEnumerable<KeyValuePair<string, object>> tags = _tags;
				return tags ?? s_emptyTagObjects;
			}
		}

		public IEnumerable<ActivityEvent> Events
		{
			get
			{
				IEnumerable<ActivityEvent> events = _events;
				return events ?? s_emptyEvents;
			}
		}

		public IEnumerable<ActivityLink> Links
		{
			get
			{
				IEnumerable<ActivityLink> links = _links;
				return links ?? s_emptyLinks;
			}
		}

		public IEnumerable<KeyValuePair<string, string?>> Baggage
		{
			get
			{
				for (Activity activity2 = this; activity2 != null; activity2 = activity2.Parent)
				{
					if (activity2._baggage != null)
					{
						return Iterate(activity2);
					}
				}
				return s_emptyBaggageTags;
				static IEnumerable<KeyValuePair<string, string>> Iterate(Activity activity)
				{
					do
					{
						if (activity._baggage != null)
						{
							for (DiagNode<KeyValuePair<string, string>> current = activity._baggage.First; current != null; current = current.Next)
							{
								yield return current.Value;
							}
						}
						activity = activity.Parent;
					}
					while (activity != null);
				}
			}
		}

		public ActivityContext Context => new ActivityContext(TraceId, SpanId, ActivityTraceFlags, TraceStateString);

		public string? TraceStateString
		{
			get
			{
				for (Activity activity = this; activity != null; activity = activity.Parent)
				{
					string traceState = activity._traceState;
					if (traceState != null)
					{
						return traceState;
					}
				}
				return null;
			}
			set
			{
				_traceState = value;
			}
		}

		public ActivitySpanId SpanId
		{
			[SecuritySafeCritical]
			get
			{
				if (_spanId == null && _id != null && IdFormat == ActivityIdFormat.W3C)
				{
					string value = ActivitySpanId.CreateFromString(_id.AsSpan(36, 16)).ToHexString();
					Interlocked.CompareExchange(ref _spanId, value, null);
				}
				return new ActivitySpanId(_spanId);
			}
		}

		public ActivityTraceId TraceId
		{
			get
			{
				if (_traceId == null)
				{
					TrySetTraceIdFromParent();
				}
				return new ActivityTraceId(_traceId);
			}
		}

		public bool Recorded => (ActivityTraceFlags & ActivityTraceFlags.Recorded) != 0;

		public bool IsAllDataRequested { get; set; }

		public ActivityTraceFlags ActivityTraceFlags
		{
			get
			{
				if (!W3CIdFlagsSet)
				{
					TrySetTraceFlagsFromParent();
				}
				return (ActivityTraceFlags)(-129 & (int)_w3CIdFlags);
			}
			set
			{
				_w3CIdFlags = (byte)(0x80u | (byte)value);
			}
		}

		public ActivitySpanId ParentSpanId
		{
			[SecuritySafeCritical]
			get
			{
				if (_parentSpanId == null)
				{
					string text = null;
					if (_parentId != null && IsW3CId(_parentId))
					{
						try
						{
							text = ActivitySpanId.CreateFromString(_parentId.AsSpan(36, 16)).ToHexString();
						}
						catch
						{
						}
					}
					else if (Parent != null && Parent.IdFormat == ActivityIdFormat.W3C)
					{
						text = Parent.SpanId.ToHexString();
					}
					if (text != null)
					{
						Interlocked.CompareExchange(ref _parentSpanId, text, null);
					}
				}
				return new ActivitySpanId(_parentSpanId);
			}
		}

		public static Func<ActivityTraceId>? TraceIdGenerator { get; set; }

		public static ActivityIdFormat DefaultIdFormat
		{
			get
			{
				if (s_defaultIdFormat == ActivityIdFormat.Unknown)
				{
					s_defaultIdFormat = ActivityIdFormat.Hierarchical;
				}
				return s_defaultIdFormat;
			}
			set
			{
				if (ActivityIdFormat.Hierarchical > value || value > ActivityIdFormat.W3C)
				{
					throw new ArgumentException(System.SR.ActivityIdFormatInvalid);
				}
				s_defaultIdFormat = value;
			}
		}

		private bool W3CIdFlagsSet => (_w3CIdFlags & 0x80) != 0;

		public bool IsStopped
		{
			get
			{
				return (_state & State.IsStopped) != 0;
			}
			private set
			{
				if (value)
				{
					_state |= State.IsStopped;
				}
				else
				{
					_state &= ~State.IsStopped;
				}
			}
		}

		public ActivityIdFormat IdFormat
		{
			get
			{
				return (ActivityIdFormat)(_state & State.FormatFlags);
			}
			private set
			{
				_state = (_state & ~State.FormatFlags) | (State)((byte)value & 3u);
			}
		}

		public static Activity? Current
		{
			get
			{
				return s_current.Value;
			}
			set
			{
				if (ValidateSetCurrent(value))
				{
					SetCurrent(value);
				}
			}
		}

		public static event EventHandler<ActivityChangedEventArgs>? CurrentChanged;

		public Activity SetStatus(ActivityStatusCode code, string? description = null)
		{
			_statusCode = code;
			_statusDescription = ((code == ActivityStatusCode.Error) ? description : null);
			return this;
		}

		public Enumerator<KeyValuePair<string, object?>> EnumerateTagObjects()
		{
			return new Enumerator<KeyValuePair<string, object>>(_tags?.First);
		}

		public Enumerator<ActivityEvent> EnumerateEvents()
		{
			return new Enumerator<ActivityEvent>(_events?.First);
		}

		public Enumerator<ActivityLink> EnumerateLinks()
		{
			return new Enumerator<ActivityLink>(_links?.First);
		}

		public string? GetBaggageItem(string key)
		{
			foreach (KeyValuePair<string, string> item in Baggage)
			{
				if (key == item.Key)
				{
					return item.Value;
				}
			}
			return null;
		}

		public object? GetTagItem(string key)
		{
			return _tags?.Get(key) ?? null;
		}

		public Activity(string operationName)
		{
			Source = s_defaultSource;
			IsAllDataRequested = true;
			if (string.IsNullOrEmpty(operationName))
			{
				NotifyError(new ArgumentException(System.SR.OperationNameInvalid));
			}
			OperationName = operationName;
		}

		public Activity AddTag(string key, string? value)
		{
			return AddTag(key, (object?)value);
		}

		public Activity AddTag(string key, object? value)
		{
			KeyValuePair<string, object> keyValuePair = new KeyValuePair<string, object>(key, value);
			if (_tags != null || Interlocked.CompareExchange(ref _tags, new TagsLinkedList(keyValuePair), null) != null)
			{
				_tags.Add(keyValuePair);
			}
			return this;
		}

		public Activity SetTag(string key, object? value)
		{
			KeyValuePair<string, object> keyValuePair = new KeyValuePair<string, object>(key, value);
			if (_tags != null || Interlocked.CompareExchange(ref _tags, new TagsLinkedList(keyValuePair, set: true), null) != null)
			{
				_tags.Set(keyValuePair);
			}
			return this;
		}

		public Activity AddEvent(ActivityEvent e)
		{
			if (_events != null || Interlocked.CompareExchange(ref _events, new DiagLinkedList<ActivityEvent>(e), null) != null)
			{
				_events.Add(e);
			}
			return this;
		}

		public Activity AddBaggage(string key, string? value)
		{
			KeyValuePair<string, string> keyValuePair = new KeyValuePair<string, string>(key, value);
			if (_baggage != null || Interlocked.CompareExchange(ref _baggage, new BaggageLinkedList(keyValuePair), null) != null)
			{
				_baggage.Add(keyValuePair);
			}
			return this;
		}

		public Activity SetBaggage(string key, string? value)
		{
			KeyValuePair<string, string> keyValuePair = new KeyValuePair<string, string>(key, value);
			if (_baggage != null || Interlocked.CompareExchange(ref _baggage, new BaggageLinkedList(keyValuePair, set: true), null) != null)
			{
				_baggage.Set(keyValuePair);
			}
			return this;
		}

		public Activity SetParentId(string parentId)
		{
			if (Parent != null)
			{
				NotifyError(new InvalidOperationException(System.SR.SetParentIdOnActivityWithParent));
			}
			else if (ParentId != null || _parentSpanId != null)
			{
				NotifyError(new InvalidOperationException(System.SR.ParentIdAlreadySet));
			}
			else if (string.IsNullOrEmpty(parentId))
			{
				NotifyError(new ArgumentException(System.SR.ParentIdInvalid));
			}
			else
			{
				_parentId = parentId;
			}
			return this;
		}

		public Activity SetParentId(ActivityTraceId traceId, ActivitySpanId spanId, ActivityTraceFlags activityTraceFlags = ActivityTraceFlags.None)
		{
			if (Parent != null)
			{
				NotifyError(new InvalidOperationException(System.SR.SetParentIdOnActivityWithParent));
			}
			else if (ParentId != null || _parentSpanId != null)
			{
				NotifyError(new InvalidOperationException(System.SR.ParentIdAlreadySet));
			}
			else
			{
				_traceId = traceId.ToHexString();
				_parentSpanId = spanId.ToHexString();
				ActivityTraceFlags = activityTraceFlags;
				_parentTraceFlags = (byte)activityTraceFlags;
			}
			return this;
		}

		public Activity SetStartTime(DateTime startTimeUtc)
		{
			if (startTimeUtc.Kind != DateTimeKind.Utc)
			{
				NotifyError(new InvalidOperationException(System.SR.StartTimeNotUtc));
			}
			else
			{
				StartTimeUtc = startTimeUtc;
			}
			return this;
		}

		public Activity SetEndTime(DateTime endTimeUtc)
		{
			if (endTimeUtc.Kind != DateTimeKind.Utc)
			{
				NotifyError(new InvalidOperationException(System.SR.EndTimeNotUtc));
			}
			else
			{
				Duration = endTimeUtc - StartTimeUtc;
				if (Duration.Ticks <= 0)
				{
					Duration = new TimeSpan(1L);
				}
			}
			return this;
		}

		public Activity Start()
		{
			if (_id != null || _spanId != null)
			{
				NotifyError(new InvalidOperationException(System.SR.ActivityStartAlreadyStarted));
			}
			else
			{
				_previousActiveActivity = Current;
				if (_parentId == null && _parentSpanId == null && _previousActiveActivity != null)
				{
					Parent = _previousActiveActivity;
				}
				if (StartTimeUtc == default(DateTime))
				{
					StartTimeUtc = GetUtcNow();
				}
				if (IdFormat == ActivityIdFormat.Unknown)
				{
					IdFormat = (ForceDefaultIdFormat ? DefaultIdFormat : ((Parent != null) ? Parent.IdFormat : ((_parentSpanId != null) ? ActivityIdFormat.W3C : ((_parentId == null) ? DefaultIdFormat : ((!IsW3CId(_parentId)) ? ActivityIdFormat.Hierarchical : ActivityIdFormat.W3C)))));
				}
				if (IdFormat == ActivityIdFormat.W3C)
				{
					GenerateW3CId();
				}
				else
				{
					_id = GenerateHierarchicalId();
				}
				SetCurrent(this);
				Source.NotifyActivityStart(this);
			}
			return this;
		}

		public void Stop()
		{
			if (_id == null && _spanId == null)
			{
				NotifyError(new InvalidOperationException(System.SR.ActivityNotStarted));
			}
			else if (!IsStopped)
			{
				IsStopped = true;
				if (Duration == TimeSpan.Zero)
				{
					SetEndTime(GetUtcNow());
				}
				Source.NotifyActivityStop(this);
				SetCurrent(_previousActiveActivity);
			}
		}

		public Activity SetIdFormat(ActivityIdFormat format)
		{
			if (_id != null || _spanId != null)
			{
				NotifyError(new InvalidOperationException(System.SR.SetFormatOnStartedActivity));
			}
			else
			{
				IdFormat = format;
			}
			return this;
		}

		private static bool IsW3CId(string id)
		{
			if (id.Length == 55 && (('0' <= id[0] && id[0] <= '9') || ('a' <= id[0] && id[0] <= 'f')) && (('0' <= id[1] && id[1] <= '9') || ('a' <= id[1] && id[1] <= 'f')))
			{
				if (id[0] == 'f')
				{
					return id[1] != 'f';
				}
				return true;
			}
			return false;
		}

		[SecuritySafeCritical]
		internal static bool TryConvertIdToContext(string traceParent, string traceState, bool isRemote, out ActivityContext context)
		{
			context = default(ActivityContext);
			if (!IsW3CId(traceParent))
			{
				return false;
			}
			ReadOnlySpan<char> idData = traceParent.AsSpan(3, 32);
			ReadOnlySpan<char> idData2 = traceParent.AsSpan(36, 16);
			if (!ActivityTraceId.IsLowerCaseHexAndNotAllZeros(idData) || !ActivityTraceId.IsLowerCaseHexAndNotAllZeros(idData2) || !System.HexConverter.IsHexLowerChar(traceParent[53]) || !System.HexConverter.IsHexLowerChar(traceParent[54]))
			{
				return false;
			}
			context = new ActivityContext(new ActivityTraceId(idData.ToString()), new ActivitySpanId(idData2.ToString()), (ActivityTraceFlags)ActivityTraceId.HexByteFromChars(traceParent[53], traceParent[54]), traceState, isRemote);
			return true;
		}

		public void Dispose()
		{
			if (!IsStopped)
			{
				Stop();
			}
			Dispose(disposing: true);
			GC.SuppressFinalize(this);
		}

		protected virtual void Dispose(bool disposing)
		{
		}

		public void SetCustomProperty(string propertyName, object? propertyValue)
		{
			if (_customProperties == null)
			{
				Interlocked.CompareExchange(ref _customProperties, new Dictionary<string, object>(), null);
			}
			lock (_customProperties)
			{
				if (propertyValue == null)
				{
					_customProperties.Remove(propertyName);
				}
				else
				{
					_customProperties[propertyName] = propertyValue;
				}
			}
		}

		public object? GetCustomProperty(string propertyName)
		{
			if (_customProperties == null)
			{
				return null;
			}
			lock (_customProperties)
			{
				object value;
				return _customProperties.TryGetValue(propertyName, out value) ? value : null;
			}
		}

		internal static Activity Create(ActivitySource source, string name, ActivityKind kind, string parentId, ActivityContext parentContext, IEnumerable<KeyValuePair<string, object>> tags, IEnumerable<ActivityLink> links, DateTimeOffset startTime, ActivityTagsCollection samplerTags, ActivitySamplingResult request, bool startIt, ActivityIdFormat idFormat, string traceState)
		{
			Activity activity = new Activity(name);
			activity.Source = source;
			activity.Kind = kind;
			activity.IdFormat = idFormat;
			activity._traceState = traceState;
			if (links != null)
			{
				using IEnumerator<ActivityLink> enumerator = links.GetEnumerator();
				if (enumerator.MoveNext())
				{
					activity._links = new DiagLinkedList<ActivityLink>(enumerator);
				}
			}
			if (tags != null)
			{
				using IEnumerator<KeyValuePair<string, object>> enumerator2 = tags.GetEnumerator();
				if (enumerator2.MoveNext())
				{
					activity._tags = new TagsLinkedList(enumerator2);
				}
			}
			if (samplerTags != null)
			{
				if (activity._tags == null)
				{
					activity._tags = new TagsLinkedList(samplerTags);
				}
				else
				{
					activity._tags.Add(samplerTags);
				}
			}
			if (parentId != null)
			{
				activity._parentId = parentId;
			}
			else if (parentContext != default(ActivityContext))
			{
				activity._traceId = parentContext.TraceId.ToString();
				if (parentContext.SpanId != default(ActivitySpanId))
				{
					activity._parentSpanId = parentContext.SpanId.ToString();
				}
				activity.ActivityTraceFlags = parentContext.TraceFlags;
				activity._parentTraceFlags = (byte)parentContext.TraceFlags;
				activity.HasRemoteParent = parentContext.IsRemote;
			}
			activity.IsAllDataRequested = request == ActivitySamplingResult.AllData || request == ActivitySamplingResult.AllDataAndRecorded;
			if (request == ActivitySamplingResult.AllDataAndRecorded)
			{
				activity.ActivityTraceFlags |= ActivityTraceFlags.Recorded;
			}
			if (startTime != default(DateTimeOffset))
			{
				activity.StartTimeUtc = startTime.UtcDateTime;
			}
			if (startIt)
			{
				activity.Start();
			}
			return activity;
		}

		private void GenerateW3CId()
		{
			if (_traceId == null && !TrySetTraceIdFromParent())
			{
				_traceId = (TraceIdGenerator?.Invoke() ?? ActivityTraceId.CreateRandom()).ToHexString();
			}
			if (!W3CIdFlagsSet)
			{
				TrySetTraceFlagsFromParent();
			}
			_spanId = ActivitySpanId.CreateRandom().ToHexString();
		}

		private static void NotifyError(Exception exception)
		{
			try
			{
				throw exception;
			}
			catch
			{
			}
		}

		private string GenerateHierarchicalId()
		{
			if (Parent != null)
			{
				return AppendSuffix(Parent.Id, Interlocked.Increment(ref Parent._currentChildId).ToString(), '.');
			}
			if (ParentId != null)
			{
				string text = ((ParentId[0] == '|') ? ParentId : ("|" + ParentId));
				char c = text[text.Length - 1];
				if (c != '.' && c != '_')
				{
					text += ".";
				}
				return AppendSuffix(text, Interlocked.Increment(ref s_currentRootId).ToString("x"), '_');
			}
			return GenerateRootId();
		}

		private string GetRootId(string id)
		{
			if (IdFormat == ActivityIdFormat.W3C)
			{
				return id.Substring(3, 32);
			}
			int num = id.IndexOf('.');
			if (num < 0)
			{
				num = id.Length;
			}
			int num2 = ((id[0] == '|') ? 1 : 0);
			return id.Substring(num2, num - num2);
		}

		private string AppendSuffix(string parentId, string suffix, char delimiter)
		{
			if (parentId.Length + suffix.Length < 1024)
			{
				return parentId + suffix + delimiter;
			}
			int num = 1015;
			while (num > 1 && parentId[num - 1] != '.' && parentId[num - 1] != '_')
			{
				num--;
			}
			if (num == 1)
			{
				return GenerateRootId();
			}
			string text = ((int)GetRandomNumber()).ToString("x8");
			return parentId.Substring(0, num) + text + "#";
		}

		[SecuritySafeCritical]
		private unsafe static long GetRandomNumber()
		{
			Guid guid = Guid.NewGuid();
			return *(long*)(&guid);
		}

		private static bool ValidateSetCurrent(Activity activity)
		{
			bool flag = activity == null || (activity.Id != null && !activity.IsStopped);
			if (!flag)
			{
				NotifyError(new InvalidOperationException(System.SR.ActivityNotRunning));
			}
			return flag;
		}

		[SecuritySafeCritical]
		private bool TrySetTraceIdFromParent()
		{
			if (Parent != null && Parent.IdFormat == ActivityIdFormat.W3C)
			{
				_traceId = Parent.TraceId.ToHexString();
			}
			else if (_parentId != null && IsW3CId(_parentId))
			{
				try
				{
					_traceId = ActivityTraceId.CreateFromString(_parentId.AsSpan(3, 32)).ToHexString();
				}
				catch
				{
				}
			}
			return _traceId != null;
		}

		[SecuritySafeCritical]
		private void TrySetTraceFlagsFromParent()
		{
			if (W3CIdFlagsSet)
			{
				return;
			}
			if (Parent != null)
			{
				ActivityTraceFlags = Parent.ActivityTraceFlags;
			}
			else if (_parentId != null && IsW3CId(_parentId))
			{
				if (System.HexConverter.IsHexLowerChar(_parentId[53]) && System.HexConverter.IsHexLowerChar(_parentId[54]))
				{
					_w3CIdFlags = (byte)(ActivityTraceId.HexByteFromChars(_parentId[53], _parentId[54]) | 0x80u);
				}
				else
				{
					_w3CIdFlags = 128;
				}
			}
		}

		private static void SetCurrent(Activity activity)
		{
			EventHandler<ActivityChangedEventArgs> currentChanged = Activity.CurrentChanged;
			if (currentChanged == null)
			{
				s_current.Value = activity;
				return;
			}
			Activity value = s_current.Value;
			s_current.Value = activity;
			currentChanged(null, new ActivityChangedEventArgs(value, activity));
		}

		private static string GenerateRootId()
		{
			return "|" + Interlocked.Increment(ref s_currentRootId).ToString("x") + s_uniqSuffix;
		}

		internal static DateTime GetUtcNow()
		{
			TimeSync timeSync = Activity.timeSync;
			long value = (long)((double)((Stopwatch.GetTimestamp() - timeSync.SyncStopwatchTicks) * 10000000) / (double)Stopwatch.Frequency);
			DateTime syncUtcNow = timeSync.SyncUtcNow;
			return syncUtcNow.AddTicks(value);
		}

		private static void Sync()
		{
			Thread.Sleep(1);
			timeSync = new TimeSync();
		}

		[SecuritySafeCritical]
		private static Timer InitializeSyncTimer()
		{
			bool flag = false;
			try
			{
				if (!ExecutionContext.IsFlowSuppressed())
				{
					ExecutionContext.SuppressFlow();
					flag = true;
				}
				return new Timer(delegate
				{
					Sync();
				}, null, 0, 7200000);
			}
			finally
			{
				if (flag)
				{
					ExecutionContext.RestoreFlow();
				}
			}
		}
	}
	[Flags]
	public enum ActivityTraceFlags
	{
		None = 0,
		Recorded = 1
	}
	public enum ActivityIdFormat
	{
		Unknown,
		Hierarchical,
		W3C
	}
	[SecuritySafeCritical]
	public readonly struct ActivityTraceId : IEquatable<ActivityTraceId>
	{
		private readonly string _hexString;

		internal ActivityTraceId(string hexString)
		{
			_hexString = hexString;
		}

		public static ActivityTraceId CreateRandom()
		{
			Span<byte> span = stackalloc byte[16];
			SetToRandomBytes(span);
			return CreateFromBytes(span);
		}

		public static ActivityTraceId CreateFromBytes(ReadOnlySpan<byte> idData)
		{
			if (idData.Length != 16)
			{
				throw new ArgumentOutOfRangeException("idData");
			}
			return new ActivityTraceId(System.HexConverter.ToString(idData, System.HexConverter.Casing.Lower));
		}

		public static ActivityTraceId CreateFromUtf8String(ReadOnlySpan<byte> idData)
		{
			return new ActivityTraceId(idData);
		}

		public static ActivityTraceId CreateFromString(ReadOnlySpan<char> idData)
		{
			if (idData.Length != 32 || !IsLowerCaseHexAndNotAllZeros(idData))
			{
				throw new ArgumentOutOfRangeException("idData");
			}
			return new ActivityTraceId(idData.ToString());
		}

		public string ToHexString()
		{
			return _hexString ?? "00000000000000000000000000000000";
		}

		public override string ToString()
		{
			return ToHexString();
		}

		public static bool operator ==(ActivityTraceId traceId1, ActivityTraceId traceId2)
		{
			return traceId1._hexString == traceId2._hexString;
		}

		public static bool operator !=(ActivityTraceId traceId1, ActivityTraceId traceId2)
		{
			return traceId1._hexString != traceId2._hexString;
		}

		public bool Equals(ActivityTraceId traceId)
		{
			return _hexString == traceId._hexString;
		}

		public override bool Equals([NotNullWhen(true)] object? obj)
		{
			if (obj is ActivityTraceId activityTraceId)
			{
				return _hexString == activityTraceId._hexString;
			}
			return false;
		}

		public override int GetHashCode()
		{
			return ToHexString().GetHashCode();
		}

		private ActivityTraceId(ReadOnlySpan<byte> idData)
		{
			if (idData.Length != 32)
			{
				throw new ArgumentOutOfRangeException("idData");
			}
			Span<ulong> span = stackalloc ulong[2];
			if (!Utf8Parser.TryParse(idData.Slice(0, 16), out span[0], out int bytesConsumed, 'x'))
			{
				_hexString = CreateRandom()._hexString;
				return;
			}
			if (!Utf8Parser.TryParse(idData.Slice(16, 16), out span[1], out bytesConsumed, 'x'))
			{
				_hexString = CreateRandom()._hexString;
				return;
			}
			if (BitConverter.IsLittleEndian)
			{
				span[0] = BinaryPrimitives.ReverseEndianness(span[0]);
				span[1] = BinaryPrimitives.ReverseEndianness(span[1]);
			}
			_hexString = System.HexConverter.ToString(MemoryMarshal.AsBytes(span), System.HexConverter.Casing.Lower);
		}

		public void CopyTo(Span<byte> destination)
		{
			SetSpanFromHexChars(ToHexString().AsSpan(), destination);
		}

		internal static void SetToRandomBytes(Span<byte> outBytes)
		{
			RandomNumberGenerator current = RandomNumberGenerator.Current;
			System.Runtime.CompilerServices.Unsafe.WriteUnaligned<long>(ref outBytes[0], current.Next());
			if (outBytes.Length == 16)
			{
				System.Runtime.CompilerServices.Unsafe.WriteUnaligned<long>(ref outBytes[8], current.Next());
			}
		}

		internal static void SetSpanFromHexChars(ReadOnlySpan<char> charData, Span<byte> outBytes)
		{
			for (int i = 0; i < outBytes.Length; i++)
			{
				outBytes[i] = HexByteFromChars(charData[i * 2], charData[i * 2 + 1]);
			}
		}

		internal static byte HexByteFromChars(char char1, char char2)
		{
			int num = System.HexConverter.FromLowerChar(char1);
			int num2 = System.HexConverter.FromLowerChar(char2);
			if ((num | num2) == 255)
			{
				throw new ArgumentOutOfRangeException("idData");
			}
			return (byte)((num << 4) | num2);
		}

		internal static bool IsLowerCaseHexAndNotAllZeros(ReadOnlySpan<char> idData)
		{
			bool result = false;
			for (int i = 0; i < idData.Length; i++)
			{
				char c = idData[i];
				if (!System.HexConverter.IsHexLowerChar(c))
				{
					return false;
				}
				if (c != '0')
				{
					result = true;
				}
			}
			return result;
		}
	}
	[SecuritySafeCritical]
	public readonly struct ActivitySpanId : IEquatable<ActivitySpanId>
	{
		private readonly string _hexString;

		internal ActivitySpanId(string hexString)
		{
			_hexString = hexString;
		}

		public unsafe static ActivitySpanId CreateRandom()
		{
			ulong num = default(ulong);
			ActivityTraceId.SetToRandomBytes(new Span<byte>(&num, 8));
			return new ActivitySpanId(System.HexConverter.ToString(new ReadOnlySpan<byte>(&num, 8), System.HexConverter.Casing.Lower));
		}

		public static ActivitySpanId CreateFromBytes(ReadOnlySpan<byte> idData)
		{
			if (idData.Length != 8)
			{
				throw new ArgumentOutOfRangeException("idData");
			}
			return new ActivitySpanId(System.HexConverter.ToString(idData, System.HexConverter.Casing.Lower));
		}

		public static ActivitySpanId CreateFromUtf8String(ReadOnlySpan<byte> idData)
		{
			return new ActivitySpanId(idData);
		}

		public static ActivitySpanId CreateFromString(ReadOnlySpan<char> idData)
		{
			if (idData.Length != 16 || !ActivityTraceId.IsLowerCaseHexAndNotAllZeros(idData))
			{
				throw new ArgumentOutOfRangeException("idData");
			}
			return new ActivitySpanId(idData.ToString());
		}

		public string ToHexString()
		{
			return _hexString ?? "0000000000000000";
		}

		public override string ToString()
		{
			return ToHexString();
		}

		public static bool operator ==(ActivitySpanId spanId1, ActivitySpanId spandId2)
		{
			return spanId1._hexString == spandId2._hexString;
		}

		public static bool operator !=(ActivitySpanId spanId1, ActivitySpanId spandId2)
		{
			return spanId1._hexString != spandId2._hexString;
		}

		public bool Equals(ActivitySpanId spanId)
		{
			return _hexString == spanId._hexString;
		}

		public override bool Equals([NotNullWhen(true)] object? obj)
		{
			if (obj is ActivitySpanId activitySpanId)
			{
				return _hexString == activitySpanId._hexString;
			}
			return false;
		}

		public override int GetHashCode()
		{
			return ToHexString().GetHashCode();
		}

		private unsafe ActivitySpanId(ReadOnlySpan<byte> idData)
		{
			if (idData.Length != 16)
			{
				throw new ArgumentOutOfRangeException("idData");
			}
			if (!Utf8Parser.TryParse(idData, out ulong value, out int _, 'x'))
			{
				_hexString = CreateRandom()._hexString;
				return;
			}
			if (BitConverter.IsLittleEndian)
			{
				value = BinaryPrimitives.ReverseEndianness(value);
			}
			_hexString = System.HexConverter.ToString(new ReadOnlySpan<byte>(&value, 8), System.HexConverter.Casing.Lower);
		}

		public void CopyTo(Span<byte> destination)
		{
			ActivityTraceId.SetSpanFromHexChars(ToHexString().AsSpan(), destination);
		}
	}
	public enum ActivityStatusCode
	{
		Unset,
		Ok,
		Error
	}
	public class ActivityTagsCollection : IDictionary<string, object?>, ICollection<KeyValuePair<string, object?>>, IEnumerable<KeyValuePair<string, object?>>, IEnumerable
	{
		public struct Enumerator : IEnumerator<KeyValuePair<string, object?>>, IDisposable, IEnumerator
		{
			private List<KeyValuePair<string, object>>.Enumerator _enumerator;

			public KeyValuePair<string, object?> Current => _enumerator.Current;

			object IEnumerator.Current => ((IEnumerator)_enumerator).Current;

			internal Enumerator(List<KeyValuePair<string, object>> list)
			{
				_enumerator = list.GetEnumerator();
			}

			public void Dispose()
			{
				_enumerator.Dispose();
			}

			public bool MoveNext()
			{
				return _enumerator.MoveNext();
			}

			void IEnumerator.Reset()
			{
				((IEnumerator)_enumerator).Reset();
			}
		}

		private List<KeyValuePair<string, object>> _list = new List<KeyValuePair<string, object>>();

		public object? this[string key]
		{
			get
			{
				int num = FindIndex(key);
				if (num >= 0)
				{
					return _list[num].Value;
				}
				return null;
			}
			set
			{
				if (key == null)
				{
					throw new ArgumentNullException("key");
				}
				int num = FindIndex(key);
				if (value == null)
				{
					if (num >= 0)
					{
						_list.RemoveAt(num);
					}
				}
				else if (num >= 0)
				{
					_list[num] = new KeyValuePair<string, object>(key, value);
				}
				else
				{
					_list.Add(new KeyValuePair<string, object>(key, value));
				}
			}
		}

		public ICollection<string> Keys
		{
			get
			{
				List<string> list = new List<string>(_list.Count);
				foreach (KeyValuePair<string, object> item in _list)
				{
					list.Add(item.Key);
				}
				return list;
			}
		}

		public ICollection<object?> Values
		{
			get
			{
				List<object> list = new List<object>(_list.Count);
				foreach (KeyValuePair<string, object> item in _list)
				{
					list.Add(item.Value);
				}
				return list;
			}
		}

		public bool IsReadOnly => false;

		public int Count => _list.Count;

		public ActivityTagsCollection()
		{
		}

		public ActivityTagsCollection(IEnumerable<KeyValuePair<string, object?>> list)
		{
			if (list == null)
			{
				throw new ArgumentNullException("list");
			}
			foreach (KeyValuePair<string, object> item in list)
			{
				if (item.Key != null)
				{
					this[item.Key] = item.Value;
				}
			}
		}

		public void Add(string key, object? value)
		{
			if (key == null)
			{
				throw new ArgumentNullException("key");
			}
			int num = FindIndex(key);
			if (num >= 0)
			{
				throw new InvalidOperationException(System.SR.Format(System.SR.KeyAlreadyExist, key));
			}
			_list.Add(new KeyValuePair<string, object>(key, value));
		}

		public void Add(KeyValuePair<string, object?> item)
		{
			if (item.Key == null)
			{
				throw new ArgumentNullException("item");
			}
			int num = FindIndex(item.Key);
			if (num >= 0)
			{
				throw new InvalidOperationException(System.SR.Format(System.SR.KeyAlreadyExist, item.Key));
			}
			_list.Add(item);
		}

		public void Clear()
		{
			_list.Clear();
		}

		public bool Contains(KeyValuePair<string, object?> item)
		{
			return _list.Contains(item);
		}

		public bool ContainsKey(string key)
		{
			return FindIndex(key) >= 0;
		}

		public void CopyTo(KeyValuePair<string, object?>[] array, int arrayIndex)
		{
			_list.CopyTo(array, arrayIndex);
		}

		IEnumerator<KeyValuePair<string, object>> IEnumerable<KeyValuePair<string, object>>.GetEnumerator()
		{
			return new Enumerator(_list);
		}

		public Enumerator GetEnumerator()
		{
			return new Enumerator(_list);
		}

		IEnumerator IEnumerable.GetEnumerator()
		{
			return new Enumerator(_list);
		}

		public bool Remove(string key)
		{
			if (key == null)
			{
				throw new ArgumentNullException("key");
			}
			int num = FindIndex(key);
			if (num >= 0)
			{
				_list.RemoveAt(num);
				return true;
			}
			return false;
		}

		public bool Remove(KeyValuePair<string, object?> item)
		{
			return _list.Remove(item);
		}

		public bool TryGetValue(string key, out object? value)
		{
			int num = FindIndex(key);
			if (num >= 0)
			{
				value = _list[num].Value;
				return true;
			}
			value = null;
			return false;
		}

		private int FindIndex(string key)
		{
			for (int i = 0; i < _list.Count; i++)
			{
				if (_list[i].Key == key)
				{
					return i;
				}
			}
			return -1;
		}
	}
	public readonly struct ActivityContext : IEquatable<ActivityContext>
	{
		public ActivityTraceId TraceId { get; }

		public ActivitySpanId SpanId { get; }

		public ActivityTraceFlags TraceFlags { get; }

		public string? TraceState { get; }

		public bool IsRemote { get; }

		public ActivityContext(ActivityTraceId traceId, ActivitySpanId spanId, ActivityTraceFlags traceFlags, string? traceState = null, bool isRemote = false)
		{
			TraceId = traceId;
			SpanId = spanId;
			TraceFlags = traceFlags;
			TraceState = traceState;
			IsRemote = isRemote;
		}

		public static bool TryParse(string? traceParent, string? traceState, bool isRemote, out ActivityContext context)
		{
			if (traceParent == null)
			{
				context = default(ActivityContext);
				return false;
			}
			return Activity.TryConvertIdToContext(traceParent, traceState, isRemote, out context);
		}

		public static bool TryParse(string? traceParent, string? traceState, out ActivityContext context)
		{
			return TryParse(traceParent, traceState, isRemote: false, out context);
		}

		public static ActivityContext Parse(string traceParent, string? traceState)
		{
			if (traceParent == null)
			{
				throw new ArgumentNullException("traceParent");
			}
			if (!Activity.TryConvertIdToContext(traceParent, traceState, isRemote: false, out var context))
			{
				throw new ArgumentException(System.SR.InvalidTraceParent);
			}
			return context;
		}

		public bool Equals(ActivityContext value)
		{
			if (SpanId.Equals(value.SpanId) && TraceId.Equals(value.TraceId) && TraceFlags == value.TraceFlags && TraceState == value.TraceState)
			{
				return IsRemote == value.IsRemote;
			}
			return false;
		}

		public override bool Equals([NotNullWhen(true)] object? obj)
		{
			if (!(obj is ActivityContext value))
			{
				return false;
			}
			return Equals(value);
		}

		public static bool operator ==(ActivityContext left, ActivityContext right)
		{
			return left.Equals(right);
		}

		public static bool operator !=(ActivityContext left, ActivityContext right)
		{
			return !(left == right);
		}

		public override int GetHashCode()
		{
			if (this == default(ActivityContext))
			{
				return 0;
			}
			int num = 5381;
			num = (num << 5) + num + TraceId.GetHashCode();
			num = (num << 5) + num + SpanId.GetHashCode();
			num = (int)((num << 5) + num + TraceFlags);
			return (num << 5) + num + ((TraceState != null) ? TraceState.GetHashCode() : 0);
		}
	}
	public readonly struct ActivityCreationOptions<T>
	{
		private readonly ActivityTagsCollection _samplerTags;

		private readonly ActivityContext _context;

		private readonly string _traceState;

		public ActivitySource Source { get; }

		public string Name { get; }

		public ActivityKind Kind { get; }

		public T Parent { get; }

		public IEnumerable<KeyValuePair<string, object?>>? Tags { get; }

		public IEnumerable<ActivityLink>? Links { get; }

		public ActivityTagsCollection SamplingTags
		{
			[SecuritySafeCritical]
			get
			{
				if (_samplerTags == null)
				{
					System.Runtime.CompilerServices.Unsafe.AsRef<ActivityTagsCollection>(ref _samplerTags) = new ActivityTagsCollection();
				}
				return _samplerTags;
			}
		}

		public ActivityTraceId TraceId
		{
			[SecuritySafeCritical]
			get
			{
				if (Parent is ActivityContext && IdFormat == ActivityIdFormat.W3C && _context == default(ActivityContext))
				{
					ActivityTraceId traceId = Activity.TraceIdGenerator?.Invoke() ?? ActivityTraceId.CreateRandom();
					System.Runtime.CompilerServices.Unsafe.AsRef<ActivityContext>(ref _context) = new ActivityContext(traceId, default(ActivitySpanId), ActivityTraceFlags.None);
				}
				return _context.TraceId;
			}
		}

		public string? TraceState
		{
			[SecuritySafeCritical]
			get
			{
				return _traceState;
			}
			[SecuritySafeCritical]
			init
			{
				_traceState = value;
			}
		}

		internal ActivityIdFormat IdFormat { get; }

		internal ActivityCreationOptions(ActivitySource source, string name, T parent, ActivityKind kind, IEnumerable<KeyValuePair<string, object>> tags, IEnumerable<ActivityLink> links, ActivityIdFormat idFormat)
		{
			Source = source;
			Name = name;
			Kind = kind;
			Parent = parent;
			Tags = tags;
			Links = links;
			IdFormat = idFormat;
			if (IdFormat == ActivityIdFormat.Unknown && Activity.ForceDefaultIdFormat)
			{
				IdFormat = Activity.DefaultIdFormat;
			}
			_samplerTags = null;
			_traceState = null;
			if (parent is ActivityContext)
			{
				object obj = parent;
				ActivityContext activityContext = (ActivityContext)((obj is ActivityContext) ? obj : null);
				if (activityContext != default(ActivityContext))
				{
					_context = activityContext;
					if (IdFormat == ActivityIdFormat.Unknown)
					{
						IdFormat = ActivityIdFormat.W3C;
					}
					_traceState = activityContext.TraceState;
					return;
				}
			}
			if ((object)parent is string text && text != null)
			{
				if (IdFormat != ActivityIdFormat.Hierarchical)
				{
					if (ActivityContext.TryParse(text, null, out _context))
					{
						IdFormat = ActivityIdFormat.W3C;
					}
					if (IdFormat == ActivityIdFormat.Unknown)
					{
						IdFormat = ActivityIdFormat.Hierarchical;
					}
				}
				else
				{
					_context = default(ActivityContext);
				}
			}
			else
			{
				_context = default(ActivityContext);
				if (IdFormat == ActivityIdFormat.Unknown)
				{
					IdFormat = ((Activity.Current != null) ? Activity.Current.IdFormat : Activity.DefaultIdFormat);
				}
			}
		}

		[SecuritySafeCritical]
		internal void SetTraceState(string traceState)
		{
			System.Runtime.CompilerServices.Unsafe.AsRef<string>(ref _traceState) = traceState;
		}

		internal ActivityTagsCollection GetSamplingTags()
		{
			return _samplerTags;
		}

		internal ActivityContext GetContext()
		{
			return _context;
		}
	}
	public enum ActivitySamplingResult
	{
		None,
		PropagationData,
		AllData,
		AllDataAndRecorded
	}
	public readonly struct ActivityEvent
	{
		private static readonly IEnumerable<KeyValuePair<string, object>> s_emptyTags = Array.Empty<KeyValuePair<string, object>>();

		private readonly Activity.TagsLinkedList _tags;

		public string Name { get; }

		public DateTimeOffset Timestamp { get; }

		public IEnumerable<KeyValuePair<string, object?>> Tags
		{
			get
			{
				IEnumerable<KeyValuePair<string, object>> tags = _tags;
				return tags ?? s_emptyTags;
			}
		}

		public ActivityEvent(string name)
			: this(name, DateTimeOffset.UtcNow)
		{
		}

		public ActivityEvent(string name, DateTimeOffset timestamp = default(DateTimeOffset), ActivityTagsCollection? tags = null)
		{
			Name = name ?? string.Empty;
			Timestamp = ((timestamp != default(DateTimeOffset)) ? timestamp : DateTimeOffset.UtcNow);
			_tags = ((tags != null && tags.Count > 0) ? new Activity.TagsLinkedList(tags) : null);
		}

		public Activity.Enumerator<KeyValuePair<string, object?>> EnumerateTagObjects()
		{
			return new Activity.Enumerator<KeyValuePair<string, object>>(_tags?.First);
		}
	}
	public enum ActivityKind
	{
		Internal,
		Server,
		Client,
		Producer,
		Consumer
	}
	public readonly struct ActivityLink : IEquatable<ActivityLink>
	{
		private readonly Activity.TagsLinkedList _tags;

		public ActivityContext Context { get; }

		public IEnumerable<KeyValuePair<string, object?>>? Tags => _tags;

		public ActivityLink(ActivityContext context, ActivityTagsCollection? tags = null)
		{
			Context = context;
			_tags = ((tags != null && tags.Count > 0) ? new Activity.TagsLinkedList(tags) : null);
		}

		public override bool Equals([NotNullWhen(true)] object? obj)
		{
			if (obj is ActivityLink value)
			{
				return Equals(value);
			}
			return false;
		}

		public bool Equals(ActivityLink value)
		{
			if (Context == value.Context)
			{
				return value.Tags == Tags;
			}
			return false;
		}

		public static bool operator ==(ActivityLink left, ActivityLink right)
		{
			return left.Equals(right);
		}

		public static bool operator !=(ActivityLink left, ActivityLink right)
		{
			return !left.Equals(right);
		}

		public Activity.Enumerator<KeyValuePair<string, object?>> EnumerateTagObjects()
		{
			return new Activity.Enumerator<KeyValuePair<string, object>>(_tags?.First);
		}

		public override int GetHashCode()
		{
			if (this == default(ActivityLink))
			{
				return 0;
			}
			int num = 5381;
			num = (num << 5) + num + Context.GetHashCode();
			if (Tags != null)
			{
				foreach (KeyValuePair<string, object> tag in Tags)
				{
					num = (num << 5) + num + tag.Key.GetHashCode();
					if (tag.Value != null)
					{
						num = (num << 5) + num + tag.Value.GetHashCode();
					}
				}
			}
			return num;
		}
	}
	public delegate ActivitySamplingResult SampleActivity<T>(ref ActivityCreationOptions<T> options);
	public sealed class ActivityListener : IDisposable
	{
		public Action<Activity>? ActivityStarted { get; set; }

		public Action<Activity>? ActivityStopped { get; set; }

		public Func<ActivitySource, bool>? ShouldListenTo { get; set; }

		public SampleActivity<string>? SampleUsingParentId { get; set; }

		public SampleActivity<ActivityContext>? Sample { get; set; }

		public void Dispose()
		{
			ActivitySource.DetachListener(this);
		}
	}
	public sealed class ActivitySource : IDisposable
	{
		internal delegate void Function<T, TParent>(T item, ref ActivityCreationOptions<TParent> data, ref ActivitySamplingResult samplingResult, ref ActivityCreationOptions<ActivityContext> dataWithContext);

		private static readonly SynchronizedList<ActivitySource> s_activeSources = new SynchronizedList<ActivitySource>();

		private static readonly SynchronizedList<ActivityListener> s_allListeners = new SynchronizedList<ActivityListener>();

		private SynchronizedList<ActivityListener> _listeners;

		public string Name { get; }

		public string? Version { get; }

		public ActivitySource(string name, string? version = "")
		{
			Name = name ?? throw new ArgumentNullException("name");
			Version = version;
			s_activeSources.Add(this);
			if (s_allListeners.Count > 0)
			{
				s_allListeners.EnumWithAction(delegate(ActivityListener listener, object source)
				{
					Func<ActivitySource, bool> shouldListenTo = listener.ShouldListenTo;
					if (shouldListenTo != null)
					{
						ActivitySource activitySource = (ActivitySource)source;
						if (shouldListenTo(activitySource))
						{
							activitySource.AddListener(listener);
						}
					}
				}, this);
			}
			GC.KeepAlive(DiagnosticSourceEventSource.Log);
		}

		public bool HasListeners()
		{
			SynchronizedList<ActivityListener> listeners = _listeners;
			if (listeners != null)
			{
				return listeners.Count > 0;
			}
			return false;
		}

		public Activity? CreateActivity(string name, ActivityKind kind)
		{
			return CreateActivity(name, kind, default(ActivityContext), null, null, null, default(DateTimeOffset), startIt: false);
		}

		public Activity? CreateActivity(string name, ActivityKind kind, ActivityContext parentContext, IEnumerable<KeyValuePair<string, object?>>? tags = null, IEnumerable<ActivityLink>? links = null, ActivityIdFormat idFormat = ActivityIdFormat.Unknown)
		{
			return CreateActivity(name, kind, parentContext, null, tags, links, default(DateTimeOffset), startIt: false, idFormat);
		}

		public Activity? CreateActivity(string name, ActivityKind kind, string? parentId, IEnumerable<KeyValuePair<string, object?>>? tags = null, IEnumerable<ActivityLink>? links = null, ActivityIdFormat idFormat = ActivityIdFormat.Unknown)
		{
			return CreateActivity(name, kind, default(ActivityContext), parentId, tags, links, default(DateTimeOffset), startIt: false, idFormat);
		}

		public Activity? StartActivity([CallerMemberName] string name = "", ActivityKind kind = ActivityKind.Internal)
		{
			return CreateActivity(name, kind, default(ActivityContext), null, null, null, default(DateTimeOffset));
		}

		public Activity? StartActivity(string name, ActivityKind kind, ActivityContext parentContext, IEnumerable<KeyValuePair<string, object?>>? tags = null, IEnumerable<ActivityLink>? links = null, DateTimeOffset startTime = default(DateTimeOffset))
		{
			return CreateActivity(name, kind, parentContext, null, tags, links, startTime);
		}

		public Activity? StartActivity(string name, ActivityKind kind, string? parentId, IEnumerable<KeyValuePair<string, object?>>? tags = null, IEnumerable<ActivityLink>? links = null, DateTimeOffset startTime = default(DateTimeOffset))
		{
			return CreateActivity(name, kind, default(ActivityContext), parentId, tags, links, startTime);
		}

		public Activity? StartActivity(ActivityKind kind, ActivityContext parentContext = default(ActivityContext), IEnumerable<KeyValuePair<string, object?>>? tags = null, IEnumerable<ActivityLink>? links = null, DateTimeOffset startTime = default(DateTimeOffset), [CallerMemberName] string name = "")
		{
			return CreateActivity(name, kind, parentContext, null, tags, links, startTime);
		}

		private Activity CreateActivity(string name, ActivityKind kind, ActivityContext context, string parentId, IEnumerable<KeyValuePair<string, object>> tags, IEnumerable<ActivityLink> links, DateTimeOffset startTime, bool startIt = true, ActivityIdFormat idFormat = ActivityIdFormat.Unknown)
		{
			SynchronizedList<ActivityListener> listeners = _listeners;
			if (listeners == null || listeners.Count == 0)
			{
				return null;
			}
			Activity result2 = null;
			ActivitySamplingResult samplingResult = ActivitySamplingResult.None;
			ActivityTagsCollection activityTagsCollection;
			string traceState;
			if (parentId != null)
			{
				ActivityCreationOptions<string> activityCreationOptions = default(ActivityCreationOptions<string>);
				ActivityCreationOptions<ActivityContext> dataWithContext2 = default(ActivityCreationOptions<ActivityContext>);
				activityCreationOptions = new ActivityCreationOptions<string>(this, name, parentId, kind, tags, links, idFormat);
				if (activityCreationOptions.IdFormat == ActivityIdFormat.W3C)
				{
					dataWithContext2 = new ActivityCreationOptions<ActivityContext>(this, name, activityCreationOptions.GetContext(), kind, tags, links, ActivityIdFormat.W3C);
				}
				listeners.EnumWithFunc(delegate(ActivityListener listener, ref ActivityCreationOptions<string> data, ref ActivitySamplingResult result, ref ActivityCreationOptions<ActivityContext> dataWithContext)
				{
					SampleActivity<string> sampleUsingParentId = listener.SampleUsingParentId;
					if (sampleUsingParentId != null)
					{
						ActivitySamplingResult activitySamplingResult2 = sampleUsingParentId(ref data);
						dataWithContext.SetTraceState(data.TraceState);
						if (activitySamplingResult2 > result)
						{
							result = activitySamplingResult2;
						}
					}
					else if (data.IdFormat == ActivityIdFormat.W3C)
					{
						SampleActivity<ActivityContext> sample2 = listener.Sample;
						if (sample2 != null)
						{
							ActivitySamplingResult activitySamplingResult3 = sample2(ref dataWithContext);
							data.SetTraceState(dataWithContext.TraceState);
							if (activitySamplingResult3 > result)
							{
								result = activitySamplingResult3;
							}
						}
					}
				}, ref activityCreationOptions, ref samplingResult, ref dataWithContext2);
				if (context == default(ActivityContext))
				{
					if (activityCreationOptions.GetContext() != default(ActivityContext))
					{
						context = activityCreationOptions.GetContext();
						parentId = null;
					}
					else if (dataWithContext2.GetContext() != default(ActivityContext))
					{
						context = dataWithContext2.GetContext();
						parentId = null;
					}
				}
				activityTagsCollection = activityCreationOptions.GetSamplingTags();
				ActivityTagsCollection samplingTags = dataWithContext2.GetSamplingTags();
				if (samplingTags != null)
				{
					if (activityTagsCollection == null)
					{
						activityTagsCollection = samplingTags;
					}
					else
					{
						foreach (KeyValuePair<string, object?> item in samplingTags)
						{
							activityTagsCollection.Add(item);
						}
					}
				}
				idFormat = activityCreationOptions.IdFormat;
				traceState = activityCreationOptions.TraceState;
			}
			else
			{
				bool flag = context == default(ActivityContext) && Activity.Current != null;
				ActivityCreationOptions<ActivityContext> data2 = new ActivityCreationOptions<ActivityContext>(this, name, flag ? Activity.Current.Context : context, kind, tags, links, idFormat);
				listeners.EnumWithFunc(delegate(ActivityListener listener, ref ActivityCreationOptions<ActivityContext> data, ref ActivitySamplingResult result, ref ActivityCreationOptions<ActivityContext> unused)
				{
					SampleActivity<ActivityContext> sample = listener.Sample;
					if (sample != null)
					{
						ActivitySamplingResult activitySamplingResult = sample(ref data);
						if (activitySamplingResult > result)
						{
							result = activitySamplingResult;
						}
					}
				}, ref data2, ref samplingResult, ref data2);
				if (!flag)
				{
					context = data2.GetContext();
				}
				activityTagsCollection = data2.GetSamplingTags();
				idFormat = data2.IdFormat;
				traceState = data2.TraceState;
			}
			if (samplingResult != 0)
			{
				result2 = Activity.Create(this, name, kind, parentId, context, tags, links, startTime, activityTagsCollection, samplingResult, startIt, idFormat, traceState);
			}
			return result2;
		}

		public void Dispose()
		{
			_listeners = null;
			s_activeSources.Remove(this);
		}

		public static void AddActivityListener(ActivityListener listener)
		{
			if (listener == null)
			{
				throw new ArgumentNullException("listener");
			}
			if (!s_allListeners.AddIfNotExist(listener))
			{
				return;
			}
			s_activeSources.EnumWithAction(delegate(ActivitySource source, object obj)
			{
				Func<ActivitySource, bool> shouldListenTo = ((ActivityListener)obj).ShouldListenTo;
				if (shouldListenTo != null && shouldListenTo(source))
				{
					source.AddListener((ActivityListener)obj);
				}
			}, listener);
		}

		internal void AddListener(ActivityListener listener)
		{
			if (_listeners == null)
			{
				Interlocked.CompareExchange(ref _listeners, new SynchronizedList<ActivityListener>(), null);
			}
			_listeners.AddIfNotExist(listener);
		}

		internal static void DetachListener(ActivityListener listener)
		{
			s_allListeners.Remove(listener);
			s_activeSources.EnumWithAction(delegate(ActivitySource source, object obj)
			{
				source._listeners?.Remove((ActivityListener)obj);
			}, listener);
		}

		internal void NotifyActivityStart(Activity activity)
		{
			SynchronizedList<ActivityListener> listeners = _listeners;
			if (listeners != null && listeners.Count > 0)
			{
				listeners.EnumWithAction(delegate(ActivityListener listener, object obj)
				{
					listener.ActivityStarted?.Invoke((Activity)obj);
				}, activity);
			}
		}

		internal void NotifyActivityStop(Activity activity)
		{
			SynchronizedList<ActivityListener> listeners = _listeners;
			if (listeners != null && listeners.Count > 0)
			{
				listeners.EnumWithAction(delegate(ActivityListener listener, object obj)
				{
					listener.ActivityStopped?.Invoke((Activity)obj);
				}, activity);
			}
		}
	}
	internal sealed class SynchronizedList<T>
	{
		private readonly List<T> _list;

		private uint _version;

		public int Count => _list.Count;

		public SynchronizedList()
		{
			_list = new List<T>();
		}

		public void Add(T item)
		{
			lock (_list)
			{
				_list.Add(item);
				_version++;
			}
		}

		public bool AddIfNotExist(T item)
		{
			lock (_list)
			{
				if (!_list.Contains(item))
				{
					_list.Add(item);
					_version++;
					return true;
				}
				return false;
			}
		}

		public bool Remove(T item)
		{
			lock (_list)
			{
				if (_list.Remove(item))
				{
					_version++;
					return true;
				}
				return false;
			}
		}

		public void EnumWithFunc<TParent>(ActivitySource.Function<T, TParent> func, ref ActivityCreationOptions<TParent> data, ref ActivitySamplingResult samplingResult, ref ActivityCreationOptions<ActivityContext> dataWithContext)
		{
			uint version = _version;
			int num = 0;
			while (num < _list.Count)
			{
				T item;
				lock (_list)
				{
					if (version != _version)
					{
						version = _version;
						num = 0;
						continue;
					}
					item = _list[num];
					num++;
					goto IL_004f;
				}
				IL_004f:
				func(item, ref data, ref samplingResult, ref dataWithContext);
			}
		}

		public void EnumWithAction(Action<T, object> action, object arg)
		{
			uint version = _version;
			int num = 0;
			while (num < _list.Count)
			{
				T arg2;
				lock (_list)
				{
					if (version != _version)
					{
						version = _version;
						num = 0;
						continue;
					}
					arg2 = _list[num];
					num++;
					goto IL_004f;
				}
				IL_004f:
				action(arg2, arg);
			}
		}
	}
	public abstract class DiagnosticSource
	{
		internal const string WriteRequiresUnreferencedCode = "The type of object being written to DiagnosticSource cannot be discovered statically.";

		[RequiresUnreferencedCode("The type of object being written to DiagnosticSource cannot be discovered statically.")]
		public abstract void Write(string name, object? value);

		public abstract bool IsEnabled(string name);

		public virtual bool IsEnabled(string name, object? arg1, object? arg2 = null)
		{
			return IsEnabled(name);
		}

		[RequiresUnreferencedCode("The type of object being written to DiagnosticSource cannot be discovered statically.")]
		public Activity StartActivity(Activity activity, object? args)
		{
			activity.Start();
			Write(activity.OperationName + ".Start", args);
			return activity;
		}

		[RequiresUnreferencedCode("The type of object being written to DiagnosticSource cannot be discovered statically.")]
		public void StopActivity(Activity activity, object? args)
		{
			if (activity.Duration == TimeSpan.Zero)
			{
				activity.SetEndTime(Activity.GetUtcNow());
			}
			Write(activity.OperationName + ".Stop", args);
			activity.Stop();
		}

		public virtual void OnActivityImport(Activity activity, object? payload)
		{
		}

		public virtual void OnActivityExport(Activity activity, object? payload)
		{
		}
	}
	public class DiagnosticListener : DiagnosticSource, IObservable<KeyValuePair<string, object?>>, IDisposable
	{
		private sealed class DiagnosticSubscription : IDisposable
		{
			internal IObserver<KeyValuePair<string, object>> Observer;

			internal Predicate<string> IsEnabled1Arg;

			internal Func<string, object, object, bool> IsEnabled3Arg;

			internal Action<Activity, object> OnActivityImport;

			internal Action<Activity, object> OnActivityExport;

			internal DiagnosticListener Owner;

			internal DiagnosticSubscription Next;

			public void Dispose()
			{
				DiagnosticSubscription subscriptions;
				DiagnosticSubscription value;
				do
				{
					subscriptions = Owner._subscriptions;
					value = Remove(subscriptions, this);
				}
				while (Interlocked.CompareExchange(ref Owner._subscriptions, value, subscriptions) != subscriptions);
			}

			private static DiagnosticSubscription Remove(DiagnosticSubscription subscriptions, DiagnosticSubscription subscription)
			{
				if (subscriptions == null)
				{
					return null;
				}
				if (subscriptions.Observer == subscription.Observer && subscriptions.IsEnabled1Arg == subscription.IsEnabled1Arg && subscriptions.IsEnabled3Arg == subscription.IsEnabled3Arg)
				{
					return subscriptions.Next;
				}
				return new DiagnosticSubscription
				{
					Observer = subscriptions.Observer,
					Owner = subscriptions.Owner,
					IsEnabled1Arg = subscriptions.IsEnabled1Arg,
					IsEnabled3Arg = subscriptions.IsEnabled3Arg,
					Next = Remove(subscriptions.Next, subscription)
				};
			}
		}

		private sealed class AllListenerObservable : IObservable<DiagnosticListener>
		{
			internal sealed class AllListenerSubscription : IDisposable
			{
				private readonly AllListenerObservable _owner;

				internal readonly IObserver<DiagnosticListener> Subscriber;

				internal AllListenerSubscription Next;

				internal AllListenerSubscription(AllListenerObservable owner, IObserver<DiagnosticListener> subscriber, AllListenerSubscription next)
				{
					_owner = owner;
					Subscriber = subscriber;
					Next = next;
				}

				public void Dispose()
				{
					if (_owner.Remove(this))
					{
						Subscriber.OnCompleted();
					}
				}
			}

			private AllListenerSubscription _subscriptions;

			public IDisposable Subscribe(IObserver<DiagnosticListener> observer)
			{
				lock (s_allListenersLock)
				{
					for (DiagnosticListener diagnosticListener = s_allListeners; diagnosticListener != null; diagnosticListener = diagnosticListener._next)
					{
						observer.OnNext(diagnosticListener);
					}
					_subscriptions = new AllListenerSubscription(this, observer, _subscriptions);
					return _subscriptions;
				}
			}

			internal void OnNewDiagnosticListener(DiagnosticListener diagnosticListener)
			{
				for (AllListenerSubscription allListenerSubscription = _subscriptions; allListenerSubscription != null; allListenerSubscription = allListenerSubscription.Next)
				{
					allListenerSubscription.Subscriber.OnNext(diagnosticListener);
				}
			}

			private bool Remove(AllListenerSubscription subscription)
			{
				lock (s_allListenersLock)
				{
					if (_subscriptions == subscription)
					{
						_subscriptions = subscription.Next;
						return true;
					}
					if (_subscriptions != null)
					{
						AllListenerSubscription allListenerSubscription = _subscriptions;
						while (allListenerSubscription.Next != null)
						{
							if (allListenerSubscription.Next == subscription)
							{
								allListenerSubscription.Next = allListenerSubscription.Next.Next;
								return true;
							}
							allListenerSubscription = allListenerSubscription.Next;
						}
					}
					return false;
				}
			}
		}

		private volatile DiagnosticSubscription _subscriptions;

		private DiagnosticListener _next;

		private bool _disposed;

		private static DiagnosticListener s_allListeners;

		private static volatile AllListenerObservable s_allListenerObservable;

		private static readonly object s_allListenersLock = new object();

		public static IObservable<DiagnosticListener> AllListeners
		{
			get
			{
				GC.KeepAlive(HttpHandlerDiagnosticListener.s_instance);
				return s_allListenerObservable ?? Interlocked.CompareExchange(ref s_allListenerObservable, new AllListenerObservable(), null) ?? s_allListenerObservable;
			}
		}

		public string Name { get; private set; }

		public override void OnActivityImport(Activity activity, object? payload)
		{
			for (DiagnosticSubscription diagnosticSubscription = _subscriptions; diagnosticSubscription != null; diagnosticSubscription = diagnosticSubscription.Next)
			{
				diagnosticSubscription.OnActivityImport?.Invoke(activity, payload);
			}
		}

		public override void OnActivityExport(Activity activity, object? payload)
		{
			for (DiagnosticSubscription diagnosticSubscription = _subscriptions; diagnosticSubscription != null; diagnosticSubscription = diagnosticSubscription.Next)
			{
				diagnosticSubscription.OnActivityExport?.Invoke(activity, payload);
			}
		}

		public virtual IDisposable Subscribe(IObserver<KeyValuePair<string, object?>> observer, Func<string, object?, object?, bool>? isEnabled, Action<Activity, object?>? onActivityImport = null, Action<Activity, object?>? onActivityExport = null)
		{
			if (isEnabled != null)
			{
				return SubscribeInternal(observer, (string name) => IsEnabled(name, null), isEnabled, onActivityImport, onActivityExport);
			}
			return SubscribeInternal(observer, null, null, onActivityImport, onActivityExport);
		}

		public virtual IDisposable Subscribe(IObserver<KeyValuePair<string, object?>> observer, Predicate<string>? isEnabled)
		{
			if (isEnabled == null)
			{
				return SubscribeInternal(observer, null, null, null, null);
			}
			Predicate<string> localIsEnabled = isEnabled;
			return SubscribeInternal(observer, isEnabled, (string name, object arg1, object arg2) => localIsEnabled(name), null, null);
		}

		public virtual IDisposable Subscribe(IObserver<KeyValuePair<string, object?>> observer, Func<string, object?, object?, bool>? isEnabled)
		{
			if (isEnabled != null)
			{
				return SubscribeInternal(observer, (string name) => IsEnabled(name, null), isEnabled, null, null);
			}
			return SubscribeInternal(observer, null, null, null, null);
		}

		public virtual IDisposable Subscribe(IObserver<KeyValuePair<string, object?>> observer)
		{
			return SubscribeInternal(observer, null, null, null, null);
		}

		public DiagnosticListener(string name)
		{
			Name = name;
			lock (s_allListenersLock)
			{
				s_allListenerObservable?.OnNewDiagnosticListener(this);
				_next = s_allListeners;
				s_allListeners = this;
			}
			GC.KeepAlive(DiagnosticSourceEventSource.Log);
		}

		public virtual void Dispose()
		{
			lock (s_allListenersLock)
			{
				if (_disposed)
				{
					return;
				}
				_disposed = true;
				if (s_allListeners == this)
				{
					s_allListeners = s_allListeners._next;
				}
				else
				{
					for (DiagnosticListener next = s_allListeners; next != null; next = next._next)
					{
						if (next._next == this)
						{
							next._next = _next;
							break;
						}
					}
				}
				_next = null;
			}
			DiagnosticSubscription location = null;
			Interlocked.Exchange(ref location, _subscriptions);
			while (location != null)
			{
				location.Observer.OnCompleted();
				location = location.Next;
			}
		}

		public override string ToString()
		{
			return Name ?? string.Empty;
		}

		public bool IsEnabled()
		{
			return _subscriptions != null;
		}

		public override bool IsEnabled(string name)
		{
			for (DiagnosticSubscription diagnosticSubscription = _subscriptions; diagnosticSubscription != null; diagnosticSubscription = diagnosticSubscription.Next)
			{
				if (diagnosticSubscription.IsEnabled1Arg == null || diagnosticSubscription.IsEnabled1Arg(name))
				{
					return true;
				}
			}
			return false;
		}

		public override bool IsEnabled(string name, object? arg1, object? arg2 = null)
		{
			for (DiagnosticSubscription diagnosticSubscription = _subscriptions; diagnosticSubscription != null; diagnosticSubscription = diagnosticSubscription.Next)
			{
				if (diagnosticSubscription.IsEnabled3Arg == null || diagnosticSubscription.IsEnabled3Arg(name, arg1, arg2))
				{
					return true;
				}
			}
			return false;
		}

		[RequiresUnreferencedCode("The type of object being written to DiagnosticSource cannot be discovered statically.")]
		public override void Write(string name, object? value)
		{
			for (DiagnosticSubscription diagnosticSubscription = _subscriptions; diagnosticSubscription != null; diagnosticSubscription = diagnosticSubscription.Next)
			{
				diagnosticSubscription.Observer.OnNext(new KeyValuePair<string, object>(name, value));
			}
		}

		private IDisposable SubscribeInternal(IObserver<KeyValuePair<string, object>> observer, Predicate<string> isEnabled1Arg, Func<string, object, object, bool> isEnabled3Arg, Action<Activity, object> onActivityImport, Action<Activity, object> onActivityExport)
		{
			if (_disposed)
			{
				return new DiagnosticSubscription
				{
					Owner = this
				};
			}
			DiagnosticSubscription diagnosticSubscription = new DiagnosticSubscription
			{
				Observer = observer,
				IsEnabled1Arg = isEnabled1Arg,
				IsEnabled3Arg = isEnabled3Arg,
				OnActivityImport = onActivityImport,
				OnActivityExport = onActivityExport,
				Owner = this,
				Next = _subscriptions
			};
			while (Interlocked.CompareExchange(ref _subscriptions, diagnosticSubscription, diagnosticSubscription.Next) != diagnosticSubscription.Next)
			{
				diagnosticSubscription.Next = _subscriptions;
			}
			return diagnosticSubscription;
		}
	}
	[EventSource(Name = "Microsoft-Diagnostics-DiagnosticSource")]
	[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2113:ReflectionToRequiresUnreferencedCode", Justification = "In EventSource, EnsureDescriptorsInitialized's use of GetType preserves methods on Delegate and MulticastDelegate because the nested type OverrideEventProvider's base type EventProvider defines a delegate. This includes Delegate and MulticastDelegate methods which require unreferenced code, but EnsureDescriptorsInitialized does not access these members and is safe to call.")]
	[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2115:ReflectionToDynamicallyAccessedMembers", Justification = "In EventSource, EnsureDescriptorsInitialized's use of GetType preserves methods on Delegate and MulticastDelegate because the nested type OverrideEventProvider's base type EventProvider defines a delegate. This includes Delegate and MulticastDelegate methods which have dynamically accessed members requirements, but EnsureDescriptorsInitialized does not access these members and is safe to call.")]
	internal sealed class DiagnosticSourceEventSource : EventSource
	{
		public static class Keywords
		{
			public const EventKeywords Messages = (EventKeywords)1L;

			public const EventKeywords Events = (EventKeywords)2L;

			public const EventKeywords IgnoreShortCutKeywords = (EventKeywords)2048L;

			public const EventKeywords AspNetCoreHosting = (EventKeywords)4096L;

			public const EventKeywords EntityFrameworkCoreCommands = (EventKeywords)8192L;
		}

		[Flags]
		internal enum ActivityEvents
		{
			None = 0,
			ActivityStart = 1,
			ActivityStop = 2,
			All = 3
		}

		internal sealed class FilterAndTransform
		{
			public FilterAndTransform Next;

			internal const string c_ActivitySourcePrefix = "[AS]";

			private IDisposable _diagnosticsListenersSubscription;

			private Subscriptions _liveSubscriptions;

			private readonly bool _noImplicitTransforms;

			private ImplicitTransformEntry _firstImplicitTransformsEntry;

			private ConcurrentDictionary<Type, TransformSpec> _implicitTransformsTable;

			private readonly TransformSpec _explicitTransforms;

			private readonly DiagnosticSourceEventSource _eventSource;

			internal string SourceName { get; set; }

			internal string ActivityName { get; set; }

			internal ActivityEvents Events { get; set; }

			internal ActivitySamplingResult SamplingResult { get; set; }

			public static void CreateFilterAndTransformList(ref FilterAndTransform specList, string filterAndPayloadSpecs, DiagnosticSourceEventSource eventSource)
			{
				DestroyFilterAndTransformList(ref specList, eventSource);
				if (filterAndPayloadSpecs == null)
				{
					filterAndPayloadSpecs = "";
				}
				int num = filterAndPayloadSpecs.Length;
				while (true)
				{
					if (0 < num && char.IsWhiteSpace(filterAndPayloadSpecs[num - 1]))
					{
						num--;
						continue;
					}
					int num2 = filterAndPayloadSpecs.LastIndexOf('\n', num - 1, num);
					int i = 0;
					if (0 <= num2)
					{
						i = num2 + 1;
					}
					for (; i < num && char.IsWhiteSpace(filterAndPayloadSpecs[i]); i++)
					{
					}
					if (IsActivitySourceEntry(filterAndPayloadSpecs, i, num))
					{
						AddNewActivitySourceTransform(filterAndPayloadSpecs, i, num, eventSource);
					}
					else
					{
						specList = new FilterAndTransform(filterAndPayloadSpecs, i, num, eventSource, specList);
					}
					num = num2;
					if (num < 0)
					{
						break;
					}
				}
				if (eventSource._activitySourceSpecs != null)
				{
					NormalizeActivitySourceSpecsList(eventSource);
					CreateActivityListener(eventSource);
				}
			}

			public static void DestroyFilterAndTransformList(ref FilterAndTransform specList, DiagnosticSourceEventSource eventSource)
			{
				eventSource._activityListener?.Dispose();
				eventSource._activityListener = null;
				eventSource._activitySourceSpecs = null;
				FilterAndTransform filterAndTransform = specList;
				specList = null;
				while (filterAndTransform != null)
				{
					filterAndTransform.Dispose();
					filterAndTransform = filterAndTransform.Next;
				}
			}

			public FilterAndTransform(string filterAndPayloadSpec, int startIdx, int endIdx, DiagnosticSourceEventSource eventSource, FilterAndTransform next)
			{
				FilterAndTransform filterAndTransform = this;
				Next = next;
				_eventSource = eventSource;
				string listenerNameFilter = null;
				string eventNameFilter = null;
				string text = null;
				int num = startIdx;
				int num2 = endIdx;
				int num3 = filterAndPayloadSpec.IndexOf(':', startIdx, endIdx - startIdx);
				if (0 <= num3)
				{
					num2 = num3;
					num = num3 + 1;
				}
				int num4 = filterAndPayloadSpec.IndexOf('/', startIdx, num2 - startIdx);
				if (0 <= num4)
				{
					listenerNameFilter = filterAndPayloadSpec.Substring(startIdx, num4 - startIdx);
					int num5 = filterAndPayloadSpec.IndexOf('@', num4 + 1, num2 - num4 - 1);
					if (0 <= num5)
					{
						text = filterAndPayloadSpec.Substring(num5 + 1, num2 - num5 - 1);
						eventNameFilter = filterAndPayloadSpec.Substring(num4 + 1, num5 - num4 - 1);
					}
					else
					{
						eventNameFilter = filterAndPayloadSpec.Substring(num4 + 1, num2 - num4 - 1);
					}
				}
				else if (startIdx < num2)
				{
					listenerNameFilter = filterAndPayloadSpec.Substring(startIdx, num2 - startIdx);
				}
				_eventSource.Message("DiagnosticSource: Enabling '" + (listenerNameFilter ?? "*") + "/" + (eventNameFilter ?? "*") + "'");
				if (num < endIdx && filterAndPayloadSpec[num] == '-')
				{
					_eventSource.Message("DiagnosticSource: suppressing implicit transforms.");
					_noImplicitTransforms = true;
					num++;
				}
				if (num < endIdx)
				{
					while (true)
					{
						int num6 = num;
						int num7 = filterAndPayloadSpec.LastIndexOf(';', endIdx - 1, endIdx - num);
						if (0 <= num7)
						{
							num6 = num7 + 1;
						}
						if (num6 < endIdx)
						{
							if (_eventSource.IsEnabled(EventLevel.Informational, (EventKeywords)1L))
							{
								_eventSource.Message("DiagnosticSource: Parsing Explicit Transform '" + filterAndPayloadSpec.Substring(num6, endIdx - num6) + "'");
							}
							_explicitTransforms = new TransformSpec(filterAndPayloadSpec, num6, endIdx, _explicitTransforms);
						}
						if (num == num6)
						{
							break;
						}
						endIdx = num7;
					}
				}
				Action<string, string, IEnumerable<KeyValuePair<string, string>>> writeEvent = null;
				if (text != null && text.Contains("Activity"))
				{
					writeEvent = text switch
					{
						"Activity1Start" => _eventSource.Activity1Start, 
						"Activity1Stop" => _eventSource.Activity1Stop, 
						"Activity2Start" => _eventSource.Activity2Start, 
						"Activity2Stop" => _eventSource.Activity2Stop, 
						"RecursiveActivity1Start" => _eventSource.RecursiveActivity1Start, 
						"RecursiveActivity1Stop" => _eventSource.RecursiveActivity1Stop, 
						_ => null, 
					};
					if (writeEvent == null)
					{
						_eventSource.Message("DiagnosticSource: Could not find Event to log Activity " + text);
					}
				}
				if (writeEvent == null)
				{
					writeEvent = _eventSource.Event;
				}
				_diagnosticsListenersSubscription = DiagnosticListener.AllListeners.Subscribe(new CallbackObserver<DiagnosticListener>(delegate(DiagnosticListener newListener)
				{
					if (listenerNameFilter == null || listenerNameFilter == newListener.Name)
					{
						filterAndTransform._eventSource.NewDiagnosticListener(newListener.Name);
						Predicate<string> isEnabled = null;
						if (eventNameFilter != null)
						{
							isEnabled = (string eventName) => eventNameFilter == eventName;
						}
						IDisposable subscription = newListener.Subscribe(new CallbackObserver<KeyValuePair<string, object>>(OnEventWritten), isEnabled);
						filterAndTransform._liveSubscriptions = new Subscriptions(subscription, filterAndTransform._liveSubscriptions);
					}
					[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode", Justification = "DiagnosticSource.Write is marked with RequiresUnreferencedCode.")]
					[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2119", Justification = "DAM on EventSource references this compiler-generated local function which calls a method that requires unreferenced code. EventSource will not access this local function.")]
					void OnEventWritten(KeyValuePair<string, object> evnt)
					{
						if (eventNameFilter == null || !(eventNameFilter != evnt.Key))
						{
							List<KeyValuePair<string, string>> arg = filterAndTransform.Morph(evnt.Value);
							string key = evnt.Key;
							writeEvent(newListener.Name, key, arg);
						}
					}
				}));
			}

			internal FilterAndTransform(string filterAndPayloadSpec, int endIdx, int colonIdx, string activitySourceName, string activityName, ActivityEvents events, ActivitySamplingResult sampli

BepInEx/plugins/SlopCrew.Plugin/System.Memory.dll

Decompiled 8 months ago
using System;
using System.Buffers;
using System.Buffers.Binary;
using System.Buffers.Text;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.Numerics;
using System.Numerics.Hashing;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security;
using System.Security.Permissions;
using System.Text;
using FxResources.System.Memory;
using Microsoft.CodeAnalysis;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: AssemblyTitle("System.Memory")]
[assembly: AssemblyDescription("System.Memory")]
[assembly: AssemblyDefaultAlias("System.Memory")]
[assembly: AssemblyCompany("Microsoft Corporation")]
[assembly: AssemblyProduct("Microsoft® .NET Framework")]
[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")]
[assembly: AssemblyFileVersion("4.6.31308.01")]
[assembly: AssemblyInformationalVersion("4.6.31308.01 @BuiltBy: cloudtest-841353dfc000000 @Branch: release/2.1-MSRC @SrcCode: https://github.com/dotnet/corefx/tree/32b491939fbd125f304031c35038b1e14b4e3958")]
[assembly: CLSCompliant(true)]
[assembly: AssemblyMetadata(".NETFrameworkAssembly", "")]
[assembly: AssemblyMetadata("Serviceable", "True")]
[assembly: AssemblyMetadata("PreferInbox", "True")]
[assembly: DefaultDllImportSearchPaths(DllImportSearchPath.System32 | DllImportSearchPath.AssemblyDirectory)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("4.0.1.2")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class IsReadOnlyAttribute : Attribute
	{
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class IsByRefLikeAttribute : Attribute
	{
	}
}
namespace FxResources.System.Memory
{
	internal static class SR
	{
	}
}
namespace System
{
	public readonly struct SequencePosition : IEquatable<SequencePosition>
	{
		private readonly object _object;

		private readonly int _integer;

		public SequencePosition(object @object, int integer)
		{
			_object = @object;
			_integer = integer;
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public object GetObject()
		{
			return _object;
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public int GetInteger()
		{
			return _integer;
		}

		public bool Equals(SequencePosition other)
		{
			if (_integer == other._integer)
			{
				return object.Equals(_object, other._object);
			}
			return false;
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public override bool Equals(object obj)
		{
			if (obj is SequencePosition other)
			{
				return Equals(other);
			}
			return false;
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public override int GetHashCode()
		{
			return HashHelpers.Combine(_object?.GetHashCode() ?? 0, _integer);
		}
	}
	internal static class ThrowHelper
	{
		internal static void ThrowArgumentNullException(System.ExceptionArgument argument)
		{
			throw CreateArgumentNullException(argument);
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		private static Exception CreateArgumentNullException(System.ExceptionArgument argument)
		{
			return new ArgumentNullException(argument.ToString());
		}

		internal static void ThrowArrayTypeMismatchException()
		{
			throw CreateArrayTypeMismatchException();
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		private static Exception CreateArrayTypeMismatchException()
		{
			return new ArrayTypeMismatchException();
		}

		internal static void ThrowArgumentException_InvalidTypeWithPointersNotSupported(Type type)
		{
			throw CreateArgumentException_InvalidTypeWithPointersNotSupported(type);
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		private static Exception CreateArgumentException_InvalidTypeWithPointersNotSupported(Type type)
		{
			return new ArgumentException(System.SR.Format(System.SR.Argument_InvalidTypeWithPointersNotSupported, type));
		}

		internal static void ThrowArgumentException_DestinationTooShort()
		{
			throw CreateArgumentException_DestinationTooShort();
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		private static Exception CreateArgumentException_DestinationTooShort()
		{
			return new ArgumentException(System.SR.Argument_DestinationTooShort);
		}

		internal static void ThrowIndexOutOfRangeException()
		{
			throw CreateIndexOutOfRangeException();
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		private static Exception CreateIndexOutOfRangeException()
		{
			return new IndexOutOfRangeException();
		}

		internal static void ThrowArgumentOutOfRangeException()
		{
			throw CreateArgumentOutOfRangeException();
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		private static Exception CreateArgumentOutOfRangeException()
		{
			return new ArgumentOutOfRangeException();
		}

		internal static void ThrowArgumentOutOfRangeException(System.ExceptionArgument argument)
		{
			throw CreateArgumentOutOfRangeException(argument);
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		private static Exception CreateArgumentOutOfRangeException(System.ExceptionArgument argument)
		{
			return new ArgumentOutOfRangeException(argument.ToString());
		}

		internal static void ThrowArgumentOutOfRangeException_PrecisionTooLarge()
		{
			throw CreateArgumentOutOfRangeException_PrecisionTooLarge();
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		private static Exception CreateArgumentOutOfRangeException_PrecisionTooLarge()
		{
			return new ArgumentOutOfRangeException("precision", System.SR.Format(System.SR.Argument_PrecisionTooLarge, (byte)99));
		}

		internal static void ThrowArgumentOutOfRangeException_SymbolDoesNotFit()
		{
			throw CreateArgumentOutOfRangeException_SymbolDoesNotFit();
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		private static Exception CreateArgumentOutOfRangeException_SymbolDoesNotFit()
		{
			return new ArgumentOutOfRangeException("symbol", System.SR.Argument_BadFormatSpecifier);
		}

		internal static void ThrowInvalidOperationException()
		{
			throw CreateInvalidOperationException();
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		private static Exception CreateInvalidOperationException()
		{
			return new InvalidOperationException();
		}

		internal static void ThrowInvalidOperationException_OutstandingReferences()
		{
			throw CreateInvalidOperationException_OutstandingReferences();
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		private static Exception CreateInvalidOperationException_OutstandingReferences()
		{
			return new InvalidOperationException(System.SR.OutstandingReferences);
		}

		internal static void ThrowInvalidOperationException_UnexpectedSegmentType()
		{
			throw CreateInvalidOperationException_UnexpectedSegmentType();
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		private static Exception CreateInvalidOperationException_UnexpectedSegmentType()
		{
			return new InvalidOperationException(System.SR.UnexpectedSegmentType);
		}

		internal static void ThrowInvalidOperationException_EndPositionNotReached()
		{
			throw CreateInvalidOperationException_EndPositionNotReached();
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		private static Exception CreateInvalidOperationException_EndPositionNotReached()
		{
			return new InvalidOperationException(System.SR.EndPositionNotReached);
		}

		internal static void ThrowArgumentOutOfRangeException_PositionOutOfRange()
		{
			throw CreateArgumentOutOfRangeException_PositionOutOfRange();
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		private static Exception CreateArgumentOutOfRangeException_PositionOutOfRange()
		{
			return new ArgumentOutOfRangeException("position");
		}

		internal static void ThrowArgumentOutOfRangeException_OffsetOutOfRange()
		{
			throw CreateArgumentOutOfRangeException_OffsetOutOfRange();
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		private static Exception CreateArgumentOutOfRangeException_OffsetOutOfRange()
		{
			return new ArgumentOutOfRangeException("offset");
		}

		internal static void ThrowObjectDisposedException_ArrayMemoryPoolBuffer()
		{
			throw CreateObjectDisposedException_ArrayMemoryPoolBuffer();
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		private static Exception CreateObjectDisposedException_ArrayMemoryPoolBuffer()
		{
			return new ObjectDisposedException("ArrayMemoryPoolBuffer");
		}

		internal static void ThrowFormatException_BadFormatSpecifier()
		{
			throw CreateFormatException_BadFormatSpecifier();
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		private static Exception CreateFormatException_BadFormatSpecifier()
		{
			return new FormatException(System.SR.Argument_BadFormatSpecifier);
		}

		internal static void ThrowArgumentException_OverlapAlignmentMismatch()
		{
			throw CreateArgumentException_OverlapAlignmentMismatch();
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		private static Exception CreateArgumentException_OverlapAlignmentMismatch()
		{
			return new ArgumentException(System.SR.Argument_OverlapAlignmentMismatch);
		}

		internal static void ThrowNotSupportedException()
		{
			throw CreateThrowNotSupportedException();
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		private static Exception CreateThrowNotSupportedException()
		{
			return new NotSupportedException();
		}

		public static bool TryFormatThrowFormatException(out int bytesWritten)
		{
			bytesWritten = 0;
			ThrowFormatException_BadFormatSpecifier();
			return false;
		}

		public static bool TryParseThrowFormatException<T>(out T value, out int bytesConsumed)
		{
			value = default(T);
			bytesConsumed = 0;
			ThrowFormatException_BadFormatSpecifier();
			return false;
		}

		public static void ThrowArgumentValidationException<T>(ReadOnlySequenceSegment<T> startSegment, int startIndex, ReadOnlySequenceSegment<T> endSegment)
		{
			throw CreateArgumentValidationException(startSegment, startIndex, endSegment);
		}

		private static Exception CreateArgumentValidationException<T>(ReadOnlySequenceSegment<T> startSegment, int startIndex, ReadOnlySequenceSegment<T> endSegment)
		{
			if (startSegment == null)
			{
				return CreateArgumentNullException(System.ExceptionArgument.startSegment);
			}
			if (endSegment == null)
			{
				return CreateArgumentNullException(System.ExceptionArgument.endSegment);
			}
			if (startSegment != endSegment && startSegment.RunningIndex > endSegment.RunningIndex)
			{
				return CreateArgumentOutOfRangeException(System.ExceptionArgument.endSegment);
			}
			if ((uint)startSegment.Memory.Length < (uint)startIndex)
			{
				return CreateArgumentOutOfRangeException(System.ExceptionArgument.startIndex);
			}
			return CreateArgumentOutOfRangeException(System.ExceptionArgument.endIndex);
		}

		public static void ThrowArgumentValidationException(Array array, int start)
		{
			throw CreateArgumentValidationException(array, start);
		}

		private static Exception CreateArgumentValidationException(Array array, int start)
		{
			if (array == null)
			{
				return CreateArgumentNullException(System.ExceptionArgument.array);
			}
			if ((uint)start > (uint)array.Length)
			{
				return CreateArgumentOutOfRangeException(System.ExceptionArgument.start);
			}
			return CreateArgumentOutOfRangeException(System.ExceptionArgument.length);
		}

		public static void ThrowStartOrEndArgumentValidationException(long start)
		{
			throw CreateStartOrEndArgumentValidationException(start);
		}

		private static Exception CreateStartOrEndArgumentValidationException(long start)
		{
			if (start < 0)
			{
				return CreateArgumentOutOfRangeException(System.ExceptionArgument.start);
			}
			return CreateArgumentOutOfRangeException(System.ExceptionArgument.length);
		}
	}
	internal enum ExceptionArgument
	{
		length,
		start,
		minimumBufferSize,
		elementIndex,
		comparable,
		comparer,
		destination,
		offset,
		startSegment,
		endSegment,
		startIndex,
		endIndex,
		array,
		culture,
		manager
	}
	internal static class DecimalDecCalc
	{
		private static uint D32DivMod1E9(uint hi32, ref uint lo32)
		{
			ulong num = ((ulong)hi32 << 32) | lo32;
			lo32 = (uint)(num / 1000000000);
			return (uint)(num % 1000000000);
		}

		internal static uint DecDivMod1E9(ref MutableDecimal value)
		{
			return D32DivMod1E9(D32DivMod1E9(D32DivMod1E9(0u, ref value.High), ref value.Mid), ref value.Low);
		}

		internal static void DecAddInt32(ref MutableDecimal value, uint i)
		{
			if (D32AddCarry(ref value.Low, i) && D32AddCarry(ref value.Mid, 1u))
			{
				D32AddCarry(ref value.High, 1u);
			}
		}

		private static bool D32AddCarry(ref uint value, uint i)
		{
			uint num = value;
			uint num2 = (value = num + i);
			if (num2 >= num)
			{
				return num2 < i;
			}
			return true;
		}

		internal static void DecMul10(ref MutableDecimal value)
		{
			MutableDecimal d = value;
			DecShiftLeft(ref value);
			DecShiftLeft(ref value);
			DecAdd(ref value, d);
			DecShiftLeft(ref value);
		}

		private static void DecShiftLeft(ref MutableDecimal value)
		{
			uint num = (((value.Low & 0x80000000u) != 0) ? 1u : 0u);
			uint num2 = (((value.Mid & 0x80000000u) != 0) ? 1u : 0u);
			value.Low <<= 1;
			value.Mid = (value.Mid << 1) | num;
			value.High = (value.High << 1) | num2;
		}

		private static void DecAdd(ref MutableDecimal value, MutableDecimal d)
		{
			if (D32AddCarry(ref value.Low, d.Low) && D32AddCarry(ref value.Mid, 1u))
			{
				D32AddCarry(ref value.High, 1u);
			}
			if (D32AddCarry(ref value.Mid, d.Mid))
			{
				D32AddCarry(ref value.High, 1u);
			}
			D32AddCarry(ref value.High, d.High);
		}
	}
	internal static class Number
	{
		private static class DoubleHelper
		{
			public unsafe static uint Exponent(double d)
			{
				return (*(uint*)((byte*)(&d) + 4) >> 20) & 0x7FFu;
			}

			public unsafe static ulong Mantissa(double d)
			{
				return *(uint*)(&d) | ((ulong)(uint)(*(int*)((byte*)(&d) + 4) & 0xFFFFF) << 32);
			}

			public unsafe static bool Sign(double d)
			{
				return *(uint*)((byte*)(&d) + 4) >> 31 != 0;
			}
		}

		internal const int DECIMAL_PRECISION = 29;

		private static readonly ulong[] s_rgval64Power10 = new ulong[30]
		{
			11529215046068469760uL, 14411518807585587200uL, 18014398509481984000uL, 11258999068426240000uL, 14073748835532800000uL, 17592186044416000000uL, 10995116277760000000uL, 13743895347200000000uL, 17179869184000000000uL, 10737418240000000000uL,
			13421772800000000000uL, 16777216000000000000uL, 10485760000000000000uL, 13107200000000000000uL, 16384000000000000000uL, 14757395258967641293uL, 11805916207174113035uL, 9444732965739290428uL, 15111572745182864686uL, 12089258196146291749uL,
			9671406556917033399uL, 15474250491067253438uL, 12379400392853802751uL, 9903520314283042201uL, 15845632502852867522uL, 12676506002282294018uL, 10141204801825835215uL, 16225927682921336344uL, 12980742146337069075uL, 10384593717069655260uL
		};

		private static readonly sbyte[] s_rgexp64Power10 = new sbyte[15]
		{
			4, 7, 10, 14, 17, 20, 24, 27, 30, 34,
			37, 40, 44, 47, 50
		};

		private static readonly ulong[] s_rgval64Power10By16 = new ulong[42]
		{
			10240000000000000000uL, 11368683772161602974uL, 12621774483536188886uL, 14012984643248170708uL, 15557538194652854266uL, 17272337110188889248uL, 9588073174409622172uL, 10644899600020376798uL, 11818212630765741798uL, 13120851772591970216uL,
			14567071740625403792uL, 16172698447808779622uL, 17955302187076837696uL, 9967194951097567532uL, 11065809325636130658uL, 12285516299433008778uL, 13639663065038175358uL, 15143067982934716296uL, 16812182738118149112uL, 9332636185032188787uL,
			10361307573072618722uL, 16615349947311448416uL, 14965776766268445891uL, 13479973333575319909uL, 12141680576410806707uL, 10936253623915059637uL, 9850501549098619819uL, 17745086042373215136uL, 15983352577617880260uL, 14396524142538228461uL,
			12967236152753103031uL, 11679847981112819795uL, 10520271803096747049uL, 9475818434452569218uL, 17070116948172427008uL, 15375394465392026135uL, 13848924157002783096uL, 12474001934591998882uL, 11235582092889474480uL, 10120112665365530972uL,
			18230774251475056952uL, 16420821625123739930uL
		};

		private static readonly short[] s_rgexp64Power10By16 = new short[21]
		{
			54, 107, 160, 213, 266, 319, 373, 426, 479, 532,
			585, 638, 691, 745, 798, 851, 904, 957, 1010, 1064,
			1117
		};

		public static void RoundNumber(ref NumberBuffer number, int pos)
		{
			Span<byte> digits = number.Digits;
			int i;
			for (i = 0; i < pos && digits[i] != 0; i++)
			{
			}
			if (i == pos && digits[i] >= 53)
			{
				while (i > 0 && digits[i - 1] == 57)
				{
					i--;
				}
				if (i > 0)
				{
					digits[i - 1]++;
				}
				else
				{
					number.Scale++;
					digits[0] = 49;
					i = 1;
				}
			}
			else
			{
				while (i > 0 && digits[i - 1] == 48)
				{
					i--;
				}
			}
			if (i == 0)
			{
				number.Scale = 0;
				number.IsNegative = false;
			}
			digits[i] = 0;
		}

		internal static bool NumberBufferToDouble(ref NumberBuffer number, out double value)
		{
			double num = NumberToDouble(ref number);
			uint num2 = DoubleHelper.Exponent(num);
			ulong num3 = DoubleHelper.Mantissa(num);
			switch (num2)
			{
			case 2047u:
				value = 0.0;
				return false;
			case 0u:
				if (num3 == 0L)
				{
					num = 0.0;
				}
				break;
			}
			value = num;
			return true;
		}

		public unsafe static bool NumberBufferToDecimal(ref NumberBuffer number, ref decimal value)
		{
			MutableDecimal value2 = default(MutableDecimal);
			byte* ptr = number.UnsafeDigits;
			int num = number.Scale;
			if (*ptr == 0)
			{
				if (num > 0)
				{
					num = 0;
				}
			}
			else
			{
				if (num > 29)
				{
					return false;
				}
				while ((num > 0 || (*ptr != 0 && num > -28)) && (value2.High < 429496729 || (value2.High == 429496729 && (value2.Mid < 2576980377u || (value2.Mid == 2576980377u && (value2.Low < 2576980377u || (value2.Low == 2576980377u && *ptr <= 53)))))))
				{
					DecimalDecCalc.DecMul10(ref value2);
					if (*ptr != 0)
					{
						DecimalDecCalc.DecAddInt32(ref value2, (uint)(*(ptr++) - 48));
					}
					num--;
				}
				if (*(ptr++) >= 53)
				{
					bool flag = true;
					if (*(ptr - 1) == 53 && *(ptr - 2) % 2 == 0)
					{
						int num2 = 20;
						while (*ptr == 48 && num2 != 0)
						{
							ptr++;
							num2--;
						}
						if (*ptr == 0 || num2 == 0)
						{
							flag = false;
						}
					}
					if (flag)
					{
						DecimalDecCalc.DecAddInt32(ref value2, 1u);
						if ((value2.High | value2.Mid | value2.Low) == 0)
						{
							value2.High = 429496729u;
							value2.Mid = 2576980377u;
							value2.Low = 2576980378u;
							num++;
						}
					}
				}
			}
			if (num > 0)
			{
				return false;
			}
			if (num <= -29)
			{
				value2.High = 0u;
				value2.Low = 0u;
				value2.Mid = 0u;
				value2.Scale = 28;
			}
			else
			{
				value2.Scale = -num;
			}
			value2.IsNegative = number.IsNegative;
			value = System.Runtime.CompilerServices.Unsafe.As<MutableDecimal, decimal>(ref value2);
			return true;
		}

		public static void DecimalToNumber(decimal value, ref NumberBuffer number)
		{
			ref MutableDecimal reference = ref System.Runtime.CompilerServices.Unsafe.As<decimal, MutableDecimal>(ref value);
			Span<byte> digits = number.Digits;
			number.IsNegative = reference.IsNegative;
			int num = 29;
			while ((reference.Mid != 0) | (reference.High != 0))
			{
				uint num2 = DecimalDecCalc.DecDivMod1E9(ref reference);
				for (int i = 0; i < 9; i++)
				{
					digits[--num] = (byte)(num2 % 10 + 48);
					num2 /= 10;
				}
			}
			for (uint num3 = reference.Low; num3 != 0; num3 /= 10)
			{
				digits[--num] = (byte)(num3 % 10 + 48);
			}
			int num4 = 29 - num;
			number.Scale = num4 - reference.Scale;
			Span<byte> digits2 = number.Digits;
			int index = 0;
			while (--num4 >= 0)
			{
				digits2[index++] = digits[num++];
			}
			digits2[index] = 0;
		}

		private static uint DigitsToInt(ReadOnlySpan<byte> digits, int count)
		{
			uint value;
			int bytesConsumed;
			bool flag = Utf8Parser.TryParse(digits.Slice(0, count), out value, out bytesConsumed, 'D');
			return value;
		}

		private static ulong Mul32x32To64(uint a, uint b)
		{
			return (ulong)a * (ulong)b;
		}

		private static ulong Mul64Lossy(ulong a, ulong b, ref int pexp)
		{
			ulong num = Mul32x32To64((uint)(a >> 32), (uint)(b >> 32)) + (Mul32x32To64((uint)(a >> 32), (uint)b) >> 32) + (Mul32x32To64((uint)a, (uint)(b >> 32)) >> 32);
			if ((num & 0x8000000000000000uL) == 0L)
			{
				num <<= 1;
				pexp--;
			}
			return num;
		}

		private static int abs(int value)
		{
			if (value < 0)
			{
				return -value;
			}
			return value;
		}

		private unsafe static double NumberToDouble(ref NumberBuffer number)
		{
			ReadOnlySpan<byte> digits = number.Digits;
			int i = 0;
			int numDigits = number.NumDigits;
			int num = numDigits;
			for (; digits[i] == 48; i++)
			{
				num--;
			}
			if (num == 0)
			{
				return 0.0;
			}
			int num2 = Math.Min(num, 9);
			num -= num2;
			ulong num3 = DigitsToInt(digits, num2);
			if (num > 0)
			{
				num2 = Math.Min(num, 9);
				num -= num2;
				uint b = (uint)(s_rgval64Power10[num2 - 1] >> 64 - s_rgexp64Power10[num2 - 1]);
				num3 = Mul32x32To64((uint)num3, b) + DigitsToInt(digits.Slice(9), num2);
			}
			int num4 = number.Scale - (numDigits - num);
			int num5 = abs(num4);
			if (num5 >= 352)
			{
				ulong num6 = ((num4 > 0) ? 9218868437227405312uL : 0);
				if (number.IsNegative)
				{
					num6 |= 0x8000000000000000uL;
				}
				return *(double*)(&num6);
			}
			int pexp = 64;
			if ((num3 & 0xFFFFFFFF00000000uL) == 0L)
			{
				num3 <<= 32;
				pexp -= 32;
			}
			if ((num3 & 0xFFFF000000000000uL) == 0L)
			{
				num3 <<= 16;
				pexp -= 16;
			}
			if ((num3 & 0xFF00000000000000uL) == 0L)
			{
				num3 <<= 8;
				pexp -= 8;
			}
			if ((num3 & 0xF000000000000000uL) == 0L)
			{
				num3 <<= 4;
				pexp -= 4;
			}
			if ((num3 & 0xC000000000000000uL) == 0L)
			{
				num3 <<= 2;
				pexp -= 2;
			}
			if ((num3 & 0x8000000000000000uL) == 0L)
			{
				num3 <<= 1;
				pexp--;
			}
			int num7 = num5 & 0xF;
			if (num7 != 0)
			{
				int num8 = s_rgexp64Power10[num7 - 1];
				pexp += ((num4 < 0) ? (-num8 + 1) : num8);
				ulong b2 = s_rgval64Power10[num7 + ((num4 < 0) ? 15 : 0) - 1];
				num3 = Mul64Lossy(num3, b2, ref pexp);
			}
			num7 = num5 >> 4;
			if (num7 != 0)
			{
				int num9 = s_rgexp64Power10By16[num7 - 1];
				pexp += ((num4 < 0) ? (-num9 + 1) : num9);
				ulong b3 = s_rgval64Power10By16[num7 + ((num4 < 0) ? 21 : 0) - 1];
				num3 = Mul64Lossy(num3, b3, ref pexp);
			}
			if (((uint)(int)num3 & 0x400u) != 0)
			{
				ulong num10 = num3 + 1023 + (ulong)(((int)num3 >> 11) & 1);
				if (num10 < num3)
				{
					num10 = (num10 >> 1) | 0x8000000000000000uL;
					pexp++;
				}
				num3 = num10;
			}
			pexp += 1022;
			num3 = ((pexp <= 0) ? ((pexp == -52 && num3 >= 9223372036854775896uL) ? 1 : ((pexp > -52) ? (num3 >> -pexp + 11 + 1) : 0)) : ((pexp < 2047) ? ((ulong)((long)pexp << 52) + ((num3 >> 11) & 0xFFFFFFFFFFFFFL)) : 9218868437227405312uL));
			if (number.IsNegative)
			{
				num3 |= 0x8000000000000000uL;
			}
			return *(double*)(&num3);
		}
	}
	internal ref struct NumberBuffer
	{
		public int Scale;

		public bool IsNegative;

		public const int BufferSize = 51;

		private byte _b0;

		private byte _b1;

		private byte _b2;

		private byte _b3;

		private byte _b4;

		private byte _b5;

		private byte _b6;

		private byte _b7;

		private byte _b8;

		private byte _b9;

		private byte _b10;

		private byte _b11;

		private byte _b12;

		private byte _b13;

		private byte _b14;

		private byte _b15;

		private byte _b16;

		private byte _b17;

		private byte _b18;

		private byte _b19;

		private byte _b20;

		private byte _b21;

		private byte _b22;

		private byte _b23;

		private byte _b24;

		private byte _b25;

		private byte _b26;

		private byte _b27;

		private byte _b28;

		private byte _b29;

		private byte _b30;

		private byte _b31;

		private byte _b32;

		private byte _b33;

		private byte _b34;

		private byte _b35;

		private byte _b36;

		private byte _b37;

		private byte _b38;

		private byte _b39;

		private byte _b40;

		private byte _b41;

		private byte _b42;

		private byte _b43;

		private byte _b44;

		private byte _b45;

		private byte _b46;

		private byte _b47;

		private byte _b48;

		private byte _b49;

		private byte _b50;

		public unsafe Span<byte> Digits => new Span<byte>(System.Runtime.CompilerServices.Unsafe.AsPointer<byte>(ref _b0), 51);

		public unsafe byte* UnsafeDigits => (byte*)System.Runtime.CompilerServices.Unsafe.AsPointer<byte>(ref _b0);

		public int NumDigits => Digits.IndexOf<byte>(0);

		[Conditional("DEBUG")]
		public void CheckConsistency()
		{
		}

		public override string ToString()
		{
			StringBuilder stringBuilder = new StringBuilder();
			stringBuilder.Append('[');
			stringBuilder.Append('"');
			Span<byte> digits = Digits;
			for (int i = 0; i < 51; i++)
			{
				byte b = digits[i];
				if (b == 0)
				{
					break;
				}
				stringBuilder.Append((char)b);
			}
			stringBuilder.Append('"');
			stringBuilder.Append(", Scale = " + Scale);
			stringBuilder.Append(", IsNegative   = " + IsNegative);
			stringBuilder.Append(']');
			return stringBuilder.ToString();
		}
	}
	[DebuggerTypeProxy(typeof(System.MemoryDebugView<>))]
	[DebuggerDisplay("{ToString(),raw}")]
	public readonly struct Memory<T>
	{
		private readonly object _object;

		private readonly int _index;

		private readonly int _length;

		private const int RemoveFlagsBitMask = int.MaxValue;

		public static Memory<T> Empty => default(Memory<T>);

		public int Length => _length & 0x7FFFFFFF;

		public bool IsEmpty => (_length & 0x7FFFFFFF) == 0;

		public Span<T> Span
		{
			[MethodImpl(MethodImplOptions.AggressiveInlining)]
			get
			{
				Span<T> result;
				if (_index < 0)
				{
					result = ((MemoryManager<T>)_object).GetSpan();
					return result.Slice(_index & 0x7FFFFFFF, _length);
				}
				if (typeof(T) == typeof(char) && _object is string text)
				{
					result = new Span<T>(System.Runtime.CompilerServices.Unsafe.As<Pinnable<T>>((object)text), MemoryExtensions.StringAdjustment, text.Length);
					return result.Slice(_index, _length);
				}
				if (_object != null)
				{
					return new Span<T>((T[])_object, _index, _length & 0x7FFFFFFF);
				}
				result = default(Span<T>);
				return result;
			}
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public Memory(T[] array)
		{
			if (array == null)
			{
				this = default(Memory<T>);
				return;
			}
			if (default(T) == null && array.GetType() != typeof(T[]))
			{
				System.ThrowHelper.ThrowArrayTypeMismatchException();
			}
			_object = array;
			_index = 0;
			_length = array.Length;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		internal Memory(T[] array, int start)
		{
			if (array == null)
			{
				if (start != 0)
				{
					System.ThrowHelper.ThrowArgumentOutOfRangeException();
				}
				this = default(Memory<T>);
				return;
			}
			if (default(T) == null && array.GetType() != typeof(T[]))
			{
				System.ThrowHelper.ThrowArrayTypeMismatchException();
			}
			if ((uint)start > (uint)array.Length)
			{
				System.ThrowHelper.ThrowArgumentOutOfRangeException();
			}
			_object = array;
			_index = start;
			_length = array.Length - start;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public Memory(T[] array, int start, int length)
		{
			if (array == null)
			{
				if (start != 0 || length != 0)
				{
					System.ThrowHelper.ThrowArgumentOutOfRangeException();
				}
				this = default(Memory<T>);
				return;
			}
			if (default(T) == null && array.GetType() != typeof(T[]))
			{
				System.ThrowHelper.ThrowArrayTypeMismatchException();
			}
			if ((uint)start > (uint)array.Length || (uint)length > (uint)(array.Length - start))
			{
				System.ThrowHelper.ThrowArgumentOutOfRangeException();
			}
			_object = array;
			_index = start;
			_length = length;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		internal Memory(MemoryManager<T> manager, int length)
		{
			if (length < 0)
			{
				System.ThrowHelper.ThrowArgumentOutOfRangeException();
			}
			_object = manager;
			_index = int.MinValue;
			_length = length;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		internal Memory(MemoryManager<T> manager, int start, int length)
		{
			if (length < 0 || start < 0)
			{
				System.ThrowHelper.ThrowArgumentOutOfRangeException();
			}
			_object = manager;
			_index = start | int.MinValue;
			_length = length;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		internal Memory(object obj, int start, int length)
		{
			_object = obj;
			_index = start;
			_length = length;
		}

		public static implicit operator Memory<T>(T[] array)
		{
			return new Memory<T>(array);
		}

		public static implicit operator Memory<T>(ArraySegment<T> segment)
		{
			return new Memory<T>(segment.Array, segment.Offset, segment.Count);
		}

		public static implicit operator ReadOnlyMemory<T>(Memory<T> memory)
		{
			return System.Runtime.CompilerServices.Unsafe.As<Memory<T>, ReadOnlyMemory<T>>(ref memory);
		}

		public override string ToString()
		{
			if (typeof(T) == typeof(char))
			{
				if (!(_object is string text))
				{
					return Span.ToString();
				}
				return text.Substring(_index, _length & 0x7FFFFFFF);
			}
			return $"System.Memory<{typeof(T).Name}>[{_length & 0x7FFFFFFF}]";
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public Memory<T> Slice(int start)
		{
			int length = _length;
			int num = length & 0x7FFFFFFF;
			if ((uint)start > (uint)num)
			{
				System.ThrowHelper.ThrowArgumentOutOfRangeException(System.ExceptionArgument.start);
			}
			return new Memory<T>(_object, _index + start, length - start);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public Memory<T> Slice(int start, int length)
		{
			int length2 = _length;
			int num = length2 & 0x7FFFFFFF;
			if ((uint)start > (uint)num || (uint)length > (uint)(num - start))
			{
				System.ThrowHelper.ThrowArgumentOutOfRangeException();
			}
			return new Memory<T>(_object, _index + start, length | (length2 & int.MinValue));
		}

		public void CopyTo(Memory<T> destination)
		{
			Span.CopyTo(destination.Span);
		}

		public bool TryCopyTo(Memory<T> destination)
		{
			return Span.TryCopyTo(destination.Span);
		}

		public unsafe MemoryHandle Pin()
		{
			if (_index < 0)
			{
				return ((MemoryManager<T>)_object).Pin(_index & 0x7FFFFFFF);
			}
			if (typeof(T) == typeof(char) && _object is string value)
			{
				GCHandle handle = GCHandle.Alloc(value, GCHandleType.Pinned);
				void* pointer = System.Runtime.CompilerServices.Unsafe.Add<T>((void*)handle.AddrOfPinnedObject(), _index);
				return new MemoryHandle(pointer, handle);
			}
			if (_object is T[] array)
			{
				if (_length < 0)
				{
					void* pointer2 = System.Runtime.CompilerServices.Unsafe.Add<T>(System.Runtime.CompilerServices.Unsafe.AsPointer<T>(ref MemoryMarshal.GetReference<T>(array)), _index);
					return new MemoryHandle(pointer2);
				}
				GCHandle handle2 = GCHandle.Alloc(array, GCHandleType.Pinned);
				void* pointer3 = System.Runtime.CompilerServices.Unsafe.Add<T>((void*)handle2.AddrOfPinnedObject(), _index);
				return new MemoryHandle(pointer3, handle2);
			}
			return default(MemoryHandle);
		}

		public T[] ToArray()
		{
			return Span.ToArray();
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public override bool Equals(object obj)
		{
			if (obj is ReadOnlyMemory<T> readOnlyMemory)
			{
				return readOnlyMemory.Equals(this);
			}
			if (obj is Memory<T> other)
			{
				return Equals(other);
			}
			return false;
		}

		public bool Equals(Memory<T> other)
		{
			if (_object == other._object && _index == other._index)
			{
				return _length == other._length;
			}
			return false;
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public override int GetHashCode()
		{
			if (_object == null)
			{
				return 0;
			}
			int hashCode = _object.GetHashCode();
			int index = _index;
			int hashCode2 = index.GetHashCode();
			index = _length;
			return CombineHashCodes(hashCode, hashCode2, index.GetHashCode());
		}

		private static int CombineHashCodes(int left, int right)
		{
			return ((left << 5) + left) ^ right;
		}

		private static int CombineHashCodes(int h1, int h2, int h3)
		{
			return CombineHashCodes(CombineHashCodes(h1, h2), h3);
		}
	}
	internal sealed class MemoryDebugView<T>
	{
		private readonly ReadOnlyMemory<T> _memory;

		[DebuggerBrowsable(DebuggerBrowsableState.RootHidden)]
		public T[] Items => _memory.ToArray();

		public MemoryDebugView(Memory<T> memory)
		{
			_memory = memory;
		}

		public MemoryDebugView(ReadOnlyMemory<T> memory)
		{
			_memory = memory;
		}
	}
	public static class MemoryExtensions
	{
		internal static readonly IntPtr StringAdjustment = MeasureStringAdjustment();

		public static ReadOnlySpan<char> Trim(this ReadOnlySpan<char> span)
		{
			return span.TrimStart().TrimEnd();
		}

		public static ReadOnlySpan<char> TrimStart(this ReadOnlySpan<char> span)
		{
			int i;
			for (i = 0; i < span.Length && char.IsWhiteSpace(span[i]); i++)
			{
			}
			return span.Slice(i);
		}

		public static ReadOnlySpan<char> TrimEnd(this ReadOnlySpan<char> span)
		{
			int num = span.Length - 1;
			while (num >= 0 && char.IsWhiteSpace(span[num]))
			{
				num--;
			}
			return span.Slice(0, num + 1);
		}

		public static ReadOnlySpan<char> Trim(this ReadOnlySpan<char> span, char trimChar)
		{
			return span.TrimStart(trimChar).TrimEnd(trimChar);
		}

		public static ReadOnlySpan<char> TrimStart(this ReadOnlySpan<char> span, char trimChar)
		{
			int i;
			for (i = 0; i < span.Length && span[i] == trimChar; i++)
			{
			}
			return span.Slice(i);
		}

		public static ReadOnlySpan<char> TrimEnd(this ReadOnlySpan<char> span, char trimChar)
		{
			int num = span.Length - 1;
			while (num >= 0 && span[num] == trimChar)
			{
				num--;
			}
			return span.Slice(0, num + 1);
		}

		public static ReadOnlySpan<char> Trim(this ReadOnlySpan<char> span, ReadOnlySpan<char> trimChars)
		{
			return span.TrimStart(trimChars).TrimEnd(trimChars);
		}

		public static ReadOnlySpan<char> TrimStart(this ReadOnlySpan<char> span, ReadOnlySpan<char> trimChars)
		{
			if (trimChars.IsEmpty)
			{
				return span.TrimStart();
			}
			int i;
			for (i = 0; i < span.Length; i++)
			{
				int num = 0;
				while (num < trimChars.Length)
				{
					if (span[i] != trimChars[num])
					{
						num++;
						continue;
					}
					goto IL_003c;
				}
				break;
				IL_003c:;
			}
			return span.Slice(i);
		}

		public static ReadOnlySpan<char> TrimEnd(this ReadOnlySpan<char> span, ReadOnlySpan<char> trimChars)
		{
			if (trimChars.IsEmpty)
			{
				return span.TrimEnd();
			}
			int num;
			for (num = span.Length - 1; num >= 0; num--)
			{
				int num2 = 0;
				while (num2 < trimChars.Length)
				{
					if (span[num] != trimChars[num2])
					{
						num2++;
						continue;
					}
					goto IL_0044;
				}
				break;
				IL_0044:;
			}
			return span.Slice(0, num + 1);
		}

		public static bool IsWhiteSpace(this ReadOnlySpan<char> span)
		{
			for (int i = 0; i < span.Length; i++)
			{
				if (!char.IsWhiteSpace(span[i]))
				{
					return false;
				}
			}
			return true;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static int IndexOf<T>(this Span<T> span, T value) where T : IEquatable<T>
		{
			if (typeof(T) == typeof(byte))
			{
				return System.SpanHelpers.IndexOf(ref System.Runtime.CompilerServices.Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), System.Runtime.CompilerServices.Unsafe.As<T, byte>(ref value), span.Length);
			}
			if (typeof(T) == typeof(char))
			{
				return System.SpanHelpers.IndexOf(ref System.Runtime.CompilerServices.Unsafe.As<T, char>(ref MemoryMarshal.GetReference(span)), System.Runtime.CompilerServices.Unsafe.As<T, char>(ref value), span.Length);
			}
			return System.SpanHelpers.IndexOf(ref MemoryMarshal.GetReference(span), value, span.Length);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static int IndexOf<T>(this Span<T> span, ReadOnlySpan<T> value) where T : IEquatable<T>
		{
			if (typeof(T) == typeof(byte))
			{
				return System.SpanHelpers.IndexOf(ref System.Runtime.CompilerServices.Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), span.Length, ref System.Runtime.CompilerServices.Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(value)), value.Length);
			}
			return System.SpanHelpers.IndexOf(ref MemoryMarshal.GetReference(span), span.Length, ref MemoryMarshal.GetReference(value), value.Length);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static int LastIndexOf<T>(this Span<T> span, T value) where T : IEquatable<T>
		{
			if (typeof(T) == typeof(byte))
			{
				return System.SpanHelpers.LastIndexOf(ref System.Runtime.CompilerServices.Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), System.Runtime.CompilerServices.Unsafe.As<T, byte>(ref value), span.Length);
			}
			if (typeof(T) == typeof(char))
			{
				return System.SpanHelpers.LastIndexOf(ref System.Runtime.CompilerServices.Unsafe.As<T, char>(ref MemoryMarshal.GetReference(span)), System.Runtime.CompilerServices.Unsafe.As<T, char>(ref value), span.Length);
			}
			return System.SpanHelpers.LastIndexOf(ref MemoryMarshal.GetReference(span), value, span.Length);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static int LastIndexOf<T>(this Span<T> span, ReadOnlySpan<T> value) where T : IEquatable<T>
		{
			if (typeof(T) == typeof(byte))
			{
				return System.SpanHelpers.LastIndexOf(ref System.Runtime.CompilerServices.Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), span.Length, ref System.Runtime.CompilerServices.Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(value)), value.Length);
			}
			return System.SpanHelpers.LastIndexOf(ref MemoryMarshal.GetReference(span), span.Length, ref MemoryMarshal.GetReference(value), value.Length);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static bool SequenceEqual<T>(this Span<T> span, ReadOnlySpan<T> other) where T : IEquatable<T>
		{
			int length = span.Length;
			if (default(T) != null && IsTypeComparableAsBytes<T>(out var size))
			{
				if (length == other.Length)
				{
					return System.SpanHelpers.SequenceEqual(ref System.Runtime.CompilerServices.Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), ref System.Runtime.CompilerServices.Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(other)), (NUInt)length * size);
				}
				return false;
			}
			if (length == other.Length)
			{
				return System.SpanHelpers.SequenceEqual(ref MemoryMarshal.GetReference(span), ref MemoryMarshal.GetReference(other), length);
			}
			return false;
		}

		public static int SequenceCompareTo<T>(this Span<T> span, ReadOnlySpan<T> other) where T : IComparable<T>
		{
			if (typeof(T) == typeof(byte))
			{
				return System.SpanHelpers.SequenceCompareTo(ref System.Runtime.CompilerServices.Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), span.Length, ref System.Runtime.CompilerServices.Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(other)), other.Length);
			}
			if (typeof(T) == typeof(char))
			{
				return System.SpanHelpers.SequenceCompareTo(ref System.Runtime.CompilerServices.Unsafe.As<T, char>(ref MemoryMarshal.GetReference(span)), span.Length, ref System.Runtime.CompilerServices.Unsafe.As<T, char>(ref MemoryMarshal.GetReference(other)), other.Length);
			}
			return System.SpanHelpers.SequenceCompareTo(ref MemoryMarshal.GetReference(span), span.Length, ref MemoryMarshal.GetReference(other), other.Length);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static int IndexOf<T>(this ReadOnlySpan<T> span, T value) where T : IEquatable<T>
		{
			if (typeof(T) == typeof(byte))
			{
				return System.SpanHelpers.IndexOf(ref System.Runtime.CompilerServices.Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), System.Runtime.CompilerServices.Unsafe.As<T, byte>(ref value), span.Length);
			}
			if (typeof(T) == typeof(char))
			{
				return System.SpanHelpers.IndexOf(ref System.Runtime.CompilerServices.Unsafe.As<T, char>(ref MemoryMarshal.GetReference(span)), System.Runtime.CompilerServices.Unsafe.As<T, char>(ref value), span.Length);
			}
			return System.SpanHelpers.IndexOf(ref MemoryMarshal.GetReference(span), value, span.Length);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static int IndexOf<T>(this ReadOnlySpan<T> span, ReadOnlySpan<T> value) where T : IEquatable<T>
		{
			if (typeof(T) == typeof(byte))
			{
				return System.SpanHelpers.IndexOf(ref System.Runtime.CompilerServices.Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), span.Length, ref System.Runtime.CompilerServices.Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(value)), value.Length);
			}
			return System.SpanHelpers.IndexOf(ref MemoryMarshal.GetReference(span), span.Length, ref MemoryMarshal.GetReference(value), value.Length);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static int LastIndexOf<T>(this ReadOnlySpan<T> span, T value) where T : IEquatable<T>
		{
			if (typeof(T) == typeof(byte))
			{
				return System.SpanHelpers.LastIndexOf(ref System.Runtime.CompilerServices.Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), System.Runtime.CompilerServices.Unsafe.As<T, byte>(ref value), span.Length);
			}
			if (typeof(T) == typeof(char))
			{
				return System.SpanHelpers.LastIndexOf(ref System.Runtime.CompilerServices.Unsafe.As<T, char>(ref MemoryMarshal.GetReference(span)), System.Runtime.CompilerServices.Unsafe.As<T, char>(ref value), span.Length);
			}
			return System.SpanHelpers.LastIndexOf(ref MemoryMarshal.GetReference(span), value, span.Length);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static int LastIndexOf<T>(this ReadOnlySpan<T> span, ReadOnlySpan<T> value) where T : IEquatable<T>
		{
			if (typeof(T) == typeof(byte))
			{
				return System.SpanHelpers.LastIndexOf(ref System.Runtime.CompilerServices.Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), span.Length, ref System.Runtime.CompilerServices.Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(value)), value.Length);
			}
			return System.SpanHelpers.LastIndexOf(ref MemoryMarshal.GetReference(span), span.Length, ref MemoryMarshal.GetReference(value), value.Length);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static int IndexOfAny<T>(this Span<T> span, T value0, T value1) where T : IEquatable<T>
		{
			if (typeof(T) == typeof(byte))
			{
				return System.SpanHelpers.IndexOfAny(ref System.Runtime.CompilerServices.Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), System.Runtime.CompilerServices.Unsafe.As<T, byte>(ref value0), System.Runtime.CompilerServices.Unsafe.As<T, byte>(ref value1), span.Length);
			}
			return System.SpanHelpers.IndexOfAny(ref MemoryMarshal.GetReference(span), value0, value1, span.Length);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static int IndexOfAny<T>(this Span<T> span, T value0, T value1, T value2) where T : IEquatable<T>
		{
			if (typeof(T) == typeof(byte))
			{
				return System.SpanHelpers.IndexOfAny(ref System.Runtime.CompilerServices.Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), System.Runtime.CompilerServices.Unsafe.As<T, byte>(ref value0), System.Runtime.CompilerServices.Unsafe.As<T, byte>(ref value1), System.Runtime.CompilerServices.Unsafe.As<T, byte>(ref value2), span.Length);
			}
			return System.SpanHelpers.IndexOfAny(ref MemoryMarshal.GetReference(span), value0, value1, value2, span.Length);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static int IndexOfAny<T>(this Span<T> span, ReadOnlySpan<T> values) where T : IEquatable<T>
		{
			if (typeof(T) == typeof(byte))
			{
				return System.SpanHelpers.IndexOfAny(ref System.Runtime.CompilerServices.Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), span.Length, ref System.Runtime.CompilerServices.Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(values)), values.Length);
			}
			return System.SpanHelpers.IndexOfAny(ref MemoryMarshal.GetReference(span), span.Length, ref MemoryMarshal.GetReference(values), values.Length);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static int IndexOfAny<T>(this ReadOnlySpan<T> span, T value0, T value1) where T : IEquatable<T>
		{
			if (typeof(T) == typeof(byte))
			{
				return System.SpanHelpers.IndexOfAny(ref System.Runtime.CompilerServices.Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), System.Runtime.CompilerServices.Unsafe.As<T, byte>(ref value0), System.Runtime.CompilerServices.Unsafe.As<T, byte>(ref value1), span.Length);
			}
			return System.SpanHelpers.IndexOfAny(ref MemoryMarshal.GetReference(span), value0, value1, span.Length);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static int IndexOfAny<T>(this ReadOnlySpan<T> span, T value0, T value1, T value2) where T : IEquatable<T>
		{
			if (typeof(T) == typeof(byte))
			{
				return System.SpanHelpers.IndexOfAny(ref System.Runtime.CompilerServices.Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), System.Runtime.CompilerServices.Unsafe.As<T, byte>(ref value0), System.Runtime.CompilerServices.Unsafe.As<T, byte>(ref value1), System.Runtime.CompilerServices.Unsafe.As<T, byte>(ref value2), span.Length);
			}
			return System.SpanHelpers.IndexOfAny(ref MemoryMarshal.GetReference(span), value0, value1, value2, span.Length);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static int IndexOfAny<T>(this ReadOnlySpan<T> span, ReadOnlySpan<T> values) where T : IEquatable<T>
		{
			if (typeof(T) == typeof(byte))
			{
				return System.SpanHelpers.IndexOfAny(ref System.Runtime.CompilerServices.Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), span.Length, ref System.Runtime.CompilerServices.Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(values)), values.Length);
			}
			return System.SpanHelpers.IndexOfAny(ref MemoryMarshal.GetReference(span), span.Length, ref MemoryMarshal.GetReference(values), values.Length);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static int LastIndexOfAny<T>(this Span<T> span, T value0, T value1) where T : IEquatable<T>
		{
			if (typeof(T) == typeof(byte))
			{
				return System.SpanHelpers.LastIndexOfAny(ref System.Runtime.CompilerServices.Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), System.Runtime.CompilerServices.Unsafe.As<T, byte>(ref value0), System.Runtime.CompilerServices.Unsafe.As<T, byte>(ref value1), span.Length);
			}
			return System.SpanHelpers.LastIndexOfAny(ref MemoryMarshal.GetReference(span), value0, value1, span.Length);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static int LastIndexOfAny<T>(this Span<T> span, T value0, T value1, T value2) where T : IEquatable<T>
		{
			if (typeof(T) == typeof(byte))
			{
				return System.SpanHelpers.LastIndexOfAny(ref System.Runtime.CompilerServices.Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), System.Runtime.CompilerServices.Unsafe.As<T, byte>(ref value0), System.Runtime.CompilerServices.Unsafe.As<T, byte>(ref value1), System.Runtime.CompilerServices.Unsafe.As<T, byte>(ref value2), span.Length);
			}
			return System.SpanHelpers.LastIndexOfAny(ref MemoryMarshal.GetReference(span), value0, value1, value2, span.Length);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static int LastIndexOfAny<T>(this Span<T> span, ReadOnlySpan<T> values) where T : IEquatable<T>
		{
			if (typeof(T) == typeof(byte))
			{
				return System.SpanHelpers.LastIndexOfAny(ref System.Runtime.CompilerServices.Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), span.Length, ref System.Runtime.CompilerServices.Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(values)), values.Length);
			}
			return System.SpanHelpers.LastIndexOfAny(ref MemoryMarshal.GetReference(span), span.Length, ref MemoryMarshal.GetReference(values), values.Length);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static int LastIndexOfAny<T>(this ReadOnlySpan<T> span, T value0, T value1) where T : IEquatable<T>
		{
			if (typeof(T) == typeof(byte))
			{
				return System.SpanHelpers.LastIndexOfAny(ref System.Runtime.CompilerServices.Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), System.Runtime.CompilerServices.Unsafe.As<T, byte>(ref value0), System.Runtime.CompilerServices.Unsafe.As<T, byte>(ref value1), span.Length);
			}
			return System.SpanHelpers.LastIndexOfAny(ref MemoryMarshal.GetReference(span), value0, value1, span.Length);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static int LastIndexOfAny<T>(this ReadOnlySpan<T> span, T value0, T value1, T value2) where T : IEquatable<T>
		{
			if (typeof(T) == typeof(byte))
			{
				return System.SpanHelpers.LastIndexOfAny(ref System.Runtime.CompilerServices.Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), System.Runtime.CompilerServices.Unsafe.As<T, byte>(ref value0), System.Runtime.CompilerServices.Unsafe.As<T, byte>(ref value1), System.Runtime.CompilerServices.Unsafe.As<T, byte>(ref value2), span.Length);
			}
			return System.SpanHelpers.LastIndexOfAny(ref MemoryMarshal.GetReference(span), value0, value1, value2, span.Length);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static int LastIndexOfAny<T>(this ReadOnlySpan<T> span, ReadOnlySpan<T> values) where T : IEquatable<T>
		{
			if (typeof(T) == typeof(byte))
			{
				return System.SpanHelpers.LastIndexOfAny(ref System.Runtime.CompilerServices.Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), span.Length, ref System.Runtime.CompilerServices.Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(values)), values.Length);
			}
			return System.SpanHelpers.LastIndexOfAny(ref MemoryMarshal.GetReference(span), span.Length, ref MemoryMarshal.GetReference(values), values.Length);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static bool SequenceEqual<T>(this ReadOnlySpan<T> span, ReadOnlySpan<T> other) where T : IEquatable<T>
		{
			int length = span.Length;
			if (default(T) != null && IsTypeComparableAsBytes<T>(out var size))
			{
				if (length == other.Length)
				{
					return System.SpanHelpers.SequenceEqual(ref System.Runtime.CompilerServices.Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), ref System.Runtime.CompilerServices.Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(other)), (NUInt)length * size);
				}
				return false;
			}
			if (length == other.Length)
			{
				return System.SpanHelpers.SequenceEqual(ref MemoryMarshal.GetReference(span), ref MemoryMarshal.GetReference(other), length);
			}
			return false;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static int SequenceCompareTo<T>(this ReadOnlySpan<T> span, ReadOnlySpan<T> other) where T : IComparable<T>
		{
			if (typeof(T) == typeof(byte))
			{
				return System.SpanHelpers.SequenceCompareTo(ref System.Runtime.CompilerServices.Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), span.Length, ref System.Runtime.CompilerServices.Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(other)), other.Length);
			}
			if (typeof(T) == typeof(char))
			{
				return System.SpanHelpers.SequenceCompareTo(ref System.Runtime.CompilerServices.Unsafe.As<T, char>(ref MemoryMarshal.GetReference(span)), span.Length, ref System.Runtime.CompilerServices.Unsafe.As<T, char>(ref MemoryMarshal.GetReference(other)), other.Length);
			}
			return System.SpanHelpers.SequenceCompareTo(ref MemoryMarshal.GetReference(span), span.Length, ref MemoryMarshal.GetReference(other), other.Length);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static bool StartsWith<T>(this Span<T> span, ReadOnlySpan<T> value) where T : IEquatable<T>
		{
			int length = value.Length;
			if (default(T) != null && IsTypeComparableAsBytes<T>(out var size))
			{
				if (length <= span.Length)
				{
					return System.SpanHelpers.SequenceEqual(ref System.Runtime.CompilerServices.Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), ref System.Runtime.CompilerServices.Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(value)), (NUInt)length * size);
				}
				return false;
			}
			if (length <= span.Length)
			{
				return System.SpanHelpers.SequenceEqual(ref MemoryMarshal.GetReference(span), ref MemoryMarshal.GetReference(value), length);
			}
			return false;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static bool StartsWith<T>(this ReadOnlySpan<T> span, ReadOnlySpan<T> value) where T : IEquatable<T>
		{
			int length = value.Length;
			if (default(T) != null && IsTypeComparableAsBytes<T>(out var size))
			{
				if (length <= span.Length)
				{
					return System.SpanHelpers.SequenceEqual(ref System.Runtime.CompilerServices.Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), ref System.Runtime.CompilerServices.Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(value)), (NUInt)length * size);
				}
				return false;
			}
			if (length <= span.Length)
			{
				return System.SpanHelpers.SequenceEqual(ref MemoryMarshal.GetReference(span), ref MemoryMarshal.GetReference(value), length);
			}
			return false;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static bool EndsWith<T>(this Span<T> span, ReadOnlySpan<T> value) where T : IEquatable<T>
		{
			int length = span.Length;
			int length2 = value.Length;
			if (default(T) != null && IsTypeComparableAsBytes<T>(out var size))
			{
				if (length2 <= length)
				{
					return System.SpanHelpers.SequenceEqual(ref System.Runtime.CompilerServices.Unsafe.As<T, byte>(ref System.Runtime.CompilerServices.Unsafe.Add<T>(ref MemoryMarshal.GetReference(span), length - length2)), ref System.Runtime.CompilerServices.Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(value)), (NUInt)length2 * size);
				}
				return false;
			}
			if (length2 <= length)
			{
				return System.SpanHelpers.SequenceEqual(ref System.Runtime.CompilerServices.Unsafe.Add<T>(ref MemoryMarshal.GetReference(span), length - length2), ref MemoryMarshal.GetReference(value), length2);
			}
			return false;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static bool EndsWith<T>(this ReadOnlySpan<T> span, ReadOnlySpan<T> value) where T : IEquatable<T>
		{
			int length = span.Length;
			int length2 = value.Length;
			if (default(T) != null && IsTypeComparableAsBytes<T>(out var size))
			{
				if (length2 <= length)
				{
					return System.SpanHelpers.SequenceEqual(ref System.Runtime.CompilerServices.Unsafe.As<T, byte>(ref System.Runtime.CompilerServices.Unsafe.Add<T>(ref MemoryMarshal.GetReference(span), length - length2)), ref System.Runtime.CompilerServices.Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(value)), (NUInt)length2 * size);
				}
				return false;
			}
			if (length2 <= length)
			{
				return System.SpanHelpers.SequenceEqual(ref System.Runtime.CompilerServices.Unsafe.Add<T>(ref MemoryMarshal.GetReference(span), length - length2), ref MemoryMarshal.GetReference(value), length2);
			}
			return false;
		}

		public static void Reverse<T>(this Span<T> span)
		{
			ref T reference = ref MemoryMarshal.GetReference(span);
			int num = 0;
			int num2 = span.Length - 1;
			while (num < num2)
			{
				T val = System.Runtime.CompilerServices.Unsafe.Add<T>(ref reference, num);
				System.Runtime.CompilerServices.Unsafe.Add<T>(ref reference, num) = System.Runtime.CompilerServices.Unsafe.Add<T>(ref reference, num2);
				System.Runtime.CompilerServices.Unsafe.Add<T>(ref reference, num2) = val;
				num++;
				num2--;
			}
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static Span<T> AsSpan<T>(this T[] array)
		{
			return new Span<T>(array);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static Span<T> AsSpan<T>(this T[] array, int start, int length)
		{
			return new Span<T>(array, start, length);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static Span<T> AsSpan<T>(this ArraySegment<T> segment)
		{
			return new Span<T>(segment.Array, segment.Offset, segment.Count);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static Span<T> AsSpan<T>(this ArraySegment<T> segment, int start)
		{
			if ((uint)start > segment.Count)
			{
				System.ThrowHelper.ThrowArgumentOutOfRangeException(System.ExceptionArgument.start);
			}
			return new Span<T>(segment.Array, segment.Offset + start, segment.Count - start);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static Span<T> AsSpan<T>(this ArraySegment<T> segment, int start, int length)
		{
			if ((uint)start > segment.Count)
			{
				System.ThrowHelper.ThrowArgumentOutOfRangeException(System.ExceptionArgument.start);
			}
			if ((uint)length > segment.Count - start)
			{
				System.ThrowHelper.ThrowArgumentOutOfRangeException(System.ExceptionArgument.length);
			}
			return new Span<T>(segment.Array, segment.Offset + start, length);
		}

		public static Memory<T> AsMemory<T>(this T[] array)
		{
			return new Memory<T>(array);
		}

		public static Memory<T> AsMemory<T>(this T[] array, int start)
		{
			return new Memory<T>(array, start);
		}

		public static Memory<T> AsMemory<T>(this T[] array, int start, int length)
		{
			return new Memory<T>(array, start, length);
		}

		public static Memory<T> AsMemory<T>(this ArraySegment<T> segment)
		{
			return new Memory<T>(segment.Array, segment.Offset, segment.Count);
		}

		public static Memory<T> AsMemory<T>(this ArraySegment<T> segment, int start)
		{
			if ((uint)start > segment.Count)
			{
				System.ThrowHelper.ThrowArgumentOutOfRangeException(System.ExceptionArgument.start);
			}
			return new Memory<T>(segment.Array, segment.Offset + start, segment.Count - start);
		}

		public static Memory<T> AsMemory<T>(this ArraySegment<T> segment, int start, int length)
		{
			if ((uint)start > segment.Count)
			{
				System.ThrowHelper.ThrowArgumentOutOfRangeException(System.ExceptionArgument.start);
			}
			if ((uint)length > segment.Count - start)
			{
				System.ThrowHelper.ThrowArgumentOutOfRangeException(System.ExceptionArgument.length);
			}
			return new Memory<T>(segment.Array, segment.Offset + start, length);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static void CopyTo<T>(this T[] source, Span<T> destination)
		{
			new ReadOnlySpan<T>(source).CopyTo(destination);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static void CopyTo<T>(this T[] source, Memory<T> destination)
		{
			source.CopyTo(destination.Span);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static bool Overlaps<T>(this Span<T> span, ReadOnlySpan<T> other)
		{
			return ((ReadOnlySpan<T>)span).Overlaps(other);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static bool Overlaps<T>(this Span<T> span, ReadOnlySpan<T> other, out int elementOffset)
		{
			return ((ReadOnlySpan<T>)span).Overlaps(other, out elementOffset);
		}

		public static bool Overlaps<T>(this ReadOnlySpan<T> span, ReadOnlySpan<T> other)
		{
			if (span.IsEmpty || other.IsEmpty)
			{
				return false;
			}
			IntPtr intPtr = System.Runtime.CompilerServices.Unsafe.ByteOffset<T>(ref MemoryMarshal.GetReference(span), ref MemoryMarshal.GetReference(other));
			if (System.Runtime.CompilerServices.Unsafe.SizeOf<IntPtr>() == 4)
			{
				if ((uint)(int)intPtr >= (uint)(span.Length * System.Runtime.CompilerServices.Unsafe.SizeOf<T>()))
				{
					return (uint)(int)intPtr > (uint)(-(other.Length * System.Runtime.CompilerServices.Unsafe.SizeOf<T>()));
				}
				return true;
			}
			if ((ulong)(long)intPtr >= (ulong)((long)span.Length * (long)System.Runtime.CompilerServices.Unsafe.SizeOf<T>()))
			{
				return (ulong)(long)intPtr > (ulong)(-((long)other.Length * (long)System.Runtime.CompilerServices.Unsafe.SizeOf<T>()));
			}
			return true;
		}

		public static bool Overlaps<T>(this ReadOnlySpan<T> span, ReadOnlySpan<T> other, out int elementOffset)
		{
			if (span.IsEmpty || other.IsEmpty)
			{
				elementOffset = 0;
				return false;
			}
			IntPtr intPtr = System.Runtime.CompilerServices.Unsafe.ByteOffset<T>(ref MemoryMarshal.GetReference(span), ref MemoryMarshal.GetReference(other));
			if (System.Runtime.CompilerServices.Unsafe.SizeOf<IntPtr>() == 4)
			{
				if ((uint)(int)intPtr < (uint)(span.Length * System.Runtime.CompilerServices.Unsafe.SizeOf<T>()) || (uint)(int)intPtr > (uint)(-(other.Length * System.Runtime.CompilerServices.Unsafe.SizeOf<T>())))
				{
					if ((int)intPtr % System.Runtime.CompilerServices.Unsafe.SizeOf<T>() != 0)
					{
						System.ThrowHelper.ThrowArgumentException_OverlapAlignmentMismatch();
					}
					elementOffset = (int)intPtr / System.Runtime.CompilerServices.Unsafe.SizeOf<T>();
					return true;
				}
				elementOffset = 0;
				return false;
			}
			if ((ulong)(long)intPtr < (ulong)((long)span.Length * (long)System.Runtime.CompilerServices.Unsafe.SizeOf<T>()) || (ulong)(long)intPtr > (ulong)(-((long)other.Length * (long)System.Runtime.CompilerServices.Unsafe.SizeOf<T>())))
			{
				if ((long)intPtr % System.Runtime.CompilerServices.Unsafe.SizeOf<T>() != 0L)
				{
					System.ThrowHelper.ThrowArgumentException_OverlapAlignmentMismatch();
				}
				elementOffset = (int)((long)intPtr / System.Runtime.CompilerServices.Unsafe.SizeOf<T>());
				return true;
			}
			elementOffset = 0;
			return false;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static int BinarySearch<T>(this Span<T> span, IComparable<T> comparable)
		{
			return span.BinarySearch<T, IComparable<T>>(comparable);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static int BinarySearch<T, TComparable>(this Span<T> span, TComparable comparable) where TComparable : IComparable<T>
		{
			return BinarySearch((ReadOnlySpan<T>)span, comparable);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static int BinarySearch<T, TComparer>(this Span<T> span, T value, TComparer comparer) where TComparer : IComparer<T>
		{
			return ((ReadOnlySpan<T>)span).BinarySearch(value, comparer);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static int BinarySearch<T>(this ReadOnlySpan<T> span, IComparable<T> comparable)
		{
			return MemoryExtensions.BinarySearch<T, IComparable<T>>(span, comparable);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static int BinarySearch<T, TComparable>(this ReadOnlySpan<T> span, TComparable comparable) where TComparable : IComparable<T>
		{
			return System.SpanHelpers.BinarySearch(span, comparable);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static int BinarySearch<T, TComparer>(this ReadOnlySpan<T> span, T value, TComparer comparer) where TComparer : IComparer<T>
		{
			if (comparer == null)
			{
				System.ThrowHelper.ThrowArgumentNullException(System.ExceptionArgument.comparer);
			}
			System.SpanHelpers.ComparerComparable<T, TComparer> comparable = new System.SpanHelpers.ComparerComparable<T, TComparer>(value, comparer);
			return BinarySearch(span, comparable);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		private static bool IsTypeComparableAsBytes<T>(out NUInt size)
		{
			if (typeof(T) == typeof(byte) || typeof(T) == typeof(sbyte))
			{
				size = (NUInt)1;
				return true;
			}
			if (typeof(T) == typeof(char) || typeof(T) == typeof(short) || typeof(T) == typeof(ushort))
			{
				size = (NUInt)2;
				return true;
			}
			if (typeof(T) == typeof(int) || typeof(T) == typeof(uint))
			{
				size = (NUInt)4;
				return true;
			}
			if (typeof(T) == typeof(long) || typeof(T) == typeof(ulong))
			{
				size = (NUInt)8;
				return true;
			}
			size = default(NUInt);
			return false;
		}

		public static Span<T> AsSpan<T>(this T[] array, int start)
		{
			return Span<T>.Create(array, start);
		}

		public static bool Contains(this ReadOnlySpan<char> span, ReadOnlySpan<char> value, StringComparison comparisonType)
		{
			return span.IndexOf(value, comparisonType) >= 0;
		}

		public static bool Equals(this ReadOnlySpan<char> span, ReadOnlySpan<char> other, StringComparison comparisonType)
		{
			switch (comparisonType)
			{
			case StringComparison.Ordinal:
				return span.SequenceEqual(other);
			case StringComparison.OrdinalIgnoreCase:
				if (span.Length != other.Length)
				{
					return false;
				}
				return EqualsOrdinalIgnoreCase(span, other);
			default:
				return span.ToString().Equals(other.ToString(), comparisonType);
			}
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		private static bool EqualsOrdinalIgnoreCase(ReadOnlySpan<char> span, ReadOnlySpan<char> other)
		{
			if (other.Length == 0)
			{
				return true;
			}
			return CompareToOrdinalIgnoreCase(span, other) == 0;
		}

		public static int CompareTo(this ReadOnlySpan<char> span, ReadOnlySpan<char> other, StringComparison comparisonType)
		{
			return comparisonType switch
			{
				StringComparison.Ordinal => span.SequenceCompareTo(other), 
				StringComparison.OrdinalIgnoreCase => CompareToOrdinalIgnoreCase(span, other), 
				_ => string.Compare(span.ToString(), other.ToString(), comparisonType), 
			};
		}

		private unsafe static int CompareToOrdinalIgnoreCase(ReadOnlySpan<char> strA, ReadOnlySpan<char> strB)
		{
			int num = Math.Min(strA.Length, strB.Length);
			int num2 = num;
			fixed (char* ptr = &MemoryMarshal.GetReference(strA))
			{
				fixed (char* ptr3 = &MemoryMarshal.GetReference(strB))
				{
					char* ptr2 = ptr;
					char* ptr4 = ptr3;
					while (num != 0 && *ptr2 <= '\u007f' && *ptr4 <= '\u007f')
					{
						int num3 = *ptr2;
						int num4 = *ptr4;
						if (num3 == num4)
						{
							ptr2++;
							ptr4++;
							num--;
							continue;
						}
						if ((uint)(num3 - 97) <= 25u)
						{
							num3 -= 32;
						}
						if ((uint)(num4 - 97) <= 25u)
						{
							num4 -= 32;
						}
						if (num3 != num4)
						{
							return num3 - num4;
						}
						ptr2++;
						ptr4++;
						num--;
					}
					if (num == 0)
					{
						return strA.Length - strB.Length;
					}
					num2 -= num;
					return string.Compare(strA.Slice(num2).ToString(), strB.Slice(num2).ToString(), StringComparison.OrdinalIgnoreCase);
				}
			}
		}

		public static int IndexOf(this ReadOnlySpan<char> span, ReadOnlySpan<char> value, StringComparison comparisonType)
		{
			if (comparisonType == StringComparison.Ordinal)
			{
				return span.IndexOf(value);
			}
			return span.ToString().IndexOf(value.ToString(), comparisonType);
		}

		public static int ToLower(this ReadOnlySpan<char> source, Span<char> destination, CultureInfo culture)
		{
			if (culture == null)
			{
				System.ThrowHelper.ThrowArgumentNullException(System.ExceptionArgument.culture);
			}
			if (destination.Length < source.Length)
			{
				return -1;
			}
			string text = source.ToString();
			string text2 = text.ToLower(culture);
			AsSpan(text2).CopyTo(destination);
			return source.Length;
		}

		public static int ToLowerInvariant(this ReadOnlySpan<char> source, Span<char> destination)
		{
			return source.ToLower(destination, CultureInfo.InvariantCulture);
		}

		public static int ToUpper(this ReadOnlySpan<char> source, Span<char> destination, CultureInfo culture)
		{
			if (culture == null)
			{
				System.ThrowHelper.ThrowArgumentNullException(System.ExceptionArgument.culture);
			}
			if (destination.Length < source.Length)
			{
				return -1;
			}
			string text = source.ToString();
			string text2 = text.ToUpper(culture);
			AsSpan(text2).CopyTo(destination);
			return source.Length;
		}

		public static int ToUpperInvariant(this ReadOnlySpan<char> source, Span<char> destination)
		{
			return source.ToUpper(destination, CultureInfo.InvariantCulture);
		}

		public static bool EndsWith(this ReadOnlySpan<char> span, ReadOnlySpan<char> value, StringComparison comparisonType)
		{
			switch (comparisonType)
			{
			case StringComparison.Ordinal:
				return span.EndsWith(value);
			case StringComparison.OrdinalIgnoreCase:
				if (value.Length <= span.Length)
				{
					return EqualsOrdinalIgnoreCase(span.Slice(span.Length - value.Length), value);
				}
				return false;
			default:
			{
				string text = span.ToString();
				string value2 = value.ToString();
				return text.EndsWith(value2, comparisonType);
			}
			}
		}

		public static bool StartsWith(this ReadOnlySpan<char> span, ReadOnlySpan<char> value, StringComparison comparisonType)
		{
			switch (comparisonType)
			{
			case StringComparison.Ordinal:
				return span.StartsWith(value);
			case StringComparison.OrdinalIgnoreCase:
				if (value.Length <= span.Length)
				{
					return EqualsOrdinalIgnoreCase(span.Slice(0, value.Length), value);
				}
				return false;
			default:
			{
				string text = span.ToString();
				string value2 = value.ToString();
				return text.StartsWith(value2, comparisonType);
			}
			}
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static ReadOnlySpan<char> AsSpan(this string text)
		{
			if (text == null)
			{
				return default(ReadOnlySpan<char>);
			}
			return new ReadOnlySpan<char>(System.Runtime.CompilerServices.Unsafe.As<Pinnable<char>>((object)text), StringAdjustment, text.Length);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static ReadOnlySpan<char> AsSpan(this string text, int start)
		{
			if (text == null)
			{
				if (start != 0)
				{
					System.ThrowHelper.ThrowArgumentOutOfRangeException(System.ExceptionArgument.start);
				}
				return default(ReadOnlySpan<char>);
			}
			if ((uint)start > (uint)text.Length)
			{
				System.ThrowHelper.ThrowArgumentOutOfRangeException(System.ExceptionArgument.start);
			}
			return new ReadOnlySpan<char>(System.Runtime.CompilerServices.Unsafe.As<Pinnable<char>>((object)text), StringAdjustment + start * 2, text.Length - start);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static ReadOnlySpan<char> AsSpan(this string text, int start, int length)
		{
			if (text == null)
			{
				if (start != 0 || length != 0)
				{
					System.ThrowHelper.ThrowArgumentOutOfRangeException(System.ExceptionArgument.start);
				}
				return default(ReadOnlySpan<char>);
			}
			if ((uint)start > (uint)text.Length || (uint)length > (uint)(text.Length - start))
			{
				System.ThrowHelper.ThrowArgumentOutOfRangeException(System.ExceptionArgument.start);
			}
			return new ReadOnlySpan<char>(System.Runtime.CompilerServices.Unsafe.As<Pinnable<char>>((object)text), StringAdjustment + start * 2, length);
		}

		public static ReadOnlyMemory<char> AsMemory(this string text)
		{
			if (text == null)
			{
				return default(ReadOnlyMemory<char>);
			}
			return new ReadOnlyMemory<char>(text, 0, text.Length);
		}

		public static ReadOnlyMemory<char> AsMemory(this string text, int start)
		{
			if (text == null)
			{
				if (start != 0)
				{
					System.ThrowHelper.ThrowArgumentOutOfRangeException(System.ExceptionArgument.start);
				}
				return default(ReadOnlyMemory<char>);
			}
			if ((uint)start > (uint)text.Length)
			{
				System.ThrowHelper.ThrowArgumentOutOfRangeException(System.ExceptionArgument.start);
			}
			return new ReadOnlyMemory<char>(text, start, text.Length - start);
		}

		public static ReadOnlyMemory<char> AsMemory(this string text, int start, int length)
		{
			if (text == null)
			{
				if (start != 0 || length != 0)
				{
					System.ThrowHelper.ThrowArgumentOutOfRangeException(System.ExceptionArgument.start);
				}
				return default(ReadOnlyMemory<char>);
			}
			if ((uint)start > (uint)text.Length || (uint)length > (uint)(text.Length - start))
			{
				System.ThrowHelper.ThrowArgumentOutOfRangeException(System.ExceptionArgument.start);
			}
			return new ReadOnlyMemory<char>(text, start, length);
		}

		private unsafe static IntPtr MeasureStringAdjustment()
		{
			string text = "a";
			fixed (char* ptr = text)
			{
				return System.Runtime.CompilerServices.Unsafe.ByteOffset<char>(ref System.Runtime.CompilerServices.Unsafe.As<Pinnable<char>>((object)text).Data, ref System.Runtime.CompilerServices.Unsafe.AsRef<char>((void*)ptr));
			}
		}
	}
	[DebuggerTypeProxy(typeof(System.MemoryDebugView<>))]
	[DebuggerDisplay("{ToString(),raw}")]
	public readonly struct ReadOnlyMemory<T>
	{
		private readonly object _object;

		private readonly int _index;

		private readonly int _length;

		internal const int RemoveFlagsBitMask = int.MaxValue;

		public static ReadOnlyMemory<T> Empty => default(ReadOnlyMemory<T>);

		public int Length => _length & 0x7FFFFFFF;

		public bool IsEmpty => (_length & 0x7FFFFFFF) == 0;

		public ReadOnlySpan<T> Span
		{
			[MethodImpl(MethodImplOptions.AggressiveInlining)]
			get
			{
				if (_index < 0)
				{
					return ((MemoryManager<T>)_object).GetSpan().Slice(_index & 0x7FFFFFFF, _length);
				}
				ReadOnlySpan<T> result;
				if (typeof(T) == typeof(char) && _object is string text)
				{
					result = new ReadOnlySpan<T>(System.Runtime.CompilerServices.Unsafe.As<Pinnable<T>>((object)text), MemoryExtensions.StringAdjustment, text.Length);
					return result.Slice(_index, _length);
				}
				if (_object != null)
				{
					return new ReadOnlySpan<T>((T[])_object, _index, _length & 0x7FFFFFFF);
				}
				result = default(ReadOnlySpan<T>);
				return result;
			}
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public ReadOnlyMemory(T[] array)
		{
			if (array == null)
			{
				this = default(ReadOnlyMemory<T>);
				return;
			}
			_object = array;
			_index = 0;
			_length = array.Length;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public ReadOnlyMemory(T[] array, int start, int length)
		{
			if (array == null)
			{
				if (start != 0 || length != 0)
				{
					System.ThrowHelper.ThrowArgumentOutOfRangeException();
				}
				this = default(ReadOnlyMemory<T>);
				return;
			}
			if ((uint)start > (uint)array.Length || (uint)length > (uint)(array.Length - start))
			{
				System.ThrowHelper.ThrowArgumentOutOfRangeException();
			}
			_object = array;
			_index = start;
			_length = length;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		internal ReadOnlyMemory(object obj, int start, int length)
		{
			_object = obj;
			_index = start;
			_length = length;
		}

		public static implicit operator ReadOnlyMemory<T>(T[] array)
		{
			return new ReadOnlyMemory<T>(array);
		}

		public static implicit operator ReadOnlyMemory<T>(ArraySegment<T> segment)
		{
			return new ReadOnlyMemory<T>(segment.Array, segment.Offset, segment.Count);
		}

		public override string ToString()
		{
			if (typeof(T) == typeof(char))
			{
				if (!(_object is string text))
				{
					return Span.ToString();
				}
				return text.Substring(_index, _length & 0x7FFFFFFF);
			}
			return $"System.ReadOnlyMemory<{typeof(T).Name}>[{_length & 0x7FFFFFFF}]";
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public ReadOnlyMemory<T> Slice(int start)
		{
			int length = _length;
			int num = length & 0x7FFFFFFF;
			if ((uint)start > (uint)num)
			{
				System.ThrowHelper.ThrowArgumentOutOfRangeException(System.ExceptionArgument.start);
			}
			return new ReadOnlyMemory<T>(_object, _index + start, length - start);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public ReadOnlyMemory<T> Slice(int start, int length)
		{
			int length2 = _length;
			int num = _length & 0x7FFFFFFF;
			if ((uint)start > (uint)num || (uint)length > (uint)(num - start))
			{
				System.ThrowHelper.ThrowArgumentOutOfRangeException(System.ExceptionArgument.start);
			}
			return new ReadOnlyMemory<T>(_object, _index + start, length | (length2 & int.MinValue));
		}

		public void CopyTo(Memory<T> destination)
		{
			Span.CopyTo(destination.Span);
		}

		public bool TryCopyTo(Memory<T> destination)
		{
			return Span.TryCopyTo(destination.Span);
		}

		public unsafe MemoryHandle Pin()
		{
			if (_index < 0)
			{
				return ((MemoryManager<T>)_object).Pin(_index & 0x7FFFFFFF);
			}
			if (typeof(T) == typeof(char) && _object is string value)
			{
				GCHandle handle = GCHandle.Alloc(value, GCHandleType.Pinned);
				void* pointer = System.Runtime.CompilerServices.Unsafe.Add<T>((void*)handle.AddrOfPinnedObject(), _index);
				return new MemoryHandle(pointer, handle);
			}
			if (_object is T[] array)
			{
				if (_length < 0)
				{
					void* pointer2 = System.Runtime.CompilerServices.Unsafe.Add<T>(System.Runtime.CompilerServices.Unsafe.AsPointer<T>(ref MemoryMarshal.GetReference<T>(array)), _index);
					return new MemoryHandle(pointer2);
				}
				GCHandle handle2 = GCHandle.Alloc(array, GCHandleType.Pinned);
				void* pointer3 = System.Runtime.CompilerServices.Unsafe.Add<T>((void*)handle2.AddrOfPinnedObject(), _index);
				return new MemoryHandle(pointer3, handle2);
			}
			return default(MemoryHandle);
		}

		public T[] ToArray()
		{
			return Span.ToArray();
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public override bool Equals(object obj)
		{
			if (obj is ReadOnlyMemory<T> other)
			{
				return Equals(other);
			}
			if (obj is Memory<T> memory)
			{
				return Equals(memory);
			}
			return false;
		}

		public bool Equals(ReadOnlyMemory<T> other)
		{
			if (_object == other._object && _index == other._index)
			{
				return _length == other._length;
			}
			return false;
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public override int GetHashCode()
		{
			if (_object == null)
			{
				return 0;
			}
			int hashCode = _object.GetHashCode();
			int index = _index;
			int hashCode2 = index.GetHashCode();
			index = _length;
			return CombineHashCodes(hashCode, hashCode2, index.GetHashCode());
		}

		private static int CombineHashCodes(int left, int right)
		{
			return ((left << 5) + left) ^ right;
		}

		private static int CombineHashCodes(int h1, int h2, int h3)
		{
			return CombineHashCodes(CombineHashCodes(h1, h2), h3);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		internal object GetObjectStartLength(out int start, out int length)
		{
			start = _index;
			length = _length;
			return _object;
		}
	}
	[DebuggerTypeProxy(typeof(System.SpanDebugView<>))]
	[DebuggerDisplay("{ToString(),raw}")]
	[DebuggerTypeProxy(typeof(System.SpanDebugView<>))]
	[DebuggerDisplay("{ToString(),raw}")]
	public readonly ref struct ReadOnlySpan<T>
	{
		public ref struct Enumerator
		{
			private readonly ReadOnlySpan<T> _span;

			private int _index;

			public ref readonly T Current
			{
				[MethodImpl(MethodImplOptions.AggressiveInlining)]
				get
				{
					return ref _span[_index];
				}
			}

			[MethodImpl(MethodImplOptions.AggressiveInlining)]
			internal Enumerator(ReadOnlySpan<T> span)
			{
				_span = span;
				_index = -1;
			}

			[MethodImpl(MethodImplOptions.AggressiveInlining)]
			public bool MoveNext()
			{
				int num = _index + 1;
				if (num < _span.Length)
				{
					_index = num;
					return true;
				}
				return false;
			}
		}

		private readonly Pinnable<T> _pinnable;

		private readonly IntPtr _byteOffset;

		private readonly int _length;

		public int Length => _length;

		public bool IsEmpty => _length == 0;

		public static ReadOnlySpan<T> Empty => default(ReadOnlySpan<T>);

		public unsafe ref readonly T this[int index]
		{
			[MethodImpl(MethodImplOptions.AggressiveInlining)]
			get
			{
				if ((uint)index >= (uint)_length)
				{
					System.ThrowHelper.ThrowIndexOutOfRangeException();
				}
				if (_pinnable == null)
				{
					IntPtr byteOffset = _byteOffset;
					return ref System.Runtime.CompilerServices.Unsafe.Add<T>(ref System.Runtime.CompilerServices.Unsafe.AsRef<T>(byteOffset.ToPointer()), index);
				}
				return ref System.Runtime.CompilerServices.Unsafe.Add<T>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset<T>(ref _pinnable.Data, _byteOffset), index);
			}
		}

		internal Pinnable<T> Pinnable => _pinnable;

		internal IntPtr ByteOffset => _byteOffset;

		public static bool operator !=(ReadOnlySpan<T> left, ReadOnlySpan<T> right)
		{
			return !(left == right);
		}

		[Obsolete("Equals() on ReadOnlySpan will always throw an exception. Use == instead.")]
		[EditorBrowsable(EditorBrowsableState.Never)]
		public override bool Equals(object obj)
		{
			throw new NotSupportedException(System.SR.NotSupported_CannotCallEqualsOnSpan);
		}

		[Obsolete("GetHashCode() on ReadOnlySpan will always throw an exception.")]
		[EditorBrowsable(EditorBrowsableState.Never)]
		public override int GetHashCode()
		{
			throw new NotSupportedException(System.SR.NotSupported_CannotCallGetHashCodeOnSpan);
		}

		public static implicit operator ReadOnlySpan<T>(T[] array)
		{
			return new ReadOnlySpan<T>(array);
		}

		public static implicit operator ReadOnlySpan<T>(ArraySegment<T> segment)
		{
			return new ReadOnlySpan<T>(segment.Array, segment.Offset, segment.Count);
		}

		public Enumerator GetEnumerator()
		{
			return new Enumerator(this);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public ReadOnlySpan(T[] array)
		{
			if (array == null)
			{
				this = default(ReadOnlySpan<T>);
				return;
			}
			_length = array.Length;
			_pinnable = System.Runtime.CompilerServices.Unsafe.As<Pinnable<T>>((object)array);
			_byteOffset = System.SpanHelpers.PerTypeValues<T>.ArrayAdjustment;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public ReadOnlySpan(T[] array, int start, int length)
		{
			if (array == null)
			{
				if (start != 0 || length != 0)
				{
					System.ThrowHelper.ThrowArgumentOutOfRangeException(System.ExceptionArgument.start);
				}
				this = default(ReadOnlySpan<T>);
				return;
			}
			if ((uint)start > (uint)array.Length || (uint)length > (uint)(array.Length - start))
			{
				System.ThrowHelper.ThrowArgumentOutOfRangeException(System.ExceptionArgument.start);
			}
			_length = length;
			_pinnable = System.Runtime.CompilerServices.Unsafe.As<Pinnable<T>>((object)array);
			_byteOffset = System.SpanHelpers.PerTypeValues<T>.ArrayAdjustment.Add<T>(start);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		[CLSCompliant(false)]
		public unsafe ReadOnlySpan(void* pointer, int length)
		{
			if (System.SpanHelpers.IsReferenceOrContainsReferences<T>())
			{
				System.ThrowHelper.ThrowArgumentException_InvalidTypeWithPointersNotSupported(typeof(T));
			}
			if (length < 0)
			{
				System.ThrowHelper.ThrowArgumentOutOfRangeException(System.ExceptionArgument.start);
			}
			_length = length;
			_pinnable = null;
			_byteOffset = new IntPtr(pointer);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		internal ReadOnlySpan(Pinnable<T> pinnable, IntPtr byteOffset, int length)
		{
			_length = length;
			_pinnable = pinnable;
			_byteOffset = byteOffset;
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public unsafe ref readonly T GetPinnableReference()
		{
			if (_length != 0)
			{
				if (_pinnable == null)
				{
					IntPtr byteOffset = _byteOffset;
					return ref System.Runtime.CompilerServices.Unsafe.AsRef<T>(byteOffset.ToPointer());
				}
				return ref System.Runtime.CompilerServices.Unsafe.AddByteOffset<T>(ref _pinnable.Data, _byteOffset);
			}
			return ref System.Runtime.CompilerServices.Unsafe.AsRef<T>((void*)null);
		}

		public void CopyTo(Span<T> destination)
		{
			if (!TryCopyTo(destination))
			{
				System.ThrowHelper.ThrowArgumentException_DestinationTooShort();
			}
		}

		public bool TryCopyTo(Span<T> destination)
		{
			int length = _length;
			int length2 = destination.Length;
			if (length == 0)
			{
				return true;
			}
			if ((uint)length > (uint)length2)
			{
				return false;
			}
			ref T src = ref DangerousGetPinnableReference();
			System.SpanHelpers.CopyTo(ref destination.DangerousGetPinnableReference(), length2, ref src, length);
			return true;
		}

		public static bool operator ==(ReadOnlySpan<T> left, ReadOnlySpan<T> right)
		{
			if (left._length == right._length)
			{
				return System.Runtime.CompilerServices.Unsafe.AreSame<T>(ref left.DangerousGetPinnableReference(), ref right.DangerousGetPinnableReference());
			}
			return false;
		}

		public unsafe override string ToString()
		{
			if (typeof(T) == typeof(char))
			{
				if (_byteOffset == MemoryExtensions.StringAdjustment)
				{
					object obj = System.Runtime.CompilerServices.Unsafe.As<object>((object)_pinnable);
					if (obj is string text && _length == text.Length)
					{
						return text;
					}
				}
				fixed (char* value = &System.Runtime.CompilerServices.Unsafe.As<T, char>(ref DangerousGetPinnableReference()))
				{
					return new string(value, 0, _length);
				}
			}
			return $"System.ReadOnlySpan<{typeof(T).Name}>[{_length}]";
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public ReadOnlySpan<T> Slice(int start)
		{
			if ((uint)start > (uint)_length)
			{
				System.ThrowHelper.ThrowArgumentOutOfRangeException(System.ExceptionArgument.start);
			}
			IntPtr byteOffset = _byteOffset.Add<T>(start);
			int length = _length - start;
			return new ReadOnlySpan<T>(_pinnable, byteOffset, length);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public ReadOnlySpan<T> Slice(int start, int length)
		{
			if ((uint)start > (uint)_length || (uint)length > (uint)(_length - start))
			{
				System.ThrowHelper.ThrowArgumentOutOfRangeException(System.ExceptionArgument.start);
			}
			IntPtr byteOffset = _byteOffset.Add<T>(start);
			return new ReadOnlySpan<T>(_pinnable, byteOffset, length);
		}

		public T[] ToArray()
		{
			if (_length == 0)
			{
				return System.SpanHelpers.PerTypeValues<T>.EmptyArray;
			}
			T[] array = new T[_length];
			CopyTo(array);
			return array;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		[EditorBrowsable(EditorBrowsableState.Never)]
		internal unsafe ref T DangerousGetPinnableReference()
		{
			if (_pinnable == null)
			{
				IntPtr byteOffset = _byteOffset;
				return ref System.Runtime.CompilerServices.Unsafe.AsRef<T>(byteOffset.ToPointer());
			}
			return ref System.Runtime.CompilerServices.Unsafe.AddByteOffset<T>(ref _pinnable.Data, _byteOffset);
		}
	}
	[DebuggerTypeProxy(typeof(System.SpanDebugView<>))]
	[DebuggerDisplay("{ToString(),raw}")]
	[DebuggerTypeProxy(typeof(System.SpanDebugView<>))]
	[DebuggerDisplay("{ToString(),raw}")]
	public readonly ref struct Span<T>
	{
		public ref struct Enumerator
		{
			private readonly Span<T> _span;

			private int _index;

			public ref T Current
			{
				[MethodImpl(MethodImplOptions.AggressiveInlining)]
				get
				{
					return ref _span[_index];
				}
			}

			[MethodImpl(MethodImplOptions.AggressiveInlining)]
			internal Enumerator(Span<T> span)
			{
				_span = span;
				_index = -1;
			}

			[MethodImpl(MethodImplOptions.AggressiveInlining)]
			public bool MoveNext()
			{
				int num = _index + 1;
				if (num < _span.Length)
				{
					_index = num;
					return true;
				}
				return false;
			}
		}

		private readonly Pinnable<T> _pinnable;

		private readonly IntPtr _byteOffset;

		private readonly int _length;

		public int Length => _length;

		public bool IsEmpty => _length == 0;

		public static Span<T> Empty => default(Span<T>);

		public unsafe ref T this[int index]
		{
			[MethodImpl(MethodImplOptions.AggressiveInlining)]
			get
			{
				if ((uint)index >= (uint)_length)
				{
					System.ThrowHelper.ThrowIndexOutOfRangeException();
				}
				if (_pinnable == null)
				{
					IntPtr byteOffset = _byteOffset;
					return ref System.Runtime.CompilerServices.Unsafe.Add<T>(ref System.Runtime.CompilerServices.Unsafe.AsRef<T>(byteOffset.ToPointer()), index);
				}
				return ref System.Runtime.CompilerServices.Unsafe.Add<T>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset<T>(ref _pinnable.Data, _byteOffset), index);
			}
		}

		internal Pinnable<T> Pinnable => _pinnable;

		internal IntPtr ByteOffset => _byteOffset;

		public static bool operator !=(Span<T> left, Span<T> right)
		{
			return !(left == right);
		}

		[Obsolete("Equals() on Span will always throw an exception. Use == instead.")]
		[EditorBrowsable(EditorBrowsableState.Never)]
		public override bool Equals(object obj)
		{
			throw new NotSupportedException(System.SR.NotSupported_CannotCallEqualsOnSpan);
		}

		[Obsolete("GetHashCode() on Span will always throw an exception.")]
		[EditorBrowsable(EditorBrowsableState.Never)]
		public override int GetHashCode()
		{
			throw new NotSupportedException(System.SR.NotSupported_CannotCallGetHashCodeOnSpan);
		}

		public static implicit operator Span<T>(T[] array)
		{
			return new Span<T>(array);
		}

		public static implicit operator Span<T>(ArraySegment<T> segment)
		{
			return new Span<T>(segment.Array, segment.Offset, segment.Count);
		}

		public Enumerator GetEnumerator()
		{
			return new Enumerator(this);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public Span(T[] array)
		{
			if (array == null)
			{
				this = default(Span<T>);
				return;
			}
			if (default(T) == null && array.GetType() != typeof(T[]))
			{
				System.ThrowHelper.ThrowArrayTypeMismatchException();
			}
			_length = array.Length;
			_pinnable = System.Runtime.CompilerServices.Unsafe.As<Pinnable<T>>((object)array);
			_byteOffset = System.SpanHelpers.PerTypeValues<T>.ArrayAdjustment;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		internal static Span<T> Create(T[] array, int start)
		{
			if (array == null)
			{
				if (start != 0)
				{
					System.ThrowHelper.ThrowArgumentOutOfRangeException(System.ExceptionArgument.start);
				}
				return default(Span<T>);
			}
			if (default(T) == null && array.GetType() != typeof(T[]))
			{
				System.ThrowHelper.ThrowArrayTypeMismatchException();
			}
			if ((uint)start > (uint)array.Length)
			{
				System.ThrowHelper.ThrowArgumentOutOfRangeException(System.ExceptionArgument.start);
			}
			IntPtr byteOffset = System.SpanHelpers.PerTypeValues<T>.ArrayAdjustment.Add<T>(start);
			int length = array.Length - start;
			return new Span<T>(System.Runtime.CompilerServices.Unsafe.As<Pinnable<T>>((object)array), byteOffset, length);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public Span(T[] array, int start, int length)
		{
			if (array == null)
			{
				if (start != 0 || length != 0)
				{
					System.ThrowHelper.ThrowArgumentOutOfRangeException(System.ExceptionArgument.start);
				}
				this = default(Span<T>);
				return;
			}
			if (default(T) == null && array.GetType() != typeof(T[]))
			{
				System.ThrowHelper.ThrowArrayTypeMismatchException();
			}
			if ((uint)start > (uint)array.Length || (uint)length > (uint)(array.Length - start))
			{
				System.ThrowHelper.ThrowArgumentOutOfRangeException(System.ExceptionArgument.start);
			}
			_length = length;
			_pinnable = System.Runtime.CompilerServices.Unsafe.As<Pinnable<T>>((object)array);
			_byteOffset = System.SpanHelpers.PerTypeValues<T>.ArrayAdjustment.Add<T>(start);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		[CLSCompliant(false)]
		public unsafe Span(void* pointer, int length)
		{
			if (System.SpanHelpers.IsReferenceOrContainsReferences<T>())
			{
				System.ThrowHelper.ThrowArgumentException_InvalidTypeWithPointersNotSupported(typeof(T));
			}
			if (length < 0)
			{
				System.ThrowHelper.ThrowArgumentOutOfRangeException(System.ExceptionArgument.start);
			}
			_length = length;
			_pinnable = null;
			_byteOffset = new IntPtr(pointer);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		internal Span(Pinnable<T> pinnable, IntPtr byteOffset, int length)
		{
			_length = length;
			_pinnable = pinnable;
			_byteOffset = byteOffset;
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public unsafe ref T GetPinnableReference()
		{
			if (_length != 0)
			{
				if (_pinnable == null)
				{
					IntPtr byteOffset = _byteOffset;
					return ref System.Runtime.CompilerServices.Unsafe.AsRef<T>(byteOffset.ToPointer());
				}
				return ref System.Runtime.CompilerServices.Unsafe.AddByteOffset<T>(ref _pinnable.Data, _byteOffset);
			}
			return ref System.Runtime.CompilerServices.Unsafe.AsRef<T>((void*)null);
		}

		public unsafe void Clear()
		{
			int length = _length;
			if (length == 0)
			{
				return;
			}
			UIntPtr byteLength = (UIntPtr)(ulong)((uint)length * System.Runtime.CompilerServices.Unsafe.SizeOf<T>());
			if ((System.Runtime.CompilerServices.Unsafe.SizeOf<T>() & (sizeof(IntPtr) - 1)) != 0)
			{
				if (_pinnable == null)
				{
					IntPtr byteOffset = _byteOffset;
					byte* ptr = (byte*)byteOffset.ToPointer();
					System.SpanHelpers.ClearLessThanPointerSized(ptr, byteLength);
				}
				else
				{
					System.SpanHelpers.ClearLessThanPointerSized(ref System.Runtime.CompilerServices.Unsafe.As<T, byte>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset<T>(ref _pinnable.Data, _byteOffset)), byteLength);
				}
			}
			else if (System.SpanHelpers.IsReferenceOrContainsReferences<T>())
			{
				UIntPtr pointerSizeLength = (UIntPtr)(ulong)(length * System.Runtime.CompilerServices.Unsafe.SizeOf<T>() / sizeof(IntPtr));
				System.SpanHelpers.ClearPointerSizedWithReferences(ref System.Runtime.CompilerServices.Unsafe.As<T, IntPtr>(ref DangerousGetPinnableReference()), pointerSizeLength);
			}
			else
			{
				System.SpanHelpers.ClearPointerSizedWithoutReferences(ref System.Runtime.CompilerServices.Unsafe.As<T, byte>(ref DangerousGetPinnableReference()), byteLength);
			}
		}

		public unsafe void Fill(T value)
		{
			int length = _length;
			if (length == 0)
			{
				return;
			}
			if (System.Runtime.CompilerServices.Unsafe.SizeOf<T>() == 1)
			{
				byte b = System.Runtime.CompilerServices.Unsafe.As<T, byte>(ref value);
				if (_pinnable == null)
				{
					IntPtr byteOffset = _byteOffset;
					System.Runtime.CompilerServices.Unsafe.InitBlockUnaligned(byteOffset.ToPointer(), b, (uint)length);
				}
				else
				{
					System.Runtime.CompilerServices.Unsafe.InitBlockUnaligned(ref System.Runtime.CompilerServices.Unsafe.As<T, byte>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset<T>(ref _pinnable.Data, _byteOffset)), b, (uint)length);
				}
				return;
			}
			ref T reference = ref DangerousGetPinnableReference();
			int i;
			for (i = 0; i < (length & -8); i += 8)
			{
				System.Runtime.CompilerServices.Unsafe.Add<T>(ref reference, i) = value;
				System.Runtime.CompilerServices.Unsafe.Add<T>(ref reference, i + 1) = value;
				System.Runtime.CompilerServices.Unsafe.Add<T>(ref reference, i + 2) = value;
				System.Runtime.CompilerServices.Unsafe.Add<T>(ref reference, i + 3) = value;
				System.Runtime.CompilerServices.Unsafe.Add<T>(ref reference, i + 4) = value;
				System.Runtime.CompilerServices.Unsafe.Add<T>(ref reference, i + 5) = value;
				System.Runtime.CompilerServices.Unsafe.Add<T>(ref reference, i + 6) = value;
				System.Runtime.CompilerServices.Unsafe.Add<T>(ref reference, i + 7) = value;
			}
			if (i < (length & -4))
			{
				System.Runtime.CompilerServices.Unsafe.Add<T>(ref reference, i) = value;
				System.Runtime.CompilerServices.Unsafe.Add<T>(ref reference, i + 1) = value;
				System.Runtime.CompilerServices.Unsafe.Add<T>(ref reference, i + 2) = value;
				System.Runtime.CompilerServices.Unsafe.Add<T>(ref reference, i + 3) = value;
				i += 4;
			}
			for (; i < length; i++)
			{
				System.Runtime.CompilerServices.Unsafe.Add<T>(ref reference, i) = value;
			}
		}

		public void CopyTo(Span<T> destination)
		{
			if (!TryCopyTo(destination))
			{
				System.ThrowHelper.ThrowArgumentException_DestinationTooShort();
			}
		}

		public bool TryCopyTo(Span<T> destination)
		{
			int length = _length;
			int length2 = destination._length;
			if (length == 0)
			{
				return true;
			}
			if ((uint)length > (uint)length2)
			{
				return false;
			}
			ref T src = ref DangerousGetPinnableReference();
			System.SpanHelpers.CopyTo(ref destination.DangerousGetPinnableReference(), length2, ref src, length);
			return true;
		}

		public static bool operator ==(Span<T> left, Span<T> right)
		{
			if (left._length == right._length)
			{
				return System.Runtime.CompilerServices.Unsafe.AreSame<T>(ref left.DangerousGetPinnableReference(), ref right.DangerousGetPinnableReference());
			}
			return false;
		}

		public static implicit operator ReadOnlySpan<T>(Span<T> span)
		{
			return new ReadOnlySpan<T>(span._pinnable, span._byteOffset, span._length);
		}

		public unsafe override string ToString()
		{
			if (typeof(T) == typeof(char))
			{
				fixed (char* value = &System.Runtime.CompilerServices.Unsafe.As<T, char>(ref DangerousGetPinnableReference()))
				{
					return new string(value, 0, _length);
				}
			}
			return $"System.Span<{typeof(T).Name}>[{_length}]";
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public Span<T> Slice(int start)
		{
			if ((uint)start > (uint)_length)
			{
				System.ThrowHelper.ThrowArgumentOutOfRangeException(System.ExceptionArgument.start);
			}
			IntPtr byteOffset = _byteOffset.Add<T>(start);
			int length = _length - start;
			return new Span<T>(_pinnable, byteOffset, length);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public Span<T> Slice(int start, int length)
		{
			if ((uint)start > (uint)_length || (uint)length > (uint)(_length - start))
			{
				System.ThrowHelper.ThrowArgumentOutOfRangeException(System.ExceptionArgument.start);
			}
			IntPtr byteOffset = _byteOffset.Add<T>(start);
			return new Span<T>(_pinnable, byteOffset, length);
		}

		public T[] ToArray()
		{
			if (_length == 0)
			{
				return System.SpanHelpers.PerTypeValues<T>.EmptyArray;
			}
			T[] array = new T[_length];
			CopyTo(array);
			return array;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		[EditorBrowsable(EditorBrowsableState.Never)]
		internal unsafe ref T DangerousGetPinnableReference()
		{
			if (_pinnable == null)
			{
				IntPtr byteOffset = _byteOffset;
				return ref System.Runtime.CompilerServices.Unsafe.AsRef<T>(byteOffset.ToPointer());
			}
			return ref System.Runtime.CompilerServices.Unsafe.AddByteOffset<T>(ref _pinnable.Data, _byteOffset);
		}
	}
	internal sealed class SpanDebugView<T>
	{
		private readonly T[] _array;

		[DebuggerBrowsable(DebuggerBrowsableState.RootHidden)]
		public T[] Items => _array;

		public SpanDebugView(Span<T> span)
		{
			_array = span.ToArray();
		}

		public SpanDebugView(ReadOnlySpan<T> span)
		{
			_array = span.ToArray();
		}
	}
	internal static class SpanHelpers
	{
		internal struct ComparerComparable<T, TComparer> : IComparable<T> where TComparer : IComparer<T>
		{
			private readonly T _value;

			private readonly TComparer _comparer;

			public ComparerComparable(T value, TComparer comparer)
			{
				_value = value;
				_comparer = comparer;
			}

			[MethodImpl(MethodImplOptions.AggressiveInlining)]
			public int CompareTo(T other)
			{
				return _comparer.Compare(_value, other);
			}
		}

		[StructLayout(LayoutKind.Sequential, Size = 64)]
		private struct Reg64
		{
		}

		[StructLayout(LayoutKind.Sequential, Size = 32)]
		private struct Reg32
		{
		}

		[StructLayout(LayoutKind.Sequential, Size = 16)]
		private struct Reg16
		{
		}

		public static class PerTypeValues<T>
		{
			public static readonly bool IsReferenceOrContainsReferences = IsReferenceOrContainsReferencesCore(typeof(T));

			public static readonly T[] EmptyArray = new T[0];

			public static readonly IntPtr ArrayAdjustment = MeasureArrayAdjustment();

			private static IntPtr MeasureArrayAdjustment()
			{
				T[] array = new T[1];
				return System.Runtime.CompilerServices.Unsafe.ByteOffset<T>(ref System.Runtime.CompilerServices.Unsafe.As<Pinnable<T>>((object)array).Data, ref array[0]);
			}
		}

		private const ulong XorPowerOfTwoToHighByte = 283686952306184uL;

		private const ulong XorPowerOfTwoToHighChar = 4295098372uL;

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static int BinarySearch<T, TComparable>(this ReadOnlySpan<T> span, TComparable comparable) where TComparable : IComparable<T>
		{
			if (comparable == null)
			{
				System.ThrowHelper.ThrowArgumentNullException(System.ExceptionArgument.comparable);
			}
			return BinarySearch(ref MemoryMarshal.GetReference(span), span.Length, comparable);
		}

		public static int BinarySearch<T, TComparable>(ref T spanStart, int length, TComparable comparable) where TComparable : IComparable<T>
		{
			int num = 0;
			int num2 = length - 1;
			while (num <= num2)
			{
				int num3 = num2 + num >>> 1;
				int num4 = comparable.CompareTo(System.Runtime.CompilerServices.Unsafe.Add<T>(ref spanStart, num3));
				if (num4 == 0)
				{
					return num3;
				}
				if (num4 > 0)
				{
					num = num3 + 1;
				}
				else
				{
					num2 = num3 - 1;
				}
			}
			return ~num;
		}

		public static int IndexOf(ref byte searchSpace, int searchSpaceLength, ref byte value, int valueLength)
		{
			if (valueLength == 0)
			{
				return 0;
			}
			byte value2 = value;
			ref byte second = ref System.Runtime.CompilerServices.Unsafe.Add<byte>(ref value, 1);
			int num = valueLength - 1;
			int num2 = 0;
			while (true)
			{
				int num3 = searchSpaceLength - num2 - num;
				if (num3 <= 0)
				{
					break;
				}
				int num4 = IndexOf(ref System.Runtime.CompilerServices.Unsafe.Add<byte>(ref searchSpace, num2), value2, num3);
				if (num4 == -1)
				{
					break;
				}
				num2 += num4;
				if (SequenceEqual(ref System.Runtime.CompilerServices.Unsafe.Add<byte>(ref searchSpace, num2 + 1), ref second, num))
				{
					return num2;
				}
				num2++;
			}
			return -1;
		}

		public static int IndexOfAny(ref byte searchSpace, int searchSpaceLength, ref byte value, int valueLength)
		{
			if (valueLength == 0)
			{
				return 0;
			}
			int num = -1;
			for (int i = 0; i < valueLength; i++)
			{
				int num2 = IndexOf(ref searchSpace, System.Runtime.CompilerServices.Unsafe.Add<byte>(ref value, i), searchSpaceLength);
				if ((uint)num2 < (uint)num)
				{
					num = num2;
					searchSpaceLength = num2;
					if (num == 0)
					{
						break;
			

BepInEx/plugins/SlopCrew.Plugin/System.Numerics.Vectors.dll

Decompiled 8 months ago
using System;
using System.Diagnostics;
using System.Globalization;
using System.Numerics;
using System.Numerics.Hashing;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security;
using System.Security.Permissions;
using System.Text;
using FxResources.System.Numerics.Vectors;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: AssemblyTitle("System.Numerics.Vectors")]
[assembly: AssemblyDescription("System.Numerics.Vectors")]
[assembly: AssemblyDefaultAlias("System.Numerics.Vectors")]
[assembly: AssemblyCompany("Microsoft Corporation")]
[assembly: AssemblyProduct("Microsoft® .NET Framework")]
[assembly: AssemblyCopyright("© Microsoft Corporation.  All rights reserved.")]
[assembly: AssemblyFileVersion("4.6.26515.06")]
[assembly: AssemblyInformationalVersion("4.6.26515.06 @BuiltBy: dlab-DDVSOWINAGE059 @Branch: release/2.1 @SrcCode: https://github.com/dotnet/corefx/tree/30ab651fcb4354552bd4891619a0bdd81e0ebdbf")]
[assembly: CLSCompliant(true)]
[assembly: AssemblyMetadata(".NETFrameworkAssembly", "")]
[assembly: AssemblyMetadata("Serviceable", "True")]
[assembly: AssemblyMetadata("PreferInbox", "True")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("4.1.4.0")]
[assembly: TypeForwardedTo(typeof(Matrix3x2))]
[assembly: TypeForwardedTo(typeof(Matrix4x4))]
[assembly: TypeForwardedTo(typeof(Plane))]
[assembly: TypeForwardedTo(typeof(Quaternion))]
[assembly: TypeForwardedTo(typeof(Vector2))]
[assembly: TypeForwardedTo(typeof(Vector3))]
[assembly: TypeForwardedTo(typeof(Vector4))]
[module: UnverifiableCode]
namespace FxResources.System.Numerics.Vectors
{
	internal static class SR
	{
	}
}
namespace System
{
	internal static class MathF
	{
		public const float PI = 3.1415927f;

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static float Abs(float x)
		{
			return Math.Abs(x);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static float Acos(float x)
		{
			return (float)Math.Acos(x);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static float Cos(float x)
		{
			return (float)Math.Cos(x);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static float IEEERemainder(float x, float y)
		{
			return (float)Math.IEEERemainder(x, y);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static float Pow(float x, float y)
		{
			return (float)Math.Pow(x, y);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static float Sin(float x)
		{
			return (float)Math.Sin(x);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static float Sqrt(float x)
		{
			return (float)Math.Sqrt(x);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static float Tan(float x)
		{
			return (float)Math.Tan(x);
		}
	}
	internal static class SR
	{
		private static ResourceManager s_resourceManager;

		private static ResourceManager ResourceManager => s_resourceManager ?? (s_resourceManager = new ResourceManager(ResourceType));

		internal static Type ResourceType { get; } = typeof(SR);


		internal static string Arg_ArgumentOutOfRangeException => GetResourceString("Arg_ArgumentOutOfRangeException", null);

		internal static string Arg_ElementsInSourceIsGreaterThanDestination => GetResourceString("Arg_ElementsInSourceIsGreaterThanDestination", null);

		internal static string Arg_NullArgumentNullRef => GetResourceString("Arg_NullArgumentNullRef", null);

		internal static string Arg_TypeNotSupported => GetResourceString("Arg_TypeNotSupported", null);

		internal static string Arg_InsufficientNumberOfElements => GetResourceString("Arg_InsufficientNumberOfElements", null);

		[MethodImpl(MethodImplOptions.NoInlining)]
		private static bool UsingResourceKeys()
		{
			return false;
		}

		internal static string GetResourceString(string resourceKey, string defaultString)
		{
			string text = null;
			try
			{
				text = ResourceManager.GetString(resourceKey);
			}
			catch (MissingManifestResourceException)
			{
			}
			if (defaultString != null && resourceKey.Equals(text, StringComparison.Ordinal))
			{
				return defaultString;
			}
			return text;
		}

		internal static string Format(string resourceFormat, params object[] args)
		{
			if (args != null)
			{
				if (UsingResourceKeys())
				{
					return resourceFormat + string.Join(", ", args);
				}
				return string.Format(resourceFormat, args);
			}
			return resourceFormat;
		}

		internal static string Format(string resourceFormat, object p1)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1);
			}
			return string.Format(resourceFormat, p1);
		}

		internal static string Format(string resourceFormat, object p1, object p2)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2);
			}
			return string.Format(resourceFormat, p1, p2);
		}

		internal static string Format(string resourceFormat, object p1, object p2, object p3)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2, p3);
			}
			return string.Format(resourceFormat, p1, p2, p3);
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Field, Inherited = false)]
	internal sealed class IntrinsicAttribute : Attribute
	{
	}
}
namespace System.Numerics
{
	internal class ConstantHelper
	{
		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static byte GetByteWithAllBitsSet()
		{
			byte result = 0;
			result = byte.MaxValue;
			return result;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static sbyte GetSByteWithAllBitsSet()
		{
			sbyte result = 0;
			result = -1;
			return result;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static ushort GetUInt16WithAllBitsSet()
		{
			ushort result = 0;
			result = ushort.MaxValue;
			return result;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static short GetInt16WithAllBitsSet()
		{
			short result = 0;
			result = -1;
			return result;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static uint GetUInt32WithAllBitsSet()
		{
			uint result = 0u;
			result = uint.MaxValue;
			return result;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static int GetInt32WithAllBitsSet()
		{
			int result = 0;
			result = -1;
			return result;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static ulong GetUInt64WithAllBitsSet()
		{
			ulong result = 0uL;
			result = ulong.MaxValue;
			return result;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static long GetInt64WithAllBitsSet()
		{
			long result = 0L;
			result = -1L;
			return result;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public unsafe static float GetSingleWithAllBitsSet()
		{
			float result = 0f;
			*(int*)(&result) = -1;
			return result;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public unsafe static double GetDoubleWithAllBitsSet()
		{
			double result = 0.0;
			*(long*)(&result) = -1L;
			return result;
		}
	}
	[StructLayout(LayoutKind.Explicit)]
	internal struct Register
	{
		[FieldOffset(0)]
		internal byte byte_0;

		[FieldOffset(1)]
		internal byte byte_1;

		[FieldOffset(2)]
		internal byte byte_2;

		[FieldOffset(3)]
		internal byte byte_3;

		[FieldOffset(4)]
		internal byte byte_4;

		[FieldOffset(5)]
		internal byte byte_5;

		[FieldOffset(6)]
		internal byte byte_6;

		[FieldOffset(7)]
		internal byte byte_7;

		[FieldOffset(8)]
		internal byte byte_8;

		[FieldOffset(9)]
		internal byte byte_9;

		[FieldOffset(10)]
		internal byte byte_10;

		[FieldOffset(11)]
		internal byte byte_11;

		[FieldOffset(12)]
		internal byte byte_12;

		[FieldOffset(13)]
		internal byte byte_13;

		[FieldOffset(14)]
		internal byte byte_14;

		[FieldOffset(15)]
		internal byte byte_15;

		[FieldOffset(0)]
		internal sbyte sbyte_0;

		[FieldOffset(1)]
		internal sbyte sbyte_1;

		[FieldOffset(2)]
		internal sbyte sbyte_2;

		[FieldOffset(3)]
		internal sbyte sbyte_3;

		[FieldOffset(4)]
		internal sbyte sbyte_4;

		[FieldOffset(5)]
		internal sbyte sbyte_5;

		[FieldOffset(6)]
		internal sbyte sbyte_6;

		[FieldOffset(7)]
		internal sbyte sbyte_7;

		[FieldOffset(8)]
		internal sbyte sbyte_8;

		[FieldOffset(9)]
		internal sbyte sbyte_9;

		[FieldOffset(10)]
		internal sbyte sbyte_10;

		[FieldOffset(11)]
		internal sbyte sbyte_11;

		[FieldOffset(12)]
		internal sbyte sbyte_12;

		[FieldOffset(13)]
		internal sbyte sbyte_13;

		[FieldOffset(14)]
		internal sbyte sbyte_14;

		[FieldOffset(15)]
		internal sbyte sbyte_15;

		[FieldOffset(0)]
		internal ushort uint16_0;

		[FieldOffset(2)]
		internal ushort uint16_1;

		[FieldOffset(4)]
		internal ushort uint16_2;

		[FieldOffset(6)]
		internal ushort uint16_3;

		[FieldOffset(8)]
		internal ushort uint16_4;

		[FieldOffset(10)]
		internal ushort uint16_5;

		[FieldOffset(12)]
		internal ushort uint16_6;

		[FieldOffset(14)]
		internal ushort uint16_7;

		[FieldOffset(0)]
		internal short int16_0;

		[FieldOffset(2)]
		internal short int16_1;

		[FieldOffset(4)]
		internal short int16_2;

		[FieldOffset(6)]
		internal short int16_3;

		[FieldOffset(8)]
		internal short int16_4;

		[FieldOffset(10)]
		internal short int16_5;

		[FieldOffset(12)]
		internal short int16_6;

		[FieldOffset(14)]
		internal short int16_7;

		[FieldOffset(0)]
		internal uint uint32_0;

		[FieldOffset(4)]
		internal uint uint32_1;

		[FieldOffset(8)]
		internal uint uint32_2;

		[FieldOffset(12)]
		internal uint uint32_3;

		[FieldOffset(0)]
		internal int int32_0;

		[FieldOffset(4)]
		internal int int32_1;

		[FieldOffset(8)]
		internal int int32_2;

		[FieldOffset(12)]
		internal int int32_3;

		[FieldOffset(0)]
		internal ulong uint64_0;

		[FieldOffset(8)]
		internal ulong uint64_1;

		[FieldOffset(0)]
		internal long int64_0;

		[FieldOffset(8)]
		internal long int64_1;

		[FieldOffset(0)]
		internal float single_0;

		[FieldOffset(4)]
		internal float single_1;

		[FieldOffset(8)]
		internal float single_2;

		[FieldOffset(12)]
		internal float single_3;

		[FieldOffset(0)]
		internal double double_0;

		[FieldOffset(8)]
		internal double double_1;
	}
	[System.Runtime.CompilerServices.Intrinsic]
	public struct Vector<T> : IEquatable<Vector<T>>, IFormattable where T : struct
	{
		private struct VectorSizeHelper
		{
			internal Vector<T> _placeholder;

			internal byte _byte;
		}

		private System.Numerics.Register register;

		private static readonly int s_count = InitializeCount();

		private static readonly Vector<T> s_zero = default(Vector<T>);

		private static readonly Vector<T> s_one = new Vector<T>(GetOneValue());

		private static readonly Vector<T> s_allOnes = new Vector<T>(GetAllBitsSetValue());

		public static int Count
		{
			[System.Runtime.CompilerServices.Intrinsic]
			get
			{
				return s_count;
			}
		}

		public static Vector<T> Zero
		{
			[System.Runtime.CompilerServices.Intrinsic]
			get
			{
				return s_zero;
			}
		}

		public static Vector<T> One
		{
			[System.Runtime.CompilerServices.Intrinsic]
			get
			{
				return s_one;
			}
		}

		internal static Vector<T> AllOnes => s_allOnes;

		public unsafe T this[int index]
		{
			[System.Runtime.CompilerServices.Intrinsic]
			get
			{
				if (index >= Count || index < 0)
				{
					throw new IndexOutOfRangeException(System.SR.Format(System.SR.Arg_ArgumentOutOfRangeException, index));
				}
				if (typeof(T) == typeof(byte))
				{
					fixed (byte* ptr = &register.byte_0)
					{
						return (T)(object)ptr[index];
					}
				}
				if (typeof(T) == typeof(sbyte))
				{
					fixed (sbyte* ptr2 = &register.sbyte_0)
					{
						return (T)(object)ptr2[index];
					}
				}
				if (typeof(T) == typeof(ushort))
				{
					fixed (ushort* ptr3 = &register.uint16_0)
					{
						return (T)(object)ptr3[index];
					}
				}
				if (typeof(T) == typeof(short))
				{
					fixed (short* ptr4 = &register.int16_0)
					{
						return (T)(object)ptr4[index];
					}
				}
				if (typeof(T) == typeof(uint))
				{
					fixed (uint* ptr5 = &register.uint32_0)
					{
						return (T)(object)ptr5[index];
					}
				}
				if (typeof(T) == typeof(int))
				{
					fixed (int* ptr6 = &register.int32_0)
					{
						return (T)(object)ptr6[index];
					}
				}
				if (typeof(T) == typeof(ulong))
				{
					fixed (ulong* ptr7 = &register.uint64_0)
					{
						return (T)(object)ptr7[index];
					}
				}
				if (typeof(T) == typeof(long))
				{
					fixed (long* ptr8 = &register.int64_0)
					{
						return (T)(object)ptr8[index];
					}
				}
				if (typeof(T) == typeof(float))
				{
					fixed (float* ptr9 = &register.single_0)
					{
						return (T)(object)ptr9[index];
					}
				}
				if (typeof(T) == typeof(double))
				{
					fixed (double* ptr10 = &register.double_0)
					{
						return (T)(object)ptr10[index];
					}
				}
				throw new NotSupportedException(System.SR.Arg_TypeNotSupported);
			}
		}

		private unsafe static int InitializeCount()
		{
			VectorSizeHelper vectorSizeHelper = default(VectorSizeHelper);
			byte* ptr = &vectorSizeHelper._placeholder.register.byte_0;
			byte* ptr2 = &vectorSizeHelper._byte;
			int num = (int)(ptr2 - ptr);
			int num2 = -1;
			if (typeof(T) == typeof(byte))
			{
				num2 = 1;
			}
			else if (typeof(T) == typeof(sbyte))
			{
				num2 = 1;
			}
			else if (typeof(T) == typeof(ushort))
			{
				num2 = 2;
			}
			else if (typeof(T) == typeof(short))
			{
				num2 = 2;
			}
			else if (typeof(T) == typeof(uint))
			{
				num2 = 4;
			}
			else if (typeof(T) == typeof(int))
			{
				num2 = 4;
			}
			else if (typeof(T) == typeof(ulong))
			{
				num2 = 8;
			}
			else if (typeof(T) == typeof(long))
			{
				num2 = 8;
			}
			else if (typeof(T) == typeof(float))
			{
				num2 = 4;
			}
			else
			{
				if (!(typeof(T) == typeof(double)))
				{
					throw new NotSupportedException(System.SR.Arg_TypeNotSupported);
				}
				num2 = 8;
			}
			return num / num2;
		}

		[System.Runtime.CompilerServices.Intrinsic]
		public unsafe Vector(T value)
		{
			this = default(Vector<T>);
			if (Vector.IsHardwareAccelerated)
			{
				if (typeof(T) == typeof(byte))
				{
					fixed (byte* ptr = &register.byte_0)
					{
						for (int i = 0; i < Count; i++)
						{
							ptr[i] = (byte)(object)value;
						}
					}
				}
				else if (typeof(T) == typeof(sbyte))
				{
					fixed (sbyte* ptr2 = &register.sbyte_0)
					{
						for (int j = 0; j < Count; j++)
						{
							ptr2[j] = (sbyte)(object)value;
						}
					}
				}
				else if (typeof(T) == typeof(ushort))
				{
					fixed (ushort* ptr3 = &register.uint16_0)
					{
						for (int k = 0; k < Count; k++)
						{
							ptr3[k] = (ushort)(object)value;
						}
					}
				}
				else if (typeof(T) == typeof(short))
				{
					fixed (short* ptr4 = &register.int16_0)
					{
						for (int l = 0; l < Count; l++)
						{
							ptr4[l] = (short)(object)value;
						}
					}
				}
				else if (typeof(T) == typeof(uint))
				{
					fixed (uint* ptr5 = &register.uint32_0)
					{
						for (int m = 0; m < Count; m++)
						{
							ptr5[m] = (uint)(object)value;
						}
					}
				}
				else if (typeof(T) == typeof(int))
				{
					fixed (int* ptr6 = &register.int32_0)
					{
						for (int n = 0; n < Count; n++)
						{
							ptr6[n] = (int)(object)value;
						}
					}
				}
				else if (typeof(T) == typeof(ulong))
				{
					fixed (ulong* ptr7 = &register.uint64_0)
					{
						for (int num = 0; num < Count; num++)
						{
							ptr7[num] = (ulong)(object)value;
						}
					}
				}
				else if (typeof(T) == typeof(long))
				{
					fixed (long* ptr8 = &register.int64_0)
					{
						for (int num2 = 0; num2 < Count; num2++)
						{
							ptr8[num2] = (long)(object)value;
						}
					}
				}
				else if (typeof(T) == typeof(float))
				{
					fixed (float* ptr9 = &register.single_0)
					{
						for (int num3 = 0; num3 < Count; num3++)
						{
							ptr9[num3] = (float)(object)value;
						}
					}
				}
				else
				{
					if (!(typeof(T) == typeof(double)))
					{
						return;
					}
					fixed (double* ptr10 = &register.double_0)
					{
						for (int num4 = 0; num4 < Count; num4++)
						{
							ptr10[num4] = (double)(object)value;
						}
					}
				}
			}
			else if (typeof(T) == typeof(byte))
			{
				register.byte_0 = (byte)(object)value;
				register.byte_1 = (byte)(object)value;
				register.byte_2 = (byte)(object)value;
				register.byte_3 = (byte)(object)value;
				register.byte_4 = (byte)(object)value;
				register.byte_5 = (byte)(object)value;
				register.byte_6 = (byte)(object)value;
				register.byte_7 = (byte)(object)value;
				register.byte_8 = (byte)(object)value;
				register.byte_9 = (byte)(object)value;
				register.byte_10 = (byte)(object)value;
				register.byte_11 = (byte)(object)value;
				register.byte_12 = (byte)(object)value;
				register.byte_13 = (byte)(object)value;
				register.byte_14 = (byte)(object)value;
				register.byte_15 = (byte)(object)value;
			}
			else if (typeof(T) == typeof(sbyte))
			{
				register.sbyte_0 = (sbyte)(object)value;
				register.sbyte_1 = (sbyte)(object)value;
				register.sbyte_2 = (sbyte)(object)value;
				register.sbyte_3 = (sbyte)(object)value;
				register.sbyte_4 = (sbyte)(object)value;
				register.sbyte_5 = (sbyte)(object)value;
				register.sbyte_6 = (sbyte)(object)value;
				register.sbyte_7 = (sbyte)(object)value;
				register.sbyte_8 = (sbyte)(object)value;
				register.sbyte_9 = (sbyte)(object)value;
				register.sbyte_10 = (sbyte)(object)value;
				register.sbyte_11 = (sbyte)(object)value;
				register.sbyte_12 = (sbyte)(object)value;
				register.sbyte_13 = (sbyte)(object)value;
				register.sbyte_14 = (sbyte)(object)value;
				register.sbyte_15 = (sbyte)(object)value;
			}
			else if (typeof(T) == typeof(ushort))
			{
				register.uint16_0 = (ushort)(object)value;
				register.uint16_1 = (ushort)(object)value;
				register.uint16_2 = (ushort)(object)value;
				register.uint16_3 = (ushort)(object)value;
				register.uint16_4 = (ushort)(object)value;
				register.uint16_5 = (ushort)(object)value;
				register.uint16_6 = (ushort)(object)value;
				register.uint16_7 = (ushort)(object)value;
			}
			else if (typeof(T) == typeof(short))
			{
				register.int16_0 = (short)(object)value;
				register.int16_1 = (short)(object)value;
				register.int16_2 = (short)(object)value;
				register.int16_3 = (short)(object)value;
				register.int16_4 = (short)(object)value;
				register.int16_5 = (short)(object)value;
				register.int16_6 = (short)(object)value;
				register.int16_7 = (short)(object)value;
			}
			else if (typeof(T) == typeof(uint))
			{
				register.uint32_0 = (uint)(object)value;
				register.uint32_1 = (uint)(object)value;
				register.uint32_2 = (uint)(object)value;
				register.uint32_3 = (uint)(object)value;
			}
			else if (typeof(T) == typeof(int))
			{
				register.int32_0 = (int)(object)value;
				register.int32_1 = (int)(object)value;
				register.int32_2 = (int)(object)value;
				register.int32_3 = (int)(object)value;
			}
			else if (typeof(T) == typeof(ulong))
			{
				register.uint64_0 = (ulong)(object)value;
				register.uint64_1 = (ulong)(object)value;
			}
			else if (typeof(T) == typeof(long))
			{
				register.int64_0 = (long)(object)value;
				register.int64_1 = (long)(object)value;
			}
			else if (typeof(T) == typeof(float))
			{
				register.single_0 = (float)(object)value;
				register.single_1 = (float)(object)value;
				register.single_2 = (float)(object)value;
				register.single_3 = (float)(object)value;
			}
			else if (typeof(T) == typeof(double))
			{
				register.double_0 = (double)(object)value;
				register.double_1 = (double)(object)value;
			}
		}

		[System.Runtime.CompilerServices.Intrinsic]
		public Vector(T[] values)
			: this(values, 0)
		{
		}

		public unsafe Vector(T[] values, int index)
		{
			this = default(Vector<T>);
			if (values == null)
			{
				throw new NullReferenceException(System.SR.Arg_NullArgumentNullRef);
			}
			if (index < 0 || values.Length - index < Count)
			{
				throw new IndexOutOfRangeException(System.SR.Format(System.SR.Arg_InsufficientNumberOfElements, Count, "values"));
			}
			if (Vector.IsHardwareAccelerated)
			{
				if (typeof(T) == typeof(byte))
				{
					fixed (byte* ptr = &register.byte_0)
					{
						for (int i = 0; i < Count; i++)
						{
							ptr[i] = (byte)(object)values[i + index];
						}
					}
				}
				else if (typeof(T) == typeof(sbyte))
				{
					fixed (sbyte* ptr2 = &register.sbyte_0)
					{
						for (int j = 0; j < Count; j++)
						{
							ptr2[j] = (sbyte)(object)values[j + index];
						}
					}
				}
				else if (typeof(T) == typeof(ushort))
				{
					fixed (ushort* ptr3 = &register.uint16_0)
					{
						for (int k = 0; k < Count; k++)
						{
							ptr3[k] = (ushort)(object)values[k + index];
						}
					}
				}
				else if (typeof(T) == typeof(short))
				{
					fixed (short* ptr4 = &register.int16_0)
					{
						for (int l = 0; l < Count; l++)
						{
							ptr4[l] = (short)(object)values[l + index];
						}
					}
				}
				else if (typeof(T) == typeof(uint))
				{
					fixed (uint* ptr5 = &register.uint32_0)
					{
						for (int m = 0; m < Count; m++)
						{
							ptr5[m] = (uint)(object)values[m + index];
						}
					}
				}
				else if (typeof(T) == typeof(int))
				{
					fixed (int* ptr6 = &register.int32_0)
					{
						for (int n = 0; n < Count; n++)
						{
							ptr6[n] = (int)(object)values[n + index];
						}
					}
				}
				else if (typeof(T) == typeof(ulong))
				{
					fixed (ulong* ptr7 = &register.uint64_0)
					{
						for (int num = 0; num < Count; num++)
						{
							ptr7[num] = (ulong)(object)values[num + index];
						}
					}
				}
				else if (typeof(T) == typeof(long))
				{
					fixed (long* ptr8 = &register.int64_0)
					{
						for (int num2 = 0; num2 < Count; num2++)
						{
							ptr8[num2] = (long)(object)values[num2 + index];
						}
					}
				}
				else if (typeof(T) == typeof(float))
				{
					fixed (float* ptr9 = &register.single_0)
					{
						for (int num3 = 0; num3 < Count; num3++)
						{
							ptr9[num3] = (float)(object)values[num3 + index];
						}
					}
				}
				else
				{
					if (!(typeof(T) == typeof(double)))
					{
						return;
					}
					fixed (double* ptr10 = &register.double_0)
					{
						for (int num4 = 0; num4 < Count; num4++)
						{
							ptr10[num4] = (double)(object)values[num4 + index];
						}
					}
				}
			}
			else if (typeof(T) == typeof(byte))
			{
				fixed (byte* ptr11 = &register.byte_0)
				{
					*ptr11 = (byte)(object)values[index];
					ptr11[1] = (byte)(object)values[1 + index];
					ptr11[2] = (byte)(object)values[2 + index];
					ptr11[3] = (byte)(object)values[3 + index];
					ptr11[4] = (byte)(object)values[4 + index];
					ptr11[5] = (byte)(object)values[5 + index];
					ptr11[6] = (byte)(object)values[6 + index];
					ptr11[7] = (byte)(object)values[7 + index];
					ptr11[8] = (byte)(object)values[8 + index];
					ptr11[9] = (byte)(object)values[9 + index];
					ptr11[10] = (byte)(object)values[10 + index];
					ptr11[11] = (byte)(object)values[11 + index];
					ptr11[12] = (byte)(object)values[12 + index];
					ptr11[13] = (byte)(object)values[13 + index];
					ptr11[14] = (byte)(object)values[14 + index];
					ptr11[15] = (byte)(object)values[15 + index];
				}
			}
			else if (typeof(T) == typeof(sbyte))
			{
				fixed (sbyte* ptr12 = &register.sbyte_0)
				{
					*ptr12 = (sbyte)(object)values[index];
					ptr12[1] = (sbyte)(object)values[1 + index];
					ptr12[2] = (sbyte)(object)values[2 + index];
					ptr12[3] = (sbyte)(object)values[3 + index];
					ptr12[4] = (sbyte)(object)values[4 + index];
					ptr12[5] = (sbyte)(object)values[5 + index];
					ptr12[6] = (sbyte)(object)values[6 + index];
					ptr12[7] = (sbyte)(object)values[7 + index];
					ptr12[8] = (sbyte)(object)values[8 + index];
					ptr12[9] = (sbyte)(object)values[9 + index];
					ptr12[10] = (sbyte)(object)values[10 + index];
					ptr12[11] = (sbyte)(object)values[11 + index];
					ptr12[12] = (sbyte)(object)values[12 + index];
					ptr12[13] = (sbyte)(object)values[13 + index];
					ptr12[14] = (sbyte)(object)values[14 + index];
					ptr12[15] = (sbyte)(object)values[15 + index];
				}
			}
			else if (typeof(T) == typeof(ushort))
			{
				fixed (ushort* ptr13 = &register.uint16_0)
				{
					*ptr13 = (ushort)(object)values[index];
					ptr13[1] = (ushort)(object)values[1 + index];
					ptr13[2] = (ushort)(object)values[2 + index];
					ptr13[3] = (ushort)(object)values[3 + index];
					ptr13[4] = (ushort)(object)values[4 + index];
					ptr13[5] = (ushort)(object)values[5 + index];
					ptr13[6] = (ushort)(object)values[6 + index];
					ptr13[7] = (ushort)(object)values[7 + index];
				}
			}
			else if (typeof(T) == typeof(short))
			{
				fixed (short* ptr14 = &register.int16_0)
				{
					*ptr14 = (short)(object)values[index];
					ptr14[1] = (short)(object)values[1 + index];
					ptr14[2] = (short)(object)values[2 + index];
					ptr14[3] = (short)(object)values[3 + index];
					ptr14[4] = (short)(object)values[4 + index];
					ptr14[5] = (short)(object)values[5 + index];
					ptr14[6] = (short)(object)values[6 + index];
					ptr14[7] = (short)(object)values[7 + index];
				}
			}
			else if (typeof(T) == typeof(uint))
			{
				fixed (uint* ptr15 = &register.uint32_0)
				{
					*ptr15 = (uint)(object)values[index];
					ptr15[1] = (uint)(object)values[1 + index];
					ptr15[2] = (uint)(object)values[2 + index];
					ptr15[3] = (uint)(object)values[3 + index];
				}
			}
			else if (typeof(T) == typeof(int))
			{
				fixed (int* ptr16 = &register.int32_0)
				{
					*ptr16 = (int)(object)values[index];
					ptr16[1] = (int)(object)values[1 + index];
					ptr16[2] = (int)(object)values[2 + index];
					ptr16[3] = (int)(object)values[3 + index];
				}
			}
			else if (typeof(T) == typeof(ulong))
			{
				fixed (ulong* ptr17 = &register.uint64_0)
				{
					*ptr17 = (ulong)(object)values[index];
					ptr17[1] = (ulong)(object)values[1 + index];
				}
			}
			else if (typeof(T) == typeof(long))
			{
				fixed (long* ptr18 = &register.int64_0)
				{
					*ptr18 = (long)(object)values[index];
					ptr18[1] = (long)(object)values[1 + index];
				}
			}
			else if (typeof(T) == typeof(float))
			{
				fixed (float* ptr19 = &register.single_0)
				{
					*ptr19 = (float)(object)values[index];
					ptr19[1] = (float)(object)values[1 + index];
					ptr19[2] = (float)(object)values[2 + index];
					ptr19[3] = (float)(object)values[3 + index];
				}
			}
			else if (typeof(T) == typeof(double))
			{
				fixed (double* ptr20 = &register.double_0)
				{
					*ptr20 = (double)(object)values[index];
					ptr20[1] = (double)(object)values[1 + index];
				}
			}
		}

		internal unsafe Vector(void* dataPointer)
			: this(dataPointer, 0)
		{
		}

		internal unsafe Vector(void* dataPointer, int offset)
		{
			this = default(Vector<T>);
			if (typeof(T) == typeof(byte))
			{
				byte* ptr = (byte*)dataPointer;
				ptr += offset;
				fixed (byte* ptr2 = &register.byte_0)
				{
					for (int i = 0; i < Count; i++)
					{
						ptr2[i] = ptr[i];
					}
				}
				return;
			}
			if (typeof(T) == typeof(sbyte))
			{
				sbyte* ptr3 = (sbyte*)dataPointer;
				ptr3 += offset;
				fixed (sbyte* ptr4 = &register.sbyte_0)
				{
					for (int j = 0; j < Count; j++)
					{
						ptr4[j] = ptr3[j];
					}
				}
				return;
			}
			if (typeof(T) == typeof(ushort))
			{
				ushort* ptr5 = (ushort*)dataPointer;
				ptr5 += offset;
				fixed (ushort* ptr6 = &register.uint16_0)
				{
					for (int k = 0; k < Count; k++)
					{
						ptr6[k] = ptr5[k];
					}
				}
				return;
			}
			if (typeof(T) == typeof(short))
			{
				short* ptr7 = (short*)dataPointer;
				ptr7 += offset;
				fixed (short* ptr8 = &register.int16_0)
				{
					for (int l = 0; l < Count; l++)
					{
						ptr8[l] = ptr7[l];
					}
				}
				return;
			}
			if (typeof(T) == typeof(uint))
			{
				uint* ptr9 = (uint*)dataPointer;
				ptr9 += offset;
				fixed (uint* ptr10 = &register.uint32_0)
				{
					for (int m = 0; m < Count; m++)
					{
						ptr10[m] = ptr9[m];
					}
				}
				return;
			}
			if (typeof(T) == typeof(int))
			{
				int* ptr11 = (int*)dataPointer;
				ptr11 += offset;
				fixed (int* ptr12 = &register.int32_0)
				{
					for (int n = 0; n < Count; n++)
					{
						ptr12[n] = ptr11[n];
					}
				}
				return;
			}
			if (typeof(T) == typeof(ulong))
			{
				ulong* ptr13 = (ulong*)dataPointer;
				ptr13 += offset;
				fixed (ulong* ptr14 = &register.uint64_0)
				{
					for (int num = 0; num < Count; num++)
					{
						ptr14[num] = ptr13[num];
					}
				}
				return;
			}
			if (typeof(T) == typeof(long))
			{
				long* ptr15 = (long*)dataPointer;
				ptr15 += offset;
				fixed (long* ptr16 = &register.int64_0)
				{
					for (int num2 = 0; num2 < Count; num2++)
					{
						ptr16[num2] = ptr15[num2];
					}
				}
				return;
			}
			if (typeof(T) == typeof(float))
			{
				float* ptr17 = (float*)dataPointer;
				ptr17 += offset;
				fixed (float* ptr18 = &register.single_0)
				{
					for (int num3 = 0; num3 < Count; num3++)
					{
						ptr18[num3] = ptr17[num3];
					}
				}
				return;
			}
			if (typeof(T) == typeof(double))
			{
				double* ptr19 = (double*)dataPointer;
				ptr19 += offset;
				fixed (double* ptr20 = &register.double_0)
				{
					for (int num4 = 0; num4 < Count; num4++)
					{
						ptr20[num4] = ptr19[num4];
					}
				}
				return;
			}
			throw new NotSupportedException(System.SR.Arg_TypeNotSupported);
		}

		private Vector(ref System.Numerics.Register existingRegister)
		{
			register = existingRegister;
		}

		[System.Runtime.CompilerServices.Intrinsic]
		public void CopyTo(T[] destination)
		{
			CopyTo(destination, 0);
		}

		[System.Runtime.CompilerServices.Intrinsic]
		public unsafe void CopyTo(T[] destination, int startIndex)
		{
			if (destination == null)
			{
				throw new NullReferenceException(System.SR.Arg_NullArgumentNullRef);
			}
			if (startIndex < 0 || startIndex >= destination.Length)
			{
				throw new ArgumentOutOfRangeException("startIndex", System.SR.Format(System.SR.Arg_ArgumentOutOfRangeException, startIndex));
			}
			if (destination.Length - startIndex < Count)
			{
				throw new ArgumentException(System.SR.Format(System.SR.Arg_ElementsInSourceIsGreaterThanDestination, startIndex));
			}
			if (Vector.IsHardwareAccelerated)
			{
				if (typeof(T) == typeof(byte))
				{
					fixed (byte* ptr = (byte[])(object)destination)
					{
						for (int i = 0; i < Count; i++)
						{
							ptr[startIndex + i] = (byte)(object)this[i];
						}
					}
				}
				else if (typeof(T) == typeof(sbyte))
				{
					fixed (sbyte* ptr2 = (sbyte[])(object)destination)
					{
						for (int j = 0; j < Count; j++)
						{
							ptr2[startIndex + j] = (sbyte)(object)this[j];
						}
					}
				}
				else if (typeof(T) == typeof(ushort))
				{
					fixed (ushort* ptr3 = (ushort[])(object)destination)
					{
						for (int k = 0; k < Count; k++)
						{
							ptr3[startIndex + k] = (ushort)(object)this[k];
						}
					}
				}
				else if (typeof(T) == typeof(short))
				{
					fixed (short* ptr4 = (short[])(object)destination)
					{
						for (int l = 0; l < Count; l++)
						{
							ptr4[startIndex + l] = (short)(object)this[l];
						}
					}
				}
				else if (typeof(T) == typeof(uint))
				{
					fixed (uint* ptr5 = (uint[])(object)destination)
					{
						for (int m = 0; m < Count; m++)
						{
							ptr5[startIndex + m] = (uint)(object)this[m];
						}
					}
				}
				else if (typeof(T) == typeof(int))
				{
					fixed (int* ptr6 = (int[])(object)destination)
					{
						for (int n = 0; n < Count; n++)
						{
							ptr6[startIndex + n] = (int)(object)this[n];
						}
					}
				}
				else if (typeof(T) == typeof(ulong))
				{
					fixed (ulong* ptr7 = (ulong[])(object)destination)
					{
						for (int num = 0; num < Count; num++)
						{
							ptr7[startIndex + num] = (ulong)(object)this[num];
						}
					}
				}
				else if (typeof(T) == typeof(long))
				{
					fixed (long* ptr8 = (long[])(object)destination)
					{
						for (int num2 = 0; num2 < Count; num2++)
						{
							ptr8[startIndex + num2] = (long)(object)this[num2];
						}
					}
				}
				else if (typeof(T) == typeof(float))
				{
					fixed (float* ptr9 = (float[])(object)destination)
					{
						for (int num3 = 0; num3 < Count; num3++)
						{
							ptr9[startIndex + num3] = (float)(object)this[num3];
						}
					}
				}
				else
				{
					if (!(typeof(T) == typeof(double)))
					{
						return;
					}
					fixed (double* ptr10 = (double[])(object)destination)
					{
						for (int num4 = 0; num4 < Count; num4++)
						{
							ptr10[startIndex + num4] = (double)(object)this[num4];
						}
					}
				}
			}
			else if (typeof(T) == typeof(byte))
			{
				fixed (byte* ptr11 = (byte[])(object)destination)
				{
					ptr11[startIndex] = register.byte_0;
					ptr11[startIndex + 1] = register.byte_1;
					ptr11[startIndex + 2] = register.byte_2;
					ptr11[startIndex + 3] = register.byte_3;
					ptr11[startIndex + 4] = register.byte_4;
					ptr11[startIndex + 5] = register.byte_5;
					ptr11[startIndex + 6] = register.byte_6;
					ptr11[startIndex + 7] = register.byte_7;
					ptr11[startIndex + 8] = register.byte_8;
					ptr11[startIndex + 9] = register.byte_9;
					ptr11[startIndex + 10] = register.byte_10;
					ptr11[startIndex + 11] = register.byte_11;
					ptr11[startIndex + 12] = register.byte_12;
					ptr11[startIndex + 13] = register.byte_13;
					ptr11[startIndex + 14] = register.byte_14;
					ptr11[startIndex + 15] = register.byte_15;
				}
			}
			else if (typeof(T) == typeof(sbyte))
			{
				fixed (sbyte* ptr12 = (sbyte[])(object)destination)
				{
					ptr12[startIndex] = register.sbyte_0;
					ptr12[startIndex + 1] = register.sbyte_1;
					ptr12[startIndex + 2] = register.sbyte_2;
					ptr12[startIndex + 3] = register.sbyte_3;
					ptr12[startIndex + 4] = register.sbyte_4;
					ptr12[startIndex + 5] = register.sbyte_5;
					ptr12[startIndex + 6] = register.sbyte_6;
					ptr12[startIndex + 7] = register.sbyte_7;
					ptr12[startIndex + 8] = register.sbyte_8;
					ptr12[startIndex + 9] = register.sbyte_9;
					ptr12[startIndex + 10] = register.sbyte_10;
					ptr12[startIndex + 11] = register.sbyte_11;
					ptr12[startIndex + 12] = register.sbyte_12;
					ptr12[startIndex + 13] = register.sbyte_13;
					ptr12[startIndex + 14] = register.sbyte_14;
					ptr12[startIndex + 15] = register.sbyte_15;
				}
			}
			else if (typeof(T) == typeof(ushort))
			{
				fixed (ushort* ptr13 = (ushort[])(object)destination)
				{
					ptr13[startIndex] = register.uint16_0;
					ptr13[startIndex + 1] = register.uint16_1;
					ptr13[startIndex + 2] = register.uint16_2;
					ptr13[startIndex + 3] = register.uint16_3;
					ptr13[startIndex + 4] = register.uint16_4;
					ptr13[startIndex + 5] = register.uint16_5;
					ptr13[startIndex + 6] = register.uint16_6;
					ptr13[startIndex + 7] = register.uint16_7;
				}
			}
			else if (typeof(T) == typeof(short))
			{
				fixed (short* ptr14 = (short[])(object)destination)
				{
					ptr14[startIndex] = register.int16_0;
					ptr14[startIndex + 1] = register.int16_1;
					ptr14[startIndex + 2] = register.int16_2;
					ptr14[startIndex + 3] = register.int16_3;
					ptr14[startIndex + 4] = register.int16_4;
					ptr14[startIndex + 5] = register.int16_5;
					ptr14[startIndex + 6] = register.int16_6;
					ptr14[startIndex + 7] = register.int16_7;
				}
			}
			else if (typeof(T) == typeof(uint))
			{
				fixed (uint* ptr15 = (uint[])(object)destination)
				{
					ptr15[startIndex] = register.uint32_0;
					ptr15[startIndex + 1] = register.uint32_1;
					ptr15[startIndex + 2] = register.uint32_2;
					ptr15[startIndex + 3] = register.uint32_3;
				}
			}
			else if (typeof(T) == typeof(int))
			{
				fixed (int* ptr16 = (int[])(object)destination)
				{
					ptr16[startIndex] = register.int32_0;
					ptr16[startIndex + 1] = register.int32_1;
					ptr16[startIndex + 2] = register.int32_2;
					ptr16[startIndex + 3] = register.int32_3;
				}
			}
			else if (typeof(T) == typeof(ulong))
			{
				fixed (ulong* ptr17 = (ulong[])(object)destination)
				{
					ptr17[startIndex] = register.uint64_0;
					ptr17[startIndex + 1] = register.uint64_1;
				}
			}
			else if (typeof(T) == typeof(long))
			{
				fixed (long* ptr18 = (long[])(object)destination)
				{
					ptr18[startIndex] = register.int64_0;
					ptr18[startIndex + 1] = register.int64_1;
				}
			}
			else if (typeof(T) == typeof(float))
			{
				fixed (float* ptr19 = (float[])(object)destination)
				{
					ptr19[startIndex] = register.single_0;
					ptr19[startIndex + 1] = register.single_1;
					ptr19[startIndex + 2] = register.single_2;
					ptr19[startIndex + 3] = register.single_3;
				}
			}
			else if (typeof(T) == typeof(double))
			{
				fixed (double* ptr20 = (double[])(object)destination)
				{
					ptr20[startIndex] = register.double_0;
					ptr20[startIndex + 1] = register.double_1;
				}
			}
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public override bool Equals(object obj)
		{
			if (!(obj is Vector<T>))
			{
				return false;
			}
			return Equals((Vector<T>)obj);
		}

		[System.Runtime.CompilerServices.Intrinsic]
		public bool Equals(Vector<T> other)
		{
			if (Vector.IsHardwareAccelerated)
			{
				for (int i = 0; i < Count; i++)
				{
					if (!ScalarEquals(this[i], other[i]))
					{
						return false;
					}
				}
				return true;
			}
			if (typeof(T) == typeof(byte))
			{
				if (register.byte_0 == other.register.byte_0 && register.byte_1 == other.register.byte_1 && register.byte_2 == other.register.byte_2 && register.byte_3 == other.register.byte_3 && register.byte_4 == other.register.byte_4 && register.byte_5 == other.register.byte_5 && register.byte_6 == other.register.byte_6 && register.byte_7 == other.register.byte_7 && register.byte_8 == other.register.byte_8 && register.byte_9 == other.register.byte_9 && register.byte_10 == other.register.byte_10 && register.byte_11 == other.register.byte_11 && register.byte_12 == other.register.byte_12 && register.byte_13 == other.register.byte_13 && register.byte_14 == other.register.byte_14)
				{
					return register.byte_15 == other.register.byte_15;
				}
				return false;
			}
			if (typeof(T) == typeof(sbyte))
			{
				if (register.sbyte_0 == other.register.sbyte_0 && register.sbyte_1 == other.register.sbyte_1 && register.sbyte_2 == other.register.sbyte_2 && register.sbyte_3 == other.register.sbyte_3 && register.sbyte_4 == other.register.sbyte_4 && register.sbyte_5 == other.register.sbyte_5 && register.sbyte_6 == other.register.sbyte_6 && register.sbyte_7 == other.register.sbyte_7 && register.sbyte_8 == other.register.sbyte_8 && register.sbyte_9 == other.register.sbyte_9 && register.sbyte_10 == other.register.sbyte_10 && register.sbyte_11 == other.register.sbyte_11 && register.sbyte_12 == other.register.sbyte_12 && register.sbyte_13 == other.register.sbyte_13 && register.sbyte_14 == other.register.sbyte_14)
				{
					return register.sbyte_15 == other.register.sbyte_15;
				}
				return false;
			}
			if (typeof(T) == typeof(ushort))
			{
				if (register.uint16_0 == other.register.uint16_0 && register.uint16_1 == other.register.uint16_1 && register.uint16_2 == other.register.uint16_2 && register.uint16_3 == other.register.uint16_3 && register.uint16_4 == other.register.uint16_4 && register.uint16_5 == other.register.uint16_5 && register.uint16_6 == other.register.uint16_6)
				{
					return register.uint16_7 == other.register.uint16_7;
				}
				return false;
			}
			if (typeof(T) == typeof(short))
			{
				if (register.int16_0 == other.register.int16_0 && register.int16_1 == other.register.int16_1 && register.int16_2 == other.register.int16_2 && register.int16_3 == other.register.int16_3 && register.int16_4 == other.register.int16_4 && register.int16_5 == other.register.int16_5 && register.int16_6 == other.register.int16_6)
				{
					return register.int16_7 == other.register.int16_7;
				}
				return false;
			}
			if (typeof(T) == typeof(uint))
			{
				if (register.uint32_0 == other.register.uint32_0 && register.uint32_1 == other.register.uint32_1 && register.uint32_2 == other.register.uint32_2)
				{
					return register.uint32_3 == other.register.uint32_3;
				}
				return false;
			}
			if (typeof(T) == typeof(int))
			{
				if (register.int32_0 == other.register.int32_0 && register.int32_1 == other.register.int32_1 && register.int32_2 == other.register.int32_2)
				{
					return register.int32_3 == other.register.int32_3;
				}
				return false;
			}
			if (typeof(T) == typeof(ulong))
			{
				if (register.uint64_0 == other.register.uint64_0)
				{
					return register.uint64_1 == other.register.uint64_1;
				}
				return false;
			}
			if (typeof(T) == typeof(long))
			{
				if (register.int64_0 == other.register.int64_0)
				{
					return register.int64_1 == other.register.int64_1;
				}
				return false;
			}
			if (typeof(T) == typeof(float))
			{
				if (register.single_0 == other.register.single_0 && register.single_1 == other.register.single_1 && register.single_2 == other.register.single_2)
				{
					return register.single_3 == other.register.single_3;
				}
				return false;
			}
			if (typeof(T) == typeof(double))
			{
				if (register.double_0 == other.register.double_0)
				{
					return register.double_1 == other.register.double_1;
				}
				return false;
			}
			throw new NotSupportedException(System.SR.Arg_TypeNotSupported);
		}

		public override int GetHashCode()
		{
			int num = 0;
			if (Vector.IsHardwareAccelerated)
			{
				if (typeof(T) == typeof(byte))
				{
					for (int i = 0; i < Count; i++)
					{
						num = HashHelpers.Combine(num, ((byte)(object)this[i]).GetHashCode());
					}
					return num;
				}
				if (typeof(T) == typeof(sbyte))
				{
					for (int j = 0; j < Count; j++)
					{
						num = HashHelpers.Combine(num, ((sbyte)(object)this[j]).GetHashCode());
					}
					return num;
				}
				if (typeof(T) == typeof(ushort))
				{
					for (int k = 0; k < Count; k++)
					{
						num = HashHelpers.Combine(num, ((ushort)(object)this[k]).GetHashCode());
					}
					return num;
				}
				if (typeof(T) == typeof(short))
				{
					for (int l = 0; l < Count; l++)
					{
						num = HashHelpers.Combine(num, ((short)(object)this[l]).GetHashCode());
					}
					return num;
				}
				if (typeof(T) == typeof(uint))
				{
					for (int m = 0; m < Count; m++)
					{
						num = HashHelpers.Combine(num, ((uint)(object)this[m]).GetHashCode());
					}
					return num;
				}
				if (typeof(T) == typeof(int))
				{
					for (int n = 0; n < Count; n++)
					{
						num = HashHelpers.Combine(num, ((int)(object)this[n]).GetHashCode());
					}
					return num;
				}
				if (typeof(T) == typeof(ulong))
				{
					for (int num2 = 0; num2 < Count; num2++)
					{
						num = HashHelpers.Combine(num, ((ulong)(object)this[num2]).GetHashCode());
					}
					return num;
				}
				if (typeof(T) == typeof(long))
				{
					for (int num3 = 0; num3 < Count; num3++)
					{
						num = HashHelpers.Combine(num, ((long)(object)this[num3]).GetHashCode());
					}
					return num;
				}
				if (typeof(T) == typeof(float))
				{
					for (int num4 = 0; num4 < Count; num4++)
					{
						num = HashHelpers.Combine(num, ((float)(object)this[num4]).GetHashCode());
					}
					return num;
				}
				if (typeof(T) == typeof(double))
				{
					for (int num5 = 0; num5 < Count; num5++)
					{
						num = HashHelpers.Combine(num, ((double)(object)this[num5]).GetHashCode());
					}
					return num;
				}
				throw new NotSupportedException(System.SR.Arg_TypeNotSupported);
			}
			if (typeof(T) == typeof(byte))
			{
				num = HashHelpers.Combine(num, register.byte_0.GetHashCode());
				num = HashHelpers.Combine(num, register.byte_1.GetHashCode());
				num = HashHelpers.Combine(num, register.byte_2.GetHashCode());
				num = HashHelpers.Combine(num, register.byte_3.GetHashCode());
				num = HashHelpers.Combine(num, register.byte_4.GetHashCode());
				num = HashHelpers.Combine(num, register.byte_5.GetHashCode());
				num = HashHelpers.Combine(num, register.byte_6.GetHashCode());
				num = HashHelpers.Combine(num, register.byte_7.GetHashCode());
				num = HashHelpers.Combine(num, register.byte_8.GetHashCode());
				num = HashHelpers.Combine(num, register.byte_9.GetHashCode());
				num = HashHelpers.Combine(num, register.byte_10.GetHashCode());
				num = HashHelpers.Combine(num, register.byte_11.GetHashCode());
				num = HashHelpers.Combine(num, register.byte_12.GetHashCode());
				num = HashHelpers.Combine(num, register.byte_13.GetHashCode());
				num = HashHelpers.Combine(num, register.byte_14.GetHashCode());
				return HashHelpers.Combine(num, register.byte_15.GetHashCode());
			}
			if (typeof(T) == typeof(sbyte))
			{
				num = HashHelpers.Combine(num, register.sbyte_0.GetHashCode());
				num = HashHelpers.Combine(num, register.sbyte_1.GetHashCode());
				num = HashHelpers.Combine(num, register.sbyte_2.GetHashCode());
				num = HashHelpers.Combine(num, register.sbyte_3.GetHashCode());
				num = HashHelpers.Combine(num, register.sbyte_4.GetHashCode());
				num = HashHelpers.Combine(num, register.sbyte_5.GetHashCode());
				num = HashHelpers.Combine(num, register.sbyte_6.GetHashCode());
				num = HashHelpers.Combine(num, register.sbyte_7.GetHashCode());
				num = HashHelpers.Combine(num, register.sbyte_8.GetHashCode());
				num = HashHelpers.Combine(num, register.sbyte_9.GetHashCode());
				num = HashHelpers.Combine(num, register.sbyte_10.GetHashCode());
				num = HashHelpers.Combine(num, register.sbyte_11.GetHashCode());
				num = HashHelpers.Combine(num, register.sbyte_12.GetHashCode());
				num = HashHelpers.Combine(num, register.sbyte_13.GetHashCode());
				num = HashHelpers.Combine(num, register.sbyte_14.GetHashCode());
				return HashHelpers.Combine(num, register.sbyte_15.GetHashCode());
			}
			if (typeof(T) == typeof(ushort))
			{
				num = HashHelpers.Combine(num, register.uint16_0.GetHashCode());
				num = HashHelpers.Combine(num, register.uint16_1.GetHashCode());
				num = HashHelpers.Combine(num, register.uint16_2.GetHashCode());
				num = HashHelpers.Combine(num, register.uint16_3.GetHashCode());
				num = HashHelpers.Combine(num, register.uint16_4.GetHashCode());
				num = HashHelpers.Combine(num, register.uint16_5.GetHashCode());
				num = HashHelpers.Combine(num, register.uint16_6.GetHashCode());
				return HashHelpers.Combine(num, register.uint16_7.GetHashCode());
			}
			if (typeof(T) == typeof(short))
			{
				num = HashHelpers.Combine(num, register.int16_0.GetHashCode());
				num = HashHelpers.Combine(num, register.int16_1.GetHashCode());
				num = HashHelpers.Combine(num, register.int16_2.GetHashCode());
				num = HashHelpers.Combine(num, register.int16_3.GetHashCode());
				num = HashHelpers.Combine(num, register.int16_4.GetHashCode());
				num = HashHelpers.Combine(num, register.int16_5.GetHashCode());
				num = HashHelpers.Combine(num, register.int16_6.GetHashCode());
				return HashHelpers.Combine(num, register.int16_7.GetHashCode());
			}
			if (typeof(T) == typeof(uint))
			{
				num = HashHelpers.Combine(num, register.uint32_0.GetHashCode());
				num = HashHelpers.Combine(num, register.uint32_1.GetHashCode());
				num = HashHelpers.Combine(num, register.uint32_2.GetHashCode());
				return HashHelpers.Combine(num, register.uint32_3.GetHashCode());
			}
			if (typeof(T) == typeof(int))
			{
				num = HashHelpers.Combine(num, register.int32_0.GetHashCode());
				num = HashHelpers.Combine(num, register.int32_1.GetHashCode());
				num = HashHelpers.Combine(num, register.int32_2.GetHashCode());
				return HashHelpers.Combine(num, register.int32_3.GetHashCode());
			}
			if (typeof(T) == typeof(ulong))
			{
				num = HashHelpers.Combine(num, register.uint64_0.GetHashCode());
				return HashHelpers.Combine(num, register.uint64_1.GetHashCode());
			}
			if (typeof(T) == typeof(long))
			{
				num = HashHelpers.Combine(num, register.int64_0.GetHashCode());
				return HashHelpers.Combine(num, register.int64_1.GetHashCode());
			}
			if (typeof(T) == typeof(float))
			{
				num = HashHelpers.Combine(num, register.single_0.GetHashCode());
				num = HashHelpers.Combine(num, register.single_1.GetHashCode());
				num = HashHelpers.Combine(num, register.single_2.GetHashCode());
				return HashHelpers.Combine(num, register.single_3.GetHashCode());
			}
			if (typeof(T) == typeof(double))
			{
				num = HashHelpers.Combine(num, register.double_0.GetHashCode());
				return HashHelpers.Combine(num, register.double_1.GetHashCode());
			}
			throw new NotSupportedException(System.SR.Arg_TypeNotSupported);
		}

		public override string ToString()
		{
			return ToString("G", CultureInfo.CurrentCulture);
		}

		public string ToString(string format)
		{
			return ToString(format, CultureInfo.CurrentCulture);
		}

		public string ToString(string format, IFormatProvider formatProvider)
		{
			StringBuilder stringBuilder = new StringBuilder();
			string numberGroupSeparator = NumberFormatInfo.GetInstance(formatProvider).NumberGroupSeparator;
			stringBuilder.Append('<');
			for (int i = 0; i < Count - 1; i++)
			{
				stringBuilder.Append(((IFormattable)(object)this[i]).ToString(format, formatProvider));
				stringBuilder.Append(numberGroupSeparator);
				stringBuilder.Append(' ');
			}
			stringBuilder.Append(((IFormattable)(object)this[Count - 1]).ToString(format, formatProvider));
			stringBuilder.Append('>');
			return stringBuilder.ToString();
		}

		public unsafe static Vector<T>operator +(Vector<T> left, Vector<T> right)
		{
			if (Vector.IsHardwareAccelerated)
			{
				if (typeof(T) == typeof(byte))
				{
					byte* ptr = stackalloc byte[(int)(uint)Count];
					for (int i = 0; i < Count; i++)
					{
						ptr[i] = (byte)(object)ScalarAdd(left[i], right[i]);
					}
					return new Vector<T>(ptr);
				}
				if (typeof(T) == typeof(sbyte))
				{
					sbyte* ptr2 = stackalloc sbyte[(int)(uint)Count];
					for (int j = 0; j < Count; j++)
					{
						ptr2[j] = (sbyte)(object)ScalarAdd(left[j], right[j]);
					}
					return new Vector<T>(ptr2);
				}
				if (typeof(T) == typeof(ushort))
				{
					ushort* ptr3 = stackalloc ushort[Count];
					for (int k = 0; k < Count; k++)
					{
						ptr3[k] = (ushort)(object)ScalarAdd(left[k], right[k]);
					}
					return new Vector<T>(ptr3);
				}
				if (typeof(T) == typeof(short))
				{
					short* ptr4 = stackalloc short[Count];
					for (int l = 0; l < Count; l++)
					{
						ptr4[l] = (short)(object)ScalarAdd(left[l], right[l]);
					}
					return new Vector<T>(ptr4);
				}
				if (typeof(T) == typeof(uint))
				{
					uint* ptr5 = stackalloc uint[Count];
					for (int m = 0; m < Count; m++)
					{
						ptr5[m] = (uint)(object)ScalarAdd(left[m], right[m]);
					}
					return new Vector<T>(ptr5);
				}
				if (typeof(T) == typeof(int))
				{
					int* ptr6 = stackalloc int[Count];
					for (int n = 0; n < Count; n++)
					{
						ptr6[n] = (int)(object)ScalarAdd(left[n], right[n]);
					}
					return new Vector<T>(ptr6);
				}
				if (typeof(T) == typeof(ulong))
				{
					ulong* ptr7 = stackalloc ulong[Count];
					for (int num = 0; num < Count; num++)
					{
						ptr7[num] = (ulong)(object)ScalarAdd(left[num], right[num]);
					}
					return new Vector<T>(ptr7);
				}
				if (typeof(T) == typeof(long))
				{
					long* ptr8 = stackalloc long[Count];
					for (int num2 = 0; num2 < Count; num2++)
					{
						ptr8[num2] = (long)(object)ScalarAdd(left[num2], right[num2]);
					}
					return new Vector<T>(ptr8);
				}
				if (typeof(T) == typeof(float))
				{
					float* ptr9 = stackalloc float[Count];
					for (int num3 = 0; num3 < Count; num3++)
					{
						ptr9[num3] = (float)(object)ScalarAdd(left[num3], right[num3]);
					}
					return new Vector<T>(ptr9);
				}
				if (typeof(T) == typeof(double))
				{
					double* ptr10 = stackalloc double[Count];
					for (int num4 = 0; num4 < Count; num4++)
					{
						ptr10[num4] = (double)(object)ScalarAdd(left[num4], right[num4]);
					}
					return new Vector<T>(ptr10);
				}
				throw new NotSupportedException(System.SR.Arg_TypeNotSupported);
			}
			Vector<T> result = default(Vector<T>);
			if (typeof(T) == typeof(byte))
			{
				result.register.byte_0 = (byte)(left.register.byte_0 + right.register.byte_0);
				result.register.byte_1 = (byte)(left.register.byte_1 + right.register.byte_1);
				result.register.byte_2 = (byte)(left.register.byte_2 + right.register.byte_2);
				result.register.byte_3 = (byte)(left.register.byte_3 + right.register.byte_3);
				result.register.byte_4 = (byte)(left.register.byte_4 + right.register.byte_4);
				result.register.byte_5 = (byte)(left.register.byte_5 + right.register.byte_5);
				result.register.byte_6 = (byte)(left.register.byte_6 + right.register.byte_6);
				result.register.byte_7 = (byte)(left.register.byte_7 + right.register.byte_7);
				result.register.byte_8 = (byte)(left.register.byte_8 + right.register.byte_8);
				result.register.byte_9 = (byte)(left.register.byte_9 + right.register.byte_9);
				result.register.byte_10 = (byte)(left.register.byte_10 + right.register.byte_10);
				result.register.byte_11 = (byte)(left.register.byte_11 + right.register.byte_11);
				result.register.byte_12 = (byte)(left.register.byte_12 + right.register.byte_12);
				result.register.byte_13 = (byte)(left.register.byte_13 + right.register.byte_13);
				result.register.byte_14 = (byte)(left.register.byte_14 + right.register.byte_14);
				result.register.byte_15 = (byte)(left.register.byte_15 + right.register.byte_15);
			}
			else if (typeof(T) == typeof(sbyte))
			{
				result.register.sbyte_0 = (sbyte)(left.register.sbyte_0 + right.register.sbyte_0);
				result.register.sbyte_1 = (sbyte)(left.register.sbyte_1 + right.register.sbyte_1);
				result.register.sbyte_2 = (sbyte)(left.register.sbyte_2 + right.register.sbyte_2);
				result.register.sbyte_3 = (sbyte)(left.register.sbyte_3 + right.register.sbyte_3);
				result.register.sbyte_4 = (sbyte)(left.register.sbyte_4 + right.register.sbyte_4);
				result.register.sbyte_5 = (sbyte)(left.register.sbyte_5 + right.register.sbyte_5);
				result.register.sbyte_6 = (sbyte)(left.register.sbyte_6 + right.register.sbyte_6);
				result.register.sbyte_7 = (sbyte)(left.register.sbyte_7 + right.register.sbyte_7);
				result.register.sbyte_8 = (sbyte)(left.register.sbyte_8 + right.register.sbyte_8);
				result.register.sbyte_9 = (sbyte)(left.register.sbyte_9 + right.register.sbyte_9);
				result.register.sbyte_10 = (sbyte)(left.register.sbyte_10 + right.register.sbyte_10);
				result.register.sbyte_11 = (sbyte)(left.register.sbyte_11 + right.register.sbyte_11);
				result.register.sbyte_12 = (sbyte)(left.register.sbyte_12 + right.register.sbyte_12);
				result.register.sbyte_13 = (sbyte)(left.register.sbyte_13 + right.register.sbyte_13);
				result.register.sbyte_14 = (sbyte)(left.register.sbyte_14 + right.register.sbyte_14);
				result.register.sbyte_15 = (sbyte)(left.register.sbyte_15 + right.register.sbyte_15);
			}
			else if (typeof(T) == typeof(ushort))
			{
				result.register.uint16_0 = (ushort)(left.register.uint16_0 + right.register.uint16_0);
				result.register.uint16_1 = (ushort)(left.register.uint16_1 + right.register.uint16_1);
				result.register.uint16_2 = (ushort)(left.register.uint16_2 + right.register.uint16_2);
				result.register.uint16_3 = (ushort)(left.register.uint16_3 + right.register.uint16_3);
				result.register.uint16_4 = (ushort)(left.register.uint16_4 + right.register.uint16_4);
				result.register.uint16_5 = (ushort)(left.register.uint16_5 + right.register.uint16_5);
				result.register.uint16_6 = (ushort)(left.register.uint16_6 + right.register.uint16_6);
				result.register.uint16_7 = (ushort)(left.register.uint16_7 + right.register.uint16_7);
			}
			else if (typeof(T) == typeof(short))
			{
				result.register.int16_0 = (short)(left.register.int16_0 + right.register.int16_0);
				result.register.int16_1 = (short)(left.register.int16_1 + right.register.int16_1);
				result.register.int16_2 = (short)(left.register.int16_2 + right.register.int16_2);
				result.register.int16_3 = (short)(left.register.int16_3 + right.register.int16_3);
				result.register.int16_4 = (short)(left.register.int16_4 + right.register.int16_4);
				result.register.int16_5 = (short)(left.register.int16_5 + right.register.int16_5);
				result.register.int16_6 = (short)(left.register.int16_6 + right.register.int16_6);
				result.register.int16_7 = (short)(left.register.int16_7 + right.register.int16_7);
			}
			else if (typeof(T) == typeof(uint))
			{
				result.register.uint32_0 = left.register.uint32_0 + right.register.uint32_0;
				result.register.uint32_1 = left.register.uint32_1 + right.register.uint32_1;
				result.register.uint32_2 = left.register.uint32_2 + right.register.uint32_2;
				result.register.uint32_3 = left.register.uint32_3 + right.register.uint32_3;
			}
			else if (typeof(T) == typeof(int))
			{
				result.register.int32_0 = left.register.int32_0 + right.register.int32_0;
				result.register.int32_1 = left.register.int32_1 + right.register.int32_1;
				result.register.int32_2 = left.register.int32_2 + right.register.int32_2;
				result.register.int32_3 = left.register.int32_3 + right.register.int32_3;
			}
			else if (typeof(T) == typeof(ulong))
			{
				result.register.uint64_0 = left.register.uint64_0 + right.register.uint64_0;
				result.register.uint64_1 = left.register.uint64_1 + right.register.uint64_1;
			}
			else if (typeof(T) == typeof(long))
			{
				result.register.int64_0 = left.register.int64_0 + right.register.int64_0;
				result.register.int64_1 = left.register.int64_1 + right.register.int64_1;
			}
			else if (typeof(T) == typeof(float))
			{
				result.register.single_0 = left.register.single_0 + right.register.single_0;
				result.register.single_1 = left.register.single_1 + right.register.single_1;
				result.register.single_2 = left.register.single_2 + right.register.single_2;
				result.register.single_3 = left.register.single_3 + right.register.single_3;
			}
			else if (typeof(T) == typeof(double))
			{
				result.register.double_0 = left.register.double_0 + right.register.double_0;
				result.register.double_1 = left.register.double_1 + right.register.double_1;
			}
			return result;
		}

		public unsafe static Vector<T>operator -(Vector<T> left, Vector<T> right)
		{
			if (Vector.IsHardwareAccelerated)
			{
				if (typeof(T) == typeof(byte))
				{
					byte* ptr = stackalloc byte[(int)(uint)Count];
					for (int i = 0; i < Count; i++)
					{
						ptr[i] = (byte)(object)ScalarSubtract(left[i], right[i]);
					}
					return new Vector<T>(ptr);
				}
				if (typeof(T) == typeof(sbyte))
				{
					sbyte* ptr2 = stackalloc sbyte[(int)(uint)Count];
					for (int j = 0; j < Count; j++)
					{
						ptr2[j] = (sbyte)(object)ScalarSubtract(left[j], right[j]);
					}
					return new Vector<T>(ptr2);
				}
				if (typeof(T) == typeof(ushort))
				{
					ushort* ptr3 = stackalloc ushort[Count];
					for (int k = 0; k < Count; k++)
					{
						ptr3[k] = (ushort)(object)ScalarSubtract(left[k], right[k]);
					}
					return new Vector<T>(ptr3);
				}
				if (typeof(T) == typeof(short))
				{
					short* ptr4 = stackalloc short[Count];
					for (int l = 0; l < Count; l++)
					{
						ptr4[l] = (short)(object)ScalarSubtract(left[l], right[l]);
					}
					return new Vector<T>(ptr4);
				}
				if (typeof(T) == typeof(uint))
				{
					uint* ptr5 = stackalloc uint[Count];
					for (int m = 0; m < Count; m++)
					{
						ptr5[m] = (uint)(object)ScalarSubtract(left[m], right[m]);
					}
					return new Vector<T>(ptr5);
				}
				if (typeof(T) == typeof(int))
				{
					int* ptr6 = stackalloc int[Count];
					for (int n = 0; n < Count; n++)
					{
						ptr6[n] = (int)(object)ScalarSubtract(left[n], right[n]);
					}
					return new Vector<T>(ptr6);
				}
				if (typeof(T) == typeof(ulong))
				{
					ulong* ptr7 = stackalloc ulong[Count];
					for (int num = 0; num < Count; num++)
					{
						ptr7[num] = (ulong)(object)ScalarSubtract(left[num], right[num]);
					}
					return new Vector<T>(ptr7);
				}
				if (typeof(T) == typeof(long))
				{
					long* ptr8 = stackalloc long[Count];
					for (int num2 = 0; num2 < Count; num2++)
					{
						ptr8[num2] = (long)(object)ScalarSubtract(left[num2], right[num2]);
					}
					return new Vector<T>(ptr8);
				}
				if (typeof(T) == typeof(float))
				{
					float* ptr9 = stackalloc float[Count];
					for (int num3 = 0; num3 < Count; num3++)
					{
						ptr9[num3] = (float)(object)ScalarSubtract(left[num3], right[num3]);
					}
					return new Vector<T>(ptr9);
				}
				if (typeof(T) == typeof(double))
				{
					double* ptr10 = stackalloc double[Count];
					for (int num4 = 0; num4 < Count; num4++)
					{
						ptr10[num4] = (double)(object)ScalarSubtract(left[num4], right[num4]);
					}
					return new Vector<T>(ptr10);
				}
				throw new NotSupportedException(System.SR.Arg_TypeNotSupported);
			}
			Vector<T> result = default(Vector<T>);
			if (typeof(T) == typeof(byte))
			{
				result.register.byte_0 = (byte)(left.register.byte_0 - right.register.byte_0);
				result.register.byte_1 = (byte)(left.register.byte_1 - right.register.byte_1);
				result.register.byte_2 = (byte)(left.register.byte_2 - right.register.byte_2);
				result.register.byte_3 = (byte)(left.register.byte_3 - right.register.byte_3);
				result.register.byte_4 = (byte)(left.register.byte_4 - right.register.byte_4);
				result.register.byte_5 = (byte)(left.register.byte_5 - right.register.byte_5);
				result.register.byte_6 = (byte)(left.register.byte_6 - right.register.byte_6);
				result.register.byte_7 = (byte)(left.register.byte_7 - right.register.byte_7);
				result.register.byte_8 = (byte)(left.register.byte_8 - right.register.byte_8);
				result.register.byte_9 = (byte)(left.register.byte_9 - right.register.byte_9);
				result.register.byte_10 = (byte)(left.register.byte_10 - right.register.byte_10);
				result.register.byte_11 = (byte)(left.register.byte_11 - right.register.byte_11);
				result.register.byte_12 = (byte)(left.register.byte_12 - right.register.byte_12);
				result.register.byte_13 = (byte)(left.register.byte_13 - right.register.byte_13);
				result.register.byte_14 = (byte)(left.register.byte_14 - right.register.byte_14);
				result.register.byte_15 = (byte)(left.register.byte_15 - right.register.byte_15);
			}
			else if (typeof(T) == typeof(sbyte))
			{
				result.register.sbyte_0 = (sbyte)(left.register.sbyte_0 - right.register.sbyte_0);
				result.register.sbyte_1 = (sbyte)(left.register.sbyte_1 - right.register.sbyte_1);
				result.register.sbyte_2 = (sbyte)(left.register.sbyte_2 - right.register.sbyte_2);
				result.register.sbyte_3 = (sbyte)(left.register.sbyte_3 - right.register.sbyte_3);
				result.register.sbyte_4 = (sbyte)(left.register.sbyte_4 - right.register.sbyte_4);
				result.register.sbyte_5 = (sbyte)(left.register.sbyte_5 - right.register.sbyte_5);
				result.register.sbyte_6 = (sbyte)(left.register.sbyte_6 - right.register.sbyte_6);
				result.register.sbyte_7 = (sbyte)(left.register.sbyte_7 - right.register.sbyte_7);
				result.register.sbyte_8 = (sbyte)(left.register.sbyte_8 - right.register.sbyte_8);
				result.register.sbyte_9 = (sbyte)(left.register.sbyte_9 - right.register.sbyte_9);
				result.register.sbyte_10 = (sbyte)(left.register.sbyte_10 - right.register.sbyte_10);
				result.register.sbyte_11 = (sbyte)(left.register.sbyte_11 - right.register.sbyte_11);
				result.register.sbyte_12 = (sbyte)(left.register.sbyte_12 - right.register.sbyte_12);
				result.register.sbyte_13 = (sbyte)(left.register.sbyte_13 - right.register.sbyte_13);
				result.register.sbyte_14 = (sbyte)(left.register.sbyte_14 - right.register.sbyte_14);
				result.register.sbyte_15 = (sbyte)(left.register.sbyte_15 - right.register.sbyte_15);
			}
			else if (typeof(T) == typeof(ushort))
			{
				result.register.uint16_0 = (ushort)(left.register.uint16_0 - right.register.uint16_0);
				result.register.uint16_1 = (ushort)(left.register.uint16_1 - right.register.uint16_1);
				result.register.uint16_2 = (ushort)(left.register.uint16_2 - right.register.uint16_2);
				result.register.uint16_3 = (ushort)(left.register.uint16_3 - right.register.uint16_3);
				result.register.uint16_4 = (ushort)(left.register.uint16_4 - right.register.uint16_4);
				result.register.uint16_5 = (ushort)(left.register.uint16_5 - right.register.uint16_5);
				result.register.uint16_6 = (ushort)(left.register.uint16_6 - right.register.uint16_6);
				result.register.uint16_7 = (ushort)(left.register.uint16_7 - right.register.uint16_7);
			}
			else if (typeof(T) == typeof(short))
			{
				result.register.int16_0 = (short)(left.register.int16_0 - right.register.int16_0);
				result.register.int16_1 = (short)(left.register.int16_1 - right.register.int16_1);
				result.register.int16_2 = (short)(left.register.int16_2 - right.register.int16_2);
				result.register.int16_3 = (short)(left.register.int16_3 - right.register.int16_3);
				result.register.int16_4 = (short)(left.register.int16_4 - right.register.int16_4);
				result.register.int16_5 = (short)(left.register.int16_5 - right.register.int16_5);
				result.register.int16_6 = (short)(left.register.int16_6 - right.register.int16_6);
				result.register.int16_7 = (short)(left.register.int16_7 - right.register.int16_7);
			}
			else if (typeof(T) == typeof(uint))
			{
				result.register.uint32_0 = left.register.uint32_0 - right.register.uint32_0;
				result.register.uint32_1 = left.register.uint32_1 - right.register.uint32_1;
				result.register.uint32_2 = left.register.uint32_2 - right.register.uint32_2;
				result.register.uint32_3 = left.register.uint32_3 - right.register.uint32_3;
			}
			else if (typeof(T) == typeof(int))
			{
				result.register.int32_0 = left.register.int32_0 - right.register.int32_0;
				result.register.int32_1 = left.register.int32_1 - right.register.int32_1;
				result.register.int32_2 = left.register.int32_2 - right.register.int32_2;
				result.register.int32_3 = left.register.int32_3 - right.register.int32_3;
			}
			else if (typeof(T) == typeof(ulong))
			{
				result.register.uint64_0 = left.register.uint64_0 - right.register.uint64_0;
				result.register.uint64_1 = left.register.uint64_1 - right.register.uint64_1;
			}
			else if (typeof(T) == typeof(long))
			{
				result.register.int64_0 = left.register.int64_0 - right.register.int64_0;
				result.register.int64_1 = left.register.int64_1 - right.register.int64_1;
			}
			else if (typeof(T) == typeof(float))
			{
				result.register.single_0 = left.register.single_0 - right.register.single_0;
				result.register.single_1 = left.register.single_1 - right.register.single_1;
				result.register.single_2 = left.register.single_2 - right.register.single_2;
				result.register.single_3 = left.register.single_3 - right.register.single_3;
			}
			else if (typeof(T) == typeof(double))
			{
				result.register.double_0 = left.register.double_0 - right.register.double_0;
				result.register.double_1 = left.register.double_1 - right.register.double_1;
			}
			return result;
		}

		public unsafe static Vector<T>operator *(Vector<T> left, Vector<T> right)
		{
			if (Vector.IsHardwareAccelerated)
			{
				if (typeof(T) == typeof(byte))
				{
					byte* ptr = stackalloc byte[(int)(uint)Count];
					for (int i = 0; i < Count; i++)
					{
						ptr[i] = (byte)(object)ScalarMultiply(left[i], right[i]);
					}
					return new Vector<T>(ptr);
				}
				if (typeof(T) == typeof(sbyte))
				{
					sbyte* ptr2 = stackalloc sbyte[(int)(uint)Count];
					for (int j = 0; j < Count; j++)
					{
						ptr2[j] = (sbyte)(object)ScalarMultiply(left[j], right[j]);
					}
					return new Vector<T>(ptr2);
				}
				if (typeof(T) == typeof(ushort))
				{
					ushort* ptr3 = stackalloc ushort[Count];
					for (int k = 0; k < Count; k++)
					{
						ptr3[k] = (ushort)(object)ScalarMultiply(left[k], right[k]);
					}
					return new Vector<T>(ptr3);
				}
				if (typeof(T) == typeof(short))
				{
					short* ptr4 = stackalloc short[Count];
					for (int l = 0; l < Count; l++)
					{
						ptr4[l] = (short)(object)ScalarMultiply(left[l], right[l]);
					}
					return new Vector<T>(ptr4);
				}
				if (typeof(T) == typeof(uint))
				{
					uint* ptr5 = stackalloc uint[Count];
					for (int m = 0; m < Count; m++)
					{
						ptr5[m] = (uint)(object)ScalarMultiply(left[m], right[m]);
					}
					return new Vector<T>(ptr5);
				}
				if (typeof(T) == typeof(int))
				{
					int* ptr6 = stackalloc int[Count];
					for (int n = 0; n < Count; n++)
					{
						ptr6[n] = (int)(object)ScalarMultiply(left[n], right[n]);
					}
					return new Vector<T>(ptr6);
				}
				if (typeof(T) == typeof(ulong))
				{
					ulong* ptr7 = stackalloc ulong[Count];
					for (int num = 0; num < Count; num++)
					{
						ptr7[num] = (ulong)(object)ScalarMultiply(left[num], right[num]);
					}
					return new Vector<T>(ptr7);
				}
				if (typeof(T) == typeof(long))
				{
					long* ptr8 = stackalloc long[Count];
					for (int num2 = 0; num2 < Count; num2++)
					{
						ptr8[num2] = (long)(object)ScalarMultiply(left[num2], right[num2]);
					}
					return new Vector<T>(ptr8);
				}
				if (typeof(T) == typeof(float))
				{
					float* ptr9 = stackalloc float[Count];
					for (int num3 = 0; num3 < Count; num3++)
					{
						ptr9[num3] = (float)(object)ScalarMultiply(left[num3], right[num3]);
					}
					return new Vector<T>(ptr9);
				}
				if (typeof(T) == typeof(double))
				{
					double* ptr10 = stackalloc double[Count];
					for (int num4 = 0; num4 < Count; num4++)
					{
						ptr10[num4] = (double)(object)ScalarMultiply(left[num4], right[num4]);
					}
					return new Vector<T>(ptr10);
				}
				throw new NotSupportedException(System.SR.Arg_TypeNotSupported);
			}
			Vector<T> result = default(Vector<T>);
			if (typeof(T) == typeof(byte))
			{
				result.register.byte_0 = (byte)(left.register.byte_0 * right.register.byte_0);
				result.register.byte_1 = (byte)(left.register.byte_1 * right.register.byte_1);
				result.register.byte_2 = (byte)(left.register.byte_2 * right.register.byte_2);
				result.register.byte_3 = (byte)(left.register.byte_3 * right.register.byte_3);
				result.register.byte_4 = (byte)(left.register.byte_4 * right.register.byte_4);
				result.register.byte_5 = (byte)(left.register.byte_5 * right.register.byte_5);
				result.register.byte_6 = (byte)(left.register.byte_6 * right.register.byte_6);
				result.register.byte_7 = (byte)(left.register.byte_7 * right.register.byte_7);
				result.register.byte_8 = (byte)(left.register.byte_8 * right.register.byte_8);
				result.register.byte_9 = (byte)(left.register.byte_9 * right.register.byte_9);
				result.register.byte_10 = (byte)(left.register.byte_10 * right.register.byte_10);
				result.register.byte_11 = (byte)(left.register.byte_11 * right.register.byte_11);
				result.register.byte_12 = (byte)(left.register.byte_12 * right.register.byte_12);
				result.register.byte_13 = (byte)(left.register.byte_13 * right.register.byte_13);
				result.register.byte_14 = (byte)(left.register.byte_14 * right.register.byte_14);
				result.register.byte_15 = (byte)(left.register.byte_15 * right.register.byte_15);
			}
			else if (typeof(T) == typeof(sbyte))
			{
				result.register.sbyte_0 = (sbyte)(left.register.sbyte_0 * right.register.sbyte_0);
				result.register.sbyte_1 = (sbyte)(left.register.sbyte_1 * right.register.sbyte_1);
				result.register.sbyte_2 = (sbyte)(left.register.sbyte_2 * right.register.sbyte_2);
				result.register.sbyte_3 = (sbyte)(left.register.sbyte_3 * right.register.sbyte_3);
				result.register.sbyte_4 = (sbyte)(left.register.sbyte_4 * right.register.sbyte_4);
				result.register.sbyte_5 = (sbyte)(left.register.sbyte_5 * right.register.sbyte_5);
				result.register.sbyte_6 = (sbyte)(left.register.sbyte_6 * right.register.sbyte_6);
				result.register.sbyte_7 = (sbyte)(left.register.sbyte_7 * right.register.sbyte_7);
				result.register.sbyte_8 = (sbyte)(left.register.sbyte_8 * right.register.sbyte_8);
				result.register.sbyte_9 = (sbyte)(left.register.sbyte_9 * right.register.sbyte_9);
				result.register.sbyte_10 = (sbyte)(left.register.sbyte_10 * right.register.sbyte_10);
				result.register.sbyte_11 = (sbyte)(left.register.sbyte_11 * right.register.sbyte_11);
				result.register.sbyte_12 = (sbyte)(left.register.sbyte_12 * right.register.sbyte_12);
				result.register.sbyte_13 = (sbyte)(left.register.sbyte_13 * right.register.sbyte_13);
				result.register.sbyte_14 = (sbyte)(left.register.sbyte_14 * right.register.sbyte_14);
				result.register.sbyte_15 = (sbyte)(left.register.sbyte_15 * right.register.sbyte_15);
			}
			else if (typeof(T) == typeof(ushort))
			{
				result.register.uint16_0 = (ushort)(left.register.uint16_0 * right.register.uint16_0);
				result.register.uint16_1 = (ushort)(left.register.uint16_1 * right.register.uint16_1);
				result.register.uint16_2 = (ushort)(left.register.uint16_2 * right.register.uint16_2);
				result.register.uint16_3 = (ushort)(left.register.uint16_3 * right.register.uint16_3);
				result.register.uint16_4 = (ushort)(left.register.uint16_4 * right.register.uint16_4);
				result.register.uint16_5 = (ushort)(left.register.uint16_5 * right.register.uint16_5);
				result.register.uint16_6 = (ushort)(left.register.uint16_6 * right.register.uint16_6);
				result.register.uint16_7 = (ushort)(left.register.uint16_7 * right.register.uint16_7);
			}
			else if (typeof(T) == typeof(short))
			{
				result.register.int16_0 = (short)(left.register.int16_0 * right.register.int16_0);
				result.register.int16_1 = (short)(left.register.int16_1 * right.register.int16_1);
				result.register.int16_2 = (short)(left.register.int16_2 * right.register.int16_2);
				result.register.int16_3 = (short)(left.register.int16_3 * right.register.int16_3);
				result.register.int16_4 = (short)(left.register.int16_4 * right.register.int16_4);
				result.register.int16_5 = (short)(left.register.int16_5 * right.register.int16_5);
				result.register.int16_6 = (short)(left.register.int16_6 * right.register.int16_6);
				result.register.int16_7 = (short)(left.register.int16_7 * right.register.int16_7);
			}
			else if (typeof(T) == typeof(uint))
			{
				result.register.uint32_0 = left.register.uint32_0 * right.register.uint32_0;
				result.register.uint32_1 = left.register.uint32_1 * right.register.uint32_1;
				result.register.uint32_2 = left.register.uint32_2 * right.register.uint32_2;
				result.register.uint32_3 = left.register.uint32_3 * right.register.uint32_3;
			}
			else if (typeof(T) == typeof(int))
			{
				result.register.int32_0 = left.register.int32_0 * right.register.int32_0;
				result.register.int32_1 = left.register.int32_1 * right.register.int32_1;
				result.register.int32_2 = left.register.int32_2 * right.register.int32_2;
				result.register.int32_3 = left.register.int32_3 * right.register.int32_3;
			}
			else if (typeof(T) == typeof(ulong))
			{
				result.register.uint64_0 = left.register.uint64_0 * right.register.uint64_0;
				result.register.uint64_1 = left.register.uint64_1 * right.register.uint64_1;
			}
			else if (typeof(T) == typeof(long))
			{
				result.register.int64_0 = left.register.int64_0 * right.register.int64_0;
				result.register.int64_1 = left.register.int64_1 * right.register.int64_1;
			}
			else if (typeof(T) == typeof(float))
			{
				result.register.single_0 = left.register.single_0 * right.register.single_0;
				result.register.single_1 = left.register.single_1 * right.register.single_1;
				result.register.single_2 = left.register.single_2 * right.register.single_2;
				result.register.single_3 = left.register.single_3 * right.register.single_3;
			}
			else if (typeof(T) == typeof(double))
			{
				result.register.double_0 = left.register.double_0 * right.register.double_0;
				result.register.double_1 = left.register.double_1 * right.register.double_1;
			}
			return result;
		}

		public static Vector<T>operator *(Vector<T> value, T factor)
		{
			if (Vector.IsHardwareAccelerated)
			{
				return new Vector<T>(factor) * value;
			}
			Vector<T> result = default(Vector<T>);
			if (typeof(T) == typeof(byte))
			{
				result.register.byte_0 = (byte)(value.register.byte_0 * (byte)(object)factor);
				result.register.byte_1 = (byte)(value.register.byte_1 * (byte)(object)factor);
				result.register.byte_2 = (byte)(value.register.byte_2 * (byte)(object)factor);
				result.register.byte_3 = (byte)(value.register.byte_3 * (byte)(object)factor);
				result.register.byte_4 = (byte)(value.register.byte_4 * (byte)(object)factor);
				result.register.byte_5 = (byte)(value.register.byte_5 * (byte)(object)factor);
				result.register.byte_6 = (byte)(value.register.byte_6 * (byte)(object)factor);
				result.register.byte_7 = (byte)(value.register.byte_7 * (byte)(object)factor);
				result.register.byte_8 = (byte)(value.register.byte_8 * (byte)(object)factor);
				result.register.byte_9 = (byte)(value.register.byte_9 * (byte)(object)factor);
				result.register.byte_10 = (byte)(value.register.byte_10 * (byte)(object)factor);
				result.register.byte_11 = (byte)(value.register.byte_11 * (byte)(object)factor);
				result.register.byte_12 = (byte)(value.register.byte_12 * (byte)(object)factor);
				result.register.byte_13 = (byte)(value.register.byte_13 * (byte)(object)factor);
				result.register.byte_14 = (byte)(value.register.byte_14 * (byte)(object)factor);
				result.register.byte_15 = (byte)(value.register.byte_15 * (byte)(object)factor);
			}
			else if (typeof(T) == typeof(sbyte))
			{
				result.register.sbyte_0 = (sbyte)(value.register.sbyte_0 * (sbyte)(object)factor);
				result.register.sbyte_1 = (sbyte)(value.register.sbyte_1 * (sbyte)(object)factor);
				result.register.sbyte_2 = (sbyte)(value.register.sbyte_2 * (sbyte)(object)factor);
				result.register.sbyte_3 = (sbyte)(value.register.sbyte_3 * (sbyte)(object)factor);
				result.register.sbyte_4 = (sbyte)(value.register.sbyte_4 * (sbyte)(object)factor);
				result.register.sbyte_5 = (sbyte)(value.register.sbyte_5 * (sbyte)(object)factor);
				result.register.sbyte_6 = (sbyte)(value.register.sbyte_6 * (sbyte)(object)factor);
				result.register.sbyte_7 = (sbyte)(value.register.sbyte_7 * (sbyte)(object)factor);
				result.register.sbyte_8 = (sbyte)(value.register.sbyte_8 * (sbyte)(object)factor);
				result.register.sbyte_9 = (sbyte)(value.register.sbyte_9 * (sbyte)(object)factor);
				result.register.sbyte_10 = (sbyte)(value.register.sbyte_10 * (sbyte)(object)factor);
				result.register.sbyte_11 = (sbyte)(value.register.sbyte_11 * (sbyte)(object)factor);
				result.register.sbyte_12 = (sbyte)(value.register.sbyte_12 * (sbyte)(object)factor);
				result.register.sbyte_13 = (sbyte)(value.register.sbyte_13 * (sbyte)(object)factor);
				result.register.sbyte_14 = (sbyte)(value.register.sbyte_14 * (sbyte)(object)factor);
				result.register.sbyte_15 = (sbyte)(value.register.sbyte_15 * (sbyte)(object)factor);
			}
			else if (typeof(T) == typeof(ushort))
			{
				result.register.uint16_0 = (ushort)(value.register.uint16_0 * (ushort)(object)factor);
				result.register.uint16_1 = (ushort)(value.register.uint16_1 * (ushort)(object)factor);
				result.register.uint16_2 = (ushort)(value.register.uint16_2 * (ushort)(object)factor);
				result.register.uint16_3 = (ushort)(value.register.uint16_3 * (ushort)(object)factor);
				result.register.uint16_4 = (ushort)(value.register.uint16_4 * (ushort)(object)factor);
				result.register.uint16_5 = (ushort)(value.register.uint16_5 * (ushort)(object)factor);
				result.register.uint16_6 = (ushort)(value.register.uint16_6 * (ushort)(object)factor);
				result.register.uint16_7 = (ushort)(value.register.uint16_7 * (ushort)(object)factor);
			}
			else if (typeof(T) == typeof(short))
			{
				result.register.int16_0 = (short)(value.register.int16_0 * (short)(object)factor);
				result.register.int16_1 = (short)(value.register.int16_1 * (short)(object)factor);
				result.register.int16_2 = (short)(value.register.int16_2 * (short)(object)factor);
				result.register.int16_3 = (short)(value.register.int16_3 * (short)(object)factor);
				result.register.int16_4 = (short)(value.register.int16_4 * (short)(object)factor);
				result.register.int16_5 = (short)(value.register.int16_5 * (short)(object)factor);
				result.register.int16_6 = (short)(value.register.int16_6 * (short)(object)factor);
				result.register.int16_7 = (short)(value.register.int16_7 * (short)(object)factor);
			}
			else if (typeof(T) == typeof(uint))
			{
				result.register.uint32_0 = value.register.uint32_0 * (uint)(object)factor;
				result.register.uint32_1 = value.register.uint32_1 * (uint)(object)factor;
				result.register.uint32_2 = value.register.uint32_2 * (uint)(object)factor;
				result.register.uint32_3 = value.register.uint32_3 * (uint)(object)factor;
			}
			else if (typeof(T) == typeof(int))
			{
				result.register.int32_0 = value.register.int32_0 * (int)(object)factor;
				result.register.int32_1 = value.register.int32_1 * (int)(object)factor;
				result.register.int32_2 = value.register.int32_2 * (int)(object)factor;
				result.register.int32_3 = value.register.int32_3 * (int)(object)factor;
			}
			else if (typeof(T) == typeof(ulong))
			{
				result.register.uint64_0 = value.register.uint64_0 * (ulong)(object)factor;
				result.register.uint64_1 = value.register.uint64_1 * (ulong)(object)factor;
			}
			else if (typeof(T) == typeof(long))
			{
				result.register.int64_0 = value.register.int64_0 * (long)(object)factor;
				result.register.int64_1 = value.register.int64_1 * (long)(object)factor;
			}
			else if (typeof(T) == typeof(float))
			{
				result.register.single_0 = value.register.single_0 * (float)(object)factor;
				result.register.single_1 = value.register.single_1 * (float)(object)factor;
				result.register.single_2 = value.register.single_2 * (float)(object)factor;
				result.register.single_3 = value.register.single_3 * (float)(object)factor;
			}
			else if (typeof(T) == typeof(double))
			{
				result.register.double_0 = value.register.double_0 * (double)(object)factor;
				result.register.double_1 = value.register.double_1 * (double)(object)factor;
			}
			return result;
		}

		public static Vector<T>operator *(T factor, Vector<T> value)
		{
			if (Vector.IsHardwareAccelerated)
			{
				return new Vector<T>(factor) * value;
			}
			Vector<T> result = default(Vector<T>);
			if (typeof(T) == typeof(byte))
			{
				result.register.byte_0 = (byte)(value.register.byte_0 * (byte)(object)factor);
				result.register.byte_1 = (byte)(value.register.byte_1 * (byte)(object)factor);
				result.register.byte_2 = (byte)(value.register.byte_2 * (byte)(object)factor);
				result.register.byte_3 = (byte)(value.register.byte_3 * (byte)(object)factor);
				result.register.byte_4 = (byte)(value.register.byte_4 * (byte)(object)factor);
				result.register.byte_5 = (byte)(value.register.byte_5 * (byte)(object)factor);
				result.register.byte_6 = (byte)(value.register.byte_6 * (byte)(object)factor);
				result.register.byte_7 = (byte)(value.register.byte_7 * (byte)(object)factor);
				result.register.byte_8 = (byte)(value.register.byte_8 * (byte)(object)factor);
				result.register.byte_9 = (byte)(value.register.byte_9 * (byte)(object)factor);
				result.register.byte_10 = (byte)(value.register.byte_10 * (byte)(object)factor);
				result.register.byte_11 = (byte)(value.register.byte_11 * (byte)(object)factor);
				result.register.byte_12 = (byte)(value.register.byte_12 * (byte)(object)factor);
				result.register.byte_13 = (byte)(value.register.byte_13 * (byte)(object)factor);
				result.register.byte_14 = (byte)(value.register.byte_14 * (byte)(object)factor);
				result.register.byte_15 = (byte)(value.register.byte_15 * (byte)(object)factor);
			}
			else if (typeof(T) == typeof(sbyte))
			{
				result.register.sbyte_0 = (sbyte)(value.register.sbyte_0 * (sbyte)(object)factor);
				result.register.sbyte_1 = (sbyte)(value.register.sbyte_1 * (sbyte)(object)factor);
				result.register.sbyte_2 = (sbyte)(value.register.sbyte_2 * (sbyte)(object)factor);
				result.register.sbyte_3 = (sbyte)(value.register.sbyte_3 * (sbyte)(object)factor);
				result.register.sbyte_4 = (sbyte)(value.register.sbyte_4 * (sbyte)(object)factor);
				result.register.sbyte_5 = (sbyte)(value.register.sbyte_5 * (sbyte)(object)factor);
				result.register.sbyte_6 = (sbyte)(value.register.sbyte_6 * (sbyte)(object)factor);
				result.register.sbyte_7 = (sbyte)(value.register.sbyte_7 * (sbyte)(object)factor);
				result.register.sbyte_8 = (sbyte)(value.register.sbyte_8 * (sbyte)(object)factor);
				result.register.sbyte_9 = (sbyte)(value.register.sbyte_9 * (sbyte)(object)factor);
				result.register.sbyte_10 = (sbyte)(value.register.sbyte_10 * (sbyte)(object)factor);
				result.register.sbyte_11 = (sbyte)(value.register.sbyte_11 * (sbyte)(object)factor);
				result.register.sbyte_12 = (sbyte)(value.register.sbyte_12 * (sbyte)(object)factor);
				result.register.sbyte_13 = (sbyte)(value.register.sbyte_13 * (sbyte)(object)factor);
				result.register.sbyte_14 = (sbyte)(value.register.sbyte_14 * (sbyte)(object)factor);
				result.register.sbyte_15 = (sbyte)(value.register.sbyte_15 * (sbyte)(object)factor);
			}
			else if (typeof(T) == typeof(ushort))
			{
				result.register.uint16_0 = (ushort)(value.register.uint16_0 * (ushort)(object)factor);
				result.register.uint16_1 = (ushort)(value.register.uint16_1 * (ushort)(object)factor);
				result.register.uint16_2 = (ushort)(value.register.uint16_2 * (ushort)(object)factor);
				result.register.uint16_3 = (ushort)(value.register.uint16_3 * (ushort)(object)factor);
				result.register.uint16_4 = (ushort)(value.register.uint16_4 * (ushort)(object)factor);
				result.register.uint16_5 = (ushort)(value.register.uint16_5 * (ushort)(object)factor);
				result.register.uint16_6 = (ushort)(value.register.uint16_6 * (ushort)(object)factor);
				result.register.uint16_7 = (ushort)(value.register.uint16_7 * (ushort)(object)factor);
			}
			else if (typeof(T) == typeof(short))
			{
				result.register.int16_0 = (short)(value.register.int16_0 * (short)(object)factor);
				result.register.int16_1 = (short)(value.register.int16_1 * (short)(object)factor);
				result.register.int16_2 = (short)(value.register.int16_2 * (short)(object)factor);
				result.register.int16_3 = (short)(value.register.int16_3 * (short)(object)factor);
				result.register.int16_4 = (short)(value.register.int16_4 * (short)(object)factor);
				result.register.int16_5 = (short)(value.register.int16_5 * (short)(object)factor);
				result.register.int16_6 = (short)(value.register.int16_6 * (short)(object)factor);
				result.register.int16_7 = (short)(value.register.int16_7 * (short)(object)factor);
			}
			else if (typeof(T) == typeof(uint))
			{
				result.register.uint32_0 = value.register.uint32_0 * (uint)(object)factor;
				result.register.uint32_1 = value.register.uint32_1 * (uint)(object)factor;
				result.register.uint32_2 = value.register.uint32_2 * (uint)(object)factor;
				result.register.uint32_3 = value.register.uint32_3 * (uint)(object)factor;
			}
			else if (typeof(T) == typeof(int))
			{
				result.register.int32_0 = value.register.int32_0 * (int)(object)factor;
				result.register.int32_1 = value.register.int32_1 * (int)(object)factor;
				result.register.int32_2 = value.register.int32_2 * (int)(object)factor;
				result.register.int32_3 = value.register.int32_3 * (int)(object)factor;
			}
			else if (typeof(T) == typeof(ulong))
			{
				result.register.uint64_0 = value.register.uint64_0 * (ulong)(object)factor;
				result.register.uint64_1 = value.register.uint64_1 * (ulong)(object)factor;
			}
			else if (typeof(T) == typeof(long))
			{
				result.register.int64_0 = value.register.int64_0 * (long)(object)factor;
				result.register.int64_1 = value.register.int64_1 * (long)(object)factor;
			}
			else if (typeof(T) == typeof(float))
			{
				result.register.single_0 = value.register.single_0 * (float)(object)factor;
				result.register.single_1 = value.register.single_1 * (float)(object)factor;
				result.register.single_2 = value.register.single_2 * (float)(object)factor;
				result.register.single_3 = value.register.single_3 * (float)(object)factor;
			}
			else if (typeof(T) == typeof(double))
			{
				result.register.double_0 = value.register.double_0 * (double)(object)factor;
				result.register.double_1 = value.register.double_1 * (double)(object)factor;
			}
			return result;
		}

		public unsafe static Vector<T>operator /(Vector<T> left, Vector<T> right)
		{
			if (Vector.IsHardwareAccelerated)
			{
				if (typeof(T) == typeof(byte))
				{
					byte* ptr = stackalloc byte[(int)(uint)Count];
					for (int i = 0; i < Count; i++)
					{
						ptr[i] = (byte)(object)ScalarDivide(left[i], right[i]);
					}
					return new Vector<T>(ptr);
				}
				if (typeof(T) == typeof(sbyte))
				{
					sbyte* ptr2 = stackalloc sbyte[(int)(uint)Count];
					for (int j = 0; j < Count; j++)
					{
						ptr2[j] = (sbyte)(object)ScalarDivide(left[j], right[j]);
					}
					return new Vector<T>(ptr2);
				}
				if (typeof(T) == typeof(ushort))
				{
					ushort* ptr3 = stackalloc ushort[Count];
					for (int k = 0; k < Count; k++)
					{
						ptr3[k] = (ushort)(object)ScalarDivide(left[k], right[k]);
					}
					return new Vector<T>(ptr3);
				}
				if (typeof(T) == typeof(short))
				{
					short* ptr4 = stackalloc short[Count];
					for (int l = 0; l < Count; l++)
					{
						ptr4[l] = (short)(object)ScalarDivide(left[l], right[l]);
					}
					return new Vector<T>(ptr4);
				}
				if (typeof(T) == typeof(uint))
				{
					uint* ptr5 = stackalloc uint[Count];
					for (int m = 0; m < Count; m++)
					{
						ptr5[m] = (uint)(object)ScalarDivide(left[m], right[m]);
					}
					return new Vector<T>(ptr5);
				}
				if (typeof(T) == typeof(int))
				{
					int* ptr6 = stackalloc int[Count];
					for (int n = 0; n < Count; n++)
					{
						ptr6[n] = (int)(object)ScalarDivide(left[n], right[n]);
					}
					return new Vector<T>(ptr6);
				}
				if (typeof(T) == typeof(ulong))
				{
					ulong* ptr7 = stackalloc ulong[Count];
					for (int num = 0; num < Count; num++)
					{
						ptr7[num] = (ulong)(object)ScalarDivide(left[num], right[num]);
					}
					return new Vector<T>(ptr7);
				}
				if (typeof(T) == typeof(long))
				{
					long* ptr8 = stackalloc long[Count];
					for (int num2 = 0; num2 < Count; num2++)
					{
						ptr8[num2] = (long)(object)ScalarDivide(left[num2], right[num2]);
					}
					return new Vector<T>(ptr8);
				}
				if (typeof(T) == typeof(float))
				{
					float* ptr9 = stackalloc float[Count];
					for (int num3 = 0; num3 < Count; num3++)
					{
						ptr9[num3] = (float)(object)ScalarDivide(left[num3], right[num3]);
					}
					return new Vector<T>(ptr9);
				}
				if (typeof(T) == typeof(double))
				{
					double* ptr10 = stackalloc double[Count];
					for (int num4 = 0; num4 < Count; num4++)
					{
						ptr10[num4] = (double)(object)ScalarDivide(left[num4], right[num4]);
					}
					return new Vector<T>(ptr10);
				}
				throw new NotSupportedException(System.SR.Arg_TypeNotSupported);
			}
			Vector<T> result = default(Vector<T>);
			if (typeof(T) == typeof(byte))
			{
				result.register.byte_0 = (byte)(left.register.byte_0 / right.register.byte_0);
				result.register.byte_1 = (byte)(left.register.byte_1 / right.register.byte_1);
				result.register.byte_2 = (byte)(left.register.byte_2 / right.register.byte_2);
				result.register.byte_3 = (byte)(left.register.byte_3 / right.register.byte_3);
				result.register.byte_4 = (byte)(left.register.byte_4 / right.register.byte_4);
				result.register.byte_5 = (byte)(left.register.byte_5 / right.register.byte_5);
				result.register.byte_6 = (byte)(left.register.byte_6 / right.register.byte_6);
				result.register.byte_7 = (byte)(left.register.byte_7 / right.register.byte_7);
				result.register.byte_8 = (byte)(left.register.byte_8 / right.register.byte_8);
				result.register.byte_9 = (byte)(left.register.byte_9 / right.register.byte_9);
				result.register.byte_10 = (byte)(left.register.byte_10 / right.register.byte_10);
				result.register.byte_11 = (byte)(left.register.byte_11 / right.register.byte_11);
				result.register.byte_12 = (byte)(left.register.byte_12 / right.register.byte_12);
				result.register.byte_13 = (byte)(left.register.byte_13 / right.register.byte_13);
				result.register.byte_14 = (byte)(left.register.byte_14 / right.register.byte_14);
				result.register.byte_15 = (byte)(left.register.byte_15 / right.register.byte_15);
			}
			else if (typeof(T) == typeof(sbyte))
			{
				result.register.sbyte_0 = (sbyte)(left.register.sbyte_0 / right.register.sbyte_0);
				result.register.sbyte_1 = (sbyte)(left.register.sbyte_1 / right.register.sbyte_1);
				result.register.sbyte_2 = (sbyte)(left.register.sbyte_2 / right.register.sbyte_2);
				result.register.sbyte_3 = (sbyte)(left.register.sbyte_3 / right.register.sbyte_3);
				result.register.sbyte_4 = (sbyte)(left.register.sbyte_4 / right.register.sbyte_4);
				result.register.sbyte_5 = (sbyte)(left.register.sbyte_5 / right.register.sbyte_5);
				result.register.sbyte_6 = (sbyte)(left.register.sbyte_6 / right.register.sbyte_6);
				result.register.sbyte_7 = (sbyte)(left.register.sbyte_7 / right.register.sbyte_7);
				result.register.sbyte_8 = (sbyte)(left.register.sbyte_8 / right.register.sbyte_8);
				result.register.sbyte_9 = (sbyte)(left.register.sbyte_9 / right.register.sbyte_9);
				result.register.sbyte_10 = (sbyte)(left.register.sbyte_10 / right.register.sbyte_10);
				result.register.sbyte_11 = (sbyte)(left.register.sbyte_11 / right.register.sbyte_11);
				result.register.sbyte_12 = (sbyte)(left.register.sbyte_12 / right.register.sbyte_12);
				result.register.sbyte_13 = (sbyte)(left.register.sbyte_13 / right.register.sbyte_13);
				result.register.sbyte_14 = (sbyte)(left.register.sbyte_14 / right.register.sbyte_14);
				result.register.sbyte_15 = (sbyte)(left.register.sbyte_15 / right.register.sbyte_15);
			}
			else if (typeof(T) == typeof(ushort))
			{
				result.register.uint16_0 = (ushort)(left.register.uint16_0 / right.register.uint16_0);
				result.register.uint16_1 = (ushort)(left.register.uint16_1 / right.register.uint16_1);
				result.register.uint16_2 = (ushort)(left.register.uint16_2 / right.register.uint16_2);
				result.register.uint16_3 = (ushort)(left.register.uint16_3 / right.register.uint16_3);
				result.register.uint16_4 = (ushort)(left.register.uint16_4 / right.register.uint16_4);
				result.register.uint16_5 = (ushort)(left.register.uint16_5 / right.register.uint16_5);
				result.register.uint16_6 = (ushort)(left.register.uint16_6 / right.register.uint16_6);
				result.register.uint16_7 = (ushort)(left.register.uint16_7 / right.register.uint16_7);
			}
			else if (typeof(T) == typeof(short))
			{
				result.register.int16_0 = (short)(left.register.int16_0 / right.register.int16_0);
				result.register.int16_1 = (short)(left.register.int16_1 / right.register.int16_1);
				result.register.int16_2 = (short)(left.register.int16_2 / right.register.int16_2);
				result.register.int16_3 = (short)(left.register.int16_3 / right.register.int16_3);
				result.register.int16_4 = (short)(left.register.int16_4 / right.register.int16_4);
				result.register.int16_5 = (short)(left.register.int16_5 / right.register.int16_5);
				result.register.int16_6 = (short)(left.register.int16_6 / right.register.int16_6);
				result.register.int16_7 = (short)(left.register.int16_7 / right.register.int16_7);
			}
			else if (typeof(T) == typeof(uint))
			{
				result.register.uint32_0 = left.register.uint32_0 / right.register.uint32_0;
				result.register.uint32_1 = left.register.uint32_1 / right.register.uint32_1;
				result.register.uint32_2 = left.register.uint32_2 / right.register.uint32_2;
				result.register.uint32_3 = left.register.uint32_3 / right.register.uint32_3;
			}
			else if (typeof(T) == typeof(int))
			{
				result.register.int32_0 = left.register.int32_0 / right.register.int32_0;
				result.register.int32_1 = left.register.int32_1 / right.register.int32_1;
				result.register.int32_2 = left.register.int32_2 / right.register.int32_2;
				result.register.int32_3 = left.register.int32_3 / right.register.int32_3;
			}
			else if (typeof(T) == typeof(ulong))
			{
				result.register.uint64_0 = left.register.uint64_0 / right.register.uint64_0;
				result.register.uint64_1 = left.register.uint64_1 / right.register.uint64_1;
			}
			else if (typeof(T) == typeof(long))
			{
				result.register.int64_0 = left.register.int64_0 / right.register.int64_0;
				result.register.int64_1 = left.register.int64_1 / right.register.int64_1;
			}
			else if (typeof(T) == typeof(float))
			{
				result.register.single_0 = left.register.single_0 / right.register.single_0;
				result.register.single_1 = left.register.single_1 / right.register.single_1;
				result.register.single_2 = left.register.single_2 / right.register.single_2;
				result.register.single_3 = left.register.single_3 / right.register.single_3;
			}
			else if (typeof(T) == typeof(double))
			{
				result.register.double_0 = left.register.double_0 / right.register.double_0;
				result.register.double_1 = left.register.double_1 / right.register.double_1;
			}
			return result;
		}

		public static Vector<T>operator -(Vector<T> value)
		{
			return Zero - value;
		}

		[System.Runtime.CompilerServices.Intrinsic]
		public unsafe static Vector<T>operator &(Vector<T> left, Vector<T> right)
		{
			Vector<T> result = default(Vector<T>);
			if (Vector.IsHardwareAccelerated)
			{
				long* ptr = &result.register.int64_0;
				long* ptr2 = &left.register.int64_0;
				long* ptr3 = &right.register.int64_0;
				for (int i = 0; i < Vector<long>.Count; i++)
				{
					ptr[i] = ptr2[i] & ptr3[i];
				}
			}
			else
			{
				result.register.int64_0 = left.register.int64_0 & right.register.int64_0;
				result.register.int64_1 = left.register.int64_1 & right.register.int64_1;
			}
			return result;
		}

		[System.Runtime.CompilerServices.Intrinsic]
		public unsafe static Vector<T>operator |(Vector<T> left, Vector<T> right)
		{
			Vector<T> result = default(Vector<T>);
			if (Vector.IsHardwareAccelerated)
			{
				long* ptr = &result.register.int64_0;
				long* ptr2 = &left.register.int64_0;
				long* ptr3 = &right.register.int64_0;
				for (int i = 0; i < Vector<long>.Count; i++)
				{
					ptr[i] = ptr2[i] | ptr3[i];
				}
			}
			else
			{
				result.register.int64_0 = left.register.int64_0 | right.register.int64_0;
				result.register.int64_1 = left.register.int64_1 | right.register.int64_1;
			}
			return result;
		}

		[System.Runtime.CompilerServices.Intrinsic]
		public unsafe static Vector<T>operator ^(Vector<T> left, Vector<T> right)
		{
			Vector<T> result = default(Vector<T>);
			if (Vector.IsHardwareAccelerated)
			{
				long* ptr = &result.register.int64_0;
				long* ptr2 = &left.register.int64_0;
				long* ptr3 = &right.register.int64_0;
				for (int i = 0; i < Vector<long>.Count; i++)
				{
					ptr[i] = ptr2[i] ^ ptr3[i];
				}
			}
			else
			{
				result.register.int64_0 = left.register.int64_0 ^ right.register.int64_0;
				result.register.int64_1 = left.register.int64_1 ^ right.register.int64_1;
			}
			return result;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static Vector<T>operator ~(Vector<T> value)
		{
			return s_allOnes ^ value;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static bool operator ==(Vector<T> left, Vector<T> right)
		{
			return left.Equals(right);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static bool operator !=(Vector<T> left, Vector<T> right)
		{
			return !(left == right);
		}

		[System.Runtime.CompilerServices.Intrinsic]
		public static explicit operator Vector<byte>(Vector<T> value)
		{
			return new Vector<byte>(ref value.register);
		}

		[CLSCompliant(false)]
		[System.Runtime.CompilerServices.Intrinsic]
		public static explicit operator Vector<sbyte>(Vector<T> value)
		{
			return new Vector<sbyte>(ref value.register);
		}

		[CLSCompliant(false)]
		[System.Runtime.CompilerServices.Intrinsic]
		public static explicit operator Vector<ushort>(Vector<T> value)
		{
			return new Vector<ushort>(ref value.register);
		}

		[System.Runtime.CompilerServices.Intrinsic]
		public static explicit operator Vector<short>(Vector<T> value)
		{
			return new Vector<short>(ref value.register);
		}

		[CLSCompliant(false)]
		[System.Runtime.CompilerServices.Intrinsic]
		public static explicit operator Vector<uint>(Vector<T> value)
		{
			return new Vector<uint>(ref value.register);
		}

		[System.Runtime.CompilerServices.Intrinsic]
		public static explicit operator Vector<int>(Vector<T> value)
		{
			return new Vector<int>(ref value.register);
		}

		[CLSCompliant(false)]
		[System.Runtime.CompilerServices.Intrinsic]
		public static explicit operator Vector<ulong>(Vector<T> value)
		{
			return new Vector<ulong>(ref value.register);
		}

		[System.Runtime.CompilerServices.Intrinsic]
		public static explicit operator Vector<long>(Vector<T> value)
		{
			return new Vector<long>(ref value.register);
		}

		[System.Runtime.CompilerServices.Intrinsic]
		public static explicit operator Vector<float>(Vector<T> value)
		{
			return new Vector<float>(ref value.register);
		}

		[System.Runtime.CompilerServices.Intrinsic]
		public static explicit operator Vector<double>(Vector<T> value)
		{
			return new Vector<double>(ref value.register);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		[System.Runtime.Compile

BepInEx/plugins/SlopCrew.Plugin/System.Runtime.CompilerServices.Unsafe.dll

Decompiled 8 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using Microsoft.CodeAnalysis;

[assembly: AssemblyProduct("Microsoft® .NET Framework")]
[assembly: CLSCompliant(false)]
[assembly: AssemblyMetadata(".NETFrameworkAssembly", "")]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: CompilationRelaxations(8)]
[assembly: AssemblyDescription("System.Runtime.CompilerServices.Unsafe")]
[assembly: AssemblyFileVersion("6.0.21.52210")]
[assembly: AssemblyInformationalVersion("6.0.0")]
[assembly: AssemblyTitle("System.Runtime.CompilerServices.Unsafe")]
[assembly: AssemblyMetadata("Serviceable", "True")]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: AssemblyMetadata("IsTrimmable", "True")]
[assembly: AssemblyCopyright("© Microsoft Corporation.  All rights reserved.")]
[assembly: AssemblyCompany("Microsoft Corporation")]
[assembly: AssemblyVersion("6.0.0.0")]
namespace System.Runtime.CompilerServices
{
	public static class Unsafe
	{
		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		[System.Runtime.Versioning.NonVersionable]
		public unsafe static T Read<T>(void* source)
		{
			return Unsafe.Read<T>(source);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		[System.Runtime.Versioning.NonVersionable]
		public unsafe static T ReadUnaligned<T>(void* source)
		{
			return Unsafe.ReadUnaligned<T>(source);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		[System.Runtime.Versioning.NonVersionable]
		public static T ReadUnaligned<T>(ref byte source)
		{
			return Unsafe.ReadUnaligned<T>(ref source);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		[System.Runtime.Versioning.NonVersionable]
		public unsafe static void Write<T>(void* destination, T value)
		{
			Unsafe.Write(destination, value);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		[System.Runtime.Versioning.NonVersionable]
		public unsafe static void WriteUnaligned<T>(void* destination, T value)
		{
			Unsafe.WriteUnaligned(destination, value);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		[System.Runtime.Versioning.NonVersionable]
		public static void WriteUnaligned<T>(ref byte destination, T value)
		{
			Unsafe.WriteUnaligned(ref destination, value);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		[System.Runtime.Versioning.NonVersionable]
		public unsafe static void Copy<T>(void* destination, ref T source)
		{
			Unsafe.Write(destination, source);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		[System.Runtime.Versioning.NonVersionable]
		public unsafe static void Copy<T>(ref T destination, void* source)
		{
			destination = Unsafe.Read<T>(source);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		[System.Runtime.Versioning.NonVersionable]
		public unsafe static void* AsPointer<T>(ref T value)
		{
			return Unsafe.AsPointer(ref value);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		[System.Runtime.Versioning.NonVersionable]
		public static void SkipInit<T>(out T value)
		{
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		[System.Runtime.Versioning.NonVersionable]
		public static int SizeOf<T>()
		{
			return Unsafe.SizeOf<T>();
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		[System.Runtime.Versioning.NonVersionable]
		public unsafe static void CopyBlock(void* destination, void* source, uint byteCount)
		{
			// IL cpblk instruction
			Unsafe.CopyBlock(destination, source, byteCount);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		[System.Runtime.Versioning.NonVersionable]
		public static void CopyBlock(ref byte destination, ref byte source, uint byteCount)
		{
			// IL cpblk instruction
			Unsafe.CopyBlock(ref destination, ref source, byteCount);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		[System.Runtime.Versioning.NonVersionable]
		public unsafe static void CopyBlockUnaligned(void* destination, void* source, uint byteCount)
		{
			// IL cpblk instruction
			Unsafe.CopyBlockUnaligned(destination, source, byteCount);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		[System.Runtime.Versioning.NonVersionable]
		public static void CopyBlockUnaligned(ref byte destination, ref byte source, uint byteCount)
		{
			// IL cpblk instruction
			Unsafe.CopyBlockUnaligned(ref destination, ref source, byteCount);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		[System.Runtime.Versioning.NonVersionable]
		public unsafe static void InitBlock(void* startAddress, byte value, uint byteCount)
		{
			// IL initblk instruction
			Unsafe.InitBlock(startAddress, value, byteCount);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		[System.Runtime.Versioning.NonVersionable]
		public static void InitBlock(ref byte startAddress, byte value, uint byteCount)
		{
			// IL initblk instruction
			Unsafe.InitBlock(ref startAddress, value, byteCount);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		[System.Runtime.Versioning.NonVersionable]
		public unsafe static void InitBlockUnaligned(void* startAddress, byte value, uint byteCount)
		{
			// IL initblk instruction
			Unsafe.InitBlockUnaligned(startAddress, value, byteCount);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		[System.Runtime.Versioning.NonVersionable]
		public static void InitBlockUnaligned(ref byte startAddress, byte value, uint byteCount)
		{
			// IL initblk instruction
			Unsafe.InitBlockUnaligned(ref startAddress, value, byteCount);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		[System.Runtime.Versioning.NonVersionable]
		public static T As<T>(object o) where T : class
		{
			return (T)o;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		[System.Runtime.Versioning.NonVersionable]
		public unsafe static ref T AsRef<T>(void* source)
		{
			return ref *(T*)source;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		[System.Runtime.Versioning.NonVersionable]
		public static ref T AsRef<T>(in T source)
		{
			return ref source;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		[System.Runtime.Versioning.NonVersionable]
		public static ref TTo As<TFrom, TTo>(ref TFrom source)
		{
			return ref Unsafe.As<TFrom, TTo>(ref source);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		[System.Runtime.Versioning.NonVersionable]
		public static ref T Unbox<T>(object box) where T : struct
		{
			return ref (T)box;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		[System.Runtime.Versioning.NonVersionable]
		public static ref T Add<T>(ref T source, int elementOffset)
		{
			return ref Unsafe.Add(ref source, elementOffset);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		[System.Runtime.Versioning.NonVersionable]
		public unsafe static void* Add<T>(void* source, int elementOffset)
		{
			return (byte*)source + (nint)elementOffset * (nint)Unsafe.SizeOf<T>();
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		[System.Runtime.Versioning.NonVersionable]
		public static ref T Add<T>(ref T source, IntPtr elementOffset)
		{
			return ref Unsafe.Add(ref source, elementOffset);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static ref T Add<T>(ref T source, [System.Runtime.Versioning.NonVersionable] nuint elementOffset)
		{
			return ref Unsafe.Add(ref source, elementOffset);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		[System.Runtime.Versioning.NonVersionable]
		public static ref T AddByteOffset<T>(ref T source, IntPtr byteOffset)
		{
			return ref Unsafe.AddByteOffset(ref source, byteOffset);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static ref T AddByteOffset<T>(ref T source, [System.Runtime.Versioning.NonVersionable] nuint byteOffset)
		{
			return ref Unsafe.AddByteOffset(ref source, byteOffset);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		[System.Runtime.Versioning.NonVersionable]
		public static ref T Subtract<T>(ref T source, int elementOffset)
		{
			return ref Unsafe.Subtract(ref source, elementOffset);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		[System.Runtime.Versioning.NonVersionable]
		public unsafe static void* Subtract<T>(void* source, int elementOffset)
		{
			return (byte*)source - (nint)elementOffset * (nint)Unsafe.SizeOf<T>();
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		[System.Runtime.Versioning.NonVersionable]
		public static ref T Subtract<T>(ref T source, IntPtr elementOffset)
		{
			return ref Unsafe.Subtract(ref source, elementOffset);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static ref T Subtract<T>(ref T source, [System.Runtime.Versioning.NonVersionable] nuint elementOffset)
		{
			return ref Unsafe.Subtract(ref source, elementOffset);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		[System.Runtime.Versioning.NonVersionable]
		public static ref T SubtractByteOffset<T>(ref T source, IntPtr byteOffset)
		{
			return ref Unsafe.SubtractByteOffset(ref source, byteOffset);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static ref T SubtractByteOffset<T>(ref T source, [System.Runtime.Versioning.NonVersionable] nuint byteOffset)
		{
			return ref Unsafe.SubtractByteOffset(ref source, byteOffset);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		[System.Runtime.Versioning.NonVersionable]
		public static IntPtr ByteOffset<T>(ref T origin, ref T target)
		{
			return Unsafe.ByteOffset(target: ref target, origin: ref origin);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		[System.Runtime.Versioning.NonVersionable]
		public static bool AreSame<T>(ref T left, ref T right)
		{
			return Unsafe.AreSame(ref left, ref right);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		[System.Runtime.Versioning.NonVersionable]
		public static bool IsAddressGreaterThan<T>(ref T left, ref T right)
		{
			return Unsafe.IsAddressGreaterThan(ref left, ref right);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		[System.Runtime.Versioning.NonVersionable]
		public static bool IsAddressLessThan<T>(ref T left, ref T right)
		{
			return Unsafe.IsAddressLessThan(ref left, ref right);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		[System.Runtime.Versioning.NonVersionable]
		public unsafe static bool IsNullRef<T>(ref T source)
		{
			return Unsafe.AsPointer(ref source) == null;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		[System.Runtime.Versioning.NonVersionable]
		public unsafe static ref T NullRef<T>()
		{
			return ref *(T*)null;
		}
	}
}
namespace System.Runtime.Versioning
{
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Constructor | AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
	internal sealed class NonVersionableAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	internal sealed class IsReadOnlyAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	[Microsoft.CodeAnalysis.Embedded]
	[CompilerGenerated]
	internal sealed class NativeIntegerAttribute : Attribute
	{
		public readonly bool[] TransformFlags;

		public NativeIntegerAttribute()
		{
			TransformFlags = new bool[1] { true };
		}

		public NativeIntegerAttribute(bool[] A_0)
		{
			TransformFlags = A_0;
		}
	}
}
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}

BepInEx/plugins/SlopCrew.Plugin/System.Runtime.InteropServices.RuntimeInformation.dll

Decompiled 8 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using FxResources.System.Runtime.InteropServices.RuntimeInformation;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(/*Could not decode attribute arguments.*/)]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: AssemblyTitle("System.Runtime.InteropServices.RuntimeInformation")]
[assembly: AssemblyDescription("System.Runtime.InteropServices.RuntimeInformation")]
[assembly: AssemblyDefaultAlias("System.Runtime.InteropServices.RuntimeInformation")]
[assembly: AssemblyCompany("Microsoft Corporation")]
[assembly: AssemblyProduct("Microsoft® .NET Framework")]
[assembly: AssemblyCopyright("© Microsoft Corporation.  All rights reserved.")]
[assembly: AssemblyFileVersion("4.6.24705.01")]
[assembly: AssemblyInformationalVersion("4.6.24705.01. Commit Hash: 4d1af962ca0fede10beb01d197367c2f90e92c97")]
[assembly: CLSCompliant(true)]
[assembly: AssemblyMetadata(".NETFrameworkAssembly", "")]
[assembly: AssemblyMetadata("Serviceable", "True")]
[assembly: AssemblyVersion("4.0.1.0")]
internal static class Interop : Object
{
	internal class NtDll : Object
	{
		internal struct RTL_OSVERSIONINFOEX : ValueType
		{
			internal uint dwOSVersionInfoSize;

			internal uint dwMajorVersion;

			internal uint dwMinorVersion;

			internal uint dwBuildNumber;

			internal uint dwPlatformId;

			[MarshalAs(23, SizeConst = 128)]
			internal string szCSDVersion;
		}

		[DllImport("ntdll.dll")]
		private static extern int RtlGetVersion(out RTL_OSVERSIONINFOEX lpVersionInformation);

		internal static string RtlGetVersion()
		{
			RTL_OSVERSIONINFOEX lpVersionInformation = default(RTL_OSVERSIONINFOEX);
			lpVersionInformation.dwOSVersionInfoSize = (uint)Marshal.SizeOf((object)lpVersionInformation);
			if (RtlGetVersion(out lpVersionInformation) == 0)
			{
				return String.Format("{0} {1}.{2}.{3} {4}", (object[])(object)new Object[5]
				{
					(Object)"Microsoft Windows",
					(object)lpVersionInformation.dwMajorVersion,
					(object)lpVersionInformation.dwMinorVersion,
					(object)lpVersionInformation.dwBuildNumber,
					(Object)lpVersionInformation.szCSDVersion
				});
			}
			return "Microsoft Windows";
		}
	}

	internal static class Libraries : Object
	{
		internal const string Advapi32 = "advapi32.dll";

		internal const string BCrypt = "BCrypt.dll";

		internal const string Combase = "combase.dll";

		internal const string Console_L1 = "api-ms-win-core-console-l1-1-0.dll";

		internal const string Console_L2 = "api-ms-win-core-console-l2-1-0.dll";

		internal const string CoreFile_L1 = "api-ms-win-core-file-l1-1-0.dll";

		internal const string CoreFile_L1_2 = "api-ms-win-core-file-l1-2-0.dll";

		internal const string CoreFile_L2 = "api-ms-win-core-file-l2-1-0.dll";

		internal const string Crypt32 = "crypt32.dll";

		internal const string Debug = "api-ms-win-core-debug-l1-1-0.dll";

		internal const string Error_L1 = "api-ms-win-core-winrt-error-l1-1-0.dll";

		internal const string ErrorHandling = "api-ms-win-core-errorhandling-l1-1-0.dll";

		internal const string Eventing = "api-ms-win-eventing-provider-l1-1-0.dll";

		internal const string Handle = "api-ms-win-core-handle-l1-1-0.dll";

		internal const string Heap = "api-ms-win-core-heap-obsolete-l1-1-0.dll";

		internal const string Heap_L1 = "api-ms-win-core-heap-l1-1-0.dll";

		internal const string IO = "api-ms-win-core-io-l1-1-0.dll";

		internal const string IpHlpApi = "iphlpapi.dll";

		internal const string Kernel32 = "kernel32.dll";

		internal const string Kernel32_L1 = "api-ms-win-core-kernel32-legacy-l1-1-1.dll";

		internal const string Kernel32_L2 = "api-ms-win-core-kernel32-legacy-l1-1-0.dll";

		internal const string Keyboard = "ext-ms-win-ntuser-keyboard-l1-2-1.dll";

		internal const string LibraryLoader = "api-ms-win-core-libraryloader-l1-1-0.dll";

		internal const string Localization = "api-ms-win-core-localization-l1-2-0.dll";

		internal const string Memory_L1_0 = "api-ms-win-core-memory-l1-1-0.dll";

		internal const string Memory_L1_1 = "api-ms-win-core-memory-l1-1-1.dll";

		internal const string Memory_L1_2 = "api-ms-win-core-memory-l1-1-2.dll";

		internal const string Memory_L1_3 = "api-ms-win-core-memory-l1-1-3.dll";

		internal const string NCrypt = "ncrypt.dll";

		internal const string NtDll = "ntdll.dll";

		internal const string OleAut32 = "oleaut32.dll";

		internal const string Pipe = "api-ms-win-core-namedpipe-l1-1-0.dll";

		internal const string Pipe_L2 = "api-ms-win-core-namedpipe-l1-2-1.dll";

		internal const string ProcessEnvironment = "api-ms-win-core-processenvironment-l1-1-0.dll";

		internal const string ProcessThread_L1 = "api-ms-win-core-processthreads-l1-1-0.dll";

		internal const string ProcessThread_L1_1 = "api-ms-win-core-processthreads-l1-1-1.dll";

		internal const string ProcessThread_L1_2 = "api-ms-win-core-processthreads-l1-1-2.dll";

		internal const string ProcessTopology = "api-ms-win-core-processtopology-obsolete-l1-1-0.dll";

		internal const string Profile = "api-ms-win-core-profile-l1-1-0.dll";

		internal const string Psapi = "api-ms-win-core-psapi-l1-1-0.dll";

		internal const string Psapi_Obsolete = "api-ms-win-core-psapi-obsolete-l1-1-0.dll";

		internal const string Registry_L1 = "api-ms-win-core-registry-l1-1-0.dll";

		internal const string Registry_L2 = "api-ms-win-core-registry-l2-1-0.dll";

		internal const string RoBuffer = "api-ms-win-core-winrt-robuffer-l1-1-0.dll";

		internal const string SecurityBase = "api-ms-win-security-base-l1-1-0.dll";

		internal const string SecurityCpwl = "api-ms-win-security-cpwl-l1-1-0.dll";

		internal const string SecurityCryptoApi = "api-ms-win-security-cryptoapi-l1-1-0.dll";

		internal const string SecurityLsa = "api-ms-win-security-lsalookup-l2-1-0.dll";

		internal const string SecurityLsaPolicy = "api-ms-win-security-lsapolicy-l1-1-0.dll";

		internal const string SecurityProvider = "api-ms-win-security-provider-l1-1-0.dll";

		internal const string SecuritySddl = "api-ms-win-security-sddl-l1-1-0.dll";

		internal const string ServiceCore = "api-ms-win-service-core-l1-1-1.dll";

		internal const string ServiceMgmt_L1 = "api-ms-win-service-management-l1-1-0.dll";

		internal const string ServiceMgmt_L2 = "api-ms-win-service-management-l2-1-0.dll";

		internal const string ServiceWinSvc = "api-ms-win-service-winsvc-l1-1-0.dll";

		internal const string Sspi = "sspicli.dll";

		internal const string String_L1 = "api-ms-win-core-string-l1-1-0.dll";

		internal const string Synch = "api-ms-win-core-synch-l1-1-0.dll";

		internal const string SystemInfo_L1_1 = "api-ms-win-core-sysinfo-l1-1-0.dll";

		internal const string SystemInfo_L1_2 = "api-ms-win-core-sysinfo-l1-2-0.dll";

		internal const string ThreadPool = "api-ms-win-core-threadpool-l1-2-0.dll";

		internal const string User32 = "user32.dll";

		internal const string Util = "api-ms-win-core-util-l1-1-0.dll";

		internal const string Version = "api-ms-win-core-version-l1-1-0.dll";

		internal const string WinHttp = "winhttp.dll";

		internal const string Winsock = "Ws2_32.dll";

		internal const string Wow64 = "api-ms-win-core-wow64-l1-1-0.dll";

		internal const string Ws2_32 = "ws2_32.dll";

		internal const string Zlib = "clrcompression.dll";
	}

	internal class mincore : Object
	{
		internal struct SYSTEM_INFO : ValueType
		{
			internal ushort wProcessorArchitecture;

			internal ushort wReserved;

			internal int dwPageSize;

			internal System.IntPtr lpMinimumApplicationAddress;

			internal System.IntPtr lpMaximumApplicationAddress;

			internal System.IntPtr dwActiveProcessorMask;

			internal int dwNumberOfProcessors;

			internal int dwProcessorType;

			internal int dwAllocationGranularity;

			internal short wProcessorLevel;

			internal short wProcessorRevision;
		}

		internal enum ProcessorArchitecture : Enum
		{
			Processor_Architecture_INTEL = 0,
			Processor_Architecture_ARM = 5,
			Processor_Architecture_IA64 = 6,
			Processor_Architecture_AMD64 = 9,
			Processor_Architecture_ARM64 = 12,
			Processor_Architecture_UNKNOWN = 65535
		}

		[DllImport("api-ms-win-core-sysinfo-l1-2-0.dll")]
		internal static extern void GetNativeSystemInfo(out SYSTEM_INFO lpSystemInfo);

		[DllImport("api-ms-win-core-sysinfo-l1-1-0.dll")]
		internal static extern void GetSystemInfo(out SYSTEM_INFO lpSystemInfo);
	}
}
namespace FxResources.System.Runtime.InteropServices.RuntimeInformation
{
	internal static class SR : Object
	{
	}
}
namespace System
{
	internal static class SR : Object
	{
		private static ResourceManager s_resourceManager;

		private const string s_resourcesName = "FxResources.System.Runtime.InteropServices.RuntimeInformation.SR";

		private static ResourceManager ResourceManager
		{
			get
			{
				//IL_000c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0016: Expected O, but got Unknown
				if (s_resourceManager == null)
				{
					s_resourceManager = new ResourceManager(ResourceType);
				}
				return s_resourceManager;
			}
		}

		internal static string Argument_EmptyValue => GetResourceString("Argument_EmptyValue", null);

		internal static Type ResourceType => typeof(SR);

		[MethodImpl(8)]
		private static bool UsingResourceKeys()
		{
			return false;
		}

		internal static string GetResourceString(string resourceKey, string defaultString)
		{
			string text = null;
			try
			{
				text = ResourceManager.GetString(resourceKey);
			}
			catch (MissingManifestResourceException)
			{
			}
			if (defaultString != null && resourceKey.Equals(text, (StringComparison)4))
			{
				return defaultString;
			}
			return text;
		}

		internal static string Format(string resourceFormat, params object[] args)
		{
			if (args != null)
			{
				if (UsingResourceKeys())
				{
					return String.Concat(resourceFormat, String.Join(", ", args));
				}
				return String.Format(resourceFormat, args);
			}
			return resourceFormat;
		}

		internal static string Format(string resourceFormat, object p1)
		{
			if (UsingResourceKeys())
			{
				return String.Join(", ", (object[])(object)new Object[2]
				{
					(Object)resourceFormat,
					p1
				});
			}
			return String.Format(resourceFormat, (object[])(object)new Object[1] { p1 });
		}

		internal static string Format(string resourceFormat, object p1, object p2)
		{
			if (UsingResourceKeys())
			{
				return String.Join(", ", (object[])(object)new Object[3]
				{
					(Object)resourceFormat,
					p1,
					p2
				});
			}
			return String.Format(resourceFormat, (object[])(object)new Object[2] { p1, p2 });
		}

		internal static string Format(string resourceFormat, object p1, object p2, object p3)
		{
			if (UsingResourceKeys())
			{
				return String.Join(", ", (object[])(object)new Object[4]
				{
					(Object)resourceFormat,
					p1,
					p2,
					p3
				});
			}
			return String.Format(resourceFormat, (object[])(object)new Object[3] { p1, p2, p3 });
		}
	}
}
namespace System.Runtime.InteropServices
{
	public static class RuntimeInformation : Object
	{
		private static string s_osDescription = null;

		private static object s_osLock = (object)new Object();

		private static object s_processLock = (object)new Object();

		private static Nullable<Architecture> s_osArch = default(Nullable<Architecture>);

		private static Nullable<Architecture> s_processArch = default(Nullable<Architecture>);

		private const string FrameworkName = ".NET Framework";

		private static string s_frameworkDescription;

		public static string OSDescription
		{
			get
			{
				if (s_osDescription == null)
				{
					s_osDescription = Interop.NtDll.RtlGetVersion();
				}
				return s_osDescription;
			}
		}

		public static Architecture OSArchitecture
		{
			get
			{
				//IL_005e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0063: Unknown result type (might be due to invalid IL or missing references)
				//IL_006b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0070: Unknown result type (might be due to invalid IL or missing references)
				//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_0051: 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)
				lock (s_osLock)
				{
					if (!s_osArch.HasValue)
					{
						Interop.mincore.GetNativeSystemInfo(out var lpSystemInfo);
						switch ((Interop.mincore.ProcessorArchitecture)lpSystemInfo.wProcessorArchitecture)
						{
						case Interop.mincore.ProcessorArchitecture.Processor_Architecture_ARM64:
							s_osArch = new Nullable<Architecture>(Architecture.Arm64);
							break;
						case Interop.mincore.ProcessorArchitecture.Processor_Architecture_ARM:
							s_osArch = new Nullable<Architecture>(Architecture.Arm);
							break;
						case Interop.mincore.ProcessorArchitecture.Processor_Architecture_AMD64:
							s_osArch = new Nullable<Architecture>(Architecture.X64);
							break;
						case Interop.mincore.ProcessorArchitecture.Processor_Architecture_INTEL:
							s_osArch = new Nullable<Architecture>(Architecture.X86);
							break;
						}
					}
				}
				return s_osArch.Value;
			}
		}

		public static Architecture ProcessArchitecture
		{
			get
			{
				//IL_005e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0063: Unknown result type (might be due to invalid IL or missing references)
				//IL_006b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0070: Unknown result type (might be due to invalid IL or missing references)
				//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_0051: 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)
				lock (s_processLock)
				{
					if (!s_processArch.HasValue)
					{
						Interop.mincore.GetSystemInfo(out var lpSystemInfo);
						switch ((Interop.mincore.ProcessorArchitecture)lpSystemInfo.wProcessorArchitecture)
						{
						case Interop.mincore.ProcessorArchitecture.Processor_Architecture_ARM64:
							s_processArch = new Nullable<Architecture>(Architecture.Arm64);
							break;
						case Interop.mincore.ProcessorArchitecture.Processor_Architecture_ARM:
							s_processArch = new Nullable<Architecture>(Architecture.Arm);
							break;
						case Interop.mincore.ProcessorArchitecture.Processor_Architecture_AMD64:
							s_processArch = new Nullable<Architecture>(Architecture.X64);
							break;
						case Interop.mincore.ProcessorArchitecture.Processor_Architecture_INTEL:
							s_processArch = new Nullable<Architecture>(Architecture.X86);
							break;
						}
					}
				}
				return s_processArch.Value;
			}
		}

		public static string FrameworkDescription
		{
			get
			{
				//IL_002a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0030: Expected O, but got Unknown
				if (s_frameworkDescription == null)
				{
					AssemblyFileVersionAttribute val = (AssemblyFileVersionAttribute)CustomAttributeExtensions.GetCustomAttribute(IntrospectionExtensions.GetTypeInfo(typeof(Object)).Assembly, typeof(AssemblyFileVersionAttribute));
					s_frameworkDescription = String.Format("{0} {1}", (object[])(object)new Object[2]
					{
						(Object)".NET Framework",
						(Object)val.Version
					});
				}
				return s_frameworkDescription;
			}
		}

		public static bool IsOSPlatform(OSPlatform osPlatform)
		{
			return OSPlatform.Windows == osPlatform;
		}
	}
	public enum Architecture : Enum
	{
		X86,
		X64,
		Arm,
		Arm64
	}
	public struct OSPlatform : ValueType, IEquatable<OSPlatform>
	{
		private readonly string _osPlatform;

		[field: CompilerGenerated]
		public static OSPlatform Linux
		{
			[CompilerGenerated]
			get;
		} = new OSPlatform("LINUX");


		[field: CompilerGenerated]
		public static OSPlatform OSX
		{
			[CompilerGenerated]
			get;
		} = new OSPlatform("OSX");


		[field: CompilerGenerated]
		public static OSPlatform Windows
		{
			[CompilerGenerated]
			get;
		} = new OSPlatform("WINDOWS");


		private OSPlatform(string osPlatform)
		{
			//IL_0008: 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)
			if (osPlatform == null)
			{
				throw new ArgumentNullException("osPlatform");
			}
			if (osPlatform.Length == 0)
			{
				throw new ArgumentException(System.SR.Argument_EmptyValue, "osPlatform");
			}
			_osPlatform = osPlatform;
		}

		public static OSPlatform Create(string osPlatform)
		{
			return new OSPlatform(osPlatform);
		}

		public bool Equals(OSPlatform other)
		{
			return Equals(other._osPlatform);
		}

		internal bool Equals(string other)
		{
			return String.Equals(_osPlatform, other, (StringComparison)4);
		}

		public override bool Equals(object obj)
		{
			if (obj is OSPlatform)
			{
				return Equals((OSPlatform)obj);
			}
			return false;
		}

		public override int GetHashCode()
		{
			if (_osPlatform != null)
			{
				return ((Object)_osPlatform).GetHashCode();
			}
			return 0;
		}

		public override string ToString()
		{
			return _osPlatform ?? String.Empty;
		}

		public static bool operator ==(OSPlatform left, OSPlatform right)
		{
			return left.Equals(right);
		}

		public static bool operator !=(OSPlatform left, OSPlatform right)
		{
			return !(left == right);
		}
	}
}

BepInEx/plugins/SlopCrew.Plugin/System.Security.Cryptography.Algorithms.dll

Decompiled 8 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Cryptography;
using System.Security.Permissions;
using FxResources.System.Security.Cryptography.Algorithms;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: AssemblyTitle("System.Security.Cryptography.Algorithms")]
[assembly: AssemblyDescription("System.Security.Cryptography.Algorithms")]
[assembly: AssemblyDefaultAlias("System.Security.Cryptography.Algorithms")]
[assembly: AssemblyCompany("Microsoft Corporation")]
[assembly: AssemblyProduct("Microsoft® .NET Framework")]
[assembly: AssemblyCopyright("© Microsoft Corporation.  All rights reserved.")]
[assembly: AssemblyFileVersion("4.6.25815.03")]
[assembly: AssemblyInformationalVersion("4.6.25815.03. Commit Hash: 0ceb8c26f15bd10adc7ccf15d911d75632fb3f3e")]
[assembly: CLSCompliant(true)]
[assembly: AssemblyMetadata(".NETFrameworkAssembly", "")]
[assembly: AssemblyMetadata("Serviceable", "True")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("4.1.0.0")]
[assembly: TypeForwardedTo(typeof(Aes))]
[assembly: TypeForwardedTo(typeof(DeriveBytes))]
[assembly: TypeForwardedTo(typeof(ECDsa))]
[assembly: TypeForwardedTo(typeof(HMACMD5))]
[assembly: TypeForwardedTo(typeof(HMACSHA1))]
[assembly: TypeForwardedTo(typeof(HMACSHA256))]
[assembly: TypeForwardedTo(typeof(HMACSHA384))]
[assembly: TypeForwardedTo(typeof(HMACSHA512))]
[assembly: TypeForwardedTo(typeof(MD5))]
[assembly: TypeForwardedTo(typeof(RandomNumberGenerator))]
[assembly: TypeForwardedTo(typeof(Rfc2898DeriveBytes))]
[assembly: TypeForwardedTo(typeof(RSA))]
[assembly: TypeForwardedTo(typeof(RSAEncryptionPadding))]
[assembly: TypeForwardedTo(typeof(RSAEncryptionPaddingMode))]
[assembly: TypeForwardedTo(typeof(RSAParameters))]
[assembly: TypeForwardedTo(typeof(RSASignaturePadding))]
[assembly: TypeForwardedTo(typeof(RSASignaturePaddingMode))]
[assembly: TypeForwardedTo(typeof(SHA1))]
[assembly: TypeForwardedTo(typeof(SHA256))]
[assembly: TypeForwardedTo(typeof(SHA384))]
[assembly: TypeForwardedTo(typeof(SHA512))]
[assembly: TypeForwardedTo(typeof(TripleDES))]
[module: UnverifiableCode]
namespace FxResources.System.Security.Cryptography.Algorithms
{
	internal static class SR
	{
	}
}
namespace System
{
	internal static class SR
	{
		private static ResourceManager s_resourceManager;

		private const string s_resourcesName = "FxResources.System.Security.Cryptography.Algorithms.SR";

		private static ResourceManager ResourceManager
		{
			get
			{
				if (s_resourceManager == null)
				{
					s_resourceManager = new ResourceManager(ResourceType);
				}
				return s_resourceManager;
			}
		}

		internal static string ArgumentOutOfRange_NeedNonNegNum => GetResourceString("ArgumentOutOfRange_NeedNonNegNum", null);

		internal static string ArgumentOutOfRange_NeedPosNum => GetResourceString("ArgumentOutOfRange_NeedPosNum", null);

		internal static string Argument_InvalidOffLen => GetResourceString("Argument_InvalidOffLen", null);

		internal static string Argument_InvalidOidValue => GetResourceString("Argument_InvalidOidValue", null);

		internal static string Argument_InvalidValue => GetResourceString("Argument_InvalidValue", null);

		internal static string ArgumentNull_Buffer => GetResourceString("ArgumentNull_Buffer", null);

		internal static string Arg_CryptographyException => GetResourceString("Arg_CryptographyException", null);

		internal static string Cryptography_CSP_NoPrivateKey => GetResourceString("Cryptography_CSP_NoPrivateKey", null);

		internal static string Cryptography_HashAlgorithmNameNullOrEmpty => GetResourceString("Cryptography_HashAlgorithmNameNullOrEmpty", null);

		internal static string Cryptography_CurveNotSupported => GetResourceString("Cryptography_CurveNotSupported", null);

		internal static string Cryptography_Der_Invalid_Encoding => GetResourceString("Cryptography_Der_Invalid_Encoding", null);

		internal static string Cryptography_InvalidCurveOid => GetResourceString("Cryptography_InvalidCurveOid", null);

		internal static string Cryptography_InvalidCurveKeyParameters => GetResourceString("Cryptography_InvalidCurveKeyParameters", null);

		internal static string Cryptography_InvalidECCharacteristic2Curve => GetResourceString("Cryptography_InvalidECCharacteristic2Curve", null);

		internal static string Cryptography_InvalidECPrimeCurve => GetResourceString("Cryptography_InvalidECPrimeCurve", null);

		internal static string Cryptography_InvalidECNamedCurve => GetResourceString("Cryptography_InvalidECNamedCurve", null);

		internal static string Cryptography_InvalidKeySize => GetResourceString("Cryptography_InvalidKeySize", null);

		internal static string Cryptography_InvalidKey_SemiWeak => GetResourceString("Cryptography_InvalidKey_SemiWeak", null);

		internal static string Cryptography_InvalidKey_Weak => GetResourceString("Cryptography_InvalidKey_Weak", null);

		internal static string Cryptography_InvalidIVSize => GetResourceString("Cryptography_InvalidIVSize", null);

		internal static string Cryptography_InvalidPadding => GetResourceString("Cryptography_InvalidPadding", null);

		internal static string Cryptography_InvalidRsaParameters => GetResourceString("Cryptography_InvalidRsaParameters", null);

		internal static string Cryptography_InvalidPaddingMode => GetResourceString("Cryptography_InvalidPaddingMode", null);

		internal static string Cryptography_Invalid_IA5String => GetResourceString("Cryptography_Invalid_IA5String", null);

		internal static string Cryptography_MissingIV => GetResourceString("Cryptography_MissingIV", null);

		internal static string Cryptography_MustTransformWholeBlock => GetResourceString("Cryptography_MustTransformWholeBlock", null);

		internal static string Cryptography_NotValidPrivateKey => GetResourceString("Cryptography_NotValidPrivateKey", null);

		internal static string Cryptography_NotValidPublicOrPrivateKey => GetResourceString("Cryptography_NotValidPublicOrPrivateKey", null);

		internal static string Cryptography_OpenInvalidHandle => GetResourceString("Cryptography_OpenInvalidHandle", null);

		internal static string Cryptography_PartialBlock => GetResourceString("Cryptography_PartialBlock", null);

		internal static string Cryptography_PasswordDerivedBytes_FewBytesSalt => GetResourceString("Cryptography_PasswordDerivedBytes_FewBytesSalt", null);

		internal static string Cryptography_PasswordDerivedBytes_InvalidAlgorithm => GetResourceString("Cryptography_PasswordDerivedBytes_InvalidAlgorithm", null);

		internal static string Cryptography_PasswordDerivedBytes_InvalidIV => GetResourceString("Cryptography_PasswordDerivedBytes_InvalidIV", null);

		internal static string Cryptography_RC2_EKS40 => GetResourceString("Cryptography_RC2_EKS40", null);

		internal static string Cryptography_RC2_EKSKS => GetResourceString("Cryptography_RC2_EKSKS", null);

		internal static string Cryptography_TransformBeyondEndOfBuffer => GetResourceString("Cryptography_TransformBeyondEndOfBuffer", null);

		internal static string Cryptography_CipherModeNotSupported => GetResourceString("Cryptography_CipherModeNotSupported", null);

		internal static string Cryptography_UnknownHashAlgorithm => GetResourceString("Cryptography_UnknownHashAlgorithm", null);

		internal static string Cryptography_UnknownPaddingMode => GetResourceString("Cryptography_UnknownPaddingMode", null);

		internal static string Cryptography_UnexpectedTransformTruncation => GetResourceString("Cryptography_UnexpectedTransformTruncation", null);

		internal static string Cryptography_Unmapped_System_Typed_Error => GetResourceString("Cryptography_Unmapped_System_Typed_Error", null);

		internal static string Cryptography_UnsupportedPaddingMode => GetResourceString("Cryptography_UnsupportedPaddingMode", null);

		internal static string NotSupported_SubclassOverride => GetResourceString("NotSupported_SubclassOverride", null);

		internal static Type ResourceType => typeof(FxResources.System.Security.Cryptography.Algorithms.SR);

		[MethodImpl(MethodImplOptions.NoInlining)]
		private static bool UsingResourceKeys()
		{
			return false;
		}

		internal static string GetResourceString(string resourceKey, string defaultString)
		{
			string text = null;
			try
			{
				text = ResourceManager.GetString(resourceKey);
			}
			catch (MissingManifestResourceException)
			{
			}
			if (defaultString != null && resourceKey.Equals(text, StringComparison.Ordinal))
			{
				return defaultString;
			}
			return text;
		}

		internal static string Format(string resourceFormat, params object[] args)
		{
			if (args != null)
			{
				if (UsingResourceKeys())
				{
					return resourceFormat + string.Join(", ", args);
				}
				return string.Format(resourceFormat, args);
			}
			return resourceFormat;
		}

		internal static string Format(string resourceFormat, object p1)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1);
			}
			return string.Format(resourceFormat, p1);
		}

		internal static string Format(string resourceFormat, object p1, object p2)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2);
			}
			return string.Format(resourceFormat, p1, p2);
		}

		internal static string Format(string resourceFormat, object p1, object p2, object p3)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2, p3);
			}
			return string.Format(resourceFormat, p1, p2, p3);
		}
	}
}
namespace System.Security.Cryptography
{
	public sealed class IncrementalHash : IDisposable
	{
		private const int NTE_BAD_ALGID = -2146893816;

		private static readonly byte[] s_empty = new byte[0];

		private readonly HashAlgorithmName _algorithmName;

		private HashAlgorithm _hash;

		private bool _disposed;

		private bool _resetPending;

		public HashAlgorithmName AlgorithmName => _algorithmName;

		private IncrementalHash(HashAlgorithmName name, HashAlgorithm hash)
		{
			_algorithmName = name;
			_hash = hash;
		}

		public void AppendData(byte[] data)
		{
			if (data == null)
			{
				throw new ArgumentNullException("data");
			}
			AppendData(data, 0, data.Length);
		}

		public void AppendData(byte[] data, int offset, int count)
		{
			if (data == null)
			{
				throw new ArgumentNullException("data");
			}
			if (offset < 0)
			{
				throw new ArgumentOutOfRangeException("offset", System.SR.ArgumentOutOfRange_NeedNonNegNum);
			}
			if (count < 0 || count > data.Length)
			{
				throw new ArgumentOutOfRangeException("count");
			}
			if (data.Length - count < offset)
			{
				throw new ArgumentException(System.SR.Argument_InvalidOffLen);
			}
			if (_disposed)
			{
				throw new ObjectDisposedException(typeof(IncrementalHash).Name);
			}
			if (_resetPending)
			{
				_hash.Initialize();
				_resetPending = false;
			}
			_hash.TransformBlock(data, offset, count, null, 0);
		}

		public byte[] GetHashAndReset()
		{
			if (_disposed)
			{
				throw new ObjectDisposedException(typeof(IncrementalHash).Name);
			}
			if (_resetPending)
			{
				_hash.Initialize();
			}
			_hash.TransformFinalBlock(s_empty, 0, 0);
			byte[] hash = _hash.Hash;
			_resetPending = true;
			return hash;
		}

		public void Dispose()
		{
			_disposed = true;
			if (_hash != null)
			{
				_hash.Dispose();
				_hash = null;
			}
		}

		public static IncrementalHash CreateHash(HashAlgorithmName hashAlgorithm)
		{
			if (string.IsNullOrEmpty(hashAlgorithm.Name))
			{
				throw new ArgumentException(System.SR.Cryptography_HashAlgorithmNameNullOrEmpty, "hashAlgorithm");
			}
			return new IncrementalHash(hashAlgorithm, GetHashAlgorithm(hashAlgorithm));
		}

		public static IncrementalHash CreateHMAC(HashAlgorithmName hashAlgorithm, byte[] key)
		{
			if (key == null)
			{
				throw new ArgumentNullException("key");
			}
			if (string.IsNullOrEmpty(hashAlgorithm.Name))
			{
				throw new ArgumentException(System.SR.Cryptography_HashAlgorithmNameNullOrEmpty, "hashAlgorithm");
			}
			return new IncrementalHash(hashAlgorithm, GetHMAC(hashAlgorithm, key));
		}

		private static HashAlgorithm GetHashAlgorithm(HashAlgorithmName hashAlgorithm)
		{
			if (hashAlgorithm == HashAlgorithmName.MD5)
			{
				return new MD5CryptoServiceProvider();
			}
			if (hashAlgorithm == HashAlgorithmName.SHA1)
			{
				return new SHA1CryptoServiceProvider();
			}
			if (hashAlgorithm == HashAlgorithmName.SHA256)
			{
				return new SHA256CryptoServiceProvider();
			}
			if (hashAlgorithm == HashAlgorithmName.SHA384)
			{
				return new SHA384CryptoServiceProvider();
			}
			if (hashAlgorithm == HashAlgorithmName.SHA512)
			{
				return new SHA512CryptoServiceProvider();
			}
			throw new CryptographicException(-2146893816);
		}

		private static HashAlgorithm GetHMAC(HashAlgorithmName hashAlgorithm, byte[] key)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Expected O, but got Unknown
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Expected O, but got Unknown
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Expected O, but got Unknown
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Expected O, but got Unknown
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Expected O, but got Unknown
			if (hashAlgorithm == HashAlgorithmName.MD5)
			{
				return (HashAlgorithm)new HMACMD5(key);
			}
			if (hashAlgorithm == HashAlgorithmName.SHA1)
			{
				return (HashAlgorithm)new HMACSHA1(key);
			}
			if (hashAlgorithm == HashAlgorithmName.SHA256)
			{
				return (HashAlgorithm)new HMACSHA256(key);
			}
			if (hashAlgorithm == HashAlgorithmName.SHA384)
			{
				return (HashAlgorithm)new HMACSHA384(key);
			}
			if (hashAlgorithm == HashAlgorithmName.SHA512)
			{
				return (HashAlgorithm)new HMACSHA512(key);
			}
			throw new CryptographicException(-2146893816);
		}
	}
}

BepInEx/plugins/SlopCrew.Plugin/System.Security.Cryptography.Primitives.dll

Decompiled 8 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security.Cryptography;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("System.Security.Cryptography.Primitives")]
[assembly: AssemblyDescription("System.Security.Cryptography.Primitives")]
[assembly: AssemblyDefaultAlias("System.Security.Cryptography.Primitives")]
[assembly: AssemblyCompany("Microsoft Corporation")]
[assembly: AssemblyProduct("Microsoft® .NET Framework")]
[assembly: AssemblyCopyright("© Microsoft Corporation.  All rights reserved.")]
[assembly: AssemblyFileVersion("4.6.24705.01")]
[assembly: AssemblyInformationalVersion("4.6.24705.01. Commit Hash: 4d1af962ca0fede10beb01d197367c2f90e92c97")]
[assembly: CLSCompliant(true)]
[assembly: AssemblyMetadata(".NETFrameworkAssembly", "")]
[assembly: AssemblyMetadata("Serviceable", "True")]
[assembly: AssemblyVersion("4.0.1.0")]
[assembly: TypeForwardedTo(typeof(AsymmetricAlgorithm))]
[assembly: TypeForwardedTo(typeof(CipherMode))]
[assembly: TypeForwardedTo(typeof(CryptographicException))]
[assembly: TypeForwardedTo(typeof(CryptoStream))]
[assembly: TypeForwardedTo(typeof(CryptoStreamMode))]
[assembly: TypeForwardedTo(typeof(HashAlgorithm))]
[assembly: TypeForwardedTo(typeof(HashAlgorithmName))]
[assembly: TypeForwardedTo(typeof(HMAC))]
[assembly: TypeForwardedTo(typeof(ICryptoTransform))]
[assembly: TypeForwardedTo(typeof(KeyedHashAlgorithm))]
[assembly: TypeForwardedTo(typeof(KeySizes))]
[assembly: TypeForwardedTo(typeof(PaddingMode))]
[assembly: TypeForwardedTo(typeof(SymmetricAlgorithm))]

BepInEx/plugins/SlopCrew.Plugin/System.Text.Encodings.Web.dll

Decompiled 8 months ago
using System;
using System.Buffers;
using System.Buffers.Binary;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Numerics;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text.Encodings.Web;
using System.Text.Unicode;
using System.Threading;
using FxResources.System.Text.Encodings.Web;
using Microsoft.CodeAnalysis;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: AssemblyMetadata(".NETFrameworkAssembly", "")]
[assembly: AssemblyMetadata("Serviceable", "True")]
[assembly: AssemblyMetadata("PreferInbox", "True")]
[assembly: AssemblyDefaultAlias("System.Text.Encodings.Web")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: CLSCompliant(true)]
[assembly: AssemblyMetadata("IsTrimmable", "True")]
[assembly: DefaultDllImportSearchPaths(DllImportSearchPath.System32 | DllImportSearchPath.AssemblyDirectory)]
[assembly: AssemblyCompany("Microsoft Corporation")]
[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")]
[assembly: AssemblyDescription("Provides types for encoding and escaping strings for use in JavaScript, HyperText Markup Language (HTML), and uniform resource locators (URL).\r\n\r\nCommonly Used Types:\r\nSystem.Text.Encodings.Web.HtmlEncoder\r\nSystem.Text.Encodings.Web.UrlEncoder\r\nSystem.Text.Encodings.Web.JavaScriptEncoder")]
[assembly: AssemblyFileVersion("7.0.22.51805")]
[assembly: AssemblyInformationalVersion("7.0.0+d099f075e45d2aa6007a22b71b45a08758559f80")]
[assembly: AssemblyProduct("Microsoft® .NET")]
[assembly: AssemblyTitle("System.Text.Encodings.Web")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/dotnet/runtime")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("7.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: System.Runtime.CompilerServices.NullablePublicOnly(false)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class IsReadOnlyAttribute : Attribute
	{
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class IsByRefLikeAttribute : Attribute
	{
	}
	[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 NullablePublicOnlyAttribute : Attribute
	{
		public readonly bool IncludesInternals;

		public NullablePublicOnlyAttribute(bool P_0)
		{
			IncludesInternals = P_0;
		}
	}
	[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 NativeIntegerAttribute : Attribute
	{
		public readonly bool[] TransformFlags;

		public NativeIntegerAttribute()
		{
			TransformFlags = new bool[1] { true };
		}

		public NativeIntegerAttribute(bool[] P_0)
		{
			TransformFlags = 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 FxResources.System.Text.Encodings.Web
{
	internal static class SR
	{
	}
}
namespace System
{
	internal static class HexConverter
	{
		public enum Casing : uint
		{
			Upper = 0u,
			Lower = 8224u
		}

		public static ReadOnlySpan<byte> CharToHexLookup => new byte[256]
		{
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 0, 1,
			2, 3, 4, 5, 6, 7, 8, 9, 255, 255,
			255, 255, 255, 255, 255, 10, 11, 12, 13, 14,
			15, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 10, 11, 12,
			13, 14, 15, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255
		};

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static void ToBytesBuffer(byte value, Span<byte> buffer, int startingIndex = 0, Casing casing = Casing.Upper)
		{
			uint num = (uint)(((value & 0xF0) << 4) + (value & 0xF) - 35209);
			uint num2 = ((((0 - num) & 0x7070) >> 4) + num + 47545) | (uint)casing;
			buffer[startingIndex + 1] = (byte)num2;
			buffer[startingIndex] = (byte)(num2 >> 8);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static void ToCharsBuffer(byte value, Span<char> buffer, int startingIndex = 0, Casing casing = Casing.Upper)
		{
			uint num = (uint)(((value & 0xF0) << 4) + (value & 0xF) - 35209);
			uint num2 = ((((0 - num) & 0x7070) >> 4) + num + 47545) | (uint)casing;
			buffer[startingIndex + 1] = (char)(num2 & 0xFFu);
			buffer[startingIndex] = (char)(num2 >> 8);
		}

		public static void EncodeToUtf16(ReadOnlySpan<byte> bytes, Span<char> chars, Casing casing = Casing.Upper)
		{
			for (int i = 0; i < bytes.Length; i++)
			{
				ToCharsBuffer(bytes[i], chars, i * 2, casing);
			}
		}

		public static string ToString(ReadOnlySpan<byte> bytes, Casing casing = Casing.Upper)
		{
			Span<char> span = ((bytes.Length <= 16) ? stackalloc char[bytes.Length * 2] : new char[bytes.Length * 2].AsSpan());
			Span<char> buffer = span;
			int num = 0;
			ReadOnlySpan<byte> readOnlySpan = bytes;
			for (int i = 0; i < readOnlySpan.Length; i++)
			{
				byte value = readOnlySpan[i];
				ToCharsBuffer(value, buffer, num, casing);
				num += 2;
			}
			return buffer.ToString();
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static char ToCharUpper(int value)
		{
			value &= 0xF;
			value += 48;
			if (value > 57)
			{
				value += 7;
			}
			return (char)value;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static char ToCharLower(int value)
		{
			value &= 0xF;
			value += 48;
			if (value > 57)
			{
				value += 39;
			}
			return (char)value;
		}

		public static bool TryDecodeFromUtf16(ReadOnlySpan<char> chars, Span<byte> bytes)
		{
			int charsProcessed;
			return TryDecodeFromUtf16(chars, bytes, out charsProcessed);
		}

		public static bool TryDecodeFromUtf16(ReadOnlySpan<char> chars, Span<byte> bytes, out int charsProcessed)
		{
			int num = 0;
			int num2 = 0;
			int num3 = 0;
			int num4 = 0;
			while (num2 < bytes.Length)
			{
				num3 = FromChar(chars[num + 1]);
				num4 = FromChar(chars[num]);
				if ((num3 | num4) == 255)
				{
					break;
				}
				bytes[num2++] = (byte)((num4 << 4) | num3);
				num += 2;
			}
			if (num3 == 255)
			{
				num++;
			}
			charsProcessed = num;
			return (num3 | num4) != 255;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static int FromChar(int c)
		{
			if (c < CharToHexLookup.Length)
			{
				return CharToHexLookup[c];
			}
			return 255;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static int FromUpperChar(int c)
		{
			if (c <= 71)
			{
				return CharToHexLookup[c];
			}
			return 255;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static int FromLowerChar(int c)
		{
			switch (c)
			{
			case 48:
			case 49:
			case 50:
			case 51:
			case 52:
			case 53:
			case 54:
			case 55:
			case 56:
			case 57:
				return c - 48;
			case 97:
			case 98:
			case 99:
			case 100:
			case 101:
			case 102:
				return c - 97 + 10;
			default:
				return 255;
			}
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static bool IsHexChar(int c)
		{
			if (IntPtr.Size == 8)
			{
				ulong num = (uint)(c - 48);
				ulong num2 = (ulong)(-17875860044349952L << (int)num);
				ulong num3 = num - 64;
				if ((long)(num2 & num3) >= 0L)
				{
					return false;
				}
				return true;
			}
			return FromChar(c) != 255;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static bool IsHexUpperChar(int c)
		{
			if ((uint)(c - 48) > 9u)
			{
				return (uint)(c - 65) <= 5u;
			}
			return true;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static bool IsHexLowerChar(int c)
		{
			if ((uint)(c - 48) > 9u)
			{
				return (uint)(c - 97) <= 5u;
			}
			return true;
		}
	}
	internal static class SR
	{
		private static readonly bool s_usingResourceKeys = AppContext.TryGetSwitch("System.Resources.UseSystemResourceKeys", out var isEnabled) && isEnabled;

		private static ResourceManager s_resourceManager;

		internal static ResourceManager ResourceManager => s_resourceManager ?? (s_resourceManager = new ResourceManager(typeof(SR)));

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

		private static bool UsingResourceKeys()
		{
			return s_usingResourceKeys;
		}

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

		internal static string GetResourceString(string resourceKey, string defaultString)
		{
			string resourceString = GetResourceString(resourceKey);
			if (!(resourceKey == resourceString) && resourceString != null)
			{
				return resourceString;
			}
			return defaultString;
		}

		internal static string Format(string resourceFormat, object p1)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1);
			}
			return string.Format(resourceFormat, p1);
		}

		internal static string Format(string resourceFormat, object p1, object p2)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2);
			}
			return string.Format(resourceFormat, p1, p2);
		}

		internal static string Format(string resourceFormat, object p1, object p2, object p3)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2, p3);
			}
			return string.Format(resourceFormat, p1, p2, p3);
		}

		internal static string Format(string resourceFormat, params object[] args)
		{
			if (args != null)
			{
				if (UsingResourceKeys())
				{
					return resourceFormat + ", " + string.Join(", ", args);
				}
				return string.Format(resourceFormat, args);
			}
			return resourceFormat;
		}

		internal static string Format(IFormatProvider provider, string resourceFormat, object p1)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1);
			}
			return string.Format(provider, resourceFormat, p1);
		}

		internal static string Format(IFormatProvider provider, string resourceFormat, object p1, object p2)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2);
			}
			return string.Format(provider, resourceFormat, p1, p2);
		}

		internal static string Format(IFormatProvider provider, string resourceFormat, object p1, object p2, object p3)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2, p3);
			}
			return string.Format(provider, resourceFormat, p1, p2, p3);
		}

		internal static string Format(IFormatProvider provider, string resourceFormat, params object[] args)
		{
			if (args != null)
			{
				if (UsingResourceKeys())
				{
					return resourceFormat + ", " + string.Join(", ", args);
				}
				return string.Format(provider, resourceFormat, args);
			}
			return resourceFormat;
		}
	}
}
namespace System.Diagnostics.CodeAnalysis
{
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)]
	internal sealed class AllowNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)]
	internal sealed class DisallowNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)]
	internal sealed class MaybeNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)]
	internal sealed class NotNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class MaybeNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public MaybeNullWhenAttribute(bool returnValue)
		{
			ReturnValue = returnValue;
		}
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class NotNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public NotNullWhenAttribute(bool returnValue)
		{
			ReturnValue = returnValue;
		}
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = true, Inherited = false)]
	internal sealed class NotNullIfNotNullAttribute : Attribute
	{
		public string ParameterName { get; }

		public NotNullIfNotNullAttribute(string parameterName)
		{
			ParameterName = parameterName;
		}
	}
	[AttributeUsage(AttributeTargets.Method, Inherited = false)]
	internal sealed class DoesNotReturnAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class DoesNotReturnIfAttribute : Attribute
	{
		public bool ParameterValue { get; }

		public DoesNotReturnIfAttribute(bool parameterValue)
		{
			ParameterValue = parameterValue;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	internal sealed class MemberNotNullAttribute : Attribute
	{
		public string[] Members { get; }

		public MemberNotNullAttribute(string member)
		{
			Members = new string[1] { member };
		}

		public MemberNotNullAttribute(params string[] members)
		{
			Members = members;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	internal sealed class MemberNotNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public string[] Members { get; }

		public MemberNotNullWhenAttribute(bool returnValue, string member)
		{
			ReturnValue = returnValue;
			Members = new string[1] { member };
		}

		public MemberNotNullWhenAttribute(bool returnValue, params string[] members)
		{
			ReturnValue = returnValue;
			Members = members;
		}
	}
}
namespace System.Runtime.InteropServices
{
	[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
	internal sealed class LibraryImportAttribute : Attribute
	{
		public string LibraryName { get; }

		public string EntryPoint { get; set; }

		public StringMarshalling StringMarshalling { get; set; }

		public Type StringMarshallingCustomType { get; set; }

		public bool SetLastError { get; set; }

		public LibraryImportAttribute(string libraryName)
		{
			LibraryName = libraryName;
		}
	}
	internal enum StringMarshalling
	{
		Custom,
		Utf8,
		Utf16
	}
}
namespace System.Numerics
{
	internal static class BitOperations
	{
		private static ReadOnlySpan<byte> Log2DeBruijn => new byte[32]
		{
			0, 9, 1, 10, 13, 21, 2, 29, 11, 14,
			16, 18, 22, 25, 3, 30, 8, 12, 20, 28,
			15, 17, 24, 7, 19, 27, 23, 6, 26, 5,
			4, 31
		};

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static int Log2(uint value)
		{
			return Log2SoftwareFallback(value | 1u);
		}

		private static int Log2SoftwareFallback(uint value)
		{
			value |= value >> 1;
			value |= value >> 2;
			value |= value >> 4;
			value |= value >> 8;
			value |= value >> 16;
			return System.Runtime.CompilerServices.Unsafe.AddByteOffset<byte>(ref MemoryMarshal.GetReference(Log2DeBruijn), (IntPtr)(nint)(value * 130329821 >> 27));
		}
	}
}
namespace System.Text
{
	internal static class UnicodeDebug
	{
		[Conditional("DEBUG")]
		internal static void AssertIsBmpCodePoint(uint codePoint)
		{
			System.Text.UnicodeUtility.IsBmpCodePoint(codePoint);
		}

		[Conditional("DEBUG")]
		internal static void AssertIsHighSurrogateCodePoint(uint codePoint)
		{
			System.Text.UnicodeUtility.IsHighSurrogateCodePoint(codePoint);
		}

		[Conditional("DEBUG")]
		internal static void AssertIsLowSurrogateCodePoint(uint codePoint)
		{
			System.Text.UnicodeUtility.IsLowSurrogateCodePoint(codePoint);
		}

		[Conditional("DEBUG")]
		internal static void AssertIsValidCodePoint(uint codePoint)
		{
			System.Text.UnicodeUtility.IsValidCodePoint(codePoint);
		}

		[Conditional("DEBUG")]
		internal static void AssertIsValidScalar(uint scalarValue)
		{
			System.Text.UnicodeUtility.IsValidUnicodeScalar(scalarValue);
		}

		[Conditional("DEBUG")]
		internal static void AssertIsValidSupplementaryPlaneScalar(uint scalarValue)
		{
			if (System.Text.UnicodeUtility.IsValidUnicodeScalar(scalarValue))
			{
				System.Text.UnicodeUtility.IsBmpCodePoint(scalarValue);
			}
		}

		private static string ToHexString(uint codePoint)
		{
			return FormattableString.Invariant($"U+{codePoint:X4}");
		}
	}
	internal static class UnicodeUtility
	{
		public const uint ReplacementChar = 65533u;

		public static int GetPlane(uint codePoint)
		{
			return (int)(codePoint >> 16);
		}

		public static uint GetScalarFromUtf16SurrogatePair(uint highSurrogateCodePoint, uint lowSurrogateCodePoint)
		{
			return (highSurrogateCodePoint << 10) + lowSurrogateCodePoint - 56613888;
		}

		public static int GetUtf16SequenceLength(uint value)
		{
			value -= 65536;
			value += 33554432;
			value >>= 24;
			return (int)value;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static void GetUtf16SurrogatesFromSupplementaryPlaneScalar(uint value, out char highSurrogateCodePoint, out char lowSurrogateCodePoint)
		{
			highSurrogateCodePoint = (char)(value + 56557568 >> 10);
			lowSurrogateCodePoint = (char)((value & 0x3FF) + 56320);
		}

		public static int GetUtf8SequenceLength(uint value)
		{
			int num = (int)(value - 2048) >> 31;
			value ^= 0xF800u;
			value -= 63616;
			value += 67108864;
			value >>= 24;
			return (int)value + num * 2;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static bool IsAsciiCodePoint(uint value)
		{
			return value <= 127;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static bool IsBmpCodePoint(uint value)
		{
			return value <= 65535;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static bool IsHighSurrogateCodePoint(uint value)
		{
			return IsInRangeInclusive(value, 55296u, 56319u);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static bool IsInRangeInclusive(uint value, uint lowerBound, uint upperBound)
		{
			return value - lowerBound <= upperBound - lowerBound;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static bool IsLowSurrogateCodePoint(uint value)
		{
			return IsInRangeInclusive(value, 56320u, 57343u);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static bool IsSurrogateCodePoint(uint value)
		{
			return IsInRangeInclusive(value, 55296u, 57343u);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static bool IsValidCodePoint(uint codePoint)
		{
			return codePoint <= 1114111;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static bool IsValidUnicodeScalar(uint value)
		{
			return ((value - 1114112) ^ 0xD800) >= 4293855232u;
		}
	}
	internal ref struct ValueStringBuilder
	{
		private char[] _arrayToReturnToPool;

		private Span<char> _chars;

		private int _pos;

		public int Length
		{
			get
			{
				return _pos;
			}
			set
			{
				_pos = value;
			}
		}

		public int Capacity => _chars.Length;

		public ref char this[int index] => ref _chars[index];

		public Span<char> RawChars => _chars;

		public ValueStringBuilder(Span<char> initialBuffer)
		{
			_arrayToReturnToPool = null;
			_chars = initialBuffer;
			_pos = 0;
		}

		public ValueStringBuilder(int initialCapacity)
		{
			_arrayToReturnToPool = ArrayPool<char>.Shared.Rent(initialCapacity);
			_chars = _arrayToReturnToPool;
			_pos = 0;
		}

		public void EnsureCapacity(int capacity)
		{
			if ((uint)capacity > (uint)_chars.Length)
			{
				Grow(capacity - _pos);
			}
		}

		public ref char GetPinnableReference()
		{
			return ref MemoryMarshal.GetReference(_chars);
		}

		public ref char GetPinnableReference(bool terminate)
		{
			if (terminate)
			{
				EnsureCapacity(Length + 1);
				_chars[Length] = '\0';
			}
			return ref MemoryMarshal.GetReference(_chars);
		}

		public override string ToString()
		{
			string result = _chars.Slice(0, _pos).ToString();
			Dispose();
			return result;
		}

		public ReadOnlySpan<char> AsSpan(bool terminate)
		{
			if (terminate)
			{
				EnsureCapacity(Length + 1);
				_chars[Length] = '\0';
			}
			return _chars.Slice(0, _pos);
		}

		public ReadOnlySpan<char> AsSpan()
		{
			return _chars.Slice(0, _pos);
		}

		public ReadOnlySpan<char> AsSpan(int start)
		{
			return _chars.Slice(start, _pos - start);
		}

		public ReadOnlySpan<char> AsSpan(int start, int length)
		{
			return _chars.Slice(start, length);
		}

		public bool TryCopyTo(Span<char> destination, out int charsWritten)
		{
			if (_chars.Slice(0, _pos).TryCopyTo(destination))
			{
				charsWritten = _pos;
				Dispose();
				return true;
			}
			charsWritten = 0;
			Dispose();
			return false;
		}

		public void Insert(int index, char value, int count)
		{
			if (_pos > _chars.Length - count)
			{
				Grow(count);
			}
			int length = _pos - index;
			_chars.Slice(index, length).CopyTo(_chars.Slice(index + count));
			_chars.Slice(index, count).Fill(value);
			_pos += count;
		}

		public void Insert(int index, string s)
		{
			if (s != null)
			{
				int length = s.Length;
				if (_pos > _chars.Length - length)
				{
					Grow(length);
				}
				int length2 = _pos - index;
				_chars.Slice(index, length2).CopyTo(_chars.Slice(index + length));
				s.AsSpan().CopyTo(_chars.Slice(index));
				_pos += length;
			}
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public void Append(char c)
		{
			int pos = _pos;
			if ((uint)pos < (uint)_chars.Length)
			{
				_chars[pos] = c;
				_pos = pos + 1;
			}
			else
			{
				GrowAndAppend(c);
			}
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public void Append(string s)
		{
			if (s != null)
			{
				int pos = _pos;
				if (s.Length == 1 && (uint)pos < (uint)_chars.Length)
				{
					_chars[pos] = s[0];
					_pos = pos + 1;
				}
				else
				{
					AppendSlow(s);
				}
			}
		}

		private void AppendSlow(string s)
		{
			int pos = _pos;
			if (pos > _chars.Length - s.Length)
			{
				Grow(s.Length);
			}
			s.AsSpan().CopyTo(_chars.Slice(pos));
			_pos += s.Length;
		}

		public void Append(char c, int count)
		{
			if (_pos > _chars.Length - count)
			{
				Grow(count);
			}
			Span<char> span = _chars.Slice(_pos, count);
			for (int i = 0; i < span.Length; i++)
			{
				span[i] = c;
			}
			_pos += count;
		}

		public unsafe void Append(char* value, int length)
		{
			int pos = _pos;
			if (pos > _chars.Length - length)
			{
				Grow(length);
			}
			Span<char> span = _chars.Slice(_pos, length);
			for (int i = 0; i < span.Length; i++)
			{
				span[i] = *(value++);
			}
			_pos += length;
		}

		public void Append(ReadOnlySpan<char> value)
		{
			int pos = _pos;
			if (pos > _chars.Length - value.Length)
			{
				Grow(value.Length);
			}
			value.CopyTo(_chars.Slice(_pos));
			_pos += value.Length;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public Span<char> AppendSpan(int length)
		{
			int pos = _pos;
			if (pos > _chars.Length - length)
			{
				Grow(length);
			}
			_pos = pos + length;
			return _chars.Slice(pos, length);
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		private void GrowAndAppend(char c)
		{
			Grow(1);
			Append(c);
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		private void Grow(int additionalCapacityBeyondPos)
		{
			int minimumLength = (int)Math.Max((uint)(_pos + additionalCapacityBeyondPos), Math.Min((uint)(_chars.Length * 2), 2147483591u));
			char[] array = ArrayPool<char>.Shared.Rent(minimumLength);
			_chars.Slice(0, _pos).CopyTo(array);
			char[] arrayToReturnToPool = _arrayToReturnToPool;
			_chars = (_arrayToReturnToPool = array);
			if (arrayToReturnToPool != null)
			{
				ArrayPool<char>.Shared.Return(arrayToReturnToPool);
			}
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public void Dispose()
		{
			char[] arrayToReturnToPool = _arrayToReturnToPool;
			this = default(System.Text.ValueStringBuilder);
			if (arrayToReturnToPool != null)
			{
				ArrayPool<char>.Shared.Return(arrayToReturnToPool);
			}
		}
	}
	internal readonly struct Rune : IEquatable<Rune>
	{
		private const int MaxUtf16CharsPerRune = 2;

		private const char HighSurrogateStart = '\ud800';

		private const char LowSurrogateStart = '\udc00';

		private const int HighSurrogateRange = 1023;

		private readonly uint _value;

		public bool IsAscii => System.Text.UnicodeUtility.IsAsciiCodePoint(_value);

		public bool IsBmp => System.Text.UnicodeUtility.IsBmpCodePoint(_value);

		public static Rune ReplacementChar => UnsafeCreate(65533u);

		public int Utf16SequenceLength => System.Text.UnicodeUtility.GetUtf16SequenceLength(_value);

		public int Value => (int)_value;

		public Rune(uint value)
		{
			if (!System.Text.UnicodeUtility.IsValidUnicodeScalar(value))
			{
				ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.value);
			}
			_value = value;
		}

		public Rune(int value)
			: this((uint)value)
		{
		}

		private Rune(uint scalarValue, bool unused)
		{
			_value = scalarValue;
		}

		public static bool operator ==(Rune left, Rune right)
		{
			return left._value == right._value;
		}

		public static bool operator !=(Rune left, Rune right)
		{
			return left._value != right._value;
		}

		public static bool IsControl(Rune value)
		{
			return ((value._value + 1) & 0xFFFFFF7Fu) <= 32;
		}

		public static OperationStatus DecodeFromUtf16(ReadOnlySpan<char> source, out Rune result, out int charsConsumed)
		{
			if (!source.IsEmpty)
			{
				char c = source[0];
				if (TryCreate(c, out result))
				{
					charsConsumed = 1;
					return OperationStatus.Done;
				}
				if (1u < (uint)source.Length)
				{
					char lowSurrogate = source[1];
					if (TryCreate(c, lowSurrogate, out result))
					{
						charsConsumed = 2;
						return OperationStatus.Done;
					}
				}
				else if (char.IsHighSurrogate(c))
				{
					goto IL_004c;
				}
				charsConsumed = 1;
				result = ReplacementChar;
				return OperationStatus.InvalidData;
			}
			goto IL_004c;
			IL_004c:
			charsConsumed = source.Length;
			result = ReplacementChar;
			return OperationStatus.NeedMoreData;
		}

		public static OperationStatus DecodeFromUtf8(ReadOnlySpan<byte> source, out Rune result, out int bytesConsumed)
		{
			int num = 0;
			uint num2;
			if ((uint)num < (uint)source.Length)
			{
				num2 = source[num];
				if (System.Text.UnicodeUtility.IsAsciiCodePoint(num2))
				{
					goto IL_0021;
				}
				if (System.Text.UnicodeUtility.IsInRangeInclusive(num2, 194u, 244u))
				{
					num2 = num2 - 194 << 6;
					num++;
					if ((uint)num >= (uint)source.Length)
					{
						goto IL_0163;
					}
					int num3 = (sbyte)source[num];
					if (num3 < -64)
					{
						num2 += (uint)num3;
						num2 += 128;
						num2 += 128;
						if (num2 < 2048)
						{
							goto IL_0021;
						}
						if (System.Text.UnicodeUtility.IsInRangeInclusive(num2, 2080u, 3343u) && !System.Text.UnicodeUtility.IsInRangeInclusive(num2, 2912u, 2943u) && !System.Text.UnicodeUtility.IsInRangeInclusive(num2, 3072u, 3087u))
						{
							num++;
							if ((uint)num >= (uint)source.Length)
							{
								goto IL_0163;
							}
							num3 = (sbyte)source[num];
							if (num3 < -64)
							{
								num2 <<= 6;
								num2 += (uint)num3;
								num2 += 128;
								num2 -= 131072;
								if (num2 > 65535)
								{
									num++;
									if ((uint)num >= (uint)source.Length)
									{
										goto IL_0163;
									}
									num3 = (sbyte)source[num];
									if (num3 >= -64)
									{
										goto IL_0153;
									}
									num2 <<= 6;
									num2 += (uint)num3;
									num2 += 128;
									num2 -= 4194304;
								}
								goto IL_0021;
							}
						}
					}
				}
				else
				{
					num = 1;
				}
				goto IL_0153;
			}
			goto IL_0163;
			IL_0021:
			bytesConsumed = num + 1;
			result = UnsafeCreate(num2);
			return OperationStatus.Done;
			IL_0153:
			bytesConsumed = num;
			result = ReplacementChar;
			return OperationStatus.InvalidData;
			IL_0163:
			bytesConsumed = num;
			result = ReplacementChar;
			return OperationStatus.NeedMoreData;
		}

		public override bool Equals([NotNullWhen(true)] object obj)
		{
			if (obj is Rune other)
			{
				return Equals(other);
			}
			return false;
		}

		public bool Equals(Rune other)
		{
			return this == other;
		}

		public override int GetHashCode()
		{
			return Value;
		}

		public static bool TryCreate(char ch, out Rune result)
		{
			if (!System.Text.UnicodeUtility.IsSurrogateCodePoint(ch))
			{
				result = UnsafeCreate(ch);
				return true;
			}
			result = default(Rune);
			return false;
		}

		public static bool TryCreate(char highSurrogate, char lowSurrogate, out Rune result)
		{
			uint num = (uint)(highSurrogate - 55296);
			uint num2 = (uint)(lowSurrogate - 56320);
			if ((num | num2) <= 1023)
			{
				result = UnsafeCreate((uint)((int)(num << 10) + (lowSurrogate - 56320) + 65536));
				return true;
			}
			result = default(Rune);
			return false;
		}

		public bool TryEncodeToUtf16(Span<char> destination, out int charsWritten)
		{
			if (destination.Length >= 1)
			{
				if (IsBmp)
				{
					destination[0] = (char)_value;
					charsWritten = 1;
					return true;
				}
				if (destination.Length >= 2)
				{
					System.Text.UnicodeUtility.GetUtf16SurrogatesFromSupplementaryPlaneScalar(_value, out destination[0], out destination[1]);
					charsWritten = 2;
					return true;
				}
			}
			charsWritten = 0;
			return false;
		}

		public bool TryEncodeToUtf8(Span<byte> destination, out int bytesWritten)
		{
			if (destination.Length >= 1)
			{
				if (IsAscii)
				{
					destination[0] = (byte)_value;
					bytesWritten = 1;
					return true;
				}
				if (destination.Length >= 2)
				{
					if (_value <= 2047)
					{
						destination[0] = (byte)(_value + 12288 >> 6);
						destination[1] = (byte)((_value & 0x3F) + 128);
						bytesWritten = 2;
						return true;
					}
					if (destination.Length >= 3)
					{
						if (_value <= 65535)
						{
							destination[0] = (byte)(_value + 917504 >> 12);
							destination[1] = (byte)(((_value & 0xFC0) >> 6) + 128);
							destination[2] = (byte)((_value & 0x3F) + 128);
							bytesWritten = 3;
							return true;
						}
						if (destination.Length >= 4)
						{
							destination[0] = (byte)(_value + 62914560 >> 18);
							destination[1] = (byte)(((_value & 0x3F000) >> 12) + 128);
							destination[2] = (byte)(((_value & 0xFC0) >> 6) + 128);
							destination[3] = (byte)((_value & 0x3F) + 128);
							bytesWritten = 4;
							return true;
						}
					}
				}
			}
			bytesWritten = 0;
			return false;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		internal static Rune UnsafeCreate(uint scalarValue)
		{
			return new Rune(scalarValue, unused: false);
		}
	}
}
namespace System.Text.Unicode
{
	internal static class UnicodeHelpers
	{
		internal const int UNICODE_LAST_CODEPOINT = 1114111;

		private static ReadOnlySpan<byte> DefinedCharsBitmapSpan => new byte[8192]
		{
			0, 0, 0, 0, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 127, 0, 0, 0, 0,
			254, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 252, 240, 215, 255, 255, 251, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 254, 255, 255, 255,
			127, 254, 255, 255, 255, 255, 255, 231, 254, 255,
			255, 255, 255, 255, 255, 0, 255, 255, 255, 135,
			31, 0, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 191, 255, 255, 255, 255,
			255, 255, 255, 231, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 3, 0, 255, 255,
			255, 255, 255, 255, 255, 231, 255, 255, 255, 255,
			255, 63, 255, 127, 255, 255, 255, 79, 255, 7,
			255, 255, 255, 127, 3, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 239, 159, 249, 255, 255, 253,
			197, 243, 159, 121, 128, 176, 207, 255, 255, 127,
			238, 135, 249, 255, 255, 253, 109, 211, 135, 57,
			2, 94, 192, 255, 127, 0, 238, 191, 251, 255,
			255, 253, 237, 243, 191, 59, 1, 0, 207, 255,
			3, 254, 238, 159, 249, 255, 255, 253, 237, 243,
			159, 57, 224, 176, 207, 255, 255, 0, 236, 199,
			61, 214, 24, 199, 255, 195, 199, 61, 129, 0,
			192, 255, 255, 7, 255, 223, 253, 255, 255, 253,
			255, 243, 223, 61, 96, 39, 207, 255, 128, 255,
			255, 223, 253, 255, 255, 253, 239, 243, 223, 61,
			96, 96, 207, 255, 6, 0, 255, 223, 253, 255,
			255, 255, 255, 255, 223, 253, 240, 255, 207, 255,
			255, 255, 238, 255, 127, 252, 255, 255, 251, 47,
			127, 132, 95, 255, 192, 255, 28, 0, 254, 255,
			255, 255, 255, 255, 255, 135, 255, 255, 255, 15,
			0, 0, 0, 0, 214, 247, 255, 255, 175, 255,
			255, 63, 95, 63, 255, 243, 0, 0, 0, 0,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 254,
			255, 255, 255, 31, 254, 255, 255, 255, 255, 254,
			255, 255, 255, 223, 255, 223, 255, 7, 0, 0,
			0, 0, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 191, 32, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 61, 127, 61, 255, 255,
			255, 255, 255, 61, 255, 255, 255, 255, 61, 127,
			61, 255, 127, 255, 255, 255, 255, 255, 255, 255,
			61, 255, 255, 255, 255, 255, 255, 255, 255, 231,
			255, 255, 255, 31, 255, 255, 255, 3, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 63, 63,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			254, 255, 255, 31, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 1, 255, 255, 63, 128,
			255, 255, 127, 0, 255, 255, 15, 0, 255, 223,
			13, 0, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 63, 255, 3, 255, 3, 255, 255,
			255, 3, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 1, 255, 255, 255, 255, 255, 7,
			255, 255, 255, 255, 255, 255, 255, 255, 63, 0,
			255, 255, 255, 127, 255, 15, 255, 15, 241, 255,
			255, 255, 255, 63, 31, 0, 255, 255, 255, 255,
			255, 15, 255, 255, 255, 3, 255, 199, 255, 255,
			255, 255, 255, 255, 255, 207, 255, 255, 255, 255,
			255, 255, 255, 127, 255, 255, 255, 159, 255, 3,
			255, 3, 255, 63, 255, 255, 255, 127, 0, 0,
			0, 0, 0, 0, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 31, 255, 255, 255, 255, 255, 127,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 15, 240, 255, 255, 255, 255,
			255, 255, 255, 248, 255, 227, 255, 255, 255, 255,
			255, 255, 255, 1, 255, 255, 255, 255, 255, 231,
			255, 0, 255, 255, 255, 255, 255, 7, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 63, 63, 255, 255, 255, 255,
			63, 63, 255, 170, 255, 255, 255, 63, 255, 255,
			255, 255, 255, 255, 223, 255, 223, 255, 207, 239,
			255, 255, 220, 127, 0, 248, 255, 255, 255, 124,
			255, 255, 255, 255, 255, 127, 223, 255, 243, 255,
			255, 127, 255, 31, 255, 255, 255, 255, 1, 0,
			255, 255, 255, 255, 1, 0, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 15, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 127, 0, 0, 0,
			255, 7, 0, 0, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			207, 255, 255, 255, 191, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 15, 254,
			255, 255, 255, 255, 191, 32, 255, 255, 255, 255,
			255, 255, 255, 128, 1, 128, 255, 255, 127, 0,
			127, 127, 127, 127, 127, 127, 127, 127, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 63, 0, 0, 0, 0, 255, 255,
			255, 251, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 15, 0, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			63, 0, 0, 0, 255, 15, 254, 255, 255, 255,
			255, 255, 255, 255, 254, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 127, 254, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 224, 255,
			255, 255, 255, 255, 254, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 127, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 15, 0, 255, 255,
			255, 255, 255, 127, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 31, 255, 255, 255, 255,
			255, 255, 127, 0, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 15, 0, 0,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 0, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 7,
			235, 3, 0, 0, 252, 255, 255, 255, 255, 255,
			255, 31, 255, 3, 255, 255, 255, 255, 255, 255,
			255, 0, 255, 255, 255, 255, 255, 255, 255, 255,
			63, 192, 255, 3, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 15, 128,
			255, 255, 255, 31, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 191, 255, 195, 255, 255, 255, 127,
			255, 255, 255, 255, 255, 255, 127, 0, 255, 63,
			255, 243, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 7, 0, 0, 248, 255, 255,
			127, 0, 126, 126, 126, 0, 127, 127, 255, 255,
			255, 255, 255, 255, 255, 15, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 63, 255, 3, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			15, 0, 255, 255, 127, 248, 255, 255, 255, 255,
			255, 15, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 63, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 3, 0, 0,
			0, 0, 127, 0, 248, 224, 255, 255, 127, 95,
			219, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 7, 0, 248, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 252, 255, 255, 255, 255, 255,
			255, 128, 0, 0, 0, 0, 255, 255, 255, 255,
			255, 3, 255, 255, 255, 255, 255, 255, 247, 255,
			127, 15, 223, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 31,
			254, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 127, 252, 252, 252, 28, 127, 127,
			0, 62
		};

		internal static ReadOnlySpan<byte> GetDefinedBmpCodePointsBitmapLittleEndian()
		{
			return DefinedCharsBitmapSpan;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		internal static void GetUtf16SurrogatePairFromAstralScalarValue(uint scalar, out char highSurrogate, out char lowSurrogate)
		{
			highSurrogate = (char)(scalar + 56557568 >> 10);
			lowSurrogate = (char)((scalar & 0x3FF) + 56320);
		}

		internal static int GetUtf8RepresentationForScalarValue(uint scalar)
		{
			if (scalar <= 127)
			{
				return (byte)scalar;
			}
			if (scalar <= 2047)
			{
				byte b = (byte)(0xC0u | (scalar >> 6));
				byte b2 = (byte)(0x80u | (scalar & 0x3Fu));
				return (b2 << 8) | b;
			}
			if (scalar <= 65535)
			{
				byte b3 = (byte)(0xE0u | (scalar >> 12));
				byte b4 = (byte)(0x80u | ((scalar >> 6) & 0x3Fu));
				byte b5 = (byte)(0x80u | (scalar & 0x3Fu));
				return (((b5 << 8) | b4) << 8) | b3;
			}
			byte b6 = (byte)(0xF0u | (scalar >> 18));
			byte b7 = (byte)(0x80u | ((scalar >> 12) & 0x3Fu));
			byte b8 = (byte)(0x80u | ((scalar >> 6) & 0x3Fu));
			byte b9 = (byte)(0x80u | (scalar & 0x3Fu));
			return (((((b9 << 8) | b8) << 8) | b7) << 8) | b6;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		internal static bool IsSupplementaryCodePoint(int scalar)
		{
			return (scalar & -65536) != 0;
		}
	}
	public sealed class UnicodeRange
	{
		public int FirstCodePoint { get; private set; }

		public int Length { get; private set; }

		public UnicodeRange(int firstCodePoint, int length)
		{
			if (firstCodePoint < 0 || firstCodePoint > 65535)
			{
				throw new ArgumentOutOfRangeException("firstCodePoint");
			}
			if (length < 0 || (long)firstCodePoint + (long)length > 65536)
			{
				throw new ArgumentOutOfRangeException("length");
			}
			FirstCodePoint = firstCodePoint;
			Length = length;
		}

		public static UnicodeRange Create(char firstCharacter, char lastCharacter)
		{
			if (lastCharacter < firstCharacter)
			{
				throw new ArgumentOutOfRangeException("lastCharacter");
			}
			return new UnicodeRange(firstCharacter, 1 + (lastCharacter - firstCharacter));
		}
	}
	public static class UnicodeRanges
	{
		private static UnicodeRange _none;

		private static UnicodeRange _all;

		private static UnicodeRange _u0000;

		private static UnicodeRange _u0080;

		private static UnicodeRange _u0100;

		private static UnicodeRange _u0180;

		private static UnicodeRange _u0250;

		private static UnicodeRange _u02B0;

		private static UnicodeRange _u0300;

		private static UnicodeRange _u0370;

		private static UnicodeRange _u0400;

		private static UnicodeRange _u0500;

		private static UnicodeRange _u0530;

		private static UnicodeRange _u0590;

		private static UnicodeRange _u0600;

		private static UnicodeRange _u0700;

		private static UnicodeRange _u0750;

		private static UnicodeRange _u0780;

		private static UnicodeRange _u07C0;

		private static UnicodeRange _u0800;

		private static UnicodeRange _u0840;

		private static UnicodeRange _u0860;

		private static UnicodeRange _u0870;

		private static UnicodeRange _u08A0;

		private static UnicodeRange _u0900;

		private static UnicodeRange _u0980;

		private static UnicodeRange _u0A00;

		private static UnicodeRange _u0A80;

		private static UnicodeRange _u0B00;

		private static UnicodeRange _u0B80;

		private static UnicodeRange _u0C00;

		private static UnicodeRange _u0C80;

		private static UnicodeRange _u0D00;

		private static UnicodeRange _u0D80;

		private static UnicodeRange _u0E00;

		private static UnicodeRange _u0E80;

		private static UnicodeRange _u0F00;

		private static UnicodeRange _u1000;

		private static UnicodeRange _u10A0;

		private static UnicodeRange _u1100;

		private static UnicodeRange _u1200;

		private static UnicodeRange _u1380;

		private static UnicodeRange _u13A0;

		private static UnicodeRange _u1400;

		private static UnicodeRange _u1680;

		private static UnicodeRange _u16A0;

		private static UnicodeRange _u1700;

		private static UnicodeRange _u1720;

		private static UnicodeRange _u1740;

		private static UnicodeRange _u1760;

		private static UnicodeRange _u1780;

		private static UnicodeRange _u1800;

		private static UnicodeRange _u18B0;

		private static UnicodeRange _u1900;

		private static UnicodeRange _u1950;

		private static UnicodeRange _u1980;

		private static UnicodeRange _u19E0;

		private static UnicodeRange _u1A00;

		private static UnicodeRange _u1A20;

		private static UnicodeRange _u1AB0;

		private static UnicodeRange _u1B00;

		private static UnicodeRange _u1B80;

		private static UnicodeRange _u1BC0;

		private static UnicodeRange _u1C00;

		private static UnicodeRange _u1C50;

		private static UnicodeRange _u1C80;

		private static UnicodeRange _u1C90;

		private static UnicodeRange _u1CC0;

		private static UnicodeRange _u1CD0;

		private static UnicodeRange _u1D00;

		private static UnicodeRange _u1D80;

		private static UnicodeRange _u1DC0;

		private static UnicodeRange _u1E00;

		private static UnicodeRange _u1F00;

		private static UnicodeRange _u2000;

		private static UnicodeRange _u2070;

		private static UnicodeRange _u20A0;

		private static UnicodeRange _u20D0;

		private static UnicodeRange _u2100;

		private static UnicodeRange _u2150;

		private static UnicodeRange _u2190;

		private static UnicodeRange _u2200;

		private static UnicodeRange _u2300;

		private static UnicodeRange _u2400;

		private static UnicodeRange _u2440;

		private static UnicodeRange _u2460;

		private static UnicodeRange _u2500;

		private static UnicodeRange _u2580;

		private static UnicodeRange _u25A0;

		private static UnicodeRange _u2600;

		private static UnicodeRange _u2700;

		private static UnicodeRange _u27C0;

		private static UnicodeRange _u27F0;

		private static UnicodeRange _u2800;

		private static UnicodeRange _u2900;

		private static UnicodeRange _u2980;

		private static UnicodeRange _u2A00;

		private static UnicodeRange _u2B00;

		private static UnicodeRange _u2C00;

		private static UnicodeRange _u2C60;

		private static UnicodeRange _u2C80;

		private static UnicodeRange _u2D00;

		private static UnicodeRange _u2D30;

		private static UnicodeRange _u2D80;

		private static UnicodeRange _u2DE0;

		private static UnicodeRange _u2E00;

		private static UnicodeRange _u2E80;

		private static UnicodeRange _u2F00;

		private static UnicodeRange _u2FF0;

		private static UnicodeRange _u3000;

		private static UnicodeRange _u3040;

		private static UnicodeRange _u30A0;

		private static UnicodeRange _u3100;

		private static UnicodeRange _u3130;

		private static UnicodeRange _u3190;

		private static UnicodeRange _u31A0;

		private static UnicodeRange _u31C0;

		private static UnicodeRange _u31F0;

		private static UnicodeRange _u3200;

		private static UnicodeRange _u3300;

		private static UnicodeRange _u3400;

		private static UnicodeRange _u4DC0;

		private static UnicodeRange _u4E00;

		private static UnicodeRange _uA000;

		private static UnicodeRange _uA490;

		private static UnicodeRange _uA4D0;

		private static UnicodeRange _uA500;

		private static UnicodeRange _uA640;

		private static UnicodeRange _uA6A0;

		private static UnicodeRange _uA700;

		private static UnicodeRange _uA720;

		private static UnicodeRange _uA800;

		private static UnicodeRange _uA830;

		private static UnicodeRange _uA840;

		private static UnicodeRange _uA880;

		private static UnicodeRange _uA8E0;

		private static UnicodeRange _uA900;

		private static UnicodeRange _uA930;

		private static UnicodeRange _uA960;

		private static UnicodeRange _uA980;

		private static UnicodeRange _uA9E0;

		private static UnicodeRange _uAA00;

		private static UnicodeRange _uAA60;

		private static UnicodeRange _uAA80;

		private static UnicodeRange _uAAE0;

		private static UnicodeRange _uAB00;

		private static UnicodeRange _uAB30;

		private static UnicodeRange _uAB70;

		private static UnicodeRange _uABC0;

		private static UnicodeRange _uAC00;

		private static UnicodeRange _uD7B0;

		private static UnicodeRange _uF900;

		private static UnicodeRange _uFB00;

		private static UnicodeRange _uFB50;

		private static UnicodeRange _uFE00;

		private static UnicodeRange _uFE10;

		private static UnicodeRange _uFE20;

		private static UnicodeRange _uFE30;

		private static UnicodeRange _uFE50;

		private static UnicodeRange _uFE70;

		private static UnicodeRange _uFF00;

		private static UnicodeRange _uFFF0;

		public static UnicodeRange None => _none ?? CreateEmptyRange(ref _none);

		public static UnicodeRange All => _all ?? CreateRange(ref _all, '\0', '\uffff');

		public static UnicodeRange BasicLatin => _u0000 ?? CreateRange(ref _u0000, '\0', '\u007f');

		public static UnicodeRange Latin1Supplement => _u0080 ?? CreateRange(ref _u0080, '\u0080', 'ÿ');

		public static UnicodeRange LatinExtendedA => _u0100 ?? CreateRange(ref _u0100, 'Ā', 'ſ');

		public static UnicodeRange LatinExtendedB => _u0180 ?? CreateRange(ref _u0180, 'ƀ', 'ɏ');

		public static UnicodeRange IpaExtensions => _u0250 ?? CreateRange(ref _u0250, 'ɐ', 'ʯ');

		public static UnicodeRange SpacingModifierLetters => _u02B0 ?? CreateRange(ref _u02B0, 'ʰ', '\u02ff');

		public static UnicodeRange CombiningDiacriticalMarks => _u0300 ?? CreateRange(ref _u0300, '\u0300', '\u036f');

		public static UnicodeRange GreekandCoptic => _u0370 ?? CreateRange(ref _u0370, 'Ͱ', 'Ͽ');

		public static UnicodeRange Cyrillic => _u0400 ?? CreateRange(ref _u0400, 'Ѐ', 'ӿ');

		public static UnicodeRange CyrillicSupplement => _u0500 ?? CreateRange(ref _u0500, 'Ԁ', 'ԯ');

		public static UnicodeRange Armenian => _u0530 ?? CreateRange(ref _u0530, '\u0530', '֏');

		public static UnicodeRange Hebrew => _u0590 ?? CreateRange(ref _u0590, '\u0590', '\u05ff');

		public static UnicodeRange Arabic => _u0600 ?? CreateRange(ref _u0600, '\u0600', 'ۿ');

		public static UnicodeRange Syriac => _u0700 ?? CreateRange(ref _u0700, '܀', 'ݏ');

		public static UnicodeRange ArabicSupplement => _u0750 ?? CreateRange(ref _u0750, 'ݐ', 'ݿ');

		public static UnicodeRange Thaana => _u0780 ?? CreateRange(ref _u0780, 'ހ', '\u07bf');

		public static UnicodeRange NKo => _u07C0 ?? CreateRange(ref _u07C0, '߀', '߿');

		public static UnicodeRange Samaritan => _u0800 ?? CreateRange(ref _u0800, 'ࠀ', '\u083f');

		public static UnicodeRange Mandaic => _u0840 ?? CreateRange(ref _u0840, 'ࡀ', '\u085f');

		public static UnicodeRange SyriacSupplement => _u0860 ?? CreateRange(ref _u0860, 'ࡠ', '\u086f');

		public static UnicodeRange ArabicExtendedB => _u0870 ?? CreateRange(ref _u0870, '\u0870', '\u089f');

		public static UnicodeRange ArabicExtendedA => _u08A0 ?? CreateRange(ref _u08A0, 'ࢠ', '\u08ff');

		public static UnicodeRange Devanagari => _u0900 ?? CreateRange(ref _u0900, '\u0900', 'ॿ');

		public static UnicodeRange Bengali => _u0980 ?? CreateRange(ref _u0980, 'ঀ', '\u09ff');

		public static UnicodeRange Gurmukhi => _u0A00 ?? CreateRange(ref _u0A00, '\u0a00', '\u0a7f');

		public static UnicodeRange Gujarati => _u0A80 ?? CreateRange(ref _u0A80, '\u0a80', '\u0aff');

		public static UnicodeRange Oriya => _u0B00 ?? CreateRange(ref _u0B00, '\u0b00', '\u0b7f');

		public static UnicodeRange Tamil => _u0B80 ?? CreateRange(ref _u0B80, '\u0b80', '\u0bff');

		public static UnicodeRange Telugu => _u0C00 ?? CreateRange(ref _u0C00, '\u0c00', '౿');

		public static UnicodeRange Kannada => _u0C80 ?? CreateRange(ref _u0C80, 'ಀ', '\u0cff');

		public static UnicodeRange Malayalam => _u0D00 ?? CreateRange(ref _u0D00, '\u0d00', 'ൿ');

		public static UnicodeRange Sinhala => _u0D80 ?? CreateRange(ref _u0D80, '\u0d80', '\u0dff');

		public static UnicodeRange Thai => _u0E00 ?? CreateRange(ref _u0E00, '\u0e00', '\u0e7f');

		public static UnicodeRange Lao => _u0E80 ?? CreateRange(ref _u0E80, '\u0e80', '\u0eff');

		public static UnicodeRange Tibetan => _u0F00 ?? CreateRange(ref _u0F00, 'ༀ', '\u0fff');

		public static UnicodeRange Myanmar => _u1000 ?? CreateRange(ref _u1000, 'က', '႟');

		public static UnicodeRange Georgian => _u10A0 ?? CreateRange(ref _u10A0, 'Ⴀ', 'ჿ');

		public static UnicodeRange HangulJamo => _u1100 ?? CreateRange(ref _u1100, 'ᄀ', 'ᇿ');

		public static UnicodeRange Ethiopic => _u1200 ?? CreateRange(ref _u1200, 'ሀ', '\u137f');

		public static UnicodeRange EthiopicSupplement => _u1380 ?? CreateRange(ref _u1380, 'ᎀ', '\u139f');

		public static UnicodeRange Cherokee => _u13A0 ?? CreateRange(ref _u13A0, 'Ꭰ', '\u13ff');

		public static UnicodeRange UnifiedCanadianAboriginalSyllabics => _u1400 ?? CreateRange(ref _u1400, '᐀', 'ᙿ');

		public static UnicodeRange Ogham => _u1680 ?? CreateRange(ref _u1680, '\u1680', '\u169f');

		public static UnicodeRange Runic => _u16A0 ?? CreateRange(ref _u16A0, 'ᚠ', '\u16ff');

		public static UnicodeRange Tagalog => _u1700 ?? CreateRange(ref _u1700, 'ᜀ', '\u171f');

		public static UnicodeRange Hanunoo => _u1720 ?? CreateRange(ref _u1720, 'ᜠ', '\u173f');

		public static UnicodeRange Buhid => _u1740 ?? CreateRange(ref _u1740, 'ᝀ', '\u175f');

		public static UnicodeRange Tagbanwa => _u1760 ?? CreateRange(ref _u1760, 'ᝠ', '\u177f');

		public static UnicodeRange Khmer => _u1780 ?? CreateRange(ref _u1780, 'ក', '\u17ff');

		public static UnicodeRange Mongolian => _u1800 ?? CreateRange(ref _u1800, '᠀', '\u18af');

		public static UnicodeRange UnifiedCanadianAboriginalSyllabicsExtended => _u18B0 ?? CreateRange(ref _u18B0, 'ᢰ', '\u18ff');

		public static UnicodeRange Limbu => _u1900 ?? CreateRange(ref _u1900, 'ᤀ', '᥏');

		public static UnicodeRange TaiLe => _u1950 ?? CreateRange(ref _u1950, 'ᥐ', '\u197f');

		public static UnicodeRange NewTaiLue => _u1980 ?? CreateRange(ref _u1980, 'ᦀ', '᧟');

		public static UnicodeRange KhmerSymbols => _u19E0 ?? CreateRange(ref _u19E0, '᧠', '᧿');

		public static UnicodeRange Buginese => _u1A00 ?? CreateRange(ref _u1A00, 'ᨀ', '᨟');

		public static UnicodeRange TaiTham => _u1A20 ?? CreateRange(ref _u1A20, 'ᨠ', '\u1aaf');

		public static UnicodeRange CombiningDiacriticalMarksExtended => _u1AB0 ?? CreateRange(ref _u1AB0, '\u1ab0', '\u1aff');

		public static UnicodeRange Balinese => _u1B00 ?? CreateRange(ref _u1B00, '\u1b00', '\u1b7f');

		public static UnicodeRange Sundanese => _u1B80 ?? CreateRange(ref _u1B80, '\u1b80', 'ᮿ');

		public static UnicodeRange Batak => _u1BC0 ?? CreateRange(ref _u1BC0, 'ᯀ', '᯿');

		public static UnicodeRange Lepcha => _u1C00 ?? CreateRange(ref _u1C00, 'ᰀ', 'ᱏ');

		public static UnicodeRange OlChiki => _u1C50 ?? CreateRange(ref _u1C50, '᱐', '᱿');

		public static UnicodeRange CyrillicExtendedC => _u1C80 ?? CreateRange(ref _u1C80, 'ᲀ', '\u1c8f');

		public static UnicodeRange GeorgianExtended => _u1C90 ?? CreateRange(ref _u1C90, 'Ა', 'Ჿ');

		public static UnicodeRange SundaneseSupplement => _u1CC0 ?? CreateRange(ref _u1CC0, '᳀', '\u1ccf');

		public static UnicodeRange VedicExtensions => _u1CD0 ?? CreateRange(ref _u1CD0, '\u1cd0', '\u1cff');

		public static UnicodeRange PhoneticExtensions => _u1D00 ?? CreateRange(ref _u1D00, 'ᴀ', 'ᵿ');

		public static UnicodeRange PhoneticExtensionsSupplement => _u1D80 ?? CreateRange(ref _u1D80, 'ᶀ', 'ᶿ');

		public static UnicodeRange CombiningDiacriticalMarksSupplement => _u1DC0 ?? CreateRange(ref _u1DC0, '\u1dc0', '\u1dff');

		public static UnicodeRange LatinExtendedAdditional => _u1E00 ?? CreateRange(ref _u1E00, 'Ḁ', 'ỿ');

		public static UnicodeRange GreekExtended => _u1F00 ?? CreateRange(ref _u1F00, 'ἀ', '\u1fff');

		public static UnicodeRange GeneralPunctuation => _u2000 ?? CreateRange(ref _u2000, '\u2000', '\u206f');

		public static UnicodeRange SuperscriptsandSubscripts => _u2070 ?? CreateRange(ref _u2070, '⁰', '\u209f');

		public static UnicodeRange CurrencySymbols => _u20A0 ?? CreateRange(ref _u20A0, '₠', '\u20cf');

		public static UnicodeRange CombiningDiacriticalMarksforSymbols => _u20D0 ?? CreateRange(ref _u20D0, '\u20d0', '\u20ff');

		public static UnicodeRange LetterlikeSymbols => _u2100 ?? CreateRange(ref _u2100, '℀', '⅏');

		public static UnicodeRange NumberForms => _u2150 ?? CreateRange(ref _u2150, '⅐', '\u218f');

		public static UnicodeRange Arrows => _u2190 ?? CreateRange(ref _u2190, '←', '⇿');

		public static UnicodeRange MathematicalOperators => _u2200 ?? CreateRange(ref _u2200, '∀', '⋿');

		public static UnicodeRange MiscellaneousTechnical => _u2300 ?? CreateRange(ref _u2300, '⌀', '⏿');

		public static UnicodeRange ControlPictures => _u2400 ?? CreateRange(ref _u2400, '␀', '\u243f');

		public static UnicodeRange OpticalCharacterRecognition => _u2440 ?? CreateRange(ref _u2440, '⑀', '\u245f');

		public static UnicodeRange EnclosedAlphanumerics => _u2460 ?? CreateRange(ref _u2460, '①', '⓿');

		public static UnicodeRange BoxDrawing => _u2500 ?? CreateRange(ref _u2500, '─', '╿');

		public static UnicodeRange BlockElements => _u2580 ?? CreateRange(ref _u2580, '▀', '▟');

		public static UnicodeRange GeometricShapes => _u25A0 ?? CreateRange(ref _u25A0, '■', '◿');

		public static UnicodeRange MiscellaneousSymbols => _u2600 ?? CreateRange(ref _u2600, '☀', '⛿');

		public static UnicodeRange Dingbats => _u2700 ?? CreateRange(ref _u2700, '✀', '➿');

		public static UnicodeRange MiscellaneousMathematicalSymbolsA => _u27C0 ?? CreateRange(ref _u27C0, '⟀', '⟯');

		public static UnicodeRange SupplementalArrowsA => _u27F0 ?? CreateRange(ref _u27F0, '⟰', '⟿');

		public static UnicodeRange BraillePatterns => _u2800 ?? CreateRange(ref _u2800, '⠀', '⣿');

		public static UnicodeRange SupplementalArrowsB => _u2900 ?? CreateRange(ref _u2900, '⤀', '⥿');

		public static UnicodeRange MiscellaneousMathematicalSymbolsB => _u2980 ?? CreateRange(ref _u2980, '⦀', '⧿');

		public static UnicodeRange SupplementalMathematicalOperators => _u2A00 ?? CreateRange(ref _u2A00, '⨀', '⫿');

		public static UnicodeRange MiscellaneousSymbolsandArrows => _u2B00 ?? CreateRange(ref _u2B00, '⬀', '⯿');

		public static UnicodeRange Glagolitic => _u2C00 ?? CreateRange(ref _u2C00, 'Ⰰ', '\u2c5f');

		public static UnicodeRange LatinExtendedC => _u2C60 ?? CreateRange(ref _u2C60, 'Ⱡ', 'Ɀ');

		public static UnicodeRange Coptic => _u2C80 ?? CreateRange(ref _u2C80, 'Ⲁ', '⳿');

		public static UnicodeRange GeorgianSupplement => _u2D00 ?? CreateRange(ref _u2D00, 'ⴀ', '\u2d2f');

		public static UnicodeRange Tifinagh => _u2D30 ?? CreateRange(ref _u2D30, 'ⴰ', '\u2d7f');

		public static UnicodeRange EthiopicExtended => _u2D80 ?? CreateRange(ref _u2D80, 'ⶀ', '\u2ddf');

		public static UnicodeRange CyrillicExtendedA => _u2DE0 ?? CreateRange(ref _u2DE0, '\u2de0', '\u2dff');

		public static UnicodeRange SupplementalPunctuation => _u2E00 ?? CreateRange(ref _u2E00, '⸀', '\u2e7f');

		public static UnicodeRange CjkRadicalsSupplement => _u2E80 ?? CreateRange(ref _u2E80, '⺀', '\u2eff');

		public static UnicodeRange KangxiRadicals => _u2F00 ?? CreateRange(ref _u2F00, '⼀', '\u2fdf');

		public static UnicodeRange IdeographicDescriptionCharacters => _u2FF0 ?? CreateRange(ref _u2FF0, '⿰', '\u2fff');

		public static UnicodeRange CjkSymbolsandPunctuation => _u3000 ?? CreateRange(ref _u3000, '\u3000', '〿');

		public static UnicodeRange Hiragana => _u3040 ?? CreateRange(ref _u3040, '\u3040', 'ゟ');

		public static UnicodeRange Katakana => _u30A0 ?? CreateRange(ref _u30A0, '゠', 'ヿ');

		public static UnicodeRange Bopomofo => _u3100 ?? CreateRange(ref _u3100, '\u3100', 'ㄯ');

		public static UnicodeRange HangulCompatibilityJamo => _u3130 ?? CreateRange(ref _u3130, '\u3130', '\u318f');

		public static UnicodeRange Kanbun => _u3190 ?? CreateRange(ref _u3190, '㆐', '㆟');

		public static UnicodeRange BopomofoExtended => _u31A0 ?? CreateRange(ref _u31A0, 'ㆠ', 'ㆿ');

		public static UnicodeRange CjkStrokes => _u31C0 ?? CreateRange(ref _u31C0, '㇀', '\u31ef');

		public static UnicodeRange KatakanaPhoneticExtensions => _u31F0 ?? CreateRange(ref _u31F0, 'ㇰ', 'ㇿ');

		public static UnicodeRange EnclosedCjkLettersandMonths => _u3200 ?? CreateRange(ref _u3200, '㈀', '㋿');

		public static UnicodeRange CjkCompatibility => _u3300 ?? CreateRange(ref _u3300, '㌀', '㏿');

		public static UnicodeRange CjkUnifiedIdeographsExtensionA => _u3400 ?? CreateRange(ref _u3400, '㐀', '䶿');

		public static UnicodeRange YijingHexagramSymbols => _u4DC0 ?? CreateRange(ref _u4DC0, '䷀', '䷿');

		public static UnicodeRange CjkUnifiedIdeographs => _u4E00 ?? CreateRange(ref _u4E00, '一', '\u9fff');

		public static UnicodeRange YiSyllables => _uA000 ?? CreateRange(ref _uA000, 'ꀀ', '\ua48f');

		public static UnicodeRange YiRadicals => _uA490 ?? CreateRange(ref _uA490, '꒐', '\ua4cf');

		public static UnicodeRange Lisu => _uA4D0 ?? CreateRange(ref _uA4D0, 'ꓐ', '꓿');

		public static UnicodeRange Vai => _uA500 ?? CreateRange(ref _uA500, 'ꔀ', '\ua63f');

		public static UnicodeRange CyrillicExtendedB => _uA640 ?? CreateRange(ref _uA640, 'Ꙁ', '\ua69f');

		public static UnicodeRange Bamum => _uA6A0 ?? CreateRange(ref _uA6A0, 'ꚠ', '\ua6ff');

		public static UnicodeRange ModifierToneLetters => _uA700 ?? CreateRange(ref _uA700, '\ua700', 'ꜟ');

		public static UnicodeRange LatinExtendedD => _uA720 ?? CreateRange(ref _uA720, '\ua720', 'ꟿ');

		public static UnicodeRange SylotiNagri => _uA800 ?? CreateRange(ref _uA800, 'ꠀ', '\ua82f');

		public static UnicodeRange CommonIndicNumberForms => _uA830 ?? CreateRange(ref _uA830, '꠰', '\ua83f');

		public static UnicodeRange Phagspa => _uA840 ?? CreateRange(ref _uA840, 'ꡀ', '\ua87f');

		public static UnicodeRange Saurashtra => _uA880 ?? CreateRange(ref _uA880, '\ua880', '\ua8df');

		public static UnicodeRange DevanagariExtended => _uA8E0 ?? CreateRange(ref _uA8E0, '\ua8e0', '\ua8ff');

		public static UnicodeRange KayahLi => _uA900 ?? CreateRange(ref _uA900, '꤀', '꤯');

		public static UnicodeRange Rejang => _uA930 ?? CreateRange(ref _uA930, 'ꤰ', '꥟');

		public static UnicodeRange HangulJamoExtendedA => _uA960 ?? CreateRange(ref _uA960, 'ꥠ', '\ua97f');

		public static UnicodeRange Javanese => _uA980 ?? CreateRange(ref _uA980, '\ua980', '꧟');

		public static UnicodeRange MyanmarExtendedB => _uA9E0 ?? CreateRange(ref _uA9E0, 'ꧠ', '\ua9ff');

		public static UnicodeRange Cham => _uAA00 ?? CreateRange(ref _uAA00, 'ꨀ', '꩟');

		public static UnicodeRange MyanmarExtendedA => _uAA60 ?? CreateRange(ref _uAA60, 'ꩠ', 'ꩿ');

		public static UnicodeRange TaiViet => _uAA80 ?? CreateRange(ref _uAA80, 'ꪀ', '꫟');

		public static UnicodeRange MeeteiMayekExtensions => _uAAE0 ?? CreateRange(ref _uAAE0, 'ꫠ', '\uaaff');

		public static UnicodeRange EthiopicExtendedA => _uAB00 ?? CreateRange(ref _uAB00, '\uab00', '\uab2f');

		public static UnicodeRange LatinExtendedE => _uAB30 ?? CreateRange(ref _uAB30, 'ꬰ', '\uab6f');

		public static UnicodeRange CherokeeSupplement => _uAB70 ?? CreateRange(ref _uAB70, 'ꭰ', 'ꮿ');

		public static UnicodeRange MeeteiMayek => _uABC0 ?? CreateRange(ref _uABC0, 'ꯀ', '\uabff');

		public static UnicodeRange HangulSyllables => _uAC00 ?? CreateRange(ref _uAC00, '가', '\ud7af');

		public static UnicodeRange HangulJamoExtendedB => _uD7B0 ?? CreateRange(ref _uD7B0, 'ힰ', '\ud7ff');

		public static UnicodeRange CjkCompatibilityIdeographs => _uF900 ?? CreateRange(ref _uF900, '豈', '\ufaff');

		public static UnicodeRange AlphabeticPresentationForms => _uFB00 ?? CreateRange(ref _uFB00, 'ff', 'ﭏ');

		public static UnicodeRange ArabicPresentationFormsA => _uFB50 ?? CreateRange(ref _uFB50, 'ﭐ', '\ufdff');

		public static UnicodeRange VariationSelectors => _uFE00 ?? CreateRange(ref _uFE00, '\ufe00', '\ufe0f');

		public static UnicodeRange VerticalForms => _uFE10 ?? CreateRange(ref _uFE10, '︐', '\ufe1f');

		public static UnicodeRange CombiningHalfMarks => _uFE20 ?? CreateRange(ref _uFE20, '\ufe20', '\ufe2f');

		public static UnicodeRange CjkCompatibilityForms => _uFE30 ?? CreateRange(ref _uFE30, '︰', '\ufe4f');

		public static UnicodeRange SmallFormVariants => _uFE50 ?? CreateRange(ref _uFE50, '﹐', '\ufe6f');

		public static UnicodeRange ArabicPresentationFormsB => _uFE70 ?? CreateRange(ref _uFE70, 'ﹰ', '\ufeff');

		public static UnicodeRange HalfwidthandFullwidthForms => _uFF00 ?? CreateRange(ref _uFF00, '\uff00', '\uffef');

		public static UnicodeRange Specials => _uFFF0 ?? CreateRange(ref _uFFF0, '\ufff0', '\uffff');

		[MethodImpl(MethodImplOptions.NoInlining)]
		private static UnicodeRange CreateEmptyRange([NotNull] ref UnicodeRange range)
		{
			Volatile.Write(ref range, new UnicodeRange(0, 0));
			return range;
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		private static UnicodeRange CreateRange([NotNull] ref UnicodeRange range, char first, char last)
		{
			Volatile.Write(ref range, UnicodeRange.Create(first, last));
			return range;
		}
	}
}
namespace System.Text.Encodings.Web
{
	internal struct AsciiByteMap
	{
		private const int BufferSize = 128;

		private unsafe fixed byte Buffer[128];

		internal unsafe void InsertAsciiChar(char key, byte value)
		{
			if (key < '\u0080')
			{
				Buffer[(uint)key] = value;
			}
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		internal unsafe readonly bool TryLookup(Rune key, out byte value)
		{
			if (key.IsAscii)
			{
				byte b = Buffer[(uint)key.Value];
				if (b != 0)
				{
					value = b;
					return true;
				}
			}
			value = 0;
			return false;
		}
	}
	internal struct AllowedBmpCodePointsBitmap
	{
		private const int BitmapLengthInDWords = 2048;

		private unsafe fixed uint Bitmap[2048];

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public unsafe void AllowChar(char value)
		{
			_GetIndexAndOffset(value, out UIntPtr index, out int offset);
			ref uint reference = ref Bitmap[(ulong)index];
			reference |= (uint)(1 << offset);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public unsafe void ForbidChar(char value)
		{
			_GetIndexAndOffset(value, out UIntPtr index, out int offset);
			ref uint reference = ref Bitmap[(ulong)index];
			reference &= (uint)(~(1 << offset));
		}

		public void ForbidHtmlCharacters()
		{
			ForbidChar('<');
			ForbidChar('>');
			ForbidChar('&');
			ForbidChar('\'');
			ForbidChar('"');
			ForbidChar('+');
		}

		public unsafe void ForbidUndefinedCharacters()
		{
			fixed (uint* pointer = Bitmap)
			{
				ReadOnlySpan<byte> definedBmpCodePointsBitmapLittleEndian = UnicodeHelpers.GetDefinedBmpCodePointsBitmapLittleEndian();
				Span<uint> span = new Span<uint>(pointer, 2048);
				for (int i = 0; i < span.Length; i++)
				{
					span[i] &= BinaryPrimitives.ReadUInt32LittleEndian(definedBmpCodePointsBitmapLittleEndian.Slice(i * 4));
				}
			}
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public unsafe readonly bool IsCharAllowed(char value)
		{
			_GetIndexAndOffset(value, out UIntPtr index, out int offset);
			if ((Bitmap[(ulong)index] & (uint)(1 << 

BepInEx/plugins/SlopCrew.Plugin/System.Text.Json.dll

Decompiled 8 months ago
using System;
using System.Buffers;
using System.Buffers.Text;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.IO;
using System.Numerics;
using System.Reflection;
using System.Reflection.Emit;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.ExceptionServices;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text.Encodings.Web;
using System.Text.Json.Nodes;
using System.Text.Json.Reflection;
using System.Text.Json.Serialization;
using System.Text.Json.Serialization.Converters;
using System.Text.Json.Serialization.Metadata;
using System.Threading;
using System.Threading.Tasks;
using FxResources.System.Text.Json;
using Microsoft.CodeAnalysis;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: AssemblyMetadata(".NETFrameworkAssembly", "")]
[assembly: AssemblyMetadata("Serviceable", "True")]
[assembly: AssemblyMetadata("PreferInbox", "True")]
[assembly: AssemblyDefaultAlias("System.Text.Json")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: CLSCompliant(true)]
[assembly: AssemblyMetadata("IsTrimmable", "True")]
[assembly: DefaultDllImportSearchPaths(DllImportSearchPath.System32 | DllImportSearchPath.AssemblyDirectory)]
[assembly: AssemblyCompany("Microsoft Corporation")]
[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")]
[assembly: AssemblyDescription("Provides high-performance and low-allocating types that serialize objects to JavaScript Object Notation (JSON) text and deserialize JSON text to objects, with UTF-8 support built-in. Also provides types to read and write JSON text encoded as UTF-8, and to create an in-memory document object model (DOM), that is read-only, for random access of the JSON elements within a structured view of the data.\r\n\r\nThe System.Text.Json 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("7.0.22.51805")]
[assembly: AssemblyInformationalVersion("7.0.0+d099f075e45d2aa6007a22b71b45a08758559f80")]
[assembly: AssemblyProduct("Microsoft® .NET")]
[assembly: AssemblyTitle("System.Text.Json")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/dotnet/runtime")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("7.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: System.Runtime.CompilerServices.NullablePublicOnly(false)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class IsReadOnlyAttribute : Attribute
	{
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class IsUnmanagedAttribute : Attribute
	{
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class IsByRefLikeAttribute : Attribute
	{
	}
	[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 NullablePublicOnlyAttribute : Attribute
	{
		public readonly bool IncludesInternals;

		public NullablePublicOnlyAttribute(bool P_0)
		{
			IncludesInternals = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
	internal sealed class ScopedRefAttribute : Attribute
	{
	}
	[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 FxResources.System.Text.Json
{
	internal static class SR
	{
	}
}
namespace System
{
	internal static class HexConverter
	{
		public enum Casing : uint
		{
			Upper = 0u,
			Lower = 8224u
		}

		public static ReadOnlySpan<byte> CharToHexLookup => new byte[256]
		{
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 0, 1,
			2, 3, 4, 5, 6, 7, 8, 9, 255, 255,
			255, 255, 255, 255, 255, 10, 11, 12, 13, 14,
			15, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 10, 11, 12,
			13, 14, 15, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
			255, 255, 255, 255, 255, 255
		};

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static void ToBytesBuffer(byte value, Span<byte> buffer, int startingIndex = 0, Casing casing = Casing.Upper)
		{
			uint num = (uint)(((value & 0xF0) << 4) + (value & 0xF) - 35209);
			uint num2 = ((((0 - num) & 0x7070) >> 4) + num + 47545) | (uint)casing;
			buffer[startingIndex + 1] = (byte)num2;
			buffer[startingIndex] = (byte)(num2 >> 8);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static void ToCharsBuffer(byte value, Span<char> buffer, int startingIndex = 0, Casing casing = Casing.Upper)
		{
			uint num = (uint)(((value & 0xF0) << 4) + (value & 0xF) - 35209);
			uint num2 = ((((0 - num) & 0x7070) >> 4) + num + 47545) | (uint)casing;
			buffer[startingIndex + 1] = (char)(num2 & 0xFFu);
			buffer[startingIndex] = (char)(num2 >> 8);
		}

		public static void EncodeToUtf16(ReadOnlySpan<byte> bytes, Span<char> chars, Casing casing = Casing.Upper)
		{
			for (int i = 0; i < bytes.Length; i++)
			{
				ToCharsBuffer(bytes[i], chars, i * 2, casing);
			}
		}

		public static string ToString(ReadOnlySpan<byte> bytes, Casing casing = Casing.Upper)
		{
			Span<char> span = ((bytes.Length <= 16) ? stackalloc char[bytes.Length * 2] : new char[bytes.Length * 2].AsSpan());
			Span<char> buffer = span;
			int num = 0;
			ReadOnlySpan<byte> readOnlySpan = bytes;
			for (int i = 0; i < readOnlySpan.Length; i++)
			{
				byte value = readOnlySpan[i];
				ToCharsBuffer(value, buffer, num, casing);
				num += 2;
			}
			return buffer.ToString();
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static char ToCharUpper(int value)
		{
			value &= 0xF;
			value += 48;
			if (value > 57)
			{
				value += 7;
			}
			return (char)value;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static char ToCharLower(int value)
		{
			value &= 0xF;
			value += 48;
			if (value > 57)
			{
				value += 39;
			}
			return (char)value;
		}

		public static bool TryDecodeFromUtf16(ReadOnlySpan<char> chars, Span<byte> bytes)
		{
			int charsProcessed;
			return TryDecodeFromUtf16(chars, bytes, out charsProcessed);
		}

		public static bool TryDecodeFromUtf16(ReadOnlySpan<char> chars, Span<byte> bytes, out int charsProcessed)
		{
			int num = 0;
			int num2 = 0;
			int num3 = 0;
			int num4 = 0;
			while (num2 < bytes.Length)
			{
				num3 = FromChar(chars[num + 1]);
				num4 = FromChar(chars[num]);
				if ((num3 | num4) == 255)
				{
					break;
				}
				bytes[num2++] = (byte)((num4 << 4) | num3);
				num += 2;
			}
			if (num3 == 255)
			{
				num++;
			}
			charsProcessed = num;
			return (num3 | num4) != 255;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static int FromChar(int c)
		{
			if (c < CharToHexLookup.Length)
			{
				return CharToHexLookup[c];
			}
			return 255;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static int FromUpperChar(int c)
		{
			if (c <= 71)
			{
				return CharToHexLookup[c];
			}
			return 255;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static int FromLowerChar(int c)
		{
			switch (c)
			{
			case 48:
			case 49:
			case 50:
			case 51:
			case 52:
			case 53:
			case 54:
			case 55:
			case 56:
			case 57:
				return c - 48;
			case 97:
			case 98:
			case 99:
			case 100:
			case 101:
			case 102:
				return c - 97 + 10;
			default:
				return 255;
			}
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static bool IsHexChar(int c)
		{
			if (IntPtr.Size == 8)
			{
				ulong num = (uint)(c - 48);
				ulong num2 = (ulong)(-17875860044349952L << (int)num);
				ulong num3 = num - 64;
				if ((long)(num2 & num3) >= 0L)
				{
					return false;
				}
				return true;
			}
			return FromChar(c) != 255;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static bool IsHexUpperChar(int c)
		{
			if ((uint)(c - 48) > 9u)
			{
				return (uint)(c - 65) <= 5u;
			}
			return true;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static bool IsHexLowerChar(int c)
		{
			if ((uint)(c - 48) > 9u)
			{
				return (uint)(c - 97) <= 5u;
			}
			return true;
		}
	}
	internal static class Obsoletions
	{
		internal const string SharedUrlFormat = "https://aka.ms/dotnet-warnings/{0}";

		internal const string SystemTextEncodingUTF7Message = "The UTF-7 encoding is insecure and should not be used. Consider using UTF-8 instead.";

		internal const string SystemTextEncodingUTF7DiagId = "SYSLIB0001";

		internal const string PrincipalPermissionAttributeMessage = "PrincipalPermissionAttribute is not honored by the runtime and must not be used.";

		internal const string PrincipalPermissionAttributeDiagId = "SYSLIB0002";

		internal const string CodeAccessSecurityMessage = "Code Access Security is not supported or honored by the runtime.";

		internal const string CodeAccessSecurityDiagId = "SYSLIB0003";

		internal const string ConstrainedExecutionRegionMessage = "The Constrained Execution Region (CER) feature is not supported.";

		internal const string ConstrainedExecutionRegionDiagId = "SYSLIB0004";

		internal const string GlobalAssemblyCacheMessage = "The Global Assembly Cache is not supported.";

		internal const string GlobalAssemblyCacheDiagId = "SYSLIB0005";

		internal const string ThreadAbortMessage = "Thread.Abort is not supported and throws PlatformNotSupportedException.";

		internal const string ThreadResetAbortMessage = "Thread.ResetAbort is not supported and throws PlatformNotSupportedException.";

		internal const string ThreadAbortDiagId = "SYSLIB0006";

		internal const string DefaultCryptoAlgorithmsMessage = "The default implementation of this cryptography algorithm is not supported.";

		internal const string DefaultCryptoAlgorithmsDiagId = "SYSLIB0007";

		internal const string CreatePdbGeneratorMessage = "The CreatePdbGenerator API is not supported and throws PlatformNotSupportedException.";

		internal const string CreatePdbGeneratorDiagId = "SYSLIB0008";

		internal const string AuthenticationManagerMessage = "The AuthenticationManager Authenticate and PreAuthenticate methods are not supported and throw PlatformNotSupportedException.";

		internal const string AuthenticationManagerDiagId = "SYSLIB0009";

		internal const string RemotingApisMessage = "This Remoting API is not supported and throws PlatformNotSupportedException.";

		internal const string RemotingApisDiagId = "SYSLIB0010";

		internal const string BinaryFormatterMessage = "BinaryFormatter serialization is obsolete and should not be used. See https://aka.ms/binaryformatter for more information.";

		internal const string BinaryFormatterDiagId = "SYSLIB0011";

		internal const string CodeBaseMessage = "Assembly.CodeBase and Assembly.EscapedCodeBase are only included for .NET Framework compatibility. Use Assembly.Location instead.";

		internal const string CodeBaseDiagId = "SYSLIB0012";

		internal const string EscapeUriStringMessage = "Uri.EscapeUriString can corrupt the Uri string in some cases. Consider using Uri.EscapeDataString for query string components instead.";

		internal const string EscapeUriStringDiagId = "SYSLIB0013";

		internal const string WebRequestMessage = "WebRequest, HttpWebRequest, ServicePoint, and WebClient are obsolete. Use HttpClient instead.";

		internal const string WebRequestDiagId = "SYSLIB0014";

		internal const string DisablePrivateReflectionAttributeMessage = "DisablePrivateReflectionAttribute has no effect in .NET 6.0+.";

		internal const string DisablePrivateReflectionAttributeDiagId = "SYSLIB0015";

		internal const string GetContextInfoMessage = "Use the Graphics.GetContextInfo overloads that accept arguments for better performance and fewer allocations.";

		internal const string GetContextInfoDiagId = "SYSLIB0016";

		internal const string StrongNameKeyPairMessage = "Strong name signing is not supported and throws PlatformNotSupportedException.";

		internal const string StrongNameKeyPairDiagId = "SYSLIB0017";

		internal const string ReflectionOnlyLoadingMessage = "ReflectionOnly loading is not supported and throws PlatformNotSupportedException.";

		internal const string ReflectionOnlyLoadingDiagId = "SYSLIB0018";

		internal const string RuntimeEnvironmentMessage = "RuntimeEnvironment members SystemConfigurationFile, GetRuntimeInterfaceAsIntPtr, and GetRuntimeInterfaceAsObject are not supported and throw PlatformNotSupportedException.";

		internal const string RuntimeEnvironmentDiagId = "SYSLIB0019";

		internal const string JsonSerializerOptionsIgnoreNullValuesMessage = "JsonSerializerOptions.IgnoreNullValues is obsolete. To ignore null values when serializing, set DefaultIgnoreCondition to JsonIgnoreCondition.WhenWritingNull.";

		internal const string JsonSerializerOptionsIgnoreNullValuesDiagId = "SYSLIB0020";

		internal const string DerivedCryptographicTypesMessage = "Derived cryptographic types are obsolete. Use the Create method on the base type instead.";

		internal const string DerivedCryptographicTypesDiagId = "SYSLIB0021";

		internal const string RijndaelMessage = "The Rijndael and RijndaelManaged types are obsolete. Use Aes instead.";

		internal const string RijndaelDiagId = "SYSLIB0022";

		internal const string RNGCryptoServiceProviderMessage = "RNGCryptoServiceProvider is obsolete. To generate a random number, use one of the RandomNumberGenerator static methods instead.";

		internal const string RNGCryptoServiceProviderDiagId = "SYSLIB0023";

		internal const string AppDomainCreateUnloadMessage = "Creating and unloading AppDomains is not supported and throws an exception.";

		internal const string AppDomainCreateUnloadDiagId = "SYSLIB0024";

		internal const string SuppressIldasmAttributeMessage = "SuppressIldasmAttribute has no effect in .NET 6.0+.";

		internal const string SuppressIldasmAttributeDiagId = "SYSLIB0025";

		internal const string X509CertificateImmutableMessage = "X509Certificate and X509Certificate2 are immutable. Use the appropriate constructor to create a new certificate.";

		internal const string X509CertificateImmutableDiagId = "SYSLIB0026";

		internal const string PublicKeyPropertyMessage = "PublicKey.Key is obsolete. Use the appropriate method to get the public key, such as GetRSAPublicKey.";

		internal const string PublicKeyPropertyDiagId = "SYSLIB0027";

		internal const string X509CertificatePrivateKeyMessage = "X509Certificate2.PrivateKey is obsolete. Use the appropriate method to get the private key, such as GetRSAPrivateKey, or use the CopyWithPrivateKey method to create a new instance with a private key.";

		internal const string X509CertificatePrivateKeyDiagId = "SYSLIB0028";

		internal const string ProduceLegacyHmacValuesMessage = "ProduceLegacyHmacValues is obsolete. Producing legacy HMAC values is not supported.";

		internal const string ProduceLegacyHmacValuesDiagId = "SYSLIB0029";

		internal const string UseManagedSha1Message = "HMACSHA1 always uses the algorithm implementation provided by the platform. Use a constructor without the useManagedSha1 parameter.";

		internal const string UseManagedSha1DiagId = "SYSLIB0030";

		internal const string CryptoConfigEncodeOIDMessage = "EncodeOID is obsolete. Use the ASN.1 functionality provided in System.Formats.Asn1.";

		internal const string CryptoConfigEncodeOIDDiagId = "SYSLIB0031";

		internal const string CorruptedStateRecoveryMessage = "Recovery from corrupted process state exceptions is not supported; HandleProcessCorruptedStateExceptionsAttribute is ignored.";

		internal const string CorruptedStateRecoveryDiagId = "SYSLIB0032";

		internal const string Rfc2898CryptDeriveKeyMessage = "Rfc2898DeriveBytes.CryptDeriveKey is obsolete and is not supported. Use PasswordDeriveBytes.CryptDeriveKey instead.";

		internal const string Rfc2898CryptDeriveKeyDiagId = "SYSLIB0033";

		internal const string CmsSignerCspParamsCtorMessage = "CmsSigner(CspParameters) is obsolete and is not supported. Use an alternative constructor instead.";

		internal const string CmsSignerCspParamsCtorDiagId = "SYSLIB0034";

		internal const string SignerInfoCounterSigMessage = "ComputeCounterSignature without specifying a CmsSigner is obsolete and is not supported. Use the overload that accepts a CmsSigner.";

		internal const string SignerInfoCounterSigDiagId = "SYSLIB0035";

		internal const string RegexCompileToAssemblyMessage = "Regex.CompileToAssembly is obsolete and not supported. Use the GeneratedRegexAttribute with the regular expression source generator instead.";

		internal const string RegexCompileToAssemblyDiagId = "SYSLIB0036";

		internal const string AssemblyNameMembersMessage = "AssemblyName members HashAlgorithm, ProcessorArchitecture, and VersionCompatibility are obsolete and not supported.";

		internal const string AssemblyNameMembersDiagId = "SYSLIB0037";

		internal const string SystemDataSerializationFormatBinaryMessage = "SerializationFormat.Binary is obsolete and should not be used. See https://aka.ms/serializationformat-binary-obsolete for more information.";

		internal const string SystemDataSerializationFormatBinaryDiagId = "SYSLIB0038";

		internal const string TlsVersion10and11Message = "TLS versions 1.0 and 1.1 have known vulnerabilities and are not recommended. Use a newer TLS version instead, or use SslProtocols.None to defer to OS defaults.";

		internal const string TlsVersion10and11DiagId = "SYSLIB0039";

		internal const string EncryptionPolicyMessage = "EncryptionPolicy.NoEncryption and AllowEncryption significantly reduce security and should not be used in production code.";

		internal const string EncryptionPolicyDiagId = "SYSLIB0040";

		internal const string Rfc2898OutdatedCtorMessage = "The default hash algorithm and iteration counts in Rfc2898DeriveBytes constructors are outdated and insecure. Use a constructor that accepts the hash algorithm and the number of iterations.";

		internal const string Rfc2898OutdatedCtorDiagId = "SYSLIB0041";

		internal const string EccXmlExportImportMessage = "ToXmlString and FromXmlString have no implementation for ECC types, and are obsolete. Use a standard import and export format such as ExportSubjectPublicKeyInfo or ImportSubjectPublicKeyInfo for public keys and ExportPkcs8PrivateKey or ImportPkcs8PrivateKey for private keys.";

		internal const string EccXmlExportImportDiagId = "SYSLIB0042";

		internal const string EcDhPublicKeyBlobMessage = "ECDiffieHellmanPublicKey.ToByteArray() and the associated constructor do not have a consistent and interoperable implementation on all platforms. Use ECDiffieHellmanPublicKey.ExportSubjectPublicKeyInfo() instead.";

		internal const string EcDhPublicKeyBlobDiagId = "SYSLIB0043";

		internal const string AssemblyNameCodeBaseMessage = "AssemblyName.CodeBase and AssemblyName.EscapedCodeBase are obsolete. Using them for loading an assembly is not supported.";

		internal const string AssemblyNameCodeBaseDiagId = "SYSLIB0044";

		internal const string CryptoStringFactoryMessage = "Cryptographic factory methods accepting an algorithm name are obsolete. Use the parameterless Create factory method on the algorithm type instead.";

		internal const string CryptoStringFactoryDiagId = "SYSLIB0045";

		internal const string ControlledExecutionRunMessage = "ControlledExecution.Run method may corrupt the process and should not be used in production code.";

		internal const string ControlledExecutionRunDiagId = "SYSLIB0046";

		internal const string XmlSecureResolverMessage = "XmlSecureResolver is obsolete. Use XmlResolver.ThrowingResolver instead when attempting to forbid XML external entity resolution.";

		internal const string XmlSecureResolverDiagId = "SYSLIB0047";
	}
	internal static class SR
	{
		private static readonly bool s_usingResourceKeys = AppContext.TryGetSwitch("System.Resources.UseSystemResourceKeys", out var isEnabled) && isEnabled;

		private static ResourceManager s_resourceManager;

		internal static ResourceManager ResourceManager => s_resourceManager ?? (s_resourceManager = new ResourceManager(typeof(SR)));

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

		private static bool UsingResourceKeys()
		{
			return s_usingResourceKeys;
		}

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

		internal static string GetResourceString(string resourceKey, string defaultString)
		{
			string resourceString = GetResourceString(resourceKey);
			if (!(resourceKey == resourceString) && resourceString != null)
			{
				return resourceString;
			}
			return defaultString;
		}

		internal static string Format(string resourceFormat, object p1)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1);
			}
			return string.Format(resourceFormat, p1);
		}

		internal static string Format(string resourceFormat, object p1, object p2)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2);
			}
			return string.Format(resourceFormat, p1, p2);
		}

		internal static string Format(string resourceFormat, object p1, object p2, object p3)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2, p3);
			}
			return string.Format(resourceFormat, p1, p2, p3);
		}

		internal static string Format(string resourceFormat, params object[] args)
		{
			if (args != null)
			{
				if (UsingResourceKeys())
				{
					return resourceFormat + ", " + string.Join(", ", args);
				}
				return string.Format(resourceFormat, args);
			}
			return resourceFormat;
		}

		internal static string Format(IFormatProvider provider, string resourceFormat, object p1)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1);
			}
			return string.Format(provider, resourceFormat, p1);
		}

		internal static string Format(IFormatProvider provider, string resourceFormat, object p1, object p2)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2);
			}
			return string.Format(provider, resourceFormat, p1, p2);
		}

		internal static string Format(IFormatProvider provider, string resourceFormat, object p1, object p2, object p3)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2, p3);
			}
			return string.Format(provider, resourceFormat, p1, p2, p3);
		}

		internal static string Format(IFormatProvider provider, string resourceFormat, params object[] args)
		{
			if (args != null)
			{
				if (UsingResourceKeys())
				{
					return resourceFormat + ", " + string.Join(", ", args);
				}
				return string.Format(provider, resourceFormat, args);
			}
			return resourceFormat;
		}
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate, Inherited = false)]
	internal sealed class ObsoleteAttribute : Attribute
	{
		public string Message { get; }

		public bool IsError { get; }

		public string DiagnosticId { get; set; }

		public string UrlFormat { get; set; }

		public ObsoleteAttribute()
		{
		}

		public ObsoleteAttribute(string message)
		{
			Message = message;
		}

		public ObsoleteAttribute(string message, bool error)
		{
			Message = message;
			IsError = error;
		}
	}
}
namespace System.Diagnostics.CodeAnalysis
{
	[AttributeUsage(AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Field, AllowMultiple = true, Inherited = false)]
	internal sealed class DynamicDependencyAttribute : Attribute
	{
		public string MemberSignature { get; }

		public DynamicallyAccessedMemberTypes MemberTypes { get; }

		public Type Type { get; }

		public string TypeName { get; }

		public string AssemblyName { get; }

		public string Condition { get; set; }

		public DynamicDependencyAttribute(string memberSignature)
		{
			MemberSignature = memberSignature;
		}

		public DynamicDependencyAttribute(string memberSignature, Type type)
		{
			MemberSignature = memberSignature;
			Type = type;
		}

		public DynamicDependencyAttribute(string memberSignature, string typeName, string assemblyName)
		{
			MemberSignature = memberSignature;
			TypeName = typeName;
			AssemblyName = assemblyName;
		}

		public DynamicDependencyAttribute(DynamicallyAccessedMemberTypes memberTypes, Type type)
		{
			MemberTypes = memberTypes;
			Type = type;
		}

		public DynamicDependencyAttribute(DynamicallyAccessedMemberTypes memberTypes, string typeName, string assemblyName)
		{
			MemberTypes = memberTypes;
			TypeName = typeName;
			AssemblyName = assemblyName;
		}
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Interface | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, Inherited = false)]
	internal sealed class DynamicallyAccessedMembersAttribute : Attribute
	{
		public DynamicallyAccessedMemberTypes MemberTypes { get; }

		public DynamicallyAccessedMembersAttribute(DynamicallyAccessedMemberTypes memberTypes)
		{
			MemberTypes = memberTypes;
		}
	}
	[Flags]
	internal enum DynamicallyAccessedMemberTypes
	{
		None = 0,
		PublicParameterlessConstructor = 1,
		PublicConstructors = 3,
		NonPublicConstructors = 4,
		PublicMethods = 8,
		NonPublicMethods = 0x10,
		PublicFields = 0x20,
		NonPublicFields = 0x40,
		PublicNestedTypes = 0x80,
		NonPublicNestedTypes = 0x100,
		PublicProperties = 0x200,
		NonPublicProperties = 0x400,
		PublicEvents = 0x800,
		NonPublicEvents = 0x1000,
		Interfaces = 0x2000,
		All = -1
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Constructor | AttributeTargets.Method, Inherited = false)]
	internal sealed class RequiresUnreferencedCodeAttribute : Attribute
	{
		public string Message { get; }

		public string Url { get; set; }

		public RequiresUnreferencedCodeAttribute(string message)
		{
			Message = message;
		}
	}
	[AttributeUsage(AttributeTargets.All, Inherited = false, AllowMultiple = true)]
	internal sealed class UnconditionalSuppressMessageAttribute : Attribute
	{
		public string Category { get; }

		public string CheckId { get; }

		public string Scope { get; set; }

		public string Target { get; set; }

		public string MessageId { get; set; }

		public string Justification { get; set; }

		public UnconditionalSuppressMessageAttribute(string category, string checkId)
		{
			Category = category;
			CheckId = checkId;
		}
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
	internal sealed class StringSyntaxAttribute : Attribute
	{
		public const string CompositeFormat = "CompositeFormat";

		public const string DateOnlyFormat = "DateOnlyFormat";

		public const string DateTimeFormat = "DateTimeFormat";

		public const string EnumFormat = "EnumFormat";

		public const string GuidFormat = "GuidFormat";

		public const string Json = "Json";

		public const string NumericFormat = "NumericFormat";

		public const string Regex = "Regex";

		public const string TimeOnlyFormat = "TimeOnlyFormat";

		public const string TimeSpanFormat = "TimeSpanFormat";

		public const string Uri = "Uri";

		public const string Xml = "Xml";

		public string Syntax { get; }

		public object[] Arguments { get; }

		public StringSyntaxAttribute(string syntax)
		{
			Syntax = syntax;
			Arguments = Array.Empty<object>();
		}

		public StringSyntaxAttribute(string syntax, params object[] arguments)
		{
			Syntax = syntax;
			Arguments = arguments;
		}
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Constructor | AttributeTargets.Method, Inherited = false)]
	internal sealed class RequiresDynamicCodeAttribute : Attribute
	{
		public string Message { get; }

		public string Url { get; set; }

		public RequiresDynamicCodeAttribute(string message)
		{
			Message = message;
		}
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)]
	internal sealed class AllowNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)]
	internal sealed class DisallowNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)]
	internal sealed class MaybeNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)]
	internal sealed class NotNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class MaybeNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public MaybeNullWhenAttribute(bool returnValue)
		{
			ReturnValue = returnValue;
		}
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class NotNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public NotNullWhenAttribute(bool returnValue)
		{
			ReturnValue = returnValue;
		}
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = true, Inherited = false)]
	internal sealed class NotNullIfNotNullAttribute : Attribute
	{
		public string ParameterName { get; }

		public NotNullIfNotNullAttribute(string parameterName)
		{
			ParameterName = parameterName;
		}
	}
	[AttributeUsage(AttributeTargets.Method, Inherited = false)]
	internal sealed class DoesNotReturnAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class DoesNotReturnIfAttribute : Attribute
	{
		public bool ParameterValue { get; }

		public DoesNotReturnIfAttribute(bool parameterValue)
		{
			ParameterValue = parameterValue;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	internal sealed class MemberNotNullAttribute : Attribute
	{
		public string[] Members { get; }

		public MemberNotNullAttribute(string member)
		{
			Members = new string[1] { member };
		}

		public MemberNotNullAttribute(params string[] members)
		{
			Members = members;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	internal sealed class MemberNotNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public string[] Members { get; }

		public MemberNotNullWhenAttribute(bool returnValue, string member)
		{
			ReturnValue = returnValue;
			Members = new string[1] { member };
		}

		public MemberNotNullWhenAttribute(bool returnValue, params string[] members)
		{
			ReturnValue = returnValue;
			Members = members;
		}
	}
}
namespace System.Runtime.InteropServices
{
	[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
	internal sealed class LibraryImportAttribute : Attribute
	{
		public string LibraryName { get; }

		public string EntryPoint { get; set; }

		public StringMarshalling StringMarshalling { get; set; }

		public Type StringMarshallingCustomType { get; set; }

		public bool SetLastError { get; set; }

		public LibraryImportAttribute(string libraryName)
		{
			LibraryName = libraryName;
		}
	}
	internal enum StringMarshalling
	{
		Custom,
		Utf8,
		Utf16
	}
}
namespace System.Runtime.Versioning
{
	[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate, Inherited = false)]
	internal sealed class RequiresPreviewFeaturesAttribute : Attribute
	{
		public string Message { get; }

		public string Url { get; set; }

		public RequiresPreviewFeaturesAttribute()
		{
		}

		public RequiresPreviewFeaturesAttribute(string message)
		{
			Message = message;
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[EditorBrowsable(EditorBrowsableState.Never)]
	internal static class IsExternalInit
	{
	}
}
namespace System.Collections.Generic
{
	internal sealed class ReferenceEqualityComparer : IEqualityComparer<object>, IEqualityComparer
	{
		public static ReferenceEqualityComparer Instance { get; } = new ReferenceEqualityComparer();


		private ReferenceEqualityComparer()
		{
		}

		public new bool Equals(object x, object y)
		{
			return x == y;
		}

		public int GetHashCode(object obj)
		{
			return RuntimeHelpers.GetHashCode(obj);
		}
	}
	internal static class StackExtensions
	{
		public static bool TryPeek<T>(this Stack<T> stack, [MaybeNullWhen(false)] out T result)
		{
			if (stack.Count > 0)
			{
				result = stack.Peek();
				return true;
			}
			result = default(T);
			return false;
		}

		public static bool TryPop<T>(this Stack<T> stack, [MaybeNullWhen(false)] out T result)
		{
			if (stack.Count > 0)
			{
				result = stack.Pop();
				return true;
			}
			result = default(T);
			return false;
		}
	}
}
namespace System.Buffers
{
	internal sealed class ArrayBufferWriter<T> : IBufferWriter<T>
	{
		private const int ArrayMaxLength = 2147483591;

		private const int DefaultInitialBufferSize = 256;

		private T[] _buffer;

		private int _index;

		public ReadOnlyMemory<T> WrittenMemory => _buffer.AsMemory(0, _index);

		public ReadOnlySpan<T> WrittenSpan => _buffer.AsSpan(0, _index);

		public int WrittenCount => _index;

		public int Capacity => _buffer.Length;

		public int FreeCapacity => _buffer.Length - _index;

		public ArrayBufferWriter()
		{
			_buffer = Array.Empty<T>();
			_index = 0;
		}

		public ArrayBufferWriter(int initialCapacity)
		{
			if (initialCapacity <= 0)
			{
				throw new ArgumentException(null, "initialCapacity");
			}
			_buffer = new T[initialCapacity];
			_index = 0;
		}

		public void Clear()
		{
			_buffer.AsSpan(0, _index).Clear();
			_index = 0;
		}

		public void Advance(int count)
		{
			if (count < 0)
			{
				throw new ArgumentException(null, "count");
			}
			if (_index > _buffer.Length - count)
			{
				ThrowInvalidOperationException_AdvancedTooFar(_buffer.Length);
			}
			_index += count;
		}

		public Memory<T> GetMemory(int sizeHint = 0)
		{
			CheckAndResizeBuffer(sizeHint);
			return _buffer.AsMemory(_index);
		}

		public Span<T> GetSpan(int sizeHint = 0)
		{
			CheckAndResizeBuffer(sizeHint);
			return _buffer.AsSpan(_index);
		}

		private void CheckAndResizeBuffer(int sizeHint)
		{
			if (sizeHint < 0)
			{
				throw new ArgumentException("sizeHint");
			}
			if (sizeHint == 0)
			{
				sizeHint = 1;
			}
			if (sizeHint <= FreeCapacity)
			{
				return;
			}
			int num = _buffer.Length;
			int num2 = Math.Max(sizeHint, num);
			if (num == 0)
			{
				num2 = Math.Max(num2, 256);
			}
			int num3 = num + num2;
			if ((uint)num3 > 2147483647u)
			{
				uint num4 = (uint)(num - FreeCapacity + sizeHint);
				if (num4 > 2147483591)
				{
					ThrowOutOfMemoryException(num4);
				}
				num3 = 2147483591;
			}
			Array.Resize(ref _buffer, num3);
		}

		private static void ThrowInvalidOperationException_AdvancedTooFar(int capacity)
		{
			throw new InvalidOperationException(System.SR.Format(System.SR.BufferWriterAdvancedTooFar, capacity));
		}

		private static void ThrowOutOfMemoryException(uint capacity)
		{
			throw new OutOfMemoryException(System.SR.Format(System.SR.BufferMaximumSizeExceeded, capacity));
		}
	}
}
namespace System.Buffers.Text
{
	internal enum SequenceValidity
	{
		Empty,
		WellFormed,
		Incomplete,
		Invalid
	}
}
namespace System.Text.Json
{
	internal sealed class PooledByteBufferWriter : IBufferWriter<byte>, IDisposable
	{
		private byte[] _rentedBuffer;

		private int _index;

		private const int MinimumBufferSize = 256;

		public ReadOnlyMemory<byte> WrittenMemory => _rentedBuffer.AsMemory(0, _index);

		public int WrittenCount => _index;

		public int Capacity => _rentedBuffer.Length;

		public int FreeCapacity => _rentedBuffer.Length - _index;

		private PooledByteBufferWriter()
		{
		}

		public PooledByteBufferWriter(int initialCapacity)
		{
			_rentedBuffer = ArrayPool<byte>.Shared.Rent(initialCapacity);
			_index = 0;
		}

		public void Clear()
		{
			ClearHelper();
		}

		public void ClearAndReturnBuffers()
		{
			ClearHelper();
			byte[] rentedBuffer = _rentedBuffer;
			_rentedBuffer = null;
			ArrayPool<byte>.Shared.Return(rentedBuffer);
		}

		private void ClearHelper()
		{
			_rentedBuffer.AsSpan(0, _index).Clear();
			_index = 0;
		}

		public void Dispose()
		{
			if (_rentedBuffer != null)
			{
				ClearHelper();
				byte[] rentedBuffer = _rentedBuffer;
				_rentedBuffer = null;
				ArrayPool<byte>.Shared.Return(rentedBuffer);
			}
		}

		public void InitializeEmptyInstance(int initialCapacity)
		{
			_rentedBuffer = ArrayPool<byte>.Shared.Rent(initialCapacity);
			_index = 0;
		}

		public static PooledByteBufferWriter CreateEmptyInstanceForCaching()
		{
			return new PooledByteBufferWriter();
		}

		public void Advance(int count)
		{
			_index += count;
		}

		public Memory<byte> GetMemory(int sizeHint = 0)
		{
			CheckAndResizeBuffer(sizeHint);
			return _rentedBuffer.AsMemory(_index);
		}

		public Span<byte> GetSpan(int sizeHint = 0)
		{
			CheckAndResizeBuffer(sizeHint);
			return _rentedBuffer.AsSpan(_index);
		}

		internal Task WriteToStreamAsync(Stream destination, CancellationToken cancellationToken)
		{
			return destination.WriteAsync(_rentedBuffer, 0, _index, cancellationToken);
		}

		internal void WriteToStream(Stream destination)
		{
			destination.Write(_rentedBuffer, 0, _index);
		}

		private void CheckAndResizeBuffer(int sizeHint)
		{
			if (sizeHint == 0)
			{
				sizeHint = 256;
			}
			int num = _rentedBuffer.Length - _index;
			if (sizeHint <= num)
			{
				return;
			}
			int num2 = _rentedBuffer.Length;
			int num3 = Math.Max(sizeHint, num2);
			int num4 = num2 + num3;
			if ((uint)num4 > 2147483647u)
			{
				num4 = num2 + sizeHint;
				if ((uint)num4 > 2147483647u)
				{
					ThrowHelper.ThrowOutOfMemoryException_BufferMaximumSizeExceeded((uint)num4);
				}
			}
			byte[] rentedBuffer = _rentedBuffer;
			_rentedBuffer = ArrayPool<byte>.Shared.Rent(num4);
			Span<byte> span = rentedBuffer.AsSpan(0, _index);
			span.CopyTo(_rentedBuffer);
			span.Clear();
			ArrayPool<byte>.Shared.Return(rentedBuffer);
		}
	}
	internal static class ThrowHelper
	{
		public const string ExceptionSourceValueToRethrowAsJsonException = "System.Text.Json.Rethrowable";

		[MethodImpl(MethodImplOptions.NoInlining)]
		[DoesNotReturn]
		public static void ThrowOutOfMemoryException_BufferMaximumSizeExceeded(uint capacity)
		{
			throw new OutOfMemoryException(System.SR.Format(System.SR.BufferMaximumSizeExceeded, capacity));
		}

		[DoesNotReturn]
		public static void ThrowArgumentNullException(string parameterName)
		{
			throw new ArgumentNullException(parameterName);
		}

		[DoesNotReturn]
		public static void ThrowArgumentOutOfRangeException_MaxDepthMustBePositive(string parameterName)
		{
			throw GetArgumentOutOfRangeException(parameterName, System.SR.MaxDepthMustBePositive);
		}

		private static ArgumentOutOfRangeException GetArgumentOutOfRangeException(string parameterName, string message)
		{
			return new ArgumentOutOfRangeException(parameterName, message);
		}

		[DoesNotReturn]
		public static void ThrowArgumentOutOfRangeException_CommentEnumMustBeInRange(string parameterName)
		{
			throw GetArgumentOutOfRangeException(parameterName, System.SR.CommentHandlingMustBeValid);
		}

		[DoesNotReturn]
		public static void ThrowArgumentOutOfRangeException_ArrayIndexNegative(string paramName)
		{
			throw new ArgumentOutOfRangeException(paramName, System.SR.ArrayIndexNegative);
		}

		[DoesNotReturn]
		public static void ThrowArgumentException_ArrayTooSmall(string paramName)
		{
			throw new ArgumentException(System.SR.ArrayTooSmall, paramName);
		}

		private static ArgumentException GetArgumentException(string message)
		{
			return new ArgumentException(message);
		}

		[DoesNotReturn]
		public static void ThrowArgumentException(string message)
		{
			throw GetArgumentException(message);
		}

		public static InvalidOperationException GetInvalidOperationException_CallFlushFirst(int _buffered)
		{
			return GetInvalidOperationException(System.SR.Format(System.SR.CallFlushToAvoidDataLoss, _buffered));
		}

		[DoesNotReturn]
		public static void ThrowArgumentException_DestinationTooShort()
		{
			throw GetArgumentException(System.SR.DestinationTooShort);
		}

		[DoesNotReturn]
		public static void ThrowArgumentException_PropertyNameTooLarge(int tokenLength)
		{
			throw GetArgumentException(System.SR.Format(System.SR.PropertyNameTooLarge, tokenLength));
		}

		[DoesNotReturn]
		public static void ThrowArgumentException_ValueTooLarge(int tokenLength)
		{
			throw GetArgumentException(System.SR.Format(System.SR.ValueTooLarge, tokenLength));
		}

		[DoesNotReturn]
		public static void ThrowArgumentException_ValueNotSupported()
		{
			throw GetArgumentException(System.SR.SpecialNumberValuesNotSupported);
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_NeedLargerSpan()
		{
			throw GetInvalidOperationException(System.SR.FailedToGetLargerSpan);
		}

		[DoesNotReturn]
		public static void ThrowArgumentException(ReadOnlySpan<byte> propertyName, ReadOnlySpan<byte> value)
		{
			if (propertyName.Length > 166666666)
			{
				ThrowArgumentException(System.SR.Format(System.SR.PropertyNameTooLarge, propertyName.Length));
			}
			else
			{
				ThrowArgumentException(System.SR.Format(System.SR.ValueTooLarge, value.Length));
			}
		}

		[DoesNotReturn]
		public static void ThrowArgumentException(ReadOnlySpan<byte> propertyName, ReadOnlySpan<char> value)
		{
			if (propertyName.Length > 166666666)
			{
				ThrowArgumentException(System.SR.Format(System.SR.PropertyNameTooLarge, propertyName.Length));
			}
			else
			{
				ThrowArgumentException(System.SR.Format(System.SR.ValueTooLarge, value.Length));
			}
		}

		[DoesNotReturn]
		public static void ThrowArgumentException(ReadOnlySpan<char> propertyName, ReadOnlySpan<byte> value)
		{
			if (propertyName.Length > 166666666)
			{
				ThrowArgumentException(System.SR.Format(System.SR.PropertyNameTooLarge, propertyName.Length));
			}
			else
			{
				ThrowArgumentException(System.SR.Format(System.SR.ValueTooLarge, value.Length));
			}
		}

		[DoesNotReturn]
		public static void ThrowArgumentException(ReadOnlySpan<char> propertyName, ReadOnlySpan<char> value)
		{
			if (propertyName.Length > 166666666)
			{
				ThrowArgumentException(System.SR.Format(System.SR.PropertyNameTooLarge, propertyName.Length));
			}
			else
			{
				ThrowArgumentException(System.SR.Format(System.SR.ValueTooLarge, value.Length));
			}
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationOrArgumentException(ReadOnlySpan<byte> propertyName, int currentDepth, int maxDepth)
		{
			currentDepth &= 0x7FFFFFFF;
			if (currentDepth >= maxDepth)
			{
				ThrowInvalidOperationException(System.SR.Format(System.SR.DepthTooLarge, currentDepth, maxDepth));
			}
			else
			{
				ThrowArgumentException(System.SR.Format(System.SR.PropertyNameTooLarge, propertyName.Length));
			}
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException(int currentDepth, int maxDepth)
		{
			currentDepth &= 0x7FFFFFFF;
			ThrowInvalidOperationException(System.SR.Format(System.SR.DepthTooLarge, currentDepth, maxDepth));
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException(string message)
		{
			throw GetInvalidOperationException(message);
		}

		private static InvalidOperationException GetInvalidOperationException(string message)
		{
			return new InvalidOperationException(message)
			{
				Source = "System.Text.Json.Rethrowable"
			};
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_DepthNonZeroOrEmptyJson(int currentDepth)
		{
			throw GetInvalidOperationException(currentDepth);
		}

		private static InvalidOperationException GetInvalidOperationException(int currentDepth)
		{
			currentDepth &= 0x7FFFFFFF;
			if (currentDepth != 0)
			{
				return GetInvalidOperationException(System.SR.Format(System.SR.ZeroDepthAtEnd, currentDepth));
			}
			return GetInvalidOperationException(System.SR.EmptyJsonIsInvalid);
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationOrArgumentException(ReadOnlySpan<char> propertyName, int currentDepth, int maxDepth)
		{
			currentDepth &= 0x7FFFFFFF;
			if (currentDepth >= maxDepth)
			{
				ThrowInvalidOperationException(System.SR.Format(System.SR.DepthTooLarge, currentDepth, maxDepth));
			}
			else
			{
				ThrowArgumentException(System.SR.Format(System.SR.PropertyNameTooLarge, propertyName.Length));
			}
		}

		public static InvalidOperationException GetInvalidOperationException_ExpectedArray(JsonTokenType tokenType)
		{
			return GetInvalidOperationException("array", tokenType);
		}

		public static InvalidOperationException GetInvalidOperationException_ExpectedObject(JsonTokenType tokenType)
		{
			return GetInvalidOperationException("object", tokenType);
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_ExpectedNumber(JsonTokenType tokenType)
		{
			throw GetInvalidOperationException("number", tokenType);
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_ExpectedBoolean(JsonTokenType tokenType)
		{
			throw GetInvalidOperationException("boolean", tokenType);
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_ExpectedString(JsonTokenType tokenType)
		{
			throw GetInvalidOperationException("string", tokenType);
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_ExpectedStringComparison(JsonTokenType tokenType)
		{
			throw GetInvalidOperationException(tokenType);
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_ExpectedComment(JsonTokenType tokenType)
		{
			throw GetInvalidOperationException("comment", tokenType);
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_CannotSkipOnPartial()
		{
			throw GetInvalidOperationException(System.SR.CannotSkip);
		}

		private static InvalidOperationException GetInvalidOperationException(string message, JsonTokenType tokenType)
		{
			return GetInvalidOperationException(System.SR.Format(System.SR.InvalidCast, tokenType, message));
		}

		private static InvalidOperationException GetInvalidOperationException(JsonTokenType tokenType)
		{
			return GetInvalidOperationException(System.SR.Format(System.SR.InvalidComparison, tokenType));
		}

		[DoesNotReturn]
		internal static void ThrowJsonElementWrongTypeException(JsonTokenType expectedType, JsonTokenType actualType)
		{
			throw GetJsonElementWrongTypeException(expectedType.ToValueKind(), actualType.ToValueKind());
		}

		internal static InvalidOperationException GetJsonElementWrongTypeException(JsonValueKind expectedType, JsonValueKind actualType)
		{
			return GetInvalidOperationException(System.SR.Format(System.SR.JsonElementHasWrongType, expectedType, actualType));
		}

		internal static InvalidOperationException GetJsonElementWrongTypeException(string expectedTypeName, JsonValueKind actualType)
		{
			return GetInvalidOperationException(System.SR.Format(System.SR.JsonElementHasWrongType, expectedTypeName, actualType));
		}

		[DoesNotReturn]
		public static void ThrowJsonReaderException(ref Utf8JsonReader json, ExceptionResource resource, byte nextByte = 0, ReadOnlySpan<byte> bytes = default(ReadOnlySpan<byte>))
		{
			throw GetJsonReaderException(ref json, resource, nextByte, bytes);
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		public static JsonException GetJsonReaderException(ref Utf8JsonReader json, ExceptionResource resource, byte nextByte, ReadOnlySpan<byte> bytes)
		{
			string resourceString = GetResourceString(ref json, resource, nextByte, JsonHelpers.Utf8GetString(bytes));
			long lineNumber = json.CurrentState._lineNumber;
			long bytePositionInLine = json.CurrentState._bytePositionInLine;
			resourceString += $" LineNumber: {lineNumber} | BytePositionInLine: {bytePositionInLine}.";
			return new JsonReaderException(resourceString, lineNumber, bytePositionInLine);
		}

		private static bool IsPrintable(byte value)
		{
			if (value >= 32)
			{
				return value < 127;
			}
			return false;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		internal static string GetPrintableString(byte value)
		{
			if (!IsPrintable(value))
			{
				return $"0x{value:X2}";
			}
			char c = (char)value;
			return c.ToString();
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		private static string GetResourceString(ref Utf8JsonReader json, ExceptionResource resource, byte nextByte, string characters)
		{
			string printableString = GetPrintableString(nextByte);
			string result = "";
			switch (resource)
			{
			case ExceptionResource.ArrayDepthTooLarge:
				result = System.SR.Format(System.SR.ArrayDepthTooLarge, json.CurrentState.Options.MaxDepth);
				break;
			case ExceptionResource.MismatchedObjectArray:
				result = System.SR.Format(System.SR.MismatchedObjectArray, printableString);
				break;
			case ExceptionResource.TrailingCommaNotAllowedBeforeArrayEnd:
				result = System.SR.TrailingCommaNotAllowedBeforeArrayEnd;
				break;
			case ExceptionResource.TrailingCommaNotAllowedBeforeObjectEnd:
				result = System.SR.TrailingCommaNotAllowedBeforeObjectEnd;
				break;
			case ExceptionResource.EndOfStringNotFound:
				result = System.SR.EndOfStringNotFound;
				break;
			case ExceptionResource.RequiredDigitNotFoundAfterSign:
				result = System.SR.Format(System.SR.RequiredDigitNotFoundAfterSign, printableString);
				break;
			case ExceptionResource.RequiredDigitNotFoundAfterDecimal:
				result = System.SR.Format(System.SR.RequiredDigitNotFoundAfterDecimal, printableString);
				break;
			case ExceptionResource.RequiredDigitNotFoundEndOfData:
				result = System.SR.RequiredDigitNotFoundEndOfData;
				break;
			case ExceptionResource.ExpectedEndAfterSingleJson:
				result = System.SR.Format(System.SR.ExpectedEndAfterSingleJson, printableString);
				break;
			case ExceptionResource.ExpectedEndOfDigitNotFound:
				result = System.SR.Format(System.SR.ExpectedEndOfDigitNotFound, printableString);
				break;
			case ExceptionResource.ExpectedNextDigitEValueNotFound:
				result = System.SR.Format(System.SR.ExpectedNextDigitEValueNotFound, printableString);
				break;
			case ExceptionResource.ExpectedSeparatorAfterPropertyNameNotFound:
				result = System.SR.Format(System.SR.ExpectedSeparatorAfterPropertyNameNotFound, printableString);
				break;
			case ExceptionResource.ExpectedStartOfPropertyNotFound:
				result = System.SR.Format(System.SR.ExpectedStartOfPropertyNotFound, printableString);
				break;
			case ExceptionResource.ExpectedStartOfPropertyOrValueNotFound:
				result = System.SR.ExpectedStartOfPropertyOrValueNotFound;
				break;
			case ExceptionResource.ExpectedStartOfPropertyOrValueAfterComment:
				result = System.SR.Format(System.SR.ExpectedStartOfPropertyOrValueAfterComment, printableString);
				break;
			case ExceptionResource.ExpectedStartOfValueNotFound:
				result = System.SR.Format(System.SR.ExpectedStartOfValueNotFound, printableString);
				break;
			case ExceptionResource.ExpectedValueAfterPropertyNameNotFound:
				result = System.SR.ExpectedValueAfterPropertyNameNotFound;
				break;
			case ExceptionResource.FoundInvalidCharacter:
				result = System.SR.Format(System.SR.FoundInvalidCharacter, printableString);
				break;
			case ExceptionResource.InvalidEndOfJsonNonPrimitive:
				result = System.SR.Format(System.SR.InvalidEndOfJsonNonPrimitive, json.TokenType);
				break;
			case ExceptionResource.ObjectDepthTooLarge:
				result = System.SR.Format(System.SR.ObjectDepthTooLarge, json.CurrentState.Options.MaxDepth);
				break;
			case ExceptionResource.ExpectedFalse:
				result = System.SR.Format(System.SR.ExpectedFalse, characters);
				break;
			case ExceptionResource.ExpectedNull:
				result = System.SR.Format(System.SR.ExpectedNull, characters);
				break;
			case ExceptionResource.ExpectedTrue:
				result = System.SR.Format(System.SR.ExpectedTrue, characters);
				break;
			case ExceptionResource.InvalidCharacterWithinString:
				result = System.SR.Format(System.SR.InvalidCharacterWithinString, printableString);
				break;
			case ExceptionResource.InvalidCharacterAfterEscapeWithinString:
				result = System.SR.Format(System.SR.InvalidCharacterAfterEscapeWithinString, printableString);
				break;
			case ExceptionResource.InvalidHexCharacterWithinString:
				result = System.SR.Format(System.SR.InvalidHexCharacterWithinString, printableString);
				break;
			case ExceptionResource.EndOfCommentNotFound:
				result = System.SR.EndOfCommentNotFound;
				break;
			case ExceptionResource.ZeroDepthAtEnd:
				result = System.SR.Format(System.SR.ZeroDepthAtEnd);
				break;
			case ExceptionResource.ExpectedJsonTokens:
				result = System.SR.ExpectedJsonTokens;
				break;
			case ExceptionResource.NotEnoughData:
				result = System.SR.NotEnoughData;
				break;
			case ExceptionResource.ExpectedOneCompleteToken:
				result = System.SR.ExpectedOneCompleteToken;
				break;
			case ExceptionResource.InvalidCharacterAtStartOfComment:
				result = System.SR.Format(System.SR.InvalidCharacterAtStartOfComment, printableString);
				break;
			case ExceptionResource.UnexpectedEndOfDataWhileReadingComment:
				result = System.SR.Format(System.SR.UnexpectedEndOfDataWhileReadingComment);
				break;
			case ExceptionResource.UnexpectedEndOfLineSeparator:
				result = System.SR.Format(System.SR.UnexpectedEndOfLineSeparator);
				break;
			case ExceptionResource.InvalidLeadingZeroInNumber:
				result = System.SR.Format(System.SR.InvalidLeadingZeroInNumber, printableString);
				break;
			}
			return result;
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException(ExceptionResource resource, int currentDepth, int maxDepth, byte token, JsonTokenType tokenType)
		{
			throw GetInvalidOperationException(resource, currentDepth, maxDepth, token, tokenType);
		}

		[DoesNotReturn]
		public static void ThrowArgumentException_InvalidCommentValue()
		{
			throw new ArgumentException(System.SR.CannotWriteCommentWithEmbeddedDelimiter);
		}

		[DoesNotReturn]
		public static void ThrowArgumentException_InvalidUTF8(ReadOnlySpan<byte> value)
		{
			StringBuilder stringBuilder = new StringBuilder();
			int num = Math.Min(value.Length, 10);
			for (int i = 0; i < num; i++)
			{
				byte b = value[i];
				if (IsPrintable(b))
				{
					stringBuilder.Append((char)b);
				}
				else
				{
					stringBuilder.Append($"0x{b:X2}");
				}
			}
			if (num < value.Length)
			{
				stringBuilder.Append("...");
			}
			throw new ArgumentException(System.SR.Format(System.SR.CannotEncodeInvalidUTF8, stringBuilder));
		}

		[DoesNotReturn]
		public static void ThrowArgumentException_InvalidUTF16(int charAsInt)
		{
			throw new ArgumentException(System.SR.Format(System.SR.CannotEncodeInvalidUTF16, $"0x{charAsInt:X2}"));
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_ReadInvalidUTF16(int charAsInt)
		{
			throw GetInvalidOperationException(System.SR.Format(System.SR.CannotReadInvalidUTF16, $"0x{charAsInt:X2}"));
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_ReadIncompleteUTF16()
		{
			throw GetInvalidOperationException(System.SR.CannotReadIncompleteUTF16);
		}

		public static InvalidOperationException GetInvalidOperationException_ReadInvalidUTF8(DecoderFallbackException innerException)
		{
			return GetInvalidOperationException(System.SR.CannotTranscodeInvalidUtf8, innerException);
		}

		public static ArgumentException GetArgumentException_ReadInvalidUTF16(EncoderFallbackException innerException)
		{
			return new ArgumentException(System.SR.CannotTranscodeInvalidUtf16, innerException);
		}

		public static InvalidOperationException GetInvalidOperationException(string message, Exception innerException)
		{
			InvalidOperationException ex = new InvalidOperationException(message, innerException);
			ex.Source = "System.Text.Json.Rethrowable";
			return ex;
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		public static InvalidOperationException GetInvalidOperationException(ExceptionResource resource, int currentDepth, int maxDepth, byte token, JsonTokenType tokenType)
		{
			string resourceString = GetResourceString(resource, currentDepth, maxDepth, token, tokenType);
			InvalidOperationException invalidOperationException = GetInvalidOperationException(resourceString);
			invalidOperationException.Source = "System.Text.Json.Rethrowable";
			return invalidOperationException;
		}

		[DoesNotReturn]
		public static void ThrowOutOfMemoryException(uint capacity)
		{
			throw new OutOfMemoryException(System.SR.Format(System.SR.BufferMaximumSizeExceeded, capacity));
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		private static string GetResourceString(ExceptionResource resource, int currentDepth, int maxDepth, byte token, JsonTokenType tokenType)
		{
			string result = "";
			switch (resource)
			{
			case ExceptionResource.MismatchedObjectArray:
				result = ((tokenType == JsonTokenType.PropertyName) ? System.SR.Format(System.SR.CannotWriteEndAfterProperty, (char)token) : System.SR.Format(System.SR.MismatchedObjectArray, (char)token));
				break;
			case ExceptionResource.DepthTooLarge:
				result = System.SR.Format(System.SR.DepthTooLarge, currentDepth & 0x7FFFFFFF, maxDepth);
				break;
			case ExceptionResource.CannotStartObjectArrayWithoutProperty:
				result = System.SR.Format(System.SR.CannotStartObjectArrayWithoutProperty, tokenType);
				break;
			case ExceptionResource.CannotStartObjectArrayAfterPrimitiveOrClose:
				result = System.SR.Format(System.SR.CannotStartObjectArrayAfterPrimitiveOrClose, tokenType);
				break;
			case ExceptionResource.CannotWriteValueWithinObject:
				result = System.SR.Format(System.SR.CannotWriteValueWithinObject, tokenType);
				break;
			case ExceptionResource.CannotWritePropertyWithinArray:
				result = ((tokenType == JsonTokenType.PropertyName) ? System.SR.Format(System.SR.CannotWritePropertyAfterProperty) : System.SR.Format(System.SR.CannotWritePropertyWithinArray, tokenType));
				break;
			case ExceptionResource.CannotWriteValueAfterPrimitiveOrClose:
				result = System.SR.Format(System.SR.CannotWriteValueAfterPrimitiveOrClose, tokenType);
				break;
			}
			return result;
		}

		[DoesNotReturn]
		public static void ThrowFormatException()
		{
			throw new FormatException
			{
				Source = "System.Text.Json.Rethrowable"
			};
		}

		public static void ThrowFormatException(NumericType numericType)
		{
			string message = "";
			switch (numericType)
			{
			case NumericType.Byte:
				message = System.SR.FormatByte;
				break;
			case NumericType.SByte:
				message = System.SR.FormatSByte;
				break;
			case NumericType.Int16:
				message = System.SR.FormatInt16;
				break;
			case NumericType.Int32:
				message = System.SR.FormatInt32;
				break;
			case NumericType.Int64:
				message = System.SR.FormatInt64;
				break;
			case NumericType.UInt16:
				message = System.SR.FormatUInt16;
				break;
			case NumericType.UInt32:
				message = System.SR.FormatUInt32;
				break;
			case NumericType.UInt64:
				message = System.SR.FormatUInt64;
				break;
			case NumericType.Single:
				message = System.SR.FormatSingle;
				break;
			case NumericType.Double:
				message = System.SR.FormatDouble;
				break;
			case NumericType.Decimal:
				message = System.SR.FormatDecimal;
				break;
			}
			throw new FormatException(message)
			{
				Source = "System.Text.Json.Rethrowable"
			};
		}

		[DoesNotReturn]
		public static void ThrowFormatException(DataType dataType)
		{
			string message = "";
			switch (dataType)
			{
			case DataType.Boolean:
			case DataType.DateOnly:
			case DataType.DateTime:
			case DataType.DateTimeOffset:
			case DataType.TimeOnly:
			case DataType.TimeSpan:
			case DataType.Guid:
			case DataType.Version:
				message = System.SR.Format(System.SR.UnsupportedFormat, dataType);
				break;
			case DataType.Base64String:
				message = System.SR.CannotDecodeInvalidBase64;
				break;
			}
			throw new FormatException(message)
			{
				Source = "System.Text.Json.Rethrowable"
			};
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_ExpectedChar(JsonTokenType tokenType)
		{
			throw GetInvalidOperationException("char", tokenType);
		}

		[DoesNotReturn]
		public static void ThrowObjectDisposedException_Utf8JsonWriter()
		{
			throw new ObjectDisposedException("Utf8JsonWriter");
		}

		[DoesNotReturn]
		public static void ThrowObjectDisposedException_JsonDocument()
		{
			throw new ObjectDisposedException("JsonDocument");
		}

		[DoesNotReturn]
		public static void ThrowArgumentException_NodeValueNotAllowed(string paramName)
		{
			throw new ArgumentException(System.SR.NodeValueNotAllowed, paramName);
		}

		[DoesNotReturn]
		public static void ThrowArgumentException_DuplicateKey(string paramName, string propertyName)
		{
			throw new ArgumentException(System.SR.Format(System.SR.NodeDuplicateKey, propertyName), paramName);
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_NodeAlreadyHasParent()
		{
			throw new InvalidOperationException(System.SR.NodeAlreadyHasParent);
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_NodeCycleDetected()
		{
			throw new InvalidOperationException(System.SR.NodeCycleDetected);
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_NodeElementCannotBeObjectOrArray()
		{
			throw new InvalidOperationException(System.SR.NodeElementCannotBeObjectOrArray);
		}

		[DoesNotReturn]
		public static void ThrowNotSupportedException_CollectionIsReadOnly()
		{
			throw GetNotSupportedException_CollectionIsReadOnly();
		}

		public static NotSupportedException GetNotSupportedException_CollectionIsReadOnly()
		{
			return new NotSupportedException(System.SR.CollectionIsReadOnly);
		}

		[DoesNotReturn]
		public static void ThrowArgumentException_DeserializeWrongType(Type type, object value)
		{
			throw new ArgumentException(System.SR.Format(System.SR.DeserializeWrongType, type, value.GetType()));
		}

		[DoesNotReturn]
		public static void ThrowArgumentException_SerializerDoesNotSupportComments(string paramName)
		{
			throw new ArgumentException(System.SR.JsonSerializerDoesNotSupportComments, paramName);
		}

		[DoesNotReturn]
		public static void ThrowNotSupportedException_SerializationNotSupported(Type propertyType)
		{
			throw new NotSupportedException(System.SR.Format(System.SR.SerializationNotSupportedType, propertyType));
		}

		[DoesNotReturn]
		public static void ThrowNotSupportedException_TypeRequiresAsyncSerialization(Type propertyType)
		{
			throw new NotSupportedException(System.SR.Format(System.SR.TypeRequiresAsyncSerialization, propertyType));
		}

		[DoesNotReturn]
		public static void ThrowNotSupportedException_ConstructorMaxOf64Parameters(Type type)
		{
			throw new NotSupportedException(System.SR.Format(System.SR.ConstructorMaxOf64Parameters, type));
		}

		[DoesNotReturn]
		public static void ThrowNotSupportedException_DictionaryKeyTypeNotSupported(Type keyType, JsonConverter converter)
		{
			throw new NotSupportedException(System.SR.Format(System.SR.DictionaryKeyTypeNotSupported, keyType, converter.GetType()));
		}

		[DoesNotReturn]
		public static void ThrowJsonException_DeserializeUnableToConvertValue(Type propertyType)
		{
			throw new JsonException(System.SR.Format(System.SR.DeserializeUnableToConvertValue, propertyType))
			{
				AppendPathInformation = true
			};
		}

		[DoesNotReturn]
		public static void ThrowInvalidCastException_DeserializeUnableToAssignValue(Type typeOfValue, Type declaredType)
		{
			throw new InvalidCastException(System.SR.Format(System.SR.DeserializeUnableToAssignValue, typeOfValue, declaredType));
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_DeserializeUnableToAssignNull(Type declaredType)
		{
			throw new InvalidOperationException(System.SR.Format(System.SR.DeserializeUnableToAssignNull, declaredType));
		}

		[DoesNotReturn]
		public static void ThrowJsonException_SerializationConverterRead(JsonConverter converter)
		{
			throw new JsonException(System.SR.Format(System.SR.SerializationConverterRead, converter))
			{
				AppendPathInformation = true
			};
		}

		[DoesNotReturn]
		public static void ThrowJsonException_SerializationConverterWrite(JsonConverter converter)
		{
			throw new JsonException(System.SR.Format(System.SR.SerializationConverterWrite, converter))
			{
				AppendPathInformation = true
			};
		}

		[DoesNotReturn]
		public static void ThrowJsonException_SerializerCycleDetected(int maxDepth)
		{
			throw new JsonException(System.SR.Format(System.SR.SerializerCycleDetected, maxDepth))
			{
				AppendPathInformation = true
			};
		}

		[DoesNotReturn]
		public static void ThrowJsonException(string message = null)
		{
			throw new JsonException(message)
			{
				AppendPathInformation = true
			};
		}

		[DoesNotReturn]
		public static void ThrowArgumentException_CannotSerializeInvalidType(string paramName, Type typeToConvert, Type declaringType, string propertyName)
		{
			if (declaringType == null)
			{
				throw new ArgumentException(System.SR.Format(System.SR.CannotSerializeInvalidType, typeToConvert), paramName);
			}
			throw new ArgumentException(System.SR.Format(System.SR.CannotSerializeInvalidMember, typeToConvert, propertyName, declaringType), paramName);
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_CannotSerializeInvalidType(Type typeToConvert, Type declaringType, MemberInfo memberInfo)
		{
			if (declaringType == null)
			{
				throw new InvalidOperationException(System.SR.Format(System.SR.CannotSerializeInvalidType, typeToConvert));
			}
			throw new InvalidOperationException(System.SR.Format(System.SR.CannotSerializeInvalidMember, typeToConvert, memberInfo.Name, declaringType));
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_SerializationConverterNotCompatible(Type converterType, Type type)
		{
			throw new InvalidOperationException(System.SR.Format(System.SR.SerializationConverterNotCompatible, converterType, type));
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_ResolverTypeNotCompatible(Type requestedType, Type actualType)
		{
			throw new InvalidOperationException(System.SR.Format(System.SR.ResolverTypeNotCompatible, actualType, requestedType));
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_ResolverTypeInfoOptionsNotCompatible()
		{
			throw new InvalidOperationException(System.SR.ResolverTypeInfoOptionsNotCompatible);
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_JsonTypeInfoUsedButTypeInfoResolverNotSet()
		{
			throw new InvalidOperationException(System.SR.JsonTypeInfoUsedButTypeInfoResolverNotSet);
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_SerializationConverterOnAttributeInvalid(Type classType, MemberInfo memberInfo)
		{
			string text = classType.ToString();
			if (memberInfo != null)
			{
				text = text + "." + memberInfo.Name;
			}
			throw new InvalidOperationException(System.SR.Format(System.SR.SerializationConverterOnAttributeInvalid, text));
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_SerializationConverterOnAttributeNotCompatible(Type classTypeAttributeIsOn, MemberInfo memberInfo, Type typeToConvert)
		{
			string text = classTypeAttributeIsOn.ToString();
			if (memberInfo != null)
			{
				text = text + "." + memberInfo.Name;
			}
			throw new InvalidOperationException(System.SR.Format(System.SR.SerializationConverterOnAttributeNotCompatible, text, typeToConvert));
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_SerializerOptionsImmutable(JsonSerializerContext context)
		{
			string message = ((context == null) ? System.SR.SerializerOptionsImmutable : System.SR.SerializerContextOptionsImmutable);
			throw new InvalidOperationException(message);
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_TypeInfoResolverImmutable()
		{
			throw new InvalidOperationException(System.SR.TypeInfoResolverImmutable);
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_TypeInfoImmutable()
		{
			throw new InvalidOperationException(System.SR.TypeInfoImmutable);
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_PropertyInfoImmutable()
		{
			throw new InvalidOperationException(System.SR.PropertyInfoImmutable);
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_SerializerPropertyNameConflict(Type type, string propertyName)
		{
			throw new InvalidOperationException(System.SR.Format(System.SR.SerializerPropertyNameConflict, type, propertyName));
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_SerializerPropertyNameNull(JsonPropertyInfo jsonPropertyInfo)
		{
			throw new InvalidOperationException(System.SR.Format(System.SR.SerializerPropertyNameNull, jsonPropertyInfo.DeclaringType, jsonPropertyInfo.MemberName));
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_JsonPropertyRequiredAndNotDeserializable(JsonPropertyInfo jsonPropertyInfo)
		{
			throw new InvalidOperationException(System.SR.Format(System.SR.JsonPropertyRequiredAndNotDeserializable, jsonPropertyInfo.Name, jsonPropertyInfo.DeclaringType));
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_JsonPropertyRequiredAndExtensionData(JsonPropertyInfo jsonPropertyInfo)
		{
			throw new InvalidOperationException(System.SR.Format(System.SR.JsonPropertyRequiredAndExtensionData, jsonPropertyInfo.Name, jsonPropertyInfo.DeclaringType));
		}

		[DoesNotReturn]
		public static void ThrowJsonException_JsonRequiredPropertyMissing(JsonTypeInfo parent, BitArray requiredPropertiesSet)
		{
			StringBuilder stringBuilder = new StringBuilder();
			bool flag = true;
			for (int i = 0; i < parent.PropertyCache.List.Count; i++)
			{
				JsonPropertyInfo value = parent.PropertyCache.List[i].Value;
				if (value.IsRequired && !requiredPropertiesSet[value.RequiredPropertyIndex])
				{
					if (!flag)
					{
						stringBuilder.Append(CultureInfo.CurrentUICulture.TextInfo.ListSeparator);
						stringBuilder.Append(' ');
					}
					stringBuilder.Append(value.Name);
					flag = false;
					if (stringBuilder.Length >= 50)
					{
						break;
					}
				}
			}
			throw new JsonException(System.SR.Format(System.SR.JsonRequiredPropertiesMissing, parent.Type, stringBuilder.ToString()));
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_NamingPolicyReturnNull(JsonNamingPolicy namingPolicy)
		{
			throw new InvalidOperationException(System.SR.Format(System.SR.NamingPolicyReturnNull, namingPolicy));
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_SerializerConverterFactoryReturnsNull(Type converterType)
		{
			throw new InvalidOperationException(System.SR.Format(System.SR.SerializerConverterFactoryReturnsNull, converterType));
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_SerializerConverterFactoryReturnsJsonConverterFactorty(Type converterType)
		{
			throw new InvalidOperationException(System.SR.Format(System.SR.SerializerConverterFactoryReturnsJsonConverterFactory, converterType));
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_MultiplePropertiesBindToConstructorParameters(Type parentType, string parameterName, string firstMatchName, string secondMatchName)
		{
			throw new InvalidOperationException(System.SR.Format(System.SR.MultipleMembersBindWithConstructorParameter, firstMatchName, secondMatchName, parentType, parameterName));
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_ConstructorParameterIncompleteBinding(Type parentType)
		{
			throw new InvalidOperationException(System.SR.Format(System.SR.ConstructorParamIncompleteBinding, parentType));
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_ExtensionDataCannotBindToCtorParam(string propertyName, JsonPropertyInfo jsonPropertyInfo)
		{
			throw new InvalidOperationException(System.SR.Format(System.SR.ExtensionDataCannotBindToCtorParam, propertyName, jsonPropertyInfo.DeclaringType));
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_JsonIncludeOnNonPublicInvalid(string memberName, Type declaringType)
		{
			throw new InvalidOperationException(System.SR.Format(System.SR.JsonIncludeOnNonPublicInvalid, memberName, declaringType));
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_IgnoreConditionOnValueTypeInvalid(string clrPropertyName, Type propertyDeclaringType)
		{
			throw new InvalidOperationException(System.SR.Format(System.SR.IgnoreConditionOnValueTypeInvalid, clrPropertyName, propertyDeclaringType));
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_NumberHandlingOnPropertyInvalid(JsonPropertyInfo jsonPropertyInfo)
		{
			throw new InvalidOperationException(System.SR.Format(System.SR.NumberHandlingOnPropertyInvalid, jsonPropertyInfo.MemberName, jsonPropertyInfo.DeclaringType));
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_ConverterCanConvertMultipleTypes(Type runtimePropertyType, JsonConverter jsonConverter)
		{
			throw new InvalidOperationException(System.SR.Format(System.SR.ConverterCanConvertMultipleTypes, jsonConverter.GetType(), jsonConverter.TypeToConvert, runtimePropertyType));
		}

		[DoesNotReturn]
		public static void ThrowNotSupportedException_ObjectWithParameterizedCtorRefMetadataNotSupported(ReadOnlySpan<byte> propertyName, ref Utf8JsonReader reader, scoped ref ReadStack state)
		{
			JsonTypeInfo topJsonTypeInfoWithParameterizedConstructor = state.GetTopJsonTypeInfoWithParameterizedConstructor();
			state.Current.JsonPropertyName = propertyName.ToArray();
			NotSupportedException ex = new NotSupportedException(System.SR.Format(System.SR.ObjectWithParameterizedCtorRefMetadataNotSupported, topJsonTypeInfoWithParameterizedConstructor.Type));
			ThrowNotSupportedException(ref state, in reader, ex);
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_JsonTypeInfoOperationNotPossibleForKind(JsonTypeInfoKind kind)
		{
			throw new InvalidOperationException(System.SR.Format(System.SR.InvalidJsonTypeInfoOperationForKind, kind));
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_CreateObjectConverterNotCompatible(Type type)
		{
			throw new InvalidOperationException(System.SR.Format(System.SR.CreateObjectConverterNotCompatible, type));
		}

		[DoesNotReturn]
		public static void ReThrowWithPath(scoped ref ReadStack state, JsonReaderException ex)
		{
			string text = state.JsonPath();
			string message = ex.Message;
			int num = message.LastIndexOf(" LineNumber: ", StringComparison.InvariantCulture);
			message = ((num < 0) ? (message + " Path: " + text + ".") : (message.Substring(0, num) + " Path: " + text + " |" + message.Substring(num)));
			throw new JsonException(message, text, ex.LineNumber, ex.BytePositionInLine, ex);
		}

		[DoesNotReturn]
		public static void ReThrowWithPath(scoped ref ReadStack state, in Utf8JsonReader reader, Exception ex)
		{
			JsonException ex2 = new JsonException(null, ex);
			AddJsonExceptionInformation(ref state, in reader, ex2);
			throw ex2;
		}

		public static void AddJsonExceptionInformation(scoped ref ReadStack state, in Utf8JsonReader reader, JsonException ex)
		{
			long lineNumber = reader.CurrentState._lineNumber;
			ex.LineNumber = lineNumber;
			long bytePositionInLine = reader.CurrentState._bytePositionInLine;
			ex.BytePositionInLine = bytePositionInLine;
			string arg = (ex.Path = state.JsonPath());
			string text2 = ex._message;
			if (string.IsNullOrEmpty(text2))
			{
				Type p = state.Current.JsonPropertyInfo?.PropertyType ?? state.Current.JsonTypeInfo.Type;
				text2 = System.SR.Format(System.SR.DeserializeUnableToConvertValue, p);
				ex.AppendPathInformation = true;
			}
			if (ex.AppendPathInformation)
			{
				text2 += $" Path: {arg} | LineNumber: {lineNumber} | BytePositionInLine: {bytePositionInLine}.";
				ex.SetMessage(text2);
			}
		}

		[DoesNotReturn]
		public static void ReThrowWithPath(ref WriteStack state, Exception ex)
		{
			JsonException ex2 = new JsonException(null, ex);
			AddJsonExceptionInformation(ref state, ex2);
			throw ex2;
		}

		public static void AddJsonExceptionInformation(ref WriteStack state, JsonException ex)
		{
			string text2 = (ex.Path = state.PropertyPath());
			string text3 = ex._message;
			if (string.IsNullOrEmpty(text3))
			{
				text3 = System.SR.Format(System.SR.SerializeUnableToSerialize);
				ex.AppendPathInformation = true;
			}
			if (ex.AppendPathInformation)
			{
				text3 = text3 + " Path: " + text2 + ".";
				ex.SetMessage(text3);
			}
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_SerializationDuplicateAttribute(Type attribute, MemberInfo memberInfo)
		{
			string p = ((memberInfo is Type type) ? type.ToString() : $"{memberInfo.DeclaringType}.{memberInfo.Name}");
			throw new InvalidOperationException(System.SR.Format(System.SR.SerializationDuplicateAttribute, attribute, p));
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_SerializationDuplicateTypeAttribute(Type classType, Type attribute)
		{
			throw new InvalidOperationException(System.SR.Format(System.SR.SerializationDuplicateTypeAttribute, classType, attribute));
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_SerializationDuplicateTypeAttribute<TAttribute>(Type classType)
		{
			throw new InvalidOperationException(System.SR.Format(System.SR.SerializationDuplicateTypeAttribute, classType, typeof(TAttribute)));
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_SerializationDataExtensionPropertyInvalid(JsonPropertyInfo jsonPropertyInfo)
		{
			throw new InvalidOperationException(System.SR.Format(System.SR.SerializationDataExtensionPropertyInvalid, jsonPropertyInfo.PropertyType, jsonPropertyInfo.MemberName));
		}

		[DoesNotReturn]
		public static void ThrowInvalidOperationException_NodeJsonObjectCustomCo

BepInEx/plugins/SlopCrew.Plugin/System.Threading.Tasks.Extensions.dll

Decompiled 8 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security;
using System.Threading.Tasks;
using System.Threading.Tasks.Sources;
using Microsoft.CodeAnalysis;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("System.Threading.Tasks.Extensions")]
[assembly: AssemblyDescription("System.Threading.Tasks.Extensions")]
[assembly: AssemblyDefaultAlias("System.Threading.Tasks.Extensions")]
[assembly: AssemblyCompany("Microsoft Corporation")]
[assembly: AssemblyProduct("Microsoft® .NET Framework")]
[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")]
[assembly: AssemblyFileVersion("4.6.28619.01")]
[assembly: AssemblyInformationalVersion("4.6.28619.01 @BuiltBy: dlab14-DDVSOWINAGE069 @Branch: release/2.1 @SrcCode: https://github.com/dotnet/corefx/tree/7601f4f6225089ffb291dc7d58293c7bbf5c5d4f")]
[assembly: CLSCompliant(true)]
[assembly: AssemblyMetadata(".NETFrameworkAssembly", "")]
[assembly: AssemblyMetadata("Serviceable", "True")]
[assembly: AssemblyMetadata("PreferInbox", "True")]
[assembly: AssemblyVersion("4.2.0.1")]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class IsReadOnlyAttribute : Attribute
	{
	}
}
namespace System
{
	internal static class ThrowHelper
	{
		internal static void ThrowArgumentNullException(System.ExceptionArgument argument)
		{
			throw GetArgumentNullException(argument);
		}

		internal static void ThrowArgumentOutOfRangeException(System.ExceptionArgument argument)
		{
			throw GetArgumentOutOfRangeException(argument);
		}

		private static ArgumentNullException GetArgumentNullException(System.ExceptionArgument argument)
		{
			return new ArgumentNullException(GetArgumentName(argument));
		}

		private static ArgumentOutOfRangeException GetArgumentOutOfRangeException(System.ExceptionArgument argument)
		{
			return new ArgumentOutOfRangeException(GetArgumentName(argument));
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		private static string GetArgumentName(System.ExceptionArgument argument)
		{
			return argument.ToString();
		}
	}
	internal enum ExceptionArgument
	{
		task,
		source,
		state
	}
}
namespace System.Threading.Tasks
{
	[StructLayout(LayoutKind.Auto)]
	[AsyncMethodBuilder(typeof(AsyncValueTaskMethodBuilder))]
	public readonly struct ValueTask : IEquatable<ValueTask>
	{
		private sealed class ValueTaskSourceAsTask : TaskCompletionSource<bool>
		{
			private static readonly Action<object> s_completionAction = delegate(object state)
			{
				IValueTaskSource source;
				if (!(state is ValueTaskSourceAsTask valueTaskSourceAsTask) || (source = valueTaskSourceAsTask._source) == null)
				{
					System.ThrowHelper.ThrowArgumentOutOfRangeException(System.ExceptionArgument.state);
					return;
				}
				valueTaskSourceAsTask._source = null;
				ValueTaskSourceStatus status = source.GetStatus(valueTaskSourceAsTask._token);
				try
				{
					source.GetResult(valueTaskSourceAsTask._token);
					valueTaskSourceAsTask.TrySetResult(result: false);
				}
				catch (Exception exception)
				{
					if (status == ValueTaskSourceStatus.Canceled)
					{
						valueTaskSourceAsTask.TrySetCanceled();
					}
					else
					{
						valueTaskSourceAsTask.TrySetException(exception);
					}
				}
			};

			private IValueTaskSource _source;

			private readonly short _token;

			public ValueTaskSourceAsTask(IValueTaskSource source, short token)
			{
				_token = token;
				_source = source;
				source.OnCompleted(s_completionAction, this, token, ValueTaskSourceOnCompletedFlags.None);
			}
		}

		private static readonly Task s_canceledTask = Task.Delay(-1, new CancellationToken(canceled: true));

		internal readonly object _obj;

		internal readonly short _token;

		internal readonly bool _continueOnCapturedContext;

		internal static Task CompletedTask { get; } = Task.Delay(0);


		public bool IsCompleted
		{
			[MethodImpl(MethodImplOptions.AggressiveInlining)]
			get
			{
				object obj = _obj;
				if (obj == null)
				{
					return true;
				}
				if (obj is Task task)
				{
					return task.IsCompleted;
				}
				return System.Runtime.CompilerServices.Unsafe.As<IValueTaskSource>(obj).GetStatus(_token) != ValueTaskSourceStatus.Pending;
			}
		}

		public bool IsCompletedSuccessfully
		{
			[MethodImpl(MethodImplOptions.AggressiveInlining)]
			get
			{
				object obj = _obj;
				if (obj == null)
				{
					return true;
				}
				if (obj is Task task)
				{
					return task.Status == TaskStatus.RanToCompletion;
				}
				return System.Runtime.CompilerServices.Unsafe.As<IValueTaskSource>(obj).GetStatus(_token) == ValueTaskSourceStatus.Succeeded;
			}
		}

		public bool IsFaulted
		{
			get
			{
				object obj = _obj;
				if (obj == null)
				{
					return false;
				}
				if (obj is Task task)
				{
					return task.IsFaulted;
				}
				return System.Runtime.CompilerServices.Unsafe.As<IValueTaskSource>(obj).GetStatus(_token) == ValueTaskSourceStatus.Faulted;
			}
		}

		public bool IsCanceled
		{
			get
			{
				object obj = _obj;
				if (obj == null)
				{
					return false;
				}
				if (obj is Task task)
				{
					return task.IsCanceled;
				}
				return System.Runtime.CompilerServices.Unsafe.As<IValueTaskSource>(obj).GetStatus(_token) == ValueTaskSourceStatus.Canceled;
			}
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public ValueTask(Task task)
		{
			if (task == null)
			{
				System.ThrowHelper.ThrowArgumentNullException(System.ExceptionArgument.task);
			}
			_obj = task;
			_continueOnCapturedContext = true;
			_token = 0;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public ValueTask(IValueTaskSource source, short token)
		{
			if (source == null)
			{
				System.ThrowHelper.ThrowArgumentNullException(System.ExceptionArgument.source);
			}
			_obj = source;
			_token = token;
			_continueOnCapturedContext = true;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		private ValueTask(object obj, short token, bool continueOnCapturedContext)
		{
			_obj = obj;
			_token = token;
			_continueOnCapturedContext = continueOnCapturedContext;
		}

		public override int GetHashCode()
		{
			return _obj?.GetHashCode() ?? 0;
		}

		public override bool Equals(object obj)
		{
			if (obj is ValueTask)
			{
				return Equals((ValueTask)obj);
			}
			return false;
		}

		public bool Equals(ValueTask other)
		{
			if (_obj == other._obj)
			{
				return _token == other._token;
			}
			return false;
		}

		public static bool operator ==(ValueTask left, ValueTask right)
		{
			return left.Equals(right);
		}

		public static bool operator !=(ValueTask left, ValueTask right)
		{
			return !left.Equals(right);
		}

		public Task AsTask()
		{
			object obj = _obj;
			object obj2;
			if (obj != null)
			{
				obj2 = obj as Task;
				if (obj2 == null)
				{
					return GetTaskForValueTaskSource(System.Runtime.CompilerServices.Unsafe.As<IValueTaskSource>(obj));
				}
			}
			else
			{
				obj2 = CompletedTask;
			}
			return (Task)obj2;
		}

		public ValueTask Preserve()
		{
			if (_obj != null)
			{
				return new ValueTask(AsTask());
			}
			return this;
		}

		private Task GetTaskForValueTaskSource(IValueTaskSource t)
		{
			ValueTaskSourceStatus status = t.GetStatus(_token);
			if (status != 0)
			{
				try
				{
					t.GetResult(_token);
					return CompletedTask;
				}
				catch (Exception exception)
				{
					if (status == ValueTaskSourceStatus.Canceled)
					{
						return s_canceledTask;
					}
					TaskCompletionSource<bool> taskCompletionSource = new TaskCompletionSource<bool>();
					taskCompletionSource.TrySetException(exception);
					return taskCompletionSource.Task;
				}
			}
			ValueTaskSourceAsTask valueTaskSourceAsTask = new ValueTaskSourceAsTask(t, _token);
			return valueTaskSourceAsTask.Task;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		[StackTraceHidden]
		internal void ThrowIfCompletedUnsuccessfully()
		{
			object obj = _obj;
			if (obj != null)
			{
				if (obj is Task task)
				{
					task.GetAwaiter().GetResult();
				}
				else
				{
					System.Runtime.CompilerServices.Unsafe.As<IValueTaskSource>(obj).GetResult(_token);
				}
			}
		}

		public ValueTaskAwaiter GetAwaiter()
		{
			return new ValueTaskAwaiter(this);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public ConfiguredValueTaskAwaitable ConfigureAwait(bool continueOnCapturedContext)
		{
			return new ConfiguredValueTaskAwaitable(new ValueTask(_obj, _token, continueOnCapturedContext));
		}
	}
	[StructLayout(LayoutKind.Auto)]
	[AsyncMethodBuilder(typeof(AsyncValueTaskMethodBuilder<>))]
	public readonly struct ValueTask<TResult> : IEquatable<ValueTask<TResult>>
	{
		private sealed class ValueTaskSourceAsTask : TaskCompletionSource<TResult>
		{
			private static readonly Action<object> s_completionAction = delegate(object state)
			{
				IValueTaskSource<TResult> source;
				if (!(state is ValueTaskSourceAsTask valueTaskSourceAsTask) || (source = valueTaskSourceAsTask._source) == null)
				{
					System.ThrowHelper.ThrowArgumentOutOfRangeException(System.ExceptionArgument.state);
					return;
				}
				valueTaskSourceAsTask._source = null;
				ValueTaskSourceStatus status = source.GetStatus(valueTaskSourceAsTask._token);
				try
				{
					valueTaskSourceAsTask.TrySetResult(source.GetResult(valueTaskSourceAsTask._token));
				}
				catch (Exception exception)
				{
					if (status == ValueTaskSourceStatus.Canceled)
					{
						valueTaskSourceAsTask.TrySetCanceled();
					}
					else
					{
						valueTaskSourceAsTask.TrySetException(exception);
					}
				}
			};

			private IValueTaskSource<TResult> _source;

			private readonly short _token;

			public ValueTaskSourceAsTask(IValueTaskSource<TResult> source, short token)
			{
				_source = source;
				_token = token;
				source.OnCompleted(s_completionAction, this, token, ValueTaskSourceOnCompletedFlags.None);
			}
		}

		private static Task<TResult> s_canceledTask;

		internal readonly object _obj;

		internal readonly TResult _result;

		internal readonly short _token;

		internal readonly bool _continueOnCapturedContext;

		public bool IsCompleted
		{
			[MethodImpl(MethodImplOptions.AggressiveInlining)]
			get
			{
				object obj = _obj;
				if (obj == null)
				{
					return true;
				}
				if (obj is Task<TResult> task)
				{
					return task.IsCompleted;
				}
				return System.Runtime.CompilerServices.Unsafe.As<IValueTaskSource<TResult>>(obj).GetStatus(_token) != ValueTaskSourceStatus.Pending;
			}
		}

		public bool IsCompletedSuccessfully
		{
			[MethodImpl(MethodImplOptions.AggressiveInlining)]
			get
			{
				object obj = _obj;
				if (obj == null)
				{
					return true;
				}
				if (obj is Task<TResult> task)
				{
					return task.Status == TaskStatus.RanToCompletion;
				}
				return System.Runtime.CompilerServices.Unsafe.As<IValueTaskSource<TResult>>(obj).GetStatus(_token) == ValueTaskSourceStatus.Succeeded;
			}
		}

		public bool IsFaulted
		{
			get
			{
				object obj = _obj;
				if (obj == null)
				{
					return false;
				}
				if (obj is Task<TResult> task)
				{
					return task.IsFaulted;
				}
				return System.Runtime.CompilerServices.Unsafe.As<IValueTaskSource<TResult>>(obj).GetStatus(_token) == ValueTaskSourceStatus.Faulted;
			}
		}

		public bool IsCanceled
		{
			get
			{
				object obj = _obj;
				if (obj == null)
				{
					return false;
				}
				if (obj is Task<TResult> task)
				{
					return task.IsCanceled;
				}
				return System.Runtime.CompilerServices.Unsafe.As<IValueTaskSource<TResult>>(obj).GetStatus(_token) == ValueTaskSourceStatus.Canceled;
			}
		}

		public TResult Result
		{
			[MethodImpl(MethodImplOptions.AggressiveInlining)]
			get
			{
				object obj = _obj;
				if (obj == null)
				{
					return _result;
				}
				if (obj is Task<TResult> task)
				{
					return task.GetAwaiter().GetResult();
				}
				return System.Runtime.CompilerServices.Unsafe.As<IValueTaskSource<TResult>>(obj).GetResult(_token);
			}
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public ValueTask(TResult result)
		{
			_result = result;
			_obj = null;
			_continueOnCapturedContext = true;
			_token = 0;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public ValueTask(Task<TResult> task)
		{
			if (task == null)
			{
				System.ThrowHelper.ThrowArgumentNullException(System.ExceptionArgument.task);
			}
			_obj = task;
			_result = default(TResult);
			_continueOnCapturedContext = true;
			_token = 0;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public ValueTask(IValueTaskSource<TResult> source, short token)
		{
			if (source == null)
			{
				System.ThrowHelper.ThrowArgumentNullException(System.ExceptionArgument.source);
			}
			_obj = source;
			_token = token;
			_result = default(TResult);
			_continueOnCapturedContext = true;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		private ValueTask(object obj, TResult result, short token, bool continueOnCapturedContext)
		{
			_obj = obj;
			_result = result;
			_token = token;
			_continueOnCapturedContext = continueOnCapturedContext;
		}

		public override int GetHashCode()
		{
			if (_obj == null)
			{
				if (_result == null)
				{
					return 0;
				}
				return _result.GetHashCode();
			}
			return _obj.GetHashCode();
		}

		public override bool Equals(object obj)
		{
			if (obj is ValueTask<TResult>)
			{
				return Equals((ValueTask<TResult>)obj);
			}
			return false;
		}

		public bool Equals(ValueTask<TResult> other)
		{
			if (_obj == null && other._obj == null)
			{
				return EqualityComparer<TResult>.Default.Equals(_result, other._result);
			}
			if (_obj == other._obj)
			{
				return _token == other._token;
			}
			return false;
		}

		public static bool operator ==(ValueTask<TResult> left, ValueTask<TResult> right)
		{
			return left.Equals(right);
		}

		public static bool operator !=(ValueTask<TResult> left, ValueTask<TResult> right)
		{
			return !left.Equals(right);
		}

		public Task<TResult> AsTask()
		{
			object obj = _obj;
			if (obj == null)
			{
				return Task.FromResult(_result);
			}
			if (obj is Task<TResult> result)
			{
				return result;
			}
			return GetTaskForValueTaskSource(System.Runtime.CompilerServices.Unsafe.As<IValueTaskSource<TResult>>(obj));
		}

		public ValueTask<TResult> Preserve()
		{
			if (_obj != null)
			{
				return new ValueTask<TResult>(AsTask());
			}
			return this;
		}

		private Task<TResult> GetTaskForValueTaskSource(IValueTaskSource<TResult> t)
		{
			ValueTaskSourceStatus status = t.GetStatus(_token);
			if (status != 0)
			{
				try
				{
					return Task.FromResult(t.GetResult(_token));
				}
				catch (Exception exception)
				{
					if (status == ValueTaskSourceStatus.Canceled)
					{
						Task<TResult> task = s_canceledTask;
						if (task == null)
						{
							TaskCompletionSource<TResult> taskCompletionSource = new TaskCompletionSource<TResult>();
							taskCompletionSource.TrySetCanceled();
							task = (s_canceledTask = taskCompletionSource.Task);
						}
						return task;
					}
					TaskCompletionSource<TResult> taskCompletionSource2 = new TaskCompletionSource<TResult>();
					taskCompletionSource2.TrySetException(exception);
					return taskCompletionSource2.Task;
				}
			}
			ValueTaskSourceAsTask valueTaskSourceAsTask = new ValueTaskSourceAsTask(t, _token);
			return valueTaskSourceAsTask.Task;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public ValueTaskAwaiter<TResult> GetAwaiter()
		{
			return new ValueTaskAwaiter<TResult>(this);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public ConfiguredValueTaskAwaitable<TResult> ConfigureAwait(bool continueOnCapturedContext)
		{
			return new ConfiguredValueTaskAwaitable<TResult>(new ValueTask<TResult>(_obj, _result, _token, continueOnCapturedContext));
		}

		public override string ToString()
		{
			if (IsCompletedSuccessfully)
			{
				TResult result = Result;
				if (result != null)
				{
					return result.ToString();
				}
			}
			return string.Empty;
		}
	}
}
namespace System.Threading.Tasks.Sources
{
	[Flags]
	public enum ValueTaskSourceOnCompletedFlags
	{
		None = 0,
		UseSchedulingContext = 1,
		FlowExecutionContext = 2
	}
	public enum ValueTaskSourceStatus
	{
		Pending,
		Succeeded,
		Faulted,
		Canceled
	}
	public interface IValueTaskSource
	{
		ValueTaskSourceStatus GetStatus(short token);

		void OnCompleted(Action<object> continuation, object state, short token, ValueTaskSourceOnCompletedFlags flags);

		void GetResult(short token);
	}
	public interface IValueTaskSource<out TResult>
	{
		ValueTaskSourceStatus GetStatus(short token);

		void OnCompleted(Action<object> continuation, object state, short token, ValueTaskSourceOnCompletedFlags flags);

		TResult GetResult(short token);
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Interface | AttributeTargets.Delegate, Inherited = false, AllowMultiple = false)]
	public sealed class AsyncMethodBuilderAttribute : Attribute
	{
		public Type BuilderType { get; }

		public AsyncMethodBuilderAttribute(Type builderType)
		{
			BuilderType = builderType;
		}
	}
	[StructLayout(LayoutKind.Auto)]
	public struct AsyncValueTaskMethodBuilder
	{
		private AsyncTaskMethodBuilder _methodBuilder;

		private bool _haveResult;

		private bool _useBuilder;

		public ValueTask Task
		{
			get
			{
				if (_haveResult)
				{
					return default(ValueTask);
				}
				_useBuilder = true;
				return new ValueTask(_methodBuilder.Task);
			}
		}

		public static AsyncValueTaskMethodBuilder Create()
		{
			return default(AsyncValueTaskMethodBuilder);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public void Start<TStateMachine>(ref TStateMachine stateMachine) where TStateMachine : IAsyncStateMachine
		{
			_methodBuilder.Start(ref stateMachine);
		}

		public void SetStateMachine(IAsyncStateMachine stateMachine)
		{
			_methodBuilder.SetStateMachine(stateMachine);
		}

		public void SetResult()
		{
			if (_useBuilder)
			{
				_methodBuilder.SetResult();
			}
			else
			{
				_haveResult = true;
			}
		}

		public void SetException(Exception exception)
		{
			_methodBuilder.SetException(exception);
		}

		public void AwaitOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : INotifyCompletion where TStateMachine : IAsyncStateMachine
		{
			_useBuilder = true;
			_methodBuilder.AwaitOnCompleted(ref awaiter, ref stateMachine);
		}

		[SecuritySafeCritical]
		public void AwaitUnsafeOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : ICriticalNotifyCompletion where TStateMachine : IAsyncStateMachine
		{
			_useBuilder = true;
			_methodBuilder.AwaitUnsafeOnCompleted(ref awaiter, ref stateMachine);
		}
	}
	[StructLayout(LayoutKind.Auto)]
	public struct AsyncValueTaskMethodBuilder<TResult>
	{
		private AsyncTaskMethodBuilder<TResult> _methodBuilder;

		private TResult _result;

		private bool _haveResult;

		private bool _useBuilder;

		public ValueTask<TResult> Task
		{
			get
			{
				if (_haveResult)
				{
					return new ValueTask<TResult>(_result);
				}
				_useBuilder = true;
				return new ValueTask<TResult>(_methodBuilder.Task);
			}
		}

		public static AsyncValueTaskMethodBuilder<TResult> Create()
		{
			return default(AsyncValueTaskMethodBuilder<TResult>);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public void Start<TStateMachine>(ref TStateMachine stateMachine) where TStateMachine : IAsyncStateMachine
		{
			_methodBuilder.Start(ref stateMachine);
		}

		public void SetStateMachine(IAsyncStateMachine stateMachine)
		{
			_methodBuilder.SetStateMachine(stateMachine);
		}

		public void SetResult(TResult result)
		{
			if (_useBuilder)
			{
				_methodBuilder.SetResult(result);
				return;
			}
			_result = result;
			_haveResult = true;
		}

		public void SetException(Exception exception)
		{
			_methodBuilder.SetException(exception);
		}

		public void AwaitOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : INotifyCompletion where TStateMachine : IAsyncStateMachine
		{
			_useBuilder = true;
			_methodBuilder.AwaitOnCompleted(ref awaiter, ref stateMachine);
		}

		[SecuritySafeCritical]
		public void AwaitUnsafeOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : ICriticalNotifyCompletion where TStateMachine : IAsyncStateMachine
		{
			_useBuilder = true;
			_methodBuilder.AwaitUnsafeOnCompleted(ref awaiter, ref stateMachine);
		}
	}
	[StructLayout(LayoutKind.Auto)]
	public readonly struct ConfiguredValueTaskAwaitable
	{
		[StructLayout(LayoutKind.Auto)]
		public readonly struct ConfiguredValueTaskAwaiter : ICriticalNotifyCompletion, INotifyCompletion
		{
			private readonly ValueTask _value;

			public bool IsCompleted
			{
				[MethodImpl(MethodImplOptions.AggressiveInlining)]
				get
				{
					return _value.IsCompleted;
				}
			}

			[MethodImpl(MethodImplOptions.AggressiveInlining)]
			internal ConfiguredValueTaskAwaiter(ValueTask value)
			{
				_value = value;
			}

			[MethodImpl(MethodImplOptions.AggressiveInlining)]
			[StackTraceHidden]
			public void GetResult()
			{
				_value.ThrowIfCompletedUnsuccessfully();
			}

			public void OnCompleted(Action continuation)
			{
				object obj = _value._obj;
				if (obj is Task task)
				{
					task.ConfigureAwait(_value._continueOnCapturedContext).GetAwaiter().OnCompleted(continuation);
				}
				else if (obj != null)
				{
					System.Runtime.CompilerServices.Unsafe.As<IValueTaskSource>(obj).OnCompleted(ValueTaskAwaiter.s_invokeActionDelegate, continuation, _value._token, ValueTaskSourceOnCompletedFlags.FlowExecutionContext | (_value._continueOnCapturedContext ? ValueTaskSourceOnCompletedFlags.UseSchedulingContext : ValueTaskSourceOnCompletedFlags.None));
				}
				else
				{
					ValueTask.CompletedTask.ConfigureAwait(_value._continueOnCapturedContext).GetAwaiter().OnCompleted(continuation);
				}
			}

			public void UnsafeOnCompleted(Action continuation)
			{
				object obj = _value._obj;
				if (obj is Task task)
				{
					task.ConfigureAwait(_value._continueOnCapturedContext).GetAwaiter().UnsafeOnCompleted(continuation);
				}
				else if (obj != null)
				{
					System.Runtime.CompilerServices.Unsafe.As<IValueTaskSource>(obj).OnCompleted(ValueTaskAwaiter.s_invokeActionDelegate, continuation, _value._token, _value._continueOnCapturedContext ? ValueTaskSourceOnCompletedFlags.UseSchedulingContext : ValueTaskSourceOnCompletedFlags.None);
				}
				else
				{
					ValueTask.CompletedTask.ConfigureAwait(_value._continueOnCapturedContext).GetAwaiter().UnsafeOnCompleted(continuation);
				}
			}
		}

		private readonly ValueTask _value;

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		internal ConfiguredValueTaskAwaitable(ValueTask value)
		{
			_value = value;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public ConfiguredValueTaskAwaiter GetAwaiter()
		{
			return new ConfiguredValueTaskAwaiter(_value);
		}
	}
	[StructLayout(LayoutKind.Auto)]
	public readonly struct ConfiguredValueTaskAwaitable<TResult>
	{
		[StructLayout(LayoutKind.Auto)]
		public readonly struct ConfiguredValueTaskAwaiter : ICriticalNotifyCompletion, INotifyCompletion
		{
			private readonly ValueTask<TResult> _value;

			public bool IsCompleted
			{
				[MethodImpl(MethodImplOptions.AggressiveInlining)]
				get
				{
					return _value.IsCompleted;
				}
			}

			[MethodImpl(MethodImplOptions.AggressiveInlining)]
			internal ConfiguredValueTaskAwaiter(ValueTask<TResult> value)
			{
				_value = value;
			}

			[MethodImpl(MethodImplOptions.AggressiveInlining)]
			[StackTraceHidden]
			public TResult GetResult()
			{
				return _value.Result;
			}

			public void OnCompleted(Action continuation)
			{
				object obj = _value._obj;
				if (obj is Task<TResult> task)
				{
					task.ConfigureAwait(_value._continueOnCapturedContext).GetAwaiter().OnCompleted(continuation);
				}
				else if (obj != null)
				{
					System.Runtime.CompilerServices.Unsafe.As<IValueTaskSource<TResult>>(obj).OnCompleted(ValueTaskAwaiter.s_invokeActionDelegate, continuation, _value._token, ValueTaskSourceOnCompletedFlags.FlowExecutionContext | (_value._continueOnCapturedContext ? ValueTaskSourceOnCompletedFlags.UseSchedulingContext : ValueTaskSourceOnCompletedFlags.None));
				}
				else
				{
					ValueTask.CompletedTask.ConfigureAwait(_value._continueOnCapturedContext).GetAwaiter().OnCompleted(continuation);
				}
			}

			public void UnsafeOnCompleted(Action continuation)
			{
				object obj = _value._obj;
				if (obj is Task<TResult> task)
				{
					task.ConfigureAwait(_value._continueOnCapturedContext).GetAwaiter().UnsafeOnCompleted(continuation);
				}
				else if (obj != null)
				{
					System.Runtime.CompilerServices.Unsafe.As<IValueTaskSource<TResult>>(obj).OnCompleted(ValueTaskAwaiter.s_invokeActionDelegate, continuation, _value._token, _value._continueOnCapturedContext ? ValueTaskSourceOnCompletedFlags.UseSchedulingContext : ValueTaskSourceOnCompletedFlags.None);
				}
				else
				{
					ValueTask.CompletedTask.ConfigureAwait(_value._continueOnCapturedContext).GetAwaiter().UnsafeOnCompleted(continuation);
				}
			}
		}

		private readonly ValueTask<TResult> _value;

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		internal ConfiguredValueTaskAwaitable(ValueTask<TResult> value)
		{
			_value = value;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public ConfiguredValueTaskAwaiter GetAwaiter()
		{
			return new ConfiguredValueTaskAwaiter(_value);
		}
	}
	public readonly struct ValueTaskAwaiter : ICriticalNotifyCompletion, INotifyCompletion
	{
		internal static readonly Action<object> s_invokeActionDelegate = delegate(object state)
		{
			if (!(state is Action action))
			{
				System.ThrowHelper.ThrowArgumentOutOfRangeException(System.ExceptionArgument.state);
			}
			else
			{
				action();
			}
		};

		private readonly ValueTask _value;

		public bool IsCompleted
		{
			[MethodImpl(MethodImplOptions.AggressiveInlining)]
			get
			{
				return _value.IsCompleted;
			}
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		internal ValueTaskAwaiter(ValueTask value)
		{
			_value = value;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		[StackTraceHidden]
		public void GetResult()
		{
			_value.ThrowIfCompletedUnsuccessfully();
		}

		public void OnCompleted(Action continuation)
		{
			object obj = _value._obj;
			if (obj is Task task)
			{
				task.GetAwaiter().OnCompleted(continuation);
			}
			else if (obj != null)
			{
				System.Runtime.CompilerServices.Unsafe.As<IValueTaskSource>(obj).OnCompleted(s_invokeActionDelegate, continuation, _value._token, ValueTaskSourceOnCompletedFlags.UseSchedulingContext | ValueTaskSourceOnCompletedFlags.FlowExecutionContext);
			}
			else
			{
				ValueTask.CompletedTask.GetAwaiter().OnCompleted(continuation);
			}
		}

		public void UnsafeOnCompleted(Action continuation)
		{
			object obj = _value._obj;
			if (obj is Task task)
			{
				task.GetAwaiter().UnsafeOnCompleted(continuation);
			}
			else if (obj != null)
			{
				System.Runtime.CompilerServices.Unsafe.As<IValueTaskSource>(obj).OnCompleted(s_invokeActionDelegate, continuation, _value._token, ValueTaskSourceOnCompletedFlags.UseSchedulingContext);
			}
			else
			{
				ValueTask.CompletedTask.GetAwaiter().UnsafeOnCompleted(continuation);
			}
		}
	}
	public readonly struct ValueTaskAwaiter<TResult> : ICriticalNotifyCompletion, INotifyCompletion
	{
		private readonly ValueTask<TResult> _value;

		public bool IsCompleted
		{
			[MethodImpl(MethodImplOptions.AggressiveInlining)]
			get
			{
				return _value.IsCompleted;
			}
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		internal ValueTaskAwaiter(ValueTask<TResult> value)
		{
			_value = value;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		[StackTraceHidden]
		public TResult GetResult()
		{
			return _value.Result;
		}

		public void OnCompleted(Action continuation)
		{
			object obj = _value._obj;
			if (obj is Task<TResult> task)
			{
				task.GetAwaiter().OnCompleted(continuation);
			}
			else if (obj != null)
			{
				System.Runtime.CompilerServices.Unsafe.As<IValueTaskSource<TResult>>(obj).OnCompleted(ValueTaskAwaiter.s_invokeActionDelegate, continuation, _value._token, ValueTaskSourceOnCompletedFlags.UseSchedulingContext | ValueTaskSourceOnCompletedFlags.FlowExecutionContext);
			}
			else
			{
				ValueTask.CompletedTask.GetAwaiter().OnCompleted(continuation);
			}
		}

		public void UnsafeOnCompleted(Action continuation)
		{
			object obj = _value._obj;
			if (obj is Task<TResult> task)
			{
				task.GetAwaiter().UnsafeOnCompleted(continuation);
			}
			else if (obj != null)
			{
				System.Runtime.CompilerServices.Unsafe.As<IValueTaskSource<TResult>>(obj).OnCompleted(ValueTaskAwaiter.s_invokeActionDelegate, continuation, _value._token, ValueTaskSourceOnCompletedFlags.UseSchedulingContext);
			}
			else
			{
				ValueTask.CompletedTask.GetAwaiter().UnsafeOnCompleted(continuation);
			}
		}
	}
}
namespace System.Diagnostics
{
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Constructor | AttributeTargets.Method, Inherited = false)]
	internal sealed class StackTraceHiddenAttribute : Attribute
	{
	}
}

BepInEx/plugins/SlopCrew.Plugin/System.ValueTuple.dll

Decompiled 8 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Numerics.Hashing;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security;
using FxResources.System.ValueTuple;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AllowPartiallyTrustedCallers]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: AssemblyTitle("System.ValueTuple")]
[assembly: AssemblyDescription("System.ValueTuple")]
[assembly: AssemblyDefaultAlias("System.ValueTuple")]
[assembly: AssemblyCompany("Microsoft Corporation")]
[assembly: AssemblyProduct("Microsoft® .NET Framework")]
[assembly: AssemblyCopyright("© Microsoft Corporation.  All rights reserved.")]
[assembly: AssemblyFileVersion("4.6.26515.06")]
[assembly: AssemblyInformationalVersion("4.6.26515.06 @BuiltBy: dlab-DDVSOWINAGE059 @Branch: release/2.1 @SrcCode: https://github.com/dotnet/corefx/tree/30ab651fcb4354552bd4891619a0bdd81e0ebdbf")]
[assembly: CLSCompliant(true)]
[assembly: AssemblyMetadata(".NETFrameworkAssembly", "")]
[assembly: AssemblyMetadata("Serviceable", "True")]
[assembly: AssemblyMetadata("PreferInbox", "True")]
[assembly: AssemblyVersion("4.0.3.0")]
namespace FxResources.System.ValueTuple
{
	internal static class SR
	{
	}
}
namespace System
{
	public static class TupleExtensions
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public static void Deconstruct<T1>(this Tuple<T1> value, out T1 item1)
		{
			item1 = value.Item1;
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static void Deconstruct<T1, T2>(this Tuple<T1, T2> value, out T1 item1, out T2 item2)
		{
			item1 = value.Item1;
			item2 = value.Item2;
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static void Deconstruct<T1, T2, T3>(this Tuple<T1, T2, T3> value, out T1 item1, out T2 item2, out T3 item3)
		{
			item1 = value.Item1;
			item2 = value.Item2;
			item3 = value.Item3;
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static void Deconstruct<T1, T2, T3, T4>(this Tuple<T1, T2, T3, T4> value, out T1 item1, out T2 item2, out T3 item3, out T4 item4)
		{
			item1 = value.Item1;
			item2 = value.Item2;
			item3 = value.Item3;
			item4 = value.Item4;
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static void Deconstruct<T1, T2, T3, T4, T5>(this Tuple<T1, T2, T3, T4, T5> value, out T1 item1, out T2 item2, out T3 item3, out T4 item4, out T5 item5)
		{
			item1 = value.Item1;
			item2 = value.Item2;
			item3 = value.Item3;
			item4 = value.Item4;
			item5 = value.Item5;
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static void Deconstruct<T1, T2, T3, T4, T5, T6>(this Tuple<T1, T2, T3, T4, T5, T6> value, out T1 item1, out T2 item2, out T3 item3, out T4 item4, out T5 item5, out T6 item6)
		{
			item1 = value.Item1;
			item2 = value.Item2;
			item3 = value.Item3;
			item4 = value.Item4;
			item5 = value.Item5;
			item6 = value.Item6;
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static void Deconstruct<T1, T2, T3, T4, T5, T6, T7>(this Tuple<T1, T2, T3, T4, T5, T6, T7> value, out T1 item1, out T2 item2, out T3 item3, out T4 item4, out T5 item5, out T6 item6, out T7 item7)
		{
			item1 = value.Item1;
			item2 = value.Item2;
			item3 = value.Item3;
			item4 = value.Item4;
			item5 = value.Item5;
			item6 = value.Item6;
			item7 = value.Item7;
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static void Deconstruct<T1, T2, T3, T4, T5, T6, T7, T8>(this Tuple<T1, T2, T3, T4, T5, T6, T7, Tuple<T8>> value, out T1 item1, out T2 item2, out T3 item3, out T4 item4, out T5 item5, out T6 item6, out T7 item7, out T8 item8)
		{
			item1 = value.Item1;
			item2 = value.Item2;
			item3 = value.Item3;
			item4 = value.Item4;
			item5 = value.Item5;
			item6 = value.Item6;
			item7 = value.Item7;
			item8 = value.Rest.Item1;
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static void Deconstruct<T1, T2, T3, T4, T5, T6, T7, T8, T9>(this Tuple<T1, T2, T3, T4, T5, T6, T7, Tuple<T8, T9>> value, out T1 item1, out T2 item2, out T3 item3, out T4 item4, out T5 item5, out T6 item6, out T7 item7, out T8 item8, out T9 item9)
		{
			item1 = value.Item1;
			item2 = value.Item2;
			item3 = value.Item3;
			item4 = value.Item4;
			item5 = value.Item5;
			item6 = value.Item6;
			item7 = value.Item7;
			item8 = value.Rest.Item1;
			item9 = value.Rest.Item2;
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static void Deconstruct<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(this Tuple<T1, T2, T3, T4, T5, T6, T7, Tuple<T8, T9, T10>> value, out T1 item1, out T2 item2, out T3 item3, out T4 item4, out T5 item5, out T6 item6, out T7 item7, out T8 item8, out T9 item9, out T10 item10)
		{
			item1 = value.Item1;
			item2 = value.Item2;
			item3 = value.Item3;
			item4 = value.Item4;
			item5 = value.Item5;
			item6 = value.Item6;
			item7 = value.Item7;
			item8 = value.Rest.Item1;
			item9 = value.Rest.Item2;
			item10 = value.Rest.Item3;
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static void Deconstruct<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(this Tuple<T1, T2, T3, T4, T5, T6, T7, Tuple<T8, T9, T10, T11>> value, out T1 item1, out T2 item2, out T3 item3, out T4 item4, out T5 item5, out T6 item6, out T7 item7, out T8 item8, out T9 item9, out T10 item10, out T11 item11)
		{
			item1 = value.Item1;
			item2 = value.Item2;
			item3 = value.Item3;
			item4 = value.Item4;
			item5 = value.Item5;
			item6 = value.Item6;
			item7 = value.Item7;
			item8 = value.Rest.Item1;
			item9 = value.Rest.Item2;
			item10 = value.Rest.Item3;
			item11 = value.Rest.Item4;
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static void Deconstruct<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(this Tuple<T1, T2, T3, T4, T5, T6, T7, Tuple<T8, T9, T10, T11, T12>> value, out T1 item1, out T2 item2, out T3 item3, out T4 item4, out T5 item5, out T6 item6, out T7 item7, out T8 item8, out T9 item9, out T10 item10, out T11 item11, out T12 item12)
		{
			item1 = value.Item1;
			item2 = value.Item2;
			item3 = value.Item3;
			item4 = value.Item4;
			item5 = value.Item5;
			item6 = value.Item6;
			item7 = value.Item7;
			item8 = value.Rest.Item1;
			item9 = value.Rest.Item2;
			item10 = value.Rest.Item3;
			item11 = value.Rest.Item4;
			item12 = value.Rest.Item5;
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static void Deconstruct<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>(this Tuple<T1, T2, T3, T4, T5, T6, T7, Tuple<T8, T9, T10, T11, T12, T13>> value, out T1 item1, out T2 item2, out T3 item3, out T4 item4, out T5 item5, out T6 item6, out T7 item7, out T8 item8, out T9 item9, out T10 item10, out T11 item11, out T12 item12, out T13 item13)
		{
			item1 = value.Item1;
			item2 = value.Item2;
			item3 = value.Item3;
			item4 = value.Item4;
			item5 = value.Item5;
			item6 = value.Item6;
			item7 = value.Item7;
			item8 = value.Rest.Item1;
			item9 = value.Rest.Item2;
			item10 = value.Rest.Item3;
			item11 = value.Rest.Item4;
			item12 = value.Rest.Item5;
			item13 = value.Rest.Item6;
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static void Deconstruct<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>(this Tuple<T1, T2, T3, T4, T5, T6, T7, Tuple<T8, T9, T10, T11, T12, T13, T14>> value, out T1 item1, out T2 item2, out T3 item3, out T4 item4, out T5 item5, out T6 item6, out T7 item7, out T8 item8, out T9 item9, out T10 item10, out T11 item11, out T12 item12, out T13 item13, out T14 item14)
		{
			item1 = value.Item1;
			item2 = value.Item2;
			item3 = value.Item3;
			item4 = value.Item4;
			item5 = value.Item5;
			item6 = value.Item6;
			item7 = value.Item7;
			item8 = value.Rest.Item1;
			item9 = value.Rest.Item2;
			item10 = value.Rest.Item3;
			item11 = value.Rest.Item4;
			item12 = value.Rest.Item5;
			item13 = value.Rest.Item6;
			item14 = value.Rest.Item7;
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static void Deconstruct<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>(this Tuple<T1, T2, T3, T4, T5, T6, T7, Tuple<T8, T9, T10, T11, T12, T13, T14, Tuple<T15>>> value, out T1 item1, out T2 item2, out T3 item3, out T4 item4, out T5 item5, out T6 item6, out T7 item7, out T8 item8, out T9 item9, out T10 item10, out T11 item11, out T12 item12, out T13 item13, out T14 item14, out T15 item15)
		{
			item1 = value.Item1;
			item2 = value.Item2;
			item3 = value.Item3;
			item4 = value.Item4;
			item5 = value.Item5;
			item6 = value.Item6;
			item7 = value.Item7;
			item8 = value.Rest.Item1;
			item9 = value.Rest.Item2;
			item10 = value.Rest.Item3;
			item11 = value.Rest.Item4;
			item12 = value.Rest.Item5;
			item13 = value.Rest.Item6;
			item14 = value.Rest.Item7;
			item15 = value.Rest.Rest.Item1;
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static void Deconstruct<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>(this Tuple<T1, T2, T3, T4, T5, T6, T7, Tuple<T8, T9, T10, T11, T12, T13, T14, Tuple<T15, T16>>> value, out T1 item1, out T2 item2, out T3 item3, out T4 item4, out T5 item5, out T6 item6, out T7 item7, out T8 item8, out T9 item9, out T10 item10, out T11 item11, out T12 item12, out T13 item13, out T14 item14, out T15 item15, out T16 item16)
		{
			item1 = value.Item1;
			item2 = value.Item2;
			item3 = value.Item3;
			item4 = value.Item4;
			item5 = value.Item5;
			item6 = value.Item6;
			item7 = value.Item7;
			item8 = value.Rest.Item1;
			item9 = value.Rest.Item2;
			item10 = value.Rest.Item3;
			item11 = value.Rest.Item4;
			item12 = value.Rest.Item5;
			item13 = value.Rest.Item6;
			item14 = value.Rest.Item7;
			item15 = value.Rest.Rest.Item1;
			item16 = value.Rest.Rest.Item2;
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static void Deconstruct<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17>(this Tuple<T1, T2, T3, T4, T5, T6, T7, Tuple<T8, T9, T10, T11, T12, T13, T14, Tuple<T15, T16, T17>>> value, out T1 item1, out T2 item2, out T3 item3, out T4 item4, out T5 item5, out T6 item6, out T7 item7, out T8 item8, out T9 item9, out T10 item10, out T11 item11, out T12 item12, out T13 item13, out T14 item14, out T15 item15, out T16 item16, out T17 item17)
		{
			item1 = value.Item1;
			item2 = value.Item2;
			item3 = value.Item3;
			item4 = value.Item4;
			item5 = value.Item5;
			item6 = value.Item6;
			item7 = value.Item7;
			item8 = value.Rest.Item1;
			item9 = value.Rest.Item2;
			item10 = value.Rest.Item3;
			item11 = value.Rest.Item4;
			item12 = value.Rest.Item5;
			item13 = value.Rest.Item6;
			item14 = value.Rest.Item7;
			item15 = value.Rest.Rest.Item1;
			item16 = value.Rest.Rest.Item2;
			item17 = value.Rest.Rest.Item3;
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static void Deconstruct<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18>(this Tuple<T1, T2, T3, T4, T5, T6, T7, Tuple<T8, T9, T10, T11, T12, T13, T14, Tuple<T15, T16, T17, T18>>> value, out T1 item1, out T2 item2, out T3 item3, out T4 item4, out T5 item5, out T6 item6, out T7 item7, out T8 item8, out T9 item9, out T10 item10, out T11 item11, out T12 item12, out T13 item13, out T14 item14, out T15 item15, out T16 item16, out T17 item17, out T18 item18)
		{
			item1 = value.Item1;
			item2 = value.Item2;
			item3 = value.Item3;
			item4 = value.Item4;
			item5 = value.Item5;
			item6 = value.Item6;
			item7 = value.Item7;
			item8 = value.Rest.Item1;
			item9 = value.Rest.Item2;
			item10 = value.Rest.Item3;
			item11 = value.Rest.Item4;
			item12 = value.Rest.Item5;
			item13 = value.Rest.Item6;
			item14 = value.Rest.Item7;
			item15 = value.Rest.Rest.Item1;
			item16 = value.Rest.Rest.Item2;
			item17 = value.Rest.Rest.Item3;
			item18 = value.Rest.Rest.Item4;
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static void Deconstruct<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19>(this Tuple<T1, T2, T3, T4, T5, T6, T7, Tuple<T8, T9, T10, T11, T12, T13, T14, Tuple<T15, T16, T17, T18, T19>>> value, out T1 item1, out T2 item2, out T3 item3, out T4 item4, out T5 item5, out T6 item6, out T7 item7, out T8 item8, out T9 item9, out T10 item10, out T11 item11, out T12 item12, out T13 item13, out T14 item14, out T15 item15, out T16 item16, out T17 item17, out T18 item18, out T19 item19)
		{
			item1 = value.Item1;
			item2 = value.Item2;
			item3 = value.Item3;
			item4 = value.Item4;
			item5 = value.Item5;
			item6 = value.Item6;
			item7 = value.Item7;
			item8 = value.Rest.Item1;
			item9 = value.Rest.Item2;
			item10 = value.Rest.Item3;
			item11 = value.Rest.Item4;
			item12 = value.Rest.Item5;
			item13 = value.Rest.Item6;
			item14 = value.Rest.Item7;
			item15 = value.Rest.Rest.Item1;
			item16 = value.Rest.Rest.Item2;
			item17 = value.Rest.Rest.Item3;
			item18 = value.Rest.Rest.Item4;
			item19 = value.Rest.Rest.Item5;
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static void Deconstruct<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20>(this Tuple<T1, T2, T3, T4, T5, T6, T7, Tuple<T8, T9, T10, T11, T12, T13, T14, Tuple<T15, T16, T17, T18, T19, T20>>> value, out T1 item1, out T2 item2, out T3 item3, out T4 item4, out T5 item5, out T6 item6, out T7 item7, out T8 item8, out T9 item9, out T10 item10, out T11 item11, out T12 item12, out T13 item13, out T14 item14, out T15 item15, out T16 item16, out T17 item17, out T18 item18, out T19 item19, out T20 item20)
		{
			item1 = value.Item1;
			item2 = value.Item2;
			item3 = value.Item3;
			item4 = value.Item4;
			item5 = value.Item5;
			item6 = value.Item6;
			item7 = value.Item7;
			item8 = value.Rest.Item1;
			item9 = value.Rest.Item2;
			item10 = value.Rest.Item3;
			item11 = value.Rest.Item4;
			item12 = value.Rest.Item5;
			item13 = value.Rest.Item6;
			item14 = value.Rest.Item7;
			item15 = value.Rest.Rest.Item1;
			item16 = value.Rest.Rest.Item2;
			item17 = value.Rest.Rest.Item3;
			item18 = value.Rest.Rest.Item4;
			item19 = value.Rest.Rest.Item5;
			item20 = value.Rest.Rest.Item6;
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static void Deconstruct<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21>(this Tuple<T1, T2, T3, T4, T5, T6, T7, Tuple<T8, T9, T10, T11, T12, T13, T14, Tuple<T15, T16, T17, T18, T19, T20, T21>>> value, out T1 item1, out T2 item2, out T3 item3, out T4 item4, out T5 item5, out T6 item6, out T7 item7, out T8 item8, out T9 item9, out T10 item10, out T11 item11, out T12 item12, out T13 item13, out T14 item14, out T15 item15, out T16 item16, out T17 item17, out T18 item18, out T19 item19, out T20 item20, out T21 item21)
		{
			item1 = value.Item1;
			item2 = value.Item2;
			item3 = value.Item3;
			item4 = value.Item4;
			item5 = value.Item5;
			item6 = value.Item6;
			item7 = value.Item7;
			item8 = value.Rest.Item1;
			item9 = value.Rest.Item2;
			item10 = value.Rest.Item3;
			item11 = value.Rest.Item4;
			item12 = value.Rest.Item5;
			item13 = value.Rest.Item6;
			item14 = value.Rest.Item7;
			item15 = value.Rest.Rest.Item1;
			item16 = value.Rest.Rest.Item2;
			item17 = value.Rest.Rest.Item3;
			item18 = value.Rest.Rest.Item4;
			item19 = value.Rest.Rest.Item5;
			item20 = value.Rest.Rest.Item6;
			item21 = value.Rest.Rest.Item7;
		}

		public static ValueTuple<T1> ToValueTuple<T1>(this Tuple<T1> value)
		{
			return ValueTuple.Create(value.Item1);
		}

		public static (T1, T2) ToValueTuple<T1, T2>(this Tuple<T1, T2> value)
		{
			return ValueTuple.Create(value.Item1, value.Item2);
		}

		public static (T1, T2, T3) ToValueTuple<T1, T2, T3>(this Tuple<T1, T2, T3> value)
		{
			return ValueTuple.Create(value.Item1, value.Item2, value.Item3);
		}

		public static (T1, T2, T3, T4) ToValueTuple<T1, T2, T3, T4>(this Tuple<T1, T2, T3, T4> value)
		{
			return ValueTuple.Create(value.Item1, value.Item2, value.Item3, value.Item4);
		}

		public static (T1, T2, T3, T4, T5) ToValueTuple<T1, T2, T3, T4, T5>(this Tuple<T1, T2, T3, T4, T5> value)
		{
			return ValueTuple.Create(value.Item1, value.Item2, value.Item3, value.Item4, value.Item5);
		}

		public static (T1, T2, T3, T4, T5, T6) ToValueTuple<T1, T2, T3, T4, T5, T6>(this Tuple<T1, T2, T3, T4, T5, T6> value)
		{
			return ValueTuple.Create(value.Item1, value.Item2, value.Item3, value.Item4, value.Item5, value.Item6);
		}

		public static (T1, T2, T3, T4, T5, T6, T7) ToValueTuple<T1, T2, T3, T4, T5, T6, T7>(this Tuple<T1, T2, T3, T4, T5, T6, T7> value)
		{
			return ValueTuple.Create(value.Item1, value.Item2, value.Item3, value.Item4, value.Item5, value.Item6, value.Item7);
		}

		public static (T1, T2, T3, T4, T5, T6, T7, T8) ToValueTuple<T1, T2, T3, T4, T5, T6, T7, T8>(this Tuple<T1, T2, T3, T4, T5, T6, T7, Tuple<T8>> value)
		{
			return CreateLong(value.Item1, value.Item2, value.Item3, value.Item4, value.Item5, value.Item6, value.Item7, ValueTuple.Create(value.Rest.Item1));
		}

		public static (T1, T2, T3, T4, T5, T6, T7, T8, T9) ToValueTuple<T1, T2, T3, T4, T5, T6, T7, T8, T9>(this Tuple<T1, T2, T3, T4, T5, T6, T7, Tuple<T8, T9>> value)
		{
			return CreateLong<T1, T2, T3, T4, T5, T6, T7, (T8, T9)>(value.Item1, value.Item2, value.Item3, value.Item4, value.Item5, value.Item6, value.Item7, ValueTuple.Create(value.Rest.Item1, value.Rest.Item2));
		}

		public static (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10) ToValueTuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(this Tuple<T1, T2, T3, T4, T5, T6, T7, Tuple<T8, T9, T10>> value)
		{
			return CreateLong<T1, T2, T3, T4, T5, T6, T7, (T8, T9, T10)>(value.Item1, value.Item2, value.Item3, value.Item4, value.Item5, value.Item6, value.Item7, ValueTuple.Create(value.Rest.Item1, value.Rest.Item2, value.Rest.Item3));
		}

		public static (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11) ToValueTuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(this Tuple<T1, T2, T3, T4, T5, T6, T7, Tuple<T8, T9, T10, T11>> value)
		{
			return CreateLong<T1, T2, T3, T4, T5, T6, T7, (T8, T9, T10, T11)>(value.Item1, value.Item2, value.Item3, value.Item4, value.Item5, value.Item6, value.Item7, ValueTuple.Create(value.Rest.Item1, value.Rest.Item2, value.Rest.Item3, value.Rest.Item4));
		}

		public static (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12) ToValueTuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(this Tuple<T1, T2, T3, T4, T5, T6, T7, Tuple<T8, T9, T10, T11, T12>> value)
		{
			return CreateLong<T1, T2, T3, T4, T5, T6, T7, (T8, T9, T10, T11, T12)>(value.Item1, value.Item2, value.Item3, value.Item4, value.Item5, value.Item6, value.Item7, ValueTuple.Create(value.Rest.Item1, value.Rest.Item2, value.Rest.Item3, value.Rest.Item4, value.Rest.Item5));
		}

		public static (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13) ToValueTuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>(this Tuple<T1, T2, T3, T4, T5, T6, T7, Tuple<T8, T9, T10, T11, T12, T13>> value)
		{
			return CreateLong<T1, T2, T3, T4, T5, T6, T7, (T8, T9, T10, T11, T12, T13)>(value.Item1, value.Item2, value.Item3, value.Item4, value.Item5, value.Item6, value.Item7, ValueTuple.Create(value.Rest.Item1, value.Rest.Item2, value.Rest.Item3, value.Rest.Item4, value.Rest.Item5, value.Rest.Item6));
		}

		public static (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14) ToValueTuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>(this Tuple<T1, T2, T3, T4, T5, T6, T7, Tuple<T8, T9, T10, T11, T12, T13, T14>> value)
		{
			return CreateLong<T1, T2, T3, T4, T5, T6, T7, (T8, T9, T10, T11, T12, T13, T14)>(value.Item1, value.Item2, value.Item3, value.Item4, value.Item5, value.Item6, value.Item7, ValueTuple.Create(value.Rest.Item1, value.Rest.Item2, value.Rest.Item3, value.Rest.Item4, value.Rest.Item5, value.Rest.Item6, value.Rest.Item7));
		}

		public static (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15) ToValueTuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>(this Tuple<T1, T2, T3, T4, T5, T6, T7, Tuple<T8, T9, T10, T11, T12, T13, T14, Tuple<T15>>> value)
		{
			return CreateLong(value.Item1, value.Item2, value.Item3, value.Item4, value.Item5, value.Item6, value.Item7, CreateLong(value.Rest.Item1, value.Rest.Item2, value.Rest.Item3, value.Rest.Item4, value.Rest.Item5, value.Rest.Item6, value.Rest.Item7, ValueTuple.Create(value.Rest.Rest.Item1)));
		}

		public static (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16) ToValueTuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>(this Tuple<T1, T2, T3, T4, T5, T6, T7, Tuple<T8, T9, T10, T11, T12, T13, T14, Tuple<T15, T16>>> value)
		{
			return CreateLong(value.Item1, value.Item2, value.Item3, value.Item4, value.Item5, value.Item6, value.Item7, CreateLong<T8, T9, T10, T11, T12, T13, T14, (T15, T16)>(value.Rest.Item1, value.Rest.Item2, value.Rest.Item3, value.Rest.Item4, value.Rest.Item5, value.Rest.Item6, value.Rest.Item7, ValueTuple.Create(value.Rest.Rest.Item1, value.Rest.Rest.Item2)));
		}

		public static (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17) ToValueTuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17>(this Tuple<T1, T2, T3, T4, T5, T6, T7, Tuple<T8, T9, T10, T11, T12, T13, T14, Tuple<T15, T16, T17>>> value)
		{
			return CreateLong(value.Item1, value.Item2, value.Item3, value.Item4, value.Item5, value.Item6, value.Item7, CreateLong<T8, T9, T10, T11, T12, T13, T14, (T15, T16, T17)>(value.Rest.Item1, value.Rest.Item2, value.Rest.Item3, value.Rest.Item4, value.Rest.Item5, value.Rest.Item6, value.Rest.Item7, ValueTuple.Create(value.Rest.Rest.Item1, value.Rest.Rest.Item2, value.Rest.Rest.Item3)));
		}

		public static (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18) ToValueTuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18>(this Tuple<T1, T2, T3, T4, T5, T6, T7, Tuple<T8, T9, T10, T11, T12, T13, T14, Tuple<T15, T16, T17, T18>>> value)
		{
			return CreateLong(value.Item1, value.Item2, value.Item3, value.Item4, value.Item5, value.Item6, value.Item7, CreateLong<T8, T9, T10, T11, T12, T13, T14, (T15, T16, T17, T18)>(value.Rest.Item1, value.Rest.Item2, value.Rest.Item3, value.Rest.Item4, value.Rest.Item5, value.Rest.Item6, value.Rest.Item7, ValueTuple.Create(value.Rest.Rest.Item1, value.Rest.Rest.Item2, value.Rest.Rest.Item3, value.Rest.Rest.Item4)));
		}

		public static (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19) ToValueTuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19>(this Tuple<T1, T2, T3, T4, T5, T6, T7, Tuple<T8, T9, T10, T11, T12, T13, T14, Tuple<T15, T16, T17, T18, T19>>> value)
		{
			return CreateLong(value.Item1, value.Item2, value.Item3, value.Item4, value.Item5, value.Item6, value.Item7, CreateLong<T8, T9, T10, T11, T12, T13, T14, (T15, T16, T17, T18, T19)>(value.Rest.Item1, value.Rest.Item2, value.Rest.Item3, value.Rest.Item4, value.Rest.Item5, value.Rest.Item6, value.Rest.Item7, ValueTuple.Create(value.Rest.Rest.Item1, value.Rest.Rest.Item2, value.Rest.Rest.Item3, value.Rest.Rest.Item4, value.Rest.Rest.Item5)));
		}

		public static (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20) ToValueTuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20>(this Tuple<T1, T2, T3, T4, T5, T6, T7, Tuple<T8, T9, T10, T11, T12, T13, T14, Tuple<T15, T16, T17, T18, T19, T20>>> value)
		{
			return CreateLong(value.Item1, value.Item2, value.Item3, value.Item4, value.Item5, value.Item6, value.Item7, CreateLong<T8, T9, T10, T11, T12, T13, T14, (T15, T16, T17, T18, T19, T20)>(value.Rest.Item1, value.Rest.Item2, value.Rest.Item3, value.Rest.Item4, value.Rest.Item5, value.Rest.Item6, value.Rest.Item7, ValueTuple.Create(value.Rest.Rest.Item1, value.Rest.Rest.Item2, value.Rest.Rest.Item3, value.Rest.Rest.Item4, value.Rest.Rest.Item5, value.Rest.Rest.Item6)));
		}

		public static (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21) ToValueTuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21>(this Tuple<T1, T2, T3, T4, T5, T6, T7, Tuple<T8, T9, T10, T11, T12, T13, T14, Tuple<T15, T16, T17, T18, T19, T20, T21>>> value)
		{
			return CreateLong(value.Item1, value.Item2, value.Item3, value.Item4, value.Item5, value.Item6, value.Item7, CreateLong<T8, T9, T10, T11, T12, T13, T14, (T15, T16, T17, T18, T19, T20, T21)>(value.Rest.Item1, value.Rest.Item2, value.Rest.Item3, value.Rest.Item4, value.Rest.Item5, value.Rest.Item6, value.Rest.Item7, ValueTuple.Create(value.Rest.Rest.Item1, value.Rest.Rest.Item2, value.Rest.Rest.Item3, value.Rest.Rest.Item4, value.Rest.Rest.Item5, value.Rest.Rest.Item6, value.Rest.Rest.Item7)));
		}

		public static Tuple<T1> ToTuple<T1>(this ValueTuple<T1> value)
		{
			return Tuple.Create(value.Item1);
		}

		public static Tuple<T1, T2> ToTuple<T1, T2>(this (T1, T2) value)
		{
			return Tuple.Create(value.Item1, value.Item2);
		}

		public static Tuple<T1, T2, T3> ToTuple<T1, T2, T3>(this (T1, T2, T3) value)
		{
			return Tuple.Create(value.Item1, value.Item2, value.Item3);
		}

		public static Tuple<T1, T2, T3, T4> ToTuple<T1, T2, T3, T4>(this (T1, T2, T3, T4) value)
		{
			return Tuple.Create(value.Item1, value.Item2, value.Item3, value.Item4);
		}

		public static Tuple<T1, T2, T3, T4, T5> ToTuple<T1, T2, T3, T4, T5>(this (T1, T2, T3, T4, T5) value)
		{
			return Tuple.Create(value.Item1, value.Item2, value.Item3, value.Item4, value.Item5);
		}

		public static Tuple<T1, T2, T3, T4, T5, T6> ToTuple<T1, T2, T3, T4, T5, T6>(this (T1, T2, T3, T4, T5, T6) value)
		{
			return Tuple.Create(value.Item1, value.Item2, value.Item3, value.Item4, value.Item5, value.Item6);
		}

		public static Tuple<T1, T2, T3, T4, T5, T6, T7> ToTuple<T1, T2, T3, T4, T5, T6, T7>(this (T1, T2, T3, T4, T5, T6, T7) value)
		{
			return Tuple.Create(value.Item1, value.Item2, value.Item3, value.Item4, value.Item5, value.Item6, value.Item7);
		}

		public static Tuple<T1, T2, T3, T4, T5, T6, T7, Tuple<T8>> ToTuple<T1, T2, T3, T4, T5, T6, T7, T8>(this (T1, T2, T3, T4, T5, T6, T7, T8) value)
		{
			return CreateLongRef(value.Item1, value.Item2, value.Item3, value.Item4, value.Item5, value.Item6, value.Item7, Tuple.Create(value.Rest.Item1));
		}

		public static Tuple<T1, T2, T3, T4, T5, T6, T7, Tuple<T8, T9>> ToTuple<T1, T2, T3, T4, T5, T6, T7, T8, T9>(this (T1, T2, T3, T4, T5, T6, T7, T8, T9) value)
		{
			return CreateLongRef(value.Item1, value.Item2, value.Item3, value.Item4, value.Item5, value.Item6, value.Item7, Tuple.Create(value.Rest.Item1, value.Rest.Item2));
		}

		public static Tuple<T1, T2, T3, T4, T5, T6, T7, Tuple<T8, T9, T10>> ToTuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(this (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10) value)
		{
			return CreateLongRef(value.Item1, value.Item2, value.Item3, value.Item4, value.Item5, value.Item6, value.Item7, Tuple.Create(value.Rest.Item1, value.Rest.Item2, value.Rest.Item3));
		}

		public static Tuple<T1, T2, T3, T4, T5, T6, T7, Tuple<T8, T9, T10, T11>> ToTuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(this (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11) value)
		{
			return CreateLongRef(value.Item1, value.Item2, value.Item3, value.Item4, value.Item5, value.Item6, value.Item7, Tuple.Create(value.Rest.Item1, value.Rest.Item2, value.Rest.Item3, value.Rest.Item4));
		}

		public static Tuple<T1, T2, T3, T4, T5, T6, T7, Tuple<T8, T9, T10, T11, T12>> ToTuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(this (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12) value)
		{
			return CreateLongRef(value.Item1, value.Item2, value.Item3, value.Item4, value.Item5, value.Item6, value.Item7, Tuple.Create(value.Rest.Item1, value.Rest.Item2, value.Rest.Item3, value.Rest.Item4, value.Rest.Item5));
		}

		public static Tuple<T1, T2, T3, T4, T5, T6, T7, Tuple<T8, T9, T10, T11, T12, T13>> ToTuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>(this (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13) value)
		{
			return CreateLongRef(value.Item1, value.Item2, value.Item3, value.Item4, value.Item5, value.Item6, value.Item7, Tuple.Create(value.Rest.Item1, value.Rest.Item2, value.Rest.Item3, value.Rest.Item4, value.Rest.Item5, value.Rest.Item6));
		}

		public static Tuple<T1, T2, T3, T4, T5, T6, T7, Tuple<T8, T9, T10, T11, T12, T13, T14>> ToTuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>(this (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14) value)
		{
			return CreateLongRef(value.Item1, value.Item2, value.Item3, value.Item4, value.Item5, value.Item6, value.Item7, Tuple.Create(value.Rest.Item1, value.Rest.Item2, value.Rest.Item3, value.Rest.Item4, value.Rest.Item5, value.Rest.Item6, value.Rest.Item7));
		}

		public static Tuple<T1, T2, T3, T4, T5, T6, T7, Tuple<T8, T9, T10, T11, T12, T13, T14, Tuple<T15>>> ToTuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>(this (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15) value)
		{
			return CreateLongRef(value.Item1, value.Item2, value.Item3, value.Item4, value.Item5, value.Item6, value.Item7, CreateLongRef(value.Rest.Item1, value.Rest.Item2, value.Rest.Item3, value.Rest.Item4, value.Rest.Item5, value.Rest.Item6, value.Rest.Item7, Tuple.Create(value.Rest.Rest.Item1)));
		}

		public static Tuple<T1, T2, T3, T4, T5, T6, T7, Tuple<T8, T9, T10, T11, T12, T13, T14, Tuple<T15, T16>>> ToTuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>(this (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16) value)
		{
			return CreateLongRef(value.Item1, value.Item2, value.Item3, value.Item4, value.Item5, value.Item6, value.Item7, CreateLongRef(value.Rest.Item1, value.Rest.Item2, value.Rest.Item3, value.Rest.Item4, value.Rest.Item5, value.Rest.Item6, value.Rest.Item7, Tuple.Create(value.Rest.Rest.Item1, value.Rest.Rest.Item2)));
		}

		public static Tuple<T1, T2, T3, T4, T5, T6, T7, Tuple<T8, T9, T10, T11, T12, T13, T14, Tuple<T15, T16, T17>>> ToTuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17>(this (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17) value)
		{
			return CreateLongRef(value.Item1, value.Item2, value.Item3, value.Item4, value.Item5, value.Item6, value.Item7, CreateLongRef(value.Rest.Item1, value.Rest.Item2, value.Rest.Item3, value.Rest.Item4, value.Rest.Item5, value.Rest.Item6, value.Rest.Item7, Tuple.Create(value.Rest.Rest.Item1, value.Rest.Rest.Item2, value.Rest.Rest.Item3)));
		}

		public static Tuple<T1, T2, T3, T4, T5, T6, T7, Tuple<T8, T9, T10, T11, T12, T13, T14, Tuple<T15, T16, T17, T18>>> ToTuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18>(this (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18) value)
		{
			return CreateLongRef(value.Item1, value.Item2, value.Item3, value.Item4, value.Item5, value.Item6, value.Item7, CreateLongRef(value.Rest.Item1, value.Rest.Item2, value.Rest.Item3, value.Rest.Item4, value.Rest.Item5, value.Rest.Item6, value.Rest.Item7, Tuple.Create(value.Rest.Rest.Item1, value.Rest.Rest.Item2, value.Rest.Rest.Item3, value.Rest.Rest.Item4)));
		}

		public static Tuple<T1, T2, T3, T4, T5, T6, T7, Tuple<T8, T9, T10, T11, T12, T13, T14, Tuple<T15, T16, T17, T18, T19>>> ToTuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19>(this (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19) value)
		{
			return CreateLongRef(value.Item1, value.Item2, value.Item3, value.Item4, value.Item5, value.Item6, value.Item7, CreateLongRef(value.Rest.Item1, value.Rest.Item2, value.Rest.Item3, value.Rest.Item4, value.Rest.Item5, value.Rest.Item6, value.Rest.Item7, Tuple.Create(value.Rest.Rest.Item1, value.Rest.Rest.Item2, value.Rest.Rest.Item3, value.Rest.Rest.Item4, value.Rest.Rest.Item5)));
		}

		public static Tuple<T1, T2, T3, T4, T5, T6, T7, Tuple<T8, T9, T10, T11, T12, T13, T14, Tuple<T15, T16, T17, T18, T19, T20>>> ToTuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20>(this (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20) value)
		{
			return CreateLongRef(value.Item1, value.Item2, value.Item3, value.Item4, value.Item5, value.Item6, value.Item7, CreateLongRef(value.Rest.Item1, value.Rest.Item2, value.Rest.Item3, value.Rest.Item4, value.Rest.Item5, value.Rest.Item6, value.Rest.Item7, Tuple.Create(value.Rest.Rest.Item1, value.Rest.Rest.Item2, value.Rest.Rest.Item3, value.Rest.Rest.Item4, value.Rest.Rest.Item5, value.Rest.Rest.Item6)));
		}

		public static Tuple<T1, T2, T3, T4, T5, T6, T7, Tuple<T8, T9, T10, T11, T12, T13, T14, Tuple<T15, T16, T17, T18, T19, T20, T21>>> ToTuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21>(this (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21) value)
		{
			return CreateLongRef(value.Item1, value.Item2, value.Item3, value.Item4, value.Item5, value.Item6, value.Item7, CreateLongRef(value.Rest.Item1, value.Rest.Item2, value.Rest.Item3, value.Rest.Item4, value.Rest.Item5, value.Rest.Item6, value.Rest.Item7, Tuple.Create(value.Rest.Rest.Item1, value.Rest.Rest.Item2, value.Rest.Rest.Item3, value.Rest.Rest.Item4, value.Rest.Rest.Item5, value.Rest.Rest.Item6, value.Rest.Rest.Item7)));
		}

		private static ValueTuple<T1, T2, T3, T4, T5, T6, T7, TRest> CreateLong<T1, T2, T3, T4, T5, T6, T7, TRest>(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6, T7 item7, TRest rest) where TRest : struct
		{
			return new ValueTuple<T1, T2, T3, T4, T5, T6, T7, TRest>(item1, item2, item3, item4, item5, item6, item7, rest);
		}

		private static Tuple<T1, T2, T3, T4, T5, T6, T7, TRest> CreateLongRef<T1, T2, T3, T4, T5, T6, T7, TRest>(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6, T7 item7, TRest rest)
		{
			return new Tuple<T1, T2, T3, T4, T5, T6, T7, TRest>(item1, item2, item3, item4, item5, item6, item7, rest);
		}
	}
	internal interface ITupleInternal
	{
		int Size { get; }

		int GetHashCode(IEqualityComparer comparer);

		string ToStringEnd();
	}
	[StructLayout(LayoutKind.Sequential, Size = 1)]
	public struct ValueTuple : IEquatable<ValueTuple>, IStructuralEquatable, IStructuralComparable, IComparable, IComparable<ValueTuple>, System.ITupleInternal
	{
		int System.ITupleInternal.Size => 0;

		public override bool Equals(object obj)
		{
			return obj is ValueTuple;
		}

		public bool Equals(ValueTuple other)
		{
			return true;
		}

		bool IStructuralEquatable.Equals(object other, IEqualityComparer comparer)
		{
			return other is ValueTuple;
		}

		int IComparable.CompareTo(object other)
		{
			if (other == null)
			{
				return 1;
			}
			if (!(other is ValueTuple))
			{
				throw new ArgumentException(System.SR.ArgumentException_ValueTupleIncorrectType, "other");
			}
			return 0;
		}

		public int CompareTo(ValueTuple other)
		{
			return 0;
		}

		int IStructuralComparable.CompareTo(object other, IComparer comparer)
		{
			if (other == null)
			{
				return 1;
			}
			if (!(other is ValueTuple))
			{
				throw new ArgumentException(System.SR.ArgumentException_ValueTupleIncorrectType, "other");
			}
			return 0;
		}

		public override int GetHashCode()
		{
			return 0;
		}

		int IStructuralEquatable.GetHashCode(IEqualityComparer comparer)
		{
			return 0;
		}

		int System.ITupleInternal.GetHashCode(IEqualityComparer comparer)
		{
			return 0;
		}

		public override string ToString()
		{
			return "()";
		}

		string System.ITupleInternal.ToStringEnd()
		{
			return ")";
		}

		public static ValueTuple Create()
		{
			return default(ValueTuple);
		}

		public static ValueTuple<T1> Create<T1>(T1 item1)
		{
			return new ValueTuple<T1>(item1);
		}

		public static (T1, T2) Create<T1, T2>(T1 item1, T2 item2)
		{
			return (item1, item2);
		}

		public static (T1, T2, T3) Create<T1, T2, T3>(T1 item1, T2 item2, T3 item3)
		{
			return (item1, item2, item3);
		}

		public static (T1, T2, T3, T4) Create<T1, T2, T3, T4>(T1 item1, T2 item2, T3 item3, T4 item4)
		{
			return (item1, item2, item3, item4);
		}

		public static (T1, T2, T3, T4, T5) Create<T1, T2, T3, T4, T5>(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5)
		{
			return (item1, item2, item3, item4, item5);
		}

		public static (T1, T2, T3, T4, T5, T6) Create<T1, T2, T3, T4, T5, T6>(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6)
		{
			return (item1, item2, item3, item4, item5, item6);
		}

		public static (T1, T2, T3, T4, T5, T6, T7) Create<T1, T2, T3, T4, T5, T6, T7>(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6, T7 item7)
		{
			return (item1, item2, item3, item4, item5, item6, item7);
		}

		public static (T1, T2, T3, T4, T5, T6, T7, T8) Create<T1, T2, T3, T4, T5, T6, T7, T8>(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6, T7 item7, T8 item8)
		{
			return new ValueTuple<T1, T2, T3, T4, T5, T6, T7, ValueTuple<T8>>(item1, item2, item3, item4, item5, item6, item7, Create(item8));
		}

		internal static int CombineHashCodes(int h1, int h2)
		{
			return HashHelpers.Combine(HashHelpers.Combine(HashHelpers.RandomSeed, h1), h2);
		}

		internal static int CombineHashCodes(int h1, int h2, int h3)
		{
			return HashHelpers.Combine(CombineHashCodes(h1, h2), h3);
		}

		internal static int CombineHashCodes(int h1, int h2, int h3, int h4)
		{
			return HashHelpers.Combine(CombineHashCodes(h1, h2, h3), h4);
		}

		internal static int CombineHashCodes(int h1, int h2, int h3, int h4, int h5)
		{
			return HashHelpers.Combine(CombineHashCodes(h1, h2, h3, h4), h5);
		}

		internal static int CombineHashCodes(int h1, int h2, int h3, int h4, int h5, int h6)
		{
			return HashHelpers.Combine(CombineHashCodes(h1, h2, h3, h4, h5), h6);
		}

		internal static int CombineHashCodes(int h1, int h2, int h3, int h4, int h5, int h6, int h7)
		{
			return HashHelpers.Combine(CombineHashCodes(h1, h2, h3, h4, h5, h6), h7);
		}

		internal static int CombineHashCodes(int h1, int h2, int h3, int h4, int h5, int h6, int h7, int h8)
		{
			return HashHelpers.Combine(CombineHashCodes(h1, h2, h3, h4, h5, h6, h7), h8);
		}
	}
	public struct ValueTuple<T1> : IEquatable<ValueTuple<T1>>, IStructuralEquatable, IStructuralComparable, IComparable, IComparable<ValueTuple<T1>>, System.ITupleInternal
	{
		private static readonly EqualityComparer<T1> s_t1Comparer = EqualityComparer<T1>.Default;

		public T1 Item1;

		int System.ITupleInternal.Size => 1;

		public ValueTuple(T1 item1)
		{
			Item1 = item1;
		}

		public override bool Equals(object obj)
		{
			if (obj is ValueTuple<T1>)
			{
				return Equals((ValueTuple<T1>)obj);
			}
			return false;
		}

		public bool Equals(ValueTuple<T1> other)
		{
			return s_t1Comparer.Equals(Item1, other.Item1);
		}

		bool IStructuralEquatable.Equals(object other, IEqualityComparer comparer)
		{
			if (other == null || !(other is ValueTuple<T1> valueTuple))
			{
				return false;
			}
			return comparer.Equals(Item1, valueTuple.Item1);
		}

		int IComparable.CompareTo(object other)
		{
			if (other == null)
			{
				return 1;
			}
			if (!(other is ValueTuple<T1> valueTuple))
			{
				throw new ArgumentException(System.SR.ArgumentException_ValueTupleIncorrectType, "other");
			}
			return Comparer<T1>.Default.Compare(Item1, valueTuple.Item1);
		}

		public int CompareTo(ValueTuple<T1> other)
		{
			return Comparer<T1>.Default.Compare(Item1, other.Item1);
		}

		int IStructuralComparable.CompareTo(object other, IComparer comparer)
		{
			if (other == null)
			{
				return 1;
			}
			if (!(other is ValueTuple<T1> valueTuple))
			{
				throw new ArgumentException(System.SR.ArgumentException_ValueTupleIncorrectType, "other");
			}
			return comparer.Compare(Item1, valueTuple.Item1);
		}

		public override int GetHashCode()
		{
			return s_t1Comparer.GetHashCode(Item1);
		}

		int IStructuralEquatable.GetHashCode(IEqualityComparer comparer)
		{
			return comparer.GetHashCode(Item1);
		}

		int System.ITupleInternal.GetHashCode(IEqualityComparer comparer)
		{
			return comparer.GetHashCode(Item1);
		}

		public override string ToString()
		{
			return "(" + Item1?.ToString() + ")";
		}

		string System.ITupleInternal.ToStringEnd()
		{
			return Item1?.ToString() + ")";
		}
	}
	[StructLayout(LayoutKind.Auto)]
	public struct ValueTuple<T1, T2> : IEquatable<(T1, T2)>, IStructuralEquatable, IStructuralComparable, IComparable, IComparable<(T1, T2)>, System.ITupleInternal
	{
		private static readonly EqualityComparer<T1> s_t1Comparer = EqualityComparer<T1>.Default;

		private static readonly EqualityComparer<T2> s_t2Comparer = EqualityComparer<T2>.Default;

		public T1 Item1;

		public T2 Item2;

		int System.ITupleInternal.Size => 2;

		public ValueTuple(T1 item1, T2 item2)
		{
			Item1 = item1;
			Item2 = item2;
		}

		public override bool Equals(object obj)
		{
			if (obj is ValueTuple<T1, T2>)
			{
				return Equals(((T1, T2))obj);
			}
			return false;
		}

		public bool Equals((T1, T2) other)
		{
			if (s_t1Comparer.Equals(Item1, other.Item1))
			{
				return s_t2Comparer.Equals(Item2, other.Item2);
			}
			return false;
		}

		bool IStructuralEquatable.Equals(object other, IEqualityComparer comparer)
		{
			if (other == null || !(other is (T1, T2) tuple))
			{
				return false;
			}
			if (comparer.Equals(Item1, tuple.Item1))
			{
				return comparer.Equals(Item2, tuple.Item2);
			}
			return false;
		}

		int IComparable.CompareTo(object other)
		{
			if (other == null)
			{
				return 1;
			}
			if (!(other is ValueTuple<T1, T2>))
			{
				throw new ArgumentException(System.SR.ArgumentException_ValueTupleIncorrectType, "other");
			}
			return CompareTo(((T1, T2))other);
		}

		public int CompareTo((T1, T2) other)
		{
			int num = Comparer<T1>.Default.Compare(Item1, other.Item1);
			if (num != 0)
			{
				return num;
			}
			return Comparer<T2>.Default.Compare(Item2, other.Item2);
		}

		int IStructuralComparable.CompareTo(object other, IComparer comparer)
		{
			if (other == null)
			{
				return 1;
			}
			if (!(other is (T1, T2) tuple))
			{
				throw new ArgumentException(System.SR.ArgumentException_ValueTupleIncorrectType, "other");
			}
			int num = comparer.Compare(Item1, tuple.Item1);
			if (num != 0)
			{
				return num;
			}
			return comparer.Compare(Item2, tuple.Item2);
		}

		public override int GetHashCode()
		{
			return ValueTuple.CombineHashCodes(s_t1Comparer.GetHashCode(Item1), s_t2Comparer.GetHashCode(Item2));
		}

		int IStructuralEquatable.GetHashCode(IEqualityComparer comparer)
		{
			return GetHashCodeCore(comparer);
		}

		private int GetHashCodeCore(IEqualityComparer comparer)
		{
			return ValueTuple.CombineHashCodes(comparer.GetHashCode(Item1), comparer.GetHashCode(Item2));
		}

		int System.ITupleInternal.GetHashCode(IEqualityComparer comparer)
		{
			return GetHashCodeCore(comparer);
		}

		public override string ToString()
		{
			return "(" + Item1?.ToString() + ", " + Item2?.ToString() + ")";
		}

		string System.ITupleInternal.ToStringEnd()
		{
			return Item1?.ToString() + ", " + Item2?.ToString() + ")";
		}
	}
	[StructLayout(LayoutKind.Auto)]
	public struct ValueTuple<T1, T2, T3> : IEquatable<(T1, T2, T3)>, IStructuralEquatable, IStructuralComparable, IComparable, IComparable<(T1, T2, T3)>, System.ITupleInternal
	{
		private static readonly EqualityComparer<T1> s_t1Comparer = EqualityComparer<T1>.Default;

		private static readonly EqualityComparer<T2> s_t2Comparer = EqualityComparer<T2>.Default;

		private static readonly EqualityComparer<T3> s_t3Comparer = EqualityComparer<T3>.Default;

		public T1 Item1;

		public T2 Item2;

		public T3 Item3;

		int System.ITupleInternal.Size => 3;

		public ValueTuple(T1 item1, T2 item2, T3 item3)
		{
			Item1 = item1;
			Item2 = item2;
			Item3 = item3;
		}

		public override bool Equals(object obj)
		{
			if (obj is ValueTuple<T1, T2, T3>)
			{
				return Equals(((T1, T2, T3))obj);
			}
			return false;
		}

		public bool Equals((T1, T2, T3) other)
		{
			if (s_t1Comparer.Equals(Item1, other.Item1) && s_t2Comparer.Equals(Item2, other.Item2))
			{
				return s_t3Comparer.Equals(Item3, other.Item3);
			}
			return false;
		}

		bool IStructuralEquatable.Equals(object other, IEqualityComparer comparer)
		{
			if (other == null || !(other is (T1, T2, T3) tuple))
			{
				return false;
			}
			if (comparer.Equals(Item1, tuple.Item1) && comparer.Equals(Item2, tuple.Item2))
			{
				return comparer.Equals(Item3, tuple.Item3);
			}
			return false;
		}

		int IComparable.CompareTo(object other)
		{
			if (other == null)
			{
				return 1;
			}
			if (!(other is ValueTuple<T1, T2, T3>))
			{
				throw new ArgumentException(System.SR.ArgumentException_ValueTupleIncorrectType, "other");
			}
			return CompareTo(((T1, T2, T3))other);
		}

		public int CompareTo((T1, T2, T3) other)
		{
			int num = Comparer<T1>.Default.Compare(Item1, other.Item1);
			if (num != 0)
			{
				return num;
			}
			num = Comparer<T2>.Default.Compare(Item2, other.Item2);
			if (num != 0)
			{
				return num;
			}
			return Comparer<T3>.Default.Compare(Item3, other.Item3);
		}

		int IStructuralComparable.CompareTo(object other, IComparer comparer)
		{
			if (other == null)
			{
				return 1;
			}
			if (!(other is (T1, T2, T3) tuple))
			{
				throw new ArgumentException(System.SR.ArgumentException_ValueTupleIncorrectType, "other");
			}
			int num = comparer.Compare(Item1, tuple.Item1);
			if (num != 0)
			{
				return num;
			}
			num = comparer.Compare(Item2, tuple.Item2);
			if (num != 0)
			{
				return num;
			}
			return comparer.Compare(Item3, tuple.Item3);
		}

		public override int GetHashCode()
		{
			return ValueTuple.CombineHashCodes(s_t1Comparer.GetHashCode(Item1), s_t2Comparer.GetHashCode(Item2), s_t3Comparer.GetHashCode(Item3));
		}

		int IStructuralEquatable.GetHashCode(IEqualityComparer comparer)
		{
			return GetHashCodeCore(comparer);
		}

		private int GetHashCodeCore(IEqualityComparer comparer)
		{
			return ValueTuple.CombineHashCodes(comparer.GetHashCode(Item1), comparer.GetHashCode(Item2), comparer.GetHashCode(Item3));
		}

		int System.ITupleInternal.GetHashCode(IEqualityComparer comparer)
		{
			return GetHashCodeCore(comparer);
		}

		public override string ToString()
		{
			return "(" + Item1?.ToString() + ", " + Item2?.ToString() + ", " + Item3?.ToString() + ")";
		}

		string System.ITupleInternal.ToStringEnd()
		{
			return Item1?.ToString() + ", " + Item2?.ToString() + ", " + Item3?.ToString() + ")";
		}
	}
	[StructLayout(LayoutKind.Auto)]
	public struct ValueTuple<T1, T2, T3, T4> : IEquatable<(T1, T2, T3, T4)>, IStructuralEquatable, IStructuralComparable, IComparable, IComparable<(T1, T2, T3, T4)>, System.ITupleInternal
	{
		private static readonly EqualityComparer<T1> s_t1Comparer = EqualityComparer<T1>.Default;

		private static readonly EqualityComparer<T2> s_t2Comparer = EqualityComparer<T2>.Default;

		private static readonly EqualityComparer<T3> s_t3Comparer = EqualityComparer<T3>.Default;

		private static readonly EqualityComparer<T4> s_t4Comparer = EqualityComparer<T4>.Default;

		public T1 Item1;

		public T2 Item2;

		public T3 Item3;

		public T4 Item4;

		int System.ITupleInternal.Size => 4;

		public ValueTuple(T1 item1, T2 item2, T3 item3, T4 item4)
		{
			Item1 = item1;
			Item2 = item2;
			Item3 = item3;
			Item4 = item4;
		}

		public override bool Equals(object obj)
		{
			if (obj is ValueTuple<T1, T2, T3, T4>)
			{
				return Equals(((T1, T2, T3, T4))obj);
			}
			return false;
		}

		public bool Equals((T1, T2, T3, T4) other)
		{
			if (s_t1Comparer.Equals(Item1, other.Item1) && s_t2Comparer.Equals(Item2, other.Item2) && s_t3Comparer.Equals(Item3, other.Item3))
			{
				return s_t4Comparer.Equals(Item4, other.Item4);
			}
			return false;
		}

		bool IStructuralEquatable.Equals(object other, IEqualityComparer comparer)
		{
			if (other == null || !(other is (T1, T2, T3, T4) tuple))
			{
				return false;
			}
			if (comparer.Equals(Item1, tuple.Item1) && comparer.Equals(Item2, tuple.Item2) && comparer.Equals(Item3, tuple.Item3))
			{
				return comparer.Equals(Item4, tuple.Item4);
			}
			return false;
		}

		int IComparable.CompareTo(object other)
		{
			if (other == null)
			{
				return 1;
			}
			if (!(other is ValueTuple<T1, T2, T3, T4>))
			{
				throw new ArgumentException(System.SR.ArgumentException_ValueTupleIncorrectType, "other");
			}
			return CompareTo(((T1, T2, T3, T4))other);
		}

		public int CompareTo((T1, T2, T3, T4) other)
		{
			int num = Comparer<T1>.Default.Compare(Item1, other.Item1);
			if (num != 0)
			{
				return num;
			}
			num = Comparer<T2>.Default.Compare(Item2, other.Item2);
			if (num != 0)
			{
				return num;
			}
			num = Comparer<T3>.Default.Compare(Item3, other.Item3);
			if (num != 0)
			{
				return num;
			}
			return Comparer<T4>.Default.Compare(Item4, other.Item4);
		}

		int IStructuralComparable.CompareTo(object other, IComparer comparer)
		{
			if (other == null)
			{
				return 1;
			}
			if (!(other is (T1, T2, T3, T4) tuple))
			{
				throw new ArgumentException(System.SR.ArgumentException_ValueTupleIncorrectType, "other");
			}
			int num = comparer.Compare(Item1, tuple.Item1);
			if (num != 0)
			{
				return num;
			}
			num = comparer.Compare(Item2, tuple.Item2);
			if (num != 0)
			{
				return num;
			}
			num = comparer.Compare(Item3, tuple.Item3);
			if (num != 0)
			{
				return num;
			}
			return comparer.Compare(Item4, tuple.Item4);
		}

		public override int GetHashCode()
		{
			return ValueTuple.CombineHashCodes(s_t1Comparer.GetHashCode(Item1), s_t2Comparer.GetHashCode(Item2), s_t3Comparer.GetHashCode(Item3), s_t4Comparer.GetHashCode(Item4));
		}

		int IStructuralEquatable.GetHashCode(IEqualityComparer comparer)
		{
			return GetHashCodeCore(comparer);
		}

		private int GetHashCodeCore(IEqualityComparer comparer)
		{
			return ValueTuple.CombineHashCodes(comparer.GetHashCode(Item1), comparer.GetHashCode(Item2), comparer.GetHashCode(Item3), comparer.GetHashCode(Item4));
		}

		int System.ITupleInternal.GetHashCode(IEqualityComparer comparer)
		{
			return GetHashCodeCore(comparer);
		}

		public override string ToString()
		{
			return "(" + Item1?.ToString() + ", " + Item2?.ToString() + ", " + Item3?.ToString() + ", " + Item4?.ToString() + ")";
		}

		string System.ITupleInternal.ToStringEnd()
		{
			return Item1?.ToString() + ", " + Item2?.ToString() + ", " + Item3?.ToString() + ", " + Item4?.ToString() + ")";
		}
	}
	[StructLayout(LayoutKind.Auto)]
	public struct ValueTuple<T1, T2, T3, T4, T5> : IEquatable<(T1, T2, T3, T4, T5)>, IStructuralEquatable, IStructuralComparable, IComparable, IComparable<(T1, T2, T3, T4, T5)>, System.ITupleInternal
	{
		private static readonly EqualityComparer<T1> s_t1Comparer = EqualityComparer<T1>.Default;

		private static readonly EqualityComparer<T2> s_t2Comparer = EqualityComparer<T2>.Default;

		private static readonly EqualityComparer<T3> s_t3Comparer = EqualityComparer<T3>.Default;

		private static readonly EqualityComparer<T4> s_t4Comparer = EqualityComparer<T4>.Default;

		private static readonly EqualityComparer<T5> s_t5Comparer = EqualityComparer<T5>.Default;

		public T1 Item1;

		public T2 Item2;

		public T3 Item3;

		public T4 Item4;

		public T5 Item5;

		int System.ITupleInternal.Size => 5;

		public ValueTuple(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5)
		{
			Item1 = item1;
			Item2 = item2;
			Item3 = item3;
			Item4 = item4;
			Item5 = item5;
		}

		public override bool Equals(object obj)
		{
			if (obj is ValueTuple<T1, T2, T3, T4, T5>)
			{
				return Equals(((T1, T2, T3, T4, T5))obj);
			}
			return false;
		}

		public bool Equals((T1, T2, T3, T4, T5) other)
		{
			if (s_t1Comparer.Equals(Item1, other.Item1) && s_t2Comparer.Equals(Item2, other.Item2) && s_t3Comparer.Equals(Item3, other.Item3) && s_t4Comparer.Equals(Item4, other.Item4))
			{
				return s_t5Comparer.Equals(Item5, other.Item5);
			}
			return false;
		}

		bool IStructuralEquatable.Equals(object other, IEqualityComparer comparer)
		{
			if (other == null || !(other is (T1, T2, T3, T4, T5) tuple))
			{
				return false;
			}
			if (comparer.Equals(Item1, tuple.Item1) && comparer.Equals(Item2, tuple.Item2) && comparer.Equals(Item3, tuple.Item3) && comparer.Equals(Item4, tuple.Item4))
			{
				return comparer.Equals(Item5, tuple.Item5);
			}
			return false;
		}

		int IComparable.CompareTo(object other)
		{
			if (other == null)
			{
				return 1;
			}
			if (!(other is ValueTuple<T1, T2, T3, T4, T5>))
			{
				throw new ArgumentException(System.SR.ArgumentException_ValueTupleIncorrectType, "other");
			}
			return CompareTo(((T1, T2, T3, T4, T5))other);
		}

		public int CompareTo((T1, T2, T3, T4, T5) other)
		{
			int num = Comparer<T1>.Default.Compare(Item1, other.Item1);
			if (num != 0)
			{
				return num;
			}
			num = Comparer<T2>.Default.Compare(Item2, other.Item2);
			if (num != 0)
			{
				return num;
			}
			num = Comparer<T3>.Default.Compare(Item3, other.Item3);
			if (num != 0)
			{
				return num;
			}
			num = Comparer<T4>.Default.Compare(Item4, other.Item4);
			if (num != 0)
			{
				return num;
			}
			return Comparer<T5>.Default.Compare(Item5, other.Item5);
		}

		int IStructuralComparable.CompareTo(object other, IComparer comparer)
		{
			if (other == null)
			{
				return 1;
			}
			if (!(other is (T1, T2, T3, T4, T5) tuple))
			{
				throw new ArgumentException(System.SR.ArgumentException_ValueTupleIncorrectType, "other");
			}
			int num = comparer.Compare(Item1, tuple.Item1);
			if (num != 0)
			{
				return num;
			}
			num = comparer.Compare(Item2, tuple.Item2);
			if (num != 0)
			{
				return num;
			}
			num = comparer.Compare(Item3, tuple.Item3);
			if (num != 0)
			{
				return num;
			}
			num = comparer.Compare(Item4, tuple.Item4);
			if (num != 0)
			{
				return num;
			}
			return comparer.Compare(Item5, tuple.Item5);
		}

		public override int GetHashCode()
		{
			return ValueTuple.CombineHashCodes(s_t1Comparer.GetHashCode(Item1), s_t2Comparer.GetHashCode(Item2), s_t3Comparer.GetHashCode(Item3), s_t4Comparer.GetHashCode(Item4), s_t5Comparer.GetHashCode(Item5));
		}

		int IStructuralEquatable.GetHashCode(IEqualityComparer comparer)
		{
			return GetHashCodeCore(comparer);
		}

		private int GetHashCodeCore(IEqualityComparer comparer)
		{
			return ValueTuple.CombineHashCodes(comparer.GetHashCode(Item1), comparer.GetHashCode(Item2), comparer.GetHashCode(Item3), comparer.GetHashCode(Item4), comparer.GetHashCode(Item5));
		}

		int System.ITupleInternal.GetHashCode(IEqualityComparer comparer)
		{
			return GetHashCodeCore(comparer);
		}

		public override string ToString()
		{
			return "(" + Item1?.ToString() + ", " + Item2?.ToString() + ", " + Item3?.ToString() + ", " + Item4?.ToString() + ", " + Item5?.ToString() + ")";
		}

		string System.ITupleInternal.ToStringEnd()
		{
			return Item1?.ToString() + ", " + Item2?.ToString() + ", " + Item3?.ToString() + ", " + Item4?.ToString() + ", " + Item5?.ToString() + ")";
		}
	}
	[StructLayout(LayoutKind.Auto)]
	public struct ValueTuple<T1, T2, T3, T4, T5, T6> : IEquatable<(T1, T2, T3, T4, T5, T6)>, IStructuralEquatable, IStructuralComparable, IComparable, IComparable<(T1, T2, T3, T4, T5, T6)>, System.ITupleInternal
	{
		private static readonly EqualityComparer<T1> s_t1Comparer = EqualityComparer<T1>.Default;

		private static readonly EqualityComparer<T2> s_t2Comparer = EqualityComparer<T2>.Default;

		private static readonly EqualityComparer<T3> s_t3Comparer = EqualityComparer<T3>.Default;

		private static readonly EqualityComparer<T4> s_t4Comparer = EqualityComparer<T4>.Default;

		private static readonly EqualityComparer<T5> s_t5Comparer = EqualityComparer<T5>.Default;

		private static readonly EqualityComparer<T6> s_t6Comparer = EqualityComparer<T6>.Default;

		public T1 Item1;

		public T2 Item2;

		public T3 Item3;

		public T4 Item4;

		public T5 Item5;

		public T6 Item6;

		int System.ITupleInternal.Size => 6;

		public ValueTuple(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6)
		{
			Item1 = item1;
			Item2 = item2;
			Item3 = item3;
			Item4 = item4;
			Item5 = item5;
			Item6 = item6;
		}

		public override bool Equals(object obj)
		{
			if (obj is ValueTuple<T1, T2, T3, T4, T5, T6>)
			{
				return Equals(((T1, T2, T3, T4, T5, T6))obj);
			}
			return false;
		}

		public bool Equals((T1, T2, T3, T4, T5, T6) other)
		{
			if (s_t1Comparer.Equals(Item1, other.Item1) && s_t2Comparer.Equals(Item2, other.Item2) && s_t3Comparer.Equals(Item3, other.Item3) && s_t4Comparer.Equals(Item4, other.Item4) && s_t5Comparer.Equals(Item5, other.Item5))
			{
				return s_t6Comparer.Equals(Item6, other.Item6);
			}
			return false;
		}

		bool IStructuralEquatable.Equals(object other, IEqualityComparer comparer)
		{
			if (other == null || !(other is (T1, T2, T3, T4, T5, T6) tuple))
			{
				return false;
			}
			if (comparer.Equals(Item1, tuple.Item1) && comparer.Equals(Item2, tuple.Item2) && comparer.Equals(Item3, tuple.Item3) && comparer.Equals(Item4, tuple.Item4) && comparer.Equals(Item5, tuple.Item5))
			{
				return comparer.Equals(Item6, tuple.Item6);
			}
			return false;
		}

		int IComparable.CompareTo(object other)
		{
			if (other == null)
			{
				return 1;
			}
			if (!(other is ValueTuple<T1, T2, T3, T4, T5, T6>))
			{
				throw new ArgumentException(System.SR.ArgumentException_ValueTupleIncorrectType, "other");
			}
			return CompareTo(((T1, T2, T3, T4, T5, T6))other);
		}

		public int CompareTo((T1, T2, T3, T4, T5, T6) other)
		{
			int num = Comparer<T1>.Default.Compare(Item1, other.Item1);
			if (num != 0)
			{
				return num;
			}
			num = Comparer<T2>.Default.Compare(Item2, other.Item2);
			if (num != 0)
			{
				return num;
			}
			num = Comparer<T3>.Default.Compare(Item3, other.Item3);
			if (num != 0)
			{
				return num;
			}
			num = Comparer<T4>.Default.Compare(Item4, other.Item4);
			if (num != 0)
			{
				return num;
			}
			num = Comparer<T5>.Default.Compare(Item5, other.Item5);
			if (num != 0)
			{
				return num;
			}
			return Comparer<T6>.Default.Compare(Item6, other.Item6);
		}

		int IStructuralComparable.CompareTo(object other, IComparer comparer)
		{
			if (other == null)
			{
				return 1;
			}
			if (!(other is (T1, T2, T3, T4, T5, T6) tuple))
			{
				throw new ArgumentException(System.SR.ArgumentException_ValueTupleIncorrectType, "other");
			}
			int num = comparer.Compare(Item1, tuple.Item1);
			if (num != 0)
			{
				return num;
			}
			num = comparer.Compare(Item2, tuple.Item2);
			if (num != 0)
			{
				return num;
			}
			num = comparer.Compare(Item3, tuple.Item3);
			if (num != 0)
			{
				return num;
			}
			num = comparer.Compare(Item4, tuple.Item4);
			if (num != 0)
			{
				return num;
			}
			num = comparer.Compare(Item5, tuple.Item5);
			if (num != 0)
			{
				return num;
			}
			return comparer.Compare(Item6, tuple.Item6);
		}

		public override int GetHashCode()
		{
			return ValueTuple.CombineHashCodes(s_t1Comparer.GetHashCode(Item1), s_t2Comparer.GetHashCode(Item2), s_t3Comparer.GetHashCode(Item3), s_t4Comparer.GetHashCode(Item4), s_t5Comparer.GetHashCode(Item5), s_t6Comparer.GetHashCode(Item6));
		}

		int IStructuralEquatable.GetHashCode(IEqualityComparer comparer)
		{
			return GetHashCodeCore(comparer);
		}

		private int GetHashCodeCore(IEqualityComparer comparer)
		{
			return ValueTuple.CombineHashCodes(comparer.GetHashCode(Item1), comparer.GetHashCode(Item2), comparer.GetHashCode(Item3), comparer.GetHashCode(Item4), comparer.GetHashCode(Item5), comparer.GetHashCode(Item6));
		}

		int System.ITupleInternal.GetHashCode(IEqualityComparer comparer)
		{
			return GetHashCodeCore(comparer);
		}

		public override string ToString()
		{
			return "(" + Item1?.ToString() + ", " + Item2?.ToString() + ", " + Item3?.ToString() + ", " + Item4?.ToString() + ", " + Item5?.ToString() + ", " + Item6?.ToString() + ")";
		}

		string System.ITupleInternal.ToStringEnd()
		{
			return Item1?.ToString() + ", " + Item2?.ToString() + ", " + Item3?.ToString() + ", " + Item4?.ToString() + ", " + Item5?.ToString() + ", " + Item6?.ToString() + ")";
		}
	}
	[StructLayout(LayoutKind.Auto)]
	public struct ValueTuple<T1, T2, T3, T4, T5, T6, T7> : IEquatable<(T1, T2, T3, T4, T5, T6, T7)>, IStructuralEquatable, IStructuralComparable, IComparable, IComparable<(T1, T2, T3, T4, T5, T6, T7)>, System.ITupleInternal
	{
		private static readonly EqualityComparer<T1> s_t1Comparer = EqualityComparer<T1>.Default;

		private static readonly EqualityComparer<T2> s_t2Comparer = EqualityComparer<T2>.Default;

		private static readonly EqualityComparer<T3> s_t3Comparer = EqualityComparer<T3>.Default;

		private static readonly EqualityComparer<T4> s_t4Comparer = EqualityComparer<T4>.Default;

		private static readonly EqualityComparer<T5> s_t5Comparer = EqualityComparer<T5>.Default;

		private static readonly EqualityComparer<T6> s_t6Comparer = EqualityComparer<T6>.Default;

		private static readonly EqualityComparer<T7> s_t7Comparer = EqualityComparer<T7>.Default;

		public T1 Item1;

		public T2 Item2;

		public T3 Item3;

		public T4 Item4;

		public T5 Item5;

		public T6 Item6;

		public T7 Item7;

		int System.ITupleInternal.Size => 7;

		public ValueTuple(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6, T7 item7)
		{
			Item1 = item1;
			Item2 = item2;
			Item3 = item3;
			Item4 = item4;
			Item5 = item5;
			Item6 = item6;
			Item7 = item7;
		}

		public override bool Equals(object obj)
		{
			if (obj is ValueTuple<T1, T2, T3, T4, T5, T6, T7>)
			{
				return Equals(((T1, T2, T3, T4, T5, T6, T7))obj);
			}
			return false;
		}

		public bool Equals((T1, T2, T3, T4, T5, T6, T7) other)
		{
			if (s_t1Comparer.Equals(Item1, other.Item1) && s_t2Comparer.Equals(Item2, other.Item2) && s_t3Comparer.Equals(Item3, other.Item3) && s_t4Comparer.Equals(Item4, other.Item4) && s_t5Comparer.Equals(Item5, other.Item5) && s_t6Comparer.Equals(Item6, other.Item6))
			{
				return s_t7Comparer.Equals(Item7, other.Item7);
			}
			return false;
		}

		bool IStructuralEquatable.Equals(object other, IEqualityComparer comparer)
		{
			if (other == null || !(other is (T1, T2, T3, T4, T5, T6, T7) tuple))
			{
				return false;
			}
			if (comparer.Equals(Item1, tuple.Item1) && comparer.Equals(Item2, tuple.Item2) && comparer.Equals(Item3, tuple.Item3) && comparer.Equals(Item4, tuple.Item4) && comparer.Equals(Item5, tuple.Item5) && comparer.Equals(Item6, tuple.Item6))
			{
				return comparer.Equals(Item7, tuple.Item7);
			}
			return false;
		}

		int IComparable.CompareTo(object other)
		{
			if (other == null)
			{
				return 1;
			}
			if (!(other is ValueTuple<T1, T2, T3, T4, T5, T6, T7>))
			{
				throw new ArgumentException(System.SR.ArgumentException_ValueTupleIncorrectType, "other");
			}
			return CompareTo(((T1, T2, T3, T4, T5, T6, T7))other);
		}

		public int CompareTo((T1, T2, T3, T4, T5, T6, T7) other)
		{
			int num = Comparer<T1>.Default.Compare(Item1, other.Item1);
			if (num != 0)
			{
				return num;
			}
			num = Comparer<T2>.Default.Compare(Item2, other.Item2);
			if (num != 0)
			{
				return num;
			}
			num = Comparer<T3>.Default.Compare(Item3, other.Item3);
			if (num != 0)
			{
				return num;
			}
			num = Comparer<T4>.Default.Compare(Item4, other.Item4);
			if (num != 0)
			{
				return num;
			}
			num = Comparer<T5>.Default.Compare(Item5, other.Item5);
			if (num != 0)
			{
				return num;
			}
			num = Comparer<T6>.Default.Compare(Item6, other.Item6);
			if (num != 0)
			{
				return num;
			}
			return Comparer<T7>.Default.Compare(Item7, other.Item7);
		}

		int IStructuralComparable.CompareTo(object other, IComparer comparer)
		{
			if (other == null)
			{
				return 1;
			}
			if (!(other is (T1, T2, T3, T4, T5, T6, T7) tuple))
			{
				throw new ArgumentException(System.SR.ArgumentException_ValueTupleIncorrectType, "other");
			}
			int num = comparer.Compare(Item1, tuple.Item1);
			if (num != 0)
			{
				return num;
			}
			num = comparer.Compare(Item2, tuple.Item2);
			if (num != 0)
			{
				return num;
			}
			num = comparer.Compare(Item3, tuple.Item3);
			if (num != 0)
			{
				return num;
			}
			num = comparer.Compare(Item4, tuple.Item4);
			if (num != 0)
			{
				return num;
			}
			num = comparer.Compare(Item5, tuple.Item5);
			if (num != 0)
			{
				return num;
			}
			num = comparer.Compare(Item6, tuple.Item6);
			if (num != 0)
			{
				return num;
			}
			return comparer.Compare(Item7, tuple.Item7);
		}

		public override int GetHashCode()
		{
			return ValueTuple.CombineHashCodes(s_t1Comparer.GetHashCode(Item1), s_t2Comparer.GetHashCode(Item2), s_t3Comparer.GetHashCode(Item3), s_t4Comparer.GetHashCode(Item4), s_t5Comparer.GetHashCode(Item5), s_t6Comparer.GetHashCode(Item6), s_t7Comparer.GetHashCode(Item7));
		}

		int IStructuralEquatable.GetHashCode(IEqualityComparer comparer)
		{
			return GetHashCodeCore(comparer);
		}

		private int GetHashCodeCore(IEqualityComparer comparer)
		{
			return ValueTuple.CombineHashCodes(comparer.GetHashCode(Item1), comparer.GetHashCode(Item2), comparer.GetHashCode(Item3), comparer.GetHashCode(Item4), comparer.GetHashCode(Item5), comparer.GetHashCode(Item6), comparer.GetHashCode(Item7));
		}

		int System.ITupleInternal.GetHashCode(IEqualityComparer comparer)
		{
			return GetHashCodeCore(comparer);
		}

		public override string ToString()
		{
			return "(" + Item1?.ToString() + ", " + Item2?.ToString() + ", " + Item3?.ToString() + ", " + Item4?.ToString() + ", " + Item5?.ToString() + ", " + Item6?.ToString() + ", " + Item7?.ToString() + ")";
		}

		string System.ITupleInternal.ToStringEnd()
		{
			return Item1?.ToString() + ", " + Item2?.ToString() + ", " + Item3?.ToString() + ", " + Item4?.ToString() + ", " + Item5?.ToString() + ", " + Item6?.ToString() + ", " + Item7?.ToString() + ")";
		}
	}
	[StructLayout(LayoutKind.Auto)]
	public struct ValueTuple<T1, T2, T3, T4, T5, T6, T7, TRest> : IEquatable<ValueTuple<T1, T2, T3, T4, T5, T6, T7, TRest>>, IStructuralEquatable, IStructuralComparable, IComparable, IComparable<ValueTuple<T1, T2, T3, T4, T5, T6, T7, TRest>>, System.ITupleInternal where TRest : struct
	{
		private static readonly EqualityComparer<T1> s_t1Comparer = EqualityComparer<T1>.Default;

		private static readonly EqualityComparer<T2> s_t2Comparer = EqualityComparer<T2>.Default;

		private static readonly EqualityComparer<T3> s_t3Comparer = EqualityComparer<T3>.Default;

		private static readonly EqualityComparer<T4> s_t4Comparer = EqualityComparer<T4>.Default;

		private static readonly EqualityComparer<T5> s_t5Comparer = EqualityComparer<T5>.Default;

		private static readonly EqualityComparer<T6> s_t6Comparer = EqualityComparer<T6>.Default;

		private static readonly EqualityComparer<T7> s_t7Comparer = EqualityComparer<T7>.Default;

		private static readonly EqualityComparer<TRest> s_tRestComparer = EqualityComparer<TRest>.Default;

		public T1 Item1;

		public T2 Item2;

		public T3 Item3;

		public T4 Item4;

		public T5 Item5;

		public T6 Item6;

		public T7 Item7;

		public TRest Rest;

		int System.ITupleInternal.Size
		{
			get
			{
				if ((object)Rest is System.ITupleInternal tupleInternal)
				{
					return 7 + tupleInternal.Size;
				}
				return 8;
			}
		}

		public ValueTuple(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6, T7 item7, TRest rest)
		{
			if (!(rest is System.ITupleInternal))
			{
				throw new ArgumentException(System.SR.ArgumentException_ValueTupleLastArgumentNotAValueTuple);
			}
			Item1 = item1;
			Item2 = item2;
			Item3 = item3;
			Item4 = item4;
			Item5 = item5;
			Item6 = item6;
			Item7 = item7;
			Rest = rest;
		}

		public override bool Equals(object obj)
		{
			if (obj is ValueTuple<T1, T2, T3, T4, T5, T6, T7, TRest>)
			{
				return Equals((ValueTuple<T1, T2, T3, T4, T5, T6, T7, TRest>)obj);
			}
			return false;
		}

		public bool Equals(ValueTuple<T1, T2, T3, T4, T5, T6, T7, TRest> other)
		{
			if (s_t1Comparer.Equals(Item1, other.Item1) && s_t2Comparer.Equals(Item2, other.Item2) && s_t3Comparer.Equals(Item3, other.Item3) && s_t4Comparer.Equals(Item4, other.Item4) && s_t5Comparer.Equals(Item5, other.Item5) && s_t6Comparer.Equals(Item6, other.Item6) && s_t7Comparer.Equals(Item7, other.Item7))
			{
				return s_tRestComparer.Equals(Rest, other.Rest);
			}
			return false;
		}

		bool IStructuralEquatable.Equals(object other, IEqualityComparer comparer)
		{
			if (other == null || !(other is ValueTuple<T1, T2, T3, T4, T5, T6, T7, TRest> valueTuple))
			{
				return false;
			}
			if (comparer.Equals(Item1, valueTuple.Item1) && comparer.Equals(Item2, valueTuple.Item2) && comparer.Equals(Item3, valueTuple.Item3) && comparer.Equals(Item4, valueTuple.Item4) && comparer.Equals(Item5, valueTuple.Item5) && comparer.Equals(Item6, valueTuple.Item6) && comparer.Equals(Item7, valueTuple.Item7))
			{
				return comparer.Equals(Rest, valueTuple.Rest);
			}
			return false;
		}

		int IComparable.CompareTo(object other)
		{
			if (other == null)
			{
				return 1;
			}
			if (!(other is ValueTuple<T1, T2, T3, T4, T5, T6, T7, TRest>))
			{
				throw new ArgumentException(System.SR.ArgumentException_ValueTupleIncorrectType, "other");
			}
			return CompareTo((ValueTuple<T1, T2, T3, T4, T5, T6, T7, TRest>)other);
		}

		public int CompareTo(ValueTuple<T1, T2, T3, T4, T5, T6, T7, TRest> other)
		{
			int num = Comparer<T1>.Default.Compare(Item1, other.Item1);
			if (num != 0)
			{
				return num;
			}
			num = Comparer<T2>.Default.Compare(Item2, other.Item2);
			if (num != 0)
			{
				return num;
			}
			num = Comparer<T3>.Default.Compare(Item3, other.Item3);
			if (num != 0)
			{
				return num;
			}
			num = Comparer<T4>.Default.Compare(Item4, other.Item4);
			if (num != 0)
			{
				return num;
			}
			num = Comparer<T5>.Default.Compare(Item5, other.Item5);
			if (num != 0)
			{
				return num;
			}
			num = Comparer<T6>.Default.Compare(Item6, other.Item6);
			if (num != 0)
			{
				return num;
			}
			num = Comparer<T7>.Default.Compare(Item7, other.Item7);
			if (num != 0)
			{
				return num;
			}
			return Comparer<TRest>.Default.Compare(Rest, other.Rest);
		}

		int IStructuralComparable.CompareTo(object other, IComparer comparer)
		{
			if (other == null)
			{
				return 1;
			}
			if (!(other is ValueTuple<T1, T2, T3, T4, T5, T6, T7, TRest> valueTuple))
			{
				throw new ArgumentException(System.SR.ArgumentException_ValueTupleIncorrectType, "other");
			}
			int num = comparer.Compare(Item1, valueTuple.Item1);
			if (num != 0)
			{
				return num;
			}
			num = comparer.Compare(Item2, valueTuple.Item2);
			if (num != 0)
			{
				return num;
			}
			num = comparer.Compare(Item3, valueTuple.Item3);
			if (num != 0)
			{
				return num;
			}
			num = comparer.Compare(Item4, valueTuple.Item4);
			if (num != 0)
			{
				return num;
			}
			num = comparer.Compare(Item5, valueTuple.Item5);
			if (num != 0)
			{
				return num;
			}
			num = comparer.Compare(Item6, valueTuple.Item6);
			if (num != 0)
			{
				return num;
			}
			num = comparer.Compare(Item7, valueTuple.Item7);
			if (num != 0)
			{
				return num;
			}
			return comparer.Compare(Rest, valueTuple.Rest);
		}

		public override int GetHashCode()
		{
			if (!((object)Rest is System.ITupleInternal tupleInternal))
			{
				return ValueTuple.CombineHashCodes(s_t1Comparer.GetHashCode(Item1), s_t2Comparer.GetHashCode(Item2), s_t3Comparer.GetHashCode(Item3), s_t4Comparer.GetHashCode(Item4), s_t5Comparer.GetHashCode(Item5), s_t6Comparer.GetHashCode(Item6), s_t7Comparer.GetHashCode(Item7));
			}
			int size = tupleInternal.Size;
			if (size >= 8)
			{
				return tupleInternal.GetHashCode();
			}
			switch (8 - size)
			{
			case 1:
				return ValueTuple.CombineHashCodes(s_t7Comparer.GetHashCode(Item7), tupleInternal.GetHashCode());
			case 2:
				return ValueTuple.CombineHashCodes(s_t6Comparer.GetHashCode(Item6), s_t7Comparer.GetHashCode(Item7), tupleInternal.GetHashCode());
			case 3:
				return ValueTuple.CombineHashCodes(s_t5Comparer.GetHashCode(Item5), s_t6Comparer.GetHashCode(Item6), s_t7Comparer.GetHashCode(Item7), tupleInternal.GetHashCode());
			case 4:
				return ValueTuple.CombineHashCodes(s_t4Comparer.GetHashCode(Item4), s_t5Comparer.GetHashCode(Item5), s_t6Comparer.GetHashCode(Item6), s_t7Comparer.GetHashCode(Item7), tupleInternal.GetHashCode());
			case 5:
				return ValueTuple.CombineHashCodes(s_t3Comparer.GetHashCode(Item3), s_t4Comparer.GetHashCode(Item4), s_t5Comparer.GetHashCode(Item5), s_t6Comparer.GetHashCode(Item6), s_t7Comparer.GetHashCode(Item7), tupleInternal.GetHashCode());
			case 6:
				return ValueTuple.CombineHashCodes(s_t2Comparer.GetHashCode(Item2), s_t3Comparer.GetHashCode(Item3), s_t4Comparer.GetHashCode(Item4), s_t5Comparer.GetHashCode(Item5), s_t6Comparer.GetHashCode(Item6), s_t7Comparer.GetHashCode(Item7), tupleInternal.GetHashCode());
			case 7:
			case 8:
				return ValueTuple.CombineHashCodes(s_t1Comparer.GetHashCode(Item1), s_t2Comparer.GetHashCode(Item2), s_t3Comparer.GetHashCode(Item3), s_t4Comparer.GetHashCode(Item4), s_t5Comparer.GetHashCode(Item5), s_t6Comparer.GetHashCode(Item6), s_t7Comparer.GetHashCode(Item7), tupleInternal.GetHashCode());
			default:
				return -1;
			}
		}

		int IStructuralEquatable.GetHashCode(IEqualityComparer comparer)
		{
			return GetHashCodeCore(comparer);
		}

		private int GetHashCodeCore(IEqualityComparer comparer)
		{
			if (!((object)Rest is System.ITupleInternal tupleInternal))
			{
				return ValueTuple.CombineHashCodes(comparer.GetHashCode(Item1), comparer.GetHashCode(Item2), comparer.GetHashCode(Item3), comparer.GetHashCode(Item4), comparer.GetHashCode(Item5), comparer.GetHashCode(Item6), comparer.GetHashCode(Item7));
			}
			int size = tupleInternal.Size;
			if (size >= 8)
			{
				return tupleInternal.GetHashCode(comparer);
			}
			switch (8 - size)
			{
			case 1:
				return ValueTuple.CombineHashCodes(comparer.GetHashCode(Item7), tupleInternal.GetHashCode(comparer));
			case 2:
				return ValueTuple.CombineHashCodes(comparer.GetHashCode(Item6), comparer.GetHashCode(Item7), tupleInternal.GetHashCode(comparer));
			case 3:
				return ValueTuple.CombineHashCodes(comparer.GetHashCode(Item5), comparer.GetHashCode(Item6), comparer.GetHashCode(Item7), tupleInternal.GetHashCode(comparer));
			case 4:
				return ValueTuple.CombineHashCodes(comparer.GetHashCode(Item4), comparer.GetHashCode(Item5), comparer.GetHashCode(Item6), comparer.GetHashCode(Item7), tupleInternal.GetHashCode(comparer));
			case 5:
				return ValueTuple.CombineHashCodes(comparer.GetHashCode(Item3), comparer.GetHashCode(Item4), comparer.GetHashCode(Item5), comparer.GetHashCode(Item6), comparer.GetHashCode(Item7), tupleInternal.GetHashCode(comparer));
			case 6:
				return ValueTuple.CombineHashCodes(comparer.GetHashCode(Item2), comparer.GetHashCode(Item3), comparer.GetHashCode(Item4), comparer.GetHashCode(Item5), comparer.GetHashCode(Item6), comparer.GetHashCode(Item7), tupleInternal.GetHashCode(comparer));
			case 7:
			case 8:
				return ValueTuple.CombineHashCodes(comparer.GetHashCode(Item1), comparer.GetHashCode(Item2), comparer.GetHashCode(Item3), comparer.GetHashCode(Item4), comparer.GetHashCode(Item5), comparer.GetHashCode(Item6), comparer.GetHashCode(Item7), tupleInternal.GetHashCode(comparer));
			default:
				return -1;
			}
		}

		int System.ITupleInternal.GetHashCode(IEqualityComparer comparer)
		{
			return GetHashCodeCore(comparer);
		}

		public override string ToString()
		{
			string[] obj;
			T1 val;
			object obj2;
			if (!((object)Rest is System.ITupleInternal tupleInternal))
			{
				obj = new string[17]
				{
					"(", null, null, null, null, null, null, null, null, null,
					null, null, null, null, null, null, null
				};
				ref T1 reference = ref Item1;
				val = default(T1);
				if (val == null)
				{
					val = reference;
					reference = ref val;
					if (val == null)
					{
						obj2 = null;
						goto IL_005d;
					}
				}
				obj2 = reference.ToString();
				goto IL_005d;
			}
			string[] obj3 = new string[16]
			{
				"(", null, null, null, null, null, null, null, null, null,
				null, null, null, null, null, null
			};
			ref T1 reference2 = ref Item1;
			val = default(T1);
			object obj4;
			if (val == null)
			{
				val = reference2;
				reference2 = ref val;
				if (val == null)
				{
					obj4 = null;
					goto IL_0262;
				}
			}
			obj4 = reference2.ToString();
			goto IL_0262;
			IL_02e2:
			object obj5;
			obj3[5] = (string)obj5;
			obj3[6] = ", ";
			ref T4 reference3 = ref Item4;
			T4 val2 = default(T4);
			object obj6;
			if (val2 == null)
			{
				val2 = reference3;
				reference3 = ref val2;
				if (val2 == null)
				{
					obj6 = null;
					goto IL_0325;
				}
			}
			obj6 = reference3.ToString();
			goto IL_0325;
			IL_03f3:
			object obj7;
			obj3[13] = (string)obj7;
			obj3[14] = ", ";
			obj3[15] = tupleInternal.ToStringEnd();
			return string.Concat(obj3);
			IL_03ae:
			object obj8;
			obj3[11] = (string)obj8;
			obj3[12] = ", ";
			ref T7 reference4 = ref Item7;
			T7 val3 = default(T7);
			if (val3 == null)
			{
				val3 = reference4;
				reference4 = ref val3;
				if (val3 == null)
				{
					obj7 = null;
					goto IL_03f3;
				}
			}
			obj7 = reference4.ToString();
			goto IL_03f3;
			IL_0120:
			object obj9;
			obj[7] = (string)obj9;
			obj[8] = ", ";
			ref T5 reference5 = ref Item5;
			T5 val4 = default(T5);
			object obj10;
			if (val4 == null)
			{
				val4 = reference5;
				reference5 = ref val4;
				if (val4 == null)
				{
					obj10 = null;
					goto IL_0164;
				}
			}
			obj10 = reference5.ToString();
			goto IL_0164;
			IL_005d:
			obj[1] = (string)obj2;
			obj[2] = ", ";
			ref T2 reference6 = ref Item2;
			T2 val5 = default(T2);
			object obj11;
			if (val5 == null)
			{
				val5 = reference6;
				reference6 = ref val5;
				if (val5 == null)
				{
					obj11 = null;
					goto IL_009d;
				}
			}
			obj11 = reference6.ToString();
			goto IL_009d;
			IL_0164:
			obj[9] = (string)obj10;
			obj[10] = ", ";
			ref T6 reference7 = ref Item6;
			T6 val6 = default(T6);
			object obj12;
			if (val6 == null)
			{
				val6 = reference7;
				reference7 = ref val6;
				if (val6 == null)
				{
					obj12 = null;
					goto IL_01a9;
				}
			}
			obj12 = reference7.ToString();
			goto IL_01a9;
			IL_02a2:
			object obj13;
			obj3[3] = (string)obj13;
			obj3[4] = ", ";
			ref T3 reference8 = ref Item3;
			T3 val7 = default(T3);
			if (val7 == null)
			{
				val7 = reference8;
				reference8 = ref val7;
				if (val7 == null)
				{
					obj5 = null;
					goto IL_02e2;
				}
			}
			obj5 = reference8.ToString();
			goto IL_02e2;
			IL_01ee:
			object obj14;
			obj[13] = (string)obj14;
			obj[14] = ", ";
			obj[15] = Rest.ToString();
			obj[16] = ")";
			return string.Concat(obj);
			IL_009d:
			obj[3] = (string)obj11;
			obj[4] = ", ";
			ref T3 reference9 = ref Item3;
			val7 = default(T3);
			object obj15;
			if (val7 == null)
			{
				val7 = reference9;
				reference9 = ref val7;
				if (val7 == null)
				{
					obj15 = null;
					goto IL_00dd;
				}
			}
			obj15 = reference9.ToString();
			goto IL_00dd;
			IL_0325:
			obj3[7] = (string)obj6;
			obj3[8] = ", ";
			ref T5 reference10 = ref Item5;
			val4 = default(T5);
			object obj16;
			if (val4 == null)
			{
				val4 = reference10;
				reference10 = ref val4;
				if (val4 == null)
				{
					obj16 = null;
					goto IL_0369;
				}
			}
			obj16 = reference10.ToString();
			goto IL_0369;
			IL_01a9:
			obj[11] = (string)obj12;
			obj[12] = ", ";
			ref T7 reference11 = ref Item7;
			val3 = default(T7);
			if (val3 == null)
			{
				val3 = reference11;
				reference11 = ref val3;
				if (val3 == null)
				{
					obj14 = null;
					goto IL_01ee;
				}
			}
			obj14 = reference11.ToString();
			goto IL_01ee;
			IL_0262:
			obj3[1] = (string)obj4;
			obj3[2] = ", ";
			ref T2 reference12 = ref Item2;
			val5 = default(T2);
			if (val5 == null)
			{
				val5 = reference12;
				reference12 = ref val5;
				if (val5 == null)
				{
					obj13 = null;
					goto IL_02a2;
				}
			}
			obj13 = reference12.ToString();
			goto IL_02a2;
			IL_00dd:
			obj[5] = (string)obj15;
			obj[6] = ", ";
			ref T4 reference13 = ref Item4;
			val2 = default(T4);
			if (val2 == null)
			{
				val2 = reference13;
				reference13 = ref val2;
				if (val2 == null)
				{
					obj9 = null;
					goto IL_0120;
				}
			}
			obj9 = reference13.ToString();
			goto IL_0120;
			IL_0369:
			obj3[9] = (string)obj16;
			obj3[10] = ", ";
			ref T6 reference14 = ref Item6;
			val6 = default(T6);
			if (val6 == null)
			{
				val6 = reference14;
				reference14 = ref val6;
				if (val6 == null)
				{
					obj8 = null;
					goto IL_03ae;
				}
			}
			obj8 = reference14.ToString();
			goto IL_03ae;
		}

		string System.ITupleInternal.ToStringEnd()
		{
			string[] array;
			T1 val;
			object obj;
			if (!((object)Rest is System.ITupleInternal tupleInternal))
			{
				array = new string[16];
				ref T1 reference = ref Item1;
				val = default(T1);
				if (val == null)
				{
					val = reference;
					reference = ref val;
					if (val == null)
					{
						obj = null;
						goto IL_0055;
					}
				}
				obj = reference.ToString();
				goto IL_0055;
			}
			string[] array2 = new string[15];
			ref T1 reference2 = ref Item1;
			val = default(T1);
			object obj2;
			if (val == null)
			{
				val = reference2;
				reference2 = ref val;
				if (val == null)
				{
					obj2 = null;
					goto IL_0251;
				}
			}
			obj2 = reference2.ToString();
			goto IL_0251;
			IL_02d1:
			object obj3;
			array2[4] = (string)obj3;
			array2[5] = ", ";
			ref T4 reference3 = ref Item4;
			T4 val2 = default(T4);
			object obj4;
			if (val2 == null)
			{
				val2 = reference3;
				reference3 = ref val2;
				if (val2 == null)
				{
					obj4 = null;
					goto IL_0314;
				}
			}
			obj4 = reference3.ToString();
			goto IL_0314;
			IL_03e1:
			object obj5;
			array2[12] = (string)obj5;
			array2[13] = ", ";
			array2[14] = tupleInternal.ToStringEnd();
			return string.Concat(array2);
			IL_039c:
			object obj6;
			array2[10] = (string)obj6;
			array2[11] = ", ";
			ref T7 reference4 = ref Item7;
			T7 val3 = default(T7);
			if (val3 == null)
			{
				val3 = reference4;
				reference4 = ref val3;
				if (val3 == null)
				{
					obj5 = null;
					goto IL_03e1;
				}
			}
			obj5 = reference4.ToString();
			goto IL_03e1;
			IL_0118:
			object obj7;
			array[6] = (string)obj7;
			array[7] = ", ";
			ref T5 reference5 = ref Item5;
			T5 val4 = default(T5);
			object obj8;
			if (val4 == null)
			{
				val4 = reference5;
				reference5 = ref val4;
				if (val4 == null)
				{
					obj8 = null;
					goto IL_015b;
				}
			}
			obj8 = reference5.ToString();
			goto IL_015b;
			IL_0055:
			array[0] = (string)obj;
			array[1] = ", ";
			ref T2 reference6 = ref Item2;
			T2 val5 = default(T2);
			object obj9;
			if (val5 == null)
			{
				val5 = reference6;
				reference6 = ref val5;
				if (val5 == null)
				{
					obj9 = null;
					goto IL_0095;
				}
			}
			obj9 = reference6.ToString();
			goto IL_0095;
			IL_015b:
			array[8] = (string)obj8;
			array[9] = ", ";
			ref T6 reference7 = ref Item6;
			T6 val6 = default(T6);
			object obj10;
			if (val6 == null)
			{
				val6 = reference7;
				reference7 = ref val6;
				if (val6 == null)
				{
					obj10 = null;
					goto IL_01a0;
				}
			}
			obj10 = reference7.ToString();
			goto IL_01a0;
			IL_0291:
			object obj11;
			array2[2] = (string)obj11;
			array2[3] = ", ";
			ref T3 reference8 = ref Item3;
			T3 val7 = default(T3);
			if (val7 == null)
			{
				val7 = reference8;
				reference8 = ref val7;
				if (val7 == null)
				{
					obj3 = null;
					goto IL_02d1;
				}
			}
			obj3 = reference8.ToString();
			goto IL_02d1;
			IL_01e5:
			object obj12;
			array[12] = (string)obj12;
			array[13] = ", ";
			array[14] = Rest.ToString();
			array[15] = ")";
			return string.Concat(array);
			IL_0095:
			array[2] = (string)obj9;
			array[3] = ", ";
			ref T3 reference9 = ref Item3;
			val7 = default(T3);
			object obj13;
			if (val7 == null)
			{
				val7 = reference9;
				reference9 = ref val7;
				if (val7 == null)
				{
					obj13 = null;
					goto IL_00d5;
				}
			}
			obj13 = reference9.ToString();
			goto IL_00d5;
			IL_0314:
			array2[6] = (string)obj4;
			array2[7] = ", ";
			ref T5 reference10 = ref Item5;
			val4 = default(T5);
			object obj14;
			if (val4 == null)
			{
				val4 = reference10;
				reference10 = ref val4;
				if (val4 == null)
				{
					obj14 = null;
					goto IL_0357;
				}
			}
			obj14 = reference10.ToString();
			goto IL_0357;
			IL_01a0:
			array[10] = (string)obj10;
			array[11] = ", ";
			ref T7 reference11 = ref Item7;
			val3 = default(T7);
			if (val3 == null)
			{
				val3 = reference11;
				reference11 = ref val3;
				if (val3 == null)
				{
					obj12 = null;
					goto IL_01e5;
				}
			}
			obj12 = reference11.ToString();
			goto IL_01e5;
			IL_0251:
			array2[0] = (string)obj2;
			array2[1] = ", ";
			ref T2 reference12 = ref Item2;
			val5 = default(T2);
			if (val5 == null)
			{
				val5 = reference12;
				reference12 = ref val5;
				if (val5 == null)
				{
					obj11 = null;
					goto IL_0291;
				}
			}
			obj11 = reference12.ToString();
			goto IL_0291;
			IL_00d5:
			array[4] = (string)obj13;
			array[5] = ", ";
			ref T4 reference13 = ref Item4;
			val2 = default(T4);
			if (val2 == null)
			{
				val2 = reference13;
				reference13 = ref val2;
				if (val2 == null)
				{
					obj7 = null;
					goto IL_0118;
				}
			}
			obj7 = reference13.ToString();
			goto IL_0118;
			IL_0357:
			array2[8] = (string)obj14;
			array2[9] = ", ";
			ref T6 reference14 = ref Item6;
			val6 = default(T6);
			if (val6 == null)
			{
				val6 = reference14;
				reference14 = ref val6;
				if (val6 == null)
				{
					obj6 = null;
					goto IL_039c;
				}
			}
			obj6 = reference14.ToString();
			goto IL_039c;
		}
	}
	internal static class SR
	{
		private static ResourceManager s_resourceManager;

		private static ResourceManager ResourceManager => s_resourceManager ?? (s_resourceManager = new ResourceManager(ResourceType));

		internal static Type ResourceType { get; } = typeof(SR);


		internal static string ArgumentException_ValueTupleIncorrectType => GetResourceString("ArgumentException_ValueTupleIncorrectType", null);

		internal static string ArgumentException_ValueTupleLastArgumentNotAValueTuple => GetResourceString("ArgumentException_ValueTupleLastArgumentNotAValueTuple", null);

		[MethodImpl(MethodImplOptions.NoInlining)]
		private static bool UsingResourceKeys()
		{
			return false;
		}

		internal static string GetResourceString(string resourceKey, string defaultString)
		{
			string text = null;
			try
			{
				text = ResourceManager.GetString(resourceKey);
			}
			catch (MissingManifestResourceException)
			{
			}
			if (defaultString != null && resourceKey.Equals(text, StringComparison.Ordinal))
			{
				return defaultString;
			}
			return text;
		}

		internal static string Format(string resourceFormat, params object[] args)
		{
			if (args != null)
			{
				if (UsingResourceKeys())
				{
					return resourceFormat + string.Join(", ", args);
				}
				return string.Format(resourceFormat, args);
			}
			return resourceFormat;
		}

		internal static string Format(string resourceFormat, object p1)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1);
			}
			return string.Format(resourceFormat, p1);
		}

		internal static string Format(string resourceFormat, object p1, object p2)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2);
			}
			return string.Format(resourceFormat, p1, p2);
		}

		internal static string Format(string resourceFormat, object p1, object p2, object p3)
		{
			if (UsingResourceKeys())
			{
				return string.Join(", ", resourceFormat, p1, p2, p3);
			}
			return string.Format(resourceFormat, p1, p2, p3);
		}
	}
}
namespace System.Numerics.Hashing
{
	internal static class HashHelpers
	{
		public static readonly int RandomSeed = Guid.NewGuid().GetHashCode();

		public static int Combine(int h1, int h2)
		{
			uint num = (uint)(h1 << 5) | ((uint)h1 >> 27);
			return ((int)num + h1) ^ h2;
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[CLSCompliant(false)]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue)]
	public sealed class TupleElementNamesAttribute : Attribute
	{
		private readonly string[] _transformNames;

		public IList<string> TransformNames => _transformNames;

		public TupleElementNamesAttribute(string[] transformNames)
		{
			if (transformNames == null)
			{
				throw new ArgumentNullException("transformNames");
			}
			_transformNames = transformNames;
		}
	}
}