private void EnsurePitlaneStarted(RequiredModel model) { if (!model.InMenus && model.InPitlane && _previousModel?.InPitlane == false) { PitlaneStarted?.Invoke(this, model); } }
public bool TryCollect(out RequiredModel collected) { collected = null; try { if (!Subscriber.IsSubscribed) { Subscriber.Subscribe(); } collected = Subscriber.Receive <RequiredModel>(); } catch (Exception ex) { if (!(ex is SocketException)) { Logger.Fatal("Fatal error while collecting data from network.", ex); } else { Logger.Warn($"Connecting to {PublisherIp}:{PublisherPort}..."); } return(false); } return(true); }
private void EnsurePitlaneFinished(RequiredModel model) { if (!model.InMenus && !model.InPitlane && _previousModel?.InPitlane == true) { PitlaneFinished?.Invoke(this, model); } }
private void EnsureLapInvalidated(RequiredModel model) { if (!model.InMenus && !model.LapIsValid && _previousModel?.LapIsValid == true) { LapInvalidated?.Invoke(this, model); } }
private void EnsureLapFinished(RequiredModel model) { if (!model.InMenus && model.LapNumber > _previousModel?.LapNumber) { LapFinished?.Invoke(this, model); } }
private void EnsureSessionFinished(RequiredModel model) { if (model.Type == null && _previousModel?.Type != null) { SessionFinished?.Invoke(this, model); } }
private void EnsureSectorChanged(RequiredModel model) { if (!model.InMenus && _previousModel != null && model.SectorId != _previousModel.SectorId && _previousModel.SectorId != -1) { SectorChanged?.Invoke(this, model); } }
public override void OnLapStarted(object sender, RequiredModel lap) { base.OnLapStarted(sender, lap); if (LoadedMap == null) { MapManager.IsRecording = true; Logger.Info("Start recording map."); } }
public override void OnUpdated(object sender, RequiredModel model) { base.OnUpdated(sender, model); DrawCurrentPosition(model); if (MapManager.IsRecording) { MapManager.Record(model.CarPosition); } }
public void Return_null_if_every_property_is_ok() { var model = new RequiredModel { Summary = "text" }; builder.BuildFromModel(model); builder.Invalid.Should().BeFalse(); builder.Result.Should().BeNull(); }
public void Approve_required_properties() { var model = new RequiredModel { Summary = "text" }; builder.BuildFromModel(model); builder.Invalid.Should().BeFalse(); builder.Result.Should().BeNull(); }
public override void OnLapFinished(object sender, RequiredModel model) { base.OnLapFinished(sender, model); if (MapManager.IsRecording) { MapManager.Save(model.TrackName, model.LayoutName); Logger.Info("Map was created and saved."); LoadedMap = MapManager.LoadMap(model.TrackName, model.LayoutName); } }
public void Check_required_string_properties(string value) { var model = new RequiredModel { Summary = value }; builder.BuildFromModel(model); builder.Invalid.Should().BeTrue(); builder.Result.Errors.Should().ContainEquivalentOf(new { Error = "required", Path = new[] { "summary" } }); }
public void Analyze(RequiredModel model) { if (model != null) { EnsureSessionFinished(model); EnsureSessionStarted(model); EnsureLapFinished(model); EnsureLapStarted(model); EnsureLapInvalidated(model); EnsureSectorChanged(model); EnsurePitlaneStarted(model); EnsurePitlaneFinished(model); _previousModel = model; } Updated?.Invoke(this, model); }
public virtual void OnPitlaneFinished(object sender, RequiredModel model) { Logger.Info("Pitlane finished."); }
public virtual void OnPitlaneStarted(object sender, RequiredModel model) { Logger.Info("Pitlane started."); }
public virtual void OnSectorChanged(object sender, RequiredModel model) { Logger.Info("Sector changed."); }
public virtual void OnLapInvalidated(object sender, RequiredModel model) { Logger.Info("Lap invalidated."); }
public virtual void OnLapFinished(object sender, RequiredModel model) { Logger.Info("Lap finished."); }
public virtual void OnLapStarted(object sender, RequiredModel model) { Logger.Info("Lap started."); }
public virtual void OnSessionFinished(object sender, RequiredModel model) { Logger.Info("Session finished."); }
public virtual void OnSessionStarted(object sender, RequiredModel model) { Logger.Info("Session started."); }
public override void OnPitlaneFinished(object sender, RequiredModel model) { base.OnPitlaneFinished(sender, model); MapManager.Clear(); }
public virtual void OnUpdated(object sender, RequiredModel model) { }
public override void OnUpdated(object sender, RequiredModel model) { Publisher?.Publish(model); }
public override void OnSessionStarted(object sender, RequiredModel model) { base.OnSessionStarted(sender, model); LoadedMap = MapManager.LoadMap(model.TrackName, model.LayoutName); }