Beispiel #1
0
        private void ChatMessageEvetRiser()
        {
            Task.Factory.StartNew(async() =>
            {
                if (_FFChatMessageArrived.HandlersCount == 0)
                {
                    SpinWait.SpinUntil(() => _FFChatMessageArrived.HandlersCount > 0);
                }

                while (_KeepWorking)
                {
                    try
                    {
                        FFChatMsg ffChatMsg = new FFChatMsg();
                        if (_FFxivChat.TryDequeue(out ffChatMsg))
                        {
                            var ea = new ChatMessageArrivedEventArgs(this)
                            {
                                ChatMessage = ffChatMsg
                            };

                            await _FFChatMessageArrived.InvokeAsync(ea);
                        }
                        else
                        {
                            SpinWait.SpinUntil(() => _FFxivChat.IsEmpty == false && _KeepWorking == true);
                        }
                    }
                    catch (Exception e)
                    {
                        Logger.WriteLog(e);
                    }
                }
            }, TaskCreationOptions.LongRunning);
        }
Beispiel #2
0
        private void ProcessChatMsg(ChatLogItem chatLogItem)
        {
            var tmpMsg = new FFChatMsg(chatLogItem.Line, chatLogItem.Code, chatLogItem.TimeStamp);

            _FFxivChat.Enqueue(tmpMsg);
        }
Beispiel #3
0
 public FFChatMsg(FFChatMsg msg)
 {
     Text      = msg.Text;
     Code      = msg.Code;
     TimeStamp = msg.TimeStamp;
 }