/// <summary> /// Returns the markup for the list of servable files /// in the same directory /// as the context web directory. /// /// Each file name will link to the file so that it /// may be served. /// /// The optional comment heads the list of file names. /// If omitted, a default comment is constructed. /// </summary> /// <param name="context">Web site HttpContext object</param> /// <param name="comment">Optional comment to head list</param> public static string MakeServableListMarkup (HttpContext context, string comment) { if (context == null) { return(""); } List <string> servablelist = HttpContextTools.MakeServableList(context); int count = servablelist.Count; if (count == 0) { return(""); } StringBuilder builder = new StringBuilder(); builder.Append(HTML_Tools.open_p); if (StringTools.IsTrivial(comment)) { string tildePath = HttpContextTools.GetTildeDirectoryPath(context); builder.Append("Servable files in "); builder.Append(tildePath); builder.Append(" ["); builder.Append(count); builder.Append("]:"); } else { builder.Append(comment); } builder.Append(HTML_Tools.shut_p); foreach (string name in servablelist) { builder.Append(HTML_Tools.open_div); builder.Append(HTML_Tools.open_anchor); builder.Append(name); builder.Append(HTML_Tools.mid_anchor_blank); builder.Append(HTML_Tools.open_code); builder.Append(name); builder.Append(HTML_Tools.shut_code); builder.Append(HTML_Tools.shut_anchor); builder.Append(HTML_Tools.shut_div); } return(builder.ToString()); }