added more fucking stuff that i dont know how it works

This commit is contained in:
2021-05-25 11:04:08 +02:00
parent 6892bc2a47
commit f9a593f234
6 changed files with 149 additions and 24 deletions

View File

@@ -37,6 +37,7 @@ namespace EZPPClient_Installer
public MainWindow()
{
InitializeComponent();
DownloadUtil.FilesToDownload("yeet");
Init();
}
@@ -45,14 +46,14 @@ namespace EZPPClient_Installer
UpdateInstallButton(false);
UpdateStatus status = await CheckForUpdates();
UpdateState status = await CheckForInstallerUpdates();
switch (status)
{
case UpdateStatus.UpdateFound:
ShowUpdateDialog();
case UpdateState.UpdateFound:
ShowInstallerUpdateDialog();
return;
case UpdateStatus.Error:
case UpdateState.Error:
return;
}
@@ -67,8 +68,14 @@ namespace EZPPClient_Installer
if(!string.IsNullOrEmpty(osuPath) && isValidFolder)
{
bool foundInstall = await isEZPPClientInstallationFound(osuPath);
if(foundInstall)
InstallButton.Content = "Uninstall";
if (foundInstall)
{
Uninstall_Button.Visibility = Visibility.Visible;
UpdateInstallButton(false);
}
folderTextbox.Text = osuPath;
}
@@ -82,7 +89,7 @@ namespace EZPPClient_Installer
}
private async Task<UpdateStatus> CheckForUpdates()
private async Task<UpdateState> CheckForInstallerUpdates()
{
#if !DEBUG
try
@@ -100,16 +107,16 @@ namespace EZPPClient_Installer
}
if (ver > VERSION)
return UpdateStatus.UpdateFound;
return UpdateState.UpdateFound;
}
}
catch (WebException e)
{
ShowErrorDialog(e.Message);
return UpdateStatus.Error;
return UpdateState.Error;
}
#endif
return UpdateStatus.UpToDate;
return UpdateState.UpToDate;
}
private async void ShowErrorDialog(string error)
@@ -124,8 +131,9 @@ namespace EZPPClient_Installer
this.Close();
}
private async void ShowUpdateDialog()
private async void ShowInstallerUpdateDialog()
{
UpdateInstallButton(false);
var dialog = new ContentDialog()
{
Title = "New version available.",
@@ -137,7 +145,7 @@ namespace EZPPClient_Installer
if (result == ContentDialogResult.Primary)
{
System.Diagnostics.Process.Start("https://ez-pp.farm/download");
ShowUpdateDialog();
ShowInstallerUpdateDialog();
}
}
@@ -194,10 +202,17 @@ namespace EZPPClient_Installer
{
bool foundInstall = await isEZPPClientInstallationFound(fbd.SelectedPath);
folderTextbox.Text = fbd.SelectedPath;
if(foundInstall)
InstallButton.Content = "Uninstall";
if (foundInstall)
{
Uninstall_Button.Visibility = Visibility.Visible;
UpdateInstallButton(false);
string osuEZPPPath = folderTextbox.Text + @"\EZPPClient";
List<string> outdatedFiles = DownloadUtil.FilesToDownload(osuEZPPPath)
}else
UpdateInstallButton(true);
}
}
@@ -258,11 +273,6 @@ namespace EZPPClient_Installer
File,
Directory
}
private enum UpdateStatus
{
UpdateFound,
UpToDate,
Error
}
}
}