public ActionResult ChangeStatusChat(int chatlogId) { ChatLog chatLog = _chatLogic.GetSingleChatLog(chatlogId); chatLog.Status = !chatLog.Status; _chatLogic.ChangeChatStatus(chatLog); _appointmentLogic.DeleteAppointmentByChat(chatlogId); return(RedirectToAction("ChatOverview")); }
public void AddRemoteLog(string remoteLog) { DebugLog("Adding remote log..."); var localClient = GeneralUtilities.localClient(); if (localClient == null) { DebugLog("No local client. Clearing logs and setting logs directly."); Clear(); AddPublic(remoteLog); ChatLog.SetLog(remoteLog); G.Sys.GameManager_.StartCoroutine(RemoveEventListenersCoroutine()); return; } DebugLog("Adding logs from the server:"); string[] remoteLogArray = System.Text.RegularExpressions.Regex.Split(remoteLog, $"\r\n|\n|\r"); var localNetworkPlayer = localClient.NetworkPlayer_; var personalBuffer = GetPersonalBuffer(localNetworkPlayer); DebugLog($"\nPublic log:\n{GetBufferString(publicChatBuffer)}"); DebugLog($"\nPersonal log:\n{GetBufferString(personalBuffer)}"); DebugLog($"\nRemote log:\n{remoteLog}"); List <DiffLine> publicDiff = DiffLine.GetDiffLines(publicChatBuffer); DiffLine.ExecuteDiff(publicDiff, remoteLogArray); string publicLog = DiffLine.DiffLinesToString(publicDiff); DebugLog($"\nPublic diff:\n{DiffLine.DiffLinesToStringInfo(publicDiff)}"); List <DiffLine> personalDiff = publicDiff; DiffLine.ExecuteDiff(personalDiff, personalBuffer, DiffLine.DiffOptions.AddFirst); string personalLog = DiffLine.DiffLinesToString(personalDiff); publicChatBuffer.Clear(); AddPublicNoPersonal(publicLog); personalBuffer.Clear(); AddPersonalNoAddLocal(localNetworkPlayer, personalLog); DebugLog($"\nFinal diff:\n{DiffLine.DiffLinesToStringInfo(personalDiff)}"); ChatLog.SetLog(personalLog); foreach (var chatInput in PrivateUtilities.getComponents <ChatInputV2>()) { PrivateUtilities.callPrivateMethod(chatInput, "OnEventSetServerChat", new SetServerChat.Data(personalLog)); } }
public ActionResult Index([Bind(Include = "ChatContent")] ChatLog chatLog) { if (ModelState.IsValid) { chatLog.UserId = UserId; chatLog.UserName = UserName; chatLog.UserType = UserType; chatLog.ChatTime = DateTime.Now; db.ChatLogs.Add(chatLog); db.SaveChanges(); } return(RedirectToAction(nameof(Index))); }
public async Task <ActionResult> Create([Bind(Include = "Id,UserId,UserName,ChatContent,ChatTime,UserType")] ChatLog chatLog) { if (ModelState.IsValid) { db.ChatLogs.Add(chatLog); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewBag.UserId = new SelectList(db.Users, "Id", "UserLabel", chatLog.UserId); return(View(chatLog)); }
public ChatLog Crear(ChatLog model) { var output = new ChatLog(); try { //using (var oCnn = Cn.OracleCn()) //{ // OracleCommand oCmd = null; // oCnn.Open(); // oCmd = new OracleCommand("SP_CREARCHATLOG", oCnn) // { // CommandType = CommandType.StoredProcedure // }; // oCmd.Parameters.Add(new OracleParameter("pIdCanalAtencion", OracleDbType.Int32)).Value = idCanalAtencion; // oCmd.Parameters.Add(new OracleParameter("pIdAlumno", OracleDbType.Int64)).Value = idAlumno; // oCmd.Parameters.Add(new OracleParameter("pIdCurso", OracleDbType.Int64)).Value = idCurso; // oCmd.Parameters.Add(new OracleParameter("pIdSesion", OracleDbType.Int64)).Value = idSesion; // oCmd.Parameters.Add(new OracleParameter("pConsulta", OracleDbType.Varchar2)).Value = consulta; // oCmd.Parameters.Add(new OracleParameter("pUsuario", OracleDbType.Varchar2)).Value = usuario; // oCmd.Parameters.Add(new OracleParameter("P_RC", OracleDbType.RefCursor)).Direction = ParameterDirection.Output; // OracleDataReader rd = oCmd.ExecuteReader(); // if (rd.HasRows) // { // while (rd.Read()) // { // output = new ChatLog // { // IdSolicitud = rd.GetInt64(rd.GetOrdinal("IDSOLICITUD")), // IdAlumno = rd.GetInt64(rd.GetOrdinal("IDALUMNO")), // IdCurso = rd.GetInt32(rd.GetOrdinal("IDCURSO")), // Consulta = rd.GetValue(rd.GetOrdinal("CONSULTA")) == DBNull.Value ? string.Empty : rd.GetString(rd.GetOrdinal("CONSULTA")), // FechaRegistro = rd.GetDateTime(rd.GetOrdinal("FECHAREGISTRO")) // }; // } // } //} } catch (Exception ex) { Console.WriteLine(ex.Message); } return(output); }
/// <summary> /// 离开聊天室 /// </summary> public void LeftChat(string userID, bool keepAlive) { if (this.RoomID == null && this.Room != null) { this.RoomID = this.Room.RoomID; } RequestReleaseParty leftMessage = null; try { leftMessage = RequestReleaseParty.Create(this.RoomID); } catch (Exception ex) { ChatLog.GetInstance().LogException(ex); } if (leftMessage == null) { return; } leftMessage.UserId = userID; ChatParty party = this.Room.GetUser(userID); if (party != null) { try { if (keepAlive) { leftMessage.MessageText = MessageText.Create(string.Format("[{0}] 已经离开。", party.DisplayName)); } else { leftMessage.MessageText = MessageText.Create("亲,网络不给力,您与攻城狮失联了!"); } } catch (Exception ex) { ChatLog.GetInstance().LogException(ex); } if (party.UserType == UserType.Agent) { leftMessage.AfterAction = Genesyslab.Platform.WebMedia.Protocols.BasicChat.Action.CloseIfNoAgents; if (keepAlive) { leftMessage.AfterAction = Genesyslab.Platform.WebMedia.Protocols.BasicChat.Action.KeepAlive; } } } this.SendMessage(userID, leftMessage); }
public void GetByID_OneItem_ReturnsChatLog() { // Arrange var id = Guid.NewGuid(); ChatLog entity = new ChatLog { ID = id }; // Act MessageHub.Instance.Publish(new OnCacheObjectSet <ChatLog>(entity)); // Assert Assert.AreNotSame(entity, _cache.GetByID(id)); }
void ClientJoinRoom(string roomName, string clientName) { if (!RoomExistsByName(roomName)) { ChatLog.Error("Room " + roomName + " does not exists"); return; } var room = RoomFromName(roomName); room.Members.Add(clientName); //todo: send client joined }
public static void ScheduleDynamicBackup() { if (Debugger.IsAttached) { return; } YiScheduler.Instance.Do(TimeSpan.FromMinutes(DynamicBackupFrequency), async() => { await Db.SaveAsJsonAsync(SaveType.Dynamic); await ChatLog.Save(); ScheduleDynamicBackup(); CompactLoh(); }); }
protected void Page_Load(object sender, EventArgs e) { string currentScript = Request["script"]; string currentMessage = Request["message"]; using (ChatDBContainer context = new ChatDBContainer()) { switch (currentScript) { case "postmessage": var msg2 = new ChatLog(); msg2.ChatMessage = currentMessage; msg2.Createdate = System.DateTime.Now; msg2.ToUserName = ""; msg2.FromUserName = ""; context.AddObject("ChatLogSet", msg2); context.SaveChanges(); outPut.InnerHtml = msg2.ChatMessage + "<br />"; break; case "refresh": var Messages = from a in context.ChatLogSet orderby a.Createdate select a; outPut.InnerHtml = ""; foreach (ChatLog msg1 in Messages) { outPut.InnerHtml += msg1.ChatMessage + "<br />"; } break; case "clear": foreach (ChatLog msg1 in context.ChatLogSet) { context.DeleteObject(msg1); } context.SaveChanges(); outPut.InnerHtml = ""; break; default: outPut.InnerHtml = ""; break; } } }
public void Init(ChatLog c) { PlayerInfo friend = ChatModel.Instance.ChatTarget; Text content = transform.Find("Content").Find("Text").GetComponent <Text>(); content.text = c.Content; Transform headTr = transform.Find("Head"); Image Head = headTr.GetComponent <Image>(); if (c.SendPlayer == 2) { headTr.localPosition = new Vector3(-147, 0, 0); Head.rectTransform.sizeDelta = new Vector2(48, 48); AsyncImageDownload.Instance.SetAsyncImage(friend.HeaderIcon, Head); Head.color = Color.white; } else if (c.SendPlayer == 1) { Head.rectTransform.sizeDelta = new Vector2(48, 48); AsyncImageDownload.Instance.SetAsyncImage(LoginModel.Instance.Head, Head); Head.color = Color.white; } //else if (c.SendPlayer == 3) //{ // transform.Find("Content").GetComponent<Image>().color = new Color(1,1,1,0); // content.fontSize = 20; // content.color = Color.gray; // content.alignment = TextAnchor.MiddleCenter; //} transform.Find("Time").GetComponent <Text>().text = c.sendTime; transform.Find("Content").Find("Text").GetComponent <ContentSizeFitter>().SetLayoutVertical(); RectTransform r = transform.Find("Content").GetComponent <RectTransform>(); ContentSizeFitter con = transform.Find("Content").GetComponent <ContentSizeFitter>(); con.SetLayoutVertical(); LayoutRebuilder.ForceRebuildLayoutImmediate(r); float _h = LayoutUtility.GetPreferredSize(r, 1); float h = transform.Find("Content").GetComponent <RectTransform>().sizeDelta.y; float w = transform.GetComponent <RectTransform>().sizeDelta.x; //Debug.Log(transform.GetComponent<RectTransform>().sizeDelta+"..."+w+"..."+_h); Vector2 v = transform.GetComponent <RectTransform>().sizeDelta; if (h > v.y) { transform.GetComponent <RectTransform>().sizeDelta = new Vector2(w, h); } }
void ReceiveServerClosed(Packet packet, object arg) { var p = PacketUtilities.GetProtocolObject <ProtocolObject.ServerClosed>(packet); if (logEnabled) { ChatLog.Info("Server disconnected -> " + p.message); } if (onServerClosed != null) { scheduler.Schedule(() => onServerClosed.Invoke(p)); } }
/// <summary> /// 重载基类方法,删除传入的CacheItem /// </summary> /// <param name="cacheItem">缓存队列对象</param> public void RemoveItem(string key, TValue data) { List <TValue> dataList = null; try { this.TryGetValue(key, out dataList); dataList.Remove(data); } catch (Exception ex) { ChatLog.GetInstance().LogException(ex); } }
/// <summary> /// Sends ASK message through the tcp layer /// </summary> public void AskForConnectedUsers() { if (!tcpLayer.Connected) { ChatLog.Info("CLIENT NOT CONNECTED"); return; } var bytes = PacketUtilities.Build(new ProtocolObject.AskAllConnected() { }); tcpLayer.Send(bytes); }
private async Task ExportChatLogAsync(ChatLog chatLog, string filePath, ExportFormat format) { // Create output directory var dirPath = Path.GetDirectoryName(filePath); if (!dirPath.IsNullOrWhiteSpace()) { Directory.CreateDirectory(dirPath); } // Render chat log to output file using (var writer = File.CreateText(filePath)) await CreateRenderer(chatLog, format).RenderAsync(writer); }
// GET: Admin/ChatLogManage/Details/5 public async Task <ActionResult> Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ChatLog chatLog = await db.ChatLogs.FindAsync(id); if (chatLog == null) { return(HttpNotFound()); } return(View(chatLog)); }
/// <summary> /// 通过key,删除一Cache项 /// </summary> /// <param name="key">缓存唯一标识</param> public void Remove(string key) { try { lock (this.innerDictionary) { this.innerDictionary.Remove(key); } } catch (Exception ex) { ChatLog.GetInstance().LogException(ex); } }
public override void WarnIfNecessary(ChatLog chat) { if (!isIntelRenderer) { return; } chat.Add("&cIntel graphics cards are known to have issues with the OpenGL build."); chat.Add("&cVSync may not work, and you may see disappearing clouds and map edges."); chat.Add(" "); chat.Add("&cFor Windows, try downloading the Direct3D 9 build as it doesn't have"); chat.Add("&cthese problems. Alternatively, the disappearing graphics can be"); chat.Add("&cpartially fixed by typing \"/client render legacy\" into chat."); }
private void ProcessEvents() { try { ThreadMonitoring.Register(1, (this.thread.Name.Length < 0x40) ? this.thread.Name : ("..." + this.thread.Name.Substring(this.thread.Name.Length - 60))); } catch (Exception ex) { this.active = false; ChatLog.GetInstance().LogException(ex); } while (this.active) { try { ThreadMonitoring.Heartbeat(); object obj2 = this.eventQueue.Dequeue(500); if (obj2 is ThreadingUtility.DelegateTask) { ThreadingUtility.DelegateTask task = (ThreadingUtility.DelegateTask)obj2; task.D.DynamicInvoke(task.Args); } else if (obj2 is ThreadingUtility.EventHandlerTask) { ThreadingUtility.EventHandlerTask task2 = (ThreadingUtility.EventHandlerTask)obj2; task2.Handler(task2.Sender, task2.Args); } else if (obj2 is WaitCallbackTask) { WaitCallbackTask task3 = (WaitCallbackTask)obj2; task3.callback(task3.state); } continue; } catch (ThreadAbortException) { break; } catch (Exception exception) { if (base.Logger.IsDebugEnabled) { base.Logger.Debug("Exception in SingleThreadInvoker.ProcessEvents", exception); } continue; } } ThreadMonitoring.Unregister(); }
/// <summary> /// 更新用户信息 /// </summary> protected void InitRoom() { ChatRoom room = ChatRoomCache.GetInstance().GetRoom(this.TicketID, this.SessionID); if (room == null) { room = new ChatRoom(this.TicketID, this.SessionID, this.RoomID); ChatRoomCache.GetInstance().AddRoom(room); } // 日志 if (!string.IsNullOrEmpty(this.RoomID)) { ChatLog.GetInstance().FormatMessage("SessionID:{0},RoomID:{1}", this.SessionID, this.RoomID); } }
// GET: Admin/ChatLogManage/Edit/5 public async Task <ActionResult> Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ChatLog chatLog = await db.ChatLogs.FindAsync(id); if (chatLog == null) { return(HttpNotFound()); } ViewBag.UserId = new SelectList(db.Users, "Id", "UserLabel", chatLog.UserId); return(View(chatLog)); }
/// <summary> /// Send the close room request, if success the room will be closed and all clients kicked out (can /// </summary> /// <param name="roomName"></param> public void CloseRoom(string roomName) { if (!tcpLayer.Connected) { ChatLog.Info("CLIENT NOT CONNECTED"); return; } var bytes = PacketUtilities.Build(new ProtocolObject.CloseRoom() { roomName = roomName, }); tcpLayer.Send(bytes); }
/// <summary> /// Sends QUIT message through the tcp layer /// </summary> public void Quit() { if (!tcpLayer.Connected) { ChatLog.Info("CLIENT NOT CONNECTED"); return; } var bytes = PacketUtilities.Build(new ProtocolObject.Quit() { name = clientName }); tcpLayer.Send(bytes); }
void AskAllConnectedReceived(Packet receivedPacket, ChatClientData client) { var packet = PacketUtilities.GetProtocolObject <ProtocolObject.Join>(receivedPacket); if (!client.HasJoined) { ChatLog.Info("-- Rejected MESSAGE command by a not joined client -> " + client.Socket.RemoteEndPoint.ToString()); return; } client.Socket.Send(PacketUtilities.Build(new ProtocolObject.GetAllConnected() { names = (from c in clientsConnected where c.Name != client.Name && c.Name != "" select c.Name).ToArray() //empty names are not joined })); }
public void ExportChatLog(ChatLog chatLog, string filePath, ExportFormat format, int?partitionLimit = null) { // If partitioning is disabled or there are fewer messages in chat log than the limit - process it without partitioning if (partitionLimit == null || partitionLimit <= 0 || chatLog.Messages.Count <= partitionLimit) { ExportChatLogSingle(chatLog, filePath, format); } // Otherwise split into partitions and export separately else { var partitions = SplitIntoPartitions(chatLog, partitionLimit.Value); ExportChatLogPartitioned(partitions, filePath, format); } }
public List <ChatLog> GetAllOpenChatsWithCareRecipientId(int userid) { List <ChatLog> chatLogList = new List <ChatLog>(); try { SqlCommand cmd = new SqlCommand("GetAllChatsByCareRecipientID", _conn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@userid", SqlDbType.Int).Value = userid; _conn.Open(); DataTable dt = new DataTable(); dt.Load(cmd.ExecuteReader()); foreach (DataRow dr in dt.Rows) { int chatLogId = Convert.ToInt32(dr["ChatLogID"]); string questionTitle = (dr["Title"].ToString()); int careRecipientId = Convert.ToInt32(dr["CareRecipientID"]); int volunteerId = Convert.ToInt32(dr["VolunteerID"]); string careRecipientName = dr["CareRecipientFirstName"].ToString() + dr["CareRecipientLastName"].ToString(); int questionId = Convert.ToInt32(dr["QuestionID"]); string statusstring = dr["Status"].ToString(); bool status = statusstring != "False"; string volunteerName = dr["VolunteerFirstName"].ToString() + dr["VolunteerLastName"].ToString(); DateTime timeStamp = Convert.ToDateTime(dr["TimeStamp"].ToString()); ChatLog chatLog = new ChatLog(chatLogId, questionTitle, careRecipientId, volunteerId, careRecipientName, volunteerName, timeStamp, questionId, status); chatLogList.Add(chatLog); } return(chatLogList); } catch (Exception) { return(null); } finally { _conn.Close(); } }
private void ChatTimer_Tick(object sender, EventArgs e) { string ChatLog; if (string.IsNullOrEmpty(ChatLog = GetChannelChat())) { isPassed = false; if (AutoClose.Checked) { WindowsCloseTimer.Enabled = true; } return; } if (isPassed || string.IsNullOrEmpty(ChatLog) || ChatLog == "\0") { return; } if (!Visible) { Visible = true; } string[] lines = ChatLog.Split(new char[] { '\n' }, StringSplitOptions.RemoveEmptyEntries); if (lines.Length == 0) { return; } string TimeLine = $"|CFFFFFFFF({DateTime.Now:hh:mm:ss})|R "; ChatLog = string.Empty; for (int i = 0; i < lines.Length; i++) { if (i != 0) { ChatLog += '\n'; } ChatLog += TimeLine + lines[i]; } SetRTBText(ref richTextBox, ChatLog); richTextBox.AppendText("\n"); if (WindowsCloseTimer.Enabled) { WindowsCloseTimer.Enabled = false; Text = Title.Text = "접속 중 - " + GetChannelName(); } }
/// <summary> /// 标记聊天结束 /// </summary> /// <param name="openid">用户的openid</param> /// <returns></returns> public static ChatLog FinishChatting(string openid) { var db = new ModelContext(); ChatLog cl = db.ChatLogSet.OrderByDescending(item => item.StartDate).FirstOrDefault(item => item.Openid == openid); if (cl == null) { return(null); } cl.EndDate = DateTime.Now; cl.Status = ChatStatus.Finish; db.SaveChanges(); return(cl); }
void ReceiveRoomCreated(Packet packet, object arg) { var p = PacketUtilities.GetProtocolObject <ProtocolObject.RoomCreated>(packet); if (logEnabled) { ChatLog.Info("Room created success? -> " + p.success + " --- Room name -> " + p.roomName + " --- Room host -> " + p.roomHost); ChatLog.Info("message -> " + p.message); } if (p.success) { JoinedRooms.Add(p.roomName, new ChatRoom(false, p.roomName, p.roomHost)); } //todo implement callback }
public void Execute(string interactionId, string messageText) { try { RequestJoin reqJoin = RequestJoin.Create(interactionId, Visibility.All, MessageText.Create(messageText)); BaseAction action = new ChatJoinAction(Protocol); action.Request = reqJoin; base.CloneSubscription(ref action); action.Execute(); } catch (Exception ex) { ChatLog.GetInstance().LogException(ex); } }
/// <summary> /// 加入聊天 /// </summary> /// <param name="interactionID"></param> public void ChatJoin(string interactionID, string title) { ChatLog.GetInstance().FormatMessage("RequestChat请求。连接状态:{2} TicketID:{0} SessionID:{1}" , this.TicketID, this.SessionID, this.IsAvailableConnection ? "可用" : "不可用"); if (string.IsNullOrEmpty(title)) { title = "工程师"; } string message = string.Format("{0} [{1}] 为您服务。", title, this.Agent.ChatProtocol.UserNickname); if (this.IsAvailableConnection) { this.ChatJoin(interactionID, this.UserID, message); } }