mirror of
https://github.com/n00mkrad/flowframes.git
synced 2025-12-22 11:19:25 +01:00
CLI improvements, OneDrive path check
This commit is contained in:
@@ -66,6 +66,22 @@ namespace Flowframes
|
||||
}
|
||||
}
|
||||
|
||||
public static bool? GetBoolCli(this string str)
|
||||
{
|
||||
if (str == null)
|
||||
return null;
|
||||
|
||||
str = str.Trim().Lower();
|
||||
|
||||
if (str == "true" || str == "1" || str == "yes")
|
||||
return true;
|
||||
|
||||
if (str == "false" || str == "0" || str == "no")
|
||||
return false;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static float GetFloat(this TextBox textbox)
|
||||
{
|
||||
return GetFloat(textbox.Text);
|
||||
@@ -142,7 +158,7 @@ namespace Flowframes
|
||||
public static string Trunc(this string inStr, int maxChars, bool addEllipsis = true)
|
||||
{
|
||||
string str = inStr.Length <= maxChars ? inStr : inStr.Substring(0, maxChars);
|
||||
if(addEllipsis && inStr.Length > maxChars)
|
||||
if (addEllipsis && inStr.Length > maxChars)
|
||||
str += "…";
|
||||
return str;
|
||||
}
|
||||
@@ -189,7 +205,7 @@ namespace Flowframes
|
||||
return newString.ToString();
|
||||
}
|
||||
|
||||
public static string ReplaceLast (this string str, string stringToReplace, string replaceWith)
|
||||
public static string ReplaceLast(this string str, string stringToReplace, string replaceWith)
|
||||
{
|
||||
int place = str.LastIndexOf(stringToReplace);
|
||||
|
||||
@@ -199,12 +215,12 @@ namespace Flowframes
|
||||
return str.Remove(place, stringToReplace.Length).Insert(place, replaceWith);
|
||||
}
|
||||
|
||||
public static string[] SplitBy (this string str, string splitBy)
|
||||
public static string[] SplitBy(this string str, string splitBy)
|
||||
{
|
||||
return str.Split(new string[] { splitBy }, StringSplitOptions.None);
|
||||
}
|
||||
|
||||
public static string RemoveComments (this string str)
|
||||
public static string RemoveComments(this string str)
|
||||
{
|
||||
return str.Split('#')[0].SplitBy("//")[0];
|
||||
}
|
||||
@@ -216,9 +232,9 @@ namespace Flowframes
|
||||
return filename + suffix + ext;
|
||||
}
|
||||
|
||||
public static string ToStringDot (this float f, string format = "")
|
||||
public static string ToStringDot(this float f, string format = "")
|
||||
{
|
||||
if(string.IsNullOrWhiteSpace(format))
|
||||
if (string.IsNullOrWhiteSpace(format))
|
||||
return f.ToString().Replace(",", ".");
|
||||
else
|
||||
return f.ToString(format).Replace(",", ".");
|
||||
@@ -385,12 +401,12 @@ namespace Flowframes
|
||||
return s.ToUpperInvariant();
|
||||
}
|
||||
|
||||
public static EncoderInfoVideo GetInfo (this Enums.Encoding.Encoder enc)
|
||||
public static EncoderInfoVideo GetInfo(this Enums.Encoding.Encoder enc)
|
||||
{
|
||||
return OutputUtils.GetEncoderInfoVideo(enc);
|
||||
}
|
||||
|
||||
public static bool IsEmpty (this string s)
|
||||
public static bool IsEmpty(this string s)
|
||||
{
|
||||
return string.IsNullOrWhiteSpace(s);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user