Switch to `string.Replace(char, char)` and `string.LastIndexOf(char)`

This commit is contained in:
YoshiRulz 2024-07-03 19:44:57 +10:00
parent 0067dd4b0a
commit 504ba590b1
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
4 changed files with 5 additions and 7 deletions
src
BizHawk.Client.Common/movie/bk2
BizHawk.Client.EmuHawk
MainForm.cs
tools/VirtualPads/controls
BizHawk.Emulation.Common/vpads_schemata

View File

@ -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);

View File

@ -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)
{

View File

@ -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
);

View File

@ -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');
}
/// <summary>An (X, Y) pair intended to be a screen coordinate (for zappers, mouse, stylus, etc.)</summary>
@ -111,9 +111,7 @@ namespace BizHawk.Emulation.Common
/// <remarks>Using this ctor, the valid ranges for the X and Y axes are taken to be <c>(0..TargetSize.Width)</c> and <c>(0..TargetSize.Height)</c>.</remarks>
public TargetedPairSchema(int x, int y, string nameX)
: base(new Point(x, y), nameX)
{
SecondaryName = nameX.Replace("X", "Y");
}
=> SecondaryName = nameX.Replace('X', 'Y');
/// <remarks>Using this ctor, the valid ranges for the X and Y axes are taken to be <c>(0..maxX)</c> and <c>(0..maxY)</c>.</remarks>
public TargetedPairSchema(int x, int y, string nameX, int maxX, int maxY)