public StatistikTextFile(string name, int seasonYearOrNumber, FilePathesBuilder filePathesBuilder)
 {
     this._filePathesBuilder = filePathesBuilder;
     this.Name = name;
     this._seasonYearOrNumber = seasonYearOrNumber;
     this.SetPath();
 }
Esempio n. 2
0
        private void ReadInAllTeams()
        {
            FilePathesBuilder filePathesBuilder = new FilePathesBuilder();
            string            teamListFilePath  = filePathesBuilder.GetTeamListTextFilePath();
            var teamListContent = File.ReadAllLines(teamListFilePath, Encoding.Default);

            this.AllTeams = new List <Team>();
            foreach (string line in teamListContent)
            {
                if (line.StartsWith("Verein:"))
                {
                    Team team =
                        new Team(line.Substring(line.IndexOf("Verein:", StringComparison.Ordinal) + "Verein:".Length).Trim());
                    this.AllTeams.Add(team);
                }
                else if (line.StartsWith("Wappen:"))
                {
                    string emblemName =
                        line.Substring(line.IndexOf("Wappen:", StringComparison.Ordinal) + "Wappen:".Length).Trim();

                    this.AllTeams[this.AllTeams.Count - 1].EmblemPath = filePathesBuilder.GetEmblemPath(emblemName);
                }
                else if (line.StartsWith("Stadt:"))
                {
                    this.AllTeams[this.AllTeams.Count - 1].City =
                        line.Substring(line.IndexOf("Stadt:", StringComparison.Ordinal) + "Stadt:".Length).Trim();
                }
            }
        }
 public StatistikTextFile(string name, int seasonYearOrNumber)
 {
     this._filePathesBuilder = new FilePathesBuilder(new KickerLatexPathDropbox());
     this.Name = name;
     this._seasonYearOrNumber = seasonYearOrNumber;
     this.SetPath();
 }
        public SeasonLatexFileList(int seasonYearOrNumber, FilePathesBuilder filePathesBuilder, IFileSystem fileSystem)
        {
            this._seasonYearOrNumber = seasonYearOrNumber;
            this._filePathesBuilder  = filePathesBuilder;
            this._fileSystem         = fileSystem;

            this.FillSeasonLatexList();
        }
        public SeasonLatexFileList(int seasonYearOrNumber)
        {
            this._seasonYearOrNumber = seasonYearOrNumber;
            this._filePathesBuilder  = new FilePathesBuilder(new KickerLatexPathDropbox());
            this._fileSystem         = new FileSystem();

            this.FillSeasonLatexList();
        }
        public SeasonLatexFile(string seasonLatexFileName, int seasonYearOrNumber)
        {
            this.Name = seasonLatexFileName;
            this.SeasonYearOrNumber = seasonYearOrNumber;
            this._filePathesBuilder = new FilePathesBuilder();
            this.GetPath();

            this._fileSystem = new FileSystem();
            this.Initialize();
        }
Esempio n. 7
0
        private static string GetKommenatorBildPfad(string kommentatorName)
        {
            FilePathesBuilder filePathesBuilder        = new FilePathesBuilder();
            string            kommentatorPictureFolder = filePathesBuilder.GetKommentatorenPictureFolder();
            string            kommentatorPicturePath   = Path.Combine(kommentatorPictureFolder, kommentatorName.Replace(" ", string.Empty) + ".jpg");

            if (!File.Exists(kommentatorPicturePath))
            {
                kommentatorPicturePath = kommentatorPicturePath.Replace(".jpg", ".png");
            }
            return(kommentatorPicturePath);
        }
Esempio n. 8
0
        private void SetKommenatorBildPfad(Kommentar kommentator)
        {
            FilePathesBuilder fb = new FilePathesBuilder();
            string            kommentatorPictureFolder = fb.GetKommentatorenPictureFolder();
            string            kommentatorPicturePath   = Path.Combine(kommentatorPictureFolder,
                                                                      kommentator.Name.Replace(" ", string.Empty) + ".jpg");

            if (!File.Exists(kommentatorPicturePath))
            {
                kommentatorPicturePath = kommentatorPicturePath.Replace(".jpg", ".png");
            }
            kommentator.PicturePath = kommentatorPicturePath;
        }
Esempio n. 9
0
        private void ReadInAllKommentatoren()
        {
            this.AllKommentatoren = new ObservableCollection <Kommentar>();
            FilePathesBuilder fb = new FilePathesBuilder();

            for (int i = 1; i < fb.GetLastSeason(); i++)
            {
                string vorberichtStatistikFile = fb.GetStatistikTextFilePath(i, "Vorbericht");
                FindKommenatorsInTextFile(vorberichtStatistikFile);

                string transferStatistikFile = fb.GetStatistikTextFilePath(i, "Transfers");
                FindKommenatorsInTextFile(transferStatistikFile);
            }
        }
Esempio n. 10
0
        public DataTable GetDataTable(int seasonYearOrNumber)
        {
            DataTable dt = new DataTable();

            dt.Columns.Add("Place", typeof(int));
            dt.Columns.Add("Team", typeof(string));
            dt.Columns.Add("GoalsScored", typeof(int));
            dt.Columns.Add("GoalsReceived", typeof(int));
            dt.Columns.Add("Points", typeof(int));

            FilePathesBuilder fb            = new FilePathesBuilder();
            string            tableFilePath = fb.GetTableFilePath(seasonYearOrNumber, this.Name);
            var tableContent = File.ReadAllLines(tableFilePath, Encoding.Default);

            for (int i = 0; i < tableContent.Length; i++)
            {
                DataRow dr = dt.NewRow();
                dt.Rows.Add(dr);
            }

            int rowCounter = 0;

            foreach (string untrimmedLine in tableContent)
            {
                string line = untrimmedLine.Trim();

                int positionOfLastDoublePoint      = line.LastIndexOf(":", StringComparison.Ordinal);
                int positionOfLastWhitespace       = line.LastIndexOf(' ');
                int positionOfSecondLastWhitespace = line.LastIndexOf(' ', positionOfLastWhitespace - 1);
                int positionOfFirstDot             = line.IndexOf('.');
                if (positionOfFirstDot == -1)
                {
                    positionOfFirstDot = line.IndexOf(' ');
                }

                int place  = int.Parse(line.Substring(0, positionOfFirstDot));
                int points = int.Parse(line.Substring(positionOfLastWhitespace));

                int goalsReceived =
                    int.Parse(line.Substring(
                                  positionOfLastDoublePoint + 1,
                                  positionOfLastWhitespace - positionOfLastDoublePoint - 1));
                var a = line.Substring(
                    positionOfSecondLastWhitespace + 1,
                    positionOfLastDoublePoint - positionOfSecondLastWhitespace - 1);
                int goalsScored =
                    int.Parse(line.Substring(
                                  positionOfSecondLastWhitespace + 1,
                                  positionOfLastDoublePoint - positionOfSecondLastWhitespace - 1));
                string teamName = line.Substring(
                    positionOfFirstDot + 2,
                    positionOfSecondLastWhitespace - positionOfFirstDot - 2);

                dt.Rows[rowCounter]["Place"]         = place;
                dt.Rows[rowCounter]["Team"]          = teamName;
                dt.Rows[rowCounter]["GoalsScored"]   = goalsScored;
                dt.Rows[rowCounter]["GoalsReceived"] = goalsReceived;
                dt.Rows[rowCounter]["Points"]        = points;
                rowCounter++;
            }

            return(dt);
        }
Esempio n. 11
0
 public Table()
 {
     this._filePathesBuilder = new FilePathesBuilder();
 }