/// <summary> /// コメントを取得する(エントリー・ポイント) /// </summary> /// <returns></returns> public async Task <List <ComApi.CommentBody.Json.JsonComment> > GetComment(WatchPage::BaseJson data, NicoContext context, bool kako = false) { var logger = NicoLogger.GetLogger(); logger.Debug($"過去ログ: {kako}", moduleName); //threadkeyを取得 (crInfo.Threadkey, crInfo.Force184) = await GetThreadKey(data.video.dmcInfo.thread.thread_id.ToString(), context); //最古コメントを取得 logger.Log("現行コメントをダウンロード中..."); var comments = new CommentList(); comments.Add(await GetCommentData(data)); ComApi::CommentBody.Json.Chat firstComment = comments.GetFirstComment(); if (kako) { crInfo.WayBackKey = await GetWayBackKey(data.video.dmcInfo.thread.thread_id, context); //初期whenデータを作成 int _when = comments.GetFirstComment().date; int i = 1; do { var kacomments = new CommentList(); logger.Log($"過去ログをダウンロード中...({i}件目、no.{firstComment.no}まで取得完了)"); kacomments.Add(await GetCommentData(data, _when)); try { firstComment = kacomments.GetFirstComment(); } catch { break; } _when = firstComment.GetPrevDate(); comments.Merge(kacomments); ++i; if (comments.IsMax(i)) { break; } }while (firstComment.no > 1); } logger.Log("ダウンロードしたコメントの整合性をチェックしています。"); comments.FormatComments(); return(comments.Comments); }
/// <summary> /// 合成する /// </summary> /// <param name="list"></param> public void Merge(CommentList list) { this.Add(list.Comments); }