diff --git a/EZPPClient Installer/EZPPClient Installer.csproj b/EZPPClient Installer/EZPPClient Installer.csproj
index 60ea8e9..7146ed0 100644
--- a/EZPPClient Installer/EZPPClient Installer.csproj
+++ b/EZPPClient Installer/EZPPClient Installer.csproj
@@ -90,13 +90,14 @@
App.xaml
Code
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
MainWindow.xaml
Code
@@ -149,5 +150,6 @@
+
\ No newline at end of file
diff --git a/EZPPClient Installer/MainWindow.xaml b/EZPPClient Installer/MainWindow.xaml
index 6b07954..c99d649 100644
--- a/EZPPClient Installer/MainWindow.xaml
+++ b/EZPPClient Installer/MainWindow.xaml
@@ -5,7 +5,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:EZPPClient_Installer"
mc:Ignorable="d"
- Title="EZPPClient Installer" Height="232.051" Width="525.487"
+ Title="EZPPClient Installer" Height="237.051" Width="525.487"
xmlns:ui="http://schemas.modernwpf.com/2019"
ui:WindowHelper.UseModernWindowStyle="True" ResizeMode="CanMinimize" Icon="circle_new.ico" Topmost="True" WindowStartupLocation="CenterScreen">
@@ -16,6 +16,8 @@
-
+
+
+
diff --git a/EZPPClient Installer/MainWindow.xaml.cs b/EZPPClient Installer/MainWindow.xaml.cs
index c99ecc9..24f46b2 100644
--- a/EZPPClient Installer/MainWindow.xaml.cs
+++ b/EZPPClient Installer/MainWindow.xaml.cs
@@ -35,6 +35,8 @@ namespace EZPPClient_Installer
private static double VERSION = 1.6;
+ public static string RELEASESTREAM;
+
public MainWindow()
{
Instance = this;
@@ -62,6 +64,8 @@ namespace EZPPClient_Installer
string versionString = "v" + VERSION;
InstallerWindow.Title = "EZPPClient Installer " + versionString.Replace(",", ".");
+ await FetchReleaseStreams();
+
string osuPath = OsuUtil.osuInstallDir();
if (osuPath.EndsWith(@"\EZPPClient"))
@@ -83,7 +87,7 @@ namespace EZPPClient_Installer
UpdateInstallButton(false);
- List outdatedFiles = DownloadUtil.FilesToDownload(osuEZPPPath, false);
+ List outdatedFiles = await DownloadUtil.FilesToDownload(osuEZPPPath, false);
if (!IsEmpty(outdatedFiles))
{
@@ -105,6 +109,16 @@ namespace EZPPClient_Installer
}
+ private async Task FetchReleaseStreams()
+ {
+ List releases = await ReleaseStreamUtil.GetAvailableReleaseStreams();
+ foreach(string release in releases)
+ {
+ ReleaseStreamComboBox.Items.Add(release.UppercaseFirst());
+ }
+ ReleaseStreamComboBox.SelectedIndex = 0;
+ }
+
private async Task CheckForInstallerUpdates()
{
#if !DEBUG
@@ -372,16 +386,20 @@ namespace EZPPClient_Installer
- List filesToDownload = DownloadUtil.FilesToDownload(EZPPFolder, InstallButton.Content.Equals("Reinstall"));
+ List filesToDownload = await DownloadUtil.FilesToDownload(EZPPFolder, InstallButton.Content.Equals("Reinstall"));
Visibility prevInstallBtnVis = InstallButton.Visibility;
Visibility prevUninstallBtnVis = Uninstall_Button.Visibility;
Visibility prevLinkFCVis = linkFoldersCheckbox.Visibility;
+ Visibility prevReleaseLabelVis = ReleaseStreamLabel.Visibility;
+ Visibility prevReleasesVis = ReleaseStreamComboBox.Visibility;
BrowseButton.IsEnabled = false;
InstallButton.Visibility = Visibility.Hidden;
Uninstall_Button.Visibility = Visibility.Hidden;
linkFoldersCheckbox.Visibility = Visibility.Hidden;
+ ReleaseStreamComboBox.Visibility = Visibility.Hidden;
+ ReleaseStreamLabel.Visibility = Visibility.Hidden;
Download_Text.Visibility = Visibility.Visible;
Download_Progressbar.Visibility = Visibility.Visible;
@@ -407,6 +425,8 @@ namespace EZPPClient_Installer
InstallButton.Visibility = prevInstallBtnVis;
Uninstall_Button.Visibility = prevUninstallBtnVis;
linkFoldersCheckbox.Visibility = prevLinkFCVis;
+ ReleaseStreamComboBox.Visibility = prevReleasesVis;
+ ReleaseStreamLabel.Visibility = prevReleaseLabelVis;
BrowseButton.IsEnabled = true;
Download_Text.Visibility = Visibility.Hidden;
@@ -415,7 +435,7 @@ namespace EZPPClient_Installer
Uninstall_Button.Visibility = Visibility.Visible;
UpdateInstallButton(false);
- List outdatedFiles = DownloadUtil.FilesToDownload(EZPPFolder, false);
+ List outdatedFiles = await DownloadUtil.FilesToDownload(EZPPFolder, false);
if (!IsEmpty(outdatedFiles))
{
@@ -509,7 +529,7 @@ namespace EZPPClient_Installer
UpdateInstallButton(false);
string osuEZPPPath = folderTextbox.Text + @"\EZPPClient";
- List outdatedFiles = DownloadUtil.FilesToDownload(osuEZPPPath, false);
+ List outdatedFiles = await DownloadUtil.FilesToDownload(osuEZPPPath, false);
if (!IsEmpty(outdatedFiles))
{
@@ -634,5 +654,53 @@ namespace EZPPClient_Installer
Instance.Download_Progressbar.Value = progress;
Instance.Download_Text.Content = "Downloading: " + file;
}
+
+ private async void ReleaseStreamComboBox_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
+ {
+
+ bool init = string.IsNullOrEmpty(RELEASESTREAM);
+
+ RELEASESTREAM = (string)ReleaseStreamComboBox.SelectedValue;
+
+ if (init)
+ return;
+
+ string osuPath = folderTextbox.Text;
+
+ bool isValidFolder = await isValidOsuFolder(osuPath);
+ UpdateInstallButton(!string.IsNullOrEmpty(osuPath));
+
+ if (!string.IsNullOrEmpty(osuPath) && isValidFolder)
+ {
+ bool foundInstall = isEZPPClientInstallationFound(osuPath);
+ if (foundInstall)
+ {
+ string osuEZPPPath = osuPath + @"\EZPPClient";
+
+ Uninstall_Button.Visibility = Visibility.Visible;
+ UpdateInstallButton(false);
+
+
+ List outdatedFiles = await DownloadUtil.FilesToDownload(osuEZPPPath, false);
+
+ if (!IsEmpty(outdatedFiles))
+ {
+ UpdateInstallButton(true);
+ InstallButton.Content = "Update";
+ linkFoldersCheckbox.IsEnabled = false;
+ }
+ }
+
+ folderTextbox.Text = osuPath;
+ }
+
+ _ = new ContentDialog()
+ {
+ Title = "Success!",
+ Content = "ReleaseStream changed to " + RELEASESTREAM,
+ PrimaryButtonText = "Okay"
+ }.ShowAsync();
+
+ }
}
}
diff --git a/EZPPClient Installer/Utils/ReleaseStreamUtil.cs b/EZPPClient Installer/Utils/ReleaseStreamUtil.cs
new file mode 100644
index 0000000..d22a497
--- /dev/null
+++ b/EZPPClient Installer/Utils/ReleaseStreamUtil.cs
@@ -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> GetAvailableReleaseStreams()
+ {
+
+ List releaseStreamList = new List();
+
+ 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;
+ }
+
+ }
+}