changed endpoints for version,data and listing, its now implemented into the EZPPanel
This commit is contained in:
@@ -24,7 +24,7 @@ namespace EZPPClient_Installer
|
||||
|
||||
using (WebClient wc = new WebClient())
|
||||
{
|
||||
var data = wc.DownloadString("https://ez-pp.farm/static/client/client.data");
|
||||
var data = wc.DownloadString("https://new.ez-pp.farm/ezppclient?list");
|
||||
string[] dataList = data.Split('\n');
|
||||
foreach (string datastring in dataList)
|
||||
{
|
||||
@@ -32,12 +32,13 @@ namespace EZPPClient_Installer
|
||||
continue;
|
||||
|
||||
string[] se = datastring.Split('#');
|
||||
string md5 = se[0].Replace("\r\n", "").Replace("\r", "").Replace("\n", "");
|
||||
string name = se[1].Replace("\r\n", "").Replace("\r", "").Replace("\n", "");
|
||||
string md5 = StripHTML(se[0]);
|
||||
string name = StripHTML(se[1]);
|
||||
md5Files.Add(new MD5File(name, md5));
|
||||
}
|
||||
}
|
||||
}catch(WebException error)
|
||||
}
|
||||
catch (WebException error)
|
||||
{
|
||||
new ContentDialog()
|
||||
{
|
||||
@@ -54,12 +55,7 @@ namespace EZPPClient_Installer
|
||||
}
|
||||
else
|
||||
{
|
||||
/*string[] files = Directory.GetFiles(pathToEZPP, "*");
|
||||
foreach (var file in files)
|
||||
{
|
||||
|
||||
}*/
|
||||
foreach(MD5File md5file in md5Files)
|
||||
foreach (MD5File md5file in md5Files)
|
||||
{
|
||||
string file = pathToEZPP + @"\" + md5file.getName();
|
||||
bool doesExistOnPC = File.Exists(file);
|
||||
@@ -71,7 +67,7 @@ namespace EZPPClient_Installer
|
||||
{
|
||||
string onlineHash = md5file.getMD5();
|
||||
string pcHash = MD5Util.CalculateMD5(file);
|
||||
if(!string.Equals(onlineHash, pcHash))
|
||||
if (!string.Equals(onlineHash, pcHash))
|
||||
{
|
||||
downloadList.Add(md5file.getName());
|
||||
}
|
||||
@@ -79,15 +75,41 @@ namespace EZPPClient_Installer
|
||||
}
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
MessageBox.Show(downloadList.Count + "/" + md5Files.Count + " Files need for update");
|
||||
|
||||
#endif
|
||||
return downloadList;
|
||||
}
|
||||
|
||||
public async Task<bool> CheckForUpdate()
|
||||
public static async Task DownloadFiles(List<string> files, string path)
|
||||
{
|
||||
return false;
|
||||
if (!Directory.Exists(path))
|
||||
Directory.CreateDirectory(path);
|
||||
|
||||
foreach(string filename in files)
|
||||
{
|
||||
await DownloadFile(filename, path);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private static async Task DownloadFile(string filename, string path)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (WebClient wc = new WebClient())
|
||||
{
|
||||
wc.DownloadProgressChanged += (sender, value) => MainWindow.updateProgress(filename + " - " + value.ProgressPercentage + "% - " + Math.Round((value.BytesReceived / 1024000D), 2) + "MB/" + Math.Round((value.TotalBytesToReceive / 1024000D), 2) + "MB", value.ProgressPercentage);
|
||||
await wc.DownloadFileTaskAsync(@"https://new.ez-pp.farm/ezppclient?file=" + filename, path + @"\" + filename);
|
||||
}
|
||||
}catch(WebException)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
private static string StripHTML(string input)
|
||||
{
|
||||
return input.Replace("\r\n", "").Replace("\r", "").Replace("\n", "");
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user