Esempio n. 1
0
        async Task <bool> UploadNewBook(MatchInfo match, DateAddedProvider dateAddedProvider)
        {
            try
            {
                BookFilesInfo content = await _incomingDataSource.GetBookContent(match.Book);

                dateAddedProvider.SetDateTimeAdded(content);

                await SaveBook(content);

                return(true);
            }
            catch (Exception ex)
            {
                _messages.WriteError(ex, "uploading {0}", match.Book.Title);
                return(false);
            }
        }
Esempio n. 2
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);
            }
        }