some reconstructions, there is still a lot to do

This commit is contained in:
Alexander Eckart committed 2013-05-06 23:38:59 +02:00
1 parent ec5bdb7742
commit d6a57da73f
5 files changed
+29 -23

No files matched your search

+1 -1
View File
@@ -807,7 +807,7 @@ namespace Vocaluxe.Base
continue;
for (int i = 0; i < CProfiles.Profiles.Length; i++)
{
if (Path.GetFileName(CProfiles.Profiles[i].ProfileFile) == Players[j] && CProfiles.Profiles[i].Active == EOffOn.TR_CONFIG_ON)
if (Path.GetFileName(CProfiles.Profiles[i].FileName) == Players[j] && CProfiles.Profiles[i].Active == EOffOn.TR_CONFIG_ON)
{
//Update Game-infos with player
CGame.Players[j].ProfileID = i;
+12 -12
View File
@@ -83,10 +83,10 @@ namespace Vocaluxe.Base
Avatar = new CAvatar(-1),
GuestProfile = EOffOn.TR_CONFIG_OFF,
Active = EOffOn.TR_CONFIG_ON,
ProfileFile = fileName != "" ? Path.Combine(CSettings.FolderProfiles, fileName) : String.Empty
FileName = fileName != "" ? Path.Combine(CSettings.FolderProfiles, fileName) : String.Empty
};
if (File.Exists(profile.ProfileFile))
if (File.Exists(profile.FileName))
return -1;
_Profiles.Add(profile);
@@ -256,20 +256,20 @@ namespace Vocaluxe.Base
{
if (!ICProfileIDValid(profileID))
return;
if (_Profiles[profileID].ProfileFile == "")
if (_Profiles[profileID].FileName == "")
return;
try
{
//Check if profile saved in config
for (int i = 0; i < CConfig.Players.Length; i++)
{
if (CConfig.Players[i] == _Profiles[profileID].ProfileFile)
if (CConfig.Players[i] == _Profiles[profileID].FileName)
{
CConfig.Players[i] = string.Empty;
CConfig.SaveConfig();
}
}
File.Delete(_Profiles[profileID].ProfileFile);
File.Delete(_Profiles[profileID].FileName);
_Profiles.RemoveAt(profileID);
//Check if profile is selected in game
for (int i = 0; i < CGame.Players.Length; i++)
@@ -282,7 +282,7 @@ namespace Vocaluxe.Base
}
catch (Exception)
{
CLog.LogError("Can't delete Profile File " + _Profiles[profileID].ProfileFile + ".xml");
CLog.LogError("Can't delete Profile File " + _Profiles[profileID].FileName + ".xml");
}
}
@@ -312,7 +312,7 @@ namespace Vocaluxe.Base
if (!ICProfileIDValid(profileID))
return;
if (_Profiles[profileID].ProfileFile == "")
if (_Profiles[profileID].FileName == "")
{
string filename = string.Empty;
foreach (char chr in _Profiles[profileID].PlayerName)
@@ -333,18 +333,18 @@ namespace Vocaluxe.Base
}
CProfile profile = _Profiles[profileID];
profile.ProfileFile = Path.Combine(CSettings.FolderProfiles, filename + ".xml");
profile.FileName = Path.Combine(CSettings.FolderProfiles, filename + ".xml");
_Profiles[profileID] = profile;
}
XmlWriter writer;
try
{
writer = XmlWriter.Create(_Profiles[profileID].ProfileFile, _Settings);
writer = XmlWriter.Create(_Profiles[profileID].FileName, _Settings);
}
catch (Exception e)
{
CLog.LogError("Error creating/opening Profile File " + _Profiles[profileID].ProfileFile + ": " + e.Message);
CLog.LogError("Error creating/opening Profile File " + _Profiles[profileID].FileName + ": " + e.Message);
return;
}
try
@@ -373,9 +373,9 @@ namespace Vocaluxe.Base
private static void _LoadProfile(string fileName)
{
CProfile profile = new CProfile {ProfileFile = Path.Combine(CSettings.FolderProfiles, fileName)};
CProfile profile = new CProfile {FileName = Path.Combine(CSettings.FolderProfiles, fileName)};
CXMLReader xmlReader = CXMLReader.OpenFile(profile.ProfileFile);
CXMLReader xmlReader = CXMLReader.OpenFile(profile.FileName);
if (xmlReader == null)
return;
+5 -5
View File
@@ -170,7 +170,7 @@ namespace Vocaluxe.Screens
//Update Game-infos with new player
CGame.Players[_SelectingFastPlayerNr - 1].ProfileID = _SelectedPlayerNr;
//Update config for default players.
CConfig.Players[_SelectingFastPlayerNr - 1] = CProfiles.Profiles[_SelectedPlayerNr].ProfileFile;
CConfig.Players[_SelectingFastPlayerNr - 1] = CProfiles.Profiles[_SelectedPlayerNr].FileName;
CConfig.SaveConfig();
//Update texture and name
_Statics[_StaticPlayerAvatar[_SelectingFastPlayerNr - 1]].Texture = CProfiles.Profiles[_SelectedPlayerNr].Avatar.Texture;
@@ -418,7 +418,7 @@ namespace Vocaluxe.Screens
//Update Game-infos with new player
CGame.Players[_SelectingSwitchNr].ProfileID = CGame.Players[i].ProfileID;
//Update config for default players.
CConfig.Players[_SelectingSwitchNr] = CProfiles.Profiles[i].ProfileFile;
CConfig.Players[_SelectingSwitchNr] = CProfiles.Profiles[i].FileName;
//Update texture and name
_Statics[_StaticPlayerAvatar[_SelectingSwitchNr]].Texture = CProfiles.Profiles[CGame.Players[i].ProfileID].Avatar.Texture;
_Texts[_TextPlayer[_SelectingSwitchNr]].Text = CProfiles.Profiles[CGame.Players[i].ProfileID].PlayerName;
@@ -436,7 +436,7 @@ namespace Vocaluxe.Screens
//Update Game-infos with new player
CGame.Players[i].ProfileID = _SelectedPlayerNr;
//Update config for default players.
CConfig.Players[i] = CProfiles.Profiles[_SelectedPlayerNr].ProfileFile;
CConfig.Players[i] = CProfiles.Profiles[_SelectedPlayerNr].FileName;
CConfig.SaveConfig();
//Update texture and name
_Statics[_StaticPlayerAvatar[i]].Texture = _ChooseAvatarStatic.Texture;
@@ -476,7 +476,7 @@ namespace Vocaluxe.Screens
//Update Game-infos with new player
CGame.Players[_SelectingFastPlayerNr - 1].ProfileID = _SelectedPlayerNr;
//Update config for default players.
CConfig.Players[_SelectingFastPlayerNr - 1] = CProfiles.Profiles[_SelectedPlayerNr].ProfileFile;
CConfig.Players[_SelectingFastPlayerNr - 1] = CProfiles.Profiles[_SelectedPlayerNr].FileName;
CConfig.SaveConfig();
//Update texture and name
_Statics[_StaticPlayerAvatar[_SelectingFastPlayerNr - 1]].Texture = CProfiles.Profiles[_SelectedPlayerNr].Avatar.Texture;
@@ -519,7 +519,7 @@ namespace Vocaluxe.Screens
//Update Game-infos with new player
CGame.Players[i].ProfileID = _SelectedPlayerNr;
//Update config for default players.
CConfig.Players[i] = CProfiles.Profiles[_SelectedPlayerNr].ProfileFile;
CConfig.Players[i] = CProfiles.Profiles[_SelectedPlayerNr].FileName;
CConfig.SaveConfig();
//Update texture and name
_Statics[_StaticPlayerAvatar[i]].Texture = CProfiles.Profiles[_SelectedPlayerNr].Avatar.Texture;
+10 -4
View File
@@ -7,13 +7,19 @@ namespace VocaluxeLib.Profile
{
public class CAvatar
{
public string FileName;
private int _ID;
public int ID
{
get { return _ID; }
}
public string FileName { get; set; }
public STexture Texture;
// ReSharper disable UnusedParameter.Local
public CAvatar(int dummy)
// ReSharper restore UnusedParameter.Local
public CAvatar(int ID)
{
_ID = ID;
FileName = String.Empty;
Texture = new STexture(-1);
}
+1 -1
View File
@@ -8,7 +8,7 @@ namespace VocaluxeLib.Profile
public class CProfile
{
public string PlayerName;
public string ProfileFile;
public string FileName;
public EGameDifficulty Difficulty;
public CAvatar Avatar;