Change syntax to match FilterBlast
Per @Greengroove's feedback, changing syntax to: [Show|Hide] # grp1 - grp2 - grp3 | mode mode can be any of these for the new Disable behavior: "Disable" "Comment" "Remove" (slightly different from FilterBlast impl) Any other mode is treated as the default behavior. Filtration always writes out as "Disable" or default (none) Also removed vestigal logging and comments.
This commit is contained in:
parent
8e5cd0045f
commit
07fc5588a7
|
@ -149,11 +149,6 @@ namespace Filtration.ObjectModel
|
|||
if (BlockGroup.IsChecked != Enabled)
|
||||
{
|
||||
Enabled = BlockGroup.IsChecked;
|
||||
// DFRICE
|
||||
Console.WriteLine("TOGGLE! ENABLED=" + (Enabled ? "YES" : "NO"));
|
||||
// This is a bit hacky. Enabled/Disabled isn't part of BlockItems,
|
||||
// but we want to piggy back on the Observerable aspect of it.
|
||||
// Just generate a change event for the Action (Show/Hide) block.
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
@ -396,11 +396,20 @@ namespace Filtration.Parser.Services
|
|||
|
||||
var blockGroupText = inputString.Substring(blockGroupStart + 1).TrimStart();
|
||||
|
||||
if (blockGroupText.StartsWith("!"))
|
||||
var blockGroupModeStart = blockGroupText.IndexOf("|", StringComparison.Ordinal);
|
||||
if (blockGroupModeStart >= 0)
|
||||
{
|
||||
block.DisableWithGroup = true;
|
||||
blockGroupText = blockGroupText.Substring(1);
|
||||
//block.Description = block.Description + "--DR--";
|
||||
var blockGroupMode = blockGroupText.Substring(blockGroupModeStart + 1).Trim();
|
||||
blockGroupText = blockGroupText.Substring(0, blockGroupModeStart);
|
||||
|
||||
// Compatible with http://filterblast.oversoul.xyz/item-filter-syntax.html#smartblocks
|
||||
// Except that REMOVE is just like COMMENT and DISABLE.
|
||||
if (blockGroupMode.Equals("Comment", StringComparison.OrdinalIgnoreCase) ||
|
||||
blockGroupMode.Equals("Remove", StringComparison.OrdinalIgnoreCase) ||
|
||||
blockGroupMode.Equals("Disable", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
block.DisableWithGroup = true;
|
||||
}
|
||||
}
|
||||
|
||||
var blockGroups = blockGroupText.Split('-').ToList();
|
||||
|
@ -469,7 +478,11 @@ namespace Filtration.Parser.Services
|
|||
|
||||
if (block.BlockGroup != null)
|
||||
{
|
||||
outputString += (block.DisableWithGroup ? " #! " : " # ") + block.BlockGroup;
|
||||
outputString += " # " + block.BlockGroup;
|
||||
if (block.DisableWithGroup)
|
||||
{
|
||||
outputString += " | Disable";
|
||||
}
|
||||
}
|
||||
|
||||
// ReSharper disable once LoopCanBeConvertedToQuery
|
||||
|
|
|
@ -4,7 +4,6 @@ using System.Collections.ObjectModel;
|
|||
using System.Collections.Specialized;
|
||||
using System.Linq;
|
||||
using System.Windows.Media;
|
||||
using Filtration.Common.ViewModels;
|
||||
using Filtration.ObjectModel;
|
||||
using Filtration.ObjectModel.BlockItemBaseTypes;
|
||||
using Filtration.ObjectModel.BlockItemTypes;
|
||||
|
@ -370,7 +369,6 @@ namespace Filtration.ViewModels
|
|||
{
|
||||
IsDirty = true;
|
||||
RaisePropertyChanged(nameof(BlockEnabled));
|
||||
Console.WriteLine("OnBlockChanged");
|
||||
}
|
||||
|
||||
public void RefreshBlockPreview()
|
||||
|
|
Loading…
Reference in New Issue