public NiconicoChatService( NiconicoChatServiceSettings settings, ChannelDatabase channelDatabase, string jikkyouIdTableFilePath, string liveIdTableFilePath ) { this.settings = settings; this.jkIdResolver = new NiconicoUtils.JkIdResolver(channelDatabase, new NiconicoUtils.JkIdTable(jikkyouIdTableFilePath)); this.liveIdResolver = new NiconicoUtils.LiveIdResolver(channelDatabase, new NiconicoUtils.LiveIdTable(liveIdTableFilePath)); try { if (!string.IsNullOrWhiteSpace(UserId) && !string.IsNullOrWhiteSpace(UserPassword)) { SetUser(UserId, UserPassword, NicoSid, Session, SessionSecure).Wait(); } } catch (AggregateException e) when(e.InnerExceptions.Count == 1 && e.InnerExceptions[0] is NiconicoUtils.NiconicoLoginSessionException) { } ChatCollectServiceEntries = new ChatCollectServiceEntry.IChatCollectServiceEntry[] { new ChatCollectServiceEntry.NewNiconicoJikkyouChatCollectServiceEntry(this, this.liveIdResolver, this.loginSession), new ChatCollectServiceEntry.NiconicoLiveChatCollectServiceEntry(this, this.loginSession), new ChatCollectServiceEntry.TsukumijimaJikkyoApiChatCollectServiceEntry(this, this.jkIdResolver), }; ChatTrendServiceEntries = new IChatTrendServiceEntry[0]; }
public NewNiconicoJikkyouChatCollectServiceEntry( ChatService.NiconicoChatService owner, NiconicoUtils.LiveIdResolver liveIdResolver, ObservableValue <NiconicoUtils.NiconicoLoginSession> session ) { this.Owner = owner; this.liveIdResolver = liveIdResolver; this.session = session; }
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); }