示例#1
0
        private void WriteRawRules()
        {
            ADRuleStorageManager ruleStorageManager = base.RuleStorageManager;

            using (Stream stream = new MemoryStream())
            {
                using (StreamWriter streamWriter = new StreamWriter(stream))
                {
                    ruleStorageManager.LoadRuleCollectionWithoutParsing();
                    ruleStorageManager.WriteRawRulesToStream(streamWriter);
                    if (base.NeedSuppressingPiiData)
                    {
                        stream.Seek(0L, SeekOrigin.Begin);
                        StreamReader streamReader = new StreamReader(stream);
                        string       value        = SuppressingPiiData.Redact(streamReader.ReadToEnd());
                        stream.SetLength(0L);
                        streamWriter.Write(value);
                        streamWriter.Flush();
                    }
                    stream.Seek(0L, SeekOrigin.Begin);
                    using (BinaryReader binaryReader = new BinaryReader(stream))
                    {
                        BinaryFileDataObject dataObject = new BinaryFileDataObject
                        {
                            FileData = binaryReader.ReadBytes((int)binaryReader.BaseStream.Length)
                        };
                        this.WriteResult(dataObject);
                    }
                }
            }
        }