public FirmwareOption(FirmwareID id, string hash, long size, FirmwareOptionStatus status) { Hash = hash; ID = id; Size = size; Status = status; }
/// <exception cref="MissingFirmwareException">not found and <paramref name="required"/> is true</exception> public byte[] GetFirmwareWithGameInfo(FirmwareID id, bool required, out GameInfo gi, string msg = null) { var ret = GetFirmwareWithPath(id, required, msg, out var path); gi = ret != null && path != null ? Database.GetGameInfo(ret, path) : null; return(ret); }
private void FirmwareWarn(FirmwareID id, bool required, string msg = null) { if (required) { var fullMsg = $"Couldn't find required firmware {id}. This is fatal{(msg != null ? $": {msg}" : ".")}"; throw new MissingFirmwareException(fullMsg); } if (msg != null) { var fullMsg = $"Couldn't find firmware {id}. Will attempt to continue: {msg}"; _dialogParent.ModalMessageBox(fullMsg, "Warning", EMsgBoxIcon.Warning); } }
private (byte[] FW, string Path)? GetFirmwareWithPath(FirmwareID id) { var path = _firmwareManager.Request(_pathEntries, _firmwareUserSpecifications, id); try { if (path is not null && File.Exists(path)) { return(File.ReadAllBytes(path), path); } // else fall through } catch (IOException) { // fall through } return(null); }
private byte[] GetFirmwareWithPath(FirmwareID id, bool required, string msg, out string path) { var firmwarePath = _firmwareManager.Request(_pathEntries, _firmwareUserSpecifications, id); if (firmwarePath == null || !File.Exists(firmwarePath)) { path = null; FirmwareWarn(id, required, msg); return(null); } try { var ret = File.ReadAllBytes(firmwarePath); path = firmwarePath; return(ret); } catch (IOException) { path = null; FirmwareWarn(id, required, msg); return(null); } }
public FirmwareRecord(FirmwareID id, string desc) { Description = desc; ID = id; }
/// <exception cref="MissingFirmwareException">not found and <paramref name="required"/> is true</exception> public byte[] GetFirmware(FirmwareID id, bool required, string msg = null) => GetFirmwareWithPath(id, required, msg, out _);
private (byte[] FW, string Path) GetFirmwareWithPathOrThrow(FirmwareID id, string?msg) => GetFirmwareWithPath(id) ?? throw new MissingFirmwareException($"Couldn't find required firmware {id}. This is fatal{(msg is null ? "." : $": {msg}")}");
public FirmwareEventArgs(FirmwareID id, string?hash, long size) { Hash = hash; ID = id; Size = size; }