Esempio n. 1
0
        public static void Start(StartupContext startupContext, IUserAlert userAlert, Action <IContainer> startCallback = null)
        {
            LogTargets.Register(startupContext, false, true);

            try
            {
                GlobalExceptionHandlers.Register();
                IgnoreCertErrorPolicy.Register();

                Logger.Info("Starting NzbDrone - {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);

                if (startCallback != null)
                {
                    startCallback(_container);
                }

                else
                {
                    SpinToExit(appMode);
                }
            }
            catch (TerminateApplicationException e)
            {
                Logger.Info(e.Message);
                LogManager.Configuration = null;
            }
        }
Esempio n. 2
0
        public static IContainer Start(StartupArguments args, IUserAlert userAlert)
        {
            var logger = NzbDroneLogger.GetLogger();

            GlobalExceptionHandlers.Register();
            IgnoreCertErrorPolicy.Register();

            logger.Info("Starting NzbDrone Console. Version {0}", Assembly.GetExecutingAssembly().GetName().Version);


            if (!PlatformValidation.IsValidate(userAlert))
            {
                throw new TerminateApplicationException();
            }

            var container = MainAppContainerBuilder.BuildContainer(args);

            DbFactory.RegisterDatabase(container);
            container.Resolve <Router>().Route();

            return(container);
        }
Esempio n. 3
0
        public static void Main(string[] args)
        {
            try
            {
                var startupArgument = new StartupContext(args);
                LogTargets.Register(startupArgument, true, true);

                Console.WriteLine("Starting NzbDrone Update Client");

                IgnoreCertErrorPolicy.Register();

                GlobalExceptionHandlers.Register();

                _container = UpdateContainerBuilder.Build(startupArgument);

                logger.Info("Updating NzbDrone to version {0}", BuildInfo.Version);
                _container.Resolve <UpdateApp>().Start(args);
            }
            catch (Exception e)
            {
                logger.FatalException("An error has occurred while applying update package.", e);
            }
        }