Ejemplo n.º 1
0
        public static async Task Main(string[] args)
        {
            const string consoleAppOperation = "What the console app does (ex: Data Uploader)";
            var          watch    = Stopwatch.StartNew();
            var          exitCode = 0;

            ConsoleExtensions.PrintStartMessage(consoleAppOperation);

            Configuration   = ConsoleStartup.SetupConfiguration();
            ServiceProvider = ConsoleStartup.SetupDependencyInjection(Configuration);

            try
            {
                using (var scope = ServiceProvider.CreateScope())
                {
                    // Do console app stuff here!
                }
            }
            catch (Exception e)
            {
                ConsoleExtensions.PrintError($"\n {e} \n");
                exitCode = -1;
            }
            finally
            {
                watch.Stop();

                ConsoleExtensions.PrintExitMessage(consoleAppOperation, exitCode, watch);
            }
        }
Ejemplo n.º 2
0
        public static async Task Main(string[] args)
        {
            const string consoleAppOperation = "Bible Uploader";
            var          watch    = Stopwatch.StartNew();
            var          exitCode = 0;

            ConsoleExtensions.PrintStartMessage(consoleAppOperation);

            Configuration   = ConsoleStartup.SetupConfiguration();
            ServiceProvider = ConsoleStartup.SetupDependencyInjection(Configuration);

            try
            {
                using var scope = ServiceProvider.CreateScope();
                var serviceProvider = scope.ServiceProvider;
                var serviceRunner   = serviceProvider.GetRequiredService <IServiceRunner>();

                await serviceRunner.Run();


                Console.WriteLine("derp");
            }
            catch (Exception e)
            {
                ConsoleExtensions.PrintError($"\n {e} \n");
                exitCode = -1;
            }
            finally
            {
                watch.Stop();

                ConsoleExtensions.PrintExitMessage(consoleAppOperation, exitCode, watch);
            }
        }
Ejemplo n.º 3
0
        public static async Task Main(string[] args)
        {
            const string consoleAppOperation = "What the console app does (ex: Data Uploader)";
            Stopwatch    watch    = Stopwatch.StartNew();
            int          exitCode = 0;

            ConsoleExtensions.PrintStartMessage(consoleAppOperation);

            Configuration   = ConsoleStartup.SetupConfiguration();
            ServiceProvider = ConsoleStartup.SetupDependencyInjection(Configuration);

            try
            {
                using (var scope = ServiceProvider.CreateScope())
                {
                    // Do console app stuff here!
                    _ioService = scope.ServiceProvider.GetRequiredService <IIOService>();

                    string directory = ServiceProvider.GetDirectoryFromConfig();

                    IEnumerable <FileInfo> files = _ioService.ListFilesInDirectory(directory);
                    await _ioService.CalculateVideoDuration(files);
                }
            }
            catch (Exception e)
            {
                ConsoleExtensions.PrintError($"\n {e} \n");
                exitCode = -1;
            }
            finally
            {
                watch.Stop();

                ConsoleExtensions.PrintExitMessage(consoleAppOperation, exitCode, watch);
            }
        }