static void Main(string[] args) { if (args.Length < 2) { Console.Error.WriteLine("At least two text files have to be specified."); return; } List <string> asciiTextFiles = new List <string>(); foreach (string filename in args) { asciiTextFiles.Add(ReadFile(filename)); } AsciiCombiner combiner = new AsciiCombiner(); var asciiArts = combiner.BuildAsciiArtList(asciiTextFiles); var asciiArtResult = combiner.CombineAsciiArts(asciiArts); bool printed = false; foreach (string line in asciiArtResult.Lines) { printed = true; Console.WriteLine(line); } if (!printed) { Console.Error.WriteLine("Files do not contain the same number of lines or columns."); } }
static async Task <int> Main(string[] args) { if (args.Length <= 2) { writeError("No file specified"); return(1); } else if (args.Length <= 3) { writeError("Only one file specified"); return(1); } string[] text1; try { text1 = await System.IO.File.ReadAllLinesAsync(args[2]); } catch { writeError(args[2] + " is invalid"); return(1); } for (int i = 3; i < args.Length; i++) { string[] text2; try { text2 = await System.IO.File.ReadAllLinesAsync(args[i]); } catch { writeError(args[i] + " is invalid"); return(1); } if (!checkText(text1, text2)) { writeError("Files do not have equal sizes"); return(1); } text1 = new AsciiCombiner().CombineAscii(text1, text2); } for (int i = 0; i < text1.Length; i++) { Console.WriteLine(text1[i]); } return(0); }
static void Main(string[] args) { if (args.Length < 2) { Console.WriteLine("You need to specify at least 2 files!"); return; } string[] textFiles = new string[args.Length]; readFiles(textFiles, args); AsciiCombiner combiner = new AsciiCombiner(); string result = combiner.combineTexts(textFiles); Console.WriteLine("\n" + result); }