public string get_archives_html() { StringBuilder sb = new StringBuilder(); int c = 0; foreach (var a in ArchivesProvider.GetAllArchives()) { sb.AppendFormat("<option value='{0}'>{1}</option>", c, System.Web.HttpUtility.HtmlEncode(a.Name)); c++; } return(sb.ToString()); }
private string get_ai_items() { StringBuilder sb = new StringBuilder(); /* * * { * supported_boards: [""], * supported_files: [""], * name: "", * ishttp: true, * ishttps: false * } */ int a_c = ArchivesProvider.GetAllArchives().Count(); int w_ac = 0; foreach (ArchiveInfo w in ArchivesProvider.GetAllArchives()) { sb.Append("{"); sb.Append("supported_boards:["); int c = w.GetSupportedBoards().Count(); int c_w = 0; foreach (string b in w.GetSupportedBoards()) { sb.Append("\""); sb.Append(b); sb.Append("\""); if (c_w < c - 1) { sb.Append(","); } c_w++; } sb.Append("],"); sb.Append("supported_files:["); c = w.GetSupportedFiles().Count(); c_w = 0; foreach (string b in w.GetSupportedFiles()) { sb.Append("\""); sb.Append(b); sb.Append("\""); if (c_w < c - 1) { sb.Append(","); } c_w++; } sb.Append("],"); sb.Append("name: \""); sb.Append(w.Name.Replace("\"", @"\""")); sb.Append("\","); sb.Append("ishttp: "); sb.Append(w.SupportHttp ? "true" : "false"); sb.Append(","); sb.Append("ishttps: "); sb.Append(w.SupportHttps ? "true" : "false"); sb.Append("}"); if (w_ac < a_c - 1) { sb.Append(","); } } return(sb.ToString()); }