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