46 lines
1.1 KiB
C#
46 lines
1.1 KiB
C#
|
using ModernWpf.Controls;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Net;
|
|||
|
using System.Threading.Tasks;
|
|||
|
|
|||
|
namespace EZPPClient_Installer
|
|||
|
{
|
|||
|
class ReleaseStreamUtil
|
|||
|
{
|
|||
|
|
|||
|
public static async Task<List<string>> GetAvailableReleaseStreams()
|
|||
|
{
|
|||
|
|
|||
|
List<string> releaseStreamList = new List<string>();
|
|||
|
|
|||
|
try
|
|||
|
{
|
|||
|
using (WebClient wc = new WebClient())
|
|||
|
{
|
|||
|
wc.Headers.Add("user-agent", "EZPPClientInstaller");
|
|||
|
var data = await wc.DownloadStringTaskAsync("https://new.ez-pp.farm/ezppclient?releases");
|
|||
|
string[] dataList = data.Split('\n');
|
|||
|
foreach (string datastring in dataList)
|
|||
|
{
|
|||
|
if (string.IsNullOrWhiteSpace(datastring))
|
|||
|
continue;
|
|||
|
releaseStreamList.Add(datastring);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
catch (WebException error)
|
|||
|
{
|
|||
|
_ = new ContentDialog()
|
|||
|
{
|
|||
|
Title = "Oops...",
|
|||
|
Content = "A error occurred while trying to fetch the ReleaseStreams.\n" + error.Message,
|
|||
|
PrimaryButtonText = "Okay"
|
|||
|
}.ShowAsync();
|
|||
|
}
|
|||
|
|
|||
|
return releaseStreamList;
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
}
|