/// <summary> /// Compare whether the two EphemeralEntryID structures are equal or not. /// </summary> /// <param name="id1">The EphemeralEntryID structure to be compared.</param> /// <returns>If the two EphemeralEntryID structures are equal, return true, else false.</returns> public bool Compare(EphemeralEntryID id1) { if (this.DisplayType == id1.DisplayType && this.Mid == id1.Mid) { if (this.ProviderUID.Compare(id1.ProviderUID)) { return(true); } } return(false); }
/// <summary> /// Parse EphemeralEntryID structure from byte array. /// </summary> /// <param name="bytes">The byte array to be parsed.</param> /// <returns>An EphemeralEntryID structure instance.</returns> public static EphemeralEntryID ParseEphemeralEntryIDFromBytes(byte[] bytes) { int index = 0; EphemeralEntryID entryID = new EphemeralEntryID { IDType = bytes[index++], R1 = bytes[index++], R2 = bytes[index++], R3 = bytes[index++], ProviderUID = new FlatUID_r { Ab = new byte[Constants.FlatUIDByteSize] } }; for (int i = 0; i < Constants.FlatUIDByteSize; i++) { entryID.ProviderUID.Ab[i] = bytes[index++]; } // R4: 4 bytes entryID.R4 = (uint)BitConverter.ToInt32(bytes, index); index += 4; // DisplayType: 4 bytes entryID.DisplayType = (DisplayTypeValue)BitConverter.ToInt32(bytes, index); index += 4; // Mid: 4 bytes entryID.Mid = (uint)BitConverter.ToInt32(bytes, index); index += 4; return entryID; }
/// <summary> /// Compare whether the two EphemeralEntryID structures are equal or not. /// </summary> /// <param name="id1">The EphemeralEntryID structure to be compared.</param> /// <returns>If the two EphemeralEntryID structures are equal, return true, else false.</returns> public bool Compare(EphemeralEntryID id1) { if (this.DisplayType == id1.DisplayType && this.Mid == id1.Mid) { if (this.ProviderUID.Compare(id1.ProviderUID)) { return true; } } return false; }