Esempio n. 1
0
        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));
        }