Added a Release Stream Picker
This commit is contained in:
48
EZPPClient Installer/Utils/ReleaseStreamUtil.cs
Normal file
48
EZPPClient Installer/Utils/ReleaseStreamUtil.cs
Normal 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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user