DatItems of destiny

This commit is contained in:
Matt Nadareski
2020-08-17 17:28:32 -07:00
parent fafac31ea8
commit 5660da7b0e
8 changed files with 521 additions and 294 deletions

View File

@@ -1,4 +1,5 @@
using SabreTools.Library.Data;
using System.Collections.Generic;
using System.Security.Permissions;
using Newtonsoft.Json;
namespace SabreTools.Library.DatItems
@@ -24,6 +25,42 @@ namespace SabreTools.Library.DatItems
#endregion
#region Accessors
/// <summary>
/// Get the value of that field as a string, if possible
/// </summary>
public override string GetField(Field field, List<Field> excludeFields)
{
// If the field is to be excluded, return empty string
if (excludeFields.Contains(field))
return string.Empty;
// Handle BiosSet-specific fields
string fieldValue;
switch (field)
{
case Field.Default:
fieldValue = Default?.ToString();
break;
case Field.BiosDescription:
fieldValue = Description;
break;
// For everything else, use the base method
default:
return base.GetField(field, excludeFields);
}
// Make sure we don't return null
if (string.IsNullOrEmpty(fieldValue))
fieldValue = string.Empty;
return fieldValue;
}
#endregion
#region Constructors
/// <summary>