private void ValidateEngine() { try { if (!IsEngineAlreadyLoaded(engineFileName)) { UCIEngineValidator ev = new UCIEngineValidator(sourceFilePath, this.Game); ev.NameReceived += new UCIEngine.NameReceivedHandler(ev_NameReceived); ev.AuthorReceived += new UCIEngine.AuthorReceivedHandler(ev_AuthorReceived); ev.UciValidated += new EventHandler(ev_UciValidated); ev.UciInvalidated += new EventHandler(ev_UciInvalidated); ev.Validate(); } else { frmProgress.Close(); btnBrowse.Enabled = true; MessageForm.Error(this, MsgE.ErrorUciEngine); } } catch (Exception ex) { TestDebugger.Instance.WriteError(ex); frmProgress.Close(); btnBrowse.Enabled = true; MessageForm.Error(this, MsgE.ErrorInvalidUciEngine); } }
public void BanUserMachineList() { ProgressForm frmProgress = ProgressForm.Show(this, "Loading Ban Uers Machines..."); try { DataSet ds = SocketClient.GetAllBanUserMachine(); dataGridView1.AutoGenerateColumns = false; if (ds != null) { if (ds.Tables.Count > 0) { table = ds.Tables[0]; } else { table = null; } } RefreshGrid(table); } catch (Exception ex) { MessageForm.Show(ex); } frmProgress.Close(); }
private void RefreshGrid() { ProgressForm frmProgress = ProgressForm.Show(this, "Loading Users..."); try { dataGridView1.AutoGenerateColumns = false; DataSet ds = SocketClient.GetAllUserByID(); if (ds != null) { if (ds.Tables.Count > 0) { table = ds.Tables[0]; } else { table = null; } } RefreshGrid(table); } catch (Exception ex) { MessageForm.Show(ex); } frmProgress.Close(); }
public void RefreshGrid() { ProgressForm frmProgress = ProgressForm.Show(this, "Loading IPs..."); try { dataGridView1.AutoGenerateColumns = false; DataSet ds = SocketClient.GetAllBlockedIPs(); if (ds != null) { if (ds.Tables.Count > 0) { table = ds.Tables[0]; } else { table = null; } } RefreshGrid(table); } catch (Exception ex) { TestDebugger.Instance.WriteError(ex); MessageForm.Show(ex); } frmProgress.Close(); }
void UpdateBanStatus(StatusE statusID) { try { int i = 0; string userIDs = string.Empty; foreach (DataGridViewRow row in dataGridView1.Rows) { if (row.Cells[0].Value != null) { if ((bool)row.Cells[0].Value) { int statusIDx = BaseItem.ToInt32(GridTable.Rows[i]["StatusID"]); if (statusIDx == (int)StatusE.Ban) { int userID = BaseItem.ToInt32(GridTable.Rows[i]["UserID"]); userIDs += "," + userID.ToString(); } } } i++; } if (userIDs.Length > 0) { userIDs = userIDs.Remove(0, 1); if (MessageForm.Confirm(this.ParentForm, MsgE.ConfirmItemTask, "remove ban", "user") == DialogResult.Yes) { ProgressForm frmProgress = ProgressForm.Show(this, "Removing Ban..."); SocketClient.UpdateBanStatus(statusID, userIDs); frmProgress.Close(); RefreshGrid(); MessageForm.Show(this.ParentForm, MsgE.InfoBanRemove); } } else { MessageForm.Show(this.ParentForm, MsgE.ErrorSelectCheckBox); } } catch (Exception ex) { MessageForm.Show(ex); } }
private void makeAdminToolStripMenuItem_Click(object sender, EventArgs e) { try { int i = 0; string userIDs = string.Empty; foreach (DataGridViewRow row in dataGridView1.Rows) { if (row.Cells[0].Value != null) { if ((bool)row.Cells[0].Value) { int userID = BaseItem.ToInt32(GridTable.Rows[i]["UserID"]); userIDs += "," + userID.ToString(); } } i++; } if (userIDs.Length > 0) { userIDs = userIDs.Remove(0, 1); if (MessageForm.Confirm(this.ParentForm, MsgE.ConfirmItemTask, "make", "admin") == DialogResult.Yes) { ProgressForm frmProgress = ProgressForm.Show(this, "Making Admin..."); SocketClient.MakeAdmin(userIDs, RankE.King, RoleE.Admin); frmProgress.Close(); RefreshGrid(); MessageForm.Show(this.ParentForm, MsgE.InfoMakeAdmin); } } else { MessageForm.Show(this.ParentForm, MsgE.ErrorSelectCheckBox); } } catch (Exception ex) { MessageForm.Show(ex); } }
private void DeleteTeams() { if (dgvTeam.Rows.Count == 0) { MessageForm.Error(this.ParentForm, MsgE.ErrorNoSelection, "team"); return; } try { int i = 0; string tournamentTeamIds = string.Empty; foreach (DataGridViewRow row in dgvTeam.Rows) { if (row.Cells[0].Value != null) { if ((bool)row.Cells[0].Value) { int teamId = BaseItem.ToInt32(TeamGridTable.Rows[i]["TeamID"]); tournamentTeamIds += "," + teamId.ToString(); } } i++; } if (tournamentTeamIds.Length > 0) { tournamentTeamIds = tournamentTeamIds.Remove(0, 1); ProgressForm frmProgress = ProgressForm.Show(this, "Removing Teams..."); SocketClient.DeleteTournamentTeam(tournamentTeamIds, this.Tournament.TournamentID); frmProgress.Close(); RefreshTeamGrid(); RefreshPlayerGrid(); } } catch (Exception ex) { TestDebugger.Instance.WriteError(ex); MessageForm.Show(ex); } }
private void RefreshGrid() { if (this.Tournament == null) { return; } if (this.Tournament.TournamentID == 0) { return; } ProgressForm frmProgress = ProgressForm.Show(this, "Loading Standings..."); try { DataSet ds = SocketClient.GetTournamentResultById(this.Tournament.TournamentID); if (ds != null) { if (ds.Tables.Count > 0) { table = ds.Tables[0]; RefreshGrid(table); FillWinners(table); } else { dgvResult.DataSource = null; LoadWinners(null); } } else { dgvResult.DataSource = null; LoadWinners(null); } } catch (Exception ex) { TestDebugger.Instance.WriteError(ex); } FormatGrid(); frmProgress.Close(); }
private void DeletePlayers() { if (dgvPlayer.Rows.Count == 0) { MessageForm.Error(this.ParentForm, MsgE.ErrorNoSelection, "player"); return; } try { int i = 0; string userIDs = string.Empty; foreach (DataGridViewRow row in dgvPlayer.Rows) { if (row.Cells[0].Value != null) { if ((bool)row.Cells[0].Value) { int userID = BaseItem.ToInt32(PlayerGridTable.Rows[i]["UserID"]); userIDs += "," + userID.ToString(); } } i++; } if (userIDs.Length > 0) { userIDs = userIDs.Remove(0, 1); ProgressForm frmProgress = ProgressForm.Show(this, "Removing Players..."); SocketClient.SaveTournamentRegisteredUsers(StatusE.Deleted, TournamentUserStatusE.Declined, this.Tournament.TournamentID, userIDs, SelectedTeamID, 0); frmProgress.Close(); RefreshPlayerGrid(); } } catch (Exception ex) { TestDebugger.Instance.WriteError(ex); MessageForm.Show(ex); } }
void UnBlockedIP() { try { int i = 0; string blockedIPIDs = string.Empty; BlockedIpItem ips = new BlockedIpItem(); foreach (DataGridViewRow row in dataGridView1.Rows) { if (row.Cells[0].Value != null) { if ((bool)row.Cells[0].Value) { Int32 blockedIps = BaseItem.ToInt32(GridTable.Rows[i]["BlockedIPID"]); blockedIPIDs += "," + blockedIps.ToString(); } } i++; } if (blockedIPIDs.Length > 0) { blockedIPIDs = blockedIPIDs.Remove(0, 1); ProgressForm frmProgress = ProgressForm.Show(this, "UnBlocking IPs..."); SocketClient.UnBlockIPs(blockedIPIDs); frmProgress.Close(); RefreshGrid(); MessageForm.Show(this.ParentForm, MsgE.InfoUnBlockedIPs); } else { MessageForm.Show(this.ParentForm, MsgE.ErrorSelectCheckBox); } } catch (Exception ex) { TestDebugger.Instance.WriteError(ex); MessageForm.Show(ex); } }
private void LoadImportGameData() { if (!databaseFileName.EndsWith(Files.DatabaseExtension)) { MessageForm.Error(this, MsgE.ErrorInvalidFileFormat); this.Close(); return; } try { ProgressForm frmProgress = ProgressForm.Show(this, "Loading Database..."); database = new Database(databaseFileName, this.Game); frmProgress.Close(); if (database.GamesCount > 0) { numFromGameNo.Value = 1; numToGameNo.Value = database.GamesCount; numFromGameNo.Maximum = database.GamesCount; numToGameNo.Maximum = database.GamesCount; } else { numFromGameNo.Maximum = 0; numToGameNo.Maximum = 0; numFromGameNo.Value = 0; numToGameNo.Value = 0; } fromGameNo = (int)numFromGameNo.Value; toGameNo = (int)numToGameNo.Value; } catch (Exception ex) { TestDebugger.Instance.WriteError(ex); MessageForm.Error(this, MsgE.ErrorInvalidFileFormat, ex); this.Close(); } }