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&id=IC348421&package=Visual_Studio_21800791_VS_100_en-us_6.mshc&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&id=IC348421&package=Visual_Studio_21800791_VS_100_en-us_6.mshc&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("&", "&"); } break; } } }
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&id=SomeAssetPath&package=SomePackage.mshc&topiclocale=EN-US xAssetPathTemplate = msxhelpPrefix + "method=asset&id={0}&package=" + helpQuery.Package + "&topiclocale=" + _helpQuery.Locale; //Rip all meta data metaData = new MetaData(stream); //Render DoRender(stream); }
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&id=SomeAssetPath&package=SomePackage.mshc&topiclocale=EN-US xAssetPathTemplate = msxhelpPrefix + "method=asset&id={0}&package=" + helpQuery.Package + "&topiclocale=" + _helpQuery.Locale; //Rip all meta data metaData = new MetaData(stream); //Render DoRender(stream); }
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&id=SouthPark.KyleBroflovski&vendor=ACME Company&topicVersion=-1&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&id=SouthPark.KyleBroflovski&vendor=ACME Company&topicVersion=-1&topicLocale=EN-US HelpQuery helpQuery = new HelpQuery("page", ID, null, _helpQuery.TopicVersion, _helpQuery.TopicLocale, _helpQuery.Locale, _helpQuery.Vendor); attr.Value = helpQuery.ToString(); //.Replace("&", "&"); } break; } } }
//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&id=IC348421&package=Visual_Studio_21800791_VS_100_en-us_6.mshc&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&id=IC348421&package=Visual_Studio_21800791_VS_100_en-us_6.mshc&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("&", "&"); } break; } } }
//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&id=SouthPark.KyleBroflovski&vendor=ACME Company&topicVersion=-1&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&id=SouthPark.KyleBroflovski&vendor=ACME Company&topicVersion=-1&topicLocale=EN-US HelpQuery helpQuery = new HelpQuery("page", ID, null, _helpQuery.TopicVersion, _helpQuery.TopicLocale, _helpQuery.Locale, _helpQuery.Vendor); attr.Value = helpQuery.ToString(); //.Replace("&", "&"); } break; } } }