public byte[] RenderStream(string format, string deviceInfo, string streamID, out string mimeType)
 {
     if (m_executionSession.Snapshot != null)
     {
         Stream chunk = m_executionSession.Snapshot.GetChunk(streamID, ReportProcessing.ReportChunkTypes.StaticImage, out mimeType);
         if (chunk == null)
         {
             chunk = m_executionSession.Snapshot.GetChunk(streamID, ReportProcessing.ReportChunkTypes.Image, out mimeType);
         }
         if (chunk != null)
         {
             byte[] array = new byte[chunk.Length];
             chunk.Read(array, 0, (int)chunk.Length);
             return(array);
         }
     }
     using (StreamCache streamCache = new StreamCache())
     {
         m_itemContext.RSRequestParameters.SetRenderingParameters(deviceInfo);
         ReportProcessing    reportProcessing = CreateAndConfigureReportProcessing();
         IRenderingExtension newRenderer      = CreateRenderer(format, allowInternal: true);
         Microsoft.ReportingServices.ReportProcessing.RenderingContext rc = CreateRenderingContext();
         ProcessingContext        pc     = CreateProcessingContext(streamCache.StreamCallback);
         OnDemandProcessingResult result = reportProcessing.RenderSnapshotStream(newRenderer, streamID, rc, pc);
         m_executionSession.SaveProcessingResult(result);
         string encoding;
         string fileExtension;
         return(streamCache.GetMainStream(out encoding, out mimeType, out fileExtension));
     }
 }
示例#2
0
 public void MoveSecondaryStreamsTo(StreamCache other)
 {
     foreach (KeyValuePair <string, CachedStream> secondaryStream in m_secondaryStreams)
     {
         other.m_secondaryStreams.Add(secondaryStream.Key, secondaryStream.Value);
     }
     m_secondaryStreams.Clear();
 }