From 75a583d9a31132926fce4e8f6173b51b625f28f2 Mon Sep 17 00:00:00 2001 From: Jaex Date: Thu, 25 Mar 2021 22:48:52 +0300 Subject: [PATCH] In actions use $ prefix instead of % for input and output, with new prefix don't add quotes around file path automatically --- ShareX.HelpersLib/ExternalProgram.cs | 2 +- ShareX.HelpersLib/NameParser/CodeMenuEntry.cs | 7 ++++++- ShareX.HelpersLib/NameParser/CodeMenuEntryActions.cs | 8 +++++--- ShareX.ImageEffectsLib/Drawings/DrawBorder.cs | 6 +++--- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/ShareX.HelpersLib/ExternalProgram.cs b/ShareX.HelpersLib/ExternalProgram.cs index d9f3cdc25..a2ea6a3e4 100644 --- a/ShareX.HelpersLib/ExternalProgram.cs +++ b/ShareX.HelpersLib/ExternalProgram.cs @@ -43,7 +43,7 @@ public class ExternalProgram public ExternalProgram() { - Args = "%input"; + Args = '"' + CodeMenuEntryActions.input.ToPrefixString() + '"'; } public ExternalProgram(string name, string path) : this() diff --git a/ShareX.HelpersLib/NameParser/CodeMenuEntry.cs b/ShareX.HelpersLib/NameParser/CodeMenuEntry.cs index cf76c5253..7b42775b1 100644 --- a/ShareX.HelpersLib/NameParser/CodeMenuEntry.cs +++ b/ShareX.HelpersLib/NameParser/CodeMenuEntry.cs @@ -42,7 +42,12 @@ public CodeMenuEntry(string value, string description, string category = null) public string ToPrefixString() { - return Prefix + Value; + return ToPrefixString(Prefix); + } + + public string ToPrefixString(string prefix) + { + return prefix + Value; } } } \ No newline at end of file diff --git a/ShareX.HelpersLib/NameParser/CodeMenuEntryActions.cs b/ShareX.HelpersLib/NameParser/CodeMenuEntryActions.cs index 39d65a9d3..162c5df78 100644 --- a/ShareX.HelpersLib/NameParser/CodeMenuEntryActions.cs +++ b/ShareX.HelpersLib/NameParser/CodeMenuEntryActions.cs @@ -29,7 +29,7 @@ namespace ShareX.HelpersLib { public class CodeMenuEntryActions : CodeMenuEntry { - protected override string Prefix { get; } = "%"; + protected override string Prefix { get; } = "$"; public static readonly CodeMenuEntryActions input = new CodeMenuEntryActions("input", Resources.ActionsCodeMenuEntry_FilePath_File_path); public static readonly CodeMenuEntryActions output = new CodeMenuEntryActions("output", Resources.ActionsCodeMenuEntry_OutputFilePath_File_path_without_extension____Output_file_name_extension_); @@ -44,12 +44,14 @@ public static string Parse(string pattern, string inputPath, string outputPath) if (inputPath != null) { - result = result.Replace(input.ToPrefixString(), '"' + inputPath + '"'); + result = result.Replace(input.ToPrefixString("%"), '"' + inputPath + '"'); + result = result.Replace(input.ToPrefixString(), inputPath); } if (outputPath != null) { - result = result.Replace(output.ToPrefixString(), '"' + outputPath + '"'); + result = result.Replace(output.ToPrefixString("%"), '"' + outputPath + '"'); + result = result.Replace(output.ToPrefixString(), outputPath); } return result; diff --git a/ShareX.ImageEffectsLib/Drawings/DrawBorder.cs b/ShareX.ImageEffectsLib/Drawings/DrawBorder.cs index bcb1691c7..0873938ed 100644 --- a/ShareX.ImageEffectsLib/Drawings/DrawBorder.cs +++ b/ShareX.ImageEffectsLib/Drawings/DrawBorder.cs @@ -52,12 +52,12 @@ public int Size } } - [DefaultValue(typeof(Color), "Black"), Editor(typeof(MyColorEditor), typeof(UITypeEditor)), TypeConverter(typeof(MyColorConverter))] - public Color Color { get; set; } - [DefaultValue(DashStyle.Solid), TypeConverter(typeof(EnumProperNameConverter))] public DashStyle DashStyle { get; set; } + [DefaultValue(typeof(Color), "Black"), Editor(typeof(MyColorEditor), typeof(UITypeEditor)), TypeConverter(typeof(MyColorConverter))] + public Color Color { get; set; } + [DefaultValue(false)] public bool UseGradient { get; set; }