static TsvData FindParent(int level, List <TsvData> data) { TsvData parent = data.LastOrDefault(o => o.Level + 1 == level); if (parent != null) { return(parent); } else { return(FindParent(level, data.Last().Children)); } }
public void ConvertToTsvData() { foreach (var line in Stream.Split('\n')) { string command = line.Split('\t')[0]; if (!TsvData.ContainsKey(command)) { TsvData.Add(command, new List <string>()); TsvData[command].AddRange(line.Split('\t')); TsvData[command].RemoveAt(0); for (int i = 0; i < TsvData[command].Count; i++) { TsvData[command][i] = TsvData[command][i].Trim(); } } } }