예제 #1
0
 private List<IdMatchInfo> GetIdMatches(JaneScript js, Board board, string id)
 {
     List<IdMatchInfo> matches = new List<IdMatchInfo>();
     using (DisposableList<ThreadItem> threads = Util.CreateThreadItemList(board)) {
         foreach (ThreadItem t in threads) {
             if (!t.DatExist) continue;
             int lines = t.Lines;
             // HACK 全取得スレッドをなめなくてもいいようにすべき
             // sinse や LastGot で事前に日付チェックを行ったり
             // バイナリサーチで日付の一致する範囲を事前に調べたり
             for (int i = 1; i <= lines; i++) {
                 using (ResItem res = t.GetRes(i)) {
                     if (res.Id == id) {
                         matches.Add(new IdMatchInfo() {
                             datName = t.DatName,
                             resNumber = i,
                             datetime = res.DateValue,
                         });
                     }
                 }
             }
             js.ProcessMessages();
         }
     }
     return matches;
 }
예제 #2
0
 private void OutputMatches(JaneScript js, Board board, string id, List<IdMatchInfo> matches)
 {
     string shortTitle = "ID検索";
     string longTitle = string.Format("ID検索: ID:{0} {1}", id, board.Name);
     Util.WriteToNewView(js, shortTitle, longTitle, longTitle, false, false, (DatOut datout) => {
         var q =
             from m in matches
             orderby m.datetime
             select m;
         foreach (var m in q) {
             using (ThreadItem t = board.FindThread(m.datName)) {
                 datout.WriteHTML(string.Format("<a href=\"{0}\">{1}</a><br>", t.URL, HttpUtility.HtmlEncode(t.Title)));
                 datout.WriteThread(t, m.resNumber, m.resNumber, AboneLevel.Futsuu);
             }
         }
         datout.WriteHTML("<br><hr><br>");
         datout.WriteText("スレごとのレス数は以下のとおりです。");
         datout.WriteBR();
         var boardGroups =
             from m in matches
             group m by m.datName into boardg
             orderby boardg.Count() descending
             select boardg;
         foreach (var bg in boardGroups) {
             using (ThreadItem t = board.FindThread(bg.Key)) {
                 datout.WriteHTML(string.Format("{0}レス: <a href=\"{1}\">{2}</a><br>", bg.Count(), t.URL, HttpUtility.HtmlEncode(t.Title)));
             }
         }
     });
 }
예제 #3
0
 public void Close(Board Item)
 {
     base.InvokeMethod("Close", Item.ComObject);
 }
예제 #4
0
 public void Open(Board Board, int Number, OpenOperation Operation, bool NewTab, bool Relative, bool BackGround)
 {
     base.InvokeMethod("Open", Board.ComObject, Number, (int)Operation, NewTab, Relative, BackGround);
 }
예제 #5
0
 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();
 }