mirror of
https://github.com/Sude-/lgogdownloader.git
synced 2025-02-02 05:52:31 +01:00
Automatically create XML files (MD5sum cache) for manually downloaded
files during status check if automatic creation enabled.
This commit is contained in:
parent
9520f3f3b7
commit
f29cf99431
@ -2876,24 +2876,36 @@ std::string Downloader::getLocalFileHash(const std::string& filepath, const std:
|
|||||||
else
|
else
|
||||||
local_xml_file = config.sXMLDirectory + "/" + path.filename().string() + ".xml";
|
local_xml_file = config.sXMLDirectory + "/" + path.filename().string() + ".xml";
|
||||||
|
|
||||||
|
if (config.bAutomaticXMLCreation && !boost::filesystem::exists(local_xml_file))
|
||||||
|
{
|
||||||
|
std::string xml_directory = config.sXMLDirectory + "/" + gamename;
|
||||||
|
Util::createXML(filepath, config.iChunkSize, xml_directory);
|
||||||
|
}
|
||||||
|
|
||||||
if (boost::filesystem::exists(local_xml_file))
|
if (boost::filesystem::exists(local_xml_file))
|
||||||
{
|
{
|
||||||
TiXmlDocument local_xml;
|
TiXmlDocument local_xml;
|
||||||
local_xml.LoadFile(local_xml_file.string());
|
local_xml.LoadFile(local_xml_file.string());
|
||||||
TiXmlNode *fileNodeLocal = local_xml.FirstChild("file");
|
TiXmlNode *fileNodeLocal = local_xml.FirstChild("file");
|
||||||
|
if (!fileNodeLocal && config.bAutomaticXMLCreation)
|
||||||
|
{
|
||||||
|
std::string xml_directory = config.sXMLDirectory + "/" + gamename;
|
||||||
|
Util::createXML(filepath, config.iChunkSize, xml_directory);
|
||||||
|
local_xml.LoadFile(local_xml_file.string());
|
||||||
|
fileNodeLocal = local_xml.FirstChild("file");
|
||||||
|
}
|
||||||
if (fileNodeLocal)
|
if (fileNodeLocal)
|
||||||
{
|
{
|
||||||
TiXmlElement *fileElemLocal = fileNodeLocal->ToElement();
|
TiXmlElement *fileElemLocal = fileNodeLocal->ToElement();
|
||||||
localHash = fileElemLocal->Attribute("md5");
|
localHash = fileElemLocal->Attribute("md5");
|
||||||
|
return localHash;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
if (boost::filesystem::exists(path) && boost::filesystem::is_regular_file(path))
|
if (boost::filesystem::exists(path) && boost::filesystem::is_regular_file(path))
|
||||||
{
|
{
|
||||||
localHash = Util::getFileHash(path.string(), RHASH_MD5);
|
localHash = Util::getFileHash(path.string(), RHASH_MD5);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return localHash;
|
return localHash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user