Example #1
0
            private static XElement RootToElement(RootMemento memento)
            {
                var specs = memento.Specs.Zip((1, 2), PlayerSpecToElement);

                return(new XElement(RootMementoElement,
                                    new XAttribute("boardSize", memento.BoardSize),
                                    new XAttribute("firstPlayer", memento.IsFirstPlayerPlaying),
                                    new XElement(PlayersElement,
                                                 specs.Item1,
                                                 specs.Item2)));
            }
Example #2
0
            public static XElement StateToElement(GameState state)
            {
                var memento = new RootMemento(state.SpecPair, state.BoardSize, state.CurrentPlayer == state.Player1);

                return(RootToElement(memento));
            }