public static void Main(string[] args) { string[] logfiles; string[] csvfiles; string indexname = ""; if (args.Length < 2) { Console.WriteLine("Usage: log_parser.exe logdir csvdir"); return; } else if (Directory.Exists(args[1])) { try { logfiles = Directory.EnumerateFiles(args[0], "*.xml").ToArray(); } catch (Exception e) { Console.WriteLine(e.Message); return; } if (logfiles.Length <= 0) { Console.WriteLine("No log files found in directory."); return; } } else { Console.WriteLine("CSV directory does not exist."); return; } csvfiles = new string[logfiles.Length]; List <ChallengeData> smallChallengeData = new List <ChallengeData>(); List <ChallengeData> bigChallengeData = new List <ChallengeData>(); for (int i = 0; i < logfiles.Length; i++) { csvfiles[i] = args[1] + Path.GetFileNameWithoutExtension(logfiles[i]) + ".csv"; Console.WriteLine(csvfiles[i]); LogParser parser = new LogParser(); parser.ParseLog(logfiles[i], csvfiles[i]); ChallengeData[] chData = parser.GetChallengeData(); smallChallengeData.Add(chData[0]); bigChallengeData.Add(chData[1]); } indexname = Path.GetDirectoryName(csvfiles[0]) + "/index.csv"; using (StreamWriter sw = new StreamWriter(indexname)) { sw.WriteLine("--------Small Joystick Total Averages--------"); LogParser.WriteTotalAverages(smallChallengeData.ToArray(), sw); sw.WriteLine("--------Big Joystick Total Averages--------"); LogParser.WriteTotalAverages(bigChallengeData.ToArray(), sw); } }