PlaylistDirectoryCallback.cpp 921 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #include "main.h"
  2. #include "PlaylistDirectoryCallback.h"
  3. PlaylistDirectoryCallback::PlaylistDirectoryCallback(const char *_extlist, const char *winampIni)
  4. : extlist(_extlist), recurse(true)
  5. {
  6. if (winampIni)
  7. {
  8. int rofiob = GetPrivateProfileIntA("winamp", "rofiob", 1, winampIni);
  9. recurse = (rofiob & 2) ? false : true;
  10. }
  11. }
  12. bool PlaylistDirectoryCallback::ShouldRecurse(const wchar_t *path)
  13. {
  14. return recurse;
  15. }
  16. bool PlaylistDirectoryCallback::ShouldLoad(const wchar_t *filename)
  17. {
  18. const wchar_t *ext = PathFindExtensionW(filename);
  19. if (!*ext)
  20. return false;
  21. ext++;
  22. const char *a = extlist;
  23. while (a && *a)
  24. {
  25. if (!lstrcmpiW(AutoWide(a), ext))
  26. return true;
  27. a += lstrlenA(a) + 1;
  28. }
  29. return false;
  30. }
  31. #define CBCLASS PlaylistDirectoryCallback
  32. START_DISPATCH;
  33. CB( IFC_PLAYLISTDIRECTORYCALLBACK_SHOULDRECURSE, ShouldRecurse )
  34. CB( IFC_PLAYLISTDIRECTORYCALLBACK_SHOULDLOAD, ShouldLoad )
  35. END_DISPATCH;