14 Commits
0.12 ... 0.14

24 changed files with 167 additions and 103 deletions

View File

@@ -46,12 +46,12 @@
<HintPath>..\packages\Castle.Core.3.3.3\lib\net45\Castle.Core.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="FluentAssertions, Version=4.13.0.0, Culture=neutral, PublicKeyToken=33f2691a05b67b6a, processorArchitecture=MSIL">
<HintPath>..\packages\FluentAssertions.4.13.0\lib\net45\FluentAssertions.dll</HintPath>
<Reference Include="FluentAssertions, Version=4.13.1.0, Culture=neutral, PublicKeyToken=33f2691a05b67b6a, processorArchitecture=MSIL">
<HintPath>..\packages\FluentAssertions.4.13.1\lib\net45\FluentAssertions.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="FluentAssertions.Core, Version=4.13.0.0, Culture=neutral, PublicKeyToken=33f2691a05b67b6a, processorArchitecture=MSIL">
<HintPath>..\packages\FluentAssertions.4.13.0\lib\net45\FluentAssertions.Core.dll</HintPath>
<Reference Include="FluentAssertions.Core, Version=4.13.1.0, Culture=neutral, PublicKeyToken=33f2691a05b67b6a, processorArchitecture=MSIL">
<HintPath>..\packages\FluentAssertions.4.13.1\lib\net45\FluentAssertions.Core.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Moq, Version=4.5.21.0, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">

View File

@@ -12,6 +12,7 @@ namespace Filtration.ItemFilterPreview.Tests.Services
{
class serializationtest
{
[Ignore("")]
[Test]
public void test_serialization()
{

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Castle.Core" version="3.3.3" targetFramework="net461" />
<package id="FluentAssertions" version="4.13.0" targetFramework="net461" />
<package id="FluentAssertions" version="4.13.1" targetFramework="net461" />
<package id="Moq" version="4.5.21" targetFramework="net461" />
<package id="NUnit" version="3.4.1" targetFramework="net461" />
<package id="YamlDotNet" version="3.9.0" targetFramework="net461" />

View File

@@ -15,7 +15,12 @@ namespace Filtration.ObjectModel.BlockItemTypes
: base(predicateOperator, predicateOperand)
{
}
public RarityBlockItem(FilterPredicateOperator predicateOperator, ItemRarity predicateOperand)
: base(predicateOperator, (int)predicateOperand)
{
}
public override string PrefixText => "Rarity";
public override string OutputText => PrefixText + " " + FilterPredicate.PredicateOperator
.GetAttributeDescription() + " " + ((ItemRarity) FilterPredicate.PredicateOperand).GetAttributeDescription();

View File

@@ -9,6 +9,6 @@ namespace Filtration.Parser.Interface.Services
IItemFilterBlock TranslateStringToItemFilterBlock(string inputString,
ThemeComponentCollection masterComponentCollection);
string TranslateItemFilterBlockToString(IItemFilterBlock block);
void ReplaceColorBlockItemsFromString(ObservableCollection<IItemFilterBlockItem> blockItems, string inputString);
void ReplaceAudioVisualBlockItemsFromString(ObservableCollection<IItemFilterBlockItem> blockItems, string inputString);
}
}

View File

@@ -40,12 +40,12 @@
<HintPath>..\packages\Castle.Core.3.3.3\lib\net45\Castle.Core.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="FluentAssertions, Version=4.13.0.0, Culture=neutral, PublicKeyToken=33f2691a05b67b6a, processorArchitecture=MSIL">
<HintPath>..\packages\FluentAssertions.4.13.0\lib\net45\FluentAssertions.dll</HintPath>
<Reference Include="FluentAssertions, Version=4.13.1.0, Culture=neutral, PublicKeyToken=33f2691a05b67b6a, processorArchitecture=MSIL">
<HintPath>..\packages\FluentAssertions.4.13.1\lib\net45\FluentAssertions.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="FluentAssertions.Core, Version=4.13.0.0, Culture=neutral, PublicKeyToken=33f2691a05b67b6a, processorArchitecture=MSIL">
<HintPath>..\packages\FluentAssertions.4.13.0\lib\net45\FluentAssertions.Core.dll</HintPath>
<Reference Include="FluentAssertions.Core, Version=4.13.1.0, Culture=neutral, PublicKeyToken=33f2691a05b67b6a, processorArchitecture=MSIL">
<HintPath>..\packages\FluentAssertions.4.13.1\lib\net45\FluentAssertions.Core.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Moq, Version=4.5.21.0, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">

View File

@@ -1472,7 +1472,7 @@ namespace Filtration.Parser.Tests.Services
}
[Test]
public void ReplaceColorBlockItemsFromString_SingleLine_ReplacesColorBlock()
public void ReplaceAudioVisualBlockItemsFromString_SingleLine_ReplacesColorBlock()
{
// Arrange
var testInputString = "SetTextColor 240 200 150 # Rarest Currency";
@@ -1482,7 +1482,7 @@ namespace Filtration.Parser.Tests.Services
testInputBlockItems.Add(testInputBlockItem);
// Act
_testUtility.Translator.ReplaceColorBlockItemsFromString(testInputBlockItems, testInputString);
_testUtility.Translator.ReplaceAudioVisualBlockItemsFromString(testInputBlockItems, testInputString);
// Assert
var textColorBlockItem = testInputBlockItems.First(b => b is TextColorBlockItem) as TextColorBlockItem;
@@ -1492,7 +1492,28 @@ namespace Filtration.Parser.Tests.Services
}
[Test]
public void ReplaceColorBlockItemsFromString_SingleLine_ReplacesColorBlockBugTest()
public void ReplaceAudioVisualBlockItemsFromString_SingleLine_ReplacesSoundBlockItem()
{
// Arrange
var testInputString = "PlayAlertSound 7 280";
var testInputBlockItems = new ObservableCollection<IItemFilterBlockItem>();
var testInputBlockItem = new SoundBlockItem(12,30);
testInputBlockItems.Add(testInputBlockItem);
// Act
_testUtility.Translator.ReplaceAudioVisualBlockItemsFromString(testInputBlockItems, testInputString);
// Assert
var soundBlockItem = testInputBlockItems.First(b => b is SoundBlockItem) as SoundBlockItem;
Assert.IsNotNull(soundBlockItem);
Assert.AreNotSame(testInputBlockItem, soundBlockItem);
Assert.AreEqual(7, soundBlockItem.Value);
Assert.AreEqual(280, soundBlockItem.SecondValue);
}
[Test]
public void ReplaceAudioVisualBlockItemsFromString_SingleLine_ReplacesColorBlockBugTest()
{
// Arrange
var testInputString = "SetBackgroundColor 70 0 0 255";
@@ -1502,7 +1523,7 @@ namespace Filtration.Parser.Tests.Services
testInputBlockItems.Add(testInputBlockItem);
// Act
_testUtility.Translator.ReplaceColorBlockItemsFromString(testInputBlockItems, testInputString);
_testUtility.Translator.ReplaceAudioVisualBlockItemsFromString(testInputBlockItems, testInputString);
// Assert
var backgroundColorBlockItem = testInputBlockItems.First(b => b is BackgroundColorBlockItem) as BackgroundColorBlockItem;
@@ -1513,7 +1534,7 @@ namespace Filtration.Parser.Tests.Services
[Ignore("Not currently possible - will not be necessary once commanding (to enable undo history) is implemented anyway")]
[Test]
public void ReplaceColorBlockItemsFromString_MalformedLine_DoesNothing()
public void ReplaceAudioVisualBlockItemsFromString_MalformedLine_DoesNothing()
{
// Arrange
var testInputString = "SetTextCsaolor 240 200 150 # Rarest Currency";
@@ -1523,7 +1544,7 @@ namespace Filtration.Parser.Tests.Services
testInputBlockItems.Add(testInputBlockItem);
// Act
_testUtility.Translator.ReplaceColorBlockItemsFromString(testInputBlockItems, testInputString);
_testUtility.Translator.ReplaceAudioVisualBlockItemsFromString(testInputBlockItems, testInputString);
// Assert
var textColorBlockItem = testInputBlockItems.First(b => b is TextColorBlockItem) as TextColorBlockItem;
@@ -1532,23 +1553,27 @@ namespace Filtration.Parser.Tests.Services
}
[Test]
public void ReplaceColorBlockItemsFromString_MultipleLines_ExistingBlockItems()
public void ReplaceAudioVisualBlockItemsFromString_MultipleLines_ExistingBlockItems()
{
// Arrange
var testInputString = "SetTextColor 240 200 150 # Rarest Currency" + Environment.NewLine +
"SetBackgroundColor 0 0 0 # Rarest Currency Background" + Environment.NewLine +
"SetBorderColor 255 255 255 # Rarest Currency Border";
"SetBorderColor 255 255 255 # Rarest Currency Border" + Environment.NewLine +
"PlayAlertSound 7 280";
var testInputBlockItems = new ObservableCollection<IItemFilterBlockItem>();
var testInputTextColorBlockItem = new TextColorBlockItem(Colors.Red);
var testInputBackgroundColorBlockItem = new BackgroundColorBlockItem(Colors.Blue);
var testInpuBorderColorBlockItem = new BorderColorBlockItem(Colors.Yellow);
var testInputBorderColorBlockItem = new BorderColorBlockItem(Colors.Yellow);
var testInputSoundBlockItem = new SoundBlockItem(1, 1);
testInputBlockItems.Add(testInputTextColorBlockItem);
testInputBlockItems.Add(testInputBackgroundColorBlockItem);
testInputBlockItems.Add(testInpuBorderColorBlockItem);
testInputBlockItems.Add(testInputBorderColorBlockItem);
testInputBlockItems.Add(testInputSoundBlockItem);
// Act
_testUtility.Translator.ReplaceColorBlockItemsFromString(testInputBlockItems, testInputString);
_testUtility.Translator.ReplaceAudioVisualBlockItemsFromString(testInputBlockItems, testInputString);
// Assert
var textColorBlockItem = testInputBlockItems.First(b => b is TextColorBlockItem) as TextColorBlockItem;
@@ -1563,23 +1588,29 @@ namespace Filtration.Parser.Tests.Services
var borderColorBlockItem = testInputBlockItems.First(b => b is BorderColorBlockItem) as BorderColorBlockItem;
Assert.IsNotNull(borderColorBlockItem);
Assert.AreNotSame(testInpuBorderColorBlockItem, borderColorBlockItem);
Assert.AreNotSame(testInputBorderColorBlockItem, borderColorBlockItem);
Assert.AreEqual(new Color { A = 255, R = 255, G = 255, B = 255 }, borderColorBlockItem.Color);
var soundBlockItem = testInputBlockItems.First(b => b is SoundBlockItem) as SoundBlockItem;
Assert.IsNotNull(soundBlockItem);
Assert.AreNotSame(testInputSoundBlockItem, soundBlockItem);
Assert.AreEqual(7, soundBlockItem.Value);
Assert.AreEqual(280, soundBlockItem.SecondValue);
}
[Test]
public void ReplaceColorBlockItemsFromString_MultipleLines_NoExistingBlockItems()
public void ReplaceAudioVisualBlockItemsFromString_MultipleLines_NoExistingBlockItems()
{
// Arrange
var testInputString = "SetTextColor 240 200 150 # Rarest Currency" + Environment.NewLine +
"SetBackgroundColor 0 0 0 # Rarest Currency Background" + Environment.NewLine +
"SetBorderColor 255 255 255 # Rarest Currency Border";
"SetBorderColor 255 255 255 # Rarest Currency Border" + Environment.NewLine +
"PlayAlertSound 7 280";
var testInputBlockItems = new ObservableCollection<IItemFilterBlockItem>();
// Act
_testUtility.Translator.ReplaceColorBlockItemsFromString(testInputBlockItems, testInputString);
_testUtility.Translator.ReplaceAudioVisualBlockItemsFromString(testInputBlockItems, testInputString);
// Assert
var textColorBlockItem = testInputBlockItems.First(b => b is TextColorBlockItem) as TextColorBlockItem;
@@ -1593,10 +1624,15 @@ namespace Filtration.Parser.Tests.Services
var borderColorBlockItem = testInputBlockItems.First(b => b is BorderColorBlockItem) as BorderColorBlockItem;
Assert.IsNotNull(borderColorBlockItem);
Assert.AreEqual(new Color { A = 255, R = 255, G = 255, B = 255 }, borderColorBlockItem.Color);
var soundBlockItem = testInputBlockItems.First(b => b is SoundBlockItem) as SoundBlockItem;
Assert.IsNotNull(soundBlockItem);
Assert.AreEqual(7, soundBlockItem.Value);
Assert.AreEqual(280, soundBlockItem.SecondValue);
}
[Test]
public void ReplaceColorBlockItemsFromString_MultipleLines_SomeExistingBlockItems()
public void ReplaceAudioVisualBlockItemsFromString_MultipleLines_SomeExistingBlockItems()
{
// Arrange
var testInputString = "SetTextColor 240 200 150 # Rarest Currency" + Environment.NewLine +
@@ -1611,7 +1647,7 @@ namespace Filtration.Parser.Tests.Services
testInputBlockItems.Add(testInpuBorderColorBlockItem);
// Act
_testUtility.Translator.ReplaceColorBlockItemsFromString(testInputBlockItems, testInputString);
_testUtility.Translator.ReplaceAudioVisualBlockItemsFromString(testInputBlockItems, testInputString);
// Assert
var textColorBlockItem = testInputBlockItems.First(b => b is TextColorBlockItem) as TextColorBlockItem;
@@ -1627,7 +1663,7 @@ namespace Filtration.Parser.Tests.Services
[Ignore("ThemeComponentBuilder deprecated")]
[Test]
public void ReplaceColorBlockItemsFromString_ThemeComponentBuilderNotInitialised_DoesNotCallAddComponent()
public void ReplaceAudioVisualBlockItemsFromString_ThemeComponentBuilderNotInitialised_DoesNotCallAddComponent()
{
// Arrange
var testInputString = "SetTextColor 240 200 150 # Rarest Currency";
@@ -1637,7 +1673,7 @@ namespace Filtration.Parser.Tests.Services
testInputBlockItems.Add(testInputBlockItem);
// Act
_testUtility.Translator.ReplaceColorBlockItemsFromString(testInputBlockItems, testInputString);
_testUtility.Translator.ReplaceAudioVisualBlockItemsFromString(testInputBlockItems, testInputString);
// Assert

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Castle.Core" version="3.3.3" targetFramework="net461" />
<package id="FluentAssertions" version="4.13.0" targetFramework="net461" />
<package id="FluentAssertions" version="4.13.1" targetFramework="net461" />
<package id="Moq" version="4.5.21" targetFramework="net461" />
<package id="NUnit" version="3.4.1" targetFramework="net461" />
</packages>

View File

@@ -318,7 +318,7 @@ namespace Filtration.Parser.Services
return blockItem;
}
public void ReplaceColorBlockItemsFromString(ObservableCollection<IItemFilterBlockItem> blockItems, string inputString)
public void ReplaceAudioVisualBlockItemsFromString(ObservableCollection<IItemFilterBlockItem> blockItems, string inputString)
{
// Reverse iterate to remove existing IAudioVisualBlockItems
for (var idx = blockItems.Count - 1; idx >= 0; idx--)
@@ -335,6 +335,13 @@ namespace Filtration.Parser.Services
switch (matches.Value)
{
case "PlayAlertSound":
{
var match = Regex.Match(line, @"\s+(\d+) (\d+)");
if (!match.Success) break;
blockItems.Add(new SoundBlockItem(Convert.ToInt16(match.Groups[1].Value), Convert.ToInt16(match.Groups[2].Value)));
break;
}
case "SetTextColor":
{
blockItems.Add(GetColorBlockItemFromString<TextColorBlockItem>(line));

View File

@@ -35,12 +35,12 @@
<HintPath>..\packages\Castle.Core.3.3.3\lib\net45\Castle.Core.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="FluentAssertions, Version=4.13.0.0, Culture=neutral, PublicKeyToken=33f2691a05b67b6a, processorArchitecture=MSIL">
<HintPath>..\packages\FluentAssertions.4.13.0\lib\net45\FluentAssertions.dll</HintPath>
<Reference Include="FluentAssertions, Version=4.13.1.0, Culture=neutral, PublicKeyToken=33f2691a05b67b6a, processorArchitecture=MSIL">
<HintPath>..\packages\FluentAssertions.4.13.1\lib\net45\FluentAssertions.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="FluentAssertions.Core, Version=4.13.0.0, Culture=neutral, PublicKeyToken=33f2691a05b67b6a, processorArchitecture=MSIL">
<HintPath>..\packages\FluentAssertions.4.13.0\lib\net45\FluentAssertions.Core.dll</HintPath>
<Reference Include="FluentAssertions.Core, Version=4.13.1.0, Culture=neutral, PublicKeyToken=33f2691a05b67b6a, processorArchitecture=MSIL">
<HintPath>..\packages\FluentAssertions.4.13.1\lib\net45\FluentAssertions.Core.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Moq, Version=4.5.21.0, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Castle.Core" version="3.3.3" targetFramework="net461" />
<package id="FluentAssertions" version="4.13.0" targetFramework="net461" />
<package id="FluentAssertions" version="4.13.1" targetFramework="net461" />
<package id="Moq" version="4.5.21" targetFramework="net461" />
<package id="NUnit" version="3.4.1" targetFramework="net461" />
</packages>

Binary file not shown.

View File

@@ -1,18 +1,16 @@
using System;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Windows;
using System.Windows.Threading;
using AutoMapper;
using Castle.Facilities.TypedFactory;
using Castle.MicroKernel.ModelBuilder.Inspectors;
using Castle.MicroKernel.Registration;
using Castle.Windsor;
using Castle.Windsor.Installer;
using Filtration.ObjectModel;
using Filtration.ObjectModel.ThemeEditor;
using Filtration.Properties;
using Filtration.Services;
using Filtration.ThemeEditor.ViewModels;
using Filtration.ViewModels;
using Filtration.Views;
@@ -71,8 +69,11 @@ namespace Filtration
var mainWindow = _container.Resolve<IMainWindow>();
mainWindow.Show();
}
var updateCheckService = _container.Resolve<IUpdateCheckService>();
updateCheckService.CheckForUpdates();
}
private static void OnDispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
{
Logger.Fatal(e.Exception);

View File

@@ -11,7 +11,7 @@ using System.Windows;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("XVar Industries Inc.")]
[assembly: AssemblyProduct("Filtration")]
[assembly: AssemblyCopyright("Copyright © Ben Wallis 2015")]
[assembly: AssemblyCopyright("Copyright © Ben Wallis 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
@@ -50,7 +50,7 @@ using System.Windows;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.12")]
[assembly: AssemblyVersion("0.14")]
[assembly: InternalsVisibleTo("Filtration.Tests")]
[assembly: InternalsVisibleTo("Filtration.ItemFilterPreview.Tests")]

View File

@@ -34,10 +34,28 @@ namespace Filtration.Services
var itemBaseTypesPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\Filtration\ItemBaseTypes.txt";
var itemClassesPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\Filtration\ItemClasses.txt";
var itemBaseTypes = _fileSystemService.ReadFileAsString(itemBaseTypesPath);
string itemBaseTypes;
try
{
itemBaseTypes = _fileSystemService.ReadFileAsString(itemBaseTypesPath);
}
catch (Exception)
{
itemBaseTypes = string.Empty;
}
ItemBaseTypes = new LineReader(() => new StringReader(itemBaseTypes)).ToList();
var itemClasses = _fileSystemService.ReadFileAsString(itemClassesPath);
string itemClasses;
try
{
itemClasses = _fileSystemService.ReadFileAsString(itemClassesPath);
}
catch (Exception)
{
itemClasses = string.Empty;
}
ItemClasses = new LineReader(() => new StringReader(itemClasses)).ToList();
}
}

View File

@@ -6,13 +6,15 @@ using System.Windows;
using System.Xml.Serialization;
using Filtration.Models;
using Filtration.Properties;
using Filtration.ViewModels;
using Filtration.Views;
using NLog;
namespace Filtration.Services
{
internal interface IUpdateCheckService
{
UpdateData CheckForUpdates();
void CheckForUpdates();
}
internal class UpdateCheckService : IUpdateCheckService
@@ -20,13 +22,16 @@ namespace Filtration.Services
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
private readonly IHTTPService _httpService;
public UpdateCheckService(IHTTPService httpService)
private readonly IUpdateAvailableViewModel _updateAvailableViewModel;
public UpdateCheckService(IHTTPService httpService,
IUpdateAvailableViewModel updateAvailableViewModel)
{
_httpService = httpService;
_updateAvailableViewModel = updateAvailableViewModel;
}
public UpdateData CheckForUpdates()
public void CheckForUpdates()
{
var assemblyVersion = FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location);
@@ -45,7 +50,6 @@ namespace Filtration.Services
Settings.Default.Save();
updateData.UpdateAvailable = true;
return updateData;
}
}
@@ -72,9 +76,14 @@ namespace Filtration.Services
}
}
}
updateData.UpdateAvailable = false;
return updateData;
if (updateData.UpdateAvailable)
{
var updateAvailableView = new UpdateAvailableView { DataContext = _updateAvailableViewModel };
_updateAvailableViewModel.Initialise(updateData);
_updateAvailableViewModel.OnRequestClose += (s, e) => updateAvailableView.Close();
updateAvailableView.ShowDialog();
}
}
catch (Exception e)
{
@@ -82,8 +91,6 @@ namespace Filtration.Services
// We don't care if the update check fails, because it could fail for multiple reasons
// including the user blocking Filtration in their firewall.
}
return null;
}
private static bool LatestVersionIsNewerThanSuppressedVersion(UpdateData updateData)

View File

@@ -24,6 +24,7 @@ namespace Filtration.ViewModels
bool IsExpanded { get; set; }
IItemFilterBlock Block { get; }
bool BlockEnabled { get; set; }
string BlockDescription { get; set; }
void RefreshBlockPreview();
}
@@ -359,10 +360,10 @@ namespace Filtration.ViewModels
IsDirty = true;
}
if (sender is IAudioVisualBlockItem)
{
RefreshBlockPreview();
}
//if (sender is IAudioVisualBlockItem)
//{
RefreshBlockPreview();
//}
}
public void RefreshBlockPreview()

View File

@@ -605,7 +605,7 @@ namespace Filtration.ViewModels
return;
}
_blockTranslator.ReplaceColorBlockItemsFromString(targetBlockViewModel.Block.BlockItems, clipboardText);
_blockTranslator.ReplaceAudioVisualBlockItemsFromString(targetBlockViewModel.Block.BlockItems, clipboardText);
targetBlockViewModel.RefreshBlockPreview();
}

View File

@@ -10,13 +10,10 @@ using System.Windows.Forms;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using Filtration.Common.Services;
using Filtration.Common.ViewModels;
using Filtration.Interface;
using Filtration.Models;
using Filtration.ObjectModel.Enums;
using Filtration.ObjectModel.ThemeEditor;
using Filtration.Parser.Interface.Services;
using Filtration.Properties;
using Filtration.Repositories;
using Filtration.Services;
using Filtration.ThemeEditor.Messages;
@@ -50,8 +47,6 @@ namespace Filtration.ViewModels
private readonly IAvalonDockWorkspaceViewModel _avalonDockWorkspaceViewModel;
private readonly IThemeProvider _themeProvider;
private readonly IThemeService _themeService;
private readonly IUpdateCheckService _updateCheckService;
private readonly IUpdateAvailableViewModel _updateAvailableViewModel;
private readonly IMessageBoxService _messageBoxService;
private readonly IClipboardService _clipboardService;
private bool _showLoadingBanner;
@@ -63,8 +58,6 @@ namespace Filtration.ViewModels
ISettingsPageViewModel settingsPageViewModel,
IThemeProvider themeProvider,
IThemeService themeService,
IUpdateCheckService updateCheckService,
IUpdateAvailableViewModel updateAvailableViewModel,
IMessageBoxService messageBoxService,
IClipboardService clipboardService)
{
@@ -75,8 +68,6 @@ namespace Filtration.ViewModels
SettingsPageViewModel = settingsPageViewModel;
_themeProvider = themeProvider;
_themeService = themeService;
_updateCheckService = updateCheckService;
_updateAvailableViewModel = updateAvailableViewModel;
_messageBoxService = messageBoxService;
_clipboardService = clipboardService;
@@ -102,10 +93,8 @@ namespace Filtration.ViewModels
AddBlockCommand = new RelayCommand(OnAddBlockCommand, () => ActiveDocumentIsScript);
AddSectionCommand = new RelayCommand(OnAddSectionCommand, () => ActiveDocumentIsScript);
DeleteBlockCommand = new RelayCommand(OnDeleteBlockCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedBlock);
DisableBlockCommand = new RelayCommand(OnDisableBlockCommand,
() => ActiveDocumentIsScript && ActiveScriptHasSelectedEnabledBlock);
EnableBlockCommand = new RelayCommand(OnEnableBlockCommand,
() => ActiveDocumentIsScript && ActiveScriptHasSelectedDisabledBlock);
DisableBlockCommand = new RelayCommand(OnDisableBlockCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedEnabledBlock);
EnableBlockCommand = new RelayCommand(OnEnableBlockCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedDisabledBlock);
OpenAboutWindowCommand = new RelayCommand(OnOpenAboutWindowCommand);
ReplaceColorsCommand = new RelayCommand(OnReplaceColorsCommand, () => ActiveDocumentIsScript);
@@ -116,10 +105,7 @@ namespace Filtration.ViewModels
AddTextColorThemeComponentCommand = new RelayCommand(OnAddTextColorThemeComponentCommand, () => ActiveDocumentIsTheme && ActiveThemeIsEditable);
AddBackgroundColorThemeComponentCommand = new RelayCommand(OnAddBackgroundColorThemeComponentCommand, () => ActiveDocumentIsTheme && ActiveThemeIsEditable);
AddBorderColorThemeComponentCommand = new RelayCommand(OnAddBorderColorThemeComponentCommand, () => ActiveDocumentIsTheme && ActiveThemeIsEditable);
DeleteThemeComponentCommand = new RelayCommand(OnDeleteThemeComponentCommand,
() =>
ActiveDocumentIsTheme && ActiveThemeIsEditable &&
_avalonDockWorkspaceViewModel.ActiveThemeViewModel.SelectedThemeComponent != null);
DeleteThemeComponentCommand = new RelayCommand(OnDeleteThemeComponentCommand, () => ActiveDocumentIsTheme && ActiveThemeIsEditable && _avalonDockWorkspaceViewModel.ActiveThemeViewModel.SelectedThemeComponent != null);
ExpandAllBlocksCommand = new RelayCommand(OnExpandAllBlocksCommand, () => ActiveDocumentIsScript);
CollapseAllBlocksCommand = new RelayCommand(OnCollapseAllBlocksCommand, () => ActiveDocumentIsScript);
@@ -189,8 +175,6 @@ namespace Filtration.ViewModels
}
}
});
CheckForUpdates();
}
public RelayCommand OpenScriptCommand { get; }
@@ -232,19 +216,6 @@ namespace Filtration.ViewModels
public RelayCommand<bool> ToggleShowAdvancedCommand { get; }
public RelayCommand ClearFiltersCommand { get; }
private void CheckForUpdates()
{
var updateData = _updateCheckService.CheckForUpdates();
if (updateData != null && updateData.UpdateAvailable)
{
var updateAvailableView = new UpdateAvailableView { DataContext = _updateAvailableViewModel };
_updateAvailableViewModel.Initialise(updateData);
_updateAvailableViewModel.OnRequestClose += (s, e) => updateAvailableView.Close();
updateAvailableView.ShowDialog();
}
}
public ImageSource Icon { get; private set; }

View File

@@ -75,8 +75,7 @@
<MenuItem Header="Paste Block Style" Command="{Binding PasteBlockStyleCommand}" Icon="{StaticResource PasteIcon}" />
</MenuItem>
<MenuItem Header="Add Block" Command="{Binding Data.AddBlockCommand, Source={StaticResource Proxy}}" Icon="{StaticResource AddBlockIcon}" />
<MenuItem Header="Add Section" Command="{Binding Data.AddSectionCommand, Source={StaticResource Proxy}}" Icon="{StaticResource AddSectionIcon}">
</MenuItem>
<MenuItem Header="Add Section" Command="{Binding Data.AddSectionCommand, Source={StaticResource Proxy}}" Icon="{StaticResource AddSectionIcon}" />
<Separator />
<MenuItem Header="Delete Block" Command="{Binding Data.DeleteBlockCommand, Source={StaticResource Proxy}}" Icon="{StaticResource DeleteIcon}" />
<Separator />
@@ -264,7 +263,7 @@
<ItemsControl.ItemTemplate>
<DataTemplate>
<TextBlock Margin="0,0,3,0">
<Hyperlink Command="{Binding ElementName=TopLevelGrid, Path=DataContext.AddBlockCommand}" CommandParameter="{Binding}">
<Hyperlink Command="{Binding ElementName=TopLevelGrid, Path=DataContext.AddFilterBlockItemCommand}" CommandParameter="{Binding}">
<TextBlock>+</TextBlock><TextBlock Text="{Binding Path=., Converter={StaticResource BlockItemTypeToStringConverter}}" />
</Hyperlink>
</TextBlock>

View File

@@ -16,6 +16,24 @@
</Style>
</UserControl.Resources>
<Grid>
<Grid.ContextMenu>
<ContextMenu>
<ContextMenu.Items>
<MenuItem Header="Copy Block" Command="{Binding CopyBlockCommand}" Icon="{StaticResource CopyIcon}" />
<MenuItem Header="Paste Block" Command="{Binding PasteBlockCommand}" Icon="{StaticResource PasteIcon}" />
<Separator />
<MenuItem Header="Add Block" Command="{Binding AddBlockCommand}" Icon="{StaticResource AddBlockIcon}" />
<MenuItem Header="Add Section" Command="{Binding AddSectionCommand}" Icon="{StaticResource AddSectionIcon}" />
<Separator />
<MenuItem Header="Delete Section" Command="{Binding DeleteBlockCommand}" Icon="{StaticResource DeleteIcon}" />
<Separator />
<MenuItem Header="Move Section To Top" Command="{Binding MoveBlockToTopCommand}" Icon="{StaticResource MoveToTopIcon}" />
<MenuItem Header="Move Section Up" Command="{Binding MoveBlockUpCommand}" Icon="{StaticResource MoveUpIcon}" />
<MenuItem Header="Move Section Down" Command="{Binding MoveBlockDownCommand}" Icon="{StaticResource MoveDownIcon}" />
<MenuItem Header="Move Section To Bottom" Command="{Binding MoveBlockToBottomCommand}" Icon="{StaticResource MoveToBottomIcon}" />
</ContextMenu.Items>
</ContextMenu>
</Grid.ContextMenu>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />

View File

@@ -21,7 +21,7 @@
</ListBox.Resources>
<ListBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Block.Description, Converter={StaticResource HashSignRemovalConverter}}" ToolTip="{Binding Block.Description}" />
<TextBlock Text="{Binding BlockDescription, Converter={StaticResource HashSignRemovalConverter}}" ToolTip="{Binding BlockDescription}" />
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>

View File

@@ -4,7 +4,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:viewModels="clr-namespace:Filtration.ViewModels"
Title="Filtration - New Version Available!" Height="300" Width="500"
Title="Filtration - New Version Available!" Height="300" Width="500" Icon="../Resources/filtration.ico"
mc:Ignorable="d"
d:DataContext="{d:DesignInstance Type=viewModels:UpdateAvailableViewModel}">
<Grid Margin="10">

View File

@@ -2,13 +2,13 @@
Filtration is an editor for Path of Exile item filter scripts.
## Current Release (Released 2015-07-31)
<b>Installer (6.37mb)</b> <a href="https://github.com/ben-wallis/Filtration/releases/download/0.11/filtration_0.11_setup.exe">filtration_0.11_setup.exe</a>
## Current Release (Released 2016-08-30)
<b>Installer (7.44mb)</b> <a href="https://github.com/ben-wallis/Filtration/releases/download/0.13/filtration_0.13_setup.exe">filtration_0.13_setup.exe</a>
<b>Zip File (7.97mb)</b> <a href="https://github.com/ben-wallis/Filtration/releases/download/0.11/filtration_0.11.zip">filtration_0.11.zip</a>
<b>Zip File (9.75mb)</b> <a href="https://github.com/ben-wallis/Filtration/releases/download/0.13/filtration_0.13.zip">filtration_0.13.zip</a>
## System Requirements
Filtration requires .NET Framework 4.5.1 installed.
Filtration requires .NET Framework 4.6.1 installed.
## Features