本文整理汇总了C#中Newtonsoft.Json.JsonPosition类的典型用法代码示例。如果您正苦于以下问题:C# JsonPosition类的具体用法?C# JsonPosition怎么用?C# JsonPosition使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JsonPosition类属于Newtonsoft.Json命名空间,在下文中一共展示了JsonPosition类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Push
private void Push(JsonContainerType value)
{
if (_currentPosition.Type != JsonContainerType.None)
_stack.Add(_currentPosition);
_currentPosition = new JsonPosition(value);
}
示例2: Pop
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;
}
示例3: Push
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));
}
}
}
示例4: Pop
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;
}
示例5: Push
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: Push
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;
}
}
示例7: Push
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
};
}
}
示例8: Pop
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;
}
示例9: BuildPath
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();
}
示例10: Push
private void Push(JsonContainerType value)
{
if (_currentPosition.Type != JsonContainerType.None)
{
if (_stack == null)
{
_stack = new List<JsonPosition>();
}
_stack.Add(_currentPosition);
}
_currentPosition = new JsonPosition(value);
}
示例11: Pop
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;
}
示例12: Push
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));
}
}
示例13: Push
// 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));
}
}
示例14: Pop
// 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;
}
示例15: Pop
// 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;
}