Decompiled source of Bendy and the Archipelago Machine v1.3.0

BepInEx/plugins/BendyAndTheArchipelagoMachine/Archipelago.MultiClient.Net.dll

Decompiled 3 weeks ago
using System;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.WebSockets;
using System.Numerics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Runtime.Versioning;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Archipelago.MultiClient.Net.Colors;
using Archipelago.MultiClient.Net.ConcurrentCollection;
using Archipelago.MultiClient.Net.Converters;
using Archipelago.MultiClient.Net.DataPackage;
using Archipelago.MultiClient.Net.Enums;
using Archipelago.MultiClient.Net.Exceptions;
using Archipelago.MultiClient.Net.Extensions;
using Archipelago.MultiClient.Net.Helpers;
using Archipelago.MultiClient.Net.MessageLog.Messages;
using Archipelago.MultiClient.Net.MessageLog.Parts;
using Archipelago.MultiClient.Net.Models;
using Archipelago.MultiClient.Net.Packets;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Serialization;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: ComVisible(false)]
[assembly: Guid("35a803ad-85ed-42e9-b1e3-c6b72096f0c1")]
[assembly: InternalsVisibleTo("Archipelago.MultiClient.Net.Tests")]
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")]
[assembly: TargetFramework(".NETFramework,Version=v4.5", FrameworkDisplayName = ".NET Framework 4.5")]
[assembly: AssemblyCompany("Jarno Westhof, Hussein Farran, Zach Parks")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyCopyright("Copyright © 2026")]
[assembly: AssemblyDescription("A client library for use with .NET based prog-langs for interfacing with Archipelago hosts.")]
[assembly: AssemblyFileVersion("6.7.1.0")]
[assembly: AssemblyInformationalVersion("6.7.1+0c57591db30f2497b0b4fef87164aa2bbe2e51b2")]
[assembly: AssemblyProduct("Archipelago.MultiClient.Net")]
[assembly: AssemblyTitle("Archipelago.MultiClient.Net")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/ArchipelagoMW/Archipelago.MultiClient.Net")]
[assembly: AssemblyVersion("6.7.1.0")]
internal interface IConcurrentHashSet<T>
{
	bool TryAdd(T item);

	bool Contains(T item);

	void UnionWith(T[] otherSet);

	T[] ToArray();

	ReadOnlyCollection<T> AsToReadOnlyCollection();

	ReadOnlyCollection<T> AsToReadOnlyCollectionExcept(IConcurrentHashSet<T> otherSet);
}
public class AttemptingStringEnumConverter : StringEnumConverter
{
	public AttemptingStringEnumConverter()
	{
	}

	public AttemptingStringEnumConverter(Type namingStrategyType)
		: base(namingStrategyType)
	{
	}

	public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
	{
		try
		{
			return ((StringEnumConverter)this).ReadJson(reader, objectType, existingValue, serializer);
		}
		catch (JsonSerializationException)
		{
			return objectType.IsValueType ? Activator.CreateInstance(objectType) : null;
		}
	}
}
namespace Archipelago.MultiClient.Net
{
	[Serializable]
	public abstract class ArchipelagoPacketBase
	{
		[JsonIgnore]
		internal JObject jobject;

		[JsonProperty("cmd")]
		[JsonConverter(typeof(StringEnumConverter))]
		public abstract ArchipelagoPacketType PacketType { get; }

		public JObject ToJObject()
		{
			return jobject;
		}
	}
	public interface IArchipelagoSession : IArchipelagoSessionActions
	{
		IArchipelagoSocketHelper Socket { get; }

		IReceivedItemsHelper Items { get; }

		ILocationCheckHelper Locations { get; }

		IPlayerHelper Players { get; }

		IDataStorageHelper DataStorage { get; }

		IConnectionInfoProvider ConnectionInfo { get; }

		IRoomStateHelper RoomState { get; }

		IMessageLogHelper MessageLog { get; }

		IHintsHelper Hints { get; }

		Task<RoomInfoPacket> ConnectAsync();

		Task<LoginResult> LoginAsync(string game, string name, ItemsHandlingFlags itemsHandlingFlags, Version version = null, string[] tags = null, string uuid = null, string password = null, bool requestSlotData = true);

		LoginResult TryConnectAndLogin(string game, string name, ItemsHandlingFlags itemsHandlingFlags, Version version = null, string[] tags = null, string uuid = null, string password = null, bool requestSlotData = true);
	}
	public class ArchipelagoSession : IArchipelagoSession, IArchipelagoSessionActions
	{
		private const int ArchipelagoConnectionTimeoutInSeconds = 4;

		private ConnectionInfoHelper connectionInfo;

		private TaskCompletionSource<LoginResult> loginResultTask = new TaskCompletionSource<LoginResult>();

		private TaskCompletionSource<RoomInfoPacket> roomInfoPacketTask = new TaskCompletionSource<RoomInfoPacket>();

		public IArchipelagoSocketHelper Socket { get; }

		public IReceivedItemsHelper Items { get; }

		public ILocationCheckHelper Locations { get; }

		public IPlayerHelper Players { get; }

		public IDataStorageHelper DataStorage { get; }

		public IConnectionInfoProvider ConnectionInfo => connectionInfo;

		public IRoomStateHelper RoomState { get; }

		public IMessageLogHelper MessageLog { get; }

		public IHintsHelper Hints { get; }

		internal ArchipelagoSession(IArchipelagoSocketHelper socket, IReceivedItemsHelper items, ILocationCheckHelper locations, IPlayerHelper players, IRoomStateHelper roomState, ConnectionInfoHelper connectionInfoHelper, IDataStorageHelper dataStorage, IMessageLogHelper messageLog, IHintsHelper createHints)
		{
			Socket = socket;
			Items = items;
			Locations = locations;
			Players = players;
			RoomState = roomState;
			connectionInfo = connectionInfoHelper;
			DataStorage = dataStorage;
			MessageLog = messageLog;
			Hints = createHints;
			socket.PacketReceived += Socket_PacketReceived;
		}

		private void Socket_PacketReceived(ArchipelagoPacketBase packet)
		{
			if (!(packet is ConnectedPacket) && !(packet is ConnectionRefusedPacket))
			{
				if (packet is RoomInfoPacket result)
				{
					roomInfoPacketTask.TrySetResult(result);
				}
			}
			else
			{
				loginResultTask.TrySetResult(LoginResult.FromPacket(packet));
			}
		}

		public Task<RoomInfoPacket> ConnectAsync()
		{
			roomInfoPacketTask = new TaskCompletionSource<RoomInfoPacket>();
			Task.Factory.StartNew(delegate
			{
				try
				{
					Task task = Socket.ConnectAsync();
					task.Wait(TimeSpan.FromSeconds(4.0));
					if (!task.IsCompleted)
					{
						roomInfoPacketTask.TrySetCanceled();
					}
				}
				catch (AggregateException)
				{
					roomInfoPacketTask.TrySetCanceled();
				}
			});
			return roomInfoPacketTask.Task;
		}

		public Task<LoginResult> LoginAsync(string game, string name, ItemsHandlingFlags itemsHandlingFlags, Version version = null, string[] tags = null, string uuid = null, string password = null, bool requestSlotData = true)
		{
			loginResultTask = new TaskCompletionSource<LoginResult>();
			if (!roomInfoPacketTask.Task.IsCompleted)
			{
				loginResultTask.TrySetResult(new LoginFailure("You are not connected, run ConnectAsync() first"));
				return loginResultTask.Task;
			}
			connectionInfo.SetConnectionParameters(game, tags, itemsHandlingFlags, uuid);
			try
			{
				Socket.SendPacket(BuildConnectPacket(name, password, version, requestSlotData));
			}
			catch (ArchipelagoSocketClosedException)
			{
				loginResultTask.TrySetResult(new LoginFailure("You are not connected, run ConnectAsync() first"));
				return loginResultTask.Task;
			}
			SetResultAfterTimeout(loginResultTask, 4, new LoginFailure("Connection timed out."));
			return loginResultTask.Task;
		}

		private static void SetResultAfterTimeout<T>(TaskCompletionSource<T> task, int timeoutInSeconds, T result)
		{
			new CancellationTokenSource(TimeSpan.FromSeconds(timeoutInSeconds)).Token.Register(delegate
			{
				task.TrySetResult(result);
			});
		}

		public LoginResult TryConnectAndLogin(string game, string name, ItemsHandlingFlags itemsHandlingFlags, Version version = null, string[] tags = null, string uuid = null, string password = null, bool requestSlotData = true)
		{
			Task<RoomInfoPacket> task = ConnectAsync();
			try
			{
				task.Wait(TimeSpan.FromSeconds(4.0));
			}
			catch (AggregateException ex)
			{
				if (ex.GetBaseException() is OperationCanceledException)
				{
					return new LoginFailure("Connection timed out.");
				}
				return new LoginFailure(ex.GetBaseException().Message);
			}
			if (!task.IsCompleted)
			{
				return new LoginFailure("Connection timed out.");
			}
			return LoginAsync(game, name, itemsHandlingFlags, version, tags, uuid, password, requestSlotData).Result;
		}

		private ConnectPacket BuildConnectPacket(string name, string password, Version version, bool requestSlotData)
		{
			return new ConnectPacket
			{
				Game = ConnectionInfo.Game,
				Name = name,
				Password = password,
				Tags = ConnectionInfo.Tags,
				Uuid = ConnectionInfo.Uuid,
				Version = ((version != null) ? new NetworkVersion(version) : new NetworkVersion(0, 6, 0)),
				ItemsHandling = ConnectionInfo.ItemsHandlingFlags,
				RequestSlotData = requestSlotData
			};
		}

		public void Say(string message)
		{
			Socket.SendPacket(new SayPacket
			{
				Text = message
			});
		}

		public void SetClientState(ArchipelagoClientState state)
		{
			Socket.SendPacket(new StatusUpdatePacket
			{
				Status = state
			});
		}

		public void SetGoalAchieved()
		{
			SetClientState(ArchipelagoClientState.ClientGoal);
		}
	}
	public interface IArchipelagoSessionActions
	{
		void Say(string message);

		void SetClientState(ArchipelagoClientState state);

		void SetGoalAchieved();
	}
	public static class ArchipelagoSessionFactory
	{
		public static ArchipelagoSession CreateSession(Uri uri)
		{
			ArchipelagoSocketHelper socket = new ArchipelagoSocketHelper(uri);
			DataPackageCache cache = new DataPackageCache(socket);
			ConnectionInfoHelper connectionInfoHelper = new ConnectionInfoHelper(socket);
			PlayerHelper playerHelper = new PlayerHelper(socket, connectionInfoHelper);
			ItemInfoResolver itemInfoResolver = new ItemInfoResolver(cache, connectionInfoHelper);
			LocationCheckHelper locationCheckHelper = new LocationCheckHelper(socket, itemInfoResolver, connectionInfoHelper, playerHelper);
			ReceivedItemsHelper items = new ReceivedItemsHelper(socket, locationCheckHelper, itemInfoResolver, connectionInfoHelper, playerHelper);
			RoomStateHelper roomStateHelper = new RoomStateHelper(socket, locationCheckHelper);
			DataStorageHelper dataStorageHelper = new DataStorageHelper(socket, connectionInfoHelper);
			MessageLogHelper messageLog = new MessageLogHelper(socket, itemInfoResolver, playerHelper, connectionInfoHelper);
			HintsHelper createHints = new HintsHelper(socket, playerHelper, locationCheckHelper, roomStateHelper, dataStorageHelper);
			return new ArchipelagoSession(socket, items, locationCheckHelper, playerHelper, roomStateHelper, connectionInfoHelper, dataStorageHelper, messageLog, createHints);
		}

		public static ArchipelagoSession CreateSession(string hostname, int port = 38281)
		{
			return CreateSession(ParseUri(hostname, port));
		}

		internal static Uri ParseUri(string hostname, int port)
		{
			string text = hostname;
			if (!text.StartsWith("ws://") && !text.StartsWith("wss://"))
			{
				text = "unspecified://" + text;
			}
			if (!text.Substring(text.IndexOf("://", StringComparison.Ordinal) + 3).Contains(":"))
			{
				text += $":{port}";
			}
			if (text.EndsWith(":"))
			{
				text += port;
			}
			return new Uri(text);
		}
	}
	public abstract class LoginResult
	{
		public abstract bool Successful { get; }

		public static LoginResult FromPacket(ArchipelagoPacketBase packet)
		{
			if (!(packet is ConnectedPacket connectedPacket))
			{
				if (packet is ConnectionRefusedPacket connectionRefusedPacket)
				{
					return new LoginFailure(connectionRefusedPacket);
				}
				throw new ArgumentOutOfRangeException("packet", "packet is not a connection result packet");
			}
			return new LoginSuccessful(connectedPacket);
		}
	}
	public class LoginSuccessful : LoginResult
	{
		public override bool Successful => true;

		public int Team { get; }

		public int Slot { get; }

		public Dictionary<string, object> SlotData { get; }

		public LoginSuccessful(ConnectedPacket connectedPacket)
		{
			Team = connectedPacket.Team;
			Slot = connectedPacket.Slot;
			SlotData = connectedPacket.SlotData;
		}
	}
	public class LoginFailure : LoginResult
	{
		public override bool Successful => false;

		public ConnectionRefusedError[] ErrorCodes { get; }

		public string[] Errors { get; }

		public LoginFailure(ConnectionRefusedPacket connectionRefusedPacket)
		{
			if (connectionRefusedPacket.Errors != null)
			{
				ErrorCodes = connectionRefusedPacket.Errors.ToArray();
				Errors = ErrorCodes.Select(GetErrorMessage).ToArray();
			}
			else
			{
				ErrorCodes = new ConnectionRefusedError[0];
				Errors = new string[0];
			}
		}

		public LoginFailure(string message)
		{
			ErrorCodes = new ConnectionRefusedError[0];
			Errors = new string[1] { message };
		}

		private static string GetErrorMessage(ConnectionRefusedError errorCode)
		{
			return errorCode switch
			{
				ConnectionRefusedError.InvalidSlot => "The slot name did not match any slot on the server.", 
				ConnectionRefusedError.InvalidGame => "The slot is set to a different game on the server.", 
				ConnectionRefusedError.SlotAlreadyTaken => "The slot already has a connection with a different uuid established.", 
				ConnectionRefusedError.IncompatibleVersion => "The client and server version mismatch.", 
				ConnectionRefusedError.InvalidPassword => "The password is invalid.", 
				ConnectionRefusedError.InvalidItemsHandling => "The item handling flags provided are invalid.", 
				_ => $"Unknown error: {errorCode}.", 
			};
		}
	}
	internal class TwoWayLookup<TA, TB> : IEnumerable<KeyValuePair<TB, TA>>, IEnumerable
	{
		private readonly Dictionary<TA, TB> aToB = new Dictionary<TA, TB>();

		private readonly Dictionary<TB, TA> bToA = new Dictionary<TB, TA>();

		public TA this[TB b] => bToA[b];

		public TB this[TA a] => aToB[a];

		public void Add(TA a, TB b)
		{
			aToB[a] = b;
			bToA[b] = a;
		}

		public void Add(TB b, TA a)
		{
			Add(a, b);
		}

		public bool TryGetValue(TA a, out TB b)
		{
			return aToB.TryGetValue(a, out b);
		}

		public bool TryGetValue(TB b, out TA a)
		{
			return bToA.TryGetValue(b, out a);
		}

		public IEnumerator<KeyValuePair<TB, TA>> GetEnumerator()
		{
			return bToA.GetEnumerator();
		}

		IEnumerator IEnumerable.GetEnumerator()
		{
			return GetEnumerator();
		}
	}
}
namespace Archipelago.MultiClient.Net.Packets
{
	public class BouncedPacket : BouncePacket
	{
		public override ArchipelagoPacketType PacketType => ArchipelagoPacketType.Bounced;
	}
	public class BouncePacket : ArchipelagoPacketBase
	{
		public override ArchipelagoPacketType PacketType => ArchipelagoPacketType.Bounce;

		[JsonProperty("games")]
		public List<string> Games { get; set; } = new List<string>();


		[JsonProperty("slots")]
		public List<int> Slots { get; set; } = new List<int>();


		[JsonProperty("tags")]
		public List<string> Tags { get; set; } = new List<string>();


		[JsonProperty("data")]
		public Dictionary<string, JToken> Data { get; set; }
	}
	public class ConnectedPacket : ArchipelagoPacketBase
	{
		public override ArchipelagoPacketType PacketType => ArchipelagoPacketType.Connected;

		[JsonProperty("team")]
		public int Team { get; set; }

		[JsonProperty("slot")]
		public int Slot { get; set; }

		[JsonProperty("players")]
		public NetworkPlayer[] Players { get; set; }

		[JsonProperty("missing_locations")]
		public long[] MissingChecks { get; set; }

		[JsonProperty("checked_locations")]
		public long[] LocationsChecked { get; set; }

		[JsonProperty("slot_data")]
		public Dictionary<string, object> SlotData { get; set; }

		[JsonProperty("slot_info")]
		public Dictionary<int, NetworkSlot> SlotInfo { get; set; }

		[JsonProperty("hint_points")]
		public int? HintPoints { get; set; }
	}
	public class ConnectionRefusedPacket : ArchipelagoPacketBase
	{
		public override ArchipelagoPacketType PacketType => ArchipelagoPacketType.ConnectionRefused;

		[JsonProperty("errors", ItemConverterType = typeof(AttemptingStringEnumConverter))]
		public ConnectionRefusedError[] Errors { get; set; }
	}
	public class ConnectPacket : ArchipelagoPacketBase
	{
		public override ArchipelagoPacketType PacketType => ArchipelagoPacketType.Connect;

		[JsonProperty("password")]
		public string Password { get; set; }

		[JsonProperty("game")]
		public string Game { get; set; }

		[JsonProperty("name")]
		public string Name { get; set; }

		[JsonProperty("uuid")]
		public string Uuid { get; set; }

		[JsonProperty("version")]
		public NetworkVersion Version { get; set; }

		[JsonProperty("tags")]
		public string[] Tags { get; set; }

		[JsonProperty("items_handling")]
		public ItemsHandlingFlags ItemsHandling { get; set; }

		[JsonProperty("slot_data")]
		public bool RequestSlotData { get; set; }
	}
	public class ConnectUpdatePacket : ArchipelagoPacketBase
	{
		public override ArchipelagoPacketType PacketType => ArchipelagoPacketType.ConnectUpdate;

		[JsonProperty("tags")]
		public string[] Tags { get; set; }

		[JsonProperty("items_handling")]
		public ItemsHandlingFlags? ItemsHandling { get; set; }
	}
	public class CreateHintsPacket : ArchipelagoPacketBase
	{
		public override ArchipelagoPacketType PacketType => ArchipelagoPacketType.CreateHints;

		[JsonProperty("locations")]
		public long[] Locations { get; set; }

		[JsonProperty("player")]
		public int Player { get; set; }

		[JsonProperty("status")]
		public HintStatus Status { get; set; }
	}
	public class DataPackagePacket : ArchipelagoPacketBase
	{
		public override ArchipelagoPacketType PacketType => ArchipelagoPacketType.DataPackage;

		[JsonProperty("data")]
		public Archipelago.MultiClient.Net.Models.DataPackage DataPackage { get; set; }
	}
	public class GetDataPackagePacket : ArchipelagoPacketBase
	{
		public override ArchipelagoPacketType PacketType => ArchipelagoPacketType.GetDataPackage;

		[JsonProperty("games")]
		public string[] Games { get; set; }
	}
	public class GetPacket : ArchipelagoPacketBase
	{
		public override ArchipelagoPacketType PacketType => ArchipelagoPacketType.Get;

		[JsonProperty("keys")]
		public string[] Keys { get; set; }
	}
	public class InvalidPacketPacket : ArchipelagoPacketBase
	{
		public override ArchipelagoPacketType PacketType => ArchipelagoPacketType.InvalidPacket;

		[JsonProperty("type")]
		public InvalidPacketErrorType ErrorType { get; set; }

		[JsonProperty("text")]
		public string ErrorText { get; set; }

		[JsonProperty("original_cmd")]
		public ArchipelagoPacketType OriginalCmd { get; set; }
	}
	public class LocationChecksPacket : ArchipelagoPacketBase
	{
		public override ArchipelagoPacketType PacketType => ArchipelagoPacketType.LocationChecks;

		[JsonProperty("locations")]
		public long[] Locations { get; set; }
	}
	public class LocationInfoPacket : ArchipelagoPacketBase
	{
		public override ArchipelagoPacketType PacketType => ArchipelagoPacketType.LocationInfo;

		[JsonProperty("locations")]
		public NetworkItem[] Locations { get; set; }
	}
	public class LocationScoutsPacket : ArchipelagoPacketBase
	{
		public override ArchipelagoPacketType PacketType => ArchipelagoPacketType.LocationScouts;

		[JsonProperty("locations")]
		public long[] Locations { get; set; }

		[JsonProperty("create_as_hint")]
		public int CreateAsHint { get; set; }
	}
	public class PrintJsonPacket : ArchipelagoPacketBase
	{
		public override ArchipelagoPacketType PacketType => ArchipelagoPacketType.PrintJSON;

		[JsonProperty("data")]
		public JsonMessagePart[] Data { get; set; }

		[JsonProperty("type")]
		[JsonConverter(typeof(AttemptingStringEnumConverter))]
		public JsonMessageType? MessageType { get; set; }
	}
	public class ItemPrintJsonPacket : PrintJsonPacket
	{
		[JsonProperty("receiving")]
		public int ReceivingPlayer { get; set; }

		[JsonProperty("item")]
		public NetworkItem Item { get; set; }
	}
	public class ItemCheatPrintJsonPacket : PrintJsonPacket
	{
		[JsonProperty("receiving")]
		public int ReceivingPlayer { get; set; }

		[JsonProperty("item")]
		public NetworkItem Item { get; set; }

		[JsonProperty("team")]
		public int Team { get; set; }
	}
	public class HintPrintJsonPacket : PrintJsonPacket
	{
		[JsonProperty("receiving")]
		public int ReceivingPlayer { get; set; }

		[JsonProperty("item")]
		public NetworkItem Item { get; set; }

		[JsonProperty("found")]
		public bool? Found { get; set; }
	}
	public class JoinPrintJsonPacket : PrintJsonPacket
	{
		[JsonProperty("team")]
		public int Team { get; set; }

		[JsonProperty("slot")]
		public int Slot { get; set; }

		[JsonProperty("tags")]
		public string[] Tags { get; set; }
	}
	public class LeavePrintJsonPacket : PrintJsonPacket
	{
		[JsonProperty("team")]
		public int Team { get; set; }

		[JsonProperty("slot")]
		public int Slot { get; set; }
	}
	public class ChatPrintJsonPacket : PrintJsonPacket
	{
		[JsonProperty("team")]
		public int Team { get; set; }

		[JsonProperty("slot")]
		public int Slot { get; set; }

		[JsonProperty("message")]
		public string Message { get; set; }
	}
	public class ServerChatPrintJsonPacket : PrintJsonPacket
	{
		[JsonProperty("message")]
		public string Message { get; set; }
	}
	public class TutorialPrintJsonPacket : PrintJsonPacket
	{
	}
	public class TagsChangedPrintJsonPacket : PrintJsonPacket
	{
		[JsonProperty("team")]
		public int Team { get; set; }

		[JsonProperty("slot")]
		public int Slot { get; set; }

		[JsonProperty("tags")]
		public string[] Tags { get; set; }
	}
	public class CommandResultPrintJsonPacket : PrintJsonPacket
	{
	}
	public class AdminCommandResultPrintJsonPacket : PrintJsonPacket
	{
	}
	public class GoalPrintJsonPacket : PrintJsonPacket
	{
		[JsonProperty("team")]
		public int Team { get; set; }

		[JsonProperty("slot")]
		public int Slot { get; set; }
	}
	public class ReleasePrintJsonPacket : PrintJsonPacket
	{
		[JsonProperty("team")]
		public int Team { get; set; }

		[JsonProperty("slot")]
		public int Slot { get; set; }
	}
	public class CollectPrintJsonPacket : PrintJsonPacket
	{
		[JsonProperty("team")]
		public int Team { get; set; }

		[JsonProperty("slot")]
		public int Slot { get; set; }
	}
	public class CountdownPrintJsonPacket : PrintJsonPacket
	{
		[JsonProperty("countdown")]
		public int RemainingSeconds { get; set; }
	}
	public class ReceivedItemsPacket : ArchipelagoPacketBase
	{
		public override ArchipelagoPacketType PacketType => ArchipelagoPacketType.ReceivedItems;

		[JsonProperty("index")]
		public int Index { get; set; }

		[JsonProperty("items")]
		public NetworkItem[] Items { get; set; }
	}
	public class RetrievedPacket : ArchipelagoPacketBase
	{
		public override ArchipelagoPacketType PacketType => ArchipelagoPacketType.Retrieved;

		[JsonProperty("keys")]
		public Dictionary<string, JToken> Data { get; set; }
	}
	public class RoomInfoPacket : ArchipelagoPacketBase
	{
		public override ArchipelagoPacketType PacketType => ArchipelagoPacketType.RoomInfo;

		[JsonProperty("version")]
		public NetworkVersion Version { get; set; }

		[JsonProperty("generator_version")]
		public NetworkVersion GeneratorVersion { get; set; }

		[JsonProperty("tags")]
		public string[] Tags { get; set; }

		[JsonProperty("password")]
		public bool Password { get; set; }

		[JsonProperty("permissions")]
		public Dictionary<string, Permissions> Permissions { get; set; }

		[JsonProperty("hint_cost")]
		public int HintCostPercentage { get; set; }

		[JsonProperty("location_check_points")]
		public int LocationCheckPoints { get; set; }

		[JsonProperty("players")]
		public NetworkPlayer[] Players { get; set; }

		[JsonProperty("games")]
		public string[] Games { get; set; }

		[JsonProperty("datapackage_checksums")]
		public Dictionary<string, string> DataPackageChecksums { get; set; }

		[JsonProperty("seed_name")]
		public string SeedName { get; set; }

		[JsonProperty("time")]
		public double Timestamp { get; set; }
	}
	public class RoomUpdatePacket : ArchipelagoPacketBase
	{
		public override ArchipelagoPacketType PacketType => ArchipelagoPacketType.RoomUpdate;

		[JsonProperty("tags")]
		public string[] Tags { get; set; }

		[JsonProperty("password")]
		public bool? Password { get; set; }

		[JsonProperty("permissions")]
		public Dictionary<string, Permissions> Permissions { get; set; } = new Dictionary<string, Permissions>();


		[JsonProperty("hint_cost")]
		public int? HintCostPercentage { get; set; }

		[JsonProperty("location_check_points")]
		public int? LocationCheckPoints { get; set; }

		[JsonProperty("players")]
		public NetworkPlayer[] Players { get; set; }

		[JsonProperty("hint_points")]
		public int? HintPoints { get; set; }

		[JsonProperty("checked_locations")]
		public long[] CheckedLocations { get; set; }
	}
	public class SayPacket : ArchipelagoPacketBase
	{
		public override ArchipelagoPacketType PacketType => ArchipelagoPacketType.Say;

		[JsonProperty("text")]
		public string Text { get; set; }
	}
	public class SetNotifyPacket : ArchipelagoPacketBase
	{
		public override ArchipelagoPacketType PacketType => ArchipelagoPacketType.SetNotify;

		[JsonProperty("keys")]
		public string[] Keys { get; set; }
	}
	public class SetPacket : ArchipelagoPacketBase
	{
		public override ArchipelagoPacketType PacketType => ArchipelagoPacketType.Set;

		[JsonProperty("key")]
		public string Key { get; set; }

		[JsonProperty("default")]
		public JToken DefaultValue { get; set; }

		[JsonProperty("operations")]
		public OperationSpecification[] Operations { get; set; }

		[JsonProperty("want_reply")]
		public bool WantReply { get; set; }

		[JsonExtensionData]
		public Dictionary<string, JToken> AdditionalArguments { get; set; }

		[OnDeserialized]
		internal void OnDeserializedMethod(StreamingContext context)
		{
			AdditionalArguments?.Remove("cmd");
		}
	}
	public class SetReplyPacket : SetPacket
	{
		public override ArchipelagoPacketType PacketType => ArchipelagoPacketType.SetReply;

		[JsonProperty("value")]
		public JToken Value { get; set; }

		[JsonProperty("original_value")]
		public JToken OriginalValue { get; set; }
	}
	public class StatusUpdatePacket : ArchipelagoPacketBase
	{
		public override ArchipelagoPacketType PacketType => ArchipelagoPacketType.StatusUpdate;

		[JsonProperty("status")]
		public ArchipelagoClientState Status { get; set; }
	}
	public class SyncPacket : ArchipelagoPacketBase
	{
		public override ArchipelagoPacketType PacketType => ArchipelagoPacketType.Sync;
	}
	internal class UnknownPacket : ArchipelagoPacketBase
	{
		public override ArchipelagoPacketType PacketType => ArchipelagoPacketType.Unknown;
	}
	public class UpdateHintPacket : ArchipelagoPacketBase
	{
		public override ArchipelagoPacketType PacketType => ArchipelagoPacketType.UpdateHint;

		[JsonProperty("player")]
		public int Player { get; set; }

		[JsonProperty("location")]
		public long Location { get; set; }

		[JsonProperty("status")]
		public HintStatus Status { get; set; }
	}
}
namespace Archipelago.MultiClient.Net.Models
{
	public struct Color : IEquatable<Color>
	{
		public static Color Red = new Color(byte.MaxValue, 0, 0);

		public static Color Green = new Color(0, 128, 0);

		public static Color Yellow = new Color(byte.MaxValue, byte.MaxValue, 0);

		public static Color Blue = new Color(0, 0, byte.MaxValue);

		public static Color Magenta = new Color(byte.MaxValue, 0, byte.MaxValue);

		public static Color Cyan = new Color(0, byte.MaxValue, byte.MaxValue);

		public static Color Black = new Color(0, 0, 0);

		public static Color White = new Color(byte.MaxValue, byte.MaxValue, byte.MaxValue);

		public static Color SlateBlue = new Color(106, 90, 205);

		public static Color Salmon = new Color(250, 128, 114);

		public static Color Plum = new Color(221, 160, 221);

		public byte R { get; set; }

		public byte G { get; set; }

		public byte B { get; set; }

		public Color(byte r, byte g, byte b)
		{
			R = r;
			G = g;
			B = b;
		}

		public override bool Equals(object obj)
		{
			if (obj is Color color && R == color.R && G == color.G)
			{
				return B == color.B;
			}
			return false;
		}

		public bool Equals(Color other)
		{
			if (R == other.R && G == other.G)
			{
				return B == other.B;
			}
			return false;
		}

		public override int GetHashCode()
		{
			return ((-1520100960 * -1521134295 + R.GetHashCode()) * -1521134295 + G.GetHashCode()) * -1521134295 + B.GetHashCode();
		}

		public static bool operator ==(Color left, Color right)
		{
			return left.Equals(right);
		}

		public static bool operator !=(Color left, Color right)
		{
			return !(left == right);
		}
	}
	public class DataPackage
	{
		[JsonProperty("games")]
		public Dictionary<string, GameData> Games { get; set; } = new Dictionary<string, GameData>();

	}
	public class DataStorageElement
	{
		internal DataStorageElementContext Context;

		internal List<OperationSpecification> Operations = new List<OperationSpecification>(0);

		internal DataStorageHelper.DataStorageUpdatedHandler Callbacks;

		internal Dictionary<string, JToken> AdditionalArguments = new Dictionary<string, JToken>(0);

		private JToken cachedValue;

		public event DataStorageHelper.DataStorageUpdatedHandler OnValueChanged
		{
			add
			{
				Context.AddHandler(Context.Key, value);
			}
			remove
			{
				Context.RemoveHandler(Context.Key, value);
			}
		}

		internal DataStorageElement(DataStorageElementContext context)
		{
			Context = context;
		}

		internal DataStorageElement(OperationType operationType, JToken value)
		{
			Operations = new List<OperationSpecification>(1)
			{
				new OperationSpecification
				{
					OperationType = operationType,
					Value = value
				}
			};
		}

		internal DataStorageElement(DataStorageElement source, OperationType operationType, JToken value)
			: this(source.Context)
		{
			Operations = source.Operations.ToList();
			Callbacks = source.Callbacks;
			AdditionalArguments = source.AdditionalArguments;
			Operations.Add(new OperationSpecification
			{
				OperationType = operationType,
				Value = value
			});
		}

		internal DataStorageElement(DataStorageElement source, Callback callback)
			: this(source.Context)
		{
			Operations = source.Operations.ToList();
			Callbacks = source.Callbacks;
			AdditionalArguments = source.AdditionalArguments;
			Callbacks = (DataStorageHelper.DataStorageUpdatedHandler)Delegate.Combine(Callbacks, callback.Method);
		}

		internal DataStorageElement(DataStorageElement source, AdditionalArgument additionalArgument)
			: this(source.Context)
		{
			Operations = source.Operations.ToList();
			Callbacks = source.Callbacks;
			AdditionalArguments = source.AdditionalArguments;
			AdditionalArguments[additionalArgument.Key] = additionalArgument.Value;
		}

		public static DataStorageElement operator ++(DataStorageElement a)
		{
			return new DataStorageElement(a, OperationType.Add, JToken.op_Implicit(1));
		}

		public static DataStorageElement operator --(DataStorageElement a)
		{
			return new DataStorageElement(a, OperationType.Add, JToken.op_Implicit(-1));
		}

		public static DataStorageElement operator +(DataStorageElement a, int b)
		{
			return new DataStorageElement(a, OperationType.Add, JToken.op_Implicit(b));
		}

		public static DataStorageElement operator +(DataStorageElement a, long b)
		{
			return new DataStorageElement(a, OperationType.Add, JToken.op_Implicit(b));
		}

		public static DataStorageElement operator +(DataStorageElement a, float b)
		{
			return new DataStorageElement(a, OperationType.Add, JToken.op_Implicit(b));
		}

		public static DataStorageElement operator +(DataStorageElement a, double b)
		{
			return new DataStorageElement(a, OperationType.Add, JToken.op_Implicit(b));
		}

		public static DataStorageElement operator +(DataStorageElement a, decimal b)
		{
			return new DataStorageElement(a, OperationType.Add, JToken.op_Implicit(b));
		}

		public static DataStorageElement operator +(DataStorageElement a, string b)
		{
			return new DataStorageElement(a, OperationType.Add, JToken.op_Implicit(b));
		}

		public static DataStorageElement operator +(DataStorageElement a, JToken b)
		{
			return new DataStorageElement(a, OperationType.Add, b);
		}

		public static DataStorageElement operator +(DataStorageElement a, IEnumerable b)
		{
			return new DataStorageElement(a, OperationType.Add, (JToken)(object)JArray.FromObject((object)b));
		}

		public static DataStorageElement operator +(DataStorageElement a, OperationSpecification s)
		{
			return new DataStorageElement(a, s.OperationType, s.Value);
		}

		public static DataStorageElement operator +(DataStorageElement a, Callback c)
		{
			return new DataStorageElement(a, c);
		}

		public static DataStorageElement operator +(DataStorageElement a, AdditionalArgument arg)
		{
			return new DataStorageElement(a, arg);
		}

		public static DataStorageElement operator *(DataStorageElement a, int b)
		{
			return new DataStorageElement(a, OperationType.Mul, JToken.op_Implicit(b));
		}

		public static DataStorageElement operator *(DataStorageElement a, long b)
		{
			return new DataStorageElement(a, OperationType.Mul, JToken.op_Implicit(b));
		}

		public static DataStorageElement operator *(DataStorageElement a, float b)
		{
			return new DataStorageElement(a, OperationType.Mul, JToken.op_Implicit(b));
		}

		public static DataStorageElement operator *(DataStorageElement a, double b)
		{
			return new DataStorageElement(a, OperationType.Mul, JToken.op_Implicit(b));
		}

		public static DataStorageElement operator *(DataStorageElement a, decimal b)
		{
			return new DataStorageElement(a, OperationType.Mul, JToken.op_Implicit(b));
		}

		public static DataStorageElement operator %(DataStorageElement a, int b)
		{
			return new DataStorageElement(a, OperationType.Mod, JToken.op_Implicit(b));
		}

		public static DataStorageElement operator %(DataStorageElement a, long b)
		{
			return new DataStorageElement(a, OperationType.Mod, JToken.op_Implicit(b));
		}

		public static DataStorageElement operator %(DataStorageElement a, float b)
		{
			return new DataStorageElement(a, OperationType.Mod, JToken.op_Implicit(b));
		}

		public static DataStorageElement operator %(DataStorageElement a, double b)
		{
			return new DataStorageElement(a, OperationType.Mod, JToken.op_Implicit(b));
		}

		public static DataStorageElement operator %(DataStorageElement a, decimal b)
		{
			return new DataStorageElement(a, OperationType.Mod, JToken.op_Implicit(b));
		}

		public static DataStorageElement operator ^(DataStorageElement a, int b)
		{
			return new DataStorageElement(a, OperationType.Pow, JToken.op_Implicit(b));
		}

		public static DataStorageElement operator ^(DataStorageElement a, long b)
		{
			return new DataStorageElement(a, OperationType.Pow, JToken.op_Implicit(b));
		}

		public static DataStorageElement operator ^(DataStorageElement a, float b)
		{
			return new DataStorageElement(a, OperationType.Pow, JToken.op_Implicit(b));
		}

		public static DataStorageElement operator ^(DataStorageElement a, double b)
		{
			return new DataStorageElement(a, OperationType.Pow, JToken.op_Implicit(b));
		}

		public static DataStorageElement operator ^(DataStorageElement a, decimal b)
		{
			return new DataStorageElement(a, OperationType.Pow, JToken.op_Implicit(b));
		}

		public static DataStorageElement operator -(DataStorageElement a, int b)
		{
			return new DataStorageElement(a, OperationType.Add, JToken.FromObject((object)(-b)));
		}

		public static DataStorageElement operator -(DataStorageElement a, long b)
		{
			return new DataStorageElement(a, OperationType.Add, JToken.FromObject((object)(-b)));
		}

		public static DataStorageElement operator -(DataStorageElement a, float b)
		{
			return new DataStorageElement(a, OperationType.Add, JToken.FromObject((object)(0f - b)));
		}

		public static DataStorageElement operator -(DataStorageElement a, double b)
		{
			return new DataStorageElement(a, OperationType.Add, JToken.FromObject((object)(0.0 - b)));
		}

		public static DataStorageElement operator -(DataStorageElement a, decimal b)
		{
			return new DataStorageElement(a, OperationType.Add, JToken.FromObject((object)(-b)));
		}

		public static DataStorageElement operator /(DataStorageElement a, int b)
		{
			return new DataStorageElement(a, OperationType.Mul, JToken.FromObject((object)(1m / (decimal)b)));
		}

		public static DataStorageElement operator /(DataStorageElement a, long b)
		{
			return new DataStorageElement(a, OperationType.Mul, JToken.FromObject((object)(1m / (decimal)b)));
		}

		public static DataStorageElement operator /(DataStorageElement a, float b)
		{
			return new DataStorageElement(a, OperationType.Mul, JToken.FromObject((object)(1.0 / (double)b)));
		}

		public static DataStorageElement operator /(DataStorageElement a, double b)
		{
			return new DataStorageElement(a, OperationType.Mul, JToken.FromObject((object)(1.0 / b)));
		}

		public static DataStorageElement operator /(DataStorageElement a, decimal b)
		{
			return new DataStorageElement(a, OperationType.Mul, JToken.FromObject((object)(1m / b)));
		}

		public static implicit operator DataStorageElement(bool b)
		{
			return new DataStorageElement(OperationType.Replace, JToken.op_Implicit(b));
		}

		public static implicit operator DataStorageElement(int i)
		{
			return new DataStorageElement(OperationType.Replace, JToken.op_Implicit(i));
		}

		public static implicit operator DataStorageElement(long l)
		{
			return new DataStorageElement(OperationType.Replace, JToken.op_Implicit(l));
		}

		public static implicit operator DataStorageElement(decimal m)
		{
			return new DataStorageElement(OperationType.Replace, JToken.op_Implicit(m));
		}

		public static implicit operator DataStorageElement(double d)
		{
			return new DataStorageElement(OperationType.Replace, JToken.op_Implicit(d));
		}

		public static implicit operator DataStorageElement(float f)
		{
			return new DataStorageElement(OperationType.Replace, JToken.op_Implicit(f));
		}

		public static implicit operator DataStorageElement(string s)
		{
			if (s != null)
			{
				return new DataStorageElement(OperationType.Replace, JToken.op_Implicit(s));
			}
			return new DataStorageElement(OperationType.Replace, (JToken)(object)JValue.CreateNull());
		}

		public static implicit operator DataStorageElement(JToken o)
		{
			return new DataStorageElement(OperationType.Replace, o);
		}

		public static implicit operator DataStorageElement(Array a)
		{
			return new DataStorageElement(OperationType.Replace, (JToken)(object)JArray.FromObject((object)a));
		}

		public static implicit operator DataStorageElement(List<bool> l)
		{
			return new DataStorageElement(OperationType.Replace, (JToken)(object)JArray.FromObject((object)l));
		}

		public static implicit operator DataStorageElement(List<int> l)
		{
			return new DataStorageElement(OperationType.Replace, (JToken)(object)JArray.FromObject((object)l));
		}

		public static implicit operator DataStorageElement(List<long> l)
		{
			return new DataStorageElement(OperationType.Replace, (JToken)(object)JArray.FromObject((object)l));
		}

		public static implicit operator DataStorageElement(List<decimal> l)
		{
			return new DataStorageElement(OperationType.Replace, (JToken)(object)JArray.FromObject((object)l));
		}

		public static implicit operator DataStorageElement(List<double> l)
		{
			return new DataStorageElement(OperationType.Replace, (JToken)(object)JArray.FromObject((object)l));
		}

		public static implicit operator DataStorageElement(List<float> l)
		{
			return new DataStorageElement(OperationType.Replace, (JToken)(object)JArray.FromObject((object)l));
		}

		public static implicit operator DataStorageElement(List<string> l)
		{
			return new DataStorageElement(OperationType.Replace, (JToken)(object)JArray.FromObject((object)l));
		}

		public static implicit operator DataStorageElement(List<object> l)
		{
			return new DataStorageElement(OperationType.Replace, (JToken)(object)JArray.FromObject((object)l));
		}

		public static implicit operator bool(DataStorageElement e)
		{
			return RetrieveAndReturnBoolValue<bool>(e);
		}

		public static implicit operator bool?(DataStorageElement e)
		{
			return RetrieveAndReturnBoolValue<bool?>(e);
		}

		public static implicit operator int(DataStorageElement e)
		{
			return RetrieveAndReturnDecimalValue<int>(e);
		}

		public static implicit operator int?(DataStorageElement e)
		{
			return RetrieveAndReturnDecimalValue<int?>(e);
		}

		public static implicit operator long(DataStorageElement e)
		{
			return RetrieveAndReturnDecimalValue<long>(e);
		}

		public static implicit operator long?(DataStorageElement e)
		{
			return RetrieveAndReturnDecimalValue<long?>(e);
		}

		public static implicit operator float(DataStorageElement e)
		{
			return RetrieveAndReturnDecimalValue<float>(e);
		}

		public static implicit operator float?(DataStorageElement e)
		{
			return RetrieveAndReturnDecimalValue<float?>(e);
		}

		public static implicit operator double(DataStorageElement e)
		{
			return RetrieveAndReturnDecimalValue<double>(e);
		}

		public static implicit operator double?(DataStorageElement e)
		{
			return RetrieveAndReturnDecimalValue<double?>(e);
		}

		public static implicit operator decimal(DataStorageElement e)
		{
			return RetrieveAndReturnDecimalValue<decimal>(e);
		}

		public static implicit operator decimal?(DataStorageElement e)
		{
			return RetrieveAndReturnDecimalValue<decimal?>(e);
		}

		public static implicit operator string(DataStorageElement e)
		{
			return RetrieveAndReturnStringValue(e);
		}

		public static implicit operator bool[](DataStorageElement e)
		{
			return RetrieveAndReturnArrayValue<bool[]>(e);
		}

		public static implicit operator int[](DataStorageElement e)
		{
			return RetrieveAndReturnArrayValue<int[]>(e);
		}

		public static implicit operator long[](DataStorageElement e)
		{
			return RetrieveAndReturnArrayValue<long[]>(e);
		}

		public static implicit operator decimal[](DataStorageElement e)
		{
			return RetrieveAndReturnArrayValue<decimal[]>(e);
		}

		public static implicit operator double[](DataStorageElement e)
		{
			return RetrieveAndReturnArrayValue<double[]>(e);
		}

		public static implicit operator float[](DataStorageElement e)
		{
			return RetrieveAndReturnArrayValue<float[]>(e);
		}

		public static implicit operator string[](DataStorageElement e)
		{
			return RetrieveAndReturnArrayValue<string[]>(e);
		}

		public static implicit operator object[](DataStorageElement e)
		{
			return RetrieveAndReturnArrayValue<object[]>(e);
		}

		public static implicit operator List<bool>(DataStorageElement e)
		{
			return RetrieveAndReturnArrayValue<List<bool>>(e);
		}

		public static implicit operator List<int>(DataStorageElement e)
		{
			return RetrieveAndReturnArrayValue<List<int>>(e);
		}

		public static implicit operator List<long>(DataStorageElement e)
		{
			return RetrieveAndReturnArrayValue<List<long>>(e);
		}

		public static implicit operator List<decimal>(DataStorageElement e)
		{
			return RetrieveAndReturnArrayValue<List<decimal>>(e);
		}

		public static implicit operator List<double>(DataStorageElement e)
		{
			return RetrieveAndReturnArrayValue<List<double>>(e);
		}

		public static implicit operator List<float>(DataStorageElement e)
		{
			return RetrieveAndReturnArrayValue<List<float>>(e);
		}

		public static implicit operator List<string>(DataStorageElement e)
		{
			return RetrieveAndReturnArrayValue<List<string>>(e);
		}

		public static implicit operator List<object>(DataStorageElement e)
		{
			return RetrieveAndReturnArrayValue<List<object>>(e);
		}

		public static implicit operator Array(DataStorageElement e)
		{
			return RetrieveAndReturnArrayValue<Array>(e);
		}

		public static implicit operator JArray(DataStorageElement e)
		{
			return RetrieveAndReturnArrayValue<JArray>(e);
		}

		public static implicit operator JToken(DataStorageElement e)
		{
			return e.Context.GetData(e.Context.Key);
		}

		public static DataStorageElement operator +(DataStorageElement a, BigInteger b)
		{
			return new DataStorageElement(a, OperationType.Add, JToken.Parse(b.ToString()));
		}

		public static DataStorageElement operator *(DataStorageElement a, BigInteger b)
		{
			return new DataStorageElement(a, OperationType.Mul, JToken.Parse(b.ToString()));
		}

		public static DataStorageElement operator %(DataStorageElement a, BigInteger b)
		{
			return new DataStorageElement(a, OperationType.Mod, JToken.Parse(b.ToString()));
		}

		public static DataStorageElement operator ^(DataStorageElement a, BigInteger b)
		{
			return new DataStorageElement(a, OperationType.Pow, JToken.Parse(b.ToString()));
		}

		public static DataStorageElement operator -(DataStorageElement a, BigInteger b)
		{
			return new DataStorageElement(a, OperationType.Add, JToken.Parse((-b).ToString()));
		}

		public static DataStorageElement operator /(DataStorageElement a, BigInteger b)
		{
			throw new InvalidOperationException("DataStorage[Key] / BigInterger is not supported, due to loss of precision when using integer division");
		}

		public static implicit operator DataStorageElement(BigInteger bi)
		{
			return new DataStorageElement(OperationType.Replace, JToken.Parse(bi.ToString()));
		}

		public static implicit operator BigInteger(DataStorageElement e)
		{
			return RetrieveAndReturnBigIntegerValue<BigInteger>(e);
		}

		public static implicit operator BigInteger?(DataStorageElement e)
		{
			return RetrieveAndReturnBigIntegerValue<BigInteger?>(e);
		}

		private static T RetrieveAndReturnBigIntegerValue<T>(DataStorageElement e)
		{
			if (e.cachedValue != null)
			{
				if (!BigInteger.TryParse(((object)e.cachedValue).ToString(), out var result))
				{
					return default(T);
				}
				return (T)Convert.ChangeType(result, IsNullable<T>() ? Nullable.GetUnderlyingType(typeof(T)) : typeof(T));
			}
			BigInteger result2;
			BigInteger? bigInteger = (BigInteger.TryParse(((object)e.Context.GetData(e.Context.Key)).ToString(), out result2) ? new BigInteger?(result2) : null);
			if (!bigInteger.HasValue && !IsNullable<T>())
			{
				bigInteger = Activator.CreateInstance<BigInteger>();
			}
			foreach (OperationSpecification operation in e.Operations)
			{
				if (operation.OperationType == OperationType.Floor || operation.OperationType == OperationType.Ceil)
				{
					continue;
				}
				if (!BigInteger.TryParse(((object)operation.Value).ToString(), NumberStyles.AllowLeadingSign, null, out var result3))
				{
					throw new InvalidOperationException($"DataStorage[Key] cannot be converted to BigInterger as its value its not an integer number, value: {operation.Value}");
				}
				switch (operation.OperationType)
				{
				case OperationType.Replace:
					bigInteger = result3;
					break;
				case OperationType.Add:
					bigInteger += result3;
					break;
				case OperationType.Mul:
					bigInteger *= result3;
					break;
				case OperationType.Mod:
					bigInteger %= result3;
					break;
				case OperationType.Pow:
					bigInteger = BigInteger.Pow(bigInteger.Value, (int)operation.Value);
					break;
				case OperationType.Max:
				{
					BigInteger value = result3;
					BigInteger? bigInteger2 = bigInteger;
					if (value > bigInteger2)
					{
						bigInteger = result3;
					}
					break;
				}
				case OperationType.Min:
				{
					BigInteger value = result3;
					BigInteger? bigInteger2 = bigInteger;
					if (value < bigInteger2)
					{
						bigInteger = result3;
					}
					break;
				}
				case OperationType.Xor:
					bigInteger ^= result3;
					break;
				case OperationType.Or:
					bigInteger |= result3;
					break;
				case OperationType.And:
					bigInteger &= result3;
					break;
				case OperationType.LeftShift:
					bigInteger <<= (int)operation.Value;
					break;
				case OperationType.RightShift:
					bigInteger >>= (int)operation.Value;
					break;
				}
			}
			e.cachedValue = JToken.Parse(bigInteger.ToString());
			if (!bigInteger.HasValue)
			{
				return default(T);
			}
			return (T)Convert.ChangeType(bigInteger.Value, IsNullable<T>() ? Nullable.GetUnderlyingType(typeof(T)) : typeof(T));
		}

		public void Initialize(JToken value)
		{
			Context.Initialize(Context.Key, value);
		}

		public void Initialize(IEnumerable value)
		{
			Context.Initialize(Context.Key, (JToken)(object)JArray.FromObject((object)value));
		}

		public Task<T> GetAsync<T>()
		{
			return GetAsync().ContinueWith((Task<JToken> r) => r.Result.ToObject<T>());
		}

		public Task<JToken> GetAsync()
		{
			return Context.GetAsync(Context.Key);
		}

		private static T RetrieveAndReturnArrayValue<T>(DataStorageElement e)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Invalid comparison between Unknown and I4
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Invalid comparison between Unknown and I4
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			if (e.cachedValue != null)
			{
				return ((JToken)(JArray)e.cachedValue).ToObject<T>();
			}
			JArray val = (JArray)(((object)e.Context.GetData(e.Context.Key).ToObject<JArray>()) ?? ((object)new JArray()));
			foreach (OperationSpecification operation in e.Operations)
			{
				switch (operation.OperationType)
				{
				case OperationType.Add:
					if ((int)operation.Value.Type != 2)
					{
						throw new InvalidOperationException($"Cannot perform operation {OperationType.Add} on Array value, with a non Array value: {operation.Value}");
					}
					((JContainer)val).Merge((object)operation.Value);
					break;
				case OperationType.Replace:
					if ((int)operation.Value.Type != 2)
					{
						throw new InvalidOperationException($"Cannot replace Array value, with a non Array value: {operation.Value}");
					}
					val = (JArray)(((object)operation.Value.ToObject<JArray>()) ?? ((object)new JArray()));
					break;
				default:
					throw new InvalidOperationException($"Cannot perform operation {operation.OperationType} on Array value");
				}
			}
			e.cachedValue = (JToken)(object)val;
			return ((JToken)val).ToObject<T>();
		}

		private static string RetrieveAndReturnStringValue(DataStorageElement e)
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Invalid comparison between Unknown and I4
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Invalid comparison between Unknown and I4
			if (e.cachedValue != null)
			{
				return (string)e.cachedValue;
			}
			JToken val = e.Context.GetData(e.Context.Key);
			string text = (((int)val.Type == 10) ? null : ((object)val).ToString());
			foreach (OperationSpecification operation in e.Operations)
			{
				switch (operation.OperationType)
				{
				case OperationType.Add:
					text += (string)operation.Value;
					break;
				case OperationType.Mul:
					if ((int)operation.Value.Type != 6)
					{
						throw new InvalidOperationException($"Cannot perform operation {OperationType.Mul} on string value, with a non interger value: {operation.Value}");
					}
					text = string.Concat(Enumerable.Repeat(text, (int)operation.Value));
					break;
				case OperationType.Replace:
					text = (string)operation.Value;
					break;
				default:
					throw new InvalidOperationException($"Cannot perform operation {operation.OperationType} on string value");
				}
			}
			if (text == null)
			{
				e.cachedValue = (JToken)(object)JValue.CreateNull();
			}
			else
			{
				e.cachedValue = JToken.op_Implicit(text);
			}
			return (string)e.cachedValue;
		}

		private static T RetrieveAndReturnBoolValue<T>(DataStorageElement e)
		{
			if (e.cachedValue != null)
			{
				return e.cachedValue.ToObject<T>();
			}
			bool? flag = e.Context.GetData(e.Context.Key).ToObject<bool?>() ?? ((bool?)Activator.CreateInstance(typeof(T)));
			foreach (OperationSpecification operation in e.Operations)
			{
				if (operation.OperationType == OperationType.Replace)
				{
					flag = (bool?)operation.Value;
					continue;
				}
				throw new InvalidOperationException($"Cannot perform operation {operation.OperationType} on boolean value");
			}
			e.cachedValue = JToken.op_Implicit(flag);
			if (!flag.HasValue)
			{
				return default(T);
			}
			return (T)Convert.ChangeType(flag.Value, IsNullable<T>() ? Nullable.GetUnderlyingType(typeof(T)) : typeof(T));
		}

		private static T RetrieveAndReturnDecimalValue<T>(DataStorageElement e)
		{
			if (e.cachedValue != null)
			{
				return e.cachedValue.ToObject<T>();
			}
			decimal? num = e.Context.GetData(e.Context.Key).ToObject<decimal?>();
			if (!num.HasValue && !IsNullable<T>())
			{
				num = Activator.CreateInstance<decimal>();
			}
			foreach (OperationSpecification operation in e.Operations)
			{
				switch (operation.OperationType)
				{
				case OperationType.Replace:
					num = (decimal)operation.Value;
					break;
				case OperationType.Add:
					num += (decimal?)(decimal)operation.Value;
					break;
				case OperationType.Mul:
					num *= (decimal?)(decimal)operation.Value;
					break;
				case OperationType.Mod:
					num %= (decimal?)(decimal)operation.Value;
					break;
				case OperationType.Pow:
					num = (decimal)Math.Pow((double)num.Value, (double)operation.Value);
					break;
				case OperationType.Max:
					num = Math.Max(num.Value, (decimal)operation.Value);
					break;
				case OperationType.Min:
					num = Math.Min(num.Value, (decimal)operation.Value);
					break;
				case OperationType.Xor:
					num = (long)num.Value ^ (long)operation.Value;
					break;
				case OperationType.Or:
					num = (long)num.Value | (long)operation.Value;
					break;
				case OperationType.And:
					num = (long)num.Value & (long)operation.Value;
					break;
				case OperationType.LeftShift:
					num = (long)num.Value << (int)operation.Value;
					break;
				case OperationType.RightShift:
					num = (long)num.Value >> (int)operation.Value;
					break;
				case OperationType.Floor:
					num = Math.Floor(num.Value);
					break;
				case OperationType.Ceil:
					num = Math.Ceiling(num.Value);
					break;
				}
			}
			e.cachedValue = JToken.op_Implicit(num);
			if (!num.HasValue)
			{
				return default(T);
			}
			return (T)Convert.ChangeType(num.Value, IsNullable<T>() ? Nullable.GetUnderlyingType(typeof(T)) : typeof(T));
		}

		private static bool IsNullable<T>()
		{
			if (typeof(T).IsGenericType)
			{
				return typeof(T).GetGenericTypeDefinition() == typeof(Nullable<>).GetGenericTypeDefinition();
			}
			return false;
		}

		public T To<T>()
		{
			if (Operations.Count != 0)
			{
				throw new InvalidOperationException("DataStorageElement.To<T>() cannot be used together with other operations on the DataStorageElement");
			}
			return Context.GetData(Context.Key).ToObject<T>();
		}

		public override string ToString()
		{
			return (Context?.ToString() ?? "(null)") + ", (" + ListOperations() + ")";
		}

		private string ListOperations()
		{
			if (Operations != null)
			{
				return string.Join(", ", Operations.Select((OperationSpecification o) => o.ToString()).ToArray());
			}
			return "none";
		}
	}
	internal class DataStorageElementContext
	{
		internal string Key { get; set; }

		internal Action<string, DataStorageHelper.DataStorageUpdatedHandler> AddHandler { get; set; }

		internal Action<string, DataStorageHelper.DataStorageUpdatedHandler> RemoveHandler { get; set; }

		internal Func<string, JToken> GetData { get; set; }

		internal Action<string, JToken> Initialize { get; set; }

		internal Func<string, Task<JToken>> GetAsync { get; set; }

		public override string ToString()
		{
			return "Key: " + Key;
		}
	}
	public class GameData
	{
		[JsonProperty("location_name_to_id")]
		public Dictionary<string, long> LocationLookup { get; set; } = new Dictionary<string, long>();


		[JsonProperty("item_name_to_id")]
		public Dictionary<string, long> ItemLookup { get; set; } = new Dictionary<string, long>();


		[Obsolete("use Checksum instead")]
		[JsonProperty("version")]
		public int Version { get; set; }

		[JsonProperty("checksum")]
		public string Checksum { get; set; }
	}
	public class Hint
	{
		[JsonProperty("receiving_player")]
		public int ReceivingPlayer { get; set; }

		[JsonProperty("finding_player")]
		public int FindingPlayer { get; set; }

		[JsonProperty("item")]
		public long ItemId { get; set; }

		[JsonProperty("location")]
		public long LocationId { get; set; }

		[JsonProperty("item_flags")]
		public ItemFlags ItemFlags { get; set; }

		[JsonProperty("found")]
		public bool Found { get; set; }

		[JsonProperty("entrance")]
		public string Entrance { get; set; }

		[JsonProperty("status")]
		public HintStatus Status { get; set; }
	}
	public class ItemInfo
	{
		private readonly IItemInfoResolver itemInfoResolver;

		public long ItemId { get; }

		public long LocationId { get; }

		public PlayerInfo Player { get; }

		public ItemFlags Flags { get; }

		public string ItemName => itemInfoResolver.GetItemName(ItemId, ItemGame);

		public string ItemDisplayName => ItemName ?? $"Item: {ItemId}";

		public string LocationName => itemInfoResolver.GetLocationName(LocationId, LocationGame);

		public string LocationDisplayName => LocationName ?? $"Location: {LocationId}";

		public string ItemGame { get; }

		public string LocationGame { get; }

		public ItemInfo(NetworkItem item, string receiverGame, string senderGame, IItemInfoResolver itemInfoResolver, PlayerInfo player)
		{
			this.itemInfoResolver = itemInfoResolver;
			ItemGame = receiverGame;
			LocationGame = senderGame;
			ItemId = item.Item;
			LocationId = item.Location;
			Flags = item.Flags;
			Player = player;
		}

		public SerializableItemInfo ToSerializable()
		{
			return new SerializableItemInfo
			{
				IsScout = (GetType() == typeof(ScoutedItemInfo)),
				ItemId = ItemId,
				LocationId = LocationId,
				PlayerSlot = Player,
				Player = Player,
				Flags = Flags,
				ItemGame = ItemGame,
				ItemName = ItemName,
				LocationGame = LocationGame,
				LocationName = LocationName
			};
		}
	}
	public class ScoutedItemInfo : ItemInfo
	{
		public new PlayerInfo Player => base.Player;

		public bool IsReceiverRelatedToActivePlayer { get; }

		public ScoutedItemInfo(NetworkItem item, string receiverGame, string senderGame, IItemInfoResolver itemInfoResolver, IPlayerHelper players, PlayerInfo player)
			: base(item, receiverGame, senderGame, itemInfoResolver, player)
		{
			IsReceiverRelatedToActivePlayer = (players.ActivePlayer ?? new PlayerInfo()).IsRelatedTo(player);
		}
	}
	public class JsonMessagePart
	{
		[JsonProperty("type")]
		[JsonConverter(typeof(AttemptingStringEnumConverter), new object[] { typeof(SnakeCaseNamingStrategy) })]
		public JsonMessagePartType? Type { get; set; }

		[JsonProperty("color")]
		[JsonConverter(typeof(AttemptingStringEnumConverter), new object[] { typeof(SnakeCaseNamingStrategy) })]
		public JsonMessagePartColor? Color { get; set; }

		[JsonProperty("text")]
		public string Text { get; set; }

		[JsonProperty("player")]
		public int? Player { get; set; }

		[JsonProperty("flags")]
		public ItemFlags? Flags { get; set; }

		[JsonProperty("hint_status")]
		public HintStatus? HintStatus { get; set; }
	}
	public struct NetworkItem
	{
		[JsonProperty("item")]
		public long Item { get; set; }

		[JsonProperty("location")]
		public long Location { get; set; }

		[JsonProperty("player")]
		public int Player { get; set; }

		[JsonProperty("flags")]
		public ItemFlags Flags { get; set; }
	}
	public struct NetworkPlayer
	{
		[JsonProperty("team")]
		public int Team { get; set; }

		[JsonProperty("slot")]
		public int Slot { get; set; }

		[JsonProperty("alias")]
		public string Alias { get; set; }

		[JsonProperty("name")]
		public string Name { get; set; }
	}
	public struct NetworkSlot
	{
		[JsonProperty("name")]
		public string Name { get; set; }

		[JsonProperty("game")]
		public string Game { get; set; }

		[JsonProperty("type")]
		public SlotType Type { get; set; }

		[JsonProperty("group_members")]
		public int[] GroupMembers { get; set; }
	}
	public class NetworkVersion
	{
		[JsonProperty("major")]
		public int Major { get; set; }

		[JsonProperty("minor")]
		public int Minor { get; set; }

		[JsonProperty("build")]
		public int Build { get; set; }

		[JsonProperty("class")]
		public string Class => "Version";

		public NetworkVersion()
		{
		}

		public NetworkVersion(int major, int minor, int build)
		{
			Major = major;
			Minor = minor;
			Build = build;
		}

		public NetworkVersion(Version version)
		{
			Major = version.Major;
			Minor = version.Minor;
			Build = version.Build;
		}

		public Version ToVersion()
		{
			return new Version(Major, Minor, Build);
		}
	}
	public class OperationSpecification
	{
		[JsonProperty("operation")]
		[JsonConverter(typeof(AttemptingStringEnumConverter), new object[] { typeof(SnakeCaseNamingStrategy) })]
		public OperationType OperationType;

		[JsonProperty("value")]
		public JToken Value { get; set; }

		public override string ToString()
		{
			return $"{OperationType}: {Value}";
		}
	}
	public static class Operation
	{
		public static OperationSpecification Min(int i)
		{
			return new OperationSpecification
			{
				OperationType = OperationType.Min,
				Value = JToken.op_Implicit(i)
			};
		}

		public static OperationSpecification Min(long i)
		{
			return new OperationSpecification
			{
				OperationType = OperationType.Min,
				Value = JToken.op_Implicit(i)
			};
		}

		public static OperationSpecification Min(float i)
		{
			return new OperationSpecification
			{
				OperationType = OperationType.Min,
				Value = JToken.op_Implicit(i)
			};
		}

		public static OperationSpecification Min(double i)
		{
			return new OperationSpecification
			{
				OperationType = OperationType.Min,
				Value = JToken.op_Implicit(i)
			};
		}

		public static OperationSpecification Min(decimal i)
		{
			return new OperationSpecification
			{
				OperationType = OperationType.Min,
				Value = JToken.op_Implicit(i)
			};
		}

		public static OperationSpecification Min(JToken i)
		{
			return new OperationSpecification
			{
				OperationType = OperationType.Min,
				Value = i
			};
		}

		public static OperationSpecification Min(BigInteger i)
		{
			return new OperationSpecification
			{
				OperationType = OperationType.Min,
				Value = JToken.Parse(i.ToString())
			};
		}

		public static OperationSpecification Max(int i)
		{
			return new OperationSpecification
			{
				OperationType = OperationType.Max,
				Value = JToken.op_Implicit(i)
			};
		}

		public static OperationSpecification Max(long i)
		{
			return new OperationSpecification
			{
				OperationType = OperationType.Max,
				Value = JToken.op_Implicit(i)
			};
		}

		public static OperationSpecification Max(float i)
		{
			return new OperationSpecification
			{
				OperationType = OperationType.Max,
				Value = JToken.op_Implicit(i)
			};
		}

		public static OperationSpecification Max(double i)
		{
			return new OperationSpecification
			{
				OperationType = OperationType.Max,
				Value = JToken.op_Implicit(i)
			};
		}

		public static OperationSpecification Max(decimal i)
		{
			return new OperationSpecification
			{
				OperationType = OperationType.Max,
				Value = JToken.op_Implicit(i)
			};
		}

		public static OperationSpecification Max(JToken i)
		{
			return new OperationSpecification
			{
				OperationType = OperationType.Max,
				Value = i
			};
		}

		public static OperationSpecification Max(BigInteger i)
		{
			return new OperationSpecification
			{
				OperationType = OperationType.Max,
				Value = JToken.Parse(i.ToString())
			};
		}

		public static OperationSpecification Remove(JToken value)
		{
			return new OperationSpecification
			{
				OperationType = OperationType.Remove,
				Value = value
			};
		}

		public static OperationSpecification Pop(int value)
		{
			return new OperationSpecification
			{
				OperationType = OperationType.Pop,
				Value = JToken.op_Implicit(value)
			};
		}

		public static OperationSpecification Pop(JToken value)
		{
			return new OperationSpecification
			{
				OperationType = OperationType.Pop,
				Value = value
			};
		}

		public static OperationSpecification Update(IDictionary dictionary)
		{
			return new OperationSpecification
			{
				OperationType = OperationType.Update,
				Value = (JToken)(object)JObject.FromObject((object)dictionary)
			};
		}

		public static OperationSpecification Floor()
		{
			return new OperationSpecification
			{
				OperationType = OperationType.Floor,
				Value = null
			};
		}

		public static OperationSpecification Ceiling()
		{
			return new OperationSpecification
			{
				OperationType = OperationType.Ceil,
				Value = null
			};
		}
	}
	public static class Bitwise
	{
		public static OperationSpecification Xor(long i)
		{
			return new OperationSpecification
			{
				OperationType = OperationType.Xor,
				Value = JToken.op_Implicit(i)
			};
		}

		public static OperationSpecification Xor(BigInteger i)
		{
			return new OperationSpecification
			{
				OperationType = OperationType.Xor,
				Value = JToken.Parse(i.ToString())
			};
		}

		public static OperationSpecification Or(long i)
		{
			return new OperationSpecification
			{
				OperationType = OperationType.Or,
				Value = JToken.op_Implicit(i)
			};
		}

		public static OperationSpecification Or(BigInteger i)
		{
			return new OperationSpecification
			{
				OperationType = OperationType.Or,
				Value = JToken.Parse(i.ToString())
			};
		}

		public static OperationSpecification And(long i)
		{
			return new OperationSpecification
			{
				OperationType = OperationType.And,
				Value = JToken.op_Implicit(i)
			};
		}

		public static OperationSpecification And(BigInteger i)
		{
			return new OperationSpecification
			{
				OperationType = OperationType.And,
				Value = JToken.Parse(i.ToString())
			};
		}

		public static OperationSpecification LeftShift(long i)
		{
			return new OperationSpecification
			{
				OperationType = OperationType.LeftShift,
				Value = JToken.op_Implicit(i)
			};
		}

		public static OperationSpecification RightShift(long i)
		{
			return new OperationSpecification
			{
				OperationType = OperationType.RightShift,
				Value = JToken.op_Implicit(i)
			};
		}
	}
	public class Callback
	{
		internal DataStorageHelper.DataStorageUpdatedHandler Method { get; set; }

		private Callback()
		{
		}

		public static Callback Add(DataStorageHelper.DataStorageUpdatedHandler callback)
		{
			return new Callback
			{
				Method = callback
			};
		}
	}
	public class AdditionalArgument
	{
		internal string Key { get; set; }

		internal JToken Value { get; set; }

		private AdditionalArgument()
		{
		}

		public static AdditionalArgument Add(string name, JToken value)
		{
			return new AdditionalArgument
			{
				Key = name,
				Value = value
			};
		}
	}
	public class MinimalSerializableItemInfo
	{
		public long ItemId { get; set; }

		public long LocationId { get; set; }

		public int PlayerSlot { get; set; }

		public ItemFlags Flags { get; set; }

		public string ItemGame { get; set; }

		public string LocationGame { get; set; }
	}
	public class SerializableItemInfo : MinimalSerializableItemInfo
	{
		public bool IsScout { get; set; }

		public PlayerInfo Player { get; set; }

		public string ItemName { get; set; }

		public string LocationName { get; set; }

		[JsonIgnore]
		public string ItemDisplayName => ItemName ?? $"Item: {base.ItemId}";

		[JsonIgnore]
		public string LocationDisplayName => LocationName ?? $"Location: {base.LocationId}";

		public string ToJson(bool full = false)
		{
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Expected O, but got Unknown
			MinimalSerializableItemInfo minimalSerializableItemInfo = this;
			if (!full)
			{
				minimalSerializableItemInfo = new MinimalSerializableItemInfo
				{
					ItemId = base.ItemId,
					LocationId = base.LocationId,
					PlayerSlot = base.PlayerSlot,
					Flags = base.Flags
				};
				if (IsScout)
				{
					minimalSerializableItemInfo.ItemGame = base.ItemGame;
				}
				else
				{
					minimalSerializableItemInfo.LocationGame = base.LocationGame;
				}
			}
			JsonSerializerSettings val = new JsonSerializerSettings
			{
				NullValueHandling = (NullValueHandling)1,
				Formatting = (Formatting)0
			};
			return JsonConvert.SerializeObject((object)minimalSerializableItemInfo, val);
		}

		public static SerializableItemInfo FromJson(string json, IArchipelagoSession session = null)
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Expected O, but got Unknown
			ItemInfoStreamingContext additional = ((session != null) ? new ItemInfoStreamingContext
			{
				Items = session.Items,
				Locations = session.Locations,
				PlayerHelper = session.Players,
				ConnectionInfo = session.ConnectionInfo
			} : null);
			JsonSerializerSettings val = new JsonSerializerSettings
			{
				Context = new StreamingContext(StreamingContextStates.Other, additional)
			};
			return JsonConvert.DeserializeObject<SerializableItemInfo>(json, val);
		}

		[OnDeserialized]
		internal void OnDeserializedMethod(StreamingContext streamingContext)
		{
			if (base.ItemGame == null && base.LocationGame != null)
			{
				IsScout = false;
			}
			else if (base.ItemGame != null && base.LocationGame == null)
			{
				IsScout = true;
			}
			if (streamingContext.Context is ItemInfoStreamingContext itemInfoStreamingContext)
			{
				if (IsScout && base.LocationGame == null)
				{
					base.LocationGame = itemInfoStreamingContext.ConnectionInfo.Game;
				}
				else if (!IsScout && base.ItemGame == null)
				{
					base.ItemGame = itemInfoStreamingContext.ConnectionInfo.Game;
				}
				if (ItemName == null)
				{
					ItemName = itemInfoStreamingContext.Items.GetItemName(base.ItemId, base.ItemGame);
				}
				if (LocationName == null)
				{
					LocationName = itemInfoStreamingContext.Locations.GetLocationNameFromId(base.LocationId, base.LocationGame);
				}
				if (Player == null)
				{
					Player = itemInfoStreamingContext.PlayerHelper.GetPlayerInfo(base.PlayerSlot);
				}
			}
		}
	}
	internal class ItemInfoStreamingContext
	{
		public IReceivedItemsHelper Items { get; set; }

		public ILocationCheckHelper Locations { get; set; }

		public IPlayerHelper PlayerHelper { get; set; }

		public IConnectionInfoProvider ConnectionInfo { get; set; }
	}
}
namespace Archipelago.MultiClient.Net.MessageLog.Parts
{
	public class EntranceMessagePart : MessagePart
	{
		internal EntranceMessagePart(JsonMessagePart messagePart)
			: base(MessagePartType.Entrance, messagePart, Archipelago.MultiClient.Net.Colors.PaletteColor.Blue)
		{
			base.Text = messagePart.Text;
		}
	}
	public class HintStatusMessagePart : MessagePart
	{
		internal HintStatusMessagePart(JsonMessagePart messagePart)
			: base(MessagePartType.HintStatus, messagePart)
		{
			base.Text = messagePart.Text;
			if (messagePart.HintStatus.HasValue)
			{
				base.PaletteColor = ColorUtils.GetColor(messagePart.HintStatus.Value);
			}
		}
	}
	public class ItemMessagePart : MessagePart
	{
		public ItemFlags Flags { get; }

		public long ItemId { get; }

		public int Player { get; }

		internal ItemMessagePart(IPlayerHelper players, IItemInfoResolver items, JsonMessagePart part)
			: base(MessagePartType.Item, part)
		{
			Flags = part.Flags.GetValueOrDefault();
			base.PaletteColor = ColorUtils.GetColor(Flags);
			Player = part.Player.GetValueOrDefault();
			string game = (players.GetPlayerInfo(Player) ?? new PlayerInfo()).Game;
			JsonMessagePartType? type = part.Type;
			if (type.HasValue)
			{
				switch (type.GetValueOrDefault())
				{
				case JsonMessagePartType.ItemId:
					ItemId = long.Parse(part.Text);
					base.Text = items.GetItemName(ItemId, game) ?? $"Item: {ItemId}";
					break;
				case JsonMessagePartType.ItemName:
					ItemId = 0L;
					base.Text = part.Text;
					break;
				}
			}
		}
	}
	public class LocationMessagePart : MessagePart
	{
		public long LocationId { get; }

		public int Player { get; }

		internal LocationMessagePart(IPlayerHelper players, IItemInfoResolver itemInfoResolver, JsonMessagePart part)
			: base(MessagePartType.Location, part, Archipelago.MultiClient.Net.Colors.PaletteColor.Green)
		{
			Player = part.Player.GetValueOrDefault();
			string game = (players.GetPlayerInfo(Player) ?? new PlayerInfo()).Game;
			JsonMessagePartType? type = part.Type;
			if (type.HasValue)
			{
				switch (type.GetValueOrDefault())
				{
				case JsonMessagePartType.LocationId:
					LocationId = long.Parse(part.Text);
					base.Text = itemInfoResolver.GetLocationName(LocationId, game) ?? $"Location: {LocationId}";
					break;
				case JsonMessagePartType.LocationName:
					LocationId = itemInfoResolver.GetLocationId(part.Text, game);
					base.Text = part.Text;
					break;
				}
			}
		}
	}
	public class MessagePart
	{
		public string Text { get; internal set; }

		public MessagePartType Type { get; internal set; }

		public Color Color => GetColor(BuiltInPalettes.Dark);

		public PaletteColor? PaletteColor { get; protected set; }

		public bool IsBackgroundColor { get; internal set; }

		internal MessagePart(MessagePartType type, JsonMessagePart messagePart, PaletteColor? color = null)
		{
			Type = type;
			Text = messagePart.Text;
			if (color.HasValue)
			{
				PaletteColor = color.Value;
			}
			else if (messagePart.Color.HasValue)
			{
				PaletteColor = ColorUtils.GetColor(messagePart.Color.Value);
				IsBackgroundColor = messagePart.Color.Value >= JsonMessagePartColor.BlackBg;
			}
			else
			{
				PaletteColor = null;
			}
		}

		public T GetColor<T>(Palette<T> palette)
		{
			return palette[PaletteColor];
		}

		public override string ToString()
		{
			return Text;
		}
	}
	public enum MessagePartType
	{
		Text,
		Player,
		Item,
		Location,
		Entrance,
		HintStatus
	}
	public class PlayerMessagePart : MessagePart
	{
		public bool IsActivePlayer { get; }

		public int SlotId { get; }

		internal PlayerMessagePart(IPlayerHelper players, IConnectionInfoProvider connectionInfo, JsonMessagePart part)
			: base(MessagePartType.Player, part)
		{
			switch (part.Type)
			{
			case JsonMessagePartType.PlayerId:
				SlotId = int.Parse(part.Text);
				IsActivePlayer = SlotId == connectionInfo.Slot;
				base.Text = players.GetPlayerAlias(SlotId) ?? $"Player {SlotId}";
				break;
			case JsonMessagePartType.PlayerName:
				SlotId = 0;
				IsActivePlayer = false;
				base.Text = part.Text;
				break;
			}
			base.PaletteColor = (IsActivePlayer ? Archipelago.MultiClient.Net.Colors.PaletteColor.Magenta : Archipelago.MultiClient.Net.Colors.PaletteColor.Yellow);
		}
	}
}
namespace Archipelago.MultiClient.Net.MessageLog.Messages
{
	public class AdminCommandResultLogMessage : LogMessage
	{
		internal AdminCommandResultLogMessage(MessagePart[] parts)
			: base(parts)
		{
		}
	}
	public class ChatLogMessage : PlayerSpecificLogMessage
	{
		public string Message { get; }

		internal ChatLogMessage(MessagePart[] parts, IPlayerHelper players, int team, int slot, string message)
			: base(parts, players, team, slot)
		{
			Message = message;
		}
	}
	public class CollectLogMessage : PlayerSpecificLogMessage
	{
		internal CollectLogMessage(MessagePart[] parts, IPlayerHelper players, int team, int slot)
			: base(parts, players, team, slot)
		{
		}
	}
	public class CommandResultLogMessage : LogMessage
	{
		internal CommandResultLogMessage(MessagePart[] parts)
			: base(parts)
		{
		}
	}
	public class CountdownLogMessage : LogMessage
	{
		public int RemainingSeconds { get; }

		internal CountdownLogMessage(MessagePart[] parts, int remainingSeconds)
			: base(parts)
		{
			RemainingSeconds = remainingSeconds;
		}
	}
	public class GoalLogMessage : PlayerSpecificLogMessage
	{
		internal GoalLogMessage(MessagePart[] parts, IPlayerHelper players, int team, int slot)
			: base(parts, players, team, slot)
		{
		}
	}
	public class HintItemSendLogMessage : ItemSendLogMessage
	{
		public bool IsFound { get; }

		internal HintItemSendLogMessage(MessagePart[] parts, IPlayerHelper players, int receiver, int sender, NetworkItem item, bool found, IItemInfoResolver itemInfoResolver)
			: base(parts, players, receiver, sender, item, itemInfoResolver)
		{
			IsFound = found;
		}
	}
	public class ItemCheatLogMessage : ItemSendLogMessage
	{
		internal ItemCheatLogMessage(MessagePart[] parts, IPlayerHelper players, int team, int slot, NetworkItem item, IItemInfoResolver itemInfoResolver)
			: base(parts, players, slot, 0, item, team, itemInfoResolver)
		{
		}
	}
	public class ItemSendLogMessage : LogMessage
	{
		private PlayerInfo ActivePlayer { get; }

		public PlayerInfo Receiver { get; }

		public PlayerInfo Sender { get; }

		public bool IsReceiverTheActivePlayer => Receiver == ActivePlayer;

		public bool IsSenderTheActivePlayer => Sender == ActivePlayer;

		public bool IsRelatedToActivePlayer
		{
			get
			{
				if (!ActivePlayer.IsRelatedTo(Receiver))
				{
					return ActivePlayer.IsRelatedTo(Sender);
				}
				return true;
			}
		}

		public ItemInfo Item { get; }

		internal ItemSendLogMessage(MessagePart[] parts, IPlayerHelper players, int receiver, int sender, NetworkItem item, IItemInfoResolver itemInfoResolver)
			: this(parts, players, receiver, sender, item, players.ActivePlayer.Team, itemInfoResolver)
		{
		}

		internal ItemSendLogMessage(MessagePart[] parts, IPlayerHelper players, int receiver, int sender, NetworkItem item, int team, IItemInfoResolver itemInfoResolver)
			: base(parts)
		{
			ActivePlayer = players.ActivePlayer ?? new PlayerInfo();
			Receiver = players.GetPlayerInfo(team, receiver) ?? new PlayerInfo();
			Sender = players.GetPlayerInfo(team, sender) ?? new PlayerInfo();
			PlayerInfo player = players.GetPlayerInfo(team, item.Player) ?? new PlayerInfo();
			Item = new ItemInfo(item, Receiver.Game, Sender.Game, itemInfoResolver, player);
		}
	}
	public class JoinLogMessage : PlayerSpecificLogMessage
	{
		public string[] Tags { get; }

		internal JoinLogMessage(MessagePart[] parts, IPlayerHelper players, int team, int slot, string[] tags)
			: base(parts, players, team, slot)
		{
			Tags = tags;
		}
	}
	public class LeaveLogMessage : PlayerSpecificLogMessage
	{
		internal LeaveLogMessage(MessagePart[] parts, IPlayerHelper players, int team, int slot)
			: base(parts, players, team, slot)
		{
		}
	}
	public class LogMessage
	{
		public MessagePart[] Parts { get; }

		internal LogMessage(MessagePart[] parts)
		{
			Parts = parts;
		}

		public override string ToString()
		{
			if (Parts.Length == 1)
			{
				return Parts[0].Text;
			}
			StringBuilder stringBuilder = new StringBuilder();
			MessagePart[] parts = Parts;
			foreach (MessagePart messagePart in parts)
			{
				stringBuilder.Append(messagePart.Text);
			}
			return stringBuilder.ToString();
		}
	}
	public abstract class PlayerSpecificLogMessage : LogMessage
	{
		private PlayerInfo ActivePlayer { get; }

		public PlayerInfo Player { get; }

		public bool IsActivePlayer => Player == ActivePlayer;

		public bool IsRelatedToActivePlayer => ActivePlayer.IsRelatedTo(Player);

		internal PlayerSpecificLogMessage(MessagePart[] parts, IPlayerHelper players, int team, int slot)
			: base(parts)
		{
			ActivePlayer = players.ActivePlayer ?? new PlayerInfo();
			Player = players.GetPlayerInfo(team, slot) ?? new PlayerInfo();
		}
	}
	public class ReleaseLogMessage : PlayerSpecificLogMessage
	{
		internal ReleaseLogMessage(MessagePart[] parts, IPlayerHelper players, int team, int slot)
			: base(parts, players, team, slot)
		{
		}
	}
	public class ServerChatLogMessage : LogMessage
	{
		public string Message { get; }

		internal ServerChatLogMessage(MessagePart[] parts, string message)
			: base(parts)
		{
			Message = message;
		}
	}
	public class TagsChangedLogMessage : PlayerSpecificLogMessage
	{
		public string[] Tags { get; }

		internal TagsChangedLogMessage(MessagePart[] parts, IPlayerHelper players, int team, int slot, string[] tags)
			: base(parts, players, team, slot)
		{
			Tags = tags;
		}
	}
	public class TutorialLogMessage : LogMessage
	{
		internal TutorialLogMessage(MessagePart[] parts)
			: base(parts)
		{
		}
	}
}
namespace Archipelago.MultiClient.Net.Helpers
{
	public class ArchipelagoSocketHelper : BaseArchipelagoSocketHelper<ClientWebSocket>, IArchipelagoSocketHelper
	{
		public Uri Uri { get; }

		internal ArchipelagoSocketHelper(Uri hostUri)
			: base(CreateWebSocket(), 1024)
		{
			Uri = hostUri;
			SecurityProtocolType securityProtocolType = SecurityProtocolType.Tls13;
			ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | securityProtocolType;
		}

		private static ClientWebSocket CreateWebSocket()
		{
			return new ClientWebSocket();
		}

		public async Task ConnectAsync()
		{
			await ConnectToProvidedUri(Uri);
			StartPolling();
		}

		private async Task ConnectToProvidedUri(Uri uri)
		{
			if (uri.Scheme != "unspecified")
			{
				try
				{
					await Socket.ConnectAsync(uri, CancellationToken.None);
					return;
				}
				catch (Exception e)
				{
					OnError(e);
					throw;
				}
			}
			List<Exception> errors = new List<Exception>(0);
			try
			{
				await Socket.ConnectAsync(uri.AsWss(), CancellationToken.None);
				if (Socket.State == WebSocketState.Open)
				{
					return;
				}
			}
			catch (Exception item)
			{
				errors.Add(item);
				Socket = CreateWebSocket();
			}
			try
			{
				await Socket.ConnectAsync(uri.AsWs(), CancellationToken.None);
			}
			catch (Exception item2)
			{
				errors.Add(item2);
				OnError(new AggregateException(errors));
				throw;
			}
		}
	}
	public class BaseArchipelagoSocketHelper<T> where T : WebSocket
	{
		private static readonly ArchipelagoPacketConverter Converter = new ArchipelagoPacketConverter();

		private readonly BlockingCollection<Tuple<ArchipelagoPacketBase, TaskCompletionSource<bool>>> sendQueue = new BlockingCollection<Tuple<ArchipelagoPacketBase, TaskCompletionSource<bool>>>();

		internal T Socket;

		private readonly int bufferSize;

		public bool Connected
		{
			get
			{
				if (Socket.State != WebSocketState.Open)
				{
					return Socket.State == WebSocketState.CloseReceived;
				}
				return true;
			}
		}

		public event ArchipelagoSocketHelperDelagates.PacketReceivedHandler PacketReceived;

		public event ArchipelagoSocketHelperDelagates.PacketsSentHandler PacketsSent;

		public event ArchipelagoSocketHelperDelagates.ErrorReceivedHandler ErrorReceived;

		public event ArchipelagoSocketHelperDelagates.SocketClosedHandler SocketClosed;

		public event ArchipelagoSocketHelperDelagates.SocketOpenedHandler SocketOpened;

		internal BaseArchipelagoSocketHelper(T socket, int bufferSize = 1024)
		{
			Socket = socket;
			this.bufferSize = bufferSize;
		}

		internal void StartPolling()
		{
			if (this.SocketOpened != null)
			{
				this.SocketOpened();
			}
			Task.Run((Func<Task?>)PollingLoop);
			Task.Run((Func<Task?>)SendLoop);
		}

		private async Task PollingLoop()
		{
			byte[] buffer = new byte[bufferSize];
			while (Socket.State == WebSocketState.Open)
			{
				string message = null;
				try
				{
					message = await ReadMessageAsync(buffer);
				}
				catch (Exception e)
				{
					OnError(e);
				}
				OnMessageReceived(message);
			}
		}

		private async Task SendLoop()
		{
			while (Socket.State == WebSocketState.Open)
			{
				try
				{
					await HandleSendBuffer();
				}
				catch (Exception e)
				{
					OnError(e);
				}
				await Task.Delay(20);
			}
		}

		private async Task<string> ReadMessageAsync(byte[] buffer)
		{
			using MemoryStream readStream = new MemoryStream(buffer.Length);
			WebSocketReceiveResult result;
			do
			{
				result = await Socket.ReceiveAsync(new ArraySegment<byte>(buffer), CancellationToken.None);
				if (result.MessageType == WebSocketMessageType.Close)
				{
					try
					{
						await Socket.CloseAsync(WebSocketCloseStatus.NormalClosure, string.Empty, CancellationToken.None);
					}
					catch
					{
					}
					OnSocketClosed();
				}
				else
				{
					readStream.Write(buffer, 0, result.Count);
				}
			}
			while (!result.EndOfMessage);
			return Encoding.UTF8.GetString(readStream.ToArray());
		}

		public async Task DisconnectAsync()
		{
			await Socket.CloseAsync(WebSocketCloseStatus.NormalClosure, "Closure requested by client", CancellationToken.None);
			OnSocketClosed();
		}

		public void SendPacket(ArchipelagoPacketBase packet)
		{
			SendMultiplePackets(new List<ArchipelagoPacketBase> { packet });
		}

		public void SendMultiplePackets(List<ArchipelagoPacketBase> packets)
		{
			SendMultiplePackets(packets.ToArray());
		}

		public void SendMultiplePackets(params ArchipelagoPacketBase[] packets)
		{
			SendMultiplePacketsAsync(packets).Wait();
		}

		public Task SendPacketAsync(ArchipelagoPacketBase packet)
		{
			return SendMultiplePacketsAsync(new List<ArchipelagoPacketBase> { packet });
		}

		public Task SendMultiplePacketsAsync(List<ArchipelagoPacketBase> packets)
		{
			return SendMultiplePacketsAsync(packets.ToArray());
		}

		public Task SendMultiplePacketsAsync(params ArchipelagoPacketBase[] packets)
		{
			TaskCompletionSource<bool> taskCompletionSource = new TaskCompletionSource<bool>();
			foreach (ArchipelagoPacketBase item in packets)
			{
				sendQueue.Add(new Tuple<ArchipelagoPacketBase, TaskCompletionSource<bool>>(item, taskCompletionSource));
			}
			return taskCompletionSource.Task;
		}

		private async Task HandleSendBuffer()
		{
			List<ArchipelagoPacketBase> list = new List<ArchipelagoPacketBase>();
			List<TaskCompletionSource<bool>> tasks = new List<TaskCompletionSource<bool>>();
			Tuple<ArchipelagoPacketBase, TaskCompletionSource<bool>> tuple = sendQueue.Take();
			list.Add(tuple.Item1);
			tasks.Add(tuple.Item2);
			Tuple<ArchipelagoPacketBase, TaskCompletionSource<bool>> item;
			while (sendQueue.TryTake(out item))
			{
				list.Add(item.Item1);
				tasks.Add(item.Item2);
			}
			if (!list.Any())
			{
				return;
			}
			if (Socket.State != WebSocketState.Open)
			{
				throw new ArchipelagoSocketClosedException();
			}
			ArchipelagoPacketBase[] packets = list.ToArray();
			string s = JsonConvert.SerializeObject((object)packets);
			byte[] messageBuffer = Encoding.UTF8.GetBytes(s);
			int messagesCount = (int)Math.Ceiling((double)messageBuffer.Length / (double)bufferSize);
			for (int i = 0; i < messagesCount; i++)
			{
				int num = bufferSize * i;
				int num2 = bufferSize;
				bool endOfMessage = i + 1 == messagesCount;
				if (num2 * (i + 1) > messageBuffer.Length)
				{
					num2 = messageBuffer.Length - num;
				}
				await Socket.SendAsync(new ArraySegment<byte>(messageBuffer, num, num2), WebSocketMessageType.Text, endOfMessage, CancellationToken.None);
			}
			foreach (TaskCompletionSource<bool> item2 in tasks)
			{
				item2.TrySetResult(result: true);
			}
			OnPacketSend(packets);
		}

		private void OnPacketSend(ArchipelagoPacketBase[] packets)
		{
			try
			{
				if (this.PacketsSent != null)
				{
					this.PacketsSent(packets);
				}
			}
			catch (Exception e)
			{
				OnError(e);
			}
		}

		private void OnSocketClosed()
		{
			try
			{
				if (this.SocketClosed != null)
				{
					this.SocketClosed("");
				}
			}
			catch (Exception e)
			{
				OnError(e);
			}
		}

		private void OnMessageReceived(string message)
		{
			try
			{
				if (string.IsNullOrEmpty(message) || this.PacketReceived == null)
				{
					return;
				}
				List<ArchipelagoPacketBase> list = null;
				try
				{
					list = JsonConvert.DeserializeObject<List<ArchipelagoPacketBase>>(message, (JsonConverter[])(object)new JsonConverter[1] { Converter });
				}
				catch (Exception e)
				{
					OnError(e);
				}
				if (list == null)
				{
					return;
				}
				foreach (ArchipelagoPacketBase item in list)
				{
					this.PacketReceived(item);
				}
			}
			catch (Exception e2)
			{
				OnError(e2);
			}
		}

		protected void OnError(Exception e)
		{
			try
			{
				if (this.ErrorReceived != null)
				{
					this.ErrorReceived(e, e.Message);
				}
			}
			catch (Exception ex)
			{
				Console.Out.WriteLine("Error occured during reporting of errorOuter Errror: " + e.Message + " " + e.StackTrace + "Inner Errror: " + ex.Message + " " + ex.StackTrace);
			}
		}
	}
	public interface IConnectionInfoProvider
	{
		string Game { get; }

		int Team { get; }

		int Slot { get; }

		string[] Tags { get; }

		ItemsHandlingFlags ItemsHandlingFlags { get; }

		string Uuid { get; }

		void UpdateConnectionOptions(string[] tags);

		void UpdateConnectionOptions(ItemsHandlingFlags itemsHandlingFlags);

		void UpdateConnectionOptions(string[] tags, ItemsHandlingFlags itemsHandlingFlags);
	}
	public class ConnectionInfoHelper : IConnectionInfoProvider
	{
		private readonly IArchipelagoSocketHelper socket;

		public string Game { get; private set; }

		public int Team { get; private set; }

		public int Slot { get; private set; }

		public string[] Tags { get; internal set; }

		public ItemsHandlingFlags ItemsHandlingFlags { get; internal set; }

		public string Uuid { get; private set; }

		internal ConnectionInfoHelper(IArchipelagoSocketHelper socket)
		{
			this.socket = socket;
			Reset();
			socket.PacketReceived += PacketReceived;
		}

		private void PacketReceived(ArchipelagoPacketBase packet)
		{
			if (!(packet is ConnectedPacket connectedPacket))
			{
				if (packet is ConnectionRefusedPacket)
				{
					Reset();
				}
				return;
			}
			Team = connectedPacket.Team;
			Slot = connectedPacket.Slot;
			if (connectedPacket.SlotInfo != null && connectedPacket.SlotInfo.ContainsKey(Slot))
			{
				Game = connectedPacket.SlotInfo[Slot].Game;
			}
		}

		internal void SetConnectionParameters(string game, string[] tags, ItemsHandlingFlags itemsHandlingFlags, string uuid)
		{
			Game = game;
			Tags = tags ?? new string[0];
			ItemsHandlingFlags = itemsHandlingFlags;
			Uuid = uuid ?? Guid.NewGuid().ToString();
		}

		private void Reset()
		{
			Game = null;
			Team = -1;
			Slot = -1;
			Tags = new string[0];
			ItemsHandlingFlags = ItemsHandlingFlags.NoItems;
			Uuid = null;
		}

		public void UpdateConnectionOptions(string[] tags)
		{
			UpdateConnectionOptions(tags, ItemsHandlingFlags);
		}

		public void UpdateConnectionOptions(ItemsHandlingFlags itemsHandlingFlags)
		{
			UpdateConnectionOptions(Tags, itemsHandlingFlags);
		}

		public void UpdateConnectionOptions(string[] tags, ItemsHandlingFlags itemsHandlingFlags)
		{
			SetConnectionParameters(Game, tags, itemsHandlingFlags, Uuid);
			socket.SendPacket(new ConnectUpdatePacket
			{
				Tags = Tags,
				ItemsHandling = ItemsHandlingFlags
			});
		}
	}
	public interface IDataStorageHelper : IDataStorageWrapper
	{
		DataStorageElement this[Scope scope, string key] { get; set; }

		DataStorageElement this[string key] { get; set; }
	}
	public class DataStorageHelper : IDataStorageHelper, IDataStorageWrapper
	{
		public delegate void DataStorageUpdatedHandler(JToken originalValue, JToken newValue, Dictionary<string, JToken> additionalArguments);

		private readonly Dictionary<string, DataStorageUpdatedHandler> onValueChangedEventHandlers = new Dictionary<string, DataStorageUpdatedHandler>();

		private readonly Dictionary<Guid, DataStorageUpdatedHandler> operationSpecificCallbacks = new Dictionary<Guid, DataStorageUpdatedHandler>();

		private readonly Dictionary<string, TaskCompletionSource<JToken>> asyncRetrievalTasks = new Dictionary<string, TaskCompletionSource<JToken>>();

		private readonly IArchipelagoSocketHelper socket;

		private readonly IConnectionInfoProvider connectionInfoProvider;

		public DataStorageElement this[Scope scope, string key]
		{
			get
			{
				return this[AddScope(scope, key)];
			}
			set
			{
				this[AddScope(scope, key)] = value;
			}
		}

		public DataStorageElement this[string key]
		{
			get
			{
				return new DataStorageElement(GetContextForKey(key));
			}
			set
			{
				SetValue(key, value);
			}
		}

		internal DataStorageHelper(IArchipelagoSocketHelper socket, IConnectionInfoProvider connectionInfoProvider)
		{
			this.socket = socket;
			this.connectionInfoProvider = connectionInfoProvider;
			socket.PacketReceived += OnPacketReceived;
		}

		private void OnPacketReceived(ArchipelagoPacketBase packet)
		{
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Invalid comparison between Unknown and I4
			if (!(packet is RetrievedPacket retrievedPacket))
			{
				if (packet is SetReplyPacket setReplyPacket)
				{
					if (setReplyPacket.AdditionalArguments != null && setReplyPacket.AdditionalArguments.ContainsKey("Reference") && (int)setReplyPacket.AdditionalArguments["Reference"].Type == 8 && ((string)setReplyPacket.AdditionalArguments["Reference"]).TryParseNGuid(out var g) && operationSpecificCallbacks.TryGetValue(g, out var value))
					{
						value(setReplyPacket.OriginalValue, setReplyPacket.Value, setReplyPacket.AdditionalArguments);
						operationSpecificCallbacks.Remove(g);
					}
					if (onValueChangedEventHandlers.TryGetValue(setReplyPacket.Key, out var value2))
					{
						value2(setReplyPacket.OriginalValue, setReplyPacket.Value, setReplyPacket.AdditionalArguments);
					}
				}
				return;
			}
			foreach (KeyValuePair<string, JToken> datum in retrievedPacket.Data)
			{
				if (asyncRetrievalTasks.TryGetValue(datum.Key, out var value3))
				{
					value3.TrySetResult(datum.Value);
					asyncRetrievalTasks.Remove(datum.Key);
				}
			}
		}

		private Task<JToken> GetAsync(string key)
		{
			if (asyncRetrievalTasks.TryGetValue(key, out var value))
			{
				return value.Task;
			}
			TaskCompletionSource<JToken> taskCompletionSource = new TaskCompletionSource<JToken>();
			asyncRetrievalTasks[key] = taskCompletionSource;
			socket.SendPacketAsync(new GetPacket
			{
				Keys = new string[1] { key }
			});
			return taskCompletionSource.Task;
		}

		private void Initialize(string key, JToken value)
		{
			socket.SendPacketAsync(new SetPacket
			{
				Key = key,
				DefaultValue = value,
				Operations = new OperationSpecification[1]
				{
					new OperationSpecification
					{
						OperationType = OperationType.Default
					}
				}
			});
		}

		private JToken GetValue(string key)
		{
			Task<JToken> async = GetAsync(key);
			if (!async.Wait(TimeSpan.FromSeconds(2.0)))
			{
				throw new TimeoutException("Timed out retrieving data for key `" + key + "`. This may be due to an attempt to retrieve a value from the DataStorageHelper in a synchronous fashion from within a PacketReceived handler. When using the DataStorageHelper from within code which runs on the websocket thread then use the asynchronous getters. Ex: `DataStorageHelper[\"" + key + "\"].GetAsync().ContinueWith(x => {});`Be aware that DataStorageHelper calls tend to cause packet responses, so making a call from within a PacketReceived handler may cause an infinite loop.");
			}
			return async.Result;
		}

		private void SetValue(string key, DataStorageElement e)
		{
			if (key.StartsWith("_read_"))
			{
				throw new InvalidOperationException("DataStorage write operation on readonly key '" + key + "' is not allowed");
			}
			if (e == null)
			{
				e = new DataStorageElement(OperationType.Replace, (JToken)(object)JValue.CreateNull());
			}
			if (e.Context == null)
			{
				e.Context = GetContextForKey(key);
			}
			else if (e.Context.Key != key)
			{
				e.Operations.Insert(0, new OperationSpecification
				{
					OperationType = OperationType.Replace,
					Value = GetValue(e.Context.Key)
				});
			}
			Dictionary<string, JToken> dictionary = e.AdditionalArguments ?? new Dictionary<string, JToken>(0);
			if (e.Callbacks != null)
			{
				Guid key2 = Guid.NewGuid();
				operationSpecificCallbacks[key2] = e.Callbacks;
				dictionary["Reference"] = JToken.op_Implicit(key2.ToString("N"));
				socket.SendPacketAsync(new SetPacket
				{
					Key = key,
					Operations = e.Operations.ToArray(),
					WantReply = true,
					AdditionalArguments = dictionary
				});
			}
			else
			{
				socket.SendPacketAsync(new SetPacket
				{
					Key = key,
					Operations = e.Operations.ToArray(),
					AdditionalArguments = dictionary
				});
			}
		}

		private DataStorageElementContext GetContextForKey(string key)
		{
			return new DataStorageElementContext
			{
				Key = key,
				GetData = GetValue,
				GetAsync = GetAsync,
				Initialize = Initialize,
				AddHandler = AddHandler,
				RemoveHandler = RemoveHandler
			};
		}

		private void AddHandler(string key, DataStorageUpdatedHandler handler)
		{
			if (onValueChangedEventHandlers.ContainsKey(key))
			{
				Dictionary<string, DataStorageUpdatedHandler> dictionary = onValueChangedEventHandlers;
				dictionary[key] = (DataStorageUpdatedHandler)Delegate.Combine(dictionary[key], handler);
			}
			else
			{
				onValueChangedEventHandlers[key] = handler;
			}
			socket.SendPacketAsync(new SetNotifyPacket
			{
				Keys = new string[1] { key }
			});
		}

		private void RemoveHandler(string key, DataStorageUpdatedHandler handler)
		{
			if (onValueChangedEventHandlers.ContainsKey(key))
			{
				Dictionary<string, DataStorageUpdatedHandler> dictionary = onValueChangedEventHandlers;
				dictionary[key] = (DataStorageUpdatedHandler)Delegate.Remove(dictionary[key], handler);
				if (onValueChangedEventHandlers[key] == null)
				{
					onValueChangedEventHandlers.Remove(key);
				}
			}
		}

		private string AddScope(Scope scope, string key)
		{
			return scope switch
			{
				Scope.Global => key, 
				Scope.Game => $"{scope}:{connectionInfoProvider.Game}:{key}", 
				Scope.Team => $"{scope}:{connectionInfoProvider.Team}:{key}", 
				Scope.Slot => $"{scope}:{connectionInfoProvider.Slot}:{key}", 
				Scope.ReadOnly => "_read_" + key, 
				_ => throw new ArgumentOutOfRangeException("scope", scope, "Invalid scope for key " + key), 
			};
		}

		private DataStorageElement GetHintsElement(int? slot = null, int? team = null)
		{
			return this[Scope.ReadOnly, $"hints_{team ?? connectionInfoProvider.Team}_{slot ?? connectionInfoProvider.Slot}"];
		}

		private DataStorageElement GetSlotDataElement(int? slot = null)
		{
			return this[Scope.ReadOnly, $"slot_data_{slot ?? connectionInfoProvider.Slot}"];
		}

		private DataStorageElement GetItemNameGroupsElement(string game = null)
		{
			return this[Scope.ReadOnly, "item_name_groups_" + (game ?? connectionInfoProvider.Game)];
		}

		private DataStorageElement GetLocationNameGroupsElement(string game = null)
		{
			return this[Scope.ReadOnly, "location_name_groups_" + (game ?? connectionInfoProvider.Game)];
		}

		private DataStorageElement GetClientStatusElement(int? slot = null, int? team = null)
		{
			return this[Scope.ReadOnly, $"client_status_{team ?? connectionInfoProvider.Team}_{slot ?? connectionInfoProvider.Slot}"];
		}

		private DataStorageElement GetRaceModeElement()
		{
			return this[Scope.ReadOnly, "race_mode"];
		}

		public Hint[] GetHints(int? slot = null, int? team = null)
		{
			return GetHintsElement(slot, team).To<Hint[]>();
		}

		public Task<Hint[]> GetHintsAsync(int? slot = null, int? team = null)
		{
			return GetHintsElement(slot, team).GetAsync<Hint[]>();
		}

		public void TrackHints(Action<Hint[]> onHintsUpdated, bool retrieveCurrentlyUnlockedHints = true, int? slot = null, int? team = null)
		{
			GetHintsElement(slot, team).OnValueChanged += delegate(JToken _, JToken newValue, Dictionary<string, JToken> x)
			{
				onHintsUpdated(newValue.ToObject<Hint[]>());
			};
			if (retrieveCurrentlyUnlockedHints)
			{
				GetHintsAsync(slot, team).ContinueWith(delegate(Task<Hint[]> t)
				{
					onHintsUpdated(t.Result);
				});
			}
		}

		public Dictionary<string, object> GetSlotData(int? slot = null)
		{
			return GetSlotData<Dictionary<string, object>>(slot);
		}

		public T GetSlotData<T>(int? slot = null) where T : class
		{
			return GetSlotDataElement(slot).To<T>();
		}

		public Task<Dictionary<string, object>> GetSlotDataAsync(int? slot = null)
		{
			return GetSlotDataAsync<Dictionary<string, object>>(slot);
		}

		public Task<T> GetSlotDataAsync<T>(int? slot = null) where T : class
		{
			return GetSlotDataElement(slot).GetAsync<T>();
		}

		public Dictionary<string, string[]> GetItemNameGroups(string game = null)
		{
			return GetItemNameGroupsElement(game).To<Dictionary<string, string[]>>();
		}

		public Task<Dictionary<string, string[]>> GetItemNameGroupsAsync(string game = null)
		{
			return GetItemNameGroupsElement(game).GetAsync<Dictionary<string, string[]>>();
		}

		public Dictionary<string, string[]> GetLocationNameGroups(string game = null)
		{
			return GetLocationNameGroupsElement(game).To<Dictionary<string, string[]>>();
		}

		public Task<Dictionary<string, string[]>> GetLocationNameGroupsAsync(string game = null)
		{
			return GetLocationNameGroupsElement(game).GetAsync<Dictionary<string, string[]>>();
		}

		public ArchipelagoClientState GetClientStatus(int? slot = null, int? team = null)
		{
			return GetClientStatusElement(slot, team).To<ArchipelagoClientState?>().GetValueOrDefault();
		}

		public Task<ArchipelagoClientState> GetClientStatusAsync(int? slot = null, int? team = null)
		{
			return GetClientStatusElement(slot, team).GetAsync<ArchipelagoClientState?>().ContinueWith((Task<ArchipelagoClientState?> r) => r.Result.GetValueOrDefault());
		}

		public void TrackClientStatus(Action<ArchipelagoClientState> onStatusUpdated, bool retrieveCurrentClientStatus = true, int? slot = null, int? team = null)
		{
			Get

BepInEx/plugins/BendyAndTheArchipelagoMachine/BendyAndTheArchipelagoMachine.dll

Decompiled 3 weeks ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Threading;
using Ai;
using Archipelago.MultiClient.Net;
using Archipelago.MultiClient.Net.BounceFeatures.DeathLink;
using Archipelago.MultiClient.Net.Enums;
using Archipelago.MultiClient.Net.Helpers;
using Archipelago.MultiClient.Net.MessageLog.Messages;
using Archipelago.MultiClient.Net.Models;
using Archipelago.MultiClient.Net.Packets;
using BendyAndTheArchipelagoMachine.Archipelago;
using BendyAndTheArchipelagoMachine.Patches;
using BendyAndTheArchipelagoMachine.Utils;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using InControl;
using Newtonsoft.Json;
using S13Audio;
using TMG.Core;
using TMG.Data;
using TMG.GamepadControl;
using TMG.UI.Controls;
using UnityEngine;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("BendyAndTheArchipelagoMachine")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("BendyAndTheArchipelagoMachine")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("b1f15d8f-0256-4b46-abd0-6c8eeb39d997")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace BendyAndTheArchipelagoMachine
{
	[BepInPlugin("lorecrafter.bendyandtheinkmachine.archipelago", "Bendy and the Archipelago Machine", "1.3.0")]
	public class BendyAndTheArchipelagoMachine : BaseUnityPlugin
	{
		public const string pluginGuid = "lorecrafter.bendyandtheinkmachine.archipelago";

		public const string pluginName = "Bendy and the Archipelago Machine";

		public const string pluginVersion = "1.3.0";

		public const string ModDisplayInfo = "Bendy and the Archipelago Machine v1.3.0";

		private const string APDisplayInfo = "Archipelago v0.6.7";

		public static ManualLogSource Logger;

		public static Client ArchipelagoClient;

		public void Awake()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			Logger = ((BaseUnityPlugin)this).Logger;
			ArchipelagoClient = new Client();
			ArchipelagoConsole.Awake();
			CheckpointMenu.Awake();
			new Harmony("lorecrafter.bendyandtheinkmachine.archipelago").PatchAll();
			ArchipelagoConsole.LogMessage("Bendy and the Archipelago Machine v1.3.0 loaded!");
		}

		private void Update()
		{
			ArchipelagoClient.ProcessItems();
			if (GetInputArchipelagoConsole())
			{
				ArchipelagoConsole.ToggleHidden();
			}
			ArchipelagoClient.deathLinkHandler?.ProcessDeaths();
		}

		private static bool GetInputArchipelagoConsole()
		{
			bool buttonDown = GamepadInput.GetButtonDown((InputControlType)106);
			bool keyDown = Input.GetKeyDown((KeyCode)96);
			if (buttonDown)
			{
				return buttonDown;
			}
			return keyDown && keyDown;
		}

		private void OnGUI()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_021c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0249: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Expected O, but got Unknown
			GUI.Label(new Rect(16f, 16f, 300f, 20f), "Bendy and the Archipelago Machine v1.3.0");
			ArchipelagoConsole.OnGUI();
			CheckpointMenu.OnGUI();
			string text;
			if (Client.authenticated)
			{
				text = " Status: Connected";
				GUI.Label(new Rect(16f, 50f, 300f, 20f), "Archipelago v0.6.7" + text);
				if (Client.NeedBaconSoup)
				{
					GUI.Label(new Rect(16f, 70f, 300f, 20f), Client.BaconSoupCount());
				}
				bool deathLinkStatus = ArchipelagoClient.deathLinkHandler.GetDeathLinkStatus();
				if (GUI.Button(new Rect(16f, 95f, (float)(deathLinkStatus ? 117 : 120), 25f), "Deathlink " + (deathLinkStatus ? "enabled" : "disabled"), new GUIStyle(GUI.skin.button)
				{
					alignment = (TextAnchor)3
				}))
				{
					ArchipelagoClient.deathLinkHandler.ToggleDeathLink();
				}
				return;
			}
			text = " Status: Disconnected";
			GUI.Label(new Rect(16f, 50f, 300f, 20f), "Archipelago v0.6.7" + text);
			GUI.Label(new Rect(16f, 70f, 150f, 20f), "Host: ");
			GUI.Label(new Rect(16f, 90f, 150f, 20f), "Player Name: ");
			GUI.Label(new Rect(16f, 110f, 150f, 20f), "Password: ");
			Client.serverData.Uri = GUI.TextField(new Rect(150f, 70f, 150f, 20f), Client.serverData.Uri);
			Client.serverData.SlotName = GUI.TextField(new Rect(150f, 90f, 150f, 20f), Client.serverData.SlotName);
			Client.serverData.Password = GUI.TextField(new Rect(150f, 110f, 150f, 20f), Client.serverData.Password);
			if (GUI.Button(new Rect(16f, 130f, 100f, 20f), "Connect") && !Utility.IsNullOrWhiteSpace(Client.serverData.SlotName))
			{
				ArchipelagoClient.Connect();
			}
		}
	}
}
namespace BendyAndTheArchipelagoMachine.Utils
{
	public static class ArchipelagoConsole
	{
		public static bool Hidden = true;

		private static List<string> logLines = new List<string>();

		private static Vector2 scrollView;

		private static Rect window;

		private static Rect scroll;

		private static Rect text;

		private static Rect hideShowButton;

		private static GUIStyle textStyle = new GUIStyle();

		private static string scrollText = "";

		private static float lastUpdateTime = Time.time;

		private const int MaxLogLines = 80;

		private const float HideTimeout = 15f;

		private static string CommandText = "!help";

		private static Rect CommandTextRect;

		private static Rect SendCommandButton;

		public static void Awake()
		{
			UpdateWindow();
		}

		public static void LogMessage(string message)
		{
			if (!Utility.IsNullOrWhiteSpace(message))
			{
				if (logLines.Count == 80)
				{
					logLines.RemoveAt(0);
				}
				logLines.Add(message);
				BendyAndTheArchipelagoMachine.Logger.LogMessage((object)message);
				lastUpdateTime = Time.time;
				UpdateWindow();
			}
		}

		public static void OnGUI()
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			if (logLines.Count == 0)
			{
				return;
			}
			if (!Hidden || Time.time - lastUpdateTime < 15f)
			{
				scrollView = GUI.BeginScrollView(window, scrollView, scroll);
				GUI.Box(text, "");
				GUI.Box(text, scrollText, textStyle);
				GUI.EndScrollView();
			}
			if (GUI.Button(hideShowButton, Hidden ? "Show" : "Hide"))
			{
				Hidden = !Hidden;
				UpdateWindow();
			}
			if (!Hidden && Client.authenticated)
			{
				CommandText = GUI.TextField(CommandTextRect, CommandText);
				if (!Utility.IsNullOrWhiteSpace(CommandText) && GUI.Button(SendCommandButton, "Send"))
				{
					BendyAndTheArchipelagoMachine.ArchipelagoClient.SendMessage(CommandText);
					CommandText = "";
				}
			}
		}

		public static void ToggleHidden()
		{
			BendyAndTheArchipelagoMachine.Logger.LogDebug((object)"Toggle Hidden");
			Hidden = !Hidden;
			UpdateWindow();
		}

		public static void UpdateWindow()
		{
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f6: Expected O, but got Unknown
			//IL_0237: Unknown result type (might be due to invalid IL or missing references)
			//IL_023c: Unknown result type (might be due to invalid IL or missing references)
			//IL_028e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0293: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c7: Unknown result type (might be due to invalid IL or missing references)
			scrollText = "";
			if (Hidden)
			{
				if (logLines.Count > 0)
				{
					scrollText = logLines[logLines.Count - 1];
				}
			}
			else
			{
				for (int i = 0; i < logLines.Count; i++)
				{
					scrollText += "> ";
					scrollText += logLines.ElementAt(i);
					if (i < logLines.Count - 1)
					{
						scrollText += "\n\n";
					}
				}
			}
			int num = (int)((float)Screen.width * 0.4f);
			int num3;
			int num2;
			if (Hidden)
			{
				num2 = (int)((float)Screen.height * 0.03f);
				num3 = num2;
			}
			else
			{
				num2 = (int)((float)Screen.height * 0.3f);
				num3 = num2 * 10;
			}
			window = new Rect((float)(Screen.width / 2 - num / 2), 0f, (float)num, (float)num2);
			scroll = new Rect(0f, 0f, (float)num * 0.9f, (float)num3);
			scrollView = new Vector2(0f, (float)num3);
			text = new Rect(0f, 0f, (float)num, (float)num3);
			textStyle.alignment = (TextAnchor)6;
			textStyle.fontSize = (Hidden ? ((int)((float)Screen.height * 0.0165f)) : ((int)((float)Screen.height * 0.0185f)));
			textStyle.normal.textColor = Color.white;
			textStyle.wordWrap = !Hidden;
			int num4 = (int)((float)Screen.width * 0.01f);
			int num5 = (int)((float)Screen.height * 0.01f);
			textStyle.padding = (Hidden ? new RectOffset(num4 / 2, num4 / 2, num5 / 2, num5 / 2) : new RectOffset(num4, num4, num5, num5));
			int num6 = (int)((float)Screen.width * 0.12f);
			int num7 = (int)((float)Screen.height * 0.03f);
			hideShowButton = new Rect((float)(Screen.width / 2 + num / 2 + num6 / 3), (float)Screen.height * 0.004f, (float)num6, (float)num7);
			num = (int)((float)Screen.width * 0.4f);
			int num8 = (int)((float)Screen.width / 2f - (float)num / 2f);
			int num9 = (int)((float)Screen.height * 0.307f);
			num2 = (int)((float)Screen.height * 0.022f);
			CommandTextRect = new Rect((float)num8, (float)num9, (float)num, (float)num2);
			num = (int)((float)Screen.width * 0.035f);
			num9 += (int)((float)Screen.height * 0.03f);
			SendCommandButton = new Rect((float)num8, (float)num9, (float)num, (float)num2);
		}
	}
	public static class CheckpointMenu
	{
		private static float checkpointsWidth;

		private static float checkpointsHeight;

		private static float xPos;

		private static float yPos;

		private static Rect position;

		private static Dictionary<int, List<string>> CheckpointNames = new Dictionary<int, List<string>>
		{
			{
				0,
				new List<string> { "Start", "Basement" }
			},
			{
				1,
				new List<string> { "Start", "Lost Keys", "Sammy's Sanctuary" }
			},
			{
				2,
				new List<string> { "Start", "Decisions", "Angel's Bidding", "Ink Hearts" }
			},
			{
				3,
				new List<string> { "Start", "Warehouse", "Haunted House" }
			},
			{
				4,
				new List<string> { "Start", "Administration", "The Ink Machine" }
			},
			{
				5,
				new List<string> { "Start" }
			}
		};

		public static bool hidden;

		public static int selectedChapter;

		public static int selectedCheckpoint;

		public static bool demonPath = false;

		public static void Awake()
		{
			hidden = true;
			selectedChapter = 0;
			selectedCheckpoint = 0;
		}

		public static void OnGUI()
		{
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			if (!hidden)
			{
				string[] availableCheckpoints = GetAvailableCheckpoints();
				xPos = (float)Screen.width * 0.7f;
				yPos = (float)Screen.height * 0.2f;
				checkpointsWidth = (float)Screen.width * 0.15f;
				checkpointsHeight = (float)Screen.height * 0.03f * (float)availableCheckpoints.Length;
				position = new Rect(xPos, yPos, checkpointsWidth, checkpointsHeight);
				selectedCheckpoint = GUI.SelectionGrid(position, selectedCheckpoint, availableCheckpoints, 1);
				if (selectedChapter == 2 && (Client.HasItem("CH3 Checkpoint - Angel's Bidding") || Client.HasItem("CH3 Checkpoint - Butcher Gang")) && GUI.Button(new Rect(xPos + checkpointsWidth, yPos + (float)Screen.height * 0.06f, checkpointsWidth * 0.45f, (float)Screen.height * 0.06f), demonPath ? "Demon Path" : "Angel Path"))
				{
					demonPath = !demonPath;
				}
			}
		}

		private static string[] GetAvailableCheckpoints()
		{
			string[] array = new string[CheckpointNames[selectedChapter].Count];
			switch (selectedChapter)
			{
			case 0:
				array[0] = (Client.HasItem("CH1 - Moving Pictures") ? "Start" : "Locked");
				array[1] = (Client.HasItem("CH1 Checkpoint - Bendy Chase") ? "Bendy Chase" : "Locked");
				break;
			case 1:
				array[0] = (Client.HasItem("CH2 - The Old Song") ? "Start" : "Locked");
				array[1] = (Client.HasItem("CH2 Checkpoint - Lost Keys") ? "Lost Keys" : "Locked");
				array[2] = (Client.HasItem("CH2 Checkpoint - Sammy's Office") ? "Sammy's Office" : "Locked");
				break;
			case 2:
				array[0] = (Client.HasItem("CH3 - Rise and Fall") ? "Start" : "Locked");
				array[1] = (Client.HasItem("CH3 Checkpoint - Toy Machine") ? "Toy Machine" : "Locked");
				array[2] = (Client.HasItem("CH3 Checkpoint - Angel's Bidding") ? "Angel's Bidding" : "Locked");
				array[3] = (Client.HasItem("CH3 Checkpoint - Butcher Gang") ? "Butcher Gang" : "Locked");
				break;
			case 3:
				array[0] = (Client.HasItem("CH4 - Colossal Wonders") ? "Start" : "Locked");
				array[1] = (Client.HasItem("CH4 Checkpoint - Warehouse") ? "Warehouse" : "Locked");
				array[2] = (Client.HasItem("CH4 Checkpoint - Brute Boris") ? "Brute Boris" : "Locked");
				break;
			case 4:
				array[0] = (Client.HasItem("CH5 - The Last Reel") ? "Start" : "Locked");
				array[1] = (Client.HasItem("CH5 Checkpoint - Administration") ? "Administration" : "Locked");
				array[2] = (Client.HasItem("CH5 Checkpoint - The Ink Machine") ? "The Ink Machine" : "Locked");
				break;
			default:
				array[0] = "Start";
				break;
			}
			return array;
		}
	}
	public class Config
	{
		public string LastUri;

		public string LastSlotName;

		public bool DeathlinkEnabled;

		public Config(string uri, string slot, bool deathlink)
		{
			LastUri = uri;
			LastSlotName = slot;
			DeathlinkEnabled = deathlink;
		}

		public void UpdateConnectionInfo(string uri, string slot)
		{
			LastUri = uri;
			LastSlotName = slot;
			SaveConfig();
		}

		public void UpdateDeathlink(bool deathlink)
		{
			DeathlinkEnabled = deathlink;
			SaveConfig();
		}

		private void SaveConfig()
		{
			string path = Path.Combine(Paths.PluginPath, "Lorecrafter703-Bendy_and_the_Archipelago_Machine", "BendyAndTheArchipelagoMachine", "config.json");
			string contents = JsonConvert.SerializeObject((object)this, (Formatting)1);
			File.WriteAllText(path, contents);
		}
	}
}
namespace BendyAndTheArchipelagoMachine.Patches
{
	[HarmonyPatch]
	internal class AudioLogs
	{
		[HarmonyPostfix]
		[HarmonyPatch(typeof(CH1AudioLogsController), "HandleAudioLogThomas01OnInteracted")]
		public static void DarkAndColdLog()
		{
			Client.SendLocation("CH1 Audio Log - Thomas Connor (Flooded Basement)");
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(CH1AudioLogsController), "HandleAudioLogWally01OnInteracted")]
		public static void ThisMachineLog()
		{
			Client.SendLocation("CH1 Audio Log - Wally Franks (Hallway Table)");
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(CH2AudioLogsController), "HandleAudioLogThePrayerOnInteracted")]
		public static void CanIGetAnAmenLog()
		{
			Client.SendLocation("CH2 Audio Log - Sammy Lawrence (Can I Get An Amen?)");
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(CH2AudioLogsController), "HandleAudioLogDistractionsOnInteracted")]
		public static void ThePumpSwitchLog()
		{
			Client.SendLocation("CH2 Audio Log - Sammy Lawrence (Music Department Lobby)");
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(CH2AudioLogsController), "HandleAudioLogTheNewVoiceAcressOnInteracted")]
		public static void NewActressLog()
		{
			Client.SendLocation("CH2 Audio Log - Susie Campbell (Recording Studio)");
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(CH2AudioLogsController), "HandleAudioLogTheProjectionistOnInteracted")]
		public static void CrazySammyLog()
		{
			Client.SendLocation("CH2 Audio Log - Norman Polk (Projector)");
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(CH2AudioLogsController), "HandleAudioLogLostKeyOnInteracted")]
		public static void StupidKeysLog()
		{
			Client.SendLocation("CH2 Audio Log - Wally Franks (Sammy’s Office)");
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(CH2AudioLogsController), "HandleAudioLogFavoriteSongOnInteracted")]
		public static void SanctuaryPuzzleLog()
		{
			Client.SendLocation("CH2 Audio Log - Sammy Lawrence (Wally’s Closet)");
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(CH2AudioLogsController), "HandleAudioLogJackFainOnInteracted")]
		public static void QuietAndSmellySewersLog()
		{
			Client.SendLocation("CH2 Audio Log - Jack Fain (Desk in Sewers)");
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(CH3AudioLogController), "HandleAudioLogGrantGeniusOnInteracted")]
		public static void TheGeniusUpstairsLog()
		{
			Client.SendLocation("CH3 Audio Log - Grant Cohen (Accounting Office on Level 9)");
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(CH3AudioLogController), "HandleAudioLogHenryOnInteracted")]
		public static void ManOfIdeasLog()
		{
			Client.SendLocation("CH3 Audio Log - Henry (Sunken Room)");
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(CH3AudioLogController), "HandleAudioLogJoeyDrewBeliefOnInteracted")]
		public static void TimeToBelieveLog()
		{
			Client.SendLocation("CH3 Audio Log - Joey Drew (Path of the Demon)");
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(CH3AudioLogController), "HandleAudioLogNormanTroubleOnInteracted")]
		public static void LookingForTroubleLog()
		{
			Client.SendLocation("CH3 Audio Log - Norman Polk (Projectionist’s Maze)");
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(CH3AudioLogController), "HandleAudioLogShawnCrookedOnInteracted")]
		public static void CrookedSmileLog()
		{
			Client.SendLocation("CH3 Audio Log - Shawn Flynn (Toy Machine Room)");
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(CH3AudioLogController), "HandleAudioLogSusieApartOnInteracted")]
		public static void EverythingIsComingApartLog()
		{
			Client.SendLocation("CH3 Audio Log - Susie Campbell (Path of the Angel)");
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(CH3AudioLogController), "HandleAudioLogSusieLunchOnInteracted")]
		public static void LunchWithJoeyLog()
		{
			Client.SendLocation("CH3 Audio Log - Susie Campbell (Flooded Morgue)");
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(CH3AudioLogController), "HandleAudioLogThomasOnInteracted")]
		public static void CuttingCornersLog()
		{
			Client.SendLocation("CH3 Audio Log - Thomas Connor (Level 9)");
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(CH3AudioLogController), "HandleAudioLogWallySmileOnInteracted")]
		public static void CrackASmileLog()
		{
			Client.SendLocation("CH3 Audio Log - Wally Franks (Level 11)");
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(CH3AudioLogController), "HandleAudioLogWallyThomasOnInteracted")]
		public static void InkPressureLog()
		{
			Client.SendLocation("CH3 Audio Log - Wally Franks and Thomas Connor (Level K Power Hallway)");
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(CH4AudioLogController), "HandleAudioLogBertTransformOnInteracted")]
		public static void ColossalWondersLog()
		{
			Client.SendLocation("CH4 Audio Log - Bertrum Piedmont (Planning Room)");
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(CH4AudioLogController), "HandleAudioLogGrantTransformOnInteracted")]
		public static void IndiscernableLog()
		{
			Client.SendLocation("CH4 Audio Log - ??? (Management Office)");
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(CH4AudioLogController), "HandleAudioLogJoeyTransformOnInteracted")]
		public static void TurnItOffLog()
		{
			Client.SendLocation("CH4 Audio Log - Joey Drew (Maintenance Room)");
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(CH4AudioLogController), "HandleAudioLogLacieTransformOnInteracted")]
		public static void MechanicalDemonLog()
		{
			Client.SendLocation("CH4 Audio Log - Lacie Benton (Research & Design)");
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(CH4AudioLogController), "HandleAudioLogSusieTransformOnInteracted")]
		public static void BehindClosedDoorsLog()
		{
			Client.SendLocation("CH4 Audio Log - Susie Campbell (Library)");
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(CH4AudioLogController), "HandleAudioLogWallyTransformOnInteracted")]
		public static void PlayingGamesLog()
		{
			Client.SendLocation("CH4 Audio Log - Wally Franks (Minigame Station)");
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(CH4BertrumController), "HandleAudioLogOnInteracted")]
		public static void BertrumsRevealLog()
		{
			Client.SendLocation("CH4 Audio Log - Bertrum Piedmont (Attraction Storage)");
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(CH5AudioLogController), "HandleAudioLogThomasTransformOnInteracted")]
		public static void OfficeReportLog()
		{
			Client.SendLocation("CH5 Audio Log - Thomas Connor (Film Vault)");
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(CH5AudioLogController), "HandleAudioLogWallyTransformOnInteracted")]
		public static void ChocolateCakeLog()
		{
			Client.SendLocation("CH5 Audio Log - Wally Franks (Administration Maze)");
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(CH5AudioLogController), "HandleAudioLogJoeyMemoTransformOnInteracted")]
		public static void TheBigPictureLog()
		{
			Client.SendLocation("CH5 Audio Log - Joey Drew (Administration Maze Entrance)");
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(CH5AudioLogController), "HandleAudioLogJoeyTommyTransformOnInteracted")]
		public static void ThousandsOfSoulsLog()
		{
			Client.SendLocation("CH5 Audio Log - Joey Drew (Administration Maze Side Room)");
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(CH5AudioLogController), "HandleAudioLogJoeySusieTransformOnInteracted")]
		public static void BringingAliceToLifeLog()
		{
			Client.SendLocation("CH5 Audio Log - Joey Drew (Joey’s Office)");
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(CH5ThroneRoom), "HandleAudioLogOnInteracted")]
		public static void BendysEndLog()
		{
			Client.SendLocation("CH5 Audio Log - Joey Drew (Bendy’s Throne)");
		}
	}
	[HarmonyPatch(typeof(CH5ThroneRoom))]
	internal class BendyBoss
	{
		public static Interactable BendyAudioLog;

		[HarmonyPostfix]
		[HarmonyPatch("InitOnComplete")]
		public static void GetAudioLogReference(CH5ThroneRoom __instance, AudioLog ___m_AudioLog)
		{
			BendyAudioLog = (Interactable)(object)___m_AudioLog;
		}

		[HarmonyPostfix]
		[HarmonyPatch("OnDisposed")]
		public static void ClearAudioLogRef()
		{
			BendyAudioLog = null;
		}

		public static bool CheckBaconSoupRequirement()
		{
			int num = 0;
			foreach (long receivedItem in Client.serverData.ReceivedItems)
			{
				if (receivedItem == IDTables.GetItemID("Bacon Soup"))
				{
					num++;
				}
			}
			long num2 = (long)Client.serverData.GetSlotDataOption("bacon_soups_required");
			long num3 = (long)Client.serverData.GetSlotDataOption("total_bacon_soups") * num2 / 100;
			return num >= num3;
		}
	}
	[HarmonyPatch(typeof(CH4BertrumController))]
	internal class BertrumFight
	{
		public static Interactable BertrumFightAudioLog;

		[HarmonyPostfix]
		[HarmonyPatch("HandleDeathOnComplete")]
		public static void OnBertrumDeath()
		{
			Client.SendLocation("CH4 Boss - Bertrum");
		}

		[HarmonyPostfix]
		[HarmonyPatch("Init")]
		public static void GetAudioLogReference(CH4BertrumController __instance, AudioLog ___m_AudioLog)
		{
			BertrumFightAudioLog = (Interactable)(object)___m_AudioLog;
		}

		[HarmonyPostfix]
		[HarmonyPatch("OnDisposed")]
		public static void ClearAudioLogRef()
		{
			BertrumFightAudioLog = null;
		}

		public static bool HandleAudioLogInteract()
		{
			return Client.HasItem("Bertrum Bossfight");
		}
	}
	[HarmonyPatch(typeof(CH4AccountingController))]
	internal class BookPuzzleDoor
	{
		public static List<Interactable> Books = new List<Interactable>();

		[HarmonyPostfix]
		[HarmonyPatch("InitOnComplete")]
		public static void AddBookRefs(CH4AccountingController __instance, List<BookPuzzle> ___m_BookPuzzle)
		{
			foreach (BookPuzzle item in ___m_BookPuzzle)
			{
				Books.Add(item.Book);
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch("OnDisposed")]
		public static void ClearBookRefs()
		{
			Books.Clear();
		}

		public static bool HandleBookOnInteract()
		{
			return Client.HasItem("Book Puzzle");
		}
	}
	[HarmonyPatch(typeof(CH3BoneController))]
	internal class BorisBone
	{
		public static Interactable boneReference;

		[HarmonyPostfix]
		[HarmonyPatch("InitOnComplete")]
		public static void RegisterBone(CH3BoneController __instance, Interactable ___m_Bone)
		{
			boneReference = ___m_Bone;
		}

		public static bool HandleBonePickup()
		{
			if ((long)Client.serverData.GetSlotDataOption("boris_bone") == 0L)
			{
				return true;
			}
			Client.SendLocation("CH3 Boris' Bone");
			return Client.HasItem("Poor Dog's Bone");
		}

		[HarmonyPostfix]
		[HarmonyPatch("OnDisposed")]
		public static void ClearBoneRef()
		{
			boneReference = null;
		}
	}
	[HarmonyPatch(typeof(BruteBorisAi))]
	internal class BruteBorisFight
	{
		[HarmonyPostfix]
		[HarmonyPatch("Death")]
		public static void OnBruteBorisDeath()
		{
			Client.SendLocation("CH4 Boss - Brute Boris");
		}
	}
	[HarmonyPatch]
	internal class Checkpoints
	{
		public static void AddCheckpointItem(string checkpoint)
		{
			BendyAndTheArchipelagoMachine.Logger.LogDebug((object)(checkpoint + " Reached"));
			if ((long)Client.serverData.GetSlotDataOption("checkpoint_sanity") == 0L)
			{
				if (!Client.HasItem(checkpoint))
				{
					Client.serverData.AddItem(IDTables.GetItemID(checkpoint));
					ArchipelagoConsole.LogMessage("Received " + checkpoint);
				}
			}
			else
			{
				Client.SendLocation(checkpoint);
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(CH1MainPowerController), "HandleLeverOnComplete")]
		public static void BasementCheckpoint()
		{
			AddCheckpointItem("CH1 Checkpoint - Bendy Chase");
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(CH2LostKeysController), "HandleLostKeysObjectiveOnActive")]
		public static void LostKeysCheckpoint()
		{
			AddCheckpointItem("CH2 Checkpoint - Lost Keys");
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(CH2SammyOfficeController), "HandleLeverOnInteracted")]
		public static void SammysOfficeCheckpoint()
		{
			AddCheckpointItem("CH2 Checkpoint - Sammy's Office");
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(CH3HeavenlyToysController), "HandleBlockingTheWayOnComplete")]
		public static void DecisionsCheckpoint()
		{
			AddCheckpointItem("CH3 Checkpoint - Toy Machine");
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(CH3DecisionController), "HandleAliceTriggerOnEnter")]
		public static void SetDecisionAngel()
		{
			CheckpointMenu.demonPath = true;
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(CH3DecisionController), "HandleBendyTriggerOnEnter")]
		public static void SetDecisionDemon()
		{
			CheckpointMenu.demonPath = false;
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(CH3AliceLairController), "HandleBodyRoomTriggerOnEnter")]
		public static void AngelsBiddingCheckpoint()
		{
			AddCheckpointItem("CH3 Checkpoint - Angel's Bidding");
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(CH3CutoutTaskController), "BreakAllCutouts")]
		public static void ButcherGangCheckpoint()
		{
			AddCheckpointItem("CH3 Checkpoint - Butcher Gang");
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(CH4WarehouseController), "HandleEntranceTriggerOnEnter")]
		public static void WarehouseCheckpoint()
		{
			AddCheckpointItem("CH4 Checkpoint - Warehouse");
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(CH4HauntedHouseController), "HandlePowerLeverOnComplete")]
		public static void HauntedHouseCheckpoint()
		{
			AddCheckpointItem("CH4 Checkpoint - Brute Boris");
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(CH5LostHarbour), "Complete")]
		public static void AdministrationCheckpoint()
		{
			AddCheckpointItem("CH5 Checkpoint - Administration");
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(CH5GiantInkMachine), "HandleThroneRoomDoorOnOpened")]
		public static void TheInkMachineCheckpoint()
		{
			AddCheckpointItem("CH5 Checkpoint - The Ink Machine");
		}
	}
	[HarmonyPatch]
	internal class DeathLinkController
	{
		public static PlayerController playerController;

		public static bool isDead;

		[HarmonyPostfix]
		[HarmonyPatch(typeof(PlayerController), "Init")]
		public static void getPlayerRef(PlayerController __instance)
		{
			playerController = __instance;
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(PlayerController), "OnDisposed")]
		public static void clearPlayerRef()
		{
			playerController = null;
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(PlayerController), "Die")]
		public static void onDeath()
		{
			BendyAndTheArchipelagoMachine.Logger.LogDebug((object)"Died");
			BendyAndTheArchipelagoMachine.ArchipelagoClient.deathLinkHandler.SendDeathLink();
		}

		[HarmonyReversePatch(/*Could not decode attribute arguments.*/)]
		[HarmonyPatch(typeof(PlayerController), "Die")]
		public static void KillPlayer(PlayerController instance)
		{
			throw new NotImplementedException();
		}

		public static void Revive()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Invalid comparison between Unknown and I4
			if ((Object)(object)playerController == (Object)null)
			{
				isDead = true;
			}
			else
			{
				isDead = (int)playerController.CurrentStatus == 4;
			}
		}
	}
	[HarmonyPatch]
	internal class LeverChallenge
	{
		[HarmonyPostfix]
		[HarmonyPatch(typeof(CH3ServiceController), "HandleSearcherOnDeath")]
		public static void LeverChallenge1(CH3ServiceController __instance, List<SearcherBossAi> ___m_Searchers)
		{
			if ((long)Client.serverData.GetSlotDataOption("include_lever_challenges") != 0L && ___m_Searchers.Count <= 0)
			{
				Client.SendLocation("CH3 Lever Challenge 1");
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(CH3ServiceController), "HandleButcherGangOnDeath")]
		public static void LeverChallenge2(CH3ServiceController __instance, List<ButcherGangAi> ___m_ButcherGang)
		{
			if ((long)Client.serverData.GetSlotDataOption("include_lever_challenges") != 0L && ___m_ButcherGang.Count <= 0)
			{
				Client.SendLocation("CH3 Lever Challenge 2");
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(CH3ServiceController), "HandleSearcherBossOnDeath")]
		public static void LeverChallenge3(CH3ServiceController __instance)
		{
			if ((long)Client.serverData.GetSlotDataOption("include_lever_challenges") != 0L)
			{
				Client.SendLocation("CH3 Lever Challenge 3");
			}
		}
	}
	[HarmonyPatch(typeof(CH2LostKeysController))]
	internal class LostKeys
	{
		public static Interactable keysReference;

		[HarmonyPostfix]
		[HarmonyPatch("InitOnComplete")]
		public static void RegisterKeys(CH2LostKeysController __instance, Interactable ___m_Keys)
		{
			keysReference = ___m_Keys;
		}

		[HarmonyPostfix]
		[HarmonyPatch("OnDisposed")]
		public static void ClearKeysRef()
		{
			keysReference = null;
		}

		public static bool HandleKeysPickup()
		{
			Client.SendLocation("CH2 Lost Keys");
			return Client.HasItem("Wally's Keys");
		}
	}
	[HarmonyPatch(typeof(CH4LostOneSpecial))]
	internal class LostOneSpecialErrors
	{
		[HarmonyPrefix]
		[HarmonyPatch("Splash")]
		public static bool SplashFix(CH4LostOneSpecial __instance, S13ObjectComplex ___m_S13Object)
		{
			return (Object)(object)___m_S13Object != (Object)null;
		}
	}
	[HarmonyPatch]
	internal class Menu
	{
		public static TitleScreenController titleScreenController;

		[HarmonyPostfix]
		[HarmonyPatch(typeof(TitleScreenController), "InitController")]
		public static void GetTitleScreenController(TitleScreenController __instance, List<MenuItemButton> ___m_BeginMenuItemButtons)
		{
			titleScreenController = __instance;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(BaseUIButton), "OnPointerClick")]
		public static bool HandleConnect(BaseUIButton __instance)
		{
			if (((Object)__instance).name != "BeginBtn")
			{
				return true;
			}
			return Client.authenticated;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(TitleScreenController), "SelectSlot")]
		public static bool OnSlotSelect(int index)
		{
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Expected O, but got Unknown
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Expected O, but got Unknown
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Expected O, but got Unknown
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Expected O, but got Unknown
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Expected O, but got Unknown
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Expected O, but got Unknown
			if (!Client.serverData.VerifySlot(index))
			{
				ArchipelagoConsole.LogMessage($"Please Connect to Slot {Client.serverData.GetSlot() + 1}");
				return false;
			}
			int slot = Client.serverData.GetSlot();
			SaveFileData val = new SaveFileData(slot);
			val.IsNewGamePlus = true;
			val.HasDied = false;
			val.PlayTime = 0f;
			val.CH1Data = new CH1DataVO();
			val.CH2Data = new CH2DataVO();
			val.CH3Data = new CH3DataVO();
			val.CH4Data = new CH4DataVO();
			val.CH5Data = new CH5DataVO();
			GameManager.Instance.GameData.SaveFiles[slot] = val;
			return true;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(TitleScreenController), "ShowBeginMenu")]
		public static void ModifyButtons(TitleScreenController __instance, ref List<MenuItemButton> ___m_BeginMenuItemButtons)
		{
			List<MenuItemButton> list = new List<MenuItemButton>();
			foreach (MenuItemButton ___m_BeginMenuItemButton in ___m_BeginMenuItemButtons)
			{
				if (((Object)___m_BeginMenuItemButton).name != "ChaptersBtn")
				{
					((TMGMonoBehaviour)___m_BeginMenuItemButton).gameObject.SetActive(false);
					list.Add(___m_BeginMenuItemButton);
				}
			}
			foreach (MenuItemButton item in list)
			{
				if (___m_BeginMenuItemButtons.Contains(item))
				{
					___m_BeginMenuItemButtons.Remove(item);
				}
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(TitleScreenController), "CheckSelectedBeginMenu")]
		public static void GoToChapterSelect(TitleScreenController __instance, ref int ___m_SelectedIndex)
		{
			___m_SelectedIndex = 2;
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(TitleScreenController), "CheckSelectedBeginMenu")]
		public static void ShowCheckpointButtons()
		{
			CheckpointMenu.selectedChapter = 0;
			CheckpointMenu.hidden = false;
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(TitleScreenController), "HandleKBBackBtnOnClick")]
		public static void HideCheckpointButtons()
		{
			CheckpointMenu.hidden = true;
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(TitleScreenController), "HandleChapterArrowOnLeft")]
		public static void LeftArrowClick(TitleScreenController __instance, int ___m_SelectedChapter)
		{
			CheckpointMenu.selectedChapter = ___m_SelectedChapter;
			CheckpointMenu.selectedCheckpoint = 0;
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(TitleScreenController), "HandleChapterArrowOnRight")]
		public static void RightArrowClick(TitleScreenController __instance, int ___m_SelectedChapter)
		{
			CheckpointMenu.selectedChapter = ___m_SelectedChapter;
			CheckpointMenu.selectedCheckpoint = 0;
		}

		public static bool HasCheckpoint(int checkpoint)
		{
			switch (checkpoint)
			{
			case 0:
				return Client.HasItem("CH1 - Moving Pictures");
			case 1:
				return Client.HasItem("CH1 Checkpoint - Bendy Chase");
			case 5:
				return Client.HasItem("CH2 - The Old Song");
			case 6:
				return Client.HasItem("CH2 Checkpoint - Lost Keys");
			case 7:
				return Client.HasItem("CH2 Checkpoint - Sammy's Office");
			case 10:
				return Client.HasItem("CH3 - Rise and Fall");
			case 11:
				return Client.HasItem("CH3 Checkpoint - Toy Machine");
			case 12:
				return Client.HasItem("CH3 Checkpoint - Angel's Bidding");
			case 13:
				return Client.HasItem("CH3 Checkpoint - Butcher Gang");
			case 15:
				return Client.HasItem("CH4 - Colossal Wonders");
			case 16:
				return Client.HasItem("CH4 Checkpoint - Warehouse");
			case 17:
				return Client.HasItem("CH4 Checkpoint - Brute Boris");
			case 20:
				return Client.HasItem("CH5 - The Last Reel");
			case 21:
				return Client.HasItem("CH5 Checkpoint - Administration");
			case 22:
				return Client.HasItem("CH5 Checkpoint - The Ink Machine");
			case 25:
				return true;
			default:
				BendyAndTheArchipelagoMachine.Logger.LogError((object)$"Unknown Checkpoint: {checkpoint}");
				return false;
			}
		}

		public static void PrepareChapterData(int checkpoint)
		{
			int slot = Client.serverData.GetSlot();
			BendyAndTheArchipelagoMachine.Logger.LogDebug((object)$"Loading checkpoint {checkpoint}");
			SaveFileData val = SetCheckpointFlags(slot, checkpoint);
			GameManager.Instance.GameData.SaveFiles[slot] = val;
			GameManager.Instance.GameData.CurrentSaveFile = val;
		}

		public static SaveFileData SetCheckpointFlags(int slot, int checkpoint)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Expected O, but got Unknown
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Expected O, but got Unknown
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Expected O, but got Unknown
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Expected O, but got Unknown
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: Expected O, but got Unknown
			//IL_0222: Unknown result type (might be due to invalid IL or missing references)
			//IL_0227: Unknown result type (might be due to invalid IL or missing references)
			//IL_0231: Expected O, but got Unknown
			//IL_0246: Unknown result type (might be due to invalid IL or missing references)
			//IL_024b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0255: Expected O, but got Unknown
			//IL_02e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f6: Expected O, but got Unknown
			//IL_030b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0310: Unknown result type (might be due to invalid IL or missing references)
			//IL_031a: Expected O, but got Unknown
			//IL_0391: Unknown result type (might be due to invalid IL or missing references)
			//IL_0396: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a0: Expected O, but got Unknown
			//IL_03b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c4: Expected O, but got Unknown
			//IL_048f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0494: Unknown result type (might be due to invalid IL or missing references)
			//IL_049e: Expected O, but got Unknown
			//IL_04b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c2: Expected O, but got Unknown
			//IL_05fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0602: Unknown result type (might be due to invalid IL or missing references)
			//IL_060c: Expected O, but got Unknown
			//IL_0621: Unknown result type (might be due to invalid IL or missing references)
			//IL_0626: Unknown result type (might be due to invalid IL or missing references)
			//IL_0630: Expected O, but got Unknown
			//IL_06ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_06f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_06fd: Expected O, but got Unknown
			//IL_0712: Unknown result type (might be due to invalid IL or missing references)
			//IL_0717: Unknown result type (might be due to invalid IL or missing references)
			//IL_0721: Expected O, but got Unknown
			//IL_07b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_07b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_07c3: Expected O, but got Unknown
			//IL_07d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_07dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_07e7: Expected O, but got Unknown
			//IL_0882: Unknown result type (might be due to invalid IL or missing references)
			//IL_0887: Unknown result type (might be due to invalid IL or missing references)
			//IL_0891: Expected O, but got Unknown
			//IL_08a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_08ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_08b5: Expected O, but got Unknown
			//IL_0912: Unknown result type (might be due to invalid IL or missing references)
			//IL_0917: Unknown result type (might be due to invalid IL or missing references)
			//IL_0921: Expected O, but got Unknown
			//IL_0936: Unknown result type (might be due to invalid IL or missing references)
			//IL_093b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0945: Expected O, but got Unknown
			SaveFileData val = new SaveFileData(slot);
			val.IsNewGamePlus = true;
			val.HasDied = false;
			val.PlayTime = 0f;
			val.CH1Data = new CH1DataVO();
			val.CH2Data = new CH2DataVO();
			val.CH3Data = new CH3DataVO();
			val.CH4Data = new CH4DataVO();
			val.CH5Data = new CH5DataVO();
			SetCollectedBaconSoups(0);
			if (checkpoint < 1)
			{
				return val;
			}
			val.CH1Data.Book = SetObjectiveSaveData(isStarted: true, isComplete: true);
			val.CH1Data.Doll = SetObjectiveSaveData(isStarted: true, isComplete: true);
			val.CH1Data.Inkwell = SetObjectiveSaveData(isStarted: true, isComplete: true);
			val.CH1Data.Gear = SetObjectiveSaveData(isStarted: true, isComplete: true);
			val.CH1Data.Record = SetObjectiveSaveData(isStarted: true, isComplete: true);
			val.CH1Data.Wrench = SetObjectiveSaveData(isStarted: true, isComplete: true);
			val.CH1Data.InkMachineRevealObjective = SetObjectiveSaveData(isStarted: true, isComplete: true);
			val.CH1Data.CollectablesObjective = SetObjectiveSaveData(isStarted: true, isComplete: true);
			val.CH1Data.TheatreObjective = SetObjectiveSaveData(isStarted: true, isComplete: true);
			val.CH1Data.InkMachineObjective = SetObjectiveSaveData(isStarted: true, isComplete: true);
			((ChapterDataVO)val.CH1Data).IsChapterComplete = false;
			((ChapterDataVO)val.CH1Data).PlayerPosition = new Vector3DataVO(new Vector3(-10f, 3.23f, 180f));
			((ChapterDataVO)val.CH1Data).PlayerRotation = new Vector3DataVO(new Vector3(0f, 0f, 0f));
			((ChapterDataVO)val.CH1Data).HasSaveData = true;
			if (checkpoint < 5)
			{
				return val;
			}
			SetCollectedBaconSoups(1);
			val.CH1Data.BendyChaseObjective = SetObjectiveSaveData(isStarted: true, isComplete: true);
			val.CH1Data.BasementObjective = SetObjectiveSaveData(isStarted: true, isComplete: true);
			((ChapterDataVO)val.CH1Data).IsChapterComplete = true;
			if (checkpoint < 6)
			{
				return val;
			}
			val.CH2Data.RitualObjective = SetObjectiveSaveData(isStarted: true, isComplete: true);
			val.CH2Data.GateObjective = SetObjectiveSaveData(isStarted: true, isComplete: true);
			val.CH2Data.MusicDepartmentObjective = SetObjectiveSaveData(isStarted: true, isComplete: true);
			val.CH2Data.LostKeysObjective = SetObjectiveSaveData(isStarted: true, isComplete: false);
			((ChapterDataVO)val.CH2Data).IsChapterComplete = false;
			((ChapterDataVO)val.CH2Data).PlayerPosition = new Vector3DataVO(new Vector3(17f, -6.378374f, -237f));
			((ChapterDataVO)val.CH2Data).PlayerRotation = new Vector3DataVO(new Vector3(0f, 360f, 0f));
			((ChapterDataVO)val.CH2Data).HasSaveData = true;
			if (checkpoint < 7)
			{
				return val;
			}
			val.CH2Data.LostKeysObjective.IsComplete = true;
			val.CH2Data.MusicPuzzleObjective = SetObjectiveSaveData(isStarted: true, isComplete: true);
			val.CH2Data.SanctuaryObjective = SetObjectiveSaveData(isStarted: true, isComplete: true);
			val.CH2Data.InfirmaryObjective = SetObjectiveSaveData(isStarted: true, isComplete: true);
			val.CH2Data.SewersObjective = SetObjectiveSaveData(isStarted: true, isComplete: true);
			val.CH2Data.SammysOfficeObjective = SetObjectiveSaveData(isStarted: true, isComplete: true);
			((ChapterDataVO)val.CH2Data).PlayerPosition = new Vector3DataVO(new Vector3(36f, -7.044999f, -230f));
			((ChapterDataVO)val.CH2Data).PlayerRotation = new Vector3DataVO(new Vector3(0f, 90f, 0f));
			if (checkpoint < 10)
			{
				return val;
			}
			SetCollectedBaconSoups(2);
			((ChapterDataVO)val.CH2Data).IsChapterComplete = true;
			if (checkpoint < 11)
			{
				return val;
			}
			val.CH3Data.SafehouseObjective = SetObjectiveSaveData(isStarted: true, isComplete: true);
			val.CH3Data.DarkHallwayObjective = SetObjectiveSaveData(isStarted: true, isComplete: true);
			val.CH3Data.HeavenlyToysObjective = SetObjectiveSaveData(isStarted: true, isComplete: false);
			((ChapterDataVO)val.CH3Data).IsChapterComplete = false;
			((ChapterDataVO)val.CH3Data).PlayerPosition = new Vector3DataVO(new Vector3(188f, 12.955f, -128f));
			((ChapterDataVO)val.CH3Data).PlayerRotation = new Vector3DataVO(new Vector3(0f, 180f, 0f));
			((ChapterDataVO)val.CH3Data).HasSaveData = true;
			if (checkpoint < 12)
			{
				return val;
			}
			val.CH3Data.HeavenlyToysObjective.IsComplete = true;
			val.CH3Data.AliceRevealObjective = SetObjectiveSaveData(isStarted: true, isComplete: true);
			val.CH3Data.DecisionObjective = SetObjectiveSaveData(isStarted: true, isComplete: true);
			val.CH3Data.ChoseDevilsPath = CheckpointMenu.demonPath;
			val.CH3Data.Toy = ((!CheckpointMenu.demonPath) ? 1 : 3);
			val.CH3Data.BorisJumpscareObjective = SetObjectiveSaveData(isStarted: true, isComplete: true);
			val.CH3Data.PosterPiperObjective = SetObjectiveSaveData(isStarted: true, isComplete: true);
			val.CH3Data.EnterLiftObjective = SetObjectiveSaveData(isStarted: true, isComplete: true);
			val.CH3Data.AliceLairObjective = SetObjectiveSaveData(isStarted: true, isComplete: false);
			((ChapterDataVO)val.CH3Data).PlayerPosition = new Vector3DataVO(new Vector3(250f, -178.045f, -82f));
			((ChapterDataVO)val.CH3Data).PlayerRotation = new Vector3DataVO(new Vector3(0f, 250f, 0f));
			if (checkpoint < 13)
			{
				return val;
			}
			val.CH3Data.AliceLairObjective.IsComplete = true;
			val.CH3Data.AliceTasksObjective = SetObjectiveSaveData(isStarted: false, isComplete: false);
			ObjectDataVO[] array = val.CH3Data.GearTask.Object;
			for (int i = 0; i < array.Length; i++)
			{
				array[i].IsComplete = true;
			}
			val.CH3Data.GearTask.Status = SetObjectiveSaveData(isStarted: true, isComplete: true);
			array = val.CH3Data.ThickInkTask.Object;
			for (int i = 0; i < array.Length; i++)
			{
				array[i].IsComplete = true;
			}
			val.CH3Data.ThickInkTask.Status = SetObjectiveSaveData(isStarted: true, isComplete: true);
			array = val.CH3Data.PowerCoreTask.Object;
			for (int i = 0; i < array.Length; i++)
			{
				array[i].IsComplete = true;
			}
			val.CH3Data.PowerCoreTask.Status = SetObjectiveSaveData(isStarted: true, isComplete: true);
			array = val.CH3Data.CutoutTask.Object;
			for (int i = 0; i < array.Length; i++)
			{
				array[i].IsComplete = true;
			}
			val.CH3Data.CutoutTask.Status = SetObjectiveSaveData(isStarted: true, isComplete: true);
			((ChapterDataVO)val.CH3Data).PlayerPosition = new Vector3DataVO(new Vector3(324f, -177.952f, -95f));
			((ChapterDataVO)val.CH3Data).PlayerRotation = new Vector3DataVO(new Vector3(0f, 215f, 0f));
			if (checkpoint < 15)
			{
				return val;
			}
			SetCollectedBaconSoups(3);
			val.CH3Data.AliceTasksObjective.IsComplete = true;
			((ChapterDataVO)val.CH3Data).IsChapterComplete = true;
			if (checkpoint < 16)
			{
				return val;
			}
			val.CH4Data.AccountingObjective = SetObjectiveSaveData(isStarted: true, isComplete: true);
			val.CH4Data.BridgeMachineObjective = SetObjectiveSaveData(isStarted: true, isComplete: true);
			val.CH4Data.LostOnesObjective = SetObjectiveSaveData(isStarted: true, isComplete: true);
			val.CH4Data.VentObjective = SetObjectiveSaveData(isStarted: true, isComplete: true);
			val.CH4Data.MapRoomObjective = SetObjectiveSaveData(isStarted: true, isComplete: true);
			val.CH4Data.WarehouseObjective = SetObjectiveSaveData(isStarted: true, isComplete: false);
			((ChapterDataVO)val.CH4Data).IsChapterComplete = false;
			((ChapterDataVO)val.CH4Data).PlayerPosition = new Vector3DataVO(new Vector3(376f, 65.99462f, -222f));
			((ChapterDataVO)val.CH4Data).PlayerRotation = new Vector3DataVO(new Vector3(0f, 82f, 0f));
			((ChapterDataVO)val.CH4Data).HasSaveData = true;
			if (checkpoint < 17)
			{
				return val;
			}
			val.CH4Data.WarehouseObjective.IsComplete = true;
			val.CH4Data.FairGamesObjective = SetObjectiveSaveData(isStarted: true, isComplete: true);
			val.CH4Data.ResearchObjective = SetObjectiveSaveData(isStarted: true, isComplete: true);
			val.CH4Data.RideStorageObjective = SetObjectiveSaveData(isStarted: true, isComplete: true);
			val.CH4Data.MaintenanceObjective = SetObjectiveSaveData(isStarted: true, isComplete: true);
			val.CH4Data.HauntedHouseObjective = SetObjectiveSaveData(isStarted: true, isComplete: true);
			((ChapterDataVO)val.CH4Data).PlayerPosition = new Vector3DataVO(new Vector3(460f, 55.955f, -239f));
			((ChapterDataVO)val.CH4Data).PlayerRotation = new Vector3DataVO(new Vector3(0f, 130f, 0f));
			if (checkpoint < 20)
			{
				return val;
			}
			SetCollectedBaconSoups(4);
			((ChapterDataVO)val.CH4Data).IsChapterComplete = true;
			if (checkpoint < 21)
			{
				return val;
			}
			val.CH5Data.SafehouseObjective = SetObjectiveSaveData(isStarted: true, isComplete: true);
			val.CH5Data.CavesObjective = SetObjectiveSaveData(isStarted: true, isComplete: true);
			val.CH5Data.DockObjective = SetObjectiveSaveData(isStarted: true, isComplete: true);
			val.CH5Data.TunnelsObjective = SetObjectiveSaveData(isStarted: true, isComplete: true);
			val.CH5Data.LostHarbourObjective = SetObjectiveSaveData(isStarted: true, isComplete: true);
			((ChapterDataVO)val.CH5Data).IsChapterComplete = false;
			((ChapterDataVO)val.CH5Data).PlayerPosition = new Vector3DataVO(new Vector3(-193f, -98.045f, -196.31f));
			((ChapterDataVO)val.CH5Data).PlayerRotation = new Vector3DataVO(new Vector3(0f, 117.5244f, 0f));
			((ChapterDataVO)val.CH5Data).HasSaveData = true;
			if (checkpoint < 22)
			{
				return val;
			}
			val.CH5Data.AdministrationObjective.IsComplete = true;
			val.CH5Data.VaultObjective = SetObjectiveSaveData(isStarted: true, isComplete: true);
			val.CH5Data.GiantInkMachineObjective = SetObjectiveSaveData(isStarted: true, isComplete: true);
			((ChapterDataVO)val.CH5Data).PlayerPosition = new Vector3DataVO(new Vector3(340f, -96.045f, -299f));
			((ChapterDataVO)val.CH5Data).PlayerRotation = new Vector3DataVO(new Vector3(0f, 90f, 0f));
			return val;
		}

		public static ObjectiveSaveDataVO SetObjectiveSaveData(bool isStarted, bool isComplete)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Expected O, but got Unknown
			return new ObjectiveSaveDataVO
			{
				IsStarted = isStarted,
				IsComplete = isComplete
			};
		}

		public static void SetCollectedBaconSoups(int chapter)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Expected O, but got Unknown
			AchievementSaveData val = new AchievementSaveData();
			val.AudioLogs = new List<int>();
			val.BaconSoup = new List<int>();
			int num;
			int num2;
			switch (chapter)
			{
			case 0:
				num = 100;
				num2 = 120;
				break;
			case 1:
				num = 200;
				num2 = 230;
				break;
			case 2:
				num = 300;
				num2 = 338;
				break;
			case 3:
				num = 400;
				num2 = 418;
				break;
			case 4:
				num = 500;
				num2 = 506;
				break;
			default:
				num = 0;
				num2 = 0;
				break;
			}
			for (int i = num; i <= num2; i++)
			{
				if (Client.serverData.CheckedLocations.Contains(i))
				{
					val.BaconSoup.Add(i - num);
				}
			}
			switch (chapter)
			{
			case 0:
				GameManager.Instance.GameData.CH1AchievementData = val;
				break;
			case 1:
				GameManager.Instance.GameData.CH2AchievementData = val;
				break;
			case 2:
				GameManager.Instance.GameData.CH3AchievementData = val;
				break;
			case 3:
				GameManager.Instance.GameData.CH4AchievementData = val;
				break;
			case 4:
				GameManager.Instance.GameData.CH5AchievementData = val;
				break;
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(BaconSoupController), "LoadBaconSoupCollected")]
		public static void HandleBaconSoupSpawns(BaconSoupController __instance, ref List<CannedSoupEdible> ___m_BaconSoups, List<int> _BaconSoupIDsCollected)
		{
			for (int num = ___m_BaconSoups.Count - 1; num > -1; num--)
			{
				CannedSoupEdible val = ___m_BaconSoups[num];
				if (_BaconSoupIDsCollected.Contains(val.GetID()))
				{
					((TMGMonoBehaviour)val).Dispose();
					___m_BaconSoups.RemoveAt(num);
				}
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(GameDataManager), "Save", new Type[]
		{
			typeof(SaveFileData),
			typeof(bool),
			typeof(bool)
		})]
		public static void CheckSavePosition(GameDataManager __instance, ref SaveFileData saveFileData)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Expected I4, but got Unknown
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Expected O, but got Unknown
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Expected O, but got Unknown
			if (Object.op_Implicit((Object)(object)GameManager.Instance.Player))
			{
				Chapters chapter = GameManager.Instance.CurrentChapter.Chapter;
				Vector3DataVO val;
				Vector3DataVO val2;
				switch (chapter - 1)
				{
				case 0:
					val = ((ChapterDataVO)saveFileData.CH1Data).PlayerPosition;
					val2 = ((ChapterDataVO)saveFileData.CH1Data).PlayerRotation;
					break;
				case 1:
					val = ((ChapterDataVO)saveFileData.CH2Data).PlayerPosition;
					val2 = ((ChapterDataVO)saveFileData.CH2Data).PlayerRotation;
					break;
				case 2:
					val = ((ChapterDataVO)saveFileData.CH3Data).PlayerPosition;
					val2 = ((ChapterDataVO)saveFileData.CH3Data).PlayerRotation;
					break;
				case 3:
					val = ((ChapterDataVO)saveFileData.CH4Data).PlayerPosition;
					val2 = ((ChapterDataVO)saveFileData.CH4Data).PlayerRotation;
					break;
				case 4:
					val = ((ChapterDataVO)saveFileData.CH5Data).PlayerPosition;
					val2 = ((ChapterDataVO)saveFileData.CH5Data).PlayerRotation;
					break;
				default:
					val = new Vector3DataVO(Vector3.zero);
					val2 = new Vector3DataVO(Vector3.zero);
					break;
				}
				BendyAndTheArchipelagoMachine.Logger.LogDebug((object)$"Position: ({val.X}, {val.Y}, {val.Z}) | Rotation: ({val2.X}, {val2.Y}, {val2.Z})");
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(TitleScreenController), "CheckSelectedChapter")]
		public static bool HandleChapterSelect(TitleScreenController __instance, int ___m_SelectedChapter)
		{
			BendyAndTheArchipelagoMachine.Logger.LogDebug((object)$"Selected button: {CheckpointMenu.selectedCheckpoint}");
			int checkpoint = ___m_SelectedChapter * 5 + CheckpointMenu.selectedCheckpoint;
			switch (___m_SelectedChapter)
			{
			case 0:
				if (!HasCheckpoint(checkpoint))
				{
					ArchipelagoConsole.LogMessage("Locked");
					break;
				}
				PrepareChapterData(checkpoint);
				CheckpointMenu.hidden = true;
				LoadChapterFromTitle(titleScreenController, "CH1");
				break;
			case 1:
				if (!HasCheckpoint(checkpoint))
				{
					ArchipelagoConsole.LogMessage("Locked");
					break;
				}
				PrepareChapterData(checkpoint);
				CheckpointMenu.hidden = true;
				LoadChapterFromTitle(titleScreenController, "CH2");
				break;
			case 2:
				if (!HasCheckpoint(checkpoint))
				{
					ArchipelagoConsole.LogMessage("Locked");
					break;
				}
				PrepareChapterData(checkpoint);
				CheckpointMenu.hidden = true;
				LoadChapterFromTitle(titleScreenController, "CH3");
				break;
			case 3:
				if (!HasCheckpoint(checkpoint))
				{
					ArchipelagoConsole.LogMessage("Locked");
					break;
				}
				PrepareChapterData(checkpoint);
				CheckpointMenu.hidden = true;
				LoadChapterFromTitle(titleScreenController, "CH4");
				break;
			case 4:
				if (!HasCheckpoint(checkpoint))
				{
					ArchipelagoConsole.LogMessage("Locked");
					break;
				}
				PrepareChapterData(checkpoint);
				CheckpointMenu.hidden = true;
				LoadChapterFromTitle(titleScreenController, "CH5");
				break;
			case 5:
				if (!HasCheckpoint(checkpoint))
				{
					ArchipelagoConsole.LogMessage("Locked");
					break;
				}
				PrepareChapterData(checkpoint);
				CheckpointMenu.hidden = true;
				LoadChapterFromTitle(titleScreenController, "Archives");
				break;
			default:
				BendyAndTheArchipelagoMachine.Logger.LogError((object)$"Unrecognized chapter: {___m_SelectedChapter}");
				break;
			}
			return false;
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(TitleScreenController), "OnDisposed")]
		public static void ClearTitleScreenRef()
		{
			titleScreenController = null;
		}

		[HarmonyReversePatch(/*Could not decode attribute arguments.*/)]
		[HarmonyPatch(typeof(TitleScreenController), "LaunchChapter")]
		public static void LoadChapterFromTitle(TitleScreenController instance, string chapterName)
		{
			throw new NotImplementedException();
		}
	}
	[HarmonyPatch(typeof(Interactable))]
	internal class MyInteractible
	{
		[HarmonyPrefix]
		[HarmonyPatch("Interact")]
		public static bool InteractPatch(Interactable __instance)
		{
			if (RitualItems.CH1RitualItemInteractablesToType.ContainsKey(__instance))
			{
				return RitualItems.HandleRitualItemPickup(__instance);
			}
			if ((Object)(object)LostKeys.keysReference != (Object)null && (Object)(object)LostKeys.keysReference == (Object)(object)__instance)
			{
				return LostKeys.HandleKeysPickup();
			}
			if ((Object)(object)ValvePickup.valveReference != (Object)null && (Object)(object)ValvePickup.valveReference == (Object)(object)__instance)
			{
				return ValvePickup.HandleValvePickup();
			}
			if (ToyBlockages.ToysRef.Contains(__instance))
			{
				return ToyBlockages.HandleToyPickup();
			}
			if ((Object)(object)BertrumFight.BertrumFightAudioLog != (Object)null && (Object)(object)BertrumFight.BertrumFightAudioLog == (Object)(object)__instance)
			{
				return BertrumFight.HandleAudioLogInteract();
			}
			if (BookPuzzleDoor.Books.Contains(__instance))
			{
				return BookPuzzleDoor.HandleBookOnInteract();
			}
			if ((Object)(object)BendyBoss.BendyAudioLog != (Object)null && (Object)(object)BendyBoss.BendyAudioLog == (Object)(object)__instance)
			{
				return BendyBoss.CheckBaconSoupRequirement();
			}
			if ((Object)(object)BorisBone.boneReference != (Object)null && (Object)(object)BorisBone.boneReference == (Object)(object)__instance)
			{
				return BorisBone.HandleBonePickup();
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(BaconSoupController))]
	internal class BaconSoup
	{
		[HarmonyPostfix]
		[HarmonyPatch("HandleCannedSoupOnInteracted")]
		private static void PickupBaconSoup(object sender, EventArgs e)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			int iD = ((CannedSoupEdible)sender).GetID();
			int chapterNumber = MyChapterController.GetChapterNumber();
			BendyAndTheArchipelagoMachine.Logger.LogMessage((object)$"Interacted with CH{chapterNumber} Bacon Soup {iD}");
			Client.SendLocation($"CH{chapterNumber} Bacon Soup {iD}");
		}

		[HarmonyPostfix]
		[HarmonyPatch("Init")]
		private static void OnInit(BaconSoupController __instance, List<CannedSoupEdible> ___m_BaconSoups)
		{
			BendyAndTheArchipelagoMachine.Logger.LogMessage((object)("Total BaconSoups: " + ___m_BaconSoups.Count));
		}
	}
	[HarmonyPatch(typeof(ChapterController))]
	internal class MyChapterController
	{
		public static ChapterController currentChapter;

		public static Chapters currentChapterNumber;

		[HarmonyReversePatch(/*Could not decode attribute arguments.*/)]
		[HarmonyPatch("LoadChapter")]
		public static void MyLoadChapter(ChapterController instance, string chapter)
		{
			throw new NotImplementedException();
		}

		[HarmonyPrefix]
		[HarmonyPatch("CompleteChapter")]
		public static bool OnChapterComplete(ChapterController __instance, Chapters ___m_Chapter)
		{
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Expected I4, but got Unknown
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			long goal = (long)Client.serverData.GetSlotDataOption("goal_chapter");
			if ((long)Client.serverData.GetSlotDataOption("require_previous_chapters") == 1)
			{
				goal = CheckCompletedChapters(ref goal);
				if (goal == -1)
				{
					BendyAndTheArchipelagoMachine.Logger.LogMessage((object)"Goal Not Yet Acheived, Not All Previous Chapters Completed.");
				}
			}
			switch (___m_Chapter - 1)
			{
			case 0:
				Client.SendLocation("CH1 Complete");
				SceneManager.LoadScene("Reset");
				if (goal == 0L)
				{
					Client.CompleteGoal();
				}
				return false;
			case 1:
				Client.SendLocation("CH2 Complete");
				SceneManager.LoadScene("Reset");
				if (goal == 1)
				{
					Client.CompleteGoal();
				}
				return false;
			case 2:
				Client.SendLocation("CH3 Complete");
				SceneManager.LoadScene("Reset");
				if (goal == 2)
				{
					Client.CompleteGoal();
				}
				return false;
			case 3:
				Client.SendLocation("CH4 Complete");
				SceneManager.LoadScene("Reset");
				if (goal == 3)
				{
					Client.CompleteGoal();
				}
				return false;
			case 4:
				Client.SendLocation("CH5 Complete");
				if (goal == 4)
				{
					Client.CompleteGoal();
					return true;
				}
				SceneManager.LoadScene("Reset");
				return false;
			default:
				BendyAndTheArchipelagoMachine.Logger.LogError((object)$"Unknown Chapter: {___m_Chapter}");
				SceneManager.LoadScene("Reset");
				return false;
			}
		}

		public static long CheckCompletedChapters(ref long goal)
		{
			if (goal >= 1)
			{
				goal = (Client.serverData.CheckedLocations.Contains(IDTables.GetLocationID("CH1 Complete")) ? goal : (-1));
			}
			if (goal >= 2)
			{
				goal = (Client.serverData.CheckedLocations.Contains(IDTables.GetLocationID("CH2 Complete")) ? goal : (-1));
			}
			if (goal >= 3)
			{
				goal = (Client.serverData.CheckedLocations.Contains(IDTables.GetLocationID("CH3 Complete")) ? goal : (-1));
			}
			if (goal >= 4)
			{
				goal = (Client.serverData.CheckedLocations.Contains(IDTables.GetLocationID("CH4 Complete")) ? goal : (-1));
			}
			return goal;
		}

		[HarmonyPostfix]
		[HarmonyPatch("Init")]
		public static void ChapterControllerInit(ChapterController __instance, Chapters ___m_Chapter)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			currentChapter = __instance;
			currentChapterNumber = ___m_Chapter;
		}

		[HarmonyPostfix]
		[HarmonyPatch("OnDisposed")]
		public static void ClearChapterControllerRef()
		{
			currentChapter = null;
		}

		public static int GetChapterNumber()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected I4, but got Unknown
			Chapters val = currentChapterNumber;
			return (val - 1) switch
			{
				0 => 1, 
				1 => 2, 
				2 => 3, 
				3 => 4, 
				4 => 5, 
				_ => -1, 
			};
		}
	}
	[HarmonyPatch(typeof(AchievementManager))]
	internal class PerfectScores
	{
		[HarmonyPostfix]
		[HarmonyPatch("SetAchievement")]
		public static void BullsEyeAcheivement(AchievementName key, AchievementManager __instance)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Expected I4, but got Unknown
			if ((long)Client.serverData.GetSlotDataOption("minigame_sanity") != 0L)
			{
				switch (key - 38)
				{
				case 1:
					Client.SendLocation("CH4 Bulls Eye");
					break;
				case 2:
					Client.SendLocation("CH4 Call the Milk Man");
					break;
				case 0:
					Client.SendLocation("CH4 Wasting Time");
					break;
				}
			}
		}
	}
	[HarmonyPatch(typeof(RadioEasterEggController))]
	internal class Radios
	{
		[HarmonyPostfix]
		[HarmonyPatch("HandleRadioOnInteracted")]
		public static void OnRadioInteract(RadioEasterEggController __instance, AchievementName ___m_AchievementAssetKey)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Invalid comparison between Unknown and I4
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Invalid comparison between Unknown and I4
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Invalid comparison between Unknown and I4
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Invalid comparison between Unknown and I4
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Invalid comparison between Unknown and I4
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Invalid comparison between Unknown and I4
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			if ((int)___m_AchievementAssetKey <= 6)
			{
				if ((int)___m_AchievementAssetKey == 2)
				{
					Client.SendLocation("CH1 Radio");
					return;
				}
				if ((int)___m_AchievementAssetKey == 6)
				{
					Client.SendLocation("CH2 Radio");
					return;
				}
			}
			else
			{
				if ((int)___m_AchievementAssetKey == 25)
				{
					Client.SendLocation("CH3 Radio");
					return;
				}
				if ((int)___m_AchievementAssetKey == 33)
				{
					Client.SendLocation("CH4 Radio");
					return;
				}
				if ((int)___m_AchievementAssetKey == 47)
				{
					Client.SendLocation("CH5 Radio");
					return;
				}
			}
			BendyAndTheArchipelagoMachine.Logger.LogError((object)$"Unrecognized Radio. AchievementName: {___m_AchievementAssetKey}");
		}
	}
	[HarmonyPatch(typeof(CH1Pedestal))]
	internal class RitualItems
	{
		public static Dictionary<CollectableType, CH1Pedestal> CH1RitualItemsTypeToPedestal = new Dictionary<CollectableType, CH1Pedestal>();

		public static Dictionary<Interactable, CollectableType> CH1RitualItemInteractablesToType = new Dictionary<Interactable, CollectableType>();

		[HarmonyPostfix]
		[HarmonyPatch("Initialize")]
		public static void OnInit(Transform collectableLocation, CH1Pedestal __instance, CollectableType ___m_CollectableType, Interactable ___m_Collectable)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			CH1RitualItemsTypeToPedestal.Add(___m_CollectableType, __instance);
			CH1RitualItemInteractablesToType.Add(___m_Collectable, ___m_CollectableType);
		}

		[HarmonyPostfix]
		[HarmonyPatch("OnDisposed")]
		public static void ClearReferences(CH1Pedestal __instance, CollectableType ___m_CollectableType, Interactable ___m_Collectable)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			CH1RitualItemsTypeToPedestal.Remove(___m_CollectableType);
			CH1RitualItemInteractablesToType.Remove(___m_Collectable);
		}

		public static bool HandleRitualItemPickup(Interactable item)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Expected I4, but got Unknown
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			CollectableType val = CH1RitualItemInteractablesToType[item];
			switch ((int)val)
			{
			case 2:
				Client.SendLocation("CH1 Ritual Item - Book");
				return Client.HasItem("The Illusion of Living");
			case 3:
				Client.SendLocation("CH1 Ritual Item - Doll");
				return Client.HasItem("Bendy Squeaky Toy");
			case 0:
				Client.SendLocation("CH1 Ritual Item - Gear");
				return Client.HasItem("Spare Gear");
			case 5:
				Client.SendLocation("CH1 Ritual Item - Inkwell");
				return Client.HasItem("Animators' Inkwell");
			case 4:
				Client.SendLocation("CH1 Ritual Item - Record");
				return Client.HasItem("Vinyl Record");
			case 1:
				Client.SendLocation("CH1 Ritual Item - Wrench");
				return Client.HasItem("'Pocket' Wrench");
			default:
				BendyAndTheArchipelagoMachine.Logger.LogError((object)$"Unknown Item Type {CH1RitualItemInteractablesToType[item]}");
				return false;
			}
		}
	}
	[HarmonyPatch(typeof(SammyLawrence_Ai))]
	internal class SammyLawrenceBoss
	{
		[HarmonyPostfix]
		[HarmonyPatch("TriggerDeath")]
		public static void OnSammyDeath()
		{
			Client.SendLocation("CH5 Boss - Sammy Lawrence");
		}
	}
	[HarmonyPatch(typeof(MeatlyController))]
	internal class theMeatly
	{
		[HarmonyPostfix]
		[HarmonyPatch("HandleMeatlyAchievementTrigger")]
		public static void HandleMeatlySighting(MeatlyController __instance, Chapters ___m_Chapter)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected I4, but got Unknown
			if ((long)Client.serverData.GetSlotDataOption("the_meatly_sanity") != 0L)
			{
				switch (___m_Chapter - 1)
				{
				case 0:
					Client.SendLocation("CH1 theMeatly");
					break;
				case 1:
					Client.SendLocation("CH2 theMeatly");
					break;
				case 2:
					Client.SendLocation("CH3 theMeatly");
					break;
				case 3:
					Client.SendLocation("CH4 theMeatly");
					break;
				case 4:
					Client.SendLocation("CH5 theMeatly");
					break;
				}
			}
		}
	}
	[HarmonyPatch]
	internal class TommyGun
	{
		private static bool LocationEligable;

		[HarmonyPostfix]
		[HarmonyPatch(typeof(CH3ProjectionistTaskController), "CheckTommyGun")]
		public static void GuaranteeTommyGun(ref bool __result)
		{
			if ((long)Client.serverData.GetSlotDataOption("include_tommy_gun") != 0L)
			{
				BendyAndTheArchipelagoMachine.Logger.LogDebug((object)$"TommyGunCheck: {__result}");
				LocationEligable = __result;
				if (!__result && Client.HasItem("Tommy Gun"))
				{
					GameManager.Instance.GameData.CurrentSaveFile.CH3Data.HasTommyGun = true;
					__result = true;
				}
				else
				{
					__result = false;
				}
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(CH3ProjectionistTaskController), "HandleGunOnInteracted")]
		public static void HandleTommyGunInteract()
		{
			if (LocationEligable && (long)Client.serverData.GetSlotDataOption("include_tommy_gun") != 0L)
			{
				Client.SendLocation("CH3 Tommy Gun Challenge");
			}
		}
	}
	[HarmonyPatch(typeof(CH3ToyMachine))]
	internal class ToyBlockages
	{
		public static List<Interactable> ToysRef = new List<Interactable>();

		[HarmonyPostfix]
		[HarmonyPatch("InitOnComplete")]
		public static void RegisterToys(CH3ToyMachine __instance, List<Spinners> ___m_SpinnersLeft, List<Spinners> ___m_SpinnersRight)
		{
			foreach (Spinners item in ___m_SpinnersLeft)
			{
				foreach (Interactable toy in item.Toys)
				{
					ToysRef.Add(toy);
				}
			}
			foreach (Spinners item2 in ___m_SpinnersRight)
			{
				foreach (Interactable toy2 in item2.Toys)
				{
					ToysRef.Add(toy2);
				}
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch("OnDisposed")]
		public static void ClearToysRef()
		{
			ToysRef.Clear();
		}

		public static bool HandleToyPickup()
		{
			return Client.HasItem("Toy Machine");
		}

		[HarmonyPostfix]
		[HarmonyPatch("HandleToyOnInteracted")]
		public static void HandleToysPickup(CH3ToyMachine __instance, bool ___m_IsLeftSolved, bool ___m_IsRightSolved)
		{
			BendyAndTheArchipelagoMachine.Logger.LogDebug((object)"Toys Picked Up!");
			if (___m_IsLeftSolved && ___m_IsRightSolved)
			{
				Client.SendLocation("CH3 Toy Blockage");
			}
		}
	}
	[HarmonyPatch(typeof(CH2SewerController))]
	internal class ValvePickup
	{
		public static Interactable valveReference;

		[HarmonyPostfix]
		[HarmonyPatch("InitOnComplete")]
		public static void RegisterValve(CH2SewerController __instance, Interactable ___m_ValvePickup)
		{
			valveReference = ___m_ValvePickup;
		}

		[HarmonyPostfix]
		[HarmonyPatch("OnDisposed")]
		public static void ClearValveRef()
		{
			valveReference = null;
		}

		public static bool HandleValvePickup()
		{
			Client.SendLocation("CH2 Sewer Valve");
			return Client.HasItem("Sewer Valve");
		}
	}
}
namespace BendyAndTheArchipelagoMachine.Archipelago
{
	public class ArchipelagoData
	{
		public string Uri;

		public string SlotName;

		public string Password;

		public int Index;

		private int SaveSlot = -1;

		public string seed;

		public Dictionary<string, object> slotData;

		private Config cfg;

		public List<long> CheckedLocations { get; private set; }

		public List<long> ReceivedItems { get; private set; }

		public bool NeedSlotData => slotData == null;

		public ArchipelagoData()
		{
			string path = Path.Combine(Paths.PluginPath, "Lorecrafter703-Bendy_and_the_Archipelago_Machine", "BendyAndTheArchipelagoMachine", "config.json");
			if (!File.Exists(path))
			{
				cfg = new Config("archipelago.gg:38281", "Bendy", deathlink: false);
				string contents = JsonConvert.SerializeObject((object)cfg, (Formatting)1);
				File.WriteAllText(path, contents);
			}
			else
			{
				string text = File.ReadAllText(path);
				cfg = JsonConvert.DeserializeObject<Config>(text);
			}
			Uri = cfg.LastUri;
			SlotName = cfg.LastSlotName;
			CheckedLocations = new List<long>();
			ReceivedItems = new List<long>();
		}

		public ArchipelagoData(string uri, string slotName, string password)
		{
			Uri = uri;
			SlotName = slotName;
			Password = password;
			CheckedLocations = new List<long>();
			ReceivedItems = new List<long>();
		}

		public override string ToString()
		{
			return JsonConvert.SerializeObject((object)this, (Formatting)1);
		}

		private void SaveData()
		{
			BendyAndTheArchipelagoMachine.Logger.LogDebug((object)("Seed: " + seed));
			string path = Path.Combine(Paths.PluginPath, "Lorecrafter703-Bendy_and_the_Archipelago_Machine", "BendyAndTheArchipelagoMachine", "savedata", seed + ".json");
			string contents = ToString();
			File.WriteAllText(path, contents);
		}

		public void SetupSession(Dictionary<string, object> roomSlotData, string roomSeed)
		{
			slotData = roomSlotData;
			seed = roomSeed;
			SaveData();
		}

		public object GetSlotDataOption(string key)
		{
			try
			{
				return slotData[key];
			}
			catch (Exception ex)
			{
				BendyAndTheArchipelagoMachine.Logger.LogError((object)ex);
				return null;
			}
		}

		public bool VerifySlot(int slot)
		{
			if (SaveSlot == -1)
			{
				SaveSlot = slot;
			}
			if (SaveSlot != slot)
			{
				return false;
			}
			return true;
		}

		public int GetSlot()
		{
			return SaveSlot;
		}

		public void AddItem(long itemID)
		{
			ReceivedItems.Add(itemID);
			Index++;
			SaveData();
		}

		public void CheckLocation(long itemID)
		{
			if (!CheckedLocations.Contains(itemID))
			{
				CheckedLocations.Add(itemID);
			}
			SaveData();
		}

		public void UpdateConnectionInfo(string uri, string slot)
		{
			cfg.UpdateConnectionInfo(uri, slot);
		}

		public void SetConfigDeathlink(bool deathLinkEnabled)
		{
			cfg?.UpdateDeathlink(deathLinkEnabled);
		}

		public bool GetConfigDeathLink()
		{
			return cfg.DeathlinkEnabled;
		}
	}
	public class DeathLinkHandler
	{
		private static bool deathLinkEnabled;

		private string slotName;

		private readonly DeathLinkService service;

		private readonly Queue<DeathLink> deathLinks = new Queue<DeathLink>();

		public bool isDead;

		public DeathLinkHandler(DeathLinkService deathLinkService, string name, bool enableDeathLink = false)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Expected O, but got Unknown
			service = deathLinkService;
			service.OnDeathLinkReceived += new DeathLinkReceivedHandler(DeathLinkReceived);
			slotName = name;
			deathLinkEnabled = enableDeathLink;
			if (deathLinkEnabled)
			{
				service.EnableDeathLink();
			}
		}

		public void ToggleDeathLink()
		{
			deathLinkEnabled = !deathLinkEnabled;
			if (deathLinkEnabled)
			{
				service.EnableDeathLink();
			}
			else
			{
				service.DisableDeathLink();
			}
			Client.serverData.SetConfigDeathlink(deathLinkEnabled);
		}

		private void DeathLinkReceived(DeathLink deathLink)
		{
			deathLinks.Enqueue(deathLink);
			BendyAndTheArchipelagoMachine.Logger.LogDebug((object)(Utility.IsNullOrWhiteSpace(deathLink.Cause) ? ("Received Death Link from " + deathLink.Source) : deathLink.Cause));
		}

		public void KillPlayer()
		{
			try
			{
				if (deathLinks.Count >= 1)
				{
					BendyAndTheArchipelagoMachine.Logger.LogDebug((object)"Killing Player");
					DeathLink val = deathLinks.Dequeue();
					if (deathLinkEnabled)
					{
						string text = (Utility.IsNullOrWhiteSpace(val.Cause) ? GetDeathLinkCause(val) : val.Cause);
						DeathLinkController.KillPlayer(DeathLinkController.playerController);
						BendyAndTheArchipelagoMachine.Logger.LogMessage((object)text);
					}
				}
			}
			catch (Exception ex)
			{
				BendyAndTheArchipelagoMachine.Logger.LogError((object)ex);
			}
		}

		public void ProcessDeaths()
		{
			DeathLinkController.Revive();
			if (!DeathLinkController.isDead)
			{
				KillPlayer();
			}
		}

		private string GetDeathLinkCause(DeathLink deathLink)
		{
			return "Received death from " + deathLink.Source;
		}

		public void SendDeathLink()
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Expected O, but got Unknown
			try
			{
				if (deathLinkEnabled)
				{
					BendyAndTheArchipelagoMachine.Logger.LogMessage((object)"sharing your death...");
					DeathLink val = new DeathLink(slotName, slotName + " succumbed to the ink.");
					service.SendDeathLink(val);
				}
			}
			catch (Exception ex)
			{
				BendyAndTheArchipelagoMachine.Logger.LogError((object)ex);
			}
		}

		public bool GetDeathLinkStatus()
		{
			return deathLinkEnabled;
		}
	}
	[StructLayout(LayoutKind.Sequential, Size = 1)]
	internal struct IDTables
	{
		private static readonly Dictionary<string, long> itemNametoID = new Dictionary<string, long>
		{
			{ "Bacon Soup", 1L },
			{ "Trap", 2L },
			{ "Empty Soup Can", 3L },
			{ "Empty Ink Well", 4L },
			{ "Broken Banjo String", 5L },
			{ "CH1 - Moving Pictures", 100L },
			{ "The Illusion of Living", 101L },
			{ "Bendy Squeaky Toy", 102L },
			{ "Spare Gear", 103L },
			{ "Animators' Inkwell", 104L },
			{ "Vinyl Record", 105L },
			{ "'Pocket' Wrench", 106L },
			{ "CH1 Checkpoint - Bendy Chase", 107L },
			{ "CH2 - The Old Song", 200L },
			{ "Wally's Keys", 201L },
			{ "Sewer Valve", 202L },
			{ "CH2 Checkpoint - Lost Keys", 203L },
			{ "CH2 Checkpoint - Sammy's Office", 204L },
			{ "CH3 - Rise and Fall", 300L },
			{ "Toy Machine", 301L },
			{ "CH3 Checkpoint - Toy Machine", 302L },
			{ "CH3 Checkpoint - Angel's Bidding", 303L },
			{ "CH3 Checkpoint - Butcher Gang", 304L },
			{ "Tommy Gun", 305L },
			{ "Poor Dog's Bone", 306L },
			{ "CH4 - Colossal Wonders", 400L },
			{ "Book Puzzle", 401L },
			{ "Bertrum Bossfight", 402L },
			{ "CH4 Checkpoint - Warehouse", 403L },
			{ "CH4 Checkpoint - Brute Boris", 404L },
			{ "CH5 - The Last Reel", 500L },
			{ "CH5 Checkpoint - Administration", 501L },
			{ "CH5 Checkpoint - The Ink Machine", 502L }
		};

		private static readonly Dictionary<string, long> locationNametoID = new Dictionary<string, long>
		{
			{ "CH1 Bacon Soup 0", 100L },
			{ "CH1 Bacon Soup 1", 101L },
			{ "CH1 Bacon Soup 2", 102L },
			{ "CH1 Bacon Soup 3", 103L },
			{ "CH1 Bacon Soup 4", 104L },
			{ "CH1 Bacon Soup 5", 105L },
			{ "CH1 Bacon Soup 6", 106L },
			{ "CH1 Bacon Soup 7", 107L },
			{ "CH1 Bacon Soup 8", 108L },
			{ "CH1 Bacon Soup 9", 109L },
			{ "CH1 Bacon Soup 10", 110L },
			{ "CH1 Bacon Soup 11", 111L },
			{ "CH1 Bacon Soup 12", 112L },
			{ "CH1 Bacon Soup 13", 113L },
			{ "CH1 Bacon Soup 14", 114L },
			{ "CH1 Bacon Soup 15", 115L },
			{ "CH1 Bacon Soup 16", 116L },
			{ "CH1 Bacon Soup 17", 117L },
			{ "CH1 Bacon Soup 18", 118L },
			{ "CH1 Bacon Soup 19", 119L },
			{ "CH1 Bacon Soup 20", 120L },
			{ "CH1 Ritual Item - Book", 121L },
			{ "CH1 Ritual Item - Doll", 122L },
			{ "CH1 Ritual Item - Gear", 123L },
			{ "CH1 Ritual Item - Inkwell", 124L },
			{ "CH1 Ritual Item - Record", 125L },
			{ "CH1 Ritual Item - Wrench", 126L },
			{ "CH1 Audio Log - Thomas Connor (Flooded Basement)", 127L },
			{ "CH1 Audio Log - Wally Franks (Hallway Table)", 128L },
			{ "CH1 Radio", 129L },
			{ "CH1 theMeatly", 130L },
			{ "CH1 Checkpoint - Bendy Chase", 131L },
			{ "CH1 Complete", 199L },
			{ "CH2 Bacon Soup 0", 200L },
			{ "CH2 Bacon Soup 1", 201L },
			{ "CH2 Bacon Soup 2", 202L },
			{ "CH2 Bacon Soup 3", 203L },
			{ "CH2 Bacon Soup 4", 204L },
			{ "CH2 Bacon Soup 5", 205L },
			{ "CH2 Bacon Soup 6", 206L },
			{ "CH2 Bacon Soup 7", 207L },
			{ "CH2 Bacon Soup 8", 208L },
			{ "CH2 Bacon Soup 9", 209L },
			{ "CH2 Bacon Soup 10", 210L },
			{ "CH2 Bacon Soup 11", 211L },
			{ "CH2 Bacon Soup 12", 212L },
			{ "CH2 Bacon Soup 13", 213L },
			{ "CH2 Bacon Soup 14", 214L },
			{ "CH2 Bacon Soup 15", 215L },
			{ "CH2 Bacon Soup 16", 216L },
			{ "CH2 Bacon Soup 17", 217L },
			{ "CH2 Bacon Soup 18", 218L },
			{ "CH2 Bacon Soup 19", 219L },
			{ "CH2 Bacon Soup 20", 220L },
			{ "CH2 Bacon Soup 21", 221L },
			{ "CH2 Bacon Soup 22", 222L },
			{ "CH2 Bacon Soup 23", 223L },
			{ "CH2 Bacon Soup 24", 224L },
			{ "CH2 Bacon Soup 25", 225L },
			{ "CH2 Bacon Soup 26", 226L },
			{ "CH2 Bacon Soup 27", 227L },
			{ "CH2 Bacon Soup 28", 228L },
			{ "CH2 Bacon Soup 29", 229L },
			{ "CH2 Bacon Soup 30", 230L },
			{ "CH2 Lost Keys", 231L },
			{ "CH2 Sewer Valve", 232L },
			{ "CH2 Audio Log - Sammy Lawrence (Can I Get An Amen?)", 233L },
			{ "CH2 Audio Log - Sammy Lawrence (Music Department Lobby)", 234L },
			{ "CH2 Audio Log - Susie Campbell (Recording Studio)", 235L },
			{ "CH2 Audio Log - Norman Polk (Projector)", 236L },
			{ "CH2 Audio Log - Wally Franks (Sammy’s Office)", 237L },
			{ "CH2 Audio Log - Sammy Lawrence (Wally’s Closet)", 238L },
			{ "CH2 Audio Log - Jack Fain (Desk in Sewers)", 239L },
			{ "CH2 Radio", 240L },
			{ "CH2 theMeatly", 241L },
			{ "CH2 Checkpoint - Lost Keys", 242L },
			{ "CH2 Checkpoint - Sammy's Office", 243L },
			{ "CH2 Complete", 299L },
			{ "CH3 Bacon Soup 0", 300L },
			{ "CH3 Bacon Soup 1", 301L },
			{ "CH3 Bacon Soup 2", 302L },
			{ "CH3 Bacon Soup 3", 303L },
			{ "CH3 Bacon Soup 4", 304L },
			{ "CH3 Bacon Soup 5", 305L },
			{ "CH3 Bacon Soup 6", 306L },
			{ "CH3 Bacon Soup 7", 307L },
			{ "CH3 Bacon Soup 8", 308L },
			{ "CH3 Bacon Soup 9", 309L },
			{ "CH3 Bacon Soup 10", 310L },
			{ "CH3 Bacon Soup 11", 311L },
			{ "CH3 Bacon Soup 12", 312L },
			{ "CH3 Bacon Soup 13", 313L },
			{ "CH3 Bacon Soup 14", 314L },
			{ "CH3 Bacon Soup 15", 315L },
			{ "CH3 Bacon Soup 16", 316L },
			{ "CH3 Bacon Soup 17", 317L },
			{ "CH3 Bacon Soup 18", 318L },
			{ "CH3 Bacon Soup 19", 319L },
			{ "CH3 Bacon Soup 20", 320L },
			{ "CH3 Bacon Soup 21", 321L },
			{ "CH3 Bacon Soup 22", 322L },
			{ "CH3 Bacon Soup 23", 323L },
			{ "CH3 Bacon Soup 24", 324L },
			{ "CH3 Bacon Soup 25", 325L },
			{ "CH3 Bacon Soup 26", 326L },
			{ "CH3 Bacon Soup 27", 327L },
			{ "CH3 Bacon Soup 28", 328L },
			{ "CH3 Bacon Soup 29", 329L },
			{ "CH3 Bacon Soup 30", 330L },
			{ "CH3 Bacon Soup 31", 331L },
			{ "CH3 Bacon Soup 32", 332L },
			{ "CH3 Bacon Soup 33", 333L },
			{ "CH3 Bacon Soup 34", 334L },
			{ "CH3 Bacon Soup 35", 335L },
			{ "CH3 Bacon Soup 36", 336L },
			{ "CH3 Bacon Soup 37", 337L },
			{ "CH3 Bacon Soup 38", 338L },
			{ "CH3 Audio Log - Shawn Flynn (Toy Machine Room)", 339L },
			{ "CH3 Audio Log - Joey Drew (Path of the Demon)", 340L },
			{ "CH3 Audio Log - Susie Campbell (Path of the Angel)", 341L },
			{ "CH3 Audio Log - Wally Franks and Thomas Connor (Level K Power Hallway)", 342L },
			{ "CH3 Audio Log - Thomas Connor (Level 9)", 343L },
			{ "CH3 Audio Log - Susie Campbell (Flooded Morgue)", 344L },
			{ "CH3 Audio Log - Wally Franks (Level 11)", 345L },
			{ "CH3 Audio Log - Grant Cohen (Accounting Office on Level 9)", 346L },
			{ "CH3 Audio Log - Norman Polk (Projectionist’s Maze)", 347L },
			{ "CH3 Audio Log - Henry (Sunken Room)", 348L },
			{ "CH3 Radio", 349L },
			{ "CH3 theMeatly", 350L },
			{ "CH3 Checkpoint - Toy Machine", 351L },
			{ "CH3 Checkpoint - Angel's Bidding", 352L },
			{ "CH3 Checkpoint - Butcher Gang", 353L },
			{ "CH3 Tommy Gun Challenge", 354L },
			{ "CH3 Lever Challenge 1", 355L },
			{ "CH3 Lever Challenge 2", 356L },
			{ "CH3 Lever Challenge 3", 357L },
			{ "CH3 Boris' Bone", 358L },
			{ "CH3 Toy Blockage", 359L },
			{ "CH3 Complete", 399L },
			{ "CH4 Bacon Soup 0", 400L },
			{ "CH4 Bacon Soup 1", 401L },
			{ "CH4 Bacon Soup 2", 402L },
			{ "CH4 Bacon Soup 3", 403L },
			{ "CH4 Bacon Soup 4", 404L },
			{ "CH4 Bacon Soup 5", 405L },
			{ "CH4 Bacon Soup 6", 406L },
			{ "CH4 Bacon Soup 7", 407L },
			{ "CH4 Bacon Soup 8", 408L },
			{ "CH4 Bacon Soup 9", 409L },
			{ "CH4 Bacon Soup 10", 410L },
			{ "CH4 Bacon Soup 11", 411L },
			{ "CH4 Bacon Soup 12", 412L },
			{ "CH4 Bacon Soup 13", 413L },
			{ "CH4 Bacon Soup 14", 414L },
			{ "CH4 Bacon Soup 15", 415L },
			{ "CH4 Bacon Soup 16", 416L },
			{ "CH4 Bacon Soup 17", 417L },
			{ "CH4 Bacon Soup 18", 418L },
			{ "CH4 Bulls Eye", 419L },
			{ "CH4 Call the Milk Man", 420L },
			{ "CH4 Wasting Time", 421L },
			{ "CH4 Boss - Bertrum", 422L },
			{ "CH4 Boss - Brute Boris", 423L },
			{ "CH4 Audio Log - ??? (Management Office)", 424L },
			{ "CH4 Audio Log - Susie Campbell (Library)", 425L },
			{ "CH4 Audio Log - Bertrum Piedmont (Planning Room)", 426L },
			{ "CH4 Audio Log - Wally Franks (Minigame Station)", 427L },
			{ "CH4 Audio Log - Lacie Benton (Research & Design)", 428L },
			{ "CH4 Audio Log - Bertrum Piedmont (Attraction Storage)", 429L },
			{ "CH4 Audio Log - Joey Drew (Maintenance Room)", 430L },
			{ "CH4 Radio", 431L },
			{ "CH4 theMeatly", 432L },
			{ "CH4 Checkpoint - Warehouse", 433L },
			{ "CH4 Checkpoint - Brute Boris", 434L },
			{ "CH4 Complete", 499L },
			{ "CH5 Bacon Soup 0", 500L },
			{ "CH5 Bacon Soup 1", 501L },
			{ "CH5 Bacon Soup 2", 502L },
			{ "CH5 Bacon Soup 3", 503L },
			{ "CH5 Bacon Soup 4", 504L },
			{ "CH5 Bacon Soup 5", 505L },
			{ "CH5 Bacon Soup 6", 506L },
			{ "CH5 Boss - Sammy Lawrence", 507L },
			{ "CH5 Audio Log - Thomas Connor (Film Vault)", 508L },
			{ "CH5 Audio Log - Wally Franks (Administration Maze)", 509L },
			{ "CH5 Audio Log - Joey Drew (Administration Maze Entrance)", 510L },
			{ "CH5 Audio Log - Joey Drew (Administration Maze Side Room)", 511L },
			{ "CH5 Audio Log - Joey Drew (Joey’s Office)", 512L },
			{ "CH5 Audio Log - Joey Drew (Bendy’s Throne)", 513L },
			{ "CH5 Radio", 514L },
			{ "CH5 theMeatly", 515L },
			{ "CH5 Checkpoint - Administration", 516L },
			{ "CH5 Checkpoint - The Ink Machine", 517L },
			{ "CH5 Complete", 599L }
		};

		public static long GetItemID(string name)
		{
			try
			{
				return itemNametoID[name];
			}
			catch (Exception ex)
			{
				BendyAndTheArchipelagoMachine.Logger.LogError((object)("No item with the name " + name + " was found.\n    " + ex.Message));
				return -1L;
			}
		}

		public static long GetLocationID(string name)
		{
			try
			{
				return locationNametoID[name];
			}
			catch (Exception ex)
			{
				BendyAndTheArchipelagoMachine.Logger.LogError((object)("No location found with name " + name + ".\n    " + ex.Message));
				return -1L;
			}
		}
	}
	public class Client
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static MessageReceivedHandler <>9__14_0;

			public static Func<string, string, string> <>9__16_0;

			internal void <SetupSession>b__14_0(LogMessage message)
			{
				ArchipelagoConsole.LogMessage(((object)message).ToString());
			}

			internal string <HandleConnectResult>b__16_0(string current, string error)
			{
				return current + "\n    " + error;
			}
		}

		public const string SERVER = "localhost";

		public const int PORT = 38281;

		public const string SLOT_NAME = "Bendy";

		public const string AP_VERSION = "0.6.7";

		public const string GAME_NAME = "Bendy and the Ink Machine";

		public static bool authenticated;

		private bool attemptingConnection;

		public static ArchipelagoData serverData = new ArchipelagoData();

		public DeathLinkHandler deathLinkHandler;

		private static ArchipelagoSession session = ArchipelagoSessionFactory.CreateSession("localhost", 38281);

		private Queue<ItemInfo> ItemQueue = new Queue<ItemInfo>();

		private ReceivedItemsHelper Helper;

		public static bool NeedBaconSoup;

		public void Connect()
		{
			if (!authenticated && !attemptingConnection)
			{
				try
				{
					session = ArchipelagoSessionFactory.CreateSession(serverData.Uri, 38281);
					SetupSession();
					attemptingConnection = true;
				}
				catch (Exception ex)
				{
					BendyAndTheArchipelagoMachine.Logger.LogError((object)ex);
				}
				TryConnect();
			}
		}

		private void SetupSession()
		{
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Expected O, but got Unknown
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Expected O, but got Unknown
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Expected O, but got Unknown
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Expected O, but got Unknown
			IMessageLogHelper messageLog = session.MessageLog;
			object obj = <>c.<>9__14_0;
			if (obj == null)
			{
				MessageReceivedHandler val = delegate(LogMessage message)
				{
					ArchipelagoConsole.LogMessage(((object)message).ToString());
				};
				<>c.<>9__14_0 = val;
				obj = (object)val;
			}
			messageLog.OnMessageReceived += (MessageReceivedHandler)obj;
			session.Items.ItemReceived += (ItemReceivedHandler)delegate(ReceivedItemsHelper receivedItemsHelper)
			{
				OnItemReceived(receivedItemsHelper);
			};
			session.Socket.ErrorReceived += new ErrorReceivedHandler(OnSessionErrorReceived);
			session.Socket.SocketClosed += new SocketClosedHandler(OnSessionSocketClosed);
		}

		private void TryConnect()
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Expected O, but got Unknown
			try
			{
				ThreadPool.QueueUserWorkItem(delegate
				{
					HandleConnectResult(session.TryConnectAndLogin("Bendy and the Ink Machine", serverData.SlotName, (ItemsHandlingFlags)7, new Version("0.6.7"), (string[])null, (string)null, serverData.Password, serverData.NeedSlotData));
				});
			}
			catch (Exception ex)
			{
				BendyAndTheArchipelagoMachine.Logger.LogError((object)ex);
				HandleConnectResult((LoginResult)new LoginFailure(ex.ToString()));
				attemptingConnection = false;
			}
		}

		private void HandleConnectResult(LoginResult result)
		{
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Expected O, but got Unknown
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			if (result.Successful)
			{
				LoginSuccessful val = (LoginSuccessful)result;
				string text = Path.Combine(Paths.PluginPath, "Lorecrafter703-Bendy_and_the_Archipelago_Machine", "BendyAndTheArchipelagoMachine", "savedata", session.RoomState.Seed + ".json");
				BendyAndTheArchipelagoMachine.Logger.LogDebug((object)text);
				if (File.Exists(text))
				{
					serverData = JsonConvert.DeserializeObject<ArchipelagoData>(File.ReadAllText(text));
				}
				else
				{
					serverData.SetupSession(val.SlotData, session.RoomState.Seed);
				}
				authenticated = true;
				NeedBaconSoup = (long)serverData.GetSlotDataOption("include_later_chapters") == 1 || (long)serverData.GetSlotDataOption("goal_chapter") == 4;
				bool enableDeathLink = (long)serverData.GetSlotDataOption("death_link") == 1;
				deathLinkHandler = new DeathLinkHandler(DeathLinkProvider.CreateDeathLinkService(session), serverData.SlotName, enableDeathLink);
				session.Locations.CompleteLocationChecksAsync(serverData.CheckedLocations.ToArray());
				string message = "Successfully connected to " + serverData.Uri + " as " + serverData.SlotName + "!";
				serverData.UpdateConnectionInfo(serverData.Uri, serverData.SlotName);
				ArchipelagoConsole.LogMessage(message);
			}
			else
			{
				LoginFailure val2 = (LoginFailure)result;
				string message = "Failed to connect to " + serverData.Uri + " as " + serverData.SlotName + ".";
				message = val2.Errors.Aggregate(message, (string current, string error) => current + "\n    " + error);
				BendyAndTheArchipelagoMachine.Logger.LogError((object)message);
				authenticated = false;
				Disconnect();
			}
			attemptingConnection = false;
		}

		private void Disconnect()
		{
			BendyAndTheArchipelagoMachine.Logger.LogDebug((object)"disconnecting from server..");
			ArchipelagoSession obj = session;
			if (obj != null)
			{
				obj.Socket.DisconnectAsync();
			}
			session = null;
			authenticated = false;
		}

		public void SendMessage(string message)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			if (authenticated)
			{
				session.Socket.SendPacketAsync((ArchipelagoPacketBase)new SayPacket
				{
					Text = message
				});
			}
		}

		private void OnItemReceived(ReceivedItemsHelper helper)
		{
			ItemInfo item = helper.DequeueItem();
			Helper = helper;
			ItemQueue.Enqueue(item);
		}

		public void ProcessItems()
		{
			if (authenticated && !attemptingConnection && Helper != null && !Utility.IsNullOrWhiteSpace(serverData.seed) && ItemQueue.Count > 0)
			{
				ItemInfo val = ItemQueue.Dequeue();
				if (Helper.Index > serverData.Index)
				{
					serverData.AddItem(val.ItemId);
					ArchipelagoConsole.LogMessage($"Received {val.ItemName} from {val.Player} ({val.LocationName}).");
				}
			}
		}

		private void OnSessionErrorReceived(Exception e, string message)
		{
			BendyAndTheArchipelagoMachine.Logger.LogError((object)e);
			ArchipelagoConsole.LogMessage(message);
			if (message.Contains("closed the WebSocket connection"))
			{
				Disconnect();
			}
		}

		private void OnSessionSocketClosed(string reason)
		{
			BendyAndTheArchipelagoMachine.Logger.LogError((object)("Connection to Archipelago lost: " + reason));
			Disconnect();
		}

		public static void SendLocation(string itemName)
		{
			long locationID = IDTables.GetLocationID(itemName);
			if (locationID != -1)
			{
				if (authenticated)
				{
					session.Locations.CompleteLocationChecks(new long[1] { locationID });
				}
				serverData.CheckLocation(locationID);
			}
		}

		public static bool HasItem(string itemName)
		{
			long itemID = IDTables.GetItemID(itemName);
			return serverData.ReceivedItems.Contains(itemID);
		}

		public static string BaconSoupCount()
		{
			int num = 0;
			foreach (long receivedItem in serverData.ReceivedItems)
			{
				if (receivedItem == IDTables.GetItemID("Bacon Soup"))
				{
					num++;
				}
			}
			long num2 = (long)serverData.GetSlotDataOption("bacon_soups_required");
			long num3 = (long)serverData.GetSlotDataOption("total_bacon_soups") * num2 / 100;
			return $"{num} / {num3} Bacon Soups";
		}

		public static void CompleteGoal()
		{
			if (authenticated)
			{
				session.SetGoalAchieved();
			}
		}
	}
}

BepInEx/plugins/BendyAndTheArchipelagoMachine/Newtonsoft.Json.dll

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

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AllowPartiallyTrustedCallers]
[assembly: InternalsVisibleTo("Newtonsoft.Json.Schema")]
[assembly: InternalsVisibleTo("Newtonsoft.Json.Tests")]
[assembly: InternalsVisibleTo("Newtonsoft.Json.Dynamic, PublicKey=0024000004800000940000000602000000240000525341310004000001000100cbd8d53b9d7de30f1f1278f636ec462cf9c254991291e66ebb157a885638a517887633b898ccbcf0d5c5ff7be85a6abe9e765d0ac7cd33c68dac67e7e64530e8222101109f154ab14a941c490ac155cd1d4fcba0fabb49016b4ef28593b015cab5937da31172f03f67d09edda404b88a60023f062ae71d0b2e4438b74cc11dc9")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("9ca358aa-317b-4925-8ada-4a29e943a363")]
[assembly: CLSCompliant(true)]
[assembly: TargetFramework(".NETFramework,Version=v4.5", FrameworkDisplayName = ".NET Framework 4.5")]
[assembly: AssemblyCompany("Newtonsoft")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyCopyright("Copyright © James Newton-King 2008")]
[assembly: AssemblyDescription("Json.NET is a popular high-performance JSON framework for .NET")]
[assembly: AssemblyFileVersion("11.0.1")]
[assembly: AssemblyInformationalVersion("11.0.1-beta2+0eb477a285cdf06aa7bf5e103583768eba37fed6")]
[assembly: AssemblyProduct("Json.NET")]
[assembly: AssemblyTitle("Json.NET")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/ArchipelagoMW/Archipelago.MultiClient.Net.git")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: AssemblyVersion("11.0.0.0")]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class IsReadOnlyAttribute : Attribute
	{
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace System.Diagnostics.CodeAnalysis
{
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = true)]
	internal sealed class NotNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false)]
	internal sealed class NotNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

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

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

			internal readonly int HashCode;

			internal Entry Next;

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

		private static readonly int HashCodeRandomizer;

		private int _count;

		private Entry[] _entries;

		private int _mask = 31;

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

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

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

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

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

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

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

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

		int LinePosition { get; }

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

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

		public JsonArrayAttribute()
		{
		}

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

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

		internal bool? _itemIsReference;

		internal ReferenceLoopHandling? _itemReferenceLoopHandling;

		internal TypeNameHandling? _itemTypeNameHandling;

		private Type? _namingStrategyType;

		private object[]? _namingStrategyParameters;

		public string? Id { get; set; }

		public string? Title { get; set; }

		public string? Description { get; set; }

		public Type? ItemConverterType { get; set; }

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

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

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

		internal NamingStrategy? NamingStrategyInstance { get; set; }

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

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

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

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

		protected JsonContainerAttribute()
		{
		}

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

		public static readonly string False = "false";

		public static readonly string Null = "null";

		public static readonly string Undefined = "undefined";

		public static readonly string PositiveInfinity = "Infinity";

		public static readonly string NegativeInfinity = "-Infinity";

		public static readonly string NaN = "NaN";

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

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

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

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

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

		public static string ToString(bool value)
		{
			return value ? True : False;
		}

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

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

		public static string ToString(int value)
		{
			return value.ToString(null, CultureInfo.InvariantCulture);
		}

		public static string ToString(short value)
		{
			return value.ToString(null, CultureInfo.InvariantCulture);
		}

		[CLSCompliant(false)]
		public static string ToString(ushort value)
		{
			return value.ToString(null, CultureInfo.InvariantCulture);
		}

		[CLSCompliant(false)]
		public static string ToString(uint value)
		{
			return value.ToString(null, CultureInfo.InvariantCulture);
		}

		public static string ToString(long value)
		{
			return value.ToString(null, CultureInfo.InvariantCulture);
		}

		private static string ToStringInternal(BigInteger value)
		{
			return value.ToString(null, CultureInfo.InvariantCulture);
		}

		[CLSCompliant(false)]
		public static string ToString(ulong value)
		{
			return value.ToString(null, CultureInfo.InvariantCulture);
		}

		public static string ToString(float value)
		{
			return EnsureDecimalPlace(value, value.ToString("R", CultureInfo.InvariantCulture));
		}

		internal static string ToString(float value, FloatFormatHandling floatFormatHandling, char quoteChar, bool nullable)
		{
			return EnsureFloatFormat(value, EnsureDecimalPlace(value, value.ToString("R", CultureInfo.InvariantCulture)), floatFormatHandling, quoteChar, nullable);
		}

		private static string EnsureFloatFormat(double value, string text, FloatFormatHandling floatFormatHandling, char quoteChar, bool nullable)
		{
			if (floatFormatHandling == FloatFormatHandling.Symbol || (!double.IsInfinity(value) && !double.IsNaN(value)))
			{
				return text;
			}
			if (floatFormatHandling == FloatFormatHandling.DefaultValue)
			{
				return (!nullable) ? "0.0" : Null;
			}
			return quoteChar + text + quoteChar;
		}

		public static string ToString(double value)
		{
			return EnsureDecimalPlace(value, value.ToString("R", CultureInfo.InvariantCulture));
		}

		internal static string ToString(double value, FloatFormatHandling floatFormatHandling, char quoteChar, bool nullable)
		{
			return EnsureFloatFormat(value, EnsureDecimalPlace(value, value.ToString("R", CultureInfo.InvariantCulture)), floatFormatHandling, quoteChar, nullable);
		}

		private static string EnsureDecimalPlace(double value, string text)
		{
			if (double.IsNaN(value) || double.IsInfinity(value) || text.IndexOf('.') != -1 || text.IndexOf('E') != -1 || text.IndexOf('e') != -1)
			{
				return text;
			}
			return text + ".0";
		}

		private static string EnsureDecimalPlace(string text)
		{
			if (text.IndexOf('.') != -1)
			{
				return text;
			}
			return text + ".0";
		}

		public static string ToString(byte value)
		{
			return value.ToString(null, CultureInfo.InvariantCulture);
		}

		[CLSCompliant(false)]
		public static string ToString(sbyte value)
		{
			return value.ToString(null, CultureInfo.InvariantCulture);
		}

		public static string ToString(decimal value)
		{
			return EnsureDecimalPlace(value.ToString(null, CultureInfo.InvariantCulture));
		}

		public static string ToString(Guid value)
		{
			return ToString(value, '"');
		}

		internal static string ToString(Guid value, char quoteChar)
		{
			string text = value.ToString("D", CultureInfo.InvariantCulture);
			string text2 = quoteChar.ToString(CultureInfo.InvariantCulture);
			return text2 + text + text2;
		}

		public static string ToString(TimeSpan value)
		{
			return ToString(value, '"');
		}

		internal static string ToString(TimeSpan value, char quoteChar)
		{
			return ToString(value.ToString(), quoteChar);
		}

		public static string ToString(Uri? value)
		{
			if (value == null)
			{
				return Null;
			}
			return ToString(value, '"');
		}

		internal static string ToString(Uri value, char quoteChar)
		{
			return ToString(value.OriginalString, quoteChar);
		}

		public static string ToString(string? value)
		{
			return ToString(value, '"');
		}

		public static string ToString(string? value, char delimiter)
		{
			return ToString(value, delimiter, StringEscapeHandling.Default);
		}

		public static string ToString(string? value, char delimiter, StringEscapeHandling stringEscapeHandling)
		{
			if (delimiter != '"' && delimiter != '\'')
			{
				throw new ArgumentException("Delimiter must be a single or double quote.", "delimiter");
			}
			return JavaScriptUtils.ToEscapedJavaScriptString(value, delimiter, appendDelimiters: true, stringEscapeHandling);
		}

		public static string ToString(object? value)
		{
			if (value == null)
			{
				return Null;
			}
			return ConvertUtils.GetTypeCode(value.GetType()) switch
			{
				PrimitiveTypeCode.String => ToString((string)value), 
				PrimitiveTypeCode.Char => ToString((char)value), 
				PrimitiveTypeCode.Boolean => ToString((bool)value), 
				PrimitiveTypeCode.SByte => ToString((sbyte)value), 
				PrimitiveTypeCode.Int16 => ToString((short)value), 
				PrimitiveTypeCode.UInt16 => ToString((ushort)value), 
				PrimitiveTypeCode.Int32 => ToString((int)value), 
				PrimitiveTypeCode.Byte => ToString((byte)value), 
				PrimitiveTypeCode.UInt32 => ToString((uint)value), 
				PrimitiveTypeCode.Int64 => ToString((long)value), 
				PrimitiveTypeCode.UInt64 => ToString((ulong)value), 
				PrimitiveTypeCode.Single => ToString((float)value), 
				PrimitiveTypeCode.Double => ToString((double)value), 
				PrimitiveTypeCode.DateTime => ToString((DateTime)value), 
				PrimitiveTypeCode.Decimal => ToString((decimal)value), 
				PrimitiveTypeCode.DBNull => Null, 
				PrimitiveTypeCode.DateTimeOffset => ToString((DateTimeOffset)value), 
				PrimitiveTypeCode.Guid => ToString((Guid)value), 
				PrimitiveTypeCode.Uri => ToString((Uri)value), 
				PrimitiveTypeCode.TimeSpan => ToString((TimeSpan)value), 
				PrimitiveTypeCode.BigInteger => ToStringInternal((BigInteger)value), 
				_ => throw new ArgumentException("Unsupported type: {0}. Use the JsonSerializer class to get the object's JSON representation.".FormatWith(CultureInfo.InvariantCulture, value.GetType())), 
			};
		}

		[DebuggerStepThrough]
		public static string SerializeObject(object? value)
		{
			return SerializeObject(value, (Type?)null, (JsonSerializerSettings?)null);
		}

		[DebuggerStepThrough]
		public static string SerializeObject(object? value, Formatting formatting)
		{
			return SerializeObject(value, formatting, (JsonSerializerSettings?)null);
		}

		[DebuggerStepThrough]
		public static string SerializeObject(object? value, params JsonConverter[] converters)
		{
			JsonSerializerSettings settings = ((converters != null && converters.Length != 0) ? new JsonSerializerSettings
			{
				Converters = converters
			} : null);
			return SerializeObject(value, null, settings);
		}

		[DebuggerStepThrough]
		public static string SerializeObject(object? value, Formatting formatting, params JsonConverter[] converters)
		{
			JsonSerializerSettings settings = ((converters != null && converters.Length != 0) ? new JsonSerializerSettings
			{
				Converters = converters
			} : null);
			return SerializeObject(value, null, formatting, settings);
		}

		[DebuggerStepThrough]
		public static string SerializeObject(object? value, JsonSerializerSettings? settings)
		{
			return SerializeObject(value, null, settings);
		}

		[DebuggerStepThrough]
		public static string SerializeObject(object? value, Type? type, JsonSerializerSettings? settings)
		{
			JsonSerializer jsonSerializer = JsonSerializer.CreateDefault(settings);
			return SerializeObjectInternal(value, type, jsonSerializer);
		}

		[DebuggerStepThrough]
		public static string SerializeObject(object? value, Formatting formatting, JsonSerializerSettings? settings)
		{
			return SerializeObject(value, null, formatting, settings);
		}

		[DebuggerStepThrough]
		public static string SerializeObject(object? value, Type? type, Formatting formatting, JsonSerializerSettings? settings)
		{
			JsonSerializer jsonSerializer = JsonSerializer.CreateDefault(settings);
			jsonSerializer.Formatting = formatting;
			return SerializeObjectInternal(value, type, jsonSerializer);
		}

		private static string SerializeObjectInternal(object? value, Type? type, JsonSerializer jsonSerializer)
		{
			StringBuilder sb = new StringBuilder(256);
			StringWriter stringWriter = new StringWriter(sb, CultureInfo.InvariantCulture);
			using (JsonTextWriter jsonTextWriter = new JsonTextWriter(stringWriter))
			{
				jsonTextWriter.Formatting = jsonSerializer.Formatting;
				jsonSerializer.Serialize(jsonTextWriter, value, type);
			}
			return stringWriter.ToString();
		}

		[DebuggerStepThrough]
		public static object? DeserializeObject(string value)
		{
			return DeserializeObject(value, (Type?)null, (JsonSerializerSettings?)null);
		}

		[DebuggerStepThrough]
		public static object? DeserializeObject(string value, JsonSerializerSettings settings)
		{
			return DeserializeObject(value, null, settings);
		}

		[DebuggerStepThrough]
		public static object? DeserializeObject(string value, Type type)
		{
			return DeserializeObject(value, type, (JsonSerializerSettings?)null);
		}

		[DebuggerStepThrough]
		public static T? DeserializeObject<T>(string value)
		{
			return JsonConvert.DeserializeObject<T>(value, (JsonSerializerSettings?)null);
		}

		[DebuggerStepThrough]
		public static T? DeserializeAnonymousType<T>(string value, T anonymousTypeObject)
		{
			return DeserializeObject<T>(value);
		}

		[DebuggerStepThrough]
		public static T? DeserializeAnonymousType<T>(string value, T anonymousTypeObject, JsonSerializerSettings settings)
		{
			return DeserializeObject<T>(value, settings);
		}

		[DebuggerStepThrough]
		public static T? DeserializeObject<T>(string value, params JsonConverter[] converters)
		{
			return (T)DeserializeObject(value, typeof(T), converters);
		}

		[DebuggerStepThrough]
		public static T? DeserializeObject<T>(string value, JsonSerializerSettings? settings)
		{
			return (T)DeserializeObject(value, typeof(T), settings);
		}

		[DebuggerStepThrough]
		public static object? DeserializeObject(string value, Type type, params JsonConverter[] converters)
		{
			JsonSerializerSettings settings = ((converters != null && converters.Length != 0) ? new JsonSerializerSettings
			{
				Converters = converters
			} : null);
			return DeserializeObject(value, type, settings);
		}

		public static object? DeserializeObject(string value, Type? type, JsonSerializerSettings? settings)
		{
			ValidationUtils.ArgumentNotNull(value, "value");
			JsonSerializer jsonSerializer = JsonSerializer.CreateDefault(settings);
			if (!jsonSerializer.IsCheckAdditionalContentSet())
			{
				jsonSerializer.CheckAdditionalContent = true;
			}
			using JsonTextReader reader = new JsonTextReader(new StringReader(value));
			return jsonSerializer.Deserialize(reader, type);
		}

		[DebuggerStepThrough]
		public static void PopulateObject(string value, object target)
		{
			PopulateObject(value, target, null);
		}

		public static void PopulateObject(string value, object target, JsonSerializerSettings? settings)
		{
			JsonSerializer jsonSerializer = JsonSerializer.CreateDefault(settings);
			using JsonReader jsonReader = new JsonTextReader(new StringReader(value));
			jsonSerializer.Populate(jsonReader, target);
			if (settings == null || !settings.CheckAdditionalContent)
			{
				return;
			}
			while (jsonReader.Read())
			{
				if (jsonReader.TokenType != JsonToken.Comment)
				{
					throw JsonSerializationException.Create(jsonReader, "Additional text found in JSON string after finishing deserializing object.");
				}
			}
		}

		public static string SerializeXmlNode(XmlNode? node)
		{
			return SerializeXmlNode(node, Formatting.None);
		}

		public static string SerializeXmlNode(XmlNode? node, Formatting formatting)
		{
			XmlNodeConverter xmlNodeConverter = new XmlNodeConverter();
			return SerializeObject(node, formatting, xmlNodeConverter);
		}

		public static string SerializeXmlNode(XmlNode? node, Formatting formatting, bool omitRootObject)
		{
			XmlNodeConverter xmlNodeConverter = new XmlNodeConverter
			{
				OmitRootObject = omitRootObject
			};
			return SerializeObject(node, formatting, xmlNodeConverter);
		}

		public static XmlDocument? DeserializeXmlNode(string value)
		{
			return DeserializeXmlNode(value, null);
		}

		public static XmlDocument? DeserializeXmlNode(string value, string? deserializeRootElementName)
		{
			return DeserializeXmlNode(value, deserializeRootElementName, writeArrayAttribute: false);
		}

		public static XmlDocument? DeserializeXmlNode(string value, string? deserializeRootElementName, bool writeArrayAttribute)
		{
			return DeserializeXmlNode(value, deserializeRootElementName, writeArrayAttribute, encodeSpecialCharacters: false);
		}

		public static XmlDocument? DeserializeXmlNode(string value, string? deserializeRootElementName, bool writeArrayAttribute, bool encodeSpecialCharacters)
		{
			XmlNodeConverter xmlNodeConverter = new XmlNodeConverter();
			xmlNodeConverter.DeserializeRootElementName = deserializeRootElementName;
			xmlNodeConverter.WriteArrayAttribute = writeArrayAttribute;
			xmlNodeConverter.EncodeSpecialCharacters = encodeSpecialCharacters;
			return (XmlDocument)DeserializeObject(value, typeof(XmlDocument), xmlNodeConverter);
		}

		public static string SerializeXNode(XObject? node)
		{
			return SerializeXNode(node, Formatting.None);
		}

		public static string SerializeXNode(XObject? node, Formatting formatting)
		{
			return SerializeXNode(node, formatting, omitRootObject: false);
		}

		public static string SerializeXNode(XObject? node, Formatting formatting, bool omitRootObject)
		{
			XmlNodeConverter xmlNodeConverter = new XmlNodeConverter
			{
				OmitRootObject = omitRootObject
			};
			return SerializeObject(node, formatting, xmlNodeConverter);
		}

		public static XDocument? DeserializeXNode(string value)
		{
			return DeserializeXNode(value, null);
		}

		public static XDocument? DeserializeXNode(string value, string? deserializeRootElementName)
		{
			return DeserializeXNode(value, deserializeRootElementName, writeArrayAttribute: false);
		}

		public static XDocument? DeserializeXNode(string value, string? deserializeRootElementName, bool writeArrayAttribute)
		{
			return DeserializeXNode(value, deserializeRootElementName, writeArrayAttribute, encodeSpecialCharacters: false);
		}

		public static XDocument? DeserializeXNode(string value, string? deserializeRootElementName, bool writeArrayAttribute, bool encodeSpecialCharacters)
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Expected O, but got Unknown
			XmlNodeConverter xmlNodeConverter = new XmlNodeConverter();
			xmlNodeConverter.DeserializeRootElementName = deserializeRootElementName;
			xmlNodeConverter.WriteArrayAttribute = writeArrayAttribute;
			xmlNodeConverter.EncodeSpecialCharacters = encodeSpecialCharacters;
			return (XDocument)DeserializeObject(value, typeof(XDocument), xmlNodeConverter);
		}
	}
	public abstract class JsonConverter
	{
		public virtual bool CanRead => true;

		public virtual bool CanWrite => true;

		public abstract void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer);

		public abstract object? ReadJson(JsonReader reader, Type objectType, object? existingValue, JsonSerializer serializer);

		public abstract bool CanConvert(Type objectType);
	}
	public abstract class JsonConverter<T> : JsonConverter
	{
		public sealed override void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer)
		{
			if (!((value != null) ? (value is T) : ReflectionUtils.IsNullable(typeof(T))))
			{
				throw new JsonSerializationException("Converter cannot write specified value to JSON. {0} is required.".FormatWith(CultureInfo.InvariantCulture, typeof(T)));
			}
			WriteJson(writer, (T)value, serializer);
		}

		public abstract void WriteJson(JsonWriter writer, T? value, JsonSerializer serializer);

		public sealed override object? ReadJson(JsonReader reader, Type objectType, object? existingValue, JsonSerializer serializer)
		{
			bool flag = existingValue == null;
			if (!flag && !(existingValue is T))
			{
				throw new JsonSerializationException("Converter cannot read JSON with the specified existing value. {0} is required.".FormatWith(CultureInfo.InvariantCulture, typeof(T)));
			}
			return ReadJson(reader, objectType, flag ? default(T) : ((T)existingValue), !flag, serializer);
		}

		public abstract T? ReadJson(JsonReader reader, Type objectType, T? existingValue, bool hasExistingValue, JsonSerializer serializer);

		public sealed override bool CanConvert(Type objectType)
		{
			return typeof(T).IsAssignableFrom(objectType);
		}
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Interface | AttributeTargets.Parameter, AllowMultiple = false)]
	public sealed class JsonConverterAttribute : Attribute
	{
		private readonly Type _converterType;

		public Type ConverterType => _converterType;

		public object[]? ConverterParameters { get; }

		public JsonConverterAttribute(Type converterType)
		{
			if (converterType == null)
			{
				throw new ArgumentNullException("converterType");
			}
			_converterType = converterType;
		}

		public JsonConverterAttribute(Type converterType, params object[] converterParameters)
			: this(converterType)
		{
			ConverterParameters = converterParameters;
		}
	}
	public class JsonConverterCollection : Collection<JsonConverter>
	{
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface, AllowMultiple = false)]
	public sealed class JsonDictionaryAttribute : JsonContainerAttribute
	{
		public JsonDictionaryAttribute()
		{
		}

		public JsonDictionaryAttribute(string id)
			: base(id)
		{
		}
	}
	[Serializable]
	public class JsonException : Exception
	{
		public JsonException()
		{
		}

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

		public JsonException(string message, Exception? innerException)
			: base(message, innerException)
		{
		}

		public JsonException(SerializationInfo info, StreamingContext context)
			: base(info, context)
		{
		}

		internal static JsonException Create(IJsonLineInfo lineInfo, string path, string message)
		{
			message = JsonPosition.FormatMessage(lineInfo, path, message);
			return new JsonException(message);
		}
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false)]
	public class JsonExtensionDataAttribute : Attribute
	{
		public bool WriteData { get; set; }

		public bool ReadData { get; set; }

		public JsonExtensionDataAttribute()
		{
			WriteData = true;
			ReadData = true;
		}
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false)]
	public sealed class JsonIgnoreAttribute : Attribute
	{
	}
	public abstract class JsonNameTable
	{
		public abstract string? Get(char[] key, int start, int length);
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface, AllowMultiple = false)]
	public sealed class JsonObjectAttribute : JsonContainerAttribute
	{
		private MemberSerialization _memberSerialization = MemberSerialization.OptOut;

		internal MissingMemberHandling? _missingMemberHandling;

		internal Required? _itemRequired;

		internal NullValueHandling? _itemNullValueHandling;

		public MemberSerialization MemberSerialization
		{
			get
			{
				return _memberSerialization;
			}
			set
			{
				_memberSerialization = value;
			}
		}

		public MissingMemberHandling MissingMemberHandling
		{
			get
			{
				return _missingMemberHandling.GetValueOrDefault();
			}
			set
			{
				_missingMemberHandling = value;
			}
		}

		public NullValueHandling ItemNullValueHandling
		{
			get
			{
				return _itemNullValueHandling.GetValueOrDefault();
			}
			set
			{
				_itemNullValueHandling = value;
			}
		}

		public Required ItemRequired
		{
			get
			{
				return _itemRequired.GetValueOrDefault();
			}
			set
			{
				_itemRequired = value;
			}
		}

		public JsonObjectAttribute()
		{
		}

		public JsonObjectAttribute(MemberSerialization memberSerialization)
		{
			MemberSerialization = memberSerialization;
		}

		public JsonObjectAttribute(string id)
			: base(id)
		{
		}
	}
	internal enum JsonContainerType
	{
		None,
		Object,
		Array,
		Constructor
	}
	internal struct JsonPosition
	{
		private static readonly char[] SpecialCharacters = new char[18]
		{
			'.', ' ', '\'', '/', '"', '[', ']', '(', ')', '\t',
			'\n', '\r', '\f', '\b', '\\', '\u0085', '\u2028', '\u2029'
		};

		internal JsonContainerType Type;

		internal int Position;

		internal string? PropertyName;

		internal bool HasIndex;

		public JsonPosition(JsonContainerType type)
		{
			Type = type;
			HasIndex = TypeHasIndex(type);
			Position = -1;
			PropertyName = null;
		}

		internal int CalculateLength()
		{
			switch (Type)
			{
			case JsonContainerType.Object:
				return PropertyName.Length + 5;
			case JsonContainerType.Array:
			case JsonContainerType.Constructor:
				return MathUtils.IntLength((ulong)Position) + 2;
			default:
				throw new ArgumentOutOfRangeException("Type");
			}
		}

		internal void WriteTo(StringBuilder sb, ref StringWriter? writer, ref char[]? buffer)
		{
			switch (Type)
			{
			case JsonContainerType.Object:
			{
				string propertyName = PropertyName;
				if (propertyName.IndexOfAny(SpecialCharacters) != -1)
				{
					sb.Append("['");
					if (writer == null)
					{
						writer = new StringWriter(sb);
					}
					JavaScriptUtils.WriteEscapedJavaScriptString(writer, propertyName, '\'', appendDelimiters: false, JavaScriptUtils.SingleQuoteCharEscapeFlags, StringEscapeHandling.Default, null, ref buffer);
					sb.Append("']");
				}
				else
				{
					if (sb.Length > 0)
					{
						sb.Append('.');
					}
					sb.Append(propertyName);
				}
				break;
			}
			case JsonContainerType.Array:
			case JsonContainerType.Constructor:
				sb.Append('[');
				sb.Append(Position);
				sb.Append(']');
				break;
			}
		}

		internal static bool TypeHasIndex(JsonContainerType type)
		{
			return type == JsonContainerType.Array || type == JsonContainerType.Constructor;
		}

		internal static string BuildPath(List<JsonPosition> positions, JsonPosition? currentPosition)
		{
			int num = 0;
			if (positions != null)
			{
				for (int i = 0; i < positions.Count; i++)
				{
					num += positions[i].CalculateLength();
				}
			}
			if (currentPosition.HasValue)
			{
				num += currentPosition.GetValueOrDefault().CalculateLength();
			}
			StringBuilder stringBuilder = new StringBuilder(num);
			StringWriter writer = null;
			char[] buffer = null;
			if (positions != null)
			{
				foreach (JsonPosition position in positions)
				{
					position.WriteTo(stringBuilder, ref writer, ref buffer);
				}
			}
			currentPosition?.WriteTo(stringBuilder, ref writer, ref buffer);
			return stringBuilder.ToString();
		}

		internal static string FormatMessage(IJsonLineInfo? lineInfo, string path, string message)
		{
			if (!message.EndsWith(Environment.NewLine, StringComparison.Ordinal))
			{
				message = message.Trim();
				if (!StringUtils.EndsWith(message, '.'))
				{
					message += ".";
				}
				message += " ";
			}
			message += "Path '{0}'".FormatWith(CultureInfo.InvariantCulture, path);
			if (lineInfo != null && lineInfo.HasLineInfo())
			{
				message += ", line {0}, position {1}".FormatWith(CultureInfo.InvariantCulture, lineInfo.LineNumber, lineInfo.LinePosition);
			}
			message += ".";
			return message;
		}
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false)]
	public sealed class JsonPropertyAttribute : Attribute
	{
		internal NullValueHandling? _nullValueHandling;

		internal DefaultValueHandling? _defaultValueHandling;

		internal ReferenceLoopHandling? _referenceLoopHandling;

		internal ObjectCreationHandling? _objectCreationHandling;

		internal TypeNameHandling? _typeNameHandling;

		internal bool? _isReference;

		internal int? _order;

		internal Required? _required;

		internal bool? _itemIsReference;

		internal ReferenceLoopHandling? _itemReferenceLoopHandling;

		internal TypeNameHandling? _itemTypeNameHandling;

		public Type? ItemConverterType { get; set; }

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

		public Type? NamingStrategyType { get; set; }

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

		public NullValueHandling NullValueHandling
		{
			get
			{
				return _nullValueHandling.GetValueOrDefault();
			}
			set
			{
				_nullValueHandling = value;
			}
		}

		public DefaultValueHandling DefaultValueHandling
		{
			get
			{
				return _defaultValueHandling.GetValueOrDefault();
			}
			set
			{
				_defaultValueHandling = value;
			}
		}

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

		public ObjectCreationHandling ObjectCreationHandling
		{
			get
			{
				return _objectCreationHandling.GetValueOrDefault();
			}
			set
			{
				_objectCreationHandling = value;
			}
		}

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

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

		public int Order
		{
			get
			{
				return _order.GetValueOrDefault();
			}
			set
			{
				_order = value;
			}
		}

		public Required Required
		{
			get
			{
				return _required.GetValueOrDefault();
			}
			set
			{
				_required = value;
			}
		}

		public string? PropertyName { get; set; }

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

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

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

		public JsonPropertyAttribute()
		{
		}

		public JsonPropertyAttribute(string propertyName)
		{
			PropertyName = propertyName;
		}
	}
	public abstract class JsonReader : IDisposable
	{
		protected internal enum State
		{
			Start,
			Complete,
			Property,
			ObjectStart,
			Object,
			ArrayStart,
			Array,
			Closed,
			PostValue,
			ConstructorStart,
			Constructor,
			Error,
			Finished
		}

		private JsonToken _tokenType;

		private object? _value;

		internal char _quoteChar;

		internal State _currentState;

		private JsonPosition _currentPosition;

		private CultureInfo? _culture;

		private DateTimeZoneHandling _dateTimeZoneHandling;

		private int? _maxDepth;

		private bool _hasExceededMaxDepth;

		internal DateParseHandling _dateParseHandling;

		internal FloatParseHandling _floatParseHandling;

		private string? _dateFormatString;

		private List<JsonPosition>? _stack;

		protected State CurrentState => _currentState;

		public bool CloseInput { get; set; }

		public bool SupportMultipleContent { get; set; }

		public virtual char QuoteChar
		{
			get
			{
				return _quoteChar;
			}
			protected internal set
			{
				_quoteChar = value;
			}
		}

		public DateTimeZoneHandling DateTimeZoneHandling
		{
			get
			{
				return _dateTimeZoneHandling;
			}
			set
			{
				if (value < DateTimeZoneHandling.Local || value > DateTimeZoneHandling.RoundtripKind)
				{
					throw new ArgumentOutOfRangeException("value");
				}
				_dateTimeZoneHandling = value;
			}
		}

		public DateParseHandling DateParseHandling
		{
			get
			{
				return _dateParseHandling;
			}
			set
			{
				if (value < DateParseHandling.None || value > DateParseHandling.DateTimeOffset)
				{
					throw new ArgumentOutOfRangeException("value");
				}
				_dateParseHandling = value;
			}
		}

		public FloatParseHandling FloatParseHandling
		{
			get
			{
				return _floatParseHandling;
			}
			set
			{
				if (value < FloatParseHandling.Double || value > FloatParseHandling.Decimal)
				{
					throw new ArgumentOutOfRangeException("value");
				}
				_floatParseHandling = value;
			}
		}

		public string? DateFormatString
		{
			get
			{
				return _dateFormatString;
			}
			set
			{
				_dateFormatString = value;
			}
		}

		public int? MaxDepth
		{
			get
			{
				return _maxDepth;
			}
			set
			{
				if (value <= 0)
				{
					throw new ArgumentException("Value must be positive.", "value");
				}
				_maxDepth = value;
			}
		}

		public virtual JsonToken TokenType => _tokenType;

		public virtual object? Value => _value;

		public virtual Type? ValueType => _value?.GetType();

		public virtual int Depth
		{
			get
			{
				int num = _stack?.Count ?? 0;
				if (JsonTokenUtils.IsStartToken(TokenType) || _currentPosition.Type == JsonContainerType.None)
				{
					return num;
				}
				return num + 1;
			}
		}

		public virtual string Path
		{
			get
			{
				if (_currentPosition.Type == JsonContainerType.None)
				{
					return string.Empty;
				}
				JsonPosition? currentPosition = ((_currentState != State.ArrayStart && _currentState != State.ConstructorStart && _currentState != State.ObjectStart) ? new JsonPosition?(_currentPosition) : null);
				return JsonPosition.BuildPath(_stack, currentPosition);
			}
		}

		public CultureInfo Culture
		{
			get
			{
				return _culture ?? CultureInfo.InvariantCulture;
			}
			set
			{
				_culture = value;
			}
		}

		public virtual Task<bool> ReadAsync(CancellationToken cancellationToken = default(CancellationToken))
		{
			return cancellationToken.CancelIfRequestedAsync<bool>() ?? Read().ToAsync();
		}

		public async Task SkipAsync(CancellationToken cancellationToken = default(CancellationToken))
		{
			if (TokenType == JsonToken.PropertyName)
			{
				await ReadAsync(cancellationToken).ConfigureAwait(continueOnCapturedContext: false);
			}
			if (JsonTokenUtils.IsStartToken(TokenType))
			{
				int depth = Depth;
				while (await ReadAsync(cancellationToken).ConfigureAwait(continueOnCapturedContext: false) && depth < Depth)
				{
				}
			}
		}

		internal async Task ReaderReadAndAssertAsync(CancellationToken cancellationToken)
		{
			if (!(await ReadAsync(cancellationToken).ConfigureAwait(continueOnCapturedContext: false)))
			{
				throw CreateUnexpectedEndException();
			}
		}

		public virtual Task<bool?> ReadAsBooleanAsync(CancellationToken cancellationToken = default(CancellationToken))
		{
			return cancellationToken.CancelIfRequestedAsync<bool?>() ?? Task.FromResult(ReadAsBoolean());
		}

		public virtual Task<byte[]?> ReadAsBytesAsync(CancellationToken cancellationToken = default(CancellationToken))
		{
			return cancellationToken.CancelIfRequestedAsync<byte[]>() ?? Task.FromResult(ReadAsBytes());
		}

		internal async Task<byte[]?> ReadArrayIntoByteArrayAsync(CancellationToken cancellationToken)
		{
			List<byte> buffer = new List<byte>();
			do
			{
				if (!(await ReadAsync(cancellationToken).ConfigureAwait(continueOnCapturedContext: false)))
				{
					SetToken(JsonToken.None);
				}
			}
			while (!ReadArrayElementIntoByteArrayReportDone(buffer));
			byte[] d = buffer.ToArray();
			SetToken(JsonToken.Bytes, d, updateIndex: false);
			return d;
		}

		public virtual Task<DateTime?> ReadAsDateTimeAsync(CancellationToken cancellationToken = default(CancellationToken))
		{
			return cancellationToken.CancelIfRequestedAsync<DateTime?>() ?? Task.FromResult(ReadAsDateTime());
		}

		public virtual Task<DateTimeOffset?> ReadAsDateTimeOffsetAsync(CancellationToken cancellationToken = default(CancellationToken))
		{
			return cancellationToken.CancelIfRequestedAsync<DateTimeOffset?>() ?? Task.FromResult(ReadAsDateTimeOffset());
		}

		public virtual Task<decimal?> ReadAsDecimalAsync(CancellationToken cancellationToken = default(CancellationToken))
		{
			return cancellationToken.CancelIfRequestedAsync<decimal?>() ?? Task.FromResult(ReadAsDecimal());
		}

		public virtual Task<double?> ReadAsDoubleAsync(CancellationToken cancellationToken = default(CancellationToken))
		{
			return Task.FromResult(ReadAsDouble());
		}

		public virtual Task<int?> ReadAsInt32Async(CancellationToken cancellationToken = default(CancellationToken))
		{
			return cancellationToken.CancelIfRequestedAsync<int?>() ?? Task.FromResult(ReadAsInt32());
		}

		public virtual Task<string?> ReadAsStringAsync(CancellationToken cancellationToken = default(CancellationToken))
		{
			return cancellationToken.CancelIfRequestedAsync<string>() ?? Task.FromResult(ReadAsString());
		}

		internal async Task<bool> ReadAndMoveToContentAsync(CancellationToken cancellationToken)
		{
			bool flag = await ReadAsync(cancellationToken).ConfigureAwait(continueOnCapturedContext: false);
			if (flag)
			{
				flag = await MoveToContentAsync(cancellationToken).ConfigureAwait(continueOnCapturedContext: false);
			}
			return flag;
		}

		internal Task<bool> MoveToContentAsync(CancellationToken cancellationToken)
		{
			JsonToken tokenType = TokenType;
			JsonToken jsonToken = tokenType;
			if (jsonToken == JsonToken.None || jsonToken == JsonToken.Comment)
			{
				return MoveToContentFromNonContentAsync(cancellationToken);
			}
			return AsyncUtils.True;
		}

		private async Task<bool> MoveToContentFromNonContentAsync(CancellationToken cancellationToken)
		{
			JsonToken jsonToken2;
			do
			{
				if (!(await ReadAsync(cancellationToken).ConfigureAwait(continueOnCapturedContext: false)))
				{
					return false;
				}
				JsonToken tokenType = TokenType;
				JsonToken jsonToken = tokenType;
				jsonToken2 = jsonToken;
			}
			while (jsonToken2 == JsonToken.None || jsonToken2 == JsonToken.Comment);
			return true;
		}

		internal JsonPosition GetPosition(int depth)
		{
			if (_stack != null && depth < _stack.Count)
			{
				return _stack[depth];
			}
			return _currentPosition;
		}

		protected JsonReader()
		{
			_currentState = State.Start;
			_dateTimeZoneHandling = DateTimeZoneHandling.RoundtripKind;
			_dateParseHandling = DateParseHandling.DateTime;
			_floatParseHandling = FloatParseHandling.Double;
			_maxDepth = 64;
			CloseInput = true;
		}

		private void Push(JsonContainerType value)
		{
			UpdateScopeWithFinishedValue();
			if (_currentPosition.Type == JsonContainerType.None)
			{
				_currentPosition = new JsonPosition(value);
				return;
			}
			if (_stack == null)
			{
				_stack = new List<JsonPosition>();
			}
			_stack.Add(_currentPosition);
			_currentPosition = new JsonPosition(value);
			if (!_maxDepth.HasValue || !(Depth + 1 > _maxDepth) || _hasExceededMaxDepth)
			{
				return;
			}
			_hasExceededMaxDepth = true;
			throw JsonReaderException.Create(this, "The reader's MaxDepth of {0} has been exceeded.".FormatWith(CultureInfo.InvariantCulture, _maxDepth));
		}

		private JsonContainerType Pop()
		{
			JsonPosition currentPosition;
			if (_stack != null && _stack.Count > 0)
			{
				currentPosition = _currentPosition;
				_currentPosition = _stack[_stack.Count - 1];
				_stack.RemoveAt(_stack.Count - 1);
			}
			else
			{
				currentPosition = _currentPosition;
				_currentPosition = default(JsonPosition);
			}
			if (_maxDepth.HasValue && Depth <= _maxDepth)
			{
				_hasExceededMaxDepth = false;
			}
			return currentPosition.Type;
		}

		private JsonContainerType Peek()
		{
			return _currentPosition.Type;
		}

		public abstract bool Read();

		public virtual int? ReadAsInt32()
		{
			JsonToken contentToken = GetContentToken();
			switch (contentToken)
			{
			case JsonToken.None:
			case JsonToken.Null:
			case JsonToken.EndArray:
				return null;
			case JsonToken.Integer:
			case JsonToken.Float:
			{
				object value = Value;
				if (value is int value2)
				{
					return value2;
				}
				int num;
				if (value is BigInteger bigInteger)
				{
					num = (int)bigInteger;
				}
				else
				{
					try
					{
						num = Convert.ToInt32(value, CultureInfo.InvariantCulture);
					}
					catch (Exception ex)
					{
						throw JsonReaderException.Create(this, "Could not convert to integer: {0}.".FormatWith(CultureInfo.InvariantCulture, value), ex);
					}
				}
				SetToken(JsonToken.Integer, num, updateIndex: false);
				return num;
			}
			case JsonToken.String:
			{
				string s = (string)Value;
				return ReadInt32String(s);
			}
			default:
				throw JsonReaderException.Create(this, "Error reading integer. Unexpected token: {0}.".FormatWith(CultureInfo.InvariantCulture, contentToken));
			}
		}

		internal int? ReadInt32String(string? s)
		{
			if (StringUtils.IsNullOrEmpty(s))
			{
				SetToken(JsonToken.Null, null, updateIndex: false);
				return null;
			}
			if (int.TryParse(s, NumberStyles.Integer, Culture, out var result))
			{
				SetToken(JsonToken.Integer, result, updateIndex: false);
				return result;
			}
			SetToken(JsonToken.String, s, updateIndex: false);
			throw JsonReaderException.Create(this, "Could not convert string to integer: {0}.".FormatWith(CultureInfo.InvariantCulture, s));
		}

		public virtual string? ReadAsString()
		{
			JsonToken contentToken = GetContentToken();
			switch (contentToken)
			{
			case JsonToken.None:
			case JsonToken.Null:
			case JsonToken.EndArray:
				return null;
			case JsonToken.String:
				return (string)Value;
			default:
				if (JsonTokenUtils.IsPrimitiveToken(contentToken))
				{
					object value = Value;
					if (value != null)
					{
						string text = ((!(value is IFormattable formattable)) ? ((value is Uri uri) ? uri.OriginalString : value.ToString()) : formattable.ToString(null, Culture));
						SetToken(JsonToken.String, text, updateIndex: false);
						return text;
					}
				}
				throw JsonReaderException.Create(this, "Error reading string. Unexpected token: {0}.".FormatWith(CultureInfo.InvariantCulture, contentToken));
			}
		}

		public virtual byte[]? ReadAsBytes()
		{
			JsonToken contentToken = GetContentToken();
			switch (contentToken)
			{
			case JsonToken.StartObject:
			{
				ReadIntoWrappedTypeObject();
				byte[] array3 = ReadAsBytes();
				ReaderReadAndAssert();
				if (TokenType != JsonToken.EndObject)
				{
					throw JsonReaderException.Create(this, "Error reading bytes. Unexpected token: {0}.".FormatWith(CultureInfo.InvariantCulture, TokenType));
				}
				SetToken(JsonToken.Bytes, array3, updateIndex: false);
				return array3;
			}
			case JsonToken.String:
			{
				string text = (string)Value;
				Guid g;
				byte[] array2 = ((text.Length == 0) ? CollectionUtils.ArrayEmpty<byte>() : ((!ConvertUtils.TryConvertGuid(text, out g)) ? Convert.FromBase64String(text) : g.ToByteArray()));
				SetToken(JsonToken.Bytes, array2, updateIndex: false);
				return array2;
			}
			case JsonToken.None:
			case JsonToken.Null:
			case JsonToken.EndArray:
				return null;
			case JsonToken.Bytes:
				if (Value is Guid guid)
				{
					byte[] array = guid.ToByteArray();
					SetToken(JsonToken.Bytes, array, updateIndex: false);
					return array;
				}
				return (byte[])Value;
			case JsonToken.StartArray:
				return ReadArrayIntoByteArray();
			default:
				throw JsonReaderException.Create(this, "Error reading bytes. Unexpected token: {0}.".FormatWith(CultureInfo.InvariantCulture, contentToken));
			}
		}

		internal byte[] ReadArrayIntoByteArray()
		{
			List<byte> list = new List<byte>();
			do
			{
				if (!Read())
				{
					SetToken(JsonToken.None);
				}
			}
			while (!ReadArrayElementIntoByteArrayReportDone(list));
			byte[] array = list.ToArray();
			SetToken(JsonToken.Bytes, array, updateIndex: false);
			return array;
		}

		private bool ReadArrayElementIntoByteArrayReportDone(List<byte> buffer)
		{
			switch (TokenType)
			{
			case JsonToken.None:
				throw JsonReaderException.Create(this, "Unexpected end when reading bytes.");
			case JsonToken.Integer:
				buffer.Add(Convert.ToByte(Value, CultureInfo.InvariantCulture));
				return false;
			case JsonToken.EndArray:
				return true;
			case JsonToken.Comment:
				return false;
			default:
				throw JsonReaderException.Create(this, "Unexpected token when reading bytes: {0}.".FormatWith(CultureInfo.InvariantCulture, TokenType));
			}
		}

		public virtual double? ReadAsDouble()
		{
			JsonToken contentToken = GetContentToken();
			switch (contentToken)
			{
			case JsonToken.None:
			case JsonToken.Null:
			case JsonToken.EndArray:
				return null;
			case JsonToken.Integer:
			case JsonToken.Float:
			{
				object value = Value;
				if (value is double value2)
				{
					return value2;
				}
				double num = ((!(value is BigInteger bigInteger) || 1 == 0) ? Convert.ToDouble(value, CultureInfo.InvariantCulture) : ((double)bigInteger));
				SetToken(JsonToken.Float, num, updateIndex: false);
				return num;
			}
			case JsonToken.String:
				return ReadDoubleString((string)Value);
			default:
				throw JsonReaderException.Create(this, "Error reading double. Unexpected token: {0}.".FormatWith(CultureInfo.InvariantCulture, contentToken));
			}
		}

		internal double? ReadDoubleString(string? s)
		{
			if (StringUtils.IsNullOrEmpty(s))
			{
				SetToken(JsonToken.Null, null, updateIndex: false);
				return null;
			}
			if (double.TryParse(s, NumberStyles.Float | NumberStyles.AllowThousands, Culture, out var result))
			{
				SetToken(JsonToken.Float, result, updateIndex: false);
				return result;
			}
			SetToken(JsonToken.String, s, updateIndex: false);
			throw JsonReaderException.Create(this, "Could not convert string to double: {0}.".FormatWith(CultureInfo.InvariantCulture, s));
		}

		public virtual bool? ReadAsBoolean()
		{
			JsonToken contentToken = GetContentToken();
			switch (contentToken)
			{
			case JsonToken.None:
			case JsonToken.Null:
			case JsonToken.EndArray:
				return null;
			case JsonToken.Integer:
			case JsonToken.Float:
			{
				bool flag = ((!(Value is BigInteger bigInteger) || 1 == 0) ? Convert.ToBoolean(Value, CultureInfo.InvariantCulture) : (bigInteger != 0L));
				SetToken(JsonToken.Boolean, flag, updateIndex: false);
				return flag;
			}
			case JsonToken.String:
				return ReadBooleanString((string)Value);
			case JsonToken.Boolean:
				return (bool)Value;
			default:
				throw JsonReaderException.Create(this, "Error reading boolean. Unexpected token: {0}.".FormatWith(CultureInfo.InvariantCulture, contentToken));
			}
		}

		internal bool? ReadBooleanString(string? s)
		{
			if (StringUtils.IsNullOrEmpty(s))
			{
				SetToken(JsonToken.Null, null, updateIndex: false);
				return null;
			}
			if (bool.TryParse(s, out var result))
			{
				SetToken(JsonToken.Boolean, result, updateIndex: false);
				return result;
			}
			SetToken(JsonToken.String, s, updateIndex: false);
			throw JsonReaderException.Create(this, "Could not convert string to boolean: {0}.".FormatWith(CultureInfo.InvariantCulture, s));
		}

		public virtual decimal? ReadAsDecimal()
		{
			JsonToken contentToken = GetContentToken();
			switch (contentToken)
			{
			case JsonToken.None:
			case JsonToken.Null:
			case JsonToken.EndArray:
				return null;
			case JsonToken.Integer:
			case JsonToken.Float:
			{
				object value = Value;
				if (value is decimal value2)
				{
					return value2;
				}
				decimal num;
				if (value is BigInteger bigInteger)
				{
					num = (decimal)bigInteger;
				}
				else
				{
					try
					{
						num = Convert.ToDecimal(value, CultureInfo.InvariantCulture);
					}
					catch (Exception ex)
					{
						throw JsonReaderException.Create(this, "Could not convert to decimal: {0}.".FormatWith(CultureInfo.InvariantCulture, value), ex);
					}
				}
				SetToken(JsonToken.Float, num, updateIndex: false);
				return num;
			}
			case JsonToken.String:
				return ReadDecimalString((string)Value);
			default:
				throw JsonReaderException.Create(this, "Error reading decimal. Unexpected token: {0}.".FormatWith(CultureInfo.InvariantCulture, contentToken));
			}
		}

		internal decimal? ReadDecimalString(string? s)
		{
			if (StringUtils.IsNullOrEmpty(s))
			{
				SetToken(JsonToken.Null, null, updateIndex: false);
				return null;
			}
			if (decimal.TryParse(s, NumberStyles.Number, Culture, out var result))
			{
				SetToken(JsonToken.Float, result, updateIndex: false);
				return result;
			}
			if (ConvertUtils.DecimalTryParse(s.ToCharArray(), 0, s.Length, out result) == ParseResult.Success)
			{
				SetToken(JsonToken.Float, result, updateIndex: false);
				return result;
			}
			SetToken(JsonToken.String, s, updateIndex: false);
			throw JsonReaderException.Create(this, "Could not convert string to decimal: {0}.".FormatWith(CultureInfo.InvariantCulture, s));
		}

		public virtual DateTime? ReadAsDateTime()
		{
			switch (GetContentToken())
			{
			case JsonToken.None:
			case JsonToken.Null:
			case JsonToken.EndArray:
				return null;
			case JsonToken.Date:
				if (Value is DateTimeOffset dateTimeOffset)
				{
					SetToken(JsonToken.Date, dateTimeOffset.DateTime, updateIndex: false);
				}
				return (DateTime)Value;
			case JsonToken.String:
				return ReadDateTimeString((string)Value);
			default:
				throw JsonReaderException.Create(this, "Error reading date. Unexpected token: {0}.".FormatWith(CultureInfo.InvariantCulture, TokenType));
			}
		}

		internal DateTime? ReadDateTimeString(string? s)
		{
			if (StringUtils.IsNullOrEmpty(s))
			{
				SetToken(JsonToken.Null, null, updateIndex: false);
				return null;
			}
			if (DateTimeUtils.TryParseDateTime(s, DateTimeZoneHandling, _dateFormatString, Culture, out var dt))
			{
				dt = DateTimeUtils.EnsureDateTime(dt, DateTimeZoneHandling);
				SetToken(JsonToken.Date, dt, updateIndex: false);
				return dt;
			}
			if (DateTime.TryParse(s, Culture, DateTimeStyles.RoundtripKind, out dt))
			{
				dt = DateTimeUtils.EnsureDateTime(dt, DateTimeZoneHandling);
				SetToken(JsonToken.Date, dt, updateIndex: false);
				return dt;
			}
			throw JsonReaderException.Create(this, "Could not convert string to DateTime: {0}.".FormatWith(CultureInfo.InvariantCulture, s));
		}

		public virtual DateTimeOffset? ReadAsDateTimeOffset()
		{
			JsonToken contentToken = GetContentToken();
			switch (contentToken)
			{
			case JsonToken.None:
			case JsonToken.Null:
			case JsonToken.EndArray:
				return null;
			case JsonToken.Date:
				if (Value is DateTime dateTime)
				{
					SetToken(JsonToken.Date, new DateTimeOffset(dateTime), updateIndex: false);
				}
				return (DateTimeOffset)Value;
			case JsonToken.String:
			{
				string s = (string)Value;
				return ReadDateTimeOffsetString(s);
			}
			default:
				throw JsonReaderException.Create(this, "Error reading date. Unexpected token: {0}.".FormatWith(CultureInfo.InvariantCulture, contentToken));
			}
		}

		internal DateTimeOffset? ReadDateTimeOffsetString(string? s)
		{
			if (StringUtils.IsNullOrEmpty(s))
			{
				SetToken(JsonToken.Null, null, updateIndex: false);
				return null;
			}
			if (DateTimeUtils.TryParseDateTimeOffset(s, _dateFormatString, Culture, out var dt))
			{
				SetToken(JsonToken.Date, dt, updateIndex: false);
				return dt;
			}
			if (DateTimeOffset.TryParse(s, Culture, DateTimeStyles.RoundtripKind, out dt))
			{
				SetToken(JsonToken.Date, dt, updateIndex: false);
				return dt;
			}
			SetToken(JsonToken.String, s, updateIndex: false);
			throw JsonReaderException.Create(this, "Could not convert string to DateTimeOffset: {0}.".FormatWith(CultureInfo.InvariantCulture, s));
		}

		internal void ReaderReadAndAssert()
		{
			if (!Read())
			{
				throw CreateUnexpectedEndException();
			}
		}

		internal JsonReaderException CreateUnexpectedEndException()
		{
			return JsonReaderException.Create(this, "Unexpected end when reading JSON.");
		}

		internal void ReadIntoWrappedTypeObject()
		{
			ReaderReadAndAssert();
			if (Value != null && Value.ToString() == "$type")
			{
				ReaderReadAndAssert();
				if (Value != null && Value.ToString().StartsWith("System.Byte[]", StringComparison.Ordinal))
				{
					ReaderReadAndAssert();
					if (Value.ToString() == "$value")
					{
						return;
					}
				}
			}
			throw JsonReaderException.Create(this, "Error reading bytes. Unexpected token: {0}.".FormatWith(CultureInfo.InvariantCulture, JsonToken.StartObject));
		}

		public void Skip()
		{
			if (TokenType == JsonToken.PropertyName)
			{
				Read();
			}
			if (JsonTokenUtils.IsStartToken(TokenType))
			{
				int depth = Depth;
				while (Read() && depth < Depth)
				{
				}
			}
		}

		protected void SetToken(JsonToken newToken)
		{
			SetToken(newToken, null, updateIndex: true);
		}

		protected void SetToken(JsonToken newToken, object? value)
		{
			SetToken(newToken, value, updateIndex: true);
		}

		protected void SetToken(JsonToken newToken, object? value, bool updateIndex)
		{
			_tokenType = newToken;
			_value = value;
			switch (newToken)
			{
			case JsonToken.StartObject:
				_currentState = State.ObjectStart;
				Push(JsonContainerType.Object);
				break;
			case JsonToken.StartArray:
				_currentState = State.ArrayStart;
				Push(JsonContainerType.Array);
				break;
			case JsonToken.StartConstructor:
				_currentState = State.ConstructorStart;
				Push(JsonContainerType.Constructor);
				break;
			case JsonToken.EndObject:
				ValidateEnd(JsonToken.EndObject);
				break;
			case JsonToken.EndArray:
				ValidateEnd(JsonToken.EndArray);
				break;
			case JsonToken.EndConstructor:
				ValidateEnd(JsonToken.EndConstructor);
				break;
			case JsonToken.PropertyName:
				_currentState = State.Property;
				_currentPosition.PropertyName = (string)value;
				break;
			case JsonToken.Raw:
			case JsonToken.Integer:
			case JsonToken.Float:
			case JsonToken.String:
			case JsonToken.Boolean:
			case JsonToken.Null:
			case JsonToken.Undefined:
			case JsonToken.Date:
			case JsonToken.Bytes:
				SetPostValueState(updateIndex);
				break;
			case JsonToken.Comment:
				break;
			}
		}

		internal void SetPostValueState(bool updateIndex)
		{
			if (Peek() != 0 || SupportMultipleContent)
			{
				_currentState = State.PostValue;
			}
			else
			{
				SetFinished();
			}
			if (updateIndex)
			{
				UpdateScopeWithFinishedValue();
			}
		}

		private void UpdateScopeWithFinishedValue()
		{
			if (_currentPosition.HasIndex)
			{
				_currentPosition.Position++;
			}
		}

		private void ValidateEnd(JsonToken endToken)
		{
			JsonContainerType jsonContainerType = Pop();
			if (GetTypeForCloseToken(endToken) != jsonContainerType)
			{
				throw JsonReaderException.Create(this, "JsonToken {0} is not valid for closing JsonType {1}.".FormatWith(CultureInfo.InvariantCulture, endToken, jsonContainerType));
			}
			if (Peek() != 0 || SupportMultipleContent)
			{
				_currentState = State.PostValue;
			}
			else
			{
				SetFinished();
			}
		}

		protected void SetStateBasedOnCurrent()
		{
			JsonContainerType jsonContainerType = Peek();
			switch (jsonContainerType)
			{
			case JsonContainerType.Object:
				_currentState = State.Object;
				break;
			case JsonContainerType.Array:
				_currentState = State.Array;
				break;
			case JsonContainerType.Constructor:
				_currentState = State.Constructor;
				break;
			case JsonContainerType.None:
				SetFinished();
				break;
			default:
				throw JsonReaderException.Create(this, "While setting the reader state back to current object an unexpected JsonType was encountered: {0}".FormatWith(CultureInfo.InvariantCulture, jsonContainerType));
			}
		}

		private void SetFinished()
		{
			_currentState = ((!SupportMultipleContent) ? State.Finished : State.Start);
		}

		private JsonContainerType GetTypeForCloseToken(JsonToken token)
		{
			return token switch
			{
				JsonToken.EndObject => JsonContainerType.Object, 
				JsonToken.EndArray => JsonContainerType.Array, 
				JsonToken.EndConstructor => JsonContainerType.Constructor, 
				_ => throw JsonReaderException.Create(this, "Not a valid close JsonToken: {0}".FormatWith(CultureInfo.InvariantCulture, token)), 
			};
		}

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

		protected virtual void Dispose(bool disposing)
		{
			if (_currentState != State.Closed && disposing)
			{
				Close();
			}
		}

		public virtual void Close()
		{
			_currentState = State.Closed;
			_tokenType = JsonToken.None;
			_value = null;
		}

		internal void ReadAndAssert()
		{
			if (!Read())
			{
				throw JsonSerializationException.Create(this, "Unexpected end when reading JSON.");
			}
		}

		internal void ReadForTypeAndAssert(JsonContract? contract, bool hasConverter)
		{
			if (!ReadForType(contract, hasConverter))
			{
				throw JsonSerializationException.Create(this, "Unexpected end when reading JSON.");
			}
		}

		internal bool ReadForType(JsonContract? contract, bool hasConverter)
		{
			if (hasConverter)
			{
				return Read();
			}
			switch (contract?.InternalReadType ?? ReadType.Read)
			{
			case ReadType.Read:
				return ReadAndMoveToContent();
			case ReadType.ReadAsInt32:
				ReadAsInt32();
				break;
			case ReadType.ReadAsInt64:
			{
				bool result = ReadAndMoveToContent();
				if (TokenType == JsonToken.Undefined)
				{
					throw JsonReaderException.Create(this, "An undefined token is not a valid {0}.".FormatWith(CultureInfo.InvariantCulture, contract?.UnderlyingType ?? typeof(long)));
				}
				return result;
			}
			case ReadType.ReadAsDecimal:
				ReadAsDecimal();
				break;
			case ReadType.ReadAsDouble:
				ReadAsDouble();
				break;
			case ReadType.ReadAsBytes:
				ReadAsBytes();
				break;
			case ReadType.ReadAsBoolean:
				ReadAsBoolean();
				break;
			case ReadType.ReadAsString:
				ReadAsString();
				break;
			case ReadType.ReadAsDateTime:
				ReadAsDateTime();
				break;
			case ReadType.ReadAsDateTimeOffset:
				ReadAsDateTimeOffset();
				break;
			default:
				throw new ArgumentOutOfRangeException();
			}
			return TokenType != JsonToken.None;
		}

		internal bool ReadAndMoveToContent()
		{
			return Read() && MoveToContent();
		}

		internal bool MoveToContent()
		{
			JsonToken tokenType = TokenType;
			while (tokenType == JsonToken.None || tokenType == JsonToken.Comment)
			{
				if (!Read())
				{
					return false;
				}
				tokenType = TokenType;
			}
			return true;
		}

		private JsonToken GetContentToken()
		{
			JsonToken tokenType;
			do
			{
				if (!Read())
				{
					SetToken(JsonToken.None);
					return JsonToken.None;
				}
				tokenType = TokenType;
			}
			while (tokenType == JsonToken.Comment);
			return tokenType;
		}
	}
	[Serializable]
	public class JsonReaderException : JsonException
	{
		public int LineNumber { get; }

		public int LinePosition { get; }

		public string? Path { get; }

		public JsonReaderException()
		{
		}

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

		public JsonReaderException(string message, Exception innerException)
			: base(message, innerException)
		{
		}

		public JsonReaderException(SerializationInfo info, StreamingContext context)
			: base(info, context)
		{
		}

		public JsonReaderException(string message, string path, int lineNumber, int linePosition, Exception? innerException)
			: base(message, innerException)
		{
			Path = path;
			LineNumber = lineNumber;
			LinePosition = linePosition;
		}

		internal static JsonReaderException Create(JsonReader reader, string message)
		{
			return Create(reader, message, null);
		}

		internal static JsonReaderException Create(JsonReader reader, string message, Exception? ex)
		{
			return Create(reader as IJsonLineInfo, reader.Path, message, ex);
		}

		internal static JsonReaderException Create(IJsonLineInfo? lineInfo, string path, string message, Exception? ex)
		{
			message = JsonPosition.FormatMessage(lineInfo, path, message);
			int lineNumber;
			int linePosition;
			if (lineInfo != null && lineInfo.HasLineInfo())
			{
				lineNumber = lineInfo.LineNumber;
				linePosition = lineInfo.LinePosition;
			}
			else
			{
				lineNumber = 0;
				linePosition = 0;
			}
			return new JsonReaderException(message, path, lineNumber, linePosition, ex);
		}
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false)]
	public sealed class JsonRequiredAttribute : Attribute
	{
	}
	[Serializable]
	public class JsonSerializationException : JsonException
	{
		public int LineNumber { get; }

		public int LinePosition { get; }

		public string? Path { get; }

		public JsonSerializationException()
		{
		}

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

		public JsonSerializationException(string message, Exception innerException)
			: base(message, innerException)
		{
		}

		public JsonSerializationException(SerializationInfo info, StreamingContext context)
			: base(info, context)
		{
		}

		public JsonSerializationException(string message, string path, int lineNumber, int linePosition, Exception? innerException)
			: base(message, innerException)
		{
			Path = path;
			LineNumber = lineNumber;
			LinePosition = linePosition;
		}

		internal static JsonSerializationException Create(JsonReader reader, string message)
		{
			return Create(reader, message, null);
		}

		internal static JsonSerializationException Create(JsonReader reader, string message, Exception? ex)
		{
			return Create(reader as IJsonLineInfo, reader.Path, message, ex);
		}

		internal static JsonSerializationException Create(IJsonLineInfo? lineInfo, string path, string message, Exception? ex)
		{
			message = JsonPosition.FormatMessage(lineInfo, path, message);
			int lineNumber;
			int linePosition;
			if (lineInfo != null && lineInfo.HasLineInfo())
			{
				lineNumber = lineInfo.LineNumber;
				linePosition = lineInfo.LinePosition;
			}
			else
			{
				lineNumber = 0;
				linePosition = 0;
			}
			return new JsonSerializationException(message, path, lineNumber, linePosition, ex);
		}
	}
	public class JsonSerializer
	{
		internal TypeNameHandling _typeNameHandling;

		internal TypeNameAssemblyFormatHandling _typeNameAssemblyFormatHandling;

		internal PreserveReferencesHandling _preserveReferencesHandling;

		internal ReferenceLoopHandling _referenceLoopHandling;

		internal MissingMemberHandling _missingMemberHandling;

		internal ObjectCreationHandling _objectCreationHandling;

		internal NullValueHandling _nullValueHandling;

		internal DefaultValueHandling _defaultValueHandling;

		internal ConstructorHandling _constructorHandling;

		internal MetadataPropertyHandling _metadataPropertyHandling;

		internal JsonConverterCollection? _converters;

		internal IContractResolver _contractResolver;

		internal ITraceWriter? _traceWriter;

		internal IEqualityComparer? _equalityComparer;

		internal ISerializationBinder _serializationBinder;

		internal StreamingContext _context;

		private IReferenceResolver? _referenceResolver;

		private Formatting? _formatting;

		private DateFormatHandling? _dateFormatHandling;

		private DateTimeZoneHandling? _dateTimeZoneHandling;

		private DateParseHandling? _dateParseHandling;

		private FloatFormatHandling? _floatFormatHandling;

		private FloatParseHandling? _floatParseHandling;

		private StringEscapeHandling? _stringEscapeHandling;

		private CultureInfo _culture;

		private int? _maxDepth;

		private bool _maxDepthSet;

		private bool? _checkAdditionalContent;

		private string? _dateFormatString;

		private bool _dateFormatStringSet;

		public virtual IReferenceResolver? ReferenceResolver
		{
			get
			{
				return GetReferenceResolver();
			}
			set
			{
				if (value == null)
				{
					throw new ArgumentNullException("value", "Reference resolver cannot be null.");
				}
				_referenceResolver = value;
			}
		}

		[Obsolete("Binder is obsolete. Use SerializationBinder instead.")]
		public virtual SerializationBinder Binder
		{
			get
			{
				if (_serializationBinder is SerializationBinder result)
				{
					return result;
				}
				if (_serializationBinder is SerializationBinderAdapter serializationBinderAdapter)
				{
					return serializationBinderAdapter.SerializationBinder;
				}
				throw new InvalidOperationException("Cannot get SerializationBinder because an ISerializationBinder was previously set.");
			}
			set
			{
				if (value == null)
				{
					throw new ArgumentNullException("value", "Serialization binder cannot be null.");
				}
				_serializationBinder = (value as ISerializationBinder) ?? new SerializationBinderAdapter(value);
			}
		}

		public virtual ISerializationBinder SerializationBinder
		{
			get
			{
				return _serializationBinder;
			}
			set
			{
				if (value == null)
				{
					throw new ArgumentNullException("value", "Serialization binder cannot be null.");
				}
				_serializationBinder = value;
			}
		}

		public virtual ITraceWriter? TraceWriter
		{
			get
			{
				return _traceWriter;
			}
			set
			{
				_traceWriter = value;
			}
		}

		public virtual IEqualityComparer? EqualityComparer
		{
			get
			{
				return _equalityComparer;
			}
			set
			{
				_equalityComparer = value;
			}
		}

		public virtual TypeNameHandling TypeNameHandling
		{
			get
			{
				return _typeNameHandling;
			}
			set
			{
				if (value < TypeNameHandling.None || value > TypeNameHandling.Auto)
				{
					throw new ArgumentOutOfRangeException("value");
				}
				_typeNameHandling = value;
			}
		}

		[Obsolete("TypeNameAssemblyFormat is obsolete. Use TypeNameAssemblyFormatHandling instead.")]
		public virtual FormatterAssemblyStyle TypeNameAssemblyFormat
		{
			get
			{
				return (FormatterAssemblyStyle)_typeNameAssemblyFormatHandling;
			}
			set
			{
				if (value < FormatterAssemblyStyle.Simple || value > FormatterAssemblyStyle.Full)
				{
					throw new ArgumentOutOfRangeException("value");
				}
				_typeNameAssemblyFormatHandling = (TypeNameAssemblyFormatHandling)value;
			}
		}

		public virtual TypeNameAssemblyFormatHandling TypeNameAssemblyFormatHandling
		{
			get
			{
				return _typeNameAssemblyFormatHandling;
			}
			set
			{
				if (value < TypeNameAssemblyFormatHandling.Simple || value > TypeNameAssemblyFormatHandling.Full)
				{
					throw new ArgumentOutOfRangeException("value");
				}
				_typeNameAssemblyFormatHandling = value;
			}
		}

		public virtual PreserveReferencesHandling PreserveReferencesHandling
		{
			get
			{
				return _preserveReferencesHandling;
			}
			set
			{
				if (value < PreserveReferencesHandling.None || value > PreserveReferencesHandling.All)
				{
					throw new ArgumentOutOfRangeException("value");
				}
				_preserveReferencesHandling = value;
			}
		}

		public virtual ReferenceLoopHandling ReferenceLoopHandling
		{
			get
			{
				return _referenceLoopHandling;
			}
			set
			{
				if (value < ReferenceLoopHandling.Error || value > ReferenceLoopHandling.Serialize)
				{
					throw new ArgumentOutOfRangeException("value");
				}
				_referenceLoopHandling = value;
			}
		}

		public virtual MissingMemberHandling MissingMemberHandling
		{
			get
			{
				return _missingMemberHandling;
			}
			set
			{
				if (value < MissingMemberHandling.Ignore || value > MissingMemberHandling.Error)
				{
					throw new ArgumentOutOfRangeException("value");
				}
				_missingMemberHandling = value;
			}
		}

		public virtual NullValueHandling NullValueHandling
		{
			get
			{
				return _nullValueHandling;
			}
			set
			{
				if (value < NullValueHandling.Include || value > NullValueHandling.Ignore)
				{
					throw new ArgumentOutOfRangeException("value");
				}
				_nullValueHandling = value;
			}
		}

		public virtual DefaultValueHandling DefaultValueHandling
		{
			get
			{
				return _defaultValueHandling;
			}
			set
			{
				if (value < DefaultValueHandling.Include || value > DefaultValueHandling.IgnoreAndPopulate)
				{
					throw new ArgumentOutOfRangeException("value");
				}
				_defaultValueHandling = value;
			}
		}

		public virtual ObjectCreationHandling ObjectCreationHandling
		{
			get
			{
				return _objectCreationHandling;
			}
			set
			{
				if (value < ObjectCreationHandling.Auto || value > ObjectCreationHandling.Replace)
				{
					throw new ArgumentOutOfRangeException("value");
				}
				_objectCreationHandling = value;
			}
		}

		public virtual ConstructorHandling ConstructorHandling
		{
			get
			{
				return _constructorHandling;
			}
			set
			{
				if (value < ConstructorHandling.Default || value > ConstructorHandling.AllowNonPublicDefaultConstructor)
				{
					throw new ArgumentOutOfRangeException("value");
				}
				_constructorHandling = value;
			}
		}

		public virtual MetadataPropertyHandling MetadataPropertyHandling
		{
			get
			{
				return _metadataPropertyHandling;
			}
			set
			{
				if (value < MetadataPropertyHandling.Default || value > MetadataPropertyHandling.Ignore)
				{
					throw new ArgumentOutOfRangeException("value");
				}
				_metadataPropertyHandling = value;
			}
		}

		public virtual JsonConverterCollection Converters
		{
			get
			{
				if (_converters == null)
				{
					_converters = new JsonConverterCollection();
				}
				return _converters;
			}
		}

		public virtual IContractResolver ContractResolver
		{
			get
			{
				return _contractResolver;
			}
			set
			{
				_contractResolver = value ?? DefaultContractResolver.Instance;
			}
		}

		public virtual StreamingContext Context
		{
			get
			{
				return _context;
			}
			set
			{
				_context = value;
			}
		}

		public virtual Formatting Formatting
		{
			get
			{
				return _formatting.GetValueOrDefault();
			}
			set
			{
				_formatting = value;
			}
		}

		public virtual DateFormatHandling DateFormatHandling
		{
			get
			{
				return _dateFormatHandling.GetValueOrDefault();
			}
			set
			{
				_dateFormatHandling = value;
			}
		}

		public virtual DateTimeZoneHandling DateTimeZoneHandling
		{
			get
			{
				return _dateTimeZoneHandling ?? DateTimeZoneHandling.RoundtripKind;
			}
			set
			{
				_dateTimeZoneHandling = value;
			}
		}

		public virtual DateParseHandling DateParseHandling
		{
			get
			{
				return _dateParseHandling ?? DateParseHandling.DateTime;
			}
			set
			{
				_dateParseHandling = value;
			}
		}

		public virtual FloatParseHandling FloatParseHandling
		{
			get
			{
				return _floatParseHandling.GetValueOrDefault();
			}
			set
			{
				_floatParseHandling = value;
			}
		}

		public virtual FloatFormatHandling FloatFormatHandling
		{
			get
			{
				return _floatFormatHandling.GetValueOrDefault();
			}
			set
			{
				_floatFormatHandling = value;
			}
		}

		public virtual StringEscapeHandling StringEscapeHandling
		{
			get
			{
				return _stringEscapeHandling.GetValueOrDefault();
			}
			set
			{
				_stringEscapeHandling = value;
			}
		}

		public virtual string DateFormatString
		{
			get
			{
				return _dateFormatString ?? "yyyy'-'MM'-'dd'T'HH':'mm':'ss.FFFFFFFK";
			}
			set
			{
				_dateFormatString = value;
				_dateFormatStringSet = true;
			}
		}

		public virtual CultureInfo Culture
		{
			get
			{
				return _culture ?? JsonSerializerSettings.DefaultCulture;
			}
			set
			{
				_culture = value;
			}
		}

		public virtual int? MaxDepth
		{
			get
			{
				return _maxDepth;
			}
			set
			{
				if (value <= 0)
				{
					throw new ArgumentException("Value must be positive.", "value");
				}
				_maxDepth = value;
				_maxDepthSet = true;
			}
		}

		public virtual bool CheckAdditionalContent
		{
			get
			{
				return _checkAdditionalContent.GetValueOrDefault();
			}
			set
			{
				_checkAdditionalContent = value;
			}
		}

		public virtual event EventHandler<Newtonsoft.Json.Serialization.ErrorEventArgs>? Error;

		internal bool IsCheckAdditionalContentSet()
		{
			return _checkAdditionalContent.HasValue;
		}

		public JsonSerializer()
		{
			_referenceLoopHandling = ReferenceLoopHandling.Error;
			_missingMemberHandling = MissingMemberHandling.Ignore;
			_nullValueHandling = NullValueHandling.Include;
			_defaultValueHandling = DefaultValueHandling.Include;
			_objectCreationHandling = ObjectCreationHandling.Auto;
			_preserveReferencesHandling = PreserveReferencesHandling.None;
			_constructorHandling = ConstructorHandling.Default;
			_typeNameHandling = TypeNameHandling.None;
			_metadataPropertyHandling = MetadataPropertyHandling.Default;
			_context = JsonSerializerSettings.DefaultContext;
			_serializationBinder = DefaultSerializationBinder.Instance;
			_culture = JsonSerializerSettings.DefaultCulture;
			_contractResolver = DefaultContractResolver.Instance;
		}

		public static JsonSerializer Create()
		{
			return new JsonSerializer();
		}

		public static JsonSerializer Create(JsonSerializerSettings? settings)
		{
			JsonSerializer jsonSerializer = Create();
			if (settings != null)
			{
				ApplySerializerSettings(jsonSerializer, settings);
			}
			return jsonSerializer;
		}

		public static JsonSerializer CreateDefault()
		{
			JsonSerializerSettings settings = JsonConvert.DefaultSettings?.Invoke();
			return Create(settings);
		}

		public static JsonSerializer CreateDefault(JsonSerializerSettings? settings)
		{
			JsonSerializer jsonSerializer = CreateDefault();
			if (settings != null)
			{
				ApplySerializerSettings(jsonSerializer, settings);
			}
			return jsonSerializer;
		}

		private static void ApplySerializerSettings(JsonSerializer serializer, JsonSerializerSettings settings)
		{
			if (!CollectionUtils.IsNullOrEmpty(settings.Converters))
			{
				for (int i = 0; i < settings.Converters.Count; i++)
				{
					serializer.Converters.Insert(i, settings.Converters[i]);
				}
			}
			if (settings._typeNameHandling.HasValue)
			{
				serializer.TypeNameHandling = settings.TypeNameHandling;
			}
			if (settings._metadataPropertyHandling.HasValue)
			{
				serializer.MetadataPropertyHandling = settings.MetadataPropertyHandling;
			}
			if (settings._typeNameAssemblyFormatHandling.HasValue)
			{
				serializer.TypeNameAssemblyFormatHandling = settings.TypeNameAssemblyFormatHandling;
			}
			if (settings._preserveReferencesHandling.HasValue)
			{
				serializer.PreserveReferencesHandling = settings.PreserveReferencesHandling;
			}
			if (settings._referenceLoopHandling.HasValue)
			{
				serializer.ReferenceLoopHandling = settings.ReferenceLoopHandling;
			}
			if (settings._missingMemberHandling.HasValue)
			{
				serializer.MissingMemberHandling = settings.MissingMemberHandling;
			}
			if (settings._objectCreationHandling.HasValue)
			{
				serializer.ObjectCreationHandling = settings.ObjectCreationHandling;
			}
			if (settings._nullValueHandling.HasValue)
			{
				serializer.NullValueHandling = settings.NullValueHandling;
			}
			if (settings._defaultValueHandling.HasValue)
			{
				serializer.DefaultValueHandling = settings.DefaultValueHandling;
			}
			if (settings._constructorHandling.HasValue)
			{
				serializer.ConstructorHandling = settings.ConstructorHandling;
			}
			if (settings._context.HasValue)
			{
				serializer.Context = settings.Context;
			}
			if (settings._checkAdditionalContent.HasValue)
			{
				serializer._checkAdditionalContent = settings._checkAdditionalContent;
			}
			if (settings.Error != null)
			{
				serializer.Error += settings.Error;
			}
			if (settings.ContractResolver != null)
			{
				serializer.ContractResolver = settings.ContractResolver;
			}
			if (settings.ReferenceResolverProvider != null)
			{
				serializer.ReferenceResolver = settings.ReferenceResolverProvider();
			}
			if (settings.TraceWriter != null)
			{
				serializer.TraceWriter = settings.TraceWriter;
			}
			if (settings.EqualityComparer != null)
			{
				serializer.EqualityComparer = settings.EqualityComparer;
			}
			if (settings.SerializationBinder != null)
			{
				serializer.SerializationBinder = settings.SerializationBinder;
			}
			if (settings._formatting.HasValue)
			{
				serializer._formatting = settings._formatting;
			}
			if (settings._dateFormatHandling.HasValue)
			{
				serializer._dateFormatHandling = settings._dateFormatHandling;
			}
			if (settings._dateTimeZoneHandling.HasValue)
			{
				serializer._dateTimeZoneHandling = settings._dateTimeZoneHandling;
			}
			if (settings._dateParseHandling.HasValue)
			{
				serializer._dateParseHandling = settings._dateParseHandling;
			}
			if (settings._dateFormatStringSet)
			{
				serializer._dateFormatString = settings._dateFormatString;
				serializer._dateFormatStringSet = settings._dateFormatStringSet;
			}
			if (settings._floatFormatHandling.HasValue)
			{
				serializer._floatFormatHandling = settings._floatFormatHandling;
			}
			if (settings._floatParseHandling.HasValue)
			{
				serializer._floatParseHandling = settings._floatParseHandling;
			}
			if (settings._stringEscapeHandling.HasValue)
			{
				serializer._stringEscapeHandling = settings._stringEscapeHandling;
			}
			if (settings._culture != null)
			{
				serializer._culture = settings._culture;
			}
			if (settings._maxDepthSet)
			{
				serializer._maxDepth = settings._maxDepth;
				serializer._maxDepthSet = settings._maxDepthSet;
			}
		}

		[DebuggerStepThrough]
		public void Populate(TextReader reader, object target)
		{
			Populate(new JsonTextReader(reader), target);
		}

		[DebuggerStepThrough]
		public void Populate(JsonReader reader, object target)
		{
			PopulateInternal(reader, target);
		}

		internal virtual void PopulateInternal(JsonReader reader, object target)
		{
			ValidationUtils.ArgumentNotNull(reader, "reader");
			ValidationUtils.ArgumentNotNull(target, "target");
			SetupReader(reader, out CultureInfo previousCulture, out DateTimeZoneHandling? previousDateTimeZoneHandling, out DateParseHandling? previousDateParseHandling, out FloatParseHandling? previousFloatParseHandling, out int? previousMaxDepth, out string previousDateFormatString);
			TraceJsonReader traceJsonReader = ((TraceWriter != null && TraceWriter.LevelFilter >= TraceLevel.Verbose) ? CreateTraceJsonReader(reader) : null);
			JsonSerializerInternalReader jsonSerializerInternalReader = new JsonSerializerInternalReader(this);
			jsonSerializerInternalReader.Populate(traceJsonReader ?? reader, target);
			if (traceJsonReader != null)
			{
				TraceWriter.Trace(TraceLevel.Verbose, traceJsonReader.GetDeserializedJsonMessage(), null);
			}
			ResetReader(reader, previousCulture, previousDateTimeZoneHandling, previousDateParseHandling, previousFloatParseHandling, previousMaxDepth, previousDateFormatString);
		}

		[DebuggerStepThrough]
		public object? Deserialize(JsonReader reader)
		{
			return Deserialize(reader, null);
		}

		[DebuggerStepThrough]
		public object? Deserialize(TextReader reader, Type objectType)
		{
			return Deserialize(new JsonTextReader(reader), objectType);
		}

		[DebuggerStepThrough]
		public T? Deserialize<T>(JsonReader reader)
		{
			return (T)Deserialize(reader, typeof(T));
		}

		[DebuggerStepThrough]
		public object? Deserialize(JsonReader reader, Type? objectType)
		{
			return DeserializeInternal(reader, objectType);
		}

		internal virtual object? DeserializeInternal(JsonReader reader, Type? objectType)
		{
			ValidationUtils.ArgumentNotNull(reader, "reader");
			SetupReader(reader, out CultureInfo previousCulture, out DateTimeZoneHandling? previousDateTimeZoneHandling, out DateParseHandling? previousDateParseHandling, out FloatParseHandling? previousFloatParseHandling, out int? previousMaxDepth, out string previousDateFormatString);
			TraceJsonReader traceJsonReader = ((TraceWriter != null && TraceWriter.LevelFilter >= TraceLevel.Verbose) ? CreateTraceJsonReader(reader) : null);
			JsonSerializerInternalReader jsonSerializerInternalReader = new JsonSerializerInternalReader(this);
			object result = jsonSerializerInternalReader.Deserialize(traceJsonReader ?? reader, objectType, CheckAdditionalContent);
			if (traceJsonReader != null)
			{
				TraceWriter.Trace(TraceLevel.Verbose, traceJsonReader.GetDeserializedJsonMessage(), null);
			}
			ResetReader(reader, previousCulture, previousDateTimeZoneHandling, previousDateParseHandling, previousFloatParseHandling, previousMaxDepth, previousDateFormatString);
			return result;
		}

		internal void SetupReader(JsonReader reader, out CultureInfo? previousCulture, out DateTimeZoneHandling? previousDateTimeZoneHandling, out DateParseHandling? previousDateParseHandling, out FloatParseHandling? previousFloatParseHandling, out int? previousMaxDepth, out string? previousDateFormatString)
		{
			if (_culture != null && !_culture.Equals(reader.Culture))
			{
				previousCulture = reader.Culture;
				reader.Culture = _culture;
			}
			else
			{
				previousCulture = null;
			}
			if (_dateTimeZoneHandling.HasValue && reader.DateTimeZoneHandling != _dateTimeZoneHandling)
			{
				previousDateTimeZoneHandling = reader.DateTimeZoneHandling;
				reader.DateTimeZoneHandling = _dateTimeZoneHandling.GetValueOrDefault();
			}
			else
			{
				previousDateTimeZoneHandling = null;
			}
			if (_dateParseHandling.HasValue && reader.DateParseHandling != _dateParseHandling)
			{
				previousDateParseHandling = reader.DateParseHandling;
				reader.DateParseHandling = _dateParseHandling.GetValueOrDefault();
			}
			else
			{
				previousDateParseHandling = null;
			}
			if (_floatParseHandling.HasValue && reader.FloatParseHandling != _floatParseHandling)
			{
				previousFloatParseHandling = reader.FloatParseHandling;
				reader.FloatParseHandling = _floatParseHandling.GetValueOrDefault();
			}
			else
			{
				previousFloatParseHandling = null;
			}
			if (_maxDepthSet && reader.MaxDepth != _maxDepth)
			{
				previousMaxDepth = reader.MaxDepth;
				reader.MaxDepth = _maxDepth;
			}
			else
			{
				previousMaxDepth = null;
			}
			if (_dateFormatStringSet && reader.DateFormatString != _dateFormatString)
			{
				previousDateFormatString = reader.DateFormatString;
				reader.DateFormatString = _dateFormatString;
			}
			else
			{
				previousDateFormatString = null;
			}
			if (reader is JsonTextReader jsonTextReader && jsonTextReader.PropertyNameTable == null && _contractResolver is DefaultContractResolver defaultContractResolver)
			{
				jsonTextReader.PropertyNameTable = defaultContractResolver.GetNameTable();
			}
		}

		private void ResetReader(JsonReader reader, CultureInfo? previousCulture, DateTimeZoneHandling? previousDateTimeZoneHandling, DateParseHandling? previousDateParseHandling, FloatParseHandling? previousFloatParseHandling, int? previousMaxDepth, string? previousDateFormatString)
		{
			if (previousCulture != null)
			{
				reader.Culture = previousCulture;
			}
			if (previousDateTimeZoneHandling.HasValue)
			{
				reader.DateTimeZoneHandling = previousDateTimeZoneHandling.GetValueOrDefault();
			}
			if (previousDateParseHandling.HasValue)
			{
				reader.DateParseHandling = previousDateParseHandling.GetValueOrDefault();
			}
			if (previousFloatParseHandling.HasValue)
			{
				reader.FloatParseHandling = previousFloatParseHandling.GetValueOrDefault();
			}
			if (_maxDepthSet)
			{
				reader.MaxDepth = previousMaxDepth;
			}
			if (_dateFormatStringSet)
			{
				reader.DateFormatString = previousDateFormatString;
			}
			if (reader is JsonTextReader jsonTextReader && jsonTextReader.PropertyNameTable != null && _contractResolver is DefaultContractResolver defaultContractResolver && jsonTextReader.PropertyNameTable == defaultContractResolver.GetNameTable())
			{
				jsonTextReader.PropertyNameTable = null;
			}
		}

		public void Serialize(TextWriter textWriter, object? value)
		{
			Serialize(new JsonTextWriter(textWriter), value);
		}

		public void Serialize(JsonWriter jsonWriter, object? value, Type? objectType)
		{
			SerializeInternal(jsonWriter, value, objectType);
		}

		public void Serialize(TextWriter textWriter, object? value, Type objectType)
		{
			Serialize(new JsonTextWriter(textWriter), value, objectType);
		}

		public void Serialize(JsonWriter jsonWriter, object? value)
		{
			SerializeInternal(jsonWriter, value, null);
		}

		private TraceJsonReader CreateTraceJsonReader(JsonReader reader)
		{
			TraceJsonReader traceJsonReader = new TraceJsonReader(reader);
			if (reader.TokenType != 0)
			{
				traceJsonReader.WriteCurrentToken();
			}
			return traceJsonReader;
		}

		internal virtual void SerializeInternal(JsonWriter jsonWriter, object? value, Type? objectType)
		{
			ValidationUtils.ArgumentNotNull(jsonWriter, "jsonWriter");
			Formatting? formatting = null;
			if (_formatting.HasValue && jsonWriter.Formatting != _formatting)
			{
				formatting = jsonWriter.Formatting;
				jsonWriter.Formatting = _formatting.GetValueOrDefault();
			}
			DateFormatHandling? dateFormatHandling = null;
			if (_dateFormatHandling.HasValue && jsonWriter.DateFormatHandling != _dateFormatHandling)
			{
				dateFormatHandling = jsonWriter.DateFormatHandling;
				jsonWriter.DateFormatHandling = _dateFormatHandling.GetValueOrDefault();
			}
			DateTimeZoneHandling? dateTimeZoneHandling = null;
			if (_dateTimeZoneHandling.HasValue && jsonWriter.DateTimeZoneHandling != _dateTimeZoneHandling)
			{
				dateTimeZoneHandling = jsonWriter.DateTimeZoneHandling;
				jsonWriter.DateTimeZoneHandling = _dateTimeZoneHandling.GetValueOrDefault();
			}
			FloatFormatHandling? floatFormatHandling = null;
			if (_floatFormatHandling.HasValue && jsonWriter.FloatFormatHandling != _floatFormatHandling)
			{
				floatFormatHandling = jsonWriter.FloatFormatHandling;
				jsonWriter.FloatFormatHandling = _floatFormatHandling.GetValueOrDefault();
			}
			StringEscapeHandling? stringEscapeHandling = null;
			if (_stringEscapeHandling.HasValue && jsonWriter.StringEscapeHandling != _stringEscapeHandling)
			{
				stringEscapeHandling = jsonWriter.StringEscapeHandling;
				jsonWriter.StringEscapeHandling = _stringEscapeHandling.GetValueOrDefault();
			}
			CultureInfo cultureInfo = null;
			if (_culture != null && !_culture.Equals(jsonWriter.Culture))
			{
				cultureInfo = jsonWriter.Culture;
				jsonWriter.Culture = _culture;
			}
			string dateFormatString = null;
			if (_dateFormatStringSet && jsonWriter.DateFormatString != _dateFormatString)
			{
				dateFormatString = jsonWriter.DateFormatString;
				jsonWriter.DateFormatString = _dateFormatString;
			}
			TraceJsonWriter traceJsonWriter = ((TraceWriter != null && TraceWriter.LevelFilter >= TraceLevel.Verbose) ? new TraceJsonWriter(jsonWriter) : null);
			JsonSerializerInternalWriter jsonSerializerInternalWriter = new JsonSerializerInternalWriter(this);
			jsonSerializerInternalWriter.Serialize(traceJsonWriter ?? jsonWriter, value, objectType);
			if (traceJsonWriter != null)
			{
				TraceWriter.Trace(TraceLevel.Verbose, traceJsonWriter.GetSerializedJsonMessage(), null);
			}
			if (formatting.HasValue)
			{
				jsonWriter.Formatting = formatting.GetValueOrDefault();
			}
			if (dateFormatHandling.HasValue)
			{
				jsonWriter.DateFormatHandling = dateFormatHandling.GetValueOrDefault();
			}
			if (dateTimeZoneHandling.HasValue)
			{
				jsonWriter.DateTimeZoneHandling = dateTimeZoneHandling.GetValueOrDefault();
			}
			if (floatFormatHandling.HasValue)
			{
				jsonWriter.FloatFormatHandling = floatFormatHandling.GetValueOrDefault();
			}
			if (stringEscapeHandling.HasValue)
			{
				jsonWriter.StringEscapeHandling = stringEscapeHandling.GetValueOrDefault();
			}
			if (_dateFormatStringSet)
			{
				jsonWriter.DateFormatString = dateFormatString;
			}
			if (cultureInfo != null)
			{
				jsonWriter.Culture = cultureInfo;
			}
		}

		internal IReferenceResolver GetReferenceResolver()
		{
			if (_referenceResolver == null)
			{
				_referenceResolver = new DefaultReferenceResolver();
			}
			return _referenceResolver;
		}

		internal JsonConverter? GetMatchingConverter(Type type)
		{
			return GetMatchingConverter(_converters, type);
		}

		internal static JsonConverter? GetMatchingConverter(IList<JsonConverter>? converters, Type objectType)
		{
			ValidationUtils.ArgumentNotNull(objectType, "objectType");
			if (converters != null)
			{
				for (int i = 0; i < converters.Count; i++)
				{
					JsonConverter jsonConverter = converters[i];
					if (jsonConverter.CanConvert(objectType))
					{
						return jsonConverter;
					}
				}
			}
			return null;
		}

		internal void OnError(Newtonsoft.Json.Serialization.ErrorEventArgs e)
		{
			this.Error?.Invoke(this, e);
		}
	}
	public class JsonSerializerSettings
	{
		internal const ReferenceLoopHandling DefaultReferenceLoopHandling = ReferenceLoopHandling.Error;

		internal const MissingMemberHandling DefaultMissingMemberHandling = MissingMemberHandling.Ignore;

		internal const NullValueHandling DefaultNullValueHandling = NullValueHandling.Include;

		internal const DefaultValueHandling DefaultDefaultValueHandling = DefaultValueHandling.Include;

		internal const ObjectCreationHandling DefaultObjectCreationHandling = ObjectCreationHandling.Auto;

		internal const PreserveReferencesHandling DefaultPreserveReferencesHandling = PreserveReferencesHandling.None;

		internal const ConstructorHandling DefaultConstructorHandling = ConstructorHandling.Default;

		internal const TypeNameHandling DefaultTypeNameHandling = TypeNameHandling.None;

		internal const MetadataPropertyHandling DefaultMetadataPropertyHandling = MetadataPropertyHandling.Default;

		internal static readonly StreamingContext DefaultContext;

		internal const Formatting DefaultFormatting = Formatting.None;

		internal const DateFormatHandling DefaultDateFormatHandling = DateFormatHandling.IsoDateFormat;

		internal const DateTimeZoneHandling DefaultDateTimeZoneHandling = DateTimeZoneHandling.RoundtripKind;

		internal const DateParseHandling DefaultDateParseHandling = DateParseHandling.DateTime;

		internal const FloatParseHandling DefaultFloatParseHandling = FloatParseHandling.Double;

		internal const FloatFormatHandling DefaultFloatFormatHandling = FloatFormatHandling.String;

		internal const StringEscapeHandling DefaultStringEscapeHandling = StringEscapeHandling.Default;

		internal const TypeNameAssemblyFormatHandling DefaultTypeNameAssemblyFormatHandling = TypeNameAssemblyFormatHandling.Simple;

		internal static readonly CultureInfo DefaultCulture;

		internal const bool DefaultCheckAdditionalContent = false;

		internal const string DefaultDateFormatString = "yyyy'-'MM'-'dd'T'HH':'mm':'ss.FFFFFFFK";

		internal const int DefaultMaxDepth = 64;

		internal Formatting? _formatting;

		internal DateFormatHandling? _dateFormatHandling;

		internal DateTimeZoneHandling? _dateTimeZoneHandling;

		internal DateParseHandling? _dateParseHandling;

		internal FloatFormatHandling? _floatFormatHandling;

		internal FloatParseHandling? _floatParseHandling;

		internal StringEscapeHandling? _stringEscapeHandling;

		internal CultureInfo? _culture;

		internal bool? _checkAdditionalContent;

		internal int? _maxDepth;

		internal bool _maxDepthSet;

		internal string? _dateFormatString;

		internal bool _dateFormatStringSet;

		internal TypeNameAssemblyFormatHandling? _typeNameAssemblyFormatHandling;

		internal DefaultValueHandling? _defaultValueHandling;

		internal PreserveReferencesHandling? _preserveReferencesHandling;

		internal NullValueHandling? _nullValueHandling;

		internal ObjectCreationHandling? _objectCreationHandling;

		internal MissingMemberHandling? _missingMemberHandling;

		internal ReferenceLoopHandling? _referenceLoopHandling;

		internal StreamingContext? _context;

		internal ConstructorHandling? _constructorHandling;

		internal TypeNameHandling? _typeNameHandling;

		internal MetadataPropertyHandling? _metadataPropertyHandling;

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

		public MissingMemberHandling MissingMemberHandling
		{
			get
			{
				return _missingMemberHandling.GetValueOrDefault();
			}
			set
			{
				_missingMemberHandling = value;
			}
		}

		public ObjectCreationHandling ObjectCreationHandling
		{
			get
			{
				return _objectCreationHandling.GetValueOrDefault();
			}
			set
			{
				_objectCreationHandling = value;
			}
		}

		public NullValueHandling NullValueHandling
		{
			get
			{
				return _nullValueHandling.GetValueOrDefault();
			}
			set
			{
				_nullValueHandling = value;
			}
		}

		public DefaultValueHandling DefaultValueHandling
		{
			get
			{
				return _defaultValueHandling.GetValueOrDefault();
			}
			set
			{
				_defaultValueHandling = value;
			}
		}

		public IList<JsonConverter> Converters { get; set; }

		public PreserveReferencesHandling PreserveReferencesHandling
		{
			get
			{
				return _preserveReferencesHandling.GetValueOrDefault();
			}
			set
			{
				_preserveReferencesHandling = value;
			}
		}

		public TypeNameHandling TypeName

BepInEx/plugins/BendyAndTheArchipelagoMachine/System.Security.Permissions.dll

Decompiled 3 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Data.Common;
using System.Diagnostics;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Runtime.Versioning;
using System.Security;
using System.Security.AccessControl;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
using System.Security.Permissions;
using System.Security.Policy;
using System.Security.Principal;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using FxResources.System.Security.Permissions;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(/*Could not decode attribute arguments.*/)]
[assembly: TargetFramework(".NETCoreApp,Version=v10.0", FrameworkDisplayName = ".NET 10.0")]
[assembly: AssemblyMetadata("Serviceable", "True")]
[assembly: AssemblyMetadata("PreferInbox", "True")]
[assembly: AssemblyDefaultAlias("System.Security.Permissions")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: CLSCompliant(true)]
[assembly: AssemblyMetadata("IsTrimmable", "True")]
[assembly: AssemblyMetadata("IsAotCompatible", "True")]
[assembly: DefaultDllImportSearchPaths(/*Could not decode attribute arguments.*/)]
[assembly: AssemblyCompany("Microsoft Corporation")]
[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")]
[assembly: AssemblyDescription("Provides types supporting Code Access Security (CAS).")]
[assembly: AssemblyFileVersion("10.0.1126.37416")]
[assembly: AssemblyInformationalVersion("10.0.11+e2f47b0110ed922f21a1522da67279133ce28f32")]
[assembly: AssemblyProduct("Microsoft® .NET")]
[assembly: AssemblyTitle("System.Security.Permissions")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/dotnet/dotnet")]
[assembly: AssemblyVersion("10.0.0.0")]
[assembly: TypeForwardedTo(typeof(IPermission))]
[assembly: TypeForwardedTo(typeof(ISecurityEncodable))]
[assembly: TypeForwardedTo(typeof(IStackWalk))]
[assembly: TypeForwardedTo(typeof(CodeAccessSecurityAttribute))]
[assembly: TypeForwardedTo(typeof(PermissionState))]
[assembly: TypeForwardedTo(typeof(SecurityAction))]
[assembly: TypeForwardedTo(typeof(SecurityAttribute))]
[assembly: TypeForwardedTo(typeof(SecurityPermissionAttribute))]
[assembly: TypeForwardedTo(typeof(SecurityPermissionFlag))]
[assembly: TypeForwardedTo(typeof(PermissionSet))]
[assembly: TypeForwardedTo(typeof(Evidence))]
[assembly: TypeForwardedTo(typeof(EvidenceBase))]
[assembly: TypeForwardedTo(typeof(SecurityElement))]
[module: RefSafetyRules(11)]
[module: NullablePublicOnly(false)]
namespace FxResources.System.Security.Permissions
{
	internal static class SR
	{
	}
}
namespace System
{
	public sealed class ApplicationIdentity : ISerializable
	{
		public string FullName => null;

		public string CodeBase => null;

		private ApplicationIdentity()
		{
		}

		public ApplicationIdentity(string applicationIdentityFullName)
		{
		}

		public override string ToString()
		{
			return null;
		}

		void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			throw new PlatformNotSupportedException();
		}
	}
	internal static class Obsoletions
	{
		internal const string SharedUrlFormat = "https://aka.ms/dotnet-warnings/{0}";

		internal const string SystemTextEncodingUTF7Message = "The UTF-7 encoding is insecure and should not be used. Consider using UTF-8 instead.";

		internal const string SystemTextEncodingUTF7DiagId = "SYSLIB0001";

		internal const string PrincipalPermissionAttributeMessage = "PrincipalPermissionAttribute is not honored by the runtime and must not be used.";

		internal const string PrincipalPermissionAttributeDiagId = "SYSLIB0002";

		internal const string CodeAccessSecurityMessage = "Code Access Security is not supported or honored by the runtime.";

		internal const string CodeAccessSecurityDiagId = "SYSLIB0003";

		internal const string ConstrainedExecutionRegionMessage = "The Constrained Execution Region (CER) feature is not supported.";

		internal const string ConstrainedExecutionRegionDiagId = "SYSLIB0004";

		internal const string GlobalAssemblyCacheMessage = "The Global Assembly Cache is not supported.";

		internal const string GlobalAssemblyCacheDiagId = "SYSLIB0005";

		internal const string ThreadAbortMessage = "Thread.Abort is not supported and throws PlatformNotSupportedException.";

		internal const string ThreadResetAbortMessage = "Thread.ResetAbort is not supported and throws PlatformNotSupportedException.";

		internal const string ThreadAbortDiagId = "SYSLIB0006";

		internal const string DefaultCryptoAlgorithmsMessage = "The default implementation of this cryptography algorithm is not supported.";

		internal const string DefaultCryptoAlgorithmsDiagId = "SYSLIB0007";

		internal const string CreatePdbGeneratorMessage = "The CreatePdbGenerator API is not supported and throws PlatformNotSupportedException.";

		internal const string CreatePdbGeneratorDiagId = "SYSLIB0008";

		internal const string AuthenticationManagerMessage = "AuthenticationManager is not supported. Methods will no-op or throw PlatformNotSupportedException.";

		internal const string AuthenticationManagerDiagId = "SYSLIB0009";

		internal const string RemotingApisMessage = "This Remoting API is not supported and throws PlatformNotSupportedException.";

		internal const string RemotingApisDiagId = "SYSLIB0010";

		internal const string BinaryFormatterMessage = "BinaryFormatter serialization is obsolete and should not be used. See https://aka.ms/binaryformatter for more information.";

		internal const string BinaryFormatterDiagId = "SYSLIB0011";

		internal const string CodeBaseMessage = "Assembly.CodeBase and Assembly.EscapedCodeBase are only included for .NET Framework compatibility. Use Assembly.Location instead.";

		internal const string CodeBaseDiagId = "SYSLIB0012";

		internal const string EscapeUriStringMessage = "Uri.EscapeUriString can corrupt the Uri string in some cases. Consider using Uri.EscapeDataString for query string components instead.";

		internal const string EscapeUriStringDiagId = "SYSLIB0013";

		internal const string WebRequestMessage = "WebRequest, HttpWebRequest, ServicePoint, and WebClient are obsolete. Use HttpClient instead.";

		internal const string WebRequestDiagId = "SYSLIB0014";

		internal const string DisablePrivateReflectionAttributeMessage = "DisablePrivateReflectionAttribute has no effect in .NET 6.0+.";

		internal const string DisablePrivateReflectionAttributeDiagId = "SYSLIB0015";

		internal const string GetContextInfoMessage = "Use the Graphics.GetContextInfo overloads that accept arguments for better performance and fewer allocations.";

		internal const string GetContextInfoDiagId = "SYSLIB0016";

		internal const string StrongNameKeyPairMessage = "Strong name signing is not supported and throws PlatformNotSupportedException.";

		internal const string StrongNameKeyPairDiagId = "SYSLIB0017";

		internal const string ReflectionOnlyLoadingMessage = "ReflectionOnly loading is not supported and throws PlatformNotSupportedException.";

		internal const string ReflectionOnlyLoadingDiagId = "SYSLIB0018";

		internal const string RuntimeEnvironmentMessage = "RuntimeEnvironment members SystemConfigurationFile, GetRuntimeInterfaceAsIntPtr, and GetRuntimeInterfaceAsObject are not supported and throw PlatformNotSupportedException.";

		internal const string RuntimeEnvironmentDiagId = "SYSLIB0019";

		internal const string JsonSerializerOptionsIgnoreNullValuesMessage = "JsonSerializerOptions.IgnoreNullValues is obsolete. To ignore null values when serializing, set DefaultIgnoreCondition to JsonIgnoreCondition.WhenWritingNull.";

		internal const string JsonSerializerOptionsIgnoreNullValuesDiagId = "SYSLIB0020";

		internal const string DerivedCryptographicTypesMessage = "Derived cryptographic types are obsolete. Use the Create method on the base type instead.";

		internal const string DerivedCryptographicTypesDiagId = "SYSLIB0021";

		internal const string RijndaelMessage = "The Rijndael and RijndaelManaged types are obsolete. Use Aes instead.";

		internal const string RijndaelDiagId = "SYSLIB0022";

		internal const string RNGCryptoServiceProviderMessage = "RNGCryptoServiceProvider is obsolete. To generate a random number, use one of the RandomNumberGenerator static methods instead.";

		internal const string RNGCryptoServiceProviderDiagId = "SYSLIB0023";

		internal const string AppDomainCreateUnloadMessage = "Creating and unloading AppDomains is not supported and throws an exception.";

		internal const string AppDomainCreateUnloadDiagId = "SYSLIB0024";

		internal const string SuppressIldasmAttributeMessage = "SuppressIldasmAttribute has no effect in .NET 6.0+.";

		internal const string SuppressIldasmAttributeDiagId = "SYSLIB0025";

		internal const string X509CertificateImmutableMessage = "X509Certificate and X509Certificate2 are immutable. Use X509CertificateLoader to create a new certificate.";

		internal const string X509CertificateImmutableDiagId = "SYSLIB0026";

		internal const string PublicKeyPropertyMessage = "PublicKey.Key is obsolete. Use the appropriate method to get the public key, such as GetRSAPublicKey.";

		internal const string PublicKeyPropertyDiagId = "SYSLIB0027";

		internal const string X509CertificatePrivateKeyMessage = "X509Certificate2.PrivateKey is obsolete. Use the appropriate method to get the private key, such as GetRSAPrivateKey, or use the CopyWithPrivateKey method to create a new instance with a private key.";

		internal const string X509CertificatePrivateKeyDiagId = "SYSLIB0028";

		internal const string ProduceLegacyHmacValuesMessage = "ProduceLegacyHmacValues is obsolete. Producing legacy HMAC values is not supported.";

		internal const string ProduceLegacyHmacValuesDiagId = "SYSLIB0029";

		internal const string UseManagedSha1Message = "HMACSHA1 always uses the algorithm implementation provided by the platform. Use a constructor without the useManagedSha1 parameter.";

		internal const string UseManagedSha1DiagId = "SYSLIB0030";

		internal const string CryptoConfigEncodeOIDMessage = "EncodeOID is obsolete. Use the ASN.1 functionality provided in System.Formats.Asn1.";

		internal const string CryptoConfigEncodeOIDDiagId = "SYSLIB0031";

		internal const string CorruptedStateRecoveryMessage = "Recovery from corrupted process state exceptions is not supported; HandleProcessCorruptedStateExceptionsAttribute is ignored.";

		internal const string CorruptedStateRecoveryDiagId = "SYSLIB0032";

		internal const string Rfc2898CryptDeriveKeyMessage = "Rfc2898DeriveBytes.CryptDeriveKey is obsolete and is not supported. Use PasswordDeriveBytes.CryptDeriveKey instead.";

		internal const string Rfc2898CryptDeriveKeyDiagId = "SYSLIB0033";

		internal const string CmsSignerCspParamsCtorMessage = "CmsSigner(CspParameters) is obsolete and is not supported. Use an alternative constructor instead.";

		internal const string CmsSignerCspParamsCtorDiagId = "SYSLIB0034";

		internal const string SignerInfoCounterSigMessage = "ComputeCounterSignature without specifying a CmsSigner is obsolete and is not supported. Use the overload that accepts a CmsSigner.";

		internal const string SignerInfoCounterSigDiagId = "SYSLIB0035";

		internal const string RegexCompileToAssemblyMessage = "Regex.CompileToAssembly is obsolete and not supported. Use the GeneratedRegexAttribute with the regular expression source generator instead.";

		internal const string RegexCompileToAssemblyDiagId = "SYSLIB0036";

		internal const string AssemblyNameMembersMessage = "AssemblyName members HashAlgorithm, ProcessorArchitecture, and VersionCompatibility are obsolete and not supported.";

		internal const string AssemblyNameMembersDiagId = "SYSLIB0037";

		internal const string SystemDataSerializationFormatBinaryMessage = "SerializationFormat.Binary is obsolete and should not be used. See https://aka.ms/serializationformat-binary-obsolete for more information.";

		internal const string SystemDataSerializationFormatBinaryDiagId = "SYSLIB0038";

		internal const string TlsVersion10and11Message = "TLS versions 1.0 and 1.1 have known vulnerabilities and are not recommended. Use a newer TLS version instead, or use SslProtocols.None to defer to OS defaults.";

		internal const string TlsVersion10and11DiagId = "SYSLIB0039";

		internal const string EncryptionPolicyMessage = "EncryptionPolicy.NoEncryption and AllowEncryption significantly reduce security and should not be used in production code.";

		internal const string EncryptionPolicyDiagId = "SYSLIB0040";

		internal const string EccXmlExportImportMessage = "ToXmlString and FromXmlString have no implementation for ECC types, and are obsolete. Use a standard import and export format such as ExportSubjectPublicKeyInfo or ImportSubjectPublicKeyInfo for public keys and ExportPkcs8PrivateKey or ImportPkcs8PrivateKey for private keys.";

		internal const string EccXmlExportImportDiagId = "SYSLIB0042";

		internal const string EcDhPublicKeyBlobMessage = "ECDiffieHellmanPublicKey.ToByteArray() and the associated constructor do not have a consistent and interoperable implementation on all platforms. Use ECDiffieHellmanPublicKey.ExportSubjectPublicKeyInfo() instead.";

		internal const string EcDhPublicKeyBlobDiagId = "SYSLIB0043";

		internal const string AssemblyNameCodeBaseMessage = "AssemblyName.CodeBase and AssemblyName.EscapedCodeBase are obsolete. Using them for loading an assembly is not supported.";

		internal const string AssemblyNameCodeBaseDiagId = "SYSLIB0044";

		internal const string CryptoStringFactoryMessage = "Cryptographic factory methods accepting an algorithm name are obsolete. Use the parameterless Create factory method on the algorithm type instead.";

		internal const string CryptoStringFactoryDiagId = "SYSLIB0045";

		internal const string ControlledExecutionRunMessage = "ControlledExecution.Run method may corrupt the process and should not be used in production code.";

		internal const string ControlledExecutionRunDiagId = "SYSLIB0046";

		internal const string XmlSecureResolverMessage = "XmlSecureResolver is obsolete. Use XmlResolver.ThrowingResolver instead when attempting to forbid XML external entity resolution.";

		internal const string XmlSecureResolverDiagId = "SYSLIB0047";

		internal const string RsaEncryptDecryptValueMessage = "RSA.EncryptValue and DecryptValue are not supported and throw NotSupportedException. Use RSA.Encrypt and RSA.Decrypt instead.";

		internal const string RsaEncryptDecryptDiagId = "SYSLIB0048";

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

		internal const string JsonSerializerOptionsAddContextDiagId = "SYSLIB0049";

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

		internal const string LegacyFormatterDiagId = "SYSLIB0050";

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

		internal const string LegacyFormatterImplDiagId = "SYSLIB0051";

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

		internal const string RegexExtensibilityDiagId = "SYSLIB0052";

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

		internal const string AesGcmTagConstructorDiagId = "SYSLIB0053";

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

		internal const string ThreadVolatileReadWriteDiagId = "SYSLIB0054";

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

		internal const string ArmIntrinsicPerformsUnsignedOperationDiagId = "SYSLIB0055";

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

		internal const string LoadFromHashAlgorithmDiagId = "SYSLIB0056";

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

		internal const string X509CtorCertDataObsoleteDiagId = "SYSLIB0057";

		internal const string TlsCipherAlgorithmEnumsMessage = "KeyExchangeAlgorithm, KeyExchangeStrength, CipherAlgorithm, CipherStrength, HashAlgorithm and HashStrength properties of SslStream are obsolete. Use NegotiatedCipherSuite instead.";

		internal const string TlsCipherAlgorithmEnumsDiagId = "SYSLIB0058";

		internal const string SystemEventsEventsThreadShutdownMessage = "SystemEvents.EventsThreadShutdown callbacks are not run before the process exits. Use AppDomain.ProcessExit instead.";

		internal const string SystemEventsEventsThreadShutdownDiagId = "SYSLIB0059";

		internal const string Rfc2898DeriveBytesCtorMessage = "The constructors on Rfc2898DeriveBytes are obsolete. Use the static Pbkdf2 method instead.";

		internal const string Rfc2898DeriveBytesCtorDiagId = "SYSLIB0060";

		internal const string QueryableMinByMaxByTSourceObsoleteMessage = "The Queryable MinBy and MaxBy taking an IComparer<TSource> are obsolete. Use the new ones that take an IComparer<TKey>.";

		internal const string QueryableMinByMaxByTSourceObsoleteDiagId = "SYSLIB0061";

		internal const string XsltSettingsEnableScriptMessage = "XSLT Script blocks are not supported.";

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

		private static ResourceManager s_resourceManager;

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

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

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

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

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

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

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

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

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

		private static bool GetUsingResourceKeysSwitchValue()
		{
			bool result = default(bool);
			if (!AppContext.TryGetSwitch("System.Resources.UseSystemResourceKeys", ref result))
			{
				return false;
			}
			return result;
		}

		internal static bool UsingResourceKeys()
		{
			return s_usingResourceKeys;
		}

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

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

		internal static string Format(string resourceFormat, object p1)
		{
			if (UsingResourceKeys())
			{
				<>y__InlineArray2<object> buffer = default(<>y__InlineArray2<object>);
				<PrivateImplementationDetails>.InlineArrayElementRef<<>y__InlineArray2<object>, object>(ref buffer, 0) = resourceFormat;
				<PrivateImplementationDetails>.InlineArrayElementRef<<>y__InlineArray2<object>, object>(ref buffer, 1) = p1;
				return string.Join(", ", <PrivateImplementationDetails>.InlineArrayAsReadOnlySpan<<>y__InlineArray2<object>, object>(in buffer, 2));
			}
			return string.Format(resourceFormat, p1);
		}

		internal static string Format(string resourceFormat, object p1, object p2)
		{
			if (UsingResourceKeys())
			{
				<>y__InlineArray3<object> buffer = default(<>y__InlineArray3<object>);
				<PrivateImplementationDetails>.InlineArrayElementRef<<>y__InlineArray3<object>, object>(ref buffer, 0) = resourceFormat;
				<PrivateImplementationDetails>.InlineArrayElementRef<<>y__InlineArray3<object>, object>(ref buffer, 1) = p1;
				<PrivateImplementationDetails>.InlineArrayElementRef<<>y__InlineArray3<object>, object>(ref buffer, 2) = p2;
				return string.Join(", ", <PrivateImplementationDetails>.InlineArrayAsReadOnlySpan<<>y__InlineArray3<object>, object>(in buffer, 3));
			}
			return string.Format(resourceFormat, p1, p2);
		}

		internal static string Format(string resourceFormat, object p1, object p2, object p3)
		{
			if (UsingResourceKeys())
			{
				<>y__InlineArray4<object> buffer = default(<>y__InlineArray4<object>);
				<PrivateImplementationDetails>.InlineArrayElementRef<<>y__InlineArray4<object>, object>(ref buffer, 0) = resourceFormat;
				<PrivateImplementationDetails>.InlineArrayElementRef<<>y__InlineArray4<object>, object>(ref buffer, 1) = p1;
				<PrivateImplementationDetails>.InlineArrayElementRef<<>y__InlineArray4<object>, object>(ref buffer, 2) = p2;
				<PrivateImplementationDetails>.InlineArrayElementRef<<>y__InlineArray4<object>, object>(ref buffer, 3) = p3;
				return string.Join(", ", <PrivateImplementationDetails>.InlineArrayAsReadOnlySpan<<>y__InlineArray4<object>, object>(in buffer, 4));
			}
			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())
			{
				<>y__InlineArray2<object> buffer = default(<>y__InlineArray2<object>);
				<PrivateImplementationDetails>.InlineArrayElementRef<<>y__InlineArray2<object>, object>(ref buffer, 0) = resourceFormat;
				<PrivateImplementationDetails>.InlineArrayElementRef<<>y__InlineArray2<object>, object>(ref buffer, 1) = p1;
				return string.Join(", ", <PrivateImplementationDetails>.InlineArrayAsReadOnlySpan<<>y__InlineArray2<object>, object>(in buffer, 2));
			}
			return string.Format(provider, resourceFormat, p1);
		}

		internal static string Format(IFormatProvider provider, string resourceFormat, object p1, object p2)
		{
			if (UsingResourceKeys())
			{
				<>y__InlineArray3<object> buffer = default(<>y__InlineArray3<object>);
				<PrivateImplementationDetails>.InlineArrayElementRef<<>y__InlineArray3<object>, object>(ref buffer, 0) = resourceFormat;
				<PrivateImplementationDetails>.InlineArrayElementRef<<>y__InlineArray3<object>, object>(ref buffer, 1) = p1;
				<PrivateImplementationDetails>.InlineArrayElementRef<<>y__InlineArray3<object>, object>(ref buffer, 2) = p2;
				return string.Join(", ", <PrivateImplementationDetails>.InlineArrayAsReadOnlySpan<<>y__InlineArray3<object>, object>(in buffer, 3));
			}
			return string.Format(provider, resourceFormat, p1, p2);
		}

		internal static string Format(IFormatProvider provider, string resourceFormat, object p1, object p2, object p3)
		{
			if (UsingResourceKeys())
			{
				<>y__InlineArray4<object> buffer = default(<>y__InlineArray4<object>);
				<PrivateImplementationDetails>.InlineArrayElementRef<<>y__InlineArray4<object>, object>(ref buffer, 0) = resourceFormat;
				<PrivateImplementationDetails>.InlineArrayElementRef<<>y__InlineArray4<object>, object>(ref buffer, 1) = p1;
				<PrivateImplementationDetails>.InlineArrayElementRef<<>y__InlineArray4<object>, object>(ref buffer, 2) = p2;
				<PrivateImplementationDetails>.InlineArrayElementRef<<>y__InlineArray4<object>, object>(ref buffer, 3) = p3;
				return string.Join(", ", <PrivateImplementationDetails>.InlineArrayAsReadOnlySpan<<>y__InlineArray4<object>, object>(in buffer, 4));
			}
			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.Xaml.Permissions
{
	[Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId = "SYSLIB0003", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
	public sealed class XamlLoadPermission : CodeAccessPermission, IUnrestrictedPermission
	{
		[SupportedOSPlatform("windows")]
		[field: CompilerGenerated]
		public System.Collections.Generic.IList<XamlAccessLevel> AllowedAccess
		{
			[CompilerGenerated]
			get;
		} = (System.Collections.Generic.IList<XamlAccessLevel>)new ReadOnlyCollection<XamlAccessLevel>((System.Collections.Generic.IList<XamlAccessLevel>)System.Array.Empty<XamlAccessLevel>());

		public XamlLoadPermission(PermissionState state)
		{
		}

		public XamlLoadPermission(XamlAccessLevel allowedAccess)
		{
		}

		public XamlLoadPermission(System.Collections.Generic.IEnumerable<XamlAccessLevel> allowedAccess)
		{
		}

		[ComVisible(false)]
		public override bool Equals(object obj)
		{
			return this == obj;
		}

		[ComVisible(false)]
		public override int GetHashCode()
		{
			return base.GetHashCode();
		}

		public override IPermission Copy()
		{
			return (IPermission)(object)new XamlLoadPermission((PermissionState)1);
		}

		public override void FromXml(SecurityElement elem)
		{
		}

		public bool Includes(XamlAccessLevel requestedAccess)
		{
			return true;
		}

		public override IPermission Intersect(IPermission target)
		{
			return (IPermission)(object)new XamlLoadPermission((PermissionState)1);
		}

		public override bool IsSubsetOf(IPermission target)
		{
			return true;
		}

		public override SecurityElement ToXml()
		{
			return null;
		}

		public override IPermission Union(IPermission other)
		{
			return (IPermission)(object)new XamlLoadPermission((PermissionState)1);
		}

		public bool IsUnrestricted()
		{
			return true;
		}
	}
}
namespace System.Web
{
	[Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId = "SYSLIB0003", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
	public sealed class AspNetHostingPermission : CodeAccessPermission, IUnrestrictedPermission
	{
		[field: CompilerGenerated]
		public AspNetHostingPermissionLevel Level
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}

		public AspNetHostingPermission(PermissionState state)
		{
		}

		public AspNetHostingPermission(AspNetHostingPermissionLevel level)
		{
		}

		public bool IsUnrestricted()
		{
			return false;
		}

		public override IPermission Copy()
		{
			return null;
		}

		public override IPermission Union(IPermission target)
		{
			return null;
		}

		public override IPermission Intersect(IPermission target)
		{
			return null;
		}

		public override bool IsSubsetOf(IPermission target)
		{
			return false;
		}

		public override void FromXml(SecurityElement securityElement)
		{
		}

		public override SecurityElement ToXml()
		{
			return null;
		}
	}
	[Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId = "SYSLIB0003", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
	[AttributeUsage(/*Could not decode attribute arguments.*/)]
	public sealed class AspNetHostingPermissionAttribute : CodeAccessSecurityAttribute
	{
		[field: CompilerGenerated]
		public AspNetHostingPermissionLevel Level
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}

		public AspNetHostingPermissionAttribute(SecurityAction action)
			: base(action)
		{
		}//IL_0001: Unknown result type (might be due to invalid IL or missing references)


		public override IPermission CreatePermission()
		{
			return null;
		}
	}
	public enum AspNetHostingPermissionLevel
	{
		None = 100,
		Minimal = 200,
		Low = 300,
		Medium = 400,
		High = 500,
		Unrestricted = 600
	}
}
namespace System.Transactions
{
	[Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId = "SYSLIB0003", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
	public sealed class DistributedTransactionPermission : CodeAccessPermission, IUnrestrictedPermission
	{
		public DistributedTransactionPermission(PermissionState state)
		{
		}

		public override IPermission Copy()
		{
			return null;
		}

		public override void FromXml(SecurityElement securityElement)
		{
		}

		public override IPermission Intersect(IPermission target)
		{
			return null;
		}

		public override bool IsSubsetOf(IPermission target)
		{
			return false;
		}

		public bool IsUnrestricted()
		{
			return false;
		}

		public override SecurityElement ToXml()
		{
			return null;
		}

		public override IPermission Union(IPermission target)
		{
			return null;
		}
	}
	[Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId = "SYSLIB0003", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
	[AttributeUsage(/*Could not decode attribute arguments.*/)]
	public sealed class DistributedTransactionPermissionAttribute : CodeAccessSecurityAttribute
	{
		[field: CompilerGenerated]
		public bool Unrestricted
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}

		public DistributedTransactionPermissionAttribute(SecurityAction action)
			: base(action)
		{
		}//IL_0001: Unknown result type (might be due to invalid IL or missing references)


		public override IPermission CreatePermission()
		{
			return null;
		}
	}
}
namespace System.ServiceProcess
{
	[Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId = "SYSLIB0003", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
	public sealed class ServiceControllerPermission : ResourcePermissionBase
	{
		public ServiceControllerPermissionEntryCollection PermissionEntries => null;

		public ServiceControllerPermission()
		{
		}

		public ServiceControllerPermission(PermissionState state)
			: base(state)
		{
		}//IL_0001: Unknown result type (might be due to invalid IL or missing references)


		public ServiceControllerPermission(ServiceControllerPermissionAccess permissionAccess, string machineName, string serviceName)
		{
		}

		public ServiceControllerPermission(ServiceControllerPermissionEntry[] permissionAccessEntries)
		{
		}
	}
	[Flags]
	public enum ServiceControllerPermissionAccess
	{
		None = 0,
		Browse = 2,
		Control = 6
	}
	[Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId = "SYSLIB0003", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
	[AttributeUsage(/*Could not decode attribute arguments.*/)]
	public class ServiceControllerPermissionAttribute : CodeAccessSecurityAttribute
	{
		public string MachineName
		{
			get
			{
				return null;
			}
			set
			{
			}
		}

		public ServiceControllerPermissionAccess PermissionAccess
		{
			get
			{
				return ServiceControllerPermissionAccess.None;
			}
			set
			{
			}
		}

		public string ServiceName
		{
			get
			{
				return null;
			}
			set
			{
			}
		}

		public ServiceControllerPermissionAttribute(SecurityAction action)
			: base(action)
		{
		}//IL_0001: Unknown result type (might be due to invalid IL or missing references)


		public override IPermission CreatePermission()
		{
			return null;
		}
	}
	public class ServiceControllerPermissionEntry
	{
		public string MachineName => null;

		public ServiceControllerPermissionAccess PermissionAccess => ServiceControllerPermissionAccess.None;

		public string ServiceName => null;

		public ServiceControllerPermissionEntry()
		{
		}

		public ServiceControllerPermissionEntry(ServiceControllerPermissionAccess permissionAccess, string machineName, string serviceName)
		{
		}
	}
	[DefaultMember("Item")]
	public class ServiceControllerPermissionEntryCollection : CollectionBase
	{
		public ServiceControllerPermissionEntry this[int index]
		{
			get
			{
				return null;
			}
			set
			{
			}
		}

		internal ServiceControllerPermissionEntryCollection()
		{
		}

		public int Add(ServiceControllerPermissionEntry value)
		{
			return 0;
		}

		public void AddRange(ServiceControllerPermissionEntry[] value)
		{
		}

		public void AddRange(ServiceControllerPermissionEntryCollection value)
		{
		}

		public bool Contains(ServiceControllerPermissionEntry value)
		{
			return false;
		}

		public void CopyTo(ServiceControllerPermissionEntry[] array, int index)
		{
		}

		public int IndexOf(ServiceControllerPermissionEntry value)
		{
			return 0;
		}

		public void Insert(int index, ServiceControllerPermissionEntry value)
		{
		}

		protected override void OnClear()
		{
		}

		protected override void OnInsert(int index, object value)
		{
		}

		protected override void OnRemove(int index, object value)
		{
		}

		protected override void OnSet(int index, object oldValue, object newValue)
		{
		}

		public void Remove(ServiceControllerPermissionEntry value)
		{
		}
	}
}
namespace System.Security
{
	[Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId = "SYSLIB0003", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
	public abstract class CodeAccessPermission : IPermission, ISecurityEncodable, IStackWalk
	{
		public void Assert()
		{
		}

		public abstract IPermission Copy();

		public void Demand()
		{
		}

		[Obsolete]
		public void Deny()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			throw new PlatformNotSupportedException(SR.PlatformNotSupported_CAS);
		}

		public override bool Equals(object obj)
		{
			return base.Equals(obj);
		}

		public abstract void FromXml(SecurityElement elem);

		public override int GetHashCode()
		{
			return base.GetHashCode();
		}

		public abstract IPermission Intersect(IPermission target);

		public abstract bool IsSubsetOf(IPermission target);

		public void PermitOnly()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			throw new PlatformNotSupportedException(SR.PlatformNotSupported_CAS);
		}

		public static void RevertAll()
		{
		}

		public static void RevertAssert()
		{
		}

		[Obsolete]
		public static void RevertDeny()
		{
		}

		public static void RevertPermitOnly()
		{
		}

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

		public abstract SecurityElement ToXml();

		public virtual IPermission Union(IPermission other)
		{
			return null;
		}
	}
	[Serializable]
	[Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId = "SYSLIB0003", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
	[TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
	public class HostProtectionException : SystemException
	{
		private const string ProtectedResourcesName = "ProtectedResources";

		private const string DemandedResourcesName = "DemandedResources";

		private const int E_HostProtection = -2146232768;

		[field: CompilerGenerated]
		public HostProtectionResource DemandedResources
		{
			[CompilerGenerated]
			get;
		}

		[field: CompilerGenerated]
		public HostProtectionResource ProtectedResources
		{
			[CompilerGenerated]
			get;
		}

		public HostProtectionException()
		{
			((System.Exception)this).HResult = -2146232768;
			ProtectedResources = HostProtectionResource.None;
			DemandedResources = HostProtectionResource.None;
		}

		public HostProtectionException(string message)
			: base(message)
		{
			((System.Exception)this).HResult = -2146232768;
			ProtectedResources = HostProtectionResource.None;
			DemandedResources = HostProtectionResource.None;
		}

		public HostProtectionException(string message, System.Exception e)
			: base(message, e)
		{
			((System.Exception)this).HResult = -2146232768;
			ProtectedResources = HostProtectionResource.None;
			DemandedResources = HostProtectionResource.None;
		}

		public HostProtectionException(string message, HostProtectionResource protectedResources, HostProtectionResource demandedResources)
			: base(message)
		{
			((System.Exception)this).HResult = -2146232768;
			ProtectedResources = protectedResources;
			DemandedResources = demandedResources;
		}

		[Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.", DiagnosticId = "SYSLIB0051", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
		[EditorBrowsable(/*Could not decode attribute arguments.*/)]
		protected HostProtectionException(SerializationInfo info, StreamingContext context)
			: base(info, context)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			ProtectedResources = (HostProtectionResource)info.GetValue("ProtectedResources", typeof(HostProtectionResource));
			DemandedResources = (HostProtectionResource)info.GetValue("DemandedResources", typeof(HostProtectionResource));
		}

		private static void AppendResourceString(string resourceString, object attr, StringBuilder sb)
		{
			if (attr != null)
			{
				sb.Append(Environment.NewLine);
				sb.Append(Environment.NewLine);
				sb.Append(resourceString);
				sb.Append(Environment.NewLine);
				sb.Append(attr);
			}
		}

		public override string ToString()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Expected O, but got Unknown
			StringBuilder val = new StringBuilder();
			val.Append(((System.Exception)this).ToString());
			AppendResourceString(SR.HostProtection_ProtectedResources, ProtectedResources, val);
			AppendResourceString(SR.HostProtection_DemandedResources, DemandedResources, val);
			return ((object)val).ToString();
		}

		[Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.", DiagnosticId = "SYSLIB0051", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
		[EditorBrowsable(/*Could not decode attribute arguments.*/)]
		public override void GetObjectData(SerializationInfo info, StreamingContext context)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			((System.Exception)this).GetObjectData(info, context);
			info.AddValue("ProtectedResources", (object)ProtectedResources, typeof(HostProtectionResource));
			info.AddValue("DemandedResources", (object)DemandedResources, typeof(HostProtectionResource));
		}
	}
	public class HostSecurityManager
	{
		public virtual PolicyLevel DomainPolicy => null;

		public virtual HostSecurityManagerOptions Flags => HostSecurityManagerOptions.None;

		public virtual ApplicationTrust DetermineApplicationTrust(Evidence applicationEvidence, Evidence activatorEvidence, TrustManagerContext context)
		{
			return null;
		}

		public virtual Evidence ProvideAppDomainEvidence(Evidence inputEvidence)
		{
			return null;
		}

		public virtual Evidence ProvideAssemblyEvidence(Assembly loadedAssembly, Evidence inputEvidence)
		{
			return null;
		}

		[Obsolete]
		public virtual PermissionSet ResolvePolicy(Evidence evidence)
		{
			return null;
		}

		public virtual EvidenceBase GenerateAppDomainEvidence(System.Type evidenceType)
		{
			return null;
		}

		public virtual EvidenceBase GenerateAssemblyEvidence(System.Type evidenceType, Assembly assembly)
		{
			return null;
		}

		public virtual System.Type[] GetHostSuppliedAppDomainEvidenceTypes()
		{
			return null;
		}

		public virtual System.Type[] GetHostSuppliedAssemblyEvidenceTypes(Assembly assembly)
		{
			return null;
		}
	}
	[Flags]
	public enum HostSecurityManagerOptions
	{
		AllFlags = 0x1F,
		HostAppDomainEvidence = 1,
		HostAssemblyEvidence = 4,
		HostDetermineApplicationTrust = 8,
		HostPolicyLevel = 2,
		HostResolvePolicy = 0x10,
		None = 0
	}
	public interface IEvidenceFactory
	{
		Evidence Evidence { get; }
	}
	public interface ISecurityPolicyEncodable
	{
		void FromXml(SecurityElement e, PolicyLevel level);

		SecurityElement ToXml(PolicyLevel level);
	}
	[Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId = "SYSLIB0003", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
	public sealed class NamedPermissionSet : PermissionSet
	{
		[field: CompilerGenerated]
		public string Description
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}

		[field: CompilerGenerated]
		public string Name
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}

		public NamedPermissionSet(NamedPermissionSet permSet)
			: base((PermissionState)0)
		{
		}

		public NamedPermissionSet(string name)
			: base((PermissionState)0)
		{
		}

		public NamedPermissionSet(string name, PermissionState state)
			: base((PermissionState)0)
		{
		}

		public NamedPermissionSet(string name, PermissionSet permSet)
			: base((PermissionState)0)
		{
		}

		public override PermissionSet Copy()
		{
			return null;
		}

		public NamedPermissionSet Copy(string name)
		{
			return null;
		}

		public override bool Equals(object o)
		{
			return ((PermissionSet)this).Equals(o);
		}

		public override void FromXml(SecurityElement et)
		{
		}

		public override int GetHashCode()
		{
			return ((PermissionSet)this).GetHashCode();
		}

		public override SecurityElement ToXml()
		{
			return null;
		}
	}
	public enum PolicyLevelType
	{
		AppDomain = 3,
		Enterprise = 2,
		Machine = 1,
		User = 0
	}
	[Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId = "SYSLIB0003", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
	public sealed class SecurityContext : System.IDisposable
	{
		internal SecurityContext()
		{
		}

		public static SecurityContext Capture()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			throw new PlatformNotSupportedException(SR.PlatformNotSupported_CAS);
		}

		public SecurityContext CreateCopy()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			throw new PlatformNotSupportedException(SR.PlatformNotSupported_CAS);
		}

		public void Dispose()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			throw new PlatformNotSupportedException(SR.PlatformNotSupported_CAS);
		}

		public static bool IsFlowSuppressed()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			throw new PlatformNotSupportedException(SR.PlatformNotSupported_CAS);
		}

		public static bool IsWindowsIdentityFlowSuppressed()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			throw new PlatformNotSupportedException(SR.PlatformNotSupported_CAS);
		}

		public static void RestoreFlow()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			throw new PlatformNotSupportedException(SR.PlatformNotSupported_CAS);
		}

		public static void Run(SecurityContext securityContext, ContextCallback callback, object state)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			throw new PlatformNotSupportedException(SR.PlatformNotSupported_CAS);
		}

		public static AsyncFlowControl SuppressFlow()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			throw new PlatformNotSupportedException(SR.PlatformNotSupported_CAS);
		}

		public static AsyncFlowControl SuppressFlowWindowsIdentity()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			throw new PlatformNotSupportedException(SR.PlatformNotSupported_CAS);
		}
	}
	public enum SecurityContextSource
	{
		CurrentAppDomain,
		CurrentAssembly
	}
	[Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId = "SYSLIB0003", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
	public static class SecurityManager
	{
		[Obsolete]
		[field: CompilerGenerated]
		public static bool CheckExecutionRights
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}

		[Obsolete]
		[field: CompilerGenerated]
		public static bool SecurityEnabled
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}

		public static bool CurrentThreadRequiresSecurityContextCapture()
		{
			return false;
		}

		public static PermissionSet GetStandardSandbox(Evidence evidence)
		{
			return null;
		}

		public static void GetZoneAndOrigin(out ArrayList zone, out ArrayList origin)
		{
			zone = null;
			origin = null;
		}

		[Obsolete]
		public static bool IsGranted(IPermission perm)
		{
			return false;
		}

		[Obsolete]
		public static PolicyLevel LoadPolicyLevelFromFile(string path, PolicyLevelType type)
		{
			return null;
		}

		[Obsolete]
		public static PolicyLevel LoadPolicyLevelFromString(string str, PolicyLevelType type)
		{
			return null;
		}

		[Obsolete]
		public static System.Collections.IEnumerator PolicyHierarchy()
		{
			return null;
		}

		[Obsolete]
		public static PermissionSet ResolvePolicy(Evidence evidence)
		{
			return null;
		}

		[Obsolete]
		public static PermissionSet ResolvePolicy(Evidence evidence, PermissionSet reqdPset, PermissionSet optPset, PermissionSet denyPset, out PermissionSet denied)
		{
			denied = null;
			return null;
		}

		[Obsolete]
		public static PermissionSet ResolvePolicy(Evidence[] evidences)
		{
			return null;
		}

		[Obsolete]
		public static System.Collections.IEnumerator ResolvePolicyGroups(Evidence evidence)
		{
			return null;
		}

		[Obsolete]
		public static PermissionSet ResolveSystemPolicy(Evidence evidence)
		{
			return null;
		}

		[Obsolete]
		public static void SavePolicy()
		{
		}

		[Obsolete]
		public static void SavePolicyLevel(PolicyLevel level)
		{
		}
	}
	public abstract class SecurityState
	{
		public abstract void EnsureState();

		public bool IsStateAvailable()
		{
			return false;
		}
	}
	public enum SecurityZone
	{
		Internet = 3,
		Intranet = 1,
		MyComputer = 0,
		NoZone = -1,
		Trusted = 2,
		Untrusted = 4
	}
	[Serializable]
	[TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
	public sealed class XmlSyntaxException : SystemException
	{
		public XmlSyntaxException()
		{
		}

		public XmlSyntaxException(int lineNumber)
		{
		}

		public XmlSyntaxException(int lineNumber, string message)
		{
		}

		public XmlSyntaxException(string message)
		{
		}

		public XmlSyntaxException(string message, System.Exception inner)
		{
		}

		[Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.", DiagnosticId = "SYSLIB0051", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
		private XmlSyntaxException(SerializationInfo info, StreamingContext context)
			: base(info, context)
		{
		}//IL_0002: Unknown result type (might be due to invalid IL or missing references)

	}
}
namespace System.Security.Policy
{
	public sealed class AllMembershipCondition : ISecurityEncodable, ISecurityPolicyEncodable, IMembershipCondition
	{
		public bool Check(Evidence evidence)
		{
			return false;
		}

		public IMembershipCondition Copy()
		{
			return null;
		}

		public override bool Equals(object o)
		{
			return base.Equals(o);
		}

		public void FromXml(SecurityElement e)
		{
		}

		public void FromXml(SecurityElement e, PolicyLevel level)
		{
		}

		public override int GetHashCode()
		{
			return base.GetHashCode();
		}

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

		public SecurityElement ToXml()
		{
			return null;
		}

		public SecurityElement ToXml(PolicyLevel level)
		{
			return null;
		}
	}
	public sealed class ApplicationDirectory : EvidenceBase
	{
		public string Directory => null;

		public ApplicationDirectory(string name)
		{
		}

		public object Copy()
		{
			return null;
		}

		public override bool Equals(object o)
		{
			return ((object)this).Equals(o);
		}

		public override int GetHashCode()
		{
			return ((object)this).GetHashCode();
		}

		public override string ToString()
		{
			return ((object)this).ToString();
		}
	}
	public sealed class ApplicationDirectoryMembershipCondition : ISecurityEncodable, ISecurityPolicyEncodable, IMembershipCondition
	{
		public bool Check(Evidence evidence)
		{
			return false;
		}

		public IMembershipCondition Copy()
		{
			return null;
		}

		public override bool Equals(object o)
		{
			return base.Equals(o);
		}

		public void FromXml(SecurityElement e)
		{
		}

		public void FromXml(SecurityElement e, PolicyLevel level)
		{
		}

		public override int GetHashCode()
		{
			return base.GetHashCode();
		}

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

		public SecurityElement ToXml()
		{
			return null;
		}

		public SecurityElement ToXml(PolicyLevel level)
		{
			return null;
		}
	}
	public sealed class ApplicationTrust : EvidenceBase, ISecurityEncodable
	{
		[field: CompilerGenerated]
		public ApplicationIdentity ApplicationIdentity
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}

		[field: CompilerGenerated]
		public PolicyStatement DefaultGrantSet
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}

		[field: CompilerGenerated]
		public object ExtraInfo
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}

		[Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId = "SYSLIB0003", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
		public System.Collections.Generic.IList<StrongName> FullTrustAssemblies => null;

		[field: CompilerGenerated]
		public bool IsApplicationTrustedToRun
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}

		[field: CompilerGenerated]
		public bool Persist
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}

		public ApplicationTrust()
		{
		}

		public ApplicationTrust(ApplicationIdentity identity)
		{
		}

		[Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId = "SYSLIB0003", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
		public ApplicationTrust(PermissionSet defaultGrantSet, System.Collections.Generic.IEnumerable<StrongName> fullTrustAssemblies)
		{
		}

		public void FromXml(SecurityElement element)
		{
		}

		public SecurityElement ToXml()
		{
			return null;
		}
	}
	[DefaultMember("Item")]
	public sealed class ApplicationTrustCollection : System.Collections.ICollection, System.Collections.IEnumerable
	{
		public int Count => 0;

		public bool IsSynchronized => false;

		public ApplicationTrust this[int index] => null;

		public ApplicationTrust this[string appFullName] => null;

		public object SyncRoot => null;

		internal ApplicationTrustCollection()
		{
		}

		public int Add(ApplicationTrust trust)
		{
			return 0;
		}

		public void AddRange(ApplicationTrust[] trusts)
		{
		}

		public void AddRange(ApplicationTrustCollection trusts)
		{
		}

		public void Clear()
		{
		}

		public void CopyTo(ApplicationTrust[] array, int index)
		{
		}

		public ApplicationTrustCollection Find(ApplicationIdentity applicationIdentity, ApplicationVersionMatch versionMatch)
		{
			return null;
		}

		public ApplicationTrustEnumerator GetEnumerator()
		{
			return new ApplicationTrustEnumerator();
		}

		public void Remove(ApplicationTrust trust)
		{
		}

		public void Remove(ApplicationIdentity applicationIdentity, ApplicationVersionMatch versionMatch)
		{
		}

		public void RemoveRange(ApplicationTrust[] trusts)
		{
		}

		public void RemoveRange(ApplicationTrustCollection trusts)
		{
		}

		void System.Collections.ICollection.CopyTo(System.Array array, int index)
		{
		}

		System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
		{
			return GetEnumerator();
		}
	}
	public sealed class ApplicationTrustEnumerator : System.Collections.IEnumerator
	{
		public ApplicationTrust Current => null;

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

		internal ApplicationTrustEnumerator()
		{
		}

		public bool MoveNext()
		{
			return false;
		}

		public void Reset()
		{
		}
	}
	public enum ApplicationVersionMatch
	{
		MatchAllVersions = 1,
		MatchExactVersion = 0
	}
	public class CodeConnectAccess
	{
		public static readonly string AnyScheme;

		public static readonly int DefaultPort;

		public static readonly int OriginPort;

		public static readonly string OriginScheme;

		public int Port => 0;

		public string Scheme => null;

		public CodeConnectAccess(string allowScheme, int allowPort)
		{
		}

		public static CodeConnectAccess CreateAnySchemeAccess(int allowPort)
		{
			return null;
		}

		public static CodeConnectAccess CreateOriginSchemeAccess(int allowPort)
		{
			return null;
		}

		public virtual bool Equals(object o)
		{
			return base.Equals(o);
		}

		public virtual int GetHashCode()
		{
			return base.GetHashCode();
		}
	}
	public abstract class CodeGroup
	{
		public virtual string AttributeString => null;

		[field: CompilerGenerated]
		public System.Collections.IList Children
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}

		[field: CompilerGenerated]
		public string Description
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}

		[field: CompilerGenerated]
		public IMembershipCondition MembershipCondition
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}

		public abstract string MergeLogic { get; }

		[field: CompilerGenerated]
		public string Name
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}

		public virtual string PermissionSetName => null;

		[field: CompilerGenerated]
		public PolicyStatement PolicyStatement
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}

		protected CodeGroup(IMembershipCondition membershipCondition, PolicyStatement policy)
		{
		}

		public void AddChild(CodeGroup group)
		{
		}

		public abstract CodeGroup Copy();

		protected virtual void CreateXml(SecurityElement element, PolicyLevel level)
		{
		}

		public virtual bool Equals(object o)
		{
			return base.Equals(o);
		}

		public void FromXml(SecurityElement e)
		{
		}

		public void FromXml(SecurityElement e, PolicyLevel level)
		{
		}

		public bool Equals(CodeGroup cg, bool compareChildren)
		{
			return false;
		}

		public virtual int GetHashCode()
		{
			return base.GetHashCode();
		}

		protected virtual void ParseXml(SecurityElement e, PolicyLevel level)
		{
		}

		public void RemoveChild(CodeGroup group)
		{
		}

		public abstract PolicyStatement Resolve(Evidence evidence);

		public abstract CodeGroup ResolveMatchingCodeGroups(Evidence evidence);

		public SecurityElement ToXml()
		{
			return null;
		}

		public SecurityElement ToXml(PolicyLevel level)
		{
			return null;
		}
	}
	[Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId = "SYSLIB0003", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
	public sealed class FileCodeGroup : CodeGroup
	{
		public override string AttributeString => null;

		public override string MergeLogic => null;

		public override string PermissionSetName => null;

		public FileCodeGroup(IMembershipCondition membershipCondition, FileIOPermissionAccess access)
			: base(null, null)
		{
		}

		public override CodeGroup Copy()
		{
			return null;
		}

		protected override void CreateXml(SecurityElement element, PolicyLevel level)
		{
		}

		public override bool Equals(object o)
		{
			return base.Equals(o);
		}

		public override int GetHashCode()
		{
			return base.GetHashCode();
		}

		protected override void ParseXml(SecurityElement e, PolicyLevel level)
		{
		}

		public override PolicyStatement Resolve(Evidence evidence)
		{
			return null;
		}

		public override CodeGroup ResolveMatchingCodeGroups(Evidence evidence)
		{
			return null;
		}
	}
	[Obsolete("This type is obsolete. See https://go.microsoft.com/fwlink/?LinkID=155570 for more information.")]
	public sealed class FirstMatchCodeGroup : CodeGroup
	{
		public override string MergeLogic => null;

		public FirstMatchCodeGroup(IMembershipCondition membershipCondition, PolicyStatement policy)
			: base(null, null)
		{
		}

		public override CodeGroup Copy()
		{
			return null;
		}

		public override PolicyStatement Resolve(Evidence evidence)
		{
			return null;
		}

		public override CodeGroup ResolveMatchingCodeGroups(Evidence evidence)
		{
			return null;
		}
	}
	[Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId = "SYSLIB0003", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
	public sealed class GacInstalled : EvidenceBase, IIdentityPermissionFactory
	{
		public object Copy()
		{
			return null;
		}

		public IPermission CreateIdentityPermission(Evidence evidence)
		{
			return null;
		}

		public override bool Equals(object o)
		{
			return ((object)this).Equals(o);
		}

		public override int GetHashCode()
		{
			return ((object)this).GetHashCode();
		}

		public override string ToString()
		{
			return ((object)this).ToString();
		}
	}
	public sealed class GacMembershipCondition : ISecurityEncodable, ISecurityPolicyEncodable, IMembershipCondition
	{
		public bool Check(Evidence evidence)
		{
			return false;
		}

		public IMembershipCondition Copy()
		{
			return null;
		}

		public override bool Equals(object o)
		{
			return base.Equals(o);
		}

		public void FromXml(SecurityElement e)
		{
		}

		public void FromXml(SecurityElement e, PolicyLevel level)
		{
		}

		public override int GetHashCode()
		{
			return base.GetHashCode();
		}

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

		public SecurityElement ToXml()
		{
			return null;
		}

		public SecurityElement ToXml(PolicyLevel level)
		{
			return null;
		}
	}
	public sealed class Hash : EvidenceBase, ISerializable
	{
		public byte[] MD5 => null;

		public byte[] SHA1 => null;

		public byte[] SHA256 => null;

		public Hash(Assembly assembly)
		{
		}

		public static Hash CreateMD5(byte[] md5)
		{
			return null;
		}

		public static Hash CreateSHA1(byte[] sha1)
		{
			return null;
		}

		public static Hash CreateSHA256(byte[] sha256)
		{
			return null;
		}

		public byte[] GenerateHash(HashAlgorithm hashAlg)
		{
			return null;
		}

		[Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.", DiagnosticId = "SYSLIB0051", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
		[EditorBrowsable(/*Could not decode attribute arguments.*/)]
		public void GetObjectData(SerializationInfo info, StreamingContext context)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			throw new PlatformNotSupportedException();
		}

		public override string ToString()
		{
			return ((object)this).ToString();
		}
	}
	public sealed class HashMembershipCondition : IDeserializationCallback, ISerializable, ISecurityEncodable, ISecurityPolicyEncodable, IMembershipCondition
	{
		[field: CompilerGenerated]
		public HashAlgorithm HashAlgorithm
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}

		[field: CompilerGenerated]
		public byte[] HashValue
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}

		public HashMembershipCondition(HashAlgorithm hashAlg, byte[] value)
		{
		}

		public bool Check(Evidence evidence)
		{
			return false;
		}

		public IMembershipCondition Copy()
		{
			return this;
		}

		public override bool Equals(object o)
		{
			return base.Equals(o);
		}

		public void FromXml(SecurityElement e)
		{
		}

		public void FromXml(SecurityElement e, PolicyLevel level)
		{
		}

		public override int GetHashCode()
		{
			return base.GetHashCode();
		}

		void IDeserializationCallback.OnDeserialization(object sender)
		{
		}

		void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			throw new PlatformNotSupportedException();
		}

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

		public SecurityElement ToXml()
		{
			return null;
		}

		public SecurityElement ToXml(PolicyLevel level)
		{
			return null;
		}
	}
	[Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId = "SYSLIB0003", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
	public interface IIdentityPermissionFactory
	{
		IPermission CreateIdentityPermission(Evidence evidence);
	}
	public interface IMembershipCondition : ISecurityEncodable, ISecurityPolicyEncodable
	{
		bool Check(Evidence evidence);

		IMembershipCondition Copy();

		bool Equals(object obj);

		string ToString();
	}
	public sealed class NetCodeGroup : CodeGroup
	{
		public static readonly string AbsentOriginScheme;

		public static readonly string AnyOtherOriginScheme;

		public override string AttributeString => null;

		public override string MergeLogic => null;

		public override string PermissionSetName => null;

		public NetCodeGroup(IMembershipCondition membershipCondition)
			: base(null, null)
		{
		}

		public void AddConnectAccess(string originScheme, CodeConnectAccess connectAccess)
		{
		}

		public override CodeGroup Copy()
		{
			return null;
		}

		protected override void CreateXml(SecurityElement element, PolicyLevel level)
		{
		}

		public override bool Equals(object o)
		{
			return base.Equals(o);
		}

		public DictionaryEntry[] GetConnectAccessRules()
		{
			return null;
		}

		public override int GetHashCode()
		{
			return base.GetHashCode();
		}

		protected override void ParseXml(SecurityElement e, PolicyLevel level)
		{
		}

		public void ResetConnectAccess()
		{
		}

		public override PolicyStatement Resolve(Evidence evidence)
		{
			return null;
		}

		public override CodeGroup ResolveMatchingCodeGroups(Evidence evidence)
		{
			return null;
		}
	}
	[Obsolete("This type is obsolete. See https://go.microsoft.com/fwlink/?LinkID=155570 for more information.")]
	public sealed class PermissionRequestEvidence : EvidenceBase
	{
		public PermissionSet DeniedPermissions => null;

		public PermissionSet OptionalPermissions => null;

		public PermissionSet RequestedPermissions => null;

		public PermissionRequestEvidence(PermissionSet request, PermissionSet optional, PermissionSet denied)
		{
		}

		public PermissionRequestEvidence Copy()
		{
			return null;
		}

		public override string ToString()
		{
			return ((object)this).ToString();
		}
	}
	[Serializable]
	[TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
	public class PolicyException : SystemException
	{
		public PolicyException()
		{
		}

		[Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.", DiagnosticId = "SYSLIB0051", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
		[EditorBrowsable(/*Could not decode attribute arguments.*/)]
		protected PolicyException(SerializationInfo info, StreamingContext context)
			: base(info, context)
		{
		}//IL_0002: Unknown result type (might be due to invalid IL or missing references)


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

		public PolicyException(string message, System.Exception exception)
			: base(message, exception)
		{
		}
	}
	public sealed class PolicyLevel
	{
		[Obsolete("Because all GAC assemblies always get full trust, the full trust list is no longer meaningful. You should install any assemblies that are used in security policy in the GAC to ensure they are trusted.")]
		public System.Collections.IList FullTrustAssemblies => null;

		public string Label => null;

		public System.Collections.IList NamedPermissionSets => null;

		[field: CompilerGenerated]
		public CodeGroup RootCodeGroup
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}

		public string StoreLocation => null;

		public PolicyLevelType Type => PolicyLevelType.User;

		internal PolicyLevel()
		{
		}

		[Obsolete("Because all GAC assemblies always get full trust, the full trust list is no longer meaningful. You should install any assemblies that are used in security policy in the GAC to ensure they are trusted.")]
		public void AddFullTrustAssembly(StrongName sn)
		{
		}

		[Obsolete("Because all GAC assemblies always get full trust, the full trust list is no longer meaningful. You should install any assemblies that are used in security policy in the GAC to ensure they are trusted.")]
		public void AddFullTrustAssembly(StrongNameMembershipCondition snMC)
		{
		}

		[Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId = "SYSLIB0003", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
		public void AddNamedPermissionSet(NamedPermissionSet permSet)
		{
		}

		[Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId = "SYSLIB0003", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
		public NamedPermissionSet ChangeNamedPermissionSet(string name, PermissionSet pSet)
		{
			return null;
		}

		[Obsolete("AppDomain policy levels are obsolete. See https://go.microsoft.com/fwlink/?LinkID=155570 for more information.")]
		public static PolicyLevel CreateAppDomainLevel()
		{
			return null;
		}

		public void FromXml(SecurityElement e)
		{
		}

		[Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId = "SYSLIB0003", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
		public NamedPermissionSet GetNamedPermissionSet(string name)
		{
			return null;
		}

		public void Recover()
		{
		}

		[Obsolete("Because all GAC assemblies always get full trust, the full trust list is no longer meaningful. You should install any assemblies that are used in security policy in the GAC to ensure they are trusted.")]
		public void RemoveFullTrustAssembly(StrongName sn)
		{
		}

		[Obsolete("Because all GAC assemblies always get full trust, the full trust list is no longer meaningful. You should install any assemblies that are used in security policy in the GAC to ensure they are trusted.")]
		public void RemoveFullTrustAssembly(StrongNameMembershipCondition snMC)
		{
		}

		[Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId = "SYSLIB0003", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
		public NamedPermissionSet RemoveNamedPermissionSet(NamedPermissionSet permSet)
		{
			return null;
		}

		[Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId = "SYSLIB0003", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
		public NamedPermissionSet RemoveNamedPermissionSet(string name)
		{
			return null;
		}

		public void Reset()
		{
		}

		public PolicyStatement Resolve(Evidence evidence)
		{
			return null;
		}

		public CodeGroup ResolveMatchingCodeGroups(Evidence evidence)
		{
			return null;
		}

		public SecurityElement ToXml()
		{
			return null;
		}
	}
	public sealed class PolicyStatement : ISecurityEncodable, ISecurityPolicyEncodable
	{
		[field: CompilerGenerated]
		public PolicyStatementAttribute Attributes
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}

		public string AttributeString => null;

		[Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId = "SYSLIB0003", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
		[field: CompilerGenerated]
		public PermissionSet PermissionSet
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}

		[Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId = "SYSLIB0003", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
		public PolicyStatement(PermissionSet permSet)
		{
		}

		[Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId = "SYSLIB0003", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
		public PolicyStatement(PermissionSet permSet, PolicyStatementAttribute attributes)
		{
		}

		public PolicyStatement Copy()
		{
			return this;
		}

		public override bool Equals(object o)
		{
			return base.Equals(o);
		}

		public void FromXml(SecurityElement et)
		{
		}

		public void FromXml(SecurityElement et, PolicyLevel level)
		{
		}

		public override int GetHashCode()
		{
			return base.GetHashCode();
		}

		public SecurityElement ToXml()
		{
			return null;
		}

		public SecurityElement ToXml(PolicyLevel level)
		{
			return null;
		}
	}
	[Flags]
	public enum PolicyStatementAttribute
	{
		All = 3,
		Exclusive = 1,
		LevelFinal = 2,
		Nothing = 0
	}
	[Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId = "SYSLIB0003", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
	public sealed class Publisher : EvidenceBase, IIdentityPermissionFactory
	{
		public X509Certificate Certificate => null;

		public Publisher(X509Certificate cert)
		{
		}

		public object Copy()
		{
			return null;
		}

		public IPermission CreateIdentityPermission(Evidence evidence)
		{
			return null;
		}

		public override bool Equals(object o)
		{
			return ((object)this).Equals(o);
		}

		public override int GetHashCode()
		{
			return ((object)this).GetHashCode();
		}

		public override string ToString()
		{
			return ((object)this).ToString();
		}
	}
	public sealed class PublisherMembershipCondition : ISecurityEncodable, ISecurityPolicyEncodable, IMembershipCondition
	{
		[field: CompilerGenerated]
		public X509Certificate Certificate
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}

		public PublisherMembershipCondition(X509Certificate certificate)
		{
		}

		public bool Check(Evidence evidence)
		{
			return false;
		}

		public IMembershipCondition Copy()
		{
			return this;
		}

		public override bool Equals(object o)
		{
			return base.Equals(o);
		}

		public void FromXml(SecurityElement e)
		{
		}

		public void FromXml(SecurityElement e, PolicyLevel level)
		{
		}

		public override int GetHashCode()
		{
			return base.GetHashCode();
		}

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

		public SecurityElement ToXml()
		{
			return null;
		}

		public SecurityElement ToXml(PolicyLevel level)
		{
			return null;
		}
	}
	[Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId = "SYSLIB0003", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
	public sealed class Site : EvidenceBase, IIdentityPermissionFactory
	{
		public string Name => null;

		public Site(string name)
		{
		}

		public object Copy()
		{
			return null;
		}

		public static Site CreateFromUrl(string url)
		{
			return null;
		}

		public IPermission CreateIdentityPermission(Evidence evidence)
		{
			return null;
		}

		public override bool Equals(object o)
		{
			return ((object)this).Equals(o);
		}

		public override int GetHashCode()
		{
			return ((object)this).GetHashCode();
		}

		public override string ToString()
		{
			return ((object)this).ToString();
		}
	}
	public sealed class SiteMembershipCondition : ISecurityEncodable, ISecurityPolicyEncodable, IMembershipCondition
	{
		[field: CompilerGenerated]
		public string Site
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}

		public SiteMembershipCondition(string site)
		{
		}

		public bool Check(Evidence evidence)
		{
			return false;
		}

		public IMembershipCondition Copy()
		{
			return null;
		}

		public override bool Equals(object o)
		{
			return base.Equals(o);
		}

		public void FromXml(SecurityElement e)
		{
		}

		public void FromXml(SecurityElement e, PolicyLevel level)
		{
		}

		public override int GetHashCode()
		{
			return base.GetHashCode();
		}

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

		public SecurityElement ToXml()
		{
			return null;
		}

		public SecurityElement ToXml(PolicyLevel level)
		{
			return null;
		}
	}
	[Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId = "SYSLIB0003", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
	public sealed class StrongName : EvidenceBase, IIdentityPermissionFactory
	{
		public string Name => null;

		public StrongNamePublicKeyBlob PublicKey => null;

		public Version Version => null;

		public StrongName(StrongNamePublicKeyBlob blob, string name, Version version)
		{
		}

		public object Copy()
		{
			return null;
		}

		public IPermission CreateIdentityPermission(Evidence evidence)
		{
			return null;
		}

		public override bool Equals(object o)
		{
			return ((object)this).Equals(o);
		}

		public override int GetHashCode()
		{
			return ((object)this).GetHashCode();
		}

		public override string ToString()
		{
			return ((object)this).ToString();
		}
	}
	[Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId = "SYSLIB0003", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
	public sealed class StrongNameMembershipCondition : ISecurityEncodable, ISecurityPolicyEncodable, IMembershipCondition
	{
		[field: CompilerGenerated]
		public string Name
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}

		[field: CompilerGenerated]
		public StrongNamePublicKeyBlob PublicKey
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}

		[field: CompilerGenerated]
		public Version Version
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}

		public StrongNameMembershipCondition(StrongNamePublicKeyBlob blob, string name, Version version)
		{
		}

		public bool Check(Evidence evidence)
		{
			return false;
		}

		public IMembershipCondition Copy()
		{
			return this;
		}

		public override bool Equals(object o)
		{
			return base.Equals(o);
		}

		public void FromXml(SecurityElement e)
		{
		}

		public void FromXml(SecurityElement e, PolicyLevel level)
		{
		}

		public override int GetHashCode()
		{
			return base.GetHashCode();
		}

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

		public SecurityElement ToXml()
		{
			return null;
		}

		public SecurityElement ToXml(PolicyLevel level)
		{
			return null;
		}
	}
	public class TrustManagerContext
	{
		[field: CompilerGenerated]
		public virtual bool IgnorePersistedDecision
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}

		[field: CompilerGenerated]
		public virtual bool KeepAlive
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}

		[field: CompilerGenerated]
		public virtual bool NoPrompt
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}

		[field: CompilerGenerated]
		public virtual bool Persist
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}

		[field: CompilerGenerated]
		public virtual TrustManagerUIContext UIContext
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}

		[field: CompilerGenerated]
		public virtual ApplicationIdentity PreviousApplicationIdentity
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}

		public TrustManagerContext()
		{
		}

		public TrustManagerContext(TrustManagerUIContext uiContext)
		{
		}
	}
	public enum TrustManagerUIContext
	{
		Install = 0,
		Run = 2,
		Upgrade = 1
	}
	[Obsolete("This type is obsolete. See https://go.microsoft.com/fwlink/?LinkID=155570 for more information.")]
	public sealed class UnionCodeGroup : CodeGroup
	{
		public override string MergeLogic => null;

		public UnionCodeGroup(IMembershipCondition membershipCondition, PolicyStatement policy)
			: base(null, null)
		{
		}

		public override CodeGroup Copy()
		{
			return null;
		}

		public override PolicyStatement Resolve(Evidence evidence)
		{
			return null;
		}

		public override CodeGroup ResolveMatchingCodeGroups(Evidence evidence)
		{
			return null;
		}
	}
	[Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId = "SYSLIB0003", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
	public sealed class Url : EvidenceBase, IIdentityPermissionFactory
	{
		public string Value => null;

		public Url(string name)
		{
		}

		public object Copy()
		{
			return null;
		}

		public IPermission CreateIdentityPermission(Evidence evidence)
		{
			return null;
		}

		public override bool Equals(object o)
		{
			return ((object)this).Equals(o);
		}

		public override int GetHashCode()
		{
			return ((object)this).GetHashCode();
		}

		public override string ToString()
		{
			return ((object)this).ToString();
		}
	}
	public sealed class UrlMembershipCondition : ISecurityEncodable, IMembershipCondition, ISecurityPolicyEncodable
	{
		[field: CompilerGenerated]
		public string Url
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}

		public UrlMembershipCondition(string url)
		{
		}

		public bool Check(Evidence evidence)
		{
			return false;
		}

		public IMembershipCondition Copy()
		{
			return null;
		}

		public override bool Equals(object obj)
		{
			return base.Equals(obj);
		}

		public void FromXml(SecurityElement e)
		{
		}

		public void FromXml(SecurityElement e, PolicyLevel level)
		{
		}

		public override int GetHashCode()
		{
			return base.GetHashCode();
		}

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

		public SecurityElement ToXml()
		{
			return null;
		}

		public SecurityElement ToXml(PolicyLevel level)
		{
			return null;
		}
	}
	[Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId = "SYSLIB0003", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
	public sealed class Zone : EvidenceBase, IIdentityPermissionFactory
	{
		public SecurityZone SecurityZone => SecurityZone.MyComputer;

		public Zone(SecurityZone zone)
		{
		}

		public object Copy()
		{
			return null;
		}

		public static Zone CreateFromUrl(string url)
		{
			return null;
		}

		public IPermission CreateIdentityPermission(Evidence evidence)
		{
			return null;
		}

		public override bool Equals(object o)
		{
			return ((object)this).Equals(o);
		}

		public override int GetHashCode()
		{
			return ((object)this).GetHashCode();
		}

		public override string ToString()
		{
			return ((object)this).ToString();
		}
	}
	public sealed class ZoneMembershipCondition : ISecurityEncodable, IMembershipCondition, ISecurityPolicyEncodable
	{
		[field: CompilerGenerated]
		public SecurityZone SecurityZone
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}

		public ZoneMembershipCondition(SecurityZone zone)
		{
		}

		public bool Check(Evidence evidence)
		{
			return false;
		}

		public IMembershipCondition Copy()
		{
			return this;
		}

		public override bool Equals(object o)
		{
			return base.Equals(o);
		}

		public void FromXml(SecurityElement e)
		{
		}

		public void FromXml(SecurityElement e, PolicyLevel level)
		{
		}

		public override int GetHashCode()
		{
			return base.GetHashCode();
		}

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

		public SecurityElement ToXml()
		{
			return null;
		}

		public SecurityElement ToXml(PolicyLevel level)
		{
			return null;
		}
	}
}
namespace System.Security.Permissions
{
	[Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId = "SYSLIB0003", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
	public sealed class DataProtectionPermission : CodeAccessPermission, IUnrestrictedPermission
	{
		[field: CompilerGenerated]
		public DataProtectionPermissionFlags Flags
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}

		public DataProtectionPermission(PermissionState state)
		{
		}

		public DataProtectionPermission(DataProtectionPermissionFlags flag)
		{
		}

		public bool IsUnrestricted()
		{
			return false;
		}

		public override IPermission Copy()
		{
			return null;
		}

		public override IPermission Union(IPermission target)
		{
			return null;
		}

		public override IPermission Intersect(IPermission target)
		{
			return null;
		}

		public override bool IsSubsetOf(IPermission target)
		{
			return false;
		}

		public override void FromXml(SecurityElement securityElement)
		{
		}

		public override SecurityElement ToXml()
		{
			return null;
		}
	}
	[Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId = "SYSLIB0003", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
	[AttributeUsage(/*Could not decode attribute arguments.*/)]
	public sealed class DataProtectionPermissionAttribute : CodeAccessSecurityAttribute
	{
		[field: CompilerGenerated]
		public DataProtectionPermissionFlags Flags
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}

		[field: CompilerGenerated]
		public bool ProtectData
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}

		[field: CompilerGenerated]
		public bool UnprotectData
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}

		[field: CompilerGenerated]
		public bool ProtectMemory
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}

		[field: CompilerGenerated]
		public bool UnprotectMemory
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}

		public DataProtectionPermissionAttribute(SecurityAction action)
			: base((SecurityAction)0)
		{
		}

		public override IPermission CreatePermission()
		{
			return null;
		}
	}
	[Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId = "SYSLIB0003", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
	[Flags]
	public enum DataProtectionPermissionFlags
	{
		NoFlags = 0,
		ProtectData = 1,
		UnprotectData = 2,
		ProtectMemory = 4,
		UnprotectMemory = 8,
		AllFlags = 0xF
	}
	[Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId = "SYSLIB0003", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
	public sealed class EnvironmentPermission : CodeAccessPermission, IUnrestrictedPermission
	{
		public EnvironmentPermission(EnvironmentPermissionAccess flag, string pathList)
		{
		}

		public EnvironmentPermission(PermissionState state)
		{
		}

		public void AddPathList(EnvironmentPermissionAccess flag, string pathList)
		{
		}

		public override IPermission Copy()
		{
			return null;
		}

		public override void FromXml(SecurityElement esd)
		{
		}

		public string GetPathList(EnvironmentPermissionAccess flag)
		{
			return null;
		}

		public override IPermission Intersect(IPermission target)
		{
			return null;
		}

		public override bool IsSubsetOf(IPermission target)
		{
			return false;
		}

		public bool IsUnrestricted()
		{
			return false;
		}

		public void SetPathList(EnvironmentPermissionAccess flag, string pathList)
		{
		}

		public override SecurityElement ToXml()
		{
			return null;
		}

		public override IPermission Union(IPermission other)
		{
			return null;
		}
	}
	[Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId = "SYSLIB0003", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
	[Flags]
	public enum EnvironmentPermissionAccess
	{
		AllAccess = 3,
		NoAccess = 0,
		Read = 1,
		Write = 2
	}
	[Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId = "SYSLIB0003", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
	[AttributeUsage(/*Could not decode attribute arguments.*/)]
	public sealed class EnvironmentPermissionAttribute : CodeAccessSecurityAttribute
	{
		[field: CompilerGenerated]
		public string All
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}

		[field: CompilerGenerated]
		public string Read
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}

		[field: CompilerGenerated]
		public string Write
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}

		public EnvironmentPermissionAttribute(SecurityAction action)
			: base((SecurityAction)0)
		{
		}

		public override IPermission CreatePermission()
		{
			return null;
		}
	}
	[Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId = "SYSLIB0003", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
	public sealed class FileDialogPermission : CodeAccessPermission, IUnrestrictedPermission
	{
		[field: CompilerGenerated]
		public FileDialogPermissionAccess Access
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}

		public FileDialogPermission(FileDialogPermissionAccess access)
		{
		}

		public FileDialogPermission(PermissionState state)
		{
		}

		public override IPermission Copy()
		{
			return (IPermission)(object)this;
		}

		public override void FromXml(SecurityElement esd)
		{
		}

		public override IPermission Intersect(IPermission target)
		{
			return null;
		}

		public override bool IsSubsetOf(IPermission target)
		{
			return false;
		}

		public bool IsUnrestricted()
		{
			return false;
		}

		public override SecurityElement ToXml()
		{
			return null;
		}

		public override IPermission Union(IPermission target)
		{
			return null;
		}
	}
	[Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId = "SYSLIB0003", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
	[Flags]
	public enum FileDialogPermissionAccess
	{
		None = 0,
		Open = 1,
		OpenSave = 3,
		Save = 2
	}
	[Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId = "SYSLIB0003", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
	[AttributeUsage(/*Could not decode attribute arguments.*/)]
	public sealed class FileDialogPermissionAttribute : CodeAccessSecurityAttribute
	{
		[field: CompilerGenerated]
		public bool Open
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}

		[field: CompilerGenerated]
		public bool Save
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}

		public FileDialogPermissionAttribute(SecurityAction action)
			: base((SecurityAction)0)
		{
		}

		public override IPermission CreatePermission()
		{
			return null;
		}
	}
	[Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId = "SYSLIB0003", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
	public sealed class FileIOPermission : CodeAccessPermission, IUnrestrictedPermission
	{
		[field: CompilerGenerated]
		public FileIOPermissionAccess AllFiles
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}

		[field: CompilerGenerated]
		public FileIOPermissionAccess AllLocalFiles
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}

		public FileIOPermission(FileIOPermissionAccess access, string path)
		{
		}

		public FileIOPermission(FileIOPermissionAccess access, string[] pathList)
		{
		}

		public FileIOPermission(FileIOPermissionAccess access, AccessControlActions actions, string path)
		{
		}

		public FileIOPermission(FileIOPermissionAccess access, AccessControlActions actions, string[] pathList)
		{
		}

		public FileIOPermission(PermissionState state)
		{
		}

		public void AddPathList(FileIOPermissionAccess access, string path)
		{
		}

		public void AddPathList(FileIOPermissionAccess access, string[] pathList)
		{
		}

		public override IPermission Copy()
		{
			return (IPermission)(object)this;
		}

		public override bool Equals(object o)
		{
			return base.Equals(o);
		}

		public override void FromXml(SecurityElement esd)
		{
		}

		public override int GetHashCode()
		{
			return base.GetHashCode();
		}

		public string[] GetPathList(FileIOPermissionAccess access)
		{
			return null;
		}

		public override IPermission Intersect(IPermission target)
		{
			return null;
		}

		public override bool IsSubsetOf(IPermission target)
		{
			return false;
		}

		public bool IsUnrestricted()
		{
			return false;
		}

		public void SetPathList(FileIOPermissionAccess access, string path)
		{
		}

		public void SetPathList(FileIOPermissionAccess access, string[] pathList)
		{
		}

		public override SecurityElement ToXml()
		{
			return null;
		}

		public override IPermission Union(IPermission other)
		{
			return null;
		}
	}
	[Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId = "SYSLIB0003", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
	[Flags]
	public enum FileIOPermissionAccess
	{
		AllAccess = 0xF,
		Append = 4,
		NoAccess = 0,
		PathDiscovery = 8,
		Read = 1,
		Write = 2
	}
	[Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId = "SYSLIB0003", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
	[AttributeUsage(/*Could not decode attribute arguments.*/)]
	public sealed class FileIOPermissionAttribute : CodeAccessSecurityAttribute
	{
		[field: CompilerGenerated]
		public string Read
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}

		[field: CompilerGenerated]
		public string Write
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}

		[field: CompilerGenerated]
		public string Append
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}

		[field: CompilerGenerated]
		public string PathDiscovery
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}

		[field: CompilerGenerated]
		public string ViewAccessControl
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}

		[field: CompilerGenerated]
		public string ChangeAccessControl
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}

		[Obsolete]
		[field: CompilerGenerated]
		public string All
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}

		[field: CompilerGenerated]
		public string ViewAndModify
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}

		[field: CompilerGenerated]
		public FileIOPermissionAccess AllFiles
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}

		[field: CompilerGenerated]
		public FileIOPermissionAccess AllLocalFiles
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}

		public FileIOPermissionAttribute(SecurityAction action)
			: base(action)
		{
		}//IL_0001: Unknown result type (might be due to invalid IL or missing references)


		public override IPermission CreatePermission()
		{
			return null;
		}
	}
	[Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId = "SYSLIB0003", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
	public sealed class GacIdentityPermission : CodeAccessPermission
	{
		public GacIdentityPermission()
		{
		}

		public GacIdentityPermission(PermissionState state)
		{
		}

		public override IPermission Copy()
		{
			return null;
		}

		public override void FromXml(SecurityElement securityElement)
		{
		}

		public override IPermission Intersect(IPermission target)
		{
			return null;
		}

		public override bool IsSubsetOf(IPermission target)
		{
			return false;
		}

		public override SecurityElement ToXml()
		{
			return null;
		}

		public override IPermission Union(IPermission target)
		{
			return null;
		}
	}
	[Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId = "SYSLIB0003", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
	[AttributeUsage(/*Could not decode attribute arguments.*/)]
	public sealed class GacIdentityPermissionAttribute : CodeAccessSecurityAttribute
	{
		public GacIdentityPermissionAttribute(SecurityAction action)
			: base((SecurityAction)0)
		{
		}

		public override IPermission CreatePermission()
		{
			return null;
		}
	}
	[Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId = "SYSLIB0003", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
	[AttributeUsage(/*Could not decode attribute arguments.*/)]
	public sealed class HostProtectionAttribute : CodeAccessSecurityAttribute
	{
		[field: CompilerGenerated]
		public bool ExternalProcessMgmt
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}

		[field: CompilerGenerated]
		public bool ExternalThreading
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}

		[field: CompilerGenerated]
		public bool MayLeakOnAbort
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}

		[field: CompilerGenerated]
		public HostProtectionResource Resources
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}

		[field: CompilerGenerated]
		public bool SecurityInfrastructure
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}

		[field: CompilerGenerated]
		public bool SelfAffectingProcessMgmt
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}

		[field: CompilerGenerated]
		public bool SelfAffectingThreading
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}

		[field: CompilerGenerated]
		public bool SharedState
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}

		[field: CompilerGenerated]
		public bool Synchronization
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}

		[field: CompilerGenerated]
		public bool UI
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}

		public HostProtectionAttribute()
			: base((SecurityAction)0)
		{
		}

		public HostProtectionAttribute(SecurityAction action)
			: base((SecurityAction)0)
		{
		}

		public override IPermission CreatePermission()
		{
			return null;
		}
	}
	[Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId = "SYSLIB0003", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
	[Flags]
	[TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
	public enum HostProtectionResource
	{
		All = 0x1FF,
		ExternalProcessMgmt = 4,
		ExternalThreading = 0x10,
		MayLeakOnAbort = 0x100,
		None = 0,
		SecurityInfrastructure = 0x40,
		SelfAffectingProcessMgmt = 8,
		SelfAffectingThreading = 0x20,
		SharedState = 2,
		Synchronization = 1,
		UI = 0x80
	}
	internal sealed class IDRole
	{
		[field: CompilerGenerated]
		internal bool Authenticated
		{
			[CompilerGenerated]
			get;
		}

		[field: CompilerGenerated]
		internal string ID
		{
			[CompilerGenerated]
			get;
		}

		[field: CompilerGenerated]
		internal string Role
		{
			[CompilerGenerated]
			get;
		}

		internal IDRole(bool authenticated, string id, string role)
		{
			Authenticated = authenticated;
			ID = id;
			Role = role;
		}

		internal IDRole(SecurityElement e)
		{
			string text = e.Attribute("Authenticated");
			Authenticated = text != null && string.Equals(text, "true", (StringComparison)5);
			ID = e.Attribute("ID");
			Role = e.Attribute("Role");
		}

		internal SecurityElement ToXml()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			SecurityElement val = new SecurityElement("Identity");
			if (Authenticated)
			{
				val.AddAttribute("Authenticated", "true");
			}
			if (ID != null)
			{
				val.AddAttribute("ID", SecurityElement.Escape(ID));
			}
			if (Role != null)
			{
				val.AddAttribute("Role", SecurityElement.Escape(Role));
			}
			return val;
		}

		public int GetHashCode()
		{
			return ((!Authenticated) ? 101 : 0) + ((ID != null) ? ((object)ID).GetHashCode() : 0) + ((Role != null) ? ((object)Role).GetHashCode() : 0);
		}
	}
	[Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId = "SYSLIB0003", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
	public enum IsolatedStorageContainment
	{
		None = 0,
		DomainIsolationByUser = 16,
		ApplicationIsolationByUser = 21,
		AssemblyIsolationByUser = 32,
		DomainIsolationByMachine = 48,
		AssemblyIsolationByMachine = 64,
		ApplicationIsolationByMachine = 69,
		DomainIsolationByRoamingUser = 80,
		AssemblyIsolationByRoamingUser = 96,
		ApplicationIsolationByRoamingUser = 101,
		AdministerIsolatedStorageByUser = 112,
		UnrestrictedIsolatedStorage = 240
	}
	[Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId = "SYSLIB0003", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
	public sealed class IsolatedStorageFilePermission : IsolatedStoragePermission
	{
		public IsolatedStorageFilePermission(PermissionState state)
			: base(state)
		{
		}//IL_0001: Unknown result type (might be due to invalid IL or missing references)


		public override IPermission Union(IPermission target)
		{
			return null;
		}

		public override bool IsSubsetOf(IPermission target)
		{
			return false;
		}

		public override IPermission Intersect(IPermission target)
		{
			return null;
		}

		public override IPermission Copy()
		{
			return null;
		}

		public override SecurityElement ToXml()
		{
			return null;
		}
	}
	[Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId = "SYSLIB0003", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
	[AttributeUsage(/*Could not decode attribute arguments.*/)]
	public sealed class IsolatedStorageFilePermissionAttribute : IsolatedStoragePermissionAttribute
	{
		public IsolatedStorageFilePermissionAttribute(SecurityAction action)
			: base(action)
		{
		}//IL_0001: Unknown result type (might be due to invalid IL or missing references)


		public override IPermission CreatePermission()
		{
			return null;
		}
	}
	[Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId = "SYSLIB0003", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
	public abstract class IsolatedStoragePermission : CodeAccessPermission, IUnrestrictedPermission
	{
		[field: CompilerGenerated]
		public long UserQuota
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}

		[field: CompilerGenerated]
		public IsolatedStorageContainment UsageAllowed
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}

		protected IsolatedStoragePermission(PermissionState state)
		{
		}

		public bool IsUnrestricted()
		{
			return false;
		}

		public override SecurityElement ToXml()
		{
			return null;
		}

		public override void FromXml(SecurityElement esd)
		{
		}
	}
	[Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId = "SYSLIB0003", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
	public abstract class IsolatedStoragePermissionAttribute : CodeAccessSecurityAttribute
	{
		[field: CompilerGenerated]
		public long UserQuota
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}

		[field: CompilerGenerated]
		public IsolatedStorageContainment UsageAllowed
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}

		protected IsolatedStoragePermissionAttribute(SecurityAction action)
			: base(action)
		{
		}//IL_0001: Unknown result type (might be due to invalid IL or missing references)

	}
	[Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId = "SYSLIB0003", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
	public interface IUnrestrictedPermission
	{
		bool IsUnrestricted();
	}
	[Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId = "SYSLIB0003", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
	public sealed class KeyContainerPermission : CodeAccessPermission, IUnrestrictedPermission
	{
		[field: CompilerGenerated]
		public KeyContainerPermissionFlags Flags
		{
			[CompilerGenerated]
			get;
		}

		[field: CompilerGenerated]
		public KeyContainerPermissionAccessEntryCollection AccessEntries
		{
			[CompilerGenerated]
			get;
		}

		public KeyContainerPermission(PermissionState state)
		{
		}

		public KeyContainerPermission(KeyContainerPermissionFlags flags)
		{
		}

		public KeyContainerPermission(KeyContainerPermissionFlags flags, KeyContainerPermissionAccessEntry[] accessList)
		{
		}

		public bool IsUnrestricted()
		{
			return false;
		}

		public override bool IsSubsetOf(IPermission target)
		{
			return false;
		}

		public override IPermission Intersect(IPermission target)
		{
			return null;
		}

		public override IPermission Union(IPermission target)
		{
			return null;
		}

		public override IPermission Copy()
		{
			return null;
		}

		public override SecurityElement ToXml()
		{
			return null;
		}

		public override void FromXml(SecurityElement securityElement)
		{
		}
	}
	[Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId = "SYSLIB0003", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
	public sealed class KeyContainerPermissionAccessEntry
	{
		[field: CompilerGenerated]
		public string KeyStore
		{
			[CompilerGenerated]
			get;
			[CompilerGenerated]
			set;
		}

		[field: CompilerGenerated]
		public 

BepInEx/plugins/BendyAndTheArchipelagoMachine/Unity.TextMeshPro.dll

Decompiled 3 weeks ago
using System;
using System.CodeDom.Compiler;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using Unity.Profiling;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.Rendering;
using UnityEngine.Serialization;
using UnityEngine.TextCore;
using UnityEngine.TextCore.LowLevel;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: InternalsVisibleTo("Unity.TextCore")]
[assembly: InternalsVisibleTo("Unity.FontEngine.Tests")]
[assembly: AssemblyVersion("0.0.0.0")]
[CompilerGenerated]
[EditorBrowsable(EditorBrowsableState.Never)]
[GeneratedCode("Unity.MonoScriptGenerator.MonoScriptInfoGenerator", null)]
internal class UnitySourceGeneratedAssemblyMonoScriptTypes_v1
{
	private struct MonoScriptData
	{
		public byte[] FilePathsData;

		public byte[] TypesData;

		public int TotalTypes;

		public int TotalFiles;

		public bool IsEditorOnly;
	}

	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	private static MonoScriptData Get()
	{
		return new MonoScriptData
		{
			FilePathsData = new byte[5236]
			{
				0, 0, 0, 4, 0, 0, 0, 79, 92, 76,
				105, 98, 114, 97, 114, 121, 92, 80, 97, 99,
				107, 97, 103, 101, 67, 97, 99, 104, 101, 92,
				99, 111, 109, 46, 117, 110, 105, 116, 121, 46,
				116, 101, 120, 116, 109, 101, 115, 104, 112, 114,
				111, 64, 51, 46, 48, 46, 55, 92, 83, 99,
				114, 105, 112, 116, 115, 92, 82, 117, 110, 116,
				105, 109, 101, 92, 70, 97, 115, 116, 65, 99,
				116, 105, 111, 110, 46, 99, 115, 0, 0, 0,
				1, 0, 0, 0, 86, 92, 76, 105, 98, 114,
				97, 114, 121, 92, 80, 97, 99, 107, 97, 103,
				101, 67, 97, 99, 104, 101, 92, 99, 111, 109,
				46, 117, 110, 105, 116, 121, 46, 116, 101, 120,
				116, 109, 101, 115, 104, 112, 114, 111, 64, 51,
				46, 48, 46, 55, 92, 83, 99, 114, 105, 112,
				116, 115, 92, 82, 117, 110, 116, 105, 109, 101,
				92, 73, 84, 101, 120, 116, 80, 114, 101, 80,
				114, 111, 99, 101, 115, 115, 111, 114, 46, 99,
				115, 0, 0, 0, 3, 0, 0, 0, 93, 92,
				76, 105, 98, 114, 97, 114, 121, 92, 80, 97,
				99, 107, 97, 103, 101, 67, 97, 99, 104, 101,
				92, 99, 111, 109, 46, 117, 110, 105, 116, 121,
				46, 116, 101, 120, 116, 109, 101, 115, 104, 112,
				114, 111, 64, 51, 46, 48, 46, 55, 92, 83,
				99, 114, 105, 112, 116, 115, 92, 82, 117, 110,
				116, 105, 109, 101, 92, 77, 97, 116, 101, 114,
				105, 97, 108, 82, 101, 102, 101, 114, 101, 110,
				99, 101, 77, 97, 110, 97, 103, 101, 114, 46,
				99, 115, 0, 0, 0, 1, 0, 0, 0, 82,
				92, 76, 105, 98, 114, 97, 114, 121, 92, 80,
				97, 99, 107, 97, 103, 101, 67, 97, 99, 104,
				101, 92, 99, 111, 109, 46, 117, 110, 105, 116,
				121, 46, 116, 101, 120, 116, 109, 101, 115, 104,
				112, 114, 111, 64, 51, 46, 48, 46, 55, 92,
				83, 99, 114, 105, 112, 116, 115, 92, 82, 117,
				110, 116, 105, 109, 101, 92, 84, 101, 120, 116,
				67, 111, 110, 116, 97, 105, 110, 101, 114, 46,
				99, 115, 0, 0, 0, 1, 0, 0, 0, 80,
				92, 76, 105, 98, 114, 97, 114, 121, 92, 80,
				97, 99, 107, 97, 103, 101, 67, 97, 99, 104,
				101, 92, 99, 111, 109, 46, 117, 110, 105, 116,
				121, 46, 116, 101, 120, 116, 109, 101, 115, 104,
				112, 114, 111, 64, 51, 46, 48, 46, 55, 92,
				83, 99, 114, 105, 112, 116, 115, 92, 82, 117,
				110, 116, 105, 109, 101, 92, 84, 101, 120, 116,
				77, 101, 115, 104, 80, 114, 111, 46, 99, 115,
				0, 0, 0, 1, 0, 0, 0, 84, 92, 76,
				105, 98, 114, 97, 114, 121, 92, 80, 97, 99,
				107, 97, 103, 101, 67, 97, 99, 104, 101, 92,
				99, 111, 109, 46, 117, 110, 105, 116, 121, 46,
				116, 101, 120, 116, 109, 101, 115, 104, 112, 114,
				111, 64, 51, 46, 48, 46, 55, 92, 83, 99,
				114, 105, 112, 116, 115, 92, 82, 117, 110, 116,
				105, 109, 101, 92, 84, 101, 120, 116, 77, 101,
				115, 104, 80, 114, 111, 85, 71, 85, 73, 46,
				99, 115, 0, 0, 0, 2, 0, 0, 0, 87,
				92, 76, 105, 98, 114, 97, 114, 121, 92, 80,
				97, 99, 107, 97, 103, 101, 67, 97, 99, 104,
				101, 92, 99, 111, 109, 46, 117, 110, 105, 116,
				121, 46, 116, 101, 120, 116, 109, 101, 115, 104,
				112, 114, 111, 64, 51, 46, 48, 46, 55, 92,
				83, 99, 114, 105, 112, 116, 115, 92, 82, 117,
				110, 116, 105, 109, 101, 92, 84, 77, 80, 114,
				111, 95, 69, 118, 101, 110, 116, 77, 97, 110,
				97, 103, 101, 114, 46, 99, 115, 0, 0, 0,
				2, 0, 0, 0, 91, 92, 76, 105, 98, 114,
				97, 114, 121, 92, 80, 97, 99, 107, 97, 103,
				101, 67, 97, 99, 104, 101, 92, 99, 111, 109,
				46, 117, 110, 105, 116, 121, 46, 116, 101, 120,
				116, 109, 101, 115, 104, 112, 114, 111, 64, 51,
				46, 48, 46, 55, 92, 83, 99, 114, 105, 112,
				116, 115, 92, 82, 117, 110, 116, 105, 109, 101,
				92, 84, 77, 80, 114, 111, 95, 69, 120, 116,
				101, 110, 115, 105, 111, 110, 77, 101, 116, 104,
				111, 100, 115, 46, 99, 115, 0, 0, 0, 10,
				0, 0, 0, 88, 92, 76, 105, 98, 114, 97,
				114, 121, 92, 80, 97, 99, 107, 97, 103, 101,
				67, 97, 99, 104, 101, 92, 99, 111, 109, 46,
				117, 110, 105, 116, 121, 46, 116, 101, 120, 116,
				109, 101, 115, 104, 112, 114, 111, 64, 51, 46,
				48, 46, 55, 92, 83, 99, 114, 105, 112, 116,
				115, 92, 82, 117, 110, 116, 105, 109, 101, 92,
				84, 77, 80, 114, 111, 95, 77, 101, 115, 104,
				85, 116, 105, 108, 105, 116, 105, 101, 115, 46,
				99, 115, 0, 0, 0, 1, 0, 0, 0, 82,
				92, 76, 105, 98, 114, 97, 114, 121, 92, 80,
				97, 99, 107, 97, 103, 101, 67, 97, 99, 104,
				101, 92, 99, 111, 109, 46, 117, 110, 105, 116,
				121, 46, 116, 101, 120, 116, 109, 101, 115, 104,
				112, 114, 111, 64, 51, 46, 48, 46, 55, 92,
				83, 99, 114, 105, 112, 116, 115, 92, 82, 117,
				110, 116, 105, 109, 101, 92, 84, 77, 80, 114,
				111, 95, 80, 114, 105, 118, 97, 116, 101, 46,
				99, 115, 0, 0, 0, 1, 0, 0, 0, 87,
				92, 76, 105, 98, 114, 97, 114, 121, 92, 80,
				97, 99, 107, 97, 103, 101, 67, 97, 99, 104,
				101, 92, 99, 111, 109, 46, 117, 110, 105, 116,
				121, 46, 116, 101, 120, 116, 109, 101, 115, 104,
				112, 114, 111, 64, 51, 46, 48, 46, 55, 92,
				83, 99, 114, 105, 112, 116, 115, 92, 82, 117,
				110, 116, 105, 109, 101, 92, 84, 77, 80, 114,
				111, 95, 85, 71, 85, 73, 95, 80, 114, 105,
				118, 97, 116, 101, 46, 99, 115, 0, 0, 0,
				1, 0, 0, 0, 78, 92, 76, 105, 98, 114,
				97, 114, 121, 92, 80, 97, 99, 107, 97, 103,
				101, 67, 97, 99, 104, 101, 92, 99, 111, 109,
				46, 117, 110, 105, 116, 121, 46, 116, 101, 120,
				116, 109, 101, 115, 104, 112, 114, 111, 64, 51,
				46, 48, 46, 55, 92, 83, 99, 114, 105, 112,
				116, 115, 92, 82, 117, 110, 116, 105, 109, 101,
				92, 84, 77, 80, 95, 65, 115, 115, 101, 116,
				46, 99, 115, 0, 0, 0, 1, 0, 0, 0,
				82, 92, 76, 105, 98, 114, 97, 114, 121, 92,
				80, 97, 99, 107, 97, 103, 101, 67, 97, 99,
				104, 101, 92, 99, 111, 109, 46, 117, 110, 105,
				116, 121, 46, 116, 101, 120, 116, 109, 101, 115,
				104, 112, 114, 111, 64, 51, 46, 48, 46, 55,
				92, 83, 99, 114, 105, 112, 116, 115, 92, 82,
				117, 110, 116, 105, 109, 101, 92, 84, 77, 80,
				95, 67, 104, 97, 114, 97, 99, 116, 101, 114,
				46, 99, 115, 0, 0, 0, 4, 0, 0, 0,
				86, 92, 76, 105, 98, 114, 97, 114, 121, 92,
				80, 97, 99, 107, 97, 103, 101, 67, 97, 99,
				104, 101, 92, 99, 111, 109, 46, 117, 110, 105,
				116, 121, 46, 116, 101, 120, 116, 109, 101, 115,
				104, 112, 114, 111, 64, 51, 46, 48, 46, 55,
				92, 83, 99, 114, 105, 112, 116, 115, 92, 82,
				117, 110, 116, 105, 109, 101, 92, 84, 77, 80,
				95, 67, 104, 97, 114, 97, 99, 116, 101, 114,
				73, 110, 102, 111, 46, 99, 115, 0, 0, 0,
				1, 0, 0, 0, 86, 92, 76, 105, 98, 114,
				97, 114, 121, 92, 80, 97, 99, 107, 97, 103,
				101, 67, 97, 99, 104, 101, 92, 99, 111, 109,
				46, 117, 110, 105, 116, 121, 46, 116, 101, 120,
				116, 109, 101, 115, 104, 112, 114, 111, 64, 51,
				46, 48, 46, 55, 92, 83, 99, 114, 105, 112,
				116, 115, 92, 82, 117, 110, 116, 105, 109, 101,
				92, 84, 77, 80, 95, 67, 111, 108, 111, 114,
				71, 114, 97, 100, 105, 101, 110, 116, 46, 99,
				115, 0, 0, 0, 1, 0, 0, 0, 86, 92,
				76, 105, 98, 114, 97, 114, 121, 92, 80, 97,
				99, 107, 97, 103, 101, 67, 97, 99, 104, 101,
				92, 99, 111, 109, 46, 117, 110, 105, 116, 121,
				46, 116, 101, 120, 116, 109, 101, 115, 104, 112,
				114, 111, 64, 51, 46, 48, 46, 55, 92, 83,
				99, 114, 105, 112, 116, 115, 92, 82, 117, 110,
				116, 105, 109, 101, 92, 84, 77, 80, 95, 67,
				111, 109, 112, 97, 116, 105, 98, 105, 108, 105,
				116, 121, 46, 99, 115, 0, 0, 0, 6, 0,
				0, 0, 87, 92, 76, 105, 98, 114, 97, 114,
				121, 92, 80, 97, 99, 107, 97, 103, 101, 67,
				97, 99, 104, 101, 92, 99, 111, 109, 46, 117,
				110, 105, 116, 121, 46, 116, 101, 120, 116, 109,
				101, 115, 104, 112, 114, 111, 64, 51, 46, 48,
				46, 55, 92, 83, 99, 114, 105, 112, 116, 115,
				92, 82, 117, 110, 116, 105, 109, 101, 92, 84,
				77, 80, 95, 67, 111, 114, 111, 117, 116, 105,
				110, 101, 84, 119, 101, 101, 110, 46, 99, 115,
				0, 0, 0, 2, 0, 0, 0, 88, 92, 76,
				105, 98, 114, 97, 114, 121, 92, 80, 97, 99,
				107, 97, 103, 101, 67, 97, 99, 104, 101, 92,
				99, 111, 109, 46, 117, 110, 105, 116, 121, 46,
				116, 101, 120, 116, 109, 101, 115, 104, 112, 114,
				111, 64, 51, 46, 48, 46, 55, 92, 83, 99,
				114, 105, 112, 116, 115, 92, 82, 117, 110, 116,
				105, 109, 101, 92, 84, 77, 80, 95, 68, 101,
				102, 97, 117, 108, 116, 67, 111, 110, 116, 114,
				111, 108, 115, 46, 99, 115, 0, 0, 0, 5,
				0, 0, 0, 81, 92, 76, 105, 98, 114, 97,
				114, 121, 92, 80, 97, 99, 107, 97, 103, 101,
				67, 97, 99, 104, 101, 92, 99, 111, 109, 46,
				117, 110, 105, 116, 121, 46, 116, 101, 120, 116,
				109, 101, 115, 104, 112, 114, 111, 64, 51, 46,
				48, 46, 55, 92, 83, 99, 114, 105, 112, 116,
				115, 92, 82, 117, 110, 116, 105, 109, 101, 92,
				84, 77, 80, 95, 68, 114, 111, 112, 100, 111,
				119, 110, 46, 99, 115, 0, 0, 0, 1, 0,
				0, 0, 82, 92, 76, 105, 98, 114, 97, 114,
				121, 92, 80, 97, 99, 107, 97, 103, 101, 67,
				97, 99, 104, 101, 92, 99, 111, 109, 46, 117,
				110, 105, 116, 121, 46, 116, 101, 120, 116, 109,
				101, 115, 104, 112, 114, 111, 64, 51, 46, 48,
				46, 55, 92, 83, 99, 114, 105, 112, 116, 115,
				92, 82, 117, 110, 116, 105, 109, 101, 92, 84,
				77, 80, 95, 70, 111, 110, 116, 65, 115, 115,
				101, 116, 46, 99, 115, 0, 0, 0, 9, 0,
				0, 0, 88, 92, 76, 105, 98, 114, 97, 114,
				121, 92, 80, 97, 99, 107, 97, 103, 101, 67,
				97, 99, 104, 101, 92, 99, 111, 109, 46, 117,
				110, 105, 116, 121, 46, 116, 101, 120, 116, 109,
				101, 115, 104, 112, 114, 111, 64, 51, 46, 48,
				46, 55, 92, 83, 99, 114, 105, 112, 116, 115,
				92, 82, 117, 110, 116, 105, 109, 101, 92, 84,
				77, 80, 95, 70, 111, 110, 116, 65, 115, 115,
				101, 116, 67, 111, 109, 109, 111, 110, 46, 99,
				115, 0, 0, 0, 1, 0, 0, 0, 91, 92,
				76, 105, 98, 114, 97, 114, 121, 92, 80, 97,
				99, 107, 97, 103, 101, 67, 97, 99, 104, 101,
				92, 99, 111, 109, 46, 117, 110, 105, 116, 121,
				46, 116, 101, 120, 116, 109, 101, 115, 104, 112,
				114, 111, 64, 51, 46, 48, 46, 55, 92, 83,
				99, 114, 105, 112, 116, 115, 92, 82, 117, 110,
				116, 105, 109, 101, 92, 84, 77, 80, 95, 70,
				111, 110, 116, 65, 115, 115, 101, 116, 85, 116,
				105, 108, 105, 116, 105, 101, 115, 46, 99, 115,
				0, 0, 0, 4, 0, 0, 0, 91, 92, 76,
				105, 98, 114, 97, 114, 121, 92, 80, 97, 99,
				107, 97, 103, 101, 67, 97, 99, 104, 101, 92,
				99, 111, 109, 46, 117, 110, 105, 116, 121, 46,
				116, 101, 120, 116, 109, 101, 115, 104, 112, 114,
				111, 64, 51, 46, 48, 46, 55, 92, 83, 99,
				114, 105, 112, 116, 115, 92, 82, 117, 110, 116,
				105, 109, 101, 92, 84, 77, 80, 95, 70, 111,
				110, 116, 70, 101, 97, 116, 117, 114, 101, 115,
				67, 111, 109, 109, 111, 110, 46, 99, 115, 0,
				0, 0, 1, 0, 0, 0, 89, 92, 76, 105,
				98, 114, 97, 114, 121, 92, 80, 97, 99, 107,
				97, 103, 101, 67, 97, 99, 104, 101, 92, 99,
				111, 109, 46, 117, 110, 105, 116, 121, 46, 116,
				101, 120, 116, 109, 101, 115, 104, 112, 114, 111,
				64, 51, 46, 48, 46, 55, 92, 83, 99, 114,
				105, 112, 116, 115, 92, 82, 117, 110, 116, 105,
				109, 101, 92, 84, 77, 80, 95, 70, 111, 110,
				116, 70, 101, 97, 116, 117, 114, 101, 84, 97,
				98, 108, 101, 46, 99, 115, 0, 0, 0, 7,
				0, 0, 0, 83, 92, 76, 105, 98, 114, 97,
				114, 121, 92, 80, 97, 99, 107, 97, 103, 101,
				67, 97, 99, 104, 101, 92, 99, 111, 109, 46,
				117, 110, 105, 116, 121, 46, 116, 101, 120, 116,
				109, 101, 115, 104, 112, 114, 111, 64, 51, 46,
				48, 46, 55, 92, 83, 99, 114, 105, 112, 116,
				115, 92, 82, 117, 110, 116, 105, 109, 101, 92,
				84, 77, 80, 95, 73, 110, 112, 117, 116, 70,
				105, 101, 108, 100, 46, 99, 115, 0, 0, 0,
				1, 0, 0, 0, 87, 92, 76, 105, 98, 114,
				97, 114, 121, 92, 80, 97, 99, 107, 97, 103,
				101, 67, 97, 99, 104, 101, 92, 99, 111, 109,
				46, 117, 110, 105, 116, 121, 46, 116, 101, 120,
				116, 109, 101, 115, 104, 112, 114, 111, 64, 51,
				46, 48, 46, 55, 92, 83, 99, 114, 105, 112,
				116, 115, 92, 82, 117, 110, 116, 105, 109, 101,
				92, 84, 77, 80, 95, 73, 110, 112, 117, 116,
				86, 97, 108, 105, 100, 97, 116, 111, 114, 46,
				99, 115, 0, 0, 0, 1, 0, 0, 0, 81,
				92, 76, 105, 98, 114, 97, 114, 121, 92, 80,
				97, 99, 107, 97, 103, 101, 67, 97, 99, 104,
				101, 92, 99, 111, 109, 46, 117, 110, 105, 116,
				121, 46, 116, 101, 120, 116, 109, 101, 115, 104,
				112, 114, 111, 64, 51, 46, 48, 46, 55, 92,
				83, 99, 114, 105, 112, 116, 115, 92, 82, 117,
				110, 116, 105, 109, 101, 92, 84, 77, 80, 95,
				76, 105, 110, 101, 73, 110, 102, 111, 46, 99,
				115, 0, 0, 0, 1, 0, 0, 0, 81, 92,
				76, 105, 98, 114, 97, 114, 121, 92, 80, 97,
				99, 107, 97, 103, 101, 67, 97, 99, 104, 101,
				92, 99, 111, 109, 46, 117, 110, 105, 116, 121,
				46, 116, 101, 120, 116, 109, 101, 115, 104, 112,
				114, 111, 64, 51, 46, 48, 46, 55, 92, 83,
				99, 114, 105, 112, 116, 115, 92, 82, 117, 110,
				116, 105, 109, 101, 92, 84, 77, 80, 95, 76,
				105, 115, 116, 80, 111, 111, 108, 46, 99, 115,
				0, 0, 0, 3, 0, 0, 0, 88, 92, 76,
				105, 98, 114, 97, 114, 121, 92, 80, 97, 99,
				107, 97, 103, 101, 67, 97, 99, 104, 101, 92,
				99, 111, 109, 46, 117, 110, 105, 116, 121, 46,
				116, 101, 120, 116, 109, 101, 115, 104, 112, 114,
				111, 64, 51, 46, 48, 46, 55, 92, 83, 99,
				114, 105, 112, 116, 115, 92, 82, 117, 110, 116,
				105, 109, 101, 92, 84, 77, 80, 95, 77, 97,
				116, 101, 114, 105, 97, 108, 77, 97, 110, 97,
				103, 101, 114, 46, 99, 115, 0, 0, 0, 1,
				0, 0, 0, 81, 92, 76, 105, 98, 114, 97,
				114, 121, 92, 80, 97, 99, 107, 97, 103, 101,
				67, 97, 99, 104, 101, 92, 99, 111, 109, 46,
				117, 110, 105, 116, 121, 46, 116, 101, 120, 116,
				109, 101, 115, 104, 112, 114, 111, 64, 51, 46,
				48, 46, 55, 92, 83, 99, 114, 105, 112, 116,
				115, 92, 82, 117, 110, 116, 105, 109, 101, 92,
				84, 77, 80, 95, 77, 101, 115, 104, 73, 110,
				102, 111, 46, 99, 115, 0, 0, 0, 1, 0,
				0, 0, 83, 92, 76, 105, 98, 114, 97, 114,
				121, 92, 80, 97, 99, 107, 97, 103, 101, 67,
				97, 99, 104, 101, 92, 99, 111, 109, 46, 117,
				110, 105, 116, 121, 46, 116, 101, 120, 116, 109,
				101, 115, 104, 112, 114, 111, 64, 51, 46, 48,
				46, 55, 92, 83, 99, 114, 105, 112, 116, 115,
				92, 82, 117, 110, 116, 105, 109, 101, 92, 84,
				77, 80, 95, 79, 98, 106, 101, 99, 116, 80,
				111, 111, 108, 46, 99, 115, 0, 0, 0, 1,
				0, 0, 0, 89, 92, 76, 105, 98, 114, 97,
				114, 121, 92, 80, 97, 99, 107, 97, 103, 101,
				67, 97, 99, 104, 101, 92, 99, 111, 109, 46,
				117, 110, 105, 116, 121, 46, 116, 101, 120, 116,
				109, 101, 115, 104, 112, 114, 111, 64, 51, 46,
				48, 46, 55, 92, 83, 99, 114, 105, 112, 116,
				115, 92, 82, 117, 110, 116, 105, 109, 101, 92,
				84, 77, 80, 95, 82, 101, 115, 111, 117, 114,
				99, 101, 115, 77, 97, 110, 97, 103, 101, 114,
				46, 99, 115, 0, 0, 0, 1, 0, 0, 0,
				91, 92, 76, 105, 98, 114, 97, 114, 121, 92,
				80, 97, 99, 107, 97, 103, 101, 67, 97, 99,
				104, 101, 92, 99, 111, 109, 46, 117, 110, 105,
				116, 121, 46, 116, 101, 120, 116, 109, 101, 115,
				104, 112, 114, 111, 64, 51, 46, 48, 46, 55,
				92, 83, 99, 114, 105, 112, 116, 115, 92, 82,
				117, 110, 116, 105, 109, 101, 92, 84, 77, 80,
				95, 82, 105, 99, 104, 84, 101, 120, 116, 84,
				97, 103, 115, 67, 111, 109, 109, 111, 110, 46,
				99, 115, 0, 0, 0, 1, 0, 0, 0, 94,
				92, 76, 105, 98, 114, 97, 114, 121, 92, 80,
				97, 99, 107, 97, 103, 101, 67, 97, 99, 104,
				101, 92, 99, 111, 109, 46, 117, 110, 105, 116,
				121, 46, 116, 101, 120, 116, 109, 101, 115, 104,
				112, 114, 111, 64, 51, 46, 48, 46, 55, 92,
				83, 99, 114, 105, 112, 116, 115, 92, 82, 117,
				110, 116, 105, 109, 101, 92, 84, 77, 80, 95,
				83, 99, 114, 111, 108, 108, 98, 97, 114, 69,
				118, 101, 110, 116, 72, 97, 110, 100, 108, 101,
				114, 46, 99, 115, 0, 0, 0, 1, 0, 0,
				0, 87, 92, 76, 105, 98, 114, 97, 114, 121,
				92, 80, 97, 99, 107, 97, 103, 101, 67, 97,
				99, 104, 101, 92, 99, 111, 109, 46, 117, 110,
				105, 116, 121, 46, 116, 101, 120, 116, 109, 101,
				115, 104, 112, 114, 111, 64, 51, 46, 48, 46,
				55, 92, 83, 99, 114, 105, 112, 116, 115, 92,
				82, 117, 110, 116, 105, 109, 101, 92, 84, 77,
				80, 95, 83, 101, 108, 101, 99, 116, 105, 111,
				110, 67, 97, 114, 101, 116, 46, 99, 115, 0,
				0, 0, 2, 0, 0, 0, 81, 92, 76, 105,
				98, 114, 97, 114, 121, 92, 80, 97, 99, 107,
				97, 103, 101, 67, 97, 99, 104, 101, 92, 99,
				111, 109, 46, 117, 110, 105, 116, 121, 46, 116,
				101, 120, 116, 109, 101, 115, 104, 112, 114, 111,
				64, 51, 46, 48, 46, 55, 92, 83, 99, 114,
				105, 112, 116, 115, 92, 82, 117, 110, 116, 105,
				109, 101, 92, 84, 77, 80, 95, 83, 101, 116,
				116, 105, 110, 103, 115, 46, 99, 115, 0, 0,
				0, 1, 0, 0, 0, 88, 92, 76, 105, 98,
				114, 97, 114, 121, 92, 80, 97, 99, 107, 97,
				103, 101, 67, 97, 99, 104, 101, 92, 99, 111,
				109, 46, 117, 110, 105, 116, 121, 46, 116, 101,
				120, 116, 109, 101, 115, 104, 112, 114, 111, 64,
				51, 46, 48, 46, 55, 92, 83, 99, 114, 105,
				112, 116, 115, 92, 82, 117, 110, 116, 105, 109,
				101, 92, 84, 77, 80, 95, 83, 104, 97, 100,
				101, 114, 85, 116, 105, 108, 105, 116, 105, 101,
				115, 46, 99, 115, 0, 0, 0, 1, 0, 0,
				0, 79, 92, 76, 105, 98, 114, 97, 114, 121,
				92, 80, 97, 99, 107, 97, 103, 101, 67, 97,
				99, 104, 101, 92, 99, 111, 109, 46, 117, 110,
				105, 116, 121, 46, 116, 101, 120, 116, 109, 101,
				115, 104, 112, 114, 111, 64, 51, 46, 48, 46,
				55, 92, 83, 99, 114, 105, 112, 116, 115, 92,
				82, 117, 110, 116, 105, 109, 101, 92, 84, 77,
				80, 95, 83, 112, 114, 105, 116, 101, 46, 99,
				115, 0, 0, 0, 1, 0, 0, 0, 87, 92,
				76, 105, 98, 114, 97, 114, 121, 92, 80, 97,
				99, 107, 97, 103, 101, 67, 97, 99, 104, 101,
				92, 99, 111, 109, 46, 117, 110, 105, 116, 121,
				46, 116, 101, 120, 116, 109, 101, 115, 104, 112,
				114, 111, 64, 51, 46, 48, 46, 55, 92, 83,
				99, 114, 105, 112, 116, 115, 92, 82, 117, 110,
				116, 105, 109, 101, 92, 84, 77, 80, 95, 83,
				112, 114, 105, 116, 101, 65, 110, 105, 109, 97,
				116, 111, 114, 46, 99, 115, 0, 0, 0, 1,
				0, 0, 0, 84, 92, 76, 105, 98, 114, 97,
				114, 121, 92, 80, 97, 99, 107, 97, 103, 101,
				67, 97, 99, 104, 101, 92, 99, 111, 109, 46,
				117, 110, 105, 116, 121, 46, 116, 101, 120, 116,
				109, 101, 115, 104, 112, 114, 111, 64, 51, 46,
				48, 46, 55, 92, 83, 99, 114, 105, 112, 116,
				115, 92, 82, 117, 110, 116, 105, 109, 101, 92,
				84, 77, 80, 95, 83, 112, 114, 105, 116, 101,
				65, 115, 115, 101, 116, 46, 99, 115, 0, 0,
				0, 6, 0, 0, 0, 97, 92, 76, 105, 98,
				114, 97, 114, 121, 92, 80, 97, 99, 107, 97,
				103, 101, 67, 97, 99, 104, 101, 92, 99, 111,
				109, 46, 117, 110, 105, 116, 121, 46, 116, 101,
				120, 116, 109, 101, 115, 104, 112, 114, 111, 64,
				51, 46, 48, 46, 55, 92, 83, 99, 114, 105,
				112, 116, 115, 92, 82, 117, 110, 116, 105, 109,
				101, 92, 84, 77, 80, 95, 83, 112, 114, 105,
				116, 101, 65, 115, 115, 101, 116, 73, 109, 112,
				111, 114, 116, 70, 111, 114, 109, 97, 116, 115,
				46, 99, 115, 0, 0, 0, 1, 0, 0, 0,
				88, 92, 76, 105, 98, 114, 97, 114, 121, 92,
				80, 97, 99, 107, 97, 103, 101, 67, 97, 99,
				104, 101, 92, 99, 111, 109, 46, 117, 110, 105,
				116, 121, 46, 116, 101, 120, 116, 109, 101, 115,
				104, 112, 114, 111, 64, 51, 46, 48, 46, 55,
				92, 83, 99, 114, 105, 112, 116, 115, 92, 82,
				117, 110, 116, 105, 109, 101, 92, 84, 77, 80,
				95, 83, 112, 114, 105, 116, 101, 67, 104, 97,
				114, 97, 99, 116, 101, 114, 46, 99, 115, 0,
				0, 0, 1, 0, 0, 0, 84, 92, 76, 105,
				98, 114, 97, 114, 121, 92, 80, 97, 99, 107,
				97, 103, 101, 67, 97, 99, 104, 101, 92, 99,
				111, 109, 46, 117, 110, 105, 116, 121, 46, 116,
				101, 120, 116, 109, 101, 115, 104, 112, 114, 111,
				64, 51, 46, 48, 46, 55, 92, 83, 99, 114,
				105, 112, 116, 115, 92, 82, 117, 110, 116, 105,
				109, 101, 92, 84, 77, 80, 95, 83, 112, 114,
				105, 116, 101, 71, 108, 121, 112, 104, 46, 99,
				115, 0, 0, 0, 1, 0, 0, 0, 78, 92,
				76, 105, 98, 114, 97, 114, 121, 92, 80, 97,
				99, 107, 97, 103, 101, 67, 97, 99, 104, 101,
				92, 99, 111, 109, 46, 117, 110, 105, 116, 121,
				46, 116, 101, 120, 116, 109, 101, 115, 104, 112,
				114, 111, 64, 51, 46, 48, 46, 55, 92, 83,
				99, 114, 105, 112, 116, 115, 92, 82, 117, 110,
				116, 105, 109, 101, 92, 84, 77, 80, 95, 83,
				116, 121, 108, 101, 46, 99, 115, 0, 0, 0,
				1, 0, 0, 0, 83, 92, 76, 105, 98, 114,
				97, 114, 121, 92, 80, 97, 99, 107, 97, 103,
				101, 67, 97, 99, 104, 101, 92, 99, 111, 109,
				46, 117, 110, 105, 116, 121, 46, 116, 101, 120,
				116, 109, 101, 115, 104, 112, 114, 111, 64, 51,
				46, 48, 46, 55, 92, 83, 99, 114, 105, 112,
				116, 115, 92, 82, 117, 110, 116, 105, 109, 101,
				92, 84, 77, 80, 95, 83, 116, 121, 108, 101,
				83, 104, 101, 101, 116, 46, 99, 115, 0, 0,
				0, 1, 0, 0, 0, 80, 92, 76, 105, 98,
				114, 97, 114, 121, 92, 80, 97, 99, 107, 97,
				103, 101, 67, 97, 99, 104, 101, 92, 99, 111,
				109, 46, 117, 110, 105, 116, 121, 46, 116, 101,
				120, 116, 109, 101, 115, 104, 112, 114, 111, 64,
				51, 46, 48, 46, 55, 92, 83, 99, 114, 105,
				112, 116, 115, 92, 82, 117, 110, 116, 105, 109,
				101, 92, 84, 77, 80, 95, 83, 117, 98, 77,
				101, 115, 104, 46, 99, 115, 0, 0, 0, 1,
				0, 0, 0, 82, 92, 76, 105, 98, 114, 97,
				114, 121, 92, 80, 97, 99, 107, 97, 103, 101,
				67, 97, 99, 104, 101, 92, 99, 111, 109, 46,
				117, 110, 105, 116, 121, 46, 116, 101, 120, 116,
				109, 101, 115, 104, 112, 114, 111, 64, 51, 46,
				48, 46, 55, 92, 83, 99, 114, 105, 112, 116,
				115, 92, 82, 117, 110, 116, 105, 109, 101, 92,
				84, 77, 80, 95, 83, 117, 98, 77, 101, 115,
				104, 85, 73, 46, 99, 115, 0, 0, 0, 6,
				0, 0, 0, 77, 92, 76, 105, 98, 114, 97,
				114, 121, 92, 80, 97, 99, 107, 97, 103, 101,
				67, 97, 99, 104, 101, 92, 99, 111, 109, 46,
				117, 110, 105, 116, 121, 46, 116, 101, 120, 116,
				109, 101, 115, 104, 112, 114, 111, 64, 51, 46,
				48, 46, 55, 92, 83, 99, 114, 105, 112, 116,
				115, 92, 82, 117, 110, 116, 105, 109, 101, 92,
				84, 77, 80, 95, 84, 101, 120, 116, 46, 99,
				115, 0, 0, 0, 1, 0, 0, 0, 84, 92,
				76, 105, 98, 114, 97, 114, 121, 92, 80, 97,
				99, 107, 97, 103, 101, 67, 97, 99, 104, 101,
				92, 99, 111, 109, 46, 117, 110, 105, 116, 121,
				46, 116, 101, 120, 116, 109, 101, 115, 104, 112,
				114, 111, 64, 51, 46, 48, 46, 55, 92, 83,
				99, 114, 105, 112, 116, 115, 92, 82, 117, 110,
				116, 105, 109, 101, 92, 84, 77, 80, 95, 84,
				101, 120, 116, 69, 108, 101, 109, 101, 110, 116,
				46, 99, 115, 0, 0, 0, 1, 0, 0, 0,
				91, 92, 76, 105, 98, 114, 97, 114, 121, 92,
				80, 97, 99, 107, 97, 103, 101, 67, 97, 99,
				104, 101, 92, 99, 111, 109, 46, 117, 110, 105,
				116, 121, 46, 116, 101, 120, 116, 109, 101, 115,
				104, 112, 114, 111, 64, 51, 46, 48, 46, 55,
				92, 83, 99, 114, 105, 112, 116, 115, 92, 82,
				117, 110, 116, 105, 109, 101, 92, 84, 77, 80,
				95, 84, 101, 120, 116, 69, 108, 101, 109, 101,
				110, 116, 95, 76, 101, 103, 97, 99, 121, 46,
				99, 115, 0, 0, 0, 1, 0, 0, 0, 81,
				92, 76, 105, 98, 114, 97, 114, 121, 92, 80,
				97, 99, 107, 97, 103, 101, 67, 97, 99, 104,
				101, 92, 99, 111, 109, 46, 117, 110, 105, 116,
				121, 46, 116, 101, 120, 116, 109, 101, 115, 104,
				112, 114, 111, 64, 51, 46, 48, 46, 55, 92,
				83, 99, 114, 105, 112, 116, 115, 92, 82, 117,
				110, 116, 105, 109, 101, 92, 84, 77, 80, 95,
				84, 101, 120, 116, 73, 110, 102, 111, 46, 99,
				115, 0, 0, 0, 1, 0, 0, 0, 93, 92,
				76, 105, 98, 114, 97, 114, 121, 92, 80, 97,
				99, 107, 97, 103, 101, 67, 97, 99, 104, 101,
				92, 99, 111, 109, 46, 117, 110, 105, 116, 121,
				46, 116, 101, 120, 116, 109, 101, 115, 104, 112,
				114, 111, 64, 51, 46, 48, 46, 55, 92, 83,
				99, 114, 105, 112, 116, 115, 92, 82, 117, 110,
				116, 105, 109, 101, 92, 84, 77, 80, 95, 84,
				101, 120, 116, 80, 97, 114, 115, 105, 110, 103,
				85, 116, 105, 108, 105, 116, 105, 101, 115, 46,
				99, 115, 0, 0, 0, 2, 0, 0, 0, 92,
				92, 76, 105, 98, 114, 97, 114, 121, 92, 80,
				97, 99, 107, 97, 103, 101, 67, 97, 99, 104,
				101, 92, 99, 111, 109, 46, 117, 110, 105, 116,
				121, 46, 116, 101, 120, 116, 109, 101, 115, 104,
				112, 114, 111, 64, 51, 46, 48, 46, 55, 92,
				83, 99, 114, 105, 112, 116, 115, 92, 82, 117,
				110, 116, 105, 109, 101, 92, 84, 77, 80, 95,
				84, 101, 120, 116, 80, 114, 111, 99, 101, 115,
				115, 105, 110, 103, 83, 116, 97, 99, 107, 46,
				99, 115, 0, 0, 0, 3, 0, 0, 0, 86,
				92, 76, 105, 98, 114, 97, 114, 121, 92, 80,
				97, 99, 107, 97, 103, 101, 67, 97, 99, 104,
				101, 92, 99, 111, 109, 46, 117, 110, 105, 116,
				121, 46, 116, 101, 120, 116, 109, 101, 115, 104,
				112, 114, 111, 64, 51, 46, 48, 46, 55, 92,
				83, 99, 114, 105, 112, 116, 115, 92, 82, 117,
				110, 116, 105, 109, 101, 92, 84, 77, 80, 95,
				84, 101, 120, 116, 85, 116, 105, 108, 105, 116,
				105, 101, 115, 46, 99, 115, 0, 0, 0, 1,
				0, 0, 0, 86, 92, 76, 105, 98, 114, 97,
				114, 121, 92, 80, 97, 99, 107, 97, 103, 101,
				67, 97, 99, 104, 101, 92, 99, 111, 109, 46,
				117, 110, 105, 116, 121, 46, 116, 101, 120, 116,
				109, 101, 115, 104, 112, 114, 111, 64, 51, 46,
				48, 46, 55, 92, 83, 99, 114, 105, 112, 116,
				115, 92, 82, 117, 110, 116, 105, 109, 101, 92,
				84, 77, 80, 95, 85, 112, 100, 97, 116, 101,
				77, 97, 110, 97, 103, 101, 114, 46, 99, 115,
				0, 0, 0, 1, 0, 0, 0, 88, 92, 76,
				105, 98, 114, 97, 114, 121, 92, 80, 97, 99,
				107, 97, 103, 101, 67, 97, 99, 104, 101, 92,
				99, 111, 109, 46, 117, 110, 105, 116, 121, 46,
				116, 101, 120, 116, 109, 101, 115, 104, 112, 114,
				111, 64, 51, 46, 48, 46, 55, 92, 83, 99,
				114, 105, 112, 116, 115, 92, 82, 117, 110, 116,
				105, 109, 101, 92, 84, 77, 80, 95, 85, 112,
				100, 97, 116, 101, 82, 101, 103, 105, 115, 116,
				101, 114, 121, 46, 99, 115
			},
			TypesData = new byte[3551]
			{
				1, 0, 0, 0, 16, 84, 77, 80, 114, 111,
				124, 70, 97, 115, 116, 65, 99, 116, 105, 111,
				110, 1, 0, 0, 0, 16, 84, 77, 80, 114,
				111, 124, 70, 97, 115, 116, 65, 99, 116, 105,
				111, 110, 1, 0, 0, 0, 16, 84, 77, 80,
				114, 111, 124, 70, 97, 115, 116, 65, 99, 116,
				105, 111, 110, 1, 0, 0, 0, 16, 84, 77,
				80, 114, 111, 124, 70, 97, 115, 116, 65, 99,
				116, 105, 111, 110, 0, 0, 0, 0, 23, 84,
				77, 80, 114, 111, 124, 73, 84, 101, 120, 116,
				80, 114, 101, 112, 114, 111, 99, 101, 115, 115,
				111, 114, 0, 0, 0, 0, 30, 84, 77, 80,
				114, 111, 124, 77, 97, 116, 101, 114, 105, 97,
				108, 82, 101, 102, 101, 114, 101, 110, 99, 101,
				77, 97, 110, 97, 103, 101, 114, 0, 0, 0,
				0, 27, 84, 77, 80, 114, 111, 124, 84, 77,
				80, 95, 77, 97, 116, 101, 114, 105, 97, 108,
				82, 101, 102, 101, 114, 101, 110, 99, 101, 0,
				0, 0, 0, 23, 84, 77, 80, 114, 111, 124,
				77, 97, 116, 101, 114, 105, 97, 108, 82, 101,
				102, 101, 114, 101, 110, 99, 101, 0, 0, 0,
				0, 19, 84, 77, 80, 114, 111, 124, 84, 101,
				120, 116, 67, 111, 110, 116, 97, 105, 110, 101,
				114, 1, 0, 0, 0, 17, 84, 77, 80, 114,
				111, 124, 84, 101, 120, 116, 77, 101, 115, 104,
				80, 114, 111, 1, 0, 0, 0, 21, 84, 77,
				80, 114, 111, 124, 84, 101, 120, 116, 77, 101,
				115, 104, 80, 114, 111, 85, 71, 85, 73, 0,
				0, 0, 0, 24, 84, 77, 80, 114, 111, 124,
				84, 77, 80, 114, 111, 95, 69, 118, 101, 110,
				116, 77, 97, 110, 97, 103, 101, 114, 0, 0,
				0, 0, 26, 84, 77, 80, 114, 111, 124, 67,
				111, 109, 112, 117, 116, 101, 95, 68, 84, 95,
				69, 118, 101, 110, 116, 65, 114, 103, 115, 0,
				0, 0, 0, 28, 84, 77, 80, 114, 111, 124,
				84, 77, 80, 114, 111, 95, 69, 120, 116, 101,
				110, 115, 105, 111, 110, 77, 101, 116, 104, 111,
				100, 115, 0, 0, 0, 0, 14, 84, 77, 80,
				114, 111, 124, 84, 77, 80, 95, 77, 97, 116,
				104, 0, 0, 0, 0, 20, 84, 77, 80, 114,
				111, 124, 86, 101, 114, 116, 101, 120, 71, 114,
				97, 100, 105, 101, 110, 116, 0, 0, 0, 0,
				18, 84, 77, 80, 114, 111, 124, 84, 77, 80,
				95, 80, 97, 103, 101, 73, 110, 102, 111, 0,
				0, 0, 0, 18, 84, 77, 80, 114, 111, 124,
				84, 77, 80, 95, 76, 105, 110, 107, 73, 110,
				102, 111, 0, 0, 0, 0, 18, 84, 77, 80,
				114, 111, 124, 84, 77, 80, 95, 87, 111, 114,
				100, 73, 110, 102, 111, 0, 0, 0, 0, 20,
				84, 77, 80, 114, 111, 124, 84, 77, 80, 95,
				83, 112, 114, 105, 116, 101, 73, 110, 102, 111,
				0, 0, 0, 0, 13, 84, 77, 80, 114, 111,
				124, 69, 120, 116, 101, 110, 116, 115, 0, 0,
				0, 0, 18, 84, 77, 80, 114, 111, 124, 77,
				101, 115, 104, 95, 69, 120, 116, 101, 110, 116,
				115, 0, 0, 0, 0, 19, 84, 77, 80, 114,
				111, 124, 87, 111, 114, 100, 87, 114, 97, 112,
				83, 116, 97, 116, 101, 0, 0, 0, 0, 18,
				84, 77, 80, 114, 111, 124, 84, 97, 103, 65,
				116, 116, 114, 105, 98, 117, 116, 101, 0, 0,
				0, 0, 26, 84, 77, 80, 114, 111, 124, 82,
				105, 99, 104, 84, 101, 120, 116, 84, 97, 103,
				65, 116, 116, 114, 105, 98, 117, 116, 101, 1,
				0, 0, 0, 17, 84, 77, 80, 114, 111, 124,
				84, 101, 120, 116, 77, 101, 115, 104, 80, 114,
				111, 1, 0, 0, 0, 21, 84, 77, 80, 114,
				111, 124, 84, 101, 120, 116, 77, 101, 115, 104,
				80, 114, 111, 85, 71, 85, 73, 0, 0, 0,
				0, 15, 84, 77, 80, 114, 111, 124, 84, 77,
				80, 95, 65, 115, 115, 101, 116, 0, 0, 0,
				0, 19, 84, 77, 80, 114, 111, 124, 84, 77,
				80, 95, 67, 104, 97, 114, 97, 99, 116, 101,
				114, 0, 0, 0, 0, 16, 84, 77, 80, 114,
				111, 124, 84, 77, 80, 95, 86, 101, 114, 116,
				101, 120, 0, 0, 0, 0, 16, 84, 77, 80,
				114, 111, 124, 84, 77, 80, 95, 79, 102, 102,
				115, 101, 116, 0, 0, 0, 0, 20, 84, 77,
				80, 114, 111, 124, 72, 105, 103, 104, 108, 105,
				103, 104, 116, 83, 116, 97, 116, 101, 0, 0,
				0, 0, 23, 84, 77, 80, 114, 111, 124, 84,
				77, 80, 95, 67, 104, 97, 114, 97, 99, 116,
				101, 114, 73, 110, 102, 111, 0, 0, 0, 0,
				23, 84, 77, 80, 114, 111, 124, 84, 77, 80,
				95, 67, 111, 108, 111, 114, 71, 114, 97, 100,
				105, 101, 110, 116, 0, 0, 0, 0, 23, 84,
				77, 80, 114, 111, 124, 84, 77, 80, 95, 67,
				111, 109, 112, 97, 116, 105, 98, 105, 108, 105,
				116, 121, 0, 0, 0, 0, 17, 84, 77, 80,
				114, 111, 124, 73, 84, 119, 101, 101, 110, 86,
				97, 108, 117, 101, 0, 0, 0, 0, 16, 84,
				77, 80, 114, 111, 124, 67, 111, 108, 111, 114,
				84, 119, 101, 101, 110, 0, 0, 0, 0, 25,
				84, 77, 80, 114, 111, 46, 124, 67, 111, 108,
				111, 114, 84, 119, 101, 101, 110, 67, 97, 108,
				108, 98, 97, 99, 107, 0, 0, 0, 0, 16,
				84, 77, 80, 114, 111, 124, 70, 108, 111, 97,
				116, 84, 119, 101, 101, 110, 0, 0, 0, 0,
				25, 84, 77, 80, 114, 111, 46, 124, 70, 108,
				111, 97, 116, 84, 119, 101, 101, 110, 67, 97,
				108, 108, 98, 97, 99, 107, 0, 0, 0, 0,
				17, 84, 77, 80, 114, 111, 124, 84, 119, 101,
				101, 110, 82, 117, 110, 110, 101, 114, 0, 0,
				0, 0, 25, 84, 77, 80, 114, 111, 124, 84,
				77, 80, 95, 68, 101, 102, 97, 117, 108, 116,
				67, 111, 110, 116, 114, 111, 108, 115, 0, 0,
				0, 0, 35, 84, 77, 80, 114, 111, 46, 84,
				77, 80, 95, 68, 101, 102, 97, 117, 108, 116,
				67, 111, 110, 116, 114, 111, 108, 115, 124, 82,
				101, 115, 111, 117, 114, 99, 101, 115, 0, 0,
				0, 0, 18, 84, 77, 80, 114, 111, 124, 84,
				77, 80, 95, 68, 114, 111, 112, 100, 111, 119,
				110, 0, 0, 0, 0, 31, 84, 77, 80, 114,
				111, 46, 84, 77, 80, 95, 68, 114, 111, 112,
				100, 111, 119, 110, 124, 68, 114, 111, 112, 100,
				111, 119, 110, 73, 116, 101, 109, 0, 0, 0,
				0, 29, 84, 77, 80, 114, 111, 46, 84, 77,
				80, 95, 68, 114, 111, 112, 100, 111, 119, 110,
				124, 79, 112, 116, 105, 111, 110, 68, 97, 116,
				97, 0, 0, 0, 0, 33, 84, 77, 80, 114,
				111, 46, 84, 77, 80, 95, 68, 114, 111, 112,
				100, 111, 119, 110, 124, 79, 112, 116, 105, 111,
				110, 68, 97, 116, 97, 76, 105, 115, 116, 0,
				0, 0, 0, 32, 84, 77, 80, 114, 111, 46,
				84, 77, 80, 95, 68, 114, 111, 112, 100, 111,
				119, 110, 124, 68, 114, 111, 112, 100, 111, 119,
				110, 69, 118, 101, 110, 116, 0, 0, 0, 0,
				19, 84, 77, 80, 114, 111, 124, 84, 77, 80,
				95, 70, 111, 110, 116, 65, 115, 115, 101, 116,
				0, 0, 0, 0, 21, 84, 77, 80, 114, 111,
				124, 70, 97, 99, 101, 73, 110, 102, 111, 95,
				76, 101, 103, 97, 99, 121, 0, 0, 0, 0,
				15, 84, 77, 80, 114, 111, 124, 84, 77, 80,
				95, 71, 108, 121, 112, 104, 0, 0, 0, 0,
				31, 84, 77, 80, 114, 111, 124, 70, 111, 110,
				116, 65, 115, 115, 101, 116, 67, 114, 101, 97,
				116, 105, 111, 110, 83, 101, 116, 116, 105, 110,
				103, 115, 0, 0, 0, 0, 24, 84, 77, 80,
				114, 111, 124, 84, 77, 80, 95, 70, 111, 110,
				116, 87, 101, 105, 103, 104, 116, 80, 97, 105,
				114, 0, 0, 0, 0, 20, 84, 77, 80, 114,
				111, 124, 75, 101, 114, 110, 105, 110, 103, 80,
				97, 105, 114, 75, 101, 121, 0, 0, 0, 0,
				29, 84, 77, 80, 114, 111, 124, 71, 108, 121,
				112, 104, 86, 97, 108, 117, 101, 82, 101, 99,
				111, 114, 100, 95, 76, 101, 103, 97, 99, 121,
				0, 0, 0, 0, 17, 84, 77, 80, 114, 111,
				124, 75, 101, 114, 110, 105, 110, 103, 80, 97,
				105, 114, 0, 0, 0, 0, 18, 84, 77, 80,
				114, 111, 124, 75, 101, 114, 110, 105, 110, 103,
				84, 97, 98, 108, 101, 0, 0, 0, 0, 23,
				84, 77, 80, 114, 111, 124, 84, 77, 80, 95,
				70, 111, 110, 116, 85, 116, 105, 108, 105, 116,
				105, 101, 115, 0, 0, 0, 0, 28, 84, 77,
				80, 114, 111, 124, 84, 77, 80, 95, 70, 111,
				110, 116, 65, 115, 115, 101, 116, 85, 116, 105,
				108, 105, 116, 105, 101, 115, 0, 0, 0, 0,
				26, 84, 77, 80, 114, 111, 124, 84, 77, 80,
				95, 71, 108, 121, 112, 104, 86, 97, 108, 117,
				101, 82, 101, 99, 111, 114, 100, 0, 0, 0,
				0, 31, 84, 77, 80, 114, 111, 124, 84, 77,
				80, 95, 71, 108, 121, 112, 104, 65, 100, 106,
				117, 115, 116, 109, 101, 110, 116, 82, 101, 99,
				111, 114, 100, 0, 0, 0, 0, 35, 84, 77,
				80, 114, 111, 124, 84, 77, 80, 95, 71, 108,
				121, 112, 104, 80, 97, 105, 114, 65, 100, 106,
				117, 115, 116, 109, 101, 110, 116, 82, 101, 99,
				111, 114, 100, 0, 0, 0, 0, 18, 84, 77,
				80, 114, 111, 124, 71, 108, 121, 112, 104, 80,
				97, 105, 114, 75, 101, 121, 0, 0, 0, 0,
				26, 84, 77, 80, 114, 111, 124, 84, 77, 80,
				95, 70, 111, 110, 116, 70, 101, 97, 116, 117,
				114, 101, 84, 97, 98, 108, 101, 0, 0, 0,
				0, 20, 84, 77, 80, 114, 111, 124, 84, 77,
				80, 95, 73, 110, 112, 117, 116, 70, 105, 101,
				108, 100, 0, 0, 0, 0, 32, 84, 77, 80,
				114, 111, 46, 84, 77, 80, 95, 73, 110, 112,
				117, 116, 70, 105, 101, 108, 100, 124, 83, 117,
				98, 109, 105, 116, 69, 118, 101, 110, 116, 0,
				0, 0, 0, 34, 84, 77, 80, 114, 111, 46,
				84, 77, 80, 95, 73, 110, 112, 117, 116, 70,
				105, 101, 108, 100, 124, 79, 110, 67, 104, 97,
				110, 103, 101, 69, 118, 101, 110, 116, 0, 0,
				0, 0, 35, 84, 77, 80, 114, 111, 46, 84,
				77, 80, 95, 73, 110, 112, 117, 116, 70, 105,
				101, 108, 100, 124, 83, 101, 108, 101, 99, 116,
				105, 111, 110, 69, 118, 101, 110, 116, 0, 0,
				0, 0, 39, 84, 77, 80, 114, 111, 46, 84,
				77, 80, 95, 73, 110, 112, 117, 116, 70, 105,
				101, 108, 100, 124, 84, 101, 120, 116, 83, 101,
				108, 101, 99, 116, 105, 111, 110, 69, 118, 101,
				110, 116, 0, 0, 0, 0, 45, 84, 77, 80,
				114, 111, 46, 84, 77, 80, 95, 73, 110, 112,
				117, 116, 70, 105, 101, 108, 100, 124, 84, 111,
				117, 99, 104, 83, 99, 114, 101, 101, 110, 75,
				101, 121, 98, 111, 97, 114, 100, 69, 118, 101,
				110, 116, 0, 0, 0, 0, 24, 84, 77, 80,
				114, 111, 124, 83, 101, 116, 80, 114, 111, 112,
				101, 114, 116, 121, 85, 116, 105, 108, 105, 116,
				121, 0, 0, 0, 0, 24, 84, 77, 80, 114,
				111, 124, 84, 77, 80, 95, 73, 110, 112, 117,
				116, 86, 97, 108, 105, 100, 97, 116, 111, 114,
				0, 0, 0, 0, 18, 84, 77, 80, 114, 111,
				124, 84, 77, 80, 95, 76, 105, 110, 101, 73,
				110, 102, 111, 0, 0, 0, 0, 18, 84, 77,
				80, 114, 111, 124, 84, 77, 80, 95, 76, 105,
				115, 116, 80, 111, 111, 108, 0, 0, 0, 0,
				25, 84, 77, 80, 114, 111, 124, 84, 77, 80,
				95, 77, 97, 116, 101, 114, 105, 97, 108, 77,
				97, 110, 97, 103, 101, 114, 0, 0, 0, 0,
				42, 84, 77, 80, 114, 111, 46, 84, 77, 80,
				95, 77, 97, 116, 101, 114, 105, 97, 108, 77,
				97, 110, 97, 103, 101, 114, 124, 70, 97, 108,
				108, 98, 97, 99, 107, 77, 97, 116, 101, 114,
				105, 97, 108, 0, 0, 0, 0, 41, 84, 77,
				80, 114, 111, 46, 84, 77, 80, 95, 77, 97,
				116, 101, 114, 105, 97, 108, 77, 97, 110, 97,
				103, 101, 114, 124, 77, 97, 115, 107, 105, 110,
				103, 77, 97, 116, 101, 114, 105, 97, 108, 0,
				0, 0, 0, 18, 84, 77, 80, 114, 111, 124,
				84, 77, 80, 95, 77, 101, 115, 104, 73, 110,
				102, 111, 0, 0, 0, 0, 20, 84, 77, 80,
				114, 111, 124, 84, 77, 80, 95, 79, 98, 106,
				101, 99, 116, 80, 111, 111, 108, 0, 0, 0,
				0, 25, 84, 77, 80, 114, 111, 124, 84, 77,
				80, 95, 82, 101, 115, 111, 117, 114, 99, 101,
				77, 97, 110, 97, 103, 101, 114, 0, 0, 0,
				0, 15, 84, 77, 80, 114, 111, 124, 67, 111,
				100, 101, 80, 111, 105, 110, 116, 0, 0, 0,
				0, 31, 84, 77, 80, 114, 111, 124, 84, 77,
				80, 95, 83, 99, 114, 111, 108, 108, 98, 97,
				114, 69, 118, 101, 110, 116, 72, 97, 110, 100,
				108, 101, 114, 0, 0, 0, 0, 24, 84, 77,
				80, 114, 111, 124, 84, 77, 80, 95, 83, 101,
				108, 101, 99, 116, 105, 111, 110, 67, 97, 114,
				101, 116, 0, 0, 0, 0, 18, 84, 77, 80,
				114, 111, 124, 84, 77, 80, 95, 83, 101, 116,
				116, 105, 110, 103, 115, 0, 0, 0, 0, 36,
				84, 77, 80, 114, 111, 46, 84, 77, 80, 95,
				83, 101, 116, 116, 105, 110, 103, 115, 124, 76,
				105, 110, 101, 66, 114, 101, 97, 107, 105, 110,
				103, 84, 97, 98, 108, 101, 0, 0, 0, 0,
				21, 84, 77, 80, 114, 111, 124, 83, 104, 97,
				100, 101, 114, 85, 116, 105, 108, 105, 116, 105,
				101, 115, 0, 0, 0, 0, 16, 84, 77, 80,
				114, 111, 124, 84, 77, 80, 95, 83, 112, 114,
				105, 116, 101, 0, 0, 0, 0, 24, 84, 77,
				80, 114, 111, 124, 84, 77, 80, 95, 83, 112,
				114, 105, 116, 101, 65, 110, 105, 109, 97, 116,
				111, 114, 0, 0, 0, 0, 21, 84, 77, 80,
				114, 111, 124, 84, 77, 80, 95, 83, 112, 114,
				105, 116, 101, 65, 115, 115, 101, 116, 0, 0,
				0, 0, 50, 84, 77, 80, 114, 111, 46, 83,
				112, 114, 105, 116, 101, 65, 115, 115, 101, 116,
				85, 116, 105, 108, 105, 116, 105, 101, 115, 124,
				84, 101, 120, 116, 117, 114, 101, 80, 97, 99,
				107, 101, 114, 95, 74, 115, 111, 110, 65, 114,
				114, 97, 121, 0, 0, 0, 0, 62, 84, 77,
				80, 114, 111, 46, 83, 112, 114, 105, 116, 101,
				65, 115, 115, 101, 116, 85, 116, 105, 108, 105,
				116, 105, 101, 115, 46, 84, 101, 120, 116, 117,
				114, 101, 80, 97, 99, 107, 101, 114, 95, 74,
				115, 111, 110, 65, 114, 114, 97, 121, 124, 83,
				112, 114, 105, 116, 101, 70, 114, 97, 109, 101,
				0, 0, 0, 0, 61, 84, 77, 80, 114, 111,
				46, 83, 112, 114, 105, 116, 101, 65, 115, 115,
				101, 116, 85, 116, 105, 108, 105, 116, 105, 101,
				115, 46, 84, 101, 120, 116, 117, 114, 101, 80,
				97, 99, 107, 101, 114, 95, 74, 115, 111, 110,
				65, 114, 114, 97, 121, 124, 83, 112, 114, 105,
				116, 101, 83, 105, 122, 101, 0, 0, 0, 0,
				56, 84, 77, 80, 114, 111, 46, 83, 112, 114,
				105, 116, 101, 65, 115, 115, 101, 116, 85, 116,
				105, 108, 105, 116, 105, 101, 115, 46, 84, 101,
				120, 116, 117, 114, 101, 80, 97, 99, 107, 101,
				114, 95, 74, 115, 111, 110, 65, 114, 114, 97,
				121, 124, 70, 114, 97, 109, 101, 0, 0, 0,
				0, 55, 84, 77, 80, 114, 111, 46, 83, 112,
				114, 105, 116, 101, 65, 115, 115, 101, 116, 85,
				116, 105, 108, 105, 116, 105, 101, 115, 46, 84,
				101, 120, 116, 117, 114, 101, 80, 97, 99, 107,
				101, 114, 95, 74, 115, 111, 110, 65, 114, 114,
				97, 121, 124, 77, 101, 116, 97, 0, 0, 0,
				0, 67, 84, 77, 80, 114, 111, 46, 83, 112,
				114, 105, 116, 101, 65, 115, 115, 101, 116, 85,
				116, 105, 108, 105, 116, 105, 101, 115, 46, 84,
				101, 120, 116, 117, 114, 101, 80, 97, 99, 107,
				101, 114, 95, 74, 115, 111, 110, 65, 114, 114,
				97, 121, 124, 83, 112, 114, 105, 116, 101, 68,
				97, 116, 97, 79, 98, 106, 101, 99, 116, 0,
				0, 0, 0, 25, 84, 77, 80, 114, 111, 124,
				84, 77, 80, 95, 83, 112, 114, 105, 116, 101,
				67, 104, 97, 114, 97, 99, 116, 101, 114, 0,
				0, 0, 0, 21, 84, 77, 80, 114, 111, 124,
				84, 77, 80, 95, 83, 112, 114, 105, 116, 101,
				71, 108, 121, 112, 104, 0, 0, 0, 0, 15,
				84, 77, 80, 114, 111, 124, 84, 77, 80, 95,
				83, 116, 121, 108, 101, 0, 0, 0, 0, 20,
				84, 77, 80, 114, 111, 124, 84, 77, 80, 95,
				83, 116, 121, 108, 101, 83, 104, 101, 101, 116,
				0, 0, 0, 0, 17, 84, 77, 80, 114, 111,
				124, 84, 77, 80, 95, 83, 117, 98, 77, 101,
				115, 104, 0, 0, 0, 0, 19, 84, 77, 80,
				114, 111, 124, 84, 77, 80, 95, 83, 117, 98,
				77, 101, 115, 104, 85, 73, 0, 0, 0, 0,
				18, 84, 77, 80, 114, 111, 124, 73, 84, 101,
				120, 116, 69, 108, 101, 109, 101, 110, 116, 0,
				0, 0, 0, 14, 84, 77, 80, 114, 111, 124,
				84, 77, 80, 95, 84, 101, 120, 116, 0, 0,
				0, 0, 36, 84, 77, 80, 114, 111, 46, 84,
				77, 80, 95, 84, 101, 120, 116, 124, 67, 104,
				97, 114, 97, 99, 116, 101, 114, 83, 117, 98,
				115, 116, 105, 116, 117, 116, 105, 111, 110, 0,
				0, 0, 0, 26, 84, 77, 80, 114, 111, 46,
				84, 77, 80, 95, 84, 101, 120, 116, 124, 85,
				110, 105, 99, 111, 100, 101, 67, 104, 97, 114,
				0, 0, 0, 0, 31, 84, 77, 80, 114, 111,
				46, 84, 77, 80, 95, 84, 101, 120, 116, 124,
				83, 112, 101, 99, 105, 97, 108, 67, 104, 97,
				114, 97, 99, 116, 101, 114, 0, 0, 0, 0,
				35, 84, 77, 80, 114, 111, 46, 84, 77, 80,
				95, 84, 101, 120, 116, 124, 84, 101, 120, 116,
				66, 97, 99, 107, 105, 110, 103, 67, 111, 110,
				116, 97, 105, 110, 101, 114, 0, 0, 0, 0,
				21, 84, 77, 80, 114, 111, 124, 84, 77, 80,
				95, 84, 101, 120, 116, 69, 108, 101, 109, 101,
				110, 116, 0, 0, 0, 0, 28, 84, 77, 80,
				114, 111, 124, 84, 77, 80, 95, 84, 101, 120,
				116, 69, 108, 101, 109, 101, 110, 116, 95, 76,
				101, 103, 97, 99, 121, 0, 0, 0, 0, 18,
				84, 77, 80, 114, 111, 124, 84, 77, 80, 95,
				84, 101, 120, 116, 73, 110, 102, 111, 0, 0,
				0, 0, 30, 84, 77, 80, 114, 111, 124, 84,
				77, 80, 95, 84, 101, 120, 116, 80, 97, 114,
				115, 105, 110, 103, 85, 116, 105, 108, 105, 116,
				105, 101, 115, 0, 0, 0, 0, 24, 84, 77,
				80, 114, 111, 124, 84, 77, 80, 95, 70, 111,
				110, 116, 83, 116, 121, 108, 101, 83, 116, 97,
				99, 107, 0, 0, 0, 0, 29, 84, 77, 80,
				114, 111, 124, 84, 77, 80, 95, 84, 101, 120,
				116, 80, 114, 111, 99, 101, 115, 115, 105, 110,
				103, 83, 116, 97, 99, 107, 0, 0, 0, 0,
				15, 84, 77, 80, 114, 111, 124, 67, 97, 114,
				101, 116, 73, 110, 102, 111, 0, 0, 0, 0,
				23, 84, 77, 80, 114, 111, 124, 84, 77, 80,
				95, 84, 101, 120, 116, 85, 116, 105, 108, 105,
				116, 105, 101, 115, 0, 0, 0, 0, 35, 84,
				77, 80, 114, 111, 46, 84, 77, 80, 95, 84,
				101, 120, 116, 85, 116, 105, 108, 105, 116, 105,
				101, 115, 124, 76, 105, 110, 101, 83, 101, 103,
				109, 101, 110, 116, 0, 0, 0, 0, 23, 84,
				77, 80, 114, 111, 124, 84, 77, 80, 95, 85,
				112, 100, 97, 116, 101, 77, 97, 110, 97, 103,
				101, 114, 0, 0, 0, 0, 24, 84, 77, 80,
				114, 111, 124, 84, 77, 80, 95, 85, 112, 100,
				97, 116, 101, 82, 101, 103, 105, 115, 116, 114,
				121
			},
			TotalFiles = 56,
			TotalTypes = 118,
			IsEditorOnly = false
		};
	}
}
namespace TMPro
{
	public class FastAction
	{
		private LinkedList<Action> delegates = new LinkedList<Action>();

		private Dictionary<Action, LinkedListNode<Action>> lookup = new Dictionary<Action, LinkedListNode<Action>>();

		public void Add(Action rhs)
		{
			if (!lookup.ContainsKey(rhs))
			{
				lookup[rhs] = delegates.AddLast(rhs);
			}
		}

		public void Remove(Action rhs)
		{
			if (lookup.TryGetValue(rhs, out var value))
			{
				lookup.Remove(rhs);
				delegates.Remove(value);
			}
		}

		public void Call()
		{
			for (LinkedListNode<Action> linkedListNode = delegates.First; linkedListNode != null; linkedListNode = linkedListNode.Next)
			{
				linkedListNode.Value();
			}
		}
	}
	public class FastAction<A>
	{
		private LinkedList<Action<A>> delegates = new LinkedList<Action<A>>();

		private Dictionary<Action<A>, LinkedListNode<Action<A>>> lookup = new Dictionary<Action<A>, LinkedListNode<Action<A>>>();

		public void Add(Action<A> rhs)
		{
			if (!lookup.ContainsKey(rhs))
			{
				lookup[rhs] = delegates.AddLast(rhs);
			}
		}

		public void Remove(Action<A> rhs)
		{
			if (lookup.TryGetValue(rhs, out var value))
			{
				lookup.Remove(rhs);
				delegates.Remove(value);
			}
		}

		public void Call(A a)
		{
			for (LinkedListNode<Action<A>> linkedListNode = delegates.First; linkedListNode != null; linkedListNode = linkedListNode.Next)
			{
				linkedListNode.Value(a);
			}
		}
	}
	public class FastAction<A, B>
	{
		private LinkedList<Action<A, B>> delegates = new LinkedList<Action<A, B>>();

		private Dictionary<Action<A, B>, LinkedListNode<Action<A, B>>> lookup = new Dictionary<Action<A, B>, LinkedListNode<Action<A, B>>>();

		public void Add(Action<A, B> rhs)
		{
			if (!lookup.ContainsKey(rhs))
			{
				lookup[rhs] = delegates.AddLast(rhs);
			}
		}

		public void Remove(Action<A, B> rhs)
		{
			if (lookup.TryGetValue(rhs, out var value))
			{
				lookup.Remove(rhs);
				delegates.Remove(value);
			}
		}

		public void Call(A a, B b)
		{
			for (LinkedListNode<Action<A, B>> linkedListNode = delegates.First; linkedListNode != null; linkedListNode = linkedListNode.Next)
			{
				linkedListNode.Value(a, b);
			}
		}
	}
	public class FastAction<A, B, C>
	{
		private LinkedList<Action<A, B, C>> delegates = new LinkedList<Action<A, B, C>>();

		private Dictionary<Action<A, B, C>, LinkedListNode<Action<A, B, C>>> lookup = new Dictionary<Action<A, B, C>, LinkedListNode<Action<A, B, C>>>();

		public void Add(Action<A, B, C> rhs)
		{
			if (!lookup.ContainsKey(rhs))
			{
				lookup[rhs] = delegates.AddLast(rhs);
			}
		}

		public void Remove(Action<A, B, C> rhs)
		{
			if (lookup.TryGetValue(rhs, out var value))
			{
				lookup.Remove(rhs);
				delegates.Remove(value);
			}
		}

		public void Call(A a, B b, C c)
		{
			for (LinkedListNode<Action<A, B, C>> linkedListNode = delegates.First; linkedListNode != null; linkedListNode = linkedListNode.Next)
			{
				linkedListNode.Value(a, b, c);
			}
		}
	}
	public interface ITextPreprocessor
	{
		string PreprocessText(string text);
	}
	public class MaterialReferenceManager
	{
		private static MaterialReferenceManager s_Instance;

		private Dictionary<int, Material> m_FontMaterialReferenceLookup = new Dictionary<int, Material>();

		private Dictionary<int, TMP_FontAsset> m_FontAssetReferenceLookup = new Dictionary<int, TMP_FontAsset>();

		private Dictionary<int, TMP_SpriteAsset> m_SpriteAssetReferenceLookup = new Dictionary<int, TMP_SpriteAsset>();

		private Dictionary<int, TMP_ColorGradient> m_ColorGradientReferenceLookup = new Dictionary<int, TMP_ColorGradient>();

		public static MaterialReferenceManager instance
		{
			get
			{
				if (s_Instance == null)
				{
					s_Instance = new MaterialReferenceManager();
				}
				return s_Instance;
			}
		}

		public static void AddFontAsset(TMP_FontAsset fontAsset)
		{
			instance.AddFontAssetInternal(fontAsset);
		}

		private void AddFontAssetInternal(TMP_FontAsset fontAsset)
		{
			if (!m_FontAssetReferenceLookup.ContainsKey(fontAsset.hashCode))
			{
				m_FontAssetReferenceLookup.Add(fontAsset.hashCode, fontAsset);
				m_FontMaterialReferenceLookup.Add(fontAsset.materialHashCode, fontAsset.material);
			}
		}

		public static void AddSpriteAsset(TMP_SpriteAsset spriteAsset)
		{
			instance.AddSpriteAssetInternal(spriteAsset);
		}

		private void AddSpriteAssetInternal(TMP_SpriteAsset spriteAsset)
		{
			if (!m_SpriteAssetReferenceLookup.ContainsKey(spriteAsset.hashCode))
			{
				m_SpriteAssetReferenceLookup.Add(spriteAsset.hashCode, spriteAsset);
				m_FontMaterialReferenceLookup.Add(spriteAsset.hashCode, spriteAsset.material);
			}
		}

		public static void AddSpriteAsset(int hashCode, TMP_SpriteAsset spriteAsset)
		{
			instance.AddSpriteAssetInternal(hashCode, spriteAsset);
		}

		private void AddSpriteAssetInternal(int hashCode, TMP_SpriteAsset spriteAsset)
		{
			if (!m_SpriteAssetReferenceLookup.ContainsKey(hashCode))
			{
				m_SpriteAssetReferenceLookup.Add(hashCode, spriteAsset);
				m_FontMaterialReferenceLookup.Add(hashCode, spriteAsset.material);
				if (spriteAsset.hashCode == 0)
				{
					spriteAsset.hashCode = hashCode;
				}
			}
		}

		public static void AddFontMaterial(int hashCode, Material material)
		{
			instance.AddFontMaterialInternal(hashCode, material);
		}

		private void AddFontMaterialInternal(int hashCode, Material material)
		{
			m_FontMaterialReferenceLookup.Add(hashCode, material);
		}

		public static void AddColorGradientPreset(int hashCode, TMP_ColorGradient spriteAsset)
		{
			instance.AddColorGradientPreset_Internal(hashCode, spriteAsset);
		}

		private void AddColorGradientPreset_Internal(int hashCode, TMP_ColorGradient spriteAsset)
		{
			if (!m_ColorGradientReferenceLookup.ContainsKey(hashCode))
			{
				m_ColorGradientReferenceLookup.Add(hashCode, spriteAsset);
			}
		}

		public bool Contains(TMP_FontAsset font)
		{
			return m_FontAssetReferenceLookup.ContainsKey(font.hashCode);
		}

		public bool Contains(TMP_SpriteAsset sprite)
		{
			return m_FontAssetReferenceLookup.ContainsKey(sprite.hashCode);
		}

		public static bool TryGetFontAsset(int hashCode, out TMP_FontAsset fontAsset)
		{
			return instance.TryGetFontAssetInternal(hashCode, out fontAsset);
		}

		private bool TryGetFontAssetInternal(int hashCode, out TMP_FontAsset fontAsset)
		{
			fontAsset = null;
			return m_FontAssetReferenceLookup.TryGetValue(hashCode, out fontAsset);
		}

		public static bool TryGetSpriteAsset(int hashCode, out TMP_SpriteAsset spriteAsset)
		{
			return instance.TryGetSpriteAssetInternal(hashCode, out spriteAsset);
		}

		private bool TryGetSpriteAssetInternal(int hashCode, out TMP_SpriteAsset spriteAsset)
		{
			spriteAsset = null;
			return m_SpriteAssetReferenceLookup.TryGetValue(hashCode, out spriteAsset);
		}

		public static bool TryGetColorGradientPreset(int hashCode, out TMP_ColorGradient gradientPreset)
		{
			return instance.TryGetColorGradientPresetInternal(hashCode, out gradientPreset);
		}

		private bool TryGetColorGradientPresetInternal(int hashCode, out TMP_ColorGradient gradientPreset)
		{
			gradientPreset = null;
			return m_ColorGradientReferenceLookup.TryGetValue(hashCode, out gradientPreset);
		}

		public static bool TryGetMaterial(int hashCode, out Material material)
		{
			return instance.TryGetMaterialInternal(hashCode, out material);
		}

		private bool TryGetMaterialInternal(int hashCode, out Material material)
		{
			material = null;
			return m_FontMaterialReferenceLookup.TryGetValue(hashCode, out material);
		}
	}
	public struct TMP_MaterialReference
	{
		public Material material;

		public int referenceCount;
	}
	public struct MaterialReference
	{
		public int index;

		public TMP_FontAsset fontAsset;

		public TMP_SpriteAsset spriteAsset;

		public Material material;

		public bool isDefaultMaterial;

		public bool isFallbackMaterial;

		public Material fallbackMaterial;

		public float padding;

		public int referenceCount;

		public MaterialReference(int index, TMP_FontAsset fontAsset, TMP_SpriteAsset spriteAsset, Material material, float padding)
		{
			this.index = index;
			this.fontAsset = fontAsset;
			this.spriteAsset = spriteAsset;
			this.material = material;
			isDefaultMaterial = ((((Object)material).GetInstanceID() == ((Object)fontAsset.material).GetInstanceID()) ? true : false);
			isFallbackMaterial = false;
			fallbackMaterial = null;
			this.padding = padding;
			referenceCount = 0;
		}

		public static bool Contains(MaterialReference[] materialReferences, TMP_FontAsset fontAsset)
		{
			int instanceID = ((Object)fontAsset).GetInstanceID();
			for (int i = 0; i < materialReferences.Length && (Object)(object)materialReferences[i].fontAsset != (Object)null; i++)
			{
				if (((Object)materialReferences[i].fontAsset).GetInstanceID() == instanceID)
				{
					return true;
				}
			}
			return false;
		}

		public static int AddMaterialReference(Material material, TMP_FontAsset fontAsset, ref MaterialReference[] materialReferences, Dictionary<int, int> materialReferenceIndexLookup)
		{
			int instanceID = ((Object)material).GetInstanceID();
			if (materialReferenceIndexLookup.TryGetValue(instanceID, out var value))
			{
				return value;
			}
			value = (materialReferenceIndexLookup[instanceID] = materialReferenceIndexLookup.Count);
			if (value >= materialReferences.Length)
			{
				Array.Resize(ref materialReferences, Mathf.NextPowerOfTwo(value + 1));
			}
			materialReferences[value].index = value;
			materialReferences[value].fontAsset = fontAsset;
			materialReferences[value].spriteAsset = null;
			materialReferences[value].material = material;
			materialReferences[value].isDefaultMaterial = ((instanceID == ((Object)fontAsset.material).GetInstanceID()) ? true : false);
			materialReferences[value].referenceCount = 0;
			return value;
		}

		public static int AddMaterialReference(Material material, TMP_SpriteAsset spriteAsset, ref MaterialReference[] materialReferences, Dictionary<int, int> materialReferenceIndexLookup)
		{
			int instanceID = ((Object)material).GetInstanceID();
			if (materialReferenceIndexLookup.TryGetValue(instanceID, out var value))
			{
				return value;
			}
			value = (materialReferenceIndexLookup[instanceID] = materialReferenceIndexLookup.Count);
			if (value >= materialReferences.Length)
			{
				Array.Resize(ref materialReferences, Mathf.NextPowerOfTwo(value + 1));
			}
			materialReferences[value].index = value;
			materialReferences[value].fontAsset = materialReferences[0].fontAsset;
			materialReferences[value].spriteAsset = spriteAsset;
			materialReferences[value].material = material;
			materialReferences[value].isDefaultMaterial = true;
			materialReferences[value].referenceCount = 0;
			return value;
		}
	}
	public enum TextContainerAnchors
	{
		TopLeft,
		Top,
		TopRight,
		Left,
		Middle,
		Right,
		BottomLeft,
		Bottom,
		BottomRight,
		Custom
	}
	[RequireComponent(typeof(RectTransform))]
	public class TextContainer : UIBehaviour
	{
		private bool m_hasChanged;

		[SerializeField]
		private Vector2 m_pivot;

		[SerializeField]
		private TextContainerAnchors m_anchorPosition = TextContainerAnchors.Middle;

		[SerializeField]
		private Rect m_rect;

		private bool m_isDefaultWidth;

		private bool m_isDefaultHeight;

		private bool m_isAutoFitting;

		private Vector3[] m_corners = (Vector3[])(object)new Vector3[4];

		private Vector3[] m_worldCorners = (Vector3[])(object)new Vector3[4];

		[SerializeField]
		private Vector4 m_margins;

		private RectTransform m_rectTransform;

		private static Vector2 k_defaultSize = new Vector2(100f, 100f);

		private TextMeshPro m_textMeshPro;

		public bool hasChanged
		{
			get
			{
				return m_hasChanged;
			}
			set
			{
				m_hasChanged = value;
			}
		}

		public Vector2 pivot
		{
			get
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				return m_pivot;
			}
			set
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_000f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0010: Unknown result type (might be due to invalid IL or missing references)
				//IL_0018: Unknown result type (might be due to invalid IL or missing references)
				if (m_pivot != value)
				{
					m_pivot = value;
					m_anchorPosition = GetAnchorPosition(m_pivot);
					m_hasChanged = true;
					OnContainerChanged();
				}
			}
		}

		public TextContainerAnchors anchorPosition
		{
			get
			{
				return m_anchorPosition;
			}
			set
			{
				//IL_0018: Unknown result type (might be due to invalid IL or missing references)
				//IL_001d: Unknown result type (might be due to invalid IL or missing references)
				if (m_anchorPosition != value)
				{
					m_anchorPosition = value;
					m_pivot = GetPivot(m_anchorPosition);
					m_hasChanged = true;
					OnContainerChanged();
				}
			}
		}

		public Rect rect
		{
			get
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				return m_rect;
			}
			set
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_000f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0010: Unknown result type (might be due to invalid IL or missing references)
				if (m_rect != value)
				{
					m_rect = value;
					m_hasChanged = true;
					OnContainerChanged();
				}
			}
		}

		public Vector2 size
		{
			get
			{
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				return new Vector2(((Rect)(ref m_rect)).width, ((Rect)(ref m_rect)).height);
			}
			set
			{
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				//IL_001b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0024: Unknown result type (might be due to invalid IL or missing references)
				if (new Vector2(((Rect)(ref m_rect)).width, ((Rect)(ref m_rect)).height) != value)
				{
					SetRect(value);
					m_hasChanged = true;
					m_isDefaultWidth = false;
					m_isDefaultHeight = false;
					OnContainerChanged();
				}
			}
		}

		public float width
		{
			get
			{
				return ((Rect)(ref m_rect)).width;
			}
			set
			{
				//IL_000d: Unknown result type (might be due to invalid IL or missing references)
				SetRect(new Vector2(value, ((Rect)(ref m_rect)).height));
				m_hasChanged = true;
				m_isDefaultWidth = false;
				OnContainerChanged();
			}
		}

		public float height
		{
			get
			{
				return ((Rect)(ref m_rect)).height;
			}
			set
			{
				//IL_000d: Unknown result type (might be due to invalid IL or missing references)
				SetRect(new Vector2(((Rect)(ref m_rect)).width, value));
				m_hasChanged = true;
				m_isDefaultHeight = false;
				OnContainerChanged();
			}
		}

		public bool isDefaultWidth => m_isDefaultWidth;

		public bool isDefaultHeight => m_isDefaultHeight;

		public bool isAutoFitting
		{
			get
			{
				return m_isAutoFitting;
			}
			set
			{
				m_isAutoFitting = value;
			}
		}

		public Vector3[] corners => m_corners;

		public Vector3[] worldCorners => m_worldCorners;

		public Vector4 margins
		{
			get
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				return m_margins;
			}
			set
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_000f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0010: Unknown result type (might be due to invalid IL or missing references)
				if (m_margins != value)
				{
					m_margins = value;
					m_hasChanged = true;
					OnContainerChanged();
				}
			}
		}

		public RectTransform rectTransform
		{
			get
			{
				if ((Object)(object)m_rectTransform == (Object)null)
				{
					m_rectTransform = ((Component)this).GetComponent<RectTransform>();
				}
				return m_rectTransform;
			}
		}

		public TextMeshPro textMeshPro
		{
			get
			{
				if ((Object)(object)m_textMeshPro == (Object)null)
				{
					m_textMeshPro = ((Component)this).GetComponent<TextMeshPro>();
				}
				return m_textMeshPro;
			}
		}

		protected override void Awake()
		{
			Debug.LogWarning((object)("The Text Container component is now Obsolete and can safely be removed from [" + ((Object)((Component)this).gameObject).name + "]."), (Object)(object)this);
		}

		protected override void OnEnable()
		{
			OnContainerChanged();
		}

		protected override void OnDisable()
		{
		}

		private void OnContainerChanged()
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			UpdateCorners();
			if ((Object)(object)m_rectTransform != (Object)null)
			{
				m_rectTransform.sizeDelta = size;
				((Transform)m_rectTransform).hasChanged = true;
			}
			if ((Object)(object)textMeshPro != (Object)null)
			{
				((Graphic)m_textMeshPro).SetVerticesDirty();
				m_textMeshPro.margin = m_margins;
			}
		}

		protected override void OnRectTransformDimensionsChange()
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)rectTransform == (Object)null)
			{
				m_rectTransform = ((Component)this).gameObject.AddComponent<RectTransform>();
			}
			if (m_rectTransform.sizeDelta != k_defaultSize)
			{
				size = m_rectTransform.sizeDelta;
			}
			pivot = m_rectTransform.pivot;
			m_hasChanged = true;
			OnContainerChanged();
		}

		private void SetRect(Vector2 size)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			m_rect = new Rect(((Rect)(ref m_rect)).x, ((Rect)(ref m_rect)).y, size.x, size.y);
		}

		private void UpdateCorners()
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			m_corners[0] = new Vector3((0f - m_pivot.x) * ((Rect)(ref m_rect)).width, (0f - m_pivot.y) * ((Rect)(ref m_rect)).height);
			m_corners[1] = new Vector3((0f - m_pivot.x) * ((Rect)(ref m_rect)).width, (1f - m_pivot.y) * ((Rect)(ref m_rect)).height);
			m_corners[2] = new Vector3((1f - m_pivot.x) * ((Rect)(ref m_rect)).width, (1f - m_pivot.y) * ((Rect)(ref m_rect)).height);
			m_corners[3] = new Vector3((1f - m_pivot.x) * ((Rect)(ref m_rect)).width, (0f - m_pivot.y) * ((Rect)(ref m_rect)).height);
			if ((Object)(object)m_rectTransform != (Object)null)
			{
				m_rectTransform.pivot = m_pivot;
			}
		}

		private Vector2 GetPivot(TextContainerAnchors anchor)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			Vector2 zero = Vector2.zero;
			switch (anchor)
			{
			case TextContainerAnchors.TopLeft:
				((Vector2)(ref zero))..ctor(0f, 1f);
				break;
			case TextContainerAnchors.Top:
				((Vector2)(ref zero))..ctor(0.5f, 1f);
				break;
			case TextContainerAnchors.TopRight:
				((Vector2)(ref zero))..ctor(1f, 1f);
				break;
			case TextContainerAnchors.Left:
				((Vector2)(ref zero))..ctor(0f, 0.5f);
				break;
			case TextContainerAnchors.Middle:
				((Vector2)(ref zero))..ctor(0.5f, 0.5f);
				break;
			case TextContainerAnchors.Right:
				((Vector2)(ref zero))..ctor(1f, 0.5f);
				break;
			case TextContainerAnchors.BottomLeft:
				((Vector2)(ref zero))..ctor(0f, 0f);
				break;
			case TextContainerAnchors.Bottom:
				((Vector2)(ref zero))..ctor(0.5f, 0f);
				break;
			case TextContainerAnchors.BottomRight:
				((Vector2)(ref zero))..ctor(1f, 0f);
				break;
			}
			return zero;
		}

		private TextContainerAnchors GetAnchorPosition(Vector2 pivot)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			if (pivot == new Vector2(0f, 1f))
			{
				return TextContainerAnchors.TopLeft;
			}
			if (pivot == new Vector2(0.5f, 1f))
			{
				return TextContainerAnchors.Top;
			}
			if (pivot == new Vector2(1f, 1f))
			{
				return TextContainerAnchors.TopRight;
			}
			if (pivot == new Vector2(0f, 0.5f))
			{
				return TextContainerAnchors.Left;
			}
			if (pivot == new Vector2(0.5f, 0.5f))
			{
				return TextContainerAnchors.Middle;
			}
			if (pivot == new Vector2(1f, 0.5f))
			{
				return TextContainerAnchors.Right;
			}
			if (pivot == new Vector2(0f, 0f))
			{
				return TextContainerAnchors.BottomLeft;
			}
			if (pivot == new Vector2(0.5f, 0f))
			{
				return TextContainerAnchors.Bottom;
			}
			if (pivot == new Vector2(1f, 0f))
			{
				return TextContainerAnchors.BottomRight;
			}
			return TextContainerAnchors.Custom;
		}
	}
	[DisallowMultipleComponent]
	[RequireComponent(typeof(MeshRenderer))]
	[AddComponentMenu("Mesh/TextMeshPro - Text")]
	[ExecuteAlways]
	[HelpURL("https://docs.unity3d.com/Packages/[email protected]")]
	public class TextMeshPro : TMP_Text, ILayoutElement
	{
		[SerializeField]
		internal int _SortingLayer;

		[SerializeField]
		internal int _SortingLayerID;

		[SerializeField]
		internal int _SortingOrder;

		private bool m_currentAutoSizeMode;

		[SerializeField]
		private bool m_hasFontAssetChanged;

		private float m_previousLossyScaleY = -1f;

		[SerializeField]
		private Renderer m_renderer;

		private MeshFilter m_meshFilter;

		private bool m_isFirstAllocation;

		private int m_max_characters = 8;

		private int m_max_numberOfLines = 4;

		private TMP_SubMesh[] m_subTextObjects = new TMP_SubMesh[8];

		[SerializeField]
		private MaskingTypes m_maskType;

		private Matrix4x4 m_EnvMapMatrix;

		private Vector3[] m_RectTransformCorners = (Vector3[])(object)new Vector3[4];

		[NonSerialized]
		private bool m_isRegisteredForEvents;

		private static ProfilerMarker k_GenerateTextMarker = new ProfilerMarker("TMP Layout Text");

		private static ProfilerMarker k_SetArraySizesMarker = new ProfilerMarker("TMP.SetArraySizes");

		private static ProfilerMarker k_GenerateTextPhaseIMarker = new ProfilerMarker("TMP GenerateText - Phase I");

		private static ProfilerMarker k_ParseMarkupTextMarker = new ProfilerMarker("TMP Parse Markup Text");

		private static ProfilerMarker k_CharacterLookupMarker = new ProfilerMarker("TMP Lookup Character & Glyph Data");

		private static ProfilerMarker k_HandleGPOSFeaturesMarker = new ProfilerMarker("TMP Handle GPOS Features");

		private static ProfilerMarker k_CalculateVerticesPositionMarker = new ProfilerMarker("TMP Calculate Vertices Position");

		private static ProfilerMarker k_ComputeTextMetricsMarker = new ProfilerMarker("TMP Compute Text Metrics");

		private static ProfilerMarker k_HandleVisibleCharacterMarker = new ProfilerMarker("TMP Handle Visible Character");

		private static ProfilerMarker k_HandleWhiteSpacesMarker = new ProfilerMarker("TMP Handle White Space & Control Character");

		private static ProfilerMarker k_HandleHorizontalLineBreakingMarker = new ProfilerMarker("TMP Handle Horizontal Line Breaking");

		private static ProfilerMarker k_HandleVerticalLineBreakingMarker = new ProfilerMarker("TMP Handle Vertical Line Breaking");

		private static ProfilerMarker k_SaveGlyphVertexDataMarker = new ProfilerMarker("TMP Save Glyph Vertex Data");

		private static ProfilerMarker k_ComputeCharacterAdvanceMarker = new ProfilerMarker("TMP Compute Character Advance");

		private static ProfilerMarker k_HandleCarriageReturnMarker = new ProfilerMarker("TMP Handle Carriage Return");

		private static ProfilerMarker k_HandleLineTerminationMarker = new ProfilerMarker("TMP Handle Line Termination");

		private static ProfilerMarker k_SavePageInfoMarker = new ProfilerMarker("TMP Save Text Extent & Page Info");

		private static ProfilerMarker k_SaveProcessingStatesMarker = new ProfilerMarker("TMP Save Processing States");

		private static ProfilerMarker k_GenerateTextPhaseIIMarker = new ProfilerMarker("TMP GenerateText - Phase II");

		private static ProfilerMarker k_GenerateTextPhaseIIIMarker = new ProfilerMarker("TMP GenerateText - Phase III");

		public int sortingLayerID
		{
			get
			{
				if ((Object)(object)renderer == (Object)null)
				{
					return 0;
				}
				return m_renderer.sortingLayerID;
			}
			set
			{
				if (!((Object)(object)renderer == (Object)null))
				{
					m_renderer.sortingLayerID = value;
					_SortingLayerID = value;
					UpdateSubMeshSortingLayerID(value);
				}
			}
		}

		public int sortingOrder
		{
			get
			{
				if ((Object)(object)renderer == (Object)null)
				{
					return 0;
				}
				return m_renderer.sortingOrder;
			}
			set
			{
				if (!((Object)(object)renderer == (Object)null))
				{
					m_renderer.sortingOrder = value;
					_SortingOrder = value;
					UpdateSubMeshSortingOrder(value);
				}
			}
		}

		public override bool autoSizeTextContainer
		{
			get
			{
				return m_autoSizeTextContainer;
			}
			set
			{
				if (m_autoSizeTextContainer != value)
				{
					m_autoSizeTextContainer = value;
					if (m_autoSizeTextContainer)
					{
						TMP_UpdateManager.RegisterTextElementForLayoutRebuild(this);
						((Graphic)this).SetLayoutDirty();
					}
				}
			}
		}

		[Obsolete("The TextContainer is now obsolete. Use the RectTransform instead.")]
		public TextContainer textContainer => null;

		public new Transform transform
		{
			get
			{
				if ((Object)(object)m_transform == (Object)null)
				{
					m_transform = ((Component)this).GetComponent<Transform>();
				}
				return m_transform;
			}
		}

		public Renderer renderer
		{
			get
			{
				if ((Object)(object)m_renderer == (Object)null)
				{
					m_renderer = ((Component)this).GetComponent<Renderer>();
				}
				return m_renderer;
			}
		}

		public override Mesh mesh
		{
			get
			{
				//IL_000f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0019: Expected O, but got Unknown
				if ((Object)(object)m_mesh == (Object)null)
				{
					m_mesh = new Mesh();
					((Object)m_mesh).hideFlags = (HideFlags)61;
				}
				return m_mesh;
			}
		}

		public MeshFilter meshFilter
		{
			get
			{
				if ((Object)(object)m_meshFilter == (Object)null)
				{
					m_meshFilter = ((Component)this).GetComponent<MeshFilter>();
					if ((Object)(object)m_meshFilter == (Object)null)
					{
						m_meshFilter = ((Component)this).gameObject.AddComponent<MeshFilter>();
						((Object)m_meshFilter).hideFlags = (HideFlags)63;
					}
				}
				return m_meshFilter;
			}
		}

		public MaskingTypes maskType
		{
			get
			{
				return m_maskType;
			}
			set
			{
				m_maskType = value;
				SetMask(m_maskType);
			}
		}

		public override event Action<TMP_TextInfo> OnPreRenderText;

		public void SetMask(MaskingTypes type, Vector4 maskCoords)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			SetMask(type);
			SetMaskCoordinates(maskCoords);
		}

		public void SetMask(MaskingTypes type, Vector4 maskCoords, float softnessX, float softnessY)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			SetMask(type);
			SetMaskCoordinates(maskCoords, softnessX, softnessY);
		}

		public override void SetVerticesDirty()
		{
			if (!((Object)(object)this == (Object)null) && ((UIBehaviour)this).IsActive())
			{
				TMP_UpdateManager.RegisterTextElementForGraphicRebuild(this);
			}
		}

		public override void SetLayoutDirty()
		{
			m_isPreferredWidthDirty = true;
			m_isPreferredHeightDirty = true;
			if (!((Object)(object)this == (Object)null) && ((UIBehaviour)this).IsActive())
			{
				LayoutRebuilder.MarkLayoutForRebuild(base.rectTransform);
				m_isLayoutDirty = true;
			}
		}

		public override void SetMaterialDirty()
		{
			((Graphic)this).UpdateMaterial();
		}

		public override void SetAllDirty()
		{
			((Graphic)this).SetLayoutDirty();
			((Graphic)this).SetVerticesDirty();
			((Graphic)this).SetMaterialDirty();
		}

		public override void Rebuild(CanvasUpdate update)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Invalid comparison between Unknown and I4
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)this == (Object)null)
			{
				return;
			}
			if ((int)update == 0)
			{
				if (m_autoSizeTextContainer)
				{
					m_rectTransform.sizeDelta = GetPreferredValues(float.PositiveInfinity, float.PositiveInfinity);
				}
			}
			else if ((int)update == 3)
			{
				OnPreRenderObject();
				if (m_isMaterialDirty)
				{
					((Graphic)this).UpdateMaterial();
					m_isMaterialDirty = false;
				}
			}
		}

		protected override void UpdateMaterial()
		{
			if (!((Object)(object)renderer == (Object)null) && !((Object)(object)m_sharedMaterial == (Object)null) && ((Object)(object)m_renderer.sharedMaterial == (Object)null || ((Object)m_renderer.sharedMaterial).GetInstanceID() != ((Object)m_sharedMaterial).GetInstanceID()))
			{
				m_renderer.sharedMaterial = m_sharedMaterial;
			}
		}

		public override void UpdateMeshPadding()
		{
			m_padding = ShaderUtilities.GetPadding(m_sharedMaterial, m_enableExtraPadding, m_isUsingBold);
			m_isMaskingEnabled = ShaderUtilities.IsMaskingEnabled(m_sharedMaterial);
			m_havePropertiesChanged = true;
			checkPaddingRequired = false;
			if (m_textInfo != null)
			{
				for (int i = 1; i < m_textInfo.materialCount; i++)
				{
					m_subTextObjects[i].UpdateMeshPadding(m_enableExtraPadding, m_isUsingBold);
				}
			}
		}

		public override void ForceMeshUpdate(bool ignoreActiveState = false, bool forceTextReparsing = false)
		{
			m_havePropertiesChanged = true;
			m_ignoreActiveState = ignoreActiveState;
			OnPreRenderObject();
		}

		public override TMP_TextInfo GetTextInfo(string text)
		{
			SetText(text);
			SetArraySizes(m_TextProcessingArray);
			m_renderMode = TextRenderFlags.DontRender;
			ComputeMarginSize();
			GenerateTextMesh();
			m_renderMode = TextRenderFlags.Render;
			return base.textInfo;
		}

		public override void ClearMesh(bool updateMesh)
		{
			if ((Object)(object)m_textInfo.meshInfo[0].mesh == (Object)null)
			{
				m_textInfo.meshInfo[0].mesh = m_mesh;
			}
			m_textInfo.ClearMeshInfo(updateMesh);
		}

		public override void UpdateGeometry(Mesh mesh, int index)
		{
			mesh.RecalculateBounds();
		}

		public override void UpdateVertexData(TMP_VertexDataUpdateFlags flags)
		{
			int materialCount = m_textInfo.materialCount;
			for (int i = 0; i < materialCount; i++)
			{
				Mesh val = ((i != 0) ? m_subTextObjects[i].mesh : m_mesh);
				if ((flags & TMP_VertexDataUpdateFlags.Vertices) == TMP_VertexDataUpdateFlags.Vertices)
				{
					val.vertices = m_textInfo.meshInfo[i].vertices;
				}
				if ((flags & TMP_VertexDataUpdateFlags.Uv0) == TMP_VertexDataUpdateFlags.Uv0)
				{
					val.uv = m_textInfo.meshInfo[i].uvs0;
				}
				if ((flags & TMP_VertexDataUpdateFlags.Uv2) == TMP_VertexDataUpdateFlags.Uv2)
				{
					val.uv2 = m_textInfo.meshInfo[i].uvs2;
				}
				if ((flags & TMP_VertexDataUpdateFlags.Colors32) == TMP_VertexDataUpdateFlags.Colors32)
				{
					val.colors32 = m_textInfo.meshInfo[i].colors32;
				}
				val.RecalculateBounds();
			}
		}

		public override void UpdateVertexData()
		{
			int materialCount = m_textInfo.materialCount;
			for (int i = 0; i < materialCount; i++)
			{
				Mesh val;
				if (i == 0)
				{
					val = m_mesh;
				}
				else
				{
					m_textInfo.meshInfo[i].ClearUnusedVertices();
					val = m_subTextObjects[i].mesh;
				}
				val.vertices = m_textInfo.meshInfo[i].vertices;
				val.uv = m_textInfo.meshInfo[i].uvs0;
				val.uv2 = m_textInfo.meshInfo[i].uvs2;
				val.colors32 = m_textInfo.meshInfo[i].colors32;
				val.RecalculateBounds();
			}
		}

		public void UpdateFontAsset()
		{
			LoadFontAsset();
		}

		public void CalculateLayoutInputHorizontal()
		{
		}

		public void CalculateLayoutInputVertical()
		{
		}

		protected override void Awake()
		{
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Expected O, but got Unknown
			m_renderer = ((Component)this).GetComponent<Renderer>();
			if ((Object)(object)m_renderer == (Object)null)
			{
				m_renderer = ((Component)this).gameObject.AddComponent<Renderer>();
			}
			m_rectTransform = base.rectTransform;
			m_transform = transform;
			m_meshFilter = ((Component)this).GetComponent<MeshFilter>();
			if ((Object)(object)m_meshFilter == (Object)null)
			{
				m_meshFilter = ((Component)this).gameObject.AddComponent<MeshFilter>();
			}
			if ((Object)(object)m_mesh == (Object)null)
			{
				m_mesh = new Mesh();
				((Object)m_mesh).hideFlags = (HideFlags)61;
				m_meshFilter.sharedMesh = m_mesh;
				m_textInfo = new TMP_TextInfo(this);
			}
			((Object)m_meshFilter).hideFlags = (HideFlags)63;
			LoadDefaultSettings();
			LoadFontAsset();
			if (m_TextProcessingArray == null)
			{
				m_TextProcessingArray = new UnicodeChar[m_max_characters];
			}
			m_cached_TextElement = new TMP_Character();
			m_isFirstAllocation = true;
			TMP_SubMesh[] componentsInChildren = ((Component)this).GetComponentsInChildren<TMP_SubMesh>();
			if (componentsInChildren.Length != 0)
			{
				int num = componentsInChildren.Length;
				if (num + 1 > m_subTextObjects.Length)
				{
					Array.Resize(ref m_subTextObjects, num + 1);
				}
				for (int i = 0; i < num; i++)
				{
					m_subTextObjects[i + 1] = componentsInChildren[i];
				}
			}
			m_havePropertiesChanged = true;
			m_isAwake = true;
		}

		protected override void OnEnable()
		{
			if (m_isAwake)
			{
				if (!m_isRegisteredForEvents)
				{
					m_isRegisteredForEvents = true;
				}
				if (!m_IsTextObjectScaleStatic)
				{
					TMP_UpdateManager.RegisterTextObjectForUpdate(this);
				}
				meshFilter.sharedMesh = mesh;
				SetActiveSubMeshes(state: true);
				ComputeMarginSize();
				((Graphic)this).SetAllDirty();
			}
		}

		protected override void OnDisable()
		{
			if (m_isAwake)
			{
				TMP_UpdateManager.UnRegisterTextElementForRebuild(this);
				TMP_UpdateManager.UnRegisterTextObjectForUpdate(this);
				meshFilter.sharedMesh = null;
				SetActiveSubMeshes(state: false);
			}
		}

		protected override void OnDestroy()
		{
			if ((Object)(object)m_mesh != (Object)null)
			{
				Object.DestroyImmediate((Object)(object)m_mesh);
			}
			m_isRegisteredForEvents = false;
			TMP_UpdateManager.UnRegisterTextElementForRebuild(this);
			TMP_UpdateManager.UnRegisterTextObjectForUpdate(this);
		}

		protected override void LoadFontAsset()
		{
			ShaderUtilities.GetShaderPropertyIDs();
			if ((Object)(object)m_fontAsset == (Object)null)
			{
				if ((Object)(object)TMP_Settings.defaultFontAsset != (Object)null)
				{
					m_fontAsset = TMP_Settings.defaultFontAsset;
				}
				else
				{
					m_fontAsset = Resources.Load<TMP_FontAsset>("Fonts & Materials/LiberationSans SDF");
				}
				if ((Object)(object)m_fontAsset == (Object)null)
				{
					Debug.LogWarning((object)("The LiberationSans SDF Font Asset was not found. There is no Font Asset assigned to " + ((Object)((Component)this).gameObject).name + "."), (Object)(object)this);
					return;
				}
				if (m_fontAsset.characterLookupTable == null)
				{
					Debug.Log((object)"Dictionary is Null!");
				}
				m_sharedMaterial = m_fontAsset.material;
				m_sharedMaterial.SetFloat("_CullMode", 0f);
				m_sharedMaterial.SetFloat(ShaderUtilities.ShaderTag_ZTestMode, 4f);
				m_renderer.receiveShadows = false;
				m_renderer.shadowCastingMode = (ShadowCastingMode)0;
			}
			else
			{
				if (m_fontAsset.characterLookupTable == null)
				{
					m_fontAsset.ReadFontAssetDefinition();
				}
				if ((Object)(object)m_sharedMaterial == (Object)null || (Object)(object)m_sharedMaterial.GetTexture(ShaderUtilities.ID_MainTex) == (Object)null || ((Object)m_fontAsset.atlasTexture).GetInstanceID() != ((Object)m_sharedMaterial.GetTexture(ShaderUtilities.ID_MainTex)).GetInstanceID())
				{
					if ((Object)(object)m_fontAsset.material == (Object)null)
					{
						Debug.LogWarning((object)("The Font Atlas Texture of the Font Asset " + ((Object)m_fontAsset).name + " assigned to " + ((Object)((Component)this).gameObject).name + " is missing."), (Object)(object)this);
					}
					else
					{
						m_sharedMaterial = m_fontAsset.material;
					}
				}
				m_sharedMaterial.SetFloat(ShaderUtilities.ShaderTag_ZTestMode, 4f);
				if (m_sharedMaterial.passCount == 1)
				{
					m_renderer.receiveShadows = false;
					m_renderer.shadowCastingMode = (ShadowCastingMode)0;
				}
			}
			m_padding = GetPaddingForMaterial();
			m_isMaskingEnabled = ShaderUtilities.IsMaskingEnabled(m_sharedMaterial);
			GetSpecialCharacters(m_fontAsset);
			((Graphic)this).SetMaterialDirty();
		}

		private void UpdateEnvMapMatrix()
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			if (m_sharedMaterial.HasProperty(ShaderUtilities.ID_EnvMap) && !((Object)(object)m_sharedMaterial.GetTexture(ShaderUtilities.ID_EnvMap) == (Object)null))
			{
				Vector3 val = Vector4.op_Implicit(m_sharedMaterial.GetVector(ShaderUtilities.ID_EnvMatrixRotation));
				m_EnvMapMatrix = Matrix4x4.TRS(Vector3.zero, Quaternion.Euler(val), Vector3.one);
				m_sharedMaterial.SetMatrix(ShaderUtilities.ID_EnvMatrix, m_EnvMapMatrix);
			}
		}

		private void SetMask(MaskingTypes maskType)
		{
			switch (maskType)
			{
			case MaskingTypes.MaskOff:
				m_sharedMaterial.DisableKeyword(ShaderUtilities.Keyword_MASK_SOFT);
				m_sharedMaterial.DisableKeyword(ShaderUtilities.Keyword_MASK_HARD);
				m_sharedMaterial.DisableKeyword(ShaderUtilities.Keyword_MASK_TEX);
				break;
			case MaskingTypes.MaskSoft:
				m_sharedMaterial.EnableKeyword(ShaderUtilities.Keyword_MASK_SOFT);
				m_sharedMaterial.DisableKeyword(ShaderUtilities.Keyword_MASK_HARD);
				m_sharedMaterial.DisableKeyword(ShaderUtilities.Keyword_MASK_TEX);
				break;
			case MaskingTypes.MaskHard:
				m_sharedMaterial.EnableKeyword(ShaderUtilities.Keyword_MASK_HARD);
				m_sharedMaterial.DisableKeyword(ShaderUtilities.Keyword_MASK_SOFT);
				m_sharedMaterial.DisableKeyword(ShaderUtilities.Keyword_MASK_TEX);
				break;
			}
		}

		private void SetMaskCoordinates(Vector4 coords)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			m_sharedMaterial.SetVector(ShaderUtilities.ID_ClipRect, coords);
		}

		private void SetMaskCoordinates(Vector4 coords, float softX, float softY)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			m_sharedMaterial.SetVector(ShaderUtilities.ID_ClipRect, coords);
			m_sharedMaterial.SetFloat(ShaderUtilities.ID_MaskSoftnessX, softX);
			m_sharedMaterial.SetFloat(ShaderUtilities.ID_MaskSoftnessY, softY);
		}

		private void EnableMasking()
		{
			if (m_sharedMaterial.HasProperty(ShaderUtilities.ID_ClipRect))
			{
				m_sharedMaterial.EnableKeyword(ShaderUtilities.Keyword_MASK_SOFT);
				m_sharedMaterial.DisableKeyword(ShaderUtilities.Keyword_MASK_HARD);
				m_sharedMaterial.DisableKeyword(ShaderUtilities.Keyword_MASK_TEX);
				m_isMaskingEnabled = true;
				UpdateMask();
			}
		}

		private void DisableMasking()
		{
			if (m_sharedMaterial.HasProperty(ShaderUtilities.ID_ClipRect))
			{
				m_sharedMaterial.DisableKeyword(ShaderUtilities.Keyword_MASK_SOFT);
				m_sharedMaterial.DisableKeyword(ShaderUtilities.Keyword_MASK_HARD);
				m_sharedMaterial.DisableKeyword(ShaderUtilities.Keyword_MASK_TEX);
				m_isMaskingEnabled = false;
				UpdateMask();
			}
		}

		private void UpdateMask()
		{
			if (m_isMaskingEnabled && m_isMaskingEnabled && (Object)(object)m_fontMaterial == (Object)null)
			{
				CreateMaterialInstance();
			}
		}

		protected override Material GetMaterial(Material mat)
		{
			if ((Object)(object)m_fontMaterial == (Object)null || ((Object)m_fontMaterial).GetInstanceID() != ((Object)mat).GetInstanceID())
			{
				m_fontMaterial = CreateMaterialInstance(mat);
			}
			m_sharedMaterial = m_fontMaterial;
			m_padding = GetPaddingForMaterial();
			((Graphic)this).SetVerticesDirty();
			((Graphic)this).SetMaterialDirty();
			return m_sharedMaterial;
		}

		protected override Material[] GetMaterials(Material[] mats)
		{
			int materialCount = m_textInfo.materialCount;
			if (m_fontMaterials == null)
			{
				m_fontMaterials = (Material[])(object)new Material[materialCount];
			}
			else if (m_fontMaterials.Length != materialCount)
			{
				TMP_TextInfo.Resize(ref m_fontMaterials, materialCount, isBlockAllocated: false);
			}
			for (int i = 0; i < materialCount; i++)
			{
				if (i == 0)
				{
					m_fontMaterials[i] = base.fontMaterial;
				}
				else
				{
					m_fontMaterials[i] = m_subTextObjects[i].material;
				}
			}
			m_fontSharedMaterials = m_fontMaterials;
			return m_fontMaterials;
		}

		protected override void SetSharedMaterial(Material mat)
		{
			m_sharedMaterial = mat;
			m_padding = GetPaddingForMaterial();
			((Graphic)this).SetMaterialDirty();
		}

		protected override Material[] GetSharedMaterials()
		{
			int materialCount = m_textInfo.materialCount;
			if (m_fontSharedMaterials == null)
			{
				m_fontSharedMaterials = (Material[])(object)new Material[materialCount];
			}
			else if (m_fontSharedMaterials.Length != materialCount)
			{
				TMP_TextInfo.Resize(ref m_fontSharedMaterials, materialCount, isBlockAllocated: false);
			}
			for (int i = 0; i < materialCount; i++)
			{
				if (i == 0)
				{
					m_fontSharedMaterials[i] = m_sharedMaterial;
				}
				else
				{
					m_fontSharedMaterials[i] = m_subTextObjects[i].sharedMaterial;
				}
			}
			return m_fontSharedMaterials;
		}

		protected override void SetSharedMaterials(Material[] materials)
		{
			int materialCount = m_textInfo.materialCount;
			if (m_fontSharedMaterials == null)
			{
				m_fontSharedMaterials = (Material[])(object)new Material[materialCount];
			}
			else if (m_fontSharedMaterials.Length != materialCount)
			{
				TMP_TextInfo.Resize(ref m_fontSharedMaterials, materialCount, isBlockAllocated: false);
			}
			for (int i = 0; i < materialCount; i++)
			{
				Texture texture = materials[i].GetTexture(ShaderUtilities.ID_MainTex);
				if (i == 0)
				{
					if (!((Object)(object)texture == (Object)null) && ((Object)texture).GetInstanceID() == ((Object)m_sharedMaterial.GetTexture(ShaderUtilities.ID_MainTex)).GetInstanceID())
					{
						m_sharedMaterial = (m_fontSharedMaterials[i] = materials[i]);
						m_padding = GetPaddingForMaterial(m_sharedMaterial);
					}
				}
				else if (!((Object)(object)texture == (Object)null) && ((Object)texture).GetInstanceID() == ((Object)m_subTextObjects[i].sharedMaterial.GetTexture(ShaderUtilities.ID_MainTex)).GetInstanceID() && m_subTextObjects[i].isDefaultMaterial)
				{
					m_subTextObjects[i].sharedMaterial = (m_fontSharedMaterials[i] = materials[i]);
				}
			}
		}

		protected override void SetOutlineThickness(float thickness)
		{
			thickness = Mathf.Clamp01(thickness);
			m_renderer.material.SetFloat(ShaderUtilities.ID_OutlineWidth, thickness);
			if ((Object)(object)m_fontMaterial == (Object)null)
			{
				m_fontMaterial = m_renderer.material;
			}
			m_fontMaterial = m_renderer.material;
			m_sharedMaterial = m_fontMaterial;
			m_padding = GetPaddingForMaterial();
		}

		protected override void SetFaceColor(Color32 color)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			m_renderer.material.SetColor(ShaderUtilities.ID_FaceColor, Color32.op_Implicit(color));
			if ((Object)(object)m_fontMaterial == (Object)null)
			{
				m_fontMaterial = m_renderer.material;
			}
			m_sharedMaterial = m_fontMaterial;
		}

		protected override void SetOutlineColor(Color32 color)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			m_renderer.material.SetColor(ShaderUtilities.ID_OutlineColor, Color32.op_Implicit(color));
			if ((Object)(object)m_fontMaterial == (Object)null)
			{
				m_fontMaterial = m_renderer.material;
			}
			m_sharedMaterial = m_fontMaterial;
		}

		private void CreateMaterialInstance()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			Material val = new Material(m_sharedMaterial);
			val.shaderKeywords = m_sharedMaterial.shaderKeywords;
			((Object)val).name = ((Object)val).name + " Instance";
			m_fontMaterial = val;
		}

		protected override void SetShaderDepth()
		{
			if (m_isOverlay)
			{
				m_sharedMaterial.SetFloat(ShaderUtilities.ShaderTag_ZTestMode, 0f);
				m_renderer.material.renderQueue = 4000;
				m_sharedMaterial = m_renderer.material;
			}
			else
			{
				m_sharedMaterial.SetFloat(ShaderUtilities.ShaderTag_ZTestMode, 4f);
				m_renderer.material.renderQueue = -1;
				m_sharedMaterial = m_renderer.material;
			}
		}

		protected override void SetCulling()
		{
			if (m_isCullingEnabled)
			{
				m_renderer.material.SetFloat("_CullMode", 2f);
				for (int i = 1; i < m_subTextObjects.Length && (Object)(object)m_subTextObjects[i] != (Object)null; i++)
				{
					Renderer val = m_subTextObjects[i].renderer;
					if ((Object)(object)val != (Object)null)
					{
						val.material.SetFloat(ShaderUtilities.ShaderTag_CullMode, 2f);
					}
				}
				return;
			}
			m_renderer.material.SetFloat("_CullMode", 0f);
			for (int j = 1; j < m_subTextObjects.Length && (Object)(object)m_subTextObjects[j] != (Object)null; j++)
			{
				Renderer val2 = m_subTextObjects[j].renderer;
				if ((Object)(object)val2 != (Object)null)
				{
					val2.material.SetFloat(ShaderUtilities.ShaderTag_CullMode, 0f);
				}
			}
		}

		private void SetPerspectiveCorrection()
		{
			if (m_isOrthographic)
			{
				m_sharedMaterial.SetFloat(ShaderUtilities.ID_PerspectiveFilter, 0f);
			}
			else
			{
				m_sharedMaterial.SetFloat(ShaderUtilities.ID_PerspectiveFilter, 0.875f);
			}
		}

		internal override int SetArraySizes(UnicodeChar[] unicodeChars)
		{
			//IL_0a30: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a4a: Expected O, but got Unknown
			int num = 0;
			m_totalCharacterCount = 0;
			m_isUsingBold = false;
			m_isParsingText = false;
			tag_NoParsing = false;
			m_FontStyleInternal = m_fontStyle;
			m_fontStyleStack.Clear();
			m_FontWeightInternal = (((m_FontStyleInternal & FontStyles.Bold) == FontStyles.Bold) ? FontWeight.Bold : m_fontWeight);
			m_FontWeightStack.SetDefault(m_FontWeightInternal);
			m_currentFontAsset = m_fontAsset;
			m_currentMaterial = m_sharedMaterial;
			m_currentMaterialIndex = 0;
			TMP_Text.m_materialReferenceStack.SetDefault(new MaterialReference(m_currentMaterialIndex, m_currentFontAsset, null, m_currentMaterial, m_padding));
			TMP_Text.m_materialReferenceIndexLookup.Clear();
			MaterialReference.AddMaterialReference(m_currentMaterial, m_currentFontAsset, ref TMP_Text.m_materialReferences, TMP_Text.m_materialReferenceIndexLookup);
			if (m_textInfo == null)
			{
				m_textInfo = new TMP_TextInfo(m_InternalTextProcessingArraySize);
			}
			else if (m_textInfo.characterInfo.Length < m_InternalTextProcessingArraySize)
			{
				TMP_TextInfo.Resize(ref m_textInfo.characterInfo, m_InternalTextProcessingArraySize, isBlockAllocated: false);
			}
			m_textElementType = TMP_TextElementType.Character;
			if (m_overflowMode == TextOverflowModes.Ellipsis)
			{
				GetEllipsisSpecialCharacter(m_currentFontAsset);
				if (m_Ellipsis.character != null)
				{
					if (((Object)m_Ellipsis.fontAsset).GetInstanceID() != ((Object)m_currentFontAsset).GetInstanceID())
					{
						if (TMP_Settings.matchMaterialPreset && ((Object)m_currentMaterial).GetInstanceID() != ((Object)m_Ellipsis.fontAsset.material).GetInstanceID())
						{
							m_Ellipsis.material = TMP_MaterialManager.GetFallbackMaterial(m_currentMaterial, m_Ellipsis.fontAsset.material);
						}
						else
						{
							m_Ellipsis.material = m_Ellipsis.fontAsset.material;
						}
						m_Ellipsis.materialIndex = MaterialReference.AddMaterialReference(m_Ellipsis.material, m_Ellipsis.fontAsset, ref TMP_Text.m_materialReferences, TMP_Text.m_materialReferenceIndexLookup);
						TMP_Text.m_materialReferences[m_Ellipsis.materialIndex].referenceCount = 0;
					}
				}
				else
				{
					m_overflowMode = TextOverflowModes.Truncate;
					if (!TMP_Settings.warningsDisabled)
					{
						Debug.LogWarning((object)("The character used for Ellipsis is not available in font asset [" + ((Object)m_currentFontAsset).name + "] or any potential fallbacks. Switching Text Overflow mode to Truncate."), (Object)(object)this);
					}
				}
			}
			if (m_overflowMode == TextOverflowModes.Linked && (Object)(object)m_linkedTextComponent != (Object)null && !m_isCalculatingPreferredValues)
			{
				m_linkedTextComponent.text = string.Empty;
			}
			for (int i = 0; i < unicodeChars.Length && unicodeChars[i].unicode != 0; i++)
			{
				if (m_textInfo.characterInfo == null || m_totalCharacterCount >= m_textInfo.characterInfo.Length)
				{
					TMP_TextInfo.Resize(ref m_textInfo.characterInfo, m_totalCharacterCount + 1, isBlockAllocated: true);
				}
				int num2 = unicodeChars[i].unicode;
				if (m_isRichText && num2 == 60)
				{
					int currentMaterialIndex = m_currentMaterialIndex;
					if (ValidateHtmlTag(unicodeChars, i + 1, out var endIndex))
					{
						int stringIndex = unicodeChars[i].stringIndex;
						i = endIndex;
						if ((m_FontStyleInternal & FontStyles.Bold) == FontStyles.Bold)
						{
							m_isUsingBold = true;
						}
						if (m_textElementType == TMP_TextElementType.Sprite)
						{
							TMP_Text.m_materialReferences[m_currentMaterialIndex].referenceCount++;
							m_textInfo.characterInfo[m_totalCharacterCount].character = (char)(57344 + m_spriteIndex);
							m_textInfo.characterInfo[m_totalCharacterCount].spriteIndex = m_spriteIndex;
							m_textInfo.characterInfo[m_totalCharacterCount].fontAsset = m_currentFontAsset;
							m_textInfo.characterInfo[m_totalCharacterCount].spriteAsset = m_currentSpriteAsset;
							m_textInfo.characterInfo[m_totalCharacterCount].materialReferenceIndex = m_currentMaterialIndex;
							m_textInfo.characterInfo[m_totalCharacterCount].textElement = m_currentSpriteAsset.spriteCharacterTable[m_spriteIndex];
							m_textInfo.characterInfo[m_totalCharacterCount].elementType = m_textElementType;
							m_textInfo.characterInfo[m_totalCharacterCount].index = stringIndex;
							m_textInfo.characterInfo[m_totalCharacterCount].stringLength = unicodeChars[i].stringIndex - stringIndex + 1;
							m_textElementType = TMP_TextElementType.Character;
							m_currentMaterialIndex = currentMaterialIndex;
							num++;
							m_totalCharacterCount++;
						}
						continue;
					}
				}
				bool flag = false;
				TMP_FontAsset currentFontAsset = m_currentFontAsset;
				Material currentMaterial = m_currentMaterial;
				int currentMaterialIndex2 = m_currentMaterialIndex;
				if (m_textElementType == TMP_TextElementType.Character)
				{
					if ((m_FontStyleInternal & FontStyles.UpperCase) == FontStyles.UpperCase)
					{
						if (char.IsLower((char)num2))
						{
							num2 = char.ToUpper((char)num2);
						}
					}
					else if ((m_FontStyleInternal & FontStyles.LowerCase) == FontStyles.LowerCase)
					{
						if (char.IsUpper((char)num2))
						{
							num2 = char.ToLower((char)num2);
						}
					}
					else if ((m_FontStyleInternal & FontStyles.SmallCaps) == FontStyles.SmallCaps && char.IsLower((char)num2))
					{
						num2 = char.ToUpper((char)num2);
					}
				}
				bool isUsingAlternativeTypeface;
				TMP_TextElement tMP_TextElement = GetTextElement((uint)num2, m_currentFontAsset, m_FontStyleInternal, m_FontWeightInternal, out isUsingAlternativeTypeface);
				if (tMP_TextElement == null)
				{
					int num3 = num2;
					num2 = (unicodeChars[i].unicode = ((TMP_Settings.missingGlyphCharacter == 0) ? 9633 : TMP_Settings.missingGlyphCharacter));
					tMP_TextElement = TMP_FontAssetUtilities.GetCharacterFromFontAsset((uint)num2, m_currentFontAsset, includeFallbacks: true, m_FontStyleInternal, m_FontWeightInternal, out isUsingAlternativeTypeface);
					if (tMP_TextElement == null && TMP_Settings.fallbackFontAssets != null && TMP_Settings.fallbackFontAssets.Count > 0)
					{
						tMP_TextElement = TMP_FontAssetUtilities.GetCharacterFromFontAssets((uint)num2, m_currentFontAsset, TMP_Settings.fallbackFontAssets, includeFallbacks: true, m_FontStyleInternal, m_FontWeightInternal, out isUsingAlternativeTypeface);
					}
					if (tMP_TextElement == null && (Object)(object)TMP_Settings.defaultFontAsset != (Object)null)
					{
						tMP_TextElement = TMP_FontAssetUtilities.GetCharacterFromFontAsset((uint)num2, TMP_Settings.defaultFontAsset, includeFallbacks: true, m_FontStyleInternal, m_FontWeightInternal, out isUsingAlternativeTypeface);
					}
					if (tMP_TextElement == null)
					{
						num2 = (unicodeChars[i].unicode = 32);
						tMP_TextElement = TMP_FontAssetUtilities.GetCharacterFromFontAsset((uint)num2, m_currentFontAsset, includeFallbacks: true, m_FontStyleInternal, m_FontWeightInternal, out isUsingAlternativeTypeface);
					}
					if (tMP_TextElement == null)
					{
						num2 = (unicodeChars[i].unicode = 3);
						tMP_TextElement = TMP_FontAssetUtilities.GetCharacterFromFontAsset((uint)num2, m_currentFontAsset, includeFallbacks: true, m_FontStyleInternal, m_FontWeightInternal, out isUsingAlternativeTypeface);
					}
					if (!TMP_Settings.warningsDisabled)
					{
						Debug.LogWarning((object)((num3 > 65535) ? $"The character with Unicode value \\U{num3:X8} was not found in the [{((Object)m_fontAsset).name}] font asset or any potential fallbacks. It was replaced by Unicode character \\u{tMP_TextElement.unicode:X4} in text object [{((Object)this).name}]." : $"The character with Unicode value \\u{num3:X4} was not found in the [{((Object)m_fontAsset).name}] font asset or any potential fallbacks. It was replaced by Unicode character \\u{tMP_TextElement.unicode:X4} in text object [{((Object)this).name}]."), (Object)(object)this);
					}
				}
				if (tMP_TextElement.elementType == TextElementType.Character && tMP_TextElement.textAsset.instanceID != m_currentFontAsset.instanceID)
				{
					flag = true;
					m_currentFontAsset = tMP_TextElement.textAsset as TMP_FontAsset;
				}
				m_textInfo.characterInfo[m_totalCharacterCount].elementType = TMP_TextElementType.Character;
				m_textInfo.characterInfo[m_totalCharacterCount].textElement = tMP_TextElement;
				m_textInfo.characterInfo[m_totalCharacterCount].isUsingAlternateTypeface = isUsingAlternativeTypeface;
				m_textInfo.characterInfo[m_totalCharacterCount].character = (char)num2;
				m_textInfo.characterInfo[m_totalCharacterCount].index = unicodeChars[i].stringIndex;
				m_textInfo.characterInfo[m_totalCharacterCount].stringLength = unicodeChars[i].length;