private void WriteHeader(EntryId.EntryIdFlags flags, byte[] buffer) { int num = 0; num += ExBitConverter.Write((int)flags, buffer, num); num += ExBitConverter.Write(this.providerGuid, buffer, num); num += ExBitConverter.Write(1, buffer, num); num += ExBitConverter.Write((int)this.displayType, buffer, num); }
internal static bool TryParse(byte[] buffer, out EntryId entryId) { entryId = null; if (buffer.Length < 28) { return(false); } EntryId.EntryIdFlags entryIdFlags = (EntryId.EntryIdFlags)BitConverter.ToInt32(buffer, 0); Guid a = ExBitConverter.ReadGuid(buffer, 4); int num = BitConverter.ToInt32(buffer, 20); EntryId.DisplayType displayType = (EntryId.DisplayType)BitConverter.ToInt32(buffer, 24); if (num != 1) { return(false); } if (entryIdFlags == EntryId.EntryIdFlags.Permanent) { if (buffer.Length < 29 || buffer[buffer.Length - 1] != 0 || a != EntryId.ExchangeProviderGuid) { return(false); } string @string = Encoding.ASCII.GetString(buffer, 28, buffer.Length - 28 - 1); entryId = new EntryId(displayType, @string); return(true); } else { if (entryIdFlags != EntryId.EntryIdFlags.Ephemeral) { return(false); } if (buffer.Length != 32) { return(false); } entryId = new EntryId(displayType, a, BitConverter.ToInt32(buffer, 28)); entryId.bytes = buffer; return(true); } }