protected override void SerializeImpl(IOutgoingMessageStream messageStream) { messageStream.WriteBool(PartialUpdate); if (!PartialUpdate) { messageStream.WriteByte(InventorySize); } messageStream.WriteInt64(InventoryId); messageStream.WriteInt16((short)InventoryType); Write(messageStream, InventoryContent); }
static void Write(IOutgoingMessageStream stream, IEnumerable <KeyValuePair <byte, InventoryItem> > data) { var toSend = data.ToList(); var count = (short)toSend.Count; stream.WriteInt16(count); Logger.Write(string.Format("Writing {0} inventory items", count)); var i = 0; foreach (var item in toSend) { Logger.Write(string.Format("Writing inventory item {0}", i)); stream.WriteByte(item.Key); WriteInventoryItem(stream, item.Value); i++; } }