public string GetPages(string page) { string root = Request.MapPath(Config.Main.Data); string[] ar = Directory.GetFiles(root, "*" + Keys.ConfigExtension); StringBuilder sb = new StringBuilder(); for (int i = 0; i < ar.Length; i++) { string p = PageInfo.DotToSlash(ar[i].Remove(ar[i].Length - Keys.ConfigExtension.Length, Keys.ConfigExtension.Length).Substring(root.Length + 1)); if (!p.StartsWith(Config.Main.AdminFolderName + Keys.UrlPathDelimiter)) { sb.AppendFormat("<option value=\"{0}\"{1}>{0}</option>", p, p == page ? " selected" : ""); } } return(sb.ToString()); }
public System.Data.DataTable Search(string text, int resultBodyLength, string prefix, string postfix) { DataTable tb = SearchUtil.CreateResultTable(); DirectoryInfo di = new DirectoryInfo(HttpContext.Current.Request.MapPath(Config.Main.Data)); FileInfo[] af = di.GetFiles("*" + Keys.ConfigExtension); int n = af.Length; for (int i = 0; i < n; i++) { PageInfo pi = new PageInfo(PageInfo.DotToSlash(af[i].Name.Substring(0, af[i].Name.Length - af[i].Extension.Length))); string body = SearchUtil.SearchTheText(pi.Body, text, resultBodyLength, prefix, postfix); if (body != null) { tb.Rows.Add(new object[] { pi.Url, pi.Title == string.Empty ? pi.Url : pi.Title, body }); } } return(tb); }