Exemplo n.º 1
0
        internal static CBORObject ParseJSONValue(
            string jstring,
            int index,
            int endPos,
            JSONOptions options)
        {
            var        nextchar = new int[1];
            var        cj       = new CBORJson3(jstring, index, endPos, options);
            CBORObject obj      = cj.ParseJSON(nextchar);

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

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