public byte[] Serialize(AirlockMessage message) { using (var stream = new MemoryStream()) using (var writer = new SimpleAirlockBinaryWriter(stream)) { writer.Write((short)1); writer.WriteCollection(message.EventGroups, SerializeEventGroup); writer.Flush(); return(stream.ToArray()); } }
public byte[] ToArray() { _writer.Flush(); return(_writeStream.ToArray()); }