private async void FsdConsumer_FlightPlanDtoReceived(object sender, DtoReceivedEventArgs <FlightPlanDto> p) { try { if (_fsdPilots.All(c => c.Callsign != p.Dto.Callsign)) { ApiUserData response = await _httpService.GetUserData(p.Dto.Cid); FsdPrefile fsdPrefile = new FsdPrefile { Cid = int.Parse(p.Dto.Cid), Name = $"{response.FirstName} {response.LastName}", Callsign = p.Dto.Callsign, LastUpdated = DateTime.UtcNow, FlightPlan = FillFlightPlanFromDto(p.Dto), }; _fsdPrefiles.Add(fsdPrefile); } else { FsdPilot fsdPilot = _fsdPilots.Find(c => c.Callsign == p.Dto.Callsign); if (fsdPilot == null) { return; } fsdPilot.FlightPlan = FillFlightPlanFromDto(p.Dto); } } catch (Exception e) { Console.WriteLine(e); } }
private async void FsdConsumer_FlightPlanDtoReceived(object sender, DtoReceivedEventArgs <FlightPlanDto> p) { try { FsdClient fsdClient; bool prefile; if (_fsdClients.All(c => c.Callsign != p.Dto.Callsign)) { ApiUserData response = await _httpService.GetUserData(p.Dto.Cid); Console.WriteLine($"Prefile Received for {response.FirstName} {response.LastName}"); fsdClient = new FsdClient { Cid = p.Dto.Cid, Realname = $"{response.FirstName} {response.LastName}", Callsign = p.Dto.Callsign, LastUpdated = DateTime.UtcNow, }; prefile = true; } else { fsdClient = _fsdClients.Find(c => c.Callsign == p.Dto.Callsign); prefile = false; } if (fsdClient == null) { return; } fsdClient.PlannedAircraft = p.Dto.Aircraft; fsdClient.PlannedTascruise = p.Dto.CruiseSpeed; fsdClient.PlannedDepairport = p.Dto.DepartureAirport; fsdClient.PlannedAltitude = p.Dto.Altitude; fsdClient.PlannedDestairport = p.Dto.DestinationAirport; fsdClient.PlannedRevision = p.Dto.Revision; fsdClient.PlannedFlighttype = p.Dto.Type; fsdClient.PlannedDeptime = p.Dto.EstimatedDepartureTime; fsdClient.PlannedActdeptime = p.Dto.ActualDepartureTime; fsdClient.PlannedHrsenroute = p.Dto.HoursEnroute; fsdClient.PlannedMinenroute = p.Dto.MinutesEnroute; fsdClient.PlannedHrsfuel = p.Dto.HoursFuel; fsdClient.PlannedMinfuel = p.Dto.MinutesFuel; fsdClient.PlannedAltairport = p.Dto.AlternateAirport; fsdClient.PlannedRemarks = p.Dto.Remarks; fsdClient.PlannedRoute = p.Dto.Route; if (prefile) { _fsdPrefiles.Add(fsdClient); p.Dto.Prefile = true; } p.Dto.Realname = fsdClient.Realname; await _liveFeedProducer.ProduceMessage(p.Dto); } catch (Exception e) { Console.WriteLine(e); } }
public async Task SaveData(ApiUserData data) { var sessionId = _eaistoSessionManager.GetSessionId(); if (sessionId == null) { sessionId = await _eaistoSessionManager.StartNewSession(); } var sessionData = await _context.EaistoSessions.SingleOrDefaultAsync(s => s.Id == sessionId); if (sessionData == null) { return; } sessionData.CaptchaId = data.CaptchaId; sessionData.Cookies = data.Cookies; await _context.SaveChangesAsync(); }
public async Task SaveData(ApiUserData data) { _data = data; }
public async Task SaveData(ApiUserData data) { _session.SetString(UserDataKey, JsonConvert.SerializeObject(data)); }