Compare commits
79 Commits
0.2
...
LootExplos
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b97e3d1780 | ||
|
|
543446b23e | ||
|
|
2278cbdc3a | ||
|
|
45edbecd64 | ||
|
|
6e71005e93 | ||
|
|
56e163e3e0 | ||
|
|
c856bbcee7 | ||
|
|
490496f2f7 | ||
|
|
9fcb609a51 | ||
|
|
1b63f68eee | ||
|
|
a496ab9b42 | ||
|
|
cbbc7c25fa | ||
|
|
d6bd1678b4 | ||
|
|
bfa2341ab8 | ||
|
|
511f503e88 | ||
|
|
3ea0530c01 | ||
|
|
aad34b1407 | ||
|
|
544b931477 | ||
|
|
f5dcdf0af9 | ||
|
|
da3759cd76 | ||
|
|
d586492de8 | ||
|
|
3337531161 | ||
|
|
0c470b3c97 | ||
|
|
3a60a5005b | ||
|
|
8b6207e334 | ||
|
|
fea6bf6da2 | ||
|
|
b6d1befd23 | ||
|
|
2475d90bac | ||
|
|
aae014b6e0 | ||
|
|
aadd56c473 | ||
|
|
8f533e8fd7 | ||
|
|
272b7e8360 | ||
|
|
2d448ed850 | ||
|
|
bf4781dbde | ||
|
|
b889f1ef9a | ||
|
|
45b9d87ddb | ||
|
|
eb054a5068 | ||
|
|
30498f08eb | ||
|
|
121681906d | ||
|
|
526350e389 | ||
|
|
0bc3cac585 | ||
|
|
c3d11da155 | ||
|
|
440254f3f8 | ||
|
|
3a628df744 | ||
|
|
c3a40b3412 | ||
|
|
965627d587 | ||
|
|
4e77075182 | ||
|
|
dce21d84b3 | ||
|
|
5b4c622345 | ||
|
|
71ad5f2d05 | ||
|
|
aa5cedcbba | ||
|
|
cc05945108 | ||
|
|
e53e24100f | ||
|
|
4faa12474a | ||
|
|
1ba3b3f850 | ||
|
|
c6f5dcda39 | ||
|
|
1be6fe9e7b | ||
|
|
29ed02e172 | ||
|
|
e3505b3575 | ||
|
|
0eafd59e79 | ||
|
|
692269ddb3 | ||
|
|
72e9caec29 | ||
|
|
e25fbe67eb | ||
|
|
c80d4825df | ||
|
|
e07e7eeb3e | ||
|
|
8119018f33 | ||
|
|
e0a660fec6 | ||
|
|
08d9cf277b | ||
|
|
08a193dc6b | ||
|
|
aa433ad685 | ||
|
|
3ee7e1cc2a | ||
|
|
6d9edbda98 | ||
|
|
f4eaba016f | ||
|
|
92eb8cec01 | ||
|
|
41ecdf325c | ||
|
|
7b0e83b9ae | ||
|
|
d48f7a58ec | ||
|
|
4db27cdfbd | ||
|
|
f7512f9f8b |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -187,3 +187,4 @@ FakesAssemblies/
|
|||||||
GeneratedArtifacts/
|
GeneratedArtifacts/
|
||||||
_Pvt_Extensions/
|
_Pvt_Extensions/
|
||||||
ModelManifest.xml
|
ModelManifest.xml
|
||||||
|
/Releases
|
||||||
|
|||||||
61
Filtration.Common.Tests/Filtration.Common.Tests.csproj
Normal file
61
Filtration.Common.Tests/Filtration.Common.Tests.csproj
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ProjectGuid>{1E42A658-45C4-4DD9-83C5-2A10728DBDFA}</ProjectGuid>
|
||||||
|
<OutputType>Library</OutputType>
|
||||||
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
|
<RootNamespace>Filtration.Common.Tests</RootNamespace>
|
||||||
|
<AssemblyName>Filtration.Common.Tests</AssemblyName>
|
||||||
|
<TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
|
||||||
|
<FileAlignment>512</FileAlignment>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>bin\Debug\</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\Release\</OutputPath>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="Moq">
|
||||||
|
<HintPath>..\packages\Moq.4.2.1506.2515\lib\net40\Moq.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="nunit.framework">
|
||||||
|
<HintPath>..\packages\NUnit.2.6.4\lib\nunit.framework.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="System.Xml.Linq" />
|
||||||
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
|
<Reference Include="Microsoft.CSharp" />
|
||||||
|
<Reference Include="System.Data" />
|
||||||
|
<Reference Include="System.Xml" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="packages.config" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
|
<Target Name="BeforeBuild">
|
||||||
|
</Target>
|
||||||
|
<Target Name="AfterBuild">
|
||||||
|
</Target>
|
||||||
|
-->
|
||||||
|
</Project>
|
||||||
36
Filtration.Common.Tests/Properties/AssemblyInfo.cs
Normal file
36
Filtration.Common.Tests/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
// General Information about an assembly is controlled through the following
|
||||||
|
// set of attributes. Change these attribute values to modify the information
|
||||||
|
// associated with an assembly.
|
||||||
|
[assembly: AssemblyTitle("Filtration.Common.Tests")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("Microsoft")]
|
||||||
|
[assembly: AssemblyProduct("Filtration.Common.Tests")]
|
||||||
|
[assembly: AssemblyCopyright("Copyright © Microsoft 2015")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
// Setting ComVisible to false makes the types in this assembly not visible
|
||||||
|
// to COM components. If you need to access a type in this assembly from
|
||||||
|
// COM, set the ComVisible attribute to true on that type.
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||||
|
[assembly: Guid("23ba4e1b-1cb6-47fc-9a8b-6ce61fc3eb32")]
|
||||||
|
|
||||||
|
// Version information for an assembly consists of the following four values:
|
||||||
|
//
|
||||||
|
// Major Version
|
||||||
|
// Minor Version
|
||||||
|
// Build Number
|
||||||
|
// Revision
|
||||||
|
//
|
||||||
|
// 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("1.0.0.0")]
|
||||||
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||||
5
Filtration.Common.Tests/packages.config
Normal file
5
Filtration.Common.Tests/packages.config
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<packages>
|
||||||
|
<package id="Moq" version="4.2.1506.2515" targetFramework="net451" />
|
||||||
|
<package id="NUnit" version="2.6.4" targetFramework="net451" />
|
||||||
|
</packages>
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Windows.Data;
|
using System.Windows.Data;
|
||||||
|
|
||||||
namespace Filtration.Converters
|
namespace Filtration.Common.Converters
|
||||||
{
|
{
|
||||||
internal class BoolInverterConverter : IValueConverter
|
internal class BoolInverterConverter : IValueConverter
|
||||||
{
|
{
|
||||||
43
Filtration.Common/Converters/BooleanVisibilityConverter.cs
Normal file
43
Filtration.Common/Converters/BooleanVisibilityConverter.cs
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
using System;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Data;
|
||||||
|
|
||||||
|
namespace Filtration.Common.Converters
|
||||||
|
{
|
||||||
|
public class BooleanVisibilityConverter : IValueConverter
|
||||||
|
{
|
||||||
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
if (value is bool && targetType == typeof (Visibility))
|
||||||
|
{
|
||||||
|
var val = (bool) value;
|
||||||
|
if (val)
|
||||||
|
{
|
||||||
|
return Visibility.Visible;
|
||||||
|
}
|
||||||
|
if (parameter is Visibility)
|
||||||
|
{
|
||||||
|
return parameter;
|
||||||
|
}
|
||||||
|
return Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
if (value != null)
|
||||||
|
{
|
||||||
|
return Visibility.Visible;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (parameter is Visibility)
|
||||||
|
{
|
||||||
|
return parameter;
|
||||||
|
}
|
||||||
|
return Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
|
||||||
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
using System.Windows.Data;
|
using System.Windows.Data;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
|
|
||||||
namespace Filtration.Converters
|
namespace Filtration.Common.Converters
|
||||||
{
|
{
|
||||||
public class ColorToSolidColorBrushConverter : IValueConverter
|
public class ColorToSolidColorBrushConverter : IValueConverter
|
||||||
{
|
{
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
using System;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Data;
|
||||||
|
|
||||||
|
namespace Filtration.Common.Converters
|
||||||
|
{
|
||||||
|
internal class InverseBooleanVisibilityConverter : IValueConverter
|
||||||
|
{
|
||||||
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
if (value is bool && targetType == typeof (Visibility))
|
||||||
|
{
|
||||||
|
var val = (bool) value;
|
||||||
|
if (val)
|
||||||
|
{
|
||||||
|
return Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
if (parameter is Visibility)
|
||||||
|
{
|
||||||
|
return parameter;
|
||||||
|
}
|
||||||
|
return Visibility.Visible;
|
||||||
|
}
|
||||||
|
if (value != null)
|
||||||
|
{
|
||||||
|
return Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (parameter is Visibility)
|
||||||
|
{
|
||||||
|
return parameter;
|
||||||
|
}
|
||||||
|
return Visibility.Visible;
|
||||||
|
}
|
||||||
|
|
||||||
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,7 +3,7 @@ using System.Globalization;
|
|||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Data;
|
using System.Windows.Data;
|
||||||
|
|
||||||
namespace Filtration.Converters
|
namespace Filtration.Common.Converters
|
||||||
{
|
{
|
||||||
internal class StringToVisibilityConverter : IValueConverter
|
internal class StringToVisibilityConverter : IValueConverter
|
||||||
{
|
{
|
||||||
103
Filtration.Common/Filtration.Common.csproj
Normal file
103
Filtration.Common/Filtration.Common.csproj
Normal file
@@ -0,0 +1,103 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ProjectGuid>{8CB44F28-2956-4C2A-9314-72727262EDD4}</ProjectGuid>
|
||||||
|
<OutputType>Library</OutputType>
|
||||||
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
|
<RootNamespace>Filtration.Common</RootNamespace>
|
||||||
|
<AssemblyName>Filtration.Common</AssemblyName>
|
||||||
|
<TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
|
||||||
|
<FileAlignment>512</FileAlignment>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>bin\Debug\</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\Release\</OutputPath>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="Castle.Core">
|
||||||
|
<HintPath>..\packages\Castle.Core.3.3.0\lib\net45\Castle.Core.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Castle.Windsor">
|
||||||
|
<HintPath>..\packages\Castle.Windsor.3.3.0\lib\net45\Castle.Windsor.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="GalaSoft.MvvmLight">
|
||||||
|
<HintPath>..\packages\MvvmLightLibs.5.1.1.0\lib\net45\GalaSoft.MvvmLight.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="GalaSoft.MvvmLight.Extras">
|
||||||
|
<HintPath>..\packages\MvvmLightLibs.5.1.1.0\lib\net45\GalaSoft.MvvmLight.Extras.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="GalaSoft.MvvmLight.Platform">
|
||||||
|
<HintPath>..\packages\MvvmLightLibs.5.1.1.0\lib\net45\GalaSoft.MvvmLight.Platform.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Microsoft.Practices.ServiceLocation">
|
||||||
|
<HintPath>..\packages\CommonServiceLocator.1.3\lib\portable-net4+sl5+netcore45+wpa81+wp8\Microsoft.Practices.ServiceLocation.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="PresentationCore" />
|
||||||
|
<Reference Include="PresentationFramework" />
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\MvvmLightLibs.5.1.1.0\lib\net45\System.Windows.Interactivity.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Xaml" />
|
||||||
|
<Reference Include="System.Xml.Linq" />
|
||||||
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
|
<Reference Include="Microsoft.CSharp" />
|
||||||
|
<Reference Include="System.Data" />
|
||||||
|
<Reference Include="System.Xml" />
|
||||||
|
<Reference Include="WindowsBase" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="Converters\BooleanInverterConverter.cs" />
|
||||||
|
<Compile Include="Converters\BooleanVisibilityConverter.cs" />
|
||||||
|
<Compile Include="Converters\ColorToSolidColorBrushConverter.cs" />
|
||||||
|
<Compile Include="Converters\InverseBooleanVisibilityConverter.cs" />
|
||||||
|
<Compile Include="Converters\StringToVisibilityConverter.cs" />
|
||||||
|
<Compile Include="Messages\ThemeClosedMessage.cs" />
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
<Compile Include="Services\FileSystemService.cs" />
|
||||||
|
<Compile Include="Services\MessageBoxService.cs" />
|
||||||
|
<Compile Include="ViewModels\FiltrationViewModelBase.cs" />
|
||||||
|
<Compile Include="ViewModels\PaneViewModel.cs" />
|
||||||
|
<Compile Include="WindsorInstallers\ServicesInstaller.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="packages.config" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\Filtration.ObjectModel\Filtration.ObjectModel.csproj">
|
||||||
|
<Project>{4AAC3BEB-1DC1-483E-9D11-0E9334E80227}</Project>
|
||||||
|
<Name>Filtration.ObjectModel</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Page Include="Styles\SharedResourcesDictionary.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
|
<Target Name="BeforeBuild">
|
||||||
|
</Target>
|
||||||
|
<Target Name="AfterBuild">
|
||||||
|
</Target>
|
||||||
|
-->
|
||||||
|
</Project>
|
||||||
12
Filtration.Common/Messages/ThemeClosedMessage.cs
Normal file
12
Filtration.Common/Messages/ThemeClosedMessage.cs
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Filtration.Common.Messages
|
||||||
|
{
|
||||||
|
class ThemeClosedMessage
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
40
Filtration.Common/Properties/AssemblyInfo.cs
Normal file
40
Filtration.Common/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
// General Information about an assembly is controlled through the following
|
||||||
|
// set of attributes. Change these attribute values to modify the information
|
||||||
|
// associated with an assembly.
|
||||||
|
[assembly: AssemblyTitle("Filtration.Common")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("Microsoft")]
|
||||||
|
[assembly: AssemblyProduct("Filtration.Common")]
|
||||||
|
[assembly: AssemblyCopyright("Copyright © Microsoft 2015")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
// Setting ComVisible to false makes the types in this assembly not visible
|
||||||
|
// to COM components. If you need to access a type in this assembly from
|
||||||
|
// COM, set the ComVisible attribute to true on that type.
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||||
|
[assembly: Guid("36a40512-35b4-489c-8e20-f431b9e92dc1")]
|
||||||
|
|
||||||
|
// Version information for an assembly consists of the following four values:
|
||||||
|
//
|
||||||
|
// Major Version
|
||||||
|
// Minor Version
|
||||||
|
// Build Number
|
||||||
|
// Revision
|
||||||
|
//
|
||||||
|
// 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("1.0.0.0")]
|
||||||
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||||
|
|
||||||
|
[assembly: InternalsVisibleTo("Filtration.Tests")]
|
||||||
|
[assembly: InternalsVisibleTo("Filtration.Common.Tests")]
|
||||||
|
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")]
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
||||||
namespace Filtration.Services
|
namespace Filtration.Common.Services
|
||||||
{
|
{
|
||||||
internal interface IFileSystemService
|
public interface IFileSystemService
|
||||||
{
|
{
|
||||||
string ReadFileAsString(string filePath);
|
string ReadFileAsString(string filePath);
|
||||||
void WriteFileFromString(string filePath, string inputString);
|
void WriteFileFromString(string filePath, string inputString);
|
||||||
17
Filtration.Common/Services/MessageBoxService.cs
Normal file
17
Filtration.Common/Services/MessageBoxService.cs
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
namespace Filtration.Common.Services
|
||||||
|
{
|
||||||
|
public interface IMessageBoxService
|
||||||
|
{
|
||||||
|
MessageBoxResult Show(string caption, string message, MessageBoxButton buttons, MessageBoxImage image);
|
||||||
|
}
|
||||||
|
|
||||||
|
public class MessageBoxService : IMessageBoxService
|
||||||
|
{
|
||||||
|
public MessageBoxResult Show(string caption, string message, MessageBoxButton buttons, MessageBoxImage image)
|
||||||
|
{
|
||||||
|
return MessageBox.Show(message, caption, buttons, image);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,14 +1,13 @@
|
|||||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:converters="clr-namespace:Filtration.Converters"
|
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:converters="clr-namespace:Filtration.Common.Converters"
|
||||||
mc:Ignorable="d" >
|
mc:Ignorable="d" >
|
||||||
<ResourceDictionary.MergedDictionaries>
|
<ResourceDictionary.MergedDictionaries>
|
||||||
<ResourceDictionary>
|
<ResourceDictionary>
|
||||||
<Style x:Key="PathOfExileFont">
|
<Style x:Key="PathOfExileFont">
|
||||||
<Setter Property="TextElement.FontFamily" Value="pack://application:,,,/resources/#Fontin SmallCaps" />
|
<Setter Property="TextElement.FontFamily" Value="pack://application:,,,/resources/#Fontin SmallCaps" />
|
||||||
<Setter Property="TextElement.FontSize" Value="14" />
|
|
||||||
</Style>
|
</Style>
|
||||||
<Style x:Key="ChromelessToggleButton" TargetType="{x:Type ToggleButton}">
|
<Style x:Key="ChromelessToggleButton" TargetType="{x:Type ToggleButton}">
|
||||||
<Setter Property="Template">
|
<Setter Property="Template">
|
||||||
@@ -32,15 +31,19 @@
|
|||||||
</Setter.Value>
|
</Setter.Value>
|
||||||
</Setter>
|
</Setter>
|
||||||
</Style>
|
</Style>
|
||||||
<converters:IntToItemRarityConverter x:Key="IntToItemRarityConverter" />
|
<Style TargetType="{x:Type Border}" x:Key="BlockItemBorder">
|
||||||
|
<Setter Property="BorderThickness" Value="1" />
|
||||||
|
<Setter Property="BorderBrush" Value="Black" />
|
||||||
|
<Setter Property="CornerRadius" Value="3" />
|
||||||
|
<Setter Property="Margin" Value="0,0,5,5" />
|
||||||
|
</Style>
|
||||||
<converters:StringToVisibilityConverter x:Key="StringToVisibilityConverter" />
|
<converters:StringToVisibilityConverter x:Key="StringToVisibilityConverter" />
|
||||||
<converters:BoolInverterConverter x:Key="BoolInverterConverter" />
|
<converters:BoolInverterConverter x:Key="BoolInverterConverter" />
|
||||||
<converters:ColorToSolidColorBrushConverter x:Key="ColorToSolidColorBrushConverter" />
|
<converters:ColorToSolidColorBrushConverter x:Key="ColorToSolidColorBrushConverter" />
|
||||||
<converters:BooleanToBlockActionConverter x:Key="BooleanToBlockActionConverter" />
|
|
||||||
<converters:BooleanToBlockActionInverseConverter x:Key="BooleanToBlockActionInverseConverter" />
|
|
||||||
<converters:BlockItemTypeToStringConverter x:Key="BlockItemTypeToStringConverter" />
|
|
||||||
<converters:BooleanVisibilityConverter x:Key="BooleanVisibilityConverter" />
|
<converters:BooleanVisibilityConverter x:Key="BooleanVisibilityConverter" />
|
||||||
|
<converters:InverseBooleanVisibilityConverter x:Key="InverseBooleanVisibilityConverter" />
|
||||||
|
|
||||||
|
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
<ResourceDictionary Source="ExpanderStyle.xaml" />
|
|
||||||
</ResourceDictionary.MergedDictionaries>
|
</ResourceDictionary.MergedDictionaries>
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
@@ -1,15 +1,14 @@
|
|||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using Filtration.Annotations;
|
using Filtration.ObjectModel.Annotations;
|
||||||
using GalaSoft.MvvmLight;
|
using GalaSoft.MvvmLight;
|
||||||
|
|
||||||
namespace Filtration.ViewModels
|
namespace Filtration.Common.ViewModels
|
||||||
{
|
{
|
||||||
internal class FiltrationViewModelBase : ViewModelBase
|
public class FiltrationViewModelBase : ViewModelBase
|
||||||
{
|
{
|
||||||
/// This gives us the ReSharper option to transform an autoproperty into a property with change notification
|
/// This gives us the ReSharper option to transform an autoproperty into a property with change notification
|
||||||
/// Also leverages .net 4.5 callermembername attribute
|
/// Also leverages .net 4.5 callermembername attribute
|
||||||
[NotifyPropertyChangedInvocator]
|
[NotifyPropertyChangedInvocator]
|
||||||
|
|
||||||
protected override void RaisePropertyChanged([CallerMemberName]string property = "")
|
protected override void RaisePropertyChanged([CallerMemberName]string property = "")
|
||||||
{
|
{
|
||||||
base.RaisePropertyChanged(property);
|
base.RaisePropertyChanged(property);
|
||||||
65
Filtration.Common/ViewModels/PaneViewModel.cs
Normal file
65
Filtration.Common/ViewModels/PaneViewModel.cs
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
using System.Windows.Media;
|
||||||
|
|
||||||
|
namespace Filtration.Common.ViewModels
|
||||||
|
{
|
||||||
|
public class PaneViewModel : FiltrationViewModelBase
|
||||||
|
{
|
||||||
|
private string _title;
|
||||||
|
public string Title
|
||||||
|
{
|
||||||
|
get { return _title; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (_title != value)
|
||||||
|
{
|
||||||
|
_title = value;
|
||||||
|
RaisePropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ImageSource IconSource { get; protected set; }
|
||||||
|
|
||||||
|
private string _contentId;
|
||||||
|
public string ContentId
|
||||||
|
{
|
||||||
|
get { return _contentId; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (_contentId != value)
|
||||||
|
{
|
||||||
|
_contentId = value;
|
||||||
|
RaisePropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool _isSelected;
|
||||||
|
public bool IsSelected
|
||||||
|
{
|
||||||
|
get { return _isSelected; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (_isSelected != value)
|
||||||
|
{
|
||||||
|
_isSelected = value;
|
||||||
|
RaisePropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool _isActive;
|
||||||
|
public bool IsActive
|
||||||
|
{
|
||||||
|
get { return _isActive; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (_isActive != value)
|
||||||
|
{
|
||||||
|
_isActive = value;
|
||||||
|
RaisePropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
23
Filtration.Common/WindsorInstallers/ServicesInstaller.cs
Normal file
23
Filtration.Common/WindsorInstallers/ServicesInstaller.cs
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
using Castle.MicroKernel.Registration;
|
||||||
|
using Castle.MicroKernel.SubSystems.Configuration;
|
||||||
|
using Castle.Windsor;
|
||||||
|
using Filtration.Common.Services;
|
||||||
|
|
||||||
|
namespace Filtration.Common.WindsorInstallers
|
||||||
|
{
|
||||||
|
public class ServicesInstaller :IWindsorInstaller
|
||||||
|
{
|
||||||
|
public void Install(IWindsorContainer container, IConfigurationStore store)
|
||||||
|
{
|
||||||
|
container.Register(
|
||||||
|
Component.For<IFileSystemService>()
|
||||||
|
.ImplementedBy<FileSystemService>()
|
||||||
|
.LifeStyle.Singleton);
|
||||||
|
|
||||||
|
container.Register(
|
||||||
|
Component.For<IMessageBoxService>()
|
||||||
|
.ImplementedBy<MessageBoxService>()
|
||||||
|
.LifeStyle.Singleton);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
7
Filtration.Common/packages.config
Normal file
7
Filtration.Common/packages.config
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<packages>
|
||||||
|
<package id="Castle.Core" version="3.3.0" targetFramework="net451" />
|
||||||
|
<package id="Castle.Windsor" version="3.3.0" targetFramework="net451" />
|
||||||
|
<package id="CommonServiceLocator" version="1.3" targetFramework="net451" />
|
||||||
|
<package id="MvvmLightLibs" version="5.1.1.0" targetFramework="net451" />
|
||||||
|
</packages>
|
||||||
56
Filtration.Interface/Filtration.Interface.csproj
Normal file
56
Filtration.Interface/Filtration.Interface.csproj
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ProjectGuid>{0F333344-7695-47B2-B0E6-172E4DE74819}</ProjectGuid>
|
||||||
|
<OutputType>Library</OutputType>
|
||||||
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
|
<RootNamespace>Filtration.Interface</RootNamespace>
|
||||||
|
<AssemblyName>Filtration.Interface</AssemblyName>
|
||||||
|
<TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
|
||||||
|
<FileAlignment>512</FileAlignment>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>bin\Debug\</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\Release\</OutputPath>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="PresentationCore" />
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="System.Xml.Linq" />
|
||||||
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
|
<Reference Include="Microsoft.CSharp" />
|
||||||
|
<Reference Include="System.Data" />
|
||||||
|
<Reference Include="System.Xml" />
|
||||||
|
<Reference Include="WindowsBase" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="IDocument.cs" />
|
||||||
|
<Compile Include="IEditableDocument.cs" />
|
||||||
|
<Compile Include="Properties\AssemblyInfo.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.
|
||||||
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
|
<Target Name="BeforeBuild">
|
||||||
|
</Target>
|
||||||
|
<Target Name="AfterBuild">
|
||||||
|
</Target>
|
||||||
|
-->
|
||||||
|
</Project>
|
||||||
9
Filtration.Interface/IDocument.cs
Normal file
9
Filtration.Interface/IDocument.cs
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
namespace Filtration.Interface
|
||||||
|
{
|
||||||
|
public interface IDocument
|
||||||
|
{
|
||||||
|
bool IsScript { get; }
|
||||||
|
bool IsTheme { get; }
|
||||||
|
void Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
9
Filtration.Interface/IEditableDocument.cs
Normal file
9
Filtration.Interface/IEditableDocument.cs
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
namespace Filtration.Interface
|
||||||
|
{
|
||||||
|
public interface IEditableDocument : IDocument
|
||||||
|
{
|
||||||
|
bool IsDirty { get; }
|
||||||
|
void Save();
|
||||||
|
void SaveAs();
|
||||||
|
}
|
||||||
|
}
|
||||||
36
Filtration.Interface/Properties/AssemblyInfo.cs
Normal file
36
Filtration.Interface/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
// General Information about an assembly is controlled through the following
|
||||||
|
// set of attributes. Change these attribute values to modify the information
|
||||||
|
// associated with an assembly.
|
||||||
|
[assembly: AssemblyTitle("Filtration.Interface")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("Microsoft")]
|
||||||
|
[assembly: AssemblyProduct("Filtration.Interface")]
|
||||||
|
[assembly: AssemblyCopyright("Copyright © Microsoft 2015")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
// Setting ComVisible to false makes the types in this assembly not visible
|
||||||
|
// to COM components. If you need to access a type in this assembly from
|
||||||
|
// COM, set the ComVisible attribute to true on that type.
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||||
|
[assembly: Guid("f21659a3-839a-41ca-97b9-78cc6f6af353")]
|
||||||
|
|
||||||
|
// Version information for an assembly consists of the following four values:
|
||||||
|
//
|
||||||
|
// Major Version
|
||||||
|
// Minor Version
|
||||||
|
// Build Number
|
||||||
|
// Revision
|
||||||
|
//
|
||||||
|
// 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("1.0.0.0")]
|
||||||
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||||
@@ -0,0 +1,74 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ProjectGuid>{56D0887E-B10D-4F9C-A88E-09CF8E8E06E3}</ProjectGuid>
|
||||||
|
<OutputType>Library</OutputType>
|
||||||
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
|
<RootNamespace>Filtration.LootExplosionStudio.Tests</RootNamespace>
|
||||||
|
<AssemblyName>Filtration.LootExplosionStudio.Tests</AssemblyName>
|
||||||
|
<TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
|
||||||
|
<FileAlignment>512</FileAlignment>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>bin\Debug\</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\Release\</OutputPath>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="Moq">
|
||||||
|
<HintPath>..\packages\Moq.4.2.1507.0118\lib\net40\Moq.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="nunit.framework">
|
||||||
|
<HintPath>..\packages\NUnit.2.6.4\lib\nunit.framework.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="PresentationCore" />
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="System.Xml.Linq" />
|
||||||
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
|
<Reference Include="Microsoft.CSharp" />
|
||||||
|
<Reference Include="System.Data" />
|
||||||
|
<Reference Include="System.Xml" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
<Compile Include="Services\TestItemFilterBlockFinderService.cs" />
|
||||||
|
<Compile Include="Services\TestLootItemAppearanceService.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="packages.config" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\Filtration.LootExplosionStudio\Filtration.LootExplosionStudio.csproj">
|
||||||
|
<Project>{c8009b11-14d0-4421-94f0-9ef4603cb363}</Project>
|
||||||
|
<Name>Filtration.LootExplosionStudio</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\Filtration.ObjectModel\Filtration.ObjectModel.csproj">
|
||||||
|
<Project>{4aac3beb-1dc1-483e-9d11-0e9334e80227}</Project>
|
||||||
|
<Name>Filtration.ObjectModel</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
|
<Target Name="BeforeBuild">
|
||||||
|
</Target>
|
||||||
|
<Target Name="AfterBuild">
|
||||||
|
</Target>
|
||||||
|
-->
|
||||||
|
</Project>
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
// General Information about an assembly is controlled through the following
|
||||||
|
// set of attributes. Change these attribute values to modify the information
|
||||||
|
// associated with an assembly.
|
||||||
|
[assembly: AssemblyTitle("Filtration.LootExplosionStudio.Tests")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("Microsoft")]
|
||||||
|
[assembly: AssemblyProduct("Filtration.LootExplosionStudio.Tests")]
|
||||||
|
[assembly: AssemblyCopyright("Copyright © Microsoft 2015")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
// Setting ComVisible to false makes the types in this assembly not visible
|
||||||
|
// to COM components. If you need to access a type in this assembly from
|
||||||
|
// COM, set the ComVisible attribute to true on that type.
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||||
|
[assembly: Guid("24ce1315-7f86-4389-a63c-22a40baa4c6d")]
|
||||||
|
|
||||||
|
// Version information for an assembly consists of the following four values:
|
||||||
|
//
|
||||||
|
// Major Version
|
||||||
|
// Minor Version
|
||||||
|
// Build Number
|
||||||
|
// Revision
|
||||||
|
//
|
||||||
|
// 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("1.0.0.0")]
|
||||||
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||||
@@ -0,0 +1,178 @@
|
|||||||
|
using Filtration.LootExplosionStudio.Services;
|
||||||
|
using Filtration.ObjectModel;
|
||||||
|
using Filtration.ObjectModel.BlockItemTypes;
|
||||||
|
using Filtration.ObjectModel.Enums;
|
||||||
|
using Filtration.ObjectModel.LootExplosionStudio;
|
||||||
|
using NUnit.Framework;
|
||||||
|
|
||||||
|
namespace Filtration.LootExplosionStudio.Tests.Services
|
||||||
|
{
|
||||||
|
[TestFixture]
|
||||||
|
public class TestItemFilterBlockFinderService
|
||||||
|
{
|
||||||
|
private ItemFilterBlockFinderServiceTestUtility _testUtility;
|
||||||
|
|
||||||
|
[SetUp]
|
||||||
|
public void ItemFilterProcessingServiceTestSetup()
|
||||||
|
{
|
||||||
|
_testUtility = new ItemFilterBlockFinderServiceTestUtility();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void FindBlockForLootItem_SingleBlock_BaseType_Matches()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var testInputBaseType = "TestBaseType";
|
||||||
|
var testInputBlockItem = new BaseTypeBlockItem();
|
||||||
|
testInputBlockItem.Items.Add(testInputBaseType);
|
||||||
|
|
||||||
|
_testUtility.TestLootItem.BaseType = testInputBaseType;
|
||||||
|
_testUtility.TestBlock.BlockItems.Add(testInputBlockItem);
|
||||||
|
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var result = _testUtility.Service.FindBlockForLootItem(_testUtility.TestLootItem, _testUtility.TestScript);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.AreEqual(_testUtility.TestBlock, result);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void FindBlockForLootItem_SingleHideBlock_Matches()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
|
||||||
|
_testUtility.TestBlock.Action = BlockAction.Hide;
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var result = _testUtility.Service.FindBlockForLootItem(_testUtility.TestLootItem, _testUtility.TestScript);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.AreEqual(_testUtility.TestBlock, result);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void FindBlockForLootItem_SingleBlock_MultipleBlockItems_Matches()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var testInputBaseType = "TestBaseType";
|
||||||
|
var testInputBaseTypeBlockItem = new BaseTypeBlockItem();
|
||||||
|
testInputBaseTypeBlockItem.Items.Add(testInputBaseType);
|
||||||
|
|
||||||
|
var testInputClass = "Test Class";
|
||||||
|
var testInputClassBlockItem = new ClassBlockItem();
|
||||||
|
testInputClassBlockItem.Items.Add(testInputClass);
|
||||||
|
|
||||||
|
var testInputItemLevel = 57;
|
||||||
|
var testInputItemLevelBlockItem = new ItemLevelBlockItem(FilterPredicateOperator.GreaterThan, 50);
|
||||||
|
|
||||||
|
_testUtility.TestLootItem.BaseType = testInputBaseType;
|
||||||
|
_testUtility.TestLootItem.Class = testInputClass;
|
||||||
|
_testUtility.TestLootItem.ItemLevel = testInputItemLevel;
|
||||||
|
|
||||||
|
_testUtility.TestBlock.BlockItems.Add(testInputBaseTypeBlockItem);
|
||||||
|
_testUtility.TestBlock.BlockItems.Add(testInputClassBlockItem);
|
||||||
|
_testUtility.TestBlock.BlockItems.Add(testInputItemLevelBlockItem);
|
||||||
|
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var result = _testUtility.Service.FindBlockForLootItem(_testUtility.TestLootItem, _testUtility.TestScript);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.AreEqual(_testUtility.TestBlock, result);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void FindBlockForLootItem_SingleBlock_MultipleBlockItemsOneWithoutMatch_Matches()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var testInputBaseType = "TestBaseType";
|
||||||
|
var testInputBaseTypeBlockItem = new BaseTypeBlockItem();
|
||||||
|
testInputBaseTypeBlockItem.Items.Add(testInputBaseType);
|
||||||
|
|
||||||
|
var testInputClass = "Test Class";
|
||||||
|
var testInputClassBlockItem = new ClassBlockItem();
|
||||||
|
testInputClassBlockItem.Items.Add(testInputClass);
|
||||||
|
|
||||||
|
var testInputItemLevel = 57;
|
||||||
|
var testInputItemLevelBlockItem = new ItemLevelBlockItem(FilterPredicateOperator.GreaterThan, 50);
|
||||||
|
|
||||||
|
var testInputDropLevel = 35;
|
||||||
|
var testInputDropLevelBlockItem = new DropLevelBlockItem(FilterPredicateOperator.GreaterThanOrEqual, 89);
|
||||||
|
|
||||||
|
_testUtility.TestLootItem.BaseType = testInputBaseType;
|
||||||
|
_testUtility.TestLootItem.Class = testInputClass;
|
||||||
|
_testUtility.TestLootItem.ItemLevel = testInputItemLevel;
|
||||||
|
_testUtility.TestLootItem.DropLevel = testInputDropLevel;
|
||||||
|
|
||||||
|
_testUtility.TestBlock.BlockItems.Add(testInputBaseTypeBlockItem);
|
||||||
|
_testUtility.TestBlock.BlockItems.Add(testInputClassBlockItem);
|
||||||
|
_testUtility.TestBlock.BlockItems.Add(testInputItemLevelBlockItem);
|
||||||
|
_testUtility.TestBlock.BlockItems.Add(testInputDropLevelBlockItem);
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var result = _testUtility.Service.FindBlockForLootItem(_testUtility.TestLootItem, _testUtility.TestScript);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.IsNull(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void FindBlockForLootItem_MultipleBlocksBlock_Matches()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var testInputBlock1 = new ItemFilterBlock();
|
||||||
|
var testInputClass1 = "Test Class";
|
||||||
|
var testInputClassBlockItem1 = new ClassBlockItem();
|
||||||
|
testInputClassBlockItem1.Items.Add(testInputClass1);
|
||||||
|
testInputBlock1.BlockItems.Add(testInputClassBlockItem1);
|
||||||
|
|
||||||
|
_testUtility.TestScript.ItemFilterBlocks.Add(testInputBlock1);
|
||||||
|
|
||||||
|
var testInputBaseType = "TestBaseType";
|
||||||
|
var testInputBaseTypeBlockItem = new BaseTypeBlockItem();
|
||||||
|
testInputBaseTypeBlockItem.Items.Add(testInputBaseType);
|
||||||
|
|
||||||
|
var testInputClass = "Test Class";
|
||||||
|
var testInputClassBlockItem = new ClassBlockItem();
|
||||||
|
testInputClassBlockItem.Items.Add(testInputClass);
|
||||||
|
|
||||||
|
var testInputItemLevel = 57;
|
||||||
|
var testInputItemLevelBlockItem = new ItemLevelBlockItem(FilterPredicateOperator.GreaterThan, 50);
|
||||||
|
|
||||||
|
_testUtility.TestLootItem.BaseType = testInputBaseType;
|
||||||
|
_testUtility.TestLootItem.Class = testInputClass;
|
||||||
|
_testUtility.TestLootItem.ItemLevel = testInputItemLevel;
|
||||||
|
|
||||||
|
_testUtility.TestBlock.BlockItems.Add(testInputBaseTypeBlockItem);
|
||||||
|
_testUtility.TestBlock.BlockItems.Add(testInputClassBlockItem);
|
||||||
|
_testUtility.TestBlock.BlockItems.Add(testInputItemLevelBlockItem);
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var result = _testUtility.Service.FindBlockForLootItem(_testUtility.TestLootItem, _testUtility.TestScript);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.AreEqual(_testUtility.TestBlock, result);
|
||||||
|
}
|
||||||
|
|
||||||
|
private class ItemFilterBlockFinderServiceTestUtility
|
||||||
|
{
|
||||||
|
public ItemFilterBlockFinderServiceTestUtility()
|
||||||
|
{
|
||||||
|
TestBlock = new ItemFilterBlock();
|
||||||
|
TestScript = new ItemFilterScript();
|
||||||
|
TestScript.ItemFilterBlocks.Add(TestBlock);
|
||||||
|
TestLootItem = new LootItem();
|
||||||
|
|
||||||
|
Service = new ItemFilterBlockFinderService();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ItemFilterScript TestScript { get; private set; }
|
||||||
|
public ItemFilterBlock TestBlock { get; private set; }
|
||||||
|
public LootItem TestLootItem { get; private set; }
|
||||||
|
public ItemFilterBlockFinderService Service { get; private set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,275 @@
|
|||||||
|
using System.Windows.Media;
|
||||||
|
using Filtration.LootExplosionStudio.Services;
|
||||||
|
using Filtration.ObjectModel;
|
||||||
|
using Filtration.ObjectModel.BlockItemTypes;
|
||||||
|
using Filtration.ObjectModel.Enums;
|
||||||
|
using Filtration.ObjectModel.LootExplosionStudio;
|
||||||
|
using Moq;
|
||||||
|
using NUnit.Framework;
|
||||||
|
|
||||||
|
namespace Filtration.LootExplosionStudio.Tests.Services
|
||||||
|
{
|
||||||
|
[TestFixture]
|
||||||
|
class TestLootItemAppearanceService
|
||||||
|
{
|
||||||
|
private LootItemAppearanceServiceTestUtility _testUtility;
|
||||||
|
|
||||||
|
[SetUp]
|
||||||
|
public void ItemFilterProcessingServiceTestSetup()
|
||||||
|
{
|
||||||
|
_testUtility = new LootItemAppearanceServiceTestUtility();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void ProcessLootItemAgainstScript_NoMatchingBlocks_NormalItem_SetsCorrectTextColor()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
_testUtility.TestLootItem.Rarity = ItemRarity.Normal;
|
||||||
|
|
||||||
|
// Act
|
||||||
|
_testUtility.Service.ProcessLootItemAgainstFilterScript(_testUtility.TestLootItem, _testUtility.TestScript);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.AreEqual(DefaultLootItemAppearanceConstants.NormalTextColor, _testUtility.TestLootItem.TextColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void ProcessLootItemAgainstScript_NoMatchingBlocks_MagicItem_SetsCorrectTextColor()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
_testUtility.TestLootItem.Rarity = ItemRarity.Magic;
|
||||||
|
_testUtility.TestBlock.BlockItems.Add(new ItemLevelBlockItem(FilterPredicateOperator.GreaterThan, 99));
|
||||||
|
|
||||||
|
// Act
|
||||||
|
_testUtility.Service.ProcessLootItemAgainstFilterScript(_testUtility.TestLootItem, _testUtility.TestScript);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.AreEqual(DefaultLootItemAppearanceConstants.MagicTextColor, _testUtility.TestLootItem.TextColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void ProcessLootItemAgainstScript_NoMatchingBlocks_RareItem_SetsCorrectTextColor()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
_testUtility.TestLootItem.Rarity = ItemRarity.Rare;
|
||||||
|
_testUtility.TestBlock.BlockItems.Add(new ItemLevelBlockItem(FilterPredicateOperator.GreaterThan, 99));
|
||||||
|
|
||||||
|
// Act
|
||||||
|
_testUtility.Service.ProcessLootItemAgainstFilterScript(_testUtility.TestLootItem, _testUtility.TestScript);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.AreEqual(DefaultLootItemAppearanceConstants.RareTextColor, _testUtility.TestLootItem.TextColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void ProcessLootItemAgainstScript_NoMatchingBlocks_UniqueItem_SetsCorrectTextColor()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
_testUtility.TestLootItem.Rarity = ItemRarity.Unique;
|
||||||
|
_testUtility.TestBlock.BlockItems.Add(new ItemLevelBlockItem(FilterPredicateOperator.GreaterThan, 99));
|
||||||
|
|
||||||
|
// Act
|
||||||
|
_testUtility.Service.ProcessLootItemAgainstFilterScript(_testUtility.TestLootItem, _testUtility.TestScript);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.AreEqual(DefaultLootItemAppearanceConstants.UniqueTextColor, _testUtility.TestLootItem.TextColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void ProcessLootItemAgainstScript_NoMatchingBlocks_SetsCorrectBackgroundColor()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
_testUtility.TestBlock.BlockItems.Add(new ItemLevelBlockItem(FilterPredicateOperator.GreaterThan, 99));
|
||||||
|
|
||||||
|
// Act
|
||||||
|
_testUtility.Service.ProcessLootItemAgainstFilterScript(_testUtility.TestLootItem, _testUtility.TestScript);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.AreEqual(DefaultLootItemAppearanceConstants.BackgroundColor, _testUtility.TestLootItem.BackgroundColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void ProcessLootItemAgainstScript_NoMatchingBlocks_SetsCorrectBorderColor()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
_testUtility.TestBlock.BlockItems.Add(new ItemLevelBlockItem(FilterPredicateOperator.GreaterThan, 99));
|
||||||
|
|
||||||
|
// Act
|
||||||
|
_testUtility.Service.ProcessLootItemAgainstFilterScript(_testUtility.TestLootItem, _testUtility.TestScript);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.AreEqual(DefaultLootItemAppearanceConstants.BorderColor, _testUtility.TestLootItem.BorderColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void ProcessLootItemAgainstScript_MatchingTextColorOnly_SetsColorsCorrectly()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var testInputTextColor = new Color {R = 123, G = 5, B = 22, A = 200};
|
||||||
|
_testUtility.TestBlock.BlockItems.Add(new TextColorBlockItem {Color = testInputTextColor});
|
||||||
|
|
||||||
|
// Act
|
||||||
|
_testUtility.Service.ProcessLootItemAgainstFilterScript(_testUtility.TestLootItem, _testUtility.TestScript);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.AreEqual(testInputTextColor, _testUtility.TestLootItem.TextColor);
|
||||||
|
Assert.AreEqual(DefaultLootItemAppearanceConstants.BackgroundColor, _testUtility.TestLootItem.BackgroundColor);
|
||||||
|
Assert.AreEqual(DefaultLootItemAppearanceConstants.BorderColor, _testUtility.TestLootItem.BorderColor);
|
||||||
|
Assert.AreEqual(DefaultLootItemAppearanceConstants.FontSize, _testUtility.TestLootItem.FontSize );
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void ProcessLootItemAgainstScript_MatchingBackgroundColorOnly_RarityNormal_SetsColorsCorrectly()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var testInputBackgroundColor = new Color {R = 123, G = 5, B = 22, A = 200};
|
||||||
|
_testUtility.TestBlock.BlockItems.Add(new BackgroundColorBlockItem {Color = testInputBackgroundColor});
|
||||||
|
|
||||||
|
// Act
|
||||||
|
_testUtility.Service.ProcessLootItemAgainstFilterScript(_testUtility.TestLootItem, _testUtility.TestScript);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.AreEqual(testInputBackgroundColor, _testUtility.TestLootItem.BackgroundColor);
|
||||||
|
Assert.AreEqual(DefaultLootItemAppearanceConstants.NormalTextColor, _testUtility.TestLootItem.TextColor);
|
||||||
|
Assert.AreEqual(DefaultLootItemAppearanceConstants.BorderColor, _testUtility.TestLootItem.BorderColor);
|
||||||
|
Assert.AreEqual(DefaultLootItemAppearanceConstants.FontSize, _testUtility.TestLootItem.FontSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void ProcessLootItemAgainstScript_MatchingBackgroundColorOnly_RarityMagic_SetsColorsCorrectly()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var testInputBackgroundColor = new Color { R = 123, G = 5, B = 22, A = 200 };
|
||||||
|
_testUtility.TestBlock.BlockItems.Add(new BackgroundColorBlockItem {Color = testInputBackgroundColor});
|
||||||
|
_testUtility.TestLootItem.Rarity = ItemRarity.Magic;
|
||||||
|
|
||||||
|
// Act
|
||||||
|
_testUtility.Service.ProcessLootItemAgainstFilterScript(_testUtility.TestLootItem, _testUtility.TestScript);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.AreEqual(testInputBackgroundColor, _testUtility.TestLootItem.BackgroundColor);
|
||||||
|
Assert.AreEqual(DefaultLootItemAppearanceConstants.MagicTextColor, _testUtility.TestLootItem.TextColor);
|
||||||
|
Assert.AreEqual(DefaultLootItemAppearanceConstants.BorderColor, _testUtility.TestLootItem.BorderColor);
|
||||||
|
Assert.AreEqual(DefaultLootItemAppearanceConstants.FontSize, _testUtility.TestLootItem.FontSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void ProcessLootItemAgainstScript_MatchingBackgroundColorOnly_RarityRare_SetsColorsCorrectly()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var testInputBackgroundColor = new Color { R = 123, G = 5, B = 22, A = 200 };
|
||||||
|
_testUtility.TestBlock.BlockItems.Add(new BackgroundColorBlockItem { Color = testInputBackgroundColor });
|
||||||
|
_testUtility.TestLootItem.Rarity = ItemRarity.Rare;
|
||||||
|
|
||||||
|
// Act
|
||||||
|
_testUtility.Service.ProcessLootItemAgainstFilterScript(_testUtility.TestLootItem, _testUtility.TestScript);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.AreEqual(testInputBackgroundColor, _testUtility.TestLootItem.BackgroundColor);
|
||||||
|
Assert.AreEqual(DefaultLootItemAppearanceConstants.RareTextColor, _testUtility.TestLootItem.TextColor);
|
||||||
|
Assert.AreEqual(DefaultLootItemAppearanceConstants.BorderColor, _testUtility.TestLootItem.BorderColor);
|
||||||
|
Assert.AreEqual(DefaultLootItemAppearanceConstants.FontSize, _testUtility.TestLootItem.FontSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void ProcessLootItemAgainstScript_MatchingBackgroundColorOnly_RarityUnique_SetsColorsCorrectly()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var testInputBackgroundColor = new Color { R = 123, G = 5, B = 22, A = 200 };
|
||||||
|
_testUtility.TestBlock.BlockItems.Add(new BackgroundColorBlockItem { Color = testInputBackgroundColor });
|
||||||
|
_testUtility.TestLootItem.Rarity = ItemRarity.Unique;
|
||||||
|
|
||||||
|
// Act
|
||||||
|
_testUtility.Service.ProcessLootItemAgainstFilterScript(_testUtility.TestLootItem, _testUtility.TestScript);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.AreEqual(testInputBackgroundColor, _testUtility.TestLootItem.BackgroundColor);
|
||||||
|
Assert.AreEqual(DefaultLootItemAppearanceConstants.UniqueTextColor, _testUtility.TestLootItem.TextColor);
|
||||||
|
Assert.AreEqual(DefaultLootItemAppearanceConstants.BorderColor, _testUtility.TestLootItem.BorderColor);
|
||||||
|
Assert.AreEqual(DefaultLootItemAppearanceConstants.FontSize, _testUtility.TestLootItem.FontSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void ProcessLootItemAgainstScript_MatchingBorderColorOnly_RarityUnique_SetsColorsCorrectly()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var testInputBorderColor = new Color { R = 123, G = 5, B = 22, A = 200 };
|
||||||
|
_testUtility.TestBlock.BlockItems.Add(new BorderColorBlockItem { Color = testInputBorderColor });
|
||||||
|
|
||||||
|
// Act
|
||||||
|
_testUtility.Service.ProcessLootItemAgainstFilterScript(_testUtility.TestLootItem, _testUtility.TestScript);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.AreEqual(testInputBorderColor, _testUtility.TestLootItem.BorderColor);
|
||||||
|
Assert.AreEqual(DefaultLootItemAppearanceConstants.NormalTextColor, _testUtility.TestLootItem.TextColor);
|
||||||
|
Assert.AreEqual(DefaultLootItemAppearanceConstants.BackgroundColor, _testUtility.TestLootItem.BackgroundColor);
|
||||||
|
Assert.AreEqual(DefaultLootItemAppearanceConstants.FontSize, _testUtility.TestLootItem.FontSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void ProcessLootItemAgainstScript_MatchingFontSizeOnly_RarityUnique_SetsColorsCorrectly()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var testInputFontSize = 22;
|
||||||
|
_testUtility.TestBlock.BlockItems.Add(new FontSizeBlockItem(22));
|
||||||
|
|
||||||
|
// Act
|
||||||
|
_testUtility.Service.ProcessLootItemAgainstFilterScript(_testUtility.TestLootItem, _testUtility.TestScript);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.AreEqual(testInputFontSize, _testUtility.TestLootItem.FontSize);
|
||||||
|
Assert.AreEqual(DefaultLootItemAppearanceConstants.NormalTextColor, _testUtility.TestLootItem.TextColor);
|
||||||
|
Assert.AreEqual(DefaultLootItemAppearanceConstants.BackgroundColor, _testUtility.TestLootItem.BackgroundColor);
|
||||||
|
Assert.AreEqual(DefaultLootItemAppearanceConstants.BorderColor, _testUtility.TestLootItem.BorderColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void ProcessLootItemAgainstScript_AllAppearanceMatching_SetsColorsCorrectly()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var testInputFontSize = 22;
|
||||||
|
var testInputTextColor = new Color { R = 123, G = 5, B = 22, A = 200 };
|
||||||
|
var testInputBackgroundColor = new Color { R = 123, G = 59, B = 27, A = 50 };
|
||||||
|
var testInputBorderColor = new Color { R = 166, G = 0, B = 100, A = 255 };
|
||||||
|
|
||||||
|
_testUtility.TestBlock.BlockItems.Add(new FontSizeBlockItem(22));
|
||||||
|
_testUtility.TestBlock.BlockItems.Add(new BorderColorBlockItem { Color = testInputBorderColor });
|
||||||
|
_testUtility.TestBlock.BlockItems.Add(new BackgroundColorBlockItem { Color = testInputBackgroundColor });
|
||||||
|
_testUtility.TestBlock.BlockItems.Add(new TextColorBlockItem { Color = testInputTextColor });
|
||||||
|
|
||||||
|
// Act
|
||||||
|
_testUtility.Service.ProcessLootItemAgainstFilterScript(_testUtility.TestLootItem, _testUtility.TestScript);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.AreEqual(testInputFontSize, _testUtility.TestLootItem.FontSize);
|
||||||
|
Assert.AreEqual(testInputTextColor, _testUtility.TestLootItem.TextColor);
|
||||||
|
Assert.AreEqual(testInputBackgroundColor, _testUtility.TestLootItem.BackgroundColor);
|
||||||
|
Assert.AreEqual(testInputBorderColor, _testUtility.TestLootItem.BorderColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
private class LootItemAppearanceServiceTestUtility
|
||||||
|
{
|
||||||
|
public LootItemAppearanceServiceTestUtility()
|
||||||
|
{
|
||||||
|
TestBlock = new ItemFilterBlock();
|
||||||
|
TestScript = new ItemFilterScript();
|
||||||
|
TestScript.ItemFilterBlocks.Add(TestBlock);
|
||||||
|
TestLootItem = new LootItem();
|
||||||
|
|
||||||
|
MockItemFilterBlockFinderService = new Mock<IItemFilterBlockFinderService>();
|
||||||
|
MockItemFilterBlockFinderService.Setup(
|
||||||
|
b => b.FindBlockForLootItem(TestLootItem, TestScript))
|
||||||
|
.Returns(TestBlock);
|
||||||
|
|
||||||
|
Service = new LootItemAppearanceService(MockItemFilterBlockFinderService.Object);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Mock<IItemFilterBlockFinderService> MockItemFilterBlockFinderService { get; private set; }
|
||||||
|
|
||||||
|
public ItemFilterScript TestScript { get; private set; }
|
||||||
|
public ItemFilterBlock TestBlock { get; private set; }
|
||||||
|
public LootItem TestLootItem { get; private set; }
|
||||||
|
public LootItemAppearanceService Service { get; private set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
5
Filtration.LootExplosionStudio.Tests/packages.config
Normal file
5
Filtration.LootExplosionStudio.Tests/packages.config
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<packages>
|
||||||
|
<package id="Moq" version="4.2.1507.0118" targetFramework="net451" />
|
||||||
|
<package id="NUnit" version="2.6.4" targetFramework="net451" />
|
||||||
|
</packages>
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ProjectGuid>{C8009B11-14D0-4421-94F0-9EF4603CB363}</ProjectGuid>
|
||||||
|
<OutputType>Library</OutputType>
|
||||||
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
|
<RootNamespace>Filtration.LootExplosionStudio</RootNamespace>
|
||||||
|
<AssemblyName>Filtration.LootExplosionStudio</AssemblyName>
|
||||||
|
<TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
|
||||||
|
<FileAlignment>512</FileAlignment>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>bin\Debug\</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\Release\</OutputPath>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="Castle.Core">
|
||||||
|
<HintPath>..\packages\Castle.Core.3.3.0\lib\net45\Castle.Core.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Castle.Windsor">
|
||||||
|
<HintPath>..\packages\Castle.Windsor.3.3.0\lib\net45\Castle.Windsor.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="PresentationCore" />
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="System.Xml.Linq" />
|
||||||
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
|
<Reference Include="Microsoft.CSharp" />
|
||||||
|
<Reference Include="System.Data" />
|
||||||
|
<Reference Include="System.Xml" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
<Compile Include="Services\ItemFilterBlockFinderService.cs" />
|
||||||
|
<Compile Include="Services\LootItemAppearanceService.cs" />
|
||||||
|
<Compile Include="Services\LootItemCollectionItemFilterCombinerService.cs" />
|
||||||
|
<Compile Include="WindsorInstallers\ServicesInstaller.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\Filtration.ObjectModel\Filtration.ObjectModel.csproj">
|
||||||
|
<Project>{4aac3beb-1dc1-483e-9d11-0e9334e80227}</Project>
|
||||||
|
<Name>Filtration.ObjectModel</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="packages.config" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
|
<Target Name="BeforeBuild">
|
||||||
|
</Target>
|
||||||
|
<Target Name="AfterBuild">
|
||||||
|
</Target>
|
||||||
|
-->
|
||||||
|
</Project>
|
||||||
39
Filtration.LootExplosionStudio/Properties/AssemblyInfo.cs
Normal file
39
Filtration.LootExplosionStudio/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
// General Information about an assembly is controlled through the following
|
||||||
|
// set of attributes. Change these attribute values to modify the information
|
||||||
|
// associated with an assembly.
|
||||||
|
[assembly: AssemblyTitle("Filtration.LootExplosionStudio")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("Microsoft")]
|
||||||
|
[assembly: AssemblyProduct("Filtration.LootExplosionStudio")]
|
||||||
|
[assembly: AssemblyCopyright("Copyright © Microsoft 2015")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
// Setting ComVisible to false makes the types in this assembly not visible
|
||||||
|
// to COM components. If you need to access a type in this assembly from
|
||||||
|
// COM, set the ComVisible attribute to true on that type.
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||||
|
[assembly: Guid("b33dec95-6eec-4e14-81d5-3d8ce0db77d1")]
|
||||||
|
|
||||||
|
// Version information for an assembly consists of the following four values:
|
||||||
|
//
|
||||||
|
// Major Version
|
||||||
|
// Minor Version
|
||||||
|
// Build Number
|
||||||
|
// Revision
|
||||||
|
//
|
||||||
|
// 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("1.0.0.0")]
|
||||||
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||||
|
|
||||||
|
[assembly: InternalsVisibleTo("Filtration.LootExplosionStudio.Tests")]
|
||||||
|
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")]
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
using System.Linq;
|
||||||
|
using Filtration.ObjectModel;
|
||||||
|
using Filtration.ObjectModel.BlockItemBaseTypes;
|
||||||
|
using Filtration.ObjectModel.LootExplosionStudio;
|
||||||
|
|
||||||
|
namespace Filtration.LootExplosionStudio.Services
|
||||||
|
{
|
||||||
|
internal interface IItemFilterBlockFinderService
|
||||||
|
{
|
||||||
|
ItemFilterBlock FindBlockForLootItem(LootItem lootItem, ItemFilterScript script);
|
||||||
|
}
|
||||||
|
|
||||||
|
internal class ItemFilterBlockFinderService : IItemFilterBlockFinderService
|
||||||
|
{
|
||||||
|
public ItemFilterBlock FindBlockForLootItem(LootItem lootItem, ItemFilterScript script)
|
||||||
|
{
|
||||||
|
return script.ItemFilterBlocks.FirstOrDefault(block => BlockMatchesLootItem(lootItem, block));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool BlockMatchesLootItem(LootItem lootItem, ItemFilterBlock block)
|
||||||
|
{
|
||||||
|
if (!block.BlockItems.OfType<StringListBlockItem>().All(blockItem => blockItem.MatchesLootItem(lootItem)))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
!block.BlockItems.OfType<NumericFilterPredicateBlockItem>()
|
||||||
|
.All(blockItem => blockItem.MatchesLootItem(lootItem)))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,80 @@
|
|||||||
|
using System.Linq;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using Filtration.ObjectModel;
|
||||||
|
using Filtration.ObjectModel.BlockItemTypes;
|
||||||
|
using Filtration.ObjectModel.Enums;
|
||||||
|
using Filtration.ObjectModel.LootExplosionStudio;
|
||||||
|
|
||||||
|
namespace Filtration.LootExplosionStudio.Services
|
||||||
|
{
|
||||||
|
internal interface ILootItemAppearanceService
|
||||||
|
{
|
||||||
|
void ProcessLootItemAgainstFilterScript(LootItem lootItem, ItemFilterScript script);
|
||||||
|
}
|
||||||
|
|
||||||
|
internal class LootItemAppearanceService : ILootItemAppearanceService
|
||||||
|
{
|
||||||
|
private readonly IItemFilterBlockFinderService _blockFinderService;
|
||||||
|
|
||||||
|
public LootItemAppearanceService(IItemFilterBlockFinderService blockFinderService)
|
||||||
|
{
|
||||||
|
_blockFinderService = blockFinderService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ProcessLootItemAgainstFilterScript(LootItem lootItem, ItemFilterScript script)
|
||||||
|
{
|
||||||
|
var matchedBlock = _blockFinderService.FindBlockForLootItem(lootItem, script);
|
||||||
|
if (matchedBlock == null)
|
||||||
|
{
|
||||||
|
lootItem.TextColor = GetDefaultTextColorForRarity(lootItem.Rarity);
|
||||||
|
lootItem.BackgroundColor = DefaultLootItemAppearanceConstants.BackgroundColor;
|
||||||
|
lootItem.BorderColor = DefaultLootItemAppearanceConstants.BorderColor;
|
||||||
|
lootItem.FontSize = 35;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
lootItem.TextColor = matchedBlock.HasBlockItemOfType<TextColorBlockItem>()
|
||||||
|
? matchedBlock.BlockItems.OfType<TextColorBlockItem>().First().Color
|
||||||
|
: GetDefaultTextColorForRarity(lootItem.Rarity);
|
||||||
|
|
||||||
|
lootItem.BackgroundColor = matchedBlock.HasBlockItemOfType<BackgroundColorBlockItem>()
|
||||||
|
? matchedBlock.BlockItems.OfType<BackgroundColorBlockItem>().First().Color
|
||||||
|
: DefaultLootItemAppearanceConstants.BackgroundColor;
|
||||||
|
|
||||||
|
lootItem.BorderColor = matchedBlock.HasBlockItemOfType<BorderColorBlockItem>()
|
||||||
|
? matchedBlock.BlockItems.OfType<BorderColorBlockItem>().First().Color
|
||||||
|
: DefaultLootItemAppearanceConstants.BorderColor;
|
||||||
|
|
||||||
|
lootItem.FontSize = matchedBlock.HasBlockItemOfType<FontSizeBlockItem>()
|
||||||
|
? matchedBlock.BlockItems.OfType<FontSizeBlockItem>().First().Value
|
||||||
|
: 35;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Color GetDefaultTextColorForRarity(ItemRarity rarity)
|
||||||
|
{
|
||||||
|
switch (rarity)
|
||||||
|
{
|
||||||
|
case ItemRarity.Normal:
|
||||||
|
{
|
||||||
|
return DefaultLootItemAppearanceConstants.NormalTextColor;
|
||||||
|
}
|
||||||
|
case ItemRarity.Magic:
|
||||||
|
{
|
||||||
|
return DefaultLootItemAppearanceConstants.MagicTextColor;
|
||||||
|
}
|
||||||
|
case ItemRarity.Rare:
|
||||||
|
{
|
||||||
|
return DefaultLootItemAppearanceConstants.RareTextColor;
|
||||||
|
}
|
||||||
|
case ItemRarity.Unique:
|
||||||
|
{
|
||||||
|
return DefaultLootItemAppearanceConstants.UniqueTextColor;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
return DefaultLootItemAppearanceConstants.NormalTextColor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
using Filtration.ObjectModel;
|
||||||
|
using Filtration.ObjectModel.LootExplosionStudio;
|
||||||
|
|
||||||
|
namespace Filtration.LootExplosionStudio.Services
|
||||||
|
{
|
||||||
|
internal interface ILootItemCollectionItemFilterCombinerService
|
||||||
|
{
|
||||||
|
void CombineLootItemCollectionWithItemFilterScript(LootItemCollection lootItemCollection,
|
||||||
|
ItemFilterScript script);
|
||||||
|
}
|
||||||
|
|
||||||
|
internal class LootItemCollectionItemFilterCombinerService : ILootItemCollectionItemFilterCombinerService
|
||||||
|
{
|
||||||
|
private readonly ILootItemAppearanceService _lootItemAppearanceService;
|
||||||
|
|
||||||
|
public LootItemCollectionItemFilterCombinerService(ILootItemAppearanceService lootItemAppearanceService)
|
||||||
|
{
|
||||||
|
_lootItemAppearanceService = lootItemAppearanceService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CombineLootItemCollectionWithItemFilterScript(LootItemCollection lootItemCollection,
|
||||||
|
ItemFilterScript script)
|
||||||
|
{
|
||||||
|
foreach (var lootItem in lootItemCollection)
|
||||||
|
{
|
||||||
|
_lootItemAppearanceService.ProcessLootItemAgainstFilterScript(lootItem, script);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
using Castle.MicroKernel.Registration;
|
||||||
|
using Castle.MicroKernel.SubSystems.Configuration;
|
||||||
|
using Castle.Windsor;
|
||||||
|
using Filtration.LootExplosionStudio.Services;
|
||||||
|
|
||||||
|
namespace Filtration.LootExplosionStudio.WindsorInstallers
|
||||||
|
{
|
||||||
|
class ServicesInstaller : IWindsorInstaller
|
||||||
|
{
|
||||||
|
public void Install(IWindsorContainer container, IConfigurationStore store)
|
||||||
|
{
|
||||||
|
container.Register(
|
||||||
|
Component.For<IItemFilterBlockFinderService>()
|
||||||
|
.ImplementedBy<ItemFilterBlockFinderService>()
|
||||||
|
.LifeStyle.Singleton);
|
||||||
|
|
||||||
|
container.Register(
|
||||||
|
Component.For<ILootItemAppearanceService>()
|
||||||
|
.ImplementedBy<LootItemAppearanceService>()
|
||||||
|
.LifeStyle.Singleton);
|
||||||
|
container.Register(
|
||||||
|
Component.For<ILootItemCollectionItemFilterCombinerService>()
|
||||||
|
.ImplementedBy<LootItemCollectionItemFilterCombinerService>()
|
||||||
|
.LifeStyle.Singleton);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
5
Filtration.LootExplosionStudio/packages.config
Normal file
5
Filtration.LootExplosionStudio/packages.config
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<packages>
|
||||||
|
<package id="Castle.Core" version="3.3.0" targetFramework="net451" />
|
||||||
|
<package id="Castle.Windsor" version="3.3.0" targetFramework="net451" />
|
||||||
|
</packages>
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
using System;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using Filtration.ObjectModel.BlockItemBaseTypes;
|
||||||
|
using Filtration.ObjectModel.BlockItemTypes;
|
||||||
|
using Filtration.ObjectModel.LootExplosionStudio;
|
||||||
|
using NUnit.Framework;
|
||||||
|
|
||||||
|
namespace Filtration.ObjectModel.Tests.BlockItemBaseTypes
|
||||||
|
{
|
||||||
|
[TestFixture]
|
||||||
|
public class TestBaseTypeBlockItem
|
||||||
|
{
|
||||||
|
[Test]
|
||||||
|
public void MatchesBlockItem_BlankLootItem_ReturnsFalse()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
|
||||||
|
var blockItem = new BaseTypeBlockItem();
|
||||||
|
var testInputLootItem = new LootItem();
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var result = blockItem.MatchesLootItem(testInputLootItem);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.IsFalse(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void MatchesBlockItem_StringMatch_ReturnsTrue()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var testInputBaseType = "Test Base Type";
|
||||||
|
|
||||||
|
var blockItem = new BaseTypeBlockItem();
|
||||||
|
blockItem.Items.Add("Testblah");
|
||||||
|
blockItem.Items.Add(testInputBaseType);
|
||||||
|
blockItem.Items.Add("Another Base Type");
|
||||||
|
|
||||||
|
var testInputLootItem = new LootItem { BaseType = testInputBaseType};
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var result = blockItem.MatchesLootItem(testInputLootItem);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.IsTrue(result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Filtration.ObjectModel.BlockItemTypes;
|
||||||
|
using Filtration.ObjectModel.LootExplosionStudio;
|
||||||
|
using NUnit.Framework;
|
||||||
|
|
||||||
|
namespace Filtration.ObjectModel.Tests.BlockItemBaseTypes
|
||||||
|
{
|
||||||
|
[TestFixture]
|
||||||
|
public class TestClassBlockItem
|
||||||
|
{
|
||||||
|
[Test]
|
||||||
|
public void MatchesBlockItem_BlankLootItem_ReturnsFalse()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
|
||||||
|
var blockItem = new ClassBlockItem();
|
||||||
|
var testInputLootItem = new LootItem();
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var result = blockItem.MatchesLootItem(testInputLootItem);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.IsFalse(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void MatchesBlockItem_StringMatch_ReturnsTrue()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var testInputClass = "Test Class";
|
||||||
|
|
||||||
|
var blockItem = new ClassBlockItem();
|
||||||
|
blockItem.Items.Add("Testblah");
|
||||||
|
blockItem.Items.Add(testInputClass);
|
||||||
|
blockItem.Items.Add("Another Base Type");
|
||||||
|
|
||||||
|
var testInputLootItem = new LootItem { Class = testInputClass };
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var result = blockItem.MatchesLootItem(testInputLootItem);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.IsTrue(result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,101 @@
|
|||||||
|
using Filtration.ObjectModel.BlockItemTypes;
|
||||||
|
using Filtration.ObjectModel.Enums;
|
||||||
|
using Filtration.ObjectModel.LootExplosionStudio;
|
||||||
|
using NUnit.Framework;
|
||||||
|
|
||||||
|
namespace Filtration.ObjectModel.Tests.BlockItemBaseTypes
|
||||||
|
{
|
||||||
|
[TestFixture]
|
||||||
|
public class TestItemLevelBlockItem
|
||||||
|
{
|
||||||
|
[Test]
|
||||||
|
public void MatchesBlockItem_NoMatch_ReturnsFalse()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
|
||||||
|
var blockItem = new ItemLevelBlockItem(FilterPredicateOperator.GreaterThan, 10);
|
||||||
|
var lootItem = new LootItem {ItemLevel = 5};
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var result = blockItem.MatchesLootItem(lootItem);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.IsFalse(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void MatchesBlockItem_EqualsMatch_ReturnsTrue()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
|
||||||
|
var blockItem = new ItemLevelBlockItem(FilterPredicateOperator.Equal, 10);
|
||||||
|
var lootItem = new LootItem { ItemLevel = 10 };
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var result = blockItem.MatchesLootItem(lootItem);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.IsTrue(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void MatchesBlockItem_GreaterThanMatch_ReturnsTrue()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
|
||||||
|
var blockItem = new ItemLevelBlockItem(FilterPredicateOperator.GreaterThan, 10);
|
||||||
|
var lootItem = new LootItem { ItemLevel = 50 };
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var result = blockItem.MatchesLootItem(lootItem);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.IsTrue(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void MatchesBlockItem_GreaterThanOrEqualMatch_ReturnsTrue()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
|
||||||
|
var blockItem = new ItemLevelBlockItem(FilterPredicateOperator.GreaterThanOrEqual, 10);
|
||||||
|
var lootItem = new LootItem { ItemLevel = 50 };
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var result = blockItem.MatchesLootItem(lootItem);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.IsTrue(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void MatchesBlockItem_LessThan_ReturnsTrue()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
|
||||||
|
var blockItem = new ItemLevelBlockItem(FilterPredicateOperator.LessThan, 10);
|
||||||
|
var lootItem = new LootItem { ItemLevel = 1 };
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var result = blockItem.MatchesLootItem(lootItem);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.IsTrue(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void MatchesBlockItem_LessThanOrEqual_ReturnsTrue()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
|
||||||
|
var blockItem = new ItemLevelBlockItem(FilterPredicateOperator.LessThanOrEqual, 10);
|
||||||
|
var lootItem = new LootItem { ItemLevel = 1 };
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var result = blockItem.MatchesLootItem(lootItem);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.IsTrue(result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,92 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Net.Sockets;
|
||||||
|
using Filtration.ObjectModel.BlockItemTypes;
|
||||||
|
using Filtration.ObjectModel.Enums;
|
||||||
|
using Filtration.ObjectModel.LootExplosionStudio;
|
||||||
|
using NUnit.Framework;
|
||||||
|
|
||||||
|
namespace Filtration.ObjectModel.Tests.BlockItemBaseTypes
|
||||||
|
{
|
||||||
|
[TestFixture]
|
||||||
|
public class TestSocketGroupBlockItem
|
||||||
|
{
|
||||||
|
[Test]
|
||||||
|
public void MatchesBlockItem_BlankLootItem_ReturnsFalse()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
|
||||||
|
var blockItem = new SocketGroupBlockItem();
|
||||||
|
var testInputLootItem = new LootItem();
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var result = blockItem.MatchesLootItem(testInputLootItem);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.IsFalse(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void MatchesBlockItem_SocketsMatch_ReturnsTrue()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var testInputSocketGroups = new List<SocketGroup>();
|
||||||
|
var testInputSocketGroup1 = new SocketGroup();
|
||||||
|
var testInputSocketGroup2 = new SocketGroup();
|
||||||
|
testInputSocketGroup1.Sockets = new List<SocketColor> {SocketColor.Blue, SocketColor.Red};
|
||||||
|
testInputSocketGroup2.Sockets = new List<SocketColor>
|
||||||
|
{
|
||||||
|
SocketColor.Blue,
|
||||||
|
SocketColor.Blue,
|
||||||
|
SocketColor.Blue,
|
||||||
|
SocketColor.Red
|
||||||
|
};
|
||||||
|
|
||||||
|
testInputSocketGroups.Add(testInputSocketGroup1);
|
||||||
|
testInputSocketGroups.Add(testInputSocketGroup2);
|
||||||
|
|
||||||
|
var blockItem = new SocketGroupBlockItem();
|
||||||
|
blockItem.Items.Add("RRG");
|
||||||
|
blockItem.Items.Add("BRB");
|
||||||
|
|
||||||
|
var testInputLootItem = new LootItem {SocketGroups = testInputSocketGroups};
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var result = blockItem.MatchesLootItem(testInputLootItem);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.IsTrue(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void MatchesBlockItem_SocketsAlmostMatch_ReturnsFalse()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var testInputSocketGroups = new List<SocketGroup>();
|
||||||
|
var testInputSocketGroup1 = new SocketGroup();
|
||||||
|
var testInputSocketGroup2 = new SocketGroup();
|
||||||
|
testInputSocketGroup1.Sockets = new List<SocketColor> { SocketColor.Blue, SocketColor.Red };
|
||||||
|
testInputSocketGroup2.Sockets = new List<SocketColor>
|
||||||
|
{
|
||||||
|
SocketColor.Blue,
|
||||||
|
SocketColor.Blue,
|
||||||
|
SocketColor.Blue,
|
||||||
|
SocketColor.Red,
|
||||||
|
SocketColor.Green
|
||||||
|
};
|
||||||
|
|
||||||
|
testInputSocketGroups.Add(testInputSocketGroup1);
|
||||||
|
testInputSocketGroups.Add(testInputSocketGroup2);
|
||||||
|
|
||||||
|
var blockItem = new SocketGroupBlockItem();
|
||||||
|
blockItem.Items.Add("BGBRWB");
|
||||||
|
|
||||||
|
var testInputLootItem = new LootItem { SocketGroups = testInputSocketGroups };
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var result = blockItem.MatchesLootItem(testInputLootItem);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.IsFalse(result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ProjectGuid>{537BE676-2FF6-4995-B05B-9CFACE852EC9}</ProjectGuid>
|
||||||
|
<OutputType>Library</OutputType>
|
||||||
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
|
<RootNamespace>Filtration.ObjectModel.Tests</RootNamespace>
|
||||||
|
<AssemblyName>Filtration.ObjectModel.Tests</AssemblyName>
|
||||||
|
<TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
|
||||||
|
<FileAlignment>512</FileAlignment>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>bin\Debug\</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\Release\</OutputPath>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="Moq">
|
||||||
|
<HintPath>..\packages\Moq.4.2.1506.2016\lib\net40\Moq.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="nunit.framework">
|
||||||
|
<HintPath>..\packages\NUnit.2.6.4\lib\nunit.framework.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="PresentationCore" />
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="System.Xml.Linq" />
|
||||||
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
|
<Reference Include="Microsoft.CSharp" />
|
||||||
|
<Reference Include="System.Data" />
|
||||||
|
<Reference Include="System.Xml" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="BlockItemBaseTypes\TestBaseTypeBlockItem.cs" />
|
||||||
|
<Compile Include="BlockItemBaseTypes\TestClassBlockItem.cs" />
|
||||||
|
<Compile Include="BlockItemBaseTypes\TestItemLevelBlockItem.cs" />
|
||||||
|
<Compile Include="BlockItemBaseTypes\TestSocketGroupBlockItem.cs" />
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
<Compile Include="TestItemFilterBlock.cs" />
|
||||||
|
<Compile Include="TestItemFilterBlockGroup.cs" />
|
||||||
|
<Compile Include="TestItemFilterScript.cs" />
|
||||||
|
<Compile Include="ThemeEditor\TestThemeComponentCollection.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\Filtration.ObjectModel\Filtration.ObjectModel.csproj">
|
||||||
|
<Project>{4aac3beb-1dc1-483e-9d11-0e9334e80227}</Project>
|
||||||
|
<Name>Filtration.ObjectModel</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="packages.config" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup />
|
||||||
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
|
<Target Name="BeforeBuild">
|
||||||
|
</Target>
|
||||||
|
<Target Name="AfterBuild">
|
||||||
|
</Target>
|
||||||
|
-->
|
||||||
|
</Project>
|
||||||
35
Filtration.ObjectModel.Tests/Properties/AssemblyInfo.cs
Normal file
35
Filtration.ObjectModel.Tests/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
// General Information about an assembly is controlled through the following
|
||||||
|
// set of attributes. Change these attribute values to modify the information
|
||||||
|
// associated with an assembly.
|
||||||
|
[assembly: AssemblyTitle("Filtration.ObjectModel.Tests")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("Microsoft")]
|
||||||
|
[assembly: AssemblyProduct("Filtration.ObjectModel.Tests")]
|
||||||
|
[assembly: AssemblyCopyright("Copyright © Microsoft 2015")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
// Setting ComVisible to false makes the types in this assembly not visible
|
||||||
|
// to COM components. If you need to access a type in this assembly from
|
||||||
|
// COM, set the ComVisible attribute to true on that type.
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||||
|
[assembly: Guid("7ed27cde-6bc5-4d11-b45d-8823de2077ce")]
|
||||||
|
|
||||||
|
// Version information for an assembly consists of the following four values:
|
||||||
|
//
|
||||||
|
// Major Version
|
||||||
|
// Minor Version
|
||||||
|
// Build Number
|
||||||
|
// Revision
|
||||||
|
//
|
||||||
|
// 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("1.0.0.0")]
|
||||||
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||||
71
Filtration.ObjectModel.Tests/TestItemFilterBlock.cs
Normal file
71
Filtration.ObjectModel.Tests/TestItemFilterBlock.cs
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
using Filtration.ObjectModel.BlockItemTypes;
|
||||||
|
using NUnit.Framework;
|
||||||
|
|
||||||
|
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()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var block = new ItemFilterBlock();
|
||||||
|
block.BlockItems.Add(new ItemLevelBlockItem());
|
||||||
|
|
||||||
|
// Act
|
||||||
|
bool result = block.AddBlockItemAllowed(typeof (ItemLevelBlockItem));
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.IsTrue(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void ItemFilterBlock_AddBlockItemAllowed_MoreThanMaximum_ReturnsFalse()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var block = new ItemFilterBlock();
|
||||||
|
block.BlockItems.Add(new SoundBlockItem());
|
||||||
|
|
||||||
|
// Act
|
||||||
|
bool result = block.AddBlockItemAllowed(typeof (SoundBlockItem));
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.IsFalse(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void HasParentInBlockGroupHierarchy_ReturnsCorrectResult()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var testInputRootBlockGroup = new ItemFilterBlockGroup("Root Block Group", null);
|
||||||
|
var testInputSubBlockGroup = new ItemFilterBlockGroup("Sub Block Group", testInputRootBlockGroup);
|
||||||
|
var testInputSubSubBlockGroup = new ItemFilterBlockGroup("Sub Sub Block Group", testInputSubBlockGroup);
|
||||||
|
|
||||||
|
var block = new ItemFilterBlock {BlockGroup = testInputSubSubBlockGroup};
|
||||||
|
|
||||||
|
// Act
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.AreEqual(true, block.HasBlockGroupInParentHierarchy(testInputRootBlockGroup, block.BlockGroup));
|
||||||
|
Assert.AreEqual(true, block.HasBlockGroupInParentHierarchy(testInputSubBlockGroup, block.BlockGroup));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
42
Filtration.ObjectModel.Tests/TestItemFilterBlockGroup.cs
Normal file
42
Filtration.ObjectModel.Tests/TestItemFilterBlockGroup.cs
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
using NUnit.Framework;
|
||||||
|
|
||||||
|
namespace Filtration.ObjectModel.Tests
|
||||||
|
{
|
||||||
|
[TestFixture]
|
||||||
|
public class TestItemFilterBlockGroup
|
||||||
|
{
|
||||||
|
[Test]
|
||||||
|
public void ToString_ReturnsFullBlockHierarchy()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
const string ExpectedResult = "Child 1 Block Group - Child 2 Block Group";
|
||||||
|
|
||||||
|
var rootBlockGroup = new ItemFilterBlockGroup("Root Block Group", null);
|
||||||
|
var child1BlockGroup = new ItemFilterBlockGroup("Child 1 Block Group", rootBlockGroup);
|
||||||
|
var child2BlockGroup = new ItemFilterBlockGroup("Child 2 Block Group", child1BlockGroup);
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var result = child2BlockGroup.ToString();
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.AreEqual(ExpectedResult, result);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void ToString_AddsTildeForAdvancedBlock()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
const string ExpectedResult = "~Child 1 Block Group - Child 2 Block Group";
|
||||||
|
|
||||||
|
var rootBlockGroup = new ItemFilterBlockGroup("Root Block Group", null);
|
||||||
|
var child1BlockGroup = new ItemFilterBlockGroup("Child 1 Block Group", rootBlockGroup, true);
|
||||||
|
var child2BlockGroup = new ItemFilterBlockGroup("Child 2 Block Group", child1BlockGroup);
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var result = child2BlockGroup.ToString();
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.AreEqual(ExpectedResult, result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,25 +1,19 @@
|
|||||||
using System;
|
using System.Linq;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Collections.ObjectModel;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using Filtration.Models;
|
using Filtration.ObjectModel.BlockItemTypes;
|
||||||
using Filtration.Models.BlockItemTypes;
|
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
|
||||||
namespace Filtration.Tests.Models
|
namespace Filtration.ObjectModel.Tests
|
||||||
{
|
{
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class TestLootFilterScript
|
public class TestItemFilterScript
|
||||||
{
|
{
|
||||||
[Test]
|
[Test]
|
||||||
public void Validate_AtLeastOneBlock_Fail_ReturnsListWithCorrectError()
|
public void Validate_AtLeastOneBlock_Fail_ReturnsListWithCorrectError()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
|
|
||||||
var script = new LootFilterScript();
|
var script = new ItemFilterScript();
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
var result = script.Validate();
|
var result = script.Validate();
|
||||||
@@ -33,10 +27,8 @@ namespace Filtration.Tests.Models
|
|||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
|
|
||||||
var script = new LootFilterScript
|
var script = new ItemFilterScript();
|
||||||
{
|
script.ItemFilterBlocks.Add(new ItemFilterBlock());
|
||||||
LootFilterBlocks = new ObservableCollection<LootFilterBlock> {new LootFilterBlock()}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
var result = script.Validate();
|
var result = script.Validate();
|
||||||
@@ -59,22 +51,19 @@ namespace Filtration.Tests.Models
|
|||||||
ReplaceBackgroundColor = true
|
ReplaceBackgroundColor = true
|
||||||
};
|
};
|
||||||
|
|
||||||
var testInputBlock1 = new LootFilterBlock();
|
var testInputBlock1 = new ItemFilterBlock();
|
||||||
testInputBlock1.BlockItems.Add(new BackgroundColorBlockItem(new Color {A = 255, R = 255, G = 0, B = 0}));
|
testInputBlock1.BlockItems.Add(new BackgroundColorBlockItem(new Color {A = 255, R = 255, G = 0, B = 0}));
|
||||||
var testInputBlock2 = new LootFilterBlock();
|
var testInputBlock2 = new ItemFilterBlock();
|
||||||
testInputBlock2.BlockItems.Add(new BackgroundColorBlockItem(new Color { A = 255, R = 255, G = 1, B = 0 }));
|
testInputBlock2.BlockItems.Add(new BackgroundColorBlockItem(new Color { A = 255, R = 255, G = 1, B = 0 }));
|
||||||
var testInputBlock3 = new LootFilterBlock();
|
var testInputBlock3 = new ItemFilterBlock();
|
||||||
testInputBlock3.BlockItems.Add(new BackgroundColorBlockItem(new Color { A = 255, R = 255, G = 0, B = 0 }));
|
testInputBlock3.BlockItems.Add(new BackgroundColorBlockItem(new Color { A = 255, R = 255, G = 0, B = 0 }));
|
||||||
|
|
||||||
var script = new LootFilterScript()
|
var script = new ItemFilterScript();
|
||||||
{
|
|
||||||
LootFilterBlocks = new ObservableCollection<LootFilterBlock>
|
script.ItemFilterBlocks.Add(testInputBlock1);
|
||||||
{
|
script.ItemFilterBlocks.Add(testInputBlock2);
|
||||||
testInputBlock1,
|
script.ItemFilterBlocks.Add(testInputBlock3);
|
||||||
testInputBlock2,
|
|
||||||
testInputBlock3
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
script.ReplaceColors(testInputReplaceColors);
|
script.ReplaceColors(testInputReplaceColors);
|
||||||
@@ -105,21 +94,16 @@ namespace Filtration.Tests.Models
|
|||||||
ReplaceTextColor = true
|
ReplaceTextColor = true
|
||||||
};
|
};
|
||||||
|
|
||||||
var testInputBlock1 = new LootFilterBlock();
|
var testInputBlock1 = new ItemFilterBlock();
|
||||||
testInputBlock1.BlockItems.Add(new BackgroundColorBlockItem(oldBackgroundColor));
|
testInputBlock1.BlockItems.Add(new BackgroundColorBlockItem(oldBackgroundColor));
|
||||||
testInputBlock1.BlockItems.Add(new TextColorBlockItem(oldTextColor));
|
testInputBlock1.BlockItems.Add(new TextColorBlockItem(oldTextColor));
|
||||||
var testInputBlock2 = new LootFilterBlock();
|
var testInputBlock2 = new ItemFilterBlock();
|
||||||
testInputBlock2.BlockItems.Add(new BackgroundColorBlockItem(oldBackgroundColor));
|
testInputBlock2.BlockItems.Add(new BackgroundColorBlockItem(oldBackgroundColor));
|
||||||
testInputBlock2.BlockItems.Add(new TextColorBlockItem(new Color {A = 1, R = 2, G = 3, B = 4}));
|
testInputBlock2.BlockItems.Add(new TextColorBlockItem(new Color {A = 1, R = 2, G = 3, B = 4}));
|
||||||
|
|
||||||
var script = new LootFilterScript
|
var script = new ItemFilterScript();
|
||||||
{
|
script.ItemFilterBlocks.Add(testInputBlock1);
|
||||||
LootFilterBlocks = new ObservableCollection<LootFilterBlock>
|
script.ItemFilterBlocks.Add(testInputBlock2);
|
||||||
{
|
|
||||||
testInputBlock1,
|
|
||||||
testInputBlock2
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
script.ReplaceColors(testInputReplaceColors);
|
script.ReplaceColors(testInputReplaceColors);
|
||||||
@@ -135,3 +119,4 @@ namespace Filtration.Tests.Models
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
using System.Windows.Media;
|
||||||
|
using Filtration.ObjectModel.Enums;
|
||||||
|
using Filtration.ObjectModel.ThemeEditor;
|
||||||
|
using NUnit.Framework;
|
||||||
|
|
||||||
|
namespace Filtration.ObjectModel.Tests.ThemeEditor
|
||||||
|
{
|
||||||
|
[TestFixture]
|
||||||
|
public class TestThemeComponentCollection
|
||||||
|
{
|
||||||
|
[Test]
|
||||||
|
public void AddComponent_ReturnsFirstAddedComponent_WhenComponentAddedTwice()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
|
||||||
|
var testInputTargetType = ThemeComponentType.TextColor;
|
||||||
|
var testInputComponentName = "testComponent";
|
||||||
|
var testInputColor = new Color();
|
||||||
|
|
||||||
|
var componentCollection = new ThemeComponentCollection();
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var firstResult = componentCollection.AddComponent(testInputTargetType, testInputComponentName, testInputColor);
|
||||||
|
var secondResult = componentCollection.AddComponent(testInputTargetType, testInputComponentName, testInputColor);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.AreSame(firstResult, secondResult);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
5
Filtration.ObjectModel.Tests/packages.config
Normal file
5
Filtration.ObjectModel.Tests/packages.config
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<packages>
|
||||||
|
<package id="Moq" version="4.2.1506.2016" targetFramework="net451" />
|
||||||
|
<package id="NUnit" version="2.6.4" targetFramework="net451" />
|
||||||
|
</packages>
|
||||||
@@ -1,9 +1,11 @@
|
|||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using Filtration.Enums;
|
using Filtration.ObjectModel.Enums;
|
||||||
|
using Filtration.ObjectModel.Extensions;
|
||||||
|
using Filtration.ObjectModel.LootExplosionStudio;
|
||||||
|
|
||||||
namespace Filtration.Models.BlockItemBaseTypes
|
namespace Filtration.ObjectModel.BlockItemBaseTypes
|
||||||
{
|
{
|
||||||
internal class ActionBlockItem : BlockItemBase
|
public class ActionBlockItem : BlockItemBase
|
||||||
{
|
{
|
||||||
private BlockAction _action;
|
private BlockAction _action;
|
||||||
|
|
||||||
@@ -25,6 +27,11 @@ namespace Filtration.Models.BlockItemBaseTypes
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override string OutputText
|
||||||
|
{
|
||||||
|
get { return Action.GetAttributeDescription(); }
|
||||||
|
}
|
||||||
|
|
||||||
public override string PrefixText
|
public override string PrefixText
|
||||||
{
|
{
|
||||||
get { return string.Empty; }
|
get { return string.Empty; }
|
||||||
@@ -1,13 +1,14 @@
|
|||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using Filtration.Annotations;
|
using Filtration.ObjectModel.Annotations;
|
||||||
|
|
||||||
namespace Filtration.Models.BlockItemBaseTypes
|
namespace Filtration.ObjectModel.BlockItemBaseTypes
|
||||||
{
|
{
|
||||||
abstract class BlockItemBase : ILootFilterBlockItem
|
public abstract class BlockItemBase : IItemFilterBlockItem
|
||||||
{
|
{
|
||||||
public abstract string PrefixText { get; }
|
public abstract string PrefixText { get; }
|
||||||
|
public abstract string OutputText { get; }
|
||||||
public abstract int MaximumAllowed { get; }
|
public abstract int MaximumAllowed { get; }
|
||||||
public abstract string DisplayHeading { get; }
|
public abstract string DisplayHeading { get; }
|
||||||
public abstract string SummaryText { get; }
|
public abstract string SummaryText { get; }
|
||||||
@@ -16,6 +17,7 @@ namespace Filtration.Models.BlockItemBaseTypes
|
|||||||
public abstract int SortOrder { get; }
|
public abstract int SortOrder { get; }
|
||||||
|
|
||||||
public event PropertyChangedEventHandler PropertyChanged;
|
public event PropertyChangedEventHandler PropertyChanged;
|
||||||
|
|
||||||
[NotifyPropertyChangedInvocator]
|
[NotifyPropertyChangedInvocator]
|
||||||
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
||||||
{
|
{
|
||||||
83
Filtration.ObjectModel/BlockItemBaseTypes/ColorBlockItem.cs
Normal file
83
Filtration.ObjectModel/BlockItemBaseTypes/ColorBlockItem.cs
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
using System;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using Filtration.ObjectModel.LootExplosionStudio;
|
||||||
|
using Filtration.ObjectModel.ThemeEditor;
|
||||||
|
|
||||||
|
namespace Filtration.ObjectModel.BlockItemBaseTypes
|
||||||
|
{
|
||||||
|
public abstract class ColorBlockItem : BlockItemBase, IAudioVisualBlockItem
|
||||||
|
{
|
||||||
|
private Color _color;
|
||||||
|
private ThemeComponent _themeComponent;
|
||||||
|
|
||||||
|
protected ColorBlockItem()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected ColorBlockItem(Color color)
|
||||||
|
{
|
||||||
|
Color = color;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string OutputText
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return PrefixText + " " + +Color.R + " " + Color.G + " "
|
||||||
|
+ Color.B + (Color.A < 255 ? " " + Color.A : string.Empty) +
|
||||||
|
(ThemeComponent != null ? " # " + ThemeComponent.ComponentName : string.Empty);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string SummaryText
|
||||||
|
{
|
||||||
|
get { return string.Empty; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public ThemeComponent ThemeComponent
|
||||||
|
{
|
||||||
|
get { return _themeComponent; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (_themeComponent == value){ return;}
|
||||||
|
|
||||||
|
if (_themeComponent != null)
|
||||||
|
{
|
||||||
|
_themeComponent.ThemeComponentUpdated -= OnThemeComponentUpdated;
|
||||||
|
_themeComponent.ThemeComponentDeleted -= OnThemeComponentDeleted;
|
||||||
|
}
|
||||||
|
if (value != null)
|
||||||
|
{
|
||||||
|
value.ThemeComponentUpdated += OnThemeComponentUpdated;
|
||||||
|
value.ThemeComponentDeleted += OnThemeComponentDeleted;
|
||||||
|
}
|
||||||
|
|
||||||
|
_themeComponent = value;
|
||||||
|
OnPropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Color SummaryBackgroundColor { get { return Colors.Transparent; } }
|
||||||
|
public override Color SummaryTextColor { get { return Colors.Transparent; } }
|
||||||
|
|
||||||
|
public Color Color
|
||||||
|
{
|
||||||
|
get { return _color; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_color = value;
|
||||||
|
OnPropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnThemeComponentUpdated(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Color = ((ThemeComponent) sender).Color;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnThemeComponentDeleted(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
ThemeComponent = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,8 +1,9 @@
|
|||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
|
using Filtration.ObjectModel.LootExplosionStudio;
|
||||||
|
|
||||||
namespace Filtration.Models.BlockItemBaseTypes
|
namespace Filtration.ObjectModel.BlockItemBaseTypes
|
||||||
{
|
{
|
||||||
internal abstract class DualIntegerBlockItem : BlockItemBase, IAudioVisualBlockItem
|
public abstract class DualIntegerBlockItem : BlockItemBase, IAudioVisualBlockItem
|
||||||
{
|
{
|
||||||
private int _value;
|
private int _value;
|
||||||
private int _secondValue;
|
private int _secondValue;
|
||||||
@@ -17,6 +18,11 @@ namespace Filtration.Models.BlockItemBaseTypes
|
|||||||
SecondValue = secondValue;
|
SecondValue = secondValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override string OutputText
|
||||||
|
{
|
||||||
|
get { return PrefixText + " " + Value + " " + SecondValue; }
|
||||||
|
}
|
||||||
|
|
||||||
public override string SummaryText { get { return string.Empty; } }
|
public override string SummaryText { get { return string.Empty; } }
|
||||||
public override Color SummaryBackgroundColor { get { return Colors.Transparent; } }
|
public override Color SummaryBackgroundColor { get { return Colors.Transparent; } }
|
||||||
public override Color SummaryTextColor { get { return Colors.Transparent; } }
|
public override Color SummaryTextColor { get { return Colors.Transparent; } }
|
||||||
@@ -1,8 +1,9 @@
|
|||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
|
using Filtration.ObjectModel.LootExplosionStudio;
|
||||||
|
|
||||||
namespace Filtration.Models.BlockItemBaseTypes
|
namespace Filtration.ObjectModel.BlockItemBaseTypes
|
||||||
{
|
{
|
||||||
internal abstract class IntegerBlockItem : BlockItemBase, IAudioVisualBlockItem
|
public abstract class IntegerBlockItem : BlockItemBase, IAudioVisualBlockItem
|
||||||
{
|
{
|
||||||
private int _value;
|
private int _value;
|
||||||
|
|
||||||
@@ -15,6 +16,11 @@ namespace Filtration.Models.BlockItemBaseTypes
|
|||||||
Value = value;
|
Value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override string OutputText
|
||||||
|
{
|
||||||
|
get { return PrefixText + " " + Value; }
|
||||||
|
}
|
||||||
|
|
||||||
public override string SummaryText { get { return string.Empty; } }
|
public override string SummaryText { get { return string.Empty; } }
|
||||||
public override Color SummaryBackgroundColor { get { return Colors.Transparent; } }
|
public override Color SummaryBackgroundColor { get { return Colors.Transparent; } }
|
||||||
public override Color SummaryTextColor { get { return Colors.Transparent; } }
|
public override Color SummaryTextColor { get { return Colors.Transparent; } }
|
||||||
@@ -0,0 +1,92 @@
|
|||||||
|
using System;
|
||||||
|
using Filtration.ObjectModel.Enums;
|
||||||
|
using Filtration.ObjectModel.Extensions;
|
||||||
|
using Filtration.ObjectModel.LootExplosionStudio;
|
||||||
|
|
||||||
|
namespace Filtration.ObjectModel.BlockItemBaseTypes
|
||||||
|
{
|
||||||
|
public abstract class NumericFilterPredicateBlockItem : BlockItemBase
|
||||||
|
{
|
||||||
|
private NumericFilterPredicate _filterPredicate;
|
||||||
|
|
||||||
|
protected NumericFilterPredicateBlockItem()
|
||||||
|
{
|
||||||
|
FilterPredicate = new NumericFilterPredicate();
|
||||||
|
FilterPredicate.PropertyChanged += OnFilterPredicateChanged;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected NumericFilterPredicateBlockItem(FilterPredicateOperator predicateOperator, int predicateOperand)
|
||||||
|
{
|
||||||
|
FilterPredicate = new NumericFilterPredicate(predicateOperator, predicateOperand);
|
||||||
|
FilterPredicate.PropertyChanged += OnFilterPredicateChanged;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string OutputText
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return PrefixText + " " + FilterPredicate.PredicateOperator.GetAttributeDescription() +
|
||||||
|
" " + FilterPredicate.PredicateOperand;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract int Minimum { get; }
|
||||||
|
public abstract int Maximum { get; }
|
||||||
|
|
||||||
|
public NumericFilterPredicate FilterPredicate
|
||||||
|
{
|
||||||
|
get { return _filterPredicate; }
|
||||||
|
protected set
|
||||||
|
{
|
||||||
|
_filterPredicate = value;
|
||||||
|
OnPropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnFilterPredicateChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
OnPropertyChanged("FilterPredicate");
|
||||||
|
OnPropertyChanged("SummaryText");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public abstract int GetLootItemProperty(LootItem lootItem);
|
||||||
|
|
||||||
|
public virtual bool MatchesLootItem(LootItem lootItem)
|
||||||
|
{
|
||||||
|
var lootItemProperty = GetLootItemProperty(lootItem);
|
||||||
|
var predicateOperand = FilterPredicate.PredicateOperand;
|
||||||
|
|
||||||
|
switch (FilterPredicate.PredicateOperator)
|
||||||
|
{
|
||||||
|
case FilterPredicateOperator.Equal:
|
||||||
|
{
|
||||||
|
return lootItemProperty == predicateOperand;
|
||||||
|
}
|
||||||
|
case FilterPredicateOperator.GreaterThan:
|
||||||
|
{
|
||||||
|
return lootItemProperty > predicateOperand;
|
||||||
|
}
|
||||||
|
case FilterPredicateOperator.GreaterThanOrEqual:
|
||||||
|
{
|
||||||
|
return lootItemProperty >= predicateOperand;
|
||||||
|
}
|
||||||
|
case FilterPredicateOperator.LessThan:
|
||||||
|
{
|
||||||
|
return lootItemProperty < predicateOperand;
|
||||||
|
}
|
||||||
|
case FilterPredicateOperator.LessThanOrEqual:
|
||||||
|
{
|
||||||
|
return lootItemProperty <= predicateOperand;
|
||||||
|
}
|
||||||
|
case FilterPredicateOperator.NotEqual:
|
||||||
|
{
|
||||||
|
return lootItemProperty != predicateOperand;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Collections.Specialized;
|
||||||
|
using System.Linq;
|
||||||
|
using Filtration.ObjectModel.LootExplosionStudio;
|
||||||
|
|
||||||
|
namespace Filtration.ObjectModel.BlockItemBaseTypes
|
||||||
|
{
|
||||||
|
public abstract class StringListBlockItem : BlockItemBase
|
||||||
|
{
|
||||||
|
protected StringListBlockItem()
|
||||||
|
{
|
||||||
|
Items = new ObservableCollection<string>();
|
||||||
|
Items.CollectionChanged += OnItemsCollectionChanged;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string OutputText
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
var enumerable = Items as IList<string> ?? Items.ToList();
|
||||||
|
if (enumerable.Count > 0)
|
||||||
|
{
|
||||||
|
return PrefixText + " " +
|
||||||
|
string.Format("\"{0}\"",
|
||||||
|
string.Join("\" \"", enumerable.ToArray()));
|
||||||
|
}
|
||||||
|
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ObservableCollection<string> Items { get; protected set; }
|
||||||
|
|
||||||
|
private void OnItemsCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
|
||||||
|
{
|
||||||
|
OnPropertyChanged("Items");
|
||||||
|
OnPropertyChanged("SummaryText");
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract string GetLootItemProperty(LootItem lootItem);
|
||||||
|
|
||||||
|
public virtual bool MatchesLootItem(LootItem lootItem)
|
||||||
|
{
|
||||||
|
return Items.Any(i => i == GetLootItemProperty(lootItem));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using Filtration.Models.BlockItemBaseTypes;
|
using Filtration.ObjectModel.BlockItemBaseTypes;
|
||||||
|
|
||||||
namespace Filtration.Models.BlockItemTypes
|
namespace Filtration.ObjectModel.BlockItemTypes
|
||||||
{
|
{
|
||||||
internal class BackgroundColorBlockItem : ColorBlockItem
|
public class BackgroundColorBlockItem : ColorBlockItem
|
||||||
{
|
{
|
||||||
public BackgroundColorBlockItem()
|
public BackgroundColorBlockItem()
|
||||||
{
|
{
|
||||||
@@ -1,10 +1,11 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using Filtration.Models.BlockItemBaseTypes;
|
using Filtration.ObjectModel.BlockItemBaseTypes;
|
||||||
|
using Filtration.ObjectModel.LootExplosionStudio;
|
||||||
|
|
||||||
namespace Filtration.Models.BlockItemTypes
|
namespace Filtration.ObjectModel.BlockItemTypes
|
||||||
{
|
{
|
||||||
internal class BaseTypeBlockItem : StringListBlockItem
|
public class BaseTypeBlockItem : StringListBlockItem
|
||||||
{
|
{
|
||||||
public override string PrefixText { get { return "BaseType"; } }
|
public override string PrefixText { get { return "BaseType"; } }
|
||||||
|
|
||||||
@@ -56,5 +57,10 @@ namespace Filtration.Models.BlockItemTypes
|
|||||||
{
|
{
|
||||||
get { return 11; }
|
get { return 11; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override string GetLootItemProperty(LootItem lootItem)
|
||||||
|
{
|
||||||
|
return lootItem.BaseType;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using Filtration.Models.BlockItemBaseTypes;
|
using Filtration.ObjectModel.BlockItemBaseTypes;
|
||||||
|
|
||||||
namespace Filtration.Models.BlockItemTypes
|
namespace Filtration.ObjectModel.BlockItemTypes
|
||||||
{
|
{
|
||||||
internal class BorderColorBlockItem : ColorBlockItem
|
public class BorderColorBlockItem : ColorBlockItem
|
||||||
{
|
{
|
||||||
public BorderColorBlockItem()
|
public BorderColorBlockItem()
|
||||||
{
|
{
|
||||||
@@ -1,10 +1,11 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using Filtration.Models.BlockItemBaseTypes;
|
using Filtration.ObjectModel.BlockItemBaseTypes;
|
||||||
|
using Filtration.ObjectModel.LootExplosionStudio;
|
||||||
|
|
||||||
namespace Filtration.Models.BlockItemTypes
|
namespace Filtration.ObjectModel.BlockItemTypes
|
||||||
{
|
{
|
||||||
internal class ClassBlockItem : StringListBlockItem
|
public class ClassBlockItem : StringListBlockItem
|
||||||
{
|
{
|
||||||
public override string PrefixText { get { return "Class"; } }
|
public override string PrefixText { get { return "Class"; } }
|
||||||
|
|
||||||
@@ -50,5 +51,10 @@ namespace Filtration.Models.BlockItemTypes
|
|||||||
{
|
{
|
||||||
get { return 10; }
|
get { return 10; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override string GetLootItemProperty(LootItem lootItem)
|
||||||
|
{
|
||||||
|
return lootItem.Class;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,10 +1,11 @@
|
|||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using Filtration.Enums;
|
using Filtration.ObjectModel.BlockItemBaseTypes;
|
||||||
using Filtration.Models.BlockItemBaseTypes;
|
using Filtration.ObjectModel.Enums;
|
||||||
|
using Filtration.ObjectModel.LootExplosionStudio;
|
||||||
|
|
||||||
namespace Filtration.Models.BlockItemTypes
|
namespace Filtration.ObjectModel.BlockItemTypes
|
||||||
{
|
{
|
||||||
internal class DropLevelBlockItem : NumericFilterPredicateBlockItem
|
public class DropLevelBlockItem : NumericFilterPredicateBlockItem
|
||||||
{
|
{
|
||||||
public DropLevelBlockItem()
|
public DropLevelBlockItem()
|
||||||
{
|
{
|
||||||
@@ -68,5 +69,10 @@ namespace Filtration.Models.BlockItemTypes
|
|||||||
return 100;
|
return 100;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override int GetLootItemProperty(LootItem lootItem)
|
||||||
|
{
|
||||||
|
return lootItem.DropLevel;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,11 +1,12 @@
|
|||||||
using Filtration.Models.BlockItemBaseTypes;
|
using Filtration.ObjectModel.BlockItemBaseTypes;
|
||||||
|
|
||||||
namespace Filtration.Models.BlockItemTypes
|
namespace Filtration.ObjectModel.BlockItemTypes
|
||||||
{
|
{
|
||||||
internal class FontSizeBlockItem : IntegerBlockItem
|
public class FontSizeBlockItem : IntegerBlockItem
|
||||||
{
|
{
|
||||||
public FontSizeBlockItem()
|
public FontSizeBlockItem()
|
||||||
{
|
{
|
||||||
|
Value = 35;
|
||||||
}
|
}
|
||||||
|
|
||||||
public FontSizeBlockItem(int value) : base(value)
|
public FontSizeBlockItem(int value) : base(value)
|
||||||
@@ -1,10 +1,11 @@
|
|||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using Filtration.Enums;
|
using Filtration.ObjectModel.BlockItemBaseTypes;
|
||||||
using Filtration.Models.BlockItemBaseTypes;
|
using Filtration.ObjectModel.Enums;
|
||||||
|
using Filtration.ObjectModel.LootExplosionStudio;
|
||||||
|
|
||||||
namespace Filtration.Models.BlockItemTypes
|
namespace Filtration.ObjectModel.BlockItemTypes
|
||||||
{
|
{
|
||||||
internal class HeightBlockItem : NumericFilterPredicateBlockItem
|
public class HeightBlockItem : NumericFilterPredicateBlockItem
|
||||||
{
|
{
|
||||||
public HeightBlockItem()
|
public HeightBlockItem()
|
||||||
{
|
{
|
||||||
@@ -65,5 +66,10 @@ namespace Filtration.Models.BlockItemTypes
|
|||||||
return 6;
|
return 6;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override int GetLootItemProperty(LootItem lootItem)
|
||||||
|
{
|
||||||
|
return lootItem.Height;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,10 +1,11 @@
|
|||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using Filtration.Enums;
|
using Filtration.ObjectModel.BlockItemBaseTypes;
|
||||||
using Filtration.Models.BlockItemBaseTypes;
|
using Filtration.ObjectModel.Enums;
|
||||||
|
using Filtration.ObjectModel.LootExplosionStudio;
|
||||||
|
|
||||||
namespace Filtration.Models.BlockItemTypes
|
namespace Filtration.ObjectModel.BlockItemTypes
|
||||||
{
|
{
|
||||||
internal class ItemLevelBlockItem : NumericFilterPredicateBlockItem
|
public class ItemLevelBlockItem : NumericFilterPredicateBlockItem
|
||||||
{
|
{
|
||||||
public ItemLevelBlockItem()
|
public ItemLevelBlockItem()
|
||||||
{
|
{
|
||||||
@@ -67,5 +68,10 @@ namespace Filtration.Models.BlockItemTypes
|
|||||||
return 100;
|
return 100;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override int GetLootItemProperty(LootItem lootItem)
|
||||||
|
{
|
||||||
|
return lootItem.ItemLevel;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,10 +1,12 @@
|
|||||||
using System.Windows.Media;
|
using System.Linq;
|
||||||
using Filtration.Enums;
|
using System.Windows.Media;
|
||||||
using Filtration.Models.BlockItemBaseTypes;
|
using Filtration.ObjectModel.BlockItemBaseTypes;
|
||||||
|
using Filtration.ObjectModel.Enums;
|
||||||
|
using Filtration.ObjectModel.LootExplosionStudio;
|
||||||
|
|
||||||
namespace Filtration.Models.BlockItemTypes
|
namespace Filtration.ObjectModel.BlockItemTypes
|
||||||
{
|
{
|
||||||
internal class LinkedSocketsBlockItem : NumericFilterPredicateBlockItem
|
public class LinkedSocketsBlockItem : NumericFilterPredicateBlockItem
|
||||||
{
|
{
|
||||||
public LinkedSocketsBlockItem()
|
public LinkedSocketsBlockItem()
|
||||||
{
|
{
|
||||||
@@ -68,5 +70,10 @@ namespace Filtration.Models.BlockItemTypes
|
|||||||
return 6;
|
return 6;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override int GetLootItemProperty(LootItem lootItem)
|
||||||
|
{
|
||||||
|
return lootItem.SocketGroups.Where(c => c.Sockets.Count > 1).Sum(socketGroup => socketGroup.Sockets.Count);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,10 +1,11 @@
|
|||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using Filtration.Enums;
|
using Filtration.ObjectModel.BlockItemBaseTypes;
|
||||||
using Filtration.Models.BlockItemBaseTypes;
|
using Filtration.ObjectModel.Enums;
|
||||||
|
using Filtration.ObjectModel.LootExplosionStudio;
|
||||||
|
|
||||||
namespace Filtration.Models.BlockItemTypes
|
namespace Filtration.ObjectModel.BlockItemTypes
|
||||||
{
|
{
|
||||||
internal class QualityBlockItem : NumericFilterPredicateBlockItem
|
public class QualityBlockItem : NumericFilterPredicateBlockItem
|
||||||
{
|
{
|
||||||
public QualityBlockItem()
|
public QualityBlockItem()
|
||||||
{
|
{
|
||||||
@@ -68,5 +69,10 @@ namespace Filtration.Models.BlockItemTypes
|
|||||||
return 20;
|
return 20;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override int GetLootItemProperty(LootItem lootItem)
|
||||||
|
{
|
||||||
|
return lootItem.Quality;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,11 +1,12 @@
|
|||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using Filtration.Enums;
|
using Filtration.ObjectModel.BlockItemBaseTypes;
|
||||||
using Filtration.Extensions;
|
using Filtration.ObjectModel.Enums;
|
||||||
using Filtration.Models.BlockItemBaseTypes;
|
using Filtration.ObjectModel.Extensions;
|
||||||
|
using Filtration.ObjectModel.LootExplosionStudio;
|
||||||
|
|
||||||
namespace Filtration.Models.BlockItemTypes
|
namespace Filtration.ObjectModel.BlockItemTypes
|
||||||
{
|
{
|
||||||
internal class RarityBlockItem : NumericFilterPredicateBlockItem
|
public class RarityBlockItem : NumericFilterPredicateBlockItem
|
||||||
{
|
{
|
||||||
public RarityBlockItem()
|
public RarityBlockItem()
|
||||||
{
|
{
|
||||||
@@ -21,6 +22,18 @@ namespace Filtration.Models.BlockItemTypes
|
|||||||
get { return "Rarity"; }
|
get { return "Rarity"; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override string OutputText
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return PrefixText + " " + FilterPredicate.PredicateOperator
|
||||||
|
.GetAttributeDescription() +
|
||||||
|
" " +
|
||||||
|
((ItemRarity) FilterPredicate.PredicateOperand)
|
||||||
|
.GetAttributeDescription();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public override int MaximumAllowed
|
public override int MaximumAllowed
|
||||||
{
|
{
|
||||||
get { return 2; }
|
get { return 2; }
|
||||||
@@ -73,5 +86,10 @@ namespace Filtration.Models.BlockItemTypes
|
|||||||
return (int)ItemRarity.Unique;
|
return (int)ItemRarity.Unique;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override int GetLootItemProperty(LootItem lootItem)
|
||||||
|
{
|
||||||
|
return (int)lootItem.Rarity;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
118
Filtration.ObjectModel/BlockItemTypes/SocketGroupBlockItem.cs
Normal file
118
Filtration.ObjectModel/BlockItemTypes/SocketGroupBlockItem.cs
Normal file
@@ -0,0 +1,118 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using Filtration.ObjectModel.BlockItemBaseTypes;
|
||||||
|
using Filtration.ObjectModel.Enums;
|
||||||
|
using Filtration.ObjectModel.LootExplosionStudio;
|
||||||
|
|
||||||
|
namespace Filtration.ObjectModel.BlockItemTypes
|
||||||
|
{
|
||||||
|
public class SocketGroupBlockItem : StringListBlockItem
|
||||||
|
{
|
||||||
|
public override string PrefixText
|
||||||
|
{
|
||||||
|
get { return "SocketGroup"; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public override int MaximumAllowed
|
||||||
|
{
|
||||||
|
get { return 1; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string DisplayHeading
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return "Socket Group";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string SummaryText
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
var summaryItemText = " " + Items.Aggregate(string.Empty, (current, i) => current + " " + i);
|
||||||
|
return "Socket Group " + summaryItemText.TrimStart(' ');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Color SummaryBackgroundColor
|
||||||
|
{
|
||||||
|
get { return Colors.GhostWhite; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Color SummaryTextColor
|
||||||
|
{
|
||||||
|
get { return Colors.Black; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public override int SortOrder
|
||||||
|
{
|
||||||
|
get { return 9; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string GetLootItemProperty(LootItem lootItem)
|
||||||
|
{
|
||||||
|
return lootItem.SocketGroups.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool MatchesLootItem(LootItem lootItem)
|
||||||
|
{
|
||||||
|
foreach (var socketGroupString in Items)
|
||||||
|
{
|
||||||
|
var socketColorList = SocketGroupStringToSocketColors(socketGroupString);
|
||||||
|
if (
|
||||||
|
lootItem.SocketGroups.Any(
|
||||||
|
g =>
|
||||||
|
g.Sockets.Count(s => s == SocketColor.Red) >=
|
||||||
|
socketColorList.Count(l => l == SocketColor.Red) &&
|
||||||
|
g.Sockets.Count(s => s == SocketColor.Green) >=
|
||||||
|
socketColorList.Count(l => l == SocketColor.Green) &&
|
||||||
|
g.Sockets.Count(s => s == SocketColor.Blue) >=
|
||||||
|
socketColorList.Count(l => l == SocketColor.Blue) &&
|
||||||
|
g.Sockets.Count(s => s == SocketColor.White) >=
|
||||||
|
socketColorList.Count(l => l == SocketColor.White)))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<SocketColor> SocketGroupStringToSocketColors(string socketGroupString)
|
||||||
|
{
|
||||||
|
var socketColorList = new List<SocketColor>();
|
||||||
|
|
||||||
|
foreach (var c in socketGroupString.ToCharArray())
|
||||||
|
{
|
||||||
|
switch (c)
|
||||||
|
{
|
||||||
|
case 'R':
|
||||||
|
{
|
||||||
|
socketColorList.Add(SocketColor.Red);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 'G':
|
||||||
|
{
|
||||||
|
socketColorList.Add(SocketColor.Green);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 'B':
|
||||||
|
{
|
||||||
|
socketColorList.Add(SocketColor.Blue);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 'W':
|
||||||
|
{
|
||||||
|
socketColorList.Add(SocketColor.White);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return socketColorList;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,10 +1,12 @@
|
|||||||
using System.Windows.Media;
|
using System.Linq;
|
||||||
using Filtration.Enums;
|
using System.Windows.Media;
|
||||||
using Filtration.Models.BlockItemBaseTypes;
|
using Filtration.ObjectModel.BlockItemBaseTypes;
|
||||||
|
using Filtration.ObjectModel.Enums;
|
||||||
|
using Filtration.ObjectModel.LootExplosionStudio;
|
||||||
|
|
||||||
namespace Filtration.Models.BlockItemTypes
|
namespace Filtration.ObjectModel.BlockItemTypes
|
||||||
{
|
{
|
||||||
internal class SocketsBlockItem : NumericFilterPredicateBlockItem
|
public class SocketsBlockItem : NumericFilterPredicateBlockItem
|
||||||
{
|
{
|
||||||
public SocketsBlockItem()
|
public SocketsBlockItem()
|
||||||
{
|
{
|
||||||
@@ -68,5 +70,10 @@ namespace Filtration.Models.BlockItemTypes
|
|||||||
return 6;
|
return 6;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override int GetLootItemProperty(LootItem lootItem)
|
||||||
|
{
|
||||||
|
return lootItem.SocketGroups.Sum(c => c.Sockets.Count());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
using Filtration.Models.BlockItemBaseTypes;
|
using Filtration.ObjectModel.BlockItemBaseTypes;
|
||||||
|
|
||||||
namespace Filtration.Models.BlockItemTypes
|
namespace Filtration.ObjectModel.BlockItemTypes
|
||||||
{
|
{
|
||||||
internal class SoundBlockItem : DualIntegerBlockItem
|
public class SoundBlockItem : DualIntegerBlockItem
|
||||||
{
|
{
|
||||||
public SoundBlockItem()
|
public SoundBlockItem()
|
||||||
{
|
{
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using Filtration.Models.BlockItemBaseTypes;
|
using Filtration.ObjectModel.BlockItemBaseTypes;
|
||||||
|
|
||||||
namespace Filtration.Models.BlockItemTypes
|
namespace Filtration.ObjectModel.BlockItemTypes
|
||||||
{
|
{
|
||||||
internal class TextColorBlockItem : ColorBlockItem
|
public class TextColorBlockItem : ColorBlockItem
|
||||||
{
|
{
|
||||||
public TextColorBlockItem()
|
public TextColorBlockItem()
|
||||||
{
|
{
|
||||||
@@ -1,10 +1,11 @@
|
|||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using Filtration.Enums;
|
using Filtration.ObjectModel.BlockItemBaseTypes;
|
||||||
using Filtration.Models.BlockItemBaseTypes;
|
using Filtration.ObjectModel.Enums;
|
||||||
|
using Filtration.ObjectModel.LootExplosionStudio;
|
||||||
|
|
||||||
namespace Filtration.Models.BlockItemTypes
|
namespace Filtration.ObjectModel.BlockItemTypes
|
||||||
{
|
{
|
||||||
internal class WidthBlockItem : NumericFilterPredicateBlockItem
|
public class WidthBlockItem : NumericFilterPredicateBlockItem
|
||||||
{
|
{
|
||||||
public WidthBlockItem()
|
public WidthBlockItem()
|
||||||
{
|
{
|
||||||
@@ -68,5 +69,10 @@ namespace Filtration.Models.BlockItemTypes
|
|||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override int GetLootItemProperty(LootItem lootItem)
|
||||||
|
{
|
||||||
|
return lootItem.Width;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
|
||||||
namespace Filtration.Enums
|
namespace Filtration.ObjectModel.Enums
|
||||||
{
|
{
|
||||||
internal enum BlockAction
|
public enum BlockAction
|
||||||
{
|
{
|
||||||
[Description("Show")]
|
[Description("Show")]
|
||||||
Show,
|
Show,
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
namespace Filtration.Enums
|
namespace Filtration.ObjectModel.Enums
|
||||||
{
|
{
|
||||||
internal enum BlockItemType
|
public enum BlockItemType
|
||||||
{
|
{
|
||||||
ItemLevel,
|
ItemLevel,
|
||||||
DropLevel,
|
DropLevel,
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
|
||||||
namespace Filtration.Enums
|
namespace Filtration.ObjectModel.Enums
|
||||||
{
|
{
|
||||||
internal enum FilterPredicateOperator
|
public enum FilterPredicateOperator
|
||||||
{
|
{
|
||||||
[Description("=")]
|
[Description("=")]
|
||||||
Equal,
|
Equal,
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
|
||||||
namespace Filtration.Enums
|
namespace Filtration.ObjectModel.Enums
|
||||||
{
|
{
|
||||||
internal enum FilterType
|
public enum FilterType
|
||||||
{
|
{
|
||||||
[Description("Show")]
|
[Description("Show")]
|
||||||
Show,
|
Show,
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
|
||||||
namespace Filtration.Enums
|
namespace Filtration.ObjectModel.Enums
|
||||||
{
|
{
|
||||||
internal enum ItemRarity
|
public enum ItemRarity
|
||||||
{
|
{
|
||||||
[Description("Normal")]
|
[Description("Normal")]
|
||||||
Normal,
|
Normal,
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
|
||||||
namespace Filtration.Enums
|
namespace Filtration.ObjectModel.Enums
|
||||||
{
|
{
|
||||||
internal enum SocketColor
|
public enum SocketColor
|
||||||
{
|
{
|
||||||
[Description("R")]
|
[Description("R")]
|
||||||
Red,
|
Red,
|
||||||
14
Filtration.ObjectModel/Enums/ThemeComponentType.cs
Normal file
14
Filtration.ObjectModel/Enums/ThemeComponentType.cs
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
using System.ComponentModel;
|
||||||
|
|
||||||
|
namespace Filtration.ObjectModel.Enums
|
||||||
|
{
|
||||||
|
public enum ThemeComponentType
|
||||||
|
{
|
||||||
|
[Description("Text")]
|
||||||
|
TextColor,
|
||||||
|
[Description("Background")]
|
||||||
|
BackgroundColor,
|
||||||
|
[Description("Border")]
|
||||||
|
BorderColor
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
|
||||||
namespace Filtration.Extensions
|
namespace Filtration.ObjectModel.Extensions
|
||||||
{
|
{
|
||||||
internal static class EnumHelper
|
public static class EnumHelper
|
||||||
{
|
{
|
||||||
public static T GetAttributeOfType<T>(this Enum enumVal) where T : Attribute
|
public static T GetAttributeOfType<T>(this Enum enumVal) where T : Attribute
|
||||||
{
|
{
|
||||||
100
Filtration.ObjectModel/Filtration.ObjectModel.csproj
Normal file
100
Filtration.ObjectModel/Filtration.ObjectModel.csproj
Normal file
@@ -0,0 +1,100 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ProjectGuid>{4AAC3BEB-1DC1-483E-9D11-0E9334E80227}</ProjectGuid>
|
||||||
|
<OutputType>Library</OutputType>
|
||||||
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
|
<RootNamespace>Filtration.ObjectModel</RootNamespace>
|
||||||
|
<AssemblyName>Filtration.ObjectModel</AssemblyName>
|
||||||
|
<TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
|
||||||
|
<FileAlignment>512</FileAlignment>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>bin\Debug\</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\Release\</OutputPath>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="PresentationCore" />
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="System.Xml.Linq" />
|
||||||
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
|
<Reference Include="Microsoft.CSharp" />
|
||||||
|
<Reference Include="System.Data" />
|
||||||
|
<Reference Include="System.Xml" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="BlockItemBaseTypes\ActionBlockItem.cs" />
|
||||||
|
<Compile Include="BlockItemBaseTypes\BlockItemBase.cs" />
|
||||||
|
<Compile Include="BlockItemBaseTypes\ColorBlockItem.cs" />
|
||||||
|
<Compile Include="BlockItemBaseTypes\DualIntegerBlockItem.cs" />
|
||||||
|
<Compile Include="BlockItemBaseTypes\IntegerBlockItem.cs" />
|
||||||
|
<Compile Include="BlockItemBaseTypes\NumericFilterPredicateBlockItem.cs" />
|
||||||
|
<Compile Include="BlockItemBaseTypes\StringListBlockItem.cs" />
|
||||||
|
<Compile Include="BlockItemTypes\BackgroundColorBlockItem.cs" />
|
||||||
|
<Compile Include="BlockItemTypes\BaseTypeBlockItem.cs" />
|
||||||
|
<Compile Include="BlockItemTypes\BorderColorBlockItem.cs" />
|
||||||
|
<Compile Include="BlockItemTypes\ClassBlockItem.cs" />
|
||||||
|
<Compile Include="BlockItemTypes\DropLevelBlockItem.cs" />
|
||||||
|
<Compile Include="BlockItemTypes\FontSizeBlockItem.cs" />
|
||||||
|
<Compile Include="BlockItemTypes\HeightBlockItem.cs" />
|
||||||
|
<Compile Include="BlockItemTypes\ItemLevelBlockItem.cs" />
|
||||||
|
<Compile Include="BlockItemTypes\LinkedSocketsBlockItem.cs" />
|
||||||
|
<Compile Include="BlockItemTypes\QualityBlockItem.cs" />
|
||||||
|
<Compile Include="BlockItemTypes\RarityBlockItem.cs" />
|
||||||
|
<Compile Include="BlockItemTypes\SocketGroupBlockItem.cs" />
|
||||||
|
<Compile Include="BlockItemTypes\SocketsBlockItem.cs" />
|
||||||
|
<Compile Include="BlockItemTypes\SoundBlockItem.cs" />
|
||||||
|
<Compile Include="BlockItemTypes\TextColorBlockItem.cs" />
|
||||||
|
<Compile Include="BlockItemTypes\WidthBlockItem.cs" />
|
||||||
|
<Compile Include="Enums\BlockAction.cs" />
|
||||||
|
<Compile Include="Enums\BlockItemType.cs" />
|
||||||
|
<Compile Include="Enums\FilterPredicateOperator.cs" />
|
||||||
|
<Compile Include="Enums\FilterType.cs" />
|
||||||
|
<Compile Include="Enums\ItemRarity.cs" />
|
||||||
|
<Compile Include="Enums\SocketColor.cs" />
|
||||||
|
<Compile Include="Enums\ThemeComponentType.cs" />
|
||||||
|
<Compile Include="Extensions\EnumHelper.cs" />
|
||||||
|
<Compile Include="IAudioVisualBlockItem.cs" />
|
||||||
|
<Compile Include="IItemFilterBlockItem.cs" />
|
||||||
|
<Compile Include="ItemFilterBlock.cs" />
|
||||||
|
<Compile Include="ItemFilterBlockGroup.cs" />
|
||||||
|
<Compile Include="ItemFilterScript.cs" />
|
||||||
|
<Compile Include="ItemFilterSection.cs" />
|
||||||
|
<Compile Include="LootExplosionStudio\DefaultLootItemAppearanceConstants.cs" />
|
||||||
|
<Compile Include="LootExplosionStudio\LootItem.cs" />
|
||||||
|
<Compile Include="LootExplosionStudio\LootItemCollection.cs" />
|
||||||
|
<Compile Include="LootExplosionStudio\SocketGroup.cs" />
|
||||||
|
<Compile Include="NumericFilterPredicate.cs" />
|
||||||
|
<Compile Include="Properties\Annotations.cs" />
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
<Compile Include="ReplaceColorsParameterSet.cs" />
|
||||||
|
<Compile Include="ThemeEditor\Theme.cs" />
|
||||||
|
<Compile Include="ThemeEditor\ThemeComponent.cs" />
|
||||||
|
<Compile Include="ThemeEditor\ThemeComponentCollection.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.
|
||||||
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
|
<Target Name="BeforeBuild">
|
||||||
|
</Target>
|
||||||
|
<Target Name="AfterBuild">
|
||||||
|
</Target>
|
||||||
|
-->
|
||||||
|
</Project>
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
|
||||||
namespace Filtration.Models
|
namespace Filtration.ObjectModel
|
||||||
{
|
{
|
||||||
internal interface IAudioVisualBlockItem
|
public interface IAudioVisualBlockItem
|
||||||
{
|
{
|
||||||
event PropertyChangedEventHandler PropertyChanged;
|
event PropertyChangedEventHandler PropertyChanged;
|
||||||
}
|
}
|
||||||
@@ -1,16 +1,17 @@
|
|||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
|
|
||||||
namespace Filtration.Models
|
namespace Filtration.ObjectModel
|
||||||
{
|
{
|
||||||
internal interface ILootFilterBlockItem : INotifyPropertyChanged
|
public interface IItemFilterBlockItem : INotifyPropertyChanged
|
||||||
{
|
{
|
||||||
string PrefixText { get; }
|
string PrefixText { get; }
|
||||||
int MaximumAllowed { get; }
|
string OutputText { get; }
|
||||||
string DisplayHeading { get; }
|
string DisplayHeading { get; }
|
||||||
string SummaryText { get; }
|
string SummaryText { get; }
|
||||||
Color SummaryBackgroundColor { get; }
|
Color SummaryBackgroundColor { get; }
|
||||||
Color SummaryTextColor { get; }
|
Color SummaryTextColor { get; }
|
||||||
|
int MaximumAllowed { get; }
|
||||||
int SortOrder { get; }
|
int SortOrder { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
111
Filtration.ObjectModel/ItemFilterBlock.cs
Normal file
111
Filtration.ObjectModel/ItemFilterBlock.cs
Normal file
@@ -0,0 +1,111 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Linq;
|
||||||
|
using Filtration.ObjectModel.BlockItemBaseTypes;
|
||||||
|
using Filtration.ObjectModel.Enums;
|
||||||
|
|
||||||
|
namespace Filtration.ObjectModel
|
||||||
|
{
|
||||||
|
public class ItemFilterBlock
|
||||||
|
{
|
||||||
|
private ItemFilterBlockGroup _blockGroup;
|
||||||
|
|
||||||
|
public ItemFilterBlock()
|
||||||
|
{
|
||||||
|
BlockItems = new ObservableCollection<IItemFilterBlockItem> {new ActionBlockItem(BlockAction.Show)};
|
||||||
|
Enabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Enabled { get; set; }
|
||||||
|
public string Description { get; set; }
|
||||||
|
|
||||||
|
public ItemFilterBlockGroup BlockGroup
|
||||||
|
{
|
||||||
|
get { return _blockGroup; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
var oldBlockGroup = _blockGroup;
|
||||||
|
_blockGroup = value;
|
||||||
|
|
||||||
|
if (_blockGroup != null)
|
||||||
|
{
|
||||||
|
_blockGroup.BlockGroupStatusChanged += OnBlockGroupStatusChanged;
|
||||||
|
if (oldBlockGroup != null)
|
||||||
|
{
|
||||||
|
oldBlockGroup.BlockGroupStatusChanged -= OnBlockGroupStatusChanged;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (oldBlockGroup != null)
|
||||||
|
{
|
||||||
|
oldBlockGroup.BlockGroupStatusChanged -= OnBlockGroupStatusChanged;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public BlockAction Action
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
var actionBlock = BlockItems.OfType<ActionBlockItem>().First();
|
||||||
|
return actionBlock.Action;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
var actionBlock = BlockItems.OfType<ActionBlockItem>().First();
|
||||||
|
actionBlock.Action = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ObservableCollection<IItemFilterBlockItem> BlockItems { get; private set; }
|
||||||
|
|
||||||
|
public int BlockCount(Type type)
|
||||||
|
{
|
||||||
|
return BlockItems != null ? BlockItems.Count(b => b.GetType() == type) : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool AddBlockItemAllowed(Type type)
|
||||||
|
{
|
||||||
|
var blockItem = (IItemFilterBlockItem)Activator.CreateInstance(type);
|
||||||
|
return BlockCount(type) < blockItem.MaximumAllowed;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool HasBlockItemOfType<T>()
|
||||||
|
{
|
||||||
|
return BlockItems.Count(b => b is T) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool HasBlockGroupInParentHierarchy(ItemFilterBlockGroup targetBlockGroup, ItemFilterBlockGroup startingBlockGroup)
|
||||||
|
{
|
||||||
|
if (startingBlockGroup == targetBlockGroup)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (BlockGroup == null)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (startingBlockGroup.ParentGroup != null)
|
||||||
|
{
|
||||||
|
return HasBlockGroupInParentHierarchy(targetBlockGroup, startingBlockGroup.ParentGroup);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnBlockGroupStatusChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (BlockGroup.IsChecked == false && Action == BlockAction.Show)
|
||||||
|
{
|
||||||
|
Action = BlockAction.Hide;
|
||||||
|
}
|
||||||
|
else if (BlockGroup.IsChecked && Action == BlockAction.Hide)
|
||||||
|
{
|
||||||
|
Action = BlockAction.Show;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
62
Filtration.ObjectModel/ItemFilterBlockGroup.cs
Normal file
62
Filtration.ObjectModel/ItemFilterBlockGroup.cs
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Filtration.ObjectModel
|
||||||
|
{
|
||||||
|
public class ItemFilterBlockGroup
|
||||||
|
{
|
||||||
|
private bool _isChecked;
|
||||||
|
|
||||||
|
public ItemFilterBlockGroup(string groupName, ItemFilterBlockGroup parent, bool advanced = false)
|
||||||
|
{
|
||||||
|
GroupName = groupName;
|
||||||
|
ParentGroup = parent;
|
||||||
|
Advanced = advanced;
|
||||||
|
ChildGroups = new List<ItemFilterBlockGroup>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public event EventHandler BlockGroupStatusChanged;
|
||||||
|
|
||||||
|
public string GroupName { get; private set; }
|
||||||
|
public ItemFilterBlockGroup ParentGroup { get; private set; }
|
||||||
|
public List<ItemFilterBlockGroup> ChildGroups { get; private set; }
|
||||||
|
public bool Advanced { get; private set; }
|
||||||
|
|
||||||
|
public bool IsChecked
|
||||||
|
{
|
||||||
|
get { return _isChecked; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value != _isChecked)
|
||||||
|
{
|
||||||
|
_isChecked = value;
|
||||||
|
// Raise an event to let blocks that have this block group assigned that
|
||||||
|
// they might need to change their Action due to the block group status changing.
|
||||||
|
if (BlockGroupStatusChanged != null)
|
||||||
|
{
|
||||||
|
BlockGroupStatusChanged.Invoke(null, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
var currentBlockGroup = this;
|
||||||
|
|
||||||
|
var outputString = (Advanced ? "~" : string.Empty) + GroupName;
|
||||||
|
|
||||||
|
// TODO: This is retarded, fix this.
|
||||||
|
if (currentBlockGroup.ParentGroup != null)
|
||||||
|
{
|
||||||
|
while (currentBlockGroup.ParentGroup.ParentGroup != null)
|
||||||
|
{
|
||||||
|
outputString = (currentBlockGroup.ParentGroup.Advanced ? "~" : string.Empty) + currentBlockGroup.ParentGroup.GroupName + " - " + outputString;
|
||||||
|
currentBlockGroup = currentBlockGroup.ParentGroup;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return outputString;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,20 +2,28 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Filtration.Models.BlockItemTypes;
|
using Filtration.ObjectModel.BlockItemTypes;
|
||||||
using Filtration.ViewModels;
|
using Filtration.ObjectModel.ThemeEditor;
|
||||||
using Filtration.Views;
|
|
||||||
|
|
||||||
namespace Filtration.Models
|
namespace Filtration.ObjectModel
|
||||||
{
|
{
|
||||||
internal class LootFilterScript
|
public class ItemFilterScript
|
||||||
{
|
{
|
||||||
public LootFilterScript()
|
public ItemFilterScript()
|
||||||
{
|
{
|
||||||
LootFilterBlocks = new ObservableCollection<LootFilterBlock>();
|
ItemFilterBlocks = new ObservableCollection<ItemFilterBlock>();
|
||||||
|
ItemFilterBlockGroups = new ObservableCollection<ItemFilterBlockGroup>
|
||||||
|
{
|
||||||
|
new ItemFilterBlockGroup("Root", null)
|
||||||
|
};
|
||||||
|
ThemeComponents = new ThemeComponentCollection { IsMasterCollection = true};
|
||||||
}
|
}
|
||||||
|
|
||||||
public ObservableCollection<LootFilterBlock> LootFilterBlocks { get; set; }
|
public ObservableCollection<ItemFilterBlock> ItemFilterBlocks { get; private set; }
|
||||||
|
public ObservableCollection<ItemFilterBlockGroup> ItemFilterBlockGroups { get; private set; }
|
||||||
|
|
||||||
|
public ThemeComponentCollection ThemeComponents { get; set; }
|
||||||
|
|
||||||
public string FilePath { get; set; }
|
public string FilePath { get; set; }
|
||||||
public string Description { get; set; }
|
public string Description { get; set; }
|
||||||
public DateTime DateModified { get; set; }
|
public DateTime DateModified { get; set; }
|
||||||
@@ -24,7 +32,7 @@ namespace Filtration.Models
|
|||||||
{
|
{
|
||||||
var validationErrors = new List<string>();
|
var validationErrors = new List<string>();
|
||||||
|
|
||||||
if (LootFilterBlocks.Count == 0)
|
if (ItemFilterBlocks.Count == 0)
|
||||||
{
|
{
|
||||||
validationErrors.Add("A script must have at least one block");
|
validationErrors.Add("A script must have at least one block");
|
||||||
}
|
}
|
||||||
@@ -34,10 +42,9 @@ namespace Filtration.Models
|
|||||||
|
|
||||||
public void ReplaceColors(ReplaceColorsParameterSet replaceColorsParameterSet)
|
public void ReplaceColors(ReplaceColorsParameterSet replaceColorsParameterSet)
|
||||||
{
|
{
|
||||||
|
|
||||||
foreach (
|
foreach (
|
||||||
var block in
|
var block in
|
||||||
LootFilterBlocks.Where(b => BlockIsColorReplacementCandidate(replaceColorsParameterSet, b)))
|
ItemFilterBlocks.Where(b => BlockIsColorReplacementCandidate(replaceColorsParameterSet, b)))
|
||||||
{
|
{
|
||||||
if (replaceColorsParameterSet.ReplaceTextColor)
|
if (replaceColorsParameterSet.ReplaceTextColor)
|
||||||
{
|
{
|
||||||
@@ -55,10 +62,9 @@ namespace Filtration.Models
|
|||||||
borderColorBlockItem.Color = replaceColorsParameterSet.NewBorderColor;
|
borderColorBlockItem.Color = replaceColorsParameterSet.NewBorderColor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool BlockIsColorReplacementCandidate(ReplaceColorsParameterSet replaceColorsParameterSet, LootFilterBlock block)
|
private bool BlockIsColorReplacementCandidate(ReplaceColorsParameterSet replaceColorsParameterSet, ItemFilterBlock block)
|
||||||
{
|
{
|
||||||
var textColorItem = block.HasBlockItemOfType<TextColorBlockItem>()
|
var textColorItem = block.HasBlockItemOfType<TextColorBlockItem>()
|
||||||
? block.BlockItems.OfType<TextColorBlockItem>().First()
|
? block.BlockItems.OfType<TextColorBlockItem>().First()
|
||||||
6
Filtration.ObjectModel/ItemFilterSection.cs
Normal file
6
Filtration.ObjectModel/ItemFilterSection.cs
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
namespace Filtration.ObjectModel
|
||||||
|
{
|
||||||
|
public class ItemFilterSection : ItemFilterBlock
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
using System.Windows.Media;
|
||||||
|
|
||||||
|
namespace Filtration.ObjectModel.LootExplosionStudio
|
||||||
|
{
|
||||||
|
public static class DefaultLootItemAppearanceConstants
|
||||||
|
{
|
||||||
|
public readonly static Color NormalTextColor = new Color { A = 255, R = 200, G = 200, B = 200 };
|
||||||
|
public readonly static Color MagicTextColor = new Color { A = 255, R = 136, G = 136, B = 255 };
|
||||||
|
public readonly static Color RareTextColor = new Color { A = 255, R = 255, G = 255, B = 119 };
|
||||||
|
public readonly static Color UniqueTextColor = new Color { A = 255, R = 175, G = 96, B = 37 };
|
||||||
|
public readonly static Color QuestItemTextColor = new Color { A = 255, R = 74, G = 230, B = 58 };
|
||||||
|
public static readonly Color BackgroundColor = new Color {A = 255, R = 0, G = 0, B = 0};
|
||||||
|
public static readonly Color BorderColor = new Color { A = 255, R = 0, G = 0, B = 0 };
|
||||||
|
public static readonly int FontSize = 35;
|
||||||
|
}
|
||||||
|
}
|
||||||
25
Filtration.ObjectModel/LootExplosionStudio/LootItem.cs
Normal file
25
Filtration.ObjectModel/LootExplosionStudio/LootItem.cs
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using Filtration.ObjectModel.Enums;
|
||||||
|
|
||||||
|
namespace Filtration.ObjectModel.LootExplosionStudio
|
||||||
|
{
|
||||||
|
public class LootItem
|
||||||
|
{
|
||||||
|
public string Name { get; set; }
|
||||||
|
public int ItemLevel { get; set; }
|
||||||
|
public int DropLevel { get; set; }
|
||||||
|
public int Quality { get; set; }
|
||||||
|
public ItemRarity Rarity { get; set; }
|
||||||
|
public string Class { get; set; }
|
||||||
|
public string BaseType { get; set; }
|
||||||
|
public List<SocketGroup> SocketGroups { get; set; }
|
||||||
|
public int Width { get; set; }
|
||||||
|
public int Height { get; set; }
|
||||||
|
|
||||||
|
public Color TextColor { get; set; }
|
||||||
|
public Color BackgroundColor { get; set; }
|
||||||
|
public Color BorderColor { get; set; }
|
||||||
|
public int FontSize { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
using System.Collections.ObjectModel;
|
||||||
|
|
||||||
|
namespace Filtration.ObjectModel.LootExplosionStudio
|
||||||
|
{
|
||||||
|
public class LootItemCollection : Collection<LootItem>
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
10
Filtration.ObjectModel/LootExplosionStudio/SocketGroup.cs
Normal file
10
Filtration.ObjectModel/LootExplosionStudio/SocketGroup.cs
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using Filtration.ObjectModel.Enums;
|
||||||
|
|
||||||
|
namespace Filtration.ObjectModel.LootExplosionStudio
|
||||||
|
{
|
||||||
|
public class SocketGroup
|
||||||
|
{
|
||||||
|
public List<SocketColor> Sockets { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,12 +1,12 @@
|
|||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using Filtration.Annotations;
|
using Filtration.ObjectModel.Annotations;
|
||||||
using Filtration.Enums;
|
using Filtration.ObjectModel.Enums;
|
||||||
using Filtration.Extensions;
|
using Filtration.ObjectModel.Extensions;
|
||||||
|
|
||||||
namespace Filtration.Models
|
namespace Filtration.ObjectModel
|
||||||
{
|
{
|
||||||
internal class NumericFilterPredicate : INotifyPropertyChanged
|
public class NumericFilterPredicate : INotifyPropertyChanged
|
||||||
{
|
{
|
||||||
private FilterPredicateOperator _predicateOperator;
|
private FilterPredicateOperator _predicateOperator;
|
||||||
private int _predicateOperand;
|
private int _predicateOperand;
|
||||||
937
Filtration.ObjectModel/Properties/Annotations.cs
Normal file
937
Filtration.ObjectModel/Properties/Annotations.cs
Normal file
@@ -0,0 +1,937 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
#pragma warning disable 1591
|
||||||
|
// ReSharper disable UnusedMember.Global
|
||||||
|
// ReSharper disable MemberCanBePrivate.Global
|
||||||
|
// ReSharper disable UnusedAutoPropertyAccessor.Global
|
||||||
|
// ReSharper disable IntroduceOptionalParameters.Global
|
||||||
|
// ReSharper disable MemberCanBeProtected.Global
|
||||||
|
// ReSharper disable InconsistentNaming
|
||||||
|
// ReSharper disable CheckNamespace
|
||||||
|
|
||||||
|
namespace Filtration.ObjectModel.Annotations
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates that the value of the marked element could be <c>null</c> sometimes,
|
||||||
|
/// so the check for <c>null</c> is necessary before its usage.
|
||||||
|
/// </summary>
|
||||||
|
/// <example><code>
|
||||||
|
/// [CanBeNull] public object Test() { return null; }
|
||||||
|
/// public 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)]
|
||||||
|
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() {
|
||||||
|
/// return null; // Warning: Possible 'null' assignment
|
||||||
|
/// }
|
||||||
|
/// </code></example>
|
||||||
|
[AttributeUsage(
|
||||||
|
AttributeTargets.Method | AttributeTargets.Parameter | AttributeTargets.Property |
|
||||||
|
AttributeTargets.Delegate | AttributeTargets.Field | AttributeTargets.Event)]
|
||||||
|
public sealed class NotNullAttribute : Attribute { }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates that collection or enumerable value does not contain null elements.
|
||||||
|
/// </summary>
|
||||||
|
[AttributeUsage(
|
||||||
|
AttributeTargets.Method | AttributeTargets.Parameter | AttributeTargets.Property |
|
||||||
|
AttributeTargets.Delegate | AttributeTargets.Field)]
|
||||||
|
public sealed class ItemNotNullAttribute : Attribute { }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates that collection or enumerable value can contain null elements.
|
||||||
|
/// </summary>
|
||||||
|
[AttributeUsage(
|
||||||
|
AttributeTargets.Method | AttributeTargets.Parameter | AttributeTargets.Property |
|
||||||
|
AttributeTargets.Delegate | AttributeTargets.Field)]
|
||||||
|
public sealed class ItemCanBeNullAttribute : Attribute { }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates that the marked method builds string by format pattern and (optional) arguments.
|
||||||
|
/// Parameter, which contains format string, should be given in constructor. The format string
|
||||||
|
/// should be in <see cref="string.Format(IFormatProvider,string,object[])"/>-like form.
|
||||||
|
/// </summary>
|
||||||
|
/// <example><code>
|
||||||
|
/// [StringFormatMethod("message")]
|
||||||
|
/// public void ShowError(string message, params object[] args) { /* do something */ }
|
||||||
|
/// public void Foo() {
|
||||||
|
/// ShowError("Failed: {0}"); // Warning: Non-existing argument in format string
|
||||||
|
/// }
|
||||||
|
/// </code></example>
|
||||||
|
[AttributeUsage(
|
||||||
|
AttributeTargets.Constructor | AttributeTargets.Method |
|
||||||
|
AttributeTargets.Property | AttributeTargets.Delegate)]
|
||||||
|
public sealed class StringFormatMethodAttribute : Attribute
|
||||||
|
{
|
||||||
|
/// <param name="formatParameterName">
|
||||||
|
/// Specifies which parameter of an annotated method should be treated as format-string
|
||||||
|
/// </param>
|
||||||
|
public StringFormatMethodAttribute(string formatParameterName)
|
||||||
|
{
|
||||||
|
FormatParameterName = formatParameterName;
|
||||||
|
}
|
||||||
|
|
||||||
|
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)]
|
||||||
|
public sealed class ValueProviderAttribute : Attribute
|
||||||
|
{
|
||||||
|
public ValueProviderAttribute(string name)
|
||||||
|
{
|
||||||
|
Name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
[NotNull] public string Name { get; private set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates that the function argument should be string literal and match one
|
||||||
|
/// of the parameters of the caller function. For example, ReSharper annotates
|
||||||
|
/// the parameter of <see cref="System.ArgumentNullException"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <example><code>
|
||||||
|
/// public void Foo(string param) {
|
||||||
|
/// if (param == null)
|
||||||
|
/// throw new ArgumentNullException("par"); // Warning: Cannot resolve symbol
|
||||||
|
/// }
|
||||||
|
/// </code></example>
|
||||||
|
[AttributeUsage(AttributeTargets.Parameter)]
|
||||||
|
public sealed class InvokerParameterNameAttribute : Attribute { }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates that the method is contained in a type that implements
|
||||||
|
/// <c>System.ComponentModel.INotifyPropertyChanged</c> interface and this method
|
||||||
|
/// is used to notify that some property value changed.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// The method should be non-static and conform to one of the supported signatures:
|
||||||
|
/// <list>
|
||||||
|
/// <item><c>NotifyChanged(string)</c></item>
|
||||||
|
/// <item><c>NotifyChanged(params string[])</c></item>
|
||||||
|
/// <item><c>NotifyChanged{T}(Expression{Func{T}})</c></item>
|
||||||
|
/// <item><c>NotifyChanged{T,U}(Expression{Func{T,U}})</c></item>
|
||||||
|
/// <item><c>SetProperty{T}(ref T, T, string)</c></item>
|
||||||
|
/// </list>
|
||||||
|
/// </remarks>
|
||||||
|
/// <example><code>
|
||||||
|
/// public class Foo : INotifyPropertyChanged {
|
||||||
|
/// public event PropertyChangedEventHandler PropertyChanged;
|
||||||
|
/// [NotifyPropertyChangedInvocator]
|
||||||
|
/// protected virtual void NotifyChanged(string propertyName) { ... }
|
||||||
|
///
|
||||||
|
/// private string _name;
|
||||||
|
/// public string Name {
|
||||||
|
/// get { return _name; }
|
||||||
|
/// set { _name = value; NotifyChanged("LastName"); /* Warning */ }
|
||||||
|
/// }
|
||||||
|
/// }
|
||||||
|
/// </code>
|
||||||
|
/// Examples of generated notifications:
|
||||||
|
/// <list>
|
||||||
|
/// <item><c>NotifyChanged("Property")</c></item>
|
||||||
|
/// <item><c>NotifyChanged(() => Property)</c></item>
|
||||||
|
/// <item><c>NotifyChanged((VM x) => x.Property)</c></item>
|
||||||
|
/// <item><c>SetProperty(ref myField, value, "Property")</c></item>
|
||||||
|
/// </list>
|
||||||
|
/// </example>
|
||||||
|
[AttributeUsage(AttributeTargets.Method)]
|
||||||
|
public sealed class NotifyPropertyChangedInvocatorAttribute : Attribute
|
||||||
|
{
|
||||||
|
public NotifyPropertyChangedInvocatorAttribute() { }
|
||||||
|
public NotifyPropertyChangedInvocatorAttribute(string parameterName)
|
||||||
|
{
|
||||||
|
ParameterName = parameterName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string ParameterName { get; private set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Describes dependency between method input and output.
|
||||||
|
/// </summary>
|
||||||
|
/// <syntax>
|
||||||
|
/// <p>Function Definition Table syntax:</p>
|
||||||
|
/// <list>
|
||||||
|
/// <item>FDT ::= FDTRow [;FDTRow]*</item>
|
||||||
|
/// <item>FDTRow ::= Input => Output | Output <= Input</item>
|
||||||
|
/// <item>Input ::= ParameterName: Value [, Input]*</item>
|
||||||
|
/// <item>Output ::= [ParameterName: Value]* {halt|stop|void|nothing|Value}</item>
|
||||||
|
/// <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/>
|
||||||
|
/// </syntax>
|
||||||
|
/// <examples><list>
|
||||||
|
/// <item><code>
|
||||||
|
/// [ContractAnnotation("=> halt")]
|
||||||
|
/// public void TerminationMethod()
|
||||||
|
/// </code></item>
|
||||||
|
/// <item><code>
|
||||||
|
/// [ContractAnnotation("halt <= condition: false")]
|
||||||
|
/// public void Assert(bool condition, string text) // regular assertion method
|
||||||
|
/// </code></item>
|
||||||
|
/// <item><code>
|
||||||
|
/// [ContractAnnotation("s:null => 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")]
|
||||||
|
/// public object Transform(object data)
|
||||||
|
/// </code></item>
|
||||||
|
/// <item><code>
|
||||||
|
/// [ContractAnnotation("s:null=>false; =>true,result:notnull; =>false, result:null")]
|
||||||
|
/// public bool TryParse(string s, out Person result)
|
||||||
|
/// </code></item>
|
||||||
|
/// </list></examples>
|
||||||
|
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
|
||||||
|
public sealed class ContractAnnotationAttribute : Attribute
|
||||||
|
{
|
||||||
|
public ContractAnnotationAttribute([NotNull] string contract)
|
||||||
|
: this(contract, false) { }
|
||||||
|
|
||||||
|
public ContractAnnotationAttribute([NotNull] string contract, bool forceFullStates)
|
||||||
|
{
|
||||||
|
Contract = contract;
|
||||||
|
ForceFullStates = forceFullStates;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Contract { get; private set; }
|
||||||
|
public bool ForceFullStates { get; private set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates that marked element should be localized or not.
|
||||||
|
/// </summary>
|
||||||
|
/// <example><code>
|
||||||
|
/// [LocalizationRequiredAttribute(true)]
|
||||||
|
/// public class Foo {
|
||||||
|
/// private 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Required { get; private set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates that the value of the marked type (or its derivatives)
|
||||||
|
/// cannot be compared using '==' or '!=' operators and <c>Equals()</c>
|
||||||
|
/// should be used instead. However, using '==' or '!=' for comparison
|
||||||
|
/// with <c>null</c> is always permitted.
|
||||||
|
/// </summary>
|
||||||
|
/// <example><code>
|
||||||
|
/// [CannotApplyEqualityOperator]
|
||||||
|
/// class NoEquality { }
|
||||||
|
/// class UsesNoEquality {
|
||||||
|
/// public void Test() {
|
||||||
|
/// var ca1 = new NoEquality();
|
||||||
|
/// var ca2 = new NoEquality();
|
||||||
|
/// if (ca1 != null) { // OK
|
||||||
|
/// bool condition = ca1 == ca2; // Warning
|
||||||
|
/// }
|
||||||
|
/// }
|
||||||
|
/// }
|
||||||
|
/// </code></example>
|
||||||
|
[AttributeUsage(AttributeTargets.Interface | AttributeTargets.Class | AttributeTargets.Struct)]
|
||||||
|
public sealed class CannotApplyEqualityOperatorAttribute : Attribute { }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// When applied to a target attribute, specifies a requirement for any type marked
|
||||||
|
/// with the target attribute to implement or inherit specific type or types.
|
||||||
|
/// </summary>
|
||||||
|
/// <example><code>
|
||||||
|
/// [BaseTypeRequired(typeof(IComponent)] // Specify requirement
|
||||||
|
/// public class ComponentAttribute : Attribute { }
|
||||||
|
/// [Component] // ComponentAttribute requires implementing IComponent interface
|
||||||
|
/// public class MyComponent : IComponent { }
|
||||||
|
/// </code></example>
|
||||||
|
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
|
||||||
|
[BaseTypeRequired(typeof(Attribute))]
|
||||||
|
public sealed class BaseTypeRequiredAttribute : Attribute
|
||||||
|
{
|
||||||
|
public BaseTypeRequiredAttribute([NotNull] Type baseType)
|
||||||
|
{
|
||||||
|
BaseType = baseType;
|
||||||
|
}
|
||||||
|
|
||||||
|
[NotNull] public Type BaseType { get; private set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates that the marked symbol is used implicitly (e.g. via reflection, in external library),
|
||||||
|
/// so this symbol will not be marked as unused (as well as by other usage inspections).
|
||||||
|
/// </summary>
|
||||||
|
[AttributeUsage(AttributeTargets.All)]
|
||||||
|
public sealed class UsedImplicitlyAttribute : Attribute
|
||||||
|
{
|
||||||
|
public UsedImplicitlyAttribute()
|
||||||
|
: this(ImplicitUseKindFlags.Default, ImplicitUseTargetFlags.Default) { }
|
||||||
|
|
||||||
|
public UsedImplicitlyAttribute(ImplicitUseKindFlags useKindFlags)
|
||||||
|
: this(useKindFlags, ImplicitUseTargetFlags.Default) { }
|
||||||
|
|
||||||
|
public UsedImplicitlyAttribute(ImplicitUseTargetFlags targetFlags)
|
||||||
|
: this(ImplicitUseKindFlags.Default, targetFlags) { }
|
||||||
|
|
||||||
|
public UsedImplicitlyAttribute(ImplicitUseKindFlags useKindFlags, ImplicitUseTargetFlags targetFlags)
|
||||||
|
{
|
||||||
|
UseKindFlags = useKindFlags;
|
||||||
|
TargetFlags = targetFlags;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ImplicitUseKindFlags UseKindFlags { get; private set; }
|
||||||
|
public ImplicitUseTargetFlags TargetFlags { get; private set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Should be used on attributes and causes ReSharper to not mark symbols marked with such attributes
|
||||||
|
/// as unused (as well as by other usage inspections)
|
||||||
|
/// </summary>
|
||||||
|
[AttributeUsage(AttributeTargets.Class | AttributeTargets.GenericParameter)]
|
||||||
|
public sealed class MeansImplicitUseAttribute : Attribute
|
||||||
|
{
|
||||||
|
public MeansImplicitUseAttribute()
|
||||||
|
: this(ImplicitUseKindFlags.Default, ImplicitUseTargetFlags.Default) { }
|
||||||
|
|
||||||
|
public MeansImplicitUseAttribute(ImplicitUseKindFlags useKindFlags)
|
||||||
|
: this(useKindFlags, ImplicitUseTargetFlags.Default) { }
|
||||||
|
|
||||||
|
public MeansImplicitUseAttribute(ImplicitUseTargetFlags targetFlags)
|
||||||
|
: this(ImplicitUseKindFlags.Default, targetFlags) { }
|
||||||
|
|
||||||
|
public MeansImplicitUseAttribute(ImplicitUseKindFlags useKindFlags, ImplicitUseTargetFlags targetFlags)
|
||||||
|
{
|
||||||
|
UseKindFlags = useKindFlags;
|
||||||
|
TargetFlags = targetFlags;
|
||||||
|
}
|
||||||
|
|
||||||
|
[UsedImplicitly] public ImplicitUseKindFlags UseKindFlags { get; private set; }
|
||||||
|
[UsedImplicitly] public ImplicitUseTargetFlags TargetFlags { get; private set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
[Flags]
|
||||||
|
public enum ImplicitUseKindFlags
|
||||||
|
{
|
||||||
|
Default = Access | Assign | InstantiatedWithFixedConstructorSignature,
|
||||||
|
/// <summary>Only entity marked with attribute considered used.</summary>
|
||||||
|
Access = 1,
|
||||||
|
/// <summary>Indicates implicit assignment to a member.</summary>
|
||||||
|
Assign = 2,
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates implicit instantiation of a type with fixed constructor signature.
|
||||||
|
/// That means any unused constructor parameters won't be reported as such.
|
||||||
|
/// </summary>
|
||||||
|
InstantiatedWithFixedConstructorSignature = 4,
|
||||||
|
/// <summary>Indicates implicit instantiation of a type.</summary>
|
||||||
|
InstantiatedNoFixedConstructorSignature = 8,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Specify what is considered used implicitly when marked
|
||||||
|
/// with <see cref="MeansImplicitUseAttribute"/> or <see cref="UsedImplicitlyAttribute"/>.
|
||||||
|
/// </summary>
|
||||||
|
[Flags]
|
||||||
|
public enum ImplicitUseTargetFlags
|
||||||
|
{
|
||||||
|
Default = Itself,
|
||||||
|
Itself = 1,
|
||||||
|
/// <summary>Members of entity marked with attribute are considered used.</summary>
|
||||||
|
Members = 2,
|
||||||
|
/// <summary>Entity marked with attribute and all its members considered used.</summary>
|
||||||
|
WithMembers = Itself | Members
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This attribute is intended to mark publicly available API
|
||||||
|
/// which should not be removed and so is treated as used.
|
||||||
|
/// </summary>
|
||||||
|
[MeansImplicitUse(ImplicitUseTargetFlags.WithMembers)]
|
||||||
|
public sealed class PublicAPIAttribute : Attribute
|
||||||
|
{
|
||||||
|
public PublicAPIAttribute() { }
|
||||||
|
public PublicAPIAttribute([NotNull] string comment)
|
||||||
|
{
|
||||||
|
Comment = comment;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Comment { get; private set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Tells code analysis engine if the parameter is completely handled when the invoked method is on stack.
|
||||||
|
/// If the parameter is a delegate, indicates that delegate is executed while the method is executed.
|
||||||
|
/// If the parameter is an enumerable, indicates that it is enumerated while the method is executed.
|
||||||
|
/// </summary>
|
||||||
|
[AttributeUsage(AttributeTargets.Parameter)]
|
||||||
|
public sealed class InstantHandleAttribute : Attribute { }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates that a method does not make any observable state changes.
|
||||||
|
/// 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
|
||||||
|
/// }
|
||||||
|
/// </code></example>
|
||||||
|
[AttributeUsage(AttributeTargets.Method)]
|
||||||
|
public sealed class PureAttribute : 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 (~).
|
||||||
|
/// </summary>
|
||||||
|
[AttributeUsage(AttributeTargets.Parameter)]
|
||||||
|
public sealed class PathReferenceAttribute : Attribute
|
||||||
|
{
|
||||||
|
public PathReferenceAttribute() { }
|
||||||
|
public PathReferenceAttribute([PathReference] string basePath)
|
||||||
|
{
|
||||||
|
BasePath = basePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string BasePath { get; private set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// An extension method marked with this attribute is processed by ReSharper code completion
|
||||||
|
/// as a 'Source Template'. When extension method is completed over some expression, it's source code
|
||||||
|
/// is automatically expanded like a template at call site.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Template method body can contain valid source code and/or special comments starting with '$'.
|
||||||
|
/// Text inside these comments is added as source code when the template is applied. Template parameters
|
||||||
|
/// can be used either as additional method parameters or as identifiers wrapped in two '$' signs.
|
||||||
|
/// Use the <see cref="MacroAttribute"/> attribute to specify macros for parameters.
|
||||||
|
/// </remarks>
|
||||||
|
/// <example>
|
||||||
|
/// In this example, the 'forEach' method is a source template available over all values
|
||||||
|
/// of enumerable types, producing ordinary C# 'foreach' statement and placing caret inside block:
|
||||||
|
/// <code>
|
||||||
|
/// [SourceTemplate]
|
||||||
|
/// public static void forEach<T>(this IEnumerable<T> xs) {
|
||||||
|
/// foreach (var x in xs) {
|
||||||
|
/// //$ $END$
|
||||||
|
/// }
|
||||||
|
/// }
|
||||||
|
/// </code>
|
||||||
|
/// </example>
|
||||||
|
[AttributeUsage(AttributeTargets.Method)]
|
||||||
|
public sealed class SourceTemplateAttribute : Attribute { }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Allows specifying a macro for a parameter of a <see cref="SourceTemplateAttribute">source template</see>.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// You can apply the attribute on the whole method or on any of its additional parameters. The macro expression
|
||||||
|
/// is defined in the <see cref="MacroAttribute.Expression"/> property. When applied on a method, the target
|
||||||
|
/// template parameter is defined in the <see cref="MacroAttribute.Target"/> property. To apply the macro silently
|
||||||
|
/// for the parameter, set the <see cref="MacroAttribute.Editable"/> property value = -1.
|
||||||
|
/// </remarks>
|
||||||
|
/// <example>
|
||||||
|
/// Applying the attribute on a source template method:
|
||||||
|
/// <code>
|
||||||
|
/// [SourceTemplate, Macro(Target = "item", Expression = "suggestVariableName()")]
|
||||||
|
/// public static void forEach<T>(this IEnumerable<T> collection) {
|
||||||
|
/// foreach (var item in collection) {
|
||||||
|
/// //$ $END$
|
||||||
|
/// }
|
||||||
|
/// }
|
||||||
|
/// </code>
|
||||||
|
/// Applying the attribute on a template method parameter:
|
||||||
|
/// <code>
|
||||||
|
/// [SourceTemplate]
|
||||||
|
/// public static void something(this Entity x, [Macro(Expression = "guid()", Editable = -1)] string newguid) {
|
||||||
|
/// /*$ var $x$Id = "$newguid$" + x.ToString();
|
||||||
|
/// x.DoSomething($x$Id); */
|
||||||
|
/// }
|
||||||
|
/// </code>
|
||||||
|
/// </example>
|
||||||
|
[AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method, AllowMultiple = true)]
|
||||||
|
public sealed class MacroAttribute : Attribute
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 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; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Allows specifying which occurrence of the target parameter becomes editable when the template is deployed.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// If the target parameter is used several times in the template, only one occurrence becomes editable;
|
||||||
|
/// other occurrences are changed synchronously. To specify the zero-based index of the editable occurrence,
|
||||||
|
/// use values >= 0. To make the parameter non-editable when the template is expanded, use -1.
|
||||||
|
/// </remarks>>
|
||||||
|
public int Editable { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 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; }
|
||||||
|
}
|
||||||
|
|
||||||
|
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
|
||||||
|
public sealed class AspMvcAreaMasterLocationFormatAttribute : Attribute
|
||||||
|
{
|
||||||
|
public AspMvcAreaMasterLocationFormatAttribute(string format)
|
||||||
|
{
|
||||||
|
Format = format;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Format { get; private set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
|
||||||
|
public sealed class AspMvcAreaPartialViewLocationFormatAttribute : Attribute
|
||||||
|
{
|
||||||
|
public AspMvcAreaPartialViewLocationFormatAttribute(string format)
|
||||||
|
{
|
||||||
|
Format = format;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Format { get; private set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
|
||||||
|
public sealed class AspMvcAreaViewLocationFormatAttribute : Attribute
|
||||||
|
{
|
||||||
|
public AspMvcAreaViewLocationFormatAttribute(string format)
|
||||||
|
{
|
||||||
|
Format = format;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Format { get; private set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
|
||||||
|
public sealed class AspMvcMasterLocationFormatAttribute : Attribute
|
||||||
|
{
|
||||||
|
public AspMvcMasterLocationFormatAttribute(string format)
|
||||||
|
{
|
||||||
|
Format = format;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Format { get; private set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
|
||||||
|
public sealed class AspMvcPartialViewLocationFormatAttribute : Attribute
|
||||||
|
{
|
||||||
|
public AspMvcPartialViewLocationFormatAttribute(string format)
|
||||||
|
{
|
||||||
|
Format = format;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Format { get; private set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
|
||||||
|
public sealed class AspMvcViewLocationFormatAttribute : Attribute
|
||||||
|
{
|
||||||
|
public AspMvcViewLocationFormatAttribute(string format)
|
||||||
|
{
|
||||||
|
Format = format;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Format { get; private set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter
|
||||||
|
/// is an MVC action. If applied to a method, the MVC action name is calculated
|
||||||
|
/// implicitly from the context. Use this attribute for custom wrappers similar to
|
||||||
|
/// <c>System.Web.Mvc.Html.ChildActionExtensions.RenderAction(HtmlHelper, String)</c>.
|
||||||
|
/// </summary>
|
||||||
|
[AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method)]
|
||||||
|
public sealed class AspMvcActionAttribute : Attribute
|
||||||
|
{
|
||||||
|
public AspMvcActionAttribute() { }
|
||||||
|
public AspMvcActionAttribute(string anonymousProperty)
|
||||||
|
{
|
||||||
|
AnonymousProperty = anonymousProperty;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string AnonymousProperty { get; private set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ASP.NET MVC attribute. Indicates that a parameter is an MVC area.
|
||||||
|
/// Use this attribute for custom wrappers similar to
|
||||||
|
/// <c>System.Web.Mvc.Html.ChildActionExtensions.RenderAction(HtmlHelper, String)</c>.
|
||||||
|
/// </summary>
|
||||||
|
[AttributeUsage(AttributeTargets.Parameter)]
|
||||||
|
public sealed class AspMvcAreaAttribute : Attribute
|
||||||
|
{
|
||||||
|
public AspMvcAreaAttribute() { }
|
||||||
|
public AspMvcAreaAttribute(string anonymousProperty)
|
||||||
|
{
|
||||||
|
AnonymousProperty = anonymousProperty;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string AnonymousProperty { get; private set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter is
|
||||||
|
/// an MVC controller. If applied to a method, the MVC controller name is calculated
|
||||||
|
/// implicitly from the context. Use this attribute for custom wrappers similar to
|
||||||
|
/// <c>System.Web.Mvc.Html.ChildActionExtensions.RenderAction(HtmlHelper, String, String)</c>.
|
||||||
|
/// </summary>
|
||||||
|
[AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method)]
|
||||||
|
public sealed class AspMvcControllerAttribute : Attribute
|
||||||
|
{
|
||||||
|
public AspMvcControllerAttribute() { }
|
||||||
|
public AspMvcControllerAttribute(string anonymousProperty)
|
||||||
|
{
|
||||||
|
AnonymousProperty = anonymousProperty;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string AnonymousProperty { get; private set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ASP.NET MVC attribute. Indicates that a parameter is an MVC Master. Use this attribute
|
||||||
|
/// for custom wrappers similar to <c>System.Web.Mvc.Controller.View(String, String)</c>.
|
||||||
|
/// </summary>
|
||||||
|
[AttributeUsage(AttributeTargets.Parameter)]
|
||||||
|
public sealed class AspMvcMasterAttribute : Attribute { }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ASP.NET MVC attribute. Indicates that a parameter is an MVC model type. Use this attribute
|
||||||
|
/// for custom wrappers similar to <c>System.Web.Mvc.Controller.View(String, Object)</c>.
|
||||||
|
/// </summary>
|
||||||
|
[AttributeUsage(AttributeTargets.Parameter)]
|
||||||
|
public sealed class AspMvcModelTypeAttribute : Attribute { }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter is an MVC
|
||||||
|
/// partial view. If applied to a method, the MVC partial view name is calculated implicitly
|
||||||
|
/// from the context. Use this attribute for custom wrappers similar to
|
||||||
|
/// <c>System.Web.Mvc.Html.RenderPartialExtensions.RenderPartial(HtmlHelper, String)</c>.
|
||||||
|
/// </summary>
|
||||||
|
[AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method)]
|
||||||
|
public sealed class AspMvcPartialViewAttribute : Attribute { }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 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 { }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ASP.NET MVC attribute. Indicates that a parameter is an MVC display template.
|
||||||
|
/// Use this attribute for custom wrappers similar to
|
||||||
|
/// <c>System.Web.Mvc.Html.DisplayExtensions.DisplayForModel(HtmlHelper, String)</c>.
|
||||||
|
/// </summary>
|
||||||
|
[AttributeUsage(AttributeTargets.Parameter)]
|
||||||
|
public sealed class AspMvcDisplayTemplateAttribute : Attribute { }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ASP.NET MVC attribute. Indicates that a parameter is an MVC editor template.
|
||||||
|
/// Use this attribute for custom wrappers similar to
|
||||||
|
/// <c>System.Web.Mvc.Html.EditorExtensions.EditorForModel(HtmlHelper, String)</c>.
|
||||||
|
/// </summary>
|
||||||
|
[AttributeUsage(AttributeTargets.Parameter)]
|
||||||
|
public sealed class AspMvcEditorTemplateAttribute : Attribute { }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ASP.NET MVC attribute. Indicates that a parameter is an MVC template.
|
||||||
|
/// Use this attribute for custom wrappers similar to
|
||||||
|
/// <c>System.ComponentModel.DataAnnotations.UIHintAttribute(System.String)</c>.
|
||||||
|
/// </summary>
|
||||||
|
[AttributeUsage(AttributeTargets.Parameter)]
|
||||||
|
public sealed class AspMvcTemplateAttribute : Attribute { }
|
||||||
|
|
||||||
|
/// <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
|
||||||
|
/// 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. When applied to a parameter of an attribute,
|
||||||
|
/// indicates that this parameter is an MVC action name.
|
||||||
|
/// </summary>
|
||||||
|
/// <example><code>
|
||||||
|
/// [ActionName("Foo")]
|
||||||
|
/// public ActionResult Login(string returnUrl) {
|
||||||
|
/// ViewBag.ReturnUrl = Url.Action("Foo"); // OK
|
||||||
|
/// return RedirectToAction("Bar"); // Error: Cannot resolve action
|
||||||
|
/// }
|
||||||
|
/// </code></example>
|
||||||
|
[AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Property)]
|
||||||
|
public sealed class AspMvcActionSelectorAttribute : Attribute { }
|
||||||
|
|
||||||
|
[AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Property | AttributeTargets.Field)]
|
||||||
|
public sealed class HtmlElementAttributesAttribute : Attribute
|
||||||
|
{
|
||||||
|
public HtmlElementAttributesAttribute() { }
|
||||||
|
public HtmlElementAttributesAttribute(string name)
|
||||||
|
{
|
||||||
|
Name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Name { get; private set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
[AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property)]
|
||||||
|
public sealed class HtmlAttributeValueAttribute : Attribute
|
||||||
|
{
|
||||||
|
public HtmlAttributeValueAttribute([NotNull] string name)
|
||||||
|
{
|
||||||
|
Name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
[NotNull] public string Name { get; private set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Razor attribute. Indicates that a parameter or a method is a Razor section.
|
||||||
|
/// Use this attribute for custom wrappers similar to
|
||||||
|
/// <c>System.Web.WebPages.WebPageBase.RenderSection(String)</c>.
|
||||||
|
/// </summary>
|
||||||
|
[AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method)]
|
||||||
|
public sealed class RazorSectionAttribute : Attribute { }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates how method invocation affects content of the collection.
|
||||||
|
/// </summary>
|
||||||
|
[AttributeUsage(AttributeTargets.Method)]
|
||||||
|
public sealed class CollectionAccessAttribute : Attribute
|
||||||
|
{
|
||||||
|
public CollectionAccessAttribute(CollectionAccessType collectionAccessType)
|
||||||
|
{
|
||||||
|
CollectionAccessType = collectionAccessType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CollectionAccessType CollectionAccessType { get; private set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
[Flags]
|
||||||
|
public enum CollectionAccessType
|
||||||
|
{
|
||||||
|
/// <summary>Method does not use or modify content of the collection.</summary>
|
||||||
|
None = 0,
|
||||||
|
/// <summary>Method only reads content of the collection but does not modify it.</summary>
|
||||||
|
Read = 1,
|
||||||
|
/// <summary>Method can change content of the collection but does not add new elements.</summary>
|
||||||
|
ModifyExistingContent = 2,
|
||||||
|
/// <summary>Method can add new elements to the collection.</summary>
|
||||||
|
UpdatedContent = ModifyExistingContent | 4
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates that the marked method is assertion method, i.e. it halts control flow if
|
||||||
|
/// one of the conditions is satisfied. To set the condition, mark one of the parameters with
|
||||||
|
/// <see cref="AssertionConditionAttribute"/> attribute.
|
||||||
|
/// </summary>
|
||||||
|
[AttributeUsage(AttributeTargets.Method)]
|
||||||
|
public sealed class AssertionMethodAttribute : Attribute { }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates the condition parameter of the assertion method. The method itself should be
|
||||||
|
/// marked by <see cref="AssertionMethodAttribute"/> attribute. The mandatory argument of
|
||||||
|
/// the attribute is the assertion type.
|
||||||
|
/// </summary>
|
||||||
|
[AttributeUsage(AttributeTargets.Parameter)]
|
||||||
|
public sealed class AssertionConditionAttribute : Attribute
|
||||||
|
{
|
||||||
|
public AssertionConditionAttribute(AssertionConditionType conditionType)
|
||||||
|
{
|
||||||
|
ConditionType = conditionType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AssertionConditionType ConditionType { get; private set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Specifies assertion type. If the assertion method argument satisfies the condition,
|
||||||
|
/// then the execution continues. Otherwise, execution is assumed to be halted.
|
||||||
|
/// </summary>
|
||||||
|
public enum AssertionConditionType
|
||||||
|
{
|
||||||
|
/// <summary>Marked parameter should be evaluated to true.</summary>
|
||||||
|
IS_TRUE = 0,
|
||||||
|
/// <summary>Marked parameter should be evaluated to false.</summary>
|
||||||
|
IS_FALSE = 1,
|
||||||
|
/// <summary>Marked parameter should be evaluated to null value.</summary>
|
||||||
|
IS_NULL = 2,
|
||||||
|
/// <summary>Marked parameter should be evaluated to not null value.</summary>
|
||||||
|
IS_NOT_NULL = 3,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates that the marked method unconditionally terminates control flow execution.
|
||||||
|
/// For example, it could unconditionally throw exception.
|
||||||
|
/// </summary>
|
||||||
|
[Obsolete("Use [ContractAnnotation('=> halt')] instead")]
|
||||||
|
[AttributeUsage(AttributeTargets.Method)]
|
||||||
|
public sealed class TerminatesProgramAttribute : Attribute { }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates that method is pure LINQ method, with postponed enumeration (like Enumerable.Select,
|
||||||
|
/// .Where). This annotation allows inference of [InstantHandle] annotation for parameters
|
||||||
|
/// of delegate type by analyzing LINQ method chains.
|
||||||
|
/// </summary>
|
||||||
|
[AttributeUsage(AttributeTargets.Method)]
|
||||||
|
public sealed class LinqTunnelAttribute : Attribute { }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates that IEnumerable, passed as parameter, is not enumerated.
|
||||||
|
/// </summary>
|
||||||
|
[AttributeUsage(AttributeTargets.Parameter)]
|
||||||
|
public sealed class NoEnumerationAttribute : Attribute { }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates that parameter is regular expression pattern.
|
||||||
|
/// </summary>
|
||||||
|
[AttributeUsage(AttributeTargets.Parameter)]
|
||||||
|
public sealed class RegexPatternAttribute : 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.
|
||||||
|
/// </summary>
|
||||||
|
[AttributeUsage(AttributeTargets.Class)]
|
||||||
|
public sealed class XamlItemsControlAttribute : Attribute { }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// XAML attibute. 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>
|
||||||
|
/// <remarks>
|
||||||
|
/// Property should have the tree ancestor of the <c>ItemsControl</c> type or
|
||||||
|
/// marked with the <see cref="XamlItemsControlAttribute"/> attribute.
|
||||||
|
/// </remarks>
|
||||||
|
[AttributeUsage(AttributeTargets.Property)]
|
||||||
|
public sealed class XamlItemBindingOfItemsControlAttribute : Attribute { }
|
||||||
|
|
||||||
|
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
|
||||||
|
public sealed class AspChildControlTypeAttribute : Attribute
|
||||||
|
{
|
||||||
|
public AspChildControlTypeAttribute(string tagName, Type controlType)
|
||||||
|
{
|
||||||
|
TagName = tagName;
|
||||||
|
ControlType = controlType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string TagName { get; private set; }
|
||||||
|
public Type ControlType { get; private set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Method)]
|
||||||
|
public sealed class AspDataFieldAttribute : Attribute { }
|
||||||
|
|
||||||
|
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Method)]
|
||||||
|
public sealed class AspDataFieldsAttribute : Attribute { }
|
||||||
|
|
||||||
|
[AttributeUsage(AttributeTargets.Property)]
|
||||||
|
public sealed class AspMethodPropertyAttribute : Attribute { }
|
||||||
|
|
||||||
|
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
|
||||||
|
public sealed class AspRequiredAttributeAttribute : Attribute
|
||||||
|
{
|
||||||
|
public AspRequiredAttributeAttribute([NotNull] string attribute)
|
||||||
|
{
|
||||||
|
Attribute = attribute;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Attribute { get; private set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
[AttributeUsage(AttributeTargets.Property)]
|
||||||
|
public sealed class AspTypePropertyAttribute : Attribute
|
||||||
|
{
|
||||||
|
public bool CreateConstructorReferences { get; private set; }
|
||||||
|
|
||||||
|
public AspTypePropertyAttribute(bool createConstructorReferences)
|
||||||
|
{
|
||||||
|
CreateConstructorReferences = createConstructorReferences;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
|
||||||
|
public sealed class RazorImportNamespaceAttribute : Attribute
|
||||||
|
{
|
||||||
|
public RazorImportNamespaceAttribute(string name)
|
||||||
|
{
|
||||||
|
Name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Name { get; private set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
|
||||||
|
public sealed class RazorInjectionAttribute : Attribute
|
||||||
|
{
|
||||||
|
public RazorInjectionAttribute(string type, string fieldName)
|
||||||
|
{
|
||||||
|
Type = type;
|
||||||
|
FieldName = fieldName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Type { get; private set; }
|
||||||
|
public string FieldName { get; private set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
[AttributeUsage(AttributeTargets.Method)]
|
||||||
|
public sealed class RazorHelperCommonAttribute : Attribute { }
|
||||||
|
|
||||||
|
[AttributeUsage(AttributeTargets.Property)]
|
||||||
|
public sealed class RazorLayoutAttribute : Attribute { }
|
||||||
|
|
||||||
|
[AttributeUsage(AttributeTargets.Method)]
|
||||||
|
public sealed class RazorWriteLiteralMethodAttribute : Attribute { }
|
||||||
|
|
||||||
|
[AttributeUsage(AttributeTargets.Method)]
|
||||||
|
public sealed class RazorWriteMethodAttribute : Attribute { }
|
||||||
|
|
||||||
|
[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 { }
|
||||||
|
}
|
||||||
35
Filtration.ObjectModel/Properties/AssemblyInfo.cs
Normal file
35
Filtration.ObjectModel/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
// General Information about an assembly is controlled through the following
|
||||||
|
// set of attributes. Change these attribute values to modify the information
|
||||||
|
// associated with an assembly.
|
||||||
|
[assembly: AssemblyTitle("Filtration.ObjectModel")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("Microsoft")]
|
||||||
|
[assembly: AssemblyProduct("Filtration.ObjectModel")]
|
||||||
|
[assembly: AssemblyCopyright("Copyright © Microsoft 2015")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
// Setting ComVisible to false makes the types in this assembly not visible
|
||||||
|
// to COM components. If you need to access a type in this assembly from
|
||||||
|
// COM, set the ComVisible attribute to true on that type.
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||||
|
[assembly: Guid("1b4dc4e6-68eb-4586-8570-63e9196fb1de")]
|
||||||
|
|
||||||
|
// Version information for an assembly consists of the following four values:
|
||||||
|
//
|
||||||
|
// Major Version
|
||||||
|
// Minor Version
|
||||||
|
// Build Number
|
||||||
|
// Revision
|
||||||
|
//
|
||||||
|
// 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("1.0.0.0")]
|
||||||
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
|
|
||||||
namespace Filtration.Models
|
namespace Filtration.ObjectModel
|
||||||
{
|
{
|
||||||
internal class ReplaceColorsParameterSet
|
public class ReplaceColorsParameterSet
|
||||||
{
|
{
|
||||||
public Color OldTextColor { get; set; }
|
public Color OldTextColor { get; set; }
|
||||||
public Color NewTextColor { get; set; }
|
public Color NewTextColor { get; set; }
|
||||||
42
Filtration.ObjectModel/ThemeEditor/Theme.cs
Normal file
42
Filtration.ObjectModel/ThemeEditor/Theme.cs
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Xml.Serialization;
|
||||||
|
using Filtration.ObjectModel.Enums;
|
||||||
|
|
||||||
|
namespace Filtration.ObjectModel.ThemeEditor
|
||||||
|
{
|
||||||
|
[Serializable]
|
||||||
|
public class Theme
|
||||||
|
{
|
||||||
|
private readonly ThemeComponentCollection _components;
|
||||||
|
|
||||||
|
public Theme()
|
||||||
|
{
|
||||||
|
_components = new ThemeComponentCollection { IsMasterCollection = false};
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
[XmlIgnore]
|
||||||
|
public string FilePath { get; set; }
|
||||||
|
|
||||||
|
public ThemeComponentCollection Components
|
||||||
|
{
|
||||||
|
get { return _components; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool ComponentExists(ThemeComponentType componentType, string componentName)
|
||||||
|
{
|
||||||
|
var componentCount =
|
||||||
|
_components.Count(c => c.ComponentName == componentName && c.ComponentType == componentType);
|
||||||
|
return componentCount > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AddComponent(ThemeComponentType componentType, string componentName, Color componentColor)
|
||||||
|
{
|
||||||
|
_components.Add(new ThemeComponent(componentType, componentName, componentColor));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
106
Filtration.ObjectModel/ThemeEditor/ThemeComponent.cs
Normal file
106
Filtration.ObjectModel/ThemeEditor/ThemeComponent.cs
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
using System;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Xml.Serialization;
|
||||||
|
using Filtration.ObjectModel.Annotations;
|
||||||
|
using Filtration.ObjectModel.Enums;
|
||||||
|
|
||||||
|
namespace Filtration.ObjectModel.ThemeEditor
|
||||||
|
{
|
||||||
|
[Serializable]
|
||||||
|
public class ThemeComponent : INotifyPropertyChanged
|
||||||
|
{
|
||||||
|
private Color _color;
|
||||||
|
private EventHandler _themeComponentUpdatedEventHandler;
|
||||||
|
private readonly object _eventLock = new object();
|
||||||
|
|
||||||
|
public ThemeComponent()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public ThemeComponent(ThemeComponentType componentType, string componentName, Color componentColor)
|
||||||
|
{
|
||||||
|
if (componentName == null || componentColor == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentException("Null parameters not allowed in ThemeComponent constructor");
|
||||||
|
}
|
||||||
|
|
||||||
|
ComponentType = componentType;
|
||||||
|
Color = componentColor;
|
||||||
|
ComponentName = componentName;
|
||||||
|
}
|
||||||
|
|
||||||
|
// By implementing a custom event accessor here we can keep the UsageCount up to date.
|
||||||
|
public event EventHandler ThemeComponentUpdated
|
||||||
|
{
|
||||||
|
add
|
||||||
|
{
|
||||||
|
lock (_eventLock)
|
||||||
|
{
|
||||||
|
_themeComponentUpdatedEventHandler += value;
|
||||||
|
OnPropertyChanged("UsageCount");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
remove
|
||||||
|
{
|
||||||
|
lock (_eventLock)
|
||||||
|
{
|
||||||
|
// ReSharper disable once DelegateSubtraction
|
||||||
|
_themeComponentUpdatedEventHandler -= value;
|
||||||
|
OnPropertyChanged("UsageCount");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public event EventHandler ThemeComponentDeleted;
|
||||||
|
|
||||||
|
public string ComponentName { get; set; }
|
||||||
|
public ThemeComponentType ComponentType{ get; set; }
|
||||||
|
|
||||||
|
public Color Color
|
||||||
|
{
|
||||||
|
get { return _color; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_color = value;
|
||||||
|
OnPropertyChanged();
|
||||||
|
if (_themeComponentUpdatedEventHandler != null)
|
||||||
|
{
|
||||||
|
_themeComponentUpdatedEventHandler.Invoke(this, EventArgs.Empty);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int UsageCount
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_themeComponentUpdatedEventHandler == null)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return _themeComponentUpdatedEventHandler.GetInvocationList().Length;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void TerminateComponent()
|
||||||
|
{
|
||||||
|
if (ThemeComponentDeleted != null)
|
||||||
|
{
|
||||||
|
ThemeComponentDeleted.Invoke(this, EventArgs.Empty);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public event PropertyChangedEventHandler PropertyChanged;
|
||||||
|
|
||||||
|
[NotifyPropertyChangedInvocator]
|
||||||
|
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
||||||
|
{
|
||||||
|
var handler = PropertyChanged;
|
||||||
|
if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using Filtration.ObjectModel.Enums;
|
||||||
|
|
||||||
|
namespace Filtration.ObjectModel.ThemeEditor
|
||||||
|
{
|
||||||
|
public class ThemeComponentCollection : ObservableCollection<ThemeComponent>
|
||||||
|
{
|
||||||
|
public bool IsMasterCollection { get; set; }
|
||||||
|
|
||||||
|
public ThemeComponent AddComponent(ThemeComponentType componentType, string componentName, Color componentColor)
|
||||||
|
{
|
||||||
|
if (ComponentExists(componentType, componentName))
|
||||||
|
{
|
||||||
|
return Items.FirstOrDefault(t => t.ComponentName == componentName && t.ComponentType == componentType);
|
||||||
|
}
|
||||||
|
|
||||||
|
var component = new ThemeComponent(componentType, componentName, componentColor);
|
||||||
|
Items.Add(component);
|
||||||
|
|
||||||
|
return component;
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool ComponentExists(ThemeComponentType componentType, string componentName)
|
||||||
|
{
|
||||||
|
var componentCount =
|
||||||
|
Items.Count(c => c.ComponentName == componentName && c.ComponentType == componentType);
|
||||||
|
return componentCount > 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -46,21 +46,37 @@
|
|||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Models\TestLootFilterBlock.cs" />
|
|
||||||
<Compile Include="Models\TestLootFilterScript.cs" />
|
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="Services\TestLootFilterPersistenceService.cs" />
|
<Compile Include="Repositories\TestItemFilterScriptRepository.cs" />
|
||||||
|
<Compile Include="Services\TestHTTPService.cs" />
|
||||||
|
<Compile Include="Services\TestItemFilterPersistenceService.cs" />
|
||||||
<Compile Include="Services\TestStaticDataService.cs" />
|
<Compile Include="Services\TestStaticDataService.cs" />
|
||||||
<Compile Include="Translators\TestLootFilterBlockTranslator.cs" />
|
<Compile Include="Services\TestUpdateService.cs" />
|
||||||
<Compile Include="Translators\TestLootFilterScriptTranslator.cs" />
|
<Compile Include="Translators\TestBlockGroupHierarchyBuilder.cs" />
|
||||||
|
<Compile Include="Translators\TestItemFilterBlockTranslator.cs" />
|
||||||
|
<Compile Include="Translators\TestItemFilterScriptTranslator.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<None Include="app.config" />
|
||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Folder Include="Models\" />
|
||||||
<Folder Include="ViewModels\" />
|
<Folder Include="ViewModels\" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\Filtration.Common\Filtration.Common.csproj">
|
||||||
|
<Project>{8cb44f28-2956-4c2a-9314-72727262edd4}</Project>
|
||||||
|
<Name>Filtration.Common</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\Filtration.Interface\Filtration.Interface.csproj">
|
||||||
|
<Project>{0f333344-7695-47b2-b0e6-172e4de74819}</Project>
|
||||||
|
<Name>Filtration.Interface</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\Filtration.ObjectModel\Filtration.ObjectModel.csproj">
|
||||||
|
<Project>{4aac3beb-1dc1-483e-9d11-0e9334e80227}</Project>
|
||||||
|
<Name>Filtration.ObjectModel</Name>
|
||||||
|
</ProjectReference>
|
||||||
<ProjectReference Include="..\Filtration\Filtration.csproj">
|
<ProjectReference Include="..\Filtration\Filtration.csproj">
|
||||||
<Project>{55e0a34c-e039-43d7-a024-a4045401cdda}</Project>
|
<Project>{55e0a34c-e039-43d7-a024-a4045401cdda}</Project>
|
||||||
<Name>Filtration</Name>
|
<Name>Filtration</Name>
|
||||||
@@ -70,7 +86,7 @@
|
|||||||
<Content Include="Resources\testscript.txt">
|
<Content Include="Resources\testscript.txt">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="Resources\ThioleLootFilter.txt">
|
<Content Include="Resources\ThioleItemFilter.txt">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|||||||
@@ -1,55 +0,0 @@
|
|||||||
using Filtration.Models;
|
|
||||||
using Filtration.Models.BlockItemTypes;
|
|
||||||
using NUnit.Framework;
|
|
||||||
|
|
||||||
namespace Filtration.Tests.Models
|
|
||||||
{
|
|
||||||
[TestFixture]
|
|
||||||
public class TestLootFilterBlock
|
|
||||||
{
|
|
||||||
[Test]
|
|
||||||
public void LootFilterBlock_BlockCount_ReturnsCorrectNumber()
|
|
||||||
{
|
|
||||||
// Arrange
|
|
||||||
var block = new LootFilterBlock();
|
|
||||||
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 LootFilterBlock_AddBlockItemAllowed_LessThanMaximum_ReturnsTrue()
|
|
||||||
{
|
|
||||||
// Arrange
|
|
||||||
var block = new LootFilterBlock();
|
|
||||||
block.BlockItems.Add(new ItemLevelBlockItem());
|
|
||||||
|
|
||||||
// Act
|
|
||||||
bool result = block.AddBlockItemAllowed(typeof (ItemLevelBlockItem));
|
|
||||||
|
|
||||||
// Assert
|
|
||||||
Assert.IsTrue(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void LootFilterBlock_AddBlockItemAllowed_MoreThanMaximum_ReturnsFalse()
|
|
||||||
{
|
|
||||||
// Arrange
|
|
||||||
var block = new LootFilterBlock();
|
|
||||||
block.BlockItems.Add(new SoundBlockItem());
|
|
||||||
|
|
||||||
// Act
|
|
||||||
bool result = block.AddBlockItemAllowed(typeof (SoundBlockItem));
|
|
||||||
|
|
||||||
// Assert
|
|
||||||
Assert.IsFalse(result);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
// General Information about an assembly is controlled through the following
|
// General Information about an assembly is controlled through the following
|
||||||
|
|||||||
118
Filtration.Tests/Repositories/TestItemFilterScriptRepository.cs
Normal file
118
Filtration.Tests/Repositories/TestItemFilterScriptRepository.cs
Normal file
@@ -0,0 +1,118 @@
|
|||||||
|
using System.IO;
|
||||||
|
using Filtration.Repositories;
|
||||||
|
using Filtration.Services;
|
||||||
|
using Filtration.ViewModels;
|
||||||
|
using Moq;
|
||||||
|
using NUnit.Framework;
|
||||||
|
|
||||||
|
namespace Filtration.Tests.Repositories
|
||||||
|
{
|
||||||
|
[TestFixture]
|
||||||
|
public class TestItemFilterScriptRepository
|
||||||
|
{
|
||||||
|
[Test]
|
||||||
|
public void LoadScriptFromFile_CallsPersistenceServiceUsingPathAndReturnsViewModel()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var testInputPath = "C:\\TestPath.filter";
|
||||||
|
|
||||||
|
|
||||||
|
var mockPersistenceService = new Mock<IItemFilterPersistenceService>();
|
||||||
|
mockPersistenceService.Setup(p => p.LoadItemFilterScript(testInputPath)).Verifiable();
|
||||||
|
|
||||||
|
var mockItemFilterScriptViewModel = new Mock<IItemFilterScriptViewModel>();
|
||||||
|
|
||||||
|
var mockItemFilterScriptViewModelFactory = new Mock<IItemFilterScriptViewModelFactory>();
|
||||||
|
mockItemFilterScriptViewModelFactory.Setup(f => f.Create()).Returns(mockItemFilterScriptViewModel.Object);
|
||||||
|
|
||||||
|
var repository = new ItemFilterScriptRepository(mockPersistenceService.Object, mockItemFilterScriptViewModelFactory.Object);
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var result = repository.LoadScriptFromFile(testInputPath);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
mockPersistenceService.Verify();
|
||||||
|
Assert.AreEqual(mockItemFilterScriptViewModel.Object, result);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void LoadScriptFromFile_PersistenceServiceThrows_ThrowsIOException()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var testInputPath = "C:\\TestPath.filter";
|
||||||
|
|
||||||
|
var mockPersistenceService = new Mock<IItemFilterPersistenceService>();
|
||||||
|
mockPersistenceService.Setup(p => p.LoadItemFilterScript(testInputPath)).Throws<IOException>();
|
||||||
|
|
||||||
|
var mockItemFilterScriptViewModelFactory = new Mock<IItemFilterScriptViewModelFactory>();
|
||||||
|
|
||||||
|
var repository = new ItemFilterScriptRepository(mockPersistenceService.Object, mockItemFilterScriptViewModelFactory.Object);
|
||||||
|
|
||||||
|
// Act
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.Throws<IOException>(() => repository.LoadScriptFromFile(testInputPath));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void SetItemFilterScriptDirectory_CallsPersistenceServiceSetItemFilterScriptDirectory()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var testInputPath = "C:\\Test\\Path";
|
||||||
|
|
||||||
|
var mockPersistenceService = new Mock<IItemFilterPersistenceService>();
|
||||||
|
mockPersistenceService.Setup(p => p.SetItemFilterScriptDirectory(testInputPath)).Verifiable();
|
||||||
|
|
||||||
|
var mockItemFilterScriptViewModelFactory = new Mock<IItemFilterScriptViewModelFactory>();
|
||||||
|
|
||||||
|
var repository = new ItemFilterScriptRepository(mockPersistenceService.Object, mockItemFilterScriptViewModelFactory.Object);
|
||||||
|
|
||||||
|
// Act
|
||||||
|
repository.SetItemFilterScriptDirectory(testInputPath);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
mockPersistenceService.Verify();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void GetItemFilterScriptDirectory_ReturnsItemFilterScriptDirectoryFromPersistenceService()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var testInputPath = "C:\\Test\\Path";
|
||||||
|
|
||||||
|
var mockPersistenceService = new Mock<IItemFilterPersistenceService>();
|
||||||
|
mockPersistenceService.SetupGet(p => p.ItemFilterScriptDirectory).Returns(testInputPath).Verifiable();
|
||||||
|
|
||||||
|
var mockItemFilterScriptViewModelFactory = new Mock<IItemFilterScriptViewModelFactory>();
|
||||||
|
|
||||||
|
var repository = new ItemFilterScriptRepository(mockPersistenceService.Object, mockItemFilterScriptViewModelFactory.Object);
|
||||||
|
|
||||||
|
// Act
|
||||||
|
string result = repository.GetItemFilterScriptDirectory();
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
mockPersistenceService.Verify();
|
||||||
|
Assert.AreEqual(result, testInputPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void NewScript_ReturnsScriptFromViewModelFactory()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var mockPersistenceService = new Mock<IItemFilterPersistenceService>();
|
||||||
|
|
||||||
|
var mockItemFilterScriptViewModel = new Mock<IItemFilterScriptViewModel>();
|
||||||
|
|
||||||
|
var mockItemFilterScriptViewModelFactory = new Mock<IItemFilterScriptViewModelFactory>();
|
||||||
|
mockItemFilterScriptViewModelFactory.Setup(f => f.Create()).Returns(mockItemFilterScriptViewModel.Object);
|
||||||
|
|
||||||
|
var repository = new ItemFilterScriptRepository(mockPersistenceService.Object, mockItemFilterScriptViewModelFactory.Object);
|
||||||
|
|
||||||
|
// Act
|
||||||
|
IItemFilterScriptViewModel result = repository.NewScript();
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.AreEqual(mockItemFilterScriptViewModel.Object, result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user