|
|
@ -23,7 +23,7 @@ namespace MediaBrowser.Server.Mono
|
|
|
|
|
|
|
|
|
|
|
|
private static ILogger _logger;
|
|
|
|
private static ILogger _logger;
|
|
|
|
|
|
|
|
|
|
|
|
public static void Main (string[] args)
|
|
|
|
public static void Main(string[] args)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var applicationPath = Assembly.GetEntryAssembly().Location;
|
|
|
|
var applicationPath = Assembly.GetEntryAssembly().Location;
|
|
|
|
|
|
|
|
|
|
|
@ -81,26 +81,27 @@ namespace MediaBrowser.Server.Mono
|
|
|
|
|
|
|
|
|
|
|
|
_appHost = new ApplicationHost(appPaths, logManager, options, fileSystem, "MBServer.Mono", nativeApp);
|
|
|
|
_appHost = new ApplicationHost(appPaths, logManager, options, fileSystem, "MBServer.Mono", nativeApp);
|
|
|
|
|
|
|
|
|
|
|
|
if (options.ContainsOption("-v")) {
|
|
|
|
if (options.ContainsOption("-v"))
|
|
|
|
Console.WriteLine (_appHost.ApplicationVersion.ToString());
|
|
|
|
{
|
|
|
|
|
|
|
|
Console.WriteLine(_appHost.ApplicationVersion.ToString());
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Console.WriteLine ("appHost.Init");
|
|
|
|
Console.WriteLine("appHost.Init");
|
|
|
|
|
|
|
|
|
|
|
|
var initProgress = new Progress<double>();
|
|
|
|
var initProgress = new Progress<double>();
|
|
|
|
|
|
|
|
|
|
|
|
var task = _appHost.Init(initProgress);
|
|
|
|
var task = _appHost.Init(initProgress);
|
|
|
|
Task.WaitAll (task);
|
|
|
|
Task.WaitAll(task);
|
|
|
|
|
|
|
|
|
|
|
|
Console.WriteLine ("Running startup tasks");
|
|
|
|
Console.WriteLine("Running startup tasks");
|
|
|
|
|
|
|
|
|
|
|
|
task = _appHost.RunStartupTasks();
|
|
|
|
task = _appHost.RunStartupTasks();
|
|
|
|
Task.WaitAll (task);
|
|
|
|
Task.WaitAll(task);
|
|
|
|
|
|
|
|
|
|
|
|
task = ApplicationTaskCompletionSource.Task;
|
|
|
|
task = ApplicationTaskCompletionSource.Task;
|
|
|
|
|
|
|
|
|
|
|
|
Task.WaitAll (task);
|
|
|
|
Task.WaitAll(task);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
@ -135,7 +136,7 @@ namespace MediaBrowser.Server.Mono
|
|
|
|
|
|
|
|
|
|
|
|
public static void Shutdown()
|
|
|
|
public static void Shutdown()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
ApplicationTaskCompletionSource.SetResult (true);
|
|
|
|
ApplicationTaskCompletionSource.SetResult(true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static void Restart()
|
|
|
|
public static void Restart()
|
|
|
@ -145,14 +146,17 @@ namespace MediaBrowser.Server.Mono
|
|
|
|
|
|
|
|
|
|
|
|
_logger.Info("Starting new instance");
|
|
|
|
_logger.Info("Starting new instance");
|
|
|
|
|
|
|
|
|
|
|
|
var currentProcess = Process.GetCurrentProcess();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var args = Environment.GetCommandLineArgs()
|
|
|
|
var args = Environment.GetCommandLineArgs()
|
|
|
|
|
|
|
|
.Skip(1)
|
|
|
|
.Select(NormalizeCommandLineArgument);
|
|
|
|
.Select(NormalizeCommandLineArgument);
|
|
|
|
|
|
|
|
|
|
|
|
var commandLineArgsString = string.Join(" ", args.ToArray());
|
|
|
|
var commandLineArgsString = string.Join(" ", args.ToArray());
|
|
|
|
|
|
|
|
var module = Environment.GetCommandLineArgs().First();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_logger.Info("Executable: {0}", module);
|
|
|
|
|
|
|
|
_logger.Info("Arguments: {0}", commandLineArgsString);
|
|
|
|
|
|
|
|
|
|
|
|
Process.Start(currentProcess.MainModule.FileName, commandLineArgsString);
|
|
|
|
Process.Start(module, commandLineArgsString);
|
|
|
|
|
|
|
|
|
|
|
|
_logger.Info("Calling Environment.Exit");
|
|
|
|
_logger.Info("Calling Environment.Exit");
|
|
|
|
Environment.Exit(0);
|
|
|
|
Environment.Exit(0);
|
|
|
@ -171,7 +175,7 @@ namespace MediaBrowser.Server.Mono
|
|
|
|
|
|
|
|
|
|
|
|
class NoCheckCertificatePolicy : ICertificatePolicy
|
|
|
|
class NoCheckCertificatePolicy : ICertificatePolicy
|
|
|
|
{
|
|
|
|
{
|
|
|
|
public bool CheckValidationResult (ServicePoint srvPoint, X509Certificate certificate, WebRequest request, int certificateProblem)
|
|
|
|
public bool CheckValidationResult(ServicePoint srvPoint, X509Certificate certificate, WebRequest request, int certificateProblem)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|