private LogTreeNode GetChild(string[] path) { if (path.Length == 0) { return(this); } if (!Children.ContainsKey(path[0])) { Children[path[0]] = new LogTreeNode(); } return(Children[path[0]].GetChild(path.Skip(1).ToArray())); }
static void Main(string[] args) { if (args.Length != 1) { PrintHelp(); return; } var logdir = args[0] == "!test" ? "TestData" : args[0]; var all = Directory .EnumerateFiles(logdir) .With(LogReader.ParseLines) .ToList(); var bld = new LogTreeNode(); all.ForEach(it => bld.Attach(it)); var tree = bld.GetContent(); tree.Children.ForEach(PrintItem); }