当前位置: 首页>>代码示例>>C#>>正文


C# Json.JsonPosition类代码示例

本文整理汇总了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);
        }
开发者ID:jrwren,项目名称:yahoofinance,代码行数:7,代码来源:JsonWriter.cs

示例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;
        }
开发者ID:jrwren,项目名称:yahoofinance,代码行数:16,代码来源:JsonWriter.cs

示例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));
                }
            }
        }
开发者ID:benerdin,项目名称:Newtonsoft.Json,代码行数:26,代码来源:JsonReader.cs

示例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;
        }
开发者ID:benerdin,项目名称:Newtonsoft.Json,代码行数:22,代码来源:JsonReader.cs

示例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;
   }
 }
开发者ID:jmhdz,项目名称:GalleryServer,代码行数:16,代码来源:JsonWriter.cs

示例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;
      }
    }
开发者ID:leesanghyun2,项目名称:mp-onlinevideos2,代码行数:18,代码来源:JsonWriter.cs

示例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
     };
   }
 }
开发者ID:Zeludon,项目名称:FEZ,代码行数:15,代码来源:JsonWriter.cs

示例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;
 }
开发者ID:Zeludon,项目名称:FEZ,代码行数:16,代码来源:JsonWriter.cs

示例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();
        }
开发者ID:Zainulabdeen,项目名称:Newtonsoft.Json,代码行数:30,代码来源:JsonPosition.cs

示例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);
        }
开发者ID:jlvaquero,项目名称:Newtonsoft.Json,代码行数:14,代码来源:JsonWriter.cs

示例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;
 }
开发者ID:Zeludon,项目名称:FEZ,代码行数:23,代码来源:JsonReader.cs

示例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));
   }
 }
开发者ID:Zeludon,项目名称:FEZ,代码行数:24,代码来源:JsonReader.cs

示例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));
     }
 }
开发者ID:newchild,项目名称:Project-DayZero,代码行数:18,代码来源:JsonReader.cs

示例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;
 }
开发者ID:newchild,项目名称:Project-DayZero,代码行数:22,代码来源:JsonReader.cs

示例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;
 }
开发者ID:newchild,项目名称:Project-DayZero,代码行数:16,代码来源:JsonWriter.cs


注:本文中的Newtonsoft.Json.JsonPosition类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。