diff --git a/MediaBrowser.Server.Mac.sln b/MediaBrowser.Server.Mac.sln index a4d850ff41..91d76ca6d2 100644 --- a/MediaBrowser.Server.Mac.sln +++ b/MediaBrowser.Server.Mac.sln @@ -286,13 +286,14 @@ Global {C97B98FA-00D4-4880-88B8-C76017A418AB}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(MonoDevelopProperties) = preSolution - StartupItem = MediaBrowser.Server.Mac\MediaBrowser.Server.Mac.csproj - Policies = $0 - $0.DotNetNamingPolicy = $1 - $1.DirectoryNamespaceAssociation = None - $1.ResourceNamePolicy = FileFormatDefault - $0.VersionControlPolicy = $2 - $2.inheritsSet = Mono + StartupItems = $0 + $0.Item = MediaBrowser.Server.Mac\MediaBrowser.Server.Mac.csproj + Policies = $1 + $1.DotNetNamingPolicy = $2 + $2.DirectoryNamespaceAssociation = None + $2.ResourceNamePolicy = FileFormatDefault + $1.VersionControlPolicy = $3 + $3.inheritsSet = Mono version = EndGlobalSection EndGlobal diff --git a/MediaBrowser.Server.Mac.userprefs b/MediaBrowser.Server.Mac.userprefs index fb3457d9d4..4e0fb8a83e 100644 --- a/MediaBrowser.Server.Mac.userprefs +++ b/MediaBrowser.Server.Mac.userprefs @@ -1,24 +1,46 @@  - - + + - - - + + + + + + + + + + - + + + + + - - + + + + + + + + + + - + + + + \ No newline at end of file diff --git a/MediaBrowser.Server.Mac/AppController.cs b/MediaBrowser.Server.Mac/AppController.cs index 1823e21528..c500084e24 100644 --- a/MediaBrowser.Server.Mac/AppController.cs +++ b/MediaBrowser.Server.Mac/AppController.cs @@ -25,6 +25,7 @@ namespace MediaBrowser.Server.Mac public AppController() { Instance = this; + MainClass.AddDependencies (this); } public override void AwakeFromNib() diff --git a/MediaBrowser.Server.Mac/Main.cs b/MediaBrowser.Server.Mac/Main.cs index 88b9497ead..6b76a63f1b 100644 --- a/MediaBrowser.Server.Mac/Main.cs +++ b/MediaBrowser.Server.Mac/Main.cs @@ -15,7 +15,6 @@ using MediaBrowser.Common.Implementations.IO; using MediaBrowser.Common.Implementations.Logging; using MediaBrowser.Model.Logging; using MediaBrowser.Server.Implementations; -using MediaBrowser.Server.Mono.Native; using MediaBrowser.Server.Startup.Common; using MediaBrowser.Server.Startup.Common.Browser; using Microsoft.Win32; @@ -54,26 +53,23 @@ namespace MediaBrowser.Server.Mac AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; StartApplication(appPaths, logManager, options); - RunNSApp (args); - } - - private static void RunNSApp(string[] args) { - NSApplication.Init (); - - AppController.Instance.AppHost = _appHost; - AppController.Instance.Logger = _logger; - AppController.Instance.ConfigurationManager = _appHost.ServerConfigurationManager; - AppController.Instance.Localization = _appHost.LocalizationManager; - NSApplication.Main (args); + var b = true; + } + + public static void AddDependencies(AppController appController){ + appController.AppHost = _appHost; + appController.Logger = _logger; + appController.ConfigurationManager = _appHost.ServerConfigurationManager; + appController.Localization = _appHost.LocalizationManager; } private static ServerApplicationPaths CreateApplicationPaths(string applicationPath, string programDataPath) { if (string.IsNullOrEmpty(programDataPath)) { - return new ServerApplicationPaths(applicationPath); + programDataPath = Path.Combine(Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData), "mediabrowser"); } return new ServerApplicationPaths(programDataPath, applicationPath); diff --git a/MediaBrowser.Server.Mac/MediaBrowser.Server.Mac.csproj b/MediaBrowser.Server.Mac/MediaBrowser.Server.Mac.csproj index 2f67874882..648bdca050 100644 --- a/MediaBrowser.Server.Mac/MediaBrowser.Server.Mac.csproj +++ b/MediaBrowser.Server.Mac/MediaBrowser.Server.Mac.csproj @@ -72,9 +72,9 @@ + - AppDelegate.cs @@ -83,6 +83,8 @@ AppController.cs + + diff --git a/MediaBrowser.Server.Mac/Native/NativeApp.cs b/MediaBrowser.Server.Mac/Native/NativeApp.cs new file mode 100644 index 0000000000..aedce3d667 --- /dev/null +++ b/MediaBrowser.Server.Mac/Native/NativeApp.cs @@ -0,0 +1,20 @@ +using System; +using MediaBrowser.Server.Mono.Native; + +namespace MediaBrowser.Server.Mac +{ + /// + /// Class NativeApp + /// + public class NativeApp : BaseMonoApp + { + /// + /// Shutdowns this instance. + /// + public override void Shutdown() + { + MainClass.Shutdown(); + } + } +} + diff --git a/MediaBrowser.Server.Mono/Native/NativeApp.cs b/MediaBrowser.Server.Mono/Native/NativeApp.cs index b71b74a662..d92b86157a 100644 --- a/MediaBrowser.Server.Mono/Native/NativeApp.cs +++ b/MediaBrowser.Server.Mono/Native/NativeApp.cs @@ -4,7 +4,7 @@ namespace MediaBrowser.Server.Mono.Native /// /// Class NativeApp /// - public class NativeApp : BaseMonoApp + internal class NativeApp : BaseMonoApp { /// /// Shutdowns this instance.