protected override void RunAction() { using (QueueViewerClient <ExtensibleMessageInfo> queueViewerClient = new QueueViewerClient <ExtensibleMessageInfo>((string)base.Server)) { try { int num = 0; for (;;) { byte[] array = queueViewerClient.ReadMessageBody(base.Identity, num, 65536); if (array == null) { break; } num += array.Length; BinaryFileDataObject binaryFileDataObject = new BinaryFileDataObject(); binaryFileDataObject.SetIdentity(base.Identity); binaryFileDataObject.FileData = array; base.WriteObject(binaryFileDataObject); } } catch (RpcException ex) { if (ex.ErrorCode == 1753 || ex.ErrorCode == 1727) { base.WriteError(ErrorMapper.GetLocalizedException(ex.ErrorCode, null, base.Server), (ErrorCategory)1002, null); } throw; } } }
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); } } } }
public static void OnPostExportSelfSignedCertificate(DataRow inputRow, DataTable dataTable, DataObjectStore store) { DataRow dataRow = dataTable.Rows[0]; object dataObject = store.GetDataObject("BinaryFileDataObject"); if (dataObject != null && dataObject is IEnumerable) { foreach (object obj in ((IEnumerable)dataObject)) { BinaryFileDataObject binaryFileDataObject = (BinaryFileDataObject)obj; if (binaryFileDataObject != null) { dataRow["FileData"] = binaryFileDataObject.FileData; break; } } } }
private void ProcessRequestResults(ExchangeCertificate certificate, string request) { if (this.BinaryEncoded) { BinaryFileDataObject binaryFileDataObject = new BinaryFileDataObject(); binaryFileDataObject.FileData = Convert.FromBase64String(request); base.WriteObject(binaryFileDataObject); if (this.GenerateRequest && !string.IsNullOrEmpty(this.RequestFile)) { this.WriteRequest(binaryFileDataObject.FileData, string.Empty); return; } } else { string text = ManageExchangeCertificate.WrapCertificateRequestWithPemTags(request); base.WriteObject(text); if (this.GenerateRequest && !string.IsNullOrEmpty(this.RequestFile)) { this.WriteRequest(null, text); } } }
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)); } }