Compare commits
18 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1e26a2ae3e | ||
|
|
54b72e44b0 | ||
|
|
24df1d7687 | ||
|
|
7162e16b49 | ||
|
|
324ce4d0b3 | ||
|
|
de489e8b2c | ||
|
|
341b1d1eb2 | ||
|
|
6be29dbd28 | ||
|
|
3851ad51e1 | ||
|
|
65d3e07156 | ||
|
|
a86ab3ec8d | ||
|
|
41722e8a57 | ||
|
|
3cb0a041d7 | ||
|
|
c8778bb1eb | ||
|
|
8e849d6a8f | ||
|
|
0d3f01a856 | ||
|
|
178ff579c6 | ||
|
|
30aa52e788 |
@@ -27,8 +27,6 @@ namespace Filtration.ObjectModel.BlockItemBaseTypes
|
||||
}
|
||||
}
|
||||
|
||||
public string Comment { get; set; }
|
||||
|
||||
public override string OutputText => Action.GetAttributeDescription();
|
||||
|
||||
public override string PrefixText => string.Empty;
|
||||
|
||||
@@ -17,6 +17,7 @@ namespace Filtration.ObjectModel.BlockItemBaseTypes
|
||||
public abstract Color SummaryBackgroundColor { get; }
|
||||
public abstract Color SummaryTextColor { get; }
|
||||
public abstract int SortOrder { get; }
|
||||
public string Comment { get; set; }
|
||||
|
||||
public bool IsDirty
|
||||
{
|
||||
|
||||
@@ -4,6 +4,6 @@ namespace Filtration.ObjectModel
|
||||
{
|
||||
public interface IBlockItemWithTheme : IItemFilterBlockItem
|
||||
{
|
||||
ThemeComponent ThemeComponent { get; }
|
||||
ThemeComponent ThemeComponent { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,5 +14,6 @@ namespace Filtration.ObjectModel
|
||||
int MaximumAllowed { get; }
|
||||
int SortOrder { get; }
|
||||
bool IsDirty { get; }
|
||||
string Comment { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using Filtration.ObjectModel.Enums;
|
||||
using GalaSoft.MvvmLight.Command;
|
||||
using Microsoft.Win32;
|
||||
@@ -25,13 +26,34 @@ namespace Filtration.ObjectModel.ThemeEditor
|
||||
|
||||
if (_customSoundsAvailable == null || _customSoundsAvailable.Count < 1)
|
||||
{
|
||||
_customSoundsAvailable = new ObservableCollection<string> {
|
||||
"1maybevaluable.mp3", "2currency.mp3", "3uniques.mp3", "4maps.mp3", "5highmaps.mp3",
|
||||
"6veryvaluable.mp3", "7chancing.mp3", "12leveling.mp3", "placeholder.mp3"
|
||||
};
|
||||
|
||||
_customSoundsAvailable = new ObservableCollection<string>();
|
||||
|
||||
var poeFolderPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments).ToString() + @"\My Games\Path of Exile\";
|
||||
if(System.IO.Directory.Exists(poeFolderPath))
|
||||
{
|
||||
var poeFolderFiles = System.IO.Directory.GetFiles(poeFolderPath).Where(
|
||||
s => s.EndsWith(".mp3")
|
||||
|| s.EndsWith(".wav")
|
||||
|| s.EndsWith(".wma")
|
||||
|| s.EndsWith(".3gp")
|
||||
|| s.EndsWith(".aag")
|
||||
|| s.EndsWith(".m4a")
|
||||
|| s.EndsWith(".ogg")
|
||||
).OrderBy(f => f);
|
||||
|
||||
foreach (var file in poeFolderFiles)
|
||||
{
|
||||
_customSoundsAvailable.Add(file.Replace(poeFolderPath, ""));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (_customSoundsAvailable.IndexOf(Value) < 0)
|
||||
if(string.IsNullOrWhiteSpace(Value))
|
||||
{
|
||||
Value = _customSoundsAvailable.Count > 0 ? _customSoundsAvailable[0] : "";
|
||||
}
|
||||
else if (_customSoundsAvailable.IndexOf(Value) < 0)
|
||||
{
|
||||
_customSoundsAvailable.Add(Value);
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ namespace Filtration.Parser.Tests.Services
|
||||
// Arrange
|
||||
var inputString = "HideDisabled" + Environment.NewLine +
|
||||
" ItemLevel >= 55";
|
||||
|
||||
|
||||
// Act
|
||||
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, _testUtility.MockItemFilterScript);
|
||||
|
||||
@@ -372,71 +372,89 @@ namespace Filtration.Parser.Tests.Services
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TranslateStringToItemFilterBlock_ElderItem_ReturnsCorrectObject()
|
||||
{
|
||||
// Arrange
|
||||
var inputString = "Show" + Environment.NewLine +
|
||||
" ElderItem False";
|
||||
|
||||
// Act
|
||||
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, _testUtility.MockItemFilterScript);
|
||||
|
||||
// Assert
|
||||
|
||||
Assert.AreEqual(1, result.BlockItems.Count(b => b is ElderItemBlockItem));
|
||||
var blockItem = result.BlockItems.OfType<ElderItemBlockItem>().First();
|
||||
Assert.IsFalse(blockItem.BooleanValue);
|
||||
public void TranslateStringToItemFilterBlock_ElderItem_ReturnsCorrectObject()
|
||||
{
|
||||
// Arrange
|
||||
var inputString = "Show" + Environment.NewLine +
|
||||
" ElderItem False";
|
||||
|
||||
// Act
|
||||
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, _testUtility.MockItemFilterScript);
|
||||
|
||||
// Assert
|
||||
|
||||
Assert.AreEqual(1, result.BlockItems.Count(b => b is ElderItemBlockItem));
|
||||
var blockItem = result.BlockItems.OfType<ElderItemBlockItem>().First();
|
||||
Assert.IsFalse(blockItem.BooleanValue);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TranslateStringToItemFilterBlock_ShaperItem_ReturnsCorrectObject()
|
||||
{
|
||||
// Arrange
|
||||
var inputString = "Show" + Environment.NewLine +
|
||||
" ShaperItem True";
|
||||
|
||||
// Act
|
||||
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, _testUtility.MockItemFilterScript);
|
||||
|
||||
// Assert
|
||||
|
||||
Assert.AreEqual(1, result.BlockItems.Count(b => b is ShaperItemBlockItem));
|
||||
var blockItem = result.BlockItems.OfType<ShaperItemBlockItem>().First();
|
||||
Assert.IsTrue(blockItem.BooleanValue);
|
||||
public void TranslateStringToItemFilterBlock_ShaperItem_ReturnsCorrectObject()
|
||||
{
|
||||
// Arrange
|
||||
var inputString = "Show" + Environment.NewLine +
|
||||
" ShaperItem True";
|
||||
|
||||
// Act
|
||||
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, _testUtility.MockItemFilterScript);
|
||||
|
||||
// Assert
|
||||
|
||||
Assert.AreEqual(1, result.BlockItems.Count(b => b is ShaperItemBlockItem));
|
||||
var blockItem = result.BlockItems.OfType<ShaperItemBlockItem>().First();
|
||||
Assert.IsTrue(blockItem.BooleanValue);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TranslateStringToItemFilterBlock_ShapedMap_ReturnsCorrectObject()
|
||||
{
|
||||
// Arrange
|
||||
var inputString = "Show" + Environment.NewLine +
|
||||
" ShapedMap false";
|
||||
|
||||
// Act
|
||||
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, _testUtility.MockItemFilterScript);
|
||||
|
||||
// Assert
|
||||
|
||||
Assert.AreEqual(1, result.BlockItems.Count(b => b is ShapedMapBlockItem));
|
||||
var blockItem = result.BlockItems.OfType<ShapedMapBlockItem>().First();
|
||||
Assert.IsFalse(blockItem.BooleanValue);
|
||||
public void TranslateStringToItemFilterBlock_MapTier_ReturnsCorrectObject()
|
||||
{
|
||||
// Arrange
|
||||
var inputString = "Show" + Environment.NewLine +
|
||||
" MapTier >= 15";
|
||||
|
||||
// Act
|
||||
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, _testUtility.MockItemFilterScript);
|
||||
|
||||
// Assert
|
||||
|
||||
Assert.AreEqual(1, result.BlockItems.Count(b => b is MapTierBlockItem));
|
||||
var blockItem = result.BlockItems.OfType<MapTierBlockItem>().First();
|
||||
Assert.AreEqual(15, blockItem.FilterPredicate.PredicateOperand);
|
||||
Assert.AreEqual(FilterPredicateOperator.GreaterThanOrEqual, blockItem.FilterPredicate.PredicateOperator);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TranslateStringToItemFilterBlock_ElderMap_ReturnsCorrectObject()
|
||||
{
|
||||
// Arrange
|
||||
var inputString = "Show" + Environment.NewLine +
|
||||
" ElderMap false";
|
||||
|
||||
// Act
|
||||
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, _testUtility.MockItemFilterScript);
|
||||
|
||||
// Assert
|
||||
|
||||
Assert.AreEqual(1, result.BlockItems.Count(b => b is ElderMapBlockItem));
|
||||
var blockItem = result.BlockItems.OfType<ElderMapBlockItem>().First();
|
||||
Assert.IsFalse(blockItem.BooleanValue);
|
||||
public void TranslateStringToItemFilterBlock_ShapedMap_ReturnsCorrectObject()
|
||||
{
|
||||
// Arrange
|
||||
var inputString = "Show" + Environment.NewLine +
|
||||
" ShapedMap false";
|
||||
|
||||
// Act
|
||||
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, _testUtility.MockItemFilterScript);
|
||||
|
||||
// Assert
|
||||
|
||||
Assert.AreEqual(1, result.BlockItems.Count(b => b is ShapedMapBlockItem));
|
||||
var blockItem = result.BlockItems.OfType<ShapedMapBlockItem>().First();
|
||||
Assert.IsFalse(blockItem.BooleanValue);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TranslateStringToItemFilterBlock_ElderMap_ReturnsCorrectObject()
|
||||
{
|
||||
// Arrange
|
||||
var inputString = "Show" + Environment.NewLine +
|
||||
" ElderMap false";
|
||||
|
||||
// Act
|
||||
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, _testUtility.MockItemFilterScript);
|
||||
|
||||
// Assert
|
||||
|
||||
Assert.AreEqual(1, result.BlockItems.Count(b => b is ElderMapBlockItem));
|
||||
var blockItem = result.BlockItems.OfType<ElderMapBlockItem>().First();
|
||||
Assert.IsFalse(blockItem.BooleanValue);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -775,7 +793,7 @@ namespace Filtration.Parser.Tests.Services
|
||||
" SetTextColor 255 20 100 # Rare Item Text";
|
||||
var testComponent = new ColorThemeComponent(ThemeComponentType.TextColor, "Rare Item Text", new Color { R = 255, G = 20, B = 100});
|
||||
var testInputThemeComponentCollection = new ThemeComponentCollection { testComponent };
|
||||
|
||||
|
||||
// Act
|
||||
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, Mock.Of<IItemFilterScript>(i => i.ItemFilterScriptSettings.ThemeComponentCollection == testInputThemeComponentCollection));
|
||||
|
||||
@@ -876,22 +894,22 @@ namespace Filtration.Parser.Tests.Services
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TranslateStringToItemFilterBlock_DisableDropSound_ReturnsCorrectObject()
|
||||
{
|
||||
// Arrange
|
||||
var inputString = "Show" + Environment.NewLine +
|
||||
" DisableDropSound True";
|
||||
|
||||
// Act
|
||||
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, _testUtility.MockItemFilterScript);
|
||||
|
||||
// Assert
|
||||
|
||||
Assert.AreEqual(1, result.BlockItems.Count(b => b is DisableDropSoundBlockItem));
|
||||
var blockItem = result.BlockItems.OfType<DisableDropSoundBlockItem>().First();
|
||||
Assert.IsTrue(blockItem.BooleanValue);
|
||||
}
|
||||
|
||||
public void TranslateStringToItemFilterBlock_DisableDropSound_ReturnsCorrectObject()
|
||||
{
|
||||
// Arrange
|
||||
var inputString = "Show" + Environment.NewLine +
|
||||
" DisableDropSound True";
|
||||
|
||||
// Act
|
||||
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, _testUtility.MockItemFilterScript);
|
||||
|
||||
// Assert
|
||||
|
||||
Assert.AreEqual(1, result.BlockItems.Count(b => b is DisableDropSoundBlockItem));
|
||||
var blockItem = result.BlockItems.OfType<DisableDropSoundBlockItem>().First();
|
||||
Assert.IsTrue(blockItem.BooleanValue);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TranslateStringToItemFilterBlock_Everything_ReturnsCorrectObject()
|
||||
{
|
||||
@@ -925,7 +943,10 @@ namespace Filtration.Parser.Tests.Services
|
||||
" SetBorderColor 0 0 0" + Environment.NewLine +
|
||||
" SetFontSize 50" + Environment.NewLine +
|
||||
" PlayAlertSound 3" + Environment.NewLine +
|
||||
" DisableDropSound False" + Environment.NewLine;
|
||||
" DisableDropSound False" + Environment.NewLine +
|
||||
" CustomAlertSound \"test.mp3\" # customSoundTheme" + Environment.NewLine +
|
||||
" MinimapIcon 2 Green Triangle # iconTheme" + Environment.NewLine +
|
||||
" PlayEffect Green Temp # effectTheme" + Environment.NewLine;
|
||||
|
||||
// Act
|
||||
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, _testUtility.MockItemFilterScript);
|
||||
@@ -1024,12 +1045,40 @@ namespace Filtration.Parser.Tests.Services
|
||||
var fontSizeblockItem = result.BlockItems.OfType<FontSizeBlockItem>().First();
|
||||
Assert.AreEqual(50, fontSizeblockItem.Value);
|
||||
|
||||
var soundblockItem = result.BlockItems.OfType<SoundBlockItem>().First();
|
||||
Assert.AreEqual("3", soundblockItem.Value);
|
||||
Assert.AreEqual(79, soundblockItem.SecondValue);
|
||||
Assert.AreEqual(0, result.BlockItems.OfType<SoundBlockItem>().Count());
|
||||
|
||||
var disableDropSoundBlockItem = result.BlockItems.OfType<DisableDropSoundBlockItem>().First();
|
||||
Assert.IsFalse(disableDropSoundBlockItem.BooleanValue);
|
||||
|
||||
var customSoundBlockItem = result.BlockItems.OfType<CustomSoundBlockItem>().First();
|
||||
Assert.AreEqual("test.mp3", customSoundBlockItem.Value);
|
||||
Assert.AreNotEqual(null, customSoundBlockItem.ThemeComponent);
|
||||
Assert.AreEqual(ThemeComponentType.CustomSound, customSoundBlockItem.ThemeComponent.ComponentType);
|
||||
Assert.AreEqual("customSoundTheme", customSoundBlockItem.ThemeComponent.ComponentName);
|
||||
Assert.AreEqual(typeof(StringThemeComponent), customSoundBlockItem.ThemeComponent.GetType());
|
||||
Assert.AreEqual("test.mp3", ((StringThemeComponent)customSoundBlockItem.ThemeComponent).Value);
|
||||
|
||||
var mapIconBlockItem = result.BlockItems.OfType<MapIconBlockItem>().First();
|
||||
Assert.AreEqual(IconSize.Small, mapIconBlockItem.Size);
|
||||
Assert.AreEqual(IconColor.Green, mapIconBlockItem.Color);
|
||||
Assert.AreEqual(IconShape.Triangle, mapIconBlockItem.Shape);
|
||||
Assert.AreNotEqual(null, mapIconBlockItem.ThemeComponent);
|
||||
Assert.AreEqual(ThemeComponentType.Icon, mapIconBlockItem.ThemeComponent.ComponentType);
|
||||
Assert.AreEqual("iconTheme", mapIconBlockItem.ThemeComponent.ComponentName);
|
||||
Assert.AreEqual(typeof(IconThemeComponent), mapIconBlockItem.ThemeComponent.GetType());
|
||||
Assert.AreEqual(IconSize.Small, ((IconThemeComponent)mapIconBlockItem.ThemeComponent).IconSize);
|
||||
Assert.AreEqual(IconColor.Green, ((IconThemeComponent)mapIconBlockItem.ThemeComponent).IconColor);
|
||||
Assert.AreEqual(IconShape.Triangle, ((IconThemeComponent)mapIconBlockItem.ThemeComponent).IconShape);
|
||||
|
||||
var effectColorBlockItem = result.BlockItems.OfType<EffectColorBlockItem>().First();
|
||||
Assert.AreEqual(EffectColor.Green, effectColorBlockItem.Color);
|
||||
Assert.IsTrue(effectColorBlockItem.Temporary);
|
||||
Assert.AreNotEqual(null, effectColorBlockItem.ThemeComponent);
|
||||
Assert.AreEqual(ThemeComponentType.Effect, effectColorBlockItem.ThemeComponent.ComponentType);
|
||||
Assert.AreEqual("effectTheme", effectColorBlockItem.ThemeComponent.ComponentName);
|
||||
Assert.AreEqual(typeof(EffectColorThemeComponent), effectColorBlockItem.ThemeComponent.GetType());
|
||||
Assert.AreEqual(EffectColor.Green, ((EffectColorThemeComponent)effectColorBlockItem.ThemeComponent).EffectColor);
|
||||
Assert.IsTrue(((EffectColorThemeComponent)effectColorBlockItem.ThemeComponent).Temporary);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -1038,9 +1087,9 @@ namespace Filtration.Parser.Tests.Services
|
||||
// Arrange
|
||||
|
||||
var inputString = "Show" + Environment.NewLine +
|
||||
" ItemLevel >= 70" + Environment.NewLine +
|
||||
" ItemLevel <= 80" + Environment.NewLine +
|
||||
" Quality = 15" + Environment.NewLine +
|
||||
" ItemLevel >= 70" + Environment.NewLine +
|
||||
" ItemLevel <= 80" + Environment.NewLine +
|
||||
" Quality = 15" + Environment.NewLine +
|
||||
" Quality < 17";
|
||||
|
||||
// Act
|
||||
@@ -1101,7 +1150,7 @@ namespace Filtration.Parser.Tests.Services
|
||||
var blockItem = result.BlockItems.OfType<FontSizeBlockItem>().First();
|
||||
Assert.AreEqual(27, blockItem.Value);
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public void TranslateStringToItemFilterBlock_MultipleSoundItems_OnlyLastOneUsed()
|
||||
{
|
||||
@@ -1257,6 +1306,86 @@ namespace Filtration.Parser.Tests.Services
|
||||
Assert.AreEqual(ItemRarity.Magic, (ItemRarity)rarityBlockItem.FilterPredicate.PredicateOperand);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TranslateStringToItemFilterBlock_CustomSoundDocumentsFile()
|
||||
{
|
||||
// Arrange
|
||||
var inputString = @"Show" + Environment.NewLine +
|
||||
"CustomAlertSound \"test.mp3\"";
|
||||
|
||||
// Act
|
||||
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, _testUtility.MockItemFilterScript);
|
||||
|
||||
// Assert
|
||||
Assert.AreEqual(1, result.BlockItems.Count(b => b is CustomSoundBlockItem));
|
||||
var customSoundBlockItem = result.BlockItems.OfType<CustomSoundBlockItem>().First();
|
||||
Assert.AreEqual("test.mp3", customSoundBlockItem.Value);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TranslateStringToItemFilterBlock_CustomSoundDocumentsRelativeFile()
|
||||
{
|
||||
// Arrange
|
||||
var inputString = @"Show" + Environment.NewLine +
|
||||
"CustomAlertSound \"Sounds\test.mp3\"";
|
||||
|
||||
// Act
|
||||
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, _testUtility.MockItemFilterScript);
|
||||
|
||||
// Assert
|
||||
Assert.AreEqual(1, result.BlockItems.Count(b => b is CustomSoundBlockItem));
|
||||
var customSoundBlockItem = result.BlockItems.OfType<CustomSoundBlockItem>().First();
|
||||
Assert.AreEqual("Sounds\test.mp3", customSoundBlockItem.Value);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TranslateStringToItemFilterBlock_CustomSoundFullBackSlashPath()
|
||||
{
|
||||
// Arrange
|
||||
var inputString = @"Show" + Environment.NewLine +
|
||||
"CustomAlertSound \"C:\\Sounds\\test.mp3\"";
|
||||
|
||||
// Act
|
||||
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, _testUtility.MockItemFilterScript);
|
||||
|
||||
// Assert
|
||||
Assert.AreEqual(1, result.BlockItems.Count(b => b is CustomSoundBlockItem));
|
||||
var customSoundBlockItem = result.BlockItems.OfType<CustomSoundBlockItem>().First();
|
||||
Assert.AreEqual("C:\\Sounds\\test.mp3", customSoundBlockItem.Value);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TranslateStringToItemFilterBlock_CustomSoundFullForwardSlashPath()
|
||||
{
|
||||
// Arrange
|
||||
var inputString = @"Show" + Environment.NewLine +
|
||||
"CustomAlertSound \"C:/Sounds/test.mp3\"";
|
||||
|
||||
//Act
|
||||
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, _testUtility.MockItemFilterScript);
|
||||
|
||||
// Assert
|
||||
Assert.AreEqual(1, result.BlockItems.Count(b => b is CustomSoundBlockItem));
|
||||
var customSoundBlockItem = result.BlockItems.OfType<CustomSoundBlockItem>().First();
|
||||
Assert.AreEqual("C:/Sounds/test.mp3", customSoundBlockItem.Value);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TranslateStringToItemFilterBlock_CustomSoundFullMixedPath()
|
||||
{
|
||||
// Arrange
|
||||
var inputString = @"Show" + Environment.NewLine +
|
||||
"CustomAlertSound \"C:\\Sounds/test.mp3\"";
|
||||
|
||||
// Act
|
||||
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, _testUtility.MockItemFilterScript);
|
||||
|
||||
// Assert
|
||||
Assert.AreEqual(1, result.BlockItems.Count(b => b is CustomSoundBlockItem));
|
||||
var customSoundBlockItem = result.BlockItems.OfType<CustomSoundBlockItem>().First();
|
||||
Assert.AreEqual("C:\\Sounds/test.mp3", customSoundBlockItem.Value);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TranslateItemFilterBlockToString_NothingPopulated_ReturnsCorrectString()
|
||||
{
|
||||
@@ -1277,13 +1406,13 @@ namespace Filtration.Parser.Tests.Services
|
||||
{
|
||||
// Arrange
|
||||
var expectedResult = "Show # Child 1 Block Group - Child 2 Block Group";
|
||||
|
||||
|
||||
var rootBlockGroup = new ItemFilterBlockGroup("Root Block Group", null);
|
||||
var child1BlockGroup = new ItemFilterBlockGroup("Child 1 Block Group", rootBlockGroup);
|
||||
var child2BlockGroup = new ItemFilterBlockGroup("Child 2 Block Group", child1BlockGroup);
|
||||
_testUtility.TestBlock.BlockGroup = child2BlockGroup;
|
||||
|
||||
// TODO: Shouldn't be set to edited this way
|
||||
_testUtility.TestBlock.BlockGroup = child2BlockGroup;
|
||||
|
||||
// TODO: Shouldn't be set to edited this way
|
||||
_testUtility.TestBlock.IsEdited = true;
|
||||
// Act
|
||||
var result = _testUtility.Translator.TranslateItemFilterBlockToString(_testUtility.TestBlock);
|
||||
@@ -1802,7 +1931,7 @@ namespace Filtration.Parser.Tests.Services
|
||||
{
|
||||
// Arrange
|
||||
var expectedResult = "Show" + Environment.NewLine +
|
||||
" ItemLevel > 56" + Environment.NewLine +
|
||||
" ItemLevel > 56" + Environment.NewLine +
|
||||
" ItemLevel >= 45" + Environment.NewLine +
|
||||
" ItemLevel < 100";
|
||||
|
||||
@@ -1844,7 +1973,7 @@ namespace Filtration.Parser.Tests.Services
|
||||
// Arrange
|
||||
var expectedResult = "#Show" + Environment.NewLine +
|
||||
"# Width = 4";
|
||||
|
||||
|
||||
|
||||
_testUtility.TestBlock.Enabled = false;
|
||||
_testUtility.TestBlock.BlockItems.Add(new WidthBlockItem(FilterPredicateOperator.Equal, 4));
|
||||
@@ -1891,7 +2020,7 @@ namespace Filtration.Parser.Tests.Services
|
||||
" DisableDropSound True" + Environment.NewLine +
|
||||
" MinimapIcon 1 Blue Circle" + Environment.NewLine +
|
||||
" PlayEffect Red Temp" + Environment.NewLine +
|
||||
" CustomAlertSound \"test.mp3\"";
|
||||
" CustomAlertSound \"test.mp3\"";
|
||||
|
||||
_testUtility.TestBlock.BlockItems.Add(new ActionBlockItem(BlockAction.Show));
|
||||
_testUtility.TestBlock.BlockItems.Add(new IdentifiedBlockItem(true));
|
||||
@@ -1959,7 +2088,7 @@ namespace Filtration.Parser.Tests.Services
|
||||
|
||||
// Act
|
||||
_testUtility.Translator.ReplaceAudioVisualBlockItemsFromString(testInputBlockItems, testInputString);
|
||||
|
||||
|
||||
// Assert
|
||||
var textColorBlockItem = testInputBlockItems.First(b => b is TextColorBlockItem) as TextColorBlockItem;
|
||||
Assert.IsNotNull(textColorBlockItem);
|
||||
@@ -2034,7 +2163,7 @@ namespace Filtration.Parser.Tests.Services
|
||||
// Arrange
|
||||
var testInputString = "SetTextColor 240 200 150 # Rarest Currency" + Environment.NewLine +
|
||||
"SetBackgroundColor 0 0 0 # Rarest Currency Background" + Environment.NewLine +
|
||||
"SetBorderColor 255 255 255 # Rarest Currency Border" + Environment.NewLine +
|
||||
"SetBorderColor 255 255 255 # Rarest Currency Border" + Environment.NewLine +
|
||||
"PlayAlertSound 7 280";
|
||||
|
||||
var testInputBlockItems = new ObservableCollection<IItemFilterBlockItem>();
|
||||
@@ -2080,9 +2209,9 @@ namespace Filtration.Parser.Tests.Services
|
||||
// Arrange
|
||||
var testInputString = "SetTextColor 240 200 150 # Rarest Currency" + Environment.NewLine +
|
||||
"SetBackgroundColor 0 0 0 # Rarest Currency Background" + Environment.NewLine +
|
||||
"SetBorderColor 255 255 255 # Rarest Currency Border" + Environment.NewLine +
|
||||
"SetBorderColor 255 255 255 # Rarest Currency Border" + Environment.NewLine +
|
||||
"PlayAlertSound 7 280";
|
||||
|
||||
|
||||
var testInputBlockItems = new ObservableCollection<IItemFilterBlockItem>();
|
||||
|
||||
// Act
|
||||
@@ -2152,9 +2281,9 @@ namespace Filtration.Parser.Tests.Services
|
||||
_testUtility.Translator.ReplaceAudioVisualBlockItemsFromString(testInputBlockItems, testInputString);
|
||||
|
||||
// Assert
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private class ItemFilterBlockTranslatorTestUtility
|
||||
{
|
||||
public ItemFilterBlockTranslatorTestUtility()
|
||||
|
||||
@@ -285,13 +285,11 @@ namespace Filtration.Parser.Tests.Services
|
||||
" ItemLevel > 2" + Environment.NewLine +
|
||||
" SetTextColor 255 40 0" + Environment.NewLine +
|
||||
Environment.NewLine +
|
||||
"#Disabled Block Start" + Environment.NewLine +
|
||||
"#Show" + Environment.NewLine +
|
||||
"# ItemLevel > 2" + Environment.NewLine +
|
||||
"# SetTextColor 255 215 0" + Environment.NewLine +
|
||||
"# SetBorderColor 255 105 180" + Environment.NewLine +
|
||||
"# SetFontSize 32" + Environment.NewLine +
|
||||
"#Disabled Block End" + Environment.NewLine +
|
||||
Environment.NewLine +
|
||||
"Show" + Environment.NewLine +
|
||||
" ItemLevel > 20" + Environment.NewLine +
|
||||
@@ -316,13 +314,11 @@ namespace Filtration.Parser.Tests.Services
|
||||
" ItemLevel > 2" + Environment.NewLine +
|
||||
" SetTextColor 255 40 0" + Environment.NewLine +
|
||||
Environment.NewLine +
|
||||
"#Disabled Block Start" + Environment.NewLine +
|
||||
"#Show" + Environment.NewLine +
|
||||
"# ItemLevel > 2" + Environment.NewLine +
|
||||
"# SetTextColor 255 215 0" + Environment.NewLine +
|
||||
"# SetBorderColor 255 105 180" + Environment.NewLine +
|
||||
"# SetFontSize 32" + Environment.NewLine +
|
||||
"#Disabled Block End" + Environment.NewLine +
|
||||
Environment.NewLine +
|
||||
"Show" + Environment.NewLine +
|
||||
" ItemLevel > 20" + Environment.NewLine +
|
||||
@@ -355,11 +351,9 @@ namespace Filtration.Parser.Tests.Services
|
||||
" ItemLevel > 2" + Environment.NewLine +
|
||||
" SetTextColor 255 40 0" + Environment.NewLine +
|
||||
Environment.NewLine +
|
||||
"#Disabled Block Start" + Environment.NewLine +
|
||||
"# This is a disabled block" + Environment.NewLine +
|
||||
"#Show" + Environment.NewLine +
|
||||
"# ItemLevel > 2" + Environment.NewLine +
|
||||
"#Disabled Block End";
|
||||
"# ItemLevel > 2";
|
||||
|
||||
|
||||
var blockTranslator = new ItemFilterBlockTranslator(Mock.Of<IBlockGroupHierarchyBuilder>());
|
||||
@@ -384,11 +378,9 @@ namespace Filtration.Parser.Tests.Services
|
||||
" ItemLevel > 2" + Environment.NewLine +
|
||||
" SetTextColor 255 40 0" + Environment.NewLine +
|
||||
Environment.NewLine +
|
||||
"#Disabled Block Start" + Environment.NewLine +
|
||||
"# This is a disabled block" + Environment.NewLine +
|
||||
"#Show#My Block Group" + Environment.NewLine +
|
||||
"# ItemLevel > 2" + Environment.NewLine +
|
||||
"#Disabled Block End";
|
||||
"# ItemLevel > 2";
|
||||
|
||||
|
||||
var mockBlockGroupHierarchyBuilder = new Mock<IBlockGroupHierarchyBuilder>();
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
<HintPath>..\packages\Castle.Windsor.3.4.0\lib\net45\Castle.Windsor.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
|
||||
@@ -41,13 +41,13 @@ namespace Filtration.Parser.Services
|
||||
itemFilterCommentBlock.Comment += trimmedLine + Environment.NewLine;
|
||||
}
|
||||
|
||||
itemFilterCommentBlock.Comment = itemFilterCommentBlock.Comment.TrimEnd('\r', '\n');
|
||||
|
||||
itemFilterCommentBlock.Comment = itemFilterCommentBlock.Comment.TrimEnd('\r', '\n');
|
||||
|
||||
itemFilterCommentBlock.IsEdited = false;
|
||||
return itemFilterCommentBlock;
|
||||
}
|
||||
|
||||
// This method converts a string into a ItemFilterBlock. This is used for pasting ItemFilterBlocks
|
||||
// This method converts a string into a ItemFilterBlock. This is used for pasting ItemFilterBlocks
|
||||
// and reading ItemFilterScripts from a file.
|
||||
public IItemFilterBlock TranslateStringToItemFilterBlock(string inputString, IItemFilterScript parentItemFilterScript, string originalString = "", bool initialiseBlockGroupHierarchyBuilder = false)
|
||||
{
|
||||
@@ -63,13 +63,35 @@ namespace Filtration.Parser.Services
|
||||
|
||||
foreach (var line in new LineReader(() => new StringReader(inputString)))
|
||||
{
|
||||
if (line.StartsWith(@"#") && !showHideFound)
|
||||
if (line.StartsWith(@"#"))
|
||||
{
|
||||
block.Description = line.TrimStart('#').TrimStart(' ');
|
||||
if(!showHideFound)
|
||||
{
|
||||
block.Description = line.TrimStart('#').TrimStart(' ');
|
||||
}
|
||||
else
|
||||
{
|
||||
if(block.BlockItems.Count > 1)
|
||||
{
|
||||
block.BlockItems.Last().Comment += Environment.NewLine + line.TrimStart('#');
|
||||
}
|
||||
else
|
||||
{
|
||||
block.ActionBlockItem.Comment += Environment.NewLine + line.TrimStart('#');
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
var trimmedLine = line.Trim();
|
||||
var fullLine = line.Trim();
|
||||
var trimmedLine = fullLine;
|
||||
var blockComment = "";
|
||||
var themeComponentType = -1;
|
||||
if(trimmedLine.IndexOf('#') > 0)
|
||||
{
|
||||
blockComment = trimmedLine.Substring(trimmedLine.IndexOf('#') + 1);
|
||||
trimmedLine = trimmedLine.Substring(0, trimmedLine.IndexOf('#')).Trim();
|
||||
}
|
||||
var spaceOrEndOfLinePos = trimmedLine.IndexOf(" ", StringComparison.Ordinal) > 0 ? trimmedLine.IndexOf(" ", StringComparison.Ordinal) : trimmedLine.Length;
|
||||
|
||||
var lineOption = trimmedLine.Substring(0, spaceOrEndOfLinePos);
|
||||
@@ -88,11 +110,11 @@ namespace Filtration.Parser.Services
|
||||
// group hierarchy, if block groups are disabled it is preserved as a simple text comment.
|
||||
if (parentItemFilterScript.ItemFilterScriptSettings.BlockGroupsEnabled)
|
||||
{
|
||||
AddBlockGroupToBlock(block, trimmedLine);
|
||||
AddBlockGroupToBlock(block, fullLine);
|
||||
}
|
||||
else
|
||||
{
|
||||
block.ActionBlockItem.Comment = GetTextAfterFirstComment(trimmedLine);
|
||||
block.ActionBlockItem.Comment = GetTextAfterFirstComment(fullLine);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -193,7 +215,12 @@ namespace Filtration.Parser.Services
|
||||
// Only ever use the last SetTextColor item encountered as multiples aren't valid.
|
||||
RemoveExistingBlockItemsOfType<TextColorBlockItem>(block);
|
||||
|
||||
AddColorItemToBlockItems<TextColorBlockItem>(block, trimmedLine);
|
||||
var result = Regex.Matches(trimmedLine, @"([\w\s]*)");
|
||||
|
||||
var blockItem = new TextColorBlockItem();
|
||||
blockItem.Color = GetColorFromString(result[0].Groups[1].Value);
|
||||
block.BlockItems.Add(blockItem);
|
||||
themeComponentType = (int)ThemeComponentType.TextColor;
|
||||
break;
|
||||
}
|
||||
case "SetBackgroundColor":
|
||||
@@ -201,7 +228,12 @@ namespace Filtration.Parser.Services
|
||||
// Only ever use the last SetBackgroundColor item encountered as multiples aren't valid.
|
||||
RemoveExistingBlockItemsOfType<BackgroundColorBlockItem>(block);
|
||||
|
||||
AddColorItemToBlockItems<BackgroundColorBlockItem>(block, trimmedLine);
|
||||
var result = Regex.Matches(trimmedLine, @"([\w\s]*)");
|
||||
|
||||
var blockItem = new BackgroundColorBlockItem();
|
||||
blockItem.Color = GetColorFromString(result[0].Groups[1].Value);
|
||||
block.BlockItems.Add(blockItem);
|
||||
themeComponentType = (int)ThemeComponentType.BackgroundColor;
|
||||
break;
|
||||
}
|
||||
case "SetBorderColor":
|
||||
@@ -209,7 +241,12 @@ namespace Filtration.Parser.Services
|
||||
// Only ever use the last SetBorderColor item encountered as multiples aren't valid.
|
||||
RemoveExistingBlockItemsOfType<BorderColorBlockItem>(block);
|
||||
|
||||
AddColorItemToBlockItems<BorderColorBlockItem>(block, trimmedLine);
|
||||
var result = Regex.Matches(trimmedLine, @"([\w\s]*)");
|
||||
|
||||
var blockItem = new BorderColorBlockItem();
|
||||
blockItem.Color = GetColorFromString(result[0].Groups[1].Value);
|
||||
block.BlockItems.Add(blockItem);
|
||||
themeComponentType = (int)ThemeComponentType.BorderColor;
|
||||
break;
|
||||
}
|
||||
case "SetFontSize":
|
||||
@@ -217,15 +254,12 @@ namespace Filtration.Parser.Services
|
||||
// Only ever use the last SetFontSize item encountered as multiples aren't valid.
|
||||
RemoveExistingBlockItemsOfType<FontSizeBlockItem>(block);
|
||||
|
||||
var match = Regex.Matches(trimmedLine, @"(\s+(\d+)\s*)([#]?)(.*)");
|
||||
var match = Regex.Matches(trimmedLine, @"(\s+(\d+)\s*)");
|
||||
if (match.Count > 0)
|
||||
{
|
||||
var blockItem = new FontSizeBlockItem(Convert.ToInt16(match[0].Groups[2].Value));
|
||||
if(match[0].Groups[3].Value == "#" && !string.IsNullOrWhiteSpace(match[0].Groups[4].Value))
|
||||
{
|
||||
blockItem.ThemeComponent = _masterComponentCollection.AddComponent(ThemeComponentType.FontSize, match[0].Groups[4].Value.Trim(), blockItem.Value);
|
||||
}
|
||||
block.BlockItems.Add(blockItem);
|
||||
themeComponentType = (int)ThemeComponentType.FontSize;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -237,49 +271,42 @@ namespace Filtration.Parser.Services
|
||||
RemoveExistingBlockItemsOfType<PositionalSoundBlockItem>(block);
|
||||
RemoveExistingBlockItemsOfType<CustomSoundBlockItem>(block);
|
||||
|
||||
var match = Regex.Match(trimmedLine, @"\S+\s+(\S+)\s?(\d+)?\s*([#]?)(.*)");
|
||||
|
||||
if (match.Success)
|
||||
{
|
||||
string firstValue = match.Groups[1].Value;
|
||||
int secondValue;
|
||||
|
||||
if (match.Groups[2].Success)
|
||||
{
|
||||
secondValue = Convert.ToInt16(match.Groups[2].Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
secondValue = 79;
|
||||
var match = Regex.Match(trimmedLine, @"\S+\s+(\S+)\s?(\d+)?");
|
||||
|
||||
if (match.Success)
|
||||
{
|
||||
string firstValue = match.Groups[1].Value;
|
||||
int secondValue;
|
||||
|
||||
if (match.Groups[2].Success)
|
||||
{
|
||||
secondValue = Convert.ToInt16(match.Groups[2].Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
secondValue = 79;
|
||||
}
|
||||
|
||||
ThemeComponent themeComponent = null;
|
||||
if(match.Groups[3].Value == "#" && !string.IsNullOrWhiteSpace(match.Groups[4].Value))
|
||||
{
|
||||
themeComponent = _masterComponentCollection.AddComponent(ThemeComponentType.AlertSound, match.Groups[4].Value.Trim(), firstValue, secondValue);
|
||||
}
|
||||
|
||||
if (lineOption == "PlayAlertSound")
|
||||
{
|
||||
var blockItemValue = new SoundBlockItem
|
||||
{
|
||||
Value = firstValue,
|
||||
SecondValue = secondValue
|
||||
};
|
||||
blockItemValue.ThemeComponent = themeComponent;
|
||||
block.BlockItems.Add(blockItemValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
var blockItemValue = new PositionalSoundBlockItem
|
||||
{
|
||||
Value = firstValue,
|
||||
SecondValue = secondValue
|
||||
};
|
||||
blockItemValue.ThemeComponent = themeComponent;
|
||||
block.BlockItems.Add(blockItemValue);
|
||||
}
|
||||
}
|
||||
if (lineOption == "PlayAlertSound")
|
||||
{
|
||||
var blockItemValue = new SoundBlockItem
|
||||
{
|
||||
Value = firstValue,
|
||||
SecondValue = secondValue
|
||||
};
|
||||
block.BlockItems.Add(blockItemValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
var blockItemValue = new PositionalSoundBlockItem
|
||||
{
|
||||
Value = firstValue,
|
||||
SecondValue = secondValue
|
||||
};
|
||||
block.BlockItems.Add(blockItemValue);
|
||||
}
|
||||
themeComponentType = (int)ThemeComponentType.AlertSound;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "GemLevel":
|
||||
@@ -314,54 +341,49 @@ namespace Filtration.Parser.Services
|
||||
{
|
||||
// Only ever use the last Icon item encountered as multiples aren't valid.
|
||||
RemoveExistingBlockItemsOfType<MapIconBlockItem>(block);
|
||||
|
||||
|
||||
// TODO: Get size, color, shape values programmatically
|
||||
var match = Regex.Match(trimmedLine,
|
||||
@"\S+\s+(0|1|2)\s+(Red|Green|Blue|Brown|White|Yellow)\s+(Circle|Diamond|Hexagon|Square|Star|Triangle)\s*([#]?)(.*)",
|
||||
RegexOptions.IgnoreCase);
|
||||
|
||||
if (match.Success)
|
||||
{
|
||||
var blockItemValue = new MapIconBlockItem
|
||||
{
|
||||
Size = (IconSize)Int16.Parse(match.Groups[1].Value),
|
||||
Color = EnumHelper.GetEnumValueFromDescription<IconColor>(match.Groups[2].Value),
|
||||
Shape = EnumHelper.GetEnumValueFromDescription<IconShape>(match.Groups[3].Value)
|
||||
|
||||
if (match.Success)
|
||||
{
|
||||
var blockItemValue = new MapIconBlockItem
|
||||
{
|
||||
Size = (IconSize)Int16.Parse(match.Groups[1].Value),
|
||||
Color = EnumHelper.GetEnumValueFromDescription<IconColor>(match.Groups[2].Value),
|
||||
Shape = EnumHelper.GetEnumValueFromDescription<IconShape>(match.Groups[3].Value)
|
||||
};
|
||||
|
||||
if(match.Groups[4].Value == "#" && !string.IsNullOrWhiteSpace(match.Groups[5].Value))
|
||||
{
|
||||
ThemeComponent themeComponent = _masterComponentCollection.AddComponent(ThemeComponentType.Icon, match.Groups[5].Value.Trim(),
|
||||
blockItemValue.Size, blockItemValue.Color, blockItemValue.Shape);
|
||||
blockItemValue.ThemeComponent = themeComponent;
|
||||
}
|
||||
block.BlockItems.Add(blockItemValue);
|
||||
}
|
||||
|
||||
if(match.Groups[4].Value == "#" && !string.IsNullOrWhiteSpace(match.Groups[5].Value))
|
||||
{
|
||||
ThemeComponent themeComponent = _masterComponentCollection.AddComponent(ThemeComponentType.Icon, match.Groups[5].Value.Trim(),
|
||||
blockItemValue.Size, blockItemValue.Color, blockItemValue.Shape);
|
||||
blockItemValue.ThemeComponent = themeComponent;
|
||||
}
|
||||
block.BlockItems.Add(blockItemValue);
|
||||
themeComponentType = (int)ThemeComponentType.Icon;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "PlayEffect":
|
||||
{
|
||||
// Only ever use the last BeamColor item encountered as multiples aren't valid.
|
||||
RemoveExistingBlockItemsOfType<PlayEffectBlockItem>(block);
|
||||
|
||||
|
||||
// TODO: Get colors programmatically
|
||||
var match = Regex.Match(trimmedLine, @"\S+\s+(Red|Green|Blue|Brown|White|Yellow)\s+(Temp)?\s*([#]?)(.*)", RegexOptions.IgnoreCase);
|
||||
|
||||
if (match.Success)
|
||||
{
|
||||
var blockItemValue = new PlayEffectBlockItem
|
||||
{
|
||||
Color = EnumHelper.GetEnumValueFromDescription<EffectColor>(match.Groups[1].Value),
|
||||
Temporary = match.Groups[2].Value.Trim().ToLower() == "temp"
|
||||
var match = Regex.Match(trimmedLine, @"\S+\s+(Red|Green|Blue|Brown|White|Yellow)\s*(Temp)?", RegexOptions.IgnoreCase);
|
||||
|
||||
if (match.Success)
|
||||
{
|
||||
var blockItemValue = new PlayEffectBlockItem
|
||||
{
|
||||
Color = EnumHelper.GetEnumValueFromDescription<EffectColor>(match.Groups[1].Value),
|
||||
Temporary = match.Groups[2].Value.Trim().ToLower() == "temp"
|
||||
};
|
||||
|
||||
if(match.Groups[3].Value == "#" && !string.IsNullOrWhiteSpace(match.Groups[4].Value))
|
||||
{
|
||||
ThemeComponent themeComponent = _masterComponentCollection.AddComponent(ThemeComponentType.Effect, match.Groups[4].Value.Trim(),
|
||||
blockItemValue.Color, blockItemValue.Temporary);
|
||||
blockItemValue.ThemeComponent = themeComponent;
|
||||
}
|
||||
block.BlockItems.Add(blockItemValue);
|
||||
block.BlockItems.Add(blockItemValue);
|
||||
themeComponentType = (int)ThemeComponentType.Effect;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -372,22 +394,17 @@ namespace Filtration.Parser.Services
|
||||
RemoveExistingBlockItemsOfType<SoundBlockItem>(block);
|
||||
RemoveExistingBlockItemsOfType<PositionalSoundBlockItem>(block);
|
||||
|
||||
var match = Regex.Match(trimmedLine, @"\S+\s+""(\S+)""\s*([#]?)(.*)");
|
||||
|
||||
if (match.Success)
|
||||
{
|
||||
var blockItemValue = new CustomSoundBlockItem
|
||||
{
|
||||
Value = match.Groups[1].Value
|
||||
var match = Regex.Match(trimmedLine, @"\S+\s+""([^\*\<\>\?|]+)""");
|
||||
|
||||
if (match.Success)
|
||||
{
|
||||
var blockItemValue = new CustomSoundBlockItem
|
||||
{
|
||||
Value = match.Groups[1].Value
|
||||
};
|
||||
|
||||
if(match.Groups[2].Value == "#" && !string.IsNullOrWhiteSpace(match.Groups[3].Value))
|
||||
{
|
||||
ThemeComponent themeComponent = _masterComponentCollection.AddComponent(ThemeComponentType.CustomSound, match.Groups[3].Value.Trim(), blockItemValue.Value);
|
||||
blockItemValue.ThemeComponent = themeComponent;
|
||||
}
|
||||
block.BlockItems.Add(blockItemValue);
|
||||
}
|
||||
block.BlockItems.Add(blockItemValue);
|
||||
themeComponentType = (int)ThemeComponentType.CustomSound;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "MapTier":
|
||||
@@ -396,8 +413,87 @@ namespace Filtration.Parser.Services
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(blockComment) && block.BlockItems.Count > 1)
|
||||
{
|
||||
var blockItemWithTheme = block.BlockItems.Last() as IBlockItemWithTheme;
|
||||
if(blockItemWithTheme == null)
|
||||
{
|
||||
block.BlockItems.Last().Comment = blockComment;
|
||||
}
|
||||
else
|
||||
{
|
||||
switch((ThemeComponentType)themeComponentType)
|
||||
{
|
||||
case ThemeComponentType.AlertSound:
|
||||
{
|
||||
ThemeComponent themeComponent = null;
|
||||
if(blockItemWithTheme is SoundBlockItem)
|
||||
{
|
||||
themeComponent = _masterComponentCollection.AddComponent(ThemeComponentType.AlertSound, blockComment.Trim(),
|
||||
((SoundBlockItem)blockItemWithTheme).Value, ((SoundBlockItem)blockItemWithTheme).SecondValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
themeComponent = _masterComponentCollection.AddComponent(ThemeComponentType.AlertSound, blockComment.Trim(),
|
||||
((PositionalSoundBlockItem)blockItemWithTheme).Value, ((PositionalSoundBlockItem)blockItemWithTheme).SecondValue);
|
||||
}
|
||||
blockItemWithTheme.ThemeComponent = themeComponent;
|
||||
break;
|
||||
}
|
||||
case ThemeComponentType.BackgroundColor:
|
||||
{
|
||||
ThemeComponent themeComponent = _masterComponentCollection.AddComponent(ThemeComponentType.BackgroundColor,
|
||||
blockComment.Trim(), ((BackgroundColorBlockItem)blockItemWithTheme).Color);
|
||||
blockItemWithTheme.ThemeComponent = themeComponent;
|
||||
break;
|
||||
}
|
||||
case ThemeComponentType.BorderColor:
|
||||
{
|
||||
ThemeComponent themeComponent = _masterComponentCollection.AddComponent(ThemeComponentType.BorderColor,
|
||||
blockComment.Trim(), ((BorderColorBlockItem)blockItemWithTheme).Color);
|
||||
blockItemWithTheme.ThemeComponent = themeComponent;
|
||||
break;
|
||||
}
|
||||
case ThemeComponentType.CustomSound:
|
||||
{
|
||||
ThemeComponent themeComponent = _masterComponentCollection.AddComponent(ThemeComponentType.CustomSound,
|
||||
blockComment.Trim(), ((CustomSoundBlockItem)blockItemWithTheme).Value);
|
||||
blockItemWithTheme.ThemeComponent = themeComponent;
|
||||
break;
|
||||
}
|
||||
case ThemeComponentType.Effect:
|
||||
{
|
||||
ThemeComponent themeComponent = _masterComponentCollection.AddComponent(ThemeComponentType.Effect,
|
||||
blockComment.Trim(), ((EffectColorBlockItem)blockItemWithTheme).Color, ((EffectColorBlockItem)blockItemWithTheme).Temporary);
|
||||
blockItemWithTheme.ThemeComponent = themeComponent;
|
||||
break;
|
||||
}
|
||||
case ThemeComponentType.FontSize:
|
||||
{
|
||||
ThemeComponent themeComponent = _masterComponentCollection.AddComponent(ThemeComponentType.FontSize,
|
||||
blockComment.Trim(), ((FontSizeBlockItem)blockItemWithTheme).Value);
|
||||
blockItemWithTheme.ThemeComponent = themeComponent;
|
||||
break;
|
||||
}
|
||||
case ThemeComponentType.Icon:
|
||||
{
|
||||
ThemeComponent themeComponent = _masterComponentCollection.AddComponent(ThemeComponentType.Icon, blockComment.Trim(),
|
||||
((IconBlockItem)blockItemWithTheme).Size, ((IconBlockItem)blockItemWithTheme).Color, ((IconBlockItem)blockItemWithTheme).Shape);
|
||||
blockItemWithTheme.ThemeComponent = themeComponent;
|
||||
break;
|
||||
}
|
||||
case ThemeComponentType.TextColor:
|
||||
{
|
||||
ThemeComponent themeComponent = _masterComponentCollection.AddComponent(ThemeComponentType.TextColor,
|
||||
blockComment.Trim(), ((TextColorBlockItem)blockItemWithTheme).Color);
|
||||
blockItemWithTheme.ThemeComponent = themeComponent;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
block.IsEdited = false;
|
||||
return block;
|
||||
}
|
||||
@@ -427,7 +523,7 @@ namespace Filtration.Parser.Services
|
||||
private static void AddNumericFilterPredicateItemToBlockItems<T>(IItemFilterBlock block, string inputString) where T : NumericFilterPredicateBlockItem
|
||||
{
|
||||
var blockItem = Activator.CreateInstance<T>();
|
||||
|
||||
|
||||
SetNumericFilterPredicateFromString(blockItem.FilterPredicate, inputString);
|
||||
block.BlockItems.Add(blockItem);
|
||||
}
|
||||
@@ -460,48 +556,6 @@ namespace Filtration.Parser.Services
|
||||
}
|
||||
}
|
||||
|
||||
private void AddColorItemToBlockItems<T>(IItemFilterBlock block, string inputString) where T : ColorBlockItem
|
||||
{
|
||||
block.BlockItems.Add(GetColorBlockItemFromString<T>(inputString));
|
||||
}
|
||||
|
||||
private T GetColorBlockItemFromString<T>(string inputString) where T: ColorBlockItem
|
||||
{
|
||||
var blockItem = Activator.CreateInstance<T>();
|
||||
var result = Regex.Matches(inputString, @"([\w\s]*)[#]?(.*)");
|
||||
|
||||
blockItem.Color = GetColorFromString(result[0].Groups[1].Value);
|
||||
|
||||
var componentName = result[0].Groups[2].Value.Trim();
|
||||
if (!string.IsNullOrEmpty(componentName))
|
||||
{
|
||||
ThemeComponentType componentType;
|
||||
if (typeof(T) == typeof(TextColorBlockItem))
|
||||
{
|
||||
componentType = ThemeComponentType.TextColor;
|
||||
}
|
||||
else if (typeof(T) == typeof(BackgroundColorBlockItem))
|
||||
{
|
||||
componentType = ThemeComponentType.BackgroundColor;
|
||||
}
|
||||
else if (typeof(T) == typeof(BorderColorBlockItem))
|
||||
{
|
||||
componentType = ThemeComponentType.BorderColor;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception("Parsing error - unknown theme component type");
|
||||
}
|
||||
if (_masterComponentCollection != null)
|
||||
{
|
||||
blockItem.ThemeComponent = _masterComponentCollection.AddComponent(componentType, componentName,
|
||||
blockItem.Color);
|
||||
}
|
||||
}
|
||||
|
||||
return blockItem;
|
||||
}
|
||||
|
||||
public void ReplaceAudioVisualBlockItemsFromString(ObservableCollection<IItemFilterBlockItem> blockItems, string inputString)
|
||||
{
|
||||
// Reverse iterate to remove existing IAudioVisualBlockItems
|
||||
@@ -516,42 +570,93 @@ namespace Filtration.Parser.Services
|
||||
foreach (var line in new LineReader(() => new StringReader(inputString)))
|
||||
{
|
||||
var matches = Regex.Match(line, @"(\w+)");
|
||||
|
||||
var blockComment = "";
|
||||
var trimmedLine = line.Trim();
|
||||
if (trimmedLine.IndexOf('#') > 0)
|
||||
{
|
||||
blockComment = trimmedLine.Substring(trimmedLine.IndexOf('#') + 1);
|
||||
trimmedLine = trimmedLine.Substring(0, trimmedLine.IndexOf('#')).Trim();
|
||||
}
|
||||
|
||||
switch (matches.Value)
|
||||
{
|
||||
case "PlayAlertSound":
|
||||
{
|
||||
var match = Regex.Match(line, @"\s+(\S+) (\d+)");
|
||||
var match = Regex.Match(trimmedLine, @"\s+(\S+) (\d+)");
|
||||
if (!match.Success) break;
|
||||
blockItems.Add(new SoundBlockItem(match.Groups[1].Value, Convert.ToInt16(match.Groups[2].Value)));
|
||||
var blockItem = new SoundBlockItem(match.Groups[1].Value, Convert.ToInt16(match.Groups[2].Value));
|
||||
if(_masterComponentCollection != null && !string.IsNullOrWhiteSpace(blockComment))
|
||||
{
|
||||
ThemeComponent themeComponent = _masterComponentCollection.AddComponent(ThemeComponentType.AlertSound,
|
||||
blockComment, blockItem.Value, blockItem.SecondValue);
|
||||
blockItem.ThemeComponent = themeComponent;
|
||||
}
|
||||
blockItems.Add(blockItem);
|
||||
break;
|
||||
}
|
||||
case "SetTextColor":
|
||||
{
|
||||
blockItems.Add(GetColorBlockItemFromString<TextColorBlockItem>(line));
|
||||
var result = Regex.Matches(trimmedLine, @"([\w\s]*)");
|
||||
|
||||
var blockItem = new TextColorBlockItem();
|
||||
blockItem.Color = GetColorFromString(result[0].Groups[1].Value);
|
||||
if(_masterComponentCollection != null && !string.IsNullOrWhiteSpace(blockComment))
|
||||
{
|
||||
ThemeComponent themeComponent = _masterComponentCollection.AddComponent(ThemeComponentType.TextColor,
|
||||
blockComment, blockItem.Color);
|
||||
blockItem.ThemeComponent = themeComponent;
|
||||
}
|
||||
blockItems.Add(blockItem);
|
||||
break;
|
||||
}
|
||||
case "SetBackgroundColor":
|
||||
{
|
||||
blockItems.Add(GetColorBlockItemFromString<BackgroundColorBlockItem>(line));
|
||||
var result = Regex.Matches(trimmedLine, @"([\w\s]*)");
|
||||
|
||||
var blockItem = new BackgroundColorBlockItem();
|
||||
blockItem.Color = GetColorFromString(result[0].Groups[1].Value);
|
||||
if(_masterComponentCollection != null && !string.IsNullOrWhiteSpace(blockComment))
|
||||
{
|
||||
ThemeComponent themeComponent = _masterComponentCollection.AddComponent(ThemeComponentType.BackgroundColor,
|
||||
blockComment, blockItem.Color);
|
||||
blockItem.ThemeComponent = themeComponent;
|
||||
}
|
||||
blockItems.Add(blockItem);
|
||||
break;
|
||||
}
|
||||
case "SetBorderColor":
|
||||
{
|
||||
blockItems.Add(GetColorBlockItemFromString<BorderColorBlockItem>(line));
|
||||
var result = Regex.Matches(trimmedLine, @"([\w\s]*)");
|
||||
|
||||
var blockItem = new BorderColorBlockItem();
|
||||
blockItem.Color = GetColorFromString(result[0].Groups[1].Value);
|
||||
if(_masterComponentCollection != null && !string.IsNullOrWhiteSpace(blockComment))
|
||||
{
|
||||
ThemeComponent themeComponent = _masterComponentCollection.AddComponent(ThemeComponentType.BorderColor,
|
||||
blockComment, blockItem.Color);
|
||||
blockItem.ThemeComponent = themeComponent;
|
||||
}
|
||||
blockItems.Add(blockItem);
|
||||
break;
|
||||
}
|
||||
case "SetFontSize":
|
||||
{
|
||||
var match = Regex.Match(line, @"\s+(\d+)");
|
||||
var match = Regex.Match(trimmedLine, @"\s+(\d+)");
|
||||
if (!match.Success) break;
|
||||
blockItems.Add(new FontSizeBlockItem(Convert.ToInt16(match.Value)));
|
||||
var blockItem = new FontSizeBlockItem(Convert.ToInt16(match.Value));
|
||||
if (_masterComponentCollection != null && !string.IsNullOrWhiteSpace(blockComment))
|
||||
{
|
||||
ThemeComponent themeComponent = _masterComponentCollection.AddComponent(ThemeComponentType.FontSize,
|
||||
blockComment, blockItem.Value);
|
||||
blockItem.ThemeComponent = themeComponent;
|
||||
}
|
||||
blockItems.Add(blockItem);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void AddBlockGroupToBlock(IItemFilterBlock block, string inputString)
|
||||
{
|
||||
var blockGroupText = GetTextAfterFirstComment(inputString);
|
||||
@@ -618,15 +723,15 @@ namespace Filtration.Parser.Services
|
||||
// TODO: Private
|
||||
public string TranslateItemFilterCommentBlockToString(IItemFilterCommentBlock itemFilterCommentBlock)
|
||||
{
|
||||
if (!itemFilterCommentBlock.IsEdited)
|
||||
{
|
||||
return itemFilterCommentBlock.OriginalText;
|
||||
if (!itemFilterCommentBlock.IsEdited)
|
||||
{
|
||||
return itemFilterCommentBlock.OriginalText;
|
||||
}
|
||||
|
||||
// TODO: Tests
|
||||
// TODO: # Section: text?
|
||||
var commentWithHashes = string.Empty;
|
||||
|
||||
var commentWithHashes = string.Empty;
|
||||
|
||||
// Add "# " to the beginning of each line of the comment before saving it
|
||||
foreach (var line in new LineReader(() => new StringReader(itemFilterCommentBlock.Comment)))
|
||||
{
|
||||
@@ -636,15 +741,15 @@ namespace Filtration.Parser.Services
|
||||
// Remove trailing newline
|
||||
return commentWithHashes.TrimEnd('\r', '\n');
|
||||
}
|
||||
|
||||
|
||||
// This method converts an ItemFilterBlock object into a string. This is used for copying a ItemFilterBlock
|
||||
// to the clipboard, and when saving a ItemFilterScript.
|
||||
// TODO: Private
|
||||
public string TranslateItemFilterBlockToString(IItemFilterBlock block)
|
||||
{
|
||||
if(!block.IsEdited)
|
||||
{
|
||||
return block.OriginalText;
|
||||
if(!block.IsEdited)
|
||||
{
|
||||
return block.OriginalText;
|
||||
}
|
||||
|
||||
var outputString = string.Empty;
|
||||
@@ -672,14 +777,14 @@ namespace Filtration.Parser.Services
|
||||
{
|
||||
outputString += (!block.Enabled ? _disabledNewLine : _newLine) + blockItem.OutputText;
|
||||
}
|
||||
}
|
||||
|
||||
//TODO: Disabled for the time being. A better solution is needed.
|
||||
// Replace 'Maelström' to prevent encoding problems in other editors
|
||||
//outputString.Replace("Maelström Staff", "Maelstr");
|
||||
//outputString.Replace("Maelström of Chaos", "Maelstr");
|
||||
//outputString.Replace("Maelström", "Maelstr");
|
||||
|
||||
}
|
||||
|
||||
//TODO: Disabled for the time being. A better solution is needed.
|
||||
// Replace 'Maelström' to prevent encoding problems in other editors
|
||||
//outputString.Replace("Maelström Staff", "Maelstr");
|
||||
//outputString.Replace("Maelström of Chaos", "Maelstr");
|
||||
//outputString.Replace("Maelström", "Maelstr");
|
||||
|
||||
return outputString;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows;
|
||||
using Filtration.Common.Utilities;
|
||||
using Filtration.ObjectModel;
|
||||
using Filtration.ObjectModel.Factories;
|
||||
@@ -48,18 +48,58 @@ namespace Filtration.Parser.Services
|
||||
_itemFilterScriptFactory = itemFilterScriptFactory;
|
||||
}
|
||||
|
||||
public static string PreprocessDisabledBlocks(string inputString)
|
||||
public static string PreprocessDisabledBlocks(string inputString, out List<bool> inBlock)
|
||||
{
|
||||
bool inDisabledBlock = false;
|
||||
inBlock = new List<bool>();
|
||||
|
||||
var lines = Regex.Split(inputString, "\r\n|\r|\n").ToList();
|
||||
// find first show/hide and check script
|
||||
for (var i = 0; i < lines.Count; i++)
|
||||
{
|
||||
inBlock.Add(false);
|
||||
lines[i] = lines[i].Trim();
|
||||
if(!lines[i].StartsWith("#"))
|
||||
{
|
||||
string curLine = Regex.Replace(lines[i], @"\s+", "");
|
||||
if ((curLine.StartsWith("Show") || curLine.StartsWith("Hide")) && (curLine.Length == 4 || curLine[4] == '#')) // found
|
||||
{
|
||||
inBlock[i] = true;
|
||||
break;
|
||||
}
|
||||
else // This means script has wrong syntax, just replace those lines with empty string
|
||||
{
|
||||
lines[i] = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// find remaining boundaries
|
||||
var lastInBlock = inBlock.Count - 1;
|
||||
for (var i = inBlock.Count; i < lines.Count; i++)
|
||||
{
|
||||
inBlock.Add(false);
|
||||
lines[i] = lines[i].Trim();
|
||||
if (!lines[i].StartsWith("#") && lines[i].Length > 0)
|
||||
{
|
||||
if (!lines[i].StartsWith("Show") && !lines[i].StartsWith("Hide")) // Continuing inline
|
||||
{
|
||||
for(int j = lastInBlock + 1; j < i; j++)
|
||||
{
|
||||
inBlock[j] = true;
|
||||
}
|
||||
}
|
||||
lastInBlock = i;
|
||||
inBlock[i] = true;
|
||||
}
|
||||
}
|
||||
|
||||
for (var i = 0; i < lines.Count; i++)
|
||||
{
|
||||
if (!inDisabledBlock && lines[i].StartsWith("#"))
|
||||
{
|
||||
string curLine = Regex.Replace(lines[i].Substring(1), @"\s+", "");
|
||||
if ((curLine.StartsWith("Show") || curLine.StartsWith("Hide")) && (curLine.Length == 4 || curLine[4] == '#'))
|
||||
if ((curLine.StartsWith("Show") || curLine.StartsWith("Hide")) && (curLine.Length == 4 || curLine[4] == '#') && !inBlock[i])
|
||||
{
|
||||
inDisabledBlock = true;
|
||||
lines[i] = lines[i].Substring(1).TrimStart(' ');
|
||||
@@ -88,16 +128,29 @@ namespace Filtration.Parser.Services
|
||||
var script = _itemFilterScriptFactory.Create();
|
||||
_blockGroupHierarchyBuilder.Initialise(script.ItemFilterBlockGroups.First());
|
||||
|
||||
//Remove old disabled tags
|
||||
inputString = Regex.Replace(inputString, @"#Disabled\sBlock\s(Start|End).*?\n", "");
|
||||
inputString = (inputString.EndsWith("\n#Disabled Block End")) ? inputString.Substring(0, inputString.Length - 19) : inputString;
|
||||
if(Regex.Matches(inputString, @"#Disabled\sBlock\s(Start|End).*?\n").Count > 0)
|
||||
{
|
||||
if (MessageBox.Show(
|
||||
"Loaded script contains special '#Disabled Block Start' lines." +
|
||||
" These may be coming from old versions of Filtration or Greengroove's filter." +
|
||||
"It is suggested to remove them however this may cause problems with original source" +
|
||||
Environment.NewLine + "(There is no in game effect of those lines)" +
|
||||
Environment.NewLine + Environment.NewLine + "Would you like to remove them?", "Special Comment Lines Found",
|
||||
MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.Yes)
|
||||
{
|
||||
//Remove old disabled tags
|
||||
inputString = Regex.Replace(inputString, @"#Disabled\sBlock\s(Start|End).*?\n", "");
|
||||
inputString = (inputString.EndsWith("\n#Disabled Block End")) ? inputString.Substring(0, inputString.Length - 19) : inputString;
|
||||
}
|
||||
}
|
||||
|
||||
var originalLines = Regex.Split(inputString, "\r\n|\r|\n");
|
||||
|
||||
inputString = inputString.Replace("\t", "");
|
||||
inputString = PreprocessDisabledBlocks(inputString);
|
||||
List<bool> inBlock;
|
||||
inputString = PreprocessDisabledBlocks(inputString, out inBlock);
|
||||
|
||||
var conditionBoundaries = IdentifyBlockBoundaries(inputString);
|
||||
var conditionBoundaries = IdentifyBlockBoundaries(inputString, inBlock);
|
||||
|
||||
var lines = Regex.Split(inputString, "\r\n|\r|\n");
|
||||
|
||||
@@ -158,7 +211,7 @@ namespace Filtration.Parser.Services
|
||||
return script;
|
||||
}
|
||||
|
||||
private static LinkedList<ItemFilterBlockBoundary> IdentifyBlockBoundaries(string inputString)
|
||||
private static LinkedList<ItemFilterBlockBoundary> IdentifyBlockBoundaries(string inputString, List<bool> inBlock)
|
||||
{
|
||||
var blockBoundaries = new LinkedList<ItemFilterBlockBoundary>();
|
||||
var previousLine = string.Empty;
|
||||
@@ -177,9 +230,10 @@ namespace Filtration.Parser.Services
|
||||
continue;
|
||||
}
|
||||
|
||||
// A line starting with a comment when we're inside a ItemFilterBlock boundary represents the end of that block
|
||||
// as ItemFilterBlocks cannot have comment lines after the block description
|
||||
if (trimmedLine.StartsWith("#") && currentItemFilterBlockBoundary.BoundaryType == ItemFilterBlockBoundaryType.ItemFilterBlock)
|
||||
// A line starting with a comment when we're inside a ItemFilterBlock boundary may represent the end of that block
|
||||
// or a block item comment
|
||||
if (trimmedLine.StartsWith("#") && !inBlock[currentLine] &&
|
||||
currentItemFilterBlockBoundary.BoundaryType == ItemFilterBlockBoundaryType.ItemFilterBlock)
|
||||
{
|
||||
blockBoundaries.AddLast(currentItemFilterBlockBoundary);
|
||||
currentItemFilterBlockBoundary = new ItemFilterBlockBoundary(currentLine, ItemFilterBlockBoundaryType.CommentBlock);
|
||||
|
||||
@@ -209,7 +209,7 @@ namespace Filtration.ThemeEditor.ViewModels
|
||||
Components.Add(new StrIntThemeComponent(themeComponentType, "Untitled Component", "1", 100));
|
||||
break;
|
||||
case ThemeComponentType.CustomSound:
|
||||
Components.Add(new StringThemeComponent(themeComponentType, "Untitled Component", "placeholder.mp3"));
|
||||
Components.Add(new StringThemeComponent(themeComponentType, "Untitled Component", ""));
|
||||
break;
|
||||
case ThemeComponentType.Icon:
|
||||
Components.Add(new IconThemeComponent(themeComponentType, "Untitled Component", IconSize.Largest, IconColor.Red, IconShape.Circle));
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace Filtration.Converters
|
||||
{
|
||||
if (values[0] == DependencyProperty.UnsetValue ||
|
||||
values[1] == DependencyProperty.UnsetValue)
|
||||
return null;
|
||||
return new Rect(0, 0, 0, 0);
|
||||
|
||||
var size = (int)(values[0]);
|
||||
var color = (int)(values[1]);
|
||||
|
||||
@@ -50,7 +50,7 @@ using System.Windows;
|
||||
// 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("0.18")]
|
||||
[assembly: AssemblyVersion("0.19")]
|
||||
|
||||
[assembly: InternalsVisibleTo("Filtration.Tests")]
|
||||
[assembly: InternalsVisibleTo("Filtration.ItemFilterPreview.Tests")]
|
||||
|
||||
|
Before Width: | Height: | Size: 100 KiB After Width: | Height: | Size: 106 KiB |
|
Before Width: | Height: | Size: 80 KiB After Width: | Height: | Size: 84 KiB |
|
Before Width: | Height: | Size: 99 KiB After Width: | Height: | Size: 107 KiB |
|
Before Width: | Height: | Size: 85 KiB After Width: | Height: | Size: 96 KiB |
|
Before Width: | Height: | Size: 80 KiB After Width: | Height: | Size: 83 KiB |
|
Before Width: | Height: | Size: 75 KiB After Width: | Height: | Size: 77 KiB |
@@ -9,7 +9,7 @@ Bows
|
||||
Claws
|
||||
Currency
|
||||
Daggers
|
||||
Delve Stackable Currency
|
||||
Delve Socketable Currency
|
||||
Divination Card
|
||||
Fishing Rods
|
||||
Flasks
|
||||
|
||||
@@ -251,6 +251,13 @@ namespace Filtration.ViewModels
|
||||
var newBlockItem = (IItemFilterBlockItem) Activator.CreateInstance(blockItemType);
|
||||
|
||||
newBlockItem.PropertyChanged += OnBlockItemChanged;
|
||||
|
||||
var customSoundBlockItem = newBlockItem as CustomSoundBlockItem;
|
||||
if(customSoundBlockItem != null && _parentScriptViewModel.CustomSoundsAvailable.Count > 0)
|
||||
{
|
||||
customSoundBlockItem.Value = _parentScriptViewModel.CustomSoundsAvailable[0];
|
||||
}
|
||||
|
||||
BlockItems.Add(newBlockItem);
|
||||
OnBlockItemChanged(this, EventArgs.Empty);
|
||||
IsDirty = true;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using Filtration.ObjectModel;
|
||||
using GalaSoft.MvvmLight.CommandWpf;
|
||||
using System;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace Filtration.ViewModels
|
||||
{
|
||||
@@ -61,7 +62,7 @@ namespace Filtration.ViewModels
|
||||
{
|
||||
string[] commentLines = ItemFilterCommentBlock.Comment.Split(new[] { Environment.NewLine }, StringSplitOptions.None);
|
||||
var titleOffset = 1;
|
||||
if (commentLines.Length > 1 && (commentLines[0].TrimStart(' ').StartsWith(@"============") || commentLines[0].TrimStart(' ').StartsWith(@"------------")))
|
||||
if (commentLines.Length > 1 && !Regex.Match(commentLines[0], "[a-zA-Z]+").Success)
|
||||
{
|
||||
titleOffset = 3;
|
||||
commentLines[0] = commentLines[1];
|
||||
|
||||
@@ -166,10 +166,22 @@ namespace Filtration.ViewModels
|
||||
|
||||
_viewItemFilterBlockViewModels = new ObservableCollection<IItemFilterBlockViewModelBase>();
|
||||
|
||||
_customSoundsAvailable = new ObservableCollection<string> {
|
||||
"1maybevaluable.mp3", "2currency.mp3", "3uniques.mp3", "4maps.mp3", "5highmaps.mp3",
|
||||
"6veryvaluable.mp3", "7chancing.mp3", "12leveling.mp3", "placeholder.mp3"
|
||||
};
|
||||
_customSoundsAvailable = new ObservableCollection<string>();
|
||||
|
||||
var poeFolderFiles = Directory.GetFiles(persistenceService.DefaultPathOfExileDirectory() + "\\").Where(
|
||||
s => s.EndsWith(".mp3")
|
||||
|| s.EndsWith(".wav")
|
||||
|| s.EndsWith(".wma")
|
||||
|| s.EndsWith(".3gp")
|
||||
|| s.EndsWith(".aag")
|
||||
|| s.EndsWith(".m4a")
|
||||
|| s.EndsWith(".ogg")
|
||||
).OrderBy(f => f);
|
||||
|
||||
foreach(var file in poeFolderFiles)
|
||||
{
|
||||
_customSoundsAvailable.Add(file.Replace(persistenceService.DefaultPathOfExileDirectory() + "\\", ""));
|
||||
}
|
||||
}
|
||||
|
||||
public void Initialise(IItemFilterScript itemFilterScript, bool newScript)
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
|
||||
Filtration is an editor for Path of Exile item filter scripts.
|
||||
|
||||
## Current Release (Released 2017-12-08)
|
||||
<b>Installer</b> <a href="https://github.com/ben-wallis/Filtration/releases/download/0.17/filtration_0.17_setup.exe">filtration_0.17_setup.exe</a>
|
||||
## Current Release (Released 2018-08-30)
|
||||
<b>Installer</b> <a href="https://github.com/ben-wallis/Filtration/releases/download/0.19/filtration_0.19_setup.exe">filtration_0.19_setup.exe</a>
|
||||
|
||||
<b>Zip File</b> <a href="https://github.com/ben-wallis/Filtration/releases/download/0.17/filtration_0.17.zip">filtration_0.17.zip</a>
|
||||
<b>Zip File</b> <a href="https://github.com/ben-wallis/Filtration/releases/download/0.19/filtration_0.19.zip">filtration_0.19.zip</a>
|
||||
|
||||
## System Requirements
|
||||
Filtration requires .NET Framework 4.6.1 installed.
|
||||
|
||||