private JsonContainerType Pop() { JsonPosition oldPosition = _currentPosition; if (_stack.Count > 0) { _currentPosition = _stack[_stack.Count - 1]; _stack.RemoveAt(_stack.Count - 1); } else { _currentPosition = new JsonPosition(); } return(oldPosition.Type); }
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; } }
private JsonContainerType Pop() { JsonPosition jsonPosition; if (this._stack.Count > 0) { jsonPosition = this._currentPosition; this._currentPosition = this._stack[this._stack.Count - 1]; this._stack.RemoveAt(this._stack.Count - 1); } else { jsonPosition = this._currentPosition; this._currentPosition = new JsonPosition(); } return(jsonPosition.Type); }
// Token: 0x06000C3B RID: 3131 RVA: 0x00050098 File Offset: 0x0004E298 internal static JsonSerializationException Create([Nullable(2)] IJsonLineInfo lineInfo, string path, string message, [Nullable(2)] Exception ex) { message = JsonPosition.FormatMessage(lineInfo, path, message); int lineNumber; int linePosition; if (lineInfo != null && lineInfo.HasLineInfo()) { lineNumber = lineInfo.LineNumber; linePosition = lineInfo.LinePosition; } else { lineNumber = 0; linePosition = 0; } return(new JsonSerializationException(message, path, lineNumber, linePosition, ex)); }
internal static JsonReaderException Create(IJsonLineInfo lineInfo, string path, string message, Exception ex) { int lineNumber; int linePosition; message = JsonPosition.FormatMessage(lineInfo, path, message); if (lineInfo == null || !lineInfo.HasLineInfo()) { lineNumber = 0; linePosition = 0; } else { lineNumber = lineInfo.LineNumber; linePosition = lineInfo.LinePosition; } return(new JsonReaderException(message, path, lineNumber, linePosition, ex)); }
private void Push(JsonContainerType value) { UpdateScopeWithFinishedValue(); if (_currentPosition.Type == JsonContainerType.None) { _currentPosition.Type = value; } else { _stack.Add(_currentPosition); var state = new JsonPosition { Type = value }; _currentPosition = state; } }
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; }
private JsonContainerType Pop() { JsonPosition currentPosition; if (this._stack.Count > 0) { currentPosition = this._currentPosition; this._currentPosition = this._stack[this._stack.Count - 1]; this._stack.RemoveAt(this._stack.Count - 1); } else { currentPosition = this._currentPosition; this._currentPosition = default(JsonPosition); } if (this._maxDepth.HasValue && this.Depth <= this._maxDepth) { this._hasExceededMaxDepth = false; } return(currentPosition.Type); }
private void Push(JsonContainerType value) { UpdateScopeWithFinishedValue(); if (_currentPosition.Type == JsonContainerType.None) { _currentPosition = new JsonPosition(value); } else { _stack.Add(_currentPosition); _currentPosition = new JsonPosition(value); // 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)); } } }
private void Push(JsonContainerType value) { this.UpdateScopeWithFinishedValue(); if (this._currentPosition.Type == JsonContainerType.None) { this._currentPosition = new JsonPosition(value); return; } if (this._stack == null) { this._stack = new List <JsonPosition>(); } this._stack.Add(this._currentPosition); this._currentPosition = new JsonPosition(value); if (this._maxDepth.HasValue) { int?nullable = this._maxDepth; if (this.Depth + 1 > nullable.GetValueOrDefault() & nullable.HasValue && !this._hasExceededMaxDepth) { this._hasExceededMaxDepth = true; throw JsonReaderException.Create(this, "The reader's MaxDepth of {0} has been exceeded.".FormatWith(CultureInfo.InvariantCulture, this._maxDepth)); } } }
// Token: 0x06000075 RID: 117 // RVA: 0x00028DC4 File Offset: 0x00026FC4 private JsonContainerType Pop() { JsonPosition currentPosition; if (this._stack.Count > 0) { currentPosition = this._currentPosition; this._currentPosition = this._stack[this._stack.Count - 1]; this._stack.RemoveAt(this._stack.Count - 1); } else { currentPosition = this._currentPosition; this._currentPosition = default(JsonPosition); } if (this._maxDepth.HasValue && this.Depth <= this._maxDepth) { this._hasExceededMaxDepth = false; } return currentPosition.Type; }
private JsonContainerType Pop() { JsonPosition oldPosition; if (_stack != null && _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; }
private void Push(JsonContainerType value) { UpdateScopeWithFinishedValue(); if (_currentPosition.Type == JsonContainerType.None) { _currentPosition = new JsonPosition(value); } else { if (_stack == null) { _stack = new List<JsonPosition>(); } _stack.Add(_currentPosition); _currentPosition = new JsonPosition(value); // 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)); } } }
// Token: 0x06000BA4 RID: 2980 RVA: 0x0000ECBF File Offset: 0x0000CEBF internal static JsonException Create(IJsonLineInfo lineInfo, string path, string message) { message = JsonPosition.FormatMessage(lineInfo, path, message); return(new JsonException(message)); }
private void Push(JsonContainerType value) { if (_currentPosition.Type != JsonContainerType.None) _stack.Add(_currentPosition); _currentPosition = new JsonPosition(value); }
// Token: 0x060000FA RID: 250 // RVA: 0x0002A678 File Offset: 0x00028878 private JsonContainerType Pop() { JsonPosition currentPosition = this._currentPosition; if (this._stack.Count > 0) { this._currentPosition = this._stack[this._stack.Count - 1]; this._stack.RemoveAt(this._stack.Count - 1); } else { this._currentPosition = default(JsonPosition); } return currentPosition.Type; }
private JsonContainerType Pop() { JsonPosition jsonPosition; if (this._stack.Count > 0) { jsonPosition = this._currentPosition; this._currentPosition = this._stack[this._stack.Count - 1]; this._stack.RemoveAt(this._stack.Count - 1); } else { jsonPosition = this._currentPosition; this._currentPosition = new JsonPosition(); } return jsonPosition.Type; }
private void Push(JsonContainerType value) { if (this._currentPosition.Type == JsonContainerType.None) { this._currentPosition.Type = value; } else { this._stack.Add(this._currentPosition); this._currentPosition = new JsonPosition() { Type = value }; } }
private JsonContainerType Pop() { JsonPosition jsonPosition; if (this._stack.Count > 0) { jsonPosition = this._currentPosition; this._currentPosition = this._stack[this._stack.Count - 1]; this._stack.RemoveAt(this._stack.Count - 1); } else { jsonPosition = this._currentPosition; this._currentPosition = new JsonPosition(); } if (this._maxDepth.HasValue) { int depth = this.Depth; int? nullable = this._maxDepth; if ((depth > nullable.GetValueOrDefault() ? 0 : (nullable.HasValue ? 1 : 0)) != 0) this._hasExceededMaxDepth = false; } return jsonPosition.Type; }
private void Push(JsonContainerType value) { if (_currentPosition.Type != JsonContainerType.None) { if (_stack == null) { _stack = new List<JsonPosition>(); } _stack.Add(_currentPosition); } _currentPosition = new JsonPosition(value); }
private void Push(JsonContainerType value) { this.UpdateScopeWithFinishedValue(); if (this._currentPosition.Type == JsonContainerType.None) { this._currentPosition.Type = value; } else { this._stack.Add(this._currentPosition); this._currentPosition = new JsonPosition() { Type = value }; if (!this._maxDepth.HasValue) return; int num = this.Depth + 1; int? nullable = this._maxDepth; if ((num <= nullable.GetValueOrDefault() ? 0 : (nullable.HasValue ? 1 : 0)) == 0 || this._hasExceededMaxDepth) return; this._hasExceededMaxDepth = true; throw JsonReaderException.Create(this, StringUtils.FormatWith("The reader's MaxDepth of {0} has been exceeded.", (IFormatProvider) CultureInfo.InvariantCulture, (object) this._maxDepth)); } }
internal static JsonWriterException Create(string path, string message, Exception ex) { message = JsonPosition.FormatMessage(null, path, message); return(new JsonWriterException(message, path, ex)); }
// Token: 0x06000074 RID: 116 // RVA: 0x00028D14 File Offset: 0x00026F14 private void Push(JsonContainerType value) { this.UpdateScopeWithFinishedValue(); if (this._currentPosition.Type == JsonContainerType.None) { this._currentPosition = new JsonPosition(value); return; } this._stack.Add(this._currentPosition); this._currentPosition = new JsonPosition(value); if (this._maxDepth.HasValue && this.Depth + 1 > this._maxDepth && !this._hasExceededMaxDepth) { this._hasExceededMaxDepth = true; throw JsonReaderException.Create(this, StringUtils.FormatWith("The reader's MaxDepth of {0} has been exceeded.", CultureInfo.InvariantCulture, this._maxDepth)); } }
private JsonContainerType Pop() { JsonPosition oldPosition = _currentPosition; if (_stack.Count > 0) { _currentPosition = _stack[_stack.Count - 1]; _stack.RemoveAt(_stack.Count - 1); } else { _currentPosition = new JsonPosition(); } return oldPosition.Type; }
internal static string BuildPath(List<JsonPosition> positions, JsonPosition? currentPosition) { int capacity = 0; if (positions != null) { for (int i = 0; i < positions.Count; i++) { capacity += positions[i].CalculateLength(); } } if (currentPosition != null) { capacity += currentPosition.Value.CalculateLength(); } StringBuilder sb = new StringBuilder(capacity); if (positions != null) { foreach (JsonPosition state in positions) { state.WriteTo(sb); } } if (currentPosition != null) { currentPosition.Value.WriteTo(sb); } return sb.ToString(); }