Improve parsing & bug fixes
This commit is contained in:
parent
e5209fb459
commit
7fb9378304
|
@ -312,6 +312,7 @@ namespace Filtration.Parser.Services
|
|||
|
||||
private static void AddBooleanItemToBlockItems<T>(IItemFilterBlock block, string inputString) where T : BooleanBlockItem
|
||||
{
|
||||
inputString = Regex.Replace(inputString, @"\s+", " ");
|
||||
var blockItem = Activator.CreateInstance<T>();
|
||||
var splitString = inputString.Split(' ');
|
||||
if (splitString.Length == 2)
|
||||
|
|
|
@ -115,9 +115,10 @@ namespace Filtration.Parser.Services
|
|||
var parsingCommented = false;
|
||||
for (var i = 0; i < lines.Length; i++)
|
||||
{
|
||||
if (!parsingCommented)
|
||||
if (!parsingCommented && lines[i].StartsWith("#"))
|
||||
{
|
||||
if (lines[i].StartsWith("# Show") || lines[i].StartsWith("#Show"))
|
||||
string curLine = Regex.Replace(lines[i].Substring(1), @"\s+", "");
|
||||
if ((curLine.StartsWith("Show") || curLine.StartsWith("Hide")) && (curLine.Length == 4 || curLine[4] == '#'))
|
||||
{
|
||||
parsingCommented = true;
|
||||
lines[i] = "#Disabled Block Start" + Environment.NewLine + lines[i];
|
||||
|
@ -125,7 +126,7 @@ namespace Filtration.Parser.Services
|
|||
}
|
||||
else
|
||||
{
|
||||
if (!lines[i].StartsWith("#"))
|
||||
if (parsingCommented && !lines[i].StartsWith("#"))
|
||||
{
|
||||
parsingCommented = false;
|
||||
lines[i - 1] += Environment.NewLine + "#Disabled Block End";
|
||||
|
@ -145,8 +146,8 @@ namespace Filtration.Parser.Services
|
|||
var script = _itemFilterScriptFactory.Create();
|
||||
_blockGroupHierarchyBuilder.Initialise(script.ItemFilterBlockGroups.First());
|
||||
|
||||
//NeverSink's Indepth Loot Filter parsing
|
||||
if (inputString.Contains("NeverSink's Indepth Loot Filter"))
|
||||
//Check for possible different disabled block syntaxes if the script is not from Filtration
|
||||
if (!inputString.Contains("Script edited with Filtration"))
|
||||
{
|
||||
inputString = ConvertCommentedToDisabled(inputString);
|
||||
}
|
||||
|
@ -304,13 +305,6 @@ namespace Filtration.Parser.Services
|
|||
}
|
||||
}
|
||||
|
||||
//NeverSink's Indepth Loot Filter parsing
|
||||
if (outputString.Contains("NeverSink's Indepth Loot Filter"))
|
||||
{
|
||||
outputString = Regex.Replace(outputString, "(\r)?\n#Disabled Block Start*(\r)?\n", Environment.NewLine);
|
||||
outputString = Regex.Replace(outputString, "(\r)?\n#Disabled Block End*(\r)?\n", Environment.NewLine);
|
||||
}
|
||||
|
||||
return outputString;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,7 +59,7 @@ namespace Filtration.ViewModels
|
|||
{
|
||||
string[] commentLines = ItemFilterCommentBlock.Comment.Split(new[] { Environment.NewLine }, StringSplitOptions.None);
|
||||
var titleOffset = 1;
|
||||
if (commentLines.Length > 1 && (commentLines[0].StartsWith(@"============") || commentLines[0].StartsWith(@"------------")))
|
||||
if (commentLines.Length > 1 && (commentLines[0].TrimStart(' ').StartsWith(@"============") || commentLines[0].TrimStart(' ').StartsWith(@"------------")))
|
||||
{
|
||||
titleOffset = 3;
|
||||
commentLines[0] = commentLines[1];
|
||||
|
|
Loading…
Reference in New Issue