copy edits from import dirs too

This commit is contained in:
Chris Danford
2006-03-27 19:28:10 +00:00
parent 59aaab0375
commit 9bee8d3b4a
8 changed files with 57 additions and 34 deletions
+2 -1
View File
@@ -1242,7 +1242,8 @@ HelpText=Mit &LEFT;&RIGHT; wählen, dann START drücken
[ScreenServiceAction]
%d added, %d overwritten=%d hinzugefügt, %d überschrieben
%d copied, %d overwritten=%d kopiert, %d überschrieben
%d copied=%d kopiert
%d overwritten=%d überschrieben
%d deleted=%d gelöscht
%d edits cleared, %d errors.=%d Bearbeitungen geleert, %d Fehler
%d failed=%d durchgefallen
+2 -1
View File
@@ -1216,7 +1216,8 @@ HelpText=Use &LEFT; &RIGHT; to select, then press START
[ScreenServiceAction]
%d added, %d overwritten=%d added, %d overwritten
%d copied, %d overwritten=%d copied, %d overwritten
%d copied=%d copied
%d overwritten=%d overwritten
%d deleted=%d deleted
%d edits cleared, %d errors.=%d edits cleared, %d errors.
%d failed=%d failed
+2 -1
View File
@@ -1241,7 +1241,8 @@ HelpText=Utiliza &LEFT; &RIGHT; para seleccionar, después presiona START
[ScreenServiceAction]
%d added, %d overwritten=%d añadido, %d sobreescrito
%d copied, %d overwritten=%d copiados, %d sobreescrito
%d copied=%d copiados
%d overwritten=%d sobreescrito
%d deleted=%d eliminados
%d edits cleared, %d errors.=ediciones %d borradas, errores %d
%d failed=%d fallo
+2 -1
View File
@@ -1241,7 +1241,8 @@ HelpText=Utilisez &LEFT; &RIGHT; pour sélectionner, et appuyez sur DEMARRER
[ScreenServiceAction]
%d added, %d overwritten=%d ajoutés, %d écrasés
%d copied, %d overwritten=%d copiés, %d écrasés
%d copied=%d copiés
%d overwritten=%d écrasés
%d deleted=%d effacés
%d edits cleared, %d errors.=%d modifications effacées, %d erreurs.
%d failed=%d échecs
+2 -1
View File
@@ -1241,7 +1241,8 @@ HelpText=Usa &LEFT; &RIGHT; poi, per selezionare, premi AVVIA
[ScreenServiceAction]
%d added, %d overwritten=%d aggiunto, %d sovrascritto
%d copied, %d overwritten=%d copiato, %d sovrascritto
%d copied=%d copiato
%d overwritten=%d sovrascritto
%d deleted=%d cancellato
%d edits cleared, %d errors.=%d modifiche eliminate, %d errori
%d failed=%d non riuscito
+1 -1
View File
@@ -189,7 +189,7 @@ bool ProfileManager::LoadLocalProfileFromMachine( PlayerNumber pn )
return true;
}
void ProfileManager::GetMemoryCardProfileDirectoriesToTry( vector<RString> &asDirsToTry ) const
void ProfileManager::GetMemoryCardProfileDirectoriesToTry( vector<RString> &asDirsToTry )
{
/* Try to load the preferred profile. */
asDirsToTry.push_back( PREFSMAN->m_sMemoryCardProfileSubdir );
+1 -1
View File
@@ -108,6 +108,7 @@ public:
void AddCategoryScore( StepsType st, RankingCategory rc, PlayerNumber pn, const HighScore &hs, int &iPersonalIndexOut, int &iMachineIndexOut );
void IncrementCategoryPlayCount( StepsType st, RankingCategory rc, PlayerNumber pn );
static void GetMemoryCardProfileDirectoriesToTry( vector<RString> &asDirsToTry );
// Lua
void PushSelf( lua_State *L );
@@ -116,7 +117,6 @@ public:
private:
ProfileLoadResult LoadProfile( PlayerNumber pn, RString sProfileDir, bool bIsMemCard );
void GetMemoryCardProfileDirectoriesToTry( vector<RString> &asDirsToTry ) const;
// Directory that contains the profile. Either on local machine or
// on a memory card.
+45 -27
View File
@@ -221,6 +221,31 @@ static void CopyEdits( const RString &sFromProfileDir, const RString &sToProfile
}
static LocalizedString EDITS_NOT_COPIED ( "ScreenServiceAction", "Edits not copied - No memory cards ready." );
static LocalizedString COPIED_TO_CARD ( "ScreenServiceAction", "Copied to P%d card:" );
static LocalizedString COPIED ( "ScreenServiceAction", "%d copied" );
static LocalizedString OVERWRITTEN ( "ScreenServiceAction", "%d overwritten" );
static LocalizedString ADDED_AND_OVERWRITTEN ( "ScreenServiceAction", "%d added, %d overwritten" );
static LocalizedString FAILED ( "ScreenServiceAction", "%d failed" );
static LocalizedString DELETED ( "ScreenServiceAction", "%d deleted" );
static RString CopyEdits( const RString &sFromProfileDir, const RString &sToProfileDir, const RString &sDisplayDir )
{
int iNumAttempted = 0;
int iNumSuccessful = 0;
int iNumOverwritten = 0;
CopyEdits( sFromProfileDir, sToProfileDir, iNumAttempted, iNumSuccessful, iNumOverwritten );
vector<RString> vs;
vs.push_back( sDisplayDir );
vs.push_back( ssprintf( COPIED.GetValue(), iNumSuccessful ) );
vs.push_back( ssprintf( OVERWRITTEN.GetValue(), iNumOverwritten ) );
if( iNumSuccessful < iNumAttempted )
vs.push_back( ssprintf( FAILED.GetValue(), iNumAttempted-iNumSuccessful ) );
return join( "\n", vs );
}
static void SyncFiles( const RString &sFromDir, const RString &sToDir, const RString &sMask, int &iNumAdded, int &iNumDeleted, int &iNumOverwritten, int &iNumFailed )
{
vector<RString> vsFilesSource;
@@ -275,12 +300,6 @@ static void SyncEdits( const RString &sFromDir, const RString &sToDir, int &iNum
SyncFiles( sFromDir + EDIT_COURSES_SUBDIR, sToDir + EDIT_COURSES_SUBDIR, "*.crs", iNumAdded, iNumDeleted, iNumOverwritten, iNumFailed );
}
static LocalizedString EDITS_NOT_COPIED( "ScreenServiceAction", "Edits not copied - No memory cards ready." );
static LocalizedString COPIED_TO_CARD( "ScreenServiceAction", "Copied to P%d card:" );
static LocalizedString COPIED_AND_OVERWRITTEN( "ScreenServiceAction", "%d copied, %d overwritten" );
static LocalizedString ADDED_AND_OVERWRITTEN( "ScreenServiceAction", "%d added, %d overwritten" );
static LocalizedString FAILED( "ScreenServiceAction", "%d failed" );
static LocalizedString DELETED( "ScreenServiceAction", "%d deleted" );
static RString CopyEditsMachineToMemoryCard()
{
PlayerNumber pn = GetFirstReadyMemoryCard();
@@ -290,21 +309,17 @@ static RString CopyEditsMachineToMemoryCard()
if( !MEMCARDMAN->IsMounted(pn) )
MEMCARDMAN->MountCard(pn);
int iNumAttempted = 0;
int iNumSuccessful = 0;
int iNumOverwritten = 0;
RString sFromDir = PROFILEMAN->GetProfileDir(ProfileSlot_Machine);
RString sToDir = MEM_CARD_MOUNT_POINT[pn] + (RString)PREFSMAN->m_sMemoryCardProfileSubdir + "/";
CopyEdits( sFromDir, sToDir, iNumAttempted, iNumSuccessful, iNumOverwritten );
vector<RString> vs;
vs.push_back( ssprintf( COPIED_TO_CARD.GetValue(), pn+1 ) );
RString s = CopyEdits( sFromDir, sToDir, PREFSMAN->m_sMemoryCardProfileSubdir );
vs.push_back( s );
MEMCARDMAN->UnmountCard(pn);
RString sRet = ssprintf( COPIED_TO_CARD.GetValue(), pn+1 ) + " ";
sRet += ssprintf( COPIED_AND_OVERWRITTEN.GetValue(), iNumSuccessful, iNumOverwritten );
if( iNumSuccessful < iNumAttempted )
sRet += RString("; ") + ssprintf( FAILED.GetValue(), iNumAttempted-iNumSuccessful );
return sRet;
return join("\n\n",vs);
}
static RString SyncEditsMachineToMemoryCard()
@@ -346,13 +361,20 @@ static RString CopyEditsMemoryCardToMachine()
if( !MEMCARDMAN->IsMounted(pn) )
MEMCARDMAN->MountCard(pn);
int iNumAttempted = 0;
int iNumSuccessful = 0;
int iNumOverwritten = 0;
RString sFromDir = MEM_CARD_MOUNT_POINT[pn] + (RString)PREFSMAN->m_sMemoryCardProfileSubdir + "/";
RString sToDir = PROFILEMAN->GetProfileDir(ProfileSlot_Machine);
CopyEdits( sFromDir, sToDir, iNumAttempted, iNumSuccessful, iNumOverwritten );
vector<RString> vsSubDirs;
ProfileManager::GetMemoryCardProfileDirectoriesToTry( vsSubDirs );
vector<RString> vs;
vs.push_back( ssprintf( COPIED_TO_CARD.GetValue(), pn+1 ) );
FOREACH_CONST( RString, vsSubDirs, sSubDir )
{
RString sFromDir = MEM_CARD_MOUNT_POINT[pn] + (RString)(*sSubDir) + "/";
RString sToDir = PROFILEMAN->GetProfileDir(ProfileSlot_Machine);
RString s = CopyEdits( sFromDir, sToDir, *sSubDir );
vs.push_back( s );
}
MEMCARDMAN->UnmountCard(pn);
@@ -360,11 +382,7 @@ static RString CopyEditsMemoryCardToMachine()
PROFILEMAN->SaveMachineProfile();
PROFILEMAN->LoadMachineProfile();
RString sRet = ssprintf( COPIED_FROM_CARD.GetValue(), pn+1 ) + " ";
sRet += ssprintf( COPIED_AND_OVERWRITTEN.GetValue(), iNumSuccessful, iNumOverwritten );
if( iNumSuccessful < iNumAttempted )
sRet += RString("; ") + ssprintf( FAILED.GetValue(), iNumAttempted-iNumSuccessful );
return sRet;
return join("\n\n",vs);
}
static LocalizedString PREFERENCES_RESET( "ScreenServiceAction", "Preferences reset." );