Initial Commit
This commit is contained in:
6
Filtration/App.config
Normal file
6
Filtration/App.config
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1" />
|
||||
</startup>
|
||||
</configuration>
|
||||
19
Filtration/App.xaml
Normal file
19
Filtration/App.xaml
Normal file
@@ -0,0 +1,19 @@
|
||||
<Application x:Class="Filtration.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
Startup="Application_Startup">
|
||||
<Application.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.Buttons.xaml" />
|
||||
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.TextBox.xaml" />
|
||||
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.Toolbar.xaml" />
|
||||
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
|
||||
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Colors.xaml" />
|
||||
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/Steel.xaml" />
|
||||
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml" />
|
||||
<ResourceDictionary Source="Views/CrossButton.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</Application.Resources>
|
||||
</Application>
|
||||
37
Filtration/App.xaml.cs
Normal file
37
Filtration/App.xaml.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using Castle.MicroKernel.ModelBuilder.Inspectors;
|
||||
using Castle.Windsor;
|
||||
using Castle.Windsor.Installer;
|
||||
using Filtration.Views;
|
||||
|
||||
namespace Filtration
|
||||
{
|
||||
public partial class App
|
||||
{
|
||||
private IWindsorContainer _container;
|
||||
|
||||
private void Application_Startup(object sender, StartupEventArgs e)
|
||||
{
|
||||
_container = new WindsorContainer();
|
||||
|
||||
var propInjector = _container.Kernel.ComponentModelBuilder
|
||||
.Contributors
|
||||
.OfType<PropertiesDependenciesModelInspector>()
|
||||
.Single();
|
||||
|
||||
_container.Kernel.ComponentModelBuilder.RemoveContributor(propInjector);
|
||||
|
||||
_container.Install(FromAssembly.This());
|
||||
|
||||
var mainWindow = _container.Resolve<IMainWindow>();
|
||||
mainWindow.Show();
|
||||
}
|
||||
|
||||
protected override void OnExit(ExitEventArgs e)
|
||||
{
|
||||
_container.Dispose();
|
||||
base.OnExit(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
21
Filtration/Converters/BlockItemTypeToStringConverter.cs
Normal file
21
Filtration/Converters/BlockItemTypeToStringConverter.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
using Filtration.Models;
|
||||
|
||||
namespace Filtration.Converters
|
||||
{
|
||||
internal class BlockItemTypeToStringConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
var test = (ILootFilterBlockItem)Activator.CreateInstance((Type) value);
|
||||
return test.DisplayHeading;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
29
Filtration/Converters/BooleanInverterConverter.cs
Normal file
29
Filtration/Converters/BooleanInverterConverter.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace Filtration.Converters
|
||||
{
|
||||
internal class BoolInverterConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter,
|
||||
CultureInfo culture)
|
||||
{
|
||||
if (value is bool)
|
||||
{
|
||||
return !(bool)value;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter,
|
||||
CultureInfo culture)
|
||||
{
|
||||
if (value is bool)
|
||||
{
|
||||
return !(bool)value;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
||||
20
Filtration/Converters/BooleanToBlockActionConverter.cs
Normal file
20
Filtration/Converters/BooleanToBlockActionConverter.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
using Filtration.Enums;
|
||||
|
||||
namespace Filtration.Converters
|
||||
{
|
||||
internal class BooleanToBlockActionConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return (BlockAction)value == BlockAction.Show;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return (bool)value ? BlockAction.Show : BlockAction.Hide;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
using Filtration.Enums;
|
||||
|
||||
namespace Filtration.Converters
|
||||
{
|
||||
internal class BooleanToBlockActionInverseConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return (BlockAction)value == BlockAction.Hide;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return (bool)value ? BlockAction.Hide : BlockAction.Show;
|
||||
}
|
||||
}
|
||||
}
|
||||
20
Filtration/Converters/BooleanVisibilityConverter.cs
Normal file
20
Filtration/Converters/BooleanVisibilityConverter.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace Filtration.Converters
|
||||
{
|
||||
internal class BooleanVisibilityConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return (bool)value ? Visibility.Visible : Visibility.Collapsed;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
22
Filtration/Converters/ColorToSolidColorBrushConverter.cs
Normal file
22
Filtration/Converters/ColorToSolidColorBrushConverter.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace Filtration.Converters
|
||||
{
|
||||
public class ColorToSolidColorBrushConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
||||
{
|
||||
return value != null ? new SolidColorBrush((Color)value) : null;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
||||
{
|
||||
if (value != null)
|
||||
return ((SolidColorBrush)value).Color;
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
20
Filtration/Converters/ItemRarityConverter.cs
Normal file
20
Filtration/Converters/ItemRarityConverter.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
using Filtration.Enums;
|
||||
|
||||
namespace Filtration.Converters
|
||||
{
|
||||
public class IntToItemRarityConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return (ItemRarity) ((int) value);
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return (int) ((ItemRarity) value);
|
||||
}
|
||||
}
|
||||
}
|
||||
27
Filtration/Converters/StringToVisibilityConverter.cs
Normal file
27
Filtration/Converters/StringToVisibilityConverter.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace Filtration.Converters
|
||||
{
|
||||
internal class StringToVisibilityConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (String.IsNullOrEmpty((string)value))
|
||||
{
|
||||
return Visibility.Collapsed;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Visibility.Visible;
|
||||
}
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
12
Filtration/Enums/BlockAction.cs
Normal file
12
Filtration/Enums/BlockAction.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace Filtration.Enums
|
||||
{
|
||||
internal enum BlockAction
|
||||
{
|
||||
[Description("Show")]
|
||||
Show,
|
||||
[Description("Hide")]
|
||||
Hide
|
||||
}
|
||||
}
|
||||
22
Filtration/Enums/BlockItemType.cs
Normal file
22
Filtration/Enums/BlockItemType.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
namespace Filtration.Enums
|
||||
{
|
||||
internal enum BlockItemType
|
||||
{
|
||||
ItemLevel,
|
||||
DropLevel,
|
||||
Quality,
|
||||
Rarity,
|
||||
Class,
|
||||
BaseType,
|
||||
Sockets,
|
||||
LinkedSockets,
|
||||
SocketGroup,
|
||||
Width,
|
||||
Height,
|
||||
TextColor,
|
||||
BackgroundColor,
|
||||
BorderColor,
|
||||
Sound,
|
||||
FontSize
|
||||
}
|
||||
}
|
||||
20
Filtration/Enums/FilterPredicateOperator.cs
Normal file
20
Filtration/Enums/FilterPredicateOperator.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace Filtration.Enums
|
||||
{
|
||||
internal enum FilterPredicateOperator
|
||||
{
|
||||
[Description("=")]
|
||||
Equal,
|
||||
[Description("!=")]
|
||||
NotEqual,
|
||||
[Description("<")]
|
||||
LessThan,
|
||||
[Description("<=")]
|
||||
LessThanOrEqual,
|
||||
[Description(">")]
|
||||
GreaterThan,
|
||||
[Description(">=")]
|
||||
GreaterThanOrEqual
|
||||
}
|
||||
}
|
||||
12
Filtration/Enums/FilterType.cs
Normal file
12
Filtration/Enums/FilterType.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace Filtration.Enums
|
||||
{
|
||||
internal enum FilterType
|
||||
{
|
||||
[Description("Show")]
|
||||
Show,
|
||||
[Description("Hide")]
|
||||
Hide
|
||||
}
|
||||
}
|
||||
16
Filtration/Enums/ItemRarity.cs
Normal file
16
Filtration/Enums/ItemRarity.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace Filtration.Enums
|
||||
{
|
||||
internal enum ItemRarity
|
||||
{
|
||||
[Description("Normal")]
|
||||
Normal,
|
||||
[Description("Magic")]
|
||||
Magic,
|
||||
[Description("Rare")]
|
||||
Rare,
|
||||
[Description("Unique")]
|
||||
Unique
|
||||
}
|
||||
}
|
||||
16
Filtration/Enums/SocketColor.cs
Normal file
16
Filtration/Enums/SocketColor.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace Filtration.Enums
|
||||
{
|
||||
internal enum SocketColor
|
||||
{
|
||||
[Description("R")]
|
||||
Red,
|
||||
[Description("G")]
|
||||
Green,
|
||||
[Description("B")]
|
||||
Blue,
|
||||
[Description("W")]
|
||||
White
|
||||
}
|
||||
}
|
||||
38
Filtration/Extensions/EnumHelper.cs
Normal file
38
Filtration/Extensions/EnumHelper.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace Filtration.Extensions
|
||||
{
|
||||
internal static class EnumHelper
|
||||
{
|
||||
public static T GetAttributeOfType<T>(this Enum enumVal) where T : Attribute
|
||||
{
|
||||
var type = enumVal.GetType();
|
||||
var memInfo = type.GetMember(enumVal.ToString());
|
||||
var attributes = memInfo[0].GetCustomAttributes(typeof(T), false);
|
||||
return (attributes.Length > 0) ? (T)attributes[0] : null;
|
||||
}
|
||||
|
||||
public static string GetAttributeDescription(this Enum enumValue)
|
||||
{
|
||||
var attribute = enumValue.GetAttributeOfType<DescriptionAttribute>();
|
||||
|
||||
return attribute == null ? String.Empty : attribute.Description;
|
||||
}
|
||||
|
||||
public static T GetEnumValueFromDescription<T>(string description)
|
||||
{
|
||||
var fis = typeof(T).GetFields();
|
||||
|
||||
foreach (var fi in fis)
|
||||
{
|
||||
DescriptionAttribute[] attributes = (DescriptionAttribute[])fi.GetCustomAttributes(typeof(DescriptionAttribute), false);
|
||||
|
||||
if (attributes.Length > 0 && attributes[0].Description == description)
|
||||
return (T)Enum.Parse(typeof(T), fi.Name);
|
||||
}
|
||||
|
||||
throw new Exception("Not found");
|
||||
}
|
||||
}
|
||||
}
|
||||
65
Filtration/Extensions/EnumerationExtension.cs
Normal file
65
Filtration/Extensions/EnumerationExtension.cs
Normal file
@@ -0,0 +1,65 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Windows.Markup;
|
||||
|
||||
namespace Filtration.Extensions
|
||||
{
|
||||
internal class EnumerationExtension : MarkupExtension
|
||||
{
|
||||
private Type _enumType;
|
||||
|
||||
|
||||
public EnumerationExtension(Type enumType)
|
||||
{
|
||||
if (enumType == null) throw new ArgumentNullException("enumType");
|
||||
|
||||
EnumType = enumType;
|
||||
}
|
||||
|
||||
public Type EnumType
|
||||
{
|
||||
get
|
||||
{
|
||||
return _enumType;
|
||||
}
|
||||
private set
|
||||
{
|
||||
if (_enumType == value) return;
|
||||
|
||||
var enumType = Nullable.GetUnderlyingType(value) ?? value;
|
||||
|
||||
if (enumType.IsEnum == false) throw new ArgumentException("Type must be an Enum.");
|
||||
|
||||
_enumType = value;
|
||||
}
|
||||
}
|
||||
|
||||
public override object ProvideValue(IServiceProvider serviceProvider)
|
||||
{
|
||||
var enumValues = Enum.GetValues(EnumType);
|
||||
|
||||
return (from object enumValue in enumValues
|
||||
select new EnumerationMember { Value = enumValue, Description = GetDescription(enumValue) }).ToArray
|
||||
();
|
||||
}
|
||||
|
||||
private string GetDescription(object enumValue)
|
||||
{
|
||||
var descriptionAttribute =
|
||||
EnumType.GetField(enumValue.ToString())
|
||||
.GetCustomAttributes(typeof(DescriptionAttribute), false)
|
||||
.FirstOrDefault() as DescriptionAttribute;
|
||||
|
||||
|
||||
return descriptionAttribute != null ? descriptionAttribute.Description : enumValue.ToString();
|
||||
}
|
||||
|
||||
public class EnumerationMember
|
||||
{
|
||||
public string Description { get; set; }
|
||||
|
||||
public object Value { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
321
Filtration/Filtration.csproj
Normal file
321
Filtration/Filtration.csproj
Normal file
@@ -0,0 +1,321 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{55E0A34C-E039-43D7-A024-A4045401CDDA}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Filtration</RootNamespace>
|
||||
<AssemblyName>Filtration</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Castle.Core">
|
||||
<HintPath>..\packages\Castle.Core.3.3.0\lib\net45\Castle.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Castle.Windsor">
|
||||
<HintPath>..\packages\Castle.Windsor.3.3.0\lib\net45\Castle.Windsor.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DragAndDropLib">
|
||||
<HintPath>..\..\DragAndDrop(Complete)\DragAndDropLib\bin\Debug\DragAndDropLib.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="FontAwesome.WPF, Version=4.3.0.26714, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\FontAwesome.WPF.4.3.0.2\lib\FontAwesome.WPF.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="GalaSoft.MvvmLight, Version=5.1.1.35049, Culture=neutral, PublicKeyToken=e7570ab207bcb616, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\MvvmLightLibs.5.1.1.0\lib\net45\GalaSoft.MvvmLight.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="GalaSoft.MvvmLight.Platform, Version=5.1.1.35053, Culture=neutral, PublicKeyToken=5f873c45e98af8a1, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\MvvmLightLibs.5.1.1.0\lib\net45\GalaSoft.MvvmLight.Platform.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MahApps.Metro">
|
||||
<HintPath>..\packages\MahApps.Metro.1.1.2.0\lib\net45\MahApps.Metro.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Controls.Input.Toolkit">
|
||||
<HintPath>..\packages\WPFToolkit.3.5.50211.1\lib\System.Windows.Controls.Input.Toolkit.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Windows.Controls.Layout.Toolkit">
|
||||
<HintPath>..\packages\WPFToolkit.3.5.50211.1\lib\System.Windows.Controls.Layout.Toolkit.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xaml">
|
||||
<RequiredTargetFramework>4.0</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="WindowsBase" />
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
<Reference Include="WPFToolkit">
|
||||
<HintPath>..\packages\WPFToolkit.3.5.50211.1\lib\WPFToolkit.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xceed.Wpf.Toolkit, Version=2.4.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\Extended.Wpf.Toolkit.2.4\lib\net40\Xceed.Wpf.Toolkit.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ApplicationDefinition Include="App.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
<Compile Include="Converters\BlockItemTypeToStringConverter.cs" />
|
||||
<Compile Include="Converters\BooleanInverterConverter.cs" />
|
||||
<Compile Include="Converters\BooleanToBlockActionInverseConverter.cs" />
|
||||
<Compile Include="Converters\BooleanToBlockActionConverter.cs" />
|
||||
<Compile Include="Converters\ColorToSolidColorBrushConverter.cs" />
|
||||
<Compile Include="Converters\ItemRarityConverter.cs" />
|
||||
<Compile Include="Converters\BooleanVisibilityConverter.cs" />
|
||||
<Compile Include="Converters\StringToVisibilityConverter.cs" />
|
||||
<Compile Include="Enums\BlockAction.cs" />
|
||||
<Compile Include="Enums\BlockItemType.cs" />
|
||||
<Compile Include="Enums\FilterPredicateOperator.cs" />
|
||||
<Compile Include="Enums\FilterType.cs" />
|
||||
<Compile Include="Enums\ItemRarity.cs" />
|
||||
<Compile Include="Enums\SocketColor.cs" />
|
||||
<Compile Include="Extensions\EnumerationExtension.cs" />
|
||||
<Compile Include="Extensions\EnumHelper.cs" />
|
||||
<Compile Include="Models\BlockItemBaseTypes\ActionBlockItem.cs" />
|
||||
<Compile Include="Models\BlockItemBaseTypes\ColorBlockItem.cs" />
|
||||
<Compile Include="Models\BlockItemBaseTypes\DualIntegerBlockItem.cs" />
|
||||
<Compile Include="Models\BlockItemBaseTypes\IntegerBlockItem.cs" />
|
||||
<Compile Include="Models\BlockItemBaseTypes\NumericFilterPredicateBlockItem.cs" />
|
||||
<Compile Include="Models\BlockItemBaseTypes\StringListBlockItem.cs" />
|
||||
<Compile Include="Models\BlockItemTypes\FontSizeBlockItem.cs" />
|
||||
<Compile Include="Models\BlockItemTypes\SoundBlockItem.cs" />
|
||||
<Compile Include="Models\BlockItemTypes\BorderColorBlockItem.cs" />
|
||||
<Compile Include="Models\BlockItemTypes\BaseTypeBlockItem.cs" />
|
||||
<Compile Include="Models\BlockItemTypes\BackgroundColorBlockItem.cs" />
|
||||
<Compile Include="Models\BlockItemTypes\TextColorBlockItem.cs" />
|
||||
<Compile Include="Models\BlockItemTypes\ClassBlockItem.cs" />
|
||||
<Compile Include="Models\BlockItemTypes\HeightBlockItem.cs" />
|
||||
<Compile Include="Models\BlockItemTypes\WidthBlockItem.cs" />
|
||||
<Compile Include="Models\BlockItemTypes\SocketGroupBlockItem.cs" />
|
||||
<Compile Include="Models\BlockItemTypes\LinkedSocketsBlockItem.cs" />
|
||||
<Compile Include="Models\BlockItemTypes\SocketsBlockItem.cs" />
|
||||
<Compile Include="Models\BlockItemTypes\DropLevelBlockItem.cs" />
|
||||
<Compile Include="Models\BlockItemTypes\RarityBlockItem.cs" />
|
||||
<Compile Include="Models\BlockItemTypes\QualityBlockItem.cs" />
|
||||
<Compile Include="Models\BlockItemTypes\ItemLevelBlockItem.cs" />
|
||||
<Compile Include="Models\IAudioVisualBlockItem.cs" />
|
||||
<Compile Include="Models\LootFilterBlock.cs" />
|
||||
<Compile Include="Models\ILootFilterBlockItem.cs" />
|
||||
<Compile Include="Models\LootFilterScript.cs" />
|
||||
<Compile Include="Models\LootFilterSection.cs" />
|
||||
<Compile Include="Models\NumericFilterPredicate.cs" />
|
||||
<Compile Include="Models\BlockItemBaseTypes\SocketGroupBlockItemBase.cs" />
|
||||
<Compile Include="Properties\Annotations.cs" />
|
||||
<Compile Include="Services\FileSystemService.cs" />
|
||||
<Compile Include="Services\LootFilterPersistenceService.cs" />
|
||||
<Compile Include="Services\StaticDataService.cs" />
|
||||
<Compile Include="Translators\LootFilterBlockTranslator.cs" />
|
||||
<Compile Include="Translators\LootFilterScriptTranslator.cs" />
|
||||
<Compile Include="UserControls\AutoScrollingListBox.cs" />
|
||||
<Compile Include="UserControls\CrossButton.cs" />
|
||||
<Compile Include="UserControls\EditableListBoxControl.xaml.cs">
|
||||
<DependentUpon>EditableListBoxControl.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Utilities\LineReader.cs" />
|
||||
<Compile Include="ViewModels\FiltrationViewModelBase.cs" />
|
||||
<Compile Include="ViewModels\ILootFilterScriptViewModelFactory.cs" />
|
||||
<Compile Include="ViewModels\ILootFilterBlockViewModelFactory.cs" />
|
||||
<Compile Include="ViewModels\ILootFilterScriptViewModel.cs" />
|
||||
<Compile Include="ViewModels\ILootFilterBlockViewModel.cs" />
|
||||
<Compile Include="ViewModels\LootFilterBlockViewModel.cs" />
|
||||
<Compile Include="ViewModels\LootFilterScriptViewModel.cs" />
|
||||
<Compile Include="Views\BlockTemplateSelector.cs" />
|
||||
<Compile Include="Views\LootFilterBlockDisplaySettingsView.xaml.cs">
|
||||
<DependentUpon>LootFilterBlockDisplaySettingsView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Views\LootFilterScriptView.xaml.cs">
|
||||
<DependentUpon>LootFilterScriptView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Views\LootFilterBlockView.xaml.cs">
|
||||
<DependentUpon>LootFilterBlockView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="UserControls\NumericFilterPredicateControl.xaml.cs">
|
||||
<DependentUpon>NumericFilterPredicateControl.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Views\LootFilterSectionView.xaml.cs">
|
||||
<DependentUpon>LootFilterSectionView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="WindsorInstallers\ModelsInstaller.cs" />
|
||||
<Compile Include="WindsorInstallers\ServicesInstaller.cs" />
|
||||
<Compile Include="WindsorInstallers\TranslatorsInstaller.cs" />
|
||||
<Compile Include="WindsorInstallers\ViewModelsInstaller.cs" />
|
||||
<Compile Include="WindsorInstallers\ViewsInstaller.cs" />
|
||||
<Page Include="Views\CrossButton.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="UserControls\EditableListBoxControl.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Views\ExpanderStyle.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Views\LootFilterBlockDisplaySettingsView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Views\LootFilterBlockViewDictionary.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Views\LootFilterScriptView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Views\LootFilterBlockView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Views\LootFilterSectionView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Views\MainWindow.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Compile Include="App.xaml.cs">
|
||||
<DependentUpon>App.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="ViewModels\IMainWindowViewModel.cs" />
|
||||
<Compile Include="ViewModels\MainWindowViewModel.cs" />
|
||||
<Compile Include="Views\IMainWindow.cs" />
|
||||
<Compile Include="Views\MainWindow.xaml.cs">
|
||||
<DependentUpon>MainWindow.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Page Include="UserControls\NumericFilterPredicateControl.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Properties\AssemblyInfo.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
<None Include="packages.config" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<AppDesigner Include="Properties\" />
|
||||
<Resource Include="Resources\Fontin-SmallCaps.ttf" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\groundtile.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Resources\AlertSound8.wav">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Resources\ItemBaseTypes.txt">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Resources\ItemClasses.txt">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Resources\AlertSound9.wav">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Resources\AlertSound7.wav">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Resources\AlertSound6.wav">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Resources\AlertSound4.wav">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Resources\AlertSound5.wav">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Resources\AlertSound2.wav">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Resources\AlertSound3.wav">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Resources\AlertSound1.wav">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(XamlSpyInstallPath)MSBuild\FirstFloor.XamlSpy.WPF.targets" Condition="'$(XamlSpyInstallPath)' != '' and '$(Configuration)' == 'DEBUG'" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
84
Filtration/Models/BlockItemBaseTypes/ActionBlockItem.cs
Normal file
84
Filtration/Models/BlockItemBaseTypes/ActionBlockItem.cs
Normal file
@@ -0,0 +1,84 @@
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Windows.Media;
|
||||
using Filtration.Annotations;
|
||||
using Filtration.Enums;
|
||||
|
||||
namespace Filtration.Models.BlockItemBaseTypes
|
||||
{
|
||||
internal class ActionBlockItem : ILootFilterBlockItem
|
||||
{
|
||||
private BlockAction _action;
|
||||
|
||||
public ActionBlockItem(BlockAction action)
|
||||
{
|
||||
Action = action;
|
||||
}
|
||||
|
||||
public BlockAction Action
|
||||
{
|
||||
get { return _action; }
|
||||
set
|
||||
{
|
||||
_action = value;
|
||||
OnPropertyChanged();
|
||||
OnPropertyChanged("SummaryText");
|
||||
OnPropertyChanged("SummaryBackgroundColor");
|
||||
OnPropertyChanged("SummaryTextColor");
|
||||
}
|
||||
}
|
||||
|
||||
public string PrefixText
|
||||
{
|
||||
get { return string.Empty; }
|
||||
}
|
||||
|
||||
public int MaximumAllowed
|
||||
{
|
||||
get { return 1; }
|
||||
}
|
||||
|
||||
public string DisplayHeading
|
||||
{
|
||||
get
|
||||
{
|
||||
return "Action";
|
||||
}
|
||||
}
|
||||
|
||||
public string SummaryText
|
||||
{
|
||||
get
|
||||
{
|
||||
return Action == BlockAction.Show ? "Show" : "Hide";
|
||||
}
|
||||
}
|
||||
|
||||
public Color SummaryBackgroundColor
|
||||
{
|
||||
get
|
||||
{
|
||||
return Action == BlockAction.Show ? Colors.LimeGreen : Colors.OrangeRed;
|
||||
}
|
||||
}
|
||||
|
||||
public Color SummaryTextColor
|
||||
{
|
||||
get
|
||||
{
|
||||
return Action == BlockAction.Show ? Colors.Black : Colors.White;
|
||||
}
|
||||
}
|
||||
|
||||
public int SortOrder { get { return 0; } }
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
[NotifyPropertyChangedInvocator]
|
||||
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
var handler = PropertyChanged;
|
||||
if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
}
|
||||
53
Filtration/Models/BlockItemBaseTypes/ColorBlockItem.cs
Normal file
53
Filtration/Models/BlockItemBaseTypes/ColorBlockItem.cs
Normal file
@@ -0,0 +1,53 @@
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Windows.Media;
|
||||
using Filtration.Annotations;
|
||||
|
||||
namespace Filtration.Models.BlockItemBaseTypes
|
||||
{
|
||||
internal abstract class ColorBlockItem : ILootFilterBlockItem, IAudioVisualBlockItem
|
||||
{
|
||||
private Color _color;
|
||||
|
||||
protected ColorBlockItem()
|
||||
{
|
||||
}
|
||||
|
||||
protected ColorBlockItem(Color color)
|
||||
{
|
||||
Color = color;
|
||||
}
|
||||
|
||||
public abstract string PrefixText { get; }
|
||||
public abstract int MaximumAllowed { get; }
|
||||
|
||||
public abstract string DisplayHeading { get; }
|
||||
|
||||
public string SummaryText
|
||||
{
|
||||
get { return string.Empty; }
|
||||
}
|
||||
|
||||
public Color SummaryBackgroundColor { get { return Colors.Transparent; } }
|
||||
public Color SummaryTextColor { get { return Colors.Transparent; } }
|
||||
public abstract int SortOrder { get; }
|
||||
|
||||
public Color Color
|
||||
{
|
||||
get { return _color; }
|
||||
set
|
||||
{
|
||||
_color = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
[NotifyPropertyChangedInvocator]
|
||||
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
var handler = PropertyChanged;
|
||||
if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
}
|
||||
60
Filtration/Models/BlockItemBaseTypes/DualIntegerBlockItem.cs
Normal file
60
Filtration/Models/BlockItemBaseTypes/DualIntegerBlockItem.cs
Normal file
@@ -0,0 +1,60 @@
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Windows.Media;
|
||||
using Filtration.Annotations;
|
||||
|
||||
namespace Filtration.Models.BlockItemBaseTypes
|
||||
{
|
||||
internal abstract class DualIntegerBlockItem : ILootFilterBlockItem, IAudioVisualBlockItem
|
||||
{
|
||||
private int _value;
|
||||
private int _secondValue;
|
||||
|
||||
protected DualIntegerBlockItem()
|
||||
{
|
||||
}
|
||||
|
||||
protected DualIntegerBlockItem(int value, int secondValue)
|
||||
{
|
||||
Value = value;
|
||||
SecondValue = secondValue;
|
||||
}
|
||||
|
||||
public abstract string PrefixText { get; }
|
||||
public abstract int MaximumAllowed { get; }
|
||||
public abstract string DisplayHeading { get; }
|
||||
|
||||
public string SummaryText { get { return string.Empty; } }
|
||||
public Color SummaryBackgroundColor { get { return Colors.Transparent; } }
|
||||
public Color SummaryTextColor { get { return Colors.Transparent; } }
|
||||
public abstract int SortOrder { get; }
|
||||
|
||||
public int Value
|
||||
{
|
||||
get { return _value; }
|
||||
set
|
||||
{
|
||||
_value = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public int SecondValue
|
||||
{
|
||||
get { return _secondValue; }
|
||||
set
|
||||
{
|
||||
_secondValue = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
[NotifyPropertyChangedInvocator]
|
||||
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
var handler = PropertyChanged;
|
||||
if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
}
|
||||
52
Filtration/Models/BlockItemBaseTypes/IntegerBlockItem.cs
Normal file
52
Filtration/Models/BlockItemBaseTypes/IntegerBlockItem.cs
Normal file
@@ -0,0 +1,52 @@
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Windows.Media;
|
||||
using Filtration.Annotations;
|
||||
|
||||
namespace Filtration.Models.BlockItemBaseTypes
|
||||
{
|
||||
internal abstract class IntegerBlockItem : ILootFilterBlockItem, IAudioVisualBlockItem
|
||||
{
|
||||
private int _value;
|
||||
|
||||
protected IntegerBlockItem()
|
||||
{
|
||||
}
|
||||
|
||||
protected IntegerBlockItem(int value)
|
||||
{
|
||||
Value = value;
|
||||
}
|
||||
|
||||
public abstract string PrefixText { get; }
|
||||
public abstract int MaximumAllowed { get; }
|
||||
|
||||
public abstract string DisplayHeading { get; }
|
||||
|
||||
public string SummaryText { get { return string.Empty; } }
|
||||
public Color SummaryBackgroundColor { get { return Colors.Transparent; } }
|
||||
public Color SummaryTextColor { get { return Colors.Transparent; } }
|
||||
public abstract int SortOrder { get; }
|
||||
|
||||
public abstract int Minimum { get; }
|
||||
public abstract int Maximum { get; }
|
||||
|
||||
public int Value
|
||||
{
|
||||
get { return _value; }
|
||||
set
|
||||
{
|
||||
_value = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
[NotifyPropertyChangedInvocator]
|
||||
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
var handler = PropertyChanged;
|
||||
if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Windows.Media;
|
||||
using Filtration.Annotations;
|
||||
using Filtration.Enums;
|
||||
|
||||
namespace Filtration.Models.BlockItemBaseTypes
|
||||
{
|
||||
internal abstract class NumericFilterPredicateBlockItem : ILootFilterBlockItem
|
||||
{
|
||||
private NumericFilterPredicate _filterPredicate;
|
||||
|
||||
protected NumericFilterPredicateBlockItem()
|
||||
{
|
||||
FilterPredicate = new NumericFilterPredicate();
|
||||
FilterPredicate.PropertyChanged += OnFilterPredicateChanged;
|
||||
}
|
||||
|
||||
protected NumericFilterPredicateBlockItem(FilterPredicateOperator predicateOperator, int predicateOperand)
|
||||
{
|
||||
FilterPredicate = new NumericFilterPredicate(predicateOperator, predicateOperand);
|
||||
FilterPredicate.PropertyChanged += OnFilterPredicateChanged;
|
||||
}
|
||||
|
||||
public abstract string PrefixText { get; }
|
||||
public abstract int MaximumAllowed { get; }
|
||||
public abstract string DisplayHeading { get; }
|
||||
public abstract string SummaryText { get; }
|
||||
public abstract Color SummaryBackgroundColor { get; }
|
||||
public abstract Color SummaryTextColor { get; }
|
||||
public abstract int SortOrder { get; }
|
||||
|
||||
public abstract int Minimum { get; }
|
||||
public abstract int Maximum { get; }
|
||||
|
||||
public NumericFilterPredicate FilterPredicate
|
||||
{
|
||||
get { return _filterPredicate; }
|
||||
protected set
|
||||
{
|
||||
_filterPredicate = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnFilterPredicateChanged(object sender, EventArgs e)
|
||||
{
|
||||
OnPropertyChanged("FilterPredicate");
|
||||
OnPropertyChanged("SummaryText");
|
||||
}
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
[NotifyPropertyChangedInvocator]
|
||||
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
var handler = PropertyChanged;
|
||||
if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Collections.Specialized;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Windows.Media;
|
||||
using Filtration.Annotations;
|
||||
using Filtration.Enums;
|
||||
|
||||
namespace Filtration.Models.BlockItemBaseTypes
|
||||
{
|
||||
internal abstract class SocketGroupBlockItemBase : ILootFilterBlockItem
|
||||
{
|
||||
protected SocketGroupBlockItemBase()
|
||||
{
|
||||
SocketColorGroups = new ObservableCollection<List<SocketColor>>();
|
||||
SocketColorGroups.CollectionChanged += OnSocketColorGroupsCollectionChanged;
|
||||
}
|
||||
|
||||
public abstract string PrefixText { get; }
|
||||
public abstract int MaximumAllowed { get; }
|
||||
public abstract string DisplayHeading { get; }
|
||||
|
||||
public abstract string SummaryText { get; }
|
||||
public abstract Color SummaryBackgroundColor { get; }
|
||||
public abstract Color SummaryTextColor { get; }
|
||||
public abstract int SortOrder { get; }
|
||||
public ObservableCollection<List<SocketColor>> SocketColorGroups { get; private set; }
|
||||
|
||||
private void OnSocketColorGroupsCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
|
||||
{
|
||||
OnPropertyChanged("SocketColorGroups");
|
||||
}
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
[NotifyPropertyChangedInvocator]
|
||||
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
var handler = PropertyChanged;
|
||||
if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
42
Filtration/Models/BlockItemBaseTypes/StringListBlockItem.cs
Normal file
42
Filtration/Models/BlockItemBaseTypes/StringListBlockItem.cs
Normal file
@@ -0,0 +1,42 @@
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Collections.Specialized;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Windows.Media;
|
||||
using Filtration.Annotations;
|
||||
|
||||
namespace Filtration.Models.BlockItemBaseTypes
|
||||
{
|
||||
internal abstract class StringListBlockItem : ILootFilterBlockItem
|
||||
{
|
||||
protected StringListBlockItem()
|
||||
{
|
||||
Items = new ObservableCollection<string>();
|
||||
Items.CollectionChanged += OnItemsCollectionChanged;
|
||||
}
|
||||
|
||||
public abstract string PrefixText { get; }
|
||||
public abstract int MaximumAllowed { get; }
|
||||
public abstract string DisplayHeading { get; }
|
||||
|
||||
public abstract string SummaryText { get; }
|
||||
public abstract Color SummaryBackgroundColor { get; }
|
||||
public abstract Color SummaryTextColor { get; }
|
||||
public abstract int SortOrder { get; }
|
||||
public ObservableCollection<string> Items { get; protected set; }
|
||||
|
||||
private void OnItemsCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
|
||||
{
|
||||
OnPropertyChanged("Items");
|
||||
OnPropertyChanged("SummaryText");
|
||||
}
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
[NotifyPropertyChangedInvocator]
|
||||
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
var handler = PropertyChanged;
|
||||
if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
}
|
||||
39
Filtration/Models/BlockItemTypes/BackgroundColorBlockItem.cs
Normal file
39
Filtration/Models/BlockItemTypes/BackgroundColorBlockItem.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using System.Windows.Media;
|
||||
using Filtration.Models.BlockItemBaseTypes;
|
||||
|
||||
namespace Filtration.Models.BlockItemTypes
|
||||
{
|
||||
internal class BackgroundColorBlockItem : ColorBlockItem
|
||||
{
|
||||
public BackgroundColorBlockItem()
|
||||
{
|
||||
}
|
||||
|
||||
public BackgroundColorBlockItem(Color color) : base(color)
|
||||
{
|
||||
}
|
||||
|
||||
public override string PrefixText
|
||||
{
|
||||
get { return "SetBackgroundColor"; }
|
||||
}
|
||||
|
||||
public override int MaximumAllowed
|
||||
{
|
||||
get { return 1; }
|
||||
}
|
||||
|
||||
public override string DisplayHeading
|
||||
{
|
||||
get
|
||||
{
|
||||
return "Background Color";
|
||||
}
|
||||
}
|
||||
|
||||
public override int SortOrder
|
||||
{
|
||||
get { return 13; }
|
||||
}
|
||||
}
|
||||
}
|
||||
60
Filtration/Models/BlockItemTypes/BaseTypeBlockItem.cs
Normal file
60
Filtration/Models/BlockItemTypes/BaseTypeBlockItem.cs
Normal file
@@ -0,0 +1,60 @@
|
||||
using System.Linq;
|
||||
using System.Windows.Media;
|
||||
using Filtration.Models.BlockItemBaseTypes;
|
||||
|
||||
namespace Filtration.Models.BlockItemTypes
|
||||
{
|
||||
internal class BaseTypeBlockItem : StringListBlockItem
|
||||
{
|
||||
public override string PrefixText { get { return "BaseType"; } }
|
||||
|
||||
public override int MaximumAllowed
|
||||
{
|
||||
get { return 1; }
|
||||
}
|
||||
|
||||
public override string DisplayHeading
|
||||
{
|
||||
get
|
||||
{
|
||||
return "Base Type";
|
||||
}
|
||||
}
|
||||
|
||||
public override string SummaryText
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Items.Count > 0 && Items.Count < 4)
|
||||
{
|
||||
return "Item Base Types: " +
|
||||
Items.Aggregate(string.Empty, (current, i) => current + i + ", ").TrimEnd(' ').TrimEnd(',');
|
||||
}
|
||||
if (Items.Count >= 4)
|
||||
{
|
||||
var remaining = Items.Count - 3;
|
||||
return "Item Base Types: " + Items.Take(3)
|
||||
.Aggregate(string.Empty, (current, i) => current + i + ", ")
|
||||
.TrimEnd(' ')
|
||||
.TrimEnd(',') + " (+" + remaining + " more)";
|
||||
}
|
||||
return "Item Base Types: (none)";
|
||||
}
|
||||
}
|
||||
|
||||
public override Color SummaryBackgroundColor
|
||||
{
|
||||
get { return Colors.MediumTurquoise; }
|
||||
}
|
||||
|
||||
public override Color SummaryTextColor
|
||||
{
|
||||
get { return Colors.Black; }
|
||||
}
|
||||
|
||||
public override int SortOrder
|
||||
{
|
||||
get { return 11; }
|
||||
}
|
||||
}
|
||||
}
|
||||
39
Filtration/Models/BlockItemTypes/BorderColorBlockItem.cs
Normal file
39
Filtration/Models/BlockItemTypes/BorderColorBlockItem.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using System.Windows.Media;
|
||||
using Filtration.Models.BlockItemBaseTypes;
|
||||
|
||||
namespace Filtration.Models.BlockItemTypes
|
||||
{
|
||||
internal class BorderColorBlockItem : ColorBlockItem
|
||||
{
|
||||
public BorderColorBlockItem()
|
||||
{
|
||||
}
|
||||
|
||||
public BorderColorBlockItem(Color color) : base(color)
|
||||
{
|
||||
}
|
||||
|
||||
public override string PrefixText
|
||||
{
|
||||
get { return "SetBorderColor"; }
|
||||
}
|
||||
|
||||
public override int MaximumAllowed
|
||||
{
|
||||
get { return 1; }
|
||||
}
|
||||
|
||||
public override string DisplayHeading
|
||||
{
|
||||
get
|
||||
{
|
||||
return "Border Color";
|
||||
}
|
||||
}
|
||||
|
||||
public override int SortOrder
|
||||
{
|
||||
get { return 14; }
|
||||
}
|
||||
}
|
||||
}
|
||||
54
Filtration/Models/BlockItemTypes/ClassBlockItem.cs
Normal file
54
Filtration/Models/BlockItemTypes/ClassBlockItem.cs
Normal file
@@ -0,0 +1,54 @@
|
||||
using System.Linq;
|
||||
using System.Windows.Media;
|
||||
using Filtration.Models.BlockItemBaseTypes;
|
||||
|
||||
namespace Filtration.Models.BlockItemTypes
|
||||
{
|
||||
internal class ClassBlockItem : StringListBlockItem
|
||||
{
|
||||
public override string PrefixText { get { return "Class"; } }
|
||||
|
||||
public override int MaximumAllowed
|
||||
{
|
||||
get { return 1; }
|
||||
}
|
||||
|
||||
public override string DisplayHeading { get { return "Class"; } }
|
||||
|
||||
public override string SummaryText
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Items.Count > 0 && Items.Count < 4)
|
||||
{
|
||||
return "Item Classes: " +
|
||||
Items.Aggregate(string.Empty, (current, i) => current + i + ", ").TrimEnd(' ').TrimEnd(',');
|
||||
}
|
||||
if (Items.Count >= 4)
|
||||
{
|
||||
var remaining = Items.Count - 3;
|
||||
return "Item Classes: " + Items.Take(3)
|
||||
.Aggregate(string.Empty, (current, i) => current + i + ", ")
|
||||
.TrimEnd(' ')
|
||||
.TrimEnd(',') + " (+" + remaining + " more)";
|
||||
}
|
||||
return "Item Classes: (none)";
|
||||
}
|
||||
}
|
||||
|
||||
public override Color SummaryBackgroundColor
|
||||
{
|
||||
get { return Colors.MediumSeaGreen; }
|
||||
}
|
||||
|
||||
public override Color SummaryTextColor
|
||||
{
|
||||
get { return Colors.White; }
|
||||
}
|
||||
|
||||
public override int SortOrder
|
||||
{
|
||||
get { return 10; }
|
||||
}
|
||||
}
|
||||
}
|
||||
72
Filtration/Models/BlockItemTypes/DropLevelBlockItem.cs
Normal file
72
Filtration/Models/BlockItemTypes/DropLevelBlockItem.cs
Normal file
@@ -0,0 +1,72 @@
|
||||
using System.Windows.Media;
|
||||
using Filtration.Enums;
|
||||
using Filtration.Models.BlockItemBaseTypes;
|
||||
|
||||
namespace Filtration.Models.BlockItemTypes
|
||||
{
|
||||
internal class DropLevelBlockItem : NumericFilterPredicateBlockItem
|
||||
{
|
||||
public DropLevelBlockItem()
|
||||
{
|
||||
}
|
||||
|
||||
public DropLevelBlockItem(FilterPredicateOperator predicateOperator, int predicateOperand)
|
||||
: base(predicateOperator, predicateOperand)
|
||||
{
|
||||
}
|
||||
|
||||
public override string PrefixText
|
||||
{
|
||||
get { return "DropLevel"; }
|
||||
}
|
||||
|
||||
public override int MaximumAllowed
|
||||
{
|
||||
get { return 2; }
|
||||
}
|
||||
|
||||
public override string DisplayHeading
|
||||
{
|
||||
get
|
||||
{
|
||||
return "Drop Level";
|
||||
}
|
||||
}
|
||||
|
||||
public override string SummaryText
|
||||
{
|
||||
get { return "Drop Level " + FilterPredicate; }
|
||||
}
|
||||
|
||||
public override Color SummaryBackgroundColor
|
||||
{
|
||||
get { return Colors.DodgerBlue; }
|
||||
}
|
||||
|
||||
public override Color SummaryTextColor
|
||||
{
|
||||
get { return Colors.White; }
|
||||
}
|
||||
|
||||
public override int SortOrder
|
||||
{
|
||||
get { return 2; }
|
||||
}
|
||||
|
||||
public override int Minimum
|
||||
{
|
||||
get
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public override int Maximum
|
||||
{
|
||||
get
|
||||
{
|
||||
return 100;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
54
Filtration/Models/BlockItemTypes/FontSizeBlockItem.cs
Normal file
54
Filtration/Models/BlockItemTypes/FontSizeBlockItem.cs
Normal file
@@ -0,0 +1,54 @@
|
||||
using Filtration.Models.BlockItemBaseTypes;
|
||||
|
||||
namespace Filtration.Models.BlockItemTypes
|
||||
{
|
||||
internal class FontSizeBlockItem : IntegerBlockItem
|
||||
{
|
||||
public FontSizeBlockItem()
|
||||
{
|
||||
}
|
||||
|
||||
public FontSizeBlockItem(int value) : base(value)
|
||||
{
|
||||
}
|
||||
|
||||
public override string PrefixText
|
||||
{
|
||||
get { return "SetFontSize"; }
|
||||
}
|
||||
|
||||
public override int MaximumAllowed
|
||||
{
|
||||
get { return 1; }
|
||||
}
|
||||
|
||||
public override string DisplayHeading
|
||||
{
|
||||
get
|
||||
{
|
||||
return "Font Size";
|
||||
}
|
||||
}
|
||||
|
||||
public override int SortOrder
|
||||
{
|
||||
get { return 15; }
|
||||
}
|
||||
|
||||
public override int Minimum
|
||||
{
|
||||
get
|
||||
{
|
||||
return 11;
|
||||
}
|
||||
}
|
||||
|
||||
public override int Maximum
|
||||
{
|
||||
get
|
||||
{
|
||||
return 45;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
69
Filtration/Models/BlockItemTypes/HeightBlockItem.cs
Normal file
69
Filtration/Models/BlockItemTypes/HeightBlockItem.cs
Normal file
@@ -0,0 +1,69 @@
|
||||
using System.Windows.Media;
|
||||
using Filtration.Enums;
|
||||
using Filtration.Models.BlockItemBaseTypes;
|
||||
|
||||
namespace Filtration.Models.BlockItemTypes
|
||||
{
|
||||
internal class HeightBlockItem : NumericFilterPredicateBlockItem
|
||||
{
|
||||
public HeightBlockItem()
|
||||
{
|
||||
}
|
||||
|
||||
public HeightBlockItem(FilterPredicateOperator predicateOperator, int predicateOperand)
|
||||
: base(predicateOperator, predicateOperand)
|
||||
{
|
||||
}
|
||||
|
||||
public override string PrefixText
|
||||
{
|
||||
get { return "Height"; }
|
||||
}
|
||||
|
||||
public override int MaximumAllowed
|
||||
{
|
||||
get { return 2; }
|
||||
}
|
||||
|
||||
public override string DisplayHeading
|
||||
{
|
||||
get { return "Height"; }
|
||||
}
|
||||
|
||||
public override string SummaryText
|
||||
{
|
||||
get { return "Height " + FilterPredicate; }
|
||||
}
|
||||
|
||||
public override Color SummaryBackgroundColor
|
||||
{
|
||||
get { return Colors.Plum; }
|
||||
}
|
||||
|
||||
public override Color SummaryTextColor
|
||||
{
|
||||
get { return Colors.White; }
|
||||
}
|
||||
|
||||
public override int SortOrder
|
||||
{
|
||||
get { return 8; }
|
||||
}
|
||||
|
||||
public override int Minimum
|
||||
{
|
||||
get
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public override int Maximum
|
||||
{
|
||||
get
|
||||
{
|
||||
return 6;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
71
Filtration/Models/BlockItemTypes/ItemLevelBlockItem.cs
Normal file
71
Filtration/Models/BlockItemTypes/ItemLevelBlockItem.cs
Normal file
@@ -0,0 +1,71 @@
|
||||
using System.Windows.Media;
|
||||
using Filtration.Enums;
|
||||
using Filtration.Models.BlockItemBaseTypes;
|
||||
|
||||
namespace Filtration.Models.BlockItemTypes
|
||||
{
|
||||
internal class ItemLevelBlockItem : NumericFilterPredicateBlockItem
|
||||
{
|
||||
public ItemLevelBlockItem()
|
||||
{
|
||||
}
|
||||
|
||||
public ItemLevelBlockItem(FilterPredicateOperator predicateOperator, int predicateOperand) : base (predicateOperator, predicateOperand)
|
||||
{
|
||||
}
|
||||
|
||||
public override string PrefixText
|
||||
{
|
||||
get { return "ItemLevel"; }
|
||||
}
|
||||
|
||||
public override int MaximumAllowed
|
||||
{
|
||||
get { return 2; }
|
||||
}
|
||||
|
||||
public override string DisplayHeading
|
||||
{
|
||||
get
|
||||
{
|
||||
return "Item Level";
|
||||
}
|
||||
}
|
||||
|
||||
public override string SummaryText
|
||||
{
|
||||
get { return "Item Level " + FilterPredicate; }
|
||||
}
|
||||
|
||||
public override Color SummaryBackgroundColor
|
||||
{
|
||||
get { return Colors.DarkSlateGray; }
|
||||
}
|
||||
|
||||
public override Color SummaryTextColor
|
||||
{
|
||||
get { return Colors.White; }
|
||||
}
|
||||
|
||||
public override int SortOrder
|
||||
{
|
||||
get { return 1; }
|
||||
}
|
||||
|
||||
public override int Minimum
|
||||
{
|
||||
get
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public override int Maximum
|
||||
{
|
||||
get
|
||||
{
|
||||
return 100;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
72
Filtration/Models/BlockItemTypes/LinkedSocketsBlockItem.cs
Normal file
72
Filtration/Models/BlockItemTypes/LinkedSocketsBlockItem.cs
Normal file
@@ -0,0 +1,72 @@
|
||||
using System.Windows.Media;
|
||||
using Filtration.Enums;
|
||||
using Filtration.Models.BlockItemBaseTypes;
|
||||
|
||||
namespace Filtration.Models.BlockItemTypes
|
||||
{
|
||||
internal class LinkedSocketsBlockItem : NumericFilterPredicateBlockItem
|
||||
{
|
||||
public LinkedSocketsBlockItem()
|
||||
{
|
||||
}
|
||||
|
||||
public LinkedSocketsBlockItem(FilterPredicateOperator predicateOperator, int predicateOperand)
|
||||
: base(predicateOperator, predicateOperand)
|
||||
{
|
||||
}
|
||||
|
||||
public override string PrefixText
|
||||
{
|
||||
get { return "LinkedSockets"; }
|
||||
}
|
||||
|
||||
public override int MaximumAllowed
|
||||
{
|
||||
get { return 2; }
|
||||
}
|
||||
|
||||
public override string DisplayHeading
|
||||
{
|
||||
get
|
||||
{
|
||||
return "Linked Sockets";
|
||||
}
|
||||
}
|
||||
|
||||
public override string SummaryText
|
||||
{
|
||||
get { return "Linked Sockets " + FilterPredicate; }
|
||||
}
|
||||
|
||||
public override Color SummaryBackgroundColor
|
||||
{
|
||||
get { return Colors.Gold; }
|
||||
}
|
||||
|
||||
public override Color SummaryTextColor
|
||||
{
|
||||
get { return Colors.Black; }
|
||||
}
|
||||
|
||||
public override int SortOrder
|
||||
{
|
||||
get { return 6; }
|
||||
}
|
||||
|
||||
public override int Minimum
|
||||
{
|
||||
get
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public override int Maximum
|
||||
{
|
||||
get
|
||||
{
|
||||
return 6;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
72
Filtration/Models/BlockItemTypes/QualityBlockItem.cs
Normal file
72
Filtration/Models/BlockItemTypes/QualityBlockItem.cs
Normal file
@@ -0,0 +1,72 @@
|
||||
using System.Windows.Media;
|
||||
using Filtration.Enums;
|
||||
using Filtration.Models.BlockItemBaseTypes;
|
||||
|
||||
namespace Filtration.Models.BlockItemTypes
|
||||
{
|
||||
internal class QualityBlockItem : NumericFilterPredicateBlockItem
|
||||
{
|
||||
public QualityBlockItem()
|
||||
{
|
||||
}
|
||||
|
||||
public QualityBlockItem(FilterPredicateOperator predicateOperator, int predicateOperand)
|
||||
: base(predicateOperator, predicateOperand)
|
||||
{
|
||||
}
|
||||
|
||||
public override string PrefixText
|
||||
{
|
||||
get { return "Quality"; }
|
||||
}
|
||||
|
||||
public override int MaximumAllowed
|
||||
{
|
||||
get { return 2; }
|
||||
}
|
||||
|
||||
public override string DisplayHeading
|
||||
{
|
||||
get
|
||||
{
|
||||
return "Quality";
|
||||
}
|
||||
}
|
||||
|
||||
public override string SummaryText
|
||||
{
|
||||
get { return "Quality " + FilterPredicate; }
|
||||
}
|
||||
|
||||
public override Color SummaryBackgroundColor
|
||||
{
|
||||
get { return Colors.DarkOrange; }
|
||||
}
|
||||
|
||||
public override Color SummaryTextColor
|
||||
{
|
||||
get { return Colors.White; }
|
||||
}
|
||||
|
||||
public override int SortOrder
|
||||
{
|
||||
get { return 3; }
|
||||
}
|
||||
|
||||
public override int Minimum
|
||||
{
|
||||
get
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public override int Maximum
|
||||
{
|
||||
get
|
||||
{
|
||||
return 20;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
77
Filtration/Models/BlockItemTypes/RarityBlockItem.cs
Normal file
77
Filtration/Models/BlockItemTypes/RarityBlockItem.cs
Normal file
@@ -0,0 +1,77 @@
|
||||
using System.Windows.Media;
|
||||
using Filtration.Enums;
|
||||
using Filtration.Extensions;
|
||||
using Filtration.Models.BlockItemBaseTypes;
|
||||
|
||||
namespace Filtration.Models.BlockItemTypes
|
||||
{
|
||||
internal class RarityBlockItem : NumericFilterPredicateBlockItem
|
||||
{
|
||||
public RarityBlockItem()
|
||||
{
|
||||
}
|
||||
|
||||
public RarityBlockItem(FilterPredicateOperator predicateOperator, int predicateOperand)
|
||||
: base(predicateOperator, predicateOperand)
|
||||
{
|
||||
}
|
||||
|
||||
public override string PrefixText
|
||||
{
|
||||
get { return "Rarity"; }
|
||||
}
|
||||
|
||||
public override int MaximumAllowed
|
||||
{
|
||||
get { return 2; }
|
||||
}
|
||||
|
||||
public override string DisplayHeading
|
||||
{
|
||||
get
|
||||
{
|
||||
return "Item Rarity";
|
||||
}
|
||||
}
|
||||
|
||||
public override string SummaryText
|
||||
{
|
||||
get
|
||||
{
|
||||
return "Rarity " + FilterPredicate.PredicateOperator.GetAttributeDescription() + " " +
|
||||
((ItemRarity) FilterPredicate.PredicateOperand).GetAttributeDescription();
|
||||
}
|
||||
}
|
||||
|
||||
public override Color SummaryBackgroundColor
|
||||
{
|
||||
get { return Colors.LightCoral; }
|
||||
}
|
||||
|
||||
public override Color SummaryTextColor
|
||||
{
|
||||
get { return Colors.White; }
|
||||
}
|
||||
|
||||
public override int SortOrder
|
||||
{
|
||||
get { return 4; }
|
||||
}
|
||||
|
||||
public override int Minimum
|
||||
{
|
||||
get
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public override int Maximum
|
||||
{
|
||||
get
|
||||
{
|
||||
return (int)ItemRarity.Unique;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
51
Filtration/Models/BlockItemTypes/SocketGroupBlockItem.cs
Normal file
51
Filtration/Models/BlockItemTypes/SocketGroupBlockItem.cs
Normal file
@@ -0,0 +1,51 @@
|
||||
using System.Linq;
|
||||
using System.Windows.Media;
|
||||
using Filtration.Models.BlockItemBaseTypes;
|
||||
|
||||
namespace Filtration.Models.BlockItemTypes
|
||||
{
|
||||
internal class SocketGroupBlockItem : StringListBlockItem
|
||||
{
|
||||
public override string PrefixText
|
||||
{
|
||||
get { return "SocketGroup"; }
|
||||
}
|
||||
|
||||
public override int MaximumAllowed
|
||||
{
|
||||
get { return 1; }
|
||||
}
|
||||
|
||||
public override string DisplayHeading
|
||||
{
|
||||
get
|
||||
{
|
||||
return "Socket Group";
|
||||
}
|
||||
}
|
||||
|
||||
public override string SummaryText
|
||||
{
|
||||
get
|
||||
{
|
||||
var summaryItemText = " " + Items.Aggregate(string.Empty, (current, i) => current + " " + i);
|
||||
return "Socket Group " + summaryItemText.TrimStart(' ');
|
||||
}
|
||||
}
|
||||
|
||||
public override Color SummaryBackgroundColor
|
||||
{
|
||||
get { return Colors.GhostWhite; }
|
||||
}
|
||||
|
||||
public override Color SummaryTextColor
|
||||
{
|
||||
get { return Colors.Black; }
|
||||
}
|
||||
|
||||
public override int SortOrder
|
||||
{
|
||||
get { return 9; }
|
||||
}
|
||||
}
|
||||
}
|
||||
72
Filtration/Models/BlockItemTypes/SocketsBlockItem.cs
Normal file
72
Filtration/Models/BlockItemTypes/SocketsBlockItem.cs
Normal file
@@ -0,0 +1,72 @@
|
||||
using System.Windows.Media;
|
||||
using Filtration.Enums;
|
||||
using Filtration.Models.BlockItemBaseTypes;
|
||||
|
||||
namespace Filtration.Models.BlockItemTypes
|
||||
{
|
||||
internal class SocketsBlockItem : NumericFilterPredicateBlockItem
|
||||
{
|
||||
public SocketsBlockItem()
|
||||
{
|
||||
}
|
||||
|
||||
public SocketsBlockItem(FilterPredicateOperator predicateOperator, int predicateOperand)
|
||||
: base(predicateOperator, predicateOperand)
|
||||
{
|
||||
}
|
||||
|
||||
public override string PrefixText
|
||||
{
|
||||
get { return "Sockets"; }
|
||||
}
|
||||
|
||||
public override int MaximumAllowed
|
||||
{
|
||||
get { return 2; }
|
||||
}
|
||||
|
||||
public override string DisplayHeading
|
||||
{
|
||||
get
|
||||
{
|
||||
return "Sockets";
|
||||
}
|
||||
}
|
||||
|
||||
public override string SummaryText
|
||||
{
|
||||
get { return "Sockets " + FilterPredicate; }
|
||||
}
|
||||
|
||||
public override Color SummaryBackgroundColor
|
||||
{
|
||||
get { return Colors.LightGray; }
|
||||
}
|
||||
|
||||
public override Color SummaryTextColor
|
||||
{
|
||||
get { return Colors.Black; }
|
||||
}
|
||||
|
||||
public override int SortOrder
|
||||
{
|
||||
get { return 5; }
|
||||
}
|
||||
|
||||
public override int Minimum
|
||||
{
|
||||
get
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public override int Maximum
|
||||
{
|
||||
get
|
||||
{
|
||||
return 6;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
40
Filtration/Models/BlockItemTypes/SoundBlockItem.cs
Normal file
40
Filtration/Models/BlockItemTypes/SoundBlockItem.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using Filtration.Models.BlockItemBaseTypes;
|
||||
|
||||
namespace Filtration.Models.BlockItemTypes
|
||||
{
|
||||
internal class SoundBlockItem : DualIntegerBlockItem
|
||||
{
|
||||
public SoundBlockItem()
|
||||
{
|
||||
Value = 1;
|
||||
SecondValue = 79;
|
||||
}
|
||||
|
||||
public SoundBlockItem(int value, int secondValue) : base(value, secondValue)
|
||||
{
|
||||
}
|
||||
|
||||
public override string PrefixText
|
||||
{
|
||||
get { return "PlayAlertSound"; }
|
||||
}
|
||||
|
||||
public override int MaximumAllowed
|
||||
{
|
||||
get { return 1; }
|
||||
}
|
||||
|
||||
public override string DisplayHeading
|
||||
{
|
||||
get
|
||||
{
|
||||
return "Play Alert Sound";
|
||||
}
|
||||
}
|
||||
|
||||
public override int SortOrder
|
||||
{
|
||||
get { return 16; }
|
||||
}
|
||||
}
|
||||
}
|
||||
39
Filtration/Models/BlockItemTypes/TextColorBlockItem.cs
Normal file
39
Filtration/Models/BlockItemTypes/TextColorBlockItem.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using System.Windows.Media;
|
||||
using Filtration.Models.BlockItemBaseTypes;
|
||||
|
||||
namespace Filtration.Models.BlockItemTypes
|
||||
{
|
||||
internal class TextColorBlockItem : ColorBlockItem
|
||||
{
|
||||
public TextColorBlockItem()
|
||||
{
|
||||
}
|
||||
|
||||
public TextColorBlockItem(Color color) : base(color)
|
||||
{
|
||||
}
|
||||
|
||||
public override string PrefixText
|
||||
{
|
||||
get { return "SetTextColor"; }
|
||||
}
|
||||
|
||||
public override int MaximumAllowed
|
||||
{
|
||||
get { return 1; }
|
||||
}
|
||||
|
||||
public override string DisplayHeading
|
||||
{
|
||||
get
|
||||
{
|
||||
return "Text Color";
|
||||
}
|
||||
}
|
||||
|
||||
public override int SortOrder
|
||||
{
|
||||
get { return 12; }
|
||||
}
|
||||
}
|
||||
}
|
||||
72
Filtration/Models/BlockItemTypes/WidthBlockItem.cs
Normal file
72
Filtration/Models/BlockItemTypes/WidthBlockItem.cs
Normal file
@@ -0,0 +1,72 @@
|
||||
using System.Windows.Media;
|
||||
using Filtration.Enums;
|
||||
using Filtration.Models.BlockItemBaseTypes;
|
||||
|
||||
namespace Filtration.Models.BlockItemTypes
|
||||
{
|
||||
internal class WidthBlockItem : NumericFilterPredicateBlockItem
|
||||
{
|
||||
public WidthBlockItem()
|
||||
{
|
||||
}
|
||||
|
||||
public WidthBlockItem(FilterPredicateOperator predicateOperator, int predicateOperand)
|
||||
: base(predicateOperator, predicateOperand)
|
||||
{
|
||||
}
|
||||
|
||||
public override string PrefixText
|
||||
{
|
||||
get { return "Width"; }
|
||||
}
|
||||
|
||||
public override int MaximumAllowed
|
||||
{
|
||||
get { return 2; }
|
||||
}
|
||||
|
||||
public override string DisplayHeading
|
||||
{
|
||||
get
|
||||
{
|
||||
return "Width";
|
||||
}
|
||||
}
|
||||
|
||||
public override string SummaryText
|
||||
{
|
||||
get { return "Width " + FilterPredicate; }
|
||||
}
|
||||
|
||||
public override Color SummaryBackgroundColor
|
||||
{
|
||||
get { return Colors.Tan; }
|
||||
}
|
||||
|
||||
public override Color SummaryTextColor
|
||||
{
|
||||
get { return Colors.White; }
|
||||
}
|
||||
|
||||
public override int SortOrder
|
||||
{
|
||||
get { return 7; }
|
||||
}
|
||||
|
||||
public override int Minimum
|
||||
{
|
||||
get
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public override int Maximum
|
||||
{
|
||||
get
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
9
Filtration/Models/IAudioVisualBlockItem.cs
Normal file
9
Filtration/Models/IAudioVisualBlockItem.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace Filtration.Models
|
||||
{
|
||||
internal interface IAudioVisualBlockItem
|
||||
{
|
||||
event PropertyChangedEventHandler PropertyChanged;
|
||||
}
|
||||
}
|
||||
16
Filtration/Models/ILootFilterBlockItem.cs
Normal file
16
Filtration/Models/ILootFilterBlockItem.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using System.ComponentModel;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace Filtration.Models
|
||||
{
|
||||
internal interface ILootFilterBlockItem : INotifyPropertyChanged
|
||||
{
|
||||
string PrefixText { get; }
|
||||
int MaximumAllowed { get; }
|
||||
string DisplayHeading { get; }
|
||||
string SummaryText { get; }
|
||||
Color SummaryBackgroundColor { get; }
|
||||
Color SummaryTextColor { get; }
|
||||
int SortOrder { get; }
|
||||
}
|
||||
}
|
||||
45
Filtration/Models/LootFilterBlock.cs
Normal file
45
Filtration/Models/LootFilterBlock.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using Filtration.Enums;
|
||||
using Filtration.Models.BlockItemBaseTypes;
|
||||
|
||||
namespace Filtration.Models
|
||||
{
|
||||
internal class LootFilterBlock
|
||||
{
|
||||
public LootFilterBlock()
|
||||
{
|
||||
BlockItems = new ObservableCollection<ILootFilterBlockItem> {new ActionBlockItem(BlockAction.Show)};
|
||||
}
|
||||
|
||||
public string Description { get; set; }
|
||||
|
||||
public BlockAction Action
|
||||
{
|
||||
get
|
||||
{
|
||||
var actionBlock = BlockItems.OfType<ActionBlockItem>().First();
|
||||
return actionBlock.Action;
|
||||
}
|
||||
set
|
||||
{
|
||||
var actionBlock = BlockItems.OfType<ActionBlockItem>().First();
|
||||
actionBlock.Action = value;
|
||||
}
|
||||
}
|
||||
|
||||
public ObservableCollection<ILootFilterBlockItem> BlockItems { get; private set; }
|
||||
|
||||
public int BlockCount(Type type)
|
||||
{
|
||||
return BlockItems != null ? BlockItems.Count(b => b.GetType() == type) : 0;
|
||||
}
|
||||
|
||||
public bool AddBlockItemAllowed(Type type)
|
||||
{
|
||||
var blockItem = (ILootFilterBlockItem)Activator.CreateInstance(type);
|
||||
return BlockCount(type) < blockItem.MaximumAllowed;
|
||||
}
|
||||
}
|
||||
}
|
||||
31
Filtration/Models/LootFilterScript.cs
Normal file
31
Filtration/Models/LootFilterScript.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
namespace Filtration.Models
|
||||
{
|
||||
internal class LootFilterScript
|
||||
{
|
||||
public LootFilterScript()
|
||||
{
|
||||
LootFilterBlocks = new ObservableCollection<LootFilterBlock>();
|
||||
}
|
||||
|
||||
public ObservableCollection<LootFilterBlock> LootFilterBlocks { get; set; }
|
||||
public string FilePath { get; set; }
|
||||
public string Description { get; set; }
|
||||
public DateTime DateModified { get; set; }
|
||||
|
||||
public List<string> Validate()
|
||||
{
|
||||
var validationErrors = new List<string>();
|
||||
|
||||
if (LootFilterBlocks.Count == 0)
|
||||
{
|
||||
validationErrors.Add("A script must have at least one block");
|
||||
}
|
||||
|
||||
return validationErrors;
|
||||
}
|
||||
}
|
||||
}
|
||||
6
Filtration/Models/LootFilterSection.cs
Normal file
6
Filtration/Models/LootFilterSection.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
namespace Filtration.Models
|
||||
{
|
||||
internal class LootFilterSection : LootFilterBlock
|
||||
{
|
||||
}
|
||||
}
|
||||
59
Filtration/Models/NumericFilterPredicate.cs
Normal file
59
Filtration/Models/NumericFilterPredicate.cs
Normal file
@@ -0,0 +1,59 @@
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
using Filtration.Annotations;
|
||||
using Filtration.Enums;
|
||||
using Filtration.Extensions;
|
||||
|
||||
namespace Filtration.Models
|
||||
{
|
||||
internal class NumericFilterPredicate : INotifyPropertyChanged
|
||||
{
|
||||
private FilterPredicateOperator _predicateOperator;
|
||||
private int _predicateOperand;
|
||||
|
||||
public NumericFilterPredicate(FilterPredicateOperator predicateOperator, int predicateOperand)
|
||||
{
|
||||
PredicateOperator = predicateOperator;
|
||||
PredicateOperand = predicateOperand;
|
||||
}
|
||||
|
||||
public NumericFilterPredicate()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public FilterPredicateOperator PredicateOperator
|
||||
{
|
||||
get { return _predicateOperator; }
|
||||
set
|
||||
{
|
||||
_predicateOperator = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public int PredicateOperand
|
||||
{
|
||||
get { return _predicateOperand; }
|
||||
set
|
||||
{
|
||||
_predicateOperand = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return PredicateOperator.GetAttributeDescription() + " " + PredicateOperand;
|
||||
}
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
[NotifyPropertyChangedInvocator]
|
||||
public virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
var handler = PropertyChanged;
|
||||
if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
}
|
||||
937
Filtration/Properties/Annotations.cs
Normal file
937
Filtration/Properties/Annotations.cs
Normal file
@@ -0,0 +1,937 @@
|
||||
using System;
|
||||
|
||||
#pragma warning disable 1591
|
||||
// ReSharper disable UnusedMember.Global
|
||||
// ReSharper disable MemberCanBePrivate.Global
|
||||
// ReSharper disable UnusedAutoPropertyAccessor.Global
|
||||
// ReSharper disable IntroduceOptionalParameters.Global
|
||||
// ReSharper disable MemberCanBeProtected.Global
|
||||
// ReSharper disable InconsistentNaming
|
||||
// ReSharper disable CheckNamespace
|
||||
|
||||
namespace Filtration.Annotations
|
||||
{
|
||||
/// <summary>
|
||||
/// Indicates that the value of the marked element could be <c>null</c> sometimes,
|
||||
/// so the check for <c>null</c> is necessary before its usage.
|
||||
/// </summary>
|
||||
/// <example><code>
|
||||
/// [CanBeNull] public object Test() { return null; }
|
||||
/// public void UseTest() {
|
||||
/// var p = Test();
|
||||
/// var s = p.ToString(); // Warning: Possible 'System.NullReferenceException'
|
||||
/// }
|
||||
/// </code></example>
|
||||
[AttributeUsage(
|
||||
AttributeTargets.Method | AttributeTargets.Parameter | AttributeTargets.Property |
|
||||
AttributeTargets.Delegate | AttributeTargets.Field | AttributeTargets.Event)]
|
||||
public sealed class CanBeNullAttribute : Attribute { }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates that the value of the marked element could never be <c>null</c>.
|
||||
/// </summary>
|
||||
/// <example><code>
|
||||
/// [NotNull] public object Foo() {
|
||||
/// return null; // Warning: Possible 'null' assignment
|
||||
/// }
|
||||
/// </code></example>
|
||||
[AttributeUsage(
|
||||
AttributeTargets.Method | AttributeTargets.Parameter | AttributeTargets.Property |
|
||||
AttributeTargets.Delegate | AttributeTargets.Field | AttributeTargets.Event)]
|
||||
public sealed class NotNullAttribute : Attribute { }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates that collection or enumerable value does not contain null elements.
|
||||
/// </summary>
|
||||
[AttributeUsage(
|
||||
AttributeTargets.Method | AttributeTargets.Parameter | AttributeTargets.Property |
|
||||
AttributeTargets.Delegate | AttributeTargets.Field)]
|
||||
public sealed class ItemNotNullAttribute : Attribute { }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates that collection or enumerable value can contain null elements.
|
||||
/// </summary>
|
||||
[AttributeUsage(
|
||||
AttributeTargets.Method | AttributeTargets.Parameter | AttributeTargets.Property |
|
||||
AttributeTargets.Delegate | AttributeTargets.Field)]
|
||||
public sealed class ItemCanBeNullAttribute : Attribute { }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates that the marked method builds string by format pattern and (optional) arguments.
|
||||
/// Parameter, which contains format string, should be given in constructor. The format string
|
||||
/// should be in <see cref="string.Format(IFormatProvider,string,object[])"/>-like form.
|
||||
/// </summary>
|
||||
/// <example><code>
|
||||
/// [StringFormatMethod("message")]
|
||||
/// public void ShowError(string message, params object[] args) { /* do something */ }
|
||||
/// public void Foo() {
|
||||
/// ShowError("Failed: {0}"); // Warning: Non-existing argument in format string
|
||||
/// }
|
||||
/// </code></example>
|
||||
[AttributeUsage(
|
||||
AttributeTargets.Constructor | AttributeTargets.Method |
|
||||
AttributeTargets.Property | AttributeTargets.Delegate)]
|
||||
public sealed class StringFormatMethodAttribute : Attribute
|
||||
{
|
||||
/// <param name="formatParameterName">
|
||||
/// Specifies which parameter of an annotated method should be treated as format-string
|
||||
/// </param>
|
||||
public StringFormatMethodAttribute(string formatParameterName)
|
||||
{
|
||||
FormatParameterName = formatParameterName;
|
||||
}
|
||||
|
||||
public string FormatParameterName { get; private set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// For a parameter that is expected to be one of the limited set of values.
|
||||
/// Specify fields of which type should be used as values for this parameter.
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Property | AttributeTargets.Field)]
|
||||
public sealed class ValueProviderAttribute : Attribute
|
||||
{
|
||||
public ValueProviderAttribute(string name)
|
||||
{
|
||||
Name = name;
|
||||
}
|
||||
|
||||
[NotNull] public string Name { get; private set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Indicates that the function argument should be string literal and match one
|
||||
/// of the parameters of the caller function. For example, ReSharper annotates
|
||||
/// the parameter of <see cref="System.ArgumentNullException"/>.
|
||||
/// </summary>
|
||||
/// <example><code>
|
||||
/// public void Foo(string param) {
|
||||
/// if (param == null)
|
||||
/// throw new ArgumentNullException("par"); // Warning: Cannot resolve symbol
|
||||
/// }
|
||||
/// </code></example>
|
||||
[AttributeUsage(AttributeTargets.Parameter)]
|
||||
public sealed class InvokerParameterNameAttribute : Attribute { }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates that the method is contained in a type that implements
|
||||
/// <c>System.ComponentModel.INotifyPropertyChanged</c> interface and this method
|
||||
/// is used to notify that some property value changed.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The method should be non-static and conform to one of the supported signatures:
|
||||
/// <list>
|
||||
/// <item><c>NotifyChanged(string)</c></item>
|
||||
/// <item><c>NotifyChanged(params string[])</c></item>
|
||||
/// <item><c>NotifyChanged{T}(Expression{Func{T}})</c></item>
|
||||
/// <item><c>NotifyChanged{T,U}(Expression{Func{T,U}})</c></item>
|
||||
/// <item><c>SetProperty{T}(ref T, T, string)</c></item>
|
||||
/// </list>
|
||||
/// </remarks>
|
||||
/// <example><code>
|
||||
/// public class Foo : INotifyPropertyChanged {
|
||||
/// public event PropertyChangedEventHandler PropertyChanged;
|
||||
/// [NotifyPropertyChangedInvocator]
|
||||
/// protected virtual void NotifyChanged(string propertyName) { ... }
|
||||
///
|
||||
/// private string _name;
|
||||
/// public string Name {
|
||||
/// get { return _name; }
|
||||
/// set { _name = value; NotifyChanged("LastName"); /* Warning */ }
|
||||
/// }
|
||||
/// }
|
||||
/// </code>
|
||||
/// Examples of generated notifications:
|
||||
/// <list>
|
||||
/// <item><c>NotifyChanged("Property")</c></item>
|
||||
/// <item><c>NotifyChanged(() => Property)</c></item>
|
||||
/// <item><c>NotifyChanged((VM x) => x.Property)</c></item>
|
||||
/// <item><c>SetProperty(ref myField, value, "Property")</c></item>
|
||||
/// </list>
|
||||
/// </example>
|
||||
[AttributeUsage(AttributeTargets.Method)]
|
||||
public sealed class NotifyPropertyChangedInvocatorAttribute : Attribute
|
||||
{
|
||||
public NotifyPropertyChangedInvocatorAttribute() { }
|
||||
public NotifyPropertyChangedInvocatorAttribute(string parameterName)
|
||||
{
|
||||
ParameterName = parameterName;
|
||||
}
|
||||
|
||||
public string ParameterName { get; private set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Describes dependency between method input and output.
|
||||
/// </summary>
|
||||
/// <syntax>
|
||||
/// <p>Function Definition Table syntax:</p>
|
||||
/// <list>
|
||||
/// <item>FDT ::= FDTRow [;FDTRow]*</item>
|
||||
/// <item>FDTRow ::= Input => Output | Output <= Input</item>
|
||||
/// <item>Input ::= ParameterName: Value [, Input]*</item>
|
||||
/// <item>Output ::= [ParameterName: Value]* {halt|stop|void|nothing|Value}</item>
|
||||
/// <item>Value ::= true | false | null | notnull | canbenull</item>
|
||||
/// </list>
|
||||
/// If method has single input parameter, it's name could be omitted.<br/>
|
||||
/// Using <c>halt</c> (or <c>void</c>/<c>nothing</c>, which is the same)
|
||||
/// for method output means that the methos doesn't return normally.<br/>
|
||||
/// <c>canbenull</c> annotation is only applicable for output parameters.<br/>
|
||||
/// You can use multiple <c>[ContractAnnotation]</c> for each FDT row,
|
||||
/// or use single attribute with rows separated by semicolon.<br/>
|
||||
/// </syntax>
|
||||
/// <examples><list>
|
||||
/// <item><code>
|
||||
/// [ContractAnnotation("=> halt")]
|
||||
/// public void TerminationMethod()
|
||||
/// </code></item>
|
||||
/// <item><code>
|
||||
/// [ContractAnnotation("halt <= condition: false")]
|
||||
/// public void Assert(bool condition, string text) // regular assertion method
|
||||
/// </code></item>
|
||||
/// <item><code>
|
||||
/// [ContractAnnotation("s:null => true")]
|
||||
/// public bool IsNullOrEmpty(string s) // string.IsNullOrEmpty()
|
||||
/// </code></item>
|
||||
/// <item><code>
|
||||
/// // A method that returns null if the parameter is null,
|
||||
/// // and not null if the parameter is not null
|
||||
/// [ContractAnnotation("null => null; notnull => notnull")]
|
||||
/// public object Transform(object data)
|
||||
/// </code></item>
|
||||
/// <item><code>
|
||||
/// [ContractAnnotation("s:null=>false; =>true,result:notnull; =>false, result:null")]
|
||||
/// public bool TryParse(string s, out Person result)
|
||||
/// </code></item>
|
||||
/// </list></examples>
|
||||
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
|
||||
public sealed class ContractAnnotationAttribute : Attribute
|
||||
{
|
||||
public ContractAnnotationAttribute([NotNull] string contract)
|
||||
: this(contract, false) { }
|
||||
|
||||
public ContractAnnotationAttribute([NotNull] string contract, bool forceFullStates)
|
||||
{
|
||||
Contract = contract;
|
||||
ForceFullStates = forceFullStates;
|
||||
}
|
||||
|
||||
public string Contract { get; private set; }
|
||||
public bool ForceFullStates { get; private set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Indicates that marked element should be localized or not.
|
||||
/// </summary>
|
||||
/// <example><code>
|
||||
/// [LocalizationRequiredAttribute(true)]
|
||||
/// public class Foo {
|
||||
/// private string str = "my string"; // Warning: Localizable string
|
||||
/// }
|
||||
/// </code></example>
|
||||
[AttributeUsage(AttributeTargets.All)]
|
||||
public sealed class LocalizationRequiredAttribute : Attribute
|
||||
{
|
||||
public LocalizationRequiredAttribute() : this(true) { }
|
||||
public LocalizationRequiredAttribute(bool required)
|
||||
{
|
||||
Required = required;
|
||||
}
|
||||
|
||||
public bool Required { get; private set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Indicates that the value of the marked type (or its derivatives)
|
||||
/// cannot be compared using '==' or '!=' operators and <c>Equals()</c>
|
||||
/// should be used instead. However, using '==' or '!=' for comparison
|
||||
/// with <c>null</c> is always permitted.
|
||||
/// </summary>
|
||||
/// <example><code>
|
||||
/// [CannotApplyEqualityOperator]
|
||||
/// class NoEquality { }
|
||||
/// class UsesNoEquality {
|
||||
/// public void Test() {
|
||||
/// var ca1 = new NoEquality();
|
||||
/// var ca2 = new NoEquality();
|
||||
/// if (ca1 != null) { // OK
|
||||
/// bool condition = ca1 == ca2; // Warning
|
||||
/// }
|
||||
/// }
|
||||
/// }
|
||||
/// </code></example>
|
||||
[AttributeUsage(AttributeTargets.Interface | AttributeTargets.Class | AttributeTargets.Struct)]
|
||||
public sealed class CannotApplyEqualityOperatorAttribute : Attribute { }
|
||||
|
||||
/// <summary>
|
||||
/// When applied to a target attribute, specifies a requirement for any type marked
|
||||
/// with the target attribute to implement or inherit specific type or types.
|
||||
/// </summary>
|
||||
/// <example><code>
|
||||
/// [BaseTypeRequired(typeof(IComponent)] // Specify requirement
|
||||
/// public class ComponentAttribute : Attribute { }
|
||||
/// [Component] // ComponentAttribute requires implementing IComponent interface
|
||||
/// public class MyComponent : IComponent { }
|
||||
/// </code></example>
|
||||
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
|
||||
[BaseTypeRequired(typeof(Attribute))]
|
||||
public sealed class BaseTypeRequiredAttribute : Attribute
|
||||
{
|
||||
public BaseTypeRequiredAttribute([NotNull] Type baseType)
|
||||
{
|
||||
BaseType = baseType;
|
||||
}
|
||||
|
||||
[NotNull] public Type BaseType { get; private set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Indicates that the marked symbol is used implicitly (e.g. via reflection, in external library),
|
||||
/// so this symbol will not be marked as unused (as well as by other usage inspections).
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.All)]
|
||||
public sealed class UsedImplicitlyAttribute : Attribute
|
||||
{
|
||||
public UsedImplicitlyAttribute()
|
||||
: this(ImplicitUseKindFlags.Default, ImplicitUseTargetFlags.Default) { }
|
||||
|
||||
public UsedImplicitlyAttribute(ImplicitUseKindFlags useKindFlags)
|
||||
: this(useKindFlags, ImplicitUseTargetFlags.Default) { }
|
||||
|
||||
public UsedImplicitlyAttribute(ImplicitUseTargetFlags targetFlags)
|
||||
: this(ImplicitUseKindFlags.Default, targetFlags) { }
|
||||
|
||||
public UsedImplicitlyAttribute(ImplicitUseKindFlags useKindFlags, ImplicitUseTargetFlags targetFlags)
|
||||
{
|
||||
UseKindFlags = useKindFlags;
|
||||
TargetFlags = targetFlags;
|
||||
}
|
||||
|
||||
public ImplicitUseKindFlags UseKindFlags { get; private set; }
|
||||
public ImplicitUseTargetFlags TargetFlags { get; private set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Should be used on attributes and causes ReSharper to not mark symbols marked with such attributes
|
||||
/// as unused (as well as by other usage inspections)
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Class | AttributeTargets.GenericParameter)]
|
||||
public sealed class MeansImplicitUseAttribute : Attribute
|
||||
{
|
||||
public MeansImplicitUseAttribute()
|
||||
: this(ImplicitUseKindFlags.Default, ImplicitUseTargetFlags.Default) { }
|
||||
|
||||
public MeansImplicitUseAttribute(ImplicitUseKindFlags useKindFlags)
|
||||
: this(useKindFlags, ImplicitUseTargetFlags.Default) { }
|
||||
|
||||
public MeansImplicitUseAttribute(ImplicitUseTargetFlags targetFlags)
|
||||
: this(ImplicitUseKindFlags.Default, targetFlags) { }
|
||||
|
||||
public MeansImplicitUseAttribute(ImplicitUseKindFlags useKindFlags, ImplicitUseTargetFlags targetFlags)
|
||||
{
|
||||
UseKindFlags = useKindFlags;
|
||||
TargetFlags = targetFlags;
|
||||
}
|
||||
|
||||
[UsedImplicitly] public ImplicitUseKindFlags UseKindFlags { get; private set; }
|
||||
[UsedImplicitly] public ImplicitUseTargetFlags TargetFlags { get; private set; }
|
||||
}
|
||||
|
||||
[Flags]
|
||||
public enum ImplicitUseKindFlags
|
||||
{
|
||||
Default = Access | Assign | InstantiatedWithFixedConstructorSignature,
|
||||
/// <summary>Only entity marked with attribute considered used.</summary>
|
||||
Access = 1,
|
||||
/// <summary>Indicates implicit assignment to a member.</summary>
|
||||
Assign = 2,
|
||||
/// <summary>
|
||||
/// Indicates implicit instantiation of a type with fixed constructor signature.
|
||||
/// That means any unused constructor parameters won't be reported as such.
|
||||
/// </summary>
|
||||
InstantiatedWithFixedConstructorSignature = 4,
|
||||
/// <summary>Indicates implicit instantiation of a type.</summary>
|
||||
InstantiatedNoFixedConstructorSignature = 8,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Specify what is considered used implicitly when marked
|
||||
/// with <see cref="MeansImplicitUseAttribute"/> or <see cref="UsedImplicitlyAttribute"/>.
|
||||
/// </summary>
|
||||
[Flags]
|
||||
public enum ImplicitUseTargetFlags
|
||||
{
|
||||
Default = Itself,
|
||||
Itself = 1,
|
||||
/// <summary>Members of entity marked with attribute are considered used.</summary>
|
||||
Members = 2,
|
||||
/// <summary>Entity marked with attribute and all its members considered used.</summary>
|
||||
WithMembers = Itself | Members
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This attribute is intended to mark publicly available API
|
||||
/// which should not be removed and so is treated as used.
|
||||
/// </summary>
|
||||
[MeansImplicitUse(ImplicitUseTargetFlags.WithMembers)]
|
||||
public sealed class PublicAPIAttribute : Attribute
|
||||
{
|
||||
public PublicAPIAttribute() { }
|
||||
public PublicAPIAttribute([NotNull] string comment)
|
||||
{
|
||||
Comment = comment;
|
||||
}
|
||||
|
||||
public string Comment { get; private set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tells code analysis engine if the parameter is completely handled when the invoked method is on stack.
|
||||
/// If the parameter is a delegate, indicates that delegate is executed while the method is executed.
|
||||
/// If the parameter is an enumerable, indicates that it is enumerated while the method is executed.
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Parameter)]
|
||||
public sealed class InstantHandleAttribute : Attribute { }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates that a method does not make any observable state changes.
|
||||
/// The same as <c>System.Diagnostics.Contracts.PureAttribute</c>.
|
||||
/// </summary>
|
||||
/// <example><code>
|
||||
/// [Pure] private int Multiply(int x, int y) { return x * y; }
|
||||
/// public void Foo() {
|
||||
/// const int a = 2, b = 2;
|
||||
/// Multiply(a, b); // Waring: Return value of pure method is not used
|
||||
/// }
|
||||
/// </code></example>
|
||||
[AttributeUsage(AttributeTargets.Method)]
|
||||
public sealed class PureAttribute : Attribute { }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates that a parameter is a path to a file or a folder within a web project.
|
||||
/// Path can be relative or absolute, starting from web root (~).
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Parameter)]
|
||||
public sealed class PathReferenceAttribute : Attribute
|
||||
{
|
||||
public PathReferenceAttribute() { }
|
||||
public PathReferenceAttribute([PathReference] string basePath)
|
||||
{
|
||||
BasePath = basePath;
|
||||
}
|
||||
|
||||
public string BasePath { get; private set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// An extension method marked with this attribute is processed by ReSharper code completion
|
||||
/// as a 'Source Template'. When extension method is completed over some expression, it's source code
|
||||
/// is automatically expanded like a template at call site.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Template method body can contain valid source code and/or special comments starting with '$'.
|
||||
/// Text inside these comments is added as source code when the template is applied. Template parameters
|
||||
/// can be used either as additional method parameters or as identifiers wrapped in two '$' signs.
|
||||
/// Use the <see cref="MacroAttribute"/> attribute to specify macros for parameters.
|
||||
/// </remarks>
|
||||
/// <example>
|
||||
/// In this example, the 'forEach' method is a source template available over all values
|
||||
/// of enumerable types, producing ordinary C# 'foreach' statement and placing caret inside block:
|
||||
/// <code>
|
||||
/// [SourceTemplate]
|
||||
/// public static void forEach<T>(this IEnumerable<T> xs) {
|
||||
/// foreach (var x in xs) {
|
||||
/// //$ $END$
|
||||
/// }
|
||||
/// }
|
||||
/// </code>
|
||||
/// </example>
|
||||
[AttributeUsage(AttributeTargets.Method)]
|
||||
public sealed class SourceTemplateAttribute : Attribute { }
|
||||
|
||||
/// <summary>
|
||||
/// Allows specifying a macro for a parameter of a <see cref="SourceTemplateAttribute">source template</see>.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// You can apply the attribute on the whole method or on any of its additional parameters. The macro expression
|
||||
/// is defined in the <see cref="MacroAttribute.Expression"/> property. When applied on a method, the target
|
||||
/// template parameter is defined in the <see cref="MacroAttribute.Target"/> property. To apply the macro silently
|
||||
/// for the parameter, set the <see cref="MacroAttribute.Editable"/> property value = -1.
|
||||
/// </remarks>
|
||||
/// <example>
|
||||
/// Applying the attribute on a source template method:
|
||||
/// <code>
|
||||
/// [SourceTemplate, Macro(Target = "item", Expression = "suggestVariableName()")]
|
||||
/// public static void forEach<T>(this IEnumerable<T> collection) {
|
||||
/// foreach (var item in collection) {
|
||||
/// //$ $END$
|
||||
/// }
|
||||
/// }
|
||||
/// </code>
|
||||
/// Applying the attribute on a template method parameter:
|
||||
/// <code>
|
||||
/// [SourceTemplate]
|
||||
/// public static void something(this Entity x, [Macro(Expression = "guid()", Editable = -1)] string newguid) {
|
||||
/// /*$ var $x$Id = "$newguid$" + x.ToString();
|
||||
/// x.DoSomething($x$Id); */
|
||||
/// }
|
||||
/// </code>
|
||||
/// </example>
|
||||
[AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method, AllowMultiple = true)]
|
||||
public sealed class MacroAttribute : Attribute
|
||||
{
|
||||
/// <summary>
|
||||
/// Allows specifying a macro that will be executed for a <see cref="SourceTemplateAttribute">source template</see>
|
||||
/// parameter when the template is expanded.
|
||||
/// </summary>
|
||||
public string Expression { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Allows specifying which occurrence of the target parameter becomes editable when the template is deployed.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// If the target parameter is used several times in the template, only one occurrence becomes editable;
|
||||
/// other occurrences are changed synchronously. To specify the zero-based index of the editable occurrence,
|
||||
/// use values >= 0. To make the parameter non-editable when the template is expanded, use -1.
|
||||
/// </remarks>>
|
||||
public int Editable { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Identifies the target parameter of a <see cref="SourceTemplateAttribute">source template</see> if the
|
||||
/// <see cref="MacroAttribute"/> is applied on a template method.
|
||||
/// </summary>
|
||||
public string Target { get; set; }
|
||||
}
|
||||
|
||||
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
|
||||
public sealed class AspMvcAreaMasterLocationFormatAttribute : Attribute
|
||||
{
|
||||
public AspMvcAreaMasterLocationFormatAttribute(string format)
|
||||
{
|
||||
Format = format;
|
||||
}
|
||||
|
||||
public string Format { get; private set; }
|
||||
}
|
||||
|
||||
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
|
||||
public sealed class AspMvcAreaPartialViewLocationFormatAttribute : Attribute
|
||||
{
|
||||
public AspMvcAreaPartialViewLocationFormatAttribute(string format)
|
||||
{
|
||||
Format = format;
|
||||
}
|
||||
|
||||
public string Format { get; private set; }
|
||||
}
|
||||
|
||||
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
|
||||
public sealed class AspMvcAreaViewLocationFormatAttribute : Attribute
|
||||
{
|
||||
public AspMvcAreaViewLocationFormatAttribute(string format)
|
||||
{
|
||||
Format = format;
|
||||
}
|
||||
|
||||
public string Format { get; private set; }
|
||||
}
|
||||
|
||||
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
|
||||
public sealed class AspMvcMasterLocationFormatAttribute : Attribute
|
||||
{
|
||||
public AspMvcMasterLocationFormatAttribute(string format)
|
||||
{
|
||||
Format = format;
|
||||
}
|
||||
|
||||
public string Format { get; private set; }
|
||||
}
|
||||
|
||||
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
|
||||
public sealed class AspMvcPartialViewLocationFormatAttribute : Attribute
|
||||
{
|
||||
public AspMvcPartialViewLocationFormatAttribute(string format)
|
||||
{
|
||||
Format = format;
|
||||
}
|
||||
|
||||
public string Format { get; private set; }
|
||||
}
|
||||
|
||||
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
|
||||
public sealed class AspMvcViewLocationFormatAttribute : Attribute
|
||||
{
|
||||
public AspMvcViewLocationFormatAttribute(string format)
|
||||
{
|
||||
Format = format;
|
||||
}
|
||||
|
||||
public string Format { get; private set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter
|
||||
/// is an MVC action. If applied to a method, the MVC action name is calculated
|
||||
/// implicitly from the context. Use this attribute for custom wrappers similar to
|
||||
/// <c>System.Web.Mvc.Html.ChildActionExtensions.RenderAction(HtmlHelper, String)</c>.
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method)]
|
||||
public sealed class AspMvcActionAttribute : Attribute
|
||||
{
|
||||
public AspMvcActionAttribute() { }
|
||||
public AspMvcActionAttribute(string anonymousProperty)
|
||||
{
|
||||
AnonymousProperty = anonymousProperty;
|
||||
}
|
||||
|
||||
public string AnonymousProperty { get; private set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ASP.NET MVC attribute. Indicates that a parameter is an MVC area.
|
||||
/// Use this attribute for custom wrappers similar to
|
||||
/// <c>System.Web.Mvc.Html.ChildActionExtensions.RenderAction(HtmlHelper, String)</c>.
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Parameter)]
|
||||
public sealed class AspMvcAreaAttribute : Attribute
|
||||
{
|
||||
public AspMvcAreaAttribute() { }
|
||||
public AspMvcAreaAttribute(string anonymousProperty)
|
||||
{
|
||||
AnonymousProperty = anonymousProperty;
|
||||
}
|
||||
|
||||
public string AnonymousProperty { get; private set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter is
|
||||
/// an MVC controller. If applied to a method, the MVC controller name is calculated
|
||||
/// implicitly from the context. Use this attribute for custom wrappers similar to
|
||||
/// <c>System.Web.Mvc.Html.ChildActionExtensions.RenderAction(HtmlHelper, String, String)</c>.
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method)]
|
||||
public sealed class AspMvcControllerAttribute : Attribute
|
||||
{
|
||||
public AspMvcControllerAttribute() { }
|
||||
public AspMvcControllerAttribute(string anonymousProperty)
|
||||
{
|
||||
AnonymousProperty = anonymousProperty;
|
||||
}
|
||||
|
||||
public string AnonymousProperty { get; private set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ASP.NET MVC attribute. Indicates that a parameter is an MVC Master. Use this attribute
|
||||
/// for custom wrappers similar to <c>System.Web.Mvc.Controller.View(String, String)</c>.
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Parameter)]
|
||||
public sealed class AspMvcMasterAttribute : Attribute { }
|
||||
|
||||
/// <summary>
|
||||
/// ASP.NET MVC attribute. Indicates that a parameter is an MVC model type. Use this attribute
|
||||
/// for custom wrappers similar to <c>System.Web.Mvc.Controller.View(String, Object)</c>.
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Parameter)]
|
||||
public sealed class AspMvcModelTypeAttribute : Attribute { }
|
||||
|
||||
/// <summary>
|
||||
/// ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter is an MVC
|
||||
/// partial view. If applied to a method, the MVC partial view name is calculated implicitly
|
||||
/// from the context. Use this attribute for custom wrappers similar to
|
||||
/// <c>System.Web.Mvc.Html.RenderPartialExtensions.RenderPartial(HtmlHelper, String)</c>.
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method)]
|
||||
public sealed class AspMvcPartialViewAttribute : Attribute { }
|
||||
|
||||
/// <summary>
|
||||
/// ASP.NET MVC attribute. Allows disabling inspections for MVC views within a class or a method.
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)]
|
||||
public sealed class AspMvcSupressViewErrorAttribute : Attribute { }
|
||||
|
||||
/// <summary>
|
||||
/// ASP.NET MVC attribute. Indicates that a parameter is an MVC display template.
|
||||
/// Use this attribute for custom wrappers similar to
|
||||
/// <c>System.Web.Mvc.Html.DisplayExtensions.DisplayForModel(HtmlHelper, String)</c>.
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Parameter)]
|
||||
public sealed class AspMvcDisplayTemplateAttribute : Attribute { }
|
||||
|
||||
/// <summary>
|
||||
/// ASP.NET MVC attribute. Indicates that a parameter is an MVC editor template.
|
||||
/// Use this attribute for custom wrappers similar to
|
||||
/// <c>System.Web.Mvc.Html.EditorExtensions.EditorForModel(HtmlHelper, String)</c>.
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Parameter)]
|
||||
public sealed class AspMvcEditorTemplateAttribute : Attribute { }
|
||||
|
||||
/// <summary>
|
||||
/// ASP.NET MVC attribute. Indicates that a parameter is an MVC template.
|
||||
/// Use this attribute for custom wrappers similar to
|
||||
/// <c>System.ComponentModel.DataAnnotations.UIHintAttribute(System.String)</c>.
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Parameter)]
|
||||
public sealed class AspMvcTemplateAttribute : Attribute { }
|
||||
|
||||
/// <summary>
|
||||
/// ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter
|
||||
/// is an MVC view. If applied to a method, the MVC view name is calculated implicitly
|
||||
/// from the context. Use this attribute for custom wrappers similar to
|
||||
/// <c>System.Web.Mvc.Controller.View(Object)</c>.
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method)]
|
||||
public sealed class AspMvcViewAttribute : Attribute { }
|
||||
|
||||
/// <summary>
|
||||
/// ASP.NET MVC attribute. When applied to a parameter of an attribute,
|
||||
/// indicates that this parameter is an MVC action name.
|
||||
/// </summary>
|
||||
/// <example><code>
|
||||
/// [ActionName("Foo")]
|
||||
/// public ActionResult Login(string returnUrl) {
|
||||
/// ViewBag.ReturnUrl = Url.Action("Foo"); // OK
|
||||
/// return RedirectToAction("Bar"); // Error: Cannot resolve action
|
||||
/// }
|
||||
/// </code></example>
|
||||
[AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Property)]
|
||||
public sealed class AspMvcActionSelectorAttribute : Attribute { }
|
||||
|
||||
[AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Property | AttributeTargets.Field)]
|
||||
public sealed class HtmlElementAttributesAttribute : Attribute
|
||||
{
|
||||
public HtmlElementAttributesAttribute() { }
|
||||
public HtmlElementAttributesAttribute(string name)
|
||||
{
|
||||
Name = name;
|
||||
}
|
||||
|
||||
public string Name { get; private set; }
|
||||
}
|
||||
|
||||
[AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property)]
|
||||
public sealed class HtmlAttributeValueAttribute : Attribute
|
||||
{
|
||||
public HtmlAttributeValueAttribute([NotNull] string name)
|
||||
{
|
||||
Name = name;
|
||||
}
|
||||
|
||||
[NotNull] public string Name { get; private set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Razor attribute. Indicates that a parameter or a method is a Razor section.
|
||||
/// Use this attribute for custom wrappers similar to
|
||||
/// <c>System.Web.WebPages.WebPageBase.RenderSection(String)</c>.
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method)]
|
||||
public sealed class RazorSectionAttribute : Attribute { }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates how method invocation affects content of the collection.
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Method)]
|
||||
public sealed class CollectionAccessAttribute : Attribute
|
||||
{
|
||||
public CollectionAccessAttribute(CollectionAccessType collectionAccessType)
|
||||
{
|
||||
CollectionAccessType = collectionAccessType;
|
||||
}
|
||||
|
||||
public CollectionAccessType CollectionAccessType { get; private set; }
|
||||
}
|
||||
|
||||
[Flags]
|
||||
public enum CollectionAccessType
|
||||
{
|
||||
/// <summary>Method does not use or modify content of the collection.</summary>
|
||||
None = 0,
|
||||
/// <summary>Method only reads content of the collection but does not modify it.</summary>
|
||||
Read = 1,
|
||||
/// <summary>Method can change content of the collection but does not add new elements.</summary>
|
||||
ModifyExistingContent = 2,
|
||||
/// <summary>Method can add new elements to the collection.</summary>
|
||||
UpdatedContent = ModifyExistingContent | 4
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Indicates that the marked method is assertion method, i.e. it halts control flow if
|
||||
/// one of the conditions is satisfied. To set the condition, mark one of the parameters with
|
||||
/// <see cref="AssertionConditionAttribute"/> attribute.
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Method)]
|
||||
public sealed class AssertionMethodAttribute : Attribute { }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates the condition parameter of the assertion method. The method itself should be
|
||||
/// marked by <see cref="AssertionMethodAttribute"/> attribute. The mandatory argument of
|
||||
/// the attribute is the assertion type.
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Parameter)]
|
||||
public sealed class AssertionConditionAttribute : Attribute
|
||||
{
|
||||
public AssertionConditionAttribute(AssertionConditionType conditionType)
|
||||
{
|
||||
ConditionType = conditionType;
|
||||
}
|
||||
|
||||
public AssertionConditionType ConditionType { get; private set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Specifies assertion type. If the assertion method argument satisfies the condition,
|
||||
/// then the execution continues. Otherwise, execution is assumed to be halted.
|
||||
/// </summary>
|
||||
public enum AssertionConditionType
|
||||
{
|
||||
/// <summary>Marked parameter should be evaluated to true.</summary>
|
||||
IS_TRUE = 0,
|
||||
/// <summary>Marked parameter should be evaluated to false.</summary>
|
||||
IS_FALSE = 1,
|
||||
/// <summary>Marked parameter should be evaluated to null value.</summary>
|
||||
IS_NULL = 2,
|
||||
/// <summary>Marked parameter should be evaluated to not null value.</summary>
|
||||
IS_NOT_NULL = 3,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Indicates that the marked method unconditionally terminates control flow execution.
|
||||
/// For example, it could unconditionally throw exception.
|
||||
/// </summary>
|
||||
[Obsolete("Use [ContractAnnotation('=> halt')] instead")]
|
||||
[AttributeUsage(AttributeTargets.Method)]
|
||||
public sealed class TerminatesProgramAttribute : Attribute { }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates that method is pure LINQ method, with postponed enumeration (like Enumerable.Select,
|
||||
/// .Where). This annotation allows inference of [InstantHandle] annotation for parameters
|
||||
/// of delegate type by analyzing LINQ method chains.
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Method)]
|
||||
public sealed class LinqTunnelAttribute : Attribute { }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates that IEnumerable, passed as parameter, is not enumerated.
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Parameter)]
|
||||
public sealed class NoEnumerationAttribute : Attribute { }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates that parameter is regular expression pattern.
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Parameter)]
|
||||
public sealed class RegexPatternAttribute : Attribute { }
|
||||
|
||||
/// <summary>
|
||||
/// XAML attribute. Indicates the type that has <c>ItemsSource</c> property and should be treated
|
||||
/// as <c>ItemsControl</c>-derived type, to enable inner items <c>DataContext</c> type resolve.
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Class)]
|
||||
public sealed class XamlItemsControlAttribute : Attribute { }
|
||||
|
||||
/// <summary>
|
||||
/// XAML attibute. Indicates the property of some <c>BindingBase</c>-derived type, that
|
||||
/// is used to bind some item of <c>ItemsControl</c>-derived type. This annotation will
|
||||
/// enable the <c>DataContext</c> type resolve for XAML bindings for such properties.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Property should have the tree ancestor of the <c>ItemsControl</c> type or
|
||||
/// marked with the <see cref="XamlItemsControlAttribute"/> attribute.
|
||||
/// </remarks>
|
||||
[AttributeUsage(AttributeTargets.Property)]
|
||||
public sealed class XamlItemBindingOfItemsControlAttribute : Attribute { }
|
||||
|
||||
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
|
||||
public sealed class AspChildControlTypeAttribute : Attribute
|
||||
{
|
||||
public AspChildControlTypeAttribute(string tagName, Type controlType)
|
||||
{
|
||||
TagName = tagName;
|
||||
ControlType = controlType;
|
||||
}
|
||||
|
||||
public string TagName { get; private set; }
|
||||
public Type ControlType { get; private set; }
|
||||
}
|
||||
|
||||
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Method)]
|
||||
public sealed class AspDataFieldAttribute : Attribute { }
|
||||
|
||||
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Method)]
|
||||
public sealed class AspDataFieldsAttribute : Attribute { }
|
||||
|
||||
[AttributeUsage(AttributeTargets.Property)]
|
||||
public sealed class AspMethodPropertyAttribute : Attribute { }
|
||||
|
||||
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
|
||||
public sealed class AspRequiredAttributeAttribute : Attribute
|
||||
{
|
||||
public AspRequiredAttributeAttribute([NotNull] string attribute)
|
||||
{
|
||||
Attribute = attribute;
|
||||
}
|
||||
|
||||
public string Attribute { get; private set; }
|
||||
}
|
||||
|
||||
[AttributeUsage(AttributeTargets.Property)]
|
||||
public sealed class AspTypePropertyAttribute : Attribute
|
||||
{
|
||||
public bool CreateConstructorReferences { get; private set; }
|
||||
|
||||
public AspTypePropertyAttribute(bool createConstructorReferences)
|
||||
{
|
||||
CreateConstructorReferences = createConstructorReferences;
|
||||
}
|
||||
}
|
||||
|
||||
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
|
||||
public sealed class RazorImportNamespaceAttribute : Attribute
|
||||
{
|
||||
public RazorImportNamespaceAttribute(string name)
|
||||
{
|
||||
Name = name;
|
||||
}
|
||||
|
||||
public string Name { get; private set; }
|
||||
}
|
||||
|
||||
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
|
||||
public sealed class RazorInjectionAttribute : Attribute
|
||||
{
|
||||
public RazorInjectionAttribute(string type, string fieldName)
|
||||
{
|
||||
Type = type;
|
||||
FieldName = fieldName;
|
||||
}
|
||||
|
||||
public string Type { get; private set; }
|
||||
public string FieldName { get; private set; }
|
||||
}
|
||||
|
||||
[AttributeUsage(AttributeTargets.Method)]
|
||||
public sealed class RazorHelperCommonAttribute : Attribute { }
|
||||
|
||||
[AttributeUsage(AttributeTargets.Property)]
|
||||
public sealed class RazorLayoutAttribute : Attribute { }
|
||||
|
||||
[AttributeUsage(AttributeTargets.Method)]
|
||||
public sealed class RazorWriteLiteralMethodAttribute : Attribute { }
|
||||
|
||||
[AttributeUsage(AttributeTargets.Method)]
|
||||
public sealed class RazorWriteMethodAttribute : Attribute { }
|
||||
|
||||
[AttributeUsage(AttributeTargets.Parameter)]
|
||||
public sealed class RazorWriteMethodParameterAttribute : Attribute { }
|
||||
|
||||
/// <summary>
|
||||
/// Prevents the Member Reordering feature from tossing members of the marked class.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The attribute must be mentioned in your member reordering patterns
|
||||
/// </remarks>
|
||||
[AttributeUsage(AttributeTargets.All)]
|
||||
public sealed class NoReorder : Attribute { }
|
||||
}
|
||||
57
Filtration/Properties/AssemblyInfo.cs
Normal file
57
Filtration/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,57 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Filtration")]
|
||||
[assembly: AssemblyDescription("A loot filter script manager for Path of Exile")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("XVar Industries Inc.")]
|
||||
[assembly: AssemblyProduct("Filtration")]
|
||||
[assembly: AssemblyCopyright("Copyright © Ben Wallis 2015")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
//In order to begin building localizable applications, set
|
||||
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
|
||||
//inside a <PropertyGroup>. For example, if you are using US english
|
||||
//in your source files, set the <UICulture> to en-US. Then uncomment
|
||||
//the NeutralResourceLanguage attribute below. Update the "en-US" in
|
||||
//the line below to match the UICulture setting in the project file.
|
||||
|
||||
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
|
||||
|
||||
|
||||
[assembly: ThemeInfo(
|
||||
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
|
||||
//(used if a resource is not found in the page,
|
||||
// or application resource dictionaries)
|
||||
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
|
||||
//(used if a resource is not found in the page,
|
||||
// app, or any theme specific resource dictionaries)
|
||||
)]
|
||||
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
|
||||
[assembly: InternalsVisibleTo("Filtration.Tests")]
|
||||
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")]
|
||||
164
Filtration/Properties/Resources.Designer.cs
generated
Normal file
164
Filtration/Properties/Resources.Designer.cs
generated
Normal file
@@ -0,0 +1,164 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.0
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Filtration.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Filtration.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.IO.UnmanagedMemoryStream similar to System.IO.MemoryStream.
|
||||
/// </summary>
|
||||
internal static System.IO.UnmanagedMemoryStream AlertSound1 {
|
||||
get {
|
||||
return ResourceManager.GetStream("AlertSound1", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.IO.UnmanagedMemoryStream similar to System.IO.MemoryStream.
|
||||
/// </summary>
|
||||
internal static System.IO.UnmanagedMemoryStream AlertSound2 {
|
||||
get {
|
||||
return ResourceManager.GetStream("AlertSound2", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.IO.UnmanagedMemoryStream similar to System.IO.MemoryStream.
|
||||
/// </summary>
|
||||
internal static System.IO.UnmanagedMemoryStream AlertSound3 {
|
||||
get {
|
||||
return ResourceManager.GetStream("AlertSound3", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.IO.UnmanagedMemoryStream similar to System.IO.MemoryStream.
|
||||
/// </summary>
|
||||
internal static System.IO.UnmanagedMemoryStream AlertSound4 {
|
||||
get {
|
||||
return ResourceManager.GetStream("AlertSound4", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.IO.UnmanagedMemoryStream similar to System.IO.MemoryStream.
|
||||
/// </summary>
|
||||
internal static System.IO.UnmanagedMemoryStream AlertSound5 {
|
||||
get {
|
||||
return ResourceManager.GetStream("AlertSound5", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.IO.UnmanagedMemoryStream similar to System.IO.MemoryStream.
|
||||
/// </summary>
|
||||
internal static System.IO.UnmanagedMemoryStream AlertSound6 {
|
||||
get {
|
||||
return ResourceManager.GetStream("AlertSound6", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.IO.UnmanagedMemoryStream similar to System.IO.MemoryStream.
|
||||
/// </summary>
|
||||
internal static System.IO.UnmanagedMemoryStream AlertSound7 {
|
||||
get {
|
||||
return ResourceManager.GetStream("AlertSound7", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.IO.UnmanagedMemoryStream similar to System.IO.MemoryStream.
|
||||
/// </summary>
|
||||
internal static System.IO.UnmanagedMemoryStream AlertSound8 {
|
||||
get {
|
||||
return ResourceManager.GetStream("AlertSound8", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.IO.UnmanagedMemoryStream similar to System.IO.MemoryStream.
|
||||
/// </summary>
|
||||
internal static System.IO.UnmanagedMemoryStream AlertSound9 {
|
||||
get {
|
||||
return ResourceManager.GetStream("AlertSound9", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Byte[].
|
||||
/// </summary>
|
||||
internal static byte[] Fontin_SmallCaps {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("Fontin_SmallCaps", resourceCulture);
|
||||
return ((byte[])(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap groundtile {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("groundtile", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
154
Filtration/Properties/Resources.resx
Normal file
154
Filtration/Properties/Resources.resx
Normal file
@@ -0,0 +1,154 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="AlertSound1" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\AlertSound1.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name="AlertSound2" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\AlertSound2.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name="AlertSound3" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\AlertSound3.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name="AlertSound4" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\AlertSound4.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name="AlertSound5" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\AlertSound5.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name="AlertSound6" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\AlertSound6.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name="AlertSound7" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\AlertSound7.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name="AlertSound8" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\AlertSound8.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name="AlertSound9" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\AlertSound9.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name="Fontin_SmallCaps" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\Fontin-SmallCaps.ttf;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name="groundtile" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\groundtile.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
</root>
|
||||
30
Filtration/Properties/Settings.Designer.cs
generated
Normal file
30
Filtration/Properties/Settings.Designer.cs
generated
Normal file
@@ -0,0 +1,30 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.34209
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Filtration.Properties
|
||||
{
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
|
||||
{
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default
|
||||
{
|
||||
get
|
||||
{
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
7
Filtration/Properties/Settings.settings
Normal file
7
Filtration/Properties/Settings.settings
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
</SettingsFile>
|
||||
BIN
Filtration/Resources/AlertSound1.wav
Normal file
BIN
Filtration/Resources/AlertSound1.wav
Normal file
Binary file not shown.
BIN
Filtration/Resources/AlertSound2.wav
Normal file
BIN
Filtration/Resources/AlertSound2.wav
Normal file
Binary file not shown.
BIN
Filtration/Resources/AlertSound3.wav
Normal file
BIN
Filtration/Resources/AlertSound3.wav
Normal file
Binary file not shown.
BIN
Filtration/Resources/AlertSound4.wav
Normal file
BIN
Filtration/Resources/AlertSound4.wav
Normal file
Binary file not shown.
BIN
Filtration/Resources/AlertSound5.wav
Normal file
BIN
Filtration/Resources/AlertSound5.wav
Normal file
Binary file not shown.
BIN
Filtration/Resources/AlertSound6.wav
Normal file
BIN
Filtration/Resources/AlertSound6.wav
Normal file
Binary file not shown.
BIN
Filtration/Resources/AlertSound7.wav
Normal file
BIN
Filtration/Resources/AlertSound7.wav
Normal file
Binary file not shown.
BIN
Filtration/Resources/AlertSound8.wav
Normal file
BIN
Filtration/Resources/AlertSound8.wav
Normal file
Binary file not shown.
BIN
Filtration/Resources/AlertSound9.wav
Normal file
BIN
Filtration/Resources/AlertSound9.wav
Normal file
Binary file not shown.
BIN
Filtration/Resources/Fontin-SmallCaps.ttf
Normal file
BIN
Filtration/Resources/Fontin-SmallCaps.ttf
Normal file
Binary file not shown.
1070
Filtration/Resources/ItemBaseTypes.txt
Normal file
1070
Filtration/Resources/ItemBaseTypes.txt
Normal file
File diff suppressed because it is too large
Load Diff
36
Filtration/Resources/ItemClasses.txt
Normal file
36
Filtration/Resources/ItemClasses.txt
Normal file
@@ -0,0 +1,36 @@
|
||||
Life Flasks
|
||||
Mana Flasks
|
||||
Hybrid Flasks
|
||||
Currency
|
||||
Amulets
|
||||
Rings
|
||||
Claws
|
||||
Daggers
|
||||
Wands
|
||||
One Hand Swords
|
||||
Thrusting One Hand Swords
|
||||
One Hand Axes
|
||||
One Hand Maces
|
||||
Bows
|
||||
Staves
|
||||
Two Hand Swords
|
||||
Two Hand Axes
|
||||
Two Hand Maces
|
||||
Active Skill Gems
|
||||
Support Skill Gems
|
||||
Quivers
|
||||
Belts
|
||||
Gloves
|
||||
Boots
|
||||
Body Armours
|
||||
Helmets
|
||||
Shields
|
||||
Stackable Currency
|
||||
Quest Items
|
||||
Sceptres
|
||||
Utility Flasks
|
||||
Maps
|
||||
Fishing Rods
|
||||
Map Fragments
|
||||
Hideout Doodads
|
||||
Microtransactions
|
||||
BIN
Filtration/Resources/groundtile.png
Normal file
BIN
Filtration/Resources/groundtile.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 20 KiB |
36
Filtration/Services/FileSystemService.cs
Normal file
36
Filtration/Services/FileSystemService.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace Filtration.Services
|
||||
{
|
||||
internal interface IFileSystemService
|
||||
{
|
||||
string ReadFileAsString(string filePath);
|
||||
void WriteFileFromString(string filePath, string inputString);
|
||||
bool DirectoryExists(string directoryPath);
|
||||
string GetUserProfilePath();
|
||||
}
|
||||
|
||||
internal class FileSystemService : IFileSystemService
|
||||
{
|
||||
public string ReadFileAsString(string filePath)
|
||||
{
|
||||
return File.ReadAllText(filePath);
|
||||
}
|
||||
|
||||
public void WriteFileFromString(string filePath, string inputString)
|
||||
{
|
||||
File.WriteAllText(filePath, inputString);
|
||||
}
|
||||
|
||||
public bool DirectoryExists(string directoryPath)
|
||||
{
|
||||
return Directory.Exists(directoryPath);
|
||||
}
|
||||
|
||||
public string GetUserProfilePath()
|
||||
{
|
||||
return Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
|
||||
}
|
||||
}
|
||||
}
|
||||
51
Filtration/Services/LootFilterPersistenceService.cs
Normal file
51
Filtration/Services/LootFilterPersistenceService.cs
Normal file
@@ -0,0 +1,51 @@
|
||||
using Filtration.Models;
|
||||
using Filtration.Translators;
|
||||
|
||||
namespace Filtration.Services
|
||||
{
|
||||
internal interface ILootFilterPersistenceService
|
||||
{
|
||||
string LootFilterScriptDirectory { get; set; }
|
||||
LootFilterScript LoadLootFilterScript(string filePath);
|
||||
void SaveLootFilterScript(LootFilterScript script);
|
||||
string DefaultPathOfExileDirectory();
|
||||
}
|
||||
|
||||
internal class LootFilterPersistenceService : ILootFilterPersistenceService
|
||||
{
|
||||
private readonly IFileSystemService _fileSystemService;
|
||||
private readonly ILootFilterScriptTranslator _lootFilterScriptTranslator;
|
||||
|
||||
public LootFilterPersistenceService(IFileSystemService fileSystemService, ILootFilterScriptTranslator lootFilterScriptTranslator)
|
||||
{
|
||||
_fileSystemService = fileSystemService;
|
||||
_lootFilterScriptTranslator = lootFilterScriptTranslator;
|
||||
}
|
||||
|
||||
public string LootFilterScriptDirectory { get; set; }
|
||||
|
||||
public LootFilterScript LoadLootFilterScript(string filePath)
|
||||
{
|
||||
var script =
|
||||
_lootFilterScriptTranslator.TranslateStringToLootFilterScript(
|
||||
_fileSystemService.ReadFileAsString(filePath));
|
||||
|
||||
script.FilePath = filePath;
|
||||
return script;
|
||||
}
|
||||
|
||||
public void SaveLootFilterScript(LootFilterScript script)
|
||||
{
|
||||
_fileSystemService.WriteFileFromString(script.FilePath,
|
||||
_lootFilterScriptTranslator.TranslateLootFilterScriptToString(script));
|
||||
}
|
||||
|
||||
public string DefaultPathOfExileDirectory()
|
||||
{
|
||||
var defaultDir = _fileSystemService.GetUserProfilePath() + "\\Documents\\My Games\\Path of Exile";
|
||||
var defaultDirExists = _fileSystemService.DirectoryExists(defaultDir);
|
||||
|
||||
return defaultDirExists ? defaultDir : string.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
37
Filtration/Services/StaticDataService.cs
Normal file
37
Filtration/Services/StaticDataService.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Filtration.Utilities;
|
||||
|
||||
namespace Filtration.Services
|
||||
{
|
||||
public interface IStaticDataService
|
||||
{
|
||||
IEnumerable<string> ItemBaseTypes { get; }
|
||||
IEnumerable<string> ItemClasses { get; }
|
||||
}
|
||||
|
||||
internal class StaticDataService : IStaticDataService
|
||||
{
|
||||
private readonly IFileSystemService _fileSystemService;
|
||||
|
||||
public StaticDataService(IFileSystemService fileSystemService)
|
||||
{
|
||||
_fileSystemService = fileSystemService;
|
||||
PopulateStaticData();
|
||||
}
|
||||
|
||||
public IEnumerable<string> ItemBaseTypes { get; private set; }
|
||||
|
||||
public IEnumerable<string> ItemClasses { get; private set; }
|
||||
|
||||
private void PopulateStaticData()
|
||||
{
|
||||
var itemBaseTypes = _fileSystemService.ReadFileAsString("Resources\\ItemBaseTypes.txt");
|
||||
ItemBaseTypes = new LineReader(() => new StringReader(itemBaseTypes)).ToList();
|
||||
|
||||
var itemClasses = _fileSystemService.ReadFileAsString("Resources\\ItemClasses.txt");
|
||||
ItemClasses = new LineReader(() => new StringReader(itemClasses)).ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
436
Filtration/Translators/LootFilterBlockTranslator.cs
Normal file
436
Filtration/Translators/LootFilterBlockTranslator.cs
Normal file
@@ -0,0 +1,436 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows.Media;
|
||||
using Filtration.Enums;
|
||||
using Filtration.Extensions;
|
||||
using Filtration.Models;
|
||||
using Filtration.Models.BlockItemBaseTypes;
|
||||
using Filtration.Models.BlockItemTypes;
|
||||
using Filtration.Utilities;
|
||||
|
||||
namespace Filtration.Translators
|
||||
{
|
||||
internal interface ILootFilterBlockTranslator
|
||||
{
|
||||
LootFilterBlock TranslateStringToLootFilterBlock(string inputString);
|
||||
string TranslateLootFilterBlockToString(LootFilterBlock block);
|
||||
}
|
||||
|
||||
internal class LootFilterBlockTranslator : ILootFilterBlockTranslator
|
||||
{
|
||||
private const string Indent = " ";
|
||||
private readonly string _newLine = Environment.NewLine + Indent;
|
||||
|
||||
// This method converts a string into a LootFilterBlock. This is used for pasting LootFilterBlocks
|
||||
// and reading LootFilterScripts from a file.
|
||||
public LootFilterBlock TranslateStringToLootFilterBlock(string inputString)
|
||||
{
|
||||
var block = new LootFilterBlock();
|
||||
var showHideFound = false;
|
||||
foreach (var line in new LineReader(() => new StringReader(inputString)))
|
||||
{
|
||||
if (line.StartsWith(@"# Section:"))
|
||||
{
|
||||
var section = new LootFilterSection
|
||||
{
|
||||
Description = line.Substring(line.IndexOf(":", StringComparison.Ordinal) + 1).Trim()
|
||||
};
|
||||
return section;
|
||||
}
|
||||
|
||||
if (line.StartsWith(@"#") && !showHideFound)
|
||||
{
|
||||
block.Description = line.TrimStart('#').TrimStart(' ');
|
||||
continue;
|
||||
}
|
||||
|
||||
var trimmedLine = line.TrimStart(' ');
|
||||
var spaceOrEndOfLinePos = trimmedLine.IndexOf(" ", StringComparison.Ordinal) > 0 ? trimmedLine.IndexOf(" ", StringComparison.Ordinal) : trimmedLine.Length;
|
||||
|
||||
var lineOption = trimmedLine.Substring(0, spaceOrEndOfLinePos);
|
||||
switch (lineOption)
|
||||
{
|
||||
case "Show":
|
||||
showHideFound = true;
|
||||
block.Action = BlockAction.Show;
|
||||
break;
|
||||
case "Hide":
|
||||
showHideFound = true;
|
||||
block.Action = BlockAction.Hide;
|
||||
break;
|
||||
case "ItemLevel":
|
||||
{
|
||||
AddNumericFilterPredicateItemToBlockItems<ItemLevelBlockItem>(block, trimmedLine);
|
||||
break;
|
||||
}
|
||||
case "DropLevel":
|
||||
{
|
||||
AddNumericFilterPredicateItemToBlockItems<DropLevelBlockItem>(block, trimmedLine);
|
||||
break;
|
||||
}
|
||||
case "Quality":
|
||||
{
|
||||
AddNumericFilterPredicateItemToBlockItems<QualityBlockItem>(block,trimmedLine);
|
||||
break;
|
||||
}
|
||||
case "Rarity":
|
||||
{
|
||||
var blockItemValue = new RarityBlockItem();
|
||||
var result = Regex.Match(trimmedLine, @"^\w+\s+([><!=]{0,2})\s*(\w+)$");
|
||||
if (result.Groups.Count == 3)
|
||||
{
|
||||
blockItemValue.FilterPredicate.PredicateOperator =
|
||||
EnumHelper.GetEnumValueFromDescription<FilterPredicateOperator>(string.IsNullOrEmpty(result.Groups[1].Value) ? "=" : result.Groups[1].Value);
|
||||
blockItemValue.FilterPredicate.PredicateOperand =
|
||||
(int)(EnumHelper.GetEnumValueFromDescription<ItemRarity>(result.Groups[2].Value));
|
||||
}
|
||||
block.BlockItems.Add(blockItemValue);
|
||||
break;
|
||||
}
|
||||
case "Class":
|
||||
{
|
||||
AddStringListItemToBlockItems<ClassBlockItem>(block, trimmedLine);
|
||||
break;
|
||||
}
|
||||
case "BaseType":
|
||||
{
|
||||
AddStringListItemToBlockItems<BaseTypeBlockItem>(block, trimmedLine);
|
||||
break;
|
||||
}
|
||||
case "Sockets":
|
||||
{
|
||||
AddNumericFilterPredicateItemToBlockItems<SocketsBlockItem>(block, trimmedLine);
|
||||
break;
|
||||
}
|
||||
case "LinkedSockets":
|
||||
{
|
||||
AddNumericFilterPredicateItemToBlockItems<LinkedSocketsBlockItem>(block,trimmedLine);
|
||||
break;
|
||||
}
|
||||
case "Width":
|
||||
{
|
||||
AddNumericFilterPredicateItemToBlockItems<WidthBlockItem>(block, trimmedLine);
|
||||
break;
|
||||
}
|
||||
case "Height":
|
||||
{
|
||||
AddNumericFilterPredicateItemToBlockItems<HeightBlockItem>(block, trimmedLine);
|
||||
break;
|
||||
}
|
||||
case "SocketGroup":
|
||||
{
|
||||
//var blockItem = new SocketGroupBlockItem();
|
||||
|
||||
//var socketGroups = Regex.Matches(trimmedLine, @"\s+([RGBW]{1,6})");
|
||||
|
||||
//foreach (Match socketGroupMatch in socketGroups)
|
||||
//{
|
||||
|
||||
// var socketGroupCharArray = socketGroupMatch.Groups[1].Value.Trim(' ').ToCharArray();
|
||||
// var socketColorList = socketGroupCharArray.Select(c => (EnumHelper.GetEnumValueFromDescription<SocketColor>(c.ToString()))).ToList();
|
||||
|
||||
// blockItem.SocketColorGroups.Add(socketColorList);
|
||||
//}
|
||||
|
||||
//block.FilterBlockItems.Add(blockItem);
|
||||
AddStringListItemToBlockItems<SocketGroupBlockItem>(block, trimmedLine);
|
||||
break;
|
||||
}
|
||||
case "SetTextColor":
|
||||
{
|
||||
// Only ever use the last SetTextColor item encountered as multiples aren't valid.
|
||||
RemoveExistingBlockItemsOfType<TextColorBlockItem>(block);
|
||||
|
||||
AddColorItemToBlockItems<TextColorBlockItem>(block, trimmedLine);
|
||||
break;
|
||||
}
|
||||
case "SetBackgroundColor":
|
||||
{
|
||||
// Only ever use the last SetBackgroundColor item encountered as multiples aren't valid.
|
||||
RemoveExistingBlockItemsOfType<BackgroundColorBlockItem>(block);
|
||||
|
||||
AddColorItemToBlockItems<BackgroundColorBlockItem>(block, trimmedLine);
|
||||
break;
|
||||
}
|
||||
case "SetBorderColor":
|
||||
{
|
||||
// Only ever use the last SetBorderColor item encountered as multiples aren't valid.
|
||||
RemoveExistingBlockItemsOfType<BorderColorBlockItem>(block);
|
||||
|
||||
AddColorItemToBlockItems<BorderColorBlockItem>(block, trimmedLine);
|
||||
break;
|
||||
}
|
||||
case "SetFontSize":
|
||||
{
|
||||
// Only ever use the last SetFontSize item encountered as multiples aren't valid.
|
||||
RemoveExistingBlockItemsOfType<FontSizeBlockItem>(block);
|
||||
|
||||
var match = Regex.Match(trimmedLine, @"\s+(\d+)");
|
||||
if (match.Success)
|
||||
{
|
||||
var blockItemValue = new FontSizeBlockItem(Convert.ToInt16(match.Value));
|
||||
block.BlockItems.Add(blockItemValue);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "PlayAlertSound":
|
||||
{
|
||||
// Only ever use the last PlayAlertSound item encountered as multiples aren't valid.
|
||||
RemoveExistingBlockItemsOfType<SoundBlockItem>(block);
|
||||
|
||||
var matches = Regex.Matches(trimmedLine, @"\s+(\d+)");
|
||||
switch (matches.Count)
|
||||
{
|
||||
case 1:
|
||||
if (matches[0].Success)
|
||||
{
|
||||
var blockItemValue = new SoundBlockItem
|
||||
{
|
||||
Value = Convert.ToInt16(matches[0].Value),
|
||||
SecondValue = 79
|
||||
};
|
||||
block.BlockItems.Add(blockItemValue);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (matches[0].Success && matches[1].Success)
|
||||
{
|
||||
var blockItemValue = new SoundBlockItem
|
||||
{
|
||||
Value = Convert.ToInt16(matches[0].Value),
|
||||
SecondValue = Convert.ToInt16(matches[1].Value)
|
||||
};
|
||||
block.BlockItems.Add(blockItemValue);
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return block;
|
||||
}
|
||||
|
||||
private static void RemoveExistingBlockItemsOfType<T>(LootFilterBlock block)
|
||||
{
|
||||
var existingBlockItemCount = block.BlockItems.Count(b => b.GetType() == typeof(T));
|
||||
if (existingBlockItemCount > 0)
|
||||
{
|
||||
var existingBlockItem = block.BlockItems.First(b => b.GetType() == typeof(T));
|
||||
block.BlockItems.Remove(existingBlockItem);
|
||||
}
|
||||
}
|
||||
|
||||
private static void AddNumericFilterPredicateItemToBlockItems<T>(LootFilterBlock block, string inputString) where T : NumericFilterPredicateBlockItem
|
||||
{
|
||||
var blockItem = Activator.CreateInstance<T>();
|
||||
|
||||
SetNumericFilterPredicateFromString(blockItem.FilterPredicate, inputString);
|
||||
block.BlockItems.Add(blockItem);
|
||||
}
|
||||
|
||||
private static void SetNumericFilterPredicateFromString(NumericFilterPredicate predicate, string inputString)
|
||||
{
|
||||
var result = Regex.Match(inputString, @"^\w+\s+([><!=]{0,2})\s*(\d{0,3})$");
|
||||
if (result.Groups.Count != 3) return;
|
||||
|
||||
predicate.PredicateOperator =
|
||||
EnumHelper.GetEnumValueFromDescription<FilterPredicateOperator>(string.IsNullOrEmpty(result.Groups[1].Value) ? "=" : result.Groups[1].Value);
|
||||
predicate.PredicateOperand = Convert.ToInt16(result.Groups[2].Value);
|
||||
}
|
||||
|
||||
private static void AddStringListItemToBlockItems<T>(LootFilterBlock block, string inputString) where T : StringListBlockItem
|
||||
{
|
||||
var blockItem = Activator.CreateInstance<T>();
|
||||
PopulateListFromString(blockItem.Items, inputString.Substring(inputString.IndexOf(" ", StringComparison.Ordinal) + 1).Trim());
|
||||
block.BlockItems.Add(blockItem);
|
||||
}
|
||||
|
||||
private static void PopulateListFromString(ICollection<string> list, string inputString)
|
||||
{
|
||||
var result = Regex.Matches(inputString, @"[^\s""]+|""([^""]*)""");
|
||||
foreach (Match match in result)
|
||||
{
|
||||
list.Add(match.Groups[1].Success
|
||||
? match.Groups[1].Value
|
||||
: match.Groups[0].Value);
|
||||
}
|
||||
}
|
||||
|
||||
private static void AddColorItemToBlockItems<T>(LootFilterBlock block, string inputString) where T : ColorBlockItem
|
||||
{
|
||||
var blockItem = Activator.CreateInstance<T>();
|
||||
blockItem.Color = GetColorFromString(inputString);
|
||||
block.BlockItems.Add(blockItem);
|
||||
}
|
||||
|
||||
private static Color GetColorFromString(string inputString)
|
||||
{
|
||||
var argbValues = Regex.Matches(inputString, @"\s+(\d+)");
|
||||
|
||||
switch (argbValues.Count)
|
||||
{
|
||||
case 3:
|
||||
return new Color
|
||||
{
|
||||
A = byte.MaxValue,
|
||||
R = Convert.ToByte(argbValues[0].Value),
|
||||
G = Convert.ToByte(argbValues[1].Value),
|
||||
B = Convert.ToByte(argbValues[2].Value)
|
||||
};
|
||||
case 4:
|
||||
return new Color
|
||||
{
|
||||
R = Convert.ToByte(argbValues[0].Value),
|
||||
G = Convert.ToByte(argbValues[1].Value),
|
||||
B = Convert.ToByte(argbValues[2].Value),
|
||||
A = Convert.ToByte(argbValues[3].Value)
|
||||
};
|
||||
}
|
||||
return new Color();
|
||||
}
|
||||
|
||||
// This method converts a LootFilterBlock object into a string. This is used for copying a LootFilterBlock
|
||||
// to the clipboard, and when saving a LootFilterScript.
|
||||
public string TranslateLootFilterBlockToString(LootFilterBlock block)
|
||||
{
|
||||
if (block.GetType() == typeof (LootFilterSection))
|
||||
{
|
||||
return "# Section: " + block.Description;
|
||||
}
|
||||
|
||||
var outputString = string.Empty;
|
||||
|
||||
if (!string.IsNullOrEmpty(block.Description))
|
||||
{
|
||||
outputString += "# " + block.Description + Environment.NewLine;
|
||||
}
|
||||
|
||||
outputString += block.Action.GetAttributeDescription();
|
||||
|
||||
// This could be refactored to use the upcasted NumericFilterPredicateBlockItem (or even ILootFilterBlockItem) instead
|
||||
// of the specific downcasts. Leaving it like this currently to preserve sorting since the different
|
||||
// downcasts have no defined sort order (yet).
|
||||
foreach (var blockItem in block.BlockItems.OfType<ItemLevelBlockItem>())
|
||||
{
|
||||
AddNumericFilterPredicateBlockItemToString(ref outputString, blockItem);
|
||||
}
|
||||
|
||||
foreach (var blockItem in block.BlockItems.OfType<DropLevelBlockItem>())
|
||||
{
|
||||
AddNumericFilterPredicateBlockItemToString(ref outputString, blockItem);
|
||||
}
|
||||
|
||||
foreach (var blockItem in block.BlockItems.OfType<QualityBlockItem>())
|
||||
{
|
||||
AddNumericFilterPredicateBlockItemToString(ref outputString, blockItem);
|
||||
}
|
||||
|
||||
// ReSharper disable once LoopCanBeConvertedToQuery
|
||||
foreach (var blockItem in block.BlockItems.OfType<RarityBlockItem>())
|
||||
{
|
||||
outputString += _newLine + "Rarity " +
|
||||
blockItem.FilterPredicate.PredicateOperator
|
||||
.GetAttributeDescription() +
|
||||
" " +
|
||||
((ItemRarity) blockItem.FilterPredicate.PredicateOperand)
|
||||
.GetAttributeDescription();
|
||||
}
|
||||
|
||||
foreach (var blockItem in block.BlockItems.OfType<ClassBlockItem>())
|
||||
{
|
||||
AddStringListBlockItemToString(ref outputString, blockItem);
|
||||
}
|
||||
|
||||
foreach (var blockItem in block.BlockItems.OfType<BaseTypeBlockItem>())
|
||||
{
|
||||
AddStringListBlockItemToString(ref outputString, blockItem);
|
||||
}
|
||||
|
||||
foreach (var blockItem in block.BlockItems.OfType<SocketsBlockItem>())
|
||||
{
|
||||
AddNumericFilterPredicateBlockItemToString(ref outputString, blockItem);
|
||||
}
|
||||
|
||||
foreach (var blockItem in block.BlockItems.OfType<LinkedSocketsBlockItem>())
|
||||
{
|
||||
AddNumericFilterPredicateBlockItemToString(ref outputString, blockItem);
|
||||
}
|
||||
|
||||
foreach (var blockItem in block.BlockItems.OfType<WidthBlockItem>())
|
||||
{
|
||||
AddNumericFilterPredicateBlockItemToString(ref outputString, blockItem);
|
||||
}
|
||||
|
||||
foreach (var blockItem in block.BlockItems.OfType<HeightBlockItem>())
|
||||
{
|
||||
AddNumericFilterPredicateBlockItemToString(ref outputString, blockItem);
|
||||
}
|
||||
|
||||
foreach (var blockItem in block.BlockItems.OfType<SocketGroupBlockItem>())
|
||||
{
|
||||
AddStringListBlockItemToString(ref outputString, blockItem);
|
||||
}
|
||||
|
||||
if (block.BlockItems.Count(b => b is TextColorBlockItem) > 0)
|
||||
{
|
||||
// Only add the first TextColorBlockItem type (not that we should ever have more than one).
|
||||
AddColorBlockItemToString(ref outputString, block.BlockItems.OfType<TextColorBlockItem>().First());
|
||||
}
|
||||
|
||||
if (block.BlockItems.Count(b => b.GetType() == typeof(BackgroundColorBlockItem)) > 0)
|
||||
{
|
||||
// Only add the first BackgroundColorBlockItem type (not that we should ever have more than one).
|
||||
AddColorBlockItemToString(ref outputString, block.BlockItems.OfType<BackgroundColorBlockItem>().First());
|
||||
}
|
||||
|
||||
if (block.BlockItems.Count(b => b.GetType() == typeof(BorderColorBlockItem)) > 0)
|
||||
{
|
||||
// Only add the first BorderColorBlockItem (not that we should ever have more than one).
|
||||
AddColorBlockItemToString(ref outputString, block.BlockItems.OfType<BorderColorBlockItem>().First());
|
||||
}
|
||||
|
||||
if (block.BlockItems.Count(b => b.GetType() == typeof(FontSizeBlockItem)) > 0)
|
||||
{
|
||||
outputString += _newLine + "SetFontSize " +
|
||||
block.BlockItems.OfType<FontSizeBlockItem>().First().Value;
|
||||
}
|
||||
|
||||
if (block.BlockItems.Count(b => b.GetType() == typeof(SoundBlockItem)) > 0)
|
||||
{
|
||||
var blockItemValue = block.BlockItems.OfType<SoundBlockItem>().First();
|
||||
outputString += _newLine + "PlayAlertSound " + blockItemValue.Value + " " + blockItemValue.SecondValue;
|
||||
}
|
||||
|
||||
return outputString;
|
||||
}
|
||||
|
||||
private void AddNumericFilterPredicateBlockItemToString(ref string targetString, NumericFilterPredicateBlockItem blockItem)
|
||||
{
|
||||
targetString += _newLine + blockItem.PrefixText + " " +
|
||||
blockItem.FilterPredicate.PredicateOperator.GetAttributeDescription() +
|
||||
" " + blockItem.FilterPredicate.PredicateOperand;
|
||||
}
|
||||
|
||||
private void AddStringListBlockItemToString(ref string targetString, StringListBlockItem blockItem)
|
||||
{
|
||||
var enumerable = blockItem.Items as IList<string> ?? blockItem.Items.ToList();
|
||||
if (enumerable.Count > 0)
|
||||
{
|
||||
targetString += _newLine + blockItem.PrefixText + " " +
|
||||
string.Format("\"{0}\"",
|
||||
string.Join("\" \"", enumerable.ToArray()));
|
||||
}
|
||||
}
|
||||
|
||||
private void AddColorBlockItemToString(ref string targetString, ColorBlockItem blockItem)
|
||||
{
|
||||
targetString += _newLine + blockItem.PrefixText + " " + blockItem.Color.R + " " + blockItem.Color.G + " "
|
||||
+ blockItem.Color.B + (blockItem.Color.A < 255 ? " " + blockItem.Color.A : string.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
104
Filtration/Translators/LootFilterScriptTranslator.cs
Normal file
104
Filtration/Translators/LootFilterScriptTranslator.cs
Normal file
@@ -0,0 +1,104 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text.RegularExpressions;
|
||||
using Filtration.Models;
|
||||
using Filtration.Utilities;
|
||||
|
||||
namespace Filtration.Translators
|
||||
{
|
||||
internal interface ILootFilterScriptTranslator
|
||||
{
|
||||
LootFilterScript TranslateStringToLootFilterScript(string inputString);
|
||||
string TranslateLootFilterScriptToString(LootFilterScript script);
|
||||
}
|
||||
|
||||
internal class LootFilterScriptTranslator : ILootFilterScriptTranslator
|
||||
{
|
||||
private readonly ILootFilterBlockTranslator _blockTranslator;
|
||||
|
||||
public LootFilterScriptTranslator(ILootFilterBlockTranslator blockTranslator)
|
||||
{
|
||||
_blockTranslator = blockTranslator;
|
||||
}
|
||||
|
||||
public LootFilterScript TranslateStringToLootFilterScript(string inputString)
|
||||
{
|
||||
var script = new LootFilterScript();
|
||||
inputString = inputString.Replace("\t", "");
|
||||
var conditionBoundaries = IdentifyBlockBoundaries(inputString);
|
||||
|
||||
var lines = Regex.Split(inputString, "\r\n|\r|\n");
|
||||
|
||||
// Process the script header
|
||||
for (var i = 0; i < conditionBoundaries.First.Value; i++)
|
||||
{
|
||||
if (lines[i].StartsWith("#"))
|
||||
{
|
||||
script.Description += lines[i].Substring(1).Trim(' ') + Environment.NewLine;
|
||||
}
|
||||
}
|
||||
script.Description = script.Description.TrimEnd('\n').TrimEnd('\r');
|
||||
|
||||
// Extract each block from between boundaries and translate it into a LootFilterBlock object
|
||||
// and add that object to the LootFilterBlocks list
|
||||
for (var boundary = conditionBoundaries.First; boundary != null; boundary = boundary.Next)
|
||||
{
|
||||
var begin = boundary.Value;
|
||||
var end = boundary.Next != null ? boundary.Next.Value : lines.Length;
|
||||
var block = new string[end - begin];
|
||||
Array.Copy(lines, begin, block, 0, end - begin);
|
||||
var blockString = string.Join("\r\n", block);
|
||||
script.LootFilterBlocks.Add(_blockTranslator.TranslateStringToLootFilterBlock(blockString));
|
||||
}
|
||||
|
||||
return script;
|
||||
}
|
||||
|
||||
private static LinkedList<int> IdentifyBlockBoundaries(string inputString)
|
||||
{
|
||||
var blockBoundaries = new LinkedList<int>();
|
||||
var previousLine = string.Empty;
|
||||
var currentLine = 0;
|
||||
|
||||
foreach (var line in new LineReader(() => new StringReader(inputString)))
|
||||
{
|
||||
currentLine++;
|
||||
var trimmedLine = line.TrimStart(' ').TrimEnd(' ');
|
||||
if (trimmedLine.StartsWith("Show") || trimmedLine.StartsWith("Hide") ||
|
||||
trimmedLine.StartsWith("# Section:"))
|
||||
{
|
||||
// If the line previous to the Show or Hide line is a comment then we should include that in the block
|
||||
// as it represents the block description.
|
||||
blockBoundaries.AddLast(previousLine.StartsWith("#") && !previousLine.StartsWith("# Section:") ? currentLine - 2 : currentLine - 1);
|
||||
}
|
||||
previousLine = line;
|
||||
}
|
||||
|
||||
return blockBoundaries;
|
||||
}
|
||||
|
||||
public string TranslateLootFilterScriptToString(LootFilterScript script)
|
||||
{
|
||||
var outputString = string.Empty;
|
||||
|
||||
if (!string.IsNullOrEmpty(script.Description))
|
||||
{
|
||||
// ReSharper disable once LoopCanBeConvertedToQuery
|
||||
foreach (var line in new LineReader(() => new StringReader(script.Description)))
|
||||
{
|
||||
outputString += "# " + line + Environment.NewLine;
|
||||
}
|
||||
outputString += Environment.NewLine;
|
||||
}
|
||||
|
||||
// ReSharper disable once LoopCanBeConvertedToQuery
|
||||
foreach (var block in script.LootFilterBlocks)
|
||||
{
|
||||
outputString += _blockTranslator.TranslateLootFilterBlockToString(block) + Environment.NewLine + Environment.NewLine;
|
||||
}
|
||||
|
||||
return outputString;
|
||||
}
|
||||
}
|
||||
}
|
||||
20
Filtration/UserControls/AutoScrollingListBox.cs
Normal file
20
Filtration/UserControls/AutoScrollingListBox.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System.Collections.Specialized;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace Filtration.UserControls
|
||||
{
|
||||
public class AutoScrollingListBox : ListBox
|
||||
{
|
||||
protected override void OnItemsChanged(NotifyCollectionChangedEventArgs e)
|
||||
{
|
||||
if (e.NewItems == null) return;
|
||||
|
||||
var newItemCount = e.NewItems.Count;
|
||||
|
||||
if (newItemCount > 0)
|
||||
ScrollIntoView(e.NewItems[newItemCount - 1]);
|
||||
|
||||
base.OnItemsChanged(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
15
Filtration/UserControls/CrossButton.cs
Normal file
15
Filtration/UserControls/CrossButton.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace Filtration.UserControls
|
||||
{
|
||||
public class CrossButton : Button
|
||||
{
|
||||
static CrossButton()
|
||||
{
|
||||
// Set the style key, so that our control template is used.
|
||||
DefaultStyleKeyProperty.OverrideMetadata(typeof(CrossButton),
|
||||
new FrameworkPropertyMetadata(typeof(CrossButton)));
|
||||
}
|
||||
}
|
||||
}
|
||||
47
Filtration/UserControls/EditableListBoxControl.xaml
Normal file
47
Filtration/UserControls/EditableListBoxControl.xaml
Normal file
@@ -0,0 +1,47 @@
|
||||
<UserControl x:Class="Filtration.UserControls.EditableListBoxControl"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:userControls="clr-namespace:Filtration.UserControls"
|
||||
xmlns:toolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Input.Toolkit"
|
||||
mc:Ignorable="d"
|
||||
d:DataContext="{d:DesignInstance Type=userControls:EditableListBoxControl}">
|
||||
|
||||
<Grid VerticalAlignment="Top">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition></RowDefinition>
|
||||
<RowDefinition></RowDefinition>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"></ColumnDefinition>
|
||||
<ColumnDefinition Width="40"></ColumnDefinition>
|
||||
</Grid.ColumnDefinitions>
|
||||
<ListBox Grid.Row="0"
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="2"
|
||||
ItemsSource="{Binding ItemsSource}"
|
||||
BorderThickness="1"
|
||||
Height="120"
|
||||
VerticalAlignment="Stretch" SelectionMode="Single" x:Name="ControlListBox" BorderBrush="#CCCCCC">
|
||||
<ListBox.Resources>
|
||||
<Style TargetType="ListBoxItem">
|
||||
<!-- Undo the style that we set in the parent LootFilterScriptView to hide the condition selections -->
|
||||
<Style.Resources>
|
||||
<!-- SelectedItem with focus -->
|
||||
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Silver" />
|
||||
<!-- SelectedItem without focus -->
|
||||
<SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="LightGray" />
|
||||
<!-- SelectedItem text foreground -->
|
||||
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}" Color="Black" />
|
||||
</Style.Resources>
|
||||
</Style>
|
||||
</ListBox.Resources>
|
||||
<ListBox.InputBindings>
|
||||
<KeyBinding Key="Delete" Command="{Binding Path=DeleteItemCommand}" CommandParameter="{Binding ElementName=ControlListBox, Path=SelectedValue}" />
|
||||
</ListBox.InputBindings>
|
||||
</ListBox>
|
||||
<toolkit:AutoCompleteBox Grid.Row="1" Grid.Column="0" ItemsSource="{Binding AutoCompleteItemsSource}" FilterMode="Contains" Text="{Binding AddItemText, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}" ></toolkit:AutoCompleteBox>
|
||||
<Button Grid.Row="1" Grid.Column="1" Command="{Binding AddItemCommand}" IsDefault="True">Add</Button>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
111
Filtration/UserControls/EditableListBoxControl.xaml.cs
Normal file
111
Filtration/UserControls/EditableListBoxControl.xaml.cs
Normal file
@@ -0,0 +1,111 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Windows;
|
||||
using Filtration.Annotations;
|
||||
using GalaSoft.MvvmLight.CommandWpf;
|
||||
|
||||
namespace Filtration.UserControls
|
||||
{
|
||||
public partial class EditableListBoxControl : INotifyPropertyChanged
|
||||
{
|
||||
private string _addItemText;
|
||||
|
||||
public EditableListBoxControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
// ReSharper disable once PossibleNullReferenceException
|
||||
(Content as FrameworkElement).DataContext = this;
|
||||
AddItemCommand = new RelayCommand(OnAddItemCommand, () => !string.IsNullOrEmpty(AddItemText));
|
||||
DeleteItemCommand = new RelayCommand<string>(OnDeleteItemCommand);
|
||||
}
|
||||
|
||||
public RelayCommand AddItemCommand { get; private set; }
|
||||
public RelayCommand<string> DeleteItemCommand { get; private set; }
|
||||
|
||||
public static readonly DependencyProperty ItemsSourceProperty = DependencyProperty.Register(
|
||||
"ItemsSource",
|
||||
typeof (ICollection<string>),
|
||||
typeof (EditableListBoxControl),
|
||||
new FrameworkPropertyMetadata(OnItemsSourcePropertyChanged)
|
||||
);
|
||||
|
||||
public static readonly DependencyProperty LabelProperty = DependencyProperty.Register(
|
||||
"Label",
|
||||
typeof (string),
|
||||
typeof (EditableListBoxControl),
|
||||
new FrameworkPropertyMetadata()
|
||||
);
|
||||
|
||||
public static readonly DependencyProperty AutoCompleteItemsSourceProperty = DependencyProperty.Register(
|
||||
"AutoCompleteItemsSource",
|
||||
typeof (IEnumerable<string>),
|
||||
typeof (EditableListBoxControl),
|
||||
new FrameworkPropertyMetadata()
|
||||
);
|
||||
|
||||
public IEnumerable<string> AutoCompleteItemsSource
|
||||
{
|
||||
get { return (IEnumerable<string>) GetValue(AutoCompleteItemsSourceProperty); }
|
||||
set { SetValue(AutoCompleteItemsSourceProperty, value); }
|
||||
}
|
||||
|
||||
public ICollection<string> ItemsSource
|
||||
{
|
||||
get { return (ICollection<string>)GetValue(ItemsSourceProperty); }
|
||||
set { SetValue(ItemsSourceProperty, value); }
|
||||
}
|
||||
|
||||
public string Label
|
||||
{
|
||||
get { return (string)GetValue(LabelProperty); }
|
||||
set { SetValue(LabelProperty, value); }
|
||||
}
|
||||
|
||||
public string AddItemText
|
||||
{
|
||||
get { return _addItemText; }
|
||||
set
|
||||
{
|
||||
_addItemText = value;
|
||||
OnPropertyChanged();
|
||||
AddItemCommand.RaiseCanExecuteChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnAddItemCommand()
|
||||
{
|
||||
if (string.IsNullOrEmpty(AddItemText)) return;
|
||||
|
||||
ItemsSource.Add(AddItemText);
|
||||
AddItemText = string.Empty;
|
||||
}
|
||||
|
||||
private void OnDeleteItemCommand(string itemToDelete)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(itemToDelete))
|
||||
{
|
||||
ItemsSource.Remove(itemToDelete);
|
||||
}
|
||||
}
|
||||
|
||||
private static void OnItemsSourcePropertyChanged(DependencyObject source,
|
||||
DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
var control = source as EditableListBoxControl;
|
||||
if (control == null) return;
|
||||
|
||||
control.OnPropertyChanged("ItemsSource");
|
||||
}
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
[NotifyPropertyChangedInvocator]
|
||||
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
var handler = PropertyChanged;
|
||||
if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
}
|
||||
25
Filtration/UserControls/NumericFilterPredicateControl.xaml
Normal file
25
Filtration/UserControls/NumericFilterPredicateControl.xaml
Normal file
@@ -0,0 +1,25 @@
|
||||
<UserControl x:Class="Filtration.UserControls.NumericFilterPredicateControl"
|
||||
x:ClassModifier="internal"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:enums="clr-namespace:Filtration.Enums"
|
||||
xmlns:extensions="clr-namespace:Filtration.Extensions"
|
||||
xmlns:userControls="clr-namespace:Filtration.UserControls"
|
||||
mc:Ignorable="d"
|
||||
d:DataContext="{d:DesignInstance Type=userControls:NumericFilterPredicateControl}">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition SharedSizeGroup="NumericFilterPredicateControlComboBox" Width="50" />
|
||||
<ColumnDefinition Width="4" />
|
||||
<ColumnDefinition SharedSizeGroup="NumericFilterPredicateControlUpDown" Width="45" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<ComboBox Grid.Column="0" ItemsSource="{Binding Source={extensions:Enumeration {x:Type enums:FilterPredicateOperator}}}"
|
||||
DisplayMemberPath="Description"
|
||||
SelectedValue="{Binding FilterPredicateOperator}"
|
||||
SelectedValuePath="Value" />
|
||||
<xctk:ShortUpDown Grid.Column="2" Value="{Binding Path=FilterPredicateOperand}" Minimum="{Binding Path=Minimum}" Maximum="{Binding Path=Maximum}" />
|
||||
</Grid>
|
||||
</UserControl>
|
||||
133
Filtration/UserControls/NumericFilterPredicateControl.xaml.cs
Normal file
133
Filtration/UserControls/NumericFilterPredicateControl.xaml.cs
Normal file
@@ -0,0 +1,133 @@
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Windows;
|
||||
using Filtration.Annotations;
|
||||
using Filtration.Enums;
|
||||
using Filtration.Models;
|
||||
|
||||
namespace Filtration.UserControls
|
||||
{
|
||||
internal partial class NumericFilterPredicateControl : INotifyPropertyChanged
|
||||
{
|
||||
public NumericFilterPredicateControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
// ReSharper disable once PossibleNullReferenceException
|
||||
(Content as FrameworkElement).DataContext = this;
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty NumericFilterPredicateProperty = DependencyProperty.Register(
|
||||
"NumericFilterPredicate",
|
||||
typeof (NumericFilterPredicate),
|
||||
typeof (NumericFilterPredicateControl),
|
||||
new FrameworkPropertyMetadata(OnNumericFilterPredicatePropertyChanged));
|
||||
|
||||
public static readonly DependencyProperty TextProperty = DependencyProperty.Register(
|
||||
"Text",
|
||||
typeof (string),
|
||||
typeof (NumericFilterPredicateControl),
|
||||
new FrameworkPropertyMetadata {BindsTwoWayByDefault = true});
|
||||
|
||||
public static readonly DependencyProperty MinimumProperty = DependencyProperty.Register(
|
||||
"Minimum",
|
||||
typeof (int),
|
||||
typeof (NumericFilterPredicateControl),
|
||||
new FrameworkPropertyMetadata {BindsTwoWayByDefault = true});
|
||||
|
||||
public static readonly DependencyProperty MaximumProperty = DependencyProperty.Register(
|
||||
"Maximum",
|
||||
typeof (int),
|
||||
typeof (NumericFilterPredicateControl),
|
||||
new FrameworkPropertyMetadata {BindsTwoWayByDefault = true});
|
||||
|
||||
public NumericFilterPredicate NumericFilterPredicate
|
||||
{
|
||||
get
|
||||
{
|
||||
return (NumericFilterPredicate)GetValue(NumericFilterPredicateProperty);
|
||||
}
|
||||
set
|
||||
{
|
||||
SetValue(NumericFilterPredicateProperty, value);
|
||||
OnPropertyChanged();
|
||||
OnPropertyChanged("FilterPredicateOperator");
|
||||
OnPropertyChanged("FilterPredicateOperand");
|
||||
}
|
||||
}
|
||||
|
||||
public FilterPredicateOperator FilterPredicateOperator
|
||||
{
|
||||
get { return NumericFilterPredicate.PredicateOperator; }
|
||||
set
|
||||
{
|
||||
NumericFilterPredicate.PredicateOperator = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public int FilterPredicateOperand
|
||||
{
|
||||
get { return NumericFilterPredicate.PredicateOperand; }
|
||||
set
|
||||
{
|
||||
NumericFilterPredicate.PredicateOperand = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public string Text
|
||||
{
|
||||
get
|
||||
{
|
||||
return (string)GetValue(TextProperty);
|
||||
}
|
||||
set
|
||||
{
|
||||
SetValue(TextProperty, value);
|
||||
}
|
||||
}
|
||||
|
||||
public int Minimum
|
||||
{
|
||||
get
|
||||
{
|
||||
return (int)GetValue(MinimumProperty);
|
||||
}
|
||||
set
|
||||
{
|
||||
SetValue(MinimumProperty, value);
|
||||
}
|
||||
}
|
||||
|
||||
public int Maximum
|
||||
{
|
||||
get
|
||||
{
|
||||
return (int)GetValue(MaximumProperty);
|
||||
}
|
||||
set
|
||||
{
|
||||
SetValue(MaximumProperty, value);
|
||||
}
|
||||
}
|
||||
|
||||
private static void OnNumericFilterPredicatePropertyChanged(DependencyObject source,
|
||||
DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
var control = source as NumericFilterPredicateControl;
|
||||
if (control == null) return;
|
||||
|
||||
control.OnPropertyChanged("FilterPredicateOperator");
|
||||
control.OnPropertyChanged("FilterPredicateOperand");
|
||||
}
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
[NotifyPropertyChangedInvocator]
|
||||
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
var handler = PropertyChanged;
|
||||
if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
}
|
||||
97
Filtration/Utilities/LineReader.cs
Normal file
97
Filtration/Utilities/LineReader.cs
Normal file
@@ -0,0 +1,97 @@
|
||||
// Taken from JonSkeet's StackOverflow answer here: http://stackoverflow.com/questions/286533/filestream-streamreader-problem-in-c-sharp/286598#286598
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace Filtration.Utilities
|
||||
{
|
||||
|
||||
public sealed class LineReader : IEnumerable<string>
|
||||
{
|
||||
/// <summary>
|
||||
/// Means of creating a TextReader to read from.
|
||||
/// </summary>
|
||||
private readonly Func<TextReader> _dataSource;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a LineReader from a stream source. The delegate is only
|
||||
/// called when the enumerator is fetched. UTF-8 is used to decode
|
||||
/// the stream into text.
|
||||
/// </summary>
|
||||
/// <param name="streamSource">Data source</param>
|
||||
public LineReader(Func<Stream> streamSource)
|
||||
: this(streamSource, Encoding.UTF8)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a LineReader from a stream source. The delegate is only
|
||||
/// called when the enumerator is fetched.
|
||||
/// </summary>
|
||||
/// <param name="streamSource">Data source</param>
|
||||
/// <param name="encoding">Encoding to use to decode the stream
|
||||
/// into text</param>
|
||||
public LineReader(Func<Stream> streamSource, Encoding encoding)
|
||||
: this(() => new StreamReader(streamSource(), encoding))
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a LineReader from a filename. The file is only opened
|
||||
/// (or even checked for existence) when the enumerator is fetched.
|
||||
/// UTF8 is used to decode the file into text.
|
||||
/// </summary>
|
||||
/// <param name="filename">File to read from</param>
|
||||
public LineReader(string filename)
|
||||
: this(filename, Encoding.UTF8)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a LineReader from a filename. The file is only opened
|
||||
/// (or even checked for existence) when the enumerator is fetched.
|
||||
/// </summary>
|
||||
/// <param name="filename">File to read from</param>
|
||||
/// <param name="encoding">Encoding to use to decode the file
|
||||
/// into text</param>
|
||||
public LineReader(string filename, Encoding encoding)
|
||||
: this(() => new StreamReader(filename, encoding))
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a LineReader from a TextReader source. The delegate
|
||||
/// is only called when the enumerator is fetched
|
||||
/// </summary>
|
||||
/// <param name="dataSource">Data source</param>
|
||||
public LineReader(Func<TextReader> dataSource)
|
||||
{
|
||||
_dataSource = dataSource;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enumerates the data source line by line.
|
||||
/// </summary>
|
||||
public IEnumerator<string> GetEnumerator()
|
||||
{
|
||||
using (TextReader reader = _dataSource())
|
||||
{
|
||||
string line;
|
||||
while ((line = reader.ReadLine()) != null)
|
||||
{
|
||||
yield return line;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enumerates the data source line by line.
|
||||
/// </summary>
|
||||
IEnumerator IEnumerable.GetEnumerator()
|
||||
{
|
||||
return GetEnumerator();
|
||||
}
|
||||
}
|
||||
}
|
||||
18
Filtration/ViewModels/FiltrationViewModelBase.cs
Normal file
18
Filtration/ViewModels/FiltrationViewModelBase.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System.Runtime.CompilerServices;
|
||||
using Filtration.Annotations;
|
||||
using GalaSoft.MvvmLight;
|
||||
|
||||
namespace Filtration.ViewModels
|
||||
{
|
||||
internal class FiltrationViewModelBase : ViewModelBase
|
||||
{
|
||||
/// This gives us the ReSharper option to transform an autoproperty into a property with change notification
|
||||
/// Also leverages .net 4.5 callermembername attribute
|
||||
[NotifyPropertyChangedInvocator]
|
||||
|
||||
protected override void RaisePropertyChanged([CallerMemberName]string property = "")
|
||||
{
|
||||
base.RaisePropertyChanged(property);
|
||||
}
|
||||
}
|
||||
}
|
||||
16
Filtration/ViewModels/ILootFilterBlockViewModel.cs
Normal file
16
Filtration/ViewModels/ILootFilterBlockViewModel.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using System.ComponentModel;
|
||||
using Filtration.Models;
|
||||
using GalaSoft.MvvmLight.CommandWpf;
|
||||
|
||||
namespace Filtration.ViewModels
|
||||
{
|
||||
internal interface ILootFilterBlockViewModel
|
||||
{
|
||||
void Initialise(LootFilterBlock lootFilterBlock);
|
||||
bool IsDirty { get; set; }
|
||||
LootFilterBlock Block { get; }
|
||||
RelayCommand CopyBlockCommand { get; }
|
||||
string BlockDescription { get; set; }
|
||||
event PropertyChangedEventHandler PropertyChanged;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace Filtration.ViewModels
|
||||
{
|
||||
internal interface ILootFilterBlockViewModelFactory
|
||||
{
|
||||
ILootFilterBlockViewModel Create();
|
||||
void Release(ILootFilterBlockViewModel lootFilterBlockViewModel);
|
||||
}
|
||||
}
|
||||
20
Filtration/ViewModels/ILootFilterScriptViewModel.cs
Normal file
20
Filtration/ViewModels/ILootFilterScriptViewModel.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using Filtration.Models;
|
||||
|
||||
namespace Filtration.ViewModels
|
||||
{
|
||||
internal interface ILootFilterScriptViewModel
|
||||
{
|
||||
ObservableCollection<ILootFilterBlockViewModel> LootFilterBlockViewModels { get; }
|
||||
LootFilterScript Script { get; }
|
||||
bool IsDirty { get; }
|
||||
string Description { get; set; }
|
||||
string Filename { get; }
|
||||
string DisplayName { get; }
|
||||
string Filepath { get; }
|
||||
void Initialise(LootFilterScript lootFilterScript);
|
||||
void RemoveDirtyFlag();
|
||||
event PropertyChangedEventHandler PropertyChanged;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace Filtration.ViewModels
|
||||
{
|
||||
internal interface ILootFilterScriptViewModelFactory
|
||||
{
|
||||
ILootFilterScriptViewModel Create();
|
||||
void Release(ILootFilterScriptViewModel lootFilterScriptViewModel);
|
||||
}
|
||||
}
|
||||
6
Filtration/ViewModels/IMainWindowViewModel.cs
Normal file
6
Filtration/ViewModels/IMainWindowViewModel.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
namespace Filtration.ViewModels
|
||||
{
|
||||
internal interface IMainWindowViewModel
|
||||
{
|
||||
}
|
||||
}
|
||||
288
Filtration/ViewModels/LootFilterBlockViewModel.cs
Normal file
288
Filtration/ViewModels/LootFilterBlockViewModel.cs
Normal file
@@ -0,0 +1,288 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Collections.Specialized;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
using Filtration.Models;
|
||||
using Filtration.Models.BlockItemTypes;
|
||||
using Filtration.Services;
|
||||
using Filtration.Translators;
|
||||
using GalaSoft.MvvmLight.CommandWpf;
|
||||
|
||||
namespace Filtration.ViewModels
|
||||
{
|
||||
internal class LootFilterBlockViewModel : FiltrationViewModelBase, ILootFilterBlockViewModel
|
||||
{
|
||||
private readonly ILootFilterBlockTranslator _translator;
|
||||
private readonly IStaticDataService _staticDataService;
|
||||
private readonly MediaPlayer _mediaPlayer = new MediaPlayer();
|
||||
|
||||
private bool _displaySettingsPopupOpen;
|
||||
|
||||
public LootFilterBlockViewModel(ILootFilterBlockTranslator translator, IStaticDataService staticDataService)
|
||||
{
|
||||
_translator = translator;
|
||||
_staticDataService = staticDataService;
|
||||
CopyBlockCommand = new RelayCommand(OnCopyConditionCommand);
|
||||
|
||||
AddFilterBlockItemCommand = new RelayCommand<Type>(OnAddFilterBlockItemCommand);
|
||||
AddAudioVisualBlockItemCommand = new RelayCommand<Type>(OnAddAudioVisualBlockItemCommand);
|
||||
RemoveFilterBlockItemCommand = new RelayCommand<ILootFilterBlockItem>(OnRemoveFilterBlockItemCommand);
|
||||
RemoveAudioVisualBlockItemCommand = new RelayCommand<ILootFilterBlockItem>(OnRemoveAudioVisualBlockItemCommand);
|
||||
PlaySoundCommand = new RelayCommand(OnPlaySoundCommand, () => HasSound);
|
||||
}
|
||||
|
||||
public void Initialise(LootFilterBlock lootFilterBlock)
|
||||
{
|
||||
if (lootFilterBlock == null)
|
||||
{
|
||||
throw new ArgumentNullException("lootFilterBlock");
|
||||
}
|
||||
|
||||
Block = lootFilterBlock;
|
||||
lootFilterBlock.BlockItems.CollectionChanged += OnBlockItemsCollectionChanged;
|
||||
|
||||
foreach (var blockItem in lootFilterBlock.BlockItems.OfType<IAudioVisualBlockItem>())
|
||||
{
|
||||
blockItem.PropertyChanged += OnAudioVisualBlockItemChanged;
|
||||
}
|
||||
}
|
||||
|
||||
public RelayCommand CopyBlockCommand { get; private set; }
|
||||
public RelayCommand<Type> AddFilterBlockItemCommand { get; private set; }
|
||||
public RelayCommand<Type> AddAudioVisualBlockItemCommand { get; private set; }
|
||||
public RelayCommand<ILootFilterBlockItem> RemoveFilterBlockItemCommand { get; private set; }
|
||||
public RelayCommand<ILootFilterBlockItem> RemoveAudioVisualBlockItemCommand { get; private set; }
|
||||
public RelayCommand PlaySoundCommand { get; private set; }
|
||||
|
||||
public LootFilterBlock Block { get; private set; }
|
||||
public bool IsDirty { get; set; }
|
||||
|
||||
public ObservableCollection<ILootFilterBlockItem> FilterBlockItems
|
||||
{
|
||||
get { return Block.BlockItems; }
|
||||
}
|
||||
|
||||
public IEnumerable<ILootFilterBlockItem> SummaryBlockItems
|
||||
{
|
||||
get { return Block.BlockItems.Where(b => !(b is IAudioVisualBlockItem)); }
|
||||
}
|
||||
|
||||
public IEnumerable<ILootFilterBlockItem> AudioVisualBlockItems
|
||||
{
|
||||
get { return Block.BlockItems.Where(b => b is IAudioVisualBlockItem); }
|
||||
}
|
||||
|
||||
public bool DisplaySettingsPopupOpen
|
||||
{
|
||||
get { return _displaySettingsPopupOpen; }
|
||||
set
|
||||
{
|
||||
_displaySettingsPopupOpen = value;
|
||||
RaisePropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerable<string> AutoCompleteItemClasses
|
||||
{
|
||||
get { return _staticDataService.ItemClasses; }
|
||||
}
|
||||
|
||||
public IEnumerable<string> AutoCompleteItemBaseTypes
|
||||
{
|
||||
get { return _staticDataService.ItemBaseTypes; }
|
||||
}
|
||||
|
||||
public List<int> SoundsAvailable
|
||||
{
|
||||
get
|
||||
{
|
||||
return new List<int>
|
||||
{
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
4,
|
||||
5,
|
||||
6,
|
||||
7,
|
||||
8,
|
||||
9
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public List<Type> BlockItemTypesAvailable
|
||||
{
|
||||
get
|
||||
{
|
||||
return new List<Type>
|
||||
{
|
||||
typeof (ItemLevelBlockItem),
|
||||
typeof (DropLevelBlockItem),
|
||||
typeof (QualityBlockItem),
|
||||
typeof (RarityBlockItem),
|
||||
typeof (SocketsBlockItem),
|
||||
typeof (LinkedSocketsBlockItem),
|
||||
typeof (WidthBlockItem),
|
||||
typeof (HeightBlockItem),
|
||||
typeof (SocketGroupBlockItem),
|
||||
typeof (ClassBlockItem),
|
||||
typeof (BaseTypeBlockItem)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public List<Type> AudioVisualBlockItemTypesAvailable
|
||||
{
|
||||
get
|
||||
{
|
||||
return new List<Type>
|
||||
{
|
||||
typeof (TextColorBlockItem),
|
||||
typeof (BackgroundColorBlockItem),
|
||||
typeof (BorderColorBlockItem),
|
||||
typeof (FontSizeBlockItem),
|
||||
typeof (SoundBlockItem)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public string BlockDescription
|
||||
{
|
||||
get
|
||||
{
|
||||
return Block.Description;
|
||||
}
|
||||
set
|
||||
{
|
||||
Block.Description = value;
|
||||
RaisePropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public bool HasTextColor
|
||||
{
|
||||
get { return FilterBlockItems.Count(b => b is TextColorBlockItem) > 0; }
|
||||
}
|
||||
|
||||
public Color DisplayTextColor
|
||||
{
|
||||
get
|
||||
{
|
||||
return HasTextColor
|
||||
? FilterBlockItems.OfType<TextColorBlockItem>().First().Color
|
||||
: new Color { A = 255, R = 255, G = 255, B = 255 };
|
||||
}
|
||||
}
|
||||
|
||||
public bool HasBackgroundColor
|
||||
{
|
||||
get { return FilterBlockItems.Count(b => b is BackgroundColorBlockItem) > 0; }
|
||||
}
|
||||
|
||||
public Color DisplayBackgroundColor
|
||||
{
|
||||
get
|
||||
{
|
||||
return HasBackgroundColor
|
||||
? FilterBlockItems.OfType<BackgroundColorBlockItem>().First().Color
|
||||
: new Color { A = 255, R = 0, G = 0, B = 0 };
|
||||
}
|
||||
}
|
||||
|
||||
public bool HasBorderColor
|
||||
{
|
||||
get { return FilterBlockItems.Count(b => b is BorderColorBlockItem) > 0; }
|
||||
}
|
||||
|
||||
public Color DisplayBorderColor
|
||||
{
|
||||
get
|
||||
{
|
||||
return HasBorderColor
|
||||
? FilterBlockItems.OfType<BorderColorBlockItem>().First().Color
|
||||
: new Color { A = 255, R = 0, G = 0, B = 0 };
|
||||
}
|
||||
}
|
||||
|
||||
public bool HasFontSize
|
||||
{
|
||||
get { return FilterBlockItems.Count(b => b is FontSizeBlockItem) > 0; }
|
||||
}
|
||||
|
||||
public bool HasSound
|
||||
{
|
||||
get { return FilterBlockItems.Count(b => b is SoundBlockItem) > 0; }
|
||||
}
|
||||
|
||||
private void OnCopyConditionCommand()
|
||||
{
|
||||
Clipboard.SetText(_translator.TranslateLootFilterBlockToString(Block));
|
||||
}
|
||||
|
||||
private void OnAddFilterBlockItemCommand(Type blockItemType)
|
||||
{
|
||||
if (!AddBlockItemAllowed(blockItemType)) return;
|
||||
var newBlockItem = (ILootFilterBlockItem) Activator.CreateInstance(blockItemType);
|
||||
|
||||
FilterBlockItems.Add(newBlockItem);
|
||||
IsDirty = true;
|
||||
}
|
||||
|
||||
private void OnRemoveFilterBlockItemCommand(ILootFilterBlockItem blockItem)
|
||||
{
|
||||
FilterBlockItems.Remove(blockItem);
|
||||
IsDirty = true;
|
||||
}
|
||||
|
||||
private void OnAddAudioVisualBlockItemCommand(Type blockItemType)
|
||||
{
|
||||
if (!AddBlockItemAllowed(blockItemType)) return;
|
||||
var newBlockItem = (ILootFilterBlockItem) Activator.CreateInstance(blockItemType);
|
||||
|
||||
newBlockItem.PropertyChanged += OnAudioVisualBlockItemChanged;
|
||||
FilterBlockItems.Add(newBlockItem);
|
||||
OnAudioVisualBlockItemChanged(null, null);
|
||||
IsDirty = true;
|
||||
}
|
||||
|
||||
private void OnRemoveAudioVisualBlockItemCommand(ILootFilterBlockItem blockItem)
|
||||
{
|
||||
blockItem.PropertyChanged -= OnAudioVisualBlockItemChanged;
|
||||
FilterBlockItems.Remove(blockItem);
|
||||
OnAudioVisualBlockItemChanged(null, null);
|
||||
IsDirty = true;
|
||||
}
|
||||
|
||||
private bool AddBlockItemAllowed(Type type)
|
||||
{
|
||||
var blockItem = (ILootFilterBlockItem)Activator.CreateInstance(type);
|
||||
var blockCount = FilterBlockItems.Count(b => b.GetType() == type);
|
||||
return blockCount < blockItem.MaximumAllowed;
|
||||
}
|
||||
|
||||
private void OnPlaySoundCommand()
|
||||
{
|
||||
var soundUri = "Resources/AlertSound" + FilterBlockItems.OfType<SoundBlockItem>().First().Value + ".wav";
|
||||
_mediaPlayer.Open(new Uri(soundUri, UriKind.Relative));
|
||||
_mediaPlayer.Play();
|
||||
}
|
||||
|
||||
private void OnAudioVisualBlockItemChanged(object sender, EventArgs e)
|
||||
{
|
||||
RaisePropertyChanged("DisplayTextColor");
|
||||
RaisePropertyChanged("DisplayBackgroundColor");
|
||||
RaisePropertyChanged("DisplayBorderColor");
|
||||
RaisePropertyChanged("HasSound");
|
||||
}
|
||||
|
||||
private void OnBlockItemsCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
|
||||
{
|
||||
RaisePropertyChanged("SummaryBlockItems");
|
||||
RaisePropertyChanged("AudioVisualBlockItems");
|
||||
}
|
||||
}
|
||||
}
|
||||
100
Filtration/ViewModels/LootFilterScriptViewModel - Copy.cs
Normal file
100
Filtration/ViewModels/LootFilterScriptViewModel - Copy.cs
Normal file
@@ -0,0 +1,100 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Media;
|
||||
using Filtration.Enums;
|
||||
using Filtration.Models;
|
||||
|
||||
namespace Filtration.ViewModels
|
||||
{
|
||||
internal class LootFilterScriptViewModela : ILootFilterScriptViewModel
|
||||
{
|
||||
private readonly ILootFilterConditionViewModelFactory _lootFilterConditionViewModelFactory;
|
||||
|
||||
public LootFilterScriptViewModela(ILootFilterConditionViewModelFactory lootFilterConditionViewModelFactory)
|
||||
{
|
||||
_lootFilterConditionViewModelFactory = lootFilterConditionViewModelFactory;
|
||||
LootFilterConditionViewModels = new List<ILootFilterConditionViewModel>();
|
||||
|
||||
var testCondition = new LootFilterCondition
|
||||
{
|
||||
BackgroundColor = Colors.DarkCyan,
|
||||
TextColor = Colors.White,
|
||||
BorderColor = Colors.Red,
|
||||
Sockets =
|
||||
new NumericFilterPredicate(FilterPredicateOperator.LessThanOrEqual, 5),
|
||||
LinkedSockets =
|
||||
new NumericFilterPredicate(FilterPredicateOperator.Equal, 2),
|
||||
ItemRarity = new NumericFilterPredicate(FilterPredicateOperator.GreaterThan, (int) ItemRarity.Magic),
|
||||
FontSize = 10,
|
||||
Quality =
|
||||
new NumericFilterPredicate(FilterPredicateOperator.GreaterThanOrEqual, 15),
|
||||
ItemLevel =
|
||||
new NumericFilterPredicate(FilterPredicateOperator.GreaterThan, 50),
|
||||
DropLevel = new NumericFilterPredicate(),
|
||||
FilterDescription = "My Wicked Filter"
|
||||
};
|
||||
|
||||
var testCondition2 = new LootFilterCondition
|
||||
{
|
||||
BackgroundColor = Colors.Beige,
|
||||
TextColor = Colors.Blue,
|
||||
BorderColor = Colors.Black,
|
||||
Sockets =
|
||||
new NumericFilterPredicate(FilterPredicateOperator.LessThan, 4),
|
||||
LinkedSockets =
|
||||
new NumericFilterPredicate(FilterPredicateOperator.GreaterThanOrEqual, 3),
|
||||
FontSize = 12,
|
||||
Quality =
|
||||
new NumericFilterPredicate(FilterPredicateOperator.GreaterThanOrEqual, 15),
|
||||
ItemLevel =
|
||||
new NumericFilterPredicate(FilterPredicateOperator.Equal, 32),
|
||||
DropLevel = new NumericFilterPredicate(FilterPredicateOperator.GreaterThanOrEqual, 85),
|
||||
FilterDescription = "This is a test filter"
|
||||
};
|
||||
|
||||
|
||||
|
||||
var testCondition3 = new LootFilterCondition
|
||||
{
|
||||
BackgroundColor = Colors.Beige,
|
||||
TextColor = new Color { A = 128, R = 0, G = 0, B = 255},
|
||||
BorderColor = Colors.Black,
|
||||
Sockets =
|
||||
new NumericFilterPredicate(FilterPredicateOperator.LessThan, 4),
|
||||
LinkedSockets =
|
||||
new NumericFilterPredicate(FilterPredicateOperator.GreaterThanOrEqual, 3),
|
||||
FontSize = 12,
|
||||
Quality =
|
||||
new NumericFilterPredicate(FilterPredicateOperator.GreaterThanOrEqual, 15),
|
||||
ItemLevel =
|
||||
new NumericFilterPredicate(FilterPredicateOperator.Equal, 32),
|
||||
DropLevel = new NumericFilterPredicate(FilterPredicateOperator.GreaterThanOrEqual, 85),
|
||||
FilterDescription = "This is a test filter"
|
||||
};
|
||||
|
||||
var testConditionFilter = _lootFilterConditionViewModelFactory.Create();
|
||||
var testConditionFilter2 = _lootFilterConditionViewModelFactory.Create();
|
||||
var testConditionFilter3 = _lootFilterConditionViewModelFactory.Create();
|
||||
testConditionFilter.Initialise(testCondition);
|
||||
testConditionFilter2.Initialise(testCondition2);
|
||||
testConditionFilter3.Initialise(testCondition3);
|
||||
|
||||
testConditionFilter.Classes.Add("Test Class 1");
|
||||
testConditionFilter.Classes.Add("Test Class 2");
|
||||
testConditionFilter.Classes.Add("Test Class 3");
|
||||
testConditionFilter.Classes.Add("Test Class 4");
|
||||
testConditionFilter.Classes.Add("Test Class 5");
|
||||
testConditionFilter.Classes.Add("Test Class 6");
|
||||
testConditionFilter.Classes.Add("Test Class 7");
|
||||
testConditionFilter.Classes.Add("Test Class 8");
|
||||
testConditionFilter.Classes.Add("Test Class 9");
|
||||
testConditionFilter.Classes.Add("Test Class 10");
|
||||
testConditionFilter.BaseTypes.Add("Test Base Type 1");
|
||||
testConditionFilter.BaseTypes.Add("Test Base Type 2");
|
||||
LootFilterConditionViewModels.Add(testConditionFilter);
|
||||
LootFilterConditionViewModels.Add(testConditionFilter2);
|
||||
LootFilterConditionViewModels.Add(testConditionFilter3);
|
||||
}
|
||||
|
||||
public List<ILootFilterConditionViewModel> LootFilterConditionViewModels { get; private set; }
|
||||
}
|
||||
}
|
||||
225
Filtration/ViewModels/LootFilterScriptViewModel.cs
Normal file
225
Filtration/ViewModels/LootFilterScriptViewModel.cs
Normal file
@@ -0,0 +1,225 @@
|
||||
using System.Collections.ObjectModel;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using Filtration.Models;
|
||||
using GalaSoft.MvvmLight.CommandWpf;
|
||||
|
||||
namespace Filtration.ViewModels
|
||||
{
|
||||
internal class LootFilterScriptViewModel : FiltrationViewModelBase, ILootFilterScriptViewModel
|
||||
{
|
||||
private readonly ILootFilterBlockViewModelFactory _lootFilterBlockViewModelFactory;
|
||||
private bool _isDirty;
|
||||
|
||||
public LootFilterScriptViewModel(ILootFilterBlockViewModelFactory lootFilterBlockViewModelFactory )
|
||||
{
|
||||
DeleteBlockCommand = new RelayCommand(OnDeleteBlock, () => SelectedBlockViewModel != null);
|
||||
MoveBlockToTopCommand = new RelayCommand(OnMoveBlockToTopCommand, () => SelectedBlockViewModel != null);
|
||||
MoveBlockUpCommand = new RelayCommand(OnMoveBlockUpCommand, () => SelectedBlockViewModel != null);
|
||||
MoveBlockDownCommand = new RelayCommand(OnMoveBlockDownCommand, () => SelectedBlockViewModel != null);
|
||||
MoveBlockToBottomCommand = new RelayCommand(OnMoveBlockToBottomCommand, () => SelectedBlockViewModel != null);
|
||||
AddBlockAboveCommand = new RelayCommand(OnAddBlockAboveCommand, () => SelectedBlockViewModel != null || LootFilterBlockViewModels.Count == 0);
|
||||
AddBlockBelowCommand = new RelayCommand(OnAddBlockBelowCommand, () => SelectedBlockViewModel != null);
|
||||
|
||||
AddSectionAboveCommand = new RelayCommand(OnAddSectionAboveCommand, () => SelectedBlockViewModel != null);
|
||||
|
||||
_lootFilterBlockViewModelFactory = lootFilterBlockViewModelFactory;
|
||||
LootFilterBlockViewModels = new ObservableCollection<ILootFilterBlockViewModel>();
|
||||
|
||||
}
|
||||
|
||||
public RelayCommand DeleteBlockCommand { get; private set; }
|
||||
public RelayCommand MoveBlockToTopCommand { get; private set; }
|
||||
public RelayCommand MoveBlockUpCommand { get; private set; }
|
||||
public RelayCommand MoveBlockDownCommand { get; private set; }
|
||||
public RelayCommand MoveBlockToBottomCommand { get; private set; }
|
||||
public RelayCommand AddBlockAboveCommand { get; private set; }
|
||||
public RelayCommand AddBlockBelowCommand { get; private set; }
|
||||
public RelayCommand AddSectionAboveCommand { get; private set; }
|
||||
|
||||
public ObservableCollection<ILootFilterBlockViewModel> LootFilterBlockViewModels { get; private set; }
|
||||
|
||||
public string Description
|
||||
{
|
||||
get { return Script.Description; }
|
||||
set
|
||||
{
|
||||
Script.Description = value;
|
||||
_isDirty = true;
|
||||
RaisePropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public LootFilterBlockViewModel SelectedBlockViewModel { get; set; }
|
||||
|
||||
public LootFilterScript Script { get; private set; }
|
||||
|
||||
public bool IsDirty
|
||||
{
|
||||
get { return _isDirty || HasDirtyChildren; }
|
||||
set { _isDirty = value; }
|
||||
}
|
||||
|
||||
private bool HasDirtyChildren
|
||||
{
|
||||
get { return LootFilterBlockViewModels.Any(vm => vm.IsDirty); }
|
||||
}
|
||||
|
||||
private void CleanChildren()
|
||||
{
|
||||
foreach (var vm in LootFilterBlockViewModels)
|
||||
{
|
||||
vm.IsDirty = false;
|
||||
}
|
||||
}
|
||||
|
||||
public void RemoveDirtyFlag()
|
||||
{
|
||||
CleanChildren();
|
||||
IsDirty = false;
|
||||
}
|
||||
|
||||
public string DisplayName
|
||||
{
|
||||
get { return !string.IsNullOrEmpty(Filename) ? Filename : Description; }
|
||||
}
|
||||
|
||||
public string Filename
|
||||
{
|
||||
get { return Path.GetFileName(Script.FilePath); }
|
||||
}
|
||||
|
||||
public string Filepath
|
||||
{
|
||||
get { return Script.FilePath; }
|
||||
}
|
||||
|
||||
public void Initialise(LootFilterScript lootFilterScript)
|
||||
{
|
||||
LootFilterBlockViewModels.Clear();
|
||||
|
||||
Script = lootFilterScript;
|
||||
foreach (var block in Script.LootFilterBlocks)
|
||||
{
|
||||
var vm = _lootFilterBlockViewModelFactory.Create();
|
||||
vm.Initialise(block);
|
||||
LootFilterBlockViewModels.Add(vm);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnMoveBlockToTopCommand()
|
||||
{
|
||||
var currentIndex = LootFilterBlockViewModels.IndexOf(SelectedBlockViewModel);
|
||||
|
||||
if (currentIndex > 0)
|
||||
{
|
||||
var block = SelectedBlockViewModel.Block;
|
||||
Script.LootFilterBlocks.Remove(block);
|
||||
Script.LootFilterBlocks.Insert(0, block);
|
||||
LootFilterBlockViewModels.Move(currentIndex, 0);
|
||||
_isDirty = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnMoveBlockUpCommand()
|
||||
{
|
||||
var currentIndex = LootFilterBlockViewModels.IndexOf(SelectedBlockViewModel);
|
||||
|
||||
if (currentIndex > 0)
|
||||
{
|
||||
var block = SelectedBlockViewModel.Block;
|
||||
var blockPos = Script.LootFilterBlocks.IndexOf(block);
|
||||
Script.LootFilterBlocks.RemoveAt(blockPos);
|
||||
Script.LootFilterBlocks.Insert(blockPos - 1, block);
|
||||
LootFilterBlockViewModels.Move(currentIndex, currentIndex - 1);
|
||||
_isDirty = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnMoveBlockDownCommand()
|
||||
{
|
||||
var currentIndex = LootFilterBlockViewModels.IndexOf(SelectedBlockViewModel);
|
||||
|
||||
if (currentIndex < LootFilterBlockViewModels.Count - 1)
|
||||
{
|
||||
var block = SelectedBlockViewModel.Block;
|
||||
var blockPos = Script.LootFilterBlocks.IndexOf(block);
|
||||
Script.LootFilterBlocks.RemoveAt(blockPos);
|
||||
Script.LootFilterBlocks.Insert(blockPos + 1, block);
|
||||
LootFilterBlockViewModels.Move(currentIndex, currentIndex + 1);
|
||||
_isDirty = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnMoveBlockToBottomCommand()
|
||||
{
|
||||
var currentIndex = LootFilterBlockViewModels.IndexOf(SelectedBlockViewModel);
|
||||
|
||||
if (currentIndex < LootFilterBlockViewModels.Count - 1)
|
||||
{
|
||||
var block = SelectedBlockViewModel.Block;
|
||||
Script.LootFilterBlocks.Remove(block);
|
||||
Script.LootFilterBlocks.Add(block);
|
||||
LootFilterBlockViewModels.Move(currentIndex, LootFilterBlockViewModels.Count - 1);
|
||||
_isDirty = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnAddBlockAboveCommand()
|
||||
{
|
||||
var vm = _lootFilterBlockViewModelFactory.Create();
|
||||
var newBlock = new LootFilterBlock();
|
||||
vm.Initialise(newBlock);
|
||||
|
||||
if (LootFilterBlockViewModels.Count > 0)
|
||||
{
|
||||
Script.LootFilterBlocks.Insert(Script.LootFilterBlocks.IndexOf(SelectedBlockViewModel.Block), newBlock);
|
||||
LootFilterBlockViewModels.Insert(LootFilterBlockViewModels.IndexOf(SelectedBlockViewModel), vm);
|
||||
}
|
||||
else
|
||||
{
|
||||
Script.LootFilterBlocks.Add(newBlock);
|
||||
LootFilterBlockViewModels.Add(vm);
|
||||
}
|
||||
|
||||
_isDirty = true;
|
||||
}
|
||||
|
||||
private void OnAddBlockBelowCommand()
|
||||
{
|
||||
var vm = _lootFilterBlockViewModelFactory.Create();
|
||||
var newBlock = new LootFilterBlock();
|
||||
vm.Initialise(newBlock);
|
||||
|
||||
Script.LootFilterBlocks.Insert(Script.LootFilterBlocks.IndexOf(SelectedBlockViewModel.Block) + 1, newBlock);
|
||||
LootFilterBlockViewModels.Insert(LootFilterBlockViewModels.IndexOf(SelectedBlockViewModel) + 1, vm);
|
||||
_isDirty = true;
|
||||
}
|
||||
|
||||
private void OnAddSectionAboveCommand()
|
||||
{
|
||||
var vm = _lootFilterBlockViewModelFactory.Create();
|
||||
var newSection = new LootFilterSection { Description = "New Section" };
|
||||
vm.Initialise(newSection);
|
||||
|
||||
Script.LootFilterBlocks.Insert(Script.LootFilterBlocks.IndexOf(SelectedBlockViewModel.Block), newSection);
|
||||
LootFilterBlockViewModels.Insert(LootFilterBlockViewModels.IndexOf(SelectedBlockViewModel), vm);
|
||||
_isDirty = true;
|
||||
}
|
||||
|
||||
private void OnDeleteBlock()
|
||||
{
|
||||
var result = MessageBox.Show("Are you sure you wish to delete this block?", "Delete Confirmation",
|
||||
MessageBoxButton.YesNo, MessageBoxImage.Question);
|
||||
|
||||
if (result == MessageBoxResult.Yes)
|
||||
{
|
||||
Script.LootFilterBlocks.Remove(SelectedBlockViewModel.Block);
|
||||
LootFilterBlockViewModels.Remove(SelectedBlockViewModel);
|
||||
_isDirty = true;
|
||||
}
|
||||
SelectedBlockViewModel = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
244
Filtration/ViewModels/MainWindowViewModel.cs
Normal file
244
Filtration/ViewModels/MainWindowViewModel.cs
Normal file
@@ -0,0 +1,244 @@
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Windows.Forms;
|
||||
using Castle.Core;
|
||||
using Filtration.Models;
|
||||
using Filtration.Services;
|
||||
using Filtration.Translators;
|
||||
using GalaSoft.MvvmLight.CommandWpf;
|
||||
using Clipboard = System.Windows.Clipboard;
|
||||
using OpenFileDialog = Microsoft.Win32.OpenFileDialog;
|
||||
|
||||
namespace Filtration.ViewModels
|
||||
{
|
||||
internal class MainWindowViewModel : FiltrationViewModelBase, IMainWindowViewModel
|
||||
{
|
||||
private LootFilterScript _loadedScript;
|
||||
|
||||
private readonly ILootFilterScriptViewModelFactory _lootFilterScriptViewModelFactory;
|
||||
private readonly ILootFilterPersistenceService _persistenceService;
|
||||
private readonly ILootFilterScriptTranslator _lootFilterScriptTranslator;
|
||||
private ILootFilterScriptViewModel _currentScriptViewModel;
|
||||
private readonly ObservableCollection<ILootFilterScriptViewModel> _scriptViewModels;
|
||||
|
||||
public MainWindowViewModel(ILootFilterScriptViewModelFactory lootFilterScriptViewModelFactory,
|
||||
ILootFilterPersistenceService persistenceService, ILootFilterScriptTranslator lootFilterScriptTranslator)
|
||||
{
|
||||
_lootFilterScriptViewModelFactory = lootFilterScriptViewModelFactory;
|
||||
_persistenceService = persistenceService;
|
||||
_lootFilterScriptTranslator = lootFilterScriptTranslator;
|
||||
|
||||
_scriptViewModels = new ObservableCollection<ILootFilterScriptViewModel>();
|
||||
|
||||
OpenScriptCommand = new RelayCommand(OnOpenScriptCommand);
|
||||
SaveScriptCommand = new RelayCommand(OnSaveScriptCommand, () => CurrentScriptViewModel != null);
|
||||
SaveScriptAsCommand = new RelayCommand(OnSaveScriptAsCommand, () => CurrentScriptViewModel != null);
|
||||
CopyScriptCommand = new RelayCommand(OnCopyScriptCommand, () => CurrentScriptViewModel != null);
|
||||
NewScriptCommand = new RelayCommand(OnNewScriptCommand);
|
||||
CloseScriptCommand = new RelayCommand<ILootFilterScriptViewModel>(OnCloseScriptCommand, v => CurrentScriptViewModel != null);
|
||||
|
||||
LoadScriptFromFile("C:\\ThioleLootFilter.txt");
|
||||
|
||||
SetLootFilterScriptDirectory();
|
||||
}
|
||||
|
||||
public RelayCommand OpenScriptCommand { get; private set; }
|
||||
public RelayCommand SaveScriptCommand { get; private set; }
|
||||
public RelayCommand SaveScriptAsCommand { get; private set; }
|
||||
public RelayCommand CopyScriptCommand { get; private set; }
|
||||
public RelayCommand NewScriptCommand { get; private set; }
|
||||
public RelayCommand<ILootFilterScriptViewModel> CloseScriptCommand { get; private set; }
|
||||
|
||||
public ObservableCollection<ILootFilterScriptViewModel> ScriptViewModels
|
||||
{
|
||||
get { return _scriptViewModels; }
|
||||
}
|
||||
|
||||
[DoNotWire]
|
||||
public ILootFilterScriptViewModel CurrentScriptViewModel
|
||||
{
|
||||
get { return _currentScriptViewModel; }
|
||||
set
|
||||
{
|
||||
_currentScriptViewModel = value;
|
||||
RaisePropertyChanged();
|
||||
SaveScriptCommand.RaiseCanExecuteChanged();
|
||||
SaveScriptAsCommand.RaiseCanExecuteChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnOpenScriptCommand()
|
||||
{
|
||||
var openFileDialog = new OpenFileDialog
|
||||
{
|
||||
Filter = "Filter Files (*.filter)|*.filter|All Files (*.*)|*.*",
|
||||
InitialDirectory = _persistenceService.LootFilterScriptDirectory
|
||||
};
|
||||
|
||||
if (openFileDialog.ShowDialog() != true) return;
|
||||
|
||||
LoadScriptFromFile(openFileDialog.FileName);
|
||||
}
|
||||
|
||||
private void LoadScriptFromFile(string path)
|
||||
{
|
||||
try
|
||||
{
|
||||
_loadedScript = _persistenceService.LoadLootFilterScript(path);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
MessageBox.Show(@"Error loading filter script - " + e.Message, @"Script Load Error", MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
var newViewModel = _lootFilterScriptViewModelFactory.Create();
|
||||
newViewModel.Initialise(_loadedScript);
|
||||
ScriptViewModels.Add(newViewModel);
|
||||
CurrentScriptViewModel = newViewModel;
|
||||
}
|
||||
|
||||
private void SetLootFilterScriptDirectory()
|
||||
{
|
||||
var defaultDir = _persistenceService.DefaultPathOfExileDirectory();
|
||||
if (!string.IsNullOrEmpty(defaultDir))
|
||||
{
|
||||
_persistenceService.LootFilterScriptDirectory = defaultDir;
|
||||
}
|
||||
else
|
||||
{
|
||||
var dlg = new FolderBrowserDialog
|
||||
{
|
||||
Description = @"Select your Path of Exile data directory, usually in Documents\My Games",
|
||||
ShowNewFolderButton = false
|
||||
};
|
||||
var result = dlg.ShowDialog();
|
||||
|
||||
if (result == DialogResult.OK)
|
||||
{
|
||||
_persistenceService.LootFilterScriptDirectory = dlg.SelectedPath;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnSaveScriptCommand()
|
||||
{
|
||||
if (!ValidateScript()) return;
|
||||
|
||||
if (string.IsNullOrEmpty(CurrentScriptViewModel.Script.FilePath))
|
||||
{
|
||||
OnSaveScriptAsCommand();
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
_persistenceService.SaveLootFilterScript(CurrentScriptViewModel.Script);
|
||||
CurrentScriptViewModel.RemoveDirtyFlag();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
MessageBox.Show(@"Error saving filter file - " + e.Message, @"Save Error", MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void OnSaveScriptAsCommand()
|
||||
{
|
||||
if (!ValidateScript()) return;
|
||||
|
||||
var saveDialog = new SaveFileDialog
|
||||
{
|
||||
DefaultExt = ".filter",
|
||||
Filter = @"Filter Files (*.filter)|*.filter|All Files (*.*)|*.*",
|
||||
InitialDirectory = _persistenceService.LootFilterScriptDirectory
|
||||
};
|
||||
|
||||
var result = saveDialog.ShowDialog();
|
||||
|
||||
if (result != DialogResult.OK) return;
|
||||
|
||||
var previousFilePath = CurrentScriptViewModel.Script.FilePath;
|
||||
try
|
||||
{
|
||||
CurrentScriptViewModel.Script.FilePath = saveDialog.FileName;
|
||||
_persistenceService.SaveLootFilterScript(CurrentScriptViewModel.Script);
|
||||
CurrentScriptViewModel.RemoveDirtyFlag();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
MessageBox.Show(@"Error saving filter file - " + e.Message, @"Save Error", MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Error);
|
||||
CurrentScriptViewModel.Script.FilePath = previousFilePath;
|
||||
}
|
||||
}
|
||||
|
||||
private bool ValidateScript()
|
||||
{
|
||||
var result = CurrentScriptViewModel.Script.Validate();
|
||||
|
||||
if (result.Count == 0) return true;
|
||||
|
||||
var failures = string.Empty;
|
||||
|
||||
// ReSharper disable once LoopCanBeConvertedToQuery
|
||||
foreach (string failure in result)
|
||||
{
|
||||
failures += failure + Environment.NewLine;
|
||||
}
|
||||
|
||||
MessageBox.Show(@"The following script validation errors occurred:" + Environment.NewLine + failures,
|
||||
@"Script Validation Failure", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||
return false;
|
||||
}
|
||||
|
||||
private void OnCopyScriptCommand()
|
||||
{
|
||||
Clipboard.SetText(_lootFilterScriptTranslator.TranslateLootFilterScriptToString(_loadedScript));
|
||||
}
|
||||
|
||||
private void OnNewScriptCommand()
|
||||
{
|
||||
var newScript = new LootFilterScript();
|
||||
var newViewModel = _lootFilterScriptViewModelFactory.Create();
|
||||
newViewModel.Initialise(newScript);
|
||||
newViewModel.Description = "New Script";
|
||||
ScriptViewModels.Add(newViewModel);
|
||||
CurrentScriptViewModel = newViewModel;
|
||||
}
|
||||
|
||||
private void OnCloseScriptCommand(ILootFilterScriptViewModel scriptViewModel)
|
||||
{
|
||||
CurrentScriptViewModel = scriptViewModel;
|
||||
if (!CurrentScriptViewModel.IsDirty)
|
||||
{
|
||||
ScriptViewModels.Remove(CurrentScriptViewModel);
|
||||
}
|
||||
else
|
||||
{
|
||||
var result = MessageBox.Show(@"Want to save your changes to this script?",
|
||||
@"Filtration", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
|
||||
switch (result)
|
||||
{
|
||||
case DialogResult.Yes:
|
||||
{
|
||||
OnSaveScriptCommand();
|
||||
ScriptViewModels.Remove(CurrentScriptViewModel);
|
||||
break;
|
||||
}
|
||||
case DialogResult.No:
|
||||
{
|
||||
ScriptViewModels.Remove(CurrentScriptViewModel);
|
||||
break;
|
||||
}
|
||||
case DialogResult.Cancel:
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
26
Filtration/Views/BlockTemplateSelector.cs
Normal file
26
Filtration/Views/BlockTemplateSelector.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using Filtration.Models;
|
||||
using Filtration.ViewModels;
|
||||
|
||||
namespace Filtration.Views
|
||||
{
|
||||
public class BlockTemplateSelector : DataTemplateSelector
|
||||
{
|
||||
public override DataTemplate SelectTemplate(object item, DependencyObject container)
|
||||
{
|
||||
var viewModel = item as LootFilterBlockViewModel;
|
||||
var element = container as FrameworkElement;
|
||||
|
||||
if (viewModel == null || element == null)
|
||||
return null;
|
||||
|
||||
if (viewModel.Block is LootFilterSection)
|
||||
{
|
||||
return element.FindResource("LootFilterSectionTemplate") as DataTemplate;
|
||||
}
|
||||
|
||||
return element.FindResource("LootFilterBlockTemplate") as DataTemplate;
|
||||
}
|
||||
}
|
||||
}
|
||||
67
Filtration/Views/CrossButton.xaml
Normal file
67
Filtration/Views/CrossButton.xaml
Normal file
@@ -0,0 +1,67 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:Filtration.UserControls">
|
||||
<Style TargetType="{x:Type local:CrossButton}">
|
||||
<Style.Resources>
|
||||
<SolidColorBrush x:Key="NormalBackgroundBrush" Color="#00000000" />
|
||||
<SolidColorBrush x:Key="NormalBorderBrush" Color="#FFFFFFFF" />
|
||||
<SolidColorBrush x:Key="NormalForegroundBrush" Color="#FF8f949b" />
|
||||
|
||||
<SolidColorBrush x:Key="HoverBackgroundBrush" Color="#FFc13535" />
|
||||
<SolidColorBrush x:Key="HoverForegroundBrush" Color="#FFf9ebeb" />
|
||||
|
||||
<SolidColorBrush x:Key="PressedBackgroundBrush" Color="#FF431e20" />
|
||||
<SolidColorBrush x:Key="PressedBorderBrush" Color="#FF110033" />
|
||||
<SolidColorBrush x:Key="PressedForegroundBrush" Color="#FFf9ebeb" />
|
||||
</Style.Resources>
|
||||
<Setter Property="Cursor" Value="Hand" />
|
||||
<Setter Property="Focusable" Value="False" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type Button}">
|
||||
<Grid Background="Transparent">
|
||||
<!-- The background of the button, as an ellipse. -->
|
||||
<Ellipse x:Name="backgroundEllipse" />
|
||||
<!-- A path that renders a cross. -->
|
||||
<Path x:Name="ButtonPath"
|
||||
Margin="3"
|
||||
Stroke="{StaticResource NormalForegroundBrush}"
|
||||
StrokeThickness="1.5"
|
||||
StrokeStartLineCap="Square"
|
||||
StrokeEndLineCap="Square"
|
||||
Stretch="Uniform"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Center">
|
||||
<Path.Data>
|
||||
<PathGeometry>
|
||||
<PathGeometry.Figures>
|
||||
<PathFigure StartPoint="0,0">
|
||||
<LineSegment Point="25,25"/>
|
||||
</PathFigure>
|
||||
<PathFigure StartPoint="0,25">
|
||||
<LineSegment Point="25,0"/>
|
||||
</PathFigure>
|
||||
</PathGeometry.Figures>
|
||||
</PathGeometry>
|
||||
</Path.Data>
|
||||
</Path>
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter TargetName="backgroundEllipse" Property="Fill" Value="{StaticResource HoverBackgroundBrush}" />
|
||||
<Setter TargetName="ButtonPath" Property="Stroke" Value="{StaticResource HoverForegroundBrush}"/>
|
||||
</Trigger>
|
||||
<!--<Trigger Property="IsEnabled" Value="false">
|
||||
<Setter Property="Visibility" Value="Collapsed"/>
|
||||
</Trigger>-->
|
||||
<Trigger Property="IsPressed" Value="true">
|
||||
<Setter TargetName="backgroundEllipse" Property="Fill" Value="{StaticResource PressedBackgroundBrush}" />
|
||||
<Setter TargetName="backgroundEllipse" Property="Stroke" Value="{StaticResource PressedBorderBrush}" />
|
||||
<Setter TargetName="ButtonPath" Property="Stroke" Value="{StaticResource PressedForegroundBrush}"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
230
Filtration/Views/ExpanderStyle.xaml
Normal file
230
Filtration/Views/ExpanderStyle.xaml
Normal file
@@ -0,0 +1,230 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<Style x:Key="ExpanderRightHeaderStyle" TargetType="{x:Type ToggleButton}">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type ToggleButton}">
|
||||
<Border Padding="{TemplateBinding Padding}">
|
||||
<Grid Background="Transparent" SnapsToDevicePixels="False">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="19"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid>
|
||||
<Grid.LayoutTransform>
|
||||
<TransformGroup>
|
||||
<TransformGroup.Children>
|
||||
<TransformCollection>
|
||||
<RotateTransform Angle="-90"/>
|
||||
</TransformCollection>
|
||||
</TransformGroup.Children>
|
||||
</TransformGroup>
|
||||
</Grid.LayoutTransform>
|
||||
<Ellipse x:Name="circle" HorizontalAlignment="Center" Height="19" Stroke="DarkGray" VerticalAlignment="Center" Width="19"/>
|
||||
<Path x:Name="arrow" Data="M 1,1.5 L 4.5,5 L 8,1.5" HorizontalAlignment="Center" SnapsToDevicePixels="false" Stroke="#666" StrokeThickness="2" VerticalAlignment="Center"/>
|
||||
</Grid>
|
||||
<ContentPresenter HorizontalAlignment="Center" Margin="0,4,0,0" Grid.Row="1" RecognizesAccessKey="True" SnapsToDevicePixels="True" VerticalAlignment="Top"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsChecked" Value="true">
|
||||
<Setter Property="Data" TargetName="arrow" Value="M 1,4.5 L 4.5,1 L 8,4.5"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsMouseOver" Value="true">
|
||||
<Setter Property="Stroke" TargetName="circle" Value="#FF3C7FB1"/>
|
||||
<Setter Property="Stroke" TargetName="arrow" Value="#222"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsPressed" Value="true">
|
||||
<Setter Property="Stroke" TargetName="circle" Value="#FF526C7B"/>
|
||||
<Setter Property="StrokeThickness" TargetName="circle" Value="1.5"/>
|
||||
<Setter Property="Stroke" TargetName="arrow" Value="#FF003366"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
<Style x:Key="ExpanderUpHeaderStyle" TargetType="{x:Type ToggleButton}">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type ToggleButton}">
|
||||
<Border Padding="{TemplateBinding Padding}">
|
||||
<Grid Background="Transparent" SnapsToDevicePixels="False">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="19"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid>
|
||||
<Grid.LayoutTransform>
|
||||
<TransformGroup>
|
||||
<TransformGroup.Children>
|
||||
<TransformCollection>
|
||||
<RotateTransform Angle="180"/>
|
||||
</TransformCollection>
|
||||
</TransformGroup.Children>
|
||||
</TransformGroup>
|
||||
</Grid.LayoutTransform>
|
||||
<Ellipse x:Name="circle" HorizontalAlignment="Center" Height="19" Stroke="DarkGray" VerticalAlignment="Center" Width="19"/>
|
||||
<Path x:Name="arrow" Data="M 1,1.5 L 4.5,5 L 8,1.5" HorizontalAlignment="Center" SnapsToDevicePixels="false" Stroke="#666" StrokeThickness="2" VerticalAlignment="Center"/>
|
||||
</Grid>
|
||||
<ContentPresenter Grid.Column="1" HorizontalAlignment="Left" Margin="4,0,0,0" RecognizesAccessKey="True" SnapsToDevicePixels="True" VerticalAlignment="Center"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsChecked" Value="true">
|
||||
<Setter Property="Data" TargetName="arrow" Value="M 1,4.5 L 4.5,1 L 8,4.5"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsMouseOver" Value="true">
|
||||
<Setter Property="Stroke" TargetName="circle" Value="#FF3C7FB1"/>
|
||||
<Setter Property="Stroke" TargetName="arrow" Value="#222"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsPressed" Value="true">
|
||||
<Setter Property="Stroke" TargetName="circle" Value="#FF526C7B"/>
|
||||
<Setter Property="StrokeThickness" TargetName="circle" Value="1.5"/>
|
||||
<Setter Property="Stroke" TargetName="arrow" Value="#FF003366"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
<Style x:Key="ExpanderLeftHeaderStyle" TargetType="{x:Type ToggleButton}">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type ToggleButton}">
|
||||
<Border Padding="{TemplateBinding Padding}">
|
||||
<Grid Background="Transparent" SnapsToDevicePixels="False">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="19"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid>
|
||||
<Grid.LayoutTransform>
|
||||
<TransformGroup>
|
||||
<TransformGroup.Children>
|
||||
<TransformCollection>
|
||||
<RotateTransform Angle="90"/>
|
||||
</TransformCollection>
|
||||
</TransformGroup.Children>
|
||||
</TransformGroup>
|
||||
</Grid.LayoutTransform>
|
||||
<Ellipse x:Name="circle" HorizontalAlignment="Center" Height="19" Stroke="DarkGray" VerticalAlignment="Center" Width="19"/>
|
||||
<Path x:Name="arrow" Data="M 1,1.5 L 4.5,5 L 8,1.5" HorizontalAlignment="Center" SnapsToDevicePixels="false" Stroke="#666" StrokeThickness="2" VerticalAlignment="Center"/>
|
||||
</Grid>
|
||||
<ContentPresenter HorizontalAlignment="Center" Margin="0,4,0,0" Grid.Row="1" RecognizesAccessKey="True" SnapsToDevicePixels="True" VerticalAlignment="Top"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsChecked" Value="true">
|
||||
<Setter Property="Data" TargetName="arrow" Value="M 1,4.5 L 4.5,1 L 8,4.5"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsMouseOver" Value="true">
|
||||
<Setter Property="Stroke" TargetName="circle" Value="#FF3C7FB1"/>
|
||||
<Setter Property="Stroke" TargetName="arrow" Value="#222"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsPressed" Value="true">
|
||||
<Setter Property="Stroke" TargetName="circle" Value="#FF526C7B"/>
|
||||
<Setter Property="StrokeThickness" TargetName="circle" Value="1.5"/>
|
||||
<Setter Property="Stroke" TargetName="arrow" Value="#FF003366"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
<Style x:Key="ExpanderHeaderFocusVisual">
|
||||
<Setter Property="Control.Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate>
|
||||
<Border>
|
||||
<Rectangle Margin="0" SnapsToDevicePixels="true" Stroke="Black" StrokeThickness="1" StrokeDashArray="1 2"/>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
<Style x:Key="ExpanderDownHeaderStyle" TargetType="{x:Type ToggleButton}">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type ToggleButton}">
|
||||
<Border Padding="{TemplateBinding Padding}">
|
||||
<Grid Background="Transparent" SnapsToDevicePixels="False">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="19"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Ellipse x:Name="circle" HorizontalAlignment="Center" Height="19" Stroke="DarkGray" VerticalAlignment="Center" Width="19"/>
|
||||
<Path x:Name="arrow" Data="M 1,1.5 L 4.5,5 L 8,1.5" HorizontalAlignment="Center" SnapsToDevicePixels="false" Stroke="#666" StrokeThickness="2" VerticalAlignment="Center"/>
|
||||
<ContentPresenter Grid.Column="1" HorizontalAlignment="Stretch" Margin="4,0,0,0" RecognizesAccessKey="True" SnapsToDevicePixels="True" VerticalAlignment="Center"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsChecked" Value="true">
|
||||
<Setter Property="Data" TargetName="arrow" Value="M 1,4.5 L 4.5,1 L 8,4.5"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsMouseOver" Value="true">
|
||||
<Setter Property="Stroke" TargetName="circle" Value="#FF3C7FB1"/>
|
||||
<Setter Property="Stroke" TargetName="arrow" Value="#222"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsPressed" Value="true">
|
||||
<Setter Property="Stroke" TargetName="circle" Value="#FF526C7B"/>
|
||||
<Setter Property="StrokeThickness" TargetName="circle" Value="1.5"/>
|
||||
<Setter Property="Stroke" TargetName="arrow" Value="#FF003366"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
<Style x:Key="ExpanderRightAlignStyle" TargetType="{x:Type Expander}">
|
||||
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
|
||||
<Setter Property="VerticalContentAlignment" Value="Stretch"/>
|
||||
<Setter Property="BorderBrush" Value="Transparent"/>
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type Expander}">
|
||||
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" CornerRadius="3" SnapsToDevicePixels="true">
|
||||
<DockPanel>
|
||||
<!--<ToggleButton x:Name="HeaderSite" ContentTemplate="{TemplateBinding HeaderTemplate}" ContentTemplateSelector="{TemplateBinding HeaderTemplateSelector}" Content="{TemplateBinding Header}" DockPanel.Dock="Top" Foreground="{TemplateBinding Foreground}" FontWeight="{TemplateBinding FontWeight}" FocusVisualStyle="{StaticResource ExpanderHeaderFocusVisual}" FontStyle="{TemplateBinding FontStyle}" FontStretch="{TemplateBinding FontStretch}" FontSize="{TemplateBinding FontSize}" FontFamily="{TemplateBinding FontFamily}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" IsChecked="{Binding IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Margin="1" MinWidth="0" MinHeight="0" Padding="{TemplateBinding Padding}" Style="{StaticResource ExpanderDownHeaderStyle}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>-->
|
||||
<Grid DockPanel.Dock="Top">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<ToggleButton Grid.Column="0" x:Name="HeaderSite" ContentTemplate="{TemplateBinding HeaderTemplate}" ContentTemplateSelector="{TemplateBinding HeaderTemplateSelector}" Foreground="{TemplateBinding Foreground}" FontWeight="{TemplateBinding FontWeight}" FocusVisualStyle="{StaticResource ExpanderHeaderFocusVisual}" FontStyle="{TemplateBinding FontStyle}" FontStretch="{TemplateBinding FontStretch}" FontSize="{TemplateBinding FontSize}" FontFamily="{TemplateBinding FontFamily}" IsChecked="{Binding IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Margin="1" MinWidth="0" MinHeight="0" Padding="{TemplateBinding Padding}" Style="{StaticResource ExpanderDownHeaderStyle}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>
|
||||
<ContentPresenter Grid.Column="1" Content="{TemplateBinding Header}" HorizontalAlignment="Stretch" />
|
||||
</Grid>
|
||||
<ContentPresenter x:Name="ExpandSite" DockPanel.Dock="Bottom" Focusable="false" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" Visibility="Collapsed" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
|
||||
</DockPanel>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsExpanded" Value="true">
|
||||
<Setter Property="Visibility" TargetName="ExpandSite" Value="Visible"/>
|
||||
</Trigger>
|
||||
<Trigger Property="ExpandDirection" Value="Right">
|
||||
<Setter Property="DockPanel.Dock" TargetName="ExpandSite" Value="Right"/>
|
||||
<Setter Property="DockPanel.Dock" TargetName="HeaderSite" Value="Left"/>
|
||||
<Setter Property="Style" TargetName="HeaderSite" Value="{StaticResource ExpanderRightHeaderStyle}"/>
|
||||
</Trigger>
|
||||
<Trigger Property="ExpandDirection" Value="Up">
|
||||
<Setter Property="DockPanel.Dock" TargetName="ExpandSite" Value="Top"/>
|
||||
<Setter Property="DockPanel.Dock" TargetName="HeaderSite" Value="Bottom"/>
|
||||
<Setter Property="Style" TargetName="HeaderSite" Value="{StaticResource ExpanderUpHeaderStyle}"/>
|
||||
</Trigger>
|
||||
<Trigger Property="ExpandDirection" Value="Left">
|
||||
<Setter Property="DockPanel.Dock" TargetName="ExpandSite" Value="Left"/>
|
||||
<Setter Property="DockPanel.Dock" TargetName="HeaderSite" Value="Right"/>
|
||||
<Setter Property="Style" TargetName="HeaderSite" Value="{StaticResource ExpanderLeftHeaderStyle}"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="false">
|
||||
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
7
Filtration/Views/IMainWindow.cs
Normal file
7
Filtration/Views/IMainWindow.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace Filtration.Views
|
||||
{
|
||||
public interface IMainWindow
|
||||
{
|
||||
void Show();
|
||||
}
|
||||
}
|
||||
108
Filtration/Views/LootFilterBlockDisplaySettingsView.xaml
Normal file
108
Filtration/Views/LootFilterBlockDisplaySettingsView.xaml
Normal file
@@ -0,0 +1,108 @@
|
||||
<UserControl x:Class="Filtration.Views.LootFilterBlockDisplaySettingsView"
|
||||
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:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
|
||||
xmlns:fa="http://schemas.fontawesome.io/icons/"
|
||||
xmlns:userControls="clr-namespace:Filtration.UserControls"
|
||||
xmlns:viewModels="clr-namespace:Filtration.ViewModels"
|
||||
xmlns:blockItemBaseTypes="clr-namespace:Filtration.Models.BlockItemBaseTypes"
|
||||
xmlns:blockItemTypes="clr-namespace:Filtration.Models.BlockItemTypes"
|
||||
xmlns:componentModel="clr-namespace:System.ComponentModel;assembly=WindowsBase"
|
||||
mc:Ignorable="d"
|
||||
d:DataContext="{d:DesignInstance Type=viewModels:LootFilterBlockViewModel}"
|
||||
d:DesignHeight="120" d:DesignWidth="175">
|
||||
<UserControl.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="LootFilterBlockViewDictionary.xaml" />
|
||||
<ResourceDictionary>
|
||||
<CollectionViewSource x:Key="AudioVisualBlockItemsViewSource" Source="{Binding AudioVisualBlockItems}">
|
||||
<CollectionViewSource.SortDescriptions>
|
||||
<componentModel:SortDescription PropertyName="SortOrder" />
|
||||
</CollectionViewSource.SortDescriptions>
|
||||
</CollectionViewSource>
|
||||
</ResourceDictionary>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</UserControl.Resources>
|
||||
<Border BorderThickness="2" CornerRadius="4" BorderBrush="Black" Padding="4" Background="White">
|
||||
<Grid Background="White" Name="SettingsGrid">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<ItemsControl ItemsSource="{Binding AudioVisualBlockItemTypesAvailable}" Grid.Row="0" Margin="0,0,0,5">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<WrapPanel></WrapPanel>
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Margin="0,0,3,0">
|
||||
<Hyperlink Command="{Binding ElementName=SettingsGrid, Path=DataContext.AddAudioVisualBlockItemCommand}" CommandParameter="{Binding}">
|
||||
<TextBlock>+</TextBlock><TextBlock Text="{Binding Path=., Converter={StaticResource BlockItemTypeToStringConverter}}" />
|
||||
</Hyperlink>
|
||||
</TextBlock>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
<ItemsControl Grid.Row="1" ItemsSource="{Binding Source={StaticResource AudioVisualBlockItemsViewSource}}" Grid.IsSharedSizeScope="True">
|
||||
<ItemsControl.Resources>
|
||||
<Style TargetType="{x:Type TextBlock}" x:Key="DisplayHeading">
|
||||
<Setter Property="Margin" Value="0,0,5,0" />
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
</Style>
|
||||
<DataTemplate DataType="{x:Type blockItemBaseTypes:ColorBlockItem}">
|
||||
<Grid Margin="0,0,0,2">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition SharedSizeGroup="AudioVisualBlockItemTitleColumn" Width="*" />
|
||||
<ColumnDefinition SharedSizeGroup="AudioVisualBlockItemValueColumn" Width="Auto" />
|
||||
<ColumnDefinition SharedSizeGroup="AudioVisualBlockItemCloseColumn" Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Grid.Column="0" Text="{Binding DisplayHeading}" Style="{StaticResource DisplayHeading}" />
|
||||
<xctk:ColorPicker Grid.Column="1" SelectedColor="{Binding Color}" HorizontalAlignment="Right" Width="100" />
|
||||
<userControls:CrossButton Grid.Column="2" Height="12" Command="{Binding ElementName=SettingsGrid, Path=DataContext.RemoveAudioVisualBlockItemCommand}" CommandParameter="{Binding}" />
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="{x:Type blockItemBaseTypes:IntegerBlockItem}">
|
||||
<Grid Margin="0,0,0,2">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition SharedSizeGroup="AudioVisualBlockItemTitleColumn" Width="*" />
|
||||
<ColumnDefinition SharedSizeGroup="AudioVisualBlockItemValueColumn" Width="Auto" />
|
||||
<ColumnDefinition SharedSizeGroup="AudioVisualBlockItemCloseColumn" Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Grid.Column="0" Text="{Binding DisplayHeading}" Style="{StaticResource DisplayHeading}" />
|
||||
<xctk:ShortUpDown Grid.Column="1" Value="{Binding Value}" Minimum="{Binding Minimum}" Maximum="{Binding Maximum}" Width="50" HorizontalAlignment="Right"/>
|
||||
<userControls:CrossButton Grid.Column="2" Height="12" Command="{Binding ElementName=SettingsGrid, Path=DataContext.RemoveAudioVisualBlockItemCommand}" CommandParameter="{Binding}" />
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="{x:Type blockItemTypes:SoundBlockItem}">
|
||||
<Grid Margin="0,0,0,2">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition SharedSizeGroup="AudioVisualBlockItemTitleColumn" Width="*" />
|
||||
<ColumnDefinition SharedSizeGroup="AudioVisualBlockItemValueColumn" Width="Auto" />
|
||||
<ColumnDefinition SharedSizeGroup="AudioVisualBlockItemCloseColumn" Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Grid.Column="0" Text="{Binding DisplayHeading}" Style="{StaticResource DisplayHeading}" />
|
||||
<WrapPanel Grid.Column="1" Grid.Row="0" HorizontalAlignment="Right">
|
||||
<Button Command="{Binding ElementName=SettingsGrid, Path=DataContext.PlaySoundCommand}" Width="20" Height="20" Padding="3" Background="Transparent" BorderBrush="Transparent">
|
||||
<fa:ImageAwesome Icon="PlayCircle" VerticalAlignment="Center" HorizontalAlignment="Center" />
|
||||
</Button>
|
||||
<ComboBox ItemsSource="{Binding ElementName=SettingsGrid, Path=DataContext.SoundsAvailable}" SelectedValue="{Binding Value}" />
|
||||
<xctk:ShortUpDown Value="{Binding Path=SecondValue}" Minimum="1" Maximum="100" HorizontalAlignment="Right" ToolTip="Volume"/>
|
||||
</WrapPanel>
|
||||
<userControls:CrossButton Grid.Column="2" Grid.Row="0" Height="12" Command="{Binding ElementName=SettingsGrid, Path=DataContext.RemoveAudioVisualBlockItemCommand}" CommandParameter="{Binding}" />
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ItemsControl.Resources>
|
||||
</ItemsControl>
|
||||
</Grid>
|
||||
</Border>
|
||||
</UserControl>
|
||||
10
Filtration/Views/LootFilterBlockDisplaySettingsView.xaml.cs
Normal file
10
Filtration/Views/LootFilterBlockDisplaySettingsView.xaml.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
namespace Filtration.Views
|
||||
{
|
||||
public partial class LootFilterBlockDisplaySettingsView
|
||||
{
|
||||
public LootFilterBlockDisplaySettingsView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
284
Filtration/Views/LootFilterBlockView.xaml
Normal file
284
Filtration/Views/LootFilterBlockView.xaml
Normal file
@@ -0,0 +1,284 @@
|
||||
<UserControl x:Class="Filtration.Views.LootFilterBlockView"
|
||||
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:viewModels="clr-namespace:Filtration.ViewModels"
|
||||
xmlns:userControls="clr-namespace:Filtration.UserControls"
|
||||
xmlns:views="clr-namespace:Filtration.Views"
|
||||
xmlns:blockItemBaseTypes="clr-namespace:Filtration.Models.BlockItemBaseTypes"
|
||||
xmlns:blockItemTypes="clr-namespace:Filtration.Models.BlockItemTypes"
|
||||
xmlns:fa="http://schemas.fontawesome.io/icons/"
|
||||
xmlns:enums="clr-namespace:Filtration.Enums"
|
||||
xmlns:extensions="clr-namespace:Filtration.Extensions"
|
||||
mc:Ignorable="d"
|
||||
d:DataContext="{d:DesignInstance Type=viewModels:LootFilterBlockViewModel}"
|
||||
d:DesignHeight="200" d:DesignWidth="800">
|
||||
<UserControl.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="LootFilterBlockViewDictionary.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</UserControl.Resources>
|
||||
<Grid x:Name="TopLevelGrid">
|
||||
<Border BorderThickness="1" BorderBrush="SlateGray" CornerRadius="2">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Rectangle Width="7" >
|
||||
<Rectangle.Fill>
|
||||
<SolidColorBrush Color="Gray"></SolidColorBrush>
|
||||
<!--<DrawingBrush Viewbox="0,0,5,4" TileMode="Tile">
|
||||
<DrawingBrush.Drawing>
|
||||
<GeometryDrawing Brush="#FF9D9D9D">
|
||||
<GeometryDrawing.Geometry>
|
||||
<GeometryGroup>
|
||||
<RectangleGeometry Rect="0,0,1,1" />
|
||||
<RectangleGeometry Rect="4,0,1,1" />
|
||||
<RectangleGeometry Rect="2,2,1,1" />
|
||||
</GeometryGroup>
|
||||
</GeometryDrawing.Geometry>
|
||||
</GeometryDrawing>
|
||||
</DrawingBrush.Drawing>
|
||||
</DrawingBrush>-->
|
||||
</Rectangle.Fill>
|
||||
</Rectangle>
|
||||
<Expander Grid.Column="1" Style="{StaticResource ExpanderRightAlignStyle}" x:Name="TestExpander" ToolTip="{Binding BlockDescription}">
|
||||
<Expander.ContextMenu>
|
||||
<ContextMenu>
|
||||
<ContextMenu.Items>
|
||||
<MenuItem Header="Copy" Command="{Binding CopyBlockCommand}" />
|
||||
<Separator />
|
||||
</ContextMenu.Items>
|
||||
</ContextMenu>
|
||||
</Expander.ContextMenu>
|
||||
<Expander.Header>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Grid.Row="0" Grid.Column="0" VerticalAlignment="Center">
|
||||
<!-- BlockItems Summary Panel -->
|
||||
<ItemsControl ItemsSource="{Binding SummaryBlockItems}">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<WrapPanel />
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Border BorderBrush="Black" CornerRadius="4" Margin="0,2,2,2" BorderThickness="1" Background="{Binding SummaryBackgroundColor, Converter={StaticResource ColorToSolidColorBrushConverter}}">
|
||||
<TextBlock Text="{Binding SummaryText}" Margin="5,1,5,1" Foreground="{Binding SummaryTextColor, Converter={StaticResource ColorToSolidColorBrushConverter}}" />
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</StackPanel>
|
||||
|
||||
<!-- Item Preview Box -->
|
||||
<WrapPanel Grid.Row="0" Grid.Column="1" VerticalAlignment="Center">
|
||||
<fa:ImageAwesome Icon="VolumeUp" VerticalAlignment="Center" HorizontalAlignment="Center" Height="15" Width="15" Margin="0,0,3,0" Visibility="{Binding HasSound, Converter={StaticResource BooleanVisibilityConverter}}" />
|
||||
<ToggleButton Width="140"
|
||||
Height="25"
|
||||
Margin="0,0,8,0"
|
||||
Style="{StaticResource ChromelessToggleButton}"
|
||||
x:Name="ItemPreviewButton"
|
||||
IsChecked="{Binding DisplaySettingsPopupOpen, Mode=OneWayToSource}"
|
||||
ToolTip="Click here to change color and font settings" Cursor="Hand" >
|
||||
<Grid>
|
||||
<Image Source="pack://application:,,,/resources/groundtile.png" Stretch="Fill" />
|
||||
<Border Padding="4,2,4,2" BorderThickness="2" BorderBrush="{Binding DisplayBorderColor, Converter={StaticResource ColorToSolidColorBrushConverter}}">
|
||||
<Border.Background>
|
||||
<SolidColorBrush Color="{Binding DisplayBackgroundColor}" />
|
||||
</Border.Background>
|
||||
<TextBlock TextAlignment="Center" Text="Test Item Preview" Style="{StaticResource PathOfExileFont}">
|
||||
<TextBlock.Foreground>
|
||||
<SolidColorBrush Color="{Binding DisplayTextColor}" />
|
||||
</TextBlock.Foreground>
|
||||
</TextBlock>
|
||||
</Border>
|
||||
</Grid>
|
||||
</ToggleButton>
|
||||
</WrapPanel>
|
||||
|
||||
<!-- AudioVisual BlockItem Settings Popup -->
|
||||
<Popup Grid.Row="0"
|
||||
Grid.Column="1"
|
||||
PlacementTarget="{Binding ElementName=ItemPreviewButton}"
|
||||
Placement="Left"
|
||||
PopupAnimation="Slide"
|
||||
StaysOpen="False"
|
||||
IsOpen="{Binding DisplaySettingsPopupOpen}"
|
||||
AllowsTransparency="True"
|
||||
HorizontalOffset="-5"
|
||||
Width="250">
|
||||
<views:LootFilterBlockDisplaySettingsView />
|
||||
</Popup>
|
||||
</Grid>
|
||||
</Expander.Header>
|
||||
<Grid Margin="10,5,10,5">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<!-- Add Block Item Links -->
|
||||
<ItemsControl ItemsSource="{Binding BlockItemTypesAvailable}" Grid.Row="0" Margin="0,0,0,10">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<WrapPanel></WrapPanel>
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Margin="0,0,3,0">
|
||||
<Hyperlink Command="{Binding ElementName=TopLevelGrid, Path=DataContext.AddFilterBlockItemCommand}" CommandParameter="{Binding}">
|
||||
<TextBlock>+</TextBlock><TextBlock Text="{Binding Path=., Converter={StaticResource BlockItemTypeToStringConverter}}" />
|
||||
</Hyperlink>
|
||||
</TextBlock>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
<!-- Block Items -->
|
||||
<WrapPanel Grid.Row="1" MaxHeight="200">
|
||||
<ItemsControl ItemsSource="{Binding FilterBlockItems}">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<WrapPanel Orientation="Vertical" />
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
<ItemsControl.Resources>
|
||||
<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="Width" Value="142" />
|
||||
<Setter Property="Margin" Value="0,0,5,5" />
|
||||
</Style>
|
||||
<DataTemplate DataType="{x:Type blockItemBaseTypes:ActionBlockItem}">
|
||||
<Border Style="{StaticResource BlockItemBorder}">
|
||||
<WrapPanel VerticalAlignment="Center" Margin="5,5,5,5">
|
||||
<RadioButton IsChecked="{Binding Action, Converter={StaticResource BooleanToBlockActionConverter}}" Margin="0,0,10,0">Show</RadioButton>
|
||||
<RadioButton IsChecked="{Binding Action, Converter={StaticResource BooleanToBlockActionInverseConverter}}">Hide</RadioButton>
|
||||
</WrapPanel>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="{x:Type blockItemBaseTypes:NumericFilterPredicateBlockItem}">
|
||||
<Border Style="{StaticResource BlockItemBorder}">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<Border Background="PowderBlue" CornerRadius="3,3,0,0">
|
||||
<Grid Margin="3,0,3,0">
|
||||
<TextBlock Text="{Binding DisplayHeading}" Grid.Row="0" VerticalAlignment="Center" Foreground="Navy" />
|
||||
<userControls:CrossButton Grid.Row="0" Height="12" HorizontalAlignment="Right" VerticalAlignment="Center" Command="{Binding ElementName=TopLevelGrid, Path=DataContext.RemoveFilterBlockItemCommand}" CommandParameter="{Binding}"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
<userControls:NumericFilterPredicateControl Grid.Row="1" Grid.Column="0" Margin="5,5,5,5" NumericFilterPredicate="{Binding FilterPredicate}" Minimum="{Binding Minimum, Mode=OneTime}" Maximum="{Binding Maximum, Mode=OneTime}" />
|
||||
</Grid>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="{x:Type blockItemTypes:RarityBlockItem}">
|
||||
<Border Style="{StaticResource BlockItemBorder}">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Border Background="PowderBlue" CornerRadius="3,3,0,0">
|
||||
<Grid Margin="3,0,3,0">
|
||||
<TextBlock Text="{Binding DisplayHeading}" Grid.Row="0" VerticalAlignment="Center" Foreground="Navy" />
|
||||
<userControls:CrossButton Grid.Row="0" Height="12" HorizontalAlignment="Right" VerticalAlignment="Center" Command="{Binding ElementName=TopLevelGrid, Path=DataContext.RemoveFilterBlockItemCommand}" CommandParameter="{Binding}"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
<StackPanel Orientation="Horizontal" Grid.Row="1" Margin="5,5,5,5">
|
||||
<ComboBox ItemsSource="{Binding Source={extensions:Enumeration {x:Type enums:FilterPredicateOperator}}}"
|
||||
DisplayMemberPath="Description"
|
||||
SelectedValue="{Binding FilterPredicate.PredicateOperator}"
|
||||
SelectedValuePath="Value" Width="50" Margin="0,0,6,0" />
|
||||
<ComboBox ItemsSource="{Binding Source={extensions:Enumeration {x:Type enums:ItemRarity}}}"
|
||||
DisplayMemberPath="Description"
|
||||
SelectedValue="{Binding FilterPredicate.PredicateOperand, Converter={StaticResource IntToItemRarityConverter}}"
|
||||
SelectedValuePath="Value" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
<!-- TODO: Sort out these messy duplicated data templates -->
|
||||
<DataTemplate DataType="{x:Type blockItemTypes:ClassBlockItem}">
|
||||
<Border Style="{StaticResource BlockItemBorder}">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Border Background="PowderBlue" CornerRadius="3,3,0,0">
|
||||
<Grid Margin="3,0,3,0">
|
||||
<TextBlock Text="{Binding DisplayHeading}" Grid.Row="0" VerticalAlignment="Center" Foreground="Navy" />
|
||||
<userControls:CrossButton Grid.Row="0" Height="12" HorizontalAlignment="Right" VerticalAlignment="Center" Command="{Binding ElementName=TopLevelGrid, Path=DataContext.RemoveFilterBlockItemCommand}" CommandParameter="{Binding}"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
<userControls:EditableListBoxControl Grid.Row="1" Grid.Column="0" Margin="5,5,5,5" ItemsSource="{Binding Items}" AutoCompleteItemsSource="{Binding ElementName=TopLevelGrid, Path=DataContext.AutoCompleteItemClasses}" />
|
||||
</Grid>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="{x:Type blockItemTypes:BaseTypeBlockItem}">
|
||||
<Border Style="{StaticResource BlockItemBorder}">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Border Background="PowderBlue" CornerRadius="3,3,0,0">
|
||||
<Grid Margin="3,0,3,0">
|
||||
<TextBlock Text="{Binding DisplayHeading}" Grid.Row="0" VerticalAlignment="Center" Foreground="Navy" />
|
||||
<userControls:CrossButton Grid.Row="0" Height="12" HorizontalAlignment="Right" VerticalAlignment="Center" Command="{Binding ElementName=TopLevelGrid, Path=DataContext.RemoveFilterBlockItemCommand}" CommandParameter="{Binding}"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
<userControls:EditableListBoxControl Grid.Row="1" Grid.Column="0" Margin="5,5,5,5" ItemsSource="{Binding Items}" AutoCompleteItemsSource="{Binding ElementName=TopLevelGrid, Path=DataContext.AutoCompleteItemBaseTypes}" />
|
||||
</Grid>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="{x:Type blockItemTypes:SocketGroupBlockItem}">
|
||||
<Border Style="{StaticResource BlockItemBorder}">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Border Background="PowderBlue" CornerRadius="3,3,0,0">
|
||||
<Grid Margin="3,0,3,0">
|
||||
<TextBlock Text="{Binding DisplayHeading}" Grid.Row="0" VerticalAlignment="Center" Foreground="Navy" />
|
||||
<userControls:CrossButton Grid.Row="0" Height="12" HorizontalAlignment="Right" VerticalAlignment="Center" Command="{Binding ElementName=TopLevelGrid, Path=DataContext.RemoveFilterBlockItemCommand}" CommandParameter="{Binding}"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
<userControls:EditableListBoxControl Grid.Row="1" Grid.Column="0" Margin="5,5,5,5" ItemsSource="{Binding Items}" />
|
||||
</Grid>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="{x:Type blockItemBaseTypes:ColorBlockItem}" />
|
||||
<DataTemplate DataType="{x:Type blockItemTypes:SoundBlockItem}" />
|
||||
<DataTemplate DataType="{x:Type blockItemTypes:FontSizeBlockItem}" />
|
||||
</ItemsControl.Resources>
|
||||
</ItemsControl>
|
||||
</WrapPanel>
|
||||
<Grid Grid.Row="2" Margin="0,5,0,5">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Grid.Column="0" Margin="0,0,5,0" Text="Description:" VerticalAlignment="Center" />
|
||||
<TextBox Grid.Column="1" Text="{Binding BlockDescription}" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Expander>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
10
Filtration/Views/LootFilterBlockView.xaml.cs
Normal file
10
Filtration/Views/LootFilterBlockView.xaml.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
namespace Filtration.Views
|
||||
{
|
||||
public partial class LootFilterBlockView
|
||||
{
|
||||
public LootFilterBlockView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
35
Filtration/Views/LootFilterBlockViewDictionary.xaml
Normal file
35
Filtration/Views/LootFilterBlockViewDictionary.xaml
Normal file
@@ -0,0 +1,35 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:converters="clr-namespace:Filtration.Converters"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
mc:Ignorable="d" >
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary>
|
||||
<Style x:Key="PathOfExileFont">
|
||||
<Setter Property="TextElement.FontFamily" Value="pack://application:,,,/resources/#Fontin SmallCaps" />
|
||||
<Setter Property="TextElement.FontSize" Value="14" />
|
||||
</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>
|
||||
<converters:IntToItemRarityConverter x:Key="IntToItemRarityConverter" />
|
||||
<converters:StringToVisibilityConverter x:Key="StringToVisibilityConverter" />
|
||||
<converters:BoolInverterConverter x:Key="BoolInverterConverter" />
|
||||
<converters:ColorToSolidColorBrushConverter x:Key="ColorToSolidColorBrushConverter" />
|
||||
<converters:BooleanToBlockActionConverter x:Key="BooleanToBlockActionConverter" />
|
||||
<converters:BooleanToBlockActionInverseConverter x:Key="BooleanToBlockActionInverseConverter" />
|
||||
<converters:BlockItemTypeToStringConverter x:Key="BlockItemTypeToStringConverter" />
|
||||
<converters:BooleanVisibilityConverter x:Key="BooleanVisibilityConverter" />
|
||||
</ResourceDictionary>
|
||||
<ResourceDictionary Source="ExpanderStyle.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
122
Filtration/Views/LootFilterScriptView.xaml
Normal file
122
Filtration/Views/LootFilterScriptView.xaml
Normal file
@@ -0,0 +1,122 @@
|
||||
<UserControl x:Class="Filtration.Views.LootFilterScriptView"
|
||||
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:views="clr-namespace:Filtration.Views"
|
||||
xmlns:viewModels="clr-namespace:Filtration.ViewModels"
|
||||
xmlns:userControls="clr-namespace:Filtration.UserControls"
|
||||
xmlns:fa="http://schemas.fontawesome.io/icons/"
|
||||
mc:Ignorable="d"
|
||||
d:DataContext="{d:DesignInstance Type=viewModels:LootFilterScriptViewModel}"
|
||||
d:DesignHeight="300" d:DesignWidth="600">
|
||||
<UserControl.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary>
|
||||
<!-- ReSharper disable once Xaml.RedundantResource -->
|
||||
<DataTemplate x:Key="LootFilterBlockTemplate">
|
||||
<views:LootFilterBlockView Margin="0,2,0,2" />
|
||||
</DataTemplate>
|
||||
<!-- ReSharper disable once Xaml.RedundantResource -->
|
||||
<DataTemplate x:Key="LootFilterSectionTemplate">
|
||||
<views:LootFilterSectionView Margin="0,2,0,2" />
|
||||
</DataTemplate>
|
||||
<views:BlockTemplateSelector x:Key="BlockTemplateSelector" />
|
||||
</ResourceDictionary>
|
||||
<ResourceDictionary Source="ExpanderStyle.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</UserControl.Resources>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<Border Grid.Row="0" BorderThickness="2" BorderBrush="SlateGray" CornerRadius="4" Margin="5,5,5,0">
|
||||
<StackPanel Margin="2,2,2,2">
|
||||
<Expander Style="{StaticResource ExpanderRightAlignStyle}">
|
||||
<Expander.Header>
|
||||
<TextBlock Text="Script Description" VerticalAlignment="Center" />
|
||||
</Expander.Header>
|
||||
<Grid>
|
||||
<TextBox Text="{Binding Description, UpdateSourceTrigger=PropertyChanged}" Margin="5" MaxLines="20" />
|
||||
</Grid>
|
||||
</Expander>
|
||||
<!--<TextBlock Text="{Binding Filepath, StringFormat=Path: {0}}" />-->
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<Border Grid.Row="1" BorderThickness="2" BorderBrush="SlateGray" CornerRadius="4" Margin="5,5,5,5">
|
||||
<DockPanel>
|
||||
<ToolBarTray DockPanel.Dock="Top">
|
||||
<ToolBarTray.Resources>
|
||||
<Style TargetType="{x:Type fa:ImageAwesome}">
|
||||
<Style.Setters>
|
||||
<Setter Property="Width" Value="15" />
|
||||
<Setter Property="Height" Value="15" />
|
||||
</Style.Setters>
|
||||
</Style>
|
||||
</ToolBarTray.Resources>
|
||||
<ToolBar>
|
||||
<Button ToolTip="Add Block" Command="{Binding AddBlockAboveCommand}">
|
||||
<fa:ImageAwesome Icon="Plus" />
|
||||
</Button>
|
||||
<Button ToolTip="Add Section" Command="{Binding AddSectionAboveCommand}">
|
||||
<fa:ImageAwesome Icon="ListUl" />
|
||||
</Button>
|
||||
<Button ToolTip="Delete Block/Section" Command="{Binding DeleteBlockCommand}">
|
||||
<fa:ImageAwesome Icon="Minus" />
|
||||
</Button>
|
||||
</ToolBar>
|
||||
<ToolBar>
|
||||
<Button ToolTip="Move Block to Top" Command="{Binding MoveBlockToTopCommand}">
|
||||
<fa:ImageAwesome Icon="AngleDoubleUp" />
|
||||
</Button>
|
||||
<Button ToolTip="Move Block Up" Command="{Binding MoveBlockUpCommand}">
|
||||
<fa:ImageAwesome Icon="AngleUp" />
|
||||
</Button>
|
||||
<Button ToolTip="Move Block Down" Command="{Binding MoveBlockDownCommand}">
|
||||
<fa:ImageAwesome Icon="AngleDown" />
|
||||
</Button>
|
||||
<Button ToolTip="Move Block to Bottom" Command="{Binding MoveBlockToBottomCommand}">
|
||||
<fa:ImageAwesome Icon="AngleDoubleDown" />
|
||||
</Button>
|
||||
</ToolBar>
|
||||
</ToolBarTray>
|
||||
<userControls:AutoScrollingListBox ItemsSource="{Binding LootFilterBlockViewModels}"
|
||||
DockPanel.Dock="Bottom"
|
||||
Margin="5,5,5,5"
|
||||
HorizontalContentAlignment="Stretch"
|
||||
BorderThickness="0"
|
||||
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
|
||||
VirtualizingStackPanel.VirtualizationMode="Recycling"
|
||||
ItemTemplateSelector="{StaticResource BlockTemplateSelector}"
|
||||
SelectedItem="{Binding SelectedBlockViewModel}">
|
||||
<ListBox.ItemContainerStyle>
|
||||
<Style TargetType="ListBoxItem">
|
||||
<Setter Property="BorderBrush" Value="Red"/>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsSelected" Value="True">
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</ListBox.ItemContainerStyle>
|
||||
<ListBox.Resources>
|
||||
<Style TargetType="ListBoxItem">
|
||||
<Style.Resources>
|
||||
<!-- SelectedItem with focus -->
|
||||
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Transparent" />
|
||||
<!-- SelectedItem without focus -->
|
||||
<SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="Transparent" />
|
||||
<!-- SelectedItem text foreground -->
|
||||
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}" Color="Black" />
|
||||
</Style.Resources>
|
||||
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
|
||||
</Style>
|
||||
</ListBox.Resources>
|
||||
</userControls:AutoScrollingListBox>
|
||||
</DockPanel>
|
||||
</Border>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user