public static void UpdateStats(ShooterData shooter, ShooterMatchData data, MatchData match)
        {
            if (shooter.DatesOfMatches.All(d => d != match.Date))
            {
                shooter.DatesOfMatches.Add(match.Date);

                if (match.Champions.Any(c => c.ShooterId == shooter.Id))
                {
                    ++shooter.DC;
                }

                if (data.DNF)
                {
                    ++shooter.DNF;
                }

                shooter.FN += data.FN;
                shooter.NT += data.NT;
                shooter.PD += data.PD;
                shooter.PE += data.PE;
                ++shooter.TotalMatches;
                shooter.TotalTime += data.TotalTime;

                if (!data.DNF)
                {
                    shooter.TotalTimeWithoutDnf += data.TotalTime;
                }
            }
        }
        public List<MatchData> GetAllMatchesInfo()
        {
            string text = ReadFileAsAnsi(RootFolder + "matches.MAT.csv");
            TextReader reader = new StringReader(text);
            CsvReader csv = new CsvReader(reader);

            List<MatchData> matches = new List<MatchData>();
            while (csv.Read())
            {
                MatchData data = new MatchData();
                data.Title = csv.GetField<string>("Description").Trim();
                data.MatchId = csv.GetField<int>("Matchid");
                data.Date = DateTime.Parse(csv.GetField<string>("Date")); // yyyy-mm-dd
                data.IsClassification = csv.GetField<string>("Classifier") == "Y";
                data.MaxStrings = csv.GetField<int>("Strings");
                data.NumberOfRegisteredShooters = csv.GetField<int>("Registered");
                data.NumberOfStages = csv.GetField<int>("Numstages");
                matches.Add(data);
                matchesInfo.Add(data.MatchId, data);

                //string d = string.Empty;
                //d += "Matchid: " + csv.GetField<string>("Matchid") + "; ";
                //d += "Date: " + csv.GetField<string>("Date") + "; ";
                //d += "Strings: " + csv.GetField<string>("Strings") + "; ";
                //d += "Numstages: " + csv.GetField<string>("Numstages") + "; ";
                //d += "Description: " + csv.GetField<string>("Description") + "; ";
                //d += "Classifier: " + csv.GetField<string>("Classifier") + "; ";
                //d += "Registered: " + csv.GetField<string>("Registered") + "; ";

                //Debug.WriteLine(d);
            }

            return matches;
        }
        public static void UpdateShooter(ShooterData shooter, string division, string classification, MatchData match)
        {
            string value = division + " " + classification;

            if (shooter.UsedDivisionClassifications.All(d => d != value))
            {
                shooter.UsedDivisionClassifications.Add(value);
            }
        }
        /// <exception cref="ArgumentException">No new lines in input text!</exception>
        /// <exception cref="ParseException">Varies parse errors!</exception>
        public MatchData Parse(string text, List<ShooterData> existingShooters)
        {
            match = new MatchData();

            string[] lines = text.Split(new[] { '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries);
            if (lines.Length == 0)
            {
                throw new ArgumentException("No new lines in input text!");
            }

            ExtractMatchData(lines);
            ExtractChampions(lines, existingShooters);
            ExtractShootersScores(lines, existingShooters);

            return match;
        }
        public static ShooterData AddOrGet(string fullName, List<ShooterData> shooters, MatchData match)
        {
            var shooter = shooters.FirstOrDefault(s => s.FullName.Equals(fullName, StringComparison.CurrentCultureIgnoreCase));

            if (shooter == null)
            {
                shooter = new ShooterData();

                shooter.Id = 1;
                if (shooters.Count > 0)
                {
                    shooter.Id = shooters.Max(s => s.Id) + 1;
                }

                shooter.FullName = fullName;

                shooters.Add(shooter);
            }

            return shooter;
        }