예제 #1
0
        private void UpdateCache(string entryKey, ChatType chatType)
        {
            if (chatType.Channel != null)
            {
                if (!ChannelIndex.ContainsKey(entryKey))
                {
                    ChannelIndex.Add(entryKey, new Dictionary <string, byte>());
                }

                var channels = ChannelIndex[entryKey];
                if (!channels.ContainsKey(chatType.Channel))
                {
                    channels[chatType.Channel] = 1;
                    ChannelIndexUpdated        = true;
                }

                UpdateChannelCache(chatType.Channel);
            }

            AddPlayer(chatType.Sender);
            AddPlayer(chatType.Receiver);
        }
예제 #2
0
        internal bool PassFilter(ChatType chatType)
        {
            bool passed = false;

            if (ValidChannels == null || (chatType.Channel != null && ValidChannels.ContainsKey(chatType.Channel)))
            {
                string receiver       = chatType.Receiver == "You" ? Player : chatType.Receiver;
                string sender         = chatType.Sender == "You" ? Player : chatType.Sender;
                bool   receiverIsTo   = receiver != null && To != null && receiver.IndexOf(To, StringComparison.OrdinalIgnoreCase) > -1;
                bool   senderIsFrom   = sender != null && From != null && sender.IndexOf(From, StringComparison.OrdinalIgnoreCase) > -1;
                bool   receiverIsFrom = receiver != null && From != null && receiver.IndexOf(From, StringComparison.OrdinalIgnoreCase) > -1;
                bool   senderIsTo     = sender != null && To != null && sender.IndexOf(To, StringComparison.OrdinalIgnoreCase) > -1;

                if (((To == null || receiverIsTo) && (From == null || senderIsFrom)) || (senderIsTo && receiverIsFrom))
                {
                    if (!PlayerManager.Instance.IsVerifiedPet(chatType.Sender) && IsPossiblePlayerNameWithServer(chatType.Sender))
                    {
                        if (Keyword != null)
                        {
                            int afterSender = chatType.AfterSenderIndex >= 0 ? chatType.AfterSenderIndex : 0;
                            int foundIndex  = chatType.Line.IndexOf(Keyword, afterSender, StringComparison.OrdinalIgnoreCase);
                            if (foundIndex > -1)
                            {
                                passed = true;
                                chatType.KeywordStart = foundIndex;
                            }
                        }
                        else
                        {
                            passed = true;
                        }
                    }
                }
            }

            return(passed);
        }
예제 #3
0
        private void AddToArchive(string year, string month, string day, ChatLine chatLine, ChatType chatType, DateUtil dateUtil)
        {
            string entryKey   = day;
            string archiveKey = year + "-" + month;

            if (CurrentArchiveKey != archiveKey)
            {
                SaveCurrent(true);
                string fileName = GetFileName(year, month);
                var    mode     = File.Exists(fileName) ? ZipArchiveMode.Update : ZipArchiveMode.Create;

                CurrentArchive    = OpenArchive(fileName, mode);
                CurrentArchiveKey = archiveKey;
                LoadCache();
            }

            if (entryKey != CurrentEntryKey && CurrentArchive != null)
            {
                SaveCurrent(false);
                CurrentEntryKey = entryKey;
                CurrentList     = new List <ChatLine>();

                var entry = CurrentArchive.Mode != ZipArchiveMode.Create ? CurrentArchive.GetEntry(CurrentEntryKey) : null;
                if (entry != null)
                {
                    using (var reader = new StreamReader(entry.Open()))
                    {
                        List <string> temp = new List <string>();
                        while (reader.BaseStream.CanRead && !reader.EndOfStream)
                        {
                            temp.Insert(0, reader.ReadLine()); // reverse
                        }

                        // this is so the date precision numbers are calculated in the same order
                        // as the new lines being added
                        temp.ForEach(line =>
                        {
                            var existingLine = CreateLine(dateUtil, line);
                            if (existingLine != null)
                            {
                                CurrentList.Insert(0, existingLine); // reverse back
                            }
                        });
                    }
                }
            }

            if (CurrentList != null)
            {
                int index = CurrentList.BinarySearch(chatLine, RTAComparer);
                if (index < 0)
                {
                    index = Math.Abs(index) - 1;
                    CurrentList.Insert(index, chatLine);
                    UpdateCache(entryKey, chatType);
                    CurrentListModified = true;
                }
                else if (chatLine.Line != CurrentList[index].Line)
                {
                    CurrentList.Insert(index, chatLine);
                    UpdateCache(entryKey, chatType);
                    CurrentListModified = true;
                }
            }
        }
예제 #4
0
        internal static ChatType ParseChatType(string line)
        {
            ChatType chatType = null;

            try
            {
                int count;
                int max   = Math.Min(16, line.Length - LineParsing.ACTIONINDEX);
                int index = YouCriteria.FindIndex(criteria => line.IndexOf(criteria, LineParsing.ACTIONINDEX, max, StringComparison.Ordinal) > -1);

                if (index < 0)
                {
                    int criteriaIndex = -1;
                    for (int i = 0; i < OtherCriteria.Count; i++)
                    {
                        int lastIndex = line.IndexOf("'", LineParsing.ACTIONINDEX, StringComparison.Ordinal);
                        if (lastIndex > -1)
                        {
                            count = lastIndex - LineParsing.ACTIONINDEX;
                            if (count > 0)
                            {
                                criteriaIndex = line.IndexOf(OtherCriteria[i], LineParsing.ACTIONINDEX, count, StringComparison.Ordinal);
                                if (criteriaIndex > -1)
                                {
                                    index = i;
                                    break;
                                }
                            }
                        }
                    }

                    if (index < 0)
                    {
                        index = line.IndexOf(" ", LineParsing.ACTIONINDEX, StringComparison.Ordinal);
                        if (index > -1 && index + 5 < line.Length)
                        {
                            if (line[index + 1] == '-' && line[index + 2] == '>')
                            {
                                int lastIndex = line.IndexOf(":", index + 4, StringComparison.Ordinal);
                                if (lastIndex > -1)
                                {
                                    string sender   = line.Substring(LineParsing.ACTIONINDEX, index - LineParsing.ACTIONINDEX);
                                    string receiver = line.Substring(index + 4, lastIndex - index - 4);
                                    chatType = new ChatType {
                                        Channel = ChatChannels.TELL, Sender = sender, Receiver = receiver, Line = line, AfterSenderIndex = lastIndex
                                    };

                                    if (ConfigUtil.PlayerName == sender)
                                    {
                                        chatType.SenderIsYou = true;
                                    }
                                }
                            }
                        }
                    }
                    else if (index > -1 && criteriaIndex > -1)
                    {
                        int start, end;
                        int senderLen = criteriaIndex - LineParsing.ACTIONINDEX;
                        chatType = new ChatType {
                            SenderIsYou = false, Sender = line.Substring(LineParsing.ACTIONINDEX, senderLen), AfterSenderIndex = criteriaIndex, Line = line
                        };

                        switch (index)
                        {
                        case 0:
                            chatType.Channel = ChatChannels.SAY;
                            break;

                        case 1:
                            start = criteriaIndex + 7;
                            if (line.IndexOf("you, ", start, 5, StringComparison.Ordinal) > -1)
                            {
                                chatType.Channel  = ChatChannels.TELL;
                                chatType.Receiver = "You";
                            }
                            else if (line.IndexOf("the guild", start, 9, StringComparison.Ordinal) > -1)
                            {
                                chatType.Channel = ChatChannels.GUILD;
                            }
                            else if (line.IndexOf("the group", start, 9, StringComparison.Ordinal) > -1)
                            {
                                chatType.Channel = ChatChannels.GROUP;
                            }
                            else if (line.IndexOf("the raid", start, 8, StringComparison.Ordinal) > -1)
                            {
                                chatType.Channel = ChatChannels.RAID;
                            }
                            else if (line.IndexOf("the fellowship", start, 14, StringComparison.Ordinal) > -1)
                            {
                                chatType.Channel = ChatChannels.FELLOWSHIP;
                            }
                            else if ((end = line.IndexOf(":", start + 1, StringComparison.Ordinal)) > -1)
                            {
                                chatType.Channel = line.Substring(start, end - start);
                                chatType.Channel = char.ToUpper(chatType.Channel[0], CultureInfo.CurrentCulture) + chatType.Channel.Substring(1).ToLower(CultureInfo.CurrentCulture);
                            }
                            break;

                        case 2:
                            chatType.Channel = ChatChannels.SHOUT;
                            break;

                        case 3:
                            chatType.Channel = ChatChannels.OOC;
                            break;

                        case 4:
                            chatType.Channel = ChatChannels.AUCTION;
                            break;

                        case 5:
                            // check if it's an old cross server tell and not an NPC
                            if (line.IndexOf(" told you,", criteriaIndex, 10, StringComparison.Ordinal) > -1 && chatType.Sender.IndexOf(".", StringComparison.Ordinal) > -1)
                            {
                                chatType.Channel  = ChatChannels.TELL;
                                chatType.Receiver = "You";
                            }
                            break;
                        }
                    }
                }
                else
                {
                    int start, end;
                    chatType = new ChatType {
                        SenderIsYou = true, Sender = "You", AfterSenderIndex = LineParsing.ACTIONINDEX + 4, Line = line
                    };
                    switch (index)
                    {
                    case 0:
                        chatType.Channel = ChatChannels.SAY;
                        break;

                    case 1:
                        chatType.Channel = ChatChannels.TELL;

                        start = LineParsing.ACTIONINDEX + 9;
                        if ((end = line.IndexOf(",", start, StringComparison.Ordinal)) > -1)
                        {
                            chatType.Receiver = line.Substring(start, end - start);
                        }
                        break;

                    case 2:
                        start = LineParsing.ACTIONINDEX + 9;

                        if (line.IndexOf("your party", start, 10, StringComparison.Ordinal) > -1)
                        {
                            chatType.Channel = ChatChannels.GROUP;
                        }
                        else if (line.IndexOf("your raid", start, 9, StringComparison.Ordinal) > -1)
                        {
                            chatType.Channel = ChatChannels.RAID;
                        }
                        else
                        {
                            if ((end = line.IndexOf(":", start, StringComparison.Ordinal)) > -1)
                            {
                                chatType.Channel = line.Substring(start, end - start);
                                chatType.Channel = char.ToUpper(chatType.Channel[0], CultureInfo.CurrentCulture) + chatType.Channel.Substring(1).ToLower(CultureInfo.CurrentCulture);
                            }
                        }
                        break;

                    case 3:
                        start = LineParsing.ACTIONINDEX + 11;
                        if (line.IndexOf("your guild", start, 10, StringComparison.Ordinal) > -1)
                        {
                            chatType.Channel = ChatChannels.GUILD;
                        }
                        else if (line.IndexOf("your fellowship", start, 15, StringComparison.Ordinal) > -1)
                        {
                            chatType.Channel = ChatChannels.FELLOWSHIP;
                        }
                        break;

                    case 4:
                        chatType.Channel = ChatChannels.SHOUT;
                        break;

                    case 5:
                        chatType.Channel = ChatChannels.OOC;
                        break;

                    case 6:
                        chatType.Channel = ChatChannels.AUCTION;
                        break;
                    }
                }
            }
            catch (ArgumentNullException ne)
            {
                LOG.Error(ne);
            }
            catch (NullReferenceException nr)
            {
                LOG.Error(nr);
            }
            catch (ArgumentOutOfRangeException aor)
            {
                LOG.Error(aor);
            }
            catch (ArgumentException ae)
            {
                LOG.Error(ae);
            }

            return(chatType);
        }
예제 #5
0
        public ChatViewer()
        {
            InitializeComponent();

            fontSize.ItemsSource = FontSizeList;
            startDate.Text       = Properties.Resources.CHAT_START_DATE;
            endDate.Text         = Properties.Resources.CHAT_END_DATE;
            textFilter.Text      = Properties.Resources.CHAT_TEXT_FILTER;

            var context = new AutoCompleteText()
            {
                Text = Properties.Resources.CHAT_TO_FILTER
            };

            context.Items.AddRange(PlayerAutoCompleteList);
            toFilter.DataContext = context;

            context = new AutoCompleteText()
            {
                Text = Properties.Resources.CHAT_FROM_FILTER
            };
            context.Items.AddRange(PlayerAutoCompleteList);
            fromFilter.DataContext = context;

            string fgColor = ConfigUtil.GetSetting("ChatFontFgColor");

            if (fontFgColor.ItemsSource is List <ColorItem> colors)
            {
                fontFgColor.SelectedItem = (colors.Find(item => item.Name == fgColor) is ColorItem found) ? found : colors.Find(item => item.Name == "#ffffff");
            }

            string family = ConfigUtil.GetSetting("ChatFontFamily");

            fontFamily.SelectedItem = (family != null) ? new FontFamily(family) : chatBox.FontFamily;

            string size = ConfigUtil.GetSetting("ChatFontSize");

            if (size != null && double.TryParse(size, out double dsize))
            {
                fontSize.SelectedItem = dsize;
            }
            else
            {
                fontSize.SelectedValue = chatBox.FontSize;
            }

            FilterTimer = new DispatcherTimer {
                Interval = new TimeSpan(0, 0, 0, 0, 500)
            };
            FilterTimer.Tick += (sender, e) =>
            {
                FilterTimer.Stop();
                ChangeSearch();
            };

            RefreshTimer = new DispatcherTimer {
                Interval = new TimeSpan(0, 0, 1)
            };
            RefreshTimer.Tick += (sender, e) =>
            {
                ChatIterator newIterator = new ChatIterator(players.SelectedValue as string, CurrentChatFilter);
                var          tempChat    = FirstChat;
                var          tempFilter  = CurrentChatFilter;

                if (tempChat != null)
                {
                    Task.Run(() =>
                    {
                        foreach (var chatType in newIterator.TakeWhile(chatType => chatType.Line != tempChat.Line).Reverse())
                        {
                            Dispatcher.Invoke(() =>
                            {
                                // make sure user didnt start new search
                                if (tempFilter == CurrentChatFilter && RefreshTimer.IsEnabled && tempFilter.PastLiveFilter(chatType))
                                {
                                    if (chatBox.Document.Blocks.Count == 0)
                                    {
                                        MainParagraph = new Paragraph {
                                            Margin = new Thickness(0, 0, 0, 0), Padding = new Thickness(4, 0, 0, 4)
                                        };
                                        chatBox.Document.Blocks.Add(MainParagraph);
                                        MainParagraph.Inlines.Add(new Run());
                                    }

                                    var newItem = new Span(new Run(Environment.NewLine));
                                    newItem.Inlines.Add(new Run(chatType.Line));
                                    MainParagraph.Inlines.InsertAfter(MainParagraph.Inlines.LastInline, newItem);
                                    statusCount.Text = ++CurrentLineCount + " Lines";

                                    FirstChat = chatType;
                                }
                            }, DispatcherPriority.DataBind);
                        }

                        Dispatcher.Invoke(() => RefreshTimer.Stop());
                    });
                }
            };

            LoadPlayers();

            Ready = true;
            ChangeSearch();

            ChatManager.EventsUpdatePlayer += ChatManager_EventsUpdatePlayer;
            ChatManager.EventsNewChannels  += ChatManager_EventsNewChannels;
        }
예제 #6
0
        private void DisplayPage(int count)
        {
            if (!Running)
            {
                Running = true;
                Task.Delay(10).ContinueWith(task =>
                {
                    var chatList = CurrentIterator.Take(count).ToList();
                    if (chatList.Count > 0)
                    {
                        Dispatcher.Invoke(() =>
                        {
                            try
                            {
                                bool needScroll = false;
                                if (chatBox.Document.Blocks.Count == 0)
                                {
                                    MainParagraph = new Paragraph {
                                        Margin = new Thickness(0, 0, 0, 0), Padding = new Thickness(4, 0, 0, 4)
                                    };
                                    chatBox.Document.Blocks.Add(MainParagraph);
                                    MainParagraph.Inlines.Add(new Run());
                                    needScroll = true;
                                }

                                for (int i = 0; i < chatList.Count; i++)
                                {
                                    if (needScroll && i == 0)
                                    {
                                        FirstChat = chatList[i];
                                    }

                                    var text = chatList[i].Line;

                                    Span span = new Span();
                                    if (LastTextFilter != null && chatList[i].KeywordStart > -1)
                                    {
                                        var first  = text.Substring(0, chatList[i].KeywordStart);
                                        var second = text.Substring(chatList[i].KeywordStart, LastTextFilter.Length);
                                        var last   = text.Substring(chatList[i].KeywordStart + LastTextFilter.Length);

                                        if (first.Length > 0)
                                        {
                                            span.Inlines.Add(new Run(first));
                                        }

                                        span.Inlines.Add(new Run {
                                            Text = second, FontStyle = FontStyles.Italic, FontWeight = FontWeights.Bold
                                        });

                                        if (last.Length > 0)
                                        {
                                            span.Inlines.Add(new Run(last));
                                        }
                                    }
                                    else
                                    {
                                        span.Inlines.Add(new Run(text));
                                    }

                                    MainParagraph.Inlines.InsertAfter(MainParagraph.Inlines.FirstInline, span);

                                    if (i != 0)
                                    {
                                        span.Inlines.Add(Environment.NewLine);
                                    }

                                    CurrentLineCount++;
                                }

                                if (needScroll)
                                {
                                    chatScroller.ScrollToEnd();
                                }

                                if (!Connected)
                                {
                                    chatScroller.ScrollChanged += Chat_ScrollChanged;
                                    Connected = true;
                                }

                                statusCount.Text = CurrentLineCount + " Lines";
                            }
                            catch (Exception ex2)
                            {
                                LOG.Error(ex2);
                                throw;
                            }
                            finally
                            {
                                Running = false;
                            }
                        }, DispatcherPriority.Normal);
                    }
                    else
                    {
                        Running = false;
                    }
                }, TaskScheduler.Default);
            }
        }
예제 #7
0
        internal static ChatType ParseChatType(string line)
        {
            ChatType chatType = null;

            if (!string.IsNullOrEmpty(line) && line.Length > (LineParsing.ActionIndex + 3))
            {
                try
                {
                    int count;
                    int max   = Math.Min(16, line.Length - LineParsing.ActionIndex);
                    int index = YouCriteria.FindIndex(criteria => line.IndexOf(criteria, LineParsing.ActionIndex, max, StringComparison.Ordinal) > -1);

                    if (index < 0)
                    {
                        int criteriaIndex = -1;
                        for (int i = 0; i < OtherCriteria.Count; i++)
                        {
                            int lastIndex = line.IndexOf("'", LineParsing.ActionIndex, StringComparison.Ordinal);
                            if (lastIndex > -1)
                            {
                                count = lastIndex - LineParsing.ActionIndex;
                                if (count > 0 && line.Length >= (LineParsing.ActionIndex + count))
                                {
                                    criteriaIndex = line.IndexOf(OtherCriteria[i], LineParsing.ActionIndex, count, StringComparison.Ordinal);
                                    if (criteriaIndex > -1)
                                    {
                                        index = i;
                                        break;
                                    }
                                }
                            }
                        }

                        if (index < 0)
                        {
                            index = line.IndexOf(" ", LineParsing.ActionIndex, StringComparison.Ordinal);
                            if (index > -1 && index + 5 < line.Length)
                            {
                                if (line[index + 1] == '-' && line[index + 2] == '>' && line.Length >= (index + 4))
                                {
                                    int lastIndex = line.IndexOf(":", index + 4, StringComparison.Ordinal);
                                    if (lastIndex > -1)
                                    {
                                        string sender   = line.Substring(LineParsing.ActionIndex, index - LineParsing.ActionIndex);
                                        string receiver = line.Substring(index + 4, lastIndex - index - 4);
                                        chatType = new ChatType {
                                            Channel = ChatChannels.Tell, Sender = sender, Receiver = receiver, Line = line, AfterSenderIndex = lastIndex
                                        };

                                        if (ConfigUtil.PlayerName == sender)
                                        {
                                            chatType.SenderIsYou = true;
                                        }
                                    }
                                }
                            }
                        }
                        else if (index > -1 && criteriaIndex > -1)
                        {
                            int start, end;
                            int senderLen = criteriaIndex - LineParsing.ActionIndex;
                            chatType = new ChatType {
                                SenderIsYou = false, Sender = line.Substring(LineParsing.ActionIndex, senderLen), AfterSenderIndex = criteriaIndex, Line = line
                            };

                            switch (index)
                            {
                            case 0:
                                chatType.Channel = ChatChannels.Say;
                                break;

                            case 1:
                                start = criteriaIndex + 7;
                                if (line.Length >= (start + 5) && line.IndexOf("you, ", start, 5, StringComparison.Ordinal) > -1)
                                {
                                    chatType.Channel  = ChatChannels.Tell;
                                    chatType.Receiver = "You";
                                }
                                else if (line.Length >= (start + 9) && line.IndexOf("the guild", start, 9, StringComparison.Ordinal) > -1)
                                {
                                    chatType.Channel = ChatChannels.Guild;
                                }
                                else if (line.Length >= (start + 9) && line.IndexOf("the group", start, 9, StringComparison.Ordinal) > -1)
                                {
                                    chatType.Channel = ChatChannels.Group;
                                }
                                else if (line.Length >= (start + 8) && line.IndexOf("the raid", start, 8, StringComparison.Ordinal) > -1)
                                {
                                    chatType.Channel = ChatChannels.Raid;
                                }
                                else if (line.Length >= (start + 14) && line.IndexOf("the fellowship", start, 14, StringComparison.Ordinal) > -1)
                                {
                                    chatType.Channel = ChatChannels.Fellowship;
                                }
                                else if ((end = line.IndexOf(":", start + 1, StringComparison.Ordinal)) > -1)
                                {
                                    chatType.Channel = line.Substring(start, end - start);
                                    chatType.Channel = char.ToUpper(chatType.Channel[0], CultureInfo.CurrentCulture) + chatType.Channel.Substring(1).ToLower(CultureInfo.CurrentCulture);
                                }
                                break;

                            case 2:
                                chatType.Channel = ChatChannels.Shout;
                                break;

                            case 3:
                                chatType.Channel = ChatChannels.Ooc;
                                break;

                            case 4:
                                chatType.Channel = ChatChannels.Auction;
                                break;

                            case 5:
                                // check if it's an old cross server tell and not an NPC
                                if (line.Length >= (criteriaIndex + 10) && line.IndexOf(" told you,", criteriaIndex, 10, StringComparison.Ordinal) > -1 && chatType.Sender.IndexOf(".", StringComparison.Ordinal) > -1)
                                {
                                    chatType.Channel  = ChatChannels.Tell;
                                    chatType.Receiver = "You";
                                }
                                break;
                            }
                        }
                    }
                    else
                    {
                        int start, end;
                        chatType = new ChatType {
                            SenderIsYou = true, Sender = "You", AfterSenderIndex = LineParsing.ActionIndex + 4, Line = line
                        };
                        switch (index)
                        {
                        case 0:
                            chatType.Channel = ChatChannels.Say;
                            break;

                        case 1:
                            chatType.Channel = ChatChannels.Tell;

                            start = LineParsing.ActionIndex + 9;
                            if ((end = line.IndexOf(",", start, StringComparison.Ordinal)) > -1)
                            {
                                chatType.Receiver = line.Substring(start, end - start);
                            }
                            break;

                        case 2:
                            start = LineParsing.ActionIndex + 9;

                            if (line.Length >= (start + 10) && line.IndexOf("your party", start, 10, StringComparison.Ordinal) > -1)
                            {
                                chatType.Channel = ChatChannels.Group;
                            }
                            else if (line.Length >= (start + 9) && line.IndexOf("your raid", start, 9, StringComparison.Ordinal) > -1)
                            {
                                chatType.Channel = ChatChannels.Raid;
                            }
                            else
                            {
                                if ((end = line.IndexOf(":", start, StringComparison.Ordinal)) > -1)
                                {
                                    chatType.Channel = line.Substring(start, end - start);
                                    chatType.Channel = char.ToUpper(chatType.Channel[0], CultureInfo.CurrentCulture) + chatType.Channel.Substring(1).ToLower(CultureInfo.CurrentCulture);
                                }
                            }
                            break;

                        case 3:
                            start = LineParsing.ActionIndex + 11;
                            if (line.Length >= (start + 10) && line.IndexOf("your guild", start, 10, StringComparison.Ordinal) > -1)
                            {
                                chatType.Channel = ChatChannels.Guild;
                            }
                            else if (line.Length >= (start + 15) && line.IndexOf("your fellowship", start, 15, StringComparison.Ordinal) > -1)
                            {
                                chatType.Channel = ChatChannels.Fellowship;
                            }
                            break;

                        case 4:
                            chatType.Channel = ChatChannels.Shout;
                            break;

                        case 5:
                            chatType.Channel = ChatChannels.Ooc;
                            break;

                        case 6:
                            chatType.Channel = ChatChannels.Auction;
                            break;
                        }
                    }
                }
                catch (Exception ex)
                {
                    LOG.Error("Failed parsing line = " + line);
                    LOG.Error(ex);
                }
            }

            return(chatType);
        }