changed endpoints for version,data and listing, its now implemented into the EZPPanel
This commit is contained in:
@@ -29,6 +29,8 @@ namespace EZPPClient_Installer
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
|
||||
public static MainWindow Instance { get; private set; }
|
||||
|
||||
[DllImport("kernel32.dll")]
|
||||
private static extern bool CreateSymbolicLink(string lpSymlinkFileName, string lpTargetFileName, SymbolicLink dwFlags);
|
||||
|
||||
@@ -36,8 +38,8 @@ namespace EZPPClient_Installer
|
||||
|
||||
public MainWindow()
|
||||
{
|
||||
Instance = this;
|
||||
InitializeComponent();
|
||||
DownloadUtil.FilesToDownload("yeet");
|
||||
Init();
|
||||
}
|
||||
|
||||
@@ -61,13 +63,13 @@ namespace EZPPClient_Installer
|
||||
string versionString = "v" + VERSION;
|
||||
InstallerWindow.Title = "EZPPClient Installer " + versionString.Replace(",", ".");
|
||||
|
||||
string osuPath = "";
|
||||
string osuPath = Util.osuInstallDir();
|
||||
bool isValidFolder = await isValidOsuFolder(osuPath);
|
||||
UpdateInstallButton(!string.IsNullOrEmpty(osuPath));
|
||||
|
||||
if(!string.IsNullOrEmpty(osuPath) && isValidFolder)
|
||||
{
|
||||
bool foundInstall = await isEZPPClientInstallationFound(osuPath);
|
||||
bool foundInstall = isEZPPClientInstallationFound(osuPath);
|
||||
if (foundInstall)
|
||||
{
|
||||
Uninstall_Button.Visibility = Visibility.Visible;
|
||||
@@ -96,7 +98,7 @@ namespace EZPPClient_Installer
|
||||
{
|
||||
using (WebClient client = new WebClient())
|
||||
{
|
||||
string newVersionString = client.DownloadString("https://ez-pp.farm/static/client/installer.ver");
|
||||
string newVersionString = client.DownloadString("https://new.ez-pp.farm/ezppclient?version");
|
||||
double ver = 0;
|
||||
try
|
||||
{
|
||||
@@ -169,8 +171,50 @@ namespace EZPPClient_Installer
|
||||
}.ShowAsync();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
string EZPPFolder = osuFolder + @"\EZPPClient";
|
||||
|
||||
List<string> filesToDownload = DownloadUtil.FilesToDownload(EZPPFolder);
|
||||
|
||||
Visibility prevInstallBtnVis = InstallButton.Visibility;
|
||||
Visibility prevUninstallBtnVis = Uninstall_Button.Visibility;
|
||||
Visibility prevLinkFCVis = linkFoldersCheckbox.Visibility;
|
||||
|
||||
InstallButton.Visibility = Visibility.Hidden;
|
||||
Uninstall_Button.Visibility = Visibility.Hidden;
|
||||
linkFoldersCheckbox.Visibility = Visibility.Hidden;
|
||||
|
||||
Download_Text.Visibility = Visibility.Visible;
|
||||
Download_Progressbar.Visibility = Visibility.Visible;
|
||||
|
||||
await DownloadUtil.DownloadFiles(filesToDownload, EZPPFolder);
|
||||
|
||||
InstallButton.Visibility = prevInstallBtnVis;
|
||||
Uninstall_Button.Visibility = prevUninstallBtnVis;
|
||||
linkFoldersCheckbox.Visibility = prevLinkFCVis;
|
||||
|
||||
Download_Text.Visibility = Visibility.Hidden;
|
||||
Download_Progressbar.Visibility = Visibility.Hidden;
|
||||
|
||||
await new ContentDialog()
|
||||
{
|
||||
Title = "Success!",
|
||||
Content = "The EZPPClient was successfully installed!",
|
||||
PrimaryButtonText = "Yaaay :3"
|
||||
}.ShowAsync();
|
||||
|
||||
Uninstall_Button.Visibility = Visibility.Visible;
|
||||
UpdateInstallButton(false);
|
||||
|
||||
string osuEZPPPath = folderTextbox.Text + @"\EZPPClient";
|
||||
List<string> outdatedFiles = DownloadUtil.FilesToDownload(osuEZPPPath);
|
||||
|
||||
if (!IsEmpty(outdatedFiles))
|
||||
{
|
||||
InstallButton.Content = "Update";
|
||||
UpdateInstallButton(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void Hyperlink_RequestNavigate(object sender, RequestNavigateEventArgs e)
|
||||
@@ -200,7 +244,7 @@ namespace EZPPClient_Installer
|
||||
}
|
||||
else
|
||||
{
|
||||
bool foundInstall = await isEZPPClientInstallationFound(fbd.SelectedPath);
|
||||
bool foundInstall = isEZPPClientInstallationFound(fbd.SelectedPath);
|
||||
folderTextbox.Text = fbd.SelectedPath;
|
||||
|
||||
if (foundInstall)
|
||||
@@ -224,21 +268,9 @@ namespace EZPPClient_Installer
|
||||
}
|
||||
}
|
||||
|
||||
private async Task<bool> isEZPPClientInstallationFound(string folder)
|
||||
private bool isEZPPClientInstallationFound(string folder)
|
||||
{
|
||||
string[] subDirs = Directory.GetDirectories(folder, "*");
|
||||
bool doesExist = false;
|
||||
|
||||
foreach (string dir in subDirs)
|
||||
{
|
||||
if(dir.Contains("EZPPClient"))
|
||||
{
|
||||
doesExist = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return doesExist;
|
||||
return Directory.Exists(folder + @"\EZPPClient");
|
||||
}
|
||||
|
||||
private async Task<bool> isValidOsuFolder(string folder)
|
||||
@@ -289,5 +321,12 @@ namespace EZPPClient_Installer
|
||||
Directory
|
||||
}
|
||||
|
||||
public static void updateProgress(string file, double progress)
|
||||
{
|
||||
Instance.Download_Progressbar.IsIndeterminate = (progress == 100);
|
||||
Instance.Download_Progressbar.Value = progress;
|
||||
Instance.Download_Text.Content = "Downloading: " + file;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user