Decompiled source of JSON and CSV Loader Nightly v0.0.5

JSON Loader v3.dll

Decompiled an hour ago
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
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 Cecil_Libraries.ANSI_Utils.Objects;
using DiskCardGame;
using InscryptionAPI.Card;
using InscryptionAPI.Guid;
using InscryptionAPI.Helpers;
using JSONLoader3.Cores.JSONLoaderV1Support.Objects;
using JSONLoader3.Cores.JSONLoaderV1Support.Schemas;
using JSONLoader3.Cores.JSONLoaderV1Support.Utilities;
using JSONLoader3.Peripheral.FILE_Loader;
using JSONLoader3.Peripheral.ImageHandling;
using JSONLoader3.Peripheral.JSON_LINT;
using JSONLoader3.Peripheral.JSON_SCHEMA;
using JSONLoader3.Peripheral.Tooltip_Parser;
using JSONLoader3.Peripheral.XML_Parser;
using JSONLoader3.Subperipheral.JSONLoader_Configuration;
using Microsoft.CodeAnalysis;
using Sirenix.Utilities;
using UnityEngine;
using UnityEngine.UIElements;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("Chaosyr")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("This is the new Modulated and API Based system in which JSONLoader will run off of (and maybe a CSV loader too)")]
[assembly: AssemblyFileVersion("3.0.0.0")]
[assembly: AssemblyInformationalVersion("3.0.0-Nightly-0.0.5+4de26c46a77613e506dd58cf3a3be6cf05b4c20e")]
[assembly: AssemblyProduct("JSON Loader v3")]
[assembly: AssemblyTitle("JSON Loader v3")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("3.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace JSONLoader3
{
	[BepInPlugin("Chaosyr.MADH95.Inscryption.JSON.CSVLoader", "JSON_and_CSV_Loader", "3.0.0.00000005")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class JSONLoader3 : BaseUnityPlugin
	{
		public const string PluginGuid = "Chaosyr.MADH95.Inscryption.JSON.CSVLoader";

		public const string PluginName = "JSON_and_CSV_Loader";

		public const string PluginVersion = "3.0.0.00000005";

		private static Color Error = new Color("Doubleline", "Red", false, true, false);

		private static Color Warning = new Color("Underlined", "Yellow", false, true, false);

		private static Color256 Information = new Color256("Bold", 230, false, false);

		private static Color256 Debug = new Color256("Dulled", 248, false, false);

		private static Color256 ExtendedInformation = new Color256("Italic", 228, false, false);

		private static Color256 SummaryInformation = new Color256("Framed", 219, false, false);

		private static ManualLogSource BepInExLogger;

		public void Awake()
		{
			BepInExLogger = ((BaseUnityPlugin)this).Logger;
			DefineConfiguration.DefineConfigs(((BaseUnityPlugin)this).Config);
			FormatLogger("info", "Initialization for JSONLoader3 and CSVLoader", "Finished Creating JSONLoader3 and CSVLoader Configuration");
			FindFiles.FindFilesToLoad();
			LoadFiles.LoadFoundFiles();
			foreach (CardInfo item in CardUtils.allJLDRCardsPublic)
			{
				FormatLogger("info", "Initialization for JSONLoader3 and CSVLoader", "Successfully Loaded card: " + ((Object)item).name);
			}
			FormatLogger("info", "Initialization for JSONLoader3 and CSVLoader", "Finished Loading JSONLoader, JSONLoader2, JSONLoader3 and CSVLoader.");
		}

		public static void FormatLogger(string level, string source, string message)
		{
			if (level.ToLower() == "error")
			{
				Console.WriteLine(((ColorBase)Error).Format() + "[(" + source + ") Error]: " + message + "\u001b[0m");
				LogToBepInExFile((LogLevel)2, source, message);
			}
			else if (level.ToLower() == "warning")
			{
				Console.WriteLine(((ColorBase)Warning).Format() + "[(" + source + ") Warning]: " + message + "\u001b[0m");
				LogToBepInExFile((LogLevel)4, source, message);
			}
			else if (level.ToLower() == "info" || level.ToLower() == "information")
			{
				Console.WriteLine(((ColorBase)Information).Format() + "[(" + source + ") Information]: " + message + "\u001b[0m");
				LogToBepInExFile((LogLevel)16, source, message);
			}
			else if (level.ToLower() == "debug" && DefineConfiguration.ShowVerboseLogging.Value)
			{
				Console.WriteLine(((ColorBase)Debug).Format() + "[(" + source + ") Debug]: " + message + "\u001b[0m");
				LogToBepInExFile((LogLevel)32, source, message);
			}
			else if ((level.ToLower() == "additionalinfo" || level.ToLower() == "additionalinformation") && DefineConfiguration.ShowAdditionalInformation.Value)
			{
				Console.WriteLine(((ColorBase)ExtendedInformation).Format() + "[(" + source + ") Additional Information]: " + message + "\u001b[0m");
				LogToBepInExFile((LogLevel)8, source, message);
			}
			else if (level.ToLower() == "summary" && DefineConfiguration.ShowSummary.Value)
			{
				Console.WriteLine(((ColorBase)SummaryInformation).Format() + "[(" + source + ") Summary Information]: " + message + "\u001b[0m");
				LogToBepInExFile((LogLevel)8, source, message);
			}
		}

		private static void LogToBepInExFile(LogLevel level, string source, string message)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Expected O, but got Unknown
			ManualLogSource val = new ManualLogSource("Chaosyr.MADH95.Inscryption.JSON.CSVLoader");
			LogEventArgs e = new LogEventArgs((object)$"[({source}) {level}]: {message}", level, (ILogSource)(object)val);
			foreach (ILogListener listener in Logger.Listeners)
			{
				if (listener is DiskLogListener)
				{
					listener.LogEvent((object)typeof(JSONLoader3), e);
				}
			}
		}
	}
}
namespace JSONLoader3.Subperipheral.JSONLoader_Configuration
{
	public class DefineConfiguration
	{
		public static ConfigEntry<string> JSONLoadingPaths;

		public static ConfigEntry<string> CSVLoadingPaths;

		public static ConfigEntry<string> SchemaSavePath;

		public static ConfigEntry<bool> ShowVerboseLogging;

		public static ConfigEntry<bool> ShowAdditionalInformation;

		public static ConfigEntry<bool> ShowSummary;

		public static ConfigEntry<bool> toggleRecursiveOnPlugin;

		private static ConfigFile configFile;

		public static void DefineConfigs(ConfigFile config)
		{
			configFile = config;
			JSONLoadingPaths = configFile.Bind<string>("Configuration", "JSON Loading Origination Path", "Scripts, Plugins/Scripts, Cards, Plugins/Cards", "These paths are case insensitive, and determine where JSON Scripts may be sourced from in order to load. If your a mod maker shipping mods, make a 'plugins' folder in your mods folder, and put a folder in there called 'scripts', this is where your JSON scripts should reside. If you need another path, you can override this value with your mod, we'll provide a system for you to do so.");
			CSVLoadingPaths = configFile.Bind<string>("Configuration", "CSV Loading Origination Path", "Sheets, Plugins/Sheets", "These paths are case insensitive, and determine where CSV Sheets may be sourced from in order to load. If your a mod maker shipping mods, make a 'plugins' folder in your mods folder, and put a folder in there called 'sheets', this is where your CSV Sheets should reside. If you need another path, you can override this value with your mod, we'll provide a system for you to do so.");
			SchemaSavePath = configFile.Bind<string>("Configuration", "Schema Save Path", "/Schemas", "This determines where JSON Schemas will be saved to as we create them, this path will be localized to the DLL's folder. You can use '../' to mean go up a folder.");
			JSONLoader3.FormatLogger("info", "Configuration", "Finished adding configuration for the Loading Paths associated with this mod.");
			ShowVerboseLogging = configFile.Bind<bool>("Logging", "Show Verbose Logging", false, "While this value is set to true, this API will show what is happening when its happening.");
			ShowAdditionalInformation = configFile.Bind<bool>("Logging", "Show Additional Information", false, "While this value is set to true, this API will show a more in depth lense as to what went wrong, and try to help explain why its wrong with links to references.");
			ShowSummary = configFile.Bind<bool>("Logging", "Show Summary Information", false, "While this value is set to true, this API will show the Summary for each property being verified by the Linter and some Additional Debug Information.");
			JSONLoader3.FormatLogger("info", "Configuration", "Finished adding configuration for the Logging associated with this mod.");
			toggleRecursiveOnPlugin = configFile.Bind<bool>("Compatibility", "Recursively Scan At Plugin Level", false, "While this value is set to true, this API will recursively scan for JSONs and CSVs from the Plugins level, rather than the set folders. This is defaulted to false for the purposes of keeping Load Times fast, but if you have a mod that isn't structured for this toggle this setting on.");
			JSONLoader3.FormatLogger("info", "Configuration", "Finished adding configuration for the Compatibility associated with this mod.");
		}
	}
}
namespace JSONLoader3.Peripheral.XML_Parser
{
	public class ReadDocumentationFile
	{
		private static Assembly assembly = Assembly.GetExecutingAssembly();

		internal static string DLLPath = Path.GetDirectoryName(assembly.Location);

		internal static string DLLName = Path.GetFileNameWithoutExtension(assembly.Location);

		internal static List<string> DocFileXML = new List<string>();

		public static void FetchDocFile()
		{
			string dLLPath = DLLPath;
			char directorySeparatorChar = Path.DirectorySeparatorChar;
			if (File.Exists(dLLPath + directorySeparatorChar + DLLName + ".xml"))
			{
				string dLLPath2 = DLLPath;
				directorySeparatorChar = Path.DirectorySeparatorChar;
				StreamReader streamReader = new StreamReader(dLLPath2 + directorySeparatorChar + DLLName + ".xml");
				while (streamReader.Peek() >= 0)
				{
					DocFileXML.Add(streamReader.ReadLine());
				}
			}
		}

		public static List<string> FetchItemSummary((string Namespace, string className, string ItemName) tup)
		{
			if (DocFileXML.Count == 0)
			{
				return null;
			}
			int num = DocFileXML.FindIndex((string x) => x.Contains("F:" + tup.Namespace + "." + tup.className + "." + tup.ItemName));
			List<string> list = new List<string>();
			for (int num2 = num + 1; num2 < DocFileXML.FindIndex(num, (string x) => x.Trim() == "</summary>"); num2++)
			{
				if (!(DocFileXML[num2].Trim() == "</summary>") && !(DocFileXML[num2].Trim() == "<summary>"))
				{
					list.Add(DocFileXML[num2]);
				}
			}
			return list;
		}

		public static string GetJSONSummary((string Namespace, string className, string ItemName) tup)
		{
			List<string> list = FetchItemSummary((Namespace: tup.Namespace, className: tup.className, ItemName: tup.ItemName));
			string text = "";
			foreach (string item in list)
			{
				text = text + item.Trim() + " ";
			}
			return text.Trim();
		}

		public static (string Namespace, string className, string ItemName) GetInfo<Class>(string ItemName)
		{
			string item = typeof(Class).Namespace;
			string name = typeof(Class).Name;
			return (Namespace: item, className: name, ItemName: ItemName);
		}

		public static (string Namespace, string className, string ItemName) GetInfo(string ItemName, Type Class)
		{
			string item = Class.Namespace;
			string name = Class.Name;
			return (Namespace: item, className: name, ItemName: ItemName);
		}

		public static string EscapeJSON(string value)
		{
			return value.Replace("\\", "\\\\").Replace("\"", "\\\"");
		}
	}
}
namespace JSONLoader3.Peripheral.Tooltip_Parser
{
	public class TooltipDisector
	{
		public static List<string> GetTooltipProperties(FieldInfo field)
		{
			List<string> list = new List<string>();
			TooltipAttribute customAttribute = ((MemberInfo)field).GetCustomAttribute<TooltipAttribute>();
			if (customAttribute == null)
			{
				return list;
			}
			string[] array = customAttribute.tooltip.Split(new char[1] { '|' });
			foreach (string text in array)
			{
				StringBuilder stringBuilder = new StringBuilder();
				int num = 0;
				string tooltip = customAttribute.tooltip;
				foreach (char c in tooltip)
				{
					if (c == '(')
					{
						num++;
					}
					if (c == ')')
					{
						num--;
					}
					if (c == '|' && num == 0)
					{
						list.Add(stringBuilder.ToString().Trim());
						stringBuilder.Clear();
					}
					else
					{
						stringBuilder.Append(c);
					}
				}
				if (stringBuilder.Length > 0)
				{
					list.Add(stringBuilder.ToString().Trim());
				}
			}
			return list;
		}
	}
}
namespace JSONLoader3.Peripheral.JSON_SCHEMA
{
	public class LoadSchema
	{
		public static string SchemaFolder;

		public static List<string> FindAndLoadSchema<Class>(string LoaderName)
		{
			string fullSchemaPath = GetFullSchemaPath<Class>(LoaderName);
			FileStream stream = File.OpenRead(fullSchemaPath);
			StreamReader streamReader = new StreamReader(stream);
			List<string> list = new List<string>();
			while (streamReader.Peek() >= 0)
			{
				string item = streamReader.ReadLine();
				list.Add(item);
			}
			streamReader.Dispose();
			return list;
		}

		public static string GetFullSchemaPath<Class>(string LoaderName)
		{
			string[] obj = new string[8] { SchemaFolder, null, null, null, null, null, null, null };
			char directorySeparatorChar = Path.DirectorySeparatorChar;
			obj[1] = directorySeparatorChar.ToString();
			obj[2] = LoaderName;
			directorySeparatorChar = Path.DirectorySeparatorChar;
			obj[3] = directorySeparatorChar.ToString();
			obj[4] = LoaderName;
			obj[5] = "_";
			obj[6] = typeof(Class).Name;
			obj[7] = "_Schema.json";
			return string.Concat(obj);
		}

		static LoadSchema()
		{
			string dLLPath = FindFiles.DLLPath;
			char directorySeparatorChar = Path.DirectorySeparatorChar;
			SchemaFolder = dLLPath + directorySeparatorChar + DefineConfiguration.SchemaSavePath.Value;
		}
	}
	public class WriteSchema
	{
		public static string SchemaFolder;

		public static void CreateSchemaDirectors(string LoaderName)
		{
			if (!Directory.Exists(SchemaFolder))
			{
				Directory.CreateDirectory(SchemaFolder);
			}
			string schemaFolder = SchemaFolder;
			char directorySeparatorChar = Path.DirectorySeparatorChar;
			if (!Directory.Exists(schemaFolder + directorySeparatorChar + LoaderName))
			{
				string schemaFolder2 = SchemaFolder;
				directorySeparatorChar = Path.DirectorySeparatorChar;
				Directory.CreateDirectory(schemaFolder2 + directorySeparatorChar + LoaderName);
			}
		}

		public static StreamWriter CreateAndOpenSchema<Class>(string LoaderName)
		{
			string[] obj = new string[8] { SchemaFolder, null, null, null, null, null, null, null };
			char directorySeparatorChar = Path.DirectorySeparatorChar;
			obj[1] = directorySeparatorChar.ToString();
			obj[2] = LoaderName;
			directorySeparatorChar = Path.DirectorySeparatorChar;
			obj[3] = directorySeparatorChar.ToString();
			obj[4] = LoaderName;
			obj[5] = "_";
			obj[6] = typeof(Class).Name;
			obj[7] = "_Schema.json";
			string path = string.Concat(obj);
			FileStream stream = File.Create(path);
			return new StreamWriter(stream);
		}

		public static void CloseWriterAndFile(StreamWriter Writer)
		{
			Writer.Dispose();
		}

		public static List<(FieldInfo field, List<string> tooltips)> GetToolTips(List<FieldInfo> fields)
		{
			List<(FieldInfo, List<string>)> list = new List<(FieldInfo, List<string>)>();
			foreach (FieldInfo field in fields)
			{
				list.Add((field, TooltipDisector.GetTooltipProperties(field)));
			}
			return list;
		}

		public static List<string> GetRequired(List<(FieldInfo field, List<string> tooltips)> fieldTooltipList)
		{
			return (from x in fieldTooltipList
				where x.tooltips.Contains<string>("REQUIRED", StringComparer.Ordinal) && !x.tooltips.Contains<string>("EXCLUDED", StringComparer.Ordinal)
				select "\"" + x.field.Name + "\"").ToList();
		}

		public static List<(FieldInfo field, List<string> tooltips)> GetWritable(List<(FieldInfo field, List<string> tooltips)> fieldTooltipList)
		{
			return fieldTooltipList.Where(((FieldInfo field, List<string> tooltips) x) => !x.tooltips.Contains<string>("EXCLUDED", StringComparer.Ordinal)).ToList();
		}

		public static string HandleString(List<(FieldInfo field, List<string> tooltips)> writableFields, FieldInfo field, List<string> tooltips, int Indentation, Type Class)
		{
			string text = "";
			text = text + "\r\n        " + new string(' ', Indentation * 4) + "\"" + field.Name + "\": {\r\n            " + new string(' ', Indentation * 4) + "\"type\": \"string\",\r\n            " + new string(' ', Indentation * 4) + "\"description\": \"" + ReadDocumentationFile.EscapeJSON(ReadDocumentationFile.GetJSONSummary(ReadDocumentationFile.GetInfo(field.Name, Class))) + "\",";
			string text2 = tooltips.FirstOrDefault((string x) => x.IndexOf("MinimumLength", StringComparison.Ordinal) >= 0);
			if (text2 != null)
			{
				text = text + "\r\n            " + new string(' ', Indentation * 4) + "\"minLength\": " + text2.Split(new char[1] { '(' }).Last().Trim('(', ')') + ",";
			}
			string text3 = tooltips.FirstOrDefault((string x) => x.IndexOf("Pattern", StringComparison.Ordinal) >= 0);
			if (text3 != null)
			{
				text = text + "\r\n            " + new string(' ', Indentation * 4) + "\"pattern\": \"" + ReadDocumentationFile.EscapeJSON(text3.Substring(text3.IndexOf('(') + 1, text3.LastIndexOf(')') - text3.IndexOf('(') - 1)) + "\",";
			}
			string text4 = tooltips.FirstOrDefault((string x) => x.IndexOf("Default", StringComparison.Ordinal) >= 0);
			if (text4 != null)
			{
				text = text + "\r\n            " + new string(' ', Indentation * 4) + "\"default\": \"" + text4.Split(new char[1] { '(' }).Last().Trim('(', ')') + "\",";
			}
			string text5 = tooltips.FirstOrDefault((string x) => x.IndexOf("Enums", StringComparison.Ordinal) >= 0);
			if (text5 != null)
			{
				text = text + "\r\n            " + new string(' ', Indentation * 4) + "\"enum\": [\r\n                " + new string(' ', Indentation * 4) + string.Join(", " + Environment.NewLine + "                " + new string(' ', Indentation * 4), from x in text5.Split(new char[1] { '(' }).Last().Trim('(', ')')
						.Split(new char[1] { ',' })
					select "\"" + x.Trim() + "\"") + "\r\n            " + new string(' ', Indentation * 4) + "],";
			}
			text = text.TrimEnd(Array.Empty<char>());
			text = text.TrimEnd(new char[1] { ',' });
			text = text + "\r\n        " + new string(' ', Indentation * 4) + "}";
			if (writableFields.IndexOf((field, tooltips)) != writableFields.Count - 1)
			{
				text += ",";
			}
			return text;
		}

		public static string HandleInt(List<(FieldInfo field, List<string> tooltips)> writableFields, FieldInfo field, List<string> tooltips, int Indentation, Type Class)
		{
			string text = "";
			text = text + "\r\n        " + new string(' ', Indentation * 4) + "\"" + field.Name + "\": {\r\n            " + new string(' ', Indentation * 4) + "\"type\": \"integer\",\r\n            " + new string(' ', Indentation * 4) + "\"description\": \"" + ReadDocumentationFile.EscapeJSON(ReadDocumentationFile.GetJSONSummary(ReadDocumentationFile.GetInfo(field.Name, Class))) + "\",";
			string text2 = tooltips.FirstOrDefault((string x) => x.IndexOf("Default", StringComparison.Ordinal) >= 0);
			if (text2 != null)
			{
				text = text + "\r\n            " + new string(' ', Indentation * 4) + "\"default\": " + text2.Split(new char[1] { '(' }).Last().Trim('(', ')') + ",";
			}
			string text3 = tooltips.FirstOrDefault((string x) => x.IndexOf("Minimum", StringComparison.Ordinal) >= 0);
			if (text3 != null)
			{
				text = text + "\r\n            " + new string(' ', Indentation * 4) + "\"minimum\": " + text3.Split(new char[1] { '(' }).Last().Trim('(', ')') + ",";
			}
			string text4 = tooltips.FirstOrDefault((string x) => x.IndexOf("Maximum", StringComparison.Ordinal) >= 0);
			if (text4 != null)
			{
				text = text + "\r\n            " + new string(' ', Indentation * 4) + "\"maximum\": " + text4.Split(new char[1] { '(' }).Last().Trim('(', ')') + ",";
			}
			text = text.TrimEnd(Array.Empty<char>());
			text = text.TrimEnd(new char[1] { ',' });
			text = text + "\r\n        " + new string(' ', Indentation * 4) + "}";
			if (writableFields.IndexOf((field, tooltips)) != writableFields.Count - 1)
			{
				text += ",";
			}
			return text;
		}

		public static string HandleBoolean(List<(FieldInfo field, List<string> tooltips)> writableFields, FieldInfo field, List<string> tooltips, int Indentation, Type Class)
		{
			string text = "";
			text = text + "\r\n        " + new string(' ', Indentation * 4) + "\"" + field.Name + "\": {\r\n            " + new string(' ', Indentation * 4) + "\"type\": \"boolean\",\r\n            " + new string(' ', Indentation * 4) + "\"description\": \"" + ReadDocumentationFile.EscapeJSON(ReadDocumentationFile.GetJSONSummary(ReadDocumentationFile.GetInfo(field.Name, Class))) + "\",";
			string text2 = tooltips.FirstOrDefault((string x) => x.IndexOf("Default", StringComparison.Ordinal) >= 0);
			if (text2 != null)
			{
				text = text + "\r\n            " + new string(' ', Indentation * 4) + "\"default\": " + text2.Split(new char[1] { '(' }).Last().Trim('(', ')')
					.ToLower() + ",";
			}
			text = text.TrimEnd(Array.Empty<char>());
			text = text.TrimEnd(new char[1] { ',' });
			text = text + "\r\n        " + new string(' ', Indentation * 4) + "}";
			if (writableFields.IndexOf((field, tooltips)) != writableFields.Count - 1)
			{
				text += ",";
			}
			return text;
		}

		public static string HandleStringArray(List<(FieldInfo field, List<string> tooltips)> writableFields, FieldInfo field, List<string> tooltips, int Indentation, Type Class)
		{
			string text = "";
			text = text + "\r\n        " + new string(' ', Indentation * 4) + "\"" + field.Name + "\": {\r\n            " + new string(' ', Indentation * 4) + "\"type\": \"array\",\r\n            " + new string(' ', Indentation * 4) + "\"description\": \"" + ReadDocumentationFile.EscapeJSON(ReadDocumentationFile.GetJSONSummary(ReadDocumentationFile.GetInfo(field.Name, Class))) + "\",";
			string text2 = tooltips.FirstOrDefault((string x) => x.IndexOf("Items", StringComparison.Ordinal) >= 0);
			if (text2 != null && text2.Split(new char[1] { '(' }).Last().Trim('(', ')')
				.ToLower() == "true")
			{
				text = text + "\r\n            " + new string(' ', Indentation * 4) + "\"items\": {";
				string text3 = tooltips.FirstOrDefault((string x) => x.IndexOf("ItemType", StringComparison.Ordinal) >= 0);
				if (text3 != null)
				{
					text = text + "\r\n                " + new string(' ', Indentation * 4) + "\"type\": \"" + text3.Split(new char[1] { '(' }).Last().Trim('(', ')')
						.ToLower() + "\",";
				}
				string text4 = tooltips.FirstOrDefault((string x) => x.IndexOf("Pattern", StringComparison.Ordinal) >= 0);
				if (text4 != null)
				{
					text = text + "\r\n                " + new string(' ', Indentation * 4) + "\"pattern\": \"" + ReadDocumentationFile.EscapeJSON(text4.Substring(text4.IndexOf('(') + 1, text4.LastIndexOf(')') - text4.IndexOf('(') - 1)) + "\",";
				}
				string text5 = tooltips.FirstOrDefault((string x) => x.IndexOf("Enums", StringComparison.Ordinal) >= 0);
				if (text5 != null)
				{
					text = text + "\r\n                " + new string(' ', Indentation * 4) + "\"enum\": [\r\n                    " + new string(' ', Indentation * 4) + string.Join(", " + Environment.NewLine + "                    " + new string(' ', Indentation * 4), from x in text5.Split(new char[1] { '(' }).Last().Trim('(', ')')
							.Split(new char[1] { ',' })
						select "\"" + x.Trim() + "\"") + "\r\n                " + new string(' ', Indentation * 4) + "],";
				}
				text = text.TrimEnd(Array.Empty<char>());
				text = text.TrimEnd(new char[1] { ',' });
				text = text + "\r\n            " + new string(' ', Indentation * 4) + "},";
			}
			string text6 = tooltips.FirstOrDefault((string x) => x.IndexOf("UniqueItems", StringComparison.Ordinal) >= 0);
			if (text6 != null)
			{
				text = text + "\r\n            " + new string(' ', Indentation * 4) + "\"uniqueItems\": " + text6.Split(new char[1] { '(' }).Last().Trim('(', ')')
					.ToLower() + ",";
			}
			text = text.TrimEnd(Array.Empty<char>());
			text = text.TrimEnd(new char[1] { ',' });
			text = text + "\r\n        " + new string(' ', Indentation * 4) + "}";
			if (writableFields.IndexOf((field, tooltips)) != writableFields.Count - 1)
			{
				text += ",";
			}
			return text;
		}

		public static string HandleObjectArray(List<(FieldInfo field, List<string> tooltips)> writableFields, FieldInfo field, List<string> tooltips, int Indentation, Type Class)
		{
			Type type = field.FieldType.GetGenericArguments()[0];
			string text = "";
			text = text + "\r\n        " + new string(' ', Indentation * 4) + "\"" + field.Name + "\": {\r\n            " + new string(' ', Indentation * 4) + "\"type\": \"array\",\r\n            " + new string(' ', Indentation * 4) + "\"description\": \"" + ReadDocumentationFile.EscapeJSON(ReadDocumentationFile.GetJSONSummary(ReadDocumentationFile.GetInfo(field.Name, Class))) + "\",";
			string text2 = tooltips.FirstOrDefault((string x) => x.IndexOf("Items", StringComparison.Ordinal) >= 0);
			if (text2 != null && text2.Split(new char[1] { '(' }).Last().Trim('(', ')')
				.ToLower() == "true")
			{
				text = text + "\r\n            " + new string(' ', Indentation * 4) + "\"items\": {";
				string text3 = tooltips.FirstOrDefault((string x) => x.IndexOf("ItemType", StringComparison.Ordinal) >= 0);
				if (text3 != null)
				{
					text = text + "\r\n                " + new string(' ', Indentation * 4) + "\"type\": \"" + text3.Split(new char[1] { '(' }).Last().Trim('(', ')')
						.ToLower() + "\",";
				}
				string text4 = tooltips.FirstOrDefault((string x) => x.IndexOf("AdditionalProperties", StringComparison.Ordinal) >= 0);
				if (text4 != null)
				{
					text = text + "\r\n                " + new string(' ', Indentation * 4) + "\"additionalProperties\": " + text4.Split(new char[1] { '(' }).Last().Trim('(', ')')
						.ToLower() + ",";
				}
				string text5 = RecursiveWrite(type, Indentation + 3);
				text += text5;
				text = text.TrimEnd(Array.Empty<char>());
				text = text.TrimEnd(new char[1] { ',' });
				text = text + "\r\n            " + new string(' ', Indentation * 4) + "},";
			}
			string text6 = tooltips.FirstOrDefault((string x) => x.IndexOf("UniqueItems", StringComparison.Ordinal) >= 0);
			if (text6 != null)
			{
				text = text + "\r\n            " + new string(' ', Indentation * 4) + "\"uniqueItems\": " + text6.Split(new char[1] { '(' }).Last().Trim('(', ')')
					.ToLower() + ",";
			}
			text = text.TrimEnd(Array.Empty<char>());
			text = text.TrimEnd(new char[1] { ',' });
			text = text + "\r\n        " + new string(' ', Indentation * 4) + "}";
			if (writableFields.IndexOf((field, tooltips)) != writableFields.Count - 1)
			{
				text += ",";
			}
			return text;
		}

		public static string HandleObject(List<(FieldInfo field, List<string> tooltips)> writableFields, FieldInfo field, List<string> tooltips, int Indentation, Type Class)
		{
			string text = "";
			text = text + "\r\n        " + new string(' ', Indentation * 4) + "\"" + field.Name + "\": {\r\n            " + new string(' ', Indentation * 4) + "\"type\": \"object\",\r\n            " + new string(' ', Indentation * 4) + "\"description\": \"" + ReadDocumentationFile.EscapeJSON(ReadDocumentationFile.GetJSONSummary(ReadDocumentationFile.GetInfo(field.Name, Class))) + "\",";
			string text2 = RecursiveWrite(field.FieldType, Indentation + 2);
			text += text2;
			text = text.TrimEnd(Array.Empty<char>());
			text = text.TrimEnd(new char[1] { ',' });
			text = text + "\r\n        " + new string(' ', Indentation * 4) + "}";
			if (writableFields.IndexOf((field, tooltips)) != writableFields.Count - 1)
			{
				text += ",";
			}
			return text;
		}

		public static void WriteJSONSchema<Class>(string LoaderName)
		{
			CreateSchemaDirectors(LoaderName);
			StreamWriter streamWriter = CreateAndOpenSchema<Class>(LoaderName);
			streamWriter.Write("{\r\n    \"$schema\": \"http://json-schema.org/draft-04/schema#\",\r\n    \"$id\": \"https://github.com/MADH95/JSONLoader\",\r\n    \"title\": \"New " + LoaderName + " " + typeof(Class).Name + "\",\r\n    \"description\": \"Schema to verify the input data for a new " + LoaderName + " " + typeof(Class).Name + ".\",\r\n    \"type\": \"object\",\r\n    \"additionalProperties\": false,");
			List<(FieldInfo, List<string>)> toolTips = GetToolTips(typeof(Class).GetFields().ToList());
			List<string> required = GetRequired(toolTips);
			if (!LinqExtensions.IsNullOrEmpty<string>((IList<string>)required))
			{
				streamWriter.Write("\r\n    \"required\": [\r\n        " + string.Join("," + Environment.NewLine + "        ", required) + "\r\n    ],");
			}
			streamWriter.Write("\r\n    \"properties\": {");
			List<(FieldInfo, List<string>)> writable = GetWritable(toolTips);
			foreach (var (fieldInfo, tooltips) in writable)
			{
				if (fieldInfo.FieldType == typeof(string))
				{
					streamWriter.Write(HandleString(writable, fieldInfo, tooltips, 0, typeof(Class)));
				}
				else if (fieldInfo.FieldType == typeof(int))
				{
					streamWriter.Write(HandleInt(writable, fieldInfo, tooltips, 0, typeof(Class)));
				}
				else if (fieldInfo.FieldType == typeof(bool))
				{
					streamWriter.Write(HandleBoolean(writable, fieldInfo, tooltips, 0, typeof(Class)));
				}
				else if (fieldInfo.FieldType == typeof(List<string>))
				{
					streamWriter.Write(HandleStringArray(writable, fieldInfo, tooltips, 0, typeof(Class)));
				}
				else if (fieldInfo.FieldType.IsGenericType && fieldInfo.FieldType.GetGenericTypeDefinition() == typeof(List<>))
				{
					streamWriter.Write(HandleObjectArray(writable, fieldInfo, tooltips, 0, typeof(Class)));
				}
				else if (fieldInfo.FieldType.IsClass)
				{
					streamWriter.Write(HandleObject(writable, fieldInfo, tooltips, 0, typeof(Class)));
				}
			}
			streamWriter.Write("\r\n    }\r\n}");
			CloseWriterAndFile(streamWriter);
		}

		public static string RecursiveWrite(Type Class, int Indentation)
		{
			string text = "";
			List<FieldInfo> fields = Class.GetFields().ToList();
			List<(FieldInfo, List<string>)> toolTips = GetToolTips(fields);
			List<string> required = GetRequired(toolTips);
			if (!LinqExtensions.IsNullOrEmpty<string>((IList<string>)required))
			{
				text = text + "\r\n    " + new string(' ', Indentation * 4) + "\"required\": [\r\n        " + new string(' ', Indentation * 4) + string.Join("," + Environment.NewLine + "        " + new string(' ', Indentation * 4), required) + "\r\n    " + new string(' ', Indentation * 4) + "],";
			}
			text = text + "\r\n    " + new string(' ', Indentation * 4) + "\"properties\": {";
			List<(FieldInfo, List<string>)> writable = GetWritable(toolTips);
			foreach (var (fieldInfo, tooltips) in writable)
			{
				if (fieldInfo.FieldType == typeof(string))
				{
					text += HandleString(writable, fieldInfo, tooltips, Indentation, Class);
				}
				else if (fieldInfo.FieldType == typeof(int))
				{
					text += HandleInt(writable, fieldInfo, tooltips, Indentation, Class);
				}
				else if (fieldInfo.FieldType == typeof(bool))
				{
					text += HandleBoolean(writable, fieldInfo, tooltips, Indentation, Class);
				}
				else if (fieldInfo.FieldType == typeof(List<string>))
				{
					text += HandleStringArray(writable, fieldInfo, tooltips, Indentation, Class);
				}
				else if (fieldInfo.FieldType.IsGenericType && fieldInfo.FieldType.GetGenericTypeDefinition() == typeof(List<>))
				{
					text += HandleObjectArray(writable, fieldInfo, tooltips, Indentation, Class);
				}
				else if (fieldInfo.FieldType.IsClass)
				{
					text += HandleObject(writable, fieldInfo, tooltips, Indentation, Class);
				}
			}
			return text + "\r\n    " + new string(' ', Indentation * 4) + "},";
		}

		static WriteSchema()
		{
			string dLLPath = FindFiles.DLLPath;
			char directorySeparatorChar = Path.DirectorySeparatorChar;
			SchemaFolder = dLLPath + directorySeparatorChar + DefineConfiguration.SchemaSavePath.Value;
		}
	}
}
namespace JSONLoader3.Peripheral.JSON_LINT
{
	public class LintingTools
	{
		public static (List<(int depth, string propertyName, string propertyValue)> validatedJSON, bool check) LintAgainstSchema<Class>(string file, List<string> JSONSchema, string LoaderName)
		{
			List<string> list = LoadInJSONItem(file);
			foreach (string item3 in list)
			{
				int num = list.IndexOf(item3);
				if (num != list.Count - 1 && (list[num + 1].Trim().StartsWith("}") || list[num + 1].Trim().EndsWith("}")) && list[num].EndsWith(","))
				{
					JSONLoader3.FormatLogger("ERROR", "LintingTools", "Trailing Comma Detected on the Last Line of the JSON.");
					JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "This error occurs when the last Key in the JSON has a comma at the end prior to closing a brace.");
					JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", $"To fix it just remove the comma at the end of line {num}.");
					JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Here's the full path to the file the issue takes root in: " + file);
				}
			}
			List<(int, string, string)> list2 = DisectedJSON(list);
			List<(int, string, string)> jSONSchemaProperties = DisectedJSON(JSONSchema);
			List<string> requiredFromSchema = GetRequiredFromSchema(JSONSchema);
			List<(string, bool)> list3 = new List<(string, bool)>();
			foreach (string item4 in requiredFromSchema)
			{
				list3.Add((item4, false));
			}
			JSONLoader3.FormatLogger("Debug", "LintingTools", "Required Fields: " + string.Join(", ", requiredFromSchema));
			foreach (var item5 in list2.Where<(int, string, string)>(((int depth, string propertyName, string propertyValue) x) => x.depth == 1))
			{
				string traversalPath = GetTraversalPath(jSONSchemaProperties, item5, 2);
				if (traversalPath == string.Empty)
				{
					JSONLoader3.FormatLogger("ERROR", "LintingTools", "Something went wrong while doing PathTraversal for " + item5.Item2 + " the following should help identify what you did wrong.");
					if (GetTraversalPath(jSONSchemaProperties, (depth: item5.Item1, propertyName: StringUtilsExtensions.ToCamelCase(item5.Item2), propertyValue: item5.Item3), 2) != string.Empty)
					{
						JSONLoader3.FormatLogger("ERROR", "LintingTools", "The casing of " + item5.Item2 + " within " + Path.GetFileNameWithoutExtension(file) + " is not correct, it should be in camelCase.");
						JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Basically the Property needs to follow the correct convention which is first word in Lowercase, and the rest of the words first letters Capitalized.");
						JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "likeThis");
						JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "In the JSON the KVP would look like: \"likeThis\": false");
						JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Here's the full path to the file the issue takes root in: " + file);
						return (validatedJSON: list2, check: false);
					}
					char directorySeparatorChar;
					if (!AllowExtraFieldsCheck(JSONSchema))
					{
						JSONLoader3.FormatLogger("ERROR", "LintingTools", "The Property of " + item5.Item2 + " is not apart of the JSON Schema, please remove it from the JSON entitled " + Path.GetFileNameWithoutExtension(file) + ".");
						JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "If you want to stop seeing these when you make your jsons, just cross check the JSON against the Schema saving it.");
						JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Theres a nifty site called JSONEditor that you may find useful, theres a guide in the README.");
						JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Additionally you can cross-reference against the Property List we provide in our API's documentation and WIKI's.");
						JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Here's the full path to the file the issue takes root in: " + file);
						string[] obj = new string[8]
						{
							LoadSchema.SchemaFolder,
							null,
							null,
							null,
							null,
							null,
							null,
							null
						};
						directorySeparatorChar = Path.DirectorySeparatorChar;
						obj[1] = directorySeparatorChar.ToString();
						obj[2] = LoaderName;
						directorySeparatorChar = Path.DirectorySeparatorChar;
						obj[3] = directorySeparatorChar.ToString();
						obj[4] = LoaderName;
						obj[5] = "_";
						obj[6] = typeof(Class).Name;
						obj[7] = "_Schema.json";
						JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "You can also find the full Schema here: " + Path.GetFullPath(string.Concat(obj)));
						return (validatedJSON: list2, check: false);
					}
					JSONLoader3.FormatLogger("Warning", "LintingTools", "The Property of " + item5.Item2 + " is not apart of the JSON Schema, please remove it from the JSON entitled " + Path.GetFileNameWithoutExtension(file) + ".");
					JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Here's the full path to the file the issue takes root in: " + file);
					string[] obj2 = new string[8]
					{
						LoadSchema.SchemaFolder,
						null,
						null,
						null,
						null,
						null,
						null,
						null
					};
					directorySeparatorChar = Path.DirectorySeparatorChar;
					obj2[1] = directorySeparatorChar.ToString();
					obj2[2] = LoaderName;
					directorySeparatorChar = Path.DirectorySeparatorChar;
					obj2[3] = directorySeparatorChar.ToString();
					obj2[4] = LoaderName;
					obj2[5] = "_";
					obj2[6] = typeof(Class).Name;
					obj2[7] = "_Schema.json";
					JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "You can also find the full Schema here: " + Path.GetFullPath(string.Concat(obj2)));
					JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "This is a warning because additionalProperties was enabled for this Object thus we're letting it slide.");
				}
				else
				{
					JSONLoader3.FormatLogger("Debug", "LintingTools", "Successfully Linted for Path: " + traversalPath);
				}
				if (requiredFromSchema.Contains(item5.Item2))
				{
					JSONLoader3.FormatLogger("Debug", "LintingTools", "'" + item5.Item2 + "' is a required field.");
					for (int num2 = 0; num2 < list3.Count; num2++)
					{
						JSONLoader3.FormatLogger("Debug", "LintingTools", $"Required Tick [{num2}]: ({list3[num2].Item1}, {list3[num2].Item2})");
						if (list3[num2].Item1 == item5.Item2)
						{
							list3[num2] = (item5.Item2, true);
							JSONLoader3.FormatLogger("Debug", "LintingTools", "Ticked '" + item5.Item2 + "' as checked.");
							break;
						}
					}
				}
				if (traversalPath != string.Empty)
				{
					List<string> jSONSchemaProperty = GetJSONSchemaProperty(traversalPath, JSONSchema);
					string item = item5.Item2;
					string item2 = item5.Item3;
					string[] obj3 = new string[8]
					{
						LoadSchema.SchemaFolder,
						null,
						null,
						null,
						null,
						null,
						null,
						null
					};
					char directorySeparatorChar = Path.DirectorySeparatorChar;
					obj3[1] = directorySeparatorChar.ToString();
					obj3[2] = LoaderName;
					directorySeparatorChar = Path.DirectorySeparatorChar;
					obj3[3] = directorySeparatorChar.ToString();
					obj3[4] = LoaderName;
					obj3[5] = "_";
					obj3[6] = typeof(Class).Name;
					obj3[7] = "_Schema.json";
					if (!ValidatePropertyAgainstSchema(item, item2, jSONSchemaProperty, file, Path.GetFullPath(string.Concat(obj3))))
					{
						return (validatedJSON: list2, check: false);
					}
				}
			}
			JSONLoader3.FormatLogger("Debug", "LintingTools", "Final Required Ticks: " + string.Join(", ", list3.Select<(string, bool), string>(((string field, bool checkedField) x) => $"({x.field}, {x.checkedField})")));
			foreach (var item6 in list3)
			{
				var (text, _) = item6;
				if (!item6.Item2)
				{
					JSONLoader3.FormatLogger("ERROR", "LintingTools", "Missing Required Field: " + text + " within " + Path.GetFileNameWithoutExtension(file) + ".");
					JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "To Fix this, simply add the field mentioned in the error to the json with the appropriate value.");
					JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Here's the full path to the file the issue takes root in: " + file);
					return (validatedJSON: list2, check: false);
				}
			}
			return (validatedJSON: list2, check: true);
		}

		public static string GetTraversalPath(List<(int depth, string propertyName, string propertyValue)> JSONSchemaProperties, (int depth, string propertyName, string propertyValue) JSON, int spelunkingDepth)
		{
			List<string> list = new List<string>();
			int num = JSONSchemaProperties.FindIndex(((int depth, string propertyName, string propertyValue) x) => x.propertyName == JSON.propertyName && x.depth == JSON.depth * spelunkingDepth);
			if (num == -1)
			{
				return string.Empty;
			}
			list.Add(JSONSchemaProperties[num].propertyName);
			int item = JSONSchemaProperties[num].depth;
			for (int num2 = num - 1; num2 >= 0; num2--)
			{
				if (JSONSchemaProperties[num2].depth < item)
				{
					list.Insert(0, JSONSchemaProperties[num2].propertyName);
					item = JSONSchemaProperties[num2].depth;
				}
			}
			return string.Join("/", list);
		}

		public static List<(int depth, string propertyName, string propertyValue)> DisectedJSON(List<string> JSONFile)
		{
			List<(int, string, string)> list = new List<(int, string, string)>();
			int num = 0;
			foreach (string item2 in JSONFile)
			{
				int item = num;
				string text = item2.Trim();
				foreach (char c in text)
				{
					if (c == '{' || c == '[')
					{
						num++;
					}
					else if (c == '}' || c == ']')
					{
						num--;
					}
				}
				if (!item2.Trim().StartsWith("{") && !item2.Trim().StartsWith("}") && !item2.Trim().StartsWith("[") && !item2.Trim().StartsWith("]") && item2.Trim().Contains(":"))
				{
					list.Add((item, item2.Trim().Substring(0, item2.Trim().IndexOf(":")).Trim()
						.Trim(new char[1] { '"' }), item2.Trim().Substring(item2.Trim().IndexOf(":") + 1).Trim()
						.TrimEnd(new char[1] { ',' })));
				}
			}
			return list;
		}

		public static List<string> LoadInJSONItem(string file)
		{
			FileStream stream = File.OpenRead(file);
			StreamReader streamReader = new StreamReader(stream);
			List<string> list = new List<string>();
			while (streamReader.Peek() >= 0)
			{
				string item = streamReader.ReadLine();
				list.Add(item);
			}
			streamReader.Dispose();
			return list;
		}

		public static List<string> GetJSONSchemaProperty(string propertyPath, List<string> JSONSchema)
		{
			List<string> list = (from x in propertyPath.Split(new char[1] { '/' })
				where !string.IsNullOrWhiteSpace(x)
				select x).ToList();
			List<string> list2 = JSONSchema;
			foreach (string item in list)
			{
				list2 = DigThroughSchemaFindRelevant(item, list2);
				if (list2.Count == 0)
				{
					break;
				}
			}
			return list2;
		}

		public static List<string> GetRequiredFromSchema(List<string> JSONSchema)
		{
			List<string> list = new List<string>();
			int num = -1;
			int num2 = -1;
			for (int i = 0; i < JSONSchema.Count; i++)
			{
				if (JSONSchema[i].Trim().StartsWith("\"required\": ["))
				{
					num = i + 1;
					break;
				}
			}
			if (num == -1)
			{
				return list;
			}
			for (int j = num; j < JSONSchema.Count; j++)
			{
				if (JSONSchema[j].Trim().TrimEnd(new char[1] { ',' }) == "]")
				{
					num2 = j;
					break;
				}
			}
			if (num2 == -1)
			{
				return list;
			}
			for (int k = num; k < num2; k++)
			{
				string text = JSONSchema[k].Trim().Trim('"', ',');
				if (!StringExtensions.IsNullOrWhitespace(text) && !list.Contains(text))
				{
					list.Add(text);
				}
			}
			return list;
		}

		public static bool AllowExtraFieldsCheck(List<string> JSONSchema)
		{
			bool result = true;
			foreach (string item in JSONSchema)
			{
				if (item.Contains("\"additionalProperties\": "))
				{
					result = bool.Parse(item.Trim().Replace("\"additionalProperties\": ", "").Trim('"', ','));
					break;
				}
			}
			return result;
		}

		internal static List<string> DigThroughArrayFindRelevant(string jsonArray)
		{
			if (!jsonArray.Trim().StartsWith("[") || !jsonArray.Trim().EndsWith("]"))
			{
				return new List<string>();
			}
			string text = jsonArray.Trim().Substring(1, jsonArray.Trim().Length - 2).Trim();
			List<string> list = new List<string>();
			int num = 0;
			int num2 = 0;
			for (int i = 0; i < text.Length; i++)
			{
				if (text[i] == '{' || text[i] == '[')
				{
					num2++;
				}
				else if (text[i] == '}' || text[i] == ']')
				{
					num2--;
				}
				if (text[i] == ',' && num2 == 0)
				{
					list.Add(text.Substring(num, i - num).Trim());
					num = i + 1;
				}
			}
			if (num < text.Length)
			{
				list.Add(text.Substring(num).Trim());
			}
			return list;
		}

		internal static List<string> DigThroughSchemaFindRelevant(string propertyToFind, List<string> JSONSchema)
		{
			int num = -1;
			foreach (string item in JSONSchema)
			{
				if (item.Trim().StartsWith("\"" + propertyToFind + "\": {"))
				{
					num = JSONSchema.IndexOf(item);
					break;
				}
			}
			List<string> list = new List<string>();
			if (num == -1)
			{
				JSONLoader3.FormatLogger("Warning", "LintingTools", "Could not find " + propertyToFind + " in Schema.");
				return list;
			}
			int num2 = 0;
			bool flag = false;
			for (int i = num; i < JSONSchema.Count; i++)
			{
				string text = JSONSchema[i];
				list.Add(text);
				string text2 = text;
				for (int j = 0; j < text2.Length; j++)
				{
					switch (text2[j])
					{
					case '{':
						num2++;
						flag = true;
						break;
					case '}':
						num2--;
						break;
					}
				}
				if (flag && num2 == 0)
				{
					break;
				}
			}
			return list;
		}

		internal static List<(int depth, string propertyName, string propertyValue)> GetObjectProperties(string jsonObject)
		{
			List<string> list = new List<string> { "{" };
			list.AddRange(jsonObject.Trim().Split(new char[1] { '\n' }));
			list.Add("}");
			List<(int, string, string)> list2 = DisectedJSON(list);
			if (list2.Count == 0)
			{
				return new List<(int, string, string)>();
			}
			int objectDepth = list2[0].Item1;
			return list2.Where<(int, string, string)>(((int depth, string propertyName, string propertyValue) x) => x.depth == objectDepth).ToList();
		}

		internal static List<string> GetArrayItems(string jsonArray, string propertyName, string file)
		{
			if (jsonArray.Trim() != "[")
			{
				return DigThroughArrayFindRelevant(jsonArray);
			}
			List<string> list = File.ReadAllLines(file).ToList();
			int num = list.FindIndex((string x) => x.Trim().StartsWith("\"" + propertyName + "\""));
			if (num == -1)
			{
				return new List<string>();
			}
			string text = list[num].Substring(list[num].IndexOf(":") + 1).Trim();
			int num2 = 0;
			string text2 = text;
			for (int num3 = 0; num3 < text2.Length; num3++)
			{
				switch (text2[num3])
				{
				case '[':
					num2++;
					break;
				case ']':
					num2--;
					break;
				}
			}
			while (num2 > 0 && num + 1 < list.Count)
			{
				num++;
				string text3 = list[num].Trim();
				text = text + "\n" + text3;
				string text4 = text3;
				for (int num4 = 0; num4 < text4.Length; num4++)
				{
					switch (text4[num4])
					{
					case '[':
						num2++;
						break;
					case ']':
						num2--;
						break;
					}
				}
			}
			return DigThroughArrayFindRelevant(text.TrimEnd(new char[1] { ',' }));
		}

		internal static List<string> GetArrayItems(string jsonArray)
		{
			return DigThroughArrayFindRelevant(jsonArray);
		}

		public static bool ValidatePropertyAgainstSchema(string jsonPropertyName, string jsonPropertyValue, List<string> PropertySchema, string file, string schemaFile)
		{
			string text = "";
			string text2 = "";
			bool flag = false;
			bool flag2 = false;
			List<string> list = new List<string>(PropertySchema);
			foreach (string item in PropertySchema)
			{
				if (PropertySchema.IndexOf(item) == 0)
				{
					list.RemoveAt(0);
				}
				if (item.Contains("\"type\": \"") && !flag)
				{
					text = item.Trim().Replace("\"type\": \"", "").Trim('"', ',');
					list.Remove(item);
					flag = true;
				}
				if (item.Contains("\"description\": \"") && !flag2)
				{
					text2 = item.Trim().Replace("\"description\": \"", "").Trim('"', ',');
					list.Remove(item);
					flag2 = true;
				}
			}
			JSONLoader3.FormatLogger("Summary", "LintingTools", "Property Description for " + jsonPropertyName + " for ease of access.");
			foreach (string item2 in text2.Split(new char[1] { '|' }).ToList())
			{
				JSONLoader3.FormatLogger("Summary", "LintingTools", item2.Trim().Replace("\\\"", "\""));
			}
			switch (text)
			{
			case "string":
				return ValidateString(jsonPropertyName, jsonPropertyValue, list, file, schemaFile);
			case "integer":
				return ValidateInteger(jsonPropertyName, jsonPropertyValue, list, file, schemaFile);
			case "boolean":
				return ValidateBoolean(jsonPropertyName, jsonPropertyValue, list, file, schemaFile);
			case "object":
				return ValidateObject(jsonPropertyName, jsonPropertyValue, list, file, schemaFile);
			case "array":
				return ValidateArray(jsonPropertyName, jsonPropertyValue, list, file, schemaFile);
			default:
				JSONLoader3.FormatLogger("Warning", "LintingTools", "Could not find " + text + " support for validating " + jsonPropertyName + " within this Item Type for validating against the Schema, notify a maintainer if this is not intentional.");
				return true;
			}
		}

		public static bool ValidateString(string jsonPropertyName, string jsonPropertyValue, List<string> PropertySchema, string file, string schemaFile)
		{
			int num = -1;
			Regex regex = null;
			string text = "";
			List<string> list = new List<string>();
			for (int i = 0; i < PropertySchema.Count; i++)
			{
				string text2 = PropertySchema[i];
				if (text2.Contains("\"minLength\": "))
				{
					num = int.Parse(text2.Trim().Replace("\"minLength\": ", "").Trim('"', ','));
				}
				if (text2.Contains("\"pattern\": \""))
				{
					regex = new Regex(Regex.Unescape(text2.Trim().Replace("\"pattern\": \"", "").Trim('"', ',')));
				}
				if (text2.Contains("\"default\": \""))
				{
					text = text2.Trim().Replace("\"default\": \"", "").Trim('"', ',');
				}
				if (!text2.Contains("\"enum\": ["))
				{
					continue;
				}
				int num2 = i + 1;
				for (int j = num2; j < PropertySchema.Count; j++)
				{
					string text3 = PropertySchema[j].Trim();
					if (text3.TrimEnd(new char[1] { ',' }) == "]")
					{
						break;
					}
					string text4 = text3.Trim('"', ',');
					if (!StringExtensions.IsNullOrWhitespace(text4))
					{
						list.Add(text4);
					}
				}
				break;
			}
			if (!jsonPropertyValue.StartsWith("\"") || !jsonPropertyValue.EndsWith("\""))
			{
				JSONLoader3.FormatLogger("ERROR", "LintingTools", "Invalid String was Found. The JSON this error occured in: " + Path.GetFileNameWithoutExtension(file));
				JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "To fix this ensure the Value for this item is properly encases in Quotation marks.");
				return false;
			}
			if (num != -1 && jsonPropertyValue.Trim(new char[1] { '"' }).Length < num)
			{
				JSONLoader3.FormatLogger("ERROR", "LintingTools", $"The string is shorter than the Minimum Length ({num}) for {jsonPropertyName} according to the Schema for this Item. The JSON this error occured in: {Path.GetFileNameWithoutExtension(file)}");
				JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", $"To fix this just simply extend the length of {jsonPropertyValue} above {num}.");
				JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Sadly as it broke here, I'm going to have to call a break, meaning we are going to stop proccessing this item and move on to the next one.");
				JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Hopefully you'll have it fixed for next load up!!");
				JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Here's the full path to the file the issue takes root in: " + file);
				return false;
			}
			if (regex != null && !regex.IsMatch(jsonPropertyValue.Trim(new char[1] { '"' })))
			{
				JSONLoader3.FormatLogger("ERROR", "LintingTools", $"The string value for {jsonPropertyName} is invalid based on the Regex specified by the Schema for this item ({regex}). The JSON this error occured in: {Path.GetFileNameWithoutExtension(file)}");
				JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "To fix this copy the regex shown above and paste it into the expression box of https://regexr.com/.");
				JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Now take your value (" + jsonPropertyValue + ") and put it in the Text Box below it.");
				JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "The Regex will be described under tools, so now just edit your value for " + jsonPropertyName + " until it is valid.");
				JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Now just paste that value back into your JSON Key associated with " + jsonPropertyName + ", than your set for the next boot.");
				JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Keep in mind if it was an image, ensure the image matches that exact name. P.S. If your trying to route folders use '/' after the folders name to go in, and '../' to go in.");
				JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Sadly as it broke here, I'm going to have to call a break, meaning we are going to stop proccessing this item and move on to the next one.");
				JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Hopefully you'll have it fixed for next load up!!");
				JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Here's the full path to the file the issue takes root in: " + file);
				return false;
			}
			if (StringExtensions.IsNullOrWhitespace(text) && StringExtensions.IsNullOrWhitespace(jsonPropertyValue.Trim(new char[1] { '"' })))
			{
				JSONLoader3.FormatLogger("ERROR", "LintingTools", "The string is empty and there is no default value for " + jsonPropertyName + " either define it or remove it. The JSON this error occured in: " + Path.GetFileNameWithoutExtension(file));
				JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "To fix this simply as the error states remove the KVP for " + jsonPropertyName);
				JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Alternatively define a value for " + jsonPropertyName + " you can toggle on Summary in The Config to show the Properties Description for further Information about it..");
				JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Sadly as it broke here, I'm going to have to call a break, meaning we are going to stop proccessing this item and move on to the next one.");
				JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Hopefully you'll have it fixed for next load up!!");
				JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Here's the full path to the file the issue takes root in: " + file);
				return false;
			}
			string valueToCheck = jsonPropertyValue.Trim().Trim(new char[1] { '"' });
			JSONLoader3.FormatLogger("Debug", "LintingTools", "Enums found for " + jsonPropertyName + ": (" + string.Join(", ", list) + ")");
			JSONLoader3.FormatLogger("Debug", "LintingTools", "Value being checked: (" + valueToCheck + ")");
			bool flag = list.Any((string enumValue) => string.Equals(enumValue.Trim(), valueToCheck, StringComparison.Ordinal));
			JSONLoader3.FormatLogger("Debug", "LintingTools", $"Enum validation result for ({valueToCheck}): {flag}");
			if (list.Count > 0 && !flag)
			{
				JSONLoader3.FormatLogger("ERROR", "LintingTools", "The string does not match any of the required Enums for " + jsonPropertyName + " according to the Schema. The JSON this error occured in: " + Path.GetFileNameWithoutExtension(file));
				JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "To fix this just ensure the " + jsonPropertyName + " matches the actual Enums applicable for this field.");
				JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Look at the Description for " + jsonPropertyName + " for a list of possible values for this field.");
				JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Sadly as it broke here, I'm going to have to call a break, meaning we are going to stop proccessing this item and move on to the next one.");
				JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Hopefully you'll have it fixed for next load up!!");
				JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Here's the full path to the file the issue takes root in: " + file);
				return false;
			}
			return true;
		}

		public static bool ValidateInteger(string jsonPropertyName, string jsonPropertyValue, List<string> PropertySchema, string file, string schemaFile)
		{
			int num = -1;
			int num2 = -1;
			int num3 = -1;
			bool flag = false;
			bool flag2 = false;
			bool flag3 = false;
			foreach (string item in PropertySchema)
			{
				if (item.Contains("\"minimum\": "))
				{
					num = int.Parse(item.Trim().Replace("\"minimum\": ", "").Trim('"', ','));
					flag = true;
				}
				if (item.Contains("\"maximum\": "))
				{
					num2 = int.Parse(item.Trim().Replace("\"maximum\": ", "").Trim('"', ','));
					flag2 = true;
				}
				if (item.Contains("\"default\": "))
				{
					num3 = int.Parse(item.Trim().Replace("\"default\": ", "").Trim('"', ','));
					flag3 = true;
				}
			}
			if (jsonPropertyValue.StartsWith("\"") && jsonPropertyValue.EndsWith("\""))
			{
				JSONLoader3.FormatLogger("ERROR", "LintingTools", "Invalid Int was Found. The JSON this error occured in: " + Path.GetFileNameWithoutExtension(file));
				JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "To fix this ensure the Value for this item is NOT encased in Quotation marks.");
				JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Sadly as it broke here, I'm going to have to call a break, meaning we are going to stop proccessing this item and move on to the next one.");
				JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Hopefully you'll have it fixed for next load up!!");
				JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Here's the full path to the file the issue takes root in: " + file);
				return false;
			}
			if (StringExtensions.IsNullOrWhitespace(jsonPropertyValue) && !flag3)
			{
				JSONLoader3.FormatLogger("ERROR", "LintingTools", "The value is empty and there is no default value for " + jsonPropertyName + " either define it or remove it. The JSON this error occured in: " + Path.GetFileNameWithoutExtension(file));
				JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "To fix this simply as the error states remove the KVP for " + jsonPropertyName);
				JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Alternatively define a value for " + jsonPropertyName + " you can toggle on Summary in The Config to show the Properties Description for further Information about it..");
				JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Sadly as it broke here, I'm going to have to call a break, meaning we are going to stop proccessing this item and move on to the next one.");
				JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Hopefully you'll have it fixed for next load up!!");
				JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Here's the full path to the file the issue takes root in: " + file);
				return false;
			}
			if (!int.TryParse(jsonPropertyValue, out var result))
			{
				JSONLoader3.FormatLogger("ERROR", "LintingTools", "The Value passed in with " + jsonPropertyName + " is not a valid Integer. The JSON this error occured in: " + Path.GetFileNameWithoutExtension(file));
				JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "The value associated with " + jsonPropertyName + " did not parse correctly as an Integer, the value being (" + jsonPropertyValue + ")");
				JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Sadly as it broke here, I'm going to have to call a break, meaning we are going to stop proccessing this item and move on to the next one.");
				JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Hopefully you'll have it fixed for next load up!!");
				JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Here's the full path to the file the issue takes root in: " + file);
				return false;
			}
			if (result > num2 && flag2)
			{
				JSONLoader3.FormatLogger("ERROR", "LintingTools", $"The value of {jsonPropertyName} is Greater than the Maximum allowed by the Schema for this item, the maximum being {num2}. The JSON this error occured in: {Path.GetFileNameWithoutExtension(file)}");
				JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", $"To fix this simply set the value of {jsonPropertyName} to a Integer less than {num2}.");
				JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Sadly as it broke here, I'm going to have to call a break, meaning we are going to stop proccessing this item and move on to the next one.");
				JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Hopefully you'll have it fixed for next load up!!");
				JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Here's the full path to the file the issue takes root in: " + file);
				return false;
			}
			if (result < num && flag)
			{
				JSONLoader3.FormatLogger("ERROR", "LintingTools", $"The value of {jsonPropertyName} is Less than the Minimum allowed by the Schema for this item, the minimum being {num}. The JSON this error occured in: {Path.GetFileNameWithoutExtension(file)}");
				JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", $"To fix this simply set the value of {jsonPropertyName} to a Integer greater than {num}.");
				JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Sadly as it broke here, I'm going to have to call a break, meaning we are going to stop proccessing this item and move on to the next one.");
				JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Hopefully you'll have it fixed for next load up!!");
				JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Here's the full path to the file the issue takes root in: " + file);
				return false;
			}
			return true;
		}

		public static bool ValidateBoolean(string jsonPropertyName, string jsonPropertyValue, List<string> PropertySchema, string file, string schemaFile)
		{
			bool flag = false;
			bool flag2 = false;
			foreach (string item in PropertySchema)
			{
				if (item.Contains("\"default\": "))
				{
					flag = bool.Parse(item.Trim().Replace("\"default\": ", "").Trim('"', ','));
					flag2 = true;
				}
			}
			if (jsonPropertyValue.StartsWith("\"") && jsonPropertyValue.EndsWith("\""))
			{
				JSONLoader3.FormatLogger("ERROR", "LintingTools", "Invalid Boolean was Found. The JSON this error occured in: " + Path.GetFileNameWithoutExtension(file));
				JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "To fix this ensure the Value for this item is NOT encased in Quotation marks.");
				JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Sadly as it broke here, I'm going to have to call a break, meaning we are going to stop proccessing this item and move on to the next one.");
				JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Hopefully you'll have it fixed for next load up!!");
				JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Here's the full path to the file the issue takes root in: " + file);
				return false;
			}
			if (StringExtensions.IsNullOrWhitespace(jsonPropertyValue) && !flag2)
			{
				JSONLoader3.FormatLogger("ERROR", "LintingTools", "The value is empty and there is no default value for " + jsonPropertyName + " either define it or remove it. The JSON this error occured in: " + Path.GetFileNameWithoutExtension(file));
				JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "To fix this simply as the error states remove the KVP for " + jsonPropertyName);
				JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Alternatively define a value for " + jsonPropertyName + " you can toggle on Summary in The Config to show the Properties Description for further Information about it..");
				JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Sadly as it broke here, I'm going to have to call a break, meaning we are going to stop proccessing this item and move on to the next one.");
				JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Hopefully you'll have it fixed for next load up!!");
				JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Here's the full path to the file the issue takes root in: " + file);
				return false;
			}
			if (!bool.TryParse(jsonPropertyValue, out var _))
			{
				JSONLoader3.FormatLogger("ERROR", "LintingTools", "The Value passed in with " + jsonPropertyName + " is not a valid Boolean. The JSON this error occured in: " + Path.GetFileNameWithoutExtension(file));
				JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "The value associated with " + jsonPropertyName + " did not parse correctly as an Boolean, the value being (" + jsonPropertyValue + ")");
				JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Sadly as it broke here, I'm going to have to call a break, meaning we are going to stop proccessing this item and move on to the next one.");
				JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Hopefully you'll have it fixed for next load up!!");
				JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Here's the full path to the file the issue takes root in: " + file);
				return false;
			}
			if (jsonPropertyValue != jsonPropertyValue.ToLower())
			{
				JSONLoader3.FormatLogger("ERROR", "LintingTools", "The Value passed in with " + jsonPropertyName + " did not have the correct casing, the Value (" + jsonPropertyValue + ") must be all lowercase. The JSON this error occured in: " + Path.GetFileNameWithoutExtension(file));
				JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "To fix this just make sure the value associated with " + jsonPropertyName + " is in full lowercase.");
				JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Sadly as it broke here, I'm going to have to call a break, meaning we are going to stop proccessing this item and move on to the next one.");
				JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Hopefully you'll have it fixed for next load up!!");
				JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Here's the full path to the file the issue takes root in: " + file);
				return false;
			}
			return true;
		}

		public static bool ValidateObject(string jsonPropertyName, string jsonPropertyValue, List<string> PropertySchema, string file, string schemaFile)
		{
			List<string> list = new List<string>();
			list.Add("{");
			if (jsonPropertyValue.Trim().StartsWith("{"))
			{
				list.AddRange(jsonPropertyValue.Trim().Split(new char[1] { '\n' }));
			}
			else
			{
				list.Add("\"" + jsonPropertyName + "\": " + jsonPropertyValue);
			}
			list.Add("}");
			List<(int, string, string)> list2 = DisectedJSON(list);
			if (list2.Count == 0)
			{
				JSONLoader3.FormatLogger("ERROR", "LintingTools", "Could not dissect object for " + jsonPropertyName + ". The JSON this error occured in: " + Path.GetFileNameWithoutExtension(file));
				return false;
			}
			int item = list2[0].Item1;
			if (!jsonPropertyValue.Trim().StartsWith("{"))
			{
				list2 = list2.Where<(int, string, string)>(((int depth, string propertyName, string propertyValue) x) => x.propertyName != jsonPropertyName).ToList();
			}
			List<(int, string, string)> list3 = DisectedJSON(PropertySchema);
			List<string> requiredFromSchema = GetRequiredFromSchema(PropertySchema);
			List<(string, bool)> list4 = new List<(string, bool)>();
			foreach (string item3 in requiredFromSchema)
			{
				list4.Add((item3, false));
			}
			JSONLoader3.FormatLogger("Debug", "LintingTools", "Required Fields: " + string.Join(", ", requiredFromSchema));
			foreach (var item4 in list2)
			{
				JSONLoader3.FormatLogger("Debug", "LintingTools", $"Object Traversal: [{item4.Item2}] JSON Depth [{item4.Item1}]");
				JSONLoader3.FormatLogger("Debug", "LintingTools", "Object Schema: " + string.Join(", ", list3.Select<(int, string, string), string>(((int depth, string propertyName, string propertyValue) x) => $"[{x.depth}] {x.propertyName}")));
				int item2 = item4.Item1 - item + 1;
				string traversalPath = GetTraversalPath(list3, (depth: item2, propertyName: item4.Item2, propertyValue: item4.Item3), 2);
				if (traversalPath == string.Empty)
				{
					JSONLoader3.FormatLogger("ERROR", "LintingTools", "Something went wrong while doing PathTraversal for " + item4.Item2 + " the following should help identify what you did wrong.");
					if (GetTraversalPath(list3, (depth: item2, propertyName: StringUtilsExtensions.ToCamelCase(item4.Item2), propertyValue: item4.Item3), 2) != string.Empty)
					{
						JSONLoader3.FormatLogger("ERROR", "LintingTools", "The casing of " + item4.Item2 + " within " + Path.GetFileNameWithoutExtension(file) + " is not correct, it should be in camelCase.");
						JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Basically the Property needs to follow the correct convention which is first word in Lowercase, and the rest of the words first letters Capitalized.");
						JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "likeThis");
						JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "In the JSON the KVP would look like: \"likeThis\": false");
						JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Here's the full path to the file the issue takes root in: " + file);
						return false;
					}
					if (!AllowExtraFieldsCheck(PropertySchema))
					{
						JSONLoader3.FormatLogger("ERROR", "LintingTools", "The Property of " + item4.Item2 + " is not apart of the JSON Schema, please remove it from the JSON entitled " + Path.GetFileNameWithoutExtension(file) + ".");
						JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "If you want to stop seeing these when you make your jsons, just cross check the JSON against the Schema saving it.");
						JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Theres a nifty site called JSONEditor that you may find useful, theres a guide in the README.");
						JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Additionally you can cross-reference against the Property List we provide in our API's documentation and WIKI's.");
						JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Here's the full path to the file the issue takes root in: " + file);
						JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "You can also find the full Schema here: " + schemaFile);
					}
					else
					{
						JSONLoader3.FormatLogger("Warning", "LintingTools", "The Property of " + item4.Item2 + " is not apart of the JSON Schema, please remove it from the JSON entitled " + Path.GetFileNameWithoutExtension(file) + ".");
						JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Here's the full path to the file the issue takes root in: " + file);
						JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "You can also find the full Schema here: " + schemaFile);
						JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "This is a warning because additionalProperties was enabled for this Object thus we're letting it slide.");
					}
				}
				else
				{
					JSONLoader3.FormatLogger("Debug", "LintingTools", "Successfully Linted for Path: " + traversalPath);
				}
				if (requiredFromSchema.Contains(item4.Item2))
				{
					JSONLoader3.FormatLogger("Debug", "LintingTools", "'" + item4.Item2 + "' is a required field.");
					for (int num = 0; num < list4.Count; num++)
					{
						JSONLoader3.FormatLogger("Debug", "LintingTools", $"Required Tick [{num}]: ({list4[num].Item1}, {list4[num].Item2})");
						if (list4[num].Item1 == item4.Item2)
						{
							list4[num] = (item4.Item2, true);
							JSONLoader3.FormatLogger("Debug", "LintingTools", "Ticked '" + item4.Item2 + "' as checked.");
							break;
						}
					}
				}
				if (traversalPath != string.Empty)
				{
					List<string> jSONSchemaProperty = GetJSONSchemaProperty(traversalPath, PropertySchema);
					if (!ValidatePropertyAgainstSchema(item4.Item2, item4.Item3, jSONSchemaProperty, file, schemaFile))
					{
						return false;
					}
				}
			}
			JSONLoader3.FormatLogger("Debug", "LintingTools", "Final Required Ticks: " + string.Join(", ", list4.Select<(string, bool), string>(((string field, bool checkedField) x) => $"({x.field}, {x.checkedField})")));
			foreach (var item5 in list4)
			{
				var (text, _) = item5;
				if (!item5.Item2)
				{
					JSONLoader3.FormatLogger("ERROR", "LintingTools", "Missing Required Field: " + text + " within " + Path.GetFileNameWithoutExtension(file) + ".");
					JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "To Fix this, simply add the field mentioned in the error to the json with the appropriate value.");
					JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Here's the full path to the file the issue takes root in: " + file);
					return false;
				}
			}
			return true;
		}

		public static bool ValidateArray(string jsonPropertyName, string jsonPropertyValue, List<string> PropertySchema, string file, string schemaFile)
		{
			List<string> arrayItems = GetArrayItems(jsonPropertyValue, jsonPropertyName, file);
			if (arrayItems.Count == 0)
			{
				JSONLoader3.FormatLogger("Warning", "LintingTools", "The Array is empty for " + jsonPropertyName + " either define it or remove it. The JSON this warming occured in: " + Path.GetFileNameWithoutExtension(file));
				JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "To fix this simply as the error states remove the KVP for " + jsonPropertyName);
				JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Alternatively define a value for " + jsonPropertyName + " you can toggle on Summary in The Config to show the Properties Description for further Information about it..");
				JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "This is a warning because we have never been strict about this, but if you want to stop seeing this warning do the above.");
				return true;
			}
			bool flag = false;
			string text = "";
			foreach (string item in PropertySchema)
			{
				if (item.Contains("\"uniqueItems\": "))
				{
					flag = bool.Parse(item.Trim().Replace("\"uniqueItems\": ", "").Trim('"', ','));
				}
			}
			if (flag && arrayItems.Distinct().Count() != arrayItems.Count)
			{
				JSONLoader3.FormatLogger("ERROR", "LintingTools", "There is duplicated Array Items in the Array " + jsonPropertyName + ", according to the Schema for this Item, all Array Items must be Unique for " + jsonPropertyName + ". The JSON this error occured in: " + Path.GetFileNameWithoutExtension(file));
				JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "To fix this error just ensure all Items of the Array are Unique, e.g. No Repeats within it.");
				JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Sadly as it broke here, I'm going to have to call a break, meaning we are going to stop proccessing this item and move on to the next one.");
				JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Hopefully you'll have it fixed for next load up!!");
				JSONLoader3.FormatLogger("AdditionalInformation", "LintingTools", "Here's the full path to the file the issue takes root in: " + file);
				return false;
			}
			List<string> list = DigThroughSchemaFindRelevant("items", PropertySchema);
			if (list.Count == 0)
			{
				JSONLoader3.FormatLogger("ERROR", "LintingTools", "Array " + jsonPropertyName + " has no item schema defined. The JSON this error occured in: " + Path.GetFileNameWithoutExtension(file));
				JSONLoader3.FormatLogger("Warning", "LintingTools", "Could not find any Schema for validating the Items of the Array " + jsonPropertyName + ", notify a maintainer if you ever receive this, with a copy of your JSON file.");
				return false;
			}
			foreach (string item2 in list)
			{
				if (item2.Contains("\"type\": \""))
				{
					text = item2.Trim().Replace("\"type\": \"", "").Trim('"', ',');
					break;
				}
			}
			foreach (string item3 in arrayItems)
			{
				bool flag2 = false;
				if (text == "object")
				{
					flag2 = ValidateObject(jsonPropertyName, item3, list, file, schemaFile);
				}
				else
				{
					List<string> list2 = new List<string>();
					list2.Add("{");
					list2.Add("\"" + jsonPropertyName + "\": " + item3);
					list2.Add("}");
					List<(int, string, string)> list3 = DisectedJSON(list2);
					if (list3.Count == 0)
					{
						JSONLoader3.FormatLogger("ERROR", "LintingTools", "Could not dissect array item for " + jsonPropertyName + ". The JSON this error occured in: " + Path.GetFileNameWithoutExtension(file));
						return false;
					}
					switch (text)
					{
					case "string":
						flag2 = ValidateString(list3[0].Item2, list3[0].Item3, list, file, schemaFile);
						break;
					case "integer":
						flag2 = ValidateInteger(list3[0].Item2, list3[0].Item3, list, file, schemaFile);
						break;
					case "boolean":
						flag2 = ValidateBoolean(list3[0].Item2, list3[0].Item3, list, file, schemaFile);
						break;
					case "array":
						flag2 = ValidateArray(list3[0].Item2, list3[0].Item3, list, file, schemaFile);
						break;
					default:
						JSONLoader3.FormatLogger("Warning", "LintingTools", "Could not find " + text + " support for validating " + jsonPropertyName + " within this Item Type for validating against the Schema, notify a maintainer if this is not intentional.");
						flag2 = true;
						break;
					}
				}
				if (!flag2)
				{
					return false;
				}
			}
			return true;
		}
	}
}
namespace JSONLoader3.Peripheral.ImageHandling
{
	public class ScanImages
	{
		public static Sprite ParseImage(string plugin, string imagePath)
		{
			if (imagePath.StartsWith("data:image/png;base64,") || imagePath.StartsWith("base64:"))
			{
				return GetTextureFromBase64(imagePath);
			}
			if (!imagePath.Contains("/"))
			{
				return GetSpriteFromFileName(imagePath, plugin);
			}
			return GetTextureFromPluginAndPath(plugin, imagePath);
		}

		private static Texture2D GetTextureFromString(string path)
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Expected O, but got Unknown
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Expected O, but got Unknown
			if (path.StartsWith("data:image/png;base64,"))
			{
				try
				{
					string s = path.Substring("data:image/png;base64,".Length);
					byte[] array = Convert.FromBase64String(s);
					Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false);
					((Texture)val).filterMode = (FilterMode)0;
					ImageConversion.LoadImage(val, array);
					return val;
				}
				catch (Exception ex)
				{
					JSONLoader3.FormatLogger("Error", "ScanImages", "Failed to convert base64 to texture: " + path);
					JSONLoader3.FormatLogger("Debug", "ScanImages", "Printing Message of Exception and Source");
					JSONLoader3.FormatLogger("Debug", "ScanImages", ex.Message + " " + ex.Source);
					JSONLoader3.FormatLogger("Debug", "ScanImages", "Printing Stack Trace");
					JSONLoader3.FormatLogger("Debug", "ScanImages", ex.StackTrace);
				}
			}
			if (path.StartsWith("base64:"))
			{
				try
				{
					string s2 = path.Substring("base64:".Length);
					byte[] array2 = Convert.FromBase64String(s2);
					Texture2D val2 = new Texture2D(2, 2, (TextureFormat)4, false);
					((Texture)val2).filterMode = (FilterMode)0;
					ImageConversion.LoadImage(val2, array2);
					return val2;
				}
				catch (Exception ex2)
				{
					JSONLoader3.FormatLogger("Error", "ScanImages", "Failed to convert base64 to texture: " + path);
					JSONLoader3.FormatLogger("Debug", "ScanImages", "Printing Message of Exception and Source");
					JSONLoader3.FormatLogger("Debug", "ScanImages", ex2.Message + " " + ex2.Source);
					JSONLoader3.FormatLogger("Debug", "ScanImages", "Printing Stack Trace");
					JSONLoader3.FormatLogger("Debug", "ScanImages", ex2.StackTrace);
				}
			}
			return TextureHelper.GetImageAsTexture(path, (FilterMode)0);
		}

		private static Sprite GetTextureFromBase64(string texture)
		{
			if (!string.IsNullOrEmpty(texture))
			{
				Texture2D textureFromString = GetTextureFromString(texture);
				if ((Object)(object)textureFromString != (Object)null)
				{
					return TextureHelper.ConvertTexture(textureFromString, (Vector2?)null);
				}
			}
			return null;
		}

		private static Sprite GetTextureFromPluginAndPath(string plugin, string filePath)
		{
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Expected O, but got Unknown
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			string fullPath = Path.GetFullPath(Path.Combine(plugin, filePath.Replace('/', Path.DirectorySeparatorChar)));
			if (!File.Exists(fullPath))
			{
				fullPath = Path.GetFullPath(Path.Combine(plugin, "plugins", filePath.Replace('/', Path.DirectorySeparatorChar)));
				if (!File.Exists(fullPath))
				{
					JSONLoader3.FormatLogger("Error", "ScanImages", "File not found at path: " + filePath + " when appended onto the Plugins Path.");
					JSONLoader3.FormatLogger("AdditionalInformation", "ScanImages", "We tried the following 2 paths: ");
					JSONLoader3.FormatLogger("AdditionalInformation", "ScanImages", Path.GetFullPath(Path.Combine(plugin, filePath.Replace('/', Path.DirectorySeparatorChar))));
					JSONLoader3.FormatLogger("AdditionalInformation", "ScanImages", Path.GetFullPath(Path.Combine(plugin, "plugins", filePath.Replace('/', Path.DirectorySeparatorChar))));
					JSONLoader3.FormatLogger("AdditionalInformation", "ScanImages", "To resolve this, just make sure the Path leads to where your asset is located, we don't recursively scan in this case.");
					Texture2D val = new Texture2D(114, 94);
					return Sprite.Create(val, new Rect(0f, 0f, 114f, 94f), new Vector2(0.5f, 0.5f));
				}
			}
			return GetCustomImage(Path.GetFileNameWithoutExtension(filePath), Path.GetDirectoryName(fullPath));
		}

		public static Sprite GetSpriteFromFileName(string fileName, string pluginPath)
		{
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Expected O, but got Unknown
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			List<string> list = Directory.GetFiles(pluginPath, "*", SearchOption.AllDirectories).ToList();
			foreach (string item in list)
			{
				if (item.EndsWith(".png") && Path.GetFileName(item) == fileName)
				{
					return GetCustomImage(item.Replace(".png", ""), pluginPath);
				}
			}
			Texture2D val = new Texture2D(114, 94);
			return Sprite.Create(val, new Rect(0f, 0f, 114f, 94f), new Vector2(0.5f, 0.5f));
		}

		private static Texture2D LoadCustomPNG(string fileName, string imagePath)
		{
			return LoadCustomTexture(fileName, imagePath);
		}

		private static Texture2D LoadCustomTexture(string fileName, string imagePath)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Expected O, but got Unknown
			string text = Path.Combine(imagePath, fileName + ".png");
			if (File.Exists(text))
			{
				byte[] array = File.ReadAllBytes(text);
				Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false);
				ImageConversion.LoadImage(val, array);
				return val;
			}
			JSONLoader3.FormatLogger("Error", "ScanImages", "Texture not found at path: " + text);
			return null;
		}

		private static Sprite GetCustomImage(string fileName, string imagePath)
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			Texture2D val = LoadCustomPNG(fileName, imagePath);
			if ((Object)(object)val != (Object)null)
			{
				Sprite val2 = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f));
				((Object)val2).name = fileName;
				return val2;
			}
			JSONLoader3.FormatLogger("Error", "ScanImages", "Sprite creation failed for: " + fileName + " at path: " + imagePath);
			return null;
		}
	}
}
namespace JSONLoader3.Peripheral.FILE_Loader
{
	public class FindFiles
	{
		private static Assembly assembly = Assembly.GetExecutingAssembly();

		internal static string DLLPath = Path.GetDirectoryName(assembly.Location);

		public static void FindFilesToLoad()
		{
			string text = FindElementInPath(DLLPath, "BepInEx");
			if (text != null)
			{
				char directorySeparatorChar = Path.DirectorySeparatorChar;
				string path = text + directorySeparatorChar + "plugins";
				if (Directory.Exists(path))
				{
					JSONLoader3.FormatLogger("Information", "FindFiles", "We are now attempting to scan for files in which JSONLoader3 or CSVLoader will need to load. If you have verbose lFogging on we'll show all the paths as it happens.");
					List<string> list = Directory.GetDirectories(path).ToList();
					{
						foreach (string item in list)
						{
							if (DefineConfiguration.toggleRecursiveOnPlugin.Value)
							{
								List<string> list2 = Directory.GetFiles(item, "*", SearchOption.AllDirectories).ToList();
								foreach (string item2 in list2)
								{
									HandleJSONFile(item2, item);
								}
							}
							else
							{
								JSONLoader3.FormatLogger("Debug", "FindFiles", "Checking Plugin: " + item + " for loadable JSON files.");
								string[] array = DefineConfiguration.JSONLoadingPaths.Value.Split(new char[1] { ',' });
								foreach (string text2 in array)
								{
									directorySeparatorChar = Path.DirectorySeparatorChar;
									if (!Directory.Exists(item + directorySeparatorChar + text2.Trim().Replace('/', Path.DirectorySeparatorChar)))
									{
										continue;
									}
									directorySeparatorChar = Path.DirectorySeparatorChar;
									string path2 = item + directorySeparatorChar + text2.Trim().Replace('/', Path.DirectorySeparatorChar);
									List<string> list3 = Directory.GetFiles(path2, "*", SearchOption.AllDirectories).ToList();
									foreach (string item3 in list3)
									{
										HandleJSONFile(item3, item);
									}
								}
							}
							if (DefineConfiguration.toggleRecursiveOnPlugin.Value)
							{
								List<string> list4 = Directory.GetFiles(item, "*", SearchOption.AllDirectories).ToList();
								foreach (string item4 in list4)
								{
									HandleCSVFile(item4, item);
								}
								continue;
							}
							JSONLoader3.FormatLogger("Debug", "FindFiles", "Checking Plugin: " + item + " for loadable CSV files.");
							string[] array2 = DefineConfiguration.CSVLoadingPaths.Value.Split(new char[1] { ',' });
							foreach (string text3 in array2)
							{
								directorySeparatorChar = Path.DirectorySeparatorChar;
								if (!Directory.Exists(item + directorySeparatorChar + text3.Trim().Replace('/', Path.DirectorySeparatorChar)))
								{
									continue;
								}
								directorySeparatorChar = Path.DirectorySeparatorChar;
								string path3 = item + directorySeparatorChar + text3.Trim().Replace('/', Path.DirectorySeparatorChar);
								List<string> list5 = Directory.GetFiles(path3, "*", SearchOption.AllDirectories).ToList();
								foreach (string item5 in list5)
								{
									HandleCSVFile(item5, item);
								}
							}
						}
						return;
					}
				}
				JSONLoader3.FormatLogger("Error", "FindFiles", "Your install is missing a 'plugins' Folder, please ensure there is one if you are seeing this error arise and that it is lowercase.");
				JSONLoader3.FormatLogger("ExtendedInformation", "FindFiles", "This error is mainly because for whatever reason you either don't have a 'plugins' folder, or your 'plugins' folder was capitalized wrong.");
			}
			else
			{
				JSONLoader3.FormatLogger("Error", "FindFiles", "Not sure how this is even running right now, but this error is because JSONLoader was not found within the BepInEx path.");
				JSONLoader3.FormatLogger("ExtendedInformation", "FindFiles", "This error occurs primarily when this Plugin was not placed under the Plugins Folder, or if the Plugins folder could not be found. We expect Lowercase for the Path.");
			}
		}

		internal static void HandleJSONFile(string JSONFile, string plugin)
		{
			if ((!JSONFile.EndsWith(".jldr", StringComparison.OrdinalIgnoreCase) && !JSONFile.EndsWith(".jldr2", StringComparison.OrdinalIgnoreCase) && !JSONFile.EndsWith(".jldr3", StringComparison.OrdinalIgnoreCase)) || JSONFile.EndsWith("_example.jldr", StringComparison.OrdinalIgnoreCase) || JSONFile.EndsWith("_example.jldr2", StringComparison.OrdinalIgnoreCase) || JSONFile.EndsWith("_example.jldr3", StringComparison.OrdinalIgnoreCase))
			{
				return;
			}
			if (Directory.Exists(JSONFile))
			{
				List<string> list = Directory.GetFiles(JSONFile).ToList();
				foreach (string item in list)
				{
					HandleJSONFile(item, plugin);
				}
			}
			if (JSONFile.EndsWith(".jldr", StringComparison.OrdinalIgnoreCase))
			{
				LoadFiles.JLDRFiles.Add((plugin, JSONFile));
			}
			else if (JSONFile.EndsWith(".jldr2", StringComparison.OrdinalIgnoreCase))
			{
				LoadFiles.JLDR2Files.Add((plugin, JSONFile));
			}
			else if (JSONFile.EndsWith(".jldr3", StringComparison.OrdinalIgnoreCase))
			{
				LoadFiles.JLDR3Files.Add((plugin, JSONFile));
			}
			JSONLoader3.FormatLogger("Debug", "FindFiles", "Found File: " + JSONFile + " to load.");
		}

		internal static void HandleCSVFile(string CSVFile, string plugin)
		{
			if (!CSVFile.EndsWith(".csv", StringComparison.OrdinalIgnoreCase) || CSVFile.EndsWith("_example.csv", StringComparison.OrdinalIgnoreCase))
			{
				return;
			}
			if (Directory.Exists(CSVFile))
			{
				List<string> list = Directory.GetFiles(CSVFile).ToList();
				foreach (string item in list)
				{
					HandleCSVFile(item, plugin);
				}
			}
			if (CSVFile.EndsWith(".csv", StringComparison.OrdinalIgnoreCase))
			{
				LoadFiles.CSVFiles.Add((plugin, CSVFile));
			}
			JSONLoader3.FormatLogger("Debug", "FindFiles", "Found File: " + CSVFile + " to load.");
		}

		internal static string FindElementInPath(string fullPath, string toFind)
		{
			string text = fullPath;
			while (!string.IsNullOrEmpty(text))
			{
				string fileName = Path.GetFileName(text);
				if (string.Equals(fileName, toFind, StringComparison.OrdinalIgnoreCase))
				{
					return text;
				}
				text = Path.GetDirectoryName(text);
			}
			return null;
		}
	}
	public class LoadFiles
	{
		internal static List<(string plugin, string file)> JLDRFiles = new List<(string, string)>();

		internal static List<(string plugin, string file)> JLDR2Files = new List<(string, string)>();

		internal static List<(string plugin, string file)> JLDR3Files = new List<(string, string)>();

		internal static List<(string plugin, string file)> CSVFiles = new List<(string, string)>();

		public static void LoadFoundFiles()
		{
			JSONLoader3.FormatLogger("Info", "LoadFiles", "Loading XML Documentation File!!");
			ReadDocumentationFile.FetchDocFile();
			JSONLoader3.FormatLogger("Info", "LoadFiles", "Loading JLDR Files!!");
			foreach (var (item, item2) in JLDRFiles)
			{
				CardUtils.CardsToLoad.Add((item, item2));
			}
			CardUtils.HandleCards();
			JSONLoader3.FormatLogger("Info", "LoadFiles", "Loading JLDR2 Files!!");
			foreach (var (text, text2) in JLDR2Files)
			{
			}
			JSONLoader3.FormatLogger("Info", "LoadFiles", "Loading JLDR3 Files!!");
			foreach (var (text3, text4) in JLDR3Files)
			{
			}
			JSONLoader3.FormatLogger("Info", "LoadFiles", "Loading CSV Files!!");
			foreach (var (text5, text6) in CSVFiles)
			{
			}
		}
	}
}
namespace JSONLoader3.Cores.JSONLoaderV1Support.Utilities
{
	public class CardUtils
	{
		internal static List<(string pluginName, string file)> CardsToLoad = new List<(string, string)>();

		internal static List<CardInfo> allJLDRCards = new List<CardInfo>();

		public static ReadOnlyCollection<CardInfo> allJLDRCardsPublic => allJLDRCards.AsReadOnly();

		public static void HandleCards()
		{
			if (CardsToLoad.Count == 0)
			{
				return;
			}
			JSONLoader3.FormatLogger("Debug", "CardUtils", "Writing JSONLoaderV1's " + typeof(Card).Name + "'s Schema so that we can Lint against it.");
			WriteSchema.WriteJSONSchema<Card>("JSONLoaderV1");
			JSONLoader3.FormatLogger("Debug", "CardUtils", "Loading JSONLoaderV1's " + typeof(Card).Name + "'s Schema so that we can Lint against it.");
			List<string> jSONSchema = LoadSchema.FindAndLoadSchema<Card>("JSONLoaderV1");
			foreach (var (pluginName, text) in CardsToLoad)
			{
				JSONLoader3.FormatLogger("Debug", "CardUtils", "Linting " + text + " against Schema.");
				(List<(int depth, string propertyName, string propertyValue)> validatedJSON, bool check) tuple2 = LintingTools.LintAgainstSchema<Card>(text, jSONSchema, "JSONLoaderV1");
				var (jSONCard, _) = tuple2;
				if (tuple2.check)
				{
					JSONLoader3.FormatLogger("Debug", "CardUtils", "Linting " + text + " against Schema was Successful, attempting to Parse into a JSONLoaderV1's " + typeof(Card).Name + ".");
					Parse(jSONCard, text, pluginName);
				}
			}
		}

		public static void Parse(List<(int depth, string propertyName, string propertyValue)> JSONCard, string file, string pluginName)
		{
			List<string> list = new List<string>();
			string text = string.Empty;
			string text2 = string.Empty;
			string text3 = string.Empty;
			List<string> list2 = new List<string>();
			string text4 = string.Empty;
			string text5 = string.Empty;
			int num = 0;
			int num2 = 0;
			bool flag = false;
			int num3 = 0;
			int num4 = 0;
			int num5 = 0;
			List<string> list3 = new List<string>();
			string text6 = string.Empty;
			List<string> list4 = new List<string>();
			List<string> list5 = new List<string>();
			List<string> list6 = new List<string>();
			List<string> list7 = new List<string>();
			List<global::JSONLoader3.Cores.JSONLoaderV1Support.Objects.AbilityData> list8 = new List<global::JSONLoader3.Cores.JSONLoaderV1Support.Objects.AbilityData>();
			List<global::JSONLoader3.Cores.JSONLoaderV1Support.Objects.SpecialAbilityData> list9 = new List<global::JSONLoader3.Cores.JSONLoaderV1Support.Objects.SpecialAbilityData>();
			global::JSONLoader3.Cores.JSONLoaderV1Support.Objects.EvolveData evolveData = null;
			string text7 = string.Empty;
			global::JSONLoader3.Cores.JSONLoaderV1Support.Objects.TailData tailData = null;
			global::JSONLoader3.Cores.JSONLoaderV1Support.Objects.IceCubeData iceCubeData = null;
			bool flag2 = false;
			bool flag3 = false;
			List<string> list10 = new List<string>();
			string text8 = string.Empty;
			string text9 = string.Empty;
			string text10 = string.Empty;
			string text11 = string.Empty;
			string text12 = string.Empty;
			List<string> list11 = new List<string>();
			foreach (var (num6, text13, text14) in JSONCard)
			{
				JSONLoader3.FormatLogger("Debug", "CardUtils", $"Found {text13} with value of ({text14}), depth of ({num6}) while parsing {typeof(Card).Name}.");
				if (text13 == "fieldsToEdit" && num6 == 1)
				{
					list = (from x in LintingTools.GetArrayItems(text14, text13, file)
						select x.Trim().Trim(new char[1] { '"' }) into x
						where !string.IsNullOrEmpty(x)
						select x).ToList();
					JSONLoader3.FormatLogger("Debug", "CardUtils", "Found " + text13 + " with value of (" + string.Join(", ", list) + ") successfully while parsing " + typeof(Card).Name + " from " + Path.GetFileNameWithoutExtension(pluginName) + " specifically " + Path.GetFileNameWithoutExtension(file) + ".");
				}
				if (text13 == "name" && num6 == 1)
				{
					text = text14.Trim(new char[1] { '"' });
					JSONLoader3.FormatLogger("Debug", "CardUtils", "Found " + text13 + " with value of (" + text + ") successfully while parsing " + typeof(Card).Name + " from " + Path.GetFileNameWithoutExtension(pluginName) + " specifically " + Path.GetFileNameWithoutExtension(file) + ".");
				}
				if (text13 == "displayedName" && num6 == 1)
				{
					text2 = text14.Trim(new char[1] { '"' });
					JSONLoader3.FormatLogger("Debug", "CardUtils", "Found " + text13 + " with value of (" + text2 + ") successfully while parsing " + typeof(Card).Name + " from " + Path.GetFileNameWithoutExtension(pluginName) + " specifically " + Path.GetFileNameWithoutExtension(file) + ".");
				}
				if (text13 == "description" && num6 == 1)
				{
					text3 = text14.Trim(new char[1] { '"' });
					JSONLoader3.FormatLogger("Debug", "CardUtils", "Found " + text13 + " with value of (" + text3 + ") successfully while parsing " + typeof(Card).Name + " from " + Path.GetFileNameWithoutExtension(pluginName) + " specifically " + Path.GetFileNameWithoutExtension(file) + ".");
				}
				if (text13 == "metaCategories" && num6 == 1)
				{
					list2 = (from x in LintingTools.GetArrayItems(text14, text13, file)
						select x.Trim().Trim(new char[1] { '"' }) into x
						where !string.IsNullOrEmpty(x)
						select x).ToList();
					JSONLoader3.FormatLogger("Debug", "CardUtils", "Found " + text13 + " with value of (" + string.Join(", ", list2) + ") successfully while parsing " + typeof(Card).Name + " from " + Path.GetFileNameWithoutExtension(pluginName) + " specifically " + Path.GetFileNameWithoutExtension(file) + ".");
				}
				if (text13 == "cardComplexity" && num6 == 1)
				{
					text4 = text14.Trim(new char[1] { '"' });
					JSONLoader3.FormatLogger("Debug", "CardUtils", "Found " + text13 + " with value of (" + text4 + ") successfully while parsing " + typeof(Card).Name + " from " + Path.GetFileNameWithoutExtension(pluginName) + " specifically " + Path.GetFileNameWithoutExtension(file) + ".");
				}
				if (text13 == "temple" && num6 == 1)
				{
					text5 = text14.Trim(new char[1] { '"' });
					JSONLoader3.FormatLogger("Debug", "CardUtils", "Found " + text13 + " with value of (" + text5 + ") successfully while parsing " + typeof(Card).Name + " from " + Path.GetFileNameWithoutExtension(pluginName) + " specifically " + Path.GetFileNameWithoutExtension(file) + ".");
				}
				if (text13 == "baseAttack" && num6 == 1)
				{
					num = int.Parse(text14);
					JSONLoader3.FormatLogger("Debug", "CardUtils", $"Found {text13} with value of ({num}) successfully while parsing {typeof(Card).Name} from {Path.GetFileNameWithoutExtension(pluginName)} specifically {Path.GetFileNameWithoutExtension(file)}.");
				}
				if (text13 == "baseHealth" && num6 == 1)
				{
					num2 = int.Parse(text14);
					JSONLoader3.FormatLogger("Debug", "CardUtils", $"Found {text13} with value of ({num2}) successfully while parsing {typeof(Card).Name} from {Path.GetFileNameWithoutExtension(pluginName)} specifically {Path.GetFileNameWithoutExtension(file)}.");
				}
				if (text13 == "hideAttackAndHealth" && num6 == 1)
				{
					flag = bool.Parse(text14);
					JSONLoader3.FormatLogger("Debug", "CardUtils", $"Found {text13} with value of ({flag}) successfully while parsing {typeof(Card).Name} from {Path.GetFileNameWithoutExtension(pluginName)} specifically {Path.GetFileNameWithoutExtension(file)}.");
				}
				if (text13 == "bloodCost" && num6 == 1)
				{
					num3 = int.Parse(text14);
					JSONLoader3.FormatLogger("Debug", "CardUtils", $"Found {text13} with value of ({num3}) successfully while parsing {typeof(Card).Name} from {Path.GetFileNameWithoutExtension(pluginName)} specifically {Path.GetFileNameWithoutExtension(file)}.");
				}
				if (text13 == "bonesCost" && num6 == 1)
				{
					num4 = int.Parse(text14);
					JSONLoader3.FormatLogger("Debug", "CardUtils", $"Found {text13} with value of ({num4}) successfull