Exemplo n.º 1
0
 public FirmwareOption(FirmwareID id, string hash, long size, FirmwareOptionStatus status)
 {
     Hash   = hash;
     ID     = id;
     Size   = size;
     Status = status;
 }
Exemplo n.º 2
0
        /// <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);
        }
Exemplo n.º 3
0
        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);
            }
        }
Exemplo n.º 4
0
        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);
        }
Exemplo n.º 5
0
        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);
            }
        }
Exemplo n.º 6
0
 public FirmwareRecord(FirmwareID id, string desc)
 {
     Description = desc;
     ID          = id;
 }
Exemplo n.º 7
0
 /// <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 _);
Exemplo n.º 8
0
 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}")}");
Exemplo n.º 9
0
 public FirmwareEventArgs(FirmwareID id, string?hash, long size)
 {
     Hash = hash;
     ID   = id;
     Size = size;
 }