/// <summary>
/// Common routine used in normal upload and bulk upload.
/// </summary>
/// <param name="book"></param>
/// <param name="progressBox"></param>
/// <param name="publishView"></param>
/// <param name="parseId"></param>
/// <param name="invokeTarget"></param>
/// <returns></returns>
internal string FullUpload(Book.Book book, LogBox progressBox, PublishView publishView, out string parseId, Form invokeTarget = null)
{
var bookFolder = book.FolderPath;
// Set this in the metadata so it gets uploaded. Do this in the background task as it can take some time.
// These bits of data can't easily be set while saving the book because we save one page at a time
// and they apply to the book as a whole.
book.BookInfo.LanguageTableReferences = _parseClient.GetLanguagePointers(book.CollectionSettings.MakeLanguageUploadData(book.AllLanguages.ToArray()));
book.BookInfo.PageCount = book.GetPages().Count();
book.BookInfo.Save();
progressBox.WriteStatus(LocalizationManager.GetString("PublishTab.Upload.MakingThumbnail", "Making thumbnail image..."));
MakeThumbnail(book, 70, invokeTarget);
MakeThumbnail(book, 256, invokeTarget);
//the largest thumbnail I found on Amazon was 300px high. Prathambooks.org about the same.
var uploadPdfPath = Path.Combine(bookFolder, Path.ChangeExtension(Path.GetFileName(bookFolder), ".pdf"));
// If there is not already a locked preview in the book folder
// (which we take to mean the user has created a customized one that he prefers),
// make sure we have a current correct preview and then copy it to the book folder so it gets uploaded.
if (!FileUtils.IsFileLocked(uploadPdfPath))
{
progressBox.WriteStatus(LocalizationManager.GetString("PublishTab.Upload.MakingPdf", "Making PDF Preview..."));
publishView.MakePublishPreview();
if (File.Exists(publishView.PdfPreviewPath))
{
File.Copy(publishView.PdfPreviewPath, uploadPdfPath, true);
}
}
string result = UploadBook(bookFolder, progressBox, out parseId);
return(result);
}