Convert FirmwareRecord to a readonly struct
This commit is contained in:
parent
2e52827bc1
commit
a41fc1f1ce
|
@ -37,7 +37,7 @@ namespace BizHawk.Client.Common
|
|||
var resolved = Resolve(
|
||||
pathEntries,
|
||||
userSpecifications,
|
||||
FirmwareDatabase.FirmwareRecords.FirstOrDefault(fr => fr.ID == id));
|
||||
FirmwareDatabase.FirmwareRecords.First(fr => fr.ID == id));
|
||||
if (resolved == null)
|
||||
{
|
||||
return null;
|
||||
|
|
|
@ -179,7 +179,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
};
|
||||
lvi.SubItems.Add(fr.ID.System);
|
||||
lvi.SubItems.Add(fr.ID.Firmware);
|
||||
lvi.SubItems.Add(fr.Descr);
|
||||
lvi.SubItems.Add(fr.Description);
|
||||
lvi.SubItems.Add(""); // resolved with
|
||||
lvi.SubItems.Add(""); // location
|
||||
lvi.SubItems.Add(""); // size
|
||||
|
@ -531,7 +531,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
lblFirmware =
|
||||
{
|
||||
Text = $"{fr.ID.System} : {fr.ID.Firmware} ({fr.Descr})"
|
||||
Text = $"{fr.ID.System} : {fr.ID.Firmware} ({fr.Description})"
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -40,11 +40,7 @@ namespace BizHawk.Emulation.Common
|
|||
=> options.Add(new(new(systemId, id), ff.Hash, ff.Size, ff.IsBad ? FirmwareOptionStatus.Bad : status));
|
||||
|
||||
void Firmware(string systemId, string id, string desc)
|
||||
=> records.Add(new FirmwareRecord
|
||||
{
|
||||
ID = new(systemId, id),
|
||||
Descr = desc
|
||||
});
|
||||
=> records.Add(new(new(systemId, id), desc));
|
||||
|
||||
void FirmwareAndOption(string hash, long size, string systemId, string id, string name, string desc)
|
||||
{
|
||||
|
|
|
@ -1,9 +1,17 @@
|
|||
#nullable enable
|
||||
|
||||
namespace BizHawk.Emulation.Common
|
||||
{
|
||||
public sealed class FirmwareRecord
|
||||
public readonly struct FirmwareRecord
|
||||
{
|
||||
public string Descr { get; set; }
|
||||
public readonly string Description;
|
||||
|
||||
public FirmwareID ID { get; set; }
|
||||
public readonly FirmwareID ID;
|
||||
|
||||
public FirmwareRecord(FirmwareID id, string desc)
|
||||
{
|
||||
Description = desc;
|
||||
ID = id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue