예제 #1
0
        public static void Start(StartupContext startupContext, IUserAlert userAlert, Action <IContainer> startCallback = null)
        {
            try
            {
                Logger.Info("Starting Radarr - {0} - Version {1}",
#if NETCOREAPP
                            Process.GetCurrentProcess().MainModule.FileName,
#else
                            Assembly.GetCallingAssembly().Location,
#endif
                            Assembly.GetExecutingAssembly().GetName().Version);

                if (!PlatformValidation.IsValidate(userAlert))
                {
                    throw new TerminateApplicationException("Missing system requirements");
                }

                Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);

                _container = MainAppContainerBuilder.BuildContainer(startupContext);
                _container.Resolve <InitializeLogger>().Initialize();
                _container.Resolve <IAppFolderFactory>().Register();
                _container.Resolve <IProvidePidFile>().Write();

                var appMode = GetApplicationMode(startupContext);

                Start(appMode, startupContext);

                _container.Resolve <ICancelHandler>().Attach();

                if (startCallback != null)
                {
                    startCallback(_container);
                }
                else
                {
                    SpinToExit(appMode);
                }
            }
            catch (InvalidConfigFileException ex)
            {
                throw new RadarrStartupException(ex);
            }
            catch (TerminateApplicationException e)
            {
                Logger.Info(e.Message);
                LogManager.Configuration = null;
            }
        }
예제 #2
0
        public static void Start(StartupContext startupContext, IUserAlert userAlert, Action <IContainer> startCallback = null)
        {
            try
            {
                SecurityProtocolPolicy.Register();
                X509CertificateValidationPolicy.Register();

                Logger.Info("Starting Radarr - {0} - Version {1}", Assembly.GetCallingAssembly().Location, Assembly.GetExecutingAssembly().GetName().Version);

                if (!PlatformValidation.IsValidate(userAlert))
                {
                    throw new TerminateApplicationException("Missing system requirements");
                }

                _container = MainAppContainerBuilder.BuildContainer(startupContext);
                _container.Resolve <IAppFolderFactory>().Register();
                _container.Resolve <IProvidePidFile>().Write();

                var appMode = GetApplicationMode(startupContext);

                Start(appMode, startupContext);

                _container.Resolve <ICancelHandler>().Attach();

                if (startCallback != null)
                {
                    startCallback(_container);
                }
                else
                {
                    SpinToExit(appMode);
                }
            }
            catch (InvalidConfigFileException ex)
            {
                throw new RadarrStartupException(ex);
            }
            catch (TerminateApplicationException e)
            {
                Logger.Info(e.Message);
                LogManager.Configuration = null;
            }
        }