diff --git a/Filtration.ObjectModel/BlockItemBaseTypes/ColorBooleanBlockItem.cs b/Filtration.ObjectModel/BlockItemBaseTypes/ColorBooleanBlockItem.cs
new file mode 100644
index 0000000..c046842
--- /dev/null
+++ b/Filtration.ObjectModel/BlockItemBaseTypes/ColorBooleanBlockItem.cs
@@ -0,0 +1,53 @@
+using System;
+using System.Windows.Media;
+using Filtration.ObjectModel.ThemeEditor;
+
+namespace Filtration.ObjectModel.BlockItemBaseTypes
+{
+ public abstract class ColorBooleanBlockItem : BlockItemBase, IAudioVisualBlockItem
+ {
+ private Color _color;
+ private bool _booleanValue;
+
+ protected ColorBooleanBlockItem()
+ {
+ }
+
+ protected ColorBooleanBlockItem(Color color, bool booleanValue)
+ {
+ Color = color;
+ BooleanValue = booleanValue;
+ }
+
+ public override string OutputText => PrefixText + " " + +Color.R + " " + Color.G + " "
+ + Color.B + (Color.A < 255 ? " " + Color.A : string.Empty) +
+ (BooleanValue ? " True" : " False");
+
+ public override string SummaryText => string.Empty;
+
+ public override Color SummaryBackgroundColor => Colors.Transparent;
+ public override Color SummaryTextColor => Colors.Transparent;
+
+ public Color Color
+ {
+ get { return _color; }
+ set
+ {
+ _color = value;
+ IsDirty = true;
+ OnPropertyChanged();
+ }
+ }
+
+ public bool BooleanValue
+ {
+ get { return _booleanValue; }
+ set
+ {
+ _booleanValue = value;
+ IsDirty = true;
+ OnPropertyChanged();
+ }
+ }
+ }
+}
diff --git a/Filtration.ObjectModel/BlockItemTypes/BeamBlockItem.cs b/Filtration.ObjectModel/BlockItemTypes/BeamBlockItem.cs
index 0761609..ea938cc 100644
--- a/Filtration.ObjectModel/BlockItemTypes/BeamBlockItem.cs
+++ b/Filtration.ObjectModel/BlockItemTypes/BeamBlockItem.cs
@@ -3,13 +3,13 @@ using Filtration.ObjectModel.BlockItemBaseTypes;
namespace Filtration.ObjectModel.BlockItemTypes
{
- public class BeamBlockItem : ColorBlockItem
+ public class BeamBlockItem : ColorBooleanBlockItem
{
public BeamBlockItem()
{
}
- public BeamBlockItem(Color color) : base(color)
+ public BeamBlockItem(Color color, bool booleanValue) : base(color, booleanValue)
{
}
diff --git a/Filtration.ObjectModel/Filtration.ObjectModel.csproj b/Filtration.ObjectModel/Filtration.ObjectModel.csproj
index ade4e80..4213fe3 100644
--- a/Filtration.ObjectModel/Filtration.ObjectModel.csproj
+++ b/Filtration.ObjectModel/Filtration.ObjectModel.csproj
@@ -52,6 +52,7 @@
+
diff --git a/Filtration.Parser.Tests/Services/TestItemFilterBlockTranslator.cs b/Filtration.Parser.Tests/Services/TestItemFilterBlockTranslator.cs
index f768146..0c3a281 100644
--- a/Filtration.Parser.Tests/Services/TestItemFilterBlockTranslator.cs
+++ b/Filtration.Parser.Tests/Services/TestItemFilterBlockTranslator.cs
@@ -914,7 +914,7 @@ namespace Filtration.Parser.Tests.Services
{
// Arrange
var inputString = "Show" + Environment.NewLine +
- " BeamColor 255 20 100";
+ " BeamColor 255 20 100 True";
// Act
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, _testUtility.MockItemFilterScript);
@@ -924,7 +924,8 @@ namespace Filtration.Parser.Tests.Services
var blockItem = result.BlockItems.OfType().First();
Assert.AreEqual(255, blockItem.Color.R);
Assert.AreEqual(20, blockItem.Color.G);
- Assert.AreEqual(100, blockItem.Color.B);
+ Assert.AreEqual(100, blockItem.Color.B);
+ Assert.IsTrue(blockItem.BooleanValue);
}
[Test]
@@ -962,7 +963,7 @@ namespace Filtration.Parser.Tests.Services
" PlayAlertSound 3" + Environment.NewLine +
" DisableDropSound False" + Environment.NewLine +
" Icon Icon2" + Environment.NewLine +
- " BeamColor 255 100 5" + Environment.NewLine;
+ " BeamColor 255 100 5 false" + Environment.NewLine;
// Act
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, _testUtility.MockItemFilterScript);
@@ -1075,6 +1076,7 @@ namespace Filtration.Parser.Tests.Services
Assert.AreEqual(255, beamBlockItem.Color.R);
Assert.AreEqual(100, beamBlockItem.Color.G);
Assert.AreEqual(5, beamBlockItem.Color.B);
+ Assert.IsFalse(beamBlockItem.BooleanValue);
}
[Test]
@@ -1951,7 +1953,7 @@ namespace Filtration.Parser.Tests.Services
" PlayAlertSound 6 90" + Environment.NewLine +
" DisableDropSound True";/* + Environment.NewLine +
" Icon Icon4";
- " BeamColor 120 130 140";*/
+ " BeamColor 120 130 140 False";*/
_testUtility.TestBlock.BlockItems.Add(new ActionBlockItem(BlockAction.Show));
_testUtility.TestBlock.BlockItems.Add(new IdentifiedBlockItem(true));
@@ -1996,7 +1998,7 @@ namespace Filtration.Parser.Tests.Services
_testUtility.TestBlock.BlockItems.Add(new ElderMapBlockItem(true));
_testUtility.TestBlock.BlockItems.Add(new DisableDropSoundBlockItem(true));
_testUtility.TestBlock.BlockItems.Add(new IconBlockItem("Icon4"));
- _testUtility.TestBlock.BlockItems.Add(new BeamBlockItem(new Color { A = 255, R = 120, G = 130, B = 140 }));
+ _testUtility.TestBlock.BlockItems.Add(new BeamBlockItem(new Color { A = 255, R = 120, G = 130, B = 140 }, false));
// Act
var result = _testUtility.Translator.TranslateItemFilterBlockToString(_testUtility.TestBlock);
diff --git a/Filtration.Parser/Services/ItemFilterBlockTranslator.cs b/Filtration.Parser/Services/ItemFilterBlockTranslator.cs
index 373c2f3..3545227 100644
--- a/Filtration.Parser/Services/ItemFilterBlockTranslator.cs
+++ b/Filtration.Parser/Services/ItemFilterBlockTranslator.cs
@@ -308,7 +308,7 @@ namespace Filtration.Parser.Services
{
var blockItemValue = new IconBlockItem
{
- Value = match.Groups[1].Value,
+ Value = match.Groups[1].Value
};
block.BlockItems.Add(blockItemValue);
}
@@ -318,8 +318,15 @@ namespace Filtration.Parser.Services
{
// Only ever use the last BeamColor item encountered as multiples aren't valid.
RemoveExistingBlockItemsOfType(block);
-
- AddColorItemToBlockItems(block, trimmedLine);
+
+ var result = Regex.Matches(trimmedLine, @"([\w\s]*)(True|False)[#]?(.*)", RegexOptions.IgnoreCase);
+ var color = GetColorFromString(result[0].Groups[1].Value);
+ var beamBlockItem = new BeamBlockItem
+ {
+ Color = GetColorFromString(result[0].Groups[1].Value),
+ BooleanValue = result[0].Groups[2].Value.Trim().ToLowerInvariant() == "true"
+ };
+ block.BlockItems.Add(beamBlockItem);
break;
}
}
diff --git a/Filtration/UserControls/BlockItemControl.xaml b/Filtration/UserControls/BlockItemControl.xaml
index 5aa6466..18ae6ac 100644
--- a/Filtration/UserControls/BlockItemControl.xaml
+++ b/Filtration/UserControls/BlockItemControl.xaml
@@ -85,7 +85,18 @@
-
+
+
+
+
+
+ Permanent
+ Temporary
+
+
+
+
+