private void btn_AddCompetitor_Click(object sender, EventArgs e) { List <Competitor> singleCompetitor = new List <Competitor>(); var Username = txt_addUsername.Text.Trim(); var Start = 0; try { Start = Convert.ToInt32(txt_addStartFrame.Text.Trim()); } catch { Start = -1; } var End = 0; try { End = Convert.ToInt32(txt_addEndFrame.Text.Trim()); } catch { End = -1; } var Rerecs = 0; try { Rerecs = Convert.ToInt32(txt_addRerecords.Text.Trim()); } catch { Rerecs = -1; } var DQ = false; var Comment = ""; if (checkBox_DQ.Checked) { DQ = true; Comment = DQString(); } else { DQ = false; Comment = ""; } Competitor newCompetitor = new Competitor(1, Username, Start, End, Rerecs, DQ, Comment); singleCompetitor.Add(newCompetitor); WriteToDataGrid(singleCompetitor); // Spaghetti // txt_addUsername.Clear(); txt_addStartFrame.Clear(); txt_addEndFrame.Clear(); txt_addRerecords.Clear(); checkBox_DQ.Checked = false; chk_DQ_M64Early.Checked = false; chk_DQ_FailedGoal.Checked = false; chk_DQ_StratTalk.Checked = false; chk_DQ_IllegalInteraction.Checked = false; chk_DQ_Desync.Checked = false; chk_DQ_Other.Checked = false; txt_DQ_Other.Clear(); Refresh(); // End spaghetti // GridSortRank(); }
private void btn_Submit_Click(object sender, EventArgs e) { try { for (int i = 0; i < txt_Input.Lines.Length; i++) { string line = txt_Input.Lines[i]; var var = line.Split(' '); var time = var[1].Split('"'); int frames = (int)(Convert.ToDouble($"{time[0]}.{time[1]}") * 60); Competitor competitor = new Competitor(0, var[0], 0, frames, 0, false, ""); compList.Add(competitor); } this.Close(); } catch { MessageBox.Show("Whoops, please use the appropriate format!!!"); } }
public List <Competitor> CompObjectCompile() { List <Competitor> CompetitionList = new List <Competitor>(); for (int row = 0; row < dataGrid_TASData.Rows.Count - 1; row++) { //int rank = row + 1; int rank = -1; try { rank = Convert.ToInt32(dataGrid_TASData.Rows[row].Cells[0].Value); } catch { rank = -1; } int start = 0; try { start = Convert.ToInt32(dataGrid_TASData.Rows[row].Cells[2].Value); } catch { start = -1; } int end; try { end = Convert.ToInt32(dataGrid_TASData.Rows[row].Cells[3].Value); } catch { end = -1; } int rerecs; try { rerecs = Convert.ToInt32(dataGrid_TASData.Rows[row].Cells[5].Value); } catch { rerecs = -1; } string username = $"{dataGrid_TASData.Rows[row].Cells[1].Value}"; bool dq; try { dq = (bool)dataGrid_TASData.Rows[row].Cells[6].Value; } catch { dq = false; } string comments = $"{dataGrid_TASData.Rows[row].Cells[7].Value}"; Competitor user = new Competitor(rank, username, start, end, rerecs, dq, comments); CompetitionList.Add(user); } return(CompetitionList); }