EFBTracker/Tracking/SimPosition.cs

26 lines
823 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace EFBTracker.Tracking
{
public class SimPosition
{
public float Latitude { get; set; }
public float Longitude { get; set; }
public int Altitude { get; set; }
public SimPosition(Packet[] data){
if (data[0].Data != null)
{
//Use Linq to search through the packets for a given id and use that data
Latitude = (data.Where(x => x.Id == 22).Select(x => x.Data[0]).ToArray())[0];
Longitude = (data.Where(x => x.Id == 23).Select(x => x.Data[0]).ToArray())[0];
Altitude = Convert.ToInt32((data.Where(x => x.Id == 24).Select(x => x.Data[0]).ToArray())[0]);
}
}
}
}