public void Convert(ItemTitleInfo itemTitleInfo, IBookInformationData titleInformation)
        {
            titleInformation.Languages.Clear();
            titleInformation.Creators.Clear();
            titleInformation.Contributors.Clear();
            titleInformation.Subjects.Clear();
            titleInformation.Identifiers.Clear();

            // in case main body title is not defined (empty)
            if ((itemTitleInfo != null) && (itemTitleInfo.BookTitle != null))
            {
                titleInformation.BookMainTitle = itemTitleInfo.BookTitle.Text;
            }

            titleInformation.AllSequences.Clear();

            if (itemTitleInfo != null)
            {
                // Pass all sequences
                SequencesInfoConverterV3.Convert(itemTitleInfo, titleInformation);

                // Getting information from FB2 Title section
                ConvertMainTitle(itemTitleInfo, titleInformation);

                // add authors
                AuthorsInfoConverterV3.Convert(itemTitleInfo, _conversionSettings, titleInformation);

                // add translators
                TranslatorsInfoConverterV3.Convert(itemTitleInfo, titleInformation, _conversionSettings);

                // genres
                GenresInfoConverterV3.Convert(itemTitleInfo, titleInformation,_conversionSettings);
            }
            titleInformation.DateFileCreation = DateTime.Now;
        }
 public static void Convert(ItemTitleInfo titleInfo, IBookInformationData titleInformation,IEPubConversionSettings settings)
 {
     foreach (var genre in titleInfo.Genres)
     {
         var item = new Subject
         {
             SubjectInfo = Rus2Lat.Instance.Translate(DescriptionConverters.Fb2GenreToDescription(genre.Genre),
                 settings.TransliterationSettings)
         };
         titleInformation.Subjects.Add(item);
     }
 }
Esempio n. 3
0
 public static void Convert(ItemTitleInfo itemInfo, IBookInformationData titleInformation)
 {
     foreach (var seq in itemInfo.Sequences)
     {
         List<string> allSequences = DescriptionConverters.GetSequencesAsStrings(seq);
         if (allSequences.Count != 0)
         {
             foreach (var sequence in allSequences)
             {
                 titleInformation.Series.Add(sequence);
                 titleInformation.AllSequences.Add(sequence);
             }
         }
     }
 }
 private void ConvertMainTitle(ItemTitleInfo titleInfo, IBookInformationData titleInformation)
 {
     var bookTitle = new Title
     {
         TitleName = Rus2Lat.Instance.Translate(DescriptionConverters.FormatBookTitle(titleInfo, _conversionSettings),
             _conversionSettings.TransliterationSettings),
         Language = string.IsNullOrEmpty(titleInfo.BookTitle.Language)
             ? titleInfo.Language
             : titleInfo.BookTitle.Language,
         TitleType = TitleType.Main
     };
     titleInformation.BookTitles.Add(bookTitle);
     // add main title language
     titleInformation.Languages.Add(titleInfo.Language);
 }
 public static void Convert(ItemTitleInfo titleInfo, IBookInformationData titleInformation, IEPubConversionSettings settings)
 {
     foreach (var translator in titleInfo.Translators)
     {
         var person = new PersoneWithRole
         {
             PersonName = Rus2Lat.Instance.Translate(DescriptionConverters.GenerateAuthorString(translator, settings),
                 settings.TransliterationSettings),
             FileAs = DescriptionConverters.GenerateFileAsString(translator, settings),
             Role = RolesEnum.Translator,
             Language = titleInfo.Language
         };
         titleInformation.Contributors.Add(person);
     }
 }
Esempio n. 6
0
        public static void Convert(ItemTitleInfo titleInfo, IEPubConversionSettings settings, IBookInformationData titleInformation)
        {
            foreach (var author in titleInfo.BookAuthors)
            {
                var person = new PersoneWithRole();
                string authorString = DescriptionConverters.GenerateAuthorString(author, settings);
                person.PersonName = Rus2Lat.Instance.Translate(authorString, settings.TransliterationSettings);
                person.FileAs = DescriptionConverters.GenerateFileAsString(author, settings);
                person.Role = RolesEnum.Author;
                person.Language = titleInfo.Language;
                titleInformation.Creators.Add(person);

                // add authors to Title page
                titleInformation.Authors.Add(authorString);
            }
        }
Esempio n. 7
0
        public static string FormatBookTitle(ItemTitleInfo titleInfo, IEPubConversionSettings commonSettings)
        {
            var formatTitle = new ProcessSeqFormatString
            {
                BookTitleFormatSeqNum = commonSettings.SequenceFormat,
                BookTitleFormatNoSeqNum = commonSettings.NoSequenceFormat,
                BookTitleFormatNoSeries = commonSettings.NoSeriesFormat
            };

            String rc;
            if ((titleInfo.Sequences.Count > 0) && commonSettings.AddSeqToTitle)
            {
                rc = formatTitle.GenerateBookTitle(titleInfo.BookTitle.Text, titleInfo.Sequences[0].Name,
                                                   titleInfo.Sequences[0].Number);
            }
            else
            {
                rc = formatTitle.GenerateBookTitle(titleInfo.BookTitle.Text, "", 0);
            }
            return rc;
        }
Esempio n. 8
0
 private void ConvertAnnotation(ItemTitleInfo titleInfo, EPubFileV3 epubFile)
 {
     if (titleInfo.Annotation != null)
     {
         epubFile.BookInformation.Description = new Description {DescInfo = titleInfo.Annotation.ToString()};
         epubFile.AnnotationPage = new AnnotationPageFileV3();
         var converterSettings = new ConverterOptionsV3
         {
             CapitalDrop = Settings.CommonSettings.CapitalDrop,
             Images = Images,
             MaxSize = Settings.V3Settings.HTMLFileMaxSize,
             ReferencesManager = _referencesManager,
         };
         var annotationConverter = new AnnotationConverterV3();
         epubFile.AnnotationPage.BookAnnotation = (Div)annotationConverter.Convert(titleInfo.Annotation,
            new AnnotationConverterParamsV3 { Settings = converterSettings, Level = 1 });
     }
 }