Automatic cleanup/formating

This commit is contained in:
Flamefire committed 2013-04-24 01:26:36 +02:00
1 parent b1e28ae7bc
commit 69d8af4e87
22 files changed
+38 -45

No files matched your search

@@ -636,7 +636,8 @@ namespace VocaluxeLib.PartyModes.Challenge
int pos = 1; int pos = 1;
int lastPoints = 0; int lastPoints = 0;
int lastSingPoints = 0; int lastSingPoints = 0;
foreach (CResultTableRow resultRow in _GameData.ResultTable) { foreach (CResultTableRow resultRow in _GameData.ResultTable)
{
if (lastPoints > resultRow.NumGamePoints || lastSingPoints > resultRow.NumSingPoints) if (lastPoints > resultRow.NumGamePoints || lastSingPoints > resultRow.NumSingPoints)
pos++; pos++;
resultRow.Position = pos; resultRow.Position = pos;
@@ -409,7 +409,8 @@ namespace VocaluxeLib.PartyModes.Challenge
_RoundsTable.Add(rtr); _RoundsTable.Add(rtr);
} }
//Create statics and texts for rounds //Create statics and texts for rounds
foreach (CRoundsTableRow roundRow in _RoundsTable) { foreach (CRoundsTableRow roundRow in _RoundsTable)
{
//Round-number //Round-number
CText text = GetNewText(_Texts[_TextRoundNumber]); CText text = GetNewText(_Texts[_TextRoundNumber]);
_AddText(text); _AddText(text);
@@ -451,7 +452,8 @@ namespace VocaluxeLib.PartyModes.Challenge
float delta = _Texts[_TextRoundNumber].Height; float delta = _Texts[_TextRoundNumber].Height;
//Update statics and texts for rounds //Update statics and texts for rounds
foreach (CRoundsTableRow roundRow in _RoundsTable) { foreach (CRoundsTableRow roundRow in _RoundsTable)
{
//Round-number //Round-number
roundRow.Number.X = numberX; roundRow.Number.X = numberX;
roundRow.Number.Y = numberY; roundRow.Number.Y = numberY;
@@ -157,21 +157,15 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
//filter against PlayerNrDemand //filter against PlayerNrDemand
List<CCombination> combsFiltered = new List<CCombination>(); List<CCombination> combsFiltered = new List<CCombination>();
if (playerNrDemand != null) if (playerNrDemand != null)
{
combsFiltered.AddRange(_Combs.Where(t => t.IsAvailableAll(playerNrDemand))); combsFiltered.AddRange(_Combs.Where(t => t.IsAvailableAll(playerNrDemand)));
}
//1st fallback //1st fallback
if (playerNrDemand != null && combsFiltered.Count == 0) if (playerNrDemand != null && combsFiltered.Count == 0)
{
combsFiltered.AddRange(_Combs.Where(t => t.IsAvailableSomeone(playerNrDemand))); combsFiltered.AddRange(_Combs.Where(t => t.IsAvailableSomeone(playerNrDemand)));
}
//2nd fallback //2nd fallback
if (combsFiltered.Count == 0) if (combsFiltered.Count == 0)
{
combsFiltered.AddRange(_Combs); combsFiltered.AddRange(_Combs);
}
int num = combsFiltered.Count; int num = combsFiltered.Count;
int rand = _Rand.Next(num); int rand = _Rand.Next(num);
@@ -702,7 +702,8 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
int pos = 1; int pos = 1;
int lastPoints = 0; int lastPoints = 0;
int lastSingPoints = 0; int lastSingPoints = 0;
foreach (CResultTableRow resultRow in _GameData.ResultTable) { foreach (CResultTableRow resultRow in _GameData.ResultTable)
{
if (lastPoints > resultRow.NumGamePoints || lastSingPoints > resultRow.NumSingPoints) if (lastPoints > resultRow.NumGamePoints || lastSingPoints > resultRow.NumSingPoints)
pos++; pos++;
resultRow.Position = pos; resultRow.Position = pos;
@@ -409,7 +409,8 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
_RoundsTable.Add(rtr); _RoundsTable.Add(rtr);
} }
//Create statics and texts for rounds //Create statics and texts for rounds
foreach (CRoundsTableRow roundRow in _RoundsTable) { foreach (CRoundsTableRow roundRow in _RoundsTable)
{
//Round-number //Round-number
CText text = GetNewText(_Texts[_TextRoundNumber]); CText text = GetNewText(_Texts[_TextRoundNumber]);
_AddText(text); _AddText(text);
@@ -451,7 +452,8 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
float delta = _Texts[_TextRoundNumber].Height; float delta = _Texts[_TextRoundNumber].Height;
//Update statics and texts for rounds //Update statics and texts for rounds
foreach (CRoundsTableRow roundRow in _RoundsTable) { foreach (CRoundsTableRow roundRow in _RoundsTable)
{
//Round-number //Round-number
roundRow.Number.X = numberX; roundRow.Number.X = numberX;
roundRow.Number.Y = numberY; roundRow.Number.Y = numberY;
@@ -453,7 +453,8 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
private bool _OnAdd() private bool _OnAdd()
{ {
foreach (CPlayerChooseButton chooseButton in _PlayerChooseButtons) { foreach (CPlayerChooseButton chooseButton in _PlayerChooseButtons)
{
if (chooseButton.Button.Selected && chooseButton.ProfileID != -1) if (chooseButton.Button.Selected && chooseButton.ProfileID != -1)
{ {
if (_Data.ScreenNames.ProfileIDs.Count < _NumPlayer) if (_Data.ScreenNames.ProfileIDs.Count < _NumPlayer)
@@ -173,7 +173,8 @@ namespace VocaluxeLib.PartyModes.TicTacToe
_OldMouseX = mouseEvent.X; _OldMouseX = mouseEvent.X;
_OldMouseY = mouseEvent.Y; _OldMouseY = mouseEvent.Y;
//Check if mouse if over tile //Check if mouse if over tile
foreach (CPlayerChooseButton chooseButton in _PlayerChooseButtons) { foreach (CPlayerChooseButton chooseButton in _PlayerChooseButtons)
{
if (chooseButton.Button.Selected) if (chooseButton.Button.Selected)
{ {
_SelectedPlayerNr = chooseButton.ProfileID; _SelectedPlayerNr = chooseButton.ProfileID;
@@ -445,9 +446,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
bool visible = false; bool visible = false;
//Show profile only if active //Show profile only if active
if (CBase.Profiles.GetProfiles()[i].Active == EOffOn.TR_CONFIG_ON) if (CBase.Profiles.GetProfiles()[i].Active == EOffOn.TR_CONFIG_ON)
{
visible = _Data.ScreenNames.ProfileIDsTeam1.All(t => t != i) && _Data.ScreenNames.ProfileIDsTeam2.All(t => t != i); visible = _Data.ScreenNames.ProfileIDsTeam1.All(t => t != i) && _Data.ScreenNames.ProfileIDsTeam2.All(t => t != i);
}
if (visible) if (visible)
_PlayerChooseButtonsVisibleProfiles.Add(i); _PlayerChooseButtonsVisibleProfiles.Add(i);
} }
+2 -1
View File
@@ -121,7 +121,8 @@ namespace Vocaluxe.Base
public static int BackgroundMusicVolume public static int BackgroundMusicVolume
{ {
get { return _BackgroundMusicVolume; } get { return _BackgroundMusicVolume; }
set { set
{
if (value < 0) if (value < 0)
_BackgroundMusicVolume = 0; _BackgroundMusicVolume = 0;
else if (value > 100) else if (value > 100)
+2 -1
View File
@@ -265,7 +265,8 @@ namespace Vocaluxe.Base
CLog.StopBenchmark(1, "Load Theme " + Enum.GetNames(typeof(EScreens))[i]); CLog.StopBenchmark(1, "Load Theme " + Enum.GetNames(typeof(EScreens))[i]);
} }
foreach (IMenu popup in _PopupScreens) { foreach (IMenu popup in _PopupScreens)
{
popup.Init(); popup.Init();
popup.LoadTheme(CTheme.GetThemeScreensPath(-1)); popup.LoadTheme(CTheme.GetThemeScreensPath(-1));
} }
+2 -1
View File
@@ -101,7 +101,8 @@ namespace Vocaluxe.Base
int[] pmIDs = new int[_PartyModes.Count]; int[] pmIDs = new int[_PartyModes.Count];
_PartyModes.Keys.CopyTo(pmIDs, 0); _PartyModes.Keys.CopyTo(pmIDs, 0);
foreach (int pmID in pmIDs) { foreach (int pmID in pmIDs)
{
if (pmID != _NormalGameModeID) if (pmID != _NormalGameModeID)
{ {
SPartyMode mode; SPartyMode mode;
+2 -1
View File
@@ -262,7 +262,8 @@ namespace Vocaluxe.Base
string artist = line.Substring(0, pos - 1).Trim(); string artist = line.Substring(0, pos - 1).Trim();
string title = line.Substring(pos + 1, line.Length - pos - 1).Trim(); string title = line.Substring(pos + 1, line.Length - pos - 1).Trim();
bool found = false; bool found = false;
foreach (CSong song in allSongs) { foreach (CSong song in allSongs)
{
if (song.Artist == artist && song.Title == title) if (song.Artist == artist && song.Title == title)
{ {
pl.AddSong(song.ID); pl.AddSong(song.ID);
-1
View File
@@ -47,7 +47,6 @@ namespace Vocaluxe.Base
public static EGameState GameState = EGameState.Start; public static EGameState GameState = EGameState.Start;
//Adjusting of programName and version now in the assembly config. //Adjusting of programName and version now in the assembly config.
//I'd use the major and minor for Main releases, build number for every public release and revision for every bugfix version without any features //I'd use the major and minor for Main releases, build number for every public release and revision for every bugfix version without any features
//As it is different than before, this is open for discussion. //As it is different than before, this is open for discussion.
+1 -4
View File
@@ -89,10 +89,7 @@ namespace Vocaluxe.Base
public static int NumVisibleSongs public static int NumVisibleSongs
{ {
get get { return Sorter.SortedSongs.Count(sp => sp.Visible); }
{
return Sorter.SortedSongs.Count(sp => sp.Visible);
}
} }
public static int NumCategories public static int NumCategories
-1
View File
@@ -28,7 +28,6 @@ namespace Vocaluxe.Lib.Sound
//static float LastPosition; //static float LastPosition;
#region log #region log
private static void _LogHandler(string text) private static void _LogHandler(string text)
{ {
CLog.LogError(text); CLog.LogError(text);
+2 -3
View File
@@ -52,8 +52,7 @@ namespace Vocaluxe.Lib.Sound.PortAudio
public struct SPaDeviceInfo public struct SPaDeviceInfo
{ {
public int StructVersion; public int StructVersion;
[MarshalAs(UnmanagedType.LPStr)] [MarshalAs(UnmanagedType.LPStr)] public string Name;
public string Name;
public int HostApi; public int HostApi;
public int MaxInputChannels; public int MaxInputChannels;
public int MaxOutputChannels; public int MaxOutputChannels;
@@ -554,8 +553,8 @@ namespace Vocaluxe.Lib.Sound.PortAudio
public static extern void Pa_Sleep(int msec); public static extern void Pa_Sleep(int msec);
#endregion #endregion
} }
// ReSharper restore UnusedMember.Global // ReSharper restore UnusedMember.Global
// ReSharper restore FieldCanBeMadeReadOnly.Global // ReSharper restore FieldCanBeMadeReadOnly.Global
// ReSharper restore MemberCanBePrivate.Global // ReSharper restore MemberCanBePrivate.Global
} }
+2 -1
View File
@@ -201,7 +201,8 @@ namespace Vocaluxe.Screens
//Prepare Text //Prepare Text
int lastY = 280; int lastY = 280;
foreach (string[] paragraph in _Paragraphs) { foreach (string[] paragraph in _Paragraphs)
{
string line = ""; string line = "";
for (int e = 0; e < paragraph.Length; e++) for (int e = 0; e < paragraph.Length; e++)
{ {
-4
View File
@@ -631,10 +631,8 @@ namespace Vocaluxe.Screens
if (CGame.GetNumSongs() > 1) if (CGame.GetNumSongs() > 1)
{ {
for (int i = 0; i < CGame.NumPlayer; i++) for (int i = 0; i < CGame.NumPlayer; i++)
{
CGame.Player[i].LineNr = (i + 1) % 2; CGame.Player[i].LineNr = (i + 1) % 2;
} }
}
else else
{ {
for (int i = 0; i < CGame.NumPlayer; i++) for (int i = 0; i < CGame.NumPlayer; i++)
@@ -644,9 +642,7 @@ namespace Vocaluxe.Screens
_SetDuetLyricsVisibility(song.IsDuet); _SetDuetLyricsVisibility(song.IsDuet);
for (int p = 0; p < CGame.NumPlayer; p++) for (int p = 0; p < CGame.NumPlayer; p++)
{
_NoteLines[p] = _SingNotes[_SingBars].AddPlayer(_SingNotes[_SingBars].BarPos[p, CGame.NumPlayer - 1], CTheme.GetPlayerColor(p + 1), p); _NoteLines[p] = _SingNotes[_SingBars].AddPlayer(_SingNotes[_SingBars].BarPos[p, CGame.NumPlayer - 1], CTheme.GetPlayerColor(p + 1), p);
}
/* /*
case 4: case 4:
-2
View File
@@ -802,9 +802,7 @@ namespace Vocaluxe.Screens
if (_AvailableGameModes.Count >= _SelectSlides[_SelectSlideOptionsMode].Selection) if (_AvailableGameModes.Count >= _SelectSlides[_SelectSlideOptionsMode].Selection)
gm = _AvailableGameModes[_SelectSlides[_SelectSlideOptionsMode].Selection]; gm = _AvailableGameModes[_SelectSlides[_SelectSlideOptionsMode].Selection];
else else
{
gm = CSongs.VisibleSongs[songNr].IsDuet ? EGameMode.TR_GAMEMODE_DUET : EGameMode.TR_GAMEMODE_NORMAL; gm = CSongs.VisibleSongs[songNr].IsDuet ? EGameMode.TR_GAMEMODE_DUET : EGameMode.TR_GAMEMODE_NORMAL;
}
CGame.Reset(); CGame.Reset();
CGame.ClearSongs(); CGame.ClearSongs();
+4 -2
View File
@@ -106,10 +106,12 @@ namespace VocaluxeLib.Menu
{ {
_PrepareTiles(); _PrepareTiles();
_PlayerSelector = new CStatic(_PartyModeID) { _PlayerSelector = new CStatic(_PartyModeID)
{
Texture = _TextureTileSelected, Texture = _TextureTileSelected,
Rect = new SRectF(0, 0, _TileW + 6, _TileH + 6, Rect.Z - 0.5f), Rect = new SRectF(0, 0, _TileW + 6, _TileH + 6, Rect.Z - 0.5f),
Visible = false}; Visible = false
};
_UpdateVisibleProfiles(); _UpdateVisibleProfiles();
+4 -1
View File
@@ -500,7 +500,9 @@ namespace VocaluxeLib.Menu
{ {
if (keyEvent.KeyPressed && !Char.IsControl(keyEvent.Unicode)) if (keyEvent.KeyPressed && !Char.IsControl(keyEvent.Unicode))
_Theme.ButtonPlaylistName.Text.Text = _Theme.ButtonPlaylistName.Text.Text + keyEvent.Unicode; _Theme.ButtonPlaylistName.Text.Text = _Theme.ButtonPlaylistName.Text.Text + keyEvent.Unicode;
else switch (keyEvent.Key) else
{
switch (keyEvent.Key)
{ {
case Keys.Enter: case Keys.Enter:
CBase.Playlist.SetPlaylistName(ActivePlaylistID, _Theme.ButtonPlaylistName.Text.Text); CBase.Playlist.SetPlaylistName(ActivePlaylistID, _Theme.ButtonPlaylistName.Text.Text);
@@ -519,6 +521,7 @@ namespace VocaluxeLib.Menu
_Theme.ButtonPlaylistName.Text.Text = _Theme.ButtonPlaylistName.Text.Text.Remove(_Theme.ButtonPlaylistName.Text.Text.Length - 1); _Theme.ButtonPlaylistName.Text.Text = _Theme.ButtonPlaylistName.Text.Text.Remove(_Theme.ButtonPlaylistName.Text.Text.Length - 1);
break; break;
} }
}
return true; return true;
} }
if (CurrentPlaylistElement == -1 || _PlaylistElementContents.Count == 0) if (CurrentPlaylistElement == -1 || _PlaylistElementContents.Count == 0)
+1 -4
View File
@@ -597,10 +597,7 @@ namespace VocaluxeLib.Menu.SingNotes
public int NumLinesWithPoints public int NumLinesWithPoints
{ {
get get { return _Lines.Count(line => line.Points > 0f); }
{
return _Lines.Count(line => line.Points > 0f);
}
} }
#region Methods #region Methods
-2
View File
@@ -883,9 +883,7 @@ namespace VocaluxeLib.Menu.SongMenu
// build sentences list // build sentences list
List<string> sentences = new List<string>(); List<string> sentences = new List<string>();
foreach (CLine line in lines.Line) foreach (CLine line in lines.Line)
{
sentences.Add(line.Points != 0 ? line.Lyrics : String.Empty); sentences.Add(line.Points != 0 ? line.Lyrics : String.Empty);
}
// find equal sentences series // find equal sentences series
List<SSeries> series = new List<SSeries>(); List<SSeries> series = new List<SSeries>();