예제 #1
0
파일: Aggregator.cs 프로젝트: adarmus/ebook
        BookInfo GetBookWithIsbn(BookFile first, string isbn, IEnumerable<string> files)
        {
            var book = new BookInfo(files)
            {
                Isbn = isbn,
                Author = first.Author,
                Description = first.Description,
                PublishDate = first.PublishDate,
                Publisher = first.Publisher,
                Title = first.Title
            };

            return book;
        }
예제 #2
0
        void ReadMobiFile(MobiHeaderReader mobiReader, PdbRecords pdbRecords)
        {
            string title = mobiReader.GetTitleReader().ReadTitle();

            ExthHeaderReader exthReader = mobiReader.GetExthHeaderReader();

            if (exthReader == null)
            {
                _mobiFile = MakeMobiFileNoExth(title);
            }
            else
            {
                _mobiFile = MakeMobiFromExth(exthReader, title);
            }
        }
예제 #3
0
파일: Aggregator.cs 프로젝트: adarmus/ebook
        BookInfo GetBookWithoutIsbn(BookFile first)
        {
            var files = first.FilePath;

            var book = new BookInfo(files)
            {
                Isbn = "",
                Author = first.Author,
                Description = first.Description,
                PublishDate = first.PublishDate,
                Publisher = first.Publisher,
                Title = first.Title
            };

            return book;
        }
예제 #4
0
        async Task <BookFile> ReadBookFile(string path)
        {
            string          ext    = Path.GetExtension(path);
            IBookFileReader reader = _lookup[ext];

            try
            {
                BookFile book = await Task.Run(() => reader.Read(path));

                _messages.Write("Read {0}", path);

                return(book);
            }
            catch (Exception ex)
            {
                _messages.WriteError(ex, "reading {0}", path);
                return(null);
            }
        }
예제 #5
0
파일: EpubReader.cs 프로젝트: adarmus/ebook
        public BookFile Read(string filepath)
        {
            BookFile book = null;
            try
            {
                var epub = new Epub(filepath);

                book = new BookFile();
                book.Author = GetFirstSafe(epub.Creator);
                book.Title = GetFirstSafe(epub.Title);
                book.Publisher = GetFirstSafe(epub.Publisher);
                book.Description = GetFirstSafe(epub.Description);
                book.PublishDate = GetFirstSafe(epub.Date);
                book.Isbn = epub.ISBN;
                book.FilePath = filepath;
            }
            catch
            {

            }
            return book;
        }
예제 #6
0
 public PdbFileReader(string filepath)
 {
     _filepath = filepath;
     _mobiFile = null;
 }
예제 #7
0
파일: Aggregator.cs 프로젝트: adarmus/ebook
        void OutputComparison(BookFile first, BookFile mobi)
        {
            bool titleOk = first.Title == mobi.Title;
            bool authorOk = first.Author == mobi.Author;
            bool publisherOk = first.Publisher == mobi.Publisher;

            if (authorOk && titleOk && publisherOk)
                return;

            Console.WriteLine("  {0}: {1}{2}{3}  {4}{5}{6}",
                first.Isbn,
                titleOk ? " " : "T",
                authorOk ? " " : "A",
                publisherOk ? " " : "P",
                titleOk ? "" : string.Format("({0} -> {1})", first.Title, mobi.Title),
                authorOk ? "" : string.Format("({0} -> {1})", first.Author, mobi.Author),
                publisherOk ? "" : string.Format("({0} -> {1})", first.Publisher, mobi.Publisher)
                );
        }