示例#1
0
        static void Main(string[] args)
        {
            try
            {
                var oldColor = Console.ForegroundColor;

                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("AGN Gaming Radarr Hotpatch Loading...");
                Console.WriteLine("Attempting to bootstrap Radarr, here goes!");
                Console.ForegroundColor = oldColor;

                var patchManager = new PatchManager();

                var startupArgs = new StartupContext(args);
                try
                {
                    NzbDroneLogger.Register(startupArgs, false, true);
                }
                catch (Exception ex)
                {
                    System.Console.WriteLine("NLog Exception: " + ex.ToString());
                    throw;
                }

                if (patchManager.BeginPatching())
                {
                    Utility.WriteToConsole("All patches successful, starting Radarr.", ConsoleColor.Green);
                    Bootstrap.Start(startupArgs, new ConsoleAlerts());
                }
                else
                {
                    Console.WriteLine("");
                    Console.WriteLine("");
                    Logger.Fatal("Some HotPatch patches were not applied successfully.  Are you using a supported version of Radarr?");
                    Exit(ExitCodes.UnknownFailure);
                }
            }
            catch (SocketException e)
            {
                System.Console.WriteLine("");
                System.Console.WriteLine("");
                Logger.Fatal(e.Message + ". This can happen if another instance of Radarr is already running another application is using the same port (default: 7878) or the user has insufficient permissions");
                Exit(ExitCodes.RecoverableFailure);
            }
            catch (Exception e)
            {
                System.Console.WriteLine("");
                System.Console.WriteLine("");
                Logger.Fatal(e, "EPIC FAIL!");
                Exit(ExitCodes.UnknownFailure);
            }
        }