public void LoadTable(List <string> tables) { foreach (var row in tables) { var splitRow = row.Split(", "); if (splitRow[0] != rowName) { continue; } if (splitRow[3] == "-" && splitRow[4] == "-" && splitRow[5] == "-") { var entry = new NhlfeEntry(splitRow[2], null, null, null); entries.Add(int.Parse(splitRow[1]), entry); } else if (splitRow[3] == "-") { var entry = new NhlfeEntry(splitRow[2], null, int.Parse(splitRow[4]), int.Parse(splitRow[5])); entries.Add(int.Parse(splitRow[1]), entry); } else if (splitRow[4] == "-") { var entry = new NhlfeEntry(splitRow[2], int.Parse(splitRow[3]), null, int.Parse(splitRow[5])); entries.Add(int.Parse(splitRow[1]), entry); } else if (splitRow[5] == "-") { var entry = new NhlfeEntry(splitRow[2], int.Parse(splitRow[3]), int.Parse(splitRow[4]), null); entries.Add(int.Parse(splitRow[1]), entry); } else { Console.WriteLine("Unknown NHLFE entry."); } } }
private void LoadTableFromFile(string configFilePath) { foreach (var row in File.ReadAllLines(configFilePath)) { var splitRow = row.Split(", "); if (splitRow[0] != rowName) { continue; } if (splitRow[3] == "-" && splitRow[4] == "-" && splitRow[5] == "-") { var entry = new NhlfeEntry(splitRow[2], null, null, null); entries.Add(int.Parse(splitRow[1]), entry); } else if (splitRow[3] == "-") { var entry = new NhlfeEntry(splitRow[2], null, int.Parse(splitRow[4]), int.Parse(splitRow[5])); entries.Add(int.Parse(splitRow[1]), entry); } else if (splitRow[4] == "-") { var entry = new NhlfeEntry(splitRow[2], int.Parse(splitRow[3]), null, int.Parse(splitRow[5])); entries.Add(int.Parse(splitRow[1]), entry); } else if (splitRow[5] == "-") { var entry = new NhlfeEntry(splitRow[2], int.Parse(splitRow[3]), int.Parse(splitRow[4]), null); entries.Add(int.Parse(splitRow[1]), entry); } else { Console.WriteLine("Unknown NHLFE entry."); } } }