Пример #1
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));
            }
        }