public override void Add(string aKey, KnetikJSONNode aItem) { var tmp = new KnetikJSONClass(); tmp.Add(aKey, aItem); Set(tmp); }
public static KnetikJSONNode Deserialize(System.IO.BinaryReader aReader) { KnetikJSONBinaryTag type = (KnetikJSONBinaryTag)aReader.ReadByte(); switch(type) { case KnetikJSONBinaryTag.Array: { int count = aReader.ReadInt32(); KnetikJSONArray tmp = new KnetikJSONArray(); for(int i = 0; i < count; i++) tmp.Add(Deserialize(aReader)); return tmp; } case KnetikJSONBinaryTag.Class: { int count = aReader.ReadInt32(); KnetikJSONClass tmp = new KnetikJSONClass(); for(int i = 0; i < count; i++) { string key = aReader.ReadString(); var val = Deserialize(aReader); tmp.Add(key, val); } return tmp; } case KnetikJSONBinaryTag.Value: { return new KnetikJSONData(aReader.ReadString()); } case KnetikJSONBinaryTag.IntValue: { return new KnetikJSONData(aReader.ReadInt32()); } case KnetikJSONBinaryTag.DoubleValue: { return new KnetikJSONData(aReader.ReadDouble()); } case KnetikJSONBinaryTag.BoolValue: { return new KnetikJSONData(aReader.ReadBoolean()); } case KnetikJSONBinaryTag.FloatValue: { return new KnetikJSONData(aReader.ReadSingle()); } default: { throw new Exception("Error deserializing JSON. Unknown tag: " + type); } } }
public override KnetikJSONNode this[string aKey] { get { return new KnetikJSONLazyCreator(this, aKey); } set { var tmp = new KnetikJSONClass(); tmp.Add(aKey, value); Set(tmp); } }