protected override bool InternalRender(Microsoft.ReportingServices.OnDemandReportRendering.Report report, NameValueCollection reportServerParameters, NameValueCollection deviceInfo, NameValueCollection clientCapabilities, ref Hashtable renderProperties, CreateAndRegisterStream createAndRegisterStream)
        {
            HtmlTextWriter      htmlTextWriter      = null;
            Html5ServerRenderer html5ServerRenderer = null;

            try
            {
                htmlTextWriter = HtmlWriterFactory.CreateWriter(report.Name, "text/html", createAndRegisterStream, StreamOper.CreateAndRegister);
                DeviceInfo deviceInfo2 = null;
                try
                {
                    deviceInfo2 = new ServerDeviceInfo();
                    deviceInfo2.ParseDeviceInfo(deviceInfo, clientCapabilities);
                }
                catch (ArgumentOutOfRangeException innerException)
                {
                    throw new ReportRenderingException(RenderRes.rrInvalidDeviceInfo, innerException);
                }
                bool onlyVisibleStyles = deviceInfo2.OnlyVisibleStyles;
                int  totalPages        = 0;
                if (renderProperties != null)
                {
                    object obj = renderProperties["ClientPaginationMode"];
                    if (obj != null)
                    {
                        PaginationMode paginationMode = (PaginationMode)obj;
                        if (paginationMode == PaginationMode.TotalPages)
                        {
                            object obj2 = renderProperties["PreviousTotalPages"];
                            if (obj2 != null && obj2 is int)
                            {
                                totalPages = (int)obj2;
                            }
                        }
                    }
                }
                if (deviceInfo2.BookmarkId != null)
                {
                    string uniqueName = null;
                    SPBInteractivityProcessing sPBInteractivityProcessing = new SPBInteractivityProcessing();
                    int section = sPBInteractivityProcessing.ProcessBookmarkNavigationEvent(report, totalPages, deviceInfo2.BookmarkId, out uniqueName);
                    if (uniqueName != null)
                    {
                        deviceInfo2.Section      = section;
                        deviceInfo2.NavigationId = uniqueName;
                    }
                }
                try
                {
                    html5ServerRenderer = CreateRenderer(report, reportServerParameters, deviceInfo2, deviceInfo, clientCapabilities, createAndRegisterStream, ref renderProperties, totalPages);
                }
                catch (InvalidSectionException innerException2)
                {
                    throw new ReportRenderingException(innerException2);
                }
                html5ServerRenderer.Render(htmlTextWriter);
                html5ServerRenderer.UpdateRenderProperties(ref renderProperties);
                return(false);
            }
            finally
            {
                html5ServerRenderer?.Dispose();
                htmlTextWriter?.Flush();
            }
        }