public void ObserveGame(int gameNumber) { if (!Games.Exists(game => game.GameNumber == gameNumber) && !ExpectedGames.Contains(gameNumber)) { ExpectedGames.Add(gameNumber); Client.WriteLine("observe " + Convert.ToString(gameNumber)); } }
private void GameInfoReceived(object sender, EventArgs args) { var gameInfo = (sender as IGSGameInfoRequest).Result; if (!Games.Exists(game => game.GameNumber == gameInfo.GameNumber) && (ExpectedGames == null || ExpectedGames.Contains(gameInfo.GameNumber))) { var game = new ObservedGame(gameInfo.BoardSize, gameInfo.GameNumber); game.Info.BlackPlayer = gameInfo.BlackPlayer; game.Info.WhitePlayer = gameInfo.WhitePlayer; Games.Add(game); OnGameAdded(new IGSGameEventArgs(game)); Client.WriteLine("moves " + Convert.ToString(gameInfo.GameNumber)); if (ExpectedGames != null) { ExpectedGames.Remove(gameInfo.GameNumber); } } }