protected override void OnCarInfo(MsgCarInfo msg) { //using (var a = new FileStream("Test.txt", FileMode.Append, FileAccess.Write)) //using (var b = new StreamWriter(a)) //{ // b.WriteLine($"{DateTime.Now.TimeOfDay}: OnCarInfo Called {msg.CarId}"); //} if (Competitors.Any(driver => driver.DriverGuid == msg.DriverGuid && driver.IsConnected == true) || string.IsNullOrEmpty(msg.DriverGuid)) { return; } var competitor = new Competitor { CompetitorId = Guid.NewGuid().ToString(), SessionId = CurrentSession.SessionId, CarId = msg.CarId, ConnectionId = msg.CarId, CarModel = msg.CarModel, CarSkin = msg.CarSkin, DriverName = msg.DriverName, DriverGuid = msg.DriverGuid, IsConnected = true }; Competitors.Add(ApiWrapperNet4.Post <Competitor>("competitor/addcompetitor", competitor)); }
public void Join(string login) { if (IsTakenPart(login)) { throw new InvalidOperationException(string.Format("{0} is already taking part in this competition", login)); } Competitors.Add(new Competitor(login)); }
public override RaceWithFactory AddCompetitor(Transport.Transport transport) { if (transport.IsAir()) { Competitors.Add(transport); } else { throw new AddTransportException(); } return(this); }
public override RaceWithFactory AddCompetitor(Transport.Transport transport) { Competitors.Add(transport); return(this); }
public void Add(Player player) { Competitors.Add(new Competitor { Player = player, Game = this }); }