FirmwareManager - replace query syntax with LINQ expressions. Query syntax is a pain unless you really need it
This commit is contained in:
parent
5f2b4fe4d2
commit
965c7555ce
|
@ -185,10 +185,10 @@ namespace BizHawk.Client.Common
|
||||||
|
|
||||||
// get all options for this firmware (in order)
|
// get all options for this firmware (in order)
|
||||||
var fr1 = fr;
|
var fr1 = fr;
|
||||||
var options =
|
var options = FirmwareDatabase.FirmwareOptions
|
||||||
from fo in FirmwareDatabase.FirmwareOptions
|
.Where(fo => fo.SystemId == fr1.SystemId
|
||||||
where fo.SystemId == fr1.SystemId && fo.FirmwareId == fr1.FirmwareId && fo.IsAcceptableOrIdeal
|
&& fo.FirmwareId == fr1.FirmwareId
|
||||||
select fo;
|
&& fo.IsAcceptableOrIdeal);
|
||||||
|
|
||||||
// try each option
|
// try each option
|
||||||
foreach (var fo in options)
|
foreach (var fo in options)
|
||||||
|
@ -245,16 +245,14 @@ namespace BizHawk.Client.Common
|
||||||
ri.Size = fi.Length;
|
ri.Size = fi.Length;
|
||||||
ri.Hash = rff.Hash;
|
ri.Hash = rff.Hash;
|
||||||
|
|
||||||
// check whether it was a known file anyway, and go ahead and bind to the known file, as a perk (the firmwares config doesnt really use this information right now)
|
// check whether it was a known file anyway, and go ahead and bind to the known file, as a perk (the firmwares config doesn't really use this information right now)
|
||||||
if (FirmwareDatabase.FirmwareFilesByHash.TryGetValue(rff.Hash, out var ff))
|
if (FirmwareDatabase.FirmwareFilesByHash.TryGetValue(rff.Hash, out var ff))
|
||||||
{
|
{
|
||||||
ri.KnownFirmwareFile = ff;
|
ri.KnownFirmwareFile = ff;
|
||||||
|
|
||||||
// if the known firmware file is for a different firmware, flag it so we can show a warning
|
// if the known firmware file is for a different firmware, flag it so we can show a warning
|
||||||
var option =
|
var option = FirmwareDatabase.FirmwareOptions
|
||||||
(from fo in FirmwareDatabase.FirmwareOptions
|
.FirstOrDefault(fo => fo.Hash == rff.Hash && fo.ConfigKey != fr.ConfigKey);
|
||||||
where fo.Hash == rff.Hash && fo.ConfigKey != fr.ConfigKey
|
|
||||||
select fr).FirstOrDefault();
|
|
||||||
|
|
||||||
if (option != null)
|
if (option != null)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue