Beispiel #1
0
        public static async Task Main(string[] args)
        {
            // Use args in application
            new ArgsHelper().SetEnvironmentByArgs(args);

            var services = new ServiceCollection();

            // Setup AppSettings
            services = await SetupAppSettings.FirstStepToAddSingleton(services);

            // Inject services
            RegisterDependencies.Configure(services);
            var serviceProvider = services.BuildServiceProvider();
            var appSettings     = serviceProvider.GetRequiredService <AppSettings>();

            serviceProvider = services.BuildServiceProvider();
            var selectorStorage = serviceProvider.GetRequiredService <ISelectorStorage>();

            var console = serviceProvider.GetRequiredService <IConsole>();
            var metaExifThumbnailService = serviceProvider.GetRequiredService <IMetaExifThumbnailService>();

            // Help and other Command Line Tools args are included in the Geo tools
            await new MetaThumbnailCommandLineHelper(selectorStorage,
                                                     appSettings, console, metaExifThumbnailService).CommandLineAsync(args);
        }
Beispiel #2
0
        public static async Task Main(string[] args)
        {
            // Use args in application
            new ArgsHelper().SetEnvironmentByArgs(args);

            var services = new ServiceCollection();

            // Setup AppSettings
            services = await SetupAppSettings.FirstStepToAddSingleton(services);

            // Inject services
            RegisterDependencies.Configure(services);
            var serviceProvider = services.BuildServiceProvider();
            var appSettings     = serviceProvider.GetRequiredService <AppSettings>();

            services.AddMonitoringWorkerService(appSettings, AppSettings.StarskyAppType.Importer);
            services.AddApplicationInsightsLogging(appSettings);

            new SetupDatabaseTypes(appSettings, services).BuilderDb();
            serviceProvider = services.BuildServiceProvider();

            var import           = serviceProvider.GetService <IImport>();
            var console          = serviceProvider.GetRequiredService <IConsole>();
            var exifToolDownload = serviceProvider.GetRequiredService <IExifToolDownload>();
            var webLogger        = serviceProvider.GetRequiredService <IWebLogger>();

            // Migrations before importing
            await RunMigrations.Run(serviceProvider.GetService <ApplicationDbContext>(), webLogger, appSettings);

            // Help and other Command Line Tools args are included in the ImporterCli
            await new ImportCli(import, appSettings, console, exifToolDownload).Importer(args);

            await new FlushApplicationInsights(serviceProvider, appSettings, webLogger).FlushAsync();
        }
Beispiel #3
0
        public static async Task Main(string[] args)
        {
            // Use args in application
            new ArgsHelper().SetEnvironmentByArgs(args);

            var services = new ServiceCollection();

            // Setup AppSettings
            services = await SetupAppSettings.FirstStepToAddSingleton(services);

            // Inject services
            RegisterDependencies.Configure(services);
            var serviceProvider = services.BuildServiceProvider();
            var appSettings     = serviceProvider.GetRequiredService <AppSettings>();

            services.AddMonitoringWorkerService(appSettings, AppSettings.StarskyAppType.Thumbnail);
            services.AddApplicationInsightsLogging(appSettings);

            new SetupDatabaseTypes(appSettings, services).BuilderDb();
            serviceProvider = services.BuildServiceProvider();

            var thumbnailService = serviceProvider.GetService <IThumbnailService>();
            var thumbnailCleaner = serviceProvider.GetService <IThumbnailCleaner>();

            var console         = serviceProvider.GetRequiredService <IConsole>();
            var selectorStorage = serviceProvider.GetRequiredService <ISelectorStorage>();

            // Help and other Command Line Tools args are included in the ThumbnailCLI
            await new ThumbnailCli(appSettings, console, thumbnailService, thumbnailCleaner, selectorStorage).Thumbnail(args);

            await new FlushApplicationInsights(serviceProvider).FlushAsync();
        }
Beispiel #4
0
        /// <summary>
        /// Starsky Admin CLI to manage user admin tasks
        /// </summary>
        /// <param name="args">use -h to see all options</param>
        internal static async Task Main(string[] args)
        {
            // Use args in application
            new ArgsHelper().SetEnvironmentByArgs(args);

            var services = new ServiceCollection();

            // Setup AppSettings
            services = await SetupAppSettings.FirstStepToAddSingleton(services);

            // Inject services
            RegisterDependencies.Configure(services);
            var serviceProvider = services.BuildServiceProvider();
            var appSettings     = serviceProvider.GetRequiredService <AppSettings>();

            services.AddMonitoringWorkerService(appSettings, AppSettings.StarskyAppType.Geo);
            services.AddApplicationInsightsLogging(appSettings);

            var webLogger = serviceProvider.GetRequiredService <IWebLogger>();

            new SetupDatabaseTypes(appSettings, services).BuilderDb();
            serviceProvider = services.BuildServiceProvider();

            // Use args in application
            appSettings.Verbose = ArgsHelper.NeedVerbose(args);

            var userManager = serviceProvider.GetService <IUserManager>();

            appSettings.ApplicationType = AppSettings.StarskyAppType.Admin;

            if (new ArgsHelper().NeedHelp(args))
            {
                new ArgsHelper(appSettings).NeedHelpShowDialog();
                return;
            }

            await RunMigrations.Run(serviceProvider.GetService <ApplicationDbContext>(),
                                    webLogger, appSettings);

            await new ConsoleAdmin(userManager, new ConsoleWrapper()).Tool(
                ArgsHelper.GetName(args), ArgsHelper.GetUserInputPassword(args));

            await new FlushApplicationInsights(serviceProvider).FlushAsync();
        }
Beispiel #5
0
        public static async Task Main(string[] args)
        {
            // Use args in application
            new ArgsHelper().SetEnvironmentByArgs(args);

            // Setup AppSettings
            var services = await SetupAppSettings.FirstStepToAddSingleton(new ServiceCollection());

            // Inject services
            RegisterDependencies.Configure(services);
            var serviceProvider = services.BuildServiceProvider();
            var appSettings     = serviceProvider.GetRequiredService <AppSettings>();

            serviceProvider = services.BuildServiceProvider();

            var storageSelector   = serviceProvider.GetService <ISelectorStorage>();
            var console           = serviceProvider.GetRequiredService <IConsole>();
            var webRequestFactory = serviceProvider.GetRequiredService <IFtpWebRequestFactory>();

            new WebFtpCli(appSettings, storageSelector, console, webRequestFactory).Run(args);
        }
Beispiel #6
0
        public static async Task Main(string[] args)
        {
            // Use args in application
            new ArgsHelper().SetEnvironmentByArgs(args);
            var services = new ServiceCollection();

            services = await SetupAppSettings.FirstStepToAddSingleton(services);

            // Inject services
            RegisterDependencies.Configure(services);
            var serviceProvider = services.BuildServiceProvider();
            var appSettings     = serviceProvider.GetRequiredService <AppSettings>();

            serviceProvider = services.BuildServiceProvider();

            var publishPreflight = serviceProvider.GetService <IPublishPreflight>();
            var publishService   = serviceProvider.GetService <IWebHtmlPublishService>();
            var storageSelector  = serviceProvider.GetService <ISelectorStorage>();
            var console          = serviceProvider.GetRequiredService <IConsole>();

            // Help and args selectors are defined in the PublishCli
            await new PublishCli(storageSelector, publishPreflight, publishService, appSettings, console).Publisher(args);
        }
Beispiel #7
0
        public static async Task Main(string[] args)
        {
            // Use args in application
            new ArgsHelper().SetEnvironmentByArgs(args);

            var services = new ServiceCollection();

            // Setup AppSettings
            services = await SetupAppSettings.FirstStepToAddSingleton(services);

            // Inject services
            RegisterDependencies.Configure(services);
            var serviceProvider = services.BuildServiceProvider();
            var appSettings     = serviceProvider.GetRequiredService <AppSettings>();

            services.AddMonitoringWorkerService(appSettings, AppSettings.StarskyAppType.Geo);
            services.AddApplicationInsightsLogging(appSettings);

            new SetupDatabaseTypes(appSettings, services).BuilderDb();
            serviceProvider = services.BuildServiceProvider();

            var geoReverseLookup = serviceProvider.GetService <IGeoReverseLookup>();
            var geoLocationWrite = serviceProvider.GetRequiredService <IGeoLocationWrite>();
            var geoFileDownload  = serviceProvider.GetRequiredService <IGeoFileDownload>();

            var selectorStorage = serviceProvider.GetRequiredService <ISelectorStorage>();

            var console          = serviceProvider.GetRequiredService <IConsole>();
            var exifToolDownload = serviceProvider.GetRequiredService <IExifToolDownload>();

            // Help and other Command Line Tools args are included in the Geo tools
            await new GeoCli(geoReverseLookup, geoLocationWrite, selectorStorage,
                             appSettings, console, geoFileDownload, exifToolDownload).CommandLineAsync(args);

            await new FlushApplicationInsights(serviceProvider).FlushAsync();
        }