split out SongManager::LoadEditsFromDir
This commit is contained in:
@@ -1183,30 +1183,34 @@ void SongManager::LoadAllFromProfile( ProfileSlot s )
|
|||||||
CString sProfileDir = PROFILEMAN->GetProfileDir( s );
|
CString sProfileDir = PROFILEMAN->GetProfileDir( s );
|
||||||
if( sProfileDir.empty() )
|
if( sProfileDir.empty() )
|
||||||
return; // skip
|
return; // skip
|
||||||
|
|
||||||
|
LoadEditsFromDir( sProfileDir, s );
|
||||||
|
}
|
||||||
|
|
||||||
|
void SongManager::LoadEditsFromDir( const CString &sDir, ProfileSlot slot )
|
||||||
|
{
|
||||||
//
|
//
|
||||||
// Load all .edit files.
|
// Load all .edit files.
|
||||||
//
|
//
|
||||||
|
CString sEditsDir = sDir+"Edits/";
|
||||||
|
|
||||||
|
CStringArray asEditsFilesWithPath;
|
||||||
|
GetDirListing( sEditsDir+"*.edit", asEditsFilesWithPath, false, true );
|
||||||
|
|
||||||
|
unsigned size = min( asEditsFilesWithPath.size(), (unsigned)MAX_EDITS_PER_PROFILE );
|
||||||
|
|
||||||
|
for( unsigned i=0; i<size; i++ )
|
||||||
{
|
{
|
||||||
CString sEditsDir = sProfileDir+"Edits/";
|
CString fn = asEditsFilesWithPath[i];
|
||||||
|
|
||||||
CStringArray asEditsFilesWithPath;
|
int iBytes = FILEMAN->GetFileSizeInBytes( fn );
|
||||||
GetDirListing( sEditsDir+"*.edit", asEditsFilesWithPath, false, true );
|
if( iBytes > MAX_EDIT_SIZE_BYTES )
|
||||||
|
|
||||||
unsigned size = min( asEditsFilesWithPath.size(), (unsigned)MAX_EDITS_PER_PROFILE );
|
|
||||||
|
|
||||||
for( unsigned i=0; i<size; i++ )
|
|
||||||
{
|
{
|
||||||
CString fn = asEditsFilesWithPath[i];
|
LOG->Warn( "The file '%s' is unreasonably large. It won't be loaded.", fn.c_str() );
|
||||||
|
continue;
|
||||||
int iBytes = FILEMAN->GetFileSizeInBytes( fn );
|
|
||||||
if( iBytes > MAX_EDIT_SIZE_BYTES )
|
|
||||||
{
|
|
||||||
LOG->Warn( "The file '%s' is unreasonably large. It won't be loaded.", fn.c_str() );
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
SMLoader::LoadEdit( fn, s );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SMLoader::LoadEdit( fn, slot );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ public:
|
|||||||
void SetPreferences();
|
void SetPreferences();
|
||||||
|
|
||||||
void LoadAllFromProfile( ProfileSlot s ); // songs, edits
|
void LoadAllFromProfile( ProfileSlot s ); // songs, edits
|
||||||
|
void LoadEditsFromDir( const CString &sDir, ProfileSlot slot );
|
||||||
int GetNumStepsLoadedFromProfile();
|
int GetNumStepsLoadedFromProfile();
|
||||||
void FreeAllLoadedFromProfiles();
|
void FreeAllLoadedFromProfiles();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user