private static SupervisionPolicy GetPresentationObject(ADRuleStorageManager storageManager, ref Dictionary <string, string> rules, bool displayDetails)
        {
            SupervisionPolicy supervisionPolicy = new SupervisionPolicy("SupervisionPolicy" + storageManager.RuleCollectionId.GetHashCode().ToString());

            foreach (Microsoft.Exchange.MessagingPolicies.Rules.Rule rule in storageManager.GetRuleCollection())
            {
                TransportRule transportRule = (TransportRule)rule;
                if (!transportRule.IsTooAdvancedToParse)
                {
                    Microsoft.Exchange.MessagingPolicies.Rules.Tasks.Rule rule2 = Microsoft.Exchange.MessagingPolicies.Rules.Tasks.Rule.CreateFromInternalRule(TransportRulePredicate.BridgeheadMappings, TransportRuleAction.BridgeheadMappings, transportRule, 0, null);
                    if (transportRule.Name.Equals(GetSupervisionPolicy.ClosedCampusInboundRuleName))
                    {
                        supervisionPolicy.ClosedCampusInboundPolicyEnabled = (transportRule.Enabled == RuleState.Enabled);
                        if (displayDetails)
                        {
                            supervisionPolicy.ClosedCampusInboundPolicyGroupExceptions  = GetSupervisionPolicy.ConvertToSmtpAddressMVP(rule2.ExceptIfSentToMemberOf);
                            supervisionPolicy.ClosedCampusInboundPolicyDomainExceptions = GetSupervisionPolicy.ConvertToSmtpDomains(rule2.ExceptIfFromAddressMatchesPatterns);
                        }
                        rules.Remove(GetSupervisionPolicy.ClosedCampusInboundRuleName);
                    }
                    else if (transportRule.Name.Equals(GetSupervisionPolicy.ClosedCampusOutboundRuleName))
                    {
                        supervisionPolicy.ClosedCampusOutboundPolicyEnabled = (transportRule.Enabled == RuleState.Enabled);
                        if (displayDetails)
                        {
                            supervisionPolicy.ClosedCampusOutboundPolicyGroupExceptions  = GetSupervisionPolicy.ConvertToSmtpAddressMVP(rule2.ExceptIfFromMemberOf);
                            supervisionPolicy.ClosedCampusOutboundPolicyDomainExceptions = GetSupervisionPolicy.ConvertToSmtpDomains(rule2.ExceptIfRecipientAddressMatchesPatterns);
                        }
                        rules.Remove(GetSupervisionPolicy.ClosedCampusOutboundRuleName);
                    }
                    else if (transportRule.Name.Equals(GetSupervisionPolicy.BadWordsRuleName))
                    {
                        supervisionPolicy.BadWordsPolicyEnabled = (transportRule.Enabled == RuleState.Enabled);
                        if (displayDetails)
                        {
                            supervisionPolicy.BadWordsList = GetSupervisionPolicy.ConvertToCommaSeparatedString(rule2.SubjectOrBodyContainsWords);
                        }
                        rules.Remove(GetSupervisionPolicy.BadWordsRuleName);
                    }
                    else if (transportRule.Name.Equals(GetSupervisionPolicy.AntiBullyingRuleName))
                    {
                        supervisionPolicy.AntiBullyingPolicyEnabled = (transportRule.Enabled == RuleState.Enabled);
                        rules.Remove(GetSupervisionPolicy.AntiBullyingRuleName);
                    }
                }
            }
            return(supervisionPolicy);
        }
        protected override void InternalProcessRecord()
        {
            TaskLogger.LogEnter();
            Dictionary <string, string> ruleNames            = GetSupervisionPolicy.GetRuleNames();
            ADRuleStorageManager        adruleStorageManager = null;

            try
            {
                adruleStorageManager = new ADRuleStorageManager("TransportVersioned", base.DataSession);
            }
            catch (RuleCollectionNotInAdException exception)
            {
                base.WriteError(exception, (ErrorCategory)1003, null);
            }
            QueryFilter queryFilter = GetSupervisionPolicy.GetQueryFilter(ruleNames.Keys);

            adruleStorageManager.LoadRuleCollectionWithoutParsing(queryFilter);
            try
            {
                adruleStorageManager.ParseRuleCollection();
            }
            catch (ParserException exception2)
            {
                base.WriteError(exception2, (ErrorCategory)1003, null);
            }
            SupervisionPolicy presentationObject = GetSupervisionPolicy.GetPresentationObject(adruleStorageManager, ref ruleNames, this.DisplayDetails.ToBool());

            this.WriteResult(presentationObject);
            string missingPolicies = GetSupervisionPolicy.GetMissingPolicies(ruleNames);

            if (!string.IsNullOrEmpty(missingPolicies))
            {
                this.WriteWarning(Strings.SupervisionPoliciesNotFound(missingPolicies));
            }
            TaskLogger.LogExit();
        }