in sdk/src/resumable/ResumableDownloader.cc [374:412]
int ResumableDownloader::loadRecord()
{
auto recordStream = GetFstreamByPath(recordPath_, recordPathW_, std::ios::in);
if (recordStream->is_open()) {
Json::Value root;
Json::CharReaderBuilder rbuilder;
std::string errMsg;
if (!Json::parseFromStream(rbuilder, *recordStream, &root, &errMsg))
{
return ARG_ERROR_PARSE_DOWNLOAD_RECORD_FILE;
}
record_.opType = root["opType"].asString();
record_.driveID = root["driveID"].asString();
record_.shareID = root["shareID"].asString();
record_.fileID = root["fileID"].asString();
record_.contentHash = root["contentHash"].asString();
record_.filePath = root["filePath"].asString();
record_.mtime = root["mtime"].asString();
record_.size = root["size"].asUInt64();
record_.partSize = root["partSize"].asUInt64();
PartRecord part;
for (uint32_t i = 0; i < root["parts"].size(); i++) {
Json::Value partValue = root["parts"][i];
part.partNumber = partValue["partNumber"].asInt();
part.size = partValue["size"].asInt64();
part.crc64 = partValue["crc64"].asUInt64();
record_.parts.push_back(part);
}
record_.md5Sum = root["md5Sum"].asString();
partSize_ = record_.partSize;
hasRecord_ = true;
recordStream->close();
}
return 0;
}