Always use ToLowerInvariant

This commit is contained in:
n00mkrad
2022-10-14 09:00:47 +02:00
parent 292ccbdf0d
commit 8524d2b964
21 changed files with 62 additions and 62 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("_", "-").ToLower(); } }
public string PkgDir { get { return NameInternal.Replace("_", "-").ToLowerInvariant(); } }
public enum InterpFactorSupport { Fixed, AnyPowerOfTwo, AnyInteger, AnyFloat }
public InterpFactorSupport FactorSupport { get; set; } = InterpFactorSupport.Fixed;
public int[] SupportedFactors { get; set; } = new int[0];

View File

@@ -186,7 +186,7 @@ namespace Flowframes
bool gif = outMode == Interpolate.OutMode.VidGif;
bool proResAlpha = outMode == Interpolate.OutMode.VidProRes && Config.GetInt(Config.Key.proResProfile) > 3;
bool outputSupportsAlpha = png || gif || proResAlpha;
string ext = inputIsFrames ? Path.GetExtension(IoUtils.GetFilesSorted(inPath).First()).ToLower() : Path.GetExtension(inPath).ToLower();
string ext = inputIsFrames ? Path.GetExtension(IoUtils.GetFilesSorted(inPath).First()).ToLowerInvariant() : Path.GetExtension(inPath).ToLowerInvariant();
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

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

View File

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

View File

@@ -150,7 +150,7 @@ namespace Flowframes
{
foreach (TabPage tab in mainTabControl.TabPages)
{
if (tab.Text.ToLower() == tabName.ToLower())
if (tab.Text.ToLowerInvariant() == tabName.ToLowerInvariant())
mainTabControl.SelectedTab = tab;
}
@@ -362,13 +362,13 @@ namespace Flowframes
Interpolate.OutMode GetOutMode()
{
Interpolate.OutMode outMode = Interpolate.OutMode.VidMp4;
if (outModeCombox.Text.ToLower().Contains("mkv")) outMode = Interpolate.OutMode.VidMkv;
if (outModeCombox.Text.ToLower().Contains("webm")) outMode = Interpolate.OutMode.VidWebm;
if (outModeCombox.Text.ToLower().Contains("prores")) outMode = Interpolate.OutMode.VidProRes;
if (outModeCombox.Text.ToLower().Contains("avi")) outMode = Interpolate.OutMode.VidAvi;
if (outModeCombox.Text.ToLower().Contains("gif")) outMode = Interpolate.OutMode.VidGif;
if (outModeCombox.Text.ToLower().Contains("image")) outMode = Interpolate.OutMode.ImgPng;
if (outModeCombox.Text.ToLower().Contains("real")) outMode = Interpolate.OutMode.Realtime;
if (outModeCombox.Text.ToLowerInvariant().Contains("mkv")) outMode = Interpolate.OutMode.VidMkv;
if (outModeCombox.Text.ToLowerInvariant().Contains("webm")) outMode = Interpolate.OutMode.VidWebm;
if (outModeCombox.Text.ToLowerInvariant().Contains("prores")) outMode = Interpolate.OutMode.VidProRes;
if (outModeCombox.Text.ToLowerInvariant().Contains("avi")) outMode = Interpolate.OutMode.VidAvi;
if (outModeCombox.Text.ToLowerInvariant().Contains("gif")) outMode = Interpolate.OutMode.VidGif;
if (outModeCombox.Text.ToLowerInvariant().Contains("image")) outMode = Interpolate.OutMode.ImgPng;
if (outModeCombox.Text.ToLowerInvariant().Contains("real")) outMode = Interpolate.OutMode.Realtime;
return outMode;
}
@@ -378,7 +378,7 @@ namespace Flowframes
for (int i = 0; i < outModeCombox.Items.Count; i++)
{
string currentItem = outModeCombox.Items[i].ToString().ToLower();
string currentItem = outModeCombox.Items[i].ToString().ToLowerInvariant();
if (mode == Interpolate.OutMode.VidMkv && currentItem.Contains("mkv")) targetIndex = i;
if (mode == Interpolate.OutMode.VidWebm && currentItem.Contains("webm")) targetIndex = i;
if (mode == Interpolate.OutMode.VidProRes && currentItem.Contains("prores")) targetIndex = i;

View File

@@ -315,7 +315,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).ToLower());
bool preferFfmpegReadout = preferFfmpegReadoutFormats.Contains(Path.GetExtension(path).ToLowerInvariant());
Fraction fps = new Fraction();

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.ToLower(), relPath);
return Path.Combine(baseUrl, ai.ToLowerInvariant(), relPath);
}
static string GetMdlFileUrl(string ai, string model, string relPath)

View File

@@ -54,7 +54,7 @@ namespace Flowframes.Main
{
UpdateChunkAndBufferSizes();
bool imgSeq = Interpolate.currentSettings.outMode.ToString().ToLower().StartsWith("img");
bool imgSeq = Interpolate.currentSettings.outMode.ToString().ToLowerInvariant().StartsWith("img");
interpFramesFolder = interpFramesPath;
videoChunksFolder = Path.Combine(interpFramesPath.GetParentDir(), Paths.chunksDir);

View File

@@ -30,7 +30,7 @@ namespace Flowframes.Main
await Blend.BlendSceneChanges(frameFile);
}
if (!mode.ToString().ToLower().Contains("vid")) // Copy interp frames out of temp folder and skip video export for image seq export
if (!mode.ToString().ToLowerInvariant().Contains("vid")) // Copy interp frames out of temp folder and skip video export for image seq export
{
try
{
@@ -139,7 +139,7 @@ namespace Flowframes.Main
static int GetImgSeqQ (string format)
{
if(format.ToLower() == "jpg" || format.ToLower() == "jpeg")
if(format.ToLowerInvariant() == "jpg" || format.ToLowerInvariant() == "jpeg")
{
switch (Config.GetInt(Config.Key.imgSeqQuality))
{
@@ -151,7 +151,7 @@ namespace Flowframes.Main
}
}
if (format.ToLower() == "webp")
if (format.ToLowerInvariant() == "webp")
{
switch (Config.GetInt(Config.Key.imgSeqQuality))
{
@@ -307,7 +307,7 @@ namespace Flowframes.Main
bool dontEncodeFullFpsVid = fpsLimit && Config.GetInt(Config.Key.maxFpsMode) == 0;
if (mode.ToString().ToLower().StartsWith("img")) // Image Sequence output mode, not video
if (mode.ToString().ToLowerInvariant().StartsWith("img")) // Image Sequence output mode, not video
{
string desiredFormat = Config.Get(Config.Key.imgSeqFormat);
string availableFormat = Path.GetExtension(IoUtils.GetFilesSorted(interpDir)[0]).Remove(".").ToUpper();

View File

@@ -229,14 +229,14 @@ namespace Flowframes.Main
float maxFps = Config.GetFloat(Config.Key.maxFps);
float encodeFps = maxFps > 0 ? interpFps.Clamp(0, maxFps) : interpFps;
if (enc.ToLower().Contains("av1") && encodeFps > maxAv1Fps)
if (enc.ToLowerInvariant().Contains("av1") && encodeFps > maxAv1Fps)
{
UiUtils.ShowMessageBox($"The selected encoder only supports up to {maxAv1Fps} FPS!\nPlease use a different encoder or reduce the interpolation factor.", UiUtils.MessageType.Error);
I.Cancel();
return false;
}
if (enc.ToLower().Contains("nvenc") && !(await FfmpegCommands.IsEncoderCompatible(enc)))
if (enc.ToLowerInvariant().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

@@ -224,7 +224,7 @@ namespace Flowframes
try
{
string[] lines = info.SplitIntoLines();
string lastLine = lines.Last().ToLower();
string lastLine = lines.Last().ToLowerInvariant();
return lastLine.Substring(0, lastLine.IndexOf("fps")).GetInt();
}
catch
@@ -245,7 +245,7 @@ namespace Flowframes
Logger.Log($"IsEncoderCompatible('{enc}')", true, false, "ffmpeg");
string args = $"-loglevel error -f lavfi -i color=black:s=540x540 -vframes 1 -an -c:v {enc} -f null -";
string output = await RunFfmpeg(args, LogMode.Hidden);
return !output.ToLower().Contains("error");
return !output.ToLowerInvariant().Contains("error");
}
public static string GetAudioCodec(string path, int streamIndex = -1)

View File

@@ -84,7 +84,7 @@ namespace Flowframes.Media
Directory.CreateDirectory(outDir);
string inArg = $"-f concat -i {Path.GetFileName(framesFile)}";
string linksDir = Path.Combine(framesFile + Paths.symlinksSuffix);
format = format.ToLower();
format = format.ToLowerInvariant();
if (Config.GetBool(Config.Key.allowSymlinkEncoding, true) && Symlinks.SymlinksAllowed())
{

View File

@@ -44,7 +44,7 @@ namespace Flowframes.Media
static string GetImgArgs(string extension, bool includePixFmt = true, bool alpha = false)
{
extension = extension.ToLower().Remove(".").Replace("jpeg", "jpg");
extension = extension.ToLowerInvariant().Remove(".").Replace("jpeg", "jpg");
string pixFmt = "-pix_fmt rgb24";
string args = "";
@@ -278,7 +278,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).ToLower() == ".png");
bool isPng = (Path.GetExtension(outPath).ToLowerInvariant() == ".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()}";
@@ -287,7 +287,7 @@ namespace Flowframes.Media
public static async Task ExtractSingleFrame(string inputFile, string outputPath, int frameNum)
{
bool isPng = (Path.GetExtension(outputPath).ToLower() == ".png");
bool isPng = (Path.GetExtension(outputPath).ToLowerInvariant() == ".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()}";
@@ -302,7 +302,7 @@ namespace Flowframes.Media
if (IoUtils.IsPathDirectory(outputPath))
outputPath = Path.Combine(outputPath, "last.png");
bool isPng = (Path.GetExtension(outputPath).ToLower() == ".png");
bool isPng = (Path.GetExtension(outputPath).ToLowerInvariant() == ".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

@@ -75,7 +75,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.ToLower() == "dts" && profile != "unknown") codec = profile;
if (codec.ToLowerInvariant() == "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();
@@ -223,14 +223,14 @@ namespace Flowframes.Media
if (codec == Codec.H264)
{
string preset = Config.Get(Config.Key.ffEncPreset).ToLower().Remove(" ");
string preset = Config.Get(Config.Key.ffEncPreset).ToLowerInvariant().Remove(" ");
string g = GetKeyIntArg(fps, keyint);
return new string[] { $"-c:v {GetEnc(codec)} -crf {Config.GetInt(Config.Key.h264Crf)} -preset {preset} {g} -pix_fmt {GetPixFmt()}" };
}
if (codec == Codec.H265)
{
string preset = Config.Get(Config.Key.ffEncPreset).ToLower().Remove(" ");
string preset = Config.Get(Config.Key.ffEncPreset).ToLowerInvariant().Remove(" ");
int crf = Config.GetInt(Config.Key.h265Crf);
string g = GetKeyIntArg(fps, keyint);
return new string[] { $"-c:v {GetEnc(codec)} {(crf > 0 ? $"-crf {crf}" : "-x265-params lossless=1")} -preset {preset} {g} -pix_fmt {GetPixFmt()}" };
@@ -318,7 +318,7 @@ namespace Flowframes.Media
static string GetVp9Speed()
{
string preset = Config.Get(Config.Key.ffEncPreset).ToLower().Remove(" ");
string preset = Config.Get(Config.Key.ffEncPreset).ToLowerInvariant().Remove(" ");
string arg = "";
if (preset == "veryslow") arg = "0";
@@ -334,7 +334,7 @@ namespace Flowframes.Media
static string GetSvtAv1Speed()
{
string preset = Config.Get(Config.Key.ffEncPreset).ToLower().Remove(" ");
string preset = Config.Get(Config.Key.ffEncPreset).ToLowerInvariant().Remove(" ");
string arg = "8";
if (preset == "veryslow") arg = "3";
@@ -499,12 +499,12 @@ namespace Flowframes.Media
if (validExtensions == null)
validExtensions = new List<string>();
validExtensions = validExtensions.Select(x => x.Remove(".").ToLower()).ToList(); // Ignore "." in extensions
validExtensions = validExtensions.Select(x => x.Remove(".").ToLowerInvariant()).ToList(); // Ignore "." in extensions
string concatFileContent = "";
string[] files = IoUtils.GetFilesSorted(inputFilesDir);
int fileCount = 0;
foreach (string file in files.Where(x => validExtensions.Contains(Path.GetExtension(x).Replace(".", "").ToLower())))
foreach (string file in files.Where(x => validExtensions.Contains(Path.GetExtension(x).Replace(".", "").ToLowerInvariant())))
{
fileCount++;
concatFileContent += $"file '{file.Replace(@"\", "/")}'\n";

View File

@@ -79,13 +79,13 @@ namespace Flowframes.Media
if (stripKeyName)
{
List<string> filtered = output.SplitIntoLines().Where(x => x.ToLower().Contains(lineFilter.ToLower())).ToList(); // Filter
List<string> filtered = output.SplitIntoLines().Where(x => x.ToLowerInvariant().Contains(lineFilter.ToLowerInvariant())).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.ToLower().Contains(lineFilter.ToLower())).ToArray());
output = string.Join("\n", output.SplitIntoLines().Where(x => x.ToLowerInvariant().Contains(lineFilter.ToLowerInvariant())).ToArray());
}
}

View File

@@ -130,8 +130,8 @@ namespace Flowframes.Os
{
if (AvProcess.lastAvProcess != null && !AvProcess.lastAvProcess.HasExited)
{
if (Logger.LastLogLine.ToLower().Contains("frame: "))
Logger.Log(FormatUtils.BeautifyFfmpegStats(Logger.LastLogLine), false, Logger.LastUiLine.ToLower().Contains("frame"));
if (Logger.LastLogLine.ToLowerInvariant().Contains("frame: "))
Logger.Log(FormatUtils.BeautifyFfmpegStats(Logger.LastLogLine), false, Logger.LastUiLine.ToLowerInvariant().Contains("frame"));
}
if (AvProcess.lastAvProcess.HasExited && !AutoEncode.HasWorkToDo()) // Stop logging if ffmpeg is not running & AE is done
@@ -316,7 +316,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.ToLower()} {ttaStr} {uhdStr} -g {Config.Get(Config.Key.ncnnGpus)} -f {NcnnUtils.GetNcnnPattern()} -j {NcnnUtils.GetNcnnThreads()}";
$" -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()}";
Logger.Log("cmd.exe " + rifeNcnn.StartInfo.Arguments, true);
@@ -453,7 +453,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.ToLower()}" +
string args = $" -v -i {framesPath.Wrap()} -o {outPath.Wrap()} -n {targetFrames} -m {mdl.ToLowerInvariant()}" +
$" -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}";
@@ -615,26 +615,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.ToLower().Contains("modulenotfounderror"))
if (!hasShownError && err && line.ToLowerInvariant().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.ToLower().Contains("no longer supports this gpu"))
if (!hasShownError && line.ToLowerInvariant().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.ToLower().Contains("error(s) in loading state_dict"))
if (!hasShownError && line.ToLowerInvariant().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.ToLower().Contains("unicodeencodeerror"))
if (!hasShownError && line.ToLowerInvariant().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);
@@ -678,32 +678,32 @@ namespace Flowframes.Os
if (ai.Piped) // VS specific
{
if (!hasShownError && Interpolate.currentSettings.outMode != Interpolate.OutMode.Realtime && line.ToLower().Contains("fwrite() call failed"))
if (!hasShownError && Interpolate.currentSettings.outMode != Interpolate.OutMode.Realtime && line.ToLowerInvariant().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.ToLower().Contains("allocate memory failed"))
if (!hasShownError && line.ToLowerInvariant().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.ToLower().Contains("vapoursynth.error:"))
if (!hasShownError && line.ToLowerInvariant().Contains("vapoursynth.error:"))
{
hasShownError = true;
UiUtils.ShowMessageBox($"VapourSynth Error:\n\n{line}", UiUtils.MessageType.Error);
}
}
if (!hasShownError && err && line.ToLower().Contains("out of memory"))
if (!hasShownError && err && line.ToLowerInvariant().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.ToLower().Contains("illegal memory access"))
if (!hasShownError && line.ToLowerInvariant().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

@@ -150,7 +150,7 @@ namespace Flowframes.Os
char pathDriveLetter = (path[0].ToString().ToUpper())[0];
foreach (var detectedDrive in detectedDrives)
{
if (detectedDrive.DriveLetter == pathDriveLetter && detectedDrive.HardwareType.ToString().ToLower().Trim() == "ssd")
if (detectedDrive.DriveLetter == pathDriveLetter && detectedDrive.HardwareType.ToString().ToLowerInvariant().Trim() == "ssd")
return true;
}
}
@@ -296,7 +296,7 @@ namespace Flowframes.Os
{
string gpuName = property.Value.ToString();
if (!gpuName.ToLower().Contains("microsoft")) // To ignore pseudo-GPUs like on vServers, RDP sessions, etc. (e.g. "Microsoft Basic Display Adapter")
if (!gpuName.ToLowerInvariant().Contains("microsoft")) // To ignore pseudo-GPUs like on vServers, RDP sessions, etc. (e.g. "Microsoft Basic Display Adapter")
{
gpus.Add(gpuName);
Logger.Log($"[GetGpus] Found GPU: {property.Value}", true);

View File

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

View File

@@ -21,7 +21,7 @@ namespace Flowframes.Os
string[] osInfo = osInfoStr.Split(" | ");
string version = osInfo[0].Remove("Microsoft").Trim();
return (version.ToLower().Contains("windows 10") || version.ToLower().Contains("windows 11"));
return (version.ToLowerInvariant().Contains("windows 10") || version.ToLowerInvariant().Contains("windows 11"));
}
static bool Is32Bit()
@@ -38,7 +38,7 @@ namespace Flowframes.Os
public static void CheckOs()
{
if (!File.Exists(Paths.GetVerPath()) && Paths.GetExeDir().ToLower().Contains("temp"))
if (!File.Exists(Paths.GetVerPath()) && Paths.GetExeDir().ToLowerInvariant().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());
@@ -57,7 +57,7 @@ namespace Flowframes.Os
if (string.IsNullOrWhiteSpace(version))
return;
if (!version.ToLower().Contains("windows 10") && !version.ToLower().Contains("windows 11") && !Config.GetBool("ignoreIncompatibleOs", false))
if (!version.ToLowerInvariant().Contains("windows 10") && !version.ToLowerInvariant().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

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

View File

@@ -196,7 +196,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().ToLower();
s = s.Trim().ToLowerInvariant();
if (s == "bt709") return 1;
if (s == "bt470m") return 4;
if (s == "bt470bg") return 5;
@@ -212,7 +212,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().ToLower();
s = s.Trim().ToLowerInvariant();
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)
@@ -234,7 +234,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().ToLower();
s = s.Trim().ToLowerInvariant();
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)
@@ -252,7 +252,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().ToLower();
s = s.Trim().ToLowerInvariant();
if (s == "tv") return 1; // TV
if (s == "pc") return 2; // PC/Full
return 0; // Fallback: Unspecified