예제 #1
0
 private void Push(JsonContainerType value)
 {
     if (_currentPosition.Type == JsonContainerType.None)
     {
         _currentPosition.Type = value;
     }
     else
     {
         _stack.Add(_currentPosition);
         var state = new JsonPosition
         {
             Type = value
         };
         _currentPosition = state;
     }
 }
예제 #2
0
        private JsonContainerType Pop()
        {
            JsonPosition oldPosition;

            if (_stack.Count > 0)
            {
                oldPosition      = _currentPosition;
                _currentPosition = _stack[_stack.Count - 1];
                _stack.RemoveAt(_stack.Count - 1);
            }
            else
            {
                oldPosition      = _currentPosition;
                _currentPosition = new JsonPosition();
            }

            return(oldPosition.Type);
        }
예제 #3
0
        private JsonContainerType Pop()
        {
            JsonPosition oldPosition;

            if (_stack.Count > 0)
            {
                oldPosition      = _currentPosition;
                _currentPosition = _stack[_stack.Count - 1];
                _stack.RemoveAt(_stack.Count - 1);
            }
            else
            {
                oldPosition      = _currentPosition;
                _currentPosition = new JsonPosition();
            }

            if (_maxDepth != null && Depth <= _maxDepth)
            {
                _hasExceededMaxDepth = false;
            }

            return(oldPosition.Type);
        }
예제 #4
0
    private JsonContainerType Pop()
    {
      JsonPosition oldPosition;
      if (_stack.Count > 0)
      {
        oldPosition = _currentPosition;
        _currentPosition = _stack[_stack.Count - 1];
        _stack.RemoveAt(_stack.Count - 1);
      }
      else
      {
        oldPosition = _currentPosition;
        _currentPosition = new JsonPosition();
      }

      return oldPosition.Type;
    }
예제 #5
0
 private void Push(JsonContainerType value)
 {
   if (_currentPosition.Type == JsonContainerType.None)
   {
     _currentPosition.Type = value;
   }
   else
   {
     _stack.Add(_currentPosition);
     var state = new JsonPosition
     {
       Type = value
     };
     _currentPosition = state;
   }
 }
예제 #6
0
    private JsonContainerType Pop()
    {
      JsonPosition oldPosition;
      if (_stack.Count > 0)
      {
        oldPosition = _currentPosition;
        _currentPosition = _stack[_stack.Count - 1];
        _stack.RemoveAt(_stack.Count - 1);
      }
      else
      {
        oldPosition = _currentPosition;
        _currentPosition = new JsonPosition();
      }

      if (_maxDepth != null && Depth <= _maxDepth)
        _hasExceededMaxDepth = false;

      return oldPosition.Type;
    }
예제 #7
0
    private void Push(JsonContainerType value)
    {
      UpdateScopeWithFinishedValue();

      if (_currentPosition.Type == JsonContainerType.None)
      {
        _currentPosition.Type = value;
      }
      else
      {
        _stack.Add(_currentPosition);
        JsonPosition state = new JsonPosition
        {
          Type = value
        };
        _currentPosition = state;

        // this is a little hacky because Depth increases when first property/value is written but only testing here is faster/simpler
        if (_maxDepth != null && Depth + 1 > _maxDepth && !_hasExceededMaxDepth)
        {
          _hasExceededMaxDepth = true;
          throw JsonReaderException.Create(this, "The reader's MaxDepth of {0} has been exceeded.".FormatWith(CultureInfo.InvariantCulture, _maxDepth));
        }
      }
    }