In actions use $ prefix instead of % for input and output, with new prefix don't add quotes around file path automatically

This commit is contained in:
Jaex 2021-03-25 22:48:52 +03:00
parent 6799edaa1b
commit 75a583d9a3
4 changed files with 15 additions and 8 deletions

View file

@ -43,7 +43,7 @@ public class ExternalProgram
public ExternalProgram()
{
Args = "%input";
Args = '"' + CodeMenuEntryActions.input.ToPrefixString() + '"';
}
public ExternalProgram(string name, string path) : this()

View file

@ -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;
}
}
}

View file

@ -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;

View file

@ -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; }