EFB/Metar/Metar.cs

32 lines
819 B
C#
Raw Normal View History

2022-02-28 21:53:28 +00:00
using libmetar.Services;
2022-02-18 22:43:01 +00:00
using System.Collections.Generic;
using System.Threading.Tasks;
namespace EFB.Metar
{
public static class Metar
{
private static MetarService metarService { get; set; } = new MetarService();
private static TafService tafService { get; set; } = new TafService();
2022-02-28 21:53:28 +00:00
public static async Task<string> GetMETAR(string ICAO)
{
2022-02-18 22:43:01 +00:00
return (await metarService.GetRawAsync(ICAO)).Raw;
}
2022-02-28 21:53:28 +00:00
public static async Task<List<string>> GetTAF(string ICAO)
{
2022-02-18 22:43:01 +00:00
var downloadedTAF = (await tafService.GetRawAsync(ICAO)).RawSplit;
List<string> TAF = new List<string>();
2022-02-28 21:53:28 +00:00
2022-02-18 22:43:01 +00:00
foreach (var line in downloadedTAF)
{
TAF.Add(line);
}
return TAF;
}
}
}