private void DoFindId(JaneScript js, ThreadItem thread, string id) { using (Board board = thread.Board) { board.Load(); List<IdMatchInfo> matches = this.GetIdMatches(js, board, id); this.OutputMatches(js, board, id, matches); } }
private List<ResRefInfo> GetResRefInfos(ThreadItem thread) { int lines = thread.Lines; var ret = new List<ResRefInfo>(lines); using (ReferredList rl = thread.GetReferredList()) { for (int i = 1; i <= lines; i++) { ret.Add(new ResRefInfo() { ResNumber = i, RefCount = rl.RefCount(i), }); } } return ret; }
private void DoTop10(JaneScript js, ThreadItem thread) { // レス数で降順ソートしてトップ10 var top = ( from rr in this.GetResRefInfos(thread) orderby rr.RefCount descending select rr) .Take(10).ToArray(); string shortTitle = "レス数トップ10"; string longTitle = "レス数トップ10: " + thread.Title; Util.WriteToNewView(js, shortTitle, longTitle, longTitle, false, false, (DatOut datout) => { for (int i = 0; i < top.Length; i++) { var rr = top[i]; datout.WriteText(string.Format("{0}位 {1}レス", i + 1, rr.RefCount)); datout.WriteBR(); datout.WriteThread(thread, rr.ResNumber, rr.ResNumber, AboneLevel.Futsuu); } }); }
private void DoGroupBy(JaneScript js, ThreadItem thread) { // レス数でグループ化して降順ソート var groups = from rr in this.GetResRefInfos(thread) group rr.ResNumber by rr.RefCount into g orderby g.Key descending select g; Uri threadUri = thread.URL; string shortTitle = "レス数でグループ化"; string longTitle = "レス数でグループ化: " + thread.Title; Util.WriteToNewView(js, shortTitle,longTitle, longTitle, false, false, (DatOut datout) => { foreach (var g in groups) { datout.WriteHTML(string.Format("<dt>{0} ({1})</dt>", g.Key, g.Count())); StringBuilder sb = new StringBuilder("<dd>"); foreach (var resNumber in g) { sb.AppendFormat("<a href=\"{0}{1}\">{1}</a> ", threadUri, resNumber); } sb.AppendLine("<br></dd>");//ddを閉じる前にbrを入れるとインデントする datout.WriteHTML(sb.ToString()); datout.Flush(); } }); }
public void WriteThread(ThreadItem Thread, int StartLine, int EndLine, AboneLevel AboneLevel) { base.InvokeMethod("WriteThread", Thread.ComObject, StartLine, EndLine, (int)AboneLevel); }
public void Open(ThreadItem Thread, int Number, OpenOperation Operation, bool NewTab, bool Relative, bool BackGround) { base.InvokeMethod("Open", Thread.ComObject, Number, (int)Operation, NewTab, Relative, BackGround); }
public void Close(ThreadItem Item) { base.InvokeMethod("Close", Item.ComObject); }
private void OutDraft(DatOut datout, Category category, Board board, ThreadItem thread, FileInfo fi, bool readDraftContents) { datout.WriteHTML(string.Format("<dt>{0} [<a href=\"{1}\">{2}</a>] <a href=\"{3}\">{4}</a></dt>", HttpUtility.HtmlEncode(category.Name), board.Url.AbsoluteUri, HttpUtility.HtmlEncode(board.Name), thread.URL.AbsoluteUri, HttpUtility.HtmlEncode(thread.Title))); if (readDraftContents) { this.DatOut(datout, fi); } datout.WriteBR(); }