private void AcceptChallenge(int i) { if (Ap.IsGameInProgress) { //MessageForm.Show(this.ParentForm, MsgE.ErrorRoomChange); ChatClient.Write(ChatTypeE.OnlineClient, ChatMessageTypeE.Warning, ChatTypeE.OnlineClient, MsgE.ErrorRoomChange, 0); return; } if (dataGridView1["ChallengerID", i].Value.ToString() != Ap.CurrentUserID.ToString()) { if ((dataGridView1["Conditions", i].Value.ToString() == "true" || dataGridView1["Conditions", i].Value.ToString() == "Rated") && Ap.CurrentUser.IsGuest) { MessageForm.Show(this.ParentForm, MsgE.ErrorGuestAcceptChallenge); return; } if (dataGridView1["challengeStatusID", i].Value.ToString() == "1") { int challengeID = UData.ToInt32(dataGridView1[0, i].Value); InfinityChess.WinForms.MainOnline.LoadGameByChallengeID(challengeID); Ap.CanAutoChallenge = true; } } }
private void dataGridView1_SelectionChanged(object sender, EventArgs e) { if (dataGridView1.SelectedRows.Count > 0) { if (SelectPlayer != null) { int userID = UData.ToInt32(dataGridView1.SelectedRows[0].Cells[0].Value.ToString()); string userName = dataGridView1.SelectedRows[0].Cells[2].Value.ToString(); string userRank = dataGridView1.SelectedRows[0].Cells[14].Value.ToString(); SelectPlayer(userID, userName, userRank); } } }
public static int Login(Cxt cxt, string userName, string password) { DataSet ds = Login(cxt, userName, password, "", "", "", DateTime.Now); if (ds.Tables.Count > 1) { return(UData.ToInt32(ds.Tables[1].Rows[0]["UserId"])); } else { return(0); } }
public OnlineClient() { InitializeComponent(); if (!string.IsNullOrEmpty(KeyValues.Instance.GetKeyValue(KeyValueE.RefreshIntervalOnlineClient).Value)) { timer1.Interval = UData.ToInt32(KeyValues.Instance.GetKeyValue(KeyValueE.RefreshIntervalOnlineClient).Value); } if (!string.IsNullOrEmpty(KeyValues.Instance.GetKeyValue(KeyValueE.Heartbeat).Value)) { timerHeartbeat.Interval = UData.ToInt32(KeyValues.Instance.GetKeyValue(KeyValueE.Heartbeat).Value); } }
public void MovePrevious() { if (wrapPanel.Children.Count > 0) { TextBlock target = (TextBlock)wrapPanel.Children[SelectedIndex]; if (!string.IsNullOrEmpty(target.Tag.ToString())) { Move m = this.Game.Moves.GetById(UData.ToInt32(target.Tag)); if (m != null) { this.Game.MoveTo(MoveToE.Previous); } } } }
private void toolStripButtonDelete_Click(object sender, EventArgs e) { if (dataGridView1.SelectedRows.Count != 0 && Ap.SelectedRoomID != (int)RoomE.HumanTournaments && Ap.SelectedRoomParentID != (int)RoomE.HumanTournaments) { int i = dataGridView1.CurrentRow.Index; int ChallengeID = UData.ToInt32(dataGridView1["ChallengeID", i].Value); int ChallengerID = UData.ToInt32(dataGridView1["ChallengerID", i].Value); ChallengeTypeE challengeType = (ChallengeTypeE)UData.ToInt32(dataGridView1["Type", i].Value); DataSet ds = SocketClient.DeleteChallenge(ChallengeID, ChallengerID, challengeType); if (ds != null && ds.Tables.Count > 0) { LoadChallenges(ds.Tables[0]); } } }
private void ViewGame(DataGridViewRow row) { if (row.Cells[9].Value.ToString() == "In progress") { if (Convert.ToInt32(row.Cells[3].Value) == Ap.CurrentUserID || Convert.ToInt32(row.Cells[6].Value) == Ap.CurrentUserID) { return; } } if (row.Cells[0].Value != null && !String.IsNullOrEmpty(row.Cells[0].Value.ToString()) && (Ap.CurrentUser.UserStatusIDE == UserStatusE.Blank || Ap.CurrentUser.UserStatusIDE == UserStatusE.Engine || Ap.CurrentUser.UserStatusIDE == UserStatusE.Centaur)) { int GameID = UData.ToInt32(row.Cells[0].Value); SocketClient.AddAudience(GameID); InfinityChess.WinForms.MainOnline.ShowMainOnline(GameID); } }
public static DataTable LoginKv(Kv kv) { DataSet ds = Login(kv.Cxt, kv.Get("LoginID"), kv.Get("Password"), kv.Get("AccessCode"), kv.Get("Ip"), kv.Get("MachineCode"), Convert.ToDateTime(kv.Get("ServerDate"))); int msgId = UData.ToInt32(ds.Tables[0].Rows[0]["MsgId"]); kv = new Kv(); kv.Set("Msg", UData.ToString(ds.Tables[0])); if (ds.Tables.Count > 1) { kv.Set("UserData", UData.ToString(ds.Tables[1])); kv.Set("RolesData", UData.ToString(ds.Tables[2])); } return(kv.DataTable); }
private void toolStripButtonModify_Click(object sender, EventArgs e) { if (dataGridView1.SelectedRows.Count != 0 && Ap.SelectedRoomID != (int)RoomE.HumanTournaments && Ap.SelectedRoomParentID != (int)RoomE.HumanTournaments) { int i = dataGridView1.CurrentRow.Index; if (UData.ToInt32(dataGridView1["ChallengerID", i].Value) != Ap.CurrentUserID && UData.ToInt32(dataGridView1["Type", i].Value) != (int)ChallengeTypeE.Seek) { ChallengeWindow frm = new ChallengeWindow(); frm.IsModify = true; frm.ChallengeID = UData.ToInt32(dataGridView1["ChallengeID", i].Value); frm.opponentUserID = UData.ToInt32(dataGridView1["ChallengerID", i].Value); frm.opponentUserName = dataGridView1["OpponentName", i].Value.ToString(); frm.ShowDialog(); } } }
bool OpenBestBiltzGame() { bool isGameRunning = false; DataSet dsPlayer = SocketClient.HighestRankingPlayerGame(); if (dsPlayer.Tables.Count > 0) { if (dsPlayer.Tables[0].Rows[0]["GameID"] != System.DBNull.Value) { int GameID = UData.ToInt32(dsPlayer.Tables[0].Rows[0]["GameID"]); SocketClient.AddAudience(GameID); MainOnline.ShowMainOnline(GameID); isGameRunning = true; } } return(isGameRunning); }
private void btnOK_Click(object sender, EventArgs e) { UserFormulas.Instance = null; UserFormulaDataKv formula = new UserFormulaDataKv(); formula.UserID = Ap.CurrentUserID; formula.IsUnrated = chkUnrated.Checked; formula.IsRated = chkRated.Checked; formula.IsDucate = chkDucats.Checked; formula.IsNoComputer = chkNoComputer.Checked; formula.IsNoCentaur = chkNoCentaur.Checked; formula.IsFastInternetOnly = chkFastInternet.Checked; formula.MinElo = UData.ToInt32(numericMinElo.Value); formula.MaxElo = UData.ToInt32(numericMaxElo.Value); formula.MinTime = UData.ToInt32(numericMinTime.Value); formula.MaxTime = UData.ToInt32(numericMaxTime.Value); formula.MinGainPerMove = UData.ToInt32(numericMinGain.Value); formula.MaxGainPerMove = UData.ToInt32(numericMaxGain.Value); formula.RankID = UData.ToInt32(comboBoxMinRank.SelectedValue); formula.DucatesToOverride = UData.ToInt32(numericMinDucats.Value); formula.IsActive = chkActivate.Checked; try { DataSet ds = SocketClient.UpdateFormula(formula); if (ds != null && ds.Tables.Count > 0) { ChallengesUc.Instance.LoadChallenges(ds.Tables[0]); } } catch (Exception ex) { TestDebugger.Instance.WriteError(ex); } this.Close(); }
public static DataTable LoginGuest(Kv kv) { DataSet ds = Login(kv.Cxt, kv.Get("LoginID"), kv.Get("Password"), kv.Get("AccessCode"), kv.Get("Ip"), kv.Get("MachineCode"), DateTime.Now); int msgId = UData.ToInt32(ds.Tables[0].Rows[0]["MsgId"]); Kv kvOut = new Kv(); kvOut.Cxt = kv.Cxt; kvOut.Set("MsgId", msgId); kvOut.Set("ServerDateTime", DateTime.Now.ToString()); if ((SignInMsgE)msgId == SignInMsgE.UserNotFound) { kvOut = GetGuest(kvOut.Cxt, kv.Get("AccessCode")); } else { if (ds.Tables.Count > 1) { kvOut.Set("UserData", UData.ToString(ds.Tables[1])); kvOut.Set("RolesData", UData.ToString(ds.Tables[2])); } } System.Diagnostics.Debug.WriteLine("**************** S T A R T **************"); string s = UData.ToString(ds); if (String.IsNullOrEmpty(s)) { System.Diagnostics.Debug.WriteLine("<EMPTY DATASET>"); } else { System.Diagnostics.Debug.WriteLine("ROWS=" + kvOut.DataTable.Rows.Count); } return(kvOut.DataTable); }
private void toolStripButtonDelete_Click(object sender, EventArgs e) { if (dataGridView1.SelectedRows.Count > 0) { DialogResult dr = MessageForm.Confirm(this.ParentForm, MsgE.ConfirmEmailDelete, ""); if (dr == DialogResult.Yes) { int messageId = UData.ToInt32(dataGridView1.SelectedRows[0].Cells[0].Value.ToString()); int statusIDTo = UData.ToInt32(dataGridView1.SelectedRows[0].Cells[10].Value.ToString()); DataSet ds = SocketClient.DeleteEmail(messageId, (int)StatusE.Deleted, statusIDTo); if (ds != null && ds.Tables.Count > 0) { this.LoadMessages(ds.Tables[0]); } else { this.LoadMessages(null); editor1.BodyHtml = ""; } } } }
private void rootPreviewMouseDown(object sender, RoutedEventArgs e) { if (!(e.OriginalSource.GetType() == typeof(TextBlock))) { return; } TextBlock target = (TextBlock)e.OriginalSource; target = CheckComments(target); if (target != null && target.Tag != null && !string.IsNullOrEmpty(target.Tag.ToString())) { Move m = this.Game.Moves.GetById(UData.ToInt32(target.Tag)); if (m != null) { this.Game.MoveTo(m); } } e.Handled = true; wrapPanel.Focus(); }
private void ChallengeGame(DataGridViewRow row) { if (Ap.IsGameInProgress) { return; } if (Ap.SelectedRoomID == (int)RoomE.HumanTournaments || Ap.SelectedRoomParentID == (int)RoomE.HumanTournaments || Ap.SelectedRoomID == (int)RoomE.EngineTournaments || Ap.SelectedRoomParentID == (int)RoomE.EngineTournaments) { return; } if (Convert.ToInt32(row.Cells[0].Value) == Ap.CurrentUserID) { MessageForm.Error(this.ParentForm, MsgE.ErrorChallangeYourself); return; } if (UData.ToInt32(row.Cells[20].Value.ToString()) == (int)UserStatusE.Blank || UData.ToInt32(row.Cells[20].Value.ToString()) == (int)UserStatusE.Engine || UData.ToInt32(row.Cells[20].Value.ToString()) == (int)UserStatusE.Centaur || UData.ToInt32(row.Cells[20].Value.ToString()) == (int)UserStatusE.Kibitzer) { if (!String.IsNullOrEmpty(row.Cells[21].Value.ToString()) && Convert.ToBoolean(row.Cells[21].Value.ToString())) { MessageForm.Show(this.ParentForm, MsgE.ChallengePauseUser, row.Cells[2].Value.ToString()); return; } //MessageForm.Show(dataGridView1[2, e.RowIndex].Value + " : " + UserStatusE.Idle.ToString()); ChallengeWindow frm = new ChallengeWindow(); frm.IsModify = false; frm.opponentUserID = SelectedUserId; frm.opponentUserName = SelectedUserName; frm.opponentRank = SelectedUserRank; frm.ShowDialog(); } }
private void dataGridView1_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e) { if (e.ColumnIndex == 5 || e.ColumnIndex == 8 || e.ColumnIndex == 9 || e.ColumnIndex == 10 || e.ColumnIndex == 13) { if (dataGridView1["WhiteUserID", e.RowIndex].Value.ToString() != userID.ToString()) { switch (e.ColumnIndex) { case 5: e.Value = dataGridView1["WhiteUserName", e.RowIndex].Value; break; case 8: e.Value = dataGridView1["EloWhite", e.RowIndex].Value; break; case 9: if (dataGridView1["GameResultID", e.RowIndex].Value != null) { string result = string.Empty; GameResultE gameResult = (GameResultE)UData.ToInt32(dataGridView1["GameResultID", e.RowIndex].Value.ToString()); switch (gameResult) { case GameResultE.None: break; case GameResultE.InProgress: break; case GameResultE.WhiteWin: result = "0"; break; case GameResultE.WhiteLose: result = "1"; break; case GameResultE.Draw: result = "1/2"; break; case GameResultE.Absent: break; case GameResultE.NoResult: break; case GameResultE.WhiteBye: result = "1"; break; case GameResultE.BlackBye: result = "0"; break; case GameResultE.ForcedWhiteWin: result = "0"; break; case GameResultE.ForcedWhiteLose: result = "1"; break; case GameResultE.ForcedDraw: result = "1/2"; break; default: break; } e.Value = result; } break; case 10: e.Value = "White"; break; case 13: if (dataGridView1["WhiteUserCountry", e.RowIndex].Value != null && dataGridView1["WhiteUserCountry", e.RowIndex].Value.ToString() != "" && dataGridView1["WhiteUserCountry", e.RowIndex].Value.ToString() != "0") { Image item = Image.FromFile(App.Model.Ap.FolderImages + @"Flags\" + dataGridView1["WhiteUserCountry", e.RowIndex].Value + ".PNG"); e.Value = item; } else { Image item = Image.FromFile(App.Model.Ap.FolderImages + @"Flags\244.PNG"); e.Value = item; } break; } } else { switch (e.ColumnIndex) { case 5: e.Value = dataGridView1["BlackUserName", e.RowIndex].Value; break; case 8: e.Value = dataGridView1["EloBlack", e.RowIndex].Value; break; case 9: if (dataGridView1["GameResultID", e.RowIndex].Value != null) { string result = string.Empty; GameResultE gameResult = (GameResultE)UData.ToInt32(dataGridView1["GameResultID", e.RowIndex].Value.ToString()); switch (gameResult) { case GameResultE.None: break; case GameResultE.InProgress: break; case GameResultE.WhiteWin: result = "1"; break; case GameResultE.WhiteLose: result = "0"; break; case GameResultE.Draw: result = "1/2"; break; case GameResultE.Absent: break; case GameResultE.NoResult: break; case GameResultE.WhiteBye: result = "0"; break; case GameResultE.BlackBye: result = "1"; break; case GameResultE.ForcedWhiteWin: result = "1"; break; case GameResultE.ForcedWhiteLose: result = "0"; break; case GameResultE.ForcedDraw: result = "1/2"; break; default: break; } e.Value = result; } break; case 10: e.Value = "Black"; break; case 13: if (dataGridView1["BlackUserCountry", e.RowIndex].Value != null && dataGridView1["BlackUserCountry", e.RowIndex].Value.ToString() != "" && dataGridView1["BlackUserCountry", e.RowIndex].Value.ToString() != "0") { Image item = Image.FromFile(App.Model.Ap.FolderImages + @"Flags\" + dataGridView1["BlackUserCountry", e.RowIndex].Value + ".PNG"); e.Value = item; } else { Image item = Image.FromFile(App.Model.Ap.FolderImages + @"Flags\244.PNG"); e.Value = item; } break; } } } }
private void dataGridView1_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e) { if (e.ColumnIndex == 1 || e.ColumnIndex == 4 || e.ColumnIndex == 10 || e.ColumnIndex == 13 || e.ColumnIndex == 16) { if (dataGridView1["ChallengerID", e.RowIndex].Value.ToString() == Ap.CurrentUserID.ToString()) { switch (e.ColumnIndex) { case 1: if (dataGridView1["Type", e.RowIndex].Value != null && dataGridView1["Type", e.RowIndex].Value.ToString() != "") { if (UData.ToInt32(dataGridView1["Type", e.RowIndex].Value) == (int)ChallengeTypeE.Seek) { Image item = Image.FromFile(App.Model.Ap.FolderImages + @"Challenges\outgoingSeek.png"); e.Value = item; } else if (UData.ToInt32(dataGridView1["Type", e.RowIndex].Value) == (int)ChallengeTypeE.Challenge) { Image item = Image.FromFile(App.Model.Ap.FolderImages + @"Challenges\outgoing.png"); e.Value = item; } else if (UData.ToInt32(dataGridView1["Type", e.RowIndex].Value) == (int)ChallengeTypeE.Modify) { Image item = Image.FromFile(App.Model.Ap.FolderImages + @"Challenges\modify.ico"); e.Value = item; } else { Image item = Image.FromFile(App.Model.Ap.FolderImages + @"Challenges\decline.png"); e.Value = item; } } break; case 4: e.Value = dataGridView1["OpponentName", e.RowIndex].Value; break; case 10: if (dataGridView1["OpponentElo", e.RowIndex].Value.ToString() == "0") { e.Value = ""; } else { e.Value = dataGridView1["OpponentElo", e.RowIndex].Value; } break; case 13: if (dataGridView1["Type", e.RowIndex].Value != null && dataGridView1["Type", e.RowIndex].Value.ToString() != "") { if (UData.ToInt32(dataGridView1["Type", e.RowIndex].Value) == (int)ChallengeTypeE.Seek) { e.Value = "Seek"; } else if (UData.ToInt32(dataGridView1["Type", e.RowIndex].Value) == (int)ChallengeTypeE.Challenge) { e.Value = "Outgoing"; } else if (UData.ToInt32(dataGridView1["Type", e.RowIndex].Value) == (int)ChallengeTypeE.Modify) { e.Value = "Modify"; } else { e.Value = "Decline"; } } break; case 16: if (dataGridView1["InternetO", e.RowIndex].Value != null && dataGridView1["InternetO", e.RowIndex].Value.ToString() != "" && dataGridView1["InternetO", e.RowIndex].Value.ToString() != "0") { Image item = Image.FromFile(App.Model.Ap.FolderImages + @"Internet\" + dataGridView1["InternetO", e.RowIndex].Value + ".PNG"); e.Value = item; dataGridView1["Internet", e.RowIndex].ToolTipText = dataGridView1["InternetTooltipO", e.RowIndex].Value.ToString(); } else { Image item = Image.FromFile(App.Model.Ap.FolderImages + @"Flags\244.PNG"); e.Value = item; } break; } } else { switch (e.ColumnIndex) { case 1: if (dataGridView1["Type", e.RowIndex].Value != null && dataGridView1["Type", e.RowIndex].Value.ToString() != "") { if (UData.ToInt32(dataGridView1["Type", e.RowIndex].Value) == (int)ChallengeTypeE.Seek) { Image item = Image.FromFile(App.Model.Ap.FolderImages + @"Challenges\incomingSeek.png"); e.Value = item; } else if (UData.ToInt32(dataGridView1["Type", e.RowIndex].Value) == (int)ChallengeTypeE.Modify) { Image item = Image.FromFile(App.Model.Ap.FolderImages + @"Challenges\modify.ico"); e.Value = item; } else { Image item = Image.FromFile(App.Model.Ap.FolderImages + @"Challenges\incoming.png"); e.Value = item; } } break; case 4: e.Value = dataGridView1["ChallengerName", e.RowIndex].Value; break; case 10: if (dataGridView1["OpponentElo", e.RowIndex].Value.ToString() == "0") { e.Value = ""; } else { e.Value = dataGridView1["ChallengerElo", e.RowIndex].Value; } break; case 13: if (dataGridView1["Type", e.RowIndex].Value != null && dataGridView1["Type", e.RowIndex].Value.ToString() != "") { if (UData.ToInt32(dataGridView1["Type", e.RowIndex].Value) == (int)ChallengeTypeE.Seek) { e.Value = "Seek"; } else if (UData.ToInt32(dataGridView1["Type", e.RowIndex].Value) == (int)ChallengeTypeE.Modify) { e.Value = "Modify"; } else { e.Value = "Incoming"; } } break; case 16: if (dataGridView1["InternetC", e.RowIndex].Value != null && dataGridView1["InternetC", e.RowIndex].Value.ToString() != "" && dataGridView1["InternetC", e.RowIndex].Value.ToString() != "0") { Image item = Image.FromFile(App.Model.Ap.FolderImages + @"Internet\" + dataGridView1["InternetC", e.RowIndex].Value + ".PNG"); e.Value = item; dataGridView1["Internet", e.RowIndex].ToolTipText = dataGridView1["InternetTooltipC", e.RowIndex].Value.ToString(); } else { Image item = Image.FromFile(App.Model.Ap.FolderImages + @"Flags\244.PNG"); e.Value = item; } break; } } } if (e.ColumnIndex == 7) { if (dataGridView1[7, e.RowIndex].Value != null && Convert.ToBoolean(dataGridView1[7, e.RowIndex].Value.ToString())) { e.Value = "Rated"; } else { if (Convert.ToBoolean(dataGridView1["IsChallengerSendsGame", e.RowIndex].Value)) { e.Value = "Unrated, Send Opening"; } else { e.Value = "Unrated"; } } } }
public void LoadChallenges(DataTable table) { if (AutometicAcceptTournamentChallenges(table)) { dataGridView1.DataSource = null; return; } if (Ap.CurrentUser.IsPause) { return; } int index = 0; DataGridViewColumn oldColumn = new DataGridViewColumn(); SortOrder so = SortOrder.None; if (dataGridView1 != null && dataGridView1.Rows.Count > 0) { if (dataGridView1.SelectedRows.Count > 0) { index = dataGridView1.SelectedRows[0].Index; } oldColumn = dataGridView1.SortedColumn; so = dataGridView1.SortOrder; } dataGridView1.AutoGenerateColumns = false; dataGridView1.DataSource = null; if (Ap.CurrentUser.HumanRankIDE == RankE.Guest && Ap.SelectedRoomID != (int)RoomE.Cafe && Ap.SelectedRoomID != (int)RoomE.Broadcasts && Ap.SelectedRoomID != (int)RoomE.EngineHall) { return; } table = CheckUserFormula(table); if (table == null) { AutometicAcceptChallenges(table); return; } //DataRow[] dr = table.Select("ChallengerUserID <> " + Ap.CurrentUserID + " AND Type = " + (int)ChallengeTypeE.Decline); DataTable dt = new DataTable(); dt = table.Clone(); foreach (DataRow dr in table.Rows) { if (UData.ToInt32(dr["ChallengerUserID"].ToString()) != Ap.CurrentUserID && UData.ToInt32(dr["Type"].ToString()) == (int)ChallengeTypeE.Decline) { //DO NOTHING } else { dt.ImportRow(dr); } } dataGridView1.DataSource = dt; if (oldColumn != null) { switch (so) { case SortOrder.Ascending: this.dataGridView1.Sort(oldColumn, ListSortDirection.Ascending); break; case SortOrder.Descending: this.dataGridView1.Sort(oldColumn, ListSortDirection.Descending); break; case SortOrder.None: break; default: break; } } //dataGridView1.Refresh(); if (dataGridView1.Rows.Count > index) { dataGridView1.FirstDisplayedScrollingRowIndex = index; dataGridView1.Rows[index].Selected = true; } AutometicAcceptChallenges(dt); }
private void btnOK_Click(object sender, EventArgs e) { if (Ap.IsGameInProgress) { PlayingModeData.Instance.AutometicChallenges = chkAutomaticChallenges.Checked; PlayingModeData.Instance.AutometicAccepts = chkAutometicAccepts.Checked; this.Close(); } else { string engineName = string.Empty; UserStatusE userStatus; if (rbHuman.Checked) { if (selectedEngine != null) { selectedEngine.Close(); selectedEngine = null; } Ap.PlayingMode.ChessTypeID = 1; PlayingModeData.Instance.AutometicChallenges = false; PlayingModeData.Instance.AutometicAccepts = false; PlayingModeData.Instance.SendEvaluations = false; PlayingModeData.Instance.SendExpectedMoves = false; userStatus = UserStatusE.Blank; } else if (rbComputer.Checked) { if (selectedEngine == null) { MessageForm.Show(this, MsgE.InfoUploadEngine); return; } engineName = selectedEngine.EngineName; Ap.PlayingMode.ChessTypeID = 2; PlayingModeData.Instance.AutometicChallenges = chkAutomaticChallenges.Checked; PlayingModeData.Instance.AutometicAccepts = chkAutometicAccepts.Checked; PlayingModeData.Instance.SendEvaluations = chkSendEvaluations.Checked; PlayingModeData.Instance.SendExpectedMoves = chkSendExpectedMove.Checked; PlayingModeData.Instance.Time = UData.ToInt32(numericUpDown1.Value); PlayingModeData.Instance.GainPerMove = UData.ToInt32(numericUpDown2.Value); Ap.CurrentUser.UserStatusIDE = userStatus = UserStatusE.Engine; ChatClient.Write(ChatTypeE.OnlineClient, ChatMessageTypeE.Info, ChatTypeE.OnlineClient, "'" + engineName + "' loaded successfully", 0); } else { Ap.PlayingMode.ChessTypeID = 3; PlayingModeData.Instance.AutometicChallenges = false; PlayingModeData.Instance.AutometicAccepts = false; PlayingModeData.Instance.SendEvaluations = false; PlayingModeData.Instance.SendExpectedMoves = false; Ap.CurrentUser.UserStatusIDE = userStatus = UserStatusE.Centaur; } SocketClient.SetUserEngine(engineName, userStatus); PlayingModeData.Instance.Pause = Ap.CurrentUser.IsPause; PlayingModeData.Instance.ChessTypeID = Ap.PlayingMode.ChessTypeID; PlayingModeData.Instance.Save(); Ap.PlayingMode.SelectedEngine = selectedEngine; Ap.PlayingMode.SelectedBook = selectedBook; this.Close(); } }
public void SetDataByRoomId(DataSet ds, bool isFromTimer) { try { if (ds != null && ds.Tables.Count > 0) { if (ds.Tables["Room"] != null && ds.Tables["Room"].Rows.Count > 0) { Room room = new Room(Ap.Cxt, ds.Tables["Room"].Rows[0]); if (!string.IsNullOrEmpty(room.TournamentID.ToString())) { Ap.SelectedRoomParentID = room.ParentID; Ap.RoomTournamentID = room.TournamentID; isUrlBit = room.IsUrlBit; url = string.Empty; if (isUrlBit) { if (DBNull.Value.ToString() != room.Html && room.Html != string.Empty) { url = room.Html; } } if (LoadRoomInfoPage != null && !isFromTimer) { LoadRoomInfoPage(Ap.SelectedRoomID, Ap.RoomTournamentID, url); } } } if (ds.Tables["LoggedinUsers"].Rows.Count > 0) { if (!string.IsNullOrEmpty(ds.Tables["LoggedinUsers"].Rows[0]["LoggedinUser"].ToString())) { tsUserCounter.Text = ds.Tables["LoggedinUsers"].Rows[0]["LoggedinUser"].ToString(); } } if (ds.Tables.Count == 0) { return; } if (LoadPlayerGrid != null) { LoadPlayerGrid(ds.Tables["Users"]); } if (LoadGameGrid != null) { LoadGameGrid(ds.Tables["Games"]); } if (LoadChallengeGrid != null) { LoadChallengeGrid(ds.Tables["Challenges"]); } if (LoadUserMessages != null) { if (ds.Tables["UserMessages"] != null) { LoadUserMessages(ds.Tables["UserMessages"]); } } if (ds.Tables["RoomUsersCount"] != null) { if (ds.Tables["RoomUsersCount"].Rows.Count > 0) { if (treeView1.Nodes.Count > 0) { SetRoomUsersCount(ds); } } } if (ds.Tables["AcceptedChallenge"] != null) { if (ds.Tables["AcceptedChallenge"].Rows.Count > 0) { int challengeID = UData.ToInt32(ds.Tables["AcceptedChallenge"].Rows[0]["ChallengeID"]); InfinityChess.WinForms.MainOnline.ShowMainOnline(challengeID, ChallengeStatusE.Accepted, 0); Ap.CanAutoChallenge = true; return; } } //Only for human tounament rooms if (Ap.SelectedRoomID > (int)RoomE.EngineTournaments && Ap.SelectedRoomParentID != (int)RoomE.ComputerChess && Ap.SelectedRoomParentID != (int)RoomE.EngineTournaments) { if (Ap.IsGameInProgress || Ap.KibitzersCount > 0) { return; } Ap.CurrentUser.UserStatusIDE = UserStatusE.Blank; Ap.CurrentUser.EngineID = 1; Ap.PlayingMode.ChessTypeID = 1; PlayingModeData.Instance.ChessTypeID = 1; if (Ap.PlayingMode.SelectedEngine != null) { Ap.PlayingMode.SelectedEngine.Close(); Ap.PlayingMode.SelectedEngine = null; } SocketClient.SetUserEngine(string.Empty, Ap.CurrentUser.UserStatusIDE); } return; } else { return; } } catch (Exception ex) { TestDebugger.Instance.WriteError(ex); } }