public static int Main(string[] args) { bool verbose = false; bool showHelp = false; string configPath = ""; string romPath = null; string outputPath = null; int seed = Seed.Arbitrary(); string extractedFile = null; var p = new OptionSet { { "v|verbose", "enable verbose logging", v => verbose = true }, { "h|help", "show help message and exit", v => showHelp = true }, { "c|config=", "config file", (string v) => configPath = v }, { "i|input=", "input ROM", (string v) => romPath = v }, { "o|output=", "output ROM", (string v) => outputPath = v }, { "s|seed=", "random number seed (overrides config)", (string v) => seed = Seed.From(v) }, { "extract-to=", "extract ROM data to files", (string v) => extractedFile = v }, }; List <string> extra; try { extra = p.Parse(args); } catch (OptionException e) { Console.Error.WriteLine(e.Message); p.WriteOptionDescriptions(Console.Error); return(1); } if (showHelp) { p.WriteOptionDescriptions(Console.Out); return(0); } var logConfig = new NLog.Config.LoggingConfiguration(); var console = new NLog.Targets.ConsoleTarget("console"); logConfig.AddRule(verbose ? LogLevel.Trace : LogLevel.Warn, LogLevel.Fatal, console); LogManager.Configuration = logConfig; log = LogManager.GetCurrentClassLogger(); log.Info("loading rom {0}", romPath); var rom = new NintendoDSRom(romPath); log.Info("rom loaded"); if (extractedFile != null) { SaveAll(extractedFile, rom.FileTable.Root); } return(0); }