From 504ba590b14a4817a510b6143ecb19f54be1d092 Mon Sep 17 00:00:00 2001 From: YoshiRulz Date: Wed, 3 Jul 2024 19:44:57 +1000 Subject: [PATCH] Switch to `string.Replace(char, char)` and `string.LastIndexOf(char)` --- src/BizHawk.Client.Common/movie/bk2/Bk2Movie.IO.cs | 2 +- src/BizHawk.Client.EmuHawk/MainForm.cs | 2 +- .../tools/VirtualPads/controls/VirtualPadAnalogStick.cs | 2 +- .../vpads_schemata/PadSchemaControl.cs | 6 ++---- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/BizHawk.Client.Common/movie/bk2/Bk2Movie.IO.cs b/src/BizHawk.Client.Common/movie/bk2/Bk2Movie.IO.cs index d58099728a..7d27e24ddd 100644 --- a/src/BizHawk.Client.Common/movie/bk2/Bk2Movie.IO.cs +++ b/src/BizHawk.Client.Common/movie/bk2/Bk2Movie.IO.cs @@ -23,7 +23,7 @@ namespace BizHawk.Client.Common } var backupName = Filename; - backupName = backupName.Insert(Filename.LastIndexOf(".", StringComparison.Ordinal), $".{DateTime.Now:yyyy-MM-dd HH.mm.ss}"); + backupName = backupName.Insert(Filename.LastIndexOf('.'), $".{DateTime.Now:yyyy-MM-dd HH.mm.ss}"); backupName = Path.Combine(Session.BackupDirectory, Path.GetFileName(backupName)); Write(backupName, isBackup: true); diff --git a/src/BizHawk.Client.EmuHawk/MainForm.cs b/src/BizHawk.Client.EmuHawk/MainForm.cs index b245197d94..82b8cade41 100644 --- a/src/BizHawk.Client.EmuHawk/MainForm.cs +++ b/src/BizHawk.Client.EmuHawk/MainForm.cs @@ -791,7 +791,7 @@ namespace BizHawk.Client.EmuHawk OSTailoredCode.WindowsVersion._11 => null, OSTailoredCode.WindowsVersion._10 when win10PlusVersion! < new Version(10, 0, 19044) => $"Quick reminder: Your copy of Windows 10 (build {win10PlusVersion.Build}) is no longer supported by Microsoft.\nEmuHawk will probably continue working, but please update to at least 21H2 for increased security.", OSTailoredCode.WindowsVersion._10 => null, - _ => $"Quick reminder: Windows {winVersion.ToString().RemovePrefix('_').Replace("_", ".")} is no longer supported by Microsoft.\nEmuHawk will probably continue working, but please get a new operating system for increased security (either Windows 10+ or a GNU+Linux distro)." + _ => $"Quick reminder: Windows {winVersion.ToString().RemovePrefix('_').Replace('_', '.')} is no longer supported by Microsoft.\nEmuHawk will probably continue working, but please get a new operating system for increased security (either Windows 10+ or a GNU+Linux distro)." }; if (message is not null) { diff --git a/src/BizHawk.Client.EmuHawk/tools/VirtualPads/controls/VirtualPadAnalogStick.cs b/src/BizHawk.Client.EmuHawk/tools/VirtualPads/controls/VirtualPadAnalogStick.cs index 76baba50fb..d99890d7da 100644 --- a/src/BizHawk.Client.EmuHawk/tools/VirtualPads/controls/VirtualPadAnalogStick.cs +++ b/src/BizHawk.Client.EmuHawk/tools/VirtualPads/controls/VirtualPadAnalogStick.cs @@ -101,7 +101,7 @@ namespace BizHawk.Client.EmuHawk _inputManager.StickyXorAdapter, name, RangeX, - !string.IsNullOrEmpty(secondaryName) ? secondaryName : Name.Replace("X", "Y"), + string.IsNullOrEmpty(secondaryName) ? Name.Replace('X', 'Y') : secondaryName, RangeY ); diff --git a/src/BizHawk.Emulation.Common/vpads_schemata/PadSchemaControl.cs b/src/BizHawk.Emulation.Common/vpads_schemata/PadSchemaControl.cs index b7f1c357a4..1667476da9 100644 --- a/src/BizHawk.Emulation.Common/vpads_schemata/PadSchemaControl.cs +++ b/src/BizHawk.Emulation.Common/vpads_schemata/PadSchemaControl.cs @@ -94,7 +94,7 @@ namespace BizHawk.Emulation.Common public AnalogSchema(int x, int y, string nameX) : base(new Point(x, y), nameX) - => SecondaryName = nameX.Replace("X", "Y"); + => SecondaryName = nameX.Replace('X', 'Y'); } /// An (X, Y) pair intended to be a screen coordinate (for zappers, mouse, stylus, etc.) @@ -111,9 +111,7 @@ namespace BizHawk.Emulation.Common /// Using this ctor, the valid ranges for the X and Y axes are taken to be (0..TargetSize.Width) and (0..TargetSize.Height). public TargetedPairSchema(int x, int y, string nameX) : base(new Point(x, y), nameX) - { - SecondaryName = nameX.Replace("X", "Y"); - } + => SecondaryName = nameX.Replace('X', 'Y'); /// Using this ctor, the valid ranges for the X and Y axes are taken to be (0..maxX) and (0..maxY). public TargetedPairSchema(int x, int y, string nameX, int maxX, int maxY)