public Match(FRCApi.MatchResult frcMatch)
            {
                this.Include         = true;
                this.TimeStamp       = new DateTime();
                this.ActualStartTime = frcMatch.actualStartTime;
                this.PostResultTime  = frcMatch.postResultTime;
                Dictionary <int, string> TBAmatchKeys = new Dictionary <int, string>();

                TBAmatchKeys.Add(1, "QF1M1");
                TBAmatchKeys.Add(2, "QF2M1");
                TBAmatchKeys.Add(3, "QF3M1");
                TBAmatchKeys.Add(4, "QF4M1");
                TBAmatchKeys.Add(5, "QF1M2");
                TBAmatchKeys.Add(6, "QF2M2");
                TBAmatchKeys.Add(7, "QF3M2");
                TBAmatchKeys.Add(8, "QF4M2");
                TBAmatchKeys.Add(9, "QF1M3");
                TBAmatchKeys.Add(10, "QF2M3");
                TBAmatchKeys.Add(11, "QF3M3");
                TBAmatchKeys.Add(12, "QF4M3");
                TBAmatchKeys.Add(13, "SF1M1");
                TBAmatchKeys.Add(14, "SF2M1");
                TBAmatchKeys.Add(15, "SF1M2");
                TBAmatchKeys.Add(16, "SF2M2");
                TBAmatchKeys.Add(17, "SF1M3");
                TBAmatchKeys.Add(18, "SF2M3");
                TBAmatchKeys.Add(19, "F1M1");
                TBAmatchKeys.Add(20, "F1M2");
                TBAmatchKeys.Add(21, "F1M3");
                if (frcMatch.tournamentLevel == "Qualification")
                {
                    this.TbaDescription = "QM" + frcMatch.matchNumber;
                }
                else
                {
                    this.TbaDescription = TBAmatchKeys[frcMatch.matchNumber];
                }


                if (frcMatch.description.StartsWith("Qualification "))
                {
                    this.FIRSTDescription = "Qualification Match " + frcMatch.description.Substring(14);
                }
                else
                {
                    //playoffs
                    if (frcMatch.matchNumber >= 9 && frcMatch.matchNumber <= 12)
                    {
                        this.FIRSTDescription = "Quarterfinal Match " + frcMatch.description;
                    }
                    else if (frcMatch.matchNumber >= 17 && frcMatch.matchNumber <= 18)
                    {
                        this.FIRSTDescription = "Semifinal Match " + frcMatch.description;
                    }
                    else if (frcMatch.matchNumber == 21 && Properties.Settings.Default.year == 2019)//only need to add for this season
                    {
                        this.FIRSTDescription = "Final " + frcMatch.description;
                    }
                    else
                    {
                        this.FIRSTDescription = frcMatch.description;
                    }
                }

                this.RedAlliance  = String.Join(", ", frcMatch.teams.Where(team => team.station.StartsWith("Red")).Select(n => n.teamNumber.ToString()).ToList());
                this.BlueAlliance = String.Join(", ", frcMatch.teams.Where(team => team.station.StartsWith("Blue")).Select(n => n.teamNumber.ToString()).ToList());

                this.RedScore    = Convert.ToInt16(frcMatch.scoreRedFinal);
                this.BlueScore   = Convert.ToInt16(frcMatch.scoreBlueFinal);
                this.VideoPath   = "";
                this.YouTubeId   = "";
                this.MatchNumber = frcMatch.matchNumber;
                this.Level       = frcMatch.tournamentLevel;
            }
Exemplo n.º 2
0
 public MatchData2016(FRCApi.MatchResult result, FRCApi.ScoreDetails2016 details)
 {
     this.result  = result;
     this.details = details;
 }