Exemple #1
0
        public SemaphoreGame GetNextGame()
        {
            if (Games == null || Games.Count == 0)
            {
                return(null);
            }
            SemaphoreGame game = Games[_currentGame].CreateCopy();

            _currentGame = _currentGame + 1 == Games.Count ? 0 : _currentGame + 1;

            return(game);
        }
Exemple #2
0
        private void GenerateGames()
        {
            ////TODO: Read XML File
            Games.Clear();
            using (var sr = new StreamReader(Settings.Default.SemaphoreGamesFilePath))
            {
                string gameline = sr.ReadLine();
                while (gameline != null)
                {
                    var game = new SemaphoreGame();
                    foreach (char semaphore in gameline)
                    {
                        game.Semaphores.Add(new SemaphoreImage(semaphore));
                    }

                    Games.Add(game);
                    gameline = sr.ReadLine();
                }
            }
        }