Ejemplo n.º 1
0
        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];
        }
Ejemplo n.º 2
0
 public TsukumijimaJikkyoApiChatCollectService(
     ChatCollectServiceEntry.IChatCollectServiceEntry serviceEntry,
     NiconicoUtils.JkIdResolver jkIdResolver
     ) : base(TimeSpan.FromSeconds(10))
 {
     this.ServiceEntry = serviceEntry;
     this.jkIdResolver = jkIdResolver;
 }
 public TsukumijimaJikkyoApiChatCollectServiceEntry(
     ChatService.IChatService chatService,
     NiconicoUtils.JkIdResolver jkIdResolver
     )
 {
     this.Owner        = chatService;
     this.jkIdResolver = jkIdResolver;
 }
Ejemplo n.º 4
0
        public NiconicoLogChatCollectService(ChatCollectServiceEntry.IChatCollectServiceEntry serviceEntry, NiconicoUtils.JkIdResolver jkIdResolver, NiconicoUtils.NiconicoLoginSession session) : base(new TimeSpan(0, 0, 10))
        {
            this.ServiceEntry = serviceEntry;
            this.jkIdResolver = jkIdResolver;
            this.session      = session;

            var handler = new HttpClientHandler();

            client = new HttpClient(handler);
            handler.CookieContainer.Add(session.Cookie);
        }
        public NiconicoChatCollectService(ChatCollectServiceEntry.IChatCollectServiceEntry serviceEntry, NiconicoUtils.JkIdResolver jkIdResolver, NiconicoUtils.NiconicoLoginSession session)
        {
            ServiceEntry      = serviceEntry;
            this.jkIdResolver = jkIdResolver;

            if (session != null)
            {
                var handler = new HttpClientHandler();
                handler.CookieContainer.Add(session.Cookie);
                httpClient = new HttpClient(handler);
                CanPost    = true;
            }
            else
            {
                httpClient = new HttpClient();
                CanPost    = false;
            }
            httpClient.BaseAddress = new Uri("http://jk.nicovideo.jp");
        }
 public NiconicoChatCollectServiceEntry(ChatService.NiconicoChatService owner, NiconicoUtils.JkIdResolver jkIdResolver, ObservableValue <NiconicoUtils.NiconicoLoginSession> session)
 {
     this.Owner        = owner;
     this.jkIdResolver = jkIdResolver;
     this.session      = session;
 }