コード例 #1
0
        /// <summary>
        /// Gets the buffered JSON data.
        /// </summary>
        /// <returns>Returns a <see cref="JsonBuffer"/> object with the
        /// written and buffered JSON data.</returns>
        /// <remarks>
        /// This method method auto-completes the JSON data if it has not
        /// been written in its entirety.
        /// </remarks>

        public JsonBuffer GetBuffer()
        {
            if (Depth > 0)
            {
                AutoComplete();
            }
            return(_storage.ToBuffer());
        }
コード例 #2
0
ファイル: JsonBuffer.cs プロジェクト: scslmd/NppToolBucket
        public static JsonBuffer From(JsonToken token)
        {
            JsonTokenClass clazz = token.Class;

            if (clazz == JsonTokenClass.Null)
            {
                return(_null);
            }

            if (!clazz.IsScalar)
            {
                throw new ArgumentException("Token must represent a JSON scalar value or null.", "token");
            }

            if (clazz == JsonTokenClass.Boolean)
            {
                return(token.Equals(JsonToken.True()) ? _true : _false);
            }

            JsonBufferStorage storage = new JsonBufferStorage(1);

            storage.Write(token);
            return(storage.ToBuffer());
        }
コード例 #3
0
ファイル: JsonBuffer.cs プロジェクト: GroupXTech/Yatse2
        public static JsonBuffer From(JsonToken token)
        {
            JsonTokenClass clazz = token.Class;

            if (clazz == JsonTokenClass.Null)
                return _null;

            if (!clazz.IsScalar)
                throw new ArgumentException("Token must represent a JSON scalar value or null.", "token");

            if (clazz == JsonTokenClass.Boolean)
                return token.Equals(JsonToken.True()) ? _true : _false;

            JsonBufferStorage storage = new JsonBufferStorage(1);
            storage.Write(token);
            return storage.ToBuffer();
        }