public virtual void WriteToStreamDelta(Stream stream, Attack previous) { if (previous == null) { Attack.Serialize(stream, this); return; } Attack.SerializeDelta(stream, this, previous); }
public static byte[] SerializeToBytes(Attack instance) { byte[] array; using (MemoryStream memoryStream = new MemoryStream()) { Attack.Serialize(memoryStream, instance); array = memoryStream.ToArray(); } return(array); }
public static void Serialize(Stream stream, PlayerAttack instance) { MemoryStream memoryStream = Pool.Get <MemoryStream>(); if (instance.attack == null) { throw new ArgumentNullException("attack", "Required by proto specification."); } stream.WriteByte(10); memoryStream.SetLength((long)0); Attack.Serialize(memoryStream, instance.attack); uint length = (uint)memoryStream.Length; ProtocolParser.WriteUInt32(stream, length); stream.Write(memoryStream.GetBuffer(), 0, (int)length); stream.WriteByte(16); ProtocolParser.WriteUInt64(stream, (ulong)instance.projectileID); Pool.FreeMemoryStream(ref memoryStream); }
public virtual void WriteToStream(Stream stream) { Attack.Serialize(stream, this); }
public void ToProto(Stream stream) { Attack.Serialize(stream, this); }