예제 #1
0
 public override void WriteTo(GGWriter writer)
 {
     writer.WriteStartArray(_items.Count);
     if (_items.Count > 0)
     {
         for (int i = 0; i < _items.Count - 1; i++)
         {
             _items[i].WriteTo(writer);
             writer.WriteArrayDelimiter();
         }
         _items[_items.Count - 1].WriteTo(writer);
     }
     writer.WriteEndArray();
 }
예제 #2
0
 public override void WriteTo(GGWriter writer)
 {
     writer.WriteStartHash(Pairs.Count);
     if (Pairs.Count > 0)
     {
         foreach (var pair in Pairs.Take(Pairs.Count - 1))
         {
             writer.WriteHashName(pair.Key);
             pair.Value.WriteTo(writer);
             writer.WriteHashDelimiter();
         }
         var lastPair = Pairs.Last();
         writer.WriteHashName(lastPair.Key);
         lastPair.Value.WriteTo(writer);
     }
     writer.WriteEndHash();
 }
예제 #3
0
 public override void WriteTo(GGWriter writer)
 {
     if (Value is string)
     {
         writer.WriteString((string)Value); return;
     }
     if (Value is int)
     {
         writer.WriteInt((int)Value); return;
     }
     if (Value is double)
     {
         writer.WriteDouble((double)Value); return;
     }
     if (Value == null)
     {
         writer.WriteNull(); return;
     }
     throw new InvalidOperationException();
 }
예제 #4
0
 public abstract void WriteTo(GGWriter writer);