Add Custom Sound block

This commit is contained in:
azakhi
2018-08-27 22:43:01 +03:00
parent 1e9b1158bd
commit 2958d93b33
7 changed files with 154 additions and 5 deletions

View File

@@ -235,6 +235,7 @@ namespace Filtration.Parser.Services
// Only ever use the last PlayAlertSound item encountered as multiples aren't valid.
RemoveExistingBlockItemsOfType<SoundBlockItem>(block);
RemoveExistingBlockItemsOfType<PositionalSoundBlockItem>(block);
RemoveExistingBlockItemsOfType<CustomSoundBlockItem>(block);
var match = Regex.Match(trimmedLine, @"\S+\s+(\S+)\s?(\d+)?\s*([#]?)(.*)");
@@ -314,7 +315,7 @@ namespace Filtration.Parser.Services
// Only ever use the last Icon item encountered as multiples aren't valid.
RemoveExistingBlockItemsOfType<IconBlockItem>(block);
var match = Regex.Match(trimmedLine, @"\S+\s+(\S+)");
var match = Regex.Match(trimmedLine, @"\S+\s+""(\S+)""");
if (match.Success)
{
@@ -341,6 +342,25 @@ namespace Filtration.Parser.Services
block.BlockItems.Add(beamBlockItem);
break;
}
case "CustomAlertSound":
{
// Only ever use the last CustomSoundBlockItem item encountered as multiples aren't valid.
RemoveExistingBlockItemsOfType<CustomSoundBlockItem>(block);
RemoveExistingBlockItemsOfType<SoundBlockItem>(block);
RemoveExistingBlockItemsOfType<PositionalSoundBlockItem>(block);
var match = Regex.Match(trimmedLine, @"\S+\s+""(\S+)""");
if (match.Success)
{
var blockItemValue = new CustomSoundBlockItem
{
Value = match.Groups[1].Value
};
block.BlockItems.Add(blockItemValue);
}
break;
}
}
}