protected override void ProcessRecord() { Collection <FormatData> data; if (InputObject.BaseObject is FormatData) { data = new Collection <FormatData>(); data.Add((FormatData)InputObject.BaseObject); } else { if (_formatManager == null) { _formatManager = new FormatManager(FormatShape.Undefined, ExecutionContext); } data = _formatManager.Process(InputObject); } // although we might have multiple FormatData objects, they are all derived from a single data object // so all should be formatted in the same shape var processor = FormatProcessor.Get(OutputWriter, data[0].Shape); foreach (var curData in data) { processor.ProcessPayload(curData); } }
protected override void EndProcessing() { if (_formatManager == null) { return; } var data = _formatManager.End(); if (data.Count < 1) { return; } var processor = FormatProcessor.Get(OutputWriter, data[0].Shape); foreach (var formatPayload in data) { processor.ProcessPayload(formatPayload); } }