Initial Commit
This commit is contained in:
commit
446fe51843
|
@ -0,0 +1,189 @@
|
|||
## Ignore Visual Studio temporary files, build results, and
|
||||
## files generated by popular Visual Studio add-ons.
|
||||
|
||||
# User-specific files
|
||||
*.suo
|
||||
*.user
|
||||
*.sln.docstates
|
||||
|
||||
# Build results
|
||||
[Dd]ebug/
|
||||
[Dd]ebugPublic/
|
||||
[Rr]elease/
|
||||
x64/
|
||||
build/
|
||||
bld/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
|
||||
# Roslyn cache directories
|
||||
*.ide/
|
||||
|
||||
# MSTest test Results
|
||||
[Tt]est[Rr]esult*/
|
||||
[Bb]uild[Ll]og.*
|
||||
|
||||
#NUNIT
|
||||
*.VisualState.xml
|
||||
TestResult.xml
|
||||
|
||||
# Build Results of an ATL Project
|
||||
[Dd]ebugPS/
|
||||
[Rr]eleasePS/
|
||||
dlldata.c
|
||||
|
||||
*_i.c
|
||||
*_p.c
|
||||
*_i.h
|
||||
*.ilk
|
||||
*.meta
|
||||
*.obj
|
||||
*.pch
|
||||
*.pdb
|
||||
*.pgc
|
||||
*.pgd
|
||||
*.rsp
|
||||
*.sbr
|
||||
*.tlb
|
||||
*.tli
|
||||
*.tlh
|
||||
*.tmp
|
||||
*.tmp_proj
|
||||
*.log
|
||||
*.vspscc
|
||||
*.vssscc
|
||||
.builds
|
||||
*.pidb
|
||||
*.svclog
|
||||
*.scc
|
||||
|
||||
# Chutzpah Test files
|
||||
_Chutzpah*
|
||||
|
||||
# Visual C++ cache files
|
||||
ipch/
|
||||
*.aps
|
||||
*.ncb
|
||||
*.opensdf
|
||||
*.sdf
|
||||
*.cachefile
|
||||
|
||||
# Visual Studio profiler
|
||||
*.psess
|
||||
*.vsp
|
||||
*.vspx
|
||||
|
||||
# TFS 2012 Local Workspace
|
||||
$tf/
|
||||
|
||||
# Guidance Automation Toolkit
|
||||
*.gpState
|
||||
|
||||
# ReSharper is a .NET coding add-in
|
||||
_ReSharper*/
|
||||
*.[Rr]e[Ss]harper
|
||||
*.DotSettings.user
|
||||
|
||||
# JustCode is a .NET coding addin-in
|
||||
.JustCode
|
||||
|
||||
# TeamCity is a build add-in
|
||||
_TeamCity*
|
||||
|
||||
# DotCover is a Code Coverage Tool
|
||||
*.dotCover
|
||||
|
||||
# NCrunch
|
||||
_NCrunch_*
|
||||
.*crunch*.local.xml
|
||||
|
||||
# MightyMoose
|
||||
*.mm.*
|
||||
AutoTest.Net/
|
||||
|
||||
# Web workbench (sass)
|
||||
.sass-cache/
|
||||
|
||||
# Installshield output folder
|
||||
[Ee]xpress/
|
||||
|
||||
# DocProject is a documentation generator add-in
|
||||
DocProject/buildhelp/
|
||||
DocProject/Help/*.HxT
|
||||
DocProject/Help/*.HxC
|
||||
DocProject/Help/*.hhc
|
||||
DocProject/Help/*.hhk
|
||||
DocProject/Help/*.hhp
|
||||
DocProject/Help/Html2
|
||||
DocProject/Help/html
|
||||
|
||||
# Click-Once directory
|
||||
publish/
|
||||
|
||||
# Publish Web Output
|
||||
*.[Pp]ublish.xml
|
||||
*.azurePubxml
|
||||
## TODO: Comment the next line if you want to checkin your
|
||||
## web deploy settings but do note that will include unencrypted
|
||||
## passwords
|
||||
#*.pubxml
|
||||
|
||||
# NuGet Packages Directory
|
||||
packages/*
|
||||
## TODO: If the tool you use requires repositories.config
|
||||
## uncomment the next line
|
||||
#!packages/repositories.config
|
||||
|
||||
# Enable "build/" folder in the NuGet Packages folder since
|
||||
# NuGet packages use it for MSBuild targets.
|
||||
# This line needs to be after the ignore of the build folder
|
||||
# (and the packages folder if the line above has been uncommented)
|
||||
!packages/build/
|
||||
|
||||
# Windows Azure Build Output
|
||||
csx/
|
||||
*.build.csdef
|
||||
|
||||
# Windows Store app package directory
|
||||
AppPackages/
|
||||
|
||||
# Others
|
||||
sql/
|
||||
*.Cache
|
||||
ClientBin/
|
||||
[Ss]tyle[Cc]op.*
|
||||
~$*
|
||||
*~
|
||||
*.dbmdl
|
||||
*.dbproj.schemaview
|
||||
*.pfx
|
||||
*.publishsettings
|
||||
node_modules/
|
||||
|
||||
# RIA/Silverlight projects
|
||||
Generated_Code/
|
||||
|
||||
# Backup & report files from converting an old project file
|
||||
# to a newer Visual Studio version. Backup files are not needed,
|
||||
# because we have git ;-)
|
||||
_UpgradeReport_Files/
|
||||
Backup*/
|
||||
UpgradeLog*.XML
|
||||
UpgradeLog*.htm
|
||||
|
||||
# SQL Server files
|
||||
*.mdf
|
||||
*.ldf
|
||||
|
||||
# Business Intelligence projects
|
||||
*.rdl.data
|
||||
*.bim.layout
|
||||
*.bim_*.settings
|
||||
|
||||
# Microsoft Fakes
|
||||
FakesAssemblies/
|
||||
|
||||
# LightSwitch generated files
|
||||
GeneratedArtifacts/
|
||||
_Pvt_Extensions/
|
||||
ModelManifest.xml
|
|
@ -0,0 +1,85 @@
|
|||
<?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>{E0693972-72C5-4E05-A9C5-A5943E4015C6}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Filtration.Tests</RootNamespace>
|
||||
<AssemblyName>Filtration.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.1502.0911\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="Models\TestLootFilterBlock.cs" />
|
||||
<Compile Include="Models\TestLootFilterScript.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Services\TestLootFilterPersistenceService.cs" />
|
||||
<Compile Include="Services\TestStaticDataService.cs" />
|
||||
<Compile Include="Translators\TestLootFilterBlockTranslator.cs" />
|
||||
<Compile Include="Translators\TestLootFilterScriptTranslator.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="ViewModels\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Filtration\Filtration.csproj">
|
||||
<Project>{55e0a34c-e039-43d7-a024-a4045401cdda}</Project>
|
||||
<Name>Filtration</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Resources\testscript.txt">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Resources\ThioleLootFilter.txt">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</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,55 @@
|
|||
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);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Filtration.Models;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Filtration.Tests.Models
|
||||
{
|
||||
[TestFixture]
|
||||
public class TestLootFilterScript
|
||||
{
|
||||
[Test]
|
||||
public void Validate_AtLeastOneBlock_Fail_ReturnsListWithCorrectError()
|
||||
{
|
||||
// Arrange
|
||||
|
||||
var script = new LootFilterScript();
|
||||
|
||||
// Act
|
||||
var result = script.Validate();
|
||||
|
||||
// Assert
|
||||
Assert.AreEqual(1, result.Count(r => r.Contains("A script must have at least one block")));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Validate_AtLeastOneBlock_Pass_ReturnsListWithoutError()
|
||||
{
|
||||
// Arrange
|
||||
|
||||
var script = new LootFilterScript
|
||||
{
|
||||
LootFilterBlocks = new ObservableCollection<LootFilterBlock> {new LootFilterBlock()}
|
||||
};
|
||||
|
||||
// Act
|
||||
var result = script.Validate();
|
||||
|
||||
// Assert
|
||||
Assert.AreEqual(0, result.Count(r => r.Contains("A script must have at least one block")));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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.Tests")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Microsoft")]
|
||||
[assembly: AssemblyProduct("Filtration.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("307a4c95-f595-485b-8a04-8c4d461c5325")]
|
||||
|
||||
// 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,914 @@
|
|||
###BETA VERSION 1.0.0.1-8
|
||||
#Please test and let me know via pm on reddit /u/brute_force or @Thiole in game if i am online
|
||||
|
||||
#------------------------------------------------------------------
|
||||
#Fishing Rods First OFC
|
||||
Show
|
||||
Class Fishing Rods
|
||||
SetTextColor 0 0 0
|
||||
SetBorderColor 0 0 0
|
||||
SetBackgroundColor 255 255 255
|
||||
|
||||
Show
|
||||
Class "Quest Items"
|
||||
|
||||
#####Shows better currency differently from lower currency for efficiency
|
||||
##### skill gems
|
||||
Show
|
||||
Class "Active Skill Gems" "Support Skill Gems"
|
||||
Quality >= 1
|
||||
SetFontSize 28
|
||||
SetTextColor 0 200 200
|
||||
SetBorderColor 0 200 200
|
||||
|
||||
Show
|
||||
Class "Active Skill Gems" "Support Skill Gems"
|
||||
SetFontSize 30
|
||||
SetTextColor 0 200 200
|
||||
|
||||
# Section: Chance bases
|
||||
|
||||
Show
|
||||
BaseType "Lapis Amulet" "Amber Amulet"
|
||||
SetFontSize 25
|
||||
SetBorderColor 255 0 255
|
||||
|
||||
Show
|
||||
SocketGroup RGB BGR
|
||||
SetFontSize 30
|
||||
SetBorderColor 0 255 0
|
||||
|
||||
#Chance Bases
|
||||
Show
|
||||
BaseType "Prophecy Wand" "Leather Belt" "Occultist's Vestment" "Agate Amulet" "Gavel"
|
||||
SetFontSize 30
|
||||
Rarity Normal
|
||||
SetBorderColor 255 0 255
|
||||
|
||||
|
||||
################currency highlighting
|
||||
Show
|
||||
BaseType "Mirror of Kalandra" "Exalted Orb" "Divine Orb" "Orb of Regret" "Eternal Orb" "Regal Orb"
|
||||
SetTextColor 200 200 130
|
||||
SetBorderColor 200 200 130
|
||||
SetBackgroundColor 0 0 0
|
||||
SetFontSize 32
|
||||
|
||||
Show
|
||||
BaseType "Gemcutter's Prism" "Chaos Orb" "Orb of Fusing" "Orb of Alchemy"
|
||||
SetBorderColor 200 200 130
|
||||
SetTextColor 200 200 130
|
||||
SetFontSize 30
|
||||
|
||||
Show
|
||||
BaseType "Chromatic Orb"
|
||||
SetBorderColor 0 255 0
|
||||
SetTextColor 200 200 130
|
||||
|
||||
Show
|
||||
BaseType "Cartographer's Chisel"
|
||||
SetBorderColor 0 0 255
|
||||
SetTextColor 200 200 130
|
||||
Show
|
||||
Class Currency
|
||||
SetTextColor 200 200 130
|
||||
SetFontSize 30
|
||||
SetBackgroundColor 0 0 0
|
||||
#############################
|
||||
|
||||
#unique Weapon slot start
|
||||
|
||||
#staves / wands
|
||||
|
||||
|
||||
Show
|
||||
BaseType "Judgement Staff" "Long Staff" "Vile Staff" "Imperial Staff" "Prophecy Wand" "Spiraled Wand"
|
||||
Rarity Unique
|
||||
SetTextColor 175 100 40
|
||||
SetBorderColor 175 100 40
|
||||
SetBackgroundColor 0 0 0
|
||||
|
||||
Show
|
||||
Class "Staves"
|
||||
Rarity Unique
|
||||
DropLevel = 48
|
||||
SetTextColor 175 100 40
|
||||
SetBorderColor 175 100 40
|
||||
SetBackgroundColor 0 0 0
|
||||
|
||||
#Claws / Daggers
|
||||
|
||||
Show
|
||||
BaseType "Slaughter Knife" "Imperial Skean" "Thresher Claw"
|
||||
Rarity Unique
|
||||
SetTextColor 175 100 40
|
||||
SetBorderColor 175 100 40
|
||||
SetBackgroundColor 0 0 0
|
||||
|
||||
#Maces / Sceptres / Mauls / Axes
|
||||
|
||||
Show
|
||||
BaseType "Void Sceptre" "Siege Axe" "Gavel"
|
||||
Rarity Unique
|
||||
SetTextColor 175 100 40
|
||||
SetBorderColor 175 100 40
|
||||
SetBackgroundColor 0 0 0
|
||||
|
||||
#Swords
|
||||
|
||||
|
||||
|
||||
#Bows
|
||||
Show
|
||||
BaseType "Spine Bow" "Imperial Bow"
|
||||
Rarity Unique
|
||||
SetTextColor 175 100 40
|
||||
SetBorderColor 175 100 40
|
||||
SetBackgroundColor 0 0 0
|
||||
|
||||
#Body Armor
|
||||
Show
|
||||
BaseType "Simple Robe" "Full Wyrmscale" "Varnished Coat" "Occultist's Vestment" "Glorious Plate" "Sacrificial Garb"
|
||||
Rarity Unique
|
||||
SetTextColor 175 100 40
|
||||
SetBorderColor 175 100 40
|
||||
SetBackgroundColor 0 0 0
|
||||
|
||||
#boots
|
||||
Show
|
||||
BaseType "Conjurer Boots"
|
||||
Rarity Unique
|
||||
SetTextColor 175 100 40
|
||||
SetBorderColor 175 100 40
|
||||
SetBackgroundColor 0 0 0
|
||||
#gloves
|
||||
Show
|
||||
BaseType "Vaal Gauntlets" "Strapped Mitts" "Conjurer Gloves" "Deerskin Gloves" "Murder Mitts"
|
||||
Rarity Unique
|
||||
SetTextColor 175 100 40
|
||||
SetBorderColor 175 100 40
|
||||
SetBackgroundColor 0 0 0
|
||||
|
||||
|
||||
#helm
|
||||
Show
|
||||
BaseType "Sinner Tricorne" "Ursine Pelt" "Ezomyte Burgonet" "Great Crown"
|
||||
Rarity Unique
|
||||
SetTextColor 175 100 40
|
||||
SetBorderColor 175 100 40
|
||||
SetBackgroundColor 0 0 0
|
||||
|
||||
#######shields
|
||||
|
||||
Show
|
||||
BaseType "Champion Kite Shield" "Archon Kite Shield" "Titanium Spirit Shield" "Mosaic Kite Shield" "Branded Kite Shield"
|
||||
Rarity Unique
|
||||
SetTextColor 175 100 40
|
||||
SetBorderColor 175 100 40
|
||||
SetBackgroundColor 0 0 0
|
||||
|
||||
#######Amulet / Ring/ Belt
|
||||
|
||||
|
||||
Show
|
||||
BaseType "Amber Amulet" "Onyx Amulet" "Agate Amulet" "Chain Belt"
|
||||
Rarity Unique
|
||||
SetTextColor 175 100 40
|
||||
SetBorderColor 175 100 40
|
||||
SetBackgroundColor 0 0 0
|
||||
|
||||
Show
|
||||
BaseType "Gold Ring" "Sapphire Ring" "Prismatic Ring" "Amethyst Ring" "Paua Ring"
|
||||
Rarity Unique
|
||||
SetTextColor 175 100 40
|
||||
SetBorderColor 175 100 40
|
||||
SetBackgroundColor 0 0 0
|
||||
|
||||
#Utility
|
||||
Show
|
||||
Class Jewel "Utility Flask"
|
||||
Rarity Unique
|
||||
SetTextColor 175 100 40
|
||||
SetBorderColor 175 100 40
|
||||
SetBackgroundColor 0 0 0
|
||||
|
||||
Show
|
||||
Class Jewel
|
||||
SetBorderColor 255 0 255
|
||||
|
||||
################### LEVEL BASED UNIQUE HIGHLIGHTING #############################
|
||||
Show
|
||||
BaseType "Steelscale Gauntlets" "Prophet Crown" "Leather Cap" "Pine Buckler"
|
||||
Rarity Unique
|
||||
ItemLevel < 70
|
||||
SetTextColor 175 100 40
|
||||
SetBorderColor 0 0 0
|
||||
SetBackgroundColor 175 100 40
|
||||
|
||||
|
||||
####
|
||||
Show
|
||||
Rarity Unique
|
||||
SetFontSize 30
|
||||
SetTextColor 175 100 40
|
||||
SetBackgroundColor 0 0 0
|
||||
|
||||
|
||||
|
||||
|
||||
###########RARES#####
|
||||
|
||||
#Global Rules
|
||||
|
||||
Show
|
||||
Class Amulets Rings Belt
|
||||
Rarity Rare
|
||||
SetFontSize 30
|
||||
SetTextColor 255 255 0
|
||||
SetBorderColor 255 255 0
|
||||
SetBackgroundColor 0 60 0 200
|
||||
|
||||
Show
|
||||
BaseType "Sai" "Moon Staff" "Maraketh Bow" "Tiger Hook" "Morning Star" "Tornado Wand" "Prophecy Wand" "Imbued Wand" "Infernal Sword" "Void Axe" "Jewelled Foil" "Harpy Rapier" "Judgement Staff" "Void Sceptre" "Midnight Blade" "Eternal Sword" "Harbinger Bow" "Imperial Claw" "Ambusher" "Platinum Kris" "Terror Claw" "Imperial Skean" "Demon Dagger" "Infernal Axe"
|
||||
Rarity Rare
|
||||
SetFontSize 30
|
||||
SetTextColor 255 255 0
|
||||
SetBorderColor 255 255 0
|
||||
SetBackgroundColor 0 0 0
|
||||
|
||||
|
||||
|
||||
|
||||
##Level Scaling Rules
|
||||
##low 60 bases###############################
|
||||
|
||||
Show
|
||||
BaseType "Terror Maul" "Vaal Rapier" "Imperial Staff" "Carnal Sceptre" "Imperial Bow" "Vaal Claw" "Thicket Bow" "Vaal Hatchet" "Royal Axe" "Nightmare Mace" "Vaal Blade" "Vaal Sceptre"
|
||||
Rarity Rare
|
||||
ItemLevel <= 70
|
||||
SetFontSize 30
|
||||
SetTextColor 255 255 0
|
||||
SetBorderColor 255 255 0
|
||||
SetBackgroundColor 0 0 0
|
||||
|
||||
Show
|
||||
BaseType "Terror Maul" "Vaal Rapier" "Imperial Staff" "Carnal Sceptre" "Imperial Bow" "Vaal Claw" "Thicket Bow" "Vaal Hatchet" "Royal Axe" "Nightmare Mace" "Vaal Blade" "Vaal Sceptre"
|
||||
Rarity Rare
|
||||
ItemLevel <= 75
|
||||
SetFontSize 30
|
||||
SetTextColor 255 255 0
|
||||
SetBorderColor 255 255 0
|
||||
SetBackgroundColor 0 100 0 200
|
||||
#####
|
||||
Show
|
||||
Class "Body Armour" "Gloves" "Boots" "Belt" "Helm" "Shield" "Quiver" "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
|
||||
Rarity Rare
|
||||
ItemLevel <= 75
|
||||
DropLevel >= 67
|
||||
SetFontSize 30
|
||||
SetTextColor 255 255 0
|
||||
SetBorderColor 255 255 0
|
||||
SetBackgroundColor 0 100 0 200
|
||||
|
||||
Show
|
||||
Class "Body Armour" "Gloves" "Boots" "Belt" "Helm" "Shield" "Quiver" "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
|
||||
Rarity Rare
|
||||
DropLevel >= 68
|
||||
SetFontSize 30
|
||||
SetTextColor 255 255 0
|
||||
SetBorderColor 255 255 0
|
||||
SetBackgroundColor 0 0 0
|
||||
|
||||
|
||||
|
||||
#######65-68 bases
|
||||
Show
|
||||
Class "Body Armour" "Gloves" "Boots" "Belt" "Helm" "Shield" "Quiver" "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
|
||||
Rarity Rare
|
||||
ItemLevel <= 73
|
||||
DropLevel > 65
|
||||
SetFontSize 30
|
||||
SetTextColor 255 255 0
|
||||
SetBorderColor 255 255 0
|
||||
SetBackgroundColor 0 100 0 200
|
||||
|
||||
Show
|
||||
Class "Body Armour" "Gloves" "Boots" "Belt" "Helm" "Shield" "Quiver" "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
|
||||
Rarity Rare
|
||||
DropLevel > 65
|
||||
SetFontSize 30
|
||||
SetTextColor 255 255 0
|
||||
SetBorderColor 255 255 0
|
||||
SetBackgroundColor 0 0 0
|
||||
|
||||
|
||||
########## 60-65 bases
|
||||
Show
|
||||
Class "Body Armour" "Gloves" "Boots" "Belt" "Helm" "Shield" "Quiver" "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
|
||||
Rarity Rare
|
||||
ItemLevel <= 68
|
||||
DropLevel > 60
|
||||
SetFontSize 30
|
||||
SetTextColor 255 255 0
|
||||
SetBorderColor 255 255 0
|
||||
SetBackgroundColor 0 100 0 200
|
||||
|
||||
Show
|
||||
Class "Body Armour" "Gloves" "Boots" "Belt" "Helm" "Shield" "Quiver" "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
|
||||
Rarity Rare
|
||||
ItemLevel <= 73
|
||||
DropLevel > 60
|
||||
SetFontSize 30
|
||||
SetTextColor 255 255 0
|
||||
SetBorderColor 255 255 0
|
||||
SetBackgroundColor 0 0 0
|
||||
|
||||
##### 55-60 bases
|
||||
|
||||
Show
|
||||
Class "Body Armour" "Gloves" "Boots" "Belt" "Helm" "Shield" "Quiver" "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
|
||||
Rarity Rare
|
||||
ItemLevel <= 64
|
||||
DropLevel > 55
|
||||
SetFontSize 30
|
||||
SetTextColor 255 255 0
|
||||
SetBorderColor 255 255 0
|
||||
SetBackgroundColor 0 100 0 200
|
||||
|
||||
Show
|
||||
Class "Body Armour" "Gloves" "Boots" "Belt" "Helm" "Shield" "Quiver" "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
|
||||
Rarity Rare
|
||||
ItemLevel <= 70
|
||||
DropLevel > 55
|
||||
SetFontSize 30
|
||||
SetTextColor 255 255 0
|
||||
SetBorderColor 255 255 0
|
||||
SetBackgroundColor 0 0 0
|
||||
|
||||
## 50-55 bases
|
||||
Show
|
||||
Class "Body Armour" "Gloves" "Boots" "Belt" "Helm" "Shield" "Quiver" "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
|
||||
Rarity Rare
|
||||
ItemLevel <= 58
|
||||
DropLevel > 50
|
||||
SetFontSize 30
|
||||
SetTextColor 255 255 0
|
||||
SetBorderColor 255 255 0
|
||||
SetBackgroundColor 0 100 0 200
|
||||
|
||||
Show
|
||||
Class "Body Armour" "Gloves" "Boots" "Belt" "Helm" "Shield" "Quiver" "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
|
||||
Rarity Rare
|
||||
ItemLevel <= 65
|
||||
DropLevel > 50
|
||||
SetFontSize 30
|
||||
SetTextColor 255 255 0
|
||||
SetBorderColor 255 255 0
|
||||
SetBackgroundColor 0 0 0
|
||||
|
||||
#####46-50 bases
|
||||
Show
|
||||
Class "Body Armour" "Gloves" "Boots" "Belt" "Helm" "Shield" "Quiver" "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
|
||||
Rarity Rare
|
||||
ItemLevel <= 54
|
||||
DropLevel > 46
|
||||
SetFontSize 30
|
||||
SetTextColor 255 255 0
|
||||
SetBorderColor 255 255 0
|
||||
SetBackgroundColor 0 100 0 200
|
||||
|
||||
Show
|
||||
Class "Body Armour" "Gloves" "Boots" "Belt" "Helm" "Shield" "Quiver" "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
|
||||
Rarity Rare
|
||||
ItemLevel <= 60
|
||||
DropLevel > 46
|
||||
SetFontSize 30
|
||||
SetTextColor 255 255 0
|
||||
SetBorderColor 255 255 0
|
||||
SetBackgroundColor 0 0 0
|
||||
|
||||
####42 - 48 bases
|
||||
|
||||
|
||||
Show
|
||||
Class "Body Armour" "Gloves" "Boots" "Belt" "Helm" "Shield" "Quiver" "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
|
||||
Rarity Rare
|
||||
ItemLevel <= 48
|
||||
DropLevel > 42
|
||||
SetFontSize 30
|
||||
SetTextColor 255 255 0
|
||||
SetBorderColor 255 255 0
|
||||
SetBackgroundColor 0 100 0 200
|
||||
|
||||
Show
|
||||
Class "Body Armour" "Gloves" "Boots" "Belt" "Helm" "Shield" "Quiver" "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
|
||||
Rarity Rare
|
||||
ItemLevel <= 51
|
||||
DropLevel > 42
|
||||
SetFontSize 30
|
||||
SetTextColor 255 255 0
|
||||
SetBorderColor 255 255 0
|
||||
SetBackgroundColor 0 0 0
|
||||
|
||||
###38-42
|
||||
|
||||
|
||||
Show
|
||||
Class "Body Armour" "Gloves" "Boots" "Belt" "Helm" "Shield" "Quiver" "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
|
||||
Rarity Rare
|
||||
ItemLevel <= 42
|
||||
DropLevel > 38
|
||||
SetFontSize 30
|
||||
SetTextColor 255 255 0
|
||||
SetBorderColor 255 255 0
|
||||
SetBackgroundColor 0 100 0 200
|
||||
|
||||
Show
|
||||
Class "Body Armour" "Gloves" "Boots" "Belt" "Helm" "Shield" "Quiver" "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
|
||||
Rarity Rare
|
||||
ItemLevel <= 48
|
||||
DropLevel > 38
|
||||
SetFontSize 30
|
||||
SetTextColor 255 255 0
|
||||
SetBorderColor 255 255 0
|
||||
SetBackgroundColor 0 0 0
|
||||
|
||||
####33-38
|
||||
Show
|
||||
Class "Body Armour" "Gloves" "Boots" "Belt" "Helm" "Shield" "Quiver" "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
|
||||
Rarity Rare
|
||||
ItemLevel <= 39
|
||||
DropLevel > 33
|
||||
SetFontSize 30
|
||||
SetTextColor 255 255 0
|
||||
SetBorderColor 255 255 0
|
||||
SetBackgroundColor 0 100 0 200
|
||||
|
||||
Show
|
||||
Class "Body Armour" "Gloves" "Boots" "Belt" "Helm" "Shield" "Quiver" "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
|
||||
Rarity Rare
|
||||
ItemLevel <= 42
|
||||
DropLevel > 33
|
||||
SetFontSize 30
|
||||
SetTextColor 255 255 0
|
||||
SetBorderColor 255 255 0
|
||||
SetBackgroundColor 0 0 0
|
||||
|
||||
#### 27 - 32
|
||||
Show
|
||||
Class "Body Armour" "Gloves" "Boots" "Belt" "Helm" "Shield" "Quiver" "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
|
||||
Rarity Rare
|
||||
ItemLevel <= 32
|
||||
DropLevel > 27
|
||||
SetFontSize 30
|
||||
SetTextColor 255 255 0
|
||||
SetBorderColor 255 255 0
|
||||
SetBackgroundColor 0 100 0 200
|
||||
|
||||
Show
|
||||
Class "Body Armour" "Gloves" "Boots" "Belt" "Helm" "Shield" "Quiver" "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
|
||||
Rarity Rare
|
||||
ItemLevel <= 38
|
||||
DropLevel > 27
|
||||
SetFontSize 30
|
||||
SetTextColor 255 255 0
|
||||
SetBorderColor 255 255 0
|
||||
SetBackgroundColor 0 0 0
|
||||
|
||||
##### 22- 27
|
||||
|
||||
Show
|
||||
Class "Body Armour" "Gloves" "Boots" "Belt" "Helm" "Shield" "Quiver" "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
|
||||
Rarity Rare
|
||||
ItemLevel <= 27
|
||||
DropLevel > 22
|
||||
SetFontSize 30
|
||||
SetTextColor 255 255 0
|
||||
SetBorderColor 255 255 0
|
||||
SetBackgroundColor 0 100 0 200
|
||||
|
||||
Show
|
||||
Class "Body Armour" "Gloves" "Boots" "Belt" "Helm" "Shield" "Quiver" "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
|
||||
Rarity Rare
|
||||
ItemLevel <= 31
|
||||
DropLevel > 22
|
||||
SetFontSize 30
|
||||
SetTextColor 255 255 0
|
||||
SetBorderColor 255 255 0
|
||||
SetBackgroundColor 0 0 0
|
||||
|
||||
########18-22
|
||||
|
||||
Show
|
||||
Class "Body Armour" "Gloves" "Boots" "Belt" "Helm" "Shield" "Quiver" "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
|
||||
Rarity Rare
|
||||
ItemLevel <= 22
|
||||
DropLevel > 18
|
||||
SetFontSize 30
|
||||
SetTextColor 255 255 0
|
||||
SetBorderColor 255 255 0
|
||||
SetBackgroundColor 0 100 0 200
|
||||
|
||||
Show
|
||||
Class "Body Armour" "Gloves" "Boots" "Belt" "Helm" "Shield" "Quiver" "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
|
||||
Rarity Rare
|
||||
ItemLevel <= 27
|
||||
DropLevel > 18
|
||||
SetFontSize 30
|
||||
SetTextColor 255 255 0
|
||||
SetBorderColor 255 255 0
|
||||
SetBackgroundColor 0 0 0
|
||||
|
||||
##12-18
|
||||
|
||||
Show
|
||||
Class "Body Armour" "Gloves" "Boots" "Belt" "Helm" "Shield" "Quiver" "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
|
||||
Rarity Rare
|
||||
ItemLevel <= 18
|
||||
DropLevel > 12
|
||||
SetFontSize 30
|
||||
SetTextColor 255 255 0
|
||||
SetBorderColor 255 255 0
|
||||
SetBackgroundColor 0 100 0 200
|
||||
|
||||
Show
|
||||
Class "Body Armour" "Gloves" "Boots" "Belt" "Helm" "Shield" "Quiver" "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
|
||||
Rarity Rare
|
||||
ItemLevel <= 24
|
||||
DropLevel > 12
|
||||
SetFontSize 30
|
||||
SetTextColor 255 255 0
|
||||
SetBorderColor 255 255 0
|
||||
SetBackgroundColor 0 0 0
|
||||
###### 8-12
|
||||
Show
|
||||
Class "Body Armour" "Gloves" "Boots" "Belt" "Helm" "Shield" "Quiver" "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
|
||||
Rarity Rare
|
||||
ItemLevel <= 12
|
||||
DropLevel > 8
|
||||
SetFontSize 30
|
||||
SetTextColor 255 255 0
|
||||
SetBorderColor 255 255 0
|
||||
SetBackgroundColor 0 100 0 200
|
||||
|
||||
Show
|
||||
Class "Body Armour" "Gloves" "Boots" "Belt" "Helm" "Shield" "Quiver" "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
|
||||
Rarity Rare
|
||||
ItemLevel <= 16
|
||||
DropLevel > 8
|
||||
SetFontSize 30
|
||||
SetTextColor 255 255 0
|
||||
SetBorderColor 255 255 0
|
||||
SetBackgroundColor 0 0 0
|
||||
#####1-8
|
||||
Show
|
||||
Class "Body Armour" "Gloves" "Boots" "Belt" "Helm" "Shield" "Quiver" "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
|
||||
Rarity Rare
|
||||
ItemLevel <= 8
|
||||
DropLevel >= 0
|
||||
SetFontSize 30
|
||||
SetTextColor 255 255 0
|
||||
SetBorderColor 255 255 0
|
||||
SetBackgroundColor 0 100 0 200
|
||||
|
||||
Show
|
||||
Class "Body Armour" "Gloves" "Boots" "Belt" "Helm" "Shield" "Quiver" "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
|
||||
Rarity Rare
|
||||
ItemLevel <= 12
|
||||
DropLevel >= 0
|
||||
SetFontSize 30
|
||||
SetTextColor 255 255 0
|
||||
SetBorderColor 255 255 0
|
||||
SetBackgroundColor 0 0 0
|
||||
|
||||
|
||||
###Rare highlighting
|
||||
|
||||
Show
|
||||
Rarity Rare
|
||||
SetFontSize 27
|
||||
SetTextColor 255 255 0 170
|
||||
SetBorderColor 255 255 0
|
||||
SetBackgroundColor 100 40 40 200
|
||||
|
||||
#### Flask Highlighting
|
||||
|
||||
Show
|
||||
Class Flask
|
||||
Quality > 13
|
||||
SetFontSize 25
|
||||
SetBorderColor 255 255 255
|
||||
|
||||
Show
|
||||
Class Flask
|
||||
Quality > 5
|
||||
SetFontSize 25
|
||||
|
||||
Show
|
||||
Class "Utility Flask"
|
||||
SetFontSize 30
|
||||
|
||||
###### RGB Highlighting
|
||||
|
||||
Show
|
||||
SocketGroup RGB BGR
|
||||
SetFontSize 30
|
||||
SetTextColor 0 255 0
|
||||
SetBorderColor 0 255 0
|
||||
|
||||
########Chisel Recipe Highlighting
|
||||
|
||||
Show
|
||||
BaseType "Gavel" "Rock Breaker" "Stone Hammer"
|
||||
Rarity Normal
|
||||
SetFontSize 25
|
||||
SetBorderColor 0 0 255
|
||||
Show
|
||||
BaseType "Gavel" "Rock Breaker" "Stone Hammer"
|
||||
Rarity Magic
|
||||
Quality > 15
|
||||
SetFontSize 25
|
||||
SetBorderColor 0 0 255
|
||||
|
||||
####### 6S/5L
|
||||
|
||||
Show
|
||||
LinkedSockets >= 5
|
||||
SetBorderColor 255 0 0
|
||||
SetFontSize 30
|
||||
Show
|
||||
Sockets 6
|
||||
SetBorderColor 255 0 0
|
||||
SetFontSize 30
|
||||
|
||||
Show
|
||||
LinkedSockets >= 3
|
||||
ItemLevel < 20
|
||||
|
||||
########################### Normal Show Rules
|
||||
Show
|
||||
BaseType "Sai" "Moon Staff" "Maraketh Bow" "Tiger Hook" "Morning Star" "Tornado Wand" "Prophecy Wand" "Imbued Wand" "Infernal Sword" "Void Axe" "Jewelled Foil" "Harpy Rapier" "Judgement Staff" "Void Sceptre" "Midnight Blade" "Eternal Sword" "Harbinger Bow" "Imperial Claw" "Ambusher" "Platinum Kris" "Terror Claw" "Imperial Skean" "Demon Dagger" "Infernal Axe"
|
||||
SetFontSize 30
|
||||
|
||||
### Show these whites up to 70
|
||||
Show
|
||||
BaseType "Terror Maul" "Vaal Rapier" "Imperial Staff" "Carnal Sceptre" "Imperial Bow" "Vaal Claw" "Thicket Bow" "Vaal Hatchet" "Royal Axe" "Nightmare Mace" "Vaal Blade" "Vaal Sceptre"
|
||||
Rarity Normal
|
||||
SetFontSize 30
|
||||
ItemLevel <= 70
|
||||
|
||||
###### T1 Bases up to forever
|
||||
Show
|
||||
Class "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
|
||||
DropLevel >= 68
|
||||
Rarity Normal
|
||||
SetFontSize 30
|
||||
|
||||
|
||||
### T2 Bases up to 70
|
||||
Show
|
||||
Class "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
|
||||
ItemLevel <= 70
|
||||
DropLevel > 64
|
||||
Rarity Normal
|
||||
SetFontSize 30
|
||||
|
||||
###### T3 Bases up to 65
|
||||
Show
|
||||
Class "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
|
||||
ItemLevel <= 65
|
||||
DropLevel > 59
|
||||
Rarity Normal
|
||||
SetFontSize 30
|
||||
|
||||
#### t4 Bases up to 60
|
||||
Show
|
||||
Class "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
|
||||
ItemLevel <= 60
|
||||
DropLevel > 53
|
||||
Rarity Normal
|
||||
SetFontSize 30
|
||||
|
||||
###### T5 up to 56
|
||||
|
||||
Show
|
||||
Class "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
|
||||
ItemLevel <= 56
|
||||
DropLevel > 49
|
||||
Rarity Normal
|
||||
SetFontSize 30
|
||||
|
||||
##### t6 up to 50
|
||||
|
||||
Show
|
||||
Class "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
|
||||
ItemLevel <= 50
|
||||
DropLevel > 44
|
||||
Rarity Normal
|
||||
SetFontSize 30
|
||||
|
||||
##### t7 up to 45
|
||||
Show
|
||||
Class "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
|
||||
ItemLevel <= 45
|
||||
DropLevel > 39
|
||||
Rarity Normal
|
||||
SetFontSize 30
|
||||
|
||||
##### t8 up to 39
|
||||
Show
|
||||
Class "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
|
||||
ItemLevel <= 39
|
||||
DropLevel > 33
|
||||
Rarity Normal
|
||||
SetFontSize 30
|
||||
|
||||
##### t9 up to 34
|
||||
|
||||
Show
|
||||
Class "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
|
||||
ItemLevel <= 34
|
||||
DropLevel > 28
|
||||
Rarity Normal
|
||||
SetFontSize 30
|
||||
|
||||
#### t10 up to 30
|
||||
Show
|
||||
Class "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
|
||||
ItemLevel <= 30
|
||||
DropLevel > 27
|
||||
Rarity Normal
|
||||
SetFontSize 30
|
||||
|
||||
#t11 up to 29
|
||||
|
||||
Show
|
||||
Class "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
|
||||
ItemLevel <= 29
|
||||
DropLevel > 21
|
||||
Rarity Normal
|
||||
SetFontSize 30
|
||||
|
||||
#t12 bases up to 27
|
||||
|
||||
Show
|
||||
Class "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
|
||||
ItemLevel <= 27
|
||||
DropLevel > 20
|
||||
Rarity Normal
|
||||
SetFontSize 30
|
||||
|
||||
#T13 Bases up to 21
|
||||
Show
|
||||
Class "Body Armour" "Gloves" "Boots" "Belt" "Helm" "Shield" "Quiver" "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
|
||||
ItemLevel <= 21
|
||||
DropLevel > 15
|
||||
Rarity Normal
|
||||
SetFontSize 29
|
||||
|
||||
#### t14 up to 17
|
||||
|
||||
Show
|
||||
Class "Body Armour" "Gloves" "Boots" "Belt" "Helm" "Shield" "Quiver" "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
|
||||
ItemLevel <= 17
|
||||
DropLevel > 10
|
||||
Rarity Normal
|
||||
SetFontSize 30
|
||||
|
||||
####t15 up to 15
|
||||
|
||||
Show
|
||||
Class "Body Armour" "Gloves" "Boots" "Belt" "Helm" "Shield" "Quiver" "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
|
||||
ItemLevel <= 14
|
||||
DropLevel > 7
|
||||
Rarity Normal
|
||||
SetFontSize 29
|
||||
|
||||
###t16 up to 10
|
||||
Show
|
||||
Class "Body Armour" "Gloves" "Boots" "Belt" "Helm" "Shield" "Quiver" "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
|
||||
ItemLevel <= 10
|
||||
DropLevel > 5
|
||||
Rarity Normal
|
||||
SetFontSize 29
|
||||
|
||||
####t17 up to 7
|
||||
|
||||
Show
|
||||
Class "Body Armour" "Gloves" "Boots" "Belt" "Helm" "Shield" "Quiver" "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
|
||||
ItemLevel <= 7
|
||||
DropLevel >= 1
|
||||
Rarity Normal
|
||||
SetFontSize 29
|
||||
|
||||
##################### WHITES RULES DONE
|
||||
|
||||
|
||||
#### Show rings at all levels for progression
|
||||
Show
|
||||
Class Ring Amulet
|
||||
ItemLevel < 70
|
||||
|
||||
Show
|
||||
Class Boots Gloves Helmet Shield Belt
|
||||
Rarity Magic
|
||||
SetFontSize 25
|
||||
ItemLevel < 20
|
||||
|
||||
#### Cant get map based level highlighting to work, DropLevel does not work for maps
|
||||
|
||||
Show
|
||||
Class "Map Fragments" "Maps"
|
||||
|
||||
|
||||
##### Flask based level visibility
|
||||
|
||||
### Small Flask to ~ End of A1N, REQ level 0
|
||||
Show
|
||||
BaseType "Small Life Flask" "Small Mana Flask"
|
||||
ItemLevel < 12
|
||||
SetFontSize 30
|
||||
SetBorderColor 255 255 255
|
||||
|
||||
|
||||
#### Medium Ends midway through a2, medium starts dropping around the same time as large, REQ LEVEL 4
|
||||
|
||||
Show
|
||||
BaseType "Medium Life Flask" "Medium Mana Flask"
|
||||
ItemLevel < 19
|
||||
SetFontSize 30
|
||||
SetBorderColor 255 255 255
|
||||
|
||||
#### Large Ends around the same time, these make mediums basically obsolete, i only keep mediums on because of 3x vendor recipe for another large REQ LEVEL 14
|
||||
|
||||
Show
|
||||
BaseType "Large Life Flask" "Large Mana Flask"
|
||||
ItemLevel < 20
|
||||
SetFontSize 30
|
||||
SetBorderColor 255 255 255
|
||||
|
||||
|
||||
#### Greater ends near the end of a2/beginning of a3 REQ LEVEL 18
|
||||
Show
|
||||
BaseType "Greater Life Flask" "Greater Mana Flask"
|
||||
ItemLevel < 24
|
||||
SetFontSize 30
|
||||
SetBorderColor 255 255 255
|
||||
|
||||
|
||||
#### Hides Midway through A3N REQ LEVEL 26
|
||||
Show
|
||||
BaseType "Grand Life Flask" "Grand Mana Flask"
|
||||
ItemLevel < 34
|
||||
SetFontSize 30
|
||||
SetBorderColor 255 255 255
|
||||
|
||||
####Hides Near the end of Normal difficulty REQ LEVEL 34
|
||||
|
||||
Show
|
||||
BaseType "Giant Life Flask" "Giant Mana Flask"
|
||||
ItemLevel < 38
|
||||
SetFontSize 30
|
||||
SetBorderColor 255 255 255
|
||||
|
||||
####Hides somewhere at the start of cruel REQ LEVEL 37
|
||||
Show
|
||||
BaseType "Colossal Life Flask" "Colossal Mana Flask"
|
||||
ItemLevel < 45
|
||||
SetFontSize 30
|
||||
SetBorderColor 255 255 255
|
||||
|
||||
####### Hides Midway through cruel REQ LEVEL 45
|
||||
|
||||
Show
|
||||
BaseType "Sacred Life Flask" "Sacred Mana Flask"
|
||||
ItemLevel < 49
|
||||
SetFontSize 30
|
||||
SetBorderColor 255 255 255
|
||||
|
||||
### REQ LEVEL 53
|
||||
|
||||
Show
|
||||
BaseType "Hallowed Life Flask" "Hallowed Mana Flask"
|
||||
ItemLevel < 58
|
||||
SetFontSize 30
|
||||
SetBorderColor 255 255 255
|
||||
|
||||
##### REQ LEVEL 60
|
||||
|
||||
Show
|
||||
BaseType "Sanctified Life Flask" "Sanctified Mana Flask"
|
||||
ItemLevel < 70
|
||||
SetFontSize 30
|
||||
SetBorderColor 255 255 255
|
||||
|
||||
### REQ LEVEL 65 and 70 Respectively 2 best bases in game, always show
|
||||
|
||||
Show
|
||||
BaseType "Divine Life Flask" "Eternal Life Flask" "Divine Mana Flask" "Eternal Mana Flask"
|
||||
SetFontSize 30
|
||||
SetBorderColor 255 255 255
|
||||
|
||||
Hide
|
||||
SetFontSize 20
|
||||
SetBackgroundColor 0 0 0 50
|
|
@ -0,0 +1,39 @@
|
|||
# Loot Filter Script created by Filtration v0.1 - www.github.com/XVar/filtration
|
||||
# Begin Script Description
|
||||
# This is a test script
|
||||
#
|
||||
# End Script Description
|
||||
|
||||
# First test condition booyah
|
||||
Show
|
||||
ItemLevel = 32
|
||||
DropLevel >= 85
|
||||
Quality >= 15
|
||||
Sockets < 4
|
||||
LinkedSockets >= 3
|
||||
SetFontSize 12
|
||||
|
||||
# Section: Gud stuff u shud pick up m9
|
||||
|
||||
# Second test condition
|
||||
Show
|
||||
ItemLevel > 50
|
||||
Quality >= 15
|
||||
Rarity > Magic
|
||||
Class "Test Class 1" "Test Class 2" "Test Class 3" "Test Class 4" "Test Class 5" "Test Class 6" "Test Class 7" "Test Class 8" "Test Class 9" "Test Class 10"
|
||||
BaseType "Test Base Type 1" "Test Base Type 2"
|
||||
Sockets <= 5
|
||||
LinkedSockets = 2
|
||||
SetFontSize 10
|
||||
|
||||
Show
|
||||
ItemLevel > 50
|
||||
Quality >= 15
|
||||
Rarity > Magic
|
||||
Class "Test Class 1" "Test Class 2" "Test Class 3" "Test Class 4" "Test Class 5" "Test Class 6" "Test Class 7" "Test Class 8" "Test Class 9" "Test Class 10"
|
||||
BaseType "Test Base Type 1" "Test Base Type 2"
|
||||
Sockets <= 5
|
||||
LinkedSockets = 2
|
||||
SetFontSize 10
|
||||
|
||||
Hide
|
|
@ -0,0 +1,83 @@
|
|||
using Filtration.Models;
|
||||
using Filtration.Services;
|
||||
using Filtration.Translators;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Filtration.Tests.Services
|
||||
{
|
||||
[TestFixture]
|
||||
public class TestLootFilterPersistenceService
|
||||
{
|
||||
[Test]
|
||||
public void LoadLootFilterScript_CallsTranslatorAndFileSystemService()
|
||||
{
|
||||
// Arrange
|
||||
const string TestInputPath = "C:\\Test Path\\Script.Filter";
|
||||
const string TestScriptString = "This is a test loot filter script";
|
||||
var testLootFilterScript = new LootFilterScript();
|
||||
|
||||
var mockFileSystemService = new Mock<IFileSystemService>();
|
||||
mockFileSystemService.Setup(s => s.ReadFileAsString(TestInputPath)).Returns(TestScriptString).Verifiable();
|
||||
|
||||
var mockLootFilterScriptTranslator = new Mock<ILootFilterScriptTranslator>();
|
||||
mockLootFilterScriptTranslator.Setup(t => t.TranslateStringToLootFilterScript(TestScriptString)).Returns(testLootFilterScript).Verifiable();
|
||||
|
||||
var service = new LootFilterPersistenceService(mockFileSystemService.Object, mockLootFilterScriptTranslator.Object);
|
||||
|
||||
// Act
|
||||
var script = service.LoadLootFilterScript(TestInputPath);
|
||||
|
||||
// Assert
|
||||
mockFileSystemService.Verify();
|
||||
mockLootFilterScriptTranslator.Verify();
|
||||
Assert.AreEqual(testLootFilterScript, script);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SaveLootFilterScript_CallsTranslatorAndFileSystemService()
|
||||
{
|
||||
// Arrange
|
||||
var testFilePath = "C:\\Test\\File.txt";
|
||||
var testScript = new LootFilterScript {FilePath = testFilePath};
|
||||
var testTranslatedScript = "Test translated script";
|
||||
|
||||
var mockFileSystemService = new Mock<IFileSystemService>();
|
||||
mockFileSystemService.Setup(s => s.WriteFileFromString(testFilePath, testTranslatedScript)).Verifiable();
|
||||
|
||||
var mockLootFilterScriptTranslator = new Mock<ILootFilterScriptTranslator>();
|
||||
mockLootFilterScriptTranslator.Setup(t => t.TranslateLootFilterScriptToString(testScript)).Returns(testTranslatedScript).Verifiable();
|
||||
|
||||
var service = new LootFilterPersistenceService(mockFileSystemService.Object, mockLootFilterScriptTranslator.Object);
|
||||
|
||||
// Act
|
||||
service.SaveLootFilterScript(testScript);
|
||||
|
||||
// Assert
|
||||
mockFileSystemService.Verify();
|
||||
mockLootFilterScriptTranslator.Verify();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void DefaultPathOfExileDirectoryExists_CallsFileSystemServiceWithCorrectString()
|
||||
{
|
||||
// Arrange
|
||||
const string TestUserProfilePath = "C:\\Users\\TestUser";
|
||||
|
||||
|
||||
var mockFileSystemService = new Mock<IFileSystemService>();
|
||||
mockFileSystemService.Setup(f => f.GetUserProfilePath()).Returns(TestUserProfilePath).Verifiable();
|
||||
mockFileSystemService.Setup(f => f.DirectoryExists(TestUserProfilePath + "\\Documents\\My Games\\Path of Exile")).Returns(true).Verifiable();
|
||||
|
||||
var mockLootFilterScriptTranslator = new Mock<ILootFilterScriptTranslator>();
|
||||
|
||||
var service = new LootFilterPersistenceService(mockFileSystemService.Object, mockLootFilterScriptTranslator.Object);
|
||||
|
||||
// Act
|
||||
var result = service.DefaultPathOfExileDirectory();
|
||||
|
||||
// Assert
|
||||
mockFileSystemService.Verify();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
using Filtration.Services;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Filtration.Tests.Services
|
||||
{
|
||||
[TestFixture]
|
||||
public class TestStaticDataService
|
||||
{
|
||||
[Test]
|
||||
public void Constructor_CallsFileSystemService()
|
||||
{
|
||||
// Arrange
|
||||
|
||||
var mockFileSystemService = new Mock<IFileSystemService>();
|
||||
mockFileSystemService.Setup(f => f.ReadFileAsString(It.IsAny<string>())).Verifiable();
|
||||
|
||||
var service = new StaticDataService(mockFileSystemService.Object);
|
||||
|
||||
// Act
|
||||
|
||||
// Assert
|
||||
mockFileSystemService.Verify();
|
||||
}
|
||||
|
||||
[Ignore("Integration Test")]
|
||||
[Test]
|
||||
public void Constructor_ReadsFromFileCorrectly()
|
||||
{
|
||||
// Arrange
|
||||
|
||||
var fileSystemService = new FileSystemService();
|
||||
|
||||
var service = new StaticDataService(fileSystemService);
|
||||
|
||||
// Act
|
||||
|
||||
// Assert
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,173 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Filtration.Enums;
|
||||
using Filtration.Models;
|
||||
using Filtration.Models.BlockItemBaseTypes;
|
||||
using Filtration.Models.BlockItemTypes;
|
||||
using Filtration.Translators;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Filtration.Tests.Translators
|
||||
{
|
||||
[TestFixture]
|
||||
public class TestLootFilterScriptTranslator
|
||||
{
|
||||
[Test]
|
||||
public void TranslateStringToLootFilterScript_ReturnsScriptWithCorrectNumberOfBlocks()
|
||||
{
|
||||
// Arrange
|
||||
var testInput = File.ReadAllText(@"Resources/testscript.txt");
|
||||
|
||||
var mockLootFilterBlockTranslator = new Mock<ILootFilterBlockTranslator>();
|
||||
mockLootFilterBlockTranslator.Setup(t => t.TranslateStringToLootFilterBlock(It.IsAny<string>())).Verifiable();
|
||||
|
||||
var translator = new LootFilterScriptTranslator(mockLootFilterBlockTranslator.Object);
|
||||
|
||||
// Act
|
||||
var script = translator.TranslateStringToLootFilterScript(testInput);
|
||||
|
||||
// Assert
|
||||
Assert.AreEqual(5, script.LootFilterBlocks.Count);
|
||||
mockLootFilterBlockTranslator.Verify();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TranslateStringToLootFilterScript_ReturnsScriptWithDescriptionCorrectlySet()
|
||||
{
|
||||
// Arrange
|
||||
var testInput = File.ReadAllText(@"Resources/testscript.txt");
|
||||
var expectedDescription = "Loot Filter Script created by Filtration v0.1 - www.github.com/XVar/filtration" + Environment.NewLine +
|
||||
"Begin Script Description" + Environment.NewLine +
|
||||
"This is a test script" + Environment.NewLine +
|
||||
Environment.NewLine +
|
||||
"End Script Description";
|
||||
|
||||
var mockLootFilterBlockTranslator = new Mock<ILootFilterBlockTranslator>();
|
||||
mockLootFilterBlockTranslator.Setup(t => t.TranslateStringToLootFilterBlock(It.IsAny<string>())).Verifiable();
|
||||
|
||||
var translator = new LootFilterScriptTranslator(mockLootFilterBlockTranslator.Object);
|
||||
|
||||
// Act
|
||||
var script = translator.TranslateStringToLootFilterScript(testInput);
|
||||
|
||||
// Assert
|
||||
Assert.AreEqual(expectedDescription, script.Description);
|
||||
}
|
||||
|
||||
[Ignore("Integration Test")]
|
||||
[Test]
|
||||
public void TranslateStringToLootFilterScript_ThioleLootFilterTest()
|
||||
{
|
||||
// Arrange
|
||||
var testInput = File.ReadAllText(@"Resources/ThioleLootFilter.txt");
|
||||
|
||||
|
||||
var BlockTranslator = new LootFilterBlockTranslator();
|
||||
var translator = new LootFilterScriptTranslator(BlockTranslator);
|
||||
|
||||
// Act
|
||||
var script = translator.TranslateStringToLootFilterScript(testInput);
|
||||
// Assert
|
||||
// Not crashing out when loading a huge script means this integration test has passed!
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TranslateLootFilterScriptToString_OneBlock_CallsTranslator()
|
||||
{
|
||||
// Arrange
|
||||
var testScript = new LootFilterScript();
|
||||
|
||||
var testBlock = new LootFilterBlock();
|
||||
testBlock.BlockItems.Add(new ItemLevelBlockItem(FilterPredicateOperator.Equal, 5));
|
||||
|
||||
var BlockOutput = "Test Script Output";
|
||||
var expectedOutput = "Test Script Output" + Environment.NewLine + Environment.NewLine;
|
||||
|
||||
testScript.LootFilterBlocks.Add(testBlock);
|
||||
|
||||
var mockLootFilterBlockTranslator = new Mock<ILootFilterBlockTranslator>();
|
||||
mockLootFilterBlockTranslator.Setup(t => t.TranslateLootFilterBlockToString(testBlock)).Returns(BlockOutput).Verifiable();
|
||||
|
||||
var translator = new LootFilterScriptTranslator(mockLootFilterBlockTranslator.Object);
|
||||
|
||||
// Act
|
||||
var result = translator.TranslateLootFilterScriptToString(testScript);
|
||||
|
||||
// Assert
|
||||
Assert.AreEqual(expectedOutput, result);
|
||||
mockLootFilterBlockTranslator.Verify();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TranslateLootFilterScriptToString_FullScript_ReturnsCorrectOutput()
|
||||
{
|
||||
var script = new LootFilterScript
|
||||
{
|
||||
Description = "Test script description" + Environment.NewLine +
|
||||
"This is a really great script!" + Environment.NewLine +
|
||||
"Multiple line script descriptions are fun!"
|
||||
};
|
||||
var block1 = new LootFilterBlock {Description = "Test Filter 1"};
|
||||
block1.BlockItems.Add(new ItemLevelBlockItem(FilterPredicateOperator.GreaterThan, 5));
|
||||
|
||||
var block2 = new LootFilterBlock();
|
||||
block2.BlockItems.Add(new QualityBlockItem(FilterPredicateOperator.LessThan, 15));
|
||||
block2.BlockItems.Add(new FontSizeBlockItem(7));
|
||||
block2.BlockItems.Add(new WidthBlockItem(FilterPredicateOperator.Equal, 3));
|
||||
|
||||
script.LootFilterBlocks.Add(block1);
|
||||
script.LootFilterBlocks.Add(block2);
|
||||
|
||||
var expectedOutput = "# Test script description" + Environment.NewLine +
|
||||
"# This is a really great script!" + Environment.NewLine +
|
||||
"# Multiple line script descriptions are fun!" + Environment.NewLine +
|
||||
Environment.NewLine +
|
||||
"# Test Filter 1" + Environment.NewLine +
|
||||
"Show" + Environment.NewLine +
|
||||
" ItemLevel > 5" + Environment.NewLine +
|
||||
Environment.NewLine +
|
||||
"Show" + Environment.NewLine +
|
||||
" Quality < 15" + Environment.NewLine +
|
||||
" Width = 3" + Environment.NewLine +
|
||||
" SetFontSize 7" + Environment.NewLine + Environment.NewLine;
|
||||
|
||||
var blockTranslator = new LootFilterBlockTranslator();
|
||||
var translator = new LootFilterScriptTranslator(blockTranslator);
|
||||
|
||||
// Act
|
||||
var result = translator.TranslateLootFilterScriptToString(script);
|
||||
|
||||
// Assert
|
||||
Assert.AreEqual(expectedOutput, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TranslateStringToLootFilterScript_SectionDirectlyBeforeBlockWithoutDescription_ReturnsCorrectObject()
|
||||
{
|
||||
// Arrange
|
||||
var testInputScript = "# My Script" + Environment.NewLine +
|
||||
Environment.NewLine +
|
||||
"# Section: Chance Bases" + Environment.NewLine +
|
||||
"Show" + Environment.NewLine +
|
||||
" BaseType \"Lapis Amulet\" \"Amber Amulet\"" + Environment.NewLine +
|
||||
" SetBorderColor 255 0 255" + Environment.NewLine +
|
||||
" SetFontSize 25";
|
||||
|
||||
var blockTranslator = new LootFilterBlockTranslator();
|
||||
var translator = new LootFilterScriptTranslator(blockTranslator);
|
||||
|
||||
// Act
|
||||
var result = translator.TranslateStringToLootFilterScript(testInputScript);
|
||||
|
||||
// Assert
|
||||
Assert.AreEqual(2, result.LootFilterBlocks.Count);
|
||||
var block = result.LootFilterBlocks.First(l => l.GetType() != typeof(LootFilterSection));
|
||||
Assert.AreEqual(4, block.BlockItems.Count);
|
||||
var baseTypeItem = block.BlockItems.OfType<BaseTypeBlockItem>().First();
|
||||
Assert.AreEqual(2, baseTypeItem.Items.Count);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Moq" version="4.2.1502.0911" targetFramework="net451" />
|
||||
<package id="NUnit" version="2.6.4" targetFramework="net451" />
|
||||
</packages>
|
|
@ -0,0 +1,31 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2013
|
||||
VisualStudioVersion = 12.0.31101.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Filtration", "Filtration\Filtration.csproj", "{55E0A34C-E039-43D7-A024-A4045401CDDA}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Filtration.Tests", "Filtration.Tests\Filtration.Tests.csproj", "{E0693972-72C5-4E05-A9C5-A5943E4015C6}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{55E0A34C-E039-43D7-A024-A4045401CDDA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{55E0A34C-E039-43D7-A024-A4045401CDDA}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{55E0A34C-E039-43D7-A024-A4045401CDDA}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{55E0A34C-E039-43D7-A024-A4045401CDDA}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{E0693972-72C5-4E05-A9C5-A5943E4015C6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{E0693972-72C5-4E05-A9C5-A5943E4015C6}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{E0693972-72C5-4E05-A9C5-A5943E4015C6}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{E0693972-72C5-4E05-A9C5-A5943E4015C6}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(Performance) = preSolution
|
||||
HasPerformanceSessions = true
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -0,0 +1,2 @@
|
|||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||
<s:Boolean x:Key="/Default/CodeInspection/CodeAnnotations/NamespacesWithAnnotations/=Filtration_002EAnnotations/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1" />
|
||||
</startup>
|
||||
</configuration>
|
|
@ -0,0 +1,19 @@
|
|||
<Application x:Class="Filtration.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
Startup="Application_Startup">
|
||||
<Application.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.Buttons.xaml" />
|
||||
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.TextBox.xaml" />
|
||||
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.Toolbar.xaml" />
|
||||
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
|
||||
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Colors.xaml" />
|
||||
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/Steel.xaml" />
|
||||
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml" />
|
||||
<ResourceDictionary Source="Views/CrossButton.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</Application.Resources>
|
||||
</Application>
|
|
@ -0,0 +1,37 @@
|
|||
using System.Linq;
|
||||
using System.Windows;
|
||||
using Castle.MicroKernel.ModelBuilder.Inspectors;
|
||||
using Castle.Windsor;
|
||||
using Castle.Windsor.Installer;
|
||||
using Filtration.Views;
|
||||
|
||||
namespace Filtration
|
||||
{
|
||||
public partial class App
|
||||
{
|
||||
private IWindsorContainer _container;
|
||||
|
||||
private void Application_Startup(object sender, StartupEventArgs e)
|
||||
{
|
||||
_container = new WindsorContainer();
|
||||
|
||||
var propInjector = _container.Kernel.ComponentModelBuilder
|
||||
.Contributors
|
||||
.OfType<PropertiesDependenciesModelInspector>()
|
||||
.Single();
|
||||
|
||||
_container.Kernel.ComponentModelBuilder.RemoveContributor(propInjector);
|
||||
|
||||
_container.Install(FromAssembly.This());
|
||||
|
||||
var mainWindow = _container.Resolve<IMainWindow>();
|
||||
mainWindow.Show();
|
||||
}
|
||||
|
||||
protected override void OnExit(ExitEventArgs e)
|
||||
{
|
||||
_container.Dispose();
|
||||
base.OnExit(e);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
using Filtration.Models;
|
||||
|
||||
namespace Filtration.Converters
|
||||
{
|
||||
internal class BlockItemTypeToStringConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
var test = (ILootFilterBlockItem)Activator.CreateInstance((Type) value);
|
||||
return test.DisplayHeading;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace Filtration.Converters
|
||||
{
|
||||
internal class BoolInverterConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter,
|
||||
CultureInfo culture)
|
||||
{
|
||||
if (value is bool)
|
||||
{
|
||||
return !(bool)value;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter,
|
||||
CultureInfo culture)
|
||||
{
|
||||
if (value is bool)
|
||||
{
|
||||
return !(bool)value;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
using Filtration.Enums;
|
||||
|
||||
namespace Filtration.Converters
|
||||
{
|
||||
internal class BooleanToBlockActionConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return (BlockAction)value == BlockAction.Show;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return (bool)value ? BlockAction.Show : BlockAction.Hide;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
using Filtration.Enums;
|
||||
|
||||
namespace Filtration.Converters
|
||||
{
|
||||
internal class BooleanToBlockActionInverseConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return (BlockAction)value == BlockAction.Hide;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return (bool)value ? BlockAction.Hide : BlockAction.Show;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace Filtration.Converters
|
||||
{
|
||||
internal class BooleanVisibilityConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return (bool)value ? Visibility.Visible : Visibility.Collapsed;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
using System;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace Filtration.Converters
|
||||
{
|
||||
public class ColorToSolidColorBrushConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
||||
{
|
||||
return value != null ? new SolidColorBrush((Color)value) : null;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
||||
{
|
||||
if (value != null)
|
||||
return ((SolidColorBrush)value).Color;
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
using Filtration.Enums;
|
||||
|
||||
namespace Filtration.Converters
|
||||
{
|
||||
public class IntToItemRarityConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return (ItemRarity) ((int) value);
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return (int) ((ItemRarity) value);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace Filtration.Converters
|
||||
{
|
||||
internal class StringToVisibilityConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (String.IsNullOrEmpty((string)value))
|
||||
{
|
||||
return Visibility.Collapsed;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Visibility.Visible;
|
||||
}
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
using System.ComponentModel;
|
||||
|
||||
namespace Filtration.Enums
|
||||
{
|
||||
internal enum BlockAction
|
||||
{
|
||||
[Description("Show")]
|
||||
Show,
|
||||
[Description("Hide")]
|
||||
Hide
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
namespace Filtration.Enums
|
||||
{
|
||||
internal enum BlockItemType
|
||||
{
|
||||
ItemLevel,
|
||||
DropLevel,
|
||||
Quality,
|
||||
Rarity,
|
||||
Class,
|
||||
BaseType,
|
||||
Sockets,
|
||||
LinkedSockets,
|
||||
SocketGroup,
|
||||
Width,
|
||||
Height,
|
||||
TextColor,
|
||||
BackgroundColor,
|
||||
BorderColor,
|
||||
Sound,
|
||||
FontSize
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
using System.ComponentModel;
|
||||
|
||||
namespace Filtration.Enums
|
||||
{
|
||||
internal enum FilterPredicateOperator
|
||||
{
|
||||
[Description("=")]
|
||||
Equal,
|
||||
[Description("!=")]
|
||||
NotEqual,
|
||||
[Description("<")]
|
||||
LessThan,
|
||||
[Description("<=")]
|
||||
LessThanOrEqual,
|
||||
[Description(">")]
|
||||
GreaterThan,
|
||||
[Description(">=")]
|
||||
GreaterThanOrEqual
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
using System.ComponentModel;
|
||||
|
||||
namespace Filtration.Enums
|
||||
{
|
||||
internal enum FilterType
|
||||
{
|
||||
[Description("Show")]
|
||||
Show,
|
||||
[Description("Hide")]
|
||||
Hide
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
using System.ComponentModel;
|
||||
|
||||
namespace Filtration.Enums
|
||||
{
|
||||
internal enum ItemRarity
|
||||
{
|
||||
[Description("Normal")]
|
||||
Normal,
|
||||
[Description("Magic")]
|
||||
Magic,
|
||||
[Description("Rare")]
|
||||
Rare,
|
||||
[Description("Unique")]
|
||||
Unique
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
using System.ComponentModel;
|
||||
|
||||
namespace Filtration.Enums
|
||||
{
|
||||
internal enum SocketColor
|
||||
{
|
||||
[Description("R")]
|
||||
Red,
|
||||
[Description("G")]
|
||||
Green,
|
||||
[Description("B")]
|
||||
Blue,
|
||||
[Description("W")]
|
||||
White
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
using System;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace Filtration.Extensions
|
||||
{
|
||||
internal static class EnumHelper
|
||||
{
|
||||
public static T GetAttributeOfType<T>(this Enum enumVal) where T : Attribute
|
||||
{
|
||||
var type = enumVal.GetType();
|
||||
var memInfo = type.GetMember(enumVal.ToString());
|
||||
var attributes = memInfo[0].GetCustomAttributes(typeof(T), false);
|
||||
return (attributes.Length > 0) ? (T)attributes[0] : null;
|
||||
}
|
||||
|
||||
public static string GetAttributeDescription(this Enum enumValue)
|
||||
{
|
||||
var attribute = enumValue.GetAttributeOfType<DescriptionAttribute>();
|
||||
|
||||
return attribute == null ? String.Empty : attribute.Description;
|
||||
}
|
||||
|
||||
public static T GetEnumValueFromDescription<T>(string description)
|
||||
{
|
||||
var fis = typeof(T).GetFields();
|
||||
|
||||
foreach (var fi in fis)
|
||||
{
|
||||
DescriptionAttribute[] attributes = (DescriptionAttribute[])fi.GetCustomAttributes(typeof(DescriptionAttribute), false);
|
||||
|
||||
if (attributes.Length > 0 && attributes[0].Description == description)
|
||||
return (T)Enum.Parse(typeof(T), fi.Name);
|
||||
}
|
||||
|
||||
throw new Exception("Not found");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Windows.Markup;
|
||||
|
||||
namespace Filtration.Extensions
|
||||
{
|
||||
internal class EnumerationExtension : MarkupExtension
|
||||
{
|
||||
private Type _enumType;
|
||||
|
||||
|
||||
public EnumerationExtension(Type enumType)
|
||||
{
|
||||
if (enumType == null) throw new ArgumentNullException("enumType");
|
||||
|
||||
EnumType = enumType;
|
||||
}
|
||||
|
||||
public Type EnumType
|
||||
{
|
||||
get
|
||||
{
|
||||
return _enumType;
|
||||
}
|
||||
private set
|
||||
{
|
||||
if (_enumType == value) return;
|
||||
|
||||
var enumType = Nullable.GetUnderlyingType(value) ?? value;
|
||||
|
||||
if (enumType.IsEnum == false) throw new ArgumentException("Type must be an Enum.");
|
||||
|
||||
_enumType = value;
|
||||
}
|
||||
}
|
||||
|
||||
public override object ProvideValue(IServiceProvider serviceProvider)
|
||||
{
|
||||
var enumValues = Enum.GetValues(EnumType);
|
||||
|
||||
return (from object enumValue in enumValues
|
||||
select new EnumerationMember { Value = enumValue, Description = GetDescription(enumValue) }).ToArray
|
||||
();
|
||||
}
|
||||
|
||||
private string GetDescription(object enumValue)
|
||||
{
|
||||
var descriptionAttribute =
|
||||
EnumType.GetField(enumValue.ToString())
|
||||
.GetCustomAttributes(typeof(DescriptionAttribute), false)
|
||||
.FirstOrDefault() as DescriptionAttribute;
|
||||
|
||||
|
||||
return descriptionAttribute != null ? descriptionAttribute.Description : enumValue.ToString();
|
||||
}
|
||||
|
||||
public class EnumerationMember
|
||||
{
|
||||
public string Description { get; set; }
|
||||
|
||||
public object Value { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,321 @@
|
|||
<?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>{55E0A34C-E039-43D7-A024-A4045401CDDA}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Filtration</RootNamespace>
|
||||
<AssemblyName>Filtration</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<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' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<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="DragAndDropLib">
|
||||
<HintPath>..\..\DragAndDrop(Complete)\DragAndDropLib\bin\Debug\DragAndDropLib.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="FontAwesome.WPF, Version=4.3.0.26714, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\FontAwesome.WPF.4.3.0.2\lib\FontAwesome.WPF.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="GalaSoft.MvvmLight, Version=5.1.1.35049, Culture=neutral, PublicKeyToken=e7570ab207bcb616, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\MvvmLightLibs.5.1.1.0\lib\net45\GalaSoft.MvvmLight.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="GalaSoft.MvvmLight.Platform, Version=5.1.1.35053, Culture=neutral, PublicKeyToken=5f873c45e98af8a1, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\MvvmLightLibs.5.1.1.0\lib\net45\GalaSoft.MvvmLight.Platform.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MahApps.Metro">
|
||||
<HintPath>..\packages\MahApps.Metro.1.1.2.0\lib\net45\MahApps.Metro.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Controls.Input.Toolkit">
|
||||
<HintPath>..\packages\WPFToolkit.3.5.50211.1\lib\System.Windows.Controls.Input.Toolkit.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Windows.Controls.Layout.Toolkit">
|
||||
<HintPath>..\packages\WPFToolkit.3.5.50211.1\lib\System.Windows.Controls.Layout.Toolkit.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xaml">
|
||||
<RequiredTargetFramework>4.0</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="WindowsBase" />
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
<Reference Include="WPFToolkit">
|
||||
<HintPath>..\packages\WPFToolkit.3.5.50211.1\lib\WPFToolkit.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xceed.Wpf.Toolkit, Version=2.4.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\Extended.Wpf.Toolkit.2.4\lib\net40\Xceed.Wpf.Toolkit.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ApplicationDefinition Include="App.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
<Compile Include="Converters\BlockItemTypeToStringConverter.cs" />
|
||||
<Compile Include="Converters\BooleanInverterConverter.cs" />
|
||||
<Compile Include="Converters\BooleanToBlockActionInverseConverter.cs" />
|
||||
<Compile Include="Converters\BooleanToBlockActionConverter.cs" />
|
||||
<Compile Include="Converters\ColorToSolidColorBrushConverter.cs" />
|
||||
<Compile Include="Converters\ItemRarityConverter.cs" />
|
||||
<Compile Include="Converters\BooleanVisibilityConverter.cs" />
|
||||
<Compile Include="Converters\StringToVisibilityConverter.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="Extensions\EnumerationExtension.cs" />
|
||||
<Compile Include="Extensions\EnumHelper.cs" />
|
||||
<Compile Include="Models\BlockItemBaseTypes\ActionBlockItem.cs" />
|
||||
<Compile Include="Models\BlockItemBaseTypes\ColorBlockItem.cs" />
|
||||
<Compile Include="Models\BlockItemBaseTypes\DualIntegerBlockItem.cs" />
|
||||
<Compile Include="Models\BlockItemBaseTypes\IntegerBlockItem.cs" />
|
||||
<Compile Include="Models\BlockItemBaseTypes\NumericFilterPredicateBlockItem.cs" />
|
||||
<Compile Include="Models\BlockItemBaseTypes\StringListBlockItem.cs" />
|
||||
<Compile Include="Models\BlockItemTypes\FontSizeBlockItem.cs" />
|
||||
<Compile Include="Models\BlockItemTypes\SoundBlockItem.cs" />
|
||||
<Compile Include="Models\BlockItemTypes\BorderColorBlockItem.cs" />
|
||||
<Compile Include="Models\BlockItemTypes\BaseTypeBlockItem.cs" />
|
||||
<Compile Include="Models\BlockItemTypes\BackgroundColorBlockItem.cs" />
|
||||
<Compile Include="Models\BlockItemTypes\TextColorBlockItem.cs" />
|
||||
<Compile Include="Models\BlockItemTypes\ClassBlockItem.cs" />
|
||||
<Compile Include="Models\BlockItemTypes\HeightBlockItem.cs" />
|
||||
<Compile Include="Models\BlockItemTypes\WidthBlockItem.cs" />
|
||||
<Compile Include="Models\BlockItemTypes\SocketGroupBlockItem.cs" />
|
||||
<Compile Include="Models\BlockItemTypes\LinkedSocketsBlockItem.cs" />
|
||||
<Compile Include="Models\BlockItemTypes\SocketsBlockItem.cs" />
|
||||
<Compile Include="Models\BlockItemTypes\DropLevelBlockItem.cs" />
|
||||
<Compile Include="Models\BlockItemTypes\RarityBlockItem.cs" />
|
||||
<Compile Include="Models\BlockItemTypes\QualityBlockItem.cs" />
|
||||
<Compile Include="Models\BlockItemTypes\ItemLevelBlockItem.cs" />
|
||||
<Compile Include="Models\IAudioVisualBlockItem.cs" />
|
||||
<Compile Include="Models\LootFilterBlock.cs" />
|
||||
<Compile Include="Models\ILootFilterBlockItem.cs" />
|
||||
<Compile Include="Models\LootFilterScript.cs" />
|
||||
<Compile Include="Models\LootFilterSection.cs" />
|
||||
<Compile Include="Models\NumericFilterPredicate.cs" />
|
||||
<Compile Include="Models\BlockItemBaseTypes\SocketGroupBlockItemBase.cs" />
|
||||
<Compile Include="Properties\Annotations.cs" />
|
||||
<Compile Include="Services\FileSystemService.cs" />
|
||||
<Compile Include="Services\LootFilterPersistenceService.cs" />
|
||||
<Compile Include="Services\StaticDataService.cs" />
|
||||
<Compile Include="Translators\LootFilterBlockTranslator.cs" />
|
||||
<Compile Include="Translators\LootFilterScriptTranslator.cs" />
|
||||
<Compile Include="UserControls\AutoScrollingListBox.cs" />
|
||||
<Compile Include="UserControls\CrossButton.cs" />
|
||||
<Compile Include="UserControls\EditableListBoxControl.xaml.cs">
|
||||
<DependentUpon>EditableListBoxControl.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Utilities\LineReader.cs" />
|
||||
<Compile Include="ViewModels\FiltrationViewModelBase.cs" />
|
||||
<Compile Include="ViewModels\ILootFilterScriptViewModelFactory.cs" />
|
||||
<Compile Include="ViewModels\ILootFilterBlockViewModelFactory.cs" />
|
||||
<Compile Include="ViewModels\ILootFilterScriptViewModel.cs" />
|
||||
<Compile Include="ViewModels\ILootFilterBlockViewModel.cs" />
|
||||
<Compile Include="ViewModels\LootFilterBlockViewModel.cs" />
|
||||
<Compile Include="ViewModels\LootFilterScriptViewModel.cs" />
|
||||
<Compile Include="Views\BlockTemplateSelector.cs" />
|
||||
<Compile Include="Views\LootFilterBlockDisplaySettingsView.xaml.cs">
|
||||
<DependentUpon>LootFilterBlockDisplaySettingsView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Views\LootFilterScriptView.xaml.cs">
|
||||
<DependentUpon>LootFilterScriptView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Views\LootFilterBlockView.xaml.cs">
|
||||
<DependentUpon>LootFilterBlockView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="UserControls\NumericFilterPredicateControl.xaml.cs">
|
||||
<DependentUpon>NumericFilterPredicateControl.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Views\LootFilterSectionView.xaml.cs">
|
||||
<DependentUpon>LootFilterSectionView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="WindsorInstallers\ModelsInstaller.cs" />
|
||||
<Compile Include="WindsorInstallers\ServicesInstaller.cs" />
|
||||
<Compile Include="WindsorInstallers\TranslatorsInstaller.cs" />
|
||||
<Compile Include="WindsorInstallers\ViewModelsInstaller.cs" />
|
||||
<Compile Include="WindsorInstallers\ViewsInstaller.cs" />
|
||||
<Page Include="Views\CrossButton.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="UserControls\EditableListBoxControl.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Views\ExpanderStyle.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Views\LootFilterBlockDisplaySettingsView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Views\LootFilterBlockViewDictionary.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Views\LootFilterScriptView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Views\LootFilterBlockView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Views\LootFilterSectionView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Views\MainWindow.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Compile Include="App.xaml.cs">
|
||||
<DependentUpon>App.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="ViewModels\IMainWindowViewModel.cs" />
|
||||
<Compile Include="ViewModels\MainWindowViewModel.cs" />
|
||||
<Compile Include="Views\IMainWindow.cs" />
|
||||
<Compile Include="Views\MainWindow.xaml.cs">
|
||||
<DependentUpon>MainWindow.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Page Include="UserControls\NumericFilterPredicateControl.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Properties\AssemblyInfo.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
<None Include="packages.config" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<AppDesigner Include="Properties\" />
|
||||
<Resource Include="Resources\Fontin-SmallCaps.ttf" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\groundtile.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Resources\AlertSound8.wav">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Resources\ItemBaseTypes.txt">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Resources\ItemClasses.txt">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Resources\AlertSound9.wav">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Resources\AlertSound7.wav">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Resources\AlertSound6.wav">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Resources\AlertSound4.wav">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Resources\AlertSound5.wav">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Resources\AlertSound2.wav">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Resources\AlertSound3.wav">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Resources\AlertSound1.wav">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(XamlSpyInstallPath)MSBuild\FirstFloor.XamlSpy.WPF.targets" Condition="'$(XamlSpyInstallPath)' != '' and '$(Configuration)' == 'DEBUG'" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
|
@ -0,0 +1,84 @@
|
|||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Windows.Media;
|
||||
using Filtration.Annotations;
|
||||
using Filtration.Enums;
|
||||
|
||||
namespace Filtration.Models.BlockItemBaseTypes
|
||||
{
|
||||
internal class ActionBlockItem : ILootFilterBlockItem
|
||||
{
|
||||
private BlockAction _action;
|
||||
|
||||
public ActionBlockItem(BlockAction action)
|
||||
{
|
||||
Action = action;
|
||||
}
|
||||
|
||||
public BlockAction Action
|
||||
{
|
||||
get { return _action; }
|
||||
set
|
||||
{
|
||||
_action = value;
|
||||
OnPropertyChanged();
|
||||
OnPropertyChanged("SummaryText");
|
||||
OnPropertyChanged("SummaryBackgroundColor");
|
||||
OnPropertyChanged("SummaryTextColor");
|
||||
}
|
||||
}
|
||||
|
||||
public string PrefixText
|
||||
{
|
||||
get { return string.Empty; }
|
||||
}
|
||||
|
||||
public int MaximumAllowed
|
||||
{
|
||||
get { return 1; }
|
||||
}
|
||||
|
||||
public string DisplayHeading
|
||||
{
|
||||
get
|
||||
{
|
||||
return "Action";
|
||||
}
|
||||
}
|
||||
|
||||
public string SummaryText
|
||||
{
|
||||
get
|
||||
{
|
||||
return Action == BlockAction.Show ? "Show" : "Hide";
|
||||
}
|
||||
}
|
||||
|
||||
public Color SummaryBackgroundColor
|
||||
{
|
||||
get
|
||||
{
|
||||
return Action == BlockAction.Show ? Colors.LimeGreen : Colors.OrangeRed;
|
||||
}
|
||||
}
|
||||
|
||||
public Color SummaryTextColor
|
||||
{
|
||||
get
|
||||
{
|
||||
return Action == BlockAction.Show ? Colors.Black : Colors.White;
|
||||
}
|
||||
}
|
||||
|
||||
public int SortOrder { get { return 0; } }
|
||||
|
||||
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,53 @@
|
|||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Windows.Media;
|
||||
using Filtration.Annotations;
|
||||
|
||||
namespace Filtration.Models.BlockItemBaseTypes
|
||||
{
|
||||
internal abstract class ColorBlockItem : ILootFilterBlockItem, IAudioVisualBlockItem
|
||||
{
|
||||
private Color _color;
|
||||
|
||||
protected ColorBlockItem()
|
||||
{
|
||||
}
|
||||
|
||||
protected ColorBlockItem(Color color)
|
||||
{
|
||||
Color = color;
|
||||
}
|
||||
|
||||
public abstract string PrefixText { get; }
|
||||
public abstract int MaximumAllowed { get; }
|
||||
|
||||
public abstract string DisplayHeading { get; }
|
||||
|
||||
public string SummaryText
|
||||
{
|
||||
get { return string.Empty; }
|
||||
}
|
||||
|
||||
public Color SummaryBackgroundColor { get { return Colors.Transparent; } }
|
||||
public Color SummaryTextColor { get { return Colors.Transparent; } }
|
||||
public abstract int SortOrder { get; }
|
||||
|
||||
public Color Color
|
||||
{
|
||||
get { return _color; }
|
||||
set
|
||||
{
|
||||
_color = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
[NotifyPropertyChangedInvocator]
|
||||
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
var handler = PropertyChanged;
|
||||
if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Windows.Media;
|
||||
using Filtration.Annotations;
|
||||
|
||||
namespace Filtration.Models.BlockItemBaseTypes
|
||||
{
|
||||
internal abstract class DualIntegerBlockItem : ILootFilterBlockItem, IAudioVisualBlockItem
|
||||
{
|
||||
private int _value;
|
||||
private int _secondValue;
|
||||
|
||||
protected DualIntegerBlockItem()
|
||||
{
|
||||
}
|
||||
|
||||
protected DualIntegerBlockItem(int value, int secondValue)
|
||||
{
|
||||
Value = value;
|
||||
SecondValue = secondValue;
|
||||
}
|
||||
|
||||
public abstract string PrefixText { get; }
|
||||
public abstract int MaximumAllowed { get; }
|
||||
public abstract string DisplayHeading { get; }
|
||||
|
||||
public string SummaryText { get { return string.Empty; } }
|
||||
public Color SummaryBackgroundColor { get { return Colors.Transparent; } }
|
||||
public Color SummaryTextColor { get { return Colors.Transparent; } }
|
||||
public abstract int SortOrder { get; }
|
||||
|
||||
public int Value
|
||||
{
|
||||
get { return _value; }
|
||||
set
|
||||
{
|
||||
_value = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public int SecondValue
|
||||
{
|
||||
get { return _secondValue; }
|
||||
set
|
||||
{
|
||||
_secondValue = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
[NotifyPropertyChangedInvocator]
|
||||
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
var handler = PropertyChanged;
|
||||
if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Windows.Media;
|
||||
using Filtration.Annotations;
|
||||
|
||||
namespace Filtration.Models.BlockItemBaseTypes
|
||||
{
|
||||
internal abstract class IntegerBlockItem : ILootFilterBlockItem, IAudioVisualBlockItem
|
||||
{
|
||||
private int _value;
|
||||
|
||||
protected IntegerBlockItem()
|
||||
{
|
||||
}
|
||||
|
||||
protected IntegerBlockItem(int value)
|
||||
{
|
||||
Value = value;
|
||||
}
|
||||
|
||||
public abstract string PrefixText { get; }
|
||||
public abstract int MaximumAllowed { get; }
|
||||
|
||||
public abstract string DisplayHeading { get; }
|
||||
|
||||
public string SummaryText { get { return string.Empty; } }
|
||||
public Color SummaryBackgroundColor { get { return Colors.Transparent; } }
|
||||
public Color SummaryTextColor { get { return Colors.Transparent; } }
|
||||
public abstract int SortOrder { get; }
|
||||
|
||||
public abstract int Minimum { get; }
|
||||
public abstract int Maximum { get; }
|
||||
|
||||
public int Value
|
||||
{
|
||||
get { return _value; }
|
||||
set
|
||||
{
|
||||
_value = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
[NotifyPropertyChangedInvocator]
|
||||
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
var handler = PropertyChanged;
|
||||
if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Windows.Media;
|
||||
using Filtration.Annotations;
|
||||
using Filtration.Enums;
|
||||
|
||||
namespace Filtration.Models.BlockItemBaseTypes
|
||||
{
|
||||
internal abstract class NumericFilterPredicateBlockItem : ILootFilterBlockItem
|
||||
{
|
||||
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 abstract string PrefixText { get; }
|
||||
public abstract int MaximumAllowed { get; }
|
||||
public abstract string DisplayHeading { get; }
|
||||
public abstract string SummaryText { get; }
|
||||
public abstract Color SummaryBackgroundColor { get; }
|
||||
public abstract Color SummaryTextColor { get; }
|
||||
public abstract int SortOrder { get; }
|
||||
|
||||
public abstract int Minimum { get; }
|
||||
public abstract int 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 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,44 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Collections.Specialized;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Windows.Media;
|
||||
using Filtration.Annotations;
|
||||
using Filtration.Enums;
|
||||
|
||||
namespace Filtration.Models.BlockItemBaseTypes
|
||||
{
|
||||
internal abstract class SocketGroupBlockItemBase : ILootFilterBlockItem
|
||||
{
|
||||
protected SocketGroupBlockItemBase()
|
||||
{
|
||||
SocketColorGroups = new ObservableCollection<List<SocketColor>>();
|
||||
SocketColorGroups.CollectionChanged += OnSocketColorGroupsCollectionChanged;
|
||||
}
|
||||
|
||||
public abstract string PrefixText { get; }
|
||||
public abstract int MaximumAllowed { get; }
|
||||
public abstract string DisplayHeading { get; }
|
||||
|
||||
public abstract string SummaryText { get; }
|
||||
public abstract Color SummaryBackgroundColor { get; }
|
||||
public abstract Color SummaryTextColor { get; }
|
||||
public abstract int SortOrder { get; }
|
||||
public ObservableCollection<List<SocketColor>> SocketColorGroups { get; private set; }
|
||||
|
||||
private void OnSocketColorGroupsCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
|
||||
{
|
||||
OnPropertyChanged("SocketColorGroups");
|
||||
}
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
[NotifyPropertyChangedInvocator]
|
||||
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
var handler = PropertyChanged;
|
||||
if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
using System.Collections.ObjectModel;
|
||||
using System.Collections.Specialized;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Windows.Media;
|
||||
using Filtration.Annotations;
|
||||
|
||||
namespace Filtration.Models.BlockItemBaseTypes
|
||||
{
|
||||
internal abstract class StringListBlockItem : ILootFilterBlockItem
|
||||
{
|
||||
protected StringListBlockItem()
|
||||
{
|
||||
Items = new ObservableCollection<string>();
|
||||
Items.CollectionChanged += OnItemsCollectionChanged;
|
||||
}
|
||||
|
||||
public abstract string PrefixText { get; }
|
||||
public abstract int MaximumAllowed { get; }
|
||||
public abstract string DisplayHeading { get; }
|
||||
|
||||
public abstract string SummaryText { get; }
|
||||
public abstract Color SummaryBackgroundColor { get; }
|
||||
public abstract Color SummaryTextColor { get; }
|
||||
public abstract int SortOrder { get; }
|
||||
public ObservableCollection<string> Items { get; protected set; }
|
||||
|
||||
private void OnItemsCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
|
||||
{
|
||||
OnPropertyChanged("Items");
|
||||
OnPropertyChanged("SummaryText");
|
||||
}
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
[NotifyPropertyChangedInvocator]
|
||||
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
var handler = PropertyChanged;
|
||||
if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
using System.Windows.Media;
|
||||
using Filtration.Models.BlockItemBaseTypes;
|
||||
|
||||
namespace Filtration.Models.BlockItemTypes
|
||||
{
|
||||
internal class BackgroundColorBlockItem : ColorBlockItem
|
||||
{
|
||||
public BackgroundColorBlockItem()
|
||||
{
|
||||
}
|
||||
|
||||
public BackgroundColorBlockItem(Color color) : base(color)
|
||||
{
|
||||
}
|
||||
|
||||
public override string PrefixText
|
||||
{
|
||||
get { return "SetBackgroundColor"; }
|
||||
}
|
||||
|
||||
public override int MaximumAllowed
|
||||
{
|
||||
get { return 1; }
|
||||
}
|
||||
|
||||
public override string DisplayHeading
|
||||
{
|
||||
get
|
||||
{
|
||||
return "Background Color";
|
||||
}
|
||||
}
|
||||
|
||||
public override int SortOrder
|
||||
{
|
||||
get { return 13; }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
using System.Linq;
|
||||
using System.Windows.Media;
|
||||
using Filtration.Models.BlockItemBaseTypes;
|
||||
|
||||
namespace Filtration.Models.BlockItemTypes
|
||||
{
|
||||
internal class BaseTypeBlockItem : StringListBlockItem
|
||||
{
|
||||
public override string PrefixText { get { return "BaseType"; } }
|
||||
|
||||
public override int MaximumAllowed
|
||||
{
|
||||
get { return 1; }
|
||||
}
|
||||
|
||||
public override string DisplayHeading
|
||||
{
|
||||
get
|
||||
{
|
||||
return "Base Type";
|
||||
}
|
||||
}
|
||||
|
||||
public override string SummaryText
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Items.Count > 0 && Items.Count < 4)
|
||||
{
|
||||
return "Item Base Types: " +
|
||||
Items.Aggregate(string.Empty, (current, i) => current + i + ", ").TrimEnd(' ').TrimEnd(',');
|
||||
}
|
||||
if (Items.Count >= 4)
|
||||
{
|
||||
var remaining = Items.Count - 3;
|
||||
return "Item Base Types: " + Items.Take(3)
|
||||
.Aggregate(string.Empty, (current, i) => current + i + ", ")
|
||||
.TrimEnd(' ')
|
||||
.TrimEnd(',') + " (+" + remaining + " more)";
|
||||
}
|
||||
return "Item Base Types: (none)";
|
||||
}
|
||||
}
|
||||
|
||||
public override Color SummaryBackgroundColor
|
||||
{
|
||||
get { return Colors.MediumTurquoise; }
|
||||
}
|
||||
|
||||
public override Color SummaryTextColor
|
||||
{
|
||||
get { return Colors.Black; }
|
||||
}
|
||||
|
||||
public override int SortOrder
|
||||
{
|
||||
get { return 11; }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
using System.Windows.Media;
|
||||
using Filtration.Models.BlockItemBaseTypes;
|
||||
|
||||
namespace Filtration.Models.BlockItemTypes
|
||||
{
|
||||
internal class BorderColorBlockItem : ColorBlockItem
|
||||
{
|
||||
public BorderColorBlockItem()
|
||||
{
|
||||
}
|
||||
|
||||
public BorderColorBlockItem(Color color) : base(color)
|
||||
{
|
||||
}
|
||||
|
||||
public override string PrefixText
|
||||
{
|
||||
get { return "SetBorderColor"; }
|
||||
}
|
||||
|
||||
public override int MaximumAllowed
|
||||
{
|
||||
get { return 1; }
|
||||
}
|
||||
|
||||
public override string DisplayHeading
|
||||
{
|
||||
get
|
||||
{
|
||||
return "Border Color";
|
||||
}
|
||||
}
|
||||
|
||||
public override int SortOrder
|
||||
{
|
||||
get { return 14; }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
using System.Linq;
|
||||
using System.Windows.Media;
|
||||
using Filtration.Models.BlockItemBaseTypes;
|
||||
|
||||
namespace Filtration.Models.BlockItemTypes
|
||||
{
|
||||
internal class ClassBlockItem : StringListBlockItem
|
||||
{
|
||||
public override string PrefixText { get { return "Class"; } }
|
||||
|
||||
public override int MaximumAllowed
|
||||
{
|
||||
get { return 1; }
|
||||
}
|
||||
|
||||
public override string DisplayHeading { get { return "Class"; } }
|
||||
|
||||
public override string SummaryText
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Items.Count > 0 && Items.Count < 4)
|
||||
{
|
||||
return "Item Classes: " +
|
||||
Items.Aggregate(string.Empty, (current, i) => current + i + ", ").TrimEnd(' ').TrimEnd(',');
|
||||
}
|
||||
if (Items.Count >= 4)
|
||||
{
|
||||
var remaining = Items.Count - 3;
|
||||
return "Item Classes: " + Items.Take(3)
|
||||
.Aggregate(string.Empty, (current, i) => current + i + ", ")
|
||||
.TrimEnd(' ')
|
||||
.TrimEnd(',') + " (+" + remaining + " more)";
|
||||
}
|
||||
return "Item Classes: (none)";
|
||||
}
|
||||
}
|
||||
|
||||
public override Color SummaryBackgroundColor
|
||||
{
|
||||
get { return Colors.MediumSeaGreen; }
|
||||
}
|
||||
|
||||
public override Color SummaryTextColor
|
||||
{
|
||||
get { return Colors.White; }
|
||||
}
|
||||
|
||||
public override int SortOrder
|
||||
{
|
||||
get { return 10; }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,72 @@
|
|||
using System.Windows.Media;
|
||||
using Filtration.Enums;
|
||||
using Filtration.Models.BlockItemBaseTypes;
|
||||
|
||||
namespace Filtration.Models.BlockItemTypes
|
||||
{
|
||||
internal class DropLevelBlockItem : NumericFilterPredicateBlockItem
|
||||
{
|
||||
public DropLevelBlockItem()
|
||||
{
|
||||
}
|
||||
|
||||
public DropLevelBlockItem(FilterPredicateOperator predicateOperator, int predicateOperand)
|
||||
: base(predicateOperator, predicateOperand)
|
||||
{
|
||||
}
|
||||
|
||||
public override string PrefixText
|
||||
{
|
||||
get { return "DropLevel"; }
|
||||
}
|
||||
|
||||
public override int MaximumAllowed
|
||||
{
|
||||
get { return 2; }
|
||||
}
|
||||
|
||||
public override string DisplayHeading
|
||||
{
|
||||
get
|
||||
{
|
||||
return "Drop Level";
|
||||
}
|
||||
}
|
||||
|
||||
public override string SummaryText
|
||||
{
|
||||
get { return "Drop Level " + FilterPredicate; }
|
||||
}
|
||||
|
||||
public override Color SummaryBackgroundColor
|
||||
{
|
||||
get { return Colors.DodgerBlue; }
|
||||
}
|
||||
|
||||
public override Color SummaryTextColor
|
||||
{
|
||||
get { return Colors.White; }
|
||||
}
|
||||
|
||||
public override int SortOrder
|
||||
{
|
||||
get { return 2; }
|
||||
}
|
||||
|
||||
public override int Minimum
|
||||
{
|
||||
get
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public override int Maximum
|
||||
{
|
||||
get
|
||||
{
|
||||
return 100;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
using Filtration.Models.BlockItemBaseTypes;
|
||||
|
||||
namespace Filtration.Models.BlockItemTypes
|
||||
{
|
||||
internal class FontSizeBlockItem : IntegerBlockItem
|
||||
{
|
||||
public FontSizeBlockItem()
|
||||
{
|
||||
}
|
||||
|
||||
public FontSizeBlockItem(int value) : base(value)
|
||||
{
|
||||
}
|
||||
|
||||
public override string PrefixText
|
||||
{
|
||||
get { return "SetFontSize"; }
|
||||
}
|
||||
|
||||
public override int MaximumAllowed
|
||||
{
|
||||
get { return 1; }
|
||||
}
|
||||
|
||||
public override string DisplayHeading
|
||||
{
|
||||
get
|
||||
{
|
||||
return "Font Size";
|
||||
}
|
||||
}
|
||||
|
||||
public override int SortOrder
|
||||
{
|
||||
get { return 15; }
|
||||
}
|
||||
|
||||
public override int Minimum
|
||||
{
|
||||
get
|
||||
{
|
||||
return 11;
|
||||
}
|
||||
}
|
||||
|
||||
public override int Maximum
|
||||
{
|
||||
get
|
||||
{
|
||||
return 45;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,69 @@
|
|||
using System.Windows.Media;
|
||||
using Filtration.Enums;
|
||||
using Filtration.Models.BlockItemBaseTypes;
|
||||
|
||||
namespace Filtration.Models.BlockItemTypes
|
||||
{
|
||||
internal class HeightBlockItem : NumericFilterPredicateBlockItem
|
||||
{
|
||||
public HeightBlockItem()
|
||||
{
|
||||
}
|
||||
|
||||
public HeightBlockItem(FilterPredicateOperator predicateOperator, int predicateOperand)
|
||||
: base(predicateOperator, predicateOperand)
|
||||
{
|
||||
}
|
||||
|
||||
public override string PrefixText
|
||||
{
|
||||
get { return "Height"; }
|
||||
}
|
||||
|
||||
public override int MaximumAllowed
|
||||
{
|
||||
get { return 2; }
|
||||
}
|
||||
|
||||
public override string DisplayHeading
|
||||
{
|
||||
get { return "Height"; }
|
||||
}
|
||||
|
||||
public override string SummaryText
|
||||
{
|
||||
get { return "Height " + FilterPredicate; }
|
||||
}
|
||||
|
||||
public override Color SummaryBackgroundColor
|
||||
{
|
||||
get { return Colors.Plum; }
|
||||
}
|
||||
|
||||
public override Color SummaryTextColor
|
||||
{
|
||||
get { return Colors.White; }
|
||||
}
|
||||
|
||||
public override int SortOrder
|
||||
{
|
||||
get { return 8; }
|
||||
}
|
||||
|
||||
public override int Minimum
|
||||
{
|
||||
get
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public override int Maximum
|
||||
{
|
||||
get
|
||||
{
|
||||
return 6;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,71 @@
|
|||
using System.Windows.Media;
|
||||
using Filtration.Enums;
|
||||
using Filtration.Models.BlockItemBaseTypes;
|
||||
|
||||
namespace Filtration.Models.BlockItemTypes
|
||||
{
|
||||
internal class ItemLevelBlockItem : NumericFilterPredicateBlockItem
|
||||
{
|
||||
public ItemLevelBlockItem()
|
||||
{
|
||||
}
|
||||
|
||||
public ItemLevelBlockItem(FilterPredicateOperator predicateOperator, int predicateOperand) : base (predicateOperator, predicateOperand)
|
||||
{
|
||||
}
|
||||
|
||||
public override string PrefixText
|
||||
{
|
||||
get { return "ItemLevel"; }
|
||||
}
|
||||
|
||||
public override int MaximumAllowed
|
||||
{
|
||||
get { return 2; }
|
||||
}
|
||||
|
||||
public override string DisplayHeading
|
||||
{
|
||||
get
|
||||
{
|
||||
return "Item Level";
|
||||
}
|
||||
}
|
||||
|
||||
public override string SummaryText
|
||||
{
|
||||
get { return "Item Level " + FilterPredicate; }
|
||||
}
|
||||
|
||||
public override Color SummaryBackgroundColor
|
||||
{
|
||||
get { return Colors.DarkSlateGray; }
|
||||
}
|
||||
|
||||
public override Color SummaryTextColor
|
||||
{
|
||||
get { return Colors.White; }
|
||||
}
|
||||
|
||||
public override int SortOrder
|
||||
{
|
||||
get { return 1; }
|
||||
}
|
||||
|
||||
public override int Minimum
|
||||
{
|
||||
get
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public override int Maximum
|
||||
{
|
||||
get
|
||||
{
|
||||
return 100;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,72 @@
|
|||
using System.Windows.Media;
|
||||
using Filtration.Enums;
|
||||
using Filtration.Models.BlockItemBaseTypes;
|
||||
|
||||
namespace Filtration.Models.BlockItemTypes
|
||||
{
|
||||
internal class LinkedSocketsBlockItem : NumericFilterPredicateBlockItem
|
||||
{
|
||||
public LinkedSocketsBlockItem()
|
||||
{
|
||||
}
|
||||
|
||||
public LinkedSocketsBlockItem(FilterPredicateOperator predicateOperator, int predicateOperand)
|
||||
: base(predicateOperator, predicateOperand)
|
||||
{
|
||||
}
|
||||
|
||||
public override string PrefixText
|
||||
{
|
||||
get { return "LinkedSockets"; }
|
||||
}
|
||||
|
||||
public override int MaximumAllowed
|
||||
{
|
||||
get { return 2; }
|
||||
}
|
||||
|
||||
public override string DisplayHeading
|
||||
{
|
||||
get
|
||||
{
|
||||
return "Linked Sockets";
|
||||
}
|
||||
}
|
||||
|
||||
public override string SummaryText
|
||||
{
|
||||
get { return "Linked Sockets " + FilterPredicate; }
|
||||
}
|
||||
|
||||
public override Color SummaryBackgroundColor
|
||||
{
|
||||
get { return Colors.Gold; }
|
||||
}
|
||||
|
||||
public override Color SummaryTextColor
|
||||
{
|
||||
get { return Colors.Black; }
|
||||
}
|
||||
|
||||
public override int SortOrder
|
||||
{
|
||||
get { return 6; }
|
||||
}
|
||||
|
||||
public override int Minimum
|
||||
{
|
||||
get
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public override int Maximum
|
||||
{
|
||||
get
|
||||
{
|
||||
return 6;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,72 @@
|
|||
using System.Windows.Media;
|
||||
using Filtration.Enums;
|
||||
using Filtration.Models.BlockItemBaseTypes;
|
||||
|
||||
namespace Filtration.Models.BlockItemTypes
|
||||
{
|
||||
internal class QualityBlockItem : NumericFilterPredicateBlockItem
|
||||
{
|
||||
public QualityBlockItem()
|
||||
{
|
||||
}
|
||||
|
||||
public QualityBlockItem(FilterPredicateOperator predicateOperator, int predicateOperand)
|
||||
: base(predicateOperator, predicateOperand)
|
||||
{
|
||||
}
|
||||
|
||||
public override string PrefixText
|
||||
{
|
||||
get { return "Quality"; }
|
||||
}
|
||||
|
||||
public override int MaximumAllowed
|
||||
{
|
||||
get { return 2; }
|
||||
}
|
||||
|
||||
public override string DisplayHeading
|
||||
{
|
||||
get
|
||||
{
|
||||
return "Quality";
|
||||
}
|
||||
}
|
||||
|
||||
public override string SummaryText
|
||||
{
|
||||
get { return "Quality " + FilterPredicate; }
|
||||
}
|
||||
|
||||
public override Color SummaryBackgroundColor
|
||||
{
|
||||
get { return Colors.DarkOrange; }
|
||||
}
|
||||
|
||||
public override Color SummaryTextColor
|
||||
{
|
||||
get { return Colors.White; }
|
||||
}
|
||||
|
||||
public override int SortOrder
|
||||
{
|
||||
get { return 3; }
|
||||
}
|
||||
|
||||
public override int Minimum
|
||||
{
|
||||
get
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public override int Maximum
|
||||
{
|
||||
get
|
||||
{
|
||||
return 20;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,77 @@
|
|||
using System.Windows.Media;
|
||||
using Filtration.Enums;
|
||||
using Filtration.Extensions;
|
||||
using Filtration.Models.BlockItemBaseTypes;
|
||||
|
||||
namespace Filtration.Models.BlockItemTypes
|
||||
{
|
||||
internal class RarityBlockItem : NumericFilterPredicateBlockItem
|
||||
{
|
||||
public RarityBlockItem()
|
||||
{
|
||||
}
|
||||
|
||||
public RarityBlockItem(FilterPredicateOperator predicateOperator, int predicateOperand)
|
||||
: base(predicateOperator, predicateOperand)
|
||||
{
|
||||
}
|
||||
|
||||
public override string PrefixText
|
||||
{
|
||||
get { return "Rarity"; }
|
||||
}
|
||||
|
||||
public override int MaximumAllowed
|
||||
{
|
||||
get { return 2; }
|
||||
}
|
||||
|
||||
public override string DisplayHeading
|
||||
{
|
||||
get
|
||||
{
|
||||
return "Item Rarity";
|
||||
}
|
||||
}
|
||||
|
||||
public override string SummaryText
|
||||
{
|
||||
get
|
||||
{
|
||||
return "Rarity " + FilterPredicate.PredicateOperator.GetAttributeDescription() + " " +
|
||||
((ItemRarity) FilterPredicate.PredicateOperand).GetAttributeDescription();
|
||||
}
|
||||
}
|
||||
|
||||
public override Color SummaryBackgroundColor
|
||||
{
|
||||
get { return Colors.LightCoral; }
|
||||
}
|
||||
|
||||
public override Color SummaryTextColor
|
||||
{
|
||||
get { return Colors.White; }
|
||||
}
|
||||
|
||||
public override int SortOrder
|
||||
{
|
||||
get { return 4; }
|
||||
}
|
||||
|
||||
public override int Minimum
|
||||
{
|
||||
get
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public override int Maximum
|
||||
{
|
||||
get
|
||||
{
|
||||
return (int)ItemRarity.Unique;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
using System.Linq;
|
||||
using System.Windows.Media;
|
||||
using Filtration.Models.BlockItemBaseTypes;
|
||||
|
||||
namespace Filtration.Models.BlockItemTypes
|
||||
{
|
||||
internal 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; }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,72 @@
|
|||
using System.Windows.Media;
|
||||
using Filtration.Enums;
|
||||
using Filtration.Models.BlockItemBaseTypes;
|
||||
|
||||
namespace Filtration.Models.BlockItemTypes
|
||||
{
|
||||
internal class SocketsBlockItem : NumericFilterPredicateBlockItem
|
||||
{
|
||||
public SocketsBlockItem()
|
||||
{
|
||||
}
|
||||
|
||||
public SocketsBlockItem(FilterPredicateOperator predicateOperator, int predicateOperand)
|
||||
: base(predicateOperator, predicateOperand)
|
||||
{
|
||||
}
|
||||
|
||||
public override string PrefixText
|
||||
{
|
||||
get { return "Sockets"; }
|
||||
}
|
||||
|
||||
public override int MaximumAllowed
|
||||
{
|
||||
get { return 2; }
|
||||
}
|
||||
|
||||
public override string DisplayHeading
|
||||
{
|
||||
get
|
||||
{
|
||||
return "Sockets";
|
||||
}
|
||||
}
|
||||
|
||||
public override string SummaryText
|
||||
{
|
||||
get { return "Sockets " + FilterPredicate; }
|
||||
}
|
||||
|
||||
public override Color SummaryBackgroundColor
|
||||
{
|
||||
get { return Colors.LightGray; }
|
||||
}
|
||||
|
||||
public override Color SummaryTextColor
|
||||
{
|
||||
get { return Colors.Black; }
|
||||
}
|
||||
|
||||
public override int SortOrder
|
||||
{
|
||||
get { return 5; }
|
||||
}
|
||||
|
||||
public override int Minimum
|
||||
{
|
||||
get
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public override int Maximum
|
||||
{
|
||||
get
|
||||
{
|
||||
return 6;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
using Filtration.Models.BlockItemBaseTypes;
|
||||
|
||||
namespace Filtration.Models.BlockItemTypes
|
||||
{
|
||||
internal class SoundBlockItem : DualIntegerBlockItem
|
||||
{
|
||||
public SoundBlockItem()
|
||||
{
|
||||
Value = 1;
|
||||
SecondValue = 79;
|
||||
}
|
||||
|
||||
public SoundBlockItem(int value, int secondValue) : base(value, secondValue)
|
||||
{
|
||||
}
|
||||
|
||||
public override string PrefixText
|
||||
{
|
||||
get { return "PlayAlertSound"; }
|
||||
}
|
||||
|
||||
public override int MaximumAllowed
|
||||
{
|
||||
get { return 1; }
|
||||
}
|
||||
|
||||
public override string DisplayHeading
|
||||
{
|
||||
get
|
||||
{
|
||||
return "Play Alert Sound";
|
||||
}
|
||||
}
|
||||
|
||||
public override int SortOrder
|
||||
{
|
||||
get { return 16; }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
using System.Windows.Media;
|
||||
using Filtration.Models.BlockItemBaseTypes;
|
||||
|
||||
namespace Filtration.Models.BlockItemTypes
|
||||
{
|
||||
internal class TextColorBlockItem : ColorBlockItem
|
||||
{
|
||||
public TextColorBlockItem()
|
||||
{
|
||||
}
|
||||
|
||||
public TextColorBlockItem(Color color) : base(color)
|
||||
{
|
||||
}
|
||||
|
||||
public override string PrefixText
|
||||
{
|
||||
get { return "SetTextColor"; }
|
||||
}
|
||||
|
||||
public override int MaximumAllowed
|
||||
{
|
||||
get { return 1; }
|
||||
}
|
||||
|
||||
public override string DisplayHeading
|
||||
{
|
||||
get
|
||||
{
|
||||
return "Text Color";
|
||||
}
|
||||
}
|
||||
|
||||
public override int SortOrder
|
||||
{
|
||||
get { return 12; }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,72 @@
|
|||
using System.Windows.Media;
|
||||
using Filtration.Enums;
|
||||
using Filtration.Models.BlockItemBaseTypes;
|
||||
|
||||
namespace Filtration.Models.BlockItemTypes
|
||||
{
|
||||
internal class WidthBlockItem : NumericFilterPredicateBlockItem
|
||||
{
|
||||
public WidthBlockItem()
|
||||
{
|
||||
}
|
||||
|
||||
public WidthBlockItem(FilterPredicateOperator predicateOperator, int predicateOperand)
|
||||
: base(predicateOperator, predicateOperand)
|
||||
{
|
||||
}
|
||||
|
||||
public override string PrefixText
|
||||
{
|
||||
get { return "Width"; }
|
||||
}
|
||||
|
||||
public override int MaximumAllowed
|
||||
{
|
||||
get { return 2; }
|
||||
}
|
||||
|
||||
public override string DisplayHeading
|
||||
{
|
||||
get
|
||||
{
|
||||
return "Width";
|
||||
}
|
||||
}
|
||||
|
||||
public override string SummaryText
|
||||
{
|
||||
get { return "Width " + FilterPredicate; }
|
||||
}
|
||||
|
||||
public override Color SummaryBackgroundColor
|
||||
{
|
||||
get { return Colors.Tan; }
|
||||
}
|
||||
|
||||
public override Color SummaryTextColor
|
||||
{
|
||||
get { return Colors.White; }
|
||||
}
|
||||
|
||||
public override int SortOrder
|
||||
{
|
||||
get { return 7; }
|
||||
}
|
||||
|
||||
public override int Minimum
|
||||
{
|
||||
get
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public override int Maximum
|
||||
{
|
||||
get
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
using System.ComponentModel;
|
||||
|
||||
namespace Filtration.Models
|
||||
{
|
||||
internal interface IAudioVisualBlockItem
|
||||
{
|
||||
event PropertyChangedEventHandler PropertyChanged;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
using System.ComponentModel;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace Filtration.Models
|
||||
{
|
||||
internal interface ILootFilterBlockItem : INotifyPropertyChanged
|
||||
{
|
||||
string PrefixText { get; }
|
||||
int MaximumAllowed { get; }
|
||||
string DisplayHeading { get; }
|
||||
string SummaryText { get; }
|
||||
Color SummaryBackgroundColor { get; }
|
||||
Color SummaryTextColor { get; }
|
||||
int SortOrder { get; }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using Filtration.Enums;
|
||||
using Filtration.Models.BlockItemBaseTypes;
|
||||
|
||||
namespace Filtration.Models
|
||||
{
|
||||
internal class LootFilterBlock
|
||||
{
|
||||
public LootFilterBlock()
|
||||
{
|
||||
BlockItems = new ObservableCollection<ILootFilterBlockItem> {new ActionBlockItem(BlockAction.Show)};
|
||||
}
|
||||
|
||||
public string Description { get; set; }
|
||||
|
||||
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<ILootFilterBlockItem> 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 = (ILootFilterBlockItem)Activator.CreateInstance(type);
|
||||
return BlockCount(type) < blockItem.MaximumAllowed;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
namespace Filtration.Models
|
||||
{
|
||||
internal class LootFilterScript
|
||||
{
|
||||
public LootFilterScript()
|
||||
{
|
||||
LootFilterBlocks = new ObservableCollection<LootFilterBlock>();
|
||||
}
|
||||
|
||||
public ObservableCollection<LootFilterBlock> LootFilterBlocks { get; set; }
|
||||
public string FilePath { get; set; }
|
||||
public string Description { get; set; }
|
||||
public DateTime DateModified { get; set; }
|
||||
|
||||
public List<string> Validate()
|
||||
{
|
||||
var validationErrors = new List<string>();
|
||||
|
||||
if (LootFilterBlocks.Count == 0)
|
||||
{
|
||||
validationErrors.Add("A script must have at least one block");
|
||||
}
|
||||
|
||||
return validationErrors;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
namespace Filtration.Models
|
||||
{
|
||||
internal class LootFilterSection : LootFilterBlock
|
||||
{
|
||||
}
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
using Filtration.Annotations;
|
||||
using Filtration.Enums;
|
||||
using Filtration.Extensions;
|
||||
|
||||
namespace Filtration.Models
|
||||
{
|
||||
internal class NumericFilterPredicate : INotifyPropertyChanged
|
||||
{
|
||||
private FilterPredicateOperator _predicateOperator;
|
||||
private int _predicateOperand;
|
||||
|
||||
public NumericFilterPredicate(FilterPredicateOperator predicateOperator, int predicateOperand)
|
||||
{
|
||||
PredicateOperator = predicateOperator;
|
||||
PredicateOperand = predicateOperand;
|
||||
}
|
||||
|
||||
public NumericFilterPredicate()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public FilterPredicateOperator PredicateOperator
|
||||
{
|
||||
get { return _predicateOperator; }
|
||||
set
|
||||
{
|
||||
_predicateOperator = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public int PredicateOperand
|
||||
{
|
||||
get { return _predicateOperand; }
|
||||
set
|
||||
{
|
||||
_predicateOperand = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return PredicateOperator.GetAttributeDescription() + " " + PredicateOperand;
|
||||
}
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
[NotifyPropertyChangedInvocator]
|
||||
public virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
var handler = PropertyChanged;
|
||||
if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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.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 { }
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows;
|
||||
|
||||
// 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")]
|
||||
[assembly: AssemblyDescription("A loot filter script manager for Path of Exile")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("XVar Industries Inc.")]
|
||||
[assembly: AssemblyProduct("Filtration")]
|
||||
[assembly: AssemblyCopyright("Copyright © Ben Wallis 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)]
|
||||
|
||||
//In order to begin building localizable applications, set
|
||||
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
|
||||
//inside a <PropertyGroup>. For example, if you are using US english
|
||||
//in your source files, set the <UICulture> to en-US. Then uncomment
|
||||
//the NeutralResourceLanguage attribute below. Update the "en-US" in
|
||||
//the line below to match the UICulture setting in the project file.
|
||||
|
||||
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
|
||||
|
||||
|
||||
[assembly: ThemeInfo(
|
||||
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
|
||||
//(used if a resource is not found in the page,
|
||||
// or application resource dictionaries)
|
||||
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
|
||||
//(used if a resource is not found in the page,
|
||||
// app, or any theme specific resource dictionaries)
|
||||
)]
|
||||
|
||||
|
||||
// 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("DynamicProxyGenAssembly2")]
|
|
@ -0,0 +1,164 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.0
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Filtration.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Filtration.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.IO.UnmanagedMemoryStream similar to System.IO.MemoryStream.
|
||||
/// </summary>
|
||||
internal static System.IO.UnmanagedMemoryStream AlertSound1 {
|
||||
get {
|
||||
return ResourceManager.GetStream("AlertSound1", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.IO.UnmanagedMemoryStream similar to System.IO.MemoryStream.
|
||||
/// </summary>
|
||||
internal static System.IO.UnmanagedMemoryStream AlertSound2 {
|
||||
get {
|
||||
return ResourceManager.GetStream("AlertSound2", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.IO.UnmanagedMemoryStream similar to System.IO.MemoryStream.
|
||||
/// </summary>
|
||||
internal static System.IO.UnmanagedMemoryStream AlertSound3 {
|
||||
get {
|
||||
return ResourceManager.GetStream("AlertSound3", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.IO.UnmanagedMemoryStream similar to System.IO.MemoryStream.
|
||||
/// </summary>
|
||||
internal static System.IO.UnmanagedMemoryStream AlertSound4 {
|
||||
get {
|
||||
return ResourceManager.GetStream("AlertSound4", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.IO.UnmanagedMemoryStream similar to System.IO.MemoryStream.
|
||||
/// </summary>
|
||||
internal static System.IO.UnmanagedMemoryStream AlertSound5 {
|
||||
get {
|
||||
return ResourceManager.GetStream("AlertSound5", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.IO.UnmanagedMemoryStream similar to System.IO.MemoryStream.
|
||||
/// </summary>
|
||||
internal static System.IO.UnmanagedMemoryStream AlertSound6 {
|
||||
get {
|
||||
return ResourceManager.GetStream("AlertSound6", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.IO.UnmanagedMemoryStream similar to System.IO.MemoryStream.
|
||||
/// </summary>
|
||||
internal static System.IO.UnmanagedMemoryStream AlertSound7 {
|
||||
get {
|
||||
return ResourceManager.GetStream("AlertSound7", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.IO.UnmanagedMemoryStream similar to System.IO.MemoryStream.
|
||||
/// </summary>
|
||||
internal static System.IO.UnmanagedMemoryStream AlertSound8 {
|
||||
get {
|
||||
return ResourceManager.GetStream("AlertSound8", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.IO.UnmanagedMemoryStream similar to System.IO.MemoryStream.
|
||||
/// </summary>
|
||||
internal static System.IO.UnmanagedMemoryStream AlertSound9 {
|
||||
get {
|
||||
return ResourceManager.GetStream("AlertSound9", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Byte[].
|
||||
/// </summary>
|
||||
internal static byte[] Fontin_SmallCaps {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("Fontin_SmallCaps", resourceCulture);
|
||||
return ((byte[])(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap groundtile {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("groundtile", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,154 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="AlertSound1" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\AlertSound1.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name="AlertSound2" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\AlertSound2.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name="AlertSound3" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\AlertSound3.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name="AlertSound4" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\AlertSound4.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name="AlertSound5" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\AlertSound5.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name="AlertSound6" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\AlertSound6.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name="AlertSound7" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\AlertSound7.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name="AlertSound8" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\AlertSound8.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name="AlertSound9" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\AlertSound9.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name="Fontin_SmallCaps" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\Fontin-SmallCaps.ttf;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name="groundtile" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\groundtile.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
</root>
|
|
@ -0,0 +1,30 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.34209
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Filtration.Properties
|
||||
{
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
|
||||
{
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default
|
||||
{
|
||||
get
|
||||
{
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
</SettingsFile>
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,36 @@
|
|||
Life Flasks
|
||||
Mana Flasks
|
||||
Hybrid Flasks
|
||||
Currency
|
||||
Amulets
|
||||
Rings
|
||||
Claws
|
||||
Daggers
|
||||
Wands
|
||||
One Hand Swords
|
||||
Thrusting One Hand Swords
|
||||
One Hand Axes
|
||||
One Hand Maces
|
||||
Bows
|
||||
Staves
|
||||
Two Hand Swords
|
||||
Two Hand Axes
|
||||
Two Hand Maces
|
||||
Active Skill Gems
|
||||
Support Skill Gems
|
||||
Quivers
|
||||
Belts
|
||||
Gloves
|
||||
Boots
|
||||
Body Armours
|
||||
Helmets
|
||||
Shields
|
||||
Stackable Currency
|
||||
Quest Items
|
||||
Sceptres
|
||||
Utility Flasks
|
||||
Maps
|
||||
Fishing Rods
|
||||
Map Fragments
|
||||
Hideout Doodads
|
||||
Microtransactions
|
Binary file not shown.
After Width: | Height: | Size: 20 KiB |
|
@ -0,0 +1,36 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace Filtration.Services
|
||||
{
|
||||
internal interface IFileSystemService
|
||||
{
|
||||
string ReadFileAsString(string filePath);
|
||||
void WriteFileFromString(string filePath, string inputString);
|
||||
bool DirectoryExists(string directoryPath);
|
||||
string GetUserProfilePath();
|
||||
}
|
||||
|
||||
internal class FileSystemService : IFileSystemService
|
||||
{
|
||||
public string ReadFileAsString(string filePath)
|
||||
{
|
||||
return File.ReadAllText(filePath);
|
||||
}
|
||||
|
||||
public void WriteFileFromString(string filePath, string inputString)
|
||||
{
|
||||
File.WriteAllText(filePath, inputString);
|
||||
}
|
||||
|
||||
public bool DirectoryExists(string directoryPath)
|
||||
{
|
||||
return Directory.Exists(directoryPath);
|
||||
}
|
||||
|
||||
public string GetUserProfilePath()
|
||||
{
|
||||
return Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
using Filtration.Models;
|
||||
using Filtration.Translators;
|
||||
|
||||
namespace Filtration.Services
|
||||
{
|
||||
internal interface ILootFilterPersistenceService
|
||||
{
|
||||
string LootFilterScriptDirectory { get; set; }
|
||||
LootFilterScript LoadLootFilterScript(string filePath);
|
||||
void SaveLootFilterScript(LootFilterScript script);
|
||||
string DefaultPathOfExileDirectory();
|
||||
}
|
||||
|
||||
internal class LootFilterPersistenceService : ILootFilterPersistenceService
|
||||
{
|
||||
private readonly IFileSystemService _fileSystemService;
|
||||
private readonly ILootFilterScriptTranslator _lootFilterScriptTranslator;
|
||||
|
||||
public LootFilterPersistenceService(IFileSystemService fileSystemService, ILootFilterScriptTranslator lootFilterScriptTranslator)
|
||||
{
|
||||
_fileSystemService = fileSystemService;
|
||||
_lootFilterScriptTranslator = lootFilterScriptTranslator;
|
||||
}
|
||||
|
||||
public string LootFilterScriptDirectory { get; set; }
|
||||
|
||||
public LootFilterScript LoadLootFilterScript(string filePath)
|
||||
{
|
||||
var script =
|
||||
_lootFilterScriptTranslator.TranslateStringToLootFilterScript(
|
||||
_fileSystemService.ReadFileAsString(filePath));
|
||||
|
||||
script.FilePath = filePath;
|
||||
return script;
|
||||
}
|
||||
|
||||
public void SaveLootFilterScript(LootFilterScript script)
|
||||
{
|
||||
_fileSystemService.WriteFileFromString(script.FilePath,
|
||||
_lootFilterScriptTranslator.TranslateLootFilterScriptToString(script));
|
||||
}
|
||||
|
||||
public string DefaultPathOfExileDirectory()
|
||||
{
|
||||
var defaultDir = _fileSystemService.GetUserProfilePath() + "\\Documents\\My Games\\Path of Exile";
|
||||
var defaultDirExists = _fileSystemService.DirectoryExists(defaultDir);
|
||||
|
||||
return defaultDirExists ? defaultDir : string.Empty;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Filtration.Utilities;
|
||||
|
||||
namespace Filtration.Services
|
||||
{
|
||||
public interface IStaticDataService
|
||||
{
|
||||
IEnumerable<string> ItemBaseTypes { get; }
|
||||
IEnumerable<string> ItemClasses { get; }
|
||||
}
|
||||
|
||||
internal class StaticDataService : IStaticDataService
|
||||
{
|
||||
private readonly IFileSystemService _fileSystemService;
|
||||
|
||||
public StaticDataService(IFileSystemService fileSystemService)
|
||||
{
|
||||
_fileSystemService = fileSystemService;
|
||||
PopulateStaticData();
|
||||
}
|
||||
|
||||
public IEnumerable<string> ItemBaseTypes { get; private set; }
|
||||
|
||||
public IEnumerable<string> ItemClasses { get; private set; }
|
||||
|
||||
private void PopulateStaticData()
|
||||
{
|
||||
var itemBaseTypes = _fileSystemService.ReadFileAsString("Resources\\ItemBaseTypes.txt");
|
||||
ItemBaseTypes = new LineReader(() => new StringReader(itemBaseTypes)).ToList();
|
||||
|
||||
var itemClasses = _fileSystemService.ReadFileAsString("Resources\\ItemClasses.txt");
|
||||
ItemClasses = new LineReader(() => new StringReader(itemClasses)).ToList();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,436 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows.Media;
|
||||
using Filtration.Enums;
|
||||
using Filtration.Extensions;
|
||||
using Filtration.Models;
|
||||
using Filtration.Models.BlockItemBaseTypes;
|
||||
using Filtration.Models.BlockItemTypes;
|
||||
using Filtration.Utilities;
|
||||
|
||||
namespace Filtration.Translators
|
||||
{
|
||||
internal interface ILootFilterBlockTranslator
|
||||
{
|
||||
LootFilterBlock TranslateStringToLootFilterBlock(string inputString);
|
||||
string TranslateLootFilterBlockToString(LootFilterBlock block);
|
||||
}
|
||||
|
||||
internal class LootFilterBlockTranslator : ILootFilterBlockTranslator
|
||||
{
|
||||
private const string Indent = " ";
|
||||
private readonly string _newLine = Environment.NewLine + Indent;
|
||||
|
||||
// This method converts a string into a LootFilterBlock. This is used for pasting LootFilterBlocks
|
||||
// and reading LootFilterScripts from a file.
|
||||
public LootFilterBlock TranslateStringToLootFilterBlock(string inputString)
|
||||
{
|
||||
var block = new LootFilterBlock();
|
||||
var showHideFound = false;
|
||||
foreach (var line in new LineReader(() => new StringReader(inputString)))
|
||||
{
|
||||
if (line.StartsWith(@"# Section:"))
|
||||
{
|
||||
var section = new LootFilterSection
|
||||
{
|
||||
Description = line.Substring(line.IndexOf(":", StringComparison.Ordinal) + 1).Trim()
|
||||
};
|
||||
return section;
|
||||
}
|
||||
|
||||
if (line.StartsWith(@"#") && !showHideFound)
|
||||
{
|
||||
block.Description = line.TrimStart('#').TrimStart(' ');
|
||||
continue;
|
||||
}
|
||||
|
||||
var trimmedLine = line.TrimStart(' ');
|
||||
var spaceOrEndOfLinePos = trimmedLine.IndexOf(" ", StringComparison.Ordinal) > 0 ? trimmedLine.IndexOf(" ", StringComparison.Ordinal) : trimmedLine.Length;
|
||||
|
||||
var lineOption = trimmedLine.Substring(0, spaceOrEndOfLinePos);
|
||||
switch (lineOption)
|
||||
{
|
||||
case "Show":
|
||||
showHideFound = true;
|
||||
block.Action = BlockAction.Show;
|
||||
break;
|
||||
case "Hide":
|
||||
showHideFound = true;
|
||||
block.Action = BlockAction.Hide;
|
||||
break;
|
||||
case "ItemLevel":
|
||||
{
|
||||
AddNumericFilterPredicateItemToBlockItems<ItemLevelBlockItem>(block, trimmedLine);
|
||||
break;
|
||||
}
|
||||
case "DropLevel":
|
||||
{
|
||||
AddNumericFilterPredicateItemToBlockItems<DropLevelBlockItem>(block, trimmedLine);
|
||||
break;
|
||||
}
|
||||
case "Quality":
|
||||
{
|
||||
AddNumericFilterPredicateItemToBlockItems<QualityBlockItem>(block,trimmedLine);
|
||||
break;
|
||||
}
|
||||
case "Rarity":
|
||||
{
|
||||
var blockItemValue = new RarityBlockItem();
|
||||
var result = Regex.Match(trimmedLine, @"^\w+\s+([><!=]{0,2})\s*(\w+)$");
|
||||
if (result.Groups.Count == 3)
|
||||
{
|
||||
blockItemValue.FilterPredicate.PredicateOperator =
|
||||
EnumHelper.GetEnumValueFromDescription<FilterPredicateOperator>(string.IsNullOrEmpty(result.Groups[1].Value) ? "=" : result.Groups[1].Value);
|
||||
blockItemValue.FilterPredicate.PredicateOperand =
|
||||
(int)(EnumHelper.GetEnumValueFromDescription<ItemRarity>(result.Groups[2].Value));
|
||||
}
|
||||
block.BlockItems.Add(blockItemValue);
|
||||
break;
|
||||
}
|
||||
case "Class":
|
||||
{
|
||||
AddStringListItemToBlockItems<ClassBlockItem>(block, trimmedLine);
|
||||
break;
|
||||
}
|
||||
case "BaseType":
|
||||
{
|
||||
AddStringListItemToBlockItems<BaseTypeBlockItem>(block, trimmedLine);
|
||||
break;
|
||||
}
|
||||
case "Sockets":
|
||||
{
|
||||
AddNumericFilterPredicateItemToBlockItems<SocketsBlockItem>(block, trimmedLine);
|
||||
break;
|
||||
}
|
||||
case "LinkedSockets":
|
||||
{
|
||||
AddNumericFilterPredicateItemToBlockItems<LinkedSocketsBlockItem>(block,trimmedLine);
|
||||
break;
|
||||
}
|
||||
case "Width":
|
||||
{
|
||||
AddNumericFilterPredicateItemToBlockItems<WidthBlockItem>(block, trimmedLine);
|
||||
break;
|
||||
}
|
||||
case "Height":
|
||||
{
|
||||
AddNumericFilterPredicateItemToBlockItems<HeightBlockItem>(block, trimmedLine);
|
||||
break;
|
||||
}
|
||||
case "SocketGroup":
|
||||
{
|
||||
//var blockItem = new SocketGroupBlockItem();
|
||||
|
||||
//var socketGroups = Regex.Matches(trimmedLine, @"\s+([RGBW]{1,6})");
|
||||
|
||||
//foreach (Match socketGroupMatch in socketGroups)
|
||||
//{
|
||||
|
||||
// var socketGroupCharArray = socketGroupMatch.Groups[1].Value.Trim(' ').ToCharArray();
|
||||
// var socketColorList = socketGroupCharArray.Select(c => (EnumHelper.GetEnumValueFromDescription<SocketColor>(c.ToString()))).ToList();
|
||||
|
||||
// blockItem.SocketColorGroups.Add(socketColorList);
|
||||
//}
|
||||
|
||||
//block.FilterBlockItems.Add(blockItem);
|
||||
AddStringListItemToBlockItems<SocketGroupBlockItem>(block, trimmedLine);
|
||||
break;
|
||||
}
|
||||
case "SetTextColor":
|
||||
{
|
||||
// Only ever use the last SetTextColor item encountered as multiples aren't valid.
|
||||
RemoveExistingBlockItemsOfType<TextColorBlockItem>(block);
|
||||
|
||||
AddColorItemToBlockItems<TextColorBlockItem>(block, trimmedLine);
|
||||
break;
|
||||
}
|
||||
case "SetBackgroundColor":
|
||||
{
|
||||
// Only ever use the last SetBackgroundColor item encountered as multiples aren't valid.
|
||||
RemoveExistingBlockItemsOfType<BackgroundColorBlockItem>(block);
|
||||
|
||||
AddColorItemToBlockItems<BackgroundColorBlockItem>(block, trimmedLine);
|
||||
break;
|
||||
}
|
||||
case "SetBorderColor":
|
||||
{
|
||||
// Only ever use the last SetBorderColor item encountered as multiples aren't valid.
|
||||
RemoveExistingBlockItemsOfType<BorderColorBlockItem>(block);
|
||||
|
||||
AddColorItemToBlockItems<BorderColorBlockItem>(block, trimmedLine);
|
||||
break;
|
||||
}
|
||||
case "SetFontSize":
|
||||
{
|
||||
// Only ever use the last SetFontSize item encountered as multiples aren't valid.
|
||||
RemoveExistingBlockItemsOfType<FontSizeBlockItem>(block);
|
||||
|
||||
var match = Regex.Match(trimmedLine, @"\s+(\d+)");
|
||||
if (match.Success)
|
||||
{
|
||||
var blockItemValue = new FontSizeBlockItem(Convert.ToInt16(match.Value));
|
||||
block.BlockItems.Add(blockItemValue);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "PlayAlertSound":
|
||||
{
|
||||
// Only ever use the last PlayAlertSound item encountered as multiples aren't valid.
|
||||
RemoveExistingBlockItemsOfType<SoundBlockItem>(block);
|
||||
|
||||
var matches = Regex.Matches(trimmedLine, @"\s+(\d+)");
|
||||
switch (matches.Count)
|
||||
{
|
||||
case 1:
|
||||
if (matches[0].Success)
|
||||
{
|
||||
var blockItemValue = new SoundBlockItem
|
||||
{
|
||||
Value = Convert.ToInt16(matches[0].Value),
|
||||
SecondValue = 79
|
||||
};
|
||||
block.BlockItems.Add(blockItemValue);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (matches[0].Success && matches[1].Success)
|
||||
{
|
||||
var blockItemValue = new SoundBlockItem
|
||||
{
|
||||
Value = Convert.ToInt16(matches[0].Value),
|
||||
SecondValue = Convert.ToInt16(matches[1].Value)
|
||||
};
|
||||
block.BlockItems.Add(blockItemValue);
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return block;
|
||||
}
|
||||
|
||||
private static void RemoveExistingBlockItemsOfType<T>(LootFilterBlock block)
|
||||
{
|
||||
var existingBlockItemCount = block.BlockItems.Count(b => b.GetType() == typeof(T));
|
||||
if (existingBlockItemCount > 0)
|
||||
{
|
||||
var existingBlockItem = block.BlockItems.First(b => b.GetType() == typeof(T));
|
||||
block.BlockItems.Remove(existingBlockItem);
|
||||
}
|
||||
}
|
||||
|
||||
private static void AddNumericFilterPredicateItemToBlockItems<T>(LootFilterBlock block, string inputString) where T : NumericFilterPredicateBlockItem
|
||||
{
|
||||
var blockItem = Activator.CreateInstance<T>();
|
||||
|
||||
SetNumericFilterPredicateFromString(blockItem.FilterPredicate, inputString);
|
||||
block.BlockItems.Add(blockItem);
|
||||
}
|
||||
|
||||
private static void SetNumericFilterPredicateFromString(NumericFilterPredicate predicate, string inputString)
|
||||
{
|
||||
var result = Regex.Match(inputString, @"^\w+\s+([><!=]{0,2})\s*(\d{0,3})$");
|
||||
if (result.Groups.Count != 3) return;
|
||||
|
||||
predicate.PredicateOperator =
|
||||
EnumHelper.GetEnumValueFromDescription<FilterPredicateOperator>(string.IsNullOrEmpty(result.Groups[1].Value) ? "=" : result.Groups[1].Value);
|
||||
predicate.PredicateOperand = Convert.ToInt16(result.Groups[2].Value);
|
||||
}
|
||||
|
||||
private static void AddStringListItemToBlockItems<T>(LootFilterBlock block, string inputString) where T : StringListBlockItem
|
||||
{
|
||||
var blockItem = Activator.CreateInstance<T>();
|
||||
PopulateListFromString(blockItem.Items, inputString.Substring(inputString.IndexOf(" ", StringComparison.Ordinal) + 1).Trim());
|
||||
block.BlockItems.Add(blockItem);
|
||||
}
|
||||
|
||||
private static void PopulateListFromString(ICollection<string> list, string inputString)
|
||||
{
|
||||
var result = Regex.Matches(inputString, @"[^\s""]+|""([^""]*)""");
|
||||
foreach (Match match in result)
|
||||
{
|
||||
list.Add(match.Groups[1].Success
|
||||
? match.Groups[1].Value
|
||||
: match.Groups[0].Value);
|
||||
}
|
||||
}
|
||||
|
||||
private static void AddColorItemToBlockItems<T>(LootFilterBlock block, string inputString) where T : ColorBlockItem
|
||||
{
|
||||
var blockItem = Activator.CreateInstance<T>();
|
||||
blockItem.Color = GetColorFromString(inputString);
|
||||
block.BlockItems.Add(blockItem);
|
||||
}
|
||||
|
||||
private static Color GetColorFromString(string inputString)
|
||||
{
|
||||
var argbValues = Regex.Matches(inputString, @"\s+(\d+)");
|
||||
|
||||
switch (argbValues.Count)
|
||||
{
|
||||
case 3:
|
||||
return new Color
|
||||
{
|
||||
A = byte.MaxValue,
|
||||
R = Convert.ToByte(argbValues[0].Value),
|
||||
G = Convert.ToByte(argbValues[1].Value),
|
||||
B = Convert.ToByte(argbValues[2].Value)
|
||||
};
|
||||
case 4:
|
||||
return new Color
|
||||
{
|
||||
R = Convert.ToByte(argbValues[0].Value),
|
||||
G = Convert.ToByte(argbValues[1].Value),
|
||||
B = Convert.ToByte(argbValues[2].Value),
|
||||
A = Convert.ToByte(argbValues[3].Value)
|
||||
};
|
||||
}
|
||||
return new Color();
|
||||
}
|
||||
|
||||
// This method converts a LootFilterBlock object into a string. This is used for copying a LootFilterBlock
|
||||
// to the clipboard, and when saving a LootFilterScript.
|
||||
public string TranslateLootFilterBlockToString(LootFilterBlock block)
|
||||
{
|
||||
if (block.GetType() == typeof (LootFilterSection))
|
||||
{
|
||||
return "# Section: " + block.Description;
|
||||
}
|
||||
|
||||
var outputString = string.Empty;
|
||||
|
||||
if (!string.IsNullOrEmpty(block.Description))
|
||||
{
|
||||
outputString += "# " + block.Description + Environment.NewLine;
|
||||
}
|
||||
|
||||
outputString += block.Action.GetAttributeDescription();
|
||||
|
||||
// This could be refactored to use the upcasted NumericFilterPredicateBlockItem (or even ILootFilterBlockItem) instead
|
||||
// of the specific downcasts. Leaving it like this currently to preserve sorting since the different
|
||||
// downcasts have no defined sort order (yet).
|
||||
foreach (var blockItem in block.BlockItems.OfType<ItemLevelBlockItem>())
|
||||
{
|
||||
AddNumericFilterPredicateBlockItemToString(ref outputString, blockItem);
|
||||
}
|
||||
|
||||
foreach (var blockItem in block.BlockItems.OfType<DropLevelBlockItem>())
|
||||
{
|
||||
AddNumericFilterPredicateBlockItemToString(ref outputString, blockItem);
|
||||
}
|
||||
|
||||
foreach (var blockItem in block.BlockItems.OfType<QualityBlockItem>())
|
||||
{
|
||||
AddNumericFilterPredicateBlockItemToString(ref outputString, blockItem);
|
||||
}
|
||||
|
||||
// ReSharper disable once LoopCanBeConvertedToQuery
|
||||
foreach (var blockItem in block.BlockItems.OfType<RarityBlockItem>())
|
||||
{
|
||||
outputString += _newLine + "Rarity " +
|
||||
blockItem.FilterPredicate.PredicateOperator
|
||||
.GetAttributeDescription() +
|
||||
" " +
|
||||
((ItemRarity) blockItem.FilterPredicate.PredicateOperand)
|
||||
.GetAttributeDescription();
|
||||
}
|
||||
|
||||
foreach (var blockItem in block.BlockItems.OfType<ClassBlockItem>())
|
||||
{
|
||||
AddStringListBlockItemToString(ref outputString, blockItem);
|
||||
}
|
||||
|
||||
foreach (var blockItem in block.BlockItems.OfType<BaseTypeBlockItem>())
|
||||
{
|
||||
AddStringListBlockItemToString(ref outputString, blockItem);
|
||||
}
|
||||
|
||||
foreach (var blockItem in block.BlockItems.OfType<SocketsBlockItem>())
|
||||
{
|
||||
AddNumericFilterPredicateBlockItemToString(ref outputString, blockItem);
|
||||
}
|
||||
|
||||
foreach (var blockItem in block.BlockItems.OfType<LinkedSocketsBlockItem>())
|
||||
{
|
||||
AddNumericFilterPredicateBlockItemToString(ref outputString, blockItem);
|
||||
}
|
||||
|
||||
foreach (var blockItem in block.BlockItems.OfType<WidthBlockItem>())
|
||||
{
|
||||
AddNumericFilterPredicateBlockItemToString(ref outputString, blockItem);
|
||||
}
|
||||
|
||||
foreach (var blockItem in block.BlockItems.OfType<HeightBlockItem>())
|
||||
{
|
||||
AddNumericFilterPredicateBlockItemToString(ref outputString, blockItem);
|
||||
}
|
||||
|
||||
foreach (var blockItem in block.BlockItems.OfType<SocketGroupBlockItem>())
|
||||
{
|
||||
AddStringListBlockItemToString(ref outputString, blockItem);
|
||||
}
|
||||
|
||||
if (block.BlockItems.Count(b => b is TextColorBlockItem) > 0)
|
||||
{
|
||||
// Only add the first TextColorBlockItem type (not that we should ever have more than one).
|
||||
AddColorBlockItemToString(ref outputString, block.BlockItems.OfType<TextColorBlockItem>().First());
|
||||
}
|
||||
|
||||
if (block.BlockItems.Count(b => b.GetType() == typeof(BackgroundColorBlockItem)) > 0)
|
||||
{
|
||||
// Only add the first BackgroundColorBlockItem type (not that we should ever have more than one).
|
||||
AddColorBlockItemToString(ref outputString, block.BlockItems.OfType<BackgroundColorBlockItem>().First());
|
||||
}
|
||||
|
||||
if (block.BlockItems.Count(b => b.GetType() == typeof(BorderColorBlockItem)) > 0)
|
||||
{
|
||||
// Only add the first BorderColorBlockItem (not that we should ever have more than one).
|
||||
AddColorBlockItemToString(ref outputString, block.BlockItems.OfType<BorderColorBlockItem>().First());
|
||||
}
|
||||
|
||||
if (block.BlockItems.Count(b => b.GetType() == typeof(FontSizeBlockItem)) > 0)
|
||||
{
|
||||
outputString += _newLine + "SetFontSize " +
|
||||
block.BlockItems.OfType<FontSizeBlockItem>().First().Value;
|
||||
}
|
||||
|
||||
if (block.BlockItems.Count(b => b.GetType() == typeof(SoundBlockItem)) > 0)
|
||||
{
|
||||
var blockItemValue = block.BlockItems.OfType<SoundBlockItem>().First();
|
||||
outputString += _newLine + "PlayAlertSound " + blockItemValue.Value + " " + blockItemValue.SecondValue;
|
||||
}
|
||||
|
||||
return outputString;
|
||||
}
|
||||
|
||||
private void AddNumericFilterPredicateBlockItemToString(ref string targetString, NumericFilterPredicateBlockItem blockItem)
|
||||
{
|
||||
targetString += _newLine + blockItem.PrefixText + " " +
|
||||
blockItem.FilterPredicate.PredicateOperator.GetAttributeDescription() +
|
||||
" " + blockItem.FilterPredicate.PredicateOperand;
|
||||
}
|
||||
|
||||
private void AddStringListBlockItemToString(ref string targetString, StringListBlockItem blockItem)
|
||||
{
|
||||
var enumerable = blockItem.Items as IList<string> ?? blockItem.Items.ToList();
|
||||
if (enumerable.Count > 0)
|
||||
{
|
||||
targetString += _newLine + blockItem.PrefixText + " " +
|
||||
string.Format("\"{0}\"",
|
||||
string.Join("\" \"", enumerable.ToArray()));
|
||||
}
|
||||
}
|
||||
|
||||
private void AddColorBlockItemToString(ref string targetString, ColorBlockItem blockItem)
|
||||
{
|
||||
targetString += _newLine + blockItem.PrefixText + " " + blockItem.Color.R + " " + blockItem.Color.G + " "
|
||||
+ blockItem.Color.B + (blockItem.Color.A < 255 ? " " + blockItem.Color.A : string.Empty);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,104 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text.RegularExpressions;
|
||||
using Filtration.Models;
|
||||
using Filtration.Utilities;
|
||||
|
||||
namespace Filtration.Translators
|
||||
{
|
||||
internal interface ILootFilterScriptTranslator
|
||||
{
|
||||
LootFilterScript TranslateStringToLootFilterScript(string inputString);
|
||||
string TranslateLootFilterScriptToString(LootFilterScript script);
|
||||
}
|
||||
|
||||
internal class LootFilterScriptTranslator : ILootFilterScriptTranslator
|
||||
{
|
||||
private readonly ILootFilterBlockTranslator _blockTranslator;
|
||||
|
||||
public LootFilterScriptTranslator(ILootFilterBlockTranslator blockTranslator)
|
||||
{
|
||||
_blockTranslator = blockTranslator;
|
||||
}
|
||||
|
||||
public LootFilterScript TranslateStringToLootFilterScript(string inputString)
|
||||
{
|
||||
var script = new LootFilterScript();
|
||||
inputString = inputString.Replace("\t", "");
|
||||
var conditionBoundaries = IdentifyBlockBoundaries(inputString);
|
||||
|
||||
var lines = Regex.Split(inputString, "\r\n|\r|\n");
|
||||
|
||||
// Process the script header
|
||||
for (var i = 0; i < conditionBoundaries.First.Value; i++)
|
||||
{
|
||||
if (lines[i].StartsWith("#"))
|
||||
{
|
||||
script.Description += lines[i].Substring(1).Trim(' ') + Environment.NewLine;
|
||||
}
|
||||
}
|
||||
script.Description = script.Description.TrimEnd('\n').TrimEnd('\r');
|
||||
|
||||
// Extract each block from between boundaries and translate it into a LootFilterBlock object
|
||||
// and add that object to the LootFilterBlocks list
|
||||
for (var boundary = conditionBoundaries.First; boundary != null; boundary = boundary.Next)
|
||||
{
|
||||
var begin = boundary.Value;
|
||||
var end = boundary.Next != null ? boundary.Next.Value : lines.Length;
|
||||
var block = new string[end - begin];
|
||||
Array.Copy(lines, begin, block, 0, end - begin);
|
||||
var blockString = string.Join("\r\n", block);
|
||||
script.LootFilterBlocks.Add(_blockTranslator.TranslateStringToLootFilterBlock(blockString));
|
||||
}
|
||||
|
||||
return script;
|
||||
}
|
||||
|
||||
private static LinkedList<int> IdentifyBlockBoundaries(string inputString)
|
||||
{
|
||||
var blockBoundaries = new LinkedList<int>();
|
||||
var previousLine = string.Empty;
|
||||
var currentLine = 0;
|
||||
|
||||
foreach (var line in new LineReader(() => new StringReader(inputString)))
|
||||
{
|
||||
currentLine++;
|
||||
var trimmedLine = line.TrimStart(' ').TrimEnd(' ');
|
||||
if (trimmedLine.StartsWith("Show") || trimmedLine.StartsWith("Hide") ||
|
||||
trimmedLine.StartsWith("# Section:"))
|
||||
{
|
||||
// If the line previous to the Show or Hide line is a comment then we should include that in the block
|
||||
// as it represents the block description.
|
||||
blockBoundaries.AddLast(previousLine.StartsWith("#") && !previousLine.StartsWith("# Section:") ? currentLine - 2 : currentLine - 1);
|
||||
}
|
||||
previousLine = line;
|
||||
}
|
||||
|
||||
return blockBoundaries;
|
||||
}
|
||||
|
||||
public string TranslateLootFilterScriptToString(LootFilterScript script)
|
||||
{
|
||||
var outputString = string.Empty;
|
||||
|
||||
if (!string.IsNullOrEmpty(script.Description))
|
||||
{
|
||||
// ReSharper disable once LoopCanBeConvertedToQuery
|
||||
foreach (var line in new LineReader(() => new StringReader(script.Description)))
|
||||
{
|
||||
outputString += "# " + line + Environment.NewLine;
|
||||
}
|
||||
outputString += Environment.NewLine;
|
||||
}
|
||||
|
||||
// ReSharper disable once LoopCanBeConvertedToQuery
|
||||
foreach (var block in script.LootFilterBlocks)
|
||||
{
|
||||
outputString += _blockTranslator.TranslateLootFilterBlockToString(block) + Environment.NewLine + Environment.NewLine;
|
||||
}
|
||||
|
||||
return outputString;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
using System.Collections.Specialized;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace Filtration.UserControls
|
||||
{
|
||||
public class AutoScrollingListBox : ListBox
|
||||
{
|
||||
protected override void OnItemsChanged(NotifyCollectionChangedEventArgs e)
|
||||
{
|
||||
if (e.NewItems == null) return;
|
||||
|
||||
var newItemCount = e.NewItems.Count;
|
||||
|
||||
if (newItemCount > 0)
|
||||
ScrollIntoView(e.NewItems[newItemCount - 1]);
|
||||
|
||||
base.OnItemsChanged(e);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace Filtration.UserControls
|
||||
{
|
||||
public class CrossButton : Button
|
||||
{
|
||||
static CrossButton()
|
||||
{
|
||||
// Set the style key, so that our control template is used.
|
||||
DefaultStyleKeyProperty.OverrideMetadata(typeof(CrossButton),
|
||||
new FrameworkPropertyMetadata(typeof(CrossButton)));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
<UserControl x:Class="Filtration.UserControls.EditableListBoxControl"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:userControls="clr-namespace:Filtration.UserControls"
|
||||
xmlns:toolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Input.Toolkit"
|
||||
mc:Ignorable="d"
|
||||
d:DataContext="{d:DesignInstance Type=userControls:EditableListBoxControl}">
|
||||
|
||||
<Grid VerticalAlignment="Top">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition></RowDefinition>
|
||||
<RowDefinition></RowDefinition>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"></ColumnDefinition>
|
||||
<ColumnDefinition Width="40"></ColumnDefinition>
|
||||
</Grid.ColumnDefinitions>
|
||||
<ListBox Grid.Row="0"
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="2"
|
||||
ItemsSource="{Binding ItemsSource}"
|
||||
BorderThickness="1"
|
||||
Height="120"
|
||||
VerticalAlignment="Stretch" SelectionMode="Single" x:Name="ControlListBox" BorderBrush="#CCCCCC">
|
||||
<ListBox.Resources>
|
||||
<Style TargetType="ListBoxItem">
|
||||
<!-- Undo the style that we set in the parent LootFilterScriptView to hide the condition selections -->
|
||||
<Style.Resources>
|
||||
<!-- SelectedItem with focus -->
|
||||
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Silver" />
|
||||
<!-- SelectedItem without focus -->
|
||||
<SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="LightGray" />
|
||||
<!-- SelectedItem text foreground -->
|
||||
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}" Color="Black" />
|
||||
</Style.Resources>
|
||||
</Style>
|
||||
</ListBox.Resources>
|
||||
<ListBox.InputBindings>
|
||||
<KeyBinding Key="Delete" Command="{Binding Path=DeleteItemCommand}" CommandParameter="{Binding ElementName=ControlListBox, Path=SelectedValue}" />
|
||||
</ListBox.InputBindings>
|
||||
</ListBox>
|
||||
<toolkit:AutoCompleteBox Grid.Row="1" Grid.Column="0" ItemsSource="{Binding AutoCompleteItemsSource}" FilterMode="Contains" Text="{Binding AddItemText, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}" ></toolkit:AutoCompleteBox>
|
||||
<Button Grid.Row="1" Grid.Column="1" Command="{Binding AddItemCommand}" IsDefault="True">Add</Button>
|
||||
</Grid>
|
||||
</UserControl>
|
|
@ -0,0 +1,111 @@
|
|||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Windows;
|
||||
using Filtration.Annotations;
|
||||
using GalaSoft.MvvmLight.CommandWpf;
|
||||
|
||||
namespace Filtration.UserControls
|
||||
{
|
||||
public partial class EditableListBoxControl : INotifyPropertyChanged
|
||||
{
|
||||
private string _addItemText;
|
||||
|
||||
public EditableListBoxControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
// ReSharper disable once PossibleNullReferenceException
|
||||
(Content as FrameworkElement).DataContext = this;
|
||||
AddItemCommand = new RelayCommand(OnAddItemCommand, () => !string.IsNullOrEmpty(AddItemText));
|
||||
DeleteItemCommand = new RelayCommand<string>(OnDeleteItemCommand);
|
||||
}
|
||||
|
||||
public RelayCommand AddItemCommand { get; private set; }
|
||||
public RelayCommand<string> DeleteItemCommand { get; private set; }
|
||||
|
||||
public static readonly DependencyProperty ItemsSourceProperty = DependencyProperty.Register(
|
||||
"ItemsSource",
|
||||
typeof (ICollection<string>),
|
||||
typeof (EditableListBoxControl),
|
||||
new FrameworkPropertyMetadata(OnItemsSourcePropertyChanged)
|
||||
);
|
||||
|
||||
public static readonly DependencyProperty LabelProperty = DependencyProperty.Register(
|
||||
"Label",
|
||||
typeof (string),
|
||||
typeof (EditableListBoxControl),
|
||||
new FrameworkPropertyMetadata()
|
||||
);
|
||||
|
||||
public static readonly DependencyProperty AutoCompleteItemsSourceProperty = DependencyProperty.Register(
|
||||
"AutoCompleteItemsSource",
|
||||
typeof (IEnumerable<string>),
|
||||
typeof (EditableListBoxControl),
|
||||
new FrameworkPropertyMetadata()
|
||||
);
|
||||
|
||||
public IEnumerable<string> AutoCompleteItemsSource
|
||||
{
|
||||
get { return (IEnumerable<string>) GetValue(AutoCompleteItemsSourceProperty); }
|
||||
set { SetValue(AutoCompleteItemsSourceProperty, value); }
|
||||
}
|
||||
|
||||
public ICollection<string> ItemsSource
|
||||
{
|
||||
get { return (ICollection<string>)GetValue(ItemsSourceProperty); }
|
||||
set { SetValue(ItemsSourceProperty, value); }
|
||||
}
|
||||
|
||||
public string Label
|
||||
{
|
||||
get { return (string)GetValue(LabelProperty); }
|
||||
set { SetValue(LabelProperty, value); }
|
||||
}
|
||||
|
||||
public string AddItemText
|
||||
{
|
||||
get { return _addItemText; }
|
||||
set
|
||||
{
|
||||
_addItemText = value;
|
||||
OnPropertyChanged();
|
||||
AddItemCommand.RaiseCanExecuteChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnAddItemCommand()
|
||||
{
|
||||
if (string.IsNullOrEmpty(AddItemText)) return;
|
||||
|
||||
ItemsSource.Add(AddItemText);
|
||||
AddItemText = string.Empty;
|
||||
}
|
||||
|
||||
private void OnDeleteItemCommand(string itemToDelete)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(itemToDelete))
|
||||
{
|
||||
ItemsSource.Remove(itemToDelete);
|
||||
}
|
||||
}
|
||||
|
||||
private static void OnItemsSourcePropertyChanged(DependencyObject source,
|
||||
DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
var control = source as EditableListBoxControl;
|
||||
if (control == null) return;
|
||||
|
||||
control.OnPropertyChanged("ItemsSource");
|
||||
}
|
||||
|
||||
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,25 @@
|
|||
<UserControl x:Class="Filtration.UserControls.NumericFilterPredicateControl"
|
||||
x:ClassModifier="internal"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:enums="clr-namespace:Filtration.Enums"
|
||||
xmlns:extensions="clr-namespace:Filtration.Extensions"
|
||||
xmlns:userControls="clr-namespace:Filtration.UserControls"
|
||||
mc:Ignorable="d"
|
||||
d:DataContext="{d:DesignInstance Type=userControls:NumericFilterPredicateControl}">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition SharedSizeGroup="NumericFilterPredicateControlComboBox" Width="50" />
|
||||
<ColumnDefinition Width="4" />
|
||||
<ColumnDefinition SharedSizeGroup="NumericFilterPredicateControlUpDown" Width="45" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<ComboBox Grid.Column="0" ItemsSource="{Binding Source={extensions:Enumeration {x:Type enums:FilterPredicateOperator}}}"
|
||||
DisplayMemberPath="Description"
|
||||
SelectedValue="{Binding FilterPredicateOperator}"
|
||||
SelectedValuePath="Value" />
|
||||
<xctk:ShortUpDown Grid.Column="2" Value="{Binding Path=FilterPredicateOperand}" Minimum="{Binding Path=Minimum}" Maximum="{Binding Path=Maximum}" />
|
||||
</Grid>
|
||||
</UserControl>
|
|
@ -0,0 +1,133 @@
|
|||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Windows;
|
||||
using Filtration.Annotations;
|
||||
using Filtration.Enums;
|
||||
using Filtration.Models;
|
||||
|
||||
namespace Filtration.UserControls
|
||||
{
|
||||
internal partial class NumericFilterPredicateControl : INotifyPropertyChanged
|
||||
{
|
||||
public NumericFilterPredicateControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
// ReSharper disable once PossibleNullReferenceException
|
||||
(Content as FrameworkElement).DataContext = this;
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty NumericFilterPredicateProperty = DependencyProperty.Register(
|
||||
"NumericFilterPredicate",
|
||||
typeof (NumericFilterPredicate),
|
||||
typeof (NumericFilterPredicateControl),
|
||||
new FrameworkPropertyMetadata(OnNumericFilterPredicatePropertyChanged));
|
||||
|
||||
public static readonly DependencyProperty TextProperty = DependencyProperty.Register(
|
||||
"Text",
|
||||
typeof (string),
|
||||
typeof (NumericFilterPredicateControl),
|
||||
new FrameworkPropertyMetadata {BindsTwoWayByDefault = true});
|
||||
|
||||
public static readonly DependencyProperty MinimumProperty = DependencyProperty.Register(
|
||||
"Minimum",
|
||||
typeof (int),
|
||||
typeof (NumericFilterPredicateControl),
|
||||
new FrameworkPropertyMetadata {BindsTwoWayByDefault = true});
|
||||
|
||||
public static readonly DependencyProperty MaximumProperty = DependencyProperty.Register(
|
||||
"Maximum",
|
||||
typeof (int),
|
||||
typeof (NumericFilterPredicateControl),
|
||||
new FrameworkPropertyMetadata {BindsTwoWayByDefault = true});
|
||||
|
||||
public NumericFilterPredicate NumericFilterPredicate
|
||||
{
|
||||
get
|
||||
{
|
||||
return (NumericFilterPredicate)GetValue(NumericFilterPredicateProperty);
|
||||
}
|
||||
set
|
||||
{
|
||||
SetValue(NumericFilterPredicateProperty, value);
|
||||
OnPropertyChanged();
|
||||
OnPropertyChanged("FilterPredicateOperator");
|
||||
OnPropertyChanged("FilterPredicateOperand");
|
||||
}
|
||||
}
|
||||
|
||||
public FilterPredicateOperator FilterPredicateOperator
|
||||
{
|
||||
get { return NumericFilterPredicate.PredicateOperator; }
|
||||
set
|
||||
{
|
||||
NumericFilterPredicate.PredicateOperator = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public int FilterPredicateOperand
|
||||
{
|
||||
get { return NumericFilterPredicate.PredicateOperand; }
|
||||
set
|
||||
{
|
||||
NumericFilterPredicate.PredicateOperand = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public string Text
|
||||
{
|
||||
get
|
||||
{
|
||||
return (string)GetValue(TextProperty);
|
||||
}
|
||||
set
|
||||
{
|
||||
SetValue(TextProperty, value);
|
||||
}
|
||||
}
|
||||
|
||||
public int Minimum
|
||||
{
|
||||
get
|
||||
{
|
||||
return (int)GetValue(MinimumProperty);
|
||||
}
|
||||
set
|
||||
{
|
||||
SetValue(MinimumProperty, value);
|
||||
}
|
||||
}
|
||||
|
||||
public int Maximum
|
||||
{
|
||||
get
|
||||
{
|
||||
return (int)GetValue(MaximumProperty);
|
||||
}
|
||||
set
|
||||
{
|
||||
SetValue(MaximumProperty, value);
|
||||
}
|
||||
}
|
||||
|
||||
private static void OnNumericFilterPredicatePropertyChanged(DependencyObject source,
|
||||
DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
var control = source as NumericFilterPredicateControl;
|
||||
if (control == null) return;
|
||||
|
||||
control.OnPropertyChanged("FilterPredicateOperator");
|
||||
control.OnPropertyChanged("FilterPredicateOperand");
|
||||
}
|
||||
|
||||
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,97 @@
|
|||
// Taken from JonSkeet's StackOverflow answer here: http://stackoverflow.com/questions/286533/filestream-streamreader-problem-in-c-sharp/286598#286598
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace Filtration.Utilities
|
||||
{
|
||||
|
||||
public sealed class LineReader : IEnumerable<string>
|
||||
{
|
||||
/// <summary>
|
||||
/// Means of creating a TextReader to read from.
|
||||
/// </summary>
|
||||
private readonly Func<TextReader> _dataSource;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a LineReader from a stream source. The delegate is only
|
||||
/// called when the enumerator is fetched. UTF-8 is used to decode
|
||||
/// the stream into text.
|
||||
/// </summary>
|
||||
/// <param name="streamSource">Data source</param>
|
||||
public LineReader(Func<Stream> streamSource)
|
||||
: this(streamSource, Encoding.UTF8)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a LineReader from a stream source. The delegate is only
|
||||
/// called when the enumerator is fetched.
|
||||
/// </summary>
|
||||
/// <param name="streamSource">Data source</param>
|
||||
/// <param name="encoding">Encoding to use to decode the stream
|
||||
/// into text</param>
|
||||
public LineReader(Func<Stream> streamSource, Encoding encoding)
|
||||
: this(() => new StreamReader(streamSource(), encoding))
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a LineReader from a filename. The file is only opened
|
||||
/// (or even checked for existence) when the enumerator is fetched.
|
||||
/// UTF8 is used to decode the file into text.
|
||||
/// </summary>
|
||||
/// <param name="filename">File to read from</param>
|
||||
public LineReader(string filename)
|
||||
: this(filename, Encoding.UTF8)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a LineReader from a filename. The file is only opened
|
||||
/// (or even checked for existence) when the enumerator is fetched.
|
||||
/// </summary>
|
||||
/// <param name="filename">File to read from</param>
|
||||
/// <param name="encoding">Encoding to use to decode the file
|
||||
/// into text</param>
|
||||
public LineReader(string filename, Encoding encoding)
|
||||
: this(() => new StreamReader(filename, encoding))
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a LineReader from a TextReader source. The delegate
|
||||
/// is only called when the enumerator is fetched
|
||||
/// </summary>
|
||||
/// <param name="dataSource">Data source</param>
|
||||
public LineReader(Func<TextReader> dataSource)
|
||||
{
|
||||
_dataSource = dataSource;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enumerates the data source line by line.
|
||||
/// </summary>
|
||||
public IEnumerator<string> GetEnumerator()
|
||||
{
|
||||
using (TextReader reader = _dataSource())
|
||||
{
|
||||
string line;
|
||||
while ((line = reader.ReadLine()) != null)
|
||||
{
|
||||
yield return line;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enumerates the data source line by line.
|
||||
/// </summary>
|
||||
IEnumerator IEnumerable.GetEnumerator()
|
||||
{
|
||||
return GetEnumerator();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
using System.Runtime.CompilerServices;
|
||||
using Filtration.Annotations;
|
||||
using GalaSoft.MvvmLight;
|
||||
|
||||
namespace Filtration.ViewModels
|
||||
{
|
||||
internal class FiltrationViewModelBase : ViewModelBase
|
||||
{
|
||||
/// This gives us the ReSharper option to transform an autoproperty into a property with change notification
|
||||
/// Also leverages .net 4.5 callermembername attribute
|
||||
[NotifyPropertyChangedInvocator]
|
||||
|
||||
protected override void RaisePropertyChanged([CallerMemberName]string property = "")
|
||||
{
|
||||
base.RaisePropertyChanged(property);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
using System.ComponentModel;
|
||||
using Filtration.Models;
|
||||
using GalaSoft.MvvmLight.CommandWpf;
|
||||
|
||||
namespace Filtration.ViewModels
|
||||
{
|
||||
internal interface ILootFilterBlockViewModel
|
||||
{
|
||||
void Initialise(LootFilterBlock lootFilterBlock);
|
||||
bool IsDirty { get; set; }
|
||||
LootFilterBlock Block { get; }
|
||||
RelayCommand CopyBlockCommand { get; }
|
||||
string BlockDescription { get; set; }
|
||||
event PropertyChangedEventHandler PropertyChanged;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
namespace Filtration.ViewModels
|
||||
{
|
||||
internal interface ILootFilterBlockViewModelFactory
|
||||
{
|
||||
ILootFilterBlockViewModel Create();
|
||||
void Release(ILootFilterBlockViewModel lootFilterBlockViewModel);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using Filtration.Models;
|
||||
|
||||
namespace Filtration.ViewModels
|
||||
{
|
||||
internal interface ILootFilterScriptViewModel
|
||||
{
|
||||
ObservableCollection<ILootFilterBlockViewModel> LootFilterBlockViewModels { get; }
|
||||
LootFilterScript Script { get; }
|
||||
bool IsDirty { get; }
|
||||
string Description { get; set; }
|
||||
string Filename { get; }
|
||||
string DisplayName { get; }
|
||||
string Filepath { get; }
|
||||
void Initialise(LootFilterScript lootFilterScript);
|
||||
void RemoveDirtyFlag();
|
||||
event PropertyChangedEventHandler PropertyChanged;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
namespace Filtration.ViewModels
|
||||
{
|
||||
internal interface ILootFilterScriptViewModelFactory
|
||||
{
|
||||
ILootFilterScriptViewModel Create();
|
||||
void Release(ILootFilterScriptViewModel lootFilterScriptViewModel);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
namespace Filtration.ViewModels
|
||||
{
|
||||
internal interface IMainWindowViewModel
|
||||
{
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue