Fix Show/Hide parsing

This commit is contained in:
azakhi 2019-03-18 13:52:02 +03:00
parent 444f09751a
commit 52b48156ba

View File

@ -61,8 +61,7 @@ namespace Filtration.Parser.Services
lines[i] = lines[i].Trim(); lines[i] = lines[i].Trim();
if(!lines[i].StartsWith("#")) if(!lines[i].StartsWith("#"))
{ {
string curLine = Regex.Replace(lines[i], @"\s+", ""); if ((lines[i].StartsWith("Show") || lines[i].StartsWith("Hide")) && (lines[i].Length == 4 || lines[i][4] == ' ')) // found
if ((curLine.StartsWith("Show") || curLine.StartsWith("Hide")) && (curLine.Length == 4 || curLine[4] == '#')) // found
{ {
inBlock[i] = true; inBlock[i] = true;
break; break;
@ -98,8 +97,8 @@ namespace Filtration.Parser.Services
{ {
if (!inDisabledBlock && lines[i].StartsWith("#")) if (!inDisabledBlock && lines[i].StartsWith("#"))
{ {
string curLine = Regex.Replace(lines[i].Substring(1), @"\s+", ""); string curLine = lines[i].Substring(1).Trim();
if ((curLine.StartsWith("Show") || curLine.StartsWith("Hide")) && (curLine.Length == 4 || curLine[4] == '#') && !inBlock[i]) if ((curLine.StartsWith("Show") || curLine.StartsWith("Hide")) && (curLine.Length == 4 || curLine[4] == ' ') && !inBlock[i])
{ {
inDisabledBlock = true; inDisabledBlock = true;
lines[i] = lines[i].Substring(1).TrimStart(' '); lines[i] = lines[i].Substring(1).TrimStart(' ');