Merge branch 'master' into Patron
This commit is contained in:
21
NLog-user.config
Normal file
21
NLog-user.config
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||||
|
<variable name="logStamp" value="${time} ${pad:padding=-8:inner=[${level:uppercase=true}]}" />
|
||||||
|
<variable name="logContent" value="${message:withException=true}"/>
|
||||||
|
|
||||||
|
<targets async="true">
|
||||||
|
<target xsi:type="Null" name="null" formatMessage="false" />
|
||||||
|
<target xsi:type="File" name="keen" layout="${var:logStamp} ${logger}: ${var:logContent}" fileName="Logs\Keen-${shortdate}.log" />
|
||||||
|
<target xsi:type="File" name="main" layout="${var:logStamp} ${logger}: ${var:logContent}" fileName="Logs\Torch-${shortdate}.log" />
|
||||||
|
<target xsi:type="File" name="chat" layout="${longdate} ${message}" fileName="Logs\Chat.log" />
|
||||||
|
<target xsi:type="ColoredConsole" name="console" layout="${var:logStamp} ${logger:shortName=true}: ${var:logContent}" />
|
||||||
|
<target xsi:type="File" name="patch" layout="${var:logContent}" fileName="Logs\patch.log"/>
|
||||||
|
<target xsi:type="FlowDocument" name="wpf" layout="${var:logStamp} ${logger:shortName=true}: ${var:logContent}" />
|
||||||
|
</targets>
|
||||||
|
|
||||||
|
<rules>
|
||||||
|
<!-- Define custom rules below. The example line will pipe all debug output to log file, in-UI console, and independent console. -->
|
||||||
|
<!--<logger name="*" minlevel="Debug" writeTo="main, console, wpf" />-->
|
||||||
|
</rules>
|
||||||
|
</nlog>
|
@@ -4,6 +4,8 @@
|
|||||||
<variable name="logStamp" value="${time} ${pad:padding=-8:inner=[${level:uppercase=true}]}" />
|
<variable name="logStamp" value="${time} ${pad:padding=-8:inner=[${level:uppercase=true}]}" />
|
||||||
<variable name="logContent" value="${message:withException=true}"/>
|
<variable name="logContent" value="${message:withException=true}"/>
|
||||||
|
|
||||||
|
<include file="NLog-user.config"/>
|
||||||
|
|
||||||
<targets async="true">
|
<targets async="true">
|
||||||
<target xsi:type="Null" name="null" formatMessage="false" />
|
<target xsi:type="Null" name="null" formatMessage="false" />
|
||||||
<target xsi:type="File" name="keen" layout="${var:logStamp} ${logger}: ${var:logContent}" fileName="Logs\Keen-${shortdate}.log" />
|
<target xsi:type="File" name="keen" layout="${var:logStamp} ${logger}: ${var:logContent}" fileName="Logs\Keen-${shortdate}.log" />
|
||||||
@@ -15,6 +17,7 @@
|
|||||||
</targets>
|
</targets>
|
||||||
|
|
||||||
<rules>
|
<rules>
|
||||||
|
<!-- Do not define custom rules here. Use NLog-user.config -->
|
||||||
<logger name="Keen" minlevel="Warn" writeTo="main"/>
|
<logger name="Keen" minlevel="Warn" writeTo="main"/>
|
||||||
<logger name="Keen" minlevel="Info" writeTo="console, wpf"/>
|
<logger name="Keen" minlevel="Info" writeTo="console, wpf"/>
|
||||||
<logger name="Keen" minlevel="Debug" writeTo="keen" final="true" />
|
<logger name="Keen" minlevel="Debug" writeTo="keen" final="true" />
|
||||||
|
@@ -4,12 +4,14 @@ using System.IO;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using NLog;
|
||||||
using Torch.API;
|
using Torch.API;
|
||||||
|
|
||||||
namespace Torch.Managers
|
namespace Torch.Managers
|
||||||
{
|
{
|
||||||
public class FilesystemManager : Manager
|
public class FilesystemManager : Manager
|
||||||
{
|
{
|
||||||
|
private static readonly Logger _log = LogManager.GetCurrentClassLogger();
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Temporary directory for Torch that is cleared every time the program is started.
|
/// Temporary directory for Torch that is cleared every time the program is started.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -22,11 +24,20 @@ namespace Torch.Managers
|
|||||||
|
|
||||||
public FilesystemManager(ITorchBase torchInstance) : base(torchInstance)
|
public FilesystemManager(ITorchBase torchInstance) : base(torchInstance)
|
||||||
{
|
{
|
||||||
|
var tmp = Path.Combine(Path.GetTempPath(), "Torch");
|
||||||
var torch = new FileInfo(typeof(FilesystemManager).Assembly.Location).Directory.FullName;
|
var torch = new FileInfo(typeof(FilesystemManager).Assembly.Location).Directory.FullName;
|
||||||
TempDirectory = Directory.CreateDirectory(Path.Combine(torch, "tmp")).FullName;
|
if (Path.GetPathRoot(tmp) == Path.GetPathRoot(torch))
|
||||||
TorchDirectory = torch;
|
{
|
||||||
|
TempDirectory = tmp;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TempDirectory = Directory.CreateDirectory(Path.Combine(torch, "tmp")).FullName;
|
||||||
|
TorchDirectory = torch;
|
||||||
|
|
||||||
ClearTemp();
|
_log.Info($"Clearing tmp directory at {TempDirectory}");
|
||||||
|
ClearTemp();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ClearTemp()
|
private void ClearTemp()
|
||||||
|
@@ -56,8 +56,6 @@ namespace Torch.Managers
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_log.Info($"Clearing tmp directory at {_fsManager.TempDirectory}");
|
|
||||||
|
|
||||||
if (job.Version > Torch.TorchVersion)
|
if (job.Version > Torch.TorchVersion)
|
||||||
{
|
{
|
||||||
_log.Warn($"Updating Torch from version {Torch.TorchVersion} to version {job.Version}");
|
_log.Warn($"Updating Torch from version {Torch.TorchVersion} to version {job.Version}");
|
||||||
@@ -90,6 +88,9 @@ namespace Torch.Managers
|
|||||||
{
|
{
|
||||||
foreach (var file in zip.Entries)
|
foreach (var file in zip.Entries)
|
||||||
{
|
{
|
||||||
|
if(file.Name == "NLog-user.config" && File.Exists(Path.Combine(extractPath, file.FullName)))
|
||||||
|
continue;
|
||||||
|
|
||||||
_log.Debug($"Unzipping {file.FullName}");
|
_log.Debug($"Unzipping {file.FullName}");
|
||||||
var targetFile = Path.Combine(extractPath, file.FullName);
|
var targetFile = Path.Combine(extractPath, file.FullName);
|
||||||
_fsManager.SoftDelete(extractPath, file.FullName);
|
_fsManager.SoftDelete(extractPath, file.FullName);
|
||||||
|
Reference in New Issue
Block a user