Cleanups after merge

This commit is contained in:
Flamefire committed 2013-05-19 18:38:50 +02:00
1 parent f83496d66a
commit 11398dbb2f
56 files changed
+353 -359

No files matched your search

@@ -515,6 +515,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
return false; return false;
} }
// ReSharper disable LoopCanBeConvertedToQuery
foreach (CSong song in visibleSongs) foreach (CSong song in visibleSongs)
{ {
foreach (EGameMode mode in song.AvailableGameModes) foreach (EGameMode mode in song.AvailableGameModes)
@@ -523,6 +524,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
ids.Add(song.ID); ids.Add(song.ID);
} }
} }
// ReSharper restore LoopCanBeConvertedToQuery
if (ids.Count == 0) if (ids.Count == 0)
{ {
@@ -382,17 +382,8 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
//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 = true; //Don't show profile if is selected
visible = !_Data.ScreenNames.ProfileIDs.Contains(i);
for (int p = 0; p < _Data.ScreenNames.ProfileIDs.Count; p++)
{
//Don't show profile if is selected
if (_Data.ScreenNames.ProfileIDs[p] == i)
{
visible = false;
break;
}
}
} }
if (visible) if (visible)
_PlayerChooseButtonsVisibleProfiles.Add(i); _PlayerChooseButtonsVisibleProfiles.Add(i);
@@ -658,7 +658,9 @@ namespace VocaluxeLib.PartyModes.TicTacToe
for (int i = 0; i < CBase.Playlist.GetPlaylistSongCount(_GameData.PlaylistID); i++) for (int i = 0; i < CBase.Playlist.GetPlaylistSongCount(_GameData.PlaylistID); i++)
{ {
int id = CBase.Playlist.GetPlaylistSong(_GameData.PlaylistID, i).SongID; int id = CBase.Playlist.GetPlaylistSong(_GameData.PlaylistID, i).SongID;
// ReSharper disable LoopCanBeConvertedToQuery
foreach (EGameMode mode in CBase.Songs.GetSongByID(id).AvailableGameModes) foreach (EGameMode mode in CBase.Songs.GetSongByID(id).AvailableGameModes)
// ReSharper restore LoopCanBeConvertedToQuery
{ {
if (mode == gm) if (mode == gm)
songs.Add(id); songs.Add(id);
@@ -669,7 +671,9 @@ namespace VocaluxeLib.PartyModes.TicTacToe
case ESongSource.TR_ALLSONGS: case ESongSource.TR_ALLSONGS:
for (int i = 0; i < CBase.Songs.GetNumSongs(); i++) for (int i = 0; i < CBase.Songs.GetNumSongs(); i++)
{ {
// ReSharper disable LoopCanBeConvertedToQuery
foreach (EGameMode mode in CBase.Songs.GetSongByID(i).AvailableGameModes) foreach (EGameMode mode in CBase.Songs.GetSongByID(i).AvailableGameModes)
// ReSharper restore LoopCanBeConvertedToQuery
{ {
if (mode == gm) if (mode == gm)
songs.Add(i); songs.Add(i);
@@ -681,7 +685,9 @@ namespace VocaluxeLib.PartyModes.TicTacToe
CBase.Songs.SetCategory(_GameData.CategoryID); CBase.Songs.SetCategory(_GameData.CategoryID);
for (int i = 0; i < CBase.Songs.NumSongsInCategory(_GameData.CategoryID); i++) for (int i = 0; i < CBase.Songs.NumSongsInCategory(_GameData.CategoryID); i++)
{ {
// ReSharper disable LoopCanBeConvertedToQuery
foreach (EGameMode mode in CBase.Songs.GetVisibleSong(i).AvailableGameModes) foreach (EGameMode mode in CBase.Songs.GetVisibleSong(i).AvailableGameModes)
// ReSharper restore LoopCanBeConvertedToQuery
{ {
if (mode == gm) if (mode == gm)
songs.Add(CBase.Songs.GetVisibleSong(i).ID); songs.Add(CBase.Songs.GetVisibleSong(i).ID);
-2
View File
@@ -25,8 +25,6 @@ using System.Linq;
using VocaluxeLib; using VocaluxeLib;
using VocaluxeLib.Songs; using VocaluxeLib.Songs;
using VocaluxeLib.Draw; using VocaluxeLib.Draw;
using VocaluxeLib.Menu;
using VocaluxeLib.Menu.SongMenu;
namespace Vocaluxe.Base namespace Vocaluxe.Base
{ {
+3 -4
View File
@@ -29,7 +29,6 @@ using System.Xml;
using Vocaluxe.Lib.Sound; using Vocaluxe.Lib.Sound;
using Vocaluxe.Lib.Webcam; using Vocaluxe.Lib.Webcam;
using VocaluxeLib; using VocaluxeLib;
using VocaluxeLib.Menu;
using VocaluxeLib.Profile; using VocaluxeLib.Profile;
namespace Vocaluxe.Base namespace Vocaluxe.Base
@@ -844,12 +843,12 @@ namespace Vocaluxe.Base
if (Players[j] == "" || profiles == null) if (Players[j] == "" || profiles == null)
continue; continue;
for (int i = 0; i < profiles.Length; i++) foreach (CProfile profile in profiles)
{ {
if (Path.GetFileName(profiles[i].FileName) == Players[j] && profiles[i].Active == EOffOn.TR_CONFIG_ON) if (Path.GetFileName(profile.FileName) == Players[j] && profile.Active == EOffOn.TR_CONFIG_ON)
{ {
//Update Game-infos with player //Update Game-infos with player
CGame.Players[j].ProfileID = profiles[i].ID; CGame.Players[j].ProfileID = profile.ID;
} }
} }
} }
-17
View File
@@ -17,9 +17,7 @@
// */ // */
#endregion #endregion
using System;
using System.Collections.Generic; using System.Collections.Generic;
using Vocaluxe.Base.Server; using Vocaluxe.Base.Server;
using Vocaluxe.Lib.Input; using Vocaluxe.Lib.Input;
using Vocaluxe.Lib.Input.WiiMote; using Vocaluxe.Lib.Input.WiiMote;
@@ -44,17 +42,13 @@ namespace Vocaluxe.Base
_Controller.Add(CVocaluxeServer.Controller); _Controller.Add(CVocaluxeServer.Controller);
foreach (IController controller in _Controller) foreach (IController controller in _Controller)
{
controller.Init(); controller.Init();
}
} }
public static void Close() public static void Close()
{ {
foreach (IController controller in _Controller) foreach (IController controller in _Controller)
{
controller.Close(); controller.Close();
}
_Controller = new List<IController>(); _Controller = new List<IController>();
} }
@@ -62,17 +56,13 @@ namespace Vocaluxe.Base
public static void Connect() public static void Connect()
{ {
foreach (IController controller in _Controller) foreach (IController controller in _Controller)
{
controller.Connect(); controller.Connect();
}
} }
public static void Disconnect() public static void Disconnect()
{ {
foreach (IController controller in _Controller) foreach (IController controller in _Controller)
{
controller.Disconnect(); controller.Disconnect();
}
} }
public static bool IsConnected() public static bool IsConnected()
@@ -89,17 +79,12 @@ namespace Vocaluxe.Base
SKeyEvent ke = new SKeyEvent(); SKeyEvent ke = new SKeyEvent();
while (controller.PollKeyEvent(ref ke)) while (controller.PollKeyEvent(ref ke))
{
_KeysPool.Add(ke); _KeysPool.Add(ke);
}
SMouseEvent me = new SMouseEvent(); SMouseEvent me = new SMouseEvent();
while (controller.PollMouseEvent(ref me)) while (controller.PollMouseEvent(ref me))
{
_MousePool.Add(me); _MousePool.Add(me);
}
} }
} }
public static bool PollKeyEvent(ref SKeyEvent keyEvent) public static bool PollKeyEvent(ref SKeyEvent keyEvent)
@@ -127,9 +112,7 @@ namespace Vocaluxe.Base
public static void SetRumble(float duration) public static void SetRumble(float duration)
{ {
foreach (IController controller in _Controller) foreach (IController controller in _Controller)
{
controller.SetRumble(duration); controller.SetRumble(duration);
}
} }
} }
} }
-1
View File
@@ -25,7 +25,6 @@ using System.Text;
using System.Xml; using System.Xml;
using VocaluxeLib; using VocaluxeLib;
using VocaluxeLib.Draw; using VocaluxeLib.Draw;
using VocaluxeLib.Menu;
namespace Vocaluxe.Base namespace Vocaluxe.Base
{ {
+20 -2
View File
@@ -1,8 +1,26 @@
using System; #region license
// /*
// This file is part of Vocaluxe.
//
// Vocaluxe is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Vocaluxe is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
// */
#endregion
using System;
using System.Diagnostics; using System.Diagnostics;
using VocaluxeLib; using VocaluxeLib;
using VocaluxeLib.Draw; using VocaluxeLib.Draw;
using VocaluxeLib.Menu;
namespace Vocaluxe.Base namespace Vocaluxe.Base
{ {
-2
View File
@@ -38,8 +38,6 @@ using Community.CsharpSqlite;
using VocaluxeLib; using VocaluxeLib;
using VocaluxeLib.Songs; using VocaluxeLib.Songs;
using VocaluxeLib.Draw; using VocaluxeLib.Draw;
using VocaluxeLib.Menu;
using VocaluxeLib.Menu.SongMenu;
namespace Vocaluxe.Base namespace Vocaluxe.Base
{ {
-1
View File
@@ -24,7 +24,6 @@ using System.Linq;
using System.Text; using System.Text;
using System.Xml; using System.Xml;
using VocaluxeLib; using VocaluxeLib;
using VocaluxeLib.Menu;
namespace Vocaluxe.Base namespace Vocaluxe.Base
{ {
-1
View File
@@ -26,7 +26,6 @@ using VocaluxeLib;
using VocaluxeLib.Game; using VocaluxeLib.Game;
using VocaluxeLib.Draw; using VocaluxeLib.Draw;
using VocaluxeLib.Menu; using VocaluxeLib.Menu;
using VocaluxeLib.Menu.SongMenu;
using VocaluxeLib.Songs; using VocaluxeLib.Songs;
using VocaluxeLib.Profile; using VocaluxeLib.Profile;
+2 -7
View File
@@ -21,6 +21,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.IO; using System.IO;
using System.Linq;
using System.Text; using System.Text;
using Vocaluxe.Lib.Playlist; using Vocaluxe.Lib.Playlist;
using VocaluxeLib; using VocaluxeLib;
@@ -40,13 +41,7 @@ namespace Vocaluxe.Base
public static List<string> PlaylistNames public static List<string> PlaylistNames
{ {
get get { return _Playlists.Select(t => t.PlaylistName).ToList(); }
{
List<string> names = new List<string>();
for (int i = 0; i < _Playlists.Count; i++)
names.Add(_Playlists[i].PlaylistName);
return names;
}
} }
public static int NumPlaylists public static int NumPlaylists
+64 -89
View File
@@ -20,13 +20,9 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Text;
using System.Xml;
using VocaluxeLib; using VocaluxeLib;
using VocaluxeLib.Game;
using VocaluxeLib.Profile; using VocaluxeLib.Profile;
using VocaluxeLib.Draw; using VocaluxeLib.Draw;
using VocaluxeLib.Menu;
namespace Vocaluxe.Base namespace Vocaluxe.Base
{ {
@@ -38,7 +34,7 @@ namespace Vocaluxe.Base
Profile = 4 Profile = 4
} }
public delegate void ProfileChangedCallback(EProfileChangedFlags TypeChanged); public delegate void ProfileChangedCallback(EProfileChangedFlags typeChanged);
static class CProfiles static class CProfiles
{ {
@@ -70,12 +66,12 @@ namespace Vocaluxe.Base
private static Dictionary<int, CAvatar> _Avatars; private static Dictionary<int, CAvatar> _Avatars;
private static Queue<int> _AvatarIDs; private static Queue<int> _AvatarIDs;
private static Queue<SChange> _Queue = new Queue<SChange>(); private static readonly Queue<SChange> _Queue = new Queue<SChange>();
private static Object _QueueMutex = new Object(); private static readonly Object _QueueMutex = new Object();
private static List<ProfileChangedCallback> _ProfileChangedCallbacks = new List<ProfileChangedCallback>(); private static readonly List<ProfileChangedCallback> _ProfileChangedCallbacks = new List<ProfileChangedCallback>();
private static bool _ProfilesChanged = false; private static bool _ProfilesChanged;
private static bool _AvatarsChanged = false; private static bool _AvatarsChanged;
#endregion private vars #endregion private vars
#region properties #region properties
@@ -142,7 +138,7 @@ namespace Vocaluxe.Base
if (change.Profile == null) if (change.Profile == null)
break; break;
if (!ICProfileIDValid(change.Profile.ID)) if (!IsProfileIDValid(change.Profile.ID))
return; return;
_Profiles[change.Profile.ID] = change.Profile; _Profiles[change.Profile.ID] = change.Profile;
@@ -150,7 +146,7 @@ namespace Vocaluxe.Base
break; break;
case EAction.DeleteProfile: case EAction.DeleteProfile:
if (!ICProfileIDValid(change.ProfileID)) if (!IsProfileIDValid(change.ProfileID))
break; break;
_DeleteProfile(change.ProfileID); _DeleteProfile(change.ProfileID);
@@ -170,15 +166,12 @@ namespace Vocaluxe.Base
if (change.Avatar == null) if (change.Avatar == null)
break; break;
if (!ICAvatarIDValid(change.Avatar.ID)) if (!IsAvatarIDValid(change.Avatar.ID))
return; return;
_Avatars[change.Avatar.ID] = change.Avatar; _Avatars[change.Avatar.ID] = change.Avatar;
_AvatarsChanged = true; _AvatarsChanged = true;
break; break;
default:
break;
} }
} }
} }
@@ -214,15 +207,14 @@ namespace Vocaluxe.Base
_ProfilesChanged = false; _ProfilesChanged = false;
} }
public static void AddProfileChangedCallback(ProfileChangedCallback Notification) public static void AddProfileChangedCallback(ProfileChangedCallback notification)
{ {
_ProfileChangedCallbacks.Add(Notification); _ProfileChangedCallbacks.Add(notification);
} }
public static void LoadProfiles() public static void LoadProfiles()
{ {
SChange change = new SChange(); SChange change = new SChange {Action = EAction.LoadProfiles};
change.Action = EAction.LoadProfiles;
lock (_QueueMutex) lock (_QueueMutex)
{ {
@@ -232,8 +224,7 @@ namespace Vocaluxe.Base
public static void LoadAvatars() public static void LoadAvatars()
{ {
SChange change = new SChange(); SChange change = new SChange {Action = EAction.LoadAvatars};
change.Action = EAction.LoadAvatars;
lock (_QueueMutex) lock (_QueueMutex)
{ {
@@ -241,14 +232,12 @@ namespace Vocaluxe.Base
} }
} }
public static void AddProfile(CProfile NewProfile) public static void AddProfile(CProfile newProfile)
{ {
if (NewProfile == null) if (newProfile == null)
return; return;
SChange change = new SChange(); SChange change = new SChange {Action = EAction.AddProfile, Profile = newProfile};
change.Action = EAction.AddProfile;
change.Profile = NewProfile;
lock (_QueueMutex) lock (_QueueMutex)
{ {
@@ -256,14 +245,12 @@ namespace Vocaluxe.Base
} }
} }
public static void EditProfile(CProfile EditProfile) public static void EditProfile(CProfile editProfile)
{ {
if (EditProfile == null) if (editProfile == null)
return; return;
SChange change = new SChange(); SChange change = new SChange {Action = EAction.EditProfile, Profile = editProfile};
change.Action = EAction.EditProfile;
change.Profile = EditProfile;
lock (_QueueMutex) lock (_QueueMutex)
{ {
@@ -273,12 +260,10 @@ namespace Vocaluxe.Base
public static void DeleteProfile(int profileID) public static void DeleteProfile(int profileID)
{ {
if (!ICProfileIDValid(profileID)) if (!IsProfileIDValid(profileID))
return; return;
SChange change = new SChange(); SChange change = new SChange {Action = EAction.DeleteProfile, ProfileID = profileID};
change.Action = EAction.DeleteProfile;
change.ProfileID = profileID;
lock (_QueueMutex) lock (_QueueMutex)
{ {
@@ -286,14 +271,12 @@ namespace Vocaluxe.Base
} }
} }
public static void AddAvatar(CAvatar NewAvatar) public static void AddAvatar(CAvatar newAvatar)
{ {
if (NewAvatar == null) if (newAvatar == null)
return; return;
SChange change = new SChange(); SChange change = new SChange {Action = EAction.AddAvatar, Avatar = newAvatar};
change.Action = EAction.AddAvatar;
change.Avatar = NewAvatar;
lock (_QueueMutex) lock (_QueueMutex)
{ {
@@ -301,14 +284,12 @@ namespace Vocaluxe.Base
} }
} }
public static void EditAvatar(CAvatar EditAvatar) public static void EditAvatar(CAvatar editAvatar)
{ {
if (EditAvatar == null) if (editAvatar == null)
return; return;
SChange change = new SChange(); SChange change = new SChange {Action = EAction.EditAvatar, Avatar = editAvatar};
change.Action = EAction.EditAvatar;
change.Avatar = EditAvatar;
lock (_QueueMutex) lock (_QueueMutex)
{ {
@@ -318,26 +299,20 @@ namespace Vocaluxe.Base
public static CProfile[] GetProfiles() public static CProfile[] GetProfiles()
{ {
List<CProfile> list = new List<CProfile>();
if (_Profiles.Count == 0) if (_Profiles.Count == 0)
return null; return null;
CProfile[] result = new CProfile[_Profiles.Count]; List<CProfile> list = new List<CProfile>(_Profiles.Values);
_Profiles.Values.CopyTo(result, 0);
for (int i = 0; i < result.Length; i++)
list.Add(result[i]);
list.Sort(_CompareByPlayerName); list.Sort(_CompareByPlayerName);
return list.ToArray(); return list.ToArray();
} }
public static CAvatar[] GetAvatars() public static IEnumerable<CAvatar> GetAvatars()
{ {
CAvatar[] result = null;
if (_Avatars.Count == 0) if (_Avatars.Count == 0)
return null; return null;
result = new CAvatar[_Avatars.Count]; CAvatar[] result = new CAvatar[_Avatars.Count];
_Avatars.Values.CopyTo(result, 0); _Avatars.Values.CopyTo(result, 0);
return result; return result;
@@ -377,12 +352,12 @@ namespace Vocaluxe.Base
_Profiles[id].SaveProfile(); _Profiles[id].SaveProfile();
} }
public static bool ICProfileIDValid(int profileID) public static bool IsProfileIDValid(int profileID)
{ {
return _Profiles.ContainsKey(profileID); return _Profiles.ContainsKey(profileID);
} }
public static bool ICAvatarIDValid(int avatarID) public static bool IsAvatarIDValid(int avatarID)
{ {
return _Avatars.ContainsKey(avatarID); return _Avatars.ContainsKey(avatarID);
} }
@@ -391,7 +366,7 @@ namespace Vocaluxe.Base
#region profile properties #region profile properties
public static string GetPlayerName(int profileID, int playerNum = 0) public static string GetPlayerName(int profileID, int playerNum = 0)
{ {
if (ICProfileIDValid(profileID)) if (IsProfileIDValid(profileID))
return _Profiles[profileID].PlayerName; return _Profiles[profileID].PlayerName;
string playerName = CLanguage.Translate("TR_SCREENNAMES_PLAYER"); string playerName = CLanguage.Translate("TR_SCREENNAMES_PLAYER");
@@ -400,17 +375,17 @@ namespace Vocaluxe.Base
return playerName; return playerName;
} }
public static void SetPlayerName(int profileID, string PlayerName) public static void SetPlayerName(int profileID, string playerName)
{ {
if (!ICProfileIDValid(profileID)) if (!IsProfileIDValid(profileID))
return; return;
_Profiles[profileID].PlayerName = PlayerName; _Profiles[profileID].PlayerName = playerName;
} }
public static string GetProfileFileName(int profileID) public static string GetProfileFileName(int profileID)
{ {
if (!ICProfileIDValid(profileID)) if (!IsProfileIDValid(profileID))
return String.Empty; return String.Empty;
return Path.GetFileName(_Profiles[profileID].FileName); return Path.GetFileName(_Profiles[profileID].FileName);
@@ -418,7 +393,7 @@ namespace Vocaluxe.Base
public static string AddGetPlayerName(int profileID, char chr) public static string AddGetPlayerName(int profileID, char chr)
{ {
if (!ICProfileIDValid(profileID)) if (!IsProfileIDValid(profileID))
return String.Empty; return String.Empty;
_Profiles[profileID].PlayerName += chr; _Profiles[profileID].PlayerName += chr;
@@ -427,7 +402,7 @@ namespace Vocaluxe.Base
public static string GetDeleteCharInPlayerName(int profileID) public static string GetDeleteCharInPlayerName(int profileID)
{ {
if (!ICProfileIDValid(profileID)) if (!IsProfileIDValid(profileID))
return String.Empty; return String.Empty;
CProfile profile = _Profiles[profileID]; CProfile profile = _Profiles[profileID];
@@ -439,12 +414,12 @@ namespace Vocaluxe.Base
public static EGameDifficulty GetDifficulty(int profileID) public static EGameDifficulty GetDifficulty(int profileID)
{ {
return ICProfileIDValid(profileID) ? _Profiles[profileID].Difficulty : EGameDifficulty.TR_CONFIG_NORMAL; return IsProfileIDValid(profileID) ? _Profiles[profileID].Difficulty : EGameDifficulty.TR_CONFIG_NORMAL;
} }
public static void SetDifficulty(int profileID, EGameDifficulty difficulty) public static void SetDifficulty(int profileID, EGameDifficulty difficulty)
{ {
if (!ICProfileIDValid(profileID)) if (!IsProfileIDValid(profileID))
return; return;
_Profiles[profileID].Difficulty = difficulty; _Profiles[profileID].Difficulty = difficulty;
@@ -452,12 +427,12 @@ namespace Vocaluxe.Base
public static EOffOn GetGuestProfile(int profileID) public static EOffOn GetGuestProfile(int profileID)
{ {
return ICProfileIDValid(profileID) ? _Profiles[profileID].GuestProfile : EOffOn.TR_CONFIG_OFF; return IsProfileIDValid(profileID) ? _Profiles[profileID].GuestProfile : EOffOn.TR_CONFIG_OFF;
} }
public static void SetGuestProfile(int profileID, EOffOn option) public static void SetGuestProfile(int profileID, EOffOn option)
{ {
if (!ICProfileIDValid(profileID)) if (!IsProfileIDValid(profileID))
return; return;
_Profiles[profileID].GuestProfile = option; _Profiles[profileID].GuestProfile = option;
@@ -465,12 +440,12 @@ namespace Vocaluxe.Base
public static EOffOn GetActive(int profileID) public static EOffOn GetActive(int profileID)
{ {
return ICProfileIDValid(profileID) ? _Profiles[profileID].Active : EOffOn.TR_CONFIG_OFF; return IsProfileIDValid(profileID) ? _Profiles[profileID].Active : EOffOn.TR_CONFIG_OFF;
} }
public static void SetActive(int profileID, EOffOn option) public static void SetActive(int profileID, EOffOn option)
{ {
if (!ICProfileIDValid(profileID)) if (!IsProfileIDValid(profileID))
return; return;
_Profiles[profileID].Active = option; _Profiles[profileID].Active = option;
@@ -478,7 +453,7 @@ namespace Vocaluxe.Base
public static bool IsGuestProfile(int profileID) public static bool IsGuestProfile(int profileID)
{ {
if (!ICProfileIDValid(profileID)) if (!IsProfileIDValid(profileID))
return true; // this will prevent from saving dummy profiles to highscore db return true; // this will prevent from saving dummy profiles to highscore db
return _Profiles[profileID].GuestProfile == EOffOn.TR_CONFIG_ON; return _Profiles[profileID].GuestProfile == EOffOn.TR_CONFIG_ON;
@@ -486,14 +461,14 @@ namespace Vocaluxe.Base
public static bool IsActive(int profileID) public static bool IsActive(int profileID)
{ {
if (!ICProfileIDValid(profileID)) if (!IsProfileIDValid(profileID))
return false; return false;
return _Profiles[profileID].Active == EOffOn.TR_CONFIG_ON; return _Profiles[profileID].Active == EOffOn.TR_CONFIG_ON;
} }
public static void SetAvatar(int profileID, int avatarID) public static void SetAvatar(int profileID, int avatarID)
{ {
if (!ICProfileIDValid(profileID) || !ICAvatarIDValid(avatarID)) if (!IsProfileIDValid(profileID) || !IsAvatarIDValid(avatarID))
return; return;
_Profiles[profileID].Avatar = _Avatars[avatarID]; _Profiles[profileID].Avatar = _Avatars[avatarID];
@@ -501,7 +476,7 @@ namespace Vocaluxe.Base
public static int GetAvatarID(int profileID) public static int GetAvatarID(int profileID)
{ {
if (!ICProfileIDValid(profileID)) if (!IsProfileIDValid(profileID))
return -1; return -1;
return _Profiles[profileID].Avatar.ID; return _Profiles[profileID].Avatar.ID;
@@ -511,7 +486,7 @@ namespace Vocaluxe.Base
#region avatar texture #region avatar texture
public static CTexture GetAvatarTexture(int avatarID) public static CTexture GetAvatarTexture(int avatarID)
{ {
if (!ICAvatarIDValid(avatarID)) if (!IsAvatarIDValid(avatarID))
return null; return null;
return _Avatars[avatarID].Texture; return _Avatars[avatarID].Texture;
@@ -519,7 +494,7 @@ namespace Vocaluxe.Base
public static CTexture GetAvatarTextureFromProfile(int profileID) public static CTexture GetAvatarTextureFromProfile(int profileID)
{ {
if (!ICProfileIDValid(profileID)) if (!IsProfileIDValid(profileID))
return null; return null;
return _Profiles[profileID].Avatar.Texture; return _Profiles[profileID].Avatar.Texture;
@@ -536,15 +511,15 @@ namespace Vocaluxe.Base
{ {
int[] ids = new int[_Profiles.Keys.Count]; int[] ids = new int[_Profiles.Keys.Count];
_Profiles.Keys.CopyTo(ids, 0); _Profiles.Keys.CopyTo(ids, 0);
for (int i = 0; i < ids.Length; i++) foreach (int id in ids)
{ {
if (_Profiles[ids[i]].LoadProfile()) if (_Profiles[id].LoadProfile())
{ {
_Profiles[ids[i]].Avatar = _GetAvatar(_Profiles[ids[i]].AvatarFileName); _Profiles[id].Avatar = _GetAvatar(_Profiles[id].AvatarFileName);
knownFiles.Add(Path.GetFileName(_Profiles[ids[i]].FileName)); knownFiles.Add(Path.GetFileName(_Profiles[id].FileName));
} }
else else
_Profiles.Remove(ids[i]); _Profiles.Remove(id);
} }
} }
@@ -578,12 +553,12 @@ namespace Vocaluxe.Base
{ {
int[] ids = new int[_Avatars.Keys.Count]; int[] ids = new int[_Avatars.Keys.Count];
_Avatars.Keys.CopyTo(ids, 0); _Avatars.Keys.CopyTo(ids, 0);
for (int i = 0; i < ids.Length; i++) foreach (int id in ids)
{ {
if (_Avatars[ids[i]].Reload()) if (_Avatars[id].Reload())
knownFiles.Add(Path.GetFileName(_Avatars[ids[i]].FileName)); knownFiles.Add(Path.GetFileName(_Avatars[id].FileName));
else else
_Avatars.Remove(ids[i]); _Avatars.Remove(id);
} }
} }
@@ -610,7 +585,7 @@ namespace Vocaluxe.Base
private static void _DeleteProfile(int profileID) private static void _DeleteProfile(int profileID)
{ {
if (!ICProfileIDValid(profileID)) if (!IsProfileIDValid(profileID))
return; return;
if (_Profiles[profileID].FileName == "") if (_Profiles[profileID].FileName == "")
@@ -651,7 +626,7 @@ namespace Vocaluxe.Base
private static void _RemoveProfile(int profileID) private static void _RemoveProfile(int profileID)
{ {
if (!ICProfileIDValid(profileID)) if (!IsProfileIDValid(profileID))
return; return;
_Profiles.Remove(profileID); _Profiles.Remove(profileID);
@@ -665,11 +640,11 @@ namespace Vocaluxe.Base
private static CAvatar _GetAvatar(string fileName) private static CAvatar _GetAvatar(string fileName)
{ {
string Name = Path.GetFileName(fileName); string name = Path.GetFileName(fileName);
foreach (int id in _Avatars.Keys) foreach (int id in _Avatars.Keys)
{ {
if (Path.GetFileName(_Avatars[id].FileName) == Name) if (Path.GetFileName(_Avatars[id].FileName) == name)
return _Avatars[id]; return _Avatars[id];
} }
return new CAvatar(-1); return new CAvatar(-1);
-1
View File
@@ -21,7 +21,6 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using VocaluxeLib; using VocaluxeLib;
using VocaluxeLib.Menu.SongMenu;
using VocaluxeLib.Songs; using VocaluxeLib.Songs;
namespace Vocaluxe.Base namespace Vocaluxe.Base
+2
View File
@@ -140,7 +140,9 @@ namespace Vocaluxe.Base
sortList.Add(new CSongPointer(song.ID, "")); sortList.Add(new CSongPointer(song.ID, ""));
else else
{ {
// ReSharper disable LoopCanBeConvertedToQuery
foreach (String sortString in values) foreach (String sortString in values)
// ReSharper restore LoopCanBeConvertedToQuery
sortList.Add(new CSongPointer(song.ID, sortString)); sortList.Add(new CSongPointer(song.ID, sortString));
} }
} }
+2 -2
View File
@@ -23,8 +23,6 @@ using System.Collections.ObjectModel;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
using VocaluxeLib; using VocaluxeLib;
using VocaluxeLib.Menu;
using VocaluxeLib.Menu.SongMenu;
using VocaluxeLib.Songs; using VocaluxeLib.Songs;
namespace Vocaluxe.Base namespace Vocaluxe.Base
@@ -256,7 +254,9 @@ namespace Vocaluxe.Base
List<CSong> songs = new List<CSong>(); List<CSong> songs = new List<CSong>();
if (_IsCatIndexValid(_CatIndex)) if (_IsCatIndexValid(_CatIndex))
{ {
// ReSharper disable LoopCanBeConvertedToQuery
foreach (CSongPointer sp in Categories[_CatIndex].Songs) foreach (CSongPointer sp in Categories[_CatIndex].Songs)
// ReSharper restore LoopCanBeConvertedToQuery
{ {
if (!sp.IsSung) if (!sp.IsSung)
songs.Add(_Songs[sp.SongID]); songs.Add(_Songs[sp.SongID]);
+4 -1
View File
@@ -26,7 +26,6 @@ using System.Xml;
using Vocaluxe.Base.Fonts; using Vocaluxe.Base.Fonts;
using VocaluxeLib; using VocaluxeLib;
using VocaluxeLib.Draw; using VocaluxeLib.Draw;
using VocaluxeLib.Menu;
namespace Vocaluxe.Base namespace Vocaluxe.Base
{ {
@@ -113,7 +112,9 @@ namespace Vocaluxe.Base
get get
{ {
List<string> names = new List<string>(); List<string> names = new List<string>();
// ReSharper disable LoopCanBeConvertedToQuery
foreach (STheme th in _Themes) foreach (STheme th in _Themes)
// ReSharper restore LoopCanBeConvertedToQuery
{ {
if (th.PartyModeID == -1) if (th.PartyModeID == -1)
names.Add(th.Name); names.Add(th.Name);
@@ -128,7 +129,9 @@ namespace Vocaluxe.Base
get get
{ {
List<string> names = new List<string>(); List<string> names = new List<string>();
// ReSharper disable LoopCanBeConvertedToQuery
foreach (SSkin sk in _Skins) foreach (SSkin sk in _Skins)
// ReSharper restore LoopCanBeConvertedToQuery
{ {
if (sk.PartyModeID == -1) if (sk.PartyModeID == -1)
names.Add(sk.Name); names.Add(sk.Name);
-1
View File
@@ -22,7 +22,6 @@ using System.Drawing;
using Vocaluxe.Lib.Video; using Vocaluxe.Lib.Video;
using VocaluxeLib; using VocaluxeLib;
using VocaluxeLib.Draw; using VocaluxeLib.Draw;
using VocaluxeLib.Menu;
namespace Vocaluxe.Base namespace Vocaluxe.Base
{ {
-1
View File
@@ -21,7 +21,6 @@ using System.Drawing;
using Vocaluxe.Lib.Webcam; using Vocaluxe.Lib.Webcam;
using VocaluxeLib; using VocaluxeLib;
using VocaluxeLib.Draw; using VocaluxeLib.Draw;
using VocaluxeLib.Menu;
namespace Vocaluxe.Base namespace Vocaluxe.Base
{ {
-1
View File
@@ -23,7 +23,6 @@ using System.Drawing;
using System.Drawing.Text; using System.Drawing.Text;
using VocaluxeLib; using VocaluxeLib;
using VocaluxeLib.Draw; using VocaluxeLib.Draw;
using VocaluxeLib.Menu;
namespace Vocaluxe.Base.Fonts namespace Vocaluxe.Base.Fonts
{ {
+10 -5
View File
@@ -25,7 +25,6 @@ using System.Drawing.Text;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using VocaluxeLib; using VocaluxeLib;
using VocaluxeLib.Draw; using VocaluxeLib.Draw;
using VocaluxeLib.Menu;
namespace Vocaluxe.Base.Fonts namespace Vocaluxe.Base.Fonts
{ {
@@ -219,10 +218,16 @@ namespace Vocaluxe.Base.Fonts
} }
//Add some additional space. Textures need some extra pixel for resizing. //Add some additional space. Textures need some extra pixel for resizing.
int d = 4; const int d = 4;
minX = minX - d; if (minX < 0) minX = 0; minX = minX - d;
minY = minY - d; if (minY < 0) minY = 0; if (minX < 0)
maxX = maxX + d; if (maxX > bmp.Width) maxX = bmp.Width; minX = 0;
minY = minY - d;
if (minY < 0)
minY = 0;
maxX = maxX + d;
if (maxX > bmp.Width)
maxX = bmp.Width;
return new Rectangle(minX, minY, maxX - minX, bmp.Height - minY); return new Rectangle(minX, minY, maxX - minX, bmp.Height - minY);
} }
+21 -12
View File
@@ -1,23 +1,32 @@
using System; #region license
using System.Collections.Generic; // /*
using System.Linq; // This file is part of Vocaluxe.
using System.Text; //
using System.Windows.Forms; // Vocaluxe is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
using Vocaluxe.Base; // the Free Software Foundation, either version 3 of the License, or
using Vocaluxe.Lib.Input; // (at your option) any later version.
using VocaluxeLib.Menu; //
// Vocaluxe is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
// */
#endregion
namespace Vocaluxe.Base.Server namespace Vocaluxe.Base.Server
{ {
internal class CClientHandler class CClientHandler
{ {
public int ConnectionID; public int ConnectionID;
public bool LoggedIn; public bool LoggedIn;
public CClientHandler(int ConnectionID) public CClientHandler(int connectionID)
{ {
this.ConnectionID = ConnectionID; ConnectionID = connectionID;
LoggedIn = false; LoggedIn = false;
} }
} }
+54 -52
View File
@@ -1,4 +1,23 @@
using System; #region license
// /*
// This file is part of Vocaluxe.
//
// Vocaluxe is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Vocaluxe is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
// */
#endregion
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.Drawing.Imaging; using System.Drawing.Imaging;
@@ -7,9 +26,7 @@ using System.Linq;
using System.IO; using System.IO;
using System.Text; using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
using ClientServerLib; using ClientServerLib;
using Vocaluxe.Base;
using Vocaluxe.Lib.Input; using Vocaluxe.Lib.Input;
using VocaluxeLib; using VocaluxeLib;
using VocaluxeLib.Profile; using VocaluxeLib.Profile;
@@ -22,7 +39,7 @@ namespace Vocaluxe.Base.Server
private static CDiscover _Discover; private static CDiscover _Discover;
private static Dictionary<int, CClientHandler> _Clients; private static Dictionary<int, CClientHandler> _Clients;
public static CControllerFramework Controller = new CControllerFramework(); public static readonly CControllerFramework Controller = new CControllerFramework();
public static void Init() public static void Init()
{ {
@@ -48,46 +65,46 @@ namespace Vocaluxe.Base.Server
_Clients = new Dictionary<int, CClientHandler>(); _Clients = new Dictionary<int, CClientHandler>();
} }
private static byte[] RequestHandler(int ConnectionID, byte[] Message) private static byte[] RequestHandler(int connectionID, byte[] message)
{ {
byte[] answer = CCommands.CreateCommandWithoutParams(CCommands.ResponseNOK); byte[] answer = CCommands.CreateCommandWithoutParams(CCommands.ResponseNOK);
if (Message == null) if (message == null)
return answer; return answer;
if (Message.Length < 4) if (message.Length < 4)
return answer; return answer;
bool loggedIn = false; bool loggedIn;
lock (_Clients) lock (_Clients)
{ {
if (!_Clients.ContainsKey(ConnectionID)) if (!_Clients.ContainsKey(connectionID))
{ {
CClientHandler client = new CClientHandler(ConnectionID); CClientHandler client = new CClientHandler(connectionID);
_Clients.Add(ConnectionID, client); _Clients.Add(connectionID, client);
} }
loggedIn = _Clients[ConnectionID].LoggedIn; loggedIn = _Clients[connectionID].LoggedIn;
} }
int command = BitConverter.ToInt32(Message, 0); int command = BitConverter.ToInt32(message, 0);
switch (command) switch (command)
{ {
case CCommands.CommandLogin: case CCommands.CommandLogin:
SLoginData data; SLoginData data;
if (!CCommands.DecodeCommandLogin(Message, out data)) if (!CCommands.DecodeCommandLogin(message, out data))
answer = CCommands.CreateCommandWithoutParams(CCommands.ResponseLoginFailed); answer = CCommands.CreateCommandWithoutParams(CCommands.ResponseLoginFailed);
else else
{ {
byte[] serverPW = CCommands.SHA256.ComputeHash(Encoding.UTF8.GetBytes(CConfig.ServerPassword)); byte[] serverPw = CCommands.SHA256.ComputeHash(Encoding.UTF8.GetBytes(CConfig.ServerPassword));
if (!serverPW.SequenceEqual(data.SHA256)) if (!serverPw.SequenceEqual(data.SHA256))
answer = CCommands.CreateCommandWithoutParams(CCommands.ResponseLoginWrongPassword); answer = CCommands.CreateCommandWithoutParams(CCommands.ResponseLoginWrongPassword);
else else
{ {
answer = CCommands.CreateCommandWithoutParams(CCommands.ResponseLoginOK); answer = CCommands.CreateCommandWithoutParams(CCommands.ResponseLoginOK);
_Clients[ConnectionID].LoggedIn = true; _Clients[connectionID].LoggedIn = true;
} }
} }
break; break;
@@ -121,13 +138,10 @@ namespace Vocaluxe.Base.Server
case CCommands.CommandSendAvatarPicture: case CCommands.CommandSendAvatarPicture:
SAvatarPicture avatarPicture; SAvatarPicture avatarPicture;
if (CCommands.DecodeCommandSendAvatarPicture(Message, out avatarPicture)) if (CCommands.DecodeCommandSendAvatarPicture(message, out avatarPicture))
{ {
Bitmap bmp = null; using (Bitmap bmp = new Bitmap(avatarPicture.Width, avatarPicture.Height))
bool success = false;
try
{ {
bmp = new Bitmap(avatarPicture.Width, avatarPicture.Height);
BitmapData bmpData = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb); BitmapData bmpData = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb);
Marshal.Copy(avatarPicture.data, 0, bmpData.Scan0, avatarPicture.data.Length); Marshal.Copy(avatarPicture.data, 0, bmpData.Scan0, avatarPicture.data.Length);
bmp.UnlockBits(bmpData); bmp.UnlockBits(bmpData);
@@ -137,23 +151,16 @@ namespace Vocaluxe.Base.Server
while (File.Exists(Path.Combine(CSettings.FolderProfiles, filename + i + ".png"))) while (File.Exists(Path.Combine(CSettings.FolderProfiles, filename + i + ".png")))
i++; i++;
bmp.Save(Path.Combine(CSettings.FolderProfiles, filename + i + ".png"), ImageFormat.Png); bmp.Save(Path.Combine(CSettings.FolderProfiles, filename + i + ".png"), ImageFormat.Png);
success = true;
}
finally
{
if (bmp != null)
bmp.Dispose();
} }
if (success) answer = CCommands.CreateCommandWithoutParams(CCommands.ResponseOK);
answer = CCommands.CreateCommandWithoutParams(CCommands.ResponseOK);
} }
break; break;
case CCommands.CommandSendAvatarPictureJpg: case CCommands.CommandSendAvatarPictureJpg:
SAvatarPicture avatarPictureJpg; SAvatarPicture avatarPictureJpg;
if (CCommands.DecodeCommandSendAvatarPicture(Message, out avatarPictureJpg)) if (CCommands.DecodeCommandSendAvatarPicture(message, out avatarPictureJpg))
{ {
if (_AddAvatar(avatarPictureJpg.data) != String.Empty) if (_AddAvatar(avatarPictureJpg.data) != String.Empty)
answer = CCommands.CreateCommandWithoutParams(CCommands.ResponseOK); answer = CCommands.CreateCommandWithoutParams(CCommands.ResponseOK);
@@ -162,39 +169,35 @@ namespace Vocaluxe.Base.Server
case CCommands.CommandSendProfile: case CCommands.CommandSendProfile:
SProfile profile; SProfile profile;
if (CCommands.DecodeCommandSendProfile(Message, out profile)) if (CCommands.DecodeCommandSendProfile(message, out profile))
{ {
try try
{ {
string AvatarFilename = _AddAvatar(profile.Avatar.data); string avatarFilename = _AddAvatar(profile.Avatar.data);
if (AvatarFilename != String.Empty) if (avatarFilename != String.Empty)
{ {
CProfile p = new CProfile(); CProfile p = new CProfile
p.Active = EOffOn.TR_CONFIG_ON; {
p.AvatarFileName = AvatarFilename; Active = EOffOn.TR_CONFIG_ON,
p.Difficulty = (EGameDifficulty)profile.Difficulty; AvatarFileName = avatarFilename,
p.GuestProfile = EOffOn.TR_CONFIG_OFF; Difficulty = (EGameDifficulty)profile.Difficulty,
p.PlayerName = profile.PlayerName; GuestProfile = EOffOn.TR_CONFIG_OFF,
PlayerName = profile.PlayerName
};
CProfiles.AddProfile(p); CProfiles.AddProfile(p);
answer = CCommands.CreateCommandWithoutParams(CCommands.ResponseOK); answer = CCommands.CreateCommandWithoutParams(CCommands.ResponseOK);
} }
} }
catch (Exception) catch (Exception) {}
{
}
} }
break; break;
default:
break;
} }
return answer; return answer;
} }
private static string _AddAvatar(byte[] JpgData) private static string _AddAvatar(byte[] jpgData)
{ {
string result = String.Empty; string result = String.Empty;
try try
@@ -206,7 +209,7 @@ namespace Vocaluxe.Base.Server
filename = filename + i + ".jpg"; filename = filename + i + ".jpg";
FileStream fs = File.Create(filename); FileStream fs = File.Create(filename);
fs.Write(JpgData, 0, JpgData.Length); fs.Write(jpgData, 0, jpgData.Length);
fs.Flush(); fs.Flush();
fs.Close(); fs.Close();
@@ -216,9 +219,8 @@ namespace Vocaluxe.Base.Server
CProfiles.AddAvatar(avatar); CProfiles.AddAvatar(avatar);
result = filename; result = filename;
} }
} }
catch { } catch {}
return result; return result;
} }
-1
View File
@@ -33,7 +33,6 @@ using SlimDX.Windows;
using Vocaluxe.Base; using Vocaluxe.Base;
using VocaluxeLib; using VocaluxeLib;
using VocaluxeLib.Draw; using VocaluxeLib.Draw;
using VocaluxeLib.Menu;
namespace Vocaluxe.Lib.Draw namespace Vocaluxe.Lib.Draw
{ {
-1
View File
@@ -29,7 +29,6 @@ using System.Windows.Forms;
using Vocaluxe.Base; using Vocaluxe.Base;
using VocaluxeLib; using VocaluxeLib;
using VocaluxeLib.Draw; using VocaluxeLib.Draw;
using VocaluxeLib.Menu;
namespace Vocaluxe.Lib.Draw namespace Vocaluxe.Lib.Draw
{ {
-1
View File
@@ -32,7 +32,6 @@ using System.Windows.Forms;
using Vocaluxe.Base; using Vocaluxe.Base;
using VocaluxeLib; using VocaluxeLib;
using VocaluxeLib.Draw; using VocaluxeLib.Draw;
using VocaluxeLib.Menu;
using BeginMode = OpenTK.Graphics.OpenGL.BeginMode; using BeginMode = OpenTK.Graphics.OpenGL.BeginMode;
using BlendingFactorDest = OpenTK.Graphics.OpenGL.BlendingFactorDest; using BlendingFactorDest = OpenTK.Graphics.OpenGL.BlendingFactorDest;
using BlendingFactorSrc = OpenTK.Graphics.OpenGL.BlendingFactorSrc; using BlendingFactorSrc = OpenTK.Graphics.OpenGL.BlendingFactorSrc;
-3
View File
@@ -19,10 +19,7 @@
using System.Drawing; using System.Drawing;
using VocaluxeLib; using VocaluxeLib;
using VocaluxeLib.Menu;
using VocaluxeLib.Draw; using VocaluxeLib.Draw;
using VocaluxeLib.Menu;
namespace Vocaluxe.Lib.Draw namespace Vocaluxe.Lib.Draw
{ {
+24 -16
View File
@@ -1,8 +1,24 @@
using System; #region license
using System.Collections.Generic; // /*
using System.Linq; // This file is part of Vocaluxe.
using System.Text; //
// Vocaluxe is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Vocaluxe is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
// */
#endregion
using System;
using System.Collections.Generic;
using VocaluxeLib; using VocaluxeLib;
namespace Vocaluxe.Lib.Input namespace Vocaluxe.Lib.Input
@@ -25,17 +41,11 @@ namespace Vocaluxe.Lib.Input
_CurrentMousePool = new List<SMouseEvent>(); _CurrentMousePool = new List<SMouseEvent>();
} }
public virtual void Close() public virtual void Close() {}
{
}
public virtual void Connect() public virtual void Connect() {}
{
}
public virtual void Disconnect() public virtual void Disconnect() {}
{
}
public virtual bool IsConnected() public virtual bool IsConnected()
{ {
@@ -81,9 +91,7 @@ namespace Vocaluxe.Lib.Input
return false; return false;
} }
public virtual void SetRumble(float duration) public virtual void SetRumble(float duration) {}
{
}
public void AddKeyEvent(SKeyEvent keyEvent) public void AddKeyEvent(SKeyEvent keyEvent)
{ {
+2
View File
@@ -63,7 +63,9 @@ namespace Vocaluxe.Lib.Playlist
if (PlaylistFile == "") if (PlaylistFile == "")
{ {
string filename = string.Empty; string filename = string.Empty;
// ReSharper disable LoopCanBeConvertedToQuery
foreach (char chr in PlaylistName) foreach (char chr in PlaylistName)
// ReSharper restore LoopCanBeConvertedToQuery
{ {
if (char.IsLetter(chr)) if (char.IsLetter(chr))
filename += chr.ToString(); filename += chr.ToString();
-1
View File
@@ -19,7 +19,6 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using VocaluxeLib;
using VocaluxeLib.Draw; using VocaluxeLib.Draw;
namespace Vocaluxe.Lib.Video namespace Vocaluxe.Lib.Video
@@ -25,8 +25,6 @@ using System.Runtime.InteropServices;
using System.Threading; using System.Threading;
using Vocaluxe.Base; using Vocaluxe.Base;
using Vocaluxe.Lib.Video.Acinerella; using Vocaluxe.Lib.Video.Acinerella;
using VocaluxeLib;
using VocaluxeLib.Draw; using VocaluxeLib.Draw;
namespace Vocaluxe.Lib.Video namespace Vocaluxe.Lib.Video
@@ -20,7 +20,6 @@
using System; using System;
using Vocaluxe.Base; using Vocaluxe.Base;
using Vocaluxe.Lib.Video.Gstreamer; using Vocaluxe.Lib.Video.Gstreamer;
using VocaluxeLib;
using VocaluxeLib.Draw; using VocaluxeLib.Draw;
namespace Vocaluxe.Lib.Video namespace Vocaluxe.Lib.Video
-3
View File
@@ -17,8 +17,6 @@
// */ // */
#endregion #endregion
using VocaluxeLib;
using VocaluxeLib.Draw; using VocaluxeLib.Draw;
namespace Vocaluxe.Lib.Video namespace Vocaluxe.Lib.Video
@@ -45,7 +43,6 @@ namespace Vocaluxe.Lib.Video
float GetLength(int streamID); float GetLength(int streamID);
/// <summary> /// <summary>
///
/// </summary> /// </summary>
/// <param name="streamID"></param> /// <param name="streamID"></param>
/// <param name="frame"></param> /// <param name="frame"></param>
-1
View File
@@ -24,7 +24,6 @@ using System.Drawing;
using System.Drawing.Imaging; using System.Drawing.Imaging;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using Vocaluxe.Base; using Vocaluxe.Base;
using VocaluxeLib;
using VocaluxeLib.Draw; using VocaluxeLib.Draw;
namespace Vocaluxe.Lib.Webcam namespace Vocaluxe.Lib.Webcam
-3
View File
@@ -18,9 +18,6 @@
#endregion #endregion
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing;
using VocaluxeLib;
using System.Drawing; using System.Drawing;
using VocaluxeLib.Draw; using VocaluxeLib.Draw;
-3
View File
@@ -19,7 +19,6 @@
using System.Windows.Forms; using System.Windows.Forms;
using Vocaluxe.Base; using Vocaluxe.Base;
using Vocaluxe.Base.Fonts;
using VocaluxeLib; using VocaluxeLib;
using VocaluxeLib.Menu; using VocaluxeLib.Menu;
@@ -165,9 +164,7 @@ namespace Vocaluxe.Screens
// ReSharper disable ConditionIsAlwaysTrueOrFalse // ReSharper disable ConditionIsAlwaysTrueOrFalse
if (CSettings.VersionRevision != ERevision.Release) if (CSettings.VersionRevision != ERevision.Release)
// ReSharper restore ConditionIsAlwaysTrueOrFalse // ReSharper restore ConditionIsAlwaysTrueOrFalse
{
_ReleaseText.Draw(); _ReleaseText.Draw();
}
return true; return true;
} }
+7 -7
View File
@@ -63,8 +63,8 @@ namespace Vocaluxe.Screens
private int _SelectingSwitchNr = -1; private int _SelectingSwitchNr = -1;
private int _SelectingFastPlayerNr; private int _SelectingFastPlayerNr;
private int _SelectedPlayerNr = -1; private int _SelectedPlayerNr = -1;
private bool _AvatarsChanged = false; private bool _AvatarsChanged;
private bool _ProfilesChanged = false; private bool _ProfilesChanged;
#region public methods #region public methods
public override void Init() public override void Init()
@@ -106,7 +106,7 @@ namespace Vocaluxe.Screens
_ChooseAvatarStatic.Visible = false; _ChooseAvatarStatic.Visible = false;
_ChooseAvatarStatic.Aspect = EAspect.Crop; _ChooseAvatarStatic.Aspect = EAspect.Crop;
CProfiles.AddProfileChangedCallback(new ProfileChangedCallback(_OnProfileChanged)); CProfiles.AddProfileChangedCallback(_OnProfileChanged);
} }
public override void LoadTheme(string xmlPath) public override void LoadTheme(string xmlPath)
@@ -670,12 +670,12 @@ namespace Vocaluxe.Screens
#endregion public methods #endregion public methods
#region private methods #region private methods
private void _OnProfileChanged(EProfileChangedFlags Flags) private void _OnProfileChanged(EProfileChangedFlags flags)
{ {
if (EProfileChangedFlags.Avatar == (EProfileChangedFlags.Avatar & Flags)) if (EProfileChangedFlags.Avatar == (EProfileChangedFlags.Avatar & flags))
_AvatarsChanged = true; _AvatarsChanged = true;
if (EProfileChangedFlags.Profile == (EProfileChangedFlags.Profile & Flags)) if (EProfileChangedFlags.Profile == (EProfileChangedFlags.Profile & flags))
_ProfilesChanged = true; _ProfilesChanged = true;
} }
@@ -690,7 +690,7 @@ namespace Vocaluxe.Screens
for (int i = 0; i < CSettings.MaxNumPlayer; i++) for (int i = 0; i < CSettings.MaxNumPlayer; i++)
{ {
_Statics[_StaticPlayerAvatar[i]].Texture = CProfiles.ICProfileIDValid(CGame.Players[i].ProfileID) ? _Statics[_StaticPlayerAvatar[i]].Texture = CProfiles.IsProfileIDValid(CGame.Players[i].ProfileID) ?
CProfiles.GetAvatarTextureFromProfile(CGame.Players[i].ProfileID) : CProfiles.GetAvatarTextureFromProfile(CGame.Players[i].ProfileID) :
_OriginalPlayerAvatarTextures[i]; _OriginalPlayerAvatarTextures[i];
_Texts[_TextPlayer[i]].Text = CProfiles.GetPlayerName(CGame.Players[i].ProfileID, i + 1); _Texts[_TextPlayer[i]].Text = CProfiles.GetPlayerName(CGame.Players[i].ProfileID, i + 1);
-1
View File
@@ -24,7 +24,6 @@ using Vocaluxe.Lib.Webcam;
using VocaluxeLib; using VocaluxeLib;
using VocaluxeLib.Menu; using VocaluxeLib.Menu;
using VocaluxeLib.Draw; using VocaluxeLib.Draw;
using VocaluxeLib.Menu;
namespace Vocaluxe.Screens namespace Vocaluxe.Screens
{ {
+15 -16
View File
@@ -28,7 +28,6 @@ using VocaluxeLib;
using VocaluxeLib.Menu; using VocaluxeLib.Menu;
using VocaluxeLib.Profile; using VocaluxeLib.Profile;
using VocaluxeLib.Draw; using VocaluxeLib.Draw;
using VocaluxeLib.Menu;
namespace Vocaluxe.Screens namespace Vocaluxe.Screens
{ {
@@ -82,7 +81,7 @@ namespace Vocaluxe.Screens
_EditMode = EEditMode.None; _EditMode = EEditMode.None;
_ProfilesChanged = false; _ProfilesChanged = false;
_AvatarsChanged = false; _AvatarsChanged = false;
CProfiles.AddProfileChangedCallback(new ProfileChangedCallback(_OnProfileChanged)); CProfiles.AddProfileChangedCallback(_OnProfileChanged);
} }
public override void LoadTheme(string xmlPath) public override void LoadTheme(string xmlPath)
@@ -302,12 +301,12 @@ namespace Vocaluxe.Screens
_OnDiscardSnapshot(); _OnDiscardSnapshot();
} }
private void _OnProfileChanged(EProfileChangedFlags Flags) private void _OnProfileChanged(EProfileChangedFlags flags)
{ {
if (EProfileChangedFlags.Avatar == (EProfileChangedFlags.Avatar & Flags)) if (EProfileChangedFlags.Avatar == (EProfileChangedFlags.Avatar & flags))
_AvatarsChanged = true; _AvatarsChanged = true;
if (EProfileChangedFlags.Profile == (EProfileChangedFlags.Profile & Flags)) if (EProfileChangedFlags.Profile == (EProfileChangedFlags.Profile & flags))
_ProfilesChanged = true; _ProfilesChanged = true;
} }
@@ -399,7 +398,7 @@ namespace Vocaluxe.Screens
_SelectSlides[_SelectSlideProfiles].Selection = selection - 1; _SelectSlides[_SelectSlideProfiles].Selection = selection - 1;
} }
private void _LoadProfiles(bool Keep) private void _LoadProfiles(bool keep)
{ {
string name = String.Empty; string name = String.Empty;
if (_EditMode == EEditMode.PlayerName) if (_EditMode == EEditMode.PlayerName)
@@ -409,12 +408,12 @@ namespace Vocaluxe.Screens
_SelectSlides[_SelectSlideProfiles].Clear(); _SelectSlides[_SelectSlideProfiles].Clear();
CProfile[] profiles = CProfiles.GetProfiles(); CProfile[] profiles = CProfiles.GetProfiles();
for (int i = 0; i < profiles.Length; i++) foreach (CProfile profile in profiles)
{ {
_SelectSlides[_SelectSlideProfiles].AddValue( _SelectSlides[_SelectSlideProfiles].AddValue(
profiles[i].PlayerName, profile.PlayerName,
null, null,
profiles[i].ID, profile.ID,
-1); -1);
} }
@@ -428,7 +427,7 @@ namespace Vocaluxe.Screens
selectedProfileID = _SelectSlides[_SelectSlideProfiles].ValueIndex; selectedProfileID = _SelectSlides[_SelectSlideProfiles].ValueIndex;
} }
if (!Keep) if (!keep)
{ {
_SelectSlides[_SelectSlideDifficulty].Selection = (int)CProfiles.GetDifficulty(selectedProfileID); _SelectSlides[_SelectSlideDifficulty].Selection = (int)CProfiles.GetDifficulty(selectedProfileID);
_SelectSlides[_SelectSlideGuestProfile].Selection = (int)CProfiles.GetGuestProfile(selectedProfileID); _SelectSlides[_SelectSlideGuestProfile].Selection = (int)CProfiles.GetGuestProfile(selectedProfileID);
@@ -442,21 +441,21 @@ namespace Vocaluxe.Screens
_ProfilesChanged = false; _ProfilesChanged = false;
} }
private void _LoadAvatars(bool Keep) private void _LoadAvatars(bool keep)
{ {
int selectedAvatarID = _SelectSlides[_SelectSlideAvatars].ValueIndex; int selectedAvatarID = _SelectSlides[_SelectSlideAvatars].ValueIndex;
_SelectSlides[_SelectSlideAvatars].Clear(); _SelectSlides[_SelectSlideAvatars].Clear();
CAvatar[] avatars = CProfiles.GetAvatars(); IEnumerable<CAvatar> avatars = CProfiles.GetAvatars();
for (int i = 0; i < avatars.Length; i++) foreach (CAvatar avatar in avatars)
{ {
_SelectSlides[_SelectSlideAvatars].AddValue( _SelectSlides[_SelectSlideAvatars].AddValue(
Path.GetFileName(avatars[i].FileName), Path.GetFileName(avatar.FileName),
null, null,
avatars[i].ID, avatar.ID,
-1); -1);
} }
if (Keep) if (keep)
{ {
_SelectSlides[_SelectSlideAvatars].SetSelectionByValueIndex(selectedAvatarID); _SelectSlides[_SelectSlideAvatars].SetSelectionByValueIndex(selectedAvatarID);
CProfiles.SetAvatar(_SelectSlides[_SelectSlideProfiles].ValueIndex, selectedAvatarID); CProfiles.SetAvatar(_SelectSlides[_SelectSlideProfiles].ValueIndex, selectedAvatarID);
+1 -1
View File
@@ -333,7 +333,7 @@ namespace Vocaluxe.Screens
_Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.Y - _Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.Y -
_Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.H; _Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.H;
} }
if (CProfiles.ICProfileIDValid(players[p].ProfileID)) if (CProfiles.IsProfileIDValid(players[p].ProfileID))
_Statics[_StaticAvatar[p, CGame.NumPlayer - 1]].Texture = CProfiles.GetAvatarTextureFromProfile(players[p].ProfileID); _Statics[_StaticAvatar[p, CGame.NumPlayer - 1]].Texture = CProfiles.GetAvatarTextureFromProfile(players[p].ProfileID);
} }
+5 -7
View File
@@ -29,8 +29,6 @@ using Vocaluxe.Base.Fonts;
using VocaluxeLib; using VocaluxeLib;
using VocaluxeLib.Draw; using VocaluxeLib.Draw;
using VocaluxeLib.Menu; using VocaluxeLib.Menu;
using VocaluxeLib.Menu.SingNotes;
using VocaluxeLib.Menu.SongMenu;
using VocaluxeLib.Songs; using VocaluxeLib.Songs;
namespace Vocaluxe.Screens namespace Vocaluxe.Screens
@@ -702,7 +700,7 @@ namespace Vocaluxe.Screens
{ {
bool lyricsOnTop = CConfig.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_TOP bool lyricsOnTop = CConfig.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_TOP
|| CConfig.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_BOTH || CConfig.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_BOTH
|| (CConfig.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_DYNAMIC && _DynamicLyricsTop); || (CConfig.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_DYNAMIC && _DynamicLyricsTop);
_Lyrics[_LyricMainTop].Visible = lyricsOnTop; _Lyrics[_LyricMainTop].Visible = lyricsOnTop;
_Lyrics[_LyricSubTop].Visible = lyricsOnTop; _Lyrics[_LyricSubTop].Visible = lyricsOnTop;
_Statics[_StaticLyricsTop].Visible = lyricsOnTop; _Statics[_StaticLyricsTop].Visible = lyricsOnTop;
@@ -712,8 +710,8 @@ namespace Vocaluxe.Screens
private void _SetNormalLyricsVisibility() private void _SetNormalLyricsVisibility()
{ {
bool visible = CConfig.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_BOTTOM bool visible = CConfig.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_BOTTOM
|| CConfig.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_BOTH || CConfig.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_BOTH
|| (CConfig.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_DYNAMIC && _DynamicLyricsBottom); || (CConfig.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_DYNAMIC && _DynamicLyricsBottom);
_Lyrics[_LyricMain].Visible = visible; _Lyrics[_LyricMain].Visible = visible;
_Lyrics[_LyricSub].Visible = visible; _Lyrics[_LyricSub].Visible = visible;
_Statics[_StaticLyrics].Visible = visible; _Statics[_StaticLyrics].Visible = visible;
@@ -1392,7 +1390,7 @@ namespace Vocaluxe.Screens
{ {
for (int i = 0; i < CGame.NumPlayer; i++) for (int i = 0; i < CGame.NumPlayer; i++)
{ {
if (CProfiles.ICProfileIDValid(CGame.Players[i].ProfileID)) if (CProfiles.IsProfileIDValid(CGame.Players[i].ProfileID))
_Statics[_StaticAvatars[i, CGame.NumPlayer - 1]].Texture = CProfiles.GetAvatarTextureFromProfile(CGame.Players[i].ProfileID); _Statics[_StaticAvatars[i, CGame.NumPlayer - 1]].Texture = CProfiles.GetAvatarTextureFromProfile(CGame.Players[i].ProfileID);
else else
_Statics[_StaticAvatars[i, CGame.NumPlayer - 1]].Visible = false; _Statics[_StaticAvatars[i, CGame.NumPlayer - 1]].Visible = false;
@@ -1403,7 +1401,7 @@ namespace Vocaluxe.Screens
{ {
for (int i = 0; i < CGame.NumPlayer; i++) for (int i = 0; i < CGame.NumPlayer; i++)
{ {
if (CProfiles.ICProfileIDValid(CGame.Players[i].ProfileID)) if (CProfiles.IsProfileIDValid(CGame.Players[i].ProfileID))
_Texts[_TextNames[i, CGame.NumPlayer - 1]].Text = CProfiles.GetPlayerName(CGame.Players[i].ProfileID); _Texts[_TextNames[i, CGame.NumPlayer - 1]].Text = CProfiles.GetPlayerName(CGame.Players[i].ProfileID);
else else
_Texts[_TextNames[i, CGame.NumPlayer - 1]].Visible = false; _Texts[_TextNames[i, CGame.NumPlayer - 1]].Visible = false;
+5 -9
View File
@@ -20,11 +20,11 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Linq;
using System.Windows.Forms; using System.Windows.Forms;
using Vocaluxe.Base; using Vocaluxe.Base;
using VocaluxeLib; using VocaluxeLib;
using VocaluxeLib.Menu; using VocaluxeLib.Menu;
using VocaluxeLib.Menu.SongMenu;
using VocaluxeLib.PartyModes; using VocaluxeLib.PartyModes;
using VocaluxeLib.Songs; using VocaluxeLib.Songs;
@@ -884,9 +884,7 @@ namespace Vocaluxe.Screens
CGame.Reset(); CGame.Reset();
CGame.ClearSongs(); CGame.ClearSongs();
List<int> ids = new List<int>(); List<int> ids = CSongs.VisibleSongs.Select(t => t.ID).ToList();
for (int i = 0; i < CSongs.VisibleSongs.Count; i++)
ids.Add(CSongs.VisibleSongs[i].ID);
while (ids.Count > 0) while (ids.Count > 0)
{ {
@@ -910,17 +908,15 @@ namespace Vocaluxe.Screens
CGame.Reset(); CGame.Reset();
CGame.ClearSongs(); CGame.ClearSongs();
List<int> ids = new List<int>(); List<int> ids;
if (allSongs) if (allSongs)
{ {
ids = new List<int>();
for (int i = 0; i < CSongs.AllSongs.Count; i++) for (int i = 0; i < CSongs.AllSongs.Count; i++)
ids.Add(i); ids.Add(i);
} }
else else
{ ids = CSongs.VisibleSongs.Select(t => t.ID).ToList();
for (int i = 0; i < CSongs.VisibleSongs.Count; i++)
ids.Add(CSongs.VisibleSongs[i].ID);
}
int s = 0; int s = 0;
while (s < numSongs && ids.Count > 0) while (s < numSongs && ids.Count > 0)
{ {
-2
View File
@@ -17,8 +17,6 @@
// */ // */
#endregion #endregion
using VocaluxeLib.Menu;
namespace VocaluxeLib namespace VocaluxeLib
{ {
public static class CBase public static class CBase
+2
View File
@@ -143,7 +143,9 @@ namespace VocaluxeLib
try try
{ {
// ReSharper disable LoopCanBeConvertedToQuery
foreach (FileInfo file in dir.GetFiles(cast)) foreach (FileInfo file in dir.GetFiles(cast))
// ReSharper restore LoopCanBeConvertedToQuery
files.Add(!fullpath ? file.Name : file.FullName); files.Add(!fullpath ? file.Name : file.FullName);
if (recursive) if (recursive)
+29 -11
View File
@@ -1,5 +1,23 @@
using System.Drawing; #region license
using VocaluxeLib.Menu; // /*
// This file is part of Vocaluxe.
//
// Vocaluxe is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Vocaluxe is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
// */
#endregion
using System.Drawing;
namespace VocaluxeLib.Draw namespace VocaluxeLib.Draw
{ {
@@ -13,7 +31,7 @@ namespace VocaluxeLib.Draw
public string TexturePath = ""; public string TexturePath = "";
/// <summary> /// <summary>
/// Original size (e.g. of bmp) /// Original size (e.g. of bmp)
/// </summary> /// </summary>
public readonly Size OrigSize; public readonly Size OrigSize;
public float OrigAspect public float OrigAspect
@@ -22,7 +40,7 @@ namespace VocaluxeLib.Draw
} }
/// <summary> /// <summary>
/// Current size when drawn /// Current size when drawn
/// </summary> /// </summary>
public SRectF Rect; public SRectF Rect;
@@ -31,7 +49,7 @@ namespace VocaluxeLib.Draw
private int _W2, _H2; private int _W2, _H2;
private readonly bool _UseFullTexture; private readonly bool _UseFullTexture;
/// <summary> /// <summary>
/// Internal texture width (on device), a power of 2 if necessary /// Internal texture width (on device), a power of 2 if necessary
/// </summary> /// </summary>
public int W2 public int W2
{ {
@@ -46,7 +64,7 @@ namespace VocaluxeLib.Draw
} }
} }
/// <summary> /// <summary>
/// Internal texture height (on device), a power of 2 if necessary /// Internal texture height (on device), a power of 2 if necessary
/// </summary> /// </summary>
public int H2 public int H2
{ {
@@ -62,16 +80,16 @@ namespace VocaluxeLib.Draw
} }
/// <summary> /// <summary>
/// Internal use. Specifies which part of texture memory is actually used /// Internal use. Specifies which part of texture memory is actually used
/// </summary> /// </summary>
public float WidthRatio { get; private set; } public float WidthRatio { get; private set; }
/// <summary> /// <summary>
/// Internal use. Specifies which part of texture memory is actually used /// Internal use. Specifies which part of texture memory is actually used
/// </summary> /// </summary>
public float HeightRatio { get; private set; } public float HeightRatio { get; private set; }
/// <summary> /// <summary>
/// Actual texture space used in x direction /// Actual texture space used in x direction
/// </summary> /// </summary>
public int UsedWidth public int UsedWidth
{ {
@@ -79,7 +97,7 @@ namespace VocaluxeLib.Draw
} }
/// <summary> /// <summary>
/// Actual texture space used in y direction /// Actual texture space used in y direction
/// </summary> /// </summary>
public int UsedHeight public int UsedHeight
{ {
@@ -112,7 +130,7 @@ namespace VocaluxeLib.Draw
*/ */
/// <summary> /// <summary>
/// Creates a new texture reference /// Creates a new texture reference
/// </summary> /// </summary>
/// <param name="origWidth">Original width (Bitmap size)</param> /// <param name="origWidth">Original width (Bitmap size)</param>
/// <param name="origHeight">Original height (Bitmap size)</param> /// <param name="origHeight">Original height (Bitmap size)</param>
+20 -13
View File
@@ -1,27 +1,34 @@
using System; #region license
// /*
// This file is part of Vocaluxe.
//
// Vocaluxe is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Vocaluxe is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
// */
#endregion
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Drawing; using System.Drawing;
using System.Linq;
using System.Text;
using VocaluxeLib.Draw; using VocaluxeLib.Draw;
using VocaluxeLib.Game; using VocaluxeLib.Game;
using VocaluxeLib.Menu; using VocaluxeLib.Menu;
using VocaluxeLib.PartyModes;
using VocaluxeLib.Profile; using VocaluxeLib.Profile;
using VocaluxeLib.Songs; using VocaluxeLib.Songs;
namespace VocaluxeLib namespace VocaluxeLib
{ {
public interface IMenuParty
{
void SetPartyModeID(int partyModeID);
int GetPartyModeID();
void AssingPartyMode(IPartyMode partyMode);
void DataToScreen(Object data);
}
public interface IConfig public interface IConfig
{ {
void SetBackgroundMusicVolume(int newVolume); void SetBackgroundMusicVolume(int newVolume);
+1 -3
View File
@@ -22,7 +22,6 @@ using System.Collections.Generic;
using System.Windows.Forms; using System.Windows.Forms;
using System.Xml; using System.Xml;
using VocaluxeLib.Draw; using VocaluxeLib.Draw;
using VocaluxeLib.Profile; using VocaluxeLib.Profile;
namespace VocaluxeLib.Menu namespace VocaluxeLib.Menu
@@ -489,8 +488,7 @@ namespace VocaluxeLib.Menu
for (int j = 0; j < _NumW; j++) for (int j = 0; j < _NumW; j++)
{ {
SRectF rect = new SRectF(Rect.X + j * (_TileW + _SpaceW), Rect.Y + i * (_TileH + _SpaceH), _TileW, _TileH, Rect.Z); SRectF rect = new SRectF(Rect.X + j * (_TileW + _SpaceW), Rect.Y + i * (_TileH + _SpaceH), _TileW, _TileH, Rect.Z);
CStatic tileStatic = new CStatic(_PartyModeID, _TextureEmptyTile, ColorEmptyTile, rect); CStatic tileStatic = new CStatic(_PartyModeID, _TextureEmptyTile, ColorEmptyTile, rect) {Aspect = EAspect.Crop};
tileStatic.Aspect = EAspect.Crop;
CText tileText = new CText(rect.X + rect.W / 2, rect.Y + rect.H + _Theme.NameSpace, rect.Z, _Theme.NameHeight, rect.W, EAlignment.Center, _Theme.NameStyle, CText tileText = new CText(rect.X + rect.W / 2, rect.Y + rect.H + _Theme.NameSpace, rect.Z, _Theme.NameHeight, rect.W, EAlignment.Center, _Theme.NameStyle,
_Theme.NameFont, _Theme.NameColor, ""); _Theme.NameFont, _Theme.NameColor, "");
_Tiles.Add(new CTile(tileStatic, tileText, -1)); _Tiles.Add(new CTile(tileStatic, tileText, -1));
-1
View File
@@ -21,7 +21,6 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Windows.Forms; using System.Windows.Forms;
using System.Xml; using System.Xml;
using VocaluxeLib.Menu.SongMenu;
using VocaluxeLib.Songs; using VocaluxeLib.Songs;
namespace VocaluxeLib.Menu namespace VocaluxeLib.Menu
-12
View File
@@ -17,18 +17,6 @@
// */ // */
#endregion #endregion
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Drawing;
using VocaluxeLib;
using VocaluxeLib.Game;
using VocaluxeLib.Draw;
using VocaluxeLib.Menu.SongMenu;
using VocaluxeLib.PartyModes;
using VocaluxeLib.Profile;
using VocaluxeLib.Songs;
namespace VocaluxeLib.Menu namespace VocaluxeLib.Menu
{ {
public interface IMenu public interface IMenu
-1
View File
@@ -22,7 +22,6 @@ using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.Xml; using System.Xml;
using VocaluxeLib.Draw; using VocaluxeLib.Draw;
using VocaluxeLib.Songs; using VocaluxeLib.Songs;
namespace VocaluxeLib.Menu.SingNotes namespace VocaluxeLib.Menu.SingNotes
-1
View File
@@ -18,7 +18,6 @@
#endregion #endregion
using System; using System;
using VocaluxeLib.Menu;
namespace VocaluxeLib.PartyModes namespace VocaluxeLib.PartyModes
{ {
+23 -9
View File
@@ -1,9 +1,23 @@
using System; #region license
using System.Collections.Generic; // /*
using System.Linq; // This file is part of Vocaluxe.
using System.Text; //
// Vocaluxe is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Vocaluxe is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
// */
#endregion
using VocaluxeLib.Draw; using VocaluxeLib.Draw;
using VocaluxeLib.Menu;
namespace VocaluxeLib.Profile namespace VocaluxeLib.Profile
{ {
@@ -13,14 +27,14 @@ namespace VocaluxeLib.Profile
public string FileName = ""; public string FileName = "";
public CTexture Texture; public CTexture Texture;
public CAvatar(int ID) public CAvatar(int id)
{ {
this.ID = ID; ID = id;
} }
public bool LoadFromFile(string NewFileName) public bool LoadFromFile(string fileName)
{ {
FileName = NewFileName; FileName = fileName;
return Reload(); return Reload();
} }
+25 -6
View File
@@ -1,7 +1,24 @@
using System; #region license
using System.Collections.Generic; // /*
// This file is part of Vocaluxe.
//
// Vocaluxe is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Vocaluxe is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
// */
#endregion
using System;
using System.IO; using System.IO;
using System.Linq;
using System.Text; using System.Text;
using System.Xml; using System.Xml;
@@ -9,7 +26,7 @@ namespace VocaluxeLib.Profile
{ {
public class CProfile public class CProfile
{ {
private static readonly XmlWriterSettings _Settings = new XmlWriterSettings() private static readonly XmlWriterSettings _Settings = new XmlWriterSettings
{ {
Indent = true, Indent = true,
Encoding = Encoding.UTF8, Encoding = Encoding.UTF8,
@@ -55,9 +72,9 @@ namespace VocaluxeLib.Profile
return LoadProfile(FileName); return LoadProfile(FileName);
} }
public bool LoadProfile(string NewFileName) public bool LoadProfile(string fileName)
{ {
FileName = NewFileName; FileName = fileName;
CXMLReader xmlReader = CXMLReader.OpenFile(FileName); CXMLReader xmlReader = CXMLReader.OpenFile(FileName);
if (xmlReader == null) if (xmlReader == null)
@@ -85,7 +102,9 @@ namespace VocaluxeLib.Profile
if (FileName == String.Empty) if (FileName == String.Empty)
{ {
string filename = string.Empty; string filename = string.Empty;
// ReSharper disable LoopCanBeConvertedToQuery
foreach (char chr in PlayerName) foreach (char chr in PlayerName)
// ReSharper restore LoopCanBeConvertedToQuery
{ {
if (char.IsLetter(chr)) if (char.IsLetter(chr))
filename += chr.ToString(); filename += chr.ToString();
-2
View File
@@ -18,8 +18,6 @@
#endregion #endregion
using System.Collections.Generic; using System.Collections.Generic;
using VocaluxeLib;
using VocaluxeLib.Draw; using VocaluxeLib.Draw;
namespace VocaluxeLib.Songs namespace VocaluxeLib.Songs
+2 -4
View File
@@ -20,10 +20,10 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq;
using System.Text; using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using VocaluxeLib.Draw; using VocaluxeLib.Draw;
using VocaluxeLib.Menu.SingNotes;
namespace VocaluxeLib.Songs namespace VocaluxeLib.Songs
{ {
@@ -806,9 +806,7 @@ namespace VocaluxeLib.Songs
return null; return null;
// build sentences list // build sentences list
List<string> sentences = new List<string>(); List<string> sentences = voice.Lines.Select(line => line.Points != 0 ? line.Lyrics : String.Empty).ToList();
foreach (CLine line in voice.Lines)
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>();
-4
View File
@@ -23,10 +23,6 @@ using System.Drawing;
using System.Windows.Forms; using System.Windows.Forms;
using VocaluxeLib.Songs; using VocaluxeLib.Songs;
using System.Windows.Forms;
using VocaluxeLib.Draw;
using VocaluxeLib.Menu.SingNotes;
namespace VocaluxeLib namespace VocaluxeLib
{ {