public object Deserialize(Stream serializationStream) { Message message = new Message(serializationStream.ToVariableInt()); long length = serializationStream.ToInt64(); if (length > 0) { length += serializationStream.Position; while (serializationStream.Position < length) { message.SetProperty(message.Template | serializationStream.ToUInt32(), TypeFormatter.Deserialize(serializationStream)); if (serializationStream.Position > length) { throw new OutOfMemoryException(); } length += serializationStream.ToInt64() + 8; } } return(message); }