mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Promote Slot to DatItem
This commit is contained in:
@@ -25,7 +25,7 @@ namespace SabreTools.Library.DatItems
|
||||
/// Conditions associated with the adjustment
|
||||
/// </summary>
|
||||
[JsonProperty("conditions")]
|
||||
public List<ListXmlCondition> Conditions { get; set; }
|
||||
public List<Condition> Conditions { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace SabreTools.Library.DatItems
|
||||
/// Represents one ListXML analog
|
||||
/// </summary>
|
||||
[JsonObject("analog")]
|
||||
public class ListXmlAnalog
|
||||
public class Analog
|
||||
{
|
||||
[JsonProperty("mask")]
|
||||
public string Mask { get; set; }
|
||||
@@ -26,7 +26,7 @@ namespace SabreTools.Library.DatItems
|
||||
/// </summary>
|
||||
/// TODO: Promote to DatItem level? (Both used at ListXML level AND under a lot of stuff)
|
||||
[JsonObject("condition")]
|
||||
public class ListXmlCondition
|
||||
public class Condition
|
||||
{
|
||||
[JsonProperty("tag")]
|
||||
public string Tag { get; set; }
|
||||
@@ -41,46 +41,11 @@ namespace SabreTools.Library.DatItems
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents one ListXML conflocation
|
||||
/// </summary>
|
||||
[JsonObject("conflocation")]
|
||||
public class ListXmlConfLocation
|
||||
{
|
||||
[JsonProperty("name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
[JsonProperty("number")]
|
||||
public string Number { get; set; }
|
||||
|
||||
[JsonProperty("inverted")]
|
||||
public bool? Inverted { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents one ListXML confsetting
|
||||
/// </summary>
|
||||
[JsonObject("confsetting")]
|
||||
public class ListXmlConfSetting
|
||||
{
|
||||
[JsonProperty("name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
[JsonProperty("value")]
|
||||
public string Value { get; set; }
|
||||
|
||||
[JsonProperty("default")]
|
||||
public bool? Default { get; set; }
|
||||
|
||||
[JsonProperty("conditions")]
|
||||
public List<ListXmlCondition> Conditions { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents one ListXML control
|
||||
/// </summary>
|
||||
[JsonObject("control")]
|
||||
public class ListXmlControl
|
||||
public class Control
|
||||
{
|
||||
[JsonProperty("type")]
|
||||
public string Type { get; set; }
|
||||
@@ -124,7 +89,7 @@ namespace SabreTools.Library.DatItems
|
||||
/// </summary>
|
||||
/// TODO: Promote to DatItem level (doesn't have "name" field?) (contains list)
|
||||
[JsonObject("device")]
|
||||
public class ListXmlDevice
|
||||
public class Device
|
||||
{
|
||||
[JsonProperty("type")]
|
||||
public string Type { get; set; }
|
||||
@@ -142,10 +107,10 @@ namespace SabreTools.Library.DatItems
|
||||
public string Interface { get; set; }
|
||||
|
||||
[JsonProperty("instances")]
|
||||
public List<ListXmlInstance> Instances { get; set; }
|
||||
public List<Instance> Instances { get; set; }
|
||||
|
||||
[JsonProperty("extensions")]
|
||||
public List<ListXmlExtension> Extensions { get; set; }
|
||||
public List<Extension> Extensions { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -153,7 +118,7 @@ namespace SabreTools.Library.DatItems
|
||||
/// </summary>
|
||||
/// TODO: Promote to DatItem level (doesn't have "name" field?)
|
||||
[JsonObject("display")]
|
||||
public class ListXmlDisplay
|
||||
public class Display
|
||||
{
|
||||
[JsonProperty("tag")]
|
||||
public string Tag { get; set; }
|
||||
@@ -198,48 +163,12 @@ namespace SabreTools.Library.DatItems
|
||||
public string VBStart { get; set; } // TODO: Int32? Float?
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents one ListXML diplocation
|
||||
/// </summary>
|
||||
[JsonObject("diplocation")]
|
||||
public class ListXmlDipLocation
|
||||
{
|
||||
[JsonProperty("name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
[JsonProperty("number")]
|
||||
public string Number { get; set; }
|
||||
|
||||
[JsonProperty("inverted")]
|
||||
public bool? Inverted { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents one ListXML dipvalue
|
||||
/// </summary>
|
||||
/// <remarks>Also used by SoftwareList</remarks>
|
||||
[JsonObject("dipvalue")]
|
||||
public class ListXmlDipValue
|
||||
{
|
||||
[JsonProperty("name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
[JsonProperty("value")]
|
||||
public string Value { get; set; }
|
||||
|
||||
[JsonProperty("default")]
|
||||
public bool? Default { get; set; }
|
||||
|
||||
[JsonProperty("conditions")]
|
||||
public List<ListXmlCondition> Conditions { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents one ListXML driver
|
||||
/// </summary>
|
||||
/// TODO: Promote to DatItem level (doesn't have "name" field?)
|
||||
[JsonObject("driver")]
|
||||
public class ListXmlDriver
|
||||
public class Driver
|
||||
{
|
||||
[JsonProperty("status")]
|
||||
public string Status { get; set; } // TODO: (good|imperfect|preliminary)
|
||||
@@ -258,7 +187,7 @@ namespace SabreTools.Library.DatItems
|
||||
/// Represents one ListXML extension
|
||||
/// </summary>
|
||||
[JsonObject("extension")]
|
||||
public class ListXmlExtension
|
||||
public class Extension
|
||||
{
|
||||
[JsonProperty("name")]
|
||||
public string Name { get; set; }
|
||||
@@ -269,7 +198,7 @@ namespace SabreTools.Library.DatItems
|
||||
/// </summary>
|
||||
/// TODO: Promote to DatItem level (doesn't have "name" field?)
|
||||
[JsonObject("feature")]
|
||||
public class ListXmlFeature
|
||||
public class Feature
|
||||
{
|
||||
[JsonProperty("type")]
|
||||
public string Type { get; set; } // TODO: (protection|palette|graphics|sound|controls|keyboard|mouse|microphone|camera|disk|printer|lan|wan|timing)
|
||||
@@ -286,7 +215,7 @@ namespace SabreTools.Library.DatItems
|
||||
/// </summary>
|
||||
/// TODO: Promote to DatItem level (doesn't have "name" field?) (contains list)
|
||||
[JsonObject("input")]
|
||||
public class ListXmlInput
|
||||
public class Input
|
||||
{
|
||||
[JsonProperty("service")]
|
||||
public bool? Service { get; set; }
|
||||
@@ -301,14 +230,14 @@ namespace SabreTools.Library.DatItems
|
||||
public string Coins { get; set; } // TODO: Int32?
|
||||
|
||||
[JsonProperty("controls")]
|
||||
public List<ListXmlControl> Controls { get; set; }
|
||||
public List<Control> Controls { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents one ListXML instance
|
||||
/// </summary>
|
||||
[JsonObject("instance")]
|
||||
public class ListXmlInstance
|
||||
public class Instance
|
||||
{
|
||||
[JsonProperty("name")]
|
||||
public string Name { get; set; }
|
||||
@@ -317,39 +246,60 @@ namespace SabreTools.Library.DatItems
|
||||
public string BriefName { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents one ListXML conflocation or diplocation
|
||||
/// </summary>
|
||||
[JsonObject("location")]
|
||||
public class Location
|
||||
{
|
||||
[JsonProperty("name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
[JsonProperty("number")]
|
||||
public string Number { get; set; }
|
||||
|
||||
[JsonProperty("inverted")]
|
||||
public bool? Inverted { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents one ListXML port
|
||||
/// </summary>
|
||||
/// TODO: Promote to DatItem level (doesn't have "name" field?) (contains list)
|
||||
[JsonObject("port")]
|
||||
public class ListXmlPort
|
||||
public class Port
|
||||
{
|
||||
[JsonProperty("tag")]
|
||||
public string Tag { get; set; }
|
||||
|
||||
[JsonProperty("analogs")]
|
||||
public List<ListXmlAnalog> Analogs { get; set; }
|
||||
public List<Analog> Analogs { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents one ListXML slot
|
||||
/// Represents one ListXML confsetting or dipvalue
|
||||
/// </summary>
|
||||
/// TODO: Promote to DatItem level (contains list)
|
||||
[JsonObject("slot")]
|
||||
public class ListXmlSlot
|
||||
[JsonObject("setting")]
|
||||
public class Setting
|
||||
{
|
||||
[JsonProperty("name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
[JsonProperty("slotoptions")]
|
||||
public List<ListXmlSlotOption> SlotOptions { get; set; }
|
||||
[JsonProperty("value")]
|
||||
public string Value { get; set; }
|
||||
|
||||
[JsonProperty("default")]
|
||||
public bool? Default { get; set; }
|
||||
|
||||
[JsonProperty("conditions")]
|
||||
public List<Condition> Conditions { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents one ListXML slotoption
|
||||
/// </summary>
|
||||
[JsonObject("slotoption")]
|
||||
public class ListXmlSlotOption
|
||||
public class SlotOption
|
||||
{
|
||||
[JsonProperty("name")]
|
||||
public string Name { get; set; }
|
||||
@@ -366,7 +316,7 @@ namespace SabreTools.Library.DatItems
|
||||
/// </summary>
|
||||
/// TODO: Promote to DatItem level (doesn't have "name" field?)
|
||||
[JsonObject("sound")]
|
||||
public class ListXmlSound
|
||||
public class Sound
|
||||
{
|
||||
[JsonProperty("channels")]
|
||||
public string Channels { get; set; } // TODO: Int32?
|
||||
|
||||
@@ -30,19 +30,19 @@ namespace SabreTools.Library.DatItems
|
||||
/// Conditions associated with the configuration
|
||||
/// </summary>
|
||||
[JsonProperty("conditions")]
|
||||
public List<ListXmlCondition> Conditions { get; set; }
|
||||
public List<Condition> Conditions { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Locations associated with the configuration
|
||||
/// </summary>
|
||||
[JsonProperty("locations")]
|
||||
public List<ListXmlConfLocation> Locations { get; set; }
|
||||
public List<Location> Locations { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Settings associated with the configuration
|
||||
/// </summary>
|
||||
[JsonProperty("settings")]
|
||||
public List<ListXmlConfSetting> Settings { get; set; }
|
||||
public List<Setting> Settings { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -289,6 +289,12 @@ namespace SabreTools.Library.DatItems
|
||||
// Ram Option
|
||||
Field.DatItem_Content,
|
||||
|
||||
// Slot.SlotOptions
|
||||
Field.DatItem_SlotOptions,
|
||||
Field.DatItem_SlotOption_Name,
|
||||
Field.DatItem_SlotOption_DeviceName,
|
||||
Field.DatItem_SlotOption_Default,
|
||||
|
||||
// Release
|
||||
Field.DatItem_Language,
|
||||
|
||||
@@ -327,7 +333,6 @@ namespace SabreTools.Library.DatItems
|
||||
// ListXML
|
||||
Field.Machine_SourceFile,
|
||||
Field.Machine_Runnable,
|
||||
Field.Machine_Slots,
|
||||
Field.Machine_Infos,
|
||||
|
||||
// Logiqx
|
||||
@@ -497,6 +502,9 @@ namespace SabreTools.Library.DatItems
|
||||
case ItemType.Sample:
|
||||
return new Sample();
|
||||
|
||||
case ItemType.Slot:
|
||||
return new Slot();
|
||||
|
||||
case ItemType.SoftwareList:
|
||||
return new SoftwareList();
|
||||
|
||||
|
||||
@@ -30,19 +30,19 @@ namespace SabreTools.Library.DatItems
|
||||
/// Conditions associated with the dipswitch
|
||||
/// </summary>
|
||||
[JsonProperty("conditions")]
|
||||
public List<ListXmlCondition> Conditions { get; set; }
|
||||
public List<Condition> Conditions { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Locations associated with the dipswitch
|
||||
/// </summary>
|
||||
[JsonProperty("locations")]
|
||||
public List<ListXmlDipLocation> Locations { get; set; }
|
||||
public List<Location> Locations { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Settings associated with the dipswitch
|
||||
/// </summary>
|
||||
[JsonProperty("values")]
|
||||
public List<ListXmlDipValue> Values { get; set; }
|
||||
public List<Setting> Values { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -217,16 +217,6 @@ namespace SabreTools.Library.DatItems
|
||||
Machine_Device_Extensions,
|
||||
Machine_Device_Extension_Name,
|
||||
|
||||
// Slots
|
||||
Machine_Slots,
|
||||
Machine_Slot_Name,
|
||||
|
||||
// Slots.SlotOptions
|
||||
Machine_Slot_SlotOptions,
|
||||
Machine_Slot_SlotOption_Name,
|
||||
Machine_Slot_SlotOption_DeviceName,
|
||||
Machine_Slot_SlotOption_Default,
|
||||
|
||||
#endregion
|
||||
|
||||
#region Logiqx
|
||||
@@ -398,6 +388,12 @@ namespace SabreTools.Library.DatItems
|
||||
// Release
|
||||
DatItem_Language,
|
||||
|
||||
// Slot.SlotOptions
|
||||
DatItem_SlotOptions,
|
||||
DatItem_SlotOption_Name,
|
||||
DatItem_SlotOption_DeviceName,
|
||||
DatItem_SlotOption_Default,
|
||||
|
||||
// Software List
|
||||
DatItem_SoftwareListStatus,
|
||||
DatItem_Filter,
|
||||
@@ -448,6 +444,7 @@ namespace SabreTools.Library.DatItems
|
||||
RamOption,
|
||||
Release,
|
||||
Sample,
|
||||
Slot,
|
||||
SoftwareList,
|
||||
|
||||
Blank = 99, // This is not a real type, only used internally
|
||||
|
||||
@@ -156,55 +156,49 @@ namespace SabreTools.Library.DatItems
|
||||
/// List of associated displays
|
||||
/// </summary>
|
||||
[JsonProperty("displays", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public List<ListXmlDisplay> Displays { get; set; } = null;
|
||||
public List<Display> Displays { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// List of associated sounds
|
||||
/// </summary>
|
||||
[JsonProperty("sounds", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public List<ListXmlSound> Sounds { get; set; } = null;
|
||||
public List<Sound> Sounds { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// List of associated conditions
|
||||
/// </summary>
|
||||
[JsonProperty("conditions", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public List<ListXmlCondition> Conditions { get; set; } = null;
|
||||
public List<Condition> Conditions { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// List of associated inputs
|
||||
/// </summary>
|
||||
[JsonProperty("inputs", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public List<ListXmlInput> Inputs { get; set; } = null;
|
||||
public List<Input> Inputs { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// List of associated ports
|
||||
/// </summary>
|
||||
[JsonProperty("ports", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public List<ListXmlPort> Ports { get; set; } = null;
|
||||
public List<Port> Ports { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// List of associated drivers
|
||||
/// </summary>
|
||||
[JsonProperty("drivers", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public List<ListXmlDriver> Drivers { get; set; } = null;
|
||||
public List<Driver> Drivers { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// List of associated features
|
||||
/// </summary>
|
||||
[JsonProperty("features", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public List<ListXmlFeature> Features { get; set; } = null;
|
||||
public List<Feature> Features { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// List of associated devices
|
||||
/// </summary>
|
||||
[JsonProperty("devices", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public List<ListXmlDevice> Devices { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// List of slot options
|
||||
/// </summary>
|
||||
[JsonProperty("slots", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public List<ListXmlSlot> Slots { get; set; } = null;
|
||||
public List<Device> Devices { get; set; } = null;
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -566,7 +560,6 @@ namespace SabreTools.Library.DatItems
|
||||
Drivers = this.Drivers,
|
||||
Features = this.Features,
|
||||
Devices = this.Devices,
|
||||
Slots = this.Slots,
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -1456,9 +1449,6 @@ namespace SabreTools.Library.DatItems
|
||||
if (fields.Contains(Field.Machine_Runnable))
|
||||
Runnable = Runnable.NULL;
|
||||
|
||||
if (fields.Contains(Field.Machine_Slots))
|
||||
Slots = null;
|
||||
|
||||
if (fields.Contains(Field.Machine_Infos))
|
||||
Infos = null;
|
||||
|
||||
@@ -1615,9 +1605,6 @@ namespace SabreTools.Library.DatItems
|
||||
if (fields.Contains(Field.Machine_Runnable))
|
||||
Runnable = machine.Runnable;
|
||||
|
||||
if (fields.Contains(Field.Machine_Slots))
|
||||
Slots = machine.Slots;
|
||||
|
||||
if (fields.Contains(Field.Machine_Infos))
|
||||
Infos = machine.Infos;
|
||||
|
||||
|
||||
174
SabreTools.Library/DatItems/Slot.cs
Normal file
174
SabreTools.Library/DatItems/Slot.cs
Normal file
@@ -0,0 +1,174 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
using SabreTools.Library.Filtering;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace SabreTools.Library.DatItems
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents which Slot(s) is associated with a set
|
||||
/// </summary>
|
||||
[JsonObject("slot")]
|
||||
public class Slot : DatItem
|
||||
{
|
||||
#region Fields
|
||||
|
||||
/// <summary>
|
||||
/// Slot options associated with the slot
|
||||
/// </summary>
|
||||
[JsonProperty("slotoptions")]
|
||||
public List<SlotOption> SlotOptions { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Accessors
|
||||
|
||||
/// <summary>
|
||||
/// Set fields with given values
|
||||
/// </summary>
|
||||
/// <param name="mappings">Mappings dictionary</param>
|
||||
public override void SetFields(Dictionary<Field, string> mappings)
|
||||
{
|
||||
// Set base fields
|
||||
base.SetFields(mappings);
|
||||
|
||||
// Handle Slot-specific fields
|
||||
|
||||
// TODO: Handle DatItem_SlotOption*
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Create a default, empty Slot object
|
||||
/// </summary>
|
||||
public Slot()
|
||||
{
|
||||
Name = string.Empty;
|
||||
ItemType = ItemType.Slot;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Cloning Methods
|
||||
|
||||
public override object Clone()
|
||||
{
|
||||
return new Slot()
|
||||
{
|
||||
Name = this.Name,
|
||||
ItemType = this.ItemType,
|
||||
DupeType = this.DupeType,
|
||||
|
||||
AltName = this.AltName,
|
||||
AltTitle = this.AltTitle,
|
||||
|
||||
Original = this.Original,
|
||||
OpenMSXSubType = this.OpenMSXSubType,
|
||||
OpenMSXType = this.OpenMSXType,
|
||||
Remark = this.Remark,
|
||||
Boot = this.Boot,
|
||||
|
||||
Part = this.Part,
|
||||
Features = this.Features,
|
||||
AreaName = this.AreaName,
|
||||
AreaSize = this.AreaSize,
|
||||
AreaWidth = this.AreaWidth,
|
||||
AreaEndianness = this.AreaEndianness,
|
||||
Value = this.Value,
|
||||
LoadFlag = this.LoadFlag,
|
||||
|
||||
Machine = this.Machine.Clone() as Machine,
|
||||
Source = this.Source.Clone() as Source,
|
||||
Remove = this.Remove,
|
||||
|
||||
SlotOptions = this.SlotOptions,
|
||||
};
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Comparision Methods
|
||||
|
||||
public override bool Equals(DatItem other)
|
||||
{
|
||||
// If we don't have a Slot, return false
|
||||
if (ItemType != other.ItemType)
|
||||
return false;
|
||||
|
||||
// Otherwise, treat it as a Slot
|
||||
Slot newOther = other as Slot;
|
||||
|
||||
// If the Slot information matches
|
||||
return (Name == newOther.Name); // TODO: Handle DatItem_SlotOption*
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Filtering
|
||||
|
||||
/// <summary>
|
||||
/// Check to see if a DatItem passes the filter
|
||||
/// </summary>
|
||||
/// <param name="filter">Filter to check against</param>
|
||||
/// <returns>True if the item passed the filter, false otherwise</returns>
|
||||
public override bool PassesFilter(Filter filter)
|
||||
{
|
||||
// Check common fields first
|
||||
if (!base.PassesFilter(filter))
|
||||
return false;
|
||||
|
||||
// TODO: Handle DatItem_SlotOption*
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove fields from the DatItem
|
||||
/// </summary>
|
||||
/// <param name="fields">List of Fields to remove</param>
|
||||
public override void RemoveFields(List<Field> fields)
|
||||
{
|
||||
// Remove common fields first
|
||||
base.RemoveFields(fields);
|
||||
|
||||
// Remove the fields
|
||||
if (fields.Contains(Field.DatItem_SlotOptions))
|
||||
SlotOptions = null;
|
||||
|
||||
// TODO: Handle DatItem_SlotOption*
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Sorting and Merging
|
||||
|
||||
/// <summary>
|
||||
/// Replace fields from another item
|
||||
/// </summary>
|
||||
/// <param name="item">DatItem to pull new information from</param>
|
||||
/// <param name="fields">List of Fields representing what should be updated</param>
|
||||
public override void ReplaceFields(DatItem item, List<Field> fields)
|
||||
{
|
||||
// Replace common fields first
|
||||
base.ReplaceFields(item, fields);
|
||||
|
||||
// If we don't have a Slot to replace from, ignore specific fields
|
||||
if (item.ItemType != ItemType.Slot)
|
||||
return;
|
||||
|
||||
// Cast for easier access
|
||||
Slot newItem = item as Slot;
|
||||
|
||||
// Replace the fields
|
||||
if (fields.Contains(Field.DatItem_SlotOptions))
|
||||
SlotOptions = newItem.SlotOptions;
|
||||
|
||||
// TODO: Handle DatItem_SlotOption*
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user