static void Main(string[] aArgs) { HelperVolkano helper = new HelperVolkano(aArgs); OptionParser optParser = helper.OptionParser; optParser.Usage = "usage: FacDef.exe [options] [target ugly name]"; OptionParser.OptionBool optNoExec = new OptionParser.OptionBool(null, "--noexec", "Do not reboot target after reprogramming"); OptionParser.OptionBool optWait = new OptionParser.OptionBool("-w", "--wait", "Wait to discover rebooted target after reprogramming (ignored with --noexec)"); optParser.AddOption(optNoExec); optParser.AddOption(optWait); helper.Start(); if (optParser.PosArgs.Count != 1) { Console.WriteLine(optParser.Help()); System.Environment.Exit(1); } string uglyname = optParser.PosArgs[0]; // create the console IConsole console = new FlashInfoConsole(); // create the reprogrammer FactoryDefaulter defaulter = new FactoryDefaulter(helper.IpAddress, console, uglyname); defaulter.NoExec = optNoExec.Value; defaulter.Wait = optWait.Value; if (!defaulter.Execute()) { defaulter.Close(); System.Environment.Exit(1); } defaulter.Close(); }
static void Main(string[] aArgs) { HelperVolkano helper = new HelperVolkano(aArgs); OptionParser optParser = helper.OptionParser; optParser.Usage = "usage: Reprog.exe [options] [target ugly name] [rom file | bundle file]"; OptionParser.OptionBool optFallback = new OptionParser.OptionBool("-f", "--fallback", "Target fallback rather than main"); OptionParser.OptionBool optNoExec = new OptionParser.OptionBool(null, "--noexec", "Do not reboot target after reprogramming"); OptionParser.OptionBool optWait = new OptionParser.OptionBool("-w", "--wait", "Wait to discover rebooted target after reprogramming (ignored with --noexec)"); OptionParser.OptionBool optNoTrust = new OptionParser.OptionBool(null, "--notrust", "Reprogram to factory fresh paying no attention to current flash contents"); OptionParser.OptionBool optBootstrap = new OptionParser.OptionBool(null, "--bootstrap", "Additionally reprogram the boostrap"); OptionParser.OptionBool optUnsafe = new OptionParser.OptionBool(null, "--unsafe", "Program directly to flash / no 2 phase programming."); OptionParser.OptionString optEmulator = new OptionParser.OptionString("-e", "--emulator", "", "Flash emulator name (SrecA)", "Emulator name"); OptionParser.OptionString optOutput = new OptionParser.OptionString("-o", "--output", "", "Flash emulator output filename", "Output filename"); optParser.AddOption(optFallback); optParser.AddOption(optNoExec); optParser.AddOption(optWait); optParser.AddOption(optNoTrust); optParser.AddOption(optBootstrap); optParser.AddOption(optUnsafe); optParser.AddOption(optEmulator); optParser.AddOption(optOutput); helper.Start(); if (optParser.PosArgs.Count != 2) { Console.WriteLine(optParser.Help()); System.Environment.Exit(1); } string uglyname = optParser.PosArgs[0]; string xmlfile = optParser.PosArgs[1]; // create the console IConsole console = new FlashInfoConsole(); // create the reprogrammer Reprogrammer reprog = new Reprogrammer(helper.IpAddress, console, uglyname, xmlfile); reprog.Fallback = optFallback.Value; reprog.NoExec = optNoExec.Value; reprog.Wait = optWait.Value; reprog.NoTrust = optNoTrust.Value; reprog.Bootstrap = optBootstrap.Value; reprog.Emulator = optEmulator.Value; reprog.Output = optOutput.Value; reprog.Unsafe = optUnsafe.Value; // reprog if (!reprog.Execute()) { reprog.Close(); System.Environment.Exit(1); } reprog.Close(); System.Environment.Exit(0); }