using Igdc;
using System.Linq;
using System.Windows;

namespace Editor.Extensions
{
    public static class MapDtoExt
    {
        public static Point[,] ToEditorFriendly(this MapDto dto)
        {
            var sizeX = dto.Elements.Keys.Max(e => e.X) + 1;
            var sizeY = dto.Elements.Keys.Max(e => e.Y) + 1;
            var map = new Point[sizeX, sizeY];
            foreach (var pair in dto.Elements)
                map[pair.Key.X, pair.Key.Y]
                    = new Point(pair.Value.X, pair.Value.Y);
            return map;
        }
    }
}