/// <summary> /// Defines a Team score. /// </summary> /// <param name="wfscore">The Worldfootball definition.</param> /// <param name="parameters"></param> /// <returns></returns> private static List <BaseScore> DefineTeam(WorldFootballScore wfscore, ScoreParameter[] parameters) { int index = 0; List <BaseScore> scores = new List <BaseScore>(); GenericScore sc = null; sc = CreateNewScore(wfscore.Id, "teamlast", "Last", IMG_PREV, "2", index++); sc.Url = String.Format("{0}teams/{1}/", WF_URL, wfscore.FullLeagueName); sc.Sizes = ScoreCenter.GetParameter(parameters, "WF.TeamLast", SIZES_TEAM_LAST); sc.AddHighlightRule(wfscore.Highlights, 3, RuleAction.FormatLine); sc.AddRule(1, Operation.EndsWith, ";", RuleAction.SkipLine, ""); scores.Add(sc); //sc = CreateNewScore(wfscore.Id, "teamresults", "Results", IMG_RESULTS, "0", index++); //sc.Url = String.Format("{0}teams/{1}/{{YYYY+1}}/3/", WF_URL, wfscore.FullLeagueName); //sc.Sizes = GetParameter(parameters, "WF.TeamResults", SIZES_TEAM_RESULTS); //AddHighlightRule(sc, wfscore.Highlights, 3, RuleAction.FormatLine); //AddRule(sc, 2, Operation.IsNull, "", RuleAction.MergeCells, "Header"); //AddRule(sc, 4, Operation.IsNull, "", RuleAction.FormatLine, "Level1"); //scores.Add(sc); List <string> items = wfscore.Details.ToLower().Split(',').ToList(); if (items.Contains("players")) { sc = CreateNewScore(wfscore.Id, "team", "Players", IMG_PLAYER, "4", index++); sc.Url = String.Format("{0}teams/{1}/", WF_URL, wfscore.FullLeagueName); sc.Sizes = ScoreCenter.GetParameter(parameters, "WF.TeamPlayers", SIZES_TEAM_PLAYERS); sc.AddRule(1, Operation.EndsWith, ";", RuleAction.SkipLine, ""); sc.AddRule(2, Operation.IsNull, "", RuleAction.MergeCells, "Header"); scores.Add(sc); } if (items.Contains("transfers")) { sc = CreateNewScore(wfscore.Id, "transfert", "Transfers", IMG_TRANSFERS, "0", index++); sc.Url = String.Format("{0}teams/{1}/{{YYYY+1}}/6", WF_URL, wfscore.FullLeagueName); sc.Sizes = ScoreCenter.GetParameter(parameters, "WF.TeamTransfers", SIZES_TEAM_TRANSFERS); sc.AddRule(3, Operation.IsNull, "", RuleAction.MergeCells, "Header"); scores.Add(sc); } sc = CreateNewScore(wfscore.Id, "teamarchives", "History", IMG_HISTORY, "1", index++); sc.Url = String.Format("{0}teams/{1}/1/", WF_URL, wfscore.FullLeagueName); sc.Sizes = ScoreCenter.GetParameter(parameters, "WF.TeamHistory", SIZES_TEAM_ARCHIVES); sc.AddHighlightRule(wfscore.Highlights, 3, RuleAction.FormatLine); sc.AddRule(1, Operation.Contains, " x ", RuleAction.FormatLine, "Header"); scores.Add(sc); return(scores); }
/// <summary> /// Defines a Cup. /// </summary> /// <param name="wfscore">The Worldfootball definition.</param> /// <param name="parameters"></param> /// <returns></returns> private static List <BaseScore> DefineCup(WorldFootballScore wfscore, ScoreParameter[] parameters) { int index = 0; List <BaseScore> scores = new List <BaseScore>(); // add last results score GenericScore sc = CreateNewScore(wfscore.Id, "last", "Last Results", IMG_RESULTS, "2", index++); string competition = ScoreCenter.GetParameter(parameters, "WF.Competition", KEY_COMPETITION); sc.Url = String.Format("{0}{2}/{1}/", WF_URL, wfscore.FullLeagueName, competition); sc.Sizes = ScoreCenter.GetParameter(parameters, "WF.CupResults", SIZES_CUP_RESULTS); sc.Dictionary = "WF.last"; sc.AddRule(3, Operation.IsNull, "", RuleAction.MergeCells, "Header"); sc.AddHighlightRule(wfscore.Highlights, 0, RuleAction.FormatCell); scores.Add(sc); string fullname = wfscore.FullLeagueName; if (String.IsNullOrEmpty(wfscore.Season) == false) { fullname += "-" + wfscore.Season; } // add rounds if any if (!String.IsNullOrEmpty(wfscore.Details)) { string[] rounds = wfscore.Details.Split(','); foreach (string round in rounds) { sc = CreateNewScore(wfscore.Id, round, round, IMG_RESULTS, "0", index++); sc.Url = String.Format("{0}spielplan/{1}-{2}/0/", WF_URL, fullname, round); sc.Sizes = wfscore.TwoLegs && round != "finale" ? ScoreCenter.GetParameter(parameters, "WF.CupLevel2", SIZES_CUP_LEVEL2) : ScoreCenter.GetParameter(parameters, "WF.CupLevel1", SIZES_CUP_LEVEL1); sc.AddRule(3, Operation.IsNull, "", RuleAction.MergeCells, "Header"); scores.Add(sc); } } // add details ScoreDetails details = GetScoreDetails(wfscore, parameters); details.AddTopScorerScore(scores, fullname, index++); details.AddAssistsScore(scores, fullname, index++); details.AddStadiumScore(scores, fullname, index++); details.AddRefereeScore(scores, fullname, index++); details.AddHistoryScore(scores, index++); details.AddTopScorerHistScore(scores, index++); return(scores); }
public void AddRefereeScore(List <BaseScore> scores, string fullname, int index) { // Referee if (this.HasDetail(ScoreCenter.GetParameter(m_parameters, "WF.KeyReferees", KEY_REFEREES))) { GenericScore sc = CreateNewScore(m_score.Id, "referee", "Referees", IMG_REFEREE, "0", index); sc.Url = String.Format("{0}schiedsrichter/{1}/1/", WF_URL, fullname); sc.Sizes = ScoreCenter.GetParameter(m_parameters, "WF.Referee", SIZES_REFEREE); sc.Skip = 1; sc.Headers = ScoreCenter.GetParameter(m_parameters, "WF.HeaderReferee", HEADERS_REFEREE); sc.AddRule(-1, Operation.IsLast, "1", RuleAction.SkipLine, ""); scores.Add(sc); } }
public void AddResults(List <BaseScore> scores, int round, string icon, string fullname, int index) { // Round Results GenericScore sc = CreateNewScore(m_score.Id, "round", "Results", icon, "0", index); sc.Url = String.Format("{0}spielplan/{1}-spieltag/{2}/ergebnisse/", WF_URL, fullname, VariableUrl.PARAM); sc.Range = new VariableUrl(round, 1, m_score.Rounds, LocalizationManager.GetString(Labels.RoundLabel)); sc.SetCanLive(true); sc.SetLive(m_score.IsLive()); sc.Sizes = ScoreCenter.GetParameter(m_parameters, "WF.LeagueRoundResults", SIZES_LEAGUE_ROUND_RESULTS); sc.Dictionary = "WF.last"; sc.AddRule(1, Operation.IsNotNull, "", RuleAction.FormatCell, "Header"); sc.AddHighlightRule(m_score.Highlights, 0, RuleAction.FormatCell); scores.Add(sc); }
public void AddAssistsScore(List <BaseScore> scores, string fullname, int index) { // Assists if (this.HasDetail(ScoreCenter.GetParameter(m_parameters, "WF.KeyAssists", KEY_ASSISTS))) { GenericScore sc = CreateNewScore(m_score.Id, "assists", "Assists", IMG_ASSIST, "0", index++); sc.Url = String.Format("{0}assists/{1}/", WF_URL, fullname); sc.Sizes = ScoreCenter.GetParameter(m_parameters, "WF.TopScorers", SIZES_SCORER); sc.Skip = 1; sc.Headers = ScoreCenter.GetParameter(m_parameters, "WF.HeaderAssist", HEADERS_ASSIST); sc.Dictionary = "WF.scorer"; sc.AddRule(-1, Operation.EqualTo, "1", RuleAction.FormatLine, "Level1"); sc.AddHighlightRule(m_score.Highlights, 4, RuleAction.FormatLine); scores.Add(sc); } }
/// <summary> /// Defines a Qualification Tournament. /// </summary> /// <param name="wfscore">The Worldfootball definition.</param> /// <param name="parameters"></param> /// <returns></returns> private static List <BaseScore> DefineQualification(WorldFootballScore wfscore, ScoreParameter[] parameters) { int index = 0; List <BaseScore> scores = new List <BaseScore>(); GenericScore sc = null; string fullname = wfscore.FullLeagueName; if (String.IsNullOrEmpty(wfscore.Season) == false) { fullname += "-" + wfscore.Season; } // add results scores sc = CreateNewScore(wfscore.Id, "results", "Results", IMG_RESULTS, "2", index++); string competition = ScoreCenter.GetParameter(parameters, "WF.Competition", KEY_COMPETITION); sc.Url = String.Format("{0}{2}/{1}/", WF_URL, wfscore.FullLeagueName, competition); sc.Sizes = ScoreCenter.GetParameter(parameters, "WF.Results", SIZES_RESULTS); sc.AddRule(3, Operation.IsNull, "", RuleAction.MergeCells, "Header"); sc.LiveConfig = LiveConfig.Copy(wfscore.LiveConfig, ScoreCenter.GetParameter(parameters, "WF.LiveFormat", "{2} {5} {4}")); sc.SetCanLive(true); sc.Element = "0"; scores.Add(sc); // retrieve details: first element is the list of groups List <string> items = wfscore.Details.Split(',').ToList(); char[] groups = items[0].ToCharArray(); foreach (char g in groups) { // add group results sc = CreateNewScore(wfscore.Id, "gr" + g, String.Format("Group {0}", Char.ToUpper(g)), "", "0", index++); sc.Url = String.Format("{0}spielplan/{1}-gruppe-{2}/0/", WF_URL, fullname, g); sc.Sizes = ScoreCenter.GetParameter(parameters, "WF.GroupResults", SIZES_GROUP_RESULTS); sc.Image = String.Format(@"Groups\Group{0}", Char.ToUpper(g)); sc.AddRule(3, Operation.IsNull, "", RuleAction.MergeCells, "Header"); sc.AddHighlightRule(wfscore.Highlights, 0, RuleAction.FormatCell); scores.Add(sc); // add group standings sc = CreateNewScore(wfscore.Id, "resgr" + g, "Standings", "", "1", index++); sc.Url = String.Format("{0}spielplan/{1}-gruppe-{2}/0/", WF_URL, fullname, g); sc.Skip = 1; sc.Headers = ScoreCenter.GetParameter(parameters, "WF.HeaderStandings", HEADERS_STANDINGS); sc.Sizes = ScoreCenter.GetParameter(parameters, "WF.GroupStandings", SIZES_GROUP_STANDINGS); sc.Image = String.Format(@"Groups\Table{0}", Char.ToUpper(g)); sc.AddHighlightRule(wfscore.Highlights, 3, RuleAction.FormatLine); scores.Add(sc); } // add rounds foreach (string round in items) { if (round == items[0]) { continue; } if (round == "stadium" || round == "referee") { continue; } sc = CreateNewScore(wfscore.Id, round, round, IMG_RESULTS, "0", index++); sc.Url = String.Format("{0}spielplan/{1}-{2}/0/", WF_URL, fullname, round); sc.Sizes = wfscore.TwoLegs && round != "finale" ? ScoreCenter.GetParameter(parameters, "WF.QualificationLevel2", SIZES_QUALIFICATION_LEVEL2) : ScoreCenter.GetParameter(parameters, "WF.QualificationLevel1", SIZES_QUALIFICATION_LEVEL1); sc.AddRule(3, Operation.IsNull, "", RuleAction.MergeCells, "Header"); sc.AddRule(0, Operation.Contains, "{Rückspiel},", RuleAction.ReplaceText, ""); scores.Add(sc); } // add details ScoreDetails details = GetScoreDetails(wfscore, parameters); details.AddTopScorerScore(scores, fullname, index++); details.AddAssistsScore(scores, fullname, index++); details.AddStadiumScore(scores, fullname, index++); details.AddRefereeScore(scores, fullname, index++); details.AddHistoryScore(scores, index++); details.AddTopScorerHistScore(scores, index++); return(scores); }
public static IList <BaseScore> GetRealScores(FussballdeScore score, ScoreParameter[] parameters) { List <BaseScore> scores = new List <BaseScore>(); GenericScore sc = null; int index = 0; var details = score.Details.Split(',').ToList(); sc = GenericScore.CreateNewScore(score.Id, C_KEY_RESULTS, "Results", XPATH_RESULTS, IMG_RESULTS, "", index++); sc.Url = GetUrl(score.Url, C_KEY_RESULTS); SetRound(sc); sc.Skip = 1; sc.Dictionary = "Fussballde"; sc.Sizes = ScoreCenter.GetParameter(parameters, "Fde.SizesResults", SIZES_RESULTS); sc.Headers = ScoreCenter.GetParameter(parameters, "Fde.HeaderResults", HEADER_RESULTS); sc.AddRule(3, Operation.Contains, CUT_BEFORE, RuleAction.CutBefore, ""); sc.AddRule(5, Operation.Contains, CUT_BEFORE, RuleAction.CutBefore, ""); sc.AddRule(1, Operation.Contains, "vorheriger Spieltag", RuleAction.SkipLine, ""); sc.AddRule(1, Operation.Contains, "Verlegte Spiele", RuleAction.MergeCells, ""); sc.AddHighlightRule(score.Highlights, 0, RuleAction.FormatCell); scores.Add(sc); sc = GenericScore.CreateNewScore(score.Id, C_KEY_TABELLE, "Standings", XPATH_TABELLE, IMG_TABELLE, "", index++); sc.Url = GetUrl(score.Url, C_KEY_TABELLE); sc.Skip = 1; sc.Dictionary = "Fussballde"; sc.Sizes = ScoreCenter.GetParameter(parameters, "Fde.SizesTabelle", SIZES_TABELLE); sc.Headers = ScoreCenter.GetParameter(parameters, "Fde.HeaderTabelle", HEADER_TABELLE); sc.AddRule(2, Operation.Contains, CUT_BEFORE, RuleAction.CutBefore, ""); sc.AddLevelsRule(score.Levels); sc.AddHighlightRule(score.Highlights, 2, RuleAction.FormatLine); scores.Add(sc); if (details.Contains("runde")) { sc = GenericScore.CreateNewScore(score.Id, "hinrunde", "1st Round", XPATH_TABELLE, IMG_TABELLE_ROUND1, "0", index++); sc.Url = GetUrl(score.Url, C_KEY_RUNDE); sc.Skip = 1; sc.Dictionary = "Fussballde"; sc.Sizes = ScoreCenter.GetParameter(parameters, "Fde.SizesTabelle", SIZES_TABELLE); sc.Headers = ScoreCenter.GetParameter(parameters, "Fde.HeaderTabelle", HEADER_TABELLE); sc.AddRule(2, Operation.Contains, CUT_BEFORE, RuleAction.CutBefore, ""); sc.AddHighlightRule(score.Highlights, 2, RuleAction.FormatLine); scores.Add(sc); sc = GenericScore.CreateNewScore(score.Id, "rueckrunde", "2nd Round", XPATH_TABELLE, IMG_TABELLE_ROUND2, "1", index++); sc.Url = GetUrl(score.Url, C_KEY_RUNDE); sc.Skip = 1; sc.Dictionary = "Fussballde"; sc.Sizes = ScoreCenter.GetParameter(parameters, "Fde.SizesTabelle", SIZES_TABELLE); sc.Headers = ScoreCenter.GetParameter(parameters, "Fde.HeaderTabelle", HEADER_TABELLE); sc.AddRule(2, Operation.Contains, CUT_BEFORE, RuleAction.CutBefore, ""); sc.AddHighlightRule(score.Highlights, 2, RuleAction.FormatLine); scores.Add(sc); } sc = GenericScore.CreateNewScore(score.Id, "heim", "Home", XPATH_TABELLE, IMG_TABELLE_HOME, "0", index++); sc.Url = GetUrl(score.Url, C_KEY_HEIMAUS); sc.Skip = 1; sc.Dictionary = "Fussballde"; sc.Sizes = ScoreCenter.GetParameter(parameters, "Fde.SizesTabelle", SIZES_TABELLE); sc.Headers = ScoreCenter.GetParameter(parameters, "Fde.HeaderTabelle", HEADER_TABELLE); sc.AddRule(2, Operation.Contains, CUT_BEFORE, RuleAction.CutBefore, ""); sc.AddHighlightRule(score.Highlights, 2, RuleAction.FormatLine); scores.Add(sc); sc = GenericScore.CreateNewScore(score.Id, "auswaerts", "Away", XPATH_TABELLE, IMG_TABELLE_AWAY, "1", index++); sc.Url = GetUrl(score.Url, C_KEY_HEIMAUS); sc.Skip = 1; sc.Dictionary = "Fussballde"; sc.Sizes = ScoreCenter.GetParameter(parameters, "Fde.SizesTabelle", SIZES_TABELLE); sc.Headers = ScoreCenter.GetParameter(parameters, "Fde.HeaderTabelle", HEADER_TABELLE); sc.AddRule(2, Operation.Contains, CUT_BEFORE, RuleAction.CutBefore, ""); sc.AddHighlightRule(score.Highlights, 2, RuleAction.FormatLine); scores.Add(sc); if (details.Contains("fairness")) { sc = GenericScore.CreateNewScore(score.Id, C_KEY_FAIRNESS, "Fair Play", XPATH_FAIRPLAY, IMG_REFEREE, "", index++); sc.Url = GetUrl(score.Url, C_KEY_FAIRNESS); sc.Skip = 1; sc.Dictionary = "Fussballde"; sc.Sizes = ScoreCenter.GetParameter(parameters, "Fde.SizesFairplay", SIZES_FAIRPLAY); sc.Headers = ScoreCenter.GetParameter(parameters, "Fde.HeaderFairplay", HEADER_FAIRPLAY); sc.AddRule(2, Operation.Contains, CUT_BEFORE, RuleAction.CutBefore, ""); sc.AddHighlightRule(score.Highlights, 2, RuleAction.FormatLine); scores.Add(sc); } if (details.Contains("torjaeger")) { sc = GenericScore.CreateNewScore(score.Id, C_KEY_SCORER, "Top Scorers", XPATH_SCORER, IMG_TOPSCORER, "", index++); sc.Url = GetUrl(score.Url, C_KEY_SCORER); sc.Skip = 1; sc.Dictionary = "Fussballde"; sc.Sizes = ScoreCenter.GetParameter(parameters, "Fde.SizesScorer", SIZES_SCORER); sc.Headers = ScoreCenter.GetParameter(parameters, "Fde.HeaderScorer", HEADER_SCORER); sc.AddRule(3, Operation.Contains, CUT_BEFORE, RuleAction.CutBefore, ""); sc.AddHighlightRule(score.Highlights, 3, RuleAction.FormatLine); scores.Add(sc); } return(scores); }