borepin/NFC/ISO7816-4/APDUCommand.cs
2020-10-05 18:39:45 +02:00

48 lines
1.2 KiB
C#

using PCSC;
using PCSC.Iso7816;
using System;
using System.Collections.Generic;
namespace NFC.ISO7816_4
{
public class APDUCommand : CommandApdu
{
public APDUCommand(IsoCase isoCase) : base(isoCase, SCardProtocol.Any)
{
}
public override bool Equals(object obj)
{
return obj is APDUCommand command &&
Case == command.Case &&
Protocol == command.Protocol &&
CLA == command.CLA &&
INS == command.INS &&
P1 == command.P1 &&
P2 == command.P2 &&
EqualityComparer<byte[]>.Default.Equals(Data, command.Data);
}
public override int GetHashCode()
{
HashCode hash = new HashCode();
hash.Add(Case);
hash.Add(Protocol);
hash.Add(IsValid);
hash.Add(CLA);
hash.Add(INS);
hash.Add(P1);
hash.Add(P2);
hash.Add(P1P2);
hash.Add(Data);
hash.Add(Lc);
hash.Add(P3);
hash.Add(Le);
hash.Add(ExpectedResponseLength);
hash.Add(IsValid);
return hash.ToHashCode();
}
}
}