Only include booleans if the value is true

This commit is contained in:
Matt Nadareski
2022-01-07 12:49:10 -08:00
parent 187e951a47
commit 00a76fb648
2 changed files with 15 additions and 2 deletions

View File

@@ -38,6 +38,7 @@
- Convert postgap and VCD fields to checkboxes
- Adjust width ratios for disc info window
- Fix IsReadOnly
- Only include booleans if the value is true
### 2.2 (2021-12-30)
- Fix Saturn header finding

View File

@@ -887,11 +887,17 @@ namespace MPF.Library
string line = $"{kvp.Key.ShortName()}{(isMultiLine ? "\n" : " ")}";
// Special case for boolean fields
if ((kvp.Key == SiteCode.PostgapType || kvp.Key == SiteCode.VCD) && kvp.Value != true.ToString())
if (kvp.Key == SiteCode.PostgapType || kvp.Key == SiteCode.VCD)
{
if (kvp.Value != true.ToString())
return string.Empty;
return line.Trim();
}
return $"{line}{kvp.Value}{(isMultiLine ? "\n" : string.Empty)}";
})
.Where(s => !string.IsNullOrEmpty(s))
) + "\n" + info.CommonDiscInfo.Comments;
// Trim the comments field
@@ -918,11 +924,17 @@ namespace MPF.Library
string line = $"{kvp.Key.ShortName()}{(isMultiLine ? "\n" : " ")}";
// Special case for boolean fields
if ((kvp.Key == SiteCode.PostgapType || kvp.Key == SiteCode.VCD) && kvp.Value != true.ToString())
if (kvp.Key == SiteCode.PostgapType || kvp.Key == SiteCode.VCD)
{
if (kvp.Value != true.ToString())
return string.Empty;
return line.Trim();
}
return $"{line}{kvp.Value}{(isMultiLine ? "\n" : string.Empty)}";
})
.Where(s => !string.IsNullOrEmpty(s))
) + "\n" + info.CommonDiscInfo.Contents;
// Trim the contents field