Example #1
0
        private byte[] GetFirmwareWithPath(string sysId, string firmwareId, bool required, string msg, out string path)
        {
            var firmwarePath = _firmwareManager.Request(
                _pathEntries,
                _firmwareUserSpecifications,
                sysId,
                firmwareId);

            if (firmwarePath == null || !File.Exists(firmwarePath))
            {
                path = null;
                FirmwareWarn(sysId, firmwareId, required, msg);
                return(null);
            }

            try
            {
                var ret = File.ReadAllBytes(firmwarePath);
                path = firmwarePath;
                return(ret);
            }
            catch (IOException)
            {
                path = null;
                FirmwareWarn(sysId, firmwareId, required, msg);
                return(null);
            }
        }
Example #2
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);
        }