public static int Main(string[] args) { if (args.Length < 2) { Usage(Console.Out); return(-1); } string input1 = args[0]; string input2 = args[1]; string[] options = new string[args.Length - 2]; for (int i = 0; i < options.Length; i++) { options[i] = args[i + 2]; } TextWriter output = Console.Out; for (int i = 0; i < options.Length - 1; i++) { switch (options[i].ToLower()) { case "/o": goto case "-output"; case "-o": goto case "-output"; case "/output": goto case "-output"; case "-output": output = new StreamWriter(options[i + 1], false, Encoding.UTF8); break; } } IDiffEngineFactory diffFactory = new BestQualityDiffEngineFactory(new IDiffEngine[] { new DirectoryDiffEngine(), new FileDiffEngine(), new VersionedFileDiffEngine(), new TextFileDiffEngine(), new MsiDiffEngine(), new CabDiffEngine(), new MspDiffEngine(), }); IDiffEngine diffEngine = diffFactory.GetDiffEngine(input1, input2, options); if (diffEngine != null) { bool different = diffEngine.GetDiff(input1, input2, options, output, "", diffFactory); return(different ? 1 : 0); } else { Console.Error.WriteLine("Dont know how to diff those inputs."); return(-1); } }
public static int Main(string[] args) { if(args.Length < 2) { Usage(Console.Out); return -1; } string input1 = args[0]; string input2 = args[1]; string[] options = new string[args.Length - 2]; for(int i = 0; i < options.Length; i++) options[i] = args[i+2]; TextWriter output = Console.Out; for(int i = 0; i < options.Length - 1; i++) { switch(options[i].ToLower()) { case "/o": goto case "-output"; case "-o": goto case "-output"; case "/output": goto case "-output"; case "-output": output = new StreamWriter(options[i+1], false, Encoding.UTF8); break; } } IDiffEngineFactory diffFactory = new BestQualityDiffEngineFactory(new IDiffEngine[] { new DirectoryDiffEngine(), new FileDiffEngine(), new VersionedFileDiffEngine(), new TextFileDiffEngine(), new MsiDiffEngine(), new CabDiffEngine(), new MspDiffEngine(), }); IDiffEngine diffEngine = diffFactory.GetDiffEngine(input1, input2, options); if(diffEngine != null) { bool different = diffEngine.GetDiff(input1, input2, options, output, "", diffFactory); return different ? 1 : 0; } else { Console.Error.WriteLine("Dont know how to diff those inputs."); return -1; } }