Added support for Identified (Issue #34) and Corrupted (Issue #42) block items

Changed block item output order (Issue #41)
This commit is contained in:
Ben Wallis
2016-12-03 11:58:18 +00:00
parent e7a40c8c6d
commit 884651bce9
31 changed files with 287 additions and 51 deletions

View File

@@ -129,6 +129,16 @@ namespace Filtration.Parser.Services
AddStringListItemToBlockItems<BaseTypeBlockItem>(block, trimmedLine);
break;
}
case "Corrupted":
{
AddBooleanItemToBlockItems<CorruptedBlockItem>(block, trimmedLine);
break;
}
case "Identified":
{
AddBooleanItemToBlockItems<IdentifiedBlockItem>(block, trimmedLine);
break;
}
case "Sockets":
{
AddNumericFilterPredicateItemToBlockItems<SocketsBlockItem>(block, trimmedLine);
@@ -240,6 +250,17 @@ namespace Filtration.Parser.Services
}
}
private static void AddBooleanItemToBlockItems<T>(IItemFilterBlock block, string inputString) where T : BooleanBlockItem
{
var blockItem = Activator.CreateInstance<T>();
var splitString = inputString.Split(' ');
if (splitString.Length == 2)
{
blockItem.BooleanValue = splitString[1].Trim().ToLowerInvariant() == "true";
block.BlockItems.Add(blockItem);
}
}
private static void AddNumericFilterPredicateItemToBlockItems<T>(IItemFilterBlock block, string inputString) where T : NumericFilterPredicateBlockItem
{
var blockItem = Activator.CreateInstance<T>();