Read() public méthode

Reads the next node from the stream.
public Read ( string path ) : bool
path string
Résultat bool
        private object Read(JsonReader reader, IJsonSerializeOperationInfo info, string path)
        {
            if (reader.NodeType == JsonNodeType.Null)
            {
                return null;
            }

            var list = _createList();

            if (reader.PeekContent() == JsonNodeType.CloseArray)
            {
                // If the next content node is CloseArray, we're reading an empty
                // array. Read the CloseArray node and return the empty list.
                reader.Read(path);
                return _transformList(list);
            }

            var index = 0;

            while (true)
            {
                var item = _itemSerializer.DeserializeObject(reader, info, path + "[" + index++ + "]");
                _addItem(list, item);

                if (!reader.ReadContent(path))
                {
                    Debug.Assert(reader.NodeType == JsonNodeType.EndOfString);

                    throw new MalformedDocumentException(MalformedDocumentError.ArrayMissingCommaOrCloseSquareBracket,
                        path, reader.Line, reader.Position);
                }

                if (reader.NodeType == JsonNodeType.CloseArray)
                {
                    break;
                }

                if (reader.NodeType != JsonNodeType.ItemSeparator)
                {
                    throw new MalformedDocumentException(MalformedDocumentError.ArrayMissingCommaOrCloseSquareBracket,
                        path, reader.Value, reader.Line, reader.Position);
                }
            }

            return _transformList(list);
        }
        private object Read(JsonReader reader, IJsonSerializeOperationInfo info)
        {
            if (reader.NodeType == JsonNodeType.Null)
            {
                return null;
            }

            var list = _createList();

            while (true)
            {
                if (reader.PeekNextNodeType() == JsonNodeType.CloseArray)
                {
                    // If the next content is CloseArray, read it and return the empty list.
                    reader.Read();
                    return list;
                }

                var item = _itemSerializer.DeserializeObject(reader, info);
                _addItem(list, item);

                if (!reader.ReadContent())
                {
                    throw new XSerializerException("Unexpected end of input while attempting to parse ',' character.");
                }

                if (reader.NodeType == JsonNodeType.CloseArray)
                {
                    break;
                }

                if (reader.NodeType != JsonNodeType.ItemSeparator)
                {
                    throw new XSerializerException("Unexpected node type found while attempting to parse ',' character: " +
                                                   reader.NodeType + ".");
                }
            }

            return list;
        }
        private object DeserializeJsonArray(JsonReader reader, IJsonSerializeOperationInfo info, string path)
        {
            var jsonArray = new JsonArray(info);

            if (reader.PeekContent() == JsonNodeType.CloseArray)
            {
                // If the next content node is CloseArray, we're reading an empty
                // array. Read the CloseArray node and return the empty array.
                reader.Read(path);
                return jsonArray;
            }

            var index = 0;

            while (true)
            {
                jsonArray.Add(DeserializeObject(reader, info, path + "[" + index++ + "]"));

                if (!reader.ReadContent(path))
                {
                    throw new MalformedDocumentException(MalformedDocumentError.ArrayMissingCommaOrCloseSquareBracket,
                        path, reader.Line, reader.Position);
                }

                if (reader.NodeType == JsonNodeType.CloseArray)
                {
                    break;
                }

                if (reader.NodeType != JsonNodeType.ItemSeparator)
                {
                    throw new MalformedDocumentException(MalformedDocumentError.ArrayMissingCommaOrCloseSquareBracket,
                        path, reader.Line, reader.Position);
                }
            }

            return jsonArray;
        }
        private object DeserializeJsonArray(JsonReader reader, IJsonSerializeOperationInfo info)
        {
            var jsonArray = new JsonArray(info);

            while (true)
            {
                if (reader.PeekNextNodeType() == JsonNodeType.CloseArray)
                {
                    // If the next content is CloseArray, read it and return the empty list.
                    reader.Read();
                    return jsonArray;
                }

                jsonArray.Add(DeserializeObject(reader, info));

                if (!reader.ReadContent())
                {
                    throw new XSerializerException("Unexpected end of input while attempting to parse ',' character.");
                }

                if (reader.NodeType == JsonNodeType.CloseArray)
                {
                    break;
                }

                if (reader.NodeType != JsonNodeType.ItemSeparator)
                {
                    throw new XSerializerException("Unexpected node type found while attempting to parse ',' character: " +
                                                   reader.NodeType + ".");
                }
            }

            return jsonArray;
        }