Decompiled source of SlopCrew v2.2.0

BepInEx/plugins/SlopCrew.Plugin/CrewBoomAPI.dll

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

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

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

		public readonly string GraffitiName;

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

		public static bool IsInitialized { get; private set; }

		public static CharacterInfo PlayerCharacterInfo { get; private set; }

		public static event Action OnInitialized;

		public static event Action<Guid> OnOverride;

		public static event Action<CharacterInfo> OnPlayerCharacterInfoChanged;

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

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

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

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

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

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

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

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

		public string Url { get; set; }

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

		public string CheckId { get; }

		public string Scope { get; set; }

		public string Target { get; set; }

		public string MessageId { get; set; }

		public string Justification { get; set; }

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

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

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

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

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

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

		private readonly ReadOnlyMemory<byte> bytes;

		public static ByteString Empty => empty;

		public int Length => bytes.Length;

		public bool IsEmpty => Length == 0;

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

		public ReadOnlyMemory<byte> Memory => bytes;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

		private readonly byte[] buffer;

		private readonly Stream input;

		private ParserInternalState state;

		internal const int DefaultRecursionLimit = 100;

		internal const int DefaultSizeLimit = int.MaxValue;

		internal const int BufferSize = 4096;

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

		internal uint LastTag => state.lastTag;

		public int SizeLimit => state.sizeLimit;

		public int RecursionLimit => state.recursionLimit;

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

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

		internal byte[] InternalBuffer => buffer;

		internal Stream InternalInputStream => input;

		internal ref ParserInternalState InternalState => ref state;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

		private const int LittleEndian64Size = 8;

		private const int LittleEndian32Size = 4;

		internal const int DoubleSize = 8;

		internal const int FloatSize = 4;

		internal const int BoolSize = 1;

		public static readonly int DefaultBufferSize = 4096;

		private readonly bool leaveOpen;

		private readonly byte[] buffer;

		private WriterInternalState state;

		private readonly Stream output;

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

		public bool Deterministic { get; set; }

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

		internal byte[] InternalBuffer => buffer;

		internal Stream InternalOutputStream => output;

		internal ref WriterInternalState InternalState => ref state;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

		public int FieldNumber { get; }

		internal abstract bool IsRepeated { get; }

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

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

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

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

		internal override bool IsRepeated => false;

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

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

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

		internal override bool IsRepeated => true;

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

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

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

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

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

		public int Count => extensions.Count;

		bool ICollection<Extension>.IsReadOnly => false;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


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

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

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

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

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

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

		void MergeFrom(IExtensionValue value);

		void WriteTo(ref WriteContext ctx);

		int CalculateSize();

		bool IsInitialized();

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

		private readonly FieldCodec<T> codec;

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

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

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

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

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

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

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

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

		public T GetValue()
		{
			return field;
		}

		object IExtensionValue.GetValue()
		{
			return field;
		}

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

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

		private readonly FieldCodec<T> codec;

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

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

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

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

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

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

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

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

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

		object IExtensionValue.GetValue()
		{
			return field;
		}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

		private static readonly EqualityComparer<T> EqualityComparer;

		private static readonly T DefaultDefault;

		private static readonly bool TypeSupportsPacking;

		private readonly int tagSize;

		internal bool PackedRepeatedField { get; }

		internal ValueWriter<T> ValueWriter { get; }

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

		internal ValueReader<T> ValueReader { get; }

		internal InputMerger ValueMerger { get; }

		internal ValuesMerger FieldMerger { get; }

		internal int FixedSize { get; }

		internal uint Tag { get; }

		internal uint EndTag { get; }

		internal T DefaultValue { get; }

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

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

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

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

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

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

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

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

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

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

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

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

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

		}

		private const char FIELD_PATH_SEPARATOR = '.';

		private readonly Node root = new Node();

		public FieldMaskTree()
		{
		}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

		void MergeFrom(CodedInputStream input);

		void WriteTo(CodedOutputStream output);

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

			public bool FormatDefaultValues { get; }

			public TypeRegistry TypeRegistry { get; }

			public bool FormatEnumsAsIntegers { get; }

			public bool PreserveProtoFieldNames { get; }

			public string Indentation { get; }

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

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

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

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

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

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

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

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

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

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

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

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

		internal const string AnyTypeUrlField = "@type";

		internal const string AnyDiagnosticValueField = "@value";

		internal const string AnyWellKnownTypeValueField = "value";

		private const string NameValueSeparator = ": ";

		private const string ValueSeparator = ", ";

		private const string MultilineValueSeparator = ",";

		private const char ObjectOpenBracket = '{';

		private const char ObjectCloseBracket = '}';

		private const char ListBracketOpen = '[';

		private const char ListBracketClose = ']';

		private static readonly JsonFormatter diagnosticFormatter;

		private static readonly string[] CommonRepresentations;

		private readonly Settings settings;

		private const string Hex = "0123456789abcdef";

		public static JsonFormatter Default { get; }

		private bool DiagnosticOnly => this == diagnosticFormatter;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

			public int RecursionLimit { get; }

			public TypeRegistry TypeRegistry { get; }

			public bool IgnoreUnknownFields { get; }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class NullablePublicOnlyAttribute : Attribute
	{
		public readonly bool IncludesInternals;

		public NullablePublicOnlyAttribute(bool P_0)
		{
			IncludesInternals = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace System
{
	public interface IAsyncDisposable
	{
		ValueTask DisposeAsync();
	}
}
namespace System.Diagnostics.CodeAnalysis
{
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)]
	internal sealed class AllowNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)]
	internal sealed class DisallowNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)]
	internal sealed class MaybeNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)]
	internal sealed class NotNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	internal sealed class MaybeNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

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

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

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

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

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

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

		public string[] Members { get; }

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

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

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

		public string EntryPoint { get; set; }

		public StringMarshalling StringMarshalling { get; set; }

		public Type StringMarshallingCustomType { get; set; }

		public bool SetLastError { get; set; }

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

		private object _id;

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

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

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

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

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

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

		private readonly bool _continueOnCapturedContext;

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

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

			private readonly bool _continueOnCapturedContext;

			public T Current => _enumerator.Current;

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

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

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

		private readonly IAsyncEnumerable<T> _enumerable;

		private readonly CancellationToken _cancellationToken;

		private readonly bool _continueOnCapturedContext;

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

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

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

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

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

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

		private object _continuationState;

		private ExecutionContext _executionContext;

		private object _capturedContext;

		private bool _completed;

		private TResult _result;

		private ExceptionDispatchInfo _error;

		private short _version;

		public bool RunContinuationsAsynchronously { get; set; }

		public short Version => _version;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class NullablePublicOnlyAttribute : Attribute
	{
		public readonly bool IncludesInternals;

		public NullablePublicOnlyAttribute(bool P_0)
		{
			IncludesInternals = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace FxResources.Microsoft.Extensions.Configuration.Abstractions
{
	internal static class SR
	{
	}
}
namespace System
{
	internal static class ThrowHelper
	{
		internal static void ThrowIfNull(object argument, [CallerArgumentExpression("argument")] string paramName = null)
		{
			if (argument == null)
			{
				Throw(paramName);
			}
		}

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

		private static ResourceManager s_resourceManager;

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

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

		private static bool UsingResourceKeys()
		{
			return s_usingResourceKeys;
		}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

		public string[] Members { get; }

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

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

		public string EntryPoint { get; set; }

		public StringMarshalling StringMarshalling { get; set; }

		public Type StringMarshallingCustomType { get; set; }

		public bool SetLastError { get; set; }

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

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

		public string Key { get; }

		public string? Value { get; }

		public IConfigurationProvider ConfigurationProvider { get; }

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

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

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

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

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

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

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

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

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

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

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

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

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

		IConfigurationSection GetSection(string key);

		IEnumerable<IConfigurationSection> GetChildren();

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

		IList<IConfigurationSource> Sources { get; }

		IConfigurationBuilder Add(IConfigurationSource source);

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

		void Set(string key, string? value);

		IChangeToken GetReloadToken();

		void Load();

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

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

		string Path { get; }

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

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

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

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: InternalsVisibleTo("Microsoft.Extensions.Configuration.Binder.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: AssemblyMetadata(".NETFrameworkAssembly", "")]
[assembly: AssemblyMetadata("Serviceable", "True")]
[assembly: AssemblyMetadata("PreferInbox", "True")]
[assembly: AssemblyDefaultAlias("Microsoft.Extensions.Configuration.Binder")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: CLSCompliant(true)]
[assembly: AssemblyMetadata("IsTrimmable", "True")]
[assembly: DefaultDllImportSearchPaths(DllImportSearchPath.System32 | DllImportSearchPath.AssemblyDirectory)]
[assembly: AssemblyCompany("Microsoft Corporation")]
[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")]
[assembly: AssemblyDescription("Functionality to bind an object to data in configuration providers for Microsoft.Extensions.Configuration.")]
[assembly: AssemblyFileVersion("7.0.323.6910")]
[assembly: AssemblyInformationalVersion("7.0.3+0a2bda10e81d901396c3cff95533529e3a93ad47")]
[assembly: AssemblyProduct("Microsoft® .NET")]
[assembly: AssemblyTitle("Microsoft.Extensions.Configuration.Binder")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/dotnet/runtime")]
[assembly: AssemblyVersion("7.0.0.3")]
[module: RefSafetyRules(11)]
[module: System.Runtime.CompilerServices.NullablePublicOnly(true)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class NullablePublicOnlyAttribute : Attribute
	{
		public readonly bool IncludesInternals;

		public NullablePublicOnlyAttribute(bool P_0)
		{
			IncludesInternals = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace FxResources.Microsoft.Extensions.Configuration.Binder
{
	internal static class SR
	{
	}
}
namespace System
{
	internal static class ThrowHelper
	{
		internal static void ThrowIfNull(object? argument, [CallerArgumentExpression("argument")] string? paramName = null)
		{
			if (argument == null)
			{
				Throw(paramName);
			}
		}

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

		private static ResourceManager s_resourceManager;

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

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

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

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

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

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

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

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

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

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

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

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

		private static bool UsingResourceKeys()
		{
			return s_usingResourceKeys;
		}

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

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

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

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

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

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

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

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

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

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

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

		public string? Url { get; set; }

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

		public string CheckId { get; }

		public string? Scope { get; set; }

		public string? Target { g