Exemple #1
0
        private string FetchFileName()
        {
            using (Stream stream = CsvEmbeddedResources.GetStream("FileNames.csv"))
            {
                using (var textReader = new StreamReader(stream))
                {
                    using (var csvReader = new CsvReader(textReader))
                    {
                        var csvFileName = csvReader.GetRecords <CsvFileName>()
                                          .Single(cfn =>
                                                  cfn.Nation == this.Nation.Representation &&
                                                  cfn.Tier == this.Tier);

                        return(csvFileName.FileName);
                    }
                }
            }
        }
Exemple #2
0
        private string FetchLeagueName()
        {
            using (Stream stream = CsvEmbeddedResources.GetStream("LeagueNames.csv"))
            {
                using (var textReader = new StreamReader(stream))
                {
                    using (var csvReader = new CsvReader(textReader))
                    {
                        var csvLeagueName = csvReader.GetRecords <CsvLeagueName>()
                                            .SingleOrDefault(cln =>
                                                             cln.Nation == this.Nation.Representation &&
                                                             cln.Tier == this.Tier &&
                                                             cln.Contains(this.StartingYear));

                        return(csvLeagueName?.Name ?? $"Tier {this.Tier}");
                    }
                }
            }
        }
Exemple #3
0
 private IReadOnlyList <PositionGrouping> FetchPositionGroupings()
 {
     using (Stream stream = CsvEmbeddedResources.GetStream("PositionGroupings.csv"))
     {
         using (var textReader = new StreamReader(stream))
         {
             using (var csvReader = new CsvReader(textReader))
             {
                 return(csvReader.GetRecords <CsvPositionGrouping>()
                        .Where(cpg =>
                               cpg.Nation == this.Nation.Representation &&
                               cpg.Tier == this.Tier &&
                               cpg.StartingYear == this.StartingYear)
                        .Select(cpg => new PositionGrouping(cpg.LongName, cpg.ShortName, cpg.Min, cpg.Max))
                        .ToArray());
             }
         }
     }
 }