40 Commits
0.15 ... 0.17

Author SHA1 Message Date
Ben Wallis
1ecec4e9dc Bumped version to 0.17 2017-12-08 17:58:53 +00:00
Ben Wallis
404a04c210 Merge pull request #51 from GlenCFL/fixes
0.16 Regression Fixing
2017-12-08 17:57:13 +00:00
GlenCFL
f1b2be7d74 Add in Ben's fix for Comments not setting dirty state. 2017-12-08 12:54:53 -05:00
GlenCFL
6393a53bf5 Remove code duplication. 2017-12-08 12:12:17 -05:00
GlenCFL
a0a72b5fe8 Mark comments as two way, fixing updating issues. 2017-12-08 10:44:22 -05:00
GlenCFL
d96234f099 Fix the contextual Delete Section command. 2017-12-08 09:15:01 -05:00
GlenCFL
07fdc2eb49 Fix the Add Section crash. 2017-12-08 07:41:16 -05:00
GlenCFL
86ff670fb0 Fix for the ShChaos sound not playing. 2017-12-08 01:42:00 -05:00
Ben Wallis
c9caed7e6b Fixed failing test 2017-12-07 22:35:06 +00:00
Ben Wallis
9cf4d86cb0 Fixed multiline comment saving 2017-12-07 22:22:26 +00:00
Ben Wallis
523a9553d9 Fixed section browser 2017-12-07 21:36:42 +00:00
Ben Wallis
b88730fb3a Merge pull request #49 from GlenCFL/master
Provide an update to fully support Path of Exile 3.1.
2017-12-07 20:19:14 +00:00
GlenCFL
06b88e85f2 Fix failing tests. 2017-12-07 14:27:03 -05:00
GlenCFL
b98988f0b5 Merge remote-tracking branch 'upstream/master' 2017-12-07 14:16:47 -05:00
Ben Wallis
d14e4e9320 Merge pull request #50 from ben-wallis/develop
Various changes from local repo
2017-12-07 18:24:46 +00:00
Ben Wallis
d91f7e1ac3 Fixed compile warnings 2017-12-07 18:18:05 +00:00
Ben Wallis
d84b17ced3 Implemented script-level undo/redo (currently hidden in UI) 2017-12-07 18:14:47 +00:00
GlenCFL
fef20ff36a Fix the halting issue on window close. 2017-12-07 12:53:44 -05:00
GlenCFL
23fa82655b Add tests for the new keywords. 2017-12-07 12:14:42 -05:00
GlenCFL
e5bd994164 Fix the existing tests. 2017-12-07 11:57:36 -05:00
GlenCFL
342487f800 Update the ordering of the BlockItems. 2017-12-07 09:26:33 -05:00
GlenCFL
8bf3527b69 Add support for PlayAlertSoundPositional. 2017-12-07 08:21:32 -05:00
GlenCFL
010e0dda31 Add support for the new alert sounds. 2017-12-07 06:49:25 -05:00
GlenCFL
2cf6a5953b Update both the item class and item base lists. 2017-12-06 23:24:30 -05:00
GlenCFL
1ebbe5b5a8 Add support for the new block types. 2017-12-06 23:03:46 -05:00
Ben Wallis
fee2a4dd99 Initial refactoring to support CommandManager 2017-06-17 13:50:44 +01:00
Ben Wallis
b65fad0679 FIL-4 Completed refactoring of Sections to ItemFilterCommentBlocks 2017-06-17 12:19:54 +01:00
Ben Wallis
43c6149832 Fixed failing tests 2017-05-20 18:34:45 +01:00
Ben Wallis
4def27c49d FIL-4 Refactored script parsing to retain isolated comments as a new ItemFilterBlockComment type - UI still needs reworking with new templates and such. 2017-05-20 18:14:28 +01:00
Ben Wallis
7b8ff1e3cb Update README.md 2017-05-14 14:15:11 +01:00
Ben Wallis
797c911bb5 FIL-13 Comments on the Show/Hide line are now preserved if block groups are not enabled for the script 2017-05-14 14:10:54 +01:00
Ben Wallis
8e54cc3b4b Fixed failing tests 2017-05-14 13:06:07 +01:00
Ben Wallis
ab7aefa8a6 FIL-11 Added BlockGroupsEnabled flag to ItemFilterScript (encapsulated in new ItemFilterScriptSettings object) 2017-05-14 13:02:30 +01:00
Ben Wallis
bb77138854 FIL-1 Changed Block Group Parsing to use " - " as delimiter instead of "-" 2017-05-14 12:12:42 +01:00
Ben Wallis
2d98f7de36 Updated appveyor.yml 2017-05-09 22:03:24 +01:00
Ben Wallis
6277917ae6 Updated Filtration.sln Visual Studio version from 14 to 15 2017-05-09 21:58:34 +01:00
Ben Wallis
3fe021949a Replaced AutoMapper usage for ItemFilterBlockGroup viewmodel mapping with constructor overload
Updated NuGet packages
2017-05-09 21:41:51 +01:00
Ben Wallis
733c7d1757 Added [Ignore] to integration unit tests 2017-05-08 20:12:24 +01:00
Ben Wallis
702c118783 Added appveyor.yml 2017-05-08 20:09:29 +01:00
Ben Wallis
11d85fdd1b Update README.md 2016-12-03 12:22:15 +00:00
183 changed files with 5123 additions and 2335 deletions

183
.gitignore vendored
View File

@@ -1,23 +1,37 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
# User-specific files
/.vs/
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
build/
x86/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
# Roslyn cache directories
*.ide/
# Visual Studio 2015/2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# Visual Studio 2017 auto generated files
Generated\ Files/
# MSTest test Results
[Tt]est[Rr]esult*/
@@ -32,6 +46,19 @@ TestResult.xml
[Rr]eleasePS/
dlldata.c
# Benchmark Results
BenchmarkDotNet.Artifacts/
# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/
**/Properties/launchSettings.json
# StyleCop
StyleCopReport.xml
# Files built by Visual Studio
*_i.c
*_p.c
*_i.h
@@ -64,14 +91,21 @@ _Chutzpah*
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# Visual Studio Trace Files
*.e2e
# TFS 2012 Local Workspace
$tf/
@@ -84,7 +118,7 @@ _ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding addin-in
# JustCode is a .NET coding add-in
.JustCode
# TeamCity is a build add-in
@@ -93,9 +127,18 @@ _TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json
# Visual Studio code coverage results
*.coverage
*.coveragexml
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
@@ -123,42 +166,63 @@ publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
## TODO: Comment the next line if you want to checkin your
## web deploy settings but do note that will include unencrypted
## passwords
#*.pubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# NuGet Packages Directory
packages/*
## TODO: If the tool you use requires repositories.config
## uncomment the next line
#!packages/repositories.config
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# Enable "build/" folder in the NuGet Packages folder since
# NuGet packages use it for MSBuild targets.
# This line needs to be after the ignore of the build folder
# (and the packages folder if the line above has been uncommented)
!packages/build/
# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
# Windows Azure Build Output
# Microsoft Azure Build Output
csx/
*.build.csdef
# Windows Store app package directory
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/
# Others
sql/
*.Cache
ClientBin/
[Ss]tyle[Cc]op.*
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
node_modules/
orleans.codegen.cs
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
@@ -174,6 +238,7 @@ UpgradeLog*.htm
# SQL Server files
*.mdf
*.ldf
*.ndf
# Business Intelligence projects
*.rdl.data
@@ -183,7 +248,69 @@ UpgradeLog*.htm
# Microsoft Fakes
FakesAssemblies/
# LightSwitch generated files
GeneratedArtifacts/
_Pvt_Extensions/
ModelManifest.xml
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# TypeScript v1 declaration files
typings/
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# JetBrains Rider
.idea/
*.sln.iml
# CodeRush
.cr/
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Tabs Studio
*.tss
# Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs
# OpenCover UI analysis results
OpenCover/
# Azure Stream Analytics local run output
ASALocalRun/

View File

@@ -35,13 +35,11 @@
<HintPath>..\packages\Castle.Core.3.3.3\lib\net45\Castle.Core.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Moq, Version=4.5.21.0, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
<HintPath>..\packages\Moq.4.5.21\lib\net45\Moq.dll</HintPath>
<Private>True</Private>
<Reference Include="Moq, Version=4.5.30.0, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
<HintPath>..\packages\Moq.4.5.30\lib\net45\Moq.dll</HintPath>
</Reference>
<Reference Include="nunit.framework, Version=3.4.1.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
<HintPath>..\packages\NUnit.3.4.1\lib\net45\nunit.framework.dll</HintPath>
<Private>True</Private>
<Reference Include="nunit.framework, Version=3.6.1.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
<HintPath>..\packages\NUnit.3.6.1\lib\net45\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />

View File

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

View File

@@ -35,8 +35,8 @@
<HintPath>..\packages\Castle.Core.3.3.3\lib\net45\Castle.Core.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Castle.Windsor">
<HintPath>..\packages\Castle.Windsor.3.3.0\lib\net45\Castle.Windsor.dll</HintPath>
<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="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>

View File

@@ -2,6 +2,7 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Text;
@@ -21,6 +22,7 @@ namespace Filtration.Common.Utilities
/// the stream into text.
/// </summary>
/// <param name="streamSource">Data source</param>
[DebuggerStepThrough]
public LineReader(Func<Stream> streamSource)
: this(streamSource, Encoding.UTF8)
{
@@ -33,6 +35,7 @@ namespace Filtration.Common.Utilities
/// <param name="streamSource">Data source</param>
/// <param name="encoding">Encoding to use to decode the stream
/// into text</param>
[DebuggerStepThrough]
public LineReader(Func<Stream> streamSource, Encoding encoding)
: this(() => new StreamReader(streamSource(), encoding))
{
@@ -44,6 +47,7 @@ namespace Filtration.Common.Utilities
/// UTF8 is used to decode the file into text.
/// </summary>
/// <param name="filename">File to read from</param>
[DebuggerStepThrough]
public LineReader(string filename)
: this(filename, Encoding.UTF8)
{
@@ -56,6 +60,7 @@ namespace Filtration.Common.Utilities
/// <param name="filename">File to read from</param>
/// <param name="encoding">Encoding to use to decode the file
/// into text</param>
[DebuggerStepThrough]
public LineReader(string filename, Encoding encoding)
: this(() => new StreamReader(filename, encoding))
{
@@ -66,6 +71,7 @@ namespace Filtration.Common.Utilities
/// is only called when the enumerator is fetched
/// </summary>
/// <param name="dataSource">Data source</param>
[DebuggerStepThrough]
public LineReader(Func<TextReader> dataSource)
{
_dataSource = dataSource;
@@ -74,6 +80,7 @@ namespace Filtration.Common.Utilities
/// <summary>
/// Enumerates the data source line by line.
/// </summary>
[DebuggerStepThrough]
public IEnumerator<string> GetEnumerator()
{
using (TextReader reader = _dataSource())
@@ -89,6 +96,7 @@ namespace Filtration.Common.Utilities
/// <summary>
/// Enumerates the data source line by line.
/// </summary>
[DebuggerStepThrough]
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Castle.Core" version="3.3.3" targetFramework="net451" />
<package id="Castle.Windsor" version="3.3.0" targetFramework="net451" />
<package id="Castle.Windsor" version="3.4.0" targetFramework="net461" />
<package id="CommonServiceLocator" version="1.3" targetFramework="net451" />
<package id="MvvmLightLibs" version="5.3.0.0" targetFramework="net461" />
</packages>

View File

@@ -46,9 +46,8 @@
<HintPath>..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.SqlServer.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="nunit.framework, Version=3.4.1.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
<HintPath>..\packages\NUnit.3.4.1\lib\net45\nunit.framework.dll</HintPath>
<Private>True</Private>
<Reference Include="nunit.framework, Version=3.6.1.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
<HintPath>..\packages\NUnit.3.6.1\lib\net45\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.ComponentModel.DataAnnotations" />

View File

@@ -6,6 +6,7 @@ using NUnit.Framework;
namespace Filtration.ItemFilterPreview.Data.Tests.Repositories
{
[Ignore("integration test")]
[TestFixture]
public class TestItemSetRepository
{

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="EntityFramework" version="6.1.3" targetFramework="net461" />
<package id="NUnit" version="3.4.1" targetFramework="net461" />
<package id="NUnit" version="3.6.1" targetFramework="net461" />
<package id="System.Data.SQLite" version="1.0.102.0" targetFramework="net461" />
<package id="System.Data.SQLite.Core" version="1.0.102.0" targetFramework="net461" />
<package id="System.Data.SQLite.EF6" version="1.0.102.0" targetFramework="net461" />

View File

@@ -46,21 +46,17 @@
<HintPath>..\packages\Castle.Core.3.3.3\lib\net45\Castle.Core.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="FluentAssertions, Version=4.13.1.0, Culture=neutral, PublicKeyToken=33f2691a05b67b6a, processorArchitecture=MSIL">
<HintPath>..\packages\FluentAssertions.4.13.1\lib\net45\FluentAssertions.dll</HintPath>
<Private>True</Private>
<Reference Include="FluentAssertions, Version=4.19.2.0, Culture=neutral, PublicKeyToken=33f2691a05b67b6a, processorArchitecture=MSIL">
<HintPath>..\packages\FluentAssertions.4.19.2\lib\net45\FluentAssertions.dll</HintPath>
</Reference>
<Reference Include="FluentAssertions.Core, Version=4.13.1.0, Culture=neutral, PublicKeyToken=33f2691a05b67b6a, processorArchitecture=MSIL">
<HintPath>..\packages\FluentAssertions.4.13.1\lib\net45\FluentAssertions.Core.dll</HintPath>
<Private>True</Private>
<Reference Include="FluentAssertions.Core, Version=4.19.2.0, Culture=neutral, PublicKeyToken=33f2691a05b67b6a, processorArchitecture=MSIL">
<HintPath>..\packages\FluentAssertions.4.19.2\lib\net45\FluentAssertions.Core.dll</HintPath>
</Reference>
<Reference Include="Moq, Version=4.5.21.0, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
<HintPath>..\packages\Moq.4.5.21\lib\net45\Moq.dll</HintPath>
<Private>True</Private>
<Reference Include="Moq, Version=4.5.30.0, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
<HintPath>..\packages\Moq.4.5.30\lib\net45\Moq.dll</HintPath>
</Reference>
<Reference Include="nunit.framework, Version=3.4.1.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
<HintPath>..\packages\NUnit.3.4.1\lib\net45\nunit.framework.dll</HintPath>
<Private>True</Private>
<Reference Include="nunit.framework, Version=3.6.1.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
<HintPath>..\packages\NUnit.3.6.1\lib\net45\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Xml" />
@@ -121,7 +117,6 @@
<None Include="packages.config" />
<None Include="Resources\MuldiniFilterScript.txt" />
</ItemGroup>
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
<Import Project="$(MSBuildBinPath)\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.

View File

@@ -6,6 +6,7 @@ using Filtration.ItemFilterPreview.Tests.Properties;
using Filtration.ObjectModel;
using Filtration.ObjectModel.BlockItemTypes;
using Filtration.ObjectModel.Enums;
using Filtration.ObjectModel.Factories;
using Filtration.Parser.Services;
using Moq;
using NUnit.Framework;
@@ -29,7 +30,7 @@ namespace Filtration.ItemFilterPreview.Tests.Services
//Arrange
var testInputItem = Mock.Of<IItem>();
var testInputBlock = Mock.Of<IItemFilterBlock>();
var testInputScript = Mock.Of<IItemFilterScript>(s => s.ItemFilterBlocks == new ObservableCollection<IItemFilterBlock> {testInputBlock});
var testInputScript = Mock.Of<IItemFilterScript>(s => s.ItemFilterBlocks == new ObservableCollection<IItemFilterBlockBase> {testInputBlock});
_testUtility.MockBlockItemMatcher
.Setup(b => b.ItemBlockMatch(testInputBlock, testInputItem))
@@ -50,7 +51,7 @@ namespace Filtration.ItemFilterPreview.Tests.Services
//Arrange
var testInputItem = Mock.Of<IItem>();
var testInputBlock = Mock.Of<IItemFilterBlock>();
var testInputScript = Mock.Of<IItemFilterScript>(s => s.ItemFilterBlocks == new ObservableCollection<IItemFilterBlock> { testInputBlock });
var testInputScript = Mock.Of<IItemFilterScript>(s => s.ItemFilterBlocks == new ObservableCollection<IItemFilterBlockBase> { testInputBlock });
_testUtility.MockBlockItemMatcher
.Setup(b => b.ItemBlockMatch(testInputBlock, testInputItem))
@@ -71,7 +72,12 @@ namespace Filtration.ItemFilterPreview.Tests.Services
//Arrange
var testInputScriptFile = Resources.MuldiniFilterScript;
var blockGroupHierarchyBuilder = new BlockGroupHierarchyBuilder();
var scriptTranslator = new ItemFilterScriptTranslator(new ItemFilterBlockTranslator(blockGroupHierarchyBuilder), blockGroupHierarchyBuilder);
var mockItemFilterScriptFactory = new Mock<IItemFilterScriptFactory>();
mockItemFilterScriptFactory
.Setup(i => i.Create())
.Returns(new ItemFilterScript());
var scriptTranslator = new ItemFilterScriptTranslator(blockGroupHierarchyBuilder, new ItemFilterBlockTranslator(blockGroupHierarchyBuilder), mockItemFilterScriptFactory.Object);
var script = scriptTranslator.TranslateStringToItemFilterScript(testInputScriptFile);
var testInputItem = new Item
@@ -101,7 +107,11 @@ namespace Filtration.ItemFilterPreview.Tests.Services
//Arrange
var testInputScriptFile = Resources.MuldiniFilterScript;
var blockGroupHierarchyBuilder = new BlockGroupHierarchyBuilder();
var scriptTranslator = new ItemFilterScriptTranslator(new ItemFilterBlockTranslator(blockGroupHierarchyBuilder), blockGroupHierarchyBuilder);
var mockItemFilterScriptFactory = new Mock<IItemFilterScriptFactory>();
mockItemFilterScriptFactory
.Setup(i => i.Create())
.Returns(new ItemFilterScript());
var scriptTranslator = new ItemFilterScriptTranslator(blockGroupHierarchyBuilder, new ItemFilterBlockTranslator(blockGroupHierarchyBuilder), mockItemFilterScriptFactory.Object);
var script = scriptTranslator.TranslateStringToItemFilterScript(testInputScriptFile);
var testInputItems = new List<IItem>

View File

@@ -6,7 +6,6 @@ using System.Xml.Serialization;
using Filtration.ObjectModel;
using Filtration.ObjectModel.Enums;
using NUnit.Framework;
using YamlDotNet.Serialization;
namespace Filtration.ItemFilterPreview.Tests.Services
{
@@ -40,7 +39,6 @@ namespace Filtration.ItemFilterPreview.Tests.Services
output = textWriter.ToString();
}
var x = 2;
//Assert
}
}

View File

@@ -8,7 +8,7 @@
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="ControlzEx" publicKeyToken="f08b075e934b7045" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.1.2.3" newVersion="2.1.2.3" />
<bindingRedirect oldVersion="0.0.0.0-2.2.0.4" newVersion="2.2.0.4" />
</dependentAssembly>
</assemblyBinding>
</runtime>

View File

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

View File

@@ -40,9 +40,8 @@
<HintPath>..\packages\Castle.Core.3.3.3\lib\net45\Castle.Core.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Castle.Windsor, Version=3.3.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
<HintPath>..\packages\Castle.Windsor.3.3.0\lib\net45\Castle.Windsor.dll</HintPath>
<Private>True</Private>
<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="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>
@@ -60,9 +59,8 @@
<HintPath>..\packages\CommonServiceLocator.1.3\lib\portable-net4+sl5+netcore45+wpa81+wp8\Microsoft.Practices.ServiceLocation.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Moq, Version=4.5.21.0, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
<HintPath>..\packages\Moq.4.5.21\lib\net45\Moq.dll</HintPath>
<Private>True</Private>
<Reference Include="Moq, Version=4.5.30.0, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
<HintPath>..\packages\Moq.4.5.30\lib\net45\Moq.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />

View File

@@ -31,7 +31,7 @@ namespace Filtration.ItemFilterPreview.Services
sw.Restart();
var matchedBlock = itemFilterScript.ItemFilterBlocks
.Where(b => !(b is ItemFilterSection))
.OfType<IItemFilterBlock>()
.FirstOrDefault(block => _blockItemMatcher.ItemBlockMatch(block, item));
filteredItems.Add(new FilteredItem(item, matchedBlock));

View File

@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Castle.Core" version="3.3.3" targetFramework="net461" />
<package id="Castle.Windsor" version="3.3.0" targetFramework="net461" />
<package id="Castle.Windsor" version="3.4.0" targetFramework="net461" />
<package id="CommonServiceLocator" version="1.3" targetFramework="net461" />
<package id="Moq" version="4.5.21" targetFramework="net461" />
<package id="Moq" version="4.5.30" targetFramework="net461" />
<package id="MvvmLightLibs" version="5.3.0.0" targetFramework="net461" />
</packages>

View File

@@ -35,13 +35,11 @@
<HintPath>..\packages\Castle.Core.3.3.3\lib\net45\Castle.Core.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Moq, Version=4.5.21.0, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
<HintPath>..\packages\Moq.4.5.21\lib\net45\Moq.dll</HintPath>
<Private>True</Private>
<Reference Include="Moq, Version=4.5.30.0, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
<HintPath>..\packages\Moq.4.5.30\lib\net45\Moq.dll</HintPath>
</Reference>
<Reference Include="nunit.framework, Version=3.4.1.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
<HintPath>..\packages\NUnit.3.4.1\lib\net45\nunit.framework.dll</HintPath>
<Private>True</Private>
<Reference Include="nunit.framework, Version=3.6.1.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
<HintPath>..\packages\NUnit.3.6.1\lib\net45\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="PresentationCore" />
<Reference Include="System" />

View File

@@ -6,23 +6,6 @@ namespace Filtration.ObjectModel.Tests
[TestFixture]
public class TestItemFilterBlock
{
[Test]
public void ItemFilterBlock_BlockCount_ReturnsCorrectNumber()
{
// Arrange
var block = new ItemFilterBlock();
block.BlockItems.Add(new ItemLevelBlockItem());
block.BlockItems.Add(new ItemLevelBlockItem());
block.BlockItems.Add(new ItemLevelBlockItem());
block.BlockItems.Add(new ItemLevelBlockItem());
// Act
var count = block.BlockCount(typeof (ItemLevelBlockItem));
// Assert
Assert.AreEqual(4, count);
}
[Test]
public void ItemFilterBlock_AddBlockItemAllowed_LessThanMaximum_ReturnsTrue()
{

View File

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

View File

@@ -15,7 +15,7 @@ namespace Filtration.ObjectModel.BlockItemBaseTypes
public BlockAction Action
{
get { return _action; }
get => _action;
set
{
_action = value;
@@ -27,6 +27,8 @@ namespace Filtration.ObjectModel.BlockItemBaseTypes
}
}
public string Comment { get; set; }
public override string OutputText => Action.GetAttributeDescription();
public override string PrefixText => string.Empty;

View File

@@ -0,0 +1,50 @@
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();
}
}
}
}

View File

@@ -16,6 +16,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 => 15;
public override int SortOrder => 18;
}
}

View File

@@ -33,6 +33,6 @@ namespace Filtration.ObjectModel.BlockItemTypes
public override Color SummaryBackgroundColor => Colors.MediumTurquoise;
public override Color SummaryTextColor => Colors.Black;
public override int SortOrder => 11;
public override int SortOrder => 16;
}
}

View File

@@ -16,6 +16,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 => 16;
public override int SortOrder => 19;
}
}

View File

@@ -33,6 +33,6 @@ namespace Filtration.ObjectModel.BlockItemTypes
public override Color SummaryBackgroundColor => Colors.MediumSeaGreen;
public override Color SummaryTextColor => Colors.White;
public override int SortOrder => 10;
public override int SortOrder => 15;
}
}

View File

@@ -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 => 9;
public override int SortOrder => 13;
public override int Minimum => 0;
public override int Maximum => 100;
}

View File

@@ -0,0 +1,23 @@
using System.Windows.Media;
using Filtration.ObjectModel.BlockItemBaseTypes;
namespace Filtration.ObjectModel.BlockItemTypes
{
public sealed class ElderItemBlockItem : BooleanBlockItem
{
public ElderItemBlockItem()
{
}
public ElderItemBlockItem(bool booleanValue) : base(booleanValue)
{
}
public override string PrefixText => "ElderItem";
public override string DisplayHeading => "Elder Item";
public override Color SummaryBackgroundColor => Colors.DarkGray;
public override Color SummaryTextColor => Colors.White;
public override int SortOrder => 6;
}
}

View File

@@ -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 => 17;
public override int SortOrder => 20;
public override int Minimum => 11;
public override int Maximum => 45;
}

View File

@@ -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 => 7;
public override int SortOrder => 10;
public override int Minimum => 0;
public override int Maximum => 6;
}

View File

@@ -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 => 13;
public override int SortOrder => 12;
public override int Minimum => 0;
public override int Maximum => 100;
}

View File

@@ -21,7 +21,7 @@ namespace Filtration.ObjectModel.BlockItemTypes
public override string SummaryText => "Linked Sockets " + FilterPredicate;
public override Color SummaryBackgroundColor => Colors.Gold;
public override Color SummaryTextColor => Colors.Black;
public override int SortOrder => 0;
public override int SortOrder => 1;
public override int Minimum => 0;
public override int Maximum => 6;
}

View File

@@ -0,0 +1,22 @@
using Filtration.ObjectModel.BlockItemBaseTypes;
namespace Filtration.ObjectModel.BlockItemTypes
{
public class PositionalSoundBlockItem : StrIntBlockItem
{
public PositionalSoundBlockItem()
{
Value = "1";
SecondValue = 79;
}
public PositionalSoundBlockItem(string value, int secondValue) : base(value, secondValue)
{
}
public override string PrefixText => "PlayAlertSoundPositional";
public override int MaximumAllowed => 1;
public override string DisplayHeading => "Play Positional Alert Sound";
public override int SortOrder => 22;
}
}

View File

@@ -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 => 12;
public override int SortOrder => 14;
public override int Minimum => 0;
public override int Maximum => (int)ItemRarity.Unique;
}

View File

@@ -0,0 +1,23 @@
using System.Windows.Media;
using Filtration.ObjectModel.BlockItemBaseTypes;
namespace Filtration.ObjectModel.BlockItemTypes
{
public sealed class ShapedMapBlockItem : BooleanBlockItem
{
public ShapedMapBlockItem()
{
}
public ShapedMapBlockItem(bool booleanValue) : base(booleanValue)
{
}
public override string PrefixText => "ShapedMap";
public override string DisplayHeading => "Shaped Map";
public override Color SummaryBackgroundColor => Colors.DarkGoldenrod;
public override Color SummaryTextColor => Colors.White;
public override int SortOrder => 8;
}
}

View File

@@ -0,0 +1,23 @@
using System.Windows.Media;
using Filtration.ObjectModel.BlockItemBaseTypes;
namespace Filtration.ObjectModel.BlockItemTypes
{
public sealed class ShaperItemBlockItem : BooleanBlockItem
{
public ShaperItemBlockItem()
{
}
public ShaperItemBlockItem(bool booleanValue) : base(booleanValue)
{
}
public override string PrefixText => "ShaperItem";
public override string DisplayHeading => "Shaper Item";
public override Color SummaryBackgroundColor => Colors.DimGray;
public override Color SummaryTextColor => Colors.White;
public override int SortOrder => 7;
}
}

View File

@@ -39,7 +39,7 @@ namespace Filtration.ObjectModel.BlockItemTypes
public override Color SummaryBackgroundColor => Colors.GhostWhite;
public override Color SummaryTextColor => Colors.Black;
public override int SortOrder => 6;
public override int SortOrder => 9;
private SocketColor StringToSocketColor(char socketColorString)
{

View File

@@ -2,21 +2,21 @@
namespace Filtration.ObjectModel.BlockItemTypes
{
public class SoundBlockItem : DualIntegerBlockItem
public class SoundBlockItem : StrIntBlockItem
{
public SoundBlockItem()
{
Value = 1;
Value = "1";
SecondValue = 79;
}
public SoundBlockItem(int value, int secondValue) : base(value, secondValue)
public SoundBlockItem(string value, int secondValue) : base(value, secondValue)
{
}
public override string PrefixText => "PlayAlertSound";
public override int MaximumAllowed => 1;
public override string DisplayHeading => "Play Alert Sound";
public override int SortOrder => 18;
public override int SortOrder => 21;
}
}

View File

@@ -16,6 +16,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 => 14;
public override int SortOrder => 17;
}
}

View File

@@ -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 => 8;
public override int SortOrder => 11;
public override int Minimum => 0;
public override int Maximum => 2;
}

View File

@@ -0,0 +1,61 @@
using System.Collections.Generic;
namespace Filtration.ObjectModel.Commands
{
public interface ICommandManager
{
void ExecuteCommand(ICommand command);
void Undo(int undoLevels = 1);
void Redo(int redoLevels = 1);
}
public interface ICommandManagerInternal : ICommandManager
{
void SetScript(IItemFilterScriptInternal layout);
}
internal class CommandManager : ICommandManagerInternal
{
private readonly Stack<IUndoableCommand> _undoCommandStack = new Stack<IUndoableCommand>();
private readonly Stack<IUndoableCommand> _redoCommandStack = new Stack<IUndoableCommand>();
private IItemFilterScriptInternal _itemFilterScript;
public void SetScript(IItemFilterScriptInternal itemFilterScript)
{
_itemFilterScript = itemFilterScript;
}
public void ExecuteCommand(ICommand command)
{
command.Execute();
if (command is IUndoableCommand undoableCommand)
{
_undoCommandStack.Push(undoableCommand);
_redoCommandStack.Clear();
}
_itemFilterScript.SetIsDirty(true);
}
public void Undo(int undoLevels = 1)
{
for (var index = undoLevels; _undoCommandStack.Count > 0 && index > 0; --index)
{
var undoableCommand = _undoCommandStack.Pop();
undoableCommand.Undo();
_redoCommandStack.Push(undoableCommand);
}
_itemFilterScript.SetIsDirty(true);
}
public void Redo(int redoLevels = 1)
{
for (int index = redoLevels; _redoCommandStack.Count > 0 && index > 0; --index)
{
var undoableCommand = _redoCommandStack.Pop();
undoableCommand.Redo();
_undoCommandStack.Push(undoableCommand);
}
_itemFilterScript.SetIsDirty(true);
}
}
}

View File

@@ -0,0 +1,7 @@
namespace Filtration.ObjectModel.Commands
{
public interface ICommand
{
void Execute();
}
}

View File

@@ -0,0 +1,8 @@
namespace Filtration.ObjectModel.Commands
{
internal interface IUndoableCommand : ICommand
{
void Undo();
void Redo();
}
}

View File

@@ -0,0 +1,37 @@
using System;
namespace Filtration.ObjectModel.Commands.ItemFilterScript
{
public class AddBlockCommand : IUndoableCommand
{
private readonly IItemFilterScript _itemFilterScript;
private readonly IItemFilterBlockBase _addAfterItemFilterBlock;
private IItemFilterBlock _newItemFilterBlock;
public AddBlockCommand(IItemFilterScript itemFilterScript, IItemFilterBlockBase addAfterItemFilterBlock)
{
_itemFilterScript = itemFilterScript;
_addAfterItemFilterBlock = addAfterItemFilterBlock;
}
public void Execute()
{
_newItemFilterBlock = new ItemFilterBlock(_itemFilterScript);
if (_addAfterItemFilterBlock != null)
{
_itemFilterScript.ItemFilterBlocks.Insert(_itemFilterScript.ItemFilterBlocks.IndexOf(_addAfterItemFilterBlock) + 1, _newItemFilterBlock);
}
else
{
_itemFilterScript.ItemFilterBlocks.Add(_newItemFilterBlock);
}
}
public void Undo()
{
_itemFilterScript.ItemFilterBlocks.Remove(_newItemFilterBlock);
}
public void Redo() => Execute();
}
}

View File

@@ -0,0 +1,40 @@
using System;
namespace Filtration.ObjectModel.Commands.ItemFilterScript
{
public class AddCommentBlockCommand : IUndoableCommand
{
private readonly IItemFilterScript _itemFilterScript;
private readonly IItemFilterBlockBase _addAfterItemFilterBlock;
private IItemFilterCommentBlock _newItemFilterBlock;
public AddCommentBlockCommand(IItemFilterScript itemFilterScript, IItemFilterBlockBase addAfterItemFilterBlock)
{
_itemFilterScript = itemFilterScript;
_addAfterItemFilterBlock = addAfterItemFilterBlock;
}
public void Execute()
{
_newItemFilterBlock = new ItemFilterCommentBlock(_itemFilterScript)
{
Comment = string.Empty
};
if (_addAfterItemFilterBlock != null)
{
_itemFilterScript.ItemFilterBlocks.Insert(_itemFilterScript.ItemFilterBlocks.IndexOf(_addAfterItemFilterBlock) + 1, _newItemFilterBlock);
}
else
{
_itemFilterScript.ItemFilterBlocks.Add(_newItemFilterBlock);
}
}
public void Undo()
{
_itemFilterScript.ItemFilterBlocks.Remove(_newItemFilterBlock);
}
public void Redo() => Execute();
}
}

View File

@@ -0,0 +1,39 @@
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();
}
}

View File

@@ -0,0 +1,30 @@
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();
}
}

View File

@@ -0,0 +1,30 @@
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();
}
}

View File

@@ -0,0 +1,39 @@
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();
}
}

View File

@@ -0,0 +1,37 @@
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();
}
}

View File

@@ -0,0 +1,29 @@
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();
}
}

View File

@@ -0,0 +1,30 @@
using System;
namespace Filtration.ObjectModel.Commands.ItemFilterScript
{
public class SetScriptDescriptionCommand : IUndoableCommand
{
private readonly IItemFilterScript _itemFilterScript;
private readonly string _newDescription;
private string _oldDescription;
public SetScriptDescriptionCommand(IItemFilterScript itemFilterScript, string newDescription)
{
_itemFilterScript = itemFilterScript;
_newDescription = newDescription;
}
public void Execute()
{
_oldDescription = _itemFilterScript.Description;
_itemFilterScript.Description = _newDescription;
}
public void Undo()
{
_itemFilterScript.Description = _oldDescription;
}
public void Redo() => Execute();
}
}

View File

@@ -0,0 +1,9 @@
namespace Filtration.ObjectModel.Factories
{
public interface IItemFilterScriptFactory
{
IItemFilterScript Create();
void Release(IItemFilterScript itemFilterScript);
}
}

View File

@@ -31,6 +31,12 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Castle.Core, Version=3.3.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
<HintPath>..\packages\Castle.Core.3.3.0\lib\net45\Castle.Core.dll</HintPath>
</Reference>
<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="PresentationCore" />
<Reference Include="System" />
<Reference Include="System.ComponentModel.DataAnnotations" />
@@ -47,6 +53,7 @@
<Compile Include="BlockItemBaseTypes\BooleanBlockItem.cs" />
<Compile Include="BlockItemBaseTypes\ColorBlockItem.cs" />
<Compile Include="BlockItemBaseTypes\DualIntegerBlockItem.cs" />
<Compile Include="BlockItemBaseTypes\StringIntBlockItem.cs" />
<Compile Include="BlockItemBaseTypes\IntegerBlockItem.cs" />
<Compile Include="BlockItemBaseTypes\NumericFilterPredicateBlockItem.cs" />
<Compile Include="BlockItemBaseTypes\StringListBlockItem.cs" />
@@ -54,6 +61,9 @@
<Compile Include="BlockItemTypes\BaseTypeBlockItem.cs" />
<Compile Include="BlockItemTypes\BorderColorBlockItem.cs" />
<Compile Include="BlockItemTypes\ClassBlockItem.cs" />
<Compile Include="BlockItemTypes\ShapedMapBlockItem.cs" />
<Compile Include="BlockItemTypes\ShaperItemBlockItem.cs" />
<Compile Include="BlockItemTypes\ElderItemBlockItem.cs" />
<Compile Include="BlockItemTypes\CorruptedBlockItem.cs" />
<Compile Include="BlockItemTypes\DropLevelBlockItem.cs" />
<Compile Include="BlockItemTypes\FontSizeBlockItem.cs" />
@@ -65,9 +75,22 @@
<Compile Include="BlockItemTypes\RarityBlockItem.cs" />
<Compile Include="BlockItemTypes\SocketGroupBlockItem.cs" />
<Compile Include="BlockItemTypes\SocketsBlockItem.cs" />
<Compile Include="BlockItemTypes\PositionalSoundBlockItem.cs" />
<Compile Include="BlockItemTypes\SoundBlockItem.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\AddCommentBlockCommand.cs" />
<Compile Include="Commands\ItemFilterScript\MoveBlockDownCommand.cs" />
<Compile Include="Commands\ItemFilterScript\MoveBlockUpCommand.cs" />
<Compile Include="Commands\ItemFilterScript\MoveBlockToTopCommand.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\FilterPredicateOperator.cs" />
@@ -77,6 +100,7 @@
<Compile Include="Enums\ThemeComponentType.cs" />
<Compile Include="Extensions\EnumHelper.cs" />
<Compile Include="Extensions\ItemRarityExtensions.cs" />
<Compile Include="Factories\IItemFilterScriptFactory.cs" />
<Compile Include="FilteredItem.cs" />
<Compile Include="IAudioVisualBlockItem.cs" />
<Compile Include="IItemFilterBlockItem.cs" />
@@ -84,7 +108,7 @@
<Compile Include="ItemFilterBlock.cs" />
<Compile Include="ItemFilterBlockGroup.cs" />
<Compile Include="ItemFilterScript.cs" />
<Compile Include="ItemFilterSection.cs" />
<Compile Include="ItemFilterScriptSettings.cs" />
<Compile Include="ItemSet.cs" />
<Compile Include="NumericFilterPredicate.cs" />
<Compile Include="PathOfExileNamedColors.cs" />
@@ -97,6 +121,8 @@
<Compile Include="ThemeEditor\Theme.cs" />
<Compile Include="ThemeEditor\ThemeComponent.cs" />
<Compile Include="ThemeEditor\ThemeComponentCollection.cs" />
<Compile Include="WindsorInstallers\CommandsInstaller.cs" />
<Compile Include="WindsorInstallers\ModelsInstaller.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.

View File

@@ -5,8 +5,6 @@ namespace Filtration.ObjectModel
{
public interface IItemFilterBlockItem : INotifyPropertyChanged
{
event PropertyChangedEventHandler PropertyChanged;
string PrefixText { get; }
string OutputText { get; }
string DisplayHeading { get; }

View File

@@ -4,44 +4,82 @@ using System.Linq;
using System.Windows.Media;
using Filtration.ObjectModel.BlockItemBaseTypes;
using Filtration.ObjectModel.BlockItemTypes;
using Filtration.ObjectModel.Commands;
using Filtration.ObjectModel.Enums;
using Filtration.ObjectModel.Extensions;
namespace Filtration.ObjectModel
{
public interface IItemFilterBlock
public interface IItemFilterBlock : IItemFilterBlockBase
{
bool Enabled { get; set; }
string Description { get; set; }
ItemFilterBlockGroup BlockGroup { get; set; }
BlockAction Action { get; set; }
ActionBlockItem ActionBlockItem { get; }
ObservableCollection<IItemFilterBlockItem> BlockItems { get; }
Color DisplayBackgroundColor { get; }
Color DisplayTextColor { get; }
Color DisplayBorderColor { get; }
double DisplayFontSize { get; }
int BlockCount(Type type);
bool AddBlockItemAllowed(Type type);
bool HasBlockItemOfType<T>();
bool HasBlockGroupInParentHierarchy(ItemFilterBlockGroup targetBlockGroup, ItemFilterBlockGroup startingBlockGroup);
}
public class ItemFilterBlock : IItemFilterBlock
public interface IItemFilterBlockBase
{
}
public abstract class ItemFilterBlockBase : IItemFilterBlockBase
{
protected ItemFilterBlockBase()
{
}
protected ItemFilterBlockBase(IItemFilterScript parentScript)
{
CommandManager = parentScript.CommandManager;
ParentScript = parentScript;
}
public ICommandManager CommandManager { get; }
public IItemFilterScript ParentScript { get; set; }
}
public interface IItemFilterCommentBlock : IItemFilterBlockBase
{
string Comment { get; set; }
}
public class ItemFilterCommentBlock : ItemFilterBlockBase, IItemFilterCommentBlock
{
public ItemFilterCommentBlock(IItemFilterScript parentScript) : base(parentScript)
{
}
public string Comment { get; set; }
}
public class ItemFilterBlock : ItemFilterBlockBase, IItemFilterBlock
{
private ItemFilterBlockGroup _blockGroup;
public ItemFilterBlock()
internal ItemFilterBlock()
{
BlockItems = new ObservableCollection<IItemFilterBlockItem> {new ActionBlockItem(BlockAction.Show)};
Enabled = true;
BlockItems = new ObservableCollection<IItemFilterBlockItem> { ActionBlockItem };
}
public bool Enabled { get; set; }
public ItemFilterBlock(IItemFilterScript parentScript) : base(parentScript)
{
BlockItems = new ObservableCollection<IItemFilterBlockItem> { ActionBlockItem };
}
public bool Enabled { get; set; } = true;
public string Description { get; set; }
public ItemFilterBlockGroup BlockGroup
{
get { return _blockGroup; }
get => _blockGroup;
set
{
var oldBlockGroup = _blockGroup;
@@ -79,17 +117,19 @@ namespace Filtration.ObjectModel
}
}
public ActionBlockItem ActionBlockItem { get; } = new ActionBlockItem(BlockAction.Show);
public ObservableCollection<IItemFilterBlockItem> BlockItems { get; }
public int BlockCount(Type type)
public bool AddBlockItemAllowed(Type type)
{
int BlockCount()
{
return BlockItems?.Count(b => b.GetType() == type) ?? 0;
}
public bool AddBlockItemAllowed(Type type)
{
var blockItem = (IItemFilterBlockItem)Activator.CreateInstance(type);
return BlockCount(type) < blockItem.MaximumAllowed;
return BlockCount() < blockItem.MaximumAllowed;
}
public bool HasBlockItemOfType<T>()

View File

@@ -1,45 +1,101 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
using Filtration.ObjectModel.Annotations;
using Filtration.ObjectModel.BlockItemTypes;
using Filtration.ObjectModel.Commands;
using Filtration.ObjectModel.ThemeEditor;
namespace Filtration.ObjectModel
{
public interface IItemFilterScript
public interface IItemFilterScript : INotifyPropertyChanged
{
ObservableCollection<IItemFilterBlock> ItemFilterBlocks { get; }
ICommandManager CommandManager { get; }
ObservableCollection<IItemFilterBlockBase> ItemFilterBlocks { get; }
ObservableCollection<ItemFilterBlockGroup> ItemFilterBlockGroups { get; }
ThemeComponentCollection ThemeComponents { get; set; }
string FilePath { get; set; }
string Description { get; set; }
DateTime DateModified { get; set; }
bool IsDirty { get; }
IItemFilterScriptSettings ItemFilterScriptSettings { get; }
List<string> Validate();
void ReplaceColors(ReplaceColorsParameterSet replaceColorsParameterSet);
}
public class ItemFilterScript : IItemFilterScript
public interface IItemFilterScriptInternal : IItemFilterScript
{
public ItemFilterScript()
void SetIsDirty(bool isDirty);
}
public class ItemFilterScript : IItemFilterScriptInternal
{
ItemFilterBlocks = new ObservableCollection<IItemFilterBlock>();
private bool _isDirty;
private string _description;
internal ItemFilterScript()
{
ItemFilterBlocks = new ObservableCollection<IItemFilterBlockBase>();
ItemFilterBlockGroups = new ObservableCollection<ItemFilterBlockGroup>
{
new ItemFilterBlockGroup("Root", null)
};
ThemeComponents = new ThemeComponentCollection { IsMasterCollection = true };
ItemFilterScriptSettings = new ItemFilterScriptSettings(ThemeComponents);
}
public ObservableCollection<IItemFilterBlock> ItemFilterBlocks { get; }
public ItemFilterScript(ICommandManagerInternal commandManager) : this()
{
CommandManager = commandManager;
commandManager.SetScript(this);
}
public ICommandManager CommandManager { get; }
public ObservableCollection<IItemFilterBlockBase> ItemFilterBlocks { get; }
public ObservableCollection<ItemFilterBlockGroup> ItemFilterBlockGroups { get; }
public ThemeComponentCollection ThemeComponents { get; set; }
public IItemFilterScriptSettings ItemFilterScriptSettings { get; }
public string FilePath { get; set; }
public string Description { get; set; }
public string Description
{
get => _description;
set
{
if (value == _description) return;
_description = value;
OnPropertyChanged();
}
}
public DateTime DateModified { get; set; }
public bool IsDirty
{
get => _isDirty;
private set
{
if (value == _isDirty) return;
_isDirty = value;
OnPropertyChanged();
}
}
public void SetIsDirty(bool isDirty)
{
IsDirty = isDirty;
}
public List<string> Validate()
{
var validationErrors = new List<string>();
@@ -54,9 +110,7 @@ namespace Filtration.ObjectModel
public void ReplaceColors(ReplaceColorsParameterSet replaceColorsParameterSet)
{
foreach (
var block in
ItemFilterBlocks.Where(b => BlockIsColorReplacementCandidate(replaceColorsParameterSet, b)))
foreach (var block in ItemFilterBlocks.OfType<ItemFilterBlock>().Where(b => BlockIsColorReplacementCandidate(replaceColorsParameterSet, b)))
{
if (replaceColorsParameterSet.ReplaceTextColor)
{
@@ -78,15 +132,9 @@ namespace Filtration.ObjectModel
private bool BlockIsColorReplacementCandidate(ReplaceColorsParameterSet replaceColorsParameterSet, IItemFilterBlock block)
{
var textColorItem = block.HasBlockItemOfType<TextColorBlockItem>()
? block.BlockItems.OfType<TextColorBlockItem>().First()
: null;
var backgroundColorItem = block.HasBlockItemOfType<BackgroundColorBlockItem>()
? block.BlockItems.OfType<BackgroundColorBlockItem>().First()
: null;
var borderColorItem = block.HasBlockItemOfType<BorderColorBlockItem>()
? block.BlockItems.OfType<BorderColorBlockItem>().First()
: null;
var textColorItem = block.BlockItems.OfType<TextColorBlockItem>().FirstOrDefault();
var backgroundColorItem = block.BlockItems.OfType<BackgroundColorBlockItem>().FirstOrDefault();
var borderColorItem = block.BlockItems.OfType<BorderColorBlockItem>().FirstOrDefault();
// If we don't have all of the things we want to replace, then we aren't a candidate for replacing those things.
if ((textColorItem == null && replaceColorsParameterSet.ReplaceTextColor) ||
@@ -109,5 +157,12 @@ namespace Filtration.ObjectModel
return true;
}
public event PropertyChangedEventHandler PropertyChanged;
[NotifyPropertyChangedInvocator]
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
}

View File

@@ -0,0 +1,21 @@
using Filtration.ObjectModel.ThemeEditor;
namespace Filtration.ObjectModel
{
public interface IItemFilterScriptSettings
{
bool BlockGroupsEnabled { get; set; }
ThemeComponentCollection ThemeComponentCollection { get; }
}
public class ItemFilterScriptSettings : IItemFilterScriptSettings
{
public ItemFilterScriptSettings(ThemeComponentCollection themeComponentCollection)
{
ThemeComponentCollection = themeComponentCollection;
}
public bool BlockGroupsEnabled { get; set; }
public ThemeComponentCollection ThemeComponentCollection { get; }
}
}

View File

@@ -1,6 +0,0 @@
namespace Filtration.ObjectModel
{
public class ItemFilterSection : ItemFilterBlock
{
}
}

View File

@@ -1,4 +1,26 @@
using System;
/* MIT License
Copyright (c) 2016 JetBrains http://www.jetbrains.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. */
using System;
#pragma warning disable 1591
// ReSharper disable UnusedMember.Global
@@ -7,7 +29,6 @@
// ReSharper disable IntroduceOptionalParameters.Global
// ReSharper disable MemberCanBeProtected.Global
// ReSharper disable InconsistentNaming
// ReSharper disable CheckNamespace
namespace Filtration.ObjectModel.Annotations
{
@@ -16,32 +37,37 @@ namespace Filtration.ObjectModel.Annotations
/// so the check for <c>null</c> is necessary before its usage.
/// </summary>
/// <example><code>
/// [CanBeNull] public object Test() { return null; }
/// public void UseTest() {
/// [CanBeNull] object Test() => null;
///
/// void UseTest() {
/// var p = Test();
/// var s = p.ToString(); // Warning: Possible 'System.NullReferenceException'
/// }
/// </code></example>
[AttributeUsage(
AttributeTargets.Method | AttributeTargets.Parameter | AttributeTargets.Property |
AttributeTargets.Delegate | AttributeTargets.Field | AttributeTargets.Event)]
AttributeTargets.Delegate | AttributeTargets.Field | AttributeTargets.Event |
AttributeTargets.Class | AttributeTargets.Interface | AttributeTargets.GenericParameter)]
public sealed class CanBeNullAttribute : Attribute { }
/// <summary>
/// Indicates that the value of the marked element could never be <c>null</c>.
/// </summary>
/// <example><code>
/// [NotNull] public object Foo() {
/// [NotNull] object Foo() {
/// return null; // Warning: Possible 'null' assignment
/// }
/// </code></example>
[AttributeUsage(
AttributeTargets.Method | AttributeTargets.Parameter | AttributeTargets.Property |
AttributeTargets.Delegate | AttributeTargets.Field | AttributeTargets.Event)]
AttributeTargets.Delegate | AttributeTargets.Field | AttributeTargets.Event |
AttributeTargets.Class | AttributeTargets.Interface | AttributeTargets.GenericParameter)]
public sealed class NotNullAttribute : Attribute { }
/// <summary>
/// Indicates that collection or enumerable value does not contain null elements.
/// Can be appplied to symbols of types derived from IEnumerable as well as to symbols of Task
/// and Lazy classes to indicate that the value of a collection item, of the Task.Result property
/// or of the Lazy.Value property can never be null.
/// </summary>
[AttributeUsage(
AttributeTargets.Method | AttributeTargets.Parameter | AttributeTargets.Property |
@@ -49,7 +75,9 @@ namespace Filtration.ObjectModel.Annotations
public sealed class ItemNotNullAttribute : Attribute { }
/// <summary>
/// Indicates that collection or enumerable value can contain null elements.
/// Can be appplied to symbols of types derived from IEnumerable as well as to symbols of Task
/// and Lazy classes to indicate that the value of a collection item, of the Task.Result property
/// or of the Lazy.Value property can be null.
/// </summary>
[AttributeUsage(
AttributeTargets.Method | AttributeTargets.Parameter | AttributeTargets.Property |
@@ -63,8 +91,9 @@ namespace Filtration.ObjectModel.Annotations
/// </summary>
/// <example><code>
/// [StringFormatMethod("message")]
/// public void ShowError(string message, params object[] args) { /* do something */ }
/// public void Foo() {
/// void ShowError(string message, params object[] args) { /* do something */ }
///
/// void Foo() {
/// ShowError("Failed: {0}"); // Warning: Non-existing argument in format string
/// }
/// </code></example>
@@ -76,22 +105,24 @@ namespace Filtration.ObjectModel.Annotations
/// <param name="formatParameterName">
/// Specifies which parameter of an annotated method should be treated as format-string
/// </param>
public StringFormatMethodAttribute(string formatParameterName)
public StringFormatMethodAttribute([NotNull] string formatParameterName)
{
FormatParameterName = formatParameterName;
}
public string FormatParameterName { get; private set; }
[NotNull] public string FormatParameterName { get; private set; }
}
/// <summary>
/// For a parameter that is expected to be one of the limited set of values.
/// Specify fields of which type should be used as values for this parameter.
/// </summary>
[AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Property | AttributeTargets.Field)]
[AttributeUsage(
AttributeTargets.Parameter | AttributeTargets.Property | AttributeTargets.Field,
AllowMultiple = true)]
public sealed class ValueProviderAttribute : Attribute
{
public ValueProviderAttribute(string name)
public ValueProviderAttribute([NotNull] string name)
{
Name = name;
}
@@ -105,7 +136,7 @@ namespace Filtration.ObjectModel.Annotations
/// the parameter of <see cref="System.ArgumentNullException"/>.
/// </summary>
/// <example><code>
/// public void Foo(string param) {
/// void Foo(string param) {
/// if (param == null)
/// throw new ArgumentNullException("par"); // Warning: Cannot resolve symbol
/// }
@@ -131,10 +162,12 @@ namespace Filtration.ObjectModel.Annotations
/// <example><code>
/// public class Foo : INotifyPropertyChanged {
/// public event PropertyChangedEventHandler PropertyChanged;
///
/// [NotifyPropertyChangedInvocator]
/// protected virtual void NotifyChanged(string propertyName) { ... }
///
/// private string _name;
/// string _name;
///
/// public string Name {
/// get { return _name; }
/// set { _name = value; NotifyChanged("LastName"); /* Warning */ }
@@ -153,12 +186,12 @@ namespace Filtration.ObjectModel.Annotations
public sealed class NotifyPropertyChangedInvocatorAttribute : Attribute
{
public NotifyPropertyChangedInvocatorAttribute() { }
public NotifyPropertyChangedInvocatorAttribute(string parameterName)
public NotifyPropertyChangedInvocatorAttribute([NotNull] string parameterName)
{
ParameterName = parameterName;
}
public string ParameterName { get; private set; }
[CanBeNull] public string ParameterName { get; private set; }
}
/// <summary>
@@ -174,15 +207,16 @@ namespace Filtration.ObjectModel.Annotations
/// <item>Value ::= true | false | null | notnull | canbenull</item>
/// </list>
/// If method has single input parameter, it's name could be omitted.<br/>
/// Using <c>halt</c> (or <c>void</c>/<c>nothing</c>, which is the same)
/// for method output means that the methos doesn't return normally.<br/>
/// <c>canbenull</c> annotation is only applicable for output parameters.<br/>
/// You can use multiple <c>[ContractAnnotation]</c> for each FDT row,
/// or use single attribute with rows separated by semicolon.<br/>
/// Using <c>halt</c> (or <c>void</c>/<c>nothing</c>, which is the same) for method output
/// means that the methos doesn't return normally (throws or terminates the process).<br/>
/// Value <c>canbenull</c> is only applicable for output parameters.<br/>
/// You can use multiple <c>[ContractAnnotation]</c> for each FDT row, or use single attribute
/// with rows separated by semicolon. There is no notion of order rows, all rows are checked
/// for applicability and applied per each program state tracked by R# analysis.<br/>
/// </syntax>
/// <examples><list>
/// <item><code>
/// [ContractAnnotation("=> halt")]
/// [ContractAnnotation("=&gt; halt")]
/// public void TerminationMethod()
/// </code></item>
/// <item><code>
@@ -190,17 +224,17 @@ namespace Filtration.ObjectModel.Annotations
/// public void Assert(bool condition, string text) // regular assertion method
/// </code></item>
/// <item><code>
/// [ContractAnnotation("s:null => true")]
/// [ContractAnnotation("s:null =&gt; true")]
/// public bool IsNullOrEmpty(string s) // string.IsNullOrEmpty()
/// </code></item>
/// <item><code>
/// // A method that returns null if the parameter is null,
/// // and not null if the parameter is not null
/// [ContractAnnotation("null => null; notnull => notnull")]
/// [ContractAnnotation("null =&gt; null; notnull =&gt; notnull")]
/// public object Transform(object data)
/// </code></item>
/// <item><code>
/// [ContractAnnotation("s:null=>false; =>true,result:notnull; =>false, result:null")]
/// [ContractAnnotation("=&gt; true, result: notnull; =&gt; false, result: null")]
/// public bool TryParse(string s, out Person result)
/// </code></item>
/// </list></examples>
@@ -216,7 +250,8 @@ namespace Filtration.ObjectModel.Annotations
ForceFullStates = forceFullStates;
}
public string Contract { get; private set; }
[NotNull] public string Contract { get; private set; }
public bool ForceFullStates { get; private set; }
}
@@ -225,14 +260,15 @@ namespace Filtration.ObjectModel.Annotations
/// </summary>
/// <example><code>
/// [LocalizationRequiredAttribute(true)]
/// public class Foo {
/// private string str = "my string"; // Warning: Localizable string
/// class Foo {
/// string str = "my string"; // Warning: Localizable string
/// }
/// </code></example>
[AttributeUsage(AttributeTargets.All)]
public sealed class LocalizationRequiredAttribute : Attribute
{
public LocalizationRequiredAttribute() : this(true) { }
public LocalizationRequiredAttribute(bool required)
{
Required = required;
@@ -250,8 +286,9 @@ namespace Filtration.ObjectModel.Annotations
/// <example><code>
/// [CannotApplyEqualityOperator]
/// class NoEquality { }
///
/// class UsesNoEquality {
/// public void Test() {
/// void Test() {
/// var ca1 = new NoEquality();
/// var ca2 = new NoEquality();
/// if (ca1 != null) { // OK
@@ -269,9 +306,10 @@ namespace Filtration.ObjectModel.Annotations
/// </summary>
/// <example><code>
/// [BaseTypeRequired(typeof(IComponent)] // Specify requirement
/// public class ComponentAttribute : Attribute { }
/// class ComponentAttribute : Attribute { }
///
/// [Component] // ComponentAttribute requires implementing IComponent interface
/// public class MyComponent : IComponent { }
/// class MyComponent : IComponent { }
/// </code></example>
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
[BaseTypeRequired(typeof(Attribute))]
@@ -308,6 +346,7 @@ namespace Filtration.ObjectModel.Annotations
}
public ImplicitUseKindFlags UseKindFlags { get; private set; }
public ImplicitUseTargetFlags TargetFlags { get; private set; }
}
@@ -334,6 +373,7 @@ namespace Filtration.ObjectModel.Annotations
}
[UsedImplicitly] public ImplicitUseKindFlags UseKindFlags { get; private set; }
[UsedImplicitly] public ImplicitUseTargetFlags TargetFlags { get; private set; }
}
@@ -377,12 +417,13 @@ namespace Filtration.ObjectModel.Annotations
public sealed class PublicAPIAttribute : Attribute
{
public PublicAPIAttribute() { }
public PublicAPIAttribute([NotNull] string comment)
{
Comment = comment;
}
public string Comment { get; private set; }
[CanBeNull] public string Comment { get; private set; }
}
/// <summary>
@@ -398,15 +439,51 @@ namespace Filtration.ObjectModel.Annotations
/// The same as <c>System.Diagnostics.Contracts.PureAttribute</c>.
/// </summary>
/// <example><code>
/// [Pure] private int Multiply(int x, int y) { return x * y; }
/// public void Foo() {
/// const int a = 2, b = 2;
/// Multiply(a, b); // Waring: Return value of pure method is not used
/// [Pure] int Multiply(int x, int y) => x * y;
///
/// void M() {
/// Multiply(123, 42); // Waring: Return value of pure method is not used
/// }
/// </code></example>
[AttributeUsage(AttributeTargets.Method)]
public sealed class PureAttribute : Attribute { }
/// <summary>
/// Indicates that the return value of method invocation must be used.
/// </summary>
[AttributeUsage(AttributeTargets.Method)]
public sealed class MustUseReturnValueAttribute : Attribute
{
public MustUseReturnValueAttribute() { }
public MustUseReturnValueAttribute([NotNull] string justification)
{
Justification = justification;
}
[CanBeNull] public string Justification { get; private set; }
}
/// <summary>
/// Indicates the type member or parameter of some type, that should be used instead of all other ways
/// to get the value that type. This annotation is useful when you have some "context" value evaluated
/// and stored somewhere, meaning that all other ways to get this value must be consolidated with existing one.
/// </summary>
/// <example><code>
/// class Foo {
/// [ProvidesContext] IBarService _barService = ...;
///
/// void ProcessNode(INode node) {
/// DoSomething(node, node.GetGlobalServices().Bar);
/// // ^ Warning: use value of '_barService' field
/// }
/// }
/// </code></example>
[AttributeUsage(
AttributeTargets.Field | AttributeTargets.Property | AttributeTargets.Parameter | AttributeTargets.Method |
AttributeTargets.Class | AttributeTargets.Interface | AttributeTargets.Struct | AttributeTargets.GenericParameter)]
public sealed class ProvidesContextAttribute : Attribute { }
/// <summary>
/// Indicates that a parameter is a path to a file or a folder within a web project.
/// Path can be relative or absolute, starting from web root (~).
@@ -415,12 +492,13 @@ namespace Filtration.ObjectModel.Annotations
public sealed class PathReferenceAttribute : Attribute
{
public PathReferenceAttribute() { }
public PathReferenceAttribute([PathReference] string basePath)
public PathReferenceAttribute([NotNull, PathReference] string basePath)
{
BasePath = basePath;
}
public string BasePath { get; private set; }
[CanBeNull] public string BasePath { get; private set; }
}
/// <summary>
@@ -484,7 +562,7 @@ namespace Filtration.ObjectModel.Annotations
/// Allows specifying a macro that will be executed for a <see cref="SourceTemplateAttribute">source template</see>
/// parameter when the template is expanded.
/// </summary>
public string Expression { get; set; }
[CanBeNull] public string Expression { get; set; }
/// <summary>
/// Allows specifying which occurrence of the target parameter becomes editable when the template is deployed.
@@ -500,73 +578,73 @@ namespace Filtration.ObjectModel.Annotations
/// Identifies the target parameter of a <see cref="SourceTemplateAttribute">source template</see> if the
/// <see cref="MacroAttribute"/> is applied on a template method.
/// </summary>
public string Target { get; set; }
[CanBeNull] public string Target { get; set; }
}
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = true)]
public sealed class AspMvcAreaMasterLocationFormatAttribute : Attribute
{
public AspMvcAreaMasterLocationFormatAttribute(string format)
public AspMvcAreaMasterLocationFormatAttribute([NotNull] string format)
{
Format = format;
}
public string Format { get; private set; }
[NotNull] public string Format { get; private set; }
}
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = true)]
public sealed class AspMvcAreaPartialViewLocationFormatAttribute : Attribute
{
public AspMvcAreaPartialViewLocationFormatAttribute(string format)
public AspMvcAreaPartialViewLocationFormatAttribute([NotNull] string format)
{
Format = format;
}
public string Format { get; private set; }
[NotNull] public string Format { get; private set; }
}
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = true)]
public sealed class AspMvcAreaViewLocationFormatAttribute : Attribute
{
public AspMvcAreaViewLocationFormatAttribute(string format)
public AspMvcAreaViewLocationFormatAttribute([NotNull] string format)
{
Format = format;
}
public string Format { get; private set; }
[NotNull] public string Format { get; private set; }
}
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = true)]
public sealed class AspMvcMasterLocationFormatAttribute : Attribute
{
public AspMvcMasterLocationFormatAttribute(string format)
public AspMvcMasterLocationFormatAttribute([NotNull] string format)
{
Format = format;
}
public string Format { get; private set; }
[NotNull] public string Format { get; private set; }
}
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = true)]
public sealed class AspMvcPartialViewLocationFormatAttribute : Attribute
{
public AspMvcPartialViewLocationFormatAttribute(string format)
public AspMvcPartialViewLocationFormatAttribute([NotNull] string format)
{
Format = format;
}
public string Format { get; private set; }
[NotNull] public string Format { get; private set; }
}
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = true)]
public sealed class AspMvcViewLocationFormatAttribute : Attribute
{
public AspMvcViewLocationFormatAttribute(string format)
public AspMvcViewLocationFormatAttribute([NotNull] string format)
{
Format = format;
}
public string Format { get; private set; }
[NotNull] public string Format { get; private set; }
}
/// <summary>
@@ -579,12 +657,13 @@ namespace Filtration.ObjectModel.Annotations
public sealed class AspMvcActionAttribute : Attribute
{
public AspMvcActionAttribute() { }
public AspMvcActionAttribute(string anonymousProperty)
public AspMvcActionAttribute([NotNull] string anonymousProperty)
{
AnonymousProperty = anonymousProperty;
}
public string AnonymousProperty { get; private set; }
[CanBeNull] public string AnonymousProperty { get; private set; }
}
/// <summary>
@@ -596,12 +675,13 @@ namespace Filtration.ObjectModel.Annotations
public sealed class AspMvcAreaAttribute : Attribute
{
public AspMvcAreaAttribute() { }
public AspMvcAreaAttribute(string anonymousProperty)
public AspMvcAreaAttribute([NotNull] string anonymousProperty)
{
AnonymousProperty = anonymousProperty;
}
public string AnonymousProperty { get; private set; }
[CanBeNull] public string AnonymousProperty { get; private set; }
}
/// <summary>
@@ -614,12 +694,13 @@ namespace Filtration.ObjectModel.Annotations
public sealed class AspMvcControllerAttribute : Attribute
{
public AspMvcControllerAttribute() { }
public AspMvcControllerAttribute(string anonymousProperty)
public AspMvcControllerAttribute([NotNull] string anonymousProperty)
{
AnonymousProperty = anonymousProperty;
}
public string AnonymousProperty { get; private set; }
[CanBeNull] public string AnonymousProperty { get; private set; }
}
/// <summary>
@@ -649,7 +730,7 @@ namespace Filtration.ObjectModel.Annotations
/// ASP.NET MVC attribute. Allows disabling inspections for MVC views within a class or a method.
/// </summary>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)]
public sealed class AspMvcSupressViewErrorAttribute : Attribute { }
public sealed class AspMvcSuppressViewErrorAttribute : Attribute { }
/// <summary>
/// ASP.NET MVC attribute. Indicates that a parameter is an MVC display template.
@@ -677,13 +758,27 @@ namespace Filtration.ObjectModel.Annotations
/// <summary>
/// ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter
/// is an MVC view. If applied to a method, the MVC view name is calculated implicitly
/// is an MVC view component. If applied to a method, the MVC view name is calculated implicitly
/// from the context. Use this attribute for custom wrappers similar to
/// <c>System.Web.Mvc.Controller.View(Object)</c>.
/// </summary>
[AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method)]
public sealed class AspMvcViewAttribute : Attribute { }
/// <summary>
/// ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter
/// is an MVC view component name.
/// </summary>
[AttributeUsage(AttributeTargets.Parameter)]
public sealed class AspMvcViewComponentAttribute : Attribute { }
/// <summary>
/// ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter
/// is an MVC view component view. If applied to a method, the MVC view component view name is default.
/// </summary>
[AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method)]
public sealed class AspMvcViewComponentViewAttribute : Attribute { }
/// <summary>
/// ASP.NET MVC attribute. When applied to a parameter of an attribute,
/// indicates that this parameter is an MVC action name.
@@ -702,12 +797,13 @@ namespace Filtration.ObjectModel.Annotations
public sealed class HtmlElementAttributesAttribute : Attribute
{
public HtmlElementAttributesAttribute() { }
public HtmlElementAttributesAttribute(string name)
public HtmlElementAttributesAttribute([NotNull] string name)
{
Name = name;
}
public string Name { get; private set; }
[CanBeNull] public string Name { get; private set; }
}
[AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property)]
@@ -730,9 +826,10 @@ namespace Filtration.ObjectModel.Annotations
public sealed class RazorSectionAttribute : Attribute { }
/// <summary>
/// Indicates how method invocation affects content of the collection.
/// Indicates how method, constructor invocation or property access
/// over collection type affects content of the collection.
/// </summary>
[AttributeUsage(AttributeTargets.Method)]
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Constructor | AttributeTargets.Property)]
public sealed class CollectionAccessAttribute : Attribute
{
public CollectionAccessAttribute(CollectionAccessType collectionAccessType)
@@ -824,6 +921,16 @@ namespace Filtration.ObjectModel.Annotations
[AttributeUsage(AttributeTargets.Parameter)]
public sealed class RegexPatternAttribute : Attribute { }
/// <summary>
/// Prevents the Member Reordering feature from tossing members of the marked class.
/// </summary>
/// <remarks>
/// The attribute must be mentioned in your member reordering patterns
/// </remarks>
[AttributeUsage(
AttributeTargets.Class | AttributeTargets.Interface | AttributeTargets.Struct | AttributeTargets.Enum)]
public sealed class NoReorderAttribute : Attribute { }
/// <summary>
/// XAML attribute. Indicates the type that has <c>ItemsSource</c> property and should be treated
/// as <c>ItemsControl</c>-derived type, to enable inner items <c>DataContext</c> type resolve.
@@ -832,7 +939,7 @@ namespace Filtration.ObjectModel.Annotations
public sealed class XamlItemsControlAttribute : Attribute { }
/// <summary>
/// XAML attibute. Indicates the property of some <c>BindingBase</c>-derived type, that
/// XAML attribute. Indicates the property of some <c>BindingBase</c>-derived type, that
/// is used to bind some item of <c>ItemsControl</c>-derived type. This annotation will
/// enable the <c>DataContext</c> type resolve for XAML bindings for such properties.
/// </summary>
@@ -846,14 +953,15 @@ namespace Filtration.ObjectModel.Annotations
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
public sealed class AspChildControlTypeAttribute : Attribute
{
public AspChildControlTypeAttribute(string tagName, Type controlType)
public AspChildControlTypeAttribute([NotNull] string tagName, [NotNull] Type controlType)
{
TagName = tagName;
ControlType = controlType;
}
public string TagName { get; private set; }
public Type ControlType { get; private set; }
[NotNull] public string TagName { get; private set; }
[NotNull] public Type ControlType { get; private set; }
}
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Method)]
@@ -873,7 +981,7 @@ namespace Filtration.ObjectModel.Annotations
Attribute = attribute;
}
public string Attribute { get; private set; }
[NotNull] public string Attribute { get; private set; }
}
[AttributeUsage(AttributeTargets.Property)]
@@ -890,25 +998,37 @@ namespace Filtration.ObjectModel.Annotations
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
public sealed class RazorImportNamespaceAttribute : Attribute
{
public RazorImportNamespaceAttribute(string name)
public RazorImportNamespaceAttribute([NotNull] string name)
{
Name = name;
}
public string Name { get; private set; }
[NotNull] public string Name { get; private set; }
}
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
public sealed class RazorInjectionAttribute : Attribute
{
public RazorInjectionAttribute(string type, string fieldName)
public RazorInjectionAttribute([NotNull] string type, [NotNull] string fieldName)
{
Type = type;
FieldName = fieldName;
}
public string Type { get; private set; }
public string FieldName { get; private set; }
[NotNull] public string Type { get; private set; }
[NotNull] public string FieldName { get; private set; }
}
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
public sealed class RazorDirectiveAttribute : Attribute
{
public RazorDirectiveAttribute([NotNull] string directive)
{
Directive = directive;
}
[NotNull] public string Directive { get; private set; }
}
[AttributeUsage(AttributeTargets.Method)]
@@ -925,13 +1045,4 @@ namespace Filtration.ObjectModel.Annotations
[AttributeUsage(AttributeTargets.Parameter)]
public sealed class RazorWriteMethodParameterAttribute : Attribute { }
/// <summary>
/// Prevents the Member Reordering feature from tossing members of the marked class.
/// </summary>
/// <remarks>
/// The attribute must be mentioned in your member reordering patterns
/// </remarks>
[AttributeUsage(AttributeTargets.All)]
public sealed class NoReorder : Attribute { }
}

View File

@@ -1,4 +1,5 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
@@ -33,3 +34,9 @@ using System.Runtime.InteropServices;
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: InternalsVisibleTo("Filtration.ItemFilterPreview.Tests")]
[assembly: InternalsVisibleTo("Filtration.ObjectModel.Tests")]
[assembly: InternalsVisibleTo("Filtration.Parser.Tests")]
[assembly: InternalsVisibleTo("Filtration.Tests")]
[assembly: InternalsVisibleTo("Filtration.ThemeEditor.Tests")]

View File

@@ -0,0 +1,21 @@
using Castle.MicroKernel.Registration;
using Castle.MicroKernel.SubSystems.Configuration;
using Castle.Windsor;
using Filtration.ObjectModel.Commands;
namespace Filtration.ObjectModel.WindsorInstallers
{
public class CommandsInstaller : IWindsorInstaller
{
public void Install(IWindsorContainer container, IConfigurationStore store)
{
container.Register(Component
.For<ICommandManager>()
.Forward<ICommandManagerInternal>()
.ImplementedBy<CommandManager>()
.LifestyleTransient());
}
}
}

View File

@@ -0,0 +1,23 @@
using Castle.Facilities.TypedFactory;
using Castle.MicroKernel.Registration;
using Castle.MicroKernel.SubSystems.Configuration;
using Castle.Windsor;
using Filtration.ObjectModel.Factories;
namespace Filtration.ObjectModel.WindsorInstallers
{
public class ModelsInstaller : IWindsorInstaller
{
public void Install(IWindsorContainer container, IConfigurationStore store)
{
container.Register(Component
.For<IItemFilterScript>()
.ImplementedBy<ItemFilterScript>()
.LifestyleTransient());
container.Register(Component
.For<IItemFilterScriptFactory>()
.AsFactory());
}
}
}

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Castle.Core" version="3.3.0" targetFramework="net461" />
<package id="Castle.Windsor" version="3.4.0" targetFramework="net461" />
</packages>

View File

@@ -1,14 +1,16 @@
using System.Collections.ObjectModel;
using Filtration.ObjectModel;
using Filtration.ObjectModel.ThemeEditor;
namespace Filtration.Parser.Interface.Services
{
public interface IItemFilterBlockTranslator
{
IItemFilterBlock TranslateStringToItemFilterBlock(string inputString,
ThemeComponentCollection masterComponentCollection);
IItemFilterBlock TranslateStringToItemFilterBlock(string inputString, IItemFilterScript parentItemFilterScript, bool initialiseBlockGroupHierarchyBuilder = false);
IItemFilterCommentBlock TranslateStringToItemFilterCommentBlock(string inputString, IItemFilterScript parentItemFilterScript);
string TranslateItemFilterBlockToString(IItemFilterBlock block);
void ReplaceAudioVisualBlockItemsFromString(ObservableCollection<IItemFilterBlockItem> blockItems, string inputString);
string TranslateItemFilterCommentBlockToString(IItemFilterCommentBlock itemFilterCommentBlock);
string TranslateItemFilterBlockBaseToString(IItemFilterBlockBase itemFilterBlockBase);
}
}

View File

@@ -4,7 +4,7 @@ namespace Filtration.Parser.Interface.Services
{
public interface IItemFilterScriptTranslator
{
ItemFilterScript TranslateStringToItemFilterScript(string inputString);
string TranslateItemFilterScriptToString(ItemFilterScript script);
IItemFilterScript TranslateStringToItemFilterScript(string inputString);
string TranslateItemFilterScriptToString(IItemFilterScript script);
}
}

View File

@@ -40,21 +40,17 @@
<HintPath>..\packages\Castle.Core.3.3.3\lib\net45\Castle.Core.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="FluentAssertions, Version=4.13.1.0, Culture=neutral, PublicKeyToken=33f2691a05b67b6a, processorArchitecture=MSIL">
<HintPath>..\packages\FluentAssertions.4.13.1\lib\net45\FluentAssertions.dll</HintPath>
<Private>True</Private>
<Reference Include="FluentAssertions, Version=4.19.2.0, Culture=neutral, PublicKeyToken=33f2691a05b67b6a, processorArchitecture=MSIL">
<HintPath>..\packages\FluentAssertions.4.19.2\lib\net45\FluentAssertions.dll</HintPath>
</Reference>
<Reference Include="FluentAssertions.Core, Version=4.13.1.0, Culture=neutral, PublicKeyToken=33f2691a05b67b6a, processorArchitecture=MSIL">
<HintPath>..\packages\FluentAssertions.4.13.1\lib\net45\FluentAssertions.Core.dll</HintPath>
<Private>True</Private>
<Reference Include="FluentAssertions.Core, Version=4.19.2.0, Culture=neutral, PublicKeyToken=33f2691a05b67b6a, processorArchitecture=MSIL">
<HintPath>..\packages\FluentAssertions.4.19.2\lib\net45\FluentAssertions.Core.dll</HintPath>
</Reference>
<Reference Include="Moq, Version=4.5.21.0, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
<HintPath>..\packages\Moq.4.5.21\lib\net45\Moq.dll</HintPath>
<Private>True</Private>
<Reference Include="Moq, Version=4.5.30.0, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
<HintPath>..\packages\Moq.4.5.30\lib\net45\Moq.dll</HintPath>
</Reference>
<Reference Include="nunit.framework, Version=3.4.1.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
<HintPath>..\packages\NUnit.3.4.1\lib\net45\nunit.framework.dll</HintPath>
<Private>True</Private>
<Reference Include="nunit.framework, Version=3.6.1.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
<HintPath>..\packages\NUnit.3.6.1\lib\net45\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="PresentationCore" />
<Reference Include="System" />
@@ -113,6 +109,9 @@
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Resources\testscript2.txt" />
</ItemGroup>
<Choose>
<When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'">
<ItemGroup>

View File

@@ -91,6 +91,37 @@ namespace Filtration.Parser.Tests.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to #Script description
///#Script description
///#Script description
///#Script description
///
///#Comment
///#SomeComment
///
///#Blockdescription
///Show #Flasks - Endgame - Life/Mana - Divine/Eternal - Q10+ - Normal
/// Class &quot;Life Flasks&quot; &quot;Mana Flasks&quot;
/// Rarity Normal
/// DropLevel &gt;= 60
/// Quality &gt;= 10
/// SetFontSize 28
/// SetTextColor 240 240 240 #Normal Item Highlight
///
///#commentymccommentface
///
///Show #Flasks - Endgame - Life/Mana - Divine/Eternal - Q10+ - Normal
/// Class &quot;Life Flasks&quot; &quot;Mana Flasks&quot;
/// Rarity Normal
/// DropL [rest of string was truncated]&quot;;.
/// </summary>
public static string testscript2 {
get {
return ResourceManager.GetString("testscript2", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to ###BETA VERSION 1.0.0.1-8
///#Please test and let me know via pm on reddit /u/brute_force or @Thiole in game if i am online

View File

@@ -118,10 +118,13 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="ThioleItemFilter" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\ThioleItemFilter.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
</data>
<data name="testscript" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\testscript.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
</data>
<data name="testscript2" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\testscript2.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
</data>
<data name="ThioleItemFilter" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\ThioleItemFilter.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
</data>
</root>

View File

@@ -0,0 +1,31 @@
#Script description
#Script description
#Script description
#Script description
#Blockdescription
Show #Flasks - Endgame - Life/Mana - Divine/Eternal - Q10+ - Normal
Class "Life Flasks" "Mana Flasks"
Rarity Normal
SetFontSize 28
# commentymccommentface
Show
Class "Life Flasks" "Mana Flasks"
Rarity Normal
DropLevel >= 60
#commment
#morecomment
#blah
#anothercomment
#notpartofblockdescription
#blockdescription2
Show #TestBlock
Class "Life Flasks" "Mana Flasks"
Rarity Normal

View File

@@ -26,6 +26,54 @@ namespace Filtration.Parser.Tests.Services
_testUtility = new ItemFilterBlockTranslatorTestUtility();
}
[Test]
public void TranslateStringToItemFilterBlockComment_ReturnsItemFilterBlockCommentWithSpacesNotRemoved()
{
//Arrange
var testInputString = "# This is a comment\r\n# Line 2 \r\n # Test";
//Act
var result = _testUtility.Translator.TranslateStringToItemFilterCommentBlock(testInputString, Mock.Of<IItemFilterScript>());
//Assert
Assert.AreEqual(" This is a comment\r\n Line 2 \r\n Test", result.Comment);
}
[Test]
public void TranslateStringToItemFilterBlock_BlockGroupsEnabled_ActionBlockItemCommentIsNull()
{
// Arrange
var inputString = "Show # Test - Test2 - Test3" + Environment.NewLine;
var inputBlockGroup = new ItemFilterBlockGroup("TestBlockGroup", null);
_testUtility.MockBlockGroupHierarchyBuilder
.Setup(b => b.IntegrateStringListIntoBlockGroupHierarchy(It.IsAny<IEnumerable<string>>()))
.Returns(inputBlockGroup);
// Act
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, Mock.Of<IItemFilterScript>(i => i.ItemFilterScriptSettings.BlockGroupsEnabled));
//Assert
Assert.IsTrue(string.IsNullOrEmpty(result.ActionBlockItem.Comment));
}
[Test]
public void TranslateStringToItemFilterBlock_BlockGroupsDisabled_ActionBlockItemCommentIsSetCorrectly()
{
// Arrange
var testInputExpectedComment = " this is a comment that should be preserved";
var inputString = $"Show #{testInputExpectedComment}" + Environment.NewLine;
// Act
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, Mock.Of<IItemFilterScript>(i => i.ItemFilterScriptSettings.BlockGroupsEnabled == false));
//Assert
Assert.AreEqual(testInputExpectedComment, result.ActionBlockItem.Comment);
}
[Test]
public void TranslateStringToItemFilterBlock_NotDisabled_SetsBlockEnabledTrue()
{
@@ -34,7 +82,7 @@ namespace Filtration.Parser.Tests.Services
" ItemLevel >= 55";
// Act
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, null);
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, _testUtility.MockItemFilterScript);
// Assert
Assert.AreEqual(true, result.Enabled);
@@ -48,7 +96,7 @@ namespace Filtration.Parser.Tests.Services
" ItemLevel >= 55";
// Act
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, null);
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, _testUtility.MockItemFilterScript);
// Assert
Assert.AreEqual(2, result.BlockItems.Count);
@@ -64,7 +112,7 @@ namespace Filtration.Parser.Tests.Services
" ItemLevel >= 55";
// Act
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, null);
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, _testUtility.MockItemFilterScript);
// Assert
Assert.AreEqual(1, result.BlockItems.Count(b => b is ItemLevelBlockItem));
@@ -74,7 +122,7 @@ namespace Filtration.Parser.Tests.Services
}
[Test]
public void TranslateStringToItemFilterBlock_BlockGroupComment_CallsBlockGroupHierarchyBuilder()
public void TranslateStringToItemFilterBlock_BlockGroupsEnabled_ShowBlock_SetsBlockGroupIsCheckedCorrectly()
{
// Arrange
var inputString = "Show # TestBlockGroup" + Environment.NewLine;
@@ -82,29 +130,14 @@ namespace Filtration.Parser.Tests.Services
// Act
_testUtility.MockBlockGroupHierarchyBuilder.Setup(b => b.IntegrateStringListIntoBlockGroupHierarchy(It.IsAny<IEnumerable<string>>())).Returns(inputBlockGroup).Verifiable();
_testUtility.Translator.TranslateStringToItemFilterBlock(inputString, null);
// Assert
_testUtility.MockBlockGroupHierarchyBuilder.Verify();
}
[Test]
public void TranslateStringToItemFilterBlock_ShowBlock_SetsBlockGroupIsCheckedCorrectly()
{
// Arrange
var inputString = "Show # TestBlockGroup" + Environment.NewLine;
var inputBlockGroup = new ItemFilterBlockGroup("TestBlockGroup", null);
// Act
_testUtility.MockBlockGroupHierarchyBuilder.Setup(b => b.IntegrateStringListIntoBlockGroupHierarchy(It.IsAny<IEnumerable<string>>())).Returns(inputBlockGroup).Verifiable();
_testUtility.Translator.TranslateStringToItemFilterBlock(inputString, null);
_testUtility.Translator.TranslateStringToItemFilterBlock(inputString, Mock.Of<IItemFilterScript>(i => i.ItemFilterScriptSettings.BlockGroupsEnabled));
// Assert
Assert.AreEqual(true, inputBlockGroup.IsChecked);
}
[Test]
public void TranslateStringToItemFilterBlock_HideBlock_SetsBlockGroupIsCheckedCorrectly()
public void TranslateStringToItemFilterBlock_BlockGroupsEnabled_HideBlock_SetsBlockGroupIsCheckedCorrectly()
{
// Arrange
var inputString = "Hide # TestBlockGroup" + Environment.NewLine;
@@ -112,56 +145,108 @@ namespace Filtration.Parser.Tests.Services
// Act
_testUtility.MockBlockGroupHierarchyBuilder.Setup(b => b.IntegrateStringListIntoBlockGroupHierarchy(It.IsAny<IEnumerable<string>>())).Returns(inputBlockGroup).Verifiable();
_testUtility.Translator.TranslateStringToItemFilterBlock(inputString, null);
_testUtility.Translator.TranslateStringToItemFilterBlock(inputString, Mock.Of<IItemFilterScript>(i => i.ItemFilterScriptSettings.BlockGroupsEnabled));
// Assert
Assert.AreEqual(false, inputBlockGroup.IsChecked);
}
[Test]
public void TranslateStringToItemFilterBlock_NoBlockGroupComment_CallsBlockGroupHierarchyBuilder()
public void TranslateStringToItemFilterBlock_BlockGroupsEnabled_BlockGroupComment_CallsBlockGroupHierarchyBuilder()
{
// Arrange
var inputString = "Show # TestBlockGroup" + Environment.NewLine;
var inputBlockGroup = new ItemFilterBlockGroup("TestBlockGroup", null);
// Act
_testUtility.MockBlockGroupHierarchyBuilder.Setup(b => b.IntegrateStringListIntoBlockGroupHierarchy(It.IsAny<IEnumerable<string>>())).Returns(inputBlockGroup).Verifiable();
_testUtility.Translator.TranslateStringToItemFilterBlock(inputString, Mock.Of<IItemFilterScript>(i => i.ItemFilterScriptSettings.BlockGroupsEnabled));
// Assert
_testUtility.MockBlockGroupHierarchyBuilder.Verify();
}
[Test]
public void TranslateStringToItemFilterBlock_BlockGroupsEnabled_NoBlockGroupComment_DoesNotCallBlockGroupHierarchyBuilder()
{
// Arrange
var inputString = "Show" + Environment.NewLine;
// Act
_testUtility.MockBlockGroupHierarchyBuilder.Setup(b => b.IntegrateStringListIntoBlockGroupHierarchy(It.IsAny<IEnumerable<string>>())).Verifiable();
_testUtility.Translator.TranslateStringToItemFilterBlock(inputString, null);
_testUtility.Translator.TranslateStringToItemFilterBlock(inputString, Mock.Of<IItemFilterScript>(i => i.ItemFilterScriptSettings.BlockGroupsEnabled));
// Assert
_testUtility.MockBlockGroupHierarchyBuilder.Verify(b => b.IntegrateStringListIntoBlockGroupHierarchy(It.IsAny<IEnumerable<string>>()), Times.Never);
}
[Test]
public void TranslateStringToItemFilterBlock_BlockGroupCommentWithNoGroups_DoesNotThrow()
public void TranslateStringToItemFilterBlock_BlockGroupsEnabled_BlockGroupCommentWithNoGroups_DoesNotThrow()
{
// Arrange
var inputString = "Show #" + Environment.NewLine;
// Act
_testUtility.MockBlockGroupHierarchyBuilder.Setup(b => b.IntegrateStringListIntoBlockGroupHierarchy(It.IsAny<IEnumerable<string>>())).Verifiable();
_testUtility.Translator.TranslateStringToItemFilterBlock(inputString, null);
_testUtility.Translator.TranslateStringToItemFilterBlock(inputString, Mock.Of<IItemFilterScript>(i => i.ItemFilterScriptSettings.BlockGroupsEnabled));
// Assert
_testUtility.MockBlockGroupHierarchyBuilder.Verify(b => b.IntegrateStringListIntoBlockGroupHierarchy(It.IsAny<IEnumerable<string>>()), Times.Never);
}
[Test]
public void TranslateStringToItemFilterBlock_BlockGroupComment_SetsBlockItemGroupCorrectly()
public void TranslateStringToItemFilterBlock_BlockGroupsEnabled_BlockGroupComment_SetsBlockItemGroupCorrectly()
{
// Arrange
var inputString = "Show # Test Block Group - Test Sub Block Group - Test Another Block Group" + Environment.NewLine;
var testBlockGroup = new ItemFilterBlockGroup("zzzzz", null);
// Act
_testUtility.MockBlockGroupHierarchyBuilder.Setup(b => b.IntegrateStringListIntoBlockGroupHierarchy(It.IsAny<IEnumerable<string>>())).Returns(testBlockGroup).Verifiable();
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, null);
_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"))))
.Returns(testBlockGroup)
.Verifiable();
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, Mock.Of<IItemFilterScript>(i => i.ItemFilterScriptSettings.BlockGroupsEnabled));
// Assert
Assert.AreEqual(testBlockGroup, result.BlockGroup);
_testUtility.MockBlockGroupHierarchyBuilder.Verify();
}
[Test]
public void TranslateStringToItemFilterBlock_BlockGroupsEnabled_BlockGroupComment_NoSpacingAroundHyphens_SetsBlockItemGroupCorrectly()
{
// Arrange
var inputString = "Show # AAA-BBB-CCC" + Environment.NewLine;
var testBlockGroup = new ItemFilterBlockGroup("zzzzz", null);
// Act
_testUtility.MockBlockGroupHierarchyBuilder
.Setup(b => b.IntegrateStringListIntoBlockGroupHierarchy(It.Is<IEnumerable<string>>(s => s.Contains("AAA-BBB-CCC"))))
.Returns(testBlockGroup)
.Verifiable();
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, Mock.Of<IItemFilterScript>(i => i.ItemFilterScriptSettings.BlockGroupsEnabled));
// Assert
Assert.AreEqual(testBlockGroup, result.BlockGroup);
_testUtility.MockBlockGroupHierarchyBuilder.Verify();
}
[Test]
public void TranslateStringToItemFilterBlock_BlockGroupsDisabled_BlockGroupComment_DoesNotCallBlockGroupHierarchyBuilder()
{
// Arrange
var inputString = "Show # AAA - BBB - CCC" + Environment.NewLine;
// Act
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, Mock.Of<IItemFilterScript>(i => i.ItemFilterScriptSettings.BlockGroupsEnabled == false));
// Assert
Assert.IsNull(result.BlockGroup);
_testUtility.MockBlockGroupHierarchyBuilder.Verify(b => b.IntegrateStringListIntoBlockGroupHierarchy(It.IsAny<IEnumerable<string>>()), Times.Never);
}
[Test]
public void TranslateStringToItemFilterBlock_Hide_ReturnsCorrectObject()
{
@@ -169,7 +254,7 @@ namespace Filtration.Parser.Tests.Services
var inputString = "Hide" + Environment.NewLine;
// Act
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, null);
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, _testUtility.MockItemFilterScript);
// Assert
Assert.AreEqual(1, result.BlockItems.Count(b => b is ActionBlockItem));
@@ -185,7 +270,7 @@ namespace Filtration.Parser.Tests.Services
" ItemLevel >= 55";
// Act
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, null);
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, _testUtility.MockItemFilterScript);
// Assert
Assert.AreEqual("This is a test Block", result.Description);
@@ -205,7 +290,7 @@ namespace Filtration.Parser.Tests.Services
" ItemLevel >= 55";
// Act
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, null);
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, _testUtility.MockItemFilterScript);
// Assert
Assert.AreEqual("Second Line", result.Description);
@@ -223,7 +308,7 @@ namespace Filtration.Parser.Tests.Services
" DropLevel = 40";
// Act
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, null);
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, _testUtility.MockItemFilterScript);
// Assert
@@ -241,7 +326,7 @@ namespace Filtration.Parser.Tests.Services
" Corrupted True";
// Act
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, null);
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, _testUtility.MockItemFilterScript);
// Assert
@@ -250,6 +335,57 @@ namespace Filtration.Parser.Tests.Services
Assert.IsTrue(blockItem.BooleanValue);
}
[Test]
public void TranslateStringToItemFilterBlock_ElderItem_ReturnsCorrectObject()
{
// Arrange
var inputString = "Show" + Environment.NewLine +
" ElderItem False";
// Act
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, _testUtility.MockItemFilterScript);
// Assert
Assert.AreEqual(1, result.BlockItems.Count(b => b is ElderItemBlockItem));
var blockItem = result.BlockItems.OfType<ElderItemBlockItem>().First();
Assert.IsFalse(blockItem.BooleanValue);
}
[Test]
public void TranslateStringToItemFilterBlock_ShaperItem_ReturnsCorrectObject()
{
// Arrange
var inputString = "Show" + Environment.NewLine +
" ShaperItem True";
// Act
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, _testUtility.MockItemFilterScript);
// Assert
Assert.AreEqual(1, result.BlockItems.Count(b => b is ShaperItemBlockItem));
var blockItem = result.BlockItems.OfType<ShaperItemBlockItem>().First();
Assert.IsTrue(blockItem.BooleanValue);
}
[Test]
public void TranslateStringToItemFilterBlock_ShapedMap_ReturnsCorrectObject()
{
// Arrange
var inputString = "Show" + Environment.NewLine +
" ShapedMap false";
// Act
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, _testUtility.MockItemFilterScript);
// Assert
Assert.AreEqual(1, result.BlockItems.Count(b => b is ShapedMapBlockItem));
var blockItem = result.BlockItems.OfType<ShapedMapBlockItem>().First();
Assert.IsFalse(blockItem.BooleanValue);
}
[Test]
public void TranslateStringToItemFilterBlock_Identified_ReturnsCorrectObject()
{
@@ -258,7 +394,7 @@ namespace Filtration.Parser.Tests.Services
" Identified True";
// Act
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, null);
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, _testUtility.MockItemFilterScript);
// Assert
@@ -275,7 +411,7 @@ namespace Filtration.Parser.Tests.Services
" Quality < 18";
// Act
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, null);
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, _testUtility.MockItemFilterScript);
// Assert
@@ -293,7 +429,7 @@ namespace Filtration.Parser.Tests.Services
" Rarity > Normal";
// Act
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, null);
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, _testUtility.MockItemFilterScript);
// Assert
@@ -311,7 +447,7 @@ namespace Filtration.Parser.Tests.Services
" Rarity Normal";
// Act
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, null);
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, _testUtility.MockItemFilterScript);
// Assert
Assert.AreEqual(1, result.BlockItems.Count(b => b is RarityBlockItem));
@@ -328,7 +464,7 @@ namespace Filtration.Parser.Tests.Services
@" Class ""Test Class 1"" ""TestOneWordClassInQuotes"" TestOneWordClassNotInQuotes ""Test Class 2""";
// Act
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, null);
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, _testUtility.MockItemFilterScript);
// Assert
Assert.AreEqual(1, result.BlockItems.Count(b => b is ClassBlockItem));
@@ -347,7 +483,7 @@ namespace Filtration.Parser.Tests.Services
@" BaseType ""Test Base Type 1"" ""TestOneWordBaseTypeInQuotes"" TestOneWordBaseTypeNotInQuotes ""Test BaseType 2""";
// Act
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, null);
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, _testUtility.MockItemFilterScript);
// Assert
Assert.AreEqual(1, result.BlockItems.Count(b => b is BaseTypeBlockItem));
@@ -366,7 +502,7 @@ namespace Filtration.Parser.Tests.Services
" Sockets > 2";
// Act
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, null);
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, _testUtility.MockItemFilterScript);
// Assert
@@ -384,7 +520,7 @@ namespace Filtration.Parser.Tests.Services
" LinkedSockets > 1";
// Act
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, null);
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, _testUtility.MockItemFilterScript);
// Assert
@@ -402,7 +538,7 @@ namespace Filtration.Parser.Tests.Services
" Width = 1";
// Act
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, null);
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, _testUtility.MockItemFilterScript);
// Assert
@@ -420,7 +556,7 @@ namespace Filtration.Parser.Tests.Services
" Height <= 3";
// Act
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, null);
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, _testUtility.MockItemFilterScript);
// Assert
@@ -438,7 +574,7 @@ namespace Filtration.Parser.Tests.Services
" Height <=3";
// Act
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, null);
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, _testUtility.MockItemFilterScript);
// Assert
Assert.AreEqual(1, result.BlockItems.Count(b => b is HeightBlockItem));
@@ -455,7 +591,7 @@ namespace Filtration.Parser.Tests.Services
" SocketGroup RRGB";
// Act
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, null);
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, _testUtility.MockItemFilterScript);
// Assert
Assert.AreEqual(1, result.BlockItems.Count(b => b is SocketGroupBlockItem));
@@ -473,7 +609,7 @@ namespace Filtration.Parser.Tests.Services
" SetTextColor 255 20 100";
// Act
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, null);
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, _testUtility.MockItemFilterScript);
// Assert
Assert.AreEqual(1, result.BlockItems.Count(b => b is TextColorBlockItem));
@@ -491,7 +627,7 @@ namespace Filtration.Parser.Tests.Services
" SetTextColor 65 0 255 12";
// Act
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, null);
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, _testUtility.MockItemFilterScript);
// Assert
Assert.AreEqual(1, result.BlockItems.Count(b => b is TextColorBlockItem));
@@ -510,7 +646,7 @@ namespace Filtration.Parser.Tests.Services
" SetBackgroundColor 255 20 100";
// Act
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, null);
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, _testUtility.MockItemFilterScript);
// Assert
Assert.AreEqual(1, result.BlockItems.Count(b => b is BackgroundColorBlockItem));
@@ -529,7 +665,7 @@ namespace Filtration.Parser.Tests.Services
" SetBorderColor 255 20 100";
// Act
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, null);
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, _testUtility.MockItemFilterScript);
// Assert
Assert.AreEqual(1, result.BlockItems.Count(b => b is BorderColorBlockItem));
@@ -548,8 +684,8 @@ namespace Filtration.Parser.Tests.Services
// Act
Assert.DoesNotThrow(() => _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, null));
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, null);
Assert.DoesNotThrow(() => _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, _testUtility.MockItemFilterScript));
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, _testUtility.MockItemFilterScript);
// Assert
Assert.AreEqual(1, result.BlockItems.Count(b => b is BorderColorBlockItem));
@@ -569,7 +705,7 @@ namespace Filtration.Parser.Tests.Services
var testInputThemeComponentCollection = new ThemeComponentCollection { testComponent };
// Act
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, testInputThemeComponentCollection);
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, Mock.Of<IItemFilterScript>(i => i.ItemFilterScriptSettings.ThemeComponentCollection == testInputThemeComponentCollection));
// Assert
var blockItem = result.BlockItems.OfType<TextColorBlockItem>().First();
@@ -587,7 +723,7 @@ namespace Filtration.Parser.Tests.Services
" SetFontSize 15";
// Act
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, null);
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, _testUtility.MockItemFilterScript);
// Assert
Assert.AreEqual(1, result.BlockItems.Count(b => b is FontSizeBlockItem));
@@ -604,12 +740,12 @@ namespace Filtration.Parser.Tests.Services
" PlayAlertSound 4";
// Act
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, null);
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, _testUtility.MockItemFilterScript);
// Assert
Assert.AreEqual(1, result.BlockItems.Count(b => b is SoundBlockItem));
var blockItem = result.BlockItems.OfType<SoundBlockItem>().First();
Assert.AreEqual(4, blockItem.Value);
Assert.AreEqual("4", blockItem.Value);
Assert.AreEqual(79, blockItem.SecondValue);
}
@@ -622,28 +758,49 @@ namespace Filtration.Parser.Tests.Services
" PlayAlertSound 2 95";
// Act
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, null);
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, _testUtility.MockItemFilterScript);
// Assert
Assert.AreEqual(1, result.BlockItems.Count(b => b is SoundBlockItem));
var blockItem = result.BlockItems.OfType<SoundBlockItem>().First();
Assert.AreEqual(2, blockItem.Value);
Assert.AreEqual("2", blockItem.Value);
Assert.AreEqual(95, blockItem.SecondValue);
}
[Test]
public void TranslateStringToItemFilterBlock_SectionComment_ReturnsItemFilterSectionObjectWithCorrectDescription()
public void TranslateStringToItemFilterBlock_PlayAlertSoundPositionalWithoutVolume_ReturnsCorrectObject()
{
// Arrange
const string testInputSectionDescription = "Wonderful items that you definitely won't want to miss!";
var inputString = "# Section: " + testInputSectionDescription;
var inputString = "Show" + Environment.NewLine +
" PlayAlertSoundPositional 12";
// Act
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, null);
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, _testUtility.MockItemFilterScript);
// Assert
Assert.IsInstanceOf<ItemFilterSection>(result);
Assert.AreEqual(testInputSectionDescription, result.Description);
Assert.AreEqual(1, result.BlockItems.Count(b => b is PositionalSoundBlockItem));
var blockItem = result.BlockItems.OfType<PositionalSoundBlockItem>().First();
Assert.AreEqual("12", blockItem.Value);
Assert.AreEqual(79, blockItem.SecondValue);
}
[Test]
public void TranslateStringToItemFilterBlock_PlayAlertSoundPositionalWithVolume_ReturnsCorrectObject()
{
// Arrange
var inputString = "Show" + Environment.NewLine +
" PlayAlertSoundPositional 7 95";
// Act
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, _testUtility.MockItemFilterScript);
// Assert
Assert.AreEqual(1, result.BlockItems.Count(b => b is PositionalSoundBlockItem));
var blockItem = result.BlockItems.OfType<PositionalSoundBlockItem>().First();
Assert.AreEqual("7", blockItem.Value);
Assert.AreEqual(95, blockItem.SecondValue);
}
[Test]
@@ -660,6 +817,9 @@ namespace Filtration.Parser.Tests.Services
" Rarity <= Unique" + Environment.NewLine +
" Identified True" + Environment.NewLine +
" Corrupted false" + Environment.NewLine +
" ElderItem true" + Environment.NewLine +
" ShaperItem False" + Environment.NewLine +
" ShapedMap TRUE" + Environment.NewLine +
@" Class ""My Item Class"" AnotherClass ""AndAnotherClass""" + Environment.NewLine +
@" BaseType MyBaseType ""Another BaseType""" + Environment.NewLine +
" JunkLine Let's ignore this one!" + Environment.NewLine +
@@ -671,10 +831,10 @@ namespace Filtration.Parser.Tests.Services
" SetBackgroundColor 255 100 5" + Environment.NewLine +
" SetBorderColor 0 0 0" + Environment.NewLine +
" SetFontSize 50" + Environment.NewLine +
" PlayAlertSound 3";
" PlayAlertSound 3" + Environment.NewLine;
// Act
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, null);
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, _testUtility.MockItemFilterScript);
// Assert
Assert.AreEqual("Test filter with everything", result.Description);
@@ -688,6 +848,15 @@ namespace Filtration.Parser.Tests.Services
var identifiedBlockItem = result.BlockItems.OfType<IdentifiedBlockItem>().First();
Assert.IsTrue(identifiedBlockItem.BooleanValue);
var elderItemBlockItem = result.BlockItems.OfType<ElderItemBlockItem>().First();
Assert.IsTrue(elderItemBlockItem.BooleanValue);
var shaperItemBlockItem = result.BlockItems.OfType<ShaperItemBlockItem>().First();
Assert.IsFalse(shaperItemBlockItem.BooleanValue);
var shapedMapBlockItem = result.BlockItems.OfType<ShapedMapBlockItem>().First();
Assert.IsTrue(shapedMapBlockItem.BooleanValue);
var dropLevelblockItem = result.BlockItems.OfType<DropLevelBlockItem>().First();
Assert.AreEqual(FilterPredicateOperator.LessThan, dropLevelblockItem.FilterPredicate.PredicateOperator);
Assert.AreEqual(70, dropLevelblockItem.FilterPredicate.PredicateOperand);
@@ -746,7 +915,7 @@ namespace Filtration.Parser.Tests.Services
Assert.AreEqual(50, fontSizeblockItem.Value);
var soundblockItem = result.BlockItems.OfType<SoundBlockItem>().First();
Assert.AreEqual(3, soundblockItem.Value);
Assert.AreEqual("3", soundblockItem.Value);
Assert.AreEqual(79, soundblockItem.SecondValue);
}
@@ -762,7 +931,7 @@ namespace Filtration.Parser.Tests.Services
" Quality < 17";
// Act
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, null);
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, _testUtility.MockItemFilterScript);
// Assert
Assert.AreEqual(2, result.BlockItems.Count(b => b is ItemLevelBlockItem));
@@ -791,7 +960,7 @@ namespace Filtration.Parser.Tests.Services
" SetTextColor 255 20 100";
// Act
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, null);
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, _testUtility.MockItemFilterScript);
// Assert
Assert.AreEqual(1, result.BlockItems.Count(b => b is TextColorBlockItem));
@@ -812,7 +981,7 @@ namespace Filtration.Parser.Tests.Services
" SetFontSize 27" + Environment.NewLine;
// Act
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, null);
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, _testUtility.MockItemFilterScript);
// Assert
Assert.AreEqual(1, result.BlockItems.Count(b => b is FontSizeBlockItem));
@@ -831,12 +1000,12 @@ namespace Filtration.Parser.Tests.Services
" PlayAlertSound 2" + Environment.NewLine;
// Act
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, null);
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, _testUtility.MockItemFilterScript);
// Assert
Assert.AreEqual(1, result.BlockItems.Count(b => b is SoundBlockItem));
var blockItem = result.BlockItems.OfType<SoundBlockItem>().First();
Assert.AreEqual(2, blockItem.Value);
Assert.AreEqual("2", blockItem.Value);
Assert.AreEqual(79, blockItem.SecondValue);
}
@@ -849,7 +1018,7 @@ namespace Filtration.Parser.Tests.Services
" SetBackgroundColor 255 20 100";
// Act
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, null);
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, _testUtility.MockItemFilterScript);
// Assert
Assert.AreEqual(1, result.BlockItems.Count(b => b is BackgroundColorBlockItem));
@@ -868,7 +1037,7 @@ namespace Filtration.Parser.Tests.Services
" SetBorderColor 255 20 100";
// Act
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, null);
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, _testUtility.MockItemFilterScript);
// Assert
Assert.AreEqual(1, result.BlockItems.Count(b => b is BorderColorBlockItem));
@@ -896,7 +1065,7 @@ namespace Filtration.Parser.Tests.Services
_testUtility.TestBlock.BlockItems.Add(new WidthBlockItem(FilterPredicateOperator.Equal, 4));
// Act
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, null);
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, _testUtility.MockItemFilterScript);
// Assert
Assert.AreEqual(1, result.BlockItems.Count(b => b is RarityBlockItem));
@@ -923,7 +1092,7 @@ namespace Filtration.Parser.Tests.Services
_testUtility.TestBlock.BlockItems.Add(new WidthBlockItem(FilterPredicateOperator.Equal, 4));
// Act
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, null);
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, _testUtility.MockItemFilterScript);
// Assert
Assert.AreEqual(1, result.BlockItems.Count(b => b is ActionBlockItem));
@@ -958,7 +1127,7 @@ namespace Filtration.Parser.Tests.Services
_testUtility.TestBlock.BlockItems.Add(new WidthBlockItem(FilterPredicateOperator.Equal, 4));
// Act
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, null);
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, _testUtility.MockItemFilterScript);
// Assert
Assert.AreEqual(1, result.BlockItems.Count(b => b is ActionBlockItem));
@@ -1006,6 +1175,22 @@ namespace Filtration.Parser.Tests.Services
Assert.AreEqual(expectedResult, result);
}
[Test]
public void TranslateItemFilterBlockToString_HasActionBlockComment_ReturnsCorrectString()
{
// Arrange
var testInputActionBlockComment = "this is a test";
var expectedResult = $"Show #{testInputActionBlockComment}";
_testUtility.TestBlock.BlockItems.OfType<ActionBlockItem>().First().Comment = testInputActionBlockComment;
// Act
var result = _testUtility.Translator.TranslateItemFilterBlockToString(_testUtility.TestBlock);
// Assert
Assert.AreEqual(expectedResult, result);
}
[Test]
public void TranslateItemFilterBlockToString_FilterTypeHide_ReturnsCorrectString()
{
@@ -1432,7 +1617,7 @@ namespace Filtration.Parser.Tests.Services
var expectedResult = "Show" + Environment.NewLine +
" PlayAlertSound 2 50";
_testUtility.TestBlock.BlockItems.Add(new SoundBlockItem(2, 50));
_testUtility.TestBlock.BlockItems.Add(new SoundBlockItem("2", 50));
// Act
var result = _testUtility.Translator.TranslateItemFilterBlockToString(_testUtility.TestBlock);
@@ -1482,22 +1667,6 @@ namespace Filtration.Parser.Tests.Services
Assert.AreEqual(expectedResult, result);
}
[Test]
public void TranslateItemFilterBlockToString_Section_ReturnsCorrectString()
{
// Arrange
const string testInputSectionText = "Ermagerd it's a section!";
var expectedResult = "# Section: " + testInputSectionText;
_testUtility.TestBlock = new ItemFilterSection { Description = testInputSectionText };
// Act
var result = _testUtility.Translator.TranslateItemFilterBlockToString(_testUtility.TestBlock);
// Assert
Assert.AreEqual(expectedResult, result);
}
[Test]
public void TranslateItemFilterBlockToString_DisabledBlock_ReturnsCorrectString()
{
@@ -1523,21 +1692,23 @@ namespace Filtration.Parser.Tests.Services
{
// Arrange
var expectedResult = "Show" + Environment.NewLine +
" LinkedSockets >= 4" + Environment.NewLine +
" Sockets <= 6" + Environment.NewLine +
" Quality > 2" + Environment.NewLine +
" Identified True" + Environment.NewLine +
" Corrupted False" + Environment.NewLine +
" ElderItem True" + Environment.NewLine +
" ShaperItem False" + Environment.NewLine +
" ShapedMap True" + Environment.NewLine +
" Height <= 6" + Environment.NewLine +
" Height >= 2" + Environment.NewLine +
" Width = 3" + Environment.NewLine +
" DropLevel > 56" + Environment.NewLine +
" Class \"Body Armour\" \"Gloves\" \"Belt\" \"Two Hand Axes\"" + Environment.NewLine +
" BaseType \"Greater Life Flask\" \"Simple Robe\" \"Full Wyrmscale\"" + Environment.NewLine +
" Rarity = Unique" + Environment.NewLine +
" ItemLevel > 70" + Environment.NewLine +
" ItemLevel <= 85" + Environment.NewLine +
" DropLevel > 56" + 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 +
" SetTextColor 255 89 0 56" + Environment.NewLine +
" SetBackgroundColor 0 0 0" + Environment.NewLine +
" SetBorderColor 255 1 254" + Environment.NewLine +
@@ -1573,7 +1744,10 @@ namespace Filtration.Parser.Tests.Services
_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 FontSizeBlockItem(50));
_testUtility.TestBlock.BlockItems.Add(new SoundBlockItem(6, 90));
_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));
// Act
var result = _testUtility.Translator.TranslateItemFilterBlockToString(_testUtility.TestBlock);
@@ -1609,7 +1783,7 @@ namespace Filtration.Parser.Tests.Services
var testInputString = "PlayAlertSound 7 280";
var testInputBlockItems = new ObservableCollection<IItemFilterBlockItem>();
var testInputBlockItem = new SoundBlockItem(12,30);
var testInputBlockItem = new SoundBlockItem("12",30);
testInputBlockItems.Add(testInputBlockItem);
// Act
@@ -1619,7 +1793,7 @@ namespace Filtration.Parser.Tests.Services
var soundBlockItem = testInputBlockItems.First(b => b is SoundBlockItem) as SoundBlockItem;
Assert.IsNotNull(soundBlockItem);
Assert.AreNotSame(testInputBlockItem, soundBlockItem);
Assert.AreEqual(7, soundBlockItem.Value);
Assert.AreEqual("7", soundBlockItem.Value);
Assert.AreEqual(280, soundBlockItem.SecondValue);
}
@@ -1676,7 +1850,7 @@ namespace Filtration.Parser.Tests.Services
var testInputTextColorBlockItem = new TextColorBlockItem(Colors.Red);
var testInputBackgroundColorBlockItem = new BackgroundColorBlockItem(Colors.Blue);
var testInputBorderColorBlockItem = new BorderColorBlockItem(Colors.Yellow);
var testInputSoundBlockItem = new SoundBlockItem(1, 1);
var testInputSoundBlockItem = new SoundBlockItem("1", 1);
testInputBlockItems.Add(testInputTextColorBlockItem);
testInputBlockItems.Add(testInputBackgroundColorBlockItem);
@@ -1705,7 +1879,7 @@ namespace Filtration.Parser.Tests.Services
var soundBlockItem = testInputBlockItems.First(b => b is SoundBlockItem) as SoundBlockItem;
Assert.IsNotNull(soundBlockItem);
Assert.AreNotSame(testInputSoundBlockItem, soundBlockItem);
Assert.AreEqual(7, soundBlockItem.Value);
Assert.AreEqual("7", soundBlockItem.Value);
Assert.AreEqual(280, soundBlockItem.SecondValue);
}
@@ -1738,7 +1912,7 @@ namespace Filtration.Parser.Tests.Services
var soundBlockItem = testInputBlockItems.First(b => b is SoundBlockItem) as SoundBlockItem;
Assert.IsNotNull(soundBlockItem);
Assert.AreEqual(7, soundBlockItem.Value);
Assert.AreEqual("7", soundBlockItem.Value);
Assert.AreEqual(280, soundBlockItem.SecondValue);
}
@@ -1789,6 +1963,7 @@ namespace Filtration.Parser.Tests.Services
// Assert
}
private class ItemFilterBlockTranslatorTestUtility
{
public ItemFilterBlockTranslatorTestUtility()
@@ -1798,6 +1973,7 @@ namespace Filtration.Parser.Tests.Services
// Mock setups
MockBlockGroupHierarchyBuilder = new Mock<IBlockGroupHierarchyBuilder>();
MockItemFilterScript = Mock.Of<IItemFilterScript>(i => i.ItemFilterScriptSettings.ThemeComponentCollection == new ThemeComponentCollection());
// Class under test instantiation
Translator = new ItemFilterBlockTranslator(MockBlockGroupHierarchyBuilder.Object);
@@ -1806,6 +1982,8 @@ namespace Filtration.Parser.Tests.Services
public ItemFilterBlock TestBlock { get; set; }
public Mock<IBlockGroupHierarchyBuilder> MockBlockGroupHierarchyBuilder { get; }
public ItemFilterBlockTranslator Translator { get; }
public IItemFilterScript MockItemFilterScript { get; }
}
}
}

View File

@@ -1,14 +1,17 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using Filtration.ObjectModel;
using Filtration.ObjectModel.BlockItemTypes;
using Filtration.ObjectModel.Enums;
using Filtration.ObjectModel.Factories;
using Filtration.ObjectModel.ThemeEditor;
using Filtration.Parser.Interface.Services;
using Filtration.Parser.Services;
using Filtration.Parser.Tests.Properties;
using Filtration.Properties;
using FluentAssertions;
using Moq;
using NUnit.Framework;
@@ -17,12 +20,9 @@ namespace Filtration.Parser.Tests.Services
[TestFixture]
public class TestItemFilterScriptTranslator
{
private ItemFilterScriptTranslatorTestUtility _testUtility;
[SetUp]
public void ItemFilterScriptTranslatorTestSetup()
{
_testUtility = new ItemFilterScriptTranslatorTestUtility();
Settings.Default.Reset();
}
@@ -32,14 +32,15 @@ namespace Filtration.Parser.Tests.Services
// Arrange
var testInput = Resources.testscript;
_testUtility.MockItemFilterBlockTranslator.Setup(t => t.TranslateStringToItemFilterBlock(It.IsAny<string>(), It.IsAny<ThemeComponentCollection>())).Verifiable();
var mockItemFilterBlockTranslator = new Mock<IItemFilterBlockTranslator>();
var translator = CreateItemFilterScriptTranslator(itemFilterBlockTranslator: mockItemFilterBlockTranslator.Object);
// Act
var script = _testUtility.ScriptTranslator.TranslateStringToItemFilterScript(testInput);
var script = translator.TranslateStringToItemFilterScript(testInput);
// Assert
Assert.AreEqual(5, script.ItemFilterBlocks.Count);
_testUtility.MockItemFilterBlockTranslator.Verify();
mockItemFilterBlockTranslator.Verify(t => t.TranslateStringToItemFilterBlock(It.IsAny<string>(), It.IsAny<IItemFilterScript>(), false));
}
[Test]
@@ -54,11 +55,10 @@ namespace Filtration.Parser.Tests.Services
Environment.NewLine +
"End Script Description";
var mockItemFilterBlockTranslator = new Mock<IItemFilterBlockTranslator>();
mockItemFilterBlockTranslator.Setup(t => t.TranslateStringToItemFilterBlock(It.IsAny<string>(), It.IsAny<ThemeComponentCollection>())).Verifiable();
var translator = CreateItemFilterScriptTranslator();
// Act
var script = _testUtility.ScriptTranslator.TranslateStringToItemFilterScript(testInput);
var script = translator.TranslateStringToItemFilterScript(testInput);
// Assert
Assert.AreEqual(expectedDescription, script.Description);
@@ -70,8 +70,8 @@ namespace Filtration.Parser.Tests.Services
// Arrange
var testInput = Resources.ThioleItemFilter;
var blockTranslator = new ItemFilterBlockTranslator(_testUtility.MockBlockGroupHierarchyBuilder.Object);
var translator = new ItemFilterScriptTranslator(blockTranslator, _testUtility.MockBlockGroupHierarchyBuilder.Object);
var blockTranslator = new ItemFilterBlockTranslator(Mock.Of<IBlockGroupHierarchyBuilder>());
var translator = CreateItemFilterScriptTranslator(itemFilterBlockTranslator: blockTranslator);
// Act
translator.TranslateStringToItemFilterScript(testInput);
@@ -80,6 +80,36 @@ namespace Filtration.Parser.Tests.Services
// Not crashing out when loading a huge script means this integration test has passed!
}
[Test]
public void TranslateStringToItemFilterScript_Blah()
{
// Arrange
var testInput = Resources.testscript2;
var blockTranslator = new ItemFilterBlockTranslator(Mock.Of<IBlockGroupHierarchyBuilder>());
var translator = CreateItemFilterScriptTranslator(itemFilterBlockTranslator: blockTranslator);
// Act
var result = translator.TranslateStringToItemFilterScript(testInput);
// 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) }
&& s.ThemeComponents == new ThemeComponentCollection()
&& s.ItemFilterScriptSettings == new ItemFilterScriptSettings(new ThemeComponentCollection())
&& s.Description == "Script description\r\nScript description\r\nScript description\r\nScript description");
result.ShouldBeEquivalentTo(expectedResult);
}
[Test]
public void TranslateItemFilterScriptToString_OneBlock_CallsTranslator()
{
@@ -93,14 +123,19 @@ namespace Filtration.Parser.Tests.Services
testScript.ItemFilterBlocks.Add(testBlock);
_testUtility.MockItemFilterBlockTranslator.Setup(t => t.TranslateItemFilterBlockToString(testBlock)).Returns(blockOutput).Verifiable();
var mockItemFilterBlockTranslator = new Mock<IItemFilterBlockTranslator>();
mockItemFilterBlockTranslator
.Setup(t => t.TranslateItemFilterBlockBaseToString(testBlock))
.Returns(blockOutput)
.Verifiable();
var translator = CreateItemFilterScriptTranslator(itemFilterBlockTranslator: mockItemFilterBlockTranslator.Object);
// Act
_testUtility.ScriptTranslator.TranslateItemFilterScriptToString(testScript);
translator.TranslateItemFilterScriptToString(testScript);
// Assert
_testUtility.MockItemFilterBlockTranslator.Verify();
mockItemFilterBlockTranslator.Verify();
}
[Test]
@@ -129,9 +164,8 @@ namespace Filtration.Parser.Tests.Services
" Width = 3" + Environment.NewLine +
" SetFontSize 7" + Environment.NewLine;
var blockTranslator = new ItemFilterBlockTranslator(_testUtility.MockBlockGroupHierarchyBuilder.Object);
var translator = new ItemFilterScriptTranslator(blockTranslator,
_testUtility.MockBlockGroupHierarchyBuilder.Object);
var blockTranslator = new ItemFilterBlockTranslator(Mock.Of<IBlockGroupHierarchyBuilder>());
var translator = CreateItemFilterScriptTranslator(itemFilterBlockTranslator: blockTranslator);
// Act
var result = translator.TranslateItemFilterScriptToString(script);
@@ -174,9 +208,8 @@ namespace Filtration.Parser.Tests.Services
" Width = 3" + Environment.NewLine +
" SetFontSize 7" + Environment.NewLine + Environment.NewLine;
var blockTranslator = new ItemFilterBlockTranslator(_testUtility.MockBlockGroupHierarchyBuilder.Object);
var translator = new ItemFilterScriptTranslator(blockTranslator,
_testUtility.MockBlockGroupHierarchyBuilder.Object);
var blockTranslator = new ItemFilterBlockTranslator(Mock.Of<IBlockGroupHierarchyBuilder>());
var translator = CreateItemFilterScriptTranslator(itemFilterBlockTranslator: blockTranslator);
// Act
var result = translator.TranslateItemFilterScriptToString(script);
@@ -198,40 +231,15 @@ namespace Filtration.Parser.Tests.Services
Environment.NewLine +
"# Test script description" + Environment.NewLine + Environment.NewLine;
var translator = CreateItemFilterScriptTranslator();
// Act
var result = _testUtility.ScriptTranslator.TranslateItemFilterScriptToString(script);
var result = translator.TranslateItemFilterScriptToString(script);
// Assert
Assert.AreEqual(expectedOutput, result);
}
[Test]
public void TranslateStringToItemFilterScript_SectionDirectlyBeforeBlockWithoutDescription_ReturnsCorrectObject()
{
// Arrange
var testInputScript = "# My Script" + Environment.NewLine +
Environment.NewLine +
"# Section: Chance Bases" + Environment.NewLine +
"Show" + Environment.NewLine +
" BaseType \"Lapis Amulet\" \"Amber Amulet\"" + Environment.NewLine +
" SetBorderColor 255 0 255" + Environment.NewLine +
" SetFontSize 25";
var blockTranslator = new ItemFilterBlockTranslator(_testUtility.MockBlockGroupHierarchyBuilder.Object);
var translator = new ItemFilterScriptTranslator(blockTranslator,
_testUtility.MockBlockGroupHierarchyBuilder.Object);
// Act
var result = translator.TranslateStringToItemFilterScript(testInputScript);
// Assert
Assert.AreEqual(2, result.ItemFilterBlocks.Count);
var block = result.ItemFilterBlocks.First(l => l.GetType() != typeof(ItemFilterSection));
Assert.AreEqual(4, block.BlockItems.Count);
var baseTypeItem = block.BlockItems.OfType<BaseTypeBlockItem>().First();
Assert.AreEqual(2, baseTypeItem.Items.Count);
}
[Test]
public void TranslateStringToItemFilterScript_OneLineDescriptionNoBlockDescriptionAddsDescriptionToScript()
{
@@ -240,16 +248,15 @@ namespace Filtration.Parser.Tests.Services
Environment.NewLine +
"Show" + Environment.NewLine +
"BaseType \"Maelström Staff\"" + Environment.NewLine + Environment.NewLine;
var blockTranslator = new ItemFilterBlockTranslator(_testUtility.MockBlockGroupHierarchyBuilder.Object);
var translator = new ItemFilterScriptTranslator(blockTranslator,
_testUtility.MockBlockGroupHierarchyBuilder.Object);
var blockTranslator = new ItemFilterBlockTranslator(Mock.Of<IBlockGroupHierarchyBuilder>());
var translator = CreateItemFilterScriptTranslator(itemFilterBlockTranslator: blockTranslator);
// Act
var result = translator.TranslateStringToItemFilterScript(testInputScript);
// Assert
Assert.AreEqual("Script edited with Filtration - https://github.com/ben-wallis/Filtration", result.Description);
var firstBlock = result.ItemFilterBlocks.First();
var firstBlock = result.ItemFilterBlocks.OfType<ItemFilterBlock>().First();
Assert.IsNull(firstBlock.Description);
}
@@ -274,9 +281,8 @@ namespace Filtration.Parser.Tests.Services
" SetTextColor 255 255 0";
var blockTranslator = new ItemFilterBlockTranslator(_testUtility.MockBlockGroupHierarchyBuilder.Object);
var translator = new ItemFilterScriptTranslator(blockTranslator,
_testUtility.MockBlockGroupHierarchyBuilder.Object);
var blockTranslator = new ItemFilterBlockTranslator(Mock.Of<IBlockGroupHierarchyBuilder>());
var translator = CreateItemFilterScriptTranslator(itemFilterBlockTranslator: blockTranslator);
// Act
var result = translator.TranslateStringToItemFilterScript(testInputScript);
@@ -306,9 +312,8 @@ namespace Filtration.Parser.Tests.Services
" SetTextColor 255 255 0";
var blockTranslator = new ItemFilterBlockTranslator(_testUtility.MockBlockGroupHierarchyBuilder.Object);
var translator = new ItemFilterScriptTranslator(blockTranslator,
_testUtility.MockBlockGroupHierarchyBuilder.Object);
var blockTranslator = new ItemFilterBlockTranslator(Mock.Of<IBlockGroupHierarchyBuilder>());
var translator = CreateItemFilterScriptTranslator(itemFilterBlockTranslator: blockTranslator);
// Act
var result = translator.TranslateStringToItemFilterScript(testInputScript);
@@ -316,9 +321,9 @@ namespace Filtration.Parser.Tests.Services
// Assert
Assert.AreEqual(3, result.ItemFilterBlocks.Count);
var firstBlock = result.ItemFilterBlocks.First();
var secondBlock = result.ItemFilterBlocks.Skip(1).First();
var thirdBlock = result.ItemFilterBlocks.Skip(2).First();
var firstBlock = result.ItemFilterBlocks.OfType<ItemFilterBlock>().First();
var secondBlock = result.ItemFilterBlocks.OfType<ItemFilterBlock>().Skip(1).First();
var thirdBlock = result.ItemFilterBlocks.OfType<ItemFilterBlock>().Skip(2).First();
Assert.AreEqual(3, firstBlock.BlockItems.Count);
Assert.AreEqual(5, secondBlock.BlockItems.Count);
@@ -340,19 +345,20 @@ namespace Filtration.Parser.Tests.Services
"#Disabled Block End";
var blockTranslator = new ItemFilterBlockTranslator(_testUtility.MockBlockGroupHierarchyBuilder.Object);
var translator = new ItemFilterScriptTranslator(blockTranslator,
_testUtility.MockBlockGroupHierarchyBuilder.Object);
var blockTranslator = new ItemFilterBlockTranslator(Mock.Of<IBlockGroupHierarchyBuilder>());
var translator = CreateItemFilterScriptTranslator(itemFilterBlockTranslator: blockTranslator);
// Act
var result = translator.TranslateStringToItemFilterScript(testInputScript);
// Assert
Assert.AreEqual(2, result.ItemFilterBlocks.Count);
var secondBlock = result.ItemFilterBlocks.Skip(1).First();
var secondBlock = result.ItemFilterBlocks.OfType<ItemFilterBlock>().Skip(1).First();
Assert.AreEqual("This is a disabled block", secondBlock.Description);
}
// TODO: Reinstate this test
[Ignore("Ignored until toggling block group parsing can be controlled from the filter script input")]
[Test]
public void TranslateStringToItemFilterScript_DisabledBlockWithBlockGroup_ReturnsCorrectBlock()
{
@@ -368,39 +374,37 @@ namespace Filtration.Parser.Tests.Services
"#Disabled Block End";
var blockTranslator = new ItemFilterBlockTranslator(_testUtility.MockBlockGroupHierarchyBuilder.Object);
_testUtility.MockBlockGroupHierarchyBuilder.Setup(
var mockBlockGroupHierarchyBuilder = new Mock<IBlockGroupHierarchyBuilder>();
mockBlockGroupHierarchyBuilder.Setup(
b => b.IntegrateStringListIntoBlockGroupHierarchy(It.IsAny<IEnumerable<string>>()))
.Returns(new ItemFilterBlockGroup("My Block Group", null));
var translator = new ItemFilterScriptTranslator(blockTranslator,
_testUtility.MockBlockGroupHierarchyBuilder.Object);
var blockTranslator = new ItemFilterBlockTranslator(mockBlockGroupHierarchyBuilder.Object);
var translator = CreateItemFilterScriptTranslator(itemFilterBlockTranslator: blockTranslator);
// Act
var result = translator.TranslateStringToItemFilterScript(testInputScript);
// Assert
Assert.AreEqual(2, result.ItemFilterBlocks.Count);
var secondBlock = result.ItemFilterBlocks.Skip(1).First();
var secondBlock = result.ItemFilterBlocks.OfType<ItemFilterBlock>().Skip(1).First();
Assert.AreEqual("This is a disabled block", secondBlock.Description);
Assert.AreEqual("My Block Group", secondBlock.BlockGroup.GroupName);
}
private class ItemFilterScriptTranslatorTestUtility
private ItemFilterScriptTranslator CreateItemFilterScriptTranslator(IBlockGroupHierarchyBuilder blockGroupHierarchyBuilder = null,
IItemFilterBlockTranslator itemFilterBlockTranslator = null,
IItemFilterScriptFactory itemFilterScriptFactory = null)
{
public ItemFilterScriptTranslatorTestUtility()
{
// Mock setups
MockItemFilterBlockTranslator = new Mock<IItemFilterBlockTranslator>();
MockBlockGroupHierarchyBuilder = new Mock<IBlockGroupHierarchyBuilder>();
var mockItemFilterScriptFactory = new Mock<IItemFilterScriptFactory>();
mockItemFilterScriptFactory
.Setup(i => i.Create())
.Returns(new ItemFilterScript());
// Class under test instantiation
ScriptTranslator = new ItemFilterScriptTranslator(MockItemFilterBlockTranslator.Object, MockBlockGroupHierarchyBuilder.Object);
}
public ItemFilterScriptTranslator ScriptTranslator { get; }
public Mock<IItemFilterBlockTranslator> MockItemFilterBlockTranslator { get; }
public Mock<IBlockGroupHierarchyBuilder> MockBlockGroupHierarchyBuilder { get; }
return new ItemFilterScriptTranslator(blockGroupHierarchyBuilder ?? new Mock<IBlockGroupHierarchyBuilder>().Object,
itemFilterBlockTranslator ?? new Mock<IItemFilterBlockTranslator>().Object,
itemFilterScriptFactory ?? mockItemFilterScriptFactory.Object);
}
}
}

View File

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

View File

@@ -35,9 +35,8 @@
<HintPath>..\packages\Castle.Core.3.3.3\lib\net45\Castle.Core.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Castle.Windsor, Version=3.3.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
<HintPath>..\packages\Castle.Windsor.3.3.0\lib\net45\Castle.Windsor.dll</HintPath>
<Private>True</Private>
<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="PresentationCore" />
<Reference Include="System" />

View File

@@ -29,64 +29,70 @@ namespace Filtration.Parser.Services
_blockGroupHierarchyBuilder = blockGroupHierarchyBuilder;
}
// Converts a string into an ItemFilterCommentBlock maintaining newlines and spaces but removing # characters
public IItemFilterCommentBlock TranslateStringToItemFilterCommentBlock(string inputString, IItemFilterScript parentItemFilterScript)
{
var itemFilterCommentBlock = new ItemFilterCommentBlock(parentItemFilterScript);
foreach (var line in new LineReader(() => new StringReader(inputString)))
{
var trimmedLine = line.TrimStart(' ').TrimStart('#');
itemFilterCommentBlock.Comment += trimmedLine + Environment.NewLine;
}
itemFilterCommentBlock.Comment = itemFilterCommentBlock.Comment.TrimEnd('\r', '\n');
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, ThemeComponentCollection masterComponentCollection)
public IItemFilterBlock TranslateStringToItemFilterBlock(string inputString, IItemFilterScript parentItemFilterScript, bool initialiseBlockGroupHierarchyBuilder = false)
{
_masterComponentCollection = masterComponentCollection;
var block = new ItemFilterBlock();
if (initialiseBlockGroupHierarchyBuilder)
{
_blockGroupHierarchyBuilder.Initialise(parentItemFilterScript.ItemFilterBlockGroups.First());
}
_masterComponentCollection = parentItemFilterScript.ItemFilterScriptSettings.ThemeComponentCollection;
var block = new ItemFilterBlock(parentItemFilterScript);
var showHideFound = false;
foreach (var line in new LineReader(() => new StringReader(inputString)))
{
if (line.StartsWith(@"# Section:"))
{
var section = new ItemFilterSection
{
Description = line.Substring(line.IndexOf(":", StringComparison.Ordinal) + 1).Trim()
};
return section;
}
if (line.StartsWith(@"#") && !showHideFound)
{
block.Description = line.TrimStart('#').TrimStart(' ');
continue;
}
var adjustedLine = line.Replace("#", " # ");
var trimmedLine = adjustedLine.TrimStart(' ').TrimEnd(' ');
var trimmedLine = line.Trim();
var spaceOrEndOfLinePos = trimmedLine.IndexOf(" ", StringComparison.Ordinal) > 0 ? trimmedLine.IndexOf(" ", StringComparison.Ordinal) : trimmedLine.Length;
var lineOption = trimmedLine.Substring(0, spaceOrEndOfLinePos);
switch (lineOption)
{
case "Show":
showHideFound = true;
block.Action = BlockAction.Show;
block.Enabled = true;
AddBlockGroupToBlock(block, trimmedLine);
break;
case "Hide":
showHideFound = true;
block.Action = BlockAction.Hide;
block.Enabled = true;
AddBlockGroupToBlock(block, trimmedLine);
break;
case "ShowDisabled":
showHideFound = true;
block.Action = BlockAction.Show;
block.Enabled = false;
AddBlockGroupToBlock(block, trimmedLine);
break;
case "HideDisabled":
{
showHideFound = true;
block.Action = BlockAction.Hide;
block.Enabled = false;
block.Action = lineOption.StartsWith("Show") ? BlockAction.Show : BlockAction.Hide;
block.Enabled = !lineOption.EndsWith("Disabled");
// If block groups are enabled for this script, the comment after Show/Hide is parsed as a block
// group hierarchy, if block groups are disabled it is preserved as a simple text comment.
if (parentItemFilterScript.ItemFilterScriptSettings.BlockGroupsEnabled)
{
AddBlockGroupToBlock(block, trimmedLine);
}
else
{
block.ActionBlockItem.Comment = GetTextAfterFirstComment(trimmedLine);
}
break;
}
case "ItemLevel":
{
AddNumericFilterPredicateItemToBlockItems<ItemLevelBlockItem>(block, trimmedLine);
@@ -139,6 +145,21 @@ namespace Filtration.Parser.Services
AddBooleanItemToBlockItems<IdentifiedBlockItem>(block, trimmedLine);
break;
}
case "ElderItem":
{
AddBooleanItemToBlockItems<ElderItemBlockItem>(block, trimmedLine);
break;
}
case "ShaperItem":
{
AddBooleanItemToBlockItems<ShaperItemBlockItem>(block, trimmedLine);
break;
}
case "ShapedMap":
{
AddBooleanItemToBlockItems<ShapedMapBlockItem>(block, trimmedLine);
break;
}
case "Sockets":
{
AddNumericFilterPredicateItemToBlockItems<SocketsBlockItem>(block, trimmedLine);
@@ -202,35 +223,46 @@ namespace Filtration.Parser.Services
break;
}
case "PlayAlertSound":
case "PlayAlertSoundPositional":
{
// Only ever use the last PlayAlertSound item encountered as multiples aren't valid.
RemoveExistingBlockItemsOfType<SoundBlockItem>(block);
RemoveExistingBlockItemsOfType<PositionalSoundBlockItem>(block);
var matches = Regex.Matches(trimmedLine, @"\s+(\d+)");
switch (matches.Count)
var match = Regex.Match(trimmedLine, @"\S+\s+(\S+)\s?(\d+)?");
if (match.Success)
{
case 1:
if (matches[0].Success)
string firstValue = match.Groups[1].Value;
int secondValue;
if (match.Groups[2].Success)
{
secondValue = Convert.ToInt16(match.Groups[2].Value);
}
else
{
secondValue = 79;
}
if (lineOption == "PlayAlertSound")
{
var blockItemValue = new SoundBlockItem
{
Value = Convert.ToInt16(matches[0].Value),
SecondValue = 79
Value = firstValue,
SecondValue = secondValue
};
block.BlockItems.Add(blockItemValue);
}
break;
case 2:
if (matches[0].Success && matches[1].Success)
else
{
var blockItemValue = new SoundBlockItem
var blockItemValue = new PositionalSoundBlockItem
{
Value = Convert.ToInt16(matches[0].Value),
SecondValue = Convert.ToInt16(matches[1].Value)
Value = firstValue,
SecondValue = secondValue
};
block.BlockItems.Add(blockItemValue);
}
break;
}
break;
}
@@ -358,9 +390,9 @@ namespace Filtration.Parser.Services
{
case "PlayAlertSound":
{
var match = Regex.Match(line, @"\s+(\d+) (\d+)");
var match = Regex.Match(line, @"\s+(\S+) (\d+)");
if (!match.Success) break;
blockItems.Add(new SoundBlockItem(Convert.ToInt16(match.Groups[1].Value), Convert.ToInt16(match.Groups[2].Value)));
blockItems.Add(new SoundBlockItem(match.Groups[1].Value, Convert.ToInt16(match.Groups[2].Value)));
break;
}
case "SetTextColor":
@@ -391,11 +423,11 @@ namespace Filtration.Parser.Services
private void AddBlockGroupToBlock(IItemFilterBlock block, string inputString)
{
var blockGroupStart = inputString.IndexOf("#", StringComparison.Ordinal);
if (blockGroupStart <= 0) return;
var blockGroupText = GetTextAfterFirstComment(inputString);
var blockGroups = blockGroupText.Split(new[] { " - " }, StringSplitOptions.RemoveEmptyEntries)
.Select(s => s.Trim())
.ToList();
var blockGroupText = inputString.Substring(blockGroupStart + 1);
var blockGroups = blockGroupText.Split('-').ToList();
if (blockGroups.Count(b => !string.IsNullOrEmpty(b.Trim())) > 0)
{
block.BlockGroup = _blockGroupHierarchyBuilder.IntegrateStringListIntoBlockGroupHierarchy(blockGroups);
@@ -403,6 +435,14 @@ namespace Filtration.Parser.Services
}
}
private static string GetTextAfterFirstComment(string inputString)
{
var blockGroupStart = inputString.IndexOf("#", StringComparison.Ordinal);
if (blockGroupStart <= 0) return string.Empty;
return inputString.Substring(blockGroupStart + 1);
}
private static Color GetColorFromString(string inputString)
{
var argbValues = Regex.Matches(inputString, @"\s+(\d+)");
@@ -429,15 +469,43 @@ namespace Filtration.Parser.Services
return new Color();
}
// This method converts an ItemFilterBlock object into a string. This is used for copying a ItemFilterBlock
// to the clipboard, and when saving a ItemFilterScript.
public string TranslateItemFilterBlockToString(IItemFilterBlock block)
public string TranslateItemFilterBlockBaseToString(IItemFilterBlockBase itemFilterBlockBase)
{
if (block.GetType() == typeof (ItemFilterSection))
if (itemFilterBlockBase is IItemFilterBlock itemFilterBlock)
{
return "# Section: " + block.Description;
return TranslateItemFilterBlockToString(itemFilterBlock);
}
if (itemFilterBlockBase is IItemFilterCommentBlock itemFilterCommentBlock)
{
return TranslateItemFilterCommentBlockToString(itemFilterCommentBlock);
}
throw new InvalidOperationException("Unable to translate unknown ItemFilterBlock type");
}
// TODO: Private
public string TranslateItemFilterCommentBlockToString(IItemFilterCommentBlock itemFilterCommentBlock)
{
// TODO: Tests
// TODO: # Section: text?
var commentWithHashes = string.Empty;
// Add "# " to the beginning of each line of the comment before saving it
foreach (var line in new LineReader(() => new StringReader(itemFilterCommentBlock.Comment)))
{
commentWithHashes += $"# {line.TrimStart(' ')}{Environment.NewLine}";
}
// Remove trailing newline
return commentWithHashes.TrimEnd('\r', '\n');
}
// This method converts an ItemFilterBlock object into a string. This is used for copying a ItemFilterBlock
// to the clipboard, and when saving a ItemFilterScript.
// TODO: Private
public string TranslateItemFilterBlockToString(IItemFilterBlock block)
{
var outputString = string.Empty;
if (!block.Enabled)
@@ -456,6 +524,10 @@ namespace Filtration.Parser.Services
{
outputString += " # " + block.BlockGroup;
}
else if (!string.IsNullOrEmpty(block.ActionBlockItem?.Comment))
{
outputString += " #" + block.ActionBlockItem.Comment;
}
// ReSharper disable once LoopCanBeConvertedToQuery
foreach (var blockItem in block.BlockItems.Where(b => b.GetType() != typeof(ActionBlockItem)).OrderBy(b => b.SortOrder))

View File

@@ -2,27 +2,53 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text.RegularExpressions;
using Filtration.Common.Utilities;
using Filtration.ObjectModel;
using Filtration.ObjectModel.Factories;
using Filtration.Parser.Interface.Services;
using Filtration.Properties;
namespace Filtration.Parser.Services
{
internal class ItemFilterBlockBoundary
{
public ItemFilterBlockBoundary(int startLine, ItemFilterBlockBoundaryType itemFilterBlockBoundaryType)
{
StartLine = startLine;
BoundaryType = itemFilterBlockBoundaryType;
}
public int StartLine { get; set; }
public ItemFilterBlockBoundaryType BoundaryType { get; set; }
}
internal enum ItemFilterBlockBoundaryType
{
ScriptDescription,
ItemFilterBlock,
CommentBlock
}
internal class ItemFilterScriptTranslator : IItemFilterScriptTranslator
{
private readonly IItemFilterBlockTranslator _blockTranslator;
private readonly IItemFilterScriptFactory _itemFilterScriptFactory;
private readonly IBlockGroupHierarchyBuilder _blockGroupHierarchyBuilder;
public ItemFilterScriptTranslator(IItemFilterBlockTranslator blockTranslator,
IBlockGroupHierarchyBuilder blockGroupHierarchyBuilder)
public ItemFilterScriptTranslator(IBlockGroupHierarchyBuilder blockGroupHierarchyBuilder,
IItemFilterBlockTranslator blockTranslator,
IItemFilterScriptFactory itemFilterScriptFactory)
{
_blockTranslator = blockTranslator;
_blockGroupHierarchyBuilder = blockGroupHierarchyBuilder;
_blockTranslator = blockTranslator;
_itemFilterScriptFactory = itemFilterScriptFactory;
}
public string PreprocessDisabledBlocks(string inputString)
public static string PreprocessDisabledBlocks(string inputString)
{
bool inDisabledBlock = false;
var showHideFound = false;
@@ -82,9 +108,9 @@ namespace Filtration.Parser.Services
return lines.Aggregate((c, n) => c + Environment.NewLine + n);
}
public ItemFilterScript TranslateStringToItemFilterScript(string inputString)
public IItemFilterScript TranslateStringToItemFilterScript(string inputString)
{
var script = new ItemFilterScript();
var script = _itemFilterScriptFactory.Create();
_blockGroupHierarchyBuilder.Initialise(script.ItemFilterBlockGroups.First());
inputString = inputString.Replace("\t", "");
@@ -98,9 +124,13 @@ namespace Filtration.Parser.Services
var lines = Regex.Split(inputString, "\r\n|\r|\n");
// Process the script header
for (var i = 0; i < conditionBoundaries.First.Value; i++)
for (var i = 0; i < conditionBoundaries.Skip(1).First().StartLine; i++)
{
if (lines[i].StartsWith("#"))
if (lines[i].StartsWith("# EnableBlockGroups"))
{
script.ItemFilterScriptSettings.BlockGroupsEnabled = true;
}
else if (lines[i].StartsWith("#"))
{
script.Description += lines[i].Substring(1).Trim(' ') + Environment.NewLine;
}
@@ -115,53 +145,105 @@ namespace Filtration.Parser.Services
// and add that object to the ItemFilterBlocks list
for (var boundary = conditionBoundaries.First; boundary != null; boundary = boundary.Next)
{
var begin = boundary.Value;
var end = boundary.Next?.Value ?? lines.Length;
if (boundary.Value.BoundaryType == ItemFilterBlockBoundaryType.ScriptDescription)
{
continue;
}
var begin = boundary.Value.StartLine;
var end = boundary.Next?.Value.StartLine ?? lines.Length;
var block = new string[end - begin];
Array.Copy(lines, begin, block, 0, end - begin);
var blockString = string.Join("\r\n", block);
script.ItemFilterBlocks.Add(_blockTranslator.TranslateStringToItemFilterBlock(blockString, script.ThemeComponents));
if (boundary.Value.BoundaryType == ItemFilterBlockBoundaryType.ItemFilterBlock)
{
script.ItemFilterBlocks.Add(_blockTranslator.TranslateStringToItemFilterBlock(blockString, script));
}
else
{
script.ItemFilterBlocks.Add(_blockTranslator.TranslateStringToItemFilterCommentBlock(blockString, script));
}
}
_blockGroupHierarchyBuilder.Cleanup();
return script;
}
private static LinkedList<int> IdentifyBlockBoundaries(string inputString)
private static LinkedList<ItemFilterBlockBoundary> IdentifyBlockBoundaries(string inputString)
{
var blockBoundaries = new LinkedList<int>();
var blockBoundaries = new LinkedList<ItemFilterBlockBoundary>();
var previousLine = string.Empty;
var currentLine = 0;
var currentLine = -1;
var currentItemFilterBlockBoundary = new ItemFilterBlockBoundary(0, ItemFilterBlockBoundaryType.ScriptDescription);
foreach (var line in new LineReader(() => new StringReader(inputString)))
{
currentLine++;
var trimmedLine = line.TrimStart(' ').TrimEnd(' ');
if (trimmedLine.StartsWith("Show") || trimmedLine.StartsWith("Hide") ||
trimmedLine.StartsWith("# Section:"))
var trimmedLine = line.Trim(' ');
if (string.IsNullOrWhiteSpace(trimmedLine))
{
previousLine = line;
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)
{
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)
{
blockBoundaries.AddLast(currentItemFilterBlockBoundary);
}
currentItemFilterBlockBoundary = new ItemFilterBlockBoundary(currentLine, ItemFilterBlockBoundaryType.CommentBlock);
}
else if (trimmedLine.StartsWith("Show") || trimmedLine.StartsWith("Hide"))
{
// If the line previous to the Show or Hide line is a comment then we should include that in the block
// as it represents the block description.
// currentLine > 2 caters for an edge case where the script description is a single line and the first
// block has no description. This prevents the script description from being assigned to the first block's description.
blockBoundaries.AddLast(previousLine.StartsWith("#") && !previousLine.StartsWith("# Section:") &&
currentLine > 2
? currentLine - 2
: currentLine - 1);
if (!(currentItemFilterBlockBoundary.StartLine == currentLine - 1 && currentItemFilterBlockBoundary.BoundaryType == ItemFilterBlockBoundaryType.CommentBlock))
{
blockBoundaries.AddLast(currentItemFilterBlockBoundary);
}
currentItemFilterBlockBoundary = new ItemFilterBlockBoundary(previousLine.StartsWith("#") && currentLine > 2 ? currentLine - 1 : currentLine,
ItemFilterBlockBoundaryType.ItemFilterBlock);
}
previousLine = line;
}
if (blockBoundaries.Last.Value != currentItemFilterBlockBoundary)
{
blockBoundaries.AddLast(currentItemFilterBlockBoundary);
}
return blockBoundaries;
}
public string TranslateItemFilterScriptToString(ItemFilterScript script)
public string TranslateItemFilterScriptToString(IItemFilterScript script)
{
var outputString = string.Empty;
outputString += "# Script edited with Filtration - https://github.com/ben-wallis/Filtration" +
Environment.NewLine;
if (script.ItemFilterScriptSettings.BlockGroupsEnabled)
{
outputString += "# EnableBlockGroups" + Environment.NewLine;
}
if (!string.IsNullOrEmpty(script.Description))
{
// ReSharper disable once LoopCanBeConvertedToQuery
@@ -178,7 +260,7 @@ namespace Filtration.Parser.Services
// ReSharper disable once LoopCanBeConvertedToQuery
foreach (var block in script.ItemFilterBlocks)
{
outputString += _blockTranslator.TranslateItemFilterBlockToString(block) + Environment.NewLine;
outputString += _blockTranslator.TranslateItemFilterBlockBaseToString(block) + Environment.NewLine;
if (Settings.Default.ExtraLineBetweenBlocks)
{

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Castle.Core" version="3.3.3" targetFramework="net461" />
<package id="Castle.Windsor" version="3.3.0" targetFramework="net461" />
<package id="Castle.Windsor" version="3.4.0" targetFramework="net461" />
</packages>

View File

@@ -35,21 +35,17 @@
<HintPath>..\packages\Castle.Core.3.3.3\lib\net45\Castle.Core.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="FluentAssertions, Version=4.13.1.0, Culture=neutral, PublicKeyToken=33f2691a05b67b6a, processorArchitecture=MSIL">
<HintPath>..\packages\FluentAssertions.4.13.1\lib\net45\FluentAssertions.dll</HintPath>
<Private>True</Private>
<Reference Include="FluentAssertions, Version=4.19.2.0, Culture=neutral, PublicKeyToken=33f2691a05b67b6a, processorArchitecture=MSIL">
<HintPath>..\packages\FluentAssertions.4.19.2\lib\net45\FluentAssertions.dll</HintPath>
</Reference>
<Reference Include="FluentAssertions.Core, Version=4.13.1.0, Culture=neutral, PublicKeyToken=33f2691a05b67b6a, processorArchitecture=MSIL">
<HintPath>..\packages\FluentAssertions.4.13.1\lib\net45\FluentAssertions.Core.dll</HintPath>
<Private>True</Private>
<Reference Include="FluentAssertions.Core, Version=4.19.2.0, Culture=neutral, PublicKeyToken=33f2691a05b67b6a, processorArchitecture=MSIL">
<HintPath>..\packages\FluentAssertions.4.19.2\lib\net45\FluentAssertions.Core.dll</HintPath>
</Reference>
<Reference Include="Moq, Version=4.5.21.0, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
<HintPath>..\packages\Moq.4.5.21\lib\net45\Moq.dll</HintPath>
<Private>True</Private>
<Reference Include="Moq, Version=4.5.30.0, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
<HintPath>..\packages\Moq.4.5.30\lib\net45\Moq.dll</HintPath>
</Reference>
<Reference Include="nunit.framework, Version=3.4.1.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
<HintPath>..\packages\NUnit.3.4.1\lib\net45\nunit.framework.dll</HintPath>
<Private>True</Private>
<Reference Include="nunit.framework, Version=3.6.1.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
<HintPath>..\packages\NUnit.3.6.1\lib\net45\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="PresentationCore" />
<Reference Include="System" />

View File

@@ -2,9 +2,11 @@
using System.IO;
using System.Threading.Tasks;
using Filtration.ObjectModel;
using Filtration.ObjectModel.Factories;
using Filtration.Repositories;
using Filtration.Services;
using Filtration.ViewModels;
using Filtration.ViewModels.Factories;
using FluentAssertions;
using Moq;
using NUnit.Framework;
@@ -29,7 +31,8 @@ namespace Filtration.Tests.Repositories
var mockItemFilterScriptViewModelFactory = new Mock<IItemFilterScriptViewModelFactory>();
mockItemFilterScriptViewModelFactory.Setup(f => f.Create()).Returns(mockItemFilterScriptViewModel.Object);
var repository = new ItemFilterScriptRepository(mockPersistenceService.Object, mockItemFilterScriptViewModelFactory.Object);
var repository = CreateItemFilterScriptRepository(itemFilterPersistenceService: mockPersistenceService.Object,
itemFilterScriptViewModelFactory: mockItemFilterScriptViewModelFactory.Object);
// Act
var result = await repository.LoadScriptFromFileAsync(testInputPath);
@@ -50,7 +53,8 @@ namespace Filtration.Tests.Repositories
var mockItemFilterScriptViewModelFactory = new Mock<IItemFilterScriptViewModelFactory>();
var repository = new ItemFilterScriptRepository(mockPersistenceService.Object, mockItemFilterScriptViewModelFactory.Object);
var repository = CreateItemFilterScriptRepository(itemFilterPersistenceService: mockPersistenceService.Object,
itemFilterScriptViewModelFactory: mockItemFilterScriptViewModelFactory.Object);
// Act
Func<Task<IItemFilterScriptViewModel>> result = async () => await repository.LoadScriptFromFileAsync(testInputPath);
@@ -70,7 +74,8 @@ namespace Filtration.Tests.Repositories
var mockItemFilterScriptViewModelFactory = new Mock<IItemFilterScriptViewModelFactory>();
var repository = new ItemFilterScriptRepository(mockPersistenceService.Object, mockItemFilterScriptViewModelFactory.Object);
var repository = CreateItemFilterScriptRepository(itemFilterPersistenceService: mockPersistenceService.Object,
itemFilterScriptViewModelFactory: mockItemFilterScriptViewModelFactory.Object);
// Act
repository.SetItemFilterScriptDirectory(testInputPath);
@@ -90,7 +95,8 @@ namespace Filtration.Tests.Repositories
var mockItemFilterScriptViewModelFactory = new Mock<IItemFilterScriptViewModelFactory>();
var repository = new ItemFilterScriptRepository(mockPersistenceService.Object, mockItemFilterScriptViewModelFactory.Object);
var repository = CreateItemFilterScriptRepository(itemFilterPersistenceService: mockPersistenceService.Object,
itemFilterScriptViewModelFactory: mockItemFilterScriptViewModelFactory.Object);
// Act
string result = repository.GetItemFilterScriptDirectory();
@@ -111,7 +117,8 @@ namespace Filtration.Tests.Repositories
var mockItemFilterScriptViewModelFactory = new Mock<IItemFilterScriptViewModelFactory>();
mockItemFilterScriptViewModelFactory.Setup(f => f.Create()).Returns(mockItemFilterScriptViewModel.Object);
var repository = new ItemFilterScriptRepository(mockPersistenceService.Object, mockItemFilterScriptViewModelFactory.Object);
var repository = CreateItemFilterScriptRepository(itemFilterPersistenceService: mockPersistenceService.Object,
itemFilterScriptViewModelFactory: mockItemFilterScriptViewModelFactory.Object);
// Act
IItemFilterScriptViewModel result = repository.NewScript();
@@ -119,5 +126,14 @@ namespace Filtration.Tests.Repositories
// Assert
Assert.AreEqual(mockItemFilterScriptViewModel.Object, result);
}
private ItemFilterScriptRepository CreateItemFilterScriptRepository(IItemFilterPersistenceService itemFilterPersistenceService = null,
IItemFilterScriptFactory itemFilterScriptFactory = null,
IItemFilterScriptViewModelFactory itemFilterScriptViewModelFactory = null)
{
return new ItemFilterScriptRepository(itemFilterPersistenceService ?? new Mock<IItemFilterPersistenceService>().Object,
itemFilterScriptFactory ?? new Mock<IItemFilterScriptFactory>().Object,
itemFilterScriptViewModelFactory ?? new Mock<IItemFilterScriptViewModelFactory>().Object);
}
}
}

View File

@@ -8,7 +8,7 @@
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="ControlzEx" publicKeyToken="f08b075e934b7045" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.1.2.3" newVersion="2.1.2.3" />
<bindingRedirect oldVersion="0.0.0.0-2.2.0.4" newVersion="2.2.0.4" />
</dependentAssembly>
</assemblyBinding>
</runtime>

View File

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

View File

@@ -35,13 +35,11 @@
<HintPath>..\packages\Castle.Core.3.3.3\lib\net45\Castle.Core.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Moq, Version=4.5.21.0, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
<HintPath>..\packages\Moq.4.5.21\lib\net45\Moq.dll</HintPath>
<Private>True</Private>
<Reference Include="Moq, Version=4.5.30.0, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
<HintPath>..\packages\Moq.4.5.30\lib\net45\Moq.dll</HintPath>
</Reference>
<Reference Include="nunit.framework, Version=3.4.1.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
<HintPath>..\packages\NUnit.3.4.1\lib\net45\nunit.framework.dll</HintPath>
<Private>True</Private>
<Reference Include="nunit.framework, Version=3.6.1.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
<HintPath>..\packages\NUnit.3.6.1\lib\net45\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="PresentationCore" />
<Reference Include="System" />

View File

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

View File

@@ -31,16 +31,15 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="AutoMapper, Version=4.2.1.0, Culture=neutral, PublicKeyToken=be96cd2c38ef1005, processorArchitecture=MSIL">
<HintPath>..\packages\AutoMapper.4.2.1\lib\net45\AutoMapper.dll</HintPath>
<Private>True</Private>
<Reference Include="AutoMapper, Version=6.0.2.0, Culture=neutral, PublicKeyToken=be96cd2c38ef1005, processorArchitecture=MSIL">
<HintPath>..\packages\AutoMapper.6.0.2\lib\net45\AutoMapper.dll</HintPath>
</Reference>
<Reference Include="Castle.Core, Version=3.3.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
<HintPath>..\packages\Castle.Core.3.3.3\lib\net45\Castle.Core.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Castle.Windsor">
<HintPath>..\packages\Castle.Windsor.3.3.0\lib\net45\Castle.Windsor.dll</HintPath>
<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="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>
@@ -58,8 +57,7 @@
<HintPath>..\packages\CommonServiceLocator.1.3\lib\portable-net4+sl5+netcore45+wpa81+wp8\Microsoft.Practices.ServiceLocation.dll</HintPath>
</Reference>
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\packages\NLog.4.3.7\lib\net45\NLog.dll</HintPath>
<Private>True</Private>
<HintPath>..\packages\NLog.4.4.9\lib\net45\NLog.dll</HintPath>
</Reference>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />

View File

@@ -11,8 +11,8 @@ namespace Filtration.ThemeEditor.Providers
{
public interface IThemeProvider
{
IThemeEditorViewModel NewThemeForScript(ItemFilterScript script);
IThemeEditorViewModel MasterThemeForScript(ItemFilterScript script);
IThemeEditorViewModel NewThemeForScript(IItemFilterScript script);
IThemeEditorViewModel MasterThemeForScript(IItemFilterScript script);
Task<IThemeEditorViewModel> LoadThemeFromFile(string filePath);
Task<Theme> LoadThemeModelFromFile(string filePath);
Task SaveThemeAsync(IThemeEditorViewModel themeEditorViewModel, string filePath);
@@ -29,7 +29,7 @@ namespace Filtration.ThemeEditor.Providers
_themePersistenceService = themePersistenceService;
}
public IThemeEditorViewModel NewThemeForScript(ItemFilterScript script)
public IThemeEditorViewModel NewThemeForScript(IItemFilterScript script)
{
var themeComponentCollection = script.ThemeComponents.Aggregate(new ThemeComponentCollection(),
(c, component) =>
@@ -45,7 +45,7 @@ namespace Filtration.ThemeEditor.Providers
return themeViewModel;
}
public IThemeEditorViewModel MasterThemeForScript(ItemFilterScript script)
public IThemeEditorViewModel MasterThemeForScript(IItemFilterScript script)
{
var themeViewModel = _themeViewModelFactory.Create();
themeViewModel.InitialiseForMasterTheme(script);

View File

@@ -12,7 +12,7 @@ namespace Filtration.ThemeEditor.Services
{
public interface IThemeService
{
void ApplyThemeToScript(Theme theme, ItemFilterScript script);
void ApplyThemeToScript(Theme theme, IItemFilterScript script);
}
public class ThemeService : IThemeService
@@ -24,7 +24,7 @@ namespace Filtration.ThemeEditor.Services
_messageBoxService = messageBoxService;
}
public void ApplyThemeToScript(Theme theme, ItemFilterScript script)
public void ApplyThemeToScript(Theme theme, IItemFilterScript script)
{
var mismatchedComponents = false;
foreach (var component in theme.Components)
@@ -44,7 +44,7 @@ namespace Filtration.ThemeEditor.Services
break;
}
foreach (var block in script.ItemFilterBlocks)
foreach (var block in script.ItemFilterBlocks.OfType<ItemFilterBlock>())
{
foreach (var blockItem in block.BlockItems.Where(i => i.GetType() == targetType))
{

View File

@@ -26,9 +26,9 @@ namespace Filtration.ThemeEditor.ViewModels
RelayCommand CloseCommand { get; }
void InitialiseForNewTheme(ThemeComponentCollection themeComponentCollection);
void InitialiseForMasterTheme(ItemFilterScript script);
void InitialiseForMasterTheme(IItemFilterScript script);
bool IsMasterTheme { get; }
ItemFilterScript IsMasterThemeForScript { get; }
IItemFilterScript IsMasterThemeForScript { get; }
string Title { get; }
string FilePath { get; set; }
string Filename { get; }
@@ -72,7 +72,7 @@ namespace Filtration.ThemeEditor.ViewModels
public bool IsMasterTheme => Components.IsMasterCollection;
public ItemFilterScript IsMasterThemeForScript { get; private set; }
public IItemFilterScript IsMasterThemeForScript { get; private set; }
public void InitialiseForNewTheme(ThemeComponentCollection themeComponentCollection)
{
@@ -80,7 +80,7 @@ namespace Filtration.ThemeEditor.ViewModels
_filenameIsFake = true;
}
public void InitialiseForMasterTheme(ItemFilterScript script)
public void InitialiseForMasterTheme(IItemFilterScript script)
{
Components = script.ThemeComponents;
IsMasterThemeForScript = script;

View File

@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="AutoMapper" version="4.2.1" targetFramework="net461" />
<package id="AutoMapper" version="6.0.2" targetFramework="net461" />
<package id="Castle.Core" version="3.3.3" targetFramework="net451" />
<package id="Castle.Windsor" version="3.3.0" targetFramework="net451" />
<package id="Castle.Windsor" version="3.4.0" targetFramework="net461" />
<package id="CommonServiceLocator" version="1.3" targetFramework="net451" />
<package id="Extended.Wpf.Toolkit" version="2.9" targetFramework="net461" />
<package id="MvvmLightLibs" version="5.3.0.0" targetFramework="net461" />
<package id="NLog" version="4.3.7" targetFramework="net461" />
<package id="NLog" version="4.4.9" targetFramework="net461" />
</packages>

View File

@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.24720.0
# Visual Studio 15
VisualStudioVersion = 15.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Filtration", "Filtration\Filtration.csproj", "{55E0A34C-E039-43D7-A024-A4045401CDDA}"
EndProject

View File

@@ -1,4 +1,5 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/CodeInspection/CodeAnnotations/NamespacesWithAnnotations/=Filtration_002EAnnotations/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/CodeAnnotations/NamespacesWithAnnotations/=Filtration_002EObjectModel_002EAnnotations/@EntryIndexedValue">True</s:Boolean>
<s:String x:Key="/Default/FilterSettingsManager/AttributeFilterXml/@EntryValue">&lt;data /&gt;</s:String>
<s:String x:Key="/Default/FilterSettingsManager/CoverageFilterXml/@EntryValue">&lt;data&gt;&lt;IncludeFilters /&gt;&lt;ExcludeFilters&gt;&lt;Filter ModuleMask="Filtration.ItemFilterPreview.Tests" ModuleVersionMask="*" ClassMask="*" FunctionMask="*" IsEnabled="True" /&gt;&lt;Filter ModuleMask="Filtration.ObjectModel.Tests" ModuleVersionMask="*" ClassMask="*" FunctionMask="*" IsEnabled="True" /&gt;&lt;Filter ModuleMask="Filtration.ThemeEditor.Tests" ModuleVersionMask="*" ClassMask="*" FunctionMask="*" IsEnabled="True" /&gt;&lt;Filter ModuleMask="Filtration.Tests" ModuleVersionMask="*" ClassMask="*" FunctionMask="*" IsEnabled="True" /&gt;&lt;/ExcludeFilters&gt;&lt;/data&gt;</s:String></wpf:ResourceDictionary>

View File

@@ -41,7 +41,7 @@
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="ControlzEx" publicKeyToken="f08b075e934b7045" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.1.2.3" newVersion="2.1.2.3" />
<bindingRedirect oldVersion="0.0.0.0-2.2.0.4" newVersion="2.2.0.4" />
</dependentAssembly>
</assemblyBinding>
</runtime>

View File

@@ -45,6 +45,9 @@
<converters:BooleanToBlockActionInverseConverter x:Key="BooleanToBlockActionInverseConverter" />
<converters:AvailableThemeComponentsConverter x:Key="AvailableThemeComponentsConverter" />
</ResourceDictionary>
<ResourceDictionary>
<RoutedCommand x:Key="OpenScriptRoutedCommand" />
</ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>

View File

@@ -41,29 +41,13 @@ namespace Filtration
_container.Install(FromAssembly.InThisApplication());
_container.Install(FromAssembly.Named("Filtration.Parser")); // Not directly referenced so manually call its installers
Mapper.Configuration.ConstructServicesUsing(_container.Resolve);
Mapper.CreateMap<ItemFilterBlockGroup, ItemFilterBlockGroupViewModel>()
.ForMember(destination => destination.ChildGroups, options => options.ResolveUsing(
delegate(ResolutionResult resolutionResult)
Mapper.Initialize(cfg =>
{
var context = resolutionResult.Context;
var showAdvanced = (bool) context.Options.Items["showAdvanced"];
var group = (ItemFilterBlockGroup) context.SourceValue;
if (showAdvanced)
return group.ChildGroups;
else
return group.ChildGroups.Where(c => c.Advanced == false);
}))
.ForMember(dest => dest.SourceBlockGroup,
opts => opts.MapFrom(from => from))
.ForMember(dest => dest.IsExpanded,
opts => opts.UseValue(false));
Mapper.CreateMap<Theme, IThemeEditorViewModel>().ConstructUsingServiceLocator();
Mapper.CreateMap<ThemeComponent, ThemeComponentViewModel>().ReverseMap();
Mapper.CreateMap<IThemeEditorViewModel, Theme>();
cfg.ConstructServicesUsing(_container.Resolve);
cfg.CreateMap<Theme, IThemeEditorViewModel>().ConstructUsingServiceLocator();
cfg.CreateMap<ThemeComponent, ThemeComponentViewModel>().ReverseMap();
cfg.CreateMap<IThemeEditorViewModel, Theme>();
});
Mapper.AssertConfigurationIsValid();

View File

@@ -15,6 +15,21 @@
<WarningLevel>4</WarningLevel>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<TargetFrameworkProfile />
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
@@ -42,20 +57,18 @@
<ApplicationIcon>Resources\filtration.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="AutoMapper, Version=4.2.1.0, Culture=neutral, PublicKeyToken=be96cd2c38ef1005, processorArchitecture=MSIL">
<HintPath>..\packages\AutoMapper.4.2.1\lib\net45\AutoMapper.dll</HintPath>
<Private>True</Private>
<Reference Include="AutoMapper, Version=6.0.2.0, Culture=neutral, PublicKeyToken=be96cd2c38ef1005, processorArchitecture=MSIL">
<HintPath>..\packages\AutoMapper.6.0.2\lib\net45\AutoMapper.dll</HintPath>
</Reference>
<Reference Include="Castle.Core, Version=3.3.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
<HintPath>..\packages\Castle.Core.3.3.3\lib\net45\Castle.Core.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Castle.Windsor">
<HintPath>..\packages\Castle.Windsor.3.3.0\lib\net45\Castle.Windsor.dll</HintPath>
<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="ControlzEx, Version=2.1.2.3, Culture=neutral, PublicKeyToken=f08b075e934b7045, processorArchitecture=MSIL">
<HintPath>..\packages\ControlzEx.2.1.2.3\lib\net45\ControlzEx.dll</HintPath>
<Private>True</Private>
<Reference Include="ControlzEx, Version=2.2.0.4, Culture=neutral, PublicKeyToken=f08b075e934b7045, processorArchitecture=MSIL">
<HintPath>..\packages\ControlzEx.2.2.0.4\lib\net45\ControlzEx.dll</HintPath>
</Reference>
<Reference Include="Fluent, Version=4.0.3.394, Culture=neutral, PublicKeyToken=3e436e32a8c5546f, processorArchitecture=MSIL">
<HintPath>..\packages\Fluent.Ribbon.4.0.3.394\lib\net45\Fluent.dll</HintPath>
@@ -79,8 +92,7 @@
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\packages\NLog.4.3.7\lib\net45\NLog.dll</HintPath>
<Private>True</Private>
<HintPath>..\packages\NLog.4.4.9\lib\net45\NLog.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Drawing" />
@@ -94,8 +106,7 @@
</Reference>
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\ControlzEx.2.1.2.3\lib\net45\System.Windows.Interactivity.dll</HintPath>
<Private>True</Private>
<HintPath>..\packages\ControlzEx.2.2.0.4\lib\net45\System.Windows.Interactivity.dll</HintPath>
</Reference>
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
@@ -185,19 +196,23 @@
<Compile Include="UserControls\ThemeComponentSelectionControl.xaml.cs">
<DependentUpon>ThemeComponentSelectionControl.xaml</DependentUpon>
</Compile>
<Compile Include="Utilities\AutoMapperHelpers.cs" />
<Compile Include="Utilities\BlockGroupMapper.cs" />
<Compile Include="Utility\RoutedCommandHandler.cs" />
<Compile Include="Utility\RoutedCommandHandlers.cs" />
<Compile Include="ViewModels\AvalonDockWorkspaceViewModel.cs" />
<Compile Include="ViewModels\Factories\IItemFilterCommentBlockViewModelFactory.cs" />
<Compile Include="ViewModels\Factories\ItemFilterBlockBaseViewModelFactory.cs" />
<Compile Include="ViewModels\ItemFilterBlockViewModelBase.cs" />
<Compile Include="ViewModels\ItemFilterCommentBlockViewModel.cs" />
<Compile Include="ViewModels\SettingsPageViewModel.cs" />
<Compile Include="ViewModels\ToolPanes\BlockGroupBrowserViewModel.cs" />
<Compile Include="ViewModels\IItemFilterScriptViewModelFactory.cs" />
<Compile Include="ViewModels\IItemFilterBlockViewModelFactory.cs" />
<Compile Include="ViewModels\Factories\IItemFilterScriptViewModelFactory.cs" />
<Compile Include="ViewModels\Factories\IItemFilterBlockViewModelFactory.cs" />
<Compile Include="ViewModels\ItemFilterBlockGroupViewModel.cs" />
<Compile Include="ViewModels\ItemFilterBlockViewModel.cs" />
<Compile Include="ViewModels\ItemFilterScriptViewModel.cs" />
<Compile Include="ViewModels\ToolPanes\BlockOutputPreviewViewModel.cs" />
<Compile Include="ViewModels\ReplaceColorsViewModel.cs" />
<Compile Include="ViewModels\ToolPanes\SectionBrowserViewModel.cs" />
<Compile Include="ViewModels\ToolPanes\CommentBlockBrowserViewModel.cs" />
<Compile Include="ViewModels\StartPageViewModel.cs" />
<Compile Include="ViewModels\ToolPanes\ToolViewModel.cs" />
<Compile Include="ViewModels\UpdateAvailableViewModel.cs" />
@@ -226,7 +241,6 @@
<Compile Include="Views\ToolPanes\BlockGroupBrowserView.xaml.cs">
<DependentUpon>BlockGroupBrowserView.xaml</DependentUpon>
</Compile>
<Compile Include="Views\BlockTemplateSelector.cs" />
<Compile Include="Views\ItemFilterScriptView.xaml.cs">
<DependentUpon>ItemFilterScriptView.xaml</DependentUpon>
</Compile>
@@ -236,8 +250,8 @@
<Compile Include="UserControls\NumericFilterPredicateControl.xaml.cs">
<DependentUpon>NumericFilterPredicateControl.xaml</DependentUpon>
</Compile>
<Compile Include="Views\ItemFilterSectionView.xaml.cs">
<DependentUpon>ItemFilterSectionView.xaml</DependentUpon>
<Compile Include="Views\ItemFilterCommentBlockView.xaml.cs">
<DependentUpon>ItemFilterCommentBlockView.xaml</DependentUpon>
</Compile>
<Compile Include="Views\AboutWindow.xaml.cs">
<DependentUpon>AboutWindow.xaml</DependentUpon>
@@ -251,12 +265,12 @@
<Compile Include="Views\ToolPanes\BlockOutputPreviewView.xaml.cs">
<DependentUpon>BlockOutputPreviewView.xaml</DependentUpon>
</Compile>
<Compile Include="Views\ToolPanes\SectionBrowserView.xaml.cs">
<DependentUpon>SectionBrowserView.xaml</DependentUpon>
</Compile>
<Compile Include="Views\StartPageView.xaml.cs">
<DependentUpon>StartPageView.xaml</DependentUpon>
</Compile>
<Compile Include="Views\ToolPanes\CommentBlockBrowserView.xaml.cs">
<DependentUpon>CommentBlockBrowserView.xaml</DependentUpon>
</Compile>
<Compile Include="Views\UpdateAvailableView.xaml.cs">
<DependentUpon>UpdateAvailableView.xaml</DependentUpon>
</Compile>
@@ -316,7 +330,7 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\ToolPanes\SectionBrowserView.xaml">
<Page Include="Views\ToolPanes\CommentBlockBrowserView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
@@ -328,7 +342,7 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\ItemFilterSectionView.xaml">
<Page Include="Views\ItemFilterCommentBlockView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
@@ -409,9 +423,6 @@
<Resource Include="Resources\groundtile.png" />
</ItemGroup>
<ItemGroup>
<Content Include="Resources\AlertSounds\AlertSound8.wav">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Resource Include="Resources\logo.png" />
<Resource Include="Resources\Icons\add_block_icon.png" />
<Resource Include="Resources\Icons\add_section_icon.png" />
@@ -447,49 +458,89 @@
<Resource Include="Resources\Icons\ThemeComponentDelete.ico" />
<Resource Include="Resources\Icons\standby_disabled_icon.png" />
<Resource Include="Resources\Icons\standby_enabled_icon.png" />
<None Include="Resources\AlertSounds\AlertSound_01.wav">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Resources\AlertSounds\AlertSound_02.wav">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Resources\AlertSounds\AlertSound_03.wav">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Resources\AlertSounds\AlertSound_04.wav">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Resources\AlertSounds\AlertSound_05.wav">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Resources\AlertSounds\AlertSound_06.wav">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Resources\AlertSounds\AlertSound_07.wav">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Resources\AlertSounds\AlertSound_08.wav">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Resources\AlertSounds\AlertSound_09.wav">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Resources\AlertSounds\AlertSound_10.wav">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Resources\AlertSounds\AlertSound_11.wav">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Resources\AlertSounds\AlertSound_12.wav">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Resources\AlertSounds\AlertSound_13.wav">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Resources\AlertSounds\AlertSound_14.wav">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Resources\AlertSounds\AlertSound_15.wav">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Resources\AlertSounds\AlertSound_16.wav">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Resources\AlertSounds\SH22Alchemy.wav">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Resources\AlertSounds\SH22Blessed.wav">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Resources\AlertSounds\SH22Chaos.wav">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Resources\AlertSounds\SH22Divine.wav">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Resources\AlertSounds\SH22Exalted.wav">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Resources\AlertSounds\SH22Fusing.wav">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Resources\AlertSounds\SH22General.wav">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Resources\AlertSounds\SH22Mirror.wav">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Resources\AlertSounds\SH22Regal.wav">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Resources\AlertSounds\SH22Vaal.wav">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<Resource Include="Resources\Icons\redo_icon.png" />
<Resource Include="Resources\Icons\undo_icon.png" />
<Content Include="Resources\ItemBaseTypes.txt" />
<Content Include="Resources\ItemClasses.txt" />
</ItemGroup>
<ItemGroup>
<Content Include="Resources\AlertSounds\AlertSound9.wav">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<Content Include="Resources\AlertSounds\AlertSound7.wav">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<Content Include="Resources\AlertSounds\AlertSound6.wav">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<Content Include="Resources\AlertSounds\AlertSound4.wav">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<Content Include="Resources\AlertSounds\AlertSound5.wav">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<Content Include="Resources\AlertSounds\AlertSound2.wav">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<Content Include="Resources\AlertSounds\AlertSound3.wav">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<Content Include="Resources\AlertSounds\AlertSound1.wav">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Filtration.Common\Filtration.Common.csproj">
<Project>{8cb44f28-2956-4c2a-9314-72727262edd4}</Project>
@@ -519,6 +570,18 @@
<ItemGroup>
<Folder Include="Translators\" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.6.1">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4.6.1 %28x86 and x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(XamlSpyInstallPath)MSBuild\FirstFloor.XamlSpy.WPF.targets" Condition="'$(XamlSpyInstallPath)' != '' and '$(Configuration)' == 'DEBUG'" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.

File diff suppressed because it is too large Load Diff

View File

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

View File

@@ -19,7 +19,7 @@ namespace Filtration.Properties {
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
@@ -63,81 +63,144 @@ namespace Filtration.Properties {
/// <summary>
/// Looks up a localized resource of type System.IO.UnmanagedMemoryStream similar to System.IO.MemoryStream.
/// </summary>
internal static System.IO.UnmanagedMemoryStream AlertSound1 {
internal static System.IO.UnmanagedMemoryStream AlertSound_01 {
get {
return ResourceManager.GetStream("AlertSound1", resourceCulture);
return ResourceManager.GetStream("AlertSound_01", resourceCulture);
}
}
/// <summary>
/// Looks up a localized resource of type System.IO.UnmanagedMemoryStream similar to System.IO.MemoryStream.
/// </summary>
internal static System.IO.UnmanagedMemoryStream AlertSound2 {
internal static System.IO.UnmanagedMemoryStream AlertSound_02 {
get {
return ResourceManager.GetStream("AlertSound2", resourceCulture);
return ResourceManager.GetStream("AlertSound_02", resourceCulture);
}
}
/// <summary>
/// Looks up a localized resource of type System.IO.UnmanagedMemoryStream similar to System.IO.MemoryStream.
/// </summary>
internal static System.IO.UnmanagedMemoryStream AlertSound3 {
internal static System.IO.UnmanagedMemoryStream AlertSound_03 {
get {
return ResourceManager.GetStream("AlertSound3", resourceCulture);
return ResourceManager.GetStream("AlertSound_03", resourceCulture);
}
}
/// <summary>
/// Looks up a localized resource of type System.IO.UnmanagedMemoryStream similar to System.IO.MemoryStream.
/// </summary>
internal static System.IO.UnmanagedMemoryStream AlertSound4 {
internal static System.IO.UnmanagedMemoryStream AlertSound_04 {
get {
return ResourceManager.GetStream("AlertSound4", resourceCulture);
return ResourceManager.GetStream("AlertSound_04", resourceCulture);
}
}
/// <summary>
/// Looks up a localized resource of type System.IO.UnmanagedMemoryStream similar to System.IO.MemoryStream.
/// </summary>
internal static System.IO.UnmanagedMemoryStream AlertSound5 {
internal static System.IO.UnmanagedMemoryStream AlertSound_05 {
get {
return ResourceManager.GetStream("AlertSound5", resourceCulture);
return ResourceManager.GetStream("AlertSound_05", resourceCulture);
}
}
/// <summary>
/// Looks up a localized resource of type System.IO.UnmanagedMemoryStream similar to System.IO.MemoryStream.
/// </summary>
internal static System.IO.UnmanagedMemoryStream AlertSound6 {
internal static System.IO.UnmanagedMemoryStream AlertSound_06 {
get {
return ResourceManager.GetStream("AlertSound6", resourceCulture);
return ResourceManager.GetStream("AlertSound_06", resourceCulture);
}
}
/// <summary>
/// Looks up a localized resource of type System.IO.UnmanagedMemoryStream similar to System.IO.MemoryStream.
/// </summary>
internal static System.IO.UnmanagedMemoryStream AlertSound7 {
internal static System.IO.UnmanagedMemoryStream AlertSound_07 {
get {
return ResourceManager.GetStream("AlertSound7", resourceCulture);
return ResourceManager.GetStream("AlertSound_07", resourceCulture);
}
}
/// <summary>
/// Looks up a localized resource of type System.IO.UnmanagedMemoryStream similar to System.IO.MemoryStream.
/// </summary>
internal static System.IO.UnmanagedMemoryStream AlertSound8 {
internal static System.IO.UnmanagedMemoryStream AlertSound_08 {
get {
return ResourceManager.GetStream("AlertSound8", resourceCulture);
return ResourceManager.GetStream("AlertSound_08", resourceCulture);
}
}
/// <summary>
/// Looks up a localized resource of type System.IO.UnmanagedMemoryStream similar to System.IO.MemoryStream.
/// </summary>
internal static System.IO.UnmanagedMemoryStream AlertSound9 {
internal static System.IO.UnmanagedMemoryStream AlertSound_09 {
get {
return ResourceManager.GetStream("AlertSound9", resourceCulture);
return ResourceManager.GetStream("AlertSound_09", resourceCulture);
}
}
/// <summary>
/// Looks up a localized resource of type System.IO.UnmanagedMemoryStream similar to System.IO.MemoryStream.
/// </summary>
internal static System.IO.UnmanagedMemoryStream AlertSound_10 {
get {
return ResourceManager.GetStream("AlertSound_10", resourceCulture);
}
}
/// <summary>
/// Looks up a localized resource of type System.IO.UnmanagedMemoryStream similar to System.IO.MemoryStream.
/// </summary>
internal static System.IO.UnmanagedMemoryStream AlertSound_11 {
get {
return ResourceManager.GetStream("AlertSound_11", resourceCulture);
}
}
/// <summary>
/// Looks up a localized resource of type System.IO.UnmanagedMemoryStream similar to System.IO.MemoryStream.
/// </summary>
internal static System.IO.UnmanagedMemoryStream AlertSound_12 {
get {
return ResourceManager.GetStream("AlertSound_12", resourceCulture);
}
}
/// <summary>
/// Looks up a localized resource of type System.IO.UnmanagedMemoryStream similar to System.IO.MemoryStream.
/// </summary>
internal static System.IO.UnmanagedMemoryStream AlertSound_13 {
get {
return ResourceManager.GetStream("AlertSound_13", resourceCulture);
}
}
/// <summary>
/// Looks up a localized resource of type System.IO.UnmanagedMemoryStream similar to System.IO.MemoryStream.
/// </summary>
internal static System.IO.UnmanagedMemoryStream AlertSound_14 {
get {
return ResourceManager.GetStream("AlertSound_14", resourceCulture);
}
}
/// <summary>
/// Looks up a localized resource of type System.IO.UnmanagedMemoryStream similar to System.IO.MemoryStream.
/// </summary>
internal static System.IO.UnmanagedMemoryStream AlertSound_15 {
get {
return ResourceManager.GetStream("AlertSound_15", resourceCulture);
}
}
/// <summary>
/// Looks up a localized resource of type System.IO.UnmanagedMemoryStream similar to System.IO.MemoryStream.
/// </summary>
internal static System.IO.UnmanagedMemoryStream AlertSound_16 {
get {
return ResourceManager.GetStream("AlertSound_16", resourceCulture);
}
}
@@ -160,5 +223,95 @@ namespace Filtration.Properties {
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.IO.UnmanagedMemoryStream similar to System.IO.MemoryStream.
/// </summary>
internal static System.IO.UnmanagedMemoryStream SH22Alchemy {
get {
return ResourceManager.GetStream("SH22Alchemy", resourceCulture);
}
}
/// <summary>
/// Looks up a localized resource of type System.IO.UnmanagedMemoryStream similar to System.IO.MemoryStream.
/// </summary>
internal static System.IO.UnmanagedMemoryStream SH22Blessed {
get {
return ResourceManager.GetStream("SH22Blessed", resourceCulture);
}
}
/// <summary>
/// Looks up a localized resource of type System.IO.UnmanagedMemoryStream similar to System.IO.MemoryStream.
/// </summary>
internal static System.IO.UnmanagedMemoryStream SH22Chaos {
get {
return ResourceManager.GetStream("SH22Chaos", resourceCulture);
}
}
/// <summary>
/// Looks up a localized resource of type System.IO.UnmanagedMemoryStream similar to System.IO.MemoryStream.
/// </summary>
internal static System.IO.UnmanagedMemoryStream SH22Divine {
get {
return ResourceManager.GetStream("SH22Divine", resourceCulture);
}
}
/// <summary>
/// Looks up a localized resource of type System.IO.UnmanagedMemoryStream similar to System.IO.MemoryStream.
/// </summary>
internal static System.IO.UnmanagedMemoryStream SH22Exalted {
get {
return ResourceManager.GetStream("SH22Exalted", resourceCulture);
}
}
/// <summary>
/// Looks up a localized resource of type System.IO.UnmanagedMemoryStream similar to System.IO.MemoryStream.
/// </summary>
internal static System.IO.UnmanagedMemoryStream SH22Fusing {
get {
return ResourceManager.GetStream("SH22Fusing", resourceCulture);
}
}
/// <summary>
/// Looks up a localized resource of type System.IO.UnmanagedMemoryStream similar to System.IO.MemoryStream.
/// </summary>
internal static System.IO.UnmanagedMemoryStream SH22General {
get {
return ResourceManager.GetStream("SH22General", resourceCulture);
}
}
/// <summary>
/// Looks up a localized resource of type System.IO.UnmanagedMemoryStream similar to System.IO.MemoryStream.
/// </summary>
internal static System.IO.UnmanagedMemoryStream SH22Mirror {
get {
return ResourceManager.GetStream("SH22Mirror", resourceCulture);
}
}
/// <summary>
/// Looks up a localized resource of type System.IO.UnmanagedMemoryStream similar to System.IO.MemoryStream.
/// </summary>
internal static System.IO.UnmanagedMemoryStream SH22Regal {
get {
return ResourceManager.GetStream("SH22Regal", resourceCulture);
}
}
/// <summary>
/// Looks up a localized resource of type System.IO.UnmanagedMemoryStream similar to System.IO.MemoryStream.
/// </summary>
internal static System.IO.UnmanagedMemoryStream SH22Vaal {
get {
return ResourceManager.GetStream("SH22Vaal", resourceCulture);
}
}
}
}

View File

@@ -118,32 +118,53 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="AlertSound1" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\AlertSounds\AlertSound1.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<data name="AlertSound_01" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\AlertSounds\AlertSound_01.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="AlertSound2" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\AlertSounds\AlertSound2.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<data name="AlertSound_02" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\AlertSounds\AlertSound_02.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="AlertSound3" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\AlertSounds\AlertSound3.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<data name="AlertSound_03" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\AlertSounds\AlertSound_03.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="AlertSound4" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\AlertSounds\AlertSound4.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<data name="AlertSound_04" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\AlertSounds\AlertSound_04.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="AlertSound5" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\AlertSounds\AlertSound5.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<data name="AlertSound_05" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\AlertSounds\AlertSound_05.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="AlertSound6" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\AlertSounds\AlertSound6.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<data name="AlertSound_06" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\AlertSounds\AlertSound_06.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="AlertSound7" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\AlertSounds\AlertSound7.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<data name="AlertSound_07" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\AlertSounds\AlertSound_07.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="AlertSound8" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\AlertSounds\AlertSound8.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<data name="AlertSound_08" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\AlertSounds\AlertSound_08.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="AlertSound9" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\AlertSounds\AlertSound9.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<data name="AlertSound_09" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\AlertSounds\AlertSound_09.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="AlertSound_10" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\AlertSounds\AlertSound_10.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="AlertSound_11" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\AlertSounds\AlertSound_11.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="AlertSound_12" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\AlertSounds\AlertSound_12.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="AlertSound_13" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\AlertSounds\AlertSound_13.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="AlertSound_14" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\AlertSounds\AlertSound_14.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="AlertSound_15" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\AlertSounds\AlertSound_15.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="AlertSound_16" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\AlertSounds\AlertSound_16.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="Fontin_SmallCaps" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Fontin-SmallCaps.ttf;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
@@ -151,4 +172,34 @@
<data name="groundtile" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\groundtile.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="SH22Alchemy" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\AlertSounds\SH22Alchemy.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="SH22Blessed" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\AlertSounds\SH22Blessed.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="SH22Chaos" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\AlertSounds\SH22Chaos.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="SH22Divine" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\AlertSounds\SH22Divine.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="SH22Exalted" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\AlertSounds\SH22Exalted.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="SH22Fusing" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\AlertSounds\SH22Fusing.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="SH22General" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\AlertSounds\SH22General.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="SH22Mirror" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\AlertSounds\SH22Mirror.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="SH22Regal" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\AlertSounds\SH22Regal.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="SH22Vaal" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\AlertSounds\SH22Vaal.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
</root>

View File

@@ -1,7 +1,9 @@
using System.Threading.Tasks;
using Filtration.ObjectModel;
using Filtration.ObjectModel.Factories;
using Filtration.Services;
using Filtration.ViewModels;
using Filtration.ViewModels.Factories;
namespace Filtration.Repositories
{
@@ -16,12 +18,15 @@ namespace Filtration.Repositories
internal class ItemFilterScriptRepository : IItemFilterScriptRepository
{
private readonly IItemFilterPersistenceService _itemFilterPersistenceService;
private readonly IItemFilterScriptFactory _itemFilterScriptFactory;
private readonly IItemFilterScriptViewModelFactory _itemFilterScriptViewModelFactory;
public ItemFilterScriptRepository(IItemFilterPersistenceService itemFilterPersistenceService,
IItemFilterScriptFactory itemFilterScriptFactory,
IItemFilterScriptViewModelFactory itemFilterScriptViewModelFactory)
{
_itemFilterPersistenceService = itemFilterPersistenceService;
_itemFilterScriptFactory = itemFilterScriptFactory;
_itemFilterScriptViewModelFactory = itemFilterScriptViewModelFactory;
}
@@ -37,7 +42,7 @@ namespace Filtration.Repositories
public IItemFilterScriptViewModel NewScript()
{
var newScript = new ItemFilterScript();
var newScript = _itemFilterScriptFactory.Create();
var newViewModel = _itemFilterScriptViewModelFactory.Create();
newViewModel.Initialise(newScript, true);

Some files were not shown because too many files have changed in this diff Show More