protected override void ValidateRead(List <ValidationError> errors)
        {
            if (this.prefix == SubjectPrefix.Empty)
            {
                errors.Add(new RulePhrase.RulePhraseValidationError(RulesTasksStrings.ArgumentNotSet, base.Name));
                return;
            }
            int index;

            if (!Utils.CheckIsUnicodeStringWellFormed(this.prefix.Value, out index))
            {
                errors.Add(new RulePhrase.RulePhraseValidationError(RulesTasksStrings.CommentsHaveInvalidChars((int)this.prefix.Value[index]), base.Name));
                return;
            }
            base.ValidateRead(errors);
        }
 protected override void ValidateRead(List <ValidationError> errors)
 {
     if (this.ReportDestination == SmtpAddress.Empty)
     {
         errors.Add(new RulePhrase.RulePhraseValidationError(RulesTasksStrings.ArgumentNotSet, base.Name));
         return;
     }
     if (this.IncidentReportOriginalMail == IncidentReportOriginalMail.DoNotIncludeOriginalMail)
     {
         if (this.IncidentReportContent.Any((IncidentReportContent reportContent) => reportContent == Microsoft.Exchange.MessagingPolicies.Rules.IncidentReportContent.AttachOriginalMail))
         {
             errors.Add(new RulePhrase.RulePhraseValidationError(RulesTasksStrings.IncidentReportConflictingParameters("IncidentReportOriginalMail", "IncidentReportContent"), base.Name));
         }
     }
     base.ValidateRead(errors);
 }
示例#3
0
 protected override void ValidateRead(List <ValidationError> errors)
 {
     if (this.Addresses == null || this.Addresses.Length == 0)
     {
         errors.Add(new RulePhrase.RulePhraseValidationError(RulesTasksStrings.ArgumentNotSet, base.Name));
         return;
     }
     foreach (SmtpAddress smtpAddress in this.Addresses)
     {
         if (!smtpAddress.IsValidAddress)
         {
             errors.Add(new RulePhrase.RulePhraseValidationError(RulesTasksStrings.InvalidSmtpAddress(smtpAddress.ToString()), base.Name));
             return;
         }
     }
     base.ValidateRead(errors);
 }
示例#4
0
        internal override RuleBifurcationInfo ToRuleBifurcationInfo(out RuleBifurcationInfo additionalBifurcationInfo)
        {
            additionalBifurcationInfo = null;
            RuleBifurcationInfo ruleBifurcationInfo = new RuleBifurcationInfo();

            foreach (SmtpAddress smtpAddress in this.Addresses)
            {
                string text = smtpAddress.ToString();
                if (string.IsNullOrEmpty(text))
                {
                    throw new ArgumentException(RulesTasksStrings.InvalidRecipient(text), "Address");
                }
                ruleBifurcationInfo.Managers.Add(text);
            }
            ruleBifurcationInfo.IsSenderEvaluation = (this.EvaluatedUser == EvaluatedUser.Sender);
            return(ruleBifurcationInfo);
        }
 internal static void ValidateReadContainsWordsPredicate(Word[] words, string name, List <ValidationError> errors)
 {
     if (words == null || words.Length == 0)
     {
         errors.Add(new RulePhrase.RulePhraseValidationError(RulesTasksStrings.ArgumentNotSet, name));
         return;
     }
     foreach (Word word in words)
     {
         string value = word.Value;
         int    index;
         if (!string.IsNullOrEmpty(value) && !Utils.CheckIsUnicodeStringWellFormed(value, out index))
         {
             errors.Add(new RulePhrase.RulePhraseValidationError(RulesTasksStrings.CommentsHaveInvalidChars((int)value[index]), name));
             break;
         }
     }
 }
示例#6
0
        internal override Action[] ToInternalActions()
        {
            List <Action> list = new List <Action>();

            foreach (SmtpAddress smtpAddress in this.Addresses)
            {
                ShortList <Argument> shortList = new ShortList <Argument>();
                string text = smtpAddress.ToString();
                if (string.IsNullOrEmpty(text))
                {
                    throw new ArgumentException(RulesTasksStrings.InvalidRecipient(text), "Addresses");
                }
                shortList.Add(new Value(text));
                Action item = TransportRuleParser.Instance.CreateAction(this.internalActionName, shortList, Utils.GetActionName(this));
                list.Add(item);
            }
            return(list.ToArray());
        }
        private ClientAccessRuleCollection FetchClientAccessRulesCollection(IConfigurationSession session)
        {
            ClientAccessRulesPriorityManager clientAccessRulesPriorityManager = new ClientAccessRulesPriorityManager(ClientAccessRulesStorageManager.GetClientAccessRules(session));
            ClientAccessRuleCollection       clientAccessRuleCollection       = new ClientAccessRuleCollection((base.Identity == null) ? OrganizationId.ForestWideOrgId.ToString() : base.Identity.ToString());

            foreach (ADClientAccessRule adclientAccessRule in clientAccessRulesPriorityManager.ADClientAccessRules)
            {
                ClientAccessRule clientAccessRule = adclientAccessRule.GetClientAccessRule();
                if (clientAccessRule.Enabled == RuleState.Disabled)
                {
                    base.WriteVerbose(RulesTasksStrings.ClientAccessRuleWillBeConsideredEnabled(clientAccessRule.Name));
                    clientAccessRule.Enabled = RuleState.Enabled;
                }
                base.WriteVerbose(RulesTasksStrings.ClientAccessRuleWillBeAddedToCollection(clientAccessRule.Name));
                clientAccessRuleCollection.Add(clientAccessRule);
            }
            return(clientAccessRuleCollection);
        }
 protected override void ValidateRead(List <ValidationError> errors)
 {
     if (this.Words == null || this.Words.Length == 0)
     {
         errors.Add(new RulePhrase.RulePhraseValidationError(RulesTasksStrings.ArgumentNotSet, base.Name));
         return;
     }
     foreach (Word word in this.Words)
     {
         string value = word.Value;
         int    index;
         if (!string.IsNullOrEmpty(value) && !Utils.CheckIsUnicodeStringWellFormed(value, out index))
         {
             errors.Add(new RulePhrase.RulePhraseValidationError(RulesTasksStrings.CommentsHaveInvalidChars((int)value[index]), base.Name));
             return;
         }
     }
     base.ValidateRead(errors);
 }
        protected override void ValidateRead(List <ValidationError> errors)
        {
            if (this.Words == null || this.Words.Length == 0)
            {
                errors.Add(new RulePhrase.RulePhraseValidationError(RulesTasksStrings.ArgumentNotSet, base.Name));
                return;
            }
            Word[] words = this.Words;
            int    i     = 0;

            while (i < words.Length)
            {
                Word   word  = words[i];
                string value = word.Value;
                int    index;
                if (!string.IsNullOrEmpty(value) && !Utils.CheckIsUnicodeStringWellFormed(value, out index))
                {
                    errors.Add(new RulePhrase.RulePhraseValidationError(RulesTasksStrings.CommentsHaveInvalidChars((int)value[index]), base.Name));
                }
                else
                {
                    int num = value.IndexOf(':');
                    if (num >= 0)
                    {
                        string text = value.Substring(0, num).Trim().ToLowerInvariant();
                        if (TransportUtils.GetDisclaimerMacroLookupTable().ContainsKey(text))
                        {
                            i++;
                            continue;
                        }
                        errors.Add(new RulePhrase.RulePhraseValidationError(RulesTasksStrings.InvalidMacroName(text), base.Name));
                    }
                    else
                    {
                        errors.Add(new RulePhrase.RulePhraseValidationError(RulesTasksStrings.MacroNameNotSpecified(value), base.Name));
                    }
                }
                return;
            }
            base.ValidateRead(errors);
        }
示例#10
0
 internal static void ValidateReadMatchesPatternsPredicate(Pattern[] patterns, bool useLegacyRegex, string name, List <ValidationError> errors)
 {
     if (patterns == null || patterns.Length == 0)
     {
         errors.Add(new RulePhrase.RulePhraseValidationError(RulesTasksStrings.ArgumentNotSet, name));
         return;
     }
     foreach (Pattern pattern in patterns)
     {
         string value = pattern.Value;
         if (!string.IsNullOrEmpty(value))
         {
             int index;
             if (!Utils.CheckIsUnicodeStringWellFormed(value, out index))
             {
                 errors.Add(new RulePhrase.RulePhraseValidationError(RulesTasksStrings.CommentsHaveInvalidChars((int)value[index]), name));
             }
             else
             {
                 try
                 {
                     Pattern.ValidatePattern(value, useLegacyRegex, false);
                 }
                 catch (ValidationArgumentException ex)
                 {
                     LocalizedString description = ValidationError.CombineErrorDescriptions(new List <ValidationError>
                     {
                         new RulePhrase.RulePhraseValidationError(RulesTasksStrings.InvalidRegex(value), name),
                         new RulePhrase.RulePhraseValidationError(ex.LocalizedString, name)
                     });
                     errors.Add(new RulePhrase.RulePhraseValidationError(description, name));
                 }
                 catch (ArgumentException)
                 {
                     errors.Add(new RulePhrase.RulePhraseValidationError(RulesTasksStrings.InvalidRegex(value), name));
                 }
             }
         }
     }
 }
示例#11
0
 internal static ArgumentException ValidateDataClassificationParameter(TargetDataClassification targetClassification, Hashtable userInput)
 {
     if (string.IsNullOrEmpty(targetClassification.Id))
     {
         return(new ArgumentException(RulesTasksStrings.InvalidMessageDataClassificationEmptyName));
     }
     if (targetClassification.MinConfidence != TargetDataClassification.UseRecommendedMinConfidence && targetClassification.MinConfidence < 1)
     {
         return(new ArgumentException(RulesTasksStrings.InvalidMessageDataClassificationParameterLessThanOne("MinConfidence")));
     }
     if (targetClassification.MaxConfidence < 1)
     {
         return(new ArgumentException(RulesTasksStrings.InvalidMessageDataClassificationParameterLessThanOne("MaxConfidence")));
     }
     if (targetClassification.MinConfidence != TargetDataClassification.UseRecommendedMinConfidence && targetClassification.MinConfidence > targetClassification.MaxConfidence)
     {
         return(new ArgumentException(RulesTasksStrings.InvalidMessageDataClassificationParameterMinGreaterThanMax("MinConfidence", "MaxConfidence")));
     }
     if (targetClassification.MinConfidence > TargetDataClassification.MaxAllowedConfidenceValue)
     {
         return(new ArgumentException(RulesTasksStrings.InvalidMessageDataClassificationParameterConfidenceExceedsMaxAllowed("MinConfidence", TargetDataClassification.MaxAllowedConfidenceValue)));
     }
     if (targetClassification.MaxConfidence > TargetDataClassification.MaxAllowedConfidenceValue)
     {
         return(new ArgumentException(RulesTasksStrings.InvalidMessageDataClassificationParameterConfidenceExceedsMaxAllowed("MaxConfidence", TargetDataClassification.MaxAllowedConfidenceValue)));
     }
     if (targetClassification.MinCount < 1)
     {
         return(new ArgumentException(RulesTasksStrings.InvalidMessageDataClassificationParameterLessThanOne("MinCount")));
     }
     if ((targetClassification.MaxCount != TargetDataClassification.IgnoreMaxCount && targetClassification.MaxCount < 1) || (targetClassification.MaxCount == TargetDataClassification.IgnoreMaxCount && userInput.ContainsKey("MaxCount".ToUpper())))
     {
         return(new ArgumentException(RulesTasksStrings.InvalidMessageDataClassificationParameterLessThanOne("MaxCount")));
     }
     if (targetClassification.MaxCount != TargetDataClassification.IgnoreMaxCount && targetClassification.MinCount > targetClassification.MaxCount)
     {
         return(new ArgumentException(RulesTasksStrings.InvalidMessageDataClassificationParameterMinGreaterThanMax("MinCount", "MaxCount")));
     }
     return(null);
 }
示例#12
0
 // Token: 0x06000619 RID: 1561 RVA: 0x000133D9 File Offset: 0x000115D9
 public ClientAccessRuleActionNotSupportedException(string action, Exception innerException) : base(RulesTasksStrings.ClientAccessRuleActionNotSupported(action), innerException)
 {
     this.action = action;
 }
 public LocDisplayNameAttribute(RulesTasksStrings.IDs ids) : base(RulesTasksStrings.GetLocalizedString(ids))
 {
 }
示例#14
0
 public LocDescriptionAttribute(RulesTasksStrings.IDs ids) : base(RulesTasksStrings.GetLocalizedString(ids))
 {
 }