public byte[] RenderStream(string format, string deviceInfo, string streamID, out string mimeType)
        {
            if (this.m_executionSession.Snapshot != null)
            {
                Stream chunk = ((SnapshotBase)this.m_executionSession.Snapshot).GetChunk(streamID, ReportProcessing.ReportChunkTypes.StaticImage, out mimeType);
                if (chunk == null)
                {
                    chunk = ((SnapshotBase)this.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())
            {
                this.m_itemContext.RSRequestParameters.SetRenderingParameters(deviceInfo);
                ReportProcessing    reportProcessing = this.CreateAndConfigureReportProcessing();
                IRenderingExtension newRenderer      = this.CreateRenderer(format, true);
                AspNetCore.ReportingServices.ReportProcessing.RenderingContext rc = this.CreateRenderingContext();
                ProcessingContext        pc     = this.CreateProcessingContext(streamCache.StreamCallback);
                OnDemandProcessingResult result = reportProcessing.RenderSnapshotStream(newRenderer, streamID, rc, pc);
                this.m_executionSession.SaveProcessingResult(result);

                string text2 = default(string);
                return(streamCache.GetMainStream(out Encoding text, out mimeType, out text2));
            }
        }
        public int PerformSort(string paginationMode, string sortId, SortOptions sortDirection, bool clearSort, out string uniqueName)
        {
            this.SetProcessingCulture();
            ControlSnapshot snapshot = this.m_executionSession.Snapshot;

            try
            {
                this.m_executionSession.Snapshot = new ControlSnapshot();
                snapshot.PrepareExecutionSnapshot(this.m_executionSession.Snapshot, null);
                using (ProcessingStreamHandler @object = new ProcessingStreamHandler())
                {
                    this.m_itemContext.RSRequestParameters.PaginationModeValue = paginationMode;
                    ReportProcessing  reportProcessing = this.CreateAndConfigureReportProcessing();
                    ProcessingContext pc = this.CreateProcessingContext(@object.StreamCallback);
                    AspNetCore.ReportingServices.ReportProcessing.RenderingContext rc = this.CreateRenderingContext();
                    int result = default(int);
                    OnDemandProcessingResult onDemandProcessingResult = reportProcessing.ProcessUserSortEvent(sortId, sortDirection, clearSort, pc, rc, (IChunkFactory)snapshot, out uniqueName, out result);
                    if (onDemandProcessingResult != null && onDemandProcessingResult.SnapshotChanged)
                    {
                        this.m_executionSession.SaveProcessingResult(onDemandProcessingResult);
                    }
                    else
                    {
                        this.m_executionSession.Snapshot = snapshot;
                    }
                    return(result);
                }
            }
            catch
            {
                this.m_executionSession.Snapshot = snapshot;
                throw;
            }
        }
        public ProcessingMessageList Render(string format, string deviceInfo, string paginationMode, bool allowInternalRenderers, IEnumerable dataSources, CreateAndRegisterStream createStreamCallback)
        {
            this.SetProcessingCulture();
            this.m_itemContext.RSRequestParameters.FormatParamValue = format;
            this.m_itemContext.RSRequestParameters.SetRenderingParameters(deviceInfo);
            this.m_itemContext.RSRequestParameters.PaginationModeValue = paginationMode;
            ReportProcessing    reportProcessing   = this.CreateAndConfigureReportProcessing();
            IRenderingExtension renderingExtension = this.CreateRenderer(format, allowInternalRenderers);
            //renderingExtension.Report = report;

            bool flag = false;

            if (format == null || this.m_executionSession.Snapshot == null)
            {
                this.ReinitializeSnapshot(null);
                flag = true;
            }
            SubreportCallbackHandler subreportHandler = this.CreateSubreportCallbackHandler();
            ProcessingContext        pc = this.CreateProcessingContext(this.m_executionSession.ExecutionInfo.ReportParameters, dataSources, this.m_executionSession.Credentials, this.m_executionSession.Snapshot, createStreamCallback, subreportHandler);

            AspNetCore.ReportingServices.ReportProcessing.RenderingContext rc = this.CreateRenderingContext();
            OnDemandProcessingResult onDemandProcessingResult = null;

            if (flag)
            {
                try
                {
                    if (renderingExtension == null)
                    {
                        onDemandProcessingResult = reportProcessing.CreateSnapshot(DateTime.Now, pc, null);
                    }
                    else
                    {
                        this.m_itemContext.RSRequestParameters.SetReportParameters(this.m_executionSession.ExecutionInfo.ReportParameters.AsNameValueCollectionInUserCulture);
                        onDemandProcessingResult = this.CreateSnapshotAndRender(reportProcessing, renderingExtension, pc, rc, subreportHandler, this.m_executionSession.ExecutionInfo.ReportParameters, this.m_executionSession.Credentials);
                    }
                }
                catch (Exception ex)
                {
                    this.m_executionSession.Snapshot = null;
                    throw;
                }
            }
            else if (renderingExtension != null)
            {
                onDemandProcessingResult = reportProcessing.RenderSnapshot(renderingExtension, rc, pc);
            }
            this.m_executionSession.SaveProcessingResult(onDemandProcessingResult);
            return(onDemandProcessingResult.Warnings);
        }
 protected virtual OnDemandProcessingResult CreateSnapshotAndRender(ReportProcessing repProc, IRenderingExtension renderer, ProcessingContext pc, AspNetCore.ReportingServices.ReportProcessing.RenderingContext rc, SubreportCallbackHandler subreportHandler, ParameterInfoCollection parameters, DatasourceCredentialsCollection credentials)
 {
     return(repProc.RenderReport(renderer, DateTime.Now, pc, rc, null));
 }