/// <summary> /// レスの変換を行います /// </summary> /// <param name="r">指定したレスのデータ</param> /// <param name="idData">IDの情報を収めたデータ</param> /// <param name="rs">元のRes構造体</param> /// <returns>変換したHTML</returns> protected virtual String SimpleConvertCore(Res r, Dictionary <string, int[]> idData, out Res rs) { rs = r; if (!r.Visible) { return(""); } StringBuilder sb = new StringBuilder(); string id = r.ID; string data = idData[id][0].ToString() + "/" + idData[id][1].ToString(); string idString = String.Empty; if (idData[id][1] > 1) { //idString = "<span style='color:#00F; text-decoration:underline;'>" + idData + "</span>" + " [" + ((int[])id[idData])[0] + "/" + ((int[])id[idData])[1] + "]"; idString = String.Format(@"<a href=""method:Extract($3,{0})"" style=""color:black;"" target=""_blank"">{0}</a>({1})", id, data); } else if ((idData[id])[1] > 3) { // idString = "<span style='color:#F00; text-decoration:underline;'>" + idData + "</span>" + " [" + ((int[])id[idData])[0] + "/" + ((int[])id[idData])[1] + "]"; idString = String.Format(@"<a href=""method:Extract($3,{0})"" style=""color:black;"" target=""_blank"">{0}</a>({1})", id, data); } else if ((idData[id])[1] == 1) { // idString = "<span style='color:#000; text-decoration:underline;'>" + idData + "</span>" + " [" + ((int[])id[idData])[0] + "/" + ((int[])id[idData])[1] + "]"; idString = String.Format(@"<a href=""method:Extract($3,{0})"" style=""color:black;"" target=""_blank"">{0}</a>({1})", id, data); } else { idString = "<span style='color:#000; text-decoration:underline;'>" + id + "</span>"; } string sentence = Regex.Replace(r.Sentence, @"<a\s+.*?>", ""); sentence = sentence.Replace("</a>", ""); sentence = SU.Linking(sentence); sentence = rs.Sentence = Regex.Replace(sentence, @">>(?<res>\d+)", (m) => { return("<a href=\"#\">>>" + m.Groups["res"].Value + "</a>"); }); //<a +.*?>(.*?)</a> string idDatas = String.Empty; idDatas = r.ID + "(" + idData[r.ID][0].ToString() + "/" + idData[r.ID][1].ToString() + ")"; sb.Append("<dt id=\"s").Append(r.Index).Append("\" class=\"\">"); sb.Append("<indices id=\"").Append(r.Index).Append("\"></indices>"); sb.AppendFormat(@"<b><a href=""menu:{0}"" name=""{0}"" target=""_blank"">{0}</a></b>", r.Index); sb.AppendFormat(@" 名前:<font color=""green""><b>{0}</b></font>", r.Name); sb.AppendFormat(@" [{0}] ", r.Mail); sb.AppendFormat(@"投稿日:{0} ", r.Date); sb.AppendFormat(@"<a href=""method:Extract($3,{0})"" style=""color:black;"" target=""_blank"">{1}</a>", r.ID, idDatas); sb.AppendFormat(@" <a href=""method:Extract($5,)"" style=""color:black;"" target=""_blank""></a> </dt><dd>{0}<br><br></dd>", sentence); sb.AppendLine(); return(sb.ToString()); }
/// <summary> /// レスの変換を行います /// </summary> /// <param name="r">変換するレス</param> /// <param name="idData">レスに関連付けられたIDデータ</param> /// <param name="rs">元のRes</param> /// <returns>変換したString</returns> protected override string SimpleConvertCore(Res r, Dictionary <string, int[]> idData, out Res rs) { rs = r; if (!r.Visible) { return(""); } StringBuilder sb = new StringBuilder(); string id = r.ID; //string data = idData[id][0].ToString() + "/" + idData[id][1].ToString(); string idString = this.ColoringId(id, idData); //if (idData[id][1] > 4) //{ // //idString = "<span style='color:#00F; text-decoration:underline;'>" + idData + "</span>" + " [" + ((int[])id[idData])[0] + "/" + ((int[])id[idData])[1] + "]"; // idString = String.Format(@"<a href=""method:Extract($3,{0})"" style=""color:red;"" target=""_blank"">{0}</a>({1})", id, data); //} //else if ((idData[id])[1] > 1) //{ // // idString = "<span style='color:#F00; text-decoration:underline;'>" + idData + "</span>" + " [" + ((int[])id[idData])[0] + "/" + ((int[])id[idData])[1] + "]"; // idString = String.Format(@"<a href=""method:Extract($3,{0})"" style=""color:blue;"" target=""_blank"">{0}</a>({1})", id, data); //} //else if ((idData[id])[1] == 1) //{ // // idString = "<span style='color:#000; text-decoration:underline;'>" + idData + "</span>" + " [" + ((int[])id[idData])[0] + "/" + ((int[])id[idData])[1] + "]"; // idString = String.Format(@"<a href=""method:Extract($3,{0})"" style=""color:black;"" target=""_blank"">{0}</a>({1})", id, data); //} //else //{ // idString = "<span style='color:#000; text-decoration:underline;'>" + id + "</span>"; //} string sentence = Regex.Replace(r.Sentence, @"<a\s+.*?>", ""); sentence = sentence.Replace("</a>", ""); sentence = SU.Linking(sentence); sentence = rs.Sentence = Regex.Replace(sentence, @">>(?<res>\d+)", (m) => { return("<a href=\"#\">>>" + m.Groups["res"].Value + "</a>"); }); //<a +.*?>(.*?)</a> string idDatas = String.Empty; idDatas = r.ID + "(" + idData[r.ID][0].ToString() + "/" + idData[r.ID][1].ToString() + ")"; sb.Append(this.ResSkin); //<b><a href=""menu:{0}"" name=""{0}"" target=""_blank"">{0}</a></b> string idx = r.Index.ToString(); sb.Replace("<PLAINNUMBER/>", @"<a href=""menu:" + idx + @""" name=""" + idx + @""" target=""_blank"">" + idx + "</a>"); sb.Replace("<NUMBER/>", @"<a href=""menu:" + idx + @""" name=""" + idx + @""" target=""_blank"">" + idx + "</a>"); sb.Replace("<MAILNAME/>", r.Mail); sb.Replace("<SKINPATH/>", this.SkinPath); sb.Replace("<ID/>", idString); sb.Replace("<BE/>", r.BE); sb.Replace("<NAME/>", r.Name); sb.Replace("<MAIL/>", r.Mail); sb.Replace("<DATE/>", r.Date); sb.Replace("<DATEONLY/>", r.Date); sb.Replace("<MESSAGE/>", sentence); return(sb.ToString()); }