Пример #1
0
        public static AlternateMailbox Parse(string blob)
        {
            AlternateMailbox result;

            if (!AlternateMailbox.TryParse(blob, out result))
            {
                throw new ArgumentException(DataStrings.InvalidAlternateMailboxString(blob, ';'), "blob");
            }
            return(result);
        }
Пример #2
0
        private static bool TryParse(string blob, ref Guid identity, ref Guid databaseGuid, ref AlternateMailbox.AlternateMailboxFlags flags, ref string name, ref List <SmtpAddress> smtpAddresses, ref string userName, ref string unknownProperties)
        {
            if (string.IsNullOrEmpty(blob))
            {
                return(false);
            }
            string[] array = blob.Split(new char[]
            {
                ';'
            });
            if (array == null || array.Length < 7)
            {
                return(false);
            }
            int i = 0;

            identity = new Guid(array[i++]);
            if (array[i++] != "1.0")
            {
                return(false);
            }
            databaseGuid  = new Guid(array[i++]);
            flags         = (AlternateMailbox.AlternateMailboxFlags) int.Parse(array[i++]);
            name          = array[i++];
            smtpAddresses = AlternateMailbox.ParseEmailAddressesString(array[i++]);
            userName      = array[i++];
            while (i < array.Length)
            {
                unknownProperties = string.Join(';'.ToString(), new string[]
                {
                    unknownProperties,
                    array[i]
                });
                i++;
            }
            return(true);
        }
Пример #3
0
 public AlternateMailbox(Guid identity, Guid databaseGuid, AlternateMailbox.AlternateMailboxFlags flags, string name, IList <SmtpAddress> smtpAddresses, string userName)
 {
     if (!AlternateMailbox.IsValidName(name))
     {
         throw new ArgumentException(name, "name");
     }
     if (!AlternateMailbox.IsValidUserName(userName))
     {
         throw new ArgumentException(userName, "userName");
     }
     this.identity     = identity;
     this.databaseGuid = databaseGuid;
     this.flags        = flags;
     this.name         = name;
     if (smtpAddresses != null)
     {
         this.smtpAddresses = new List <SmtpAddress>(smtpAddresses);
     }
     else
     {
         this.smtpAddresses = new List <SmtpAddress>(0);
     }
     this.userName = (userName ?? string.Empty);
 }
Пример #4
0
        public override string ToString()
        {
            string separator = ';'.ToString();

            string[] array = new string[7];
            array[0] = this.identity.ToString();
            array[1] = "1.0";
            array[2] = this.databaseGuid.ToString();
            string[] array2 = array;
            int      num    = 3;
            int      num2   = (int)this.flags;

            array2[num] = num2.ToString();
            array[4]    = ((this.name == null) ? string.Empty : this.name.ToString());
            array[5]    = AlternateMailbox.GetEmailAddressesString(this.smtpAddresses);
            array[6]    = ((this.userName == null) ? string.Empty : this.userName.ToString());
            string text = string.Join(separator, array);

            if (this.unknownProperties != null)
            {
                text += this.unknownProperties;
            }
            return(text);
        }
Пример #5
0
 public static bool TryParse(string blob, out AlternateMailbox alternateMailbox)
 {
     alternateMailbox = new AlternateMailbox();
     return(AlternateMailbox.TryParse(blob, ref alternateMailbox.identity, ref alternateMailbox.databaseGuid, ref alternateMailbox.flags, ref alternateMailbox.name, ref alternateMailbox.smtpAddresses, ref alternateMailbox.userName, ref alternateMailbox.unknownProperties));
 }
Пример #6
0
        public override bool Equals(object comparand)
        {
            AlternateMailbox alternateMailbox = comparand as AlternateMailbox;

            return(alternateMailbox != null && this.Equals(alternateMailbox));
        }
Пример #7
0
 public bool Equals(AlternateMailbox value)
 {
     return(object.ReferenceEquals(this, value) || (value != null && this.identity == value.identity && this.databaseGuid == value.databaseGuid && this.flags == value.flags && this.name == value.name && this.userName == value.userName));
 }