Decompiled source of DSPJapanesePlugin v1.2.8

DSPJapanesePlugin.dll

Decompiled 3 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using TranslationCommon.SimpleJSON;
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("DspFontPatcher")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DspFontPatcher")]
[assembly: AssemblyCopyright("Copyright ©  2021")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("81DF3045-8007-4F6A-AAF6-903139D85B6C")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.0.0")]
[module: UnverifiableCode]
namespace TranslationCommon.SimpleJSON
{
	public enum JSONNodeType
	{
		Array = 1,
		Object = 2,
		String = 3,
		Number = 4,
		NullValue = 5,
		Boolean = 6,
		None = 7,
		Custom = 255
	}
	public enum JSONTextMode
	{
		Compact,
		Indent
	}
	public abstract class JSONNode
	{
		public struct Enumerator
		{
			private enum Type
			{
				None,
				Array,
				Object
			}

			private readonly Type type;

			private Dictionary<string, JSONNode>.Enumerator m_Object;

			private List<JSONNode>.Enumerator m_Array;

			public bool IsValid => type != Type.None;

			public KeyValuePair<string, JSONNode> Current
			{
				get
				{
					if (type == Type.Array)
					{
						return new KeyValuePair<string, JSONNode>(string.Empty, m_Array.Current);
					}
					if (type == Type.Object)
					{
						return m_Object.Current;
					}
					return new KeyValuePair<string, JSONNode>(string.Empty, null);
				}
			}

			public Enumerator(List<JSONNode>.Enumerator aArrayEnum)
			{
				type = Type.Array;
				m_Object = default(Dictionary<string, JSONNode>.Enumerator);
				m_Array = aArrayEnum;
			}

			public Enumerator(Dictionary<string, JSONNode>.Enumerator aDictEnum)
			{
				type = Type.Object;
				m_Object = aDictEnum;
				m_Array = default(List<JSONNode>.Enumerator);
			}

			public bool MoveNext()
			{
				if (type == Type.Array)
				{
					return m_Array.MoveNext();
				}
				if (type == Type.Object)
				{
					return m_Object.MoveNext();
				}
				return false;
			}
		}

		public struct ValueEnumerator
		{
			private Enumerator m_Enumerator;

			public JSONNode Current => m_Enumerator.Current.Value;

			public ValueEnumerator(List<JSONNode>.Enumerator aArrayEnum)
				: this(new Enumerator(aArrayEnum))
			{
			}

			public ValueEnumerator(Dictionary<string, JSONNode>.Enumerator aDictEnum)
				: this(new Enumerator(aDictEnum))
			{
			}

			public ValueEnumerator(Enumerator aEnumerator)
			{
				m_Enumerator = aEnumerator;
			}

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

			public ValueEnumerator GetEnumerator()
			{
				return this;
			}
		}

		public struct KeyEnumerator
		{
			private Enumerator m_Enumerator;

			public string Current => m_Enumerator.Current.Key;

			public KeyEnumerator(List<JSONNode>.Enumerator aArrayEnum)
				: this(new Enumerator(aArrayEnum))
			{
			}

			public KeyEnumerator(Dictionary<string, JSONNode>.Enumerator aDictEnum)
				: this(new Enumerator(aDictEnum))
			{
			}

			public KeyEnumerator(Enumerator aEnumerator)
			{
				m_Enumerator = aEnumerator;
			}

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

			public KeyEnumerator GetEnumerator()
			{
				return this;
			}
		}

		public class LinqEnumerator : IEnumerator<KeyValuePair<string, JSONNode>>, IDisposable, IEnumerator, IEnumerable<KeyValuePair<string, JSONNode>>, IEnumerable
		{
			private Enumerator m_Enumerator;

			private JSONNode m_Node;

			public KeyValuePair<string, JSONNode> Current => m_Enumerator.Current;

			object IEnumerator.Current => m_Enumerator.Current;

			internal LinqEnumerator(JSONNode aNode)
			{
				m_Node = aNode;
				if (m_Node != null)
				{
					m_Enumerator = m_Node.GetEnumerator();
				}
			}

			public IEnumerator<KeyValuePair<string, JSONNode>> GetEnumerator()
			{
				return new LinqEnumerator(m_Node);
			}

			IEnumerator IEnumerable.GetEnumerator()
			{
				return new LinqEnumerator(m_Node);
			}

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

			public void Dispose()
			{
				m_Node = null;
				m_Enumerator = default(Enumerator);
			}

			public void Reset()
			{
				if (m_Node != null)
				{
					m_Enumerator = m_Node.GetEnumerator();
				}
			}
		}

		[ThreadStatic]
		private static StringBuilder m_EscapeBuilder;

		public static bool forceASCII = false;

		public static bool longAsString = false;

		public static bool allowLineComments = true;

		public static byte Color32DefaultAlpha = byte.MaxValue;

		public static float ColorDefaultAlpha = 1f;

		public static JSONContainerType VectorContainerType = JSONContainerType.Array;

		public static JSONContainerType QuaternionContainerType = JSONContainerType.Array;

		public static JSONContainerType RectContainerType = JSONContainerType.Array;

		public static JSONContainerType ColorContainerType = JSONContainerType.Array;

		internal static StringBuilder EscapeBuilder
		{
			get
			{
				if (m_EscapeBuilder == null)
				{
					m_EscapeBuilder = new StringBuilder();
				}
				return m_EscapeBuilder;
			}
		}

		public abstract JSONNodeType Tag { get; }

		public virtual JSONNode this[int aIndex]
		{
			get
			{
				return null;
			}
			set
			{
			}
		}

		public virtual JSONNode this[string aKey]
		{
			get
			{
				return null;
			}
			set
			{
			}
		}

		public virtual string Value
		{
			get
			{
				return "";
			}
			set
			{
			}
		}

		public virtual int Count => 0;

		public virtual bool IsNumber => false;

		public virtual bool IsString => false;

		public virtual bool IsBoolean => false;

		public virtual bool IsNull => false;

		public virtual bool IsArray => false;

		public virtual bool IsObject => false;

		public virtual bool Inline
		{
			get
			{
				return false;
			}
			set
			{
			}
		}

		public virtual IEnumerable<JSONNode> Children
		{
			get
			{
				yield break;
			}
		}

		public IEnumerable<JSONNode> DeepChildren
		{
			get
			{
				foreach (JSONNode C in Children)
				{
					foreach (JSONNode deepChild in C.DeepChildren)
					{
						yield return deepChild;
					}
				}
			}
		}

		public IEnumerable<KeyValuePair<string, JSONNode>> Linq => new LinqEnumerator(this);

		public KeyEnumerator Keys => new KeyEnumerator(GetEnumerator());

		public ValueEnumerator Values => new ValueEnumerator(GetEnumerator());

		public virtual double AsDouble
		{
			get
			{
				double result = 0.0;
				if (double.TryParse(Value, NumberStyles.Float, CultureInfo.InvariantCulture, out result))
				{
					return result;
				}
				return 0.0;
			}
			set
			{
				Value = value.ToString(CultureInfo.InvariantCulture);
			}
		}

		public virtual int AsInt
		{
			get
			{
				return (int)AsDouble;
			}
			set
			{
				AsDouble = value;
			}
		}

		public virtual float AsFloat
		{
			get
			{
				return (float)AsDouble;
			}
			set
			{
				AsDouble = value;
			}
		}

		public virtual bool AsBool
		{
			get
			{
				bool result = false;
				if (bool.TryParse(Value, out result))
				{
					return result;
				}
				return !string.IsNullOrEmpty(Value);
			}
			set
			{
				Value = (value ? "true" : "false");
			}
		}

		public virtual long AsLong
		{
			get
			{
				long result = 0L;
				if (long.TryParse(Value, out result))
				{
					return result;
				}
				return 0L;
			}
			set
			{
				Value = value.ToString();
			}
		}

		public virtual ulong AsULong
		{
			get
			{
				ulong result = 0uL;
				if (ulong.TryParse(Value, out result))
				{
					return result;
				}
				return 0uL;
			}
			set
			{
				Value = value.ToString();
			}
		}

		public virtual JSONArray AsArray => this as JSONArray;

		public virtual JSONObject AsObject => this as JSONObject;

		public virtual decimal AsDecimal
		{
			get
			{
				if (!decimal.TryParse(Value, NumberStyles.Number, CultureInfo.InvariantCulture, out var result))
				{
					result = default(decimal);
				}
				return result;
			}
			set
			{
				Value = value.ToString();
			}
		}

		public virtual char AsChar
		{
			get
			{
				if (IsString && Value.Length > 0)
				{
					return Value[0];
				}
				if (IsNumber)
				{
					return (char)AsInt;
				}
				return '\0';
			}
			set
			{
				if (IsString)
				{
					Value = value.ToString();
				}
				else if (IsNumber)
				{
					AsInt = value;
				}
			}
		}

		public virtual uint AsUInt
		{
			get
			{
				return (uint)AsDouble;
			}
			set
			{
				AsDouble = value;
			}
		}

		public virtual byte AsByte
		{
			get
			{
				return (byte)AsInt;
			}
			set
			{
				AsInt = value;
			}
		}

		public virtual sbyte AsSByte
		{
			get
			{
				return (sbyte)AsInt;
			}
			set
			{
				AsInt = value;
			}
		}

		public virtual short AsShort
		{
			get
			{
				return (short)AsInt;
			}
			set
			{
				AsInt = value;
			}
		}

		public virtual ushort AsUShort
		{
			get
			{
				return (ushort)AsInt;
			}
			set
			{
				AsInt = value;
			}
		}

		public virtual DateTime AsDateTime
		{
			get
			{
				if (!DateTime.TryParse(Value, CultureInfo.InvariantCulture, DateTimeStyles.None, out var result))
				{
					result = new DateTime(0L);
				}
				return result;
			}
			set
			{
				Value = value.ToString(CultureInfo.InvariantCulture);
			}
		}

		public virtual TimeSpan AsTimeSpan
		{
			get
			{
				if (!TimeSpan.TryParse(Value, out var result))
				{
					result = new TimeSpan(0L);
				}
				return result;
			}
			set
			{
				Value = value.ToString();
			}
		}

		public virtual byte[] AsByteArray
		{
			get
			{
				if (IsNull || !IsArray)
				{
					return null;
				}
				int count = Count;
				byte[] array = new byte[count];
				for (int i = 0; i < count; i++)
				{
					array[i] = this[i].AsByte;
				}
				return array;
			}
			set
			{
				if (IsArray && value != null)
				{
					Clear();
					for (int i = 0; i < value.Length; i++)
					{
						Add(value[i]);
					}
				}
			}
		}

		public virtual List<byte> AsByteList
		{
			get
			{
				if (IsNull || !IsArray)
				{
					return null;
				}
				int count = Count;
				List<byte> list = new List<byte>(count);
				for (int i = 0; i < count; i++)
				{
					list.Add(this[i].AsByte);
				}
				return list;
			}
			set
			{
				if (IsArray && value != null)
				{
					Clear();
					for (int i = 0; i < value.Count; i++)
					{
						Add(value[i]);
					}
				}
			}
		}

		public virtual string[] AsStringArray
		{
			get
			{
				if (IsNull || !IsArray)
				{
					return null;
				}
				int count = Count;
				string[] array = new string[count];
				for (int i = 0; i < count; i++)
				{
					array[i] = this[i].Value;
				}
				return array;
			}
			set
			{
				if (IsArray && value != null)
				{
					Clear();
					for (int i = 0; i < value.Length; i++)
					{
						Add(value[i]);
					}
				}
			}
		}

		public virtual List<string> AsStringList
		{
			get
			{
				if (IsNull || !IsArray)
				{
					return null;
				}
				int count = Count;
				List<string> list = new List<string>(count);
				for (int i = 0; i < count; i++)
				{
					list.Add(this[i].Value);
				}
				return list;
			}
			set
			{
				if (IsArray && value != null)
				{
					Clear();
					for (int i = 0; i < value.Count; i++)
					{
						Add(value[i]);
					}
				}
			}
		}

		internal static string Escape(string aText)
		{
			StringBuilder escapeBuilder = EscapeBuilder;
			escapeBuilder.Length = 0;
			if (escapeBuilder.Capacity < aText.Length + aText.Length / 10)
			{
				escapeBuilder.Capacity = aText.Length + aText.Length / 10;
			}
			foreach (char c in aText)
			{
				switch (c)
				{
				case '\\':
					escapeBuilder.Append("\\\\");
					continue;
				case '"':
					escapeBuilder.Append("\\\"");
					continue;
				case '\n':
					escapeBuilder.Append("\\n");
					continue;
				case '\r':
					escapeBuilder.Append("\\r");
					continue;
				case '\t':
					escapeBuilder.Append("\\t");
					continue;
				case '\b':
					escapeBuilder.Append("\\b");
					continue;
				case '\f':
					escapeBuilder.Append("\\f");
					continue;
				}
				if (c < ' ' || (forceASCII && c > '\u007f'))
				{
					ushort num = c;
					escapeBuilder.Append("\\u").Append(num.ToString("X4"));
				}
				else
				{
					escapeBuilder.Append(c);
				}
			}
			string result = escapeBuilder.ToString();
			escapeBuilder.Length = 0;
			return result;
		}

		private static JSONNode ParseElement(string token, bool quoted)
		{
			if (quoted)
			{
				return token;
			}
			if (token.Length <= 5)
			{
				string text = token.ToLower();
				if (text == "false" || text == "true")
				{
					return text == "true";
				}
				if (text == "null")
				{
					return JSONNull.CreateOrGet();
				}
			}
			if (double.TryParse(token, NumberStyles.Float, CultureInfo.InvariantCulture, out var result))
			{
				return result;
			}
			return token;
		}

		public static JSONNode Parse(string aJSON)
		{
			Stack<JSONNode> stack = new Stack<JSONNode>();
			JSONNode jSONNode = null;
			int i = 0;
			StringBuilder stringBuilder = new StringBuilder();
			string aKey = "";
			bool flag = false;
			bool flag2 = false;
			bool flag3 = false;
			for (; i < aJSON.Length; i++)
			{
				switch (aJSON[i])
				{
				case '{':
					if (flag)
					{
						stringBuilder.Append(aJSON[i]);
						break;
					}
					stack.Push(new JSONObject());
					if (jSONNode != null)
					{
						jSONNode.Add(aKey, stack.Peek());
					}
					aKey = "";
					stringBuilder.Length = 0;
					jSONNode = stack.Peek();
					flag3 = false;
					break;
				case '[':
					if (flag)
					{
						stringBuilder.Append(aJSON[i]);
						break;
					}
					stack.Push(new JSONArray());
					if (jSONNode != null)
					{
						jSONNode.Add(aKey, stack.Peek());
					}
					aKey = "";
					stringBuilder.Length = 0;
					jSONNode = stack.Peek();
					flag3 = false;
					break;
				case ']':
				case '}':
					if (flag)
					{
						stringBuilder.Append(aJSON[i]);
						break;
					}
					if (stack.Count == 0)
					{
						throw new Exception("JSON Parse: Too many closing brackets");
					}
					stack.Pop();
					if (stringBuilder.Length > 0 || flag2)
					{
						jSONNode.Add(aKey, ParseElement(stringBuilder.ToString(), flag2));
					}
					if (jSONNode != null)
					{
						jSONNode.Inline = !flag3;
					}
					flag2 = false;
					aKey = "";
					stringBuilder.Length = 0;
					if (stack.Count > 0)
					{
						jSONNode = stack.Peek();
					}
					break;
				case ':':
					if (flag)
					{
						stringBuilder.Append(aJSON[i]);
						break;
					}
					aKey = stringBuilder.ToString();
					stringBuilder.Length = 0;
					flag2 = false;
					break;
				case '"':
					flag = !flag;
					flag2 = flag2 || flag;
					break;
				case ',':
					if (flag)
					{
						stringBuilder.Append(aJSON[i]);
						break;
					}
					if (stringBuilder.Length > 0 || flag2)
					{
						jSONNode.Add(aKey, ParseElement(stringBuilder.ToString(), flag2));
					}
					flag2 = false;
					aKey = "";
					stringBuilder.Length = 0;
					flag2 = false;
					break;
				case '\n':
				case '\r':
					flag3 = true;
					break;
				case '\t':
				case ' ':
					if (flag)
					{
						stringBuilder.Append(aJSON[i]);
					}
					break;
				case '\\':
					i++;
					if (flag)
					{
						char c = aJSON[i];
						switch (c)
						{
						case 't':
							stringBuilder.Append('\t');
							break;
						case 'r':
							stringBuilder.Append('\r');
							break;
						case 'n':
							stringBuilder.Append('\n');
							break;
						case 'b':
							stringBuilder.Append('\b');
							break;
						case 'f':
							stringBuilder.Append('\f');
							break;
						case 'u':
						{
							string s = aJSON.Substring(i + 1, 4);
							stringBuilder.Append((char)int.Parse(s, NumberStyles.AllowHexSpecifier));
							i += 4;
							break;
						}
						default:
							stringBuilder.Append(c);
							break;
						}
					}
					break;
				case '/':
					if (allowLineComments && !flag && i + 1 < aJSON.Length && aJSON[i + 1] == '/')
					{
						while (++i < aJSON.Length && aJSON[i] != '\n' && aJSON[i] != '\r')
						{
						}
					}
					else
					{
						stringBuilder.Append(aJSON[i]);
					}
					break;
				default:
					stringBuilder.Append(aJSON[i]);
					break;
				case '\ufeff':
					break;
				}
			}
			if (flag)
			{
				throw new Exception("JSON Parse: Quotation marks seems to be messed up.");
			}
			if (jSONNode == null)
			{
				return ParseElement(stringBuilder.ToString(), flag2);
			}
			return jSONNode;
		}

		public virtual void Add(string aKey, JSONNode aItem)
		{
		}

		public virtual void Add(JSONNode aItem)
		{
			Add("", aItem);
		}

		public virtual JSONNode Remove(string aKey)
		{
			return null;
		}

		public virtual JSONNode Remove(int aIndex)
		{
			return null;
		}

		public virtual JSONNode Remove(JSONNode aNode)
		{
			return aNode;
		}

		public virtual void Clear()
		{
		}

		public virtual JSONNode Clone()
		{
			return null;
		}

		public virtual bool HasKey(string aKey)
		{
			return false;
		}

		public virtual JSONNode GetValueOrDefault(string aKey, JSONNode aDefault)
		{
			return aDefault;
		}

		public override string ToString()
		{
			StringBuilder stringBuilder = new StringBuilder();
			WriteToStringBuilder(stringBuilder, 0, 0, JSONTextMode.Compact);
			return stringBuilder.ToString();
		}

		public virtual string ToString(int aIndent)
		{
			StringBuilder stringBuilder = new StringBuilder();
			WriteToStringBuilder(stringBuilder, 0, aIndent, JSONTextMode.Indent);
			return stringBuilder.ToString();
		}

		internal abstract void WriteToStringBuilder(StringBuilder aSB, int aIndent, int aIndentInc, JSONTextMode aMode);

		public abstract Enumerator GetEnumerator();

		public static implicit operator JSONNode(string s)
		{
			return (s == null) ? ((JSONNode)JSONNull.CreateOrGet()) : ((JSONNode)new JSONString(s));
		}

		public static implicit operator string(JSONNode d)
		{
			return (d == null) ? null : d.Value;
		}

		public static implicit operator JSONNode(double n)
		{
			return new JSONNumber(n);
		}

		public static implicit operator double(JSONNode d)
		{
			return (d == null) ? 0.0 : d.AsDouble;
		}

		public static implicit operator JSONNode(float n)
		{
			return new JSONNumber(n);
		}

		public static implicit operator float(JSONNode d)
		{
			return (d == null) ? 0f : d.AsFloat;
		}

		public static implicit operator JSONNode(int n)
		{
			return new JSONNumber(n);
		}

		public static implicit operator int(JSONNode d)
		{
			return (!(d == null)) ? d.AsInt : 0;
		}

		public static implicit operator JSONNode(long n)
		{
			if (longAsString)
			{
				return new JSONString(n.ToString());
			}
			return new JSONNumber(n);
		}

		public static implicit operator long(JSONNode d)
		{
			return (d == null) ? 0 : d.AsLong;
		}

		public static implicit operator JSONNode(ulong n)
		{
			if (longAsString)
			{
				return new JSONString(n.ToString());
			}
			return new JSONNumber(n);
		}

		public static implicit operator ulong(JSONNode d)
		{
			return (d == null) ? 0 : d.AsULong;
		}

		public static implicit operator JSONNode(bool b)
		{
			return new JSONBool(b);
		}

		public static implicit operator bool(JSONNode d)
		{
			return !(d == null) && d.AsBool;
		}

		public static implicit operator JSONNode(KeyValuePair<string, JSONNode> aKeyValue)
		{
			return aKeyValue.Value;
		}

		public static bool operator ==(JSONNode a, object b)
		{
			if ((object)a == b)
			{
				return true;
			}
			bool flag = a is JSONNull || (object)a == null || a is JSONLazyCreator;
			bool flag2 = b is JSONNull || b == null || b is JSONLazyCreator;
			if (flag && flag2)
			{
				return true;
			}
			return !flag && a.Equals(b);
		}

		public static bool operator !=(JSONNode a, object b)
		{
			return !(a == b);
		}

		public override bool Equals(object obj)
		{
			return (object)this == obj;
		}

		public override int GetHashCode()
		{
			return base.GetHashCode();
		}

		public abstract void SerializeBinary(BinaryWriter aWriter);

		public void SaveToBinaryStream(Stream aData)
		{
			BinaryWriter aWriter = new BinaryWriter(aData);
			SerializeBinary(aWriter);
		}

		public void SaveToCompressedStream(Stream aData)
		{
			throw new Exception("Can't use compressed functions. You need include the SharpZipLib and uncomment the define at the top of SimpleJSON");
		}

		public void SaveToCompressedFile(string aFileName)
		{
			throw new Exception("Can't use compressed functions. You need include the SharpZipLib and uncomment the define at the top of SimpleJSON");
		}

		public string SaveToCompressedBase64()
		{
			throw new Exception("Can't use compressed functions. You need include the SharpZipLib and uncomment the define at the top of SimpleJSON");
		}

		public void SaveToBinaryFile(string aFileName)
		{
			Directory.CreateDirectory(new FileInfo(aFileName).Directory.FullName);
			using FileStream aData = File.OpenWrite(aFileName);
			SaveToBinaryStream(aData);
		}

		public string SaveToBinaryBase64()
		{
			using MemoryStream memoryStream = new MemoryStream();
			SaveToBinaryStream(memoryStream);
			memoryStream.Position = 0L;
			return Convert.ToBase64String(memoryStream.ToArray());
		}

		public static JSONNode DeserializeBinary(BinaryReader aReader)
		{
			JSONNodeType jSONNodeType = (JSONNodeType)aReader.ReadByte();
			switch (jSONNodeType)
			{
			case JSONNodeType.Array:
			{
				int num2 = aReader.ReadInt32();
				JSONArray jSONArray = new JSONArray();
				for (int j = 0; j < num2; j++)
				{
					jSONArray.Add(DeserializeBinary(aReader));
				}
				return jSONArray;
			}
			case JSONNodeType.Object:
			{
				int num = aReader.ReadInt32();
				JSONObject jSONObject = new JSONObject();
				for (int i = 0; i < num; i++)
				{
					string aKey = aReader.ReadString();
					JSONNode aItem = DeserializeBinary(aReader);
					jSONObject.Add(aKey, aItem);
				}
				return jSONObject;
			}
			case JSONNodeType.String:
				return new JSONString(aReader.ReadString());
			case JSONNodeType.Number:
				return new JSONNumber(aReader.ReadDouble());
			case JSONNodeType.Boolean:
				return new JSONBool(aReader.ReadBoolean());
			case JSONNodeType.NullValue:
				return JSONNull.CreateOrGet();
			default:
				throw new Exception("Error deserializing JSON. Unknown tag: " + jSONNodeType);
			}
		}

		public static JSONNode LoadFromCompressedFile(string aFileName)
		{
			throw new Exception("Can't use compressed functions. You need include the SharpZipLib and uncomment the define at the top of SimpleJSON");
		}

		public static JSONNode LoadFromCompressedStream(Stream aData)
		{
			throw new Exception("Can't use compressed functions. You need include the SharpZipLib and uncomment the define at the top of SimpleJSON");
		}

		public static JSONNode LoadFromCompressedBase64(string aBase64)
		{
			throw new Exception("Can't use compressed functions. You need include the SharpZipLib and uncomment the define at the top of SimpleJSON");
		}

		public static JSONNode LoadFromBinaryStream(Stream aData)
		{
			using BinaryReader aReader = new BinaryReader(aData);
			return DeserializeBinary(aReader);
		}

		public static JSONNode LoadFromBinaryFile(string aFileName)
		{
			using FileStream aData = File.OpenRead(aFileName);
			return LoadFromBinaryStream(aData);
		}

		public static JSONNode LoadFromBinaryBase64(string aBase64)
		{
			byte[] buffer = Convert.FromBase64String(aBase64);
			MemoryStream memoryStream = new MemoryStream(buffer);
			memoryStream.Position = 0L;
			return LoadFromBinaryStream(memoryStream);
		}

		public static implicit operator JSONNode(decimal aDecimal)
		{
			return new JSONString(aDecimal.ToString());
		}

		public static implicit operator decimal(JSONNode aNode)
		{
			return aNode.AsDecimal;
		}

		public static implicit operator JSONNode(char aChar)
		{
			return new JSONString(aChar.ToString());
		}

		public static implicit operator char(JSONNode aNode)
		{
			return aNode.AsChar;
		}

		public static implicit operator JSONNode(uint aUInt)
		{
			return new JSONNumber(aUInt);
		}

		public static implicit operator uint(JSONNode aNode)
		{
			return aNode.AsUInt;
		}

		public static implicit operator JSONNode(byte aByte)
		{
			return new JSONNumber((int)aByte);
		}

		public static implicit operator byte(JSONNode aNode)
		{
			return aNode.AsByte;
		}

		public static implicit operator JSONNode(sbyte aSByte)
		{
			return new JSONNumber(aSByte);
		}

		public static implicit operator sbyte(JSONNode aNode)
		{
			return aNode.AsSByte;
		}

		public static implicit operator JSONNode(short aShort)
		{
			return new JSONNumber(aShort);
		}

		public static implicit operator short(JSONNode aNode)
		{
			return aNode.AsShort;
		}

		public static implicit operator JSONNode(ushort aUShort)
		{
			return new JSONNumber((int)aUShort);
		}

		public static implicit operator ushort(JSONNode aNode)
		{
			return aNode.AsUShort;
		}

		public static implicit operator JSONNode(DateTime aDateTime)
		{
			return new JSONString(aDateTime.ToString(CultureInfo.InvariantCulture));
		}

		public static implicit operator DateTime(JSONNode aNode)
		{
			return aNode.AsDateTime;
		}

		public static implicit operator JSONNode(TimeSpan aTimeSpan)
		{
			return new JSONString(aTimeSpan.ToString());
		}

		public static implicit operator TimeSpan(JSONNode aNode)
		{
			return aNode.AsTimeSpan;
		}

		public static implicit operator JSONNode(byte[] aByteArray)
		{
			return new JSONArray
			{
				AsByteArray = aByteArray
			};
		}

		public static implicit operator byte[](JSONNode aNode)
		{
			return aNode.AsByteArray;
		}

		public static implicit operator JSONNode(List<byte> aByteList)
		{
			return new JSONArray
			{
				AsByteList = aByteList
			};
		}

		public static implicit operator List<byte>(JSONNode aNode)
		{
			return aNode.AsByteList;
		}

		public static implicit operator JSONNode(string[] aStringArray)
		{
			return new JSONArray
			{
				AsStringArray = aStringArray
			};
		}

		public static implicit operator string[](JSONNode aNode)
		{
			return aNode.AsStringArray;
		}

		public static implicit operator JSONNode(List<string> aStringList)
		{
			return new JSONArray
			{
				AsStringList = aStringList
			};
		}

		public static implicit operator List<string>(JSONNode aNode)
		{
			return aNode.AsStringList;
		}

		public static implicit operator JSONNode(int? aValue)
		{
			if (!aValue.HasValue)
			{
				return JSONNull.CreateOrGet();
			}
			return new JSONNumber(aValue.Value);
		}

		public static implicit operator int?(JSONNode aNode)
		{
			if (aNode == null || aNode.IsNull)
			{
				return null;
			}
			return aNode.AsInt;
		}

		public static implicit operator JSONNode(float? aValue)
		{
			if (!aValue.HasValue)
			{
				return JSONNull.CreateOrGet();
			}
			return new JSONNumber(aValue.Value);
		}

		public static implicit operator float?(JSONNode aNode)
		{
			if (aNode == null || aNode.IsNull)
			{
				return null;
			}
			return aNode.AsFloat;
		}

		public static implicit operator JSONNode(double? aValue)
		{
			if (!aValue.HasValue)
			{
				return JSONNull.CreateOrGet();
			}
			return new JSONNumber(aValue.Value);
		}

		public static implicit operator double?(JSONNode aNode)
		{
			if (aNode == null || aNode.IsNull)
			{
				return null;
			}
			return aNode.AsDouble;
		}

		public static implicit operator JSONNode(bool? aValue)
		{
			if (!aValue.HasValue)
			{
				return JSONNull.CreateOrGet();
			}
			return new JSONBool(aValue.Value);
		}

		public static implicit operator bool?(JSONNode aNode)
		{
			if (aNode == null || aNode.IsNull)
			{
				return null;
			}
			return aNode.AsBool;
		}

		public static implicit operator JSONNode(long? aValue)
		{
			if (!aValue.HasValue)
			{
				return JSONNull.CreateOrGet();
			}
			return new JSONNumber(aValue.Value);
		}

		public static implicit operator long?(JSONNode aNode)
		{
			if (aNode == null || aNode.IsNull)
			{
				return null;
			}
			return aNode.AsLong;
		}

		public static implicit operator JSONNode(short? aValue)
		{
			if (!aValue.HasValue)
			{
				return JSONNull.CreateOrGet();
			}
			return new JSONNumber(aValue.Value);
		}

		public static implicit operator short?(JSONNode aNode)
		{
			if (aNode == null || aNode.IsNull)
			{
				return null;
			}
			return aNode.AsShort;
		}

		private static JSONNode GetContainer(JSONContainerType aType)
		{
			if (aType == JSONContainerType.Array)
			{
				return new JSONArray();
			}
			return new JSONObject();
		}

		public static implicit operator JSONNode(Vector2 aVec)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			JSONNode container = GetContainer(VectorContainerType);
			container.WriteVector2(aVec);
			return container;
		}

		public static implicit operator JSONNode(Vector3 aVec)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			JSONNode container = GetContainer(VectorContainerType);
			container.WriteVector3(aVec);
			return container;
		}

		public static implicit operator JSONNode(Vector4 aVec)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			JSONNode container = GetContainer(VectorContainerType);
			container.WriteVector4(aVec);
			return container;
		}

		public static implicit operator JSONNode(Color aCol)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			JSONNode container = GetContainer(ColorContainerType);
			container.WriteColor(aCol);
			return container;
		}

		public static implicit operator JSONNode(Color32 aCol)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			JSONNode container = GetContainer(ColorContainerType);
			container.WriteColor32(aCol);
			return container;
		}

		public static implicit operator JSONNode(Quaternion aRot)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			JSONNode container = GetContainer(QuaternionContainerType);
			container.WriteQuaternion(aRot);
			return container;
		}

		public static implicit operator JSONNode(Rect aRect)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			JSONNode container = GetContainer(RectContainerType);
			container.WriteRect(aRect);
			return container;
		}

		public static implicit operator JSONNode(RectOffset aRect)
		{
			JSONNode container = GetContainer(RectContainerType);
			container.WriteRectOffset(aRect);
			return container;
		}

		public static implicit operator JSONNode(Matrix4x4 aMatrix)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			JSONNode container = GetContainer(RectContainerType);
			container.WriteMatrix(aMatrix);
			return container;
		}

		public static implicit operator Vector2(JSONNode aNode)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			return aNode.ReadVector2();
		}

		public static implicit operator Vector3(JSONNode aNode)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			return aNode.ReadVector3();
		}

		public static implicit operator Vector4(JSONNode aNode)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			return aNode.ReadVector4();
		}

		public static implicit operator Color(JSONNode aNode)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			return aNode.ReadColor();
		}

		public static implicit operator Color32(JSONNode aNode)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			return aNode.ReadColor32();
		}

		public static implicit operator Quaternion(JSONNode aNode)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			return aNode.ReadQuaternion();
		}

		public static implicit operator Rect(JSONNode aNode)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			return aNode.ReadRect();
		}

		public static implicit operator RectOffset(JSONNode aNode)
		{
			return aNode.ReadRectOffset();
		}

		public static implicit operator Matrix4x4(JSONNode aNode)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			return aNode.ReadMatrix();
		}

		public Vector2 ReadVector2(Vector2 aDefault)
		{
			//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_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			if (IsObject)
			{
				return new Vector2(this["x"].AsFloat, this["y"].AsFloat);
			}
			if (IsArray)
			{
				return new Vector2(this[0].AsFloat, this[1].AsFloat);
			}
			return aDefault;
		}

		public Vector2 ReadVector2(string aXName, string aYName)
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			if (IsObject)
			{
				return new Vector2(this[aXName].AsFloat, this[aYName].AsFloat);
			}
			return Vector2.zero;
		}

		public Vector2 ReadVector2()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			return ReadVector2(Vector2.zero);
		}

		public JSONNode WriteVector2(Vector2 aVec, string aXName = "x", string aYName = "y")
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			if (IsObject)
			{
				Inline = true;
				this[aXName].AsFloat = aVec.x;
				this[aYName].AsFloat = aVec.y;
			}
			else if (IsArray)
			{
				Inline = true;
				this[0].AsFloat = aVec.x;
				this[1].AsFloat = aVec.y;
			}
			return this;
		}

		public Vector3 ReadVector3(Vector3 aDefault)
		{
			//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_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: 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)
			if (IsObject)
			{
				return new Vector3(this["x"].AsFloat, this["y"].AsFloat, this["z"].AsFloat);
			}
			if (IsArray)
			{
				return new Vector3(this[0].AsFloat, this[1].AsFloat, this[2].AsFloat);
			}
			return aDefault;
		}

		public Vector3 ReadVector3(string aXName, string aYName, string aZName)
		{
			//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_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			if (IsObject)
			{
				return new Vector3(this[aXName].AsFloat, this[aYName].AsFloat, this[aZName].AsFloat);
			}
			return Vector3.zero;
		}

		public Vector3 ReadVector3()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			return ReadVector3(Vector3.zero);
		}

		public JSONNode WriteVector3(Vector3 aVec, string aXName = "x", string aYName = "y", string aZName = "z")
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			if (IsObject)
			{
				Inline = true;
				this[aXName].AsFloat = aVec.x;
				this[aYName].AsFloat = aVec.y;
				this[aZName].AsFloat = aVec.z;
			}
			else if (IsArray)
			{
				Inline = true;
				this[0].AsFloat = aVec.x;
				this[1].AsFloat = aVec.y;
				this[2].AsFloat = aVec.z;
			}
			return this;
		}

		public Vector4 ReadVector4(Vector4 aDefault)
		{
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: 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_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			if (IsObject)
			{
				return new Vector4(this["x"].AsFloat, this["y"].AsFloat, this["z"].AsFloat, this["w"].AsFloat);
			}
			if (IsArray)
			{
				return new Vector4(this[0].AsFloat, this[1].AsFloat, this[2].AsFloat, this[3].AsFloat);
			}
			return aDefault;
		}

		public Vector4 ReadVector4()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			return ReadVector4(Vector4.zero);
		}

		public JSONNode WriteVector4(Vector4 aVec)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: 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_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			if (IsObject)
			{
				Inline = true;
				this["x"].AsFloat = aVec.x;
				this["y"].AsFloat = aVec.y;
				this["z"].AsFloat = aVec.z;
				this["w"].AsFloat = aVec.w;
			}
			else if (IsArray)
			{
				Inline = true;
				this[0].AsFloat = aVec.x;
				this[1].AsFloat = aVec.y;
				this[2].AsFloat = aVec.z;
				this[3].AsFloat = aVec.w;
			}
			return this;
		}

		public Color ReadColor(Color aDefault)
		{
			//IL_00b9: 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_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			if (IsObject)
			{
				return new Color(this["r"].AsFloat, this["g"].AsFloat, this["b"].AsFloat, HasKey("a") ? this["a"].AsFloat : ColorDefaultAlpha);
			}
			if (IsArray)
			{
				return new Color(this[0].AsFloat, this[1].AsFloat, this[2].AsFloat, (Count > 3) ? this[3].AsFloat : ColorDefaultAlpha);
			}
			return aDefault;
		}

		public Color ReadColor()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			return ReadColor(Color.clear);
		}

		public JSONNode WriteColor(Color aCol)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: 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_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			if (IsObject)
			{
				Inline = true;
				this["r"].AsFloat = aCol.r;
				this["g"].AsFloat = aCol.g;
				this["b"].AsFloat = aCol.b;
				this["a"].AsFloat = aCol.a;
			}
			else if (IsArray)
			{
				Inline = true;
				this[0].AsFloat = aCol.r;
				this[1].AsFloat = aCol.g;
				this[2].AsFloat = aCol.b;
				this[3].AsFloat = aCol.a;
			}
			return this;
		}

		public Color32 ReadColor32(Color32 aDefault)
		{
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: 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_00be: Unknown result type (might be due to invalid IL or missing references)
			if (IsObject)
			{
				return new Color32((byte)this["r"].AsInt, (byte)this["g"].AsInt, (byte)this["b"].AsInt, (byte)(HasKey("a") ? this["a"].AsInt : Color32DefaultAlpha));
			}
			if (IsArray)
			{
				return new Color32((byte)this[0].AsInt, (byte)this[1].AsInt, (byte)this[2].AsInt, (byte)((Count > 3) ? this[3].AsInt : Color32DefaultAlpha));
			}
			return aDefault;
		}

		public Color32 ReadColor32()
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			return ReadColor32(default(Color32));
		}

		public JSONNode WriteColor32(Color32 aCol)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: 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_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			if (IsObject)
			{
				Inline = true;
				this["r"].AsInt = aCol.r;
				this["g"].AsInt = aCol.g;
				this["b"].AsInt = aCol.b;
				this["a"].AsInt = aCol.a;
			}
			else if (IsArray)
			{
				Inline = true;
				this[0].AsInt = aCol.r;
				this[1].AsInt = aCol.g;
				this[2].AsInt = aCol.b;
				this[3].AsInt = aCol.a;
			}
			return this;
		}

		public Quaternion ReadQuaternion(Quaternion aDefault)
		{
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: 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_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			if (IsObject)
			{
				return new Quaternion(this["x"].AsFloat, this["y"].AsFloat, this["z"].AsFloat, this["w"].AsFloat);
			}
			if (IsArray)
			{
				return new Quaternion(this[0].AsFloat, this[1].AsFloat, this[2].AsFloat, this[3].AsFloat);
			}
			return aDefault;
		}

		public Quaternion ReadQuaternion()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			return ReadQuaternion(Quaternion.identity);
		}

		public JSONNode WriteQuaternion(Quaternion aRot)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: 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_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			if (IsObject)
			{
				Inline = true;
				this["x"].AsFloat = aRot.x;
				this["y"].AsFloat = aRot.y;
				this["z"].AsFloat = aRot.z;
				this["w"].AsFloat = aRot.w;
			}
			else if (IsArray)
			{
				Inline = true;
				this[0].AsFloat = aRot.x;
				this[1].AsFloat = aRot.y;
				this[2].AsFloat = aRot.z;
				this[3].AsFloat = aRot.w;
			}
			return this;
		}

		public Rect ReadRect(Rect aDefault)
		{
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: 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_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			if (IsObject)
			{
				return new Rect(this["x"].AsFloat, this["y"].AsFloat, this["width"].AsFloat, this["height"].AsFloat);
			}
			if (IsArray)
			{
				return new Rect(this[0].AsFloat, this[1].AsFloat, this[2].AsFloat, this[3].AsFloat);
			}
			return aDefault;
		}

		public Rect ReadRect()
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			return ReadRect(default(Rect));
		}

		public JSONNode WriteRect(Rect aRect)
		{
			if (IsObject)
			{
				Inline = true;
				this["x"].AsFloat = ((Rect)(ref aRect)).x;
				this["y"].AsFloat = ((Rect)(ref aRect)).y;
				this["width"].AsFloat = ((Rect)(ref aRect)).width;
				this["height"].AsFloat = ((Rect)(ref aRect)).height;
			}
			else if (IsArray)
			{
				Inline = true;
				this[0].AsFloat = ((Rect)(ref aRect)).x;
				this[1].AsFloat = ((Rect)(ref aRect)).y;
				this[2].AsFloat = ((Rect)(ref aRect)).width;
				this[3].AsFloat = ((Rect)(ref aRect)).height;
			}
			return this;
		}

		public RectOffset ReadRectOffset(RectOffset aDefault)
		{
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Expected O, but got Unknown
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Expected O, but got Unknown
			if (this is JSONObject)
			{
				return new RectOffset(this["left"].AsInt, this["right"].AsInt, this["top"].AsInt, this["bottom"].AsInt);
			}
			if (this is JSONArray)
			{
				return new RectOffset(this[0].AsInt, this[1].AsInt, this[2].AsInt, this[3].AsInt);
			}
			return aDefault;
		}

		public RectOffset ReadRectOffset()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			return ReadRectOffset(new RectOffset());
		}

		public JSONNode WriteRectOffset(RectOffset aRect)
		{
			if (IsObject)
			{
				Inline = true;
				this["left"].AsInt = aRect.left;
				this["right"].AsInt = aRect.right;
				this["top"].AsInt = aRect.top;
				this["bottom"].AsInt = aRect.bottom;
			}
			else if (IsArray)
			{
				Inline = true;
				this[0].AsInt = aRect.left;
				this[1].AsInt = aRect.right;
				this[2].AsInt = aRect.top;
				this[3].AsInt = aRect.bottom;
			}
			return this;
		}

		public Matrix4x4 ReadMatrix()
		{
			//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_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			Matrix4x4 identity = Matrix4x4.identity;
			if (IsArray)
			{
				for (int i = 0; i < 16; i++)
				{
					((Matrix4x4)(ref identity))[i] = this[i].AsFloat;
				}
			}
			return identity;
		}

		public JSONNode WriteMatrix(Matrix4x4 aMatrix)
		{
			if (IsArray)
			{
				Inline = true;
				for (int i = 0; i < 16; i++)
				{
					this[i].AsFloat = ((Matrix4x4)(ref aMatrix))[i];
				}
			}
			return this;
		}
	}
	public class JSONArray : JSONNode
	{
		private readonly List<JSONNode> m_List = new List<JSONNode>();

		private bool inline;

		public override bool Inline
		{
			get
			{
				return inline;
			}
			set
			{
				inline = value;
			}
		}

		public override JSONNodeType Tag => JSONNodeType.Array;

		public override bool IsArray => true;

		public override JSONNode this[int aIndex]
		{
			get
			{
				if (aIndex < 0 || aIndex >= m_List.Count)
				{
					return new JSONLazyCreator(this);
				}
				return m_List[aIndex];
			}
			set
			{
				if (value == null)
				{
					value = JSONNull.CreateOrGet();
				}
				if (aIndex < 0 || aIndex >= m_List.Count)
				{
					m_List.Add(value);
				}
				else
				{
					m_List[aIndex] = value;
				}
			}
		}

		public override JSONNode this[string aKey]
		{
			get
			{
				return new JSONLazyCreator(this);
			}
			set
			{
				if (value == null)
				{
					value = JSONNull.CreateOrGet();
				}
				m_List.Add(value);
			}
		}

		public override int Count => m_List.Count;

		public override IEnumerable<JSONNode> Children
		{
			get
			{
				foreach (JSONNode item in m_List)
				{
					yield return item;
				}
			}
		}

		public override Enumerator GetEnumerator()
		{
			return new Enumerator(m_List.GetEnumerator());
		}

		public override void Add(string aKey, JSONNode aItem)
		{
			if (aItem == null)
			{
				aItem = JSONNull.CreateOrGet();
			}
			m_List.Add(aItem);
		}

		public override JSONNode Remove(int aIndex)
		{
			if (aIndex < 0 || aIndex >= m_List.Count)
			{
				return null;
			}
			JSONNode result = m_List[aIndex];
			m_List.RemoveAt(aIndex);
			return result;
		}

		public override JSONNode Remove(JSONNode aNode)
		{
			m_List.Remove(aNode);
			return aNode;
		}

		public override void Clear()
		{
			m_List.Clear();
		}

		public override JSONNode Clone()
		{
			JSONArray jSONArray = new JSONArray();
			jSONArray.m_List.Capacity = m_List.Capacity;
			foreach (JSONNode item in m_List)
			{
				if (item != null)
				{
					jSONArray.Add(item.Clone());
				}
				else
				{
					jSONArray.Add(null);
				}
			}
			return jSONArray;
		}

		internal override void WriteToStringBuilder(StringBuilder aSB, int aIndent, int aIndentInc, JSONTextMode aMode)
		{
			aSB.Append('[');
			int count = m_List.Count;
			if (inline)
			{
				aMode = JSONTextMode.Compact;
			}
			for (int i = 0; i < count; i++)
			{
				if (i > 0)
				{
					aSB.Append(',');
				}
				if (aMode == JSONTextMode.Indent)
				{
					aSB.AppendLine();
				}
				if (aMode == JSONTextMode.Indent)
				{
					aSB.Append(' ', aIndent + aIndentInc);
				}
				m_List[i].WriteToStringBuilder(aSB, aIndent + aIndentInc, aIndentInc, aMode);
			}
			if (aMode == JSONTextMode.Indent)
			{
				aSB.AppendLine().Append(' ', aIndent);
			}
			aSB.Append(']');
		}

		public override void SerializeBinary(BinaryWriter aWriter)
		{
			aWriter.Write((byte)1);
			aWriter.Write(m_List.Count);
			for (int i = 0; i < m_List.Count; i++)
			{
				m_List[i].SerializeBinary(aWriter);
			}
		}
	}
	public class JSONObject : JSONNode
	{
		private readonly Dictionary<string, JSONNode> m_Dict = new Dictionary<string, JSONNode>();

		private bool inline;

		public override bool Inline
		{
			get
			{
				return inline;
			}
			set
			{
				inline = value;
			}
		}

		public override JSONNodeType Tag => JSONNodeType.Object;

		public override bool IsObject => true;

		public override JSONNode this[string aKey]
		{
			get
			{
				if (m_Dict.ContainsKey(aKey))
				{
					return m_Dict[aKey];
				}
				return new JSONLazyCreator(this, aKey);
			}
			set
			{
				if (value == null)
				{
					value = JSONNull.CreateOrGet();
				}
				if (m_Dict.ContainsKey(aKey))
				{
					m_Dict[aKey] = value;
				}
				else
				{
					m_Dict.Add(aKey, value);
				}
			}
		}

		public override JSONNode this[int aIndex]
		{
			get
			{
				if (aIndex < 0 || aIndex >= m_Dict.Count)
				{
					return null;
				}
				return m_Dict.ElementAt(aIndex).Value;
			}
			set
			{
				if (value == null)
				{
					value = JSONNull.CreateOrGet();
				}
				if (aIndex >= 0 && aIndex < m_Dict.Count)
				{
					string key = m_Dict.ElementAt(aIndex).Key;
					m_Dict[key] = value;
				}
			}
		}

		public override int Count => m_Dict.Count;

		public override IEnumerable<JSONNode> Children
		{
			get
			{
				foreach (KeyValuePair<string, JSONNode> item in m_Dict)
				{
					yield return item.Value;
				}
			}
		}

		public override Enumerator GetEnumerator()
		{
			return new Enumerator(m_Dict.GetEnumerator());
		}

		public override void Add(string aKey, JSONNode aItem)
		{
			if (aItem == null)
			{
				aItem = JSONNull.CreateOrGet();
			}
			if (aKey != null)
			{
				if (m_Dict.ContainsKey(aKey))
				{
					m_Dict[aKey] = aItem;
				}
				else
				{
					m_Dict.Add(aKey, aItem);
				}
			}
			else
			{
				m_Dict.Add(Guid.NewGuid().ToString(), aItem);
			}
		}

		public override JSONNode Remove(string aKey)
		{
			if (!m_Dict.ContainsKey(aKey))
			{
				return null;
			}
			JSONNode result = m_Dict[aKey];
			m_Dict.Remove(aKey);
			return result;
		}

		public override JSONNode Remove(int aIndex)
		{
			if (aIndex < 0 || aIndex >= m_Dict.Count)
			{
				return null;
			}
			KeyValuePair<string, JSONNode> keyValuePair = m_Dict.ElementAt(aIndex);
			m_Dict.Remove(keyValuePair.Key);
			return keyValuePair.Value;
		}

		public override JSONNode Remove(JSONNode aNode)
		{
			try
			{
				KeyValuePair<string, JSONNode> keyValuePair = m_Dict.Where((KeyValuePair<string, JSONNode> k) => k.Value == aNode).First();
				m_Dict.Remove(keyValuePair.Key);
				return aNode;
			}
			catch
			{
				return null;
			}
		}

		public override void Clear()
		{
			m_Dict.Clear();
		}

		public override JSONNode Clone()
		{
			JSONObject jSONObject = new JSONObject();
			foreach (KeyValuePair<string, JSONNode> item in m_Dict)
			{
				jSONObject.Add(item.Key, item.Value.Clone());
			}
			return jSONObject;
		}

		public override bool HasKey(string aKey)
		{
			return m_Dict.ContainsKey(aKey);
		}

		public override JSONNode GetValueOrDefault(string aKey, JSONNode aDefault)
		{
			if (m_Dict.TryGetValue(aKey, out var value))
			{
				return value;
			}
			return aDefault;
		}

		internal override void WriteToStringBuilder(StringBuilder aSB, int aIndent, int aIndentInc, JSONTextMode aMode)
		{
			aSB.Append('{');
			if (Children.Count() != 0)
			{
				bool flag = true;
				if (inline)
				{
					aMode = JSONTextMode.Compact;
				}
				foreach (KeyValuePair<string, JSONNode> item in m_Dict)
				{
					if (!flag)
					{
						aSB.Append(',');
					}
					flag = false;
					if (aMode == JSONTextMode.Indent)
					{
						aSB.AppendLine();
					}
					if (aMode == JSONTextMode.Indent)
					{
						aSB.Append(' ', aIndent + aIndentInc);
					}
					aSB.Append('"').Append(JSONNode.Escape(item.Key)).Append('"');
					if (aMode == JSONTextMode.Compact)
					{
						aSB.Append(':');
					}
					else
					{
						aSB.Append(": ");
					}
					item.Value.WriteToStringBuilder(aSB, aIndent + aIndentInc, aIndentInc, aMode);
				}
				if (aMode == JSONTextMode.Indent)
				{
					aSB.AppendLine().Append(' ', aIndent);
				}
			}
			aSB.Append('}');
		}

		public override void SerializeBinary(BinaryWriter aWriter)
		{
			aWriter.Write((byte)2);
			aWriter.Write(m_Dict.Count);
			foreach (string key in m_Dict.Keys)
			{
				aWriter.Write(key);
				m_Dict[key].SerializeBinary(aWriter);
			}
		}
	}
	public class JSONString : JSONNode
	{
		private string m_Data;

		public override JSONNodeType Tag => JSONNodeType.String;

		public override bool IsString => true;

		public override string Value
		{
			get
			{
				return m_Data;
			}
			set
			{
				m_Data = value;
			}
		}

		public JSONString(string aData)
		{
			m_Data = aData;
		}

		public override Enumerator GetEnumerator()
		{
			return default(Enumerator);
		}

		public override JSONNode Clone()
		{
			return new JSONString(m_Data);
		}

		internal override void WriteToStringBuilder(StringBuilder aSB, int aIndent, int aIndentInc, JSONTextMode aMode)
		{
			aSB.Append('"').Append(JSONNode.Escape(m_Data)).Append('"');
		}

		public override bool Equals(object obj)
		{
			if (base.Equals(obj))
			{
				return true;
			}
			if (obj is string text)
			{
				return m_Data == text;
			}
			JSONString jSONString = obj as JSONString;
			if (jSONString != null)
			{
				return m_Data == jSONString.m_Data;
			}
			return false;
		}

		public override int GetHashCode()
		{
			return m_Data.GetHashCode();
		}

		public override void Clear()
		{
			m_Data = "";
		}

		public override void SerializeBinary(BinaryWriter aWriter)
		{
			aWriter.Write((byte)3);
			aWriter.Write(m_Data);
		}
	}
	public class JSONNumber : JSONNode
	{
		private double m_Data;

		public override JSONNodeType Tag => JSONNodeType.Number;

		public override bool IsNumber => true;

		public override string Value
		{
			get
			{
				return m_Data.ToString(CultureInfo.InvariantCulture);
			}
			set
			{
				if (double.TryParse(value, NumberStyles.Float, CultureInfo.InvariantCulture, out var result))
				{
					m_Data = result;
				}
			}
		}

		public override double AsDouble
		{
			get
			{
				return m_Data;
			}
			set
			{
				m_Data = value;
			}
		}

		public override long AsLong
		{
			get
			{
				return (long)m_Data;
			}
			set
			{
				m_Data = value;
			}
		}

		public override ulong AsULong
		{
			get
			{
				return (ulong)m_Data;
			}
			set
			{
				m_Data = value;
			}
		}

		public JSONNumber(double aData)
		{
			m_Data = aData;
		}

		public JSONNumber(string value)
		{
			Value = value;
		}

		public override Enumerator GetEnumerator()
		{
			return default(Enumerator);
		}

		public override JSONNode Clone()
		{
			return new JSONNumber(m_Data);
		}

		internal override void WriteToStringBuilder(StringBuilder aSB, int aIndent, int aIndentInc, JSONTextMode aMode)
		{
			aSB.Append(m_Data.ToString("R", CultureInfo.InvariantCulture));
		}

		public static bool IsNumeric(object value)
		{
			return value is int || value is uint || value is float || value is double || value is decimal || value is long || value is ulong || value is short || value is ushort || value is sbyte || value is byte;
		}

		public override bool Equals(object obj)
		{
			if (obj == null)
			{
				return false;
			}
			if (base.Equals(obj))
			{
				return true;
			}
			JSONNumber jSONNumber = obj as JSONNumber;
			if (jSONNumber != null)
			{
				return m_Data == jSONNumber.m_Data;
			}
			if (IsNumeric(obj))
			{
				return Convert.ToDouble(obj) == m_Data;
			}
			return false;
		}

		public override int GetHashCode()
		{
			return m_Data.GetHashCode();
		}

		public override void Clear()
		{
			m_Data = 0.0;
		}

		public override void SerializeBinary(BinaryWriter aWriter)
		{
			aWriter.Write((byte)4);
			aWriter.Write(m_Data);
		}
	}
	public class JSONBool : JSONNode
	{
		private bool m_Data;

		public override JSONNodeType Tag => JSONNodeType.Boolean;

		public override bool IsBoolean => true;

		public override string Value
		{
			get
			{
				return m_Data.ToString();
			}
			set
			{
				if (bool.TryParse(value, out var result))
				{
					m_Data = result;
				}
			}
		}

		public override bool AsBool
		{
			get
			{
				return m_Data;
			}
			set
			{
				m_Data = value;
			}
		}

		public JSONBool(bool aData)
		{
			m_Data = aData;
		}

		public JSONBool(string aData)
		{
			Value = aData;
		}

		public override Enumerator GetEnumerator()
		{
			return default(Enumerator);
		}

		public override JSONNode Clone()
		{
			return new JSONBool(m_Data);
		}

		internal override void WriteToStringBuilder(StringBuilder aSB, int aIndent, int aIndentInc, JSONTextMode aMode)
		{
			aSB.Append(m_Data ? "true" : "false");
		}

		public override bool Equals(object obj)
		{
			if (obj == null)
			{
				return false;
			}
			if (obj is bool)
			{
				return m_Data == (bool)obj;
			}
			return false;
		}

		public override int GetHashCode()
		{
			return m_Data.GetHashCode();
		}

		public override void Clear()
		{
			m_Data = false;
		}

		public override void SerializeBinary(BinaryWriter aWriter)
		{
			aWriter.Write((byte)6);
			aWriter.Write(m_Data);
		}
	}
	public class JSONNull : JSONNode
	{
		private static readonly JSONNull m_StaticInstance = new JSONNull();

		public static bool reuseSameInstance = true;

		public override JSONNodeType Tag => JSONNodeType.NullValue;

		public override bool IsNull => true;

		public override string Value
		{
			get
			{
				return "null";
			}
			set
			{
			}
		}

		public override bool AsBool
		{
			get
			{
				return false;
			}
			set
			{
			}
		}

		private JSONNull()
		{
		}

		public static JSONNull CreateOrGet()
		{
			if (reuseSameInstance)
			{
				return m_StaticInstance;
			}
			return new JSONNull();
		}

		public override Enumerator GetEnumerator()
		{
			return default(Enumerator);
		}

		public override JSONNode Clone()
		{
			return CreateOrGet();
		}

		public override bool Equals(object obj)
		{
			if ((object)this == obj)
			{
				return true;
			}
			return obj is JSONNull;
		}

		public override int GetHashCode()
		{
			return 0;
		}

		internal override void WriteToStringBuilder(StringBuilder aSB, int aIndent, int aIndentInc, JSONTextMode aMode)
		{
			aSB.Append("null");
		}

		public override void SerializeBinary(BinaryWriter aWriter)
		{
			aWriter.Write((byte)5);
		}
	}
	internal class JSONLazyCreator : JSONNode
	{
		private readonly string m_Key;

		private JSONNode m_Node;

		public override JSONNodeType Tag => JSONNodeType.None;

		public override JSONNode this[int aIndex]
		{
			get
			{
				return new JSONLazyCreator(this);
			}
			set
			{
				Set(new JSONArray()).Add(value);
			}
		}

		public override JSONNode this[string aKey]
		{
			get
			{
				return new JSONLazyCreator(this, aKey);
			}
			set
			{
				Set(new JSONObject()).Add(aKey, value);
			}
		}

		public override int AsInt
		{
			get
			{
				Set(new JSONNumber(0.0));
				return 0;
			}
			set
			{
				Set(new JSONNumber(value));
			}
		}

		public override float AsFloat
		{
			get
			{
				Set(new JSONNumber(0.0));
				return 0f;
			}
			set
			{
				Set(new JSONNumber(value));
			}
		}

		public override double AsDouble
		{
			get
			{
				Set(new JSONNumber(0.0));
				return 0.0;
			}
			set
			{
				Set(new JSONNumber(value));
			}
		}

		public override long AsLong
		{
			get
			{
				if (JSONNode.longAsString)
				{
					Set(new JSONString("0"));
				}
				else
				{
					Set(new JSONNumber(0.0));
				}
				return 0L;
			}
			set
			{
				if (JSONNode.longAsString)
				{
					Set(new JSONString(value.ToString()));
				}
				else
				{
					Set(new JSONNumber(value));
				}
			}
		}

		public override ulong AsULong
		{
			get
			{
				if (JSONNode.longAsString)
				{
					Set(new JSONString("0"));
				}
				else
				{
					Set(new JSONNumber(0.0));
				}
				return 0uL;
			}
			set
			{
				if (JSONNode.longAsString)
				{
					Set(new JSONString(value.ToString()));
				}
				else
				{
					Set(new JSONNumber(value));
				}
			}
		}

		public override bool AsBool
		{
			get
			{
				Set(new JSONBool(aData: false));
				return false;
			}
			set
			{
				Set(new JSONBool(value));
			}
		}

		public override JSONArray AsArray => Set(new JSONArray());

		public override JSONObject AsObject => Set(new JSONObject());

		public JSONLazyCreator(JSONNode aNode)
		{
			m_Node = aNode;
			m_Key = null;
		}

		public JSONLazyCreator(JSONNode aNode, string aKey)
		{
			m_Node = aNode;
			m_Key = aKey;
		}

		public override Enumerator GetEnumerator()
		{
			return default(Enumerator);
		}

		private T Set<T>(T aVal) where T : JSONNode
		{
			if (m_Key == null)
			{
				m_Node.Add(aVal);
			}
			else
			{
				m_Node.Add(m_Key, aVal);
			}
			m_Node = null;
			return aVal;
		}

		public override void Add(JSONNode aItem)
		{
			Set(new JSONArray()).Add(aItem);
		}

		public override void Add(string aKey, JSONNode aItem)
		{
			Set(new JSONObject()).Add(aKey, aItem);
		}

		public static bool operator ==(JSONLazyCreator a, object b)
		{
			if (b == null)
			{
				return true;
			}
			return (object)a == b;
		}

		public static bool operator !=(JSONLazyCreator a, object b)
		{
			return !(a == b);
		}

		public override bool Equals(object obj)
		{
			if (obj == null)
			{
				return true;
			}
			return (object)this == obj;
		}

		public override int GetHashCode()
		{
			return 0;
		}

		internal override void WriteToStringBuilder(StringBuilder aSB, int aIndent, int aIndentInc, JSONTextMode aMode)
		{
			aSB.Append("null");
		}

		public override void SerializeBinary(BinaryWriter aWriter)
		{
		}
	}
	public static class JSON
	{
		public static JSONNode Parse(string aJSON)
		{
			return JSONNode.Parse(aJSON);
		}

		public static string ToJson(object data, bool isIndented = true)
		{
			return new SimpleJSONBuilder().Serialize(data, isIndented);
		}

		public static T FromJson<T>(string data) where T : new()
		{
			return new SimpleJSONBuilder().Deserialize<T>(data);
		}
	}
	public class SimpleJSONBuilder
	{
		public T Deserialize<T>(string serializationStream) where T : new()
		{
			JSONNode value = JSON.Parse(serializationStream);
			return (T)SimpleJSONStaticParser.FromJsonNode(value, typeof(T), default(SimpleJSONParserSettings));
		}

		public string Serialize(object graph, bool isIndented)
		{
			SimpleJSONParserSettings simpleJSONParserSettings = default(SimpleJSONParserSettings);
			simpleJSONParserSettings.IsIndented = isIndented;
			SimpleJSONParserSettings settings = simpleJSONParserSettings;
			JSONNode jSONNode = SimpleJSONStaticParser.ToJsonNode(graph, settings);
			StringBuilder stringBuilder = new StringBuilder();
			jSONNode.WriteToStringBuilder(stringBuilder, 0, settings.IsIndented ? 2 : 0, settings.IsIndented ? JSONTextMode.Indent : JSONTextMode.Compact);
			return stringBuilder.ToString();
		}
	}
	public struct SimpleJSONParserSettings
	{
		public bool IsIndented;

		public static SimpleJSONParserSettings Default()
		{
			SimpleJSONParserSettings result = default(SimpleJSONParserSettings);
			result.IsIndented = true;
			return result;
		}
	}
	public static class SimpleJSONStaticParser
	{
		public static object FromJsonNodeImplicitSlow(JSONNode node, Type type)
		{
			Type typeFromHandle = typeof(JSONNode);
			MethodInfo methodInfo = typeFromHandle.GetMethods(BindingFlags.Static | BindingFlags.Public).FirstOrDefault((MethodInfo info) => info.Name == "op_Implicit" && info.ReturnType == type);
			if (methodInfo != null)
			{
				object[] parameters = new JSONNode[1] { node };
				return methodInfo.Invoke(null, parameters);
			}
			return node;
		}

		public static object FromJsonNode(JSONNode value, Type type, SimpleJSONParserSettings settings)
		{
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0223: 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_0273: Unknown result type (might be due to invalid IL or missing references)
			//IL_02be: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_030e: Unknown result type (might be due to invalid IL or missing references)
			if (value == null)
			{
				return null;
			}
			if (type == typeof(string))
			{
				return (string)value;
			}
			if (type == typeof(char))
			{
				return (char)value;
			}
			if (type == typeof(bool))
			{
				return (bool)value;
			}
			if (typeof(IList).IsAssignableFrom(type))
			{
				Type typeFromHandle = typeof(List<>);
				Type[] genericArguments = type.GetGenericArguments();
				Type type2 = typeFromHandle.MakeGenericType(genericArguments);
				IList list = (IList)Activator.CreateInstance(type2);
				foreach (JSONNode child in value.AsArray.Children)
				{
					list.Add(FromJsonNode(child, genericArguments[0], settings));
				}
				return list;
			}
			if (typeof(IDictionary).IsAssignableFrom(type))
			{
				Type typeFromHandle2 = typeof(Dictionary<, >);
				Type[] genericArguments2 = type.GetGenericArguments();
				Type type3 = typeFromHandle2.MakeGenericType(genericArguments2);
				IDictionary dictionary = (IDictionary)Activator.CreateInstance(type3);
				JSONNode.Enumerator enumerator2 = value.GetEnumerator();
				while (enumerator2.MoveNext())
				{
					KeyValuePair<string, JSONNode> current2 = enumerator2.Current;
					dictionary.Add(FromJsonNode(current2.Key, genericArguments2[0], settings), FromJsonNode(current2.Value, genericArguments2[1], settings));
				}
				return dictionary;
			}
			if (type == typeof(Vector2))
			{
				return (Vector2)value;
			}
			if (type == typeof(Vector3))
			{
				return (Vector3)value;
			}
			if (type == typeof(Vector4))
			{
				return (Vector4)value;
			}
			if (type == typeof(Quaternion))
			{
				return (Quaternion)value;
			}
			if (type == typeof(Rect))
			{
				return (Rect)value;
			}
			if (type == typeof(RectOffset))
			{
				return (RectOffset)value;
			}
			if (type == typeof(Matrix4x4))
			{
				return (Matrix4x4)value;
			}
			if (type == typeof(Color))
			{
				return (Color)value;
			}
			if (type == typeof(Color32))
			{
				return (Color32)value;
			}
			if (type == typeof(byte))
			{
				return (byte)value;
			}
			if (type == typeof(sbyte))
			{
				return (sbyte)value;
			}
			if (type == typeof(int))
			{
				return (int)value;
			}
			if (type == typeof(uint))
			{
				return (uint)value;
			}
			if (type == typeof(short))
			{
				return (short)value;
			}
			if (type == typeof(ushort))
			{
				return (ushort)value;
			}
			if (type == typeof(char))
			{
				return (char)value;
			}
			if (type == typeof(float))
			{
				return (float)value;
			}
			if (type == typeof(double))
			{
				return (double)value;
			}
			if (type == typeof(decimal))
			{
				return (decimal)value;
			}
			if (type == typeof(long))
			{
				return (long)value;
			}
			if (type == typeof(ulong))
			{
				return (ulong)value;
			}
			object obj = Activator.CreateInstance(type);
			FieldInfo[] fields = type.GetFields(BindingFlags.Instance | BindingFlags.Public);
			FieldInfo[] array = fields;
			foreach (FieldInfo fieldInfo in array)
			{
				fieldInfo.SetValue(obj, FromJsonNode(value[fieldInfo.Name], fieldInfo.FieldType, settings));
			}
			return obj;
		}

		public static JSONNode ToJsonNode(object value, SimpleJSONParserSettings settings)
		{
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0206: 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_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_0226: Unknown result type (might be due to invalid IL or missing references)
			//IL_0236: Unknown result type (might be due to invalid IL or missing references)
			//IL_0246: Unknown result type (might be due to invalid IL or missing references)
			if (value != null)
			{
				if (!(value is JSONNode result))
				{
					if (!(value is string aData))
					{
						if (!(value is char c))
						{
							if (!(value is bool aData2))
							{
								if (!(value is IList list))
								{
									if (!(value is IDictionary dict))
									{
										if (!(value is Vector2 val))
										{
											if (!(value is Vector3 val2))
											{
												if (!(value is Vector4 val3))
												{
													if (!(value is Quaternion val4))
													{
														if (!(value is Rect val5))
														{
															RectOffset val6 = (RectOffset)((value is RectOffset) ? value : null);
															if (val6 == null)
															{
																if (!(value is Matrix4x4 val7))
																{
																	if (!(value is Color val8))
																	{
																		if (!(value is Color32 val9))
																		{
																			if (value is float num)
																			{
																				return new JSONNumber(num.ToString("R", CultureInfo.InvariantCulture));
																			}
																			if (JSONNumber.IsNumeric(value))
																			{
																				return new JSONNumber(Convert.ToDouble(value));
																			}
																			JSONObject jSONObject = new JSONObject();
																			FieldInfo[] fields = value.GetType().GetFields(BindingFlags.Instance | BindingFlags.Public);
																			FieldInfo[] array = fields;
																			foreach (FieldInfo fieldInfo in array)
																			{
																				object value2 = fieldInfo.GetValue(value);
																				JSONNode aItem = ToJsonNode(value2, settings);
																				jSONObject.Add(fieldInfo.Name, aItem);
																			}
																			return jSONObject;
																		}
																		return val9;
																	}
																	return val8;
																}
																return val7;
															}
															return val6;
														}
														return val5;
													}
													return val4;
												}
												return val3;
											}
											return val2;
										}
										return val;
									}
									return ToJsonNode(dict, settings);
								}
								return ToJsonNode(list, settings);
							}
							return new JSONBool(aData2);
						}
						return new JSONString(new string(c, 1));
					}
					return new JSONString(aData);
				}
				return result;
			}
			return JSONNull.CreateOrGet();
		}

		private static JSONArray ToJsonNode(IList list, SimpleJSONParserSettings settings)
		{
			JSONArray jSONArray = new JSONArray();
			for (int i = 0; i < list.Count; i++)
			{
				jSONArray.Add(ToJsonNode(list[i], settings));
			}
			return jSONArray;
		}

		private static JSONObject ToJsonNode(IDictionary dict, SimpleJSONParserSettings settings)
		{
			JSONObject jSONObject = new JSONObject();
			foreach (object key in dict.Keys)
			{
				jSONObject.Add(key.ToString(), ToJsonNode(dict[key], settings));
			}
			return jSONObject;
		}
	}
	public enum JSONContainerType
	{
		Array,
		Object
	}
}
namespace DSPJapanesePlugin
{
	internal class GASAccess
	{
		public static IEnumerator CheckAndDownload(string Url, string dstPath)
		{
			string LastUpdate = (File.Exists(dstPath) ? File.GetLastWriteTime(dstPath).ToString("yyyyMMddHHmmss") : "0");
			LogManager.Logger.LogInfo((object)("URL : " + Url + "?date=" + LastUpdate));
			UnityWebRequest request = UnityWebRequest.Get(Url + "?date=" + LastUpdate);
			request.timeout = 10;
			AsyncOperation checkAsync = (AsyncOperation)(object)request.SendWebRequest();
			while (!checkAsync.isDone)
			{
			}
			if (request.isNetworkError || request.isHttpError)
			{
				LogManager.Logger.LogInfo((object)("辞書チェックエラー : " + request.error));
			}
			else if (request.downloadHandler.text == "match")
			{
				LogManager.Logger.LogInfo((object)"辞書は最新です");
				Main.JPDictionary = JSON.FromJson<Dictionary<string, string>>(File.ReadAllText(dstPath));
			}
			else if (request.downloadHandler.data.Length < 2000)
			{
				LogManager.Logger.LogInfo((object)("辞書のダウンロードに失敗しました\u3000:\u3000" + Regex.Match(request.downloadHandler.text, "TypeError.*)")));
			}
			else
			{
				LogManager.Logger.LogInfo((object)"辞書をダウンロードしました");
				Main.JPDictionary = JSON.FromJson<Dictionary<string, string>>(request.downloadHandler.text);
				File.WriteAllText(dstPath, request.downloadHandler.text);
			}
			yield return null;
		}

		public static IEnumerator MakeFromSheet(string Url, string dstPath)
		{
			LogManager.Logger.LogInfo((object)("URL : " + Url));
			UnityWebRequest request = UnityWebRequest.Get(Url ?? "");
			request.timeout = 10;
			AsyncOperation checkAsync = (AsyncOperation)(object)request.SendWebRequest();
			while (!checkAsync.isDone)
			{
			}
			if (request.isNetworkError || request.isHttpError)
			{
				LogManager.Logger.LogInfo((object)("辞書チェックエラー : " + request.error));
			}
			else if (request.downloadHandler.data.Length < 2000)
			{
				LogManager.Logger.LogInfo((object)("辞書のダウンロードに失敗しました\u3000:\u3000" + Regex.Match(request.downloadHandler.text, "TypeError.*)")));
			}
			else
			{
				LogManager.Logger.LogInfo((object)"辞書をダウンロードしました");
				string strings = request.downloadHandler.text.Replace("[LF]", "\\n").Replace("[CRLF]", "\\r\\n");
				Main.JPDictionary = JSON.FromJson<Dictionary<string, string>>(strings);
				File.WriteAllText(dstPath, strings);
			}
			yield return null;
		}

		public static IEnumerator DownloadAndSave(string Url, string dstPath)
		{
			UnityWebRequest request = UnityWebRequest.Get(Url);
			AsyncOperation checkAsync = (AsyncOperation)(object)request.SendWebRequest();
			while (!checkAsync.isDone)
			{
			}
			if (request.isNetworkError || request.isHttpError)
			{
				LogManager.Logger.LogInfo((object)("Dictionary download error : " + request.error));
			}
			else
			{
				LogManager.Logger.LogInfo((object)"Dictionary downloaded");
				File.WriteAllText(dstPath, request.downloadHandler.text);
				LogManager.Logger.LogInfo((object)"Dictionary saved ");
			}
			yield return null;
		}

		public static IEnumerator TranslateString(string ENUSString)
		{
			if (ENUSString == "")
			{
				yield return "";
			}
			UnityWebRequest request = UnityWebRequest.Get(Main.TranslateGAS.Value + "?text=" + ENUSString);
			request.timeout = 10;
			AsyncOperation checkAsync = (AsyncOperation)(object)request.SendWebRequest();
			while (!checkAsync.isDone)
			{
			}
			if (request.isNetworkError || request.isHttpError)
			{
				LogManager.Logger.LogInfo((object)("GASアクセスエラー : " + request.error));
			}
			else if (request.downloadHandler.text == "traslateFailed")
			{
				LogManager.Logger.LogInfo((object)"GAS翻訳に失敗しました。");
			}
			else
			{
				LogManager.Logger.LogInfo((object)("GAS翻訳に成功しました。: " + request.downloadHandler.text));
			}
			yield return request.downloadHandler.text;
		}
	}
	[BepInPlugin("Appun.DSP.plugin.JapanesePlugin", "DSPJapanesePlugin", "1.2.8")]
	public class Main : BaseUnityPlugin
	{
		public static ConfigEntry<bool> EnableFixUI;

		public static ConfigEntry<bool> EnableAutoUpdate;

		public static ConfigEntry<bool> ImportSheet;

		public static ConfigEntry<bool> exportNewStrings;

		public static ConfigEntry<string> DictionaryGAS;

		public static ConfigEntry<string> SsheetGAS;

		public static ConfigEntry<string> TranslateGAS;

		public static string PluginPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

		public static string jsonFilePath = Path.Combine(PluginPath, "translation_DysonSphereProgram.json");

		public static string newStringsFilePath = Path.Combine(PluginPath, "newStrings.tsv");

		public static AssetBundle FontAssetBundle { get; set; }

		public static Font newFont { get; set; }

		public static Dictionary<string, string> JPDictionary { get; set; }

		public void Awake()
		{
			LogManager.Logger = ((BaseUnityPlugin)this).Logger;
			Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null);
			EnableFixUI = ((BaseUnityPlugin)this).Config.Bind<bool>("表示の修正:アップデートでエラーが出る場合はfalseにすると解消できる可能性があります。", "EnableFixUI", true, "日本語化に伴い発生する表示の問題を修正するか");
			EnableAutoUpdate = ((BaseUnityPlugin)this).Config.Bind<bool>("辞書自動アップデート:起動時に日本語辞書ファイルを自動でダウンロードすることができます。", "EnableAutoUpdate", true, "起動時に日本語辞書ファイルを自動でアップデートするかどうか");
			ImportSheet = ((BaseUnityPlugin)this).Config.Bind<bool>("翻訳者、開発者向けの設定:基本的に変更しないでください。", "ImportSheet", false, "翻訳作業所のシートのデータを取り込んで辞書ファイルを作るかどうか");
			DictionaryGAS = ((BaseUnityPlugin)this).Config.Bind<string>("翻訳者、開発者向けの設定:基本的に変更しないでください。", "DictionaryGAS", "https://script.google.com/macros/s/AKfycbwRjiRA6PUeh02MOQ6ccWfbhkQ3wW_qxM6MEl_UXcltGHnU59GLhIOcNNoM35NS7N7_/exec", "日本語辞書ファイル取得のスクリプトアドレス");
			SsheetGAS = ((BaseUnityPlugin)this).Config.Bind<string>("翻訳者、開発者向けの設定:基本的に変更しないでください。", "SsheetGAS", "https://script.google.com/macros/s/AKfycbxOATSa3MHENWQfWc8Ti6XLK-yx-HjzvoLMnO7S2u2nKuZYrRrD3Luh2NLA6jehgf1RUQ/exec", "翻訳作業所のシート取得のスクリプトアドレス");
			TranslateGAS = ((BaseUnityPlugin)this).Config.Bind<string>("翻訳者、開発者向けの設定:基本的に変更しないでください。", "TraslateGAS", "https://script.google.com/macros/s/AKfycbzaQLfuzNbo-uOO0XtLKq6xjQIgNC2_IibXbVzZEEtSRXBWKD06q8OuDMbZd_XQXHH8/exec", "google翻訳のスクリプトアドレス");
			exportNewStrings = ((BaseUnityPlugin)this).Config.Bind<bool>("翻訳者、開発者向けの設定:基本的に変更しないでください。", "exportNewStrings", false, "バージョンアップ時に新規文字列を翻訳作業所用に書き出すかどうか。");
			if (EnableAutoUpdate.Value)
			{
				if (!ImportSheet.Value)
				{
					LogManager.Logger.LogInfo((object)"完成済みの辞書をダウンロードします");
					IEnumerator enumerator = GASAccess.CheckAndDownload(DictionaryGAS.Value, jsonFilePath);
					enumerator.MoveNext();
				}
				else
				{
					LogManager.Logger.LogInfo((object)"辞書を作業所スプレッドシートから作成します");
					IEnumerator enumerator2 = GASAccess.MakeFromSheet(SsheetGAS.Value, jsonFilePath);
					enumerator2.MoveNext();
				}
			}
			if (JPDictionary == null)
			{
				LogManager.Logger.LogInfo((object)"辞書を既存のファイルから読み込みます");
				if (!File.Exists(jsonFilePath))
				{
					LogManager.Logger.LogInfo((object)("File not found" + jsonFilePath));
				}
				JPDictionary = JSON.FromJson<Dictionary<string, string>>(File.ReadAllText(jsonFilePath));
			}
			try
			{
				AssetBundle val = AssetBundle.LoadFromStream(Assembly.GetExecutingAssembly().GetManifestResourceStream("DSPJapanesePlugin.newjpfont"));
				if ((Object)(object)val == (Object)null)
				{
					LogManager.Logger.LogInfo((object)"Asset Bundle not loaded.");
					return;
				}
				FontAssetBundle = val;
				newFont = FontAssetBundle.LoadAsset<Font>("MPMK85");
				LogManager.Logger.LogInfo((object)("フォントを読み込みました : " + (object)newFont));
			}
			catch (Exception ex)
			{
				LogManager.Logger.LogInfo((object)("e.Message " + ex.Message));
				LogManager.Logger.LogInfo((object)("e.StackTrace " + ex.StackTrace));
			}
		}
	}
	public class LogManager
	{
		public static ManualLogSource Logger;
	}
	public class NewStrings
	{
		public static void Check()
		{
			StringBuilder stringBuilder = new StringBuilder();
			foreach (KeyValuePair<string, int> item in Localization.namesIndexer)
			{
				if (!Main.JPDictionary.ContainsKey(item.Key))
				{
					string text = Localization.currentStrings[item.Value].Replace("#", "[SHARP]").Replace("\r\n", "[CRLF]").Replace("\n", "[LF]");
					string text2 = "";
					stringBuilder.Append(item.Key + "\t" + text2 + "\t\tnew\t" + text + "\t\r\n");
				}
				else
				{
					Main.JPDictionary[item.Key] = Main.JPDictionary[item.Key].Replace(" ", "\u00a0");
				}
			}
			if (stringBuilder.Length == 0)
			{
				LogManager.Logger.LogInfo((object)"新規文字列はありません");
				return;
			}
			File.WriteAllText(Main.newStringsFilePath, stringBuilder.ToString());
			LogManager.Logger.LogInfo((object)("新規文字列がありましたので、" + Main.newStringsFilePath + "に書き出しました。"));
		}
	}
	[HarmonyPatch]
	internal class Test
	{
		public static void PlanetTransport_GameTick_PrePatch(PlanetTransport __instance)
		{
			for (int i = 1; i < __instance.dispenserCursor; i++)
			{
				if (__instance.dispenserPool[i] != null && __instance.dispenserPool[i].id == i)
				{
					StorageComponent storage = __instance.dispenserPool[i].storage;
				}
			}
		}
	}
	[HarmonyPatch]
	internal class UpdateLogs
	{
		public static bool UpdateLogCreated;

		public static void UIMainMenu_UpdateLogText_Postfix(UIMainMenu __instance)
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Invalid comparison between Unknown and I4
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			if (UpdateLogCreated)
			{
				return;
			}
			for (int num = GlobalObject.versionList.Count - 1; num > 0; num--)
			{
				Version val = GlobalObject.versionList[num];
				string text = "<b><color=\"#ffee00\">[Version " + ((Version)(ref val)).ToFullString() + "]</color></b>\r\n";
				string text2 = "";
				for (UpdateLogType val2 = (UpdateLogType)0; (int)val2 <= 3; val2 = (UpdateLogType)(val2 + 1))
				{
					text2 = text2 + "   <b><color=\"#ffee00\">" + ((object)(UpdateLogType)(ref val2)).ToString() + ":</color></b>\r\n";
					for (int i = 0; i < __instance.updateLogs.Length; i++)
					{
						UpdateLog val3 = __instance.updateLogs[i];
						for (int j = 0; j < val3.logs.Length; j++)
						{
							text2 += val3.logs[j].logEn;
							text2 += "\r\n";
						}
					}
				}
				LogManager.Logger.LogInfo((object)text);
				LogManager.Logger.LogInfo((object)text2);
				LogManager.Logger.LogInfo((object)"\r\n");
			}
			UpdateLogCreated = true;
		}
	}
	[HarmonyPatch]
	internal class TranslatePatches
	{
		[HarmonyPrefix]
		[HarmonyPatch(typeof(Localization), "Translate", new Type[] { typeof(string) })]
		public static bool Localization_Translate_Prefix(ref string __result, string s)
		{
			if (s == null)
			{
				__result = "";
				return false;
			}
			if (Localization.namesIndexer == null || Localization.currentStrings == null)
			{
				__result = s;
				return false;
			}
			if (Main.JPDictionary.ContainsKey(s))
			{
				__result = Main.JPDictionary[s];
				return false;
			}
			if (!Localization.namesIndexer.ContainsKey(s))
			{
				__result = s;
				return false;
			}
			__result = Localization.currentStrings[Localization.namesIndexer[s]];
			return false;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(Localization), "get_isCJK")]
		public static bool Localization_get_isCJK_Prefix(ref bool __result)
		{
			__result = true;
			return false;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(Localization), "get_isKMG")]
		public static bool Localization_get_isKMG_Prefix(ref bool __result)
		{
			__result = true;
			return false;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(Localization), "get_isZHCN")]
		public static bool Localization_get_isZHCN_Prefix(ref bool __result)
		{
			__result = false;
			return false;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(Localization), "get_isENUS")]
		public static bool Localization_get_isENUS_Prefix(ref bool __result)
		{
			__result = false;
			return false;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(Localization), "get_isFRFR")]
		public static bool Localization_get_isFRFR_Prefix(ref bool __result)
		{
			__result = false;
			return false;
		}

		public static void Localization_Load_Prefix(ref bool __result, int index)
		{
			if (!Localization.Loaded)
			{
				__result = false;
				return;
			}
			int num = Localization.Languages.Length;
			int num2 = Localization.resourcePages.Length;
			int namesCount = Localization.NamesCount;
			if ((ulong)index >= (ulong)num)
			{
				__result = false;
				return;
			}
			string[] array = (Localization.strings[index] = new string[namesCount]);
			float[] array2 = (Localization.floats[index] = new float[namesCount]);
			StreamReader[] array3 = new StreamReader[num2];
			bool flag = true;
			try
			{
				for (int i = 0; i < num2; i++)
				{
					string text = $"{Localization.ResourcesPath}{Localization.Languages[index].lcId}/{Localization.resourcePages[i]}.txt";
					if (new FileInfo(text).Exists)
					{
						array3[i] = new StreamReader(text, detectEncodingFromByteOrderMarks: true);
						array3[i].Peek();
					}
				}
			}
			catch (Exception ex)
			{
				flag = false;
				Debug.LogError((object)("[Locale] 访问文件路径失败:" + ex.ToString()));
			}
			if (flag)
			{
				try
				{
					(new char[1])[0] = '\t';
					StringBuilder stringBuilder = new StringBuilder();
					StringBuilder stringBuilder2 = new StringBuilder();
					for (int j = 0; j < num2; j++)
					{
						if (array3[j] == null)
						{
							continue;
						}
						while (true)
						{
							string text2 = array3[j].ReadLine();
							if (text2 == null)
							{
								break;
							}
							if (text2.Equals(string.Empty))
							{
								continue;
							}
							int length = text2.Length;
							int num3 = 0;
							stringBuilder.Clear();
							for (int k = num3; k < length; k++)
							{
								if (text2[k] == '\t')
								{
									stringBuilder.Append(text2, 0, k);
									num3 = k + 1;
									break;
								}
							}
							string text3 = Localization.UnescapeString(stringBuilder, stringBuilder2).ToString();
							if (text3.Length == 0 || !Localization.namesIndexer.ContainsKey(text3))
							{
								continue;
							}
							int num4 = Localization.namesIndexer[text3];
							if (array[num4] != null)
							{
								continue;
							}
							bool flag2 = false;
							bool flag3 = false;
							for (int l = num3; l < length; l++)
							{
								if (text2[l] == '\t')
								{
									num3 = l + 1;
									break;
								}
								if (text2[l] == '#')
								{
									flag2 = true;
								}
							}
							string text4 = text2[num3].ToString();
							for (int m = num3; m < length; m++)
							{
								if (text2[m] == '\t')
								{
									num3 = m + 1;
									flag3 = true;
									break;
								}
							}
							if (flag3)
							{
								stringBuilder.Clear();
								stringBuilder.Append(text2, num3, length - num3);
								string s = (array[num4] = Localization.UnescapeString(stringBuilder, stringBuilder2).ToString());
								LogManager.Logger.LogInfo((object)(index + " : " + text3 + " : " + text4 + " : " + array[num4]));
								if (flag2 && !float.TryParse(s, NumberStyles.Any, CultureInfo.InvariantCulture, out array2[num4]))
								{
									array2[num4] = 0f;
									Debug.LogWarning((object)("[Locale] 标识名 [" + text3 + "] 参数解析失败"));
								}
							}
							else
							{
								Debug.LogWarning((object)("[Locale] 标识名 [" + text3 + "] 文本读取失败"));
							}
						}
					}
					stringBuilder.Clear();
					stringBuilder2.Clear();
					int num5 = 0;
					foreach (KeyValuePair<string, int> item in Localization.namesIndexer)
					{
						if (array[item.Value] == null)
						{
							array[item.Value] = item.Key;
							num5++;
						}
					}
					if (num5 > 0)
					{
						Debug.LogWarning((object)$"[Locale] {num5} 个词条未找到翻译文本");
					}
				}
				catch (Exception ex2)
				{
					flag = false;
					Debug.LogError((object)("[Locale] 读取过程失败:" + ex2.ToString()));
				}
			}
			for (int n = 0; n < num2; n++)
			{
				if (array3[n] != null)
				{
					array3[n].Close();
					array3[n] = null;
				}
			}
			array3 = null;
			__result = flag;
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(VFPreload), "PreloadThread")]
		public static void VFPreload_PreloadThread_Patch()
		{
			Text[] array = Resources.FindObjectsOfTypeAll(typeof(Text)) as Text[];
			Text[] array2 = array;
			foreach (Text val in array2)
			{
				if ((Object)(object)val.font != (Object)null && ((Object)val.font).name != "DIN")
				{
					val.font = Main.newFont;
				}
				if (Main.JPDictionary.ContainsKey(val.text))
				{
					val.text = Main.JPDictionary[val.text];
				}
			}
			LogManager.Logger.LogInfo((object)"フォントを変更しました");
			NewStrings.Check();
		}

		public static void UICursor_LoadCursors_Prefix()
		{
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: 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_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_0198: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01da: 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_01f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0203: Unknown result type (might be due to invalid IL or missing references)
			//IL_0208: Unknown result type (might be due to invalid IL or missing references)
			//IL_021a: Unknown result type (might be due to invalid IL or missing references)
			//IL_021f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0231: Unknown result type (might be due to i