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();
        }
Пример #2
0
        protected override void InternalProcessRecord()
        {
            ADRuleStorageManager adruleStorageManager = this.RuleStorageManager;

            if (adruleStorageManager == null)
            {
                return;
            }
            using (Stream stream = new MemoryStream())
            {
                using (StreamWriter streamWriter = new StreamWriter(stream))
                {
                    adruleStorageManager.LoadRuleCollectionWithoutParsing();
                    IEnumerable <Rule> source = adruleStorageManager.WriteToStream(streamWriter, ExportRuleCollectionTaskBase.MaxLegacyFormatVersion, null);
                    stream.Seek(0L, SeekOrigin.Begin);
                    BinaryReader         binaryReader = new BinaryReader(stream);
                    BinaryFileDataObject dataObject   = new BinaryFileDataObject
                    {
                        FileData = binaryReader.ReadBytes((int)binaryReader.BaseStream.Length)
                    };
                    this.WriteResult(dataObject);
                    if (source.Any <Rule>())
                    {
                        this.WriteWarning(Strings.ExportSkippedE15Rules(source.Count <Rule>()));
                    }
                }
            }
            try
            {
                adruleStorageManager.ParseRuleCollection();
            }
            catch (ParserException ex)
            {
                this.WriteWarning(Strings.CorruptRuleCollection(ex.Message));
            }
        }