fixed NzbDrone using 100% cpu when console not available.

This commit is contained in:
Keivan Beigi
2013-08-20 15:12:35 -07:00
parent e377e02db4
commit 75a46a3abe
9 changed files with 39 additions and 31 deletions

View File

@@ -7,8 +7,6 @@ namespace NzbDrone.Common
{
public interface IConsoleService
{
bool IsConsoleApplication { get; }
void WaitForClose();
void PrintHelp();
void PrintServiceAlreadyExist();
void PrintServiceDoesNotExist();
@@ -16,26 +14,18 @@ namespace NzbDrone.Common
public class ConsoleService : IConsoleService
{
public bool IsConsoleApplication
public static bool IsConsoleAvailable
{
get { return Console.In != StreamReader.Null; }
}
public void WaitForClose()
{
while (true)
{
Console.ReadLine();
}
}
public void PrintHelp()
{
Console.WriteLine();
Console.WriteLine(" Usage: {0} <command> ", Process.GetCurrentProcess().MainModule.ModuleName);
Console.WriteLine(" Commands:");
Console.WriteLine(" /{0} Install the application as a Windows Service ({1}).",StartupArguments.INSTALL_SERVICE, ServiceProvider.NZBDRONE_SERVICE_NAME);
Console.WriteLine(" /{0} Uninstall already installed Windows Service ({1}).",StartupArguments.UNINSTALL_SERVICE, ServiceProvider.NZBDRONE_SERVICE_NAME);
Console.WriteLine(" /{0} Install the application as a Windows Service ({1}).", StartupArguments.INSTALL_SERVICE, ServiceProvider.NZBDRONE_SERVICE_NAME);
Console.WriteLine(" /{0} Uninstall already installed Windows Service ({1}).", StartupArguments.UNINSTALL_SERVICE, ServiceProvider.NZBDRONE_SERVICE_NAME);
Console.WriteLine(" /{0} Don't open NzbDrone in a browser", StartupArguments.NO_BROWSER);
Console.WriteLine(" <No Arguments> Run application in console mode.");
}