bump AnalysisModeGlobalization to Recommended
fixes CA1304, CA1309, CA1310, CA1311 temporarily silences CA1305 reduce severity of CA2101
This commit is contained in:
parent
4c00ec54e7
commit
8e557b0b9d
|
@ -11,3 +11,7 @@ csharp_new_line_before_finally = true
|
|||
csharp_indent_switch_labels = true
|
||||
csharp_indent_case_contents = true
|
||||
csharp_indent_labels = one_less_than_current
|
||||
|
||||
# Globalization rules
|
||||
dotnet_diagnostic.CA1305.severity = silent
|
||||
dotnet_diagnostic.CA2101.severity = suggestion
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<Project>
|
||||
<PropertyGroup>
|
||||
<AnalysisLevel>6</AnalysisLevel>
|
||||
<AnalysisModeGlobalization>Recommended</AnalysisModeGlobalization>
|
||||
<CodeAnalysisRuleSet>$(MSBuildProjectDirectory)/../../Common.ruleset</CodeAnalysisRuleSet>
|
||||
<ContinuousIntegrationBuild Condition=" '$(GITLAB_CI)' != '' Or '$(APPVEYOR)' != '' ">true</ContinuousIntegrationBuild>
|
||||
<EnableNETAnalyzers>true</EnableNETAnalyzers>
|
||||
|
|
|
@ -48,7 +48,7 @@ namespace BizHawk.SrcGen.ReflectionCache
|
|||
};
|
||||
if (_namespace != null || syntaxNode is not NamespaceDeclarationSyntax syn) return;
|
||||
var newNS = Ser(syn.Name);
|
||||
if (!newNS.StartsWith("BizHawk.")) return;
|
||||
if (!newNS.StartsWith("BizHawk.", StringComparison.Ordinal)) return;
|
||||
_namespaces.Add(newNS);
|
||||
if (_namespaces.Count == SAMPLE_SIZE) _namespace = CalcNamespace();
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ namespace {nSpace}
|
|||
public static IEnumerable<string> EmbeddedResourceList(string extraPrefix)
|
||||
{{
|
||||
var fullPrefix = EMBED_PREFIX + extraPrefix;
|
||||
return Asm.GetManifestResourceNames().Where(s => s.StartsWith(fullPrefix)).Select(s => s.RemovePrefix(fullPrefix));
|
||||
return Asm.GetManifestResourceNames().Where(s => s.StartsWith(fullPrefix, StringComparison.Ordinal)).Select(s => s.RemovePrefix(fullPrefix));
|
||||
}}
|
||||
|
||||
public static IEnumerable<string> EmbeddedResourceList()
|
||||
|
|
Binary file not shown.
|
@ -160,17 +160,17 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
|
||||
public readonly ref struct LuaAutoUnlockHack
|
||||
{
|
||||
private readonly GuiApi _guiApi;
|
||||
|
||||
internal LuaAutoUnlockHack(GuiApi guiApi)
|
||||
=> _guiApi = guiApi;
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_guiApi.UnlockSurface(DisplaySurfaceID.EmuCore);
|
||||
_guiApi.UnlockSurface(DisplaySurfaceID.Client);
|
||||
}
|
||||
{
|
||||
private readonly GuiApi _guiApi;
|
||||
|
||||
internal LuaAutoUnlockHack(GuiApi guiApi)
|
||||
=> _guiApi = guiApi;
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_guiApi.UnlockSurface(DisplaySurfaceID.EmuCore);
|
||||
_guiApi.UnlockSurface(DisplaySurfaceID.Client);
|
||||
}
|
||||
}
|
||||
|
||||
public LuaAutoUnlockHack ThisIsTheLuaAutoUnlockHack()
|
||||
|
@ -491,7 +491,7 @@ namespace BizHawk.Client.Common
|
|||
{
|
||||
var family = fontfamily != null ? new FontFamily(fontfamily) : FontFamily.GenericMonospace;
|
||||
|
||||
var fstyle = fontstyle?.ToLower() switch
|
||||
var fstyle = fontstyle?.ToLowerInvariant() switch
|
||||
{
|
||||
"bold" => FontStyle.Bold,
|
||||
"italic" => FontStyle.Italic,
|
||||
|
@ -507,7 +507,7 @@ namespace BizHawk.Client.Common
|
|||
var font = new Font(family, fontsize ?? 12, fstyle, GraphicsUnit.Pixel);
|
||||
var sizeOfText = g.MeasureString(message, font, 0, new StringFormat(StringFormat.GenericDefault)).ToSize();
|
||||
|
||||
switch (horizalign?.ToLower())
|
||||
switch (horizalign?.ToLowerInvariant())
|
||||
{
|
||||
default:
|
||||
case "left":
|
||||
|
@ -521,7 +521,7 @@ namespace BizHawk.Client.Common
|
|||
break;
|
||||
}
|
||||
|
||||
switch (vertalign?.ToLower())
|
||||
switch (vertalign?.ToLowerInvariant())
|
||||
{
|
||||
default:
|
||||
case "top":
|
||||
|
@ -644,4 +644,4 @@ namespace BizHawk.Client.Common
|
|||
foreach (var brush in _pens.Values) brush.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -98,7 +98,7 @@ namespace BizHawk.Client.Common
|
|||
|
||||
public int Length() => _movieSession.Movie.FrameCount;
|
||||
|
||||
public string Mode() => (_movieSession.Movie?.Mode ?? MovieMode.Inactive).ToString().ToUpper();
|
||||
public string Mode() => (_movieSession.Movie?.Mode ?? MovieMode.Inactive).ToString().ToUpperInvariant();
|
||||
|
||||
public bool PlayFromStart(string path = "")
|
||||
{
|
||||
|
|
|
@ -7,6 +7,7 @@ using System.IO;
|
|||
using System.Net.Sockets;
|
||||
|
||||
using BizHawk.Common.CollectionExtensions;
|
||||
using BizHawk.Common.StringExtensions;
|
||||
|
||||
namespace BizHawk.Client.Common
|
||||
{
|
||||
|
@ -59,28 +60,28 @@ namespace BizHawk.Client.Common
|
|||
continue;
|
||||
}
|
||||
|
||||
var argDowncased = arg.ToLower();
|
||||
if (argDowncased.StartsWith("--load-slot="))
|
||||
var argDowncased = arg.ToLowerInvariant();
|
||||
if (argDowncased.StartsWithOrdinal("--load-slot="))
|
||||
{
|
||||
cmdLoadSlot = argDowncased.Substring(argDowncased.IndexOf('=') + 1);
|
||||
}
|
||||
else if (argDowncased.StartsWith("--load-state="))
|
||||
else if (argDowncased.StartsWithOrdinal("--load-state="))
|
||||
{
|
||||
cmdLoadState = arg.Substring(arg.IndexOf('=') + 1);
|
||||
}
|
||||
else if (argDowncased.StartsWith("--config="))
|
||||
else if (argDowncased.StartsWithOrdinal("--config="))
|
||||
{
|
||||
cmdConfigFile = arg.Substring(arg.IndexOf('=') + 1);
|
||||
}
|
||||
else if (argDowncased.StartsWith("--movie="))
|
||||
else if (argDowncased.StartsWithOrdinal("--movie="))
|
||||
{
|
||||
cmdMovie = arg.Substring(arg.IndexOf('=') + 1);
|
||||
}
|
||||
else if (argDowncased.StartsWith("--dump-type="))
|
||||
else if (argDowncased.StartsWithOrdinal("--dump-type="))
|
||||
{
|
||||
cmdDumpType = argDowncased.Substring(argDowncased.IndexOf('=') + 1);
|
||||
}
|
||||
else if (argDowncased.StartsWith("--dump-frames="))
|
||||
else if (argDowncased.StartsWithOrdinal("--dump-frames="))
|
||||
{
|
||||
string list = argDowncased.Substring(argDowncased.IndexOf('=') + 1);
|
||||
string[] items = list.Split(',');
|
||||
|
@ -93,78 +94,78 @@ namespace BizHawk.Client.Common
|
|||
// automatically set dump length to maximum frame
|
||||
autoDumpLength = currAviWriterFrameList.Order().Last();
|
||||
}
|
||||
else if (argDowncased.StartsWith("--version"))
|
||||
else if (argDowncased.StartsWithOrdinal("--version"))
|
||||
{
|
||||
printVersion = true;
|
||||
}
|
||||
else if (argDowncased.StartsWith("--dump-name="))
|
||||
else if (argDowncased.StartsWithOrdinal("--dump-name="))
|
||||
{
|
||||
cmdDumpName = arg.Substring(arg.IndexOf('=') + 1);
|
||||
}
|
||||
else if (argDowncased.StartsWith("--dump-length="))
|
||||
else if (argDowncased.StartsWithOrdinal("--dump-length="))
|
||||
{
|
||||
var len = int.TryParse(argDowncased.Substring(argDowncased.IndexOf('=') + 1), out var i1) ? i1 : default;
|
||||
autoDumpLength = len;
|
||||
}
|
||||
else if (argDowncased.StartsWith("--dump-close"))
|
||||
else if (argDowncased.StartsWithOrdinal("--dump-close"))
|
||||
{
|
||||
autoCloseOnDump = true;
|
||||
}
|
||||
else if (argDowncased.StartsWith("--chromeless"))
|
||||
else if (argDowncased.StartsWithOrdinal("--chromeless"))
|
||||
{
|
||||
// chrome is never shown, even in windowed mode
|
||||
chromeless = true;
|
||||
}
|
||||
else if (argDowncased.StartsWith("--fullscreen"))
|
||||
else if (argDowncased.StartsWithOrdinal("--fullscreen"))
|
||||
{
|
||||
startFullscreen = true;
|
||||
}
|
||||
else if (argDowncased.StartsWith("--lua="))
|
||||
else if (argDowncased.StartsWithOrdinal("--lua="))
|
||||
{
|
||||
luaScript = arg.Substring(arg.IndexOf('=') + 1);
|
||||
luaConsole = true;
|
||||
}
|
||||
else if (argDowncased.StartsWith("--luaconsole"))
|
||||
else if (argDowncased.StartsWithOrdinal("--luaconsole"))
|
||||
{
|
||||
luaConsole = true;
|
||||
}
|
||||
else if (argDowncased.StartsWith("--socket_port="))
|
||||
else if (argDowncased.StartsWithOrdinal("--socket_port="))
|
||||
{
|
||||
var port = int.TryParse(argDowncased.Substring(argDowncased.IndexOf('=') + 1), out var i1) ? i1 : default;
|
||||
if (port > 0) socketPort = port;
|
||||
}
|
||||
else if (argDowncased.StartsWith("--socket_ip="))
|
||||
else if (argDowncased.StartsWithOrdinal("--socket_ip="))
|
||||
{
|
||||
socketIP = argDowncased.Substring(argDowncased.IndexOf('=') + 1);
|
||||
}
|
||||
else if (argDowncased.StartsWith("--socket_udp"))
|
||||
else if (argDowncased.StartsWithOrdinal("--socket_udp"))
|
||||
{
|
||||
socketProtocol = ProtocolType.Udp;
|
||||
}
|
||||
else if (argDowncased.StartsWith("--mmf="))
|
||||
else if (argDowncased.StartsWithOrdinal("--mmf="))
|
||||
{
|
||||
mmfFilename = arg.Substring(arg.IndexOf('=') + 1);
|
||||
}
|
||||
else if (argDowncased.StartsWith("--url_get="))
|
||||
else if (argDowncased.StartsWithOrdinal("--url_get="))
|
||||
{
|
||||
urlGet = arg.Substring(arg.IndexOf('=') + 1);
|
||||
}
|
||||
else if (argDowncased.StartsWith("--url_post="))
|
||||
else if (argDowncased.StartsWithOrdinal("--url_post="))
|
||||
{
|
||||
urlPost = arg.Substring(arg.IndexOf('=') + 1);
|
||||
}
|
||||
else if (argDowncased.StartsWith("--audiosync="))
|
||||
else if (argDowncased.StartsWithOrdinal("--audiosync="))
|
||||
{
|
||||
audiosync = argDowncased.Substring(argDowncased.IndexOf('=') + 1) == "true";
|
||||
}
|
||||
else if (argDowncased.StartsWith("--open-ext-tool-dll="))
|
||||
else if (argDowncased.StartsWithOrdinal("--open-ext-tool-dll="))
|
||||
{
|
||||
// the first ext. tool from ExternalToolManager.ToolStripMenu which satisfies both of these will be opened:
|
||||
// - available (no load errors, correct system/rom, etc.)
|
||||
// - dll path matches given string; or dll filename matches given string with or without `.dll`
|
||||
openExtToolDll = arg.Substring(20);
|
||||
}
|
||||
else if (argDowncased.StartsWith("--userdata="))
|
||||
else if (argDowncased.StartsWithOrdinal("--userdata="))
|
||||
{
|
||||
userdataUnparsedPairs = new();
|
||||
foreach (var s in arg.Substring(11).Split(';'))
|
||||
|
|
|
@ -166,8 +166,7 @@ namespace BizHawk.Client.Common.Filters
|
|||
|
||||
value = value.Trim();
|
||||
}
|
||||
|
||||
dict[key.ToLower()] = value;
|
||||
dict[key.ToLowerInvariant()] = value;
|
||||
}
|
||||
|
||||
// process the keys
|
||||
|
|
|
@ -71,7 +71,7 @@ namespace BizHawk.Client.Common
|
|||
{
|
||||
if (!Frozen)
|
||||
{
|
||||
return recentlist.RemoveAll(recent => string.Compare(newFile, recent, StringComparison.CurrentCultureIgnoreCase) == 0) != 0; // none removed => return false
|
||||
return recentlist.RemoveAll(recent => string.Compare(newFile, recent, StringComparison.OrdinalIgnoreCase) == 0) != 0; // none removed => return false
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
@ -65,7 +65,7 @@ namespace BizHawk.Client.Common
|
|||
|
||||
if (!string.IsNullOrWhiteSpace(GameInfo.Name) && GameInfo.Name == GameInfo.Name.ToUpperInvariant())
|
||||
{
|
||||
GameInfo.Name = Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase(GameInfo.Name.ToLower());
|
||||
GameInfo.Name = Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase(GameInfo.Name.ToLowerInvariant());
|
||||
}
|
||||
|
||||
return;
|
||||
|
|
|
@ -389,7 +389,7 @@ namespace BizHawk.Client.Common
|
|||
return (int)CorePriority.UserPreference;
|
||||
}
|
||||
|
||||
if (string.Equals(c.Name, dbForcedCoreName, StringComparison.InvariantCultureIgnoreCase))
|
||||
if (string.Equals(c.Name, dbForcedCoreName, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return (int)CorePriority.GameDbPreference;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
using BizHawk.Emulation.Common;
|
||||
using System;
|
||||
using BizHawk.Common.StringExtensions;
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
namespace BizHawk.Client.Common.cheats
|
||||
{
|
||||
|
@ -50,7 +52,7 @@ namespace BizHawk.Client.Common.cheats
|
|||
private static IDecodeResult GameBoy(string code)
|
||||
{
|
||||
// Game Genie
|
||||
if (code.LastIndexOf("-") == 7 && code.IndexOf("-") == 3)
|
||||
if (code.LastIndexOf("-", StringComparison.Ordinal) == 7 && code.IndexOf("-", StringComparison.Ordinal) == 3)
|
||||
{
|
||||
return GbGgGameGenieDecoder.Decode(code);
|
||||
}
|
||||
|
@ -87,7 +89,7 @@ namespace BizHawk.Client.Common.cheats
|
|||
{
|
||||
// Problem: I don't know what the Non-FF Style codes are.
|
||||
// TODO: Fix that.
|
||||
if (code.StartsWith("FF") == false)
|
||||
if (code.StartsWithOrdinal("FF") == false)
|
||||
{
|
||||
return new InvalidCheatCode("This Action Replay Code, is not yet supported.");
|
||||
}
|
||||
|
@ -109,13 +111,13 @@ namespace BizHawk.Client.Common.cheats
|
|||
private static IDecodeResult Sms(string code)
|
||||
{
|
||||
// Game Genie
|
||||
if (code.LastIndexOf("-") == 7 && code.IndexOf("-") == 3)
|
||||
if (code.LastIndexOf("-", StringComparison.Ordinal) == 7 && code.IndexOf("-", StringComparison.Ordinal) == 3)
|
||||
{
|
||||
return GbGgGameGenieDecoder.Decode(code);
|
||||
}
|
||||
|
||||
// Action Replay
|
||||
if (code.IndexOf("-") == 3 && code.Length == 9)
|
||||
if (code.IndexOf("-", StringComparison.Ordinal) == 3 && code.Length == 9)
|
||||
{
|
||||
return SmsActionReplayDecoder.Decode(code);
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ namespace BizHawk.Client.Common.cheats
|
|||
throw new ArgumentNullException(nameof(_code));
|
||||
}
|
||||
|
||||
if (_code.LastIndexOf("-") != 7 || _code.IndexOf("-") != 3)
|
||||
if (_code.LastIndexOf("-", StringComparison.Ordinal) != 7 || _code.IndexOf("-", StringComparison.Ordinal) != 3)
|
||||
{
|
||||
return new InvalidCheatCode("All Master System Game Genie Codes need to have a dash after the third character and seventh character.");
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ namespace BizHawk.Client.Common.cheats
|
|||
code = Decrypt(code);
|
||||
}
|
||||
|
||||
if (code.IndexOf(" ") != 8 || code.Length != 17) // not a redundant length check, `code` was overwritten
|
||||
if (code.IndexOf(" ", StringComparison.Ordinal) != 8 || code.Length != 17) // not a redundant length check, `code` was overwritten
|
||||
{
|
||||
return new InvalidCheatCode("All GBA GameShark Codes need to be 17 characters in length with a space after the first eight.");
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace BizHawk.Client.Common.cheats
|
|||
throw new ArgumentNullException(nameof(code));
|
||||
}
|
||||
|
||||
if (code.IndexOf(":") != 6)
|
||||
if (code.IndexOf(":", StringComparison.Ordinal) != 6)
|
||||
{
|
||||
return new InvalidCheatCode("Action Replay/Pro Action Replay Codes need to contain a colon after the sixth character.");
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ namespace BizHawk.Client.Common.cheats
|
|||
throw new ArgumentNullException(nameof(code));
|
||||
}
|
||||
|
||||
if (code.IndexOf("-") != 4)
|
||||
if (code.IndexOf("-", StringComparison.Ordinal) != 4)
|
||||
{
|
||||
return new InvalidCheatCode("Game Genie Codes need to contain a dash after the fourth character");
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace BizHawk.Client.Common.cheats
|
|||
throw new ArgumentNullException(nameof(code));
|
||||
}
|
||||
|
||||
if (code.IndexOf(" ") != 8)
|
||||
if (code.IndexOf(" ", StringComparison.Ordinal) != 8)
|
||||
{
|
||||
return new InvalidCheatCode("GameShark Codes need to contain a space after the eighth character.");
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace BizHawk.Client.Common.cheats
|
|||
throw new ArgumentNullException(nameof(code));
|
||||
}
|
||||
|
||||
if (code.IndexOf(" ") != 8)
|
||||
if (code.IndexOf(" ", StringComparison.Ordinal) != 8)
|
||||
{
|
||||
return new InvalidCheatCode("All PSX GameShark Codes need to contain a space after the eighth character.");
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace BizHawk.Client.Common.cheats
|
|||
throw new ArgumentNullException(nameof(code));
|
||||
}
|
||||
|
||||
if (code.IndexOf(" ") != 8)
|
||||
if (code.IndexOf(" ", StringComparison.Ordinal) != 8)
|
||||
{
|
||||
return new InvalidCheatCode("All Saturn GameShark Codes need to contain a space after the eighth character.");
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace BizHawk.Client.Common.cheats
|
|||
throw new ArgumentNullException(nameof(code));
|
||||
}
|
||||
|
||||
if (code.IndexOf("-") != 3 && code.Length != 9)
|
||||
if (code.IndexOf("-", StringComparison.Ordinal) != 3 && code.Length != 9)
|
||||
{
|
||||
return new InvalidCheatCode("Action Replay Codes must be 9 characters with a dash after the third character");
|
||||
}
|
||||
|
|
|
@ -90,12 +90,12 @@ namespace BizHawk.Client.Common
|
|||
|
||||
if (path == "%recent%") return PathUtils.SpecialRecentsDir;
|
||||
|
||||
if (path.StartsWith("%exe%"))
|
||||
if (path.StartsWithOrdinal("%exe%"))
|
||||
{
|
||||
return PathUtils.ExeDirectoryPath + path.Substring(5);
|
||||
}
|
||||
|
||||
if (path.StartsWith("%rom%"))
|
||||
if (path.StartsWithOrdinal("%rom%"))
|
||||
{
|
||||
return collection.LastRomPath + path.Substring(5);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#nullable enable
|
||||
|
||||
using System.Linq;
|
||||
using BizHawk.Common.StringExtensions;
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
namespace BizHawk.Client.Common
|
||||
|
@ -21,7 +22,7 @@ namespace BizHawk.Client.Common
|
|||
if (state) return;
|
||||
// when a button or modifier key is released, all modified key variants with it are released as well
|
||||
foreach (var k in Buttons.Keys.Where(k =>
|
||||
k.EndsWith($"+{ie.LogicalButton.Button}") || k.StartsWith($"{ie.LogicalButton.Button}+") || k.Contains($"+{ie.LogicalButton.Button}+"))
|
||||
k.EndsWithOrdinal($"+{ie.LogicalButton.Button}") || k.StartsWithOrdinal($"{ie.LogicalButton.Button}+") || k.Contains($"+{ie.LogicalButton.Button}+"))
|
||||
.ToArray())
|
||||
Buttons[k] = false;
|
||||
}
|
||||
|
|
|
@ -330,7 +330,7 @@ namespace BizHawk.Client.Common
|
|||
[LuaMethodExample("local nlcliget = client.getavailabletools( );")]
|
||||
[LuaMethod("getavailabletools", "Returns a list of the tools currently open")]
|
||||
public LuaTable GetAvailableTools()
|
||||
=> _th.EnumerateToLuaTable(APIs.Tool.AvailableTools.Select(tool => tool.Name.ToLower()), indexFrom: 0);
|
||||
=> _th.EnumerateToLuaTable(APIs.Tool.AvailableTools.Select(tool => tool.Name.ToLowerInvariant()), indexFrom: 0);
|
||||
|
||||
[LuaMethodExample("local nlcliget = client.gettool( \"Tool name\" );")]
|
||||
[LuaMethod("gettool", "Returns an object that represents a tool of the given name (not case sensitive). If the tool is not open, it will be loaded if available. Use getavailabletools to get a list of names")]
|
||||
|
|
|
@ -290,7 +290,7 @@ namespace BizHawk.Client.Common
|
|||
.Replace("Uint", "uint ")
|
||||
.Replace("Nullable`1[DrawingColor]", "Color? ")
|
||||
.Replace("DrawingColor", "Color ")
|
||||
.ToLower();
|
||||
.ToLowerInvariant();
|
||||
}
|
||||
|
||||
public string ReturnType
|
||||
|
|
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||
using System.IO;
|
||||
using System.Text;
|
||||
using BizHawk.Common.PathExtensions;
|
||||
using BizHawk.Common.StringExtensions;
|
||||
|
||||
namespace BizHawk.Client.Common
|
||||
{
|
||||
|
@ -78,7 +79,7 @@ namespace BizHawk.Client.Common
|
|||
string line;
|
||||
while ((line = sr.ReadLine()) != null)
|
||||
{
|
||||
if (line.StartsWith("---"))
|
||||
if (line.StartsWithOrdinal("---"))
|
||||
{
|
||||
Add(LuaFile.SeparatorInstance);
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
|
||||
using BizHawk.Common.StringExtensions;
|
||||
using NLua;
|
||||
|
||||
// ReSharper disable UnusedMember.Global
|
||||
|
@ -127,12 +127,12 @@ namespace BizHawk.Client.Common
|
|||
[LuaMethodExample("if ( bizstring.startswith( \"Some string\", \"Some\") ) then\r\n\tconsole.log( \"Returns whether str starts with str2\" );\r\nend;")]
|
||||
[LuaMethod("startswith", "Returns whether str starts with str2")]
|
||||
public static bool StartsWith(string str, string str2)
|
||||
=> !string.IsNullOrEmpty(str) && str.StartsWith(str2); // don't bother fixing encoding, will match (or not match) regardless
|
||||
=> !string.IsNullOrEmpty(str) && str.StartsWithOrdinal(str2); // don't bother fixing encoding, will match (or not match) regardless
|
||||
|
||||
[LuaMethodExample("if ( bizstring.endswith( \"Some string\", \"string\") ) then\r\n\tconsole.log( \"Returns whether str ends wth str2\" );\r\nend;")]
|
||||
[LuaMethod("endswith", "Returns whether str ends wth str2")]
|
||||
public static bool EndsWith(string str, string str2)
|
||||
=> !string.IsNullOrEmpty(str) && str.EndsWith(str2); // don't bother fixing encoding, will match (or not match) regardless
|
||||
=> !string.IsNullOrEmpty(str) && str.EndsWithOrdinal(str2); // don't bother fixing encoding, will match (or not match) regardless
|
||||
|
||||
[LuaMethodExample("local nlbizspl = bizstring.split( \"Some, string\", \", \" );")]
|
||||
[LuaMethod("split", "Splits str into a Lua-style array using the given separator (consecutive separators in str will NOT create empty entries in the array). If the separator is not a string exactly one char long, ',' will be used.")]
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace BizHawk.Client.Common
|
|||
|
||||
public static bool IsValidMovieExtension(string ext)
|
||||
{
|
||||
return MovieExtensions.Contains(ext.ToLower().Replace(".", ""));
|
||||
return MovieExtensions.Contains(ext.Replace(".", ""), StringComparer.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
public static bool IsCurrentTasVersion(string movieVersion)
|
||||
|
@ -35,7 +35,7 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
|
||||
var split = movieVersion
|
||||
.ToLower()
|
||||
.ToLowerInvariant()
|
||||
.Split(new[] {"tasproj"}, StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
if (split.Length == 1)
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using BizHawk.Common.StringExtensions;
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
namespace BizHawk.Client.Common
|
||||
|
@ -307,7 +308,7 @@ namespace BizHawk.Client.Common
|
|||
public IMovie Get(string path)
|
||||
{
|
||||
// TODO: change IMovies to take HawkFiles only and not path
|
||||
if (Path.GetExtension(path)?.EndsWith("tasproj") ?? false)
|
||||
if (Path.GetExtension(path)?.EndsWithOrdinal("tasproj") ?? false)
|
||||
{
|
||||
return new TasMovie(this, path);
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
|
||||
var backupName = Filename;
|
||||
backupName = backupName.Insert(Filename.LastIndexOf("."), $".{DateTime.Now:yyyy-MM-dd HH.mm.ss}");
|
||||
backupName = backupName.Insert(Filename.LastIndexOf(".", StringComparison.Ordinal), $".{DateTime.Now:yyyy-MM-dd HH.mm.ss}");
|
||||
backupName = Path.Combine(Session.BackupDirectory, Path.GetFileName(backupName));
|
||||
|
||||
Write(backupName, isBackup: true);
|
||||
|
|
|
@ -58,7 +58,7 @@ namespace BizHawk.Client.Common
|
|||
{
|
||||
Log.Add(line);
|
||||
}
|
||||
else if (line.StartsWith("Frame "))
|
||||
else if (line.StartsWithOrdinal("Frame "))
|
||||
{
|
||||
var strs = line.Split(' ');
|
||||
try
|
||||
|
@ -71,7 +71,7 @@ namespace BizHawk.Client.Common
|
|||
return false;
|
||||
}
|
||||
}
|
||||
else if (line.StartsWith("LogKey:"))
|
||||
else if (line.StartsWithOrdinal("LogKey:"))
|
||||
{
|
||||
LogKey = line.Replace("LogKey:", "");
|
||||
}
|
||||
|
@ -122,7 +122,7 @@ namespace BizHawk.Client.Common
|
|||
{
|
||||
newLog.Add(line);
|
||||
}
|
||||
else if (line.StartsWith("Frame "))
|
||||
else if (line.StartsWithOrdinal("Frame "))
|
||||
{
|
||||
var strs = line.Split(' ');
|
||||
try
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using BizHawk.Common;
|
||||
using BizHawk.Common.StringExtensions;
|
||||
using BizHawk.Emulation.Common;
|
||||
using BizHawk.Emulation.Cores;
|
||||
using BizHawk.Emulation.Cores.Consoles.Nintendo.NDS;
|
||||
|
@ -41,40 +42,40 @@ namespace BizHawk.Client.Common
|
|||
{
|
||||
ImportInputFrame(line);
|
||||
}
|
||||
else if (line.StartsWith("rerecordCount"))
|
||||
else if (line.StartsWithOrdinal("rerecordCount"))
|
||||
{
|
||||
Result.Movie.Rerecords = (ulong) (int.TryParse(ParseHeader(line, "rerecordCount"), out var rerecordCount) ? rerecordCount : default);
|
||||
}
|
||||
else if (line.StartsWith("firmNickname"))
|
||||
else if (line.StartsWithOrdinal("firmNickname"))
|
||||
{
|
||||
syncSettings.FirmwareUsername = ParseHeader(line, "firmNickname");
|
||||
}
|
||||
else if (line.StartsWith("firmFavColour"))
|
||||
else if (line.StartsWithOrdinal("firmFavColour"))
|
||||
{
|
||||
syncSettings.FirmwareFavouriteColour = (NDS.NDSSyncSettings.Color)byte.Parse(ParseHeader(line, "firmFavColour"));
|
||||
}
|
||||
else if (line.StartsWith("firmBirthDay"))
|
||||
else if (line.StartsWithOrdinal("firmBirthDay"))
|
||||
{
|
||||
syncSettings.FirmwareBirthdayDay = byte.Parse(ParseHeader(line, "firmBirthDay"));
|
||||
}
|
||||
else if (line.StartsWith("firmBirthMonth"))
|
||||
else if (line.StartsWithOrdinal("firmBirthMonth"))
|
||||
{
|
||||
syncSettings.FirmwareBirthdayMonth = (NDS.NDSSyncSettings.Month)byte.Parse(ParseHeader(line, "firmBirthMonth"));
|
||||
}
|
||||
else if (line.StartsWith("rtcStartNew"))
|
||||
else if (line.StartsWithOrdinal("rtcStartNew"))
|
||||
{
|
||||
string rtcTime = ParseHeader(line, "rtcStartNew");
|
||||
syncSettings.InitialTime = DateTime.ParseExact(rtcTime, "yyyy'-'MMM'-'dd' 'HH':'mm':'ss':'fff", DateTimeFormatInfo.InvariantInfo);
|
||||
}
|
||||
else if (line.StartsWith("comment author"))
|
||||
else if (line.StartsWithOrdinal("comment author"))
|
||||
{
|
||||
Result.Movie.HeaderEntries[HeaderKeys.Author] = ParseHeader(line, "comment author");
|
||||
}
|
||||
else if (line.StartsWith("comment"))
|
||||
else if (line.StartsWithOrdinal("comment"))
|
||||
{
|
||||
Result.Movie.Comments.Add(ParseHeader(line, "comment"));
|
||||
}
|
||||
else if (line.ToLower().StartsWith("guid"))
|
||||
else if (line.StartsWith("guid", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
// We no longer care to keep this info
|
||||
}
|
||||
|
|
|
@ -107,7 +107,7 @@ namespace BizHawk.Client.Common.movie.import
|
|||
|
||||
// 020 16-byte md5sum of the ROM used
|
||||
byte[] md5 = r.ReadBytes(16);
|
||||
Result.Movie.HeaderEntries[HeaderKeys.Md5] = md5.BytesToHexString().ToLower();
|
||||
Result.Movie.HeaderEntries[HeaderKeys.Md5] = md5.BytesToHexString().ToLowerInvariant();
|
||||
|
||||
// 030 4-byte little-endian unsigned int: version of the emulator used
|
||||
uint emuVersion = r.ReadUInt32();
|
||||
|
|
|
@ -44,7 +44,7 @@ namespace BizHawk.Client.Common
|
|||
{
|
||||
ImportInputFrame(line);
|
||||
}
|
||||
else if (line.ToLower().StartsWith("sub"))
|
||||
else if (line.StartsWith("sub", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
var subtitle = ImportTextSubtitle(line);
|
||||
|
||||
|
@ -53,11 +53,11 @@ namespace BizHawk.Client.Common
|
|||
Result.Movie.Subtitles.AddFromString(subtitle);
|
||||
}
|
||||
}
|
||||
else if (line.ToLower().StartsWith("emuversion"))
|
||||
else if (line.StartsWith("emuversion", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
Result.Movie.Comments.Add($"{EmulationOrigin} {emulator} version {ParseHeader(line, "emuVersion")}");
|
||||
}
|
||||
else if (line.ToLower().StartsWith("version"))
|
||||
else if (line.StartsWith("version", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
string version = ParseHeader(line, "version");
|
||||
|
||||
|
@ -70,40 +70,40 @@ namespace BizHawk.Client.Common
|
|||
Result.Movie.Comments.Add($"{MovieOrigin} .fm2 version 3");
|
||||
}
|
||||
}
|
||||
else if (line.ToLower().StartsWith("romfilename"))
|
||||
else if (line.StartsWith("romfilename", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
Result.Movie.HeaderEntries[HeaderKeys.GameName] = ParseHeader(line, "romFilename");
|
||||
}
|
||||
else if (line.ToLower().StartsWith("cdgamename"))
|
||||
else if (line.StartsWith("cdgamename", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
Result.Movie.HeaderEntries[HeaderKeys.GameName] = ParseHeader(line, "cdGameName");
|
||||
}
|
||||
else if (line.ToLower().StartsWith("romchecksum"))
|
||||
else if (line.StartsWith("romchecksum", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
string blob = ParseHeader(line, "romChecksum");
|
||||
byte[] md5 = DecodeBlob(blob);
|
||||
if (md5 != null && md5.Length == 16)
|
||||
{
|
||||
Result.Movie.HeaderEntries[HeaderKeys.Md5] = md5.BytesToHexString().ToLower();
|
||||
Result.Movie.HeaderEntries[HeaderKeys.Md5] = md5.BytesToHexString().ToLowerInvariant();
|
||||
}
|
||||
else
|
||||
{
|
||||
Result.Warnings.Add("Bad ROM checksum.");
|
||||
}
|
||||
}
|
||||
else if (line.ToLower().StartsWith("comment author"))
|
||||
else if (line.StartsWith("comment author", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
Result.Movie.HeaderEntries[HeaderKeys.Author] = ParseHeader(line, "comment author");
|
||||
}
|
||||
else if (line.ToLower().StartsWith("rerecordcount"))
|
||||
else if (line.StartsWith("rerecordcount", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
Result.Movie.Rerecords = (ulong) (int.TryParse(ParseHeader(line, "rerecordCount"), out var rerecordCount) ? rerecordCount : default);
|
||||
}
|
||||
else if (line.ToLower().StartsWith("guid"))
|
||||
else if (line.StartsWith("guid", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
// We no longer care to keep this info
|
||||
}
|
||||
else if (line.ToLower().StartsWith("startsfromsavestate"))
|
||||
else if (line.StartsWith("startsfromsavestate", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
// If this movie starts from a savestate, we can't support it.
|
||||
if (ParseHeader(line, "StartsFromSavestate") == "1")
|
||||
|
@ -112,11 +112,11 @@ namespace BizHawk.Client.Common
|
|||
break;
|
||||
}
|
||||
}
|
||||
else if (line.ToLower().StartsWith("palflag"))
|
||||
else if (line.StartsWith("palflag", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
Result.Movie.HeaderEntries[HeaderKeys.Pal] = ParseHeader(line, "palFlag");
|
||||
}
|
||||
else if (line.ToLower().StartsWith("port0"))
|
||||
else if (line.StartsWith("port0", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
if (ParseHeader(line, "port0") == "1")
|
||||
{
|
||||
|
@ -124,7 +124,7 @@ namespace BizHawk.Client.Common
|
|||
_deck = controllerSettings.Instantiate((x, y) => false).AddSystemToControllerDef();
|
||||
}
|
||||
}
|
||||
else if (line.ToLower().StartsWith("port1"))
|
||||
else if (line.StartsWith("port1", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
if (ParseHeader(line, "port1") == "1")
|
||||
{
|
||||
|
@ -132,14 +132,14 @@ namespace BizHawk.Client.Common
|
|||
_deck = controllerSettings.Instantiate((x, y) => false).AddSystemToControllerDef();
|
||||
}
|
||||
}
|
||||
else if (line.ToLower().StartsWith("port2"))
|
||||
else if (line.StartsWith("port2", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
if (ParseHeader(line, "port2") == "1")
|
||||
{
|
||||
Result.Warnings.Add("Famicom port detected but not yet supported, ignoring");
|
||||
}
|
||||
}
|
||||
else if (line.ToLower().StartsWith("fourscore"))
|
||||
else if (line.StartsWith("fourscore", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
bool fourscore = ParseHeader(line, "fourscore") == "1";
|
||||
if (fourscore)
|
||||
|
@ -162,7 +162,7 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
|
||||
private IControllerDeck _deck;
|
||||
|
||||
|
||||
private readonly string[] _buttons = { "Right", "Left", "Down", "Up", "Start", "Select", "B", "A" };
|
||||
private void ImportInputFrame(string line)
|
||||
{
|
||||
|
@ -244,7 +244,7 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
|
||||
// base64
|
||||
if (!blob.ToLower().StartsWith("base64:"))
|
||||
if (!blob.StartsWith("base64:", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -117,8 +117,7 @@ namespace BizHawk.Client.Common
|
|||
protected static string ParseHeader(string line, string headerName)
|
||||
{
|
||||
// Case-insensitive search.
|
||||
int x = line.ToLower().LastIndexOf(
|
||||
headerName.ToLower()) + headerName.Length;
|
||||
int x = line.LastIndexOf(headerName, StringComparison.OrdinalIgnoreCase) + headerName.Length;
|
||||
string str = line.Substring(x + 1, line.Length - x - 1);
|
||||
return str.Trim();
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Linq;
|
||||
|
@ -177,7 +178,7 @@ namespace BizHawk.Client.Common.movie.import
|
|||
}
|
||||
Result.Movie.AppendFrame(_previousControllers);
|
||||
}
|
||||
else if (item.FullName.StartsWith("moviesram."))
|
||||
else if (item.FullName.StartsWithOrdinal("moviesram."))
|
||||
{
|
||||
using var stream = item.Open();
|
||||
byte[] movieSram = stream.ReadAllBytes();
|
||||
|
@ -212,7 +213,7 @@ namespace BizHawk.Client.Common.movie.import
|
|||
|
||||
Result.Movie.Rerecords = rerecordCount;
|
||||
}
|
||||
else if (item.FullName.EndsWith(".sha256"))
|
||||
else if (item.FullName.EndsWithOrdinal(".sha256"))
|
||||
{
|
||||
using var stream = item.Open();
|
||||
string sha256Hash = Encoding.UTF8.GetString(stream.ReadAllBytes()).Trim();
|
||||
|
@ -318,7 +319,7 @@ namespace BizHawk.Client.Common.movie.import
|
|||
if (player > _playerCount) break;
|
||||
|
||||
IReadOnlyList<string> buttons = controllers.Definition.ControlsOrdered[player];
|
||||
if (buttons[0].EndsWith("Up")) // hack to identify gamepad / multitap which have a different button order in bizhawk compared to lsnes
|
||||
if (buttons[0].EndsWithOrdinal("Up")) // hack to identify gamepad / multitap which have a different button order in bizhawk compared to lsnes
|
||||
{
|
||||
buttons = new[] { "B", "Y", "Select", "Start", "Up", "Down", "Left", "Right", "A", "X", "L", "R" }
|
||||
.Select(button => $"P{player} {button}")
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using BizHawk.Emulation.Common;
|
||||
using System;
|
||||
using BizHawk.Emulation.Common;
|
||||
using BizHawk.Emulation.Cores.PCEngine;
|
||||
|
||||
namespace BizHawk.Client.Common.movie.import
|
||||
|
@ -43,8 +44,7 @@ namespace BizHawk.Client.Common.movie.import
|
|||
{
|
||||
ImportTextFrame(line);
|
||||
}
|
||||
else if (line.ToLower()
|
||||
.StartsWith("ports"))
|
||||
else if (line.StartsWith("ports", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
var portNumStr = ParseHeader(line, "ports");
|
||||
if (int.TryParse(portNumStr, out int ports))
|
||||
|
@ -83,32 +83,32 @@ namespace BizHawk.Client.Common.movie.import
|
|||
ss.Port5);
|
||||
}
|
||||
}
|
||||
else if (line.ToLower().StartsWith("pcecd"))
|
||||
else if (line.StartsWith("pcecd", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
Result.Movie.HeaderEntries[HeaderKeys.Platform] = VSystemID.Raw.PCECD;
|
||||
}
|
||||
else if (line.ToLower().StartsWith("emuversion"))
|
||||
else if (line.StartsWith("emuversion", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
Result.Movie.Comments.Add($"{EmulationOrigin} Mednafen/PCEjin version {ParseHeader(line, "emuVersion")}");
|
||||
}
|
||||
else if (line.ToLower().StartsWith("version"))
|
||||
else if (line.StartsWith("version", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
string version = ParseHeader(line, "version");
|
||||
Result.Movie.Comments.Add($"{MovieOrigin} .mc2 version {version}");
|
||||
}
|
||||
else if (line.ToLower().StartsWith("romfilename"))
|
||||
else if (line.StartsWith("romfilename", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
Result.Movie.HeaderEntries[HeaderKeys.GameName] = ParseHeader(line, "romFilename");
|
||||
}
|
||||
else if (line.ToLower().StartsWith("cdgamename"))
|
||||
else if (line.StartsWith("cdgamename", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
Result.Movie.HeaderEntries[HeaderKeys.GameName] = ParseHeader(line, "cdGameName");
|
||||
}
|
||||
else if (line.ToLower().StartsWith("comment author"))
|
||||
else if (line.StartsWith("comment author", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
Result.Movie.HeaderEntries[HeaderKeys.Author] = ParseHeader(line, "comment author");
|
||||
}
|
||||
else if (line.ToLower().StartsWith("rerecordcount"))
|
||||
else if (line.StartsWith("rerecordcount", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
int rerecordCount;
|
||||
|
||||
|
@ -124,7 +124,7 @@ namespace BizHawk.Client.Common.movie.import
|
|||
|
||||
Result.Movie.Rerecords = (ulong)rerecordCount;
|
||||
}
|
||||
else if (line.ToLower().StartsWith("startsfromsavestate"))
|
||||
else if (line.StartsWith("startsfromsavestate", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
// If this movie starts from a savestate, we can't support it.
|
||||
if (ParseHeader(line, "StartsFromSavestate") == "1")
|
||||
|
|
|
@ -35,7 +35,7 @@ namespace BizHawk.Client.Common.movie.import
|
|||
uint rerecordCount = r.ReadUInt32();
|
||||
Result.Movie.Rerecords = rerecordCount;
|
||||
|
||||
|
||||
|
||||
// 0010: 4-byte little endian flag: begin from reset?
|
||||
uint reset = r.ReadUInt32();
|
||||
if (reset == 0)
|
||||
|
@ -92,7 +92,7 @@ namespace BizHawk.Client.Common.movie.import
|
|||
|
||||
// 00e4-00f3: binary: rom MD5 digest
|
||||
byte[] md5 = r.ReadBytes(16);
|
||||
Result.Movie.HeaderEntries[HeaderKeys.Md5] = md5.BytesToHexString().ToLower();
|
||||
Result.Movie.HeaderEntries[HeaderKeys.Md5] = md5.BytesToHexString().ToLowerInvariant();
|
||||
|
||||
var ss = new SMS.SmsSyncSettings();
|
||||
var cd = new SMSControllerDeck(ss.Port1, ss.Port2, isGameGear, ss.UseKeyboard);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
using System.IO;
|
||||
|
||||
using BizHawk.Common.StringExtensions;
|
||||
using BizHawk.Emulation.Common;
|
||||
using BizHawk.Emulation.Cores.Sony.PSX;
|
||||
|
||||
|
@ -315,7 +315,7 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
|
||||
// Gross, if not CR LF, this will fail, but will the PSXjin?
|
||||
if (!mnemonicStr.EndsWith("|\r\n"))
|
||||
if (!mnemonicStr.EndsWithOrdinal("|\r\n"))
|
||||
{
|
||||
Result.Errors.Add("Unable to parse text input, unknown configuration");
|
||||
}
|
||||
|
|
|
@ -45,20 +45,20 @@ namespace BizHawk.Client.Common.movie.import
|
|||
{
|
||||
ImportTextFrame(line);
|
||||
}
|
||||
else if (line.ToLower().StartsWith("emuversion"))
|
||||
else if (line.StartsWith("emuversion", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
Result.Movie.Comments.Add($"{EmulationOrigin} Yabause version {ParseHeader(line, "emuVersion")}");
|
||||
}
|
||||
else if (line.ToLower().StartsWith("version"))
|
||||
else if (line.StartsWith("version", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
string version = ParseHeader(line, "version");
|
||||
Result.Movie.Comments.Add($"{MovieOrigin} .ymv version {version}");
|
||||
}
|
||||
else if (line.ToLower().StartsWith("cdGameName"))
|
||||
else if (line.StartsWith("cdGameName", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
Result.Movie.HeaderEntries[HeaderKeys.GameName] = ParseHeader(line, "romFilename");
|
||||
}
|
||||
else if (line.ToLower().StartsWith("rerecordcount"))
|
||||
else if (line.StartsWith("rerecordcount", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
int rerecordCount;
|
||||
|
||||
|
@ -74,7 +74,7 @@ namespace BizHawk.Client.Common.movie.import
|
|||
|
||||
Result.Movie.Rerecords = (ulong)rerecordCount;
|
||||
}
|
||||
else if (line.ToLower().StartsWith("startsfromsavestate"))
|
||||
else if (line.StartsWith("startsfromsavestate", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
// If this movie starts from a savestate, we can't support it.
|
||||
if (ParseHeader(line, "StartsFromSavestate") == "1")
|
||||
|
@ -82,7 +82,7 @@ namespace BizHawk.Client.Common.movie.import
|
|||
Result.Errors.Add("Movies that begin with a savestate are not supported.");
|
||||
}
|
||||
}
|
||||
else if (line.ToLower().StartsWith("ispal"))
|
||||
else if (line.StartsWith("ispal", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
bool pal = ParseHeader(line, "isPal") == "1";
|
||||
Result.Movie.HeaderEntries[HeaderKeys.Pal] = pal.ToString();
|
||||
|
|
|
@ -56,11 +56,11 @@ namespace BizHawk.Client.Common
|
|||
{
|
||||
Add(splitLine[0], splitLine[1]);
|
||||
}
|
||||
else if (line.StartsWith("subtitle") || line.StartsWith("sub"))
|
||||
else if (line.StartsWithOrdinal("subtitle") || line.StartsWithOrdinal("sub"))
|
||||
{
|
||||
Subtitles.AddFromString(line);
|
||||
}
|
||||
else if (line.StartsWith("comment"))
|
||||
else if (line.StartsWithOrdinal("comment"))
|
||||
{
|
||||
Comments.Add(line.Substring(8, line.Length - 8));
|
||||
}
|
||||
|
|
|
@ -238,7 +238,7 @@ namespace BizHawk.Client.Common
|
|||
|
||||
counter++;
|
||||
}
|
||||
else if (line.StartsWith("Frame "))
|
||||
else if (line.StartsWithOrdinal("Frame "))
|
||||
{
|
||||
var split = line.Split(' ');
|
||||
try
|
||||
|
@ -251,7 +251,7 @@ namespace BizHawk.Client.Common
|
|||
return false;
|
||||
}
|
||||
}
|
||||
else if (line.StartsWith("LogKey:"))
|
||||
else if (line.StartsWithOrdinal("LogKey:"))
|
||||
{
|
||||
LogKey = line.Replace("LogKey:", "");
|
||||
}
|
||||
|
@ -327,7 +327,7 @@ namespace BizHawk.Client.Common
|
|||
if (_changes != value)
|
||||
{
|
||||
_changes = value;
|
||||
OnPropertyChanged("Changes");
|
||||
OnPropertyChanged(nameof(Changes));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,12 +32,12 @@ namespace BizHawk.Client.Common
|
|||
|
||||
if (x.Address.Equals(y.Address))
|
||||
{
|
||||
if (x.Domain.Name.Equals(y.Domain.Name))
|
||||
if (x.Domain.Name.Equals(y.Domain.Name, System.StringComparison.Ordinal))
|
||||
{
|
||||
return x.Size.CompareTo(y.Size);
|
||||
}
|
||||
|
||||
return x.Domain.Name.CompareTo(y.Domain.Name);
|
||||
return string.CompareOrdinal(x.Domain.Name, y.Domain.Name);
|
||||
}
|
||||
|
||||
return x.Address.CompareTo(y.Address);
|
||||
|
|
|
@ -30,7 +30,7 @@ namespace BizHawk.Client.Common
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (x.Domain.Name.Equals(y.Domain.Name))
|
||||
if (x.Domain.Name.Equals(y.Domain.Name, System.StringComparison.Ordinal))
|
||||
{
|
||||
if (x.Address.Equals(y.Address))
|
||||
{
|
||||
|
@ -40,7 +40,7 @@ namespace BizHawk.Client.Common
|
|||
return x.Address.CompareTo(y.Address);
|
||||
}
|
||||
|
||||
return x.Domain.Name.CompareTo(y.Domain.Name);
|
||||
return string.CompareOrdinal(x.Domain.Name, y.Domain.Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace BizHawk.Client.Common
|
||||
{
|
||||
|
@ -31,7 +32,7 @@ namespace BizHawk.Client.Common
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (string.Compare(x.Notes, y.Notes, true) == 0)
|
||||
if (string.Compare(x.Notes, y.Notes, StringComparison.OrdinalIgnoreCase) == 0)
|
||||
{
|
||||
if (x.Address.Equals(y.Address))
|
||||
{
|
||||
|
@ -41,7 +42,7 @@ namespace BizHawk.Client.Common
|
|||
return x.Address.CompareTo(y.Address);
|
||||
}
|
||||
|
||||
return string.Compare(x.Notes, y.Notes, true);
|
||||
return string.Compare(x.Notes, y.Notes, StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ namespace BizHawk.Client.Common
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (x.Diff.Equals(y.Diff))
|
||||
if (x.Diff.Equals(y.Diff, System.StringComparison.Ordinal))
|
||||
{
|
||||
if (x.Address.Equals(y.Address))
|
||||
{
|
||||
|
@ -40,7 +40,7 @@ namespace BizHawk.Client.Common
|
|||
return x.Address.CompareTo(y.Address);
|
||||
}
|
||||
|
||||
return x.Diff.CompareTo(y.Diff);
|
||||
return string.CompareOrdinal(x.Diff, y.Diff);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,11 +50,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
var name = Path.Combine(dir!, $"{fileNoExt}_{_frame}{ext}");
|
||||
BitmapBuffer bb = new BitmapBuffer(source.BufferWidth, source.BufferHeight, source.GetVideoBuffer());
|
||||
using var bmp = bb.ToSysdrawingBitmap();
|
||||
if (ext.ToUpper() == ".PNG")
|
||||
if (ext.ToUpperInvariant() == ".PNG")
|
||||
{
|
||||
bmp.Save(name, ImageFormat.Png);
|
||||
}
|
||||
else if (ext.ToUpper() == ".JPG")
|
||||
else if (ext.ToUpperInvariant() == ".JPG")
|
||||
{
|
||||
bmp.Save(name, ImageFormat.Jpeg);
|
||||
}
|
||||
|
|
|
@ -602,7 +602,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
public void OpenFile(string baseName)
|
||||
{
|
||||
string ext = Path.GetExtension(baseName);
|
||||
if (ext == null || ext.ToLower() != ".jmd")
|
||||
if (ext == null || ext.ToLowerInvariant() != ".jmd")
|
||||
{
|
||||
baseName += ".jmd";
|
||||
}
|
||||
|
|
|
@ -23,15 +23,15 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
// Digits are OK
|
||||
}
|
||||
else if (keyInput.Equals(decimalSeparator) && AllowDecimal)
|
||||
else if (keyInput.Equals(decimalSeparator, System.StringComparison.Ordinal) && AllowDecimal)
|
||||
{
|
||||
// Decimal separator is OK
|
||||
}
|
||||
else if (keyInput.Equals(negativeSign) && AllowNegative)
|
||||
else if (keyInput.Equals(negativeSign, System.StringComparison.Ordinal) && AllowNegative)
|
||||
{
|
||||
// Negative is OK
|
||||
}
|
||||
else if (keyInput.Equals(groupSeparator))
|
||||
else if (keyInput.Equals(groupSeparator, System.StringComparison.Ordinal))
|
||||
{
|
||||
// group separator is ok
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
lvi.Text = item.Name;
|
||||
long size = item.Size;
|
||||
var extension = Path.GetExtension(item.Name);
|
||||
if (extension != null && size % 1024 == 16 && extension.ToUpper() == ".NES")
|
||||
if (extension != null && size % 1024 == 16 && extension.ToUpperInvariant() == ".NES")
|
||||
size -= 16;
|
||||
lvi.SubItems[1].Text = Util.FormatFileSize(size);
|
||||
_archiveItems.Add(lvi);
|
||||
|
@ -206,7 +206,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
public string[] Keys { get; set; }
|
||||
public bool Matches(ListViewItem value)
|
||||
{
|
||||
string searchedStr = value.Text.ToLower();
|
||||
string searchedStr = value.Text.ToLowerInvariant();
|
||||
foreach (string key in Keys)
|
||||
{
|
||||
if (!searchedStr.Contains(key))
|
||||
|
@ -234,7 +234,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
return new SimpleMatcher
|
||||
{
|
||||
Keys = searchKey.ToLower().Split(Array.Empty<char>(), StringSplitOptions.RemoveEmptyEntries) // splits on all whitespace chars
|
||||
Keys = searchKey.ToLowerInvariant().Split(Array.Empty<char>(), StringSplitOptions.RemoveEmptyEntries) // splits on all whitespace chars
|
||||
};
|
||||
}
|
||||
else
|
||||
|
|
|
@ -71,7 +71,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
int row = c1.RowIndex.Value.CompareTo(c2.RowIndex.Value);
|
||||
return row == 0
|
||||
? string.Compare(c1.Column?.Name, c2.Column?.Name)
|
||||
? string.CompareOrdinal(c1.Column?.Name, c2.Column?.Name)
|
||||
: row;
|
||||
}
|
||||
|
||||
|
@ -83,7 +83,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
return -1;
|
||||
}
|
||||
|
||||
return c1.Column.Name.CompareTo(c2.Column.Name);
|
||||
return string.CompareOrdinal(c1.Column.Name, c2.Column.Name);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
/// <remarks>http://stackoverflow.com/questions/139010/how-to-resolve-a-lnk-in-c-sharp</remarks>
|
||||
public static string ResolveShortcut(string filename)
|
||||
{
|
||||
if (filename.Contains("|") || OSTailoredCode.IsUnixHost || !".lnk".Equals(Path.GetExtension(filename), StringComparison.InvariantCultureIgnoreCase)) return filename; // archive internal files are never shortcuts (and choke when analyzing any further)
|
||||
if (filename.Contains("|") || OSTailoredCode.IsUnixHost || !".lnk".Equals(Path.GetExtension(filename), StringComparison.OrdinalIgnoreCase)) return filename; // archive internal files are never shortcuts (and choke when analyzing any further)
|
||||
var link = new ShellLinkImports.ShellLink();
|
||||
const uint STGM_READ = 0;
|
||||
((ShellLinkImports.IPersistFile) link).Load(filename, STGM_READ);
|
||||
|
|
|
@ -250,7 +250,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
initFileName: $"{game.FilesystemSafeName()}-{suffix}");
|
||||
if (result is null) return;
|
||||
FileInfo file = new(result);
|
||||
string extension = file.Extension.ToUpper();
|
||||
string extension = file.Extension.ToUpperInvariant();
|
||||
ImageFormat i = extension switch
|
||||
{
|
||||
".BMP" => ImageFormat.Bmp,
|
||||
|
|
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
|
@ -1109,7 +1110,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
if (ie.LogicalButton.Button.Length == 1)
|
||||
{
|
||||
var c = ie.LogicalButton.Button.ToLower()[0];
|
||||
var c = ie.LogicalButton.Button.ToLowerInvariant()[0];
|
||||
if ((c >= 'a' && c <= 'z') || c == ' ')
|
||||
{
|
||||
SendAltKeyChar(c);
|
||||
|
@ -1308,7 +1309,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
using (var bb = Config.ScreenshotCaptureOsd ? CaptureOSD() : MakeScreenshotImage())
|
||||
{
|
||||
using var img = bb.ToSysdrawingBitmap();
|
||||
if (Path.GetExtension(path).ToUpper() == ".JPG")
|
||||
if (Path.GetExtension(path).ToUpperInvariant() == ".JPG")
|
||||
{
|
||||
img.Save(fi.FullName, ImageFormat.Jpeg);
|
||||
}
|
||||
|
@ -2448,7 +2449,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
BindingFlags.NonPublic | BindingFlags.InvokeMethod | BindingFlags.Instance,
|
||||
null,
|
||||
MainformMenu,
|
||||
new object/*?*/[] { c });
|
||||
new object/*?*/[] { c },
|
||||
CultureInfo.InvariantCulture);
|
||||
|
||||
public static readonly FilesystemFilterSet ConfigFileFSFilterSet = new(new FilesystemFilter("Config File", new[] { "ini" }))
|
||||
{
|
||||
|
|
|
@ -32,7 +32,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
? $"{RomGame.RomData.Length / 1024 / 1024:n0}mb"
|
||||
: $"{RomGame.RomData.Length / 1024:n0}kb";
|
||||
|
||||
ExtensionLabel.Text = RomGame.Extension.ToLower();
|
||||
ExtensionLabel.Text = RomGame.Extension.ToLowerInvariant();
|
||||
HashBox.Text = RomGame.GameInfo.Hash;
|
||||
int count = 0;
|
||||
int spacing = 25;
|
||||
|
@ -67,7 +67,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
if (AlwaysCheckbox.Checked)
|
||||
{
|
||||
_config.PreferredPlatformsForExtensions[RomGame.Extension.ToLower()] = PlatformChoice;
|
||||
_config.PreferredPlatformsForExtensions[RomGame.Extension.ToLowerInvariant()] = PlatformChoice;
|
||||
}
|
||||
|
||||
Close();
|
||||
|
|
|
@ -7,6 +7,7 @@ using Newtonsoft.Json;
|
|||
using BizHawk.BizInvoke;
|
||||
using BizHawk.Common;
|
||||
using BizHawk.Client.Common;
|
||||
using BizHawk.Common.StringExtensions;
|
||||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
|
@ -46,7 +47,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private static bool DownloadDll(string url)
|
||||
{
|
||||
if (url.StartsWith("http:"))
|
||||
if (url.StartsWithOrdinal("http:"))
|
||||
{
|
||||
// force https
|
||||
url = url.Replace("http:", "https:");
|
||||
|
|
|
@ -108,7 +108,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
exePath = Encoding.ASCII.GetString(buf2048);
|
||||
|
||||
// "BOOT = cdrom:" precedes the path
|
||||
var index = exePath.IndexOf("BOOT = cdrom:");
|
||||
var index = exePath.IndexOf("BOOT = cdrom:", StringComparison.Ordinal);
|
||||
if (index < -1) break;
|
||||
exePath = exePath.Remove(0, index + 13);
|
||||
|
||||
|
|
|
@ -113,7 +113,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
var lva = (ListViewItem)a;
|
||||
var lvb = (ListViewItem)b;
|
||||
return Sign * string.Compare(lva.SubItems[Column].Text, lvb.SubItems[Column].Text);
|
||||
return Sign * string.CompareOrdinal(lva.SubItems[Column].Text, lvb.SubItems[Column].Text);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -203,7 +203,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
if (e.IsPressed(Keys.Enter) || e.IsPressed(Keys.Tab))
|
||||
{
|
||||
var k = HotkeyInfo.AllHotkeys.FirstOrNull(kvp => string.Compare(kvp.Value.DisplayName, SearchBox.Text, true) is 0)?.Key;
|
||||
var k = HotkeyInfo.AllHotkeys.FirstOrNull(kvp => string.Compare(kvp.Value.DisplayName, SearchBox.Text, StringComparison.OrdinalIgnoreCase) is 0)?.Key;
|
||||
|
||||
// Found
|
||||
if (k is not null)
|
||||
|
|
|
@ -210,7 +210,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
foreach (var ext in MovieService.MovieExtensions)
|
||||
{
|
||||
if ($".{ext}".Equals(Path.GetExtension(_movieList[indices[i]].Filename), StringComparison.InvariantCultureIgnoreCase))
|
||||
if ($".{ext}".Equals(Path.GetExtension(_movieList[indices[i]].Filename), StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
tas.Add(i);
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ using System.Windows.Forms;
|
|||
using BizHawk.Client.Common;
|
||||
using BizHawk.Client.EmuHawk.Properties;
|
||||
using BizHawk.Common.NumberExtensions;
|
||||
using BizHawk.Common.StringExtensions;
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
|
@ -64,7 +65,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
BreakpointCallback(addr, value, flags);
|
||||
|
||||
var seekBreakpoint = _breakpoints.FirstOrDefault(x => x.Name.StartsWith(SeekName));
|
||||
var seekBreakpoint = _breakpoints.FirstOrDefault(x => x.Name.StartsWithOrdinal(SeekName));
|
||||
|
||||
if (seekBreakpoint != null)
|
||||
{
|
||||
|
@ -166,7 +167,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
public void RemoveCurrentSeek()
|
||||
{
|
||||
var seekBreakpoint = _breakpoints.FirstOrDefault(x => x.Name.StartsWith(SeekName));
|
||||
var seekBreakpoint = _breakpoints.FirstOrDefault(x => x.Name.StartsWithOrdinal(SeekName));
|
||||
|
||||
if (seekBreakpoint != null)
|
||||
{
|
||||
|
|
|
@ -44,7 +44,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
try
|
||||
{
|
||||
var code = l.ToUpper().Trim();
|
||||
var code = l.ToUpperInvariant().Trim();
|
||||
var decoder = new GameSharkDecoder(MemoryDomains, Emulator.SystemId);
|
||||
var result = decoder.Decode(code);
|
||||
var domain = decoder.CheatDomain();
|
||||
|
@ -82,4 +82,4 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -281,7 +281,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
long found = -1;
|
||||
|
||||
var search = value.Replace(" ", "").ToUpper();
|
||||
var search = value.Replace(" ", "").ToUpperInvariant();
|
||||
if (string.IsNullOrEmpty(search))
|
||||
{
|
||||
return;
|
||||
|
@ -341,7 +341,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
long found = -1;
|
||||
|
||||
var search = value.Replace(" ", "").ToUpper();
|
||||
var search = value.Replace(" ", "").ToUpperInvariant();
|
||||
if (string.IsNullOrEmpty(search))
|
||||
{
|
||||
return;
|
||||
|
|
|
@ -1456,7 +1456,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
textbox.Multiline = multiline;
|
||||
if (scrollbars != null)
|
||||
{
|
||||
switch (scrollbars.ToUpper())
|
||||
switch (scrollbars.ToUpperInvariant())
|
||||
{
|
||||
case "VERTICAL":
|
||||
textbox.ScrollBars = ScrollBars.Vertical;
|
||||
|
@ -1489,7 +1489,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
if (boxtype != null)
|
||||
{
|
||||
switch (boxtype.ToUpper())
|
||||
switch (boxtype.ToUpperInvariant())
|
||||
{
|
||||
case "HEX":
|
||||
case "HEXADECIMAL":
|
||||
|
|
|
@ -14,6 +14,7 @@ using BizHawk.Client.EmuHawk.ToolExtensions;
|
|||
using BizHawk.Common;
|
||||
using BizHawk.Common.CollectionExtensions;
|
||||
using BizHawk.Common.PathExtensions;
|
||||
using BizHawk.Common.StringExtensions;
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
|
@ -446,7 +447,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private string DressUpRelative(string path)
|
||||
{
|
||||
return path.StartsWith(".\\") ? path.Replace(".\\", "") : path;
|
||||
return path.StartsWithOrdinal(".\\") ? path.Replace(".\\", "") : path;
|
||||
}
|
||||
|
||||
private void UpdateNumberOfScripts()
|
||||
|
@ -1267,12 +1268,12 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
foreach (var path in filePaths)
|
||||
{
|
||||
if (Path.GetExtension(path)?.ToLower() == ".lua" || Path.GetExtension(path)?.ToLower() == ".txt")
|
||||
if (Path.GetExtension(path)?.ToLowerInvariant() == ".lua" || Path.GetExtension(path)?.ToLowerInvariant() == ".txt")
|
||||
{
|
||||
LoadLuaFile(path);
|
||||
UpdateDialog();
|
||||
}
|
||||
else if (Path.GetExtension(path)?.ToLower() == ".luases")
|
||||
else if (Path.GetExtension(path)?.ToLowerInvariant() == ".luases")
|
||||
{
|
||||
LoadLuaSession(path);
|
||||
return;
|
||||
|
|
|
@ -283,7 +283,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
var fStyle = FontStyle.Regular;
|
||||
if (fontStyle != null)
|
||||
{
|
||||
switch (fontStyle.ToLower())
|
||||
switch (fontStyle.ToLowerInvariant())
|
||||
{
|
||||
default:
|
||||
case "regular":
|
||||
|
@ -311,7 +311,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
if (horizAlign != null)
|
||||
{
|
||||
switch (horizAlign.ToLower())
|
||||
switch (horizAlign.ToLowerInvariant())
|
||||
{
|
||||
default:
|
||||
case "left":
|
||||
|
@ -328,7 +328,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
if (vertAlign != null)
|
||||
{
|
||||
switch (vertAlign.ToLower())
|
||||
switch (vertAlign.ToLowerInvariant())
|
||||
{
|
||||
default:
|
||||
case "top":
|
||||
|
|
|
@ -62,7 +62,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
AddButton_Click(null, null);
|
||||
AddButton_Click(null, null);
|
||||
|
||||
if (!Game.IsNullInstance() && !MainForm.CurrentlyOpenRom.EndsWith(".xml"))
|
||||
if (!Game.IsNullInstance() && !MainForm.CurrentlyOpenRom.EndsWithOrdinal(".xml"))
|
||||
{
|
||||
if (MainForm.CurrentlyOpenRom.Contains("|"))
|
||||
{
|
||||
|
|
|
@ -99,12 +99,12 @@ namespace BizHawk.Client.EmuHawk
|
|||
public bool LoadMovieFile(string filename, bool askToSave = true)
|
||||
{
|
||||
if (askToSave && !AskSaveChanges()) return false;
|
||||
if (filename.EndsWith(MovieService.TasMovieExtension))
|
||||
if (filename.EndsWithOrdinal(MovieService.TasMovieExtension))
|
||||
{
|
||||
LoadFileWithFallback(filename);
|
||||
return true; //TODO should this return false if it fell back to a new project?
|
||||
}
|
||||
if (filename.EndsWith(MovieService.StandardMovieExtension))
|
||||
if (filename.EndsWithOrdinal(MovieService.StandardMovieExtension))
|
||||
{
|
||||
if (!DialogController.ShowMessageBox2(
|
||||
caption: "Convert movie",
|
||||
|
@ -1209,7 +1209,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
int workingHeight = Screen.FromControl(this).WorkingArea.Height;
|
||||
int rowHeight = ColumnsSubMenu.Height + 4;
|
||||
int maxRows = workingHeight / rowHeight;
|
||||
int keyCount = columns.Count(c => c.Name.StartsWith("Key "));
|
||||
int keyCount = columns.Count(c => c.Name.StartsWithOrdinal("Key "));
|
||||
int keysMenusCount = (int)Math.Ceiling((double)keyCount / maxRows);
|
||||
|
||||
var keysMenus = new ToolStripMenuItem[keysMenusCount];
|
||||
|
@ -1248,7 +1248,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
((ToolStripMenuItem)sender.OwnerItem).ShowDropDown();
|
||||
};
|
||||
|
||||
if (column.Name.StartsWith("Key "))
|
||||
if (column.Name.StartsWithOrdinal("Key "))
|
||||
{
|
||||
keysMenus
|
||||
.First(m => m.DropDownItems.Count < maxRows)
|
||||
|
|
|
@ -9,6 +9,7 @@ using BizHawk.Client.Common;
|
|||
using BizHawk.Client.EmuHawk.ToolExtensions;
|
||||
using BizHawk.Client.EmuHawk.Properties;
|
||||
using BizHawk.Common;
|
||||
using BizHawk.Common.StringExtensions;
|
||||
using BizHawk.Emulation.Common;
|
||||
using BizHawk.Emulation.Cores.Nintendo.N64;
|
||||
|
||||
|
@ -383,29 +384,29 @@ namespace BizHawk.Client.EmuHawk
|
|||
|| c.Name == "Light Sensor"
|
||||
|| c.Name == "Disc Select"
|
||||
|| c.Name == "Disk Index"
|
||||
|| c.Name.StartsWith("Tilt")
|
||||
|| c.Name.StartsWith("Key ")
|
||||
|| c.Name.StartsWith("Open")
|
||||
|| c.Name.StartsWith("Close")
|
||||
|| c.Name.EndsWith("Tape")
|
||||
|| c.Name.EndsWith("Disk")
|
||||
|| c.Name.EndsWith("Block")
|
||||
|| c.Name.EndsWith("Status"));
|
||||
|| c.Name.StartsWithOrdinal("Tilt")
|
||||
|| c.Name.StartsWithOrdinal("Key ")
|
||||
|| c.Name.StartsWithOrdinal("Open")
|
||||
|| c.Name.StartsWithOrdinal("Close")
|
||||
|| c.Name.EndsWithOrdinal("Tape")
|
||||
|| c.Name.EndsWithOrdinal("Disk")
|
||||
|| c.Name.EndsWithOrdinal("Block")
|
||||
|| c.Name.EndsWithOrdinal("Status"));
|
||||
|
||||
if (Emulator.SystemId is VSystemID.Raw.N64)
|
||||
{
|
||||
foreach (var c in TasView.AllColumns
|
||||
.Where(static c => c.Name.EndsWith(" C Up") || c.Name.EndsWith(" C Down")
|
||||
|| c.Name.EndsWith(" C Left") || c.Name.EndsWith(" C Right")))
|
||||
.Where(static c => c.Name.EndsWithOrdinal(" C Up") || c.Name.EndsWithOrdinal(" C Down")
|
||||
|| c.Name.EndsWithOrdinal(" C Left") || c.Name.EndsWithOrdinal(" C Right")))
|
||||
{
|
||||
c.Text = $"c{c.Text.ToUpperInvariant()}"; // prepend 'c' to differentiate from L/R buttons -- only affects table header
|
||||
}
|
||||
var fakeAnalogControls = TasView.AllColumns
|
||||
.Where(c =>
|
||||
c.Name.EndsWith("A Up")
|
||||
|| c.Name.EndsWith("A Down")
|
||||
|| c.Name.EndsWith("A Left")
|
||||
|| c.Name.EndsWith("A Right"));
|
||||
c.Name.EndsWithOrdinal("A Up")
|
||||
|| c.Name.EndsWithOrdinal("A Down")
|
||||
|| c.Name.EndsWithOrdinal("A Left")
|
||||
|| c.Name.EndsWithOrdinal("A Right"));
|
||||
|
||||
columnsToHide = columnsToHide.Concat(fakeAnalogControls);
|
||||
}
|
||||
|
|
|
@ -14,14 +14,14 @@ namespace BizHawk.Common.PathExtensions
|
|||
public static bool IsSubfolderOf(this string? childPath, string? parentPath)
|
||||
{
|
||||
if (childPath == null || parentPath == null) return false;
|
||||
if (childPath == parentPath || childPath.StartsWith($"{parentPath}{Path.DirectorySeparatorChar}")) return true;
|
||||
if (childPath == parentPath || childPath.StartsWithOrdinal($"{parentPath}{Path.DirectorySeparatorChar}")) return true;
|
||||
|
||||
if (OSTailoredCode.IsUnixHost)
|
||||
{
|
||||
#if true
|
||||
var c = OSTailoredCode.SimpleSubshell("realpath", $"-Lm \"{childPath}\"", $"invalid path {childPath} or missing realpath binary");
|
||||
var p = OSTailoredCode.SimpleSubshell("realpath", $"-Lm \"{parentPath}\"", $"invalid path {parentPath} or missing realpath binary");
|
||||
return c == p || c.StartsWith($"{p}/");
|
||||
return c == p || c.StartsWithOrdinal($"{p}/");
|
||||
#else // written for Unix port but may be useful for Windows when moving to .NET Core
|
||||
var parentUriPath = new Uri(parentPath.TrimEnd('.')).AbsolutePath.TrimEnd('/');
|
||||
try
|
||||
|
@ -72,7 +72,7 @@ namespace BizHawk.Common.PathExtensions
|
|||
if (OSTailoredCode.IsUnixHost)
|
||||
{
|
||||
var realpathOutput = OSTailoredCode.SimpleSubshell("realpath", $"--relative-to=\"{fromPath}\" \"{toPath}\"", $"invalid path {toPath}, invalid path {fromPath}, or missing realpath binary");
|
||||
return !realpathOutput.StartsWith("../") && realpathOutput != "." && realpathOutput != ".." ? $"./{realpathOutput}" : realpathOutput;
|
||||
return !realpathOutput.StartsWithOrdinal("../") && realpathOutput != "." && realpathOutput != ".." ? $"./{realpathOutput}" : realpathOutput;
|
||||
}
|
||||
|
||||
//TODO merge this with the Windows implementation in MakeRelativeTo
|
||||
|
@ -97,14 +97,14 @@ namespace BizHawk.Common.PathExtensions
|
|||
{
|
||||
if (path.IsAbsolute())
|
||||
return path;
|
||||
else
|
||||
{
|
||||
// FileInfo for normalisation ("C:\a\b\..\c" => "C:\a\c")
|
||||
var mycwd = cwd ?? (OSTailoredCode.IsUnixHost ? Environment.CurrentDirectory : CWDHacks.Get());
|
||||
var finalpath = $"{mycwd}/{path}";
|
||||
var fi = new FileInfo(finalpath);
|
||||
return fi.FullName;
|
||||
}
|
||||
else
|
||||
{
|
||||
// FileInfo for normalisation ("C:\a\b\..\c" => "C:\a\c")
|
||||
var mycwd = cwd ?? (OSTailoredCode.IsUnixHost ? Environment.CurrentDirectory : CWDHacks.Get());
|
||||
var finalpath = $"{mycwd}/{path}";
|
||||
var fi = new FileInfo(finalpath);
|
||||
return fi.FullName;
|
||||
}
|
||||
}
|
||||
|
||||
/// <returns>the absolute path equivalent to <paramref name="path"/> which contains <c>%exe%</c> (expanded) as a prefix</returns>
|
||||
|
@ -126,7 +126,7 @@ namespace BizHawk.Common.PathExtensions
|
|||
if (!OSTailoredCode.IsUnixHost) return absolutePath.Replace(basePath, ".").RemoveSuffix(Path.DirectorySeparatorChar);
|
||||
#if true // Unix implementation using realpath
|
||||
var realpathOutput = OSTailoredCode.SimpleSubshell("realpath", $"--relative-base=\"{basePath}\" \"{absolutePath}\"", $"invalid path {absolutePath}, invalid path {basePath}, or missing realpath binary");
|
||||
return !realpathOutput.StartsWith("../") && realpathOutput != "." && realpathOutput != ".." ? $"./{realpathOutput}" : realpathOutput;
|
||||
return !realpathOutput.StartsWithOrdinal("../") && realpathOutput != "." && realpathOutput != ".." ? $"./{realpathOutput}" : realpathOutput;
|
||||
#else // for some reason there were two Unix implementations in the codebase before me? --yoshi
|
||||
// alt. #1
|
||||
if (!IsSubfolder(basePath, absolutePath)) return OSTailoredCode.IsUnixHost && basePath.TrimEnd('.') == $"{absolutePath}/" ? "." : absolutePath;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
|
@ -20,7 +21,7 @@ namespace BizHawk.Common.StringExtensions
|
|||
/// <see langword="true"/> if <paramref name="str"/> appears in <paramref name="options"/> (case-insensitive)
|
||||
/// </returns>
|
||||
public static bool In(this string str, params string[] options) =>
|
||||
options.Any(opt => string.Equals(opt, str, StringComparison.InvariantCultureIgnoreCase));
|
||||
options.Any(opt => string.Equals(opt, str, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
/// <returns>
|
||||
/// <paramref name="str"/> with the first char removed, or
|
||||
|
@ -88,7 +89,7 @@ namespace BizHawk.Common.StringExtensions
|
|||
/// </returns>
|
||||
public static string SubstringAfter(this string str, string delimiter, string notFoundValue)
|
||||
{
|
||||
var index = str.IndexOf(delimiter);
|
||||
var index = str.IndexOf(delimiter, StringComparison.Ordinal);
|
||||
return index < 0 ? notFoundValue : str.Substring(index + delimiter.Length, str.Length - index - delimiter.Length);
|
||||
}
|
||||
|
||||
|
@ -147,7 +148,7 @@ namespace BizHawk.Common.StringExtensions
|
|||
/// </returns>
|
||||
public static string? SubstringBeforeOrNull(this string str, string delimiter)
|
||||
{
|
||||
var index = str.IndexOf(delimiter);
|
||||
var index = str.IndexOf(delimiter, StringComparison.Ordinal);
|
||||
return index < 0 ? null : str.Substring(0, index);
|
||||
}
|
||||
|
||||
|
@ -165,5 +166,9 @@ namespace BizHawk.Common.StringExtensions
|
|||
/// <remarks><c>"abc,def,ghi".TransformFields(',', s => s.Reverse()) == "cba,fed,ihg"</c></remarks>
|
||||
public static string TransformFields(this string str, char delimiter, Func<string, string> transform)
|
||||
=> string.Join(delimiter.ToString(), str.Split(delimiter).Select(transform));
|
||||
|
||||
public static bool StartsWithOrdinal(this string str, string value) => str.StartsWith(value, StringComparison.Ordinal);
|
||||
|
||||
public static bool EndsWithOrdinal(this string str, string value) => str.EndsWith(value, StringComparison.Ordinal);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -142,7 +142,7 @@ namespace BizHawk.Common
|
|||
}
|
||||
for (int i = 0, l = scanResults.Count; i < l; i++)
|
||||
{
|
||||
if (string.Equals(scanResults[i].Name, autobind, StringComparison.InvariantCultureIgnoreCase))
|
||||
if (string.Equals(scanResults[i].Name, autobind, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
BindArchiveMember(i);
|
||||
return;
|
||||
|
|
|
@ -26,7 +26,7 @@ namespace BizHawk.Common
|
|||
return Enum.Parse(
|
||||
enumType,
|
||||
enumType.GetFields(BindingFlags.Public | BindingFlags.Static)
|
||||
.FirstOrDefault(fi => valueStr.Equals((fi.GetCustomAttribute(typeof(DisplayAttribute)) as DisplayAttribute)?.Name))?.Name
|
||||
.FirstOrDefault(fi => valueStr.Equals((fi.GetCustomAttribute(typeof(DisplayAttribute)) as DisplayAttribute)?.Name, StringComparison.Ordinal))?.Name
|
||||
?? valueStr
|
||||
);
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ namespace BizHawk.Common
|
|||
{
|
||||
var (dir, filename) = path.SplitPathToDirAndFile();
|
||||
_ = dir ?? throw new InvalidOperationException();
|
||||
if (!filename.StartsWith("biz-"))
|
||||
if (!filename.StartsWith("biz-", StringComparison.Ordinal))
|
||||
{
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
|
@ -128,4 +128,4 @@ namespace BizHawk.Common
|
|||
Environment.SetEnvironmentVariable("TEMP", path);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -108,7 +108,7 @@ namespace BizHawk.Common
|
|||
/// <returns>all <see cref="Type">Types</see> with the name <paramref name="className"/></returns>
|
||||
/// <remarks>adapted from https://stackoverflow.com/a/13727044/7467292</remarks>
|
||||
public static IList<Type> GetTypeByName(string className) => AppDomain.CurrentDomain.GetAssemblies()
|
||||
.SelectMany(asm => asm.GetTypesWithoutLoadErrors().Where(type => className.Equals(type.Name, StringComparison.InvariantCultureIgnoreCase))).ToList();
|
||||
.SelectMany(asm => asm.GetTypesWithoutLoadErrors().Where(type => className.Equals(type.Name, StringComparison.OrdinalIgnoreCase))).ToList();
|
||||
|
||||
/// <remarks>TODO replace this with GetTypes (i.e. the try block) when VB.NET dep is properly removed</remarks>
|
||||
public static IEnumerable<Type> GetTypesWithoutLoadErrors(this Assembly assembly)
|
||||
|
|
|
@ -8,6 +8,7 @@ using System.Text.RegularExpressions;
|
|||
|
||||
using BizHawk.Common;
|
||||
using BizHawk.Common.CollectionExtensions;
|
||||
using BizHawk.Common.StringExtensions;
|
||||
|
||||
namespace BizHawk.Emulation.Common
|
||||
{
|
||||
|
@ -147,7 +148,7 @@ namespace BizHawk.Emulation.Common
|
|||
}
|
||||
|
||||
// Hack for things like gameboy/ti-83 as opposed to genesis with no controllers plugged in
|
||||
return allNames.Exists(static b => b.StartsWith("Up")) ? 1 : 0;
|
||||
return allNames.Exists(static b => b.StartsWithOrdinal("Up")) ? 1 : 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using BizHawk.Common.StringExtensions;
|
||||
|
||||
namespace BizHawk.Emulation.Common
|
||||
{
|
||||
|
@ -37,7 +38,7 @@ namespace BizHawk.Emulation.Common
|
|||
{
|
||||
for (int i = 0; i < _numCores; i++)
|
||||
{
|
||||
if (register.StartsWith($"P{i + 1} "))
|
||||
if (register.StartsWithOrdinal($"P{i + 1} "))
|
||||
{
|
||||
_linkedCores[i].AsDebuggable().SetCpuRegister(register.Replace($"P{i + 1} ", ""), value);
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
using System;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using BizHawk.Common.StringExtensions;
|
||||
|
||||
namespace BizHawk.Emulation.Common
|
||||
{
|
||||
|
@ -40,7 +41,7 @@ namespace BizHawk.Emulation.Common
|
|||
|
||||
private void ParseDskImage()
|
||||
{
|
||||
string ident = Encoding.ASCII.GetString(_data, 0, 16).ToUpper();
|
||||
string ident = Encoding.ASCII.GetString(_data, 0, 16).ToUpperInvariant();
|
||||
if (ident.Contains("MV - CPC"))
|
||||
{
|
||||
ParseDsk();
|
||||
|
@ -81,8 +82,8 @@ namespace BizHawk.Emulation.Common
|
|||
if (s.SectorData == null || s.SectorData.Length == 0)
|
||||
continue;
|
||||
|
||||
string str = Encoding.ASCII.GetString(s.SectorData, 0, s.SectorData.Length).ToUpper();
|
||||
if (str.Contains("PLUS3DOS"))
|
||||
string str = Encoding.ASCII.GetString(s.SectorData, 0, s.SectorData.Length);
|
||||
if (str.Contains("PLUS3DOS", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
IdentifiedSystem = VSystemID.Raw.ZXSpectrum;
|
||||
return;
|
||||
|
|
|
@ -423,7 +423,7 @@ namespace BizHawk.Emulation.Common
|
|||
// If filename is all-caps, then attempt to proper-case the title.
|
||||
if (!string.IsNullOrWhiteSpace(game.Name) && game.Name == game.Name.ToUpperInvariant())
|
||||
{
|
||||
game.Name = Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase(game.Name.ToLower());
|
||||
game.Name = Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase(game.Name.ToLowerInvariant());
|
||||
}
|
||||
|
||||
return game;
|
||||
|
|
|
@ -47,17 +47,17 @@ namespace BizHawk.Emulation.Cores.Arcades.MAME
|
|||
text + (text == "" ? "" : "\r\n") +
|
||||
string.Join("\r\n", _romHashes.Select(static r => $"{r.Value} - {r.Key}"));
|
||||
|
||||
if (text.ToLower().Contains("imperfect"))
|
||||
if (text.Contains("imperfect", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
lp.Game.Status = RomStatus.Imperfect;
|
||||
}
|
||||
|
||||
if (text.ToLower().Contains("unemulated"))
|
||||
if (text.Contains("unemulated", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
lp.Game.Status = RomStatus.Unimplemented;
|
||||
}
|
||||
|
||||
if (text.ToLower().Contains("doesn't work"))
|
||||
if (text.Contains("doesn't work", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
lp.Game.Status = RomStatus.NotWorking;
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ namespace BizHawk.Emulation.Cores.Arcades.MAME
|
|||
var hashes = string.Concat(_romHashes.Values
|
||||
.Where(static s => s.Contains("SHA:"))
|
||||
.Select(static s => s.Split(' ')
|
||||
.First(static s => s.StartsWith("SHA:"))
|
||||
.First(static s => s.StartsWithOrdinal("SHA:"))
|
||||
.RemovePrefix("SHA:")));
|
||||
|
||||
lp.Game.Name = _gameFullName;
|
||||
|
|
|
@ -15,17 +15,17 @@ namespace BizHawk.Emulation.Cores.Components.FairchildF8
|
|||
//n immediate succeeds the opcode and the displacement (if present)
|
||||
//nn immediately succeeds the opcode and the displacement (if present)
|
||||
|
||||
if (format.IndexOf("nn") != -1)
|
||||
if (format.IndexOf("nn", StringComparison.Ordinal) != -1)
|
||||
{
|
||||
format = format.Replace("nn", read(addr++)
|
||||
.ToString("X2") + read(addr++)
|
||||
.ToString("X2") + "h"); // MSB is read first
|
||||
}
|
||||
|
||||
if (format.IndexOf("n") != -1) format = format.Replace("n", $"{read(addr++):X2}h");
|
||||
if (format.IndexOf("n", StringComparison.Ordinal) != -1) format = format.Replace("n", $"{read(addr++):X2}h");
|
||||
|
||||
if (format.IndexOf("+d") != -1) format = format.Replace("+d", "d");
|
||||
if (format.IndexOf("d") != -1)
|
||||
if (format.IndexOf("+d", StringComparison.Ordinal) != -1) format = format.Replace("+d", "d");
|
||||
if (format.IndexOf("d", StringComparison.Ordinal) != -1)
|
||||
{
|
||||
var b = unchecked((sbyte)read(addr++));
|
||||
format = format.Replace("d", $"{(b < 0 ? '-' : '+')}{(b < 0 ? -b : b):X2}h");
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using BizHawk.Common.StringExtensions;
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
namespace BizHawk.Emulation.Cores.Components.FairchildF8
|
||||
|
@ -274,7 +275,7 @@ namespace BizHawk.Emulation.Cores.Components.FairchildF8
|
|||
|
||||
public void SetCpuRegister(string register, int value)
|
||||
{
|
||||
if (register.StartsWith("SPR"))
|
||||
if (register.StartsWithOrdinal("SPR"))
|
||||
{
|
||||
var reg = Convert.ToInt32(register.Replace("SPR", ""));
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using BizHawk.Common.StringExtensions;
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
// Do not modify this file directly! This is GENERATED code.
|
||||
|
@ -2339,7 +2340,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280
|
|||
case 0xF4: // SET
|
||||
int a; // TODO remove these extra checks
|
||||
string b = Disassemble(PC, out a);
|
||||
if (b.StartsWith("ADC") == false && b.StartsWith("EOR") == false && b.StartsWith("AND") == false && b.StartsWith("ORA") == false)
|
||||
if (b.StartsWithOrdinal("ADC") == false && b.StartsWithOrdinal("EOR") == false && b.StartsWithOrdinal("AND") == false && b.StartsWithOrdinal("ORA") == false)
|
||||
Console.WriteLine("SETTING T FLAG, NEXT INSTRUCTION IS UNHANDLED: {0}", b);
|
||||
FlagT = true;
|
||||
PendingCycles -= 2;
|
||||
|
|
|
@ -13,11 +13,11 @@ namespace BizHawk.Emulation.Cores.Components.Z80A
|
|||
//n immediate succeeds the opcode and the displacement (if present)
|
||||
//nn immediately succeeds the opcode and the displacement (if present)
|
||||
|
||||
if (format.IndexOf("nn") != -1) format = format.Replace("nn", $"{read(addr++) + (read(addr++) << 8):X4}h"); // LSB is read first
|
||||
if (format.IndexOf("n") != -1) format = format.Replace("n", $"{read(addr++):X2}h");
|
||||
if (format.IndexOf("nn", StringComparison.Ordinal) != -1) format = format.Replace("nn", $"{read(addr++) + (read(addr++) << 8):X4}h"); // LSB is read first
|
||||
if (format.IndexOf("n", StringComparison.Ordinal) != -1) format = format.Replace("n", $"{read(addr++):X2}h");
|
||||
|
||||
if (format.IndexOf("+d") != -1) format = format.Replace("+d", "d");
|
||||
if (format.IndexOf("d") != -1)
|
||||
if (format.IndexOf("+d", StringComparison.Ordinal) != -1) format = format.Replace("+d", "d");
|
||||
if (format.IndexOf("d", StringComparison.Ordinal) != -1)
|
||||
{
|
||||
var b = unchecked ((sbyte) read(addr++));
|
||||
format = format.Replace("d", $"{(b < 0 ? '-' : '+')}{(b < 0 ? -b : b):X2}h");
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
|
||||
using BizHawk.Common.StringExtensions;
|
||||
|
||||
namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
|
||||
{
|
||||
/// <summary>
|
||||
/// The abstract class that all emulated models will inherit from
|
||||
|
@ -64,7 +66,7 @@
|
|||
// non matrix keys (J2)
|
||||
foreach (string k in KeyboardDevice.NonMatrixKeys)
|
||||
{
|
||||
if (!k.StartsWith("P2"))
|
||||
if (!k.StartsWithOrdinal("P2"))
|
||||
continue;
|
||||
|
||||
bool currState = CPC._controller.IsPressed(k);
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using BizHawk.Common.StringExtensions;
|
||||
|
||||
namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
|
||||
{
|
||||
|
@ -232,7 +233,7 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
|
|||
string hdr = Encoding.ASCII.GetString(data.Take(16).ToArray());
|
||||
|
||||
// disk checking first
|
||||
if (hdr.ToUpper().Contains("EXTENDED CPC DSK") || hdr.ToUpper().Contains("MV - CPC"))
|
||||
if (hdr.Contains("EXTENDED CPC DSK", StringComparison.OrdinalIgnoreCase) || hdr.Contains("MV - CPC", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
// amstrad .dsk disk file
|
||||
// check for number of sides
|
||||
|
@ -244,7 +245,7 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
|
|||
}
|
||||
|
||||
// tape checking
|
||||
if (hdr.ToUpper().StartsWith("ZXTAPE!"))
|
||||
if (hdr.StartsWith("ZXTAPE!", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
// cdt tape file
|
||||
return CPCMediaType.Tape;
|
||||
|
@ -263,4 +264,3 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
|
|||
DiskDoubleSided
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
using BizHawk.Common;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using BizHawk.Common.StringExtensions;
|
||||
|
||||
namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
|
||||
{
|
||||
|
@ -27,7 +28,7 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
|
|||
// look for standard magic string
|
||||
string ident = Encoding.ASCII.GetString(data, 0, 16);
|
||||
|
||||
if (!ident.ToUpper().Contains("EXTENDED CPC DSK"))
|
||||
if (!ident.Contains("EXTENDED CPC DSK", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
// incorrect format
|
||||
return false;
|
||||
|
@ -152,7 +153,7 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
|
|||
{
|
||||
// look for standard magic string
|
||||
string ident = Encoding.ASCII.GetString(data, 0, 16);
|
||||
if (!ident.ToUpper().Contains("EXTENDED CPC DSK"))
|
||||
if (!ident.Contains("EXTENDED CPC DSK", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
// incorrect format
|
||||
return false;
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
using BizHawk.Common;
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using BizHawk.Common.StringExtensions;
|
||||
|
||||
namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
|
||||
{
|
||||
|
@ -27,7 +28,7 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
|
|||
// look for standard magic string
|
||||
string ident = Encoding.ASCII.GetString(data, 0, 16);
|
||||
|
||||
if (!ident.ToUpper().Contains("MV - CPC"))
|
||||
if (!ident.Contains("MV - CPC", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
// incorrect format
|
||||
return false;
|
||||
|
@ -158,7 +159,7 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
|
|||
{
|
||||
// look for standard magic string
|
||||
string ident = Encoding.ASCII.GetString(data, 0, 16);
|
||||
if (!ident.ToUpper().Contains("MV - CPC"))
|
||||
if (!ident.Contains("MV - CPC", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
// incorrect format
|
||||
return false;
|
||||
|
|
|
@ -3,6 +3,7 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using BizHawk.Common.StringExtensions;
|
||||
|
||||
namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
|
||||
{
|
||||
|
@ -235,7 +236,7 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
|
|||
|
||||
// check for SPEEDLOCK ident in sector 0
|
||||
string ident = Encoding.ASCII.GetString(DiskTracks[0].Sectors[0].SectorData, 0, DiskTracks[0].Sectors[0].SectorData.Length);
|
||||
if (!ident.ToUpper().Contains("SPEEDLOCK"))
|
||||
if (!ident.Contains("SPEEDLOCK", StringComparison.OrdinalIgnoreCase))
|
||||
return false;
|
||||
|
||||
// check for correct sector 0 lengths
|
||||
|
@ -297,7 +298,7 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
|
|||
|
||||
// check for ALKATRAZ ident in sector 0
|
||||
string ident = Encoding.ASCII.GetString(DiskTracks[0].Sectors[0].SectorData, 0, DiskTracks[0].Sectors[0].SectorData.Length);
|
||||
if (!ident.ToUpper().Contains("ALKATRAZ PROTECTION SYSTEM"))
|
||||
if (!ident.Contains("ALKATRAZ PROTECTION SYSTEM", StringComparison.OrdinalIgnoreCase))
|
||||
return false;
|
||||
|
||||
// ALKATRAZ NOTES (-asni 2018-05-01)
|
||||
|
@ -338,7 +339,7 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
|
|||
|
||||
// check for PAUL OWENS ident in sector 2
|
||||
string ident = Encoding.ASCII.GetString(DiskTracks[0].Sectors[2].SectorData, 0, DiskTracks[0].Sectors[2].SectorData.Length);
|
||||
if (!ident.ToUpper().Contains("PAUL OWENS"))
|
||||
if (!ident.Contains("PAUL OWENS", StringComparison.OrdinalIgnoreCase))
|
||||
return false;
|
||||
|
||||
// Paul Owens Disk Protection Notes (-asni 2018-05-01)
|
||||
|
@ -380,7 +381,7 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
|
|||
|
||||
// check for Hexagon ident in sector 8
|
||||
string ident = Encoding.ASCII.GetString(DiskTracks[0].Sectors[8].SectorData, 0, DiskTracks[0].Sectors[8].SectorData.Length);
|
||||
if (ident.ToUpper().Contains("GON DISK PROT"))
|
||||
if (ident.Contains("GON DISK PROT", StringComparison.OrdinalIgnoreCase))
|
||||
return true;
|
||||
|
||||
// hexagon protection may not be labelled as such
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using System.IO;
|
||||
using System.Text;
|
||||
using BizHawk.Common.StringExtensions;
|
||||
|
||||
namespace BizHawk.Emulation.Cores.Computers.Commodore64
|
||||
{
|
||||
|
@ -12,37 +13,36 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64
|
|||
return C64Format.Unknown;
|
||||
}
|
||||
|
||||
using (var mem = new MemoryStream(data))
|
||||
using (var reader = new BinaryReader(new MemoryStream(data)))
|
||||
{
|
||||
var reader = new BinaryReader(mem);
|
||||
var header = Encoding.GetEncoding(437).GetString(reader.ReadBytes(0x10));
|
||||
|
||||
if (header.StartsWith("C64 CARTRIDGE "))
|
||||
if (header.StartsWithOrdinal("C64 CARTRIDGE "))
|
||||
{
|
||||
return C64Format.CRT;
|
||||
}
|
||||
|
||||
if (header.StartsWith("GCR-1541"))
|
||||
if (header.StartsWithOrdinal("GCR-1541"))
|
||||
{
|
||||
return C64Format.G64;
|
||||
}
|
||||
|
||||
if (header.StartsWith("C64S tape image ") || header.StartsWith("C64 tape image f"))
|
||||
if (header.StartsWithOrdinal("C64S tape image ") || header.StartsWithOrdinal("C64 tape image f"))
|
||||
{
|
||||
return C64Format.T64;
|
||||
}
|
||||
|
||||
if (header.StartsWith("C64-TAPE-RAW"))
|
||||
if (header.StartsWithOrdinal("C64-TAPE-RAW"))
|
||||
{
|
||||
return C64Format.TAP;
|
||||
}
|
||||
|
||||
if (header.StartsWith("C64File"))
|
||||
if (header.StartsWithOrdinal("C64File"))
|
||||
{
|
||||
return C64Format.P00; // poo :)
|
||||
}
|
||||
|
||||
if (header.StartsWith("P64-1541"))
|
||||
if (header.StartsWithOrdinal("P64-1541"))
|
||||
{
|
||||
return C64Format.P64;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using BizHawk.Common.StringExtensions;
|
||||
|
||||
namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
||||
{
|
||||
|
@ -66,7 +67,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
|||
// non matrix keys
|
||||
foreach (string k in KeyboardDevice.NonMatrixKeys)
|
||||
{
|
||||
if (!k.StartsWith("Key"))
|
||||
if (!k.StartsWithOrdinal("Key"))
|
||||
continue;
|
||||
|
||||
bool currState = Spectrum._controller.IsPressed(k);
|
||||
|
@ -337,4 +338,3 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using BizHawk.Common.StringExtensions;
|
||||
|
||||
namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
||||
{
|
||||
|
@ -245,7 +246,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
|||
string hdr = Encoding.ASCII.GetString(data.Take(16).ToArray());
|
||||
|
||||
// disk checking first
|
||||
if (hdr.ToUpper().Contains("EXTENDED CPC DSK") || hdr.ToUpper().Contains("MV - CPC"))
|
||||
if (hdr.Contains("EXTENDED CPC DSK", StringComparison.OrdinalIgnoreCase) || hdr.Contains("MV - CPC", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
// spectrum .dsk disk file
|
||||
// check for number of sides
|
||||
|
@ -255,20 +256,20 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
|||
else
|
||||
return SpectrumMediaType.DiskDoubleSided;
|
||||
}
|
||||
if (hdr.ToUpper().StartsWith("FDI"))
|
||||
if (hdr.StartsWith("FDI", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
// spectrum .fdi disk file
|
||||
return SpectrumMediaType.Disk;
|
||||
}
|
||||
if (hdr.ToUpper().StartsWith("CAPS"))
|
||||
if (hdr.StartsWith("CAPS", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
// IPF format file
|
||||
return SpectrumMediaType.Disk;
|
||||
}
|
||||
if (hdr.ToUpper().StartsWith("UDI!") && data[0x08] == 0)
|
||||
if (hdr.StartsWith("UDI!", StringComparison.OrdinalIgnoreCase) && data[0x08] == 0)
|
||||
{
|
||||
// UDI v1.0
|
||||
if (hdr.StartsWith("udi!"))
|
||||
if (hdr.StartsWithOrdinal("udi!"))
|
||||
{
|
||||
throw new NotSupportedException("ZXHawk currently does not supported UDIv1.0 with compression.");
|
||||
}
|
||||
|
@ -282,22 +283,22 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
|||
}
|
||||
|
||||
// tape checking
|
||||
if (hdr.ToUpper().StartsWith("ZXTAPE!"))
|
||||
if (hdr.StartsWith("ZXTAPE!", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
// spectrum .tzx tape file
|
||||
return SpectrumMediaType.Tape;
|
||||
}
|
||||
if (hdr.ToUpper().StartsWith("PZXT"))
|
||||
if (hdr.StartsWith("PZXT", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
// spectrum .tzx tape file
|
||||
return SpectrumMediaType.Tape;
|
||||
}
|
||||
if (hdr.ToUpper().StartsWith("COMPRESSED SQ"))
|
||||
if (hdr.StartsWith("COMPRESSED SQ", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
// spectrum .tzx tape file
|
||||
return SpectrumMediaType.Tape;
|
||||
}
|
||||
if (hdr.ToUpper().Contains("WAVE"))
|
||||
if (hdr.Contains("WAVE", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
// spectrum .tzx tape file
|
||||
return SpectrumMediaType.Tape;
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
using BizHawk.Common;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using BizHawk.Common.StringExtensions;
|
||||
|
||||
namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
||||
{
|
||||
|
@ -27,7 +28,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
|||
// look for standard magic string
|
||||
string ident = Encoding.ASCII.GetString(data, 0, 16);
|
||||
|
||||
if (!ident.ToUpper().Contains("EXTENDED CPC DSK"))
|
||||
if (!ident.Contains("EXTENDED CPC DSK", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
// incorrect format
|
||||
return false;
|
||||
|
@ -163,7 +164,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
|||
{
|
||||
// look for standard magic string
|
||||
string ident = Encoding.ASCII.GetString(data, 0, 16);
|
||||
if (!ident.ToUpper().Contains("EXTENDED CPC DSK"))
|
||||
if (!ident.Contains("EXTENDED CPC DSK", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
// incorrect format
|
||||
return false;
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
using BizHawk.Common;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using BizHawk.Common.StringExtensions;
|
||||
|
||||
namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
||||
{
|
||||
|
@ -27,7 +28,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
|||
// look for standard magic string
|
||||
string ident = Encoding.ASCII.GetString(data, 0, 16);
|
||||
|
||||
if (!ident.ToUpper().Contains("MV - CPC"))
|
||||
if (!ident.Contains("MV - CPC", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
// incorrect format
|
||||
return false;
|
||||
|
@ -168,7 +169,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
|||
{
|
||||
// look for standard magic string
|
||||
string ident = Encoding.ASCII.GetString(data, 0, 16);
|
||||
if (!ident.ToUpper().Contains("MV - CPC"))
|
||||
if (!ident.Contains("MV - CPC", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
// incorrect format
|
||||
return false;
|
||||
|
|
|
@ -3,6 +3,7 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using BizHawk.Common.StringExtensions;
|
||||
|
||||
namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
||||
{
|
||||
|
@ -235,7 +236,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
|||
|
||||
// check for SPEEDLOCK ident in sector 0
|
||||
string ident = Encoding.ASCII.GetString(DiskTracks[0].Sectors[0].SectorData, 0, DiskTracks[0].Sectors[0].SectorData.Length);
|
||||
if (!ident.ToUpper().Contains("SPEEDLOCK"))
|
||||
if (!ident.Contains("SPEEDLOCK", StringComparison.OrdinalIgnoreCase))
|
||||
return false;
|
||||
|
||||
// check for correct sector 0 lengths
|
||||
|
@ -297,7 +298,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
|||
|
||||
// check for ALKATRAZ ident in sector 0
|
||||
string ident = Encoding.ASCII.GetString(DiskTracks[0].Sectors[0].SectorData, 0, DiskTracks[0].Sectors[0].SectorData.Length);
|
||||
if (!ident.ToUpper().Contains("ALKATRAZ PROTECTION SYSTEM"))
|
||||
if (!ident.Contains("ALKATRAZ PROTECTION SYSTEM", StringComparison.OrdinalIgnoreCase))
|
||||
return false;
|
||||
|
||||
// ALKATRAZ NOTES (-asni 2018-05-01)
|
||||
|
@ -338,7 +339,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
|||
|
||||
// check for PAUL OWENS ident in sector 2
|
||||
string ident = Encoding.ASCII.GetString(DiskTracks[0].Sectors[2].SectorData, 0, DiskTracks[0].Sectors[2].SectorData.Length);
|
||||
if (!ident.ToUpper().Contains("PAUL OWENS"))
|
||||
if (!ident.Contains("PAUL OWENS", StringComparison.OrdinalIgnoreCase))
|
||||
return false;
|
||||
|
||||
// Paul Owens Disk Protection Notes (-asni 2018-05-01)
|
||||
|
@ -380,7 +381,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
|||
|
||||
// check for Hexagon ident in sector 8
|
||||
string ident = Encoding.ASCII.GetString(DiskTracks[0].Sectors[8].SectorData, 0, DiskTracks[0].Sectors[8].SectorData.Length);
|
||||
if (ident.ToUpper().Contains("GON DISK PROT"))
|
||||
if (ident.Contains("GON DISK PROT", StringComparison.OrdinalIgnoreCase))
|
||||
return true;
|
||||
|
||||
// hexagon protection may not be labelled as such
|
||||
|
|
|
@ -4,6 +4,7 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using BizHawk.Common.StringExtensions;
|
||||
|
||||
namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
||||
{
|
||||
|
@ -26,7 +27,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
|||
// look for standard magic string
|
||||
string ident = Encoding.ASCII.GetString(data, 0, 16);
|
||||
|
||||
if (!ident.ToUpper().Contains("CAPS"))
|
||||
if (!ident.Contains("CAPS", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
// incorrect format
|
||||
return false;
|
||||
|
|
|
@ -4,6 +4,7 @@ using System.Collections;
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using BizHawk.Common.StringExtensions;
|
||||
|
||||
namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
||||
{
|
||||
|
@ -26,7 +27,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
|||
// look for standard magic string
|
||||
string ident = Encoding.ASCII.GetString(data, 0, 4);
|
||||
|
||||
if (!ident.StartsWith("UDI!") && !ident.StartsWith("udi!"))
|
||||
if (!ident.StartsWithOrdinal("UDI!") && !ident.StartsWithOrdinal("udi!"))
|
||||
{
|
||||
// incorrect format
|
||||
return false;
|
||||
|
@ -83,7 +84,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
|||
// look for standard magic string
|
||||
string ident = Encoding.ASCII.GetString(data, 0, 4);
|
||||
|
||||
if (!ident.StartsWith("UDI!") && !ident.StartsWith("udi!"))
|
||||
if (!ident.StartsWithOrdinal("UDI!") && !ident.StartsWithOrdinal("udi!"))
|
||||
{
|
||||
// incorrect format
|
||||
return false;
|
||||
|
|
|
@ -57,7 +57,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
|||
int majorVer = data[8];
|
||||
int minorVer = data[9];
|
||||
|
||||
if (ident.ToUpper() != "COMPRESSED SQUARE WAVE")
|
||||
if (ident.ToUpperInvariant() != "COMPRESSED SQUARE WAVE")
|
||||
{
|
||||
// this is not a valid CSW format file
|
||||
return false;
|
||||
|
@ -80,7 +80,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
|||
// (first 22 bytes of the file)
|
||||
string ident = Encoding.ASCII.GetString(data, 0, 22);
|
||||
|
||||
if (ident.ToUpper() != "COMPRESSED SQUARE WAVE")
|
||||
if (ident.ToUpperInvariant() != "COMPRESSED SQUARE WAVE")
|
||||
{
|
||||
// this is not a valid CSW format file
|
||||
throw new Exception($"{nameof(CswConverter)}: This is not a valid CSW format file");
|
||||
|
|
|
@ -67,7 +67,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
|||
int majorVer = data[8];
|
||||
int minorVer = data[9];
|
||||
|
||||
if (ident.ToUpper() != "PZXT")
|
||||
if (ident.ToUpperInvariant() != "PZXT")
|
||||
{
|
||||
// this is not a valid PZX format file
|
||||
return false;
|
||||
|
@ -96,7 +96,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
|||
// check whether this is a valid pzx format file by looking at the identifier in the header block
|
||||
string ident = Encoding.ASCII.GetString(data, 0, 4);
|
||||
|
||||
if (ident.ToUpper() != "PZXT")
|
||||
if (ident.ToUpperInvariant() != "PZXT")
|
||||
{
|
||||
// this is not a valid TZX format file
|
||||
throw new Exception($"{nameof(PzxConverter)}: This is not a valid PZX format file");
|
||||
|
|
|
@ -52,7 +52,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
|||
// check whether this is a valid wav format file by looking at the identifier in the header
|
||||
string ident = Encoding.ASCII.GetString(data, 8, 4);
|
||||
|
||||
if (ident.ToUpper() != "WAVE")
|
||||
if (ident.ToUpperInvariant() != "WAVE")
|
||||
{
|
||||
// this is not a valid WAV format file
|
||||
return false;
|
||||
|
@ -74,7 +74,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
|||
// check whether this is a valid pzx format file by looking at the identifier in the header block
|
||||
string ident = Encoding.ASCII.GetString(data, 8, 4);
|
||||
|
||||
if (ident.ToUpper() != "WAVE")
|
||||
if (ident.ToUpperInvariant() != "WAVE")
|
||||
{
|
||||
// this is not a valid TZX format file
|
||||
throw new Exception($"{nameof(WavConverter)}: This is not a valid WAV format file");
|
||||
|
|
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||
using System.Collections.ObjectModel;
|
||||
|
||||
using BizHawk.Common;
|
||||
using BizHawk.Common.StringExtensions;
|
||||
using BizHawk.Emulation.Common;
|
||||
using BizHawk.Emulation.Cores.Waterbox;
|
||||
|
||||
|
@ -119,7 +120,7 @@ namespace BizHawk.Emulation.Cores.Computers.TIC80
|
|||
|
||||
foreach (var n in ret.BoolButtons)
|
||||
{
|
||||
if (n.StartsWith("Mouse"))
|
||||
if (n.StartsWithOrdinal("Mouse"))
|
||||
{
|
||||
ret.CategoryLabels[n] = "Mouse";
|
||||
}
|
||||
|
@ -127,7 +128,7 @@ namespace BizHawk.Emulation.Cores.Computers.TIC80
|
|||
|
||||
foreach (var n in ret.Axes.Keys)
|
||||
{
|
||||
if (n.StartsWith("Mouse"))
|
||||
if (n.StartsWithOrdinal("Mouse"))
|
||||
{
|
||||
ret.CategoryLabels[n] = "Mouse";
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue