示例#1
0
        public override bool Equals(object obj)
        {
            if (this == obj)
            {
                return(true);
            }
            if (obj == null)
            {
                return(false);
            }
            if (this.GetType() != obj.GetType())
            {
                return(false);
            }
            BindingTable other = (BindingTable)obj;

            if (ClusterId != other.ClusterId)
            {
                return(false);
            }
            if (DstAddrMode != other.DstAddrMode)
            {
                return(false);
            }
            if (DstGroupAddr != other.DstGroupAddr)
            {
                return(false);
            }
            if (DstAddr == null)
            {
                if (other.DstAddr != null)
                {
                    return(false);
                }
            }
            else if (!DstAddr.Equals(other.DstAddr))
            {
                return(false);
            }
            if (DstNodeEndpoint != other.DstNodeEndpoint)
            {
                return(false);
            }
            if (SrcAddr == null)
            {
                if (other.SrcAddr != null)
                {
                    return(false);
                }
            }
            else if (!SrcAddr.Equals(other.SrcAddr))
            {
                return(false);
            }
            if (SrcEndpoint != other.SrcEndpoint)
            {
                return(false);
            }
            return(true);
        }
 public override byte[] ToBytes() => ByteHelpers.Combine(
     new byte[]
 {
     Ver.ToByte(), Cmd.ToByte(), Rsv.ToByte(), Atyp.ToByte()
 },
     DstAddr.ToBytes(),
     DstPort.ToBytes());
示例#3
0
        public override int GetHashCode()
        {
            int prime  = 31;
            int result = 1;

            result = prime * result + ClusterId;
            result = prime * result + DstAddrMode;
            result = prime * result + DstGroupAddr;
            result = prime * result + ((DstAddr == null) ? 0 : DstAddr.GetHashCode());
            result = prime * result + DstNodeEndpoint;
            result = prime * result + ((SrcAddr == null) ? 0 : SrcAddr.GetHashCode());
            result = prime * result + SrcEndpoint;
            return(result);
        }