private static void PrintMatch(string outFile, Scanner.PatternFound match, bool imageScan) { // Comma offset variable to align output in CSV output var commaOffset = imageScan ? ",,,," : ",,,"; // Replace comma with a period for comma separated output var str = match.Value.Replace(',', '.'); // Quote numeric value so excel won't try to convert it to a number if (str.All(char.IsDigit)) { str = string.Format($"'{str}'"); } File.AppendAllText(outFile, $"{commaOffset}{match.Name},{str}\n"); }
private static void PrintMatch(string outFile, Scanner.PatternFound match) { // Comma offset variable to align output in CSV output var commaOffset = cmdline.Value.ImageScan ? ",,,," : ",,,"; if (cmdline.Value.CSVOuput == false) { File.AppendAllText(outFile, $"{match.Name} was found at {match.Index} with a value of {match.Value}\n"); } else { // Replace comma with a period for comma separated output string str = match.Value.Replace(',', '.'); // Quote numeric value so excel won't try to convert it to a number if (str.All(char.IsDigit)) { str = string.Format($"'{str}'"); } File.AppendAllText(outFile, $"{commaOffset}{match.Name},{str}\n"); } }