當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。