Example #1
0
 private void StartBackgroundValidation(string source, CommentInfos comments)
 {
     ThreadPool.QueueUserWorkItem(this.ThreadPoolCallback, new BackgroundInfo()
     {
         Source = source, Comments = comments
     });
 }
        /// <summary>
        /// Parses the string json into a value
        /// </summary>
        /// <param name="json">A JSON string.</param>
        /// <returns>An ArrayList, a Hashtable, a double, a string, null, true, or false</returns>
        public object Validate(string json, bool supportStartComment = false, bool relaxMode = false, CommentInfos commentInfos = null)
        {
            bool success = true;
            this._supportStartComment = supportStartComment;

            if (commentInfos == null) // Optimization for the TextHighlighter extension
            {                         // So we do not have parse the comment twice if possible
                commentInfos = new CommentParser().Parse(json);
            }

            _supportIDWithNoQuote = (relaxMode) || (commentInfos.IsRelax);
            _supportTrailingComa  = _supportIDWithNoQuote;
            _supportSlashComment  = _supportIDWithNoQuote;

            return Compile(json, ref success);
        }