C# Class MyJsonBinary

Datei anzeigen Open project: lightszero/EgretUnity

Public Methods

Method Description
Read ( System stream, IList pubdict = null ) : MyJson.IJsonNode

从二进制流读取Json

ReadStrDict ( System stream ) : List
Write ( System stream, MyJson node, IList pubdict = null, bool riseDictByKey = false, bool riseDictByString = false ) : void

从json写入二进制流

WriteStrDict ( System stream, IList dict ) : void

Private Methods

Method Description
GetFreeKey ( IList dict ) : int
GetKey ( IList dict, string value ) : int
MakeArrayTag ( int arraycount, int bytelen ) : byte
MakeNumberTag ( bool isFloat, bool isBool, bool isNull, bool isNeg, int datalength ) : byte
MakeObjectTag ( int arraycount, int bytelen ) : byte
MakeStringTag ( bool inDict, bool isPubDict, int keylength ) : byte
PackJson ( System stream, MyJson node, IList pubdict, IList localdict, bool riseDictByKey, bool riseDictByString ) : void
PackJsonArray ( System stream, MyJson array, IList pubdict, IList localdict, bool riseDictByKey, bool riseDictByString ) : void
PackJsonNumber ( System stream, MyJson number ) : void
PackJsonObject ( System stream, MyJson _object, IList pubdict, IList localdict, bool riseDictByKey, bool riseDictByString ) : void
PackJsonString ( System stream, string str, IList pubdict, IList localdict, bool riseDictByString ) : void
ReadCountHead ( System stream, byte tagfirst ) : int
ReadIntSingle ( System stream ) : int
ReadString ( System stream, byte tagfirst, IList pubdict, IList localdict ) : string
UnPackJson ( System stream, IList pubdict, IList localdict ) : MyJson.IJsonNode
UnPackJsonArray ( System stream, byte tagfirst, IList pubdict, IList localdict ) : MyJson.IJsonNode
UnPackJsonNumber ( System stream, byte tagfirst ) : MyJson.IJsonNode
UnPackJsonObject ( System stream, byte tagfirst, IList pubdict, IList localdict ) : MyJson.IJsonNode
UnPackJsonString ( System stream, byte tagfirst, IList pubdict, IList localdict ) : MyJson.IJsonNode
WriteArrayCountHead ( System stream, int arraycount ) : void
WriteFloatData ( System stream, float number ) : void
WriteIntData ( System stream, int number ) : void
WriteObjectCountHead ( System stream, int arraycount ) : void
WriteStringDataDict ( System stream, bool isPubDict, int pid ) : void
WriteStringDataDirect ( System stream, string str ) : void
WriteUIntSingle ( System stream, int number ) : void

Method Details

Read() public static method

从二进制流读取Json
public static Read ( System stream, IList pubdict = null ) : MyJson.IJsonNode
stream System 二进制流
pubdict IList 一个字符串字典(可选),如果保存的时候用了字典,解压就得用那个字典
return MyJson.IJsonNode

ReadStrDict() public static method

public static ReadStrDict ( System stream ) : List
stream System
return List

Write() public static method

从json写入二进制流
public static Write ( System stream, MyJson node, IList pubdict = null, bool riseDictByKey = false, bool riseDictByString = false ) : void
stream System 二进制流
node MyJson json
pubdict IList 一个字符串字典(可选)如果字典里有的字符串,保存只记录一个索引,但是需要字典才能读出来
riseDictByKey bool 是否把key添加到字典中(默认为false)
riseDictByString bool 是否把String值添加到字典中(默认为false)
return void

WriteStrDict() public static method

public static WriteStrDict ( System stream, IList dict ) : void
stream System
dict IList
return void