Пример #1
0
void SongList::AddDirectory(Directory Dir, bool VSRGActive, bool DotcurActive)
{
	SongList* NewList = new SongList(this);

	ListEntry NewEntry;

	NewEntry.EntryName = Dir.path().substr(Dir.path().find_last_of('/')+1);
	NewEntry.Kind = ListEntry::Directory;
	NewEntry.Data = NewList;

	std::vector<VSRG::Song*> Songs7K;
	std::vector<dotcur::Song*> SongsDC;
	std::vector<String> Listing;

	Dir.ListDirectory(Listing, Directory::FS_DIR);
	
	for (std::vector<String>::iterator i = Listing.begin();
		i != Listing.end();
		i++)
	{
		if (VSRGActive)
			LoadSong7KFromDir(Dir / *i, Songs7K);
		
		if (DotcurActive)
			LoadSongDCFromDir(Dir / *i, SongsDC);

		if (!SongsDC.size() && !Songs7K.size())
			NewList->AddDirectory(Dir / *i, VSRGActive, DotcurActive);

		if (Songs7K.size())
		{
			for (std::vector<VSRG::Song*>::iterator j = Songs7K.begin();
				j != Songs7K.end();
				j++)
			{
				NewList->AddSong(*j);
			}

			Songs7K.clear();
		}

		if (SongsDC.size())
		{
			for (std::vector<dotcur::Song*>::iterator j = SongsDC.begin();
				j != SongsDC.end();
				j++)
			{
				NewList->AddSong(*j);
			}

			SongsDC.clear();
		}
	}

	if (NewList->GetNumEntries())
		mChildren.push_back(NewEntry);
	else
		delete NewList;
}
Пример #2
0
void SongLoader::GetSongListDC(std::vector<dotcur::Song*> &OutVec, std::filesystem::path Dir)
{
    std::vector <std::filesystem::path> Listing = Utility::GetFileListing(Dir);

    for (auto i: Listing)
    {
        Log::Printf("%s... ", i.c_str());
        LoadSongDCFromDir(i, OutVec);
        Log::Printf("ok\n");
    }
}