Block matching basics complete
This commit is contained in:
@@ -1,11 +1,19 @@
|
||||
using System.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows.Media;
|
||||
using Filtration.ObjectModel.BlockItemBaseTypes;
|
||||
using Filtration.ObjectModel.Enums;
|
||||
|
||||
namespace Filtration.ObjectModel.BlockItemTypes
|
||||
{
|
||||
public class SocketGroupBlockItem : StringListBlockItem
|
||||
{
|
||||
public SocketGroupBlockItem()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override string PrefixText => "SocketGroup";
|
||||
public override int MaximumAllowed => 1;
|
||||
public override string DisplayHeading => "Socket Group";
|
||||
@@ -17,8 +25,47 @@ namespace Filtration.ObjectModel.BlockItemTypes
|
||||
return "Socket Group " + summaryItemText.TrimStart(' ');
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerable<SocketGroup> SocketGroups
|
||||
{
|
||||
get
|
||||
{
|
||||
return
|
||||
Items.Select(socketGroup => socketGroup.Select(socketChar => new Socket(StringToSocketColor(socketChar))).ToList())
|
||||
.Select(socketList => new SocketGroup(socketList, true))
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
|
||||
public override Color SummaryBackgroundColor => Colors.GhostWhite;
|
||||
public override Color SummaryTextColor => Colors.Black;
|
||||
public override int SortOrder => 9;
|
||||
|
||||
private SocketColor StringToSocketColor(char socketColorString)
|
||||
{
|
||||
switch (socketColorString)
|
||||
{
|
||||
case 'R':
|
||||
{
|
||||
return SocketColor.Red;
|
||||
}
|
||||
case 'G':
|
||||
{
|
||||
return SocketColor.Green;
|
||||
}
|
||||
case 'B':
|
||||
{
|
||||
return SocketColor.Blue;
|
||||
}
|
||||
case 'W':
|
||||
{
|
||||
return SocketColor.White;
|
||||
}
|
||||
default:
|
||||
{
|
||||
throw new InvalidOperationException("Invalid socket color");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,6 +82,8 @@
|
||||
<Compile Include="Properties\Annotations.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="ReplaceColorsParameterSet.cs" />
|
||||
<Compile Include="Socket.cs" />
|
||||
<Compile Include="SocketGroup.cs" />
|
||||
<Compile Include="ThemeEditor\Theme.cs" />
|
||||
<Compile Include="ThemeEditor\ThemeComponent.cs" />
|
||||
<Compile Include="ThemeEditor\ThemeComponentCollection.cs" />
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.ComponentModel;
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
using Filtration.ObjectModel.Annotations;
|
||||
using Filtration.ObjectModel.Enums;
|
||||
@@ -42,6 +43,37 @@ namespace Filtration.ObjectModel
|
||||
}
|
||||
}
|
||||
|
||||
public bool CompareUsing(int target)
|
||||
{
|
||||
switch (PredicateOperator)
|
||||
{
|
||||
case FilterPredicateOperator.Equal:
|
||||
{
|
||||
return target == PredicateOperand;
|
||||
}
|
||||
case FilterPredicateOperator.GreaterThan:
|
||||
{
|
||||
return target > PredicateOperand;
|
||||
}
|
||||
case FilterPredicateOperator.GreaterThanOrEqual:
|
||||
{
|
||||
return target >= PredicateOperand;
|
||||
}
|
||||
case FilterPredicateOperator.LessThan:
|
||||
{
|
||||
return target < PredicateOperand;
|
||||
}
|
||||
case FilterPredicateOperator.LessThanOrEqual:
|
||||
{
|
||||
return target <= PredicateOperand;
|
||||
}
|
||||
default:
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return PredicateOperator.GetAttributeDescription() + " " + PredicateOperand;
|
||||
|
||||
14
Filtration.ObjectModel/Socket.cs
Normal file
14
Filtration.ObjectModel/Socket.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using Filtration.ObjectModel.Enums;
|
||||
|
||||
namespace Filtration.ObjectModel
|
||||
{
|
||||
public class Socket
|
||||
{
|
||||
public Socket(SocketColor color)
|
||||
{
|
||||
Color = color;
|
||||
}
|
||||
|
||||
public SocketColor Color { get; }
|
||||
}
|
||||
}
|
||||
27
Filtration.ObjectModel/SocketGroup.cs
Normal file
27
Filtration.ObjectModel/SocketGroup.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Filtration.ObjectModel
|
||||
{
|
||||
public class SocketGroup : List<Socket>
|
||||
{
|
||||
public SocketGroup(List<Socket> sockets, bool linked)
|
||||
{
|
||||
if (sockets.Count < 1 || sockets.Count > 6)
|
||||
{
|
||||
throw new InvalidOperationException("A socket group must have between 2 and 6 sockets");
|
||||
}
|
||||
|
||||
|
||||
if (linked && sockets.Count < 2)
|
||||
{
|
||||
throw new InvalidOperationException("A linked socket group must have at least 2 sockets");
|
||||
}
|
||||
|
||||
AddRange(sockets);
|
||||
Linked = linked;
|
||||
}
|
||||
|
||||
public bool Linked { get; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user