public NewNiconicoJikkyouChatCollectService( ChatCollectServiceEntry.IChatCollectServiceEntry serviceEntry, NiconicoUtils.LiveIdResolver liveIdResolver, NiconicoUtils.NiconicoLoginSession niconicoLoginSession ) { this.ServiceEntry = serviceEntry; this.liveIdResolver = liveIdResolver; var assembly = Assembly.GetExecutingAssembly().GetName(); var ua = assembly.Name + "/" + assembly.Version.ToString(3); var handler = new HttpClientHandler(); handler.CookieContainer.Add(niconicoLoginSession.Cookie); this.httpClient = new HttpClient(handler); this.httpClient.DefaultRequestHeaders.TryAddWithoutValidation("User-Agent", ua); this.commentReceiver = new NiconicoUtils.NicoLiveCommentReceiver(niconicoLoginSession); this.commentSender = new NiconicoUtils.NicoLiveCommentSender(niconicoLoginSession); }
public NiconicoLiveChatCollectService( ChatCollectServiceEntry.IChatCollectServiceEntry serviceEntry, string liveId, NiconicoUtils.NiconicoLoginSession session ) { this.ServiceEntry = serviceEntry; this.originalLiveId = liveId; var assembly = Assembly.GetExecutingAssembly().GetName(); var ua = assembly.Name + "/" + assembly.Version.ToString(3); var handler = new HttpClientHandler(); handler.CookieContainer.Add(session.Cookie); this.httpClient = new HttpClient(handler); this.httpClient.DefaultRequestHeaders.TryAddWithoutValidation("User-Agent", ua); this.commentReceiver = new NiconicoUtils.NicoLiveCommentReceiver(session); this.commentSender = new NiconicoUtils.NicoLiveCommentSender(session); this.chatCollectTask = this.collectChat(this.cancel.Token); }