public void DecodeMap(byte[] data) { var freedomCells = PlayCheckerboard.DecodeFromBytes(data); SecondCheckerboard.Children.Clear(); if (freedomCells != null) { var cols = SecondCheckerboard.Columns; for (int i = 0; i < freedomCells.Count; i++) { Checkerboard.SetColumn(freedomCells[i], i % cols); Checkerboard.SetRow(freedomCells[i], i / cols); SecondCheckerboard.Children.Add(freedomCells[i]); } } }
public byte[] EncodeMap() { return(PlayCheckerboard.EncodeToBytes(SecondCheckerboard.Children.OfType <Mirror>().Select(mirror => mirror.Cell).ToList())); }