Improved handling of adding new profiles.

This commit is contained in:
Florian Küpper committed 2013-04-18 13:22:10 +02:00
1 parent 3a12df643b
commit aeaa38cf22
1 file changed
+25
+25
View File
@@ -79,6 +79,9 @@ namespace Vocaluxe.Base
public static void LoadProfiles()
{
List<SProfile> _OldProfiles = null;
if (_Profiles != null)
_OldProfiles = _Profiles;
_Profiles = new List<SProfile>();
List<string> files = new List<string>();
files.AddRange(CHelper.ListFiles(CSettings.FolderProfiles, "*.xml", true, true));
@@ -87,6 +90,28 @@ namespace Vocaluxe.Base
_LoadProfile(file);
_SortProfilesByName();
//Find profile-id if new profile is created
if (_OldProfiles != null)
{
int _NewProfileId = -1;
for (int i = 0; i < _OldProfiles.Count; i++)
{
if (_Profiles[i].ProfileFile != _OldProfiles[i].ProfileFile)
{
_NewProfileId = i;
break;
}
}
if (_NewProfileId != -1)
{
for (int i = 0; i < CGame.Player.Length; i++)
{
if (CGame.Player[i].ProfileID >= _NewProfileId)
CGame.Player[i].ProfileID++;
}
}
}
}
public static void LoadAvatars()