Compare commits
No commits in common. "gh-pages" and "master" have entirely different histories.
|
@ -0,0 +1,316 @@
|
||||||
|
## Ignore Visual Studio temporary files, build results, and
|
||||||
|
## files generated by popular Visual Studio add-ons.
|
||||||
|
##
|
||||||
|
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
|
||||||
|
|
||||||
|
# User-specific files
|
||||||
|
/.vs/
|
||||||
|
*.suo
|
||||||
|
*.user
|
||||||
|
*.userosscache
|
||||||
|
*.sln.docstates
|
||||||
|
|
||||||
|
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||||
|
*.userprefs
|
||||||
|
|
||||||
|
# Build results
|
||||||
|
[Dd]ebug/
|
||||||
|
[Dd]ebugPublic/
|
||||||
|
[Rr]elease/
|
||||||
|
[Rr]eleases/
|
||||||
|
x64/
|
||||||
|
x86/
|
||||||
|
bld/
|
||||||
|
[Bb]in/
|
||||||
|
[Oo]bj/
|
||||||
|
[Ll]og/
|
||||||
|
|
||||||
|
# Visual Studio 2015/2017 cache/options directory
|
||||||
|
.vs/
|
||||||
|
# Uncomment if you have tasks that create the project's static files in wwwroot
|
||||||
|
#wwwroot/
|
||||||
|
|
||||||
|
# Visual Studio 2017 auto generated files
|
||||||
|
Generated\ Files/
|
||||||
|
|
||||||
|
# MSTest test Results
|
||||||
|
[Tt]est[Rr]esult*/
|
||||||
|
[Bb]uild[Ll]og.*
|
||||||
|
|
||||||
|
# NUNIT
|
||||||
|
*.VisualState.xml
|
||||||
|
TestResult.xml
|
||||||
|
|
||||||
|
# Build Results of an ATL Project
|
||||||
|
[Dd]ebugPS/
|
||||||
|
[Rr]eleasePS/
|
||||||
|
dlldata.c
|
||||||
|
|
||||||
|
# Benchmark Results
|
||||||
|
BenchmarkDotNet.Artifacts/
|
||||||
|
|
||||||
|
# .NET Core
|
||||||
|
project.lock.json
|
||||||
|
project.fragment.lock.json
|
||||||
|
artifacts/
|
||||||
|
**/Properties/launchSettings.json
|
||||||
|
|
||||||
|
# StyleCop
|
||||||
|
StyleCopReport.xml
|
||||||
|
|
||||||
|
# Files built by Visual Studio
|
||||||
|
*_i.c
|
||||||
|
*_p.c
|
||||||
|
*_i.h
|
||||||
|
*.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
|
||||||
|
*.opendb
|
||||||
|
*.opensdf
|
||||||
|
*.sdf
|
||||||
|
*.cachefile
|
||||||
|
*.VC.db
|
||||||
|
*.VC.VC.opendb
|
||||||
|
|
||||||
|
# Visual Studio profiler
|
||||||
|
*.psess
|
||||||
|
*.vsp
|
||||||
|
*.vspx
|
||||||
|
*.sap
|
||||||
|
|
||||||
|
# Visual Studio Trace Files
|
||||||
|
*.e2e
|
||||||
|
|
||||||
|
# TFS 2012 Local Workspace
|
||||||
|
$tf/
|
||||||
|
|
||||||
|
# Guidance Automation Toolkit
|
||||||
|
*.gpState
|
||||||
|
|
||||||
|
# ReSharper is a .NET coding add-in
|
||||||
|
_ReSharper*/
|
||||||
|
*.[Rr]e[Ss]harper
|
||||||
|
*.DotSettings.user
|
||||||
|
|
||||||
|
# JustCode is a .NET coding add-in
|
||||||
|
.JustCode
|
||||||
|
|
||||||
|
# TeamCity is a build add-in
|
||||||
|
_TeamCity*
|
||||||
|
|
||||||
|
# DotCover is a Code Coverage Tool
|
||||||
|
*.dotCover
|
||||||
|
|
||||||
|
# AxoCover is a Code Coverage Tool
|
||||||
|
.axoCover/*
|
||||||
|
!.axoCover/settings.json
|
||||||
|
|
||||||
|
# Visual Studio code coverage results
|
||||||
|
*.coverage
|
||||||
|
*.coveragexml
|
||||||
|
|
||||||
|
# NCrunch
|
||||||
|
_NCrunch_*
|
||||||
|
.*crunch*.local.xml
|
||||||
|
nCrunchTemp_*
|
||||||
|
|
||||||
|
# MightyMoose
|
||||||
|
*.mm.*
|
||||||
|
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
|
||||||
|
# Note: Comment the next line if you want to checkin your web deploy settings,
|
||||||
|
# but database connection strings (with potential passwords) will be unencrypted
|
||||||
|
*.pubxml
|
||||||
|
*.publishproj
|
||||||
|
|
||||||
|
# Microsoft Azure Web App publish settings. Comment the next line if you want to
|
||||||
|
# checkin your Azure Web App publish settings, but sensitive information contained
|
||||||
|
# in these scripts will be unencrypted
|
||||||
|
PublishScripts/
|
||||||
|
|
||||||
|
# NuGet Packages
|
||||||
|
*.nupkg
|
||||||
|
# The packages folder can be ignored because of Package Restore
|
||||||
|
**/[Pp]ackages/*
|
||||||
|
# except build/, which is used as an MSBuild target.
|
||||||
|
!**/[Pp]ackages/build/
|
||||||
|
# Uncomment if necessary however generally it will be regenerated when needed
|
||||||
|
#!**/[Pp]ackages/repositories.config
|
||||||
|
# NuGet v3's project.json files produces more ignorable files
|
||||||
|
*.nuget.props
|
||||||
|
*.nuget.targets
|
||||||
|
|
||||||
|
# Microsoft Azure Build Output
|
||||||
|
csx/
|
||||||
|
*.build.csdef
|
||||||
|
|
||||||
|
# Microsoft Azure Emulator
|
||||||
|
ecf/
|
||||||
|
rcf/
|
||||||
|
|
||||||
|
# Windows Store app package directories and files
|
||||||
|
AppPackages/
|
||||||
|
BundleArtifacts/
|
||||||
|
Package.StoreAssociation.xml
|
||||||
|
_pkginfo.txt
|
||||||
|
*.appx
|
||||||
|
|
||||||
|
# Visual Studio cache files
|
||||||
|
# files ending in .cache can be ignored
|
||||||
|
*.[Cc]ache
|
||||||
|
# but keep track of directories ending in .cache
|
||||||
|
!*.[Cc]ache/
|
||||||
|
|
||||||
|
# Others
|
||||||
|
ClientBin/
|
||||||
|
~$*
|
||||||
|
*~
|
||||||
|
*.dbmdl
|
||||||
|
*.dbproj.schemaview
|
||||||
|
*.jfm
|
||||||
|
*.pfx
|
||||||
|
*.publishsettings
|
||||||
|
orleans.codegen.cs
|
||||||
|
|
||||||
|
# Since there are multiple workflows, uncomment next line to ignore bower_components
|
||||||
|
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
|
||||||
|
#bower_components/
|
||||||
|
|
||||||
|
# RIA/Silverlight projects
|
||||||
|
Generated_Code/
|
||||||
|
|
||||||
|
# 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
|
||||||
|
*.ndf
|
||||||
|
|
||||||
|
# Business Intelligence projects
|
||||||
|
*.rdl.data
|
||||||
|
*.bim.layout
|
||||||
|
*.bim_*.settings
|
||||||
|
|
||||||
|
# Microsoft Fakes
|
||||||
|
FakesAssemblies/
|
||||||
|
|
||||||
|
# GhostDoc plugin setting file
|
||||||
|
*.GhostDoc.xml
|
||||||
|
|
||||||
|
# Node.js Tools for Visual Studio
|
||||||
|
.ntvs_analysis.dat
|
||||||
|
node_modules/
|
||||||
|
|
||||||
|
# TypeScript v1 declaration files
|
||||||
|
typings/
|
||||||
|
|
||||||
|
# Visual Studio 6 build log
|
||||||
|
*.plg
|
||||||
|
|
||||||
|
# Visual Studio 6 workspace options file
|
||||||
|
*.opt
|
||||||
|
|
||||||
|
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
|
||||||
|
*.vbw
|
||||||
|
|
||||||
|
# Visual Studio LightSwitch build output
|
||||||
|
**/*.HTMLClient/GeneratedArtifacts
|
||||||
|
**/*.DesktopClient/GeneratedArtifacts
|
||||||
|
**/*.DesktopClient/ModelManifest.xml
|
||||||
|
**/*.Server/GeneratedArtifacts
|
||||||
|
**/*.Server/ModelManifest.xml
|
||||||
|
_Pvt_Extensions
|
||||||
|
|
||||||
|
# Paket dependency manager
|
||||||
|
.paket/paket.exe
|
||||||
|
paket-files/
|
||||||
|
|
||||||
|
# FAKE - F# Make
|
||||||
|
.fake/
|
||||||
|
|
||||||
|
# JetBrains Rider
|
||||||
|
.idea/
|
||||||
|
*.sln.iml
|
||||||
|
|
||||||
|
# CodeRush
|
||||||
|
.cr/
|
||||||
|
|
||||||
|
# Python Tools for Visual Studio (PTVS)
|
||||||
|
__pycache__/
|
||||||
|
*.pyc
|
||||||
|
|
||||||
|
# Cake - Uncomment if you are using it
|
||||||
|
# tools/**
|
||||||
|
# !tools/packages.config
|
||||||
|
|
||||||
|
# Tabs Studio
|
||||||
|
*.tss
|
||||||
|
|
||||||
|
# Telerik's JustMock configuration file
|
||||||
|
*.jmconfig
|
||||||
|
|
||||||
|
# BizTalk build output
|
||||||
|
*.btp.cs
|
||||||
|
*.btm.cs
|
||||||
|
*.odx.cs
|
||||||
|
*.xsd.cs
|
||||||
|
|
||||||
|
# OpenCover UI analysis results
|
||||||
|
OpenCover/
|
||||||
|
|
||||||
|
# Azure Stream Analytics local run output
|
||||||
|
ASALocalRun/
|
|
@ -0,0 +1,339 @@
|
||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
Version 2, June 1991
|
||||||
|
|
||||||
|
Copyright (C) 1989, 1991 Free Software Foundation, Inc., <http://fsf.org/>
|
||||||
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The licenses for most software are designed to take away your
|
||||||
|
freedom to share and change it. By contrast, the GNU General Public
|
||||||
|
License is intended to guarantee your freedom to share and change free
|
||||||
|
software--to make sure the software is free for all its users. This
|
||||||
|
General Public License applies to most of the Free Software
|
||||||
|
Foundation's software and to any other program whose authors commit to
|
||||||
|
using it. (Some other Free Software Foundation software is covered by
|
||||||
|
the GNU Lesser General Public License instead.) You can apply it to
|
||||||
|
your programs, too.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, not
|
||||||
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
|
have the freedom to distribute copies of free software (and charge for
|
||||||
|
this service if you wish), that you receive source code or can get it
|
||||||
|
if you want it, that you can change the software or use pieces of it
|
||||||
|
in new free programs; and that you know you can do these things.
|
||||||
|
|
||||||
|
To protect your rights, we need to make restrictions that forbid
|
||||||
|
anyone to deny you these rights or to ask you to surrender the rights.
|
||||||
|
These restrictions translate to certain responsibilities for you if you
|
||||||
|
distribute copies of the software, or if you modify it.
|
||||||
|
|
||||||
|
For example, if you distribute copies of such a program, whether
|
||||||
|
gratis or for a fee, you must give the recipients all the rights that
|
||||||
|
you have. You must make sure that they, too, receive or can get the
|
||||||
|
source code. And you must show them these terms so they know their
|
||||||
|
rights.
|
||||||
|
|
||||||
|
We protect your rights with two steps: (1) copyright the software, and
|
||||||
|
(2) offer you this license which gives you legal permission to copy,
|
||||||
|
distribute and/or modify the software.
|
||||||
|
|
||||||
|
Also, for each author's protection and ours, we want to make certain
|
||||||
|
that everyone understands that there is no warranty for this free
|
||||||
|
software. If the software is modified by someone else and passed on, we
|
||||||
|
want its recipients to know that what they have is not the original, so
|
||||||
|
that any problems introduced by others will not reflect on the original
|
||||||
|
authors' reputations.
|
||||||
|
|
||||||
|
Finally, any free program is threatened constantly by software
|
||||||
|
patents. We wish to avoid the danger that redistributors of a free
|
||||||
|
program will individually obtain patent licenses, in effect making the
|
||||||
|
program proprietary. To prevent this, we have made it clear that any
|
||||||
|
patent must be licensed for everyone's free use or not licensed at all.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow.
|
||||||
|
|
||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||||
|
|
||||||
|
0. This License applies to any program or other work which contains
|
||||||
|
a notice placed by the copyright holder saying it may be distributed
|
||||||
|
under the terms of this General Public License. The "Program", below,
|
||||||
|
refers to any such program or work, and a "work based on the Program"
|
||||||
|
means either the Program or any derivative work under copyright law:
|
||||||
|
that is to say, a work containing the Program or a portion of it,
|
||||||
|
either verbatim or with modifications and/or translated into another
|
||||||
|
language. (Hereinafter, translation is included without limitation in
|
||||||
|
the term "modification".) Each licensee is addressed as "you".
|
||||||
|
|
||||||
|
Activities other than copying, distribution and modification are not
|
||||||
|
covered by this License; they are outside its scope. The act of
|
||||||
|
running the Program is not restricted, and the output from the Program
|
||||||
|
is covered only if its contents constitute a work based on the
|
||||||
|
Program (independent of having been made by running the Program).
|
||||||
|
Whether that is true depends on what the Program does.
|
||||||
|
|
||||||
|
1. You may copy and distribute verbatim copies of the Program's
|
||||||
|
source code as you receive it, in any medium, provided that you
|
||||||
|
conspicuously and appropriately publish on each copy an appropriate
|
||||||
|
copyright notice and disclaimer of warranty; keep intact all the
|
||||||
|
notices that refer to this License and to the absence of any warranty;
|
||||||
|
and give any other recipients of the Program a copy of this License
|
||||||
|
along with the Program.
|
||||||
|
|
||||||
|
You may charge a fee for the physical act of transferring a copy, and
|
||||||
|
you may at your option offer warranty protection in exchange for a fee.
|
||||||
|
|
||||||
|
2. You may modify your copy or copies of the Program or any portion
|
||||||
|
of it, thus forming a work based on the Program, and copy and
|
||||||
|
distribute such modifications or work under the terms of Section 1
|
||||||
|
above, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) You must cause the modified files to carry prominent notices
|
||||||
|
stating that you changed the files and the date of any change.
|
||||||
|
|
||||||
|
b) You must cause any work that you distribute or publish, that in
|
||||||
|
whole or in part contains or is derived from the Program or any
|
||||||
|
part thereof, to be licensed as a whole at no charge to all third
|
||||||
|
parties under the terms of this License.
|
||||||
|
|
||||||
|
c) If the modified program normally reads commands interactively
|
||||||
|
when run, you must cause it, when started running for such
|
||||||
|
interactive use in the most ordinary way, to print or display an
|
||||||
|
announcement including an appropriate copyright notice and a
|
||||||
|
notice that there is no warranty (or else, saying that you provide
|
||||||
|
a warranty) and that users may redistribute the program under
|
||||||
|
these conditions, and telling the user how to view a copy of this
|
||||||
|
License. (Exception: if the Program itself is interactive but
|
||||||
|
does not normally print such an announcement, your work based on
|
||||||
|
the Program is not required to print an announcement.)
|
||||||
|
|
||||||
|
These requirements apply to the modified work as a whole. If
|
||||||
|
identifiable sections of that work are not derived from the Program,
|
||||||
|
and can be reasonably considered independent and separate works in
|
||||||
|
themselves, then this License, and its terms, do not apply to those
|
||||||
|
sections when you distribute them as separate works. But when you
|
||||||
|
distribute the same sections as part of a whole which is a work based
|
||||||
|
on the Program, the distribution of the whole must be on the terms of
|
||||||
|
this License, whose permissions for other licensees extend to the
|
||||||
|
entire whole, and thus to each and every part regardless of who wrote it.
|
||||||
|
|
||||||
|
Thus, it is not the intent of this section to claim rights or contest
|
||||||
|
your rights to work written entirely by you; rather, the intent is to
|
||||||
|
exercise the right to control the distribution of derivative or
|
||||||
|
collective works based on the Program.
|
||||||
|
|
||||||
|
In addition, mere aggregation of another work not based on the Program
|
||||||
|
with the Program (or with a work based on the Program) on a volume of
|
||||||
|
a storage or distribution medium does not bring the other work under
|
||||||
|
the scope of this License.
|
||||||
|
|
||||||
|
3. You may copy and distribute the Program (or a work based on it,
|
||||||
|
under Section 2) in object code or executable form under the terms of
|
||||||
|
Sections 1 and 2 above provided that you also do one of the following:
|
||||||
|
|
||||||
|
a) Accompany it with the complete corresponding machine-readable
|
||||||
|
source code, which must be distributed under the terms of Sections
|
||||||
|
1 and 2 above on a medium customarily used for software interchange; or,
|
||||||
|
|
||||||
|
b) Accompany it with a written offer, valid for at least three
|
||||||
|
years, to give any third party, for a charge no more than your
|
||||||
|
cost of physically performing source distribution, a complete
|
||||||
|
machine-readable copy of the corresponding source code, to be
|
||||||
|
distributed under the terms of Sections 1 and 2 above on a medium
|
||||||
|
customarily used for software interchange; or,
|
||||||
|
|
||||||
|
c) Accompany it with the information you received as to the offer
|
||||||
|
to distribute corresponding source code. (This alternative is
|
||||||
|
allowed only for noncommercial distribution and only if you
|
||||||
|
received the program in object code or executable form with such
|
||||||
|
an offer, in accord with Subsection b above.)
|
||||||
|
|
||||||
|
The source code for a work means the preferred form of the work for
|
||||||
|
making modifications to it. For an executable work, complete source
|
||||||
|
code means all the source code for all modules it contains, plus any
|
||||||
|
associated interface definition files, plus the scripts used to
|
||||||
|
control compilation and installation of the executable. However, as a
|
||||||
|
special exception, the source code distributed need not include
|
||||||
|
anything that is normally distributed (in either source or binary
|
||||||
|
form) with the major components (compiler, kernel, and so on) of the
|
||||||
|
operating system on which the executable runs, unless that component
|
||||||
|
itself accompanies the executable.
|
||||||
|
|
||||||
|
If distribution of executable or object code is made by offering
|
||||||
|
access to copy from a designated place, then offering equivalent
|
||||||
|
access to copy the source code from the same place counts as
|
||||||
|
distribution of the source code, even though third parties are not
|
||||||
|
compelled to copy the source along with the object code.
|
||||||
|
|
||||||
|
4. You may not copy, modify, sublicense, or distribute the Program
|
||||||
|
except as expressly provided under this License. Any attempt
|
||||||
|
otherwise to copy, modify, sublicense or distribute the Program is
|
||||||
|
void, and will automatically terminate your rights under this License.
|
||||||
|
However, parties who have received copies, or rights, from you under
|
||||||
|
this License will not have their licenses terminated so long as such
|
||||||
|
parties remain in full compliance.
|
||||||
|
|
||||||
|
5. You are not required to accept this License, since you have not
|
||||||
|
signed it. However, nothing else grants you permission to modify or
|
||||||
|
distribute the Program or its derivative works. These actions are
|
||||||
|
prohibited by law if you do not accept this License. Therefore, by
|
||||||
|
modifying or distributing the Program (or any work based on the
|
||||||
|
Program), you indicate your acceptance of this License to do so, and
|
||||||
|
all its terms and conditions for copying, distributing or modifying
|
||||||
|
the Program or works based on it.
|
||||||
|
|
||||||
|
6. Each time you redistribute the Program (or any work based on the
|
||||||
|
Program), the recipient automatically receives a license from the
|
||||||
|
original licensor to copy, distribute or modify the Program subject to
|
||||||
|
these terms and conditions. You may not impose any further
|
||||||
|
restrictions on the recipients' exercise of the rights granted herein.
|
||||||
|
You are not responsible for enforcing compliance by third parties to
|
||||||
|
this License.
|
||||||
|
|
||||||
|
7. If, as a consequence of a court judgment or allegation of patent
|
||||||
|
infringement or for any other reason (not limited to patent issues),
|
||||||
|
conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot
|
||||||
|
distribute so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you
|
||||||
|
may not distribute the Program at all. For example, if a patent
|
||||||
|
license would not permit royalty-free redistribution of the Program by
|
||||||
|
all those who receive copies directly or indirectly through you, then
|
||||||
|
the only way you could satisfy both it and this License would be to
|
||||||
|
refrain entirely from distribution of the Program.
|
||||||
|
|
||||||
|
If any portion of this section is held invalid or unenforceable under
|
||||||
|
any particular circumstance, the balance of the section is intended to
|
||||||
|
apply and the section as a whole is intended to apply in other
|
||||||
|
circumstances.
|
||||||
|
|
||||||
|
It is not the purpose of this section to induce you to infringe any
|
||||||
|
patents or other property right claims or to contest validity of any
|
||||||
|
such claims; this section has the sole purpose of protecting the
|
||||||
|
integrity of the free software distribution system, which is
|
||||||
|
implemented by public license practices. Many people have made
|
||||||
|
generous contributions to the wide range of software distributed
|
||||||
|
through that system in reliance on consistent application of that
|
||||||
|
system; it is up to the author/donor to decide if he or she is willing
|
||||||
|
to distribute software through any other system and a licensee cannot
|
||||||
|
impose that choice.
|
||||||
|
|
||||||
|
This section is intended to make thoroughly clear what is believed to
|
||||||
|
be a consequence of the rest of this License.
|
||||||
|
|
||||||
|
8. If the distribution and/or use of the Program is restricted in
|
||||||
|
certain countries either by patents or by copyrighted interfaces, the
|
||||||
|
original copyright holder who places the Program under this License
|
||||||
|
may add an explicit geographical distribution limitation excluding
|
||||||
|
those countries, so that distribution is permitted only in or among
|
||||||
|
countries not thus excluded. In such case, this License incorporates
|
||||||
|
the limitation as if written in the body of this License.
|
||||||
|
|
||||||
|
9. The Free Software Foundation may publish revised and/or new versions
|
||||||
|
of the General Public License from time to time. Such new versions will
|
||||||
|
be similar in spirit to the present version, but may differ in detail to
|
||||||
|
address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the Program
|
||||||
|
specifies a version number of this License which applies to it and "any
|
||||||
|
later version", you have the option of following the terms and conditions
|
||||||
|
either of that version or of any later version published by the Free
|
||||||
|
Software Foundation. If the Program does not specify a version number of
|
||||||
|
this License, you may choose any version ever published by the Free Software
|
||||||
|
Foundation.
|
||||||
|
|
||||||
|
10. If you wish to incorporate parts of the Program into other free
|
||||||
|
programs whose distribution conditions are different, write to the author
|
||||||
|
to ask for permission. For software which is copyrighted by the Free
|
||||||
|
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||||
|
make exceptions for this. Our decision will be guided by the two goals
|
||||||
|
of preserving the free status of all derivatives of our free software and
|
||||||
|
of promoting the sharing and reuse of software generally.
|
||||||
|
|
||||||
|
NO WARRANTY
|
||||||
|
|
||||||
|
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||||
|
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||||
|
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||||
|
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||||
|
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||||
|
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||||
|
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||||
|
REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||||
|
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||||
|
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||||
|
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||||
|
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||||
|
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||||
|
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||||
|
POSSIBILITY OF SUCH DAMAGES.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
|
If you develop a new program, and you want it to be of the greatest
|
||||||
|
possible use to the public, the best way to achieve this is to make it
|
||||||
|
free software which everyone can redistribute and change under these terms.
|
||||||
|
|
||||||
|
To do so, attach the following notices to the program. It is safest
|
||||||
|
to attach them to the start of each source file to most effectively
|
||||||
|
convey the exclusion of warranty; and each file should have at least
|
||||||
|
the "copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
{description}
|
||||||
|
Copyright (C) {year} {fullname}
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License along
|
||||||
|
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
If the program is interactive, make it output a short notice like this
|
||||||
|
when it starts in an interactive mode:
|
||||||
|
|
||||||
|
Gnomovision version 69, Copyright (C) year name of author
|
||||||
|
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||||
|
This is free software, and you are welcome to redistribute it
|
||||||
|
under certain conditions; type `show c' for details.
|
||||||
|
|
||||||
|
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||||
|
parts of the General Public License. Of course, the commands you use may
|
||||||
|
be called something other than `show w' and `show c'; they could even be
|
||||||
|
mouse-clicks or menu items--whatever suits your program.
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or your
|
||||||
|
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||||
|
necessary. Here is a sample; alter the names:
|
||||||
|
|
||||||
|
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||||
|
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||||
|
|
||||||
|
{signature of Ty Coon}, 1 April 1989
|
||||||
|
Ty Coon, President of Vice
|
||||||
|
|
||||||
|
This General Public License does not permit incorporating your program into
|
||||||
|
proprietary programs. If your program is a subroutine library, you may
|
||||||
|
consider it more useful to permit linking proprietary applications with the
|
||||||
|
library. If this is what you want to do, use the GNU Lesser General
|
||||||
|
Public License instead of this License.
|
|
@ -0,0 +1,76 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ProjectGuid>{1E42A658-45C4-4DD9-83C5-2A10728DBDFA}</ProjectGuid>
|
||||||
|
<OutputType>Library</OutputType>
|
||||||
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
|
<RootNamespace>Filtration.Common.Tests</RootNamespace>
|
||||||
|
<AssemblyName>Filtration.Common.Tests</AssemblyName>
|
||||||
|
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
||||||
|
<FileAlignment>512</FileAlignment>
|
||||||
|
<TargetFrameworkProfile />
|
||||||
|
<NuGetPackageImportStamp>
|
||||||
|
</NuGetPackageImportStamp>
|
||||||
|
</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="System" />
|
||||||
|
<Reference Include="System.Configuration" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="System.Xml.Linq" />
|
||||||
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
|
<Reference Include="Microsoft.CSharp" />
|
||||||
|
<Reference Include="System.Data" />
|
||||||
|
<Reference Include="System.Xml" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="app.config" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Castle.Core">
|
||||||
|
<Version>4.4.0</Version>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="Moq">
|
||||||
|
<Version>4.10.1</Version>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="NUnit">
|
||||||
|
<Version>3.11.0</Version>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="System.Threading.Tasks.Extensions">
|
||||||
|
<Version>4.5.2</Version>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="System.ValueTuple">
|
||||||
|
<Version>4.5.0</Version>
|
||||||
|
</PackageReference>
|
||||||
|
</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,35 @@
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
// General Information about an assembly is controlled through the following
|
||||||
|
// set of attributes. Change these attribute values to modify the information
|
||||||
|
// associated with an assembly.
|
||||||
|
[assembly: AssemblyTitle("Filtration.Common.Tests")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("Microsoft")]
|
||||||
|
[assembly: AssemblyProduct("Filtration.Common.Tests")]
|
||||||
|
[assembly: AssemblyCopyright("Copyright © Microsoft 2015")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
// Setting ComVisible to false makes the types in this assembly not visible
|
||||||
|
// to COM components. If you need to access a type in this assembly from
|
||||||
|
// COM, set the ComVisible attribute to true on that type.
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||||
|
[assembly: Guid("23ba4e1b-1cb6-47fc-9a8b-6ce61fc3eb32")]
|
||||||
|
|
||||||
|
// Version information for an assembly consists of the following four values:
|
||||||
|
//
|
||||||
|
// Major Version
|
||||||
|
// Minor Version
|
||||||
|
// Build Number
|
||||||
|
// Revision
|
||||||
|
//
|
||||||
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
|
// by using the '*' as shown below:
|
||||||
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
|
[assembly: AssemblyVersion("1.0.0.0")]
|
||||||
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
|
@ -0,0 +1,19 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<configuration>
|
||||||
|
<runtime>
|
||||||
|
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.ValueTuple" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-4.0.4.1" newVersion="4.0.4.1" />
|
||||||
|
</dependentAssembly>
|
||||||
|
</assemblyBinding>
|
||||||
|
</runtime>
|
||||||
|
</configuration>
|
|
@ -0,0 +1,29 @@
|
||||||
|
using System;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.Windows.Data;
|
||||||
|
|
||||||
|
namespace Filtration.Common.Converters
|
||||||
|
{
|
||||||
|
public class BooleanInverterConverter : 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,43 @@
|
||||||
|
using System;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Data;
|
||||||
|
|
||||||
|
namespace Filtration.Common.Converters
|
||||||
|
{
|
||||||
|
public class BooleanVisibilityConverter : IValueConverter
|
||||||
|
{
|
||||||
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
if (value is bool && targetType == typeof (Visibility))
|
||||||
|
{
|
||||||
|
var val = (bool) value;
|
||||||
|
if (val)
|
||||||
|
{
|
||||||
|
return Visibility.Visible;
|
||||||
|
}
|
||||||
|
if (parameter is Visibility)
|
||||||
|
{
|
||||||
|
return parameter;
|
||||||
|
}
|
||||||
|
return Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
if (value != null)
|
||||||
|
{
|
||||||
|
return Visibility.Visible;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (parameter is Visibility)
|
||||||
|
{
|
||||||
|
return parameter;
|
||||||
|
}
|
||||||
|
return Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
|
||||||
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
using System;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Media;
|
||||||
|
|
||||||
|
namespace Filtration.Common.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)
|
||||||
|
{
|
||||||
|
return ((SolidColorBrush) value)?.Color;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,42 @@
|
||||||
|
using System;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Data;
|
||||||
|
|
||||||
|
namespace Filtration.Common.Converters
|
||||||
|
{
|
||||||
|
internal class InverseBooleanVisibilityConverter : IValueConverter
|
||||||
|
{
|
||||||
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
if (value is bool && targetType == typeof (Visibility))
|
||||||
|
{
|
||||||
|
var val = (bool) value;
|
||||||
|
if (val)
|
||||||
|
{
|
||||||
|
return Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
if (parameter is Visibility)
|
||||||
|
{
|
||||||
|
return parameter;
|
||||||
|
}
|
||||||
|
return Visibility.Visible;
|
||||||
|
}
|
||||||
|
if (value != null)
|
||||||
|
{
|
||||||
|
return Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (parameter is Visibility)
|
||||||
|
{
|
||||||
|
return parameter;
|
||||||
|
}
|
||||||
|
return Visibility.Visible;
|
||||||
|
}
|
||||||
|
|
||||||
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
using System;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Data;
|
||||||
|
|
||||||
|
namespace Filtration.Common.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,65 @@
|
||||||
|
using System;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Windows.Markup;
|
||||||
|
|
||||||
|
namespace Filtration.Common.Extensions
|
||||||
|
{
|
||||||
|
public class EnumerationExtension : MarkupExtension
|
||||||
|
{
|
||||||
|
private Type _enumType;
|
||||||
|
|
||||||
|
|
||||||
|
public EnumerationExtension(Type enumType)
|
||||||
|
{
|
||||||
|
if (enumType == null) throw new ArgumentNullException(nameof(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,40 @@
|
||||||
|
// Taken from http://stackoverflow.com/a/11433814/4153185
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Navigation;
|
||||||
|
|
||||||
|
namespace Filtration.Common.Extensions
|
||||||
|
{
|
||||||
|
public static class HyperlinkExtensions
|
||||||
|
{
|
||||||
|
public static bool GetIsExternal(DependencyObject obj)
|
||||||
|
{
|
||||||
|
return (bool)obj.GetValue(IsExternalProperty);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void SetIsExternal(DependencyObject obj, bool value)
|
||||||
|
{
|
||||||
|
obj.SetValue(IsExternalProperty, value);
|
||||||
|
}
|
||||||
|
public static readonly DependencyProperty IsExternalProperty =
|
||||||
|
DependencyProperty.RegisterAttached("IsExternal", typeof(bool), typeof(HyperlinkExtensions), new UIPropertyMetadata(false, OnIsExternalChanged));
|
||||||
|
|
||||||
|
private static void OnIsExternalChanged(object sender, DependencyPropertyChangedEventArgs args)
|
||||||
|
{
|
||||||
|
var hyperlink = sender as Hyperlink;
|
||||||
|
|
||||||
|
if ((bool)args.NewValue)
|
||||||
|
{
|
||||||
|
if (hyperlink != null) hyperlink.RequestNavigate += Hyperlink_RequestNavigate;
|
||||||
|
}
|
||||||
|
else if (hyperlink != null) hyperlink.RequestNavigate -= Hyperlink_RequestNavigate;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void Hyperlink_RequestNavigate(object sender, RequestNavigateEventArgs e)
|
||||||
|
{
|
||||||
|
Process.Start(new ProcessStartInfo(e.Uri.AbsoluteUri));
|
||||||
|
e.Handled = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,107 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ProjectGuid>{8CB44F28-2956-4C2A-9314-72727262EDD4}</ProjectGuid>
|
||||||
|
<OutputType>Library</OutputType>
|
||||||
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
|
<RootNamespace>Filtration.Common</RootNamespace>
|
||||||
|
<AssemblyName>Filtration.Common</AssemblyName>
|
||||||
|
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
||||||
|
<FileAlignment>512</FileAlignment>
|
||||||
|
<TargetFrameworkProfile />
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>bin\Debug\</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\Release\</OutputPath>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="PresentationCore" />
|
||||||
|
<Reference Include="PresentationFramework" />
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Configuration" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="System.Runtime.Remoting" />
|
||||||
|
<Reference Include="System.Web" />
|
||||||
|
<Reference Include="System.Xaml" />
|
||||||
|
<Reference Include="System.Xml.Linq" />
|
||||||
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
|
<Reference Include="Microsoft.CSharp" />
|
||||||
|
<Reference Include="System.Data" />
|
||||||
|
<Reference Include="System.Xml" />
|
||||||
|
<Reference Include="WindowsBase" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="Converters\BooleanInverterConverter.cs" />
|
||||||
|
<Compile Include="Converters\BooleanVisibilityConverter.cs" />
|
||||||
|
<Compile Include="Converters\ColorToSolidColorBrushConverter.cs" />
|
||||||
|
<Compile Include="Converters\InverseBooleanVisibilityConverter.cs" />
|
||||||
|
<Compile Include="Converters\StringToVisibilityConverter.cs" />
|
||||||
|
<Compile Include="Extensions\EnumerationExtension.cs" />
|
||||||
|
<Compile Include="Extensions\HyperlinkExtensions.cs" />
|
||||||
|
<Compile Include="Messages\ThemeClosedMessage.cs" />
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
<Compile Include="Services\FileSystemService.cs" />
|
||||||
|
<Compile Include="Services\MessageBoxService.cs" />
|
||||||
|
<Compile Include="Utilities\LineReader.cs" />
|
||||||
|
<Compile Include="Utilities\PathOfExileColors.cs" />
|
||||||
|
<Compile Include="Utilities\VisualTreeUtility.cs" />
|
||||||
|
<Compile Include="ViewModels\PaneViewModel.cs" />
|
||||||
|
<Compile Include="WindsorInstallers\ServicesInstaller.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="app.config" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\Filtration.ObjectModel\Filtration.ObjectModel.csproj">
|
||||||
|
<Project>{4AAC3BEB-1DC1-483E-9D11-0E9334E80227}</Project>
|
||||||
|
<Name>Filtration.ObjectModel</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Page Include="Styles\SharedResourcesDictionary.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Castle.Core">
|
||||||
|
<Version>4.4.0</Version>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="Castle.Windsor">
|
||||||
|
<Version>5.0.0</Version>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="CommonServiceLocator">
|
||||||
|
<Version>2.0.4</Version>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="Extended.Wpf.Toolkit">
|
||||||
|
<Version>3.5.0</Version>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="MvvmLightLibs">
|
||||||
|
<Version>5.4.1.1</Version>
|
||||||
|
</PackageReference>
|
||||||
|
</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,6 @@
|
||||||
|
namespace Filtration.Common.Messages
|
||||||
|
{
|
||||||
|
class ThemeClosedMessage
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,40 @@
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
// General Information about an assembly is controlled through the following
|
||||||
|
// set of attributes. Change these attribute values to modify the information
|
||||||
|
// associated with an assembly.
|
||||||
|
[assembly: AssemblyTitle("Filtration.Common")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("Microsoft")]
|
||||||
|
[assembly: AssemblyProduct("Filtration.Common")]
|
||||||
|
[assembly: AssemblyCopyright("Copyright © Microsoft 2015")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
// Setting ComVisible to false makes the types in this assembly not visible
|
||||||
|
// to COM components. If you need to access a type in this assembly from
|
||||||
|
// COM, set the ComVisible attribute to true on that type.
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||||
|
[assembly: Guid("36a40512-35b4-489c-8e20-f431b9e92dc1")]
|
||||||
|
|
||||||
|
// Version information for an assembly consists of the following four values:
|
||||||
|
//
|
||||||
|
// Major Version
|
||||||
|
// Minor Version
|
||||||
|
// Build Number
|
||||||
|
// Revision
|
||||||
|
//
|
||||||
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
|
// by using the '*' as shown below:
|
||||||
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
|
[assembly: AssemblyVersion("1.0.0.0")]
|
||||||
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||||
|
|
||||||
|
[assembly: InternalsVisibleTo("Filtration.Tests")]
|
||||||
|
[assembly: InternalsVisibleTo("Filtration.Common.Tests")]
|
||||||
|
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")]
|
|
@ -0,0 +1,37 @@
|
||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Filtration.Common.Services
|
||||||
|
{
|
||||||
|
public 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, Encoding.UTF8);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool DirectoryExists(string directoryPath)
|
||||||
|
{
|
||||||
|
return Directory.Exists(directoryPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
public string GetUserProfilePath()
|
||||||
|
{
|
||||||
|
return Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
namespace Filtration.Common.Services
|
||||||
|
{
|
||||||
|
public interface IMessageBoxService
|
||||||
|
{
|
||||||
|
MessageBoxResult Show(string caption, string message, MessageBoxButton buttons, MessageBoxImage image);
|
||||||
|
}
|
||||||
|
|
||||||
|
public class MessageBoxService : IMessageBoxService
|
||||||
|
{
|
||||||
|
public MessageBoxResult Show(string caption, string message, MessageBoxButton buttons, MessageBoxImage image)
|
||||||
|
{
|
||||||
|
return MessageBox.Show(message, caption, buttons, image);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,49 @@
|
||||||
|
<ResourceDictionary 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:converters="clr-namespace:Filtration.Common.Converters"
|
||||||
|
mc:Ignorable="d" >
|
||||||
|
<ResourceDictionary.MergedDictionaries>
|
||||||
|
<ResourceDictionary>
|
||||||
|
<Style x:Key="PathOfExileFont">
|
||||||
|
<Setter Property="TextElement.FontFamily" Value="pack://application:,,,/resources/#Fontin SmallCaps" />
|
||||||
|
</Style>
|
||||||
|
<Style x:Key="ChromelessToggleButton" TargetType="{x:Type ToggleButton}">
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="ToggleButton">
|
||||||
|
<Border BorderThickness="0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
|
||||||
|
<ContentPresenter/>
|
||||||
|
</Border>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
<Style x:Key="ChromelessButton" TargetType="{x:Type Button}">
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="Button">
|
||||||
|
<Border BorderThickness="0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
|
||||||
|
<ContentPresenter/>
|
||||||
|
</Border>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
<Style TargetType="{x:Type Border}" x:Key="BlockItemBorder">
|
||||||
|
<Setter Property="BorderThickness" Value="1" />
|
||||||
|
<Setter Property="BorderBrush" Value="Black" />
|
||||||
|
<Setter Property="CornerRadius" Value="3" />
|
||||||
|
<Setter Property="Margin" Value="0,0,5,5" />
|
||||||
|
</Style>
|
||||||
|
<converters:StringToVisibilityConverter x:Key="StringToVisibilityConverter" />
|
||||||
|
<converters:BooleanInverterConverter x:Key="BoolInverterConverter" />
|
||||||
|
<converters:ColorToSolidColorBrushConverter x:Key="ColorToSolidColorBrushConverter" />
|
||||||
|
<converters:BooleanVisibilityConverter x:Key="BooleanVisibilityConverter" />
|
||||||
|
<converters:InverseBooleanVisibilityConverter x:Key="InverseBooleanVisibilityConverter" />
|
||||||
|
|
||||||
|
|
||||||
|
</ResourceDictionary>
|
||||||
|
</ResourceDictionary.MergedDictionaries>
|
||||||
|
</ResourceDictionary>
|
|
@ -0,0 +1,105 @@
|
||||||
|
// 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.Diagnostics;
|
||||||
|
using System.IO;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Filtration.Common.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>
|
||||||
|
[DebuggerStepThrough]
|
||||||
|
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>
|
||||||
|
[DebuggerStepThrough]
|
||||||
|
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>
|
||||||
|
[DebuggerStepThrough]
|
||||||
|
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>
|
||||||
|
[DebuggerStepThrough]
|
||||||
|
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>
|
||||||
|
[DebuggerStepThrough]
|
||||||
|
public LineReader(Func<TextReader> dataSource)
|
||||||
|
{
|
||||||
|
_dataSource = dataSource;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Enumerates the data source line by line.
|
||||||
|
/// </summary>
|
||||||
|
[DebuggerStepThrough]
|
||||||
|
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>
|
||||||
|
[DebuggerStepThrough]
|
||||||
|
IEnumerator IEnumerable.GetEnumerator()
|
||||||
|
{
|
||||||
|
return GetEnumerator();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,48 @@
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using Xceed.Wpf.Toolkit;
|
||||||
|
|
||||||
|
namespace Filtration.Common.Utilities
|
||||||
|
{
|
||||||
|
public static class PathOfExileColors
|
||||||
|
{
|
||||||
|
static PathOfExileColors()
|
||||||
|
{
|
||||||
|
DefaultColors = new ObservableCollection<ColorItem>
|
||||||
|
{
|
||||||
|
new ColorItem(new Color {A = 240, R=127, G = 127, B = 127}, "Default"),
|
||||||
|
new ColorItem(new Color {A = 240, R=255, G = 255, B = 255}, "Value Default"),
|
||||||
|
new ColorItem(new Color {A = 240, R=255, G = 192, B = 203}, "Pink"),
|
||||||
|
new ColorItem(new Color {A = 240, R=30, G = 144, B = 255}, "Dodger Blue"),
|
||||||
|
new ColorItem(new Color {A = 240, R=150, G = 0, B = 0}, "Fire"),
|
||||||
|
new ColorItem(new Color {A = 240, R=54, G = 100, B = 146}, "Cold"),
|
||||||
|
new ColorItem(new Color {A = 240, R=255, G = 215, B = 0}, "Lightning"),
|
||||||
|
new ColorItem(new Color {A = 240, R=208, G = 32, B = 144}, "Chaos"),
|
||||||
|
new ColorItem(new Color {A = 240, R=136, G = 136, B = 255}, "Augmented"),
|
||||||
|
new ColorItem(new Color {A = 240, R=184, G = 218, B = 242}, "Crafted"),
|
||||||
|
new ColorItem(new Color {A = 240, R=210, G = 0, B = 0}, "Unmet"),
|
||||||
|
new ColorItem(new Color {A = 240, R=175, G = 96, B = 37}, "Unique Item"),
|
||||||
|
new ColorItem(new Color {A = 240, R=255, G = 255, B = 119}, "Rare Item"),
|
||||||
|
new ColorItem(new Color {A = 240, R=136, G = 136, B = 255}, "Magic Item"),
|
||||||
|
new ColorItem(new Color {A = 240, R=200, G = 200, B = 200}, "White Item"),
|
||||||
|
new ColorItem(new Color {A = 240, R=27, G = 162, B = 155}, "Gem Item"),
|
||||||
|
new ColorItem(new Color {A = 240, R=170, G = 158, B = 130}, "Currency Item"),
|
||||||
|
new ColorItem(new Color {A = 240, R=74, G = 230, B = 58}, "Quest Item"),
|
||||||
|
new ColorItem(new Color {A = 240, R=255, G = 200, B = 0}, "Nemesis Mod"),
|
||||||
|
new ColorItem(new Color {A = 220, R = 255, G = 40, B = 0}, "Nemesis Mod Outline"),
|
||||||
|
new ColorItem(new Color {A = 240, R=231, G = 180, B = 120}, "Title"),
|
||||||
|
new ColorItem(new Color {A = 240, R=210, G = 0, B = 0}, "Corrupted"),
|
||||||
|
new ColorItem(new Color {A = 240, R=170, G = 158, B = 130}, "Favour"),
|
||||||
|
new ColorItem(new Color {A = 240, R=180, G = 96, B = 0}, "Supporter Pack New Item"),
|
||||||
|
new ColorItem(new Color {A = 240, R=163, G = 141, B = 109}, "Supporter Pack Item"),
|
||||||
|
new ColorItem(new Color {A = 240, R=210, G = 0, B = 220}, "Bloodline Mod"),
|
||||||
|
new ColorItem(new Color {A = 200, R = 74, G = 0, B = 160}, "Bloodline Mod Outline"),
|
||||||
|
new ColorItem(new Color {A = 240, R=50, G = 230, B = 100}, "Torment Mod"),
|
||||||
|
new ColorItem(new Color {A = 200, R = 0, G = 100, B = 150}, "Torment Mod Outline"),
|
||||||
|
new ColorItem(new Color {A = 240, R=210, G = 0, B = 0}, "Can't Trade or Modify")
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ObservableCollection<ColorItem> DefaultColors { get; private set; }
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Media;
|
||||||
|
|
||||||
|
namespace Filtration.Common.Utilities
|
||||||
|
{
|
||||||
|
public class VisualTreeUtility
|
||||||
|
{
|
||||||
|
public static T FindParent<T>(DependencyObject child)
|
||||||
|
where T : DependencyObject
|
||||||
|
{
|
||||||
|
//get parent item
|
||||||
|
var parentObject = VisualTreeHelper.GetParent(child);
|
||||||
|
|
||||||
|
//we've reached the end of the tree
|
||||||
|
if (parentObject == null) return null;
|
||||||
|
|
||||||
|
//check if the parent matches the type we're looking for
|
||||||
|
if (parentObject is T parent)
|
||||||
|
{
|
||||||
|
return parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
return FindParent<T>(parentObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,66 @@
|
||||||
|
using System.Windows.Media;
|
||||||
|
using GalaSoft.MvvmLight;
|
||||||
|
|
||||||
|
namespace Filtration.Common.ViewModels
|
||||||
|
{
|
||||||
|
public class PaneViewModel : ViewModelBase
|
||||||
|
{
|
||||||
|
private string _title;
|
||||||
|
public string Title
|
||||||
|
{
|
||||||
|
get { return _title; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (_title != value)
|
||||||
|
{
|
||||||
|
_title = value;
|
||||||
|
RaisePropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ImageSource IconSource { get; protected set; }
|
||||||
|
|
||||||
|
private string _contentId;
|
||||||
|
public string ContentId
|
||||||
|
{
|
||||||
|
get { return _contentId; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (_contentId != value)
|
||||||
|
{
|
||||||
|
_contentId = value;
|
||||||
|
RaisePropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool _isSelected;
|
||||||
|
public bool IsSelected
|
||||||
|
{
|
||||||
|
get { return _isSelected; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (_isSelected != value)
|
||||||
|
{
|
||||||
|
_isSelected = value;
|
||||||
|
RaisePropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool _isActive;
|
||||||
|
public bool IsActive
|
||||||
|
{
|
||||||
|
get { return _isActive; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (_isActive != value)
|
||||||
|
{
|
||||||
|
_isActive = value;
|
||||||
|
RaisePropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
using Castle.MicroKernel.Registration;
|
||||||
|
using Castle.MicroKernel.SubSystems.Configuration;
|
||||||
|
using Castle.Windsor;
|
||||||
|
using Filtration.Common.Services;
|
||||||
|
|
||||||
|
namespace Filtration.Common.WindsorInstallers
|
||||||
|
{
|
||||||
|
public class ServicesInstaller :IWindsorInstaller
|
||||||
|
{
|
||||||
|
public void Install(IWindsorContainer container, IConfigurationStore store)
|
||||||
|
{
|
||||||
|
container.Register(
|
||||||
|
Component.For<IFileSystemService>()
|
||||||
|
.ImplementedBy<FileSystemService>()
|
||||||
|
.LifeStyle.Singleton);
|
||||||
|
|
||||||
|
container.Register(
|
||||||
|
Component.For<IMessageBoxService>()
|
||||||
|
.ImplementedBy<MessageBoxService>()
|
||||||
|
.LifeStyle.Singleton);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<configuration>
|
||||||
|
<runtime>
|
||||||
|
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="CommonServiceLocator" publicKeyToken="489b6accfaf20ef0" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-2.0.4.0" newVersion="2.0.4.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
</assemblyBinding>
|
||||||
|
</runtime>
|
||||||
|
</configuration>
|
|
@ -0,0 +1,68 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ProjectGuid>{0F333344-7695-47B2-B0E6-172E4DE74819}</ProjectGuid>
|
||||||
|
<OutputType>Library</OutputType>
|
||||||
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
|
<RootNamespace>Filtration.Interface</RootNamespace>
|
||||||
|
<AssemblyName>Filtration.Interface</AssemblyName>
|
||||||
|
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
||||||
|
<FileAlignment>512</FileAlignment>
|
||||||
|
<TargetFrameworkProfile />
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>bin\Debug\</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\Release\</OutputPath>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="PresentationCore" />
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="System.Xml.Linq" />
|
||||||
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
|
<Reference Include="Microsoft.CSharp" />
|
||||||
|
<Reference Include="System.Data" />
|
||||||
|
<Reference Include="System.Xml" />
|
||||||
|
<Reference Include="WindowsBase" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="IDocument.cs" />
|
||||||
|
<Compile Include="IEditableDocument.cs" />
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="app.config" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="CommonServiceLocator">
|
||||||
|
<Version>2.0.4</Version>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="MvvmLightLibs">
|
||||||
|
<Version>5.4.1.1</Version>
|
||||||
|
</PackageReference>
|
||||||
|
</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,14 @@
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using GalaSoft.MvvmLight.CommandWpf;
|
||||||
|
|
||||||
|
namespace Filtration.Interface
|
||||||
|
{
|
||||||
|
public interface IDocument
|
||||||
|
{
|
||||||
|
bool IsScript { get; }
|
||||||
|
bool IsTheme { get; }
|
||||||
|
Task<bool> Close();
|
||||||
|
RelayCommand CloseCommand { get; }
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Filtration.Interface
|
||||||
|
{
|
||||||
|
public interface IEditableDocument : IDocument
|
||||||
|
{
|
||||||
|
bool IsDirty { get; }
|
||||||
|
Task SaveAsync();
|
||||||
|
Task SaveAsAsync();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,35 @@
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
// General Information about an assembly is controlled through the following
|
||||||
|
// set of attributes. Change these attribute values to modify the information
|
||||||
|
// associated with an assembly.
|
||||||
|
[assembly: AssemblyTitle("Filtration.Interface")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("Microsoft")]
|
||||||
|
[assembly: AssemblyProduct("Filtration.Interface")]
|
||||||
|
[assembly: AssemblyCopyright("Copyright © Microsoft 2015")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
// Setting ComVisible to false makes the types in this assembly not visible
|
||||||
|
// to COM components. If you need to access a type in this assembly from
|
||||||
|
// COM, set the ComVisible attribute to true on that type.
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||||
|
[assembly: Guid("f21659a3-839a-41ca-97b9-78cc6f6af353")]
|
||||||
|
|
||||||
|
// Version information for an assembly consists of the following four values:
|
||||||
|
//
|
||||||
|
// Major Version
|
||||||
|
// Minor Version
|
||||||
|
// Build Number
|
||||||
|
// Revision
|
||||||
|
//
|
||||||
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
|
// by using the '*' as shown below:
|
||||||
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
|
[assembly: AssemblyVersion("1.0.0.0")]
|
||||||
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
|
@ -0,0 +1,11 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<configuration>
|
||||||
|
<runtime>
|
||||||
|
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="CommonServiceLocator" publicKeyToken="489b6accfaf20ef0" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-2.0.4.0" newVersion="2.0.4.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
</assemblyBinding>
|
||||||
|
</runtime>
|
||||||
|
</configuration>
|
|
@ -0,0 +1,34 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<configuration>
|
||||||
|
<configSections>
|
||||||
|
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
|
||||||
|
|
||||||
|
</configSections>
|
||||||
|
<entityFramework>
|
||||||
|
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
|
||||||
|
<parameters>
|
||||||
|
<parameter value="mssqllocaldb" />
|
||||||
|
</parameters>
|
||||||
|
</defaultConnectionFactory>
|
||||||
|
<providers>
|
||||||
|
<provider invariantName="System.Data.SQLite" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" />
|
||||||
|
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
|
||||||
|
<provider invariantName="System.Data.SQLite.EF6" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" />
|
||||||
|
</providers>
|
||||||
|
</entityFramework>
|
||||||
|
<startup>
|
||||||
|
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
|
||||||
|
</startup>
|
||||||
|
<connectionStrings>
|
||||||
|
<add name="FiltrationDbContext" connectionString="data source="D:\C# Projects\Filtration\Filtration.db"" providerName="System.Data.SQLite.EF6" />
|
||||||
|
</connectionStrings>
|
||||||
|
|
||||||
|
<runtime>
|
||||||
|
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="CommonServiceLocator" publicKeyToken="489b6accfaf20ef0" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-2.0.4.0" newVersion="2.0.4.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
</assemblyBinding>
|
||||||
|
</runtime>
|
||||||
|
</configuration>
|
|
@ -0,0 +1,111 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ProjectGuid>{7A5720DE-A41B-47EA-AAAB-7C5608FF0C1F}</ProjectGuid>
|
||||||
|
<OutputType>Library</OutputType>
|
||||||
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
|
<RootNamespace>Filtration.ItemFilterPreview.Data.Tests</RootNamespace>
|
||||||
|
<AssemblyName>Filtration.ItemFilterPreview.Data.Tests</AssemblyName>
|
||||||
|
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
||||||
|
<FileAlignment>512</FileAlignment>
|
||||||
|
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||||
|
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
|
||||||
|
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||||
|
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
|
||||||
|
<IsCodedUITest>False</IsCodedUITest>
|
||||||
|
<TestProjectType>UnitTest</TestProjectType>
|
||||||
|
<TargetFrameworkProfile />
|
||||||
|
<NuGetPackageImportStamp>
|
||||||
|
</NuGetPackageImportStamp>
|
||||||
|
</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="System" />
|
||||||
|
<Reference Include="System.ComponentModel.DataAnnotations" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Choose>
|
||||||
|
<When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'">
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
|
||||||
|
</ItemGroup>
|
||||||
|
</When>
|
||||||
|
<Otherwise>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework" />
|
||||||
|
</ItemGroup>
|
||||||
|
</Otherwise>
|
||||||
|
</Choose>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
<Compile Include="Repositories\TestItemSetRepository.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="App.config" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\Filtration.ItemFilterPreview.Data\Filtration.ItemFilterPreview.Data.csproj">
|
||||||
|
<Project>{855b38cc-eef2-471d-bbbc-eb3e2ff3d387}</Project>
|
||||||
|
<Name>Filtration.ItemFilterPreview.Data</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\Filtration.ObjectModel\Filtration.ObjectModel.csproj">
|
||||||
|
<Project>{4aac3beb-1dc1-483e-9d11-0e9334e80227}</Project>
|
||||||
|
<Name>Filtration.ObjectModel</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="NUnit">
|
||||||
|
<Version>3.11.0</Version>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="System.Data.SQLite">
|
||||||
|
<Version>1.0.109.2</Version>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="System.Data.SQLite.Core">
|
||||||
|
<Version>1.0.109.2</Version>
|
||||||
|
</PackageReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<Choose>
|
||||||
|
<When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'">
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="Microsoft.VisualStudio.QualityTools.CodedUITestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Extension, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Microsoft.VisualStudio.TestTools.UITesting, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference>
|
||||||
|
</ItemGroup>
|
||||||
|
</When>
|
||||||
|
</Choose>
|
||||||
|
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
|
||||||
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
|
<Target Name="BeforeBuild">
|
||||||
|
</Target>
|
||||||
|
<Target Name="AfterBuild">
|
||||||
|
</Target>
|
||||||
|
-->
|
||||||
|
</Project>
|
|
@ -0,0 +1,36 @@
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
// General Information about an assembly is controlled through the following
|
||||||
|
// set of attributes. Change these attribute values to modify the information
|
||||||
|
// associated with an assembly.
|
||||||
|
[assembly: AssemblyTitle("Filtration.ItemFilterPreview.Data.Tests")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("")]
|
||||||
|
[assembly: AssemblyProduct("Filtration.ItemFilterPreview.Data.Tests")]
|
||||||
|
[assembly: AssemblyCopyright("Copyright © 2016")]
|
||||||
|
[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("7a5720de-a41b-47ea-aaab-7c5608ff0c1f")]
|
||||||
|
|
||||||
|
// 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,55 @@
|
||||||
|
using System.Linq;
|
||||||
|
using Filtration.ItemFilterPreview.Data.Repositories;
|
||||||
|
using Filtration.ObjectModel;
|
||||||
|
using Filtration.ObjectModel.Enums;
|
||||||
|
using NUnit.Framework;
|
||||||
|
|
||||||
|
namespace Filtration.ItemFilterPreview.Data.Tests.Repositories
|
||||||
|
{
|
||||||
|
[Ignore("integration test")]
|
||||||
|
[TestFixture]
|
||||||
|
public class TestItemSetRepository
|
||||||
|
{
|
||||||
|
[Test]
|
||||||
|
public void All_ReturnsAllItemSets()
|
||||||
|
{
|
||||||
|
using (var repository = new ItemSetRepository())
|
||||||
|
{
|
||||||
|
var result = repository.All.ToList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void AddItemToItemSet()
|
||||||
|
{
|
||||||
|
ItemSet fetchedItemSet;
|
||||||
|
using (var repository = new ItemSetRepository())
|
||||||
|
{
|
||||||
|
fetchedItemSet = repository.Find(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
var newItem = new Item
|
||||||
|
{
|
||||||
|
BaseType = "Test Base",
|
||||||
|
Description = "Test Item Supreme",
|
||||||
|
DropLevel = 75,
|
||||||
|
Height = 3,
|
||||||
|
Width = 2,
|
||||||
|
ItemClass = "Super Class",
|
||||||
|
ItemRarity = ItemRarity.Rare,
|
||||||
|
ItemLevel = 50,
|
||||||
|
ItemSet = fetchedItemSet,
|
||||||
|
ItemSetId = fetchedItemSet.Id
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
fetchedItemSet.Items.Add(newItem);
|
||||||
|
|
||||||
|
using (var repository = new ItemSetRepository())
|
||||||
|
{
|
||||||
|
repository.InsertOrUpdate(fetchedItemSet);
|
||||||
|
repository.Save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<configuration>
|
||||||
|
<configSections>
|
||||||
|
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
|
||||||
|
|
||||||
|
</configSections>
|
||||||
|
<entityFramework>
|
||||||
|
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
|
||||||
|
<parameters>
|
||||||
|
<parameter value="mssqllocaldb" />
|
||||||
|
</parameters>
|
||||||
|
</defaultConnectionFactory>
|
||||||
|
<providers>
|
||||||
|
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
|
||||||
|
<provider invariantName="System.Data.SQLite.EF6" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" />
|
||||||
|
</providers>
|
||||||
|
</entityFramework>
|
||||||
|
<startup>
|
||||||
|
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
|
||||||
|
</startup>
|
||||||
|
<connectionStrings>
|
||||||
|
<add name="FiltrationDbContext" connectionString="data source="D:\C# Projects\Filtration\Filtration.db"" providerName="System.Data.SQLite.EF6" />
|
||||||
|
</connectionStrings>
|
||||||
|
|
||||||
|
<runtime>
|
||||||
|
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="CommonServiceLocator" publicKeyToken="489b6accfaf20ef0" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-2.0.4.0" newVersion="2.0.4.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
</assemblyBinding>
|
||||||
|
</runtime>
|
||||||
|
</configuration>
|
|
@ -0,0 +1,47 @@
|
||||||
|
using System;
|
||||||
|
using System.Data.Entity;
|
||||||
|
using Filtration.ObjectModel;
|
||||||
|
|
||||||
|
namespace Filtration.ItemFilterPreview.Data.DataContexts
|
||||||
|
{
|
||||||
|
public class FiltrationDbContext : DbContext
|
||||||
|
{
|
||||||
|
public FiltrationDbContext() : base("name=FiltrationDbContext")
|
||||||
|
{
|
||||||
|
// Disable database initializer
|
||||||
|
Database.SetInitializer<FiltrationDbContext>(null);
|
||||||
|
Database.Log = Console.WriteLine;
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual DbSet<Item> Items { get; set; }
|
||||||
|
public virtual DbSet<ItemSet> ItemSets { get; set; }
|
||||||
|
|
||||||
|
protected override void OnModelCreating(DbModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
modelBuilder.Entity<Item>()
|
||||||
|
.Property(e => e.Description)
|
||||||
|
.IsUnicode(false);
|
||||||
|
|
||||||
|
modelBuilder.Entity<Item>()
|
||||||
|
.Property(e => e.BaseType)
|
||||||
|
.IsUnicode(false);
|
||||||
|
|
||||||
|
modelBuilder.Entity<Item>()
|
||||||
|
.Property(e => e.ItemClass)
|
||||||
|
.IsUnicode(false);
|
||||||
|
|
||||||
|
modelBuilder.Entity<Item>()
|
||||||
|
.Property(e => e.Sockets)
|
||||||
|
.IsUnicode(false);
|
||||||
|
|
||||||
|
modelBuilder.Entity<ItemSet>()
|
||||||
|
.Property(e => e.Name)
|
||||||
|
.IsUnicode(false);
|
||||||
|
|
||||||
|
modelBuilder.Entity<ItemSet>()
|
||||||
|
.HasMany(e => e.Items)
|
||||||
|
.WithRequired(e => e.ItemSet)
|
||||||
|
.WillCascadeOnDelete(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,79 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="14.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>{855B38CC-EEF2-471D-BBBC-EB3E2FF3D387}</ProjectGuid>
|
||||||
|
<OutputType>Library</OutputType>
|
||||||
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
|
<RootNamespace>Filtration.ItemFilterPreview.Data</RootNamespace>
|
||||||
|
<AssemblyName>Filtration.ItemFilterPreview.Data</AssemblyName>
|
||||||
|
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
||||||
|
<FileAlignment>512</FileAlignment>
|
||||||
|
<TargetFrameworkProfile />
|
||||||
|
<NuGetPackageImportStamp>
|
||||||
|
</NuGetPackageImportStamp>
|
||||||
|
</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="System" />
|
||||||
|
<Reference Include="System.ComponentModel.DataAnnotations" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="System.Runtime.Serialization" />
|
||||||
|
<Reference Include="System.Security" />
|
||||||
|
<Reference Include="System.Xml.Linq" />
|
||||||
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
|
<Reference Include="Microsoft.CSharp" />
|
||||||
|
<Reference Include="System.Data" />
|
||||||
|
<Reference Include="System.Net.Http" />
|
||||||
|
<Reference Include="System.Xml" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="DataContexts\FiltrationDbContext.cs" />
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
<Compile Include="Repositories\IEntityRepository.cs" />
|
||||||
|
<Compile Include="Repositories\ItemSetRepository.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="App.config" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\Filtration.ObjectModel\Filtration.ObjectModel.csproj">
|
||||||
|
<Project>{4aac3beb-1dc1-483e-9d11-0e9334e80227}</Project>
|
||||||
|
<Name>Filtration.ObjectModel</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="System.Data.SQLite">
|
||||||
|
<Version>1.0.109.2</Version>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="System.Data.SQLite.Core">
|
||||||
|
<Version>1.0.109.2</Version>
|
||||||
|
</PackageReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
|
<Target Name="BeforeBuild">
|
||||||
|
</Target>
|
||||||
|
<Target Name="AfterBuild">
|
||||||
|
</Target>
|
||||||
|
-->
|
||||||
|
</Project>
|
|
@ -0,0 +1,36 @@
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
// General Information about an assembly is controlled through the following
|
||||||
|
// set of attributes. Change these attribute values to modify the information
|
||||||
|
// associated with an assembly.
|
||||||
|
[assembly: AssemblyTitle("Filtration.ItemFilterPreview.Data")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("")]
|
||||||
|
[assembly: AssemblyProduct("Filtration.ItemFilterPreview.Data")]
|
||||||
|
[assembly: AssemblyCopyright("Copyright © 2016")]
|
||||||
|
[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("855b38cc-eef2-471d-bbbc-eb3e2ff3d387")]
|
||||||
|
|
||||||
|
// 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,16 @@
|
||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Linq.Expressions;
|
||||||
|
|
||||||
|
namespace Filtration.ItemFilterPreview.Data.Repositories
|
||||||
|
{
|
||||||
|
public interface IEntityRepository<T> : IDisposable
|
||||||
|
{
|
||||||
|
IQueryable<T> All { get; }
|
||||||
|
IQueryable<T> AllIncluding(params Expression<Func<T, object>>[] includeProperties);
|
||||||
|
T Find(int id);
|
||||||
|
void InsertOrUpdate(T itemSet);
|
||||||
|
void Delete(int id);
|
||||||
|
void Save();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,63 @@
|
||||||
|
using System;
|
||||||
|
using System.Data.Entity;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Linq.Expressions;
|
||||||
|
using Filtration.ItemFilterPreview.Data.DataContexts;
|
||||||
|
using Filtration.ObjectModel;
|
||||||
|
|
||||||
|
namespace Filtration.ItemFilterPreview.Data.Repositories
|
||||||
|
{
|
||||||
|
public class ItemSetRepository : IEntityRepository<ItemSet>
|
||||||
|
{
|
||||||
|
FiltrationDbContext _context = new FiltrationDbContext();
|
||||||
|
|
||||||
|
|
||||||
|
public IQueryable<ItemSet> All => _context.ItemSets;
|
||||||
|
|
||||||
|
public IQueryable<ItemSet> AllIncluding(params Expression<Func<ItemSet, object>>[] includeProperties)
|
||||||
|
{
|
||||||
|
IQueryable<ItemSet> query = _context.ItemSets;
|
||||||
|
foreach (var includeProperty in includeProperties)
|
||||||
|
{
|
||||||
|
query = query.Include(includeProperty);
|
||||||
|
}
|
||||||
|
|
||||||
|
return query;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ItemSet Find(int id)
|
||||||
|
{
|
||||||
|
return _context.ItemSets.Find(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void InsertOrUpdate(ItemSet itemSet)
|
||||||
|
{
|
||||||
|
if (itemSet.Id == default(long))
|
||||||
|
{
|
||||||
|
// New entity
|
||||||
|
_context.ItemSets.Add(itemSet);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Existing entity
|
||||||
|
_context.Entry(itemSet).State = EntityState.Modified;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Delete(int id)
|
||||||
|
{
|
||||||
|
var itemSet = _context.ItemSets.Find(id);
|
||||||
|
_context.ItemSets.Remove(itemSet);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Save()
|
||||||
|
{
|
||||||
|
_context.SaveChanges();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
_context.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,130 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ProductVersion>
|
||||||
|
</ProductVersion>
|
||||||
|
<SchemaVersion>2.0</SchemaVersion>
|
||||||
|
<ProjectGuid>{58CD3B9C-EBBA-4527-A81C-78B7EA9CA298}</ProjectGuid>
|
||||||
|
<OutputType>Library</OutputType>
|
||||||
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
|
<RootNamespace>Filtration.ItemFilterPreview.Tests</RootNamespace>
|
||||||
|
<AssemblyName>Filtration.ItemFilterPreview.Tests</AssemblyName>
|
||||||
|
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
||||||
|
<TargetPlatformVersion>8.1</TargetPlatformVersion>
|
||||||
|
<MinimumVisualStudioVersion>12</MinimumVisualStudioVersion>
|
||||||
|
<FileAlignment>512</FileAlignment>
|
||||||
|
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||||
|
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
|
||||||
|
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||||
|
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
|
||||||
|
<IsCodedUITest>True</IsCodedUITest>
|
||||||
|
<TestProjectType>CodedUITest</TestProjectType>
|
||||||
|
<IsWindowsStoreCodedUITest>True</IsWindowsStoreCodedUITest>
|
||||||
|
<TargetFrameworkProfile />
|
||||||
|
<NuGetPackageImportStamp>
|
||||||
|
</NuGetPackageImportStamp>
|
||||||
|
</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="System" />
|
||||||
|
<Reference Include="System.Configuration" />
|
||||||
|
<Reference Include="System.Xml" />
|
||||||
|
<Reference Include="System.Xml.Linq" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
|
||||||
|
<Visible>False</Visible>
|
||||||
|
</CodeAnalysisDependentAssemblyPaths>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
<Compile Include="Properties\Resources.Designer.cs">
|
||||||
|
<AutoGen>True</AutoGen>
|
||||||
|
<DesignTime>True</DesignTime>
|
||||||
|
<DependentUpon>Resources.resx</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Services\serializationtest.cs" />
|
||||||
|
<Compile Include="Services\TestItemBlockItemMatcher.cs" />
|
||||||
|
<Compile Include="Services\TestItemFilterProcessor.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="app.config" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\Filtration.ItemFilterPreview\Filtration.ItemFilterPreview.csproj">
|
||||||
|
<Project>{3ab98b6e-05db-44fa-9dad-584aa88f0739}</Project>
|
||||||
|
<Name>Filtration.ItemFilterPreview</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\Filtration.ObjectModel\Filtration.ObjectModel.csproj">
|
||||||
|
<Project>{4aac3beb-1dc1-483e-9d11-0e9334e80227}</Project>
|
||||||
|
<Name>Filtration.ObjectModel</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\Filtration.Parser.Interface\Filtration.Parser.Interface.csproj">
|
||||||
|
<Project>{46383F20-02DF-48B4-B092-9088FA4ACD5A}</Project>
|
||||||
|
<Name>Filtration.Parser.Interface</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\Filtration.Parser\Filtration.Parser.csproj">
|
||||||
|
<Project>{10a7c2bc-ec6f-4a38-bdda-e35935004c02}</Project>
|
||||||
|
<Name>Filtration.Parser</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\Filtration\Filtration.csproj">
|
||||||
|
<Project>{55e0a34c-e039-43d7-a024-a4045401cdda}</Project>
|
||||||
|
<Name>Filtration</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<EmbeddedResource Include="Properties\Resources.resx">
|
||||||
|
<Generator>ResXFileCodeGenerator</Generator>
|
||||||
|
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||||
|
</EmbeddedResource>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="Resources\MuldiniFilterScript.txt" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Castle.Core">
|
||||||
|
<Version>4.4.0</Version>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="FluentAssertions">
|
||||||
|
<Version>5.6.0</Version>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="Moq">
|
||||||
|
<Version>4.10.1</Version>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="NUnit">
|
||||||
|
<Version>3.11.0</Version>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="System.Threading.Tasks.Extensions">
|
||||||
|
<Version>4.5.2</Version>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="System.ValueTuple">
|
||||||
|
<Version>4.5.0</Version>
|
||||||
|
</PackageReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||||
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
|
<Target Name="BeforeBuild">
|
||||||
|
</Target>
|
||||||
|
<Target Name="AfterBuild">
|
||||||
|
</Target>
|
||||||
|
-->
|
||||||
|
</Project>
|
|
@ -0,0 +1,35 @@
|
||||||
|
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.ItemFilterPreview.Tests")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("")]
|
||||||
|
[assembly: AssemblyProduct("Filtration.ItemFilterPreview.Tests")]
|
||||||
|
[assembly: AssemblyCopyright("Copyright © 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("58cd3b9c-ebba-4527-a81c-78b7ea9ca298")]
|
||||||
|
|
||||||
|
// 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.0.0")]
|
||||||
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
|
@ -0,0 +1,82 @@
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// This code was generated by a tool.
|
||||||
|
// Runtime Version:4.0.30319.42000
|
||||||
|
//
|
||||||
|
// Changes to this file may cause incorrect behavior and will be lost if
|
||||||
|
// the code is regenerated.
|
||||||
|
// </auto-generated>
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace Filtration.ItemFilterPreview.Tests.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.ItemFilterPreview.Tests.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 string similar to ###############################################################################
|
||||||
|
///################ Path of Exile Item Filter - Script by Muldini ################
|
||||||
|
///###############################################################################
|
||||||
|
///############ http://www.pathofexile.com/forum/view-thread/1259059 #############
|
||||||
|
///
|
||||||
|
///
|
||||||
|
///
|
||||||
|
///
|
||||||
|
///###############################################################################
|
||||||
|
///### Overview ##################################################################
|
||||||
|
///################## [rest of string was truncated]";.
|
||||||
|
/// </summary>
|
||||||
|
internal static string MuldiniFilterScript {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("MuldiniFilterScript", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,124 @@
|
||||||
|
<?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="MuldiniFilterScript" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\MuldiniFilterScript.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
|
||||||
|
</data>
|
||||||
|
</root>
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,522 @@
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Filtration.ItemFilterPreview.Services;
|
||||||
|
using Filtration.ObjectModel;
|
||||||
|
using Filtration.ObjectModel.BlockItemTypes;
|
||||||
|
using Filtration.ObjectModel.Enums;
|
||||||
|
using Moq;
|
||||||
|
using NUnit.Framework;
|
||||||
|
|
||||||
|
namespace Filtration.ItemFilterPreview.Tests.Services
|
||||||
|
{
|
||||||
|
[TestFixture]
|
||||||
|
public class TestItemBlockItemMatcher
|
||||||
|
{
|
||||||
|
private ItemBlockItemMatcherTestUtility _testUtility;
|
||||||
|
|
||||||
|
[SetUp]
|
||||||
|
public void ItemBlockItemMatcherTestSetUp()
|
||||||
|
{
|
||||||
|
_testUtility = new ItemBlockItemMatcherTestUtility();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void ItemBlockMatch_EmptyShowBlock_ReturnsTrue()
|
||||||
|
{
|
||||||
|
//Arrange
|
||||||
|
var testInputItem = Mock.Of<IItem>();
|
||||||
|
var testInputBlock = new ItemFilterBlock();
|
||||||
|
|
||||||
|
//Act
|
||||||
|
var result = _testUtility.BlockItemMatcher.ItemBlockMatch(testInputBlock, testInputItem);
|
||||||
|
|
||||||
|
//Assert
|
||||||
|
Assert.IsTrue(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void ItemBlockMatch_SingleBlockItem_Matches_ReturnsTrue()
|
||||||
|
{
|
||||||
|
//Arrange
|
||||||
|
var testBaseType = "Test Base Type";
|
||||||
|
var testInputItem = Mock.Of<IItem>(i => i.BaseType == testBaseType);
|
||||||
|
var testInputBlock = new ItemFilterBlock();
|
||||||
|
var baseTypeBlockItem = new BaseTypeBlockItem();
|
||||||
|
baseTypeBlockItem.Items.Add(testBaseType);
|
||||||
|
testInputBlock.BlockItems.Add(baseTypeBlockItem);
|
||||||
|
|
||||||
|
//Act
|
||||||
|
var result = _testUtility.BlockItemMatcher.ItemBlockMatch(testInputBlock, testInputItem);
|
||||||
|
|
||||||
|
//Assert
|
||||||
|
Assert.IsTrue(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void ItemBlockMatch_SingleBlockItem_DoesNotMatche_ReturnsFalse()
|
||||||
|
{
|
||||||
|
//Arrange
|
||||||
|
var testInputItem = Mock.Of<IItem>(i => i.BaseType == "Base Type 1");
|
||||||
|
var testInputBlock = new ItemFilterBlock();
|
||||||
|
var baseTypeBlockItem = new BaseTypeBlockItem();
|
||||||
|
baseTypeBlockItem.Items.Add("Base Type 2");
|
||||||
|
testInputBlock.BlockItems.Add(baseTypeBlockItem);
|
||||||
|
|
||||||
|
//Act
|
||||||
|
var result = _testUtility.BlockItemMatcher.ItemBlockMatch(testInputBlock, testInputItem);
|
||||||
|
|
||||||
|
//Assert
|
||||||
|
Assert.IsFalse(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void ItemBlockMatch_MultipleBlockItems_Matches_ReturnsTrue()
|
||||||
|
{
|
||||||
|
//Arrange
|
||||||
|
var testInputItem = Mock.Of<IItem>(i => i.BaseType == "Base Type 1" && i.Height == 4 && i.Width == 2);
|
||||||
|
var testInputBlock = new ItemFilterBlock();
|
||||||
|
var baseTypeBlockItem = new BaseTypeBlockItem();
|
||||||
|
baseTypeBlockItem.Items.Add("Base Type 1");
|
||||||
|
var heightBlockItem = new HeightBlockItem(FilterPredicateOperator.Equal, 4);
|
||||||
|
var widthBlockItem = new WidthBlockItem(FilterPredicateOperator.Equal, 2);
|
||||||
|
|
||||||
|
testInputBlock.BlockItems.Add(baseTypeBlockItem);
|
||||||
|
testInputBlock.BlockItems.Add(heightBlockItem);
|
||||||
|
testInputBlock.BlockItems.Add(widthBlockItem);
|
||||||
|
|
||||||
|
//Act
|
||||||
|
var result = _testUtility.BlockItemMatcher.ItemBlockMatch(testInputBlock, testInputItem);
|
||||||
|
|
||||||
|
//Assert
|
||||||
|
Assert.IsTrue(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void ItemBlockMatch_MultipleBlockItems_DoesNotMatch_ReturnsFalse()
|
||||||
|
{
|
||||||
|
//Arrange
|
||||||
|
var testInputItem = Mock.Of<IItem>(i => i.BaseType == "Base Type 1" && i.Height == 4 && i.Width == 2);
|
||||||
|
var testInputBlock = new ItemFilterBlock();
|
||||||
|
var baseTypeBlockItem = new BaseTypeBlockItem();
|
||||||
|
baseTypeBlockItem.Items.Add("Base Type d");
|
||||||
|
var heightBlockItem = new HeightBlockItem(FilterPredicateOperator.Equal, 3);
|
||||||
|
var widthBlockItem = new WidthBlockItem(FilterPredicateOperator.Equal, 2);
|
||||||
|
|
||||||
|
testInputBlock.BlockItems.Add(baseTypeBlockItem);
|
||||||
|
testInputBlock.BlockItems.Add(heightBlockItem);
|
||||||
|
testInputBlock.BlockItems.Add(widthBlockItem);
|
||||||
|
|
||||||
|
//Act
|
||||||
|
var result = _testUtility.BlockItemMatcher.ItemBlockMatch(testInputBlock, testInputItem);
|
||||||
|
|
||||||
|
//Assert
|
||||||
|
Assert.IsFalse(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestCase("Test Base Type", true)]
|
||||||
|
[TestCase("Test Bas", true)]
|
||||||
|
[TestCase("T", true)]
|
||||||
|
[TestCase("Base Type", false)]
|
||||||
|
public void ItemBlockItemMatch_BaseTypeBlockItem_SingleBlockItemValue_ReturnsTrue(string testInputBaseType, bool expectedResult)
|
||||||
|
{
|
||||||
|
//Arrange
|
||||||
|
var testInputItem = Mock.Of<IItem>(i => i.BaseType == "Test Base Type");
|
||||||
|
var testInputBaseTypeBlockItem = new BaseTypeBlockItem();
|
||||||
|
testInputBaseTypeBlockItem.Items.Add(testInputBaseType);
|
||||||
|
|
||||||
|
//Act
|
||||||
|
var result = _testUtility.BlockItemMatcher.ItemBlockItemMatch(testInputBaseTypeBlockItem, testInputItem);
|
||||||
|
|
||||||
|
//Assert
|
||||||
|
Assert.AreEqual(expectedResult, result);
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestCase("Test Base Type", true)]
|
||||||
|
[TestCase("Test Bas", true)]
|
||||||
|
[TestCase("T", true)]
|
||||||
|
[TestCase("Base Type", false)]
|
||||||
|
public void ItemBlockItemMatch_BaseTypeBlockItem_MultipleBlockItemValues_ReturnsCorrectResult(string testInputBaseType, bool expectedResult)
|
||||||
|
{
|
||||||
|
//Arrange
|
||||||
|
var testInputItem = Mock.Of<IItem>(i => i.BaseType == "Test Base Type");
|
||||||
|
var testInputBlockItem = new BaseTypeBlockItem();
|
||||||
|
testInputBlockItem.Items.Add("Something else");
|
||||||
|
testInputBlockItem.Items.Add(testInputBaseType);
|
||||||
|
testInputBlockItem.Items.Add("Blah");
|
||||||
|
|
||||||
|
//Act
|
||||||
|
var result = _testUtility.BlockItemMatcher.ItemBlockItemMatch(testInputBlockItem, testInputItem);
|
||||||
|
|
||||||
|
//Assert
|
||||||
|
Assert.AreEqual(expectedResult, result);
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestCase("Test Item Class", true)]
|
||||||
|
[TestCase("Test It", true)]
|
||||||
|
[TestCase("T", true)]
|
||||||
|
[TestCase("Carrots", false)]
|
||||||
|
[TestCase("Item Class", true)]
|
||||||
|
public void ItemBlockItemMatch_ClassBlockItem_SingleBlockItemValue_ReturnsCorrectResult(string testInputBlockItemItemClass, bool expectedResult)
|
||||||
|
{
|
||||||
|
//Arrange
|
||||||
|
var testInputItem = Mock.Of<IItem>(i => i.ItemClass == "Test Item Class");
|
||||||
|
var testInputBlockItem = new ClassBlockItem();
|
||||||
|
testInputBlockItem.Items.Add(testInputBlockItemItemClass);
|
||||||
|
|
||||||
|
//Act
|
||||||
|
var result = _testUtility.BlockItemMatcher.ItemBlockItemMatch(testInputBlockItem, testInputItem);
|
||||||
|
|
||||||
|
//Assert
|
||||||
|
Assert.AreEqual(expectedResult, result);
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestCase(FilterPredicateOperator.Equal, 49, false)]
|
||||||
|
[TestCase(FilterPredicateOperator.Equal, 50, true)]
|
||||||
|
[TestCase(FilterPredicateOperator.Equal, 51, false)]
|
||||||
|
[TestCase(FilterPredicateOperator.GreaterThan, 49, true)]
|
||||||
|
[TestCase(FilterPredicateOperator.GreaterThan, 50, false)]
|
||||||
|
[TestCase(FilterPredicateOperator.GreaterThan, 51, false)]
|
||||||
|
[TestCase(FilterPredicateOperator.GreaterThanOrEqual, 49, true)]
|
||||||
|
[TestCase(FilterPredicateOperator.GreaterThanOrEqual, 50, true)]
|
||||||
|
[TestCase(FilterPredicateOperator.GreaterThanOrEqual, 51, false)]
|
||||||
|
[TestCase(FilterPredicateOperator.LessThan, 49, false)]
|
||||||
|
[TestCase(FilterPredicateOperator.LessThan, 50, false)]
|
||||||
|
[TestCase(FilterPredicateOperator.LessThan, 51, true)]
|
||||||
|
[TestCase(FilterPredicateOperator.LessThanOrEqual, 49, false)]
|
||||||
|
[TestCase(FilterPredicateOperator.LessThanOrEqual, 50, true)]
|
||||||
|
[TestCase(FilterPredicateOperator.LessThanOrEqual, 51, true)]
|
||||||
|
[TestCase(-1, 51, false)]
|
||||||
|
public void ItemBlockItemMatch_DropLevelBlockItem_ReturnsCorrectResult(FilterPredicateOperator testInputFilterPredicateOperator, int testInputBlockItemDropLevel, bool expectedResult)
|
||||||
|
{
|
||||||
|
//Arrange
|
||||||
|
var testInputItem = Mock.Of<IItem>(i => i.DropLevel == 50);
|
||||||
|
var testInputBlockItem = new DropLevelBlockItem(testInputFilterPredicateOperator, testInputBlockItemDropLevel);
|
||||||
|
|
||||||
|
//Act
|
||||||
|
var result = _testUtility.BlockItemMatcher.ItemBlockItemMatch(testInputBlockItem, testInputItem);
|
||||||
|
|
||||||
|
//Assert
|
||||||
|
Assert.AreEqual(expectedResult, result);
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestCase(FilterPredicateOperator.Equal, 1, false)]
|
||||||
|
[TestCase(FilterPredicateOperator.Equal, 2, true)]
|
||||||
|
[TestCase(FilterPredicateOperator.Equal, 3, false)]
|
||||||
|
[TestCase(FilterPredicateOperator.GreaterThan, 1, true)]
|
||||||
|
[TestCase(FilterPredicateOperator.GreaterThan, 2, false)]
|
||||||
|
[TestCase(FilterPredicateOperator.GreaterThan, 3, false)]
|
||||||
|
[TestCase(FilterPredicateOperator.GreaterThanOrEqual, 1, true)]
|
||||||
|
[TestCase(FilterPredicateOperator.GreaterThanOrEqual, 2, true)]
|
||||||
|
[TestCase(FilterPredicateOperator.GreaterThanOrEqual, 3, false)]
|
||||||
|
[TestCase(FilterPredicateOperator.LessThan, 1, false)]
|
||||||
|
[TestCase(FilterPredicateOperator.LessThan, 2, false)]
|
||||||
|
[TestCase(FilterPredicateOperator.LessThan, 3, true)]
|
||||||
|
[TestCase(FilterPredicateOperator.LessThanOrEqual, 1, false)]
|
||||||
|
[TestCase(FilterPredicateOperator.LessThanOrEqual, 2, true)]
|
||||||
|
[TestCase(FilterPredicateOperator.LessThanOrEqual, 3, true)]
|
||||||
|
[TestCase(-1, 3, false)]
|
||||||
|
public void ItemBlockItemMatch_HeightBlockItem_ReturnsCorrectResult(FilterPredicateOperator testInputFilterPredicateOperator, int testInputBlockItemHeight, bool expectedResult)
|
||||||
|
{
|
||||||
|
//Arrange
|
||||||
|
var testInputItem = Mock.Of<IItem>(i => i.Height == 2);
|
||||||
|
var testInputBlockItem = new HeightBlockItem(testInputFilterPredicateOperator, testInputBlockItemHeight);
|
||||||
|
|
||||||
|
//Act
|
||||||
|
var result = _testUtility.BlockItemMatcher.ItemBlockItemMatch(testInputBlockItem, testInputItem);
|
||||||
|
|
||||||
|
//Assert
|
||||||
|
Assert.AreEqual(expectedResult, result);
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestCase(FilterPredicateOperator.Equal, 49, false)]
|
||||||
|
[TestCase(FilterPredicateOperator.Equal, 50, true)]
|
||||||
|
[TestCase(FilterPredicateOperator.Equal, 51, false)]
|
||||||
|
[TestCase(FilterPredicateOperator.GreaterThan, 49, true)]
|
||||||
|
[TestCase(FilterPredicateOperator.GreaterThan, 50, false)]
|
||||||
|
[TestCase(FilterPredicateOperator.GreaterThan, 51, false)]
|
||||||
|
[TestCase(FilterPredicateOperator.GreaterThanOrEqual, 49, true)]
|
||||||
|
[TestCase(FilterPredicateOperator.GreaterThanOrEqual, 50, true)]
|
||||||
|
[TestCase(FilterPredicateOperator.GreaterThanOrEqual, 51, false)]
|
||||||
|
[TestCase(FilterPredicateOperator.LessThan, 49, false)]
|
||||||
|
[TestCase(FilterPredicateOperator.LessThan, 50, false)]
|
||||||
|
[TestCase(FilterPredicateOperator.LessThan, 51, true)]
|
||||||
|
[TestCase(FilterPredicateOperator.LessThanOrEqual, 49, false)]
|
||||||
|
[TestCase(FilterPredicateOperator.LessThanOrEqual, 50, true)]
|
||||||
|
[TestCase(FilterPredicateOperator.LessThanOrEqual, 51, true)]
|
||||||
|
[TestCase(-1, 51, false)]
|
||||||
|
public void ItemBlockItemMatch_ItemLevelBlockItem_ReturnsCorrectResult(FilterPredicateOperator testInputFilterPredicateOperator, int testInputBlockItemItemLevel, bool expectedResult)
|
||||||
|
{
|
||||||
|
//Arrange
|
||||||
|
var testInputItem = Mock.Of<IItem>(i => i.ItemLevel == 50);
|
||||||
|
var testInputBlockItem = new ItemLevelBlockItem(testInputFilterPredicateOperator, testInputBlockItemItemLevel);
|
||||||
|
|
||||||
|
//Act
|
||||||
|
var result = _testUtility.BlockItemMatcher.ItemBlockItemMatch(testInputBlockItem, testInputItem);
|
||||||
|
|
||||||
|
//Assert
|
||||||
|
Assert.AreEqual(expectedResult, result);
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestCase(FilterPredicateOperator.Equal, 2, false)]
|
||||||
|
[TestCase(FilterPredicateOperator.Equal, 3, true)]
|
||||||
|
[TestCase(FilterPredicateOperator.Equal, 4, false)]
|
||||||
|
[TestCase(FilterPredicateOperator.GreaterThan, 2, true)]
|
||||||
|
[TestCase(FilterPredicateOperator.GreaterThan, 3, false)]
|
||||||
|
[TestCase(FilterPredicateOperator.GreaterThan, 4, false)]
|
||||||
|
[TestCase(FilterPredicateOperator.GreaterThanOrEqual, 2, true)]
|
||||||
|
[TestCase(FilterPredicateOperator.GreaterThanOrEqual, 3, true)]
|
||||||
|
[TestCase(FilterPredicateOperator.GreaterThanOrEqual, 4, false)]
|
||||||
|
[TestCase(FilterPredicateOperator.LessThan, 2, false)]
|
||||||
|
[TestCase(FilterPredicateOperator.LessThan, 3, false)]
|
||||||
|
[TestCase(FilterPredicateOperator.LessThan, 4, true)]
|
||||||
|
[TestCase(FilterPredicateOperator.LessThanOrEqual, 2, false)]
|
||||||
|
[TestCase(FilterPredicateOperator.LessThanOrEqual, 3, true)]
|
||||||
|
[TestCase(FilterPredicateOperator.LessThanOrEqual, 4, true)]
|
||||||
|
[TestCase(-1, 3, false)]
|
||||||
|
public void ItemBlockItemMatch_LinkedSocketsBlockItem_ReturnsCorrectResult(FilterPredicateOperator testInputFilterPredicateOperator, int testInputBlockItemLinkedSockets, bool expectedResult)
|
||||||
|
{
|
||||||
|
//Arrange
|
||||||
|
var testInputItem = Mock.Of<IItem>(i => i.LinkedSockets == 3);
|
||||||
|
var testInputBlockItem = new LinkedSocketsBlockItem(testInputFilterPredicateOperator, testInputBlockItemLinkedSockets);
|
||||||
|
|
||||||
|
//Act
|
||||||
|
var result = _testUtility.BlockItemMatcher.ItemBlockItemMatch(testInputBlockItem, testInputItem);
|
||||||
|
|
||||||
|
//Assert
|
||||||
|
Assert.AreEqual(expectedResult, result);
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestCase(FilterPredicateOperator.Equal, 11, false)]
|
||||||
|
[TestCase(FilterPredicateOperator.Equal, 12, true)]
|
||||||
|
[TestCase(FilterPredicateOperator.Equal, 13, false)]
|
||||||
|
[TestCase(FilterPredicateOperator.GreaterThan, 11, true)]
|
||||||
|
[TestCase(FilterPredicateOperator.GreaterThan, 12, false)]
|
||||||
|
[TestCase(FilterPredicateOperator.GreaterThan, 13, false)]
|
||||||
|
[TestCase(FilterPredicateOperator.GreaterThanOrEqual, 11, true)]
|
||||||
|
[TestCase(FilterPredicateOperator.GreaterThanOrEqual, 12, true)]
|
||||||
|
[TestCase(FilterPredicateOperator.GreaterThanOrEqual, 13, false)]
|
||||||
|
[TestCase(FilterPredicateOperator.LessThan, 11, false)]
|
||||||
|
[TestCase(FilterPredicateOperator.LessThan, 12, false)]
|
||||||
|
[TestCase(FilterPredicateOperator.LessThan, 13, true)]
|
||||||
|
[TestCase(FilterPredicateOperator.LessThanOrEqual, 11, false)]
|
||||||
|
[TestCase(FilterPredicateOperator.LessThanOrEqual, 12, true)]
|
||||||
|
[TestCase(FilterPredicateOperator.LessThanOrEqual, 13, true)]
|
||||||
|
[TestCase(-1, 13, false)]
|
||||||
|
public void ItemBlockItemMatch_QualityBlockItem_ReturnsCorrectResult(FilterPredicateOperator testInputFilterPredicateOperator, int testInputBlockItemQuality, bool expectedResult)
|
||||||
|
{
|
||||||
|
//Arrange
|
||||||
|
var testInputItem = Mock.Of<IItem>(i => i.Quality == 12);
|
||||||
|
var testInputBlockItem = new QualityBlockItem(testInputFilterPredicateOperator, testInputBlockItemQuality);
|
||||||
|
|
||||||
|
//Act
|
||||||
|
var result = _testUtility.BlockItemMatcher.ItemBlockItemMatch(testInputBlockItem, testInputItem);
|
||||||
|
|
||||||
|
//Assert
|
||||||
|
Assert.AreEqual(expectedResult, result);
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestCase(FilterPredicateOperator.Equal, ItemRarity.Normal, false)]
|
||||||
|
[TestCase(FilterPredicateOperator.Equal, ItemRarity.Magic , true)]
|
||||||
|
[TestCase(FilterPredicateOperator.Equal, ItemRarity.Rare, false)]
|
||||||
|
[TestCase(FilterPredicateOperator.GreaterThan, ItemRarity.Normal, true)]
|
||||||
|
[TestCase(FilterPredicateOperator.GreaterThan, ItemRarity.Magic, false)]
|
||||||
|
[TestCase(FilterPredicateOperator.GreaterThan, ItemRarity.Rare, false)]
|
||||||
|
[TestCase(FilterPredicateOperator.GreaterThanOrEqual, ItemRarity.Normal, true)]
|
||||||
|
[TestCase(FilterPredicateOperator.GreaterThanOrEqual, ItemRarity.Magic, true)]
|
||||||
|
[TestCase(FilterPredicateOperator.GreaterThanOrEqual, ItemRarity.Rare, false)]
|
||||||
|
[TestCase(FilterPredicateOperator.LessThan, ItemRarity.Normal, false)]
|
||||||
|
[TestCase(FilterPredicateOperator.LessThan, ItemRarity.Magic, false)]
|
||||||
|
[TestCase(FilterPredicateOperator.LessThan, ItemRarity.Rare, true)]
|
||||||
|
[TestCase(FilterPredicateOperator.LessThanOrEqual, ItemRarity.Normal, false)]
|
||||||
|
[TestCase(FilterPredicateOperator.LessThanOrEqual, ItemRarity.Magic, true)]
|
||||||
|
[TestCase(FilterPredicateOperator.LessThanOrEqual, ItemRarity.Rare, true)]
|
||||||
|
[TestCase(-1, 13, false)]
|
||||||
|
public void ItemBlockItemMatch_RarityBlockItem_ReturnsCorrectResult(FilterPredicateOperator testInputFilterPredicateOperator, int testInputBlockItemRarity, bool expectedResult)
|
||||||
|
{
|
||||||
|
//Arrange
|
||||||
|
var testInputItem = Mock.Of<IItem>(i => i.ItemRarity == ItemRarity.Magic);
|
||||||
|
var testInputBlockItem = new RarityBlockItem(testInputFilterPredicateOperator, testInputBlockItemRarity);
|
||||||
|
|
||||||
|
//Act
|
||||||
|
var result = _testUtility.BlockItemMatcher.ItemBlockItemMatch(testInputBlockItem, testInputItem);
|
||||||
|
|
||||||
|
//Assert
|
||||||
|
Assert.AreEqual(expectedResult, result);
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestCase(FilterPredicateOperator.Equal, 2, false)]
|
||||||
|
[TestCase(FilterPredicateOperator.Equal, 3, true)]
|
||||||
|
[TestCase(FilterPredicateOperator.Equal, 4, false)]
|
||||||
|
[TestCase(FilterPredicateOperator.GreaterThan, 2, true)]
|
||||||
|
[TestCase(FilterPredicateOperator.GreaterThan, 3, false)]
|
||||||
|
[TestCase(FilterPredicateOperator.GreaterThan, 4, false)]
|
||||||
|
[TestCase(FilterPredicateOperator.GreaterThanOrEqual, 2, true)]
|
||||||
|
[TestCase(FilterPredicateOperator.GreaterThanOrEqual, 3, true)]
|
||||||
|
[TestCase(FilterPredicateOperator.GreaterThanOrEqual, 4, false)]
|
||||||
|
[TestCase(FilterPredicateOperator.LessThan, 2, false)]
|
||||||
|
[TestCase(FilterPredicateOperator.LessThan, 3, false)]
|
||||||
|
[TestCase(FilterPredicateOperator.LessThan, 4, true)]
|
||||||
|
[TestCase(FilterPredicateOperator.LessThanOrEqual, 2, false)]
|
||||||
|
[TestCase(FilterPredicateOperator.LessThanOrEqual, 3, true)]
|
||||||
|
[TestCase(FilterPredicateOperator.LessThanOrEqual, 4, true)]
|
||||||
|
[TestCase(-1, 3, false)]
|
||||||
|
public void ItemBlockItemMatch_SocketsBlockItem_ReturnsCorrectResult(FilterPredicateOperator testInputFilterPredicateOperator, int testInputBlockItemSockets, bool expectedResult)
|
||||||
|
{
|
||||||
|
//Arrange
|
||||||
|
var testInputItem = Mock.Of<IItem>(i => i.SocketCount == 3);
|
||||||
|
var testInputBlockItem = new SocketsBlockItem(testInputFilterPredicateOperator, testInputBlockItemSockets);
|
||||||
|
|
||||||
|
//Act
|
||||||
|
var result = _testUtility.BlockItemMatcher.ItemBlockItemMatch(testInputBlockItem, testInputItem);
|
||||||
|
|
||||||
|
//Assert
|
||||||
|
Assert.AreEqual(expectedResult, result);
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestCase(FilterPredicateOperator.Equal, 1, false)]
|
||||||
|
[TestCase(FilterPredicateOperator.Equal, 2, true)]
|
||||||
|
[TestCase(FilterPredicateOperator.Equal, 3, false)]
|
||||||
|
[TestCase(FilterPredicateOperator.GreaterThan, 1, true)]
|
||||||
|
[TestCase(FilterPredicateOperator.GreaterThan, 2, false)]
|
||||||
|
[TestCase(FilterPredicateOperator.GreaterThan, 3, false)]
|
||||||
|
[TestCase(FilterPredicateOperator.GreaterThanOrEqual, 1, true)]
|
||||||
|
[TestCase(FilterPredicateOperator.GreaterThanOrEqual, 2, true)]
|
||||||
|
[TestCase(FilterPredicateOperator.GreaterThanOrEqual, 3, false)]
|
||||||
|
[TestCase(FilterPredicateOperator.LessThan, 1, false)]
|
||||||
|
[TestCase(FilterPredicateOperator.LessThan, 2, false)]
|
||||||
|
[TestCase(FilterPredicateOperator.LessThan, 3, true)]
|
||||||
|
[TestCase(FilterPredicateOperator.LessThanOrEqual, 1, false)]
|
||||||
|
[TestCase(FilterPredicateOperator.LessThanOrEqual, 2, true)]
|
||||||
|
[TestCase(FilterPredicateOperator.LessThanOrEqual, 3, true)]
|
||||||
|
[TestCase(-1, 3, false)]
|
||||||
|
public void ItemBlockItemMatch_ReturnsCorrectResult(FilterPredicateOperator testInputFilterPredicateOperator, int testInputBlockItemWidth, bool expectedResult)
|
||||||
|
{
|
||||||
|
//Arrange
|
||||||
|
var testInputItem = Mock.Of<IItem>(i => i.Width == 2);
|
||||||
|
var testInputBlockItem = new WidthBlockItem(testInputFilterPredicateOperator, testInputBlockItemWidth);
|
||||||
|
|
||||||
|
//Act
|
||||||
|
var result = _testUtility.BlockItemMatcher.ItemBlockItemMatch(testInputBlockItem, testInputItem);
|
||||||
|
|
||||||
|
//Assert
|
||||||
|
Assert.AreEqual(expectedResult, result);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void ItemBlockItemMatch_SocketGroupBlockItem_SingleItemSocketGroup_SingleBlockItemSocketGroup_Match_ReturnsCorrectResult()
|
||||||
|
{
|
||||||
|
//Arrange
|
||||||
|
var testInputBlockItem = new SocketGroupBlockItem();
|
||||||
|
testInputBlockItem.Items.Add("RGB");
|
||||||
|
|
||||||
|
var testInputItem = Mock.Of<IItem>(i => i.LinkedSocketGroups == new List<SocketGroup>
|
||||||
|
{
|
||||||
|
new SocketGroup(new List<Socket>
|
||||||
|
{
|
||||||
|
new Socket(SocketColor.Red),
|
||||||
|
new Socket(SocketColor.Green),
|
||||||
|
new Socket(SocketColor.Blue),
|
||||||
|
}, true)
|
||||||
|
});
|
||||||
|
|
||||||
|
//Act
|
||||||
|
var result = _testUtility.BlockItemMatcher.ItemBlockItemMatch(testInputBlockItem, testInputItem);
|
||||||
|
|
||||||
|
//Assert
|
||||||
|
Assert.IsTrue(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void ItemBlockItemMatch_SocketGroupBlockItem_SingleItemSocketGroup_SingleBlockItemSocketGroup_NoMatch_ReturnsCorrectResult()
|
||||||
|
{
|
||||||
|
//Arrange
|
||||||
|
var testInputBlockItem = new SocketGroupBlockItem();
|
||||||
|
testInputBlockItem.Items.Add("RGB");
|
||||||
|
|
||||||
|
var testInputItem = Mock.Of<IItem>(i => i.LinkedSocketGroups == new List<SocketGroup>
|
||||||
|
{
|
||||||
|
new SocketGroup(new List<Socket>
|
||||||
|
{
|
||||||
|
new Socket(SocketColor.Red),
|
||||||
|
new Socket(SocketColor.Green)
|
||||||
|
}, true)
|
||||||
|
});
|
||||||
|
|
||||||
|
//Act
|
||||||
|
var result = _testUtility.BlockItemMatcher.ItemBlockItemMatch(testInputBlockItem, testInputItem);
|
||||||
|
|
||||||
|
//Assert
|
||||||
|
Assert.IsFalse(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void ItemBlockItemMatch_SocketGroupBlockItem_MultipleItemSocketGroup_SingleBlockItemSocketGroup_NoMatch_ReturnsCorrectResult()
|
||||||
|
{
|
||||||
|
//Arrange
|
||||||
|
var testInputBlockItem = new SocketGroupBlockItem();
|
||||||
|
testInputBlockItem.Items.Add("RGB");
|
||||||
|
testInputBlockItem.Items.Add("RGWW");
|
||||||
|
testInputBlockItem.Items.Add("RRGG");
|
||||||
|
testInputBlockItem.Items.Add("WWWW");
|
||||||
|
|
||||||
|
var testInputItem = Mock.Of<IItem>(i => i.LinkedSocketGroups == new List<SocketGroup>
|
||||||
|
{
|
||||||
|
new SocketGroup(new List<Socket>
|
||||||
|
{
|
||||||
|
new Socket(SocketColor.Red),
|
||||||
|
new Socket(SocketColor.Green),
|
||||||
|
new Socket(SocketColor.White),
|
||||||
|
new Socket(SocketColor.Green)
|
||||||
|
|
||||||
|
}, true)
|
||||||
|
});
|
||||||
|
|
||||||
|
//Act
|
||||||
|
var result = _testUtility.BlockItemMatcher.ItemBlockItemMatch(testInputBlockItem, testInputItem);
|
||||||
|
|
||||||
|
//Assert
|
||||||
|
Assert.IsFalse(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void ItemBlockItemMatch_SocketGroupBlockItem_MultipleItemSocketGroup_SingleBlockItemSocketGroup_Match_ReturnsCorrectResult()
|
||||||
|
{
|
||||||
|
//Arrange
|
||||||
|
var testInputBlockItem = new SocketGroupBlockItem();
|
||||||
|
testInputBlockItem.Items.Add("RGB");
|
||||||
|
testInputBlockItem.Items.Add("RGWW");
|
||||||
|
testInputBlockItem.Items.Add("RGWG");
|
||||||
|
testInputBlockItem.Items.Add("WWWW");
|
||||||
|
|
||||||
|
var testInputItem = Mock.Of<IItem>(i => i.LinkedSocketGroups == new List<SocketGroup>
|
||||||
|
{
|
||||||
|
new SocketGroup(new List<Socket>
|
||||||
|
{
|
||||||
|
new Socket(SocketColor.Red),
|
||||||
|
new Socket(SocketColor.Green),
|
||||||
|
new Socket(SocketColor.White),
|
||||||
|
new Socket(SocketColor.Green)
|
||||||
|
|
||||||
|
}, true)
|
||||||
|
});
|
||||||
|
|
||||||
|
//Act
|
||||||
|
var result = _testUtility.BlockItemMatcher.ItemBlockItemMatch(testInputBlockItem, testInputItem);
|
||||||
|
|
||||||
|
//Assert
|
||||||
|
Assert.IsTrue(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
private class ItemBlockItemMatcherTestUtility
|
||||||
|
{
|
||||||
|
public ItemBlockItemMatcherTestUtility()
|
||||||
|
{
|
||||||
|
// Mock setups
|
||||||
|
|
||||||
|
// Class under-test instantiation
|
||||||
|
BlockItemMatcher = new BlockItemMatcher();
|
||||||
|
}
|
||||||
|
|
||||||
|
public BlockItemMatcher BlockItemMatcher { get; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,258 @@
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Linq;
|
||||||
|
using Filtration.ItemFilterPreview.Services;
|
||||||
|
using Filtration.ItemFilterPreview.Tests.Properties;
|
||||||
|
using Filtration.ObjectModel;
|
||||||
|
using Filtration.ObjectModel.BlockItemTypes;
|
||||||
|
using Filtration.ObjectModel.Enums;
|
||||||
|
using Filtration.ObjectModel.Factories;
|
||||||
|
using Filtration.Parser.Services;
|
||||||
|
using Moq;
|
||||||
|
using NUnit.Framework;
|
||||||
|
|
||||||
|
namespace Filtration.ItemFilterPreview.Tests.Services
|
||||||
|
{
|
||||||
|
[TestFixture]
|
||||||
|
public class TestItemFilterProcessor
|
||||||
|
{
|
||||||
|
private ItemFilterProcessorTestUtility _testUtility;
|
||||||
|
|
||||||
|
[SetUp]
|
||||||
|
public void ItemFilterProcessorTestSetUp()
|
||||||
|
{
|
||||||
|
_testUtility = new ItemFilterProcessorTestUtility();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void ProcessItemsAgainstItemFilterScript_Matches_ReturnsTrue()
|
||||||
|
{
|
||||||
|
//Arrange
|
||||||
|
var testInputItem = Mock.Of<IItem>();
|
||||||
|
var testInputBlock = Mock.Of<IItemFilterBlock>();
|
||||||
|
var testInputScript = Mock.Of<IItemFilterScript>(s => s.ItemFilterBlocks == new ObservableCollection<IItemFilterBlockBase> {testInputBlock});
|
||||||
|
|
||||||
|
_testUtility.MockBlockItemMatcher
|
||||||
|
.Setup(b => b.ItemBlockMatch(testInputBlock, testInputItem))
|
||||||
|
.Returns(true)
|
||||||
|
.Verifiable();
|
||||||
|
|
||||||
|
//Act
|
||||||
|
var result = _testUtility.ItemFilterProcessor.ProcessItemsAgainstItemFilterScript(testInputScript, new List<IItem> { testInputItem });
|
||||||
|
|
||||||
|
//Assert
|
||||||
|
_testUtility.MockBlockItemMatcher.Verify();
|
||||||
|
Assert.AreEqual(testInputBlock, result.First(r => r.ItemFilterBlock == testInputBlock).ItemFilterBlock);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void ProcessItemsAgainstItemFilterScript_DoesNotMatch_ResultHasNullItemFilterBlock()
|
||||||
|
{
|
||||||
|
//Arrange
|
||||||
|
var testInputItem = Mock.Of<IItem>();
|
||||||
|
var testInputBlock = Mock.Of<IItemFilterBlock>();
|
||||||
|
var testInputScript = Mock.Of<IItemFilterScript>(s => s.ItemFilterBlocks == new ObservableCollection<IItemFilterBlockBase> { testInputBlock });
|
||||||
|
|
||||||
|
_testUtility.MockBlockItemMatcher
|
||||||
|
.Setup(b => b.ItemBlockMatch(testInputBlock, testInputItem))
|
||||||
|
.Returns(false)
|
||||||
|
.Verifiable();
|
||||||
|
|
||||||
|
//Act
|
||||||
|
var result = _testUtility.ItemFilterProcessor.ProcessItemsAgainstItemFilterScript(testInputScript, new List<IItem> { testInputItem });
|
||||||
|
|
||||||
|
//Assert
|
||||||
|
_testUtility.MockBlockItemMatcher.Verify();
|
||||||
|
Assert.AreEqual(null, result.First(r => r.Item == testInputItem).ItemFilterBlock);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
[Ignore("Outdated item filter")]
|
||||||
|
public void ProcessItemsAgainstItemFilterScript_IntegrationTest()
|
||||||
|
{
|
||||||
|
//Arrange
|
||||||
|
var testInputScriptFile = Resources.MuldiniFilterScript;
|
||||||
|
var blockGroupHierarchyBuilder = new BlockGroupHierarchyBuilder();
|
||||||
|
var mockItemFilterScriptFactory = new Mock<IItemFilterScriptFactory>();
|
||||||
|
mockItemFilterScriptFactory
|
||||||
|
.Setup(i => i.Create())
|
||||||
|
.Returns(new ItemFilterScript());
|
||||||
|
|
||||||
|
var scriptTranslator = new ItemFilterScriptTranslator(blockGroupHierarchyBuilder, new ItemFilterBlockTranslator(blockGroupHierarchyBuilder), mockItemFilterScriptFactory.Object);
|
||||||
|
var script = scriptTranslator.TranslateStringToItemFilterScript(testInputScriptFile);
|
||||||
|
|
||||||
|
var testInputItem = new Item
|
||||||
|
{
|
||||||
|
BaseType = "BlahdeBlah",
|
||||||
|
ItemClass = "Wands",
|
||||||
|
ItemRarity = ItemRarity.Magic,
|
||||||
|
ItemLevel = 9,
|
||||||
|
DropLevel = 9,
|
||||||
|
Height = 3,
|
||||||
|
Width = 1,
|
||||||
|
SocketGroups = new List<SocketGroup> {new SocketGroup(new List<Socket> {new Socket(SocketColor.Red)}, false)}
|
||||||
|
};
|
||||||
|
|
||||||
|
var itemFilterProcessor = new ItemFilterProcessor(new BlockItemMatcher());
|
||||||
|
|
||||||
|
//Act
|
||||||
|
var result = itemFilterProcessor.ProcessItemsAgainstItemFilterScript(script, new List<IItem> { testInputItem });
|
||||||
|
|
||||||
|
//Assert
|
||||||
|
Assert.AreEqual("Wands", result.First().ItemFilterBlock.BlockItems.OfType<ClassBlockItem>().First().Items.First());
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
[Ignore("Outdated item filter")]
|
||||||
|
public void ProcessItemsAgainstItemFilterScript_IntegrationTest_10Items()
|
||||||
|
{
|
||||||
|
//Arrange
|
||||||
|
var testInputScriptFile = Resources.MuldiniFilterScript;
|
||||||
|
var blockGroupHierarchyBuilder = new BlockGroupHierarchyBuilder();
|
||||||
|
var mockItemFilterScriptFactory = new Mock<IItemFilterScriptFactory>();
|
||||||
|
mockItemFilterScriptFactory
|
||||||
|
.Setup(i => i.Create())
|
||||||
|
.Returns(new ItemFilterScript());
|
||||||
|
var scriptTranslator = new ItemFilterScriptTranslator(blockGroupHierarchyBuilder, new ItemFilterBlockTranslator(blockGroupHierarchyBuilder), mockItemFilterScriptFactory.Object);
|
||||||
|
var script = scriptTranslator.TranslateStringToItemFilterScript(testInputScriptFile);
|
||||||
|
|
||||||
|
var testInputItems = new List<IItem>
|
||||||
|
{
|
||||||
|
new Item
|
||||||
|
{
|
||||||
|
BaseType = "BlahdeBlah",
|
||||||
|
ItemClass = "Wands",
|
||||||
|
ItemRarity = ItemRarity.Magic,
|
||||||
|
ItemLevel = 9,
|
||||||
|
DropLevel = 9,
|
||||||
|
Height = 3,
|
||||||
|
Width = 1,
|
||||||
|
SocketGroups = new List<SocketGroup> {new SocketGroup(new List<Socket> {new Socket(SocketColor.Red)}, false)}
|
||||||
|
},
|
||||||
|
new Item
|
||||||
|
{
|
||||||
|
BaseType = "BlahdeBlah",
|
||||||
|
ItemClass = "Wands",
|
||||||
|
ItemRarity = ItemRarity.Magic,
|
||||||
|
ItemLevel = 9,
|
||||||
|
DropLevel = 9,
|
||||||
|
Height = 3,
|
||||||
|
Width = 1,
|
||||||
|
SocketGroups = new List<SocketGroup> {new SocketGroup(new List<Socket> {new Socket(SocketColor.Red)}, false)}
|
||||||
|
},
|
||||||
|
new Item
|
||||||
|
{
|
||||||
|
BaseType = "BlahdeBlah",
|
||||||
|
ItemClass = "Wands",
|
||||||
|
ItemRarity = ItemRarity.Magic,
|
||||||
|
ItemLevel = 9,
|
||||||
|
DropLevel = 9,
|
||||||
|
Height = 3,
|
||||||
|
Width = 1,
|
||||||
|
SocketGroups = new List<SocketGroup> {new SocketGroup(new List<Socket> {new Socket(SocketColor.Red)}, false)}
|
||||||
|
},
|
||||||
|
new Item
|
||||||
|
{
|
||||||
|
BaseType = "BlahdeBlah",
|
||||||
|
ItemClass = "Wands",
|
||||||
|
ItemRarity = ItemRarity.Magic,
|
||||||
|
ItemLevel = 9,
|
||||||
|
DropLevel = 9,
|
||||||
|
Height = 3,
|
||||||
|
Width = 1,
|
||||||
|
SocketGroups = new List<SocketGroup> {new SocketGroup(new List<Socket> {new Socket(SocketColor.Red)}, false)}
|
||||||
|
},
|
||||||
|
new Item
|
||||||
|
{
|
||||||
|
BaseType = "BlahdeBlah",
|
||||||
|
ItemClass = "Wands",
|
||||||
|
ItemRarity = ItemRarity.Magic,
|
||||||
|
ItemLevel = 9,
|
||||||
|
DropLevel = 9,
|
||||||
|
Height = 3,
|
||||||
|
Width = 1,
|
||||||
|
SocketGroups = new List<SocketGroup> {new SocketGroup(new List<Socket> {new Socket(SocketColor.Red)}, false)}
|
||||||
|
},
|
||||||
|
new Item
|
||||||
|
{
|
||||||
|
BaseType = "BlahdeBlah",
|
||||||
|
ItemClass = "Wands",
|
||||||
|
ItemRarity = ItemRarity.Magic,
|
||||||
|
ItemLevel = 9,
|
||||||
|
DropLevel = 9,
|
||||||
|
Height = 3,
|
||||||
|
Width = 1,
|
||||||
|
SocketGroups = new List<SocketGroup> {new SocketGroup(new List<Socket> {new Socket(SocketColor.Red)}, false)}
|
||||||
|
},
|
||||||
|
new Item
|
||||||
|
{
|
||||||
|
BaseType = "BlahdeBlah",
|
||||||
|
ItemClass = "Wands",
|
||||||
|
ItemRarity = ItemRarity.Magic,
|
||||||
|
ItemLevel = 9,
|
||||||
|
DropLevel = 9,
|
||||||
|
Height = 3,
|
||||||
|
Width = 1,
|
||||||
|
SocketGroups = new List<SocketGroup> {new SocketGroup(new List<Socket> {new Socket(SocketColor.Red)}, false)}
|
||||||
|
},
|
||||||
|
new Item
|
||||||
|
{
|
||||||
|
BaseType = "BlahdeBlah",
|
||||||
|
ItemClass = "Wands",
|
||||||
|
ItemRarity = ItemRarity.Magic,
|
||||||
|
ItemLevel = 9,
|
||||||
|
DropLevel = 9,
|
||||||
|
Height = 3,
|
||||||
|
Width = 1,
|
||||||
|
SocketGroups = new List<SocketGroup> {new SocketGroup(new List<Socket> {new Socket(SocketColor.Red)}, false)}
|
||||||
|
},
|
||||||
|
new Item
|
||||||
|
{
|
||||||
|
BaseType = "BlahdeBlah",
|
||||||
|
ItemClass = "Wands",
|
||||||
|
ItemRarity = ItemRarity.Magic,
|
||||||
|
ItemLevel = 9,
|
||||||
|
DropLevel = 9,
|
||||||
|
Height = 3,
|
||||||
|
Width = 1,
|
||||||
|
SocketGroups = new List<SocketGroup> {new SocketGroup(new List<Socket> {new Socket(SocketColor.Red)}, false)}
|
||||||
|
},
|
||||||
|
new Item
|
||||||
|
{
|
||||||
|
BaseType = "BlahdeBlah",
|
||||||
|
ItemClass = "Wands",
|
||||||
|
ItemRarity = ItemRarity.Magic,
|
||||||
|
ItemLevel = 9,
|
||||||
|
DropLevel = 9,
|
||||||
|
Height = 3,
|
||||||
|
Width = 1,
|
||||||
|
SocketGroups = new List<SocketGroup> {new SocketGroup(new List<Socket> {new Socket(SocketColor.Red)}, false)}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var itemFilterProcessor = new ItemFilterProcessor(new BlockItemMatcher());
|
||||||
|
|
||||||
|
//Act
|
||||||
|
var result = itemFilterProcessor.ProcessItemsAgainstItemFilterScript(script, testInputItems);
|
||||||
|
|
||||||
|
//Assert
|
||||||
|
Assert.AreEqual("Wands", result.First().ItemFilterBlock.BlockItems.OfType<ClassBlockItem>().First().Items.First());
|
||||||
|
}
|
||||||
|
|
||||||
|
private class ItemFilterProcessorTestUtility
|
||||||
|
{
|
||||||
|
public ItemFilterProcessorTestUtility()
|
||||||
|
{
|
||||||
|
// Mock setups
|
||||||
|
MockBlockItemMatcher = new Mock<IBlockItemMatcher>();
|
||||||
|
|
||||||
|
// Class under-test instantiation
|
||||||
|
ItemFilterProcessor = new ItemFilterProcessor(MockBlockItemMatcher.Object);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ItemFilterProcessor ItemFilterProcessor { get; private set; }
|
||||||
|
|
||||||
|
public Mock<IBlockItemMatcher> MockBlockItemMatcher { get; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,45 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Xml;
|
||||||
|
using System.Xml.Serialization;
|
||||||
|
using Filtration.ObjectModel;
|
||||||
|
using Filtration.ObjectModel.Enums;
|
||||||
|
using NUnit.Framework;
|
||||||
|
|
||||||
|
namespace Filtration.ItemFilterPreview.Tests.Services
|
||||||
|
{
|
||||||
|
class serializationtest
|
||||||
|
{
|
||||||
|
[Ignore("")]
|
||||||
|
[Test]
|
||||||
|
public void test_serialization()
|
||||||
|
{
|
||||||
|
//Arrange
|
||||||
|
var item = new Item
|
||||||
|
{
|
||||||
|
ItemClass = "Test Class",
|
||||||
|
BaseType = "Test Base Type",
|
||||||
|
DropLevel = 54,
|
||||||
|
Height = 2,
|
||||||
|
Width = 2,
|
||||||
|
ItemLevel = 50,
|
||||||
|
ItemRarity = ItemRarity.Rare,
|
||||||
|
SocketGroups = new List<SocketGroup> {new SocketGroup(new List<Socket> {new Socket(SocketColor.Red), new Socket(SocketColor.Blue), new Socket(SocketColor.White)}, true)},
|
||||||
|
Quality = 12
|
||||||
|
};
|
||||||
|
|
||||||
|
//Act
|
||||||
|
|
||||||
|
var serializer = new XmlSerializer(item.GetType());
|
||||||
|
var output = string.Empty;
|
||||||
|
using (var textWriter = new StringWriter())
|
||||||
|
{
|
||||||
|
serializer.Serialize(textWriter, item);
|
||||||
|
output = textWriter.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
//Assert
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,39 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<configuration>
|
||||||
|
<runtime>
|
||||||
|
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="Xceed.Wpf.AvalonDock" publicKeyToken="3e4669d2f30244f4" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-3.5.0.0" newVersion="3.5.0.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="ControlzEx" publicKeyToken="f08b075e934b7045" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-2.2.0.4" newVersion="2.2.0.4" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="Xceed.Wpf.Toolkit" publicKeyToken="3e4669d2f30244f4" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-3.5.0.0" newVersion="3.5.0.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.ValueTuple" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="CommonServiceLocator" publicKeyToken="489b6accfaf20ef0" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-2.0.4.0" newVersion="2.0.4.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-4.0.4.1" newVersion="4.0.4.1" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.Windows.Interactivity" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-4.5.0.0" newVersion="4.5.0.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
</assemblyBinding>
|
||||||
|
</runtime>
|
||||||
|
</configuration>
|
|
@ -0,0 +1,26 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<configuration>
|
||||||
|
<startup>
|
||||||
|
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
|
||||||
|
</startup>
|
||||||
|
<runtime>
|
||||||
|
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.ValueTuple" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="CommonServiceLocator" publicKeyToken="489b6accfaf20ef0" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-2.0.4.0" newVersion="2.0.4.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-4.0.4.1" newVersion="4.0.4.1" />
|
||||||
|
</dependentAssembly>
|
||||||
|
</assemblyBinding>
|
||||||
|
</runtime>
|
||||||
|
</configuration>
|
|
@ -0,0 +1,8 @@
|
||||||
|
<Application x:Class="Filtration.ItemFilterPreview.App"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
Startup="Application_Startup">
|
||||||
|
<Application.Resources>
|
||||||
|
|
||||||
|
</Application.Resources>
|
||||||
|
</Application>
|
|
@ -0,0 +1,25 @@
|
||||||
|
using System.Windows;
|
||||||
|
using Castle.Facilities.TypedFactory;
|
||||||
|
using Castle.Windsor;
|
||||||
|
using Castle.Windsor.Installer;
|
||||||
|
using Filtration.ItemFilterPreview.Views;
|
||||||
|
|
||||||
|
namespace Filtration.ItemFilterPreview
|
||||||
|
{
|
||||||
|
public partial class App : Application
|
||||||
|
{
|
||||||
|
private IWindsorContainer _container;
|
||||||
|
|
||||||
|
private void Application_Startup(object sender, StartupEventArgs e)
|
||||||
|
{
|
||||||
|
_container = new WindsorContainer();
|
||||||
|
|
||||||
|
_container.AddFacility<TypedFactoryFacility>();
|
||||||
|
_container.Install(FromAssembly.InThisApplication());
|
||||||
|
_container.Install(FromAssembly.Named("Filtration.Parser"));
|
||||||
|
|
||||||
|
var mainWindow = _container.Resolve<IMainWindow>();
|
||||||
|
mainWindow.Show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,197 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="14.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>{3AB98B6E-05DB-44FA-9DAD-584AA88F0739}</ProjectGuid>
|
||||||
|
<OutputType>WinExe</OutputType>
|
||||||
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
|
<RootNamespace>Filtration.ItemFilterPreview</RootNamespace>
|
||||||
|
<AssemblyName>Filtration.ItemFilterPreview</AssemblyName>
|
||||||
|
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
||||||
|
<FileAlignment>512</FileAlignment>
|
||||||
|
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||||
|
<TargetFrameworkProfile />
|
||||||
|
</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="System" />
|
||||||
|
<Reference Include="System.Configuration" />
|
||||||
|
<Reference Include="System.Data" />
|
||||||
|
<Reference Include="System.Runtime.Remoting" />
|
||||||
|
<Reference Include="System.Web" />
|
||||||
|
<Reference Include="System.Xml" />
|
||||||
|
<Reference Include="Microsoft.CSharp" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="System.Xml.Linq" />
|
||||||
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
|
<Reference Include="System.Net.Http" />
|
||||||
|
<Reference Include="System.Xaml">
|
||||||
|
<RequiredTargetFramework>4.0</RequiredTargetFramework>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="WindowsBase" />
|
||||||
|
<Reference Include="PresentationCore" />
|
||||||
|
<Reference Include="PresentationFramework" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ApplicationDefinition Include="App.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</ApplicationDefinition>
|
||||||
|
<Compile Include="Services\BlockItemMatcher.cs" />
|
||||||
|
<Compile Include="Services\ItemFilterProcessor.cs" />
|
||||||
|
<Compile Include="UserControls\DesignTime\DesignTimeItemControl.cs" />
|
||||||
|
<Compile Include="UserControls\ItemControl.xaml.cs">
|
||||||
|
<DependentUpon>ItemControl.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="UserControls\ItemSocketsControl.xaml.cs">
|
||||||
|
<DependentUpon>ItemSocketsControl.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="UserControls\LootExplosionSceneUserControl.xaml.cs">
|
||||||
|
<DependentUpon>LootExplosionSceneUserControl.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="ViewModels\LootExplosionViewModel.cs" />
|
||||||
|
<Compile Include="ViewModels\MainWindowViewModel.cs" />
|
||||||
|
<Compile Include="Views\LootExplosionView.xaml.cs">
|
||||||
|
<DependentUpon>LootExplosionView.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="WindsorInstallers\ViewModelsInstaller.cs" />
|
||||||
|
<Compile Include="WindsorInstallers\ViewsInstaller.cs" />
|
||||||
|
<Compile Include="WindsorInstallers\ServicesInstaller.cs" />
|
||||||
|
<Page Include="UserControls\ItemControl.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
|
<Page Include="UserControls\LootExplosionSceneUserControl.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
|
<Page Include="Views\LootExplosionView.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="Views\MainWindow.xaml.cs">
|
||||||
|
<DependentUpon>MainWindow.xaml</DependentUpon>
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Page Include="UserControls\ItemSocketsControl.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="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>
|
||||||
|
<ProjectReference Include="..\Filtration.Common\Filtration.Common.csproj">
|
||||||
|
<Project>{8cb44f28-2956-4c2a-9314-72727262edd4}</Project>
|
||||||
|
<Name>Filtration.Common</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\Filtration.ObjectModel\Filtration.ObjectModel.csproj">
|
||||||
|
<Project>{4aac3beb-1dc1-483e-9d11-0e9334e80227}</Project>
|
||||||
|
<Name>Filtration.ObjectModel</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\Filtration.Parser.Interface\Filtration.Parser.Interface.csproj">
|
||||||
|
<Project>{46383f20-02df-48b4-b092-9088fa4acd5a}</Project>
|
||||||
|
<Name>Filtration.Parser.Interface</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\Filtration.Parser\Filtration.Parser.csproj">
|
||||||
|
<Project>{10a7c2bc-ec6f-4a38-bdda-e35935004c02}</Project>
|
||||||
|
<Name>Filtration.Parser</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="Resources\neversink.filter.txt" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="Resources\muldini.txt" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Folder Include="Model\" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Castle.Core">
|
||||||
|
<Version>4.4.0</Version>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="Castle.Windsor">
|
||||||
|
<Version>5.0.0</Version>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="CommonServiceLocator">
|
||||||
|
<Version>2.0.4</Version>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="Moq">
|
||||||
|
<Version>4.10.1</Version>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="MvvmLightLibs">
|
||||||
|
<Version>5.4.1.1</Version>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="System.Threading.Tasks.Extensions">
|
||||||
|
<Version>4.5.2</Version>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="System.ValueTuple">
|
||||||
|
<Version>4.5.0</Version>
|
||||||
|
</PackageReference>
|
||||||
|
</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,59 @@
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Resources;
|
||||||
|
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.ItemFilterPreview")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("")]
|
||||||
|
[assembly: AssemblyProduct("Filtration.ItemFilterPreview")]
|
||||||
|
[assembly: AssemblyCopyright("Copyright © 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.ItemFilterPreview.Tests")]
|
||||||
|
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")]
|
|
@ -0,0 +1,100 @@
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// This code was generated by a tool.
|
||||||
|
// Runtime Version:4.0.30319.42000
|
||||||
|
//
|
||||||
|
// Changes to this file may cause incorrect behavior and will be lost if
|
||||||
|
// the code is regenerated.
|
||||||
|
// </auto-generated>
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace Filtration.ItemFilterPreview.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.ItemFilterPreview.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 string similar to ###############################################################################
|
||||||
|
///################ Path of Exile Item Filter - Script by Muldini ################
|
||||||
|
///###############################################################################
|
||||||
|
///############ http://www.pathofexile.com/forum/view-thread/1259059 #############
|
||||||
|
///
|
||||||
|
///
|
||||||
|
///
|
||||||
|
///
|
||||||
|
///###############################################################################
|
||||||
|
///### Overview ##################################################################
|
||||||
|
///################## [rest of string was truncated]";.
|
||||||
|
/// </summary>
|
||||||
|
internal static string muldini {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("muldini", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to #---------------------------------------------------------------------------------------------------------------
|
||||||
|
///# NeverSink's Indepth Loot Filter
|
||||||
|
///# VERSION 3.0 - Full
|
||||||
|
///#---------------------------------------------------------------------------------------------------------------
|
||||||
|
///#
|
||||||
|
///# You can always find the latest version here:
|
||||||
|
///# http://pastebin.com/Af00CbhA
|
||||||
|
///# Forum discussion thread. You can post question and feedback here:
|
||||||
|
///# http://www.pathofexile.com/forum/view-thread/1246208/page/1
|
||||||
|
///# Please use [rest of string was truncated]";.
|
||||||
|
/// </summary>
|
||||||
|
internal static string neversinkfilter {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("neversinkfilter", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,127 @@
|
||||||
|
<?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="muldini" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\muldini.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
|
||||||
|
</data>
|
||||||
|
<data name="neversinkfilter" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\neversink.filter.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
|
||||||
|
</data>
|
||||||
|
</root>
|
|
@ -0,0 +1,26 @@
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// This code was generated by a tool.
|
||||||
|
// Runtime Version:4.0.30319.42000
|
||||||
|
//
|
||||||
|
// Changes to this file may cause incorrect behavior and will be lost if
|
||||||
|
// the code is regenerated.
|
||||||
|
// </auto-generated>
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace Filtration.ItemFilterPreview.Properties {
|
||||||
|
|
||||||
|
|
||||||
|
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||||
|
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.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.
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,155 @@
|
||||||
|
using System.Linq;
|
||||||
|
using Filtration.ObjectModel;
|
||||||
|
using Filtration.ObjectModel.BlockItemBaseTypes;
|
||||||
|
using Filtration.ObjectModel.BlockItemTypes;
|
||||||
|
|
||||||
|
namespace Filtration.ItemFilterPreview.Services
|
||||||
|
{
|
||||||
|
internal interface IBlockItemMatcher
|
||||||
|
{
|
||||||
|
bool ItemBlockMatch(IItemFilterBlock block, IItem item);
|
||||||
|
bool ItemBlockItemMatch(IItemFilterBlockItem blockItem, IItem item);
|
||||||
|
}
|
||||||
|
|
||||||
|
internal class BlockItemMatcher : IBlockItemMatcher
|
||||||
|
{
|
||||||
|
public bool ItemBlockMatch(IItemFilterBlock block, IItem item)
|
||||||
|
{
|
||||||
|
|
||||||
|
var match = block.BlockItems
|
||||||
|
.Where(blockItem => !(blockItem is IAudioVisualBlockItem) && !(blockItem is ActionBlockItem))
|
||||||
|
.All(blockItem => ItemBlockItemMatch(blockItem, item));
|
||||||
|
|
||||||
|
return match;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool ItemBlockItemMatch(IItemFilterBlockItem blockItem, IItem item)
|
||||||
|
{
|
||||||
|
var blockItemType = blockItem.GetType();
|
||||||
|
|
||||||
|
if (blockItemType == typeof (BaseTypeBlockItem))
|
||||||
|
return BaseTypeBlockItemMatch((BaseTypeBlockItem)blockItem, item);
|
||||||
|
|
||||||
|
if (blockItemType == typeof (ClassBlockItem))
|
||||||
|
return ClassBlockItemMatch((ClassBlockItem) blockItem, item);
|
||||||
|
|
||||||
|
if (blockItemType == typeof(DropLevelBlockItem))
|
||||||
|
return DropLevelBlockItemMatch((DropLevelBlockItem)blockItem, item);
|
||||||
|
|
||||||
|
if (blockItemType == typeof(HeightBlockItem))
|
||||||
|
return HeightBlockItemMatch((HeightBlockItem)blockItem, item);
|
||||||
|
|
||||||
|
if (blockItemType == typeof(ItemLevelBlockItem))
|
||||||
|
return ItemLevelBlockItemMatch((ItemLevelBlockItem)blockItem, item);
|
||||||
|
|
||||||
|
if (blockItemType == typeof(LinkedSocketsBlockItem))
|
||||||
|
return LinkedSocketsBlockItemMatch((LinkedSocketsBlockItem)blockItem, item);
|
||||||
|
|
||||||
|
if (blockItemType == typeof(QualityBlockItem))
|
||||||
|
return QualityBlockItemMatch((QualityBlockItem)blockItem, item);
|
||||||
|
|
||||||
|
if (blockItemType == typeof(RarityBlockItem))
|
||||||
|
return RarityBlockItemMatch((RarityBlockItem)blockItem, item);
|
||||||
|
|
||||||
|
if (blockItemType == typeof(SocketsBlockItem))
|
||||||
|
return SocketsBlockItemMatch((SocketsBlockItem)blockItem, item);
|
||||||
|
|
||||||
|
if (blockItemType == typeof(WidthBlockItem))
|
||||||
|
return WidthBlockItemMatch((WidthBlockItem)blockItem, item);
|
||||||
|
|
||||||
|
if (blockItemType == typeof(SocketGroupBlockItem))
|
||||||
|
return SocketGroupBlockItemMatch((SocketGroupBlockItem)blockItem, item);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool BaseTypeBlockItemMatch(BaseTypeBlockItem baseTypeBlockItem, IItem item)
|
||||||
|
{
|
||||||
|
return baseTypeBlockItem.Items.Any(b => item.BaseType.StartsWith(b));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool ClassBlockItemMatch(ClassBlockItem classBlockItem, IItem item)
|
||||||
|
{
|
||||||
|
return classBlockItem.Items.Any(c => item.ItemClass.Contains(c));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool DropLevelBlockItemMatch(DropLevelBlockItem dropLevelBlockItem, IItem item)
|
||||||
|
{
|
||||||
|
return NumericFilterPredicateBlockItemMatch(dropLevelBlockItem, item.DropLevel);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool HeightBlockItemMatch(HeightBlockItem heightBlockItem, IItem item)
|
||||||
|
{
|
||||||
|
return NumericFilterPredicateBlockItemMatch(heightBlockItem, item.Height);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool ItemLevelBlockItemMatch(ItemLevelBlockItem itemLevelBlockItem, IItem item)
|
||||||
|
{
|
||||||
|
return NumericFilterPredicateBlockItemMatch(itemLevelBlockItem, item.ItemLevel);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool LinkedSocketsBlockItemMatch(LinkedSocketsBlockItem linkedSocketsBlockItem, IItem item)
|
||||||
|
{
|
||||||
|
return NumericFilterPredicateBlockItemMatch(linkedSocketsBlockItem, item.LinkedSockets);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool QualityBlockItemMatch(QualityBlockItem qualityBlockItem, IItem item)
|
||||||
|
{
|
||||||
|
return NumericFilterPredicateBlockItemMatch(qualityBlockItem, item.Quality);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool RarityBlockItemMatch(RarityBlockItem qualityBlockItem, IItem item)
|
||||||
|
{
|
||||||
|
return NumericFilterPredicateBlockItemMatch(qualityBlockItem, (int)item.ItemRarity);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool SocketsBlockItemMatch(SocketsBlockItem socketsBlockItem, IItem item)
|
||||||
|
{
|
||||||
|
return NumericFilterPredicateBlockItemMatch(socketsBlockItem, item.SocketCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool WidthBlockItemMatch(WidthBlockItem widthBlockItem, IItem item)
|
||||||
|
{
|
||||||
|
return NumericFilterPredicateBlockItemMatch(widthBlockItem, item.Width);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool SocketGroupBlockItemMatch(SocketGroupBlockItem socketGroupBlockItem, IItem item)
|
||||||
|
{
|
||||||
|
|
||||||
|
foreach (var blockItemSocketGroup in socketGroupBlockItem.SocketGroups) // for each group of sockets in the block item
|
||||||
|
{
|
||||||
|
foreach (var itemLinkedSocketGroup in item.LinkedSocketGroups) // for each linked socket group in the item
|
||||||
|
{
|
||||||
|
if (SocketGroupHasRequiredSocketColors(itemLinkedSocketGroup, blockItemSocketGroup))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool SocketGroupHasRequiredSocketColors(SocketGroup itemLinkedSocketGroup, SocketGroup blockItemSocketGroup)
|
||||||
|
{
|
||||||
|
|
||||||
|
var blockSocketGroupColorCounts = blockItemSocketGroup.GroupBy(i => i.Color, (key, values) => new { SocketColor = key, Count = values.Count() }).ToList();
|
||||||
|
var itemSocketGroupColorCounts = itemLinkedSocketGroup.GroupBy(i => i.Color, (key, values) => new {SocketColor = key, Count = values.Count()}).ToList();
|
||||||
|
|
||||||
|
foreach (var blockItemSocketColorCount in blockSocketGroupColorCounts)
|
||||||
|
{
|
||||||
|
var match = itemSocketGroupColorCounts.FirstOrDefault(i => i.SocketColor == blockItemSocketColorCount.SocketColor && i.Count >= blockItemSocketColorCount.Count);
|
||||||
|
if (match == null)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool NumericFilterPredicateBlockItemMatch<T>(T numericFilterPredicateBlockItem, int matchValue) where T : NumericFilterPredicateBlockItem
|
||||||
|
{
|
||||||
|
return numericFilterPredicateBlockItem.FilterPredicate.CompareUsing(matchValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,48 @@
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Linq;
|
||||||
|
using Filtration.ObjectModel;
|
||||||
|
|
||||||
|
namespace Filtration.ItemFilterPreview.Services
|
||||||
|
{
|
||||||
|
internal interface IItemFilterProcessor
|
||||||
|
{
|
||||||
|
List<IFilteredItem> ProcessItemsAgainstItemFilterScript(IItemFilterScript itemFilterScript, IEnumerable<IItem> items);
|
||||||
|
}
|
||||||
|
|
||||||
|
internal class ItemFilterProcessor : IItemFilterProcessor
|
||||||
|
{
|
||||||
|
private readonly IBlockItemMatcher _blockItemMatcher;
|
||||||
|
|
||||||
|
public ItemFilterProcessor(IBlockItemMatcher blockItemMatcher)
|
||||||
|
{
|
||||||
|
_blockItemMatcher = blockItemMatcher;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<IFilteredItem> ProcessItemsAgainstItemFilterScript(IItemFilterScript itemFilterScript, IEnumerable<IItem> items)
|
||||||
|
{
|
||||||
|
var overallsw = Stopwatch.StartNew();
|
||||||
|
|
||||||
|
var filteredItems = new List<IFilteredItem>();
|
||||||
|
|
||||||
|
var sw = Stopwatch.StartNew();
|
||||||
|
foreach (var item in items)
|
||||||
|
{
|
||||||
|
sw.Restart();
|
||||||
|
|
||||||
|
var matchedBlock = itemFilterScript.ItemFilterBlocks
|
||||||
|
.OfType<IItemFilterBlock>()
|
||||||
|
.FirstOrDefault(block => _blockItemMatcher.ItemBlockMatch(block, item));
|
||||||
|
|
||||||
|
filteredItems.Add(new FilteredItem(item, matchedBlock));
|
||||||
|
|
||||||
|
Debug.WriteLine("Processed Item in {0}ms", sw.ElapsedMilliseconds);
|
||||||
|
}
|
||||||
|
sw.Stop();
|
||||||
|
|
||||||
|
overallsw.Stop();
|
||||||
|
Debug.WriteLine("Total processing time: {0}ms", overallsw.ElapsedMilliseconds);
|
||||||
|
return filteredItems;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
using System.Windows.Media;
|
||||||
|
using Filtration.ObjectModel;
|
||||||
|
using Moq;
|
||||||
|
|
||||||
|
namespace Filtration.ItemFilterPreview.UserControls.DesignTime
|
||||||
|
{
|
||||||
|
public class DesignTimeItemControl
|
||||||
|
{
|
||||||
|
public IFilteredItem FilteredItem
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return Mock.Of<IFilteredItem>(f => f.BackgroundColor == Colors.Bisque && f.TextColor == Colors.Maroon && f.BorderColor == Colors.CornflowerBlue && f.FontSize == 15);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,39 @@
|
||||||
|
<UserControl x:Class="Filtration.ItemFilterPreview.UserControls.ItemControl"
|
||||||
|
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:designTime="clr-namespace:Filtration.ItemFilterPreview.UserControls.DesignTime"
|
||||||
|
xmlns:converters="clr-namespace:Filtration.Common.Converters;assembly=Filtration.Common"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DataContext="{d:DesignInstance Type=designTime:DesignTimeItemControl, IsDesignTimeCreatable=True}"
|
||||||
|
d:DesignHeight="35" d:DesignWidth="170">
|
||||||
|
<UserControl.Resources>
|
||||||
|
<Style x:Key="PathOfExileFont" TargetType="{x:Type TextBlock}">
|
||||||
|
<Setter Property="FontFamily" Value="pack://application:,,,/resources/#Fontin SmallCaps" />
|
||||||
|
</Style>
|
||||||
|
<converters:ColorToSolidColorBrushConverter x:Key="ColorToSolidColorBrushConverter"/>
|
||||||
|
</UserControl.Resources>
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="*" />
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
|
<RowDefinition Height="*" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
<ColumnDefinition Width="Auto" />
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Border Grid.Row="1" Grid.Column="1" Margin="3" Padding="4,0,4,0" BorderThickness="1" BorderBrush="{Binding FilteredItem.BorderColor, Converter={StaticResource ColorToSolidColorBrushConverter}}">
|
||||||
|
<Border.Background>
|
||||||
|
<SolidColorBrush Color="{Binding FilteredItem.BackgroundColor}" />
|
||||||
|
</Border.Background>
|
||||||
|
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Text="{Binding FilteredItem.Item.Description}" Style="{StaticResource PathOfExileFont}" FontSize="{Binding FilteredItem.FontSize}">
|
||||||
|
<TextBlock.Foreground>
|
||||||
|
<SolidColorBrush Color="{Binding FilteredItem.TextColor}" />
|
||||||
|
</TextBlock.Foreground>
|
||||||
|
</TextBlock>
|
||||||
|
</Border>
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
|
@ -0,0 +1,29 @@
|
||||||
|
using System.Windows;
|
||||||
|
using Filtration.ObjectModel;
|
||||||
|
|
||||||
|
namespace Filtration.ItemFilterPreview.UserControls
|
||||||
|
{
|
||||||
|
public partial class ItemControl
|
||||||
|
{
|
||||||
|
public ItemControl()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
// ReSharper disable once PossibleNullReferenceException
|
||||||
|
(Content as FrameworkElement).DataContext = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static readonly DependencyProperty FilteredItemProperty = DependencyProperty.Register(
|
||||||
|
"FilteredItem",
|
||||||
|
typeof (IFilteredItem),
|
||||||
|
typeof (ItemControl),
|
||||||
|
new FrameworkPropertyMetadata()
|
||||||
|
);
|
||||||
|
|
||||||
|
public IFilteredItem FilteredItem
|
||||||
|
{
|
||||||
|
get { return (IFilteredItem)GetValue(FilteredItemProperty); }
|
||||||
|
set { SetValue(FilteredItemProperty, value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,55 @@
|
||||||
|
<UserControl x:Class="Filtration.ItemFilterPreview.UserControls.ItemSocketsControl"
|
||||||
|
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:local="clr-namespace:Filtration.ItemFilterPreview.UserControls"
|
||||||
|
mc:Ignorable="d" SizeChanged="ItemSocketsControl_OnSizeChanged" RenderOptions.EdgeMode="Aliased" SnapsToDevicePixels="True"
|
||||||
|
Height="29" Width="17" >
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="2*"/>
|
||||||
|
<ColumnDefinition Width="3*"/>
|
||||||
|
<ColumnDefinition Width="2*"/>
|
||||||
|
<ColumnDefinition Width="3*"/>
|
||||||
|
<ColumnDefinition Width="2*"/>
|
||||||
|
<ColumnDefinition Width="3*"/>
|
||||||
|
<ColumnDefinition Width="2*"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="2"/>
|
||||||
|
<RowDefinition Height="3"/>
|
||||||
|
<RowDefinition Height="2"/>
|
||||||
|
<RowDefinition Height="4"/>
|
||||||
|
<RowDefinition Height="2"/>
|
||||||
|
<RowDefinition Height="3"/>
|
||||||
|
<RowDefinition Height="2"/>
|
||||||
|
<RowDefinition Height="4"/>
|
||||||
|
<RowDefinition Height="2"/>
|
||||||
|
<RowDefinition Height="3"/>
|
||||||
|
<RowDefinition Height="2"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<Border Grid.Row="0" Grid.RowSpan="3" Grid.Column="0" Grid.ColumnSpan="3" Background="Tomato" />
|
||||||
|
|
||||||
|
<Border Grid.Row="1" Grid.Column="3" Background="White" />
|
||||||
|
|
||||||
|
<Border Grid.Row="0" Grid.RowSpan="3" Grid.Column="4" Grid.ColumnSpan="3" Background="GreenYellow" />
|
||||||
|
|
||||||
|
<Border Grid.Row="3" Grid.Column="5" Background="White" />
|
||||||
|
|
||||||
|
<Border Grid.Row="4" Grid.RowSpan="3" Grid.Column="4" Grid.ColumnSpan="3" Background="GreenYellow" />
|
||||||
|
|
||||||
|
<Border Grid.Row="5" Grid.Column="3" Background="White" />
|
||||||
|
|
||||||
|
<Border Grid.Row="4" Grid.RowSpan="3" Grid.Column="0" Grid.ColumnSpan="3" Background="CornflowerBlue" />
|
||||||
|
|
||||||
|
<Border Grid.Row="7" Grid.Column="1" Background="White" />
|
||||||
|
|
||||||
|
<Border Grid.Row="8" Grid.RowSpan="3" Grid.Column="0" Grid.ColumnSpan="3" Background="CornflowerBlue" />
|
||||||
|
|
||||||
|
<Border Grid.Row="9" Grid.Column="3" Background="White" />
|
||||||
|
|
||||||
|
<Border Grid.Row="8" Grid.RowSpan="3" Grid.Column="4" Grid.ColumnSpan="3" Background="Tomato" />
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
|
@ -0,0 +1,18 @@
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
namespace Filtration.ItemFilterPreview.UserControls
|
||||||
|
{
|
||||||
|
public partial class ItemSocketsControl
|
||||||
|
{
|
||||||
|
public ItemSocketsControl()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ItemSocketsControl_OnSizeChanged(object sender, SizeChangedEventArgs e)
|
||||||
|
{
|
||||||
|
const double ratio = 2d/3d;
|
||||||
|
Width = Height * ratio;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
<UserControl x:Class="Filtration.ItemFilterPreview.UserControls.LootExplosionSceneUserControl"
|
||||||
|
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:local="clr-namespace:Filtration.ItemFilterPreview.UserControls"
|
||||||
|
xmlns:model="clr-namespace:Filtration.ObjectModel;assembly=Filtration.ObjectModel"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DesignHeight="300" d:DesignWidth="300" d:DataContext="{d:DesignInstance local:LootExplosionSceneUserControl}">
|
||||||
|
<Grid Background="DimGray">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Button Grid.Row="0" Click="ButtonBase_OnClick">Test Canvas</Button>
|
||||||
|
<ItemsControl Grid.Row="1" ItemsSource="{Binding FilteredItems}" x:Name="FilteredItemsControl" Height="800">
|
||||||
|
<ItemsControl.ItemsPanel>
|
||||||
|
<ItemsPanelTemplate>
|
||||||
|
<Canvas />
|
||||||
|
</ItemsPanelTemplate>
|
||||||
|
</ItemsControl.ItemsPanel>
|
||||||
|
<ItemsControl.ItemTemplate>
|
||||||
|
<DataTemplate DataType="{x:Type model:IFilteredItem}">
|
||||||
|
<local:ItemControl FilteredItem="{Binding}" />
|
||||||
|
</DataTemplate>
|
||||||
|
</ItemsControl.ItemTemplate>
|
||||||
|
</ItemsControl>
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
|
@ -0,0 +1,83 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using Filtration.ObjectModel;
|
||||||
|
|
||||||
|
namespace Filtration.ItemFilterPreview.UserControls
|
||||||
|
{
|
||||||
|
public partial class LootExplosionSceneUserControl : UserControl
|
||||||
|
{
|
||||||
|
public LootExplosionSceneUserControl()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static readonly DependencyProperty FilteredItemsProperty = DependencyProperty.Register(
|
||||||
|
"FilteredItems",
|
||||||
|
typeof(IEnumerable<IFilteredItem>),
|
||||||
|
typeof(LootExplosionSceneUserControl),
|
||||||
|
new FrameworkPropertyMetadata()
|
||||||
|
);
|
||||||
|
|
||||||
|
public IEnumerable<IFilteredItem> FilteredItems
|
||||||
|
{
|
||||||
|
get { return (IEnumerable<IFilteredItem>)GetValue(FilteredItemsProperty); }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetValue(FilteredItemsProperty, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LootCanvas_OnSourceUpdated(object sender, DataTransferEventArgs e)
|
||||||
|
{
|
||||||
|
var canvas = sender as Canvas;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonBase_OnClick(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
var canvas = GetItemsPanel(FilteredItemsControl) as Canvas;
|
||||||
|
if (canvas == null) return;
|
||||||
|
var rand = new Random();
|
||||||
|
|
||||||
|
foreach (var child in canvas.Children.OfType<ContentPresenter>())
|
||||||
|
{
|
||||||
|
Canvas.SetLeft(child, rand.Next((int)(canvas.ActualWidth - child.ActualWidth)));
|
||||||
|
Canvas.SetTop(child, rand.Next((int)(canvas.ActualHeight - child.ActualHeight)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Panel GetItemsPanel(DependencyObject itemsControl)
|
||||||
|
{
|
||||||
|
var itemsPresenter = GetVisualChild<ItemsPresenter>(itemsControl);
|
||||||
|
var itemsPanel = VisualTreeHelper.GetChild(itemsPresenter, 0) as Panel;
|
||||||
|
return itemsPanel;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static T GetVisualChild<T>(DependencyObject parent) where T : Visual
|
||||||
|
{
|
||||||
|
var child = default(T);
|
||||||
|
|
||||||
|
var numVisuals = VisualTreeHelper.GetChildrenCount(parent);
|
||||||
|
for (var i = 0; i < numVisuals; i++)
|
||||||
|
{
|
||||||
|
var v = (Visual)VisualTreeHelper.GetChild(parent, i);
|
||||||
|
child = v as T;
|
||||||
|
if (child == null)
|
||||||
|
{
|
||||||
|
child = GetVisualChild<T>(v);
|
||||||
|
}
|
||||||
|
if (child != null)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return child;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
namespace Filtration.ItemFilterPreview.ViewModels
|
||||||
|
{
|
||||||
|
internal class LootExplosionViewModel
|
||||||
|
{
|
||||||
|
public LootExplosionViewModel()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,189 @@
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using Filtration.ItemFilterPreview.Properties;
|
||||||
|
using Filtration.ItemFilterPreview.Services;
|
||||||
|
using Filtration.ObjectModel;
|
||||||
|
using Filtration.ObjectModel.Enums;
|
||||||
|
using Filtration.Parser.Interface.Services;
|
||||||
|
using GalaSoft.MvvmLight;
|
||||||
|
using GalaSoft.MvvmLight.CommandWpf;
|
||||||
|
|
||||||
|
namespace Filtration.ItemFilterPreview.ViewModels
|
||||||
|
{
|
||||||
|
internal interface IMainWindowViewModel
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
internal class MainWindowViewModel : ViewModelBase, IMainWindowViewModel
|
||||||
|
{
|
||||||
|
private readonly IItemFilterScriptTranslator _itemFilterScriptTranslator;
|
||||||
|
private readonly IItemFilterProcessor _itemFilterProcessor;
|
||||||
|
private IItemFilterScript _itemFilterScript;
|
||||||
|
|
||||||
|
|
||||||
|
public MainWindowViewModel(IItemFilterScriptTranslator itemFilterScriptTranslator, IItemFilterProcessor itemFilterProcessor)
|
||||||
|
{
|
||||||
|
_itemFilterScriptTranslator = itemFilterScriptTranslator;
|
||||||
|
_itemFilterProcessor = itemFilterProcessor;
|
||||||
|
LoadScriptCommand = new RelayCommand(OnLoadScriptCommand);
|
||||||
|
LoadAlternateScriptCommand = new RelayCommand(OnLoadAlternateScriptCommand);
|
||||||
|
ProcessItemFilterCommand = new RelayCommand(OnProcessItemFilterCommand);
|
||||||
|
}
|
||||||
|
|
||||||
|
public RelayCommand LoadScriptCommand { get; private set; }
|
||||||
|
public RelayCommand LoadAlternateScriptCommand { get; private set; }
|
||||||
|
public RelayCommand ProcessItemFilterCommand { get; private set; }
|
||||||
|
|
||||||
|
public IEnumerable<IFilteredItem> FilteredItems
|
||||||
|
{
|
||||||
|
get { return _filteredItems; }
|
||||||
|
private set
|
||||||
|
{
|
||||||
|
_filteredItems = value;
|
||||||
|
RaisePropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnLoadScriptCommand()
|
||||||
|
{
|
||||||
|
_itemFilterScript = _itemFilterScriptTranslator.TranslateStringToItemFilterScript(Resources.neversinkfilter);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnLoadAlternateScriptCommand()
|
||||||
|
{
|
||||||
|
_itemFilterScript = _itemFilterScriptTranslator.TranslateStringToItemFilterScript(Resources.muldini);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnProcessItemFilterCommand()
|
||||||
|
{
|
||||||
|
FilteredItems = _itemFilterProcessor.ProcessItemsAgainstItemFilterScript(_itemFilterScript, TestItems);
|
||||||
|
}
|
||||||
|
|
||||||
|
private readonly List<IItem> TestItems = new List<IItem>
|
||||||
|
{
|
||||||
|
new Item
|
||||||
|
{
|
||||||
|
Description = "Full Plate",
|
||||||
|
BaseType = "Full Plate",
|
||||||
|
ItemClass = "Body Armors",
|
||||||
|
ItemRarity = ItemRarity.Normal,
|
||||||
|
ItemLevel = 66,
|
||||||
|
DropLevel = 28,
|
||||||
|
Height = 3,
|
||||||
|
Width = 2,
|
||||||
|
SocketGroups = new List<SocketGroup> {new SocketGroup(new List<Socket> { new Socket(SocketColor.Red) , new Socket(SocketColor.Red) , new Socket(SocketColor.Red) , new Socket(SocketColor.Red) , new Socket(SocketColor.Red) , new Socket(SocketColor.Red) }, true)}
|
||||||
|
},
|
||||||
|
new Item
|
||||||
|
{
|
||||||
|
Description = "Scroll of Wisdom",
|
||||||
|
BaseType = "Scroll of Wisdom",
|
||||||
|
ItemClass = "Currency",
|
||||||
|
ItemRarity = ItemRarity.Normal,
|
||||||
|
ItemLevel = 75,
|
||||||
|
DropLevel = 1,
|
||||||
|
Height = 1,
|
||||||
|
Width = 1,
|
||||||
|
SocketGroups = new List<SocketGroup>()
|
||||||
|
},
|
||||||
|
new Item
|
||||||
|
{
|
||||||
|
Description = "Unset Ring",
|
||||||
|
BaseType = "Unset Ring",
|
||||||
|
ItemClass = "Rings",
|
||||||
|
ItemRarity = ItemRarity.Rare,
|
||||||
|
ItemLevel = 53,
|
||||||
|
DropLevel = 45,
|
||||||
|
Height = 1,
|
||||||
|
Width = 1,
|
||||||
|
SocketGroups = new List<SocketGroup>()
|
||||||
|
},
|
||||||
|
new Item
|
||||||
|
{
|
||||||
|
Description = "Incinerate",
|
||||||
|
BaseType = "Incinerate",
|
||||||
|
ItemClass = "Active Skill Gems",
|
||||||
|
ItemRarity = ItemRarity.Normal,
|
||||||
|
ItemLevel = 9,
|
||||||
|
DropLevel = 9,
|
||||||
|
Quality = 10,
|
||||||
|
Height = 1,
|
||||||
|
Width = 1,
|
||||||
|
SocketGroups = new List<SocketGroup>()
|
||||||
|
},
|
||||||
|
new Item
|
||||||
|
{
|
||||||
|
Description = "Mirror of Kalandra",
|
||||||
|
BaseType = "Mirror of Kalandra",
|
||||||
|
ItemClass = "Currency",
|
||||||
|
ItemRarity = ItemRarity.Normal,
|
||||||
|
ItemLevel = 77,
|
||||||
|
DropLevel = 1,
|
||||||
|
Height = 1,
|
||||||
|
Width = 1,
|
||||||
|
SocketGroups = new List<SocketGroup>()
|
||||||
|
},
|
||||||
|
new Item
|
||||||
|
{
|
||||||
|
Description = "The Gemcutter",
|
||||||
|
BaseType = "The Gemcutter",
|
||||||
|
ItemClass = "Divination Card",
|
||||||
|
ItemRarity = ItemRarity.Normal,
|
||||||
|
ItemLevel = 1,
|
||||||
|
DropLevel = 72,
|
||||||
|
Height = 1,
|
||||||
|
Width = 1,
|
||||||
|
SocketGroups = new List<SocketGroup>()
|
||||||
|
},
|
||||||
|
new Item
|
||||||
|
{
|
||||||
|
Description = "Thaumetic Sulphite",
|
||||||
|
BaseType = "Thaumetic Sulphite",
|
||||||
|
ItemClass = "Quest Items",
|
||||||
|
ItemRarity = ItemRarity.Normal,
|
||||||
|
ItemLevel = 32,
|
||||||
|
DropLevel = 1,
|
||||||
|
Height = 2,
|
||||||
|
Width = 2,
|
||||||
|
SocketGroups = new List<SocketGroup>()
|
||||||
|
},
|
||||||
|
new Item
|
||||||
|
{
|
||||||
|
Description = "Fishing Rod",
|
||||||
|
BaseType = "Fishing Rod",
|
||||||
|
ItemClass = "Fishing Rods",
|
||||||
|
ItemRarity = ItemRarity.Normal,
|
||||||
|
ItemLevel = 1,
|
||||||
|
DropLevel = 1,
|
||||||
|
Height = 4,
|
||||||
|
Width = 1,
|
||||||
|
SocketGroups = new List<SocketGroup>()
|
||||||
|
},
|
||||||
|
new Item
|
||||||
|
{
|
||||||
|
Description = "Dry Peninsula Map",
|
||||||
|
BaseType = "Dry Peninsula Map",
|
||||||
|
ItemClass = "Maps",
|
||||||
|
ItemRarity = ItemRarity.Magic,
|
||||||
|
ItemLevel = 75,
|
||||||
|
DropLevel = 75,
|
||||||
|
Height = 1,
|
||||||
|
Width = 1,
|
||||||
|
SocketGroups = new List<SocketGroup>()
|
||||||
|
},
|
||||||
|
new Item
|
||||||
|
{
|
||||||
|
Description = "Stone Hammer",
|
||||||
|
BaseType = "Stone Hammer",
|
||||||
|
ItemClass = "One Hand Maces",
|
||||||
|
ItemRarity = ItemRarity.Normal,
|
||||||
|
ItemLevel = 1,
|
||||||
|
DropLevel = 1,
|
||||||
|
Height = 3,
|
||||||
|
Width = 2,
|
||||||
|
SocketGroups = new List<SocketGroup>()
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
private IEnumerable<IFilteredItem> _filteredItems;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
<UserControl x:Class="Filtration.ItemFilterPreview.Views.LootExplosionView"
|
||||||
|
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:local="clr-namespace:Filtration.ItemFilterPreview.Views"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DesignHeight="300" d:DesignWidth="300">
|
||||||
|
|
||||||
|
<Grid>
|
||||||
|
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
|
@ -0,0 +1,28 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Navigation;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
|
||||||
|
namespace Filtration.ItemFilterPreview.Views
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for LootExplosionView.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class LootExplosionView : UserControl
|
||||||
|
{
|
||||||
|
public LootExplosionView()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
<Window x:Class="Filtration.ItemFilterPreview.Views.MainWindow"
|
||||||
|
x:ClassModifier="internal"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:userControls="clr-namespace:Filtration.ItemFilterPreview.UserControls"
|
||||||
|
xmlns:viewModels="clr-namespace:Filtration.ItemFilterPreview.ViewModels"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DataContext="{d:DesignInstance viewModels:MainWindowViewModel}"
|
||||||
|
Title="MainWindow" Height="960" Width="1280" >
|
||||||
|
<Grid>
|
||||||
|
<StackPanel>
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<Button Command="{Binding LoadScriptCommand}">Load Neversink Script</Button>
|
||||||
|
<Button Command="{Binding LoadAlternateScriptCommand}">Load Muldini Script</Button>
|
||||||
|
</StackPanel>
|
||||||
|
<Button Command="{Binding ProcessItemFilterCommand}">Process Item Filter</Button>
|
||||||
|
<userControls:LootExplosionSceneUserControl FilteredItems="{Binding FilteredItems}" />
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
|
@ -0,0 +1,18 @@
|
||||||
|
using Filtration.ItemFilterPreview.ViewModels;
|
||||||
|
|
||||||
|
namespace Filtration.ItemFilterPreview.Views
|
||||||
|
{
|
||||||
|
public interface IMainWindow
|
||||||
|
{
|
||||||
|
void Show();
|
||||||
|
}
|
||||||
|
|
||||||
|
internal partial class MainWindow : IMainWindow
|
||||||
|
{
|
||||||
|
public MainWindow(IMainWindowViewModel mainWindowViewModel)
|
||||||
|
{
|
||||||
|
DataContext = mainWindowViewModel;
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
using Castle.MicroKernel.Registration;
|
||||||
|
using Castle.MicroKernel.SubSystems.Configuration;
|
||||||
|
using Castle.Windsor;
|
||||||
|
using Filtration.ItemFilterPreview.Services;
|
||||||
|
|
||||||
|
namespace Filtration.ItemFilterPreview.WindsorInstallers
|
||||||
|
{
|
||||||
|
public class ServicesInstaller : IWindsorInstaller
|
||||||
|
{
|
||||||
|
public void Install(IWindsorContainer container, IConfigurationStore store)
|
||||||
|
{
|
||||||
|
container.Register(
|
||||||
|
Component.For<IBlockItemMatcher>()
|
||||||
|
.ImplementedBy<BlockItemMatcher>()
|
||||||
|
.LifeStyle.Singleton);
|
||||||
|
|
||||||
|
container.Register(
|
||||||
|
Component.For<IItemFilterProcessor>()
|
||||||
|
.ImplementedBy<ItemFilterProcessor>()
|
||||||
|
.LifeStyle.Singleton);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
using Castle.MicroKernel.Registration;
|
||||||
|
using Castle.MicroKernel.SubSystems.Configuration;
|
||||||
|
using Castle.Windsor;
|
||||||
|
using Filtration.ItemFilterPreview.ViewModels;
|
||||||
|
|
||||||
|
namespace Filtration.ItemFilterPreview.WindsorInstallers
|
||||||
|
{
|
||||||
|
public class ViewModelsInstaller : IWindsorInstaller
|
||||||
|
{
|
||||||
|
public void Install(IWindsorContainer container, IConfigurationStore store)
|
||||||
|
{
|
||||||
|
container.Register(
|
||||||
|
Component.For<IMainWindowViewModel>()
|
||||||
|
.ImplementedBy<MainWindowViewModel>()
|
||||||
|
.LifeStyle.Singleton);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
using Castle.MicroKernel.Registration;
|
||||||
|
using Castle.MicroKernel.SubSystems.Configuration;
|
||||||
|
using Castle.Windsor;
|
||||||
|
using Filtration.ItemFilterPreview.Views;
|
||||||
|
|
||||||
|
namespace Filtration.ItemFilterPreview.WindsorInstallers
|
||||||
|
{
|
||||||
|
public class ViewsInstaller : IWindsorInstaller
|
||||||
|
{
|
||||||
|
public void Install(IWindsorContainer container, IConfigurationStore store)
|
||||||
|
{
|
||||||
|
container.Register(
|
||||||
|
Component.For<IMainWindow>()
|
||||||
|
.ImplementedBy<MainWindow>()
|
||||||
|
.LifeStyle.Singleton);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,90 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ProjectGuid>{537BE676-2FF6-4995-B05B-9CFACE852EC9}</ProjectGuid>
|
||||||
|
<OutputType>Library</OutputType>
|
||||||
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
|
<RootNamespace>Filtration.ObjectModel.Tests</RootNamespace>
|
||||||
|
<AssemblyName>Filtration.ObjectModel.Tests</AssemblyName>
|
||||||
|
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
||||||
|
<FileAlignment>512</FileAlignment>
|
||||||
|
<TargetFrameworkProfile />
|
||||||
|
<NuGetPackageImportStamp>
|
||||||
|
</NuGetPackageImportStamp>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>bin\Debug\</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\Release\</OutputPath>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="PresentationCore" />
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Configuration" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="System.Xml.Linq" />
|
||||||
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
|
<Reference Include="Microsoft.CSharp" />
|
||||||
|
<Reference Include="System.Data" />
|
||||||
|
<Reference Include="System.Xml" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
<Compile Include="TestItemFilterBlock.cs" />
|
||||||
|
<Compile Include="TestItemFilterBlockGroup.cs" />
|
||||||
|
<Compile Include="TestItemFilterScript.cs" />
|
||||||
|
<Compile Include="ThemeEditor\TestThemeComponentCollection.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\Filtration.ObjectModel\Filtration.ObjectModel.csproj">
|
||||||
|
<Project>{4aac3beb-1dc1-483e-9d11-0e9334e80227}</Project>
|
||||||
|
<Name>Filtration.ObjectModel</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="app.config" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Castle.Core">
|
||||||
|
<Version>4.4.0</Version>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="Moq">
|
||||||
|
<Version>4.10.1</Version>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="NUnit">
|
||||||
|
<Version>3.11.0</Version>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="System.Threading.Tasks.Extensions">
|
||||||
|
<Version>4.5.2</Version>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="System.ValueTuple">
|
||||||
|
<Version>4.5.0</Version>
|
||||||
|
</PackageReference>
|
||||||
|
</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,35 @@
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
// General Information about an assembly is controlled through the following
|
||||||
|
// set of attributes. Change these attribute values to modify the information
|
||||||
|
// associated with an assembly.
|
||||||
|
[assembly: AssemblyTitle("Filtration.ObjectModel.Tests")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("Microsoft")]
|
||||||
|
[assembly: AssemblyProduct("Filtration.ObjectModel.Tests")]
|
||||||
|
[assembly: AssemblyCopyright("Copyright © Microsoft 2015")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
// Setting ComVisible to false makes the types in this assembly not visible
|
||||||
|
// to COM components. If you need to access a type in this assembly from
|
||||||
|
// COM, set the ComVisible attribute to true on that type.
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||||
|
[assembly: Guid("7ed27cde-6bc5-4d11-b45d-8823de2077ce")]
|
||||||
|
|
||||||
|
// Version information for an assembly consists of the following four values:
|
||||||
|
//
|
||||||
|
// Major Version
|
||||||
|
// Minor Version
|
||||||
|
// Build Number
|
||||||
|
// Revision
|
||||||
|
//
|
||||||
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
|
// by using the '*' as shown below:
|
||||||
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
|
[assembly: AssemblyVersion("1.0.0.0")]
|
||||||
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
|
@ -0,0 +1,54 @@
|
||||||
|
using Filtration.ObjectModel.BlockItemTypes;
|
||||||
|
using NUnit.Framework;
|
||||||
|
|
||||||
|
namespace Filtration.ObjectModel.Tests
|
||||||
|
{
|
||||||
|
[TestFixture]
|
||||||
|
public class TestItemFilterBlock
|
||||||
|
{
|
||||||
|
[Test]
|
||||||
|
public void ItemFilterBlock_AddBlockItemAllowed_LessThanMaximum_ReturnsTrue()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var block = new ItemFilterBlock();
|
||||||
|
block.BlockItems.Add(new ItemLevelBlockItem());
|
||||||
|
|
||||||
|
// Act
|
||||||
|
bool result = block.AddBlockItemAllowed(typeof (ItemLevelBlockItem));
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.IsTrue(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void ItemFilterBlock_AddBlockItemAllowed_MoreThanMaximum_ReturnsFalse()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var block = new ItemFilterBlock();
|
||||||
|
block.BlockItems.Add(new SoundBlockItem());
|
||||||
|
|
||||||
|
// Act
|
||||||
|
bool result = block.AddBlockItemAllowed(typeof (SoundBlockItem));
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.IsFalse(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void HasParentInBlockGroupHierarchy_ReturnsCorrectResult()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var testInputRootBlockGroup = new ItemFilterBlockGroup("Root Block Group", null);
|
||||||
|
var testInputSubBlockGroup = new ItemFilterBlockGroup("Sub Block Group", testInputRootBlockGroup);
|
||||||
|
var testInputSubSubBlockGroup = new ItemFilterBlockGroup("Sub Sub Block Group", testInputSubBlockGroup);
|
||||||
|
|
||||||
|
var block = new ItemFilterBlock {BlockGroup = testInputSubSubBlockGroup};
|
||||||
|
|
||||||
|
// Act
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.AreEqual(true, block.HasBlockGroupInParentHierarchy(testInputRootBlockGroup, block.BlockGroup));
|
||||||
|
Assert.AreEqual(true, block.HasBlockGroupInParentHierarchy(testInputSubBlockGroup, block.BlockGroup));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,42 @@
|
||||||
|
using NUnit.Framework;
|
||||||
|
|
||||||
|
namespace Filtration.ObjectModel.Tests
|
||||||
|
{
|
||||||
|
[TestFixture]
|
||||||
|
public class TestItemFilterBlockGroup
|
||||||
|
{
|
||||||
|
[Test]
|
||||||
|
public void ToString_ReturnsFullBlockHierarchy()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
const string expectedResult = "Child 1 Block Group - Child 2 Block Group";
|
||||||
|
|
||||||
|
var rootBlockGroup = new ItemFilterBlockGroup("Root Block Group", null);
|
||||||
|
var child1BlockGroup = new ItemFilterBlockGroup("Child 1 Block Group", rootBlockGroup);
|
||||||
|
var child2BlockGroup = new ItemFilterBlockGroup("Child 2 Block Group", child1BlockGroup);
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var result = child2BlockGroup.ToString();
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.AreEqual(expectedResult, result);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void ToString_AddsTildeForAdvancedBlock()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
const string expectedResult = "~Child 1 Block Group - Child 2 Block Group";
|
||||||
|
|
||||||
|
var rootBlockGroup = new ItemFilterBlockGroup("Root Block Group", null);
|
||||||
|
var child1BlockGroup = new ItemFilterBlockGroup("Child 1 Block Group", rootBlockGroup, true);
|
||||||
|
var child2BlockGroup = new ItemFilterBlockGroup("Child 2 Block Group", child1BlockGroup);
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var result = child2BlockGroup.ToString();
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.AreEqual(expectedResult, result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,122 @@
|
||||||
|
using System.Linq;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using Filtration.ObjectModel.BlockItemTypes;
|
||||||
|
using NUnit.Framework;
|
||||||
|
|
||||||
|
namespace Filtration.ObjectModel.Tests
|
||||||
|
{
|
||||||
|
[TestFixture]
|
||||||
|
public class TestItemFilterScript
|
||||||
|
{
|
||||||
|
[Test]
|
||||||
|
public void Validate_AtLeastOneBlock_Fail_ReturnsListWithCorrectError()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
|
||||||
|
var script = new ItemFilterScript();
|
||||||
|
|
||||||
|
// 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 ItemFilterScript();
|
||||||
|
script.ItemFilterBlocks.Add(new ItemFilterBlock());
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var result = script.Validate();
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.AreEqual(0, result.Count(r => r.Contains("A script must have at least one block")));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void ReplaceColors_ReplacesBackgroundColorsCorrectly()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var oldColor = new Color {A = 255, R = 255, G = 0, B = 0};
|
||||||
|
var newColor = new Color {A = 255, R = 0, G = 255, B = 100};
|
||||||
|
|
||||||
|
var testInputReplaceColors = new ReplaceColorsParameterSet
|
||||||
|
{
|
||||||
|
OldBackgroundColor = oldColor,
|
||||||
|
NewBackgroundColor = newColor,
|
||||||
|
ReplaceBackgroundColor = true
|
||||||
|
};
|
||||||
|
|
||||||
|
var testInputBlock1 = new ItemFilterBlock();
|
||||||
|
testInputBlock1.BlockItems.Add(new BackgroundColorBlockItem(new Color {A = 255, R = 255, G = 0, B = 0}));
|
||||||
|
var testInputBlock2 = new ItemFilterBlock();
|
||||||
|
testInputBlock2.BlockItems.Add(new BackgroundColorBlockItem(new Color { A = 255, R = 255, G = 1, B = 0 }));
|
||||||
|
var testInputBlock3 = new ItemFilterBlock();
|
||||||
|
testInputBlock3.BlockItems.Add(new BackgroundColorBlockItem(new Color { A = 255, R = 255, G = 0, B = 0 }));
|
||||||
|
|
||||||
|
var script = new ItemFilterScript();
|
||||||
|
|
||||||
|
script.ItemFilterBlocks.Add(testInputBlock1);
|
||||||
|
script.ItemFilterBlocks.Add(testInputBlock2);
|
||||||
|
script.ItemFilterBlocks.Add(testInputBlock3);
|
||||||
|
|
||||||
|
|
||||||
|
// Act
|
||||||
|
script.ReplaceColors(testInputReplaceColors);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.AreEqual(newColor, testInputBlock1.BlockItems.OfType<BackgroundColorBlockItem>().First().Color);
|
||||||
|
Assert.AreNotEqual(newColor, testInputBlock2.BlockItems.OfType<BackgroundColorBlockItem>().First().Color);
|
||||||
|
Assert.AreEqual(newColor, testInputBlock3.BlockItems.OfType<BackgroundColorBlockItem>().First().Color);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void ReplaceColors_OnlyReplacesColorsWhenAllSetParametersMatched()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var oldBackgroundColor = new Color { A = 255, R = 255, G = 0, B = 0 };
|
||||||
|
var newBackgroundColor = new Color { A = 255, R = 0, G = 255, B = 100 };
|
||||||
|
|
||||||
|
var oldTextColor = new Color { A = 255, R = 100, G = 0, B = 50 };
|
||||||
|
var newTextColor = new Color { A = 255, R = 101, G = 255, B = 51 };
|
||||||
|
|
||||||
|
var testInputReplaceColors = new ReplaceColorsParameterSet
|
||||||
|
{
|
||||||
|
OldBackgroundColor = oldBackgroundColor,
|
||||||
|
NewBackgroundColor = newBackgroundColor,
|
||||||
|
OldTextColor = oldTextColor,
|
||||||
|
NewTextColor = newTextColor,
|
||||||
|
ReplaceBackgroundColor = true,
|
||||||
|
ReplaceTextColor = true
|
||||||
|
};
|
||||||
|
|
||||||
|
var testInputBlock1 = new ItemFilterBlock();
|
||||||
|
testInputBlock1.BlockItems.Add(new BackgroundColorBlockItem(oldBackgroundColor));
|
||||||
|
testInputBlock1.BlockItems.Add(new TextColorBlockItem(oldTextColor));
|
||||||
|
var testInputBlock2 = new ItemFilterBlock();
|
||||||
|
testInputBlock2.BlockItems.Add(new BackgroundColorBlockItem(oldBackgroundColor));
|
||||||
|
testInputBlock2.BlockItems.Add(new TextColorBlockItem(new Color {A = 1, R = 2, G = 3, B = 4}));
|
||||||
|
|
||||||
|
var script = new ItemFilterScript();
|
||||||
|
script.ItemFilterBlocks.Add(testInputBlock1);
|
||||||
|
script.ItemFilterBlocks.Add(testInputBlock2);
|
||||||
|
|
||||||
|
// Act
|
||||||
|
script.ReplaceColors(testInputReplaceColors);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
// First test block has had its colors changed
|
||||||
|
Assert.AreEqual(newBackgroundColor, testInputBlock1.BlockItems.OfType<BackgroundColorBlockItem>().First().Color);
|
||||||
|
Assert.AreEqual(newTextColor, testInputBlock1.BlockItems.OfType<TextColorBlockItem>().First().Color);
|
||||||
|
|
||||||
|
// Second test block has not had its colors changed
|
||||||
|
Assert.AreEqual(oldBackgroundColor, testInputBlock2.BlockItems.OfType<BackgroundColorBlockItem>().First().Color);
|
||||||
|
Assert.AreNotEqual(newTextColor, testInputBlock2.BlockItems.OfType<TextColorBlockItem>().First().Color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
using System.Windows.Media;
|
||||||
|
using Filtration.ObjectModel.Enums;
|
||||||
|
using Filtration.ObjectModel.ThemeEditor;
|
||||||
|
using NUnit.Framework;
|
||||||
|
|
||||||
|
namespace Filtration.ObjectModel.Tests.ThemeEditor
|
||||||
|
{
|
||||||
|
[TestFixture]
|
||||||
|
public class TestThemeComponentCollection
|
||||||
|
{
|
||||||
|
[Test]
|
||||||
|
public void AddComponent_ReturnsFirstAddedComponent_WhenComponentAddedTwice()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
|
||||||
|
var testInputTargetType = ThemeComponentType.TextColor;
|
||||||
|
var testInputComponentName = "testComponent";
|
||||||
|
var testInputColor = new Color();
|
||||||
|
|
||||||
|
var componentCollection = new ThemeComponentCollection();
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var firstResult = componentCollection.AddComponent(testInputTargetType, testInputComponentName, testInputColor);
|
||||||
|
var secondResult = componentCollection.AddComponent(testInputTargetType, testInputComponentName, testInputColor);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.AreSame(firstResult, secondResult);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<configuration>
|
||||||
|
<runtime>
|
||||||
|
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="Castle.Core" publicKeyToken="407dd0808d44fbdc" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.ValueTuple" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="CommonServiceLocator" publicKeyToken="489b6accfaf20ef0" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-2.0.4.0" newVersion="2.0.4.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-4.0.4.1" newVersion="4.0.4.1" />
|
||||||
|
</dependentAssembly>
|
||||||
|
</assemblyBinding>
|
||||||
|
</runtime>
|
||||||
|
</configuration>
|
|
@ -0,0 +1,51 @@
|
||||||
|
using System.Windows.Media;
|
||||||
|
using Filtration.ObjectModel.Enums;
|
||||||
|
using Filtration.ObjectModel.Extensions;
|
||||||
|
|
||||||
|
namespace Filtration.ObjectModel.BlockItemBaseTypes
|
||||||
|
{
|
||||||
|
public sealed class ActionBlockItem : BlockItemBase
|
||||||
|
{
|
||||||
|
private BlockAction _action;
|
||||||
|
|
||||||
|
public ActionBlockItem(BlockAction action)
|
||||||
|
{
|
||||||
|
Action = action;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BlockAction Action
|
||||||
|
{
|
||||||
|
get => _action;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_action = value;
|
||||||
|
IsDirty = true;
|
||||||
|
OnPropertyChanged();
|
||||||
|
OnPropertyChanged(nameof(SummaryText));
|
||||||
|
OnPropertyChanged(nameof(SummaryBackgroundColor));
|
||||||
|
OnPropertyChanged(nameof(SummaryTextColor));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string OutputText => Action.GetAttributeDescription();
|
||||||
|
|
||||||
|
public override string PrefixText => string.Empty;
|
||||||
|
|
||||||
|
public override int MaximumAllowed => 1;
|
||||||
|
|
||||||
|
public override string DisplayHeading => "Action";
|
||||||
|
|
||||||
|
public override string SummaryText => Action == BlockAction.Show ? "Show" : "Hide";
|
||||||
|
|
||||||
|
public override Color SummaryBackgroundColor => Action == BlockAction.Show ? Colors.LimeGreen : Colors.OrangeRed;
|
||||||
|
|
||||||
|
public override Color SummaryTextColor => Action == BlockAction.Show ? Colors.Black : Colors.White;
|
||||||
|
|
||||||
|
public override BlockItemOrdering SortOrder => BlockItemOrdering.Action;
|
||||||
|
|
||||||
|
public void ToggleAction()
|
||||||
|
{
|
||||||
|
Action = Action == BlockAction.Show ? BlockAction.Hide : BlockAction.Show;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,42 @@
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using Filtration.ObjectModel.Annotations;
|
||||||
|
using Filtration.ObjectModel.Enums;
|
||||||
|
|
||||||
|
namespace Filtration.ObjectModel.BlockItemBaseTypes
|
||||||
|
{
|
||||||
|
public abstract class BlockItemBase : IItemFilterBlockItem
|
||||||
|
{
|
||||||
|
private bool _isDirty;
|
||||||
|
|
||||||
|
public abstract string PrefixText { get; }
|
||||||
|
public abstract string OutputText { 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 BlockItemOrdering SortOrder { get; }
|
||||||
|
public string Comment { get; set; }
|
||||||
|
|
||||||
|
public bool IsDirty
|
||||||
|
{
|
||||||
|
get { return _isDirty; }
|
||||||
|
protected set
|
||||||
|
{
|
||||||
|
_isDirty = value;
|
||||||
|
OnPropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public event PropertyChangedEventHandler PropertyChanged;
|
||||||
|
|
||||||
|
[NotifyPropertyChangedInvocator]
|
||||||
|
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
||||||
|
{
|
||||||
|
var handler = PropertyChanged;
|
||||||
|
handler?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
namespace Filtration.ObjectModel.BlockItemBaseTypes
|
||||||
|
{
|
||||||
|
public abstract class BooleanBlockItem : BlockItemBase
|
||||||
|
{
|
||||||
|
private bool _booleanValue;
|
||||||
|
|
||||||
|
protected BooleanBlockItem()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected BooleanBlockItem(bool booleanValue)
|
||||||
|
{
|
||||||
|
BooleanValue = booleanValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool BooleanValue
|
||||||
|
{
|
||||||
|
get { return _booleanValue; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_booleanValue = value;
|
||||||
|
IsDirty = true;
|
||||||
|
OnPropertyChanged();
|
||||||
|
OnPropertyChanged(nameof(SummaryText));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string OutputText => PrefixText + " " + BooleanValue;
|
||||||
|
public override string SummaryText => DisplayHeading + " = " + BooleanValue;
|
||||||
|
public override int MaximumAllowed => 1;
|
||||||
|
|
||||||
|
public void ToggleValue()
|
||||||
|
{
|
||||||
|
BooleanValue = !BooleanValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,74 @@
|
||||||
|
using System;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using Filtration.ObjectModel.ThemeEditor;
|
||||||
|
|
||||||
|
namespace Filtration.ObjectModel.BlockItemBaseTypes
|
||||||
|
{
|
||||||
|
public abstract class ColorBlockItem : BlockItemBase, IAudioVisualBlockItem, IBlockItemWithTheme
|
||||||
|
{
|
||||||
|
private Color _color;
|
||||||
|
private ThemeComponent _themeComponent;
|
||||||
|
|
||||||
|
protected ColorBlockItem()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected ColorBlockItem(Color color)
|
||||||
|
{
|
||||||
|
Color = color;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string OutputText => PrefixText + " " + +Color.R + " " + Color.G + " "
|
||||||
|
+ Color.B + (Color.A != 240 ? " " + Color.A : string.Empty) +
|
||||||
|
(ThemeComponent != null ? " # " + ThemeComponent.ComponentName : string.Empty);
|
||||||
|
|
||||||
|
public override string SummaryText => string.Empty;
|
||||||
|
|
||||||
|
public ThemeComponent ThemeComponent
|
||||||
|
{
|
||||||
|
get { return _themeComponent; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (_themeComponent == value){ return;}
|
||||||
|
|
||||||
|
if (_themeComponent != null)
|
||||||
|
{
|
||||||
|
_themeComponent.ThemeComponentUpdated -= OnThemeComponentUpdated;
|
||||||
|
_themeComponent.ThemeComponentDeleted -= OnThemeComponentDeleted;
|
||||||
|
}
|
||||||
|
if (value != null)
|
||||||
|
{
|
||||||
|
value.ThemeComponentUpdated += OnThemeComponentUpdated;
|
||||||
|
value.ThemeComponentDeleted += OnThemeComponentDeleted;
|
||||||
|
}
|
||||||
|
|
||||||
|
_themeComponent = value;
|
||||||
|
OnPropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Color SummaryBackgroundColor => Colors.Transparent;
|
||||||
|
public override Color SummaryTextColor => Colors.Transparent;
|
||||||
|
|
||||||
|
public Color Color
|
||||||
|
{
|
||||||
|
get { return _color; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_color = value;
|
||||||
|
IsDirty = true;
|
||||||
|
OnPropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnThemeComponentUpdated(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Color = ((ColorThemeComponent) sender).Color;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnThemeComponentDeleted(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
ThemeComponent = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,53 @@
|
||||||
|
using System;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using Filtration.ObjectModel.ThemeEditor;
|
||||||
|
|
||||||
|
namespace Filtration.ObjectModel.BlockItemBaseTypes
|
||||||
|
{
|
||||||
|
public abstract class ColorBooleanBlockItem : BlockItemBase, IAudioVisualBlockItem
|
||||||
|
{
|
||||||
|
private Color _color;
|
||||||
|
private bool _booleanValue;
|
||||||
|
|
||||||
|
protected ColorBooleanBlockItem()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected ColorBooleanBlockItem(Color color, bool booleanValue)
|
||||||
|
{
|
||||||
|
Color = color;
|
||||||
|
BooleanValue = booleanValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string OutputText => PrefixText + " " + +Color.R + " " + Color.G + " "
|
||||||
|
+ Color.B + (Color.A < 255 ? " " + Color.A : string.Empty) +
|
||||||
|
(BooleanValue ? " True" : " False");
|
||||||
|
|
||||||
|
public override string SummaryText => string.Empty;
|
||||||
|
|
||||||
|
public override Color SummaryBackgroundColor => Colors.Transparent;
|
||||||
|
public override Color SummaryTextColor => Colors.Transparent;
|
||||||
|
|
||||||
|
public Color Color
|
||||||
|
{
|
||||||
|
get { return _color; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_color = value;
|
||||||
|
IsDirty = true;
|
||||||
|
OnPropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool BooleanValue
|
||||||
|
{
|
||||||
|
get { return _booleanValue; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_booleanValue = value;
|
||||||
|
IsDirty = true;
|
||||||
|
OnPropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,48 @@
|
||||||
|
using System.Windows.Media;
|
||||||
|
|
||||||
|
namespace Filtration.ObjectModel.BlockItemBaseTypes
|
||||||
|
{
|
||||||
|
public abstract class DualIntegerBlockItem : BlockItemBase, IAudioVisualBlockItem
|
||||||
|
{
|
||||||
|
private int _value;
|
||||||
|
private int _secondValue;
|
||||||
|
|
||||||
|
protected DualIntegerBlockItem()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected DualIntegerBlockItem(int value, int secondValue)
|
||||||
|
{
|
||||||
|
Value = value;
|
||||||
|
SecondValue = secondValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string OutputText => PrefixText + " " + Value + " " + SecondValue;
|
||||||
|
|
||||||
|
public override string SummaryText => string.Empty;
|
||||||
|
public override Color SummaryBackgroundColor => Colors.Transparent;
|
||||||
|
public override Color SummaryTextColor => Colors.Transparent;
|
||||||
|
|
||||||
|
public int Value
|
||||||
|
{
|
||||||
|
get { return _value; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_value = value;
|
||||||
|
IsDirty = true;
|
||||||
|
OnPropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int SecondValue
|
||||||
|
{
|
||||||
|
get { return _secondValue; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_secondValue = value;
|
||||||
|
IsDirty = true;
|
||||||
|
OnPropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,90 @@
|
||||||
|
using System;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using Filtration.ObjectModel.Enums;
|
||||||
|
using Filtration.ObjectModel.Extensions;
|
||||||
|
using Filtration.ObjectModel.ThemeEditor;
|
||||||
|
|
||||||
|
namespace Filtration.ObjectModel.BlockItemBaseTypes
|
||||||
|
{
|
||||||
|
public abstract class EffectColorBlockItem : BlockItemBase, IAudioVisualBlockItem, IBlockItemWithTheme
|
||||||
|
{
|
||||||
|
private EffectColor _color;
|
||||||
|
private bool _temporary;
|
||||||
|
private ThemeComponent _themeComponent;
|
||||||
|
|
||||||
|
protected EffectColorBlockItem()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected EffectColorBlockItem(EffectColor color, bool temporary)
|
||||||
|
{
|
||||||
|
Color = color;
|
||||||
|
Temporary = temporary;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string OutputText => PrefixText + " " + Color.GetAttributeDescription() +
|
||||||
|
(Temporary ? " " + "Temp" : string.Empty) +
|
||||||
|
(ThemeComponent != null ? " # " + ThemeComponent.ComponentName : string.Empty);
|
||||||
|
|
||||||
|
public override string SummaryText => string.Empty;
|
||||||
|
|
||||||
|
public ThemeComponent ThemeComponent
|
||||||
|
{
|
||||||
|
get { return _themeComponent; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (_themeComponent == value) { return; }
|
||||||
|
|
||||||
|
if (_themeComponent != null)
|
||||||
|
{
|
||||||
|
_themeComponent.ThemeComponentUpdated -= OnThemeComponentUpdated;
|
||||||
|
_themeComponent.ThemeComponentDeleted -= OnThemeComponentDeleted;
|
||||||
|
}
|
||||||
|
if (value != null)
|
||||||
|
{
|
||||||
|
value.ThemeComponentUpdated += OnThemeComponentUpdated;
|
||||||
|
value.ThemeComponentDeleted += OnThemeComponentDeleted;
|
||||||
|
}
|
||||||
|
|
||||||
|
_themeComponent = value;
|
||||||
|
OnPropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Color SummaryBackgroundColor => Colors.Transparent;
|
||||||
|
public override Color SummaryTextColor => Colors.Transparent;
|
||||||
|
|
||||||
|
public EffectColor Color
|
||||||
|
{
|
||||||
|
get { return _color; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_color = value;
|
||||||
|
IsDirty = true;
|
||||||
|
OnPropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Temporary
|
||||||
|
{
|
||||||
|
get { return _temporary; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_temporary = value;
|
||||||
|
IsDirty = true;
|
||||||
|
OnPropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnThemeComponentUpdated(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Color = ((EffectColorThemeComponent)sender).EffectColor;
|
||||||
|
Temporary = ((EffectColorThemeComponent)sender).Temporary;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnThemeComponentDeleted(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
ThemeComponent = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,103 @@
|
||||||
|
using System;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using Filtration.ObjectModel.Enums;
|
||||||
|
using Filtration.ObjectModel.Extensions;
|
||||||
|
using Filtration.ObjectModel.ThemeEditor;
|
||||||
|
|
||||||
|
namespace Filtration.ObjectModel.BlockItemBaseTypes
|
||||||
|
{
|
||||||
|
public abstract class IconBlockItem : BlockItemBase, IAudioVisualBlockItem, IBlockItemWithTheme
|
||||||
|
{
|
||||||
|
private IconSize _size;
|
||||||
|
private IconColor _color;
|
||||||
|
private IconShape _shape;
|
||||||
|
private ThemeComponent _themeComponent;
|
||||||
|
|
||||||
|
protected IconBlockItem()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected IconBlockItem(IconSize size, IconColor color, IconShape shape)
|
||||||
|
{
|
||||||
|
Size = size;
|
||||||
|
Color = color;
|
||||||
|
Shape = shape;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string OutputText => PrefixText + " " + (int)Size + " " + Color.GetAttributeDescription() + " " + Shape.GetAttributeDescription() +
|
||||||
|
(ThemeComponent != null ? " # " + ThemeComponent.ComponentName : string.Empty);
|
||||||
|
|
||||||
|
public override string SummaryText => string.Empty;
|
||||||
|
|
||||||
|
public ThemeComponent ThemeComponent
|
||||||
|
{
|
||||||
|
get { return _themeComponent; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (_themeComponent == value) { return; }
|
||||||
|
|
||||||
|
if (_themeComponent != null)
|
||||||
|
{
|
||||||
|
_themeComponent.ThemeComponentUpdated -= OnThemeComponentUpdated;
|
||||||
|
_themeComponent.ThemeComponentDeleted -= OnThemeComponentDeleted;
|
||||||
|
}
|
||||||
|
if (value != null)
|
||||||
|
{
|
||||||
|
value.ThemeComponentUpdated += OnThemeComponentUpdated;
|
||||||
|
value.ThemeComponentDeleted += OnThemeComponentDeleted;
|
||||||
|
}
|
||||||
|
|
||||||
|
_themeComponent = value;
|
||||||
|
OnPropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Color SummaryBackgroundColor => Colors.Transparent;
|
||||||
|
public override Color SummaryTextColor => Colors.Transparent;
|
||||||
|
|
||||||
|
public IconSize Size
|
||||||
|
{
|
||||||
|
get { return _size; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_size = value;
|
||||||
|
IsDirty = true;
|
||||||
|
OnPropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public IconColor Color
|
||||||
|
{
|
||||||
|
get { return _color; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_color = value;
|
||||||
|
IsDirty = true;
|
||||||
|
OnPropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public IconShape Shape
|
||||||
|
{
|
||||||
|
get { return _shape; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_shape = value;
|
||||||
|
IsDirty = true;
|
||||||
|
OnPropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnThemeComponentUpdated(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Size = ((IconThemeComponent)sender).IconSize;
|
||||||
|
Color = ((IconThemeComponent)sender).IconColor;
|
||||||
|
Shape = ((IconThemeComponent)sender).IconShape;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnThemeComponentDeleted(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
ThemeComponent = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,74 @@
|
||||||
|
using System;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using Filtration.ObjectModel.ThemeEditor;
|
||||||
|
|
||||||
|
namespace Filtration.ObjectModel.BlockItemBaseTypes
|
||||||
|
{
|
||||||
|
public abstract class IntegerBlockItem : BlockItemBase, IAudioVisualBlockItem, IBlockItemWithTheme
|
||||||
|
{
|
||||||
|
private int _value;
|
||||||
|
private ThemeComponent _themeComponent;
|
||||||
|
|
||||||
|
protected IntegerBlockItem()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected IntegerBlockItem(int value)
|
||||||
|
{
|
||||||
|
Value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string OutputText => PrefixText + " " + Value + (ThemeComponent != null ? " # " + ThemeComponent.ComponentName : string.Empty);
|
||||||
|
|
||||||
|
public override string SummaryText => string.Empty;
|
||||||
|
public override Color SummaryBackgroundColor => Colors.Transparent;
|
||||||
|
public override Color SummaryTextColor => Colors.Transparent;
|
||||||
|
|
||||||
|
public abstract int Minimum { get; }
|
||||||
|
public abstract int Maximum { get; }
|
||||||
|
|
||||||
|
public ThemeComponent ThemeComponent
|
||||||
|
{
|
||||||
|
get { return _themeComponent; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (_themeComponent == value) { return; }
|
||||||
|
|
||||||
|
if (_themeComponent != null)
|
||||||
|
{
|
||||||
|
_themeComponent.ThemeComponentUpdated -= OnThemeComponentUpdated;
|
||||||
|
_themeComponent.ThemeComponentDeleted -= OnThemeComponentDeleted;
|
||||||
|
}
|
||||||
|
if (value != null)
|
||||||
|
{
|
||||||
|
value.ThemeComponentUpdated += OnThemeComponentUpdated;
|
||||||
|
value.ThemeComponentDeleted += OnThemeComponentDeleted;
|
||||||
|
}
|
||||||
|
|
||||||
|
_themeComponent = value;
|
||||||
|
OnPropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int Value
|
||||||
|
{
|
||||||
|
get { return _value; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_value = value;
|
||||||
|
IsDirty = true;
|
||||||
|
OnPropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnThemeComponentUpdated(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Value = ((IntegerBlockItem)sender).Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnThemeComponentDeleted(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
ThemeComponent = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
namespace Filtration.ObjectModel.BlockItemBaseTypes
|
||||||
|
{
|
||||||
|
public abstract class NilBlockItem : BlockItemBase
|
||||||
|
{
|
||||||
|
protected NilBlockItem()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string OutputText => PrefixText;
|
||||||
|
public override string SummaryText => DisplayHeading;
|
||||||
|
public override int MaximumAllowed => 1;
|
||||||
|
|
||||||
|
public abstract string Description { get; }
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,46 @@
|
||||||
|
using System;
|
||||||
|
using Filtration.ObjectModel.Enums;
|
||||||
|
using Filtration.ObjectModel.Extensions;
|
||||||
|
|
||||||
|
namespace Filtration.ObjectModel.BlockItemBaseTypes
|
||||||
|
{
|
||||||
|
public abstract class NumericFilterPredicateBlockItem : BlockItemBase
|
||||||
|
{
|
||||||
|
private NumericFilterPredicate _filterPredicate;
|
||||||
|
|
||||||
|
protected NumericFilterPredicateBlockItem()
|
||||||
|
{
|
||||||
|
FilterPredicate = new NumericFilterPredicate();
|
||||||
|
FilterPredicate.PropertyChanged += OnFilterPredicateChanged;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected NumericFilterPredicateBlockItem(FilterPredicateOperator predicateOperator, int predicateOperand)
|
||||||
|
{
|
||||||
|
FilterPredicate = new NumericFilterPredicate(predicateOperator, predicateOperand);
|
||||||
|
FilterPredicate.PropertyChanged += OnFilterPredicateChanged;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string OutputText => PrefixText + " " + FilterPredicate.PredicateOperator.GetAttributeDescription() +
|
||||||
|
" " + FilterPredicate.PredicateOperand;
|
||||||
|
|
||||||
|
public abstract int Minimum { get; }
|
||||||
|
public abstract int Maximum { get; }
|
||||||
|
|
||||||
|
public NumericFilterPredicate FilterPredicate
|
||||||
|
{
|
||||||
|
get { return _filterPredicate; }
|
||||||
|
protected set
|
||||||
|
{
|
||||||
|
_filterPredicate = value;
|
||||||
|
OnPropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnFilterPredicateChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
IsDirty = true;
|
||||||
|
OnPropertyChanged(nameof(FilterPredicate));
|
||||||
|
OnPropertyChanged(nameof(SummaryText));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,87 @@
|
||||||
|
using System;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using Filtration.ObjectModel.ThemeEditor;
|
||||||
|
|
||||||
|
namespace Filtration.ObjectModel.BlockItemBaseTypes
|
||||||
|
{
|
||||||
|
public abstract class StrIntBlockItem : BlockItemBase, IAudioVisualBlockItem, IBlockItemWithTheme
|
||||||
|
{
|
||||||
|
private string _value;
|
||||||
|
private int _secondValue;
|
||||||
|
private ThemeComponent _themeComponent;
|
||||||
|
|
||||||
|
protected StrIntBlockItem()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected StrIntBlockItem(string value, int secondValue)
|
||||||
|
{
|
||||||
|
Value = value;
|
||||||
|
SecondValue = secondValue;
|
||||||
|
Value = value;
|
||||||
|
SecondValue = secondValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string OutputText => PrefixText + " " + Value + " " + SecondValue + (ThemeComponent != null ? " # " + ThemeComponent.ComponentName : string.Empty);
|
||||||
|
|
||||||
|
public override string SummaryText => string.Empty;
|
||||||
|
public override Color SummaryBackgroundColor => Colors.Transparent;
|
||||||
|
public override Color SummaryTextColor => Colors.Transparent;
|
||||||
|
|
||||||
|
public ThemeComponent ThemeComponent
|
||||||
|
{
|
||||||
|
get { return _themeComponent; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (_themeComponent == value) { return; }
|
||||||
|
|
||||||
|
if (_themeComponent != null)
|
||||||
|
{
|
||||||
|
_themeComponent.ThemeComponentUpdated -= OnThemeComponentUpdated;
|
||||||
|
_themeComponent.ThemeComponentDeleted -= OnThemeComponentDeleted;
|
||||||
|
}
|
||||||
|
if (value != null)
|
||||||
|
{
|
||||||
|
value.ThemeComponentUpdated += OnThemeComponentUpdated;
|
||||||
|
value.ThemeComponentDeleted += OnThemeComponentDeleted;
|
||||||
|
}
|
||||||
|
|
||||||
|
_themeComponent = value;
|
||||||
|
OnPropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Value
|
||||||
|
{
|
||||||
|
get { return _value; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_value = value;
|
||||||
|
IsDirty = true;
|
||||||
|
OnPropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int SecondValue
|
||||||
|
{
|
||||||
|
get { return _secondValue; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_secondValue = value;
|
||||||
|
IsDirty = true;
|
||||||
|
OnPropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnThemeComponentUpdated(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Value = ((StrIntBlockItem)sender).Value;
|
||||||
|
SecondValue = ((StrIntBlockItem)sender).SecondValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnThemeComponentDeleted(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
ThemeComponent = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,72 @@
|
||||||
|
using System;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using Filtration.ObjectModel.ThemeEditor;
|
||||||
|
|
||||||
|
namespace Filtration.ObjectModel.BlockItemBaseTypes
|
||||||
|
{
|
||||||
|
public abstract class StringBlockItem : BlockItemBase, IAudioVisualBlockItem, IBlockItemWithTheme
|
||||||
|
{
|
||||||
|
private string _value;
|
||||||
|
private ThemeComponent _themeComponent;
|
||||||
|
|
||||||
|
protected StringBlockItem()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected StringBlockItem(string value)
|
||||||
|
{
|
||||||
|
Value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string OutputText => PrefixText + " \"" + Value + "\""
|
||||||
|
+ (ThemeComponent != null ? " # " + ThemeComponent.ComponentName : string.Empty);
|
||||||
|
|
||||||
|
public override string SummaryText => string.Empty;
|
||||||
|
public override Color SummaryBackgroundColor => Colors.Transparent;
|
||||||
|
public override Color SummaryTextColor => Colors.Transparent;
|
||||||
|
|
||||||
|
public ThemeComponent ThemeComponent
|
||||||
|
{
|
||||||
|
get { return _themeComponent; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (_themeComponent == value) { return; }
|
||||||
|
|
||||||
|
if (_themeComponent != null)
|
||||||
|
{
|
||||||
|
_themeComponent.ThemeComponentUpdated -= OnThemeComponentUpdated;
|
||||||
|
_themeComponent.ThemeComponentDeleted -= OnThemeComponentDeleted;
|
||||||
|
}
|
||||||
|
if (value != null)
|
||||||
|
{
|
||||||
|
value.ThemeComponentUpdated += OnThemeComponentUpdated;
|
||||||
|
value.ThemeComponentDeleted += OnThemeComponentDeleted;
|
||||||
|
}
|
||||||
|
|
||||||
|
_themeComponent = value;
|
||||||
|
OnPropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Value
|
||||||
|
{
|
||||||
|
get { return _value; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_value = value;
|
||||||
|
IsDirty = true;
|
||||||
|
OnPropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnThemeComponentUpdated(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Value = ((StringThemeComponent)sender).Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnThemeComponentDeleted(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
ThemeComponent = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,40 @@
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Collections.Specialized;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
|
namespace Filtration.ObjectModel.BlockItemBaseTypes
|
||||||
|
{
|
||||||
|
public abstract class StringListBlockItem : BlockItemBase
|
||||||
|
{
|
||||||
|
protected StringListBlockItem()
|
||||||
|
{
|
||||||
|
Items = new ObservableCollection<string>();
|
||||||
|
Items.CollectionChanged += OnItemsCollectionChanged;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string OutputText
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
var enumerable = Items as IList<string> ?? Items.ToList();
|
||||||
|
if (enumerable.Count > 0)
|
||||||
|
{
|
||||||
|
return PrefixText + " " +
|
||||||
|
$"\"{string.Join("\" \"", enumerable.ToArray())}\"";
|
||||||
|
}
|
||||||
|
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ObservableCollection<string> Items { get; protected set; }
|
||||||
|
|
||||||
|
private void OnItemsCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
|
||||||
|
{
|
||||||
|
IsDirty = true;
|
||||||
|
OnPropertyChanged(nameof(Items));
|
||||||
|
OnPropertyChanged(nameof(SummaryText));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
using System.Windows.Media;
|
||||||
|
using Filtration.ObjectModel.BlockItemBaseTypes;
|
||||||
|
using Filtration.ObjectModel.Enums;
|
||||||
|
|
||||||
|
namespace Filtration.ObjectModel.BlockItemTypes
|
||||||
|
{
|
||||||
|
public sealed class AnyEnchantmentBlockItem : BooleanBlockItem
|
||||||
|
{
|
||||||
|
public AnyEnchantmentBlockItem()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public AnyEnchantmentBlockItem(bool booleanValue) : base(booleanValue)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string PrefixText => "AnyEnchantment";
|
||||||
|
public override string DisplayHeading => "Any Enchantment";
|
||||||
|
public override Color SummaryBackgroundColor => Colors.YellowGreen;
|
||||||
|
public override Color SummaryTextColor => Colors.Black;
|
||||||
|
public override BlockItemOrdering SortOrder => BlockItemOrdering.AnyEnchantment;
|
||||||
|
}
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue