Fix some external project analyzer warnings

This commit is contained in:
Morilli 2024-05-29 09:40:53 +02:00
parent bd786a0e95
commit 7a789fb853
13 changed files with 89 additions and 101 deletions

View File

@ -244,8 +244,8 @@ namespace Jellyfish.Virtu
return ret; return ret;
} }
public static bool WhiteAppleDown; public static bool WhiteAppleDown { get; private set; }
public static bool BlackAppleDown; public static bool BlackAppleDown { get; private set; }
/// <summary> /// <summary>
/// Call this at 60hz with all of the currently pressed keys /// Call this at 60hz with all of the currently pressed keys

View File

@ -373,7 +373,7 @@ namespace BizHawk.Experiment.AutoGenConfig
protected override string SerializeTValue(string? v) => v == null ? NULL_SERIALIZATION : $"\"{v}\""; protected override string SerializeTValue(string? v) => v == null ? NULL_SERIALIZATION : $"\"{v}\"";
protected override bool TValueEquality(string? a, string? b) => string.Equals(a, b) || string.IsNullOrEmpty(a) && string.IsNullOrEmpty(b); protected override bool TValueEquality(string? a, string? b) => a == b || string.IsNullOrEmpty(a) && string.IsNullOrEmpty(b);
} }
public sealed class UnrepresentablePropEditorUIGen : ConfigPropEditorUIGen<GroupBox, object?> public sealed class UnrepresentablePropEditorUIGen : ConfigPropEditorUIGen<GroupBox, object?>

View File

@ -3,7 +3,6 @@ using System.Drawing;
using System.Windows.Forms; using System.Windows.Forms;
using BizHawk.Client.Common; using BizHawk.Client.Common;
using BizHawk.Common;
using BizHawk.Client.EmuHawk; using BizHawk.Client.EmuHawk;
namespace BizHawk.DATTool namespace BizHawk.DATTool

View File

@ -1,5 +1,5 @@
#nullable disable #nullable disable
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
@ -53,13 +53,13 @@ namespace BizHawk.DATTool
{ {
// hash // hash
sb.Append(d.HASH); sb.Append(d.HASH);
sb.Append("\t"); sb.Append('\t');
// status // status
sb.Append(d.Status); sb.Append(d.Status);
sb.Append("\t"); sb.Append('\t');
// name // name
sb.Append(d.Name); sb.Append(d.Name);
sb.Append("\t"); sb.Append('\t');
// system // system
sb.Append(d.System); sb.Append(d.System);
@ -89,37 +89,37 @@ namespace BizHawk.DATTool
// notes // notes
if (d.Notes != null) if (d.Notes != null)
{ {
sb.Append("\t"); sb.Append('\t');
sb.Append(d.Notes); sb.Append(d.Notes);
} }
else if (cnt++ <= last) else if (cnt++ <= last)
{ {
sb.Append("\t"); sb.Append('\t');
} }
// metadata // metadata
if (d.MetaData != null) if (d.MetaData != null)
{ {
sb.Append("\t"); sb.Append('\t');
sb.Append(d.MetaData); sb.Append(d.MetaData);
} }
else if (cnt++ <= last) else if (cnt++ <= last)
{ {
sb.Append("\t"); sb.Append('\t');
} }
// region // region
if (d.Region != null) if (d.Region != null)
{ {
sb.Append("\t"); sb.Append('\t');
sb.Append(d.Region); sb.Append(d.Region);
} }
else if (cnt++ <= last) else if (cnt++ <= last)
{ {
sb.Append("\t"); sb.Append('\t');
} }
// force core // force core
if (d.ForcedCore != null) if (d.ForcedCore != null)
{ {
sb.Append("\t"); sb.Append('\t');
sb.Append(d.ForcedCore); sb.Append(d.ForcedCore);
} }
@ -137,8 +137,8 @@ namespace BizHawk.DATTool
// COL0: Hash // COL0: Hash
public string SHA1 { get; set; } public string SHA1 { get; set; }
public string MD5 { get; set; } public string MD5 { get; set; }
public string CRC32 { get; set; } public string CRC32 { get; set; }
// COL1: Status code indicator // COL1: Status code indicator
public string Status { get; set; } public string Status { get; set; }
// COL2: Game title // COL2: Game title
public string Name { get; set; } public string Name { get; set; }
@ -160,9 +160,9 @@ namespace BizHawk.DATTool
{ {
if (!string.IsNullOrWhiteSpace(SHA1)) if (!string.IsNullOrWhiteSpace(SHA1))
return "SHA1:" + SHA1; return "SHA1:" + SHA1;
else if (!string.IsNullOrWhiteSpace(MD5)) else if (!string.IsNullOrWhiteSpace(MD5))
return "MD5:" + MD5; return "MD5:" + MD5;
else if (!string.IsNullOrWhiteSpace(CRC32)) else if (!string.IsNullOrWhiteSpace(CRC32))
return "CRC32:" + CRC32; return "CRC32:" + CRC32;
throw new InvalidOperationException("No valid hash available?"); throw new InvalidOperationException("No valid hash available?");

View File

@ -5,6 +5,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Xml.Linq; using System.Xml.Linq;
using System.Windows.Forms; using System.Windows.Forms;
using BizHawk.Common.StringExtensions;
namespace BizHawk.DATTool namespace BizHawk.DATTool
{ {
@ -69,9 +70,9 @@ namespace BizHawk.DATTool
{ {
GameDB item = new GameDB(); GameDB item = new GameDB();
item.Name = g.Value; item.Name = g.Value;
item.SHA1 = g.Elements("rom").First().Attribute("sha1").Value.ToUpper(); item.SHA1 = g.Elements("rom").First().Attribute("sha1").Value.ToUpperInvariant();
item.MD5 = g.Elements("rom").First().Attribute("md5").Value.ToUpper(); item.MD5 = g.Elements("rom").First().Attribute("md5").Value.ToUpperInvariant();
item.CRC32 = g.Elements("rom").First().Attribute("crc").Value.ToUpper(); item.CRC32 = g.Elements("rom").First().Attribute("crc").Value.ToUpperInvariant();
item.System = GameDB.GetSystemCode(SysType); item.System = GameDB.GetSystemCode(SysType);
ParseNOINTROFlags(item); ParseNOINTROFlags(item);
@ -99,7 +100,7 @@ namespace BizHawk.DATTool
AddCommentBlock("Translated"); AddCommentBlock("Translated");
AppendCSVData(trans); AppendCSVData(trans);
var good = working.Where(st => st.Status == "" || st.Status == null).OrderBy(na => na.Name).ToList(); var good = working.Where(st => string.IsNullOrEmpty(st.Status)).OrderBy(na => na.Name).ToList();
AddCommentBlock("Believed Good"); AddCommentBlock("Believed Good");
AppendCSVData(good); AppendCSVData(good);
} }
@ -146,7 +147,7 @@ namespace BizHawk.DATTool
string f = d[i].Trim(); string f = d[i].Trim();
// check for language // check for language
if (IsLanguageFlag(f) == true) if (IsLanguageFlag(f))
{ {
g.Notes = f; g.Notes = f;
continue; continue;
@ -155,26 +156,26 @@ namespace BizHawk.DATTool
// version - ignore // version - ignore
// check development status (not currently implemented) // check development status (not currently implemented)
if (IsDevelopmenttStatus(f) == true) if (IsDevelopmenttStatus(f))
{ {
continue; continue;
} }
// check copyright status (not currently implemented) // check copyright status (not currently implemented)
if (IsCopyrightStatus(f) == true) if (IsCopyrightStatus(f))
{ {
continue; continue;
} }
// country flag(s) // country flag(s)
if (IsCountryFlag(f) == true) if (IsCountryFlag(f))
{ {
g.Region = f; g.Region = f;
continue; continue;
} }
// language - if present add to notes // language - if present add to notes
if (IsLanguageFlag(f) == true) if (IsLanguageFlag(f))
{ {
g.Notes = f; g.Notes = f;
continue; continue;
@ -207,14 +208,14 @@ namespace BizHawk.DATTool
if (e.Where(str => if (e.Where(str =>
// bad dump // bad dump
str == "b" || str.StartsWith("b ")).ToList().Count > 0) str == "b" || str.StartsWithOrdinal("b ")).ToList().Count > 0)
{ {
// RomStatus.BadDump // RomStatus.BadDump
g.Status = "B"; g.Status = "B";
} }
else if (e.Where(str => else if (e.Where(str =>
// BIOS // BIOS
str == "BIOS" || str.StartsWith("BIOS ")).ToList().Count > 0) str == "BIOS" || str.StartsWithOrdinal("BIOS ")).ToList().Count > 0)
{ {
// RomStatus.BIOS // RomStatus.BIOS
g.Status = "I"; g.Status = "I";
@ -259,7 +260,7 @@ namespace BizHawk.DATTool
{ {
foreach (var x in LC) foreach (var x in LC)
{ {
if (s == x || s.StartsWith(x + ",") || s.EndsWith("," + x)) if (s == x || s.StartsWithOrdinal(x + ",") || s.EndsWithOrdinal("," + x))
{ {
b = true; b = true;
break; break;
@ -286,7 +287,7 @@ namespace BizHawk.DATTool
{ {
foreach (var x in CC) foreach (var x in CC)
{ {
if (s == x || s.StartsWith(x) || s.EndsWith(x)) if (s == x || s.StartsWithOrdinal(x) || s.EndsWithOrdinal(x))
{ {
b = true; b = true;
break; break;

View File

@ -6,6 +6,8 @@ using System.Linq;
using System.Xml.Linq; using System.Xml.Linq;
using System.Windows.Forms; using System.Windows.Forms;
using BizHawk.Common.StringExtensions;
namespace BizHawk.DATTool namespace BizHawk.DATTool
{ {
public class TOSECParser : DATParser public class TOSECParser : DATParser
@ -70,9 +72,9 @@ namespace BizHawk.DATTool
{ {
GameDB item = new GameDB(); GameDB item = new GameDB();
item.Name = g.Value; item.Name = g.Value;
item.SHA1 = g.Elements("rom").First().Attribute("sha1").Value.ToUpper(); item.SHA1 = g.Elements("rom").First().Attribute("sha1").Value.ToUpperInvariant();
item.MD5 = g.Elements("rom").First().Attribute("md5").Value.ToUpper(); item.MD5 = g.Elements("rom").First().Attribute("md5").Value.ToUpperInvariant();
item.CRC32 = g.Elements("rom").First().Attribute("crc").Value.ToUpper(); item.CRC32 = g.Elements("rom").First().Attribute("crc").Value.ToUpperInvariant();
item.System = GameDB.GetSystemCode(SysType); item.System = GameDB.GetSystemCode(SysType);
ParseTOSECFlags(item); ParseTOSECFlags(item);
@ -104,7 +106,7 @@ namespace BizHawk.DATTool
AddCommentBlock("Home Brew"); AddCommentBlock("Home Brew");
AppendCSVData(pd); AppendCSVData(pd);
var good = working.Where(st => st.Status == "" || st.Status == null).OrderBy(na => na.Name).ToList(); var good = working.Where(st => string.IsNullOrEmpty(st.Status)).OrderBy(na => na.Name).ToList();
AddCommentBlock("Believed Good"); AddCommentBlock("Believed Good");
AppendCSVData(good); AppendCSVData(good);
} }
@ -171,27 +173,27 @@ namespace BizHawk.DATTool
} }
// country flag(s) // country flag(s)
if (IsCountryFlag(f) == true) if (IsCountryFlag(f))
{ {
g.Region = f; g.Region = f;
continue; continue;
} }
// language - if present add to notes // language - if present add to notes
if (IsLanguageFlag(f) == true) if (IsLanguageFlag(f))
{ {
g.Notes = f; g.Notes = f;
continue; continue;
} }
// check copyright status (not currently implemented) // check copyright status (not currently implemented)
if (IsCopyrightStatus(f) == true) if (IsCopyrightStatus(f))
{ {
continue; continue;
} }
// check development status (not currently implemented) // check development status (not currently implemented)
if (IsDevelopmenttStatus(f) == true) if (IsDevelopmenttStatus(f))
{ {
continue; continue;
} }
@ -225,28 +227,28 @@ namespace BizHawk.DATTool
if (e.Where(str => if (e.Where(str =>
// bad dump // bad dump
str == "b" || str.StartsWith("b ") || str == "b" || str.StartsWithOrdinal("b ") ||
// virus // virus
str == "v" || str.StartsWith("v ") || str == "v" || str.StartsWithOrdinal("v ") ||
// under dump // under dump
str == "u" || str.StartsWith("u ")).ToList().Count > 0) str == "u" || str.StartsWithOrdinal("u ")).ToList().Count > 0)
{ {
// RomStatus.BadDump // RomStatus.BadDump
g.Status = "B"; g.Status = "B";
} }
else if (e.Where(str => else if (e.Where(str =>
// cracked // cracked
str == "cr" || str.StartsWith("cr ") || str == "cr" || str.StartsWithOrdinal("cr ") ||
// fixed // fixed
str == "f" || str.StartsWith("f ") || str == "f" || str.StartsWithOrdinal("f ") ||
// hack // hack
str == "h" || str.StartsWith("h ") || str == "h" || str.StartsWithOrdinal("h ") ||
// modified // modified
str == "m" || str.StartsWith("m ") || str == "m" || str.StartsWithOrdinal("m ") ||
// pirated // pirated
str == "p" || str.StartsWith("p ") || str == "p" || str.StartsWithOrdinal("p ") ||
// trained // trained
str == "t" || str.StartsWith("t ") str == "t" || str.StartsWithOrdinal("t ")
).ToList().Count > 0) ).ToList().Count > 0)
{ {
// RomStatus.Hack // RomStatus.Hack
@ -254,7 +256,7 @@ namespace BizHawk.DATTool
} }
else if (e.Where(str => else if (e.Where(str =>
// over dump // over dump
str == "o" || str.StartsWith("o ")).ToList().Count > 0) str == "o" || str.StartsWithOrdinal("o ")).ToList().Count > 0)
{ {
// RomStatus.Overdump // RomStatus.Overdump
g.Status = "O"; g.Status = "O";
@ -268,7 +270,7 @@ namespace BizHawk.DATTool
} }
else if (e.Where(str => else if (e.Where(str =>
// translated // translated
str == "tr" || str.StartsWith("tr ")).ToList().Count > 0) str == "tr" || str.StartsWithOrdinal("tr ")).ToList().Count > 0)
{ {
// RomStatus.TranslatedRom // RomStatus.TranslatedRom
g.Status = "T"; g.Status = "T";
@ -312,7 +314,7 @@ namespace BizHawk.DATTool
{ {
foreach (var x in LC) foreach (var x in LC)
{ {
if (s == x || s.StartsWith(x) || s.EndsWith(x)) if (s == x || s.StartsWithOrdinal(x) || s.EndsWithOrdinal(x))
{ {
b = true; b = true;
break; break;
@ -342,7 +344,7 @@ namespace BizHawk.DATTool
{ {
foreach (var x in CC) foreach (var x in CC)
{ {
if (s == x || s.StartsWith(x) || s.EndsWith(x)) if (s == x || s.StartsWithOrdinal(x) || s.EndsWithOrdinal(x))
{ {
b = true; b = true;
break; break;

View File

@ -3,7 +3,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using BizHawk.Common.StringExtensions;
using Community.CsharpSqlite.SQLiteClient; using Community.CsharpSqlite.SQLiteClient;
namespace BizHawk.DBManTool namespace BizHawk.DBManTool
@ -45,7 +45,7 @@ namespace BizHawk.DBManTool
{ {
get get
{ {
if (!Name.EndsWith(", The")) return Name; if (!Name.EndsWithOrdinal(", The")) return Name;
return "The "+Name.Substring(0, Name.Length-5); return "The "+Name.Substring(0, Name.Length-5);
} }
} }
@ -110,11 +110,11 @@ namespace BizHawk.DBManTool
public static class DB public static class DB
{ {
public static List<Rom> Roms = new List<Rom>(); public static List<Rom> Roms { get; private set; } = new List<Rom>();
public static List<Game> Games = new List<Game>(); public static List<Game> Games { get; } = new List<Game>();
public static Dictionary<string, Game> GameMap = new Dictionary<string, Game>(); public static Dictionary<string, Game> GameMap { get; } = new Dictionary<string, Game>();
public static SqliteConnection Con; public static SqliteConnection Con { get; set; }
public static void LoadDbForSystem(string system) public static void LoadDbForSystem(string system)
{ {
@ -455,4 +455,4 @@ namespace BizHawk.DBManTool
cmd.Dispose(); cmd.Dispose();
} }
} }
} }

View File

@ -1,13 +1,8 @@
#nullable disable #nullable disable
using System; using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing; using System.Drawing;
using System.IO; using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
namespace BizHawk.DBManTool namespace BizHawk.DBManTool
@ -157,7 +152,7 @@ namespace BizHawk.DBManTool
void saveButton_Click(object sender, EventArgs e) void saveButton_Click(object sender, EventArgs e)
{ {
// Check if any changes were made // Check if any changes were made
if (SelectedRom.New == false && RomChangesMade() == false) if (!SelectedRom.New && !RomChangesMade())
return; return;
int saveMode = 0; int saveMode = 0;
@ -197,7 +192,7 @@ namespace BizHawk.DBManTool
if (romListView.SelectedItems.Count > 0) if (romListView.SelectedItems.Count > 0)
{ {
// Update the side listing // Update the side listing
var romListItem = (ListViewItem)romListView.SelectedItems[0]; var romListItem = romListView.SelectedItems[0];
romListItem.SubItems[0] = new ListViewItem.ListViewSubItem(romListItem, SelectedRom.DisplayName); romListItem.SubItems[0] = new ListViewItem.ListViewSubItem(romListItem, SelectedRom.DisplayName);
romListItem.SubItems[1] = new ListViewItem.ListViewSubItem(romListItem, SelectedRom.Region); romListItem.SubItems[1] = new ListViewItem.ListViewSubItem(romListItem, SelectedRom.Region);
romListItem.SubItems[2] = new ListViewItem.ListViewSubItem(romListItem, SelectedRom.VersionTags); romListItem.SubItems[2] = new ListViewItem.ListViewSubItem(romListItem, SelectedRom.VersionTags);
@ -303,14 +298,14 @@ namespace BizHawk.DBManTool
string regionStr = ""; string regionStr = "";
if (rom.Region != null) if (rom.Region != null)
{ {
if (rom.Region.IndexOf("Japan") >= 0) regionStr += "J"; if (rom.Region.Contains("Japan")) regionStr += "J";
if (rom.Region.IndexOf("USA") >= 0) regionStr += "U"; if (rom.Region.Contains("USA")) regionStr += "U";
if (rom.Region.IndexOf("Europe") >= 0) regionStr += "E"; if (rom.Region.Contains("Europe")) regionStr += "E";
if (rom.Region.IndexOf("Brazil") >= 0) regionStr += "B"; if (rom.Region.Contains("Brazil")) regionStr += "B";
if (rom.Region.IndexOf("Taiwan") >= 0) regionStr += "T"; if (rom.Region.Contains("Taiwan")) regionStr += "T";
if (rom.Region.IndexOf("Korea") >= 0) regionStr += "K"; if (rom.Region.Contains("Korea")) regionStr += "K";
if (rom.Region.IndexOf("Australia") >= 0) regionStr += "Aus"; if (rom.Region.Contains("Australia")) regionStr += "Aus";
if (rom.Region.IndexOf("World") >= 0) regionStr += "W"; if (rom.Region.Contains("World")) regionStr += "W";
} }
string romName = rom.NameWithTheFlipped; string romName = rom.NameWithTheFlipped;
@ -344,4 +339,4 @@ namespace BizHawk.DBManTool
loadRomsForSelectedSystem(); loadRomsForSelectedSystem();
} }
} }
} }

View File

@ -18,7 +18,7 @@ namespace BizHawk.DBManTool
foreach (var f in files) foreach (var f in files)
{ {
if (IsRomFile(f.Extension, f.Length) == false) if (!IsRomFile(f.Extension, f.Length))
continue; continue;
romInfos.Add(RomHasher.Generate(f.FullName)); romInfos.Add(RomHasher.Generate(f.FullName));
} }
@ -56,11 +56,11 @@ namespace BizHawk.DBManTool
foreach (var rom in roms) foreach (var rom in roms)
{ {
if (RomInDatabase(rom.MD5) == false) if (!RomInDatabase(rom.MD5))
{ {
InsertRom(rom); InsertRom(rom);
if (GameInDatabase(rom) == false) if (!GameInDatabase(rom))
InsertGame(rom); InsertGame(rom);
} }
} }

View File

@ -1,20 +1,16 @@
#nullable disable #nullable disable
using System; using System;
using System.Runtime.InteropServices;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Linq;
using System.IO; using System.IO;
using System.Collections.Generic; using System.Collections.Generic;
using BizHawk.Common;
using BizHawk.Emulation.DiscSystem; using BizHawk.Emulation.DiscSystem;
namespace BizHawk.DBManTool namespace BizHawk.DBManTool
{ {
class DiscHash class DiscHash
{ {
static List<string> FindExtensionsRecurse(string dir, string extUppercaseWithDot) static List<string> FindExtensionsRecurse(string dir, string extUppercaseWithDot)
{ {
List<string> ret = new List<string>(); List<string> ret = new List<string>();
@ -44,7 +40,6 @@ namespace BizHawk.DBManTool
public void Run(string[] args) public void Run(string[] args)
{ {
string indir = null; string indir = null;
string dpTemp = null; string dpTemp = null;
string fpOutfile = null; string fpOutfile = null;
@ -109,10 +104,10 @@ namespace BizHawk.DBManTool
progress++; progress++;
Console.WriteLine("{0}/{1} [{2}] {3}", progress, todo.Count, bizHashId, Path.GetFileNameWithoutExtension(fiCue)); Console.WriteLine("{0}/{1} [{2}] {3}", progress, todo.Count, bizHashId, Path.GetFileNameWithoutExtension(fiCue));
outf.WriteLine("bizhash:{0} datahash:{1:X8} //{2}", bizHashId, redumpHash, name); outf.WriteLine("bizhash:{0} datahash:{1:X8} //{2}", bizHashId, redumpHash, name);
if (FoundHashes.ContainsKey(bizHashId)) if (FoundHashes.TryGetValue(bizHashId, out string foundBizHashId))
{ {
Console.WriteLine("--> COLLISION WITH: {0}", FoundHashes[bizHashId]); Console.WriteLine("--> COLLISION WITH: {0}", foundBizHashId);
outf.WriteLine("--> COLLISION WITH: {0}", FoundHashes[bizHashId]); outf.WriteLine("--> COLLISION WITH: {0}", foundBizHashId);
} }
else else
FoundHashes[bizHashId] = name; FoundHashes[bizHashId] = name;
@ -130,4 +125,4 @@ namespace BizHawk.DBManTool
} //MyRun() } //MyRun()
} //class PsxRedump } //class PsxRedump
} }

View File

@ -3,15 +3,11 @@
using System; using System;
using System.Globalization; using System.Globalization;
using System.IO; using System.IO;
using System.Xml;
using System.Xml.Linq; using System.Xml.Linq;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text;
using BizHawk.Common; using BizHawk.Common;
using BizHawk.Emulation.DiscSystem;
namespace BizHawk.DBManTool namespace BizHawk.DBManTool
{ {
@ -61,8 +57,7 @@ namespace BizHawk.DBManTool
Console.WriteLine("merging"); Console.WriteLine("merging");
foreach (var rr in rdpsx.Records) foreach (var rr in rdpsx.Records)
{ {
HashRecord hr; if (!hashes.TryGetValue(rr.crc, out var hr))
if (!hashes.TryGetValue(rr.crc, out hr))
continue; continue;
hr.matched = true; hr.matched = true;
//correct name to redump current //correct name to redump current
@ -109,8 +104,8 @@ namespace BizHawk.DBManTool
CRC32 spec_crc_calc = new() { Current = 0 }; //TODO is the current usage (invert initial state, don't invert final state) equivalent to only inverting the final state? --yoshi CRC32 spec_crc_calc = new() { Current = 0 }; //TODO is the current usage (invert initial state, don't invert final state) equivalent to only inverting the final state? --yoshi
foreach (var rom in game.Elements("rom")) foreach (var rom in game.Elements("rom"))
{ {
var ext = Path.GetExtension(rom.Attribute("name").Value).ToLower(); var ext = Path.GetExtension(rom.Attribute("name").Value);
if (ext == ".cue") continue; if (ext.Equals(".cue", StringComparison.OrdinalIgnoreCase)) continue;
uint onecrc = uint.Parse(rom.Attribute("crc").Value, NumberStyles.HexNumber); uint onecrc = uint.Parse(rom.Attribute("crc").Value, NumberStyles.HexNumber);
int size = int.Parse(rom.Attribute("size").Value); int size = int.Parse(rom.Attribute("size").Value);
spec_crc_calc.Incorporate(onecrc, size); spec_crc_calc.Incorporate(onecrc, size);
@ -125,4 +120,4 @@ namespace BizHawk.DBManTool
} }
} }
} }
} }

View File

@ -6,6 +6,7 @@ using System.IO;
using System.Text; using System.Text;
using BizHawk.Common; using BizHawk.Common;
using BizHawk.Common.StringExtensions;
using BizHawk.Emulation.DiscSystem; using BizHawk.Emulation.DiscSystem;
namespace BizHawk.DBManTool namespace BizHawk.DBManTool
@ -48,7 +49,7 @@ namespace BizHawk.DBManTool
// Parse the filename to guess things about the rom // Parse the filename to guess things about the rom
var name = Path.GetFileNameWithoutExtension(fileInfo.Name); var name = Path.GetFileNameWithoutExtension(fileInfo.Name);
if (name.StartsWith("[BIOS] ")) if (name.StartsWithOrdinal("[BIOS] "))
name = name.Replace("[BIOS] ","") + " [BIOS]"; name = name.Replace("[BIOS] ","") + " [BIOS]";
string modifiers = ""; string modifiers = "";
@ -78,7 +79,7 @@ namespace BizHawk.DBManTool
if (info.VersionTags.Length != 0) if (info.VersionTags.Length != 0)
info.VersionTags += ";"; info.VersionTags += ";";
switch (mi.ToLower()) switch (mi.ToLowerInvariant())
{ {
case "j": case "j":
case "jp": case "jp":
@ -260,4 +261,4 @@ namespace BizHawk.DBManTool
return false; return false;
} }
} }
} }

Binary file not shown.