private void AddBookInfo(string folderPath)
{
try
{
//this is handy when windows explorer won't let go of the thumbs.db file, but we want to delete the folder
if (Directory.GetFiles(folderPath, "*.htm").Length == 0 && Directory.GetFiles(folderPath, "*.html").Length == 0)
return;
var bookInfo = new BookInfo(folderPath, Type == CollectionType.TheOneEditableCollection);
_bookInfos.Add(bookInfo);
}
catch (Exception e)
{
if (e.InnerException != null)
{
e = e.InnerException;
}
var jsonPath = Path.Combine(folderPath, BookInfo.MetaDataFileName);
Logger.WriteError("Reading "+ jsonPath, e);
try
{
Logger.WriteEvent(jsonPath +" Contents: " +System.Environment.NewLine+ RobustFile.ReadAllText(jsonPath));
}
catch(Exception readError)
{
Logger.WriteError("Error reading "+ jsonPath, readError);
}
//_books.Add(new ErrorBook(e, path, Type == CollectionType.TheOneEditableCollection));
_bookInfos.Add(new ErrorBookInfo(folderPath, e){});
}
}