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)
            {
                SequencesInfoConverterV2.Convert(itemTitleInfo, titleInformation);

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

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

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

                // genres
                GenresInfoConverterV2.Convert(itemTitleInfo, titleInformation, _conversionSettings);
            }
            titleInformation.DateFileCreation = DateTime.Now;
        }
        private void ConvertAnnotation(ItemTitleInfo titleInfo, EPubFileV2 epubFile)
        {
            if (titleInfo.Annotation != null)
            {
                var desc = new Description
                {
                    DescInfo = titleInfo.Annotation.ToString(),
                };
                epubFile.BookInformation.Description = desc;

                var converterSettings = new ConverterOptionsV2
                {
                    CapitalDrop       = Settings.CommonSettings.CapitalDrop,
                    Images            = Images,
                    MaxSize           = Settings.V2Settings.HTMLFileMaxSize,
                    ReferencesManager = _referencesManager,
                };
                var annotationConverter = new AnnotationConverterV2();
                var annotationPage      = new AnnotationPageFileV2
                {
                    BookAnnotation = (Div)annotationConverter.Convert(titleInfo.Annotation,
                                                                      new AnnotationConverterParamsV2 {
                        Settings = converterSettings, Level = 1
                    })
                };
                StructureManager.AddAnnotationPage(annotationPage);
            }
        }
 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);
     }
 }
 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);
     }
 }
 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, 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);
            }
        }
        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);
        }