winamp/Src/Plugins/Library/ml_playlists/PlaylistDirectoryCallback.cpp

42 lines
921 B
C++
Raw Normal View History

2024-09-24 12:54:57 +00:00
#include "main.h"
#include "PlaylistDirectoryCallback.h"
PlaylistDirectoryCallback::PlaylistDirectoryCallback(const char *_extlist, const char *winampIni)
: extlist(_extlist), recurse(true)
{
if (winampIni)
{
int rofiob = GetPrivateProfileIntA("winamp", "rofiob", 1, winampIni);
recurse = (rofiob & 2) ? false : true;
}
}
bool PlaylistDirectoryCallback::ShouldRecurse(const wchar_t *path)
{
return recurse;
}
bool PlaylistDirectoryCallback::ShouldLoad(const wchar_t *filename)
{
const wchar_t *ext = PathFindExtensionW(filename);
if (!*ext)
return false;
ext++;
const char *a = extlist;
while (a && *a)
{
if (!lstrcmpiW(AutoWide(a), ext))
return true;
a += lstrlenA(a) + 1;
}
return false;
}
#define CBCLASS PlaylistDirectoryCallback
START_DISPATCH;
CB( IFC_PLAYLISTDIRECTORYCALLBACK_SHOULDRECURSE, ShouldRecurse )
CB( IFC_PLAYLISTDIRECTORYCALLBACK_SHOULDLOAD, ShouldLoad )
END_DISPATCH;