浏览代码

update mac project

Luke 10 年之前
父节点
当前提交
7016173217

+ 5 - 6
MediaBrowser.Common.Implementations/BaseApplicationHost.cs

@@ -378,14 +378,13 @@ namespace MediaBrowser.Common.Implementations
         /// <returns>Task.</returns>
         public virtual Task RunStartupTasks()
         {
-            return Task.Run(() =>
-            {
-                Resolve<ITaskManager>().AddTasks(GetExports<IScheduledTask>(false));
+			Resolve<ITaskManager>().AddTasks(GetExports<IScheduledTask>(false));
 
-                Task.Run(() => ConfigureAutorun());
+			ConfigureAutorun ();
 
-                ConfigurationManager.ConfigurationUpdated += OnConfigurationUpdated;
-            });
+			ConfigurationManager.ConfigurationUpdated += OnConfigurationUpdated;
+
+			return Task.FromResult (true);
         }
 
         /// <summary>

+ 21 - 7
MediaBrowser.Common.Implementations/Logging/NlogManager.cs

@@ -2,6 +2,7 @@
 using NLog;
 using NLog.Config;
 using NLog.Targets;
+using NLog.Targets.Wrappers;
 using System;
 using System.IO;
 using System.Linq;
@@ -42,6 +43,8 @@ namespace MediaBrowser.Common.Implementations.Logging
         {
             LogDirectory = logDirectory;
             LogFilePrefix = logFileNamePrefix;
+
+			LogManager.Configuration = new LoggingConfiguration ();
         }
 
         private LogSeverity _severity = LogSeverity.Debug;
@@ -86,16 +89,22 @@ namespace MediaBrowser.Common.Implementations.Logging
         /// <param name="level">The level.</param>
         private void AddFileTarget(string path, LogSeverity level)
         {
-            var logFile = new FileTarget
+			RemoveTarget("ApplicationLogFileWrapper");
+
+			var wrapper = new AsyncTargetWrapper ();
+			wrapper.Name = "ApplicationLogFileWrapper";
+
+			var logFile = new FileTarget
             {
                 FileName = path,
                 Layout = "${longdate} ${level} - ${logger}: ${message}"
             };
 
-            RemoveTarget("ApplicationLogFile");
             logFile.Name = "ApplicationLogFile";
 
-            AddLogTarget(logFile, level);
+			wrapper.WrappedTarget = logFile;
+
+            AddLogTarget(wrapper, level);
         }
 
         /// <summary>
@@ -216,22 +225,27 @@ namespace MediaBrowser.Common.Implementations.Logging
 
         public void AddConsoleOutput()
         {
+			RemoveTarget("ConsoleTargetWrapper");
+
+			var wrapper = new AsyncTargetWrapper ();
+			wrapper.Name = "ConsoleTargetWrapper";
+
             var target = new ConsoleTarget()
             {
                 Layout = "${level}, ${logger}, ${message}",
                 Error = false
             };
 
-            RemoveTarget("ConsoleTarget");
-
             target.Name = "ConsoleTarget";
 
-            AddLogTarget(target, LogSeverity);
+			wrapper.WrappedTarget = target;
+
+			AddLogTarget(wrapper, LogSeverity);
         }
 
         public void RemoveConsoleOutput()
         {
-            RemoveTarget("ConsoleTarget");
+			RemoveTarget("ConsoleTargetWrapper");
         }
     }
 }

+ 3 - 2
MediaBrowser.Server.Mac/AppController.cs

@@ -26,7 +26,6 @@ namespace MediaBrowser.Server.Mac
 		{
 			Instance = this;
 			MainClass.AddDependencies (this);
-			ConfigurationManager.ConfigurationUpdated += Instance_ConfigurationUpdated;
 		}
 
 		public override void AwakeFromNib()
@@ -74,7 +73,9 @@ namespace MediaBrowser.Server.Mac
 			});
 			statusMenu.AddItem (quitMenuItem);
 
-			LocalizeText ();
+			//ConfigurationManager.ConfigurationUpdated -= Instance_ConfigurationUpdated;
+			//LocalizeText ();
+			//ConfigurationManager.ConfigurationUpdated += Instance_ConfigurationUpdated;
 		}
 
 		public IServerApplicationHost AppHost{ get; set;}

+ 0 - 1
MediaBrowser.Server.Mac/Main.cs

@@ -55,7 +55,6 @@ namespace MediaBrowser.Server.Mac
 			StartApplication(appPaths, logManager, options);
 			NSApplication.Init ();
 			NSApplication.Main (args);
-			var b = true;
 		}
 
 		public static void AddDependencies(AppController appController){

+ 0 - 1
MediaBrowser.Server.Mac/MediaBrowser.Server.Mac.csproj

@@ -108,7 +108,6 @@
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </None>
     <None Include="packages.config" />
-    <None Include="app.config" />
   </ItemGroup>
   <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
   <ItemGroup>

+ 0 - 9
MediaBrowser.Server.Mac/app.config

@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<configuration>
-  <configSections>
-    <section name="nlog" type="NLog.Config.ConfigSectionHandler, NLog" />
-  </configSections>
-  <nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
-    <targets async="true"></targets>
-  </nlog>
-</configuration>