Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
58de6f06b9 | ||
|
|
af2dace29a | ||
|
|
59cf604430 | ||
|
|
93a51e7829 | ||
|
|
9d928a374a | ||
|
|
b5788504cb | ||
|
|
6e71005e93 | ||
|
|
56e163e3e0 | ||
|
|
c856bbcee7 | ||
|
|
490496f2f7 | ||
|
|
9fcb609a51 |
@@ -13,8 +13,10 @@ namespace Filtration.ObjectModel
|
|||||||
public ItemFilterBlock()
|
public ItemFilterBlock()
|
||||||
{
|
{
|
||||||
BlockItems = new ObservableCollection<IItemFilterBlockItem> {new ActionBlockItem(BlockAction.Show)};
|
BlockItems = new ObservableCollection<IItemFilterBlockItem> {new ActionBlockItem(BlockAction.Show)};
|
||||||
|
Enabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool Enabled { get; set; }
|
||||||
public string Description { get; set; }
|
public string Description { get; set; }
|
||||||
|
|
||||||
public ItemFilterBlockGroup BlockGroup
|
public ItemFilterBlockGroup BlockGroup
|
||||||
|
|||||||
@@ -25,6 +25,36 @@ namespace Filtration.Tests.Translators
|
|||||||
_testUtility = new ItemFilterBlockTranslatorTestUtility();
|
_testUtility = new ItemFilterBlockTranslatorTestUtility();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TranslateStringToItemFilterBlock_NotDisabled_SetsBlockEnabledTrue()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var inputString = "Show" + Environment.NewLine +
|
||||||
|
" ItemLevel >= 55";
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, null);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.AreEqual(true, result.Enabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TranslateStringToItemFilterBlock_DisabledBlock_SetsBlockEnabledFalse()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var inputString = "HideDisabled" + Environment.NewLine +
|
||||||
|
" ItemLevel >= 55";
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, null);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.AreEqual(2, result.BlockItems.Count);
|
||||||
|
Assert.AreEqual(BlockAction.Hide, result.Action);
|
||||||
|
Assert.AreEqual(false, result.Enabled);
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TranslateStringToItemFilterBlock_NoDescriptionComment_ReturnsCorrectObject()
|
public void TranslateStringToItemFilterBlock_NoDescriptionComment_ReturnsCorrectObject()
|
||||||
{
|
{
|
||||||
@@ -1264,6 +1294,26 @@ namespace Filtration.Tests.Translators
|
|||||||
Assert.AreEqual(expectedResult, result);
|
Assert.AreEqual(expectedResult, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TranslateItemFilterBlockToString_DisabledBlock_ReturnsCorrectString()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var expectedResult = "#Disabled Block Start" + Environment.NewLine +
|
||||||
|
"#Show" + Environment.NewLine +
|
||||||
|
"# Width = 4" + Environment.NewLine +
|
||||||
|
"#Disabled Block End";
|
||||||
|
|
||||||
|
|
||||||
|
_testUtility.TestBlock.Enabled = false;
|
||||||
|
_testUtility.TestBlock.BlockItems.Add(new WidthBlockItem(FilterPredicateOperator.Equal, 4));
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var result = _testUtility.Translator.TranslateItemFilterBlockToString(_testUtility.TestBlock);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.AreEqual(expectedResult, result);
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TranslateItemFilterBlockToString_Everything_ReturnsCorrectString()
|
public void TranslateItemFilterBlockToString_Everything_ReturnsCorrectString()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -253,6 +253,139 @@ namespace Filtration.Tests.Translators
|
|||||||
Assert.IsNullOrEmpty(firstBlock.Description);
|
Assert.IsNullOrEmpty(firstBlock.Description);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TranslateStringToItemFilterScript_DisabledBlock_ReturnsCorrectBlockCount()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var testInputScript = "Show" + Environment.NewLine +
|
||||||
|
" ItemLevel > 2" + Environment.NewLine +
|
||||||
|
" SetTextColor 255 40 0" + Environment.NewLine +
|
||||||
|
Environment.NewLine +
|
||||||
|
"#Disabled Block Start" + Environment.NewLine +
|
||||||
|
"#Show" + Environment.NewLine +
|
||||||
|
"# ItemLevel > 2" + Environment.NewLine +
|
||||||
|
"# SetTextColor 255 215 0" + Environment.NewLine +
|
||||||
|
"# SetBorderColor 255 105 180" + Environment.NewLine +
|
||||||
|
"# SetFontSize 32" + Environment.NewLine +
|
||||||
|
"#Disabled Block End" + Environment.NewLine +
|
||||||
|
Environment.NewLine +
|
||||||
|
"Show" + Environment.NewLine +
|
||||||
|
" ItemLevel > 20" + Environment.NewLine +
|
||||||
|
" SetTextColor 255 255 0";
|
||||||
|
|
||||||
|
|
||||||
|
var blockTranslator = new ItemFilterBlockTranslator(_testUtility.MockBlockGroupHierarchyBuilder.Object);
|
||||||
|
var translator = new ItemFilterScriptTranslator(blockTranslator,
|
||||||
|
_testUtility.MockBlockGroupHierarchyBuilder.Object);
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var result = translator.TranslateStringToItemFilterScript(testInputScript);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.AreEqual(3, result.ItemFilterBlocks.Count);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TranslateStringToItemFilterScript_DisabledBlock_ReturnsCorrectBlocks()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var testInputScript = "Show" + Environment.NewLine +
|
||||||
|
" ItemLevel > 2" + Environment.NewLine +
|
||||||
|
" SetTextColor 255 40 0" + Environment.NewLine +
|
||||||
|
Environment.NewLine +
|
||||||
|
"#Disabled Block Start" + Environment.NewLine +
|
||||||
|
"#Show" + Environment.NewLine +
|
||||||
|
"# ItemLevel > 2" + Environment.NewLine +
|
||||||
|
"# SetTextColor 255 215 0" + Environment.NewLine +
|
||||||
|
"# SetBorderColor 255 105 180" + Environment.NewLine +
|
||||||
|
"# SetFontSize 32" + Environment.NewLine +
|
||||||
|
"#Disabled Block End" + Environment.NewLine +
|
||||||
|
Environment.NewLine +
|
||||||
|
"Show" + Environment.NewLine +
|
||||||
|
" ItemLevel > 20" + Environment.NewLine +
|
||||||
|
" SetTextColor 255 255 0";
|
||||||
|
|
||||||
|
|
||||||
|
var blockTranslator = new ItemFilterBlockTranslator(_testUtility.MockBlockGroupHierarchyBuilder.Object);
|
||||||
|
var translator = new ItemFilterScriptTranslator(blockTranslator,
|
||||||
|
_testUtility.MockBlockGroupHierarchyBuilder.Object);
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var result = translator.TranslateStringToItemFilterScript(testInputScript);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.AreEqual(3, result.ItemFilterBlocks.Count);
|
||||||
|
|
||||||
|
var firstBlock = result.ItemFilterBlocks.First();
|
||||||
|
var secondBlock = result.ItemFilterBlocks.Skip(1).First();
|
||||||
|
var thirdBlock = result.ItemFilterBlocks.Skip(2).First();
|
||||||
|
|
||||||
|
Assert.AreEqual(3, firstBlock.BlockItems.Count);
|
||||||
|
Assert.AreEqual(5, secondBlock.BlockItems.Count);
|
||||||
|
Assert.AreEqual(3, thirdBlock.BlockItems.Count);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TranslateStringToItemFilterScript_DisabledBlock_BlockDescriptionNotLost()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var testInputScript = "Show" + Environment.NewLine +
|
||||||
|
" ItemLevel > 2" + Environment.NewLine +
|
||||||
|
" SetTextColor 255 40 0" + Environment.NewLine +
|
||||||
|
Environment.NewLine +
|
||||||
|
"#Disabled Block Start" + Environment.NewLine +
|
||||||
|
"# This is a disabled block" + Environment.NewLine +
|
||||||
|
"#Show" + Environment.NewLine +
|
||||||
|
"# ItemLevel > 2" + Environment.NewLine +
|
||||||
|
"#Disabled Block End";
|
||||||
|
|
||||||
|
|
||||||
|
var blockTranslator = new ItemFilterBlockTranslator(_testUtility.MockBlockGroupHierarchyBuilder.Object);
|
||||||
|
var translator = new ItemFilterScriptTranslator(blockTranslator,
|
||||||
|
_testUtility.MockBlockGroupHierarchyBuilder.Object);
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var result = translator.TranslateStringToItemFilterScript(testInputScript);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.AreEqual(2, result.ItemFilterBlocks.Count);
|
||||||
|
var secondBlock = result.ItemFilterBlocks.Skip(1).First();
|
||||||
|
Assert.AreEqual("This is a disabled block", secondBlock.Description);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TranslateStringToItemFilterScript_DisabledBlockWithBlockGroup_ReturnsCorrectBlock()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var testInputScript = "Show" + Environment.NewLine +
|
||||||
|
" ItemLevel > 2" + Environment.NewLine +
|
||||||
|
" SetTextColor 255 40 0" + Environment.NewLine +
|
||||||
|
Environment.NewLine +
|
||||||
|
"#Disabled Block Start" + Environment.NewLine +
|
||||||
|
"# This is a disabled block" + Environment.NewLine +
|
||||||
|
"#Show#My Block Group" + Environment.NewLine +
|
||||||
|
"# ItemLevel > 2" + Environment.NewLine +
|
||||||
|
"#Disabled Block End";
|
||||||
|
|
||||||
|
|
||||||
|
var blockTranslator = new ItemFilterBlockTranslator(_testUtility.MockBlockGroupHierarchyBuilder.Object);
|
||||||
|
_testUtility.MockBlockGroupHierarchyBuilder.Setup(
|
||||||
|
b => b.IntegrateStringListIntoBlockGroupHierarchy(It.IsAny<IEnumerable<string>>()))
|
||||||
|
.Returns(new ItemFilterBlockGroup("My Block Group", null));
|
||||||
|
|
||||||
|
var translator = new ItemFilterScriptTranslator(blockTranslator,
|
||||||
|
_testUtility.MockBlockGroupHierarchyBuilder.Object);
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var result = translator.TranslateStringToItemFilterScript(testInputScript);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.AreEqual(2, result.ItemFilterBlocks.Count);
|
||||||
|
var secondBlock = result.ItemFilterBlocks.Skip(1).First();
|
||||||
|
Assert.AreEqual("This is a disabled block", secondBlock.Description);
|
||||||
|
Assert.AreEqual("My Block Group", secondBlock.BlockGroup.GroupName);
|
||||||
|
}
|
||||||
|
|
||||||
private class ItemFilterScriptTranslatorTestUtility
|
private class ItemFilterScriptTranslatorTestUtility
|
||||||
{
|
{
|
||||||
public ItemFilterScriptTranslatorTestUtility()
|
public ItemFilterScriptTranslatorTestUtility()
|
||||||
|
|||||||
@@ -429,6 +429,8 @@
|
|||||||
<Resource Include="Resources\Icons\filtration_icon.png" />
|
<Resource Include="Resources\Icons\filtration_icon.png" />
|
||||||
<Resource Include="Resources\Icons\Add.ico" />
|
<Resource Include="Resources\Icons\Add.ico" />
|
||||||
<Resource Include="Resources\Icons\ThemeComponentDelete.ico" />
|
<Resource Include="Resources\Icons\ThemeComponentDelete.ico" />
|
||||||
|
<Resource Include="Resources\Icons\standby_disabled_icon.png" />
|
||||||
|
<Resource Include="Resources\Icons\standby_enabled_icon.png" />
|
||||||
<Content Include="Resources\ItemBaseTypes.txt">
|
<Content Include="Resources\ItemBaseTypes.txt">
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ using System.Windows;
|
|||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("0.6.*")]
|
[assembly: AssemblyVersion("0.8.*")]
|
||||||
|
|
||||||
[assembly: InternalsVisibleTo("Filtration.Tests")]
|
[assembly: InternalsVisibleTo("Filtration.Tests")]
|
||||||
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")]
|
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")]
|
||||||
BIN
Filtration/Resources/Icons/standby_disabled_icon.png
Normal file
BIN
Filtration/Resources/Icons/standby_disabled_icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.2 KiB |
BIN
Filtration/Resources/Icons/standby_enabled_icon.png
Normal file
BIN
Filtration/Resources/Icons/standby_enabled_icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.4 KiB |
@@ -35,3 +35,4 @@ Map Fragments
|
|||||||
Hideout Doodads
|
Hideout Doodads
|
||||||
Microtransactions
|
Microtransactions
|
||||||
Divination Card
|
Divination Card
|
||||||
|
Jewel
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
using System.Collections.Generic;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Windows;
|
||||||
using Filtration.Common.Services;
|
using Filtration.Common.Services;
|
||||||
using Filtration.Utilities;
|
using Filtration.Utilities;
|
||||||
|
|
||||||
@@ -28,10 +30,10 @@ namespace Filtration.Services
|
|||||||
|
|
||||||
private void PopulateStaticData()
|
private void PopulateStaticData()
|
||||||
{
|
{
|
||||||
var itemBaseTypes = _fileSystemService.ReadFileAsString("Resources\\ItemBaseTypes.txt");
|
var itemBaseTypes = _fileSystemService.ReadFileAsString(AppDomain.CurrentDomain.BaseDirectory + "\\Resources\\ItemBaseTypes.txt");
|
||||||
ItemBaseTypes = new LineReader(() => new StringReader(itemBaseTypes)).ToList();
|
ItemBaseTypes = new LineReader(() => new StringReader(itemBaseTypes)).ToList();
|
||||||
|
|
||||||
var itemClasses = _fileSystemService.ReadFileAsString("Resources\\ItemClasses.txt");
|
var itemClasses = _fileSystemService.ReadFileAsString(AppDomain.CurrentDomain.BaseDirectory + "\\Resources\\ItemClasses.txt");
|
||||||
ItemClasses = new LineReader(() => new StringReader(itemClasses)).ToList();
|
ItemClasses = new LineReader(() => new StringReader(itemClasses)).ToList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ namespace Filtration.Translators
|
|||||||
private readonly IBlockGroupHierarchyBuilder _blockGroupHierarchyBuilder;
|
private readonly IBlockGroupHierarchyBuilder _blockGroupHierarchyBuilder;
|
||||||
private const string Indent = " ";
|
private const string Indent = " ";
|
||||||
private readonly string _newLine = Environment.NewLine + Indent;
|
private readonly string _newLine = Environment.NewLine + Indent;
|
||||||
|
private readonly string _disabledNewLine = Environment.NewLine + "#" + Indent;
|
||||||
private ThemeComponentCollection _masterComponentCollection;
|
private ThemeComponentCollection _masterComponentCollection;
|
||||||
|
|
||||||
public ItemFilterBlockTranslator(IBlockGroupHierarchyBuilder blockGroupHierarchyBuilder)
|
public ItemFilterBlockTranslator(IBlockGroupHierarchyBuilder blockGroupHierarchyBuilder)
|
||||||
@@ -42,6 +43,7 @@ namespace Filtration.Translators
|
|||||||
_masterComponentCollection = masterComponentCollection;
|
_masterComponentCollection = masterComponentCollection;
|
||||||
var block = new ItemFilterBlock();
|
var block = new ItemFilterBlock();
|
||||||
var showHideFound = false;
|
var showHideFound = false;
|
||||||
|
|
||||||
foreach (var line in new LineReader(() => new StringReader(inputString)))
|
foreach (var line in new LineReader(() => new StringReader(inputString)))
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -62,6 +64,7 @@ namespace Filtration.Translators
|
|||||||
|
|
||||||
var adjustedLine = line.Replace("#", " # ");
|
var adjustedLine = line.Replace("#", " # ");
|
||||||
var trimmedLine = adjustedLine.TrimStart(' ');
|
var trimmedLine = adjustedLine.TrimStart(' ');
|
||||||
|
|
||||||
var spaceOrEndOfLinePos = trimmedLine.IndexOf(" ", StringComparison.Ordinal) > 0 ? trimmedLine.IndexOf(" ", StringComparison.Ordinal) : trimmedLine.Length;
|
var spaceOrEndOfLinePos = trimmedLine.IndexOf(" ", StringComparison.Ordinal) > 0 ? trimmedLine.IndexOf(" ", StringComparison.Ordinal) : trimmedLine.Length;
|
||||||
|
|
||||||
var lineOption = trimmedLine.Substring(0, spaceOrEndOfLinePos);
|
var lineOption = trimmedLine.Substring(0, spaceOrEndOfLinePos);
|
||||||
@@ -70,11 +73,25 @@ namespace Filtration.Translators
|
|||||||
case "Show":
|
case "Show":
|
||||||
showHideFound = true;
|
showHideFound = true;
|
||||||
block.Action = BlockAction.Show;
|
block.Action = BlockAction.Show;
|
||||||
|
block.Enabled = true;
|
||||||
AddBlockGroupToBlock(block, trimmedLine);
|
AddBlockGroupToBlock(block, trimmedLine);
|
||||||
break;
|
break;
|
||||||
case "Hide":
|
case "Hide":
|
||||||
showHideFound = true;
|
showHideFound = true;
|
||||||
block.Action = BlockAction.Hide;
|
block.Action = BlockAction.Hide;
|
||||||
|
block.Enabled = true;
|
||||||
|
AddBlockGroupToBlock(block, trimmedLine);
|
||||||
|
break;
|
||||||
|
case "ShowDisabled":
|
||||||
|
showHideFound = true;
|
||||||
|
block.Action = BlockAction.Show;
|
||||||
|
block.Enabled = false;
|
||||||
|
AddBlockGroupToBlock(block, trimmedLine);
|
||||||
|
break;
|
||||||
|
case "HideDisabled":
|
||||||
|
showHideFound = true;
|
||||||
|
block.Action = BlockAction.Hide;
|
||||||
|
block.Enabled = false;
|
||||||
AddBlockGroupToBlock(block, trimmedLine);
|
AddBlockGroupToBlock(block, trimmedLine);
|
||||||
break;
|
break;
|
||||||
case "ItemLevel":
|
case "ItemLevel":
|
||||||
@@ -399,12 +416,17 @@ namespace Filtration.Translators
|
|||||||
|
|
||||||
var outputString = string.Empty;
|
var outputString = string.Empty;
|
||||||
|
|
||||||
|
if (!block.Enabled)
|
||||||
|
{
|
||||||
|
outputString += "#Disabled Block Start" + Environment.NewLine;
|
||||||
|
}
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(block.Description))
|
if (!string.IsNullOrEmpty(block.Description))
|
||||||
{
|
{
|
||||||
outputString += "# " + block.Description + Environment.NewLine;
|
outputString += "# " + block.Description + Environment.NewLine;
|
||||||
}
|
}
|
||||||
|
|
||||||
outputString += block.Action.GetAttributeDescription();
|
outputString += (!block.Enabled ? "#" : string.Empty) + block.Action.GetAttributeDescription();
|
||||||
|
|
||||||
if (block.BlockGroup != null)
|
if (block.BlockGroup != null)
|
||||||
{
|
{
|
||||||
@@ -416,10 +438,15 @@ namespace Filtration.Translators
|
|||||||
{
|
{
|
||||||
if (blockItem.OutputText != string.Empty)
|
if (blockItem.OutputText != string.Empty)
|
||||||
{
|
{
|
||||||
outputString += _newLine + blockItem.OutputText;
|
outputString += (!block.Enabled ? _disabledNewLine : _newLine) + blockItem.OutputText;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!block.Enabled)
|
||||||
|
{
|
||||||
|
outputString += Environment.NewLine + "#Disabled Block End";
|
||||||
|
}
|
||||||
|
|
||||||
return outputString;
|
return outputString;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
using System.Windows.Documents;
|
||||||
using Castle.Core.Internal;
|
using Castle.Core.Internal;
|
||||||
using Filtration.ObjectModel;
|
using Filtration.ObjectModel;
|
||||||
using Filtration.Properties;
|
using Filtration.Properties;
|
||||||
@@ -28,12 +29,77 @@ namespace Filtration.Translators
|
|||||||
_blockGroupHierarchyBuilder = blockGroupHierarchyBuilder;
|
_blockGroupHierarchyBuilder = blockGroupHierarchyBuilder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string PreprocessDisabledBlocks(string inputString)
|
||||||
|
{
|
||||||
|
bool inDisabledBlock = false;
|
||||||
|
var showHideFound = false;
|
||||||
|
|
||||||
|
var lines = Regex.Split(inputString, "\r\n|\r|\n").ToList();
|
||||||
|
var linesToRemove = new List<int>();
|
||||||
|
|
||||||
|
for (var i = 0; i < lines.Count; i++)
|
||||||
|
{
|
||||||
|
if (lines[i].StartsWith("#Disabled Block Start"))
|
||||||
|
{
|
||||||
|
inDisabledBlock = true;
|
||||||
|
linesToRemove.Add(i);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (inDisabledBlock)
|
||||||
|
{
|
||||||
|
if (lines[i].StartsWith("#Disabled Block End"))
|
||||||
|
{
|
||||||
|
inDisabledBlock = false;
|
||||||
|
showHideFound = false;
|
||||||
|
linesToRemove.Add(i);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
lines[i] = lines[i].TrimStart('#');
|
||||||
|
lines[i] = lines[i].Replace("#", " # ");
|
||||||
|
var spaceOrEndOfLinePos = lines[i].IndexOf(" ", StringComparison.Ordinal) > 0 ? lines[i].IndexOf(" ", StringComparison.Ordinal) : lines[i].Length;
|
||||||
|
var lineOption = lines[i].Substring(0, spaceOrEndOfLinePos);
|
||||||
|
|
||||||
|
// If we haven't found a Show or Hide line yet, then this is probably the block comment.
|
||||||
|
// Put its # back on and skip to the next line.
|
||||||
|
if (lineOption != "Show" && lineOption != "Hide" && showHideFound == false)
|
||||||
|
{
|
||||||
|
lines[i] = "#" + lines[i];
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lineOption == "Show")
|
||||||
|
{
|
||||||
|
lines[i] = lines[i].Replace("Show", "ShowDisabled");
|
||||||
|
showHideFound = true;
|
||||||
|
}
|
||||||
|
else if (lineOption == "Hide")
|
||||||
|
{
|
||||||
|
lines[i] = lines[i].Replace("Hide", "HideDisabled");
|
||||||
|
showHideFound = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var i = linesToRemove.Count - 1; i >= 0; i--)
|
||||||
|
{
|
||||||
|
lines.RemoveAt(linesToRemove[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return lines.Aggregate((c, n) => c + Environment.NewLine + n);
|
||||||
|
}
|
||||||
|
|
||||||
public ItemFilterScript TranslateStringToItemFilterScript(string inputString)
|
public ItemFilterScript TranslateStringToItemFilterScript(string inputString)
|
||||||
{
|
{
|
||||||
var script = new ItemFilterScript();
|
var script = new ItemFilterScript();
|
||||||
_blockGroupHierarchyBuilder.Initialise(script.ItemFilterBlockGroups.First());
|
_blockGroupHierarchyBuilder.Initialise(script.ItemFilterBlockGroups.First());
|
||||||
|
|
||||||
inputString = inputString.Replace("\t", "");
|
inputString = inputString.Replace("\t", "");
|
||||||
|
if (inputString.Contains("#Disabled Block Start"))
|
||||||
|
{
|
||||||
|
inputString = PreprocessDisabledBlocks(inputString);
|
||||||
|
}
|
||||||
|
|
||||||
var conditionBoundaries = IdentifyBlockBoundaries(inputString);
|
var conditionBoundaries = IdentifyBlockBoundaries(inputString);
|
||||||
|
|
||||||
var lines = Regex.Split(inputString, "\r\n|\r|\n");
|
var lines = Regex.Split(inputString, "\r\n|\r|\n");
|
||||||
@@ -85,7 +151,10 @@ namespace Filtration.Translators
|
|||||||
// as it represents the block description.
|
// as it represents the block description.
|
||||||
// currentLine > 2 caters for an edge case where the script description is a single line and the first
|
// currentLine > 2 caters for an edge case where the script description is a single line and the first
|
||||||
// block has no description. This prevents the script description from being assigned to the first block's description.
|
// block has no description. This prevents the script description from being assigned to the first block's description.
|
||||||
blockBoundaries.AddLast(previousLine.StartsWith("#") && !previousLine.StartsWith("# Section:") && currentLine > 2 ? currentLine - 2 : currentLine - 1);
|
blockBoundaries.AddLast(previousLine.StartsWith("#") && !previousLine.StartsWith("# Section:") &&
|
||||||
|
currentLine > 2
|
||||||
|
? currentLine - 2
|
||||||
|
: currentLine - 1);
|
||||||
}
|
}
|
||||||
previousLine = line;
|
previousLine = line;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -171,6 +171,19 @@ namespace Filtration.ViewModels
|
|||||||
{
|
{
|
||||||
_activeDocument = null;
|
_activeDocument = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// TODO: Replace _activeScriptViewModel and _activeThemeViewModel with a better solution.
|
||||||
|
|
||||||
|
if (document.IsScript && _activeScriptViewModel == (IItemFilterScriptViewModel) document)
|
||||||
|
{
|
||||||
|
_activeScriptViewModel = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (document.IsTheme && _activeThemeViewModel == (IThemeEditorViewModel)document)
|
||||||
|
{
|
||||||
|
_activeThemeViewModel = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SwitchActiveDocument(IDocument document)
|
public void SwitchActiveDocument(IDocument document)
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ namespace Filtration.ViewModels
|
|||||||
bool IsDirty { get; set; }
|
bool IsDirty { get; set; }
|
||||||
bool IsExpanded { get; set; }
|
bool IsExpanded { get; set; }
|
||||||
ItemFilterBlock Block { get; }
|
ItemFilterBlock Block { get; }
|
||||||
|
bool BlockEnabled { get; set; }
|
||||||
void RefreshBlockPreview();
|
void RefreshBlockPreview();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -209,6 +210,20 @@ namespace Filtration.ViewModels
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool BlockEnabled
|
||||||
|
{
|
||||||
|
get { return Block.Enabled; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (Block.Enabled != value)
|
||||||
|
{
|
||||||
|
Block.Enabled = value;
|
||||||
|
IsDirty = true;
|
||||||
|
RaisePropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public string BlockDescription
|
public string BlockDescription
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|||||||
@@ -38,9 +38,13 @@ namespace Filtration.ViewModels
|
|||||||
void Initialise(ItemFilterScript itemFilterScript, bool newScript);
|
void Initialise(ItemFilterScript itemFilterScript, bool newScript);
|
||||||
void RemoveDirtyFlag();
|
void RemoveDirtyFlag();
|
||||||
void SetDirtyFlag();
|
void SetDirtyFlag();
|
||||||
|
bool HasSelectedEnabledBlock();
|
||||||
|
bool HasSelectedDisabledBlock();
|
||||||
|
|
||||||
RelayCommand AddBlockCommand { get; }
|
RelayCommand AddBlockCommand { get; }
|
||||||
RelayCommand AddSectionCommand { get; }
|
RelayCommand AddSectionCommand { get; }
|
||||||
|
RelayCommand DisableBlockCommand { get; }
|
||||||
|
RelayCommand EnableBlockCommand { get; }
|
||||||
RelayCommand DeleteBlockCommand { get; }
|
RelayCommand DeleteBlockCommand { get; }
|
||||||
RelayCommand MoveBlockUpCommand { get; }
|
RelayCommand MoveBlockUpCommand { get; }
|
||||||
RelayCommand MoveBlockDownCommand { get; }
|
RelayCommand MoveBlockDownCommand { get; }
|
||||||
@@ -104,6 +108,8 @@ namespace Filtration.ViewModels
|
|||||||
MoveBlockToBottomCommand = new RelayCommand(OnMoveBlockToBottomCommand, () => SelectedBlockViewModel != null);
|
MoveBlockToBottomCommand = new RelayCommand(OnMoveBlockToBottomCommand, () => SelectedBlockViewModel != null);
|
||||||
AddBlockCommand = new RelayCommand(OnAddBlockCommand);
|
AddBlockCommand = new RelayCommand(OnAddBlockCommand);
|
||||||
AddSectionCommand = new RelayCommand(OnAddSectionCommand, () => SelectedBlockViewModel != null);
|
AddSectionCommand = new RelayCommand(OnAddSectionCommand, () => SelectedBlockViewModel != null);
|
||||||
|
DisableBlockCommand = new RelayCommand(OnDisableBlockCommand, HasSelectedEnabledBlock);
|
||||||
|
EnableBlockCommand = new RelayCommand(OnEnableBlockCommand, HasSelectedDisabledBlock);
|
||||||
CopyBlockCommand = new RelayCommand(OnCopyBlockCommand, () => SelectedBlockViewModel != null);
|
CopyBlockCommand = new RelayCommand(OnCopyBlockCommand, () => SelectedBlockViewModel != null);
|
||||||
CopyBlockStyleCommand = new RelayCommand(OnCopyBlockStyleCommand, () => SelectedBlockViewModel != null);
|
CopyBlockStyleCommand = new RelayCommand(OnCopyBlockStyleCommand, () => SelectedBlockViewModel != null);
|
||||||
PasteBlockCommand = new RelayCommand(OnPasteBlockCommand, () => SelectedBlockViewModel != null);
|
PasteBlockCommand = new RelayCommand(OnPasteBlockCommand, () => SelectedBlockViewModel != null);
|
||||||
@@ -128,6 +134,8 @@ namespace Filtration.ViewModels
|
|||||||
public RelayCommand MoveBlockToBottomCommand { get; private set; }
|
public RelayCommand MoveBlockToBottomCommand { get; private set; }
|
||||||
public RelayCommand AddBlockCommand { get; private set; }
|
public RelayCommand AddBlockCommand { get; private set; }
|
||||||
public RelayCommand AddSectionCommand { get; private set; }
|
public RelayCommand AddSectionCommand { get; private set; }
|
||||||
|
public RelayCommand EnableBlockCommand { get; private set; }
|
||||||
|
public RelayCommand DisableBlockCommand { get; private set; }
|
||||||
public RelayCommand CopyBlockCommand { get; private set; }
|
public RelayCommand CopyBlockCommand { get; private set; }
|
||||||
public RelayCommand CopyBlockStyleCommand { get; private set; }
|
public RelayCommand CopyBlockStyleCommand { get; private set; }
|
||||||
public RelayCommand PasteBlockCommand { get; private set; }
|
public RelayCommand PasteBlockCommand { get; private set; }
|
||||||
@@ -215,6 +223,21 @@ namespace Filtration.ViewModels
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool HasSelectedBlock()
|
||||||
|
{
|
||||||
|
return SelectedBlockViewModel != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool HasSelectedEnabledBlock()
|
||||||
|
{
|
||||||
|
return HasSelectedBlock() && !(SelectedBlockViewModel.Block is ItemFilterSection) && SelectedBlockViewModel.BlockEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool HasSelectedDisabledBlock()
|
||||||
|
{
|
||||||
|
return HasSelectedBlock() && !(SelectedBlockViewModel.Block is ItemFilterSection) && !SelectedBlockViewModel.BlockEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
public IItemFilterBlockViewModel SelectedBlockViewModel
|
public IItemFilterBlockViewModel SelectedBlockViewModel
|
||||||
{
|
{
|
||||||
get { return _selectedBlockViewModel; }
|
get { return _selectedBlockViewModel; }
|
||||||
@@ -767,5 +790,25 @@ namespace Filtration.ViewModels
|
|||||||
}
|
}
|
||||||
SelectedBlockViewModel = null;
|
SelectedBlockViewModel = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnDisableBlockCommand()
|
||||||
|
{
|
||||||
|
DisableBlock(SelectedBlockViewModel);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DisableBlock(IItemFilterBlockViewModel targetBlockViewModel)
|
||||||
|
{
|
||||||
|
targetBlockViewModel.BlockEnabled = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnEnableBlockCommand()
|
||||||
|
{
|
||||||
|
EnableBlock(SelectedBlockViewModel);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void EnableBlock(IItemFilterBlockViewModel targetBlockViewModel)
|
||||||
|
{
|
||||||
|
targetBlockViewModel.BlockEnabled = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,8 +49,6 @@ namespace Filtration.ViewModels
|
|||||||
private readonly IUpdateCheckService _updateCheckService;
|
private readonly IUpdateCheckService _updateCheckService;
|
||||||
private readonly IUpdateAvailableViewModel _updateAvailableViewModel;
|
private readonly IUpdateAvailableViewModel _updateAvailableViewModel;
|
||||||
private readonly IMessageBoxService _messageBoxService;
|
private readonly IMessageBoxService _messageBoxService;
|
||||||
private bool _activeDocumentIsScript;
|
|
||||||
private bool _activeDocumentIsTheme;
|
|
||||||
|
|
||||||
public MainWindowViewModel(IItemFilterScriptRepository itemFilterScriptRepository,
|
public MainWindowViewModel(IItemFilterScriptRepository itemFilterScriptRepository,
|
||||||
IItemFilterScriptTranslator itemFilterScriptTranslator,
|
IItemFilterScriptTranslator itemFilterScriptTranslator,
|
||||||
@@ -75,48 +73,51 @@ namespace Filtration.ViewModels
|
|||||||
_messageBoxService = messageBoxService;
|
_messageBoxService = messageBoxService;
|
||||||
|
|
||||||
NewScriptCommand = new RelayCommand(OnNewScriptCommand);
|
NewScriptCommand = new RelayCommand(OnNewScriptCommand);
|
||||||
CopyScriptCommand = new RelayCommand(OnCopyScriptCommand, () => _activeDocumentIsScript);
|
CopyScriptCommand = new RelayCommand(OnCopyScriptCommand, () => ActiveDocumentIsScript);
|
||||||
OpenScriptCommand = new RelayCommand(OnOpenScriptCommand);
|
OpenScriptCommand = new RelayCommand(OnOpenScriptCommand);
|
||||||
OpenThemeCommand = new RelayCommand(OnOpenThemeCommand);
|
OpenThemeCommand = new RelayCommand(OnOpenThemeCommand);
|
||||||
|
|
||||||
SaveCommand = new RelayCommand(OnSaveDocumentCommand, ActiveDocumentIsEditable);
|
SaveCommand = new RelayCommand(OnSaveDocumentCommand, ActiveDocumentIsEditable);
|
||||||
SaveAsCommand = new RelayCommand(OnSaveAsCommand, ActiveDocumentIsEditable);
|
SaveAsCommand = new RelayCommand(OnSaveAsCommand, ActiveDocumentIsEditable);
|
||||||
CloseCommand = new RelayCommand(OnCloseDocumentCommand, () => AvalonDockWorkspaceViewModel.ActiveDocument != null);
|
CloseCommand = new RelayCommand(OnCloseDocumentCommand, ActiveDocumentIsEditable);
|
||||||
|
|
||||||
CopyBlockCommand = new RelayCommand(OnCopyBlockCommand, () => _activeDocumentIsScript && ActiveScriptHasSelectedBlock);
|
CopyBlockCommand = new RelayCommand(OnCopyBlockCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedBlock);
|
||||||
CopyBlockStyleCommand = new RelayCommand(OnCopyBlockStyleCommand, () => _activeDocumentIsScript && ActiveScriptHasSelectedBlock);
|
CopyBlockStyleCommand = new RelayCommand(OnCopyBlockStyleCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedBlock);
|
||||||
PasteCommand = new RelayCommand(OnPasteCommand, () => _activeDocumentIsScript && ActiveScriptHasSelectedBlock);
|
PasteCommand = new RelayCommand(OnPasteCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedBlock);
|
||||||
PasteBlockStyleCommand = new RelayCommand(OnPasteBlockStyleCommand, () => _activeDocumentIsScript && ActiveScriptHasSelectedBlock);
|
PasteBlockStyleCommand = new RelayCommand(OnPasteBlockStyleCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedBlock);
|
||||||
|
|
||||||
MoveBlockUpCommand = new RelayCommand(OnMoveBlockUpCommand, () => _activeDocumentIsScript && ActiveScriptHasSelectedBlock);
|
MoveBlockUpCommand = new RelayCommand(OnMoveBlockUpCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedBlock);
|
||||||
MoveBlockDownCommand = new RelayCommand(OnMoveBlockDownCommand, () => _activeDocumentIsScript && ActiveScriptHasSelectedBlock);
|
MoveBlockDownCommand = new RelayCommand(OnMoveBlockDownCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedBlock);
|
||||||
MoveBlockToTopCommand = new RelayCommand(OnMoveBlockToTopCommand, () => _activeDocumentIsScript && ActiveScriptHasSelectedBlock);
|
MoveBlockToTopCommand = new RelayCommand(OnMoveBlockToTopCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedBlock);
|
||||||
MoveBlockToBottomCommand = new RelayCommand(OnMoveBlockToBottomCommand, () => _activeDocumentIsScript && ActiveScriptHasSelectedBlock);
|
MoveBlockToBottomCommand = new RelayCommand(OnMoveBlockToBottomCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedBlock);
|
||||||
|
|
||||||
AddBlockCommand = new RelayCommand(OnAddBlockCommand, () => _activeDocumentIsScript);
|
|
||||||
AddSectionCommand = new RelayCommand(OnAddSectionCommand, () => _activeDocumentIsScript);
|
|
||||||
DeleteBlockCommand = new RelayCommand(OnDeleteBlockCommand, () => _activeDocumentIsScript && ActiveScriptHasSelectedBlock);
|
|
||||||
|
|
||||||
|
AddBlockCommand = new RelayCommand(OnAddBlockCommand, () => ActiveDocumentIsScript);
|
||||||
|
AddSectionCommand = new RelayCommand(OnAddSectionCommand, () => ActiveDocumentIsScript);
|
||||||
|
DeleteBlockCommand = new RelayCommand(OnDeleteBlockCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedBlock);
|
||||||
|
DisableBlockCommand = new RelayCommand(OnDisableBlockCommand,
|
||||||
|
() => ActiveDocumentIsScript && ActiveScriptHasSelectedEnabledBlock);
|
||||||
|
EnableBlockCommand = new RelayCommand(OnEnableBlockCommand,
|
||||||
|
() => ActiveDocumentIsScript && ActiveScriptHasSelectedDisabledBlock);
|
||||||
OpenAboutWindowCommand = new RelayCommand(OnOpenAboutWindowCommand);
|
OpenAboutWindowCommand = new RelayCommand(OnOpenAboutWindowCommand);
|
||||||
ReplaceColorsCommand = new RelayCommand(OnReplaceColorsCommand, () => _activeDocumentIsScript);
|
ReplaceColorsCommand = new RelayCommand(OnReplaceColorsCommand, () => ActiveDocumentIsScript);
|
||||||
|
|
||||||
CreateThemeCommand = new RelayCommand(OnCreateThemeCommand, () => _activeDocumentIsScript);
|
CreateThemeCommand = new RelayCommand(OnCreateThemeCommand, () => ActiveDocumentIsScript);
|
||||||
ApplyThemeToScriptCommand = new RelayCommand(OnApplyThemeToScriptCommand, () => _activeDocumentIsScript);
|
ApplyThemeToScriptCommand = new RelayCommand(OnApplyThemeToScriptCommand, () => ActiveDocumentIsScript);
|
||||||
EditMasterThemeCommand = new RelayCommand(OnEditMasterThemeCommand, () => _activeDocumentIsScript);
|
EditMasterThemeCommand = new RelayCommand(OnEditMasterThemeCommand, () => ActiveDocumentIsScript);
|
||||||
|
|
||||||
AddTextColorThemeComponentCommand = new RelayCommand(OnAddTextColorThemeComponentCommand, () => _activeDocumentIsTheme && ActiveThemeIsEditable);
|
AddTextColorThemeComponentCommand = new RelayCommand(OnAddTextColorThemeComponentCommand, () => ActiveDocumentIsTheme && ActiveThemeIsEditable);
|
||||||
AddBackgroundColorThemeComponentCommand = new RelayCommand(OnAddBackgroundColorThemeComponentCommand, () => _activeDocumentIsTheme && ActiveThemeIsEditable);
|
AddBackgroundColorThemeComponentCommand = new RelayCommand(OnAddBackgroundColorThemeComponentCommand, () => ActiveDocumentIsTheme && ActiveThemeIsEditable);
|
||||||
AddBorderColorThemeComponentCommand = new RelayCommand(OnAddBorderColorThemeComponentCommand, () => _activeDocumentIsTheme && ActiveThemeIsEditable);
|
AddBorderColorThemeComponentCommand = new RelayCommand(OnAddBorderColorThemeComponentCommand, () => ActiveDocumentIsTheme && ActiveThemeIsEditable);
|
||||||
DeleteThemeComponentCommand = new RelayCommand(OnDeleteThemeComponentCommand,
|
DeleteThemeComponentCommand = new RelayCommand(OnDeleteThemeComponentCommand,
|
||||||
() =>
|
() =>
|
||||||
ActiveDocumentIsTheme && _activeDocumentIsTheme &&
|
ActiveDocumentIsTheme && ActiveDocumentIsTheme &&
|
||||||
_avalonDockWorkspaceViewModel.ActiveThemeViewModel.SelectedThemeComponent != null);
|
_avalonDockWorkspaceViewModel.ActiveThemeViewModel.SelectedThemeComponent != null);
|
||||||
|
|
||||||
ExpandAllBlocksCommand = new RelayCommand(OnExpandAllBlocksCommand, () => _activeDocumentIsScript);
|
ExpandAllBlocksCommand = new RelayCommand(OnExpandAllBlocksCommand, () => ActiveDocumentIsScript);
|
||||||
CollapseAllBlocksCommand = new RelayCommand(OnCollapseAllBlocksCommand, () => _activeDocumentIsScript);
|
CollapseAllBlocksCommand = new RelayCommand(OnCollapseAllBlocksCommand, () => ActiveDocumentIsScript);
|
||||||
|
|
||||||
ToggleShowAdvancedCommand = new RelayCommand<bool>(OnToggleShowAdvancedCommand, s => _activeDocumentIsScript);
|
ToggleShowAdvancedCommand = new RelayCommand<bool>(OnToggleShowAdvancedCommand, s => ActiveDocumentIsScript);
|
||||||
ClearFiltersCommand = new RelayCommand(OnClearFiltersCommand, () => _activeDocumentIsScript);
|
ClearFiltersCommand = new RelayCommand(OnClearFiltersCommand, () => ActiveDocumentIsScript);
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(_itemFilterScriptRepository.GetItemFilterScriptDirectory()))
|
if (string.IsNullOrEmpty(_itemFilterScriptRepository.GetItemFilterScriptDirectory()))
|
||||||
{
|
{
|
||||||
@@ -151,7 +152,8 @@ namespace Filtration.ViewModels
|
|||||||
ApplyThemeToScriptCommand.RaiseCanExecuteChanged();
|
ApplyThemeToScriptCommand.RaiseCanExecuteChanged();
|
||||||
EditMasterThemeCommand.RaiseCanExecuteChanged();
|
EditMasterThemeCommand.RaiseCanExecuteChanged();
|
||||||
CreateThemeCommand.RaiseCanExecuteChanged();
|
CreateThemeCommand.RaiseCanExecuteChanged();
|
||||||
SetActiveDocumentStatusProperties();
|
RaisePropertyChanged("ActiveDocumentIsScript");
|
||||||
|
RaisePropertyChanged("ActiveDocumentIsTheme");
|
||||||
RaisePropertyChanged("ShowAdvancedStatus");
|
RaisePropertyChanged("ShowAdvancedStatus");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -168,8 +170,6 @@ namespace Filtration.ViewModels
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
CheckForUpdates();
|
CheckForUpdates();
|
||||||
ActiveDocumentIsScript = false;
|
|
||||||
ActiveDocumentIsTheme = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public RelayCommand OpenScriptCommand { get; private set; }
|
public RelayCommand OpenScriptCommand { get; private set; }
|
||||||
@@ -198,6 +198,8 @@ namespace Filtration.ViewModels
|
|||||||
public RelayCommand AddBlockCommand { get; private set; }
|
public RelayCommand AddBlockCommand { get; private set; }
|
||||||
public RelayCommand AddSectionCommand { get; private set; }
|
public RelayCommand AddSectionCommand { get; private set; }
|
||||||
public RelayCommand DeleteBlockCommand { get; private set; }
|
public RelayCommand DeleteBlockCommand { get; private set; }
|
||||||
|
public RelayCommand DisableBlockCommand { get; private set; }
|
||||||
|
public RelayCommand EnableBlockCommand { get; private set; }
|
||||||
|
|
||||||
public RelayCommand MoveBlockUpCommand { get; private set; }
|
public RelayCommand MoveBlockUpCommand { get; private set; }
|
||||||
public RelayCommand MoveBlockDownCommand { get; private set; }
|
public RelayCommand MoveBlockDownCommand { get; private set; }
|
||||||
@@ -275,30 +277,14 @@ namespace Filtration.ViewModels
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetActiveDocumentStatusProperties()
|
|
||||||
{
|
|
||||||
ActiveDocumentIsScript = AvalonDockWorkspaceViewModel.ActiveDocument is ItemFilterScriptViewModel;
|
|
||||||
ActiveDocumentIsTheme = AvalonDockWorkspaceViewModel.ActiveDocument is ThemeEditorViewModel;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool ActiveDocumentIsScript
|
public bool ActiveDocumentIsScript
|
||||||
{
|
{
|
||||||
get { return _activeDocumentIsScript; }
|
get { return _avalonDockWorkspaceViewModel.ActiveDocument != null && _avalonDockWorkspaceViewModel.ActiveDocument.IsScript; }
|
||||||
private set
|
|
||||||
{
|
|
||||||
_activeDocumentIsScript = value;
|
|
||||||
RaisePropertyChanged();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool ActiveDocumentIsTheme
|
public bool ActiveDocumentIsTheme
|
||||||
{
|
{
|
||||||
get { return _activeDocumentIsTheme; }
|
get { return _avalonDockWorkspaceViewModel.ActiveDocument!= null && _avalonDockWorkspaceViewModel.ActiveDocument.IsTheme; }
|
||||||
private set
|
|
||||||
{
|
|
||||||
_activeDocumentIsTheme = value;
|
|
||||||
RaisePropertyChanged();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool ActiveScriptHasSelectedBlock
|
public bool ActiveScriptHasSelectedBlock
|
||||||
@@ -306,6 +292,16 @@ namespace Filtration.ViewModels
|
|||||||
get { return AvalonDockWorkspaceViewModel.ActiveScriptViewModel.SelectedBlockViewModel != null; }
|
get { return AvalonDockWorkspaceViewModel.ActiveScriptViewModel.SelectedBlockViewModel != null; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool ActiveScriptHasSelectedEnabledBlock
|
||||||
|
{
|
||||||
|
get { return AvalonDockWorkspaceViewModel.ActiveScriptViewModel.HasSelectedEnabledBlock(); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool ActiveScriptHasSelectedDisabledBlock
|
||||||
|
{
|
||||||
|
get { return AvalonDockWorkspaceViewModel.ActiveScriptViewModel.HasSelectedDisabledBlock(); }
|
||||||
|
}
|
||||||
|
|
||||||
public bool ActiveThemeIsEditable
|
public bool ActiveThemeIsEditable
|
||||||
{
|
{
|
||||||
get { return AvalonDockWorkspaceViewModel.ActiveThemeViewModel.IsMasterTheme; }
|
get { return AvalonDockWorkspaceViewModel.ActiveThemeViewModel.IsMasterTheme; }
|
||||||
@@ -580,6 +576,16 @@ namespace Filtration.ViewModels
|
|||||||
_avalonDockWorkspaceViewModel.ActiveScriptViewModel.DeleteBlockCommand.Execute(null);
|
_avalonDockWorkspaceViewModel.ActiveScriptViewModel.DeleteBlockCommand.Execute(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnDisableBlockCommand()
|
||||||
|
{
|
||||||
|
_avalonDockWorkspaceViewModel.ActiveScriptViewModel.DisableBlockCommand.Execute(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnEnableBlockCommand()
|
||||||
|
{
|
||||||
|
_avalonDockWorkspaceViewModel.ActiveScriptViewModel.EnableBlockCommand.Execute(null);
|
||||||
|
}
|
||||||
|
|
||||||
private void OnExpandAllBlocksCommand()
|
private void OnExpandAllBlocksCommand()
|
||||||
{
|
{
|
||||||
_avalonDockWorkspaceViewModel.ActiveScriptViewModel.ExpandAllBlocksCommand.Execute(null);
|
_avalonDockWorkspaceViewModel.ActiveScriptViewModel.ExpandAllBlocksCommand.Execute(null);
|
||||||
|
|||||||
@@ -31,4 +31,6 @@
|
|||||||
<Image Source="/Filtration;component/Resources/Icons/filtration_icon.png" x:Key="FiltrationIcon" x:Shared="False" />
|
<Image Source="/Filtration;component/Resources/Icons/filtration_icon.png" x:Key="FiltrationIcon" x:Shared="False" />
|
||||||
<Image Source="/Filtration;component/Resources/Icons/Add.ico" x:Key="AddIcon" x:Shared="False" />
|
<Image Source="/Filtration;component/Resources/Icons/Add.ico" x:Key="AddIcon" x:Shared="False" />
|
||||||
<Image Source="/Filtration;component/Resources/Icons/ThemeComponentDelete.ico" x:Key="ThemeComponentDeleteIcon" x:Shared="False" />
|
<Image Source="/Filtration;component/Resources/Icons/ThemeComponentDelete.ico" x:Key="ThemeComponentDeleteIcon" x:Shared="False" />
|
||||||
|
<Image Source="/Filtration;component/Resources/Icons/standby_enabled_icon.png" x:Key="StandbyEnabledIcon" x:Shared="False" />
|
||||||
|
<Image Source="/Filtration;component/Resources/Icons/standby_disabled_icon.png" x:Key="StandbyDisabledIcon" x:Shared="False" />
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
@@ -41,6 +41,11 @@
|
|||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
</UserControl.Resources>
|
</UserControl.Resources>
|
||||||
<Grid x:Name="TopLevelGrid">
|
<Grid x:Name="TopLevelGrid">
|
||||||
|
<Grid x:Name="DisabledBlockOverlay" IsHitTestVisible="False" Panel.ZIndex="1000" Visibility="{Binding BlockEnabled, Converter={StaticResource InverseBooleanVisibilityConverter}}">
|
||||||
|
<Grid.Background>
|
||||||
|
<SolidColorBrush Color="Gray" Opacity=".5" />
|
||||||
|
</Grid.Background>
|
||||||
|
</Grid>
|
||||||
<Border BorderThickness="1" BorderBrush="SlateGray" CornerRadius="2" Background="White">
|
<Border BorderThickness="1" BorderBrush="SlateGray" CornerRadius="2" Background="White">
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
@@ -62,8 +67,8 @@
|
|||||||
<Expander.ContextMenu>
|
<Expander.ContextMenu>
|
||||||
<ContextMenu>
|
<ContextMenu>
|
||||||
<ContextMenu.Items>
|
<ContextMenu.Items>
|
||||||
<MenuItem Header="Copy" Command="{Binding CopyBlockCommand}" Icon="{StaticResource CopyIcon}" />
|
<MenuItem Header="Copy Block" Command="{Binding CopyBlockCommand}" Icon="{StaticResource CopyIcon}" />
|
||||||
<MenuItem Header="Paste" Command="{Binding PasteBlockCommand}" Icon="{StaticResource PasteIcon}" />
|
<MenuItem Header="Paste Block" Command="{Binding PasteBlockCommand}" Icon="{StaticResource PasteIcon}" />
|
||||||
<Separator />
|
<Separator />
|
||||||
<MenuItem Header="Block Style">
|
<MenuItem Header="Block Style">
|
||||||
<MenuItem Header="Copy Block Style" Command="{Binding CopyBlockStyleCommand}" Icon="{StaticResource CopyIcon}" />
|
<MenuItem Header="Copy Block Style" Command="{Binding CopyBlockStyleCommand}" Icon="{StaticResource CopyIcon}" />
|
||||||
@@ -89,6 +94,7 @@
|
|||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="*" />
|
<ColumnDefinition Width="*" />
|
||||||
<ColumnDefinition Width="Auto" />
|
<ColumnDefinition Width="Auto" />
|
||||||
|
<ColumnDefinition Width="Auto" />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<!-- BlockItems Summary Panel -->
|
<!-- BlockItems Summary Panel -->
|
||||||
<StackPanel Grid.Row="0" Grid.Column="0" VerticalAlignment="Center">
|
<StackPanel Grid.Row="0" Grid.Column="0" VerticalAlignment="Center">
|
||||||
@@ -123,7 +129,7 @@
|
|||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<!-- Item Preview Box -->
|
<!-- Item Preview Box -->
|
||||||
<WrapPanel Grid.Row="0" Grid.Column="1" VerticalAlignment="Center">
|
<WrapPanel Grid.Row="0" Grid.Column="2" VerticalAlignment="Center">
|
||||||
<Button Command="{Binding PlaySoundCommand}"
|
<Button Command="{Binding PlaySoundCommand}"
|
||||||
Width="25"
|
Width="25"
|
||||||
Height="25"
|
Height="25"
|
||||||
@@ -160,6 +166,10 @@
|
|||||||
<RowDefinition />
|
<RowDefinition />
|
||||||
<RowDefinition />
|
<RowDefinition />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
<ColumnDefinition Width="Auto" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
<TextBlock Grid.Row="1" VerticalAlignment="Bottom" HorizontalAlignment="Right">
|
<TextBlock Grid.Row="1" VerticalAlignment="Bottom" HorizontalAlignment="Right">
|
||||||
<Hyperlink Command="{Binding SwitchBlockItemsViewCommand}">
|
<Hyperlink Command="{Binding SwitchBlockItemsViewCommand}">
|
||||||
Switch to Appearance Block Items
|
Switch to Appearance Block Items
|
||||||
@@ -167,7 +177,7 @@
|
|||||||
</TextBlock>
|
</TextBlock>
|
||||||
|
|
||||||
<!-- Add Block Item Links -->
|
<!-- Add Block Item Links -->
|
||||||
<ItemsControl ItemsSource="{Binding BlockItemTypesAvailable}" Grid.Row="0" Margin="0,0,0,10">
|
<ItemsControl Grid.Column="0" ItemsSource="{Binding BlockItemTypesAvailable}" Grid.Row="0" Margin="0,0,0,10">
|
||||||
<ItemsControl.ItemsPanel>
|
<ItemsControl.ItemsPanel>
|
||||||
<ItemsPanelTemplate>
|
<ItemsPanelTemplate>
|
||||||
<WrapPanel></WrapPanel>
|
<WrapPanel></WrapPanel>
|
||||||
@@ -184,8 +194,34 @@
|
|||||||
</ItemsControl.ItemTemplate>
|
</ItemsControl.ItemTemplate>
|
||||||
</ItemsControl>
|
</ItemsControl>
|
||||||
|
|
||||||
|
<!-- Enable/Disable Block Button -->
|
||||||
|
<ToggleButton Grid.Row="0"
|
||||||
|
Grid.Column="1"
|
||||||
|
Style="{StaticResource ChromelessToggleButton}"
|
||||||
|
IsChecked="{Binding BlockEnabled}"
|
||||||
|
Margin="0,0,5,0"
|
||||||
|
ToolTip="Enable/Disable Block"
|
||||||
|
Cursor="Hand"
|
||||||
|
Width="25"
|
||||||
|
Height="25">
|
||||||
|
<Image RenderOptions.BitmapScalingMode="HighQuality">
|
||||||
|
<Image.Style>
|
||||||
|
<Style TargetType="{x:Type Image}">
|
||||||
|
<Style.Triggers>
|
||||||
|
<DataTrigger Binding="{Binding BlockEnabled}" Value="true">
|
||||||
|
<Setter Property="Source" Value="/Filtration;component/Resources/Icons/standby_enabled_icon.png"/>
|
||||||
|
</DataTrigger>
|
||||||
|
<DataTrigger Binding="{Binding BlockEnabled}" Value="false">
|
||||||
|
<Setter Property="Source" Value="/Filtration;component/Resources/Icons/standby_disabled_icon.png"/>
|
||||||
|
</DataTrigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</Image.Style>
|
||||||
|
</Image>
|
||||||
|
</ToggleButton>
|
||||||
|
|
||||||
<!-- Block Items -->
|
<!-- Block Items -->
|
||||||
<WrapPanel Grid.Row="1" MaxHeight="200">
|
<WrapPanel Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="1" MaxHeight="200">
|
||||||
<WrapPanel.Resources>
|
<WrapPanel.Resources>
|
||||||
<CollectionViewSource Source="{Binding RegularBlockItems}" x:Key="BlockItemsCollectionViewSource">
|
<CollectionViewSource Source="{Binding RegularBlockItems}" x:Key="BlockItemsCollectionViewSource">
|
||||||
<CollectionViewSource.SortDescriptions>
|
<CollectionViewSource.SortDescriptions>
|
||||||
|
|||||||
@@ -85,6 +85,8 @@
|
|||||||
<fluent:Button Header="Move Up" Command="{Binding MoveBlockUpCommand}" SizeDefinition="Middle" Icon="{StaticResource MoveUpIcon}" />
|
<fluent:Button Header="Move Up" Command="{Binding MoveBlockUpCommand}" SizeDefinition="Middle" Icon="{StaticResource MoveUpIcon}" />
|
||||||
<fluent:Button Header="Move Down" Command="{Binding MoveBlockDownCommand}" SizeDefinition="Middle" Icon="{StaticResource MoveDownIcon}" />
|
<fluent:Button Header="Move Down" Command="{Binding MoveBlockDownCommand}" SizeDefinition="Middle" Icon="{StaticResource MoveDownIcon}" />
|
||||||
<fluent:Button Header="Move To Bottom" Command="{Binding MoveBlockToBottomCommand}" SizeDefinition="Middle" Icon="{StaticResource MoveToBottomIcon}" />
|
<fluent:Button Header="Move To Bottom" Command="{Binding MoveBlockToBottomCommand}" SizeDefinition="Middle" Icon="{StaticResource MoveToBottomIcon}" />
|
||||||
|
<fluent:Button Header="Enable Block" Command="{Binding EnableBlockCommand}" SizeDefinition="Middle" Icon="{StaticResource StandbyEnabledIcon}" />
|
||||||
|
<fluent:Button Header="Disable Block" Command="{Binding DisableBlockCommand}" SizeDefinition="Middle" Icon="{StaticResource StandbyDisabledIcon}" />
|
||||||
</fluent:RibbonGroupBox>
|
</fluent:RibbonGroupBox>
|
||||||
<fluent:RibbonGroupBox Header="Expand / Collapse">
|
<fluent:RibbonGroupBox Header="Expand / Collapse">
|
||||||
<fluent:Button Header="Expand All" Command="{Binding ExpandAllBlocksCommand}" SizeDefinition="Middle" Icon="{StaticResource ExpandIcon}" />
|
<fluent:Button Header="Expand All" Command="{Binding ExpandAllBlocksCommand}" SizeDefinition="Middle" Icon="{StaticResource ExpandIcon}" />
|
||||||
|
|||||||
19
README.md
19
README.md
@@ -2,10 +2,10 @@
|
|||||||
|
|
||||||
Filtration is an editor for Path of Exile item filter scripts.
|
Filtration is an editor for Path of Exile item filter scripts.
|
||||||
|
|
||||||
## Current Release
|
## Current Release (Released 2015-07-06)
|
||||||
<b>Installer (6.01mb)</b> <a href="https://github.com/ben-wallis/Filtration/releases/download/0.5/filtration_0.5_setup.exe">filtration_0.5_setup.exe</a>
|
<b>Installer (6.31mb)</b> <a href="https://github.com/ben-wallis/Filtration/releases/download/0.7/filtration_0.7_setup.exe">filtration_0.7_setup.exe</a>
|
||||||
|
|
||||||
<b>Zip File (7.54mb)</b> <a href="https://github.com/ben-wallis/Filtration/releases/download/0.5/filtration_0.5.zip">filtration_0.5.zip</a>
|
<b>Zip File (7.91mb)</b> <a href="https://github.com/ben-wallis/Filtration/releases/download/0.7/filtration_0.7.zip">filtration_0.7.zip</a>
|
||||||
|
|
||||||
## System Requirements
|
## System Requirements
|
||||||
Filtration requires .NET Framework 4.5.1 installed.
|
Filtration requires .NET Framework 4.5.1 installed.
|
||||||
@@ -26,19 +26,10 @@ If you'd like to make your script fully compatible with Filtration, please take
|
|||||||
## Screenshots
|
## Screenshots
|
||||||
|
|
||||||
##### Main Window
|
##### Main Window
|
||||||
<img src="http://i.imgur.com/s2lNHCm.png" />
|
<img src="http://i.imgur.com/eAsMoSo.png" />
|
||||||
|
|
||||||
##### Block Editor
|
|
||||||
<img src="http://i.imgur.com/BqWGxs7.png" />
|
|
||||||
|
|
||||||
##### Theme Editor
|
##### Theme Editor
|
||||||
<img src="http://i.imgur.com/R2w7Hf2.png" />
|
<img src="http://i.imgur.com/FJWJknO.png" />
|
||||||
|
|
||||||
##### Block Color Editor
|
|
||||||
<img src="http://i.imgur.com/nlBGiG4.png" />
|
|
||||||
|
|
||||||
##### Replace Colors Tool
|
|
||||||
<img src="http://i.imgur.com/oY1q6hq.png" />
|
|
||||||
|
|
||||||
## Contact
|
## Contact
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user