public void Test_StartInfoParsing() { FileInfo instructions = new FileInfo(@"C:\An app\Updates\3.2\Instructions.xml"); FileInfo updater = new FileInfo(@"C:\An app\Updates\Updater.exe"); ProcessStartInfo startInfo = StartInfoCreator.CreateStartInfo(instructions, updater); Assert.AreEqual(@"C:\An app\Updates\Updater.exe", startInfo.FileName); UpdaterStartupSettings settings = CommandLineArgumentParser.GetSettings(CommandLineToArgs(startInfo.Arguments)); Assert.AreEqual(@"C:\An app\Updates\3.2\Instructions.xml", settings.InstructionsFile.FullName); }
static void Main(string[] args) { if (args.Length == 0) { Console.WriteLine("This app has to be run with proper arguments."); Console.ReadKey(); return; } UpdaterStartupSettings settings = CommandLineArgumentParser.GetSettings(args); UpdateInstructions instructions = UpdateInstructionsReader.Read(settings.InstructionsFile); if (instructions != null) { Console.WriteLine($"Read update instructions from {settings.InstructionsFile}"); var worker = new PackageUpdaterWorker(); worker.TriggerUpdate(settings, instructions); } else { Console.WriteLine($"Failed to perform update based on instructions: {settings.InstructionsFile}"); } }