diff --git a/Filtration/Filtration.csproj b/Filtration/Filtration.csproj index a550ecd..cd85216 100644 --- a/Filtration/Filtration.csproj +++ b/Filtration/Filtration.csproj @@ -250,6 +250,7 @@ ThemeComponentSelectionControl.xaml + diff --git a/Filtration/NLog.config b/Filtration/NLog.config index af4b9bb..00cf2ac 100644 --- a/Filtration/NLog.config +++ b/Filtration/NLog.config @@ -10,15 +10,21 @@ layout="${longdate} ${uppercase:${level}} ${message}" /> + + + + + \ No newline at end of file diff --git a/Filtration/Services/UpdateService.cs b/Filtration/Services/UpdateService.cs index dcb2a15..d6731dc 100644 --- a/Filtration/Services/UpdateService.cs +++ b/Filtration/Services/UpdateService.cs @@ -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 UpdateStatusChanged; diff --git a/Filtration/Utility/SplatNLogAdapter.cs b/Filtration/Utility/SplatNLogAdapter.cs new file mode 100644 index 0000000..59916c2 --- /dev/null +++ b/Filtration/Utility/SplatNLogAdapter.cs @@ -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; } + } +} diff --git a/Filtration/ViewModels/ItemFilterScriptViewModel.cs b/Filtration/ViewModels/ItemFilterScriptViewModel.cs index e7e68e7..c78a95c 100644 --- a/Filtration/ViewModels/ItemFilterScriptViewModel.cs +++ b/Filtration/ViewModels/ItemFilterScriptViewModel.cs @@ -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; diff --git a/Filtration/WindsorInstallers/ServicesInstaller.cs b/Filtration/WindsorInstallers/ServicesInstaller.cs index 5300868..41cc60d 100644 --- a/Filtration/WindsorInstallers/ServicesInstaller.cs +++ b/Filtration/WindsorInstallers/ServicesInstaller.cs @@ -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() .ImplementedBy() .LifeStyle.Singleton); + + container.Register( + Component.For() + .ImplementedBy() + .LifeStyle.Singleton); } } } diff --git a/README.md b/README.md index fb353ec..9afba17 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Filtration is an editor for Path of Exile item filter scripts. ## Current Release (Released 2018-09-30) Installer
-Setup.exe +Setup.exe ## System Requirements Filtration requires .NET Framework 4.6.1 installed.