Insanely huge initial commit

This commit is contained in:
2026-02-21 17:04:05 -08:00
parent 9cdd36191a
commit 613d75914a
22525 changed files with 4035207 additions and 0 deletions

View File

@@ -0,0 +1,54 @@
// DeserializeException
using System;
using Leguar.TotalJSON.Internal;
namespace Leguar.TotalJSON {
/// <summary>
/// Exception that is thrown if something goes wrong when deserializing JSON to objects.
/// </summary>
public class DeserializeException : ArgumentException {
private DeserializeException(string message) : base(message) {
}
public override string StackTrace {
get {
return InternalTools.getCleanedStackTrace(base.StackTrace);
}
}
internal static DeserializeException forDictionaryKeyTypeNotString(Type type, string toFieldName) {
string fullMessage = "Can not deserialize to dictionary where key type is '"+type.GetType()+"'"+getToFieldNameString(toFieldName)+". Key type need to be string, or allow more loose options using DeserializeSettings";
return (new DeserializeException(fullMessage));
}
internal static DeserializeException forDictionaryKeyTypeNotKnown(Type type, string toFieldName) {
string fullMessage = "Can not deserialize to dictionary where key type is '"+type.GetType()+"'"+getToFieldNameString(toFieldName)+". Key type is none of the supported";
return (new DeserializeException(fullMessage));
}
internal static DeserializeException forNonMatchingType(JValue jValue, Type type, string toFieldName) {
string fullMessage = "Can not deserialize '"+jValue.GetType()+"' to object which type is '"+type+"'"+getToFieldNameString(toFieldName);
return (new DeserializeException(fullMessage));
}
internal static DeserializeException forNoMatchingField(string fieldName, Type type) {
string fullMessage = "Can't find field named '"+fieldName+"' needed for object type '"+type+"'. Values for all fields need to exist, or allow more loose options using DeserializeSettings";
return (new DeserializeException(fullMessage));
}
internal static DeserializeException forNoMatchingValue(Type type) {
string fullMessage = "Not all JSON values were used when populating object type '"+type+"'. Used DeserializeSettings requires that all fields are used";
return (new DeserializeException(fullMessage));
}
private static string getToFieldNameString(string toFieldName) {
return (string.IsNullOrEmpty(toFieldName) ? "" : " (field \""+toFieldName+"\")");
}
}
}

View File

@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: d739cecfd5833dc42bd95ea1ee004e93
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,26 @@
// JArgumentException
using System;
using Leguar.TotalJSON.Internal;
namespace Leguar.TotalJSON {
/// <summary>
/// Exception that is thrown if some JSON, JArray or JNumber parameter is invalid.
/// </summary>
public class JArgumentException : ArgumentException {
internal JArgumentException(string message, string paramName)
: base(message,paramName) {
}
public override string StackTrace {
get {
return InternalTools.getCleanedStackTrace(base.StackTrace);
}
}
}
}

View File

@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 4da601bc20dfdc642ad5c19464fb980a
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,26 @@
// JArgumentNullException
using System;
using Leguar.TotalJSON.Internal;
namespace Leguar.TotalJSON {
/// <summary>
/// Exception that is thrown if some JSON, JArray or JString parameter is null when it is not allowed to be null.
/// </summary>
public class JArgumentNullException : ArgumentNullException {
internal JArgumentNullException(string paramName, string message)
: base(paramName,message) {
}
public override string StackTrace {
get {
return InternalTools.getCleanedStackTrace(base.StackTrace);
}
}
}
}

View File

@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: c292f493140d1f6409bd3f0d25242435
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,26 @@
// JArrayIndexOutOfRangeException
using System;
using Leguar.TotalJSON.Internal;
namespace Leguar.TotalJSON {
/// <summary>
/// Exception that is thrown if some JArray method parameter is out of range.
/// </summary>
public class JArrayIndexOutOfRangeException : ArgumentOutOfRangeException {
internal JArrayIndexOutOfRangeException(string paramName, int actualValue, string message)
: base(paramName,actualValue,message) {
}
public override string StackTrace {
get {
return InternalTools.getCleanedStackTrace(base.StackTrace);
}
}
}
}

View File

@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 3c678893eebfa4b4f955712f5da64aa8
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,30 @@
// JNumberFormatException
using System;
using Leguar.TotalJSON.Internal;
namespace Leguar.TotalJSON {
/// <summary>
/// Exception that is thrown if trying to read JNumber value in wrong format, for example float as int.
/// </summary>
public class JNumberFormatException : FormatException {
internal JNumberFormatException(string valueAsString, string wantedType)
: base("JNumber value ("+valueAsString+") is floating point number and can't be returned as "+wantedType) {
}
internal JNumberFormatException(string valueAsString)
: base("JNumber value ("+valueAsString+") is not valid decimal number") { // (contains E/e notation, consider reading this value as double or float)
}
public override string StackTrace {
get {
return InternalTools.getCleanedStackTrace(base.StackTrace);
}
}
}
}

View File

@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 969a97261570e1e4697cb1fa851fe6ec
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,26 @@
// JNumberOverflowException
using System;
using Leguar.TotalJSON.Internal;
namespace Leguar.TotalJSON {
/// <summary>
/// Exception that is thrown if trying to read JNumber value in format where it doesn't fit. For example trying to read number 2147483648 as int.
/// </summary>
public class JNumberOverflowException : OverflowException {
internal JNumberOverflowException(string valueAsString, string wantedType, string minValue, string maxValue)
: base("JNumber value ("+valueAsString+") is outside "+wantedType+" range ["+minValue+".."+maxValue+"]") {
}
public override string StackTrace {
get {
return InternalTools.getCleanedStackTrace(base.StackTrace);
}
}
}
}

View File

@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: f205c82ee9338384c8f040c98dabc3de
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,26 @@
// JSONKeyAlreadyExistsException
using System;
using Leguar.TotalJSON.Internal;
namespace Leguar.TotalJSON {
/// <summary>
/// Exception that is thrown if JSON already contains certain key and trying to add it again.
/// </summary>
public class JSONKeyAlreadyExistsException : ArgumentException {
internal JSONKeyAlreadyExistsException(string message)
: base(message,"key") {
}
public override string StackTrace {
get {
return InternalTools.getCleanedStackTrace(base.StackTrace);
}
}
}
}

View File

@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 77652c275db7f6047830bf596953706c
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,26 @@
// JSONKeyNotFoundException
using System.Collections.Generic;
using Leguar.TotalJSON.Internal;
namespace Leguar.TotalJSON {
/// <summary>
/// Exception that is thrown if given parameter key doesn't exist in JSON.
/// </summary>
public class JSONKeyNotFoundException : KeyNotFoundException {
internal JSONKeyNotFoundException(string message)
: base(message) {
}
public override string StackTrace {
get {
return InternalTools.getCleanedStackTrace(base.StackTrace);
}
}
}
}

View File

@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: e47b0f3992e0232419eac53940948159
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,30 @@
// JValueNullException
using System;
using Leguar.TotalJSON.Internal;
namespace Leguar.TotalJSON {
/// <summary>
/// Exception thrown if trying to read value which is null while that is not allowed.
/// </summary>
public class JValueNullException : JValueTypeException {
internal JValueNullException(string key, string triedType, string exceptionMessageTail)
: base("Can not read value mapped to key \""+key+"\" as "+triedType+", value is null"+exceptionMessageTail) {
}
internal JValueNullException(int index, string triedType)
: base("Can not read value at index "+index+" as "+triedType+", value is null") {
}
public override string StackTrace {
get {
return InternalTools.getCleanedStackTrace(base.StackTrace);
}
}
}
}

View File

@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 43ec8a0036358ec41b40c1a534330183
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,34 @@
// JValueTypeException
using System;
using Leguar.TotalJSON.Internal;
namespace Leguar.TotalJSON {
/// <summary>
/// Exception thrown if trying to read value which is different type than requested. For example trying to read bool (JBoolean) as string (JString).
/// </summary>
public class JValueTypeException : InvalidCastException {
internal JValueTypeException(string key, JValue realValue, string triedType, string exceptionMessageTail)
: base("Can not cast value mapped to key \""+key+"\" to "+triedType+", value type is "+realValue.GetType()+exceptionMessageTail) {
}
internal JValueTypeException(int arrayIndex, JValue realValue, string triedType)
: base("Can not cast array element at index "+arrayIndex+" to "+triedType+", element type is "+realValue.GetType()) {
}
protected JValueTypeException(string message)
: base(message) {
}
public override string StackTrace {
get {
return InternalTools.getCleanedStackTrace(base.StackTrace);
}
}
}
}

View File

@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: dd4e8553edfa51747a9f603037136b60
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,72 @@
// ParseException
using System;
using Leguar.TotalJSON.Internal;
namespace Leguar.TotalJSON {
/// <summary>
/// Exception thrown if parsing string to JSON or JArray fails.
/// </summary>
public class ParseException : ArgumentException {
private ParseException(string message) : base(message) {
}
internal static ParseException forEmpty(String message, ParseStringSettings parseStrignSettings) {
string fullMessage=message+getExceptionMessageTail(parseStrignSettings);
return (new ParseException(fullMessage));
}
internal static ParseException forInvalidStart(String message, ParseStringRunner parseStrignRunner) {
StringPointer sp=parseStrignRunner.getStringPointer();
string fullMessage=message+" - "+sp.getLineAndColumnForException()+getExceptionMessageTail(parseStrignRunner);
return (new ParseException(fullMessage));
}
internal static ParseException forInvalidCharacter(String message, ParseStringRunner parseStrignRunner) {
StringPointer sp=parseStrignRunner.getStringPointer();
string fullMessage=message+" - "+sp.getLineAndColumnForException()+", near: "+sp.getSubStringForException(32)+getExceptionMessageTail(parseStrignRunner);
return (new ParseException(fullMessage));
}
internal static ParseException forInvalidEnd(ParseStringRunner parseStrignRunner) {
StringPointer sp=parseStrignRunner.getStringPointer();
string fullMessage="Unexpected end of input - "+sp.getLineAndColumnForException()+", near: "+sp.getSubStringForException(16)+getExceptionMessageTail(parseStrignRunner);
return (new ParseException(fullMessage));
}
internal static ParseException forCharactersAfterEnd(ParseStringRunner parseStrignRunner) {
StringPointer sp=parseStrignRunner.getStringPointer();
string fullMessage="Unexpected non-white character after end of object - "+sp.getLineAndColumnForException()+", near: "+sp.getSubStringForException(32)+getExceptionMessageTail(parseStrignRunner);
return (new ParseException(fullMessage));
}
private static string getExceptionMessageTail(ParseStringRunner parseStringRunner) {
if (parseStringRunner!=null) {
return getExceptionMessageTailForID(parseStringRunner.getParseDebugIDForExceptions());
}
return getExceptionMessageTailForID(null);
}
internal static string getExceptionMessageTail(ParseStringSettings parseStringSettings) {
if (parseStringSettings!=null) {
return getExceptionMessageTailForID(parseStringSettings.DebugIDForExceptions);
}
return getExceptionMessageTailForID(null);
}
internal static string getExceptionMessageTailForID(string debugIDForExceptions) {
return InternalTools.getExceptionMessageTailForID(debugIDForExceptions,"Parse");
}
public override string StackTrace {
get {
return InternalTools.getCleanedStackTrace(base.StackTrace);
}
}
}
}

View File

@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 9e4ae93c61b48af488cbf680e3f56180
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,25 @@
// ProtectedException
using System;
using Leguar.TotalJSON.Internal;
namespace Leguar.TotalJSON {
/// <summary>
/// Exception thrown if trying to change anything in protected JSON or JArray objects.
/// </summary>
public class ProtectedException : Exception {
internal ProtectedException(string message) : base(message) {
}
public override string StackTrace {
get {
return InternalTools.getCleanedStackTrace(base.StackTrace);
}
}
}
}

View File

@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 336cc7907a0696743b7748f5af9b05bc
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,34 @@
// SerializeException
using System;
using Leguar.TotalJSON.Internal;
namespace Leguar.TotalJSON {
/// <summary>
/// Exception that is thrown if something goes wrong when serializing system objects to JSON.
/// </summary>
public class SerializeException : ArgumentException {
internal SerializeException(string message)
: base(message) {
}
internal SerializeException(string message, object problemObject)
: base(message+", object type = "+problemObject.GetType()) {
}
internal SerializeException(string message, object problemObject, string paramName)
: base(message+", object type = "+problemObject.GetType(),paramName) {
}
public override string StackTrace {
get {
return InternalTools.getCleanedStackTrace(base.StackTrace);
}
}
}
}

View File

@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: d56315144217402429d47a7e5eeceb95
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,26 @@
// JArgumentNullException
using System;
using Leguar.TotalJSON.Internal;
namespace Leguar.TotalJSON {
/// <summary>
/// Exception that is thrown if object added to JSON or JArray is type that can't be converted to any JValue.
/// </summary>
public class UnknownObjectTypeException : JArgumentException {
internal UnknownObjectTypeException(object unknownValue, string paramName)
: base("Parameter object is unknown type '"+unknownValue.GetType().ToString()+"'",paramName) {
}
public override string StackTrace {
get {
return InternalTools.getCleanedStackTrace(base.StackTrace);
}
}
}
}

View File

@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 951941f4547f23840810348b4969ba00
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: