Beispiel #1
0
        /// <summary>
        /// Assigns match results from given match to given strings, and given fencers as fencers in the match.
        /// </summary>
        /// <param name="res1"></param>
        /// <param name="res2"></param>
        /// <param name="fencer1"></param>
        /// <param name="fencer2"></param>
        /// <param name="match"></param>
        private void assignMatchResult(out string res1, out string res2, out FRCFencer fencer1,
                                       out FRCFencer fencer2, FRCMatch match)
        {
            res1    = "";
            res2    = "";
            fencer1 = getFencerMatchingID(match.FencerID1);
            fencer2 = getFencerMatchingID(match.FencerID2);

            if (match.Fencer1Win)
            {
                res1 += "V";
                if (match.ScoreFencer1 < 5)
                {
                    res1 += match.ScoreFencer1.ToString();
                }
                res2 += match.ScoreFencer2.ToString();
            }
            else if (match.Fencer2Win)
            {
                res2 += "V";
                if (match.ScoreFencer2 < 5)
                {
                    res2 += match.ScoreFencer2.ToString();
                }
                res1 += match.ScoreFencer1.ToString();
            }
            else if (match.Fencer1Abandon)
            {
                res1 += "A";
                res2 += "X";
            }
            else if (match.Fencer2Abandon)
            {
                res2 += "A";
                res1 += "X";
            }
            else if (match.Fencer1Forfait)
            {
                res1 += "S";
                res2 += "X";
            }
            else if (match.Fencer2Forfait)
            {
                res2 += "S";
                res1 += "X";
            }
            else if (match.Fencer1Exclusion)
            {
                res1 += "E";
                res2 += "X";
            }
            else if (match.Fencer2Exclusion)
            {
                res2 += "E";
                res1 += "X";
            }
        }
Beispiel #2
0
        /// <summary>
        /// Interprets info about the tableau from the xml file.
        /// </summary>
        private void interpretTableau()
        {
            if (tableauPhase)
            {
                if (!inMatch)
                {
                    if ((reader.Name == TIREUR && isIndividualCompetition) || (reader.Name == EQUIPE && !isIndividualCompetition))
                    {
                        interpretTireurOrEquipeInTableau();
                    }
                    else if (reader.Name == SUITE_DE_TABLEAUX)
                    {
                        //Skip this add-method only once.
                        if (!onlyOnce)
                        {
                            tableau.Add(new FRCTableau());
                        }
                        else
                        {
                            onlyOnce = false;
                        }
                    }
                    else if (reader.Name == TABLEAU)
                    {
                        interpretLengthInTableau();
                    }
                    else if (reader.Name == MATCH)
                    {
                        inMatch = true;
                        FRCMatch match = new FRCMatch();
                        while (reader.MoveToNextAttribute())
                        {
                            if (reader.Name == ID)
                            {
                                match.MatchID = int.Parse(reader.Value);
                            }
                        }

                        tableau[tableau.Count - 1].getCurrentTableauPart().addMatch(match);
                        //Just to increment index of list in FRCTableauPart.
                        tableau[tableau.Count - 1].getCurrentTableauPart().getNextMatch();
                    }
                }
                else
                {
                    interpretMatchInTableau();
                }
            }

            if (reader.Name == PHASE_DE_TABLEAUX)
            {
                tableauPhase = true;
            }
        }
Beispiel #3
0
 /// <summary>
 /// Add a new match to the match list.
 /// </summary>
 /// <param name="match"></param>
 public void addMatch(FRCMatch match)
 {
     this.match.Add(match);
 }
Beispiel #4
0
        /// <summary>
        /// A method to be called from interpretPoule().
        /// </summary>
        private void interpretMatchInPoule()
        {
            FRCMatch currentMatch = pouleRound[pouleRound.Count - 1].getCurrentPoule().getCurrentMatch();

            switchFencer();
            while (reader.MoveToNextAttribute())
            {
                if (reader.Name == REF)
                {
                    if (focusOnFencer1)
                    {
                        currentMatch.FencerID1 = int.Parse(reader.Value);
                    }
                    else
                    {
                        currentMatch.FencerID2 = int.Parse(reader.Value);
                    }
                }
                else if (reader.Name == SCORE)
                {
                    if (focusOnFencer1)
                    {
                        currentMatch.ScoreFencer1 = int.Parse(reader.Value);
                    }
                    else
                    {
                        currentMatch.ScoreFencer2 = int.Parse(reader.Value);
                    }
                }
                else if (reader.Name == STATUT)
                {
                    if (focusOnFencer1)
                    {
                        if (reader.Value == "V")
                        {
                            currentMatch.Fencer1Win = true;
                        }
                        else if (reader.Value == "A")
                        {
                            currentMatch.Fencer1Abandon = true;
                            currentMatch.Fencer1Win     = false;
                        }
                        else if (reader.Value == "F")
                        {
                            currentMatch.Fencer1Forfait = true;
                            currentMatch.Fencer1Win     = false;
                        }
                        else if (reader.Value == "E")
                        {
                            currentMatch.Fencer1Exclusion = true;
                            currentMatch.Fencer1Win       = false;
                        }
                        else if (reader.Value == "D")
                        {
                            currentMatch.Fencer1Win = false;
                        }
                    }
                    else
                    {
                        if (reader.Value == "V")
                        {
                            currentMatch.Fencer2Win = true;
                        }
                        else if (reader.Value == "A")
                        {
                            currentMatch.Fencer2Abandon = true;
                            currentMatch.Fencer2Win     = false;
                        }
                        else if (reader.Value == "F")
                        {
                            currentMatch.Fencer2Forfait = true;
                            currentMatch.Fencer2Win     = false;
                        }
                        else if (reader.Value == "E")
                        {
                            currentMatch.Fencer2Exclusion = true;
                            currentMatch.Fencer2Win       = false;
                        }
                        else if (reader.Value == "D")
                        {
                            currentMatch.Fencer2Win = false;
                        }
                    }
                }

                //Console.Write(" " + reader.Name + "='" + reader.Value + "'");
            }
        }
Beispiel #5
0
        /// <summary>
        /// A method to be called from interpretTableau().
        /// </summary>
        private void interpretMatchInTableau()
        {
            if (reader.Name == ARBITRE)
            {
                int id = -1;
                while (reader.MoveToNextAttribute())
                {
                    if (reader.Name == REF)
                    {
                        id = int.Parse(reader.Value);
                    }
                }

                for (int i = 0; i < referee.Count; i++)
                {
                    if (id == referee[i].RefereeID)
                    {
                        if (tableau[tableau.Count - 1].getCurrentTableauPart().Length == 8)
                        {
                            referee[i].RefereedQuarterFinals++;
                        }
                        else if (tableau[tableau.Count - 1].getCurrentTableauPart().Length <= 4)
                        {
                            referee[i].RefereedFinals++;
                        }
                        else
                        {
                            referee[i].RefereedMatches++;
                        }

                        break;
                    }
                }
            }
            else if ((reader.Name == TIREUR && isIndividualCompetition) || (reader.Name == EQUIPE && !isIndividualCompetition))
            {
                FRCMatch currentMatch = tableau[tableau.Count - 1].getCurrentTableauPart().getCurrentMatch();
                switchFencer();
                while (reader.MoveToNextAttribute())
                {
                    if (reader.Name == REF)
                    {
                        if (focusOnFencer1)
                        {
                            currentMatch.FencerID1 = int.Parse(reader.Value);
                        }
                        else
                        {
                            currentMatch.FencerID2 = int.Parse(reader.Value);
                        }
                    }
                    else if (reader.Name == SCORE)
                    {
                        if (focusOnFencer1)
                        {
                            currentMatch.ScoreFencer1 = int.Parse(reader.Value);
                        }
                        else
                        {
                            currentMatch.ScoreFencer2 = int.Parse(reader.Value);
                        }
                    }
                    else if (reader.Name == PLACE)
                    {
                        if (focusOnFencer1)
                        {
                            currentMatch.TableauRankFencer1 = int.Parse(reader.Value);
                        }
                        else
                        {
                            currentMatch.TableauRankFencer2 = int.Parse(reader.Value);
                        }
                    }
                    else if (reader.Name == STATUT)
                    {
                        if (focusOnFencer1)
                        {
                            if (reader.Value == "V")
                            {
                                currentMatch.Fencer1Win = true;
                            }
                            else if (reader.Value == "A")
                            {
                                currentMatch.Fencer1Abandon = true;
                                currentMatch.Fencer1Win     = false;
                            }
                            else if (reader.Value == "F")
                            {
                                currentMatch.Fencer1Forfait = true;
                                currentMatch.Fencer1Win     = false;
                            }
                            else if (reader.Value == "E")
                            {
                                currentMatch.Fencer1Exclusion = true;
                                currentMatch.Fencer1Win       = false;
                            }
                            else if (reader.Value == "D")
                            {
                                currentMatch.Fencer1Win = false;
                            }
                        }
                        else
                        {
                            if (reader.Value == "V")
                            {
                                currentMatch.Fencer2Win = true;
                            }
                            else if (reader.Value == "A")
                            {
                                currentMatch.Fencer2Abandon = true;
                                currentMatch.Fencer2Win     = false;
                            }
                            else if (reader.Value == "F")
                            {
                                currentMatch.Fencer2Forfait = true;
                                currentMatch.Fencer2Win     = false;
                            }
                            else if (reader.Value == "E")
                            {
                                currentMatch.Fencer2Exclusion = true;
                                currentMatch.Fencer2Win       = false;
                            }
                            else if (reader.Value == "D")
                            {
                                currentMatch.Fencer2Win = false;
                            }
                        }
                    }
                    //Console.Write(" " + reader.Name + "='" + reader.Value + "'");
                }
            }
        }