Пример #1
0
 public JSONObject(Object obj, JSONObjectType type, string name = null) {
     ObjectType = type;
     Object = obj;
     if (name != null) {
         Name = name;
     }
 }
Пример #2
0
 public JSONObject(Object obj, JSONObjectType type, string name = null)
 {
     ObjectType = type;
     Object     = obj;
     if (name != null)
     {
         Name = name;
     }
 }
Пример #3
0
 protected void PushDataStructure(Object obj, JSONObjectType type)
 {
     _currentDataStructure = new JSONObject(obj, type);
     if (_inValue)
     {
         _currentDataStructure.Name = _dataStructureName;
     }
     _dataStructureStack.Push(_currentDataStructure);
 }
Пример #4
0
 protected void Push(Char[] characters, JSONObjectType type)
 {
     if (_accumulatorIndex > 0)
     {
         _accumulator[_accumulatorIndex] = (Char)0;
         _stack.Push(new JSONObject(new string(characters, 0, _accumulatorIndex), type));
         _accumulatorIndex = 0;
     }
 }
 protected void PushDataStructure(Object obj, JSONObjectType type)
 {
     _currentDataStructure = new JSONObject(obj, type);
     if (_inValue)
     {
         _currentDataStructure.Name = _dataStructureName;
     }
     _dataStructureStack.Push(_currentDataStructure);
 }
Пример #6
0
 protected void Push(Char[] characters, JSONObjectType type)
 {
     if (_accumulatorIndex > 0) {
         _accumulator[_accumulatorIndex] = (Char)0;
         _stack.Push(new JSONObject(new string(characters, 0, _accumulatorIndex), type));
         _accumulatorIndex = 0;
     }
 }
Пример #7
0
 protected void Push(Object obj, JSONObjectType type)
 {
     _stack.Push(new JSONObject(obj, type));
 }
Пример #8
0
 public JSONObject(Object obj, JSONObjectType type)
 {
     ObjectType = type;
     Object = obj;
 }
Пример #9
0
        public static JSONNode Deserialize(System.IO.BinaryReader aReader)
        {
            JSONObjectType type = (JSONObjectType)aReader.ReadByte();

            switch (type)
            {
            case JSONObjectType.Array:
            {
                int       count = aReader.ReadInt32();
                JSONArray tmp   = new JSONArray();
                for (int i = 0; i < count; i++)
                {
                    tmp.Add(Deserialize(aReader));
                }
                return(tmp);
            }

            case JSONObjectType.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 JSONObjectType.Value:
            {
                return(new JSONData(aReader.ReadString()));
            }

            case JSONObjectType.IntValue:
            {
                return(new JSONData(aReader.ReadInt32()));
            }

            case JSONObjectType.DoubleValue:
            {
                return(new JSONData(aReader.ReadDouble()));
            }

            case JSONObjectType.BoolValue:
            {
                return(new JSONData(aReader.ReadBoolean()));
            }

            case JSONObjectType.FloatValue:
            {
                return(new JSONData(aReader.ReadSingle()));
            }

            default:
            {
                throw new Exception("Error deserializing JSON. Unknown tag: " + type);
            }
            }
        }
Пример #10
0
 public JSONObject(Object obj, JSONObjectType type)
 {
     ObjectType = type;
     Object     = obj;
 }
Пример #11
0
 protected void Push(Object obj, JSONObjectType type)
 {
     _stack.Push(new JSONObject(obj, type));
 }