Always use Invariant shortcuts for ToLower/ToUpper

This commit is contained in:
N00MKRAD
2024-09-03 22:08:38 +02:00
parent c31c76f423
commit 9672c31fba
48 changed files with 139 additions and 235 deletions

View File

@@ -18,7 +18,7 @@ namespace Flowframes.Data
public string NameLong { get; set; } = "";
public string FriendlyName { get { return $"{NameShort} ({GetFrameworkString(Backend)})"; } }
public string Description { get { return $"{GetImplemString(Backend)} of {NameShort}{(Backend == AiBackend.Pytorch ? " (Nvidia Only!)" : "")}"; } }
public string PkgDir { get { return NameInternal.Replace("_", "-").ToLowerInvariant(); } }
public string PkgDir { get { return NameInternal.Replace("_", "-").Lower(); } }
public enum InterpFactorSupport { Fixed, AnyPowerOfTwo, AnyInteger, AnyFloat }
public InterpFactorSupport FactorSupport { get; set; } = InterpFactorSupport.Fixed;
public int[] SupportedFactors { get; set; } = new int[0];

View File

@@ -184,7 +184,7 @@ namespace Flowframes
bool gifOutput = outSettings.Encoder == Enums.Encoding.Encoder.Gif;
bool proResAlpha = outSettings.Encoder == Enums.Encoding.Encoder.ProResKs && OutputUtils.AlphaFormats.Contains(outSettings.PixelFormat);
bool outputSupportsAlpha = pngOutput || gifOutput || proResAlpha;
string ext = inputIsFrames ? Path.GetExtension(IoUtils.GetFilesSorted(inPath).First()).ToLowerInvariant() : Path.GetExtension(inPath).ToLowerInvariant();
string ext = inputIsFrames ? Path.GetExtension(IoUtils.GetFilesSorted(inPath).First()).Lower() : Path.GetExtension(inPath).Lower();
alpha = (alphaModel && outputSupportsAlpha && (ext == ".gif" || ext == ".png" || ext == ".apng" || ext == ".mov"));
Logger.Log($"RefreshAlpha: model.supportsAlpha = {alphaModel} - outputSupportsAlpha = {outputSupportsAlpha} - input ext: {ext} => alpha = {alpha}", true);
}

View File

@@ -66,7 +66,7 @@ namespace Flowframes.Data
Name = FileInfo.Name;
SourcePath = FileInfo.FullName;
ImportPath = FileInfo.FullName;
Format = FileInfo.Extension.Remove(".").ToUpper();
Format = FileInfo.Extension.Remove(".").Upper();
InputRate = new Fraction(-1, 1);
}

View File

@@ -13,7 +13,7 @@ namespace Flowframes.Data
{
streamIndex = streamNum;
lang = metaStr.Trim().Replace("_", ".").Replace(" ", ".");
//langFriendly = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(metaStr.ToLowerInvariant().Trim().Replace("_", ".").Replace(" ", "."));
//langFriendly = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(metaStr.Lower().Trim().Replace("_", ".").Replace(" ", "."));
encoding = encodingStr.Trim();
}
}

View File

@@ -272,7 +272,7 @@ namespace Flowframes
{
try
{
return Path.GetExtension(filePath)?.ToLowerInvariant() == ".concat";
return Path.GetExtension(filePath)?.Lower() == ".concat";
}
catch
{

View File

@@ -27,7 +27,7 @@ namespace Flowframes.IO
try
{
string ext = new FileInfo(path).Extension.TrimStart('.').ToUpper();
string ext = new FileInfo(path).Extension.TrimStart('.').Upper();
if (incompatibleExtensions.Contains(ext))
return null;
@@ -330,7 +330,7 @@ namespace Flowframes.IO
public static async Task<Fraction> GetVideoFramerate(string path)
{
string[] preferFfmpegReadoutFormats = new string[] { ".gif", ".png", ".apng", ".webp" };
bool preferFfmpegReadout = preferFfmpegReadoutFormats.Contains(Path.GetExtension(path).ToLowerInvariant());
bool preferFfmpegReadout = preferFfmpegReadoutFormats.Contains(Path.GetExtension(path).Lower());
Fraction fps = new Fraction();
@@ -612,7 +612,7 @@ namespace Flowframes.IO
filename = filename.Replace("[NAME]", inName);
filename = filename.Replace("[FULLNAME]", Path.GetFileName(curr.inPath));
filename = filename.Replace("[FACTOR]", curr.interpFactor.ToStringDot());
filename = filename.Replace("[AI]", curr.ai.NameShort.ToUpper());
filename = filename.Replace("[AI]", curr.ai.NameShort.Upper());
filename = filename.Replace("[MODEL]", curr.model.Name.Remove(" "));
filename = filename.Replace("[FPS]", fps.ToStringDot("0.###"));
filename = filename.Replace("[ROUNDFPS]", fps.RoundToInt().ToString());
@@ -758,7 +758,7 @@ namespace Flowframes.IO
{
MD5 md5 = MD5.Create();
var hash = md5.ComputeHash(stream);
hashStr = BitConverter.ToString(hash).Replace("-", "").ToLowerInvariant();
hashStr = BitConverter.ToString(hash).Replace("-", "").Lower();
}
if (hashType == Hash.CRC32)

View File

@@ -20,7 +20,7 @@ namespace Flowframes.IO
string custServer = Config.Get(Config.Key.customServer);
string server = custServer.Trim().Length > 3 ? custServer : Servers.GetServer().GetUrl();
string baseUrl = $"{server}/flowframes/mdl/";
return Path.Combine(baseUrl, ai.ToLowerInvariant(), relPath);
return Path.Combine(baseUrl, ai.Lower(), relPath);
}
static string GetMdlFileUrl(string ai, string model, string relPath)

View File

@@ -22,7 +22,7 @@ namespace Flowframes.Magick
int counter = 0;
foreach (string file in files)
{
if (print) Logger.Log("Converting " + Path.GetFileName(file) + " to " + format.ToString().StripNumbers().ToUpper(), false, true);
if (print) Logger.Log("Converting " + Path.GetFileName(file) + " to " + format.ToString().StripNumbers().Upper(), false, true);
MagickImage img = new MagickImage(file);
img.Format = format;
img.Quality = quality;

View File

@@ -126,7 +126,7 @@ namespace Flowframes.Main
{
Program.mainForm.SetStatus("Copying output frames...");
Enums.Encoding.Encoder desiredFormat = I.currentSettings.outSettings.Encoder;
string availableFormat = Path.GetExtension(IoUtils.GetFilesSorted(framesPath, "*.*")[0]).Remove(".").ToUpper();
string availableFormat = Path.GetExtension(IoUtils.GetFilesSorted(framesPath, "*.*")[0]).Remove(".").Upper();
string max = Config.Get(Config.Key.maxFps);
Fraction maxFps = max.Contains("/") ? new Fraction(max) : new Fraction(max.GetFloat());
bool fpsLimit = maxFps.GetFloat() > 0f && I.currentSettings.outFps.GetFloat() > maxFps.GetFloat();
@@ -139,7 +139,7 @@ namespace Flowframes.Main
IoUtils.RenameExistingFolder(outputFolderPath);
Logger.Log($"Exporting {desiredFormat.ToString().Upper()} frames to '{Path.GetFileName(outputFolderPath)}'...");
if (desiredFormat.GetInfo().OverideExtension.ToUpper() == availableFormat.ToUpper()) // Move if frames are already in the desired format
if (desiredFormat.GetInfo().OverideExtension.Upper() == availableFormat.Upper()) // Move if frames are already in the desired format
await CopyOutputFrames(framesPath, framesFile, outputFolderPath, 1, fpsLimit, false);
else // Encode if frames are not in desired format
await FfmpegEncode.FramesToFrames(framesFile, outputFolderPath, 1, I.currentSettings.outFps, new Fraction(), desiredFormat, OutputUtils.GetImgSeqQ(I.currentSettings.outSettings));
@@ -301,7 +301,7 @@ namespace Flowframes.Main
if (settings.Encoder.GetInfo().IsImageSequence) // Image Sequence output mode, not video
{
string desiredFormat = settings.Encoder.GetInfo().OverideExtension;
string availableFormat = Path.GetExtension(IoUtils.GetFilesSorted(interpDir)[0]).Remove(".").ToUpper();
string availableFormat = Path.GetExtension(IoUtils.GetFilesSorted(interpDir)[0]).Remove(".").Upper();
if (!dontEncodeFullFpsVid)
{
@@ -311,7 +311,7 @@ namespace Flowframes.Main
if (chunkNo == 1) // Only check for existing folder on first chunk, otherwise each chunk makes a new folder
IoUtils.RenameExistingFolder(outFolderPath);
if (desiredFormat.ToUpper() == availableFormat.ToUpper()) // Move if frames are already in the desired format
if (desiredFormat.Upper() == availableFormat.Upper()) // Move if frames are already in the desired format
await CopyOutputFrames(interpDir, concatFile, outFolderPath, startNo, fpsLimit, true);
else // Encode if frames are not in desired format
await FfmpegEncode.FramesToFrames(concatFile, outFolderPath, startNo, I.currentSettings.outFps, new Fraction(), settings.Encoder, OutputUtils.GetImgSeqQ(settings), AvProcess.LogMode.Hidden);

View File

@@ -176,7 +176,7 @@ namespace Flowframes.Main
return false;
}
if (I.currentSettings.ai.NameInternal.ToUpper().Contains("CUDA") && NvApi.gpuList.Count < 1)
if (I.currentSettings.ai.NameInternal.Upper().Contains("CUDA") && NvApi.gpuList.Count < 1)
{
UiUtils.ShowMessageBox("Warning: No Nvidia GPU was detected. CUDA might fall back to CPU!\n\nTry an NCNN implementation instead if you don't have an Nvidia GPU.", UiUtils.MessageType.Error);
@@ -240,7 +240,7 @@ namespace Flowframes.Main
{
string enc = I.currentSettings.outSettings.Encoder.GetInfo().Name;
if (enc.ToLowerInvariant().Contains("nvenc") && !(await FfmpegCommands.IsEncoderCompatible(enc)))
if (enc.Lower().Contains("nvenc") && !(await FfmpegCommands.IsEncoderCompatible(enc)))
{
UiUtils.ShowMessageBox("NVENC encoding is not available on your hardware!\nPlease use a different encoder.", UiUtils.MessageType.Error);
I.Cancel();

View File

@@ -241,7 +241,7 @@ namespace Flowframes
try
{
string[] lines = info.SplitIntoLines();
string lastLine = lines.Last().ToLowerInvariant();
string lastLine = lines.Last().Lower();
return lastLine.Substring(0, lastLine.IndexOf("fps")).GetInt();
}
catch

View File

@@ -306,7 +306,7 @@ namespace Flowframes.Media
public static async Task ImportSingleImage(string inputFile, string outPath, Size size)
{
string sizeStr = (size.Width > 1 && size.Height > 1) ? $"-s {size.Width}x{size.Height}" : "";
bool isPng = (Path.GetExtension(outPath).ToLowerInvariant() == ".png");
bool isPng = (Path.GetExtension(outPath).Lower() == ".png");
string comprArg = isPng ? pngCompr : "";
string pixFmt = isPng ? $"rgb24 {comprArg}" : "yuv420p -color_range full";
string args = $"-i {inputFile.Wrap()} {comprArg} {sizeStr} -pix_fmt {pixFmt} -vf {GetPadFilter()} {outPath.Wrap()}";
@@ -315,7 +315,7 @@ namespace Flowframes.Media
public static async Task ExtractSingleFrame(string inputFile, string outputPath, int frameNum)
{
bool isPng = (Path.GetExtension(outputPath).ToLowerInvariant() == ".png");
bool isPng = (Path.GetExtension(outputPath).Lower() == ".png");
string comprArg = isPng ? pngCompr : "";
string pixFmt = isPng ? $"rgb24 {comprArg}" : "yuv420p -color_range full";
string args = $"-i {inputFile.Wrap()} -vf \"select=eq(n\\,{frameNum})\" -vframes 1 -update 1 -pix_fmt {pixFmt} {outputPath.Wrap()}";
@@ -330,7 +330,7 @@ namespace Flowframes.Media
if (IoUtils.IsPathDirectory(outputPath))
outputPath = Path.Combine(outputPath, "last.png");
bool isPng = (Path.GetExtension(outputPath).ToLowerInvariant() == ".png");
bool isPng = (Path.GetExtension(outputPath).Lower() == ".png");
string comprArg = isPng ? pngCompr : "";
string pixFmt = isPng ? $"rgb24 {comprArg}" : "yuv420p -color_range full";
string sizeStr = (size.Width > 1 && size.Height > 1) ? $"-s {size.Width}x{size.Height}" : "";

View File

@@ -65,7 +65,7 @@ namespace Flowframes.Media
string title = await GetFfprobeInfoAsync(path, showStreams, "TAG:title", idx);
string codec = await GetFfprobeInfoAsync(path, showStreams, "codec_name", idx);
string codecLong = await GetFfprobeInfoAsync(path, showStreams, "codec_long_name", idx);
string pixFmt = (await GetFfprobeInfoAsync(path, showStreams, "pix_fmt", idx)).ToUpper();
string pixFmt = (await GetFfprobeInfoAsync(path, showStreams, "pix_fmt", idx)).Upper();
int kbits = (await GetFfprobeInfoAsync(path, showStreams, "bit_rate", idx)).GetInt() / 1024;
Size res = await GetMediaResolutionCached.GetSizeAsync(path);
Size sar = SizeFromString(await GetFfprobeInfoAsync(path, showStreams, "sample_aspect_ratio", idx));
@@ -86,7 +86,7 @@ namespace Flowframes.Media
string title = await GetFfprobeInfoAsync(path, showStreams, "TAG:title", idx);
string codec = await GetFfprobeInfoAsync(path, showStreams, "codec_name", idx);
string profile = await GetFfprobeInfoAsync(path, showStreams, "profile", idx);
if (codec.ToLowerInvariant() == "dts" && profile != "unknown") codec = profile;
if (codec.Lower() == "dts" && profile != "unknown") codec = profile;
string codecLong = await GetFfprobeInfoAsync(path, showStreams, "codec_long_name", idx);
int kbits = (await GetFfprobeInfoAsync(path, showStreams, "bit_rate", idx)).GetInt() / 1024;
int sampleRate = (await GetFfprobeInfoAsync(path, showStreams, "sample_rate", idx)).GetInt();
@@ -250,14 +250,14 @@ namespace Flowframes.Media
if (enc == Encoder.X264)
{
string preset = Config.Get(Config.Key.ffEncPreset).ToLowerInvariant().Remove(" "); // TODO: Replace this ugly stuff with enums
string preset = Config.Get(Config.Key.ffEncPreset).Lower().Remove(" "); // TODO: Replace this ugly stuff with enums
int crf = GetCrf(settings);
args.Add($"-crf {crf} -preset {preset}");
}
if (enc == Encoder.X265)
{
string preset = Config.Get(Config.Key.ffEncPreset).ToLowerInvariant().Remove(" "); // TODO: Replace this ugly stuff with enums
string preset = Config.Get(Config.Key.ffEncPreset).Lower().Remove(" "); // TODO: Replace this ugly stuff with enums
int crf = GetCrf(settings);
args.Add($"{(crf > 0 ? $"-crf {crf}" : "-x265-params lossless=1")} -preset {preset}");
}
@@ -402,7 +402,7 @@ namespace Flowframes.Media
static string GetVp9Speed()
{
string preset = Config.Get(Config.Key.ffEncPreset).ToLowerInvariant().Remove(" ");
string preset = Config.Get(Config.Key.ffEncPreset).Lower().Remove(" ");
string arg = "";
if (preset == "veryslow") arg = "0";
@@ -418,7 +418,7 @@ namespace Flowframes.Media
static string GetSvtAv1Speed()
{
string preset = Config.Get(Config.Key.ffEncPreset).ToLowerInvariant().Remove(" ");
string preset = Config.Get(Config.Key.ffEncPreset).Lower().Remove(" ");
string arg = "8";
if (preset == "veryslow") arg = "3";
@@ -548,10 +548,10 @@ namespace Flowframes.Media
{
containerExt = containerExt.Lower().Remove(".");
bool supported = (containerExt == "mp4" || containerExt == "mkv" || containerExt == "webm" || containerExt == "mov");
// Logger.Log($"Subtitles {(supported ? "are supported" : "not supported")} by {containerExt.ToUpper()}", true);
// Logger.Log($"Subtitles {(supported ? "are supported" : "not supported")} by {containerExt.Upper()}", true);
if (showWarningIfNotSupported && Config.GetBool(Config.Key.keepSubs) && !supported)
Logger.Log($"Warning: {containerExt.ToUpper()} exports do not include subtitles.");
Logger.Log($"Warning: {containerExt.Upper()} exports do not include subtitles.");
return supported;
}

View File

@@ -79,13 +79,13 @@ namespace Flowframes.Media
if (stripKeyName)
{
List<string> filtered = output.SplitIntoLines().Where(x => x.ToLowerInvariant().Contains(lineFilter.ToLowerInvariant())).ToList(); // Filter
List<string> filtered = output.SplitIntoLines().Where(x => x.Lower().Contains(lineFilter.Lower())).ToList(); // Filter
filtered = filtered.Select(x => string.Join("", x.Split('=').Skip(1))).ToList(); // Ignore everything before (and including) the first '=' sign
output = string.Join("\n", filtered);
}
else
{
output = string.Join("\n", output.SplitIntoLines().Where(x => x.ToLowerInvariant().Contains(lineFilter.ToLowerInvariant())).ToArray());
output = string.Join("\n", output.SplitIntoLines().Where(x => x.Lower().Contains(lineFilter.Lower())).ToArray());
}
}

View File

@@ -193,7 +193,7 @@ namespace Flowframes.MiscUtils
public static string CapsIfShort(string codec, int capsIfShorterThan = 5)
{
if (codec.Length < capsIfShorterThan)
return codec.ToUpper();
return codec.Upper();
else
return codec.ToTitleCase();
}

View File

@@ -139,8 +139,8 @@ namespace Flowframes.Os
{
if (AvProcess.lastAvProcess != null && !AvProcess.lastAvProcess.HasExited)
{
if (Logger.LastLogLine.ToLowerInvariant().Contains("frame: "))
Logger.Log(FormatUtils.BeautifyFfmpegStats(Logger.LastLogLine), false, Logger.LastUiLine.ToLowerInvariant().Contains("frame"));
if (Logger.LastLogLine.Lower().Contains("frame: "))
Logger.Log(FormatUtils.BeautifyFfmpegStats(Logger.LastLogLine), false, Logger.LastUiLine.Lower().Contains("frame"));
}
if (AvProcess.lastAvProcess.HasExited && !AutoEncode.HasWorkToDo()) // Stop logging if ffmpeg is not running & AE is done
@@ -325,7 +325,7 @@ namespace Flowframes.Os
string ttaStr = Config.GetBool(Config.Key.rifeNcnnUseTta, false) ? "-x" : "";
rifeNcnn.StartInfo.Arguments = $"{OsUtils.GetCmdArg()} cd /D {Path.Combine(Paths.GetPkgPath(), Implementations.rifeNcnn.PkgDir).Wrap()} & rife-ncnn-vulkan.exe " +
$" -v -i {inPath.Wrap()} -o {outPath.Wrap()} {frames} -m {mdl.ToLowerInvariant()} {ttaStr} {uhdStr} -g {Config.Get(Config.Key.ncnnGpus)} -f {NcnnUtils.GetNcnnPattern()} -j {NcnnUtils.GetNcnnThreads(Implementations.rifeNcnn)}";
$" -v -i {inPath.Wrap()} -o {outPath.Wrap()} {frames} -m {mdl.Lower()} {ttaStr} {uhdStr} -g {Config.Get(Config.Key.ncnnGpus)} -f {NcnnUtils.GetNcnnPattern()} -j {NcnnUtils.GetNcnnThreads(Implementations.rifeNcnn)}";
Logger.Log("cmd.exe " + rifeNcnn.StartInfo.Arguments, true);
@@ -457,7 +457,7 @@ namespace Flowframes.Os
SetProgressCheck(outPath, factor);
int targetFrames = ((IoUtils.GetAmountOfFiles(lastInPath, false, "*.*") * factor).RoundToInt());
string args = $" -v -i {framesPath.Wrap()} -o {outPath.Wrap()} -n {targetFrames} -m {mdl.ToLowerInvariant()}" +
string args = $" -v -i {framesPath.Wrap()} -o {outPath.Wrap()} -n {targetFrames} -m {mdl.Lower()}" +
$" -t {NcnnUtils.GetNcnnTilesize(tilesize)} -g {Config.Get(Config.Key.ncnnGpus)} -f {NcnnUtils.GetNcnnPattern()} -j 2:1:2";
dain.StartInfo.Arguments = $"{OsUtils.GetCmdArg()} cd /D {dainDir.Wrap()} & dain-ncnn-vulkan.exe {args}";
@@ -619,26 +619,26 @@ namespace Flowframes.Os
if (line.Contains("ff:nocuda-cpu"))
Logger.Log("WARNING: CUDA-capable GPU device is not available, running on CPU instead!");
if (!hasShownError && err && line.ToLowerInvariant().Contains("modulenotfounderror"))
if (!hasShownError && err && line.Lower().Contains("modulenotfounderror"))
{
hasShownError = true;
UiUtils.ShowMessageBox($"A python module is missing.\nCheck {ai.LogFilename} for details.\n\n{line}", UiUtils.MessageType.Error);
}
if (!hasShownError && line.ToLowerInvariant().Contains("no longer supports this gpu"))
if (!hasShownError && line.Lower().Contains("no longer supports this gpu"))
{
hasShownError = true;
UiUtils.ShowMessageBox($"Your GPU seems to be outdated and is not supported!\n\n{line}", UiUtils.MessageType.Error);
}
if (!hasShownError && line.ToLowerInvariant().Contains("error(s) in loading state_dict"))
if (!hasShownError && line.Lower().Contains("error(s) in loading state_dict"))
{
hasShownError = true;
string msg = (Interpolate.currentSettings.ai.NameInternal == Implementations.flavrCuda.NameInternal) ? "\n\nFor FLAVR, you need to select the correct model for each scale!" : "";
UiUtils.ShowMessageBox($"Error loading the AI model!\n\n{line}{msg}", UiUtils.MessageType.Error);
}
if (!hasShownError && line.ToLowerInvariant().Contains("unicodeencodeerror"))
if (!hasShownError && line.Lower().Contains("unicodeencodeerror"))
{
hasShownError = true;
UiUtils.ShowMessageBox($"It looks like your path contains invalid characters - remove them and try again!\n\n{line}", UiUtils.MessageType.Error);
@@ -682,32 +682,32 @@ namespace Flowframes.Os
if (ai.Piped) // VS specific
{
if (!hasShownError && Interpolate.currentSettings.outSettings.Format != Enums.Output.Format.Realtime && line.ToLowerInvariant().Contains("fwrite() call failed"))
if (!hasShownError && Interpolate.currentSettings.outSettings.Format != Enums.Output.Format.Realtime && line.Lower().Contains("fwrite() call failed"))
{
hasShownError = true;
UiUtils.ShowMessageBox($"VapourSynth interpolation failed with an unknown error. Check the log for details:\n\n{lastLogLines}", UiUtils.MessageType.Error);
}
if (!hasShownError && line.ToLowerInvariant().Contains("allocate memory failed"))
if (!hasShownError && line.Lower().Contains("allocate memory failed"))
{
hasShownError = true;
UiUtils.ShowMessageBox($"Out of memory!\nTry reducing your RAM usage by closing some programs.\n\n{line}", UiUtils.MessageType.Error);
}
if (!hasShownError && line.ToLowerInvariant().Contains("vapoursynth.error:"))
if (!hasShownError && line.Lower().Contains("vapoursynth.error:"))
{
hasShownError = true;
UiUtils.ShowMessageBox($"VapourSynth Error:\n\n{line}", UiUtils.MessageType.Error);
}
}
if (!hasShownError && err && line.ToLowerInvariant().Contains("out of memory"))
if (!hasShownError && err && line.Lower().Contains("out of memory"))
{
hasShownError = true;
UiUtils.ShowMessageBox($"Your GPU ran out of VRAM! Please try a video with a lower resolution or use the Max Video Size option in the settings.\n\n{line}", UiUtils.MessageType.Error);
}
if (!hasShownError && line.ToLowerInvariant().Contains("illegal memory access"))
if (!hasShownError && line.Lower().Contains("illegal memory access"))
{
hasShownError = true;
UiUtils.ShowMessageBox($"Your GPU appears to be unstable! If you have an overclock enabled, please disable it!\n\n{line}", UiUtils.MessageType.Error);

View File

@@ -149,10 +149,10 @@ namespace Flowframes.Os
var detectedDrives = Detector.DetectFixedDrives(QueryType.SeekPenalty);
if (detectedDrives.Count != 0)
{
char pathDriveLetter = (path[0].ToString().ToUpper())[0];
char pathDriveLetter = (path[0].ToString().Upper())[0];
foreach (var detectedDrive in detectedDrives)
{
if (detectedDrive.DriveLetter == pathDriveLetter && detectedDrive.HardwareType.ToString().ToLowerInvariant().Trim() == "ssd")
if (detectedDrive.DriveLetter == pathDriveLetter && detectedDrive.HardwareType.ToString().Lower().Trim() == "ssd")
return true;
}
}

View File

@@ -165,7 +165,7 @@ namespace Flowframes.Os
Logger.Log("Checking if system Python is available...", true);
string sysPyVer = GetSysPyVersion();
if (!string.IsNullOrWhiteSpace(sysPyVer) && !sysPyVer.ToLowerInvariant().Contains("not found") && sysPyVer.Length <= 35)
if (!string.IsNullOrWhiteSpace(sysPyVer) && !sysPyVer.Lower().Contains("not found") && sysPyVer.Length <= 35)
{
isInstalled = true;
Logger.Log("Using Python installation: " + sysPyVer, true);

View File

@@ -56,7 +56,7 @@ namespace Flowframes.Os
if (winVer.IsEmpty())
return;
if (!winVer.ToLowerInvariant().Contains("windows 10") && !winVer.ToLowerInvariant().Contains("windows 11") && !Config.GetBool("ignoreIncompatibleOs", false))
if (!winVer.Lower().Contains("windows 10") && !winVer.Lower().Contains("windows 11") && !Config.GetBool("ignoreIncompatibleOs", false))
{
UiUtils.ShowMessageBox($"This application was made for Windows 10/11 and is not officially compatible with {winVer}.\n\n" +
$"Use it at your own risk and do NOT ask for support as long as your are on {winVer}.", UiUtils.MessageType.Warning);

View File

@@ -53,7 +53,7 @@ namespace Flowframes
Config.Init();
Task.Run(() => DiskSpaceCheckLoop());
args = Environment.GetCommandLineArgs().Where(a => a[0] == '-').Select(x => x.Trim().Substring(1).ToLowerInvariant()).ToArray();
args = Environment.GetCommandLineArgs().Where(a => a[0] == '-').Select(x => x.Trim().Substring(1).Lower()).ToArray();
Logger.Log($"Command Line: {Environment.CommandLine}", true);
LaunchGui();

View File

@@ -54,7 +54,7 @@ namespace Flowframes.Ui
public static void ToggleMonospace(TextBox logBox)
{
bool isMonospace = logBox.Font.Name.ToLowerInvariant().Contains("consolas");
bool isMonospace = logBox.Font.Name.Lower().Contains("consolas");
if (isMonospace)
logBox.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.5f);

View File

@@ -74,7 +74,7 @@ namespace Flowframes.Ui
{
for (int i = 0; i < combox.Items.Count; i++)
{
if (((string)combox.Items[i]).ToUpper().Contains("NCNN"))
if (((string)combox.Items[i]).Upper().Contains("NCNN"))
combox.SelectedIndex = i;
}
}

View File

@@ -15,7 +15,7 @@ namespace Flowframes.Utilities
{
public static int GetColorPrimaries(string s) // Defined by the "Color primaries" section of ISO/IEC 23091-4/ITU-T H.273
{
s = s.Trim().ToLowerInvariant();
s = s.Trim().Lower();
if (s == "bt709") return 1;
if (s == "bt470m") return 4;
if (s == "bt470bg") return 5;
@@ -31,7 +31,7 @@ namespace Flowframes.Utilities
public static int GetColorTransfer(string s) // Defined by the "Transfer characteristics" section of ISO/IEC 23091-4/ITU-T H.273
{
s = s.Trim().ToLowerInvariant();
s = s.Trim().Lower();
if (s == "bt709") return 1;
if (s == "gamma22" || s == "bt470m") return 4;
if (s == "gamma28" || s == "bt470bg") return 5; // BT.470 System B, G (historical)
@@ -53,7 +53,7 @@ namespace Flowframes.Utilities
public static int GetMatrixCoeffs(string s) // Defined by the "Matrix coefficients" section of ISO/IEC 23091-4/ITU-T H.27
{
s = s.Trim().ToLowerInvariant();
s = s.Trim().Lower();
if (s == "bt709") return 1;
if (s == "fcc") return 4; // US FCC 73.628
if (s == "bt470bg") return 5; // BT.470 System B, G (historical)
@@ -71,7 +71,7 @@ namespace Flowframes.Utilities
public static int GetColorRange(string s) // Defined by the "Matrix coefficients" section of ISO/IEC 23091-4/ITU-T H.27
{
s = s.Trim().ToLowerInvariant();
s = s.Trim().Lower();
if (s == "tv") return 1; // TV
if (s == "pc") return 2; // PC/Full
return 0; // Fallback: Unspecified

View File

@@ -18,7 +18,7 @@ namespace Flowframes.Data
public string NameLong { get; set; } = "";
public string FriendlyName { get { return $"{NameShort} ({GetFrameworkString(Backend)})"; } }
public string Description { get { return $"{GetImplemString(Backend)} of {NameShort}{(Backend == AiBackend.Pytorch ? " (Nvidia Only!)" : "")}"; } }
public string PkgDir { get { return NameInternal.Replace("_", "-").ToLowerInvariant(); } }
public string PkgDir { get { return NameInternal.Replace("_", "-").Lower(); } }
public enum InterpFactorSupport { Fixed, AnyPowerOfTwo, AnyInteger, AnyFloat }
public InterpFactorSupport FactorSupport { get; set; } = InterpFactorSupport.Fixed;
public int[] SupportedFactors { get; set; } = new int[0];

View File

@@ -184,7 +184,7 @@ namespace Flowframes
bool gifOutput = outSettings.Encoder == Enums.Encoding.Encoder.Gif;
bool proResAlpha = outSettings.Encoder == Enums.Encoding.Encoder.ProResKs && OutputUtils.AlphaFormats.Contains(outSettings.PixelFormat);
bool outputSupportsAlpha = pngOutput || gifOutput || proResAlpha;
string ext = inputIsFrames ? Path.GetExtension(IoUtils.GetFilesSorted(inPath).First()).ToLowerInvariant() : Path.GetExtension(inPath).ToLowerInvariant();
string ext = inputIsFrames ? Path.GetExtension(IoUtils.GetFilesSorted(inPath).First()).Lower() : Path.GetExtension(inPath).Lower();
alpha = (alphaModel && outputSupportsAlpha && (ext == ".gif" || ext == ".png" || ext == ".apng" || ext == ".mov"));
Logger.Log($"RefreshAlpha: model.supportsAlpha = {alphaModel} - outputSupportsAlpha = {outputSupportsAlpha} - input ext: {ext} => alpha = {alpha}", true);
}

View File

@@ -66,7 +66,7 @@ namespace Flowframes.Data
Name = FileInfo.Name;
SourcePath = FileInfo.FullName;
ImportPath = FileInfo.FullName;
Format = FileInfo.Extension.Remove(".").ToUpper();
Format = FileInfo.Extension.Remove(".").Upper();
InputRate = new Fraction(-1, 1);
}

View File

@@ -13,7 +13,7 @@ namespace Flowframes.Data
{
streamIndex = streamNum;
lang = metaStr.Trim().Replace("_", ".").Replace(" ", ".");
//langFriendly = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(metaStr.ToLowerInvariant().Trim().Replace("_", ".").Replace(" ", "."));
//langFriendly = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(metaStr.Lower().Trim().Replace("_", ".").Replace(" ", "."));
encoding = encodingStr.Trim();
}
}

View File

@@ -249,7 +249,7 @@ namespace Flowframes
{
try
{
return Path.GetExtension(filePath)?.ToLowerInvariant() == ".concat";
return Path.GetExtension(filePath)?.Lower() == ".concat";
}
catch
{
@@ -367,7 +367,7 @@ namespace Flowframes
if (s == null)
return s;
return s.ToLowerInvariant();
return s.Lower();
}
public static string Upper(this string s)

View File

@@ -27,7 +27,7 @@ namespace Flowframes.IO
try
{
string ext = new FileInfo(path).Extension.TrimStart('.').ToUpper();
string ext = new FileInfo(path).Extension.TrimStart('.').Upper();
if (incompatibleExtensions.Contains(ext))
return null;
@@ -328,7 +328,7 @@ namespace Flowframes.IO
public static async Task<Fraction> GetVideoFramerate(string path)
{
string[] preferFfmpegReadoutFormats = new string[] { ".gif", ".png", ".apng", ".webp" };
bool preferFfmpegReadout = preferFfmpegReadoutFormats.Contains(Path.GetExtension(path).ToLowerInvariant());
bool preferFfmpegReadout = preferFfmpegReadoutFormats.Contains(Path.GetExtension(path).Lower());
Fraction fps = new Fraction();
@@ -620,7 +620,7 @@ namespace Flowframes.IO
filename = filename.Replace("[NAME]", inName);
filename = filename.Replace("[FULLNAME]", Path.GetFileName(curr.inPath));
filename = filename.Replace("[FACTOR]", curr.interpFactor.ToStringDot());
filename = filename.Replace("[AI]", curr.ai.NameShort.ToUpper());
filename = filename.Replace("[AI]", curr.ai.NameShort.Upper());
filename = filename.Replace("[MODEL]", curr.model.Name.Remove(" "));
filename = filename.Replace("[FPS]", fps.ToStringDot("0.###"));
filename = filename.Replace("[ROUNDFPS]", fps.RoundToInt().ToString());
@@ -766,7 +766,7 @@ namespace Flowframes.IO
{
MD5 md5 = MD5.Create();
var hash = md5.ComputeHash(stream);
hashStr = BitConverter.ToString(hash).Replace("-", "").ToLowerInvariant();
hashStr = BitConverter.ToString(hash).Replace("-", "").Lower();
}
if (hashType == Hash.CRC32)

View File

@@ -20,7 +20,7 @@ namespace Flowframes.IO
string custServer = Config.Get(Config.Key.customServer);
string server = custServer.Trim().Length > 3 ? custServer : Servers.GetServer().GetUrl();
string baseUrl = $"{server}/flowframes/mdl/";
return Path.Combine(baseUrl, ai.ToLowerInvariant(), relPath);
return Path.Combine(baseUrl, ai.Lower(), relPath);
}
static string GetMdlFileUrl(string ai, string model, string relPath)

View File

@@ -22,7 +22,7 @@ namespace Flowframes.Magick
int counter = 0;
foreach (string file in files)
{
if (print) Logger.Log("Converting " + Path.GetFileName(file) + " to " + format.ToString().StripNumbers().ToUpper(), false, true);
if (print) Logger.Log("Converting " + Path.GetFileName(file) + " to " + format.ToString().StripNumbers().Upper(), false, true);
MagickImage img = new MagickImage(file);
img.Format = format;
img.Quality = quality;

View File

@@ -126,7 +126,7 @@ namespace Flowframes.Main
{
Program.mainForm.SetStatus("Copying output frames...");
Enums.Encoding.Encoder desiredFormat = I.currentSettings.outSettings.Encoder;
string availableFormat = Path.GetExtension(IoUtils.GetFilesSorted(framesPath, "*.*")[0]).Remove(".").ToUpper();
string availableFormat = Path.GetExtension(IoUtils.GetFilesSorted(framesPath, "*.*")[0]).Remove(".").Upper();
string max = Config.Get(Config.Key.maxFps);
Fraction maxFps = max.Contains("/") ? new Fraction(max) : new Fraction(max.GetFloat());
bool fpsLimit = maxFps.GetFloat() > 0f && I.currentSettings.outFps.GetFloat() > maxFps.GetFloat();
@@ -139,7 +139,7 @@ namespace Flowframes.Main
IoUtils.RenameExistingFolder(outputFolderPath);
Logger.Log($"Exporting {desiredFormat.ToString().Upper()} frames to '{Path.GetFileName(outputFolderPath)}'...");
if (desiredFormat.GetInfo().OverideExtension.ToUpper() == availableFormat.ToUpper()) // Move if frames are already in the desired format
if (desiredFormat.GetInfo().OverideExtension.Upper() == availableFormat.Upper()) // Move if frames are already in the desired format
await CopyOutputFrames(framesPath, framesFile, outputFolderPath, 1, fpsLimit, false);
else // Encode if frames are not in desired format
await FfmpegEncode.FramesToFrames(framesFile, outputFolderPath, 1, I.currentSettings.outFps, new Fraction(), desiredFormat, OutputUtils.GetImgSeqQ(I.currentSettings.outSettings));
@@ -301,7 +301,7 @@ namespace Flowframes.Main
if (settings.Encoder.GetInfo().IsImageSequence) // Image Sequence output mode, not video
{
string desiredFormat = settings.Encoder.GetInfo().OverideExtension;
string availableFormat = Path.GetExtension(IoUtils.GetFilesSorted(interpDir)[0]).Remove(".").ToUpper();
string availableFormat = Path.GetExtension(IoUtils.GetFilesSorted(interpDir)[0]).Remove(".").Upper();
if (!dontEncodeFullFpsVid)
{
@@ -311,7 +311,7 @@ namespace Flowframes.Main
if (chunkNo == 1) // Only check for existing folder on first chunk, otherwise each chunk makes a new folder
IoUtils.RenameExistingFolder(outFolderPath);
if (desiredFormat.ToUpper() == availableFormat.ToUpper()) // Move if frames are already in the desired format
if (desiredFormat.Upper() == availableFormat.Upper()) // Move if frames are already in the desired format
await CopyOutputFrames(interpDir, concatFile, outFolderPath, startNo, fpsLimit, true);
else // Encode if frames are not in desired format
await FfmpegEncode.FramesToFrames(concatFile, outFolderPath, startNo, I.currentSettings.outFps, new Fraction(), settings.Encoder, OutputUtils.GetImgSeqQ(settings), AvProcess.LogMode.Hidden);

View File

@@ -170,7 +170,7 @@ namespace Flowframes.Main
return false;
}
if (I.currentSettings.ai.NameInternal.ToUpper().Contains("CUDA") && NvApi.gpuList.Count < 1)
if (I.currentSettings.ai.NameInternal.Upper().Contains("CUDA") && NvApi.gpuList.Count < 1)
{
UiUtils.ShowMessageBox("Warning: No Nvidia GPU was detected. CUDA might fall back to CPU!\n\nTry an NCNN implementation instead if you don't have an Nvidia GPU.", UiUtils.MessageType.Error);
@@ -234,7 +234,7 @@ namespace Flowframes.Main
{
string enc = I.currentSettings.outSettings.Encoder.GetInfo().Name;
if (enc.ToLowerInvariant().Contains("nvenc") && !(await FfmpegCommands.IsEncoderCompatible(enc)))
if (enc.Lower().Contains("nvenc") && !(await FfmpegCommands.IsEncoderCompatible(enc)))
{
UiUtils.ShowMessageBox("NVENC encoding is not available on your hardware!\nPlease use a different encoder.", UiUtils.MessageType.Error);
I.Cancel();

View File

@@ -241,7 +241,7 @@ namespace Flowframes
try
{
string[] lines = info.SplitIntoLines();
string lastLine = lines.Last().ToLowerInvariant();
string lastLine = lines.Last().Lower();
return lastLine.Substring(0, lastLine.IndexOf("fps")).GetInt();
}
catch

View File

@@ -307,7 +307,7 @@ namespace Flowframes.Media
public static async Task ImportSingleImage(string inputFile, string outPath, Size size)
{
string sizeStr = (size.Width > 1 && size.Height > 1) ? $"-s {size.Width}x{size.Height}" : "";
bool isPng = (Path.GetExtension(outPath).ToLowerInvariant() == ".png");
bool isPng = (Path.GetExtension(outPath).Lower() == ".png");
string comprArg = isPng ? pngCompr : "";
string pixFmt = "-pix_fmt " + (isPng ? $"rgb24 {comprArg}" : "yuvj420p");
string args = $"-i {inputFile.Wrap()} {comprArg} {sizeStr} {pixFmt} -vf {GetPadFilter()} {outPath.Wrap()}";
@@ -316,7 +316,7 @@ namespace Flowframes.Media
public static async Task ExtractSingleFrame(string inputFile, string outputPath, int frameNum)
{
bool isPng = (Path.GetExtension(outputPath).ToLowerInvariant() == ".png");
bool isPng = (Path.GetExtension(outputPath).Lower() == ".png");
string comprArg = isPng ? pngCompr : "";
string pixFmt = "-pix_fmt " + (isPng ? $"rgb24 {comprArg}" : "yuvj420p");
string args = $"-i {inputFile.Wrap()} -vf \"select=eq(n\\,{frameNum})\" -vframes 1 {pixFmt} {outputPath.Wrap()}";
@@ -331,7 +331,7 @@ namespace Flowframes.Media
if (IoUtils.IsPathDirectory(outputPath))
outputPath = Path.Combine(outputPath, "last.png");
bool isPng = (Path.GetExtension(outputPath).ToLowerInvariant() == ".png");
bool isPng = (Path.GetExtension(outputPath).Lower() == ".png");
string comprArg = isPng ? pngCompr : "";
string pixFmt = "-pix_fmt " + (isPng ? $"rgb24 {comprArg}" : "yuvj420p");
string sizeStr = (size.Width > 1 && size.Height > 1) ? $"-s {size.Width}x{size.Height}" : "";

View File

@@ -66,7 +66,7 @@ namespace Flowframes.Media
string title = await GetFfprobeInfoAsync(path, showStreams, "TAG:title", idx);
string codec = await GetFfprobeInfoAsync(path, showStreams, "codec_name", idx);
string codecLong = await GetFfprobeInfoAsync(path, showStreams, "codec_long_name", idx);
string pixFmt = (await GetFfprobeInfoAsync(path, showStreams, "pix_fmt", idx)).ToUpper();
string pixFmt = (await GetFfprobeInfoAsync(path, showStreams, "pix_fmt", idx)).Upper();
int kbits = (await GetFfprobeInfoAsync(path, showStreams, "bit_rate", idx)).GetInt() / 1024;
Size res = await GetMediaResolutionCached.GetSizeAsync(path);
Size sar = SizeFromString(await GetFfprobeInfoAsync(path, showStreams, "sample_aspect_ratio", idx));
@@ -87,7 +87,7 @@ namespace Flowframes.Media
string title = await GetFfprobeInfoAsync(path, showStreams, "TAG:title", idx);
string codec = await GetFfprobeInfoAsync(path, showStreams, "codec_name", idx);
string profile = await GetFfprobeInfoAsync(path, showStreams, "profile", idx);
if (codec.ToLowerInvariant() == "dts" && profile != "unknown") codec = profile;
if (codec.Lower() == "dts" && profile != "unknown") codec = profile;
string codecLong = await GetFfprobeInfoAsync(path, showStreams, "codec_long_name", idx);
int kbits = (await GetFfprobeInfoAsync(path, showStreams, "bit_rate", idx)).GetInt() / 1024;
int sampleRate = (await GetFfprobeInfoAsync(path, showStreams, "sample_rate", idx)).GetInt();
@@ -251,14 +251,14 @@ namespace Flowframes.Media
if (enc == Encoder.X264)
{
string preset = Config.Get(Config.Key.ffEncPreset).ToLowerInvariant().Remove(" "); // TODO: Replace this ugly stuff with enums
string preset = Config.Get(Config.Key.ffEncPreset).Lower().Remove(" "); // TODO: Replace this ugly stuff with enums
int crf = GetCrf(settings);
args.Add($"-crf {crf} -preset {preset}");
}
if (enc == Encoder.X265)
{
string preset = Config.Get(Config.Key.ffEncPreset).ToLowerInvariant().Remove(" "); // TODO: Replace this ugly stuff with enums
string preset = Config.Get(Config.Key.ffEncPreset).Lower().Remove(" "); // TODO: Replace this ugly stuff with enums
int crf = GetCrf(settings);
args.Add($"{(crf > 0 ? $"-crf {crf}" : "-x265-params lossless=1")} -preset {preset}");
}
@@ -403,7 +403,7 @@ namespace Flowframes.Media
static string GetVp9Speed()
{
string preset = Config.Get(Config.Key.ffEncPreset).ToLowerInvariant().Remove(" ");
string preset = Config.Get(Config.Key.ffEncPreset).Lower().Remove(" ");
string arg = "";
if (preset == "veryslow") arg = "0";
@@ -419,7 +419,7 @@ namespace Flowframes.Media
static string GetSvtAv1Speed()
{
string preset = Config.Get(Config.Key.ffEncPreset).ToLowerInvariant().Remove(" ");
string preset = Config.Get(Config.Key.ffEncPreset).Lower().Remove(" ");
string arg = "8";
if (preset == "veryslow") arg = "3";
@@ -549,10 +549,10 @@ namespace Flowframes.Media
{
containerExt = containerExt.Remove(".");
bool supported = (containerExt == "mp4" || containerExt == "mkv" || containerExt == "webm" || containerExt == "mov");
Logger.Log($"Subtitles {(supported ? "are supported" : "not supported")} by {containerExt.ToUpper()}", true);
Logger.Log($"Subtitles {(supported ? "are supported" : "not supported")} by {containerExt.Upper()}", true);
if (showWarningIfNotSupported && Config.GetBool(Config.Key.keepSubs) && !supported)
Logger.Log($"Warning: {containerExt.ToUpper()} exports do not include subtitles.");
Logger.Log($"Warning: {containerExt.Upper()} exports do not include subtitles.");
return supported;
}

View File

@@ -79,13 +79,13 @@ namespace Flowframes.Media
if (stripKeyName)
{
List<string> filtered = output.SplitIntoLines().Where(x => x.ToLowerInvariant().Contains(lineFilter.ToLowerInvariant())).ToList(); // Filter
List<string> filtered = output.SplitIntoLines().Where(x => x.Lower().Contains(lineFilter.Lower())).ToList(); // Filter
filtered = filtered.Select(x => string.Join("", x.Split('=').Skip(1))).ToList(); // Ignore everything before (and including) the first '=' sign
output = string.Join("\n", filtered);
}
else
{
output = string.Join("\n", output.SplitIntoLines().Where(x => x.ToLowerInvariant().Contains(lineFilter.ToLowerInvariant())).ToArray());
output = string.Join("\n", output.SplitIntoLines().Where(x => x.Lower().Contains(lineFilter.Lower())).ToArray());
}
}

View File

@@ -193,7 +193,7 @@ namespace Flowframes.MiscUtils
public static string CapsIfShort(string codec, int capsIfShorterThan = 5)
{
if (codec.Length < capsIfShorterThan)
return codec.ToUpper();
return codec.Upper();
else
return codec.ToTitleCase();
}

View File

@@ -140,8 +140,8 @@ namespace Flowframes.Os
{
if (AvProcess.lastAvProcess != null && !AvProcess.lastAvProcess.HasExited)
{
if (Logger.LastLogLine.ToLowerInvariant().Contains("frame: "))
Logger.Log(FormatUtils.BeautifyFfmpegStats(Logger.LastLogLine), false, Logger.LastUiLine.ToLowerInvariant().Contains("frame"));
if (Logger.LastLogLine.Lower().Contains("frame: "))
Logger.Log(FormatUtils.BeautifyFfmpegStats(Logger.LastLogLine), false, Logger.LastUiLine.Lower().Contains("frame"));
}
if (AvProcess.lastAvProcess.HasExited && !AutoEncode.HasWorkToDo()) // Stop logging if ffmpeg is not running & AE is done
@@ -326,7 +326,7 @@ namespace Flowframes.Os
string ttaStr = Config.GetBool(Config.Key.rifeNcnnUseTta, false) ? "-x" : "";
rifeNcnn.StartInfo.Arguments = $"{OsUtils.GetCmdArg()} cd /D {Path.Combine(Paths.GetPkgPath(), Implementations.rifeNcnn.PkgDir).Wrap()} & rife-ncnn-vulkan.exe " +
$" -v -i {inPath.Wrap()} -o {outPath.Wrap()} {frames} -m {mdl.ToLowerInvariant()} {ttaStr} {uhdStr} -g {Config.Get(Config.Key.ncnnGpus)} -f {NcnnUtils.GetNcnnPattern()} -j {NcnnUtils.GetNcnnThreads(Implementations.rifeNcnn)}";
$" -v -i {inPath.Wrap()} -o {outPath.Wrap()} {frames} -m {mdl.Lower()} {ttaStr} {uhdStr} -g {Config.Get(Config.Key.ncnnGpus)} -f {NcnnUtils.GetNcnnPattern()} -j {NcnnUtils.GetNcnnThreads(Implementations.rifeNcnn)}";
Logger.Log("cmd.exe " + rifeNcnn.StartInfo.Arguments, true);
@@ -458,7 +458,7 @@ namespace Flowframes.Os
SetProgressCheck(outPath, factor);
int targetFrames = ((IoUtils.GetAmountOfFiles(lastInPath, false, "*.*") * factor).RoundToInt());
string args = $" -v -i {framesPath.Wrap()} -o {outPath.Wrap()} -n {targetFrames} -m {mdl.ToLowerInvariant()}" +
string args = $" -v -i {framesPath.Wrap()} -o {outPath.Wrap()} -n {targetFrames} -m {mdl.Lower()}" +
$" -t {NcnnUtils.GetNcnnTilesize(tilesize)} -g {Config.Get(Config.Key.ncnnGpus)} -f {NcnnUtils.GetNcnnPattern()} -j 2:1:2";
dain.StartInfo.Arguments = $"{OsUtils.GetCmdArg()} cd /D {dainDir.Wrap()} & dain-ncnn-vulkan.exe {args}";
@@ -620,26 +620,26 @@ namespace Flowframes.Os
if (line.Contains("ff:nocuda-cpu"))
Logger.Log("WARNING: CUDA-capable GPU device is not available, running on CPU instead!");
if (!hasShownError && err && line.ToLowerInvariant().Contains("modulenotfounderror"))
if (!hasShownError && err && line.Lower().Contains("modulenotfounderror"))
{
hasShownError = true;
UiUtils.ShowMessageBox($"A python module is missing.\nCheck {ai.LogFilename} for details.\n\n{line}", UiUtils.MessageType.Error);
}
if (!hasShownError && line.ToLowerInvariant().Contains("no longer supports this gpu"))
if (!hasShownError && line.Lower().Contains("no longer supports this gpu"))
{
hasShownError = true;
UiUtils.ShowMessageBox($"Your GPU seems to be outdated and is not supported!\n\n{line}", UiUtils.MessageType.Error);
}
if (!hasShownError && line.ToLowerInvariant().Contains("error(s) in loading state_dict"))
if (!hasShownError && line.Lower().Contains("error(s) in loading state_dict"))
{
hasShownError = true;
string msg = (Interpolate.currentSettings.ai.NameInternal == Implementations.flavrCuda.NameInternal) ? "\n\nFor FLAVR, you need to select the correct model for each scale!" : "";
UiUtils.ShowMessageBox($"Error loading the AI model!\n\n{line}{msg}", UiUtils.MessageType.Error);
}
if (!hasShownError && line.ToLowerInvariant().Contains("unicodeencodeerror"))
if (!hasShownError && line.Lower().Contains("unicodeencodeerror"))
{
hasShownError = true;
UiUtils.ShowMessageBox($"It looks like your path contains invalid characters - remove them and try again!\n\n{line}", UiUtils.MessageType.Error);
@@ -683,32 +683,32 @@ namespace Flowframes.Os
if (ai.Piped) // VS specific
{
if (!hasShownError && Interpolate.currentSettings.outSettings.Format != Enums.Output.Format.Realtime && line.ToLowerInvariant().Contains("fwrite() call failed"))
if (!hasShownError && Interpolate.currentSettings.outSettings.Format != Enums.Output.Format.Realtime && line.Lower().Contains("fwrite() call failed"))
{
hasShownError = true;
UiUtils.ShowMessageBox($"VapourSynth interpolation failed with an unknown error. Check the log for details:\n\n{lastLogLines}", UiUtils.MessageType.Error);
}
if (!hasShownError && line.ToLowerInvariant().Contains("allocate memory failed"))
if (!hasShownError && line.Lower().Contains("allocate memory failed"))
{
hasShownError = true;
UiUtils.ShowMessageBox($"Out of memory!\nTry reducing your RAM usage by closing some programs.\n\n{line}", UiUtils.MessageType.Error);
}
if (!hasShownError && line.ToLowerInvariant().Contains("vapoursynth.error:"))
if (!hasShownError && line.Lower().Contains("vapoursynth.error:"))
{
hasShownError = true;
UiUtils.ShowMessageBox($"VapourSynth Error:\n\n{line}", UiUtils.MessageType.Error);
}
}
if (!hasShownError && err && line.ToLowerInvariant().Contains("out of memory"))
if (!hasShownError && err && line.Lower().Contains("out of memory"))
{
hasShownError = true;
UiUtils.ShowMessageBox($"Your GPU ran out of VRAM! Please try a video with a lower resolution or use the Max Video Size option in the settings.\n\n{line}", UiUtils.MessageType.Error);
}
if (!hasShownError && line.ToLowerInvariant().Contains("illegal memory access"))
if (!hasShownError && line.Lower().Contains("illegal memory access"))
{
hasShownError = true;
UiUtils.ShowMessageBox($"Your GPU appears to be unstable! If you have an overclock enabled, please disable it!\n\n{line}", UiUtils.MessageType.Error);

View File

@@ -148,10 +148,10 @@ namespace Flowframes.Os
var detectedDrives = Detector.DetectFixedDrives(QueryType.SeekPenalty);
if (detectedDrives.Count != 0)
{
char pathDriveLetter = (path[0].ToString().ToUpper())[0];
char pathDriveLetter = (path[0].ToString().Upper())[0];
foreach (var detectedDrive in detectedDrives)
{
if (detectedDrive.DriveLetter == pathDriveLetter && detectedDrive.HardwareType.ToString().ToLowerInvariant().Trim() == "ssd")
if (detectedDrive.DriveLetter == pathDriveLetter && detectedDrive.HardwareType.ToString().Lower().Trim() == "ssd")
return true;
}
}

View File

@@ -160,7 +160,7 @@ namespace Flowframes.Os
Logger.Log("Checking if system Python is available...", true);
string sysPyVer = GetSysPyVersion();
if (!string.IsNullOrWhiteSpace(sysPyVer) && !sysPyVer.ToLowerInvariant().Contains("not found") && sysPyVer.Length <= 35)
if (!string.IsNullOrWhiteSpace(sysPyVer) && !sysPyVer.Lower().Contains("not found") && sysPyVer.Length <= 35)
{
isInstalled = true;
Logger.Log("Using Python installation: " + sysPyVer, true);

View File

@@ -22,7 +22,7 @@ namespace Flowframes.Os
string[] osInfo = osInfoStr.Split(" | ");
string version = osInfo[0].Remove("Microsoft").Trim();
return (version.ToLowerInvariant().Contains("windows 10") || version.ToLowerInvariant().Contains("windows 11"));
return (version.Lower().Contains("windows 10") || version.Lower().Contains("windows 11"));
}
static bool Is32Bit()
@@ -39,7 +39,7 @@ namespace Flowframes.Os
public static void CheckOs()
{
if (!File.Exists(Paths.GetVerPath()) && Paths.GetExeDir().ToLowerInvariant().Contains("temp"))
if (!File.Exists(Paths.GetVerPath()) && Paths.GetExeDir().Lower().Contains("temp"))
{
UiUtils.ShowMessageBox("You seem to be running Flowframes out of an archive.\nPlease extract the whole archive first!", UiUtils.MessageType.Error);
IoUtils.TryDeleteIfExists(Paths.GetDataPath());
@@ -58,7 +58,7 @@ namespace Flowframes.Os
if (string.IsNullOrWhiteSpace(version))
return;
if (!version.ToLowerInvariant().Contains("windows 10") && !version.ToLowerInvariant().Contains("windows 11") && !Config.GetBool("ignoreIncompatibleOs", false))
if (!version.Lower().Contains("windows 10") && !version.Lower().Contains("windows 11") && !Config.GetBool("ignoreIncompatibleOs", false))
{
UiUtils.ShowMessageBox($"This application was made for Windows 10/11 and is not officially compatible with {version}.\n\n" +
$"Use it at your own risk and do NOT ask for support as long as your are on {version}.", UiUtils.MessageType.Warning);

View File

@@ -66,7 +66,7 @@ namespace Flowframes
Task.Run(() => DiskSpaceCheckLoop());
fileArgs = Environment.GetCommandLineArgs().Where(a => a[0] != '-' && File.Exists(a)).ToList().Skip(1).ToArray();
args = Environment.GetCommandLineArgs().Where(a => a[0] == '-').Select(x => x.Trim().Substring(1).ToLowerInvariant()).ToArray();
args = Environment.GetCommandLineArgs().Where(a => a[0] == '-').Select(x => x.Trim().Substring(1).Lower()).ToArray();
Logger.Log($"Command Line: {Environment.CommandLine}", true);
Logger.Log($"Files: {(fileArgs.Length > 0 ? string.Join(", ", fileArgs) : "None")}", true);
Logger.Log($"Args: {(args.Length > 0 ? string.Join(", ", args) : "None")}", true);

View File

@@ -54,7 +54,7 @@ namespace Flowframes.Ui
public static void ToggleMonospace(TextBox logBox)
{
bool isMonospace = logBox.Font.Name.ToLowerInvariant().Contains("consolas");
bool isMonospace = logBox.Font.Name.Lower().Contains("consolas");
if (isMonospace)
logBox.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.5f);

View File

@@ -74,7 +74,7 @@ namespace Flowframes.Ui
{
for (int i = 0; i < combox.Items.Count; i++)
{
if (((string)combox.Items[i]).ToUpper().Contains("NCNN"))
if (((string)combox.Items[i]).Upper().Contains("NCNN"))
combox.SelectedIndex = i;
}
}

View File

@@ -15,7 +15,7 @@ namespace Flowframes.Utilities
{
public static int GetColorPrimaries(string s) // Defined by the "Color primaries" section of ISO/IEC 23091-4/ITU-T H.273
{
s = s.Trim().ToLowerInvariant();
s = s.Trim().Lower();
if (s == "bt709") return 1;
if (s == "bt470m") return 4;
if (s == "bt470bg") return 5;
@@ -31,7 +31,7 @@ namespace Flowframes.Utilities
public static int GetColorTransfer(string s) // Defined by the "Transfer characteristics" section of ISO/IEC 23091-4/ITU-T H.273
{
s = s.Trim().ToLowerInvariant();
s = s.Trim().Lower();
if (s == "bt709") return 1;
if (s == "gamma22" || s == "bt470m") return 4;
if (s == "gamma28" || s == "bt470bg") return 5; // BT.470 System B, G (historical)
@@ -53,7 +53,7 @@ namespace Flowframes.Utilities
public static int GetMatrixCoeffs(string s) // Defined by the "Matrix coefficients" section of ISO/IEC 23091-4/ITU-T H.27
{
s = s.Trim().ToLowerInvariant();
s = s.Trim().Lower();
if (s == "bt709") return 1;
if (s == "fcc") return 4; // US FCC 73.628
if (s == "bt470bg") return 5; // BT.470 System B, G (historical)
@@ -71,7 +71,7 @@ namespace Flowframes.Utilities
public static int GetColorRange(string s) // Defined by the "Matrix coefficients" section of ISO/IEC 23091-4/ITU-T H.27
{
s = s.Trim().ToLowerInvariant();
s = s.Trim().Lower();
if (s == "tv") return 1; // TV
if (s == "pc") return 2; // PC/Full
return 0; // Fallback: Unspecified

View File

@@ -6,76 +6,28 @@
"isDefault": "false",
"fixedFactors": [2]
},
{
"name": "RIFE 4.0",
"desc": "v4 General Model",
"dir": "rife-v4",
"isDefault": "false"
},
{
"name": "RIFE 4.3",
"desc": "v4 General Model",
"dir": "rife-v4.3",
"isDefault": "false"
},
{
"name": "RIFE 4.4",
"desc": "v4 General Model",
"dir": "rife-v4.4",
"isDefault": "false"
},
{
"name": "RIFE 4.6",
"desc": "v4 General Model",
"dir": "rife-v4.6",
"isDefault": "false"
},
{
"name": "RIFE 4.7",
"desc": "v4 General Model",
"dir": "rife-v4.7",
"isDefault": "false"
},
{
"name": "RIFE 4.8",
"desc": "v4 General Model",
"dir": "rife-v4.8",
"isDefault": "false"
},
{
"name": "RIFE 4.9",
"desc": "v4 General Model",
"dir": "rife-v4.9",
"isDefault": "false"
},
{
"name": "RIFE 4.10",
"desc": "v4 General Model",
"dir": "rife-v4.10",
"isDefault": "false"
},
{
"name": "RIFE 4.11",
"desc": "v4 General Model",
"dir": "rife-v4.11",
"isDefault": "false"
},
{
"name": "RIFE 4.12",
"desc": "v4 General Model",
"dir": "rife-v4.12",
"isDefault": "false"
},
{
"name": "RIFE 4.12 Lite",
"desc": "Small v4 General Model",
"dir": "rife-v4.12_lite",
"isDefault": "false"
},
{
"name": "RIFE 4.13",
"desc": "v4 General Model",
"dir": "rife-v4.13",
"isDefault": "false"
},
{
"name": "RIFE 4.18",
"desc": "v4 Model - Recommended for real-world video",
"dir": "rife-v4.18",
"isDefault": "false"
},
{
"name": "RIFE 4.22",
"desc": "v4 Model - Recommended for anime video",
"dir": "rife-v4.22",
"isDefault": "true"
},
]

View File

@@ -6,76 +6,28 @@
"isDefault": "false",
"fixedFactors": [2]
},
{
"name": "RIFE 4.0",
"desc": "v4 General Model",
"dir": "rife-v4",
"isDefault": "false"
},
{
"name": "RIFE 4.3",
"desc": "v4 General Model",
"dir": "rife-v4.3",
"isDefault": "false"
},
{
"name": "RIFE 4.4",
"desc": "v4 General Model",
"dir": "rife-v4.4",
"isDefault": "false"
},
{
"name": "RIFE 4.6",
"desc": "v4 General Model",
"dir": "rife-v4.6",
"isDefault": "false"
},
{
"name": "RIFE 4.7",
"desc": "v4 General Model",
"dir": "rife-v4.7",
"isDefault": "false"
},
{
"name": "RIFE 4.8",
"desc": "v4 General Model",
"dir": "rife-v4.8",
"isDefault": "false"
},
{
"name": "RIFE 4.9",
"desc": "v4 General Model",
"dir": "rife-v4.9",
"isDefault": "false"
},
{
"name": "RIFE 4.10",
"desc": "v4 General Model",
"dir": "rife-v4.10",
"isDefault": "false"
},
{
"name": "RIFE 4.11",
"desc": "v4 General Model",
"dir": "rife-v4.11",
"isDefault": "false"
},
{
"name": "RIFE 4.12",
"desc": "v4 General Model",
"dir": "rife-v4.12",
"isDefault": "false"
},
{
"name": "RIFE 4.12 Lite",
"desc": "Small v4 General Model",
"dir": "rife-v4.12_lite",
"isDefault": "false"
},
{
"name": "RIFE 4.13",
"desc": "v4 General Model",
"dir": "rife-v4.13",
"isDefault": "false"
},
{
"name": "RIFE 4.18",
"desc": "v4 Model - Recommended for real-world video",
"dir": "rife-v4.18",
"isDefault": "false"
},
{
"name": "RIFE 4.22",
"desc": "v4 Model - Recommended for anime video",
"dir": "rife-v4.22",
"isDefault": "true"
},
]