private static List <TiledMapTileContent> DecodeBase64Data(TiledMapTileLayerDataContent data, int width, int height) { var tileList = new List <TiledMapTileContent>(); var encodedData = data.Value.Trim(); var decodedData = Convert.FromBase64String(encodedData); using (var stream = OpenStream(decodedData, data.Compression)) { using (var reader = new BinaryReader(stream)) { data.Tiles = new List <TiledMapTileContent>(); for (var y = 0; y < width; y++) { for (var x = 0; x < height; x++) { var gid = reader.ReadUInt32(); tileList.Add(new TiledMapTileContent { GlobalIdentifier = gid }); } } } } return(tileList); }
private static List <TiledMapTileContent> DecodeCommaSeperatedValuesData(TiledMapTileLayerDataContent data) { return(data.Value .Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries) .Select(uint.Parse) .Select(x => new TiledMapTileContent { GlobalIdentifier = x }) .ToList()); }