Ejemplo n.º 1
0
 private void DatOut(DatOut datout, FileInfo fi)
 {
     using (Stream stream = fi.OpenRead())
     using (StreamReader reader = new StreamReader(stream, MiscWritePlugin.encShiftJis)) {
         StringBuilder sb = new StringBuilder("<dd>");
         string line;
         while (null != (line = reader.ReadLine())) {
             sb.Append(HttpUtility.HtmlEncode(line));
             sb.Append("<br>");
         }
         sb.Append("</dd>");
         datout.WriteHTML(sb.ToString());
     }
 }
Ejemplo n.º 2
0
 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("検索が終了しました。");
 }
Ejemplo n.º 3
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();
 }