Exemplo n.º 1
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);
            }
        }