Improve pasting to support different copy sources

This commit is contained in:
azakhi
2018-09-04 14:18:11 +03:00
parent 2ff9ebf242
commit 69ce542c1a
7 changed files with 95 additions and 41 deletions

View File

@@ -210,7 +210,18 @@ namespace Filtration.Parser.Services
_blockGroupHierarchyBuilder.Cleanup();
return script;
}
public IItemFilterScript TranslatePastedStringToItemFilterScript(string inputString, bool blockGroupsEnabled)
{
//Remove old disabled tags to prevent messagebox on paste
inputString = Regex.Replace(inputString, @"#Disabled\sBlock\s(Start|End).*?\n", "");
inputString = (inputString.EndsWith("\n#Disabled Block End")) ? inputString.Substring(0, inputString.Length - 19) : inputString;
inputString = (blockGroupsEnabled ? "# EnableBlockGroups" : "#") + Environment.NewLine + Environment.NewLine + inputString;
return TranslateStringToItemFilterScript(inputString);
}
private static LinkedList<ItemFilterBlockBoundary> IdentifyBlockBoundaries(string inputString, List<bool> inBlock)
{
var blockBoundaries = new LinkedList<ItemFilterBlockBoundary>();