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; }
private void FindAndWriteDrafts(JaneScript js, DatOut datout, bool readDraftContents) { datout.WriteText("草稿を検索しています。"); datout.WriteBR(); datout.WriteHTML("<hr>"); using (CategoryList cl = js.CategoryList()) using (DisposableList<Category> categories = new DisposableList<Category>(cl)) { foreach (Category category in categories) { DirectoryInfo diCate = new DirectoryInfo(category.LogDir); if (!diCate.Exists) continue; using (DisposableList<Board> boards = new DisposableList<Board>(category)) { foreach(Board board in boards){ board.Load(); // カテゴリディレクトリの草稿を探す FileInfo fi = new FileInfo(Path.Combine(category.LogDir, board.Name + "NewThread.mns")); if (fi.Exists) this.OutDraft(datout, category, board, fi, readDraftContents); // 板ディレクトリ内を探す DirectoryInfo di = new DirectoryInfo(board.LogDir); if (!di.Exists) continue; foreach (FileInfo fi2 in di.GetFiles("*.mns")) { if (fi2.Name == "NewThread.mns") { this.OutDraft(datout, category, board, fi2, readDraftContents); } else { using (ThreadItem thread = board.FindThread(Path.GetFileNameWithoutExtension(fi2.Name))) { this.OutDraft(datout, category, board, thread, fi2, readDraftContents); } } } js.ProcessMessages(); } } js.ProcessMessages(); } } datout.WriteBR(); datout.WriteHTML("<hr>"); datout.WriteText("検索が終了しました。"); }