internal bool CheckAgainstHashFileOnS3(string currentHashes, string bookFolder, IProgress progress)
{
string hashInfoOnS3 = null;
try
{
if (!IsBookOnServer(bookFolder))
{
return(false);
}
var bkInfo = new BookInfo(bookFolder, true);
var s3id = S3BookId(bkInfo.MetaData);
var key = s3id + BloomS3Client.kDirectoryDelimeterForS3 + Path.GetFileName(bookFolder) + BloomS3Client.kDirectoryDelimeterForS3 + UploadHashesFilename;
hashInfoOnS3 = _s3Client.DownloadFile(UseSandbox ? BloomS3Client.SandboxBucketName : BloomS3Client.ProductionBucketName, key);
}
catch
{
hashInfoOnS3 = ""; // probably file doesn't exist because it hasn't yet been uploaded
}
#if DEBUG
if (currentHashes != hashInfoOnS3)
{
progress.WriteMessage("local hash");
progress.WriteMessage(currentHashes);
progress.WriteMessage("s3 hash");
progress.WriteMessage(hashInfoOnS3);
}
#endif
return(currentHashes == hashInfoOnS3);
}