protected override bool ProcessRequest(IRequestInfo info)
{
if (base.ProcessRequest(info))
return true;
var r = CorrectedLocalPath(info);
const string slashBloomSlash = "/bloom/";
if (r.StartsWith(slashBloomSlash))
r = r.Substring(slashBloomSlash.Length);
r = r.Replace("library/", "");
if (r.Contains("libraryContents"))
{
GetLibraryBooks(info);
}
else if (r == "libraryName")
{
info.WriteCompleteOutput(_collectionSettings.CollectionName + " Library");
}
else if (r.Contains("SourceCollectionsList"))
{
GetStoreBooks(info);
}
else if(r.StartsWith("thumbnails/"))
{
r = r.Replace("thumbnails/", "");
r = r.Replace("%5C", "/");
r = r.Replace("%20", " ");
if (File.Exists(r))
{
info.ReplyWithImage(r);
}
}
else if (r.EndsWith(".png") && r.Contains("thumbnail"))
{
r = r.Replace("thumbnail", "");
//if (r.Contains("thumb"))
{
if (File.Exists(r))
{
info.ReplyWithImage(r);
}
else
{
var imgPath = BloomFileLocator.GetBrowserFile("book.png");
info.ReplyWithImage(imgPath);
//book.GetThumbNailOfBookCoverAsync(book.Type != Book.Book.BookType.Publication,image => RefreshOneThumbnail(book, image));
}
}
// else
// {
// var imgPath = FileLocator.GetFileDistributedWithApplication("root", "ui", "book.png");
// info.ReplyWithImage(imgPath);
// }
}
else
{
info.ContentType = GetContentType(Path.GetExtension(r));
string path = BloomFileLocator.GetBrowserFile(r);
//request.QueryString.GetValues()
info.ReplyWithFileContent(path);
}
return true;
}