Convert RealFirmwareFile to readonly struct
This commit is contained in:
parent
3a3cb0c30b
commit
2f18c74840
|
@ -58,15 +58,14 @@ namespace BizHawk.Client.Common
|
|||
|
||||
public RealFirmwareFile Read(FileInfo fi)
|
||||
{
|
||||
var rff = new RealFirmwareFile { FileInfo = fi };
|
||||
|
||||
using (var fs = fi.OpenRead())
|
||||
{
|
||||
_sha1.ComputeHash(fs);
|
||||
}
|
||||
|
||||
rff.Hash = _sha1.Hash.BytesToHexString();
|
||||
Dict[rff.Hash] = rff;
|
||||
var hash = _sha1.Hash.BytesToHexString();
|
||||
var rff = new RealFirmwareFile(fi, hash);
|
||||
Dict[hash] = rff;
|
||||
return rff;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,12 +1,20 @@
|
|||
#nullable enable
|
||||
|
||||
using System.IO;
|
||||
|
||||
namespace BizHawk.Client.Common
|
||||
{
|
||||
/// <summary>represents a file found on disk in the user's firmware directory matching a file in our database</summary>
|
||||
public sealed class RealFirmwareFile
|
||||
public readonly struct RealFirmwareFile
|
||||
{
|
||||
public FileInfo FileInfo { get; set; }
|
||||
public readonly FileInfo FileInfo;
|
||||
|
||||
public string Hash { get; set; }
|
||||
public readonly string Hash;
|
||||
|
||||
public RealFirmwareFile(FileInfo fileInfo, string hash)
|
||||
{
|
||||
FileInfo = fileInfo;
|
||||
Hash = hash;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue