diff --git a/Charcoal/Charcoal/Charcoal.cpp b/Charcoal/Charcoal/Charcoal.cpp index a8f2d44..4033b74 100644 --- a/Charcoal/Charcoal/Charcoal.cpp +++ b/Charcoal/Charcoal/Charcoal.cpp @@ -100,7 +100,7 @@ void Charcoal::deleteBooks(const JSObject& thisobject, const JSArgs& args) } void Charcoal::grayscaleName(const JSObject& thisobject, const JSArgs& args) { - MessageBoxA(NULL, "Grayscale Books Hook", "Grayscale Books Hook", MB_OK); + MessageBoxA(NULL, "Started Grayscaling book", "Started Grayscaling book", MB_OK); // Get the first argument JSValueRef arg = args[0]; JSContextRef ctx = JSGlobalContextCreate(NULL); @@ -109,7 +109,7 @@ void Charcoal::grayscaleName(const JSObject& thisobject, const JSArgs& args) { // Call the grayscale method ebooks.grayscale(ID); - + MessageBoxA(NULL, "Finished Grayscaling book", "Finished Grayscaling book", MB_OK); return; } diff --git a/Charcoal/Charcoal/Epub.cpp b/Charcoal/Charcoal/Epub.cpp index 33b5ebf..3d4ccea 100644 --- a/Charcoal/Charcoal/Epub.cpp +++ b/Charcoal/Charcoal/Epub.cpp @@ -109,7 +109,6 @@ book Epub::add(std::string npath) } void Epub::grayscaleEpub(std::string path) { - //std::string npath = wstrtostr(path); using namespace libzippp; ZipArchive zipArchive(path); zipArchive.open(ZipArchive::Write); diff --git a/Charcoal/Charcoal/Library.cpp b/Charcoal/Charcoal/Library.cpp index e4d352b..431f96f 100644 --- a/Charcoal/Charcoal/Library.cpp +++ b/Charcoal/Charcoal/Library.cpp @@ -83,14 +83,16 @@ std::string Library::getFileExtension(const std::string& filePath) int ID = 0; std::string Library::add(PWSTR path) { - std::string f = getFileExtension(wstrtostr(path)); + std::string npath = wstrtostr(path); + std::string f = getFileExtension(npath); if (f == "epub") { Epub e; - std::string npath = wstrtostr(path); + book curr = e.add(npath); curr.ID = ID; curr.path = npath; + ++ID; collection.push_back(curr); titles.push_back(curr.title); @@ -125,11 +127,11 @@ std::vector Library::getBookTitles() { return titles; } -int Library::remove(int ID) // this actually removes the book from the library. +int Library::remove(int book_ID) // this actually removes the book from the library. { for (int i = 0; i < collection.size(); i++) { - if (collection[i].ID == ID) + if (collection[i].ID == book_ID) { collection.erase(collection.begin() + i); return 1; @@ -138,11 +140,11 @@ int Library::remove(int ID) // this actually removes the book from the library. return -1; } -int Library::grayscale(int ID) +int Library::grayscale(int book_ID) { for (int i = 0; i < collection.size(); i++) { - if (collection[i].ID == ID) + if (collection[i].ID == book_ID) { std::string path = collection[i].path; std::string f = getFileExtension((path));