From f32ab2bf12c458dbea83ed179c6d4a49c126622b Mon Sep 17 00:00:00 2001 From: adelikat Date: Wed, 26 Apr 2017 08:41:29 -0500 Subject: [PATCH] Database.cs - Get rid of a try/catch that was eating errors that was left in for debugging --- BizHawk.Emulation.Common/Database/Database.cs | 26 +++++++------------ 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/BizHawk.Emulation.Common/Database/Database.cs b/BizHawk.Emulation.Common/Database/Database.cs index 970bd57fd9..774f275a55 100644 --- a/BizHawk.Emulation.Common/Database/Database.cs +++ b/BizHawk.Emulation.Common/Database/Database.cs @@ -21,7 +21,7 @@ namespace BizHawk.Emulation.Common public static class Database { - private static readonly Dictionary db = new Dictionary(); + private static readonly Dictionary DB = new Dictionary(); private static string RemoveHashType(string hash) { @@ -43,7 +43,7 @@ namespace BizHawk.Emulation.Common { CompactGameInfo cgi; var hash_notype = RemoveHashType(hash); - db.TryGetValue(hash_notype, out cgi); + DB.TryGetValue(hash_notype, out cgi); if (cgi == null) { Console.WriteLine("DB: hash " + hash + " not in game database."); @@ -114,14 +114,8 @@ namespace BizHawk.Emulation.Common .Append('\t') .Append(gameInfo.MetaData) .Append(Environment.NewLine); - try - { - File.AppendAllText(path, sb.ToString()); - } - catch (Exception ex) - { - string blah = ex.ToString(); - } + + File.AppendAllText(path, sb.ToString()); } public static void LoadDatabase(string path) @@ -194,12 +188,12 @@ namespace BizHawk.Emulation.Common game.Region = items.Length >= 7 ? items[6] : string.Empty; game.ForcedCore = items.Length >= 8 ? items[7].ToLowerInvariant() : string.Empty; - if (db.ContainsKey(game.Hash)) + if (DB.ContainsKey(game.Hash)) { - Console.WriteLine("gamedb: Multiple hash entries {0}, duplicate detected on \"{1}\" and \"{2}\"", game.Hash, game.Name, db[game.Hash].Name); + Console.WriteLine("gamedb: Multiple hash entries {0}, duplicate detected on \"{1}\" and \"{2}\"", game.Hash, game.Name, DB[game.Hash].Name); } - db[game.Hash] = game; + DB[game.Hash] = game; } catch { @@ -213,19 +207,19 @@ namespace BizHawk.Emulation.Common { CompactGameInfo cgi; var hash = $"{CRC32.Calculate(romData):X8}"; - if (db.TryGetValue(hash, out cgi)) + if (DB.TryGetValue(hash, out cgi)) { return new GameInfo(cgi); } hash = romData.HashMD5(); - if (db.TryGetValue(hash, out cgi)) + if (DB.TryGetValue(hash, out cgi)) { return new GameInfo(cgi); } hash = romData.HashSHA1(); - if (db.TryGetValue(hash, out cgi)) + if (DB.TryGetValue(hash, out cgi)) { return new GameInfo(cgi); }