Exemplo n.º 1
0
        internal ChatIterator(string playerAndServer, ChatFilter ChatFilter)
        {
            Home = ConfigUtil.GetArchiveDir() + playerAndServer;
            CurrentChatFilter = ChatFilter;

            if (Directory.Exists(Home))
            {
                var years = Directory.GetDirectories(Home);
                if (years.Length > 0)
                {
                    Directories = years.ToList().OrderByDescending(year => year).ToList();
                    GetNextYear();
                }
            }
        }
Exemplo n.º 2
0
        private void ChangeSearch(bool refresh = false)
        {
            if (players.SelectedItem is string name && name.Length > 0 && !name.StartsWith("No ", StringComparison.Ordinal))
            {
                var    channelList = GetSelectedChannels(out bool changed);
                string text        = (textFilter.Text.Length != 0 && textFilter.Text != Properties.Resources.CHAT_TEXT_FILTER) ? textFilter.Text : null;
                string to          = (toFilter.Text.Length != 0 && toFilter.Text != Properties.Resources.CHAT_TO_FILTER) ? toFilter.Text : null;
                string from        = (fromFilter.Text.Length != 0 && fromFilter.Text != Properties.Resources.CHAT_FROM_FILTER) ? fromFilter.Text : null;
                double startDate   = GetStartDate();
                double endDate     = GetEndDate();
                if (refresh || changed || LastPlayerSelection != name || LastTextFilter != text || LastToFilter != to || LastFromFilter != from || LastStartDate != startDate || LastEndDate != endDate)
                {
                    CurrentChatFilter = new ChatFilter(name, channelList, startDate, endDate, to, from, text);
                    CurrentIterator?.Close();
                    CurrentIterator  = new ChatIterator(name, CurrentChatFilter);
                    CurrentLineCount = 0;
                    RefreshTimer.Stop();
                    LastPlayerSelection = name;
                    LastTextFilter      = text;
                    LastToFilter        = to;
                    LastFromFilter      = from;
                    LastStartDate       = startDate;
                    LastEndDate         = endDate;

                    chatScroller.ScrollChanged -= Chat_ScrollChanged;
                    Connected = false;

                    if (changed)
                    {
                        ChatManager.SaveSelectedChannels(name, channelList);
                    }

                    chatBox.Document.Blocks.Clear();
                    DisplayPage(100);
                }
            }
        }