C# Класс Poonya.Utils.Json

Provides functions for encoding and decoding files in the JSON format.
Показать файл Открыть проект

Открытые методы

Метод Описание
Decode ( byte sjson ) : object

Decodes a JSON bytestream into a hash table with numbers, bools, strings, ArrayLists and Hashtables.

Encode ( object t ) : string

Encodes the hashtable t in the JSON format. The hash table can contain, numbers, bools, strings, ArrayLists and Hashtables.

Load ( string path ) : Hashtable

Convenience function for loading a file.

Save ( Hashtable h, string path ) : void

Convenience function for saving a file.

Write ( object o, StringBuilder builder, int indentation ) : void

Writes a generic object.

WriteArray ( System.Collections.ArrayList a, StringBuilder builder, int indentation ) : void

Writes an array of items.

WriteNewLine ( StringBuilder builder, int indentation ) : void

Writes a newline and the desired ammount of indentation.

WriteObject ( System.Collections.Hashtable t, StringBuilder builder, int indentation ) : void

Writes a JSON object.

WriteObjectField ( System.Collections.Hashtable t, string key, bool write_comma, StringBuilder builder, int indentation ) : void

Writes a particular field in a JSON object.

WriteObjectFields ( System.Collections.Hashtable t, StringBuilder builder, int indentation ) : void

Writes all the fields of a JSON object.

WriteString ( String s, StringBuilder builder ) : void

Writes a string.

Приватные методы

Метод Описание
AtEnd ( byte json, int &index ) : bool
Consume ( byte json, int &index, String consume ) : void
Next ( byte json, int &index ) : byte
Parse ( byte json, int &index ) : object
ParseArray ( byte json, int &index ) : ArrayList
ParseBinary ( byte json, int &index ) : byte[]
ParseNumber ( byte json, int &index ) : Double
ParseObject ( byte json, int &index ) : Hashtable
ParseString ( byte json, int &index ) : String
SkipWhitespace ( byte json, int &index ) : void

Описание методов

Decode() публичный статический Метод

Decodes a JSON bytestream into a hash table with numbers, bools, strings, ArrayLists and Hashtables.
public static Decode ( byte sjson ) : object
sjson byte
Результат object

Encode() публичный статический Метод

Encodes the hashtable t in the JSON format. The hash table can contain, numbers, bools, strings, ArrayLists and Hashtables.
public static Encode ( object t ) : string
t object
Результат string

Load() публичный статический Метод

Convenience function for loading a file.
public static Load ( string path ) : Hashtable
path string
Результат Hashtable

Save() публичный статический Метод

Convenience function for saving a file.
public static Save ( Hashtable h, string path ) : void
h Hashtable
path string
Результат void

Write() публичный статический Метод

Writes a generic object.
public static Write ( object o, StringBuilder builder, int indentation ) : void
o object
builder StringBuilder
indentation int
Результат void

WriteArray() публичный статический Метод

Writes an array of items.
public static WriteArray ( System.Collections.ArrayList a, StringBuilder builder, int indentation ) : void
a System.Collections.ArrayList
builder StringBuilder
indentation int
Результат void

WriteNewLine() публичный статический Метод

Writes a newline and the desired ammount of indentation.
public static WriteNewLine ( StringBuilder builder, int indentation ) : void
builder StringBuilder
indentation int
Результат void

WriteObject() публичный статический Метод

Writes a JSON object.
public static WriteObject ( System.Collections.Hashtable t, StringBuilder builder, int indentation ) : void
t System.Collections.Hashtable
builder StringBuilder
indentation int
Результат void

WriteObjectField() публичный статический Метод

Writes a particular field in a JSON object.
public static WriteObjectField ( System.Collections.Hashtable t, string key, bool write_comma, StringBuilder builder, int indentation ) : void
t System.Collections.Hashtable
key string
write_comma bool
builder StringBuilder
indentation int
Результат void

WriteObjectFields() публичный статический Метод

Writes all the fields of a JSON object.
public static WriteObjectFields ( System.Collections.Hashtable t, StringBuilder builder, int indentation ) : void
t System.Collections.Hashtable
builder StringBuilder
indentation int
Результат void

WriteString() публичный статический Метод

Writes a string.
public static WriteString ( String s, StringBuilder builder ) : void
s String
builder StringBuilder
Результат void