mirror of
https://github.com/SabreTools/SabreTools.Serialization.git
synced 2026-09-24 07:45:06 +00:00
Flatten Condition out of existence
This commit is contained in:
@@ -9,7 +9,17 @@ namespace SabreTools.Data.Models.Metadata
|
||||
{
|
||||
#region Properties
|
||||
|
||||
public Condition? Condition { get; set; }
|
||||
/// <remarks>Condition subitem</remarks>
|
||||
public string? ConditionMask { get; set; }
|
||||
|
||||
/// <remarks>Condition subitem, (eq|ne|gt|le|lt|ge)</remarks>
|
||||
public Relation? ConditionRelation { get; set; }
|
||||
|
||||
/// <remarks>Condition subitem</remarks>
|
||||
public string? ConditionTag { get; set; }
|
||||
|
||||
/// <remarks>Condition subitem</remarks>
|
||||
public string? ConditionValue { get; set; }
|
||||
|
||||
/// <remarks>(yes|no) "no"</remarks>
|
||||
public bool? Default { get; set; }
|
||||
@@ -27,7 +37,10 @@ namespace SabreTools.Data.Models.Metadata
|
||||
{
|
||||
var obj = new ConfSetting();
|
||||
|
||||
obj.Condition = Condition?.Clone() as Condition;
|
||||
obj.ConditionMask = ConditionMask;
|
||||
obj.ConditionRelation = ConditionRelation;
|
||||
obj.ConditionTag = ConditionTag;
|
||||
obj.ConditionValue = ConditionValue;
|
||||
obj.Default = Default;
|
||||
obj.Name = Name;
|
||||
obj.Value = Value;
|
||||
@@ -43,6 +56,24 @@ namespace SabreTools.Data.Models.Metadata
|
||||
return false;
|
||||
|
||||
// Properties
|
||||
if ((ConditionMask is null) ^ (other.ConditionMask is null))
|
||||
return false;
|
||||
else if (ConditionMask is not null && !ConditionMask.Equals(other.ConditionMask, StringComparison.OrdinalIgnoreCase))
|
||||
return false;
|
||||
|
||||
if (ConditionRelation != other.ConditionRelation)
|
||||
return false;
|
||||
|
||||
if ((ConditionTag is null) ^ (other.ConditionTag is null))
|
||||
return false;
|
||||
else if (ConditionTag is not null && !ConditionTag.Equals(other.ConditionTag, StringComparison.OrdinalIgnoreCase))
|
||||
return false;
|
||||
|
||||
if ((ConditionValue is null) ^ (other.ConditionValue is null))
|
||||
return false;
|
||||
else if (ConditionValue is not null && !ConditionValue.Equals(other.ConditionValue, StringComparison.OrdinalIgnoreCase))
|
||||
return false;
|
||||
|
||||
if (Default != other.Default)
|
||||
return false;
|
||||
|
||||
@@ -56,12 +87,6 @@ namespace SabreTools.Data.Models.Metadata
|
||||
else if (Value is not null && !Value.Equals(other.Value, StringComparison.OrdinalIgnoreCase))
|
||||
return false;
|
||||
|
||||
// Sub-items
|
||||
if ((Condition is null) ^ (other.Condition is null))
|
||||
return false;
|
||||
else if (Condition is not null && other.Condition is not null && Condition.Equals(other.Condition))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user