mirror of
https://github.com/SabreTools/SabreTools.Serialization.git
synced 2026-09-22 14:55:11 +00:00
Flatten Analog out of existence
This commit is contained in:
@@ -1,44 +0,0 @@
|
||||
using System;
|
||||
using System.Xml.Serialization;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace SabreTools.Data.Models.Metadata
|
||||
{
|
||||
[JsonObject("analog"), XmlRoot("analog")]
|
||||
public class Analog : DatItem, ICloneable, IEquatable<Analog>
|
||||
{
|
||||
#region Properties
|
||||
|
||||
public string? Mask { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
public Analog() => ItemType = ItemType.Analog;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public object Clone()
|
||||
{
|
||||
var obj = new Analog();
|
||||
|
||||
obj.Mask = Mask;
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool Equals(Analog? other)
|
||||
{
|
||||
// Null never matches
|
||||
if (other is null)
|
||||
return false;
|
||||
|
||||
// Properties
|
||||
if ((Mask is null) ^ (other.Mask is null))
|
||||
return false;
|
||||
else if (Mask is not null && !Mask.Equals(other.Mask, StringComparison.OrdinalIgnoreCase))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -272,7 +272,6 @@ namespace SabreTools.Data.Models.Metadata
|
||||
NULL = 0,
|
||||
|
||||
Adjuster,
|
||||
Analog,
|
||||
Archive,
|
||||
BiosSet,
|
||||
Chip,
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace SabreTools.Data.Models.Metadata
|
||||
{
|
||||
#region Properties
|
||||
|
||||
public Analog[]? Analog { get; set; }
|
||||
public string[]? AnalogMask { get; set; }
|
||||
|
||||
public string? Tag { get; set; }
|
||||
|
||||
@@ -22,8 +22,8 @@ namespace SabreTools.Data.Models.Metadata
|
||||
{
|
||||
var obj = new Port();
|
||||
|
||||
if (Analog is not null)
|
||||
obj.Analog = Array.ConvertAll(Analog, i => (Analog)i.Clone());
|
||||
if (AnalogMask is not null)
|
||||
obj.AnalogMask = Array.ConvertAll(AnalogMask, i => i);
|
||||
obj.Tag = Tag;
|
||||
|
||||
return obj;
|
||||
|
||||
Reference in New Issue
Block a user