/// <summary> /// Return a XML representation of this object. /// </summary> public XElement ToXML() => new XElement(SOAPNS.v1_2.NS.SOAPEnvelope + "Header", new XElement(OCPPNS.OCPPv1_6_CS + "chargeBoxIdentity", ChargeBoxIdentity.ToString()), new XElement(SOAPNS.v1_2.NS.SOAPAdressing + "Action", new XAttribute(SOAPNS.v1_2.NS.SOAPEnvelope + "mustUnderstand", true), Action), new XElement(SOAPNS.v1_2.NS.SOAPAdressing + "MessageID", new XAttribute(SOAPNS.v1_2.NS.SOAPEnvelope + "mustUnderstand", true), MessageId), RelatesTo.IsNotNullOrEmpty() ? new XElement(SOAPNS.v1_2.NS.SOAPAdressing + "RelatesTo", new XAttribute(SOAPNS.v1_2.NS.SOAPEnvelope + "mustUnderstand", true), RelatesTo) : null, new XElement(SOAPNS.v1_2.NS.SOAPAdressing + "From", new XAttribute(SOAPNS.v1_2.NS.SOAPEnvelope + "mustUnderstand", true), From), new XElement(SOAPNS.v1_2.NS.SOAPAdressing + "ReplyTo", new XAttribute(SOAPNS.v1_2.NS.SOAPEnvelope + "mustUnderstand", true), new XElement(SOAPNS.v1_2.NS.SOAPEnvelope + "Address", "http://www.w3.org/2005/08/addressing/anonymous") ), new XElement(SOAPNS.v1_2.NS.SOAPAdressing + "To", new XAttribute(SOAPNS.v1_2.NS.SOAPEnvelope + "mustUnderstand", true), To) );
/// <summary> /// Return the HashCode of this object. /// </summary> /// <returns>The HashCode of this object.</returns> public override Int32 GetHashCode() { unchecked { return(ChargeBoxIdentity.GetHashCode() * 19 ^ Action.GetHashCode() * 17 ^ MessageId.GetHashCode() * 11 ^ (RelatesTo != null ? RelatesTo.GetHashCode() * 7 : 0) ^ From.GetHashCode() * 5 ^ To.GetHashCode()); } }
/// <summary> /// Compares two id tag infos for equality. /// </summary> /// <param name="SOAPHeader">An id tag info to compare with.</param> /// <returns>True if both match; False otherwise.</returns> public Boolean Equals(SOAPHeader SOAPHeader) { if ((Object)SOAPHeader == null) { return(false); } return(ChargeBoxIdentity.Equals(SOAPHeader.ChargeBoxIdentity) && Action.Equals(SOAPHeader.Action) && MessageId.Equals(SOAPHeader.MessageId) && ((RelatesTo == null && SOAPHeader.RelatesTo == null) || (RelatesTo != null && SOAPHeader.RelatesTo != null && RelatesTo.Equals(SOAPHeader.RelatesTo))) && From.Equals(SOAPHeader.From) && To.Equals(SOAPHeader.To)); }