Ejemplo n.º 1
0
 // Token: 0x060156C5 RID: 87749 RVA: 0x0056E690 File Offset: 0x0056C890
 private static void WriteJson(IJsonWrapper obj, JsonWriter writer)
 {
     if (obj.IsString)
     {
         writer.Write(obj.GetString());
         return;
     }
     if (obj.IsBoolean)
     {
         writer.Write(obj.GetBoolean());
         return;
     }
     if (obj.IsDouble)
     {
         writer.Write(obj.GetDouble());
         return;
     }
     if (obj.IsInt)
     {
         writer.Write(obj.GetInt());
         return;
     }
     if (obj.IsLong)
     {
         writer.Write(obj.GetLong());
         return;
     }
     if (obj.IsArray)
     {
         writer.WriteArrayStart();
         IEnumerator enumerator = obj.GetEnumerator();
         try
         {
             while (enumerator.MoveNext())
             {
                 object obj2 = enumerator.Current;
                 JsonData.WriteJson((JsonData)obj2, writer);
             }
         }
         finally
         {
             IDisposable disposable;
             if ((disposable = (enumerator as IDisposable)) != null)
             {
                 disposable.Dispose();
             }
         }
         writer.WriteArrayEnd();
         return;
     }
     if (obj.IsObject)
     {
         writer.WriteObjectStart();
         IDictionaryEnumerator enumerator2 = obj.GetEnumerator();
         try
         {
             while (enumerator2.MoveNext())
             {
                 object          obj3            = enumerator2.Current;
                 DictionaryEntry dictionaryEntry = (DictionaryEntry)obj3;
                 writer.WritePropertyName((string)dictionaryEntry.Key);
                 JsonData.WriteJson((JsonData)dictionaryEntry.Value, writer);
             }
         }
         finally
         {
             IDisposable disposable2;
             if ((disposable2 = (enumerator2 as IDisposable)) != null)
             {
                 disposable2.Dispose();
             }
         }
         writer.WriteObjectEnd();
         return;
     }
 }
Ejemplo n.º 2
0
 private static void WriteJson(IJsonWrapper obj, JsonWriter writer)
 {
     if (obj == null)
     {
         writer.Write((string)null);
     }
     else if (obj.IsString)
     {
         writer.Write(obj.GetString());
     }
     else if (obj.IsBoolean)
     {
         writer.Write(obj.GetBoolean());
     }
     else if (obj.IsDouble)
     {
         writer.Write(obj.GetDouble());
     }
     else if (obj.IsInt)
     {
         writer.Write(obj.GetInt());
     }
     else if (obj.IsLong)
     {
         writer.Write(obj.GetLong());
     }
     else if (obj.IsArray)
     {
         writer.WriteArrayStart();
         IEnumerator enumerator = obj.GetEnumerator();
         try
         {
             while (enumerator.MoveNext())
             {
                 object current = enumerator.Current;
                 WriteJson((JsonData)current, writer);
             }
         }
         finally
         {
             IDisposable disposable = enumerator as IDisposable;
             if (disposable == null)
             {
             }
             disposable.Dispose();
         }
         writer.WriteArrayEnd();
     }
     else if (obj.IsObject)
     {
         writer.WriteObjectStart();
         IDictionaryEnumerator enumerator2 = obj.GetEnumerator();
         try
         {
             while (enumerator2.MoveNext())
             {
                 DictionaryEntry entry = (DictionaryEntry)enumerator2.Current;
                 writer.WritePropertyName((string)entry.Key);
                 WriteJson((JsonData)entry.Value, writer);
             }
         }
         finally
         {
             IDisposable disposable2 = enumerator2 as IDisposable;
             if (disposable2 == null)
             {
             }
             disposable2.Dispose();
         }
         writer.WriteObjectEnd();
     }
 }