Exemplo n.º 1
0
 void ISerializable.Serialize(BinaryWriter writer)
 {
     writer.Write(Magic);
     writer.WriteFixedString(Command, 12);
     writer.Write(Payload.Length);
     writer.Write(Checksum);
     writer.Write(Payload);
 }
Exemplo n.º 2
0
 public static void EncodeMessage(BinaryWriter writer, Message message)
 {
     writer.WriteUInt32(message.Magic);
     writer.WriteFixedString(12, message.Command);
     writer.WriteUInt32(message.PayloadSize);
     writer.WriteUInt32(message.PayloadChecksum);
     writer.WriteBytes(message.PayloadSize.ToIntChecked(), message.Payload.ToArray());
 }
Exemplo n.º 3
0
    public void Write(BinaryWriter writer)
    {
      writer.WriteFixedString(Name.ToLower());
      writer.WriteFixedString(ImagePath.ToLower());
      writer.Write(Margin);
      writer.Write(Spacing);
      writer.Write(TileCount);
      writer.Write(TileWidth);
      writer.Write(TileHeight);
      writer.Write(FirstGid);

      writer.Write(PropertyEntries.Count);

      foreach (var entry in PropertyEntries)
        entry.Write(writer);
    }
Exemplo n.º 4
0
    public void Write(BinaryWriter writer)
    {
      writer.Write(Id);
      writer.Write(Properties.Count);

      foreach (var property in Properties)
      {
        writer.WriteFixedString(property.Key.ToLower());
        writer.WriteFixedString(property.Value.ToLower());
      }
    }
Exemplo n.º 5
0
 public static void EncodeMessage(Stream stream, Message message)
 {
     using (var writer = new BinaryWriter(stream, Encoding.ASCII, leaveOpen: true))
     {
         writer.Write4Bytes(message.Magic);
         writer.WriteFixedString(12, message.Command);
         writer.Write4Bytes(message.PayloadSize);
         writer.Write4Bytes(message.PayloadChecksum);
         writer.WriteBytes(message.PayloadSize.ToIntChecked(), message.Payload.ToArray());
     }
 }