Compare commits
132 Commits
0.16
...
1.0.3-beta
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8073948cfe | ||
|
|
f331bffee7 | ||
|
|
f238bbf856 | ||
|
|
a0191576f0 | ||
|
|
1d96b69800 | ||
|
|
99abb276af | ||
|
|
073fe553ea | ||
|
|
0d81d0ef54 | ||
|
|
f04f9c20ed | ||
|
|
f71ba74425 | ||
|
|
04cbf218f3 | ||
|
|
6007306346 | ||
|
|
992bd21570 | ||
|
|
7d8b32b2e7 | ||
|
|
ac904c31ff | ||
|
|
f51fe315ad | ||
|
|
3ce2e12f56 | ||
|
|
43e5b30080 | ||
|
|
bc99339390 | ||
|
|
781faae85d | ||
|
|
c926808878 | ||
|
|
24d9f97717 | ||
|
|
7e4e6fe42e | ||
|
|
c6d75cfff6 | ||
|
|
2f30eade7c | ||
|
|
e719f0bce0 | ||
|
|
dffbbf3591 | ||
|
|
07a7e8d05c | ||
|
|
1ba224906c | ||
|
|
32523787d2 | ||
|
|
ac6943d73b | ||
|
|
36c0aaea17 | ||
|
|
4b38a6a4e0 | ||
|
|
9c44dd7e7d | ||
|
|
18c878e350 | ||
|
|
5d30888597 | ||
|
|
bfd722d362 | ||
|
|
d23741555a | ||
|
|
820aa5499e | ||
|
|
1ee38b4c0e | ||
|
|
4bed777427 | ||
|
|
1f6cbeec86 | ||
|
|
550a2d8f25 | ||
|
|
ae38197052 | ||
|
|
4fd4ffc520 | ||
|
|
e15efe4e15 | ||
|
|
196db4c730 | ||
|
|
910b2b8c7f | ||
|
|
b31ce1d843 | ||
|
|
99a011c78c | ||
|
|
69ce542c1a | ||
|
|
2ff9ebf242 | ||
|
|
0eff63d706 | ||
|
|
1b8f37ca3a | ||
|
|
b4f02f872e | ||
|
|
cfef82e53a | ||
|
|
bdd121f48c | ||
|
|
0209de3817 | ||
|
|
1e26a2ae3e | ||
|
|
54b72e44b0 | ||
|
|
24df1d7687 | ||
|
|
7162e16b49 | ||
|
|
324ce4d0b3 | ||
|
|
de489e8b2c | ||
|
|
341b1d1eb2 | ||
|
|
6be29dbd28 | ||
|
|
3851ad51e1 | ||
|
|
65d3e07156 | ||
|
|
a86ab3ec8d | ||
|
|
41722e8a57 | ||
|
|
3cb0a041d7 | ||
|
|
c8778bb1eb | ||
|
|
8e849d6a8f | ||
|
|
0d3f01a856 | ||
|
|
178ff579c6 | ||
|
|
30aa52e788 | ||
|
|
c1aee2f8f7 | ||
|
|
937426e9a3 | ||
|
|
7e0932830d | ||
|
|
15c63fa222 | ||
|
|
cc986eea21 | ||
|
|
c260014a16 | ||
|
|
8f0f73f185 | ||
|
|
15143f738f | ||
|
|
dc6ed934b2 | ||
|
|
78b4ddc862 | ||
|
|
a09f0a5090 | ||
|
|
2958d93b33 | ||
|
|
1e9b1158bd | ||
|
|
d92d34af05 | ||
|
|
bc5a005ee7 | ||
|
|
8ba3433dcf | ||
|
|
d0bc0b6864 | ||
|
|
1eaf0b6fe5 | ||
|
|
4c76dc9bab | ||
|
|
2a7df9a1ca | ||
|
|
add7514ce7 | ||
|
|
0974579684 | ||
|
|
c0e9c534de | ||
|
|
780081263c | ||
|
|
387f08db85 | ||
|
|
7fb9378304 | ||
|
|
e5209fb459 | ||
|
|
961805272d | ||
|
|
281c7d85e1 | ||
|
|
57775a9e22 | ||
|
|
5817295f7c | ||
|
|
216168533f | ||
|
|
f6969a0204 | ||
|
|
38053666a0 | ||
|
|
bd730dd518 | ||
|
|
2c4096ff2c | ||
|
|
738415f10a | ||
|
|
f03e37602d | ||
|
|
2230b81257 | ||
|
|
3aa2bf488c | ||
|
|
71b7a45f84 | ||
|
|
0fd2db7076 | ||
|
|
400688573c | ||
|
|
52fc1f6bbc | ||
|
|
3f437c0109 | ||
|
|
f838b35b4c | ||
|
|
ac706486cb | ||
|
|
3607ad362e | ||
|
|
1ecec4e9dc | ||
|
|
404a04c210 | ||
|
|
f1b2be7d74 | ||
|
|
6393a53bf5 | ||
|
|
a0a72b5fe8 | ||
|
|
d96234f099 | ||
|
|
07fdc2eb49 | ||
|
|
86ff670fb0 |
@@ -3,9 +3,9 @@ using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Windows.Markup;
|
||||
|
||||
namespace Filtration.Extensions
|
||||
namespace Filtration.Common.Extensions
|
||||
{
|
||||
internal class EnumerationExtension : MarkupExtension
|
||||
public class EnumerationExtension : MarkupExtension
|
||||
{
|
||||
private Type _enumType;
|
||||
|
||||
@@ -4,7 +4,7 @@ using System.Windows;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Navigation;
|
||||
|
||||
namespace Filtration.Extensions
|
||||
namespace Filtration.Common.Extensions
|
||||
{
|
||||
public static class HyperlinkExtensions
|
||||
{
|
||||
@@ -75,6 +75,8 @@
|
||||
<Compile Include="Converters\ColorToSolidColorBrushConverter.cs" />
|
||||
<Compile Include="Converters\InverseBooleanVisibilityConverter.cs" />
|
||||
<Compile Include="Converters\StringToVisibilityConverter.cs" />
|
||||
<Compile Include="Extensions\EnumerationExtension.cs" />
|
||||
<Compile Include="Extensions\HyperlinkExtensions.cs" />
|
||||
<Compile Include="Messages\ThemeClosedMessage.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Services\FileSystemService.cs" />
|
||||
|
||||
@@ -31,9 +31,24 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="GalaSoft.MvvmLight, Version=5.3.0.19026, Culture=neutral, PublicKeyToken=e7570ab207bcb616, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MvvmLightLibs.5.3.0.0\lib\net45\GalaSoft.MvvmLight.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="GalaSoft.MvvmLight.Extras, Version=5.3.0.19032, Culture=neutral, PublicKeyToken=669f0b5e8f868abf, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MvvmLightLibs.5.3.0.0\lib\net45\GalaSoft.MvvmLight.Extras.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="GalaSoft.MvvmLight.Platform, Version=5.3.0.19032, Culture=neutral, PublicKeyToken=5f873c45e98af8a1, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MvvmLightLibs.5.3.0.0\lib\net45\GalaSoft.MvvmLight.Platform.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Practices.ServiceLocation, Version=1.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\CommonServiceLocator.1.3\lib\portable-net4+sl5+netcore45+wpa81+wp8\Microsoft.Practices.ServiceLocation.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MvvmLightLibs.5.3.0.0\lib\net45\System.Windows.Interactivity.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
@@ -46,6 +61,9 @@
|
||||
<Compile Include="IEditableDocument.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
using GalaSoft.MvvmLight.CommandWpf;
|
||||
|
||||
namespace Filtration.Interface
|
||||
{
|
||||
@@ -7,5 +9,6 @@ namespace Filtration.Interface
|
||||
bool IsScript { get; }
|
||||
bool IsTheme { get; }
|
||||
Task Close();
|
||||
RelayCommand CloseCommand { get; }
|
||||
}
|
||||
}
|
||||
|
||||
5
Filtration.Interface/packages.config
Normal file
5
Filtration.Interface/packages.config
Normal file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="CommonServiceLocator" version="1.3" targetFramework="net461" />
|
||||
<package id="MvvmLightLibs" version="5.3.0.0" targetFramework="net461" />
|
||||
</packages>
|
||||
@@ -67,6 +67,7 @@ namespace Filtration.ItemFilterPreview.Tests.Services
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Ignore("Outdated item filter")]
|
||||
public void ProcessItemsAgainstItemFilterScript_IntegrationTest()
|
||||
{
|
||||
//Arrange
|
||||
@@ -102,6 +103,7 @@ namespace Filtration.ItemFilterPreview.Tests.Services
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Ignore("Outdated item filter")]
|
||||
public void ProcessItemsAgainstItemFilterScript_IntegrationTest_10Items()
|
||||
{
|
||||
//Arrange
|
||||
|
||||
@@ -66,6 +66,9 @@
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
|
||||
@@ -27,8 +27,6 @@ namespace Filtration.ObjectModel.BlockItemBaseTypes
|
||||
}
|
||||
}
|
||||
|
||||
public string Comment { get; set; }
|
||||
|
||||
public override string OutputText => Action.GetAttributeDescription();
|
||||
|
||||
public override string PrefixText => string.Empty;
|
||||
|
||||
@@ -17,6 +17,7 @@ namespace Filtration.ObjectModel.BlockItemBaseTypes
|
||||
public abstract Color SummaryBackgroundColor { get; }
|
||||
public abstract Color SummaryTextColor { get; }
|
||||
public abstract int SortOrder { get; }
|
||||
public string Comment { get; set; }
|
||||
|
||||
public bool IsDirty
|
||||
{
|
||||
|
||||
@@ -4,7 +4,7 @@ using Filtration.ObjectModel.ThemeEditor;
|
||||
|
||||
namespace Filtration.ObjectModel.BlockItemBaseTypes
|
||||
{
|
||||
public abstract class ColorBlockItem : BlockItemBase, IAudioVisualBlockItem
|
||||
public abstract class ColorBlockItem : BlockItemBase, IAudioVisualBlockItem, IBlockItemWithTheme
|
||||
{
|
||||
private Color _color;
|
||||
private ThemeComponent _themeComponent;
|
||||
@@ -19,7 +19,7 @@ namespace Filtration.ObjectModel.BlockItemBaseTypes
|
||||
}
|
||||
|
||||
public override string OutputText => PrefixText + " " + +Color.R + " " + Color.G + " "
|
||||
+ Color.B + (Color.A < 255 ? " " + Color.A : string.Empty) +
|
||||
+ Color.B + (Color.A != 240 ? " " + Color.A : string.Empty) +
|
||||
(ThemeComponent != null ? " # " + ThemeComponent.ComponentName : string.Empty);
|
||||
|
||||
public override string SummaryText => string.Empty;
|
||||
@@ -63,7 +63,7 @@ namespace Filtration.ObjectModel.BlockItemBaseTypes
|
||||
|
||||
private void OnThemeComponentUpdated(object sender, EventArgs e)
|
||||
{
|
||||
Color = ((ThemeComponent) sender).Color;
|
||||
Color = ((ColorThemeComponent) sender).Color;
|
||||
}
|
||||
|
||||
private void OnThemeComponentDeleted(object sender, EventArgs e)
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
using System;
|
||||
using System.Windows.Media;
|
||||
using Filtration.ObjectModel.ThemeEditor;
|
||||
|
||||
namespace Filtration.ObjectModel.BlockItemBaseTypes
|
||||
{
|
||||
public abstract class ColorBooleanBlockItem : BlockItemBase, IAudioVisualBlockItem
|
||||
{
|
||||
private Color _color;
|
||||
private bool _booleanValue;
|
||||
|
||||
protected ColorBooleanBlockItem()
|
||||
{
|
||||
}
|
||||
|
||||
protected ColorBooleanBlockItem(Color color, bool booleanValue)
|
||||
{
|
||||
Color = color;
|
||||
BooleanValue = booleanValue;
|
||||
}
|
||||
|
||||
public override string OutputText => PrefixText + " " + +Color.R + " " + Color.G + " "
|
||||
+ Color.B + (Color.A < 255 ? " " + Color.A : string.Empty) +
|
||||
(BooleanValue ? " True" : " False");
|
||||
|
||||
public override string SummaryText => string.Empty;
|
||||
|
||||
public override Color SummaryBackgroundColor => Colors.Transparent;
|
||||
public override Color SummaryTextColor => Colors.Transparent;
|
||||
|
||||
public Color Color
|
||||
{
|
||||
get { return _color; }
|
||||
set
|
||||
{
|
||||
_color = value;
|
||||
IsDirty = true;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public bool BooleanValue
|
||||
{
|
||||
get { return _booleanValue; }
|
||||
set
|
||||
{
|
||||
_booleanValue = value;
|
||||
IsDirty = true;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
using System;
|
||||
using System.Windows.Media;
|
||||
using Filtration.ObjectModel.Enums;
|
||||
using Filtration.ObjectModel.Extensions;
|
||||
using Filtration.ObjectModel.ThemeEditor;
|
||||
|
||||
namespace Filtration.ObjectModel.BlockItemBaseTypes
|
||||
{
|
||||
public abstract class EffectColorBlockItem : BlockItemBase, IAudioVisualBlockItem, IBlockItemWithTheme
|
||||
{
|
||||
private EffectColor _color;
|
||||
private bool _temporary;
|
||||
private ThemeComponent _themeComponent;
|
||||
|
||||
protected EffectColorBlockItem()
|
||||
{
|
||||
}
|
||||
|
||||
protected EffectColorBlockItem(EffectColor color, bool temporary)
|
||||
{
|
||||
Color = color;
|
||||
Temporary = temporary;
|
||||
}
|
||||
|
||||
public override string OutputText => PrefixText + " " + Color.GetAttributeDescription() +
|
||||
(Temporary ? " " + "Temp" : string.Empty) +
|
||||
(ThemeComponent != null ? " # " + ThemeComponent.ComponentName : string.Empty);
|
||||
|
||||
public override string SummaryText => string.Empty;
|
||||
|
||||
public ThemeComponent ThemeComponent
|
||||
{
|
||||
get { return _themeComponent; }
|
||||
set
|
||||
{
|
||||
if (_themeComponent == value) { return; }
|
||||
|
||||
if (_themeComponent != null)
|
||||
{
|
||||
_themeComponent.ThemeComponentUpdated -= OnThemeComponentUpdated;
|
||||
_themeComponent.ThemeComponentDeleted -= OnThemeComponentDeleted;
|
||||
}
|
||||
if (value != null)
|
||||
{
|
||||
value.ThemeComponentUpdated += OnThemeComponentUpdated;
|
||||
value.ThemeComponentDeleted += OnThemeComponentDeleted;
|
||||
}
|
||||
|
||||
_themeComponent = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public override Color SummaryBackgroundColor => Colors.Transparent;
|
||||
public override Color SummaryTextColor => Colors.Transparent;
|
||||
|
||||
public EffectColor Color
|
||||
{
|
||||
get { return _color; }
|
||||
set
|
||||
{
|
||||
_color = value;
|
||||
IsDirty = true;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public bool Temporary
|
||||
{
|
||||
get { return _temporary; }
|
||||
set
|
||||
{
|
||||
_temporary = value;
|
||||
IsDirty = true;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnThemeComponentUpdated(object sender, EventArgs e)
|
||||
{
|
||||
Color = ((EffectColorThemeComponent)sender).EffectColor;
|
||||
Temporary = ((EffectColorThemeComponent)sender).Temporary;
|
||||
}
|
||||
|
||||
private void OnThemeComponentDeleted(object sender, EventArgs e)
|
||||
{
|
||||
ThemeComponent = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
103
Filtration.ObjectModel/BlockItemBaseTypes/IconBlockItem.cs
Normal file
103
Filtration.ObjectModel/BlockItemBaseTypes/IconBlockItem.cs
Normal file
@@ -0,0 +1,103 @@
|
||||
using System;
|
||||
using System.Windows.Media;
|
||||
using Filtration.ObjectModel.Enums;
|
||||
using Filtration.ObjectModel.Extensions;
|
||||
using Filtration.ObjectModel.ThemeEditor;
|
||||
|
||||
namespace Filtration.ObjectModel.BlockItemBaseTypes
|
||||
{
|
||||
public abstract class IconBlockItem : BlockItemBase, IAudioVisualBlockItem, IBlockItemWithTheme
|
||||
{
|
||||
private IconSize _size;
|
||||
private IconColor _color;
|
||||
private IconShape _shape;
|
||||
private ThemeComponent _themeComponent;
|
||||
|
||||
protected IconBlockItem()
|
||||
{
|
||||
}
|
||||
|
||||
protected IconBlockItem(IconSize size, IconColor color, IconShape shape)
|
||||
{
|
||||
Size = size;
|
||||
Color = color;
|
||||
Shape = shape;
|
||||
}
|
||||
|
||||
public override string OutputText => PrefixText + " " + (int)Size + " " + Color.GetAttributeDescription() + " " + Shape.GetAttributeDescription() +
|
||||
(ThemeComponent != null ? " # " + ThemeComponent.ComponentName : string.Empty);
|
||||
|
||||
public override string SummaryText => string.Empty;
|
||||
|
||||
public ThemeComponent ThemeComponent
|
||||
{
|
||||
get { return _themeComponent; }
|
||||
set
|
||||
{
|
||||
if (_themeComponent == value) { return; }
|
||||
|
||||
if (_themeComponent != null)
|
||||
{
|
||||
_themeComponent.ThemeComponentUpdated -= OnThemeComponentUpdated;
|
||||
_themeComponent.ThemeComponentDeleted -= OnThemeComponentDeleted;
|
||||
}
|
||||
if (value != null)
|
||||
{
|
||||
value.ThemeComponentUpdated += OnThemeComponentUpdated;
|
||||
value.ThemeComponentDeleted += OnThemeComponentDeleted;
|
||||
}
|
||||
|
||||
_themeComponent = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public override Color SummaryBackgroundColor => Colors.Transparent;
|
||||
public override Color SummaryTextColor => Colors.Transparent;
|
||||
|
||||
public IconSize Size
|
||||
{
|
||||
get { return _size; }
|
||||
set
|
||||
{
|
||||
_size = value;
|
||||
IsDirty = true;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public IconColor Color
|
||||
{
|
||||
get { return _color; }
|
||||
set
|
||||
{
|
||||
_color = value;
|
||||
IsDirty = true;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public IconShape Shape
|
||||
{
|
||||
get { return _shape; }
|
||||
set
|
||||
{
|
||||
_shape = value;
|
||||
IsDirty = true;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnThemeComponentUpdated(object sender, EventArgs e)
|
||||
{
|
||||
Size = ((IconThemeComponent)sender).IconSize;
|
||||
Color = ((IconThemeComponent)sender).IconColor;
|
||||
Shape = ((IconThemeComponent)sender).IconShape;
|
||||
}
|
||||
|
||||
private void OnThemeComponentDeleted(object sender, EventArgs e)
|
||||
{
|
||||
ThemeComponent = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,13 @@
|
||||
using System.Windows.Media;
|
||||
using System;
|
||||
using System.Windows.Media;
|
||||
using Filtration.ObjectModel.ThemeEditor;
|
||||
|
||||
namespace Filtration.ObjectModel.BlockItemBaseTypes
|
||||
{
|
||||
public abstract class IntegerBlockItem : BlockItemBase, IAudioVisualBlockItem
|
||||
public abstract class IntegerBlockItem : BlockItemBase, IAudioVisualBlockItem, IBlockItemWithTheme
|
||||
{
|
||||
private int _value;
|
||||
private ThemeComponent _themeComponent;
|
||||
|
||||
protected IntegerBlockItem()
|
||||
{
|
||||
@@ -15,7 +18,7 @@ namespace Filtration.ObjectModel.BlockItemBaseTypes
|
||||
Value = value;
|
||||
}
|
||||
|
||||
public override string OutputText => PrefixText + " " + Value;
|
||||
public override string OutputText => PrefixText + " " + Value + (ThemeComponent != null ? " # " + ThemeComponent.ComponentName : string.Empty);
|
||||
|
||||
public override string SummaryText => string.Empty;
|
||||
public override Color SummaryBackgroundColor => Colors.Transparent;
|
||||
@@ -24,6 +27,29 @@ namespace Filtration.ObjectModel.BlockItemBaseTypes
|
||||
public abstract int Minimum { get; }
|
||||
public abstract int Maximum { get; }
|
||||
|
||||
public ThemeComponent ThemeComponent
|
||||
{
|
||||
get { return _themeComponent; }
|
||||
set
|
||||
{
|
||||
if (_themeComponent == value) { return; }
|
||||
|
||||
if (_themeComponent != null)
|
||||
{
|
||||
_themeComponent.ThemeComponentUpdated -= OnThemeComponentUpdated;
|
||||
_themeComponent.ThemeComponentDeleted -= OnThemeComponentDeleted;
|
||||
}
|
||||
if (value != null)
|
||||
{
|
||||
value.ThemeComponentUpdated += OnThemeComponentUpdated;
|
||||
value.ThemeComponentDeleted += OnThemeComponentDeleted;
|
||||
}
|
||||
|
||||
_themeComponent = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public int Value
|
||||
{
|
||||
get { return _value; }
|
||||
@@ -34,5 +60,15 @@ namespace Filtration.ObjectModel.BlockItemBaseTypes
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnThemeComponentUpdated(object sender, EventArgs e)
|
||||
{
|
||||
Value = ((IntegerBlockItem)sender).Value;
|
||||
}
|
||||
|
||||
private void OnThemeComponentDeleted(object sender, EventArgs e)
|
||||
{
|
||||
ThemeComponent = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
87
Filtration.ObjectModel/BlockItemBaseTypes/StrIntBlockItem.cs
Normal file
87
Filtration.ObjectModel/BlockItemBaseTypes/StrIntBlockItem.cs
Normal file
@@ -0,0 +1,87 @@
|
||||
using System;
|
||||
using System.Windows.Media;
|
||||
using Filtration.ObjectModel.ThemeEditor;
|
||||
|
||||
namespace Filtration.ObjectModel.BlockItemBaseTypes
|
||||
{
|
||||
public abstract class StrIntBlockItem : BlockItemBase, IAudioVisualBlockItem, IBlockItemWithTheme
|
||||
{
|
||||
private string _value;
|
||||
private int _secondValue;
|
||||
private ThemeComponent _themeComponent;
|
||||
|
||||
protected StrIntBlockItem()
|
||||
{
|
||||
}
|
||||
|
||||
protected StrIntBlockItem(string value, int secondValue)
|
||||
{
|
||||
Value = value;
|
||||
SecondValue = secondValue;
|
||||
Value = value;
|
||||
SecondValue = secondValue;
|
||||
}
|
||||
|
||||
public override string OutputText => PrefixText + " " + Value + " " + SecondValue + (ThemeComponent != null ? " # " + ThemeComponent.ComponentName : string.Empty);
|
||||
|
||||
public override string SummaryText => string.Empty;
|
||||
public override Color SummaryBackgroundColor => Colors.Transparent;
|
||||
public override Color SummaryTextColor => Colors.Transparent;
|
||||
|
||||
public ThemeComponent ThemeComponent
|
||||
{
|
||||
get { return _themeComponent; }
|
||||
set
|
||||
{
|
||||
if (_themeComponent == value) { return; }
|
||||
|
||||
if (_themeComponent != null)
|
||||
{
|
||||
_themeComponent.ThemeComponentUpdated -= OnThemeComponentUpdated;
|
||||
_themeComponent.ThemeComponentDeleted -= OnThemeComponentDeleted;
|
||||
}
|
||||
if (value != null)
|
||||
{
|
||||
value.ThemeComponentUpdated += OnThemeComponentUpdated;
|
||||
value.ThemeComponentDeleted += OnThemeComponentDeleted;
|
||||
}
|
||||
|
||||
_themeComponent = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public string Value
|
||||
{
|
||||
get { return _value; }
|
||||
set
|
||||
{
|
||||
_value = value;
|
||||
IsDirty = true;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public int SecondValue
|
||||
{
|
||||
get { return _secondValue; }
|
||||
set
|
||||
{
|
||||
_secondValue = value;
|
||||
IsDirty = true;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnThemeComponentUpdated(object sender, EventArgs e)
|
||||
{
|
||||
Value = ((StrIntBlockItem)sender).Value;
|
||||
SecondValue = ((StrIntBlockItem)sender).SecondValue;
|
||||
}
|
||||
|
||||
private void OnThemeComponentDeleted(object sender, EventArgs e)
|
||||
{
|
||||
ThemeComponent = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
72
Filtration.ObjectModel/BlockItemBaseTypes/StringBlockItem.cs
Normal file
72
Filtration.ObjectModel/BlockItemBaseTypes/StringBlockItem.cs
Normal file
@@ -0,0 +1,72 @@
|
||||
using System;
|
||||
using System.Windows.Media;
|
||||
using Filtration.ObjectModel.ThemeEditor;
|
||||
|
||||
namespace Filtration.ObjectModel.BlockItemBaseTypes
|
||||
{
|
||||
public abstract class StringBlockItem : BlockItemBase, IAudioVisualBlockItem, IBlockItemWithTheme
|
||||
{
|
||||
private string _value;
|
||||
private ThemeComponent _themeComponent;
|
||||
|
||||
protected StringBlockItem()
|
||||
{
|
||||
}
|
||||
|
||||
protected StringBlockItem(string value)
|
||||
{
|
||||
Value = value;
|
||||
}
|
||||
|
||||
public override string OutputText => PrefixText + " \"" + Value + "\""
|
||||
+ (ThemeComponent != null ? " # " + ThemeComponent.ComponentName : string.Empty);
|
||||
|
||||
public override string SummaryText => string.Empty;
|
||||
public override Color SummaryBackgroundColor => Colors.Transparent;
|
||||
public override Color SummaryTextColor => Colors.Transparent;
|
||||
|
||||
public ThemeComponent ThemeComponent
|
||||
{
|
||||
get { return _themeComponent; }
|
||||
set
|
||||
{
|
||||
if (_themeComponent == value) { return; }
|
||||
|
||||
if (_themeComponent != null)
|
||||
{
|
||||
_themeComponent.ThemeComponentUpdated -= OnThemeComponentUpdated;
|
||||
_themeComponent.ThemeComponentDeleted -= OnThemeComponentDeleted;
|
||||
}
|
||||
if (value != null)
|
||||
{
|
||||
value.ThemeComponentUpdated += OnThemeComponentUpdated;
|
||||
value.ThemeComponentDeleted += OnThemeComponentDeleted;
|
||||
}
|
||||
|
||||
_themeComponent = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public string Value
|
||||
{
|
||||
get { return _value; }
|
||||
set
|
||||
{
|
||||
_value = value;
|
||||
IsDirty = true;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnThemeComponentUpdated(object sender, EventArgs e)
|
||||
{
|
||||
Value = ((StringThemeComponent)sender).Value;
|
||||
}
|
||||
|
||||
private void OnThemeComponentDeleted(object sender, EventArgs e)
|
||||
{
|
||||
ThemeComponent = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace Filtration.ObjectModel.BlockItemBaseTypes
|
||||
{
|
||||
public abstract class StrIntBlockItem : BlockItemBase, IAudioVisualBlockItem
|
||||
{
|
||||
private string _value;
|
||||
private int _secondValue;
|
||||
|
||||
protected StrIntBlockItem()
|
||||
{
|
||||
}
|
||||
|
||||
protected StrIntBlockItem(string value, int secondValue)
|
||||
{
|
||||
Value = value;
|
||||
SecondValue = secondValue;
|
||||
Value = value;
|
||||
SecondValue = secondValue;
|
||||
}
|
||||
|
||||
public override string OutputText => PrefixText + " " + Value + " " + SecondValue;
|
||||
|
||||
public override string SummaryText => string.Empty;
|
||||
public override Color SummaryBackgroundColor => Colors.Transparent;
|
||||
public override Color SummaryTextColor => Colors.Transparent;
|
||||
|
||||
public string Value
|
||||
{
|
||||
get { return _value; }
|
||||
set
|
||||
{
|
||||
_value = value;
|
||||
IsDirty = true;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public int SecondValue
|
||||
{
|
||||
get { return _secondValue; }
|
||||
set
|
||||
{
|
||||
_secondValue = value;
|
||||
IsDirty = true;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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)
|
||||
@@ -16,6 +17,6 @@ namespace Filtration.ObjectModel.BlockItemTypes
|
||||
public override string PrefixText => "SetBackgroundColor";
|
||||
public override int MaximumAllowed => 1;
|
||||
public override string DisplayHeading => "Background Color";
|
||||
public override int SortOrder => 18;
|
||||
public override int SortOrder => 23;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,6 +33,6 @@ namespace Filtration.ObjectModel.BlockItemTypes
|
||||
|
||||
public override Color SummaryBackgroundColor => Colors.MediumTurquoise;
|
||||
public override Color SummaryTextColor => Colors.Black;
|
||||
public override int SortOrder => 16;
|
||||
public override int SortOrder => 20;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
@@ -16,6 +17,6 @@ namespace Filtration.ObjectModel.BlockItemTypes
|
||||
public override string PrefixText => "SetBorderColor";
|
||||
public override int MaximumAllowed => 1;
|
||||
public override string DisplayHeading => "Border Color";
|
||||
public override int SortOrder => 19;
|
||||
public override int SortOrder => 24;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,6 +33,6 @@ namespace Filtration.ObjectModel.BlockItemTypes
|
||||
|
||||
public override Color SummaryBackgroundColor => Colors.MediumSeaGreen;
|
||||
public override Color SummaryTextColor => Colors.White;
|
||||
public override int SortOrder => 15;
|
||||
public override int SortOrder => 19;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
using Filtration.ObjectModel.BlockItemBaseTypes;
|
||||
|
||||
namespace Filtration.ObjectModel.BlockItemTypes
|
||||
{
|
||||
public class CustomSoundBlockItem : StringBlockItem
|
||||
{
|
||||
public CustomSoundBlockItem()
|
||||
{
|
||||
Value = "placeholder.mp3";
|
||||
}
|
||||
|
||||
public CustomSoundBlockItem(string value) : base(value)
|
||||
{
|
||||
}
|
||||
|
||||
public override string PrefixText => "CustomAlertSound";
|
||||
public override int MaximumAllowed => 1;
|
||||
public override string DisplayHeading => "Custom Alert Sound";
|
||||
public override int SortOrder => 31;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using System.Windows.Media;
|
||||
using Filtration.ObjectModel.BlockItemBaseTypes;
|
||||
|
||||
namespace Filtration.ObjectModel.BlockItemTypes
|
||||
{
|
||||
public sealed class DisableDropSoundBlockItem : BooleanBlockItem, IAudioVisualBlockItem
|
||||
{
|
||||
public DisableDropSoundBlockItem()
|
||||
{
|
||||
}
|
||||
|
||||
public DisableDropSoundBlockItem(bool booleanValue) : base(booleanValue)
|
||||
{
|
||||
}
|
||||
|
||||
public override string PrefixText => "DisableDropSound";
|
||||
public override string DisplayHeading => "Disable Drop Sound";
|
||||
public override Color SummaryBackgroundColor => Colors.Transparent;
|
||||
public override Color SummaryTextColor => Colors.Transparent;
|
||||
public override int SortOrder => 28;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -21,7 +21,7 @@ namespace Filtration.ObjectModel.BlockItemTypes
|
||||
public override string SummaryText => "Drop Level " + FilterPredicate;
|
||||
public override Color SummaryBackgroundColor => Colors.DodgerBlue;
|
||||
public override Color SummaryTextColor => Colors.White;
|
||||
public override int SortOrder => 13;
|
||||
public override int SortOrder => 15;
|
||||
public override int Minimum => 0;
|
||||
public override int Maximum => 100;
|
||||
}
|
||||
|
||||
23
Filtration.ObjectModel/BlockItemTypes/ElderMapBlockItem.cs
Normal file
23
Filtration.ObjectModel/BlockItemTypes/ElderMapBlockItem.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using System.Windows.Media;
|
||||
using Filtration.ObjectModel.BlockItemBaseTypes;
|
||||
|
||||
namespace Filtration.ObjectModel.BlockItemTypes
|
||||
{
|
||||
public sealed class ElderMapBlockItem : BooleanBlockItem
|
||||
{
|
||||
public ElderMapBlockItem()
|
||||
{
|
||||
}
|
||||
|
||||
public ElderMapBlockItem(bool booleanValue) : base(booleanValue)
|
||||
{
|
||||
}
|
||||
|
||||
public override string PrefixText => "ElderMap";
|
||||
public override string DisplayHeading => "Elder Map";
|
||||
public override Color SummaryBackgroundColor => Colors.DarkGoldenrod;
|
||||
public override Color SummaryTextColor => Colors.White;
|
||||
public override int SortOrder => 10;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -16,7 +16,7 @@ namespace Filtration.ObjectModel.BlockItemTypes
|
||||
public override string PrefixText => "SetFontSize";
|
||||
public override int MaximumAllowed => 1;
|
||||
public override string DisplayHeading => "Font Size";
|
||||
public override int SortOrder => 20;
|
||||
public override int SortOrder => 25;
|
||||
public override int Minimum => 11;
|
||||
public override int Maximum => 45;
|
||||
}
|
||||
|
||||
28
Filtration.ObjectModel/BlockItemTypes/GemLevelBlockItem.cs
Normal file
28
Filtration.ObjectModel/BlockItemTypes/GemLevelBlockItem.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System.Windows.Media;
|
||||
using Filtration.ObjectModel.BlockItemBaseTypes;
|
||||
using Filtration.ObjectModel.Enums;
|
||||
|
||||
namespace Filtration.ObjectModel.BlockItemTypes
|
||||
{
|
||||
public class GemLevelBlockItem : NumericFilterPredicateBlockItem
|
||||
{
|
||||
public GemLevelBlockItem()
|
||||
{
|
||||
}
|
||||
|
||||
public GemLevelBlockItem(FilterPredicateOperator predicateOperator, int predicateOperand)
|
||||
: base(predicateOperator, predicateOperand)
|
||||
{
|
||||
}
|
||||
|
||||
public override string PrefixText => "GemLevel";
|
||||
public override int MaximumAllowed => 2;
|
||||
public override string DisplayHeading => "Gem Level";
|
||||
public override string SummaryText => "Gem Level " + FilterPredicate;
|
||||
public override Color SummaryBackgroundColor => Colors.DarkSlateGray;
|
||||
public override Color SummaryTextColor => Colors.White;
|
||||
public override int SortOrder => 16;
|
||||
public override int Minimum => 0;
|
||||
public override int Maximum => 21;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
using System.Linq;
|
||||
using System.Windows.Media;
|
||||
using Filtration.ObjectModel.BlockItemBaseTypes;
|
||||
|
||||
namespace Filtration.ObjectModel.BlockItemTypes
|
||||
{
|
||||
public class HasExplicitModBlockItem : StringListBlockItem
|
||||
{
|
||||
public override string PrefixText => "HasExplicitMod";
|
||||
public override int MaximumAllowed => 8;
|
||||
public override string DisplayHeading => "Has Explicit Mod";
|
||||
|
||||
public override string SummaryText
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Items.Count > 0 && Items.Count < 4)
|
||||
{
|
||||
return "Item Explicit Mods: " +
|
||||
Items.Aggregate(string.Empty, (current, i) => current + i + ", ").TrimEnd(' ').TrimEnd(',');
|
||||
}
|
||||
if (Items.Count >= 4)
|
||||
{
|
||||
var remaining = Items.Count - 3;
|
||||
return "Item Explicit Mods: " + Items.Take(3)
|
||||
.Aggregate(string.Empty, (current, i) => current + i + ", ")
|
||||
.TrimEnd(' ')
|
||||
.TrimEnd(',') + " (+" + remaining + " more)";
|
||||
}
|
||||
return "Item Explicit Mods: (none)";
|
||||
}
|
||||
}
|
||||
|
||||
public override Color SummaryBackgroundColor => Colors.MidnightBlue;
|
||||
public override Color SummaryTextColor => Colors.White;
|
||||
public override int SortOrder => 21;
|
||||
}
|
||||
}
|
||||
@@ -21,7 +21,7 @@ namespace Filtration.ObjectModel.BlockItemTypes
|
||||
public override string SummaryText => "Height " + FilterPredicate;
|
||||
public override Color SummaryBackgroundColor => Colors.LightBlue;
|
||||
public override Color SummaryTextColor => Colors.Black;
|
||||
public override int SortOrder => 10;
|
||||
public override int SortOrder => 12;
|
||||
public override int Minimum => 0;
|
||||
public override int Maximum => 6;
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace Filtration.ObjectModel.BlockItemTypes
|
||||
public override string SummaryText => "Item Level " + FilterPredicate;
|
||||
public override Color SummaryBackgroundColor => Colors.DarkSlateGray;
|
||||
public override Color SummaryTextColor => Colors.White;
|
||||
public override int SortOrder => 12;
|
||||
public override int SortOrder => 14;
|
||||
public override int Minimum => 0;
|
||||
public override int Maximum => 100;
|
||||
}
|
||||
|
||||
24
Filtration.ObjectModel/BlockItemTypes/MapIconBlockItem.cs
Normal file
24
Filtration.ObjectModel/BlockItemTypes/MapIconBlockItem.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using Filtration.ObjectModel.BlockItemBaseTypes;
|
||||
using Filtration.ObjectModel.Enums;
|
||||
|
||||
namespace Filtration.ObjectModel.BlockItemTypes
|
||||
{
|
||||
public class MapIconBlockItem : IconBlockItem
|
||||
{
|
||||
public MapIconBlockItem()
|
||||
{
|
||||
Size = IconSize.Largest;
|
||||
Color = IconColor.Red;
|
||||
Shape = IconShape.Circle;
|
||||
}
|
||||
|
||||
public MapIconBlockItem(IconSize size, IconColor iconColor, IconShape iconShape) : base(size, iconColor, iconShape)
|
||||
{
|
||||
}
|
||||
|
||||
public override string PrefixText => "MinimapIcon";
|
||||
public override int MaximumAllowed => 1;
|
||||
public override string DisplayHeading => "Minimap Icon";
|
||||
public override int SortOrder => 29;
|
||||
}
|
||||
}
|
||||
28
Filtration.ObjectModel/BlockItemTypes/MapTierBlockItem.cs
Normal file
28
Filtration.ObjectModel/BlockItemTypes/MapTierBlockItem.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System.Windows.Media;
|
||||
using Filtration.ObjectModel.BlockItemBaseTypes;
|
||||
using Filtration.ObjectModel.Enums;
|
||||
|
||||
namespace Filtration.ObjectModel.BlockItemTypes
|
||||
{
|
||||
public class MapTierBlockItem : NumericFilterPredicateBlockItem
|
||||
{
|
||||
public MapTierBlockItem()
|
||||
{
|
||||
}
|
||||
|
||||
public MapTierBlockItem(FilterPredicateOperator predicateOperator, int predicateOperand)
|
||||
: base(predicateOperator, predicateOperand)
|
||||
{
|
||||
}
|
||||
|
||||
public override string PrefixText => "MapTier";
|
||||
public override int MaximumAllowed => 2;
|
||||
public override string DisplayHeading => "Map Tier";
|
||||
public override string SummaryText => "Map Tier " + FilterPredicate;
|
||||
public override Color SummaryBackgroundColor => Colors.DarkSlateGray;
|
||||
public override Color SummaryTextColor => Colors.White;
|
||||
public override int SortOrder => 8;
|
||||
public override int Minimum => 1;
|
||||
public override int Maximum => 16;
|
||||
}
|
||||
}
|
||||
23
Filtration.ObjectModel/BlockItemTypes/PlayEffectBlockItem.cs
Normal file
23
Filtration.ObjectModel/BlockItemTypes/PlayEffectBlockItem.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using Filtration.ObjectModel.BlockItemBaseTypes;
|
||||
using Filtration.ObjectModel.Enums;
|
||||
|
||||
namespace Filtration.ObjectModel.BlockItemTypes
|
||||
{
|
||||
public class PlayEffectBlockItem : EffectColorBlockItem
|
||||
{
|
||||
public PlayEffectBlockItem()
|
||||
{
|
||||
Color = EffectColor.Red;
|
||||
Temporary = false;
|
||||
}
|
||||
|
||||
public PlayEffectBlockItem(EffectColor effectColor, bool temporary) : base(effectColor, temporary)
|
||||
{
|
||||
}
|
||||
|
||||
public override string PrefixText => "PlayEffect";
|
||||
public override int MaximumAllowed => 1;
|
||||
public override string DisplayHeading => "Play Effect";
|
||||
public override int SortOrder => 30;
|
||||
}
|
||||
}
|
||||
@@ -17,6 +17,6 @@ namespace Filtration.ObjectModel.BlockItemTypes
|
||||
public override string PrefixText => "PlayAlertSoundPositional";
|
||||
public override int MaximumAllowed => 1;
|
||||
public override string DisplayHeading => "Play Positional Alert Sound";
|
||||
public override int SortOrder => 22;
|
||||
public override int SortOrder => 27;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,6 @@ namespace Filtration.ObjectModel.BlockItemTypes
|
||||
public override Color SummaryTextColor => Colors.White;
|
||||
public override int SortOrder => 3;
|
||||
public override int Minimum => 0;
|
||||
public override int Maximum => 20;
|
||||
public override int Maximum => 30;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace Filtration.ObjectModel.BlockItemTypes
|
||||
((ItemRarity) FilterPredicate.PredicateOperand).GetAttributeDescription();
|
||||
public override Color SummaryBackgroundColor => Colors.LightCoral;
|
||||
public override Color SummaryTextColor => Colors.White;
|
||||
public override int SortOrder => 14;
|
||||
public override int SortOrder => 18;
|
||||
public override int Minimum => 0;
|
||||
public override int Maximum => (int)ItemRarity.Unique;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace Filtration.ObjectModel.BlockItemTypes
|
||||
public override string DisplayHeading => "Shaped Map";
|
||||
public override Color SummaryBackgroundColor => Colors.DarkGoldenrod;
|
||||
public override Color SummaryTextColor => Colors.White;
|
||||
public override int SortOrder => 8;
|
||||
public override int SortOrder => 9;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace Filtration.ObjectModel.BlockItemTypes
|
||||
|
||||
public override Color SummaryBackgroundColor => Colors.GhostWhite;
|
||||
public override Color SummaryTextColor => Colors.Black;
|
||||
public override int SortOrder => 9;
|
||||
public override int SortOrder => 11;
|
||||
|
||||
private SocketColor StringToSocketColor(char socketColorString)
|
||||
{
|
||||
|
||||
@@ -17,6 +17,6 @@ namespace Filtration.ObjectModel.BlockItemTypes
|
||||
public override string PrefixText => "PlayAlertSound";
|
||||
public override int MaximumAllowed => 1;
|
||||
public override string DisplayHeading => "Play Alert Sound";
|
||||
public override int SortOrder => 21;
|
||||
public override int SortOrder => 26;
|
||||
}
|
||||
}
|
||||
|
||||
28
Filtration.ObjectModel/BlockItemTypes/StackSizeBlockItem.cs
Normal file
28
Filtration.ObjectModel/BlockItemTypes/StackSizeBlockItem.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System.Windows.Media;
|
||||
using Filtration.ObjectModel.BlockItemBaseTypes;
|
||||
using Filtration.ObjectModel.Enums;
|
||||
|
||||
namespace Filtration.ObjectModel.BlockItemTypes
|
||||
{
|
||||
public class StackSizeBlockItem : NumericFilterPredicateBlockItem
|
||||
{
|
||||
public StackSizeBlockItem()
|
||||
{
|
||||
}
|
||||
|
||||
public StackSizeBlockItem(FilterPredicateOperator predicateOperator, int predicateOperand)
|
||||
: base(predicateOperator, predicateOperand)
|
||||
{
|
||||
}
|
||||
|
||||
public override string PrefixText => "StackSize";
|
||||
public override int MaximumAllowed => 2;
|
||||
public override string DisplayHeading => "Stack Size";
|
||||
public override string SummaryText => "Stack Size " + FilterPredicate;
|
||||
public override Color SummaryBackgroundColor => Colors.DarkSlateGray;
|
||||
public override Color SummaryTextColor => Colors.White;
|
||||
public override int SortOrder => 17;
|
||||
public override int Minimum => 0;
|
||||
public override int Maximum => 1000;
|
||||
}
|
||||
}
|
||||
@@ -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)
|
||||
@@ -16,6 +18,6 @@ namespace Filtration.ObjectModel.BlockItemTypes
|
||||
public override string PrefixText => "SetTextColor";
|
||||
public override int MaximumAllowed => 1;
|
||||
public override string DisplayHeading => "Text Color";
|
||||
public override int SortOrder => 17;
|
||||
public override int SortOrder => 22;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace Filtration.ObjectModel.BlockItemTypes
|
||||
public override string SummaryText => "Width " + FilterPredicate;
|
||||
public override Color SummaryBackgroundColor => Colors.MediumPurple;
|
||||
public override Color SummaryTextColor => Colors.White;
|
||||
public override int SortOrder => 11;
|
||||
public override int SortOrder => 13;
|
||||
public override int Minimum => 0;
|
||||
public override int Maximum => 2;
|
||||
}
|
||||
|
||||
@@ -15,7 +15,10 @@ namespace Filtration.ObjectModel.Commands.ItemFilterScript
|
||||
}
|
||||
public void Execute()
|
||||
{
|
||||
_newItemFilterBlock = new ItemFilterCommentBlock(_itemFilterScript);
|
||||
_newItemFilterBlock = new ItemFilterCommentBlock(_itemFilterScript)
|
||||
{
|
||||
Comment = string.Empty
|
||||
};
|
||||
if (_addAfterItemFilterBlock != null)
|
||||
{
|
||||
_itemFilterScript.ItemFilterBlocks.Insert(_itemFilterScript.ItemFilterBlocks.IndexOf(_addAfterItemFilterBlock) + 1, _newItemFilterBlock);
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace Filtration.ObjectModel.Commands.ItemFilterScript
|
||||
{
|
||||
public class MoveBlockDownCommand : IUndoableCommand
|
||||
{
|
||||
private readonly IItemFilterScript _itemFilterScript;
|
||||
private readonly IItemFilterBlockBase _blockToMove;
|
||||
private int _indexMovedFrom;
|
||||
|
||||
public MoveBlockDownCommand(IItemFilterScript itemFilterScript, IItemFilterBlockBase blockToMove)
|
||||
{
|
||||
_itemFilterScript = itemFilterScript;
|
||||
_blockToMove = blockToMove;
|
||||
}
|
||||
|
||||
public void Execute()
|
||||
{
|
||||
_indexMovedFrom = _itemFilterScript.ItemFilterBlocks.IndexOf(_blockToMove);
|
||||
|
||||
if (_indexMovedFrom >= _itemFilterScript.ItemFilterBlocks.Count)
|
||||
{
|
||||
throw new InvalidOperationException("Cannot move the bottom block down");
|
||||
}
|
||||
|
||||
_itemFilterScript.ItemFilterBlocks.Remove(_blockToMove);
|
||||
_itemFilterScript.ItemFilterBlocks.Insert(_indexMovedFrom + 1, _blockToMove);
|
||||
|
||||
}
|
||||
|
||||
public void Undo()
|
||||
{
|
||||
_itemFilterScript.ItemFilterBlocks.Remove(_blockToMove);
|
||||
_itemFilterScript.ItemFilterBlocks.Insert(_indexMovedFrom, _blockToMove);
|
||||
}
|
||||
|
||||
public void Redo() => Execute();
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
namespace Filtration.ObjectModel.Commands.ItemFilterScript
|
||||
{
|
||||
public class MoveBlockToBottomCommand : IUndoableCommand
|
||||
{
|
||||
private readonly IItemFilterScript _itemFilterScript;
|
||||
private readonly IItemFilterBlockBase _blockToMove;
|
||||
private int _indexMovedFrom;
|
||||
|
||||
public MoveBlockToBottomCommand(IItemFilterScript itemFilterScript, IItemFilterBlockBase blockToMove)
|
||||
{
|
||||
_itemFilterScript = itemFilterScript;
|
||||
_blockToMove = blockToMove;
|
||||
}
|
||||
public void Execute()
|
||||
{
|
||||
_indexMovedFrom = _itemFilterScript.ItemFilterBlocks.IndexOf(_blockToMove);
|
||||
|
||||
_itemFilterScript.ItemFilterBlocks.Remove(_blockToMove);
|
||||
_itemFilterScript.ItemFilterBlocks.Add(_blockToMove);
|
||||
}
|
||||
|
||||
public void Undo()
|
||||
{
|
||||
_itemFilterScript.ItemFilterBlocks.Remove(_blockToMove);
|
||||
_itemFilterScript.ItemFilterBlocks.Insert(_indexMovedFrom, _blockToMove);
|
||||
}
|
||||
|
||||
public void Redo() => Execute();
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
namespace Filtration.ObjectModel.Commands.ItemFilterScript
|
||||
{
|
||||
public class MoveBlockToTopCommand : IUndoableCommand
|
||||
{
|
||||
private readonly IItemFilterScript _itemFilterScript;
|
||||
private readonly IItemFilterBlockBase _blockToMove;
|
||||
private int _indexMovedFrom;
|
||||
|
||||
public MoveBlockToTopCommand(IItemFilterScript itemFilterScript, IItemFilterBlockBase blockToMove)
|
||||
{
|
||||
_itemFilterScript = itemFilterScript;
|
||||
_blockToMove = blockToMove;
|
||||
}
|
||||
public void Execute()
|
||||
{
|
||||
_indexMovedFrom = _itemFilterScript.ItemFilterBlocks.IndexOf(_blockToMove);
|
||||
|
||||
_itemFilterScript.ItemFilterBlocks.Remove(_blockToMove);
|
||||
_itemFilterScript.ItemFilterBlocks.Insert(0, _blockToMove);
|
||||
}
|
||||
|
||||
public void Undo()
|
||||
{
|
||||
_itemFilterScript.ItemFilterBlocks.Remove(_blockToMove);
|
||||
_itemFilterScript.ItemFilterBlocks.Insert(_indexMovedFrom, _blockToMove);
|
||||
}
|
||||
|
||||
public void Redo() => Execute();
|
||||
}
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace Filtration.ObjectModel.Commands.ItemFilterScript
|
||||
{
|
||||
public class MoveBlockUpCommand : IUndoableCommand
|
||||
{
|
||||
private readonly IItemFilterScript _itemFilterScript;
|
||||
private readonly IItemFilterBlockBase _blockToMove;
|
||||
private int _indexMovedFrom;
|
||||
|
||||
public MoveBlockUpCommand(IItemFilterScript itemFilterScript, IItemFilterBlockBase blockToMove)
|
||||
{
|
||||
_itemFilterScript = itemFilterScript;
|
||||
_blockToMove = blockToMove;
|
||||
}
|
||||
|
||||
public void Execute()
|
||||
{
|
||||
_indexMovedFrom = _itemFilterScript.ItemFilterBlocks.IndexOf(_blockToMove);
|
||||
|
||||
if (_indexMovedFrom <= 0)
|
||||
{
|
||||
throw new InvalidOperationException("Cannot move the top block up");
|
||||
}
|
||||
|
||||
_itemFilterScript.ItemFilterBlocks.Remove(_blockToMove);
|
||||
_itemFilterScript.ItemFilterBlocks.Insert(_indexMovedFrom-1, _blockToMove);
|
||||
|
||||
}
|
||||
|
||||
public void Undo()
|
||||
{
|
||||
_itemFilterScript.ItemFilterBlocks.Remove(_blockToMove);
|
||||
_itemFilterScript.ItemFilterBlocks.Insert(_indexMovedFrom, _blockToMove);
|
||||
}
|
||||
|
||||
public void Redo() => Execute();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Filtration.ObjectModel.Commands.ItemFilterScript
|
||||
{
|
||||
public class MoveBlocksToBottomCommand : IUndoableCommand
|
||||
{
|
||||
private readonly IItemFilterScript _itemFilterScript;
|
||||
private readonly List<int> _sourceIndexes;
|
||||
|
||||
public MoveBlocksToBottomCommand(IItemFilterScript itemFilterScript, IItemFilterBlockBase block)
|
||||
{
|
||||
_itemFilterScript = itemFilterScript;
|
||||
_sourceIndexes = new List<int> { _itemFilterScript.ItemFilterBlocks.IndexOf(block) };
|
||||
}
|
||||
|
||||
public MoveBlocksToBottomCommand(IItemFilterScript itemFilterScript, List<int> sourceIndexes)
|
||||
{
|
||||
_itemFilterScript = itemFilterScript;
|
||||
_sourceIndexes = sourceIndexes;
|
||||
_sourceIndexes.Sort();
|
||||
}
|
||||
|
||||
public void Execute()
|
||||
{
|
||||
List<IItemFilterBlockBase> blocksToMove = new List<IItemFilterBlockBase>();
|
||||
for (var i = 0; i < _sourceIndexes.Count; i++)
|
||||
{
|
||||
blocksToMove.Add(_itemFilterScript.ItemFilterBlocks[_sourceIndexes[i]]);
|
||||
}
|
||||
|
||||
for (var i = _sourceIndexes.Count - 1; i >= 0; i--)
|
||||
{
|
||||
_itemFilterScript.ItemFilterBlocks.RemoveAt(_sourceIndexes[i]);
|
||||
}
|
||||
|
||||
foreach (var block in blocksToMove)
|
||||
{
|
||||
_itemFilterScript.ItemFilterBlocks.Add(block);
|
||||
}
|
||||
}
|
||||
|
||||
public void Undo()
|
||||
{
|
||||
List<IItemFilterBlockBase> blocksToMove = new List<IItemFilterBlockBase>();
|
||||
for (var i = 0; i < _sourceIndexes.Count; i++)
|
||||
{
|
||||
var movedIndex = _itemFilterScript.ItemFilterBlocks.Count - _sourceIndexes.Count;
|
||||
blocksToMove.Add(_itemFilterScript.ItemFilterBlocks[movedIndex]);
|
||||
_itemFilterScript.ItemFilterBlocks.RemoveAt(movedIndex);
|
||||
}
|
||||
|
||||
for (var i = 0; i < _sourceIndexes.Count; i++)
|
||||
{
|
||||
_itemFilterScript.ItemFilterBlocks.Insert(_sourceIndexes[i], blocksToMove[i]);
|
||||
}
|
||||
}
|
||||
|
||||
public void Redo() => Execute();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Filtration.ObjectModel.Commands.ItemFilterScript
|
||||
{
|
||||
public class MoveBlocksToIndexCommand : IUndoableCommand
|
||||
{
|
||||
private readonly IItemFilterScript _itemFilterScript;
|
||||
private List<int> _sourceIndexes;
|
||||
private int _targetIndex;
|
||||
|
||||
public MoveBlocksToIndexCommand(IItemFilterScript itemFilterScript, IItemFilterBlockBase block, int targetIndex)
|
||||
{
|
||||
_itemFilterScript = itemFilterScript;
|
||||
_sourceIndexes = new List<int> { _itemFilterScript.ItemFilterBlocks.IndexOf(block) };
|
||||
_targetIndex = targetIndex;
|
||||
}
|
||||
|
||||
public MoveBlocksToIndexCommand(IItemFilterScript itemFilterScript, List<int> sourceIndexes, int targetIndex)
|
||||
{
|
||||
_itemFilterScript = itemFilterScript;
|
||||
_sourceIndexes = sourceIndexes;
|
||||
_sourceIndexes.Sort();
|
||||
_targetIndex = targetIndex;
|
||||
}
|
||||
|
||||
public void Execute()
|
||||
{
|
||||
List<IItemFilterBlockBase> blocksToMove = new List<IItemFilterBlockBase>();
|
||||
for (var i = 0; i < _sourceIndexes.Count; i++)
|
||||
{
|
||||
blocksToMove.Add(_itemFilterScript.ItemFilterBlocks[_sourceIndexes[i]]);
|
||||
}
|
||||
|
||||
for (var i = _sourceIndexes.Count - 1; i >= 0; i--)
|
||||
{
|
||||
_itemFilterScript.ItemFilterBlocks.RemoveAt(_sourceIndexes[i]);
|
||||
}
|
||||
|
||||
for (var i = 0; i < blocksToMove.Count; i++)
|
||||
{
|
||||
_itemFilterScript.ItemFilterBlocks.Insert(_targetIndex + i, blocksToMove[i]);
|
||||
}
|
||||
}
|
||||
|
||||
public void Undo()
|
||||
{
|
||||
List<IItemFilterBlockBase> blocksToMove = new List<IItemFilterBlockBase>();
|
||||
for (var i = 0; i < _sourceIndexes.Count; i++)
|
||||
{
|
||||
blocksToMove.Add(_itemFilterScript.ItemFilterBlocks[_targetIndex]);
|
||||
_itemFilterScript.ItemFilterBlocks.RemoveAt(_targetIndex);
|
||||
}
|
||||
|
||||
for (var i = 0; i < _sourceIndexes.Count; i++)
|
||||
{
|
||||
_itemFilterScript.ItemFilterBlocks.Insert(_sourceIndexes[i], blocksToMove[i]);
|
||||
}
|
||||
}
|
||||
|
||||
public void Redo() => Execute();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Filtration.ObjectModel.Commands.ItemFilterScript
|
||||
{
|
||||
public class MoveBlocksToTopCommand : IUndoableCommand
|
||||
{
|
||||
private readonly IItemFilterScript _itemFilterScript;
|
||||
private readonly List<int> _sourceIndexes;
|
||||
|
||||
public MoveBlocksToTopCommand(IItemFilterScript itemFilterScript, IItemFilterBlockBase block)
|
||||
{
|
||||
_itemFilterScript = itemFilterScript;
|
||||
_sourceIndexes = new List<int> { _itemFilterScript.ItemFilterBlocks.IndexOf(block) };
|
||||
}
|
||||
|
||||
public MoveBlocksToTopCommand(IItemFilterScript itemFilterScript, List<int> sourceIndexes)
|
||||
{
|
||||
_itemFilterScript = itemFilterScript;
|
||||
_sourceIndexes = sourceIndexes;
|
||||
_sourceIndexes.Sort();
|
||||
}
|
||||
|
||||
public void Execute()
|
||||
{
|
||||
List<IItemFilterBlockBase> blocksToMove = new List<IItemFilterBlockBase>();
|
||||
for (var i = 0; i < _sourceIndexes.Count; i++)
|
||||
{
|
||||
blocksToMove.Add(_itemFilterScript.ItemFilterBlocks[_sourceIndexes[i]]);
|
||||
}
|
||||
|
||||
for (var i = _sourceIndexes.Count - 1; i >= 0; i--)
|
||||
{
|
||||
_itemFilterScript.ItemFilterBlocks.RemoveAt(_sourceIndexes[i]);
|
||||
}
|
||||
|
||||
for (var i = 0; i < _sourceIndexes.Count; i++)
|
||||
{
|
||||
_itemFilterScript.ItemFilterBlocks.Insert(i, blocksToMove[i]);
|
||||
}
|
||||
}
|
||||
|
||||
public void Undo()
|
||||
{
|
||||
List<IItemFilterBlockBase> blocksToMove = new List<IItemFilterBlockBase>();
|
||||
for (var i = 0; i < _sourceIndexes.Count; i++)
|
||||
{
|
||||
blocksToMove.Add(_itemFilterScript.ItemFilterBlocks[0]);
|
||||
_itemFilterScript.ItemFilterBlocks.RemoveAt(0);
|
||||
}
|
||||
|
||||
for (var i = 0; i < _sourceIndexes.Count; i++)
|
||||
{
|
||||
_itemFilterScript.ItemFilterBlocks.Insert(_sourceIndexes[i], blocksToMove[i]);
|
||||
}
|
||||
}
|
||||
|
||||
public void Redo() => Execute();
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace Filtration.ObjectModel.Commands.ItemFilterScript
|
||||
{
|
||||
public class PasteBlockCommand : IUndoableCommand
|
||||
{
|
||||
private readonly IItemFilterScript _itemFilterScript;
|
||||
private readonly IItemFilterBlockBase _pastedItemFilterBlock;
|
||||
private readonly IItemFilterBlockBase _addAfterItemFilterBlock;
|
||||
|
||||
public PasteBlockCommand(IItemFilterScript itemFilterScript, IItemFilterBlockBase pastedItemFilterBlock, IItemFilterBlockBase addAfterItemFilterBlock)
|
||||
{
|
||||
_itemFilterScript = itemFilterScript;
|
||||
_pastedItemFilterBlock = pastedItemFilterBlock;
|
||||
_addAfterItemFilterBlock = addAfterItemFilterBlock;
|
||||
}
|
||||
|
||||
public void Execute()
|
||||
{
|
||||
if (_addAfterItemFilterBlock != null)
|
||||
{
|
||||
_itemFilterScript.ItemFilterBlocks.Insert(_itemFilterScript.ItemFilterBlocks.IndexOf(_addAfterItemFilterBlock) + 1, _pastedItemFilterBlock);
|
||||
}
|
||||
else
|
||||
{
|
||||
_itemFilterScript.ItemFilterBlocks.Add(_pastedItemFilterBlock);
|
||||
}
|
||||
}
|
||||
|
||||
public void Undo()
|
||||
{
|
||||
_itemFilterScript.ItemFilterBlocks.Remove(_pastedItemFilterBlock);
|
||||
}
|
||||
|
||||
public void Redo() => Execute();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Filtration.ObjectModel.Commands.ItemFilterScript
|
||||
{
|
||||
public class PasteBlocksCommand : IUndoableCommand
|
||||
{
|
||||
private readonly IItemFilterScript _itemFilterScript;
|
||||
private readonly List<IItemFilterBlockBase> _pastedItemFilterBlocks;
|
||||
private readonly IItemFilterBlockBase _addAfterItemFilterBlock;
|
||||
|
||||
public PasteBlocksCommand(IItemFilterScript itemFilterScript, IItemFilterBlockBase block, IItemFilterBlockBase addAfterItemFilterBlock)
|
||||
{
|
||||
_itemFilterScript = itemFilterScript;
|
||||
_pastedItemFilterBlocks = new List<IItemFilterBlockBase> { block };
|
||||
_addAfterItemFilterBlock = addAfterItemFilterBlock;
|
||||
}
|
||||
|
||||
public PasteBlocksCommand(IItemFilterScript itemFilterScript, List<IItemFilterBlockBase> pastedItemFilterBlocks, IItemFilterBlockBase addAfterItemFilterBlock)
|
||||
{
|
||||
_itemFilterScript = itemFilterScript;
|
||||
_pastedItemFilterBlocks = pastedItemFilterBlocks;
|
||||
_addAfterItemFilterBlock = addAfterItemFilterBlock;
|
||||
}
|
||||
|
||||
public void Execute()
|
||||
{
|
||||
if (_addAfterItemFilterBlock != null)
|
||||
{
|
||||
var lastAddedBlock = _addAfterItemFilterBlock;
|
||||
foreach (var block in _pastedItemFilterBlocks)
|
||||
{
|
||||
_itemFilterScript.ItemFilterBlocks.Insert(_itemFilterScript.ItemFilterBlocks.IndexOf(lastAddedBlock) + 1, block);
|
||||
lastAddedBlock = block;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var block in _pastedItemFilterBlocks)
|
||||
{
|
||||
_itemFilterScript.ItemFilterBlocks.Add(block);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Undo()
|
||||
{
|
||||
foreach (var block in _pastedItemFilterBlocks)
|
||||
{
|
||||
_itemFilterScript.ItemFilterBlocks.Remove(block);
|
||||
}
|
||||
}
|
||||
|
||||
public void Redo() => Execute();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Filtration.ObjectModel.Commands.ItemFilterScript
|
||||
{
|
||||
public class PasteSectionCommand : IUndoableCommand
|
||||
{
|
||||
private readonly IItemFilterScript _itemFilterScript;
|
||||
private readonly List<IItemFilterBlockBase> _pastedItemFilterBlocks;
|
||||
private readonly IItemFilterBlockBase _addAfterItemFilterBlock;
|
||||
|
||||
public PasteSectionCommand(IItemFilterScript itemFilterScript, List<IItemFilterBlockBase> pastedItemFilterBlocks, IItemFilterBlockBase addAfterItemFilterBlock)
|
||||
{
|
||||
_itemFilterScript = itemFilterScript;
|
||||
_pastedItemFilterBlocks = pastedItemFilterBlocks;
|
||||
_addAfterItemFilterBlock = addAfterItemFilterBlock;
|
||||
}
|
||||
|
||||
public void Execute()
|
||||
{
|
||||
if (_addAfterItemFilterBlock != null)
|
||||
{
|
||||
var lastAddedBlock = _addAfterItemFilterBlock;
|
||||
foreach(var block in _pastedItemFilterBlocks)
|
||||
{
|
||||
_itemFilterScript.ItemFilterBlocks.Insert(_itemFilterScript.ItemFilterBlocks.IndexOf(lastAddedBlock) + 1, block);
|
||||
lastAddedBlock = block;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var block in _pastedItemFilterBlocks)
|
||||
{
|
||||
_itemFilterScript.ItemFilterBlocks.Add(block);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Undo()
|
||||
{
|
||||
foreach (var block in _pastedItemFilterBlocks)
|
||||
{
|
||||
_itemFilterScript.ItemFilterBlocks.Remove(block);
|
||||
}
|
||||
}
|
||||
|
||||
public void Redo() => Execute();
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace Filtration.ObjectModel.Commands.ItemFilterScript
|
||||
{
|
||||
public class RemoveBlockCommand : IUndoableCommand
|
||||
{
|
||||
private readonly IItemFilterScript _itemFilterScript;
|
||||
private IItemFilterBlockBase _removedItemFilterBlock;
|
||||
private int _indexRemovedFrom;
|
||||
|
||||
public RemoveBlockCommand(IItemFilterScript itemFilterScript, IItemFilterBlockBase itemFilterBlockBase)
|
||||
{
|
||||
_itemFilterScript = itemFilterScript;
|
||||
_removedItemFilterBlock = itemFilterBlockBase;
|
||||
}
|
||||
public void Execute()
|
||||
{
|
||||
_indexRemovedFrom = _itemFilterScript.ItemFilterBlocks.IndexOf(_removedItemFilterBlock);
|
||||
_itemFilterScript.ItemFilterBlocks.Remove(_removedItemFilterBlock);
|
||||
}
|
||||
|
||||
public void Undo()
|
||||
{
|
||||
_itemFilterScript.ItemFilterBlocks.Insert(_indexRemovedFrom, _removedItemFilterBlock);
|
||||
}
|
||||
|
||||
public void Redo() => Execute();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Filtration.ObjectModel.Commands.ItemFilterScript
|
||||
{
|
||||
public class RemoveBlocksCommand : IUndoableCommand
|
||||
{
|
||||
private readonly IItemFilterScript _itemFilterScript;
|
||||
private List<IItemFilterBlockBase> _removedItemFilterBlocks;
|
||||
private List<int> _sourceIndexes;
|
||||
|
||||
public RemoveBlocksCommand(IItemFilterScript itemFilterScript, IItemFilterBlockBase block)
|
||||
{
|
||||
_itemFilterScript = itemFilterScript;
|
||||
_sourceIndexes = new List<int> { _itemFilterScript.ItemFilterBlocks.IndexOf(block) };
|
||||
_removedItemFilterBlocks = new List<IItemFilterBlockBase> { block };
|
||||
}
|
||||
|
||||
public RemoveBlocksCommand(IItemFilterScript itemFilterScript, List<int> sourceIndexes)
|
||||
{
|
||||
_itemFilterScript = itemFilterScript;
|
||||
_sourceIndexes = sourceIndexes;
|
||||
_sourceIndexes.Sort();
|
||||
_removedItemFilterBlocks = new List<IItemFilterBlockBase>();
|
||||
for (var i = 0; i < _sourceIndexes.Count; i++)
|
||||
{
|
||||
_removedItemFilterBlocks.Add(_itemFilterScript.ItemFilterBlocks[_sourceIndexes[i]]);
|
||||
}
|
||||
}
|
||||
|
||||
public void Execute()
|
||||
{
|
||||
for (var i = _sourceIndexes.Count - 1; i >= 0; i--)
|
||||
{
|
||||
_itemFilterScript.ItemFilterBlocks.RemoveAt(_sourceIndexes[i]);
|
||||
}
|
||||
}
|
||||
|
||||
public void Undo()
|
||||
{
|
||||
for (var i = 0; i < _sourceIndexes.Count; i++)
|
||||
{
|
||||
_itemFilterScript.ItemFilterBlocks.Insert(_sourceIndexes[i], _removedItemFilterBlocks[i]);
|
||||
}
|
||||
}
|
||||
|
||||
public void Redo() => Execute();
|
||||
}
|
||||
}
|
||||
20
Filtration.ObjectModel/Enums/EffectColor.cs
Normal file
20
Filtration.ObjectModel/Enums/EffectColor.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace Filtration.ObjectModel.Enums
|
||||
{
|
||||
public enum EffectColor
|
||||
{
|
||||
[Description("Red")]
|
||||
Red,
|
||||
[Description("Green")]
|
||||
Green,
|
||||
[Description("Blue")]
|
||||
Blue,
|
||||
[Description("Brown")]
|
||||
Brown,
|
||||
[Description("White")]
|
||||
White,
|
||||
[Description("Yellow")]
|
||||
Yellow
|
||||
}
|
||||
}
|
||||
26
Filtration.ObjectModel/Enums/IconColor.cs
Normal file
26
Filtration.ObjectModel/Enums/IconColor.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace Filtration.ObjectModel.Enums
|
||||
{
|
||||
/// <summary>
|
||||
/// Each of the colors supported by the MinimapIcon block rule.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The ordering here should match the ordering of the colors within the source image.
|
||||
/// </remarks>
|
||||
public enum IconColor
|
||||
{
|
||||
[Description("Blue")]
|
||||
Blue,
|
||||
[Description("Green")]
|
||||
Green,
|
||||
[Description("Brown")]
|
||||
Brown,
|
||||
[Description("Red")]
|
||||
Red,
|
||||
[Description("White")]
|
||||
White,
|
||||
[Description("Yellow")]
|
||||
Yellow
|
||||
}
|
||||
}
|
||||
26
Filtration.ObjectModel/Enums/IconShape.cs
Normal file
26
Filtration.ObjectModel/Enums/IconShape.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace Filtration.ObjectModel.Enums
|
||||
{
|
||||
/// <summary>
|
||||
/// Each of the shapes supported by the MinimapIcon block rule.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The ordering here should match the ordering of the shapes within the source image.
|
||||
/// </remarks>
|
||||
public enum IconShape
|
||||
{
|
||||
[Description("Circle")]
|
||||
Circle,
|
||||
[Description("Diamond")]
|
||||
Diamond,
|
||||
[Description("Hexagon")]
|
||||
Hexagon,
|
||||
[Description("Square")]
|
||||
Square,
|
||||
[Description("Star")]
|
||||
Star,
|
||||
[Description("Triangle")]
|
||||
Triangle
|
||||
}
|
||||
}
|
||||
20
Filtration.ObjectModel/Enums/IconSize.cs
Normal file
20
Filtration.ObjectModel/Enums/IconSize.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace Filtration.ObjectModel.Enums
|
||||
{
|
||||
/// <summary>
|
||||
/// Each of the sizes supported by the MinimapIcon block rule.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The ordering here should match the ordering of the sizes within the source image.
|
||||
/// </remarks>
|
||||
public enum IconSize
|
||||
{
|
||||
[Description("Largest")]
|
||||
Largest,
|
||||
[Description("Medium")]
|
||||
Medium,
|
||||
[Description("Small")]
|
||||
Small
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,16 @@ namespace Filtration.ObjectModel.Enums
|
||||
[Description("Background")]
|
||||
BackgroundColor,
|
||||
[Description("Border")]
|
||||
BorderColor
|
||||
BorderColor,
|
||||
[Description("Font Size")]
|
||||
FontSize,
|
||||
[Description("Alert Sound")]
|
||||
AlertSound,
|
||||
[Description("Custom Sound")]
|
||||
CustomSound,
|
||||
[Description("Icon")]
|
||||
Icon,
|
||||
[Description("Effect")]
|
||||
Effect
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,8 +24,8 @@ namespace Filtration.ObjectModel
|
||||
ItemFilterBlock = itemFilterBlock;
|
||||
|
||||
BlockAction = itemFilterBlock?.Action ?? BlockAction.Show;
|
||||
BackgroundColor = itemFilterBlock?.DisplayBackgroundColor ?? new Color { A = 255, R = 0, G = 0, B = 0 };
|
||||
BorderColor = itemFilterBlock?.DisplayBorderColor ?? new Color {A = 255, R = 0, G = 0, B = 0};
|
||||
BackgroundColor = itemFilterBlock?.DisplayBackgroundColor ?? new Color { A = 240, R = 0, G = 0, B = 0 };
|
||||
BorderColor = itemFilterBlock?.DisplayBorderColor ?? new Color {A = 240, R = 0, G = 0, B = 0};
|
||||
FontSize = (itemFilterBlock?.DisplayFontSize ?? 34) / 1.8;
|
||||
|
||||
SetTextColor();
|
||||
|
||||
@@ -37,10 +37,26 @@
|
||||
<Reference Include="Castle.Windsor, Version=3.4.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Castle.Windsor.3.4.0\lib\net45\Castle.Windsor.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="CommonServiceLocator, Version=2.0.2.0, Culture=neutral, PublicKeyToken=489b6accfaf20ef0, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\CommonServiceLocator.2.0.2\lib\net45\CommonServiceLocator.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="GalaSoft.MvvmLight, Version=5.3.0.19026, Culture=neutral, PublicKeyToken=e7570ab207bcb616, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MvvmLightLibs.5.3.0.0\lib\net45\GalaSoft.MvvmLight.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="GalaSoft.MvvmLight.Extras, Version=5.3.0.19032, Culture=neutral, PublicKeyToken=669f0b5e8f868abf, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MvvmLightLibs.5.3.0.0\lib\net45\GalaSoft.MvvmLight.Extras.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="GalaSoft.MvvmLight.Platform, Version=5.3.0.19032, Culture=neutral, PublicKeyToken=5f873c45e98af8a1, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MvvmLightLibs.5.3.0.0\lib\net45\GalaSoft.MvvmLight.Platform.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.ComponentModel.DataAnnotations" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MvvmLightLibs.5.3.0.0\lib\net45\System.Windows.Interactivity.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
@@ -52,15 +68,27 @@
|
||||
<Compile Include="BlockItemBaseTypes\BlockItemBase.cs" />
|
||||
<Compile Include="BlockItemBaseTypes\BooleanBlockItem.cs" />
|
||||
<Compile Include="BlockItemBaseTypes\ColorBlockItem.cs" />
|
||||
<Compile Include="BlockItemBaseTypes\ColorBooleanBlockItem.cs" />
|
||||
<Compile Include="BlockItemBaseTypes\DualIntegerBlockItem.cs" />
|
||||
<Compile Include="BlockItemBaseTypes\StringIntBlockItem.cs" />
|
||||
<Compile Include="BlockItemBaseTypes\EffectColorBlockItem.cs" />
|
||||
<Compile Include="BlockItemBaseTypes\IconBlockItem.cs" />
|
||||
<Compile Include="BlockItemBaseTypes\StringBlockItem.cs" />
|
||||
<Compile Include="BlockItemBaseTypes\StrIntBlockItem.cs" />
|
||||
<Compile Include="BlockItemBaseTypes\IntegerBlockItem.cs" />
|
||||
<Compile Include="BlockItemBaseTypes\NumericFilterPredicateBlockItem.cs" />
|
||||
<Compile Include="BlockItemBaseTypes\StringListBlockItem.cs" />
|
||||
<Compile Include="BlockItemTypes\BackgroundColorBlockItem.cs" />
|
||||
<Compile Include="BlockItemTypes\BaseTypeBlockItem.cs" />
|
||||
<Compile Include="BlockItemTypes\MapTierBlockItem.cs" />
|
||||
<Compile Include="BlockItemTypes\PlayEffectBlockItem.cs" />
|
||||
<Compile Include="BlockItemTypes\BorderColorBlockItem.cs" />
|
||||
<Compile Include="BlockItemTypes\ClassBlockItem.cs" />
|
||||
<Compile Include="BlockItemTypes\CustomSoundBlockItem.cs" />
|
||||
<Compile Include="BlockItemTypes\DisableDropSoundBlockItem.cs" />
|
||||
<Compile Include="BlockItemTypes\ElderMapBlockItem.cs" />
|
||||
<Compile Include="BlockItemTypes\GemLevelBlockItem.cs" />
|
||||
<Compile Include="BlockItemTypes\HasExplicitModBlockItem.cs" />
|
||||
<Compile Include="BlockItemTypes\MapIconBlockItem.cs" />
|
||||
<Compile Include="BlockItemTypes\ShapedMapBlockItem.cs" />
|
||||
<Compile Include="BlockItemTypes\ShaperItemBlockItem.cs" />
|
||||
<Compile Include="BlockItemTypes\ElderItemBlockItem.cs" />
|
||||
@@ -77,24 +105,28 @@
|
||||
<Compile Include="BlockItemTypes\SocketsBlockItem.cs" />
|
||||
<Compile Include="BlockItemTypes\PositionalSoundBlockItem.cs" />
|
||||
<Compile Include="BlockItemTypes\SoundBlockItem.cs" />
|
||||
<Compile Include="BlockItemTypes\StackSizeBlockItem.cs" />
|
||||
<Compile Include="BlockItemTypes\TextColorBlockItem.cs" />
|
||||
<Compile Include="BlockItemTypes\WidthBlockItem.cs" />
|
||||
<Compile Include="Commands\CommandManager.cs" />
|
||||
<Compile Include="Commands\ICommand.cs" />
|
||||
<Compile Include="Commands\ItemFilterScript\PasteBlockCommand.cs" />
|
||||
<Compile Include="Commands\ItemFilterScript\MoveBlockToBottomCommand.cs" />
|
||||
<Compile Include="Commands\ItemFilterScript\MoveBlocksToIndexCommand.cs" />
|
||||
<Compile Include="Commands\ItemFilterScript\MoveBlocksToBottomCommand.cs" />
|
||||
<Compile Include="Commands\ItemFilterScript\AddCommentBlockCommand.cs" />
|
||||
<Compile Include="Commands\ItemFilterScript\MoveBlockDownCommand.cs" />
|
||||
<Compile Include="Commands\ItemFilterScript\MoveBlockUpCommand.cs" />
|
||||
<Compile Include="Commands\ItemFilterScript\MoveBlockToTopCommand.cs" />
|
||||
<Compile Include="Commands\ItemFilterScript\MoveBlocksToTopCommand.cs" />
|
||||
<Compile Include="Commands\ItemFilterScript\PasteBlocksCommand.cs" />
|
||||
<Compile Include="Commands\ItemFilterScript\RemoveBlocksCommand.cs" />
|
||||
<Compile Include="Commands\ItemFilterScript\SetScriptDescriptionCommand.cs" />
|
||||
<Compile Include="Commands\ItemFilterScript\RemoveBlockCommand.cs" />
|
||||
<Compile Include="Commands\ItemFilterScript\AddBlockCommand.cs" />
|
||||
<Compile Include="Commands\IUndoableCommand.cs" />
|
||||
<Compile Include="Enums\BlockAction.cs" />
|
||||
<Compile Include="Enums\BlockItemType.cs" />
|
||||
<Compile Include="Enums\EffectColor.cs" />
|
||||
<Compile Include="Enums\FilterPredicateOperator.cs" />
|
||||
<Compile Include="Enums\FilterType.cs" />
|
||||
<Compile Include="Enums\IconColor.cs" />
|
||||
<Compile Include="Enums\IconShape.cs" />
|
||||
<Compile Include="Enums\IconSize.cs" />
|
||||
<Compile Include="Enums\ItemRarity.cs" />
|
||||
<Compile Include="Enums\SocketColor.cs" />
|
||||
<Compile Include="Enums\ThemeComponentType.cs" />
|
||||
@@ -103,6 +135,7 @@
|
||||
<Compile Include="Factories\IItemFilterScriptFactory.cs" />
|
||||
<Compile Include="FilteredItem.cs" />
|
||||
<Compile Include="IAudioVisualBlockItem.cs" />
|
||||
<Compile Include="IBlockItemWithTheme.cs" />
|
||||
<Compile Include="IItemFilterBlockItem.cs" />
|
||||
<Compile Include="Item.cs" />
|
||||
<Compile Include="ItemFilterBlock.cs" />
|
||||
@@ -118,12 +151,21 @@
|
||||
<Compile Include="ReplaceColorsParameterSet.cs" />
|
||||
<Compile Include="Socket.cs" />
|
||||
<Compile Include="SocketGroup.cs" />
|
||||
<Compile Include="ThemeEditor\EffectColorThemeComponent.cs" />
|
||||
<Compile Include="ThemeEditor\IconThemeComponent.cs" />
|
||||
<Compile Include="ThemeEditor\StringThemeComponent.cs" />
|
||||
<Compile Include="ThemeEditor\StrIntThemeComponent.cs" />
|
||||
<Compile Include="ThemeEditor\IntegerThemeComponent.cs" />
|
||||
<Compile Include="ThemeEditor\Theme.cs" />
|
||||
<Compile Include="ThemeEditor\ColorThemeComponent.cs" />
|
||||
<Compile Include="ThemeEditor\ThemeComponent.cs" />
|
||||
<Compile Include="ThemeEditor\ThemeComponentCollection.cs" />
|
||||
<Compile Include="WindsorInstallers\CommandsInstaller.cs" />
|
||||
<Compile Include="WindsorInstallers\ModelsInstaller.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
|
||||
9
Filtration.ObjectModel/IBlockItemWithTheme.cs
Normal file
9
Filtration.ObjectModel/IBlockItemWithTheme.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
using Filtration.ObjectModel.ThemeEditor;
|
||||
|
||||
namespace Filtration.ObjectModel
|
||||
{
|
||||
public interface IBlockItemWithTheme : IItemFilterBlockItem
|
||||
{
|
||||
ThemeComponent ThemeComponent { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -14,5 +14,6 @@ namespace Filtration.ObjectModel
|
||||
int MaximumAllowed { get; }
|
||||
int SortOrder { get; }
|
||||
bool IsDirty { get; }
|
||||
string Comment { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Collections.Specialized;
|
||||
using System.Linq;
|
||||
using System.Windows.Media;
|
||||
using Filtration.ObjectModel.BlockItemBaseTypes;
|
||||
@@ -13,6 +14,7 @@ namespace Filtration.ObjectModel
|
||||
public interface IItemFilterBlock : IItemFilterBlockBase
|
||||
{
|
||||
bool Enabled { get; set; }
|
||||
event EventHandler EnabledStatusChanged;
|
||||
string Description { get; set; }
|
||||
ItemFilterBlockGroup BlockGroup { get; set; }
|
||||
BlockAction Action { get; set; }
|
||||
@@ -22,12 +24,18 @@ namespace Filtration.ObjectModel
|
||||
Color DisplayTextColor { get; }
|
||||
Color DisplayBorderColor { get; }
|
||||
double DisplayFontSize { get; }
|
||||
int DisplayIconSize { get; }
|
||||
int DisplayIconColor { get; }
|
||||
int DisplayIconShape { get; }
|
||||
Color DisplayEffectColor { get; }
|
||||
bool HasBlockItemOfType<T>();
|
||||
bool HasBlockGroupInParentHierarchy(ItemFilterBlockGroup targetBlockGroup, ItemFilterBlockGroup startingBlockGroup);
|
||||
}
|
||||
|
||||
public interface IItemFilterBlockBase
|
||||
{
|
||||
bool IsEdited { get; set; }
|
||||
string OriginalText { get; set; }
|
||||
}
|
||||
|
||||
public abstract class ItemFilterBlockBase : IItemFilterBlockBase
|
||||
@@ -44,6 +52,8 @@ namespace Filtration.ObjectModel
|
||||
|
||||
public ICommandManager CommandManager { get; }
|
||||
public IItemFilterScript ParentScript { get; set; }
|
||||
public bool IsEdited { get; set; }
|
||||
public string OriginalText { get; set; }
|
||||
}
|
||||
|
||||
public interface IItemFilterCommentBlock : IItemFilterBlockBase
|
||||
@@ -53,29 +63,70 @@ namespace Filtration.ObjectModel
|
||||
|
||||
public class ItemFilterCommentBlock : ItemFilterBlockBase, IItemFilterCommentBlock
|
||||
{
|
||||
private string _comment;
|
||||
public ItemFilterCommentBlock(IItemFilterScript parentScript) : base(parentScript)
|
||||
{
|
||||
}
|
||||
|
||||
public string Comment { get; set; }
|
||||
public string Comment
|
||||
{
|
||||
get { return _comment; }
|
||||
set
|
||||
{
|
||||
_comment = value;
|
||||
IsEdited = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class ItemFilterBlock : ItemFilterBlockBase, IItemFilterBlock
|
||||
{
|
||||
private ItemFilterBlockGroup _blockGroup;
|
||||
private bool _enabled;
|
||||
private string _description;
|
||||
|
||||
internal ItemFilterBlock()
|
||||
{
|
||||
BlockItems = new ObservableCollection<IItemFilterBlockItem> { ActionBlockItem };
|
||||
BlockItems.CollectionChanged += new NotifyCollectionChangedEventHandler(OnBlockItemsChanged);
|
||||
ActionBlockItem.PropertyChanged += OnActionBlockItemChanged;
|
||||
_enabled = true;
|
||||
}
|
||||
|
||||
public ItemFilterBlock(IItemFilterScript parentScript) : base(parentScript)
|
||||
{
|
||||
BlockItems = new ObservableCollection<IItemFilterBlockItem> { ActionBlockItem };
|
||||
BlockItems.CollectionChanged += new NotifyCollectionChangedEventHandler(OnBlockItemsChanged);
|
||||
ActionBlockItem.PropertyChanged += OnActionBlockItemChanged;
|
||||
_enabled = true;
|
||||
}
|
||||
|
||||
public bool Enabled { get; set; } = true;
|
||||
public string Description { get; set; }
|
||||
public bool Enabled
|
||||
{
|
||||
get { return _enabled; }
|
||||
set
|
||||
{
|
||||
_enabled = value;
|
||||
IsEdited = true;
|
||||
EnabledStatusChanged?.Invoke(null, null);
|
||||
if(BlockGroup != null && BlockGroup.IsEnableChecked != value)
|
||||
{
|
||||
BlockGroup.IsEnableChecked = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public event EventHandler EnabledStatusChanged;
|
||||
|
||||
public string Description
|
||||
{
|
||||
get { return _description; }
|
||||
set
|
||||
{
|
||||
_description = value;
|
||||
IsEdited = true;
|
||||
}
|
||||
}
|
||||
|
||||
public ItemFilterBlockGroup BlockGroup
|
||||
{
|
||||
@@ -114,12 +165,24 @@ namespace Filtration.ObjectModel
|
||||
{
|
||||
var actionBlock = BlockItems.OfType<ActionBlockItem>().First();
|
||||
actionBlock.Action = value;
|
||||
IsEdited = true;
|
||||
}
|
||||
}
|
||||
|
||||
public ActionBlockItem ActionBlockItem { get; } = new ActionBlockItem(BlockAction.Show);
|
||||
|
||||
public ObservableCollection<IItemFilterBlockItem> BlockItems { get; }
|
||||
private void OnBlockItemsChanged(object sender, NotifyCollectionChangedEventArgs e)
|
||||
{
|
||||
IsEdited = true;
|
||||
}
|
||||
private void OnActionBlockItemChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (BlockGroup != null && BlockGroup.IsShowChecked != (Action == BlockAction.Show))
|
||||
{
|
||||
BlockGroup.IsShowChecked = (Action == BlockAction.Show);
|
||||
}
|
||||
}
|
||||
|
||||
public bool AddBlockItemAllowed(Type type)
|
||||
{
|
||||
@@ -153,14 +216,23 @@ namespace Filtration.ObjectModel
|
||||
|
||||
private void OnBlockGroupStatusChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (BlockGroup.IsChecked == false && Action == BlockAction.Show)
|
||||
if (BlockGroup.IsShowChecked == false && Action == BlockAction.Show)
|
||||
{
|
||||
Action = BlockAction.Hide;
|
||||
}
|
||||
else if (BlockGroup.IsChecked && Action == BlockAction.Hide)
|
||||
else if (BlockGroup.IsShowChecked == true && Action == BlockAction.Hide)
|
||||
{
|
||||
Action = BlockAction.Show;
|
||||
}
|
||||
|
||||
if (BlockGroup.IsEnableChecked == false && Enabled)
|
||||
{
|
||||
Enabled = false;
|
||||
}
|
||||
else if (BlockGroup.IsEnableChecked == true && !Enabled)
|
||||
{
|
||||
Enabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
public Color DisplayTextColor
|
||||
@@ -198,7 +270,7 @@ namespace Filtration.ObjectModel
|
||||
get
|
||||
{
|
||||
var backgroundColorBlockItem = BlockItems.OfType<BackgroundColorBlockItem>().FirstOrDefault();
|
||||
return backgroundColorBlockItem?.Color ?? new Color { A = 255, R = 0, G = 0, B = 0 };
|
||||
return backgroundColorBlockItem?.Color ?? new Color { A = 240, R = 0, G = 0, B = 0 };
|
||||
}
|
||||
}
|
||||
|
||||
@@ -207,7 +279,7 @@ namespace Filtration.ObjectModel
|
||||
get
|
||||
{
|
||||
var borderColorBlockItem = BlockItems.OfType<BorderColorBlockItem>().FirstOrDefault();
|
||||
return borderColorBlockItem?.Color ?? new Color { A = 255, R = 0, G = 0, B = 0 };
|
||||
return borderColorBlockItem?.Color ?? new Color { A = 240, R = 0, G = 0, B = 0 };
|
||||
}
|
||||
}
|
||||
|
||||
@@ -219,5 +291,70 @@ namespace Filtration.ObjectModel
|
||||
return fontSizeBlockItem?.Value ?? 34;
|
||||
}
|
||||
}
|
||||
|
||||
public int DisplayIconSize
|
||||
{
|
||||
get
|
||||
{
|
||||
var mapIconBlockItem = BlockItems.OfType<MapIconBlockItem>().FirstOrDefault();
|
||||
if (mapIconBlockItem != null)
|
||||
return (int)mapIconBlockItem.Size;
|
||||
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
public int DisplayIconColor
|
||||
{
|
||||
get
|
||||
{
|
||||
var mapIconBlockItem = BlockItems.OfType<MapIconBlockItem>().FirstOrDefault();
|
||||
if (mapIconBlockItem != null)
|
||||
return (int)mapIconBlockItem.Color;
|
||||
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
public int DisplayIconShape
|
||||
{
|
||||
get
|
||||
{
|
||||
var mapIconBlockItem = BlockItems.OfType<MapIconBlockItem>().FirstOrDefault();
|
||||
if (mapIconBlockItem != null)
|
||||
return (int)mapIconBlockItem.Shape;
|
||||
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
public Color DisplayEffectColor
|
||||
{
|
||||
get
|
||||
{
|
||||
var beamBlockItem = BlockItems.OfType<PlayEffectBlockItem>().FirstOrDefault();
|
||||
|
||||
if (beamBlockItem != null)
|
||||
{
|
||||
switch (beamBlockItem.Color)
|
||||
{
|
||||
case EffectColor.Red:
|
||||
return Colors.Red;
|
||||
case EffectColor.Green:
|
||||
return Colors.Green;
|
||||
case EffectColor.Blue:
|
||||
return Colors.Blue;
|
||||
case EffectColor.Brown:
|
||||
return Colors.Brown;
|
||||
case EffectColor.White:
|
||||
return Colors.White;
|
||||
case EffectColor.Yellow:
|
||||
return Colors.Yellow;
|
||||
}
|
||||
}
|
||||
|
||||
return Colors.Transparent;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,31 +5,34 @@ namespace Filtration.ObjectModel
|
||||
{
|
||||
public class ItemFilterBlockGroup
|
||||
{
|
||||
private bool _isChecked;
|
||||
private bool? _isShowChecked;
|
||||
private bool? _isEnableChecked;
|
||||
|
||||
public ItemFilterBlockGroup(string groupName, ItemFilterBlockGroup parent, bool advanced = false)
|
||||
public ItemFilterBlockGroup(string groupName, ItemFilterBlockGroup parent, bool advanced = false, bool isLeafNode = false)
|
||||
{
|
||||
GroupName = groupName;
|
||||
ParentGroup = parent;
|
||||
Advanced = advanced;
|
||||
ChildGroups = new List<ItemFilterBlockGroup>();
|
||||
IsLeafNode = isLeafNode;
|
||||
}
|
||||
|
||||
public string GroupName { get; }
|
||||
public ItemFilterBlockGroup ParentGroup { get; set; }
|
||||
public List<ItemFilterBlockGroup> ChildGroups { get; }
|
||||
public bool Advanced { get; }
|
||||
public bool IsLeafNode { get; }
|
||||
|
||||
public event EventHandler BlockGroupStatusChanged;
|
||||
|
||||
public string GroupName { get; }
|
||||
public ItemFilterBlockGroup ParentGroup { get; }
|
||||
public List<ItemFilterBlockGroup> ChildGroups { get; }
|
||||
public bool Advanced { get; }
|
||||
|
||||
public bool IsChecked
|
||||
public bool? IsShowChecked
|
||||
{
|
||||
get { return _isChecked; }
|
||||
get { return _isShowChecked; }
|
||||
set
|
||||
{
|
||||
if (value != _isChecked)
|
||||
if (value != _isShowChecked)
|
||||
{
|
||||
_isChecked = value;
|
||||
_isShowChecked = value;
|
||||
// Raise an event to let blocks that have this block group assigned that
|
||||
// they might need to change their Action due to the block group status changing.
|
||||
BlockGroupStatusChanged?.Invoke(null, null);
|
||||
@@ -37,20 +40,85 @@ namespace Filtration.ObjectModel
|
||||
}
|
||||
}
|
||||
|
||||
public bool? IsEnableChecked
|
||||
{
|
||||
get { return _isEnableChecked; }
|
||||
set
|
||||
{
|
||||
if (value != _isEnableChecked)
|
||||
{
|
||||
_isEnableChecked = value;
|
||||
// Raise an event to let blocks that have this block group assigned that
|
||||
// they might need to change their Enabled due to the block group status changing.
|
||||
BlockGroupStatusChanged?.Invoke(null, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void ClearStatusChangeSubscribers()
|
||||
{
|
||||
BlockGroupStatusChanged = null;
|
||||
}
|
||||
|
||||
public void AddOrJoinBlockGroup(ItemFilterBlockGroup blockGroup)
|
||||
{
|
||||
var childIndex = ChildGroups.FindIndex(item => item.GroupName.Equals(blockGroup.GroupName));
|
||||
if (!blockGroup.IsLeafNode && childIndex >= 0)
|
||||
{
|
||||
while(blockGroup.ChildGroups.Count > 0)
|
||||
{
|
||||
ChildGroups[childIndex].AddOrJoinBlockGroup(blockGroup.ChildGroups[0]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(blockGroup.ParentGroup != null)
|
||||
{
|
||||
blockGroup.ParentGroup.ChildGroups.Remove(blockGroup);
|
||||
}
|
||||
blockGroup.ParentGroup = this;
|
||||
ChildGroups.Add(blockGroup);
|
||||
}
|
||||
}
|
||||
|
||||
public void DetachSelf(bool keepChildren)
|
||||
{
|
||||
if(ParentGroup == null)
|
||||
return;
|
||||
|
||||
if(IsLeafNode && ParentGroup.ParentGroup != null && ParentGroup.ChildGroups.Count < 2)
|
||||
{
|
||||
ParentGroup.DetachSelf(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
ParentGroup.ChildGroups.Remove(this);
|
||||
|
||||
if (keepChildren)
|
||||
{
|
||||
foreach(var child in ChildGroups)
|
||||
{
|
||||
ParentGroup.AddOrJoinBlockGroup(child);
|
||||
}
|
||||
}
|
||||
|
||||
ParentGroup = null;
|
||||
}
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
var currentBlockGroup = this;
|
||||
if(ParentGroup == null)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
var outputString = (Advanced ? "~" : string.Empty) + GroupName;
|
||||
|
||||
// TODO: This is retarded, fix this.
|
||||
if (currentBlockGroup.ParentGroup != null)
|
||||
var parentOutput = ParentGroup.ToString();
|
||||
if(!string.IsNullOrWhiteSpace(parentOutput))
|
||||
{
|
||||
while (currentBlockGroup.ParentGroup.ParentGroup != null)
|
||||
{
|
||||
outputString = (currentBlockGroup.ParentGroup.Advanced ? "~" : string.Empty) + currentBlockGroup.ParentGroup.GroupName + " - " + outputString;
|
||||
currentBlockGroup = currentBlockGroup.ParentGroup;
|
||||
}
|
||||
outputString = parentOutput + (IsLeafNode ? string.Empty : " - " + outputString);
|
||||
}
|
||||
|
||||
return outputString;
|
||||
|
||||
@@ -8,36 +8,36 @@ namespace Filtration.ObjectModel
|
||||
{
|
||||
public static Dictionary<PathOfExileNamedColor, Color> Colors => new Dictionary<PathOfExileNamedColor, Color>
|
||||
{
|
||||
{PathOfExileNamedColor.Default, new Color {A = 255, R = 127, G = 127, B = 127}},
|
||||
{PathOfExileNamedColor.ValueDefault, new Color {A = 255, R = 255, G = 255, B = 255}},
|
||||
{PathOfExileNamedColor.Pink, new Color {A = 255, R = 255, G = 192, B = 203}},
|
||||
{PathOfExileNamedColor.DodgerBlue, new Color {A = 255, R = 30, G = 144, B = 255}},
|
||||
{PathOfExileNamedColor.Fire, new Color {A = 255, R = 150, G = 0, B = 0}},
|
||||
{PathOfExileNamedColor.Cold, new Color {A = 255, R = 54, G = 100, B = 146}},
|
||||
{PathOfExileNamedColor.Lightning, new Color {A = 255, R = 255, G = 215, B = 0}},
|
||||
{PathOfExileNamedColor.Chaos, new Color {A = 255, R = 208, G = 32, B = 144}},
|
||||
{PathOfExileNamedColor.Augmented, new Color {A = 255, R = 136, G = 136, B = 255}},
|
||||
{PathOfExileNamedColor.Crafted, new Color {A = 255, R = 184, G = 218, B = 242}},
|
||||
{PathOfExileNamedColor.Unmet, new Color {A = 255, R = 210, G = 0, B = 0}},
|
||||
{PathOfExileNamedColor.UniqueItem, new Color {A = 255, R = 175, G = 96, B = 37}},
|
||||
{PathOfExileNamedColor.RareItem, new Color {A = 255, R = 255, G = 255, B = 119}},
|
||||
{PathOfExileNamedColor.MagicItem, new Color {A = 255, R = 136, G = 136, B = 255}},
|
||||
{PathOfExileNamedColor.WhiteItem, new Color {A = 255, R = 200, G = 200, B = 200}},
|
||||
{PathOfExileNamedColor.GemItem, new Color {A = 255, R = 27, G = 162, B = 155}},
|
||||
{PathOfExileNamedColor.CurrencyItem, new Color {A = 255, R = 170, G = 158, B = 130}},
|
||||
{PathOfExileNamedColor.QuestItem, new Color {A = 255, R = 74, G = 230, B = 58}},
|
||||
{PathOfExileNamedColor.NemesisMod, new Color {A = 255, R = 255, G = 200, B = 0}},
|
||||
{PathOfExileNamedColor.Default, new Color {A = 240, R = 127, G = 127, B = 127}},
|
||||
{PathOfExileNamedColor.ValueDefault, new Color {A = 240, R = 255, G = 255, B = 255}},
|
||||
{PathOfExileNamedColor.Pink, new Color {A = 240, R = 255, G = 192, B = 203}},
|
||||
{PathOfExileNamedColor.DodgerBlue, new Color {A = 240, R = 30, G = 144, B = 255}},
|
||||
{PathOfExileNamedColor.Fire, new Color {A = 240, R = 150, G = 0, B = 0}},
|
||||
{PathOfExileNamedColor.Cold, new Color {A = 240, R = 54, G = 100, B = 146}},
|
||||
{PathOfExileNamedColor.Lightning, new Color {A = 240, R = 255, G = 215, B = 0}},
|
||||
{PathOfExileNamedColor.Chaos, new Color {A = 240, R = 208, G = 32, B = 144}},
|
||||
{PathOfExileNamedColor.Augmented, new Color {A = 240, R = 136, G = 136, B = 255}},
|
||||
{PathOfExileNamedColor.Crafted, new Color {A = 240, R = 184, G = 218, B = 242}},
|
||||
{PathOfExileNamedColor.Unmet, new Color {A = 240, R = 210, G = 0, B = 0}},
|
||||
{PathOfExileNamedColor.UniqueItem, new Color {A = 240, R = 175, G = 96, B = 37}},
|
||||
{PathOfExileNamedColor.RareItem, new Color {A = 240, R = 255, G = 255, B = 119}},
|
||||
{PathOfExileNamedColor.MagicItem, new Color {A = 240, R = 136, G = 136, B = 255}},
|
||||
{PathOfExileNamedColor.WhiteItem, new Color {A = 240, R = 200, G = 200, B = 200}},
|
||||
{PathOfExileNamedColor.GemItem, new Color {A = 240, R = 27, G = 162, B = 155}},
|
||||
{PathOfExileNamedColor.CurrencyItem, new Color {A = 240, R = 170, G = 158, B = 130}},
|
||||
{PathOfExileNamedColor.QuestItem, new Color {A = 240, R = 74, G = 230, B = 58}},
|
||||
{PathOfExileNamedColor.NemesisMod, new Color {A = 240, R = 255, G = 200, B = 0}},
|
||||
{PathOfExileNamedColor.NemesisModOutline, new Color {A = 220, R = 255, G = 40, B = 0}},
|
||||
{PathOfExileNamedColor.Title, new Color {A = 255, R = 231, G = 180, B = 120}},
|
||||
{PathOfExileNamedColor.Corrupted, new Color {A = 255, R = 210, G = 0, B = 0}},
|
||||
{PathOfExileNamedColor.Favour, new Color {A = 255, R = 170, G = 158, B = 130}},
|
||||
{PathOfExileNamedColor.SupporterPackNewItem, new Color {A = 255, R = 180, G = 96, B = 0}},
|
||||
{PathOfExileNamedColor.SupporterPackItem, new Color {A = 255, R = 163, G = 141, B = 109}},
|
||||
{PathOfExileNamedColor.BloodlineMod, new Color {A = 255, R = 210, G = 0, B = 220}},
|
||||
{PathOfExileNamedColor.Title, new Color {A = 240, R = 231, G = 180, B = 120}},
|
||||
{PathOfExileNamedColor.Corrupted, new Color {A = 240, R = 210, G = 0, B = 0}},
|
||||
{PathOfExileNamedColor.Favour, new Color {A = 240, R = 170, G = 158, B = 130}},
|
||||
{PathOfExileNamedColor.SupporterPackNewItem, new Color {A = 240, R = 180, G = 96, B = 0}},
|
||||
{PathOfExileNamedColor.SupporterPackItem, new Color {A = 240, R = 163, G = 141, B = 109}},
|
||||
{PathOfExileNamedColor.BloodlineMod, new Color {A = 240, R = 210, G = 0, B = 220}},
|
||||
{PathOfExileNamedColor.BloodlineModOutline, new Color {A = 200, R = 74, G = 0, B = 160}},
|
||||
{PathOfExileNamedColor.TormentMod, new Color {A = 255, R = 50, G = 230, B = 100}},
|
||||
{PathOfExileNamedColor.TormentMod, new Color {A = 240, R = 50, G = 230, B = 100}},
|
||||
{PathOfExileNamedColor.TormentModOutline, new Color {A = 200, R = 0, G = 100, B = 150}},
|
||||
{PathOfExileNamedColor.CantTradeorModify, new Color {A = 255, R = 210, G = 0, B = 0}},
|
||||
{PathOfExileNamedColor.CantTradeorModify, new Color {A = 240, R = 210, G = 0, B = 0}},
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
35
Filtration.ObjectModel/ThemeEditor/ColorThemeComponent.cs
Normal file
35
Filtration.ObjectModel/ThemeEditor/ColorThemeComponent.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using System.Windows.Media;
|
||||
using Filtration.ObjectModel.Enums;
|
||||
|
||||
namespace Filtration.ObjectModel.ThemeEditor
|
||||
{
|
||||
[Serializable]
|
||||
public class ColorThemeComponent : ThemeComponent
|
||||
{
|
||||
private Color _color;
|
||||
|
||||
public ColorThemeComponent(ThemeComponentType componentType, string componentName, Color componentColor)
|
||||
{
|
||||
if (componentName == null || componentColor == null)
|
||||
{
|
||||
throw new ArgumentException("Null parameters not allowed in ColorThemeComponent constructor");
|
||||
}
|
||||
|
||||
ComponentType = componentType;
|
||||
Color = componentColor;
|
||||
ComponentName = componentName;
|
||||
}
|
||||
|
||||
public Color Color
|
||||
{
|
||||
get { return _color; }
|
||||
set
|
||||
{
|
||||
_color = value;
|
||||
OnPropertyChanged();
|
||||
_themeComponentUpdatedEventHandler?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
using System;
|
||||
using Filtration.ObjectModel.Enums;
|
||||
|
||||
namespace Filtration.ObjectModel.ThemeEditor
|
||||
{
|
||||
[Serializable]
|
||||
public class EffectColorThemeComponent : ThemeComponent
|
||||
{
|
||||
private EffectColor _effectColor;
|
||||
private bool _temporary;
|
||||
|
||||
public EffectColorThemeComponent(ThemeComponentType componentType, string componentName, EffectColor componentEffectColor, bool componentTemporary)
|
||||
{
|
||||
if (componentName == null)
|
||||
{
|
||||
throw new ArgumentException("Null parameters not allowed in EffectColorThemeComponent constructor");
|
||||
}
|
||||
|
||||
ComponentType = componentType;
|
||||
ComponentName = componentName;
|
||||
EffectColor = componentEffectColor;
|
||||
Temporary = componentTemporary;
|
||||
}
|
||||
|
||||
public EffectColor EffectColor
|
||||
{
|
||||
get { return _effectColor; }
|
||||
set
|
||||
{
|
||||
_effectColor = value;
|
||||
OnPropertyChanged();
|
||||
_themeComponentUpdatedEventHandler?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
|
||||
public bool Temporary
|
||||
{
|
||||
get { return _temporary; }
|
||||
set
|
||||
{
|
||||
_temporary = value;
|
||||
OnPropertyChanged();
|
||||
_themeComponentUpdatedEventHandler?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
60
Filtration.ObjectModel/ThemeEditor/IconThemeComponent.cs
Normal file
60
Filtration.ObjectModel/ThemeEditor/IconThemeComponent.cs
Normal file
@@ -0,0 +1,60 @@
|
||||
using System;
|
||||
using Filtration.ObjectModel.Enums;
|
||||
|
||||
namespace Filtration.ObjectModel.ThemeEditor
|
||||
{
|
||||
[Serializable]
|
||||
public class IconThemeComponent : ThemeComponent
|
||||
{
|
||||
private IconSize _iconSize;
|
||||
private IconColor _iconColor;
|
||||
private IconShape _iconShape;
|
||||
|
||||
public IconThemeComponent(ThemeComponentType componentType, string componentName, IconSize componentIconSize, IconColor componentIconColor, IconShape componentIconShape)
|
||||
{
|
||||
if (componentName == null)
|
||||
{
|
||||
throw new ArgumentException("Null parameters not allowed in IconThemeComponent constructor");
|
||||
}
|
||||
|
||||
ComponentType = componentType;
|
||||
ComponentName = componentName;
|
||||
IconSize = componentIconSize;
|
||||
IconColor = componentIconColor;
|
||||
IconShape = componentIconShape;
|
||||
}
|
||||
|
||||
public IconSize IconSize
|
||||
{
|
||||
get { return _iconSize; }
|
||||
set
|
||||
{
|
||||
_iconSize = value;
|
||||
OnPropertyChanged();
|
||||
_themeComponentUpdatedEventHandler?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
|
||||
public IconColor IconColor
|
||||
{
|
||||
get { return _iconColor; }
|
||||
set
|
||||
{
|
||||
_iconColor = value;
|
||||
OnPropertyChanged();
|
||||
_themeComponentUpdatedEventHandler?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
|
||||
public IconShape IconShape
|
||||
{
|
||||
get { return _iconShape; }
|
||||
set
|
||||
{
|
||||
_iconShape = value;
|
||||
OnPropertyChanged();
|
||||
_themeComponentUpdatedEventHandler?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
35
Filtration.ObjectModel/ThemeEditor/IntegerThemeComponent.cs
Normal file
35
Filtration.ObjectModel/ThemeEditor/IntegerThemeComponent.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using System.Windows.Media;
|
||||
using Filtration.ObjectModel.Enums;
|
||||
|
||||
namespace Filtration.ObjectModel.ThemeEditor
|
||||
{
|
||||
[Serializable]
|
||||
public class IntegerThemeComponent : ThemeComponent
|
||||
{
|
||||
private int _value;
|
||||
|
||||
public IntegerThemeComponent(ThemeComponentType componentType, string componentName, int componentValue)
|
||||
{
|
||||
if (componentName == null)
|
||||
{
|
||||
throw new ArgumentException("Null parameters not allowed in IntegerThemeComponent constructor");
|
||||
}
|
||||
|
||||
ComponentType = componentType;
|
||||
Value = componentValue;
|
||||
ComponentName = componentName;
|
||||
}
|
||||
|
||||
public int Value
|
||||
{
|
||||
get { return _value; }
|
||||
set
|
||||
{
|
||||
_value = value;
|
||||
OnPropertyChanged();
|
||||
_themeComponentUpdatedEventHandler?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
47
Filtration.ObjectModel/ThemeEditor/StrIntThemeComponent.cs
Normal file
47
Filtration.ObjectModel/ThemeEditor/StrIntThemeComponent.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
using System;
|
||||
using Filtration.ObjectModel.Enums;
|
||||
|
||||
namespace Filtration.ObjectModel.ThemeEditor
|
||||
{
|
||||
[Serializable]
|
||||
public class StrIntThemeComponent : ThemeComponent
|
||||
{
|
||||
private string _value;
|
||||
private int _secondValue;
|
||||
|
||||
public StrIntThemeComponent(ThemeComponentType componentType, string componentName, string componentValue, int componentSecondValue)
|
||||
{
|
||||
if (componentName == null || componentValue == null)
|
||||
{
|
||||
throw new ArgumentException("Null parameters not allowed in StrIntThemeComponent constructor");
|
||||
}
|
||||
|
||||
ComponentType = componentType;
|
||||
Value = componentValue;
|
||||
SecondValue = componentSecondValue;
|
||||
ComponentName = componentName;
|
||||
}
|
||||
|
||||
public string Value
|
||||
{
|
||||
get { return _value; }
|
||||
set
|
||||
{
|
||||
_value = value;
|
||||
OnPropertyChanged();
|
||||
_themeComponentUpdatedEventHandler?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
|
||||
public int SecondValue
|
||||
{
|
||||
get { return _secondValue; }
|
||||
set
|
||||
{
|
||||
_secondValue = value;
|
||||
OnPropertyChanged();
|
||||
_themeComponentUpdatedEventHandler?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
104
Filtration.ObjectModel/ThemeEditor/StringThemeComponent.cs
Normal file
104
Filtration.ObjectModel/ThemeEditor/StringThemeComponent.cs
Normal file
@@ -0,0 +1,104 @@
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using Filtration.ObjectModel.Enums;
|
||||
using GalaSoft.MvvmLight.Command;
|
||||
using Microsoft.Win32;
|
||||
|
||||
namespace Filtration.ObjectModel.ThemeEditor
|
||||
{
|
||||
[Serializable]
|
||||
public class StringThemeComponent : ThemeComponent
|
||||
{
|
||||
private string _value;
|
||||
public static ObservableCollection<string> _customSoundsAvailable;
|
||||
|
||||
public StringThemeComponent(ThemeComponentType componentType, string componentName, string componentValue)
|
||||
{
|
||||
if (componentName == null || componentValue == null)
|
||||
{
|
||||
throw new ArgumentException("Null parameters not allowed in StringThemeComponent constructor");
|
||||
}
|
||||
|
||||
ComponentType = componentType;
|
||||
Value = componentValue;
|
||||
ComponentName = componentName;
|
||||
|
||||
if (_customSoundsAvailable == null || _customSoundsAvailable.Count < 1)
|
||||
{
|
||||
|
||||
_customSoundsAvailable = new ObservableCollection<string>();
|
||||
|
||||
var poeFolderPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments).ToString() + @"\My Games\Path of Exile\";
|
||||
if(System.IO.Directory.Exists(poeFolderPath))
|
||||
{
|
||||
var poeFolderFiles = System.IO.Directory.GetFiles(poeFolderPath).Where(
|
||||
s => s.EndsWith(".mp3")
|
||||
|| s.EndsWith(".wav")
|
||||
|| s.EndsWith(".wma")
|
||||
|| s.EndsWith(".3gp")
|
||||
|| s.EndsWith(".aag")
|
||||
|| s.EndsWith(".m4a")
|
||||
|| s.EndsWith(".ogg")
|
||||
).OrderBy(f => f);
|
||||
|
||||
foreach (var file in poeFolderFiles)
|
||||
{
|
||||
_customSoundsAvailable.Add(file.Replace(poeFolderPath, ""));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(string.IsNullOrWhiteSpace(Value))
|
||||
{
|
||||
Value = _customSoundsAvailable.Count > 0 ? _customSoundsAvailable[0] : "";
|
||||
}
|
||||
else if (_customSoundsAvailable.IndexOf(Value) < 0)
|
||||
{
|
||||
_customSoundsAvailable.Add(Value);
|
||||
}
|
||||
|
||||
CustomSoundFileDialogCommand = new RelayCommand(OnCustomSoundFileDialog);
|
||||
}
|
||||
|
||||
public RelayCommand CustomSoundFileDialogCommand { get; set; }
|
||||
|
||||
public ObservableCollection<string> CustomSoundsAvailable => _customSoundsAvailable;
|
||||
|
||||
public string Value
|
||||
{
|
||||
get { return _value; }
|
||||
set
|
||||
{
|
||||
_value = value;
|
||||
OnPropertyChanged();
|
||||
_themeComponentUpdatedEventHandler?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnCustomSoundFileDialog()
|
||||
{
|
||||
OpenFileDialog fileDialog = new OpenFileDialog();
|
||||
fileDialog.DefaultExt = ".mp3";
|
||||
var poePath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments).ToString() + @"\My Games\Path of Exile\";
|
||||
fileDialog.InitialDirectory = poePath;
|
||||
|
||||
Nullable<bool> result = fileDialog.ShowDialog();
|
||||
if (result == true)
|
||||
{
|
||||
var fileName = fileDialog.FileName;
|
||||
if (fileName.StartsWith(poePath))
|
||||
{
|
||||
fileName = fileName.Replace(poePath, "");
|
||||
}
|
||||
|
||||
if (CustomSoundsAvailable.IndexOf(fileName) < 0)
|
||||
{
|
||||
CustomSoundsAvailable.Add(fileName);
|
||||
OnPropertyChanged(nameof(CustomSoundsAvailable));
|
||||
}
|
||||
Value = fileName;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -32,7 +32,17 @@ namespace Filtration.ObjectModel.ThemeEditor
|
||||
|
||||
public void AddComponent(ThemeComponentType componentType, string componentName, Color componentColor)
|
||||
{
|
||||
_components.Add(new ThemeComponent(componentType, componentName, componentColor));
|
||||
_components.Add(new ColorThemeComponent(componentType, componentName, componentColor));
|
||||
}
|
||||
|
||||
public void AddComponent(ThemeComponentType componentType, string componentName, int componentValue)
|
||||
{
|
||||
_components.Add(new IntegerThemeComponent(componentType, componentName, componentValue));
|
||||
}
|
||||
|
||||
public void AddComponent(ThemeComponentType componentType, string componentName, string componentValue, int componentSecondValue)
|
||||
{
|
||||
_components.Add(new StrIntThemeComponent(componentType, componentName, componentValue, componentSecondValue));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,8 +10,7 @@ namespace Filtration.ObjectModel.ThemeEditor
|
||||
[Serializable]
|
||||
public class ThemeComponent : INotifyPropertyChanged
|
||||
{
|
||||
private Color _color;
|
||||
private EventHandler _themeComponentUpdatedEventHandler;
|
||||
protected EventHandler _themeComponentUpdatedEventHandler;
|
||||
private readonly object _eventLock = new object();
|
||||
|
||||
public ThemeComponent()
|
||||
@@ -19,18 +18,6 @@ namespace Filtration.ObjectModel.ThemeEditor
|
||||
|
||||
}
|
||||
|
||||
public ThemeComponent(ThemeComponentType componentType, string componentName, Color componentColor)
|
||||
{
|
||||
if (componentName == null || componentColor == null)
|
||||
{
|
||||
throw new ArgumentException("Null parameters not allowed in ThemeComponent constructor");
|
||||
}
|
||||
|
||||
ComponentType = componentType;
|
||||
Color = componentColor;
|
||||
ComponentName = componentName;
|
||||
}
|
||||
|
||||
// By implementing a custom event accessor here we can keep the UsageCount up to date.
|
||||
public event EventHandler ThemeComponentUpdated
|
||||
{
|
||||
@@ -58,17 +45,6 @@ namespace Filtration.ObjectModel.ThemeEditor
|
||||
public string ComponentName { get; set; }
|
||||
public ThemeComponentType ComponentType{ get; set; }
|
||||
|
||||
public Color Color
|
||||
{
|
||||
get { return _color; }
|
||||
set
|
||||
{
|
||||
_color = value;
|
||||
OnPropertyChanged();
|
||||
_themeComponentUpdatedEventHandler?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
|
||||
public int UsageCount
|
||||
{
|
||||
get
|
||||
|
||||
@@ -16,7 +16,72 @@ namespace Filtration.ObjectModel.ThemeEditor
|
||||
return Items.FirstOrDefault(t => t.ComponentName == componentName && t.ComponentType == componentType);
|
||||
}
|
||||
|
||||
var component = new ThemeComponent(componentType, componentName, componentColor);
|
||||
var component = new ColorThemeComponent(componentType, componentName, componentColor);
|
||||
Items.Add(component);
|
||||
|
||||
return component;
|
||||
}
|
||||
|
||||
public ThemeComponent AddComponent(ThemeComponentType componentType, string componentName, int componentValue)
|
||||
{
|
||||
if (ComponentExists(componentType, componentName))
|
||||
{
|
||||
return Items.FirstOrDefault(t => t.ComponentName == componentName && t.ComponentType == componentType);
|
||||
}
|
||||
|
||||
var component = new IntegerThemeComponent(componentType, componentName, componentValue);
|
||||
Items.Add(component);
|
||||
|
||||
return component;
|
||||
}
|
||||
|
||||
public ThemeComponent AddComponent(ThemeComponentType componentType, string componentName, string componentValue, int componentSecondValue)
|
||||
{
|
||||
if (ComponentExists(componentType, componentName))
|
||||
{
|
||||
return Items.FirstOrDefault(t => t.ComponentName == componentName && t.ComponentType == componentType);
|
||||
}
|
||||
|
||||
var component = new StrIntThemeComponent(componentType, componentName, componentValue, componentSecondValue);
|
||||
Items.Add(component);
|
||||
|
||||
return component;
|
||||
}
|
||||
|
||||
public ThemeComponent AddComponent(ThemeComponentType componentType, string componentName, string componentValue)
|
||||
{
|
||||
if (ComponentExists(componentType, componentName))
|
||||
{
|
||||
return Items.FirstOrDefault(t => t.ComponentName == componentName && t.ComponentType == componentType);
|
||||
}
|
||||
|
||||
var component = new StringThemeComponent(componentType, componentName, componentValue);
|
||||
Items.Add(component);
|
||||
|
||||
return component;
|
||||
}
|
||||
|
||||
public ThemeComponent AddComponent(ThemeComponentType componentType, string componentName, IconSize componentIconSize, IconColor componentIconColor, IconShape componentIconShape)
|
||||
{
|
||||
if (ComponentExists(componentType, componentName))
|
||||
{
|
||||
return Items.FirstOrDefault(t => t.ComponentName == componentName && t.ComponentType == componentType);
|
||||
}
|
||||
|
||||
var component = new IconThemeComponent(componentType, componentName, componentIconSize, componentIconColor, componentIconShape);
|
||||
Items.Add(component);
|
||||
|
||||
return component;
|
||||
}
|
||||
|
||||
public ThemeComponent AddComponent(ThemeComponentType componentType, string componentName, EffectColor componentEffectColor, bool componentTemporary)
|
||||
{
|
||||
if (ComponentExists(componentType, componentName))
|
||||
{
|
||||
return Items.FirstOrDefault(t => t.ComponentName == componentName && t.ComponentType == componentType);
|
||||
}
|
||||
|
||||
var component = new EffectColorThemeComponent(componentType, componentName, componentEffectColor, componentTemporary);
|
||||
Items.Add(component);
|
||||
|
||||
return component;
|
||||
@@ -28,5 +93,10 @@ namespace Filtration.ObjectModel.ThemeEditor
|
||||
Items.Count(c => c.ComponentName == componentName && c.ComponentType == componentType);
|
||||
return componentCount > 0;
|
||||
}
|
||||
|
||||
public bool ComponentExists(ThemeComponent themeComponent)
|
||||
{
|
||||
return ComponentExists(themeComponent.ComponentType, themeComponent.ComponentName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,4 +2,6 @@
|
||||
<packages>
|
||||
<package id="Castle.Core" version="3.3.0" targetFramework="net461" />
|
||||
<package id="Castle.Windsor" version="3.4.0" targetFramework="net461" />
|
||||
<package id="CommonServiceLocator" version="2.0.2" targetFramework="net461" />
|
||||
<package id="MvvmLightLibs" version="5.3.0.0" targetFramework="net461" />
|
||||
</packages>
|
||||
@@ -7,6 +7,6 @@ namespace Filtration.Parser.Interface.Services
|
||||
{
|
||||
void Initialise(ItemFilterBlockGroup rootBlockGroup);
|
||||
void Cleanup();
|
||||
ItemFilterBlockGroup IntegrateStringListIntoBlockGroupHierarchy(IEnumerable<string> groupStrings);
|
||||
ItemFilterBlockGroup IntegrateStringListIntoBlockGroupHierarchy(IEnumerable<string> groupStrings, bool show, bool enabled);
|
||||
}
|
||||
}
|
||||
@@ -5,8 +5,8 @@ namespace Filtration.Parser.Interface.Services
|
||||
{
|
||||
public interface IItemFilterBlockTranslator
|
||||
{
|
||||
IItemFilterBlock TranslateStringToItemFilterBlock(string inputString, IItemFilterScript parentItemFilterScript, bool initialiseBlockGroupHierarchyBuilder = false);
|
||||
IItemFilterCommentBlock TranslateStringToItemFilterCommentBlock(string inputString, IItemFilterScript parentItemFilterScript);
|
||||
IItemFilterBlock TranslateStringToItemFilterBlock(string inputString, IItemFilterScript parentItemFilterScript, string originalString = "", bool initialiseBlockGroupHierarchyBuilder = false);
|
||||
IItemFilterCommentBlock TranslateStringToItemFilterCommentBlock(string inputString, IItemFilterScript parentItemFilterScript, string originalString = "");
|
||||
|
||||
string TranslateItemFilterBlockToString(IItemFilterBlock block);
|
||||
void ReplaceAudioVisualBlockItemsFromString(ObservableCollection<IItemFilterBlockItem> blockItems, string inputString);
|
||||
|
||||
@@ -5,6 +5,7 @@ namespace Filtration.Parser.Interface.Services
|
||||
public interface IItemFilterScriptTranslator
|
||||
{
|
||||
IItemFilterScript TranslateStringToItemFilterScript(string inputString);
|
||||
IItemFilterScript TranslatePastedStringToItemFilterScript(string inputString, bool blockGroupsEnabled);
|
||||
string TranslateItemFilterScriptToString(IItemFilterScript script);
|
||||
}
|
||||
}
|
||||
@@ -18,11 +18,11 @@ namespace Filtration.Parser.Tests.Services
|
||||
var builder = new BlockGroupHierarchyBuilder();
|
||||
|
||||
// Act
|
||||
var result = builder.IntegrateStringListIntoBlockGroupHierarchy(inputStrings, rootBlock);
|
||||
var result = builder.IntegrateStringListIntoBlockGroupHierarchy(inputStrings, rootBlock, true, true);
|
||||
|
||||
// Assert
|
||||
Assert.AreEqual(1, rootBlock.ChildGroups.Count);
|
||||
Assert.AreEqual("Sub Block Group", result.GroupName);
|
||||
Assert.AreEqual("Sub Block Group", result.ParentGroup.GroupName);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -35,11 +35,11 @@ namespace Filtration.Parser.Tests.Services
|
||||
var builder = new BlockGroupHierarchyBuilder();
|
||||
|
||||
// Act
|
||||
var result = builder.IntegrateStringListIntoBlockGroupHierarchy(inputStrings, rootBlock);
|
||||
var result = builder.IntegrateStringListIntoBlockGroupHierarchy(inputStrings, rootBlock, true, true);
|
||||
|
||||
// Assert
|
||||
Assert.AreEqual(1, rootBlock.ChildGroups.Count);
|
||||
Assert.AreEqual("Block Group", result.GroupName);
|
||||
Assert.AreEqual("Block Group", result.ParentGroup.GroupName);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -52,12 +52,12 @@ namespace Filtration.Parser.Tests.Services
|
||||
var builder = new BlockGroupHierarchyBuilder();
|
||||
|
||||
// Act
|
||||
var result = builder.IntegrateStringListIntoBlockGroupHierarchy(inputStrings, rootBlock);
|
||||
var result = builder.IntegrateStringListIntoBlockGroupHierarchy(inputStrings, rootBlock, true, true);
|
||||
|
||||
// Assert
|
||||
Assert.AreEqual(1, rootBlock.ChildGroups.Count);
|
||||
Assert.AreEqual("Block Group", result.GroupName);
|
||||
Assert.AreEqual(true, result.Advanced);
|
||||
Assert.AreEqual("Block Group", result.ParentGroup.GroupName);
|
||||
Assert.AreEqual(true, result.ParentGroup.Advanced);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -70,11 +70,11 @@ namespace Filtration.Parser.Tests.Services
|
||||
var builder = new BlockGroupHierarchyBuilder();
|
||||
|
||||
// Act
|
||||
var result = builder.IntegrateStringListIntoBlockGroupHierarchy(inputStrings, rootBlock);
|
||||
var result = builder.IntegrateStringListIntoBlockGroupHierarchy(inputStrings, rootBlock, true, true);
|
||||
|
||||
// Assert
|
||||
Assert.AreEqual(1, rootBlock.ChildGroups.Count);
|
||||
Assert.AreEqual(true, result.Advanced);
|
||||
Assert.AreEqual(true, result.ParentGroup.Advanced);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -90,12 +90,12 @@ namespace Filtration.Parser.Tests.Services
|
||||
var builder = new BlockGroupHierarchyBuilder();
|
||||
|
||||
// Act
|
||||
var result = builder.IntegrateStringListIntoBlockGroupHierarchy(inputStrings, rootBlock);
|
||||
var result = builder.IntegrateStringListIntoBlockGroupHierarchy(inputStrings, rootBlock, true, true);
|
||||
|
||||
// Assert
|
||||
Assert.AreEqual(1, rootBlock.ChildGroups.Count);
|
||||
Assert.AreEqual("Block Group", result.GroupName);
|
||||
Assert.AreEqual(true, result.Advanced);
|
||||
Assert.AreEqual("Block Group", result.ParentGroup.GroupName);
|
||||
Assert.AreEqual(true, result.ParentGroup.Advanced);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -107,15 +107,15 @@ namespace Filtration.Parser.Tests.Services
|
||||
|
||||
// Act
|
||||
var inputStrings = new List<string> { "Block Group" };
|
||||
builder.IntegrateStringListIntoBlockGroupHierarchy(inputStrings, rootBlock);
|
||||
builder.IntegrateStringListIntoBlockGroupHierarchy(inputStrings, rootBlock, true, true);
|
||||
inputStrings = new List<string> { "Block Group 2" };
|
||||
builder.IntegrateStringListIntoBlockGroupHierarchy(inputStrings, rootBlock);
|
||||
builder.IntegrateStringListIntoBlockGroupHierarchy(inputStrings, rootBlock, true, true);
|
||||
inputStrings = new List<string> { "Block Group", "Sub Block Group" };
|
||||
var result = builder.IntegrateStringListIntoBlockGroupHierarchy(inputStrings, rootBlock);
|
||||
var result = builder.IntegrateStringListIntoBlockGroupHierarchy(inputStrings, rootBlock, true, true);
|
||||
|
||||
// Assert
|
||||
Assert.AreEqual(2, rootBlock.ChildGroups.Count);
|
||||
Assert.AreEqual("Sub Block Group", result.GroupName);
|
||||
Assert.AreEqual("Sub Block Group", result.ParentGroup.GroupName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace Filtration.Parser.Tests.Services
|
||||
|
||||
var inputBlockGroup = new ItemFilterBlockGroup("TestBlockGroup", null);
|
||||
_testUtility.MockBlockGroupHierarchyBuilder
|
||||
.Setup(b => b.IntegrateStringListIntoBlockGroupHierarchy(It.IsAny<IEnumerable<string>>()))
|
||||
.Setup(b => b.IntegrateStringListIntoBlockGroupHierarchy(It.IsAny<IEnumerable<string>>(), true, true))
|
||||
.Returns(inputBlockGroup);
|
||||
|
||||
// Act
|
||||
@@ -121,6 +121,7 @@ namespace Filtration.Parser.Tests.Services
|
||||
Assert.AreEqual(FilterPredicateOperator.GreaterThanOrEqual, blockItem.FilterPredicate.PredicateOperator);
|
||||
}
|
||||
|
||||
[Ignore("Update required, ItemFilterBlockTranslator does not set IsShowChecked anymore")]
|
||||
[Test]
|
||||
public void TranslateStringToItemFilterBlock_BlockGroupsEnabled_ShowBlock_SetsBlockGroupIsCheckedCorrectly()
|
||||
{
|
||||
@@ -129,13 +130,14 @@ namespace Filtration.Parser.Tests.Services
|
||||
var inputBlockGroup = new ItemFilterBlockGroup("TestBlockGroup", null);
|
||||
|
||||
// Act
|
||||
_testUtility.MockBlockGroupHierarchyBuilder.Setup(b => b.IntegrateStringListIntoBlockGroupHierarchy(It.IsAny<IEnumerable<string>>())).Returns(inputBlockGroup).Verifiable();
|
||||
_testUtility.MockBlockGroupHierarchyBuilder.Setup(b => b.IntegrateStringListIntoBlockGroupHierarchy(It.IsAny<IEnumerable<string>>(), true, true)).Returns(inputBlockGroup).Verifiable();
|
||||
_testUtility.Translator.TranslateStringToItemFilterBlock(inputString, Mock.Of<IItemFilterScript>(i => i.ItemFilterScriptSettings.BlockGroupsEnabled));
|
||||
|
||||
// Assert
|
||||
Assert.AreEqual(true, inputBlockGroup.IsChecked);
|
||||
Assert.AreEqual(true, inputBlockGroup.IsShowChecked);
|
||||
}
|
||||
|
||||
[Ignore("Update required, ItemFilterBlockTranslator does not set IsShowChecked anymore")]
|
||||
[Test]
|
||||
public void TranslateStringToItemFilterBlock_BlockGroupsEnabled_HideBlock_SetsBlockGroupIsCheckedCorrectly()
|
||||
{
|
||||
@@ -144,11 +146,11 @@ namespace Filtration.Parser.Tests.Services
|
||||
var inputBlockGroup = new ItemFilterBlockGroup("TestBlockGroup", null);
|
||||
|
||||
// Act
|
||||
_testUtility.MockBlockGroupHierarchyBuilder.Setup(b => b.IntegrateStringListIntoBlockGroupHierarchy(It.IsAny<IEnumerable<string>>())).Returns(inputBlockGroup).Verifiable();
|
||||
_testUtility.MockBlockGroupHierarchyBuilder.Setup(b => b.IntegrateStringListIntoBlockGroupHierarchy(It.IsAny<IEnumerable<string>>(), false, true)).Returns(inputBlockGroup).Verifiable();
|
||||
_testUtility.Translator.TranslateStringToItemFilterBlock(inputString, Mock.Of<IItemFilterScript>(i => i.ItemFilterScriptSettings.BlockGroupsEnabled));
|
||||
|
||||
// Assert
|
||||
Assert.AreEqual(false, inputBlockGroup.IsChecked);
|
||||
Assert.AreEqual(false, inputBlockGroup.IsShowChecked);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -159,7 +161,7 @@ namespace Filtration.Parser.Tests.Services
|
||||
var inputBlockGroup = new ItemFilterBlockGroup("TestBlockGroup", null);
|
||||
|
||||
// Act
|
||||
_testUtility.MockBlockGroupHierarchyBuilder.Setup(b => b.IntegrateStringListIntoBlockGroupHierarchy(It.IsAny<IEnumerable<string>>())).Returns(inputBlockGroup).Verifiable();
|
||||
_testUtility.MockBlockGroupHierarchyBuilder.Setup(b => b.IntegrateStringListIntoBlockGroupHierarchy(It.IsAny<IEnumerable<string>>(), true, true)).Returns(inputBlockGroup).Verifiable();
|
||||
_testUtility.Translator.TranslateStringToItemFilterBlock(inputString, Mock.Of<IItemFilterScript>(i => i.ItemFilterScriptSettings.BlockGroupsEnabled));
|
||||
|
||||
// Assert
|
||||
@@ -173,11 +175,11 @@ namespace Filtration.Parser.Tests.Services
|
||||
var inputString = "Show" + Environment.NewLine;
|
||||
|
||||
// Act
|
||||
_testUtility.MockBlockGroupHierarchyBuilder.Setup(b => b.IntegrateStringListIntoBlockGroupHierarchy(It.IsAny<IEnumerable<string>>())).Verifiable();
|
||||
_testUtility.MockBlockGroupHierarchyBuilder.Setup(b => b.IntegrateStringListIntoBlockGroupHierarchy(It.IsAny<IEnumerable<string>>(), true, true)).Verifiable();
|
||||
_testUtility.Translator.TranslateStringToItemFilterBlock(inputString, Mock.Of<IItemFilterScript>(i => i.ItemFilterScriptSettings.BlockGroupsEnabled));
|
||||
|
||||
// Assert
|
||||
_testUtility.MockBlockGroupHierarchyBuilder.Verify(b => b.IntegrateStringListIntoBlockGroupHierarchy(It.IsAny<IEnumerable<string>>()), Times.Never);
|
||||
_testUtility.MockBlockGroupHierarchyBuilder.Verify(b => b.IntegrateStringListIntoBlockGroupHierarchy(It.IsAny<IEnumerable<string>>(), true, true), Times.Never);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -190,7 +192,7 @@ namespace Filtration.Parser.Tests.Services
|
||||
_testUtility.Translator.TranslateStringToItemFilterBlock(inputString, Mock.Of<IItemFilterScript>(i => i.ItemFilterScriptSettings.BlockGroupsEnabled));
|
||||
|
||||
// Assert
|
||||
_testUtility.MockBlockGroupHierarchyBuilder.Verify(b => b.IntegrateStringListIntoBlockGroupHierarchy(It.IsAny<IEnumerable<string>>()), Times.Never);
|
||||
_testUtility.MockBlockGroupHierarchyBuilder.Verify(b => b.IntegrateStringListIntoBlockGroupHierarchy(It.IsAny<IEnumerable<string>>(), true, true), Times.Never);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -202,7 +204,7 @@ namespace Filtration.Parser.Tests.Services
|
||||
|
||||
// Act
|
||||
_testUtility.MockBlockGroupHierarchyBuilder
|
||||
.Setup(b => b.IntegrateStringListIntoBlockGroupHierarchy(It.Is<IEnumerable<string>>(s => s.Contains("Test Block Group") && s.Contains("Test Sub Block Group") && s.Contains("Test Another Block Group"))))
|
||||
.Setup(b => b.IntegrateStringListIntoBlockGroupHierarchy(It.Is<IEnumerable<string>>(s => s.Contains("Test Block Group") && s.Contains("Test Sub Block Group") && s.Contains("Test Another Block Group")), true, true))
|
||||
.Returns(testBlockGroup)
|
||||
.Verifiable();
|
||||
|
||||
@@ -222,7 +224,7 @@ namespace Filtration.Parser.Tests.Services
|
||||
|
||||
// Act
|
||||
_testUtility.MockBlockGroupHierarchyBuilder
|
||||
.Setup(b => b.IntegrateStringListIntoBlockGroupHierarchy(It.Is<IEnumerable<string>>(s => s.Contains("AAA-BBB-CCC"))))
|
||||
.Setup(b => b.IntegrateStringListIntoBlockGroupHierarchy(It.Is<IEnumerable<string>>(s => s.Contains("AAA-BBB-CCC")), true, true))
|
||||
.Returns(testBlockGroup)
|
||||
.Verifiable();
|
||||
|
||||
@@ -244,7 +246,7 @@ namespace Filtration.Parser.Tests.Services
|
||||
|
||||
// Assert
|
||||
Assert.IsNull(result.BlockGroup);
|
||||
_testUtility.MockBlockGroupHierarchyBuilder.Verify(b => b.IntegrateStringListIntoBlockGroupHierarchy(It.IsAny<IEnumerable<string>>()), Times.Never);
|
||||
_testUtility.MockBlockGroupHierarchyBuilder.Verify(b => b.IntegrateStringListIntoBlockGroupHierarchy(It.IsAny<IEnumerable<string>>(), true, true), Times.Never);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -318,6 +320,42 @@ namespace Filtration.Parser.Tests.Services
|
||||
Assert.AreEqual(FilterPredicateOperator.Equal, blockItem.FilterPredicate.PredicateOperator);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TranslateStringToItemFilterBlock_GemLevel_ReturnsCorrectObject()
|
||||
{
|
||||
// Arrange
|
||||
var inputString = "Show" + Environment.NewLine +
|
||||
" GemLevel = 20";
|
||||
|
||||
// Act
|
||||
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, _testUtility.MockItemFilterScript);
|
||||
|
||||
// Assert
|
||||
|
||||
Assert.AreEqual(1, result.BlockItems.Count(b => b is GemLevelBlockItem));
|
||||
var blockItem = result.BlockItems.OfType<GemLevelBlockItem>().First();
|
||||
Assert.AreEqual(20, blockItem.FilterPredicate.PredicateOperand);
|
||||
Assert.AreEqual(FilterPredicateOperator.Equal, blockItem.FilterPredicate.PredicateOperator);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TranslateStringToItemFilterBlock_StackSize_ReturnsCorrectObject()
|
||||
{
|
||||
// Arrange
|
||||
var inputString = "Show" + Environment.NewLine +
|
||||
" StackSize > 5";
|
||||
|
||||
// Act
|
||||
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, _testUtility.MockItemFilterScript);
|
||||
|
||||
// Assert
|
||||
|
||||
Assert.AreEqual(1, result.BlockItems.Count(b => b is StackSizeBlockItem));
|
||||
var blockItem = result.BlockItems.OfType<StackSizeBlockItem>().First();
|
||||
Assert.AreEqual(5, blockItem.FilterPredicate.PredicateOperand);
|
||||
Assert.AreEqual(FilterPredicateOperator.GreaterThan, blockItem.FilterPredicate.PredicateOperator);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TranslateStringToItemFilterBlock_Corrupted_ReturnsCorrectObject()
|
||||
{
|
||||
@@ -369,6 +407,24 @@ namespace Filtration.Parser.Tests.Services
|
||||
Assert.IsTrue(blockItem.BooleanValue);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TranslateStringToItemFilterBlock_MapTier_ReturnsCorrectObject()
|
||||
{
|
||||
// Arrange
|
||||
var inputString = "Show" + Environment.NewLine +
|
||||
" MapTier >= 15";
|
||||
|
||||
// Act
|
||||
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, _testUtility.MockItemFilterScript);
|
||||
|
||||
// Assert
|
||||
|
||||
Assert.AreEqual(1, result.BlockItems.Count(b => b is MapTierBlockItem));
|
||||
var blockItem = result.BlockItems.OfType<MapTierBlockItem>().First();
|
||||
Assert.AreEqual(15, blockItem.FilterPredicate.PredicateOperand);
|
||||
Assert.AreEqual(FilterPredicateOperator.GreaterThanOrEqual, blockItem.FilterPredicate.PredicateOperator);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TranslateStringToItemFilterBlock_ShapedMap_ReturnsCorrectObject()
|
||||
{
|
||||
@@ -386,6 +442,23 @@ namespace Filtration.Parser.Tests.Services
|
||||
Assert.IsFalse(blockItem.BooleanValue);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TranslateStringToItemFilterBlock_ElderMap_ReturnsCorrectObject()
|
||||
{
|
||||
// Arrange
|
||||
var inputString = "Show" + Environment.NewLine +
|
||||
" ElderMap false";
|
||||
|
||||
// Act
|
||||
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, _testUtility.MockItemFilterScript);
|
||||
|
||||
// Assert
|
||||
|
||||
Assert.AreEqual(1, result.BlockItems.Count(b => b is ElderMapBlockItem));
|
||||
var blockItem = result.BlockItems.OfType<ElderMapBlockItem>().First();
|
||||
Assert.IsFalse(blockItem.BooleanValue);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TranslateStringToItemFilterBlock_Identified_ReturnsCorrectObject()
|
||||
{
|
||||
@@ -494,6 +567,25 @@ namespace Filtration.Parser.Tests.Services
|
||||
Assert.Contains("Test BaseType 2", blockItem.Items);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TranslateStringToItemFilterBlock_HasExplicitMod_ReturnsCorrectObject()
|
||||
{
|
||||
// Arrange
|
||||
var inputString = "Show" + Environment.NewLine +
|
||||
@" HasExplicitMod ""Test Mod 1"" ""TestOneWordModInQuotes"" TestOneWordModNotInQuotes ""Test Mod 2""";
|
||||
|
||||
// Act
|
||||
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, _testUtility.MockItemFilterScript);
|
||||
|
||||
// Assert
|
||||
Assert.AreEqual(1, result.BlockItems.Count(b => b is HasExplicitModBlockItem));
|
||||
var blockItem = result.BlockItems.OfType<HasExplicitModBlockItem>().First();
|
||||
Assert.Contains("Test Mod 1", blockItem.Items);
|
||||
Assert.Contains("TestOneWordModInQuotes", blockItem.Items);
|
||||
Assert.Contains("TestOneWordModNotInQuotes", blockItem.Items);
|
||||
Assert.Contains("Test Mod 2", blockItem.Items);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TranslateStringToItemFilterBlock_Sockets_ReturnsCorrectObject()
|
||||
{
|
||||
@@ -701,7 +793,7 @@ namespace Filtration.Parser.Tests.Services
|
||||
// Arrange
|
||||
var inputString = "Show" + Environment.NewLine +
|
||||
" SetTextColor 255 20 100 # Rare Item Text";
|
||||
var testComponent = new ThemeComponent(ThemeComponentType.TextColor, "Rare Item Text", new Color { R = 255, G = 20, B = 100});
|
||||
var testComponent = new ColorThemeComponent(ThemeComponentType.TextColor, "Rare Item Text", new Color { A = 240, R = 255, G = 20, B = 100});
|
||||
var testInputThemeComponentCollection = new ThemeComponentCollection { testComponent };
|
||||
|
||||
// Act
|
||||
@@ -803,6 +895,23 @@ namespace Filtration.Parser.Tests.Services
|
||||
Assert.AreEqual(95, blockItem.SecondValue);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TranslateStringToItemFilterBlock_DisableDropSound_ReturnsCorrectObject()
|
||||
{
|
||||
// Arrange
|
||||
var inputString = "Show" + Environment.NewLine +
|
||||
" DisableDropSound True";
|
||||
|
||||
// Act
|
||||
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, _testUtility.MockItemFilterScript);
|
||||
|
||||
// Assert
|
||||
|
||||
Assert.AreEqual(1, result.BlockItems.Count(b => b is DisableDropSoundBlockItem));
|
||||
var blockItem = result.BlockItems.OfType<DisableDropSoundBlockItem>().First();
|
||||
Assert.IsTrue(blockItem.BooleanValue);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TranslateStringToItemFilterBlock_Everything_ReturnsCorrectObject()
|
||||
{
|
||||
@@ -813,6 +922,8 @@ namespace Filtration.Parser.Tests.Services
|
||||
"Show" + Environment.NewLine +
|
||||
" ItemLevel >= 50" + Environment.NewLine +
|
||||
" DropLevel < 70" + Environment.NewLine +
|
||||
" GemLevel = 20" + Environment.NewLine +
|
||||
" StackSize > 2" + Environment.NewLine +
|
||||
" Quality = 15" + Environment.NewLine +
|
||||
" Rarity <= Unique" + Environment.NewLine +
|
||||
" Identified True" + Environment.NewLine +
|
||||
@@ -820,8 +931,10 @@ namespace Filtration.Parser.Tests.Services
|
||||
" ElderItem true" + Environment.NewLine +
|
||||
" ShaperItem False" + Environment.NewLine +
|
||||
" ShapedMap TRUE" + Environment.NewLine +
|
||||
" ElderMap False" + Environment.NewLine +
|
||||
@" Class ""My Item Class"" AnotherClass ""AndAnotherClass""" + Environment.NewLine +
|
||||
@" BaseType MyBaseType ""Another BaseType""" + Environment.NewLine +
|
||||
@" HasExplicitMod MyMod ""Another Mod""" + Environment.NewLine +
|
||||
" JunkLine Let's ignore this one!" + Environment.NewLine +
|
||||
" #Quality Commented out quality line" + Environment.NewLine +
|
||||
" Sockets >= 3" + Environment.NewLine +
|
||||
@@ -831,7 +944,11 @@ namespace Filtration.Parser.Tests.Services
|
||||
" SetBackgroundColor 255 100 5" + Environment.NewLine +
|
||||
" SetBorderColor 0 0 0" + Environment.NewLine +
|
||||
" SetFontSize 50" + Environment.NewLine +
|
||||
" PlayAlertSound 3" + Environment.NewLine;
|
||||
" PlayAlertSound 3" + Environment.NewLine +
|
||||
" DisableDropSound False" + Environment.NewLine +
|
||||
" CustomAlertSound \"test.mp3\" # customSoundTheme" + Environment.NewLine +
|
||||
" MinimapIcon 2 Green Triangle # iconTheme" + Environment.NewLine +
|
||||
" PlayEffect Green Temp # effectTheme" + Environment.NewLine;
|
||||
|
||||
// Act
|
||||
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, _testUtility.MockItemFilterScript);
|
||||
@@ -857,10 +974,21 @@ namespace Filtration.Parser.Tests.Services
|
||||
var shapedMapBlockItem = result.BlockItems.OfType<ShapedMapBlockItem>().First();
|
||||
Assert.IsTrue(shapedMapBlockItem.BooleanValue);
|
||||
|
||||
var elderMapBlockItem = result.BlockItems.OfType<ElderMapBlockItem>().First();
|
||||
Assert.IsFalse(elderMapBlockItem.BooleanValue);
|
||||
|
||||
var dropLevelblockItem = result.BlockItems.OfType<DropLevelBlockItem>().First();
|
||||
Assert.AreEqual(FilterPredicateOperator.LessThan, dropLevelblockItem.FilterPredicate.PredicateOperator);
|
||||
Assert.AreEqual(70, dropLevelblockItem.FilterPredicate.PredicateOperand);
|
||||
|
||||
var gemLevelBlockItem = result.BlockItems.OfType<GemLevelBlockItem>().First();
|
||||
Assert.AreEqual(FilterPredicateOperator.Equal, gemLevelBlockItem.FilterPredicate.PredicateOperator);
|
||||
Assert.AreEqual(20, gemLevelBlockItem.FilterPredicate.PredicateOperand);
|
||||
|
||||
var stackSizeBlockItem = result.BlockItems.OfType<StackSizeBlockItem>().First();
|
||||
Assert.AreEqual(FilterPredicateOperator.GreaterThan, stackSizeBlockItem.FilterPredicate.PredicateOperator);
|
||||
Assert.AreEqual(2, stackSizeBlockItem.FilterPredicate.PredicateOperand);
|
||||
|
||||
var qualityblockItem = result.BlockItems.OfType<QualityBlockItem>().First();
|
||||
Assert.AreEqual(FilterPredicateOperator.Equal, qualityblockItem.FilterPredicate.PredicateOperator);
|
||||
Assert.AreEqual(15, qualityblockItem.FilterPredicate.PredicateOperand);
|
||||
@@ -880,6 +1008,11 @@ namespace Filtration.Parser.Tests.Services
|
||||
Assert.Contains("MyBaseType", baseTypeblockItem.Items);
|
||||
Assert.Contains("Another BaseType", baseTypeblockItem.Items);
|
||||
|
||||
var hasExplicitModBlockItem = result.BlockItems.OfType<HasExplicitModBlockItem>().First();
|
||||
Assert.AreEqual(2, hasExplicitModBlockItem.Items.Count);
|
||||
Assert.Contains("MyMod", hasExplicitModBlockItem.Items);
|
||||
Assert.Contains("Another Mod", hasExplicitModBlockItem.Items);
|
||||
|
||||
var socketsblockItem = result.BlockItems.OfType<SocketsBlockItem>().First();
|
||||
Assert.AreEqual(FilterPredicateOperator.GreaterThanOrEqual, socketsblockItem.FilterPredicate.PredicateOperator);
|
||||
Assert.AreEqual(3, socketsblockItem.FilterPredicate.PredicateOperand);
|
||||
@@ -914,9 +1047,40 @@ namespace Filtration.Parser.Tests.Services
|
||||
var fontSizeblockItem = result.BlockItems.OfType<FontSizeBlockItem>().First();
|
||||
Assert.AreEqual(50, fontSizeblockItem.Value);
|
||||
|
||||
var soundblockItem = result.BlockItems.OfType<SoundBlockItem>().First();
|
||||
Assert.AreEqual("3", soundblockItem.Value);
|
||||
Assert.AreEqual(79, soundblockItem.SecondValue);
|
||||
Assert.AreEqual(0, result.BlockItems.OfType<SoundBlockItem>().Count());
|
||||
|
||||
var disableDropSoundBlockItem = result.BlockItems.OfType<DisableDropSoundBlockItem>().First();
|
||||
Assert.IsFalse(disableDropSoundBlockItem.BooleanValue);
|
||||
|
||||
var customSoundBlockItem = result.BlockItems.OfType<CustomSoundBlockItem>().First();
|
||||
Assert.AreEqual("test.mp3", customSoundBlockItem.Value);
|
||||
Assert.AreNotEqual(null, customSoundBlockItem.ThemeComponent);
|
||||
Assert.AreEqual(ThemeComponentType.CustomSound, customSoundBlockItem.ThemeComponent.ComponentType);
|
||||
Assert.AreEqual("customSoundTheme", customSoundBlockItem.ThemeComponent.ComponentName);
|
||||
Assert.AreEqual(typeof(StringThemeComponent), customSoundBlockItem.ThemeComponent.GetType());
|
||||
Assert.AreEqual("test.mp3", ((StringThemeComponent)customSoundBlockItem.ThemeComponent).Value);
|
||||
|
||||
var mapIconBlockItem = result.BlockItems.OfType<MapIconBlockItem>().First();
|
||||
Assert.AreEqual(IconSize.Small, mapIconBlockItem.Size);
|
||||
Assert.AreEqual(IconColor.Green, mapIconBlockItem.Color);
|
||||
Assert.AreEqual(IconShape.Triangle, mapIconBlockItem.Shape);
|
||||
Assert.AreNotEqual(null, mapIconBlockItem.ThemeComponent);
|
||||
Assert.AreEqual(ThemeComponentType.Icon, mapIconBlockItem.ThemeComponent.ComponentType);
|
||||
Assert.AreEqual("iconTheme", mapIconBlockItem.ThemeComponent.ComponentName);
|
||||
Assert.AreEqual(typeof(IconThemeComponent), mapIconBlockItem.ThemeComponent.GetType());
|
||||
Assert.AreEqual(IconSize.Small, ((IconThemeComponent)mapIconBlockItem.ThemeComponent).IconSize);
|
||||
Assert.AreEqual(IconColor.Green, ((IconThemeComponent)mapIconBlockItem.ThemeComponent).IconColor);
|
||||
Assert.AreEqual(IconShape.Triangle, ((IconThemeComponent)mapIconBlockItem.ThemeComponent).IconShape);
|
||||
|
||||
var effectColorBlockItem = result.BlockItems.OfType<EffectColorBlockItem>().First();
|
||||
Assert.AreEqual(EffectColor.Green, effectColorBlockItem.Color);
|
||||
Assert.IsTrue(effectColorBlockItem.Temporary);
|
||||
Assert.AreNotEqual(null, effectColorBlockItem.ThemeComponent);
|
||||
Assert.AreEqual(ThemeComponentType.Effect, effectColorBlockItem.ThemeComponent.ComponentType);
|
||||
Assert.AreEqual("effectTheme", effectColorBlockItem.ThemeComponent.ComponentName);
|
||||
Assert.AreEqual(typeof(EffectColorThemeComponent), effectColorBlockItem.ThemeComponent.GetType());
|
||||
Assert.AreEqual(EffectColor.Green, ((EffectColorThemeComponent)effectColorBlockItem.ThemeComponent).EffectColor);
|
||||
Assert.IsTrue(((EffectColorThemeComponent)effectColorBlockItem.ThemeComponent).Temporary);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -1144,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()
|
||||
{
|
||||
@@ -1151,6 +1395,8 @@ namespace Filtration.Parser.Tests.Services
|
||||
var expectedResult = "Show";
|
||||
|
||||
// Act
|
||||
// TODO: Shouldn't be set to edited this way
|
||||
_testUtility.TestBlock.IsEdited = true;
|
||||
var result = _testUtility.Translator.TranslateItemFilterBlockToString(_testUtility.TestBlock);
|
||||
|
||||
// Assert
|
||||
@@ -1168,6 +1414,8 @@ namespace Filtration.Parser.Tests.Services
|
||||
var child2BlockGroup = new ItemFilterBlockGroup("Child 2 Block Group", child1BlockGroup);
|
||||
_testUtility.TestBlock.BlockGroup = child2BlockGroup;
|
||||
|
||||
// TODO: Shouldn't be set to edited this way
|
||||
_testUtility.TestBlock.IsEdited = true;
|
||||
// Act
|
||||
var result = _testUtility.Translator.TranslateItemFilterBlockToString(_testUtility.TestBlock);
|
||||
|
||||
@@ -1183,6 +1431,8 @@ namespace Filtration.Parser.Tests.Services
|
||||
var expectedResult = $"Show #{testInputActionBlockComment}";
|
||||
|
||||
_testUtility.TestBlock.BlockItems.OfType<ActionBlockItem>().First().Comment = testInputActionBlockComment;
|
||||
// TODO: Shouldn't be set to edited this way
|
||||
_testUtility.TestBlock.IsEdited = true;
|
||||
|
||||
// Act
|
||||
var result = _testUtility.Translator.TranslateItemFilterBlockToString(_testUtility.TestBlock);
|
||||
@@ -1334,6 +1584,38 @@ namespace Filtration.Parser.Tests.Services
|
||||
Assert.AreEqual(expectedResult, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TranslateItemFilterBlockToString_GemLevel_ReturnsCorrectString()
|
||||
{
|
||||
// Arrange
|
||||
var expectedResult = "Show" + Environment.NewLine +
|
||||
" GemLevel <= 15";
|
||||
|
||||
_testUtility.TestBlock.BlockItems.Add(new GemLevelBlockItem(FilterPredicateOperator.LessThanOrEqual, 15));
|
||||
|
||||
// Act
|
||||
var result = _testUtility.Translator.TranslateItemFilterBlockToString(_testUtility.TestBlock);
|
||||
|
||||
// Assert
|
||||
Assert.AreEqual(expectedResult, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TranslateItemFilterBlockToString_StackSize_ReturnsCorrectString()
|
||||
{
|
||||
// Arrange
|
||||
var expectedResult = "Show" + Environment.NewLine +
|
||||
" StackSize = 5";
|
||||
|
||||
_testUtility.TestBlock.BlockItems.Add(new StackSizeBlockItem(FilterPredicateOperator.Equal, 5));
|
||||
|
||||
// Act
|
||||
var result = _testUtility.Translator.TranslateItemFilterBlockToString(_testUtility.TestBlock);
|
||||
|
||||
// Assert
|
||||
Assert.AreEqual(expectedResult, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TranslateItemFilterBlockToString_Quality_ReturnsCorrectString()
|
||||
{
|
||||
@@ -1425,6 +1707,26 @@ namespace Filtration.Parser.Tests.Services
|
||||
Assert.AreEqual(expectedResult, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TranslateItemFilterBlockToString_HasExplicitMod_ReturnsCorrectString()
|
||||
{
|
||||
// Arrange
|
||||
var expectedResult = "Show" + Environment.NewLine +
|
||||
" HasExplicitMod \"Test Mod\" \"Another Mod\" \"Yet Another Mod\"";
|
||||
|
||||
var hasExplicitModBlockItem = new HasExplicitModBlockItem();
|
||||
hasExplicitModBlockItem.Items.Add("Test Mod");
|
||||
hasExplicitModBlockItem.Items.Add("Another Mod");
|
||||
hasExplicitModBlockItem.Items.Add("Yet Another Mod");
|
||||
_testUtility.TestBlock.BlockItems.Add(hasExplicitModBlockItem);
|
||||
|
||||
// Act
|
||||
var result = _testUtility.Translator.TranslateItemFilterBlockToString(_testUtility.TestBlock);
|
||||
|
||||
// Assert
|
||||
Assert.AreEqual(expectedResult, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TranslateItemFilterBlockToString_Sockets_ReturnsCorrectString()
|
||||
{
|
||||
@@ -1515,7 +1817,7 @@ namespace Filtration.Parser.Tests.Services
|
||||
var expectedResult = "Show" + Environment.NewLine +
|
||||
" SetTextColor 54 102 255";
|
||||
|
||||
_testUtility.TestBlock.BlockItems.Add(new TextColorBlockItem(new Color {A = 255, R = 54, G = 102, B = 255}));
|
||||
_testUtility.TestBlock.BlockItems.Add(new TextColorBlockItem(new Color {A = 240, R = 54, G = 102, B = 255}));
|
||||
|
||||
// Act
|
||||
var result = _testUtility.Translator.TranslateItemFilterBlockToString(_testUtility.TestBlock);
|
||||
@@ -1531,9 +1833,9 @@ namespace Filtration.Parser.Tests.Services
|
||||
var expectedResult = "Show" + Environment.NewLine +
|
||||
" SetTextColor 54 102 255 # Test Theme Component";
|
||||
|
||||
var blockItem = new TextColorBlockItem(new Color {A = 255, R = 54, G = 102, B = 255})
|
||||
var blockItem = new TextColorBlockItem(new Color {A = 240, R = 54, G = 102, B = 255})
|
||||
{
|
||||
ThemeComponent = new ThemeComponent(ThemeComponentType.TextColor, "Test Theme Component", new Color())
|
||||
ThemeComponent = new ColorThemeComponent(ThemeComponentType.TextColor, "Test Theme Component", new Color())
|
||||
};
|
||||
|
||||
_testUtility.TestBlock.BlockItems.Add(blockItem);
|
||||
@@ -1671,10 +1973,8 @@ namespace Filtration.Parser.Tests.Services
|
||||
public void TranslateItemFilterBlockToString_DisabledBlock_ReturnsCorrectString()
|
||||
{
|
||||
// Arrange
|
||||
var expectedResult = "#Disabled Block Start" + Environment.NewLine +
|
||||
"#Show" + Environment.NewLine +
|
||||
"# Width = 4" + Environment.NewLine +
|
||||
"#Disabled Block End";
|
||||
var expectedResult = "#Show" + Environment.NewLine +
|
||||
"# Width = 4";
|
||||
|
||||
|
||||
_testUtility.TestBlock.Enabled = false;
|
||||
@@ -1699,21 +1999,30 @@ namespace Filtration.Parser.Tests.Services
|
||||
" Corrupted False" + Environment.NewLine +
|
||||
" ElderItem True" + Environment.NewLine +
|
||||
" ShaperItem False" + Environment.NewLine +
|
||||
" MapTier < 10" + Environment.NewLine +
|
||||
" ShapedMap True" + Environment.NewLine +
|
||||
" ElderMap True" + Environment.NewLine +
|
||||
" Height <= 6" + Environment.NewLine +
|
||||
" Height >= 2" + Environment.NewLine +
|
||||
" Width = 3" + Environment.NewLine +
|
||||
" ItemLevel > 70" + Environment.NewLine +
|
||||
" ItemLevel <= 85" + Environment.NewLine +
|
||||
" DropLevel > 56" + Environment.NewLine +
|
||||
" GemLevel < 15" + Environment.NewLine +
|
||||
" StackSize >= 4" + Environment.NewLine +
|
||||
" Rarity = Unique" + Environment.NewLine +
|
||||
" Class \"Body Armour\" \"Gloves\" \"Belt\" \"Two Hand Axes\"" + Environment.NewLine +
|
||||
" BaseType \"Greater Life Flask\" \"Simple Robe\" \"Full Wyrmscale\"" + Environment.NewLine +
|
||||
" HasExplicitMod \"Guatelitzi's\" \"of Tacati\" \"Tyrannical\"" + Environment.NewLine +
|
||||
" SetTextColor 255 89 0 56" + Environment.NewLine +
|
||||
" SetBackgroundColor 0 0 0" + Environment.NewLine +
|
||||
" SetBorderColor 255 1 254" + Environment.NewLine +
|
||||
" SetFontSize 50" + Environment.NewLine +
|
||||
" PlayAlertSound 6 90";
|
||||
" PlayAlertSound 6 90" + Environment.NewLine +
|
||||
" DisableDropSound True" + Environment.NewLine +
|
||||
" MinimapIcon 1 Blue Circle" + Environment.NewLine +
|
||||
" PlayEffect Red Temp" + Environment.NewLine +
|
||||
" CustomAlertSound \"test.mp3\"";
|
||||
|
||||
_testUtility.TestBlock.BlockItems.Add(new ActionBlockItem(BlockAction.Show));
|
||||
_testUtility.TestBlock.BlockItems.Add(new IdentifiedBlockItem(true));
|
||||
@@ -1722,6 +2031,8 @@ namespace Filtration.Parser.Tests.Services
|
||||
_testUtility.TestBlock.BlockItems.Add(new ItemLevelBlockItem(FilterPredicateOperator.GreaterThan, 70));
|
||||
_testUtility.TestBlock.BlockItems.Add(new ItemLevelBlockItem(FilterPredicateOperator.LessThanOrEqual, 85));
|
||||
_testUtility.TestBlock.BlockItems.Add(new DropLevelBlockItem(FilterPredicateOperator.GreaterThan, 56));
|
||||
_testUtility.TestBlock.BlockItems.Add(new GemLevelBlockItem(FilterPredicateOperator.LessThan, 15));
|
||||
_testUtility.TestBlock.BlockItems.Add(new StackSizeBlockItem(FilterPredicateOperator.GreaterThanOrEqual, 4));
|
||||
_testUtility.TestBlock.BlockItems.Add(new QualityBlockItem(FilterPredicateOperator.GreaterThan, 2));
|
||||
_testUtility.TestBlock.BlockItems.Add(new RarityBlockItem(FilterPredicateOperator.Equal, (int)ItemRarity.Unique));
|
||||
var classItemblockItem = new ClassBlockItem();
|
||||
@@ -1735,19 +2046,30 @@ namespace Filtration.Parser.Tests.Services
|
||||
baseTypeItemblockItem.Items.Add("Simple Robe");
|
||||
baseTypeItemblockItem.Items.Add("Full Wyrmscale");
|
||||
_testUtility.TestBlock.BlockItems.Add(baseTypeItemblockItem);
|
||||
var hasExplicitModBlockItem = new HasExplicitModBlockItem();
|
||||
hasExplicitModBlockItem.Items.Add("Guatelitzi's");
|
||||
hasExplicitModBlockItem.Items.Add("of Tacati");
|
||||
hasExplicitModBlockItem.Items.Add("Tyrannical");
|
||||
_testUtility.TestBlock.BlockItems.Add(hasExplicitModBlockItem);
|
||||
_testUtility.TestBlock.BlockItems.Add(new SocketsBlockItem(FilterPredicateOperator.LessThanOrEqual, 6));
|
||||
_testUtility.TestBlock.BlockItems.Add(new LinkedSocketsBlockItem(FilterPredicateOperator.GreaterThanOrEqual, 4));
|
||||
_testUtility.TestBlock.BlockItems.Add(new WidthBlockItem(FilterPredicateOperator.Equal, 3));
|
||||
_testUtility.TestBlock.BlockItems.Add(new HeightBlockItem(FilterPredicateOperator.LessThanOrEqual, 6));
|
||||
_testUtility.TestBlock.BlockItems.Add(new HeightBlockItem(FilterPredicateOperator.GreaterThanOrEqual, 2));
|
||||
_testUtility.TestBlock.BlockItems.Add(new TextColorBlockItem(new Color {A = 56, R = 255, G = 89, B = 0}));
|
||||
_testUtility.TestBlock.BlockItems.Add(new BackgroundColorBlockItem(new Color { A = 255, R = 0, G = 0, B = 0 }));
|
||||
_testUtility.TestBlock.BlockItems.Add(new BorderColorBlockItem(new Color { A = 255, R = 255, G = 1, B = 254 }));
|
||||
_testUtility.TestBlock.BlockItems.Add(new BackgroundColorBlockItem(new Color { A = 240, R = 0, G = 0, B = 0 }));
|
||||
_testUtility.TestBlock.BlockItems.Add(new BorderColorBlockItem(new Color { A = 240, R = 255, G = 1, B = 254 }));
|
||||
_testUtility.TestBlock.BlockItems.Add(new FontSizeBlockItem(50));
|
||||
_testUtility.TestBlock.BlockItems.Add(new SoundBlockItem("6", 90));
|
||||
_testUtility.TestBlock.BlockItems.Add(new ElderItemBlockItem(true));
|
||||
_testUtility.TestBlock.BlockItems.Add(new ShaperItemBlockItem(false));
|
||||
_testUtility.TestBlock.BlockItems.Add(new ShapedMapBlockItem(true));
|
||||
_testUtility.TestBlock.BlockItems.Add(new ElderMapBlockItem(true));
|
||||
_testUtility.TestBlock.BlockItems.Add(new CustomSoundBlockItem("test.mp3"));
|
||||
_testUtility.TestBlock.BlockItems.Add(new MapTierBlockItem(FilterPredicateOperator.LessThan, 10));
|
||||
_testUtility.TestBlock.BlockItems.Add(new MapIconBlockItem(IconSize.Medium, IconColor.Blue, IconShape.Circle));
|
||||
_testUtility.TestBlock.BlockItems.Add(new PlayEffectBlockItem(EffectColor.Red, true));
|
||||
_testUtility.TestBlock.BlockItems.Add(new DisableDropSoundBlockItem(true));
|
||||
|
||||
// Act
|
||||
var result = _testUtility.Translator.TranslateItemFilterBlockToString(_testUtility.TestBlock);
|
||||
@@ -1773,7 +2095,7 @@ namespace Filtration.Parser.Tests.Services
|
||||
var textColorBlockItem = testInputBlockItems.First(b => b is TextColorBlockItem) as TextColorBlockItem;
|
||||
Assert.IsNotNull(textColorBlockItem);
|
||||
Assert.AreNotSame(testInputBlockItem, textColorBlockItem);
|
||||
Assert.AreEqual(new Color { R = 240, G = 200, B = 150, A = 255}, textColorBlockItem.Color);
|
||||
Assert.AreEqual(new Color { R = 240, G = 200, B = 150, A = 240}, textColorBlockItem.Color);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -1864,17 +2186,17 @@ namespace Filtration.Parser.Tests.Services
|
||||
var textColorBlockItem = testInputBlockItems.First(b => b is TextColorBlockItem) as TextColorBlockItem;
|
||||
Assert.IsNotNull(textColorBlockItem);
|
||||
Assert.AreNotSame(testInputTextColorBlockItem, textColorBlockItem);
|
||||
Assert.AreEqual(new Color {A = 255, R = 240, G = 200, B = 150}, textColorBlockItem.Color);
|
||||
Assert.AreEqual(new Color {A = 240, R = 240, G = 200, B = 150}, textColorBlockItem.Color);
|
||||
|
||||
var backgroundColorBlockItem = testInputBlockItems.First(b => b is BackgroundColorBlockItem) as BackgroundColorBlockItem;
|
||||
Assert.IsNotNull(backgroundColorBlockItem);
|
||||
Assert.AreNotSame(testInputBackgroundColorBlockItem, backgroundColorBlockItem);
|
||||
Assert.AreEqual(new Color { A = 255, R = 0, G = 0, B = 0 }, backgroundColorBlockItem.Color);
|
||||
Assert.AreEqual(new Color { A = 240, R = 0, G = 0, B = 0 }, backgroundColorBlockItem.Color);
|
||||
|
||||
var borderColorBlockItem = testInputBlockItems.First(b => b is BorderColorBlockItem) as BorderColorBlockItem;
|
||||
Assert.IsNotNull(borderColorBlockItem);
|
||||
Assert.AreNotSame(testInputBorderColorBlockItem, borderColorBlockItem);
|
||||
Assert.AreEqual(new Color { A = 255, R = 255, G = 255, B = 255 }, borderColorBlockItem.Color);
|
||||
Assert.AreEqual(new Color { A = 240, R = 255, G = 255, B = 255 }, borderColorBlockItem.Color);
|
||||
|
||||
var soundBlockItem = testInputBlockItems.First(b => b is SoundBlockItem) as SoundBlockItem;
|
||||
Assert.IsNotNull(soundBlockItem);
|
||||
@@ -1900,15 +2222,15 @@ namespace Filtration.Parser.Tests.Services
|
||||
// Assert
|
||||
var textColorBlockItem = testInputBlockItems.First(b => b is TextColorBlockItem) as TextColorBlockItem;
|
||||
Assert.IsNotNull(textColorBlockItem);
|
||||
Assert.AreEqual(new Color { A = 255, R = 240, G = 200, B = 150 }, textColorBlockItem.Color);
|
||||
Assert.AreEqual(new Color { A = 240, R = 240, G = 200, B = 150 }, textColorBlockItem.Color);
|
||||
|
||||
var backgroundColorBlockItem = testInputBlockItems.First(b => b is BackgroundColorBlockItem) as BackgroundColorBlockItem;
|
||||
Assert.IsNotNull(backgroundColorBlockItem);
|
||||
Assert.AreEqual(new Color { A = 255, R = 0, G = 0, B = 0 }, backgroundColorBlockItem.Color);
|
||||
Assert.AreEqual(new Color { A = 240, R = 0, G = 0, B = 0 }, backgroundColorBlockItem.Color);
|
||||
|
||||
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);
|
||||
Assert.AreEqual(new Color { A = 240, R = 255, G = 255, B = 255 }, borderColorBlockItem.Color);
|
||||
|
||||
var soundBlockItem = testInputBlockItems.First(b => b is SoundBlockItem) as SoundBlockItem;
|
||||
Assert.IsNotNull(soundBlockItem);
|
||||
@@ -1937,11 +2259,11 @@ namespace Filtration.Parser.Tests.Services
|
||||
// Assert
|
||||
var textColorBlockItem = testInputBlockItems.First(b => b is TextColorBlockItem) as TextColorBlockItem;
|
||||
Assert.IsNotNull(textColorBlockItem);
|
||||
Assert.AreEqual(new Color { A = 255, R = 240, G = 200, B = 150 }, textColorBlockItem.Color);
|
||||
Assert.AreEqual(new Color { A = 240, R = 240, G = 200, B = 150 }, textColorBlockItem.Color);
|
||||
|
||||
var backgroundColorBlockItem = testInputBlockItems.First(b => b is BackgroundColorBlockItem) as BackgroundColorBlockItem;
|
||||
Assert.IsNotNull(backgroundColorBlockItem);
|
||||
Assert.AreEqual(new Color { A = 255, R = 0, G = 0, B = 0 }, backgroundColorBlockItem.Color);
|
||||
Assert.AreEqual(new Color { A = 240, R = 0, G = 0, B = 0 }, backgroundColorBlockItem.Color);
|
||||
|
||||
Assert.AreEqual(0, testInputBlockItems.Count(b => b is BorderColorBlockItem));
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ namespace Filtration.Parser.Tests.Services
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Ignore("Outdated item filter")]
|
||||
public void TranslateStringToItemFilterScript_ReturnsScriptWithCorrectNumberOfBlocks()
|
||||
{
|
||||
// Arrange
|
||||
@@ -40,7 +41,7 @@ namespace Filtration.Parser.Tests.Services
|
||||
|
||||
// Assert
|
||||
Assert.AreEqual(5, script.ItemFilterBlocks.Count);
|
||||
mockItemFilterBlockTranslator.Verify(t => t.TranslateStringToItemFilterBlock(It.IsAny<string>(), It.IsAny<IItemFilterScript>(), false));
|
||||
mockItemFilterBlockTranslator.Verify(t => t.TranslateStringToItemFilterBlock(It.IsAny<string>(), It.IsAny<IItemFilterScript>(), "", false));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -95,14 +96,30 @@ namespace Filtration.Parser.Tests.Services
|
||||
// Assert
|
||||
var expectedResult = Mock.Of<IItemFilterScript>(s => s.ItemFilterBlocks == new ObservableCollection<IItemFilterBlockBase>
|
||||
{
|
||||
Mock.Of<IItemFilterBlock>(c => c.Description == "Blockdescription"),
|
||||
Mock.Of<IItemFilterCommentBlock>(c => c.Comment == " commentymccommentface"),
|
||||
Mock.Of<IItemFilterBlock>(),
|
||||
Mock.Of<IItemFilterCommentBlock>(c => c.Comment == "commment\r\nmorecomment\r\nblah"),
|
||||
Mock.Of<IItemFilterCommentBlock>(c => c.Comment == "anothercomment"),
|
||||
Mock.Of<IItemFilterCommentBlock>(c => c.Comment == "notpartofblockdescription "),
|
||||
Mock.Of<IItemFilterBlock>(c => c.Description == "blockdescription2")
|
||||
} && s.ItemFilterBlockGroups == new ObservableCollection<ItemFilterBlockGroup> { new ItemFilterBlockGroup("Root", null, false) }
|
||||
Mock.Of<IItemFilterBlock>(c => c.Description == "Blockdescription"
|
||||
&& c.OriginalText == "#Blockdescription" + Environment.NewLine +
|
||||
"Show #Flasks - Endgame - Life/Mana - Divine/Eternal - Q10+ - Normal" + Environment.NewLine +
|
||||
" Class \"Life Flasks\" \"Mana Flasks\"" + Environment.NewLine +
|
||||
" Rarity Normal" + Environment.NewLine +
|
||||
" SetFontSize 28"
|
||||
),
|
||||
Mock.Of<IItemFilterCommentBlock>(c => c.Comment == " commentymccommentface" && c.OriginalText == "# commentymccommentface"),
|
||||
Mock.Of<IItemFilterBlock>(c => c.OriginalText == "Show" + Environment.NewLine +
|
||||
" Class \"Life Flasks\" \"Mana Flasks\"" + Environment.NewLine +
|
||||
" Rarity Normal" + Environment.NewLine +
|
||||
" DropLevel >= 60"
|
||||
),
|
||||
Mock.Of<IItemFilterCommentBlock>(c => c.Comment == "commment\r\nmorecomment\r\nblah"
|
||||
&& c.OriginalText == "#commment" + Environment.NewLine + "#morecomment" + Environment.NewLine + "#blah"),
|
||||
Mock.Of<IItemFilterCommentBlock>(c => c.Comment == "anothercomment" && c.OriginalText == "#anothercomment"),
|
||||
Mock.Of<IItemFilterCommentBlock>(c => c.Comment == "notpartofblockdescription " && c.OriginalText == "#notpartofblockdescription "),
|
||||
Mock.Of<IItemFilterBlock>(c => c.Description == "blockdescription2"
|
||||
&& c.OriginalText == "#blockdescription2" + Environment.NewLine +
|
||||
"Show #TestBlock" + Environment.NewLine +
|
||||
" Class \"Life Flasks\" \"Mana Flasks\"" + Environment.NewLine +
|
||||
" Rarity Normal "
|
||||
)
|
||||
} && s.ItemFilterBlockGroups == new ObservableCollection<ItemFilterBlockGroup> { new ItemFilterBlockGroup("Root", null, false, false) }
|
||||
&& s.ThemeComponents == new ThemeComponentCollection()
|
||||
&& s.ItemFilterScriptSettings == new ItemFilterScriptSettings(new ThemeComponentCollection())
|
||||
&& s.Description == "Script description\r\nScript description\r\nScript description\r\nScript description");
|
||||
@@ -155,7 +172,7 @@ namespace Filtration.Parser.Tests.Services
|
||||
script.ItemFilterBlocks.Add(block1);
|
||||
script.ItemFilterBlocks.Add(block2);
|
||||
|
||||
var expectedOutput = "# Script edited with Filtration - https://github.com/ben-wallis/Filtration" + Environment.NewLine +
|
||||
var expectedOutput = "# Script edited with Filtration - https://github.com/ben-wallis/Filtration" + Environment.NewLine + Environment.NewLine +
|
||||
"# Test Filter 1" + Environment.NewLine +
|
||||
"Show" + Environment.NewLine +
|
||||
" ItemLevel > 5" + Environment.NewLine +
|
||||
@@ -268,13 +285,11 @@ namespace Filtration.Parser.Tests.Services
|
||||
" ItemLevel > 2" + Environment.NewLine +
|
||||
" SetTextColor 255 40 0" + Environment.NewLine +
|
||||
Environment.NewLine +
|
||||
"#Disabled Block Start" + Environment.NewLine +
|
||||
"#Show" + Environment.NewLine +
|
||||
"# ItemLevel > 2" + Environment.NewLine +
|
||||
"# SetTextColor 255 215 0" + Environment.NewLine +
|
||||
"# SetBorderColor 255 105 180" + Environment.NewLine +
|
||||
"# SetFontSize 32" + Environment.NewLine +
|
||||
"#Disabled Block End" + Environment.NewLine +
|
||||
Environment.NewLine +
|
||||
"Show" + Environment.NewLine +
|
||||
" ItemLevel > 20" + Environment.NewLine +
|
||||
@@ -299,13 +314,11 @@ namespace Filtration.Parser.Tests.Services
|
||||
" ItemLevel > 2" + Environment.NewLine +
|
||||
" SetTextColor 255 40 0" + Environment.NewLine +
|
||||
Environment.NewLine +
|
||||
"#Disabled Block Start" + Environment.NewLine +
|
||||
"#Show" + Environment.NewLine +
|
||||
"# ItemLevel > 2" + Environment.NewLine +
|
||||
"# SetTextColor 255 215 0" + Environment.NewLine +
|
||||
"# SetBorderColor 255 105 180" + Environment.NewLine +
|
||||
"# SetFontSize 32" + Environment.NewLine +
|
||||
"#Disabled Block End" + Environment.NewLine +
|
||||
Environment.NewLine +
|
||||
"Show" + Environment.NewLine +
|
||||
" ItemLevel > 20" + Environment.NewLine +
|
||||
@@ -338,11 +351,9 @@ namespace Filtration.Parser.Tests.Services
|
||||
" ItemLevel > 2" + Environment.NewLine +
|
||||
" SetTextColor 255 40 0" + Environment.NewLine +
|
||||
Environment.NewLine +
|
||||
"#Disabled Block Start" + Environment.NewLine +
|
||||
"# This is a disabled block" + Environment.NewLine +
|
||||
"#Show" + Environment.NewLine +
|
||||
"# ItemLevel > 2" + Environment.NewLine +
|
||||
"#Disabled Block End";
|
||||
"# ItemLevel > 2";
|
||||
|
||||
|
||||
var blockTranslator = new ItemFilterBlockTranslator(Mock.Of<IBlockGroupHierarchyBuilder>());
|
||||
@@ -367,17 +378,15 @@ namespace Filtration.Parser.Tests.Services
|
||||
" ItemLevel > 2" + Environment.NewLine +
|
||||
" SetTextColor 255 40 0" + Environment.NewLine +
|
||||
Environment.NewLine +
|
||||
"#Disabled Block Start" + Environment.NewLine +
|
||||
"# This is a disabled block" + Environment.NewLine +
|
||||
"#Show#My Block Group" + Environment.NewLine +
|
||||
"# ItemLevel > 2" + Environment.NewLine +
|
||||
"#Disabled Block End";
|
||||
"# ItemLevel > 2";
|
||||
|
||||
|
||||
var mockBlockGroupHierarchyBuilder = new Mock<IBlockGroupHierarchyBuilder>();
|
||||
mockBlockGroupHierarchyBuilder.Setup(
|
||||
b => b.IntegrateStringListIntoBlockGroupHierarchy(It.IsAny<IEnumerable<string>>()))
|
||||
.Returns(new ItemFilterBlockGroup("My Block Group", null));
|
||||
b => b.IntegrateStringListIntoBlockGroupHierarchy(It.IsAny<IEnumerable<string>>(), true, false))
|
||||
.Returns(new ItemFilterBlockGroup("My Block Group", null, false, true));
|
||||
|
||||
var blockTranslator = new ItemFilterBlockTranslator(mockBlockGroupHierarchyBuilder.Object);
|
||||
|
||||
@@ -393,6 +402,39 @@ namespace Filtration.Parser.Tests.Services
|
||||
Assert.AreEqual("My Block Group", secondBlock.BlockGroup.GroupName);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TranslateStringToItemFilterScript_SectionBeforeFirstBlock_ParsesCorrectly()
|
||||
{
|
||||
//Arrange
|
||||
var testInputScript = "# Filter Description Line 1" + Environment.NewLine +
|
||||
"# Filter Description Line 2" + Environment.NewLine +
|
||||
"# Filter Description Line 3" + Environment.NewLine +
|
||||
Environment.NewLine +
|
||||
"# Section: Test" + Environment.NewLine +
|
||||
Environment.NewLine +
|
||||
" Show" + Environment.NewLine +
|
||||
"Class \"Pantheon Soul\"";
|
||||
|
||||
|
||||
var blockTranslator = CreateItemFilterScriptTranslator(itemFilterBlockTranslator: new ItemFilterBlockTranslator(Mock.Of<IBlockGroupHierarchyBuilder>()));
|
||||
|
||||
//Act
|
||||
var result = blockTranslator.TranslateStringToItemFilterScript(testInputScript);
|
||||
|
||||
//Assert
|
||||
var expectedDescription = "Filter Description Line 1" + Environment.NewLine +
|
||||
"Filter Description Line 2" + Environment.NewLine +
|
||||
"Filter Description Line 3";
|
||||
|
||||
Assert.AreEqual(expectedDescription, result.Description);
|
||||
var firstItemFilterCommentBlock = result.ItemFilterBlocks.OfType<ItemFilterCommentBlock>().FirstOrDefault();
|
||||
Assert.IsNotNull(firstItemFilterCommentBlock);
|
||||
Assert.AreEqual(" Section: Test", firstItemFilterCommentBlock.Comment);
|
||||
var firstItemFilterBlock = result.ItemFilterBlocks.OfType<ItemFilterBlock>().FirstOrDefault();
|
||||
Assert.IsNotNull(firstItemFilterBlock);
|
||||
Assert.AreEqual(BlockAction.Show, firstItemFilterBlock.Action);
|
||||
}
|
||||
|
||||
private ItemFilterScriptTranslator CreateItemFilterScriptTranslator(IBlockGroupHierarchyBuilder blockGroupHierarchyBuilder = null,
|
||||
IItemFilterBlockTranslator itemFilterBlockTranslator = null,
|
||||
IItemFilterScriptFactory itemFilterScriptFactory = null)
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
<HintPath>..\packages\Castle.Windsor.3.4.0\lib\net45\Castle.Windsor.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
|
||||
@@ -20,16 +20,16 @@ namespace Filtration.Parser.Services
|
||||
_rootBlockGroup = null;
|
||||
}
|
||||
|
||||
public ItemFilterBlockGroup IntegrateStringListIntoBlockGroupHierarchy(IEnumerable<string> groupStrings)
|
||||
public ItemFilterBlockGroup IntegrateStringListIntoBlockGroupHierarchy(IEnumerable<string> groupStrings, bool show, bool enabled)
|
||||
{
|
||||
if (_rootBlockGroup == null)
|
||||
{
|
||||
throw new Exception("BlockGroupHierarchyBuilder must be initialised with root BlockGroup before use");
|
||||
}
|
||||
return IntegrateStringListIntoBlockGroupHierarchy(groupStrings, _rootBlockGroup);
|
||||
return IntegrateStringListIntoBlockGroupHierarchy(groupStrings, _rootBlockGroup, show, enabled);
|
||||
}
|
||||
|
||||
public ItemFilterBlockGroup IntegrateStringListIntoBlockGroupHierarchy(IEnumerable<string> groupStrings, ItemFilterBlockGroup startItemGroup)
|
||||
public ItemFilterBlockGroup IntegrateStringListIntoBlockGroupHierarchy(IEnumerable<string> groupStrings, ItemFilterBlockGroup startItemGroup, bool show, bool enabled)
|
||||
{
|
||||
var inputGroups = groupStrings.ToList();
|
||||
var firstGroup = inputGroups.First().Trim();
|
||||
@@ -47,12 +47,47 @@ namespace Filtration.Parser.Services
|
||||
if (matchingChildItemGroup == null)
|
||||
{
|
||||
var newItemGroup = CreateBlockGroup(inputGroups.First().Trim(), startItemGroup);
|
||||
newItemGroup.IsShowChecked = show;
|
||||
newItemGroup.IsEnableChecked = enabled;
|
||||
startItemGroup.ChildGroups.Add(newItemGroup);
|
||||
inputGroups = inputGroups.Skip(1).ToList();
|
||||
return inputGroups.Count > 0 ? IntegrateStringListIntoBlockGroupHierarchy(inputGroups, newItemGroup) : newItemGroup;
|
||||
if (inputGroups.Count > 0)
|
||||
{
|
||||
return IntegrateStringListIntoBlockGroupHierarchy(inputGroups, newItemGroup, show, enabled);
|
||||
}
|
||||
else
|
||||
{
|
||||
var leafNode = new ItemFilterBlockGroup("", newItemGroup, false, true);
|
||||
leafNode.IsShowChecked = show;
|
||||
leafNode.IsEnableChecked = enabled;
|
||||
newItemGroup.ChildGroups.Add(leafNode);
|
||||
return leafNode;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(matchingChildItemGroup.IsShowChecked != show)
|
||||
{
|
||||
matchingChildItemGroup.IsShowChecked = null;
|
||||
}
|
||||
if (matchingChildItemGroup.IsEnableChecked != enabled)
|
||||
{
|
||||
matchingChildItemGroup.IsEnableChecked = null;
|
||||
}
|
||||
}
|
||||
inputGroups = inputGroups.Skip(1).ToList();
|
||||
return inputGroups.Count > 0 ? IntegrateStringListIntoBlockGroupHierarchy(inputGroups, matchingChildItemGroup) : matchingChildItemGroup;
|
||||
if(inputGroups.Count > 0)
|
||||
{
|
||||
return IntegrateStringListIntoBlockGroupHierarchy(inputGroups, matchingChildItemGroup, show, enabled);
|
||||
}
|
||||
else
|
||||
{
|
||||
var leafNode = new ItemFilterBlockGroup("", matchingChildItemGroup, false, true);
|
||||
leafNode.IsShowChecked = show;
|
||||
leafNode.IsEnableChecked = enabled;
|
||||
matchingChildItemGroup.ChildGroups.Add(leafNode);
|
||||
return leafNode;
|
||||
}
|
||||
}
|
||||
|
||||
private ItemFilterBlockGroup CreateBlockGroup(string groupNameString, ItemFilterBlockGroup parentGroup)
|
||||
|
||||
@@ -30,9 +30,9 @@ namespace Filtration.Parser.Services
|
||||
}
|
||||
|
||||
// Converts a string into an ItemFilterCommentBlock maintaining newlines and spaces but removing # characters
|
||||
public IItemFilterCommentBlock TranslateStringToItemFilterCommentBlock(string inputString, IItemFilterScript parentItemFilterScript)
|
||||
public IItemFilterCommentBlock TranslateStringToItemFilterCommentBlock(string inputString, IItemFilterScript parentItemFilterScript, string originalString = "")
|
||||
{
|
||||
var itemFilterCommentBlock = new ItemFilterCommentBlock(parentItemFilterScript);
|
||||
var itemFilterCommentBlock = new ItemFilterCommentBlock(parentItemFilterScript) {OriginalText = originalString};
|
||||
|
||||
foreach (var line in new LineReader(() => new StringReader(inputString)))
|
||||
{
|
||||
@@ -42,12 +42,13 @@ namespace Filtration.Parser.Services
|
||||
|
||||
itemFilterCommentBlock.Comment = itemFilterCommentBlock.Comment.TrimEnd('\r', '\n');
|
||||
|
||||
itemFilterCommentBlock.IsEdited = false;
|
||||
return itemFilterCommentBlock;
|
||||
}
|
||||
|
||||
// This method converts a string into a ItemFilterBlock. This is used for pasting ItemFilterBlocks
|
||||
// and reading ItemFilterScripts from a file.
|
||||
public IItemFilterBlock TranslateStringToItemFilterBlock(string inputString, IItemFilterScript parentItemFilterScript, bool initialiseBlockGroupHierarchyBuilder = false)
|
||||
public IItemFilterBlock TranslateStringToItemFilterBlock(string inputString, IItemFilterScript parentItemFilterScript, string originalString = "", bool initialiseBlockGroupHierarchyBuilder = false)
|
||||
{
|
||||
if (initialiseBlockGroupHierarchyBuilder)
|
||||
{
|
||||
@@ -57,16 +58,39 @@ namespace Filtration.Parser.Services
|
||||
_masterComponentCollection = parentItemFilterScript.ItemFilterScriptSettings.ThemeComponentCollection;
|
||||
var block = new ItemFilterBlock(parentItemFilterScript);
|
||||
var showHideFound = false;
|
||||
block.OriginalText = originalString;
|
||||
|
||||
foreach (var line in new LineReader(() => new StringReader(inputString)))
|
||||
{
|
||||
if (line.StartsWith(@"#") && !showHideFound)
|
||||
if (line.StartsWith(@"#"))
|
||||
{
|
||||
if(!showHideFound)
|
||||
{
|
||||
block.Description = line.TrimStart('#').TrimStart(' ');
|
||||
}
|
||||
else
|
||||
{
|
||||
if(block.BlockItems.Count > 1)
|
||||
{
|
||||
block.BlockItems.Last().Comment += Environment.NewLine + line.TrimStart('#');
|
||||
}
|
||||
else
|
||||
{
|
||||
block.ActionBlockItem.Comment += Environment.NewLine + line.TrimStart('#');
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
var trimmedLine = line.Trim();
|
||||
var fullLine = line.Trim();
|
||||
var trimmedLine = fullLine;
|
||||
var blockComment = "";
|
||||
var themeComponentType = -1;
|
||||
if(trimmedLine.IndexOf('#') > 0)
|
||||
{
|
||||
blockComment = trimmedLine.Substring(trimmedLine.IndexOf('#') + 1);
|
||||
trimmedLine = trimmedLine.Substring(0, trimmedLine.IndexOf('#')).Trim();
|
||||
}
|
||||
var spaceOrEndOfLinePos = trimmedLine.IndexOf(" ", StringComparison.Ordinal) > 0 ? trimmedLine.IndexOf(" ", StringComparison.Ordinal) : trimmedLine.Length;
|
||||
|
||||
var lineOption = trimmedLine.Substring(0, spaceOrEndOfLinePos);
|
||||
@@ -85,11 +109,11 @@ namespace Filtration.Parser.Services
|
||||
// group hierarchy, if block groups are disabled it is preserved as a simple text comment.
|
||||
if (parentItemFilterScript.ItemFilterScriptSettings.BlockGroupsEnabled)
|
||||
{
|
||||
AddBlockGroupToBlock(block, trimmedLine);
|
||||
AddBlockGroupToBlock(block, fullLine);
|
||||
}
|
||||
else
|
||||
{
|
||||
block.ActionBlockItem.Comment = GetTextAfterFirstComment(trimmedLine);
|
||||
block.ActionBlockItem.Comment = GetTextAfterFirstComment(fullLine);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -190,7 +214,11 @@ namespace Filtration.Parser.Services
|
||||
// Only ever use the last SetTextColor item encountered as multiples aren't valid.
|
||||
RemoveExistingBlockItemsOfType<TextColorBlockItem>(block);
|
||||
|
||||
AddColorItemToBlockItems<TextColorBlockItem>(block, trimmedLine);
|
||||
var result = Regex.Matches(trimmedLine, @"([\w\s]*)");
|
||||
|
||||
var blockItem = new TextColorBlockItem {Color = GetColorFromString(result[0].Groups[1].Value)};
|
||||
block.BlockItems.Add(blockItem);
|
||||
themeComponentType = (int)ThemeComponentType.TextColor;
|
||||
break;
|
||||
}
|
||||
case "SetBackgroundColor":
|
||||
@@ -198,7 +226,11 @@ namespace Filtration.Parser.Services
|
||||
// Only ever use the last SetBackgroundColor item encountered as multiples aren't valid.
|
||||
RemoveExistingBlockItemsOfType<BackgroundColorBlockItem>(block);
|
||||
|
||||
AddColorItemToBlockItems<BackgroundColorBlockItem>(block, trimmedLine);
|
||||
var result = Regex.Matches(trimmedLine, @"([\w\s]*)");
|
||||
|
||||
var blockItem = new BackgroundColorBlockItem {Color = GetColorFromString(result[0].Groups[1].Value)};
|
||||
block.BlockItems.Add(blockItem);
|
||||
themeComponentType = (int)ThemeComponentType.BackgroundColor;
|
||||
break;
|
||||
}
|
||||
case "SetBorderColor":
|
||||
@@ -206,7 +238,11 @@ namespace Filtration.Parser.Services
|
||||
// Only ever use the last SetBorderColor item encountered as multiples aren't valid.
|
||||
RemoveExistingBlockItemsOfType<BorderColorBlockItem>(block);
|
||||
|
||||
AddColorItemToBlockItems<BorderColorBlockItem>(block, trimmedLine);
|
||||
var result = Regex.Matches(trimmedLine, @"([\w\s]*)");
|
||||
|
||||
var blockItem = new BorderColorBlockItem {Color = GetColorFromString(result[0].Groups[1].Value)};
|
||||
block.BlockItems.Add(blockItem);
|
||||
themeComponentType = (int)ThemeComponentType.BorderColor;
|
||||
break;
|
||||
}
|
||||
case "SetFontSize":
|
||||
@@ -214,11 +250,12 @@ namespace Filtration.Parser.Services
|
||||
// Only ever use the last SetFontSize item encountered as multiples aren't valid.
|
||||
RemoveExistingBlockItemsOfType<FontSizeBlockItem>(block);
|
||||
|
||||
var match = Regex.Match(trimmedLine, @"\s+(\d+)");
|
||||
if (match.Success)
|
||||
var match = Regex.Matches(trimmedLine, @"(\s+(\d+)\s*)");
|
||||
if (match.Count > 0)
|
||||
{
|
||||
var blockItemValue = new FontSizeBlockItem(Convert.ToInt16(match.Value));
|
||||
block.BlockItems.Add(blockItemValue);
|
||||
var blockItem = new FontSizeBlockItem(Convert.ToInt16(match[0].Groups[2].Value));
|
||||
block.BlockItems.Add(blockItem);
|
||||
themeComponentType = (int)ThemeComponentType.FontSize;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -228,22 +265,15 @@ namespace Filtration.Parser.Services
|
||||
// Only ever use the last PlayAlertSound item encountered as multiples aren't valid.
|
||||
RemoveExistingBlockItemsOfType<SoundBlockItem>(block);
|
||||
RemoveExistingBlockItemsOfType<PositionalSoundBlockItem>(block);
|
||||
RemoveExistingBlockItemsOfType<CustomSoundBlockItem>(block);
|
||||
|
||||
var match = Regex.Match(trimmedLine, @"\S+\s+(\S+)\s?(\d+)?");
|
||||
|
||||
if (match.Success)
|
||||
{
|
||||
string firstValue = match.Groups[1].Value;
|
||||
int secondValue;
|
||||
|
||||
if (match.Groups[2].Success)
|
||||
{
|
||||
secondValue = Convert.ToInt16(match.Groups[2].Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
secondValue = 79;
|
||||
}
|
||||
var secondValue = match.Groups[2].Success ? Convert.ToInt16(match.Groups[2].Value) : 79;
|
||||
|
||||
if (lineOption == "PlayAlertSound")
|
||||
{
|
||||
@@ -263,12 +293,195 @@ namespace Filtration.Parser.Services
|
||||
};
|
||||
block.BlockItems.Add(blockItemValue);
|
||||
}
|
||||
themeComponentType = (int)ThemeComponentType.AlertSound;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "GemLevel":
|
||||
{
|
||||
AddNumericFilterPredicateItemToBlockItems<GemLevelBlockItem>(block, trimmedLine);
|
||||
break;
|
||||
}
|
||||
case "StackSize":
|
||||
{
|
||||
AddNumericFilterPredicateItemToBlockItems<StackSizeBlockItem>(block, trimmedLine);
|
||||
break;
|
||||
}
|
||||
case "HasExplicitMod":
|
||||
{
|
||||
AddStringListItemToBlockItems<HasExplicitModBlockItem>(block, trimmedLine);
|
||||
break;
|
||||
}
|
||||
case "ElderMap":
|
||||
{
|
||||
AddBooleanItemToBlockItems<ElderMapBlockItem>(block, trimmedLine);
|
||||
break;
|
||||
}
|
||||
case "DisableDropSound":
|
||||
{
|
||||
// Only ever use the last DisableDropSound item encountered as multiples aren't valid.
|
||||
RemoveExistingBlockItemsOfType<DisableDropSoundBlockItem>(block);
|
||||
|
||||
AddBooleanItemToBlockItems<DisableDropSoundBlockItem>(block, trimmedLine);
|
||||
break;
|
||||
}
|
||||
case "MinimapIcon":
|
||||
{
|
||||
// Only ever use the last Icon item encountered as multiples aren't valid.
|
||||
RemoveExistingBlockItemsOfType<MapIconBlockItem>(block);
|
||||
|
||||
// TODO: Get size, color, shape values programmatically
|
||||
var match = Regex.Match(trimmedLine,
|
||||
@"\S+\s+(0|1|2)\s+(Red|Green|Blue|Brown|White|Yellow)\s+(Circle|Diamond|Hexagon|Square|Star|Triangle)\s*([#]?)(.*)",
|
||||
RegexOptions.IgnoreCase);
|
||||
|
||||
if (match.Success)
|
||||
{
|
||||
var blockItemValue = new MapIconBlockItem
|
||||
{
|
||||
Size = (IconSize)short.Parse(match.Groups[1].Value),
|
||||
Color = EnumHelper.GetEnumValueFromDescription<IconColor>(match.Groups[2].Value),
|
||||
Shape = EnumHelper.GetEnumValueFromDescription<IconShape>(match.Groups[3].Value)
|
||||
};
|
||||
|
||||
var themeComponent = _masterComponentCollection.AddComponent(ThemeComponentType.Icon, match.Groups[5].Value.Trim(),
|
||||
blockItemValue.Size, blockItemValue.Color, blockItemValue.Shape);
|
||||
if(match.Groups[4].Value == "#" && !string.IsNullOrWhiteSpace(match.Groups[5].Value))
|
||||
{
|
||||
blockItemValue.ThemeComponent = themeComponent;
|
||||
}
|
||||
block.BlockItems.Add(blockItemValue);
|
||||
themeComponentType = (int)ThemeComponentType.Icon;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "PlayEffect":
|
||||
{
|
||||
// Only ever use the last BeamColor item encountered as multiples aren't valid.
|
||||
RemoveExistingBlockItemsOfType<PlayEffectBlockItem>(block);
|
||||
|
||||
// TODO: Get colors programmatically
|
||||
var match = Regex.Match(trimmedLine, @"\S+\s+(Red|Green|Blue|Brown|White|Yellow)\s*(Temp)?", RegexOptions.IgnoreCase);
|
||||
|
||||
if (match.Success)
|
||||
{
|
||||
var blockItemValue = new PlayEffectBlockItem
|
||||
{
|
||||
Color = EnumHelper.GetEnumValueFromDescription<EffectColor>(match.Groups[1].Value),
|
||||
Temporary = match.Groups[2].Value.Trim().ToLower() == "temp"
|
||||
};
|
||||
block.BlockItems.Add(blockItemValue);
|
||||
themeComponentType = (int)ThemeComponentType.Effect;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "CustomAlertSound":
|
||||
{
|
||||
// Only ever use the last CustomSoundBlockItem item encountered as multiples aren't valid.
|
||||
RemoveExistingBlockItemsOfType<CustomSoundBlockItem>(block);
|
||||
RemoveExistingBlockItemsOfType<SoundBlockItem>(block);
|
||||
RemoveExistingBlockItemsOfType<PositionalSoundBlockItem>(block);
|
||||
|
||||
var match = Regex.Match(trimmedLine, @"\S+\s+""([^\*\<\>\?|]+)""");
|
||||
|
||||
if (match.Success)
|
||||
{
|
||||
var blockItemValue = new CustomSoundBlockItem
|
||||
{
|
||||
Value = match.Groups[1].Value
|
||||
};
|
||||
block.BlockItems.Add(blockItemValue);
|
||||
themeComponentType = (int)ThemeComponentType.CustomSound;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "MapTier":
|
||||
{
|
||||
AddNumericFilterPredicateItemToBlockItems<MapTierBlockItem>(block, trimmedLine);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(blockComment) && block.BlockItems.Count > 1)
|
||||
{
|
||||
if(!(block.BlockItems.Last() is IBlockItemWithTheme blockItemWithTheme))
|
||||
{
|
||||
block.BlockItems.Last().Comment = blockComment;
|
||||
}
|
||||
else
|
||||
{
|
||||
switch((ThemeComponentType)themeComponentType)
|
||||
{
|
||||
case ThemeComponentType.AlertSound:
|
||||
{
|
||||
ThemeComponent themeComponent;
|
||||
if(blockItemWithTheme is SoundBlockItem item)
|
||||
{
|
||||
themeComponent = _masterComponentCollection.AddComponent(ThemeComponentType.AlertSound, blockComment.Trim(),
|
||||
item.Value, item.SecondValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
themeComponent = _masterComponentCollection.AddComponent(ThemeComponentType.AlertSound, blockComment.Trim(),
|
||||
((PositionalSoundBlockItem)blockItemWithTheme).Value, ((PositionalSoundBlockItem)blockItemWithTheme).SecondValue);
|
||||
}
|
||||
blockItemWithTheme.ThemeComponent = themeComponent;
|
||||
break;
|
||||
}
|
||||
case ThemeComponentType.BackgroundColor:
|
||||
{
|
||||
ThemeComponent themeComponent = _masterComponentCollection.AddComponent(ThemeComponentType.BackgroundColor,
|
||||
blockComment.Trim(), ((BackgroundColorBlockItem)blockItemWithTheme).Color);
|
||||
blockItemWithTheme.ThemeComponent = themeComponent;
|
||||
break;
|
||||
}
|
||||
case ThemeComponentType.BorderColor:
|
||||
{
|
||||
ThemeComponent themeComponent = _masterComponentCollection.AddComponent(ThemeComponentType.BorderColor,
|
||||
blockComment.Trim(), ((BorderColorBlockItem)blockItemWithTheme).Color);
|
||||
blockItemWithTheme.ThemeComponent = themeComponent;
|
||||
break;
|
||||
}
|
||||
case ThemeComponentType.CustomSound:
|
||||
{
|
||||
ThemeComponent themeComponent = _masterComponentCollection.AddComponent(ThemeComponentType.CustomSound,
|
||||
blockComment.Trim(), ((CustomSoundBlockItem)blockItemWithTheme).Value);
|
||||
blockItemWithTheme.ThemeComponent = themeComponent;
|
||||
break;
|
||||
}
|
||||
case ThemeComponentType.Effect:
|
||||
{
|
||||
ThemeComponent themeComponent = _masterComponentCollection.AddComponent(ThemeComponentType.Effect,
|
||||
blockComment.Trim(), ((EffectColorBlockItem)blockItemWithTheme).Color, ((EffectColorBlockItem)blockItemWithTheme).Temporary);
|
||||
blockItemWithTheme.ThemeComponent = themeComponent;
|
||||
break;
|
||||
}
|
||||
case ThemeComponentType.FontSize:
|
||||
{
|
||||
ThemeComponent themeComponent = _masterComponentCollection.AddComponent(ThemeComponentType.FontSize,
|
||||
blockComment.Trim(), ((FontSizeBlockItem)blockItemWithTheme).Value);
|
||||
blockItemWithTheme.ThemeComponent = themeComponent;
|
||||
break;
|
||||
}
|
||||
case ThemeComponentType.Icon:
|
||||
{
|
||||
ThemeComponent themeComponent = _masterComponentCollection.AddComponent(ThemeComponentType.Icon, blockComment.Trim(),
|
||||
((IconBlockItem)blockItemWithTheme).Size, ((IconBlockItem)blockItemWithTheme).Color, ((IconBlockItem)blockItemWithTheme).Shape);
|
||||
blockItemWithTheme.ThemeComponent = themeComponent;
|
||||
break;
|
||||
}
|
||||
case ThemeComponentType.TextColor:
|
||||
{
|
||||
ThemeComponent themeComponent = _masterComponentCollection.AddComponent(ThemeComponentType.TextColor,
|
||||
blockComment.Trim(), ((TextColorBlockItem)blockItemWithTheme).Color);
|
||||
blockItemWithTheme.ThemeComponent = themeComponent;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
block.IsEdited = false;
|
||||
return block;
|
||||
}
|
||||
|
||||
@@ -284,6 +497,7 @@ namespace Filtration.Parser.Services
|
||||
|
||||
private static void AddBooleanItemToBlockItems<T>(IItemFilterBlock block, string inputString) where T : BooleanBlockItem
|
||||
{
|
||||
inputString = Regex.Replace(inputString, @"\s+", " ");
|
||||
var blockItem = Activator.CreateInstance<T>();
|
||||
var splitString = inputString.Split(' ');
|
||||
if (splitString.Length == 2)
|
||||
@@ -329,48 +543,6 @@ namespace Filtration.Parser.Services
|
||||
}
|
||||
}
|
||||
|
||||
private void AddColorItemToBlockItems<T>(IItemFilterBlock block, string inputString) where T : ColorBlockItem
|
||||
{
|
||||
block.BlockItems.Add(GetColorBlockItemFromString<T>(inputString));
|
||||
}
|
||||
|
||||
private T GetColorBlockItemFromString<T>(string inputString) where T: ColorBlockItem
|
||||
{
|
||||
var blockItem = Activator.CreateInstance<T>();
|
||||
var result = Regex.Matches(inputString, @"([\w\s]*)[#]?(.*)");
|
||||
|
||||
blockItem.Color = GetColorFromString(result[0].Groups[1].Value);
|
||||
|
||||
var componentName = result[0].Groups[2].Value.Trim();
|
||||
if (!string.IsNullOrEmpty(componentName))
|
||||
{
|
||||
ThemeComponentType componentType;
|
||||
if (typeof(T) == typeof(TextColorBlockItem))
|
||||
{
|
||||
componentType = ThemeComponentType.TextColor;
|
||||
}
|
||||
else if (typeof(T) == typeof(BackgroundColorBlockItem))
|
||||
{
|
||||
componentType = ThemeComponentType.BackgroundColor;
|
||||
}
|
||||
else if (typeof(T) == typeof(BorderColorBlockItem))
|
||||
{
|
||||
componentType = ThemeComponentType.BorderColor;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception("Parsing error - unknown theme component type");
|
||||
}
|
||||
if (_masterComponentCollection != null)
|
||||
{
|
||||
blockItem.ThemeComponent = _masterComponentCollection.AddComponent(componentType, componentName,
|
||||
blockItem.Color);
|
||||
}
|
||||
}
|
||||
|
||||
return blockItem;
|
||||
}
|
||||
|
||||
public void ReplaceAudioVisualBlockItemsFromString(ObservableCollection<IItemFilterBlockItem> blockItems, string inputString)
|
||||
{
|
||||
// Reverse iterate to remove existing IAudioVisualBlockItems
|
||||
@@ -385,36 +557,84 @@ namespace Filtration.Parser.Services
|
||||
foreach (var line in new LineReader(() => new StringReader(inputString)))
|
||||
{
|
||||
var matches = Regex.Match(line, @"(\w+)");
|
||||
var blockComment = "";
|
||||
var trimmedLine = line.Trim();
|
||||
if (trimmedLine.IndexOf('#') > 0)
|
||||
{
|
||||
blockComment = trimmedLine.Substring(trimmedLine.IndexOf('#') + 1);
|
||||
trimmedLine = trimmedLine.Substring(0, trimmedLine.IndexOf('#')).Trim();
|
||||
}
|
||||
|
||||
switch (matches.Value)
|
||||
{
|
||||
case "PlayAlertSound":
|
||||
{
|
||||
var match = Regex.Match(line, @"\s+(\S+) (\d+)");
|
||||
var match = Regex.Match(trimmedLine, @"\s+(\S+) (\d+)");
|
||||
if (!match.Success) break;
|
||||
blockItems.Add(new SoundBlockItem(match.Groups[1].Value, Convert.ToInt16(match.Groups[2].Value)));
|
||||
var blockItem = new SoundBlockItem(match.Groups[1].Value, Convert.ToInt16(match.Groups[2].Value));
|
||||
if(_masterComponentCollection != null && !string.IsNullOrWhiteSpace(blockComment))
|
||||
{
|
||||
ThemeComponent themeComponent = _masterComponentCollection.AddComponent(ThemeComponentType.AlertSound,
|
||||
blockComment, blockItem.Value, blockItem.SecondValue);
|
||||
blockItem.ThemeComponent = themeComponent;
|
||||
}
|
||||
blockItems.Add(blockItem);
|
||||
break;
|
||||
}
|
||||
case "SetTextColor":
|
||||
{
|
||||
blockItems.Add(GetColorBlockItemFromString<TextColorBlockItem>(line));
|
||||
var result = Regex.Matches(trimmedLine, @"([\w\s]*)");
|
||||
|
||||
var blockItem = new TextColorBlockItem {Color = GetColorFromString(result[0].Groups[1].Value)};
|
||||
if(_masterComponentCollection != null && !string.IsNullOrWhiteSpace(blockComment))
|
||||
{
|
||||
ThemeComponent themeComponent = _masterComponentCollection.AddComponent(ThemeComponentType.TextColor,
|
||||
blockComment, blockItem.Color);
|
||||
blockItem.ThemeComponent = themeComponent;
|
||||
}
|
||||
blockItems.Add(blockItem);
|
||||
break;
|
||||
}
|
||||
case "SetBackgroundColor":
|
||||
{
|
||||
blockItems.Add(GetColorBlockItemFromString<BackgroundColorBlockItem>(line));
|
||||
var result = Regex.Matches(trimmedLine, @"([\w\s]*)");
|
||||
|
||||
var blockItem = new BackgroundColorBlockItem {Color = GetColorFromString(result[0].Groups[1].Value)};
|
||||
if(_masterComponentCollection != null && !string.IsNullOrWhiteSpace(blockComment))
|
||||
{
|
||||
ThemeComponent themeComponent = _masterComponentCollection.AddComponent(ThemeComponentType.BackgroundColor,
|
||||
blockComment, blockItem.Color);
|
||||
blockItem.ThemeComponent = themeComponent;
|
||||
}
|
||||
blockItems.Add(blockItem);
|
||||
break;
|
||||
}
|
||||
case "SetBorderColor":
|
||||
{
|
||||
blockItems.Add(GetColorBlockItemFromString<BorderColorBlockItem>(line));
|
||||
var result = Regex.Matches(trimmedLine, @"([\w\s]*)");
|
||||
|
||||
var blockItem = new BorderColorBlockItem {Color = GetColorFromString(result[0].Groups[1].Value)};
|
||||
if(_masterComponentCollection != null && !string.IsNullOrWhiteSpace(blockComment))
|
||||
{
|
||||
ThemeComponent themeComponent = _masterComponentCollection.AddComponent(ThemeComponentType.BorderColor,
|
||||
blockComment, blockItem.Color);
|
||||
blockItem.ThemeComponent = themeComponent;
|
||||
}
|
||||
blockItems.Add(blockItem);
|
||||
break;
|
||||
}
|
||||
case "SetFontSize":
|
||||
{
|
||||
var match = Regex.Match(line, @"\s+(\d+)");
|
||||
var match = Regex.Match(trimmedLine, @"\s+(\d+)");
|
||||
if (!match.Success) break;
|
||||
blockItems.Add(new FontSizeBlockItem(Convert.ToInt16(match.Value)));
|
||||
var blockItem = new FontSizeBlockItem(Convert.ToInt16(match.Value));
|
||||
if (_masterComponentCollection != null && !string.IsNullOrWhiteSpace(blockComment))
|
||||
{
|
||||
ThemeComponent themeComponent = _masterComponentCollection.AddComponent(ThemeComponentType.FontSize,
|
||||
blockComment, blockItem.Value);
|
||||
blockItem.ThemeComponent = themeComponent;
|
||||
}
|
||||
blockItems.Add(blockItem);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -430,8 +650,8 @@ namespace Filtration.Parser.Services
|
||||
|
||||
if (blockGroups.Count(b => !string.IsNullOrEmpty(b.Trim())) > 0)
|
||||
{
|
||||
block.BlockGroup = _blockGroupHierarchyBuilder.IntegrateStringListIntoBlockGroupHierarchy(blockGroups);
|
||||
block.BlockGroup.IsChecked = block.Action == BlockAction.Show;
|
||||
block.BlockGroup = _blockGroupHierarchyBuilder.IntegrateStringListIntoBlockGroupHierarchy(blockGroups,
|
||||
block.Action == BlockAction.Show, block.Enabled);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -452,7 +672,7 @@ namespace Filtration.Parser.Services
|
||||
case 3:
|
||||
return new Color
|
||||
{
|
||||
A = byte.MaxValue,
|
||||
A = 240,
|
||||
R = Convert.ToByte(argbValues[0].Value),
|
||||
G = Convert.ToByte(argbValues[1].Value),
|
||||
B = Convert.ToByte(argbValues[2].Value)
|
||||
@@ -487,6 +707,11 @@ namespace Filtration.Parser.Services
|
||||
// TODO: Private
|
||||
public string TranslateItemFilterCommentBlockToString(IItemFilterCommentBlock itemFilterCommentBlock)
|
||||
{
|
||||
if (!itemFilterCommentBlock.IsEdited)
|
||||
{
|
||||
return itemFilterCommentBlock.OriginalText;
|
||||
}
|
||||
|
||||
// TODO: Tests
|
||||
// TODO: # Section: text?
|
||||
var commentWithHashes = string.Empty;
|
||||
@@ -506,13 +731,13 @@ namespace Filtration.Parser.Services
|
||||
// TODO: Private
|
||||
public string TranslateItemFilterBlockToString(IItemFilterBlock block)
|
||||
{
|
||||
var outputString = string.Empty;
|
||||
|
||||
if (!block.Enabled)
|
||||
if(!block.IsEdited)
|
||||
{
|
||||
outputString += "#Disabled Block Start" + Environment.NewLine;
|
||||
return block.OriginalText;
|
||||
}
|
||||
|
||||
var outputString = string.Empty;
|
||||
|
||||
if (!string.IsNullOrEmpty(block.Description))
|
||||
{
|
||||
outputString += "# " + block.Description + Environment.NewLine;
|
||||
@@ -538,10 +763,11 @@ namespace Filtration.Parser.Services
|
||||
}
|
||||
}
|
||||
|
||||
if (!block.Enabled)
|
||||
{
|
||||
outputString += Environment.NewLine + "#Disabled Block End";
|
||||
}
|
||||
//TODO: Disabled for the time being. A better solution is needed.
|
||||
// Replace 'Maelström' to prevent encoding problems in other editors
|
||||
//outputString.Replace("Maelström Staff", "Maelstr");
|
||||
//outputString.Replace("Maelström of Chaos", "Maelstr");
|
||||
//outputString.Replace("Maelström", "Maelstr");
|
||||
|
||||
return outputString;
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows;
|
||||
using Filtration.Common.Utilities;
|
||||
using Filtration.ObjectModel;
|
||||
using Filtration.ObjectModel.Factories;
|
||||
@@ -48,63 +48,78 @@ namespace Filtration.Parser.Services
|
||||
_itemFilterScriptFactory = itemFilterScriptFactory;
|
||||
}
|
||||
|
||||
public static string PreprocessDisabledBlocks(string inputString)
|
||||
public static string PreprocessDisabledBlocks(string inputString, out List<bool> inBlock)
|
||||
{
|
||||
bool inDisabledBlock = false;
|
||||
var showHideFound = false;
|
||||
inBlock = new List<bool>();
|
||||
|
||||
var lines = Regex.Split(inputString, "\r\n|\r|\n").ToList();
|
||||
var linesToRemove = new List<int>();
|
||||
// find first show/hide and check script
|
||||
for (var i = 0; i < lines.Count; i++)
|
||||
{
|
||||
inBlock.Add(false);
|
||||
lines[i] = lines[i].Trim();
|
||||
if(!lines[i].StartsWith("#"))
|
||||
{
|
||||
string curLine = Regex.Replace(lines[i], @"\s+", "");
|
||||
if ((curLine.StartsWith("Show") || curLine.StartsWith("Hide")) && (curLine.Length == 4 || curLine[4] == '#')) // found
|
||||
{
|
||||
inBlock[i] = true;
|
||||
break;
|
||||
}
|
||||
else // This means script has wrong syntax, just replace those lines with empty string
|
||||
{
|
||||
lines[i] = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// find remaining boundaries
|
||||
var lastInBlock = inBlock.Count - 1;
|
||||
for (var i = inBlock.Count; i < lines.Count; i++)
|
||||
{
|
||||
inBlock.Add(false);
|
||||
lines[i] = lines[i].Trim();
|
||||
if (!lines[i].StartsWith("#") && lines[i].Length > 0)
|
||||
{
|
||||
if (!lines[i].StartsWith("Show") && !lines[i].StartsWith("Hide")) // Continuing inline
|
||||
{
|
||||
for(int j = lastInBlock + 1; j < i; j++)
|
||||
{
|
||||
inBlock[j] = true;
|
||||
}
|
||||
}
|
||||
lastInBlock = i;
|
||||
inBlock[i] = true;
|
||||
}
|
||||
}
|
||||
|
||||
for (var i = 0; i < lines.Count; i++)
|
||||
{
|
||||
if (lines[i].StartsWith("#Disabled Block Start"))
|
||||
if (!inDisabledBlock && lines[i].StartsWith("#"))
|
||||
{
|
||||
string curLine = Regex.Replace(lines[i].Substring(1), @"\s+", "");
|
||||
if ((curLine.StartsWith("Show") || curLine.StartsWith("Hide")) && (curLine.Length == 4 || curLine[4] == '#') && !inBlock[i])
|
||||
{
|
||||
inDisabledBlock = true;
|
||||
linesToRemove.Add(i);
|
||||
lines[i] = lines[i].Substring(1).TrimStart(' ');
|
||||
lines[i] = lines[i].Substring(0, 4) + "Disabled" + lines[i].Substring(4);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (inDisabledBlock)
|
||||
{
|
||||
if (lines[i].StartsWith("#Disabled Block End"))
|
||||
if (!lines[i].StartsWith("#"))
|
||||
{
|
||||
inDisabledBlock = false;
|
||||
showHideFound = false;
|
||||
linesToRemove.Add(i);
|
||||
continue;
|
||||
}
|
||||
|
||||
lines[i] = lines[i].TrimStart('#');
|
||||
lines[i] = lines[i].Replace("#", " # ");
|
||||
var spaceOrEndOfLinePos = lines[i].IndexOf(" ", StringComparison.Ordinal) > 0 ? lines[i].IndexOf(" ", StringComparison.Ordinal) : lines[i].Length;
|
||||
var lineOption = lines[i].Substring(0, spaceOrEndOfLinePos);
|
||||
|
||||
// If we haven't found a Show or Hide line yet, then this is probably the block comment.
|
||||
// Put its # back on and skip to the next line.
|
||||
if (lineOption != "Show" && lineOption != "Hide" && showHideFound == false)
|
||||
else
|
||||
{
|
||||
lines[i] = "#" + lines[i];
|
||||
continue;
|
||||
}
|
||||
|
||||
if (lineOption == "Show")
|
||||
{
|
||||
lines[i] = lines[i].Replace("Show", "ShowDisabled");
|
||||
showHideFound = true;
|
||||
}
|
||||
else if (lineOption == "Hide")
|
||||
{
|
||||
lines[i] = lines[i].Replace("Hide", "HideDisabled");
|
||||
showHideFound = true;
|
||||
lines[i] = lines[i].Substring(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (var i = linesToRemove.Count - 1; i >= 0; i--)
|
||||
{
|
||||
lines.RemoveAt(linesToRemove[i]);
|
||||
}
|
||||
|
||||
return lines.Aggregate((c, n) => c + Environment.NewLine + n);
|
||||
}
|
||||
|
||||
@@ -113,13 +128,29 @@ namespace Filtration.Parser.Services
|
||||
var script = _itemFilterScriptFactory.Create();
|
||||
_blockGroupHierarchyBuilder.Initialise(script.ItemFilterBlockGroups.First());
|
||||
|
||||
inputString = inputString.Replace("\t", "");
|
||||
if (inputString.Contains("#Disabled Block Start"))
|
||||
if(Regex.Matches(inputString, @"#Disabled\sBlock\s(Start|End).*?\n").Count > 0)
|
||||
{
|
||||
inputString = PreprocessDisabledBlocks(inputString);
|
||||
if (MessageBox.Show(
|
||||
"Loaded script contains special '#Disabled Block Start' lines." +
|
||||
" These may be coming from old versions of Filtration or Greengroove's filter." +
|
||||
"It is suggested to remove them however this may cause problems with original source" +
|
||||
Environment.NewLine + "(There is no in game effect of those lines)" +
|
||||
Environment.NewLine + Environment.NewLine + "Would you like to remove them?", "Special Comment Lines Found",
|
||||
MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.Yes)
|
||||
{
|
||||
//Remove old disabled tags
|
||||
inputString = Regex.Replace(inputString, @"#Disabled\sBlock\s(Start|End).*?\n", "");
|
||||
inputString = (inputString.EndsWith("\n#Disabled Block End")) ? inputString.Substring(0, inputString.Length - 19) : inputString;
|
||||
}
|
||||
}
|
||||
|
||||
var conditionBoundaries = IdentifyBlockBoundaries(inputString);
|
||||
var originalLines = Regex.Split(inputString, "\r\n|\r|\n");
|
||||
|
||||
inputString = inputString.Replace("\t", "");
|
||||
List<bool> inBlock;
|
||||
inputString = PreprocessDisabledBlocks(inputString, out inBlock);
|
||||
|
||||
var conditionBoundaries = IdentifyBlockBoundaries(inputString, inBlock);
|
||||
|
||||
var lines = Regex.Split(inputString, "\r\n|\r|\n");
|
||||
|
||||
@@ -155,14 +186,24 @@ namespace Filtration.Parser.Services
|
||||
var block = new string[end - begin];
|
||||
Array.Copy(lines, begin, block, 0, end - begin);
|
||||
var blockString = string.Join("\r\n", block);
|
||||
Array.Copy(originalLines, begin, block, 0, end - begin);
|
||||
var originalString = "";
|
||||
for (var i = block.Length - 1; i >= 0; i--)
|
||||
{
|
||||
if(block[i].Replace(" ", "").Replace("\t", "").Length > 0)
|
||||
{
|
||||
originalString = string.Join("\r\n", block, 0, i + 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (boundary.Value.BoundaryType == ItemFilterBlockBoundaryType.ItemFilterBlock)
|
||||
{
|
||||
script.ItemFilterBlocks.Add(_blockTranslator.TranslateStringToItemFilterBlock(blockString, script));
|
||||
script.ItemFilterBlocks.Add(_blockTranslator.TranslateStringToItemFilterBlock(blockString, script, originalString));
|
||||
}
|
||||
else
|
||||
{
|
||||
script.ItemFilterBlocks.Add(_blockTranslator.TranslateStringToItemFilterCommentBlock(blockString, script));
|
||||
script.ItemFilterBlocks.Add(_blockTranslator.TranslateStringToItemFilterCommentBlock(blockString, script, originalString));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -170,7 +211,18 @@ namespace Filtration.Parser.Services
|
||||
return script;
|
||||
}
|
||||
|
||||
private static LinkedList<ItemFilterBlockBoundary> IdentifyBlockBoundaries(string inputString)
|
||||
public IItemFilterScript TranslatePastedStringToItemFilterScript(string inputString, bool blockGroupsEnabled)
|
||||
{
|
||||
//Remove old disabled tags to prevent messagebox on paste
|
||||
inputString = Regex.Replace(inputString, @"#Disabled\sBlock\s(Start|End).*?\n", "");
|
||||
inputString = (inputString.EndsWith("\n#Disabled Block End")) ? inputString.Substring(0, inputString.Length - 19) : inputString;
|
||||
|
||||
inputString = (blockGroupsEnabled ? "# EnableBlockGroups" : "#") + Environment.NewLine + Environment.NewLine + inputString;
|
||||
|
||||
return TranslateStringToItemFilterScript(inputString);
|
||||
}
|
||||
|
||||
private static LinkedList<ItemFilterBlockBoundary> IdentifyBlockBoundaries(string inputString, List<bool> inBlock)
|
||||
{
|
||||
var blockBoundaries = new LinkedList<ItemFilterBlockBoundary>();
|
||||
var previousLine = string.Empty;
|
||||
@@ -189,21 +241,19 @@ namespace Filtration.Parser.Services
|
||||
continue;
|
||||
}
|
||||
|
||||
// A line starting with a comment when we're inside a ItemFilterBlock boundary represents the end of that block
|
||||
// as ItemFilterBlocks cannot have comment lines after the block description
|
||||
if (trimmedLine.StartsWith("#") && currentItemFilterBlockBoundary.BoundaryType == ItemFilterBlockBoundaryType.ItemFilterBlock)
|
||||
// A line starting with a comment when we're inside a ItemFilterBlock boundary may represent the end of that block
|
||||
// or a block item comment
|
||||
if (trimmedLine.StartsWith("#") && !inBlock[currentLine] &&
|
||||
currentItemFilterBlockBoundary.BoundaryType == ItemFilterBlockBoundaryType.ItemFilterBlock)
|
||||
{
|
||||
blockBoundaries.AddLast(currentItemFilterBlockBoundary);
|
||||
currentItemFilterBlockBoundary = new ItemFilterBlockBoundary(currentLine, ItemFilterBlockBoundaryType.CommentBlock);
|
||||
}
|
||||
// A line starting with a comment where the previous line was null represents the start of a new comment (unless we're on the first
|
||||
// line in which case it's not a new comment).
|
||||
else if (trimmedLine.StartsWith("#") && string.IsNullOrWhiteSpace(previousLine) && currentItemFilterBlockBoundary.BoundaryType != ItemFilterBlockBoundaryType.ScriptDescription)
|
||||
{
|
||||
if (blockBoundaries.Count > 0)
|
||||
else if (trimmedLine.StartsWith("#") && string.IsNullOrWhiteSpace(previousLine) && currentLine > 0)
|
||||
{
|
||||
blockBoundaries.AddLast(currentItemFilterBlockBoundary);
|
||||
}
|
||||
currentItemFilterBlockBoundary = new ItemFilterBlockBoundary(currentLine, ItemFilterBlockBoundaryType.CommentBlock);
|
||||
}
|
||||
|
||||
@@ -254,8 +304,8 @@ namespace Filtration.Parser.Services
|
||||
outputString += "# " + line + Environment.NewLine;
|
||||
}
|
||||
}
|
||||
outputString += Environment.NewLine;
|
||||
}
|
||||
outputString += Environment.NewLine;
|
||||
|
||||
// ReSharper disable once LoopCanBeConvertedToQuery
|
||||
foreach (var block in script.ItemFilterBlocks)
|
||||
|
||||
@@ -66,7 +66,6 @@
|
||||
<Compile Include="Repositories\TestItemFilterScriptRepository.cs" />
|
||||
<Compile Include="Services\TestHTTPService.cs" />
|
||||
<Compile Include="Services\TestItemFilterPersistenceService.cs" />
|
||||
<Compile Include="Services\TestStaticDataService.cs" />
|
||||
<Compile Include="Services\TestUpdateService.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@@ -107,6 +106,9 @@
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
using Filtration.Common.Services;
|
||||
using Filtration.Services;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Filtration.Tests.Services
|
||||
{
|
||||
[TestFixture]
|
||||
public class TestStaticDataService
|
||||
{
|
||||
[Test]
|
||||
public void Constructor_CallsFileSystemService()
|
||||
{
|
||||
// Arrange
|
||||
|
||||
var mockFileSystemService = new Mock<IFileSystemService>();
|
||||
mockFileSystemService.Setup(f => f.ReadFileAsString(It.IsAny<string>())).Returns("TestResult").Verifiable();
|
||||
|
||||
var service = new StaticDataService(mockFileSystemService.Object);
|
||||
|
||||
// Act
|
||||
|
||||
// Assert
|
||||
mockFileSystemService.Verify();
|
||||
}
|
||||
|
||||
[Ignore("Integration Test")]
|
||||
[Test]
|
||||
public void Constructor_ReadsFromFileCorrectly()
|
||||
{
|
||||
// Arrange
|
||||
|
||||
var fileSystemService = new FileSystemService();
|
||||
|
||||
var service = new StaticDataService(fileSystemService);
|
||||
|
||||
// Act
|
||||
|
||||
// Assert
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -73,6 +73,9 @@
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace Filtration.ThemeEditor.Tests.Services
|
||||
|
||||
var testInputTheme = new Theme();
|
||||
var testInputThemeComponentColor = new Color{ R = 255, G = 0, B = 1 };
|
||||
var testInputThemeComponent = new ThemeComponent(ThemeComponentType.TextColor, "Test Component 1", testInputThemeComponentColor);
|
||||
var testInputThemeComponent = new ColorThemeComponent(ThemeComponentType.TextColor, "Test Component 1", testInputThemeComponentColor);
|
||||
testInputTheme.Components.Add(testInputThemeComponent);
|
||||
testInputBlockItem.ThemeComponent = testInputThemeComponent;
|
||||
var mockMessageBoxService = new Mock<IMessageBoxService>();
|
||||
@@ -53,8 +53,8 @@ namespace Filtration.ThemeEditor.Tests.Services
|
||||
|
||||
var testInputTheme = new Theme();
|
||||
var testInputThemeComponentColor = new Color { R = 255, G = 0, B = 1 };
|
||||
var testInputThemeComponent = new ThemeComponent(ThemeComponentType.TextColor, "Test Component 1", testInputThemeComponentColor);
|
||||
var testInputBlockItemThemeComponent = new ThemeComponent(ThemeComponentType.TextColor, "Different Component", testInputThemeComponentColor);
|
||||
var testInputThemeComponent = new ColorThemeComponent(ThemeComponentType.TextColor, "Test Component 1", testInputThemeComponentColor);
|
||||
var testInputBlockItemThemeComponent = new ColorThemeComponent(ThemeComponentType.TextColor, "Different Component", testInputThemeComponentColor);
|
||||
testInputTheme.Components.Add(testInputThemeComponent);
|
||||
testInputBlockItem.ThemeComponent = testInputBlockItemThemeComponent;
|
||||
|
||||
|
||||
@@ -31,6 +31,18 @@ namespace Filtration.ThemeEditor.Converters
|
||||
{
|
||||
return "Background Color Theme Components";
|
||||
}
|
||||
case "Font Size":
|
||||
{
|
||||
return "Font Size Theme Components";
|
||||
}
|
||||
case "Alert Sound":
|
||||
{
|
||||
return "Alert Sound Theme Components";
|
||||
}
|
||||
case "Custom Sound":
|
||||
{
|
||||
return "Custom Alert Sound Theme Components";
|
||||
}
|
||||
}
|
||||
|
||||
return type.GetAttributeDescription();
|
||||
|
||||
@@ -108,6 +108,12 @@
|
||||
<Compile Include="Providers\ThemeProvider.cs" />
|
||||
<Compile Include="Services\ThemePersistenceService.cs" />
|
||||
<Compile Include="Services\ThemeService.cs" />
|
||||
<Compile Include="ViewModels\ColorThemeComponentViewModel.cs" />
|
||||
<Compile Include="ViewModels\EffectColorThemeComponentViewModel.cs" />
|
||||
<Compile Include="ViewModels\IconThemeComponentViewModel.cs" />
|
||||
<Compile Include="ViewModels\StringThemeComponentViewModel.cs" />
|
||||
<Compile Include="ViewModels\StrIntThemeComponentViewModel.cs" />
|
||||
<Compile Include="ViewModels\IntegerThemeComponentViewModel.cs" />
|
||||
<Compile Include="ViewModels\IThemeViewModelFactory.cs" />
|
||||
<Compile Include="ViewModels\ThemeComponentViewModel.cs" />
|
||||
<Compile Include="ViewModels\ThemeEditorViewModel.cs" />
|
||||
@@ -135,7 +141,10 @@
|
||||
<Name>Filtration.ObjectModel</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\open_icon.png" />
|
||||
<Resource Include="Resources\speaker_icon.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Page Include="Views\ThemeComponentControl.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using AutoMapper;
|
||||
using Filtration.ObjectModel;
|
||||
using Filtration.ObjectModel.Enums;
|
||||
using Filtration.ObjectModel.ThemeEditor;
|
||||
using Filtration.ThemeEditor.Services;
|
||||
using Filtration.ThemeEditor.ViewModels;
|
||||
@@ -34,7 +35,20 @@ namespace Filtration.ThemeEditor.Providers
|
||||
var themeComponentCollection = script.ThemeComponents.Aggregate(new ThemeComponentCollection(),
|
||||
(c, component) =>
|
||||
{
|
||||
c.Add(new ThemeComponent(component.ComponentType, component.ComponentName, component.Color));
|
||||
switch(component.ComponentType)
|
||||
{
|
||||
case ThemeComponentType.BackgroundColor:
|
||||
case ThemeComponentType.BorderColor:
|
||||
case ThemeComponentType.TextColor:
|
||||
c.Add(new ColorThemeComponent(component.ComponentType, component.ComponentName, ((ColorThemeComponent)component).Color));
|
||||
break;
|
||||
case ThemeComponentType.FontSize:
|
||||
c.Add(new IntegerThemeComponent(component.ComponentType, component.ComponentName, ((IntegerThemeComponent)component).Value));
|
||||
break;
|
||||
case ThemeComponentType.AlertSound:
|
||||
c.Add(new StrIntThemeComponent(component.ComponentType, component.ComponentName, ((StrIntThemeComponent)component).Value, ((StrIntThemeComponent)component).SecondValue));
|
||||
break;
|
||||
}
|
||||
return c;
|
||||
});
|
||||
|
||||
|
||||
BIN
Filtration.ThemeEditor/Resources/open_icon.png
Normal file
BIN
Filtration.ThemeEditor/Resources/open_icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 411 B |
BIN
Filtration.ThemeEditor/Resources/speaker_icon.png
Normal file
BIN
Filtration.ThemeEditor/Resources/speaker_icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.6 KiB |
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using Filtration.Common.Services;
|
||||
@@ -29,38 +30,25 @@ namespace Filtration.ThemeEditor.Services
|
||||
var mismatchedComponents = false;
|
||||
foreach (var component in theme.Components)
|
||||
{
|
||||
var componentMatched = false;
|
||||
Type targetType = null;
|
||||
var blocks = script.ItemFilterBlocks.OfType<ItemFilterBlock>();
|
||||
switch (component.ComponentType)
|
||||
{
|
||||
case ThemeComponentType.BackgroundColor:
|
||||
targetType = typeof (BackgroundColorBlockItem);
|
||||
mismatchedComponents = ApplyColorTheme(blocks, typeof(BackgroundColorBlockItem), component);
|
||||
break;
|
||||
case ThemeComponentType.TextColor:
|
||||
targetType = typeof (TextColorBlockItem);
|
||||
mismatchedComponents = ApplyColorTheme(blocks, typeof(TextColorBlockItem), component);
|
||||
break;
|
||||
case ThemeComponentType.BorderColor:
|
||||
targetType = typeof (BorderColorBlockItem);
|
||||
mismatchedComponents = ApplyColorTheme(blocks, typeof(BorderColorBlockItem), component);
|
||||
break;
|
||||
case ThemeComponentType.FontSize:
|
||||
mismatchedComponents = ApplyIntegerTheme(blocks, typeof(FontSizeBlockItem), component);
|
||||
break;
|
||||
case ThemeComponentType.AlertSound:
|
||||
mismatchedComponents = ApplyStrIntTheme(blocks, typeof(SoundBlockItem), component);
|
||||
mismatchedComponents = ApplyStrIntTheme(blocks, typeof(PositionalSoundBlockItem), component);
|
||||
break;
|
||||
}
|
||||
|
||||
foreach (var block in script.ItemFilterBlocks.OfType<ItemFilterBlock>())
|
||||
{
|
||||
foreach (var blockItem in block.BlockItems.Where(i => i.GetType() == targetType))
|
||||
{
|
||||
var colorBlockItem = (ColorBlockItem) blockItem;
|
||||
if (colorBlockItem.ThemeComponent != null &&
|
||||
colorBlockItem.ThemeComponent.ComponentName == component.ComponentName)
|
||||
{
|
||||
colorBlockItem.Color = component.Color;
|
||||
componentMatched = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!componentMatched)
|
||||
{
|
||||
mismatchedComponents = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,5 +59,66 @@ namespace Filtration.ThemeEditor.Services
|
||||
MessageBoxButton.OK, MessageBoxImage.Exclamation);
|
||||
}
|
||||
}
|
||||
|
||||
private bool ApplyColorTheme(IEnumerable<ItemFilterBlock> blocks, Type type, ThemeComponent component)
|
||||
{
|
||||
var componentMatched = false;
|
||||
foreach (var block in blocks)
|
||||
{
|
||||
foreach (var blockItem in block.BlockItems.Where(i => i.GetType() == type))
|
||||
{
|
||||
var colorBlockItem = (ColorBlockItem)blockItem;
|
||||
if (colorBlockItem.ThemeComponent != null &&
|
||||
colorBlockItem.ThemeComponent.ComponentName == component.ComponentName)
|
||||
{
|
||||
colorBlockItem.Color = ((ColorThemeComponent)component).Color;
|
||||
componentMatched = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return !componentMatched;
|
||||
}
|
||||
|
||||
private bool ApplyIntegerTheme(IEnumerable<ItemFilterBlock> blocks, Type type, ThemeComponent component)
|
||||
{
|
||||
var componentMatched = false;
|
||||
foreach (var block in blocks)
|
||||
{
|
||||
foreach (var blockItem in block.BlockItems.Where(i => i.GetType() == type))
|
||||
{
|
||||
var colorBlockItem = (IntegerBlockItem)blockItem;
|
||||
if (colorBlockItem.ThemeComponent != null &&
|
||||
colorBlockItem.ThemeComponent.ComponentName == component.ComponentName)
|
||||
{
|
||||
colorBlockItem.Value = ((IntegerThemeComponent)component).Value;
|
||||
componentMatched = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return !componentMatched;
|
||||
}
|
||||
|
||||
private bool ApplyStrIntTheme(IEnumerable<ItemFilterBlock> blocks, Type type, ThemeComponent component)
|
||||
{
|
||||
var componentMatched = false;
|
||||
foreach (var block in blocks)
|
||||
{
|
||||
foreach (var blockItem in block.BlockItems.Where(i => i.GetType() == type))
|
||||
{
|
||||
var colorBlockItem = (StrIntBlockItem)blockItem;
|
||||
if (colorBlockItem.ThemeComponent != null &&
|
||||
colorBlockItem.ThemeComponent.ComponentName == component.ComponentName)
|
||||
{
|
||||
colorBlockItem.Value = ((StrIntThemeComponent)component).Value;
|
||||
colorBlockItem.SecondValue = ((StrIntThemeComponent)component).SecondValue;
|
||||
componentMatched = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return !componentMatched;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace Filtration.ThemeEditor.ViewModels
|
||||
{
|
||||
public class ColorThemeComponentViewModel : ThemeComponentViewModel
|
||||
{
|
||||
public Color Color { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
using Filtration.ObjectModel.Enums;
|
||||
|
||||
namespace Filtration.ThemeEditor.ViewModels
|
||||
{
|
||||
public class EffectColorThemeComponentViewModel : ThemeComponentViewModel
|
||||
{
|
||||
public EffectColor EffectColor { get; set; }
|
||||
public bool Temporary { get; set; }
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user