private Stream UpgradeFrom201001(XmlReader xmlReader, out RDLUpgradeResult upgradeResults)
            {
                MemoryStream    memoryStream = new MemoryStream();
                UpgradeImpl2010 upgradeImpl  = new UpgradeImpl2010();

                upgradeImpl.Upgrade(xmlReader, memoryStream);
                upgradeResults = upgradeImpl.UpgradeResults;
                memoryStream.Seek(0L, SeekOrigin.Begin);
                return(memoryStream);
            }
            private Stream UpgradeUnified(Stream stream, XmlReader xmlReader, string namespaceURI, bool throwUpgradeException, bool upgradeDundasCRIToNative, bool renameInvalidDataSources, out RDLUpgradeResult upgradeResults)
            {
                if (stream == null && xmlReader == null)
                {
                    throw new ArgumentNullException("Stream or XmlReader must be non-null");
                }
                if (xmlReader != null && namespaceURI == null)
                {
                    throw new ArgumentException("namespaceURI must not be null if xmlReader is specified");
                }
                if (namespaceURI == null)
                {
                    xmlReader = this.CreateXmlReader(stream);
                    xmlReader.MoveToContent();
                    namespaceURI = xmlReader.NamespaceURI;
                    xmlReader.Close();
                    xmlReader = null;
                    stream.Seek(0L, SeekOrigin.Begin);
                }
                upgradeResults = null;
                switch (namespaceURI)
                {
                case "http://schemas.microsoft.com/SQLServer/reporting/reportdefinition-1":
                case "http://schemas.microsoft.com/SQLServer/reporting/reportdefinition-2":
                case "http://schemas.microsoft.com/sqlserver/reporting/2003/04/reportdefinition":
                case "http://schemas.microsoft.com/sqlserver/reporting/2003/04/reportdefinition-1":
                case "http://schemas.microsoft.com/sqlserver/reporting/2003/10/reportdefinition":
                    this.LoadDefinitionXml(ref xmlReader, stream, false);
                    stream = this.SaveDefinitionXml();
                    goto case "http://schemas.microsoft.com/sqlserver/reporting/2005/01/reportdefinition";

                case "http://schemas.microsoft.com/sqlserver/reporting/2005/01/reportdefinition":
                    stream = this.UpgradeFrom200501(this.EnsureReaderSetup(xmlReader, stream), throwUpgradeException, upgradeDundasCRIToNative, renameInvalidDataSources, out upgradeResults);
                    goto case "http://schemas.microsoft.com/sqlserver/reporting/2016/01/reportdefinition";

                case "http://schemas.microsoft.com/sqlserver/reporting/2007/01/reportdefinition":
                    this.LoadDefinitionXml(ref xmlReader, stream, true);
                    this.UpgradeFrom200701();
                    stream = this.SaveDefinitionXml();
                    goto case "http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition";

                case "http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition":
                    stream = this.UpgradeFrom200801(this.EnsureReaderSetup(xmlReader, stream), out upgradeResults);
                    goto case "http://schemas.microsoft.com/sqlserver/reporting/2016/01/reportdefinition";

                case "http://schemas.microsoft.com/sqlserver/reporting/2009/01/reportdefinition":
                    this.LoadDefinitionXml(ref xmlReader, stream, true);
                    this.UpgradeFrom200901();
                    stream = this.SaveDefinitionXml();
                    goto case "http://schemas.microsoft.com/sqlserver/reporting/2010/01/reportdefinition";

                case "http://schemas.microsoft.com/sqlserver/reporting/2010/01/reportdefinition":
                    stream = this.UpgradeFrom201001(this.EnsureReaderSetup(xmlReader, stream), out upgradeResults);
                    goto case "http://schemas.microsoft.com/sqlserver/reporting/2016/01/reportdefinition";

                case "http://schemas.microsoft.com/sqlserver/reporting/2016/01/reportdefinition":
                    if (upgradeResults == null)
                    {
                        upgradeResults = new RDLUpgradeResult();
                    }
                    if (stream == null)
                    {
                        this.LoadDefinitionXml(ref xmlReader, stream, true);
                        stream = this.SaveDefinitionXml();
                    }
                    return(stream);

                default:
                    throw new RDLUpgradeException(RDLUpgradeStrings.rdlInvalidTargetNamespace(namespaceURI));
                }
            }
 public Stream Upgrade(Stream stream, bool throwUpgradeException, bool upgradeDundasCRIToNative, bool renameInvalidDataSources, out RDLUpgradeResult upgradeResults)
 {
     return(this.UpgradeUnified(stream, (XmlReader)null, (string)null, throwUpgradeException, upgradeDundasCRIToNative, renameInvalidDataSources, out upgradeResults));
 }
 public Stream Upgrade(XmlReader xmlReader, string namespaceURI, bool throwUpgradeException, bool upgradeDundasCRIToNative, out RDLUpgradeResult upgradeResults)
 {
     return(this.UpgradeUnified((Stream)null, xmlReader, namespaceURI, throwUpgradeException, upgradeDundasCRIToNative, true, out upgradeResults));
 }
        public static RDLUpgradeResult CheckForDundasCRI(XmlTextReader xmlTextReader)
        {
            RDLUpgradeResult rDLUpgradeResult = new RDLUpgradeResult();

            try
            {
                xmlTextReader.MoveToContent();
                if (xmlTextReader.NamespaceURI.Equals(RdlUpgrader.Get2005NamespaceURI(), StringComparison.OrdinalIgnoreCase))
                {
                    while (xmlTextReader.ReadToFollowing("CustomReportItem"))
                    {
                        bool flag   = false;
                        bool flag2  = false;
                        bool flag3  = false;
                        bool flag4  = false;
                        bool flag5  = false;
                        bool flag6  = false;
                        bool flag7  = false;
                        bool flag8  = false;
                        bool flag9  = false;
                        bool flag10 = false;
                        bool flag11 = false;
                        xmlTextReader.ReadStartElement();
                        do
                        {
                            if (xmlTextReader.NodeType == XmlNodeType.Element)
                            {
                                if (xmlTextReader.Name == "Type")
                                {
                                    string text = xmlTextReader.ReadInnerXml();
                                    flag  = text.Equals("DUNDASCHARTCONTROL", StringComparison.OrdinalIgnoreCase);
                                    flag2 = text.Equals("DUNDASGAUGECONTROL", StringComparison.OrdinalIgnoreCase);
                                    if (!flag && !flag2)
                                    {
                                        break;
                                    }
                                }
                                else if (xmlTextReader.Name == "CustomProperties")
                                {
                                    xmlTextReader.ReadStartElement();
                                    do
                                    {
                                        if (xmlTextReader.Name == "Name")
                                        {
                                            string text2 = xmlTextReader.ReadInnerXml();
                                            if (text2.StartsWith("CHART.ANNOTATIONS.", StringComparison.OrdinalIgnoreCase))
                                            {
                                                flag3 = true;
                                            }
                                            if (text2.StartsWith("CHART.LEGENDS", StringComparison.OrdinalIgnoreCase) && (text2.IndexOf("LEGEND.CUSTOMITEMS.", StringComparison.OrdinalIgnoreCase) > 0 || text2.IndexOf("LEGEND.CELLCOLUMNS.", StringComparison.OrdinalIgnoreCase) > 0))
                                            {
                                                flag4 = true;
                                            }
                                            if (text2.StartsWith("GAUGECORE.NUMERICINDICATORS.", StringComparison.OrdinalIgnoreCase))
                                            {
                                                flag5 = true;
                                            }
                                            if (text2.StartsWith("GAUGECORE.STATEINDICATORS.", StringComparison.OrdinalIgnoreCase))
                                            {
                                                flag6 = true;
                                            }
                                            if (text2.StartsWith("GAUGECORE.NAMEDIMAGES.", StringComparison.OrdinalIgnoreCase) || text2.StartsWith("GAUGECORE.IMAGES.", StringComparison.OrdinalIgnoreCase))
                                            {
                                                flag7 = true;
                                            }
                                            if (text2.StartsWith("CUSTOM_CODE_CS", StringComparison.OrdinalIgnoreCase) || text2.StartsWith("CUSTOM_CODE_VB", StringComparison.OrdinalIgnoreCase) || text2.StartsWith("CUSTOM_CODE_COMPILED_ASSEMBLY", StringComparison.OrdinalIgnoreCase))
                                            {
                                                flag8 = true;
                                            }
                                        }
                                    }while ((!(xmlTextReader.Name == "CustomProperties") || xmlTextReader.NodeType != XmlNodeType.EndElement) && xmlTextReader.Read());
                                }
                                else if (xmlTextReader.Name == "CustomData")
                                {
                                    bool flag12 = false;
                                    bool flag13 = false;
                                    xmlTextReader.ReadStartElement();
                                    do
                                    {
                                        if (xmlTextReader.Name == "DataRowGroupings")
                                        {
                                            if (xmlTextReader.NodeType == XmlNodeType.Element)
                                            {
                                                flag12 = true;
                                            }
                                            else if (xmlTextReader.NodeType == XmlNodeType.EndElement)
                                            {
                                                flag12 = false;
                                            }
                                        }
                                        else if (flag12 && xmlTextReader.Name == "Name")
                                        {
                                            string text3 = xmlTextReader.ReadInnerXml();
                                            if (text3.Equals("ERRORFORMULA:BOXPLOT", StringComparison.OrdinalIgnoreCase) || text3.Equals("FINANCIALFORMULA:FORECASTING", StringComparison.OrdinalIgnoreCase))
                                            {
                                                flag9 = true;
                                            }
                                            if (text3.StartsWith("ERRORFORMULA", StringComparison.OrdinalIgnoreCase) || text3.StartsWith("FINANCIALFORMULA", StringComparison.OrdinalIgnoreCase) || text3.StartsWith("STATISTICALFORMULA", StringComparison.OrdinalIgnoreCase))
                                            {
                                                xmlTextReader.Skip();
                                                string[] array  = xmlTextReader.ReadInnerXml().Split(';');
                                                string[] array2 = array;
                                                foreach (string text4 in array2)
                                                {
                                                    if (text4.Trim().StartsWith("SECONDARYAXIS", StringComparison.OrdinalIgnoreCase))
                                                    {
                                                        flag10 = true;
                                                    }
                                                }
                                            }
                                        }
                                        else if (xmlTextReader.Name == "DataRows")
                                        {
                                            if (xmlTextReader.NodeType == XmlNodeType.Element)
                                            {
                                                flag13 = true;
                                            }
                                            else if (xmlTextReader.NodeType == XmlNodeType.EndElement)
                                            {
                                                flag13 = false;
                                            }
                                        }
                                        else if (flag13 && xmlTextReader.Name == "Name")
                                        {
                                            string text5 = xmlTextReader.ReadInnerXml();
                                            if (text5.StartsWith("CUSTOMVALUE:", StringComparison.OrdinalIgnoreCase))
                                            {
                                                flag11 = true;
                                            }
                                        }
                                    }while ((!(xmlTextReader.Name == "CustomData") || xmlTextReader.NodeType != XmlNodeType.EndElement) && xmlTextReader.Read());
                                }
                            }
                            xmlTextReader.Skip();
                        }while (xmlTextReader.NodeType != XmlNodeType.EndElement);
                        if (flag)
                        {
                            if (flag3 || flag4 || flag8 || flag9 || flag10 || flag11)
                            {
                                rDLUpgradeResult.HasUnsupportedDundasChartFeatures = true;
                            }
                        }
                        else if (flag2 && (flag5 || flag6 || flag7 || flag8))
                        {
                            rDLUpgradeResult.HasUnsupportedDundasGaugeFeatures = true;
                        }
                    }
                    return(rDLUpgradeResult);
                }
                return(rDLUpgradeResult);
            }
            catch
            {
                return(rDLUpgradeResult);
            }
        }
        public static Stream UpgradeToCurrent(Stream stream, bool throwUpgradeException, bool renameInvalidDataSources, out RDLUpgradeResult upgradeResults)
        {
            if (!stream.CanSeek)
            {
                throw new ArgumentException("Upgrade reqires Stream.CanSeek.");
            }
            RdlUpgrader rdlUpgrader = new RdlUpgrader();

            return(rdlUpgrader.Upgrade(stream, throwUpgradeException, true, renameInvalidDataSources, out upgradeResults));
        }
        public static Stream UpgradeToCurrent(Stream stream, bool throwUpgradeException, bool renameInvalidDataSources)
        {
            RDLUpgradeResult rDLUpgradeResult = null;

            return(RDLUpgrader.UpgradeToCurrent(stream, throwUpgradeException, renameInvalidDataSources, out rDLUpgradeResult));
        }
        public static Stream UpgradeToCurrent(Stream stream, bool throwUpgradeException)
        {
            RDLUpgradeResult rDLUpgradeResult = null;

            return(RDLUpgrader.UpgradeToCurrent(stream, throwUpgradeException, true, out rDLUpgradeResult));
        }
        public static Stream UpgradeToCurrent(XmlReader rdlReader, string namespaceURI, bool throwUpgradeException, bool upgradeDundasCRIToNative)
        {
            RDLUpgradeResult rDLUpgradeResult = null;

            return(RDLUpgrader.UpgradeToCurrent(rdlReader, namespaceURI, throwUpgradeException, upgradeDundasCRIToNative, out rDLUpgradeResult));
        }
        public static Stream UpgradeToCurrent(XmlReader rdlReader, string namespaceURI, bool throwUpgradeException, bool upgradeDundasCRIToNative, out RDLUpgradeResult upgradeResults)
        {
            RdlUpgrader rdlUpgrader = new RdlUpgrader();

            return(rdlUpgrader.Upgrade(rdlReader, namespaceURI, throwUpgradeException, upgradeDundasCRIToNative, out upgradeResults));
        }
            private Stream UpgradeFrom200501(XmlReader xmlReader, bool throwUpgradeException, bool upgradeDundasCRIToNative, bool renameInvalidDataSources, out RDLUpgradeResult upgradeResults)
            {
                MemoryStream    memoryStream = new MemoryStream();
                UpgradeImpl2005 upgradeImpl  = new UpgradeImpl2005(throwUpgradeException, upgradeDundasCRIToNative, renameInvalidDataSources);

                upgradeImpl.Upgrade(xmlReader, memoryStream);
                upgradeResults = upgradeImpl.UpgradeResults;
                memoryStream.Seek(0L, SeekOrigin.Begin);
                return(memoryStream);
            }