Fix the reading of CustomAlertSounds containing path separators.
This commit is contained in:
parent
7162e16b49
commit
24df1d7687
|
@ -1271,6 +1271,86 @@ namespace Filtration.Parser.Tests.Services
|
|||
Assert.AreEqual(ItemRarity.Rare, (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 TranslateStringToItemFilterBlock_SpecificTest_2()
|
||||
{
|
||||
|
|
|
@ -394,7 +394,7 @@ namespace Filtration.Parser.Services
|
|||
RemoveExistingBlockItemsOfType<SoundBlockItem>(block);
|
||||
RemoveExistingBlockItemsOfType<PositionalSoundBlockItem>(block);
|
||||
|
||||
var match = Regex.Match(trimmedLine, @"\S+\s+""(\S+)""");
|
||||
var match = Regex.Match(trimmedLine, @"\S+\s+""([^\*\<\>\?|]+)""");
|
||||
|
||||
if (match.Success)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue