Compare commits
23 Commits
1.0.0-beta
...
1.0.3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c96aa472d9 | ||
|
|
d4e8a72d47 | ||
|
|
4c826f42fd | ||
|
|
4022cf12a0 | ||
|
|
8073948cfe | ||
|
|
f331bffee7 | ||
|
|
f238bbf856 | ||
|
|
a0191576f0 | ||
|
|
1d96b69800 | ||
|
|
99abb276af | ||
|
|
073fe553ea | ||
|
|
0d81d0ef54 | ||
|
|
f04f9c20ed | ||
|
|
f71ba74425 | ||
|
|
04cbf218f3 | ||
|
|
6007306346 | ||
|
|
992bd21570 | ||
|
|
7d8b32b2e7 | ||
|
|
ac904c31ff | ||
|
|
0209de3817 | ||
|
|
1e26a2ae3e | ||
|
|
54b72e44b0 | ||
|
|
24df1d7687 |
@@ -7,6 +7,7 @@ namespace Filtration.ObjectModel.BlockItemTypes
|
||||
{
|
||||
public BackgroundColorBlockItem()
|
||||
{
|
||||
Color = new Color { A = 240, R = 0, G = 0, B = 0 };
|
||||
}
|
||||
|
||||
public BackgroundColorBlockItem(Color color) : base(color)
|
||||
|
||||
@@ -7,6 +7,7 @@ namespace Filtration.ObjectModel.BlockItemTypes
|
||||
{
|
||||
public BorderColorBlockItem()
|
||||
{
|
||||
Color = new Color {A = 240, R = 0, G = 0, B = 0};
|
||||
}
|
||||
|
||||
public BorderColorBlockItem(Color color) : base(color)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.Windows.Media;
|
||||
using Filtration.ObjectModel.BlockItemBaseTypes;
|
||||
using Filtration.ObjectModel.Enums;
|
||||
|
||||
namespace Filtration.ObjectModel.BlockItemTypes
|
||||
{
|
||||
@@ -7,6 +8,7 @@ namespace Filtration.ObjectModel.BlockItemTypes
|
||||
{
|
||||
public TextColorBlockItem()
|
||||
{
|
||||
Color = PathOfExileNamedColors.Colors[PathOfExileNamedColor.WhiteItem];
|
||||
}
|
||||
|
||||
public TextColorBlockItem(Color color) : base(color)
|
||||
|
||||
@@ -1308,6 +1308,86 @@ namespace Filtration.Parser.Tests.Services
|
||||
Assert.AreEqual(ItemRarity.Magic, (ItemRarity)rarityBlockItem.FilterPredicate.PredicateOperand);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TranslateStringToItemFilterBlock_CustomSoundDocumentsFile()
|
||||
{
|
||||
// Arrange
|
||||
var inputString = @"Show" + Environment.NewLine +
|
||||
"CustomAlertSound \"test.mp3\"";
|
||||
|
||||
// Act
|
||||
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, _testUtility.MockItemFilterScript);
|
||||
|
||||
// Assert
|
||||
Assert.AreEqual(1, result.BlockItems.Count(b => b is CustomSoundBlockItem));
|
||||
var customSoundBlockItem = result.BlockItems.OfType<CustomSoundBlockItem>().First();
|
||||
Assert.AreEqual("test.mp3", customSoundBlockItem.Value);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TranslateStringToItemFilterBlock_CustomSoundDocumentsRelativeFile()
|
||||
{
|
||||
// Arrange
|
||||
var inputString = @"Show" + Environment.NewLine +
|
||||
"CustomAlertSound \"Sounds\test.mp3\"";
|
||||
|
||||
// Act
|
||||
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, _testUtility.MockItemFilterScript);
|
||||
|
||||
// Assert
|
||||
Assert.AreEqual(1, result.BlockItems.Count(b => b is CustomSoundBlockItem));
|
||||
var customSoundBlockItem = result.BlockItems.OfType<CustomSoundBlockItem>().First();
|
||||
Assert.AreEqual("Sounds\test.mp3", customSoundBlockItem.Value);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TranslateStringToItemFilterBlock_CustomSoundFullBackSlashPath()
|
||||
{
|
||||
// Arrange
|
||||
var inputString = @"Show" + Environment.NewLine +
|
||||
"CustomAlertSound \"C:\\Sounds\\test.mp3\"";
|
||||
|
||||
// Act
|
||||
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, _testUtility.MockItemFilterScript);
|
||||
|
||||
// Assert
|
||||
Assert.AreEqual(1, result.BlockItems.Count(b => b is CustomSoundBlockItem));
|
||||
var customSoundBlockItem = result.BlockItems.OfType<CustomSoundBlockItem>().First();
|
||||
Assert.AreEqual("C:\\Sounds\\test.mp3", customSoundBlockItem.Value);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TranslateStringToItemFilterBlock_CustomSoundFullForwardSlashPath()
|
||||
{
|
||||
// Arrange
|
||||
var inputString = @"Show" + Environment.NewLine +
|
||||
"CustomAlertSound \"C:/Sounds/test.mp3\"";
|
||||
|
||||
//Act
|
||||
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, _testUtility.MockItemFilterScript);
|
||||
|
||||
// Assert
|
||||
Assert.AreEqual(1, result.BlockItems.Count(b => b is CustomSoundBlockItem));
|
||||
var customSoundBlockItem = result.BlockItems.OfType<CustomSoundBlockItem>().First();
|
||||
Assert.AreEqual("C:/Sounds/test.mp3", customSoundBlockItem.Value);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TranslateStringToItemFilterBlock_CustomSoundFullMixedPath()
|
||||
{
|
||||
// Arrange
|
||||
var inputString = @"Show" + Environment.NewLine +
|
||||
"CustomAlertSound \"C:\\Sounds/test.mp3\"";
|
||||
|
||||
// Act
|
||||
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, _testUtility.MockItemFilterScript);
|
||||
|
||||
// Assert
|
||||
Assert.AreEqual(1, result.BlockItems.Count(b => b is CustomSoundBlockItem));
|
||||
var customSoundBlockItem = result.BlockItems.OfType<CustomSoundBlockItem>().First();
|
||||
Assert.AreEqual("C:\\Sounds/test.mp3", customSoundBlockItem.Value);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TranslateItemFilterBlockToString_NothingPopulated_ReturnsCorrectString()
|
||||
{
|
||||
|
||||
@@ -382,7 +382,7 @@ namespace Filtration.Parser.Services
|
||||
RemoveExistingBlockItemsOfType<SoundBlockItem>(block);
|
||||
RemoveExistingBlockItemsOfType<PositionalSoundBlockItem>(block);
|
||||
|
||||
var match = Regex.Match(trimmedLine, @"\S+\s+""(\S+)""");
|
||||
var match = Regex.Match(trimmedLine, @"\S+\s+""([^\*\<\>\?|]+)""");
|
||||
|
||||
if (match.Success)
|
||||
{
|
||||
|
||||
14
Filtration/Enums/UpdateSource.cs
Normal file
14
Filtration/Enums/UpdateSource.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Filtration.Enums
|
||||
{
|
||||
internal enum UpdateSource
|
||||
{
|
||||
GitHub,
|
||||
Local
|
||||
}
|
||||
}
|
||||
@@ -203,6 +203,7 @@
|
||||
<Compile Include="Converters\HashSignRemovalConverter.cs" />
|
||||
<Compile Include="Converters\ItemRarityConverter.cs" />
|
||||
<Compile Include="Converters\TreeViewMarginConverter.cs" />
|
||||
<Compile Include="Enums\UpdateSource.cs" />
|
||||
<Compile Include="Models\UpdateData.cs" />
|
||||
<Compile Include="Properties\Annotations.cs" />
|
||||
<Compile Include="Repositories\ItemFilterScriptRepository.cs" />
|
||||
@@ -229,6 +230,7 @@
|
||||
<Compile Include="UserControls\ThemeComponentSelectionControl.xaml.cs">
|
||||
<DependentUpon>ThemeComponentSelectionControl.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Utility\SplatNLogAdapter.cs" />
|
||||
<Compile Include="ViewModels\DesignTime\DesignTimeSettingsPageViewModel.cs" />
|
||||
<Compile Include="Views\AttachedProperties\SelectedItemsAttachedProperty.cs" />
|
||||
<Compile Include="Utility\RoutedCommandHandler.cs" />
|
||||
|
||||
@@ -9,16 +9,13 @@
|
||||
<description>A Path of Exile loot filter script editor</description>
|
||||
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
||||
<copyright>Copyright 2018</copyright>
|
||||
<releaseNotes>Still no 1.0.0 release notes
|
||||
|
||||
Changes since 1.0.0-beta1:
|
||||
|
||||
* Static data (ItemBaseTypes and ItemClasses) is now correctly loaded from embedded resources instead of the legacy text files in appdata
|
||||
* Updates to static data files
|
||||
* Disabled setting themes for MinimapIcon, PlayEffect and SetFontSize blocks as a temporary fix for issue #68</releaseNotes>
|
||||
<releaseNotes>* Added missing AlertSound mp3 resources to installer
|
||||
* Fixed a crash related to performing certain commands with no blocks selected
|
||||
* Added extra logging to updater</releaseNotes>
|
||||
<dependencies />
|
||||
</metadata>
|
||||
<files>
|
||||
<file src="*.*" target="lib\net45\" exclude="*.pdb;*.nupkg;*.vshost.*;*.xml"/>
|
||||
<file src="Resources\AlertSounds\*.mp3" target="lib\net45\Resources\AlertSounds\" />
|
||||
</files>
|
||||
</package>
|
||||
@@ -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>
|
||||
@@ -10,8 +10,8 @@ using System.Runtime.CompilerServices;
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
[assembly: AssemblyVersion("1.0.0")]
|
||||
[assembly: AssemblyInformationalVersion("1.0.0-beta2")]
|
||||
[assembly: AssemblyVersion("1.0.3")]
|
||||
[assembly: AssemblyInformationalVersion("1.0.3")]
|
||||
|
||||
[assembly: InternalsVisibleTo("Filtration.Tests")]
|
||||
[assembly: InternalsVisibleTo("Filtration.ItemFilterPreview.Tests")]
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace Filtration.Services
|
||||
|
||||
_mainWindow.Show();
|
||||
|
||||
await _updateService.CheckForUpdates();
|
||||
await _updateService.CheckForUpdatesAsync();
|
||||
}
|
||||
|
||||
private void CurrentDomainOnUnhandledException(object sender, UnhandledExceptionEventArgs e)
|
||||
|
||||
@@ -2,7 +2,9 @@
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using Filtration.Enums;
|
||||
using Filtration.Properties;
|
||||
using Filtration.Utility;
|
||||
using NLog;
|
||||
using Squirrel;
|
||||
|
||||
@@ -52,7 +54,7 @@ namespace Filtration.Services
|
||||
|
||||
string LatestReleaseVersion { get; }
|
||||
|
||||
Task CheckForUpdates();
|
||||
Task CheckForUpdatesAsync();
|
||||
|
||||
Task DownloadUpdatesAsync();
|
||||
|
||||
@@ -63,20 +65,26 @@ namespace Filtration.Services
|
||||
|
||||
internal class UpdateService : IUpdateService
|
||||
{
|
||||
private readonly ISettingsService _settingsService;
|
||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
private const string _localUpdatePath = @"C:\Repos\Filtration\Releases";
|
||||
|
||||
private readonly ISettingsService _settingsService;
|
||||
private readonly UpdateSource _updateSource = UpdateSource.GitHub;
|
||||
|
||||
private ReleaseEntry _latestRelease;
|
||||
private UpdateInfo _updates;
|
||||
|
||||
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;
|
||||
@@ -96,35 +104,42 @@ namespace Filtration.Services
|
||||
|
||||
public string LatestReleaseVersion { get; private set; }
|
||||
|
||||
public async Task CheckForUpdates()
|
||||
public async Task CheckForUpdatesAsync()
|
||||
{
|
||||
if (UpdateStatus != UpdateStatus.NoUpdateAvailable)
|
||||
{
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
|
||||
|
||||
Logger.Debug("Checking for update...");
|
||||
UpdateStatus = UpdateStatus.CheckingForUpdate;
|
||||
|
||||
try
|
||||
{
|
||||
bool downloadPrereleaseUpdates;
|
||||
downloadPrereleaseUpdates = Settings.Default.DownloadPrereleaseUpdates;
|
||||
_downloadPrereleaseUpdates = Settings.Default.DownloadPrereleaseUpdates;
|
||||
#if DEBUG
|
||||
downloadPrereleaseUpdates = true;
|
||||
_downloadPrereleaseUpdates = true;
|
||||
#endif
|
||||
using (var mgr = await UpdateManager.GitHubUpdateManager("https://github.com/ben-wallis/Filtration", prerelease: downloadPrereleaseUpdates))
|
||||
|
||||
async Task CheckForUpdatesAsync(IUpdateManager updateManager)
|
||||
{
|
||||
_updates = await mgr.CheckForUpdate(progress: progress => UpdateProgressChanged?.Invoke(this, new UpdateProgressChangedEventArgs(progress)));
|
||||
_updates = await updateManager.CheckForUpdate(progress: progress => UpdateProgressChanged?.Invoke(this, new UpdateProgressChangedEventArgs(progress)));
|
||||
}
|
||||
|
||||
// Local file update source for testing
|
||||
//using (var mgr = new UpdateManager(_localUpdatePath))
|
||||
//{
|
||||
|
||||
// _updates = await mgr.CheckForUpdate(progress: progress => UpdateProgressChanged?.Invoke(this, new UpdateProgressChangedEventArgs(progress)));
|
||||
//}
|
||||
if (_updateSource == UpdateSource.GitHub)
|
||||
{
|
||||
using (var updateManager = await UpdateManager.GitHubUpdateManager("https://github.com/ben-wallis/Filtration", prerelease: _downloadPrereleaseUpdates))
|
||||
{
|
||||
await CheckForUpdatesAsync(updateManager);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
using (var updateManager = new UpdateManager(_localUpdatePath))
|
||||
{
|
||||
await CheckForUpdatesAsync(updateManager);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -133,25 +148,12 @@ namespace Filtration.Services
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (_updates.ReleasesToApply.Any())
|
||||
{
|
||||
_latestRelease = _updates.ReleasesToApply.OrderBy(x => x.Version).Last();
|
||||
LatestReleaseVersion = _latestRelease.Version.ToString();
|
||||
|
||||
Logger.Debug($"Update found ({LatestReleaseVersion}), fetching release notes...");
|
||||
|
||||
try
|
||||
{
|
||||
var releaseNotes = _latestRelease.GetReleaseNotes(_localUpdatePath);
|
||||
LatestReleaseNotes = ProcessReleaseNotes(releaseNotes);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.Error(e);
|
||||
UpdateStatus = UpdateStatus.Error;
|
||||
return;
|
||||
}
|
||||
Logger.Debug($"Update found ({LatestReleaseVersion})");
|
||||
|
||||
UpdateStatus = UpdateStatus.UpdateAvailable;
|
||||
}
|
||||
@@ -162,7 +164,7 @@ namespace Filtration.Services
|
||||
}
|
||||
}
|
||||
|
||||
private string ProcessReleaseNotes(string rawReleaseNotes)
|
||||
private static string ProcessReleaseNotes(string rawReleaseNotes)
|
||||
{
|
||||
var regex = new Regex(@"<!\[CDATA\[(.*)]]>", RegexOptions.Singleline);
|
||||
var matches = regex.Match(rawReleaseNotes);
|
||||
@@ -184,11 +186,31 @@ namespace Filtration.Services
|
||||
|
||||
UpdateStatus = UpdateStatus.Downloading;
|
||||
|
||||
async Task DownloadUpdatesAsync(IUpdateManager updateManager)
|
||||
{
|
||||
Logger.Debug("Downloading update...");
|
||||
await updateManager.DownloadReleases(_updates.ReleasesToApply, OnProgressChanged);
|
||||
|
||||
Logger.Debug("Fetching release notes...");
|
||||
var releaseNotes = _updates.FetchReleaseNotes();
|
||||
LatestReleaseNotes = ProcessReleaseNotes(releaseNotes[_latestRelease]);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
using (var updateManager = new UpdateManager(_localUpdatePath))
|
||||
if (_updateSource == UpdateSource.GitHub)
|
||||
{
|
||||
await updateManager.DownloadReleases(_updates.ReleasesToApply, OnProgressChanged);
|
||||
using (var updateManager = await UpdateManager.GitHubUpdateManager("https://github.com/ben-wallis/Filtration", prerelease: _downloadPrereleaseUpdates))
|
||||
{
|
||||
await DownloadUpdatesAsync(updateManager);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
using (var updateManager = new UpdateManager(_localUpdatePath))
|
||||
{
|
||||
await DownloadUpdatesAsync(updateManager);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
@@ -215,11 +237,22 @@ namespace Filtration.Services
|
||||
// wipes out user settings due to the application directory changing with each update
|
||||
_settingsService.BackupSettings();
|
||||
|
||||
Logger.Debug("Applying update...");
|
||||
try
|
||||
{
|
||||
using (var updateManager = new UpdateManager(_localUpdatePath))
|
||||
if (_updateSource == UpdateSource.GitHub)
|
||||
{
|
||||
await updateManager.ApplyReleases(_updates, OnProgressChanged);
|
||||
using (var mgr = await UpdateManager.GitHubUpdateManager("https://github.com/ben-wallis/Filtration", prerelease: _downloadPrereleaseUpdates))
|
||||
{
|
||||
await mgr.ApplyReleases(_updates, OnProgressChanged);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
using (var updateManager = new UpdateManager(_localUpdatePath))
|
||||
{
|
||||
await updateManager.ApplyReleases(_updates, OnProgressChanged);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
@@ -229,6 +262,7 @@ namespace Filtration.Services
|
||||
return;
|
||||
}
|
||||
|
||||
Logger.Debug("Update complete");
|
||||
UpdateStatus = UpdateStatus.UpdateComplete;
|
||||
}
|
||||
|
||||
|
||||
52
Filtration/Utility/SplatNLogAdapter.cs
Normal file
52
Filtration/Utility/SplatNLogAdapter.cs
Normal 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; }
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,7 @@ using GalaSoft.MvvmLight.CommandWpf;
|
||||
using GalaSoft.MvvmLight.Messaging;
|
||||
using Microsoft.Win32;
|
||||
using Xceed.Wpf.Toolkit;
|
||||
using static System.Int32;
|
||||
|
||||
namespace Filtration.ViewModels
|
||||
{
|
||||
@@ -59,8 +60,7 @@ namespace Filtration.ViewModels
|
||||
|
||||
public override void Initialise(IItemFilterBlockBase itemFilterBlockBase, IItemFilterScriptViewModel parentScriptViewModel)
|
||||
{
|
||||
var itemFilterBlock = itemFilterBlockBase as IItemFilterBlock;
|
||||
if (itemFilterBlock == null || parentScriptViewModel == null)
|
||||
if (!(itemFilterBlockBase is IItemFilterBlock itemFilterBlock) || parentScriptViewModel == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(itemFilterBlock));
|
||||
}
|
||||
@@ -136,7 +136,7 @@ namespace Filtration.ViewModels
|
||||
|
||||
public bool AudioVisualBlockItemsGridVisible
|
||||
{
|
||||
get { return _audioVisualBlockItemsGridVisible; }
|
||||
get => _audioVisualBlockItemsGridVisible;
|
||||
set
|
||||
{
|
||||
_audioVisualBlockItemsGridVisible = value;
|
||||
@@ -150,7 +150,7 @@ namespace Filtration.ViewModels
|
||||
|
||||
public bool DisplaySettingsPopupOpen
|
||||
{
|
||||
get { return _displaySettingsPopupOpen; }
|
||||
get => _displaySettingsPopupOpen;
|
||||
set
|
||||
{
|
||||
_displaySettingsPopupOpen = value;
|
||||
@@ -205,7 +205,7 @@ namespace Filtration.ViewModels
|
||||
|
||||
public bool BlockEnabled
|
||||
{
|
||||
get { return Block.Enabled; }
|
||||
get => Block.Enabled;
|
||||
set
|
||||
{
|
||||
if (Block.Enabled != value)
|
||||
@@ -219,10 +219,7 @@ namespace Filtration.ViewModels
|
||||
|
||||
public string BlockDescription
|
||||
{
|
||||
get
|
||||
{
|
||||
return Block.Description;
|
||||
}
|
||||
get => Block.Description;
|
||||
set
|
||||
{
|
||||
if (Block.Description != value)
|
||||
@@ -269,8 +266,7 @@ namespace Filtration.ViewModels
|
||||
|
||||
newBlockItem.PropertyChanged += OnBlockItemChanged;
|
||||
|
||||
var customSoundBlockItem = newBlockItem as CustomSoundBlockItem;
|
||||
if(customSoundBlockItem != null && _parentScriptViewModel.CustomSoundsAvailable.Count > 0)
|
||||
if(newBlockItem is CustomSoundBlockItem customSoundBlockItem && _parentScriptViewModel.CustomSoundsAvailable.Count > 0)
|
||||
{
|
||||
customSoundBlockItem.Value = _parentScriptViewModel.CustomSoundsAvailable[0];
|
||||
}
|
||||
@@ -364,16 +360,14 @@ namespace Filtration.ViewModels
|
||||
|
||||
private string ComputeFilePartFromNumber(string identifier)
|
||||
{
|
||||
if (Int32.TryParse(identifier, out int x))
|
||||
if (TryParse(identifier, out int x))
|
||||
{
|
||||
if (x <= 9)
|
||||
{
|
||||
return "AlertSound_0" + x + ".mp3";
|
||||
}
|
||||
else
|
||||
{
|
||||
return "AlertSound_" + x + ".mp3";
|
||||
}
|
||||
|
||||
return "AlertSound_" + x + ".mp3";
|
||||
}
|
||||
|
||||
return "";
|
||||
@@ -431,11 +425,9 @@ namespace Filtration.ViewModels
|
||||
{
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
_mediaPlayer.Open(new Uri(prefix + filePart, UriKind.Relative));
|
||||
_mediaPlayer.Play();
|
||||
}
|
||||
|
||||
_mediaPlayer.Open(new Uri(prefix + filePart, UriKind.Relative));
|
||||
_mediaPlayer.Play();
|
||||
}
|
||||
|
||||
private void OnPlayPositionalSoundCommand()
|
||||
@@ -448,11 +440,9 @@ namespace Filtration.ViewModels
|
||||
{
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
_mediaPlayer.Open(new Uri(prefix + filePart, UriKind.Relative));
|
||||
_mediaPlayer.Play();
|
||||
}
|
||||
|
||||
_mediaPlayer.Open(new Uri(prefix + filePart, UriKind.Relative));
|
||||
_mediaPlayer.Play();
|
||||
}
|
||||
|
||||
private void OnBlockEnabledStatusChanged(object sender, EventArgs e)
|
||||
@@ -462,13 +452,12 @@ namespace Filtration.ViewModels
|
||||
|
||||
private void OnBlockItemChanged(object sender, EventArgs e)
|
||||
{
|
||||
var itemFilterBlockItem = sender as IItemFilterBlockItem;
|
||||
if ( itemFilterBlockItem != null && itemFilterBlockItem.IsDirty)
|
||||
if (sender is IItemFilterBlockItem itemFilterBlockItem && itemFilterBlockItem.IsDirty)
|
||||
{
|
||||
IsDirty = true;
|
||||
}
|
||||
var customSoundBlockItem = sender as CustomSoundBlockItem;
|
||||
if (customSoundBlockItem != null)
|
||||
|
||||
if (sender is CustomSoundBlockItem customSoundBlockItem)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(customSoundBlockItem.Value) && _parentScriptViewModel.CustomSoundsAvailable.IndexOf(customSoundBlockItem.Value) < 0)
|
||||
{
|
||||
@@ -507,12 +496,11 @@ namespace Filtration.ViewModels
|
||||
|
||||
private void OnCustomSoundFileDialog()
|
||||
{
|
||||
OpenFileDialog fileDialog = new OpenFileDialog();
|
||||
fileDialog.DefaultExt = ".mp3";
|
||||
var poePath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments).ToString() + @"\My Games\Path of Exile\";
|
||||
OpenFileDialog fileDialog = new OpenFileDialog {DefaultExt = ".mp3"};
|
||||
var poePath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\My Games\Path of Exile\";
|
||||
fileDialog.InitialDirectory = poePath;
|
||||
|
||||
Nullable<bool> result = fileDialog.ShowDialog();
|
||||
bool? result = fileDialog.ShowDialog();
|
||||
if (result == true)
|
||||
{
|
||||
var fileName = fileDialog.FileName;
|
||||
@@ -533,7 +521,7 @@ namespace Filtration.ViewModels
|
||||
|
||||
private void OnPlayCustomSoundCommand()
|
||||
{
|
||||
var poePath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments).ToString() + @"\My Games\Path of Exile\";
|
||||
var poePath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\My Games\Path of Exile\";
|
||||
var identifier = BlockItems.OfType<CustomSoundBlockItem>().First().Value;
|
||||
|
||||
if(!Path.IsPathRooted(identifier))
|
||||
@@ -569,9 +557,11 @@ namespace Filtration.ViewModels
|
||||
var newGroup = new ItemFilterBlockGroup(BlockGroupSearch, null, AdvancedBlockGroup, false);
|
||||
if (baseBlock.BlockGroup == null)
|
||||
{
|
||||
baseBlock.BlockGroup = new ItemFilterBlockGroup("", null, false, true);
|
||||
baseBlock.BlockGroup.IsShowChecked = baseBlock.Action == BlockAction.Show;
|
||||
baseBlock.BlockGroup.IsEnableChecked = BlockEnabled;
|
||||
baseBlock.BlockGroup = new ItemFilterBlockGroup("", null, false, true)
|
||||
{
|
||||
IsShowChecked = baseBlock.Action == BlockAction.Show,
|
||||
IsEnableChecked = BlockEnabled
|
||||
};
|
||||
}
|
||||
newGroup.AddOrJoinBlockGroup(baseBlock.BlockGroup);
|
||||
blockToAdd.AddOrJoinBlockGroup(newGroup);
|
||||
@@ -611,8 +601,7 @@ namespace Filtration.ViewModels
|
||||
|
||||
private void UpdateBlockGroups()
|
||||
{
|
||||
var baseBlock = Block as ItemFilterBlock;
|
||||
if (baseBlock == null)
|
||||
if (!(Block is ItemFilterBlock baseBlock))
|
||||
return;
|
||||
|
||||
var currentGroup = baseBlock.BlockGroup;
|
||||
|
||||
@@ -143,6 +143,7 @@ namespace Filtration.ViewModels
|
||||
{
|
||||
RaisePropertyChanged(nameof(SelectedBlockViewModels));
|
||||
RaisePropertyChanged(nameof(LastSelectedBlockViewModel));
|
||||
Messenger.Default.Send(new NotificationMessage("LastSelectedBlockChanged"));
|
||||
};
|
||||
_lastAddedBlocks = new List<IItemFilterBlockViewModelBase>();
|
||||
_showAdvanced = Settings.Default.ShowAdvanced;
|
||||
@@ -378,7 +379,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--);
|
||||
}
|
||||
@@ -553,6 +554,8 @@ namespace Filtration.ViewModels
|
||||
|
||||
public bool CanModifySelectedBlocks()
|
||||
{
|
||||
ValidateSelectedBlocks();
|
||||
|
||||
if (SelectedBlockViewModels.Count < 1)
|
||||
return false;
|
||||
|
||||
@@ -569,6 +572,9 @@ namespace Filtration.ViewModels
|
||||
|
||||
public bool CanModifyBlock(IItemFilterBlockViewModelBase itemFilterBlock)
|
||||
{
|
||||
if (itemFilterBlock == null)
|
||||
return false;
|
||||
|
||||
if (itemFilterBlock is IItemFilterBlockViewModel)
|
||||
return true;
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Windows.Media.Imaging;
|
||||
using Filtration.Parser.Interface.Services;
|
||||
using GalaSoft.MvvmLight.Messaging;
|
||||
@@ -28,19 +29,10 @@ namespace Filtration.ViewModels.ToolPanes
|
||||
|
||||
Messenger.Default.Register<NotificationMessage>(this, message =>
|
||||
{
|
||||
switch (message.Notification)
|
||||
{
|
||||
case "LastSelectedBlockChanged":
|
||||
{
|
||||
OnLastSelectedBlockChanged(this, EventArgs.Empty);
|
||||
break;
|
||||
}
|
||||
case "ActiveDocumentChanged":
|
||||
{
|
||||
OnLastSelectedBlockChanged(this, EventArgs.Empty);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (message.Notification == "LastSelectedBlockChanged")
|
||||
OnLastSelectedBlockChanged(this, EventArgs.Empty);
|
||||
else if (message.Notification == "ActiveDocumentChanged")
|
||||
OnLastSelectedBlockChanged(this, EventArgs.Empty);
|
||||
});
|
||||
|
||||
}
|
||||
@@ -49,7 +41,7 @@ namespace Filtration.ViewModels.ToolPanes
|
||||
|
||||
public string PreviewText
|
||||
{
|
||||
get { return _previewText; }
|
||||
get => _previewText;
|
||||
private set
|
||||
{
|
||||
_previewText = value;
|
||||
@@ -64,15 +56,17 @@ namespace Filtration.ViewModels.ToolPanes
|
||||
|
||||
private void OnLastSelectedBlockChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (AvalonDockWorkspaceViewModel.ActiveScriptViewModel?.LastSelectedBlockViewModel == null)
|
||||
if (AvalonDockWorkspaceViewModel.ActiveScriptViewModel?.SelectedBlockViewModels == null ||
|
||||
AvalonDockWorkspaceViewModel.ActiveScriptViewModel.SelectedBlockViewModels.Count == 0 ||
|
||||
AvalonDockWorkspaceViewModel.ActiveScriptViewModel.SelectedBlockViewModels.FirstOrDefault() == null)
|
||||
{
|
||||
PreviewText = string.Empty;
|
||||
return;
|
||||
}
|
||||
|
||||
PreviewText =
|
||||
_itemFilterBlockTranslator.TranslateItemFilterBlockBaseToString(
|
||||
AvalonDockWorkspaceViewModel.ActiveScriptViewModel.LastSelectedBlockViewModel.BaseBlock);
|
||||
PreviewText = AvalonDockWorkspaceViewModel.ActiveScriptViewModel.SelectedBlockViewModels
|
||||
.Select(s => _itemFilterBlockTranslator.TranslateItemFilterBlockBaseToString(s.BaseBlock))
|
||||
.Aggregate((prev, curr) => prev + Environment.NewLine + Environment.NewLine + curr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,33 +106,33 @@ namespace Filtration.ViewModels
|
||||
switch (UpdateStatus)
|
||||
{
|
||||
case UpdateStatus.UpdateAvailable:
|
||||
{
|
||||
await _updateService.DownloadUpdatesAsync();
|
||||
break;
|
||||
}
|
||||
{
|
||||
await _updateService.DownloadUpdatesAsync();
|
||||
break;
|
||||
}
|
||||
case UpdateStatus.ReadyToApplyUpdate:
|
||||
{
|
||||
if (!_updateTabShown)
|
||||
{
|
||||
// When the update has downloaded and is ready to apply, clicking the button
|
||||
// closes the update popup and shows the update tab.
|
||||
_avalonDockWorkspaceViewModel.AddDocument(this);
|
||||
Visible = false;
|
||||
_updateTabShown = true;
|
||||
NextStepButtonText = "Update";
|
||||
}
|
||||
else
|
||||
{
|
||||
await _updateService.ApplyUpdatesAsync();
|
||||
}
|
||||
if (!_updateTabShown)
|
||||
{
|
||||
// When the update has downloaded and is ready to apply, clicking the button
|
||||
// closes the update popup and shows the update tab.
|
||||
_avalonDockWorkspaceViewModel.AddDocument(this);
|
||||
Visible = false;
|
||||
_updateTabShown = true;
|
||||
NextStepButtonText = "Update";
|
||||
}
|
||||
else
|
||||
{
|
||||
await _updateService.ApplyUpdatesAsync();
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case UpdateStatus.UpdateComplete:
|
||||
{
|
||||
_updateService.RestartAfterUpdate();
|
||||
break;
|
||||
}
|
||||
{
|
||||
_updateService.RestartAfterUpdate();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,7 +144,6 @@ namespace Filtration.ViewModels
|
||||
{
|
||||
Visible = true;
|
||||
NextStepButtonText = "Download";
|
||||
RaisePropertyChanged(nameof(ReleaseNotes));
|
||||
RaisePropertyChanged(nameof(Version));
|
||||
break;
|
||||
}
|
||||
@@ -156,6 +155,7 @@ namespace Filtration.ViewModels
|
||||
}
|
||||
case UpdateStatus.ReadyToApplyUpdate:
|
||||
{
|
||||
RaisePropertyChanged(nameof(ReleaseNotes));
|
||||
NextStepButtonText = "Update Ready";
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -8,6 +8,6 @@
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="300" d:DesignWidth="300">
|
||||
<Grid>
|
||||
<TextBlock Text="{Binding PreviewText}" ToolTip="{Binding PreviewText}" Margin="10" />
|
||||
<TextBox IsReadOnly="True" Text="{Binding PreviewText, Mode=OneWay}" ToolTip="{Binding PreviewText}" Padding="5" Background="Transparent" BorderThickness="0" />
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using Castle.MicroKernel.SubSystems.Configuration;
|
||||
using Castle.Windsor;
|
||||
using Filtration.Services;
|
||||
using Filtration.Utility;
|
||||
|
||||
namespace Filtration.WindsorInstallers
|
||||
{
|
||||
@@ -43,6 +44,11 @@ namespace Filtration.WindsorInstallers
|
||||
Component.For<ISettingsService>()
|
||||
.ImplementedBy<SettingsService>()
|
||||
.LifeStyle.Singleton);
|
||||
|
||||
container.Register(
|
||||
Component.For<ISplatNLogAdapter>()
|
||||
.ImplementedBy<SplatNLogAdapter>()
|
||||
.LifeStyle.Singleton);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
11
README.md
11
README.md
@@ -2,10 +2,9 @@
|
||||
|
||||
Filtration is an editor for Path of Exile item filter scripts.
|
||||
|
||||
## Current Release (Released 2018-08-30)
|
||||
<b>Installer</b> <a href="https://github.com/ben-wallis/Filtration/releases/download/0.19/filtration_0.19_setup.exe">filtration_0.19_setup.exe</a>
|
||||
|
||||
<b>Zip File</b> <a href="https://github.com/ben-wallis/Filtration/releases/download/0.19/filtration_0.19.zip">filtration_0.19.zip</a>
|
||||
## Current Release (Released 2018-09-30)
|
||||
<b>Installer</b><br>
|
||||
<a href="https://github.com/ben-wallis/Filtration/releases/download/1.0.2/Setup.exe">Setup.exe</a>
|
||||
|
||||
## System Requirements
|
||||
Filtration requires .NET Framework 4.6.1 installed.
|
||||
@@ -25,10 +24,10 @@ If you'd like to make your script fully compatible with Filtration, please take
|
||||
## Screenshots
|
||||
|
||||
##### Main Window
|
||||
<img src="http://i.imgur.com/eAsMoSo.png" />
|
||||
<img src="https://i.imgur.com/d3tKEab.png" />
|
||||
|
||||
##### Theme Editor
|
||||
<img src="http://i.imgur.com/FJWJknO.png" />
|
||||
<img src="https://i.imgur.com/Pi9wds1.png" />
|
||||
|
||||
## Contact
|
||||
You can find me on irc.freenode.net in #filtration
|
||||
|
||||
Reference in New Issue
Block a user