in Scripts/Runtime/Lib/WitResponse.cs [576:628]
public static WitResponseNode Deserialize(System.IO.BinaryReader aReader)
{
JSONBinaryTag type = (JSONBinaryTag) aReader.ReadByte();
switch (type)
{
case JSONBinaryTag.Array:
{
int count = aReader.ReadInt32();
WitResponseArray tmp = new WitResponseArray();
for (int i = 0; i < count; i++)
tmp.Add(Deserialize(aReader));
return tmp;
}
case JSONBinaryTag.Class:
{
int count = aReader.ReadInt32();
WitResponseClass tmp = new WitResponseClass();
for (int i = 0; i < count; i++)
{
string key = aReader.ReadString();
var val = Deserialize(aReader);
tmp.Add(key, val);
}
return tmp;
}
case JSONBinaryTag.Value:
{
return new WitResponseData(aReader.ReadString());
}
case JSONBinaryTag.IntValue:
{
return new WitResponseData(aReader.ReadInt32());
}
case JSONBinaryTag.DoubleValue:
{
return new WitResponseData(aReader.ReadDouble());
}
case JSONBinaryTag.BoolValue:
{
return new WitResponseData(aReader.ReadBoolean());
}
case JSONBinaryTag.FloatValue:
{
return new WitResponseData(aReader.ReadSingle());
}
default:
{
throw new JSONParseException("Error deserializing JSON. Unknown tag: " + type);
}
}
}