Exemplo n.º 1
0
        public static IDictionary <string, object> Serialize(Room room)
        {
            var data = EntitySerializer.Serialize(room);

            data.Add("Description", room.Description);
            data.Add("Exits", ExitSet.Serialize(room._exits));
            if (room.Resets != null)
            {
                data.Add("Resets", RoomReset.Serialize(room.Resets));
            }

            return(data);
        }
Exemplo n.º 2
0
        public static Room Deserialize(dynamic data)
        {
            var room = new Room {
                Description = data.Description
            };

            if (data.Exits != null)
            {
                room._exits = ExitSet.Deserialize(data.Exits);
            }

            if (data.Resets != null)
            {
                room.Resets = RoomReset.Deserialize(data.Resets);
            }
            EntitySerializer.Deserialize(data, room);
            return(room);
        }