<commit_before>﻿using _7DTDManager.Interfaces;
using NLog;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

namespace _7DTDManager.LineHandlers
{
    public class lineListPlayers : BaseLineHandler
    {
        static Logger logger = LogManager.GetCurrentClassLogger();
        static Regex rgLPLine = new Regex("^[0-9]+. id=(?<enityid>[0-9]+), (?<name>.*), pos=\\((?<pos>.*)\\), rot=.*, deaths=(?<deaths>[0-9]+), zombies=(?<zombies>[0-9]+), players=(?<players>[0-9]+), score=.*, steamid=(?<steamid>[0-9]+), ip=(?<ip>.*), ping=(?<ping>[0-9]+)");
        static Regex rgLPEnd = new Regex("Total of (?<numplayers>[0-9]+) in the game");

        private List<IPlayer> found = null;
        bool IsFirst = true;
        int countPlayers = 0;

        public override bool ProcessLine(IServerConnection serverConnection, string currentLine)
        {
            if (rgLPLine.IsMatch(currentLine))
            {
                if (IsFirst)
                {
                    countPlayers = 0;
                    found = new List<IPlayer>();
                    IsFirst = false;
                    PriorityProcess = true;<commit_msg>Fix: Crash when no one is online<commit_after>﻿using _7DTDManager.Interfaces;
using NLog;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

namespace _7DTDManager.LineHandlers
{
    public class lineListPlayers : BaseLineHandler
    {
        static Logger logger = LogManager.GetCurrentClassLogger();
        static Regex rgLPLine = new Regex("^[0-9]+. id=(?<enityid>[0-9]+), (?<name>.*), pos=\\((?<pos>.*)\\), rot=.*, deaths=(?<deaths>[0-9]+), zombies=(?<zombies>[0-9]+), players=(?<players>[0-9]+), score=.*, steamid=(?<steamid>[0-9]+), ip=(?<ip>.*), ping=(?<ping>[0-9]+)");
        static Regex rgLPEnd = new Regex("Total of (?<numplayers>[0-9]+) in the game");

        private List<IPlayer> found = new List<IPlayer>();
        bool IsFirst = true;
        int countPlayers = 0;

        public override bool ProcessLine(IServerConnection serverConnection, string currentLine)
        {
            if (rgLPLine.IsMatch(currentLine))
            {
                if (IsFirst)
                {
                    countPlayers = 0;
                    found = new List<IPlayer>();
                    IsFirst = false;
                    PriorityProcess = true;
{'fraction_non_alphanumeric': 0.1572452229299363, 'fraction_numerical': 0.01592356687898089, 'mean_word_length': 2.6739766081871346, 'pattern_counts': {'":': 0, '<': 28, '<?xml version=': 0, '>': 28, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4819708', 'n_tokens_mistral': 825, 'n_tokens_neox': 763, 'n_words': 170}