Merge branch 'master' into lego/hb_2939_20201108230556187

This commit is contained in:
Clint Rutkas
2020-11-10 14:43:16 -08:00
155 changed files with 9771 additions and 1830 deletions

View File

@@ -13,44 +13,7 @@ namespace ColorPicker.Helpers
internal static class ColorHelper
{
/// <summary>
/// Convert a given <see cref="Color"/> color to a HSL color (hue, saturation, lightness)
/// </summary>
/// <param name="color">The <see cref="Color"/> to convert</param>
/// <returns>The hue [0°..360°], saturation [0..1] and lightness [0..1] values of the converted color</returns>
internal static (double hue, double saturation, double lightness) ConvertToHSLColor(Color color)
{
var min = Math.Min(Math.Min(color.R, color.G), color.B) / 255d;
var max = Math.Max(Math.Max(color.R, color.G), color.B) / 255d;
var lightness = (max + min) / 2d;
if (lightness == 0d || min == max)
{
return (color.GetHue(), 0d, lightness);
}
else if (lightness > 0d && lightness <= 0.5d)
{
return (color.GetHue(), (max - min) / (max + min), lightness);
}
return (color.GetHue(), (max - min) / (2d - (max + min)), lightness);
}
/// <summary>
/// Convert a given <see cref="Color"/> color to a HSV color (hue, saturation, value)
/// </summary>
/// <param name="color">The <see cref="Color"/> to convert</param>
/// <returns>The hue [0°..360°], saturation [0..1] and value [0..1] of the converted color</returns>
internal static (double hue, double saturation, double value) ConvertToHSVColor(Color color)
{
var min = Math.Min(Math.Min(color.R, color.G), color.B) / 255d;
var max = Math.Max(Math.Max(color.R, color.G), color.B) / 255d;
return (color.GetHue(), max == 0d ? 0d : (max - min) / max, max);
}
/// <summary>
/// Convert a given <see cref="Color"/> color to a CYMK color (cyan, magenta, yellow, black key)
/// Convert a given <see cref="Color"/> to a CYMK color (cyan, magenta, yellow, black key)
/// </summary>
/// <param name="color">The <see cref="Color"/> to convert</param>
/// <returns>The cyan[0..1], magenta[0..1], yellow[0..1] and black key[0..1] of the converted color</returns>
@@ -80,5 +43,135 @@ namespace ColorPicker.Helpers
return (cyan, magenta, yellow, blackKey);
}
/// <summary>
/// Convert a given <see cref="Color"/> to a HSB color (hue, saturation, brightness)
/// </summary>
/// <param name="color">The <see cref="Color"/> to convert</param>
/// <returns>The hue [0°..360°], saturation [0..1] and brightness [0..1] of the converted color</returns>
internal static (double hue, double saturation, double brightness) ConvertToHSBColor(Color color)
=> (color.GetHue(), color.GetSaturation(), color.GetBrightness());
/// <summary>
/// Convert a given <see cref="Color"/> to a HSI color (hue, saturation, intensity)
/// </summary>
/// <param name="color">The <see cref="Color"/> to convert</param>
/// <returns>The hue [0°..360°], saturation [0..1] and intensity [0..1] of the converted color</returns>
internal static (double hue, double saturation, double intensity) ConvertToHSIColor(Color color)
{
// special case for black
if (color.R == 0 && color.G == 0 && color.B == 0)
{
return (0d, 0d, 0d);
}
var red = color.R / 255d;
var green = color.G / 255d;
var blue = color.B / 255d;
var intensity = (red + green + blue) / 3d;
var min = Math.Min(Math.Min(color.R, color.G), color.B) / 255d;
return (color.GetHue(), 1d - (min / intensity), intensity);
}
/// <summary>
/// Convert a given <see cref="Color"/> to a HSL color (hue, saturation, lightness)
/// </summary>
/// <param name="color">The <see cref="Color"/> to convert</param>
/// <returns>The hue [0°..360°], saturation [0..1] and lightness [0..1] values of the converted color</returns>
internal static (double hue, double saturation, double lightness) ConvertToHSLColor(Color color)
{
var min = Math.Min(Math.Min(color.R, color.G), color.B) / 255d;
var max = Math.Max(Math.Max(color.R, color.G), color.B) / 255d;
var lightness = (max + min) / 2d;
if (lightness == 0d || min == max)
{
return (color.GetHue(), 0d, lightness);
}
else if (lightness > 0d && lightness <= 0.5d)
{
return (color.GetHue(), (max - min) / (max + min), lightness);
}
return (color.GetHue(), (max - min) / (2d - (max + min)), lightness);
}
/// <summary>
/// Convert a given <see cref="Color"/> to a HSV color (hue, saturation, value)
/// </summary>
/// <param name="color">The <see cref="Color"/> to convert</param>
/// <returns>The hue [0°..360°], saturation [0..1] and value [0..1] of the converted color</returns>
internal static (double hue, double saturation, double value) ConvertToHSVColor(Color color)
{
var min = Math.Min(Math.Min(color.R, color.G), color.B) / 255d;
var max = Math.Max(Math.Max(color.R, color.G), color.B) / 255d;
return (color.GetHue(), max == 0d ? 0d : (max - min) / max, max);
}
/// <summary>
/// Convert a given <see cref="Color"/> to a HWB color (hue, whiteness, blackness)
/// </summary>
/// <param name="color">The <see cref="Color"/> to convert</param>
/// <returns>The hue [0°..360°], whiteness [0..1] and blackness [0..1] of the converted color</returns>
internal static (double hue, double whiteness, double blackness) ConvertToHWBColor(Color color)
{
var min = Math.Min(Math.Min(color.R, color.G), color.B) / 255d;
var max = Math.Max(Math.Max(color.R, color.G), color.B) / 255d;
return (color.GetHue(), min, 1 - max);
}
/// <summary>
/// Convert a given <see cref="Color"/> to a natural color (hue, whiteness, blackness)
/// </summary>
/// <param name="color">The <see cref="Color"/> to convert</param>
/// <returns>The hue, whiteness [0..1] and blackness [0..1] of the converted color</returns>
internal static (string hue, double whiteness, double blackness) ConvertToNaturalColor(Color color)
{
var min = Math.Min(Math.Min(color.R, color.G), color.B) / 255d;
var max = Math.Max(Math.Max(color.R, color.G), color.B) / 255d;
return (GetNaturalColorFromHue(color.GetHue()), min, 1 - max);
}
/// <summary>
/// Return the natural color for the given hue value
/// </summary>
/// <param name="hue">The hue value to convert</param>
/// <returns>A natural color</returns>
private static string GetNaturalColorFromHue(double hue)
{
if (hue < 60d)
{
return $"R{Math.Round(hue / 0.6d, 0)}";
}
if (hue < 120d)
{
return $"Y{Math.Round((hue - 60d) / 0.6d, 0)}";
}
if (hue < 180d)
{
return $"G{Math.Round((hue - 120d) / 0.6d, 0)}";
}
if (hue < 240d)
{
return $"C{Math.Round((hue - 180d) / 0.6d, 0)}";
}
if (hue < 300d)
{
return $"B{Math.Round((hue - 240d) / 0.6d, 0)}";
}
return $"M{Math.Round((hue - 300d) / 0.6d, 0)}";
}
}
}

View File

@@ -5,7 +5,7 @@
using System;
using System.Drawing;
using System.Globalization;
using Microsoft.PowerToys.Settings.UI.Library;
using Microsoft.PowerToys.Settings.UI.Library.Enumerations;
namespace ColorPicker.Helpers
{
@@ -25,14 +25,38 @@ namespace ColorPicker.Helpers
{
ColorRepresentationType.CMYK => ColorToCYMK(color),
ColorRepresentationType.HEX => ColorToHex(color),
ColorRepresentationType.HSB => ColorToHSB(color),
ColorRepresentationType.HSI => ColorToHSI(color),
ColorRepresentationType.HSL => ColorToHSL(color),
ColorRepresentationType.HSV => ColorToHSV(color),
ColorRepresentationType.HWB => ColorToHWB(color),
ColorRepresentationType.NCol => ColorToNCol(color),
ColorRepresentationType.RGB => ColorToRGB(color),
// Fall-back value, when "_userSettings.CopiedColorRepresentation.Value" is incorrect
_ => ColorToHex(color),
};
/// <summary>
/// Return a <see cref="string"/> representation of a CYMK color
/// </summary>
/// <param name="color">The <see cref="Color"/> for the CYMK color presentation</param>
/// <returns>A <see cref="string"/> representation of a CYMK color</returns>
private static string ColorToCYMK(Color color)
{
var (cyan, magenta, yellow, blackKey) = ColorHelper.ConvertToCMYKColor(color);
cyan = Math.Round(cyan * 100);
magenta = Math.Round(magenta * 100);
yellow = Math.Round(yellow * 100);
blackKey = Math.Round(blackKey * 100);
return $"cmyk({cyan.ToString(CultureInfo.InvariantCulture)}%"
+ $", {magenta.ToString(CultureInfo.InvariantCulture)}%"
+ $", {yellow.ToString(CultureInfo.InvariantCulture)}%"
+ $", {blackKey.ToString(CultureInfo.InvariantCulture)}%)";
}
/// <summary>
/// Return a hexadecimal <see cref="string"/> representation of a RGB color
/// </summary>
@@ -44,19 +68,45 @@ namespace ColorPicker.Helpers
+ $"{color.B.ToString("X2", CultureInfo.InvariantCulture)}";
/// <summary>
/// Return a <see cref="string"/> representation of a RGB color
/// Return a <see cref="string"/> representation of a HSB color
/// </summary>
/// <param name="color">The see cref="Color"/> for the RGB color presentation</param>
/// <returns>A <see cref="string"/> representation of a RGB color</returns>
private static string ColorToRGB(Color color)
=> $"rgb({color.R.ToString(CultureInfo.InvariantCulture)}"
+ $", {color.G.ToString(CultureInfo.InvariantCulture)}"
+ $", {color.B.ToString(CultureInfo.InvariantCulture)})";
/// <param name="color">The <see cref="Color"/> for the HSB color presentation</param>
/// <returns>A <see cref="string"/> representation of a HSB color</returns>
private static string ColorToHSB(Color color)
{
var (hue, saturation, brightness) = ColorHelper.ConvertToHSBColor(color);
hue = Math.Round(hue);
saturation = Math.Round(saturation * 100);
brightness = Math.Round(brightness * 100);
return $"hsb({hue.ToString(CultureInfo.InvariantCulture)}"
+ $", {saturation.ToString(CultureInfo.InvariantCulture)}%"
+ $", {brightness.ToString(CultureInfo.InvariantCulture)}%)";
}
/// <summary>
/// Return a <see cref="string"/> representation of a HSI color
/// </summary>
/// <param name="color">The <see cref="Color"/> for the HSI color presentation</param>
/// <returns>A <see cref="string"/> representation of a HSI color</returns>
private static string ColorToHSI(Color color)
{
var (hue, saturation, intensity) = ColorHelper.ConvertToHSIColor(color);
hue = Math.Round(hue);
saturation = Math.Round(saturation * 100);
intensity = Math.Round(intensity * 100);
return $"hsi({hue.ToString(CultureInfo.InvariantCulture)}"
+ $", {saturation.ToString(CultureInfo.InvariantCulture)}%"
+ $", {intensity.ToString(CultureInfo.InvariantCulture)}%)";
}
/// <summary>
/// Return a <see cref="string"/> representation of a HSL color
/// </summary>
/// <param name="color">The see cref="Color"/> for the HSL color presentation</param>
/// <param name="color">The <see cref="Color"/> for the HSL color presentation</param>
/// <returns>A <see cref="string"/> representation of a HSL color</returns>
private static string ColorToHSL(Color color)
{
@@ -75,7 +125,7 @@ namespace ColorPicker.Helpers
/// <summary>
/// Return a <see cref="string"/> representation of a HSV color
/// </summary>
/// <param name="color">The see cref="Color"/> for the HSV color presentation</param>
/// <param name="color">The <see cref="Color"/> for the HSV color presentation</param>
/// <returns>A <see cref="string"/> representation of a HSV color</returns>
private static string ColorToHSV(Color color)
{
@@ -92,24 +142,48 @@ namespace ColorPicker.Helpers
}
/// <summary>
/// Return a <see cref="string"/> representation of a HSV color
/// Return a <see cref="string"/> representation of a HWB color
/// </summary>
/// <param name="color">The see cref="Color"/> for the HSV color presentation</param>
/// <returns>A <see cref="string"/> representation of a HSV color</returns>
private static string ColorToCYMK(Color color)
/// <param name="color">The <see cref="Color"/> for the HWB color presentation</param>
/// <returns>A <see cref="string"/> representation of a HWB color</returns>
private static string ColorToHWB(Color color)
{
var (cyan, magenta, yellow, blackKey) = ColorHelper.ConvertToCMYKColor(color);
var (hue, whiteness, blackness) = ColorHelper.ConvertToHWBColor(color);
cyan = Math.Round(cyan * 100);
magenta = Math.Round(magenta * 100);
yellow = Math.Round(yellow * 100);
blackKey = Math.Round(blackKey * 100);
hue = Math.Round(hue);
whiteness = Math.Round(whiteness * 100);
blackness = Math.Round(blackness * 100);
// Using InvariantCulture since this is used for color representation
return $"cmyk({cyan.ToString(CultureInfo.InvariantCulture)}%"
+ $", {magenta.ToString(CultureInfo.InvariantCulture)}%"
+ $", {yellow.ToString(CultureInfo.InvariantCulture)}%"
+ $", {blackKey.ToString(CultureInfo.InvariantCulture)}%)";
return $"hwb({hue.ToString(CultureInfo.InvariantCulture)}"
+ $", {whiteness.ToString(CultureInfo.InvariantCulture)}%"
+ $", {blackness.ToString(CultureInfo.InvariantCulture)}%)";
}
/// <summary>
/// Return a <see cref="string"/> representation of a natural color
/// </summary>
/// <param name="color">The <see cref="Color"/> for the natural color presentation</param>
/// <returns>A <see cref="string"/> representation of a natural color</returns>
private static string ColorToNCol(Color color)
{
var (hue, whiteness, blackness) = ColorHelper.ConvertToNaturalColor(color);
whiteness = Math.Round(whiteness * 100);
blackness = Math.Round(blackness * 100);
return $"{hue}"
+ $", {whiteness.ToString(CultureInfo.InvariantCulture)}%"
+ $", {blackness.ToString(CultureInfo.InvariantCulture)}%";
}
/// <summary>
/// Return a <see cref="string"/> representation of a RGB color
/// </summary>
/// <param name="color">The see cref="Color"/> for the RGB color presentation</param>
/// <returns>A <see cref="string"/> representation of a RGB color</returns>
private static string ColorToRGB(Color color)
=> $"rgb({color.R.ToString(CultureInfo.InvariantCulture)}"
+ $", {color.G.ToString(CultureInfo.InvariantCulture)}"
+ $", {color.B.ToString(CultureInfo.InvariantCulture)})";
}
}

View File

@@ -2,7 +2,7 @@
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using Microsoft.PowerToys.Settings.UI.Library;
using Microsoft.PowerToys.Settings.UI.Library.Enumerations;
namespace ColorPicker.Settings
{

View File

@@ -8,6 +8,7 @@ using System.IO;
using System.IO.Abstractions;
using System.Threading;
using Microsoft.PowerToys.Settings.UI.Library;
using Microsoft.PowerToys.Settings.UI.Library.Enumerations;
using Microsoft.PowerToys.Settings.UI.Library.Utilities;
namespace ColorPicker.Settings

View File

@@ -15,7 +15,6 @@ using ColorPicker.Mouse;
using ColorPicker.Settings;
using ColorPicker.Telemetry;
using ColorPicker.ViewModelContracts;
using Microsoft.PowerToys.Settings.UI.Library;
using Microsoft.PowerToys.Telemetry;
namespace ColorPicker.ViewModels

View File

@@ -1,5 +1,6 @@
using System;
using System.Drawing;
using System.Globalization;
using ColorPicker.Helpers;
using Microsoft.VisualStudio.TestTools.UnitTesting;
@@ -41,7 +42,7 @@ namespace UnitTest_ColorPickerUI.Helpers
[DataRow(315, 100, 050, 100, 000, 075)] // Red-magenta
[DataRow(330, 100, 050, 100, 000, 050)] // Blue-red
[DataRow(345, 100, 050, 100, 000, 025)] // Light blue-red
public void ColorRGBtoHSL(double hue, double saturation, double lightness, int red, int green, int blue)
public void ColorRGBtoHSLTest(double hue, double saturation, double lightness, int red, int green, int blue)
{
red = Convert.ToInt32(Math.Round(255d / 100d * red)); // [0%..100%] to [0..255]
green = Convert.ToInt32(Math.Round(255d / 100d * green)); // [0%..100%] to [0..255]
@@ -90,7 +91,7 @@ namespace UnitTest_ColorPickerUI.Helpers
[DataRow(315, 100, 100, 100, 000, 075)] // Red-magenta
[DataRow(330, 100, 100, 100, 000, 050)] // Blue-red
[DataRow(345, 100, 100, 100, 000, 025)] // Light blue-red
public void ColorRGBtoHSV(double hue, double saturation, double value, int red, int green, int blue)
public void ColorRGBtoHSVTest(double hue, double saturation, double value, int red, int green, int blue)
{
red = Convert.ToInt32(Math.Round(255d / 100d * red)); // [0%..100%] to [0..255]
green = Convert.ToInt32(Math.Round(255d / 100d * green)); // [0%..100%] to [0..255]
@@ -138,7 +139,7 @@ namespace UnitTest_ColorPickerUI.Helpers
[DataRow(000, 100, 025, 000, 255, 000, 192)] // Red-magenta
[DataRow(000, 100, 050, 000, 255, 000, 128)] // Blue-red
[DataRow(000, 100, 075, 000, 255, 000, 064)] // Light blue-red
public void ColorRGBtoCMYK(int cyan, int magenta, int yellow, int blackKey, int red, int green, int blue)
public void ColorRGBtoCMYKTest(int cyan, int magenta, int yellow, int blackKey, int red, int green, int blue)
{
var color = Color.FromArgb(255, red, green, blue);
var result = ColorHelper.ConvertToCMYKColor(color);
@@ -156,8 +157,130 @@ namespace UnitTest_ColorPickerUI.Helpers
Assert.AreEqual(result.blackKey * 100d, blackKey, 0.5d);
}
// values taken from https://en.wikipedia.org/wiki/HSL_and_HSV#Examples
[TestMethod]
public void ColorRGBtoCMYKZeroDiv()
[DataRow("FFFFFF", 000.0, 000.0, 100.0)] // white
[DataRow("808080", 000.0, 000.0, 050.0)] // gray
[DataRow("000000", 000.0, 000.0, 000.0)] // black
[DataRow("FF0000", 000.0, 100.0, 033.3)] // red
[DataRow("BFBF00", 060.0, 100.0, 050.0)] // yellow
[DataRow("008000", 120.0, 100.0, 016.7)] // green
[DataRow("80FFFF", 180.0, 040.0, 083.3)] // cyan
[DataRow("8080FF", 240.0, 025.0, 066.7)] // blue
[DataRow("BF40BF", 300.0, 057.1, 058.3)] // magenta
[DataRow("A0A424", 061.8, 069.9, 047.1)]
[DataRow("411BEA", 251.1, 075.6, 042.6)]
[DataRow("1EAC41", 134.9, 066.7, 034.9)]
[DataRow("F0C80E", 049.5, 091.1, 059.3)]
[DataRow("B430E5", 283.7, 068.6, 059.6)]
[DataRow("ED7651", 014.3, 044.6, 057.0)]
[DataRow("FEF888", 056.9, 036.3, 083.5)]
[DataRow("19CB97", 162.4, 080.0, 049.5)]
[DataRow("362698", 248.3, 053.3, 031.9)]
[DataRow("7E7EB8", 240.5, 013.5, 057.0)]
public void ColorRGBtoHSITest(string hexValue, double hue, double saturation, double intensity)
{
var red = int.Parse(hexValue.Substring(0, 2), NumberStyles.HexNumber);
var green = int.Parse(hexValue.Substring(2, 2), NumberStyles.HexNumber);
var blue = int.Parse(hexValue.Substring(4, 2), NumberStyles.HexNumber);
var color = Color.FromArgb(255, red, green, blue);
var result = ColorHelper.ConvertToHSIColor(color);
// hue[0<>..360<EFBFBD>]
Assert.AreEqual(result.hue, hue, 0.5d);
// saturation[0..1]
Assert.AreEqual(result.saturation * 100d, saturation, 0.5d);
// intensity[0..1]
Assert.AreEqual(result.intensity * 100d, intensity, 0.5d);
}
// values taken from https://en.wikipedia.org/wiki/HSL_and_HSV#Examples
// and manual convert via https://colorconv.com/hwb
[TestMethod]
[DataRow("FFFFFF", 000, 100, 000)] // white
[DataRow("808080", 000, 050, 050)] // gray
[DataRow("000000", 000, 000, 100)] // black
[DataRow("FF0000", 000, 000, 000)] // red
[DataRow("BFBF00", 060, 000, 025)] // yellow
[DataRow("008000", 120, 000, 050)] // green
[DataRow("80FFFF", 180, 050, 000)] // cyan
[DataRow("8080FF", 240, 050, 000)] // blue
[DataRow("BF40BF", 300, 025, 025)] // magenta
[DataRow("A0A424", 062, 014, 036)]
[DataRow("411BEA", 251, 011, 008)]
[DataRow("1EAC41", 135, 012, 033)]
[DataRow("F0C80E", 049, 005, 006)]
[DataRow("B430E5", 284, 019, 010)]
[DataRow("ED7651", 014, 032, 007)]
[DataRow("FEF888", 057, 053, 000)]
[DataRow("19CB97", 162, 010, 020)]
[DataRow("362698", 248, 015, 040)]
[DataRow("7E7EB8", 240, 049, 028)]
public void ColorRGBtoHWBTest(string hexValue, double hue, double whiteness, double blackness)
{
var red = int.Parse(hexValue.Substring(0, 2), NumberStyles.HexNumber);
var green = int.Parse(hexValue.Substring(2, 2), NumberStyles.HexNumber);
var blue = int.Parse(hexValue.Substring(4, 2), NumberStyles.HexNumber);
var color = Color.FromArgb(255, red, green, blue);
var result = ColorHelper.ConvertToHWBColor(color);
// hue[0<>..360<EFBFBD>]
Assert.AreEqual(result.hue, hue, 0.5d);
// whiteness[0..1]
Assert.AreEqual(result.whiteness * 100d, whiteness, 0.5d);
// blackness[0..1]
Assert.AreEqual(result.blackness * 100d, blackness, 0.5d);
}
// values taken from https://en.wikipedia.org/wiki/HSL_and_HSV#Examples
// and manual convert via https://colorconv.com/hwb
[TestMethod]
[DataRow("FFFFFF", "R0", 100, 000)] // white
[DataRow("808080", "R0", 050, 050)] // gray
[DataRow("000000", "R0", 000, 100)] // black
[DataRow("FF0000", "R0", 000, 000)] // red
[DataRow("BFBF00", "Y0", 000, 025)] // yellow
[DataRow("008000", "G0", 000, 050)] // green
[DataRow("80FFFF", "C0", 050, 000)] // cyan
[DataRow("8080FF", "B0", 050, 000)] // blue
[DataRow("BF40BF", "M0", 025, 025)] // magenta
[DataRow("A0A424", "Y3", 014, 036)]
[DataRow("411BEA", "B18", 011, 008)]
[DataRow("1EAC41", "G25", 012, 033)]
[DataRow("F0C80E", "R82", 005, 006)]
[DataRow("B430E5", "B73", 019, 010)]
[DataRow("ED7651", "R24", 032, 007)]
[DataRow("FEF888", "R95", 053, 000)]
[DataRow("19CB97", "G71", 010, 020)]
[DataRow("362698", "B14", 015, 040)]
[DataRow("7E7EB8", "B0", 049, 028)]
public void ColorRGBtoNColTest(string hexValue, string hue, double whiteness, double blackness)
{
var red = int.Parse(hexValue.Substring(0, 2), NumberStyles.HexNumber);
var green = int.Parse(hexValue.Substring(2, 2), NumberStyles.HexNumber);
var blue = int.Parse(hexValue.Substring(4, 2), NumberStyles.HexNumber);
var color = Color.FromArgb(255, red, green, blue);
var result = ColorHelper.ConvertToNaturalColor(color);
// hue
Assert.AreEqual(result.hue, hue);
// whiteness[0..1]
Assert.AreEqual(result.whiteness * 100d, whiteness, 0.5d);
// blackness[0..1]
Assert.AreEqual(result.blackness * 100d, blackness, 0.5d);
}
[TestMethod]
public void ColorRGBtoCMYKZeroDivTest()
{
for(var red = 0; red < 256; red++)
{

View File

@@ -1,5 +1,5 @@
using ColorPicker.Helpers;
using Microsoft.PowerToys.Settings.UI.Library;
using Microsoft.PowerToys.Settings.UI.Library.Enumerations;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Drawing;
@@ -11,11 +11,15 @@ namespace UnitTest_ColorPickerUI.Helpers
[TestMethod]
[DataRow(ColorRepresentationType.CMYK, "cmyk(0%, 0%, 0%, 100%)")]
[DataRow(ColorRepresentationType.HEX, "#000000")]
[DataRow(ColorRepresentationType.NCol, "R0, 0%, 100%")]
[DataRow(ColorRepresentationType.HSB, "hsb(0, 0%, 0%)")]
[DataRow(ColorRepresentationType.HSI, "hsi(0, 0%, 0%)")]
[DataRow(ColorRepresentationType.HSL, "hsl(0, 0%, 0%)")]
[DataRow(ColorRepresentationType.HSV, "hsv(0, 0%, 0%)")]
[DataRow(ColorRepresentationType.HWB, "hwb(0, 0%, 100%)")]
[DataRow(ColorRepresentationType.RGB, "rgb(0, 0, 0)")]
public void ColorRGBtoCMYKZeroDiv(ColorRepresentationType type, string expected)
public void GetStringRepresentationTest(ColorRepresentationType type, string expected)
{
var result = ColorRepresentationHelper.GetStringRepresentation(Color.Black, type);
Assert.AreEqual(result, expected);

View File

@@ -211,7 +211,10 @@
<Border Margin="8"
BorderBrush="{Binding Path=IsSelected, Converter={StaticResource BooleanToBrushConverter}}"
Style="{StaticResource templateBackground}"
MouseDown="LayoutItem_Click">
MouseDown="LayoutItem_Click"
Focusable="True"
FocusManager.GotFocus="LayoutItem_Focused"
KeyDown="LayoutItem_Apply">
<DockPanel Margin="0,20,0,0"
VerticalAlignment="Stretch"
HorizontalAlignment="Stretch"
@@ -244,7 +247,10 @@
<Border Margin="8"
BorderBrush="{Binding Path=IsSelected, Converter={StaticResource BooleanToBrushConverter}}"
Style="{StaticResource templateBackground}"
MouseDown="LayoutItem_Click">
MouseDown="LayoutItem_Click"
Focusable="True"
FocusManager.GotFocus="LayoutItem_Focused"
KeyDown="LayoutItem_Apply">
<DockPanel Margin="0,20,0,0"
VerticalAlignment="Stretch"
HorizontalAlignment="Stretch"

View File

@@ -84,6 +84,21 @@ namespace FancyZonesEditor
Select(((Border)sender).DataContext as LayoutModel);
}
private void LayoutItem_Focused(object sender, RoutedEventArgs e)
{
Select(((Border)sender).DataContext as LayoutModel);
}
private void LayoutItem_Apply(object sender, KeyEventArgs e)
{
if (e.Key == Key.Return || e.Key == Key.Space)
{
// When certain layout item (template or custom) is focused through keyboard and user
// presses Enter or Space key, layout will be applied.
Apply();
}
}
private void Select(LayoutModel newSelection)
{
if (EditorOverlay.Current.DataContext is LayoutModel currentSelection)
@@ -154,6 +169,11 @@ namespace FancyZonesEditor
}
private void Apply_Click(object sender, RoutedEventArgs e)
{
Apply();
}
private void Apply()
{
EditorOverlay mainEditor = EditorOverlay.Current;

View File

@@ -59,20 +59,6 @@ namespace FancyZonesEditor
private const int MaxNegativeSpacing = -10;
// Localizable strings
private const string ErrorMessageBoxTitle = "FancyZones Editor Error";
private const string ErrorParsingDeviceInfo = "Error parsing device info data.";
private const string ErrorInvalidArgs = "FancyZones Editor arguments are invalid.";
private const string ErrorNonStandaloneApp = "FancyZones Editor should not be run as standalone application.";
// Displayed layout names are localizable strings, but their underlying json tags are not.
private const string FocusLayoutID = "Focus";
private const string ColumnsLayoutID = "Columns";
private const string RowsLayoutID = "Rows";
private const string GridLayoutID = "Grid";
private const string PriorityGridLayoutID = "Priority Grid";
private const string CreateNewCustomLabel = "Create new custom";
// Non-localizable strings
public static readonly string RegistryPath = "SOFTWARE\\SuperFancyZones";
public static readonly string FullRegistryPath = "HKEY_CURRENT_USER\\" + RegistryPath;
@@ -153,30 +139,30 @@ namespace FancyZonesEditor
// Initialize the five default layout models: Focus, Columns, Rows, Grid, and PriorityGrid
DefaultModels = new List<LayoutModel>(5);
_focusModel = new CanvasLayoutModel(FocusLayoutID, LayoutType.Focus);
_focusModel = new CanvasLayoutModel(Properties.Resources.Template_Layout_Focus, LayoutType.Focus);
DefaultModels.Add(_focusModel);
_columnsModel = new GridLayoutModel(ColumnsLayoutID, LayoutType.Columns)
_columnsModel = new GridLayoutModel(Properties.Resources.Template_Layout_Columns, LayoutType.Columns)
{
Rows = 1,
RowPercents = new List<int>(1) { _multiplier },
};
DefaultModels.Add(_columnsModel);
_rowsModel = new GridLayoutModel(RowsLayoutID, LayoutType.Rows)
_rowsModel = new GridLayoutModel(Properties.Resources.Template_Layout_Rows, LayoutType.Rows)
{
Columns = 1,
ColumnPercents = new List<int>(1) { _multiplier },
};
DefaultModels.Add(_rowsModel);
_gridModel = new GridLayoutModel(GridLayoutID, LayoutType.Grid);
_gridModel = new GridLayoutModel(Properties.Resources.Template_Layout_Grid, LayoutType.Grid);
DefaultModels.Add(_gridModel);
_priorityGridModel = new GridLayoutModel(PriorityGridLayoutID, LayoutType.PriorityGrid);
_priorityGridModel = new GridLayoutModel(Properties.Resources.Template_Layout_Priority_Grid, LayoutType.PriorityGrid);
DefaultModels.Add(_priorityGridModel);
_blankCustomModel = new CanvasLayoutModel(CreateNewCustomLabel, LayoutType.Blank);
_blankCustomModel = new CanvasLayoutModel(Properties.Resources.Custom_Layout_Create_New, LayoutType.Blank);
UpdateLayoutModels();
}
@@ -495,7 +481,7 @@ namespace FancyZonesEditor
}
catch (Exception ex)
{
LayoutModel.ShowExceptionMessageBox(ErrorParsingDeviceInfo, ex);
LayoutModel.ShowExceptionMessageBox(Properties.Resources.Error_Parsing_Device_Info, ex);
}
}
@@ -514,7 +500,7 @@ namespace FancyZonesEditor
}
else
{
MessageBox.Show(ErrorInvalidArgs, ErrorMessageBoxTitle);
MessageBox.Show(Properties.Resources.Error_Invalid_Arguments, Properties.Resources.Error_Message_Box_Title);
((App)Application.Current).Shutdown();
}
}
@@ -526,7 +512,7 @@ namespace FancyZonesEditor
var parsedLocation = singleMonitorString.Split('_');
if (parsedLocation.Length != 4)
{
MessageBox.Show(ErrorInvalidArgs, ErrorMessageBoxTitle);
MessageBox.Show(Properties.Resources.Error_Invalid_Arguments, Properties.Resources.Error_Message_Box_Title);
((App)Application.Current).Shutdown();
}
@@ -553,7 +539,7 @@ namespace FancyZonesEditor
}
else
{
MessageBox.Show(ErrorNonStandaloneApp, ErrorMessageBoxTitle);
MessageBox.Show(Properties.Resources.Error_Invalid_Arguments, Properties.Resources.Error_Message_Box_Title);
((App)Application.Current).Shutdown();
}
}

View File

@@ -132,6 +132,15 @@ namespace FancyZonesEditor.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to Create new custom.
/// </summary>
public static string Custom_Layout_Create_New {
get {
return ResourceManager.GetString("Custom_Layout_Create_New", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Custom layout creator.
/// </summary>
@@ -177,6 +186,42 @@ namespace FancyZonesEditor.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to FancyZones Editor arguments are invalid..
/// </summary>
public static string Error_Invalid_Arguments {
get {
return ResourceManager.GetString("Error_Invalid_Arguments", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to FancyZones Editor Error.
/// </summary>
public static string Error_Message_Box_Title {
get {
return ResourceManager.GetString("Error_Message_Box_Title", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to FancyZones Editor should not be run as standalone application..
/// </summary>
public static string Error_Not_Standalone_App {
get {
return ResourceManager.GetString("Error_Not_Standalone_App", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Error parsing device info data..
/// </summary>
public static string Error_Parsing_Device_Info {
get {
return ResourceManager.GetString("Error_Parsing_Device_Info", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to FancyZones Editor.
/// </summary>
@@ -249,6 +294,51 @@ namespace FancyZonesEditor.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to Columns.
/// </summary>
public static string Template_Layout_Columns {
get {
return ResourceManager.GetString("Template_Layout_Columns", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Focus.
/// </summary>
public static string Template_Layout_Focus {
get {
return ResourceManager.GetString("Template_Layout_Focus", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Grid.
/// </summary>
public static string Template_Layout_Grid {
get {
return ResourceManager.GetString("Template_Layout_Grid", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Priority Grid.
/// </summary>
public static string Template_Layout_Priority_Grid {
get {
return ResourceManager.GetString("Template_Layout_Priority_Grid", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Rows.
/// </summary>
public static string Template_Layout_Rows {
get {
return ResourceManager.GetString("Template_Layout_Rows", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Templates.
/// </summary>

View File

@@ -189,4 +189,35 @@
<data name="Custom_Layout_Delete_Button" xml:space="preserve">
<value>Delete custom layout</value>
</data>
<data name="Custom_Layout_Create_New" xml:space="preserve">
<value>Create new custom</value>
<comment>As in Create new custom layout</comment>
</data>
<data name="Error_Invalid_Arguments" xml:space="preserve">
<value>FancyZones Editor arguments are invalid.</value>
</data>
<data name="Error_Message_Box_Title" xml:space="preserve">
<value>FancyZones Editor Error</value>
</data>
<data name="Error_Not_Standalone_App" xml:space="preserve">
<value>FancyZones Editor should not be run as standalone application.</value>
</data>
<data name="Error_Parsing_Device_Info" xml:space="preserve">
<value>Error parsing device info data.</value>
</data>
<data name="Template_Layout_Columns" xml:space="preserve">
<value>Columns</value>
</data>
<data name="Template_Layout_Focus" xml:space="preserve">
<value>Focus</value>
</data>
<data name="Template_Layout_Grid" xml:space="preserve">
<value>Grid</value>
</data>
<data name="Template_Layout_Priority_Grid" xml:space="preserve">
<value>Priority Grid</value>
</data>
<data name="Template_Layout_Rows" xml:space="preserve">
<value>Rows</value>
</data>
</root>

View File

@@ -91,6 +91,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Custom_Layout_Delete_Button" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Delete custom layout]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Odstranit vlastní rozložení]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Custom_Table_Layout" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Custom table layout creator]]></Val>
@@ -136,6 +145,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Grid_Layout_Editor" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Grid layout editor]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Editor rozložení mřížky]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Name" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Name]]></Val>
@@ -190,6 +208,24 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Zone_Count_Decrement" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Decrement number of zones in template layout]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Snížit počet zón v rozložení šablony]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Zone_Count_Increment" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Increment number of zones in template layout]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Zvýšit počet zón v rozložení šablony]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
</Item>
</Item>
</LCX>

View File

@@ -91,6 +91,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Custom_Layout_Delete_Button" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Delete custom layout]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Benutzerdefiniertes Layout löschen]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Custom_Table_Layout" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Custom table layout creator]]></Val>
@@ -136,6 +145,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Grid_Layout_Editor" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Grid layout editor]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Rasterlayout-Editor]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Name" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Name]]></Val>
@@ -190,6 +208,24 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Zone_Count_Decrement" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Decrement number of zones in template layout]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Anzahl von Zonen im Vorlagenlayout verringern]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Zone_Count_Increment" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Increment number of zones in template layout]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Anzahl von Zonen im Vorlagenlayout erhöhen]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
</Item>
</Item>
</LCX>

View File

@@ -91,6 +91,12 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Custom_Layout_Delete_Button" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Delete custom layout]]></Val>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Custom_Table_Layout" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Custom table layout creator]]></Val>
@@ -122,7 +128,7 @@
<Str Cat="Text">
<Val><![CDATA[FancyZones Editor]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Editor de Diseños sofisticados]]></Val>
<Val><![CDATA[Editor de FancyZones]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -131,11 +137,17 @@
<Str Cat="Text">
<Val><![CDATA[FancyZones main editor]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Editor principal de Diseños sofisticados]]></Val>
<Val><![CDATA[Editor principal de FancyZones]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Grid_Layout_Editor" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Grid layout editor]]></Val>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Name" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Name]]></Val>
@@ -190,6 +202,18 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Zone_Count_Decrement" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Decrement number of zones in template layout]]></Val>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Zone_Count_Increment" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Increment number of zones in template layout]]></Val>
</Str>
<Disp Icon="Str" />
</Item>
</Item>
</Item>
</LCX>

View File

@@ -91,6 +91,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Custom_Layout_Delete_Button" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Delete custom layout]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Supprimer la disposition personnalisée]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Custom_Table_Layout" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Custom table layout creator]]></Val>
@@ -136,6 +145,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Grid_Layout_Editor" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Grid layout editor]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Éditeur de disposition de grille]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Name" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Name]]></Val>
@@ -190,6 +208,24 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Zone_Count_Decrement" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Decrement number of zones in template layout]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Décrémenter le nombre de zones dans la disposition du modèle]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Zone_Count_Increment" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Increment number of zones in template layout]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Incrémenter le nombre de zones dans la disposition du modèle]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
</Item>
</Item>
</LCX>

View File

@@ -91,6 +91,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Custom_Layout_Delete_Button" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Delete custom layout]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[カスタム レイアウトの削除]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Custom_Table_Layout" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Custom table layout creator]]></Val>
@@ -136,6 +145,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Grid_Layout_Editor" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Grid layout editor]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[グリッド レイアウト エディター]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Name" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Name]]></Val>
@@ -190,6 +208,24 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Zone_Count_Decrement" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Decrement number of zones in template layout]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[テンプレート レイアウト内のゾーンの数を減らす]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Zone_Count_Increment" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Increment number of zones in template layout]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[テンプレート レイアウト内のゾーンの数を増やす]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
</Item>
</Item>
</LCX>

View File

@@ -91,6 +91,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Custom_Layout_Delete_Button" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Delete custom layout]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[사용자 지정 레이아웃 삭제]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Custom_Table_Layout" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Custom table layout creator]]></Val>
@@ -136,6 +145,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Grid_Layout_Editor" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Grid layout editor]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[그리드 레이아웃 편집기]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Name" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Name]]></Val>
@@ -190,6 +208,24 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Zone_Count_Decrement" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Decrement number of zones in template layout]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[템플릿 레이아웃의 영역 수 감소]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Zone_Count_Increment" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Increment number of zones in template layout]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[템플릿 레이아웃의 영역 수 증가]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
</Item>
</Item>
</LCX>

View File

@@ -91,6 +91,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Custom_Layout_Delete_Button" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Delete custom layout]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Aangepaste indeling verwijderen]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Custom_Table_Layout" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Custom table layout creator]]></Val>
@@ -136,6 +145,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Grid_Layout_Editor" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Grid layout editor]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Editor voor rasterindeling]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Name" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Name]]></Val>
@@ -190,6 +208,24 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Zone_Count_Decrement" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Decrement number of zones in template layout]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Aantal zones in sjabloonindeling verlagen]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Zone_Count_Increment" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Increment number of zones in template layout]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Aantal zones in sjabloonindeling verhogen]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
</Item>
</Item>
</LCX>

View File

@@ -91,6 +91,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Custom_Layout_Delete_Button" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Delete custom layout]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Usuń układ niestandardowy]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Custom_Table_Layout" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Custom table layout creator]]></Val>
@@ -122,7 +131,7 @@
<Str Cat="Text">
<Val><![CDATA[FancyZones Editor]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Edytor Fantazyjnych stref]]></Val>
<Val><![CDATA[Edytor FancyZones]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -131,7 +140,16 @@
<Str Cat="Text">
<Val><![CDATA[FancyZones main editor]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Główny edytor Fantazyjnych stref]]></Val>
<Val><![CDATA[Główny edytor FancyZones]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Grid_Layout_Editor" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Grid layout editor]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Edytor układu siatki]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -190,6 +208,24 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Zone_Count_Decrement" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Decrement number of zones in template layout]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Zmniejsz liczbę stref w układzie szablonu]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Zone_Count_Increment" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Increment number of zones in template layout]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Zwiększ liczbę stref w układzie szablonu]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
</Item>
</Item>
</LCX>

View File

@@ -91,6 +91,12 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Custom_Layout_Delete_Button" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Delete custom layout]]></Val>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Custom_Table_Layout" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Custom table layout creator]]></Val>
@@ -122,7 +128,7 @@
<Str Cat="Text">
<Val><![CDATA[FancyZones Editor]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Editor de Esquemas de Zonas]]></Val>
<Val><![CDATA[Editor de FancyZones]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -131,11 +137,17 @@
<Str Cat="Text">
<Val><![CDATA[FancyZones main editor]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Editor principal de Esquemas de Zonas]]></Val>
<Val><![CDATA[Editor principal de FancyZones]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Grid_Layout_Editor" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Grid layout editor]]></Val>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Name" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Name]]></Val>
@@ -190,6 +202,18 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Zone_Count_Decrement" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Decrement number of zones in template layout]]></Val>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Zone_Count_Increment" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Increment number of zones in template layout]]></Val>
</Str>
<Disp Icon="Str" />
</Item>
</Item>
</Item>
</LCX>

View File

@@ -91,6 +91,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Custom_Layout_Delete_Button" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Delete custom layout]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Удалить пользовательский макет]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Custom_Table_Layout" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Custom table layout creator]]></Val>
@@ -136,6 +145,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Grid_Layout_Editor" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Grid layout editor]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Редактор макета сетки]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Name" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Name]]></Val>
@@ -190,6 +208,24 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Zone_Count_Decrement" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Decrement number of zones in template layout]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Уменьшение числа зон в макете шаблона]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Zone_Count_Increment" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Increment number of zones in template layout]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Увеличение числа зон в макете шаблона]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
</Item>
</Item>
</LCX>

View File

@@ -91,6 +91,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Custom_Layout_Delete_Button" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Delete custom layout]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Ta bort anpassad layout]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Custom_Table_Layout" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Custom table layout creator]]></Val>
@@ -136,6 +145,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Grid_Layout_Editor" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Grid layout editor]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Redigeringsprogram för rutnätslayout]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Name" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Name]]></Val>
@@ -190,6 +208,24 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Zone_Count_Decrement" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Decrement number of zones in template layout]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Minska antalet zoner i mallayouten]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Zone_Count_Increment" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Increment number of zones in template layout]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Öka antalet zoner i mallayout]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
</Item>
</Item>
</LCX>

View File

@@ -91,6 +91,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Custom_Layout_Delete_Button" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Delete custom layout]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[删除自定义布局]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Custom_Table_Layout" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Custom table layout creator]]></Val>
@@ -136,6 +145,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Grid_Layout_Editor" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Grid layout editor]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[网格布局编辑器]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Name" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Name]]></Val>
@@ -190,6 +208,24 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Zone_Count_Decrement" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Decrement number of zones in template layout]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[模板布局中的区域递减数]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Zone_Count_Increment" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Increment number of zones in template layout]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[模板布局中的区域递增数]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
</Item>
</Item>
</LCX>

View File

@@ -91,6 +91,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Custom_Layout_Delete_Button" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Delete custom layout]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[刪除自訂配置]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Custom_Table_Layout" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Custom table layout creator]]></Val>
@@ -136,6 +145,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Grid_Layout_Editor" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Grid layout editor]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[方格配置編輯器]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Name" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Name]]></Val>
@@ -190,6 +208,24 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Zone_Count_Decrement" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Decrement number of zones in template layout]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[減少範本配置中的區域數]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Zone_Count_Increment" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Increment number of zones in template layout]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[增加範本配置中的區域數]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
</Item>
</Item>
</LCX>

View File

@@ -41,7 +41,7 @@
<Str Cat="Text">
<Val><![CDATA[FancyZones]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Diseños sofisticados]]></Val>
<Val><![CDATA[FancyZones]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -50,7 +50,7 @@
<Str Cat="Text">
<Val><![CDATA[FancyZones persisted data path not found. Please report the bug to]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[No se encontró la ruta de acceso a los datos persistentes de Diseños sofisticados. Notifique el error a]]></Val>
<Val><![CDATA[No se encontró la ruta de acceso a los datos persistentes de FancyZones. Notifique el error a]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -59,7 +59,7 @@
<Str Cat="Text">
<Val><![CDATA[The FancyZones editor failed to start. Please report the bug to]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[No se pudo iniciar el editor de Diseños sofisticados. Notifique el error a]]></Val>
<Val><![CDATA[No se pudo iniciar el editor de FancyZones. Notifique el error a]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -68,7 +68,7 @@
<Str Cat="Text">
<Val><![CDATA[Failed to load the FancyZones settings. Default settings will be used.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[No se pudo cargar la configuración de Diseños sofisticados. Se usará la configuración predeterminada.]]></Val>
<Val><![CDATA[No se pudo cargar la configuración de FancyZones. Se usará la configuración predeterminada.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -77,7 +77,7 @@
<Str Cat="Text">
<Val><![CDATA[Failed to save the FancyZones settings. Please retry again later, if the problem persists report the bug to]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[No se pudo guardar la configuración de Diseños sofisticados. Vuelva a intentarlo más tarde y, si el problema continúa, notifique el error a]]></Val>
<Val><![CDATA[No se pudo guardar la configuración de FancyZones. Vuelva a intentarlo más tarde y, si el problema continúa, notifique el error a]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -95,7 +95,7 @@
<Str Cat="Text">
<Val><![CDATA[PowerToys - FancyZones]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[PowerToys: Diseños sofisticados]]></Val>
<Val><![CDATA[PowerToys: FancyZones]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -251,7 +251,7 @@
<Str Cat="Text">
<Val><![CDATA[Flash zones when the active FancyZones layout changes]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Permite intercambiar las zonas cuando cambia el diseño activo de Diseños sofisticados.]]></Val>
<Val><![CDATA[Permite intercambiar las zonas cuando cambia el diseño activo de FancyZones.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />

View File

@@ -194,7 +194,7 @@
<Str Cat="Text">
<Val><![CDATA[Hold Shift key to activate zones while dragging]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[&lt;Shift&gt; 키를 누른 채로 끌어와서 영역 활성화]]></Val>
<Val><![CDATA[Shift 키를 누른 채로 끌어와서 영역 활성화]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -260,7 +260,7 @@
<Str Cat="Text">
<Val><![CDATA[During zone layout changes, windows assigned to a zone will match new size/positions]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[영역 레이아웃 변경하는 동안 영역에 할당 새 크기/위치와 일치하게 변경됩니다.]]></Val>
<Val><![CDATA[영역 레이아웃 변경 시, 영역에 할당되어 있던 새 크기/위치에 맞게 변경]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />

View File

@@ -41,7 +41,7 @@
<Str Cat="Text">
<Val><![CDATA[FancyZones]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Fantazyjne strefy]]></Val>
<Val><![CDATA[OK, it was localized according to instructions, but can be unlocalized. Global term change should be initiated.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -50,7 +50,7 @@
<Str Cat="Text">
<Val><![CDATA[FancyZones persisted data path not found. Please report the bug to]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Nie znaleziono ścieżki utrwalonych danych narzędzia Fantazyjne strefy. Zgłoś usterkę do]]></Val>
<Val><![CDATA[Nie znaleziono ścieżki utrwalonych danych narzędzia FancyZones. Zgłoś usterkę do]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -59,7 +59,7 @@
<Str Cat="Text">
<Val><![CDATA[The FancyZones editor failed to start. Please report the bug to]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Nie można uruchomić edytora narzędzia Fantazyjne strefy. Zgłoś usterkę do]]></Val>
<Val><![CDATA[Nie można uruchomić edytora FancyZones. Zgłoś usterkę do]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -68,7 +68,7 @@
<Str Cat="Text">
<Val><![CDATA[Failed to load the FancyZones settings. Default settings will be used.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Nie można załadować ustawień narzędzia Fantazyjne strefy. Zostaną użyte ustawienia domyślne.]]></Val>
<Val><![CDATA[Nie można załadować ustawień narzędzia FancyZones. Zostaną użyte ustawienia domyślne.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -77,7 +77,7 @@
<Str Cat="Text">
<Val><![CDATA[Failed to save the FancyZones settings. Please retry again later, if the problem persists report the bug to]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Nie można zapisać ustawień narzędzia Fantazyjne strefy. Spróbuj ponownie później, a jeśli problem będzie się powtarzać, zgłoś usterkę do]]></Val>
<Val><![CDATA[Nie można zapisać ustawień narzędzia FancyZones. Spróbuj ponownie później, a jeśli problem będzie się powtarzać, zgłoś usterkę do]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -95,7 +95,7 @@
<Str Cat="Text">
<Val><![CDATA[PowerToys - FancyZones]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[PowerToys — Fantazyjne strefy]]></Val>
<Val><![CDATA[PowerToys — FancyZones]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -251,7 +251,7 @@
<Str Cat="Text">
<Val><![CDATA[Flash zones when the active FancyZones layout changes]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Przełączaj strefy w przypadku zmiany aktywnego układu narzędzia Fantazyjne strefy]]></Val>
<Val><![CDATA[Przełączaj strefy w przypadku zmiany aktywnego układu narzędzia FancyZones]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />

View File

@@ -41,7 +41,7 @@
<Str Cat="Text">
<Val><![CDATA[FancyZones]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Esquemas de Zonas]]></Val>
<Val><![CDATA[FancyZones]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -50,7 +50,7 @@
<Str Cat="Text">
<Val><![CDATA[FancyZones persisted data path not found. Please report the bug to]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[O caminho de dados persistentes dos Esquemas de Zonas não foi encontrado. Reporte o erro para]]></Val>
<Val><![CDATA[O caminho de dados persistentes de FancyZones não foi encontrado. Reporte o erro para]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -59,7 +59,7 @@
<Str Cat="Text">
<Val><![CDATA[The FancyZones editor failed to start. Please report the bug to]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Falha ao iniciar o editor dos Esquemas de Zonas. Reporte o erro para]]></Val>
<Val><![CDATA[Falha ao iniciar o editor de FancyZones. Reporte o erro para]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -68,7 +68,7 @@
<Str Cat="Text">
<Val><![CDATA[Failed to load the FancyZones settings. Default settings will be used.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Falha ao carregar as definições dos Esquemas de Zonas. Serão utilizadas as predefinições.]]></Val>
<Val><![CDATA[Falha ao carregar as definições de FancyZones. Serão utilizadas as predefinições.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -77,7 +77,7 @@
<Str Cat="Text">
<Val><![CDATA[Failed to save the FancyZones settings. Please retry again later, if the problem persists report the bug to]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Falha ao guardar as definições dos Esquemas de Zonas. Volte a tentar mais tarde e, se o problema persistir, reporte o erro para]]></Val>
<Val><![CDATA[Falha ao guardar as definições de FancyZones. Volte a tentar mais tarde e, se o problema persistir, reporte o erro para]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -95,7 +95,7 @@
<Str Cat="Text">
<Val><![CDATA[PowerToys - FancyZones]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[PowerToys - Esquemas de Zonas]]></Val>
<Val><![CDATA[PowerToys - FancyZones]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -251,7 +251,7 @@
<Str Cat="Text">
<Val><![CDATA[Flash zones when the active FancyZones layout changes]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Alternar zonas quando o esquema ativo dos Esquemas de Zonas muda]]></Val>
<Val><![CDATA[Alternar zonas quando o esquema ativo de FancyZones muda]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />

View File

@@ -106,7 +106,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="PropertyChanged.Fody" Version="3.2.10">
<PackageReference Include="PropertyChanged.Fody" Version="3.3.1">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="SharpZipLib" Version="1.2.0" />

View File

@@ -42,9 +42,9 @@ namespace PowerLauncher
{
string path = Log.CurrentLogDirectory;
var directory = new DirectoryInfo(path);
var log = directory.GetFiles().OrderByDescending(f => f.LastWriteTime).First();
var log = directory.GetFiles().OrderByDescending(f => f.LastWriteTime).FirstOrDefault();
LogFilePathBox.Text = log.FullName;
LogFilePathBox.Text = log?.FullName;
StringBuilder content = new StringBuilder();
content.AppendLine(ErrorReporting.RuntimeInfo());

View File

@@ -120,10 +120,13 @@
</Item>
<Item ItemId=";deseralization_error_title" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Powertoys Run deserialization error]]></Val>
<Val><![CDATA[PowerToys Run deserialization error]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Ошибка десериализации Панели PowerToys]]></Val>
<Val><![CDATA[Ошибка десериализации Панели PowerToys]]></Val>
</Tgt>
<Prev Cat="Text">
<Val><![CDATA[Powertoys Run deserialization error]]></Val>
</Prev>
</Str>
<Disp Icon="Str" />
</Item>
@@ -154,7 +157,7 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";reportWindow_file_bug" ItemType="0;.resx" PsrId="211" Leaf="true">
<Item ItemId=";reportWindow_file_bug" ItemType="0;.resx" PsrId="211" InstFlg="true" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Please file a bug in the]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
@@ -163,7 +166,7 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";reportWindow_github_repo" ItemType="0;.resx" PsrId="211" Leaf="true">
<Item ItemId=";reportWindow_github_repo" ItemType="0;.resx" PsrId="211" InstFlg="true" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[PowerToys GitHub repository]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">

View File

@@ -41,8 +41,8 @@ namespace Wox.Plugin.Logger
var rule = new LoggingRule("*", LogLevel.Info, target);
#endif
configuration.LoggingRules.Add(rule);
LogManager.Configuration = configuration;
target.Dispose();
LogManager.Configuration = configuration;
}
private static void LogInternalException(string message, System.Exception e, Type fullClassName, [CallerMemberName] string methodName = "", [CallerFilePath] string sourceFilePath = "", [CallerLineNumber] int sourceLineNumber = 0)

View File

@@ -84,7 +84,7 @@
<PackageReference Include="Mono.Cecil" Version="0.11.3" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="NLog.Extensions.Logging" Version="1.6.5" />
<PackageReference Include="PropertyChanged.Fody" Version="3.2.10">
<PackageReference Include="PropertyChanged.Fody" Version="3.3.1">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="System.Runtime" Version="4.3.1" />

View File

@@ -146,6 +146,8 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.targets')" />
<Import Project="..\..\..\..\packages\boost.1.72.0.0\build\boost.targets" Condition="Exists('..\..\..\..\packages\boost.1.72.0.0\build\boost.targets')" />
<Import Project="..\..\..\..\packages\boost_regex-vc142.1.72.0.0\build\boost_regex-vc142.targets" Condition="Exists('..\..\..\..\packages\boost_regex-vc142.1.72.0.0\build\boost_regex-vc142.targets')" />
</ImportGroup>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
@@ -153,5 +155,7 @@
</PropertyGroup>
<Error Condition="!Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.props'))" />
<Error Condition="!Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.targets'))" />
<Error Condition="!Exists('..\..\..\..\packages\boost.1.72.0.0\build\boost.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\boost.1.72.0.0\build\boost.targets'))" />
<Error Condition="!Exists('..\..\..\..\packages\boost_regex-vc142.1.72.0.0\build\boost_regex-vc142.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\boost_regex-vc142.1.72.0.0\build\boost_regex-vc142.targets'))" />
</Target>
</Project>

View File

@@ -1,4 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="boost" version="1.72.0.0" targetFramework="native" />
<package id="boost_regex-vc142" version="1.72.0.0" targetFramework="native" />
<package id="Microsoft.Windows.CppWinRT" version="2.0.200729.8" targetFramework="native" />
</packages>

View File

@@ -218,6 +218,8 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.targets')" />
<Import Project="..\..\..\..\packages\boost.1.72.0.0\build\boost.targets" Condition="Exists('..\..\..\..\packages\boost.1.72.0.0\build\boost.targets')" />
<Import Project="..\..\..\..\packages\boost_regex-vc142.1.72.0.0\build\boost_regex-vc142.targets" Condition="Exists('..\..\..\..\packages\boost_regex-vc142.1.72.0.0\build\boost_regex-vc142.targets')" />
</ImportGroup>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
@@ -225,5 +227,7 @@
</PropertyGroup>
<Error Condition="!Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.props'))" />
<Error Condition="!Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.targets'))" />
<Error Condition="!Exists('..\..\..\..\packages\boost.1.72.0.0\build\boost.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\boost.1.72.0.0\build\boost.targets'))" />
<Error Condition="!Exists('..\..\..\..\packages\boost_regex-vc142.1.72.0.0\build\boost_regex-vc142.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\boost_regex-vc142.1.72.0.0\build\boost_regex-vc142.targets'))" />
</Target>
</Project>

View File

@@ -144,4 +144,8 @@
<data name="Extended_Menu_Info" xml:space="preserve">
<value>Only show the PowerRename menu item on the extended context menu (Shift + Right-click).</value>
</data>
</root>
<data name="Use_Boost_Lib" xml:space="preserve">
<value>Use Boost library (provides extended features but may use different regex syntax).</value>
<comment>Boost is a product name, should not be translated</comment>
</data>
</root>

View File

@@ -234,6 +234,11 @@ public:
GET_RESOURCE_STRING(IDS_EXTENDED_MENU_INFO),
CSettingsInstance().GetExtendedContextMenuOnly());
settings.add_bool_toggle(
L"bool_use_boost_lib",
GET_RESOURCE_STRING(IDS_USE_BOOST_LIB),
CSettingsInstance().GetUseBoostLib());
return settings.serialize_to_buffer(buffer, buffer_size);
}
@@ -252,6 +257,7 @@ public:
CSettingsInstance().SetMaxMRUSize(values.get_int_value(L"int_max_mru_size").value());
CSettingsInstance().SetShowIconOnMenu(values.get_bool_value(L"bool_show_icon_on_menu").value());
CSettingsInstance().SetExtendedContextMenuOnly(values.get_bool_value(L"bool_show_extended_menu").value());
CSettingsInstance().SetUseBoostLib(values.get_bool_value(L"bool_use_boost_lib").value());
CSettingsInstance().Save();
Trace::SettingsChanged();

View File

@@ -28,7 +28,7 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Icon_Context_Menu" ItemType="0;.resx" PsrId="211" Leaf="true">
<Item ItemId=";Icon_Context_Menu" ItemType="0;.resx" PsrId="211" InstFlg="true" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Show icon on context menu.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
@@ -46,7 +46,7 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";PowerRename" ItemType="0;.resx" PsrId="211" Leaf="true">
<Item ItemId=";PowerRename" ItemType="0;.resx" PsrId="211" InstFlg="true" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Po&werRename]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
@@ -55,7 +55,7 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";PowerRename_App_Name" ItemType="0;.resx" PsrId="211" Leaf="true">
<Item ItemId=";PowerRename_App_Name" ItemType="0;.resx" PsrId="211" InstFlg="true" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[PowerRename]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
@@ -82,6 +82,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Use_Boost_Lib" ItemType="0;.resx" PsrId="211" InstFlg="true" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Use Boost library (provides extended features but may use different regex syntax).]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Usare libreria Boost (fornisce funzionalità estese ma può usare una sintassi regex diversa).]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
</Item>
</Item>
</LCX>

View File

@@ -1,4 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="boost" version="1.72.0.0" targetFramework="native" />
<package id="boost_regex-vc142" version="1.72.0.0" targetFramework="native" />
<package id="Microsoft.Windows.CppWinRT" version="2.0.200729.8" targetFramework="native" />
</packages>

View File

@@ -189,6 +189,8 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.targets')" />
<Import Project="..\..\..\..\packages\boost.1.72.0.0\build\boost.targets" Condition="Exists('..\..\..\..\packages\boost.1.72.0.0\build\boost.targets')" />
<Import Project="..\..\..\..\packages\boost_regex-vc142.1.72.0.0\build\boost_regex-vc142.targets" Condition="Exists('..\..\..\..\packages\boost_regex-vc142.1.72.0.0\build\boost_regex-vc142.targets')" />
</ImportGroup>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
@@ -196,5 +198,7 @@
</PropertyGroup>
<Error Condition="!Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.props'))" />
<Error Condition="!Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.targets'))" />
<Error Condition="!Exists('..\..\..\..\packages\boost.1.72.0.0\build\boost.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\boost.1.72.0.0\build\boost.targets'))" />
<Error Condition="!Exists('..\..\..\..\packages\boost_regex-vc142.1.72.0.0\build\boost_regex-vc142.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\boost_regex-vc142.1.72.0.0\build\boost_regex-vc142.targets'))" />
</Target>
</Project>

View File

@@ -1,8 +1,10 @@
#include "pch.h"
#include "PowerRenameRegEx.h"
#include "Settings.h"
#include <regex>
#include <string>
#include <algorithm>
#include <boost/regex.hpp>
using namespace std;
@@ -177,6 +179,8 @@ CPowerRenameRegEx::CPowerRenameRegEx() :
// Init to empty strings
SHStrDup(L"", &m_searchTerm);
SHStrDup(L"", &m_replaceTerm);
_useBoostLib = CSettingsInstance().GetUseBoostLib();
}
CPowerRenameRegEx::~CPowerRenameRegEx()
@@ -206,14 +210,29 @@ HRESULT CPowerRenameRegEx::Replace(_In_ PCWSTR source, _Outptr_ PWSTR* result)
if (m_flags & UseRegularExpressions)
{
std::wregex pattern(m_searchTerm, (!(m_flags & CaseSensitive)) ? regex_constants::icase | regex_constants::ECMAScript : regex_constants::ECMAScript);
if (m_flags & MatchAllOccurences)
if (_useBoostLib)
{
res = regex_replace(wstring(source), pattern, replaceTerm);
boost::wregex pattern(m_searchTerm, (!(m_flags & CaseSensitive)) ? boost::regex::icase | boost::regex::ECMAScript : boost::regex::ECMAScript);
if (m_flags & MatchAllOccurences)
{
res = boost::regex_replace(wstring(source), pattern, replaceTerm);
}
else
{
res = boost::regex_replace(wstring(source), pattern, replaceTerm, boost::regex_constants::format_first_only);
}
}
else
{
res = regex_replace(wstring(source), pattern, replaceTerm, regex_constants::format_first_only);
std::wregex pattern(m_searchTerm, (!(m_flags & CaseSensitive)) ? regex_constants::icase | regex_constants::ECMAScript : regex_constants::ECMAScript);
if (m_flags & MatchAllOccurences)
{
res = regex_replace(wstring(source), pattern, replaceTerm);
}
else
{
res = regex_replace(wstring(source), pattern, replaceTerm, regex_constants::format_first_only);
}
}
}
else

View File

@@ -39,6 +39,7 @@ protected:
size_t _Find(std::wstring data, std::wstring toSearch, bool caseInsensitive, size_t pos);
bool _useBoostLib = false;
DWORD m_flags = DEFAULT_FLAGS;
PWSTR m_searchTerm = nullptr;
PWSTR m_replaceTerm = nullptr;

View File

@@ -31,6 +31,7 @@ namespace
const wchar_t c_mruEnabled[] = L"MRUEnabled";
const wchar_t c_mruList[] = L"MRUList";
const wchar_t c_insertionIdx[] = L"InsertionIdx";
const wchar_t c_useBoostLib[] = L"UseBoostLib";
unsigned int GetRegNumber(const std::wstring& valueName, unsigned int defaultValue)
{
@@ -414,6 +415,7 @@ void CSettings::Save()
jsonData.SetNamedValue(c_maxMRUSize, json::value(settings.maxMRUSize));
jsonData.SetNamedValue(c_searchText, json::value(settings.searchText));
jsonData.SetNamedValue(c_replaceText, json::value(settings.replaceText));
jsonData.SetNamedValue(c_useBoostLib, json::value(settings.useBoostLib));
json::to_file(jsonFilePath, jsonData);
GetSystemTimeAsFileTime(&lastLoadedTime);
@@ -457,6 +459,7 @@ void CSettings::MigrateFromRegistry()
settings.flags = GetRegNumber(c_flags, 0);
settings.searchText = GetRegString(c_searchText, L"");
settings.replaceText = GetRegString(c_replaceText, L"");
settings.useBoostLib = false; // Never existed in registry, disabled by default.
}
void CSettings::ParseJson()
@@ -499,6 +502,10 @@ void CSettings::ParseJson()
{
settings.replaceText = jsonSettings.GetNamedString(c_replaceText);
}
if (json::has(jsonSettings, c_useBoostLib, json::JsonValueType::Boolean))
{
settings.useBoostLib = jsonSettings.GetNamedBoolean(c_useBoostLib);
}
}
catch (const winrt::hresult_error&) { }
}

View File

@@ -51,6 +51,16 @@ public:
settings.persistState = persistState;
}
inline bool GetUseBoostLib() const
{
return settings.useBoostLib;
}
inline void SetUseBoostLib(bool useBoostLib)
{
settings.useBoostLib = useBoostLib;
}
inline bool GetMRUEnabled() const
{
return settings.MRUEnabled;
@@ -114,6 +124,7 @@ private:
bool showIconOnMenu{ true };
bool extendedContextMenuOnly{ false }; // Disabled by default.
bool persistState{ true };
bool useBoostLib{ false }; // Disabled by default.
bool MRUEnabled{ true };
unsigned int maxMRUSize{ 10 };
unsigned int flags{ 0 };

View File

@@ -1,4 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="boost" version="1.72.0.0" targetFramework="native" />
<package id="boost_regex-vc142" version="1.72.0.0" targetFramework="native" />
<package id="Microsoft.Windows.CppWinRT" version="2.0.200729.8" targetFramework="native" />
</packages>

View File

@@ -85,5 +85,6 @@ void Trace::SettingsChanged() noexcept
TraceLoggingBoolean(CSettingsInstance().GetPersistState(), "PersistState"),
TraceLoggingBoolean(CSettingsInstance().GetMRUEnabled(), "IsMRUEnabled"),
TraceLoggingUInt64(CSettingsInstance().GetMaxMRUSize(), "MaxMRUSize"),
TraceLoggingBoolean(CSettingsInstance().GetUseBoostLib(), "UseBoostLib"),
TraceLoggingUInt64(CSettingsInstance().GetFlags(), "Flags"));
}

View File

@@ -202,6 +202,8 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.targets')" />
<Import Project="..\..\..\..\packages\boost.1.72.0.0\build\boost.targets" Condition="Exists('..\..\..\..\packages\boost.1.72.0.0\build\boost.targets')" />
<Import Project="..\..\..\..\packages\boost_regex-vc142.1.72.0.0\build\boost_regex-vc142.targets" Condition="Exists('..\..\..\..\packages\boost_regex-vc142.1.72.0.0\build\boost_regex-vc142.targets')" />
</ImportGroup>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
@@ -209,5 +211,7 @@
</PropertyGroup>
<Error Condition="!Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.props'))" />
<Error Condition="!Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.targets'))" />
<Error Condition="!Exists('..\..\..\..\packages\boost.1.72.0.0\build\boost.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\boost.1.72.0.0\build\boost.targets'))" />
<Error Condition="!Exists('..\..\..\..\packages\boost_regex-vc142.1.72.0.0\build\boost_regex-vc142.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\boost_regex-vc142.1.72.0.0\build\boost_regex-vc142.targets'))" />
</Target>
</Project>

View File

@@ -1,4 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="boost" version="1.72.0.0" targetFramework="native" />
<package id="boost_regex-vc142" version="1.72.0.0" targetFramework="native" />
<package id="Microsoft.Windows.CppWinRT" version="2.0.200729.8" targetFramework="native" />
</packages>

View File

@@ -37,11 +37,20 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Countslabelfmt" ItemType="0;.resx" PsrId="211" Leaf="true">
<Item ItemId=";Countslabelrenamingfmt" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Items Selected: %u | Renaming: %u]]></Val>
<Val><![CDATA[Items Renaming: %u]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Vybrané položky: %u | Přejmenování: %u]]></Val>
<Val><![CDATA[Položky | Přejmenování: %u]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Countslabelselectedfmt" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Items Selected: %u]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Počet vybraných položek: %u]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -118,12 +127,24 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Items_Renaming" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Items Renaming: 0]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Položky | Přejmenování: 0]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Items_Selected" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Items Selected: 0 | Renaming: 0]]></Val>
<Val><![CDATA[Items Selected: 0]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Vybrané položky: 0 | Přejmenování: 0]]></Val>
<Val><![CDATA[Počet vybraných položek: 0]]></Val>
</Tgt>
<Prev Cat="Text">
<Val><![CDATA[Items Selected: 0 | Renaming: 0]]></Val>
</Prev>
</Str>
<Disp Icon="Str" />
</Item>

View File

@@ -37,11 +37,20 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Countslabelfmt" ItemType="0;.resx" PsrId="211" Leaf="true">
<Item ItemId=";Countslabelrenamingfmt" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Items Selected: %u | Renaming: %u]]></Val>
<Val><![CDATA[Items Renaming: %u]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Ausgewählte Elemente: %u | Umbenennung: %u]]></Val>
<Val><![CDATA[Umbenannte Elemente: %u]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Countslabelselectedfmt" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Items Selected: %u]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Ausgewählte Elemente: %u]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -118,12 +127,24 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Items_Renaming" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Items Renaming: 0]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Umbenannte Elemente: 0]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Items_Selected" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Items Selected: 0 | Renaming: 0]]></Val>
<Val><![CDATA[Items Selected: 0]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Ausgewählte Elemente: 0 | Umbenennung: 0]]></Val>
<Val><![CDATA[Ausgewählte Elemente: 0]]></Val>
</Tgt>
<Prev Cat="Text">
<Val><![CDATA[Items Selected: 0 | Renaming: 0]]></Val>
</Prev>
</Str>
<Disp Icon="Str" />
</Item>

View File

@@ -37,11 +37,20 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Countslabelfmt" ItemType="0;.resx" PsrId="211" Leaf="true">
<Item ItemId=";Countslabelrenamingfmt" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Items Selected: %u | Renaming: %u]]></Val>
<Val><![CDATA[Items Renaming: %u]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Éléments sélectionnés : %u | Renommage : %u]]></Val>
<Val><![CDATA[Renommage des éléments : %u]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Countslabelselectedfmt" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Items Selected: %u]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Éléments sélectionnés : %u]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -118,12 +127,24 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Items_Renaming" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Items Renaming: 0]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Renommage des éléments : 0]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Items_Selected" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Items Selected: 0 | Renaming: 0]]></Val>
<Val><![CDATA[Items Selected: 0]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Éléments sélectionnés : 0 | Renommage : 0]]></Val>
<Val><![CDATA[Éléments sélectionnés : 0]]></Val>
</Tgt>
<Prev Cat="Text">
<Val><![CDATA[Items Selected: 0 | Renaming: 0]]></Val>
</Prev>
</Str>
<Disp Icon="Str" />
</Item>

View File

@@ -37,11 +37,20 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Countslabelfmt" ItemType="0;.resx" PsrId="211" Leaf="true">
<Item ItemId=";Countslabelrenamingfmt" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Items Selected: %u | Renaming: %u]]></Val>
<Val><![CDATA[Items Renaming: %u]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[選択された項目: %u | 名前変更中: %u]]></Val>
<Val><![CDATA[名前変更中の項目: %u]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Countslabelselectedfmt" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Items Selected: %u]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[選択された項目: %u]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -118,12 +127,24 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Items_Renaming" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Items Renaming: 0]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[名前変更中の項目: 0]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Items_Selected" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Items Selected: 0 | Renaming: 0]]></Val>
<Val><![CDATA[Items Selected: 0]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[選択された項目: 0 | 名前の変更中: 0]]></Val>
<Val><![CDATA[選択された項目: 0]]></Val>
</Tgt>
<Prev Cat="Text">
<Val><![CDATA[Items Selected: 0 | Renaming: 0]]></Val>
</Prev>
</Str>
<Disp Icon="Str" />
</Item>

View File

@@ -37,11 +37,20 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Countslabelfmt" ItemType="0;.resx" PsrId="211" Leaf="true">
<Item ItemId=";Countslabelrenamingfmt" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Items Selected: %u | Renaming: %u]]></Val>
<Val><![CDATA[Items Renaming: %u]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[선택한 항목: %u개 | 이름 바꾸: %u]]></Val>
<Val><![CDATA[이름 바꾸는 항목: %u]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Countslabelselectedfmt" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Items Selected: %u]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[선택한 항목: %u]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -118,12 +127,24 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Items_Renaming" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Items Renaming: 0]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[이름을 바꾸는 항목: 0]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Items_Selected" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Items Selected: 0 | Renaming: 0]]></Val>
<Val><![CDATA[Items Selected: 0]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[선택한 항목: 0개 | 이름 바꾸기: 0회]]></Val>
<Val><![CDATA[선택한 항목: 0]]></Val>
</Tgt>
<Prev Cat="Text">
<Val><![CDATA[Items Selected: 0 | Renaming: 0]]></Val>
</Prev>
</Str>
<Disp Icon="Str" />
</Item>

View File

@@ -37,11 +37,20 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Countslabelfmt" ItemType="0;.resx" PsrId="211" Leaf="true">
<Item ItemId=";Countslabelrenamingfmt" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Items Selected: %u | Renaming: %u]]></Val>
<Val><![CDATA[Items Renaming: %u]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Geselecteerde items: %u | Naam wijzigen: %u]]></Val>
<Val><![CDATA[Items waarvoor de naam wordt gewijzigd: %u]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Countslabelselectedfmt" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Items Selected: %u]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Geselecteerde items: %u]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -118,12 +127,24 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Items_Renaming" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Items Renaming: 0]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Items waarvoor de naam wordt gewijzigd: 0]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Items_Selected" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Items Selected: 0 | Renaming: 0]]></Val>
<Val><![CDATA[Items Selected: 0]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Geselecteerde items: 0 | Naam wijzigen: 0]]></Val>
<Val><![CDATA[Geselecteerde items: 0]]></Val>
</Tgt>
<Prev Cat="Text">
<Val><![CDATA[Items Selected: 0 | Renaming: 0]]></Val>
</Prev>
</Str>
<Disp Icon="Str" />
</Item>

View File

@@ -37,11 +37,20 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Countslabelfmt" ItemType="0;.resx" PsrId="211" Leaf="true">
<Item ItemId=";Countslabelrenamingfmt" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Items Selected: %u | Renaming: %u]]></Val>
<Val><![CDATA[Items Renaming: %u]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Wybrane elementy: %u | Zmienianie nazwy: %u]]></Val>
<Val><![CDATA[Pozostałe elementy: %u]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Countslabelselectedfmt" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Items Selected: %u]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Wybrane elementy: %u]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -118,12 +127,24 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Items_Renaming" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Items Renaming: 0]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Pozostałe elementy: 0]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Items_Selected" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Items Selected: 0 | Renaming: 0]]></Val>
<Val><![CDATA[Items Selected: 0]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Wybrane elementy: 0 | Zmienianie nazwy: 0]]></Val>
<Val><![CDATA[Wybrane elementy: 0]]></Val>
</Tgt>
<Prev Cat="Text">
<Val><![CDATA[Items Selected: 0 | Renaming: 0]]></Val>
</Prev>
</Str>
<Disp Icon="Str" />
</Item>

View File

@@ -37,11 +37,20 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Countslabelfmt" ItemType="0;.resx" PsrId="211" Leaf="true">
<Item ItemId=";Countslabelrenamingfmt" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Items Selected: %u | Renaming: %u]]></Val>
<Val><![CDATA[Items Renaming: %u]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Выбрано элементов: %u | Переименовывается: %u]]></Val>
<Val><![CDATA[Переименование элементов: %u]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Countslabelselectedfmt" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Items Selected: %u]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Выбрано элементов: %u]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -118,12 +127,24 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Items_Renaming" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Items Renaming: 0]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Переименование элементов: 0]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Items_Selected" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Items Selected: 0 | Renaming: 0]]></Val>
<Val><![CDATA[Items Selected: 0]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Выбрано элементов: 0 | Переименовывается: 0]]></Val>
<Val><![CDATA[Выбрано элементов: 0]]></Val>
</Tgt>
<Prev Cat="Text">
<Val><![CDATA[Items Selected: 0 | Renaming: 0]]></Val>
</Prev>
</Str>
<Disp Icon="Str" />
</Item>

View File

@@ -37,11 +37,20 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Countslabelfmt" ItemType="0;.resx" PsrId="211" Leaf="true">
<Item ItemId=";Countslabelrenamingfmt" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Items Selected: %u | Renaming: %u]]></Val>
<Val><![CDATA[Items Renaming: %u]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Valda objekt: %u | Byter namn: %u]]></Val>
<Val><![CDATA[Objekt byter namn: %u]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Countslabelselectedfmt" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Items Selected: %u]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Valda objekt: %u]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -118,12 +127,24 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Items_Renaming" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Items Renaming: 0]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Objekt byter namn: 0]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Items_Selected" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Items Selected: 0 | Renaming: 0]]></Val>
<Val><![CDATA[Items Selected: 0]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Markerade objekt: 0 | Byter namn på: 0]]></Val>
<Val><![CDATA[Valda objekt: 0]]></Val>
</Tgt>
<Prev Cat="Text">
<Val><![CDATA[Items Selected: 0 | Renaming: 0]]></Val>
</Prev>
</Str>
<Disp Icon="Str" />
</Item>

View File

@@ -37,11 +37,20 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Countslabelfmt" ItemType="0;.resx" PsrId="211" Leaf="true">
<Item ItemId=";Countslabelrenamingfmt" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Items Selected: %u | Renaming: %u]]></Val>
<Val><![CDATA[Items Renaming: %u]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[已选择的项: %u 个 | 正在重命名: %u 个]]></Val>
<Val><![CDATA[正在重命名的项: %u 个]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Countslabelselectedfmt" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Items Selected: %u]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[已选择的项: %u 个]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -118,12 +127,24 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Items_Renaming" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Items Renaming: 0]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[正在重命名的项: 0 个]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Items_Selected" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Items Selected: 0 | Renaming: 0]]></Val>
<Val><![CDATA[Items Selected: 0]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[已选择的项: 0 个 | 正在重命名: 0 个]]></Val>
<Val><![CDATA[已选择的项: 0 个]]></Val>
</Tgt>
<Prev Cat="Text">
<Val><![CDATA[Items Selected: 0 | Renaming: 0]]></Val>
</Prev>
</Str>
<Disp Icon="Str" />
</Item>

View File

@@ -37,11 +37,20 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Countslabelfmt" ItemType="0;.resx" PsrId="211" Leaf="true">
<Item ItemId=";Countslabelrenamingfmt" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Items Selected: %u | Renaming: %u]]></Val>
<Val><![CDATA[Items Renaming: %u]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[選取的項目: %u | 將重新命名: %u]]></Val>
<Val><![CDATA[要重新命名的項目數: %u]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Countslabelselectedfmt" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Items Selected: %u]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[選取的項目數: %u]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -118,12 +127,24 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Items_Renaming" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Items Renaming: 0]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[要重新命名的項目數: 0]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Items_Selected" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Items Selected: 0 | Renaming: 0]]></Val>
<Val><![CDATA[Items Selected: 0]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[選取的項目: 0 | 將重新命名: 0]]></Val>
<Val><![CDATA[選取的項目: 0]]></Val>
</Tgt>
<Prev Cat="Text">
<Val><![CDATA[Items Selected: 0 | Renaming: 0]]></Val>
</Prev>
</Str>
<Disp Icon="Str" />
</Item>

View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.props')" />
<ItemGroup Label="ProjectConfigurations">
@@ -196,6 +196,7 @@
<ClCompile Include="MockPowerRenameItem.cpp" />
<ClCompile Include="MockPowerRenameManagerEvents.cpp" />
<ClCompile Include="MockPowerRenameRegExEvents.cpp" />
<ClCompile Include="PowerRenameRegExBoostTests.cpp" />
<ClCompile Include="PowerRenameManagerTests.cpp" />
<ClCompile Include="pch.cpp">
<PrecompiledHeader Condition="'$(CIBuild)'!='true'">Create</PrecompiledHeader>
@@ -217,6 +218,8 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.targets')" />
<Import Project="..\..\..\..\packages\boost.1.72.0.0\build\boost.targets" Condition="Exists('..\..\..\..\packages\boost.1.72.0.0\build\boost.targets')" />
<Import Project="..\..\..\..\packages\boost_regex-vc142.1.72.0.0\build\boost_regex-vc142.targets" Condition="Exists('..\..\..\..\packages\boost_regex-vc142.1.72.0.0\build\boost_regex-vc142.targets')" />
</ImportGroup>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
@@ -224,5 +227,7 @@
</PropertyGroup>
<Error Condition="!Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.props'))" />
<Error Condition="!Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.targets'))" />
<Error Condition="!Exists('..\..\..\..\packages\boost.1.72.0.0\build\boost.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\boost.1.72.0.0\build\boost.targets'))" />
<Error Condition="!Exists('..\..\..\..\packages\boost_regex-vc142.1.72.0.0\build\boost_regex-vc142.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\boost_regex-vc142.1.72.0.0\build\boost_regex-vc142.targets'))" />
</Target>
</Project>

View File

@@ -8,6 +8,7 @@
<ClCompile Include="pch.cpp" />
<ClCompile Include="PowerRenameRegExTests.cpp" />
<ClCompile Include="TestFileHelper.cpp" />
<ClCompile Include="PowerRenameRegExBoostTests.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="MockPowerRenameItem.h" />

View File

@@ -0,0 +1,437 @@
#include "pch.h"
#include "CppUnitTest.h"
#include "powerrename/lib/Settings.h"
#include <PowerRenameInterfaces.h>
#include <PowerRenameRegEx.h>
#include "MockPowerRenameRegExEvents.h"
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
namespace PowerRenameRegExBoostTests
{
struct SearchReplaceExpected
{
PCWSTR search;
PCWSTR replace;
PCWSTR test;
PCWSTR expected;
};
TEST_CLASS(SimpleTests)
{
public:
TEST_CLASS_INITIALIZE(ClassInitialize)
{
CSettingsInstance().SetUseBoostLib(true);
}
TEST_CLASS_CLEANUP(ClassCleanup)
{
CSettingsInstance().SetUseBoostLib(false);
}
TEST_METHOD(GeneralReplaceTest)
{
CComPtr<IPowerRenameRegEx> renameRegEx;
Assert::IsTrue(CPowerRenameRegEx::s_CreateInstance(&renameRegEx) == S_OK);
PWSTR result = nullptr;
Assert::IsTrue(renameRegEx->PutSearchTerm(L"foo") == S_OK);
Assert::IsTrue(renameRegEx->PutReplaceTerm(L"big") == S_OK);
Assert::IsTrue(renameRegEx->Replace(L"foobar", &result) == S_OK);
Assert::IsTrue(wcscmp(result, L"bigbar") == 0);
CoTaskMemFree(result);
}
TEST_METHOD(ReplaceNoMatch)
{
CComPtr<IPowerRenameRegEx> renameRegEx;
Assert::IsTrue(CPowerRenameRegEx::s_CreateInstance(&renameRegEx) == S_OK);
PWSTR result = nullptr;
Assert::IsTrue(renameRegEx->PutSearchTerm(L"notfound") == S_OK);
Assert::IsTrue(renameRegEx->PutReplaceTerm(L"big") == S_OK);
Assert::IsTrue(renameRegEx->Replace(L"foobar", &result) == S_OK);
Assert::IsTrue(wcscmp(result, L"foobar") == 0);
CoTaskMemFree(result);
}
TEST_METHOD(ReplaceNoSearchOrReplaceTerm)
{
CComPtr<IPowerRenameRegEx> renameRegEx;
Assert::IsTrue(CPowerRenameRegEx::s_CreateInstance(&renameRegEx) == S_OK);
PWSTR result = nullptr;
Assert::IsTrue(renameRegEx->Replace(L"foobar", &result) != S_OK);
Assert::IsTrue(result == nullptr);
CoTaskMemFree(result);
}
TEST_METHOD(ReplaceNoReplaceTerm)
{
CComPtr<IPowerRenameRegEx> renameRegEx;
Assert::IsTrue(CPowerRenameRegEx::s_CreateInstance(&renameRegEx) == S_OK);
PWSTR result = nullptr;
Assert::IsTrue(renameRegEx->PutSearchTerm(L"foo") == S_OK);
Assert::IsTrue(renameRegEx->Replace(L"foobar", &result) == S_OK);
Assert::IsTrue(wcscmp(result, L"bar") == 0);
CoTaskMemFree(result);
}
TEST_METHOD(ReplaceEmptyStringReplaceTerm)
{
CComPtr<IPowerRenameRegEx> renameRegEx;
Assert::IsTrue(CPowerRenameRegEx::s_CreateInstance(&renameRegEx) == S_OK);
PWSTR result = nullptr;
Assert::IsTrue(renameRegEx->PutSearchTerm(L"foo") == S_OK);
Assert::IsTrue(renameRegEx->PutReplaceTerm(L"") == S_OK);
Assert::IsTrue(renameRegEx->Replace(L"foobar", &result) == S_OK);
Assert::IsTrue(wcscmp(result, L"bar") == 0);
CoTaskMemFree(result);
}
TEST_METHOD(VerifyDefaultFlags)
{
CComPtr<IPowerRenameRegEx> renameRegEx;
Assert::IsTrue(CPowerRenameRegEx::s_CreateInstance(&renameRegEx) == S_OK);
DWORD flags = 0;
Assert::IsTrue(renameRegEx->GetFlags(&flags) == S_OK);
Assert::IsTrue(flags == MatchAllOccurences);
}
TEST_METHOD(VerifyCaseSensitiveSearch)
{
CComPtr<IPowerRenameRegEx> renameRegEx;
Assert::IsTrue(CPowerRenameRegEx::s_CreateInstance(&renameRegEx) == S_OK);
DWORD flags = CaseSensitive;
Assert::IsTrue(renameRegEx->PutFlags(flags) == S_OK);
SearchReplaceExpected sreTable[] = {
{ L"Foo", L"Foo", L"FooBar", L"FooBar" },
{ L"Foo", L"boo", L"FooBar", L"booBar" },
{ L"Foo", L"boo", L"foobar", L"foobar" },
{ L"123", L"654", L"123456", L"654456" },
};
for (int i = 0; i < ARRAYSIZE(sreTable); i++)
{
PWSTR result = nullptr;
Assert::IsTrue(renameRegEx->PutSearchTerm(sreTable[i].search) == S_OK);
Assert::IsTrue(renameRegEx->PutReplaceTerm(sreTable[i].replace) == S_OK);
Assert::IsTrue(renameRegEx->Replace(sreTable[i].test, &result) == S_OK);
Assert::IsTrue(wcscmp(result, sreTable[i].expected) == 0);
CoTaskMemFree(result);
}
}
TEST_METHOD(VerifyReplaceFirstOnly)
{
CComPtr<IPowerRenameRegEx> renameRegEx;
Assert::IsTrue(CPowerRenameRegEx::s_CreateInstance(&renameRegEx) == S_OK);
DWORD flags = 0;
Assert::IsTrue(renameRegEx->PutFlags(flags) == S_OK);
SearchReplaceExpected sreTable[] = {
{ L"B", L"BB", L"ABA", L"ABBA" },
{ L"B", L"A", L"ABBBA", L"AABBA" },
{ L"B", L"BBB", L"ABABAB", L"ABBBABAB" },
};
for (int i = 0; i < ARRAYSIZE(sreTable); i++)
{
PWSTR result = nullptr;
Assert::IsTrue(renameRegEx->PutSearchTerm(sreTable[i].search) == S_OK);
Assert::IsTrue(renameRegEx->PutReplaceTerm(sreTable[i].replace) == S_OK);
Assert::IsTrue(renameRegEx->Replace(sreTable[i].test, &result) == S_OK);
Assert::IsTrue(wcscmp(result, sreTable[i].expected) == 0);
CoTaskMemFree(result);
}
}
TEST_METHOD(VerifyReplaceAll)
{
CComPtr<IPowerRenameRegEx> renameRegEx;
Assert::IsTrue(CPowerRenameRegEx::s_CreateInstance(&renameRegEx) == S_OK);
DWORD flags = MatchAllOccurences;
Assert::IsTrue(renameRegEx->PutFlags(flags) == S_OK);
SearchReplaceExpected sreTable[] = {
{ L"B", L"BB", L"ABA", L"ABBA" },
{ L"B", L"A", L"ABBBA", L"AAAAA" },
{ L"B", L"BBB", L"ABABAB", L"ABBBABBBABBB" },
};
for (int i = 0; i < ARRAYSIZE(sreTable); i++)
{
PWSTR result = nullptr;
Assert::IsTrue(renameRegEx->PutSearchTerm(sreTable[i].search) == S_OK);
Assert::IsTrue(renameRegEx->PutReplaceTerm(sreTable[i].replace) == S_OK);
Assert::IsTrue(renameRegEx->Replace(sreTable[i].test, &result) == S_OK);
Assert::IsTrue(wcscmp(result, sreTable[i].expected) == 0);
CoTaskMemFree(result);
}
}
TEST_METHOD(VerifyReplaceAllCaseInsensitive)
{
CComPtr<IPowerRenameRegEx> renameRegEx;
Assert::IsTrue(CPowerRenameRegEx::s_CreateInstance(&renameRegEx) == S_OK);
DWORD flags = MatchAllOccurences | CaseSensitive;
Assert::IsTrue(renameRegEx->PutFlags(flags) == S_OK);
SearchReplaceExpected sreTable[] = {
{ L"B", L"BB", L"ABA", L"ABBA" },
{ L"B", L"A", L"ABBBA", L"AAAAA" },
{ L"B", L"BBB", L"ABABAB", L"ABBBABBBABBB" },
{ L"b", L"BBB", L"AbABAb", L"ABBBABABBB" },
};
for (int i = 0; i < ARRAYSIZE(sreTable); i++)
{
PWSTR result = nullptr;
Assert::IsTrue(renameRegEx->PutSearchTerm(sreTable[i].search) == S_OK);
Assert::IsTrue(renameRegEx->PutReplaceTerm(sreTable[i].replace) == S_OK);
Assert::IsTrue(renameRegEx->Replace(sreTable[i].test, &result) == S_OK);
Assert::IsTrue(wcscmp(result, sreTable[i].expected) == 0);
CoTaskMemFree(result);
}
}
TEST_METHOD(VerifyReplaceFirstOnlyUseRegEx)
{
CComPtr<IPowerRenameRegEx> renameRegEx;
Assert::IsTrue(CPowerRenameRegEx::s_CreateInstance(&renameRegEx) == S_OK);
DWORD flags = UseRegularExpressions;
Assert::IsTrue(renameRegEx->PutFlags(flags) == S_OK);
SearchReplaceExpected sreTable[] = {
{ L"B", L"BB", L"ABA", L"ABBA" },
{ L"B", L"A", L"ABBBA", L"AABBA" },
{ L"B", L"BBB", L"ABABAB", L"ABBBABAB" },
};
for (int i = 0; i < ARRAYSIZE(sreTable); i++)
{
PWSTR result = nullptr;
Assert::IsTrue(renameRegEx->PutSearchTerm(sreTable[i].search) == S_OK);
Assert::IsTrue(renameRegEx->PutReplaceTerm(sreTable[i].replace) == S_OK);
Assert::IsTrue(renameRegEx->Replace(sreTable[i].test, &result) == S_OK);
Assert::IsTrue(wcscmp(result, sreTable[i].expected) == 0);
CoTaskMemFree(result);
}
}
TEST_METHOD(VerifyReplaceAllUseRegEx)
{
CComPtr<IPowerRenameRegEx> renameRegEx;
Assert::IsTrue(CPowerRenameRegEx::s_CreateInstance(&renameRegEx) == S_OK);
DWORD flags = MatchAllOccurences | UseRegularExpressions;
Assert::IsTrue(renameRegEx->PutFlags(flags) == S_OK);
SearchReplaceExpected sreTable[] = {
{ L"B", L"BB", L"ABA", L"ABBA" },
{ L"B", L"A", L"ABBBA", L"AAAAA" },
{ L"B", L"BBB", L"ABABAB", L"ABBBABBBABBB" },
};
for (int i = 0; i < ARRAYSIZE(sreTable); i++)
{
PWSTR result = nullptr;
Assert::IsTrue(renameRegEx->PutSearchTerm(sreTable[i].search) == S_OK);
Assert::IsTrue(renameRegEx->PutReplaceTerm(sreTable[i].replace) == S_OK);
Assert::IsTrue(renameRegEx->Replace(sreTable[i].test, &result) == S_OK);
Assert::IsTrue(wcscmp(result, sreTable[i].expected) == 0);
CoTaskMemFree(result);
}
}
TEST_METHOD(VerifyReplaceAllUseRegExCaseSensitive)
{
CComPtr<IPowerRenameRegEx> renameRegEx;
Assert::IsTrue(CPowerRenameRegEx::s_CreateInstance(&renameRegEx) == S_OK);
DWORD flags = MatchAllOccurences | UseRegularExpressions | CaseSensitive;
Assert::IsTrue(renameRegEx->PutFlags(flags) == S_OK);
SearchReplaceExpected sreTable[] = {
{ L"B", L"BB", L"ABA", L"ABBA" },
{ L"B", L"A", L"ABBBA", L"AAAAA" },
{ L"b", L"BBB", L"AbABAb", L"ABBBABABBB" },
};
for (int i = 0; i < ARRAYSIZE(sreTable); i++)
{
PWSTR result = nullptr;
Assert::IsTrue(renameRegEx->PutSearchTerm(sreTable[i].search) == S_OK);
Assert::IsTrue(renameRegEx->PutReplaceTerm(sreTable[i].replace) == S_OK);
Assert::IsTrue(renameRegEx->Replace(sreTable[i].test, &result) == S_OK);
Assert::IsTrue(wcscmp(result, sreTable[i].expected) == 0);
CoTaskMemFree(result);
}
}
TEST_METHOD(VerifyMatchAllWildcardUseRegEx)
{
CComPtr<IPowerRenameRegEx> renameRegEx;
Assert::IsTrue(CPowerRenameRegEx::s_CreateInstance(&renameRegEx) == S_OK);
DWORD flags = MatchAllOccurences | UseRegularExpressions;
Assert::IsTrue(renameRegEx->PutFlags(flags) == S_OK);
// This differs from the Standard Library: .* has two matches (all and nothing).
SearchReplaceExpected sreTable[] = {
//search, replace, test, result
{ L".*", L"Foo", L"AAAAAA", L"FooFoo" },
{ L".+", L"Foo", L"AAAAAA", L"Foo" },
};
for (int i = 0; i < ARRAYSIZE(sreTable); i++)
{
PWSTR result = nullptr;
Assert::IsTrue(renameRegEx->PutSearchTerm(sreTable[i].search) == S_OK);
Assert::IsTrue(renameRegEx->PutReplaceTerm(sreTable[i].replace) == S_OK);
Assert::IsTrue(renameRegEx->Replace(sreTable[i].test, &result) == S_OK);
Assert::IsTrue(wcscmp(result, sreTable[i].expected) == 0);
CoTaskMemFree(result);
}
}
void VerifyReplaceFirstWildcard(SearchReplaceExpected sreTable[], int tableSize, DWORD flags)
{
CComPtr<IPowerRenameRegEx> renameRegEx;
Assert::IsTrue(CPowerRenameRegEx::s_CreateInstance(&renameRegEx) == S_OK);
Assert::IsTrue(renameRegEx->PutFlags(flags) == S_OK);
for (int i = 0; i < tableSize; i++)
{
PWSTR result = nullptr;
Assert::IsTrue(renameRegEx->PutSearchTerm(sreTable[i].search) == S_OK);
Assert::IsTrue(renameRegEx->PutReplaceTerm(sreTable[i].replace) == S_OK);
Assert::IsTrue(renameRegEx->Replace(sreTable[i].test, &result) == S_OK);
Assert::AreEqual(sreTable[i].expected, result);
CoTaskMemFree(result);
}
}
TEST_METHOD(VerifyReplaceFirstWildCardUseRegex)
{
SearchReplaceExpected sreTable[] = {
//search, replace, test, result
{ L".*", L"Foo", L"AAAAAA", L"Foo" },
};
VerifyReplaceFirstWildcard(sreTable, ARRAYSIZE(sreTable), UseRegularExpressions);
}
TEST_METHOD(VerifyReplaceFirstWildCardUseRegexMatchAllOccurrences)
{
// This differs from the Standard Library: .* has two matches (all and nothing).
SearchReplaceExpected sreTable[] = {
//search, replace, test, result
{ L".*", L"Foo", L"AAAAAA", L"FooFoo" },
{ L".+", L"Foo", L"AAAAAA", L"Foo" },
};
VerifyReplaceFirstWildcard(sreTable, ARRAYSIZE(sreTable), UseRegularExpressions | MatchAllOccurences);
}
TEST_METHOD(VerifyReplaceFirstWildCardMatchAllOccurrences)
{
SearchReplaceExpected sreTable[] = {
//search, replace, test, result
{ L".*", L"Foo", L"AAAAAA", L"AAAAAA" },
{ L".*", L"Foo", L".*", L"Foo" },
{ L".*", L"Foo", L".*Bar.*", L"FooBarFoo" },
};
VerifyReplaceFirstWildcard(sreTable, ARRAYSIZE(sreTable), MatchAllOccurences);
}
TEST_METHOD(VerifyReplaceFirstWildNoFlags)
{
SearchReplaceExpected sreTable[] = {
//search, replace, test, result
{ L".*", L"Foo", L"AAAAAA", L"AAAAAA" },
{ L".*", L"Foo", L".*", L"Foo" },
};
VerifyReplaceFirstWildcard(sreTable, ARRAYSIZE(sreTable), 0);
}
TEST_METHOD(VerifyHandleCapturingGroups)
{
// This differs from the Standard Library: Boost does not recognize $123 as $1 and "23".
// To use a capturing group followed by numbers as replacement curly braces are needed.
CComPtr<IPowerRenameRegEx> renameRegEx;
Assert::IsTrue(CPowerRenameRegEx::s_CreateInstance(&renameRegEx) == S_OK);
DWORD flags = MatchAllOccurences | UseRegularExpressions | CaseSensitive;
Assert::IsTrue(renameRegEx->PutFlags(flags) == S_OK);
SearchReplaceExpected sreTable[] = {
//search, replace, test, result
{ L"(foo)(bar)", L"$1_$002_$223_$001021_$00001", L"foobar", L"foo_$002__$001021_$00001" },
{ L"(foo)(bar)", L"$1_$002_${2}23_$001021_$00001", L"foobar", L"foo_$002_bar23_$001021_$00001" },
{ L"(foo)(bar)", L"_$1$2_$123$040", L"foobar", L"_foobar_$040" },
{ L"(foo)(bar)", L"_$1$2_${1}23$040", L"foobar", L"_foobar_foo23$040" },
{ L"(foo)(bar)", L"$$$1", L"foobar", L"$foo" },
{ L"(foo)(bar)", L"$$1", L"foobar", L"$1" },
{ L"(foo)(bar)", L"$12", L"foobar", L"" },
{ L"(foo)(bar)", L"${1}2", L"foobar", L"foo2" },
{ L"(foo)(bar)", L"$10", L"foobar", L"" },
{ L"(foo)(bar)", L"${1}0", L"foobar", L"foo0" },
{ L"(foo)(bar)", L"$01", L"foobar", L"$01" },
{ L"(foo)(bar)", L"$$$11", L"foobar", L"$" },
{ L"(foo)(bar)", L"$$${1}1", L"foobar", L"$foo1" },
{ L"(foo)(bar)", L"$$$$113a", L"foobar", L"$$113a" },
};
for (int i = 0; i < ARRAYSIZE(sreTable); i++)
{
PWSTR result = nullptr;
Assert::IsTrue(renameRegEx->PutSearchTerm(sreTable[i].search) == S_OK);
Assert::IsTrue(renameRegEx->PutReplaceTerm(sreTable[i].replace) == S_OK);
Assert::IsTrue(renameRegEx->Replace(sreTable[i].test, &result) == S_OK);
Assert::IsTrue(wcscmp(result, sreTable[i].expected) == 0);
CoTaskMemFree(result);
}
}
TEST_METHOD(VerifyLookbehind)
{
SearchReplaceExpected sreTable[] = {
//search, replace, test, result
{ L"(?<=E12).*", L"Foo", L"AAE12BBB", L"AAE12Foo" },
{ L"(?<=E12).+", L"Foo", L"AAE12BBB", L"AAE12Foo" },
{ L"(?<=E\\d\\d).+", L"Foo", L"AAE12BBB", L"AAE12Foo" },
{ L"(?<!E12).*", L"Foo", L"AAE12BBB", L"Foo" },
{ L"(?<!E12).+", L"Foo", L"AAE12BBB", L"Foo" },
{ L"(?<!E\\d\\d).+", L"Foo", L"AAE12BBB", L"Foo" },
};
CComPtr<IPowerRenameRegEx> renameRegEx;
Assert::IsTrue(CPowerRenameRegEx::s_CreateInstance(&renameRegEx) == S_OK);
Assert::IsTrue(renameRegEx->PutFlags(UseRegularExpressions) == S_OK);
for (int i = 0; i < ARRAYSIZE(sreTable); i++)
{
PWSTR result = nullptr;
Assert::IsTrue(renameRegEx->PutSearchTerm(sreTable[i].search) == S_OK);
Assert::IsTrue(renameRegEx->PutReplaceTerm(sreTable[i].replace) == S_OK);
Assert::IsTrue(renameRegEx->Replace(sreTable[i].test, &result) == S_OK);
Assert::IsTrue(wcscmp(result, sreTable[i].expected) == 0);
CoTaskMemFree(result);
}
}
TEST_METHOD(VerifyEventsFire)
{
CComPtr<IPowerRenameRegEx> renameRegEx;
Assert::IsTrue(CPowerRenameRegEx::s_CreateInstance(&renameRegEx) == S_OK);
CMockPowerRenameRegExEvents* mockEvents = new CMockPowerRenameRegExEvents();
CComPtr<IPowerRenameRegExEvents> regExEvents;
Assert::IsTrue(mockEvents->QueryInterface(IID_PPV_ARGS(&regExEvents)) == S_OK);
DWORD cookie = 0;
Assert::IsTrue(renameRegEx->Advise(regExEvents, &cookie) == S_OK);
DWORD flags = MatchAllOccurences | UseRegularExpressions | CaseSensitive;
Assert::IsTrue(renameRegEx->PutFlags(flags) == S_OK);
Assert::IsTrue(renameRegEx->PutSearchTerm(L"FOO") == S_OK);
Assert::IsTrue(renameRegEx->PutReplaceTerm(L"BAR") == S_OK);
Assert::IsTrue(lstrcmpi(L"FOO", mockEvents->m_searchTerm) == 0);
Assert::IsTrue(lstrcmpi(L"BAR", mockEvents->m_replaceTerm) == 0);
Assert::IsTrue(flags == mockEvents->m_flags);
Assert::IsTrue(renameRegEx->UnAdvise(cookie) == S_OK);
mockEvents->Release();
}
};
}

View File

@@ -1,5 +1,6 @@
#include "pch.h"
#include "CppUnitTest.h"
#include "powerrename/lib/Settings.h"
#include <PowerRenameInterfaces.h>
#include <PowerRenameRegEx.h>
#include "MockPowerRenameRegExEvents.h"
@@ -18,8 +19,14 @@ namespace PowerRenameRegExTests
TEST_CLASS(SimpleTests){
public:
TEST_METHOD(GeneralReplaceTest){
CComPtr<IPowerRenameRegEx> renameRegEx;
TEST_CLASS_INITIALIZE(ClassInitialize)
{
CSettingsInstance().SetUseBoostLib(false);
}
TEST_METHOD(GeneralReplaceTest)
{
CComPtr<IPowerRenameRegEx> renameRegEx;
Assert::IsTrue(CPowerRenameRegEx::s_CreateInstance(&renameRegEx) == S_OK);
PWSTR result = nullptr;
Assert::IsTrue(renameRegEx->PutSearchTerm(L"foo") == S_OK);
@@ -362,6 +369,30 @@ TEST_METHOD(VerifyHandleCapturingGroups)
}
}
TEST_METHOD(VerifyLookbehindFails)
{
// Standard Library Regex Engine does not support lookbehind, thus test should fail.
SearchReplaceExpected sreTable[] = {
//search, replace, test, result
{ L"(?<=E12).*", L"Foo", L"AAAAAA", nullptr },
{ L"(?<!E12).*", L"Foo", L"AAAAAA", nullptr },
};
CComPtr<IPowerRenameRegEx> renameRegEx;
Assert::IsTrue(CPowerRenameRegEx::s_CreateInstance(&renameRegEx) == S_OK);
Assert::IsTrue(renameRegEx->PutFlags(UseRegularExpressions) == S_OK);
for (int i = 0; i < ARRAYSIZE(sreTable); i++)
{
PWSTR result = nullptr;
Assert::IsTrue(renameRegEx->PutSearchTerm(sreTable[i].search) == S_OK);
Assert::IsTrue(renameRegEx->PutReplaceTerm(sreTable[i].replace) == S_OK);
Assert::IsTrue(renameRegEx->Replace(sreTable[i].test, &result) == E_FAIL);
Assert::AreEqual(sreTable[i].expected, result);
CoTaskMemFree(result);
}
}
TEST_METHOD(VerifyEventsFire)
{
CComPtr<IPowerRenameRegEx> renameRegEx;

View File

@@ -1,4 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="boost" version="1.72.0.0" targetFramework="native" />
<package id="boost_regex-vc142" version="1.72.0.0" targetFramework="native" />
<package id="Microsoft.Windows.CppWinRT" version="2.0.200729.8" targetFramework="native" />
</packages>