Merge from master (missed 1.0.3 merge)

This commit is contained in:
Ben Wallis 2018-12-06 21:45:46 +00:00
commit 444f09751a
7 changed files with 74 additions and 3 deletions

View File

@ -250,6 +250,7 @@
<DependentUpon>ThemeComponentSelectionControl.xaml</DependentUpon>
</Compile>
<Compile Include="ViewModels\DesignTime\DesignTimeItemFilterBlockViewModel.cs" />
<Compile Include="Utility\SplatNLogAdapter.cs" />
<Compile Include="ViewModels\DesignTime\DesignTimeSettingsPageViewModel.cs" />
<Compile Include="Views\AttachedProperties\SelectedItemsAttachedProperty.cs" />
<Compile Include="Utility\RoutedCommandHandler.cs" />

View File

@ -10,15 +10,21 @@
layout="${longdate} ${uppercase:${level}} ${message}" />
<target xsi:type="File" name="fDebug" fileName="${basedir}/Filtration_debug_${shortdate}.log"
layout="${longdate} ${uppercase:${level}} ${message}" />
<target xsi:type="File" name="fUpdater" fileName="${basedir}/Filtration_updater_${shortdate}.log"
layout="${longdate} ${uppercase:${level}} ${message}" />
<target xsi:type="Debugger" name="cDebug" layout="${longdate} ${uppercase:${level}} ${message}"/>
</targets>
<rules>
<!-- Squirrel Updater Log-->
<logger name="SquirrelLogger" minlevel="Trace" writeTo="fUpdater" />
<!-- Uncomment the Debug line to enable Debug logging -->
<!--<logger name="*" minlevel="Debug" writeTo="fDebug" final="true" />-->
<logger name="*" minlevel="Error" writeTo="fErrors" />
<logger name="*" minlevel="Trace" writeTo="cDebug" />
</rules>
</nlog>

View File

@ -6,6 +6,7 @@ using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Filtration.Enums;
using Filtration.Properties;
using Filtration.Utility;
using NLog;
using Squirrel;
@ -78,11 +79,14 @@ namespace Filtration.Services
private bool _downloadPrereleaseUpdates;
private UpdateStatus _updateStatus;
public UpdateService(ISettingsService settingsService)
public UpdateService(ISettingsService settingsService,
ISplatNLogAdapter splatNLogAdapter)
{
_settingsService = settingsService;
UpdateStatus = UpdateStatus.NoUpdateAvailable;
Splat.Locator.CurrentMutable.Register(() => splatNLogAdapter, typeof(Splat.ILogger));
}
public event EventHandler<UpdateStatusChangedEventArgs> UpdateStatusChanged;

View File

@ -0,0 +1,52 @@
using System;
using NLog;
using ILogger = Splat.ILogger;
using LogLevel = Splat.LogLevel;
namespace Filtration.Utility
{
public interface ISplatNLogAdapter
{
}
public class SplatNLogAdapter : ILogger, ISplatNLogAdapter
{
private static readonly Logger Logger = LogManager.GetLogger("SquirrelLogger");
public void Write(string message, LogLevel logLevel)
{
switch (logLevel)
{
case LogLevel.Debug:
{
Logger.Debug(message);
break;
}
case LogLevel.Info:
{
Logger.Info(message);
break;
}
case LogLevel.Error:
{
Logger.Error(message);
break;
}
case LogLevel.Fatal:
{
Logger.Fatal(message);
break;
}
case LogLevel.Warn:
{
Logger.Warn(message);
break;
}
default:
throw new ArgumentOutOfRangeException(nameof(logLevel), logLevel, null);
}
}
public LogLevel Level { get; set; }
}
}

View File

@ -393,7 +393,7 @@ namespace Filtration.ViewModels
{
for (var i = 0; i < SelectedBlockViewModels.Count; i++)
{
if (!ViewItemFilterBlockViewModels.Contains(SelectedBlockViewModels[i]))
if (SelectedBlockViewModels[i] == null || !ViewItemFilterBlockViewModels.Contains(SelectedBlockViewModels[i]))
{
SelectedBlockViewModels.RemoveAt(i--);
}
@ -562,6 +562,8 @@ namespace Filtration.ViewModels
public bool CanModifySelectedBlocks()
{
ValidateSelectedBlocks();
if (SelectedBlockViewModels.Count < 1)
return false;

View File

@ -2,6 +2,7 @@
using Castle.MicroKernel.SubSystems.Configuration;
using Castle.Windsor;
using Filtration.Services;
using Filtration.Utility;
namespace Filtration.WindsorInstallers
{
@ -58,6 +59,11 @@ namespace Filtration.WindsorInstallers
Component.For<IDialogService>()
.ImplementedBy<DialogService>()
.LifeStyle.Singleton);
container.Register(
Component.For<ISplatNLogAdapter>()
.ImplementedBy<SplatNLogAdapter>()
.LifeStyle.Singleton);
}
}
}

View File

@ -4,7 +4,7 @@ Filtration is an editor for Path of Exile item filter scripts.
## Current Release (Released 2018-09-30)
<b>Installer</b><br>
<a href="https://github.com/ben-wallis/Filtration/releases/download/1.0.1/Setup.exe">Setup.exe</a>
<a href="https://github.com/ben-wallis/Filtration/releases/download/1.0.3/Setup.exe">Setup.exe</a>
## System Requirements
Filtration requires .NET Framework 4.6.1 installed.