pull out common memory card profile code (in prep for import handling)
This commit is contained in:
@@ -1014,6 +1014,15 @@ void Profile::LoadEditableDataFromDir( CString sDir )
|
|||||||
CLAMP( m_iWeightPounds, 50, 500 );
|
CLAMP( m_iWeightPounds, 50, 500 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CString Profile::FastLoadProfileNameFromMemoryCard( CString sDir )
|
||||||
|
{
|
||||||
|
CString sProfileDir = sDir + PREFSMAN->m_sMemoryCardProfileSubdir + '/';
|
||||||
|
|
||||||
|
Profile profile;
|
||||||
|
profile.LoadEditableDataFromDir( sProfileDir );
|
||||||
|
return profile.GetDisplayName();
|
||||||
|
}
|
||||||
|
|
||||||
void Profile::LoadGeneralDataFromNode( const XNode* pNode )
|
void Profile::LoadGeneralDataFromNode( const XNode* pNode )
|
||||||
{
|
{
|
||||||
ASSERT( pNode->m_sName == "GeneralData" );
|
ASSERT( pNode->m_sName == "GeneralData" );
|
||||||
|
|||||||
@@ -283,6 +283,7 @@ public:
|
|||||||
bool SaveAllToDir( CString sDir, bool bSignData ) const;
|
bool SaveAllToDir( CString sDir, bool bSignData ) const;
|
||||||
|
|
||||||
void LoadEditableDataFromDir( CString sDir );
|
void LoadEditableDataFromDir( CString sDir );
|
||||||
|
static CString FastLoadProfileNameFromMemoryCard( CString sDir );
|
||||||
LoadResult LoadStatsXmlFromNode( const XNode* pNode );
|
LoadResult LoadStatsXmlFromNode( const XNode* pNode );
|
||||||
void LoadGeneralDataFromNode( const XNode* pNode );
|
void LoadGeneralDataFromNode( const XNode* pNode );
|
||||||
void LoadSongScoresFromNode( const XNode* pNode );
|
void LoadSongScoresFromNode( const XNode* pNode );
|
||||||
|
|||||||
@@ -238,14 +238,8 @@ bool MemoryCardDriverThreaded_Linux::DoOneUpdate( bool bMount, vector<UsbStorage
|
|||||||
d.m_State = UsbStorageDevice::STATE_READY;
|
d.m_State = UsbStorageDevice::STATE_READY;
|
||||||
|
|
||||||
FILEMAN->Mount( "dir", d.sOsMountDir, TEMP_MOUNT_POINT );
|
FILEMAN->Mount( "dir", d.sOsMountDir, TEMP_MOUNT_POINT );
|
||||||
|
d.sName = Profile::FastLoadProfileNameFromMemoryCard( TEMP_MOUNT_POINT );
|
||||||
Profile profile;
|
|
||||||
CString sProfileDir = TEMP_MOUNT_POINT + PREFSMAN->m_sMemoryCardProfileSubdir + '/';
|
|
||||||
profile.LoadEditableDataFromDir( sProfileDir );
|
|
||||||
d.sName = profile.GetDisplayName();
|
|
||||||
|
|
||||||
FILEMAN->Unmount( "dir", d.sOsMountDir, TEMP_MOUNT_POINT );
|
FILEMAN->Unmount( "dir", d.sOsMountDir, TEMP_MOUNT_POINT );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ExecuteCommand( "umount " + d.sOsMountDir );
|
ExecuteCommand( "umount " + d.sOsMountDir );
|
||||||
|
|||||||
@@ -99,11 +99,7 @@ bool MemoryCardDriverThreaded_Windows::DoOneUpdate( bool bMount, vector<UsbStora
|
|||||||
FILEMAN->Mount( "dir", usbd.sOsMountDir, TEMP_MOUNT_POINT_INTERNAL );
|
FILEMAN->Mount( "dir", usbd.sOsMountDir, TEMP_MOUNT_POINT_INTERNAL );
|
||||||
FILEMAN->Mount( "timeout", TEMP_MOUNT_POINT_INTERNAL, TEMP_MOUNT_POINT );
|
FILEMAN->Mount( "timeout", TEMP_MOUNT_POINT_INTERNAL, TEMP_MOUNT_POINT );
|
||||||
|
|
||||||
Profile profile;
|
usbd.sName = Profile::FastLoadProfileNameFromMemoryCard( TEMP_MOUNT_POINT );
|
||||||
CString sProfileDir = TEMP_MOUNT_POINT + PREFSMAN->m_sMemoryCardProfileSubdir + '/';
|
|
||||||
profile.LoadEditableDataFromDir( sProfileDir );
|
|
||||||
usbd.bIsNameAvailable = true;
|
|
||||||
usbd.sName = profile.GetDisplayName();
|
|
||||||
|
|
||||||
FILEMAN->Unmount( "timeout", TEMP_MOUNT_POINT_INTERNAL, TEMP_MOUNT_POINT );
|
FILEMAN->Unmount( "timeout", TEMP_MOUNT_POINT_INTERNAL, TEMP_MOUNT_POINT );
|
||||||
FILEMAN->Unmount( "dir", usbd.sOsMountDir, TEMP_MOUNT_POINT_INTERNAL );
|
FILEMAN->Unmount( "dir", usbd.sOsMountDir, TEMP_MOUNT_POINT_INTERNAL );
|
||||||
|
|||||||
Reference in New Issue
Block a user