private void ProcessRows() { foreach (var dataItem in dg_win_regex.ItemsSource) { myReplay rep = dataItem as myReplay; if (String.Equals(rep.NAME, "PAX")) { DataGridRow gridRow = dg_win_regex.ItemContainerGenerator.ContainerFromItem(dataItem) as DataGridRow; if (gridRow != null) { gridRow.Background = Brushes.YellowGreen; } } } }
public List <myGame> LoadCollectionData() { string csv = mw.myStats_csv; string line; ///string pattern = @"^(\d+); ([^;]+); ([^;]+); ([^;]+); ([^;]+); ([^;]+); ([^;]+); ([^;]+); ([^;]+); ([^;]+); ([^;]+); ([^;]+); ([^;]+);"; string[] myline = new string[12]; string id = null; char[] cTrim = { ' ' }; List <myReplay> single_replays = new List <myReplay>(); if (File.Exists(csv)) { System.IO.StreamReader file_c = new System.IO.StreamReader(csv); int i = 0; while (file_c.ReadLine() != null) { i++;; } int j = 0; System.IO.StreamReader file = new System.IO.StreamReader(csv); while ((line = file.ReadLine()) != null) { j++; myline = line.Split(';'); for (int k = 0; k <= 12; k++) { string result = myline[k].Trim(cTrim); myline[k] = result; } myReplay rep = new myReplay() { ID = int.Parse(myline[0]), REPLAY = myline[1], NAME = myline[2], RACE = myline[4], TEAM = int.Parse(myline[5]), RESULT = int.Parse(myline[6]), KILLSUM = int.Parse(myline[7]), DURATION = int.Parse(myline[8]), GAMETIME = double.Parse(myline[9]), PLAYERID = int.Parse(myline[10]), INCOME = double.Parse(myline[11], CultureInfo.InvariantCulture), ARMY = int.Parse(myline[12]) }; replays.Add(rep); if (id == null) { id = rep.REPLAY; } if (String.Equals(id, rep.REPLAY)) { single_replays.Add(rep); } else { collectData(single_replays); id = rep.REPLAY; single_replays.Clear(); single_replays.Add(rep); } if (j == i) { collectData(single_replays); } /** * foreach (Match m in Regex.Matches(line, pattern)) * { * string value1 = m.Groups[2].ToString() + ".SC2Replay"; * * * } **/ ///if (i > 2000) ///break; } file.Close(); } else { MessageBox.Show("No data found :(", "sc2dsstats"); } return(games); }