Table of Contents

Class JsonUtility

Namespace
Uncreated.Warfare.Util
Assembly
Uncreated.Warfare.dll
public static class JsonUtility
Inheritance
JsonUtility
Inherited Members

Methods

ReadFileSkipBOM(string, out Utf8JsonReader, JsonReaderOptions)

Reads all bytes from a file and creates a Utf8JsonReader from the file contents, skipping the UTF-8 BOM if it is present.

public static void ReadFileSkipBOM(string fileName, out Utf8JsonReader reader, JsonReaderOptions options)

Parameters

fileName string
reader Utf8JsonReader
options JsonReaderOptions

Exceptions

FileNotFoundException
PathTooLongException
DirectoryNotFoundException
IOException
UnauthorizedAccessException
NotSupportedException
SecurityException

ReadTopLevelProperties(ref Utf8JsonReader, ReadTopLevelPropertiesHandler<object?>?)

Find all top-level properties on the current object.

public static int ReadTopLevelProperties(ref Utf8JsonReader reader, JsonUtility.ReadTopLevelPropertiesHandler<object?>? action)

Parameters

reader Utf8JsonReader
action JsonUtility.ReadTopLevelPropertiesHandler<object>

Returns

int

ReadTopLevelProperties<TState>(ref Utf8JsonReader, ref TState, ReadTopLevelPropertiesHandler<TState>?)

Find all top-level properties on the current object.

public static int ReadTopLevelProperties<TState>(ref Utf8JsonReader reader, ref TState state, JsonUtility.ReadTopLevelPropertiesHandler<TState>? action)

Parameters

reader Utf8JsonReader
state TState
action JsonUtility.ReadTopLevelPropertiesHandler<TState>

Returns

int

Type Parameters

TState

SkipToProperty(ref Utf8JsonReader, string, bool)

Find the first, next property matching the given the propertyName.

public static bool SkipToProperty(ref Utf8JsonReader reader, string propertyName, bool ignoreCase = true)

Parameters

reader Utf8JsonReader
propertyName string
ignoreCase bool

Returns

bool

true if the value was found, otherwise false.

Remarks

After calling this method, you can use .GetValue() on the reader.

StartIndenting(Utf8JsonWriter)

Starts indenting until disposed. Use this with a using statement.

public static JsonIndent StartIndenting(this Utf8JsonWriter writer)

Parameters

writer Utf8JsonWriter

Returns

JsonIndent

StopIndenting(Utf8JsonWriter)

Stops indenting until disposed. Use this with a using statement.

public static JsonIndent StopIndenting(this Utf8JsonWriter writer)

Parameters

writer Utf8JsonWriter

Returns

JsonIndent