Exemplo n.º 1
0
 public void CopyFrom(IEPubConversionSettings temp)
 {
     if (temp == null)
     {
         throw new ArgumentNullException("temp");
     }
     if (temp == this)
     {
         return;
     }
     _transliterateFileName = temp.TransliterateFileName;
     _addFB2Info = temp.Fb2Info;
     _addSeqToTitle = temp.AddSeqToTitle;
     _sequenceFormat = temp.SequenceFormat;
     _noSequenceFormat = temp.NoSequenceFormat;
     _noSeriesFormat = temp.NoSeriesFormat;
     _authorFormat = temp.AuthorFormat;
     _fileAsFormat = temp.FileAsFormat;
     _skipAboutPage = temp.SkipAboutPage;
     _ignoreTitle = temp.IgnoreTitle;
     _ignoreAuthors = temp.IgnoreAuthors;
     _ignoreTranslators = temp.IgnoreTranslators;
     _ignoreGenres = temp.IgnoreGenres;
     _decorateFontNames = temp.DecorateFontNames;
     _fonts.CopyFrom(temp.Fonts);
     _transliterationSettings.CopyFrom(temp.TransliterationSettings);
 }
 public void CopyFrom(IEPubConversionSettings temp)
 {
     if (temp == null)
     {
         throw new ArgumentNullException("temp");
     }
     if (temp == this)
     {
         return;
     }
     _transliterateFileName = temp.TransliterateFileName;
     _addFB2Info            = temp.Fb2Info;
     _addSeqToTitle         = temp.AddSeqToTitle;
     _sequenceFormat        = temp.SequenceFormat;
     _noSequenceFormat      = temp.NoSequenceFormat;
     _noSeriesFormat        = temp.NoSeriesFormat;
     _authorFormat          = temp.AuthorFormat;
     _fileAsFormat          = temp.FileAsFormat;
     _skipAboutPage         = temp.SkipAboutPage;
     _ignoreTitle           = temp.IgnoreTitle;
     _ignoreAuthors         = temp.IgnoreAuthors;
     _ignoreTranslators     = temp.IgnoreTranslators;
     _ignoreGenres          = temp.IgnoreGenres;
     _decorateFontNames     = temp.DecorateFontNames;
     _fonts.CopyFrom(temp.Fonts);
     _transliterationSettings.CopyFrom(temp.TransliterationSettings);
 }
 public HeaderDataConverterV2(IEPubConversionSettings commonSettings, IEPubV2Settings v2Settings)
 {
     _titleInfoConverter       = new TitleInfoConverterV2(commonSettings);
     _sourceInfoConverter      = new SourceInfoConverterV2(commonSettings);
     _publisherInfoConverter   = new PublisherInfoConverterV2(commonSettings);
     _calibreMetadataConverter = new CalibreMetadataConverter(v2Settings);
 }
 public HeaderDataConverterV2(IEPubConversionSettings commonSettings,IEPubV2Settings v2Settings)
 {
     _titleInfoConverter = new TitleInfoConverterV2(commonSettings);
     _sourceInfoConverter = new SourceInfoConverterV2(commonSettings);
     _publisherInfoConverter = new PublisherInfoConverterV2(commonSettings);
     _calibreMetadataConverter   =   new CalibreMetadataConverter(v2Settings);
 }
        public static string GenerateAuthorString(AuthorType author, IEPubConversionSettings commonSettings)
        {
            var processor = new ProcessAuthorFormat {
                Format = commonSettings.AuthorFormat
            };

            return(processor.GenerateAuthorString(author));
        }
 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);
     }
 }
Exemplo n.º 8
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);
            }
        }
        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);
            }
        }
Exemplo n.º 10
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;
        }
Exemplo n.º 11
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);
        }
Exemplo n.º 12
0
 internal HeaderDataConverterV3(IEPubConversionSettings commonSettings, IEPubV3Settings v3Settings)
 {
     _titleInfoConverter = new TitleInfoConverterV3(commonSettings);
     _sourceInfoConverter = new SourceInfoConverterV3(commonSettings);
     _publisherInfoConverter = new PublisherInfoConverterV3(commonSettings);
 }
Exemplo n.º 13
0
 public TitleInfoConverterV2(IEPubConversionSettings conversionSettings)
 {
     _conversionSettings = conversionSettings;
 }
 public SourceInfoConverterV2(IEPubConversionSettings conversionSettings)
 {
     _conversionSettings = conversionSettings;
 }
Exemplo n.º 15
0
 internal HeaderDataConverterV3(IEPubConversionSettings commonSettings, IEPubV3Settings v3Settings)
 {
     _titleInfoConverter     = new TitleInfoConverterV3(commonSettings);
     _sourceInfoConverter    = new SourceInfoConverterV3(commonSettings);
     _publisherInfoConverter = new PublisherInfoConverterV3(commonSettings);
 }
Exemplo n.º 16
0
        private void PassPublisherInfoFromFB2(FB2File fb2File, IBookInformationData titleInformation, IEPubConversionSettings settings)
        {
            if (fb2File.PublishInfo.BookTitle != null)
            {
                var bookTitle = new Title
                {
                    TitleName =
                        Rus2Lat.Instance.Translate(fb2File.PublishInfo.BookTitle.Text, settings.TransliterationSettings),
                    Language =
                        !string.IsNullOrEmpty(fb2File.PublishInfo.BookTitle.Language)
                            ? fb2File.PublishInfo.BookTitle.Language
                            : fb2File.TitleInfo.Language
                };
                if ((Settings.ConversionSettings.IgnoreTitle != IgnoreInfoSourceOptions.IgnorePublishTitle) && (Settings.ConversionSettings.IgnoreTitle != IgnoreInfoSourceOptions.IgnoreMainAndPublish) &&
                    Settings.ConversionSettings.IgnoreTitle != IgnoreInfoSourceOptions.IgnoreSourceAndPublish)
                {
                    bookTitle.TitleType = TitleType.PublishInfo;
                    titleInformation.BookTitles.Add(bookTitle);
                }
            }


            if (fb2File.PublishInfo.ISBN != null)
            {
                var bookId = new Identifier
                {
                    IdentifierName = "BookISBN",
                    ID             = fb2File.PublishInfo.ISBN.Text,
                    Scheme         = "ISBN"
                };
                titleInformation.Identifiers.Add(bookId);
            }


            if (fb2File.PublishInfo.Publisher != null)
            {
                titleInformation.Publisher.PublisherName = Rus2Lat.Instance.Translate(fb2File.PublishInfo.Publisher.Text, settings.TransliterationSettings);
            }


            try
            {
                if (fb2File.PublishInfo.Year.HasValue)
                {
                    var date = new DateTime(fb2File.PublishInfo.Year.Value, 1, 1);
                    titleInformation.DatePublished = date;
                }
            }
            catch (FormatException ex)
            {
                Logger.Log.DebugFormat("Date reading format exception: {0}", ex);
            }
            catch (Exception exAll)
            {
                Logger.Log.ErrorFormat("Date reading exception: {0}", exAll);
            }
        }
Exemplo n.º 17
0
 public PublisherInfoConverterV2(IEPubConversionSettings conversionSettings)
 {
     _conversionSettings = conversionSettings;
 }
Exemplo n.º 18
0
 public static string GenerateAuthorString(AuthorType author,IEPubConversionSettings commonSettings)
 {
     var processor = new ProcessAuthorFormat { Format = commonSettings.AuthorFormat };
     return processor.GenerateAuthorString(author);
 }
 public TitleInfoConverterV3(IEPubConversionSettings conversionSettings)
 {
     _conversionSettings = conversionSettings;
 }
Exemplo n.º 20
0
 internal SourceInfoConverterV3(IEPubConversionSettings conversionSettings)
 {
     _conversionSettings = conversionSettings;
 }
Exemplo n.º 21
0
 public SourceInfoConverterV2(IEPubConversionSettings conversionSettings)
 {
     _conversionSettings = conversionSettings;
 }
Exemplo n.º 22
0
 public PublisherInfoConverterV2(IEPubConversionSettings conversionSettings)
 {
     _conversionSettings = conversionSettings;
 }
Exemplo n.º 23
0
 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);
     }
 }
Exemplo n.º 24
0
 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);
     }
 }
 internal PublisherInfoConverterV3(IEPubConversionSettings conversionSettings)
 {
     _conversionSettings = conversionSettings;
 }
Exemplo n.º 26
0
 internal PublisherInfoConverterV3(IEPubConversionSettings conversionSettings)
 {
     _conversionSettings = conversionSettings;
 }
Exemplo n.º 27
0
        private void PassPublisherInfoFromFB2(FB2File fb2File, IBookInformationData titleInformation, IEPubConversionSettings settings)
        {
            if (fb2File.PublishInfo.BookTitle != null)
            {
                var bookTitle = new Title
                {
                    TitleName =
                        Rus2Lat.Instance.Translate(fb2File.PublishInfo.BookTitle.Text, settings.TransliterationSettings),
                    Language =
                        !string.IsNullOrEmpty(fb2File.PublishInfo.BookTitle.Language)
                            ? fb2File.PublishInfo.BookTitle.Language
                            : fb2File.TitleInfo.Language
                };
                if ((Settings.ConversionSettings.IgnoreTitle != IgnoreInfoSourceOptions.IgnorePublishTitle) && (Settings.ConversionSettings.IgnoreTitle != IgnoreInfoSourceOptions.IgnoreMainAndPublish) &&
                    Settings.ConversionSettings.IgnoreTitle != IgnoreInfoSourceOptions.IgnoreSourceAndPublish)
                {
                    bookTitle.TitleType = TitleType.PublishInfo;
                    titleInformation.BookTitles.Add(bookTitle);
                }
            }


            if (fb2File.PublishInfo.ISBN != null)
            {
                var bookId = new Identifier
                {
                    IdentifierName = "BookISBN",
                    ID = fb2File.PublishInfo.ISBN.Text,
                    Scheme = "ISBN"
                };
                titleInformation.Identifiers.Add(bookId);
            }


            if (fb2File.PublishInfo.Publisher != null)
            {
                titleInformation.Publisher.PublisherName = Rus2Lat.Instance.Translate(fb2File.PublishInfo.Publisher.Text, settings.TransliterationSettings);
            }


            try
            {
                if (fb2File.PublishInfo.Year.HasValue)
                {
                    var date = new DateTime(fb2File.PublishInfo.Year.Value, 1, 1);
                    titleInformation.DatePublished = date;
                }
            }
            catch (FormatException ex)
            {
                Logger.Log.DebugFormat("Date reading format exception: {0}", ex);
            }
            catch (Exception exAll)
            {
                Logger.Log.ErrorFormat("Date reading exception: {0}", exAll);
            }
        }
Exemplo n.º 28
0
 internal SourceInfoConverterV3(IEPubConversionSettings conversionSettings)
 {
     _conversionSettings = conversionSettings;
 }