예제 #1
0
        internal static CBORObject ParseJSONValue(
            byte[] bytes,
            int index,
            int endPos,
            JSONOptions options)
        {
            var        nextchar = new int[1];
            var        cj       = new CBORJson2(bytes, index, endPos, options);
            CBORObject obj      = cj.ParseJSON(nextchar);

            if (nextchar[0] != -1)
            {
                cj.RaiseError("End of bytes not reached");
            }
            return(obj);
        }
예제 #2
0
        internal static CBORObject ParseJSONValue(
            byte[] bytes,
            int index,
            int endPos,
            JSONOptions options,
            int[] nextchar)
        {
      #if DEBUG
            if (bytes == null)
            {
                throw new ArgumentNullException(nameof(bytes));
            }
            if (index < 0)
            {
                throw new ArgumentException("index (" + index + ") is not greater or" +
                                            "\u0020equal to 0");
            }
            if (index > bytes.Length)
            {
                throw new ArgumentException("index (" + index + ") is not less or" +
                                            "\u0020equal to " + bytes.Length);
            }
            if (endPos < 0)
            {
                throw new ArgumentException("endPos (" + endPos + ") is not greater" +
                                            "\u0020or equal to 0");
            }
            if (endPos > bytes.Length)
            {
                throw new ArgumentException("endPos (" + endPos + ") is not less or" +
                                            "\u0020equal to " + bytes.Length);
            }
            if (endPos < index)
            {
                throw new ArgumentException("endPos (" + endPos + ") is not greater" +
                                            "\u0020or equal to " + index);
            }
      #endif

            var cj = new CBORJson2(bytes, index, endPos, options);
            return(cj.ParseJSON(nextchar));
        }