using System.Xml.Serialization;
using Newtonsoft.Json;
using SabreTools.Core;
namespace SabreTools.DatItems.Formats
{
///
/// SoftwareList diskarea information
///
/// One DiskArea can contain multiple Disk items
[JsonObject("diskarea"), XmlRoot("diskarea")]
public class DiskArea : DatItem
{
#region Fields
///
/// Name of the item
///
[JsonProperty("name", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("name")]
public string Name { get; set; }
#endregion
#region Accessors
///
public override string GetName() => Name;
///
public override void SetName(string name) => Name = name;
#endregion
#region Constructors
///
/// Create a default, empty DiskArea object
///
public DiskArea()
{
Name = string.Empty;
ItemType = ItemType.DiskArea;
}
#endregion
#region Cloning Methods
///
public override object Clone()
{
return new DiskArea()
{
ItemType = this.ItemType,
DupeType = this.DupeType,
Machine = this.Machine.Clone() as Machine,
Source = this.Source.Clone() as Source,
Remove = this.Remove,
Name = this.Name,
};
}
#endregion
#region Comparision Methods
///
public override bool Equals(DatItem other)
{
// If we don't have a DiskArea, return false
if (ItemType != other.ItemType)
return false;
// Otherwise, treat it as a DiskArea
DiskArea newOther = other as DiskArea;
// If the DiskArea information matches
return (Name == newOther.Name);
}
#endregion
}
}