예제 #1
0
 public static void ValidateUserName(string userName)
 {
     if (userName == null || userName == "")
     {
         throw new ArgumentException("Invalid user name value, user name may not be '' or null !");
     }
     if (ArgsValidator.ContainsChars(userName, new char[]
     {
         ':',
         '*',
         '?',
         '"',
         '<',
         '>',
         '|',
         '%'
     }))
     {
         throw new ArgumentException("Invalid user name value, user name may not contain {: * ? \" < > | %} chars ! ");
     }
     if (!ArgsValidator.IsPrintableCharsOnly(userName))
     {
         throw new ArgumentException("Invalid user name value, user name may contain printable chars only !");
     }
 }
예제 #2
0
 public static void ValidateFolder(string folder)
 {
     if (folder == null || folder == "")
     {
         throw new ArgumentException("Invalid folder value, user name may not be '' or null !");
     }
     if (ArgsValidator.ContainsChars(folder, new char[]
     {
         ':',
         '*',
         '?',
         '"',
         '<',
         '>',
         '|',
         '%'
     }))
     {
         throw new ArgumentException("Invalid folder value, folder may not contain {: * ? \" < > | %} chars ! ");
     }
     if (!ArgsValidator.IsPrintableCharsOnly(folder))
     {
         throw new ArgumentException("Invalid folder value, folder may contain printable chars only !");
     }
 }
예제 #3
0
 public static void ValidateSharedFolderRoot(string folder)
 {
     if (folder == null || folder == "")
     {
         throw new ArgumentException("Invalid root folder value, user name may not be '' or null !");
     }
     if (ArgsValidator.ContainsChars(folder, new char[]
     {
         ':',
         '*',
         '?',
         '"',
         '<',
         '>',
         '|',
         '%',
         '\\',
         '/'
     }))
     {
         throw new ArgumentException("Invalid root folder value, folder may not contain {: * ? \" < > | % \\ /} chars ! ");
     }
     if (!ArgsValidator.IsPrintableCharsOnly(folder))
     {
         throw new ArgumentException("Invalid root folder value, folder may contain printable chars only !");
     }
     if (folder.ToLower() == "inbox")
     {
         throw new ArgumentException("Invalid root folder value, 'Inbox' is reserved folder name !");
     }
     if (folder.ToLower() == "drafts")
     {
         throw new ArgumentException("Invalid root folder value, 'Drafts' is reserved folder name !");
     }
     if (folder.ToLower() == "trash")
     {
         throw new ArgumentException("Invalid root folder value, 'Trash' is reserved folder name !");
     }
     if (folder.ToLower() == "deleted items")
     {
         throw new ArgumentException("Invalid root folder value, 'Deleted Items' is reserved folder name !");
     }
     if (folder.ToLower() == "sent")
     {
         throw new ArgumentException("Invalid root folder value, 'Sent' is reserved folder name !");
     }
     if (folder.ToLower() == "sent items")
     {
         throw new ArgumentException("Invalid root folder value, 'Sent Items' is reserved folder name !");
     }
     if (folder.ToLower() == "outbox")
     {
         throw new ArgumentException("Invalid root folder value, 'Outbox' is reserved folder name !");
     }
 }
예제 #4
0
 public static void ValidateDomainName(string domainName)
 {
     if (domainName == null)
     {
         throw new ArgumentException("Invalid  domainName value, null values not allowed !");
     }
     if (domainName == "")
     {
         throw new ArgumentException("Invalid  domainName value, please specify domain name !");
     }
     if (!ArgsValidator.IsPrintableCharsOnly(domainName))
     {
         throw new ArgumentException("Invalid  domainName value, domain name may conatin ASCII printable chars only !");
     }
     if (ArgsValidator.ContainsChars(domainName, new char[]
     {
         '@'
     }))
     {
         throw new ArgumentException("Invalid  domainName value, domain name may not conatin '@' char !");
     }
 }