Ejemplo n.º 1
0
 internal void Write(BigEndianStream tx)
 {
     try // I can't work out how it set this from SpawnAnimal.
     {
         foreach (int k in Data.Keys)
         {
             Type type = Data[k].GetType();
             if (type == typeof(byte))
             {
                 tx.WriteByte((byte)k);
                 tx.Write((byte)Data[k]);
             }
             else if (type == typeof(short))
             {
                 tx.WriteByte((byte)(0x20 | k));
                 tx.Write((short)Data[k]);
             }
             else if (type == typeof(int))
             {
                 tx.WriteByte((byte)(0x40 | k));
                 tx.Write((int)Data[k]);
             }
             else if (type == typeof(float))
             {
                 tx.WriteByte((byte)(0x60 | k));
                 tx.Write((float)Data[k]);
             }
             else if (type == typeof(string))
             {
                 tx.WriteByte((byte)(0x80 | k));
                 tx.Write((string)Data[k]);
             }
         }
     }
     catch { }
     finally
     {
         tx.WriteByte(0x7f);
     }
 }
Ejemplo n.º 2
0
 public override void Write(BigEndianStream stream)
 {
     stream.WriteByte((byte)Reason);
 }