コード例 #1
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);
 }
コード例 #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);
        }