Minor fixes

Former-commit-id: 1b67ea76f0
This commit is contained in:
Malte Rosenbjerg 2021-10-21 19:43:13 +02:00
parent 9b1df3945b
commit 390cd00005
3 changed files with 7 additions and 5 deletions

View file

@ -16,7 +16,7 @@ internal static class KeyValuePairExtensions
public static string FormatArgumentPair(this KeyValuePair<string, string> pair, bool enclose)
{
var key = pair.Key;
var value = enclose ? pair.Value.EncloseIfContainsSpace() : pair.Value;
var value = enclose ? StringExtensions.EncloseIfContainsSpace(pair.Value) : pair.Value;
return $"{key}={value}";
}

View file

@ -19,7 +19,7 @@ internal static class StringExtensions
/// </summary>
/// <param name="input">The input</param>
/// <returns>The enclosed string</returns>
public static string EncloseIfContainsSpace(this string input)
public static string EncloseIfContainsSpace(string input)
{
return input.Contains(" ") ? $"'{input}'" : input;
}
@ -29,7 +29,7 @@ public static string EncloseIfContainsSpace(this string input)
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public static string EncloseInQuotes(this string input)
public static string EncloseInQuotes(string input)
{
return $"'{input}'";
}
@ -43,7 +43,7 @@ public static string EncloseInQuotes(this string input)
/// </remarks>
/// <param name="source"></param>
/// <returns>Scaped path</returns>
public static string ToFFmpegLibavfilterPath(this string source)
public static string ToFFmpegLibavfilterPath(string source)
{
return source.Replace(CharactersSubstitution);
}

View file

@ -103,7 +103,9 @@ public SubtitleHardBurnOptions WithParameter(string key, string value)
return this;
}
internal string TextInternal => string.Join(":", new[] { _subtitle.ToFFmpegLibavfilterPath().EncloseInQuotes() }.Concat(Parameters.Select(parameter => parameter.FormatArgumentPair(enclose: true))));
internal string TextInternal => string
.Join(":", new[] { StringExtensions.EncloseInQuotes(StringExtensions.ToFFmpegLibavfilterPath(_subtitle)) }
.Concat(Parameters.Select(parameter => parameter.FormatArgumentPair(enclose: true))));
}
public class StyleOptions