Bloom.WebLibraryIntegration.BloomParseClient.GetLanguagePointers C# (CSharp) Method

GetLanguagePointers() private method

Get the language pointers we need to refer to a sequence of languages. If matching languages don't exist they will be created (requires user to be logged in)
private GetLanguagePointers ( LanguageDescriptor languages ) : Bloom.Book.ParseDotComObjectPointer[]
languages Bloom.Book.LanguageDescriptor
return Bloom.Book.ParseDotComObjectPointer[]
        internal ParseDotComObjectPointer[] GetLanguagePointers(LanguageDescriptor[] languages)
        {
            var result = new ParseDotComObjectPointer[languages.Length];
            for (int i = 0; i < languages.Length; i++)
            {
                var lang = languages[i];
                var id = LanguageId(lang);
                if (id == null)
                {
                    var language = CreateLanguage(lang);
                    id = language["objectId"].Value;
                }
                result[i] = new ParseDotComObjectPointer() {ClassName = "language", ObjectId = id};
            }
            return result;
        }

Usage Example

Example #1
0
        /// <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);
        }
All Usage Examples Of Bloom.WebLibraryIntegration.BloomParseClient::GetLanguagePointers