Exemple #1
0
 internal EntryId(EntryId.DisplayType displayType, string dn)
 {
     if (dn == null)
     {
         throw new ArgumentNullException("dn");
     }
     this.displayType  = displayType;
     this.dn           = dn;
     this.providerGuid = EntryId.ExchangeProviderGuid;
 }
Exemple #2
0
        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);
            }
        }
Exemple #3
0
 internal EntryId(EntryId.DisplayType displayType, Guid providerGuid, int ephemeralId)
 {
     this.displayType  = displayType;
     this.providerGuid = providerGuid;
     this.ephemeralId  = ephemeralId;
 }