From 470fc924a062041bf2f9ce8edf20b0c07c39eaf1 Mon Sep 17 00:00:00 2001 From: Lothrien <91413352+Lothrien@users.noreply.github.com> Date: Tue, 22 Feb 2022 22:09:11 +0100 Subject: [PATCH] add dataareas to part (#52) * add dataareas to part to add additional dataareas in rom element * adding dataareas while updating vs code, references where lost, but i hope i'll get everything to the correct place... --- SabreTools.DatItems/Formats/Part.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/SabreTools.DatItems/Formats/Part.cs b/SabreTools.DatItems/Formats/Part.cs index 9adef25e..3dc07014 100644 --- a/SabreTools.DatItems/Formats/Part.cs +++ b/SabreTools.DatItems/Formats/Part.cs @@ -27,6 +27,13 @@ namespace SabreTools.DatItems.Formats [XmlElement("features")] public List Features { get; set; } + [JsonProperty("dataAreas", DefaultValueHandling = DefaultValueHandling.Ignore)] + [XmlElement("dataAreas")] + public List DataAreas { get; set; } + + [JsonIgnore] + public bool DataAreasSpecified { get { return DataAreas != null && DataAreas.Count > 0; } } + [JsonIgnore] public bool FeaturesSpecified { get { return Features != null && Features.Count > 0; } } @@ -71,6 +78,7 @@ namespace SabreTools.DatItems.Formats Name = this.Name, Interface = this.Interface, Features = this.Features, + DataAreas = this.DataAreas, }; } @@ -102,6 +110,15 @@ namespace SabreTools.DatItems.Formats } } + // If the dataareas match + if (DataAreasSpecified) + { + foreach (DataArea dataArea in DataAreas) + { + match &= newOther.DataAreas.Contains(dataArea); + } + } + return match; }