update mac project

This commit is contained in:
Luke 2014-11-26 22:10:44 -05:00
parent 89c0085e28
commit 7016173217
6 changed files with 29 additions and 26 deletions

View File

@ -378,14 +378,13 @@ namespace MediaBrowser.Common.Implementations
/// <returns>Task.</returns> /// <returns>Task.</returns>
public virtual Task RunStartupTasks() 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> /// <summary>

View File

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

View File

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

View File

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

View File

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

View File

@ -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>