public static string LoadArticle(int id, double webViewWidth, double webViewHeight) { string unformattedArticle = articles[id].content; StringBuilder formattedArticle = new StringBuilder(); for (int i = 0; i < unformattedArticle.Length;) { string upcomingSubsting = ""; try { upcomingSubsting = unformattedArticle.Substring(i, 7); } catch { } if (upcomingSubsting == "width=" + '"') { i = ExtraFunctions.AlterDimensions(i, unformattedArticle, formattedArticle, webViewWidth, webViewHeight); } else if (upcomingSubsting == "[appbox") { i += 21; string storeUrl = "https://www.microsoft.com/en-us/store/apps/app/"; StringBuilder appId = new StringBuilder(); while (unformattedArticle[i] != ']') { appId.Append(unformattedArticle[i]); i += 1; } i += 1; storeUrl = storeUrl + appId.ToString(); formattedArticle.Append("<a href=" + '"' + storeUrl + '"' + ">Download app</a>"); } else if (upcomingSubsting == "[captio") { int j = i; StringBuilder s = new StringBuilder(); while (unformattedArticle[j] != ']') { j += 1; } j += 1; i = j; formattedArticle.Append("<Center>"); while (unformattedArticle.Substring(j, 2) != "/>") { if (unformattedArticle.Substring(j, 7) == "width=" + '"') { j = ExtraFunctions.AlterDimensions(j, unformattedArticle, formattedArticle, webViewWidth, webViewHeight); } formattedArticle.Append(unformattedArticle[j]); j += 1; } formattedArticle.Append("/></a>"); j += 2; // // formattedArticle.Append("<br><br>Image Description : "); while (unformattedArticle[j] != '[') { // formattedArticle.Append(unformattedArticle[j]); j += 1; } i = j + 10; formattedArticle.Append("</Center>"); } else if (upcomingSubsting == "https:/") { StringBuilder url = new StringBuilder(); while (unformattedArticle[i] != '\r') { url.Append(unformattedArticle[i]); i += 1; } i += 4; if (url.ToString().Contains("youtube")) { url.Replace("watch?v=", "embed/"); formattedArticle.Append("<iframe width=" + '"' + webViewWidth + '"' + " height=" + '"' + "300" + '"' + " src=" + '"' + url + '"' + "></iframe>"); } } else { formattedArticle.Append(unformattedArticle[i]); i += 1; } } formattedArticle.Replace("\n", "</P><P>"); string style = "<style> body{zoom:100%;} iframe{margin-bottom:10px} a{text-decoration:none} p { margin-right: 15px; margin-left: 15px} body { font-family: " + '"' + "Segoe UI" + '"' + "; font-size: 46px; margin-right: 15px; margin-left: 15px } li{ font-family: " + '"' + "Segoe UI" + '"' + "; font-size: 46px; margin-right: 20px; margin-left: 20px } img{align: middle} blockquote{ font-family: " + '"' + "Segoe UI" + '"' + "; font-size: 46px; margin-right: 20px; margin-left: 20px; font-style: italic} </style>"; return("<html><head>" + style + "</head><body link = " + '"' + Settings.accentColor + '"' + ">" + "<P>" + formattedArticle.ToString() + "</Font></body>"); }