49 lines
1.2 KiB
C#
49 lines
1.2 KiB
C#
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;
|
|
}
|
|
|
|
}
|
|
}
|