static void Main(string[] args) { var fileCfg = ParseCommandLine(args, out string cfgFilename); var stackCfg = new StackCfg(); if (cfgFilename != null) { try { stackCfg = StackCfg.LoadJson(cfgFilename); } catch (Exception e) { var defaultCfgFile = "whomst-default.json"; var excMessage = $"Could not load config file {cfgFilename}."; var helpfulMessage = excMessage + $"Generating {defaultCfgFile}. Use it with /cfg={defaultCfgFile})"; Console.WriteLine(helpfulMessage); File.WriteAllText( defaultCfgFile, JsonConvert.SerializeObject(StackCfg.Default(), new JsonSerializerSettings { Formatting = Formatting.Indented, NullValueHandling = NullValueHandling.Ignore, })); throw new AggregateException(excMessage, e); } } // NOTE cfg.PrepareForUse unnecessary, will get called in WhomstJob ctor WhomstGlobalJob.Execute(fileCfg, stackCfg); }
public static void Execute(FileCfg fileCfg, StackCfg stackCfg) { var runner = new WhomstGlobalJob(); runner.RunJob(fileCfg, stackCfg); runner.WriteFiles(); }