示例#1
0
        public static IList <MatchInformation> LoadFile(string filename, string nameFighter1)
        {
            var lines = File.ReadAllLines(filename);

            var matchInfos = new List <MatchInformation>();

            foreach (var line in lines.Skip(1))
            {
                var values = line.Split(';');

                if (values.Length < 7)
                {
                    continue;
                }

                var matchInfo = new MatchInformation()
                {
                    Fighter1    = nameFighter1,
                    Fighter2    = values[0],
                    Result      = values[1],
                    Method      = values[2],
                    Competition = values[3],
                    WeightClass = values[4],
                    Round       = values[5],
                    Year        = values[6],
                };

                matchInfos.Add(matchInfo);
            }

            return(matchInfos);
        }
示例#2
0
        public static IList <MatchInformation> LoadFile()
        {
            //var fighters = new List<Fighter>();
            //var matches = new List<Match>();

            var filename = "..\\..\\..\\Data\\Worlds2016.csv";

            var lines = File.ReadAllLines(filename);

            var matchInfos = new List <MatchInformation>();

            foreach (var line in lines.Skip(1))
            {
                var values = line.Split(',');


                var matchInfo = new MatchInformation()
                {
                    Fighter1    = values[0],
                    Fighter2    = values[1],
                    Result      = "W",
                    Method      = values[2],
                    WeightClass = values[3],
                    Round       = values[4],
                    Competition = "World Championships",
                    Year        = "2016",
                };

                matchInfos.Add(matchInfo);
            }

            //MatchProcessor.ProcessMatches(matchInfos);
            //Fighters.AddRange(MatchProcessor.Fighters);
            //Matches.AddRange(MatchProcessor.Matches);

            return(matchInfos);
        }