protected static RecipientItemType GetRecipientType(RuleEvaluationContextBase context)
        {
            RecipientItemType result = RecipientItemType.Unknown;
            string            text   = context.PropertyBag[StoreObjectSchema.ItemClass] as string;

            if (!string.IsNullOrEmpty(text) && ObjectClass.IsReport(text))
            {
                result = RecipientItemType.To;
            }
            else
            {
                RecipientCollection recipients = context.Message.Recipients;
                for (int i = 0; i < recipients.Count; i++)
                {
                    if (recipients[i].Participant.RoutingType != null && recipients[i].Participant.EmailAddress != null)
                    {
                        ProxyAddress addressToResolve = ProxyAddress.Parse(recipients[i].Participant.RoutingType, recipients[i].Participant.EmailAddress);
                        if (RuleUtil.IsSameUser(context, context.RecipientCache, addressToResolve, context.Recipient))
                        {
                            result = recipients[i].RecipientItemType;
                            break;
                        }
                    }
                }
            }
            return(result);
        }
 private RecipientItemType GetRecipientType()
 {
     if (this.recipientType == null)
     {
         this.recipientType = new RecipientItemType?(RuleEvaluationContextBase.GetRecipientType(this));
     }
     return(this.recipientType.Value);
 }
 private string GetMessageBody()
 {
     if (this.body == null)
     {
         this.body = RuleEvaluationContextBase.GetMessageBody(this);
     }
     return(this.body);
 }
        protected static string GetMessageBody(RuleEvaluationContextBase context)
        {
            string text;

            using (TextReader textReader = context.Message.Body.OpenTextReader(BodyFormat.TextPlain))
            {
                text = textReader.ReadToEnd();
                if (text == null)
                {
                    text = string.Empty;
                }
            }
            return(text);
        }
 protected RuleEvaluationContextBase(RuleEvaluationContextBase parentContext)
 {
     this.message          = parentContext.message;
     this.ruleHistory      = parentContext.ruleHistory;
     this.session          = parentContext.session;
     this.cultureInfo      = parentContext.cultureInfo;
     this.folderSet        = parentContext.folderSet;
     this.folder           = parentContext.folder;
     this.recipientAddress = parentContext.recipientAddress;
     this.recipientCache   = parentContext.recipientCache;
     this.mimeSize         = parentContext.mimeSize;
     this.traceFormatter   = parentContext.traceFormatter;
     this.currentRule      = parentContext.currentRule;
     this.limitChecker     = parentContext.limitChecker;
     this.ruleConfig       = parentContext.ruleConfig;
     this.tracer           = parentContext.tracer;
     this.ShouldExecuteDisabledAndInErrorRules = parentContext.ShouldExecuteDisabledAndInErrorRules;
 }