public void Parse(ParseLogFileArgs args = null) { if (args != null) { SourceFile = string.IsNullOrEmpty(args.SourceFile) ? SourceFile : args.SourceFile; DestinationFile = string.IsNullOrEmpty(args.DestinationFile) ? DestinationFile : args.DestinationFile; var fileData = File.ReadAllLines(SourceFile).ToList(); var result = ProcessFileData(fileData); File.WriteAllLines(DestinationFile, result); return; } var sourceDirectory = "Source"; var outputDirectory = "Output"; if (!Directory.Exists(sourceDirectory)) { Directory.CreateDirectory(sourceDirectory); return; } if (!Directory.Exists(outputDirectory)) Directory.CreateDirectory(outputDirectory); var sourceFiles = Directory.GetFiles(sourceDirectory); foreach (var file in sourceFiles) { var destinationFile = Path.Combine(outputDirectory, Path.GetFileName(file) + ".csv"); var fileData = File.ReadAllLines(file).ToList(); var result = ProcessFileData(fileData); File.WriteAllLines(destinationFile, result); } }
public ParseLogFile(ParseLogFileArgs args) { SourceFile = args.SourceFile; DestinationFile = args.DestinationFile; }