public static String script_renderHTML(HtmlNode script) { foreach (var att in script.Attributes) { if (att.Name == "src") { Library.Property.ASPScripts.links.Add(att.Value); String linkpath = ""; if (att.Value.Contains("//cdnjs") || att.Value.Contains("//code")) { if (att.Value.Contains("https:")) { linkpath = att.Value; } else { linkpath = "http:" + att.Value; } } else { linkpath = Property.RacineURL + "/" + att.Value; } var subpath = att.Value.Split('/'); FileFolder.downloadfile(linkpath, "scripts/js/" + subpath[subpath.Length - 1]); att.Value = "~/Content/scripts/js/" + subpath[subpath.Length - 1]; } } return(script.OuterHtml + Environment.NewLine); }
public static String RenderHeaderStyle(HtmlNode node) { String head = ""; if (node.Name == "link") { var attcss = node.Attributes.Where(x => x.Name == "rel" && x.Value == "stylesheet").FirstOrDefault(); if (attcss != null) { var att = node.Attributes.Where(x => x.Name == "href").FirstOrDefault(); if (!Library.Property.ASPStyles.links.Contains(att.Value)) { if (att.Name == "href") { String linkpath = ""; if (att.Value.Contains("//code.jquery.com")) { linkpath = "http:" + att.Value; } else if (att.Value.Contains("https://fonts.")) { linkpath = att.Value; att.Value = linkpath; } else { linkpath = Property.RacineURL + "/" + att.Value; var subpath = att.Value.Split('/'); FileFolder.downloadfile(linkpath, "css/" + subpath[subpath.Length - 1]); att.Value = "~/Content/css/" + subpath[subpath.Length - 1]; } head += node.OuterHtml + Environment.NewLine; } } } } return(head); }
private static string RenderHeaderScript(HtmlNode node) { String script = ""; if (node.Name == "script") { var attjs = node.Attributes.Where(x => x.Name == "src").FirstOrDefault(); if (attjs != null) { if (!Library.Property.ASPScripts.links.Contains(attjs.Value)) { String linkpath = ""; if (attjs.Value.Contains("//cdnjs") || attjs.Value.Contains("//code")) { if (attjs.Value.Contains("https:")) { linkpath = attjs.Value; } else { linkpath = "http:" + attjs.Value; } } else { linkpath = Property.RacineURL + "/" + attjs.Value; } var subpath = attjs.Value.Split('/'); FileFolder.downloadfile(linkpath, "scripts/js/" + subpath[subpath.Length - 1]); attjs.Value = "~/Content/scripts/js/" + subpath[subpath.Length - 1]; script += node.OuterHtml + Environment.NewLine; } } } return(script); }