From b9029cb5f4882d91ed9f57dc39191ffec3441129 Mon Sep 17 00:00:00 2001 From: N00MKRAD <61149547+n00mkrad@users.noreply.github.com> Date: Tue, 26 Nov 2024 12:14:44 +0100 Subject: [PATCH] Remove ToStringDot, no longer needed with forced CultureInfo --- CodeLegacy/Data/Paths.cs | 2 +- CodeLegacy/Extensions/ExtensionMethods.cs | 8 -------- CodeLegacy/IO/Config.cs | 4 ++-- CodeLegacy/IO/IoUtils.cs | 4 ++-- CodeLegacy/Media/FfmpegUtils.cs | 6 +++--- CodeLegacy/Os/AiProcess.cs | 2 +- 6 files changed, 9 insertions(+), 17 deletions(-) diff --git a/CodeLegacy/Data/Paths.cs b/CodeLegacy/Data/Paths.cs index c1dfeb88..25c1cf6c 100644 --- a/CodeLegacy/Data/Paths.cs +++ b/CodeLegacy/Data/Paths.cs @@ -35,7 +35,7 @@ public static void Init() public static string GetFrameOrderFilename(float factor) { - return $"{frameOrderPrefix}-{factor.ToStringDot()}x.ini"; + return $"{frameOrderPrefix}-{factor.ToString()}x.ini"; } public static string GetFrameOrderFilenameChunk (int from, int to) diff --git a/CodeLegacy/Extensions/ExtensionMethods.cs b/CodeLegacy/Extensions/ExtensionMethods.cs index 8c02cd4c..c6283e34 100644 --- a/CodeLegacy/Extensions/ExtensionMethods.cs +++ b/CodeLegacy/Extensions/ExtensionMethods.cs @@ -239,14 +239,6 @@ public static string FilenameSuffix(this string path, string suffix) return filename + suffix + ext; } - public static string ToStringDot(this float f, string format = "") - { - if (string.IsNullOrWhiteSpace(format)) - return f.ToString().Replace(",", "."); - else - return f.ToString(format).Replace(",", "."); - } - public static string[] Split(this string str, string trimStr) { return str?.Split(new string[] { trimStr }, StringSplitOptions.None); diff --git a/CodeLegacy/IO/Config.cs b/CodeLegacy/IO/Config.cs index 3fe4c30d..b7612eb5 100644 --- a/CodeLegacy/IO/Config.cs +++ b/CodeLegacy/IO/Config.cs @@ -210,7 +210,7 @@ public static float GetFloat(Key key) public static float GetFloat(Key key, float defaultVal) { - WriteIfDoesntExist(key.ToString(), defaultVal.ToStringDot()); + WriteIfDoesntExist(key.ToString(), defaultVal.ToString()); return Get(key, Type.Float).GetFloat(); } @@ -221,7 +221,7 @@ public static float GetFloat(string key) public static float GetFloat(string key, float defaultVal) { - WriteIfDoesntExist(key, defaultVal.ToStringDot()); + WriteIfDoesntExist(key, defaultVal.ToString()); return Get(key, Type.Float).GetFloat(); } diff --git a/CodeLegacy/IO/IoUtils.cs b/CodeLegacy/IO/IoUtils.cs index 18f1f96d..8c520e12 100644 --- a/CodeLegacy/IO/IoUtils.cs +++ b/CodeLegacy/IO/IoUtils.cs @@ -610,10 +610,10 @@ public static async Task GetCurrentExportFilename(bool fpsLimit, bool is filename = filename.Replace("[NAME]", inName); filename = filename.Replace("[FULLNAME]", Path.GetFileName(curr.inPath)); - filename = filename.Replace("[FACTOR]", curr.interpFactor.ToStringDot()); + filename = filename.Replace("[FACTOR]", curr.interpFactor.ToString()); 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("[FPS]", fps.ToString("0.###")); filename = filename.Replace("[ROUNDFPS]", fps.RoundToInt().ToString()); filename = filename.Replace("[RES]", $"{outRes.Width}x{outRes.Height}"); filename = filename.Replace("[H]", $"{outRes.Height}p"); diff --git a/CodeLegacy/Media/FfmpegUtils.cs b/CodeLegacy/Media/FfmpegUtils.cs index 5352a976..c1770ebd 100644 --- a/CodeLegacy/Media/FfmpegUtils.cs +++ b/CodeLegacy/Media/FfmpegUtils.cs @@ -526,11 +526,11 @@ private static string GetAudioFilters(float itsScale) return ""; if (itsScale > 4) - return $"-af atempo=0.5,atempo=0.5,atempo={((1f / itsScale) * 4).ToStringDot()}"; + return $"-af atempo=0.5,atempo=0.5,atempo={((1f / itsScale) * 4).ToString()}"; else if (itsScale > 2) - return $"-af atempo=0.5,atempo={((1f / itsScale) * 2).ToStringDot()}"; + return $"-af atempo=0.5,atempo={((1f / itsScale) * 2).ToString()}"; else - return $"-af atempo={(1f / itsScale).ToStringDot()}"; + return $"-af atempo={(1f / itsScale).ToString()}"; } public static string GetSubCodecForContainer(string containerExt) diff --git a/CodeLegacy/Os/AiProcess.cs b/CodeLegacy/Os/AiProcess.cs index 59589dc8..599d3b75 100644 --- a/CodeLegacy/Os/AiProcess.cs +++ b/CodeLegacy/Os/AiProcess.cs @@ -206,7 +206,7 @@ public static async Task RunRifeCudaProcess(string inPath, string outDir, string string uhdStr = InterpolateUtils.UseUhd() ? "--UHD" : ""; string wthreads = $"--wthreads {2 * (int)interpFactor}"; string rbuffer = $"--rbuffer {Config.GetInt(Config.Key.rifeCudaBufferSize, 200)}"; - //string scale = $"--scale {Config.GetFloat("rifeCudaScale", 1.0f).ToStringDot()}"; + //string scale = $"--scale {Config.GetFloat("rifeCudaScale", 1.0f).ToString()}"; string prec = Config.GetBool(Config.Key.rifeCudaFp16) ? "--fp16" : ""; string args = $" --input {inPath.Wrap()} --output {outDir} --model {mdl} --multi {interpFactor} {uhdStr} {wthreads} {rbuffer} {prec}";