private void Room_InitialCommentsReceived(object sender, List <IChat> e) { var chat = e; var roomProvider = sender as RoomCommentProvider; var roomInfo = roomProvider.RoomInfo; InitialCommentsReceived?.Invoke(this, new InitialChatsReceivedEventArgs { Chat = e, RoomInfo = roomInfo }); }
private void Socket_Received(object sender, List <string> e) { var list = e; if (!_isThreadReceived) { var threadStr = list[0]; var thread = new Thread(threadStr); //<thread resultcode="0" thread="1622377992" last_res="12" ticket="0x1f8f7b00" revision="1" server_time="1520078989"/> _isThreadReceived = true; if (thread.Resultcode == 0) { //ok TicketReceived?.Invoke(this, thread.Ticket); _retryCount = 0; list.RemoveAt(0); if (list.Count == 0) { return; } } else { Disconnect(); return; } } if (_isInitialCommentsBeingSent) { if (list.Count > 3) { InitialCommentsReceived?.Invoke(this, list.Select(s => new Chat(s)).Cast <IChat>().ToList()); return; } else { _isInitialCommentsBeingSent = false; } } foreach (var chatStr in list) { CommentReceived?.Invoke(this, chatStr); } }
private void Socket_Received(object sender, List <string> e) { var list = e; if (!_isThreadReceived) { var threadStr = list[0]; var thread = new Thread(threadStr); //<thread resultcode="0" thread="1622377992" last_res="12" ticket="0x1f8f7b00" revision="1" server_time="1520078989"/> _isThreadReceived = true; if (thread.Resultcode == 0) { //ok TicketReceived?.Invoke(this, thread.Ticket); _retryCount = 0; list.RemoveAt(0); if (list.Count == 0) { return; } } else { Disconnect(); return; } } if (_isInitialCommentsBeingSent) { if (list.Count > 3) { InitialCommentsReceived?.Invoke(this, list.Select(s => new Chat(s)).Cast <IChat>().ToList()); return; } else { _isInitialCommentsBeingSent = false; } } foreach (var chatStr in list) { if (chatStr.StartsWith("<chat ")) { var chat = new Chat(chatStr); CommentReceived?.Invoke(this, chat); } else if (chatStr.StartsWith("<chat_result ")) { Debug.WriteLine(chatStr); //<chat_result thread="1622396675" status="0" no="4"/> //status=0で成功、失敗の場合4を確認済み //status=1は連投規制? } else { //<leave_thread thread="1622163911" reason="2"/> #if DEBUG using (var sw = new System.IO.StreamWriter("nico_unknownData.txt", true)) { sw.WriteLine(chatStr); } #endif } } }