Ejemplo n.º 1
0
		public override JSONNode this [string aKey] {
			get {
				return new JSONLazyCreator (this, aKey);
			}
			set {
				var tmp = new JSONClass ();
				tmp.Add (aKey, value);
				Set (tmp);
			}
		}
Ejemplo n.º 2
0
		public override void Add (string aKey, JSONNode aItem)
		{
			var tmp = new JSONClass ();
			tmp.Add (aKey, aItem);
			Set (tmp);
		}
Ejemplo n.º 3
0
		public static JSONNode Deserialize (System.IO.BinaryReader aReader)
		{
			JSONBinaryTag type = (JSONBinaryTag)aReader.ReadByte ();
			switch (type) {
			case JSONBinaryTag.Array:
				{
					int count = aReader.ReadInt32 ();
					JSONArray tmp = new JSONArray ();
					for (int i = 0; i < count; i++)
						tmp.Add (Deserialize (aReader));
					return tmp;
				}
			case JSONBinaryTag.Class:
				{
					int count = aReader.ReadInt32 ();                
					JSONClass tmp = new JSONClass ();
					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 JSONData (aReader.ReadString ());
				}
			case JSONBinaryTag.IntValue:
				{
					return new JSONData (aReader.ReadInt32 ());
				}
			case JSONBinaryTag.DoubleValue:
				{
					return new JSONData (aReader.ReadDouble ());
				}
			case JSONBinaryTag.BoolValue:
				{
					return new JSONData (aReader.ReadBoolean ());
				}
			case JSONBinaryTag.FloatValue:
				{
					return new JSONData (aReader.ReadSingle ());
				}
				
			default:
				{
					throw new Exception ("Error deserializing JSON. Unknown tag: " + type);
				}
			}
		}