コード例 #1
0
        private static IFormatter ChooseFormatter(CmdLineHelper cmdLineHelper)
        {
            if (cmdLineHelper.IsXls)
            {
                var filePath = GetOutputPath();
                var stream   = File.OpenWrite(filePath);
                Console.WriteLine($"Output in {filePath}");
                return(new XlsFriendlyFormatter(new StreamWriter(stream)));
            }

            return(new ConsoleFormatter());
        }
コード例 #2
0
        public static void Main(string[] args)
        {
            var cmdLineHelper = new CmdLineHelper(args);
            var steamUtils    = new SteamUtils();
            var saveFilePath  = cmdLineHelper.Positional.Any() ? cmdLineHelper.Positional.First() : GetSaveFilePath(steamUtils);

            var context = new Context
            {
                HeistDb   = new HeistDb(),
                Args      = cmdLineHelper,
                Formatter = ChooseFormatter(cmdLineHelper),
                SaveFile  = new SaveFile(saveFilePath)
            };

            if (context.Args.IsHelp)
            {
                CmdLineHelper.PrintHelp(Console.Out);
                return;
            }

            GetCallable(context).Run(context);
        }