private NameValueCollection CreateDeviceInfo(DeviceInfoCollection initialDeviceInfos, Report report, int pageNumber, string searchState, string replacementRoot, string linkTarget, string browserMode, bool useImageConsolidation, bool enablePowerBIFeatures)
        {
            NameValueCollection nameValueCollection = new NameValueCollection();

            foreach (DeviceInfo initialDeviceInfo in initialDeviceInfos)
            {
                nameValueCollection.Add(initialDeviceInfo.Name, initialDeviceInfo.Value);
            }
            nameValueCollection.Set("HTMLFragment", "true");
            nameValueCollection.Set("Section", pageNumber.ToString(CultureInfo.InvariantCulture));
            string value = ReportImageOperation.CreateUrl(report, this.m_viewerInstanceIdentifier, false);

            nameValueCollection.Set("StreamRoot", value);
            string value2 = ReportImageOperation.CreateUrl(report, this.m_viewerInstanceIdentifier, true);

            nameValueCollection.Set("ResourceStreamRoot", value2);
            nameValueCollection.Set("EnablePowerBIFeatures", enablePowerBIFeatures.ToString());
            //nameValueCollection.Set("ActionScript", this.ActionScriptMethod);
            if (!string.IsNullOrWhiteSpace(searchState))
            {
                nameValueCollection.Set("FindString", searchState);
            }
            if (!string.IsNullOrEmpty(replacementRoot))
            {
                nameValueCollection.Set("ReplacementRoot", replacementRoot);
            }
            nameValueCollection.Set("PrefixId", this.UniqueRenderingId);
            nameValueCollection.Set("StyleStream", "true");
            if (!string.IsNullOrEmpty(linkTarget))
            {
                nameValueCollection.Set("LinkTarget", linkTarget);
            }
            if (HttpContext.Current != null && HttpContext.Current.Request != null)
            {
                string userAgent = HttpContext.Current.Request.Headers["User-Agent"];
                if (userAgent != null)
                {
                    nameValueCollection.Set("UserAgent", userAgent);
                }
            }
            if (!string.IsNullOrEmpty(browserMode) && nameValueCollection["BrowserMode"] == null)
            {
                nameValueCollection.Set("BrowserMode", browserMode);
            }
            if (!useImageConsolidation)
            {
                nameValueCollection.Set("ImageConsolidation", "false");
            }
            return(nameValueCollection);
        }
        private void GetStreamImage(string streamID, HttpResponse response, string iterationId)
        {
            StringWriter  stringWriter  = new StringWriter(CultureInfo.InvariantCulture);
            XmlTextWriter xmlTextWriter = new XmlTextWriter(stringWriter);

            xmlTextWriter.WriteStartElement("DeviceInfo");
            string value = ReportImageOperation.CreateUrl(base.m_reportControlSession.Report, base.InstanceID, false, iterationId);

            xmlTextWriter.WriteElementString("StreamRoot", value);
            xmlTextWriter.WriteEndElement();
            string mimeType = default(string);

            byte[] streamImage = base.m_reportControlSession.GetStreamImage(streamID, stringWriter.ToString(), out mimeType);
            this.WriteBytesToResponse(streamImage, mimeType, response);
        }
 public static string CreateUrl(Report report, string instanceID, bool isResourceStreamRoot)
 {
     return(ReportImageOperation.CreateUrl(report, instanceID, isResourceStreamRoot, null));
 }