Example #1
0
        public CaptainParser()
        {
            this.CanParsePredicate = node => node?.InnerText?.Trim(Common.trimChars) == ParsersConfig.GetLabel(this.GetType(), ConfigType.PLAYER);

            this.ParseFunc = node =>
            {
                var cap = node
                          .SelectNodes("table//tr[1]/td[2]/span")?
                          .FirstOrDefault(n => (n.Attributes["class"]?.Value).Contains("kapitaenicon-table"));
                var parsedStr = (cap == null) ? "0" : "1";

                return(new Captain {
                    Value = Converter.Convert(parsedStr)
                });
            };
        }
Example #2
0
        public ClubArrivalDateParser()
        {
            this.CanParsePredicate = node => node?.InnerText?.Trim(Common.trimChars) == ParsersConfig.GetLabel(this.GetType(), ConfigType.PLAYER);

            this.ParseFunc = node =>
            {
                var parsedStr = node.InnerText;

                return(new ClubArrivalDate {
                    Value = Converter.Convert(parsedStr)
                });
            };
        }
Example #3
0
        public ProfileUrlParser()
        {
            this.CanParsePredicate = node => node?.InnerText?.Trim(Common.trimChars) == ParsersConfig.GetLabel(this.GetType(), ConfigType.PLAYER);

            this.ParseFunc = node =>
            {
                var parsedStr = node
                                .SelectNodes("table//td//a")
                                .FirstOrDefault(n => n.Attributes["class"]?.Value == "spielprofil_tooltip")
                                .Attributes["href"].Value;

                return(new ProfileUrl {
                    Value = Converter.Convert(parsedStr)
                });
            };
        }
Example #4
0
        public ImgUrlParser()
        {
            this.CanParsePredicate = node => node?.InnerText?.Trim(Common.trimChars) == ParsersConfig.GetLabel(this.GetType(), ConfigType.PLAYER);

            this.ParseFunc = node =>
            {
                var parsedStr = node
                                .SelectNodes("table//td/a/img")
                                .FirstOrDefault(n => n.Attributes["class"]?.Value == "bilderrahmen-fixed")
                                .Attributes["src"].Value;

                return(new ImgUrl {
                    Value = Converter.Convert(parsedStr)
                });
            };
        }
Example #5
0
        public PositionParser()
        {
            this.CanParsePredicate = node => node?.InnerText?.Trim(Common.trimChars) == ParsersConfig.GetLabel(this.GetType(), ConfigType.PLAYER);

            this.ParseFunc = node =>
            {
                var parsedStr = node
                                .SelectNodes("table//tr[2]/td[1]")
                                .FirstOrDefault()
                                .InnerText;

                return(new Position {
                    Value = Converter.Convert(parsedStr)
                });
            };
        }
Example #6
0
        public HeightParser()
        {
            this.CanParsePredicate = node => node?.InnerText?.Trim(Common.trimChars) == ParsersConfig.GetLabel(this.GetType(), ConfigType.PLAYER);

            this.ParseFunc = node =>
            {
                var parsedStr = Regex.Replace(node.InnerText, "([a-zA-Z,_ ]+|(?<=[a-zA-Z ])[/-])", "");

                return(new Height {
                    Value = Converter.Convert(parsedStr)
                });
            };
        }
Example #7
0
        public MarketValueParser()
        {
            this.CanParsePredicate = node => node?.InnerText?.Trim(Common.trimChars) == ParsersConfig.GetLabel(this.GetType(), ConfigType.PLAYER);

            this.ParseFunc = node =>
            {
                decimal?n  = null;
                var     sp = node.InnerText?.Split(new[] { " " }, StringSplitOptions.None);

                if (sp == null || sp.Length < 2)
                {
                    throw new Exception("Invalid number of splits");
                }

                var spl = sp[0].Split(new[] { "," }, StringSplitOptions.None);
                n = decimal.Parse(spl[0]);

                if (sp[1] == "M")
                {
                    n = n * 1000000;
                }
                else if (sp[1] == "mil")
                {
                    n = n * 1000;
                }

                return(new MarketValue {
                    Value = Converter.Convert(n.ToString())
                });
            };
        }
Example #8
0
        public ShirtNumberParser()
        {
            this.CanParsePredicate = node => node?.InnerText?.Trim(Common.trimChars) == ParsersConfig.GetLabel(this.GetType(), ConfigType.PLAYER);

            this.ParseFunc = node =>
            {
                var parsedStr = node
                                .SelectNodes("div")
                                .Where(n => n.Attributes["class"].Value == "rn_nummer")
                                .FirstOrDefault()
                                .InnerText;

                return(new ShirtNumber {
                    Value = Converter.Convert(parsedStr)
                });
            };
        }
Example #9
0
        public NationalityParser()
        {
            this.CanParsePredicate = node => node?.InnerText?.Trim(Common.trimChars) == ParsersConfig.GetLabel(this.GetType(), ConfigType.PLAYER);

            this.ParseFunc = node =>
            {
                var parsedStr = node
                                .SelectNodes("img")
                                .Where(n => n.Attributes["class"]?.Value == "flaggenrahmen")
                                .Select(n => n.Attributes["title"].Value)?.ToArray().FirstOrDefault().Trim();

                return(new Nationality {
                    Value = Converter.Convert(parsedStr)
                });
            };
        }
Example #10
0
        public BirthDateParser()
        {
            this.CanParsePredicate = node => node?.InnerText?.Trim(Common.trimChars) == ParsersConfig.GetLabel(this.GetType(), ConfigType.PLAYER);

            this.ParseFunc = node =>
            {
                var parsedStr = node.InnerText?.Split(new[] { " (" }, StringSplitOptions.None)?[0];

                return(new BirthDate {
                    Value = Converter.Convert(parsedStr)
                });
            };
        }
Example #11
0
        public ContractExpirationDateParser()
        {
            this.CanParsePredicate = node => node?.InnerText?.Trim(Common.trimChars) == ParsersConfig.GetLabel(this.GetType(), ConfigType.PLAYER);

            this.ParseFunc = node =>
            {
                var parsedStr = Regex.Replace(node.InnerText, @"\.", "/");

                return(new ContractExpirationDate(DateTime.Now)
                {
                    Value = Converter.Convert(parsedStr)
                });
            };
        }