added more fucking stuff that i dont know how it works
This commit is contained in:
69
EZPPClient Installer/DownloadUtil.cs
Normal file
69
EZPPClient Installer/DownloadUtil.cs
Normal file
@@ -0,0 +1,69 @@
|
||||
using ModernWpf.Controls;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Security.Cryptography;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace EZPPClient_Installer
|
||||
{
|
||||
public class DownloadUtil
|
||||
{
|
||||
|
||||
public static List<string> FilesToDownload(string pathToEZPP)
|
||||
{
|
||||
bool directoryExists = Directory.Exists(pathToEZPP);
|
||||
|
||||
List<string> downloadList = new List<string>();
|
||||
List<MD5File> md5Files = new List<MD5File>();
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
using (WebClient wc = new WebClient())
|
||||
{
|
||||
var data = wc.DownloadString("https://ez-pp.farm/static/client/client.data");
|
||||
string[] dataList = data.Split('\n');
|
||||
foreach (string datastring in dataList)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(datastring))
|
||||
continue;
|
||||
|
||||
string[] se = datastring.Split('#');
|
||||
string md5 = se[0];
|
||||
string name = se[1];
|
||||
md5Files.Add(new MD5File(name, md5));
|
||||
}
|
||||
}
|
||||
}catch(WebException error)
|
||||
{
|
||||
new ContentDialog()
|
||||
{
|
||||
Title = "Oops...",
|
||||
Content = "A error occurred while trying to fetch all needed Files.\n" + error.Message,
|
||||
PrimaryButtonText = "Okay"
|
||||
}.ShowAsync();
|
||||
}
|
||||
|
||||
if (!directoryExists)
|
||||
{
|
||||
foreach (MD5File md5File in md5Files)
|
||||
downloadList.Add(md5File.getName());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
return downloadList;
|
||||
}
|
||||
|
||||
public async Task<bool> CheckForUpdate()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user