static bool GenDs(IList <FileInfo> list, int rate = 44100) { bool hasError = false; int i = 0; foreach (var file in list) { hasError &= DrumSynthFloat.DsGenWaveform(file.FullName, rate); if (!hasError) { Console.WriteLine("- {0} of {1} - {2}", ++i, list.Count, Path.GetFileNameWithoutExtension(file.Name)); } else { var dfg = Console.ForegroundColor; // reuse Console.Write("- {0} of {1} - {2}", ++i, list.Count, Path.GetFileNameWithoutExtension(file.Name)); Console.ForegroundColor = ConsoleColor.Red; Console.Write(" FAIL\n"); Console.ForegroundColor = dfg; } } return(hasError); }