13 Commits
0.1 ... 0.2

24 changed files with 263 additions and 197 deletions

View File

@@ -107,6 +107,7 @@
<Compile Include="Extensions\EnumHelper.cs" /> <Compile Include="Extensions\EnumHelper.cs" />
<Compile Include="Extensions\HyperlinkExtensions.cs" /> <Compile Include="Extensions\HyperlinkExtensions.cs" />
<Compile Include="Models\BlockItemBaseTypes\ActionBlockItem.cs" /> <Compile Include="Models\BlockItemBaseTypes\ActionBlockItem.cs" />
<Compile Include="Models\BlockItemBaseTypes\BlockItemBase.cs" />
<Compile Include="Models\BlockItemBaseTypes\ColorBlockItem.cs" /> <Compile Include="Models\BlockItemBaseTypes\ColorBlockItem.cs" />
<Compile Include="Models\BlockItemBaseTypes\DualIntegerBlockItem.cs" /> <Compile Include="Models\BlockItemBaseTypes\DualIntegerBlockItem.cs" />
<Compile Include="Models\BlockItemBaseTypes\IntegerBlockItem.cs" /> <Compile Include="Models\BlockItemBaseTypes\IntegerBlockItem.cs" />
@@ -147,6 +148,9 @@
<Compile Include="UserControls\EditableListBoxControl.xaml.cs"> <Compile Include="UserControls\EditableListBoxControl.xaml.cs">
<DependentUpon>EditableListBoxControl.xaml</DependentUpon> <DependentUpon>EditableListBoxControl.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="UserControls\ItemPreviewControl.xaml.cs">
<DependentUpon>ItemPreviewControl.xaml</DependentUpon>
</Compile>
<Compile Include="Utilities\LineReader.cs" /> <Compile Include="Utilities\LineReader.cs" />
<Compile Include="ViewModels\FiltrationViewModelBase.cs" /> <Compile Include="ViewModels\FiltrationViewModelBase.cs" />
<Compile Include="ViewModels\ILootFilterScriptViewModelFactory.cs" /> <Compile Include="ViewModels\ILootFilterScriptViewModelFactory.cs" />
@@ -182,6 +186,10 @@
<Compile Include="WindsorInstallers\TranslatorsInstaller.cs" /> <Compile Include="WindsorInstallers\TranslatorsInstaller.cs" />
<Compile Include="WindsorInstallers\ViewModelsInstaller.cs" /> <Compile Include="WindsorInstallers\ViewModelsInstaller.cs" />
<Compile Include="WindsorInstallers\ViewsInstaller.cs" /> <Compile Include="WindsorInstallers\ViewsInstaller.cs" />
<Page Include="UserControls\ItemPreviewControl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\CrossButton.xaml"> <Page Include="Views\CrossButton.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
@@ -202,7 +210,7 @@
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</Page> </Page>
<Page Include="Views\LootFilterBlockViewDictionary.xaml"> <Page Include="Views\SharedResourcesDictionary.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</Page> </Page>

View File

@@ -1,12 +1,9 @@
using System.ComponentModel; using System.Windows.Media;
using System.Runtime.CompilerServices;
using System.Windows.Media;
using Filtration.Annotations;
using Filtration.Enums; using Filtration.Enums;
namespace Filtration.Models.BlockItemBaseTypes namespace Filtration.Models.BlockItemBaseTypes
{ {
internal class ActionBlockItem : ILootFilterBlockItem internal class ActionBlockItem : BlockItemBase
{ {
private BlockAction _action; private BlockAction _action;
@@ -28,17 +25,17 @@ namespace Filtration.Models.BlockItemBaseTypes
} }
} }
public string PrefixText public override string PrefixText
{ {
get { return string.Empty; } get { return string.Empty; }
} }
public int MaximumAllowed public override int MaximumAllowed
{ {
get { return 1; } get { return 1; }
} }
public string DisplayHeading public override string DisplayHeading
{ {
get get
{ {
@@ -46,7 +43,7 @@ namespace Filtration.Models.BlockItemBaseTypes
} }
} }
public string SummaryText public override string SummaryText
{ {
get get
{ {
@@ -54,7 +51,7 @@ namespace Filtration.Models.BlockItemBaseTypes
} }
} }
public Color SummaryBackgroundColor public override Color SummaryBackgroundColor
{ {
get get
{ {
@@ -62,7 +59,7 @@ namespace Filtration.Models.BlockItemBaseTypes
} }
} }
public Color SummaryTextColor public override Color SummaryTextColor
{ {
get get
{ {
@@ -70,15 +67,11 @@ namespace Filtration.Models.BlockItemBaseTypes
} }
} }
public int SortOrder { get { return 0; } } public override int SortOrder { get { return 0; } }
public event PropertyChangedEventHandler PropertyChanged; public void ToggleAction()
[NotifyPropertyChangedInvocator]
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
{ {
var handler = PropertyChanged; Action = Action == BlockAction.Show ? BlockAction.Hide : BlockAction.Show;
if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
} }
} }
} }

View File

@@ -0,0 +1,26 @@
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Windows.Media;
using Filtration.Annotations;
namespace Filtration.Models.BlockItemBaseTypes
{
abstract class BlockItemBase : ILootFilterBlockItem
{
public abstract string PrefixText { get; }
public abstract int MaximumAllowed { get; }
public abstract string DisplayHeading { get; }
public abstract string SummaryText { get; }
public abstract Color SummaryBackgroundColor { get; }
public abstract Color SummaryTextColor { get; }
public abstract int SortOrder { get; }
public event PropertyChangedEventHandler PropertyChanged;
[NotifyPropertyChangedInvocator]
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
var handler = PropertyChanged;
if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
}
}
}

View File

@@ -1,11 +1,8 @@
using System.ComponentModel; using System.Windows.Media;
using System.Runtime.CompilerServices;
using System.Windows.Media;
using Filtration.Annotations;
namespace Filtration.Models.BlockItemBaseTypes namespace Filtration.Models.BlockItemBaseTypes
{ {
internal abstract class ColorBlockItem : ILootFilterBlockItem, IAudioVisualBlockItem internal abstract class ColorBlockItem : BlockItemBase, IAudioVisualBlockItem
{ {
private Color _color; private Color _color;
@@ -18,19 +15,13 @@ namespace Filtration.Models.BlockItemBaseTypes
Color = color; Color = color;
} }
public abstract string PrefixText { get; } public override string SummaryText
public abstract int MaximumAllowed { get; }
public abstract string DisplayHeading { get; }
public string SummaryText
{ {
get { return string.Empty; } get { return string.Empty; }
} }
public Color SummaryBackgroundColor { get { return Colors.Transparent; } } public override Color SummaryBackgroundColor { get { return Colors.Transparent; } }
public Color SummaryTextColor { get { return Colors.Transparent; } } public override Color SummaryTextColor { get { return Colors.Transparent; } }
public abstract int SortOrder { get; }
public Color Color public Color Color
{ {
@@ -41,13 +32,5 @@ namespace Filtration.Models.BlockItemBaseTypes
OnPropertyChanged(); OnPropertyChanged();
} }
} }
public event PropertyChangedEventHandler PropertyChanged;
[NotifyPropertyChangedInvocator]
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
var handler = PropertyChanged;
if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
}
} }
} }

View File

@@ -1,11 +1,8 @@
using System.ComponentModel; using System.Windows.Media;
using System.Runtime.CompilerServices;
using System.Windows.Media;
using Filtration.Annotations;
namespace Filtration.Models.BlockItemBaseTypes namespace Filtration.Models.BlockItemBaseTypes
{ {
internal abstract class DualIntegerBlockItem : ILootFilterBlockItem, IAudioVisualBlockItem internal abstract class DualIntegerBlockItem : BlockItemBase, IAudioVisualBlockItem
{ {
private int _value; private int _value;
private int _secondValue; private int _secondValue;
@@ -20,14 +17,9 @@ namespace Filtration.Models.BlockItemBaseTypes
SecondValue = secondValue; SecondValue = secondValue;
} }
public abstract string PrefixText { get; } public override string SummaryText { get { return string.Empty; } }
public abstract int MaximumAllowed { get; } public override Color SummaryBackgroundColor { get { return Colors.Transparent; } }
public abstract string DisplayHeading { get; } public override Color SummaryTextColor { get { return Colors.Transparent; } }
public string SummaryText { get { return string.Empty; } }
public Color SummaryBackgroundColor { get { return Colors.Transparent; } }
public Color SummaryTextColor { get { return Colors.Transparent; } }
public abstract int SortOrder { get; }
public int Value public int Value
{ {
@@ -48,13 +40,5 @@ namespace Filtration.Models.BlockItemBaseTypes
OnPropertyChanged(); OnPropertyChanged();
} }
} }
public event PropertyChangedEventHandler PropertyChanged;
[NotifyPropertyChangedInvocator]
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
var handler = PropertyChanged;
if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
}
} }
} }

View File

@@ -1,11 +1,8 @@
using System.ComponentModel; using System.Windows.Media;
using System.Runtime.CompilerServices;
using System.Windows.Media;
using Filtration.Annotations;
namespace Filtration.Models.BlockItemBaseTypes namespace Filtration.Models.BlockItemBaseTypes
{ {
internal abstract class IntegerBlockItem : ILootFilterBlockItem, IAudioVisualBlockItem internal abstract class IntegerBlockItem : BlockItemBase, IAudioVisualBlockItem
{ {
private int _value; private int _value;
@@ -18,15 +15,9 @@ namespace Filtration.Models.BlockItemBaseTypes
Value = value; Value = value;
} }
public abstract string PrefixText { get; } public override string SummaryText { get { return string.Empty; } }
public abstract int MaximumAllowed { get; } public override Color SummaryBackgroundColor { get { return Colors.Transparent; } }
public override Color SummaryTextColor { get { return Colors.Transparent; } }
public abstract string DisplayHeading { get; }
public string SummaryText { get { return string.Empty; } }
public Color SummaryBackgroundColor { get { return Colors.Transparent; } }
public Color SummaryTextColor { get { return Colors.Transparent; } }
public abstract int SortOrder { get; }
public abstract int Minimum { get; } public abstract int Minimum { get; }
public abstract int Maximum { get; } public abstract int Maximum { get; }
@@ -40,13 +31,5 @@ namespace Filtration.Models.BlockItemBaseTypes
OnPropertyChanged(); OnPropertyChanged();
} }
} }
public event PropertyChangedEventHandler PropertyChanged;
[NotifyPropertyChangedInvocator]
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
var handler = PropertyChanged;
if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
}
} }
} }

View File

@@ -1,13 +1,9 @@
using System; using System;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Windows.Media;
using Filtration.Annotations;
using Filtration.Enums; using Filtration.Enums;
namespace Filtration.Models.BlockItemBaseTypes namespace Filtration.Models.BlockItemBaseTypes
{ {
internal abstract class NumericFilterPredicateBlockItem : ILootFilterBlockItem internal abstract class NumericFilterPredicateBlockItem : BlockItemBase
{ {
private NumericFilterPredicate _filterPredicate; private NumericFilterPredicate _filterPredicate;
@@ -23,14 +19,6 @@ namespace Filtration.Models.BlockItemBaseTypes
FilterPredicate.PropertyChanged += OnFilterPredicateChanged; FilterPredicate.PropertyChanged += OnFilterPredicateChanged;
} }
public abstract string PrefixText { get; }
public abstract int MaximumAllowed { get; }
public abstract string DisplayHeading { get; }
public abstract string SummaryText { get; }
public abstract Color SummaryBackgroundColor { get; }
public abstract Color SummaryTextColor { get; }
public abstract int SortOrder { get; }
public abstract int Minimum { get; } public abstract int Minimum { get; }
public abstract int Maximum { get; } public abstract int Maximum { get; }
@@ -49,13 +37,5 @@ namespace Filtration.Models.BlockItemBaseTypes
OnPropertyChanged("FilterPredicate"); OnPropertyChanged("FilterPredicate");
OnPropertyChanged("SummaryText"); OnPropertyChanged("SummaryText");
} }
public event PropertyChangedEventHandler PropertyChanged;
[NotifyPropertyChangedInvocator]
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
var handler = PropertyChanged;
if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
}
} }
} }

View File

@@ -1,44 +1,22 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Collections.Specialized; using System.Collections.Specialized;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Windows.Media;
using Filtration.Annotations;
using Filtration.Enums; using Filtration.Enums;
namespace Filtration.Models.BlockItemBaseTypes namespace Filtration.Models.BlockItemBaseTypes
{ {
internal abstract class SocketGroupBlockItemBase : ILootFilterBlockItem internal abstract class SocketGroupBlockItemBase : BlockItemBase
{ {
protected SocketGroupBlockItemBase() protected SocketGroupBlockItemBase()
{ {
SocketColorGroups = new ObservableCollection<List<SocketColor>>(); SocketColorGroups = new ObservableCollection<List<SocketColor>>();
SocketColorGroups.CollectionChanged += OnSocketColorGroupsCollectionChanged; SocketColorGroups.CollectionChanged += OnSocketColorGroupsCollectionChanged;
} }
public abstract string PrefixText { get; }
public abstract int MaximumAllowed { get; }
public abstract string DisplayHeading { get; }
public abstract string SummaryText { get; }
public abstract Color SummaryBackgroundColor { get; }
public abstract Color SummaryTextColor { get; }
public abstract int SortOrder { get; }
public ObservableCollection<List<SocketColor>> SocketColorGroups { get; private set; } public ObservableCollection<List<SocketColor>> SocketColorGroups { get; private set; }
private void OnSocketColorGroupsCollectionChanged(object sender, NotifyCollectionChangedEventArgs e) private void OnSocketColorGroupsCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
{ {
OnPropertyChanged("SocketColorGroups"); OnPropertyChanged("SocketColorGroups");
} }
public event PropertyChangedEventHandler PropertyChanged;
[NotifyPropertyChangedInvocator]
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
var handler = PropertyChanged;
if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
}
} }
} }

View File

@@ -1,13 +1,9 @@
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Collections.Specialized; using System.Collections.Specialized;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Windows.Media;
using Filtration.Annotations;
namespace Filtration.Models.BlockItemBaseTypes namespace Filtration.Models.BlockItemBaseTypes
{ {
internal abstract class StringListBlockItem : ILootFilterBlockItem internal abstract class StringListBlockItem : BlockItemBase
{ {
protected StringListBlockItem() protected StringListBlockItem()
{ {
@@ -15,14 +11,6 @@ namespace Filtration.Models.BlockItemBaseTypes
Items.CollectionChanged += OnItemsCollectionChanged; Items.CollectionChanged += OnItemsCollectionChanged;
} }
public abstract string PrefixText { get; }
public abstract int MaximumAllowed { get; }
public abstract string DisplayHeading { get; }
public abstract string SummaryText { get; }
public abstract Color SummaryBackgroundColor { get; }
public abstract Color SummaryTextColor { get; }
public abstract int SortOrder { get; }
public ObservableCollection<string> Items { get; protected set; } public ObservableCollection<string> Items { get; protected set; }
private void OnItemsCollectionChanged(object sender, NotifyCollectionChangedEventArgs e) private void OnItemsCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
@@ -30,13 +18,5 @@ namespace Filtration.Models.BlockItemBaseTypes
OnPropertyChanged("Items"); OnPropertyChanged("Items");
OnPropertyChanged("SummaryText"); OnPropertyChanged("SummaryText");
} }
public event PropertyChangedEventHandler PropertyChanged;
[NotifyPropertyChangedInvocator]
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
var handler = PropertyChanged;
if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
}
} }
} }

View File

@@ -3,6 +3,8 @@ using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Linq; using System.Linq;
using Filtration.Models.BlockItemTypes; using Filtration.Models.BlockItemTypes;
using Filtration.ViewModels;
using Filtration.Views;
namespace Filtration.Models namespace Filtration.Models
{ {

View File

@@ -50,7 +50,7 @@ using System.Windows;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.1.*")] [assembly: AssemblyVersion("0.2.*")]
[assembly: InternalsVisibleTo("Filtration.Tests")] [assembly: InternalsVisibleTo("Filtration.Tests")]
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")] [assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")]

View File

@@ -82,7 +82,7 @@ namespace Filtration.Translators
{ {
var outputString = string.Empty; var outputString = string.Empty;
outputString += "# Script edited with Filtration - http://ben-wallis.github.io/Filtration/" + outputString += "# Script edited with Filtration - https://github.com/ben-wallis/Filtration" +
Environment.NewLine; Environment.NewLine;
if (!string.IsNullOrEmpty(script.Description)) if (!string.IsNullOrEmpty(script.Description))

View File

@@ -0,0 +1,26 @@
<UserControl x:Class="Filtration.UserControls.ItemPreviewControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:userControls="clr-namespace:Filtration.UserControls"
mc:Ignorable="d"
d:DataContext="{d:DesignInstance Type=userControls:ItemPreviewControl}"
d:DesignHeight="35" d:DesignWidth="170">
<UserControl.Resources>
<ResourceDictionary Source="../Views/SharedResourcesDictionary.xaml" />
</UserControl.Resources>
<Grid Width="143" Height="28">
<Image Source="pack://application:,,,/resources/groundtile.png" Stretch="Fill" />
<Border Margin="3" Padding="4,0,4,2" BorderThickness="2" BorderBrush="{Binding BorderColor, Converter={StaticResource ColorToSolidColorBrushConverter}}">
<Border.Background>
<SolidColorBrush Color="{Binding BackgroundColor}" />
</Border.Background>
<TextBlock TextAlignment="Center" Text="Test Item Preview" Style="{StaticResource PathOfExileFont}">
<TextBlock.Foreground>
<SolidColorBrush Color="{Binding TextColor}" />
</TextBlock.Foreground>
</TextBlock>
</Border>
</Grid>
</UserControl>

View File

@@ -0,0 +1,74 @@
using System.Windows;
using System.Windows.Media;
namespace Filtration.UserControls
{
public partial class ItemPreviewControl
{
public ItemPreviewControl()
{
InitializeComponent();
// ReSharper disable once PossibleNullReferenceException
(Content as FrameworkElement).DataContext = this;
}
public static readonly DependencyProperty TextColorProperty = DependencyProperty.Register(
"TextColor",
typeof (Color),
typeof(ItemPreviewControl),
new FrameworkPropertyMetadata()
);
public static readonly DependencyProperty BackgroundColorProperty = DependencyProperty.Register(
"BackgroundColor",
typeof(Color),
typeof(ItemPreviewControl),
new FrameworkPropertyMetadata()
);
public static readonly DependencyProperty BorderColorProperty = DependencyProperty.Register(
"BorderColor",
typeof(Color),
typeof(ItemPreviewControl),
new FrameworkPropertyMetadata()
);
public Color TextColor
{
get { return (Color) GetValue(TextColorProperty); }
set { SetValue(TextColorProperty, value); }
}
public Color BackgroundColor
{
get { return (Color)GetValue(BackgroundColorProperty); }
set { SetValue(BackgroundColorProperty, value); }
}
public Color BorderColor
{
get { return (Color)GetValue(BorderColorProperty); }
set { SetValue(BorderColorProperty, value); }
}
//private static void OnItemPreviewControlPropertyChanged(DependencyObject source,
// DependencyPropertyChangedEventArgs e)
//{
// var control = source as ItemPreviewControl;
// if (control == null) return;
// control.OnPropertyChanged("TextColor");
// control.OnPropertyChanged("BackgroundColor");
// control.OnPropertyChanged("BorderColor");
//}
//public event PropertyChangedEventHandler PropertyChanged;
//[NotifyPropertyChangedInvocator]
//protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
//{
// var handler = PropertyChanged;
// if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
//}
}
}

View File

@@ -3,8 +3,10 @@ using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Collections.Specialized; using System.Collections.Specialized;
using System.Linq; using System.Linq;
using System.Windows;
using System.Windows.Media; using System.Windows.Media;
using Filtration.Models; using Filtration.Models;
using Filtration.Models.BlockItemBaseTypes;
using Filtration.Models.BlockItemTypes; using Filtration.Models.BlockItemTypes;
using Filtration.Services; using Filtration.Services;
using Filtration.Views; using Filtration.Views;
@@ -44,6 +46,7 @@ namespace Filtration.ViewModels
MoveBlockToBottomCommand = new RelayCommand(OnMoveBlockToBottomCommand); MoveBlockToBottomCommand = new RelayCommand(OnMoveBlockToBottomCommand);
ReplaceColorsCommand = new RelayCommand(OnReplaceColorsCommand); ReplaceColorsCommand = new RelayCommand(OnReplaceColorsCommand);
AddFilterBlockItemCommand = new RelayCommand<Type>(OnAddFilterBlockItemCommand); AddFilterBlockItemCommand = new RelayCommand<Type>(OnAddFilterBlockItemCommand);
ToggleBlockActionCommand = new RelayCommand(OnToggleBlockActionCommand);
AddAudioVisualBlockItemCommand = new RelayCommand<Type>(OnAddAudioVisualBlockItemCommand); AddAudioVisualBlockItemCommand = new RelayCommand<Type>(OnAddAudioVisualBlockItemCommand);
RemoveFilterBlockItemCommand = new RelayCommand<ILootFilterBlockItem>(OnRemoveFilterBlockItemCommand); RemoveFilterBlockItemCommand = new RelayCommand<ILootFilterBlockItem>(OnRemoveFilterBlockItemCommand);
RemoveAudioVisualBlockItemCommand = new RelayCommand<ILootFilterBlockItem>(OnRemoveAudioVisualBlockItemCommand); RemoveAudioVisualBlockItemCommand = new RelayCommand<ILootFilterBlockItem>(OnRemoveAudioVisualBlockItemCommand);
@@ -77,6 +80,7 @@ namespace Filtration.ViewModels
public RelayCommand MoveBlockDownCommand { get; private set; } public RelayCommand MoveBlockDownCommand { get; private set; }
public RelayCommand MoveBlockToTopCommand { get; private set; } public RelayCommand MoveBlockToTopCommand { get; private set; }
public RelayCommand MoveBlockToBottomCommand { get; private set; } public RelayCommand MoveBlockToBottomCommand { get; private set; }
public RelayCommand ToggleBlockActionCommand { get; private set; }
public RelayCommand ReplaceColorsCommand { get; private set; } public RelayCommand ReplaceColorsCommand { get; private set; }
public RelayCommand<Type> AddFilterBlockItemCommand { get; private set; } public RelayCommand<Type> AddFilterBlockItemCommand { get; private set; }
public RelayCommand<Type> AddAudioVisualBlockItemCommand { get; private set; } public RelayCommand<Type> AddAudioVisualBlockItemCommand { get; private set; }
@@ -245,6 +249,15 @@ namespace Filtration.ViewModels
get { return Block.HasBlockItemOfType<SoundBlockItem>(); } get { return Block.HasBlockItemOfType<SoundBlockItem>(); }
} }
private void OnToggleBlockActionCommand()
{
var actionBlock = Block.BlockItems.OfType<ActionBlockItem>().First();
if (actionBlock != null)
{
actionBlock.ToggleAction();
}
}
private void OnAddFilterBlockItemCommand(Type blockItemType) private void OnAddFilterBlockItemCommand(Type blockItemType)
{ {
if (!AddBlockItemAllowed(blockItemType)) return; if (!AddBlockItemAllowed(blockItemType)) return;

View File

@@ -42,7 +42,7 @@ namespace Filtration.ViewModels
AddBlockCommand = new RelayCommand(OnAddBlockCommand); AddBlockCommand = new RelayCommand(OnAddBlockCommand);
AddSectionCommand = new RelayCommand(OnAddSectionCommand, () => SelectedBlockViewModel != null); AddSectionCommand = new RelayCommand(OnAddSectionCommand, () => SelectedBlockViewModel != null);
CopyBlockCommand = new RelayCommand(OnCopyBlockCommand, () => SelectedBlockViewModel != null); CopyBlockCommand = new RelayCommand(OnCopyBlockCommand, () => SelectedBlockViewModel != null);
PasteBlockCommand = new RelayCommand(OnPasteBlockCommand); PasteBlockCommand = new RelayCommand(OnPasteBlockCommand, () => SelectedBlockViewModel != null);
_lootFilterBlockViewModelFactory = lootFilterBlockViewModelFactory; _lootFilterBlockViewModelFactory = lootFilterBlockViewModelFactory;
_blockTranslator = blockTranslator; _blockTranslator = blockTranslator;
LootFilterBlockViewModels = new ObservableCollection<ILootFilterBlockViewModel>(); LootFilterBlockViewModels = new ObservableCollection<ILootFilterBlockViewModel>();

View File

@@ -48,7 +48,7 @@ namespace Filtration.ViewModels
SaveScriptAsCommand = new RelayCommand(OnSaveScriptAsCommand, () => CurrentScriptViewModel != null); SaveScriptAsCommand = new RelayCommand(OnSaveScriptAsCommand, () => CurrentScriptViewModel != null);
CopyScriptCommand = new RelayCommand(OnCopyScriptCommand, () => CurrentScriptViewModel != null); CopyScriptCommand = new RelayCommand(OnCopyScriptCommand, () => CurrentScriptViewModel != null);
CopyBlockCommand = new RelayCommand(OnCopyBlockCommand, () => CurrentScriptViewModel != null && CurrentScriptViewModel.SelectedBlockViewModel != null); CopyBlockCommand = new RelayCommand(OnCopyBlockCommand, () => CurrentScriptViewModel != null && CurrentScriptViewModel.SelectedBlockViewModel != null);
PasteCommand = new RelayCommand(OnPasteCommand, () => CurrentScriptViewModel != null); PasteCommand = new RelayCommand(OnPasteCommand, () => CurrentScriptViewModel != null && CurrentScriptViewModel.SelectedBlockViewModel != null);
NewScriptCommand = new RelayCommand(OnNewScriptCommand); NewScriptCommand = new RelayCommand(OnNewScriptCommand);
CloseScriptCommand = new RelayCommand<ILootFilterScriptViewModel>(OnCloseScriptCommand, v => CurrentScriptViewModel != null); CloseScriptCommand = new RelayCommand<ILootFilterScriptViewModel>(OnCloseScriptCommand, v => CurrentScriptViewModel != null);
ReplaceColorsCommand = new RelayCommand(OnReplaceColorsCommand, () => CurrentScriptViewModel != null); ReplaceColorsCommand = new RelayCommand(OnReplaceColorsCommand, () => CurrentScriptViewModel != null);

View File

@@ -31,25 +31,28 @@ namespace Filtration.ViewModels
if (initialiseFromBlock.BlockItems.Count(b => b.GetType() == typeof (TextColorBlockItem)) > 0) if (initialiseFromBlock.BlockItems.Count(b => b.GetType() == typeof (TextColorBlockItem)) > 0)
{ {
_replaceColorsParameterSet.ReplaceTextColor = true; _replaceColorsParameterSet.ReplaceTextColor = true;
_replaceColorsParameterSet.OldTextColor = var existingBlockColor = ((TextColorBlockItem)
((TextColorBlockItem)
initialiseFromBlock.BlockItems.First(b => b.GetType() == typeof (TextColorBlockItem))).Color; initialiseFromBlock.BlockItems.First(b => b.GetType() == typeof (TextColorBlockItem))).Color;
_replaceColorsParameterSet.OldTextColor = existingBlockColor;
_replaceColorsParameterSet.NewTextColor = existingBlockColor;
} }
if (initialiseFromBlock.BlockItems.Count(b => b.GetType() == typeof(BackgroundColorBlockItem)) > 0) if (initialiseFromBlock.BlockItems.Count(b => b.GetType() == typeof(BackgroundColorBlockItem)) > 0)
{ {
_replaceColorsParameterSet.ReplaceBackgroundColor = true; _replaceColorsParameterSet.ReplaceBackgroundColor = true;
_replaceColorsParameterSet.OldBackgroundColor = var existingBlockColor = ((BackgroundColorBlockItem)
((BackgroundColorBlockItem)
initialiseFromBlock.BlockItems.First(b => b.GetType() == typeof(BackgroundColorBlockItem))).Color; initialiseFromBlock.BlockItems.First(b => b.GetType() == typeof(BackgroundColorBlockItem))).Color;
_replaceColorsParameterSet.OldBackgroundColor = existingBlockColor;
_replaceColorsParameterSet.NewBackgroundColor = existingBlockColor;
} }
if (initialiseFromBlock.BlockItems.Count(b => b.GetType() == typeof(BorderColorBlockItem)) > 0) if (initialiseFromBlock.BlockItems.Count(b => b.GetType() == typeof(BorderColorBlockItem)) > 0)
{ {
_replaceColorsParameterSet.ReplaceBorderColor = true; _replaceColorsParameterSet.ReplaceBorderColor = true;
_replaceColorsParameterSet.OldBorderColor = var existingBlockColor = ((BorderColorBlockItem)
((BorderColorBlockItem)
initialiseFromBlock.BlockItems.First(b => b.GetType() == typeof(BorderColorBlockItem))).Color; initialiseFromBlock.BlockItems.First(b => b.GetType() == typeof(BorderColorBlockItem))).Color;
_replaceColorsParameterSet.OldBorderColor = existingBlockColor;
_replaceColorsParameterSet.NewBorderColor = existingBlockColor;
} }
_lootFilterScript = lootFilterScript; _lootFilterScript = lootFilterScript;

View File

@@ -5,7 +5,7 @@
xmlns:extensions="clr-namespace:Filtration.Extensions" xmlns:extensions="clr-namespace:Filtration.Extensions"
Title="About Filtration" Title="About Filtration"
Height="360" Height="360"
Width="560" Width="580"
Loaded="AboutWindow_OnLoaded" Loaded="AboutWindow_OnLoaded"
BorderThickness="1" BorderBrush="Black"> BorderThickness="1" BorderBrush="Black">
<Grid Margin="15"> <Grid Margin="15">
@@ -29,11 +29,11 @@
<Image Source="/Filtration;component/Resources/logo.png" Width="75" Height="75" VerticalAlignment="Top" /> <Image Source="/Filtration;component/Resources/logo.png" Width="75" Height="75" VerticalAlignment="Top" />
<StackPanel Grid.Row="0" Grid.Column="1"> <StackPanel Grid.Row="0" Grid.Column="1">
<TextBlock FontWeight="Black">Filtration</TextBlock> <TextBlock FontWeight="Black">Filtration</TextBlock>
<TextBlock>Version 0.1</TextBlock> <TextBlock>Version 0.2</TextBlock>
<TextBlock>Copyright © 2015</TextBlock> <TextBlock>Copyright © 2015</TextBlock>
<TextBlock>Created by Ben Wallis</TextBlock> <TextBlock>Created by Ben Wallis</TextBlock>
<TextBlock> <TextBlock>
<Hyperlink NavigateUri="http://ben-wallis.github.io/Filtration/" extensions:HyperlinkExtensions.IsExternal="True">http://ben-wallis.github.io/Filtration/</Hyperlink> <Hyperlink NavigateUri="https://github.com/ben-wallis/Filtration/" extensions:HyperlinkExtensions.IsExternal="True">https://github.com/ben-wallis/Filtration/</Hyperlink>
<LineBreak /> <LineBreak />
</TextBlock> </TextBlock>
</StackPanel> </StackPanel>

View File

@@ -15,7 +15,7 @@
<UserControl.Resources> <UserControl.Resources>
<ResourceDictionary> <ResourceDictionary>
<ResourceDictionary.MergedDictionaries> <ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="LootFilterBlockViewDictionary.xaml" /> <ResourceDictionary Source="SharedResourcesDictionary.xaml" />
<ResourceDictionary> <ResourceDictionary>
<CollectionViewSource x:Key="AudioVisualBlockItemsViewSource" Source="{Binding AudioVisualBlockItems}"> <CollectionViewSource x:Key="AudioVisualBlockItemsViewSource" Source="{Binding AudioVisualBlockItems}">
<CollectionViewSource.SortDescriptions> <CollectionViewSource.SortDescriptions>

View File

@@ -16,7 +16,7 @@
<UserControl.Resources> <UserControl.Resources>
<ResourceDictionary> <ResourceDictionary>
<ResourceDictionary.MergedDictionaries> <ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="LootFilterBlockViewDictionary.xaml" /> <ResourceDictionary Source="SharedResourcesDictionary.xaml" />
<ResourceDictionary> <ResourceDictionary>
<views:BindingProxy x:Key="proxy" Data="{Binding}" /> <views:BindingProxy x:Key="proxy" Data="{Binding}" />
</ResourceDictionary> </ResourceDictionary>
@@ -72,39 +72,34 @@
<WrapPanel /> <WrapPanel />
</ItemsPanelTemplate> </ItemsPanelTemplate>
</ItemsControl.ItemsPanel> </ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate> <ItemsControl.Resources>
<DataTemplate> <DataTemplate DataType="{x:Type blockItemBaseTypes:BlockItemBase}">
<Border BorderBrush="Black" CornerRadius="4" Margin="0,2,2,2" BorderThickness="1" Background="{Binding SummaryBackgroundColor, Converter={StaticResource ColorToSolidColorBrushConverter}}"> <Border BorderBrush="Black" CornerRadius="4" Margin="0,2,2,2" BorderThickness="1" Background="{Binding SummaryBackgroundColor, Converter={StaticResource ColorToSolidColorBrushConverter}}">
<TextBlock Text="{Binding SummaryText}" Margin="5,1,5,1" Foreground="{Binding SummaryTextColor, Converter={StaticResource ColorToSolidColorBrushConverter}}" /> <TextBlock Text="{Binding SummaryText}" Margin="5,1,5,1" Foreground="{Binding SummaryTextColor, Converter={StaticResource ColorToSolidColorBrushConverter}}" />
</Border> </Border>
</DataTemplate> </DataTemplate>
</ItemsControl.ItemTemplate> <DataTemplate DataType="{x:Type blockItemBaseTypes:ActionBlockItem}">
<Button Command="{Binding ElementName=TopLevelGrid, Path=DataContext.ToggleBlockActionCommand}" Style="{StaticResource ChromelessButton}">
<Border BorderBrush="Black" CornerRadius="4" Margin="0,2,2,2" BorderThickness="1" Background="{Binding SummaryBackgroundColor, Converter={StaticResource ColorToSolidColorBrushConverter}}">
<TextBlock Text="{Binding SummaryText}" Margin="5,1,5,1" Foreground="{Binding SummaryTextColor, Converter={StaticResource ColorToSolidColorBrushConverter}}" />
</Border>
</Button>
</DataTemplate>
</ItemsControl.Resources>
</ItemsControl> </ItemsControl>
</StackPanel> </StackPanel>
<!-- Item Preview Box --> <!-- Item Preview Box -->
<WrapPanel Grid.Row="0" Grid.Column="1" VerticalAlignment="Center"> <WrapPanel Grid.Row="0" Grid.Column="1" VerticalAlignment="Center">
<Image Source="/Filtration;component/Resources/Icons/speaker_icon.png" VerticalAlignment="Center" HorizontalAlignment="Center" Height="15" Width="15" Margin="0,0,3,0" Visibility="{Binding HasSound, Converter={StaticResource BooleanVisibilityConverter}}" /> <Image Source="/Filtration;component/Resources/Icons/speaker_icon.png" VerticalAlignment="Center" HorizontalAlignment="Center" Height="15" Width="15" Margin="0,0,3,0" Visibility="{Binding HasSound, Converter={StaticResource BooleanVisibilityConverter}}" />
<ToggleButton Width="140" <ToggleButton Width="143"
Height="25" Height="28"
Margin="0,0,8,0" Margin="0,0,8,0"
Style="{StaticResource ChromelessToggleButton}" Style="{StaticResource ChromelessToggleButton}"
x:Name="ItemPreviewButton" x:Name="ItemPreviewButton"
IsChecked="{Binding DisplaySettingsPopupOpen, Mode=OneWayToSource}" IsChecked="{Binding DisplaySettingsPopupOpen, Mode=OneWayToSource}"
ToolTip="Click here to change color and font settings" Cursor="Hand" > ToolTip="Click here to change color and font settings" Cursor="Hand" >
<Grid> <userControls:ItemPreviewControl TextColor="{Binding DisplayTextColor}" BackgroundColor="{Binding DisplayBackgroundColor}" BorderColor="{Binding DisplayBorderColor}" />
<Image Source="pack://application:,,,/resources/groundtile.png" Stretch="Fill" />
<Border Padding="4,2,4,2" BorderThickness="2" BorderBrush="{Binding DisplayBorderColor, Converter={StaticResource ColorToSolidColorBrushConverter}}">
<Border.Background>
<SolidColorBrush Color="{Binding DisplayBackgroundColor}" />
</Border.Background>
<TextBlock TextAlignment="Center" Text="Test Item Preview" Style="{StaticResource PathOfExileFont}">
<TextBlock.Foreground>
<SolidColorBrush Color="{Binding DisplayTextColor}" />
</TextBlock.Foreground>
</TextBlock>
</Border>
</Grid>
</ToggleButton> </ToggleButton>
</WrapPanel> </WrapPanel>

View File

@@ -6,6 +6,7 @@
xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls" xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit" xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
xmlns:viewModels="clr-namespace:Filtration.ViewModels" xmlns:viewModels="clr-namespace:Filtration.ViewModels"
xmlns:userControls="clr-namespace:Filtration.UserControls"
mc:Ignorable="d" mc:Ignorable="d"
d:DataContext="{d:DesignInstance Type=viewModels:ReplaceColorsViewModel}" d:DataContext="{d:DesignInstance Type=viewModels:ReplaceColorsViewModel}"
ShowMaxRestoreButton="False" ShowMaxRestoreButton="False"
@@ -15,7 +16,7 @@
<Window.Resources> <Window.Resources>
<ResourceDictionary> <ResourceDictionary>
<ResourceDictionary.MergedDictionaries> <ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="LootFilterBlockViewDictionary.xaml" /> <ResourceDictionary Source="SharedResourcesDictionary.xaml" />
</ResourceDictionary.MergedDictionaries> </ResourceDictionary.MergedDictionaries>
</ResourceDictionary> </ResourceDictionary>
</Window.Resources> </Window.Resources>
@@ -56,20 +57,8 @@
<TextBlock Grid.Row="5" Grid.Column="2" VerticalAlignment="Center">New Border Color</TextBlock> <TextBlock Grid.Row="5" Grid.Column="2" VerticalAlignment="Center">New Border Color</TextBlock>
<xctk:ColorPicker Grid.Row="5" Grid.Column="4" SelectedColor="{Binding NewBorderColor}" /> <xctk:ColorPicker Grid.Row="5" Grid.Column="4" SelectedColor="{Binding NewBorderColor}" />
<Grid Grid.Row="6" Grid.Column="4"> <userControls:ItemPreviewControl Grid.Row="6" Grid.Column="4" TextColor="{Binding DisplayTextColor}" BackgroundColor="{Binding DisplayBackgroundColor}" BorderColor="{Binding DisplayBorderColor}" />
<Image Source="pack://application:,,,/resources/groundtile.png" Stretch="Fill" /> <TextBlock Grid.Row="6" Grid.Column="2" VerticalAlignment="Center">Preview</TextBlock>
<Border Padding="4,2,4,2" BorderThickness="2" BorderBrush="{Binding DisplayBorderColor, Converter={StaticResource ColorToSolidColorBrushConverter}}">
<Border.Background>
<SolidColorBrush Color="{Binding DisplayBackgroundColor}" />
</Border.Background>
<TextBlock TextAlignment="Center" Text="Test Item Preview" Style="{StaticResource PathOfExileFont}">
<TextBlock.Foreground>
<SolidColorBrush Color="{Binding DisplayTextColor}" />
</TextBlock.Foreground>
</TextBlock>
</Border>
</Grid>
<TextBlock Grid.Row="7" Grid.Column="2" VerticalAlignment="Center">Preview</TextBlock>
<Button Grid.Row="7" Grid.Column="4" Command="{Binding ReplaceColorsCommand}">Replace Colors</Button> <Button Grid.Row="7" Grid.Column="4" Command="{Binding ReplaceColorsCommand}">Replace Colors</Button>
</Grid> </Grid>
</controls:MetroWindow> </controls:MetroWindow>

View File

@@ -21,6 +21,17 @@
</Setter.Value> </Setter.Value>
</Setter> </Setter>
</Style> </Style>
<Style x:Key="ChromelessButton" TargetType="{x:Type Button}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border BorderThickness="0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<ContentPresenter/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<converters:IntToItemRarityConverter x:Key="IntToItemRarityConverter" /> <converters:IntToItemRarityConverter x:Key="IntToItemRarityConverter" />
<converters:StringToVisibilityConverter x:Key="StringToVisibilityConverter" /> <converters:StringToVisibilityConverter x:Key="StringToVisibilityConverter" />
<converters:BoolInverterConverter x:Key="BoolInverterConverter" /> <converters:BoolInverterConverter x:Key="BoolInverterConverter" />

38
README.md Normal file
View File

@@ -0,0 +1,38 @@
# Filtration
Filtration is an editor for Path of Exile item filter scripts.
## Current Release
<b>Installer (5.71mb)</b> <a href="https://github.com/ben-wallis/Filtration/releases/download/0.1/filtration_0.1_setup.exe">filtration_0.1_setup.exe</a>
<b>Zip File (7.01mb)</b> <a href="https://github.com/ben-wallis/Filtration/releases/download/0.1/filtration_0.1.zip">filtration_0.1.zip</a>
## System Requirements
Filtration requires .NET Framework 4.5.1 installed.
## Features
* Quick and easy editing and creation of item filter scripts - no direct editing of scripts required
* Full support for all item filter attributes
* Visual preview of colour settings
* Copy & paste filter blocks between scripts
* Section navigation via the Section Browser
* The Replace Colors tool allows you to quickly replace all instances of particular color combinations throughout a script
## Screenshots
##### Main Window
<img src="http://i.imgur.com/cGTuGKq.png" />
##### Block Editor
<img src="http://i.imgur.com/nfzhWfn.png" />
##### Block Color Editor
<img src="http://i.imgur.com/nlBGiG4.png" />
##### Replace Colors Tool
<img src="http://i.imgur.com/oY1q6hq.png" />
## Contact
You can find me on irc.freenode.net in #filtration