Decompiled source of Trainworks Reloaded v0.2.9

System.Buffers.dll

Decompiled 2 weeks 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.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.All)]
	internal class __BlockReflectionAttribute : Attribute
	{
	}
}
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;
		}
	}
}

Microsoft.Extensions.FileSystemGlobbing.dll

Decompiled 2 weeks 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.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(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[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("9.0.225.6610")]
[assembly: AssemblyInformationalVersion("9.0.2+80aa709f5d919c6814726788dc6dabe23e79e672")]
[assembly: AssemblyProduct("Microsoft® .NET")]
[assembly: AssemblyTitle("Microsoft.Extensions.FileSystemGlobbing")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/dotnet/runtime")]
[assembly: AssemblyVersion("9.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);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static string IfNullOrWhitespace(string? argument, [CallerArgumentExpression("argument")] string paramName = "")
		{
			if (argument == null)
			{
				throw new ArgumentNullException(paramName);
			}
			if (string.IsNullOrWhiteSpace(argument))
			{
				if (argument == null)
				{
					throw new ArgumentNullException(paramName);
				}
				throw new ArgumentException(paramName, "Argument is whitespace");
			}
			return argument;
		}
	}
	internal static class SR
	{
		private static readonly bool s_usingResourceKeys = GetUsingResourceKeysSwitchValue();

		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 GetUsingResourceKeysSwitchValue()
		{
			if (!AppContext.TryGetSwitch("System.Resources.UseSystemResourceKeys", out var isEnabled))
			{
				return false;
			}
			return isEnabled;
		}

		internal static bool UsingResourceKeys()
		{
			return s_usingResourceKeys;
		}

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

		private 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)
		{
			return (((h1 << 5) | (h1 >>> 27)) + 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());
			string fullPath = Path.GetFullPath(rootDir.Replace(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar));
			foreach (string file in files)
			{
				string text = file.Replace(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar);
				if (Path.IsPathRooted(file))
				{
					list.Add(Path.GetFullPath(text));
				}
				else
				{
					list.Add(Path.GetFullPath(Path.Combine(fullPath, text)));
				}
			}
			_files = list;
			FullName = fullPath;
		}

		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);
			}
			return new InMemoryDirectoryInfo(Path.GetFullPath(path.Replace(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar)), _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 List<IPattern> _includePatterns = new List<IPattern>();

		private readonly List<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");
			return new MatcherContext(_includePatterns, _excludePatterns, directoryInfo, _comparison).Execute();
		}
	}
	public static class MatcherExtensions
	{
		public static void AddExcludePatterns(this Matcher matcher, params IEnumerable<string>[] excludePatternsGroups)
		{
			for (int i = 0; i < excludePatternsGroups.Length; i++)
			{
				foreach (string item in excludePatternsGroups[i])
				{
					matcher.AddExclude(item);
				}
			}
		}

		public static void AddIncludePatterns(this Matcher matcher, params IEnumerable<string>[] includePatternsGroups)
		{
			for (int i = 0; i < includePatternsGroups.Length; i++)
			{
				foreach (string item in includePatternsGroups[i])
				{
					matcher.AddInclude(item);
				}
			}
		}

		public static IEnumerable<string> GetResultsInFullPath(this Matcher matcher, string directoryPath)
		{
			PatternMatchingResult patternMatchingResult = matcher.Execute(new DirectoryInfoWrapper(new DirectoryInfo(directoryPath)));
			if (!patternMatchingResult.HasMatches)
			{
				return Array.Empty<string>();
			}
			IEnumerable<FilePatternMatch> files = patternMatchingResult.Files;
			List<string> list = ((files is ICollection collection) ? new List<string>(collection.Count) : new List<string>());
			foreach (FilePatternMatch item in files)
			{
				list.Add(Path.GetFullPath(Path.Combine(directoryPath, item.Path)));
			}
			return list;
		}

		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 readonly 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 IPatternContext[] _includePatternContexts;

		private readonly 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()).ToArray();
			_excludePatternContexts = excludePatterns.Select((IPattern pattern) => pattern.CreatePatternContextForExclude()).ToArray();
			_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.Count != 0)
			{
				list.AddRange(directory.EnumerateFileSystemInfos());
			}
			else
			{
				foreach (FileSystemInfoBase item in directory.EnumerateFileSystemInfos())
				{
					if (item is DirectoryInfoBase && _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;
			IPatternContext[] includePatternContexts = _includePatternContexts;
			for (int i = 0; i < includePatternContexts.Length; i++)
			{
				includePatternContexts[i].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;
			IPatternContext[] includePatternContexts = _includePatternContexts;
			foreach (IPatternContext arg in includePatternContexts)
			{
				PatternTestResult patternTestResult = test(arg, fileinfo);
				if (patternTestResult.IsSuccessful)
				{
					result = patternTestResult;
					break;
				}
			}
			if (!result.IsSuccessful)
			{
				return PatternTestResult.Failed;
			}
			includePatternContexts = _excludePatternContexts;
			foreach (IPatternContext arg2 in includePatternContexts)
			{
				if (test(arg2, fileinfo).IsSuccessful)
				{
					return PatternTestResult.Failed;
				}
			}
			return result;
		}

		private void PopDirectory()
		{
			IPatternContext[] excludePatternContexts = _excludePatternContexts;
			for (int i = 0; i < excludePatternContexts.Length; i++)
			{
				excludePatternContexts[i].PopDirectory();
			}
			excludePatternContexts = _includePatternContexts;
			for (int i = 0; i < excludePatternContexts.Length; i++)
			{
				excludePatternContexts[i].PopDirectory();
			}
		}

		private void PushDirectory(DirectoryInfoBase directory)
		{
			IPatternContext[] includePatternContexts = _includePatternContexts;
			for (int i = 0; i < includePatternContexts.Length; i++)
			{
				includePatternContexts[i].PushDirectory(directory);
			}
			includePatternContexts = _excludePatternContexts;
			for (int i = 0; i < includePatternContexts.Length; i++)
			{
				includePatternContexts[i].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;
			List<IPathSegment> list2 = null;
			List<IList<IPathSegment>> list3 = null;
			List<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 readonly 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;
			if (Frame.BacktrackAvailable + 1 < 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; }
	}
}

Microsoft.Extensions.Configuration.Abstractions.dll

Decompiled 2 weeks 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(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[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("Provides abstractions of key-value pair based configuration. Interfaces defined in this package are implemented by classes in Microsoft.Extensions.Configuration and other configuration packages.")]
[assembly: AssemblyFileVersion("9.0.225.6610")]
[assembly: AssemblyInformationalVersion("9.0.2+80aa709f5d919c6814726788dc6dabe23e79e672")]
[assembly: AssemblyProduct("Microsoft® .NET")]
[assembly: AssemblyTitle("Microsoft.Extensions.Configuration.Abstractions")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/dotnet/runtime")]
[assembly: AssemblyVersion("9.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);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static string IfNullOrWhitespace(string argument, [CallerArgumentExpression("argument")] string paramName = "")
		{
			if (argument == null)
			{
				throw new ArgumentNullException(paramName);
			}
			if (string.IsNullOrWhiteSpace(argument))
			{
				if (argument == null)
				{
					throw new ArgumentNullException(paramName);
				}
				throw new ArgumentException(paramName, "Argument is whitespace");
			}
			return argument;
		}
	}
	internal static class SR
	{
		private static readonly bool s_usingResourceKeys = GetUsingResourceKeysSwitchValue();

		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 GetUsingResourceKeysSwitchValue()
		{
			if (!AppContext.TryGetSwitch("System.Resources.UseSystemResourceKeys", out var isEnabled))
			{
				return false;
			}
			return isEnabled;
		}

		internal static bool UsingResourceKeys()
		{
			return s_usingResourceKeys;
		}

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

		private 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(':');
			if (num >= 0)
			{
				return path.Substring(num + 1);
			}
			return path;
		}

		public static string? GetParentPath(string? path)
		{
			if (string.IsNullOrEmpty(path))
			{
				return null;
			}
			int num = path.LastIndexOf(':');
			if (num >= 0)
			{
				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.Path, child.Key, 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 IConfigurationManager : IConfiguration, IConfigurationBuilder
	{
	}
	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);
	}
}

TrainworksReloaded.Plugin.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using I2.Loc;
using Malee;
using Microsoft.CodeAnalysis;
using ShinyShoe;
using ShinyShoe.Logging;
using SimpleInjector;
using TrainworksReloaded.Base;
using TrainworksReloaded.Base.Card;
using TrainworksReloaded.Base.CardUpgrade;
using TrainworksReloaded.Base.Character;
using TrainworksReloaded.Base.Class;
using TrainworksReloaded.Base.Effect;
using TrainworksReloaded.Base.Enums;
using TrainworksReloaded.Base.Localization;
using TrainworksReloaded.Base.Map;
using TrainworksReloaded.Base.Prefab;
using TrainworksReloaded.Base.Relic;
using TrainworksReloaded.Base.Reward;
using TrainworksReloaded.Base.Room;
using TrainworksReloaded.Base.StatusEffects;
using TrainworksReloaded.Base.Trait;
using TrainworksReloaded.Base.Trigger;
using TrainworksReloaded.Core;
using TrainworksReloaded.Core.Impl;
using TrainworksReloaded.Core.Interfaces;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.AddressableAssets.ResourceLocators;
using UnityEngine.ResourceManagement.ResourceProviders;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("TrainworksReloaded.Plugin")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.2.9.0")]
[assembly: AssemblyInformationalVersion("0.2.9+53b4c01ba054c7d6cd2aef9a82805b8ee39b94e8")]
[assembly: AssemblyProduct("TrainworksReloaded.Plugin")]
[assembly: AssemblyTitle("TrainworksReloaded.Plugin")]
[assembly: AssemblyVersion("0.2.9.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 TrainworksReloaded.Plugin
{
	[BepInPlugin("TrainworksReloaded.Plugin", "TrainworksReloaded.Plugin", "0.2.9")]
	public class Plugin : BaseUnityPlugin
	{
		internal static ManualLogSource Logger = new ManualLogSource("TrainworksReloaded");

		internal static Lazy<Container> Container = new Lazy<Container>((Func<Container>)(() => Railend.GetContainer()));

		internal static Lazy<GameDataClient> Client = new Lazy<GameDataClient>((Func<GameDataClient>)(() => new GameDataClient()));

		public void Awake()
		{
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			ConfigEntry<bool> obj = ((BaseUnityPlugin)this).Config.Bind<bool>("Tools", "Generate CSVs", false, "Enable to Generate the Games' CSV Files on Launch");
			ConfigEntry<bool> val = ((BaseUnityPlugin)this).Config.Bind<bool>("Logs", "Include Game Logs", false, "Enable Game Logs to BepInEx Console");
			if (obj.Value)
			{
				string directoryName = Path.GetDirectoryName(typeof(Plugin).Assembly.Location);
				LocalizationManager.InitializeIfNeeded();
				for (int i = 0; i < LocalizationManager.Sources.Count; i++)
				{
					LanguageSourceData val2 = LocalizationManager.Sources[i];
					foreach (string category in val2.GetCategories(false, (List<string>)null))
					{
						string contents = val2.Export_CSV(category, ',', true, true, true, (DiffInfo)null, (ForceUnchanged)null, (ExportInfo)null);
						string path = $"{i}_{category}.csv";
						File.WriteAllText(Path.Combine(directoryName, path), contents);
					}
				}
			}
			GameDataClient client = Client.Value;
			DepInjector.AddClient((IClient)(object)client);
			Logger = ((BaseUnityPlugin)this).Logger;
			if (val.Value)
			{
				Log.AddProvider((ILogProvider)(object)new ModLogger<Plugin>(Logger));
			}
			Railend.ConfigurePreAction((Action<Container>)delegate(Container c)
			{
				Container c2 = c;
				c2.RegisterInstance<ManualLogSource>(Logger);
				c2.RegisterInstance<GameDataClient>(client);
				c2.RegisterSingleton<IGuidProvider, DeterministicGuidGenerator>();
				c2.Register<Finalizer, Finalizer>();
				c2.Collection.Register<IDataFinalizer>(new Type[21]
				{
					typeof(CardDataFinalizer),
					typeof(CardEffectFinalizer),
					typeof(CardTraitDataFinalizer),
					typeof(CardUpgradeFinalizer),
					typeof(CardUpgradeMaskFinalizer),
					typeof(CharacterDataFinalizer),
					typeof(ClassDataFinalizer),
					typeof(CharacterTriggerFinalizer),
					typeof(CardTriggerEffectFinalizer),
					typeof(VfxFinalizer),
					typeof(AtlasIconFinalizer),
					typeof(RoomModifierFinalizer),
					typeof(StatusEffectDataFinalizer),
					typeof(MapNodeFinalizer),
					typeof(RewardDataFinalizer),
					typeof(CardPoolFinalizer),
					typeof(CharacterTriggerTypeFinalizer),
					typeof(CardTriggerTypeFinalizer),
					typeof(RelicDataFinalizer),
					typeof(RelicEffectDataFinalizer),
					typeof(GameObjectFinalizer)
				});
				c2.RegisterSingleton<IRegister<LocalizationTerm>, CustomLocalizationTermRegistry>();
				c2.RegisterSingleton<CustomLocalizationTermRegistry, CustomLocalizationTermRegistry>();
				c2.RegisterConditional(typeof(ICache<>), typeof(Cache<>), (Lifestyle)(object)Lifestyle.Singleton, (Predicate<PredicateContext>)((PredicateContext c) => !c.Handled));
				c2.RegisterConditional(typeof(IModLogger<>), typeof(ModLogger<>), (Lifestyle)(object)Lifestyle.Singleton, (Predicate<PredicateContext>)((PredicateContext c) => !c.Handled));
				c2.RegisterConditional(typeof(IInstanceGenerator<>), typeof(ScriptableObjectInstanceGenerator<>), Lifestyle.Transient, (Predicate<PredicateContext>)((PredicateContext c) => typeof(ScriptableObject).IsAssignableFrom(c.ServiceType.GetGenericArguments()[0])));
				c2.RegisterConditional(typeof(IInstanceGenerator<>), typeof(InstanceGenerator<>), (Predicate<PredicateContext>)((PredicateContext c) => !c.Handled));
				c2.RegisterDecorator(typeof(IDataPipeline<, >), typeof(CacheDataPipelineDecorator<, >));
				c2.Register<FallbackDataProvider, FallbackDataProvider>();
				c2.RegisterSingleton<IRegister<GameObject>, GameObjectRegister>();
				c2.RegisterSingleton<GameObjectRegister, GameObjectRegister>();
				c2.RegisterSingleton<IRegister<AssetReferenceGameObject>, AssetReferenceGameObjectRegister>();
				c2.RegisterSingleton<AssetReferenceGameObjectRegister, AssetReferenceGameObjectRegister>();
				c2.RegisterInitializer<GameObjectRegister>((Action<GameObjectRegister>)delegate(GameObjectRegister x)
				{
					Addressables.ResourceLocators.Add((IResourceLocator)(object)x);
					Addressables.ResourceManager.ResourceProviders.Add((IResourceProvider)(object)x);
				});
				c2.RegisterInitializer<IRegister<GameObject>>((Action<IRegister<GameObject>>)delegate(IRegister<GameObject> x)
				{
					c2.GetInstance<IDataPipeline<IRegister<GameObject>, GameObject>>().Run(x);
				});
				c2.Register<IDataPipeline<IRegister<GameObject>, GameObject>, GameObjectImportPipeline>();
				c2.RegisterDecorator<IDataPipeline<IRegister<GameObject>, GameObject>, GameObjectCardArtDecorator>();
				c2.RegisterDecorator<IDataPipeline<IRegister<GameObject>, GameObject>, GameObjectMapIconDecorator>();
				c2.RegisterDecorator(typeof(IDataFinalizer), typeof(GameObjectCharacterArtFinalizer), (Predicate<DecoratorPredicateContext>)((DecoratorPredicateContext xs) => xs.ImplementationType == typeof(GameObjectFinalizer)));
				c2.RegisterSingleton<IRegister<Sprite>, SpriteRegister>();
				c2.RegisterSingleton<SpriteRegister, SpriteRegister>();
				c2.Register<IDataPipeline<IRegister<Sprite>, Sprite>, SpritePipeline>();
				c2.RegisterInitializer<IRegister<Sprite>>((Action<IRegister<Sprite>>)delegate(IRegister<Sprite> x)
				{
					c2.GetInstance<IDataPipeline<IRegister<Sprite>, Sprite>>().Run(x);
				});
				c2.RegisterSingleton<IRegister<Texture2D>, AtlasIconRegister>();
				c2.RegisterSingleton<AtlasIconRegister, AtlasIconRegister>();
				c2.Register<IDataPipeline<IRegister<Texture2D>, Texture2D>, AtlasIconPipeline>();
				c2.RegisterInitializer<IRegister<Texture2D>>((Action<IRegister<Texture2D>>)delegate(IRegister<Texture2D> x)
				{
					c2.GetInstance<IDataPipeline<IRegister<Texture2D>, Texture2D>>().Run(x);
				});
				c2.RegisterSingleton<IRegister<Trigger>, CharacterTriggerTypeRegister>();
				c2.RegisterSingleton<CharacterTriggerTypeRegister, CharacterTriggerTypeRegister>();
				c2.Register<IDataPipeline<IRegister<Trigger>, Trigger>, CharacterTriggerTypePipeline>();
				c2.RegisterInitializer<IRegister<Trigger>>((Action<IRegister<Trigger>>)delegate(IRegister<Trigger> x)
				{
					c2.GetInstance<IDataPipeline<IRegister<Trigger>, Trigger>>().Run(x);
				});
				c2.RegisterSingleton<IRegister<CardTriggerType>, CardTriggerTypeRegister>();
				c2.RegisterSingleton<CardTriggerTypeRegister, CardTriggerTypeRegister>();
				c2.Register<IDataPipeline<IRegister<CardTriggerType>, CardTriggerType>, CardTriggerTypePipeline>();
				c2.RegisterInitializer<IRegister<CardTriggerType>>((Action<IRegister<CardTriggerType>>)delegate(IRegister<CardTriggerType> x)
				{
					c2.GetInstance<IDataPipeline<IRegister<CardTriggerType>, CardTriggerType>>().Run(x);
				});
				c2.RegisterSingleton<IRegister<StatusEffectData>, StatusEffectDataRegister>();
				c2.RegisterSingleton<StatusEffectDataRegister, StatusEffectDataRegister>();
				c2.Register<IDataPipeline<IRegister<StatusEffectData>, StatusEffectData>, StatusEffectDataPipeline>();
				c2.RegisterInitializer<IRegister<StatusEffectData>>((Action<IRegister<StatusEffectData>>)delegate(IRegister<StatusEffectData> x)
				{
					c2.GetInstance<IDataPipeline<IRegister<StatusEffectData>, StatusEffectData>>().Run(x);
				});
				c2.RegisterSingleton<IRegister<CardData>, CardDataRegister>();
				c2.RegisterSingleton<CardDataRegister, CardDataRegister>();
				c2.Register<IDataPipeline<IRegister<CardData>, CardData>, CardDataPipeline>();
				c2.RegisterInitializer<IRegister<CardData>>((Action<IRegister<CardData>>)delegate(IRegister<CardData> x)
				{
					c2.GetInstance<IDataPipeline<IRegister<CardData>, CardData>>().Run(x);
				});
				c2.RegisterSingleton<VanillaCardPoolDelegator>();
				c2.RegisterDecorator<IDataPipeline<IRegister<CardData>, CardData>, PoolingCardDataPipelineDecorator>();
				c2.RegisterSingleton<IRegister<CardPool>, CardPoolRegister>();
				c2.RegisterSingleton<CardPoolRegister, CardPoolRegister>();
				c2.Register<IDataPipeline<IRegister<CardPool>, CardPool>, CardPoolPipeline>();
				c2.RegisterInitializer<IRegister<CardPool>>((Action<IRegister<CardPool>>)delegate(IRegister<CardPool> x)
				{
					c2.GetInstance<IDataPipeline<IRegister<CardPool>, CardPool>>().Run(x);
				});
				c2.RegisterSingleton<IRegister<CharacterData>, CharacterDataRegister>();
				c2.RegisterSingleton<CharacterDataRegister, CharacterDataRegister>();
				c2.Register<IDataPipeline<IRegister<CharacterData>, CharacterData>, CharacterDataPipeline>();
				c2.RegisterInitializer<IRegister<CharacterData>>((Action<IRegister<CharacterData>>)delegate(IRegister<CharacterData> x)
				{
					c2.GetInstance<IDataPipeline<IRegister<CharacterData>, CharacterData>>().Run(x);
				});
				c2.RegisterSingleton<IRegister<CardTriggerEffectData>, CardTriggerEffectRegister>();
				c2.RegisterSingleton<CardTriggerEffectRegister, CardTriggerEffectRegister>();
				c2.Register<IDataPipeline<IRegister<CardTriggerEffectData>, CardTriggerEffectData>, CardTriggerEffectPipeline>();
				c2.RegisterInitializer<IRegister<CardTriggerEffectData>>((Action<IRegister<CardTriggerEffectData>>)delegate(IRegister<CardTriggerEffectData> x)
				{
					c2.GetInstance<IDataPipeline<IRegister<CardTriggerEffectData>, CardTriggerEffectData>>().Run(x);
				});
				c2.RegisterSingleton<IRegister<CharacterTriggerData>, CharacterTriggerRegister>();
				c2.RegisterSingleton<CharacterTriggerRegister, CharacterTriggerRegister>();
				c2.Register<IDataPipeline<IRegister<CharacterTriggerData>, CharacterTriggerData>, CharacterTriggerPipeline>();
				c2.RegisterInitializer<IRegister<CharacterTriggerData>>((Action<IRegister<CharacterTriggerData>>)delegate(IRegister<CharacterTriggerData> x)
				{
					c2.GetInstance<IDataPipeline<IRegister<CharacterTriggerData>, CharacterTriggerData>>().Run(x);
				});
				c2.RegisterSingleton<IRegister<ClassData>, ClassDataRegister>();
				c2.RegisterSingleton<ClassDataRegister, ClassDataRegister>();
				c2.Register<IDataPipeline<IRegister<ClassData>, ClassData>, ClassDataPipeline>();
				c2.RegisterInitializer<IRegister<ClassData>>((Action<IRegister<ClassData>>)delegate(IRegister<ClassData> x)
				{
					c2.GetInstance<IDataPipeline<IRegister<ClassData>, ClassData>>().Run(x);
				});
				c2.RegisterSingleton<IRegister<CardEffectData>, CardEffectDataRegister>();
				c2.RegisterSingleton<CardEffectDataRegister, CardEffectDataRegister>();
				c2.Register<IDataPipeline<IRegister<CardEffectData>, CardEffectData>, CardEffectDataPipeline>();
				c2.RegisterInitializer<IRegister<CardEffectData>>((Action<IRegister<CardEffectData>>)delegate(IRegister<CardEffectData> x)
				{
					c2.GetInstance<IDataPipeline<IRegister<CardEffectData>, CardEffectData>>().Run(x);
				});
				c2.RegisterSingleton<IRegister<MapNodeData>, MapNodeRegister>();
				c2.RegisterSingleton<MapNodeRegister, MapNodeRegister>();
				c2.Register<IDataPipeline<IRegister<MapNodeData>, MapNodeData>, MapNodePipeline>();
				c2.RegisterInitializer<IRegister<MapNodeData>>((Action<IRegister<MapNodeData>>)delegate(IRegister<MapNodeData> x)
				{
					c2.GetInstance<IDataPipeline<IRegister<MapNodeData>, MapNodeData>>().Run(x);
				});
				c2.Collection.Register<IFactory<MapNodeData>>((IEnumerable<Type>)new <>z__ReadOnlySingleElementList<Type>(typeof(RewardNodeDataFactory)), (Lifestyle)(object)Lifestyle.Singleton);
				c2.RegisterDecorator<IDataPipeline<IRegister<MapNodeData>, MapNodeData>, RewardNodeDataPipelineDecorator>();
				c2.RegisterDecorator<IDataPipeline<IRegister<MapNodeData>, MapNodeData>, BucketMapNodePipelineDecorator>();
				c2.RegisterDecorator(typeof(IDataFinalizer), typeof(RewardNodeDataFinalizerDecorator), (Predicate<DecoratorPredicateContext>)((DecoratorPredicateContext xs) => xs.ImplementationType == typeof(MapNodeFinalizer)));
				c2.RegisterSingleton<MapNodeDelegator>();
				c2.RegisterSingleton<IRegister<CardTraitData>, CardTraitDataRegister>();
				c2.RegisterSingleton<CardTraitDataRegister, CardTraitDataRegister>();
				c2.Register<IDataPipeline<IRegister<CardTraitData>, CardTraitData>, CardTraitDataPipeline>();
				c2.RegisterInitializer<IRegister<CardTraitData>>((Action<IRegister<CardTraitData>>)delegate(IRegister<CardTraitData> x)
				{
					c2.GetInstance<IDataPipeline<IRegister<CardTraitData>, CardTraitData>>().Run(x);
				});
				c2.RegisterSingleton<IRegister<RewardData>, RewardDataRegister>();
				c2.RegisterSingleton<RewardDataRegister, RewardDataRegister>();
				c2.Register<IDataPipeline<IRegister<RewardData>, RewardData>, RewardDataPipeline>();
				c2.RegisterInitializer<IRegister<RewardData>>((Action<IRegister<RewardData>>)delegate(IRegister<RewardData> x)
				{
					c2.GetInstance<IDataPipeline<IRegister<RewardData>, RewardData>>().Run(x);
				});
				c2.Collection.Register<IFactory<RewardData>>((IEnumerable<Type>)new <>z__ReadOnlyArray<Type>(new Type[2]
				{
					typeof(CardPoolRewardDataFactory),
					typeof(DraftRewardDataFactory)
				}), (Lifestyle)(object)Lifestyle.Singleton);
				c2.RegisterDecorator(typeof(IDataFinalizer), typeof(CardPoolRewardDataFinalizerDecorator), (Predicate<DecoratorPredicateContext>)((DecoratorPredicateContext xs) => xs.ImplementationType == typeof(RewardDataFinalizer)));
				c2.RegisterDecorator(typeof(IDataFinalizer), typeof(DraftRewardDataFinalizerDecorator), (Predicate<DecoratorPredicateContext>)((DecoratorPredicateContext xs) => xs.ImplementationType == typeof(RewardDataFinalizer)));
				c2.RegisterSingleton<IRegister<RelicData>, RelicDataRegister>();
				c2.RegisterSingleton<RelicDataRegister, RelicDataRegister>();
				c2.Register<IDataPipeline<IRegister<RelicData>, RelicData>, RelicDataPipeline>();
				c2.RegisterInitializer<IRegister<RelicData>>((Action<IRegister<RelicData>>)delegate(IRegister<RelicData> x)
				{
					c2.GetInstance<IDataPipeline<IRegister<RelicData>, RelicData>>().Run(x);
				});
				c2.Collection.Register<IFactory<RelicData>>((IEnumerable<Type>)new <>z__ReadOnlySingleElementList<Type>(typeof(CollectableRelicDataFactory)), (Lifestyle)(object)Lifestyle.Singleton);
				c2.RegisterDecorator(typeof(IDataPipeline<IRegister<RelicData>, RelicData>), typeof(CollectableRelicDataPipelineDecorator));
				c2.RegisterDecorator(typeof(IDataFinalizer), typeof(CollectableRelicDataFinalizerDecorator), (Predicate<DecoratorPredicateContext>)((DecoratorPredicateContext xs) => xs.ImplementationType == typeof(RelicDataFinalizer)));
				c2.RegisterSingleton<VanillaRelicPoolDelegator>();
				c2.RegisterSingleton<IRegister<RelicEffectData>, RelicEffectDataRegister>();
				c2.RegisterSingleton<RelicEffectDataRegister, RelicEffectDataRegister>();
				c2.Register<IDataPipeline<IRegister<RelicEffectData>, RelicEffectData>, RelicEffectDataPipeline>();
				c2.RegisterInitializer<IRegister<RelicEffectData>>((Action<IRegister<RelicEffectData>>)delegate(IRegister<RelicEffectData> x)
				{
					c2.GetInstance<IDataPipeline<IRegister<RelicEffectData>, RelicEffectData>>().Run(x);
				});
				c2.RegisterSingleton<IRegister<RoomModifierData>, RoomModifierRegister>();
				c2.RegisterSingleton<RoomModifierRegister, RoomModifierRegister>();
				c2.Register<IDataPipeline<IRegister<RoomModifierData>, RoomModifierData>, RoomModifierPipeline>();
				c2.RegisterInitializer<IRegister<RoomModifierData>>((Action<IRegister<RoomModifierData>>)delegate(IRegister<RoomModifierData> x)
				{
					c2.GetInstance<IDataPipeline<IRegister<RoomModifierData>, RoomModifierData>>().Run(x);
				});
				c2.RegisterSingleton<IRegister<CardUpgradeData>, CardUpgradeRegister>();
				c2.RegisterSingleton<CardUpgradeRegister, CardUpgradeRegister>();
				c2.Register<IDataPipeline<IRegister<CardUpgradeData>, CardUpgradeData>, CardUpgradePipeline>();
				c2.RegisterInitializer<IRegister<CardUpgradeData>>((Action<IRegister<CardUpgradeData>>)delegate(IRegister<CardUpgradeData> x)
				{
					c2.GetInstance<IDataPipeline<IRegister<CardUpgradeData>, CardUpgradeData>>().Run(x);
				});
				c2.RegisterSingleton<IRegister<CardUpgradeMaskData>, CardUpgradeMaskRegister>();
				c2.RegisterSingleton<CardUpgradeMaskRegister, CardUpgradeMaskRegister>();
				c2.Register<IDataPipeline<IRegister<CardUpgradeMaskData>, CardUpgradeMaskData>, CardUpgradeMaskPipeline>();
				c2.RegisterInitializer<IRegister<CardUpgradeMaskData>>((Action<IRegister<CardUpgradeMaskData>>)delegate(IRegister<CardUpgradeMaskData> x)
				{
					c2.GetInstance<IDataPipeline<IRegister<CardUpgradeMaskData>, CardUpgradeMaskData>>().Run(x);
				});
				c2.RegisterSingleton<IRegister<VfxAtLoc>, VfxRegister>();
				c2.RegisterSingleton<VfxRegister, VfxRegister>();
				c2.Register<IDataPipeline<IRegister<VfxAtLoc>, VfxAtLoc>, VfxPipeline>();
				c2.RegisterInitializer<IRegister<VfxAtLoc>>((Action<IRegister<VfxAtLoc>>)delegate(IRegister<VfxAtLoc> x)
				{
					c2.GetInstance<IDataPipeline<IRegister<VfxAtLoc>, VfxAtLoc>>().Run(x);
				});
			});
			new Harmony("TrainworksReloaded.Plugin").PatchAll();
			Logger.LogInfo((object)"Plugin TrainworksReloaded.Plugin is loaded!");
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "TrainworksReloaded.Plugin";

		public const string PLUGIN_NAME = "TrainworksReloaded.Plugin";

		public const string PLUGIN_VERSION = "0.2.9";
	}
}
namespace TrainworksReloaded.Plugin.Patches
{
	[HarmonyPatch(typeof(AppManager), "DoesThisBuildReportErrors")]
	internal class DisableErrorReportingPatch
	{
		public static void Postfix(ref bool __result)
		{
			__result = false;
		}
	}
	[HarmonyPatch(typeof(AssetLoadingManager), "Start")]
	public class InitializationPatch
	{
		public static void Postfix(AssetLoadingData ____assetLoadingData)
		{
			//IL_039d: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a9: Expected O, but got Unknown
			Container container = Railend.GetContainer();
			CardDataRegister instance = container.GetInstance<CardDataRegister>();
			IModLogger<InitializationPatch> instance2 = container.GetInstance<IModLogger<InitializationPatch>>();
			instance2.Log((LogLevel)16, (object)"Starting TrainworksReloaded initialization...");
			VanillaCardPoolDelegator instance3 = container.GetInstance<VanillaCardPoolDelegator>();
			instance2.Log((LogLevel)16, (object)"Processing card pools...");
			foreach (CardPool item in ____assetLoadingData.CardPoolsAll.Union(____assetLoadingData.CardPoolsAlwaysLoad))
			{
				if (!((Object)(object)item != (Object)null) || !instance3.CardPoolToData.ContainsKey(((Object)item).name))
				{
					continue;
				}
				List<CardData> list = instance3.CardPoolToData[((Object)item).name];
				ReorderableArray<CardData> val = (ReorderableArray<CardData>)AccessTools.Field(typeof(CardPool), "cardDataList").GetValue(item);
				foreach (CardData item2 in list)
				{
					val.Add(item2);
				}
				instance2.Log((LogLevel)32, (object)$"Added {list.Count} cards to pool: {((Object)item).name}");
			}
			instance3.CardPoolToData.Clear();
			____assetLoadingData.CardPoolsAll.Add(instance.CustomCardPool);
			instance2.Log((LogLevel)16, (object)"Card pool processing complete");
			VanillaRelicPoolDelegator instance4 = container.GetInstance<VanillaRelicPoolDelegator>();
			if (instance4.RelicPoolToData.ContainsKey("megapool"))
			{
				instance2.Log((LogLevel)16, (object)"Processing relic pools...");
				RelicPool ftueBlessingPool = ____assetLoadingData.BalanceData.GetFtueBlessingPool();
				ReorderableArray<CollectableRelicData> val2 = (ReorderableArray<CollectableRelicData>)AccessTools.Field(typeof(RelicPool), "relicDataList").GetValue(ftueBlessingPool);
				foreach (CollectableRelicData item3 in instance4.RelicPoolToData["megapool"])
				{
					val2.Add(item3);
				}
				instance2.Log((LogLevel)32, (object)string.Format("Added {0} relics to megapool", instance4.RelicPoolToData["megapool"].Count));
			}
			instance4.RelicPoolToData.Clear();
			instance2.Log((LogLevel)16, (object)"Relic pool processing complete");
			ClassDataRegister instance5 = container.GetInstance<ClassDataRegister>();
			((List<ClassData>)AccessTools.Field(typeof(BalanceData), "classDatas").GetValue(____assetLoadingData.BalanceData)).AddRange(((Dictionary<string, ClassData>)(object)instance5).Values);
			instance2.Log((LogLevel)16, (object)$"Added {((Dictionary<string, ClassData>)(object)instance5).Values.Count} custom classes");
			instance2.Log((LogLevel)16, (object)"Processing map data...");
			MapNodeDelegator instance6 = container.GetInstance<MapNodeDelegator>();
			foreach (KeyValuePair<string, RunData> item4 in new Dictionary<string, RunData>
			{
				{
					"primary",
					____assetLoadingData.BalanceData.GetRunData(false, false)
				},
				{
					"first_time",
					____assetLoadingData.BalanceData.GetRunData(true, false)
				},
				{
					"endless",
					____assetLoadingData.BalanceData.GetRunData(false, true)
				}
			})
			{
				string key = item4.Key;
				ReorderableArray<MapNodeBucketList> val3 = (ReorderableArray<MapNodeBucketList>)AccessTools.Field(typeof(RunData), "mapNodeBucketLists").GetValue(item4.Value);
				if (val3 == null)
				{
					continue;
				}
				foreach (MapNodeBucketList item5 in val3)
				{
					foreach (MapNodeBucketContainer item6 in (ReorderableArray<MapNodeBucketContainer>)(object)item5.BucketList)
					{
						string text = (string)AccessTools.Field(typeof(MapNodeBucketContainer), "id").GetValue(item6);
						if (!instance6.MapBucketToData.TryGetValue(new MapNodeKey(key, text), out var value))
						{
							continue;
						}
						foreach (MapNodeBucketData item7 in (ReorderableArray<MapNodeBucketData>)AccessTools.Field(typeof(MapNodeBucketContainer), "mapNodeBucketContainerList").GetValue(item6))
						{
							item7.MapNodes.AddRange(value);
						}
						instance2.Log((LogLevel)32, (object)$"Added {value.Count} map nodes to bucket: {text} in {key}");
					}
				}
			}
			instance6.MapBucketToData.Clear();
			instance2.Log((LogLevel)16, (object)"Map data processing complete");
			instance2.Log((LogLevel)16, (object)"Loading localization data...");
			container.GetInstance<CustomLocalizationTermRegistry>().LoadData();
			instance2.Log((LogLevel)16, (object)"Localization data loaded");
			instance2.Log((LogLevel)16, (object)"Running finalization steps...");
			container.GetInstance<Finalizer>().FinalizeData();
			instance2.Log((LogLevel)16, (object)"TrainworksReloaded initialization complete!");
		}
	}
}
[CompilerGenerated]
internal sealed class <>z__ReadOnlyArray<T> : IEnumerable, ICollection, IList, IEnumerable<T>, IReadOnlyCollection<T>, IReadOnlyList<T>, ICollection<T>, IList<T>
{
	int ICollection.Count => _items.Length;

	bool ICollection.IsSynchronized => false;

	object ICollection.SyncRoot => this;

	object IList.this[int index]
	{
		get
		{
			return _items[index];
		}
		set
		{
			throw new NotSupportedException();
		}
	}

	bool IList.IsFixedSize => true;

	bool IList.IsReadOnly => true;

	int IReadOnlyCollection<T>.Count => _items.Length;

	T IReadOnlyList<T>.this[int index] => _items[index];

	int ICollection<T>.Count => _items.Length;

	bool ICollection<T>.IsReadOnly => true;

	T IList<T>.this[int index]
	{
		get
		{
			return _items[index];
		}
		set
		{
			throw new NotSupportedException();
		}
	}

	public <>z__ReadOnlyArray(T[] items)
	{
		_items = items;
	}

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

	void ICollection.CopyTo(Array array, int index)
	{
		((ICollection)_items).CopyTo(array, index);
	}

	int IList.Add(object value)
	{
		throw new NotSupportedException();
	}

	void IList.Clear()
	{
		throw new NotSupportedException();
	}

	bool IList.Contains(object value)
	{
		return ((IList)_items).Contains(value);
	}

	int IList.IndexOf(object value)
	{
		return ((IList)_items).IndexOf(value);
	}

	void IList.Insert(int index, object value)
	{
		throw new NotSupportedException();
	}

	void IList.Remove(object value)
	{
		throw new NotSupportedException();
	}

	void IList.RemoveAt(int index)
	{
		throw new NotSupportedException();
	}

	IEnumerator<T> IEnumerable<T>.GetEnumerator()
	{
		return ((IEnumerable<T>)_items).GetEnumerator();
	}

	void ICollection<T>.Add(T item)
	{
		throw new NotSupportedException();
	}

	void ICollection<T>.Clear()
	{
		throw new NotSupportedException();
	}

	bool ICollection<T>.Contains(T item)
	{
		return ((ICollection<T>)_items).Contains(item);
	}

	void ICollection<T>.CopyTo(T[] array, int arrayIndex)
	{
		((ICollection<T>)_items).CopyTo(array, arrayIndex);
	}

	bool ICollection<T>.Remove(T item)
	{
		throw new NotSupportedException();
	}

	int IList<T>.IndexOf(T item)
	{
		return ((IList<T>)_items).IndexOf(item);
	}

	void IList<T>.Insert(int index, T item)
	{
		throw new NotSupportedException();
	}

	void IList<T>.RemoveAt(int index)
	{
		throw new NotSupportedException();
	}
}
[CompilerGenerated]
internal sealed class <>z__ReadOnlySingleElementList<T> : IEnumerable, ICollection, IList, IEnumerable<T>, IReadOnlyCollection<T>, IReadOnlyList<T>, ICollection<T>, IList<T>
{
	private sealed class Enumerator : IDisposable, IEnumerator, IEnumerator<T>
	{
		object IEnumerator.Current => _item;

		T IEnumerator<T>.Current => _item;

		public Enumerator(T item)
		{
			_item = item;
		}

		bool IEnumerator.MoveNext()
		{
			if (!_moveNextCalled)
			{
				return _moveNextCalled = true;
			}
			return false;
		}

		void IEnumerator.Reset()
		{
			_moveNextCalled = false;
		}

		void IDisposable.Dispose()
		{
		}
	}

	int ICollection.Count => 1;

	bool ICollection.IsSynchronized => false;

	object ICollection.SyncRoot => this;

	object IList.this[int index]
	{
		get
		{
			if (index != 0)
			{
				throw new IndexOutOfRangeException();
			}
			return _item;
		}
		set
		{
			throw new NotSupportedException();
		}
	}

	bool IList.IsFixedSize => true;

	bool IList.IsReadOnly => true;

	int IReadOnlyCollection<T>.Count => 1;

	T IReadOnlyList<T>.this[int index]
	{
		get
		{
			if (index != 0)
			{
				throw new IndexOutOfRangeException();
			}
			return _item;
		}
	}

	int ICollection<T>.Count => 1;

	bool ICollection<T>.IsReadOnly => true;

	T IList<T>.this[int index]
	{
		get
		{
			if (index != 0)
			{
				throw new IndexOutOfRangeException();
			}
			return _item;
		}
		set
		{
			throw new NotSupportedException();
		}
	}

	public <>z__ReadOnlySingleElementList(T item)
	{
		_item = item;
	}

	IEnumerator IEnumerable.GetEnumerator()
	{
		return new Enumerator(_item);
	}

	void ICollection.CopyTo(Array array, int index)
	{
		array.SetValue(_item, index);
	}

	int IList.Add(object value)
	{
		throw new NotSupportedException();
	}

	void IList.Clear()
	{
		throw new NotSupportedException();
	}

	bool IList.Contains(object value)
	{
		return EqualityComparer<T>.Default.Equals(_item, (T)value);
	}

	int IList.IndexOf(object value)
	{
		if (!EqualityComparer<T>.Default.Equals(_item, (T)value))
		{
			return -1;
		}
		return 0;
	}

	void IList.Insert(int index, object value)
	{
		throw new NotSupportedException();
	}

	void IList.Remove(object value)
	{
		throw new NotSupportedException();
	}

	void IList.RemoveAt(int index)
	{
		throw new NotSupportedException();
	}

	IEnumerator<T> IEnumerable<T>.GetEnumerator()
	{
		return new Enumerator(_item);
	}

	void ICollection<T>.Add(T item)
	{
		throw new NotSupportedException();
	}

	void ICollection<T>.Clear()
	{
		throw new NotSupportedException();
	}

	bool ICollection<T>.Contains(T item)
	{
		return EqualityComparer<T>.Default.Equals(_item, item);
	}

	void ICollection<T>.CopyTo(T[] array, int arrayIndex)
	{
		array[arrayIndex] = _item;
	}

	bool ICollection<T>.Remove(T item)
	{
		throw new NotSupportedException();
	}

	int IList<T>.IndexOf(T item)
	{
		if (!EqualityComparer<T>.Default.Equals(_item, item))
		{
			return -1;
		}
		return 0;
	}

	void IList<T>.Insert(int index, T item)
	{
		throw new NotSupportedException();
	}

	void IList<T>.RemoveAt(int index)
	{
		throw new NotSupportedException();
	}
}

System.Memory.dll

Decompiled 2 weeks 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 source = 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)) && (source.High < 429496729 || (source.High == 429496729 && (source.Mid < 2576980377u || (source.Mid == 2576980377u && (source.Low < 2576980377u || (source.Low == 2576980377u && *ptr <= 53)))))))
				{
					DecimalDecCalc.DecMul10(ref source);
					if (*ptr != 0)
					{
						DecimalDecCalc.DecAddInt32(ref source, (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 source, 1u);
						if ((source.High | source.Mid | source.Low) == 0)
						{
							source.High = 429496729u;
							source.Mid = 2576980377u;
							source.Low = 2576980378u;
							num++;
						}
					}
				}
			}
			if (num > 0)
			{
				return false;
			}
			if (num <= -29)
			{
				source.High = 0u;
				source.Low = 0u;
				source.Mid = 0u;
				source.Scale = 28;
			}
			else
			{
				source.Scale = -num;
			}
			source.IsNegative = number.IsNegative;
			value = Unsafe.As<MutableDecimal, decimal>(ref source);
			return true;
		}

		public static void DecimalToNumber(decimal value, ref NumberBuffer number)
		{
			ref MutableDecimal reference = ref 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>(Unsafe.AsPointer(ref _b0), 51);

		public unsafe byte* UnsafeDigits => (byte*)Unsafe.AsPointer(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>(Unsafe.As<Pinnable<T>>(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 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 = Unsafe.Add<T>((void*)handle.AddrOfPinnedObject(), _index);
				return new MemoryHandle(pointer, handle);
			}
			if (_object is T[] array)
			{
				if (_length < 0)
				{
					void* pointer2 = Unsafe.Add<T>(Unsafe.AsPointer(ref MemoryMarshal.GetReference<T>(array)), _index);
					return new MemoryHandle(pointer2);
				}
				GCHandle handle2 = GCHandle.Alloc(array, GCHandleType.Pinned);
				void* pointer3 = 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 Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), Unsafe.As<T, byte>(ref value), span.Length);
			}
			if (typeof(T) == typeof(char))
			{
				return System.SpanHelpers.IndexOf(ref Unsafe.As<T, char>(ref MemoryMarshal.GetReference(span)), 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 Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), span.Length, ref 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 Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), Unsafe.As<T, byte>(ref value), span.Length);
			}
			if (typeof(T) == typeof(char))
			{
				return System.SpanHelpers.LastIndexOf(ref Unsafe.As<T, char>(ref MemoryMarshal.GetReference(span)), 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 Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), span.Length, ref 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 Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), ref 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 Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), span.Length, ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(other)), other.Length);
			}
			if (typeof(T) == typeof(char))
			{
				return System.SpanHelpers.SequenceCompareTo(ref Unsafe.As<T, char>(ref MemoryMarshal.GetReference(span)), span.Length, ref 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 Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), Unsafe.As<T, byte>(ref value), span.Length);
			}
			if (typeof(T) == typeof(char))
			{
				return System.SpanHelpers.IndexOf(ref Unsafe.As<T, char>(ref MemoryMarshal.GetReference(span)), 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 Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), span.Length, ref 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 Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), Unsafe.As<T, byte>(ref value), span.Length);
			}
			if (typeof(T) == typeof(char))
			{
				return System.SpanHelpers.LastIndexOf(ref Unsafe.As<T, char>(ref MemoryMarshal.GetReference(span)), 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 Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), span.Length, ref 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 Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), Unsafe.As<T, byte>(ref value0), 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 Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), Unsafe.As<T, byte>(ref value0), Unsafe.As<T, byte>(ref value1), 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 Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), span.Length, ref 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 Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), Unsafe.As<T, byte>(ref value0), 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 Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), Unsafe.As<T, byte>(ref value0), Unsafe.As<T, byte>(ref value1), 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 Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), span.Length, ref 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 Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), Unsafe.As<T, byte>(ref value0), 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 Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), Unsafe.As<T, byte>(ref value0), Unsafe.As<T, byte>(ref value1), 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 Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), span.Length, ref 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 Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), Unsafe.As<T, byte>(ref value0), 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 Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), Unsafe.As<T, byte>(ref value0), Unsafe.As<T, byte>(ref value1), 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 Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), span.Length, ref 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 Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), ref 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 Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), span.Length, ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(other)), other.Length);
			}
			if (typeof(T) == typeof(char))
			{
				return System.SpanHelpers.SequenceCompareTo(ref Unsafe.As<T, char>(ref MemoryMarshal.GetReference(span)), span.Length, ref 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 Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), ref 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 Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), ref 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 Unsafe.As<T, byte>(ref Unsafe.Add(ref MemoryMarshal.GetReference(span), length - length2)), ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(value)), (NUInt)length2 * size);
				}
				return false;
			}
			if (length2 <= length)
			{
				return System.SpanHelpers.SequenceEqual(ref Unsafe.Add(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 Unsafe.As<T, byte>(ref Unsafe.Add(ref MemoryMarshal.GetReference(span), length - length2)), ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(value)), (NUInt)length2 * size);
				}
				return false;
			}
			if (length2 <= length)
			{
				return System.SpanHelpers.SequenceEqual(ref Unsafe.Add(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 = Unsafe.Add(ref reference, num);
				Unsafe.Add(ref reference, num) = Unsafe.Add(ref reference, num2);
				Unsafe.Add(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 = Unsafe.ByteOffset(ref MemoryMarshal.GetReference(span), ref MemoryMarshal.GetReference(other));
			if (Unsafe.SizeOf<IntPtr>() == 4)
			{
				if ((uint)(int)intPtr >= (uint)(span.Length * Unsafe.SizeOf<T>()))
				{
					return (uint)(int)intPtr > (uint)(-(other.Length * Unsafe.SizeOf<T>()));
				}
				return true;
			}
			if ((ulong)(long)intPtr >= (ulong)((long)span.Length * (long)Unsafe.SizeOf<T>()))
			{
				return (ulong)(long)intPtr > (ulong)(-((long)other.Length * (long)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 = Unsafe.ByteOffset(ref MemoryMarshal.GetReference(span), ref MemoryMarshal.GetReference(other));
			if (Unsafe.SizeOf<IntPtr>() == 4)
			{
				if ((uint)(int)intPtr < (uint)(span.Length * Unsafe.SizeOf<T>()) || (uint)(int)intPtr > (uint)(-(other.Length * Unsafe.SizeOf<T>())))
				{
					if ((int)intPtr % Unsafe.SizeOf<T>() != 0)
					{
						System.ThrowHelper.ThrowArgumentException_OverlapAlignmentMismatch();
					}
					elementOffset = (int)intPtr / Unsafe.SizeOf<T>();
					return true;
				}
				elementOffset = 0;
				return false;
			}
			if ((ulong)(long)intPtr < (ulong)((long)span.Length * (long)Unsafe.SizeOf<T>()) || (ulong)(long)intPtr > (ulong)(-((long)other.Length * (long)Unsafe.SizeOf<T>())))
			{
				if ((long)intPtr % Unsafe.SizeOf<T>() != 0L)
				{
					System.ThrowHelper.ThrowArgumentException_OverlapAlignmentMismatch();
				}
				elementOffset = (int)((long)intPtr / 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>(Unsafe.As<Pinnable<char>>(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>(Unsafe.As<Pinnable<char>>(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>(Unsafe.As<Pinnable<char>>(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* source = text)
			{
				return Unsafe.ByteOffset(ref Unsafe.As<Pinnable<char>>(text).Data, ref Unsafe.AsRef<char>(source));
			}
		}
	}
	[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>(Unsafe.As<Pinnable<T>>(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 = Unsafe.Add<T>((void*)handle.AddrOfPinnedObject(), _index);
				return new MemoryHandle(pointer, handle);
			}
			if (_object is T[] array)
			{
				if (_length < 0)
				{
					void* pointer2 = Unsafe.Add<T>(Unsafe.AsPointer(ref MemoryMarshal.GetReference<T>(array)), _index);
					return new MemoryHandle(pointer2);
				}
				GCHandle handle2 = GCHandle.Alloc(array, GCHandleType.Pinned);
				void* pointer3 = 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 Unsafe.Add(ref Unsafe.AsRef<T>(byteOffset.ToPointer()), index);
				}
				return ref Unsafe.Add(ref Unsafe.AddByteOffset(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 = Unsafe.As<Pinnable<T>>(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 = Unsafe.As<Pinnable<T>>(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 Unsafe.AsRef<T>(byteOffset.ToPointer());
				}
				return ref Unsafe.AddByteOffset(ref _pinnable.Data, _byteOffset);
			}
			return ref Unsafe.AsRef<T>(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 Unsafe.AreSame(ref left.DangerousGetPinnableReference(), ref right.DangerousGetPinnableReference());
			}
			return false;
		}

		public unsafe override string ToString()
		{
			if (typeof(T) == typeof(char))
			{
				if (_byteOffset == MemoryExtensions.StringAdjustment)
				{
					object obj = Unsafe.As<object>(_pinnable);
					if (obj is string text && _length == text.Length)
					{
						return text;
					}
				}
				fixed (char* value = &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 Unsafe.AsRef<T>(byteOffset.ToPointer());
			}
			return ref Unsafe.AddByteOffset(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 Unsafe.Add(ref Unsafe.AsRef<T>(byteOffset.ToPointer()), index);
				}
				return ref Unsafe.Add(ref Unsafe.AddByteOffset(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 = Unsafe.As<Pinnable<T>>(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>(Unsafe.As<Pinnable<T>>(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 = Unsafe.As<Pinnable<T>>(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 Unsafe.AsRef<T>(byteOffset.ToPointer());
				}
				return ref Unsafe.AddByteOffset(ref _pinnable.Data, _byteOffset);
			}
			return ref Unsafe.AsRef<T>(null);
		}

		public unsafe void Clear()
		{
			int length = _length;
			if (length == 0)
			{
				return;
			}
			UIntPtr byteLength = (UIntPtr)(ulong)((uint)length * Unsafe.SizeOf<T>());
			if ((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 Unsafe.As<T, byte>(ref Unsafe.AddByteOffset(ref _pinnable.Data, _byteOffset)), byteLength);
				}
			}
			else if (System.SpanHelpers.IsReferenceOrContainsReferences<T>())
			{
				UIntPtr pointerSizeLength = (UIntPtr)(ulong)(length * Unsafe.SizeOf<T>() / sizeof(IntPtr));
				System.SpanHelpers.ClearPointerSizedWithReferences(ref Unsafe.As<T, IntPtr>(ref DangerousGetPinnableReference()), pointerSizeLength);
			}
			else
			{
				System.SpanHelpers.ClearPointerSizedWithoutReferences(ref Unsafe.As<T, byte>(ref DangerousGetPinnableReference()), byteLength);
			}
		}

		public unsafe void Fill(T value)
		{
			int length = _length;
			if (length == 0)
			{
				return;
			}
			if (Unsafe.SizeOf<T>() == 1)
			{
				byte value2 = Unsafe.As<T, byte>(ref value);
				if (_pinnable == null)
				{
					IntPtr byteOffset = _byteOffset;
					Unsafe.InitBlockUnaligned(byteOffset.ToPointer(), value2, (uint)length);
				}
				else
				{
					Unsafe.InitBlockUnaligned(ref Unsafe.As<T, byte>(ref Unsafe.AddByteOffset(ref _pinnable.Data, _byteOffset)), value2, (uint)length);
				}
				return;
			}
			ref T source = ref DangerousGetPinnableReference();
			int i;
			for (i = 0; i < (length & -8); i += 8)
			{
				Unsafe.Add(ref source, i) = value;
				Unsafe.Add(ref source, i + 1) = value;
				Unsafe.Add(ref source, i + 2) = value;
				Unsafe.Add(ref source, i + 3) = value;
				Unsafe.Add(ref source, i + 4) = value;
				Unsafe.Add(ref source, i + 5) = value;
				Unsafe.Add(ref source, i + 6) = value;
				Unsafe.Add(ref source, i + 7) = value;
			}
			if (i < (length & -4))
			{
				Unsafe.Add(ref source, i) = value;
				Unsafe.Add(ref source, i + 1) = value;
				Unsafe.Add(ref source, i + 2) = value;
				Unsafe.Add(ref source, i + 3) = value;
				i += 4;
			}
			for (; i < length; i++)
			{
				Unsafe.Add(ref source, 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 Unsafe.AreSame(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 = &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 Unsafe.AsRef<T>(byteOffset.ToPointer());
			}
			return ref Unsafe.AddByteOffset(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 Unsafe.ByteOffset(ref Unsafe.As<Pinnable<T>>(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(Unsafe.Add(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 Unsafe.Add(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 Unsafe.Add(ref searchSpace, num2), value2, num3);
				if (num4 == -1)
				{
					break;
				}
				num2 += num4;
				if (SequenceEqual(ref Unsafe.Add(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, Unsafe.Add(ref value, i), searchSpaceLength);
				if ((uint)num2 < (uint)num)
				{
					num = num2;
					searchSpaceLength = num2;
					if (num == 0)
					{
						break;
					}
				}
			}
			return num;
		}

		public static int LastIndexOfAny(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 = LastIndexOf(ref searchSpace, Unsafe.Add(ref value, i), searchSpaceLength);
				if (num2 > num)
				{
					num = num2;
				}
			}
			return num;
		}

		public unsafe static int IndexOf(ref byte searchSpace, byte value, int length)
		{
			IntPtr intPtr = (IntPtr)0;
			IntPtr intPtr2 = (IntPtr)length;
			if (Vector.IsHardwareAccelerated && length >= Vector<byte>.Count * 2)
			{
				int num = (int)Unsafe.AsPointer(ref searchSpace) & (Vector<byte>.Count - 1);
				intPtr2 = (IntPtr)((Vector<byte>.Count - num) & (Vector<byte>.Count - 1));
			}
			while (true)
			{
				if ((nuint)(void*)intPtr2 >= (nuint)8u)
				{
					intPtr2 -= 8;
					if (value == Unsafe.AddByteOffset(ref searchSpace, intPtr))
					{
						goto IL_0242;
					}
					if (value == Unsafe.AddByteOffset(ref searchSpace, intPtr + 1))
					{
						goto IL_024a;
					}
					if (value == Unsafe.AddByteOffset(ref searchSpace, intPtr + 2))
					{
						goto IL_0258;
					}
					if (value != Unsafe.AddByteOffset(ref searchSpace, intPtr + 3))
					{
						if (value != Unsafe.AddByteOffset(ref searchSpace, intPtr + 4))
						{
							if (value != Unsafe.AddByteOffset(ref searchSpace, intPtr + 5))
							{
								if (value != Unsafe.AddByteOffset(ref searchSpace, intPtr + 6))
								{
									if (value == Unsafe.AddByteOffset(ref searchSpace, intPtr + 7))
									{
										break;
									}
									intPtr += 8;
									continue;
								}
								return (int)(void*)(intPtr + 6);
							}
							return (int)(void*)(intPtr + 5);
						}
						return (int)(void*)(intPtr + 4);
					}
					goto IL_0266;
				}
				if ((nuint)(void*)intPtr2 >= (nuint)4u)
				{
					intPtr2 -= 4;
					if (value == Unsafe.AddByteOffset(ref searchSpace, intPtr))
					{
						goto IL_0242;
					}
					if (value == Unsafe.AddByteOffset(ref searchSpace, intPtr + 1))
					{
						goto IL_024a;
					}
					if (value == Unsafe.AddByteOffset(ref searchSpace, intPtr + 2))
					{
						goto IL_0258;
					}
					if (value == Unsafe.AddByteOffset(ref searchSpace, intPtr + 3))
					{
						goto IL_0266;
					}
					intPtr += 4;
				}
				while ((void*)intPtr2 != null)
				{
					intPtr2 -= 1;
					if (value != Unsafe.AddByteOffset(ref searchSpace, intPtr))
					{
						intPtr += 1;
						continue;
					}
					goto IL_0242;
				}
				if (Vector.IsHardwareAccelerated && (int)(void*)intPtr < length)
				{
					intPtr2 = (IntPtr)((length - (int)(void*)intPtr) & ~(Vector<byte>.Count - 1));
					Vector<byte> vector = GetVector(value);
					for (; (void*)intPtr2 > (void*)intPtr; intPtr += Vector<byte>.Count)
					{
						Vector<byte> vector2 = Vector.Equals(vector, Unsafe.ReadUnaligned<Vector<byte>>(ref Unsafe.AddByteOffset(ref searchSpace, intPtr)));
						if (!Vector<byte>.Zero.Equals(vector2))
						{
							return (int)(void*)intPtr + LocateFirstFoundByte(vector2);
						}
					}
					if ((int)(void*)intPtr < length)
					{
						intPtr2 = (IntPtr)(length - (int)(void*)intPtr);
						continue;
					}
				}
				return -1;
				IL_0266:
				return (int)(void*)(intPtr + 3);
				IL_0242:
				return (int)(void*)intPtr;
				IL_0258:
				return (int)(void*)(intPtr + 2);
				IL_024a:
				return (int)(void*)(intPtr + 1);
			}
			return (int)(void*)(intPtr + 7);
		}

		public static int LastIndexOf(ref byte searchSpace, int searchSpaceLength, ref byte value, int valueLength)
		{
			if (valueLength == 0)
			{
				return 0;
			}
			byte value2 = value;
			ref byte second = ref Unsafe.Add(ref value, 1);
			int num = valueLength - 1;
			int num2 = 0;
			while (true)
			{
				int num3 = searchSpaceLength - num2 - num;
				if (num3 <= 0)
				{
					break;
				}
				int num4 = LastIndexOf(ref searchSpace, value2, num3);
				if (num4 == -1)
				{
					break;
				}
				if (SequenceEqual(ref Unsafe.Add(ref searchSpace, num4 + 1), ref second, num))
				{
					return num4;
				}
				num2 += num3 - num4;
			}
			return -1;
		}

		public unsafe static int LastIndexOf(ref byte searchSpace, byte value, int length)
		{
			IntPtr intPtr = (IntPtr)length;
			IntPtr intPtr2 = (IntPtr)length;
			if (Vector.IsHardwareAccelerated && length >= Vector<byte>.Count * 2)
			{
				int num = (int)Unsafe.AsPointer(ref searchSpace) & (Vector<byte>.Count - 1);
				intPtr2 = (IntPtr)(((length & (Vector<byte>.Count - 1)) + num) & (Vector<byte>.Count - 1));
			}
			while (true)
			{
				if ((nuint)(void*)intPtr2 >= (nuint)8u)
				{
					intPtr2 -= 8;
					intPtr -= 8;
					if (value == Unsafe.AddByteOffset(ref searchSpace, intPtr + 7))
					{
						break;
					}
					if (value != Unsafe.AddByteOffset(ref searchSpace, intPtr + 6))
					{
						if (value != Unsafe.AddByteOffset(ref searchSpace, intPtr + 5))
						{
							if (value != Unsafe.AddByteOffset(ref searchSpace, intPtr + 4))
							{
								if (value != Unsafe.AddByteOffset(ref searchSpace, intPtr + 3))
								{
									if (value != Unsafe.AddByteOffset(ref searchSpace, intPtr + 2))
									{
										if (value != Unsafe.AddByteOffset(ref searchSpace, intPtr + 1))
										{
											if (value != Unsafe.AddByteOffset(ref searchSpace, intPtr))
											{
												continue;
											}
											goto IL_0254;
										}
										goto IL_025c;
									}
									goto IL_026a;
								}
								goto IL_0278;
							}
							return (int)(void*)(intPtr + 4);
						}
						return (int)(void*)(intPtr + 5);
					}
					return (int)(void*)(intPtr + 6);
				}
				if ((nuint)(void*)intPtr2 >= (nuint)4u)
				{
					intPtr2 -= 4;
					intPtr -= 4;
					if (value == Unsafe.AddByteOffset(ref searchSpace, intPtr + 3))
					{
						goto IL_0278;
					}
					if (value == Unsafe.AddByteOffset(ref searchSpace, intPtr + 2))
					{
						goto IL_026a;
					}
					if (value == Unsafe.AddByteOffset(ref searchSpace, intPtr + 1))
					{
						goto IL_025c;
					}
					if (value == Unsafe.AddByteOffset(ref searchSpace, intPtr))
					{
						goto IL_0254;
					}
				}
				while ((void*)intPtr2 != null)
				{
					intPtr2 -= 1;
					intPtr -= 1;
					if (val

Microsoft.Extensions.FileProviders.Abstractions.dll

Decompiled 2 weeks 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(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[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("9.0.225.6610")]
[assembly: AssemblyInformationalVersion("9.0.2+80aa709f5d919c6814726788dc6dabe23e79e672")]
[assembly: AssemblyProduct("Microsoft® .NET")]
[assembly: AssemblyTitle("Microsoft.Extensions.FileProviders.Abstractions")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/dotnet/runtime")]
[assembly: AssemblyVersion("9.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 = GetUsingResourceKeysSwitchValue();

		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 GetUsingResourceKeysSwitchValue()
		{
			if (!AppContext.TryGetSwitch("System.Resources.UseSystemResourceKeys", out var isEnabled))
			{
				return false;
			}
			return isEnabled;
		}

		internal static bool UsingResourceKeys()
		{
			return s_usingResourceKeys;
		}

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

		private 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 NullChangeToken.Singleton;
		}
	}
	internal sealed class EmptyDisposable : IDisposable
	{
		public static EmptyDisposable Instance { get; } = new EmptyDisposable();


		private EmptyDisposable()
		{
		}

		public void Dispose()
		{
		}
	}
}

Microsoft.Extensions.Configuration.FileExtensions.dll

Decompiled 2 weeks 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(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[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("Provides a base class for file-based configuration providers used with Microsoft.Extensions.Configuration and extension methods for configuring them.")]
[assembly: AssemblyFileVersion("9.0.225.6610")]
[assembly: AssemblyInformationalVersion("9.0.2+80aa709f5d919c6814726788dc6dabe23e79e672")]
[assembly: AssemblyProduct("Microsoft® .NET")]
[assembly: AssemblyTitle("Microsoft.Extensions.Configuration.FileExtensions")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/dotnet/runtime")]
[assembly: AssemblyVersion("9.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);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static string IfNullOrWhitespace(string? argument, [CallerArgumentExpression("argument")] string paramName = "")
		{
			if (argument == null)
			{
				throw new ArgumentNullException(paramName);
			}
			if (string.IsNullOrWhiteSpace(argument))
			{
				if (argument == null)
				{
					throw new ArgumentNullException(paramName);
				}
				throw new ArgumentException(paramName, "Argument is whitespace");
			}
			return argument;
		}
	}
	internal static class SR
	{
		private static readonly bool s_usingResourceKeys = GetUsingResourceKeysSwitchValue();

		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 GetUsingResourceKeysSwitchValue()
		{
			if (!AppContext.TryGetSwitch("System.Resources.UseSystemResourceKeys", out var isEnabled))
			{
				return false;
			}
			return isEnabled;
		}

		internal static bool UsingResourceKeys()
		{
			return s_usingResourceKeys;
		}

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

		private 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 const string FileProviderKey = "FileProvider";

		private const string FileLoadExceptionHandlerKey = "FileLoadExceptionHandler";

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

		public static IFileProvider GetFileProvider(this IConfigurationBuilder builder)
		{
			System.ThrowHelper.ThrowIfNull(builder, "builder");
			if (builder.Properties.TryGetValue("FileProvider", out var value))
			{
				return (IFileProvider)value;
			}
			return new PhysicalFileProvider(AppContext.BaseDirectory ?? string.Empty);
		}

		public static IConfigurationBuilder SetBasePath(this IConfigurationBuilder builder, string basePath)
		{
			System.ThrowHelper.ThrowIfNull(builder, "builder");
			System.ThrowHelper.ThrowIfNull(basePath, "basePath");
			return builder.SetFileProvider(new PhysicalFileProvider(basePath));
		}

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

		public static Action<FileLoadExceptionContext>? GetFileLoadExceptionHandler(this IConfigurationBuilder builder)
		{
			System.ThrowHelper.ThrowIfNull(builder, "builder");
			if (builder.Properties.TryGetValue("FileLoadExceptionHandler", 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(() => Source.FileProvider.Watch(Source.Path), delegate
				{
					Thread.Sleep(Source.ReloadDelay);
					Load(reload: true);
				});
			}
		}

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

		private void Load(bool reload)
		{
			IFileInfo fileInfo2 = Source.FileProvider?.GetFileInfo(Source.Path ?? string.Empty);
			if (fileInfo2 == null || !fileInfo2.Exists)
			{
				if (Source.Optional || reload)
				{
					base.Data = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
				}
				else
				{
					StringBuilder stringBuilder = new StringBuilder(System.SR.Format(System.SR.Error_FileNotFound, Source.Path));
					if (!string.IsNullOrEmpty(fileInfo2?.PhysicalPath))
					{
						stringBuilder.Append(System.SR.Format(System.SR.Error_ExpectedPhysicalPath, fileInfo2.PhysicalPath));
					}
					HandleException(ExceptionDispatchInfo.Capture(new FileNotFoundException(stringBuilder.ToString())));
				}
			}
			else
			{
				using Stream stream = OpenRead(fileInfo2);
				try
				{
					Load(stream);
				}
				catch (Exception innerException)
				{
					if (reload)
					{
						base.Data = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
					}
					InvalidDataException source = new InvalidDataException(System.SR.Format(System.SR.Error_FailedToLoad, fileInfo2.PhysicalPath), innerException);
					HandleException(ExceptionDispatchInfo.Capture(source));
				}
			}
			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 fileProvider2 = (FileProvider = builder.GetFileProvider());
			}
			if (OnLoadException == null)
			{
				Action<FileLoadExceptionContext> action = (OnLoadException = builder.GetFileLoadExceptionHandler());
			}
		}

		public void ResolveFileProvider()
		{
			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 = new PhysicalFileProvider(directoryName);
					Path = text;
				}
			}
		}
	}
	public class FileLoadExceptionContext
	{
		public FileConfigurationProvider Provider { get; set; }

		public Exception Exception { get; set; }

		public bool Ignore { get; set; }
	}
}

SimpleInjector.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Linq;
using System.Linq.Expressions;
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 System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using SimpleInjector.Advanced;
using SimpleInjector.Advanced.Internal;
using SimpleInjector.Decorators;
using SimpleInjector.Diagnostics;
using SimpleInjector.Diagnostics.Analyzers;
using SimpleInjector.Diagnostics.Debugger;
using SimpleInjector.Internals;
using SimpleInjector.Lifestyles;
using SimpleInjector.ProducerBuilders;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: InternalsVisibleTo("SimpleInjector.Tests.Unit, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b3b15f4838ebbf7da8c0aafd638ecaf0727d70194da928e9ecc56889c1f1bfff78ec012f64e9f23602ae0741ea5fd3761507c4bea021b7503315a6e95ce620dc01d8082afef6a3282b45c2e48f298f8bed3d1b75af2b32e03a986a32da4b64ed2832b8254c7dbe723c6e412d02fb8f94603e6140237fddd4d9c2cb2905cc27d4")]
[assembly: AssemblyTitle("Simple Injector")]
[assembly: AssemblyDescription("Simple Injector is an easy-to-use Inversion of Control library for .NET.")]
[assembly: AssemblyCopyright("Copyright © Simple Injector Contributors")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Simple Injector")]
[assembly: AssemblyProduct("Simple Injector")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: CLSCompliant(true)]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyFileVersion("5.0.0.0")]
[assembly: AssemblyInformationalVersion("5.5.0+eb27d31d1fdf055bed8bcfe5c22b2a1580bbb2a9")]
[assembly: AssemblyVersion("5.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;
		}
	}
	internal class IsExternalInit
	{
	}
}
namespace SimpleInjector
{
	public class ActivationException : Exception
	{
		public ActivationException()
		{
		}

		public ActivationException(string message)
			: base(message)
		{
		}

		public ActivationException(string message, Exception innerException)
			: base(message, innerException)
		{
		}
	}
	public static class ConstructorResolutionBehaviorExtensions
	{
		public static ConstructorInfo GetConstructor(this IConstructorResolutionBehavior behavior, Type implementationType)
		{
			Requires.IsNotNull(behavior, "behavior");
			Requires.IsNotNull(implementationType, "implementationType");
			string errorMessage;
			return behavior.TryGetConstructor(implementationType, out errorMessage) ?? throw BuildActivationException(behavior, implementationType, errorMessage);
		}

		private static ActivationException BuildActivationException(IConstructorResolutionBehavior behavior, Type implementationType, string? message)
		{
			return new ActivationException((message == null || string.IsNullOrWhiteSpace(message)) ? StringResources.TypeHasNoInjectableConstructorAccordingToCustomResolutionBehavior(behavior, implementationType) : message);
		}
	}
	[DebuggerTypeProxy(typeof(ContainerDebugView))]
	public class Container : ApiObject, IAsyncDisposable, IDisposable, IServiceProvider
	{
		private interface IInstanceInitializer
		{
			bool AppliesTo(Type implementationType, InitializerContext context);

			Action<T> CreateAction<T>(InitializerContext context);
		}

		private sealed class ContextualResolveInterceptor
		{
			public readonly ResolveInterceptor Interceptor;

			public readonly Predicate<InitializationContext> Predicate;

			public ContextualResolveInterceptor(ResolveInterceptor interceptor, Predicate<InitializationContext> predicate)
			{
				Interceptor = interceptor;
				Predicate = predicate;
				base..ctor();
			}
		}

		private sealed class TypedInstanceInitializer : IInstanceInitializer
		{
			[CompilerGenerated]
			private Type <serviceType>P;

			[CompilerGenerated]
			private object <instanceInitializer>P;

			public TypedInstanceInitializer(Type serviceType, object instanceInitializer)
			{
				<serviceType>P = serviceType;
				<instanceInitializer>P = instanceInitializer;
				base..ctor();
			}

			public bool AppliesTo(Type implementationType, InitializerContext context)
			{
				return Types.GetTypeHierarchyFor(implementationType).Contains(<serviceType>P);
			}

			public Action<T> CreateAction<T>(InitializerContext context)
			{
				return Helpers.CreateAction<T>(<instanceInitializer>P);
			}

			internal static IInstanceInitializer Create<TImplementation>(Action<TImplementation> initializer)
			{
				return new TypedInstanceInitializer(typeof(TImplementation), initializer);
			}
		}

		private sealed class ContextualInstanceInitializer : IInstanceInitializer
		{
			[CompilerGenerated]
			private Predicate<InitializerContext> <predicate>P;

			[CompilerGenerated]
			private Action<InstanceInitializationData> <instanceInitializer>P;

			public ContextualInstanceInitializer(Predicate<InitializerContext> predicate, Action<InstanceInitializationData> instanceInitializer)
			{
				<predicate>P = predicate;
				<instanceInitializer>P = instanceInitializer;
				base..ctor();
			}

			public bool AppliesTo(Type implementationType, InitializerContext context)
			{
				return <predicate>P(context);
			}

			public Action<T> CreateAction<T>(InitializerContext context)
			{
				InitializerContext context2 = context;
				return delegate(T instance)
				{
					<instanceInitializer>P(new InstanceInitializationData(context2, instance));
				};
			}

			internal static IInstanceInitializer Create(Action<InstanceInitializationData> instanceInitializer, Predicate<InitializerContext> predicate)
			{
				return new ContextualInstanceInitializer(predicate, instanceInitializer);
			}
		}

		private sealed class BatchMapping
		{
			public readonly Type ImplementationType;

			public readonly IEnumerable<Type> ClosedServiceTypes;

			public BatchMapping(Type implementationType, IEnumerable<Type> closedServiceTypes)
			{
				ImplementationType = implementationType;
				ClosedServiceTypes = closedServiceTypes;
				base..ctor();
			}

			public static BatchMapping[] Build(Type openServiceType, IEnumerable<Type> implementationTypes)
			{
				Type openServiceType2 = openServiceType;
				BatchMapping[] array = implementationTypes.Select((Type implemenationType) => Build(openServiceType2, implemenationType)).ToArray();
				RequiresNoDuplicateRegistrations(array);
				return array;
			}

			public static BatchMapping Build(Type openServiceType, Type implementationType)
			{
				return new BatchMapping(implementationType, implementationType.GetBaseTypesAndInterfacesFor(openServiceType));
			}

			private static void RequiresNoDuplicateRegistrations(BatchMapping[] mappings)
			{
				var anon = (from mapping in mappings
					from closedServiceType in mapping.ClosedServiceTypes
					group mapping.ImplementationType by closedServiceType into serviceTypeGroup
					where serviceTypeGroup.Count() > 1
					select new
					{
						service = serviceTypeGroup.Key,
						implementations = serviceTypeGroup.ToArray()
					}).FirstOrDefault();
				if (anon != null)
				{
					throw new InvalidOperationException(StringResources.MultipleTypesThatRepresentClosedGenericType(anon.service, anon.implementations));
				}
			}
		}

		private sealed class NonGenericTypesToRegisterForOneToOneMappingResults
		{
			public readonly List<Type> SkippedDecorators;

			public readonly List<Type> ImplementationTypes;

			public NonGenericTypesToRegisterForOneToOneMappingResults(List<Type> skippedDecorators, List<Type> implementationTypes)
			{
				SkippedDecorators = skippedDecorators;
				ImplementationTypes = implementationTypes;
				base..ctor();
			}
		}

		private sealed class ContainerVerificationScope : Scope
		{
			public ContainerVerificationScope(Container container)
				: base(container)
			{
			}

			public override void WhenScopeEnds(Action action)
			{
			}
		}

		private enum MutableCollectionType
		{
			Array,
			List
		}

		private static long Counter;

		internal readonly Dictionary<object, Dictionary<Type, WeakReference>> LifestyleRegistrationCache = new Dictionary<object, Dictionary<Type, WeakReference>>();

		internal readonly long ContainerId;

		private readonly object locker = new object();

		private readonly List<IInstanceInitializer> instanceInitializers = new List<IInstanceInitializer>();

		private readonly List<ContextualResolveInterceptor> resolveInterceptors = new List<ContextualResolveInterceptor>();

		private readonly Dictionary<Type, IRegistrationEntry> explicitRegistrations = new Dictionary<Type, IRegistrationEntry>(64);

		private readonly Dictionary<Type, CollectionResolver> collectionResolvers = new Dictionary<Type, CollectionResolver>();

		private readonly ConditionalHashSet<InstanceProducer> externalProducers = new ConditionalHashSet<InstanceProducer>();

		private bool locked;

		private string? stackTraceThatLockedTheContainer;

		private bool disposed;

		private string? stackTraceThatDisposedTheContainer;

		private EventHandler<UnregisteredTypeEventArgs>? resolveUnregisteredType;

		private EventHandler<ExpressionBuildingEventArgs>? expressionBuilding;

		private EventHandler<ExpressionBuiltEventArgs>? expressionBuilt;

		private readonly IInstanceProducerBuilder[] producerBuilders;

		private readonly IInstanceProducerBuilder unregisteredConcreteTypeProducerBuilder;

		private readonly Dictionary<Type, List<Type>> skippedNonGenericDecorators = new Dictionary<Type, List<Type>>();

		private Dictionary<Type, InstanceProducer?> rootProducerCache = new Dictionary<Type, InstanceProducer>(ReferenceEqualityComparer<Type>.Instance);

		private readonly ThreadLocal<bool> isVerifying = new ThreadLocal<bool>();

		private readonly ThreadLocal<Scope?> resolveScope = new ThreadLocal<Scope>();

		private bool usingCurrentThreadResolveScope;

		public ContainerOptions Options { get; }

		public ContainerScope ContainerScope { get; }

		public bool IsVerifying
		{
			get
			{
				ThrowWhenDisposed();
				return isVerifying.Value;
			}
			private set
			{
				isVerifying.Value = value;
			}
		}

		public bool IsLocked
		{
			get
			{
				if (locked)
				{
					return true;
				}
				lock (locker)
				{
					return locked;
				}
			}
		}

		internal LifestyleSelectionBehaviorProxyLifestyle SelectionBasedLifestyle { get; }

		internal bool HasRegistrations
		{
			get
			{
				if (explicitRegistrations.Count <= 0)
				{
					return collectionResolvers.Count > 0;
				}
				return true;
			}
		}

		internal bool HasResolveInterceptors => resolveInterceptors.Count > 0;

		internal bool IsDisposed => disposed;

		public ContainerCollectionRegistrator Collection { get; }

		internal bool SuccesfullyVerified { get; private set; }

		internal Scope? VerificationScope { get; private set; }

		internal Scope? CurrentThreadResolveScope
		{
			get
			{
				if (!usingCurrentThreadResolveScope)
				{
					return null;
				}
				return resolveScope.Value;
			}
			set
			{
				if (!usingCurrentThreadResolveScope)
				{
					usingCurrentThreadResolveScope = true;
				}
				resolveScope.Value = value;
			}
		}

		public event EventHandler<UnregisteredTypeEventArgs> ResolveUnregisteredType
		{
			add
			{
				ThrowWhenContainerIsLockedOrDisposed();
				resolveUnregisteredType = (EventHandler<UnregisteredTypeEventArgs>)Delegate.Combine(resolveUnregisteredType, value);
			}
			remove
			{
				ThrowWhenContainerIsLockedOrDisposed();
				resolveUnregisteredType = (EventHandler<UnregisteredTypeEventArgs>)Delegate.Remove(resolveUnregisteredType, value);
			}
		}

		public event EventHandler<ExpressionBuiltEventArgs> ExpressionBuilt
		{
			add
			{
				ThrowWhenContainerIsLockedOrDisposed();
				expressionBuilt = (EventHandler<ExpressionBuiltEventArgs>)Delegate.Combine(expressionBuilt, value);
			}
			remove
			{
				ThrowWhenContainerIsLockedOrDisposed();
				expressionBuilt = (EventHandler<ExpressionBuiltEventArgs>)Delegate.Remove(expressionBuilt, value);
			}
		}

		public event EventHandler<ExpressionBuildingEventArgs> ExpressionBuilding
		{
			add
			{
				ThrowWhenContainerIsLockedOrDisposed();
				expressionBuilding = (EventHandler<ExpressionBuildingEventArgs>)Delegate.Combine(expressionBuilding, value);
			}
			remove
			{
				ThrowWhenContainerIsLockedOrDisposed();
				expressionBuilding = (EventHandler<ExpressionBuildingEventArgs>)Delegate.Remove(expressionBuilding, value);
			}
		}

		internal event Action Verifying = delegate
		{
		};

		[EditorBrowsable(EditorBrowsableState.Never)]
		public async Task DisposeContainerAsync()
		{
			await DisposeAsync().ConfigureAwait(continueOnCapturedContext: false);
		}

		public async ValueTask DisposeAsync()
		{
			if (!disposed)
			{
				stackTraceThatDisposedTheContainer = GetStackTraceOrNull();
				try
				{
					await ContainerScope.DisposeAsync().ConfigureAwait(continueOnCapturedContext: false);
				}
				finally
				{
					disposed = true;
					isVerifying.Dispose();
				}
			}
		}

		public Container()
		{
			ContainerId = Interlocked.Increment(ref Counter);
			ContainerScope = new ContainerScope(this);
			Collection = new ContainerCollectionRegistrator(this);
			Options = new ContainerOptions(this);
			SelectionBasedLifestyle = new LifestyleSelectionBehaviorProxyLifestyle(Options);
			producerBuilders = new IInstanceProducerBuilder[3]
			{
				new DependencyMetadataInstanceProducerBuilder(this),
				new UnregisteredTypeResolutionInstanceProducerBuilder(this, () => resolveUnregisteredType != null, delegate(UnregisteredTypeEventArgs e)
				{
					resolveUnregisteredType?.Invoke(this, e);
				}),
				new CollectionInstanceProducerBuilder(this)
			};
			unregisteredConcreteTypeProducerBuilder = new UnregisteredConcreteTypeInstanceProducerBuilder(this);
		}

		public InstanceProducer[] GetCurrentRegistrations()
		{
			return GetCurrentRegistrations(includeInvalidContainerRegisteredTypes: false);
		}

		public InstanceProducer[] GetRootRegistrations()
		{
			if (!SuccesfullyVerified)
			{
				throw new InvalidOperationException(StringResources.GetRootRegistrationsCanNotBeCalledBeforeVerify());
			}
			return GetRootRegistrations(includeInvalidContainerRegisteredTypes: false);
		}

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

		internal InstanceProducer[] GetRootRegistrations(bool includeInvalidContainerRegisteredTypes)
		{
			InstanceProducer[] currentRegistrations = GetCurrentRegistrations(includeInvalidContainerRegisteredTypes);
			IEnumerable<InstanceProducer> second = from <>h__TransparentIdentifier0 in currentRegistrations.Select(delegate(InstanceProducer registration)
				{
					IEnumerable<KnownRelationship> relationships2;
					if (!registration.IsContainerControlledCollection())
					{
						IEnumerable<KnownRelationship> relationships = registration.GetRelationships();
						relationships2 = relationships;
					}
					else
					{
						relationships2 = Enumerable.Empty<KnownRelationship>();
					}
					return new
					{
						registration = registration,
						relationships = relationships2
					};
				})
				from relationship in <>h__TransparentIdentifier0.relationships
				select relationship.Dependency;
			return currentRegistrations.Except(second, InstanceProducer.EqualityComparer).ToArray();
		}

		internal InstanceProducer[] GetCurrentRegistrations(bool includeInvalidContainerRegisteredTypes, bool includeExternalProducers = true)
		{
			IEnumerable<InstanceProducer> first = from entry in explicitRegistrations.Values
				from producer in entry.CurrentProducers
				select producer;
			first = first.Concat<InstanceProducer>(rootProducerCache.Values);
			if (includeExternalProducers)
			{
				first = first.Concat(externalProducers.GetLivingItems());
			}
			first = from producer in first.Distinct(InstanceProducer.EqualityComparer)
				where producer != null
				where includeInvalidContainerRegisteredTypes || producer.IsValid
				select producer;
			return first.ToArray();
		}

		internal Expression OnExpressionBuilding(Registration registration, Type implementationType, Expression instanceCreatorExpression)
		{
			if (expressionBuilding != null)
			{
				KnownRelationshipCollection knownRelationshipCollection = new KnownRelationshipCollection(registration.GetRelationships().ToList());
				ExpressionBuildingEventArgs expressionBuildingEventArgs = new ExpressionBuildingEventArgs(implementationType, instanceCreatorExpression, registration.Lifestyle, knownRelationshipCollection);
				expressionBuilding(this, expressionBuildingEventArgs);
				if (knownRelationshipCollection.HasChanged)
				{
					registration.ReplaceRelationships(expressionBuildingEventArgs.KnownRelationships);
				}
				return expressionBuildingEventArgs.Expression;
			}
			return instanceCreatorExpression;
		}

		internal ExpressionBuiltEventArgs? OnExpressionBuilt(InstanceProducer instanceProducer, Expression expression)
		{
			if (expressionBuilt != null)
			{
				KnownRelationshipCollection knownRelationshipCollection = new KnownRelationshipCollection(instanceProducer.GetRelationships().ToList());
				ExpressionBuiltEventArgs expressionBuiltEventArgs = new ExpressionBuiltEventArgs(instanceProducer.ServiceType, expression, instanceProducer, instanceProducer.Registration, knownRelationshipCollection);
				expressionBuilt(this, expressionBuiltEventArgs);
				if (knownRelationshipCollection.HasChanged)
				{
					instanceProducer.ReplaceRelationships(expressionBuiltEventArgs.KnownRelationships);
				}
				return expressionBuiltEventArgs;
			}
			return null;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		internal void LockContainer()
		{
			if (!locked)
			{
				NotifyAndLock();
			}
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		internal void ThrowWhenDisposed()
		{
			if (disposed)
			{
				ThrowContainerDisposedException();
			}
		}

		internal Func<object> WrapWithResolveInterceptor(InstanceProducer instanceProducer, Func<object> producer)
		{
			if (HasResolveInterceptors)
			{
				InitializationContext context = new InitializationContext(instanceProducer, instanceProducer.Registration);
				foreach (ResolveInterceptor item in GetResolveInterceptorsFor(context))
				{
					producer = ApplyResolveInterceptor(item, context, producer);
				}
			}
			return producer;
		}

		internal void ThrowWhenContainerIsLockedOrDisposed()
		{
			ThrowWhenDisposed();
			lock (locker)
			{
				if (locked)
				{
					throw new InvalidOperationException(StringResources.ContainerCanNotBeChangedAfterUse(stackTraceThatLockedTheContainer));
				}
			}
		}

		internal void ThrowParameterTypeMustBeRegistered(InjectionTargetInfo target)
		{
			Type targetType = target.TargetType;
			throw new ActivationException(StringResources.ParameterTypeMustBeRegistered(this, target, GetLookalikesForMissingType(target.Member.DeclaringType).Any(), GetNumberOfConditionalRegistrationsFor(targetType), ContainsOneToOneRegistrationForCollection(targetType), IsCollectionButNoOneToToOneRegistrationExists(targetType), ContainsCollectionRegistrationFor(targetType), GetNonGenericDecoratorsSkippedDuringAutoRegistration(targetType), GetLookalikesForMissingType(targetType)));
		}

		internal CollectionResolver GetContainerUncontrolledResolver(Type itemType)
		{
			return GetCollectionResolver(itemType, containerControlled: false);
		}

		internal CollectionResolver GetCollectionResolver(Type itemType, bool containerControlled)
		{
			Type registrationKey = GetRegistrationKey(itemType);
			return collectionResolvers.GetValueOrDefault(registrationKey) ?? CreateAndAddCollectionResolver(registrationKey, containerControlled);
		}

		protected virtual void Dispose(bool disposing)
		{
			if (disposing && !disposed)
			{
				stackTraceThatDisposedTheContainer = GetStackTraceOrNull();
				try
				{
					ContainerScope.Dispose();
				}
				finally
				{
					disposed = true;
					isVerifying.Dispose();
				}
			}
		}

		[DebuggerStepThrough]
		private static string? GetStackTraceOrNull()
		{
			return new StackTrace(2, fNeedFileInfo: true).ToString();
		}

		private static Func<object> ApplyResolveInterceptor(ResolveInterceptor interceptor, InitializationContext context, Func<object> wrappedProducer)
		{
			ResolveInterceptor interceptor2 = interceptor;
			InitializationContext context2 = context;
			Func<object> wrappedProducer2 = wrappedProducer;
			return () => ThrowWhenResolveInterceptorReturnsNull(interceptor2(context2, wrappedProducer2));
		}

		private CollectionResolver CreateAndAddCollectionResolver(Type openServiceType, bool controlled)
		{
			CollectionResolver collectionResolver = (controlled ? ((CollectionResolver)new ContainerControlledCollectionResolver(this, openServiceType)) : ((CollectionResolver)new ContainerUncontrolledCollectionResolver(this, openServiceType)));
			collectionResolvers.Add(openServiceType, collectionResolver);
			ResolveUnregisteredType += collectionResolver.ResolveUnregisteredType;
			Verifying += collectionResolver.TriggerUnregisteredTypeResolutionOnAllClosedCollections;
			return collectionResolver;
		}

		private void NotifyAndLock()
		{
			lock (locker)
			{
				if (!locked)
				{
					stackTraceThatLockedTheContainer = GetStackTraceOrNull();
					try
					{
						Options.RaiseContainerLockingAndReset();
					}
					finally
					{
						locked = true;
					}
				}
			}
			if (Options.EnableAutoVerification && !IsVerifying && !SuccesfullyVerified)
			{
				try
				{
					Verify();
				}
				catch (InvalidOperationException ex)
				{
					throw new ActivationException(StringResources.EnableAutoVerificationIsEnabled(ex.Message), ex);
				}
				catch (DiagnosticVerificationException ex2)
				{
					throw new ActivationException(StringResources.EnableAutoVerificationIsEnabled(ex2.Message), ex2);
				}
			}
		}

		private void ThrowContainerDisposedException()
		{
			throw new ObjectDisposedException(null, StringResources.ContainerCanNotBeUsedAfterDisposal(GetType(), stackTraceThatDisposedTheContainer));
		}

		private static object ThrowWhenResolveInterceptorReturnsNull(object? instance)
		{
			return instance ?? throw new ActivationException(StringResources.ResolveInterceptorDelegateReturnedNull());
		}

		private IEnumerable<ResolveInterceptor> GetResolveInterceptorsFor(InitializationContext context)
		{
			InitializationContext context2 = context;
			return from resolveInterceptor in resolveInterceptors
				where resolveInterceptor.Predicate(context2)
				select resolveInterceptor.Interceptor;
		}

		private Action<T>[] GetInstanceInitializersFor<T>(Type type, Registration registration)
		{
			Type type2 = type;
			if (instanceInitializers.Count == 0)
			{
				return Helpers.Array<Action<T>>.Empty;
			}
			InitializerContext context = new InitializerContext(registration);
			return (from instanceInitializer in instanceInitializers
				where instanceInitializer.AppliesTo(type2, context)
				select instanceInitializer.CreateAction<T>(context)).ToArray();
		}

		private void RegisterOpenGeneric(Type serviceType, Type implementationType, Lifestyle lifestyle, Predicate<PredicateContext>? predicate = null)
		{
			Requires.IsGenericType(serviceType, "serviceType");
			Requires.IsNotPartiallyClosed(serviceType, "serviceType");
			Requires.ServiceOrItsGenericTypeDefinitionIsAssignableFromImplementation(serviceType, implementationType, "serviceType");
			Requires.OpenGenericTypeDoesNotContainUnresolvableTypeArguments(serviceType, implementationType, "implementationType");
			GetOrCreateRegistrationalEntry(serviceType).AddGeneric(serviceType, implementationType, lifestyle, predicate);
		}

		private void AddInstanceProducer(InstanceProducer producer)
		{
			if (typeof(IEnumerable<>).IsGenericTypeDefinitionOf(producer.ServiceType) && producer.IsUnconditional)
			{
				AddUncontrolledCollectionInstanceProducer(producer);
				return;
			}
			GetOrCreateRegistrationalEntry(producer.ServiceType).Add(producer);
			RemoveExternalProducer(producer);
			rootProducerCache.Remove(producer.ServiceType);
		}

		private void AddUncontrolledCollectionInstanceProducer(InstanceProducer producer)
		{
			Type type = producer.ServiceType.GetGenericArguments()[0];
			GetContainerUncontrolledResolver(type).RegisterUncontrolledCollection(type, producer);
		}

		private int GetNumberOfConditionalRegistrationsFor(Type serviceType)
		{
			return GetRegistrationalEntryOrNull(serviceType)?.GetNumberOfConditionalRegistrationsFor(serviceType) ?? 0;
		}

		private InstanceProducer? GetInstanceProducerForType(Type serviceType, InjectionConsumerInfo consumer, Func<InstanceProducer?> buildInstanceProducer)
		{
			return GetExplicitlyRegisteredInstanceProducer(serviceType, consumer) ?? TryGetInstanceProducerForRegisteredCollection(serviceType) ?? buildInstanceProducer();
		}

		private InstanceProducer? GetExplicitlyRegisteredInstanceProducer(Type serviceType, InjectionConsumerInfo consumer)
		{
			return GetRegistrationalEntryOrNull(serviceType)?.TryGetInstanceProducer(serviceType, consumer);
		}

		private InstanceProducer? TryGetInstanceProducerForRegisteredCollection(Type enumerableServiceType)
		{
			if (!typeof(IEnumerable<>).IsGenericTypeDefinitionOf(enumerableServiceType))
			{
				return null;
			}
			return GetInstanceProducerForRegisteredCollection(enumerableServiceType.GetGenericArguments()[0]);
		}

		private InstanceProducer? GetInstanceProducerForRegisteredCollection(Type serviceType)
		{
			return collectionResolvers.GetValueOrDefault(GetRegistrationKey(serviceType))?.TryGetInstanceProducer(serviceType);
		}

		private IRegistrationEntry GetOrCreateRegistrationalEntry(Type serviceType)
		{
			Type registrationKey = GetRegistrationKey(serviceType);
			IRegistrationEntry registrationEntry = explicitRegistrations.GetValueOrDefault(registrationKey);
			if (registrationEntry == null)
			{
				registrationEntry = (explicitRegistrations[registrationKey] = RegistrationEntry.Create(serviceType, this));
			}
			return registrationEntry;
		}

		private IRegistrationEntry? GetRegistrationalEntryOrNull(Type serviceType)
		{
			return explicitRegistrations.GetValueOrDefault(GetRegistrationKey(serviceType));
		}

		private static Type GetRegistrationKey(Type serviceType)
		{
			if (!serviceType.IsGenericType())
			{
				return serviceType;
			}
			return serviceType.GetGenericTypeDefinition();
		}

		private Type[] GetLookalikesForMissingType(Type missingServiceType)
		{
			return GetLookalikesForMissingNonGenericType(missingServiceType).Concat(GetLookalikesForMissingGenericTypeDefinitions(missingServiceType)).ToArray();
		}

		private IEnumerable<Type> GetLookalikesForMissingNonGenericType(Type missingServiceType)
		{
			string name = missingServiceType.ToFriendlyName();
			return GetLookalikesFromCurrentRegistrationsForMissingNonAndClosedGenericType(name).Concat(GetLookalikesFromExplictRegistrationsForMissingNonAndClosedGenericType(name)).Except(new Type[1] { missingServiceType }).Distinct();
		}

		private IEnumerable<Type> GetLookalikesFromCurrentRegistrationsForMissingNonAndClosedGenericType(string name)
		{
			string name2 = name;
			return from registration in GetCurrentRegistrations(includeInvalidContainerRegisteredTypes: false, includeExternalProducers: false)
				let typeName = registration.ServiceType.ToFriendlyName()
				where StringComparer.OrdinalIgnoreCase.Equals(typeName, name2)
				select registration.ServiceType;
		}

		private IEnumerable<Type> GetLookalikesFromExplictRegistrationsForMissingNonAndClosedGenericType(string name)
		{
			string name2 = name;
			return from type in explicitRegistrations.Keys
				where !type.IsGenericTypeDefinition()
				let friendlyName = type.ToFriendlyName()
				where StringComparer.OrdinalIgnoreCase.Equals(friendlyName, name2)
				select type;
		}

		private IEnumerable<Type> GetLookalikesForMissingGenericTypeDefinitions(Type missingType)
		{
			if (!missingType.IsGenericType())
			{
				return Enumerable.Empty<Type>();
			}
			Type missingTypeDef = missingType.GetGenericTypeDefinition();
			string missingTypeDefName = missingTypeDef.ToFriendlyName();
			return from type in explicitRegistrations.Keys
				where type.IsGenericTypeDefinition()
				where type != missingTypeDef
				let friendlyName = type.GetGenericTypeDefinition().ToFriendlyName()
				where StringComparer.OrdinalIgnoreCase.Equals(friendlyName, missingTypeDefName)
				select type;
		}

		public void Register(Type openGenericServiceType, params Assembly[] assemblies)
		{
			Register(openGenericServiceType, assemblies, SelectionBasedLifestyle);
		}

		public void Register(Type openGenericServiceType, IEnumerable<Assembly> assemblies)
		{
			Register(openGenericServiceType, assemblies, SelectionBasedLifestyle);
		}

		public void Register(Type openGenericServiceType, Assembly assembly, Lifestyle lifestyle)
		{
			Requires.IsNotNull(assembly, "assembly");
			Register(openGenericServiceType, new Assembly[1] { assembly }, lifestyle);
		}

		public void Register(Type openGenericServiceType, IEnumerable<Assembly> assemblies, Lifestyle lifestyle)
		{
			Requires.IsNotNull(openGenericServiceType, "openGenericServiceType");
			Requires.IsNotNull(lifestyle, "lifestyle");
			Requires.IsNotNull(assemblies, "assemblies");
			Requires.IsGenericType(openGenericServiceType, "openGenericServiceType", StringResources.SuppliedTypeIsNotGenericExplainingAlternativesWithAssemblies);
			Requires.IsNotPartiallyClosed(openGenericServiceType, "openGenericServiceType");
			Requires.IsOpenGenericType(openGenericServiceType, "openGenericServiceType", StringResources.SuppliedTypeIsNotOpenGenericExplainingAlternativesWithAssemblies);
			NonGenericTypesToRegisterForOneToOneMappingResults nonGenericTypesToRegisterForOneToOneMapping = GetNonGenericTypesToRegisterForOneToOneMapping(openGenericServiceType, assemblies);
			Register(openGenericServiceType, nonGenericTypesToRegisterForOneToOneMapping.ImplementationTypes, lifestyle);
			AddSkippedDecorators(openGenericServiceType, nonGenericTypesToRegisterForOneToOneMapping.SkippedDecorators);
		}

		public void Register(Type openGenericServiceType, IEnumerable<Type> implementationTypes)
		{
			Register(openGenericServiceType, implementationTypes, SelectionBasedLifestyle);
		}

		public void Register(Type openGenericServiceType, IEnumerable<Type> implementationTypes, Lifestyle lifestyle)
		{
			Lifestyle lifestyle2 = lifestyle;
			Requires.IsNotNull(openGenericServiceType, "openGenericServiceType");
			Requires.IsNotNull(lifestyle2, "lifestyle");
			Requires.IsNotNull(implementationTypes, "implementationTypes");
			Requires.IsGenericType(openGenericServiceType, "openGenericServiceType", StringResources.SuppliedTypeIsNotGenericExplainingAlternativesWithTypes);
			Requires.IsNotPartiallyClosed(openGenericServiceType, "openGenericServiceType");
			Requires.IsOpenGenericType(openGenericServiceType, "openGenericServiceType", StringResources.SuppliedTypeIsNotOpenGenericExplainingAlternativesWithTypes);
			implementationTypes = implementationTypes.Distinct().ToArray();
			Requires.DoesNotContainNullValues(implementationTypes, "implementationTypes");
			Requires.ServiceIsAssignableFromImplementations(openGenericServiceType, implementationTypes, "implementationTypes");
			CollectionDoesNotContainOpenGenericTypes(openGenericServiceType, implementationTypes, "implementationTypes");
			foreach (var item in from mapping in BatchMapping.Build(openGenericServiceType, implementationTypes)
				let registration = lifestyle2.CreateRegistration(mapping.ImplementationType, this)
				from serviceType in mapping.ClosedServiceTypes
				select new { serviceType, registration })
			{
				AddRegistration(item.serviceType, item.registration);
			}
		}

		public void RegisterSingleton(Type openGenericServiceType, params Assembly[] assemblies)
		{
			RegisterSingleton(openGenericServiceType, (IEnumerable<Assembly>)assemblies);
		}

		public void RegisterSingleton(Type openGenericServiceType, IEnumerable<Assembly> assemblies)
		{
			Register(openGenericServiceType, assemblies, Lifestyle.Singleton);
		}

		[Obsolete("Please use Container.Collection.Register instead. Will be removed in version 6.0.", true)]
		[EditorBrowsable(EditorBrowsableState.Never)]
		public void RegisterCollection<TService>(IEnumerable<Assembly> assemblies) where TService : class
		{
			Collection.Register<TService>(assemblies);
		}

		[Obsolete("Please use Container.Collection.Register instead. Will be removed in version 6.0.", true)]
		[EditorBrowsable(EditorBrowsableState.Never)]
		public void RegisterCollection(Type serviceType, params Assembly[] assemblies)
		{
			Collection.Register(serviceType, assemblies);
		}

		[Obsolete("Please use Container.Collection.Register instead. Will be removed in version 6.0.", true)]
		[EditorBrowsable(EditorBrowsableState.Never)]
		public void RegisterCollection(Type serviceType, IEnumerable<Assembly> assemblies)
		{
			Collection.Register(serviceType, assemblies);
		}

		public IEnumerable<Type> GetTypesToRegister<TService>(IEnumerable<Assembly> assemblies)
		{
			return GetTypesToRegister(typeof(TService), assemblies, new TypesToRegisterOptions());
		}

		public IEnumerable<Type> GetTypesToRegister<TService>(params Assembly[] assemblies)
		{
			return GetTypesToRegister(typeof(TService), assemblies, new TypesToRegisterOptions());
		}

		public IEnumerable<Type> GetTypesToRegister(Type serviceType, params Assembly[] assemblies)
		{
			return GetTypesToRegister(serviceType, assemblies, new TypesToRegisterOptions());
		}

		public IEnumerable<Type> GetTypesToRegister(Type serviceType, IEnumerable<Assembly> assemblies)
		{
			return GetTypesToRegister(serviceType, assemblies, new TypesToRegisterOptions());
		}

		public IEnumerable<Type> GetTypesToRegister<TService>(IEnumerable<Assembly> assemblies, TypesToRegisterOptions options)
		{
			return GetTypesToRegister(typeof(TService), assemblies, options);
		}

		public IEnumerable<Type> GetTypesToRegister(Type serviceType, IEnumerable<Assembly> assemblies, TypesToRegisterOptions options)
		{
			Requires.IsNotNull(serviceType, "serviceType");
			Requires.IsNotNull(assemblies, "assemblies");
			Requires.IsNotNull(options, "options");
			Requires.IsNotPartiallyClosed(serviceType, "serviceType");
			return GetTypesToRegisterInternal(serviceType, assemblies, options).ToArray();
		}

		private IEnumerable<Type> GetTypesToRegisterInternal(Type serviceType, IEnumerable<Assembly> assemblies, TypesToRegisterOptions options)
		{
			TypesToRegisterOptions options2 = options;
			Type serviceType2 = serviceType;
			return from assembly in assemblies.Distinct()
				where !assembly.IsDynamic
				from type in GetTypesFromAssembly(assembly)
				where Types.IsConcreteType(type)
				where options2.IncludeGenericTypeDefinitions || !type.IsGenericTypeDefinition()
				where Types.ServiceIsAssignableFromImplementation(serviceType2, type)
				let ctor = SelectImplementationTypeConstructorOrNull(type)
				where (object)ctor == null || options2.IncludeDecorators || !Types.IsDecorator(serviceType2, ctor)
				where (object)ctor == null || options2.IncludeComposites || !Types.IsComposite(serviceType2, ctor)
				select type;
		}

		private NonGenericTypesToRegisterForOneToOneMappingResults GetNonGenericTypesToRegisterForOneToOneMapping(Type openGenericServiceType, IEnumerable<Assembly> assemblies)
		{
			Type openGenericServiceType2 = openGenericServiceType;
			TypesToRegisterOptions options = new TypesToRegisterOptions
			{
				IncludeDecorators = true
			};
			Tuple<List<Type>, List<Type>> tuple = GetTypesToRegisterInternal(openGenericServiceType2, assemblies, options).ToArray().Partition((Type type) => !IsDecorator(openGenericServiceType2, type));
			return new NonGenericTypesToRegisterForOneToOneMappingResults(implementationTypes: tuple.Item1, skippedDecorators: tuple.Item2);
		}

		private bool IsDecorator(Type openGenericServiceType, Type implemenationType)
		{
			ConstructorInfo constructorInfo = SelectImplementationTypeConstructorOrNull(implemenationType);
			if (constructorInfo != null)
			{
				return Types.IsDecorator(openGenericServiceType, constructorInfo);
			}
			return false;
		}

		private ConstructorInfo? SelectImplementationTypeConstructorOrNull(Type implementationType)
		{
			return Options.SelectConstructorOrNull(implementationType);
		}

		private static IEnumerable<Type> GetTypesFromAssembly(Assembly assembly)
		{
			try
			{
				return assembly.GetTypes();
			}
			catch (Exception innerException)
			{
				throw new InvalidOperationException(StringResources.UnableToLoadTypesFromAssembly(assembly, innerException), innerException);
			}
		}

		private void AddSkippedDecorators(Type openGenericServiceType, IEnumerable<Type> nonGenericDecorators)
		{
			if (!skippedNonGenericDecorators.ContainsKey(openGenericServiceType))
			{
				skippedNonGenericDecorators[openGenericServiceType] = new List<Type>();
			}
			skippedNonGenericDecorators[openGenericServiceType].AddRange(nonGenericDecorators);
		}

		private Type[] GetNonGenericDecoratorsSkippedDuringAutoRegistration(Type serviceType)
		{
			Type serviceType2 = serviceType;
			if (serviceType2.IsGenericType())
			{
				Type genericTypeDefinition = serviceType2.GetGenericTypeDefinition();
				if (skippedNonGenericDecorators.ContainsKey(genericTypeDefinition))
				{
					return skippedNonGenericDecorators[genericTypeDefinition].Where((Type t) => serviceType2.IsAssignableFrom(t)).ToArray();
				}
			}
			return Helpers.Array<Type>.Empty;
		}

		private static void CollectionDoesNotContainOpenGenericTypes(Type openGenericServiceType, IEnumerable<Type> typesToRegister, string paramName)
		{
			IEnumerable<Type> source = typesToRegister.Where((Type type) => type.ContainsGenericParameters());
			if (source.Any())
			{
				IEnumerable<Type> source2 = typesToRegister.Where((Type type) => !type.ContainsGenericParameters());
				throw new ArgumentException(StringResources.ThisOverloadDoesNotAllowOpenGenerics(openGenericServiceType, source.ToArray(), source2.ToArray()), paramName);
			}
		}

		[Obsolete("Please use Container.Collection.Register instead. Will be removed in version 6.0.", true)]
		public void RegisterCollection<TService>(IEnumerable<TService> containerUncontrolledCollection) where TService : class
		{
			Collection.Register(containerUncontrolledCollection);
		}

		[Obsolete("Please use Container.Collection.Register instead. Will be removed in version 6.0.", true)]
		public void RegisterCollection<TService>(params TService[] singletons) where TService : class
		{
			Collection.Register(singletons);
		}

		[Obsolete("Please use Container.Collection.Register instead. Will be removed in version 6.0.", true)]
		public void RegisterCollection<TService>(IEnumerable<Type> serviceTypes) where TService : class
		{
			RegisterCollection(typeof(TService), serviceTypes);
		}

		[Obsolete("Please use Container.Collection.Register instead. Will be removed in version 6.0.", true)]
		public void RegisterCollection<TService>(IEnumerable<Registration> registrations) where TService : class
		{
			RegisterCollection(typeof(TService), registrations);
		}

		[Obsolete("Please use Container.Collection.Register instead. Will be removed in version 6.0.", true)]
		public void RegisterCollection(Type serviceType, IEnumerable<Type> serviceTypes)
		{
			Collection.Register(serviceType, serviceTypes);
		}

		[Obsolete("Please use Container.Collection.Register instead. Will be removed in version 6.0.", true)]
		public void RegisterCollection(Type serviceType, IEnumerable<Registration> registrations)
		{
			Collection.Register(serviceType, registrations);
		}

		[Obsolete("Please use Container.Collection.Register instead. Will be removed in version 6.0.", true)]
		public void RegisterCollection(Type serviceType, IEnumerable containerUncontrolledCollection)
		{
			Collection.Register(serviceType, containerUncontrolledCollection);
		}

		public void RegisterConditional<TService, TImplementation>(Predicate<PredicateContext> predicate) where TService : class where TImplementation : class, TService
		{
			this.RegisterConditional<TService, TImplementation>((Lifestyle)SelectionBasedLifestyle, predicate);
		}

		public void RegisterConditional<TService, TImplementation>(Lifestyle lifestyle, Predicate<PredicateContext> predicate) where TService : class where TImplementation : class, TService
		{
			RegisterConditional(typeof(TService), typeof(TImplementation), lifestyle, predicate);
		}

		public void RegisterConditional(Type serviceType, Type implementationType, Predicate<PredicateContext> predicate)
		{
			RegisterConditional(serviceType, implementationType, SelectionBasedLifestyle, predicate);
		}

		public void RegisterConditional(Type serviceType, Type implementationType, Lifestyle lifestyle, Predicate<PredicateContext> predicate)
		{
			Requires.IsNotNull(serviceType, "serviceType");
			Requires.IsNotNull(implementationType, "implementationType");
			Requires.IsNotNull(lifestyle, "lifestyle");
			Requires.IsNotNull(predicate, "predicate");
			Requires.IsNotPartiallyClosed(serviceType, "serviceType", "implementationType");
			Requires.ServiceOrItsGenericTypeDefinitionIsAssignableFromImplementation(serviceType, implementationType, "serviceType");
			Requires.ImplementationHasSelectableConstructor(this, implementationType, "implementationType");
			Requires.OpenGenericTypeDoesNotContainUnresolvableTypeArguments(serviceType, implementationType, "implementationType");
			if (serviceType.ContainsGenericParameters())
			{
				RegisterOpenGeneric(serviceType, implementationType, lifestyle, predicate);
				return;
			}
			Registration registration = lifestyle.CreateRegistration(implementationType, this);
			RegisterConditional(serviceType, registration, predicate);
		}

		public void RegisterConditional(Type serviceType, Func<TypeFactoryContext, Type> implementationTypeFactory, Lifestyle lifestyle, Predicate<PredicateContext> predicate)
		{
			Requires.IsNotNull(serviceType, "serviceType");
			Requires.IsNotNull(implementationTypeFactory, "implementationTypeFactory");
			Requires.IsNotNull(lifestyle, "lifestyle");
			Requires.IsNotNull(predicate, "predicate");
			Requires.IsNotPartiallyClosed(serviceType, "serviceType");
			GetOrCreateRegistrationalEntry(serviceType).Add(serviceType, implementationTypeFactory, lifestyle, predicate);
		}

		public void RegisterConditional<TService>(Registration registration, Predicate<PredicateContext> predicate)
		{
			RegisterConditional(typeof(TService), registration, predicate);
		}

		public void RegisterConditional(Type serviceType, Registration registration, Predicate<PredicateContext> predicate)
		{
			Requires.IsNotNull(serviceType, "serviceType");
			Requires.IsNotNull(registration, "registration");
			Requires.IsNotNull(predicate, "predicate");
			Requires.IsNotOpenGenericType(serviceType, "serviceType");
			Requires.ServiceIsAssignableFromImplementation(serviceType, registration.ImplementationType, "serviceType");
			ThrowWhenContainerIsLockedOrDisposed();
			InstanceProducer producer = new InstanceProducer(serviceType, registration, predicate);
			AddInstanceProducer(producer);
		}

		public void Register<TConcrete>() where TConcrete : class
		{
			Register<TConcrete, TConcrete>(SelectionBasedLifestyle, "TConcrete", "TConcrete");
		}

		public void Register<TConcrete>(Lifestyle lifestyle) where TConcrete : class
		{
			Register<TConcrete, TConcrete>(lifestyle, "TConcrete", "TConcrete");
		}

		public void Register<TService, TImplementation>() where TService : class where TImplementation : class, TService
		{
			Register<TService, TImplementation>((Lifestyle)SelectionBasedLifestyle, "TService", "TImplementation");
		}

		public void Register<TService, TImplementation>(Lifestyle lifestyle) where TService : class where TImplementation : class, TService
		{
			Register<TService, TImplementation>(lifestyle, "TService", "TImplementation");
		}

		public void Register<TService>(Func<TService> instanceCreator) where TService : class
		{
			Register(instanceCreator, SelectionBasedLifestyle);
		}

		public void Register<TService>(Func<TService> instanceCreator, Lifestyle lifestyle) where TService : class
		{
			Requires.IsNotNull(instanceCreator, "instanceCreator");
			Requires.IsNotNull(lifestyle, "lifestyle");
			Requires.IsNotAnAmbiguousType(typeof(TService), "TService");
			Registration registration = lifestyle.CreateRegistration(instanceCreator, this);
			AddRegistration(typeof(TService), registration);
		}

		public void Register(Type concreteType)
		{
			Register(concreteType, concreteType, SelectionBasedLifestyle, "concreteType", "concreteType");
		}

		public void Register(Type serviceType, Type implementationType)
		{
			Register(serviceType, implementationType, SelectionBasedLifestyle, "serviceType", "implementationType");
		}

		public void Register(Type serviceType, Type implementationType, Lifestyle lifestyle)
		{
			Register(serviceType, implementationType, lifestyle, "serviceType", "implementationType");
		}

		public void Register(Type serviceType, Func<object> instanceCreator)
		{
			Register(serviceType, instanceCreator, SelectionBasedLifestyle);
		}

		public void Register(Type serviceType, Func<object> instanceCreator, Lifestyle lifestyle)
		{
			Requires.IsNotNull(serviceType, "serviceType");
			Requires.IsNotNull(instanceCreator, "instanceCreator");
			Requires.IsNotNull(lifestyle, "lifestyle");
			Requires.IsReferenceType(serviceType, "serviceType");
			Requires.IsNotOpenGenericType(serviceType, "serviceType");
			Requires.IsNotAnAmbiguousType(serviceType, "serviceType");
			Registration registration = lifestyle.CreateRegistration(serviceType, instanceCreator, this);
			AddRegistration(serviceType, registration);
		}

		[Obsolete("Please use RegisterInstance<TService>(TService) instead. Will be removed in version 6.0.", true)]
		[EditorBrowsable(EditorBrowsableState.Never)]
		public void RegisterSingleton<TService>(TService instance) where TService : class
		{
			RegisterInstance(instance);
		}

		public void RegisterInstance<TService>(TService instance) where TService : class
		{
			Requires.IsNotNull(instance, "instance");
			Requires.IsNotAnAmbiguousType(typeof(TService), "TService");
			Type type = instance.GetType();
			Registration registration = SingletonLifestyle.CreateSingleInstanceRegistration(typeof(TService), type, instance, this);
			AddRegistration(typeof(TService), registration);
		}

		[Obsolete("Please use RegisterInstance(Type, object) instead. Will be removed in version 6.0.", true)]
		[EditorBrowsable(EditorBrowsableState.Never)]
		public void RegisterSingleton(Type serviceType, object instance)
		{
			RegisterInstance(serviceType, instance);
		}

		public void RegisterInstance(Type serviceType, object instance)
		{
			Requires.IsNotNull(serviceType, "serviceType");
			Requires.IsNotNull(instance, "instance");
			Requires.IsNotAnAmbiguousType(serviceType, "serviceType");
			Registration registration = SingletonLifestyle.CreateSingleInstanceRegistration(serviceType, instance.GetType(), instance, this);
			AddRegistration(serviceType, registration);
		}

		public void RegisterSingleton<TConcrete>() where TConcrete : class
		{
			Register<TConcrete, TConcrete>(Lifestyle.Singleton, "TConcrete", "TConcrete");
		}

		public void RegisterSingleton<TService, TImplementation>() where TService : class where TImplementation : class, TService
		{
			Register<TService, TImplementation>((Lifestyle)Lifestyle.Singleton, "TService", "TImplementation");
		}

		public void RegisterSingleton<TService>(Func<TService> instanceCreator) where TService : class
		{
			Requires.IsNotNull(instanceCreator, "instanceCreator");
			Requires.IsNotAnAmbiguousType(typeof(TService), "TService");
			Register(instanceCreator, Lifestyle.Singleton);
		}

		public void RegisterSingleton(Type serviceType, Type implementationType)
		{
			Register(serviceType, implementationType, Lifestyle.Singleton, "serviceType", "implementationType");
		}

		public void RegisterSingleton(Type serviceType, Func<object> instanceCreator)
		{
			Register(serviceType, instanceCreator, Lifestyle.Singleton);
		}

		public void RegisterInitializer<TService>(Action<TService> instanceInitializer) where TService : class
		{
			Requires.IsNotNull(instanceInitializer, "instanceInitializer");
			ThrowWhenContainerIsLockedOrDisposed();
			instanceInitializers.Add(TypedInstanceInitializer.Create(instanceInitializer));
		}

		public void RegisterInitializer(Action<InstanceInitializationData> instanceInitializer, Predicate<InitializerContext> predicate)
		{
			Requires.IsNotNull(instanceInitializer, "instanceInitializer");
			Requires.IsNotNull(predicate, "predicate");
			ThrowWhenContainerIsLockedOrDisposed();
			instanceInitializers.Add(ContextualInstanceInitializer.Create(instanceInitializer, predicate));
		}

		public void AddRegistration<TService>(Registration registration) where TService : class
		{
			Requires.IsNotNull(registration, "registration");
			AddRegistrationInternal(typeof(TService), registration);
		}

		public void AddRegistration(Type serviceType, Registration registration)
		{
			Requires.IsNotNull(serviceType, "serviceType");
			Requires.IsNotNull(registration, "registration");
			Requires.IsNotOpenGenericType(serviceType, "serviceType");
			AddRegistrationInternal(serviceType, registration);
		}

		internal void RegisterExternalProducer(InstanceProducer producer)
		{
			lock (externalProducers)
			{
				externalProducers.Add(producer);
			}
		}

		internal void RemoveExternalProducer(InstanceProducer producer)
		{
			lock (externalProducers)
			{
				externalProducers.Remove(producer);
			}
		}

		internal void RegisterResolveInterceptor(ResolveInterceptor interceptor, Predicate<InitializationContext> predicate)
		{
			resolveInterceptors.Add(new ContextualResolveInterceptor(interceptor, predicate));
		}

		private void Register<TService, TImplementation>(Lifestyle lifestyle, string serviceTypeParamName, string implementationTypeParamName) where TService : class where TImplementation : class, TService
		{
			Requires.IsNotNull(lifestyle, "lifestyle");
			Requires.IsNotAnAmbiguousType(typeof(TService), serviceTypeParamName);
			ThrowArgumentExceptionWhenTypeIsNotConstructable(typeof(TImplementation), implementationTypeParamName);
			Registration registration = lifestyle.CreateRegistration<TImplementation>(this);
			AddRegistrationInternal(typeof(TService), registration);
		}

		private void Register(Type serviceType, Type implementationType, Lifestyle lifestyle, string serviceTypeParamName, string implementationTypeParamName)
		{
			Requires.IsNotNull(serviceType, serviceTypeParamName);
			Requires.IsNotNull(implementationType, implementationTypeParamName);
			Requires.IsNotNull(lifestyle, "lifestyle");
			Requires.IsReferenceType(serviceType, serviceTypeParamName);
			Requires.IsReferenceType(implementationType, implementationTypeParamName);
			Requires.IsNotAnAmbiguousType(serviceType, serviceTypeParamName);
			ThrowArgumentExceptionWhenTypeIsNotConstructable(implementationType, implementationTypeParamName);
			if (serviceType.ContainsGenericParameters())
			{
				RegisterOpenGeneric(serviceType, implementationType, lifestyle);
				return;
			}
			Requires.ServiceIsAssignableFromImplementation(serviceType, implementationType, implementationTypeParamName);
			Registration registration = lifestyle.CreateRegistration(implementationType, this);
			AddRegistrationInternal(serviceType, registration);
		}

		private void AddRegistrationInternal(Type serviceType, Registration registration)
		{
			Requires.IsRegistrationForThisContainer(this, registration, "registration");
			ThrowWhenContainerIsLockedOrDisposed();
			AddInstanceProducer(new InstanceProducer(serviceType, registration));
		}

		private void ThrowArgumentExceptionWhenTypeIsNotConstructable(Type implementationType, string parameterName)
		{
			if (!Options.IsConstructableType(implementationType, out string errorMessage))
			{
				throw new ArgumentException(errorMessage, parameterName);
			}
		}

		public void RegisterDecorator<TService, TDecorator>() where TService : class where TDecorator : class, TService
		{
			RegisterDecoratorCore(typeof(TService), typeof(TDecorator));
		}

		public void RegisterDecorator<TService, TDecorator>(Lifestyle lifestyle) where TService : class where TDecorator : class, TService
		{
			RegisterDecoratorCore(typeof(TService), typeof(TDecorator), null, lifestyle);
		}

		public void RegisterDecorator(Type serviceType, Type decoratorType)
		{
			RegisterDecoratorCore(serviceType, decoratorType);
		}

		public void RegisterDecorator(Type serviceType, Type decoratorType, Lifestyle lifestyle)
		{
			RegisterDecoratorCore(serviceType, decoratorType, null, lifestyle);
		}

		public void RegisterDecorator(Type serviceType, Type decoratorType, Lifestyle lifestyle, Predicate<DecoratorPredicateContext> predicate)
		{
			Requires.IsNotNull(predicate, "predicate");
			RegisterDecoratorCore(serviceType, decoratorType, predicate, lifestyle);
		}

		public void RegisterDecorator(Type serviceType, Func<DecoratorPredicateContext, Type> decoratorTypeFactory, Lifestyle lifestyle, Predicate<DecoratorPredicateContext> predicate)
		{
			Requires.IsNotNull(serviceType, "serviceType");
			Requires.IsNotNull(decoratorTypeFactory, "decoratorTypeFactory");
			Requires.IsNotNull(lifestyle, "lifestyle");
			Requires.IsNotNull(predicate, "predicate");
			DecoratorInterceptor @object = new DecoratorInterceptor(new DecoratorExpressionInterceptorData(this, serviceType, null, predicate, lifestyle, decoratorTypeFactory));
			ExpressionBuilt += @object.ExpressionBuilt;
		}

		public void RegisterDecorator(Type serviceType, Type decoratorType, Predicate<DecoratorPredicateContext> predicate)
		{
			Requires.IsNotNull(predicate, "predicate");
			RegisterDecoratorCore(serviceType, decoratorType, predicate);
		}

		private void RegisterDecoratorCore(Type serviceType, Type decoratorType, Predicate<DecoratorPredicateContext>? predicate = null, Lifestyle? lifestyle = null)
		{
			Requires.IsNotNull(serviceType, "serviceType");
			Requires.IsNotNull(decoratorType, "decoratorType");
			Requires.IsNotPartiallyClosed(serviceType, "serviceType");
			Requires.ServiceTypeIsNotClosedWhenImplementationIsOpen(serviceType, decoratorType);
			Requires.ServiceOrItsGenericTypeDefinitionIsAssignableFromImplementation(serviceType, decoratorType, "serviceType");
			Requires.ImplementationHasSelectableConstructor(this, decoratorType, "decoratorType");
			Requires.IsDecorator(this, serviceType, decoratorType, "decoratorType");
			Requires.DecoratorIsNotAnOpenGenericTypeDefinitionWhenTheServiceTypeIsNot(serviceType, decoratorType, "decoratorType");
			Requires.OpenGenericTypeDoesNotContainUnresolvableTypeArguments(serviceType, decoratorType, "decoratorType");
			DecoratorInterceptor @object = new DecoratorInterceptor(new DecoratorExpressionInterceptorData(this, serviceType, decoratorType, predicate, lifestyle ?? SelectionBasedLifestyle));
			ExpressionBuilt += @object.ExpressionBuilt;
		}

		public TService GetInstance<TService>() where TService : class
		{
			ThrowWhenDisposed();
			LockContainer();
			if (!rootProducerCache.TryGetValue(typeof(TService), out InstanceProducer value))
			{
				return (TService)GetInstanceForRootType(typeof(TService));
			}
			if (value == null)
			{
				ThrowMissingInstanceProducerException(typeof(TService));
			}
			return (TService)value.GetInstance();
		}

		public object GetInstance(Type serviceType)
		{
			ThrowWhenDisposed();
			LockContainer();
			if (!rootProducerCache.TryGetValue(serviceType, out InstanceProducer value))
			{
				return GetInstanceForRootType(serviceType);
			}
			if (value == null)
			{
				ThrowMissingInstanceProducerException(serviceType);
			}
			return value.GetInstance();
		}

		public IEnumerable<TService> GetAllInstances<TService>() where TService : class
		{
			return GetInstance<IEnumerable<TService>>();
		}

		public IEnumerable<object> GetAllInstances(Type serviceType)
		{
			Requires.IsNotNull(serviceType, "serviceType");
			Type serviceType2 = typeof(IEnumerable<>).MakeGenericType(serviceType);
			return (IEnumerable<object>)GetInstance(serviceType2);
		}

		object? IServiceProvider.GetService(Type serviceType)
		{
			Requires.IsNotNull(serviceType, "serviceType");
			ThrowWhenDisposed();
			LockContainer();
			if (!rootProducerCache.TryGetValue(serviceType, out InstanceProducer value))
			{
				value = GetRegistration(serviceType);
			}
			if (value == null || !value.IsValid)
			{
				return null;
			}
			return value.GetInstance();
		}

		public InstanceProducer? GetRegistration(Type serviceType)
		{
			return GetRegistration(serviceType, throwOnFailure: false);
		}

		public InstanceProducer? GetRegistration<TService>() where TService : class
		{
			return GetRegistration<TService>(throwOnFailure: false);
		}

		public InstanceProducer? GetRegistration<TService>(bool throwOnFailure)
		{
			return GetRegistration(typeof(TService), throwOnFailure);
		}

		public InstanceProducer? GetRegistration(Type serviceType, bool throwOnFailure)
		{
			Requires.IsNotNull(serviceType, "serviceType");
			ThrowWhenDisposed();
			if (!rootProducerCache.TryGetValue(serviceType, out InstanceProducer value))
			{
				value = GetExplicitlyRegisteredInstanceProducer(serviceType, InjectionConsumerInfo.Root);
				if (value == null)
				{
					value = GetRegistrationEvenIfInvalid(serviceType, InjectionConsumerInfo.Root);
					if (value != null)
					{
						LockContainer();
					}
				}
				AppendRootInstanceProducer(serviceType, value);
			}
			bool num = value?.IsValid ?? false;
			if (!num && throwOnFailure)
			{
				ThrowInvalidRegistrationException(serviceType, value);
			}
			if (!num)
			{
				return null;
			}
			return value;
		}

		internal Action<object>? GetInitializer(Type implementationType, Registration context)
		{
			return GetInitializer<object>(implementationType, context);
		}

		internal InstanceProducer? GetRegistrationEvenIfInvalid(Type serviceType, InjectionConsumerInfo consumer, bool autoCreateConcreteTypes = true)
		{
			Type serviceType2 = serviceType;
			if (serviceType2.ContainsGenericParameters())
			{
				throw new ArgumentException(StringResources.OpenGenericTypesCanNotBeResolved(serviceType2), "serviceType");
			}
			return GetInstanceProducerForType(serviceType2, consumer, BuildProducer);
			InstanceProducer? BuildProducer()
			{
				return BuildInstanceProducerForType(serviceType2, autoCreateConcreteTypes);
			}
		}

		internal bool IsConcreteConstructableType(Type concreteType)
		{
			string errorMessage;
			return Options.IsConstructableType(concreteType, out errorMessage);
		}

		internal InstanceProducer? GetInstanceProducerForType(Type serviceType, InjectionConsumerInfo context)
		{
			Type serviceType2 = serviceType;
			return GetInstanceProducerForType(serviceType2, context, () => BuildInstanceProducerForType(serviceType2));
		}

		private Action<T>? GetInitializer<T>(Type implementationType, Registration context)
		{
			Action<T>[] initializersForType = GetInstanceInitializersFor<T>(implementationType, context);
			if (initializersForType.Length == 0)
			{
				return null;
			}
			if (initializersForType.Length == 1)
			{
				return initializersForType[0];
			}
			return delegate(T obj)
			{
				for (int i = 0; i < initializersForType.Length; i++)
				{
					initializersForType[i](obj);
				}
			};
		}

		private object GetInstanceForRootType(Type serviceType)
		{
			if (serviceType.ContainsGenericParameters())
			{
				throw new ArgumentException(StringResources.OpenGenericTypesCanNotBeResolved(serviceType), "serviceType");
			}
			InstanceProducer instanceProducerForType = GetInstanceProducerForType(serviceType, InjectionConsumerInfo.Root);
			AppendRootInstanceProducer(serviceType, instanceProducerForType);
			return GetInstanceFromProducer(instanceProducerForType, serviceType);
		}

		private object GetInstanceFromProducer(InstanceProducer? instanceProducer, Type serviceType)
		{
			if (instanceProducer == null)
			{
				ThrowMissingInstanceProducerException(serviceType);
			}
			return instanceProducer.GetInstance();
		}

		private InstanceProducer? BuildInstanceProducerForType(Type serviceType, bool autoCreateConcreteTypes = true)
		{
			IInstanceProducerBuilder[] array = producerBuilders;
			for (int i = 0; i < array.Length; i++)
			{
				InstanceProducer instanceProducer = array[i].TryBuild(serviceType);
				if (instanceProducer != null)
				{
					return instanceProducer;
				}
			}
			if (!autoCreateConcreteTypes)
			{
				return null;
			}
			return unregisteredConcreteTypeProducerBuilder.TryBuild(serviceType);
		}

		private void AppendRootInstanceProducer(Type serviceType, InstanceProducer? rootProducer)
		{
			Helpers.InterlockedAddAndReplace(ref rootProducerCache, serviceType, rootProducer);
			if (rootProducer != null)
			{
				RemoveExternalProducer(rootProducer);
			}
		}

		private void ThrowInvalidRegistrationException(Type serviceType, InstanceProducer? producer)
		{
			if (producer != null)
			{
				throw producer.Exception;
			}
			ThrowMissingInstanceProducerException(serviceType);
		}

		internal void ThrowMissingInstanceProducerException(Type type)
		{
			if (Types.IsConcreteConstructableType(type))
			{
				ThrowNotConstructableException(type);
			}
			throw new ActivationException(StringResources.NoRegistrationForTypeFound(type, GetNumberOfConditionalRegistrationsFor(type), HasRegistrations, IsCollectionButNoOneToToOneRegistrationExists(type), ContainsOneToOneRegistrationForCollection(type), ContainsCollectionRegistrationFor(type), GetNonGenericDecoratorsSkippedDuringAutoRegistration(type), GetLookalikesForMissingType(type)));
		}

		private bool IsCollectionButNoOneToToOneRegistrationExists(Type collectionServiceType)
		{
			if (Types.IsGenericCollectionType(collectionServiceType))
			{
				return !ContainsOneToOneRegistrationForCollection(collectionServiceType);
			}
			return false;
		}

		private bool ContainsOneToOneRegistrationForCollection(Type collectionServiceType)
		{
			if (Types.IsGenericCollectionType(collectionServiceType))
			{
				return ContainsExplicitRegistrationFor(collectionServiceType.GetGenericArguments()[0]);
			}
			return false;
		}

		private bool ContainsCollectionRegistrationFor(Type serviceType)
		{
			if (!Types.IsGenericCollectionType(serviceType) && !serviceType.IsPointer)
			{
				return ContainsExplicitRegistrationFor(typeof(IEnumerable<>).MakeGenericType(serviceType));
			}
			return false;
		}

		private bool ContainsExplicitRegistrationFor(Type serviceType)
		{
			return GetRegistrationEvenIfInvalid(serviceType, InjectionConsumerInfo.Root, autoCreateConcreteTypes: false) != null;
		}

		private void ThrowNotConstructableException(Type concreteType)
		{
			Options.IsConstructableType(concreteType, out string errorMessage);
			throw new ActivationException(StringResources.ImplicitRegistrationCouldNotBeMadeForType(this, concreteType, HasRegistrations) + " " + errorMessage);
		}

		public void Verify()
		{
			Verify(VerificationOption.VerifyAndDiagnose);
		}

		public void Verify(VerificationOption option)
		{
			Requires.IsValidEnum(option, "option");
			ThrowWhenDisposed();
			bool flag = option == VerificationOption.VerifyAndDiagnose;
			VerifyInternal(flag);
			if (flag)
			{
				ThrowOnDiagnosticWarnings();
			}
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		internal Scope? GetVerificationOrResolveScopeForCurrentThread()
		{
			if (VerificationScope != null && IsVerifying)
			{
				return GetScopeWhileVerifying();
			}
			if (!usingCurrentThreadResolveScope)
			{
				return null;
			}
			return resolveScope.Value;
		}

		private Scope? GetScopeWhileVerifying()
		{
			if (usingCurrentThreadResolveScope)
			{
				return resolveScope.Value ?? VerificationScope;
			}
			return VerificationScope;
		}

		internal void UseCurrentThreadResolveScope()
		{
			usingCurrentThreadResolveScope = true;
		}

		private void VerifyInternal(bool suppressLifestyleMismatchVerification)
		{
			lock (isVerifying)
			{
				IsVerifying = true;
				LockContainer();
				bool suppressLifestyleMismatchVerification2 = Options.SuppressLifestyleMismatchVerification;
				Scope scope = Options.DefaultScopedLifestyle?.GetCurrentScope(this);
				VerificationScope = scope ?? new ContainerVerificationScope(this);
				try
				{
					if (suppressLifestyleMismatchVerification)
					{
						Options.SuppressLifestyleMismatchVerification = true;
					}
					this.Verifying();
					VerifyThatAllExpressionsCanBeBuilt();
					VerifyThatAllRootObjectsCanBeCreated(VerificationScope);
					SuccesfullyVerified = true;
				}
				finally
				{
					Options.SuppressLifestyleMismatchVerification = suppressLifestyleMismatchVerification2;
					Scope verificationScope = VerificationScope;
					VerificationScope = null;
					try
					{
						if (verificationScope is ContainerVerificationScope)
						{
							verificationScope.Dispose();
						}
					}
					finally
					{
						IsVerifying = false;
					}
				}
			}
		}

		private void VerifyThatAllExpressionsCanBeBuilt()
		{
			int num = 10;
			InstanceProducer[] currentRegistrations;
			do
			{
				num--;
				currentRegistrations = GetCurrentRegistrations(includeInvalidContainerRegisteredTypes: true);
				currentRegistrations = currentRegistrations.Where((InstanceProducer producer) => !producer.IsExpressionCreated).ToArray();
				VerifyThatAllExpressionsCanBeBuilt(currentRegistrations);
			}
			while (num > 0 && currentRegistrations.Any());
		}

		private void VerifyThatAllRootObjectsCanBeCreated(Scope verificationScope)
		{
			InstanceProducer[] rootRegistrations = GetRootRegistrations(includeInvalidContainerRegisteredTypes: true);
			IEnumerable<InstanceProducer> producersThatNeedExplicitVerification = GetProducersThatNeedExplicitVerification();
			IEnumerable<InstanceProducer> source = from producer in rootRegistrations.Concat(producersThatNeedExplicitVerification).Distinct()
				where !producer.InstanceSuccessfullyCreated || !producer.VerifiersAreSuccessfullyCalled
				select producer;
			VerifyInstanceCreation(source.ToArray(), verificationScope);
		}

		private IEnumerable<InstanceProducer> GetProducersThatNeedExplicitVerification()
		{
			return from registration in GetCurrentRegistrations(includeInvalidContainerRegisteredTypes: true)
				where registration.MustBeExplicitlyVerified
				select registration;
		}

		private static void VerifyThatAllExpressionsCanBeBuilt(InstanceProducer[] producersToVerify)
		{
			for (int i = 0; i < producersToVerify.Length; i++)
			{
				VerifyInstanceProducersOfContainerControlledCollection(producersToVerify[i].VerifyExpressionBuilding());
			}
		}

		private static void VerifyInstanceProducersOfContainerControlledCollection(Expression expression)
		{
			if ((expression as ConstantExpression)?.Value is IContainerControlledCollection containerControlledCollection)
			{
				containerControlledCollection.VerifyCreatingProducers();
			}
		}

		private void VerifyInstanceCreation(InstanceProducer[] producersToVerify, Scope verificationScope)
		{
			foreach (InstanceProducer instanceProducer in producersToVerify)
			{
				if (!instanceProducer.InstanceSuccessfullyCreated)
				{
					VerifyContainerUncontrolledCollection(instanceProducer.VerifyInstanceCreation(), instanceProducer);
				}
				if (!instanceProducer.VerifiersAreSuccessfullyCalled)
				{
					instanceProducer.DoExtraVerfication(verificationScope);
				}
			}
		}

		private static void VerifyContainerUncontrolledCollection(object instance, InstanceProducer producer)
		{
			if (producer.Registration.IsCollection && !(instance is IContainerControlledCollection))
			{
				Type serviceType = producer.ServiceType.GetGenericArguments()[0];
				Helpers.VerifyCollection((IEnumerable)instance, serviceType);
			}
		}

		private void ThrowOnDiagnosticWarnings()
		{
			DiagnosticResult[] array = (from result in Analyzer.Analyze(this)
				where result.Severity > DiagnosticSeverity.Information
				select result).ToArray();
			if (array.Length != 0)
			{
				throw new DiagnosticVerificationException(array);
			}
		}
	}
	public sealed class ContainerCollectionRegistrator : ApiObject
	{
		public Container Container { get; }

		internal ContainerCollectionRegistrator(Container container)
		{
			Requires.IsNotNull(container, "container");
			Container = container;
		}

		public IList<TService> Create<TService>(params Assembly[] assemblies) where TService : class
		{
			return Create<TService>((IEnumerable<Assembly>)assemblies);
		}

		public IList<TService> Create<TService>(IEnumerable<Assembly> assemblies) where TService : class
		{
			Requires.IsNotNull(assemblies, "assemblies");
			TypesToRegisterOptions options = new TypesToRegisterOptions
			{
				IncludeComposites = false
			};
			IEnumerable<Type> typesToRegister = Container.GetTypesToRegister(typeof(TService), assemblies, options);
			return Create<TService>(typesToRegister);
		}

		public IList<TService> Create<TService>(params Type[] serviceTypes) where TService : class
		{
			return Create<TService>((IEnumerable<Type>)serviceTypes);
		}

		public IList<TService> Create<TService>(IEnumerable<Type> serviceTypes) where TService : class
		{
			return CreateInternal<TService>(serviceTypes);
		}

		public IList<TService> Create<TService>(params Registration[] registrations) where TService : class
		{
			return Create<TService>((IEnumerable<Registration>)registrations);
		}

		public IList<TService> Create<TService>(IEnumerable<Registration> registrations) where TService : class
		{
			return CreateInternal<TService>(registrations);
		}

		public Registration CreateRegistration<TService>(params Assembly[] assemblies) where TService : class
		{
			return CreateRegistration<TService>((IEnumerable<Assembly>)assemblies);
		}

		public Registration CreateRegistration<TService>(IEnumerable<Assembly> assemblies) where TService : class
		{
			Requires.IsNotNull(assemblies, "assemblies");
			TypesToRegisterOptions options = new TypesToRegisterOptions
			{
				IncludeComposites = false
			};
			IEnumerable<Type> typesToRegister = Container.GetTypesToRegister(typeof(TService), assemblies, options);
			return CreateRegistration<TService>(typesToRegister);
		}

		public Registration CreateRegistration<TService>(params Type[] serviceTypes) where TService : class
		{
			return CreateRegistration<TService>((IEnumerable<Type>)serviceTypes);
		}

		public Registration CreateRegistration<TService>(IEnumerable<Type> serviceTypes) where TService : class
		{
			return CreateInternal<TService>(serviceTypes).ParentProducer.Registration;
		}

		public Registration CreateRegistration<TService>(params Registration[] registrations) where TService : class
		{
			return CreateRegistration<TService>((IEnumerable<Registration>)registrations);
		}

		public Registration CreateRegistration<TService>(IEnumerable<Registration> registrations) where TService : class
		{
			return CreateInternal<TService>(registrations).ParentProducer.Registration;
		}

		public void Append(Type serviceType, Registration registration)
		{
			Requires.IsNotNull(serviceType, "serviceType");
			Requires.IsNotNull(registration, "registration");
			Requires.IsReferenceType(serviceType, "serviceType");
			Requires.IsNotAnAmbiguousType(serviceType, "serviceType");
			Requires.IsRegistrationForThisContainer(Container, registration, "registration");
			Requires.ServiceOrItsGenericTypeDefinitionIsAssignableFromImplementation(serviceType, registration.ImplementationType, "registration");
			Requires.OpenGenericTypesDoNotContainUnresolvableTypeArguments(serviceType, new Registration[1] { registration }, "registration");
			AppendToCollectionInternal(serviceType, registration);
		}

		public void Append<TService, TImplementation>() where TService : class where TImplementation : class, TService
		{
			Requires.IsNotAnAmbiguousType(typeof(TService), "TService");
			AppendToCollectionInternal(typeof(TService), typeof(TImplementation));
		}

		public void Append<TService, TImplementation>(Lifestyle lifestyle) where TService : class where TImplementation : class, TService
		{
			Requires.IsNotNull(lifestyle, "lifestyle");
			Requires.IsNotAnAmbiguousType(typeof(TService), "TService");
			AppendToCollectionInternal(typeof(TService), lifestyle.CreateRegistration<TImplementation>(Container));
		}

		public void Append(Type serviceType, Type implementationType)
		{
			Requires.IsNotNull(serviceType, "serviceType");
			Requires.IsNotNull(implementationType, "implementationType");
			Requires.IsReferenceType(serviceType, "serviceType");
			Requires.IsNotAnAmbiguousType(serviceType, "serviceType");
			Requires.ServiceOrItsGenericTypeDefinitionIsAssignableFromImplementation(serviceType, implementationType, "implementationType");
			Requires.OpenGenericTypeDoesNotContainUnresolvableTypeArguments(serviceType, implementationType, "implementationType");
			AppendToCollectionInternal(serviceType, implementationType);
		}

		public void Append(Type serviceType, Type implementationType, Lifestyle lifestyle)
		{
			Requires.IsNotNull(serviceType, "serviceType");
			Requires.IsNotNull(implementationType, "implementationType");
			Requires.IsNotNull(lifestyle, "lifestyle");
			Requires.IsReferenceType(serviceType, "serviceType");
			Requires.IsNotAnAmbiguousType(serviceType, "serviceType");
			Requires.ServiceOrItsGenericTypeDefinitionIsAssignableFromImplementation(serviceType, implementationType, "implementationType");
			Requires.OpenGenericTypeDoesNotContainUnresolvableTypeArguments(serviceType, implementationType, "implementationType");
			if (implementationType.ContainsGenericParameter())
			{
				AppendToCollectionInternal(serviceType, implementationType, lifestyle);
				return;
			}
			Registration registration = lifestyle.CreateRegistration(implementationType, Container);
			AppendToCollectionInternal(serviceType, registration);
		}

		public void Append<TService>(Func<TService> instanceCreator, Lifestyle lifestyle) where TService : class
		{
			Requires.IsNotNull(instanceCreator, "instanceCreator");
			Requires.IsNotNull(lifestyle, "lifestyle");
			Requires.IsNotAnAmbiguousType(typeof(TService), "TService");
			AppendToCollectionInternal(typeof(TService), lifestyle.CreateRegistration(instanceCreator, Container));
		}

		public void AppendInstance<TService>(TService instance) where TService : class
		{
			Requires.IsNotNull(instance, "instance");
			Requires.IsNotAnAmbiguousType(typeof(TService), "TService");
			AppendToCollectionInternal(typeof(TService), Lifestyle.Singleton.CreateRegistration(typeof(TService), instance, Container));
		}

		public void AppendInstance(Type serviceType, object instance)
		{
			Requires.IsNotNull(serviceType, "serviceType");
			Requires.IsNotNull(instance, "instance");
			Requires.IsReferenceType(serviceType, "serviceType");
			Requires.IsNotAnAmbiguousType(serviceType, "serviceType");
			Requires.ServiceOrItsGenericTypeDefinitionIsAssignableFromImplementation(serviceType, instance.GetType(), "instance");
			AppendToCollectionInternal(serviceType, Lifestyle.Singleton.CreateRegistration(instance.GetType(), instance, Container));
		}

		public void Register<TService>(IEnumerable<TService> containerUncontrolledCollection) where TService : class
		{
			Requires.IsNotAnAmbiguousType(typeof(TService), "TService");
			Requires.IsNotNull(containerUncontrolledCollection, "containerUncontrolledCollection");
			RegisterContainerUncontrolledCollection(typeof(TService), containerUncontrolledCollection);
		}

		public void Register<TService>(params TService[] singletons) where TService : class
		{
			Requires.IsNotNull(singletons, "singletons");
			Requires.DoesNotContainNullValues(singletons, "singletons");
			if (typeof(TService) == typeof(Type) && singletons.Length != 0)
			{
				throw new ArgumentException(StringResources.CollectionsRegisterCalledWithTypeAsTService(singletons.Cast<Type>()), "TService");
			}
			Requires.IsNotAnAmbiguousType(typeof(TService), "TService");
			IEnumerable<Registration> registrations = singletons.Select((TService singleton) => Lifestyle.Singleton.CreateRegistration(typeof(TService), singleton, Container));
			Register(typeof(TService), registrations);
		}

		public void Register<TService>(params Type[] serviceTypes) where TService : class
		{
			Register(typeof(TService), serviceTypes);
		}

		public void Register<TService>(IEnumerable<Type> serviceTypes) where TService : class
		{
			Register(typeof(TService), serviceTypes);
		}

		public void Register<TService>(IEnumerable<Type> serviceTypes, Lifestyle lifestyle) where TService : class
		{
			Register(typeof(TService), serviceTypes, lifestyle);
		}

		public void Register<TService>(IEnumerable<Registration> registrations) where TService : class
		{
			Register(typeof(TService), registrations);
		}

		public void Register(Type serviceType, IEnumerable<Type> serviceTypes)
		{
			Requires.IsNotNull(serviceType, "serviceType");
			Requires.IsNotNull(serviceTypes, "serviceTypes");
			serviceTypes = serviceTypes.ToArray();
			Requires.DoesNotContainNullValues(serviceTypes, "serviceTypes");
			Requires.ServiceIsAssignableFromImplementations(serviceType, serviceTypes, "serviceTypes", typeCanBeServiceType: true);
			Requires.DoesNotContainOpenGenericTypesWhenServiceTypeIsNotGeneric(serviceType, serviceTypes, "serviceTypes");
			Requires.OpenGenericTypesDoNotContainUnresolvableTypeArguments(serviceType, serviceTypes, "serviceTypes");
			RegisterCollectionInternal(serviceType, serviceTypes);
		}

		public void Register(Type serviceType, IEnumerable<Type> serviceTypes, Lifestyle lifestyle)
		{
			Lifestyle lifestyle2 = lifestyle;
			Requires.IsNotNull(serviceType, "serviceType");
			Requires.IsNotNull(serviceTypes, "serviceTypes");
			Requires.IsNotNull(lifestyle2, "lifestyle");
			serviceTypes = serviceTypes.ToArray();
			Requires.DoesNotContainNullValues(serviceTypes, "serviceTypes");
			Requires.ServiceIsAssignableFromImplementations(serviceType, serviceTypes, "serviceTypes", typeCanBeServiceType: true);
			Requires.DoesNotContainOpenGenericTypesWhenServiceTypeIsNotGeneric(serviceType, serviceTypes, "serviceTypes");
			Requires.OpenGenericTypesDoNotContainUnresolvableTypeArguments(serviceType, serviceTypes, "serviceTypes");
			IEnumerable<ContainerControlledItem> source = serviceTypes.Select((Type type) => (!type.ContainsGenericParameters() && !type.IsAbstract()) ? ContainerControlledItem.CreateFromRegistration(lifestyle2.CreateRegistration(type, Container)) : ContainerControlledItem.CreateFromType(type, lifestyle2));
			RegisterCollectionInternal(serviceType, source.ToArray());
		}

		public void Register(Type serviceType, IEnumerable<Registration> registrations)
		{
			Requires.IsNotNull(serviceType, "serviceType");
			Requires.IsNotNull(registrations, "registrations");
			registrations = registrations.ToArray();
			Requires.DoesNotContainNullValues(registrations, "registrations");
			Requires.AreRegistrationsForThisContainer(Container, registrations, "registrations");
			Requires.ServiceIsAssignableFromImplementations(serviceType, registrations, "registrations", typeCanBeServiceType: true);
			Requires.OpenGenericTypesDoNotContainUnresolvableTypeArguments(serviceType, registrations, "registrations");
			RegisterCollectionInternal(serviceType, registrations);
		}

		public void Register(Type serviceType, IEnumerable containerUncontrolledCollection)
		{
			Requires.IsNotNull(serviceType, "serviceType");
			Requires.IsNotNull(containerUncontrolledCollection, "containerUncontrolledCollection");
			Requires.IsNotOpenGenericType(serviceType, "serviceType");
			Requires.IsNotAnAmbiguousType(serviceType, "serviceType");
			try
			{
				RegisterContainerUncontrolledCollection(serviceType, containerUncontrolledCollection.Cast<object>());
			}
			catch (MemberAccessException innerException)
			{
				throw new ArgumentException(StringResources.UnableToResolveTypeDueToSecurityConfiguration(serviceType, innerException) + Environment.NewLine + "paramName: serviceType", innerException);
			}
		}

		public void Register<TService>(params Assembly[] assemblies) where TService : class
		{
			Register(typeof(TService), assemblies);
		}

		public void Register<TService>(IEnumerable<Assembly> assemblies) where TService : class
		{
			Register(typeof(TService), assemblies);
		}

		public void Register<TService>(IEnumerable<Assembly> assemblies, Lifestyle lifestyle) where TService : class
		{
			Register(typeof(TService), assemblies, lifestyle);
		}

		public void Register(Type serviceType, params Assembly[] assemblies)
		{
			Register(serviceType, (IEnumerable<Assembly>)assemblies);
		}

		public void Register(Type serviceType, IEnumerable<Assembly> assemblies)
		{
			TypesToRegisterOptions options = new TypesToRegisterOptions
			{
				IncludeComposites = false
			};
			IEnumerable<Type> typesToRegister = Container.GetTypesToRegister(serviceType, assemblies, options);
			Register(serviceType, typesToRegister);
		}

		public void Register(Type serviceType, IEnumerable<Assembly> assemblies, Lifestyle lifestyle)
		{
			TypesToRegisterOptions options = new TypesToRegisterOptions
			{
				IncludeComposites = false
			};
			IEnumerable<Type> typesToRegister = Container.GetTypesToRegister(serviceType, assemblies, options);
			Register(serviceType, typesToRegister, lifestyle);
		}

		private ContainerControlledCollection<TService> CreateInternal<TService>(IEnumerable<Type> serviceTypes) where TService : class
		{
			Requires.IsNotAnAmbiguousType(typeof(TService), "TService");
			Requires.IsNotNull(serviceTypes, "serviceTypes");
			serviceTypes = serviceTypes.ToArray();
			Requires.DoesNotContainNullValues(serviceTypes, "serviceTypes");
			Requires.ServiceIsAssignableFromImplementations(typeof(TService), serviceTypes, "serviceTypes", typeCanBeServiceType: true);
			Requires.DoesNotContainOpenGenericTypesWhenServiceTypeIsNotGeneric(typeof(TService), serviceTypes, "serviceTypes");
			Requires.OpenGenericTypesDoNotContainUnresolvableTypeArguments(typeof(TService), serviceTypes, "serviceTypes");
			ContainerControlledCollection<TService> containerControlledCollection = new ContainerControlledCollection<TService>(Container);
			containerControlledCollection.AppendAll(serviceTypes);
			RegisterForVerification(containerControlledCollection);
			return containerControlledCollection;
		}

		private ContainerControlledCollection<TService> CreateInternal<TService>(IEnumerable<Registration> registrations) where TService : class
		{
			Requires.IsNotAnAmbiguousType(typeof(TService), "TService");
			Requires.IsNotNull(registrations, "registrations");
			Requires.DoesNotContainNullValues(registrations, "registrations");
			Requires.AreRegistrationsForThisContainer(Container, registrations, "registrations");
			Requires.ServiceIsAssignableFromImplementations(typeof(TService), registrations, "registrations", typeCanBeServiceType: true);
			Requires.OpenGenericTypesDoNotContainUnresolvableTypeArguments(typeof(TService), registrations, "registrations");
			ContainerControlledCollection<TService> containerControlledCollection = new ContainerControlledCollection<TService>(Container);
			containerControlledCollection.AppendAll(registrations);
			RegisterForVerification(containerControlledCollection);
			return containerControlledCollection;
		}

		private void RegisterForVerification<TService>(ContainerControlledCollection<TService> collection)
		{
			collection.ParentProducer = collection.CreateInstanceProducer(Container);
		}

		private void AppendToCollectionInternal(Type itemType, Registration registration)
		{
			RegisterCollectionInternal(itemType, new ContainerControlledItem[1] { ContainerControlledItem.CreateFromRegistration(registration) }, appending: true);
		}

		private void AppendToCollectionInternal(Type itemType, Type implementationType, Lifestyle? lifestyle = null)
		{
			RegisterCollectionInternal(itemType, new ContainerControlledItem[1] { ContainerControlledItem.CreateFromType(implementationType, lifestyle) }, appending: true);
		}

		private void RegisterCollectionInternal(Type itemType, IEnumerable<Registration> registrations)
		{
			ContainerControlledItem[] controlledItems = registrations.Select(ContainerControlledItem.CreateFromRegistration).ToArray();
			RegisterCollectionInternal(itemType, controlledItems);
		}

		private void RegisterCollectionInternal(Type itemType, IEnumerable<Type> serviceTypes)
		{
			ContainerControlledItem[] controlledItems = serviceTypes.Select(ContainerControlledItem.CreateFromType).ToArray();
			RegisterCollectionInternal(itemType, controlledItems);
		}

		private void RegisterCollectionInternal(Type itemType, ContainerControlledItem[] controlledItems, bool appending = false)
		{
			Container.ThrowWhenContainerIsLockedOrDisposed();
			RegisterGenericContainerControlledCollection(itemType, controlledItems, appending);
		}

		private void RegisterGenericContainerControlledCollection(Type itemType, ContainerControlledItem[] controlledItems, bool appending)
		{
			GetContainerControlledResolver(itemType).AddControlledRegistrations(itemType, controlledItems, appending);
		}

		private void RegisterGenericContainerUncontrolledCollection(Type itemType, IEnumerable collection)
		{
			CollectionResolver containerUncontrolledResolver = Container.GetContainerUncontrolledResolver(itemType);
			InstanceProducer producer = SingletonLifestyle.CreateUncontrolledCollectionProducer(itemType, collection, Container);
			containerUncontrolledResolver.RegisterUncontrolledCollection(itemType, producer);
		}

		private void RegisterContainerUncontrolledCollection<T>(Type itemType, IEnumerable<T> containerUncontrolledCollection)
		{
			IEnumerable collection = Helpers.CastCollection(containerUncontrolledCollection.MakeReadOnly(), itemType);
			RegisterGenericContainerUncontrolledCollection(itemType, collection);
		}

		private CollectionResolver GetContainerControlledResolver(Type itemType)
		{
			return Container.GetCollectionResolver(itemType, containerControlled: true);
		}
	}
	public class ContainerLockingEventArgs : EventArgs
	{
		internal ContainerLockingEventArgs()
		{
		}
	}
	public delegate object ResolveInterceptor(InitializationContext context, Func<object> instanceProducer);
	[DebuggerDisplay("{DebuggerDisplayDescription, nq}")]
	public class ContainerOptions : ApiObject
	{
		[DebuggerBrowsable(DebuggerBrowsableState.Never)]
		private EventHandler<ContainerLockingEventArgs>? containerLocking;

		[DebuggerBrowsable(DebuggerBrowsableState.Never)]
		private IConstructorResolutionBehavior resolutionBehavior;

		[DebuggerBrowsable(DebuggerBrowsableState.Never)]
		private IDependencyInjectionBehavior injectionBehavior;

		[DebuggerBrowsable(DebuggerBrowsableState.Never)]
		private IPropertySelectionBehavior propertyBehavior;

		[DebuggerBrowsable(DebuggerBrowsableState.Never)]
		private ILifestyleSelectionBehavior lifestyleBehavior;

		[DebuggerBrowsable(DebuggerBrowsableState.Never)]
		private IExpressionCompilationBehavior compilationBehavior;

		[DebuggerBrowsable(DebuggerBrowsableState.Never)]
		private Lifestyle defaultLifestyle = Lifestyle.Transient;

		[DebuggerBrowsable(DebuggerBrowsableState.Never)]
		private ScopedLifestyle? defaultScopedLifestyle;

		[DebuggerBrowsable(DebuggerBrowsableState.Never)]
		private bool resolveUnregisteredConcreteTypes;

		[DebuggerBrowsable(DebuggerBrowsableState.Never)]
		private bool useStrictLifestyleMismatchBehavior;

		[DebuggerBrowsable(DebuggerBrowsableState.Never)]
		public Container Container { get; }

		public bool AllowOverridingRegistrations { get; set; }

		public bool SuppressLifestyleMismatchVerification { get; set; }

		[Obsolete("Please use the UseStrictLifestyleMismatchBehavior property instead. Note that UseStrictLifestyleMismatchBehavior's behavior is negated. This means that if you're currently supplying 'false' to UseLoosenedLifestyleMismatchBehavior, you will have to supply 'true' to UseStrictLifestyleMismatchBehavior instead, and vise versa. Also note that 'loosend' behavior became the default in 5.0 — In case you are assinging UseLoosenedLifestyleMismatchBehavior to 'true', the call can be removed safely. Will be treated as an error from version 5.5. Will be removed in version 6.0.", false)]
		[EditorBrowsable(EditorBrowsableState.Never)]
		public bool UseLoosenedLifestyleMismatchBehavior
		{
			get
			{
				return !UseStrictLifestyleMismatchBehavior;
			}
			set
			{
				UseStrictLifestyleMismatchBehavior = !value;
			}
		}

		public bool UseStrictLifestyleMismatchBehavior
		{
			get
			{
				return useStrictLifestyleMismatchBehavior;
			}
			set
			{
				Container.ThrowWhenContainerIsLockedOrDisposed();
				useStrictLifestyleMismatchBehavior = value;
			}
		}

		public bool EnableAutoVerification { get; set; } = true;


		public bool UseFullyQualifiedTypeNames
		{
			get
			{
				return StringResources.UseFullyQualifiedTypeNames;
			}
			set
			{
				StringResources.UseFullyQualifiedTypeNames = value;
			}
		}

		public bool ResolveUnregisteredConcreteTypes
		{
			get
			{
				return resolveUnregisteredConcreteTypes;
			}
			set
			{
				Container.ThrowWhenContainerIsLockedOrDisposed();
				resolveUnregisteredConcreteTypes = value;
			}
		}

		public IConstructorResolutionBehavior ConstructorResolutionBehavior
		{
			get
			{
				return resolutionBehavior;
			}
			set
			{
				Requires.IsNotNull(value, "value");
				ThrowWhenContainerHasRegistrations("ConstructorResolutionBehavior");
				resolutionBehavior = value;
			}
		}

		public IDependencyInjectionBehavior DependencyInjectionBehavior
		{
			get
			{
				return injectionBehavior;
			}
			set
			{
				Requires.IsNotNull(value, "value");
				ThrowWhenContainerHasRegistrations("DependencyInjectionBehavior");
				injectionBehavior = value;
			}
		}

		public IPropertySelectionBehavior PropertySelectionBehavior
		{
			get
			{
				return propertyBehavior;
			}
			set
			{
				Requires.IsNotNull(value, "value");
				ThrowWhenContainerHasRegistrations("PropertySelectionBehavior");
				propertyBehavior = value;
			}
		}

		public ILifestyleSelectionBehavior LifestyleSelectionBehavior
		{
			get
			{
				return lifestyleBehavior;
			}
			set
			{
				Requires.IsNotNull(value, "value");
				ThrowWhenContainerHasRegistrations("LifestyleSelectionBehavior");
				lifestyleBehavior = value;
			}
		}

		public IExpressionCompilationBehavior ExpressionCompilationBehavior
		{
			get
			{
				return compilationBehavior;
			}
			set
			{
				Requires.IsNotNull(value, "value");
				ThrowWhenContainerHasRegistrations("ExpressionCompilationBehavior");
				compilationBehavior = value;
			}
		}

		public Lifestyle DefaultLifestyle
		{
			get
			{
				return defaultLifestyle;
			}
			set
			{
				Requires.IsNotNull(value, "value");
				ThrowWhenContainerHasRegistrations("DefaultLifestyle");
				defaultLifestyle = value;
			}
		}

		public ScopedLifestyle? DefaultScopedLifestyle
		{
			get
			{
				return defaultScopedLifestyle;
			}
			set
			{
				Requires.IsNotNull(value, "value");
				if (value == Lifestyle.Scoped)
				{
					throw new ArgumentException(StringResources.DefaultScopedLifestyleCanNotBeSetWithLifetimeScoped(), "value");
				}
				ThrowWhenContainerHasRegistrations("DefaultScopedLifestyle");
				defaultScopedLifestyle = value;
			}
		}

		[DebuggerBrowsable(DebuggerBrowsableState.Never)]
		[Obsolete("Changing this value to true has no effect. To use dynamic assembly compilation, set the ExpressionCompilationBehavior property with a new DynamicAssemblyExpressionCompilationBehavior instance that is located in the SimpleInjector.DynamicAssemblyCompilation package. Will be treated as an error from version 5.5. Will be removed in version 6.0.", false)]
		public bool EnableDynamicAssemblyCompilation { get; set; }

		[DebuggerBrowsable(DebuggerBrowsableState.Never)]
		internal int MaximumNumberOfNodesPerDelegate { get; set; } = 350;


		[DebuggerBrowsable(DebuggerBrowsableState.Never)]
		internal string DebuggerDisplayDescription => ToString();

		public event EventHandler<ContainerLockingEventArgs> ContainerLocking
		{
			add
			{
				Container.ThrowWhenContainerIsLockedOrDisposed();
				containerLocking = (EventHandler<ContainerLockingEventArgs>)Delegate.Combine(containerLocking, value);
			}
			remove
			{
				Container.ThrowWhenContainerIsLockedOrDisposed();
				containerLocking = (EventHandler<ContainerLockingEventArgs>)Delegate.Remove(containerLocking, value);
			}
		}

		internal ContainerOptions(Container container)
		{
			Requires.IsNotNull(container, "container");
			Container = container;
			resolutionBehavior = new DefaultConstructorResolutionBehavior();
			injectionBehavior = new DefaultDependencyInjectionBehavior(container);
			propertyBehavior = new DefaultPropertySelectionBehavior();
			lifestyleBehavior = new DefaultLifestyleSelectionBehavior(this);
			compilationBehavior = new DefaultExpressionCompilationBehavior();
		}

		public void RegisterResolveInterceptor(ResolveInterceptor interceptor, Predicate<InitializationContext> predicate)
		{
			Requires.IsNotNull(interceptor, "interceptor");
			Requires.IsNotNull(predicate, "predicate");
			Container.ThrowWhenContainerIsLockedOrDisposed();
			Container.RegisterResolveInterceptor(interceptor, predicate);
		}

		public override string ToString()
		{
			List<string> list = new List<string>(1);
			if (AllowOverridingRegistrations)
			{
				list.Add("Allows Overriding Registrations");
			}
			if (!(ConstructorResolutionBehavior is DefaultConstructorResolutionBehavior))
			{
				list.Add("Custom Constructor Resolution");
			}
			if (!(DependencyInjectionBehavior is DefaultDependencyInjectionBehavior))
			{
				list.Add("Custom Dependency Injection");
			}
			if (!(PropertySelectionBehavior is DefaultPropertySelectionBehavior))
			{
				list.Add("Custom Property Selection");
			}
			if (!(LifestyleSelectionBehavior is DefaultLifestyleSelectionBehavior))
			{
				list.Add("Custom Lifestyle Selection");
			}
			if (list.Count == 0)
			{
				list.Add("Default Configuration");
			}
			return string.Join(", ", list);
		}

		internal bool IsConstructableType(Type implementationType, out string? errorMessage)
		{
			if (!Types.IsConcreteType(implementationType))
			{
				errorMessage = StringResources.TypeShouldBeConcreteToBeUsedOnThisMethod(implementationType);
				return false;
			}
			ConstructorInfo constructorInfo = ConstructorResolutionBehavior.TryGetConstructor(implementationType, out errorMessage);
			if ((object)constructorInfo == null && errorMessage == null)
			{
				throw new InvalidOperationException(StringResources.TypeHasNoInjectableConstructorAccordingToCustomResolutionBehavior(ConstructorResolutionBehavior, implementationType));
			}
			if (constructorInfo != null)
			{
				errorMessage = DependencyInjectionBehavior.VerifyConstructor(constructorInfo);
			}
			return errorMessage == null;
		}

		internal InstanceProducer GetInstanceProducerFor(InjectionConsumerInfo consumer)
		{
			return DependencyInjectionBehavior.GetInstanceProducer(consumer, throwOnFailure: true) ?? throw new ActivationException(StringResources.DependencyInjectionBehaviorReturnedNull(DependencyInjectionBehavior));
		}

		internal Lifestyle SelectLifestyle(Type implementationType)
		{
			return LifestyleSelectionBehavior.SelectLifestyle(implementationType) ?? throw new ActivationException(StringResources.LifestyleSelectionBehaviorReturnedNull(LifestyleSelectionBehavior, implementationType));
		}

		internal void RaiseContainerLockingAndReset()
		{
			EventHandler<ContainerLockingEventArgs> eventHandler = containerLocking;
			if (eventHandler != null)
			{
				containerLocking = null;
				eventHandler(Container, new ContainerLockingEventArgs());
			}
		}

		internal ConstructorInfo? SelectConstructorOrNull(Type implementationType)
		{
			string errorMessage;
			return ConstructorResolutionBehavior.TryGetConstructor(implementationType, out errorMessage);
		}

		internal ConstructorInfo SelectConstructor(Type implementatioType)
		{
			return ConstructorResolutionBehavior.GetConstructor(implementatioType);
		}

		private void ThrowWhenContainerHasRegistrations(string propertyName)
		{
			if (Container.IsLocked || Container.HasRegistrations)
			{
				throw new InvalidOperationException(StringResources.PropertyCanNotBeChangedAfterTheFirstRegistration(propertyName));
			}
		}
	}
	public class ContainerScope : ApiObject, IAsyncDisposable
	{
		private readonly Scope scope;

		[EditorBrowsable(EditorBrowsableState.Never)]
		public async Task DisposeScopeAsync()
		{
			await DisposeAsync().ConfigureAwait(continueOnCapturedContext: false);
		}

		public ValueTask DisposeAsync()
		{
			return scope.DisposeAsync();
		}

		internal ContainerScope(Container container)
		{
			scope = new Scope(container)
			{
				IsContainerScope = true
			};
		}

		public virtual void WhenScopeEnds(Action action)
		{
			scope.WhenScopeEnds(action);
		}

		public void RegisterForDisposal(IDisposable disposable)
		{
			scope.RegisterForDisposal(disposable);
		}

		public void RegisterForDisposal(object disposable)
		{
			scope.RegisterForDisposal(disposable);
		}

		public object? GetItem(object key)
		{
			return scope.GetItem(key);
		}

		public void SetItem(object key, object item)
		{
			scope.SetItem(key, item);
		}

		public T GetOrSetItem<T>(object key, Func<Container, object, T> valueFactory)
		{
			Requires.IsNotNull(key, "key");
			Requires.IsNotNull(valueFactory, "valueFactory");
			return scope.GetOrSetItem(key, valueFactory);
		}

		public IDisposable[] GetDisposables()
		{
			return scope.GetDisposables();
		}

		public object[] GetAllDisposables()
		{
			return scope.GetAllDisposables();
		}

		internal void Dispose()
		{
			scope.Dispose();
		}
	}
	[DebuggerDisplay("DecoratorContext ({DebuggerDisplay, nq})")]
	public sealed class DecoratorContext : ApiObject
	{
		[DebuggerBrowsable(DebuggerBrowsableState.Never)]
		private readonly DecoratorPredicateContext context;

		public Type ServiceType => context.ServiceType;

		public Type ImplementationType => context.ImplementationType;

		public ReadOnlyCollection<Type> AppliedDecorators => context.AppliedDecorators;

		public Expression Expression => context.Expression;

		[DebuggerBrowsable(DebuggerBrowsableState.Never)]
		internal string DebuggerDisplay => context.DebuggerDisplay;

		internal DecoratorContext(DecoratorPredicateContext context)
		{
			this.context = context;
		}
	}
	[DebuggerDisplay("DecoratorPredicateContext ({DebuggerDisplay, nq})")]
	public sealed class DecoratorPredicateContext : ApiObject
	{
		public Type ServiceType { get; }

		public Type ImplementationType { get; }

		public ReadOnlyCollection<Type> AppliedDecorators { get; }

		public Expression Expression { get; }

		[DebuggerBrowsable(DebuggerBrowsableState.Never)]
		internal string DebuggerDisplay => string.Format(CultureInfo.InvariantCulture, "{0} = {1}, {2} = {3}", "ServiceType", ServiceType.ToFriendlyName(), "ImplementationType", ImplementationType.ToFriendlyName());

		internal DecoratorPredicateContext(Type serviceType, Type implementationType, ReadOnlyCollection<Type> appliedDecorators, Expression expression)
		{
			ServiceType = serviceType;
			ImplementationType = implementationType;
			AppliedDecorators = appliedDecorators;
			Expression = expression;
		}

		internal static DecoratorPredicateContext CreateFromInfo(Type serviceType, Expression expression, ServiceTypeDecoratorInfo info)
		{
			ReadOnlyCollection<Type> appliedDecorators = new ReadOnlyCollection<Type>(info.AppliedDecorators.Select((DecoratorInfo d) => d.DecoratorType).ToList());
			return new DecoratorPredicateContext(serviceType, info.ImplementationType, appliedDecorators, expression);
		}
	}
	public static class DependencyInjectionBehaviorExtensions
	{
		public static void Verify(this IDependencyInjectionBehavior behavior, InjectionConsumerInfo consumer)
		{
			Requires.IsNotNull(behavior, "behavior");
			Requires.IsNotNull(consumer, "consumer");
			if (!behavior.VerifyDependency(consumer, out string errorMessage))
			{
				throw new ActivationException((errorMessage == null || string.IsNullOrWhiteSpace(errorMessage)) ? StringResources.DependencyNotValidForInjectionAccordingToCustomInjectionBehavior(behavior, consumer) : errorMessage);
			}
		}

		internal static string? VerifyConstructor(this IDependen

TrainworksReloaded.Base.dll

Decompiled 2 weeks 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.Runtime.CompilerServices;
using System.Runtime.Serialization;
using System.Runtime.Versioning;
using System.Text;
using BepInEx.Logging;
using HarmonyLib;
using I2.Loc;
using Malee;
using Microsoft.CodeAnalysis;
using Microsoft.Extensions.Configuration;
using RotaryHeart.Lib.SerializableDictionary;
using ShinyShoe;
using ShinyShoe.Logging;
using TMPro;
using TrainworksReloaded.Base.Card;
using TrainworksReloaded.Base.Extensions;
using TrainworksReloaded.Base.Localization;
using TrainworksReloaded.Base.Prefab;
using TrainworksReloaded.Base.Trigger;
using TrainworksReloaded.Core.Enum;
using TrainworksReloaded.Core.Extensions;
using TrainworksReloaded.Core.Impl;
using TrainworksReloaded.Core.Interfaces;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.AddressableAssets.ResourceLocators;
using UnityEngine.ResourceManagement.AsyncOperations;
using UnityEngine.ResourceManagement.ResourceLocations;
using UnityEngine.ResourceManagement.ResourceProviders;
using UnityEngine.ResourceManagement.Util;
using UnityEngine.TextCore;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("TrainworksReloaded.Base")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.2.9.0")]
[assembly: AssemblyInformationalVersion("0.2.9+53b4c01ba054c7d6cd2aef9a82805b8ee39b94e8")]
[assembly: AssemblyProduct("TrainworksReloaded.Base")]
[assembly: AssemblyTitle("TrainworksReloaded.Base")]
[assembly: AssemblyVersion("0.2.9.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 TrainworksReloaded.Base
{
	public class ProviderDetails
	{
		public bool IsInitialized { get; set; }

		public IProvider Provider { get; set; }

		public ProviderDetails(bool isInit, IProvider provider)
		{
			IsInitialized = isInit;
			Provider = provider;
		}
	}
	public class GameDataClient : Dictionary<string, ProviderDetails>, IClient
	{
		public void NewProviderAvailable(IProvider newProvider)
		{
			Add(((object)newProvider).GetType().Name, new ProviderDetails(isInit: false, newProvider));
		}

		public void NewProviderFullyInstalled(IProvider newProvider)
		{
			if (ContainsKey(((object)newProvider).GetType().Name))
			{
				base[((object)newProvider).GetType().Name].IsInitialized = true;
			}
		}

		public void ProviderRemoved(IProvider removeProvider)
		{
			Remove(((object)removeProvider).GetType().Name);
		}
	}
	public class ModLoggerWrapper
	{
		private readonly Type type;

		private readonly object data;

		public ModLoggerWrapper(Type type, object data)
		{
			this.type = type;
			this.data = data;
			base..ctor();
		}

		public override string ToString()
		{
			return string.Format("{0,-32} {1}", "[" + type.Name + "]", data);
		}
	}
	public class ModLogger<T> : IModLogger<T>, ILogProvider
	{
		private readonly ManualLogSource manualLogSource;

		public ModLogger(ManualLogSource manualLogSource)
		{
			this.manualLogSource = manualLogSource;
			base..ctor();
		}

		public void CloseLog()
		{
		}

		public void Debug(string log, LogOptions options)
		{
			Log((LogLevel)32, log);
		}

		public void Error(string log, LogOptions options)
		{
			Log((LogLevel)2, log);
		}

		public void Info(string log, LogOptions options)
		{
			Log((LogLevel)16, log);
		}

		public void Log(LogLevel level, object data)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			manualLogSource.Log((LogLevel)level, (object)new ModLoggerWrapper(typeof(T), data));
		}

		public void Verbose(string log, LogOptions options)
		{
			Log((LogLevel)32, log);
		}

		public void Warning(string log, LogOptions options)
		{
			Log((LogLevel)4, log);
		}
	}
	public class ScriptableObjectInstanceGenerator<T> : IInstanceGenerator<T> where T : ScriptableObject, new()
	{
		public T CreateInstance()
		{
			return ScriptableObject.CreateInstance<T>();
		}
	}
	public static class TemplateConstants
	{
		public const string Effect = "Effect";

		public const string Upgrade = "Upgrade";

		public const string UpgradeMask = "UpgradeMask";

		public const string Class = "Class";

		public const string Card = "Card";

		public const string Vfx = "Vfx";

		public const string CardTrigger = "Trigger";

		public const string Trait = "Trait";

		public const string CharacterTrigger = "CTrigger";

		public const string RoomModifier = "RoomModifier";

		public const string CardPool = "CardPool";

		public const string RewardData = "RewardData";

		public const string MapNode = "MapNode";

		public const string Sprite = "Sprite";

		public const string GameObject = "GameObject";

		public const string StatusEffect = "StatusEffect";

		public const string CardTriggerEnum = "TriggerEnum";

		public const string CharacterTriggerEnum = "CTriggerEnum";

		public const string RelicData = "RelicData";

		public const string RelicEffectData = "RelicEffectData";

		public const string Character = "Character";
	}
}
namespace TrainworksReloaded.Base.Trigger
{
	public class CardTriggerEffectDefinition : IDefinition<CardTriggerEffectData>
	{
		public string Key { get; set; }

		public CardTriggerEffectData Data { get; set; }

		public IConfiguration Configuration { get; set; }

		public string Id { get; set; }

		public bool IsModded { get; set; }

		public CardTriggerEffectDefinition(string key, CardTriggerEffectData data, IConfiguration configuration)
		{
			Key = key;
			Data = data;
			Configuration = configuration;
			Id = "";
			IsModded = true;
			base..ctor();
		}
	}
	public class CardTriggerEffectFinalizer : IDataFinalizer
	{
		private readonly IModLogger<CardTriggerEffectFinalizer> logger;

		private readonly IRegister<CardEffectData> effectRegister;

		private readonly IRegister<CardUpgradeData> upgradeRegister;

		private readonly IRegister<CardTriggerType> triggerEnumRegister;

		private readonly ICache<IDefinition<CardTriggerEffectData>> cache;

		public CardTriggerEffectFinalizer(IModLogger<CardTriggerEffectFinalizer> logger, IRegister<CardEffectData> effectRegister, IRegister<CardUpgradeData> upgradeRegister, IRegister<CardTriggerType> triggerEnumRegister, ICache<IDefinition<CardTriggerEffectData>> cache)
		{
			this.logger = logger;
			this.effectRegister = effectRegister;
			this.upgradeRegister = upgradeRegister;
			this.triggerEnumRegister = triggerEnumRegister;
			this.cache = cache;
		}

		public void FinalizeData()
		{
			foreach (IDefinition<CardTriggerEffectData> cacheItem in cache.GetCacheItems())
			{
				FinalizeTrigger(cacheItem);
			}
			cache.Clear();
		}

		private void FinalizeTrigger(IDefinition<CardTriggerEffectData> definition)
		{
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: 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_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Expected O, but got Unknown
			//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)
			IConfiguration configuration = definition.Configuration;
			string key = definition.Key;
			CardTriggerEffectData data = definition.Data;
			logger.Log((LogLevel)16, (object)("Finalizing Card Trigger " + key.GetId("Trigger", definition.Id) + "... "));
			CardTriggerType val = (CardTriggerType)0;
			IConfigurationSection section = configuration.GetSection("trigger");
			bool? flag = default(bool?);
			if (section.Value != null)
			{
				string value = section.Value;
				CardTriggerType val2 = default(CardTriggerType);
				val = ((!RegisterExtensions.TryLookupId<CardTriggerType>(triggerEnumRegister, value.ToId(key, "TriggerEnum"), ref val2, ref flag)) ? section.ParseCardTriggerType().GetValueOrDefault() : val2);
			}
			AccessTools.Field(typeof(CardTriggerEffectData), "trigger").SetValue(data, val);
			List<CardTriggerData> list = new List<CardTriggerData>();
			CardUpgradeData paramUpgrade = default(CardUpgradeData);
			foreach (IConfigurationSection child in configuration.GetSection("trigger_effects").GetChildren())
			{
				CardTriggerData val3 = new CardTriggerData();
				val3.persistenceMode = child.GetSection("persistence").ParsePersistenceMode().GetValueOrDefault();
				val3.paramInt = ParseExtensions.ParseInt(child.GetSection("param_int")).GetValueOrDefault();
				string value2 = child.GetSection("trigger_effect").Value;
				if (value2 != null)
				{
					val3.cardTriggerEffect = value2;
					string text = "";
					val3.buffEffectType = child.GetSection("buff_effect").Value ?? text;
					string value3 = child.GetSection("param_upgrade").Value;
					if (value3 != null && RegisterExtensions.TryLookupId<CardUpgradeData>(upgradeRegister, value3.ToId(key, "Upgrade"), ref paramUpgrade, ref flag))
					{
						val3.paramUpgrade = paramUpgrade;
					}
					list.Add(val3);
				}
			}
			AccessTools.Field(typeof(CardTriggerEffectData), "cardTriggerEffects").SetValue(data, list);
			List<CardEffectData> list2 = new List<CardEffectData>();
			CardEffectData item = default(CardEffectData);
			foreach (IConfigurationSection child2 in configuration.GetSection("effects").GetChildren())
			{
				if (child2 != null)
				{
					string value4 = child2.GetSection("id").Value;
					if (value4 != null && RegisterExtensions.TryLookupId<CardEffectData>(effectRegister, value4.ToId(key, "Effect"), ref item, ref flag))
					{
						list2.Add(item);
					}
				}
			}
			AccessTools.Field(typeof(CardTriggerEffectData), "cardEffects").SetValue(data, list2);
		}
	}
	public class CardTriggerEffectPipeline : IDataPipeline<IRegister<CardTriggerEffectData>, CardTriggerEffectData>
	{
		private readonly PluginAtlas atlas;

		private readonly IRegister<LocalizationTerm> termRegister;

		public CardTriggerEffectPipeline(PluginAtlas atlas, IRegister<LocalizationTerm> termRegister)
		{
			this.atlas = atlas;
			this.termRegister = termRegister;
		}

		public List<IDefinition<CardTriggerEffectData>> Run(IRegister<CardTriggerEffectData> service)
		{
			List<IDefinition<CardTriggerEffectData>> list = new List<IDefinition<CardTriggerEffectData>>();
			foreach (KeyValuePair<string, PluginDefinition> pluginDefinition in atlas.PluginDefinitions)
			{
				list.AddRange((IEnumerable<IDefinition<CardTriggerEffectData>>)LoadTriggers(service, pluginDefinition.Key, pluginDefinition.Value.Configuration));
			}
			return list;
		}

		private List<CardTriggerEffectDefinition> LoadTriggers(IRegister<CardTriggerEffectData> service, string key, IConfiguration pluginConfig)
		{
			List<CardTriggerEffectDefinition> list = new List<CardTriggerEffectDefinition>();
			foreach (IConfigurationSection child in pluginConfig.GetSection("card_triggers").GetChildren())
			{
				CardTriggerEffectDefinition cardTriggerEffectDefinition = LoadTriggerConfiguration(service, key, child);
				if (cardTriggerEffectDefinition != null)
				{
					list.Add(cardTriggerEffectDefinition);
				}
			}
			return list;
		}

		private CardTriggerEffectDefinition? LoadTriggerConfiguration(IRegister<CardTriggerEffectData> service, string key, IConfiguration configuration)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Expected O, but got Unknown
			string text = ParseExtensions.ParseString(configuration.GetSection("id"));
			if (text == null)
			{
				return null;
			}
			string id = key.GetId("Trigger", text);
			string text2 = "CardTriggerEffectData_descriptionKey-" + id;
			CardTriggerEffectData val = new CardTriggerEffectData();
			LocalizationTerm localizationTerm = configuration.GetSection("descriptions").ParseLocalizationTerm();
			if (localizationTerm != null)
			{
				AccessTools.Field(typeof(CardTriggerEffectData), "descriptionKey").SetValue(val, text2);
				localizationTerm.Key = text2;
				((IRegisterableDictionary<LocalizationTerm>)(object)termRegister).Register(text2, localizationTerm);
			}
			((IRegisterableDictionary<CardTriggerEffectData>)(object)service).Register(id, val);
			return new CardTriggerEffectDefinition(key, val, configuration)
			{
				Id = text
			};
		}
	}
	public class CardTriggerEffectRegister : Dictionary<string, CardTriggerEffectData>, IRegister<CardTriggerEffectData>, IRegisterableDictionary<CardTriggerEffectData>, IDictionary<string, CardTriggerEffectData>, ICollection<KeyValuePair<string, CardTriggerEffectData>>, IEnumerable<KeyValuePair<string, CardTriggerEffectData>>, IEnumerable
	{
		private readonly IModLogger<CardTriggerEffectRegister> logger;

		public CardTriggerEffectRegister(IModLogger<CardTriggerEffectRegister> logger)
		{
			this.logger = logger;
		}

		public List<string> GetAllIdentifiers(RegisterIdentifierType identifierType)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Invalid comparison between Unknown and I4
			if ((int)identifierType != 0)
			{
				if ((int)identifierType == 1)
				{
					return base.Keys.ToList();
				}
				return new List<string>();
			}
			return base.Values.Select((CardTriggerEffectData trigger) => trigger.GetDebugName()).ToList();
		}

		public void Register(string key, CardTriggerEffectData item)
		{
			logger.Log((LogLevel)16, (object)("Register Card Trigger Effect (" + key + ")"));
			Add(key, item);
		}

		public bool TryLookupIdentifier(string identifier, RegisterIdentifierType identifierType, [NotNullWhen(true)] out CardTriggerEffectData? lookup, [NotNullWhen(true)] out bool? IsModded)
		{
			//IL_0010: 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_0015: Invalid comparison between Unknown and I4
			lookup = null;
			IsModded = true;
			if ((int)identifierType != 0)
			{
				if ((int)identifierType == 1)
				{
					return TryGetValue(identifier, out lookup);
				}
				return false;
			}
			foreach (CardTriggerEffectData value in base.Values)
			{
				if (value.GetDebugName() == identifier)
				{
					lookup = value;
					IsModded = true;
					return true;
				}
			}
			return false;
		}
	}
	public class CharacterTriggerDefinition : IDefinition<CharacterTriggerData>
	{
		public string Key { get; set; }

		public CharacterTriggerData Data { get; set; }

		public IConfiguration Configuration { get; set; }

		public string Id { get; set; }

		public bool IsModded { get; set; }

		public CharacterTriggerDefinition(string key, CharacterTriggerData data, IConfiguration configuration)
		{
			Key = key;
			Data = data;
			Configuration = configuration;
			Id = "";
			IsModded = true;
			base..ctor();
		}
	}
	public class CharacterTriggerFinalizer : IDataFinalizer
	{
		private readonly IModLogger<CharacterTriggerFinalizer> logger;

		private readonly IRegister<CardEffectData> effectRegister;

		private readonly IRegister<Trigger> triggerEnumRegister;

		private readonly ICache<IDefinition<CharacterTriggerData>> cache;

		public CharacterTriggerFinalizer(IModLogger<CharacterTriggerFinalizer> logger, IRegister<CardEffectData> effectRegister, IRegister<Trigger> triggerEnumRegister, ICache<IDefinition<CharacterTriggerData>> cache)
		{
			this.logger = logger;
			this.effectRegister = effectRegister;
			this.triggerEnumRegister = triggerEnumRegister;
			this.cache = cache;
		}

		public void FinalizeData()
		{
			foreach (IDefinition<CharacterTriggerData> cacheItem in cache.GetCacheItems())
			{
				FinalizeCharacterTrigger(cacheItem);
			}
			cache.Clear();
		}

		private void FinalizeCharacterTrigger(IDefinition<CharacterTriggerData> definition)
		{
			//IL_0042: 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_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			IConfiguration configuration = definition.Configuration;
			string key = definition.Key;
			CharacterTriggerData data = definition.Data;
			logger.Log((LogLevel)16, (object)("Finalizing Character Trigger " + key.GetId("CTrigger", definition.Id) + "... "));
			Trigger val = (Trigger)0;
			IConfigurationSection section = configuration.GetSection("trigger");
			bool? flag = default(bool?);
			if (section.Value != null)
			{
				string value = section.Value;
				Trigger val2 = default(Trigger);
				val = ((!RegisterExtensions.TryLookupId<Trigger>(triggerEnumRegister, value.ToId(key, "CTriggerEnum"), ref val2, ref flag)) ? section.ParseTrigger().GetValueOrDefault() : val2);
			}
			AccessTools.Field(typeof(CharacterTriggerData), "trigger").SetValue(data, val);
			List<CardEffectData> list = new List<CardEffectData>();
			CardEffectData val3 = default(CardEffectData);
			foreach (string item in from x in configuration.GetSection("effects").GetChildren()
				select ParseExtensions.ParseString(x.GetSection("id")))
			{
				if (item != null && RegisterExtensions.TryLookupId<CardEffectData>(effectRegister, item.ToId(key, "Effect"), ref val3, ref flag))
				{
					logger.Log((LogLevel)16, (object)("Adding Effect " + val3.GetEffectStateName()));
					list.Add(val3);
				}
			}
			AccessTools.Field(typeof(CharacterTriggerData), "effects").SetValue(data, list);
		}
	}
	public class CharacterTriggerPipeline : IDataPipeline<IRegister<CharacterTriggerData>, CharacterTriggerData>
	{
		private readonly PluginAtlas atlas;

		private readonly IRegister<LocalizationTerm> termRegister;

		public CharacterTriggerPipeline(PluginAtlas atlas, IRegister<LocalizationTerm> termRegister)
		{
			this.atlas = atlas;
			this.termRegister = termRegister;
		}

		public List<IDefinition<CharacterTriggerData>> Run(IRegister<CharacterTriggerData> service)
		{
			List<IDefinition<CharacterTriggerData>> list = new List<IDefinition<CharacterTriggerData>>();
			foreach (KeyValuePair<string, PluginDefinition> pluginDefinition in atlas.PluginDefinitions)
			{
				list.AddRange((IEnumerable<IDefinition<CharacterTriggerData>>)LoadTriggers(service, pluginDefinition.Key, pluginDefinition.Value.Configuration));
			}
			return list;
		}

		private List<CharacterTriggerDefinition> LoadTriggers(IRegister<CharacterTriggerData> service, string key, IConfiguration pluginConfig)
		{
			List<CharacterTriggerDefinition> list = new List<CharacterTriggerDefinition>();
			foreach (IConfigurationSection child in pluginConfig.GetSection("character_triggers").GetChildren())
			{
				CharacterTriggerDefinition characterTriggerDefinition = LoadTriggerConfiguration(service, key, child);
				if (characterTriggerDefinition != null)
				{
					list.Add(characterTriggerDefinition);
				}
			}
			return list;
		}

		private CharacterTriggerDefinition? LoadTriggerConfiguration(IRegister<CharacterTriggerData> service, string key, IConfiguration configuration)
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Expected O, but got Unknown
			string text = ParseExtensions.ParseString(configuration.GetSection("id"));
			if (text == null)
			{
				return null;
			}
			string id = key.GetId("CTrigger", text);
			string text2 = "CharacterTriggerData_descriptionKey-" + id;
			string text3 = "CharacterTriggerData_textOnTriggerKey-" + id;
			CharacterTriggerData val = new CharacterTriggerData((Trigger)0, (CardEffectData)null);
			LocalizationTerm localizationTerm = configuration.GetSection("descriptions").ParseLocalizationTerm();
			if (localizationTerm != null)
			{
				AccessTools.Field(typeof(CharacterTriggerData), "descriptionKey").SetValue(val, text2);
				localizationTerm.Key = text2;
				((IRegisterableDictionary<LocalizationTerm>)(object)termRegister).Register(text2, localizationTerm);
			}
			LocalizationTerm localizationTerm2 = configuration.GetSection("text_on_trigger").ParseLocalizationTerm();
			if (localizationTerm2 != null)
			{
				AccessTools.Field(typeof(CharacterTriggerData), "additionalTextOnTriggerKey").SetValue(val, text3);
				localizationTerm2.Key = text3;
				((IRegisterableDictionary<LocalizationTerm>)(object)termRegister).Register(text3, localizationTerm2);
			}
			bool defaultValue = false;
			AccessTools.Field(typeof(CharacterTriggerData), "showAdditionalTriggerTextOnSuccessOnly").SetValue(val, ParseExtensions.ParseBool(configuration.GetSection("show_text_on_trigger_success_only")).GetValueOrDefault(defaultValue));
			bool defaultValue2 = false;
			AccessTools.Field(typeof(CharacterTriggerData), "displayEffectHintText").SetValue(val, ParseExtensions.ParseBool(configuration.GetSection("display_hint_text")).GetValueOrDefault(defaultValue2));
			bool defaultValue3 = false;
			AccessTools.Field(typeof(CharacterTriggerData), "hideVisualAndIgnoreSilence").SetValue(val, ParseExtensions.ParseBool(configuration.GetSection("hide_tooltip")).GetValueOrDefault(defaultValue3));
			bool defaultValue4 = false;
			AccessTools.Field(typeof(CharacterTriggerData), "allowAdditionalTooltipsWhenVisualIsHidden").SetValue(val, ParseExtensions.ParseBool(configuration.GetSection("allow_tooltips_when_hidden")).GetValueOrDefault(defaultValue4));
			bool defaultValue5 = false;
			AccessTools.Field(typeof(CharacterTriggerData), "suppressTriggerNotification").SetValue(val, ParseExtensions.ParseBool(configuration.GetSection("suppress_notifications")).GetValueOrDefault(defaultValue5));
			bool defaultValue6 = false;
			AccessTools.Field(typeof(CharacterTriggerData), "triggerOnce").SetValue(val, ParseExtensions.ParseBool(configuration.GetSection("trigger_once")).GetValueOrDefault(defaultValue6));
			bool defaultValue7 = false;
			AccessTools.Field(typeof(CharacterTriggerData), "onlyTriggerIfEquipped").SetValue(val, ParseExtensions.ParseBool(configuration.GetSection("only_trigger_if_equipped")).GetValueOrDefault(defaultValue7));
			((IRegisterableDictionary<CharacterTriggerData>)(object)service).Register(id, val);
			return new CharacterTriggerDefinition(key, val, configuration)
			{
				Id = text
			};
		}
	}
	public class CharacterTriggerRegister : Dictionary<string, CharacterTriggerData>, IRegister<CharacterTriggerData>, IRegisterableDictionary<CharacterTriggerData>, IDictionary<string, CharacterTriggerData>, ICollection<KeyValuePair<string, CharacterTriggerData>>, IEnumerable<KeyValuePair<string, CharacterTriggerData>>, IEnumerable
	{
		private readonly IModLogger<CharacterTriggerRegister> logger;

		public CharacterTriggerRegister(IModLogger<CharacterTriggerRegister> logger)
		{
			this.logger = logger;
		}

		public void Register(string key, CharacterTriggerData item)
		{
			logger.Log((LogLevel)16, (object)("Register Character Trigger (" + key + ")"));
			Add(key, item);
		}

		public List<string> GetAllIdentifiers(RegisterIdentifierType identifierType)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Invalid comparison between Unknown and I4
			if ((int)identifierType != 0)
			{
				if ((int)identifierType == 1)
				{
					return base.Keys.ToList();
				}
				return new List<string>();
			}
			return base.Values.Select((CharacterTriggerData trigger) => trigger.GetDebugName()).ToList();
		}

		public bool TryLookupIdentifier(string identifier, RegisterIdentifierType identifierType, [NotNullWhen(true)] out CharacterTriggerData? lookup, [NotNullWhen(true)] out bool? IsModded)
		{
			//IL_0010: 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_0015: Invalid comparison between Unknown and I4
			lookup = null;
			IsModded = true;
			if ((int)identifierType != 0)
			{
				if ((int)identifierType == 1)
				{
					return TryGetValue(identifier, out lookup);
				}
				return false;
			}
			foreach (CharacterTriggerData value in base.Values)
			{
				if (value.GetDebugName() == identifier)
				{
					lookup = value;
					IsModded = true;
					return true;
				}
			}
			return false;
		}
	}
}
namespace TrainworksReloaded.Base.Trait
{
	public class CardTraitDataFinalizer : IDataFinalizer
	{
		[CompilerGenerated]
		private IModLogger<CardTraitDataFinalizer> <logger>P;

		[CompilerGenerated]
		private ICache<IDefinition<CardTraitData>> <cache>P;

		[CompilerGenerated]
		private IRegister<CardUpgradeData> <upgradeRegister>P;

		[CompilerGenerated]
		private IRegister<CardData> <cardRegister>P;

		[CompilerGenerated]
		private IRegister<StatusEffectData> <statusRegister>P;

		public CardTraitDataFinalizer(IModLogger<CardTraitDataFinalizer> logger, ICache<IDefinition<CardTraitData>> cache, IRegister<CardUpgradeData> upgradeRegister, IRegister<CardData> cardRegister, IRegister<StatusEffectData> statusRegister)
		{
			<logger>P = logger;
			<cache>P = cache;
			<upgradeRegister>P = upgradeRegister;
			<cardRegister>P = cardRegister;
			<statusRegister>P = statusRegister;
			base..ctor();
		}

		public void FinalizeData()
		{
			foreach (IDefinition<CardTraitData> cacheItem in <cache>P.GetCacheItems())
			{
				FinalizeCardTrait(cacheItem);
			}
			<cache>P.Clear();
		}

		private void FinalizeCardTrait(IDefinition<CardTraitData> definition)
		{
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a4: Expected O, but got Unknown
			IConfiguration configuration = definition.Configuration;
			CardTraitData data = definition.Data;
			string key = definition.Key;
			<logger>P.Log((LogLevel)16, (object)("Finalizing Card Trait " + definition.Id.ToId(key, "Trait") + "... "));
			string value = configuration.GetSection("param_card_data").Value;
			CardData value2 = null;
			bool? flag = default(bool?);
			if (value != null)
			{
				string text = value.ToId(key, "Card");
				RegisterExtensions.TryLookupId<CardData>(<cardRegister>P, text, ref value2, ref flag);
			}
			AccessTools.Field(typeof(CardTraitData), "paramCardData").SetValue(data, value2);
			string value3 = configuration.GetSection("param_card_upgrade_data").Value;
			CardUpgradeData value4 = null;
			if (value3 != null)
			{
				string text2 = value3.ToId(key, "Upgrade");
				RegisterExtensions.TryLookupId<CardUpgradeData>(<upgradeRegister>P, text2, ref value4, ref flag);
			}
			AccessTools.Field(typeof(CardTraitData), "paramCardUpgradeData").SetValue(data, value4);
			List<StatusEffectStackData> list = new List<StatusEffectStackData>();
			StatusEffectData val = default(StatusEffectData);
			foreach (IConfigurationSection child in configuration.GetSection("param_status_effects").GetChildren())
			{
				string text3 = child?.GetSection("status").Value;
				if (text3 != null)
				{
					string text4 = text3.ToId(key, "StatusEffect");
					string statusId = text3;
					if (RegisterExtensions.TryLookupId<StatusEffectData>(<statusRegister>P, text4, ref val, ref flag))
					{
						statusId = val.GetStatusId();
					}
					list.Add(new StatusEffectStackData
					{
						statusId = statusId,
						count = ((child != null) ? ParseExtensions.ParseInt(child.GetSection("count")) : null).GetValueOrDefault()
					});
				}
			}
			AccessTools.Field(typeof(CardTraitData), "paramStatusEffects").SetValue(data, list.ToArray());
		}
	}
	public class CardTraitDataPipeline : IDataPipeline<IRegister<CardTraitData>, CardTraitData>
	{
		private readonly PluginAtlas atlas;

		private readonly IModLogger<CardTraitDataPipeline> logger;

		public CardTraitDataPipeline(PluginAtlas atlas, IModLogger<CardTraitDataPipeline> logger)
		{
			this.atlas = atlas;
			this.logger = logger;
		}

		public List<IDefinition<CardTraitData>> Run(IRegister<CardTraitData> service)
		{
			List<IDefinition<CardTraitData>> list = new List<IDefinition<CardTraitData>>();
			foreach (KeyValuePair<string, PluginDefinition> pluginDefinition in atlas.PluginDefinitions)
			{
				list.AddRange((IEnumerable<IDefinition<CardTraitData>>)LoadTraits(service, pluginDefinition.Key, pluginDefinition.Value.Configuration));
			}
			return list;
		}

		private List<CardTraitDefinition> LoadTraits(IRegister<CardTraitData> service, string key, IConfiguration pluginConfig)
		{
			List<CardTraitDefinition> list = new List<CardTraitDefinition>();
			foreach (IConfigurationSection child in pluginConfig.GetSection("traits").GetChildren())
			{
				CardTraitDefinition cardTraitDefinition = LoadTraitConfiguration(service, key, child);
				if (cardTraitDefinition != null)
				{
					list.Add(cardTraitDefinition);
				}
			}
			return list;
		}

		private CardTraitDefinition? LoadTraitConfiguration(IRegister<CardTraitData> service, string key, IConfiguration configuration)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Expected O, but got Unknown
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: 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_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: 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_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_0464: Unknown result type (might be due to invalid IL or missing references)
			//IL_048f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0491: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_04cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ce: Unknown result type (might be due to invalid IL or missing references)
			string text = ParseExtensions.ParseString(configuration.GetSection("id"));
			if (text == null)
			{
				return null;
			}
			string id = key.GetId("Trait", text);
			CardTraitData val = new CardTraitData();
			string value = configuration.GetSection("name").Value;
			if (value == null)
			{
				return null;
			}
			string text2 = configuration.GetSection("mod_reference").Value ?? key;
			PluginDefinition valueOrDefault = IEnumerableUtility.GetValueOrDefault<string, PluginDefinition>((IDictionary<string, PluginDefinition>)atlas.PluginDefinitions, text2, (PluginDefinition)null);
			Assembly assembly = ((valueOrDefault != null) ? valueOrDefault.Assembly : null);
			if (!value.GetFullyQualifiedName<CardTraitState>(assembly, out string fullyQualifiedName))
			{
				return null;
			}
			AccessTools.Field(typeof(CardTraitData), "traitStateName").SetValue(val, fullyQualifiedName);
			TrackedValueType defaultValue = (TrackedValueType)0;
			AccessTools.Field(typeof(CardTraitData), "paramTrackedValue").SetValue(val, configuration.GetSection("track_type").ParseTrackedValueType().GetValueOrDefault(defaultValue));
			CardTypeTarget defaultValue2 = (CardTypeTarget)0;
			AccessTools.Field(typeof(CardTraitData), "paramCardType").SetValue(val, configuration.GetSection("card_type").ParseCardTypeTarget().GetValueOrDefault(defaultValue2));
			EntryDuration defaultValue3 = (EntryDuration)0;
			AccessTools.Field(typeof(CardTraitData), "paramEntryDuration").SetValue(val, configuration.GetSection("entry_duration").ParseEntryDuration().GetValueOrDefault(defaultValue3));
			string text3 = "";
			AccessTools.Field(typeof(CardTraitData), "paramStr").SetValue(val, ParseExtensions.ParseString(configuration.GetSection("param_str")) ?? text3);
			string text4 = "";
			AccessTools.Field(typeof(CardTraitData), "paramDescription").SetValue(val, ParseExtensions.ParseString(configuration.GetSection("param_description")) ?? text4);
			int defaultValue4 = 0;
			AccessTools.Field(typeof(CardTraitData), "paramInt").SetValue(val, ParseExtensions.ParseInt(configuration.GetSection("param_int")).GetValueOrDefault(defaultValue4));
			int defaultValue5 = 0;
			AccessTools.Field(typeof(CardTraitData), "paramInt2").SetValue(val, ParseExtensions.ParseInt(configuration.GetSection("param_int_2")).GetValueOrDefault(defaultValue5));
			int defaultValue6 = 0;
			AccessTools.Field(typeof(CardTraitData), "paramInt3").SetValue(val, ParseExtensions.ParseInt(configuration.GetSection("param_int_3")).GetValueOrDefault(defaultValue6));
			float defaultValue7 = 1f;
			AccessTools.Field(typeof(CardTraitData), "paramFloat").SetValue(val, ParseExtensions.ParseFloat(configuration.GetSection("param_float")).GetValueOrDefault(defaultValue7));
			string text5 = "SubtypesData_None";
			AccessTools.Field(typeof(CardTraitData), "paramSubtype").SetValue(val, ParseExtensions.ParseString(configuration.GetSection("param_subtype")) ?? text5);
			bool defaultValue8 = false;
			AccessTools.Field(typeof(CardTraitData), "paramUseScalingParams").SetValue(val, ParseExtensions.ParseBool(configuration.GetSection("param_use_scaling_params")).GetValueOrDefault(defaultValue8));
			bool defaultValue9 = false;
			AccessTools.Field(typeof(CardTraitData), "paramBool").SetValue(val, ParseExtensions.ParseBool(configuration.GetSection("param_bool")).GetValueOrDefault(defaultValue9));
			bool defaultValue10 = true;
			AccessTools.Field(typeof(CardTraitData), "traitIsRemovable").SetValue(val, ParseExtensions.ParseBool(configuration.GetSection("trait_is_removable")).GetValueOrDefault(defaultValue10));
			bool defaultValue11 = false;
			AccessTools.Field(typeof(CardTraitData), "tooltipSuppressed").SetValue(val, ParseExtensions.ParseBool(configuration.GetSection("tooltip_suppressed")).GetValueOrDefault(defaultValue11));
			bool defaultValue12 = false;
			AccessTools.Field(typeof(CardTraitData), "effectTextSuppressed").SetValue(val, ParseExtensions.ParseBool(configuration.GetSection("effect_text_suppressed")).GetValueOrDefault(defaultValue12));
			bool defaultValue13 = false;
			AccessTools.Field(typeof(CardTraitData), "statusEffectTooltipsSuppressed").SetValue(val, ParseExtensions.ParseBool(configuration.GetSection("status_effect_tooltips_suppressed")).GetValueOrDefault(defaultValue13));
			Type defaultValue14 = (Type)0;
			AccessTools.Field(typeof(CardTraitData), "paramTeamType").SetValue(val, configuration.GetSection("param_team").ParseTeamType().GetValueOrDefault(defaultValue14));
			StackMode defaultValue15 = (StackMode)0;
			AccessTools.Field(typeof(CardTraitData), "stackMode").SetValue(val, configuration.GetSection("stack_mode").ParseStackMode().GetValueOrDefault(defaultValue15));
			bool defaultValue16 = false;
			AccessTools.Field(typeof(CardTraitData), "drawInDeploymentPhase").SetValue(val, ParseExtensions.ParseBool(configuration.GetSection("draw_in_deployment_phase")).GetValueOrDefault(defaultValue16));
			((IRegisterableDictionary<CardTraitData>)(object)service).Register(id, val);
			return new CardTraitDefinition(key, val, configuration)
			{
				Id = text
			};
		}
	}
	public class CardTraitDataRegister : Dictionary<string, CardTraitData>, IRegister<CardTraitData>, IRegisterableDictionary<CardTraitData>, IDictionary<string, CardTraitData>, ICollection<KeyValuePair<string, CardTraitData>>, IEnumerable<KeyValuePair<string, CardTraitData>>, IEnumerable
	{
		private readonly IModLogger<CardTraitDataRegister> logger;

		public CardTraitDataRegister(IModLogger<CardTraitDataRegister> logger)
		{
			this.logger = logger;
		}

		public void Register(string key, CardTraitData item)
		{
			logger.Log((LogLevel)16, (object)("Register Trait (" + key + ")"));
			Add(key, item);
		}

		public List<string> GetAllIdentifiers(RegisterIdentifierType identifierType)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Invalid comparison between Unknown and I4
			if ((int)identifierType != 0)
			{
				if ((int)identifierType == 1)
				{
					return base.Keys.ToList();
				}
				return new List<string>();
			}
			return base.Values.Select((CardTraitData trait) => trait.traitStateName).ToList();
		}

		public bool TryLookupIdentifier(string identifier, RegisterIdentifierType identifierType, [NotNullWhen(true)] out CardTraitData? lookup, [NotNullWhen(true)] out bool? IsModded)
		{
			//IL_0010: 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_0015: Invalid comparison between Unknown and I4
			lookup = null;
			IsModded = true;
			if ((int)identifierType != 0)
			{
				if ((int)identifierType == 1)
				{
					return TryGetValue(identifier, out lookup);
				}
				return false;
			}
			foreach (CardTraitData value in base.Values)
			{
				if (value.traitStateName == identifier)
				{
					lookup = value;
					IsModded = true;
					return true;
				}
			}
			return false;
		}
	}
	public class CardTraitDefinition : IDefinition<CardTraitData>
	{
		public string Key { get; set; }

		public CardTraitData Data { get; set; }

		public IConfiguration Configuration { get; set; }

		public string Id { get; set; }

		public bool IsModded { get; set; }

		public CardTraitDefinition(string key, CardTraitData data, IConfiguration configuration)
		{
			Key = key;
			Data = data;
			Configuration = configuration;
			Id = "";
			IsModded = true;
			base..ctor();
		}
	}
}
namespace TrainworksReloaded.Base.StatusEffects
{
	public class StatusEffectDataDefinition : IDefinition<StatusEffectData>
	{
		public string Key { get; set; }

		public StatusEffectData Data { get; set; }

		public IConfiguration Configuration { get; set; }

		public string Id { get; set; }

		public bool IsModded => true;

		public StatusEffectDataDefinition(string key, StatusEffectData data, IConfiguration configuration)
		{
			Key = key;
			Data = data;
			Configuration = configuration;
			Id = "";
			base..ctor();
		}
	}
	public class StatusEffectDataFinalizer : IDataFinalizer
	{
		private readonly IModLogger<StatusEffectDataFinalizer> logger;

		private readonly ICache<IDefinition<StatusEffectData>> cache;

		private readonly IRegister<VfxAtLoc> vfxRegister;

		private readonly IRegister<Sprite> spriteRegister;

		public StatusEffectDataFinalizer(IModLogger<StatusEffectDataFinalizer> logger, ICache<IDefinition<StatusEffectData>> cache, IRegister<VfxAtLoc> vfxRegister, IRegister<Sprite> spriteRegister)
		{
			this.logger = logger;
			this.cache = cache;
			this.vfxRegister = vfxRegister;
			this.spriteRegister = spriteRegister;
		}

		public void FinalizeData()
		{
			foreach (IDefinition<StatusEffectData> cacheItem in cache.GetCacheItems())
			{
				FinalizeStatusEffect(cacheItem);
			}
			cache.Clear();
		}

		public void FinalizeStatusEffect(IDefinition<StatusEffectData> definition)
		{
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Expected O, but got Unknown
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cf: Expected O, but got Unknown
			//IL_02b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02be: Expected O, but got Unknown
			//IL_03a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ad: Expected O, but got Unknown
			IConfiguration configuration = definition.Configuration;
			StatusEffectData data = definition.Data;
			string key = definition.Key;
			logger.Log((LogLevel)16, (object)("Finalizing StatusEffect " + data.GetStatusId() + "... "));
			string text = ParseExtensions.ParseString(configuration.GetSection("icon"));
			Sprite value = default(Sprite);
			bool? flag = default(bool?);
			if (text != null && RegisterExtensions.TryLookupId<Sprite>(spriteRegister, text.ToId(key, "Sprite"), ref value, ref flag))
			{
				AccessTools.Field(typeof(StatusEffectData), "icon").SetValue(data, value);
			}
			string baseString = ParseExtensions.ParseString(configuration.GetSection("added_vfx")) ?? "";
			VfxAtLoc value2 = default(VfxAtLoc);
			if (RegisterExtensions.TryLookupId<VfxAtLoc>(vfxRegister, baseString.ToId(key, "Vfx"), ref value2, ref flag))
			{
				AccessTools.Field(typeof(StatusEffectData), "addedVFX").SetValue(data, value2);
			}
			VfxAtLocList val = new VfxAtLocList();
			List<VfxAtLoc> vfxList = val.GetVfxList();
			VfxAtLoc item = default(VfxAtLoc);
			foreach (IConfigurationSection child in configuration.GetSection("more_added_vfx").GetChildren())
			{
				string baseString2 = ParseExtensions.ParseString(child) ?? "";
				if (RegisterExtensions.TryLookupId<VfxAtLoc>(vfxRegister, baseString2.ToId(key, "Vfx"), ref item, ref flag))
				{
					vfxList.Add(item);
				}
			}
			AccessTools.Field(typeof(StatusEffectData), "moreAddedVFX").SetValue(data, val);
			string baseString3 = ParseExtensions.ParseString(configuration.GetSection("persistent_vfx")) ?? "";
			VfxAtLoc value3 = default(VfxAtLoc);
			if (RegisterExtensions.TryLookupId<VfxAtLoc>(vfxRegister, baseString3.ToId(key, "Vfx"), ref value3, ref flag))
			{
				AccessTools.Field(typeof(StatusEffectData), "persistentVFX").SetValue(data, value3);
			}
			VfxAtLocList val2 = new VfxAtLocList();
			List<VfxAtLoc> vfxList2 = val2.GetVfxList();
			VfxAtLoc item2 = default(VfxAtLoc);
			foreach (IConfigurationSection child2 in configuration.GetSection("more_persistent_vfx").GetChildren())
			{
				string baseString4 = ParseExtensions.ParseString(child2) ?? "";
				if (RegisterExtensions.TryLookupId<VfxAtLoc>(vfxRegister, baseString4.ToId(key, "Vfx"), ref item2, ref flag))
				{
					vfxList2.Add(item2);
				}
			}
			AccessTools.Field(typeof(StatusEffectData), "morePersistentVFX").SetValue(data, val2);
			string baseString5 = ParseExtensions.ParseString(configuration.GetSection("triggered_vfx")) ?? "";
			VfxAtLoc value4 = default(VfxAtLoc);
			if (RegisterExtensions.TryLookupId<VfxAtLoc>(vfxRegister, baseString5.ToId(key, "Vfx"), ref value4, ref flag))
			{
				AccessTools.Field(typeof(StatusEffectData), "triggeredVFX").SetValue(data, value4);
			}
			VfxAtLocList val3 = new VfxAtLocList();
			List<VfxAtLoc> vfxList3 = val3.GetVfxList();
			VfxAtLoc item3 = default(VfxAtLoc);
			foreach (IConfigurationSection child3 in configuration.GetSection("more_triggered_vfx").GetChildren())
			{
				string baseString6 = ParseExtensions.ParseString(child3) ?? "";
				if (RegisterExtensions.TryLookupId<VfxAtLoc>(vfxRegister, baseString6.ToId(key, "Vfx"), ref item3, ref flag))
				{
					vfxList3.Add(item3);
				}
			}
			AccessTools.Field(typeof(StatusEffectData), "moreTriggeredVFX").SetValue(data, val3);
			string baseString7 = ParseExtensions.ParseString(configuration.GetSection("removed_vfx")) ?? "";
			VfxAtLoc value5 = default(VfxAtLoc);
			if (RegisterExtensions.TryLookupId<VfxAtLoc>(vfxRegister, baseString7.ToId(key, "Vfx"), ref value5, ref flag))
			{
				AccessTools.Field(typeof(StatusEffectData), "removedVFX").SetValue(data, value5);
			}
			VfxAtLocList val4 = new VfxAtLocList();
			List<VfxAtLoc> vfxList4 = val4.GetVfxList();
			VfxAtLoc item4 = default(VfxAtLoc);
			foreach (IConfigurationSection child4 in configuration.GetSection("more_removed_vfx").GetChildren())
			{
				string baseString8 = ParseExtensions.ParseString(child4) ?? "";
				if (RegisterExtensions.TryLookupId<VfxAtLoc>(vfxRegister, baseString8.ToId(key, "Vfx"), ref item4, ref flag))
				{
					vfxList4.Add(item4);
				}
			}
			AccessTools.Field(typeof(StatusEffectData), "moreRemovedVFX").SetValue(data, val4);
			string baseString9 = ParseExtensions.ParseString(configuration.GetSection("affected_vfx")) ?? "";
			VfxAtLoc value6 = default(VfxAtLoc);
			if (RegisterExtensions.TryLookupId<VfxAtLoc>(vfxRegister, baseString9.ToId(key, "Vfx"), ref value6, ref flag))
			{
				AccessTools.Field(typeof(StatusEffectData), "affectedVFX").SetValue(data, value6);
			}
		}
	}
	public class StatusEffectDataPipeline : IDataPipeline<IRegister<StatusEffectData>, StatusEffectData>
	{
		private readonly PluginAtlas atlas;

		private readonly IModLogger<StatusEffectDataPipeline> logger;

		private readonly IRegister<LocalizationTerm> termRegister;

		public StatusEffectDataPipeline(PluginAtlas atlas, IModLogger<StatusEffectDataPipeline> logger, IRegister<LocalizationTerm> termRegister)
		{
			this.atlas = atlas;
			this.logger = logger;
			this.termRegister = termRegister;
		}

		public List<IDefinition<StatusEffectData>> Run(IRegister<StatusEffectData> service)
		{
			List<IDefinition<StatusEffectData>> list = new List<IDefinition<StatusEffectData>>();
			foreach (KeyValuePair<string, PluginDefinition> pluginDefinition in atlas.PluginDefinitions)
			{
				list.AddRange(LoadStatusEffects(service, pluginDefinition.Key, pluginDefinition.Value.Configuration));
			}
			return list;
		}

		private IEnumerable<IDefinition<StatusEffectData>> LoadStatusEffects(IRegister<StatusEffectData> service, string key, IConfiguration configuration)
		{
			List<StatusEffectDataDefinition> list = new List<StatusEffectDataDefinition>();
			foreach (IConfigurationSection child in configuration.GetSection("status_effects").GetChildren())
			{
				StatusEffectDataDefinition statusEffectDataDefinition = LoadEffectConfiguration(service, key, child);
				if (statusEffectDataDefinition != null)
				{
					list.Add(statusEffectDataDefinition);
				}
			}
			return (IEnumerable<IDefinition<StatusEffectData>>)list;
		}

		private StatusEffectDataDefinition? LoadEffectConfiguration(IRegister<StatusEffectData> service, string key, IConfiguration configuration)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Expected O, but got Unknown
			//IL_0253: Unknown result type (might be due to invalid IL or missing references)
			//IL_027e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0280: Unknown result type (might be due to invalid IL or missing references)
			//IL_0290: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fa: Unknown result type (might be due to invalid IL or missing references)
			string text = ParseExtensions.ParseString(configuration.GetSection("id"));
			if (text == null)
			{
				return null;
			}
			string id = key.GetId("StatusEffect", text);
			string text2 = id.ToLowerInvariant();
			StatusEffectData val = new StatusEffectData();
			AccessTools.Field(typeof(StatusEffectData), "statusId").SetValue(val, text2);
			string value = configuration.GetSection("class_name").Value;
			if (value == null)
			{
				return null;
			}
			Assembly assembly = atlas.PluginDefinitions[key].Assembly;
			if (!value.GetFullyQualifiedName<StatusEffectState>(assembly, out string fullyQualifiedName))
			{
				return null;
			}
			AccessTools.Field(typeof(StatusEffectData), "statusEffectStateName").SetValue(val, fullyQualifiedName);
			string text3 = "StatusEffect_" + text2;
			LocalizationTerm localizationTerm = configuration.GetSection("names").ParseLocalizationTerm();
			if (localizationTerm != null)
			{
				localizationTerm.Key = text3 + "_CardText";
				((IRegisterableDictionary<LocalizationTerm>)(object)termRegister).Register(localizationTerm.Key, localizationTerm);
			}
			LocalizationTerm localizationTerm2 = configuration.GetSection("stackable_names").ParseLocalizationTerm();
			if (localizationTerm2 != null)
			{
				localizationTerm2.Key = text3 + "_Stack_CardText";
				((IRegisterableDictionary<LocalizationTerm>)(object)termRegister).Register(localizationTerm2.Key, localizationTerm2);
			}
			LocalizationTerm localizationTerm3 = configuration.GetSection("card_tooltips").ParseLocalizationTerm();
			if (localizationTerm3 != null)
			{
				localizationTerm3.Key = text3 + "_CardTooltipText";
				((IRegisterableDictionary<LocalizationTerm>)(object)termRegister).Register(localizationTerm3.Key, localizationTerm3);
			}
			LocalizationTerm localizationTerm4 = configuration.GetSection("character_tooltips").ParseLocalizationTerm();
			if (localizationTerm4 != null)
			{
				localizationTerm4.Key = text3 + "_CharacterTooltipText";
				((IRegisterableDictionary<LocalizationTerm>)(object)termRegister).Register(localizationTerm4.Key, localizationTerm4);
			}
			LocalizationTerm localizationTerm5 = configuration.GetSection("notifications").ParseLocalizationTerm();
			if (localizationTerm5 != null)
			{
				localizationTerm5.Key = text3 + "_NotificationText";
				((IRegisterableDictionary<LocalizationTerm>)(object)termRegister).Register(localizationTerm5.Key, localizationTerm5);
			}
			string text4 = "";
			AccessTools.Field(typeof(StatusEffectData), "appliedSFXName").SetValue(val, ParseExtensions.ParseString(configuration.GetSection("applied_sfx")) ?? text4);
			string text5 = "";
			AccessTools.Field(typeof(StatusEffectData), "triggeredSFXName").SetValue(val, ParseExtensions.ParseString(configuration.GetSection("triggered_sfx")) ?? text5);
			DisplayCategory defaultValue = (DisplayCategory)0;
			AccessTools.Field(typeof(StatusEffectData), "displayCategory").SetValue(val, configuration.GetSection("display_category").ParseDisplayCategory().GetValueOrDefault(defaultValue));
			VFXDisplayType defaultValue2 = (VFXDisplayType)0;
			AccessTools.Field(typeof(StatusEffectData), "vfxDisplayType").SetValue(val, configuration.GetSection("vfx_display_type").ParseVFXDisplayType().GetValueOrDefault(defaultValue2));
			TriggerStage defaultValue3 = (TriggerStage)0;
			AccessTools.Field(typeof(StatusEffectData), "triggerStage").SetValue(val, configuration.GetSection("trigger_stage").ParseTriggerStage().GetValueOrDefault(defaultValue3));
			List<TriggerStage> value2 = (from xs in configuration.GetSection("additional_trigger_stages").GetChildren()
				select xs.ParseTriggerStage().GetValueOrDefault()).ToList();
			AccessTools.Field(typeof(StatusEffectData), "additionalTriggerStages").SetValue(val, value2);
			bool defaultValue4 = false;
			AccessTools.Field(typeof(StatusEffectData), "hidden").SetValue(val, ParseExtensions.ParseBool(configuration.GetSection("hidden")).GetValueOrDefault(defaultValue4));
			bool defaultValue5 = false;
			AccessTools.Field(typeof(StatusEffectData), "removeStackAtEndOfTurn").SetValue(val, ParseExtensions.ParseBool(configuration.GetSection("remove_stack_at_end_of_turn")).GetValueOrDefault(defaultValue5));
			bool defaultValue6 = false;
			AccessTools.Field(typeof(StatusEffectData), "removeAtEndOfTurn").SetValue(val, ParseExtensions.ParseBool(configuration.GetSection("remove_at_end_of_turn")).GetValueOrDefault(defaultValue6));
			bool defaultValue7 = false;
			AccessTools.Field(typeof(StatusEffectData), "removeWhenTriggered").SetValue(val, ParseExtensions.ParseBool(configuration.GetSection("remove_when_triggered")).GetValueOrDefault(defaultValue7));
			bool defaultValue8 = false;
			AccessTools.Field(typeof(StatusEffectData), "removeWhenTriggeredAfterCardPlayed").SetValue(val, ParseExtensions.ParseBool(configuration.GetSection("remove_when_triggered_after_card_played")).GetValueOrDefault(defaultValue8));
			bool defaultValue9 = false;
			AccessTools.Field(typeof(StatusEffectData), "removeAtEndOfTurnIfTriggered").SetValue(val, ParseExtensions.ParseBool(configuration.GetSection("remove_at_end_of_turn_if_triggered")).GetValueOrDefault(defaultValue9));
			bool defaultValue10 = true;
			AccessTools.Field(typeof(StatusEffectData), "isStackable").SetValue(val, ParseExtensions.ParseBool(configuration.GetSection("is_stackable")).GetValueOrDefault(defaultValue10));
			bool defaultValue11 = false;
			AccessTools.Field(typeof(StatusEffectData), "isPropagatable").SetValue(val, ParseExtensions.ParseBool(configuration.GetSection("is_propagatable")).GetValueOrDefault(defaultValue11));
			bool defaultValue12 = true;
			AccessTools.Field(typeof(StatusEffectData), "scalesInEndless").SetValue(val, ParseExtensions.ParseBool(configuration.GetSection("scales_in_endless")).GetValueOrDefault(defaultValue12));
			bool defaultValue13 = false;
			AccessTools.Field(typeof(StatusEffectData), "excludeHeroPropagation").SetValue(val, ParseExtensions.ParseBool(configuration.GetSection("exclude_hero_propagation")).GetValueOrDefault(defaultValue13));
			bool defaultValue14 = false;
			AccessTools.Field(typeof(StatusEffectData), "excludeMonsterPropagation").SetValue(val, ParseExtensions.ParseBool(configuration.GetSection("exclude_monster_propagation")).GetValueOrDefault(defaultValue14));
			bool defaultValue15 = true;
			AccessTools.Field(typeof(StatusEffectData), "showStackCount").SetValue(val, ParseExtensions.ParseBool(configuration.GetSection("show_stack_count")).GetValueOrDefault(defaultValue15));
			bool defaultValue16 = true;
			AccessTools.Field(typeof(StatusEffectData), "showNotificationsOnRemoval").SetValue(val, ParseExtensions.ParseBool(configuration.GetSection("show_notifications_on_removal")).GetValueOrDefault(defaultValue16));
			bool defaultValue17 = false;
			AccessTools.Field(typeof(StatusEffectData), "showOnPyreHeart").SetValue(val, ParseExtensions.ParseBool(configuration.GetSection("show_on_pyre_heart")).GetValueOrDefault(defaultValue17));
			string text6 = "";
			AccessTools.Field(typeof(StatusEffectData), "paramStr").SetValue(val, ParseExtensions.ParseString(configuration.GetSection("param_str")) ?? text6);
			int defaultValue18 = 0;
			AccessTools.Field(typeof(StatusEffectData), "paramInt").SetValue(val, ParseExtensions.ParseInt(configuration.GetSection("param_int")).GetValueOrDefault(defaultValue18));
			int defaultValue19 = 0;
			AccessTools.Field(typeof(StatusEffectData), "paramSecondaryInt").SetValue(val, ParseExtensions.ParseInt(configuration.GetSection("param_secondary_int")).GetValueOrDefault(defaultValue19));
			float defaultValue20 = 0f;
			AccessTools.Field(typeof(StatusEffectData), "paramFloat").SetValue(val, ParseExtensions.ParseFloat(configuration.GetSection("param_secondary_int")).GetValueOrDefault(defaultValue20));
			bool defaultValue21 = false;
			AccessTools.Field(typeof(StatusEffectData), "allowSecondaryTooltipPlacement").SetValue(val, ParseExtensions.ParseBool(configuration.GetSection("allow_secondary_tooltip_placement")).GetValueOrDefault(defaultValue21));
			bool defaultValue22 = false;
			AccessTools.Field(typeof(StatusEffectData), "allowSecondaryUIPlacement").SetValue(val, ParseExtensions.ParseBool(configuration.GetSection("allow_secondary_ui_placement")).GetValueOrDefault(defaultValue22));
			((IRegisterableDictionary<StatusEffectData>)(object)service).Register(id, val);
			return new StatusEffectDataDefinition(key, val, configuration)
			{
				Id = text2
			};
		}
	}
	public class StatusEffectDataRegister : Dictionary<string, StatusEffectData>, IRegister<StatusEffectData>, IRegisterableDictionary<StatusEffectData>, IDictionary<string, StatusEffectData>, ICollection<KeyValuePair<string, StatusEffectData>>, IEnumerable<KeyValuePair<string, StatusEffectData>>, IEnumerable
	{
		private readonly IModLogger<StatusEffectDataRegister> logger;

		public StatusEffectDataRegister(IModLogger<StatusEffectDataRegister> logger)
		{
			this.logger = logger;
		}

		public void Register(string key, StatusEffectData item)
		{
			logger.Log((LogLevel)16, (object)("Register Status Effect (" + key + ")"));
			StatusEffectManager.Instance.GetAllStatusEffectsData().GetStatusEffectData().Add(item);
			StatusEffectManager.StatusIdToLocalizationExpression.Add(item.GetStatusId(), "StatusEffect_" + item.GetStatusId());
			Add(key, item);
		}

		public List<string> GetAllIdentifiers(RegisterIdentifierType identifierType)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Invalid comparison between Unknown and I4
			if ((int)identifierType != 0)
			{
				if ((int)identifierType == 1)
				{
					return base.Keys.ToList();
				}
				return new List<string>();
			}
			return base.Values.Select((StatusEffectData effect) => effect.GetStatusId()).ToList();
		}

		public bool TryLookupIdentifier(string identifier, RegisterIdentifierType identifierType, [NotNullWhen(true)] out StatusEffectData? lookup, [NotNullWhen(true)] out bool? IsModded)
		{
			//IL_0010: 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_0015: Invalid comparison between Unknown and I4
			lookup = null;
			IsModded = true;
			if ((int)identifierType != 0)
			{
				if ((int)identifierType == 1)
				{
					return TryGetValue(identifier, out lookup);
				}
				return false;
			}
			foreach (StatusEffectData value in base.Values)
			{
				if (value.GetStatusId() == identifier)
				{
					lookup = value;
					return true;
				}
			}
			return false;
		}
	}
}
namespace TrainworksReloaded.Base.Room
{
	public class RoomModifierDefinition : IDefinition<RoomModifierData>
	{
		public string Key { get; set; }

		public RoomModifierData Data { get; set; }

		public IConfiguration Configuration { get; set; }

		public string Id { get; set; }

		public bool IsModded { get; set; }

		public RoomModifierDefinition(string key, RoomModifierData data, IConfiguration configuration)
		{
			Key = key;
			Data = data;
			Configuration = configuration;
			Id = "";
			IsModded = true;
			base..ctor();
		}
	}
	public class RoomModifierFinalizer : IDataFinalizer
	{
		private readonly IModLogger<RoomModifierFinalizer> logger;

		private readonly ICache<IDefinition<RoomModifierData>> cache;

		private readonly IRegister<Sprite> spriteRegister;

		private readonly IRegister<CardData> cardDataRegister;

		private readonly IRegister<CardUpgradeData> upgradeDataRegister;

		private readonly IRegister<CardEffectData> cardEffectDataRegister;

		private readonly IRegister<VfxAtLoc> vfxRegister;

		private readonly IRegister<StatusEffectData> statusRegister;

		private readonly IRegister<Trigger> triggerEnumRegister;

		public RoomModifierFinalizer(IModLogger<RoomModifierFinalizer> logger, ICache<IDefinition<RoomModifierData>> cache, IRegister<Sprite> spriteRegister, IRegister<CardData> cardDataRegister, IRegister<CardUpgradeData> upgradeDataRegister, IRegister<CardEffectData> cardEffectDataRegister, IRegister<VfxAtLoc> vfxRegister, IRegister<StatusEffectData> statusRegister, IRegister<Trigger> triggerEnumRegister)
		{
			this.logger = logger;
			this.cache = cache;
			this.spriteRegister = spriteRegister;
			this.cardDataRegister = cardDataRegister;
			this.upgradeDataRegister = upgradeDataRegister;
			this.cardEffectDataRegister = cardEffectDataRegister;
			this.vfxRegister = vfxRegister;
			this.statusRegister = statusRegister;
			this.triggerEnumRegister = triggerEnumRegister;
		}

		public void FinalizeData()
		{
			foreach (IDefinition<RoomModifierData> cacheItem in cache.GetCacheItems())
			{
				FinalizeRoomModifier(cacheItem);
			}
			cache.Clear();
		}

		private void FinalizeRoomModifier(IDefinition<RoomModifierData> definition)
		{
			//IL_02d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_033f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0323: Unknown result type (might be due to invalid IL or missing references)
			//IL_0328: Unknown result type (might be due to invalid IL or missing references)
			//IL_0312: Unknown result type (might be due to invalid IL or missing references)
			//IL_0314: Unknown result type (might be due to invalid IL or missing references)
			//IL_0255: Unknown result type (might be due to invalid IL or missing references)
			//IL_025a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0262: Unknown result type (might be due to invalid IL or missing references)
			//IL_0297: Expected O, but got Unknown
			IConfiguration configuration = definition.Configuration;
			RoomModifierData data = definition.Data;
			string key = definition.Key;
			logger.Log((LogLevel)16, (object)("Finalizing Room Modifier " + definition.Id.ToId(key, "RoomModifier") + "... "));
			string text = ParseExtensions.ParseString(configuration.GetSection("sprite"));
			Sprite value = default(Sprite);
			bool? flag = default(bool?);
			if (text != null && RegisterExtensions.TryLookupId<Sprite>(spriteRegister, text.ToId(key, "Sprite"), ref value, ref flag))
			{
				AccessTools.Field(typeof(RoomModifierData), "icon").SetValue(data, value);
			}
			string text2 = ParseExtensions.ParseString(configuration.GetSection("param_card_upgrade"));
			CardUpgradeData value2 = default(CardUpgradeData);
			if (text2 != null && RegisterExtensions.TryLookupId<CardUpgradeData>(upgradeDataRegister, text2.ToId(key, "Upgrade"), ref value2, ref flag))
			{
				AccessTools.Field(typeof(RoomModifierData), "paramCardUpgardeData").SetValue(data, value2);
			}
			string text3 = ParseExtensions.ParseString(configuration.GetSection("trigered_vfx"));
			VfxAtLoc value3 = default(VfxAtLoc);
			if (text3 != null && RegisterExtensions.TryLookupId<VfxAtLoc>(vfxRegister, text3.ToId(key, "Vfx"), ref value3, ref flag))
			{
				AccessTools.Field(typeof(RoomModifierData), "triggeredVFX").SetValue(data, value3);
			}
			List<CardEffectData> list = new List<CardEffectData>();
			CardEffectData item = default(CardEffectData);
			foreach (IConfigurationSection child in configuration.GetSection("effects").GetChildren())
			{
				if (child == null)
				{
					continue;
				}
				string value4 = child.GetSection("id").Value;
				if (value4 != null)
				{
					string text4 = value4.ToId(key, "Effect");
					if (RegisterExtensions.TryLookupId<CardEffectData>(cardEffectDataRegister, text4, ref item, ref flag))
					{
						list.Add(item);
					}
				}
			}
			if (list.Count != 0)
			{
				AccessTools.Field(typeof(RoomModifierData), "paramCardEffects").SetValue(data, list);
			}
			List<StatusEffectStackData> list2 = new List<StatusEffectStackData>();
			StatusEffectData val = default(StatusEffectData);
			foreach (IConfigurationSection child2 in configuration.GetSection("param_status_effects").GetChildren())
			{
				string text5 = child2?.GetSection("status").Value;
				if (text5 != null)
				{
					string text6 = text5.ToId(key, "StatusEffect");
					string statusId = text5;
					if (RegisterExtensions.TryLookupId<StatusEffectData>(statusRegister, text6, ref val, ref flag))
					{
						statusId = val.GetStatusId();
					}
					list2.Add(new StatusEffectStackData
					{
						statusId = statusId,
						count = ((child2 != null) ? ParseExtensions.ParseInt(child2.GetSection("count")) : null).GetValueOrDefault()
					});
				}
			}
			AccessTools.Field(typeof(RoomModifierData), "paramStatusEffects").SetValue(data, list2.ToArray());
			Trigger val2 = (Trigger)0;
			IConfigurationSection section = configuration.GetSection("trigger");
			if (section.Value != null)
			{
				string value5 = section.Value;
				Trigger val3 = default(Trigger);
				val2 = (RegisterExtensions.TryLookupId<Trigger>(triggerEnumRegister, value5.ToId(key, "CTriggerEnum"), ref val3, ref flag) ? section.ParseTrigger().GetValueOrDefault() : val3);
			}
			AccessTools.Field(typeof(RoomModifierData), "paramTrigger").SetValue(data, val2);
		}
	}
	public class RoomModifierPipeline : IDataPipeline<IRegister<RoomModifierData>, RoomModifierData>
	{
		private readonly PluginAtlas atlas;

		private readonly IModLogger<RoomModifierPipeline> logger;

		private readonly IRegister<LocalizationTerm> termRegister;

		public RoomModifierPipeline(PluginAtlas atlas, IModLogger<RoomModifierPipeline> logger, IRegister<LocalizationTerm> termRegister)
		{
			this.atlas = atlas;
			this.logger = logger;
			this.termRegister = termRegister;
		}

		public List<IDefinition<RoomModifierData>> Run(IRegister<RoomModifierData> service)
		{
			List<IDefinition<RoomModifierData>> list = new List<IDefinition<RoomModifierData>>();
			foreach (KeyValuePair<string, PluginDefinition> pluginDefinition in atlas.PluginDefinitions)
			{
				list.AddRange((IEnumerable<IDefinition<RoomModifierData>>)LoadRoomModifiers(service, pluginDefinition.Key, pluginDefinition.Value.Configuration));
			}
			return list;
		}

		private List<RoomModifierDefinition> LoadRoomModifiers(IRegister<RoomModifierData> service, string key, IConfiguration pluginConfig)
		{
			List<RoomModifierDefinition> list = new List<RoomModifierDefinition>();
			foreach (IConfigurationSection child in pluginConfig.GetSection("room_modifiers").GetChildren())
			{
				RoomModifierDefinition roomModifierDefinition = LoadRoomModifier(service, key, child);
				if (roomModifierDefinition != null)
				{
					list.Add(roomModifierDefinition);
				}
			}
			return list;
		}

		private RoomModifierDefinition? LoadRoomModifier(IRegister<RoomModifierData> service, string key, IConfiguration configuration)
		{
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Expected O, but got Unknown
			//IL_0358: Unknown result type (might be due to invalid IL or missing references)
			//IL_035f: Expected O, but got Unknown
			//IL_040b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0410: Unknown result type (might be due to invalid IL or missing references)
			string text = ParseExtensions.ParseString(configuration.GetSection("id"));
			if (text == null)
			{
				return null;
			}
			string id = key.GetId("RoomModifier", text);
			_ = "RoomModifierData_nameKey-" + id;
			string text2 = "RoomModifierData_descriptionKey-" + id;
			string text3 = "RoomModifierData_descriptionKeyInPlay-" + id;
			string text4 = "RoomModifierData_extraTooltipTitleKey-" + id;
			string text5 = "RoomModifierData_extraTooltipBodyKey-" + id;
			RoomModifierData val = new RoomModifierData();
			string value = configuration.GetSection("name").Value;
			if (value == null)
			{
				return null;
			}
			string text6 = configuration.GetSection("mod_reference").Value ?? key;
			PluginDefinition valueOrDefault = IEnumerableUtility.GetValueOrDefault<string, PluginDefinition>((IDictionary<string, PluginDefinition>)atlas.PluginDefinitions, text6, (PluginDefinition)null);
			Assembly assembly = ((valueOrDefault != null) ? valueOrDefault.Assembly : null);
			if (!value.GetFullyQualifiedName<RoomStateModifierBase>(assembly, out string fullyQualifiedName))
			{
				return null;
			}
			AccessTools.Field(typeof(RoomModifierData), "roomStateModifierClassName").SetValue(val, fullyQualifiedName);
			LocalizationTerm localizationTerm = configuration.GetSection("names").ParseLocalizationTerm();
			if (localizationTerm != null)
			{
				localizationTerm.Key = value;
				((IRegisterableDictionary<LocalizationTerm>)(object)termRegister).Register(value, localizationTerm);
			}
			LocalizationTerm localizationTerm2 = configuration.GetSection("descriptions").ParseLocalizationTerm();
			if (localizationTerm2 != null)
			{
				AccessTools.Field(typeof(RoomModifierData), "descriptionKey").SetValue(val, text2);
				localizationTerm2.Key = text2;
				((IRegisterableDictionary<LocalizationTerm>)(object)termRegister).Register(text2, localizationTerm2);
			}
			LocalizationTerm localizationTerm3 = configuration.GetSection("play_descriptions").ParseLocalizationTerm();
			if (localizationTerm3 != null)
			{
				AccessTools.Field(typeof(RoomModifierData), "descriptionKeyInPlay").SetValue(val, text3);
				localizationTerm3.Key = text3;
				((IRegisterableDictionary<LocalizationTerm>)(object)termRegister).Register(text3, localizationTerm3);
			}
			LocalizationTerm localizationTerm4 = configuration.GetSection("extra_title_tooltips").ParseLocalizationTerm();
			if (localizationTerm4 != null)
			{
				AccessTools.Field(typeof(RoomModifierData), "extraTooltipTitleKey").SetValue(val, text4);
				localizationTerm4.Key = text4;
				((IRegisterableDictionary<LocalizationTerm>)(object)termRegister).Register(text4, localizationTerm4);
			}
			LocalizationTerm localizationTerm5 = configuration.GetSection("extra_body_tooltips").ParseLocalizationTerm();
			if (localizationTerm5 != null)
			{
				AccessTools.Field(typeof(RoomModifierData), "extraTooltipBodyKey").SetValue(val, text5);
				localizationTerm5.Key = text5;
				((IRegisterableDictionary<LocalizationTerm>)(object)termRegister).Register(text5, localizationTerm5);
			}
			string text7 = "";
			AccessTools.Field(typeof(RoomModifierData), "paramSubtype").SetValue(val, ParseExtensions.ParseString(configuration.GetSection("param_subtype")) ?? text7);
			bool defaultValue = false;
			AccessTools.Field(typeof(RoomModifierData), "useTitleForCardDescription").SetValue(val, ParseExtensions.ParseBool(configuration.GetSection("use_name_as_description")).GetValueOrDefault(defaultValue));
			int defaultValue2 = 0;
			AccessTools.Field(typeof(RoomModifierData), "paramInt").SetValue(val, ParseExtensions.ParseInt(configuration.GetSection("param_int")).GetValueOrDefault(defaultValue2));
			int defaultValue3 = 0;
			AccessTools.Field(typeof(RoomModifierData), "paramInt2").SetValue(val, ParseExtensions.ParseInt(configuration.GetSection("param_int_2")).GetValueOrDefault(defaultValue3));
			List<AdditionalTooltipData> list = new List<AdditionalTooltipData>();
			int num = 0;
			foreach (IConfigurationSection child in configuration.GetSection("additional_tooltips").GetChildren())
			{
				_ = child;
				AdditionalTooltipData val2 = new AdditionalTooltipData();
				string text8 = $"RoomModifierDataTooltip_titleKey_{num}-{id}";
				string text9 = $"RoomModifierDataTooltip_titleKey_{num}-{id}";
				LocalizationTerm localizationTerm6 = configuration.GetSection("titles").ParseLocalizationTerm();
				if (localizationTerm6 != null)
				{
					val2.titleKey = text8;
					localizationTerm6.Key = text8;
					((IRegisterableDictionary<LocalizationTerm>)(object)termRegister).Register(text8, localizationTerm6);
				}
				LocalizationTerm localizationTerm7 = configuration.GetSection("descriptions").ParseLocalizationTerm();
				if (localizationTerm7 != null)
				{
					val2.descriptionKey = text9;
					localizationTerm7.Key = text9;
					((IRegisterableDictionary<LocalizationTerm>)(object)termRegister).Register(text9, localizationTerm7);
				}
				val2.style = configuration.GetSection("param_trigger").ParseTooltipDesignType().GetValueOrDefault();
				val2.isStatusTooltip = ParseExtensions.ParseBool(configuration.GetSection("is_status")).GetValueOrDefault();
				val2.hideInTrainRoomUI = ParseExtensions.ParseBool(configuration.GetSection("hide_in_train_room")).GetValueOrDefault();
				val2.allowSecondaryPlacement = ParseExtensions.ParseBool(configuration.GetSection("allow_secondary")).GetValueOrDefault();
				val2.isTriggerTooltip = ParseExtensions.ParseBool(configuration.GetSection("hide_in_train_room")).GetValueOrDefault();
				num++;
				list.Add(val2);
			}
			AccessTools.Field(typeof(RoomModifierData), "additionalTooltips").SetValue(val, list.ToArray());
			((IRegisterableDictionary<RoomModifierData>)(object)service).Register(id, val);
			return new RoomModifierDefinition(key, val, configuration)
			{
				Id = text
			};
		}
	}
	public class RoomModifierRegister : Dictionary<string, RoomModifierData>, IRegister<RoomModifierData>, IRegisterableDictionary<RoomModifierData>, IDictionary<string, RoomModifierData>, ICollection<KeyValuePair<string, RoomModifierData>>, IEnumerable<KeyValuePair<string, RoomModifierData>>, IEnumerable
	{
		private readonly IModLogger<RoomModifierRegister> logger;

		public RoomModifierRegister(IModLogger<RoomModifierRegister> logger)
		{
			this.logger = logger;
		}

		public void Register(string key, RoomModifierData item)
		{
			logger.Log((LogLevel)16, (object)("Register Trait (" + key + ")"));
			Add(key, item);
		}

		public List<string> GetAllIdentifiers(RegisterIdentifierType identifierType)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Invalid comparison between Unknown and I4
			if ((int)identifierType != 0)
			{
				if ((int)identifierType == 1)
				{
					return base.Keys.ToList();
				}
				return new List<string>();
			}
			return base.Keys.ToList();
		}

		public bool TryLookupIdentifier(string identifier, RegisterIdentifierType identifierType, [NotNullWhen(true)] out RoomModifierData? lookup, [NotNullWhen(true)] out bool? IsModded)
		{
			//IL_0010: 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_0015: Invalid comparison between Unknown and I4
			lookup = null;
			IsModded = true;
			if ((int)identifierType != 0)
			{
				if ((int)identifierType == 1)
				{
					return TryGetValue(identifier, out lookup);
				}
				return false;
			}
			return TryGetValue(identifier, out lookup);
		}
	}
}
namespace TrainworksReloaded.Base.Reward
{
	public class CardPoolRewardDataFactory : IFactory<RewardData>
	{
		public string FactoryKey => "cardpool";

		public RewardData? GetValue()
		{
			return (RewardData?)(object)ScriptableObject.CreateInstance<CardPoolRewardData>();
		}
	}
	public class CardPoolRewardDataFinalizerDecorator : IDataFinalizer
	{
		private readonly IModLogger<CardPoolRewardDataFinalizerDecorator> logger;

		private readonly ICache<IDefinition<RewardData>> cache;

		private readonly IRegister<CardPool> cardPoolRegister;

		private readonly IDataFinalizer decoratee;

		public CardPoolRewardDataFinalizerDecorator(IModLogger<CardPoolRewardDataFinalizerDecorator> logger, ICache<IDefinition<RewardData>> cache, IRegister<CardPool> cardPoolRegister, IDataFinalizer decoratee)
		{
			this.logger = logger;
			this.cache = cache;
			this.cardPoolRegister = cardPoolRegister;
			this.decoratee = decoratee;
		}

		public void FinalizeData()
		{
			foreach (IDefinition<RewardData> cacheItem in cache.GetCacheItems())
			{
				FinalizeRewardData(cacheItem);
			}
			decoratee.FinalizeData();
			cache.Clear();
		}

		private void FinalizeRewardData(IDefinition<RewardData> definition)
		{
			IConfiguration configuration = definition.Configuration;
			RewardData data = definition.Data;
			string key = definition.Key;
			CardPoolRewardData val = (CardPoolRewardData)(object)((data is CardPoolRewardData) ? data : null);
			if (val == null)
			{
				return;
			}
			IConfigurationSection configurationSection = (from xs in configuration.GetSection("extensions").GetChildren()
				where xs.GetSection("cardpool").Exists()
				select xs.GetSection("cardpool")).First();
			if (configurationSection == null)
			{
				return;
			}
			logger.Log((LogLevel)16, (object)("Finalizing Card Pool Reward Data " + definition.Id.ToId(key, "RewardData") + "... "));
			string text = ParseExtensions.ParseString(configurationSection.GetSection("cardpool"));
			CardPool value = default(CardPool);
			bool? flag = default(bool?);
			if (text != null && RegisterExtensions.TryLookupId<CardPool>(cardPoolRegister, text.ToId(key, "CardPool"), ref value, ref flag))
			{
				AccessTools.Field(typeof(CardPoolRewardData), "cardPool").SetValue(val, value);
			}
			List<CardCosts> value2 = configurationSection.GetSection("cost_overrides").GetChildren().Select((Func<IConfigurationSection, CardCosts>)((IConfigurationSection xs) => new CardCosts
			{
				rarity = xs.GetSection("rarity").ParseRarity().GetValueOrDefault(),
				costs = (from xs in xs.GetSection("costs").GetChildren()
					select ParseExtensions.ParseInt(xs).GetValueOrDefault()).ToArray()
			}))
				.ToList();
			AccessTools.Field(typeof(CardPoolRewardData), "cardCostsOverride").SetValue(val, value2);
		}
	}
	public class DraftRewardDataFactory : IFactory<RewardData>
	{
		public string FactoryKey => "draft";

		public RewardData? GetValue()
		{
			return (RewardData?)(object)ScriptableObject.CreateInstance<DraftRewardData>();
		}
	}
	public class DraftRewardDataFinalizerDecorator : IDataFinalizer
	{
		private readonly IModLogger<DraftRewardDataFinalizerDecorator> logger;

		private readonly ICache<IDefinition<RewardData>> cache;

		private readonly IRegister<CardPool> cardPoolRegister;

		private readonly IRegister<ClassData> classRegister;

		private readonly IDataFinalizer decoratee;

		public DraftRewardDataFinalizerDecorator(IModLogger<DraftRewardDataFinalizerDecorator> logger, ICache<IDefinition<RewardData>> cache, IRegister<CardPool> cardPoolRegister, IRegister<ClassData> classRegister, IDataFinalizer decoratee)
		{
			this.logger = logger;
			this.cache = cache;
			this.cardPoolRegister = cardPoolRegister;
			this.classRegister = classRegister;
			this.decoratee = decoratee;
		}

		public void FinalizeData()
		{
			foreach (IDefinition<RewardData> cacheItem in cache.GetCacheItems())
			{
				FinalizeRewardData(cacheItem);
			}
			decoratee.FinalizeData();
			cache.Clear();
		}

		private void FinalizeRewardData(IDefinition<RewardData> definition)
		{
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_036f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0374: Unknown result type (might be due to invalid IL or missing references)
			//IL_038b: Unknown result type (might be due to invalid IL or missing references)
			IConfiguration configuration = definition.Configuration;
			RewardData data = definition.Data;
			string key = definition.Key;
			DraftRewardData val = (DraftRewardData)(object)((data is DraftRewardData) ? data : null);
			if (val == null)
			{
				return;
			}
			IConfigurationSection configurationSection = (from xs in configuration.GetSection("extensions").GetChildren()
				where xs.GetSection("draft").Exists()
				select xs.GetSection("draft")).First();
			if (configurationSection != null)
			{
				logger.Log((LogLevel)16, (object)("Finalizing Draft Reward Data " + definition.Id.ToId(key, "RewardData") + "... "));
				string text = ParseExtensions.ParseString(configurationSection.GetSection("draft_pool"));
				CardPool value = default(CardPool);
				bool? flag = default(bool?);
				if (text != null && RegisterExtensions.TryLookupId<CardPool>(cardPoolRegister, text.ToId(key, "CardPool"), ref value, ref flag))
				{
					AccessTools.Field(typeof(DraftRewardData), "draftPool").SetValue(val, value);
				}
				ClassType valueOrDefault = configurationSection.GetSection("class_type").ParseClassType().GetValueOrDefault();
				AccessTools.Field(typeof(DraftRewardData), "classType").SetValue(val, valueOrDefault);
				int valueOrDefault2 = ParseExtensions.ParseInt(configurationSection.GetSection("draft_options_count")).GetValueOrDefault(2);
				AccessTools.Field(typeof(DraftRewardData), "draftOptionsCount").SetValue(val, (uint)Math.Abs(valueOrDefault2));
				int valueOrDefault3 = ParseExtensions.ParseInt(configurationSection.GetSection("extra_copies")).GetValueOrDefault();
				AccessTools.Field(typeof(DraftRewardData), "extraCopies").SetValue(val, valueOrDefault3);
				bool valueOrDefault4 = ParseExtensions.ParseBool(configurationSection.GetSection("disable_skip")).GetValueOrDefault();
				AccessTools.Field(typeof(DraftRewardData), "disableSkip").SetValue(val, valueOrDefault4);
				bool valueOrDefault5 = ParseExtensions.ParseBool(configurationSection.GetSection("ignore_relic_rarity_override")).GetValueOrDefault();
				AccessTools.Field(typeof(DraftRewardData), "ignoreRelicRarityOverride").SetValue(val, valueOrDefault5);
				bool valueOrDefault6 = ParseExtensions.ParseBool(configurationSection.GetSection("use_run_rarity_floors")).GetValueOrDefault();
				AccessTools.Field(typeof(DraftRewardData), "useRunRarityFloors").SetValue(val, valueOrDefault6);
				bool valueOrDefault7 = ParseExtensions.ParseBool(configurationSection.GetSection("flatten_rarity_for_draft_rate")).GetValueOrDefault();
				AccessTools.Field(typeof(DraftRewardData), "flattenRarityForDraftRate").SetValue(val, valueOrDefault7);
				bool valueOrDefault8 = ParseExtensions.ParseBool(configurationSection.GetSection("grant_single_card")).GetValueOrDefault();
				AccessTools.Field(typeof(DraftRewardData), "grantSingleCard").SetValue(val, valueOrDefault8);
				bool valueOrDefault9 = ParseExtensions.ParseBool(configurationSection.GetSection("class_type_override")).GetValueOrDefault();
				AccessTools.Field(typeof(DraftRewardData), "classTypeOverride").SetValue(val, valueOrDefault9);
				flag = ParseExtensions.ParseBool(configurationSection.GetSection("use_draft_ticket_override_values"));
				bool valueOrDefault10 = flag.GetValueOrDefault();
				AccessTools.Field(typeof(DraftRewardData), "useDraftTicketOverrideValues").SetValue(val, valueOrDefault10);
				CollectableRarity valueOrDefault11 = configurationSection.GetSection("rarity_floor").ParseRarity().GetValueOrDefault();
				AccessTools.Field(typeof(DraftRewardData), "rarityFloorOverride").SetValue(val, valueOrDefault11);
				string text2 = ParseExtensions.ParseString(configurationSection.GetSection("class_data_override"));
				ClassData value2 = default(ClassData);
				if (text2 != null && RegisterExtensions.TryLookupName<ClassData>(classRegister, text2.ToId(key, "Class"), ref value2, ref flag))
				{
					AccessTools.Field(typeof(DraftRewardData), "classDataOverride").SetValue(val, value2);
				}
				List<RarityTicket> value3 = configurationSection.GetSection("card_rarity_ticket_values").GetChildren().Select(delegate(IConfigurationSection xs)
				{
					//IL_0002: 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_0022: 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)
					RarityTicket result3 = default(RarityTicket);
					result3.rarityType = xs.GetSection("rarity").ParseRarity().GetValueOrDefault();
					result3.ticketValue = ParseExtensions.ParseInt(xs.GetSection("value")).GetValueOrDefault();
					return result3;
				})
					.ToList();
				AccessTools.Field(typeof(DraftRewardData), "cardRarityTicketValues").SetValue(val, value3);
				List<RarityTicket> value4 = configurationSection.GetSection("enhancer_rarity_ticket_values").GetChildren().Select(delegate(IConfigurationSection xs)
				{
					//IL_0002: 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_0022: 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)
					RarityTicket result2 = default(RarityTicket);
					result2.rarityType = xs.GetSection("rarity").ParseRarity().GetValueOrDefault();
					result2.ticketValue = ParseExtensions.ParseInt(xs.GetSection("value")).GetValueOrDefault();
					return result2;
				})
					.ToList();
				AccessTools.Field(typeof(DraftRewardData), "enhancerRarityTicketValues").SetValue(val, value4);
				List<RarityTicket> value5 = configurationSection.GetSection("relic_rarity_ticket_values").GetChildren().Select(delegate(IConfigurationSection xs)
				{
					//IL_0002: 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_0022: 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)
					RarityTicket result = default(RarityTicket);
					result.rarityType = xs.GetSection("rarity").ParseRarity().GetValueOrDefault();
					result.ticketValue = ParseExtensions.ParseInt(xs.GetSection("value")).GetValueOrDefault();
					return result;
				})
					.ToList();
				AccessTools.Field(typeof(DraftRewardData), "relicRarityTicketValues").SetValue(val, value5);
				bool valueOrDefault12 = ParseExtensions.ParseBool(configurationSection.GetSection("is_service_merchant_reward")).GetValueOrDefault();
				AccessTools.Field(typeof(GrantableRewardData), "_isServiceMerchantReward").SetValue(val, valueOrDefault12);
				int valueOrDefault13 = ParseExtensions.ParseInt(configurationSection.GetSection("merchant_service_index")).GetValueOrDefault();
				AccessTools.Field(typeof(GrantableRewardData), "_merchantServiceIndex").SetValue(val, valueOrDefault13);
				bool valueOrDefault14 = ParseExtensions.ParseBool(configurationSection.GetSection("apply_trial_data_modifiers")).GetValueOrDefault();
				AccessTools.Field(typeof(GrantableRewardData), "_applyTrialDataModifiers").SetValue(val, valueOrDefault14);
			}
		}
	}
	public class RewardDataDefinition : IDefinition<RewardData>
	{
		public string Key { get; set; }

		public RewardData Data { get; set; }

		public IConfiguration Configuration { get; set; }

		public string Id { get; set; }

		public bool IsModded { get; set; }

		public RewardDataDefinition(string key, RewardData data, IConfiguration configuration)
		{
			Key = key;
			Data = data;
			Configuration = configuration;
			Id = "";
			IsModded = true;
			base..ctor();
		}
	}
	public class RewardDataFinalizer : IDataFinalizer
	{
		private readonly IModLogger<RewardDataFinalizer> logger;

		private readonly ICache<IDefinition<RewardData>> cache;

		private readonly IRegister<Sprite> spriteRegister;

		public RewardDataFinalizer(IModLogger<RewardDataFinalizer> logger, ICache<IDefinition<RewardData>> cache, IRegister<Sprite> spriteRegister)
		{
			this.logger = logger;
			this.cache = cache;
			this.spriteRegister = spriteRegister;
		}

		public void FinalizeData()
		{
			foreach (IDefinition<RewardData> cacheItem in cache.GetCacheItems())
			{
				FinalizeRewardData(cacheItem);
			}
			cache.Clear();
		}

		private void FinalizeRewardData(IDefinition<RewardData> definition)
		{
			IConfiguration configuration = definition.Configuration;
			RewardData data = definition.Data;
			string key = definition.Key;
			logger.Log((LogLevel)16, (object)("Finalizing Reward Data " + definition.Id.ToId(key, "RewardData") + "... "));
			string text = ParseExtensions.ParseString(configuration.GetSection("sprite"));
			Sprite value = default(Sprite);
			bool? flag = default(bool?);
			if (text != null && RegisterExtensions.TryLookupId<Sprite>(spriteRegister, text.ToId(key, "Sprite"), ref value, ref flag))
			{
				AccessTools.Field(typeof(RewardData), "_rewardSprite").SetValue(data, value);
			}
		}
	}
	public class RewardDataPipeline : IDataPipeline<IRegister<RewardData>, RewardData>
	{
		private readonly PluginAtlas atlas;

		private readonly IRegister<LocalizationTerm> termRegister;

		private readonly Dictionary<string, IFactory<RewardData>> generators;

		public RewardDataPipeline(PluginAtlas atlas, IEnumerable<IFactory<RewardData>> generators, IRegister<LocalizationTerm> termRegister)
		{
			this.atlas = atlas;
			this.termRegister = termRegister;
			this.generators = generators.ToDictionary((IFactory<RewardData> xs) => xs.FactoryKey);
		}

		public List<IDefinition<RewardData>> Run(IRegister<RewardData> service)
		{
			List<IDefinition<RewardData>> list = new List<IDefinition<RewardData>>();
			foreach (KeyValuePair<string, PluginDefinition> pluginDefinition in atlas.PluginDefinitions)
			{
				list.AddRange((IEnumerable<IDefinition<RewardData>>)LoadRewards(service, pluginDefinition.Key, pluginDefinition.Value.Configuration));
			}
			return list;
		}

		public List<RewardDataDefinition> LoadRewards(IRegister<RewardData> service, string key, IConfiguration pluginConfig)
		{
			List<RewardDataDefinition> list = new List<RewardDataDefinition>();
			foreach (IConfigurationSection child in pluginConfig.GetSection("rewards").GetChildren())
			{
				RewardDataDefinition rewardDataDefinition = LoadRewardConfiguration(service, key, child);
				if (rewardDataDefinition != null)
				{
					list.Add(rewardDataDefinition);
				}
			}
			return list;
		}

		public RewardDataDefinition? LoadRewardConfiguration(IRegister<RewardData> service, string key, IConfiguration configuration)
		{
			//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
			string text = ParseExtensions.ParseString(configuration.GetSection("id"));
			if (text == null)
			{
				return null;
			}
			string text2 = ParseExtensions.ParseString(configuration.GetSection("type"));
			if (text2 == null || !generators.TryGetValue(text2, out IFactory<RewardData> value))
			{
				return null;
			}
			RewardData value2 = value.GetValue();
			if ((Object)(object)value2 == (Object)null)
			{
				return null;
			}
			string text3 = (((Object)value2).name = key.GetId("RewardData", text));
			string text4 = "RewardData_titleKey-" + text3;
			string text5 = "RewardData_descriptionKey-" + text3;
			LocalizationTerm localizationTerm = configuration.GetSection("titles").ParseLocalizationTerm();
			if (localizationTerm != null)
			{
				AccessTools.Field(typeof(RewardData), "_rewardTitleKey").SetValue(value2, text4);
				localizationTerm.Key = text4;
				((IRegisterableDictionary<LocalizationTerm>)(object)termRegister).Register(text4, localizationTerm);
			}
			LocalizationTerm localizationTerm2 = configuration.GetSection("descriptions").ParseLocalizationTerm();
			if (localizationTerm2 != null)
			{
				AccessTools.Field(typeof(RewardData), "_rewardDescriptionKey").SetValue(value2, text5);
				localizationTerm2.Key = text5;
				((IRegisterableDictionary<LocalizationTerm>)(object)termRegister).Register(text5, localizationTerm2);
			}
			AccessTools.Field(typeof(RewardData), "_showRewardFlowInEvent").SetValue(value2, ParseExtensions.ParseBool(configuration.GetSection("show_in_event")).GetValueOrDefault());
			AccessTools.Field(typeof(RewardData), "ShowRewardAnimationInEvent").SetValue(value2, ParseExtensions.ParseBool(configuration.GetSection("show_animation_in_event")).GetValueOrDefault());
			AccessTools.Field(typeof(RewardData), "_showCancelOverride").SetValue(value2, ParseExtensions.ParseBool(configuration.GetSection("show_cancel")).GetValueOrDefault());
			AccessTools.Field(typeof(RewardData), "isUniqueInEndlessMode").SetValue(value2, ParseExtensions.ParseBool(configuration.GetSection("endless_mode_unique")).GetValueOrDefault());
			AccessTools.Field(typeof(RewardData), "_collectSFXCueName").SetValue(value2, ParseExtensions.ParseString(configuration.GetSection("collect_cue")) ?? "");
			List<int> list = (from xs in configuration.GetSection("costs").GetChildren()
				select ParseExtensions.ParseInt(xs).GetValueOrDefault()).ToList();
			AccessTools.Field(typeof(RewardData), "costs").SetValue(value2, list.ToArray());
			AccessTools.Field(typeof(RewardData), "_filter").SetValue(value2, configuration.GetSection("filter").ParseRewardFiler().GetValueOrDefault());
			((IRegisterableDictionary<RewardData>)(object)service).Register(text3, value2);
			return new RewardDataDefinition(key, value2, configuration)
			{
				Id = text
			};
		}
	}
	public class RewardDataRegister : Dictionary<string, RewardData>, IRegister<RewardData>, IRegisterableDictionary<RewardData>, IDictionary<string, RewardData>, ICollection<KeyValuePair<string, RewardData>>, IEnumerable<KeyValuePair<string, RewardData>>, IEnumerable
	{
		private readonly IModLogger<CardPoolRegister> logger;

		public RewardDataRegister(GameDataClient client, IModLogger<CardPoolRegister> logger)
		{
			this.logger = logger;
		}

		public void Register(string key, RewardData item)
		{
			logger.Log((LogLevel)16, (object)("Register Reward " + key + "... "));
			Add(key, item);
		}

		public List<string> GetAllIdentifiers(RegisterIdentifierType identifierType)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Invalid comparison between Unknown and I4
			if ((int)identifierType != 0)
			{
				if ((int)identifierType == 1)
				{
					return base.Keys.ToList();
				}
				return new List<string>();
			}
			return base.Keys.ToList();
		}

		public bool TryLookupIdentifier(string identifier, RegisterIdentifierType identifierType, [NotNullWhen(true)] out RewardData? lookup, [NotNullWhen(true)] out bool? IsModded)
		{
			//IL_0010: 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_0015: Invalid comparison between Unknown and I4
			lookup = null;
			IsModded = true;
			if ((int)identifierType != 0)
			{
				if ((int)identifierType == 1)
				{
					return TryGetValue(identifier, out lookup);
				}
				return false;
			}
			return TryGetValue(identifier, out lookup);
		}
	}
}
namespace TrainworksReloaded.Base.Relic
{
	public class CollectableRelicDataFactory : IFactory<RelicData>
	{
		public string FactoryKey => "collectable";

		public RelicData? GetValue()
		{
			return (RelicData?)(object)ScriptableObject.CreateInstance<CollectableRelicData>();
		}
	}
	public class CollectableRelicDataFinalizerDecorator : IDataFinalizer
	{
		private readonly IModLogger<CollectableRelicDataFinalizerDecorator> logger;

		private readonly ICache<IDefinition<RelicData>> cache;

		private readonly IRegister<ClassData> classRegister;

		private readonly IDataFinalizer decoratee;

		public CollectableRelicDataFinalizerDecorator(IModLogger<CollectableRelicDataFinalizerDecorator> logger, ICache<IDefinition<RelicData>> cache, IRegister<ClassData> classRegister, IDataFinalizer decoratee)
		{
			this.logger = logger;
			this.cache = cache;
			this.classRegister = classRegister;
			this.decoratee = decoratee;
		}

		public void FinalizeData()
		{
			foreach (IDefinition<RelicData> cacheItem in cache.GetCacheItems())
			{
				FinalizeRelicData(cacheItem);
			}
			decoratee.FinalizeData();
			cache.Clear();
		}

		private void FinalizeRelicData(IDefinition<RelicData> definition)
		{
			IConfiguration configuration = definition.Configuration;
			RelicData data = definition.Data;
			string key = definition.Key;
			string text = definition.Id.ToId(key, "RelicData");
			CollectableRelicData val = (CollectableRelicData)(object)((data is CollectableRelicData) ? data : null);
			if (val == null)
			{
				return;
			}
			IConfigurationSection configurationSection = (from xs in configuration.GetSection("extensions").GetChildren()
				where xs.GetSection("collectable").Exists()
				select xs.GetSection("collectable")).FirstOrDefault();
			if (configurationSection != null)
			{
				logger.Log((LogLevel)16, (object)("Finalizing Collectable Relic Data " + text + "... "));
				string text2 = ParseExtensions.ParseString(configurationSection.GetSection("class"));
				ClassData value = default(ClassData);
				bool? flag = default(bool?);
				if (text2 != null && RegisterExtensions.TryLookupName<ClassData>(classRegister, text2.ToId(key, "Class"), ref value, ref flag))
				{
					AccessTools.Field(typeof(CollectableRelicData), "linkedClass").SetValue(val, value);
				}
			}
		}
	}
	public class CollectableRelicDataPipelineDecorator : IDataPipeline<IRegister<RelicData>, RelicData>
	{
		private readonly IModLogger<CollectableRelicDataPipelineDecorator> logger;

		private readonly IDataPipeline<IRegister<RelicData>, RelicData> decoratee;

		private readonly VanillaRelicPoolDelegator relicPoolDelegator;

		public CollectableRelicDataPipelineDecorator(IModLogger<CollectableRelicDataPipelineDecorator> logger, IDataPipeline<IRegister<RelicData>, RelicData> decoratee, VanillaRelicPoolDelegator relicPoolDelegator)
		{
			this.logger = logger;
			this.decoratee = decoratee;
			this.relicPoolDelegator = relicPoolDelegator;
		}

		public List<IDefinition<RelicData>> Run(IRegister<RelicData> register)
		{
			List<IDefinition<RelicData>> list = decoratee.Run(register);
			foreach (IDefinition<RelicData> item in list)
			{
				ProcessCollectableRelicData(item);
			}
			return list;
		}

		private void ProcessCollectableRelicData(IDefinition<RelicData> definition)
		{
			//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_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0201: Unknown result type (might be due to invalid IL or missing references)
			//IL_0218: Unknown result type (might be due to invalid IL or missing references)
			IConfiguration configuration = definition.Configuration;
			RelicData data = definition.Data;
			string key = definition.Key;
			CollectableRelicData val = (CollectableRelicData)(object)((data is CollectableRelicData) ? data : null);
			if (val == null)
			{
				return;
			}
			IConfigurationSection configurationSection = (from xs in configuration.GetSection("extensions").GetChildren()
				where xs.GetSection("collectable").Exists()
				select xs.GetSection("collectable")).FirstOrDefault();
			if (configurationSection == null)
			{
				return;
			}
			CollectableRarity valueOrDefault = configurationSection.GetSection("rarity").ParseRarity().GetValueOrDefault();
			AccessTools.Field(typeof(CollectableRelicData), "rarity").SetValue(val, valueOrDefault);
			int valueOrDefault2 = ParseExtensions.ParseInt(configurationSection.GetSection("unlock_level")).GetValueOrDefault();
			AccessTools.Field(typeof(CollectableRelicData), "unlockLevel").SetValue(val, valueOrDefault2);
			bool valueOrDefault3 = ParseExtensions.ParseBool(configurationSection.GetSection("from_story_event")).GetValueOrDefault();
			AccessTools.Field(typeof(CollectableRelicData), "fromStoryEvent").SetValue(val, valueOrDefault3);
			bool valueOrDefault4 = ParseExtensions.ParseBool(configurationSection.GetSection("is_boss_given")).GetValueOrDefault();
			AccessTools.Field(typeof(CollectableRelicData), "isBossGivenRelic").SetValue(val, valueOrDefault4);
			bool valueOrDefault5 = ParseExtensions.ParseBool(configurationSection.GetSection("is_dragons_hoard")).GetValueOrDefault();
			AccessTools.Field(typeof(CollectableRelicData), "isDragonsHoardRelic").SetValue(val, valueOrDefault5);
			bool valueOrDefault6 = ParseExtensions.ParseBool(configurationSection.GetSection("ignore_for_no_relic_achievement")).GetValueOrDefault();
			AccessTools.Field(typeof(CollectableRelicData), "ignoreForNoRelicAchievement").SetValue(val, valueOrDefault6);
			DLC valueOrDefault7 = configurationSection.GetSection("required_dlc").ParseDLC().GetValueOrDefault();
			AccessTools.Field(typeof(CollectableRelicData), "requiredDLC").SetValue(val, valueOrDefault7);
			bool valueOrDefault8 = ParseExtensions.ParseBool(configurationSection.GetSection("deprioritize_in_ftue_drafts")).GetValueOrDefault();
			AccessTools.Field(typeof(CollectableRelicData), "deprioritizeInFtueDrafts").SetValue(val, valueOrDefault8);
			bool valueOrDefault9 = ParseExtensions.ParseBool(configurationSection.GetSection("force_update_count_label")).GetValueOrDefault();
			AccessTools.Field(typeof(CollectableRelicD

System.Numerics.Vectors.dll

Decompiled 2 weeks ago
using System;
using System.Diagnostics;
using System.Globalization;
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.25519.03")]
[assembly: AssemblyInformationalVersion("4.6.25519.03 built by: dlab-DDVSOWINAGE013. Commit Hash: 8321c729934c0f8be754953439b88e6e1c120c24")]
[assembly: CLSCompliant(true)]
[assembly: AssemblyMetadata(".NETFrameworkAssembly", "")]
[assembly: AssemblyMetadata("Serviceable", "True")]
[assembly: AssemblyMetadata("PreferInbox", "True")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("4.1.3.0")]
[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 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 const string s_resourcesName = "FxResources.System.Numerics.Vectors.SR";

		private static ResourceManager ResourceManager => s_resourceManager ?? (s_resourceManager = new ResourceManager(ResourceType));

		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 Type ResourceType => typeof(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.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.All)]
	internal class __BlockReflectionAttribute : 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;
		}
	}
	[AttributeUsage(AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property)]
	internal class JitIntrinsicAttribute : Attribute
	{
	}
	[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;
	}
	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> zero = new Vector<T>(GetZeroValue());

		private static readonly Vector<T> one = new Vector<T>(GetOneValue());

		private static readonly Vector<T> allOnes = new Vector<T>(GetAllBitsSetValue());

		[JitIntrinsic]
		public static int Count => s_count;

		[JitIntrinsic]
		public static Vector<T> Zero => zero;

		[JitIntrinsic]
		public static Vector<T> One => one;

		internal static Vector<T> AllOnes => allOnes;

		[JitIntrinsic]
		public unsafe T this[int index]
		{
			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;
		}

		[JitIntrinsic]
		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;
			}
		}

		[JitIntrinsic]
		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();
			}
			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;
		}

		[JitIntrinsic]
		public void CopyTo(T[] destination)
		{
			CopyTo(destination, 0);
		}

		[JitIntrinsic]
		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);
		}

		[JitIntrinsic]
		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)checked(unchecked((nuint)(uint)Count) * (nuint)1u)];
					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)checked(unchecked((nuint)(uint)Count) * (nuint)1u)];
					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)checked(unchecked((nuint)(uint)Count) * (nuint)1u)];
					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)checked(unchecked((nuint)(uint)Count) * (nuint)1u)];
					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)checked(unchecked((nuint)(uint)Count) * (nuint)1u)];
					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)checked(unchecked((nuint)(uint)Count) * (nuint)1u)];
					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)checked(unchecked((nuint)(uint)Count) * (nuint)1u)];
					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)checked(unchecked((nuint)(uint)Count) * (nuint)1u)];
					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;
		}

		[JitIntrinsic]
		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;
		}

		[JitIntrinsic]
		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;
		}

		[JitIntrinsic]
		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 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);
		}

		[JitIntrinsic]
		public static explicit operator Vector<byte>(Vector<T> value)
		{
			return new Vector<byte>(ref value.register);
		}

		[CLSCompliant(false)]
		[JitIntrinsic]
		public static explicit operator Vector<sbyte>(Vector<T> value)
		{
			return new Vector<sbyte>(ref value.register);
		}

		[CLSCompliant(false)]
		[JitIntrinsic]
		public static explicit operator Vector<ushort>(Vector<T> value)
		{
			return new Vector<ushort>(ref value.register);
		}

		[JitIntrinsic]
		public static explicit operator Vector<short>(Vector<T> value)
		{
			return new Vector<short>(ref value.register);
		}

		[CLSCompliant(false)]
		[JitIntrinsic]
		public static explicit operator Vector<uint>(Vector<T> value)
		{
			return new Vector<uint>(ref value.register);
		}

		[JitIntrinsic]
		public static explicit operator Vector<int>(Vector<T> value)
		{
			return new Vector<int>(ref value.register);
		}

		[CLSCompliant(false)]
		[JitIntrinsic]
		public static explicit operator Vector<ulong>(Vector<T> value)
		{
			return new Vector<ulong>(ref value.register);
		}

		[JitIntrinsic]
		public static explicit operator Vector<long>(Vector<T> value)
		{
			return new Vector<long>(ref value.register);
		}

		[JitIntrinsic]
		public static explicit operator Vector<float>(Vector<T> value)
		{
			return new Vector<float>(ref value.register);
		}

		[JitIntrinsic]
		public static explicit operator Vector<double>(Vector<T> value)
		{
			return new Vector<double>(ref value.register);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		[JitIntrinsic]
		internal unsafe static Vector<T> Equals(Vector<T> left, Vector<T> right)
		{
			if (Vector.IsHardwareAccelerated)
			{
				if (typeof(T) == typeof(byte))
				{
					byte* ptr = stackalloc byte[(int)checked(unchecked((nuint)(uint)Count) * (nuint)1u)];
					for (int i = 0; i < Count; i++)
					{
						ptr[i] = (byte)(ScalarEquals(left[i], right[i]) ? ConstantHelper.GetByteWithAllBitsSet() : 0);
					}
					return new Vector<T>(ptr);
				}
				if (typeof(T) == typeof(sbyte))
				{
					sbyte* ptr2 = stackalloc sbyte[(int)checked(unchecked((nuint)(uint)Count) * (nuint)1u)];
					for (int j = 0; j < Count; j++)
					{
						ptr2[j] = (sbyte)(ScalarEquals(left[j], right[j]) ? ConstantHelper.GetSByteWithAllBitsSet() : 0);
					}
					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)(ScalarEquals(left[k], right[k]) ? ConstantHelper.GetUInt16WithAllBitsSet() : 0);
					}
					return new Vector<T>(ptr3);
				}
				if (typeof(T) == typeof(short))
				{
					short* ptr4 

System.Text.Json.dll

Decompiled 2 weeks ago
using System;
using System.Buffers;
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.Globalization;
using System.IO;
using System.IO.Pipelines;
using System.Numerics;
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.Security;
using System.Security.Permissions;
using System.Text.Encodings.Web;
using System.Text.Json;
using System.Text.Json.Nodes;
using System.Text.Json.Reflection;
using System.Text.Json.Schema;
using System.Text.Json.Serialization;
using System.Text.Json.Serialization.Converters;
using System.Text.Json.Serialization.Metadata;
using System.Text.RegularExpressions;
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(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[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("9.0.225.6610")]
[assembly: AssemblyInformationalVersion("9.0.2+80aa709f5d919c6814726788dc6dabe23e79e672")]
[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("9.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 RequiresLocationAttribute : Attribute
	{
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class ParamCollectionAttribute : 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++)
			{
				ToCharsBuffer(readOnlySpan[i], 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, out int charsProcessed)
		{
			return TryDecodeFromUtf16_Scalar(chars, bytes, out charsProcessed);
		}

		private static bool TryDecodeFromUtf16_Scalar(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);
				long num2 = -17875860044349952L << (int)num;
				ulong num3 = num - 64;
				return (long)((ulong)num2 & num3) < 0L;
			}
			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 = "AuthenticationManager is not supported. Methods will no-op or 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 X509CertificateLoader 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 const string RsaEncryptDecryptValueMessage = "RSA.EncryptValue and DecryptValue are not supported and throw NotSupportedException. Use RSA.Encrypt and RSA.Decrypt instead.";

		internal const string RsaEncryptDecryptDiagId = "SYSLIB0048";

		internal const string JsonSerializerOptionsAddContextMessage = "JsonSerializerOptions.AddContext is obsolete. To register a JsonSerializerContext, use either the TypeInfoResolver or TypeInfoResolverChain properties.";

		internal const string JsonSerializerOptionsAddContextDiagId = "SYSLIB0049";

		internal const string LegacyFormatterMessage = "Formatter-based serialization is obsolete and should not be used.";

		internal const string LegacyFormatterDiagId = "SYSLIB0050";

		internal const string LegacyFormatterImplMessage = "This API supports obsolete formatter-based serialization. It should not be called or extended by application code.";

		internal const string LegacyFormatterImplDiagId = "SYSLIB0051";

		internal const string RegexExtensibilityImplMessage = "This API supports obsolete mechanisms for Regex extensibility. It is not supported.";

		internal const string RegexExtensibilityDiagId = "SYSLIB0052";

		internal const string AesGcmTagConstructorMessage = "AesGcm should indicate the required tag size for encryption and decryption. Use a constructor that accepts the tag size.";

		internal const string AesGcmTagConstructorDiagId = "SYSLIB0053";

		internal const string ThreadVolatileReadWriteMessage = "Thread.VolatileRead and Thread.VolatileWrite are obsolete. Use Volatile.Read or Volatile.Write respectively instead.";

		internal const string ThreadVolatileReadWriteDiagId = "SYSLIB0054";

		internal const string ArmIntrinsicPerformsUnsignedOperationMessage = "The underlying hardware instruction does not perform a signed saturate narrowing operation, and it always returns an unsigned result. Use the unsigned overload instead.";

		internal const string ArmIntrinsicPerformsUnsignedOperationDiagId = "SYSLIB0055";

		internal const string LoadFromHashAlgorithmMessage = "LoadFrom with a custom AssemblyHashAlgorithm is obsolete. Use overloads without an AssemblyHashAlgorithm.";

		internal const string LoadFromHashAlgorithmDiagId = "SYSLIB0056";

		internal const string X509CtorCertDataObsoleteMessage = "Loading certificate data through the constructor or Import is obsolete. Use X509CertificateLoader instead to load certificates.";

		internal const string X509CtorCertDataObsoleteDiagId = "SYSLIB0057";
	}
	internal static class SR
	{
		private static readonly bool s_usingResourceKeys = GetUsingResourceKeysSwitchValue();

		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 UnsupportedEnumIdentifier => GetResourceString("UnsupportedEnumIdentifier");

		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 JsonElementDeepEqualsInsufficientExecutionStack => GetResourceString("JsonElementDeepEqualsInsufficientExecutionStack");

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

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

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

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

		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 SerializerOptionsReadOnly => GetResourceString("SerializerOptionsReadOnly");

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

		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 PropertyTypeNotNullable => GetResourceString("PropertyTypeNotNullable");

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

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

		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 DeserializeInterfaceOrAbstractType => GetResourceString("DeserializeInterfaceOrAbstractType");

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

		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 MetadataIdCannotBeCombinedWithRef => GetResourceString("MetadataIdCannotBeCombinedWithRef");

		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 UnmappedJsonProperty => GetResourceString("UnmappedJsonProperty");

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

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

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

		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 JsonIncludeOnInaccessibleProperty => GetResourceString("JsonIncludeOnInaccessibleProperty");

		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 SerializerConverterFactoryInvalidArgument => GetResourceString("SerializerConverterFactoryInvalidArgument");

		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 NodeParentWrongType => GetResourceString("NodeParentWrongType");

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

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

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

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

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

		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 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 OnDeserializingCallbacksNotSupported => GetResourceString("OnDeserializingCallbacksNotSupported");

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

		private static bool GetUsingResourceKeysSwitchValue()
		{
			if (!AppContext.TryGetSwitch("System.Resources.UseSystemResourceKeys", out var isEnabled))
			{
				return false;
			}
			return isEnabled;
		}

		internal static bool UsingResourceKeys()
		{
			return s_usingResourceKeys;
		}

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

		private 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.Reflection
{
	internal sealed class NullabilityInfo
	{
		public Type Type { get; }

		public NullabilityState ReadState { get; internal set; }

		public NullabilityState WriteState { get; internal set; }

		public NullabilityInfo ElementType { get; }

		public NullabilityInfo[] GenericTypeArguments { get; }

		internal NullabilityInfo(Type type, NullabilityState readState, NullabilityState writeState, NullabilityInfo elementType, NullabilityInfo[] typeArguments)
		{
			Type = type;
			ReadState = readState;
			WriteState = writeState;
			ElementType = elementType;
			GenericTypeArguments = typeArguments;
		}
	}
	internal enum NullabilityState
	{
		Unknown,
		NotNull,
		Nullable
	}
	internal sealed class NullabilityInfoContext
	{
		[Flags]
		private enum NotAnnotatedStatus
		{
			None = 0,
			Private = 1,
			Internal = 2
		}

		private readonly struct NullableAttributeStateParser
		{
			private static readonly object UnknownByte = (byte)0;

			private readonly object _nullableAttributeArgument;

			public static NullableAttributeStateParser Unknown => new NullableAttributeStateParser(UnknownByte);

			public NullableAttributeStateParser(object nullableAttributeArgument)
			{
				_nullableAttributeArgument = nullableAttributeArgument;
			}

			public bool ParseNullableState(int index, ref NullabilityState state)
			{
				object nullableAttributeArgument = _nullableAttributeArgument;
				if (!(nullableAttributeArgument is byte b))
				{
					if (nullableAttributeArgument is ReadOnlyCollection<CustomAttributeTypedArgument> readOnlyCollection)
					{
						ReadOnlyCollection<CustomAttributeTypedArgument> readOnlyCollection2 = readOnlyCollection;
						if (index < readOnlyCollection2.Count && readOnlyCollection2[index].Value is byte b2)
						{
							state = TranslateByte(b2);
							return true;
						}
					}
					return false;
				}
				byte b3 = b;
				state = TranslateByte(b3);
				return true;
			}
		}

		private const string CompilerServicesNameSpace = "System.Runtime.CompilerServices";

		private readonly Dictionary<Module, NotAnnotatedStatus> _publicOnlyModules = new Dictionary<Module, NotAnnotatedStatus>();

		private readonly Dictionary<MemberInfo, NullabilityState> _context = new Dictionary<MemberInfo, NullabilityState>();

		private NullabilityState? GetNullableContext(MemberInfo memberInfo)
		{
			while (memberInfo != null)
			{
				if (_context.TryGetValue(memberInfo, out var value))
				{
					return value;
				}
				foreach (CustomAttributeData customAttributesDatum in memberInfo.GetCustomAttributesData())
				{
					if (customAttributesDatum.AttributeType.Name == "NullableContextAttribute" && customAttributesDatum.AttributeType.Namespace == "System.Runtime.CompilerServices" && customAttributesDatum.ConstructorArguments.Count == 1)
					{
						value = TranslateByte(customAttributesDatum.ConstructorArguments[0].Value);
						_context.Add(memberInfo, value);
						return value;
					}
				}
				memberInfo = memberInfo.DeclaringType;
			}
			return null;
		}

		public NullabilityInfo Create(ParameterInfo parameterInfo)
		{
			NetstandardHelpers.ThrowIfNull(parameterInfo, "parameterInfo");
			IList<CustomAttributeData> customAttributesData = parameterInfo.GetCustomAttributesData();
			NullableAttributeStateParser parser = ((parameterInfo.Member is MethodBase method && IsPrivateOrInternalMethodAndAnnotationDisabled(method)) ? NullableAttributeStateParser.Unknown : CreateParser(customAttributesData));
			NullabilityInfo nullabilityInfo = GetNullabilityInfo(parameterInfo.Member, parameterInfo.ParameterType, parser);
			if (nullabilityInfo.ReadState != 0)
			{
				CheckParameterMetadataType(parameterInfo, nullabilityInfo);
			}
			CheckNullabilityAttributes(nullabilityInfo, customAttributesData);
			return nullabilityInfo;
		}

		private void CheckParameterMetadataType(ParameterInfo parameter, NullabilityInfo nullability)
		{
			MemberInfo member = parameter.Member;
			MemberInfo metaMember;
			ParameterInfo parameterInfo;
			if (!(member is ConstructorInfo member2))
			{
				if (!(member is MethodInfo method))
				{
					return;
				}
				MethodInfo methodMetadataDefinition = GetMethodMetadataDefinition(method);
				metaMember = methodMetadataDefinition;
				parameterInfo = (string.IsNullOrEmpty(parameter.Name) ? methodMetadataDefinition.ReturnParameter : GetMetaParameter(methodMetadataDefinition, parameter));
			}
			else
			{
				parameterInfo = GetMetaParameter((MethodBase)(metaMember = (ConstructorInfo)GetMemberMetadataDefinition(member2)), parameter);
			}
			if (parameterInfo != null)
			{
				CheckGenericParameters(nullability, metaMember, parameterInfo.ParameterType, parameter.Member.ReflectedType);
			}
		}

		private static ParameterInfo GetMetaParameter(MethodBase metaMethod, ParameterInfo parameter)
		{
			ReadOnlySpan<ParameterInfo> parametersAsSpan = metaMethod.GetParametersAsSpan();
			for (int i = 0; i < parametersAsSpan.Length; i++)
			{
				if (parameter.Position == i && parameter.Name == parametersAsSpan[i].Name)
				{
					return parametersAsSpan[i];
				}
			}
			return null;
		}

		private static MethodInfo GetMethodMetadataDefinition(MethodInfo method)
		{
			if (method.IsGenericMethod && !method.IsGenericMethodDefinition)
			{
				method = method.GetGenericMethodDefinition();
			}
			return (MethodInfo)GetMemberMetadataDefinition(method);
		}

		private static void CheckNullabilityAttributes(NullabilityInfo nullability, IList<CustomAttributeData> attributes)
		{
			NullabilityState nullabilityState = NullabilityState.Unknown;
			NullabilityState nullabilityState2 = NullabilityState.Unknown;
			foreach (CustomAttributeData attribute in attributes)
			{
				if (attribute.AttributeType.Namespace == "System.Diagnostics.CodeAnalysis")
				{
					if (attribute.AttributeType.Name == "NotNullAttribute")
					{
						nullabilityState = NullabilityState.NotNull;
					}
					else if ((attribute.AttributeType.Name == "MaybeNullAttribute" || attribute.AttributeType.Name == "MaybeNullWhenAttribute") && nullabilityState == NullabilityState.Unknown && !IsValueTypeOrValueTypeByRef(nullability.Type))
					{
						nullabilityState = NullabilityState.Nullable;
					}
					else if (attribute.AttributeType.Name == "DisallowNullAttribute")
					{
						nullabilityState2 = NullabilityState.NotNull;
					}
					else if (attribute.AttributeType.Name == "AllowNullAttribute" && nullabilityState2 == NullabilityState.Unknown && !IsValueTypeOrValueTypeByRef(nullability.Type))
					{
						nullabilityState2 = NullabilityState.Nullable;
					}
				}
			}
			if (nullabilityState != 0)
			{
				nullability.ReadState = nullabilityState;
			}
			if (nullabilityState2 != 0)
			{
				nullability.WriteState = nullabilityState2;
			}
		}

		public NullabilityInfo Create(PropertyInfo propertyInfo)
		{
			NetstandardHelpers.ThrowIfNull(propertyInfo, "propertyInfo");
			MethodInfo getMethod = propertyInfo.GetGetMethod(nonPublic: true);
			MethodInfo setMethod = propertyInfo.GetSetMethod(nonPublic: true);
			NullableAttributeStateParser parser = (((getMethod == null || IsPrivateOrInternalMethodAndAnnotationDisabled(getMethod)) && (setMethod == null || IsPrivateOrInternalMethodAndAnnotationDisabled(setMethod))) ? NullableAttributeStateParser.Unknown : CreateParser(propertyInfo.GetCustomAttributesData()));
			NullabilityInfo nullabilityInfo = GetNullabilityInfo(propertyInfo, propertyInfo.PropertyType, parser);
			if (getMethod != null)
			{
				CheckNullabilityAttributes(nullabilityInfo, getMethod.ReturnParameter.GetCustomAttributesData());
			}
			else
			{
				nullabilityInfo.ReadState = NullabilityState.Unknown;
			}
			if (setMethod != null)
			{
				ReadOnlySpan<ParameterInfo> parametersAsSpan = setMethod.GetParametersAsSpan();
				ParameterInfo parameterInfo = parametersAsSpan[parametersAsSpan.Length - 1];
				CheckNullabilityAttributes(nullabilityInfo, parameterInfo.GetCustomAttributesData());
			}
			else
			{
				nullabilityInfo.WriteState = NullabilityState.Unknown;
			}
			return nullabilityInfo;
		}

		private bool IsPrivateOrInternalMethodAndAnnotationDisabled(MethodBase method)
		{
			if ((method.IsPrivate || method.IsFamilyAndAssembly || method.IsAssembly) && IsPublicOnly(method.IsPrivate, method.IsFamilyAndAssembly, method.IsAssembly, method.Module))
			{
				return true;
			}
			return false;
		}

		public NullabilityInfo Create(EventInfo eventInfo)
		{
			NetstandardHelpers.ThrowIfNull(eventInfo, "eventInfo");
			return GetNullabilityInfo(eventInfo, eventInfo.EventHandlerType, CreateParser(eventInfo.GetCustomAttributesData()));
		}

		public NullabilityInfo Create(FieldInfo fieldInfo)
		{
			NetstandardHelpers.ThrowIfNull(fieldInfo, "fieldInfo");
			IList<CustomAttributeData> customAttributesData = fieldInfo.GetCustomAttributesData();
			NullableAttributeStateParser parser = (IsPrivateOrInternalFieldAndAnnotationDisabled(fieldInfo) ? NullableAttributeStateParser.Unknown : CreateParser(customAttributesData));
			NullabilityInfo nullabilityInfo = GetNullabilityInfo(fieldInfo, fieldInfo.FieldType, parser);
			CheckNullabilityAttributes(nullabilityInfo, customAttributesData);
			return nullabilityInfo;
		}

		private bool IsPrivateOrInternalFieldAndAnnotationDisabled(FieldInfo fieldInfo)
		{
			if ((fieldInfo.IsPrivate || fieldInfo.IsFamilyAndAssembly || fieldInfo.IsAssembly) && IsPublicOnly(fieldInfo.IsPrivate, fieldInfo.IsFamilyAndAssembly, fieldInfo.IsAssembly, fieldInfo.Module))
			{
				return true;
			}
			return false;
		}

		private bool IsPublicOnly(bool isPrivate, bool isFamilyAndAssembly, bool isAssembly, Module module)
		{
			if (!_publicOnlyModules.TryGetValue(module, out var value))
			{
				value = PopulateAnnotationInfo(module.GetCustomAttributesData());
				_publicOnlyModules.Add(module, value);
			}
			if (value == NotAnnotatedStatus.None)
			{
				return false;
			}
			if (((isPrivate || isFamilyAndAssembly) && value.HasFlag(NotAnnotatedStatus.Private)) || (isAssembly && value.HasFlag(NotAnnotatedStatus.Internal)))
			{
				return true;
			}
			return false;
		}

		private static NotAnnotatedStatus PopulateAnnotationInfo(IList<CustomAttributeData> customAttributes)
		{
			bool flag = default(bool);
			foreach (CustomAttributeData customAttribute in customAttributes)
			{
				if (customAttribute.AttributeType.Name == "NullablePublicOnlyAttribute" && customAttribute.AttributeType.Namespace == "System.Runtime.CompilerServices" && customAttribute.ConstructorArguments.Count == 1)
				{
					object value = customAttribute.ConstructorArguments[0].Value;
					int num;
					if (value is bool)
					{
						flag = (bool)value;
						num = 1;
					}
					else
					{
						num = 0;
					}
					if (((uint)num & (flag ? 1u : 0u)) != 0)
					{
						return NotAnnotatedStatus.Private | NotAnnotatedStatus.Internal;
					}
					return NotAnnotatedStatus.Private;
				}
			}
			return NotAnnotatedStatus.None;
		}

		private NullabilityInfo GetNullabilityInfo(MemberInfo memberInfo, Type type, NullableAttributeStateParser parser)
		{
			int index = 0;
			NullabilityInfo nullabilityInfo = GetNullabilityInfo(memberInfo, type, parser, ref index);
			if (nullabilityInfo.ReadState != 0)
			{
				TryLoadGenericMetaTypeNullability(memberInfo, nullabilityInfo);
			}
			return nullabilityInfo;
		}

		private NullabilityInfo GetNullabilityInfo(MemberInfo memberInfo, Type type, NullableAttributeStateParser parser, ref int index)
		{
			NullabilityState state = NullabilityState.Unknown;
			NullabilityInfo elementType = null;
			NullabilityInfo[] array = Array.Empty<NullabilityInfo>();
			Type type2 = type;
			if (type2.IsByRef || type2.IsPointer)
			{
				type2 = type2.GetElementType();
			}
			if (type2.IsValueType)
			{
				Type underlyingType = Nullable.GetUnderlyingType(type2);
				if ((object)underlyingType != null)
				{
					type2 = underlyingType;
					state = NullabilityState.Nullable;
				}
				else
				{
					state = NullabilityState.NotNull;
				}
				if (type2.IsGenericType)
				{
					index++;
				}
			}
			else
			{
				if (!parser.ParseNullableState(index++, ref state))
				{
					NullabilityState? nullableContext = GetNullableContext(memberInfo);
					if (nullableContext.HasValue)
					{
						NullabilityState valueOrDefault = nullableContext.GetValueOrDefault();
						state = valueOrDefault;
					}
				}
				if (type2.IsArray)
				{
					elementType = GetNullabilityInfo(memberInfo, type2.GetElementType(), parser, ref index);
				}
			}
			if (type2.IsGenericType)
			{
				Type[] genericArguments = type2.GetGenericArguments();
				array = new NullabilityInfo[genericArguments.Length];
				for (int i = 0; i < genericArguments.Length; i++)
				{
					array[i] = GetNullabilityInfo(memberInfo, genericArguments[i], parser, ref index);
				}
			}
			return new NullabilityInfo(type, state, state, elementType, array);
		}

		private static NullableAttributeStateParser CreateParser(IList<CustomAttributeData> customAttributes)
		{
			foreach (CustomAttributeData customAttribute in customAttributes)
			{
				if (customAttribute.AttributeType.Name == "NullableAttribute" && customAttribute.AttributeType.Namespace == "System.Runtime.CompilerServices" && customAttribute.ConstructorArguments.Count == 1)
				{
					return new NullableAttributeStateParser(customAttribute.ConstructorArguments[0].Value);
				}
			}
			return new NullableAttributeStateParser(null);
		}

		private void TryLoadGenericMetaTypeNullability(MemberInfo memberInfo, NullabilityInfo nullability)
		{
			MemberInfo memberMetadataDefinition = GetMemberMetadataDefinition(memberInfo);
			Type type = null;
			if (memberMetadataDefinition is FieldInfo fieldInfo)
			{
				type = fieldInfo.FieldType;
			}
			else if (memberMetadataDefinition is PropertyInfo property)
			{
				type = GetPropertyMetaType(property);
			}
			if (type != null)
			{
				CheckGenericParameters(nullability, memberMetadataDefinition, type, memberInfo.ReflectedType);
			}
		}

		private static MemberInfo GetMemberMetadataDefinition(MemberInfo member)
		{
			Type declaringType = member.DeclaringType;
			if (declaringType != null && declaringType.IsGenericType && !declaringType.IsGenericTypeDefinition)
			{
				return NetstandardHelpers.GetMemberWithSameMetadataDefinitionAs(declaringType.GetGenericTypeDefinition(), member);
			}
			return member;
		}

		private static Type GetPropertyMetaType(PropertyInfo property)
		{
			MethodInfo getMethod = property.GetGetMethod(nonPublic: true);
			if ((object)getMethod != null)
			{
				return getMethod.ReturnType;
			}
			return property.GetSetMethod(nonPublic: true).GetParametersAsSpan()[0].ParameterType;
		}

		private void CheckGenericParameters(NullabilityInfo nullability, MemberInfo metaMember, Type metaType, Type reflectedType)
		{
			if (metaType.IsGenericParameter)
			{
				if (nullability.ReadState == NullabilityState.NotNull)
				{
					TryUpdateGenericParameterNullability(nullability, metaType, reflectedType);
				}
			}
			else
			{
				if (!metaType.ContainsGenericParameters)
				{
					return;
				}
				if (nullability.GenericTypeArguments.Length != 0)
				{
					Type[] genericArguments = metaType.GetGenericArguments();
					for (int i = 0; i < genericArguments.Length; i++)
					{
						CheckGenericParameters(nullability.GenericTypeArguments[i], metaMember, genericArguments[i], reflectedType);
					}
					return;
				}
				NullabilityInfo elementType = nullability.ElementType;
				if (elementType != null && metaType.IsArray)
				{
					CheckGenericParameters(elementType, metaMember, metaType.GetElementType(), reflectedType);
				}
				else if (metaType.IsByRef)
				{
					CheckGenericParameters(nullability, metaMember, metaType.GetElementType(), reflectedType);
				}
			}
		}

		private bool TryUpdateGenericParameterNullability(NullabilityInfo nullability, Type genericParameter, Type reflectedType)
		{
			if ((object)reflectedType != null && !genericParameter.IsGenericMethodParameter() && TryUpdateGenericTypeParameterNullabilityFromReflectedType(nullability, genericParameter, reflectedType, reflectedType))
			{
				return true;
			}
			if (IsValueTypeOrValueTypeByRef(nullability.Type))
			{
				return true;
			}
			NullabilityState state = NullabilityState.Unknown;
			if (CreateParser(genericParameter.GetCustomAttributesData()).ParseNullableState(0, ref state))
			{
				nullability.ReadState = state;
				nullability.WriteState = state;
				return true;
			}
			NullabilityState? nullableContext = GetNullableContext(genericParameter);
			if (nullableContext.HasValue)
			{
				NullabilityState writeState = (nullability.ReadState = nullableContext.GetValueOrDefault());
				nullability.WriteState = writeState;
				return true;
			}
			return false;
		}

		private bool TryUpdateGenericTypeParameterNullabilityFromReflectedType(NullabilityInfo nullability, Type genericParameter, Type context, Type reflectedType)
		{
			Type type2 = ((context.IsGenericType && !context.IsGenericTypeDefinition) ? context.GetGenericTypeDefinition() : context);
			if (genericParameter.DeclaringType == type2)
			{
				return false;
			}
			Type baseType = type2.BaseType;
			if ((object)baseType == null)
			{
				return false;
			}
			if (!baseType.IsGenericType || (baseType.IsGenericTypeDefinition ? baseType : baseType.GetGenericTypeDefinition()) != genericParameter.DeclaringType)
			{
				return TryUpdateGenericTypeParameterNullabilityFromReflectedType(nullability, genericParameter, baseType, reflectedType);
			}
			Type[] genericArguments = baseType.GetGenericArguments();
			Type type3 = genericArguments[genericParameter.GenericParameterPosition];
			if (type3.IsGenericParameter)
			{
				return TryUpdateGenericParameterNullability(nullability, type3, reflectedType);
			}
			NullableAttributeStateParser parser = CreateParser(type2.GetCustomAttributesData());
			int index = 1;
			for (int i = 0; i < genericParameter.GenericParameterPosition; i++)
			{
				index += CountNullabilityStates(genericArguments[i]);
			}
			return TryPopulateNullabilityInfo(nullability, parser, ref index);
			static int CountNullabilityStates(Type type)
			{
				Type type4 = Nullable.GetUnderlyingType(type) ?? type;
				if (type4.IsGenericType)
				{
					int num = 1;
					Type[] genericArguments2 = type4.GetGenericArguments();
					foreach (Type type5 in genericArguments2)
					{
						num += CountNullabilityStates(type5);
					}
					return num;
				}
				if (type4.HasElementType)
				{
					return (type4.IsArray ? 1 : 0) + CountNullabilityStates(type4.GetElementType());
				}
				return (!type.IsValueType) ? 1 : 0;
			}
		}

		private static bool TryPopulateNullabilityInfo(NullabilityInfo nullability, NullableAttributeStateParser parser, ref int index)
		{
			bool flag = IsValueTypeOrValueTypeByRef(nullability.Type);
			if (!flag)
			{
				NullabilityState state = NullabilityState.Unknown;
				if (!parser.ParseNullableState(index, ref state))
				{
					return false;
				}
				nullability.ReadState = state;
				nullability.WriteState = state;
			}
			if (!flag || (Nullable.GetUnderlyingType(nullability.Type) ?? nullability.Type).IsGenericType)
			{
				index++;
			}
			if (nullability.GenericTypeArguments.Length != 0)
			{
				NullabilityInfo[] genericTypeArguments = nullability.GenericTypeArguments;
				for (int i = 0; i < genericTypeArguments.Length; i++)
				{
					TryPopulateNullabilityInfo(genericTypeArguments[i], parser, ref index);
				}
			}
			else
			{
				NullabilityInfo elementType = nullability.ElementType;
				if (elementType != null)
				{
					TryPopulateNullabilityInfo(elementType, parser, ref index);
				}
			}
			return true;
		}

		private static NullabilityState TranslateByte(object value)
		{
			if (!(value is byte b))
			{
				return NullabilityState.Unknown;
			}
			return TranslateByte(b);
		}

		private static NullabilityState TranslateByte(byte b)
		{
			return b switch
			{
				1 => NullabilityState.NotNull, 
				2 => NullabilityState.Nullable, 
				_ => NullabilityState.Unknown, 
			};
		}

		private static bool IsValueTypeOrValueTypeByRef(Type type)
		{
			if (!type.IsValueType)
			{
				if (type.IsByRef || type.IsPointer)
				{
					return type.GetElementType().IsValueType;
				}
				return false;
			}
			return true;
		}
	}
	internal static class NetstandardHelpers
	{
		public static void ThrowIfNull(object argument, string paramName)
		{
			if (argument == null)
			{
				Throw(paramName);
			}
			static void Throw(string paramName)
			{
				throw new ArgumentNullException(paramName);
			}
		}

		[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2070:UnrecognizedReflectionPattern", Justification = "This is finding the MemberInfo with the same MetadataToken as specified MemberInfo. If the specified MemberInfo exists and wasn't trimmed, then the current Type's MemberInfo couldn't have been trimmed.")]
		public static MemberInfo GetMemberWithSameMetadataDefinitionAs(this Type type, MemberInfo member)
		{
			ThrowIfNull(member, "member");
			MemberInfo[] members = type.GetMembers(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
			foreach (MemberInfo memberInfo in members)
			{
				if (HasSameMetadataDefinitionAs(memberInfo, member))
				{
					return memberInfo;
				}
			}
			throw new MissingMemberException(type.FullName, member.Name);
		}

		private static bool HasSameMetadataDefinitionAs(this MemberInfo info, MemberInfo other)
		{
			if (info.MetadataToken != other.MetadataToken)
			{
				return false;
			}
			if (!info.Module.Equals(other.Module))
			{
				return false;
			}
			return true;
		}

		public static bool IsGenericMethodParameter(this Type type)
		{
			if (type.IsGenericParameter)
			{
				return (object)type.DeclaringMethod != null;
			}
			return false;
		}

		public static ReadOnlySpan<ParameterInfo> GetParametersAsSpan(this MethodBase metaMethod)
		{
			return metaMethod.GetParameters();
		}
	}
}
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.Collections
{
	internal static class HashHelpers
	{
		public const uint HashCollisionThreshold = 100u;

		public const int MaxPrimeArrayLength = 2147483587;

		public const int HashPrime = 101;

		internal static ReadOnlySpan<int> Primes
		{
			get
			{
				object obj = global::<PrivateImplementationDetails>.74BCD6ED20AF2231F2BB1CDE814C5F4FF48E54BAC46029EEF90DDF4A208E2B20_A6;
				if (obj == null)
				{
					obj = new int[72]
					{
						3, 7, 11, 17, 23, 29, 37, 47, 59, 71,
						89, 107, 131, 163, 197, 239, 293, 353, 431, 521,
						631, 761, 919, 1103, 1327, 1597, 1931, 2333, 2801, 3371,
						4049, 4861, 5839, 7013, 8419, 10103, 12143, 14591, 17519, 21023,
						25229, 30293, 36353, 43627, 52361, 62851, 75431, 90523, 108631, 130363,
						156437, 187751, 225307, 270371, 324449, 389357, 467237, 560689, 672827, 807403,
						968897, 1162687, 1395263, 1674319, 2009191, 2411033, 2893249, 3471899, 4166287, 4999559,
						5999471, 7199369
					};
					global::<PrivateImplementationDetails>.74BCD6ED20AF2231F2BB1CDE814C5F4FF48E54BAC46029EEF90DDF4A208E2B20_A6 = (int[])obj;
				}
				return new ReadOnlySpan<int>((int[]?)obj);
			}
		}

		public static bool IsPrime(int candidate)
		{
			if (((uint)candidate & (true ? 1u : 0u)) != 0)
			{
				int num = (int)Math.Sqrt(candidate);
				for (int i = 3; i <= num; i += 2)
				{
					if (candidate % i == 0)
					{
						return false;
					}
				}
				return true;
			}
			return candidate == 2;
		}

		public static int GetPrime(int min)
		{
			if (min < 0)
			{
				throw new ArgumentException(System.SR.Arg_HTCapacityOverflow);
			}
			ReadOnlySpan<int> primes = Primes;
			for (int i = 0; i < primes.Length; i++)
			{
				int num = primes[i];
				if (num >= min)
				{
					return num;
				}
			}
			for (int j = min | 1; j < int.MaxValue; j += 2)
			{
				if (IsPrime(j) && (j - 1) % 101 != 0)
				{
					return j;
				}
			}
			return min;
		}

		public static int ExpandPrime(int oldSize)
		{
			int num = 2 * oldSize;
			if ((uint)num > 2147483587u && 2147483587 > oldSize)
			{
				return 2147483587;
			}
			return GetPrime(num);
		}

		public static ulong GetFastModMultiplier(uint divisor)
		{
			return ulong.MaxValue / (ulong)divisor + 1;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static uint FastMod(uint value, uint divisor, ulong multiplier)
		{
			return (uint)(((multiplier * value >> 32) + 1) * divisor >> 32);
		}
	}
	internal static class ThrowHelper
	{
		[DoesNotReturn]
		internal static void ThrowKeyNotFound<TKey>(TKey key)
		{
			throw new KeyNotFoundException(System.SR.Format(System.SR.Arg_KeyNotFoundWithKey, key));
		}

		[DoesNotReturn]
		internal static void ThrowDuplicateKey<TKey>(TKey key)
		{
			throw new ArgumentException(System.SR.Format(System.SR.Argument_AddingDuplicate, key), "key");
		}

		[DoesNotReturn]
		internal static void ThrowConcurrentOperation()
		{
			throw new InvalidOperationException(System.SR.InvalidOperation_ConcurrentOperationsNotSupported);
		}

		[DoesNotReturn]
		internal static void ThrowIndexArgumentOutOfRange()
		{
			throw new ArgumentOutOfRangeException("index");
		}

		[DoesNotReturn]
		internal static void ThrowVersionCheckFailed()
		{
			throw new InvalidOperationException(System.SR.InvalidOperation_EnumFailedVersion);
		}

		public static void ThrowIfNull([NotNull] object argument, [CallerArgumentExpression("argument")] string paramName = null)
		{
			if (argument == null)
			{
				ThrowNull(paramName);
			}
		}

		public static void ThrowIfNegative(int value, [CallerArgumentExpression("value")] string paramName = null)
		{
			if (value < 0)
			{
				ThrowNegative(value, paramName);
			}
		}

		public static void ThrowIfGreaterThan<T>(T value, T other, [CallerArgumentExpression("value")] string paramName = null) where T : IComparable<T>
		{
			if (value.CompareTo(other) > 0)
			{
				ThrowGreater(value, other, paramName);
			}
		}

		public static void ThrowIfLessThan<T>(T value, T other, [CallerArgumentExpression("value")] string paramName = null) where T : IComparable<T>
		{
			if (value.CompareTo(other) < 0)
			{
				ThrowLess(value, other, paramName);
			}
		}

		[DoesNotReturn]
		private static void ThrowNull(string paramName)
		{
			throw new ArgumentNullException(paramName);
		}

		[DoesNotReturn]
		private static void ThrowNegative(int value, string paramName)
		{
			throw new ArgumentOutOfRangeException(paramName, value, System.SR.Format(System.SR.ArgumentOutOfRange_Generic_MustBeNonNegative, paramName, value));
		}

		[DoesNotReturn]
		private static void ThrowGreater<T>(T value, T other, string paramName)
		{
			throw new ArgumentOutOfRangeException(paramName, value, System.SR.Format(System.SR.ArgumentOutOfRange_Generic_MustBeLessOrEqual, paramName, value, other));
		}

		[DoesNotReturn]
		private static void ThrowLess<T>(T value, T other, string paramName)
		{
			throw new ArgumentOutOfRangeException(paramName, value, System.SR.Format(System.SR.ArgumentOutOfRange_Generic_MustBeGreaterOrEqual, paramName, value, other));
		}
	}
}
namespace System.Collections.ObjectModel
{
	internal static class CollectionHelpers
	{
		internal static void ValidateCopyToArguments(int sourceCount, Array array, int index)
		{
			if (array == null)
			{
				throw new ArgumentNullException("array");
			}
			if (array.Rank != 1)
			{
				throw new ArgumentException(System.SR.Arg_RankMultiDimNotSupported, "array");
			}
			if (array.GetLowerBound(0) != 0)
			{
				throw new ArgumentException(System.SR.Arg_NonZeroLowerBound, "array");
			}
			if (index < 0 || index > array.Length)
			{
				throw new ArgumentOutOfRangeException("index");
			}
			if (array.Length - index < sourceCount)
			{
				throw new ArgumentException(System.SR.Arg_ArrayPlusOffTooSmall);
			}
		}

		internal static void CopyTo<T>(ICollection<T> collection, Array array, int index)
		{
			ValidateCopyToArguments(collection.Count, array, index);
			if (collection is ICollection collection2)
			{
				collection2.CopyTo(array, index);
				return;
			}
			if (array is T[] array2)
			{
				collection.CopyTo(array2, index);
				return;
			}
			if (!(array is object[] array3))
			{
				throw new ArgumentException(System.SR.Argument_IncompatibleArrayType, "array");
			}
			try
			{
				foreach (T item in collection)
				{
					array3[index++] = item;
				}
			}
			catch (ArrayTypeMismatchException)
			{
				throw new ArgumentException(System.SR.Argument_IncompatibleArrayType, "array");
			}
		}
	}
}
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);
		}
	}
	[DebuggerDisplay("{Value}", Name = "[{Key}]")]
	internal readonly struct DebugViewDictionaryItem<TKey, TValue>
	{
		[DebuggerBrowsable(DebuggerBrowsableState.Collapsed)]
		public TKey Key { get; }

		[DebuggerBrowsable(DebuggerBrowsableState.Collapsed)]
		public TValue Value { get; }

		public DebugViewDictionaryItem(TKey key, TValue value)
		{
			Key = key;
			Value = value;
		}

		public DebugViewDictionaryItem(KeyValuePair<TKey, TValue> keyValue)
		{
			Key = keyValue.Key;
			Value = keyValue.Value;
		}
	}
	internal sealed class ICollectionDebugView<T>
	{
		private readonly ICollection<T> _collection;

		[DebuggerBrowsable(DebuggerBrowsableState.RootHidden)]
		public T[] Items
		{
			get
			{
				T[] array = new T[_collection.Count];
				_collection.CopyTo(array, 0);
				return array;
			}
		}

		public ICollectionDebugView(ICollection<T> collection)
		{
			if (collection == null)
			{
				throw new ArgumentNullException("collection");
			}
			_collection = collection;
		}
	}
	internal sealed class IDictionaryDebugView<TKey, TValue>
	{
		private readonly IDictionary<TKey, TValue> _dict;

		[DebuggerBrowsable(DebuggerBrowsableState.RootHidden)]
		public DebugViewDictionaryItem<TKey, TValue>[] Items
		{
			get
			{
				KeyValuePair<TKey, TValue>[] array = new KeyValuePair<TKey, TValue>[_dict.Count];
				_dict.CopyTo(array, 0);
				DebugViewDictionaryItem<TKey, TValue>[] array2 = new DebugViewDictionaryItem<TKey, TValue>[array.Length];
				for (int i = 0; i < array2.Length; i++)
				{
					array2[i] = new DebugViewDictionaryItem<TKey, TValue>(array[i]);
				}
				return array2;
			}
		}

		public IDictionaryDebugView(IDictionary<TKey, TValue> dictionary)
		{
			_dict = dictionary ?? throw new ArgumentNullException("dictionary");
		}
	}
	internal sealed class DictionaryKeyCollectionDebugView<TKey, TValue>
	{
		private readonly ICollection<TKey> _collection;

		[DebuggerBrowsable(DebuggerBrowsableState.RootHidden)]
		public TKey[] Items
		{
			get
			{
				TKey[] array = new TKey[_collection.Count];
				_collection.CopyTo(array, 0);
				return array;
			}
		}

		public DictionaryKeyCollectionDebugView(ICollection<TKey> collection)
		{
			_collection = collection ?? throw new ArgumentNullException("collection");
		}
	}
	internal sealed class DictionaryValueCollectionDebugView<TKey, TValue>
	{
		private readonly ICollection<TValue> _collection;

		[DebuggerBrowsable(DebuggerBrowsableState.RootHidden)]
		public TValue[] Items
		{
			get
			{
				TValue[] array = new TValue[_collection.Count];
				_collection.CopyTo(array, 0);
				return array;
			}
		}

		public DictionaryValueCollectionDebugView(ICollection<TValue> collection)
		{
			_collection = collection ?? throw new ArgumentNullException("collection");
		}
	}
	internal static class EnumerableHelpers
	{
		internal static void Reset<T>(ref T enumerator) where T : IEnumerator
		{
			enumerator.Reset();
		}

		internal static IEnumerator<T> GetEmptyEnumerator<T>()
		{
			return ((IEnumerable<T>)Array.Empty<T>()).GetEnumerator();
		}

		internal static T[] ToArray<T>(IEnumerable<T> source, out int length)
		{
			if (source is ICollection<T> collection)
			{
				int count = collection.Count;
				if (count != 0)
				{
					T[] array = new T[count];
					collection.CopyTo(array, 0);
					length = count;
					return array;
				}
			}
			else
			{
				using IEnumerator<T> enumerator = source.GetEnumerator();
				if (enumerator.MoveNext())
				{
					T[] array2 = new T[4]
					{
						enumerator.Current,
						default(T),
						default(T),
						default(T)
					};
					int num = 1;
					while (enumerator.MoveNext())
					{
						if (num == array2.Length)
						{
							int num2 = num << 1;
							if ((uint)num2 > 2147483591u)
							{
								num2 = ((2147483591 <= num) ? (num + 1) : 2147483591);
							}
							Array.Resize(ref array2, num2);
						}
						array2[num++] = enumerator.Current;
					}
					length = num;
					return array2;
				}
			}
			length = 0;
			return Array.Empty<T>();
		}
	}
	[DebuggerTypeProxy(typeof(System.Collections.Generic.IDictionaryDebugView<, >))]
	[DebuggerDisplay("Count = {Count}")]
	internal sealed class OrderedDictionary<TKey, TValue> : IDictionary<TKey, TValue>, ICollection<KeyValuePair<TKey, TValue>>, IEnumerable<KeyValuePair<TKey, TValue>>, IEnumerable, IReadOnlyDictionary<TKey, TValue>, IReadOnlyCollection<KeyValuePair<TKey, TValue>>, IDictionary, ICollection, IList<KeyValuePair<TKey, TValue>>, IReadOnlyList<KeyValuePair<TKey, TValue>>, IList
	{
		private struct Entry
		{
			public int Next;

			public uint HashCode;

			public TKey Key;

			public TValue Value;
		}

		[StructLayout(LayoutKind.Auto)]
		public struct Enumerator : IEnumerator<KeyValuePair<TKey, TValue>>, IEnumerator, IDisposable, IDictionaryEnumerator
		{
			private readonly OrderedDictionary<TKey, TValue> _dictionary;

			private readonly int _version;

			private readonly bool _useDictionaryEntry;

			private int _index;

			public KeyValuePair<TKey, TValue> Current { get; private set; }

			readonly object IEnumerator.Current
			{
				get
				{
					if (!_useDictionaryEntry)
					{
						return Current;
					}
					return new DictionaryEntry(Current.Key, Current.Value);
				}
			}

			readonly DictionaryEntry IDictionaryEnumerator.Entry => new DictionaryEntry(Current.Key, Current.Value);

			readonly object IDictionaryEnumerator.Key => Current.Key;

			readonly object IDictionaryEnumerator.Value => Current.Value;

			internal Enumerator(OrderedDictionary<TKey, TValue> dictionary, bool useDictionaryEntry)
			{
				_index = 0;
				_dictionary = dictionary;
				_version = _dictionary._version;
				_useDictionaryEntry = useDictionaryEntry;
			}

			public bool MoveNext()
			{
				OrderedDictionary<TKey, TValue> dictionary = _dictionary;
				if (_version != dictionary._version)
				{
					ThrowHelper.ThrowVersionCheckFailed();
				}
				if (_index < dictionary._count)
				{
					ref Entry reference = ref dictionary._entries[_index];
					Current = new KeyValuePair<TKey, TValue>(reference.Key, reference.Value);
					_index++;
					return true;
				}
				Current = default(KeyValuePair<TKey, TValue>);
				return false;
			}

			void IEnumerator.Reset()
			{
				if (_version != _dictionary._version)
				{
					ThrowHelper.ThrowVersionCheckFailed();
				}
				_index = 0;
				Current = default(KeyValuePair<TKey, TValue>);
			}

			readonly void IDisposable.Dispose()
			{
			}
		}

		[DebuggerTypeProxy(typeof(System.Collections.Generic.ICollectionDebugView<>))]
		[DebuggerDisplay("Count = {Count}")]
		public sealed class KeyCollection : IList<TKey>, ICollection<TKey>, IEnumerable<TKey>, IEnumerable, IReadOnlyList<TKey>, IReadOnlyCollection<TKey>, IList, ICollection
		{
			public struct Enumerator : IEnumerator<TKey>, IEnumerator, IDisposable
			{
				private OrderedDictionary<TKey, TValue>.Enumerator _enumerator;

				public TKey Current => _enumerator.Current.Key;

				object IEnumerator.Current => Current;

				internal Enumerator(OrderedDictionary<TKey, TValue> dictionary)
				{
					_enumerator = dictionary.GetEnumerator();
				}

				public bool MoveNext()
				{
					return _enumerator.MoveNext();
				}

				void IEnumerator.Reset()
				{
					System.Collections.Generic.EnumerableHelpers.Reset(ref _enumerator);
				}

				readonly void IDisposable.Dispose()
				{
				}
			}

			private readonly OrderedDictionary<TKey, TValue> _dictionary;

			public int Count => _dictionary.Count;

			bool ICollection<TKey>.IsReadOnly => true;

			bool IList.IsReadOnly => true;

			bool IList.IsFixedSize => false;

			bool ICollection.IsSynchronized => false;

			object ICollection.SyncRoot => ((ICollection)_dictionary).SyncRoot;

			TKey IList<TKey>.this[int index]
			{
				get
				{
					return _dictionary.GetAt(index).Key;
				}
				set
				{
					throw new NotSupportedException();
				}
			}

			object IList.this[int index]
			{
				get
				{
					return _dictionary.GetAt(index).Key;
				}
				set
				{
					throw new NotSupportedException();
				}
			}

			TKey IReadOnlyList<TKey>.this[int index] => _dictionary.GetAt(index).Key;

			internal KeyCollection(OrderedDictionary<TKey, TValue> dictionary)
			{
				_dictionary = dictionary;
			}

			public bool Contains(TKey key)
			{
				return _dictionary.ContainsKey(key);
			}

			bool IList.Contains(object value)
			{
				if (value is TKey key)
				{
					return Contains(key);
				}
				return false;
			}

			public void CopyTo(TKey[] array, int arrayIndex)
			{
				ThrowHelper.ThrowIfNull(array, "array");
				ThrowHelper.ThrowIfNegative(arrayIndex, "arrayIndex");
				OrderedDictionary<TKey, TValue> dictionary = _dictionary;
				int count = dictionary._count;
				if (array.Length - arrayIndex < count)
				{
					throw new ArgumentException(System.SR.Arg_ArrayPlusOffTooSmall, "array");
				}
				Entry[] entries = dictionary._entries;
				for (int i = 0; i < count; i++)
				{
					array[arrayIndex++] = entries[i].Key;
				}
			}

			void ICollection.CopyTo(Array array, int index)
			{
				ThrowHelper.ThrowIfNull(array, "array");
				if (array.Rank != 1)
				{
					throw new ArgumentException(System.SR.Arg_RankMultiDimNotSupported, "array");
				}
				if (array.GetLowerBound(0) != 0)
				{
					throw new ArgumentException(System.SR.Arg_NonZeroLowerBound, "array");
				}
				ThrowHelper.ThrowIfNegative(index, "index");
				if (array.Length - index < _dictionary.Count)
				{
					throw new ArgumentException(System.SR.Arg_ArrayPlusOffTooSmall);
				}
				if (array is TKey[] array2)
				{
					CopyTo(array2, index);
					return;
				}
				try
				{
					if (!(array is object[] array3))
					{
						throw new ArgumentException(System.SR.Argument_IncompatibleArrayType, "array");
					}
					using Enumerator enumerator = GetEnumerator();
					while (enumerator.MoveNext())
					{
						TKey current = enumerator.Current;
						array3[index++] = current;
					}
				}
				catch (ArrayTypeMismatchException)
				{
					throw new ArgumentException(System.SR.Argument_IncompatibleArrayType, "array");
				}
			}

			public Enumerator GetEnumerator()
			{
				return new Enumerator(_dictionary);
			}

			IEnumerator<TKey> IEnumerable<TKey>.GetEnumerator()
			{
				if (Count != 0)
				{
					return GetEnumerator();
				}
				return System.Collections.Generic.EnumerableHelpers.GetEmptyEnumerator<TKey>();
			}

			IEnumerator IEnumerable.GetEnumerator()
			{
				return ((IEnumerable<TKey>)this).GetEnumerator();
			}

			int IList<TKey>.IndexOf(TKey item)
			{
				return _dictionary.IndexOf(item);
			}

			void ICollection<TKey>.Add(TKey item)
			{
				throw new NotSupportedException();
			}

			void ICollection<TKey>.Clear()
			{
				throw new NotSupportedException();
			}

			void IList<TKey>.Insert(int index, TKey item)
			{
				throw new NotSupp

Microsoft.Extensions.Configuration.dll

Decompiled 2 weeks 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.FileProviders;
using Microsoft.Extensions.Internal;
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(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[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("9.0.225.6610")]
[assembly: AssemblyInformationalVersion("9.0.2+80aa709f5d919c6814726788dc6dabe23e79e672")]
[assembly: AssemblyProduct("Microsoft® .NET")]
[assembly: AssemblyTitle("Microsoft.Extensions.Configuration")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/dotnet/runtime")]
[assembly: AssemblyVersion("9.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);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static string IfNullOrWhitespace(string? argument, [CallerArgumentExpression("argument")] string paramName = "")
		{
			if (argument == null)
			{
				throw new ArgumentNullException(paramName);
			}
			if (string.IsNullOrWhiteSpace(argument))
			{
				if (argument == null)
				{
					throw new ArgumentNullException(paramName);
				}
				throw new ArgumentException(paramName, "Argument is whitespace");
			}
			return argument;
		}
	}
	internal static class SR
	{
		private static readonly bool s_usingResourceKeys = GetUsingResourceKeysSwitchValue();

		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 GetUsingResourceKeysSwitchValue()
		{
			if (!AppContext.TryGetSwitch("System.Resources.UseSystemResourceKeys", out var isEnabled))
			{
				return false;
			}
			return isEnabled;
		}

		internal static bool UsingResourceKeys()
		{
			return s_usingResourceKeys;
		}

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

		private 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.FileProviders
{
	internal sealed class EmptyDisposable : IDisposable
	{
		public static EmptyDisposable Instance { get; } = new EmptyDisposable();


		private EmptyDisposable()
		{
		}

		public void Dispose()
		{
		}
	}
}
namespace Microsoft.Extensions.Internal
{
	internal static class ChangeCallbackRegistrar
	{
		internal static IDisposable UnsafeRegisterChangeCallback<T>(Action<object?> callback, object? state, CancellationToken token, Action<T> onFailure, T onFailureState)
		{
			bool flag = false;
			if (!ExecutionContext.IsFlowSuppressed())
			{
				ExecutionContext.SuppressFlow();
				flag = true;
			}
			try
			{
				return token.Register(callback, state);
			}
			catch (ObjectDisposedException)
			{
				onFailure(onFailureState);
			}
			finally
			{
				if (flag)
				{
					ExecutionContext.RestoreFlow();
				}
			}
			return EmptyDisposable.Instance;
		}
	}
}
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(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 configuration;
			if (parentPath != null)
			{
				IConfiguration section = _config.GetSection(parentPath);
				configuration = section;
			}
			else
			{
				configuration = _config;
			}
			List<string> list = new List<string>();
			foreach (IConfigurationSection child in configuration.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 new ChainedConfigurationProvider(this);
		}
	}
	public class ConfigurationBuilder : IConfigurationBuilder
	{
		private readonly List<IConfigurationSource> _sources = new List<IConfigurationSource>();

		public IList<IConfigurationSource> Sources => _sources;

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


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

		public IConfigurationRoot Build()
		{
			List<IConfigurationProvider> list = new List<IConfigurationProvider>();
			foreach (IConfigurationSource source in _sources)
			{
				IConfigurationProvider item = source.Build(this);
				list.Add(item);
			}
			return 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;
			}
		}
	}
	[DebuggerDisplay("{DebuggerToString(),nq}")]
	[DebuggerTypeProxy(typeof(ConfigurationManagerDebugView))]
	public sealed class ConfigurationManager : IConfigurationManager, IConfiguration, IConfigurationBuilder, IConfigurationRoot, IDisposable
	{
		private sealed class ConfigurationManagerDebugView
		{
			private readonly ConfigurationManager _current;

			[DebuggerBrowsable(DebuggerBrowsableState.RootHidden)]
			public ConfigurationSectionDebugView[] Items => ConfigurationSectionDebugView.FromConfiguration(_current, _current).ToArray();

			public ConfigurationManagerDebugView(ConfigurationManager current)
			{
				_current = current;
			}
		}

		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 List<IConfigurationSource>.Enumerator 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();
			}

			IEnumerator<IConfigurationSource> IEnumerable<IConfigurationSource>.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(new MemoryConfigurationSource());
		}

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

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

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

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

		IConfigurationRoot IConfigurationBuilder.Build()
		{
			return this;
		}

		IChangeToken IConfiguration.GetReloadToken()
		{
			return _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()
		{
			Interlocked.Exchange(ref _changeToken, new ConfigurationReloadToken()).OnReload();
		}

		private void AddSource(IConfigurationSource source)
		{
			IConfigurationProvider configurationProvider = source.Build(this);
			configurationProvider.Load();
			_changeTokenRegistrations.Add(ChangeToken.OnChange(configurationProvider.GetReloadToken, RaiseChanged));
			_providerManager.AddProvider(configurationProvider);
			RaiseChanged();
		}

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

		private void DisposeRegistrations()
		{
			foreach (IDisposable changeTokenRegistration in _changeTokenRegistrations)
			{
				changeTokenRegistration.Dispose();
			}
		}

		private string DebuggerToString()
		{
			return $"Sections = {ConfigurationSectionDebugView.FromConfiguration(this, this).Count}";
		}
	}
	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(':', prefixLength);
			if (num >= 0)
			{
				return key.Substring(prefixLength, num - prefixLength);
			}
			return key.Substring(prefixLength);
		}

		public IChangeToken GetReloadToken()
		{
			return _reloadToken;
		}

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

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

		public bool ActiveChangeCallbacks { get; private set; } = true;


		public bool HasChanged => _cts.IsCancellationRequested;

		public IDisposable RegisterChangeCallback(Action<object?> callback, object? state)
		{
			return ChangeCallbackRegistrar.UnsafeRegisterChangeCallback(callback, state, _cts.Token, delegate(ConfigurationReloadToken s)
			{
				s.ActiveChangeCallbacks = false;
			}, this);
		}

		public void OnReload()
		{
			_cts.Cancel();
		}
	}
	[DebuggerDisplay("{DebuggerToString(),nq}")]
	[DebuggerTypeProxy(typeof(ConfigurationRootDebugView))]
	public class ConfigurationRoot : IConfigurationRoot, IConfiguration, IDisposable
	{
		private sealed class ConfigurationRootDebugView
		{
			private readonly ConfigurationRoot _current;

			[DebuggerBrowsable(DebuggerBrowsableState.RootHidden)]
			public ConfigurationSectionDebugView[] Items => ConfigurationSectionDebugView.FromConfiguration(_current, _current).ToArray();

			public ConfigurationRootDebugView(ConfigurationRoot current)
			{
				_current = current;
			}
		}

		private readonly IList<IConfigurationProvider> _providers;

		private readonly List<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(provider.GetReloadToken, RaiseChanged));
			}
		}

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

		public IChangeToken GetReloadToken()
		{
			return _changeToken;
		}

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

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

		private void RaiseChanged()
		{
			Interlocked.Exchange(ref _changeToken, new 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)
		{
			for (int num = providers.Count - 1; num >= 0; num--)
			{
				if (providers[num].TryGet(key, out var value))
				{
					return value;
				}
			}
			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);
			}
		}

		private string DebuggerToString()
		{
			return $"Sections = {ConfigurationSectionDebugView.FromConfiguration(this, this).Count}";
		}
	}
	[DebuggerDisplay("{DebuggerToString(),nq}")]
	[DebuggerTypeProxy(typeof(ConfigurationSectionDebugView))]
	public class ConfigurationSection : IConfigurationSection, IConfiguration
	{
		private sealed class ConfigurationSectionDebugView
		{
			private readonly ConfigurationSection _current;

			private readonly IConfigurationProvider _provider;

			public string Path => _current.Path;

			public string Key => _current.Key;

			public string Value => _current.Value;

			public IConfigurationProvider Provider => _provider;

			public List<Microsoft.Extensions.Configuration.ConfigurationSectionDebugView> Sections => Microsoft.Extensions.Configuration.ConfigurationSectionDebugView.FromConfiguration(_current, _current._root);

			public ConfigurationSectionDebugView(ConfigurationSection current)
			{
				_current = current;
				_provider = Microsoft.Extensions.Configuration.ConfigurationSectionDebugView.GetValueProvider(_current._root, _current.Path);
			}
		}

		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 _root[Path];
			}
			set
			{
				_root[Path] = value;
			}
		}

		public string? this[string key]
		{
			get
			{
				return _root[Path + ConfigurationPath.KeyDelimiter + key];
			}
			set
			{
				_root[Path + ConfigurationPath.KeyDelimiter + 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 _root.GetSection(Path + ConfigurationPath.KeyDelimiter + key);
		}

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

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

		private string DebuggerToString()
		{
			string text = "Path = " + Path;
			int count = Microsoft.Extensions.Configuration.ConfigurationSectionDebugView.FromConfiguration(this, _root).Count;
			if (count > 0)
			{
				text += $", Sections = {count}";
			}
			if (Value != null)
			{
				text = text + ", Value = " + Value;
				IConfigurationProvider valueProvider = Microsoft.Extensions.Configuration.ConfigurationSectionDebugView.GetValueProvider(_root, Path);
				if (valueProvider != null)
				{
					text += $", Provider = {valueProvider}";
				}
			}
			return text;
		}
	}
	internal sealed class ConfigurationSectionDebugView
	{
		[DebuggerBrowsable(DebuggerBrowsableState.Never)]
		private readonly IConfigurationSection _section;

		public string Path { get; }

		public string Key => _section.Key;

		public string FullPath => _section.Path;

		public string? Value => _section.Value;

		public IConfigurationProvider? Provider { get; }

		public ConfigurationSectionDebugView(IConfigurationSection section, string path, IConfigurationProvider? provider)
		{
			_section = section;
			Path = path;
			Provider = provider;
		}

		public override string ToString()
		{
			string text = "Path = " + Path;
			if (Value != null)
			{
				text = text + ", Value = " + Value;
			}
			if (Provider != null)
			{
				text += $", Provider = {Provider}";
			}
			return text;
		}

		internal static List<ConfigurationSectionDebugView> FromConfiguration(IConfiguration current, IConfigurationRoot root)
		{
			List<ConfigurationSectionDebugView> list = new List<ConfigurationSectionDebugView>();
			Stack<IConfiguration> stack = new Stack<IConfiguration>();
			stack.Push(current);
			int startIndex = ((current is IConfigurationSection configurationSection) ? (configurationSection.Path.Length + 1) : 0);
			while (stack.Count > 0)
			{
				IConfiguration configuration = stack.Pop();
				if (configuration is IConfigurationSection configurationSection2 && configuration != current)
				{
					IConfigurationProvider valueProvider = GetValueProvider(root, configurationSection2.Path);
					string path = configurationSection2.Path.Substring(startIndex);
					list.Add(new ConfigurationSectionDebugView(configurationSection2, path, valueProvider));
				}
				foreach (IConfigurationSection child in configuration.GetChildren())
				{
					stack.Push(child);
				}
			}
			list.Sort((ConfigurationSectionDebugView i1, ConfigurationSectionDebugView i2) => ConfigurationKeyComparer.Instance.Compare(i1.Path, i2.Path));
			return list;
		}

		internal static IConfigurationProvider? GetValueProvider(IConfigurationRoot root, string key)
		{
			foreach (IConfigurationProvider item in root.Providers.Reverse())
			{
				if (item.TryGet(key, out var _))
				{
					return item;
				}
			}
			return null;
		}
	}
	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<IConfigurationSection> enumerable2 = from key in (enumerable ?? root2.Providers).Aggregate(Enumerable.Empty<string>(), (IEnumerable<string> seed, IConfigurationProvider source) => source.GetChildKeys(seed, path2)).Distinct<string>(StringComparer.OrdinalIgnoreCase)
				select root2.GetSection((path2 == null) ? key : (path2 + ConfigurationPath.KeyDelimiter + 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(new MemoryConfigurationSource());
			return configurationBuilder;
		}

		public static IConfigurationBuilder AddInMemoryCollection(this IConfigurationBuilder configurationBuilder, IEnumerable<KeyValuePair<string, string?>>? initialData)
		{
			System.ThrowHelper.ThrowIfNull(configurationBuilder, "configurationBuilder");
			configurationBuilder.Add(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 new MemoryConfigurationProvider(this);
		}
	}
}

Newtonsoft.Json.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Data;
using System.Data.SqlTypes;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Dynamic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Numerics;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters;
using System.Runtime.Versioning;
using System.Security;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using System.Xml;
using System.Xml.Linq;
using Microsoft.CodeAnalysis;
using Newtonsoft.Json.Bson;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Linq.JsonPath;
using Newtonsoft.Json.Schema;
using Newtonsoft.Json.Serialization;
using Newtonsoft.Json.Utilities;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AllowPartiallyTrustedCallers]
[assembly: InternalsVisibleTo("Newtonsoft.Json.Schema, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f561df277c6c0b497d629032b410cdcf286e537c054724f7ffa0164345f62b3e642029d7a80cc351918955328c4adc8a048823ef90b0cf38ea7db0d729caf2b633c3babe08b0310198c1081995c19029bc675193744eab9d7345b8a67258ec17d112cebdbbb2a281487dceeafb9d83aa930f32103fbe1d2911425bc5744002c7")]
[assembly: InternalsVisibleTo("Newtonsoft.Json.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f561df277c6c0b497d629032b410cdcf286e537c054724f7ffa0164345f62b3e642029d7a80cc351918955328c4adc8a048823ef90b0cf38ea7db0d729caf2b633c3babe08b0310198c1081995c19029bc675193744eab9d7345b8a67258ec17d112cebdbbb2a281487dceeafb9d83aa930f32103fbe1d2911425bc5744002c7")]
[assembly: InternalsVisibleTo("Newtonsoft.Json.Dynamic, PublicKey=0024000004800000940000000602000000240000525341310004000001000100cbd8d53b9d7de30f1f1278f636ec462cf9c254991291e66ebb157a885638a517887633b898ccbcf0d5c5ff7be85a6abe9e765d0ac7cd33c68dac67e7e64530e8222101109f154ab14a941c490ac155cd1d4fcba0fabb49016b4ef28593b015cab5937da31172f03f67d09edda404b88a60023f062ae71d0b2e4438b74cc11dc9")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("9ca358aa-317b-4925-8ada-4a29e943a363")]
[assembly: CLSCompliant(true)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("Newtonsoft")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyCopyright("Copyright © James Newton-King 2008")]
[assembly: AssemblyDescription("Json.NET is a popular high-performance JSON framework for .NET")]
[assembly: AssemblyFileVersion("13.0.3.27908")]
[assembly: AssemblyInformationalVersion("13.0.3+0a2e291c0d9c0c7675d445703e51750363a549ef")]
[assembly: AssemblyProduct("Json.NET")]
[assembly: AssemblyTitle("Json.NET .NET Standard 2.0")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/JamesNK/Newtonsoft.Json")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: AssemblyVersion("13.0.0.0")]
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;
		}
	}
}
namespace System.Diagnostics.CodeAnalysis
{
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = true)]
	internal sealed class NotNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false)]
	internal sealed class NotNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public NotNullWhenAttribute(bool returnValue)
		{
			ReturnValue = returnValue;
		}
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)]
	internal sealed class MaybeNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)]
	internal sealed class AllowNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal class DoesNotReturnIfAttribute : Attribute
	{
		public bool ParameterValue { get; }

		public DoesNotReturnIfAttribute(bool parameterValue)
		{
			ParameterValue = parameterValue;
		}
	}
}
namespace Newtonsoft.Json
{
	public enum ConstructorHandling
	{
		Default,
		AllowNonPublicDefaultConstructor
	}
	public enum DateFormatHandling
	{
		IsoDateFormat,
		MicrosoftDateFormat
	}
	public enum DateParseHandling
	{
		None,
		DateTime,
		DateTimeOffset
	}
	public enum DateTimeZoneHandling
	{
		Local,
		Utc,
		Unspecified,
		RoundtripKind
	}
	public class DefaultJsonNameTable : JsonNameTable
	{
		private class Entry
		{
			internal readonly string Value;

			internal readonly int HashCode;

			internal Entry Next;

			internal Entry(string value, int hashCode, Entry next)
			{
				Value = value;
				HashCode = hashCode;
				Next = next;
			}
		}

		private static readonly int HashCodeRandomizer;

		private int _count;

		private Entry[] _entries;

		private int _mask = 31;

		static DefaultJsonNameTable()
		{
			HashCodeRandomizer = Environment.TickCount;
		}

		public DefaultJsonNameTable()
		{
			_entries = new Entry[_mask + 1];
		}

		public override string? Get(char[] key, int start, int length)
		{
			if (length == 0)
			{
				return string.Empty;
			}
			int num = length + HashCodeRandomizer;
			num += (num << 7) ^ key[start];
			int num2 = start + length;
			for (int i = start + 1; i < num2; i++)
			{
				num += (num << 7) ^ key[i];
			}
			num -= num >> 17;
			num -= num >> 11;
			num -= num >> 5;
			int num3 = Volatile.Read(ref _mask);
			int num4 = num & num3;
			for (Entry entry = _entries[num4]; entry != null; entry = entry.Next)
			{
				if (entry.HashCode == num && TextEquals(entry.Value, key, start, length))
				{
					return entry.Value;
				}
			}
			return null;
		}

		public string Add(string key)
		{
			if (key == null)
			{
				throw new ArgumentNullException("key");
			}
			int length = key.Length;
			if (length == 0)
			{
				return string.Empty;
			}
			int num = length + HashCodeRandomizer;
			for (int i = 0; i < key.Length; i++)
			{
				num += (num << 7) ^ key[i];
			}
			num -= num >> 17;
			num -= num >> 11;
			num -= num >> 5;
			for (Entry entry = _entries[num & _mask]; entry != null; entry = entry.Next)
			{
				if (entry.HashCode == num && entry.Value.Equals(key, StringComparison.Ordinal))
				{
					return entry.Value;
				}
			}
			return AddEntry(key, num);
		}

		private string AddEntry(string str, int hashCode)
		{
			int num = hashCode & _mask;
			Entry entry = new Entry(str, hashCode, _entries[num]);
			_entries[num] = entry;
			if (_count++ == _mask)
			{
				Grow();
			}
			return entry.Value;
		}

		private void Grow()
		{
			Entry[] entries = _entries;
			int num = _mask * 2 + 1;
			Entry[] array = new Entry[num + 1];
			for (int i = 0; i < entries.Length; i++)
			{
				Entry entry = entries[i];
				while (entry != null)
				{
					int num2 = entry.HashCode & num;
					Entry next = entry.Next;
					entry.Next = array[num2];
					array[num2] = entry;
					entry = next;
				}
			}
			_entries = array;
			Volatile.Write(ref _mask, num);
		}

		private static bool TextEquals(string str1, char[] str2, int str2Start, int str2Length)
		{
			if (str1.Length != str2Length)
			{
				return false;
			}
			for (int i = 0; i < str1.Length; i++)
			{
				if (str1[i] != str2[str2Start + i])
				{
					return false;
				}
			}
			return true;
		}
	}
	[Flags]
	public enum DefaultValueHandling
	{
		Include = 0,
		Ignore = 1,
		Populate = 2,
		IgnoreAndPopulate = 3
	}
	public enum FloatFormatHandling
	{
		String,
		Symbol,
		DefaultValue
	}
	public enum FloatParseHandling
	{
		Double,
		Decimal
	}
	public enum Formatting
	{
		None,
		Indented
	}
	public interface IArrayPool<T>
	{
		T[] Rent(int minimumLength);

		void Return(T[]? array);
	}
	public interface IJsonLineInfo
	{
		int LineNumber { get; }

		int LinePosition { get; }

		bool HasLineInfo();
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface, AllowMultiple = false)]
	public sealed class JsonArrayAttribute : JsonContainerAttribute
	{
		private bool _allowNullItems;

		public bool AllowNullItems
		{
			get
			{
				return _allowNullItems;
			}
			set
			{
				_allowNullItems = value;
			}
		}

		public JsonArrayAttribute()
		{
		}

		public JsonArrayAttribute(bool allowNullItems)
		{
			_allowNullItems = allowNullItems;
		}

		public JsonArrayAttribute(string id)
			: base(id)
		{
		}
	}
	[AttributeUsage(AttributeTargets.Constructor, AllowMultiple = false)]
	public sealed class JsonConstructorAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface, AllowMultiple = false)]
	public abstract class JsonContainerAttribute : Attribute
	{
		internal bool? _isReference;

		internal bool? _itemIsReference;

		internal ReferenceLoopHandling? _itemReferenceLoopHandling;

		internal TypeNameHandling? _itemTypeNameHandling;

		private Type? _namingStrategyType;

		private object[]? _namingStrategyParameters;

		public string? Id { get; set; }

		public string? Title { get; set; }

		public string? Description { get; set; }

		public Type? ItemConverterType { get; set; }

		public object[]? ItemConverterParameters { get; set; }

		public Type? NamingStrategyType
		{
			get
			{
				return _namingStrategyType;
			}
			set
			{
				_namingStrategyType = value;
				NamingStrategyInstance = null;
			}
		}

		public object[]? NamingStrategyParameters
		{
			get
			{
				return _namingStrategyParameters;
			}
			set
			{
				_namingStrategyParameters = value;
				NamingStrategyInstance = null;
			}
		}

		internal NamingStrategy? NamingStrategyInstance { get; set; }

		public bool IsReference
		{
			get
			{
				return _isReference.GetValueOrDefault();
			}
			set
			{
				_isReference = value;
			}
		}

		public bool ItemIsReference
		{
			get
			{
				return _itemIsReference.GetValueOrDefault();
			}
			set
			{
				_itemIsReference = value;
			}
		}

		public ReferenceLoopHandling ItemReferenceLoopHandling
		{
			get
			{
				return _itemReferenceLoopHandling.GetValueOrDefault();
			}
			set
			{
				_itemReferenceLoopHandling = value;
			}
		}

		public TypeNameHandling ItemTypeNameHandling
		{
			get
			{
				return _itemTypeNameHandling.GetValueOrDefault();
			}
			set
			{
				_itemTypeNameHandling = value;
			}
		}

		protected JsonContainerAttribute()
		{
		}

		protected JsonContainerAttribute(string id)
		{
			Id = id;
		}
	}
	public static class JsonConvert
	{
		public static readonly string True = "true";

		public static readonly string False = "false";

		public static readonly string Null = "null";

		public static readonly string Undefined = "undefined";

		public static readonly string PositiveInfinity = "Infinity";

		public static readonly string NegativeInfinity = "-Infinity";

		public static readonly string NaN = "NaN";

		public static Func<JsonSerializerSettings>? DefaultSettings { get; set; }

		public static string ToString(DateTime value)
		{
			return ToString(value, DateFormatHandling.IsoDateFormat, DateTimeZoneHandling.RoundtripKind);
		}

		public static string ToString(DateTime value, DateFormatHandling format, DateTimeZoneHandling timeZoneHandling)
		{
			DateTime value2 = DateTimeUtils.EnsureDateTime(value, timeZoneHandling);
			using StringWriter stringWriter = StringUtils.CreateStringWriter(64);
			stringWriter.Write('"');
			DateTimeUtils.WriteDateTimeString(stringWriter, value2, format, null, CultureInfo.InvariantCulture);
			stringWriter.Write('"');
			return stringWriter.ToString();
		}

		public static string ToString(DateTimeOffset value)
		{
			return ToString(value, DateFormatHandling.IsoDateFormat);
		}

		public static string ToString(DateTimeOffset value, DateFormatHandling format)
		{
			using StringWriter stringWriter = StringUtils.CreateStringWriter(64);
			stringWriter.Write('"');
			DateTimeUtils.WriteDateTimeOffsetString(stringWriter, value, format, null, CultureInfo.InvariantCulture);
			stringWriter.Write('"');
			return stringWriter.ToString();
		}

		public static string ToString(bool value)
		{
			if (!value)
			{
				return False;
			}
			return True;
		}

		public static string ToString(char value)
		{
			return ToString(char.ToString(value));
		}

		public static string ToString(Enum value)
		{
			return value.ToString("D");
		}

		public static string ToString(int value)
		{
			return value.ToString(null, CultureInfo.InvariantCulture);
		}

		public static string ToString(short value)
		{
			return value.ToString(null, CultureInfo.InvariantCulture);
		}

		[CLSCompliant(false)]
		public static string ToString(ushort value)
		{
			return value.ToString(null, CultureInfo.InvariantCulture);
		}

		[CLSCompliant(false)]
		public static string ToString(uint value)
		{
			return value.ToString(null, CultureInfo.InvariantCulture);
		}

		public static string ToString(long value)
		{
			return value.ToString(null, CultureInfo.InvariantCulture);
		}

		private static string ToStringInternal(BigInteger value)
		{
			return value.ToString(null, CultureInfo.InvariantCulture);
		}

		[CLSCompliant(false)]
		public static string ToString(ulong value)
		{
			return value.ToString(null, CultureInfo.InvariantCulture);
		}

		public static string ToString(float value)
		{
			return EnsureDecimalPlace(value, value.ToString("R", CultureInfo.InvariantCulture));
		}

		internal static string ToString(float value, FloatFormatHandling floatFormatHandling, char quoteChar, bool nullable)
		{
			return EnsureFloatFormat(value, EnsureDecimalPlace(value, value.ToString("R", CultureInfo.InvariantCulture)), floatFormatHandling, quoteChar, nullable);
		}

		private static string EnsureFloatFormat(double value, string text, FloatFormatHandling floatFormatHandling, char quoteChar, bool nullable)
		{
			if (floatFormatHandling == FloatFormatHandling.Symbol || (!double.IsInfinity(value) && !double.IsNaN(value)))
			{
				return text;
			}
			if (floatFormatHandling == FloatFormatHandling.DefaultValue)
			{
				if (nullable)
				{
					return Null;
				}
				return "0.0";
			}
			return quoteChar + text + quoteChar;
		}

		public static string ToString(double value)
		{
			return EnsureDecimalPlace(value, value.ToString("R", CultureInfo.InvariantCulture));
		}

		internal static string ToString(double value, FloatFormatHandling floatFormatHandling, char quoteChar, bool nullable)
		{
			return EnsureFloatFormat(value, EnsureDecimalPlace(value, value.ToString("R", CultureInfo.InvariantCulture)), floatFormatHandling, quoteChar, nullable);
		}

		private static string EnsureDecimalPlace(double value, string text)
		{
			if (double.IsNaN(value) || double.IsInfinity(value) || StringUtils.IndexOf(text, '.') != -1 || StringUtils.IndexOf(text, 'E') != -1 || StringUtils.IndexOf(text, 'e') != -1)
			{
				return text;
			}
			return text + ".0";
		}

		private static string EnsureDecimalPlace(string text)
		{
			if (StringUtils.IndexOf(text, '.') != -1)
			{
				return text;
			}
			return text + ".0";
		}

		public static string ToString(byte value)
		{
			return value.ToString(null, CultureInfo.InvariantCulture);
		}

		[CLSCompliant(false)]
		public static string ToString(sbyte value)
		{
			return value.ToString(null, CultureInfo.InvariantCulture);
		}

		public static string ToString(decimal value)
		{
			return EnsureDecimalPlace(value.ToString(null, CultureInfo.InvariantCulture));
		}

		public static string ToString(Guid value)
		{
			return ToString(value, '"');
		}

		internal static string ToString(Guid value, char quoteChar)
		{
			string text = value.ToString("D", CultureInfo.InvariantCulture);
			string text2 = quoteChar.ToString(CultureInfo.InvariantCulture);
			return text2 + text + text2;
		}

		public static string ToString(TimeSpan value)
		{
			return ToString(value, '"');
		}

		internal static string ToString(TimeSpan value, char quoteChar)
		{
			return ToString(value.ToString(), quoteChar);
		}

		public static string ToString(Uri? value)
		{
			if (value == null)
			{
				return Null;
			}
			return ToString(value, '"');
		}

		internal static string ToString(Uri value, char quoteChar)
		{
			return ToString(value.OriginalString, quoteChar);
		}

		public static string ToString(string? value)
		{
			return ToString(value, '"');
		}

		public static string ToString(string? value, char delimiter)
		{
			return ToString(value, delimiter, StringEscapeHandling.Default);
		}

		public static string ToString(string? value, char delimiter, StringEscapeHandling stringEscapeHandling)
		{
			if (delimiter != '"' && delimiter != '\'')
			{
				throw new ArgumentException("Delimiter must be a single or double quote.", "delimiter");
			}
			return JavaScriptUtils.ToEscapedJavaScriptString(value, delimiter, appendDelimiters: true, stringEscapeHandling);
		}

		public static string ToString(object? value)
		{
			if (value == null)
			{
				return Null;
			}
			return ConvertUtils.GetTypeCode(value.GetType()) switch
			{
				PrimitiveTypeCode.String => ToString((string)value), 
				PrimitiveTypeCode.Char => ToString((char)value), 
				PrimitiveTypeCode.Boolean => ToString((bool)value), 
				PrimitiveTypeCode.SByte => ToString((sbyte)value), 
				PrimitiveTypeCode.Int16 => ToString((short)value), 
				PrimitiveTypeCode.UInt16 => ToString((ushort)value), 
				PrimitiveTypeCode.Int32 => ToString((int)value), 
				PrimitiveTypeCode.Byte => ToString((byte)value), 
				PrimitiveTypeCode.UInt32 => ToString((uint)value), 
				PrimitiveTypeCode.Int64 => ToString((long)value), 
				PrimitiveTypeCode.UInt64 => ToString((ulong)value), 
				PrimitiveTypeCode.Single => ToString((float)value), 
				PrimitiveTypeCode.Double => ToString((double)value), 
				PrimitiveTypeCode.DateTime => ToString((DateTime)value), 
				PrimitiveTypeCode.Decimal => ToString((decimal)value), 
				PrimitiveTypeCode.DBNull => Null, 
				PrimitiveTypeCode.DateTimeOffset => ToString((DateTimeOffset)value), 
				PrimitiveTypeCode.Guid => ToString((Guid)value), 
				PrimitiveTypeCode.Uri => ToString((Uri)value), 
				PrimitiveTypeCode.TimeSpan => ToString((TimeSpan)value), 
				PrimitiveTypeCode.BigInteger => ToStringInternal((BigInteger)value), 
				_ => throw new ArgumentException("Unsupported type: {0}. Use the JsonSerializer class to get the object's JSON representation.".FormatWith(CultureInfo.InvariantCulture, value.GetType())), 
			};
		}

		[DebuggerStepThrough]
		public static string SerializeObject(object? value)
		{
			return SerializeObject(value, (Type?)null, (JsonSerializerSettings?)null);
		}

		[DebuggerStepThrough]
		public static string SerializeObject(object? value, Formatting formatting)
		{
			return SerializeObject(value, formatting, (JsonSerializerSettings?)null);
		}

		[DebuggerStepThrough]
		public static string SerializeObject(object? value, params JsonConverter[] converters)
		{
			JsonSerializerSettings settings = ((converters != null && converters.Length != 0) ? new JsonSerializerSettings
			{
				Converters = converters
			} : null);
			return SerializeObject(value, null, settings);
		}

		[DebuggerStepThrough]
		public static string SerializeObject(object? value, Formatting formatting, params JsonConverter[] converters)
		{
			JsonSerializerSettings settings = ((converters != null && converters.Length != 0) ? new JsonSerializerSettings
			{
				Converters = converters
			} : null);
			return SerializeObject(value, null, formatting, settings);
		}

		[DebuggerStepThrough]
		public static string SerializeObject(object? value, JsonSerializerSettings? settings)
		{
			return SerializeObject(value, null, settings);
		}

		[DebuggerStepThrough]
		public static string SerializeObject(object? value, Type? type, JsonSerializerSettings? settings)
		{
			JsonSerializer jsonSerializer = JsonSerializer.CreateDefault(settings);
			return SerializeObjectInternal(value, type, jsonSerializer);
		}

		[DebuggerStepThrough]
		public static string SerializeObject(object? value, Formatting formatting, JsonSerializerSettings? settings)
		{
			return SerializeObject(value, null, formatting, settings);
		}

		[DebuggerStepThrough]
		public static string SerializeObject(object? value, Type? type, Formatting formatting, JsonSerializerSettings? settings)
		{
			JsonSerializer jsonSerializer = JsonSerializer.CreateDefault(settings);
			jsonSerializer.Formatting = formatting;
			return SerializeObjectInternal(value, type, jsonSerializer);
		}

		private static string SerializeObjectInternal(object? value, Type? type, JsonSerializer jsonSerializer)
		{
			StringWriter stringWriter = new StringWriter(new StringBuilder(256), CultureInfo.InvariantCulture);
			using (JsonTextWriter jsonTextWriter = new JsonTextWriter(stringWriter))
			{
				jsonTextWriter.Formatting = jsonSerializer.Formatting;
				jsonSerializer.Serialize(jsonTextWriter, value, type);
			}
			return stringWriter.ToString();
		}

		[DebuggerStepThrough]
		public static object? DeserializeObject(string value)
		{
			return DeserializeObject(value, (Type?)null, (JsonSerializerSettings?)null);
		}

		[DebuggerStepThrough]
		public static object? DeserializeObject(string value, JsonSerializerSettings settings)
		{
			return DeserializeObject(value, null, settings);
		}

		[DebuggerStepThrough]
		public static object? DeserializeObject(string value, Type type)
		{
			return DeserializeObject(value, type, (JsonSerializerSettings?)null);
		}

		[DebuggerStepThrough]
		public static T? DeserializeObject<T>(string value)
		{
			return JsonConvert.DeserializeObject<T>(value, (JsonSerializerSettings?)null);
		}

		[DebuggerStepThrough]
		public static T? DeserializeAnonymousType<T>(string value, T anonymousTypeObject)
		{
			return DeserializeObject<T>(value);
		}

		[DebuggerStepThrough]
		public static T? DeserializeAnonymousType<T>(string value, T anonymousTypeObject, JsonSerializerSettings settings)
		{
			return DeserializeObject<T>(value, settings);
		}

		[DebuggerStepThrough]
		public static T? DeserializeObject<T>(string value, params JsonConverter[] converters)
		{
			return (T)DeserializeObject(value, typeof(T), converters);
		}

		[DebuggerStepThrough]
		public static T? DeserializeObject<T>(string value, JsonSerializerSettings? settings)
		{
			return (T)DeserializeObject(value, typeof(T), settings);
		}

		[DebuggerStepThrough]
		public static object? DeserializeObject(string value, Type type, params JsonConverter[] converters)
		{
			JsonSerializerSettings settings = ((converters != null && converters.Length != 0) ? new JsonSerializerSettings
			{
				Converters = converters
			} : null);
			return DeserializeObject(value, type, settings);
		}

		public static object? DeserializeObject(string value, Type? type, JsonSerializerSettings? settings)
		{
			ValidationUtils.ArgumentNotNull(value, "value");
			JsonSerializer jsonSerializer = JsonSerializer.CreateDefault(settings);
			if (!jsonSerializer.IsCheckAdditionalContentSet())
			{
				jsonSerializer.CheckAdditionalContent = true;
			}
			using JsonTextReader reader = new JsonTextReader(new StringReader(value));
			return jsonSerializer.Deserialize(reader, type);
		}

		[DebuggerStepThrough]
		public static void PopulateObject(string value, object target)
		{
			PopulateObject(value, target, null);
		}

		public static void PopulateObject(string value, object target, JsonSerializerSettings? settings)
		{
			JsonSerializer jsonSerializer = JsonSerializer.CreateDefault(settings);
			using JsonReader jsonReader = new JsonTextReader(new StringReader(value));
			jsonSerializer.Populate(jsonReader, target);
			if (settings == null || !settings.CheckAdditionalContent)
			{
				return;
			}
			while (jsonReader.Read())
			{
				if (jsonReader.TokenType != JsonToken.Comment)
				{
					throw JsonSerializationException.Create(jsonReader, "Additional text found in JSON string after finishing deserializing object.");
				}
			}
		}

		public static string SerializeXmlNode(XmlNode? node)
		{
			return SerializeXmlNode(node, Formatting.None);
		}

		public static string SerializeXmlNode(XmlNode? node, Formatting formatting)
		{
			XmlNodeConverter xmlNodeConverter = new XmlNodeConverter();
			return SerializeObject(node, formatting, xmlNodeConverter);
		}

		public static string SerializeXmlNode(XmlNode? node, Formatting formatting, bool omitRootObject)
		{
			XmlNodeConverter xmlNodeConverter = new XmlNodeConverter
			{
				OmitRootObject = omitRootObject
			};
			return SerializeObject(node, formatting, xmlNodeConverter);
		}

		public static XmlDocument? DeserializeXmlNode(string value)
		{
			return DeserializeXmlNode(value, null);
		}

		public static XmlDocument? DeserializeXmlNode(string value, string? deserializeRootElementName)
		{
			return DeserializeXmlNode(value, deserializeRootElementName, writeArrayAttribute: false);
		}

		public static XmlDocument? DeserializeXmlNode(string value, string? deserializeRootElementName, bool writeArrayAttribute)
		{
			return DeserializeXmlNode(value, deserializeRootElementName, writeArrayAttribute, encodeSpecialCharacters: false);
		}

		public static XmlDocument? DeserializeXmlNode(string value, string? deserializeRootElementName, bool writeArrayAttribute, bool encodeSpecialCharacters)
		{
			XmlNodeConverter xmlNodeConverter = new XmlNodeConverter();
			xmlNodeConverter.DeserializeRootElementName = deserializeRootElementName;
			xmlNodeConverter.WriteArrayAttribute = writeArrayAttribute;
			xmlNodeConverter.EncodeSpecialCharacters = encodeSpecialCharacters;
			return (XmlDocument)DeserializeObject(value, typeof(XmlDocument), xmlNodeConverter);
		}

		public static string SerializeXNode(XObject? node)
		{
			return SerializeXNode(node, Formatting.None);
		}

		public static string SerializeXNode(XObject? node, Formatting formatting)
		{
			return SerializeXNode(node, formatting, omitRootObject: false);
		}

		public static string SerializeXNode(XObject? node, Formatting formatting, bool omitRootObject)
		{
			XmlNodeConverter xmlNodeConverter = new XmlNodeConverter
			{
				OmitRootObject = omitRootObject
			};
			return SerializeObject(node, formatting, xmlNodeConverter);
		}

		public static XDocument? DeserializeXNode(string value)
		{
			return DeserializeXNode(value, null);
		}

		public static XDocument? DeserializeXNode(string value, string? deserializeRootElementName)
		{
			return DeserializeXNode(value, deserializeRootElementName, writeArrayAttribute: false);
		}

		public static XDocument? DeserializeXNode(string value, string? deserializeRootElementName, bool writeArrayAttribute)
		{
			return DeserializeXNode(value, deserializeRootElementName, writeArrayAttribute, encodeSpecialCharacters: false);
		}

		public static XDocument? DeserializeXNode(string value, string? deserializeRootElementName, bool writeArrayAttribute, bool encodeSpecialCharacters)
		{
			XmlNodeConverter xmlNodeConverter = new XmlNodeConverter();
			xmlNodeConverter.DeserializeRootElementName = deserializeRootElementName;
			xmlNodeConverter.WriteArrayAttribute = writeArrayAttribute;
			xmlNodeConverter.EncodeSpecialCharacters = encodeSpecialCharacters;
			return (XDocument)DeserializeObject(value, typeof(XDocument), xmlNodeConverter);
		}
	}
	public abstract class JsonConverter
	{
		public virtual bool CanRead => true;

		public virtual bool CanWrite => true;

		public abstract void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer);

		public abstract object? ReadJson(JsonReader reader, Type objectType, object? existingValue, JsonSerializer serializer);

		public abstract bool CanConvert(Type objectType);
	}
	public abstract class JsonConverter<T> : JsonConverter
	{
		public sealed override void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer)
		{
			if (!((value != null) ? (value is T) : ReflectionUtils.IsNullable(typeof(T))))
			{
				throw new JsonSerializationException("Converter cannot write specified value to JSON. {0} is required.".FormatWith(CultureInfo.InvariantCulture, typeof(T)));
			}
			WriteJson(writer, (T)value, serializer);
		}

		public abstract void WriteJson(JsonWriter writer, T? value, JsonSerializer serializer);

		public sealed override object? ReadJson(JsonReader reader, Type objectType, object? existingValue, JsonSerializer serializer)
		{
			bool flag = existingValue == null;
			if (!flag && !(existingValue is T))
			{
				throw new JsonSerializationException("Converter cannot read JSON with the specified existing value. {0} is required.".FormatWith(CultureInfo.InvariantCulture, typeof(T)));
			}
			return ReadJson(reader, objectType, flag ? default(T) : ((T)existingValue), !flag, serializer);
		}

		public abstract T? ReadJson(JsonReader reader, Type objectType, T? existingValue, bool hasExistingValue, JsonSerializer serializer);

		public sealed override bool CanConvert(Type objectType)
		{
			return typeof(T).IsAssignableFrom(objectType);
		}
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Interface | AttributeTargets.Parameter, AllowMultiple = false)]
	public sealed class JsonConverterAttribute : Attribute
	{
		private readonly Type _converterType;

		public Type ConverterType => _converterType;

		public object[]? ConverterParameters { get; }

		public JsonConverterAttribute(Type converterType)
		{
			if (converterType == null)
			{
				throw new ArgumentNullException("converterType");
			}
			_converterType = converterType;
		}

		public JsonConverterAttribute(Type converterType, params object[] converterParameters)
			: this(converterType)
		{
			ConverterParameters = converterParameters;
		}
	}
	public class JsonConverterCollection : Collection<JsonConverter>
	{
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface, AllowMultiple = false)]
	public sealed class JsonDictionaryAttribute : JsonContainerAttribute
	{
		public JsonDictionaryAttribute()
		{
		}

		public JsonDictionaryAttribute(string id)
			: base(id)
		{
		}
	}
	[Serializable]
	public class JsonException : Exception
	{
		public JsonException()
		{
		}

		public JsonException(string message)
			: base(message)
		{
		}

		public JsonException(string message, Exception? innerException)
			: base(message, innerException)
		{
		}

		public JsonException(SerializationInfo info, StreamingContext context)
			: base(info, context)
		{
		}

		internal static JsonException Create(IJsonLineInfo lineInfo, string path, string message)
		{
			message = JsonPosition.FormatMessage(lineInfo, path, message);
			return new JsonException(message);
		}
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false)]
	public class JsonExtensionDataAttribute : Attribute
	{
		public bool WriteData { get; set; }

		public bool ReadData { get; set; }

		public JsonExtensionDataAttribute()
		{
			WriteData = true;
			ReadData = true;
		}
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false)]
	public sealed class JsonIgnoreAttribute : Attribute
	{
	}
	public abstract class JsonNameTable
	{
		public abstract string? Get(char[] key, int start, int length);
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface, AllowMultiple = false)]
	public sealed class JsonObjectAttribute : JsonContainerAttribute
	{
		private MemberSerialization _memberSerialization;

		internal MissingMemberHandling? _missingMemberHandling;

		internal Required? _itemRequired;

		internal NullValueHandling? _itemNullValueHandling;

		public MemberSerialization MemberSerialization
		{
			get
			{
				return _memberSerialization;
			}
			set
			{
				_memberSerialization = value;
			}
		}

		public MissingMemberHandling MissingMemberHandling
		{
			get
			{
				return _missingMemberHandling.GetValueOrDefault();
			}
			set
			{
				_missingMemberHandling = value;
			}
		}

		public NullValueHandling ItemNullValueHandling
		{
			get
			{
				return _itemNullValueHandling.GetValueOrDefault();
			}
			set
			{
				_itemNullValueHandling = value;
			}
		}

		public Required ItemRequired
		{
			get
			{
				return _itemRequired.GetValueOrDefault();
			}
			set
			{
				_itemRequired = value;
			}
		}

		public JsonObjectAttribute()
		{
		}

		public JsonObjectAttribute(MemberSerialization memberSerialization)
		{
			MemberSerialization = memberSerialization;
		}

		public JsonObjectAttribute(string id)
			: base(id)
		{
		}
	}
	internal enum JsonContainerType
	{
		None,
		Object,
		Array,
		Constructor
	}
	internal struct JsonPosition
	{
		private static readonly char[] SpecialCharacters = new char[18]
		{
			'.', ' ', '\'', '/', '"', '[', ']', '(', ')', '\t',
			'\n', '\r', '\f', '\b', '\\', '\u0085', '\u2028', '\u2029'
		};

		internal JsonContainerType Type;

		internal int Position;

		internal string? PropertyName;

		internal bool HasIndex;

		public JsonPosition(JsonContainerType type)
		{
			Type = type;
			HasIndex = TypeHasIndex(type);
			Position = -1;
			PropertyName = null;
		}

		internal int CalculateLength()
		{
			switch (Type)
			{
			case JsonContainerType.Object:
				return PropertyName.Length + 5;
			case JsonContainerType.Array:
			case JsonContainerType.Constructor:
				return MathUtils.IntLength((ulong)Position) + 2;
			default:
				throw new ArgumentOutOfRangeException("Type");
			}
		}

		internal void WriteTo(StringBuilder sb, ref StringWriter? writer, ref char[]? buffer)
		{
			switch (Type)
			{
			case JsonContainerType.Object:
			{
				string propertyName = PropertyName;
				if (propertyName.IndexOfAny(SpecialCharacters) != -1)
				{
					sb.Append("['");
					if (writer == null)
					{
						writer = new StringWriter(sb);
					}
					JavaScriptUtils.WriteEscapedJavaScriptString(writer, propertyName, '\'', appendDelimiters: false, JavaScriptUtils.SingleQuoteCharEscapeFlags, StringEscapeHandling.Default, null, ref buffer);
					sb.Append("']");
				}
				else
				{
					if (sb.Length > 0)
					{
						sb.Append('.');
					}
					sb.Append(propertyName);
				}
				break;
			}
			case JsonContainerType.Array:
			case JsonContainerType.Constructor:
				sb.Append('[');
				sb.Append(Position);
				sb.Append(']');
				break;
			}
		}

		internal static bool TypeHasIndex(JsonContainerType type)
		{
			if (type != JsonContainerType.Array)
			{
				return type == JsonContainerType.Constructor;
			}
			return true;
		}

		internal static string BuildPath(List<JsonPosition> positions, JsonPosition? currentPosition)
		{
			int num = 0;
			if (positions != null)
			{
				for (int i = 0; i < positions.Count; i++)
				{
					num += positions[i].CalculateLength();
				}
			}
			if (currentPosition.HasValue)
			{
				num += currentPosition.GetValueOrDefault().CalculateLength();
			}
			StringBuilder stringBuilder = new StringBuilder(num);
			StringWriter writer = null;
			char[] buffer = null;
			if (positions != null)
			{
				foreach (JsonPosition position in positions)
				{
					position.WriteTo(stringBuilder, ref writer, ref buffer);
				}
			}
			currentPosition?.WriteTo(stringBuilder, ref writer, ref buffer);
			return stringBuilder.ToString();
		}

		internal static string FormatMessage(IJsonLineInfo? lineInfo, string path, string message)
		{
			if (!message.EndsWith(Environment.NewLine, StringComparison.Ordinal))
			{
				message = message.Trim();
				if (!StringUtils.EndsWith(message, '.'))
				{
					message += ".";
				}
				message += " ";
			}
			message += "Path '{0}'".FormatWith(CultureInfo.InvariantCulture, path);
			if (lineInfo != null && lineInfo.HasLineInfo())
			{
				message += ", line {0}, position {1}".FormatWith(CultureInfo.InvariantCulture, lineInfo.LineNumber, lineInfo.LinePosition);
			}
			message += ".";
			return message;
		}
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false)]
	public sealed class JsonPropertyAttribute : Attribute
	{
		internal NullValueHandling? _nullValueHandling;

		internal DefaultValueHandling? _defaultValueHandling;

		internal ReferenceLoopHandling? _referenceLoopHandling;

		internal ObjectCreationHandling? _objectCreationHandling;

		internal TypeNameHandling? _typeNameHandling;

		internal bool? _isReference;

		internal int? _order;

		internal Required? _required;

		internal bool? _itemIsReference;

		internal ReferenceLoopHandling? _itemReferenceLoopHandling;

		internal TypeNameHandling? _itemTypeNameHandling;

		public Type? ItemConverterType { get; set; }

		public object[]? ItemConverterParameters { get; set; }

		public Type? NamingStrategyType { get; set; }

		public object[]? NamingStrategyParameters { get; set; }

		public NullValueHandling NullValueHandling
		{
			get
			{
				return _nullValueHandling.GetValueOrDefault();
			}
			set
			{
				_nullValueHandling = value;
			}
		}

		public DefaultValueHandling DefaultValueHandling
		{
			get
			{
				return _defaultValueHandling.GetValueOrDefault();
			}
			set
			{
				_defaultValueHandling = value;
			}
		}

		public ReferenceLoopHandling ReferenceLoopHandling
		{
			get
			{
				return _referenceLoopHandling.GetValueOrDefault();
			}
			set
			{
				_referenceLoopHandling = value;
			}
		}

		public ObjectCreationHandling ObjectCreationHandling
		{
			get
			{
				return _objectCreationHandling.GetValueOrDefault();
			}
			set
			{
				_objectCreationHandling = value;
			}
		}

		public TypeNameHandling TypeNameHandling
		{
			get
			{
				return _typeNameHandling.GetValueOrDefault();
			}
			set
			{
				_typeNameHandling = value;
			}
		}

		public bool IsReference
		{
			get
			{
				return _isReference.GetValueOrDefault();
			}
			set
			{
				_isReference = value;
			}
		}

		public int Order
		{
			get
			{
				return _order.GetValueOrDefault();
			}
			set
			{
				_order = value;
			}
		}

		public Required Required
		{
			get
			{
				return _required.GetValueOrDefault();
			}
			set
			{
				_required = value;
			}
		}

		public string? PropertyName { get; set; }

		public ReferenceLoopHandling ItemReferenceLoopHandling
		{
			get
			{
				return _itemReferenceLoopHandling.GetValueOrDefault();
			}
			set
			{
				_itemReferenceLoopHandling = value;
			}
		}

		public TypeNameHandling ItemTypeNameHandling
		{
			get
			{
				return _itemTypeNameHandling.GetValueOrDefault();
			}
			set
			{
				_itemTypeNameHandling = value;
			}
		}

		public bool ItemIsReference
		{
			get
			{
				return _itemIsReference.GetValueOrDefault();
			}
			set
			{
				_itemIsReference = value;
			}
		}

		public JsonPropertyAttribute()
		{
		}

		public JsonPropertyAttribute(string propertyName)
		{
			PropertyName = propertyName;
		}
	}
	public abstract class JsonReader : IDisposable
	{
		protected internal enum State
		{
			Start,
			Complete,
			Property,
			ObjectStart,
			Object,
			ArrayStart,
			Array,
			Closed,
			PostValue,
			ConstructorStart,
			Constructor,
			Error,
			Finished
		}

		private JsonToken _tokenType;

		private object? _value;

		internal char _quoteChar;

		internal State _currentState;

		private JsonPosition _currentPosition;

		private CultureInfo? _culture;

		private DateTimeZoneHandling _dateTimeZoneHandling;

		private int? _maxDepth;

		private bool _hasExceededMaxDepth;

		internal DateParseHandling _dateParseHandling;

		internal FloatParseHandling _floatParseHandling;

		private string? _dateFormatString;

		private List<JsonPosition>? _stack;

		protected State CurrentState => _currentState;

		public bool CloseInput { get; set; }

		public bool SupportMultipleContent { get; set; }

		public virtual char QuoteChar
		{
			get
			{
				return _quoteChar;
			}
			protected internal set
			{
				_quoteChar = value;
			}
		}

		public DateTimeZoneHandling DateTimeZoneHandling
		{
			get
			{
				return _dateTimeZoneHandling;
			}
			set
			{
				if (value < DateTimeZoneHandling.Local || value > DateTimeZoneHandling.RoundtripKind)
				{
					throw new ArgumentOutOfRangeException("value");
				}
				_dateTimeZoneHandling = value;
			}
		}

		public DateParseHandling DateParseHandling
		{
			get
			{
				return _dateParseHandling;
			}
			set
			{
				if (value < DateParseHandling.None || value > DateParseHandling.DateTimeOffset)
				{
					throw new ArgumentOutOfRangeException("value");
				}
				_dateParseHandling = value;
			}
		}

		public FloatParseHandling FloatParseHandling
		{
			get
			{
				return _floatParseHandling;
			}
			set
			{
				if (value < FloatParseHandling.Double || value > FloatParseHandling.Decimal)
				{
					throw new ArgumentOutOfRangeException("value");
				}
				_floatParseHandling = value;
			}
		}

		public string? DateFormatString
		{
			get
			{
				return _dateFormatString;
			}
			set
			{
				_dateFormatString = value;
			}
		}

		public int? MaxDepth
		{
			get
			{
				return _maxDepth;
			}
			set
			{
				if (value <= 0)
				{
					throw new ArgumentException("Value must be positive.", "value");
				}
				_maxDepth = value;
			}
		}

		public virtual JsonToken TokenType => _tokenType;

		public virtual object? Value => _value;

		public virtual Type? ValueType => _value?.GetType();

		public virtual int Depth
		{
			get
			{
				int num = _stack?.Count ?? 0;
				if (JsonTokenUtils.IsStartToken(TokenType) || _currentPosition.Type == JsonContainerType.None)
				{
					return num;
				}
				return num + 1;
			}
		}

		public virtual string Path
		{
			get
			{
				if (_currentPosition.Type == JsonContainerType.None)
				{
					return string.Empty;
				}
				JsonPosition? currentPosition = ((_currentState != State.ArrayStart && _currentState != State.ConstructorStart && _currentState != State.ObjectStart) ? new JsonPosition?(_currentPosition) : null);
				return JsonPosition.BuildPath(_stack, currentPosition);
			}
		}

		public CultureInfo Culture
		{
			get
			{
				return _culture ?? CultureInfo.InvariantCulture;
			}
			set
			{
				_culture = value;
			}
		}

		public virtual Task<bool> ReadAsync(CancellationToken cancellationToken = default(CancellationToken))
		{
			return cancellationToken.CancelIfRequestedAsync<bool>() ?? Read().ToAsync();
		}

		public async Task SkipAsync(CancellationToken cancellationToken = default(CancellationToken))
		{
			if (TokenType == JsonToken.PropertyName)
			{
				await ReadAsync(cancellationToken).ConfigureAwait(continueOnCapturedContext: false);
			}
			if (JsonTokenUtils.IsStartToken(TokenType))
			{
				int depth = Depth;
				while (await ReadAsync(cancellationToken).ConfigureAwait(continueOnCapturedContext: false) && depth < Depth)
				{
				}
			}
		}

		internal async Task ReaderReadAndAssertAsync(CancellationToken cancellationToken)
		{
			if (!(await ReadAsync(cancellationToken).ConfigureAwait(continueOnCapturedContext: false)))
			{
				throw CreateUnexpectedEndException();
			}
		}

		public virtual Task<bool?> ReadAsBooleanAsync(CancellationToken cancellationToken = default(CancellationToken))
		{
			return cancellationToken.CancelIfRequestedAsync<bool?>() ?? Task.FromResult(ReadAsBoolean());
		}

		public virtual Task<byte[]?> ReadAsBytesAsync(CancellationToken cancellationToken = default(CancellationToken))
		{
			return cancellationToken.CancelIfRequestedAsync<byte[]>() ?? Task.FromResult(ReadAsBytes());
		}

		internal async Task<byte[]?> ReadArrayIntoByteArrayAsync(CancellationToken cancellationToken)
		{
			List<byte> buffer = new List<byte>();
			do
			{
				if (!(await ReadAsync(cancellationToken).ConfigureAwait(continueOnCapturedContext: false)))
				{
					SetToken(JsonToken.None);
				}
			}
			while (!ReadArrayElementIntoByteArrayReportDone(buffer));
			byte[] array = buffer.ToArray();
			SetToken(JsonToken.Bytes, array, updateIndex: false);
			return array;
		}

		public virtual Task<DateTime?> ReadAsDateTimeAsync(CancellationToken cancellationToken = default(CancellationToken))
		{
			return cancellationToken.CancelIfRequestedAsync<DateTime?>() ?? Task.FromResult(ReadAsDateTime());
		}

		public virtual Task<DateTimeOffset?> ReadAsDateTimeOffsetAsync(CancellationToken cancellationToken = default(CancellationToken))
		{
			return cancellationToken.CancelIfRequestedAsync<DateTimeOffset?>() ?? Task.FromResult(ReadAsDateTimeOffset());
		}

		public virtual Task<decimal?> ReadAsDecimalAsync(CancellationToken cancellationToken = default(CancellationToken))
		{
			return cancellationToken.CancelIfRequestedAsync<decimal?>() ?? Task.FromResult(ReadAsDecimal());
		}

		public virtual Task<double?> ReadAsDoubleAsync(CancellationToken cancellationToken = default(CancellationToken))
		{
			return Task.FromResult(ReadAsDouble());
		}

		public virtual Task<int?> ReadAsInt32Async(CancellationToken cancellationToken = default(CancellationToken))
		{
			return cancellationToken.CancelIfRequestedAsync<int?>() ?? Task.FromResult(ReadAsInt32());
		}

		public virtual Task<string?> ReadAsStringAsync(CancellationToken cancellationToken = default(CancellationToken))
		{
			return cancellationToken.CancelIfRequestedAsync<string>() ?? Task.FromResult(ReadAsString());
		}

		internal async Task<bool> ReadAndMoveToContentAsync(CancellationToken cancellationToken)
		{
			bool flag = await ReadAsync(cancellationToken).ConfigureAwait(continueOnCapturedContext: false);
			if (flag)
			{
				flag = await MoveToContentAsync(cancellationToken).ConfigureAwait(continueOnCapturedContext: false);
			}
			return flag;
		}

		internal Task<bool> MoveToContentAsync(CancellationToken cancellationToken)
		{
			JsonToken tokenType = TokenType;
			if (tokenType == JsonToken.None || tokenType == JsonToken.Comment)
			{
				return MoveToContentFromNonContentAsync(cancellationToken);
			}
			return AsyncUtils.True;
		}

		private async Task<bool> MoveToContentFromNonContentAsync(CancellationToken cancellationToken)
		{
			JsonToken tokenType;
			do
			{
				if (!(await ReadAsync(cancellationToken).ConfigureAwait(continueOnCapturedContext: false)))
				{
					return false;
				}
				tokenType = TokenType;
			}
			while (tokenType == JsonToken.None || tokenType == JsonToken.Comment);
			return true;
		}

		internal JsonPosition GetPosition(int depth)
		{
			if (_stack != null && depth < _stack.Count)
			{
				return _stack[depth];
			}
			return _currentPosition;
		}

		protected JsonReader()
		{
			_currentState = State.Start;
			_dateTimeZoneHandling = DateTimeZoneHandling.RoundtripKind;
			_dateParseHandling = DateParseHandling.DateTime;
			_floatParseHandling = FloatParseHandling.Double;
			_maxDepth = 64;
			CloseInput = true;
		}

		private void Push(JsonContainerType value)
		{
			UpdateScopeWithFinishedValue();
			if (_currentPosition.Type == JsonContainerType.None)
			{
				_currentPosition = new JsonPosition(value);
				return;
			}
			if (_stack == null)
			{
				_stack = new List<JsonPosition>();
			}
			_stack.Add(_currentPosition);
			_currentPosition = new JsonPosition(value);
			if (!_maxDepth.HasValue || !(Depth + 1 > _maxDepth) || _hasExceededMaxDepth)
			{
				return;
			}
			_hasExceededMaxDepth = true;
			throw JsonReaderException.Create(this, "The reader's MaxDepth of {0} has been exceeded.".FormatWith(CultureInfo.InvariantCulture, _maxDepth));
		}

		private JsonContainerType Pop()
		{
			JsonPosition currentPosition;
			if (_stack != null && _stack.Count > 0)
			{
				currentPosition = _currentPosition;
				_currentPosition = _stack[_stack.Count - 1];
				_stack.RemoveAt(_stack.Count - 1);
			}
			else
			{
				currentPosition = _currentPosition;
				_currentPosition = default(JsonPosition);
			}
			if (_maxDepth.HasValue && Depth <= _maxDepth)
			{
				_hasExceededMaxDepth = false;
			}
			return currentPosition.Type;
		}

		private JsonContainerType Peek()
		{
			return _currentPosition.Type;
		}

		public abstract bool Read();

		public virtual int? ReadAsInt32()
		{
			JsonToken contentToken = GetContentToken();
			switch (contentToken)
			{
			case JsonToken.None:
			case JsonToken.Null:
			case JsonToken.EndArray:
				return null;
			case JsonToken.Integer:
			case JsonToken.Float:
			{
				object value = Value;
				if (value is int)
				{
					return (int)value;
				}
				int num;
				if (value is BigInteger bigInteger)
				{
					num = (int)bigInteger;
				}
				else
				{
					try
					{
						num = Convert.ToInt32(value, CultureInfo.InvariantCulture);
					}
					catch (Exception ex)
					{
						throw JsonReaderException.Create(this, "Could not convert to integer: {0}.".FormatWith(CultureInfo.InvariantCulture, value), ex);
					}
				}
				SetToken(JsonToken.Integer, num, updateIndex: false);
				return num;
			}
			case JsonToken.String:
			{
				string s = (string)Value;
				return ReadInt32String(s);
			}
			default:
				throw JsonReaderException.Create(this, "Error reading integer. Unexpected token: {0}.".FormatWith(CultureInfo.InvariantCulture, contentToken));
			}
		}

		internal int? ReadInt32String(string? s)
		{
			if (StringUtils.IsNullOrEmpty(s))
			{
				SetToken(JsonToken.Null, null, updateIndex: false);
				return null;
			}
			if (int.TryParse(s, NumberStyles.Integer, Culture, out var result))
			{
				SetToken(JsonToken.Integer, result, updateIndex: false);
				return result;
			}
			SetToken(JsonToken.String, s, updateIndex: false);
			throw JsonReaderException.Create(this, "Could not convert string to integer: {0}.".FormatWith(CultureInfo.InvariantCulture, s));
		}

		public virtual string? ReadAsString()
		{
			JsonToken contentToken = GetContentToken();
			switch (contentToken)
			{
			case JsonToken.None:
			case JsonToken.Null:
			case JsonToken.EndArray:
				return null;
			case JsonToken.String:
				return (string)Value;
			default:
				if (JsonTokenUtils.IsPrimitiveToken(contentToken))
				{
					object value = Value;
					if (value != null)
					{
						string text = ((!(value is IFormattable formattable)) ? ((value is Uri uri) ? uri.OriginalString : value.ToString()) : formattable.ToString(null, Culture));
						SetToken(JsonToken.String, text, updateIndex: false);
						return text;
					}
				}
				throw JsonReaderException.Create(this, "Error reading string. Unexpected token: {0}.".FormatWith(CultureInfo.InvariantCulture, contentToken));
			}
		}

		public virtual byte[]? ReadAsBytes()
		{
			JsonToken contentToken = GetContentToken();
			switch (contentToken)
			{
			case JsonToken.StartObject:
			{
				ReadIntoWrappedTypeObject();
				byte[] array2 = ReadAsBytes();
				ReaderReadAndAssert();
				if (TokenType != JsonToken.EndObject)
				{
					throw JsonReaderException.Create(this, "Error reading bytes. Unexpected token: {0}.".FormatWith(CultureInfo.InvariantCulture, TokenType));
				}
				SetToken(JsonToken.Bytes, array2, updateIndex: false);
				return array2;
			}
			case JsonToken.String:
			{
				string text = (string)Value;
				Guid g;
				byte[] array3 = ((text.Length == 0) ? CollectionUtils.ArrayEmpty<byte>() : ((!ConvertUtils.TryConvertGuid(text, out g)) ? Convert.FromBase64String(text) : g.ToByteArray()));
				SetToken(JsonToken.Bytes, array3, updateIndex: false);
				return array3;
			}
			case JsonToken.None:
			case JsonToken.Null:
			case JsonToken.EndArray:
				return null;
			case JsonToken.Bytes:
				if (Value is Guid guid)
				{
					byte[] array = guid.ToByteArray();
					SetToken(JsonToken.Bytes, array, updateIndex: false);
					return array;
				}
				return (byte[])Value;
			case JsonToken.StartArray:
				return ReadArrayIntoByteArray();
			default:
				throw JsonReaderException.Create(this, "Error reading bytes. Unexpected token: {0}.".FormatWith(CultureInfo.InvariantCulture, contentToken));
			}
		}

		internal byte[] ReadArrayIntoByteArray()
		{
			List<byte> list = new List<byte>();
			do
			{
				if (!Read())
				{
					SetToken(JsonToken.None);
				}
			}
			while (!ReadArrayElementIntoByteArrayReportDone(list));
			byte[] array = list.ToArray();
			SetToken(JsonToken.Bytes, array, updateIndex: false);
			return array;
		}

		private bool ReadArrayElementIntoByteArrayReportDone(List<byte> buffer)
		{
			switch (TokenType)
			{
			case JsonToken.None:
				throw JsonReaderException.Create(this, "Unexpected end when reading bytes.");
			case JsonToken.Integer:
				buffer.Add(Convert.ToByte(Value, CultureInfo.InvariantCulture));
				return false;
			case JsonToken.EndArray:
				return true;
			case JsonToken.Comment:
				return false;
			default:
				throw JsonReaderException.Create(this, "Unexpected token when reading bytes: {0}.".FormatWith(CultureInfo.InvariantCulture, TokenType));
			}
		}

		public virtual double? ReadAsDouble()
		{
			JsonToken contentToken = GetContentToken();
			switch (contentToken)
			{
			case JsonToken.None:
			case JsonToken.Null:
			case JsonToken.EndArray:
				return null;
			case JsonToken.Integer:
			case JsonToken.Float:
			{
				object value = Value;
				if (value is double)
				{
					return (double)value;
				}
				double num = ((!(value is BigInteger bigInteger)) ? Convert.ToDouble(value, CultureInfo.InvariantCulture) : ((double)bigInteger));
				SetToken(JsonToken.Float, num, updateIndex: false);
				return num;
			}
			case JsonToken.String:
				return ReadDoubleString((string)Value);
			default:
				throw JsonReaderException.Create(this, "Error reading double. Unexpected token: {0}.".FormatWith(CultureInfo.InvariantCulture, contentToken));
			}
		}

		internal double? ReadDoubleString(string? s)
		{
			if (StringUtils.IsNullOrEmpty(s))
			{
				SetToken(JsonToken.Null, null, updateIndex: false);
				return null;
			}
			if (double.TryParse(s, NumberStyles.Float | NumberStyles.AllowThousands, Culture, out var result))
			{
				SetToken(JsonToken.Float, result, updateIndex: false);
				return result;
			}
			SetToken(JsonToken.String, s, updateIndex: false);
			throw JsonReaderException.Create(this, "Could not convert string to double: {0}.".FormatWith(CultureInfo.InvariantCulture, s));
		}

		public virtual bool? ReadAsBoolean()
		{
			JsonToken contentToken = GetContentToken();
			switch (contentToken)
			{
			case JsonToken.None:
			case JsonToken.Null:
			case JsonToken.EndArray:
				return null;
			case JsonToken.Integer:
			case JsonToken.Float:
			{
				bool flag = ((!(Value is BigInteger bigInteger)) ? Convert.ToBoolean(Value, CultureInfo.InvariantCulture) : (bigInteger != 0L));
				SetToken(JsonToken.Boolean, flag, updateIndex: false);
				return flag;
			}
			case JsonToken.String:
				return ReadBooleanString((string)Value);
			case JsonToken.Boolean:
				return (bool)Value;
			default:
				throw JsonReaderException.Create(this, "Error reading boolean. Unexpected token: {0}.".FormatWith(CultureInfo.InvariantCulture, contentToken));
			}
		}

		internal bool? ReadBooleanString(string? s)
		{
			if (StringUtils.IsNullOrEmpty(s))
			{
				SetToken(JsonToken.Null, null, updateIndex: false);
				return null;
			}
			if (bool.TryParse(s, out var result))
			{
				SetToken(JsonToken.Boolean, result, updateIndex: false);
				return result;
			}
			SetToken(JsonToken.String, s, updateIndex: false);
			throw JsonReaderException.Create(this, "Could not convert string to boolean: {0}.".FormatWith(CultureInfo.InvariantCulture, s));
		}

		public virtual decimal? ReadAsDecimal()
		{
			JsonToken contentToken = GetContentToken();
			switch (contentToken)
			{
			case JsonToken.None:
			case JsonToken.Null:
			case JsonToken.EndArray:
				return null;
			case JsonToken.Integer:
			case JsonToken.Float:
			{
				object value = Value;
				if (value is decimal)
				{
					return (decimal)value;
				}
				decimal num;
				if (value is BigInteger bigInteger)
				{
					num = (decimal)bigInteger;
				}
				else
				{
					try
					{
						num = Convert.ToDecimal(value, CultureInfo.InvariantCulture);
					}
					catch (Exception ex)
					{
						throw JsonReaderException.Create(this, "Could not convert to decimal: {0}.".FormatWith(CultureInfo.InvariantCulture, value), ex);
					}
				}
				SetToken(JsonToken.Float, num, updateIndex: false);
				return num;
			}
			case JsonToken.String:
				return ReadDecimalString((string)Value);
			default:
				throw JsonReaderException.Create(this, "Error reading decimal. Unexpected token: {0}.".FormatWith(CultureInfo.InvariantCulture, contentToken));
			}
		}

		internal decimal? ReadDecimalString(string? s)
		{
			if (StringUtils.IsNullOrEmpty(s))
			{
				SetToken(JsonToken.Null, null, updateIndex: false);
				return null;
			}
			if (decimal.TryParse(s, NumberStyles.Number, Culture, out var result))
			{
				SetToken(JsonToken.Float, result, updateIndex: false);
				return result;
			}
			if (ConvertUtils.DecimalTryParse(s.ToCharArray(), 0, s.Length, out result) == ParseResult.Success)
			{
				SetToken(JsonToken.Float, result, updateIndex: false);
				return result;
			}
			SetToken(JsonToken.String, s, updateIndex: false);
			throw JsonReaderException.Create(this, "Could not convert string to decimal: {0}.".FormatWith(CultureInfo.InvariantCulture, s));
		}

		public virtual DateTime? ReadAsDateTime()
		{
			switch (GetContentToken())
			{
			case JsonToken.None:
			case JsonToken.Null:
			case JsonToken.EndArray:
				return null;
			case JsonToken.Date:
				if (Value is DateTimeOffset dateTimeOffset)
				{
					SetToken(JsonToken.Date, dateTimeOffset.DateTime, updateIndex: false);
				}
				return (DateTime)Value;
			case JsonToken.String:
				return ReadDateTimeString((string)Value);
			default:
				throw JsonReaderException.Create(this, "Error reading date. Unexpected token: {0}.".FormatWith(CultureInfo.InvariantCulture, TokenType));
			}
		}

		internal DateTime? ReadDateTimeString(string? s)
		{
			if (StringUtils.IsNullOrEmpty(s))
			{
				SetToken(JsonToken.Null, null, updateIndex: false);
				return null;
			}
			if (DateTimeUtils.TryParseDateTime(s, DateTimeZoneHandling, _dateFormatString, Culture, out var dt))
			{
				dt = DateTimeUtils.EnsureDateTime(dt, DateTimeZoneHandling);
				SetToken(JsonToken.Date, dt, updateIndex: false);
				return dt;
			}
			if (DateTime.TryParse(s, Culture, DateTimeStyles.RoundtripKind, out dt))
			{
				dt = DateTimeUtils.EnsureDateTime(dt, DateTimeZoneHandling);
				SetToken(JsonToken.Date, dt, updateIndex: false);
				return dt;
			}
			throw JsonReaderException.Create(this, "Could not convert string to DateTime: {0}.".FormatWith(CultureInfo.InvariantCulture, s));
		}

		public virtual DateTimeOffset? ReadAsDateTimeOffset()
		{
			JsonToken contentToken = GetContentToken();
			switch (contentToken)
			{
			case JsonToken.None:
			case JsonToken.Null:
			case JsonToken.EndArray:
				return null;
			case JsonToken.Date:
				if (Value is DateTime dateTime)
				{
					SetToken(JsonToken.Date, new DateTimeOffset(dateTime), updateIndex: false);
				}
				return (DateTimeOffset)Value;
			case JsonToken.String:
			{
				string s = (string)Value;
				return ReadDateTimeOffsetString(s);
			}
			default:
				throw JsonReaderException.Create(this, "Error reading date. Unexpected token: {0}.".FormatWith(CultureInfo.InvariantCulture, contentToken));
			}
		}

		internal DateTimeOffset? ReadDateTimeOffsetString(string? s)
		{
			if (StringUtils.IsNullOrEmpty(s))
			{
				SetToken(JsonToken.Null, null, updateIndex: false);
				return null;
			}
			if (DateTimeUtils.TryParseDateTimeOffset(s, _dateFormatString, Culture, out var dt))
			{
				SetToken(JsonToken.Date, dt, updateIndex: false);
				return dt;
			}
			if (DateTimeOffset.TryParse(s, Culture, DateTimeStyles.RoundtripKind, out dt))
			{
				SetToken(JsonToken.Date, dt, updateIndex: false);
				return dt;
			}
			SetToken(JsonToken.String, s, updateIndex: false);
			throw JsonReaderException.Create(this, "Could not convert string to DateTimeOffset: {0}.".FormatWith(CultureInfo.InvariantCulture, s));
		}

		internal void ReaderReadAndAssert()
		{
			if (!Read())
			{
				throw CreateUnexpectedEndException();
			}
		}

		internal JsonReaderException CreateUnexpectedEndException()
		{
			return JsonReaderException.Create(this, "Unexpected end when reading JSON.");
		}

		internal void ReadIntoWrappedTypeObject()
		{
			ReaderReadAndAssert();
			if (Value != null && Value.ToString() == "$type")
			{
				ReaderReadAndAssert();
				if (Value != null && Value.ToString().StartsWith("System.Byte[]", StringComparison.Ordinal))
				{
					ReaderReadAndAssert();
					if (Value.ToString() == "$value")
					{
						return;
					}
				}
			}
			throw JsonReaderException.Create(this, "Error reading bytes. Unexpected token: {0}.".FormatWith(CultureInfo.InvariantCulture, JsonToken.StartObject));
		}

		public void Skip()
		{
			if (TokenType == JsonToken.PropertyName)
			{
				Read();
			}
			if (JsonTokenUtils.IsStartToken(TokenType))
			{
				int depth = Depth;
				while (Read() && depth < Depth)
				{
				}
			}
		}

		protected void SetToken(JsonToken newToken)
		{
			SetToken(newToken, null, updateIndex: true);
		}

		protected void SetToken(JsonToken newToken, object? value)
		{
			SetToken(newToken, value, updateIndex: true);
		}

		protected void SetToken(JsonToken newToken, object? value, bool updateIndex)
		{
			_tokenType = newToken;
			_value = value;
			switch (newToken)
			{
			case JsonToken.StartObject:
				_currentState = State.ObjectStart;
				Push(JsonContainerType.Object);
				break;
			case JsonToken.StartArray:
				_currentState = State.ArrayStart;
				Push(JsonContainerType.Array);
				break;
			case JsonToken.StartConstructor:
				_currentState = State.ConstructorStart;
				Push(JsonContainerType.Constructor);
				break;
			case JsonToken.EndObject:
				ValidateEnd(JsonToken.EndObject);
				break;
			case JsonToken.EndArray:
				ValidateEnd(JsonToken.EndArray);
				break;
			case JsonToken.EndConstructor:
				ValidateEnd(JsonToken.EndConstructor);
				break;
			case JsonToken.PropertyName:
				_currentState = State.Property;
				_currentPosition.PropertyName = (string)value;
				break;
			case JsonToken.Raw:
			case JsonToken.Integer:
			case JsonToken.Float:
			case JsonToken.String:
			case JsonToken.Boolean:
			case JsonToken.Null:
			case JsonToken.Undefined:
			case JsonToken.Date:
			case JsonToken.Bytes:
				SetPostValueState(updateIndex);
				break;
			case JsonToken.Comment:
				break;
			}
		}

		internal void SetPostValueState(bool updateIndex)
		{
			if (Peek() != 0 || SupportMultipleContent)
			{
				_currentState = State.PostValue;
			}
			else
			{
				SetFinished();
			}
			if (updateIndex)
			{
				UpdateScopeWithFinishedValue();
			}
		}

		private void UpdateScopeWithFinishedValue()
		{
			if (_currentPosition.HasIndex)
			{
				_currentPosition.Position++;
			}
		}

		private void ValidateEnd(JsonToken endToken)
		{
			JsonContainerType jsonContainerType = Pop();
			if (GetTypeForCloseToken(endToken) != jsonContainerType)
			{
				throw JsonReaderException.Create(this, "JsonToken {0} is not valid for closing JsonType {1}.".FormatWith(CultureInfo.InvariantCulture, endToken, jsonContainerType));
			}
			if (Peek() != 0 || SupportMultipleContent)
			{
				_currentState = State.PostValue;
			}
			else
			{
				SetFinished();
			}
		}

		protected void SetStateBasedOnCurrent()
		{
			JsonContainerType jsonContainerType = Peek();
			switch (jsonContainerType)
			{
			case JsonContainerType.Object:
				_currentState = State.Object;
				break;
			case JsonContainerType.Array:
				_currentState = State.Array;
				break;
			case JsonContainerType.Constructor:
				_currentState = State.Constructor;
				break;
			case JsonContainerType.None:
				SetFinished();
				break;
			default:
				throw JsonReaderException.Create(this, "While setting the reader state back to current object an unexpected JsonType was encountered: {0}".FormatWith(CultureInfo.InvariantCulture, jsonContainerType));
			}
		}

		private void SetFinished()
		{
			_currentState = ((!SupportMultipleContent) ? State.Finished : State.Start);
		}

		private JsonContainerType GetTypeForCloseToken(JsonToken token)
		{
			return token switch
			{
				JsonToken.EndObject => JsonContainerType.Object, 
				JsonToken.EndArray => JsonContainerType.Array, 
				JsonToken.EndConstructor => JsonContainerType.Constructor, 
				_ => throw JsonReaderException.Create(this, "Not a valid close JsonToken: {0}".FormatWith(CultureInfo.InvariantCulture, token)), 
			};
		}

		void IDisposable.Dispose()
		{
			Dispose(disposing: true);
			GC.SuppressFinalize(this);
		}

		protected virtual void Dispose(bool disposing)
		{
			if (_currentState != State.Closed && disposing)
			{
				Close();
			}
		}

		public virtual void Close()
		{
			_currentState = State.Closed;
			_tokenType = JsonToken.None;
			_value = null;
		}

		internal void ReadAndAssert()
		{
			if (!Read())
			{
				throw JsonSerializationException.Create(this, "Unexpected end when reading JSON.");
			}
		}

		internal void ReadForTypeAndAssert(JsonContract? contract, bool hasConverter)
		{
			if (!ReadForType(contract, hasConverter))
			{
				throw JsonSerializationException.Create(this, "Unexpected end when reading JSON.");
			}
		}

		internal bool ReadForType(JsonContract? contract, bool hasConverter)
		{
			if (hasConverter)
			{
				return Read();
			}
			switch (contract?.InternalReadType ?? ReadType.Read)
			{
			case ReadType.Read:
				return ReadAndMoveToContent();
			case ReadType.ReadAsInt32:
				ReadAsInt32();
				break;
			case ReadType.ReadAsInt64:
			{
				bool result = ReadAndMoveToContent();
				if (TokenType == JsonToken.Undefined)
				{
					throw JsonReaderException.Create(this, "An undefined token is not a valid {0}.".FormatWith(CultureInfo.InvariantCulture, contract?.UnderlyingType ?? typeof(long)));
				}
				return result;
			}
			case ReadType.ReadAsDecimal:
				ReadAsDecimal();
				break;
			case ReadType.ReadAsDouble:
				ReadAsDouble();
				break;
			case ReadType.ReadAsBytes:
				ReadAsBytes();
				break;
			case ReadType.ReadAsBoolean:
				ReadAsBoolean();
				break;
			case ReadType.ReadAsString:
				ReadAsString();
				break;
			case ReadType.ReadAsDateTime:
				ReadAsDateTime();
				break;
			case ReadType.ReadAsDateTimeOffset:
				ReadAsDateTimeOffset();
				break;
			default:
				throw new ArgumentOutOfRangeException();
			}
			return TokenType != JsonToken.None;
		}

		internal bool ReadAndMoveToContent()
		{
			if (Read())
			{
				return MoveToContent();
			}
			return false;
		}

		internal bool MoveToContent()
		{
			JsonToken tokenType = TokenType;
			while (tokenType == JsonToken.None || tokenType == JsonToken.Comment)
			{
				if (!Read())
				{
					return false;
				}
				tokenType = TokenType;
			}
			return true;
		}

		private JsonToken GetContentToken()
		{
			JsonToken tokenType;
			do
			{
				if (!Read())
				{
					SetToken(JsonToken.None);
					return JsonToken.None;
				}
				tokenType = TokenType;
			}
			while (tokenType == JsonToken.Comment);
			return tokenType;
		}
	}
	[Serializable]
	public class JsonReaderException : JsonException
	{
		public int LineNumber { get; }

		public int LinePosition { get; }

		public string? Path { get; }

		public JsonReaderException()
		{
		}

		public JsonReaderException(string message)
			: base(message)
		{
		}

		public JsonReaderException(string message, Exception innerException)
			: base(message, innerException)
		{
		}

		public JsonReaderException(SerializationInfo info, StreamingContext context)
			: base(info, context)
		{
		}

		public JsonReaderException(string message, string path, int lineNumber, int linePosition, Exception? innerException)
			: base(message, innerException)
		{
			Path = path;
			LineNumber = lineNumber;
			LinePosition = linePosition;
		}

		internal static JsonReaderException Create(JsonReader reader, string message)
		{
			return Create(reader, message, null);
		}

		internal static JsonReaderException Create(JsonReader reader, string message, Exception? ex)
		{
			return Create(reader as IJsonLineInfo, reader.Path, message, ex);
		}

		internal static JsonReaderException Create(IJsonLineInfo? lineInfo, string path, string message, Exception? ex)
		{
			message = JsonPosition.FormatMessage(lineInfo, path, message);
			int lineNumber;
			int linePosition;
			if (lineInfo != null && lineInfo.HasLineInfo())
			{
				lineNumber = lineInfo.LineNumber;
				linePosition = lineInfo.LinePosition;
			}
			else
			{
				lineNumber = 0;
				linePosition = 0;
			}
			return new JsonReaderException(message, path, lineNumber, linePosition, ex);
		}
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false)]
	public sealed class JsonRequiredAttribute : Attribute
	{
	}
	[Serializable]
	public class JsonSerializationException : JsonException
	{
		public int LineNumber { get; }

		public int LinePosition { get; }

		public string? Path { get; }

		public JsonSerializationException()
		{
		}

		public JsonSerializationException(string message)
			: base(message)
		{
		}

		public JsonSerializationException(string message, Exception innerException)
			: base(message, innerException)
		{
		}

		public JsonSerializationException(SerializationInfo info, StreamingContext context)
			: base(info, context)
		{
		}

		public JsonSerializationException(string message, string path, int lineNumber, int linePosition, Exception? innerException)
			: base(message, innerException)
		{
			Path = path;
			LineNumber = lineNumber;
			LinePosition = linePosition;
		}

		internal static JsonSerializationException Create(JsonReader reader, string message)
		{
			return Create(reader, message, null);
		}

		internal static JsonSerializationException Create(JsonReader reader, string message, Exception? ex)
		{
			return Create(reader as IJsonLineInfo, reader.Path, message, ex);
		}

		internal static JsonSerializationException Create(IJsonLineInfo? lineInfo, string path, string message, Exception? ex)
		{
			message = JsonPosition.FormatMessage(lineInfo, path, message);
			int lineNumber;
			int linePosition;
			if (lineInfo != null && lineInfo.HasLineInfo())
			{
				lineNumber = lineInfo.LineNumber;
				linePosition = lineInfo.LinePosition;
			}
			else
			{
				lineNumber = 0;
				linePosition = 0;
			}
			return new JsonSerializationException(message, path, lineNumber, linePosition, ex);
		}
	}
	public class JsonSerializer
	{
		internal TypeNameHandling _typeNameHandling;

		internal TypeNameAssemblyFormatHandling _typeNameAssemblyFormatHandling;

		internal PreserveReferencesHandling _preserveReferencesHandling;

		internal ReferenceLoopHandling _referenceLoopHandling;

		internal MissingMemberHandling _missingMemberHandling;

		internal ObjectCreationHandling _objectCreationHandling;

		internal NullValueHandling _nullValueHandling;

		internal DefaultValueHandling _defaultValueHandling;

		internal ConstructorHandling _constructorHandling;

		internal MetadataPropertyHandling _metadataPropertyHandling;

		internal JsonConverterCollection? _converters;

		internal IContractResolver _contractResolver;

		internal ITraceWriter? _traceWriter;

		internal IEqualityComparer? _equalityComparer;

		internal ISerializationBinder _serializationBinder;

		internal StreamingContext _context;

		private IReferenceResolver? _referenceResolver;

		private Formatting? _formatting;

		private DateFormatHandling? _dateFormatHandling;

		private DateTimeZoneHandling? _dateTimeZoneHandling;

		private DateParseHandling? _dateParseHandling;

		private FloatFormatHandling? _floatFormatHandling;

		private FloatParseHandling? _floatParseHandling;

		private StringEscapeHandling? _stringEscapeHandling;

		private CultureInfo _culture;

		private int? _maxDepth;

		private bool _maxDepthSet;

		private bool? _checkAdditionalContent;

		private string? _dateFormatString;

		private bool _dateFormatStringSet;

		public virtual IReferenceResolver? ReferenceResolver
		{
			get
			{
				return GetReferenceResolver();
			}
			set
			{
				if (value == null)
				{
					throw new ArgumentNullException("value", "Reference resolver cannot be null.");
				}
				_referenceResolver = value;
			}
		}

		[Obsolete("Binder is obsolete. Use SerializationBinder instead.")]
		public virtual SerializationBinder Binder
		{
			get
			{
				if (_serializationBinder is SerializationBinder result)
				{
					return result;
				}
				if (_serializationBinder is SerializationBinderAdapter serializationBinderAdapter)
				{
					return serializationBinderAdapter.SerializationBinder;
				}
				throw new InvalidOperationException("Cannot get SerializationBinder because an ISerializationBinder was previously set.");
			}
			set
			{
				if (value == null)
				{
					throw new ArgumentNullException("value", "Serialization binder cannot be null.");
				}
				_serializationBinder = (value as ISerializationBinder) ?? new SerializationBinderAdapter(value);
			}
		}

		public virtual ISerializationBinder SerializationBinder
		{
			get
			{
				return _serializationBinder;
			}
			set
			{
				if (value == null)
				{
					throw new ArgumentNullException("value", "Serialization binder cannot be null.");
				}
				_serializationBinder = value;
			}
		}

		public virtual ITraceWriter? TraceWriter
		{
			get
			{
				return _traceWriter;
			}
			set
			{
				_traceWriter = value;
			}
		}

		public virtual IEqualityComparer? EqualityComparer
		{
			get
			{
				return _equalityComparer;
			}
			set
			{
				_equalityComparer = value;
			}
		}

		public virtual TypeNameHandling TypeNameHandling
		{
			get
			{
				return _typeNameHandling;
			}
			set
			{
				if (value < TypeNameHandling.None || value > TypeNameHandling.Auto)
				{
					throw new ArgumentOutOfRangeException("value");
				}
				_typeNameHandling = value;
			}
		}

		[Obsolete("TypeNameAssemblyFormat is obsolete. Use TypeNameAssemblyFormatHandling instead.")]
		public virtual FormatterAssemblyStyle TypeNameAssemblyFormat
		{
			get
			{
				return (FormatterAssemblyStyle)_typeNameAssemblyFormatHandling;
			}
			set
			{
				if (value < FormatterAssemblyStyle.Simple || value > FormatterAssemblyStyle.Full)
				{
					throw new ArgumentOutOfRangeException("value");
				}
				_typeNameAssemblyFormatHandling = (TypeNameAssemblyFormatHandling)value;
			}
		}

		public virtual TypeNameAssemblyFormatHandling TypeNameAssemblyFormatHandling
		{
			get
			{
				return _typeNameAssemblyFormatHandling;
			}
			set
			{
				if (value < TypeNameAssemblyFormatHandling.Simple || value > TypeNameAssemblyFormatHandling.Full)
				{
					throw new ArgumentOutOfRangeException("value");
				}
				_typeNameAssemblyFormatHandling = value;
			}
		}

		public virtual PreserveReferencesHandling PreserveReferencesHandling
		{
			get
			{
				return _preserveReferencesHandling;
			}
			set
			{
				if (value < PreserveReferencesHandling.None || value > PreserveReferencesHandling.All)
				{
					throw new ArgumentOutOfRangeException("value");
				}
				_preserveReferencesHandling = value;
			}
		}

		public virtual ReferenceLoopHandling ReferenceLoopHandling
		{
			get
			{
				return _referenceLoopHandling;
			}
			set
			{
				if (value < ReferenceLoopHandling.Error || value > ReferenceLoopHandling.Serialize)
				{
					throw new ArgumentOutOfRangeException("value");
				}
				_referenceLoopHandling = value;
			}
		}

		public virtual MissingMemberHandling MissingMemberHandling
		{
			get
			{
				return _missingMemberHandling;
			}
			set
			{
				if (value < MissingMemberHandling.Ignore || value > MissingMemberHandling.Error)
				{
					throw new ArgumentOutOfRangeException("value");
				}
				_missingMemberHandling = value;
			}
		}

		public virtual NullValueHandling NullValueHandling
		{
			get
			{
				return _nullValueHandling;
			}
			set
			{
				if (value < NullValueHandling.Include || value > NullValueHandling.Ignore)
				{
					throw new ArgumentOutOfRangeException("value");
				}
				_nullValueHandling = value;
			}
		}

		public virtual DefaultValueHandling DefaultValueHandling
		{
			get
			{
				return _defaultValueHandling;
			}
			set
			{
				if (value < DefaultValueHandling.Include || value > DefaultValueHandling.IgnoreAndPopulate)
				{
					throw new ArgumentOutOfRangeException("value");
				}
				_defaultValueHandling = value;
			}
		}

		public virtual ObjectCreationHandling ObjectCreationHandling
		{
			get
			{
				return _objectCreationHandling;
			}
			set
			{
				if (value < ObjectCreationHandling.Auto || value > ObjectCreationHandling.Replace)
				{
					throw new ArgumentOutOfRangeException("value");
				}
				_objectCreationHandling = value;
			}
		}

		public virtual ConstructorHandling ConstructorHandling
		{
			get
			{
				return _constructorHandling;
			}
			set
			{
				if (value < ConstructorHandling.Default || value > ConstructorHandling.AllowNonPublicDefaultConstructor)
				{
					throw new ArgumentOutOfRangeException("value");
				}
				_constructorHandling = value;
			}
		}

		public virtual MetadataPropertyHandling MetadataPropertyHandling
		{
			get
			{
				return _metadataPropertyHandling;
			}
			set
			{
				if (value < MetadataPropertyHandling.Default || value > MetadataPropertyHandling.Ignore)
				{
					throw new ArgumentOutOfRangeException("value");
				}
				_metadataPropertyHandling = value;
			}
		}

		public virtual JsonConverterCollection Converters
		{
			get
			{
				if (_converters == null)
				{
					_converters = new JsonConverterCollection();
				}
				return _converters;
			}
		}

		public virtual IContractResolver ContractResolver
		{
			get
			{
				return _contractResolver;
			}
			set
			{
				_contractResolver = value ?? DefaultContractResolver.Instance;
			}
		}

		public virtual StreamingContext Context
		{
			get
			{
				return _context;
			}
			set
			{
				_context = value;
			}
		}

		public virtual Formatting Formatting
		{
			get
			{
				return _formatting.GetValueOrDefault();
			}
			set
			{
				_formatting = value;
			}
		}

		public virtual DateFormatHandling DateFormatHandling
		{
			get
			{
				return _dateFormatHandling.GetValueOrDefault();
			}
			set
			{
				_dateFormatHandling = value;
			}
		}

		public virtual DateTimeZoneHandling DateTimeZoneHandling
		{
			get
			{
				return _dateTimeZoneHandling ?? DateTimeZoneHandling.RoundtripKind;
			}
			set
			{
				_dateTimeZoneHandling = value;
			}
		}

		public virtual DateParseHandling DateParseHandling
		{
			get
			{
				return _dateParseHandling ?? DateParseHandling.DateTime;
			}
			set
			{
				_dateParseHandling = value;
			}
		}

		public virtual FloatParseHandling FloatParseHandling
		{
			get
			{
				return _floatParseHandling.GetValueOrDefault();
			}
			set
			{
				_floatParseHandling = value;
			}
		}

		public virtual FloatFormatHandling FloatFormatHandling
		{
			get
			{
				return _floatFormatHandling.GetValueOrDefault();
			}
			set
			{
				_floatFormatHandling = value;
			}
		}

		public virtual StringEscapeHandling StringEscapeHandling
		{
			get
			{
				return _stringEscapeHandling.GetValueOrDefault();
			}
			set
			{
				_stringEscapeHandling = value;
			}
		}

		public virtual string DateFormatString
		{
			get
			{
				return _dateFormatString ?? "yyyy'-'MM'-'dd'T'HH':'mm':'ss.FFFFFFFK";
			}
			set
			{
				_dateFormatString = value;
				_dateFormatStringSet = true;
			}
		}

		public virtual CultureInfo Culture
		{
			get
			{
				return _culture ?? JsonSerializerSettings.DefaultCulture;
			}
			set
			{
				_culture = value;
			}
		}

		public virtual int? MaxDepth
		{
			get
			{
				return _maxDepth;
			}
			set
			{
				if (value <= 0)
				{
					throw new ArgumentException("Value must be positive.", "value");
				}
				_maxDepth = value;
				_maxDepthSet = true;
			}
		}

		public virtual bool CheckAdditionalContent
		{
			get
			{
				return _checkAdditionalContent.GetValueOrDefault();
			}
			set
			{
				_checkAdditionalContent = value;
			}
		}

		public virtual event EventHandler<Newtonsoft.Json.Serialization.ErrorEventArgs>? Error;

		internal bool IsCheckAdditionalContentSet()
		{
			return _checkAdditionalContent.HasValue;
		}

		public JsonSerializer()
		{
			_referenceLoopHandling = ReferenceLoopHandling.Error;
			_missingMemberHandling = MissingMemberHandling.Ignore;
			_nullValueHandling = NullValueHandling.Include;
			_defaultValueHandling = DefaultValueHandling.Include;
			_objectCreationHandling = ObjectCreationHandling.Auto;
			_preserveReferencesHandling = PreserveReferencesHandling.None;
			_constructorHandling = ConstructorHandling.Default;
			_typeNameHandling = TypeNameHandling.None;
			_metadataPropertyHandling = MetadataPropertyHandling.Default;
			_context = JsonSerializerSettings.DefaultContext;
			_serializationBinder = DefaultSerializationBinder.Instance;
			_culture = JsonSerializerSettings.DefaultCulture;
			_contractResolver = DefaultContractResolver.Instance;
		}

		public static JsonSerializer Create()
		{
			return new JsonSerializer();
		}

		public static JsonSerializer Create(JsonSerializerSettings? settings)
		{
			JsonSerializer jsonSerializer = Create();
			if (settings != null)
			{
				ApplySerializerSettings(jsonSerializer, settings);
			}
			return jsonSerializer;
		}

		public static JsonSerializer CreateDefault()
		{
			return Create(JsonConvert.DefaultSettings?.Invoke());
		}

		public static JsonSerializer CreateDefault(JsonSerializerSettings? settings)
		{
			JsonSerializer jsonSerializer = CreateDefault();
			if (settings != null)
			{
				ApplySerializerSettings(jsonSerializer, settings);
			}
			return jsonSerializer;
		}

		private static void ApplySerializerSettings(JsonSerializer serializer, JsonSerializerSettings settings)
		{
			if (!CollectionUtils.IsNullOrEmpty(settings.Converters))
			{
				for (int i = 0; i < settings.Converters.Count; i++)
				{
					serializer.Converters.Insert(i, settings.Converters[i]);
				}
			}
			if (settings._typeNameHandling.HasValue)
			{
				serializer.TypeNameHandling = settings.TypeNameHandling;
			}
			if (settings._metadataPropertyHandling.HasValue)
			{
				serializer.MetadataPropertyHandling = settings.MetadataPropertyHandling;
			}
			if (settings._typeNameAssemblyFormatHandling.HasValue)
			{
				serializer.TypeNameAssemblyFormatHandling = settings.TypeNameAssemblyFormatHandling;
			}
			if (settings._preserveReferencesHandling.HasValue)
			{
				serializer.PreserveReferencesHandling = settings.PreserveReferencesHandling;
			}
			if (settings._referenceLoopHandling.HasValue)
			{
				serializer.ReferenceLoopHandling = settings.ReferenceLoopHandling;
			}
			if (settings._missingMemberHandling.HasValue)
			{
				serializer.MissingMemberHandling = settings.MissingMemberHandling;
			}
			if (settings._objectCreationHandling.HasValue)
			{
				serializer.ObjectCreationHandling = settings.ObjectCreationHandling;
			}
			if (settings._nullValueHandling.HasValue)
			{
				serializer.NullValueHandling = settings.NullValueHandling;
			}
			if (settings._defaultValueHandling.HasValue)
			{
				serializer.DefaultValueHandling = settings.DefaultValueHandling;
			}
			if (settings._constructorHandling.HasValue)
			{
				serializer.ConstructorHandling = settings.ConstructorHandling;
			}
			if (settings._context.HasValue)
			{
				serializer.Context = settings.Context;
			}
			if (settings._checkAdditionalContent.HasValue)
			{
				serializer._checkAdditionalContent = settings._checkAdditionalContent;
			}
			if (settings.Error != null)
			{
				serializer.Error += settings.Error;
			}
			if (settings.ContractResolver != null)
			{
				serializer.ContractResolver = settings.ContractResolver;
			}
			if (settings.ReferenceResolverProvider != null)
			{
				serializer.ReferenceResolver = settings.ReferenceResolverProvider();
			}
			if (settings.TraceWriter != null)
			{
				serializer.TraceWriter = settings.TraceWriter;
			}
			if (settings.EqualityComparer != null)
			{
				serializer.EqualityComparer = settings.EqualityComparer;
			}
			if (settings.SerializationBinder != null)
			{
				serializer.SerializationBinder = settings.SerializationBinder;
			}
			if (settings._formatting.HasValue)
			{
				serializer._formatting = settings._formatting;
			}
			if (settings._dateFormatHandling.HasValue)
			{
				serializer._dateFormatHandling = settings._dateFormatHandling;
			}
			if (settings._dateTimeZoneHandling.HasValue)
			{
				serializer._dateTimeZoneHandling = settings._dateTimeZoneHandling;
			}
			if (settings._dateParseHandling.HasValue)
			{
				serializer._dateParseHandling = settings._dateParseHandling;
			}
			if (settings._dateFormatStringSet)
			{
				serializer._dateFormatString = settings._dateFormatString;
				serializer._dateFormatStringSet = settings._dateFormatStringSet;
			}
			if (settings._floatFormatHandling.HasValue)
			{
				serializer._floatFormatHandling = settings._floatFormatHandling;
			}
			if (settings._floatParseHandling.HasValue)
			{
				serializer._floatParseHandling = settings._floatParseHandling;
			}
			if (settings._stringEscapeHandling.HasValue)
			{
				serializer._stringEscapeHandling = settings._stringEscapeHandling;
			}
			if (settings._culture != null)
			{
				serializer._culture = settings._culture;
			}
			if (settings._maxDepthSet)
			{
				serializer._maxDepth = settings._maxDepth;
				serializer._maxDepthSet = settings._maxDepthSet;
			}
		}

		[DebuggerStepThrough]
		public void Populate(TextReader reader, object target)
		{
			Populate(new JsonTextReader(reader), target);
		}

		[DebuggerStepThrough]
		public void Populate(JsonReader reader, object target)
		{
			PopulateInternal(reader, target);
		}

		internal virtual void PopulateInternal(JsonReader reader, object target)
		{
			ValidationUtils.ArgumentNotNull(reader, "reader");
			ValidationUtils.ArgumentNotNull(target, "target");
			SetupReader(reader, out CultureInfo previousCulture, out DateTimeZoneHandling? previousDateTimeZoneHandling, out DateParseHandling? previousDateParseHandling, out FloatParseHandling? previousFloatParseHandling, out int? previousMaxDepth, out string previousDateFormatString);
			TraceJsonReader traceJsonReader = ((TraceWriter != null && TraceWriter.LevelFilter >= TraceLevel.Verbose) ? CreateTraceJsonReader(reader) : null);
			new JsonSerializerInternalReader(this).Populate(traceJsonReader ?? reader, target);
			if (traceJsonReader != null)
			{
				TraceWriter.Trace(TraceLevel.Verbose, traceJsonReader.GetDeserializedJsonMessage(), null);
			}
			ResetReader(reader, previousCulture, previousDateTimeZoneHandling, previousDateParseHandling, previousFloatParseHandling, previousMaxDepth, previousDateFormatString);
		}

		[DebuggerStepThrough]
		public object? Deserialize(JsonReader reader)
		{
			return Deserialize(reader, null);
		}

		[DebuggerStepThrough]
		public object? Deserialize(TextReader reader, Type objectType)
		{
			return Deserialize(new JsonTextReader(reader), objectType);
		}

		[DebuggerStepThrough]
		public T? Deserialize<T>(JsonReader reader)
		{
			return (T)Deserialize(reader, typeof(T));
		}

		[DebuggerStepThrough]
		public object? Deserialize(JsonReader reader, Type? objectType)
		{
			return DeserializeInternal(reader, objectType);
		}

		internal virtual object? DeserializeInternal(JsonReader reader, Type? objectType)
		{
			ValidationUtils.ArgumentNotNull(reader, "reader");
			SetupReader(reader, out CultureInfo previousCulture, out DateTimeZoneHandling? previousDateTimeZoneHandling, out DateParseHandling? previousDateParseHandling, out FloatParseHandling? previousFloatParseHandling, out int? previousMaxDepth, out string previousDateFormatString);
			TraceJsonReader traceJsonReader = ((TraceWriter != null && TraceWriter.LevelFilter >= TraceLevel.Verbose) ? CreateTraceJsonReader(reader) : null);
			object? result = new JsonSerializerInternalReader(this).Deserialize(traceJsonReader ?? reader, objectType, CheckAdditionalContent);
			if (traceJsonReader != null)
			{
				TraceWriter.Trace(TraceLevel.Verbose, traceJsonReader.GetDeserializedJsonMessage(), null);
			}
			ResetReader(reader, previousCulture, previousDateTimeZoneHandling, previousDateParseHandling, previousFloatParseHandling, previousMaxDepth, previousDateFormatString);
			return result;
		}

		internal void SetupReader(JsonReader reader, out CultureInfo? previousCulture, out DateTimeZoneHandling? previousDateTimeZoneHandling, out DateParseHandling? previousDateParseHandling, out FloatParseHandling? previousFloatParseHandling, out int? previousMaxDepth, out string? previousDateFormatString)
		{
			if (_culture != null && !_culture.Equals(reader.Culture))
			{
				previousCulture = reader.Culture;
				reader.Culture = _culture;
			}
			else
			{
				previousCulture = null;
			}
			if (_dateTimeZoneHandling.HasValue && reader.DateTimeZoneHandling != _dateTimeZoneHandling)
			{
				previousDateTimeZoneHandling = reader.DateTimeZoneHandling;
				reader.DateTimeZoneHandling = _dateTimeZoneHandling.GetValueOrDefault();
			}
			else
			{
				previousDateTimeZoneHandling = null;
			}
			if (_dateParseHandling.HasValue && reader.DateParseHandling != _dateParseHandling)
			{
				previousDateParseHandling = reader.DateParseHandling;
				reader.DateParseHandling = _dateParseHandling.GetValueOrDefault();
			}
			else
			{
				previousDateParseHandling = null;
			}
			if (_floatParseHandling.HasValue && reader.FloatParseHandling != _floatParseHandling)
			{
				previousFloatParseHandling = reader.FloatParseHandling;
				reader.FloatParseHandling = _floatParseHandling.GetValueOrDefault();
			}
			else
			{
				previousFloatParseHandling = null;
			}
			if (_maxDepthSet && reader.MaxDepth != _maxDepth)
			{
				previousMaxDepth = reader.MaxDepth;
				reader.MaxDepth = _maxDepth;
			}
			else
			{
				previousMaxDepth = null;
			}
			if (_dateFormatStringSet && reader.DateFormatString != _dateFormatString)
			{
				previousDateFormatString = reader.DateFormatString;
				reader.DateFormatString = _dateFormatString;
			}
			else
			{
				previousDateFormatString = null;
			}
			if (reader is JsonTextReader jsonTextReader && jsonTextReader.PropertyNameTable == null && _contractResolver is DefaultContractResolver defaultContractResolver)
			{
				jsonTextReader.PropertyNameTable = defaultContractResolver.GetNameTable();
			}
		}

		private void ResetReader(JsonReader reader, CultureInfo? previousCulture, DateTimeZoneHandling? previousDateTimeZoneHandling, DateParseHandling? previousDateParseHandling, FloatParseHandling? previousFloatParseHandling, int? previousMaxDepth, string? previousDateFormatString)
		{
			if (previousCulture != null)
			{
				reader.Culture = previousCulture;
			}
			if (previousDateTimeZoneHandling.HasValue)
			{
				reader.DateTimeZoneHandling = previousDateTimeZoneHandling.GetValueOrDefault();
			}
			if (previousDateParseHandling.HasValue)
			{
				reader.DateParseHandling = previousDateParseHandling.GetValueOrDefault();
			}
			if (previousFloatParseHandling.HasValue)
			{
				reader.FloatParseHandling = previousFloatParseHandling.GetValueOrDefault();
			}
			if (_maxDepthSet)
			{
				reader.MaxDepth = previousMaxDepth;
			}
			if (_dateFormatStringSet)
			{
				reader.DateFormatString = previousDateFormatString;
			}
			if (reader is JsonTextReader jsonTextReader && jsonTextReader.PropertyNameTable != null && _contractResolver is DefaultContractResolver defaultContractResolver && jsonTextReader.PropertyNameTable == defaultContractResolver.GetNameTable())
			{
				jsonTextReader.PropertyNameTable = null;
			}
		}

		public void Serialize(TextWriter textWriter, object? value)
		{
			Serialize(new JsonTextWriter(textWriter), value);
		}

		public void Serialize(JsonWriter jsonWriter, object? value, Type? objectType)
		{
			SerializeInternal(jsonWriter, value, objectType);
		}

		public void Serialize(TextWriter textWriter, object? value, Type objectType)
		{
			Serialize(new JsonTextWriter(textWriter), value, objectType);
		}

		public void Serialize(JsonWriter jsonWriter, object? value)
		{
			SerializeInternal(jsonWriter, value, null);
		}

		private TraceJsonReader CreateTraceJsonReader(JsonReader reader)
		{
			TraceJsonReader traceJsonReader = new TraceJsonReader(reader);
			if (reader.TokenType != 0)
			{
				traceJsonReader.WriteCurrentToken();
			}
			return traceJsonReader;
		}

		internal virtual void SerializeInternal(JsonWriter jsonWriter, object? value, Type? objectType)
		{
			ValidationUtils.ArgumentNotNull(jsonWriter, "jsonWriter");
			Formatting? formatting = null;
			if (_formatting.HasValue && jsonWriter.Formatting != _formatting)
			{
				formatting = jsonWriter.Formatting;
				jsonWriter.Formatting = _formatting.GetValueOrDefault();
			}
			DateFormatHandling? dateFormatHandling = null;
			if (_dateFormatHandling.HasValue && jsonWriter.DateFormatHandling != _dateFormatHandling)
			{
				dateFormatHandling = jsonWriter.DateFormatHandling;
				jsonWriter.DateFormatHandling = _dateFormatHandling.GetValueOrDefault();
			}
			DateTimeZoneHandling? dateTimeZoneHandling = null;
			if (_dateTimeZoneHandling.HasValue && jsonWriter.DateTimeZoneHandling != _dateTimeZoneHandling)
			{
				dateTimeZoneHandling = jsonWriter.DateTimeZoneHandling;
				jsonWriter.DateTimeZoneHandling = _dateTimeZoneHandling.GetValueOrDefault();
			}
			FloatFormatHandling? floatFormatHandling = null;
			if (_floatFormatHandling.HasValue && jsonWriter.FloatFormatHandling != _floatFormatHandling)
			{
				floatFormatHandling = jsonWriter.FloatFormatHandling;
				jsonWriter.FloatFormatHandling = _floatFormatHandling.GetValueOrDefault();
			}
			StringEscapeHandling? stringEscapeHandling = null;
			if (_stringEscapeHandling.HasValue && jsonWriter.StringEscapeHandling != _stringEscapeHandling)
			{
				stringEscapeHandling = jsonWriter.StringEscapeHandling;
				jsonWriter.StringEscapeHandling = _stringEscapeHandling.GetValueOrDefault();
			}
			CultureInfo cultureInfo = null;
			if (_culture != null && !_culture.Equals(jsonWriter.Culture))
			{
				cultureInfo = jsonWriter.Culture;
				jsonWriter.Culture = _culture;
			}
			string dateFormatString = null;
			if (_dateFormatStringSet && jsonWriter.DateFormatString != _dateFormatString)
			{
				dateFormatString = jsonWriter.DateFormatString;
				jsonWriter.DateFormatString = _dateFormatString;
			}
			TraceJsonWriter traceJsonWriter = ((TraceWriter != null && TraceWriter.LevelFilter >= TraceLevel.Verbose) ? new TraceJsonWriter(jsonWriter) : null);
			new JsonSerializerInternalWriter(this).Serialize(traceJsonWriter ?? jsonWriter, value, objectType);
			if (traceJsonWriter != null)
			{
				TraceWriter.Trace(TraceLevel.Verbose, traceJsonWriter.GetSerializedJsonMessage(), null);
			}
			if (formatting.HasValue)
			{
				jsonWriter.Formatting = formatting.GetValueOrDefault();
			}
			if (dateFormatHandling.HasValue)
			{
				jsonWriter.DateFormatHandling = dateFormatHandling.GetValueOrDefault();
			}
			if (dateTimeZoneHandling.HasValue)
			{
				jsonWriter.DateTimeZoneHandling = dateTimeZoneHandling.GetValueOrDefault();
			}
			if (floatFormatHandling.HasValue)
			{
				jsonWriter.FloatFormatHandling = floatFormatHandling.GetValueOrDefault();
			}
			if (stringEscapeHandling.HasValue)
			{
				jsonWriter.StringEscapeHandling = stringEscapeHandling.GetValueOrDefault();
			}
			if (_dateFormatStringSet)
			{
				jsonWriter.DateFormatString = dateFormatString;
			}
			if (cultureInfo != null)
			{
				jsonWriter.Culture = cultureInfo;
			}
		}

		internal IReferenceResolver GetReferenceResolver()
		{
			if (_referenceResolver == null)
			{
				_referenceResolver = new DefaultReferenceResolver();
			}
			return _referenceResolver;
		}

		internal JsonConverter? GetMatchingConverter(Type type)
		{
			return GetMatchingConverter(_converters, type);
		}

		internal static JsonConverter? GetMatchingConverter(IList<JsonConverter>? converters, Type objectType)
		{
			if (converters != null)
			{
				for (int i = 0; i < converters.Count; i++)
				{
					JsonConverter jsonConverter = converters[i];
					if (jsonConverter.CanConvert(objectType))
					{
						return jsonConverter;
					}
				}
			}
			return null;
		}

		internal void OnError(Newtonsoft.Json.Serialization.ErrorEventArgs e)
		{
			this.Error?.Invoke(this, e);
		}
	}
	public class JsonSerializerSettings
	{
		internal const ReferenceLoopHandling DefaultReferenceLoopHandling = ReferenceLoopHandling.Error;

		internal const MissingMemberHandling DefaultMissingMemberHandling = MissingMemberHandling.Ignore;

		internal const NullValueHandling DefaultNullValueHandling = NullValueHandling.Include;

		internal const DefaultValueHandling DefaultDefaultValueHandling = DefaultValueHandling.Include;

		internal const ObjectCreationHandling DefaultObjectCreationHandling = ObjectCreationHandling.Auto;

		internal const PreserveReferencesHandling DefaultPreserveReferencesHandling = PreserveReferencesHandling.None;

		internal const ConstructorHandling DefaultConstructorHandling = ConstructorHandling.Default;

		internal const TypeNameHandling DefaultTypeNameHandling = TypeNameHandling.None;

		internal const MetadataPropertyHandling DefaultMetadataPropertyHandling = MetadataPropertyHandling.Default;

		internal static readonly StreamingContext DefaultContext;

		internal const Formatting DefaultFormatting = Formatting.None;

		internal const DateFormatHandling DefaultDateFormatHandling = DateFormatHandling.IsoDateFormat;

		internal const DateTimeZoneHandling DefaultDateTimeZoneHandling = DateTimeZoneHandling.RoundtripKind;

		internal const DateParseHandling DefaultDateParseHandling = DateParseHandling.DateTime;

		internal const FloatParseHandling DefaultFloatParseHandling = FloatParseHandling.Double;

		internal const FloatFormatHandling DefaultFloatFormatHandling = FloatFormatHandling.String;

		internal const StringEscapeHandling DefaultStringEscapeHandling = StringEscapeHandling.Default;

		internal const TypeNameAssemblyFormatHandling DefaultTypeNameAssemblyFormatHandling = TypeNameAssemblyFormatHandling.Simple;

		internal static readonly CultureInfo DefaultCulture;

		internal const bool DefaultCheckAdditionalContent = false;

		internal const string DefaultDateFormatString = "yyyy'-'MM'-'dd'T'HH':'mm':'ss.FFFFFFFK";

		internal const int DefaultMaxDepth = 64;

		internal Formatting? _formatting;

		internal DateFormatHandling? _dateFormatHandling;

		internal DateTimeZoneHandling? _dateTimeZoneHandling;

		internal DateParseHandling? _dateParseHandling;

		internal FloatFormatHandling? _floatFormatHandling;

		internal FloatParseHandling? _floatParseHandling;

		internal StringEscapeHandling? _stringEscapeHandling;

		internal CultureInfo? _culture;

		internal bool? _checkAdditionalContent;

		internal int? _maxDepth;

		internal bool _maxDepthSet;

		internal string? _dateFormatString;

		internal bool _dateFormatStringSet;

		internal TypeNameAssemblyFormatHandling? _typeNameAssemblyFormatHandling;

		internal DefaultValueHandling? _defaultValueHandling;

		internal PreserveReferencesHandling? _preserveReferencesHandling;

		internal NullValueHandling? _nullValueHandling;

		internal ObjectCreationHandling? _objectCreationHandling;

		internal MissingMemberHandling? _missingMemberHandling;

		internal ReferenceLoopHandling? _referenceLoopHandling;

		internal StreamingContext? _context;

		internal ConstructorHandling? _constructorHandling;

		internal TypeNameHandling? _typeNameHandling;

		internal MetadataPropertyHandling? _metadataPropertyHandling;

		public ReferenceLoopHandling ReferenceLoopHandling
		{
			get
			{
				return _referenceLoopHandling.GetValueOrDefault();
			}
			set
			{
				_referenceLoopHandling = value;
			}
		}

		public MissingMemberHandling MissingMemberHandling
		{
			get
			{
				return _missingMemberHandling.GetValueOrDefault();
			}
			set
			{
				_missingMemberHandling = value;
			}
		}

		public ObjectCreationHandling ObjectCreationHandling
		{
			get
			{
				return _objectCreationHandling.GetValueOrDefault();
			}
			set
			{
				_objectCreationHandling = value;
			}
		}

		public NullValueHandling NullValueHandling
		{
			get
			{
				return _nullValueHandling.GetValueOrDefault();
			}
			set
			{
				_nullValueHandling = value;
			}
		}

		public DefaultValueHandling DefaultValueHandling
		{
			get
			{
				return _defaultValueHandling.GetValueOrDefault();
			}
			set
			{
				_defaultValueHandling = value;
			}
		}

		public IList<JsonConverter> Converters { get; set; }

		public PreserveReferencesHandling PreserveReferencesHandling
		{
			get
			{
				return _preserveReferencesHandling.GetValueOrDefault();
			}
			set
			{
				_preserveReferencesHandling = value;
			}
		}

		public TypeNameHandling TypeNameHandling
		{
			get
			{
				return _typeNameHandling.GetValueOrDefault();
			}
			set
			{

Microsoft.Extensions.Primitives.dll

Decompiled 2 weeks ago
using System;
using System.Buffers;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
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;
using Microsoft.Extensions.FileProviders;
using Microsoft.Extensions.Internal;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[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("9.0.225.6610")]
[assembly: AssemblyInformationalVersion("9.0.2+80aa709f5d919c6814726788dc6dabe23e79e672")]
[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("9.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.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.Microsoft.Extensions.Primitives
{
	internal static class SR
	{
	}
}
namespace System
{
	internal static class SR
	{
		private static readonly bool s_usingResourceKeys = GetUsingResourceKeysSwitchValue();

		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 GetUsingResourceKeysSwitchValue()
		{
			if (!AppContext.TryGetSwitch("System.Resources.UseSystemResourceKeys", out var isEnabled))
			{
				return false;
			}
			return isEnabled;
		}

		internal static bool UsingResourceKeys()
		{
			return s_usingResourceKeys;
		}

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

		private 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;
			Span<char> chars = _chars;
			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)
		{
			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(scoped ReadOnlySpan<char> value)
		{
			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)
		{
			return (((h1 << 5) | (h1 >>> 27)) + h1) ^ h2;
		}
	}
}
namespace Microsoft.Extensions.FileProviders
{
	internal sealed class EmptyDisposable : IDisposable
	{
		public static EmptyDisposable Instance { get; } = new EmptyDisposable();


		private EmptyDisposable()
		{
		}

		public void Dispose()
		{
		}
	}
}
namespace Microsoft.Extensions.Internal
{
	internal static class ChangeCallbackRegistrar
	{
		internal static IDisposable UnsafeRegisterChangeCallback<T>(Action<object> callback, object state, CancellationToken token, Action<T> onFailure, T onFailureState)
		{
			bool flag = false;
			if (!ExecutionContext.IsFlowSuppressed())
			{
				ExecutionContext.SuppressFlow();
				flag = true;
			}
			try
			{
				return token.Register(callback, state);
			}
			catch (ObjectDisposedException)
			{
				onFailure(onFailureState);
			}
			finally
			{
				if (flag)
				{
					ExecutionContext.RestoreFlow();
				}
			}
			return EmptyDisposable.Instance;
		}
	}
}
namespace Microsoft.Extensions.Primitives
{
	[DebuggerDisplay("HasChanged = {HasChanged}")]
	public class CancellationChangeToken : IChangeToken
	{
		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)
		{
			return ChangeCallbackRegistrar.UnsafeRegisterChangeCallback(callback, state, Token, delegate(CancellationChangeToken s)
			{
				s.ActiveChangeCallbacks = false;
			}, this);
		}
	}
	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);
					if (token.HasChanged && token.ActiveChangeCallbacks)
					{
						disposable?.Dispose();
					}
					else
					{
						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);
		}
	}
	[DebuggerDisplay("HasChanged = {HasChanged}")]
	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)
			{
				if (compositeChangeToken._cancellationTokenSource.IsCancellationRequested)
				{
					return;
				}
				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);
	}
	[DebuggerDisplay("Value = {_value}")]
	[EditorBrowsable(EditorBrowsableState.Never)]
	[Obsolete("This type is retained only for compatibility. The recommended alternative is string.Create<TState> (int length, TState state, System.Buffers.SpanAction<char,TState> action).", true)]
	public struct InplaceStringBuilder
	{
		private int _offset;

		private int _capacity;

		private string _value;

		public int Capacity
		{
			get
			{
				return _capacity;
			}
			set
			{
				if (value < 0)
				{
					ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.value);
				}
				if (_offset > 0)
				{
					ThrowHelper.ThrowInvalidOperationException(ExceptionResource.Capacity_CannotChangeAfterWriteStarted);
				}
				_capacity = value;
			}
		}

		public InplaceStringBuilder(int capacity)
		{
			this = default(InplaceStringBuilder);
			if (capacity < 0)
			{
				ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.capacity);
			}
			_capacity = capacity;
		}

		public void Append(string? value)
		{
			if (value == null)
			{
				ThrowHelper.ThrowArgumentNullException(ExceptionArgument.value);
			}
			Append(value, 0, value.Length);
		}

		public void Append(StringSegment segment)
		{
			Append(segment.Buffer, segment.Offset, segment.Length);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public unsafe void Append(string? value, int offset, int count)
		{
			EnsureValueIsInitialized();
			if (value == null || offset < 0 || value.Length - offset < count || Capacity - _offset < count)
			{
				ThrowValidationError(value, offset, count);
			}
			fixed (char* ptr = _value)
			{
				fixed (char* ptr2 = value)
				{
					Unsafe.CopyBlockUnaligned(ptr + _offset, ptr2 + offset, (uint)(count * 2));
					_offset += count;
				}
			}
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public unsafe void Append(char c)
		{
			EnsureValueIsInitialized();
			if (_offset >= Capacity)
			{
				ThrowHelper.ThrowInvalidOperationException(ExceptionResource.Capacity_NotEnough, 1, Capacity - _offset);
			}
			fixed (char* ptr = _value)
			{
				ptr[_offset++] = c;
			}
		}

		public override string? ToString()
		{
			if (Capacity != _offset)
			{
				ThrowHelper.ThrowInvalidOperationException(ExceptionResource.Capacity_NotUsedEntirely, Capacity, _offset);
			}
			return _value;
		}

		private void EnsureValueIsInitialized()
		{
			if (_value == null)
			{
				_value = new string('\0', _capacity);
			}
		}

		private void ThrowValidationError(string value, int offset, int count)
		{
			if (value == null)
			{
				ThrowHelper.ThrowArgumentNullException(ExceptionArgument.value);
			}
			if (offset < 0 || value.Length - offset < count)
			{
				ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.offset);
			}
			if (Capacity - _offset < count)
			{
				ThrowHelper.ThrowInvalidOperationException(ExceptionResource.Capacity_NotEnough, value.Length, Capacity - _offset);
			}
		}
	}
	[DebuggerDisplay("{Value}")]
	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>, IEnumerator, IDisposable
		{
			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();
		}
	}
	[DebuggerDisplay("{ToString()}")]
	[DebuggerTypeProxy(typeof(StringValuesDebugView))]
	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?>, IEnumerator, IDisposable
		{
			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 = 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()
			{
			}
		}

		private sealed class StringValuesDebugView
		{
			[CompilerGenerated]
			private StringValues <values>P;

			[DebuggerBrowsable(DebuggerBrowsableState.RootHidden)]
			public string[] Items => <values>P.ToArray();

			public StringValuesDebugView(StringValues values)
			{
				<values>P = values;
				base..ctor();
			}
		}

		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 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 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 = 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] { 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(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] = 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(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 Unsafe.As<string>(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 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)
		{
			throw new InvalidOperationException(string.Format(GetResourceText(resource), args));
		}

		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 resource switch
			{
				ExceptionResource.Argument_InvalidOffsetLength => System.SR.Argument_InvalidOffsetLength, 
				ExceptionResource.Argument_InvalidOffsetLengthStringSegment => System.SR.Argument_InvalidOffsetLengthStringSegment, 
				ExceptionResource.Capacity_CannotChangeAfterWriteStarted => System.SR.Capacity_CannotChangeAfterWriteStarted, 
				ExceptionResource.Capacity_NotEnough => System.SR.Capacity_NotEnough, 
				ExceptionResource.Capacity_NotUsedEntirely => System.SR.Capacity_NotUsedEntirely, 
				_ => "", 
			};
		}

		private static string GetArgumentName(ExceptionArgument argument)
		{
			return argument.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
	}
}

TrainworksReloaded.Core.dll

Decompiled 2 weeks 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.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security.Cryptography;
using System.Text;
using Microsoft.CodeAnalysis;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.FileProviders;
using Newtonsoft.Json.Linq;
using SimpleInjector;
using TrainworksReloaded.Core.Configuration;
using TrainworksReloaded.Core.Enum;
using TrainworksReloaded.Core.Impl;
using TrainworksReloaded.Core.Interfaces;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("TrainworksReloaded.Core")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.2.9.0")]
[assembly: AssemblyInformationalVersion("0.2.9+53b4c01ba054c7d6cd2aef9a82805b8ee39b94e8")]
[assembly: AssemblyProduct("TrainworksReloaded.Core")]
[assembly: AssemblyTitle("TrainworksReloaded.Core")]
[assembly: AssemblyVersion("0.2.9.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class ParamCollectionAttribute : 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 RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace TrainworksReloaded.Core
{
	public class Railend
	{
		private static readonly List<Action<Container>> PreContainerActions = new List<Action<Container>>();

		private static readonly List<Action<Container>> PostContainerActions = new List<Action<Container>>();

		private static readonly Lazy<Container> container = new Lazy<Container>((Func<Container>)delegate
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			LazyBuilder builderForInit = Railhead.GetBuilderForInit();
			Container val = new Container();
			foreach (Action<Container> preContainerAction in PreContainerActions)
			{
				preContainerAction(val);
			}
			builderForInit.Build(val);
			foreach (Action<Container> postContainerAction in PostContainerActions)
			{
				postContainerAction(val);
			}
			val.Verify();
			return val;
		});

		public static void ConfigurePreAction(Action<Container> action)
		{
			PreContainerActions.Add(action);
		}

		public static void ConfigurePostAction(Action<Container> action)
		{
			PostContainerActions.Add(action);
		}

		public static Container GetContainer()
		{
			return container.Value;
		}
	}
	public class Railhead
	{
		private static readonly LazyBuilder lazyConfigure = new LazyBuilder();

		public static ILazyBuilder GetBuilder()
		{
			return lazyConfigure;
		}

		internal static LazyBuilder GetBuilderForInit()
		{
			return lazyConfigure;
		}
	}
}
namespace TrainworksReloaded.Core.Interfaces
{
	public interface ICache<T>
	{
		void AddToCache(T item);

		IEnumerable<T> GetCacheItems();

		void Clear();
	}
	public interface IDataFinalizer
	{
		void FinalizeData();
	}
	public interface IDataPipeline<T, U> where T : IRegister<U>
	{
		List<IDefinition<U>> Run(T service);
	}
	public interface IDefinition<T>
	{
		string Key { get; }

		string Id { get; }

		T Data { get; }

		IConfiguration Configuration { get; }

		bool IsModded { get; }
	}
	public interface IFactory<T>
	{
		string FactoryKey { get; }

		T? GetValue();
	}
	public interface IGuidProvider
	{
		Guid GetGuidDeterministic(string key);
	}
	public interface IInstanceGenerator<T> where T : new()
	{
		T CreateInstance();
	}
	public interface ILazyBuilder
	{
		void Configure(string pluginId, Action<IConfigurationBuilder> action);

		void ConfigureLoaders(Action<Container> action);
	}
	[Flags]
	public enum LogLevel
	{
		None = 0,
		Fatal = 1,
		Error = 2,
		Warning = 4,
		Message = 8,
		Info = 0x10,
		Debug = 0x20,
		All = 0x3F
	}
	public interface IModLogger<T>
	{
		void Log(LogLevel level, object data);
	}
	public interface IRegister<T> : IRegisterableDictionary<T>, IDictionary<string, T>, ICollection<KeyValuePair<string, T>>, IEnumerable<KeyValuePair<string, T>>, IEnumerable
	{
		List<string> GetAllIdentifiers(RegisterIdentifierType identifierType);

		bool TryLookupIdentifier(string identifier, RegisterIdentifierType identifierType, [NotNullWhen(true)] out T? lookup, [NotNullWhen(true)] out bool? IsModded);
	}
	public interface IRegisterableDictionary<T> : IDictionary<string, T>, ICollection<KeyValuePair<string, T>>, IEnumerable<KeyValuePair<string, T>>, IEnumerable
	{
		void Register(string key, T item);
	}
}
namespace TrainworksReloaded.Core.Impl
{
	public class Cache<T> : ICache<T>
	{
		public List<T> Values { get; set; } = new List<T>();


		public void AddToCache(T item)
		{
			Values.Add(item);
		}

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

		public IEnumerable<T> GetCacheItems()
		{
			return Values.AsEnumerable();
		}
	}
	public class CacheDataPipelineDecorator<T, U> : IDataPipeline<T, U> where T : IRegister<U>
	{
		private readonly IDataPipeline<T, U> decoratee;

		private readonly ICache<IDefinition<U>> cache;

		public CacheDataPipelineDecorator(IDataPipeline<T, U> decoratee, ICache<IDefinition<U>> cache)
		{
			this.decoratee = decoratee;
			this.cache = cache;
		}

		public List<IDefinition<U>> Run(T service)
		{
			List<IDefinition<U>> list = decoratee.Run(service);
			foreach (IDefinition<U> item in list)
			{
				cache.AddToCache(item);
			}
			return list;
		}
	}
	public class DeterministicGuidGenerator : IGuidProvider
	{
		private static readonly SHA256CryptoServiceProvider provider = new SHA256CryptoServiceProvider();

		public Guid GetGuidDeterministic(string key)
		{
			byte[] bytes = Encoding.Default.GetBytes(key);
			byte[] array = provider.ComputeHash(bytes);
			array[7] = (byte)(0x40u | (array[7] & 0xFu));
			array[8] = (byte)(0x80u | (array[8] & 0x3Fu));
			Array.Resize(ref array, 16);
			return new Guid(array);
		}
	}
	public class Finalizer
	{
		private readonly IEnumerable<IDataFinalizer> dataFinalizers;

		public Finalizer(IEnumerable<IDataFinalizer> dataFinalizers)
		{
			this.dataFinalizers = dataFinalizers;
		}

		public void FinalizeData()
		{
			foreach (IDataFinalizer dataFinalizer in dataFinalizers)
			{
				dataFinalizer.FinalizeData();
			}
		}
	}
	public class InstanceGenerator<T> : IInstanceGenerator<T> where T : new()
	{
		public string Key { get; } = "InstanceGenerator";


		public T CreateInstance()
		{
			return new T();
		}
	}
	public class LazyBuilder : ILazyBuilder
	{
		public Dictionary<string, List<Action<IConfigurationBuilder>>> configActions = new Dictionary<string, List<Action<IConfigurationBuilder>>>();

		public List<Action<Container>> containerActions = new List<Action<Container>>();

		public void Configure(string pluginId, Action<IConfigurationBuilder> action)
		{
			if (configActions.TryGetValue(pluginId, out List<Action<IConfigurationBuilder>> value))
			{
				value.Add(action);
				return;
			}
			configActions.Add(pluginId, new List<Action<IConfigurationBuilder>>(1) { action });
		}

		public void ConfigureLoaders(Action<Container> action)
		{
			containerActions.Add(action);
		}

		public void Build(Container container)
		{
			PluginAtlas pluginAtlas = new PluginAtlas();
			foreach (string key in configActions.Keys)
			{
				ConfigurationBuilder configurationBuilder = new ConfigurationBuilder();
				HashSet<string> hashSet = new HashSet<string>();
				Assembly assembly = null;
				foreach (Action<IConfigurationBuilder> item in configActions[key])
				{
					string directoryName = Path.GetDirectoryName(item.Method.DeclaringType.Assembly.Location);
					hashSet.Add(directoryName);
					assembly = item.Method.DeclaringType.Assembly;
					configurationBuilder.SetBasePath(directoryName);
					item(configurationBuilder);
				}
				PluginDefinition pluginDefinition = new PluginDefinition(configurationBuilder.Build());
				pluginDefinition.AssetDirectories.AddRange(hashSet);
				pluginDefinition.Assembly = assembly;
				pluginAtlas.PluginDefinitions.Add(key, pluginDefinition);
			}
			container.RegisterInstance<PluginAtlas>(pluginAtlas);
			foreach (Action<Container> containerAction in containerActions)
			{
				containerAction(container);
			}
		}
	}
	public class PluginAtlas
	{
		public Dictionary<string, PluginDefinition> PluginDefinitions { get; set; } = new Dictionary<string, PluginDefinition>();

	}
	public class PluginDefinition
	{
		public IConfiguration Configuration { get; set; }

		public List<string> AssetDirectories { get; } = new List<string>();


		public Assembly? Assembly { get; set; }

		public PluginDefinition(IConfiguration configuration)
		{
			Configuration = configuration;
		}
	}
}
namespace TrainworksReloaded.Core.Extensions
{
	public static class ConfigurationExtensions
	{
		public static IConfigurationBuilder AddMergedJsonFile(this IConfigurationBuilder builder, [ParamCollection] List<string> Paths)
		{
			List<string> Paths2 = Paths;
			return builder.AddMergedJsonFile(delegate(MergedJsonConfigurationSource xs)
			{
				xs.FileProvider = null;
				xs.Paths = Paths2;
				xs.Optional = false;
			});
		}

		public static IConfigurationBuilder AddMergedJsonFile(this IConfigurationBuilder builder, Action<MergedJsonConfigurationSource>? configureSource)
		{
			return builder.Add(configureSource);
		}
	}
	public static class ParseExtensions
	{
		public static string? ParseString(this IConfigurationSection section)
		{
			return section.Value;
		}

		public static int? ParseInt(this IConfigurationSection section)
		{
			string value = section.Value;
			if (value == null)
			{
				return null;
			}
			if (int.TryParse(value, out var result))
			{
				return result;
			}
			return null;
		}

		public static float? ParseFloat(this IConfigurationSection section)
		{
			string value = section.Value;
			if (value == null)
			{
				return null;
			}
			if (float.TryParse(value, out var result))
			{
				return result;
			}
			return null;
		}

		public static bool? ParseBool(this IConfigurationSection section)
		{
			string value = section.Value;
			if (value == null)
			{
				return null;
			}
			if (bool.TryParse(value, out var result))
			{
				return result;
			}
			return null;
		}
	}
	public static class RegisterExtensions
	{
		public static bool TryLookupName<T>(this IRegister<T> register, string name, [NotNullWhen(true)] out T? lookup, [NotNullWhen(true)] out bool? IsModded)
		{
			return register.TryLookupIdentifier(name, RegisterIdentifierType.ReadableID, out lookup, out IsModded);
		}

		public static bool TryLookupId<T>(this IRegister<T> register, string id, [NotNullWhen(true)] out T? lookup, [NotNullWhen(true)] out bool? IsModded)
		{
			return register.TryLookupIdentifier(id, RegisterIdentifierType.GUID, out lookup, out IsModded);
		}
	}
}
namespace TrainworksReloaded.Core.Enum
{
	public enum RegisterIdentifierType
	{
		ReadableID,
		GUID
	}
}
namespace TrainworksReloaded.Core.Configuration
{
	public class MergedJsonConfigurationSource : IConfigurationSource
	{
		public IFileProvider? FileProvider { get; set; }

		public List<string> Paths { get; set; }

		public bool Optional { get; set; }

		public MergedJsonConfigurationSource()
		{
			Paths = new List<string>();
			Optional = true;
			FileProvider = null;
		}

		public MergedJsonConfigurationSource(IFileProvider fileProvider, bool optional = false, params string[] paths)
		{
			FileProvider = fileProvider;
			Optional = optional;
			Paths = paths.ToList();
		}

		public IConfigurationProvider Build(IConfigurationBuilder builder)
		{
			EnsureDefaults(builder);
			return new MergedJsonConfigurationProvider(this);
		}

		public void EnsureDefaults(IConfigurationBuilder builder)
		{
			if (FileProvider == null)
			{
				IFileProvider fileProvider2 = (FileProvider = builder.GetFileProvider());
			}
		}
	}
	public class MergedJsonConfigurationProvider : ConfigurationProvider
	{
		public MergedJsonConfigurationSource Source { get; }

		public MergedJsonConfigurationProvider(MergedJsonConfigurationSource source)
		{
			Source = source;
		}

		public override void Load()
		{
			JObject val = null;
			foreach (string path in Source.Paths)
			{
				IFileInfo fileInfo = Source.FileProvider?.GetFileInfo(path) ?? null;
				if (fileInfo == null || !fileInfo.Exists)
				{
					continue;
				}
				using Stream stream = fileInfo.CreateReadStream();
				using StreamReader streamReader = new StreamReader(stream);
				JObject val2 = JObject.Parse(streamReader.ReadToEnd());
				if (val == null)
				{
					val = val2;
				}
				else if (val2 != null)
				{
					((JContainer)val).Merge((object)val2);
				}
			}
			Dictionary<string, string> data = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
			LoadNode((JToken?)(object)val, data, "");
			base.Data = data;
		}

		private void LoadNode(JToken? node, IDictionary<string, string?> data, string path)
		{
			JObject val = (JObject)(object)((node is JObject) ? node : null);
			if (val != null)
			{
				foreach (JProperty item in val.Properties())
				{
					LoadNode(item.Value, data, CombinePath(path, item.Name));
				}
				return;
			}
			JArray val2 = (JArray)(object)((node is JArray) ? node : null);
			if (val2 != null)
			{
				for (int i = 0; i < ((JContainer)val2).Count; i++)
				{
					LoadNode(val2[i], data, $"{path}:{i}");
				}
				return;
			}
			JValue val3 = (JValue)(object)((node is JValue) ? node : null);
			if (val3 != null)
			{
				data[path] = ((object)val3).ToString();
			}
		}

		private string CombinePath(string path, string key)
		{
			if (!string.IsNullOrEmpty(path))
			{
				return path + ":" + key;
			}
			return key;
		}
	}
}

Microsoft.Extensions.FileProviders.Physical.dll

Decompiled 2 weeks 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(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[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("9.0.225.6610")]
[assembly: AssemblyInformationalVersion("9.0.2+80aa709f5d919c6814726788dc6dabe23e79e672")]
[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("9.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);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static string IfNullOrWhitespace(string? argument, [CallerArgumentExpression("argument")] string paramName = "")
		{
			if (argument == null)
			{
				throw new ArgumentNullException(paramName);
			}
			if (string.IsNullOrWhiteSpace(argument))
			{
				if (argument == null)
				{
					throw new ArgumentNullException(paramName);
				}
				throw new ArgumentException(paramName, "Argument is whitespace");
			}
			return argument;
		}
	}
	internal static class SR
	{
		private static readonly bool s_usingResourceKeys = GetUsingResourceKeysSwitchValue();

		private static ResourceManager s_resourceManager;

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

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

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

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

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

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

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

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

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

		private static bool GetUsingResourceKeysSwitchValue()
		{
			if (!AppContext.TryGetSwitch("System.Resources.UseSystemResourceKeys", out var isEnabled))
			{
				return false;
			}
			return isEnabled;
		}

		internal static bool UsingResourceKeys()
		{
			return s_usingResourceKeys;
		}

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

		private 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)
		{
			if (string.IsNullOrEmpty(subpath) || PathUtils.HasInvalidPathChars(subpath))
			{
				return new NotFoundFileInfo(subpath);
			}
			subpath = subpath.TrimStart(_pathSeparators);
			if (Path.IsPathRooted(subpath))
			{
				return new NotFoundFileInfo(subpath);
			}
			string fullPath = GetFullPath(subpath);
			if (fullPath == null)
			{
				return new NotFoundFileInfo(subpath);
			}
			FileInfo fileInfo = new FileInfo(fullPath);
			if (FileSystemInfoHelper.IsExcluded(fileInfo, _filters))
			{
				return new NotFoundFileInfo(subpath);
			}
			return new PhysicalFileInfo(fileInfo);
		}

		public IDirectoryContents GetDirectoryContents(string subpath)
		{
			try
			{
				if (subpath == null || PathUtils.HasInvalidPathChars(subpath))
				{
					return NotFoundDirectoryContents.Singleton;
				}
				subpath = subpath.TrimStart(_pathSeparators);
				if (Path.IsPathRooted(subpath))
				{
					return NotFoundDirectoryContents.Singleton;
				}
				string fullPath = GetFullPath(subpath);
				if (fullPath == null || !Directory.Exists(fullPath))
				{
					return NotFoundDirectoryContents.Singleton;
				}
				return new PhysicalDirectoryContents(fullPath, _filters);
			}
			catch (DirectoryNotFoundException)
			{
			}
			catch (IOException)
			{
			}
			return NotFoundDirectoryContents.Singleton;
		}

		public IChangeToken Watch(string filter)
		{
			if (filter == null || PathUtils.HasInvalidFilterChars(filter))
			{
				return NullChangeToken.Singleton;
			}
			filter = filter.TrimStart(_pathSeparators);
			return FileWatcher.CreateFileChangeToken(filter);
		}
	}
	internal sealed class EmptyDisposable : IDisposable
	{
		public static Microsoft.Extensions.FileProviders.EmptyDisposable Instance { get; } = new Microsoft.Extensions.FileProviders.EmptyDisposable();


		private EmptyDisposable()
		{
		}

		public void Dispose()
		{
		}
	}
}
namespace Microsoft.Extensions.FileProviders.Internal
{
	public class PhysicalDirectoryContents : IDirectoryContents, IEnumerable<IFileInfo>, IEnumerable
	{
		private readonly PhysicalDirectoryInfo _info;

		public bool Exists => _info.Exists;

		public PhysicalDirectoryContents(string directory)
			: this(directory, ExclusionFilters.Sensitive)
		{
		}

		public PhysicalDirectoryContents(string directory, ExclusionFilters filters)
		{
			System.ThrowHelper.ThrowIfNull(directory, "directory");
			_info = new PhysicalDirectoryInfo(new DirectoryInfo(directory), filters);
		}

		public IEnumerator<IFileInfo> GetEnumerator()
		{
			return _info.GetEnumerator();
		}

		IEnumerator IEnumerable.GetEnumerator()
		{
			return _info.GetEnumerator();
		}
	}
}
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, IDirectoryContents, IEnumerable<IFileInfo>, IEnumerable
	{
		private readonly DirectoryInfo _info;

		private IEnumerable<IFileInfo> _entries;

		private readonly ExclusionFilters _filters;

		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;
		}

		internal PhysicalDirectoryInfo(DirectoryInfo info, ExclusionFilters filters)
		{
			_info = info;
			_filters = filters;
		}

		public Stream CreateReadStream()
		{
			throw new InvalidOperationException(System.SR.CannotCreateStream);
		}

		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 _info.EnumerateFileSystemInfos()
					where !FileSystemInfoHelper.IsExcluded(info, _filters)
					select info).Select((Func<FileSystemInfo, IFileInfo>)delegate(FileSystemInfo info)
				{
					if (info is FileInfo info2)
					{
						return new PhysicalFileInfo(info2);
					}
					if (!(info is DirectoryInfo info3))
					{
						throw new InvalidOperationException(System.SR.UnexpectedFileSystemInfo);
					}
					return new PhysicalDirectoryInfo(info3);
				});
			}
			catch (Exception ex) when (((ex is DirectoryNotFoundException || ex is IOException) ? 1 : 0) != 0)
			{
				_entries = Enumerable.Empty<IFileInfo>();
			}
		}
	}
	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 readonly 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 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)
		{
			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 changeToken2 = 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);
				}
				changeToken2 = new CompositeChangeToken(new IChangeToken[2] { changeToken2, pollingFileChangeToken });
			}
			return changeToken2;
		}

		internal IChangeToken GetOrAddWildcardChangeToken(string pattern)
		{
			if (!_wildcardTokenLookup.TryGetValue(pattern, out var value))
			{
				CancellationTokenSource cancellationTokenSource = new CancellationTokenSource();
				CancellationChangeToken changeToken = new CancellationChangeToken(cancellationTokenSource.Token);
				Matcher matcher = new Matcher(StringComparison.OrdinalIgnoreCase);
				matcher.AddInclude(pattern);
				value = new ChangeTokenInfo(cancellationTokenSource, changeToken, matcher);
				value = _wildcardTokenLookup.GetOrAdd(pattern, value);
			}
			IChangeToken changeToken2 = value.ChangeToken;
			if (PollForChanges)
			{
				PollingWildCardChangeToken pollingWildCardChangeToken = new PollingWildCardChangeToken(_root, pattern);
				if (UseActivePolling)
				{
					pollingWildCardChangeToken.ActiveChangeCallbacks = true;
					pollingWildCardChangeToken.CancellationTokenSource = new CancellationTokenSource();
					PollingChangeTokens.TryAdd(pollingWildCardChangeToken, pollingWildCardChangeToken);
				}
				changeToken2 = new CompositeChangeToken(new IChangeToken[2] { changeToken2, pollingWildCardChangeToken });
			}
			return changeToken2;
		}

		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
			{
				if (!FileSystemInfoHelper.IsExcluded(new FileInfo(fullPath), _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)
			{
				if (item.Value.Matcher.Match(path).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 (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
			{
				_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 Microsoft.Extensions.FileProviders.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
			{
				_tokenSource = value;
				_changeToken = new CancellationChangeToken(_tokenSource.Token);
			}
		}

		CancellationTokenSource? IPollingChangeToken.CancellationTokenSource => CancellationTokenSource;

		private IClock Clock { get; }

		public bool HasChanged
		{
			get
			{
				if (_changed)
				{
					return _changed;
				}
				if (ShouldRefresh())
				{
					lock (_enumerationLock)
					{
						if (!_changed && ShouldRefresh())
						{
							_changed = CalculateChanges();
						}
					}
				}
				return _changed;
				bool ShouldRefresh()
				{
					DateTime utcNow = Clock.UtcNow;
					DateTime? lastScanTimeUtc = _lastScanTimeUtc;
					return utcNow - lastScanTimeUtc >= PollingInterval;
				}
			}
		}

		public PollingWildCardChangeToken(string root, string pattern)
			: this(new DirectoryInfoWrapper(new DirectoryInfo(root)), pattern, Microsoft.Extensions.FileProviders.Physical.Clock.Instance)
		{
		}

		internal PollingWildCardChangeToken(DirectoryInfoBase directoryInfo, string pattern, IClock clock)
		{
			_directoryInfo = directoryInfo;
			Clock = clock;
			_matcher = new Matcher(StringComparison.OrdinalIgnoreCase);
			_matcher.AddInclude(pattern);
			CalculateChanges();
		}

		private bool CalculateChanges()
		{
			IOrderedEnumerable<FilePatternMatch> orderedEnumerable = _matcher.Execute(_directoryInfo).Files.OrderBy<FilePatternMatch, string>((FilePatternMatch f) => f.Path, StringComparer.Ordinal);
			using (IncrementalHash incrementalHash = IncrementalHash.CreateHash(HashAlgorithmName.SHA256))
			{
				foreach (FilePatternMatch item in orderedEnumerable)
				{
					DateTime lastWriteUtc = GetLastWriteUtc(item.Path);
					if (_lastScanTimeUtc.HasValue && _lastScanTimeUtc < lastWriteUtc)
					{
						return true;
					}
					ComputeHash(incrementalHash, item.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(_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 Microsoft.Extensions.FileProviders.EmptyDisposable.Instance;
			}
			return _changeToken.RegisterChangeCallback(callback, state);
		}
	}
}
namespace Microsoft.Extensions.FileProviders.Physical.Internal
{
	internal static class PathUtils
	{
		private static readonly char[] _invalidFileNameChars = GetInvalidFileNameChars();

		private static readonly char[] _invalidFilterChars = GetInvalidFilterChars();

		private static readonly char[] _pathSeparators = new char[2]
		{
			Path.DirectorySeparatorChar,
			Path.AltDirectorySeparatorChar
		};

		private static char[] GetInvalidFileNameChars()
		{
			return (from c in Path.GetInvalidFileNameChars()
				where c != Path.DirectorySeparatorChar && c != Path.AltDirectorySeparatorChar
				select c).ToArray();
		}

		private static char[] GetInvalidFilterChars()
		{
			return (from c in GetInvalidFileNameChars()
				where c != '*' && c != '|' && c != '?'
				select c).ToArray();
		}

		internal static bool HasInvalidPathChars(string path)
		{
			return path.IndexOfAny(_invalidFileNameChars) >= 0;
		}

		internal static bool HasInvalidFilterChars(string path)
		{
			return path.IndexOfAny(_invalidFilterChars) >= 0;
		}

		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)
		{
			StringTokenizer stringTokenizer = new StringTokenizer(path, _pathSeparators);
			int num = 0;
			foreach (StringSegment item in stringTokenizer)
			{
				if (item.Equals(".") || item.Equals(""))
				{
					continue;
				}
				if (item.Equals(".."))
				{
					num--;
					if (num == -1)
					{
						return true;
					}
				}
				else
				{
					num++;
				}
			}
			return false;
		}
	}
}

System.Text.Encodings.Web.dll

Decompiled 2 weeks 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(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[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("9.0.225.6610")]
[assembly: AssemblyInformationalVersion("9.0.2+80aa709f5d919c6814726788dc6dabe23e79e672")]
[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("9.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.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.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++)
			{
				ToCharsBuffer(readOnlySpan[i], 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, out int charsProcessed)
		{
			return TryDecodeFromUtf16_Scalar(chars, bytes, out charsProcessed);
		}

		private static bool TryDecodeFromUtf16_Scalar(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);
				long num2 = -17875860044349952L << (int)num;
				ulong num3 = num - 64;
				return (long)((ulong)num2 & num3) < 0L;
			}
			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 = GetUsingResourceKeysSwitchValue();

		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 GetUsingResourceKeysSwitchValue()
		{
			if (!AppContext.TryGetSwitch("System.Resources.UseSystemResourceKeys", out var isEnabled))
			{
				return false;
			}
			return isEnabled;
		}

		internal static bool UsingResourceKeys()
		{
			return s_usingResourceKeys;
		}

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

		private 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 Unsafe.AddByteOffset(ref MemoryMarshal.GetReference(Log2DeBruijn), (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;
			Span<char> chars = _chars;
			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)
		{
			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(scoped ReadOnlySpan<char> value)
		{
			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 _)
		{
			_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, _: 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, 14, 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, 127, 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));
				return ((byte)(0x80 | (scalar & 0x3F)) << 8) | b;
			}
			if (scalar <= 65535)
			{
				byte b2 = (byte)(0xE0u | (scalar >> 12));
				byte b3 = (byte)(0x80u | ((scalar >> 6) & 0x3Fu));
				return ((((byte)(0x80 | (scalar & 0x3F)) << 8) | b3) << 8) | b2;
			}
			byte b4 = (byte)(0xF0u | (scalar >> 18));
			byte b5 = (byte)(0x80u | ((scalar >> 12) & 0x3Fu));
			byte b6 = (byte)(0x80u | ((scalar >> 6) & 0x3Fu));
			return ((((((byte)(0x80 | (scalar & 0x3F)) << 8) | b6) << 8) | b5) << 8) | b4;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		internal static bool IsSupplementaryCodePoint(int scalar)
		{
			return (scalar & -65536) != 0;
		}
	}
	public sealed class UnicodeRange
	{
		public int FirstCodePoint { get; }

		public int Length { get; }

		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(

Microsoft.Bcl.AsyncInterfaces.dll

Decompiled 2 weeks ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
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: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[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.")]
[assembly: AssemblyFileVersion("9.0.225.6610")]
[assembly: AssemblyInformationalVersion("9.0.2+80aa709f5d919c6814726788dc6dabe23e79e672")]
[assembly: AssemblyProduct("Microsoft® .NET")]
[assembly: AssemblyTitle("Microsoft.Bcl.AsyncInterfaces")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/dotnet/runtime")]
[assembly: AssemblyVersion("9.0.0.2")]
[assembly: TypeForwardedTo(typeof(IAsyncEnumerable<>))]
[assembly: TypeForwardedTo(typeof(IAsyncEnumerator<>))]
[assembly: TypeForwardedTo(typeof(IAsyncDisposable))]
[assembly: TypeForwardedTo(typeof(AsyncIteratorMethodBuilder))]
[assembly: TypeForwardedTo(typeof(AsyncIteratorStateMachineAttribute))]
[assembly: TypeForwardedTo(typeof(ConfiguredAsyncDisposable))]
[assembly: TypeForwardedTo(typeof(ConfiguredCancelableAsyncEnumerable<>))]
[assembly: TypeForwardedTo(typeof(EnumeratorCancellationAttribute))]
[assembly: TypeForwardedTo(typeof(ManualResetValueTaskSourceCore<>))]
[assembly: TypeForwardedTo(typeof(TaskAsyncEnumerableExtensions))]
[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 System.Diagnostics.CodeAnalysis
{
	[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
	}
}

System.IO.Pipelines.dll

Decompiled 2 weeks ago
using System;
using System.Buffers;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
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 System.Threading.Tasks.Sources;
using FxResources.System.IO.Pipelines;
using Microsoft.CodeAnalysis;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: InternalsVisibleTo("System.IO.Pipelines.Tests, PublicKey=00240000048000009400000006020000002400005253413100040000010001004b86c4cb78549b34bab61a3b1800e23bfeb5b3ec390074041536a7e3cbd97f5f04cf0f857155a8928eaa29ebfd11cfbbad3ba70efea7bda3226c6a8d370a4cd303f714486b6ebc225985a638471e6ef571cc92a4613c00b8fa65d61ccee0cbe5f36330c9a01f4183559f1bef24cc2917c6d913e3a541333a1d05d9bed22b38cb")]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyMetadata("Serviceable", "True")]
[assembly: AssemblyMetadata("PreferInbox", "True")]
[assembly: AssemblyDefaultAlias("System.IO.Pipelines")]
[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("Single producer single consumer byte buffer management.\r\n\r\nCommonly Used Types:\r\nSystem.IO.Pipelines.Pipe\r\nSystem.IO.Pipelines.PipeWriter\r\nSystem.IO.Pipelines.PipeReader")]
[assembly: AssemblyFileVersion("9.0.225.6610")]
[assembly: AssemblyInformationalVersion("9.0.2+80aa709f5d919c6814726788dc6dabe23e79e672")]
[assembly: AssemblyProduct("Microsoft® .NET")]
[assembly: AssemblyTitle("System.IO.Pipelines")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/dotnet/runtime")]
[assembly: AssemblyVersion("9.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.System.IO.Pipelines
{
	internal static class SR
	{
	}
}
namespace System
{
	internal static class SR
	{
		private static readonly bool s_usingResourceKeys = GetUsingResourceKeysSwitchValue();

		private static ResourceManager s_resourceManager;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

		private static bool GetUsingResourceKeysSwitchValue()
		{
			if (!AppContext.TryGetSwitch("System.Resources.UseSystemResourceKeys", out var isEnabled))
			{
				return false;
			}
			return isEnabled;
		}

		internal static bool UsingResourceKeys()
		{
			return s_usingResourceKeys;
		}

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

		private 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.Threading
{
	internal static class CancellationTokenExtensions
	{
		internal static CancellationTokenRegistration UnsafeRegister(this CancellationToken cancellationToken, Action<object> callback, object state)
		{
			return cancellationToken.Register(callback, state);
		}
	}
}
namespace System.Threading.Tasks
{
	internal static class TaskToAsyncResult
	{
		private sealed class TaskAsyncResult : IAsyncResult
		{
			internal readonly Task _task;

			private readonly AsyncCallback _callback;

			public object AsyncState { get; }

			public bool CompletedSynchronously { get; }

			public bool IsCompleted => _task.IsCompleted;

			public WaitHandle AsyncWaitHandle => ((IAsyncResult)_task).AsyncWaitHandle;

			internal TaskAsyncResult(Task task, object state, AsyncCallback callback)
			{
				_task = task;
				AsyncState = state;
				if (task.IsCompleted)
				{
					CompletedSynchronously = true;
					callback?.Invoke(this);
				}
				else if (callback != null)
				{
					_callback = callback;
					_task.ConfigureAwait(continueOnCapturedContext: false).GetAwaiter().OnCompleted(delegate
					{
						_callback(this);
					});
				}
			}
		}

		public static IAsyncResult Begin(Task task, AsyncCallback? callback, object? state)
		{
			if (task == null)
			{
				throw new ArgumentNullException("task");
			}
			return new TaskAsyncResult(task, state, callback);
		}

		public static void End(IAsyncResult asyncResult)
		{
			Unwrap(asyncResult).GetAwaiter().GetResult();
		}

		public static TResult End<TResult>(IAsyncResult asyncResult)
		{
			return Unwrap<TResult>(asyncResult).GetAwaiter().GetResult();
		}

		public static Task Unwrap(IAsyncResult asyncResult)
		{
			if (asyncResult == null)
			{
				throw new ArgumentNullException("asyncResult");
			}
			return (asyncResult as TaskAsyncResult)?._task ?? throw new ArgumentException(null, "asyncResult");
		}

		public static Task<TResult> Unwrap<TResult>(IAsyncResult asyncResult)
		{
			if (asyncResult == null)
			{
				throw new ArgumentNullException("asyncResult");
			}
			return ((asyncResult as TaskAsyncResult)?._task as Task<TResult>) ?? throw new ArgumentException(null, "asyncResult");
		}
	}
}
namespace System.IO
{
	internal static class StreamHelpers
	{
		public static void ValidateCopyToArgs(Stream source, Stream destination, int bufferSize)
		{
			if (destination == null)
			{
				throw new ArgumentNullException("destination");
			}
			if (bufferSize <= 0)
			{
				throw new ArgumentOutOfRangeException("bufferSize", bufferSize, System.SR.ArgumentOutOfRange_NeedPosNum);
			}
			bool canRead = source.CanRead;
			if (!canRead && !source.CanWrite)
			{
				throw new ObjectDisposedException(null, System.SR.ObjectDisposed_StreamClosed);
			}
			bool canWrite = destination.CanWrite;
			if (!canWrite && !destination.CanRead)
			{
				throw new ObjectDisposedException("destination", System.SR.ObjectDisposed_StreamClosed);
			}
			if (!canRead)
			{
				throw new NotSupportedException(System.SR.NotSupported_UnreadableStream);
			}
			if (!canWrite)
			{
				throw new NotSupportedException(System.SR.NotSupported_UnwritableStream);
			}
		}
	}
}
namespace System.IO.Pipelines
{
	internal sealed class BufferSegment : ReadOnlySequenceSegment<byte>
	{
		private IMemoryOwner<byte> _memoryOwner;

		private byte[] _array;

		private BufferSegment _next;

		private int _end;

		public int End
		{
			get
			{
				return _end;
			}
			set
			{
				_end = value;
				base.Memory = AvailableMemory.Slice(0, value);
			}
		}

		public BufferSegment? NextSegment
		{
			get
			{
				return _next;
			}
			set
			{
				base.Next = value;
				_next = value;
			}
		}

		internal object? MemoryOwner => ((object)_memoryOwner) ?? ((object)_array);

		public Memory<byte> AvailableMemory { get; private set; }

		public int Length => End;

		public int WritableBytes
		{
			[MethodImpl(MethodImplOptions.AggressiveInlining)]
			get
			{
				return AvailableMemory.Length - End;
			}
		}

		public void SetOwnedMemory(IMemoryOwner<byte> memoryOwner)
		{
			_memoryOwner = memoryOwner;
			AvailableMemory = memoryOwner.Memory;
		}

		public void SetOwnedMemory(byte[] arrayPoolBuffer)
		{
			_array = arrayPoolBuffer;
			AvailableMemory = arrayPoolBuffer;
		}

		public void Reset()
		{
			ResetMemory();
			base.Next = null;
			base.RunningIndex = 0L;
			_next = null;
		}

		public void ResetMemory()
		{
			IMemoryOwner<byte> memoryOwner = _memoryOwner;
			if (memoryOwner != null)
			{
				_memoryOwner = null;
				memoryOwner.Dispose();
			}
			else
			{
				ArrayPool<byte>.Shared.Return(_array);
				_array = null;
			}
			base.Memory = default(ReadOnlyMemory<byte>);
			_end = 0;
			AvailableMemory = default(Memory<byte>);
		}

		public void SetNext(BufferSegment segment)
		{
			NextSegment = segment;
			segment = this;
			while (segment.Next != null)
			{
				segment.NextSegment.RunningIndex = segment.RunningIndex + segment.Length;
				segment = segment.NextSegment;
			}
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		internal static long GetLength(BufferSegment startSegment, int startIndex, BufferSegment endSegment, int endIndex)
		{
			return endSegment.RunningIndex + (uint)endIndex - (startSegment.RunningIndex + (uint)startIndex);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		internal static long GetLength(long startPosition, BufferSegment endSegment, int endIndex)
		{
			return endSegment.RunningIndex + (uint)endIndex - startPosition;
		}
	}
	internal readonly struct CompletionData
	{
		public Action<object?> Completion { get; }

		public object? CompletionState { get; }

		public ExecutionContext? ExecutionContext { get; }

		public SynchronizationContext? SynchronizationContext { get; }

		public CompletionData(Action<object?> completion, object? completionState, ExecutionContext? executionContext, SynchronizationContext? synchronizationContext)
		{
			Completion = completion;
			CompletionState = completionState;
			ExecutionContext = executionContext;
			SynchronizationContext = synchronizationContext;
		}
	}
	public struct FlushResult
	{
		internal ResultFlags _resultFlags;

		public bool IsCanceled => (_resultFlags & ResultFlags.Canceled) != 0;

		public bool IsCompleted => (_resultFlags & ResultFlags.Completed) != 0;

		public FlushResult(bool isCanceled, bool isCompleted)
		{
			_resultFlags = ResultFlags.None;
			if (isCanceled)
			{
				_resultFlags |= ResultFlags.Canceled;
			}
			if (isCompleted)
			{
				_resultFlags |= ResultFlags.Completed;
			}
		}
	}
	internal sealed class InlineScheduler : PipeScheduler
	{
		public override void Schedule(Action<object?> action, object? state)
		{
			action(state);
		}

		internal override void UnsafeSchedule(Action<object?> action, object? state)
		{
			action(state);
		}
	}
	public interface IDuplexPipe
	{
		PipeReader Input { get; }

		PipeWriter Output { get; }
	}
	internal struct BufferSegmentStack
	{
		private readonly struct SegmentAsValueType
		{
			private readonly BufferSegment _value;

			private SegmentAsValueType(BufferSegment value)
			{
				_value = value;
			}

			public static implicit operator SegmentAsValueType(BufferSegment s)
			{
				return new SegmentAsValueType(s);
			}

			public static implicit operator BufferSegment(SegmentAsValueType s)
			{
				return s._value;
			}
		}

		private SegmentAsValueType[] _array;

		private int _size;

		public int Count => _size;

		public BufferSegmentStack(int size)
		{
			_array = new SegmentAsValueType[size];
			_size = 0;
		}

		public bool TryPop([NotNullWhen(true)] out BufferSegment? result)
		{
			int num = _size - 1;
			SegmentAsValueType[] array = _array;
			if ((uint)num >= (uint)array.Length)
			{
				result = null;
				return false;
			}
			_size = num;
			result = array[num];
			array[num] = default(SegmentAsValueType);
			return true;
		}

		public void Push(BufferSegment item)
		{
			int size = _size;
			SegmentAsValueType[] array = _array;
			if ((uint)size < (uint)array.Length)
			{
				array[size] = item;
				_size = size + 1;
			}
			else
			{
				PushWithResize(item);
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		private void PushWithResize(BufferSegment item)
		{
			Array.Resize(ref _array, 2 * _array.Length);
			_array[_size] = item;
			_size++;
		}
	}
	public sealed class Pipe
	{
		private sealed class DefaultPipeReader : PipeReader, IValueTaskSource<ReadResult>
		{
			private readonly Pipe _pipe;

			public DefaultPipeReader(Pipe pipe)
			{
				_pipe = pipe;
			}

			public override bool TryRead(out ReadResult result)
			{
				return _pipe.TryRead(out result);
			}

			public override ValueTask<ReadResult> ReadAsync(CancellationToken cancellationToken = default(CancellationToken))
			{
				return _pipe.ReadAsync(cancellationToken);
			}

			protected override ValueTask<ReadResult> ReadAtLeastAsyncCore(int minimumBytes, CancellationToken cancellationToken)
			{
				return _pipe.ReadAtLeastAsync(minimumBytes, cancellationToken);
			}

			public override void AdvanceTo(SequencePosition consumed)
			{
				_pipe.AdvanceReader(in consumed);
			}

			public override void AdvanceTo(SequencePosition consumed, SequencePosition examined)
			{
				_pipe.AdvanceReader(in consumed, in examined);
			}

			public override void CancelPendingRead()
			{
				_pipe.CancelPendingRead();
			}

			public override void Complete(Exception exception = null)
			{
				_pipe.CompleteReader(exception);
			}

			public override void OnWriterCompleted(Action<Exception, object> callback, object state)
			{
				_pipe.OnWriterCompleted(callback, state);
			}

			public ValueTaskSourceStatus GetStatus(short token)
			{
				return _pipe.GetReadAsyncStatus();
			}

			public ReadResult GetResult(short token)
			{
				return _pipe.GetReadAsyncResult();
			}

			public void OnCompleted(Action<object> continuation, object state, short token, ValueTaskSourceOnCompletedFlags flags)
			{
				_pipe.OnReadAsyncCompleted(continuation, state, flags);
			}
		}

		private sealed class DefaultPipeWriter : PipeWriter, IValueTaskSource<FlushResult>
		{
			private readonly Pipe _pipe;

			public override bool CanGetUnflushedBytes => true;

			public override long UnflushedBytes => _pipe.GetUnflushedBytes();

			public DefaultPipeWriter(Pipe pipe)
			{
				_pipe = pipe;
			}

			public override void Complete(Exception exception = null)
			{
				_pipe.CompleteWriter(exception);
			}

			public override void CancelPendingFlush()
			{
				_pipe.CancelPendingFlush();
			}

			public override void OnReaderCompleted(Action<Exception, object> callback, object state)
			{
				_pipe.OnReaderCompleted(callback, state);
			}

			public override ValueTask<FlushResult> FlushAsync(CancellationToken cancellationToken = default(CancellationToken))
			{
				return _pipe.FlushAsync(cancellationToken);
			}

			public override void Advance(int bytes)
			{
				_pipe.Advance(bytes);
			}

			public override Memory<byte> GetMemory(int sizeHint = 0)
			{
				return _pipe.GetMemory(sizeHint);
			}

			public override Span<byte> GetSpan(int sizeHint = 0)
			{
				return _pipe.GetSpan(sizeHint);
			}

			public ValueTaskSourceStatus GetStatus(short token)
			{
				return _pipe.GetFlushAsyncStatus();
			}

			public FlushResult GetResult(short token)
			{
				return _pipe.GetFlushAsyncResult();
			}

			public void OnCompleted(Action<object> continuation, object state, short token, ValueTaskSourceOnCompletedFlags flags)
			{
				_pipe.OnFlushAsyncCompleted(continuation, state, flags);
			}

			public override ValueTask<FlushResult> WriteAsync(ReadOnlyMemory<byte> source, CancellationToken cancellationToken = default(CancellationToken))
			{
				return _pipe.WriteAsync(source, cancellationToken);
			}
		}

		private static readonly Action<object> s_signalReaderAwaitable = delegate(object state)
		{
			((Pipe)state).ReaderCancellationRequested();
		};

		private static readonly Action<object> s_signalWriterAwaitable = delegate(object state)
		{
			((Pipe)state).WriterCancellationRequested();
		};

		private static readonly Action<object> s_invokeCompletionCallbacks = delegate(object state)
		{
			((PipeCompletionCallbacks)state).Execute();
		};

		private static readonly ContextCallback s_executionContextRawCallback = ExecuteWithoutExecutionContext;

		private static readonly SendOrPostCallback s_syncContextExecutionContextCallback = ExecuteWithExecutionContext;

		private static readonly SendOrPostCallback s_syncContextExecuteWithoutExecutionContextCallback = ExecuteWithoutExecutionContext;

		private static readonly Action<object> s_scheduleWithExecutionContextCallback = ExecuteWithExecutionContext;

		private BufferSegmentStack _bufferSegmentPool;

		private readonly DefaultPipeReader _reader;

		private readonly DefaultPipeWriter _writer;

		private readonly PipeOptions _options;

		private readonly object _sync = new object();

		private long _unconsumedBytes;

		private long _unflushedBytes;

		private PipeAwaitable _readerAwaitable;

		private PipeAwaitable _writerAwaitable;

		private PipeCompletion _writerCompletion;

		private PipeCompletion _readerCompletion;

		private long _lastExaminedIndex = -1L;

		private BufferSegment _readHead;

		private int _readHeadIndex;

		private bool _disposed;

		private BufferSegment _readTail;

		private int _readTailIndex;

		private int _minimumReadBytes;

		private BufferSegment _writingHead;

		private Memory<byte> _writingHeadMemory;

		private int _writingHeadBytesBuffered;

		private PipeOperationState _operationState;

		private bool UseSynchronizationContext => _options.UseSynchronizationContext;

		private int MinimumSegmentSize => _options.MinimumSegmentSize;

		private long PauseWriterThreshold => _options.PauseWriterThreshold;

		private long ResumeWriterThreshold => _options.ResumeWriterThreshold;

		private PipeScheduler ReaderScheduler => _options.ReaderScheduler;

		private PipeScheduler WriterScheduler => _options.WriterScheduler;

		private object SyncObj => _sync;

		internal long Length => _unconsumedBytes;

		public PipeReader Reader => _reader;

		public PipeWriter Writer => _writer;

		public Pipe()
			: this(PipeOptions.Default)
		{
		}

		public Pipe(PipeOptions options)
		{
			if (options == null)
			{
				ThrowHelper.ThrowArgumentNullException(ExceptionArgument.options);
			}
			_bufferSegmentPool = new BufferSegmentStack(options.InitialSegmentPoolSize);
			_operationState = default(PipeOperationState);
			_readerCompletion = default(PipeCompletion);
			_writerCompletion = default(PipeCompletion);
			_options = options;
			_readerAwaitable = new PipeAwaitable(completed: false, UseSynchronizationContext);
			_writerAwaitable = new PipeAwaitable(completed: true, UseSynchronizationContext);
			_reader = new DefaultPipeReader(this);
			_writer = new DefaultPipeWriter(this);
		}

		private void ResetState()
		{
			_readerCompletion.Reset();
			_writerCompletion.Reset();
			_readerAwaitable = new PipeAwaitable(completed: false, UseSynchronizationContext);
			_writerAwaitable = new PipeAwaitable(completed: true, UseSynchronizationContext);
			_readTailIndex = 0;
			_readHeadIndex = 0;
			_lastExaminedIndex = -1L;
			_unflushedBytes = 0L;
			_unconsumedBytes = 0L;
		}

		internal Memory<byte> GetMemory(int sizeHint)
		{
			if (_writerCompletion.IsCompleted)
			{
				ThrowHelper.ThrowInvalidOperationException_NoWritingAllowed();
			}
			if (sizeHint < 0)
			{
				ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.sizeHint);
			}
			AllocateWriteHeadIfNeeded(sizeHint);
			return _writingHeadMemory;
		}

		internal Span<byte> GetSpan(int sizeHint)
		{
			if (_writerCompletion.IsCompleted)
			{
				ThrowHelper.ThrowInvalidOperationException_NoWritingAllowed();
			}
			if (sizeHint < 0)
			{
				ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.sizeHint);
			}
			AllocateWriteHeadIfNeeded(sizeHint);
			return _writingHeadMemory.Span;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		private void AllocateWriteHeadIfNeeded(int sizeHint)
		{
			if (!_operationState.IsWritingActive || _writingHeadMemory.Length == 0 || _writingHeadMemory.Length < sizeHint)
			{
				AllocateWriteHeadSynchronized(sizeHint);
			}
		}

		private void AllocateWriteHeadSynchronized(int sizeHint)
		{
			lock (SyncObj)
			{
				_operationState.BeginWrite();
				if (_writingHead == null)
				{
					BufferSegment readTail = AllocateSegment(sizeHint);
					_writingHead = (_readHead = (_readTail = readTail));
					_lastExaminedIndex = 0L;
					return;
				}
				int length = _writingHeadMemory.Length;
				if (length == 0 || length < sizeHint)
				{
					if (_writingHeadBytesBuffered > 0)
					{
						_writingHead.End += _writingHeadBytesBuffered;
						_writingHeadBytesBuffered = 0;
					}
					if (_writingHead.Length == 0)
					{
						_writingHead.ResetMemory();
						RentMemory(_writingHead, sizeHint);
					}
					else
					{
						BufferSegment bufferSegment = AllocateSegment(sizeHint);
						_writingHead.SetNext(bufferSegment);
						_writingHead = bufferSegment;
					}
				}
			}
		}

		private BufferSegment AllocateSegment(int sizeHint)
		{
			BufferSegment bufferSegment = CreateSegmentUnsynchronized();
			RentMemory(bufferSegment, sizeHint);
			return bufferSegment;
		}

		private void RentMemory(BufferSegment segment, int sizeHint)
		{
			MemoryPool<byte> memoryPool = null;
			int num = -1;
			if (!_options.IsDefaultSharedMemoryPool)
			{
				memoryPool = _options.Pool;
				num = memoryPool.MaxBufferSize;
			}
			if (sizeHint <= num)
			{
				segment.SetOwnedMemory(memoryPool.Rent(GetSegmentSize(sizeHint, num)));
			}
			else
			{
				int segmentSize = GetSegmentSize(sizeHint);
				segment.SetOwnedMemory(ArrayPool<byte>.Shared.Rent(segmentSize));
			}
			_writingHeadMemory = segment.AvailableMemory;
		}

		private int GetSegmentSize(int sizeHint, int maxBufferSize = int.MaxValue)
		{
			sizeHint = Math.Max(MinimumSegmentSize, sizeHint);
			return Math.Min(maxBufferSize, sizeHint);
		}

		private BufferSegment CreateSegmentUnsynchronized()
		{
			if (_bufferSegmentPool.TryPop(out BufferSegment result))
			{
				return result;
			}
			return new BufferSegment();
		}

		private void ReturnSegmentUnsynchronized(BufferSegment segment)
		{
			if (_bufferSegmentPool.Count < _options.MaxSegmentPoolSize)
			{
				_bufferSegmentPool.Push(segment);
			}
		}

		internal bool CommitUnsynchronized()
		{
			_operationState.EndWrite();
			if (_unflushedBytes == 0L)
			{
				return false;
			}
			_writingHead.End += _writingHeadBytesBuffered;
			_readTail = _writingHead;
			_readTailIndex = _writingHead.End;
			long unconsumedBytes = _unconsumedBytes;
			_unconsumedBytes += _unflushedBytes;
			bool result = true;
			if (_unconsumedBytes < _minimumReadBytes)
			{
				result = false;
			}
			else if (PauseWriterThreshold > 0 && unconsumedBytes < PauseWriterThreshold && _unconsumedBytes >= PauseWriterThreshold && !_readerCompletion.IsCompleted)
			{
				_writerAwaitable.SetUncompleted();
			}
			_unflushedBytes = 0L;
			_writingHeadBytesBuffered = 0;
			return result;
		}

		internal void Advance(int bytes)
		{
			lock (SyncObj)
			{
				if ((uint)bytes > (uint)_writingHeadMemory.Length)
				{
					ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.bytes);
				}
				if (!_readerCompletion.IsCompleted)
				{
					AdvanceCore(bytes);
				}
			}
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		private void AdvanceCore(int bytesWritten)
		{
			_unflushedBytes += bytesWritten;
			_writingHeadBytesBuffered += bytesWritten;
			_writingHeadMemory = _writingHeadMemory.Slice(bytesWritten);
		}

		internal ValueTask<FlushResult> FlushAsync(CancellationToken cancellationToken)
		{
			if (cancellationToken.IsCancellationRequested)
			{
				return new ValueTask<FlushResult>(Task.FromCanceled<FlushResult>(cancellationToken));
			}
			CompletionData completionData;
			ValueTask<FlushResult> result;
			lock (SyncObj)
			{
				PrepareFlushUnsynchronized(out completionData, out result, cancellationToken);
			}
			TrySchedule(ReaderScheduler, in completionData);
			return result;
		}

		private void PrepareFlushUnsynchronized(out CompletionData completionData, out ValueTask<FlushResult> result, CancellationToken cancellationToken)
		{
			bool num = CommitUnsynchronized();
			_writerAwaitable.BeginOperation(cancellationToken, s_signalWriterAwaitable, this);
			if (_writerAwaitable.IsCompleted)
			{
				FlushResult result2 = default(FlushResult);
				GetFlushResult(ref result2);
				result = new ValueTask<FlushResult>(result2);
			}
			else
			{
				result = new ValueTask<FlushResult>(_writer, 0);
			}
			if (num)
			{
				_readerAwaitable.Complete(out completionData);
			}
			else
			{
				completionData = default(CompletionData);
			}
		}

		internal void CompleteWriter(Exception? exception)
		{
			PipeCompletionCallbacks pipeCompletionCallbacks;
			CompletionData completionData;
			bool isCompleted;
			lock (SyncObj)
			{
				CommitUnsynchronized();
				pipeCompletionCallbacks = _writerCompletion.TryComplete(exception);
				_readerAwaitable.Complete(out completionData);
				isCompleted = _readerCompletion.IsCompleted;
			}
			if (isCompleted)
			{
				CompletePipe();
			}
			if (pipeCompletionCallbacks != null)
			{
				ScheduleCallbacks(ReaderScheduler, pipeCompletionCallbacks);
			}
			TrySchedule(ReaderScheduler, in completionData);
		}

		internal void AdvanceReader(in SequencePosition consumed)
		{
			AdvanceReader(in consumed, in consumed);
		}

		internal void AdvanceReader(in SequencePosition consumed, in SequencePosition examined)
		{
			if (_readerCompletion.IsCompleted)
			{
				ThrowHelper.ThrowInvalidOperationException_NoReadingAllowed();
			}
			AdvanceReader((BufferSegment)consumed.GetObject(), consumed.GetInteger(), (BufferSegment)examined.GetObject(), examined.GetInteger());
		}

		private void AdvanceReader(BufferSegment consumedSegment, int consumedIndex, BufferSegment examinedSegment, int examinedIndex)
		{
			if (consumedSegment != null && examinedSegment != null && BufferSegment.GetLength(consumedSegment, consumedIndex, examinedSegment, examinedIndex) < 0)
			{
				ThrowHelper.ThrowInvalidOperationException_InvalidExaminedOrConsumedPosition();
			}
			BufferSegment bufferSegment = null;
			BufferSegment returnEnd = null;
			CompletionData completionData = default(CompletionData);
			lock (SyncObj)
			{
				bool flag = false;
				if (examinedSegment == _readTail)
				{
					flag = examinedIndex == _readTailIndex;
				}
				if (examinedSegment != null && _lastExaminedIndex >= 0)
				{
					long length = BufferSegment.GetLength(_lastExaminedIndex, examinedSegment, examinedIndex);
					long unconsumedBytes = _unconsumedBytes;
					if (length < 0)
					{
						ThrowHelper.ThrowInvalidOperationException_InvalidExaminedPosition();
					}
					_unconsumedBytes -= length;
					_lastExaminedIndex = examinedSegment.RunningIndex + examinedIndex;
					if (unconsumedBytes >= ResumeWriterThreshold && _unconsumedBytes < ResumeWriterThreshold)
					{
						_writerAwaitable.Complete(out completionData);
					}
				}
				if (consumedSegment != null)
				{
					if (_readHead == null)
					{
						ThrowHelper.ThrowInvalidOperationException_AdvanceToInvalidCursor();
						return;
					}
					bufferSegment = _readHead;
					returnEnd = consumedSegment;
					if (consumedIndex == returnEnd.Length)
					{
						if (_writingHead != returnEnd)
						{
							MoveReturnEndToNextBlock();
						}
						else if (_writingHeadBytesBuffered == 0 && !_operationState.IsWritingActive)
						{
							_writingHead = null;
							_writingHeadMemory = default(Memory<byte>);
							MoveReturnEndToNextBlock();
						}
						else
						{
							_readHead = consumedSegment;
							_readHeadIndex = consumedIndex;
						}
					}
					else
					{
						_readHead = consumedSegment;
						_readHeadIndex = consumedIndex;
					}
				}
				if (flag && !_writerCompletion.IsCompleted)
				{
					_readerAwaitable.SetUncompleted();
				}
				while (bufferSegment != null && bufferSegment != returnEnd)
				{
					BufferSegment? nextSegment = bufferSegment.NextSegment;
					bufferSegment.Reset();
					ReturnSegmentUnsynchronized(bufferSegment);
					bufferSegment = nextSegment;
				}
				_operationState.EndRead();
			}
			TrySchedule(WriterScheduler, in completionData);
			void MoveReturnEndToNextBlock()
			{
				BufferSegment nextSegment2 = returnEnd.NextSegment;
				if (_readTail == returnEnd)
				{
					_readTail = nextSegment2;
					_readTailIndex = 0;
				}
				_readHead = nextSegment2;
				_readHeadIndex = 0;
				returnEnd = nextSegment2;
			}
		}

		internal void CompleteReader(Exception? exception)
		{
			PipeCompletionCallbacks pipeCompletionCallbacks;
			CompletionData completionData;
			bool isCompleted;
			lock (SyncObj)
			{
				if (_operationState.IsReadingActive)
				{
					_operationState.EndRead();
				}
				pipeCompletionCallbacks = _readerCompletion.TryComplete(exception);
				_writerAwaitable.Complete(out completionData);
				isCompleted = _writerCompletion.IsCompleted;
			}
			if (isCompleted)
			{
				CompletePipe();
			}
			if (pipeCompletionCallbacks != null)
			{
				ScheduleCallbacks(WriterScheduler, pipeCompletionCallbacks);
			}
			TrySchedule(WriterScheduler, in completionData);
		}

		internal void OnWriterCompleted(Action<Exception?, object?> callback, object? state)
		{
			if (callback == null)
			{
				ThrowHelper.ThrowArgumentNullException(ExceptionArgument.callback);
			}
			PipeCompletionCallbacks pipeCompletionCallbacks;
			lock (SyncObj)
			{
				pipeCompletionCallbacks = _writerCompletion.AddCallback(callback, state);
			}
			if (pipeCompletionCallbacks != null)
			{
				ScheduleCallbacks(ReaderScheduler, pipeCompletionCallbacks);
			}
		}

		internal void CancelPendingRead()
		{
			CompletionData completionData;
			lock (SyncObj)
			{
				_readerAwaitable.Cancel(out completionData);
			}
			TrySchedule(ReaderScheduler, in completionData);
		}

		internal void CancelPendingFlush()
		{
			CompletionData completionData;
			lock (SyncObj)
			{
				_writerAwaitable.Cancel(out completionData);
			}
			TrySchedule(WriterScheduler, in completionData);
		}

		internal void OnReaderCompleted(Action<Exception?, object?> callback, object? state)
		{
			if (callback == null)
			{
				ThrowHelper.ThrowArgumentNullException(ExceptionArgument.callback);
			}
			PipeCompletionCallbacks pipeCompletionCallbacks;
			lock (SyncObj)
			{
				pipeCompletionCallbacks = _readerCompletion.AddCallback(callback, state);
			}
			if (pipeCompletionCallbacks != null)
			{
				ScheduleCallbacks(WriterScheduler, pipeCompletionCallbacks);
			}
		}

		internal ValueTask<ReadResult> ReadAtLeastAsync(int minimumBytes, CancellationToken token)
		{
			if (_readerCompletion.IsCompleted)
			{
				ThrowHelper.ThrowInvalidOperationException_NoReadingAllowed();
			}
			if (token.IsCancellationRequested)
			{
				return new ValueTask<ReadResult>(Task.FromCanceled<ReadResult>(token));
			}
			CompletionData completionData = default(CompletionData);
			ValueTask<ReadResult> result2;
			lock (SyncObj)
			{
				_readerAwaitable.BeginOperation(token, s_signalReaderAwaitable, this);
				if (_readerAwaitable.IsCompleted)
				{
					GetReadResult(out var result);
					if (_unconsumedBytes >= minimumBytes || result.IsCanceled || result.IsCompleted)
					{
						return new ValueTask<ReadResult>(result);
					}
					_readerAwaitable.SetUncompleted();
					_operationState.EndRead();
					_readerAwaitable.BeginOperation(token, s_signalReaderAwaitable, this);
				}
				if (!_writerAwaitable.IsCompleted)
				{
					_writerAwaitable.Complete(out completionData);
				}
				_minimumReadBytes = minimumBytes;
				result2 = new ValueTask<ReadResult>(_reader, 0);
			}
			TrySchedule(WriterScheduler, in completionData);
			return result2;
		}

		internal ValueTask<ReadResult> ReadAsync(CancellationToken token)
		{
			if (_readerCompletion.IsCompleted)
			{
				ThrowHelper.ThrowInvalidOperationException_NoReadingAllowed();
			}
			if (token.IsCancellationRequested)
			{
				return new ValueTask<ReadResult>(Task.FromCanceled<ReadResult>(token));
			}
			lock (SyncObj)
			{
				_readerAwaitable.BeginOperation(token, s_signalReaderAwaitable, this);
				if (_readerAwaitable.IsCompleted)
				{
					GetReadResult(out var result);
					return new ValueTask<ReadResult>(result);
				}
				return new ValueTask<ReadResult>(_reader, 0);
			}
		}

		internal bool TryRead(out ReadResult result)
		{
			lock (SyncObj)
			{
				if (_readerCompletion.IsCompleted)
				{
					ThrowHelper.ThrowInvalidOperationException_NoReadingAllowed();
				}
				if (_unconsumedBytes > 0 || _readerAwaitable.IsCompleted)
				{
					GetReadResult(out result);
					return true;
				}
				if (_readerAwaitable.IsRunning)
				{
					ThrowHelper.ThrowInvalidOperationException_AlreadyReading();
				}
				_operationState.BeginReadTentative();
				result = default(ReadResult);
				return false;
			}
		}

		private static void ScheduleCallbacks(PipeScheduler scheduler, PipeCompletionCallbacks completionCallbacks)
		{
			scheduler.UnsafeSchedule(s_invokeCompletionCallbacks, completionCallbacks);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		private static void TrySchedule(PipeScheduler scheduler, in CompletionData completionData)
		{
			Action<object> completion = completionData.Completion;
			if (completion != null)
			{
				if (completionData.SynchronizationContext == null && completionData.ExecutionContext == null)
				{
					scheduler.UnsafeSchedule(completion, completionData.CompletionState);
				}
				else
				{
					ScheduleWithContext(scheduler, in completionData);
				}
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		private static void ScheduleWithContext(PipeScheduler scheduler, in CompletionData completionData)
		{
			if (completionData.SynchronizationContext == null)
			{
				scheduler.UnsafeSchedule(s_scheduleWithExecutionContextCallback, completionData);
			}
			else if (completionData.ExecutionContext == null)
			{
				completionData.SynchronizationContext.Post(s_syncContextExecuteWithoutExecutionContextCallback, completionData);
			}
			else
			{
				completionData.SynchronizationContext.Post(s_syncContextExecutionContextCallback, completionData);
			}
		}

		private static void ExecuteWithoutExecutionContext(object state)
		{
			CompletionData completionData = (CompletionData)state;
			completionData.Completion(completionData.CompletionState);
		}

		private static void ExecuteWithExecutionContext(object state)
		{
			ExecutionContext.Run(((CompletionData)state).ExecutionContext, s_executionContextRawCallback, state);
		}

		private void CompletePipe()
		{
			lock (SyncObj)
			{
				if (!_disposed)
				{
					_disposed = true;
					BufferSegment bufferSegment = _readHead ?? _readTail;
					while (bufferSegment != null)
					{
						BufferSegment bufferSegment2 = bufferSegment;
						bufferSegment = bufferSegment.NextSegment;
						bufferSegment2.Reset();
					}
					_writingHead = null;
					_writingHeadMemory = default(Memory<byte>);
					_readHead = null;
					_readTail = null;
					_lastExaminedIndex = -1L;
				}
			}
		}

		internal ValueTaskSourceStatus GetReadAsyncStatus()
		{
			if (_readerAwaitable.IsCompleted)
			{
				if (_writerCompletion.IsFaulted)
				{
					return ValueTaskSourceStatus.Faulted;
				}
				return ValueTaskSourceStatus.Succeeded;
			}
			return ValueTaskSourceStatus.Pending;
		}

		internal void OnReadAsyncCompleted(Action<object?> continuation, object? state, ValueTaskSourceOnCompletedFlags flags)
		{
			CompletionData completionData;
			bool doubleCompletion;
			lock (SyncObj)
			{
				_readerAwaitable.OnCompleted(continuation, state, flags, out completionData, out doubleCompletion);
			}
			if (doubleCompletion)
			{
				Writer.Complete(ThrowHelper.CreateInvalidOperationException_NoConcurrentOperation());
			}
			TrySchedule(ReaderScheduler, in completionData);
		}

		internal ReadResult GetReadAsyncResult()
		{
			CancellationTokenRegistration cancellationTokenRegistration = default(CancellationTokenRegistration);
			CancellationToken cancellationToken = default(CancellationToken);
			ReadResult result;
			try
			{
				lock (SyncObj)
				{
					if (!_readerAwaitable.IsCompleted)
					{
						ThrowHelper.ThrowInvalidOperationException_GetResultNotCompleted();
					}
					cancellationTokenRegistration = _readerAwaitable.ReleaseCancellationTokenRegistration(out cancellationToken);
					GetReadResult(out result);
				}
			}
			finally
			{
				cancellationTokenRegistration.Dispose();
			}
			if (result.IsCanceled)
			{
				cancellationToken.ThrowIfCancellationRequested();
			}
			return result;
		}

		private void GetReadResult(out ReadResult result)
		{
			bool isCompleted = _writerCompletion.IsCompletedOrThrow();
			bool flag = _readerAwaitable.ObserveCancellation();
			BufferSegment readHead = _readHead;
			if (readHead != null)
			{
				ReadOnlySequence<byte> buffer = new ReadOnlySequence<byte>(readHead, _readHeadIndex, _readTail, _readTailIndex);
				result = new ReadResult(buffer, flag, isCompleted);
			}
			else
			{
				result = new ReadResult(default(ReadOnlySequence<byte>), flag, isCompleted);
			}
			if (flag)
			{
				_operationState.BeginReadTentative();
			}
			else
			{
				_operationState.BeginRead();
			}
			_minimumReadBytes = 0;
		}

		internal ValueTaskSourceStatus GetFlushAsyncStatus()
		{
			if (_writerAwaitable.IsCompleted)
			{
				if (_readerCompletion.IsFaulted)
				{
					return ValueTaskSourceStatus.Faulted;
				}
				return ValueTaskSourceStatus.Succeeded;
			}
			return ValueTaskSourceStatus.Pending;
		}

		internal FlushResult GetFlushAsyncResult()
		{
			FlushResult result = default(FlushResult);
			CancellationToken cancellationToken = default(CancellationToken);
			CancellationTokenRegistration cancellationTokenRegistration = default(CancellationTokenRegistration);
			try
			{
				lock (SyncObj)
				{
					if (!_writerAwaitable.IsCompleted)
					{
						ThrowHelper.ThrowInvalidOperationException_GetResultNotCompleted();
					}
					GetFlushResult(ref result);
					cancellationTokenRegistration = _writerAwaitable.ReleaseCancellationTokenRegistration(out cancellationToken);
					return result;
				}
			}
			finally
			{
				cancellationTokenRegistration.Dispose();
				cancellationToken.ThrowIfCancellationRequested();
			}
		}

		internal long GetUnflushedBytes()
		{
			return _unflushedBytes;
		}

		private void GetFlushResult(ref FlushResult result)
		{
			if (_writerAwaitable.ObserveCancellation())
			{
				result._resultFlags |= ResultFlags.Canceled;
			}
			if (_readerCompletion.IsCompletedOrThrow())
			{
				result._resultFlags |= ResultFlags.Completed;
			}
		}

		internal ValueTask<FlushResult> WriteAsync(ReadOnlyMemory<byte> source, CancellationToken cancellationToken)
		{
			if (_writerCompletion.IsCompleted)
			{
				ThrowHelper.ThrowInvalidOperationException_NoWritingAllowed();
			}
			if (_readerCompletion.IsCompletedOrThrow())
			{
				return new ValueTask<FlushResult>(new FlushResult(isCanceled: false, isCompleted: true));
			}
			if (cancellationToken.IsCancellationRequested)
			{
				return new ValueTask<FlushResult>(Task.FromCanceled<FlushResult>(cancellationToken));
			}
			CompletionData completionData;
			ValueTask<FlushResult> result;
			lock (SyncObj)
			{
				AllocateWriteHeadIfNeeded(0);
				if (source.Length <= _writingHeadMemory.Length)
				{
					source.CopyTo(_writingHeadMemory);
					AdvanceCore(source.Length);
				}
				else
				{
					WriteMultiSegment(source.Span);
				}
				PrepareFlushUnsynchronized(out completionData, out result, cancellationToken);
			}
			TrySchedule(ReaderScheduler, in completionData);
			return result;
		}

		private void WriteMultiSegment(ReadOnlySpan<byte> source)
		{
			Span<byte> span = _writingHeadMemory.Span;
			while (true)
			{
				int num = Math.Min(span.Length, source.Length);
				source.Slice(0, num).CopyTo(span);
				source = source.Slice(num);
				AdvanceCore(num);
				if (source.Length != 0)
				{
					_writingHead.End += _writingHeadBytesBuffered;
					_writingHeadBytesBuffered = 0;
					BufferSegment bufferSegment = AllocateSegment(0);
					_writingHead.SetNext(bufferSegment);
					_writingHead = bufferSegment;
					span = _writingHeadMemory.Span;
					continue;
				}
				break;
			}
		}

		internal void OnFlushAsyncCompleted(Action<object?> continuation, object? state, ValueTaskSourceOnCompletedFlags flags)
		{
			CompletionData completionData;
			bool doubleCompletion;
			lock (SyncObj)
			{
				_writerAwaitable.OnCompleted(continuation, state, flags, out completionData, out doubleCompletion);
			}
			if (doubleCompletion)
			{
				Reader.Complete(ThrowHelper.CreateInvalidOperationException_NoConcurrentOperation());
			}
			TrySchedule(WriterScheduler, in completionData);
		}

		private void ReaderCancellationRequested()
		{
			CompletionData completionData;
			lock (SyncObj)
			{
				_readerAwaitable.CancellationTokenFired(out completionData);
			}
			TrySchedule(ReaderScheduler, in completionData);
		}

		private void WriterCancellationRequested()
		{
			CompletionData completionData;
			lock (SyncObj)
			{
				_writerAwaitable.CancellationTokenFired(out completionData);
			}
			TrySchedule(WriterScheduler, in completionData);
		}

		public void Reset()
		{
			lock (SyncObj)
			{
				if (!_disposed)
				{
					ThrowHelper.ThrowInvalidOperationException_ResetIncompleteReaderWriter();
				}
				_disposed = false;
				ResetState();
			}
		}
	}
	[DebuggerDisplay("CanceledState = {_awaitableState}, IsCompleted = {IsCompleted}")]
	internal struct PipeAwaitable
	{
		[Flags]
		private enum AwaitableState
		{
			None = 0,
			Completed = 1,
			Running = 2,
			Canceled = 4,
			UseSynchronizationContext = 8
		}

		private sealed class SchedulingContext
		{
			public SynchronizationContext SynchronizationContext { get; set; }

			public ExecutionContext ExecutionContext { get; set; }
		}

		private AwaitableState _awaitableState;

		private Action<object> _completion;

		private object _completionState;

		private SchedulingContext _schedulingContext;

		private CancellationTokenRegistration _cancellationTokenRegistration;

		private CancellationToken _cancellationToken;

		private CancellationToken CancellationToken => _cancellationToken;

		public bool IsCompleted => (_awaitableState & (AwaitableState.Completed | AwaitableState.Canceled)) != 0;

		public bool IsRunning => (_awaitableState & AwaitableState.Running) != 0;

		public PipeAwaitable(bool completed, bool useSynchronizationContext)
		{
			_awaitableState = (completed ? AwaitableState.Completed : AwaitableState.None) | (useSynchronizationContext ? AwaitableState.UseSynchronizationContext : AwaitableState.None);
			_completion = null;
			_completionState = null;
			_cancellationTokenRegistration = default(CancellationTokenRegistration);
			_schedulingContext = null;
			_cancellationToken = CancellationToken.None;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public void BeginOperation(CancellationToken cancellationToken, Action<object?> callback, object? state)
		{
			if (cancellationToken.CanBeCanceled && !IsCompleted)
			{
				_cancellationTokenRegistration = CancellationTokenExtensions.UnsafeRegister(cancellationToken, callback, state);
				if (_cancellationTokenRegistration == default(CancellationTokenRegistration))
				{
					cancellationToken.ThrowIfCancellationRequested();
				}
				_cancellationToken = cancellationToken;
			}
			_awaitableState |= AwaitableState.Running;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public void Complete(out CompletionData completionData)
		{
			ExtractCompletion(out completionData);
			_awaitableState |= AwaitableState.Completed;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		private void ExtractCompletion(out CompletionData completionData)
		{
			Action<object> completion = _completion;
			object completionState = _completionState;
			SchedulingContext schedulingContext = _schedulingContext;
			ExecutionContext executionContext = schedulingContext?.ExecutionContext;
			SynchronizationContext synchronizationContext = schedulingContext?.SynchronizationContext;
			_completion = null;
			_completionState = null;
			_schedulingContext = null;
			completionData = ((completion != null) ? new CompletionData(completion, completionState, executionContext, synchronizationContext) : default(CompletionData));
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public void SetUncompleted()
		{
			_awaitableState &= ~AwaitableState.Completed;
		}

		public void OnCompleted(Action<object?> continuation, object? state, ValueTaskSourceOnCompletedFlags flags, out CompletionData completionData, out bool doubleCompletion)
		{
			completionData = default(CompletionData);
			doubleCompletion = _completion != null;
			if (IsCompleted | doubleCompletion)
			{
				completionData = new CompletionData(continuation, state, _schedulingContext?.ExecutionContext, _schedulingContext?.SynchronizationContext);
				return;
			}
			_completion = continuation;
			_completionState = state;
			if ((_awaitableState & AwaitableState.UseSynchronizationContext) != 0 && (flags & ValueTaskSourceOnCompletedFlags.UseSchedulingContext) != 0)
			{
				SynchronizationContext current = SynchronizationContext.Current;
				if (current != null && current.GetType() != typeof(SynchronizationContext))
				{
					if (_schedulingContext == null)
					{
						_schedulingContext = new SchedulingContext();
					}
					_schedulingContext.SynchronizationContext = current;
				}
			}
			if ((flags & ValueTaskSourceOnCompletedFlags.FlowExecutionContext) != 0)
			{
				if (_schedulingContext == null)
				{
					_schedulingContext = new SchedulingContext();
				}
				_schedulingContext.ExecutionContext = ExecutionContext.Capture();
			}
		}

		public void Cancel(out CompletionData completionData)
		{
			ExtractCompletion(out completionData);
			_awaitableState |= AwaitableState.Canceled;
		}

		public void CancellationTokenFired(out CompletionData completionData)
		{
			if (CancellationToken.IsCancellationRequested)
			{
				Cancel(out completionData);
			}
			else
			{
				completionData = default(CompletionData);
			}
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public bool ObserveCancellation()
		{
			bool result = (_awaitableState & AwaitableState.Canceled) == AwaitableState.Canceled;
			_awaitableState &= ~(AwaitableState.Running | AwaitableState.Canceled);
			return result;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public CancellationTokenRegistration ReleaseCancellationTokenRegistration(out CancellationToken cancellationToken)
		{
			cancellationToken = CancellationToken;
			CancellationTokenRegistration cancellationTokenRegistration = _cancellationTokenRegistration;
			_cancellationToken = default(CancellationToken);
			_cancellationTokenRegistration = default(CancellationTokenRegistration);
			return cancellationTokenRegistration;
		}
	}
	[DebuggerDisplay("IsCompleted = {IsCompleted}")]
	internal struct PipeCompletion
	{
		private static readonly object s_completedSuccessfully = new object();

		private object _state;

		private List<PipeCompletionCallback> _callbacks;

		public bool IsCompleted => _state != null;

		public bool IsFaulted => _state is ExceptionDispatchInfo;

		public PipeCompletionCallbacks? TryComplete(Exception? exception = null)
		{
			if (_state == null)
			{
				if (exception != null)
				{
					_state = ExceptionDispatchInfo.Capture(exception);
				}
				else
				{
					_state = s_completedSuccessfully;
				}
			}
			return GetCallbacks();
		}

		public PipeCompletionCallbacks? AddCallback(Action<Exception?, object?> callback, object? state)
		{
			if (_callbacks == null)
			{
				_callbacks = new List<PipeCompletionCallback>();
			}
			_callbacks.Add(new PipeCompletionCallback(callback, state));
			if (IsCompleted)
			{
				return GetCallbacks();
			}
			return null;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public bool IsCompletedOrThrow()
		{
			if (!IsCompleted)
			{
				return false;
			}
			if (_state is ExceptionDispatchInfo exceptionDispatchInfo)
			{
				exceptionDispatchInfo.Throw();
			}
			return true;
		}

		private PipeCompletionCallbacks GetCallbacks()
		{
			List<PipeCompletionCallback> callbacks = _callbacks;
			if (callbacks == null)
			{
				return null;
			}
			_callbacks = null;
			return new PipeCompletionCallbacks(callbacks, _state as ExceptionDispatchInfo);
		}

		public void Reset()
		{
			_state = null;
		}

		public override string ToString()
		{
			return string.Format("{0}: {1}", "IsCompleted", IsCompleted);
		}
	}
	internal readonly struct PipeCompletionCallback
	{
		public readonly Action<Exception?, object?> Callback;

		public readonly object? State;

		public PipeCompletionCallback(Action<Exception?, object?> callback, object? state)
		{
			Callback = callback;
			State = state;
		}
	}
	internal sealed class PipeCompletionCallbacks
	{
		private readonly List<PipeCompletionCallback> _callbacks;

		private readonly Exception _exception;

		public PipeCompletionCallbacks(List<PipeCompletionCallback> callbacks, ExceptionDispatchInfo? edi)
		{
			_callbacks = callbacks;
			_exception = edi?.SourceException;
		}

		public void Execute()
		{
			int count = _callbacks.Count;
			if (count != 0)
			{
				List<Exception> exceptions = null;
				for (int i = 0; i < count; i++)
				{
					PipeCompletionCallback callback = _callbacks[i];
					Execute(callback, ref exceptions);
				}
				if (exceptions != null)
				{
					throw new AggregateException(exceptions);
				}
			}
		}

		private void Execute(PipeCompletionCallback callback, ref List<Exception> exceptions)
		{
			try
			{
				callback.Callback(_exception, callback.State);
			}
			catch (Exception item)
			{
				if (exceptions == null)
				{
					exceptions = new List<Exception>();
				}
				exceptions.Add(item);
			}
		}
	}
	public class PipeOptions
	{
		private const int DefaultMinimumSegmentSize = 4096;

		public static PipeOptions Default { get; } = new PipeOptions(null, null, null, -1L, -1L);


		public bool UseSynchronizationContext { get; }

		public long PauseWriterThreshold { get; }

		public long ResumeWriterThreshold { get; }

		public int MinimumSegmentSize { get; }

		public PipeScheduler WriterScheduler { get; }

		public PipeScheduler ReaderScheduler { get; }

		public MemoryPool<byte> Pool { get; }

		internal bool IsDefaultSharedMemoryPool { get; }

		internal int InitialSegmentPoolSize { get; }

		internal int MaxSegmentPoolSize { get; }

		public PipeOptions(MemoryPool<byte>? pool = null, PipeScheduler? readerScheduler = null, PipeScheduler? writerScheduler = null, long pauseWriterThreshold = -1L, long resumeWriterThreshold = -1L, int minimumSegmentSize = -1, bool useSynchronizationContext = true)
		{
			MinimumSegmentSize = ((minimumSegmentSize == -1) ? 4096 : minimumSegmentSize);
			InitialSegmentPoolSize = 4;
			MaxSegmentPoolSize = 256;
			if (pauseWriterThreshold == -1)
			{
				pauseWriterThreshold = 65536L;
			}
			else if (pauseWriterThreshold < 0)
			{
				ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.pauseWriterThreshold);
			}
			switch (resumeWriterThreshold)
			{
			case -1L:
				resumeWriterThreshold = 32768L;
				break;
			case 0L:
				resumeWriterThreshold = 1L;
				break;
			}
			if (resumeWriterThreshold < 0 || (pauseWriterThreshold > 0 && resumeWriterThreshold > pauseWriterThreshold))
			{
				ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.resumeWriterThreshold);
			}
			Pool = pool ?? MemoryPool<byte>.Shared;
			IsDefaultSharedMemoryPool = Pool == MemoryPool<byte>.Shared;
			ReaderScheduler = readerScheduler ?? PipeScheduler.ThreadPool;
			WriterScheduler = writerScheduler ?? PipeScheduler.ThreadPool;
			PauseWriterThreshold = pauseWriterThreshold;
			ResumeWriterThreshold = resumeWriterThreshold;
			UseSynchronizationContext = useSynchronizationContext;
		}
	}
	public abstract class PipeReader
	{
		private PipeReaderStream _stream;

		public abstract bool TryRead(out ReadResult result);

		public abstract ValueTask<ReadResult> ReadAsync(CancellationToken cancellationToken = default(CancellationToken));

		public ValueTask<ReadResult> ReadAtLeastAsync(int minimumSize, CancellationToken cancellationToken = default(CancellationToken))
		{
			if (minimumSize < 0)
			{
				ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.minimumSize);
			}
			return ReadAtLeastAsyncCore(minimumSize, cancellationToken);
		}

		protected virtual async ValueTask<ReadResult> ReadAtLeastAsyncCore(int minimumSize, CancellationToken cancellationToken)
		{
			ReadResult result;
			while (true)
			{
				result = await ReadAsync(cancellationToken).ConfigureAwait(continueOnCapturedContext: false);
				ReadOnlySequence<byte> buffer = result.Buffer;
				if (buffer.Length >= minimumSize || result.IsCompleted || result.IsCanceled)
				{
					break;
				}
				AdvanceTo(buffer.Start, buffer.End);
			}
			return result;
		}

		public abstract void AdvanceTo(SequencePosition consumed);

		public abstract void AdvanceTo(SequencePosition consumed, SequencePosition examined);

		public virtual Stream AsStream(bool leaveOpen = false)
		{
			if (_stream == null)
			{
				_stream = new PipeReaderStream(this, leaveOpen);
			}
			else if (leaveOpen)
			{
				_stream.LeaveOpen = leaveOpen;
			}
			return _stream;
		}

		public abstract void CancelPendingRead();

		public abstract void Complete(Exception? exception = null);

		public virtual ValueTask CompleteAsync(Exception? exception = null)
		{
			try
			{
				Complete(exception);
				return default(ValueTask);
			}
			catch (Exception exception2)
			{
				return new ValueTask(Task.FromException(exception2));
			}
		}

		[Obsolete("OnWriterCompleted has been deprecated and may not be invoked on all implementations of PipeReader.")]
		public virtual void OnWriterCompleted(Action<Exception?, object?> callback, object? state)
		{
		}

		public static PipeReader Create(Stream stream, StreamPipeReaderOptions? readerOptions = null)
		{
			return new StreamPipeReader(stream, readerOptions ?? StreamPipeReaderOptions.s_default);
		}

		public static PipeReader Create(ReadOnlySequence<byte> sequence)
		{
			return new SequencePipeReader(sequence);
		}

		public virtual Task CopyToAsync(PipeWriter destination, CancellationToken cancellationToken = default(CancellationToken))
		{
			if (destination == null)
			{
				ThrowHelper.ThrowArgumentNullException(ExceptionArgument.destination);
			}
			if (cancellationToken.IsCancellationRequested)
			{
				return Task.FromCanceled(cancellationToken);
			}
			return CopyToAsyncCore(destination, (PipeWriter destination, ReadOnlyMemory<byte> memory, CancellationToken cancellationToken) => destination.WriteAsync(memory, cancellationToken), cancellationToken);
		}

		public virtual Task CopyToAsync(Stream destination, CancellationToken cancellationToken = default(CancellationToken))
		{
			if (destination == null)
			{
				ThrowHelper.ThrowArgumentNullException(ExceptionArgument.destination);
			}
			if (cancellationToken.IsCancellationRequested)
			{
				return Task.FromCanceled(cancellationToken);
			}
			return CopyToAsyncCore(destination, delegate(Stream destination, ReadOnlyMemory<byte> memory, CancellationToken cancellationToken)
			{
				ValueTask writeTask2 = StreamExtensions.WriteAsync(destination, memory, cancellationToken);
				if (writeTask2.IsCompletedSuccessfully)
				{
					writeTask2.GetAwaiter().GetResult();
					return new ValueTask<FlushResult>(new FlushResult(isCanceled: false, isCompleted: false));
				}
				return Awaited(writeTask2);
			}, cancellationToken);
			static async ValueTask<FlushResult> Awaited(ValueTask writeTask)
			{
				await writeTask.ConfigureAwait(continueOnCapturedContext: false);
				return new FlushResult(isCanceled: false, isCompleted: false);
			}
		}

		private async Task CopyToAsyncCore<TStream>(TStream destination, Func<TStream, ReadOnlyMemory<byte>, CancellationToken, ValueTask<FlushResult>> writeAsync, CancellationToken cancellationToken)
		{
			while (true)
			{
				ReadResult result = await ReadAsync(cancellationToken).ConfigureAwait(continueOnCapturedContext: false);
				ReadOnlySequence<byte> buffer = result.Buffer;
				SequencePosition position = buffer.Start;
				SequencePosition consumed = position;
				try
				{
					if (result.IsCanceled)
					{
						ThrowHelper.ThrowOperationCanceledException_ReadCanceled();
					}
					ReadOnlyMemory<byte> memory;
					while (buffer.TryGet(ref position, out memory))
					{
						if (memory.IsEmpty)
						{
							consumed = position;
							continue;
						}
						FlushResult flushResult = await writeAsync(destination, memory, cancellationToken).ConfigureAwait(continueOnCapturedContext: false);
						if (flushResult.IsCanceled)
						{
							ThrowHelper.ThrowOperationCanceledException_FlushCanceled();
						}
						consumed = position;
						if (!flushResult.IsCompleted)
						{
							continue;
						}
						return;
					}
					consumed = buffer.End;
					if (result.IsCompleted)
					{
						break;
					}
				}
				finally
				{
					AdvanceTo(consumed);
				}
			}
		}
	}
	[DebuggerDisplay("State = {_state}")]
	internal struct PipeOperationState
	{
		[Flags]
		internal enum State : byte
		{
			Reading = 1,
			ReadingTentative = 2,
			Writing = 4
		}

		private State _state;

		public bool IsWritingActive => (_state & State.Writing) == State.Writing;

		public bool IsReadingActive => (_state & State.Reading) == State.Reading;

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public void BeginRead()
		{
			if ((_state & State.Reading) == State.Reading)
			{
				ThrowHelper.ThrowInvalidOperationException_AlreadyReading();
			}
			_state |= State.Reading;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public void BeginReadTentative()
		{
			if ((_state & State.Reading) == State.Reading)
			{
				ThrowHelper.ThrowInvalidOperationException_AlreadyReading();
			}
			_state |= State.ReadingTentative;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public void EndRead()
		{
			if ((_state & State.Reading) != State.Reading && (_state & State.ReadingTentative) != State.ReadingTentative)
			{
				ThrowHelper.ThrowInvalidOperationException_NoReadToComplete();
			}
			_state &= ~(State.Reading | State.ReadingTentative);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public void BeginWrite()
		{
			_state |= State.Writing;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public void EndWrite()
		{
			_state &= ~State.Writing;
		}
	}
	internal sealed class PipeReaderStream : Stream
	{
		private readonly PipeReader _pipeReader;

		public override bool CanRead => true;

		public override bool CanSeek => false;

		public override bool CanWrite => false;

		public override long Length
		{
			get
			{
				throw new NotSupportedException();
			}
		}

		public override long Position
		{
			get
			{
				throw new NotSupportedException();
			}
			set
			{
				throw new NotSupportedException();
			}
		}

		internal bool LeaveOpen { get; set; }

		public PipeReaderStream(PipeReader pipeReader, bool leaveOpen)
		{
			_pipeReader = pipeReader;
			LeaveOpen = leaveOpen;
		}

		protected override void Dispose(bool disposing)
		{
			if (!LeaveOpen)
			{
				_pipeReader.Complete();
			}
			base.Dispose(disposing);
		}

		public override void Flush()
		{
		}

		public override int Read(byte[] buffer, int offset, int count)
		{
			if (buffer == null)
			{
				ThrowHelper.ThrowArgumentNullException(ExceptionArgument.buffer);
			}
			return ReadInternal(new Span<byte>(buffer, offset, count));
		}

		public override int ReadByte()
		{
			Span<byte> buffer = stackalloc byte[1];
			if (ReadInternal(buffer) != 0)
			{
				return buffer[0];
			}
			return -1;
		}

		private int ReadInternal(Span<byte> buffer)
		{
			ValueTask<ReadResult> valueTask = _pipeReader.ReadAsync();
			ReadResult result = (valueTask.IsCompletedSuccessfully ? valueTask.Result : valueTask.AsTask().GetAwaiter().GetResult());
			return HandleReadResult(result, buffer);
		}

		public override long Seek(long offset, SeekOrigin origin)
		{
			throw new NotSupportedException();
		}

		public override void SetLength(long value)
		{
			throw new NotSupportedException();
		}

		public override void Write(byte[] buffer, int offset, int count)
		{
			throw new NotSupportedException();
		}

		public sealed override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback? callback, object? state)
		{
			return TaskToAsyncResult.Begin(ReadAsync(buffer, offset, count, default(CancellationToken)), callback, state);
		}

		public sealed override int EndRead(IAsyncResult asyncResult)
		{
			return TaskToAsyncResult.End<int>(asyncResult);
		}

		public override Task<int> ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
		{
			if (buffer == null)
			{
				ThrowHelper.ThrowArgumentNullException(ExceptionArgument.buffer);
			}
			return ReadAsyncInternal(new Memory<byte>(buffer, offset, count), cancellationToken).AsTask();
		}

		private async ValueTask<int> ReadAsyncInternal(Memory<byte> buffer, CancellationToken cancellationToken)
		{
			return HandleReadResult(await _pipeReader.ReadAsync(cancellationToken).ConfigureAwait(continueOnCapturedContext: false), buffer.Span);
		}

		private int HandleReadResult(ReadResult result, Span<byte> buffer)
		{
			if (result.IsCanceled)
			{
				ThrowHelper.ThrowOperationCanceledException_ReadCanceled();
			}
			ReadOnlySequence<byte> buffer2 = result.Buffer;
			long length = buffer2.Length;
			SequencePosition consumed = buffer2.Start;
			try
			{
				if (length != 0L)
				{
					int num = (int)Math.Min(length, buffer.Length);
					ReadOnlySequence<byte> source = ((num == length) ? buffer2 : buffer2.Slice(0, num));
					consumed = source.End;
					source.CopyTo(buffer);
					return num;
				}
				if (result.IsCompleted)
				{
					return 0;
				}
			}
			finally
			{
				_pipeReader.AdvanceTo(consumed);
			}
			ThrowHelper.ThrowInvalidOperationException_InvalidZeroByteRead();
			return 0;
		}

		public override Task CopyToAsync(Stream destination, int bufferSize, CancellationToken cancellationToken)
		{
			StreamHelpers.ValidateCopyToArgs(this, destination, bufferSize);
			return _pipeReader.CopyToAsync(destination, cancellationToken);
		}
	}
	public abstract class PipeScheduler
	{
		private static readonly ThreadPoolScheduler s_threadPoolScheduler = new ThreadPoolScheduler();

		private static readonly InlineScheduler s_inlineScheduler = new InlineScheduler();

		public static PipeScheduler ThreadPool => s_threadPoolScheduler;

		public static PipeScheduler Inline => s_inlineScheduler;

		public abstract void Schedule(Action<object?> action, object? state);

		internal virtual void UnsafeSchedule(Action<object?> action, object? state)
		{
			Schedule(action, state);
		}
	}
	public abstract class PipeWriter : IBufferWriter<byte>
	{
		private PipeWriterStream _stream;

		public virtual bool CanGetUnflushedBytes => false;

		public virtual long UnflushedBytes
		{
			get
			{
				throw ThrowHelper.CreateNotSupportedException_UnflushedBytes();
			}
		}

		public abstract void Complete(Exception? exception = null);

		public virtual ValueTask CompleteAsync(Exception? exception = null)
		{
			try
			{
				Complete(exception);
				return default(ValueTask);
			}
			catch (Exception exception2)
			{
				return new ValueTask(Task.FromException(exception2));
			}
		}

		public abstract void CancelPendingFlush();

		[Obsolete("OnReaderCompleted has been deprecated and may not be invoked on all implementations of PipeWriter.")]
		public virtual void OnReaderCompleted(Action<Exception?, object?> callback, object? state)
		{
		}

		public abstract ValueTask<FlushResult> FlushAsync(CancellationToken cancellationToken = default(CancellationToken));

		public abstract void Advance(int bytes);

		public abstract Memory<byte> GetMemory(int sizeHint = 0);

		public abstract Span<byte> GetSpan(int sizeHint = 0);

		public virtual Stream AsStream(bool leaveOpen = false)
		{
			if (_stream == null)
			{
				_stream = new PipeWriterStream(this, leaveOpen);
			}
			else if (leaveOpen)
			{
				_stream.LeaveOpen = leaveOpen;
			}
			return _stream;
		}

		public static PipeWriter Create(Stream stream, StreamPipeWriterOptions? writerOptions = null)
		{
			return new StreamPipeWriter(stream, writerOptions ?? StreamPipeWriterOptions.s_default);
		}

		public virtual ValueTask<FlushResult> WriteAsync(ReadOnlyMemory<byte> source, CancellationToken cancellationToken = default(CancellationToken))
		{
			this.Write(source.Span);
			return FlushAsync(cancellationToken);
		}

		protected internal virtual async Task CopyFromAsync(Stream source, CancellationToken cancellationToken = default(CancellationToken))
		{
			FlushResult flushResult;
			do
			{
				Memory<byte> memory = GetMemory();
				int num = await StreamExtensions.ReadAsync(source, memory, cancellationToken).ConfigureAwait(continueOnCapturedContext: false);
				if (num != 0)
				{
					Advance(num);
					flushResult = await FlushAsync(cancellationToken).ConfigureAwait(continueOnCapturedContext: false);
					if (flushResult.IsCanceled)
					{
						ThrowHelper.ThrowOperationCanceledException_FlushCanceled();
					}
					continue;
				}
				break;
			}
			while (!flushResult.IsCompleted);
		}
	}
	internal sealed class PipeWriterStream : Stream
	{
		private readonly PipeWriter _pipeWriter;

		internal bool LeaveOpen { get; set; }

		public override bool CanRead => false;

		public override bool CanSeek => false;

		public override bool CanWrite => true;

		public override long Length
		{
			get
			{
				throw new NotSupportedException();
			}
		}

		public override long Position
		{
			get
			{
				throw new NotSupportedException();
			}
			set
			{
				throw new NotSupportedException();
			}
		}

		public PipeWriterStream(PipeWriter pipeWriter, bool leaveOpen)
		{
			_pipeWriter = pipeWriter;
			LeaveOpen = leaveOpen;
		}

		protected override void Dispose(bool disposing)
		{
			if (!LeaveOpen)
			{
				_pipeWriter.Complete();
			}
		}

		public override void Flush()
		{
			FlushAsync().GetAwaiter().GetResult();
		}

		public override int Read(byte[] buffer, int offset, int count)
		{
			throw new NotSupportedException();
		}

		public override long Seek(long offset, SeekOrigin origin)
		{
			throw new NotSupportedException();
		}

		public override void SetLength(long value)
		{
			throw new NotSupportedException();
		}

		public sealed override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback? callback, object? state)
		{
			return TaskToAsyncResult.Begin(WriteAsync(buffer, offset, count, default(CancellationToken)), callback, state);
		}

		public sealed override void EndWrite(IAsyncResult asyncResult)
		{
			TaskToAsyncResult.End(asyncResult);
		}

		public override void Write(byte[] buffer, int offset, int count)
		{
			WriteAsync(buffer, offset, count).GetAwaiter().GetResult();
		}

		public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
		{
			if (buffer == null)
			{
				ThrowHelper.ThrowArgumentNullException(ExceptionArgument.buffer);
			}
			return GetFlushResultAsTask(_pipeWriter.WriteAsync(new ReadOnlyMemory<byte>(buffer, offset, count), cancellationToken));
		}

		public override Task FlushAsync(CancellationToken cancellationToken)
		{
			return GetFlushResultAsTask(_pipeWriter.FlushAsync(cancellationToken));
		}

		private static Task GetFlushResultAsTask(ValueTask<FlushResult> valueTask)
		{
			if (valueTask.IsCompletedSuccessfully)
			{
				if (valueTask.Result.IsCanceled)
				{
					ThrowHelper.ThrowOperationCanceledException_FlushCanceled();
				}
				return Task.CompletedTask;
			}
			return AwaitTask(valueTask);
			static async Task AwaitTask(ValueTask<FlushResult> valueTask)
			{
				if ((await valueTask.ConfigureAwait(continueOnCapturedContext: false)).IsCanceled)
				{
					ThrowHelper.ThrowOperationCanceledException_FlushCanceled();
				}
			}
		}
	}
	public readonly struct ReadResult
	{
		internal readonly ReadOnlySequence<byte> _resultBuffer;

		internal readonly ResultFlags _resultFlags;

		public ReadOnlySequence<byte> Buffer => _resultBuffer;

		public bool IsCanceled => (_resultFlags & ResultFlags.Canceled) != 0;

		public bool IsCompleted => (_resultFlags & ResultFlags.Completed) != 0;

		public ReadResult(ReadOnlySequence<byte> buffer, bool isCanceled, bool isCompleted)
		{
			_resultBuffer = buffer;
			_resultFlags = ResultFlags.None;
			if (isCompleted)
			{
				_resultFlags |= ResultFlags.Completed;
			}
			if (isCanceled)
			{
				_resultFlags |= ResultFlags.Canceled;
			}
		}
	}
	[Flags]
	internal enum ResultFlags : byte
	{
		None = 0,
		Canceled = 1,
		Completed = 2
	}
	internal sealed class SequencePipeReader : PipeReader
	{
		private ReadOnlySequence<byte> _sequence;

		private bool _isReaderCompleted;

		private int _cancelNext;

		public SequencePipeReader(ReadOnlySequence<byte> sequence)
		{
			_sequence = sequence;
		}

		public override void AdvanceTo(SequencePosition consumed)
		{
			AdvanceTo(consumed, consumed);
		}

		public override void AdvanceTo(SequencePosition consumed, SequencePosition examined)
		{
			ThrowIfCompleted();
			if (consumed.Equals(_sequence.End))
			{
				_sequence = ReadOnlySequence<byte>.Empty;
			}
			else
			{
				_sequence = _sequence.Slice(consumed);
			}
		}

		public override void CancelPendingRead()
		{
			Interlocked.Exchange(ref _cancelNext, 1);
		}

		public override void Complete(Exception? exception = null)
		{
			if (!_isReaderCompleted)
			{
				_isReaderCompleted = true;
				_sequence = ReadOnlySequence<byte>.Empty;
			}
		}

		public override ValueTask<ReadResult> ReadAsync(CancellationToken cancellationToken = default(CancellationToken))
		{
			if (TryRead(out var result))
			{
				return new ValueTask<ReadResult>(result);
			}
			result = new ReadResult(ReadOnlySequence<byte>.Empty, isCanceled: false, isCompleted: true);
			return new ValueTask<ReadResult>(result);
		}

		public override bool TryRead(out ReadResult result)
		{
			ThrowIfCompleted();
			bool flag = Interlocked.Exchange(ref _cancelNext, 0) == 1;
			if (flag || _sequence.Length > 0)
			{
				result = new ReadResult(_sequence, flag, isCompleted: true);
				return true;
			}
			result = default(ReadResult);
			return false;
		}

		private void ThrowIfCompleted()
		{
			if (_isReaderCompleted)
			{
				ThrowHelper.ThrowInvalidOperationException_NoReadingAllowed();
			}
		}
	}
	public static class StreamPipeExtensions
	{
		public static Task CopyToAsync(this Stream source, PipeWriter destination, CancellationToken cancellationToken = default(CancellationToken))
		{
			if (source == null)
			{
				ThrowHelper.ThrowArgumentNullException(ExceptionArgument.source);
			}
			if (destination == null)
			{
				ThrowHelper.ThrowArgumentNullException(ExceptionArgument.destination);
			}
			if (cancellationToken.IsCancellationRequested)
			{
				return Task.FromCanceled(cancellationToken);
			}
			return destination.CopyFromAsync(source, cancellationToken);
		}
	}
	internal sealed class StreamPipeReader : PipeReader
	{
		internal const int InitialSegmentPoolSize = 4;

		internal const int MaxSegmentPoolSize = 256;

		private CancellationTokenSource _internalTokenSource;

		private bool _isReaderCompleted;

		private bool _isStreamCompleted;

		private BufferSegment _readHead;

		private int _readIndex;

		private BufferSegment _readTail;

		private long _bufferedBytes;

		private bool _examinedEverything;

		private readonly object _lock = new object();

		private BufferSegmentStack _bufferSegmentPool;

		private readonly StreamPipeReaderOptions _options;

		private bool LeaveOpen => _options.LeaveOpen;

		private bool UseZeroByteReads => _options.UseZeroByteReads;

		private int BufferSize => _options.BufferSize;

		private int MaxBufferSize => _options.MaxBufferSize;

		private int MinimumReadThreshold => _options.MinimumReadSize;

		private MemoryPool<byte> Pool => _options.Pool;

		public Stream InnerStream { get; }

		private CancellationTokenSource InternalTokenSource
		{
			get
			{
				lock (_lock)
				{
					return _internalTokenSource ?? (_internalTokenSource = new CancellationTokenSource());
				}
			}
		}

		public StreamPipeReader(Stream readingStream, StreamPipeReaderOptions options)
		{
			if (readingStream == null)
			{
				ThrowHelper.ThrowArgumentNullException(ExceptionArgument.readingStream);
			}
			if (options == null)
			{
				ThrowHelper.ThrowArgumentNullException(ExceptionArgument.options);
			}
			InnerStream = readingStream;
			_options = options;
			_bufferSegmentPool = new BufferSegmentStack(4);
		}

		public override void AdvanceTo(SequencePosition consumed)
		{
			AdvanceTo(consumed, consumed);
		}

		public override void AdvanceTo(SequencePosition consumed, SequencePosition examined)
		{
			ThrowIfCompleted();
			AdvanceTo((BufferSegment)consumed.GetObject(), consumed.GetInteger(), (BufferSegment)examined.GetObject(), examined.GetInteger());
		}

		private void AdvanceTo(BufferSegment consumedSegment, int consumedIndex, BufferSegment examinedSegment, int examinedIndex)
		{
			if (consumedSegment != null && examinedSegment != null)
			{
				if (_readHead == null)
				{
					ThrowHelper.ThrowInvalidOperationException_AdvanceToInvalidCursor();
				}
				BufferSegment bufferSegment = _readHead;
				BufferSegment bufferSegment2 = consumedSegment;
				long length = BufferSegment.GetLength(bufferSegment, _readIndex, consumedSegment, consumedIndex);
				_bufferedBytes -= length;
				_examinedEverything = false;
				if (examinedSegment == _readTail)
				{
					_examinedEverything = examinedIndex == _readTail.End;
				}
				if (_bufferedBytes == 0L)
				{
					bufferSegment2 = null;
					_readHead = null;
					_readTail = null;
					_readIndex = 0;
				}
				else if (consumedIndex == bufferSegment2.Length)
				{
					BufferSegment bufferSegment3 = (_readHead = bufferSegment2.NextSegment);
					_readIndex = 0;
					bufferSegment2 = bufferSegment3;
				}
				else
				{
					_readHead = consumedSegment;
					_readIndex = consumedIndex;
				}
				while (bufferSegment != bufferSegment2)
				{
					BufferSegment? nextSegment = bufferSegment.NextSegment;
					ReturnSegmentUnsynchronized(bufferSegment);
					bufferSegment = nextSegment;
				}
			}
		}

		public override void CancelPendingRead()
		{
			InternalTokenSource.Cancel();
		}

		public override void Complete(Exception? exception = null)
		{
			if (CompleteAndGetNeedsDispose())
			{
				InnerStream.Dispose();
			}
		}

		private bool CompleteAndGetNeedsDispose()
		{
			if (_isReaderCompleted)
			{
				return false;
			}
			_isReaderCompleted = true;
			BufferSegment bufferSegment = _readHead;
			while (bufferSegment != null)
			{
				BufferSegment bufferSegment2 = bufferSegment;
				bufferSegment = bufferSegment.NextSegment;
				bufferSegment2.Reset();
			}
			return !LeaveOpen;
		}

		public override ValueTask<ReadResult> ReadAsync(CancellationToken cancellationToken = default(CancellationToken))
		{
			return ReadInternalAsync(null, cancellationToken);
		}

		protected override ValueTask<ReadResult> ReadAtLeastAsyncCore(int minimumSize, CancellationToken cancellationToken)
		{
			return ReadInternalAsync(minimumSize, cancellationToken);
		}

		private ValueTask<ReadResult> ReadInternalAsync(int? minimumSize, CancellationToken cancellationToken)
		{
			ThrowIfCompleted();
			if (cancellationToken.IsCancellationRequested)
			{
				return new ValueTask<ReadResult>(Task.FromCanceled<ReadResult>(cancellationToken));
			}
			CancellationTokenSource internalTokenSource = InternalTokenSource;
			if (TryReadInternal(internalTokenSource, out var result) && (!minimumSize.HasValue || result.Buffer.Length >= minimumSize || result.IsCompleted || result.IsCanceled))
			{
				return new ValueTask<ReadResult>(result);
			}
			if (_isStreamCompleted)
			{
				return new ValueTask<ReadResult>(new ReadResult(default(ReadOnlySequence<byte>), isCanceled: false, isCompleted: true));
			}
			return Core(this, minimumSize, internalTokenSource, cancellationToken);
			static async ValueTask<ReadResult> Core(StreamPipeReader reader, int? minimumSize, CancellationTokenSource tokenSource, CancellationToken cancellationToken)
			{
				CancellationTokenRegistration cancellationTokenRegistration = default(CancellationTokenRegistration);
				if (cancellationToken.CanBeCanceled)
				{
					cancellationTokenRegistration = CancellationTokenExtensions.UnsafeRegister(cancellationToken, delegate(object state)
					{
						((StreamPipeReader)state).Cancel();
					}, reader);
				}
				using (cancellationTokenRegistration)
				{
					bool isCanceled = false;
					try
					{
						if (reader.UseZeroByteReads && reader._bufferedBytes == 0L)
						{
							await StreamExtensions.ReadAsync(reader.InnerStream, Memory<byte>.Empty, tokenSource.Token).ConfigureAwait(continueOnCapturedContext: false);
						}
						do
						{
							reader.AllocateReadTail(minimumSize);
							Memory<byte> buffer = reader._readTail.AvailableMemory.Slice(reader._readTail.End);
							int num = await StreamExtensions.ReadAsync(reader.InnerStream, buffer, tokenSource.Token).ConfigureAwait(continueOnCapturedContext: false);
							reader._readTail.End += num;
							reader._bufferedBytes += num;
							if (num == 0)
							{
								reader._isStreamCompleted = true;
								break;
							}
						}
						while (minimumSize.HasValue && reader._bufferedBytes < minimumSize);
					}
					catch (OperationCanceledException ex)
					{
						reader.ClearCancellationToken();
						if (cancellationToken.IsCancellationRequested)
						{
							throw new OperationCanceledException(ex.Message, ex, cancellationToken);
						}
						if (!tokenSource.IsCancellationRequested)
						{
							throw;
						}
						isCanceled = true;
					}
					return new ReadResult(reader.GetCurrentReadOnlySequence(), isCanceled, reader._isStreamCompleted);
				}
			}
		}

		public override async Task CopyToAsync(PipeWriter destination, CancellationToken cancellationToken = default(CancellationToken))
		{
			ThrowIfCompleted();
			CancellationTokenSource tokenSource = InternalTokenSource;
			if (tokenSource.IsCancellationRequested)
			{
				ThrowHelper.ThrowOperationCanceledException_ReadCanceled();
			}
			CancellationTokenRegistration cancellationTokenRegistration = default(CancellationTokenRegistration);
			if (cancellationToken.CanBeCanceled)
			{
				cancellationTokenRegistration = CancellationTokenExtensions.UnsafeRegister(cancellationToken, delegate(object state)
				{
					((StreamPipeReader)state).Cancel();
				}, this);
			}
			using (cancellationTokenRegistration)
			{
				_ = 1;
				try
				{
					BufferSegment segment = _readHead;
					int start = _readIndex;
					try
					{
						while (segment != null)
						{
							FlushResult flushResult = await destination.WriteAsync(segment.Memory.Slice(start), tokenSource.Token).ConfigureAwait(continueOnCapturedContext: false);
							if (flushResult.IsCanceled)
							{
								ThrowHelper.ThrowOperationCanceledException_FlushCanceled();
							}
							segment = segment.NextSegment;
							start = 0;
							if (flushResult.IsCompleted)
							{
								return;
							}
						}
					}
					finally
					{
						if (segment != null)
						{
							AdvanceTo(segment, segment.End, segment, segment.End);
						}
					}
					if (_isStreamCompleted)
					{
						return;
					}
					await InnerStream.CopyToAsync(destination, tokenSource.Token).ConfigureAwait(continueOnCapturedContext: false);
				}
				catch (OperationCanceledException)
				{
					ClearCancellationToken();
					throw;
				}
			}
		}

		public override async Task CopyToAsync(Stream destination, CancellationToken cancellationToken = default(CancellationToken))
		{
			ThrowIfCompleted();
			CancellationTokenSource tokenSource = InternalTokenSource;
			if (tokenSource.IsCancellationRequested)
			{
				ThrowHelper.ThrowOperationCanceledException_ReadCanceled();
			}
			CancellationTokenRegistration cancellationTokenRegistration = default(CancellationTokenRegistration);
			if (cancellationToken.CanBeCanceled)
			{
				cancellationTokenRegistration = CancellationTokenExtensions.UnsafeRegister(cancellationToken, delegate(object state)
				{
					((StreamPipeReader)state).Cancel();
				}, this);
			}
			using (cancellationTokenRegistration)
			{
				_ = 1;
				try
				{
					BufferSegment segment = _readHead;
					int start = _readIndex;
					try
					{
						while (segment != null)
						{
							await StreamExtensions.WriteAsync(destination, segment.Memory.Slice(start), tokenSource.Token).ConfigureAwait(continueOnCapturedContext: false);
							segment = segment.NextSegment;
							start = 0;
						}
					}
					finally
					{
						if (segment != null)
						{
							AdvanceTo(segment, segment.End, segment, segment.End);
						}
					}
					if (_isStreamCompleted)
					{
						return;
					}
					await StreamExtensions.CopyToAsync(InnerStream, destination, tokenSource.Token).ConfigureAwait(continueOnCapturedContext: false);
				}
				catch (OperationCanceledException)
				{
					ClearCancellationToken();
					throw;
				}
			}
		}

		private void ClearCancellationToken()
		{
			lock (_lock)
			{
				_internalTokenSource = null;
			}
		}

		private void ThrowIfCompleted()
		{
			if (_isReaderCompleted)
			{
				ThrowHelper.ThrowInvalidOperationException_NoReadingAllowed();
			}
		}

		public override bool TryRead(out ReadResult result)
		{
			ThrowIfCompleted();
			return TryReadInternal(InternalTokenSource, out result);
		}

		private bool TryReadInternal(CancellationTokenSource source, out ReadResult result)
		{
			bool isCancellationRequested = source.IsCancellationRequested;
			if (isCancellationRequested || (_bufferedBytes > 0 && (!_examinedEverything || _isStreamCompleted)))
			{
				if (isCancellationRequested)
				{
					ClearCancellationToken();
				}
				ReadOnlySequence<byte> currentReadOnlySequence = GetCurrentReadOnlySequence();
				result = new ReadResult(currentReadOnlySequence, isCancellationRequested, _isStreamCompleted);
				return true;
			}
			result = default(ReadResult);
			return false;
		}

		private ReadOnlySequence<byte> GetCurrentReadOnlySequence()
		{
			if (_readHead != null)
			{
				return new ReadOnlySequence<byte>(_readHead, _readIndex, _readTail, _readTail.End);
			}
			return default(ReadOnlySequence<byte>);
		}

		private void AllocateReadTail(int? minimumSize = null)
		{
			if (_readHead == null)
			{
				_readHead = AllocateSegment(minimumSize);
				_readTail = _readHead;
			}
			else if (_readTail.WritableBytes < MinimumReadThreshold)
			{
				BufferSegment bufferSegment = AllocateSegment(minimumSize);
				_readTail.SetNext(bufferSegment);
				_readTail = bufferSegment;
			}
		}

		private BufferSegment AllocateSegment(int? minimumSize = null)
		{
			BufferSegment bufferSegment = CreateSegmentUnsynchronized();
			int num = minimumSize ?? BufferSize;
			int num2 = ((!_options.IsDefaultSharedMemoryPool) ? _options.Pool.MaxBufferSize : (-1));
			if (num <= num2)
			{
				int segmentSize = GetSegmentSize(num, num2);
				bufferSegment.SetOwnedMemory(_options.Pool.Rent(segmentSize));
			}
			else
			{
				int segmentSize2 = GetSegmentSize(num, MaxBufferSize);
				bufferSegment.SetOwnedMemory(ArrayPool<byte>.Shared.Rent(segmentSize2));
			}
			return bufferSegment;
		}

		private int GetSegmentSize(int sizeHint, int maxBufferSize)
		{
			sizeHint = Math.Max(BufferSize, sizeHint);
			return Math.Min(maxBufferSize, sizeHint);
		}

		private BufferSegment CreateSegmentUnsynchronized()
		{
			if (_bufferSegmentPool.TryPop(out BufferSegment result))
			{
				return result;
			}
			return new BufferSegment();
		}

		private void ReturnSegmentUnsynchronized(BufferSegment segment)
		{
			segment.Reset();
			if (_bufferSegmentPool.Count < 256)
			{
				_bufferSegmentPool.Push(segment);
			}
		}

		private void Cancel()
		{
			InternalTokenSource.Cancel();
		}
	}
	public class StreamPipeReaderOptions
	{
		private const int DefaultBufferSize = 4096;

		internal const int DefaultMaxBufferSize = 2097152;

		private const int DefaultMinimumReadSize = 1024;

		internal static readonly StreamPipeReaderOptions s_default = new StreamPipeReaderOptions();

		public int BufferSize { get; }

		internal int MaxBufferSize { get; } = 2097152;


		public int MinimumReadSize { get; }

		public MemoryPool<byte> Pool { get; }

		public bool LeaveOpen { get; }

		public bool UseZeroByteReads { get; }

		internal bool IsDefaultSharedMemoryPool { get; }

		public StreamPipeReaderOptions(MemoryPool<byte>? pool, int bufferSize, int minimumReadSize, bool leaveOpen)
			: this(pool, bufferSize, minimumReadSize, leaveOpen, useZeroByteReads: false)
		{
		}

		public StreamPipeReaderOptions(MemoryPool<byte>? pool = null, int bufferSize = -1, int minimumReadSize = -1, bool leaveOpen = false, bool useZeroByteReads = false)
		{
			Pool = pool ?? MemoryPool<byte>.Shared;
			IsDefaultSharedMemoryPool = Pool == MemoryPool<byte>.Shared;
			int num;
			if (bufferSize != -1)
			{
				if (bufferSize <= 0)
				{
					throw new ArgumentOutOfRangeException("bufferSize");
				}
				num = bufferSize;
			}
			else
			{
				num = 4096;
			}
			BufferSize = num;
			int num2;
			if (minimumReadSize != -1)
			{
				if (minimumReadSize <= 0)
				{
					throw new ArgumentOutOfRangeException("minimumReadSize");
				}
				num2 = minimumReadSize;
			}
			else
			{
				num2 = 1024;
			}
			MinimumReadSize = num2;
			LeaveOpen = leaveOpen;
			UseZeroByteReads = useZeroByteReads;
		}
	}
	internal sealed class StreamPipeWriter : PipeWriter
	{
		internal const int InitialSegmentPoolSize = 4;

		internal const int MaxSegmentPoolSize = 256;

		private readonly int _minimumBufferSize;

		private BufferSegment _head;

		private BufferSegment _tail;

		private Memory<byte> _tailMemory;

		private int _tailBytesBuffered;

		private int _bytesBuffered;

		private readonly MemoryPool<byte> _pool;

		private readonly int _maxPooledBufferSize;

		private CancellationTokenSource _internalTokenSource;

		private bool _isCompleted;

		private readonly object _lockObject = new object();

		private BufferSegmentStack _bufferSegmentPool;

		private readonly bool _leaveOpen;

		private CancellationTokenSource InternalTokenSource
		{
			get
			{
				lock (_lockObject)
				{
					return _internalTokenSource ?? (_internalTokenSource = new CancellationTokenSource());
				}
			}
		}

		public Stream InnerStream { get; }

		public override bool CanGetUnflushedBytes => true;

		public override long UnflushedBytes => _bytesBuffered;

		public StreamPipeWriter(Stream writingStream, StreamPipeWriterOptions options)
		{
			if (writingStream == null)
			{
				ThrowHelper.ThrowArgumentNullException(ExceptionArgument.writingStream);
			}
			if (options == null)
			{
				ThrowHelper.ThrowArgumentNullException(ExceptionArgument.options);
			}
			InnerStream = writingStream;
			_minimumBufferSize = options.MinimumBufferSize;
			_pool = ((options.Pool == MemoryPool<byte>.Shared) ? null : options.Pool);
			_maxPooledBufferSize = _pool?.MaxBufferSize ?? (-1);
			_bufferSegmentPool = new BufferSegmentStack(4);
			_leaveOpen = options.LeaveOpen;
		}

		public override void Advance(int bytes)
		{
			if ((uint)bytes > (uint)_tailMemory.Length)
			{
				ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.bytes);
			}
			_tailBytesBuffered += bytes;
			_bytesBuffered += bytes;
			_tailMemory = _tailMemory.Slice(bytes);
		}

		public override Memory<byte> GetMemory(int sizeHint = 0)
		{
			if (_isCompleted)
			{
				ThrowHelper.ThrowInvalidOperationException_NoWritingAllowed();
			}
			if (sizeHint < 0)
			{
				ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.sizeHint);
			}
			AllocateMemory(sizeHint);
			return _tailMemory;
		}

		public override Span<byte> GetSpan(int sizeHint = 0)
		{
			if (_isCompleted)
			{
				ThrowHelper.ThrowInvalidOperationException_NoWritingAllowed();
			}
			if (sizeHint < 0)
			{
				ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.sizeHint);
			}
			AllocateMemory(sizeHint);
			return _tailMemory.Span;
		}

		private void AllocateMemory(int sizeHint)
		{
			if (_head == null)
			{
				BufferSegment tail = AllocateSegment(sizeHint);
				_head = (_tail = tail);
				_tailBytesBuffered = 0;
				return;
			}
			int length = _tailMemory.Length;
			if (length == 0 || length < sizeHint)
			{
				if (_tailBytesBuffered > 0)
				{
					_tail.End += _tailBytesBuffered;
					_tailBytesBuffered = 0;
				}
				BufferSegment bufferSegment = AllocateSegment(sizeHint);
				_tail.SetNext(bufferSegment);
				_tail = bufferSegment;
			}
		}

		private BufferSegment AllocateSegment(int sizeHint)
		{
			BufferSegment bufferSegment = CreateSegmentUnsynchronized();
			int maxPooledBufferSize = _maxPooledBufferSize;
			if (sizeHint <= maxPooledBufferSize)
			{
				bufferSegment.SetOwnedMemory(_pool.Rent(GetSegmentSize(sizeHint, maxPooledBufferSize)));
			}
			else
			{
				int segmentSize = GetSegmentSize(sizeHint);
				bufferSegment.SetOwnedMemory(ArrayPool<byte>.Shared.Rent(segmentSize));
			}
			_tailMemory = bufferSegment.AvailableMemory;
			return bufferSegment;
		}

		private int GetSegmentSize(int sizeHint, int maxBufferSize = int.MaxValue)
		{
			sizeHint = Math.Max(_minimumBufferSize, sizeHint);
			return Math.Min(maxBufferSize, sizeHint);
		}

		private BufferSegment CreateSegmentUnsynchronized()
		{
			if (_bufferSegmentPool.TryPop(out BufferSegment result))
			{
				return result;
			}
			return new BufferSegment();
		}

		private void ReturnSegmentUnsynchronized(BufferSegment segment)
		{
			segment.Reset();
			if (_bufferSegmentPool.Count < 256)
			{
				_bufferSegmentPool.Push(segment);
			}
		}

		public override void CancelPendingFlush()
		{
			Cancel();
		}

		public override void Complete(Exception? exception = null)
		{
			if (_isCompleted)
			{
				return;
			}
			_isCompleted = true;
			try
			{
				FlushInternal(exception == null);
			}
			finally
			{
				_internalTokenSource?.Dispose();
				if (!_leaveOpen)
				{
					InnerStream.Dispose();
				}
			}
		}

		public override async ValueTask CompleteAsync(Exception? exception = null)
		{
			if (_isCompleted)
			{
				return;
			}
			_isCompleted = true;
			try
			{
				await FlushAsyncInternal(exception == null, Memory<byte>.Empty).ConfigureAwait(continueOnCapturedContext: false);
			}
			finally
			{
				_internalTokenSource?.Dispose();
				if (!_leaveOpen)
				{
					InnerStream.Dispose();
				}
			}
		}

		public override ValueTask<FlushResult> FlushAsync(CancellationToken cancellationToken = default(CancellationToken))
		{
			if (_bytesBuffered == 0)
			{
				return new ValueTask<FlushResult>(new FlushResult(isCanceled: false, isCompleted: false));
			}
			return FlushAsyncInternal(writeToStream: true, Memory<byte>.Empty, cancellationToken);
		}

		public override ValueTask<FlushResult> WriteAsync(ReadOnlyMemory<byte> source, CancellationToken cancellationToken = default(CancellationToken))
		{
			return FlushAsyncInternal(writeToStream: true, source, cancellationToken);
		}

		private void Cancel()
		{
			InternalTokenSource.Cancel();
		}

		private async ValueTask<FlushResult> FlushAsyncInternal(bool writeToStream, ReadOnlyMemory<byte> data, CancellationToken cancellationToken = default(CancellationToken))
		{
			CancellationTokenRegistration cancellationTokenRegistration = default(CancellationTokenRegistration);
			if (cancellationToken.CanBeCanceled)
			{
				cancellationTokenRegistration = CancellationTokenExtensions.UnsafeRegister(cancellationToken, delegate(object state)
				{
					((StreamPipeWriter)state).Cancel();
				}, this);
			}
			if (_tailBytesBuffered > 0)
			{
				_tail.End += _tailBytesBuffered;
				_tailBytesBuffered = 0;
			}
			using (cancellationTokenRegistration)
			{
				CancellationToken localToken = InternalTokenSource.Token;
				try
				{
					BufferSegment segment = _head;
					while (segment != null)
					{
						BufferSegment returnSegment = segment;
						segment = segment.NextSegment;
						if (returnSegment.Length > 0 && writeToStream)
						{
							await StreamExtensions.WriteAsync(InnerStream, returnSegment.Memory, localToken).ConfigureAwait(continueOnCapturedContext: false);
						}
						ReturnSegmentUnsynchronized(returnSegment);
						_head = segment;
					}
					if (writeToStream)
					{
						if (data.Length > 0)
						{
							await StreamExtensions.WriteAsync(InnerStream, data, localToken).ConfigureAwait(continueOnCapturedContext: false);
						}
						if (_bytesBuffered > 0 || data.Length > 0)
						{
							await InnerStream.FlushAsync(localToken).ConfigureAwait(continueOnCapturedContext: false);
						}
					}
					_head = null;
					_tail = null;
					_tailMemory =

Microsoft.Extensions.Configuration.Json.dll

Decompiled 2 weeks 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(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[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. This package enables you to read your application's settings from a JSON file. You can use JsonConfigurationExtensions.AddJsonFile extension method on IConfigurationBuilder to add the JSON configuration provider to the configuration builder.")]
[assembly: AssemblyFileVersion("9.0.225.6610")]
[assembly: AssemblyInformationalVersion("9.0.2+80aa709f5d919c6814726788dc6dabe23e79e672")]
[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("9.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);
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static string IfNullOrWhitespace(string? argument, [CallerArgumentExpression("argument")] string paramName = "")
		{
			if (argument == null)
			{
				throw new ArgumentNullException(paramName);
			}
			if (string.IsNullOrWhiteSpace(argument))
			{
				if (argument == null)
				{
					throw new ArgumentNullException(paramName);
				}
				throw new ArgumentException(paramName, "Argument is whitespace");
			}
			return argument;
		}
	}
	internal static class SR
	{
		private static readonly bool s_usingResourceKeys = GetUsingResourceKeysSwitchValue();

		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 GetUsingResourceKeysSwitchValue()
		{
			if (!AppContext.TryGetSwitch("System.Resources.UseSystemResourceKeys", out var isEnabled))
			{
				return false;
			}
			return isEnabled;
		}

		internal static bool UsingResourceKeys()
		{
			return s_usingResourceKeys;
		}

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

		private 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.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)
			{
				s.FileProvider = provider2;
				s.Path = path2;
				s.Optional = optional;
				s.ReloadOnChange = reloadOnChange;
				s.ResolveFileProvider();
			});
		}

		public static IConfigurationBuilder AddJsonFile(this IConfigurationBuilder builder, Action<JsonConfigurationSource>? configureSource)
		{
			return builder.Add(configureSource);
		}

		public static IConfigurationBuilder AddJsonStream(this IConfigurationBuilder builder, Stream stream)
		{
			Stream stream2 = stream;
			System.ThrowHelper.ThrowIfNull(builder, "builder");
			return builder.Add(delegate(JsonStreamConfigurationSource s)
			{
				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 Dictionary<string, string> ParseStream(Stream input)
		{
			JsonDocumentOptions jsonDocumentOptions = default(JsonDocumentOptions);
			jsonDocumentOptions.CommentHandling = JsonCommentHandling.Skip;
			jsonDocumentOptions.AllowTrailingCommas = true;
			JsonDocumentOptions options = jsonDocumentOptions;
			using (StreamReader streamReader = new StreamReader(input))
			{
				using JsonDocument jsonDocument = JsonDocument.Parse(streamReader.ReadToEnd(), options);
				if (jsonDocument.RootElement.ValueKind != JsonValueKind.Object)
				{
					throw new FormatException(System.SR.Format(System.SR.Error_InvalidTopLevelJSONElement, jsonDocument.RootElement.ValueKind));
				}
				VisitObjectElement(jsonDocument.RootElement);
			}
			return _data;
		}

		private void VisitObjectElement(JsonElement element)
		{
			bool nullIfElementIsEmpty = true;
			foreach (JsonProperty item in element.EnumerateObject())
			{
				nullIfElementIsEmpty = false;
				EnterContext(item.Name);
				VisitValue(item.Value);
				ExitContext();
			}
			SetNullIfElementIsEmpty(nullIfElementIsEmpty);
		}

		private void VisitArrayElement(JsonElement element)
		{
			int num = 0;
			foreach (JsonElement item in element.EnumerateArray())
			{
				EnterContext(num.ToString());
				VisitValue(item);
				ExitContext();
				num++;
			}
			SetNullIfElementIsEmpty(num == 0);
		}

		private void SetNullIfElementIsEmpty(bool isEmpty)
		{
			if (isEmpty && _paths.Count > 0)
			{
				_data[_paths.Peek()] = null;
			}
		}

		private void VisitValue(JsonElement value)
		{
			switch (value.ValueKind)
			{
			case JsonValueKind.Object:
				VisitObjectElement(value);
				break;
			case JsonValueKind.Array:
				VisitArrayElement(value);
				break;
			case JsonValueKind.String:
			case JsonValueKind.Number:
			case JsonValueKind.True:
			case JsonValueKind.False:
			case JsonValueKind.Null:
			{
				string text = _paths.Peek();
				if (_data.ContainsKey(text))
				{
					throw new FormatException(System.SR.Format(System.SR.Error_KeyIsDuplicated, text));
				}
				_data[text] = value.ToString();
				break;
			}
			default:
				throw new FormatException(System.SR.Format(System.SR.Error_UnsupportedJSONToken, 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(source)
		{
		}

		public override void Load(Stream stream)
		{
			try
			{
				base.Data = JsonConfigurationFileParser.Parse(stream);
			}
			catch (JsonException innerException)
			{
				throw new FormatException(System.SR.Error_JSONParseError, innerException);
			}
		}
	}
	public class JsonConfigurationSource : FileConfigurationSource
	{
		public override IConfigurationProvider Build(IConfigurationBuilder builder)
		{
			EnsureDefaults(builder);
			return new JsonConfigurationProvider(this);
		}
	}
	public class JsonStreamConfigurationProvider : StreamConfigurationProvider
	{
		public JsonStreamConfigurationProvider(JsonStreamConfigurationSource source)
			: base(source)
		{
		}

		public override void Load(Stream stream)
		{
			base.Data = JsonConfigurationFileParser.Parse(stream);
		}
	}
	public class JsonStreamConfigurationSource : StreamConfigurationSource
	{
		public override IConfigurationProvider Build(IConfigurationBuilder builder)
		{
			return new JsonStreamConfigurationProvider(this);
		}
	}
}