diff --git a/SabreTools.Library/DatFiles/OpenMSX.cs b/SabreTools.Library/DatFiles/OpenMSX.cs index 36c8d1d2..a8e6fd81 100644 --- a/SabreTools.Library/DatFiles/OpenMSX.cs +++ b/SabreTools.Library/DatFiles/OpenMSX.cs @@ -252,8 +252,14 @@ namespace SabreTools.Library.DatFiles // If we have any items, loop through and add them foreach (DatItem item in items) { + switch (item.ItemType) + { + case ItemType.Rom: + (item as Rom).Original = original; + break; + } + item.CopyMachineInformation(machine); - item.Original = original; ParseAddHelper(item); } @@ -705,12 +711,12 @@ namespace SabreTools.Library.DatFiles xtw.WriteEndElement(); } - switch (datItem.OpenMSXSubType) + switch (rom.OpenMSXSubType) { // Default to Rom for converting from other formats case OpenMSXSubType.Rom: case OpenMSXSubType.NULL: - xtw.WriteStartElement(datItem.OpenMSXSubType.FromOpenMSXSubType()); + xtw.WriteStartElement(rom.OpenMSXSubType.FromOpenMSXSubType()); xtw.WriteRequiredElementString("hash", rom.SHA1?.ToLowerInvariant()); xtw.WriteOptionalElementString("start", rom.Offset); xtw.WriteOptionalElementString("type", rom.OpenMSXType); @@ -719,7 +725,7 @@ namespace SabreTools.Library.DatFiles break; case OpenMSXSubType.MegaRom: - xtw.WriteStartElement(datItem.OpenMSXSubType.FromOpenMSXSubType()); + xtw.WriteStartElement(rom.OpenMSXSubType.FromOpenMSXSubType()); xtw.WriteRequiredElementString("hash", rom.SHA1?.ToLowerInvariant()); xtw.WriteOptionalElementString("start", rom.Offset); xtw.WriteOptionalElementString("type", rom.OpenMSXType); @@ -728,7 +734,7 @@ namespace SabreTools.Library.DatFiles break; case OpenMSXSubType.SCCPlusCart: - xtw.WriteStartElement(datItem.OpenMSXSubType.FromOpenMSXSubType()); + xtw.WriteStartElement(rom.OpenMSXSubType.FromOpenMSXSubType()); xtw.WriteOptionalElementString("boot", rom.Boot); xtw.WriteRequiredElementString("hash", rom.SHA1?.ToLowerInvariant()); xtw.WriteOptionalElementString("remark", rom.Remark); diff --git a/SabreTools.Library/DatItems/Adjuster.cs b/SabreTools.Library/DatItems/Adjuster.cs index dfcc646d..a6b3726d 100644 --- a/SabreTools.Library/DatItems/Adjuster.cs +++ b/SabreTools.Library/DatItems/Adjuster.cs @@ -101,12 +101,6 @@ namespace SabreTools.Library.DatItems AltName = this.AltName, AltTitle = this.AltTitle, - Original = this.Original, - OpenMSXSubType = this.OpenMSXSubType, - OpenMSXType = this.OpenMSXType, - Remark = this.Remark, - Boot = this.Boot, - Machine = this.Machine.Clone() as Machine, Source = this.Source.Clone() as Source, Remove = this.Remove, diff --git a/SabreTools.Library/DatItems/Analog.cs b/SabreTools.Library/DatItems/Analog.cs index cf9d4c9a..079ed2d0 100644 --- a/SabreTools.Library/DatItems/Analog.cs +++ b/SabreTools.Library/DatItems/Analog.cs @@ -64,12 +64,6 @@ namespace SabreTools.Library.DatItems AltName = this.AltName, AltTitle = this.AltTitle, - Original = this.Original, - OpenMSXSubType = this.OpenMSXSubType, - OpenMSXType = this.OpenMSXType, - Remark = this.Remark, - Boot = this.Boot, - Machine = this.Machine.Clone() as Machine, Source = this.Source.Clone() as Source, Remove = this.Remove, diff --git a/SabreTools.Library/DatItems/Archive.cs b/SabreTools.Library/DatItems/Archive.cs index 4034f222..7bc0a472 100644 --- a/SabreTools.Library/DatItems/Archive.cs +++ b/SabreTools.Library/DatItems/Archive.cs @@ -77,12 +77,6 @@ namespace SabreTools.Library.DatItems AltName = this.AltName, AltTitle = this.AltTitle, - Original = this.Original, - OpenMSXSubType = this.OpenMSXSubType, - OpenMSXType = this.OpenMSXType, - Remark = this.Remark, - Boot = this.Boot, - Machine = this.Machine.Clone() as Machine, Source = this.Source.Clone() as Source, Remove = this.Remove, diff --git a/SabreTools.Library/DatItems/BiosSet.cs b/SabreTools.Library/DatItems/BiosSet.cs index 8e379862..491f62fc 100644 --- a/SabreTools.Library/DatItems/BiosSet.cs +++ b/SabreTools.Library/DatItems/BiosSet.cs @@ -95,12 +95,6 @@ namespace SabreTools.Library.DatItems AltName = this.AltName, AltTitle = this.AltTitle, - Original = this.Original, - OpenMSXSubType = this.OpenMSXSubType, - OpenMSXType = this.OpenMSXType, - Remark = this.Remark, - Boot = this.Boot, - Machine = this.Machine.Clone() as Machine, Source = this.Source.Clone() as Source, Remove = this.Remove, diff --git a/SabreTools.Library/DatItems/Blank.cs b/SabreTools.Library/DatItems/Blank.cs index 674651ec..996ae0d7 100644 --- a/SabreTools.Library/DatItems/Blank.cs +++ b/SabreTools.Library/DatItems/Blank.cs @@ -32,12 +32,6 @@ namespace SabreTools.Library.DatItems AltName = this.AltName, AltTitle = this.AltTitle, - Original = this.Original, - OpenMSXSubType = this.OpenMSXSubType, - OpenMSXType = this.OpenMSXType, - Remark = this.Remark, - Boot = this.Boot, - Machine = this.Machine.Clone() as Machine, Source = this.Source.Clone() as Source, Remove = this.Remove, diff --git a/SabreTools.Library/DatItems/Chip.cs b/SabreTools.Library/DatItems/Chip.cs index 805f5cfd..68d2077d 100644 --- a/SabreTools.Library/DatItems/Chip.cs +++ b/SabreTools.Library/DatItems/Chip.cs @@ -106,12 +106,6 @@ namespace SabreTools.Library.DatItems AltName = this.AltName, AltTitle = this.AltTitle, - Original = this.Original, - OpenMSXSubType = this.OpenMSXSubType, - OpenMSXType = this.OpenMSXType, - Remark = this.Remark, - Boot = this.Boot, - Machine = this.Machine.Clone() as Machine, Source = this.Source.Clone() as Source, Remove = this.Remove, diff --git a/SabreTools.Library/DatItems/Condition.cs b/SabreTools.Library/DatItems/Condition.cs index 46949d4a..8f1c4467 100644 --- a/SabreTools.Library/DatItems/Condition.cs +++ b/SabreTools.Library/DatItems/Condition.cs @@ -99,12 +99,6 @@ namespace SabreTools.Library.DatItems AltName = this.AltName, AltTitle = this.AltTitle, - Original = this.Original, - OpenMSXSubType = this.OpenMSXSubType, - OpenMSXType = this.OpenMSXType, - Remark = this.Remark, - Boot = this.Boot, - Machine = this.Machine.Clone() as Machine, Source = this.Source.Clone() as Source, Remove = this.Remove, diff --git a/SabreTools.Library/DatItems/Configuration.cs b/SabreTools.Library/DatItems/Configuration.cs index c3de4942..b4e4b22d 100644 --- a/SabreTools.Library/DatItems/Configuration.cs +++ b/SabreTools.Library/DatItems/Configuration.cs @@ -140,12 +140,6 @@ namespace SabreTools.Library.DatItems AltName = this.AltName, AltTitle = this.AltTitle, - Original = this.Original, - OpenMSXSubType = this.OpenMSXSubType, - OpenMSXType = this.OpenMSXType, - Remark = this.Remark, - Boot = this.Boot, - Machine = this.Machine.Clone() as Machine, Source = this.Source.Clone() as Source, Remove = this.Remove, diff --git a/SabreTools.Library/DatItems/Control.cs b/SabreTools.Library/DatItems/Control.cs index 55cec761..5172f716 100644 --- a/SabreTools.Library/DatItems/Control.cs +++ b/SabreTools.Library/DatItems/Control.cs @@ -164,12 +164,6 @@ namespace SabreTools.Library.DatItems AltName = this.AltName, AltTitle = this.AltTitle, - Original = this.Original, - OpenMSXSubType = this.OpenMSXSubType, - OpenMSXType = this.OpenMSXType, - Remark = this.Remark, - Boot = this.Boot, - Machine = this.Machine.Clone() as Machine, Source = this.Source.Clone() as Source, Remove = this.Remove, diff --git a/SabreTools.Library/DatItems/DatItem.cs b/SabreTools.Library/DatItems/DatItem.cs index ba5ed6e4..8c806560 100644 --- a/SabreTools.Library/DatItems/DatItem.cs +++ b/SabreTools.Library/DatItems/DatItem.cs @@ -66,42 +66,6 @@ namespace SabreTools.Library.DatItems #endregion - #region OpenMSX - - /// - /// OpenMSX sub item type - /// - [JsonProperty("original", DefaultValueHandling = DefaultValueHandling.Ignore)] - public Original Original { get; set; } - - /// - /// OpenMSX sub item type - /// - [JsonProperty("openmsx_subtype", DefaultValueHandling = DefaultValueHandling.Ignore)] - [JsonConverter(typeof(StringEnumConverter))] - public OpenMSXSubType OpenMSXSubType { get; set; } - - /// - /// OpenMSX sub item type - /// - /// Not related to the subtype above - [JsonProperty("openmsx_type", DefaultValueHandling = DefaultValueHandling.Ignore)] - public string OpenMSXType { get; set; } - - /// - /// Item remark (like a comment) - /// - [JsonProperty("remark", DefaultValueHandling = DefaultValueHandling.Ignore)] - public string Remark { get; set; } - - /// - /// Boot state - /// - [JsonProperty("boot", DefaultValueHandling = DefaultValueHandling.Ignore)] - public string Boot { get; set; } - - #endregion - #region Metadata information /// @@ -337,25 +301,6 @@ namespace SabreTools.Library.DatItems AltTitle = mappings[Field.DatItem_AltTitle]; #endregion - - #region OpenMSX - - if (mappings.Keys.Contains(Field.DatItem_Original)) - Original = new Original() { Content = mappings[Field.DatItem_Original] }; - - if (mappings.Keys.Contains(Field.DatItem_OpenMSXSubType)) - OpenMSXSubType = mappings[Field.DatItem_OpenMSXSubType].AsOpenMSXSubType(); - - if (mappings.Keys.Contains(Field.DatItem_OpenMSXType)) - OpenMSXType = mappings[Field.DatItem_OpenMSXType]; - - if (mappings.Keys.Contains(Field.DatItem_Remark)) - Remark = mappings[Field.DatItem_Remark]; - - if (mappings.Keys.Contains(Field.DatItem_Boot)) - Boot = mappings[Field.DatItem_Boot]; - - #endregion } #endregion @@ -700,40 +645,6 @@ namespace SabreTools.Library.DatItems #endregion - #region OpenMSX - - // Filter on original - if (filter.DatItem_Original.MatchesPositiveSet(Original?.Content) == false) - return false; - if (filter.DatItem_Original.MatchesNegativeSet(Original?.Content) == true) - return false; - - // Filter on OpenMSX subtype - if (filter.DatItem_OpenMSXSubType.MatchesPositiveSet(OpenMSXSubType) == false) - return false; - if (filter.DatItem_OpenMSXSubType.MatchesNegativeSet(OpenMSXSubType) == true) - return false; - - // Filter on OpenMSX type - if (filter.DatItem_OpenMSXType.MatchesPositiveSet(OpenMSXType) == false) - return false; - if (filter.DatItem_OpenMSXType.MatchesNegativeSet(OpenMSXType) == true) - return false; - - // Filter on remark - if (filter.DatItem_Remark.MatchesPositiveSet(Remark) == false) - return false; - if (filter.DatItem_Remark.MatchesNegativeSet(Remark) == true) - return false; - - // Filter on boot - if (filter.DatItem_Boot.MatchesPositiveSet(Boot) == false) - return false; - if (filter.DatItem_Boot.MatchesNegativeSet(Boot) == true) - return false; - - #endregion - return true; } @@ -755,25 +666,6 @@ namespace SabreTools.Library.DatItems AltTitle = null; #endregion - - #region OpenMSX - - if (fields.Contains(Field.DatItem_Original)) - Original = null; - - if (fields.Contains(Field.DatItem_OpenMSXSubType)) - OpenMSXSubType = OpenMSXSubType.NULL; - - if (fields.Contains(Field.DatItem_OpenMSXType)) - OpenMSXType = null; - - if (fields.Contains(Field.DatItem_Remark)) - Remark = null; - - if (fields.Contains(Field.DatItem_Boot)) - Boot = null; - - #endregion } /// @@ -872,25 +764,6 @@ namespace SabreTools.Library.DatItems AltTitle = item.AltTitle; #endregion - - #region OpenMSX - - if (fields.Contains(Field.DatItem_Original)) - Original = item.Original; - - if (fields.Contains(Field.DatItem_OpenMSXSubType)) - OpenMSXSubType = item.OpenMSXSubType; - - if (fields.Contains(Field.DatItem_OpenMSXType)) - OpenMSXType = item.OpenMSXType; - - if (fields.Contains(Field.DatItem_Remark)) - Remark = item.Remark; - - if (fields.Contains(Field.DatItem_Boot)) - Boot = item.Boot; - - #endregion } #endregion diff --git a/SabreTools.Library/DatItems/Device.cs b/SabreTools.Library/DatItems/Device.cs index 54879ceb..c9672929 100644 --- a/SabreTools.Library/DatItems/Device.cs +++ b/SabreTools.Library/DatItems/Device.cs @@ -115,12 +115,6 @@ namespace SabreTools.Library.DatItems AltName = this.AltName, AltTitle = this.AltTitle, - Original = this.Original, - OpenMSXSubType = this.OpenMSXSubType, - OpenMSXType = this.OpenMSXType, - Remark = this.Remark, - Boot = this.Boot, - Machine = this.Machine.Clone() as Machine, Source = this.Source.Clone() as Source, Remove = this.Remove, diff --git a/SabreTools.Library/DatItems/DeviceReference.cs b/SabreTools.Library/DatItems/DeviceReference.cs index 2fc1ac0a..693e4ecf 100644 --- a/SabreTools.Library/DatItems/DeviceReference.cs +++ b/SabreTools.Library/DatItems/DeviceReference.cs @@ -77,12 +77,6 @@ namespace SabreTools.Library.DatItems AltName = this.AltName, AltTitle = this.AltTitle, - Original = this.Original, - OpenMSXSubType = this.OpenMSXSubType, - OpenMSXType = this.OpenMSXType, - Remark = this.Remark, - Boot = this.Boot, - Machine = this.Machine.Clone() as Machine, Source = this.Source.Clone() as Source, Remove = this.Remove, diff --git a/SabreTools.Library/DatItems/DipSwitch.cs b/SabreTools.Library/DatItems/DipSwitch.cs index fe7026d3..56397875 100644 --- a/SabreTools.Library/DatItems/DipSwitch.cs +++ b/SabreTools.Library/DatItems/DipSwitch.cs @@ -158,12 +158,6 @@ namespace SabreTools.Library.DatItems AltName = this.AltName, AltTitle = this.AltTitle, - Original = this.Original, - OpenMSXSubType = this.OpenMSXSubType, - OpenMSXType = this.OpenMSXType, - Remark = this.Remark, - Boot = this.Boot, - Machine = this.Machine.Clone() as Machine, Source = this.Source.Clone() as Source, Remove = this.Remove, diff --git a/SabreTools.Library/DatItems/Disk.cs b/SabreTools.Library/DatItems/Disk.cs index 7d7b5f20..c04f3beb 100644 --- a/SabreTools.Library/DatItems/Disk.cs +++ b/SabreTools.Library/DatItems/Disk.cs @@ -230,12 +230,6 @@ namespace SabreTools.Library.DatItems AltName = this.AltName, AltTitle = this.AltTitle, - Original = this.Original, - OpenMSXSubType = this.OpenMSXSubType, - OpenMSXType = this.OpenMSXType, - Remark = this.Remark, - Boot = this.Boot, - Machine = this.Machine.Clone() as Machine, Source = this.Source.Clone() as Source, Remove = this.Remove, @@ -269,12 +263,6 @@ namespace SabreTools.Library.DatItems AltName = this.AltName, AltTitle = this.AltTitle, - Original = this.Original, - OpenMSXSubType = this.OpenMSXSubType, - OpenMSXType = this.OpenMSXType, - Remark = this.Remark, - Boot = this.Boot, - Machine = this.Machine.Clone() as Machine, Source = this.Source.Clone() as Source, Remove = this.Remove, diff --git a/SabreTools.Library/DatItems/Display.cs b/SabreTools.Library/DatItems/Display.cs index c2e8704d..cd361eb3 100644 --- a/SabreTools.Library/DatItems/Display.cs +++ b/SabreTools.Library/DatItems/Display.cs @@ -181,12 +181,6 @@ namespace SabreTools.Library.DatItems AltName = this.AltName, AltTitle = this.AltTitle, - Original = this.Original, - OpenMSXSubType = this.OpenMSXSubType, - OpenMSXType = this.OpenMSXType, - Remark = this.Remark, - Boot = this.Boot, - Machine = this.Machine.Clone() as Machine, Source = this.Source.Clone() as Source, Remove = this.Remove, diff --git a/SabreTools.Library/DatItems/Driver.cs b/SabreTools.Library/DatItems/Driver.cs index 54a7ef22..ec6baa9c 100644 --- a/SabreTools.Library/DatItems/Driver.cs +++ b/SabreTools.Library/DatItems/Driver.cs @@ -97,12 +97,6 @@ namespace SabreTools.Library.DatItems AltName = this.AltName, AltTitle = this.AltTitle, - Original = this.Original, - OpenMSXSubType = this.OpenMSXSubType, - OpenMSXType = this.OpenMSXType, - Remark = this.Remark, - Boot = this.Boot, - Machine = this.Machine.Clone() as Machine, Source = this.Source.Clone() as Source, Remove = this.Remove, diff --git a/SabreTools.Library/DatItems/Enums.cs b/SabreTools.Library/DatItems/Enums.cs index 8d2b0ad1..e34ccaca 100644 --- a/SabreTools.Library/DatItems/Enums.cs +++ b/SabreTools.Library/DatItems/Enums.cs @@ -78,7 +78,7 @@ namespace SabreTools.Library.DatItems /// List of valid field types within a DatItem/Machine /// /// TODO: Move this to a more common location - /// TODO: Should this be split into separate enums? + /// TODO: Ensure the order of these after all shuffling public enum Field : int { NULL = 0, @@ -241,16 +241,6 @@ namespace SabreTools.Library.DatItems #endregion - #region OpenMSX - - DatItem_Original, - DatItem_OpenMSXSubType, - DatItem_OpenMSXType, - DatItem_Remark, - DatItem_Boot, - - #endregion - #region SoftwareList // Part @@ -291,6 +281,13 @@ namespace SabreTools.Library.DatItems DatItem_Optional, DatItem_Inverted, + // Rom (OpenMSX) + DatItem_Original, + DatItem_OpenMSXSubType, + DatItem_OpenMSXType, + DatItem_Remark, + DatItem_Boot, + // Rom (SoftwareList) DatItem_AreaName, DatItem_AreaSize, diff --git a/SabreTools.Library/DatItems/Extension.cs b/SabreTools.Library/DatItems/Extension.cs index 6de8405f..3a0a71ed 100644 --- a/SabreTools.Library/DatItems/Extension.cs +++ b/SabreTools.Library/DatItems/Extension.cs @@ -77,12 +77,6 @@ namespace SabreTools.Library.DatItems AltName = this.AltName, AltTitle = this.AltTitle, - Original = this.Original, - OpenMSXSubType = this.OpenMSXSubType, - OpenMSXType = this.OpenMSXType, - Remark = this.Remark, - Boot = this.Boot, - Machine = this.Machine.Clone() as Machine, Source = this.Source.Clone() as Source, Remove = this.Remove, diff --git a/SabreTools.Library/DatItems/Feature.cs b/SabreTools.Library/DatItems/Feature.cs index a61942a4..395c8f57 100644 --- a/SabreTools.Library/DatItems/Feature.cs +++ b/SabreTools.Library/DatItems/Feature.cs @@ -87,12 +87,6 @@ namespace SabreTools.Library.DatItems AltName = this.AltName, AltTitle = this.AltTitle, - Original = this.Original, - OpenMSXSubType = this.OpenMSXSubType, - OpenMSXType = this.OpenMSXType, - Remark = this.Remark, - Boot = this.Boot, - Machine = this.Machine.Clone() as Machine, Source = this.Source.Clone() as Source, Remove = this.Remove, diff --git a/SabreTools.Library/DatItems/Info.cs b/SabreTools.Library/DatItems/Info.cs index 3f90f391..14f9da20 100644 --- a/SabreTools.Library/DatItems/Info.cs +++ b/SabreTools.Library/DatItems/Info.cs @@ -85,12 +85,6 @@ namespace SabreTools.Library.DatItems AltName = this.AltName, AltTitle = this.AltTitle, - Original = this.Original, - OpenMSXSubType = this.OpenMSXSubType, - OpenMSXType = this.OpenMSXType, - Remark = this.Remark, - Boot = this.Boot, - Machine = this.Machine.Clone() as Machine, Source = this.Source.Clone() as Source, Remove = this.Remove, diff --git a/SabreTools.Library/DatItems/Input.cs b/SabreTools.Library/DatItems/Input.cs index e56cfd8f..93d671a9 100644 --- a/SabreTools.Library/DatItems/Input.cs +++ b/SabreTools.Library/DatItems/Input.cs @@ -99,12 +99,6 @@ namespace SabreTools.Library.DatItems AltName = this.AltName, AltTitle = this.AltTitle, - Original = this.Original, - OpenMSXSubType = this.OpenMSXSubType, - OpenMSXType = this.OpenMSXType, - Remark = this.Remark, - Boot = this.Boot, - Machine = this.Machine.Clone() as Machine, Source = this.Source.Clone() as Source, Remove = this.Remove, diff --git a/SabreTools.Library/DatItems/Instance.cs b/SabreTools.Library/DatItems/Instance.cs index 9e9b6abe..457ea338 100644 --- a/SabreTools.Library/DatItems/Instance.cs +++ b/SabreTools.Library/DatItems/Instance.cs @@ -86,12 +86,6 @@ namespace SabreTools.Library.DatItems AltName = this.AltName, AltTitle = this.AltTitle, - Original = this.Original, - OpenMSXSubType = this.OpenMSXSubType, - OpenMSXType = this.OpenMSXType, - Remark = this.Remark, - Boot = this.Boot, - Machine = this.Machine.Clone() as Machine, Source = this.Source.Clone() as Source, Remove = this.Remove, diff --git a/SabreTools.Library/DatItems/Location.cs b/SabreTools.Library/DatItems/Location.cs index 7fed8d7e..3b9bd688 100644 --- a/SabreTools.Library/DatItems/Location.cs +++ b/SabreTools.Library/DatItems/Location.cs @@ -94,12 +94,6 @@ namespace SabreTools.Library.DatItems AltName = this.AltName, AltTitle = this.AltTitle, - Original = this.Original, - OpenMSXSubType = this.OpenMSXSubType, - OpenMSXType = this.OpenMSXType, - Remark = this.Remark, - Boot = this.Boot, - Machine = this.Machine.Clone() as Machine, Source = this.Source.Clone() as Source, Remove = this.Remove, diff --git a/SabreTools.Library/DatItems/Media.cs b/SabreTools.Library/DatItems/Media.cs index 38982384..d14f9adf 100644 --- a/SabreTools.Library/DatItems/Media.cs +++ b/SabreTools.Library/DatItems/Media.cs @@ -142,12 +142,6 @@ namespace SabreTools.Library.DatItems AltName = this.AltName, AltTitle = this.AltTitle, - Original = this.Original, - OpenMSXSubType = this.OpenMSXSubType, - OpenMSXType = this.OpenMSXType, - Remark = this.Remark, - Boot = this.Boot, - Machine = this.Machine.Clone() as Machine, Source = this.Source.Clone() as Source, Remove = this.Remove, @@ -173,12 +167,6 @@ namespace SabreTools.Library.DatItems AltName = this.AltName, AltTitle = this.AltTitle, - Original = this.Original, - OpenMSXSubType = this.OpenMSXSubType, - OpenMSXType = this.OpenMSXType, - Remark = this.Remark, - Boot = this.Boot, - Machine = this.Machine.Clone() as Machine, Source = this.Source.Clone() as Source, Remove = this.Remove, diff --git a/SabreTools.Library/DatItems/Port.cs b/SabreTools.Library/DatItems/Port.cs index 311d193a..033a48e4 100644 --- a/SabreTools.Library/DatItems/Port.cs +++ b/SabreTools.Library/DatItems/Port.cs @@ -74,12 +74,6 @@ namespace SabreTools.Library.DatItems AltName = this.AltName, AltTitle = this.AltTitle, - Original = this.Original, - OpenMSXSubType = this.OpenMSXSubType, - OpenMSXType = this.OpenMSXType, - Remark = this.Remark, - Boot = this.Boot, - Machine = this.Machine.Clone() as Machine, Source = this.Source.Clone() as Source, Remove = this.Remove, diff --git a/SabreTools.Library/DatItems/RamOption.cs b/SabreTools.Library/DatItems/RamOption.cs index bcda5985..672557a6 100644 --- a/SabreTools.Library/DatItems/RamOption.cs +++ b/SabreTools.Library/DatItems/RamOption.cs @@ -95,12 +95,6 @@ namespace SabreTools.Library.DatItems AltName = this.AltName, AltTitle = this.AltTitle, - Original = this.Original, - OpenMSXSubType = this.OpenMSXSubType, - OpenMSXType = this.OpenMSXType, - Remark = this.Remark, - Boot = this.Boot, - Machine = this.Machine.Clone() as Machine, Source = this.Source.Clone() as Source, Remove = this.Remove, diff --git a/SabreTools.Library/DatItems/Release.cs b/SabreTools.Library/DatItems/Release.cs index 5eb4960c..16a7520c 100644 --- a/SabreTools.Library/DatItems/Release.cs +++ b/SabreTools.Library/DatItems/Release.cs @@ -117,12 +117,6 @@ namespace SabreTools.Library.DatItems AltName = this.AltName, AltTitle = this.AltTitle, - Original = this.Original, - OpenMSXSubType = this.OpenMSXSubType, - OpenMSXType = this.OpenMSXType, - Remark = this.Remark, - Boot = this.Boot, - Machine = this.Machine.Clone() as Machine, Source = this.Source.Clone() as Source, Remove = this.Remove, diff --git a/SabreTools.Library/DatItems/Rom.cs b/SabreTools.Library/DatItems/Rom.cs index 6c7c634d..a8697cda 100644 --- a/SabreTools.Library/DatItems/Rom.cs +++ b/SabreTools.Library/DatItems/Rom.cs @@ -171,6 +171,42 @@ namespace SabreTools.Library.DatItems #endregion + #region OpenMSX + + /// + /// OpenMSX sub item type + /// + [JsonProperty("original", DefaultValueHandling = DefaultValueHandling.Ignore)] + public Original Original { get; set; } + + /// + /// OpenMSX sub item type + /// + [JsonProperty("openmsx_subtype", DefaultValueHandling = DefaultValueHandling.Ignore)] + [JsonConverter(typeof(StringEnumConverter))] + public OpenMSXSubType OpenMSXSubType { get; set; } + + /// + /// OpenMSX sub item type + /// + /// Not related to the subtype above + [JsonProperty("openmsx_type", DefaultValueHandling = DefaultValueHandling.Ignore)] + public string OpenMSXType { get; set; } + + /// + /// Item remark (like a comment) + /// + [JsonProperty("remark", DefaultValueHandling = DefaultValueHandling.Ignore)] + public string Remark { get; set; } + + /// + /// Boot state + /// + [JsonProperty("boot", DefaultValueHandling = DefaultValueHandling.Ignore)] + public string Boot { get; set; } + + #endregion + #region SoftwareList /// @@ -284,6 +320,25 @@ namespace SabreTools.Library.DatItems #endregion + #region OpenMSX + + if (mappings.Keys.Contains(Field.DatItem_Original)) + Original = new Original() { Content = mappings[Field.DatItem_Original] }; + + if (mappings.Keys.Contains(Field.DatItem_OpenMSXSubType)) + OpenMSXSubType = mappings[Field.DatItem_OpenMSXSubType].AsOpenMSXSubType(); + + if (mappings.Keys.Contains(Field.DatItem_OpenMSXType)) + OpenMSXType = mappings[Field.DatItem_OpenMSXType]; + + if (mappings.Keys.Contains(Field.DatItem_Remark)) + Remark = mappings[Field.DatItem_Remark]; + + if (mappings.Keys.Contains(Field.DatItem_Boot)) + Boot = mappings[Field.DatItem_Boot]; + + #endregion + #region SoftwareList if (mappings.Keys.Contains(Field.DatItem_AreaName)) @@ -760,6 +815,40 @@ namespace SabreTools.Library.DatItems #endregion + #region OpenMSX + + // Filter on original + if (filter.DatItem_Original.MatchesPositiveSet(Original?.Content) == false) + return false; + if (filter.DatItem_Original.MatchesNegativeSet(Original?.Content) == true) + return false; + + // Filter on OpenMSX subtype + if (filter.DatItem_OpenMSXSubType.MatchesPositiveSet(OpenMSXSubType) == false) + return false; + if (filter.DatItem_OpenMSXSubType.MatchesNegativeSet(OpenMSXSubType) == true) + return false; + + // Filter on OpenMSX type + if (filter.DatItem_OpenMSXType.MatchesPositiveSet(OpenMSXType) == false) + return false; + if (filter.DatItem_OpenMSXType.MatchesNegativeSet(OpenMSXType) == true) + return false; + + // Filter on remark + if (filter.DatItem_Remark.MatchesPositiveSet(Remark) == false) + return false; + if (filter.DatItem_Remark.MatchesNegativeSet(Remark) == true) + return false; + + // Filter on boot + if (filter.DatItem_Boot.MatchesPositiveSet(Boot) == false) + return false; + if (filter.DatItem_Boot.MatchesNegativeSet(Boot) == true) + return false; + + #endregion + #region SoftwareList // Filter on area name @@ -887,6 +976,25 @@ namespace SabreTools.Library.DatItems #endregion + #region OpenMSX + + if (fields.Contains(Field.DatItem_Original)) + Original = null; + + if (fields.Contains(Field.DatItem_OpenMSXSubType)) + OpenMSXSubType = OpenMSXSubType.NULL; + + if (fields.Contains(Field.DatItem_OpenMSXType)) + OpenMSXType = null; + + if (fields.Contains(Field.DatItem_Remark)) + Remark = null; + + if (fields.Contains(Field.DatItem_Boot)) + Boot = null; + + #endregion + #region SoftwareList if (fields.Contains(Field.DatItem_AreaName)) @@ -1101,6 +1209,25 @@ namespace SabreTools.Library.DatItems #endregion + #region OpenMSX + + if (fields.Contains(Field.DatItem_Original)) + Original = newItem.Original; + + if (fields.Contains(Field.DatItem_OpenMSXSubType)) + OpenMSXSubType = newItem.OpenMSXSubType; + + if (fields.Contains(Field.DatItem_OpenMSXType)) + OpenMSXType = newItem.OpenMSXType; + + if (fields.Contains(Field.DatItem_Remark)) + Remark = newItem.Remark; + + if (fields.Contains(Field.DatItem_Boot)) + Boot = newItem.Boot; + + #endregion + #region SoftwareList if (fields.Contains(Field.DatItem_AreaName)) diff --git a/SabreTools.Library/DatItems/Sample.cs b/SabreTools.Library/DatItems/Sample.cs index 7e517efe..88708cec 100644 --- a/SabreTools.Library/DatItems/Sample.cs +++ b/SabreTools.Library/DatItems/Sample.cs @@ -77,12 +77,6 @@ namespace SabreTools.Library.DatItems AltName = this.AltName, AltTitle = this.AltTitle, - Original = this.Original, - OpenMSXSubType = this.OpenMSXSubType, - OpenMSXType = this.OpenMSXType, - Remark = this.Remark, - Boot = this.Boot, - Machine = this.Machine.Clone() as Machine, Source = this.Source.Clone() as Source, Remove = this.Remove, diff --git a/SabreTools.Library/DatItems/Setting.cs b/SabreTools.Library/DatItems/Setting.cs index 86f80bed..9b2f6233 100644 --- a/SabreTools.Library/DatItems/Setting.cs +++ b/SabreTools.Library/DatItems/Setting.cs @@ -109,12 +109,6 @@ namespace SabreTools.Library.DatItems AltName = this.AltName, AltTitle = this.AltTitle, - Original = this.Original, - OpenMSXSubType = this.OpenMSXSubType, - OpenMSXType = this.OpenMSXType, - Remark = this.Remark, - Boot = this.Boot, - Machine = this.Machine.Clone() as Machine, Source = this.Source.Clone() as Source, Remove = this.Remove, diff --git a/SabreTools.Library/DatItems/SharedFeature.cs b/SabreTools.Library/DatItems/SharedFeature.cs index 43a7b012..99b7c124 100644 --- a/SabreTools.Library/DatItems/SharedFeature.cs +++ b/SabreTools.Library/DatItems/SharedFeature.cs @@ -85,12 +85,6 @@ namespace SabreTools.Library.DatItems AltName = this.AltName, AltTitle = this.AltTitle, - Original = this.Original, - OpenMSXSubType = this.OpenMSXSubType, - OpenMSXType = this.OpenMSXType, - Remark = this.Remark, - Boot = this.Boot, - Machine = this.Machine.Clone() as Machine, Source = this.Source.Clone() as Source, Remove = this.Remove, diff --git a/SabreTools.Library/DatItems/Slot.cs b/SabreTools.Library/DatItems/Slot.cs index 69ea501f..26f92e43 100644 --- a/SabreTools.Library/DatItems/Slot.cs +++ b/SabreTools.Library/DatItems/Slot.cs @@ -85,12 +85,6 @@ namespace SabreTools.Library.DatItems AltName = this.AltName, AltTitle = this.AltTitle, - Original = this.Original, - OpenMSXSubType = this.OpenMSXSubType, - OpenMSXType = this.OpenMSXType, - Remark = this.Remark, - Boot = this.Boot, - Machine = this.Machine.Clone() as Machine, Source = this.Source.Clone() as Source, Remove = this.Remove, diff --git a/SabreTools.Library/DatItems/SlotOption.cs b/SabreTools.Library/DatItems/SlotOption.cs index d8ddff96..2f47fc3b 100644 --- a/SabreTools.Library/DatItems/SlotOption.cs +++ b/SabreTools.Library/DatItems/SlotOption.cs @@ -94,12 +94,6 @@ namespace SabreTools.Library.DatItems AltName = this.AltName, AltTitle = this.AltTitle, - Original = this.Original, - OpenMSXSubType = this.OpenMSXSubType, - OpenMSXType = this.OpenMSXType, - Remark = this.Remark, - Boot = this.Boot, - Machine = this.Machine.Clone() as Machine, Source = this.Source.Clone() as Source, Remove = this.Remove, diff --git a/SabreTools.Library/DatItems/SoftwareList.cs b/SabreTools.Library/DatItems/SoftwareList.cs index c2f570c3..70f85d59 100644 --- a/SabreTools.Library/DatItems/SoftwareList.cs +++ b/SabreTools.Library/DatItems/SoftwareList.cs @@ -97,12 +97,6 @@ namespace SabreTools.Library.DatItems AltName = this.AltName, AltTitle = this.AltTitle, - Original = this.Original, - OpenMSXSubType = this.OpenMSXSubType, - OpenMSXType = this.OpenMSXType, - Remark = this.Remark, - Boot = this.Boot, - Machine = this.Machine.Clone() as Machine, Source = this.Source.Clone() as Source, Remove = this.Remove, diff --git a/SabreTools.Library/DatItems/Sound.cs b/SabreTools.Library/DatItems/Sound.cs index c7ff7160..929248b3 100644 --- a/SabreTools.Library/DatItems/Sound.cs +++ b/SabreTools.Library/DatItems/Sound.cs @@ -64,12 +64,6 @@ namespace SabreTools.Library.DatItems AltName = this.AltName, AltTitle = this.AltTitle, - Original = this.Original, - OpenMSXSubType = this.OpenMSXSubType, - OpenMSXType = this.OpenMSXType, - Remark = this.Remark, - Boot = this.Boot, - Machine = this.Machine.Clone() as Machine, Source = this.Source.Clone() as Source, Remove = this.Remove,