Added a Release Stream Picker

This commit is contained in:
2021-05-27 09:00:12 +02:00
parent c14665d8a8
commit 2ca4f8beb4
4 changed files with 133 additions and 13 deletions

View File

@@ -0,0 +1,48 @@
using ModernWpf.Controls;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
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;
}
}
}