diff options
| author | Luke <luke.pulverenti@gmail.com> | 2016-11-13 23:50:23 -0500 |
|---|---|---|
| committer | Luke <luke.pulverenti@gmail.com> | 2016-11-13 23:50:23 -0500 |
| commit | 9700a3be600e569d6f5c036f79aee8b39431696d (patch) | |
| tree | 9480cb6afb9b0db9c53c7fb1d219cdca15556896 /MediaBrowser.Server.Mac/Main.cs | |
| parent | db5008644b7ddd09166b91635040a2c82908b0dc (diff) | |
update mac project
Diffstat (limited to 'MediaBrowser.Server.Mac/Main.cs')
| -rw-r--r-- | MediaBrowser.Server.Mac/Main.cs | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/MediaBrowser.Server.Mac/Main.cs b/MediaBrowser.Server.Mac/Main.cs index b48f44707..d0d489142 100644 --- a/MediaBrowser.Server.Mac/Main.cs +++ b/MediaBrowser.Server.Mac/Main.cs @@ -10,25 +10,22 @@ using System.Runtime.InteropServices; using System.Security.Cryptography.X509Certificates; using System.Threading; using System.Threading.Tasks; -using MediaBrowser.Common.Configuration; -using MediaBrowser.Common.Implementations.IO; -using MediaBrowser.Common.Implementations.Logging; using MediaBrowser.Model.Logging; using MediaBrowser.Server.Implementations; using MediaBrowser.Server.Startup.Common; -using MediaBrowser.Server.Startup.Common.Browser; using Microsoft.Win32; using MonoMac.AppKit; using MonoMac.Foundation; using MonoMac.ObjCRuntime; -using CommonIO; -using MediaBrowser.Server.Implementations.Logging; +using Emby.Server.Core; +using Emby.Common.Implementations.Logging; +using Emby.Server.Mac.Native; namespace MediaBrowser.Server.Mac { class MainClass { - internal static ApplicationHost AppHost; + internal static MacAppHost AppHost; private static ILogger _logger; @@ -41,7 +38,9 @@ namespace MediaBrowser.Server.Mac // Allow this to be specified on the command line. var customProgramDataPath = options.GetOption("-programdata"); - var appPaths = CreateApplicationPaths(applicationPath, customProgramDataPath); + var appFolderPath = Path.GetDirectoryName(applicationPath); + + var appPaths = CreateApplicationPaths(appFolderPath, customProgramDataPath); var logManager = new NlogManager(appPaths.LogDirectoryPath, "server"); logManager.ReloadLogger(LogSeverity.Info); @@ -58,7 +57,7 @@ namespace MediaBrowser.Server.Mac NSApplication.Main (args); } - private static ServerApplicationPaths CreateApplicationPaths(string applicationPath, string programDataPath) + private static ServerApplicationPaths CreateApplicationPaths(string appFolderPath, string programDataPath) { if (string.IsNullOrEmpty(programDataPath)) { @@ -71,9 +70,9 @@ namespace MediaBrowser.Server.Mac } // Within the mac bundle, go uo two levels then down into Resources folder - var resourcesPath = Path.Combine(Path.GetDirectoryName(Path.GetDirectoryName (applicationPath)), "Resources"); + var resourcesPath = Path.Combine(Path.GetDirectoryName(appFolderPath), "Resources"); - return new ServerApplicationPaths(programDataPath, applicationPath, resourcesPath); + return new ServerApplicationPaths(programDataPath, appFolderPath, resourcesPath); } /// <summary> @@ -91,12 +90,16 @@ namespace MediaBrowser.Server.Mac // Allow all https requests ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(delegate { return true; }); - var fileSystem = new ManagedFileSystem(new PatternsLogger(logManager.GetLogger("FileSystem")), false, true); + var fileSystem = new MonoFileSystem(logManager.GetLogger("FileSystem"), false, false); fileSystem.AddShortcutHandler(new MbLinkShortcutHandler(fileSystem)); - var nativeApp = new NativeApp(logManager.GetLogger("App")); - - AppHost = new ApplicationHost(appPaths, logManager, options, fileSystem, "Emby.Server.Mac.pkg", nativeApp); + AppHost = new MacAppHost(appPaths, + logManager, + options, + fileSystem, + new PowerManagement(), + "Emby.Server.Mac.pkg", + nativeApp); if (options.ContainsOption("-v")) { Console.WriteLine (AppHost.ApplicationVersion.ToString()); |
