using System; /// /// 打孔带运行时与存档数据。流程、资源和显示信息统一由 DefinitionId 在 PunchTapeCatalog 中解析。 /// namespace AibisDream.FixSystem { [Serializable] public class PunchTape : IEquatable { public string DefinitionId; public bool used; public PunchTape() { } public PunchTape(string definitionId) { DefinitionId = definitionId; } /// 用于收藏列表去重与 UI 行映射(与 Equals 一致)。 public string GetRowKey() { return DefinitionId ?? string.Empty; } public bool Equals(PunchTape other) { if (other is null) return false; if (ReferenceEquals(this, other)) return true; return string.Equals(DefinitionId, other.DefinitionId, StringComparison.Ordinal); } public override bool Equals(object obj) => Equals(obj as PunchTape); public override int GetHashCode() { return DefinitionId != null ? StringComparer.Ordinal.GetHashCode(DefinitionId) : 0; } public static bool operator ==(PunchTape left, PunchTape right) { if (left is null) return right is null; return left.Equals(right); } public static bool operator !=(PunchTape left, PunchTape right) => !(left == right); } }