Example #1
0
        public static void Register(IStartupContext startupContext, bool updateApp, bool inConsole)
        {
            var appFolderInfo = new AppFolderInfo(startupContext);

            LogManager.Configuration = new LoggingConfiguration();

            if (Debugger.IsAttached)
            {
                RegisterDebugger();
            }

            RegisterExceptron();

            if (updateApp)
            {
                RegisterLoggly();
                RegisterUpdateFile(appFolderInfo);
            }
            else
            {
                if (inConsole && (OsInfo.IsLinux || new RuntimeInfo(null, new ServiceProvider(new ProcessProvider())).IsUserInteractive))
                {
                    RegisterConsole();
                }

                RegisterAppFile(appFolderInfo);
            }

            LogManager.ReconfigExistingLoggers();
        }
Example #2
0
 public SpinService(IRuntimeInfo runtimeInfo, IProcessProvider processProvider, IStartupContext startupContext, Logger logger)
 {
     _runtimeInfo = runtimeInfo;
     _processProvider = processProvider;
     _startupContext = startupContext;
     _logger = logger;
 }
Example #3
0
 public StartNzbDrone(IServiceProvider serviceProvider, IProcessProvider processProvider, IStartupContext startupContext, Logger logger)
 {
     _serviceProvider = serviceProvider;
     _processProvider = processProvider;
     _startupContext = startupContext;
     _logger = logger;
 }
Example #4
0
        protected ContainerBuilderBase(IStartupContext args, List <string> assemblies)
        {
            _loadedTypes = new List <Type>();

            assemblies.Add(OsInfo.IsWindows ? "NzbDrone.Windows" : "NzbDrone.Mono");
            assemblies.Add("NzbDrone.Common");

            foreach (var assembly in assemblies)
            {
                _loadedTypes.AddRange(Assembly.Load(assembly).GetTypes());
            }

            Container = new Container(new TinyIoCContainer(), _loadedTypes);
            AutoRegisterInterfaces();
            Container.Register(args);
        }
 public NzbDroneServiceFactory(IConfigFileProvider configFileProvider,
                               IHostController hostController,
                               IRuntimeInfo runtimeInfo,
                               IStartupContext startupContext,
                               IBrowserService browserService,
                               IContainer container,
                               Logger logger)
 {
     _configFileProvider = configFileProvider;
     _hostController     = hostController;
     _runtimeInfo        = runtimeInfo;
     _startupContext     = startupContext;
     _browserService     = browserService;
     _container          = container;
     _logger             = logger;
 }
Example #6
0
        private static void EnsureSingleInstance(bool isService, IStartupContext startupContext)
        {
            var instancePolicy = _container.Resolve <ISingleInstancePolicy>();

            if (isService)
            {
                instancePolicy.KillAllOtherInstance();
            }
            else if (startupContext.Flags.Contains(StartupContext.TERMINATE))
            {
                instancePolicy.KillAllOtherInstance();
            }
            else
            {
                instancePolicy.PreventStartIfAlreadyRunning();
            }
        }
Example #7
0
        private async Task Setup(IStartupContext context)
        {
            var maping = context.GetModules();

            Path.Setup();
            Loading.Setup();
            Store.Setup();
            await Resource.Setup();

            Scene.Setup();
            await Window.Setup();

            Storage.Setup();
            Manager.Setup();

            // @todo database, store, netwrok, service, platform, audio ...
        }
Example #8
0
        private static void EnsureSingleInstance(bool isService, IStartupContext startupContext)
        {
            var instancePolicy = _container.Resolve<ISingleInstancePolicy>();

            if (isService)
            {
                instancePolicy.KillAllOtherInstance();
            }
            else if (startupContext.Flags.Contains(StartupContext.TERMINATE))
            {
                instancePolicy.KillAllOtherInstance();
            }
            else
            {
                instancePolicy.PreventStartIfAlreadyRunning();
            }
        }
Example #9
0
        void IStartup.ConfigureServices(IServiceCollection services, IStartupContext context)
        {
            DefaultClipboardFormatCategories.Setup(services);
            DefaultClipboardFormats.Setup(services);

            services.AddFormatsExtractor <DefaultFormatsExtractor>();
            services.AddClipboardImplementationFactory <DefaultClipboardImplementationFactory>();
            services.AddClipboardImplementationViewModelFactory <DefaultClipboardImplementationViewModelFactory>();

            //Bitmap
            services.AddSingleton(BitmapFileOption.Create <BmpBitmapEncoder>());
            services.AddSingleton(BitmapFileOption.Create <GifBitmapEncoder>());
            services.AddSingleton(BitmapFileOption.Create <PngBitmapEncoder>());
            services.AddSingleton(BitmapFileOption.Create <JpegBitmapEncoder>(extension: ".jpg"));
            services.AddSingleton(BitmapFileOption.Create <TiffBitmapEncoder>());
            services.AddSingleton(BitmapFileOption.Create <WmpBitmapEncoder>());

            services.AddSingleton <IBitmapFileOptionsManager, BitmapFileOptionsManager>();

            context.IOSettingsManager.AddSettings(new KeyedCollectionSetting <string, BitmapFileOption, IBitmapFileOptionsManager>(SettingConsts.ToFileBitmapEncoderKey, SettingConsts.DefaultToFileBitmapEncoder));

            services.AddInteractable <ClipboardImplementations.Bitmap.Interactables.ConvertToFileInteractable>();

            //Path
            services.AddSingleton <ILinkedTextContentFactory, PathLinkedImplementationFactory>();

            //Text
            services.AddSingleton <LinkedTextContentFactoriesManager>();
            services.AddInteractable <ClipboardImplementations.Text.Interactables.ConvertToFileInteractable>();
            services.AddFiltersProvider <TextSearchFilterProvider>();

            //Settings
            services.AddUISettingsFactory <PluginUISettingsFactory>();

            //Extensions
            services.AddInteractable <PinnedInteractable>();
            services.AddSingletonWithAutoInject <PinnedManager>();
            services.AddFiltersProvider <PinnedFilterProvider>();

            //Pluggins
            var pluginManager = new PluginManager(context);

            services.AddSingleton <IPluginManager>(pluginManager);
            pluginManager.ConfigureServices(services, context);
        }
Example #10
0
        public static IContainer BuildContainer(IStartupContext startupContext)
        {
            var assemblies = new List <string>
            {
                "Radarr.Host",
                "Radarr.Common",
                "Radarr.Core",
//                "NzbDrone.Api",
//                "NzbDrone.SignalR"
            };

            if (OsInfoCore.IsWindows)
            {
                assemblies.Add("Radarr.Runtime.Windows");
            }

            return(new MainAppContainerBuilder(startupContext, assemblies.ToArray()).Container);
        }
Example #11
0
 public NzbDroneServiceFactory(IConfigFileProvider configFileProvider,
                               IHostController hostController,
                               IRuntimeInfo runtimeInfo,
                               PriorityMonitor priorityMonitor,
                               IStartupContext startupContext,
                               IBrowserService browserService,
                               IProcessProvider processProvider,
                               Logger logger)
 {
     _configFileProvider = configFileProvider;
     _hostController     = hostController;
     _runtimeInfo        = runtimeInfo;
     _priorityMonitor    = priorityMonitor;
     _startupContext     = startupContext;
     _browserService     = browserService;
     _processProvider    = processProvider;
     _logger             = logger;
 }
Example #12
0
        public AppFolderInfo(IStartupContext startupContext)
        {
            if (OsInfo.IsLinux)
            {
                DATA_SPECIAL_FOLDER = Environment.SpecialFolder.ApplicationData;
            }

            if (startupContext.Args.ContainsKey(StartupContext.APPDATA))
            {
                AppDataFolder = startupContext.Args[StartupContext.APPDATA];
            }
            else
            {
                AppDataFolder = Path.Combine(Environment.GetFolderPath(DATA_SPECIAL_FOLDER, Environment.SpecialFolderOption.None), "NzbDrone");
            }

            StartUpFolder = new FileInfo(Assembly.GetExecutingAssembly().Location).Directory.FullName;
            TempFolder = Path.GetTempPath();
        }
Example #13
0
        public static ApplicationModes GetApplicationMode(IStartupContext startupContext)
        {
            if (startupContext.Help)
            {
                return(ApplicationModes.Help);
            }

            if (OsInfo.IsWindows && startupContext.RegisterUrl)
            {
                return(ApplicationModes.RegisterUrl);
            }

            if (OsInfo.IsWindows && startupContext.InstallService)
            {
                return(ApplicationModes.InstallService);
            }

            if (OsInfo.IsWindows && startupContext.UninstallService)
            {
                return(ApplicationModes.UninstallService);
            }

            Logger.Debug("Getting windows service status");

            // IsWindowsService can throw sometimes, so wrap it
            var isWindowsService = false;

            try
            {
                isWindowsService = WindowsServiceHelpers.IsWindowsService();
            }
            catch (Exception e)
            {
                Logger.Error(e, "Failed to get service status");
            }

            if (OsInfo.IsWindows && isWindowsService)
            {
                return(ApplicationModes.Service);
            }

            return(ApplicationModes.Interactive);
        }
Example #14
0
        public AppFolderInfo(IStartupContext startupContext)
        {
            if (OsInfo.IsMono)
            {
                DATA_SPECIAL_FOLDER = Environment.SpecialFolder.ApplicationData;
            }

            if (startupContext.Args.ContainsKey(StartupContext.APPDATA))
            {
                AppDataFolder = startupContext.Args[StartupContext.APPDATA];
            }
            else
            {
                AppDataFolder = Path.Combine(Environment.GetFolderPath(DATA_SPECIAL_FOLDER, Environment.SpecialFolderOption.None), "NzbDrone");
            }

            StartUpFolder = new FileInfo(Assembly.GetExecutingAssembly().Location).Directory.FullName;
            TempFolder    = Path.GetTempPath();
        }
Example #15
0
        void IStartup.ConfigureServices(IServiceCollection services, IStartupContext context)
        {
            context.IOSettingsManager.AddSettings(new KeyedCollectionSetting <string, Theme, IThemesManager>(SettingConsts.ThemeKey, SettingConsts.ThemeDefaultName));
            context.IOSettingsManager.AddSettings(new ListSetting <string>(SettingConsts.OwnerProgramClipboardFilterKey));
            context.IOSettingsManager.AddSettings(new BasicSetting <bool>(SettingConsts.Windows10HistoryFilterKey, () => true));
            context.IOSettingsManager.AddSettings(new BasicSetting <bool>(SettingConsts.Windows10CloudFilterKey, () => false));

            services.AddSingleton <IViewModelFactoriesManager, ViewModelFactoriesManager>();

            services.AddSingleton <IImageDownloader, ImageDownloader>();

            services.AddSingleton <IClipboardObjectManager, ClipboardObjectManager>();
            services.AddSingleton <IClipboardObjectsManager, ClipboardObjectsManager>();
            services.AddSingleton <ITypeDataTemplateManager, TypeDataTemplateManager>();
            services.AddSingleton <IProgramManager, ProgramManager>();
            services.AddSingleton <IFiltersManager, FiltersManager>();

            services.AddSingleton <IUISettingsManager, UISettingsManager>();
            services.AddSingleton <IThemesManager, ThemesManager>();

            services.AddSingleton <IInteractablesManager, InteractablesManager>();

            services.AddInteractable <CopyClipboardObjectInteractable>();
            services.AddInteractable <CopyFormatInteractable>();

            services.AddSingleton <IGlobalKeyEventsManager, GlobalKeyEventsManager>();
            services.AddSingletonWithAutoInject <ClipboardKeyListener>();

            services.AddTransientWithAutoInject <CreateTriggerAfterMainWindowLoaded>();

            services.AddUISettingsFactory <WPFUISettingsFactory>();

            services.AddClipboardObjectMetadataFactory <DefaultClipboardObjectMetadataFactory>();
            services.AddFiltersProvider <FormatFiltersProvider>();
            services.AddFiltersProvider <ProgramFiltersProvider>();

            services.AddSingletonWithAutoInject <ClipboardViewerListener>();

            services.AddClipboardFilter <OwnerProgramClipboardFilter>();
            services.AddClipboardFilter <Windows10ClipboardFilter>();

            services.AddFormatsExtractor <Windows10FormatsExtractor>();
        }
Example #16
0
        protected ContainerBuilderBase(IStartupContext startupContext, params string[] assemblies)
        {
            _containerBuilder = new ContainerBuilder();
            _containerBuilder.RegisterModule <LoggingModule>();
            _containerBuilder.RegisterInstance(startupContext).SingleInstance();
            _containerBuilder.RegisterType <ILogger>();
            _loadedTypes = new List <Type>();

            foreach (var assembly in assemblies)
            {
                _loadedTypes.AddRange(Assembly.Load(assembly).GetTypes());
            }

            AutoRegisterInterfaces();

            _containerBuilder.RegisterInstance(new ContainerMetadata(_loadedTypes)).SingleInstance();
            _containerBuilder.RegisterSelf();

            Container = _containerBuilder.Build();
        }
Example #17
0
        public AppFolderInfo(IStartupContext startupContext)
        {
            if (OsInfo.IsNotWindows)
            {
                DATA_SPECIAL_FOLDER = Environment.SpecialFolder.ApplicationData;
            }

            if (startupContext.Args.ContainsKey(StartupContext.APPDATA))
            {
                AppDataFolder = startupContext.Args[StartupContext.APPDATA];
                Logger.Info("Data directory is being overridden to [{0}]", AppDataFolder);
            }
            else
            {
                AppDataFolder = Path.Combine(Environment.GetFolderPath(DATA_SPECIAL_FOLDER, Environment.SpecialFolderOption.None), "Sportstarr");
            }

            StartUpFolder = new FileInfo(Assembly.GetExecutingAssembly().Location).Directory.FullName;
            TempFolder    = Path.GetTempPath();
        }
Example #18
0
        void IStartup.ConfigureServices(IServiceCollection services, IStartupContext context)
        {
            context.IOSettingsManager.AddSettings(
                new EnumSetting <MinimizeTo>(AppUISettingsFactory.MinimizeTo, MinimizeTo.Taskbar),
                new BasicSetting <bool>(AppUISettingsFactory.CheckUpdatesOnStartUp, () => true),
                new BasicSetting <bool>(AppUISettingsFactory.CheckForPrereleases, () => false)
                );

            services.AddSingleton <ICursorManager, CursorManager>();

            services.AddInteractable <OpenSettingsInteractable>();

            services.AddUISettingsFactory <AppUISettingsFactory>();

            services.AddTheme(
                new Theme("Dark", "Themes/Dark.xaml", context.AppInfo.Name),
                new Theme("Light", "Themes/Light.xaml", context.AppInfo.Name));

            services.AddTransientWithAutoInject <UpdateChecker>();
        }
Example #19
0
        public static IContainer Build(IStartupContext startupContext)
        {
            var assemblies = new List <String>
            {
                "NzbDrone.Update",
                "NzbDrone.Common"
            };

            if (OsInfo.IsWindows)
            {
                assemblies.Add("NzbDrone.Windows");
            }

            else
            {
                assemblies.Add("NzbDrone.Mono");
            }

            return(new UpdateContainerBuilder(startupContext, assemblies.ToArray()).Container);
        }
        public static IContainer Build(IStartupContext startupContext)
        {
            var assemblies = new List<string>
                             {
                                 "NzbDrone.Update",
                                 "NzbDrone.Common"
                             };

            if (OsInfo.IsWindows)
            {
                assemblies.Add("NzbDrone.Windows");
            }

            else
            {
                assemblies.Add("NzbDrone.Mono");
            }

            return new UpdateContainerBuilder(startupContext, assemblies.ToArray()).Container;
        }
Example #21
0
        protected ContainerBuilderBase(IStartupContext args, List <string> assemblies)
        {
            _loadedTypes = new List <Type>();

            assemblies.Add(OsInfo.IsWindows ? "Readarr.Windows" : "Readarr.Mono");
            assemblies.Add("Readarr.Common");

            var startupPath = AppDomain.CurrentDomain.BaseDirectory;

            foreach (var assemblyName in assemblies)
            {
                _loadedTypes.AddRange(AssemblyLoadContext.Default.LoadFromAssemblyPath(Path.Combine(startupPath, $"{assemblyName}.dll")).GetTypes());
            }

            AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(ContainerResolveEventHandler);
            RegisterSQLiteResolver();

            Container = new Container(new TinyIoCContainer(), _loadedTypes);
            AutoRegisterInterfaces();
            Container.Register(args);
        }
Example #22
0
        public AppLifetime(IHostApplicationLifetime appLifetime,
                           IConfigFileProvider configFileProvider,
                           IRuntimeInfo runtimeInfo,
                           IStartupContext startupContext,
                           IBrowserService browserService,
                           IProcessProvider processProvider,
                           IEventAggregator eventAggregator,
                           Logger logger)
        {
            _appLifetime        = appLifetime;
            _configFileProvider = configFileProvider;
            _runtimeInfo        = runtimeInfo;
            _startupContext     = startupContext;
            _browserService     = browserService;
            _processProvider    = processProvider;
            _eventAggregator    = eventAggregator;
            _logger             = logger;

            appLifetime.ApplicationStarted.Register(OnAppStarted);
            appLifetime.ApplicationStopped.Register(OnAppStopped);
        }
Example #23
0
        public static void Register(IStartupContext startupContext, bool updateApp, bool inConsole)
        {
            if (_isConfigured)
            {
                throw new InvalidOperationException("Loggers have already been registered.");
            }

            _isConfigured = true;

            GlobalExceptionHandlers.Register();

            var appFolderInfo = new AppFolderInfo(startupContext);

            if (Debugger.IsAttached)
            {
                RegisterDebugger();
            }

            RegisterSentry(updateApp);

            if (updateApp)
            {
                RegisterUpdateFile(appFolderInfo);
                RegisterLogEntries();
            }
            else
            {
                if (inConsole && (OsInfo.IsNotWindows || RuntimeInfo.IsUserInteractive))
                {
                    RegisterConsole();
                }

                RegisterAppFile(appFolderInfo);
            }

            RegisterAuthLogger();

            LogManager.ReconfigExistingLoggers();
        }
Example #24
0
        public InstallUpdateService(ICheckUpdateService checkUpdateService,
                                    IAppFolderInfo appFolderInfo,
                                    IManageCommandQueue commandQueueManager,
                                    IDiskProvider diskProvider,
                                    IDiskTransferService diskTransferService,
                                    IHttpClient httpClient,
                                    IArchiveService archiveService,
                                    IProcessProvider processProvider,
                                    IVerifyUpdates updateVerifier,
                                    IStartupContext startupContext,
                                    IDeploymentInfoProvider deploymentInfoProvider,
                                    IConfigFileProvider configFileProvider,
                                    IRuntimeInfo runtimeInfo,
                                    IBackupService backupService,
                                    IOsInfo osInfo,
                                    Logger logger)
        {
            if (configFileProvider == null)
            {
                throw new ArgumentNullException(nameof(configFileProvider));
            }

            _checkUpdateService     = checkUpdateService;
            _appFolderInfo          = appFolderInfo;
            _commandQueueManager    = commandQueueManager;
            _diskProvider           = diskProvider;
            _diskTransferService    = diskTransferService;
            _httpClient             = httpClient;
            _archiveService         = archiveService;
            _processProvider        = processProvider;
            _updateVerifier         = updateVerifier;
            _startupContext         = startupContext;
            _deploymentInfoProvider = deploymentInfoProvider;
            _configFileProvider     = configFileProvider;
            _runtimeInfo            = runtimeInfo;
            _backupService          = backupService;
            _osInfo = osInfo;
            _logger = logger;
        }
Example #25
0
        public static void Register(IStartupContext startupContext, bool updateApp, bool inConsole)
        {
            if (_isConfigured)
            {
                throw new InvalidOperationException("Loggers have already been registered.");
            }

            _isConfigured = true;

            GlobalExceptionHandlers.Register();

            var appFolderInfo = new AppFolderInfo(startupContext);

            if (Debugger.IsAttached)
            {
                RegisterDebugger();
            }

            //Disabling for now - until its fixed or we yank it out
            //RegisterExceptron();

            if (updateApp)
            {
                RegisterUpdateFile(appFolderInfo);
                RegisterLogEntries();
            }
            else
            {
                if (inConsole && (OsInfo.IsNotWindows || RuntimeInfoBase.IsUserInteractive))
                {
                    RegisterConsole();
                }

                RegisterAppFile(appFolderInfo);
            }

            LogManager.ReconfigExistingLoggers();
        }
Example #26
0
        private static ApplicationModes GetApplicationMode(IStartupContext startupContext)
        {
            if (startupContext.Flags.Contains(StartupContext.HELP))
            {
                return(ApplicationModes.Help);
            }

            if (OsInfo.IsWindows && startupContext.InstallService)
            {
                return(ApplicationModes.InstallService);
            }

            if (OsInfo.IsWindows && startupContext.UninstallService)
            {
                return(ApplicationModes.UninstallService);
            }

            if (_container.Resolve <IRuntimeInfo>().IsWindowsService)
            {
                return(ApplicationModes.Service);
            }

            return(ApplicationModes.Interactive);
        }
Example #27
0
        internal PluginManager(IStartupContext context)
        {
            _plugins = new List <IPlugin>();

            var appDirectory    = Path.GetDirectoryName(context.AppInfo.Path);
            var pluginDirectory = Path.Combine(appDirectory, "Plugins");

            if (!Directory.Exists(pluginDirectory))
            {
                return;
            }

            foreach (var pluginLocation in Directory.EnumerateFiles(pluginDirectory, "*.dll", SearchOption.TopDirectoryOnly))
            {
                TryLoadPlugin(pluginLocation);
            }

#if DEBUG
            var debugFileName = Path.Combine(pluginDirectory, "debug.txt");
            if (File.Exists(debugFileName))
            {
                using (StreamReader sr = new StreamReader(debugFileName))
                {
                    string pluginLocation = null;
                    while (!sr.EndOfStream)
                    {
                        pluginLocation = sr.ReadLine();
                        if (!string.IsNullOrWhiteSpace(pluginLocation))
                        {
                            TryLoadPlugin(Path.Combine(appDirectory, pluginLocation));
                        }
                    }
                }
            }
#endif
        }
Example #28
0
        private static ApplicationModes GetApplicationMode(IStartupContext startupContext)
        {
            if (startupContext.Flags.Contains(StartupContext.HELP))
            {
                return ApplicationModes.Help;
            }

            if (OsInfo.IsWindows && startupContext.InstallService)
            {
                return ApplicationModes.InstallService;
            }

            if (OsInfo.IsWindows && startupContext.UninstallService)
            {
                return ApplicationModes.UninstallService;
            }

            if (_container.Resolve<IRuntimeInfo>().IsWindowsService)
            {
                return ApplicationModes.Service;
            }

            return ApplicationModes.Interactive;
        }
Example #29
0
        private void EnsureSingleInstance(bool isService, IStartupContext startupContext, ISingleInstancePolicy instancePolicy)
        {
            if (startupContext.Flags.Contains(StartupContext.NO_SINGLE_INSTANCE_CHECK))
            {
                return;
            }

            if (startupContext.Flags.Contains(StartupContext.TERMINATE))
            {
                instancePolicy.KillAllOtherInstance();
            }
            else if (startupContext.Args.ContainsKey(StartupContext.APPDATA))
            {
                instancePolicy.WarnIfAlreadyRunning();
            }
            else if (isService)
            {
                instancePolicy.KillAllOtherInstance();
            }
            else
            {
                instancePolicy.PreventStartIfAlreadyRunning();
            }
        }
Example #30
0
 /// <summary>
 /// For testing purposes
 /// </summary>
 /// <param name="startupContext"></param>
 public static void SetApplicationDefaultContext(IStartupContext startupContext) => ApplicationContext._Default = startupContext;
Example #31
0
 public async Task Boot(IStartupContext context)
 {
     root = await Root.Create(context);
 }
 private UpdateContainerBuilder(IStartupContext startupContext, string[] assemblies)
     : base(startupContext, assemblies)
 {
     Container.Register<IHttpDispatcher, FallbackHttpDispatcher>();
 }
 public static void Register(IStartupContext startupArgs, bool updateApp, bool inConsole)
 {
     RadarrLogger.Register(startupArgs, updateApp, inConsole);
     GlobalExceptionHandlers.Register();
 }
Example #34
0
 private UpdateContainerBuilder(IStartupContext startupContext, List <string> assemblies)
     : base(startupContext, assemblies)
 {
     Container.Register <IHttpDispatcher, FallbackHttpDispatcher>();
 }
Example #35
0
 public SpinService(IRuntimeInfo runtimeInfo, IProcessProvider processProvider, IStartupContext startupContext, Logger logger)
 {
     _runtimeInfo     = runtimeInfo;
     _processProvider = processProvider;
     _startupContext  = startupContext;
     _logger          = logger;
 }
Example #36
0
 public WaitForExit(IRuntimeInfo runtimeInfo, IProcessProvider processProvider, IStartupContext startupContext, ILogger logger)
 {
     _runtimeInfo     = runtimeInfo;
     _processProvider = processProvider;
     _startupContext  = startupContext;
     _logger          = logger;
 }
Example #37
0
 public StartNzbDrone(IServiceProvider serviceProvider, IProcessProvider processProvider, IStartupContext startupContext, Logger logger)
 {
     _serviceProvider = serviceProvider;
     _processProvider = processProvider;
     _startupContext  = startupContext;
     _logger          = logger;
 }
Example #38
0
        public void Configure(IApplicationBuilder app,
                              IStartupContext startupContext,
                              Lazy <IMainDatabase> mainDatabaseFactory,
                              Lazy <ILogDatabase> logDatabaseFactory,
                              Lazy <ICacheDatabase> cacheDatabaseFactory,
                              DatabaseTarget dbTarget,
                              ISingleInstancePolicy singleInstancePolicy,
                              InitializeLogger initializeLogger,
                              ReconfigureLogging reconfigureLogging,
                              IAppFolderFactory appFolderFactory,
                              IProvidePidFile pidFileProvider,
                              IConfigFileProvider configFileProvider,
                              IRuntimeInfo runtimeInfo,
                              IFirewallAdapter firewallAdapter,
                              ReadarrErrorPipeline errorHandler)
        {
            initializeLogger.Initialize();
            appFolderFactory.Register();
            pidFileProvider.Write();

            reconfigureLogging.Reconfigure();

            EnsureSingleInstance(false, startupContext, singleInstancePolicy);

            // instantiate the databases to initialize/migrate them
            _ = mainDatabaseFactory.Value;
            _ = logDatabaseFactory.Value;
            _ = cacheDatabaseFactory.Value;

            dbTarget.Register();

            if (OsInfo.IsNotWindows)
            {
                Console.CancelKeyPress += (sender, eventArgs) => NLog.LogManager.Configuration = null;
            }

            if (OsInfo.IsWindows && runtimeInfo.IsAdmin)
            {
                firewallAdapter.MakeAccessible();
            }

            app.UseMiddleware <LoggingMiddleware>();
            app.UsePathBase(new PathString(configFileProvider.UrlBase));
            app.UseExceptionHandler(new ExceptionHandlerOptions
            {
                AllowStatusCode404Response = true,
                ExceptionHandler           = errorHandler.HandleException
            });

            app.UseRouting();
            app.UseCors();
            app.UseAuthentication();
            app.UseAuthorization();
            app.UseResponseCompression();
            app.Properties["host.AppName"] = BuildInfo.AppName;

            app.UseMiddleware <VersionMiddleware>();
            app.UseMiddleware <UrlBaseMiddleware>(configFileProvider.UrlBase);
            app.UseMiddleware <CacheHeaderMiddleware>();
            app.UseMiddleware <IfModifiedMiddleware>();
            app.UseMiddleware <BufferingMiddleware>(new List <string> {
                "/api/v1/command"
            });

            app.UseWebSockets();

            app.UseEndpoints(x =>
            {
                x.MapHub <MessageHub>("/signalr/messages").RequireAuthorization("SignalR");
                x.MapControllers();
            });
        }
Example #39
0
 private UpdateContainerBuilder(IStartupContext startupContext, List <string> assemblies)
     : base(startupContext, assemblies)
 {
 }
Example #40
0
        private UpdateContainerBuilder(IStartupContext startupContext, string[] assemblies)
            : base(startupContext, assemblies)
        {

        }