Merge pull request #62 from GlenCFL/fix-reopen
Fix the reading of CustomAlertSounds containing path separators.
This commit is contained in:
commit
1e26a2ae3e
|
@ -1306,6 +1306,86 @@ namespace Filtration.Parser.Tests.Services
|
||||||
Assert.AreEqual(ItemRarity.Magic, (ItemRarity)rarityBlockItem.FilterPredicate.PredicateOperand);
|
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]
|
[Test]
|
||||||
public void TranslateItemFilterBlockToString_NothingPopulated_ReturnsCorrectString()
|
public void TranslateItemFilterBlockToString_NothingPopulated_ReturnsCorrectString()
|
||||||
{
|
{
|
||||||
|
|
|
@ -394,7 +394,7 @@ namespace Filtration.Parser.Services
|
||||||
RemoveExistingBlockItemsOfType<SoundBlockItem>(block);
|
RemoveExistingBlockItemsOfType<SoundBlockItem>(block);
|
||||||
RemoveExistingBlockItemsOfType<PositionalSoundBlockItem>(block);
|
RemoveExistingBlockItemsOfType<PositionalSoundBlockItem>(block);
|
||||||
|
|
||||||
var match = Regex.Match(trimmedLine, @"\S+\s+""(\S+)""");
|
var match = Regex.Match(trimmedLine, @"\S+\s+""([^\*\<\>\?|]+)""");
|
||||||
|
|
||||||
if (match.Success)
|
if (match.Success)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue