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

View File

@ -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");
}
}
}

View File

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

View File

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

View File

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