Example #1
0
        private void DiscoverThemes()
        {
            BoardThemes.Clear();
            PieceThemes.Clear();

            var baseBoardSetsPath = Path + "/board_themes/";
            var basePieceSetsPath = Path + "/piece_themes/";

            var boardThemeDirs = Directory.GetDirectories(baseBoardSetsPath, "*", SearchOption.TopDirectoryOnly);

            foreach (var dir in boardThemeDirs)
            {
                try
                {
                    var theme = new BoardTheme(dir);
                    BoardThemes.Add(theme.Name, theme);
                }
                catch (Exception)
                {
                }
            }

            var pieceThemeDirs = Directory.GetDirectories(basePieceSetsPath, "*", SearchOption.TopDirectoryOnly);

            foreach (var dir in pieceThemeDirs)
            {
                string directoryName = System.IO.Path.GetFileName(dir.TrimEnd(System.IO.Path.DirectorySeparatorChar));
                try
                {
                    var theme = new PieceTheme(dir);
                    PieceThemes.Add(theme.Name, theme);
                }
                catch (Exception)
                {
                }
            }
        }
Example #2
0
 public BoardTheme GetAnyBoardTheme()
 {
     return(BoardThemes.FirstOrDefault().Value);
 }