diff --git a/BizHawk.Client.Common/CoreFileProvider.cs b/BizHawk.Client.Common/CoreFileProvider.cs
index 69e5db78fa..f769d63349 100644
--- a/BizHawk.Client.Common/CoreFileProvider.cs
+++ b/BizHawk.Client.Common/CoreFileProvider.cs
@@ -40,66 +40,46 @@ namespace BizHawk.Client.Common
}
}
- /// not found and is true
- private string GetFirmwarePath(string sysId, string firmwareId, bool required, string msg = null)
- {
- var path = _firmwareManager.Request(Global.Config.PathEntries.FirmwaresPathFragment, Global.Config.FirmwareUserSpecifications, sysId, firmwareId);
- if (path != null && !File.Exists(path))
- {
- path = null;
- }
-
- if (path == null)
- {
- FirmwareWarn(sysId, firmwareId, required, msg);
- }
-
- return path;
- }
-
private byte[] GetFirmwareWithPath(string sysId, string firmwareId, bool required, string msg, out string path)
{
- byte[] ret = null;
- var path_ = GetFirmwarePath(sysId, firmwareId, required, msg);
- if (path_ != null && File.Exists(path_))
- {
- try
- {
- ret = File.ReadAllBytes(path_);
- }
- catch (IOException)
- {
- }
- }
+ var firmwarePath = _firmwareManager.Request(
+ Global.Config.PathEntries.FirmwaresPathFragment,
+ Global.Config.FirmwareUserSpecifications,
+ sysId,
+ firmwareId);
- if (ret == null && path_ != null)
+ if (firmwarePath == null || !File.Exists(firmwarePath))
{
+ path = null;
FirmwareWarn(sysId, firmwareId, required, msg);
+ return null;
}
- path = path_;
- return ret;
+ try
+ {
+ var ret = File.ReadAllBytes(firmwarePath);
+ path = firmwarePath;
+ return ret;
+ }
+ catch (IOException)
+ {
+ path = null;
+ FirmwareWarn(sysId, firmwareId, required, msg);
+ return null;
+ }
}
/// not found and is true
public byte[] GetFirmware(string sysId, string firmwareId, bool required, string msg = null)
- {
- string unused;
- return GetFirmwareWithPath(sysId, firmwareId, required, msg, out unused);
- }
+ => GetFirmwareWithPath(sysId, firmwareId, required, msg, out _);
/// not found and is true
public byte[] GetFirmwareWithGameInfo(string sysId, string firmwareId, bool required, out GameInfo gi, string msg = null)
{
byte[] ret = GetFirmwareWithPath(sysId, firmwareId, required, msg, out var path);
- if (ret != null && path != null)
- {
- gi = Database.GetGameInfo(ret, path);
- }
- else
- {
- gi = null;
- }
+ gi = ret != null && path != null
+ ? Database.GetGameInfo(ret, path)
+ : null;
return ret;
}
diff --git a/BizHawk.Emulation.Common/Interfaces/ICoreFileProvider.cs b/BizHawk.Emulation.Common/Interfaces/ICoreFileProvider.cs
index 33278f4515..7fef4d6536 100644
--- a/BizHawk.Emulation.Common/Interfaces/ICoreFileProvider.cs
+++ b/BizHawk.Emulation.Common/Interfaces/ICoreFileProvider.cs
@@ -1,6 +1,4 @@
-using System;
-
-namespace BizHawk.Emulation.Common
+namespace BizHawk.Emulation.Common
{
///
/// Defines the means by which firmware, bios and other necessary files are provided to a core that needs them