Parsing MD5 Values of existent files to determine which files are out of date
This commit is contained in:
@@ -32,8 +32,8 @@ namespace EZPPClient_Installer
|
||||
continue;
|
||||
|
||||
string[] se = datastring.Split('#');
|
||||
string md5 = se[0];
|
||||
string name = se[1];
|
||||
string md5 = se[0].Replace("\r\n", "").Replace("\r", "").Replace("\n", "");
|
||||
string name = se[1].Replace("\r\n", "").Replace("\r", "").Replace("\n", "");
|
||||
md5Files.Add(new MD5File(name, md5));
|
||||
}
|
||||
}
|
||||
@@ -54,9 +54,33 @@ namespace EZPPClient_Installer
|
||||
}
|
||||
else
|
||||
{
|
||||
/*string[] files = Directory.GetFiles(pathToEZPP, "*");
|
||||
foreach (var file in files)
|
||||
{
|
||||
|
||||
}*/
|
||||
foreach(MD5File md5file in md5Files)
|
||||
{
|
||||
string file = pathToEZPP + @"\" + md5file.getName();
|
||||
bool doesExistOnPC = File.Exists(file);
|
||||
if (!doesExistOnPC)
|
||||
{
|
||||
downloadList.Add(md5file.getName());
|
||||
}
|
||||
else
|
||||
{
|
||||
string onlineHash = md5file.getMD5();
|
||||
string pcHash = MD5Util.CalculateMD5(file);
|
||||
if(!string.Equals(onlineHash, pcHash))
|
||||
{
|
||||
downloadList.Add(md5file.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MessageBox.Show(downloadList.Count + "/" + md5Files.Count + " Files need for update");
|
||||
|
||||
return downloadList;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user