private async Task OnFFChatMessageArrived(ChatMessageArrivedEventArgs ea) { bool logged = false; ChatMsgType msgType = new ChatMsgType(); if (_ChatCodesTypes != null) { if (_ChatCodesTypes.TryGetValue(ea.ChatMessage.Code, out msgType)) { if (!MsgBlackList.Contains(ea.ChatMessage.Text)) { await ProcessChatMsg(ea.ChatMessage, msgType); } if (CmdArgsStatus.LogPlotChat) { Logger.WriteChatLog(String.Format("{0} {1}: {2}", ea.ChatMessage.TimeStamp, ea.ChatMessage.Code, ea.ChatMessage.Text)); logged = true; } } if (CmdArgsStatus.LogAllChat && !logged) { Logger.WriteChatLog(String.Format("{0} {1}: {2}", ea.ChatMessage.TimeStamp, ea.ChatMessage.Code, ea.ChatMessage.Text)); } } }
public ChatMsgType(ChatMsgType chatMsgType) { ChatCode = chatMsgType.ChatCode; MsgType = chatMsgType.MsgType; Name = chatMsgType.Name; Color = chatMsgType.Color; }
private async Task ProcessChatMsg(FFChatMsg msg, ChatMsgType msgType) { switch (msgType.MsgType) { case MsgType.Translate: { var translation = await TranslateMessage(msg.Text, msgType.Color); await _TranslationArrived.InvokeAsync(translation); break; } default: { return; } } }