Пример #1
0
        private void ExpandImageSrc(XmlNode node)  //only pass in <img > node. Expand the src=url
        {
            // Before: <img class="mtps-img-src" alt="Welcome to Visual Studio 2010" src="IC348421" />
            // After:  <img class="mtps-img-src" src="ms-xhelp:///?method=asset&amp;id=IC348421&amp;package=Visual_Studio_21800791_VS_100_en-us_6.mshc&amp;topiclocale=EN-US" alt="Welcome to Visual Studio 2010" title="Welcome to Visual Studio 2010" />
            // Windows help: <img src="mshelp://windows/?id=bf416877-c83f-4476-a3da-8ec98dcf5f10">
            // Windows help: <img src="mshelp://Help/?id=bf416877-c83f-4476-a3da-8ec98dcf5f10">
            // Windows OEM:  <img src="mshelp://OEM/?id=TopicID493dg3789k4f"> ...

            int i;

            foreach (XmlAttribute attr in node.Attributes)
            {
                if (attr.Name.ToLower() == "src")
                {
                    String ID = attr.Value;
                    if (attr.Value.StartsWith("ms-xhelp:///?Id=", StringComparison.OrdinalIgnoreCase))
                    {
                        ID = attr.Value.Substring("ms-xhelp:///?Id=".Length);
                    }
                    else if (attr.Value.StartsWith("mshelp://windows/?id=", StringComparison.OrdinalIgnoreCase))
                    {
                        ID = attr.Value.Substring("mshelp://windows/?id=".Length);
                    }
                    else if (attr.Value.StartsWith("mshelp://help/?id=", StringComparison.OrdinalIgnoreCase))
                    {
                        ID = attr.Value.Substring("mshelp://help/?id=".Length);
                    }
                    else if (attr.Value.StartsWith("mshelp://OEM/?id=", StringComparison.OrdinalIgnoreCase))
                    {
                        ID = attr.Value.Substring("mshelp://OEM/?id=".Length);
                    }
                    else if (attr.Value.StartsWith("http", StringComparison.OrdinalIgnoreCase))
                    {
                        ID = "";
                    }

                    if (ID != "")
                    {
                        //Windows Help weirdness  -- /basic8/Resources/file.jpg  --> /Resources/file.jpg
                        i = ID.IndexOf("/resources/", StringComparison.OrdinalIgnoreCase);
                        if (i > 0 && ID[0] == '/')
                        {
                            ID = ID.Substring(i);
                        }

                        ID = ID.Replace('/', '\\');

                        //ms-xhelp:///?method=asset&amp;id=IC348421&amp;package=Visual_Studio_21800791_VS_100_en-us_6.mshc&amp;topiclocale=EN-US
                        HelpQuery helpQuery = new HelpQuery("asset", ID, null, _helpQuery.TopicVersion, _helpQuery.TopicLocale, _helpQuery.Locale, _helpQuery.Vendor);
                        helpQuery.Package = _helpQuery.Package;
                        attr.Value        = helpQuery.ToString(); //.Replace("&", "&amp;");
                    }
                    break;
                }
            }
        }
Пример #2
0
        public TopicStreamExpand(Stream stream, HelpQuery helpQuery)
        {
            _helpQuery = new HelpQuery(helpQuery.ToString());
            if (String.IsNullOrEmpty(_helpQuery.Locale))
                _helpQuery.Locale = MSLocales.ThreadLocale;

            xbrandingPath = msxhelpPrefix + DefaultBrandPathBase + _helpQuery.Locale + "_Microsoft";

            //eg ms-xhelp:///?method=asset&amp;id=SomeAssetPath&amp;package=SomePackage.mshc&amp;topiclocale=EN-US
            xAssetPathTemplate = msxhelpPrefix + "method=asset&amp;id={0}&amp;package=" + helpQuery.Package + "&amp;topiclocale=" + _helpQuery.Locale;

            //Rip all meta data
            metaData = new MetaData(stream);

            //Render
            DoRender(stream);
        }
Пример #3
0
        public TopicStreamExpand(Stream stream, HelpQuery helpQuery)
        {
            _helpQuery = new HelpQuery(helpQuery.ToString());
            if (String.IsNullOrEmpty(_helpQuery.Locale))
            {
                _helpQuery.Locale = MSLocales.ThreadLocale;
            }

            xbrandingPath = msxhelpPrefix + DefaultBrandPathBase + _helpQuery.Locale + "_Microsoft";

            //eg ms-xhelp:///?method=asset&amp;id=SomeAssetPath&amp;package=SomePackage.mshc&amp;topiclocale=EN-US
            xAssetPathTemplate = msxhelpPrefix + "method=asset&amp;id={0}&amp;package=" + helpQuery.Package + "&amp;topiclocale=" + _helpQuery.Locale;

            //Rip all meta data
            metaData = new MetaData(stream);

            //Render
            DoRender(stream);
        }
Пример #4
0
        private void ExpandAnchorHref(XmlNode node)  //only pass in <a > node. Expand the href=url
        {
            // Before: <a href="ms-xhelp:///?Id=SouthPark.KyleBroflovski">KyleBroflovski</a>
            // After:  <a href="ms-xhelp:///?method=page&amp;id=SouthPark.KyleBroflovski&amp;vendor=ACME Company&amp;topicVersion=-1&amp;topicLocale=EN-US">
            // Windows help: <a href="mshelp://windows/?id=bf416877-c83f-4476-a3da-8ec98dcf5f10">
            // Windows help: <a href="mshelp://Help/?id=bf416877-c83f-4476-a3da-8ec98dcf5f10">   //variation used by images
            // Windows OEM:  <a href="mshelp://OEM/?id=TopicID493dg3789k4f"> ...

            foreach (XmlAttribute attr in node.Attributes)
            {
                if (attr.Name.ToLower() == "href")
                {
                    String ID = "";
                    if (attr.Value.StartsWith("ms-xhelp:///?Id=", StringComparison.OrdinalIgnoreCase))
                    {
                        ID = attr.Value.Substring("ms-xhelp:///?Id=".Length);
                    }
                    else if (attr.Value.StartsWith("mshelp://windows/?id=", StringComparison.OrdinalIgnoreCase))
                    {
                        ID = attr.Value.Substring("mshelp://windows/?id=".Length);
                    }
                    else if (attr.Value.StartsWith("mshelp://help/?id=", StringComparison.OrdinalIgnoreCase))
                    {
                        ID = attr.Value.Substring("mshelp://help/?id=".Length);
                    }
                    else if (attr.Value.StartsWith("mshelp://OEM/?id=", StringComparison.OrdinalIgnoreCase))
                    {
                        ID = attr.Value.Substring("mshelp://OEM/?id=".Length);
                    }

                    //update value with full path
                    if (ID != "")
                    {
                        ID = ID.Replace('/', '\\');

                        //ms-xhelp:///?method=page&amp;id=SouthPark.KyleBroflovski&amp;vendor=ACME Company&amp;topicVersion=-1&amp;topicLocale=EN-US
                        HelpQuery helpQuery = new HelpQuery("page", ID, null, _helpQuery.TopicVersion, _helpQuery.TopicLocale, _helpQuery.Locale, _helpQuery.Vendor);
                        attr.Value = helpQuery.ToString(); //.Replace("&", "&amp;");
                    }
                    break;
                }
            }
        }
Пример #5
0
        //only pass in <img > node. Expand the src=url
        private void ExpandImageSrc(XmlNode node)
        {
            // Before: <img class="mtps-img-src" alt="Welcome to Visual Studio 2010" src="IC348421" />
            // After:  <img class="mtps-img-src" src="ms-xhelp:///?method=asset&amp;id=IC348421&amp;package=Visual_Studio_21800791_VS_100_en-us_6.mshc&amp;topiclocale=EN-US" alt="Welcome to Visual Studio 2010" title="Welcome to Visual Studio 2010" />
            // Windows help: <img src="mshelp://windows/?id=bf416877-c83f-4476-a3da-8ec98dcf5f10">
            // Windows help: <img src="mshelp://Help/?id=bf416877-c83f-4476-a3da-8ec98dcf5f10">
            // Windows OEM:  <img src="mshelp://OEM/?id=TopicID493dg3789k4f"> ...

            int i;
            foreach (XmlAttribute attr in node.Attributes)
            {
                if (attr.Name.ToLower() == "src")
                {
                    String ID = attr.Value;
                    if (attr.Value.StartsWith("ms-xhelp:///?Id=", StringComparison.OrdinalIgnoreCase))
                        ID = attr.Value.Substring("ms-xhelp:///?Id=".Length);
                    else if (attr.Value.StartsWith("mshelp://windows/?id=", StringComparison.OrdinalIgnoreCase))
                        ID = attr.Value.Substring("mshelp://windows/?id=".Length);
                    else if (attr.Value.StartsWith("mshelp://help/?id=", StringComparison.OrdinalIgnoreCase))
                        ID = attr.Value.Substring("mshelp://help/?id=".Length);
                    else if (attr.Value.StartsWith("mshelp://OEM/?id=", StringComparison.OrdinalIgnoreCase))
                        ID = attr.Value.Substring("mshelp://OEM/?id=".Length);
                    else if (attr.Value.StartsWith("http", StringComparison.OrdinalIgnoreCase))
                        ID = "";

                    if (ID != "")
                    {
                        //Windows Help weirdness  -- /basic8/Resources/file.jpg  --> /Resources/file.jpg
                        i = ID.IndexOf("/resources/", StringComparison.OrdinalIgnoreCase);
                        if (i > 0 && ID[0] == '/')
                            ID = ID.Substring(i);

                        ID = ID.Replace('/', '\\');

                        //ms-xhelp:///?method=asset&amp;id=IC348421&amp;package=Visual_Studio_21800791_VS_100_en-us_6.mshc&amp;topiclocale=EN-US
                        HelpQuery helpQuery = new HelpQuery("asset", ID, null, _helpQuery.TopicVersion, _helpQuery.TopicLocale, _helpQuery.Locale, _helpQuery.Vendor);
                        helpQuery.Package = _helpQuery.Package;
                        attr.Value = helpQuery.ToString(); //.Replace("&", "&amp;");
                    }
                    break;
                }
            }
        }
Пример #6
0
        //only pass in <a > node. Expand the href=url
        private void ExpandAnchorHref(XmlNode node)
        {
            // Before: <a href="ms-xhelp:///?Id=SouthPark.KyleBroflovski">KyleBroflovski</a>
            // After:  <a href="ms-xhelp:///?method=page&amp;id=SouthPark.KyleBroflovski&amp;vendor=ACME Company&amp;topicVersion=-1&amp;topicLocale=EN-US">
            // Windows help: <a href="mshelp://windows/?id=bf416877-c83f-4476-a3da-8ec98dcf5f10">
            // Windows help: <a href="mshelp://Help/?id=bf416877-c83f-4476-a3da-8ec98dcf5f10">   //variation used by images
            // Windows OEM:  <a href="mshelp://OEM/?id=TopicID493dg3789k4f"> ...

            foreach (XmlAttribute attr in node.Attributes)
            {
                if (attr.Name.ToLower() == "href")
                {
                    String ID = "";
                    if (attr.Value.StartsWith("ms-xhelp:///?Id=", StringComparison.OrdinalIgnoreCase))
                        ID = attr.Value.Substring("ms-xhelp:///?Id=".Length);
                    else if (attr.Value.StartsWith("mshelp://windows/?id=", StringComparison.OrdinalIgnoreCase))
                        ID = attr.Value.Substring("mshelp://windows/?id=".Length);
                    else if (attr.Value.StartsWith("mshelp://help/?id=", StringComparison.OrdinalIgnoreCase))
                        ID = attr.Value.Substring("mshelp://help/?id=".Length);
                    else if (attr.Value.StartsWith("mshelp://OEM/?id=", StringComparison.OrdinalIgnoreCase))
                        ID = attr.Value.Substring("mshelp://OEM/?id=".Length);

                    //update value with full path
                    if (ID != "")
                    {
                        ID = ID.Replace('/', '\\');

                        //ms-xhelp:///?method=page&amp;id=SouthPark.KyleBroflovski&amp;vendor=ACME Company&amp;topicVersion=-1&amp;topicLocale=EN-US
                        HelpQuery helpQuery = new HelpQuery("page", ID, null, _helpQuery.TopicVersion, _helpQuery.TopicLocale, _helpQuery.Locale, _helpQuery.Vendor);
                        attr.Value = helpQuery.ToString(); //.Replace("&", "&amp;");
                    }
                    break;
                }
            }
        }