private bool IsWhiteFlag(SessionFlag f) { return(f.FlagSet(SessionFlag.White)); }
private bool IsCheckeredFlag(SessionFlag f) { return(f.FlagSet(SessionFlag.Checkered)); }
private bool IsRedFlag(SessionFlag f) { return(f.FlagSet(SessionFlag.Red)); }
private bool IsSafetyCar(SessionFlag f) { return(f.FlagSet(SessionFlag.Caution) || f.FlagSet(SessionFlag.CautionWaving) || f.FlagSet(SessionFlag.OneLapToGreen)); }
private bool IsYellowFlag(SessionFlag f) { return(f.FlagSet(SessionFlag.Yellow) || f.FlagSet(SessionFlag.YellowWaving)); }
public override void Update(ConfigurationSection rootNode, API api) { SessionState = (SessionState)api.GetData("SessionState"); List <Dictionary <string, object> > sessions = rootNode.GetMapList("SessionInfo.Sessions"); Dictionary <string, object> session = sessions[sessions.Count - 1]; object sessionLaps; if (session.TryGetValue("SessionLaps", out sessionLaps) && sessionLaps is string) { string laps = (string)sessionLaps; if (laps.StartsWith("unlimited")) { LapsTotal = int.MaxValue; } else { LapsTotal = int.Parse(laps); } } object sessionType; if (session.TryGetValue("SessionType", out sessionType) && sessionType is string) { string type = (string)sessionType; switch (type) { case "Offline Testing": SessionType = Data.SessionType.OfflineTesting; break; case "Practice": SessionType = Data.SessionType.Practice; break; case "Qualifying": SessionType = Data.SessionType.Qualifying; break; case "Race": if (LapsTotal == int.MaxValue) { SessionType = Data.SessionType.TimeRace; } else { SessionType = Data.SessionType.LapRace; } break; case "Time Trial": SessionType = Data.SessionType.TimeTrial; break; default: SessionType = Data.SessionType.None; break; } } SessionFlag newFlag = (SessionFlag)Enum.Parse(typeof(SessionFlag), ((int)api.GetData("SessionFlags")).ToString(), true); if (newFlag.FlagSet(SessionFlag.White)) { Application.Current.Dispatcher.BeginInvoke(new Action(() => { //Controller.TMTVO.Instance.Window.LapsRemainingFadeIn(1); })); } SessionFlags = newFlag; this.TimeRemaining = (int)(double)api.GetData("SessionTimeRemain"); int lapsRemain = (int)api.GetData("SessionLapsRemain"); if (lapsRemain + 1 <= 5 && lapsRemain + 1 > 0) { Application.Current.Dispatcher.BeginInvoke(new Action(() => { //Controller.TMTVO.Instance.Window.LapsRemainingFadeIn(lapsRemain + 1); })); } this.LapsDriven = LapsTotal - lapsRemain; object sessionTime; if (session.TryGetValue("SessionTime", out sessionTime) && sessionTime is string) { string time = ((string)sessionTime).Substring(0, ((string)sessionTime).Length - 4).Replace('.', ','); if (time.StartsWith("unlim")) { TimeTotal = int.MaxValue; } else { TimeTotal = (int)float.Parse(time); } } }