From 11398dbb2ff7228df1197154073858dea9be351d Mon Sep 17 00:00:00 2001 From: Flamefire Date: Sun, 19 May 2013 18:38:50 +0200 Subject: [PATCH] Cleanups after merge --- .../CPartyModeChallengeMedley.cs | 2 + .../CPartyScreenChallengeMedleyNames.cs | 13 +- .../PartyModeTicTacToe/CPartyModeTicTacToe.cs | 6 + Vocaluxe/Base/CBackgroundMusic.cs | 2 - Vocaluxe/Base/CConfig.cs | 9 +- Vocaluxe/Base/CController.cs | 19 +-- Vocaluxe/Base/CCover.cs | 1 - Vocaluxe/Base/CCursor.cs | 22 ++- Vocaluxe/Base/CDataBase.cs | 2 - Vocaluxe/Base/CLanguage.cs | 1 - Vocaluxe/Base/CMain.cs | 1 - Vocaluxe/Base/CPlaylists.cs | 9 +- Vocaluxe/Base/CProfiles.cs | 153 ++++++++---------- Vocaluxe/Base/CSongCategorizer.cs | 1 - Vocaluxe/Base/CSongSorter.cs | 2 + Vocaluxe/Base/CSongs.cs | 4 +- Vocaluxe/Base/CTheme.cs | 5 +- Vocaluxe/Base/CVideo.cs | 1 - Vocaluxe/Base/CWebcam.cs | 1 - Vocaluxe/Base/Fonts/CFont.cs | 1 - Vocaluxe/Base/Fonts/CGlyph.cs | 15 +- Vocaluxe/Base/Server/CClientHandler.cs | 35 ++-- Vocaluxe/Base/Server/CVocaluxeServer.cs | 112 ++++++------- Vocaluxe/Lib/Draw/CDirect3D.cs | 1 - Vocaluxe/Lib/Draw/CDrawWinForm.cs | 1 - Vocaluxe/Lib/Draw/COpenGL.cs | 1 - Vocaluxe/Lib/Draw/IDraw.cs | 3 - Vocaluxe/Lib/Input/CControllerFramework.cs | 42 +++-- Vocaluxe/Lib/Playlist/CPlaylistFile.cs | 2 + Vocaluxe/Lib/Video/CVideoDecoder.cs | 1 - Vocaluxe/Lib/Video/CVideoDecoderFFmpeg.cs | 2 - Vocaluxe/Lib/Video/CVideoDecoderGstreamer.cs | 1 - Vocaluxe/Lib/Video/IVideoDecoder.cs | 3 - Vocaluxe/Lib/Webcam/CAForgeNet.cs | 1 - Vocaluxe/Lib/Webcam/IWebcam.cs | 3 - Vocaluxe/Screens/CScreenMain.cs | 3 - Vocaluxe/Screens/CScreenNames.cs | 14 +- Vocaluxe/Screens/CScreenOptionsVideo.cs | 1 - Vocaluxe/Screens/CScreenProfiles.cs | 31 ++-- Vocaluxe/Screens/CScreenScore.cs | 2 +- Vocaluxe/Screens/CScreenSing.cs | 12 +- Vocaluxe/Screens/CScreenSong.cs | 14 +- VocaluxeLib/CBasic.cs | 2 - VocaluxeLib/CHelper.cs | 2 + VocaluxeLib/Draw/CTexture.cs | 40 +++-- VocaluxeLib/IBasic.cs | 33 ++-- VocaluxeLib/Menu/CNameSelection.cs | 4 +- VocaluxeLib/Menu/CPlaylist.cs | 1 - VocaluxeLib/Menu/IMenu.cs | 12 -- VocaluxeLib/Menu/SingNotes/CSingNotes.cs | 1 - VocaluxeLib/PartyModes/CPartyModeNone.cs | 1 - VocaluxeLib/Profile/CAvatar.cs | 32 ++-- VocaluxeLib/Profile/CProfile.cs | 37 +++-- VocaluxeLib/Songs/CCategory.cs | 2 - VocaluxeLib/Songs/CSong.cs | 6 +- VocaluxeLib/Structs.cs | 4 - 56 files changed, 363 insertions(+), 369 deletions(-) diff --git a/PartyModes/PartyModeChallengeMedley/CPartyModeChallengeMedley.cs b/PartyModes/PartyModeChallengeMedley/CPartyModeChallengeMedley.cs index 7abd44db..f108e66f 100644 --- a/PartyModes/PartyModeChallengeMedley/CPartyModeChallengeMedley.cs +++ b/PartyModes/PartyModeChallengeMedley/CPartyModeChallengeMedley.cs @@ -515,6 +515,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley return false; } + // ReSharper disable LoopCanBeConvertedToQuery foreach (CSong song in visibleSongs) { foreach (EGameMode mode in song.AvailableGameModes) @@ -523,6 +524,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley ids.Add(song.ID); } } + // ReSharper restore LoopCanBeConvertedToQuery if (ids.Count == 0) { diff --git a/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyNames.cs b/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyNames.cs index e073f362..e4a396fb 100644 --- a/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyNames.cs +++ b/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyNames.cs @@ -382,17 +382,8 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley //Show profile only if active if (CBase.Profiles.GetProfiles()[i].Active == EOffOn.TR_CONFIG_ON) { - visible = true; - - 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; - } - } + //Don't show profile if is selected + visible = !_Data.ScreenNames.ProfileIDs.Contains(i); } if (visible) _PlayerChooseButtonsVisibleProfiles.Add(i); diff --git a/PartyModes/PartyModeTicTacToe/CPartyModeTicTacToe.cs b/PartyModes/PartyModeTicTacToe/CPartyModeTicTacToe.cs index 2f46b6dd..2e51f184 100644 --- a/PartyModes/PartyModeTicTacToe/CPartyModeTicTacToe.cs +++ b/PartyModes/PartyModeTicTacToe/CPartyModeTicTacToe.cs @@ -658,7 +658,9 @@ namespace VocaluxeLib.PartyModes.TicTacToe for (int i = 0; i < CBase.Playlist.GetPlaylistSongCount(_GameData.PlaylistID); i++) { int id = CBase.Playlist.GetPlaylistSong(_GameData.PlaylistID, i).SongID; + // ReSharper disable LoopCanBeConvertedToQuery foreach (EGameMode mode in CBase.Songs.GetSongByID(id).AvailableGameModes) + // ReSharper restore LoopCanBeConvertedToQuery { if (mode == gm) songs.Add(id); @@ -669,7 +671,9 @@ namespace VocaluxeLib.PartyModes.TicTacToe case ESongSource.TR_ALLSONGS: for (int i = 0; i < CBase.Songs.GetNumSongs(); i++) { + // ReSharper disable LoopCanBeConvertedToQuery foreach (EGameMode mode in CBase.Songs.GetSongByID(i).AvailableGameModes) + // ReSharper restore LoopCanBeConvertedToQuery { if (mode == gm) songs.Add(i); @@ -681,7 +685,9 @@ namespace VocaluxeLib.PartyModes.TicTacToe CBase.Songs.SetCategory(_GameData.CategoryID); for (int i = 0; i < CBase.Songs.NumSongsInCategory(_GameData.CategoryID); i++) { + // ReSharper disable LoopCanBeConvertedToQuery foreach (EGameMode mode in CBase.Songs.GetVisibleSong(i).AvailableGameModes) + // ReSharper restore LoopCanBeConvertedToQuery { if (mode == gm) songs.Add(CBase.Songs.GetVisibleSong(i).ID); diff --git a/Vocaluxe/Base/CBackgroundMusic.cs b/Vocaluxe/Base/CBackgroundMusic.cs index 3bcbd703..26377f1d 100644 --- a/Vocaluxe/Base/CBackgroundMusic.cs +++ b/Vocaluxe/Base/CBackgroundMusic.cs @@ -25,8 +25,6 @@ using System.Linq; using VocaluxeLib; using VocaluxeLib.Songs; using VocaluxeLib.Draw; -using VocaluxeLib.Menu; -using VocaluxeLib.Menu.SongMenu; namespace Vocaluxe.Base { diff --git a/Vocaluxe/Base/CConfig.cs b/Vocaluxe/Base/CConfig.cs index ae7c18af..73be016c 100644 --- a/Vocaluxe/Base/CConfig.cs +++ b/Vocaluxe/Base/CConfig.cs @@ -29,7 +29,6 @@ using System.Xml; using Vocaluxe.Lib.Sound; using Vocaluxe.Lib.Webcam; using VocaluxeLib; -using VocaluxeLib.Menu; using VocaluxeLib.Profile; namespace Vocaluxe.Base @@ -843,13 +842,13 @@ namespace Vocaluxe.Base CGame.Players[j].ProfileID = -1; if (Players[j] == "" || profiles == null) 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 - CGame.Players[j].ProfileID = profiles[i].ID; + CGame.Players[j].ProfileID = profile.ID; } } } diff --git a/Vocaluxe/Base/CController.cs b/Vocaluxe/Base/CController.cs index 66874fab..e28bb2ee 100644 --- a/Vocaluxe/Base/CController.cs +++ b/Vocaluxe/Base/CController.cs @@ -17,9 +17,7 @@ // */ #endregion -using System; using System.Collections.Generic; - using Vocaluxe.Base.Server; using Vocaluxe.Lib.Input; using Vocaluxe.Lib.Input.WiiMote; @@ -39,22 +37,18 @@ namespace Vocaluxe.Base _Controller = new List(); _KeysPool = new List(); _MousePool = new List(); - + _Controller.Add(new CWiiMote()); _Controller.Add(CVocaluxeServer.Controller); foreach (IController controller in _Controller) - { controller.Init(); - } } public static void Close() { foreach (IController controller in _Controller) - { controller.Close(); - } _Controller = new List(); } @@ -62,17 +56,13 @@ namespace Vocaluxe.Base public static void Connect() { foreach (IController controller in _Controller) - { controller.Connect(); - } } public static void Disconnect() { foreach (IController controller in _Controller) - { controller.Disconnect(); - } } public static bool IsConnected() @@ -89,17 +79,12 @@ namespace Vocaluxe.Base SKeyEvent ke = new SKeyEvent(); while (controller.PollKeyEvent(ref ke)) - { _KeysPool.Add(ke); - } SMouseEvent me = new SMouseEvent(); while (controller.PollMouseEvent(ref me)) - { _MousePool.Add(me); - } } - } public static bool PollKeyEvent(ref SKeyEvent keyEvent) @@ -127,9 +112,7 @@ namespace Vocaluxe.Base public static void SetRumble(float duration) { foreach (IController controller in _Controller) - { controller.SetRumble(duration); - } } } } \ No newline at end of file diff --git a/Vocaluxe/Base/CCover.cs b/Vocaluxe/Base/CCover.cs index 36cc5fe2..0c66fcf3 100644 --- a/Vocaluxe/Base/CCover.cs +++ b/Vocaluxe/Base/CCover.cs @@ -25,7 +25,6 @@ using System.Text; using System.Xml; using VocaluxeLib; using VocaluxeLib.Draw; -using VocaluxeLib.Menu; namespace Vocaluxe.Base { diff --git a/Vocaluxe/Base/CCursor.cs b/Vocaluxe/Base/CCursor.cs index 79971f57..70f1c84b 100644 --- a/Vocaluxe/Base/CCursor.cs +++ b/Vocaluxe/Base/CCursor.cs @@ -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 . +// */ +#endregion + +using System; using System.Diagnostics; using VocaluxeLib; using VocaluxeLib.Draw; -using VocaluxeLib.Menu; namespace Vocaluxe.Base { diff --git a/Vocaluxe/Base/CDataBase.cs b/Vocaluxe/Base/CDataBase.cs index a48526aa..2e9c4b65 100644 --- a/Vocaluxe/Base/CDataBase.cs +++ b/Vocaluxe/Base/CDataBase.cs @@ -38,8 +38,6 @@ using Community.CsharpSqlite; using VocaluxeLib; using VocaluxeLib.Songs; using VocaluxeLib.Draw; -using VocaluxeLib.Menu; -using VocaluxeLib.Menu.SongMenu; namespace Vocaluxe.Base { diff --git a/Vocaluxe/Base/CLanguage.cs b/Vocaluxe/Base/CLanguage.cs index 7482ffba..ede9e021 100644 --- a/Vocaluxe/Base/CLanguage.cs +++ b/Vocaluxe/Base/CLanguage.cs @@ -24,7 +24,6 @@ using System.Linq; using System.Text; using System.Xml; using VocaluxeLib; -using VocaluxeLib.Menu; namespace Vocaluxe.Base { diff --git a/Vocaluxe/Base/CMain.cs b/Vocaluxe/Base/CMain.cs index 2a572a0b..cd0ad057 100644 --- a/Vocaluxe/Base/CMain.cs +++ b/Vocaluxe/Base/CMain.cs @@ -26,7 +26,6 @@ using VocaluxeLib; using VocaluxeLib.Game; using VocaluxeLib.Draw; using VocaluxeLib.Menu; -using VocaluxeLib.Menu.SongMenu; using VocaluxeLib.Songs; using VocaluxeLib.Profile; diff --git a/Vocaluxe/Base/CPlaylists.cs b/Vocaluxe/Base/CPlaylists.cs index 8c6cb840..1dc0493b 100644 --- a/Vocaluxe/Base/CPlaylists.cs +++ b/Vocaluxe/Base/CPlaylists.cs @@ -21,6 +21,7 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.IO; +using System.Linq; using System.Text; using Vocaluxe.Lib.Playlist; using VocaluxeLib; @@ -40,13 +41,7 @@ namespace Vocaluxe.Base public static List PlaylistNames { - get - { - List names = new List(); - for (int i = 0; i < _Playlists.Count; i++) - names.Add(_Playlists[i].PlaylistName); - return names; - } + get { return _Playlists.Select(t => t.PlaylistName).ToList(); } } public static int NumPlaylists diff --git a/Vocaluxe/Base/CProfiles.cs b/Vocaluxe/Base/CProfiles.cs index 2b267cba..5c7ec480 100644 --- a/Vocaluxe/Base/CProfiles.cs +++ b/Vocaluxe/Base/CProfiles.cs @@ -20,13 +20,9 @@ using System; using System.Collections.Generic; using System.IO; -using System.Text; -using System.Xml; using VocaluxeLib; -using VocaluxeLib.Game; using VocaluxeLib.Profile; using VocaluxeLib.Draw; -using VocaluxeLib.Menu; namespace Vocaluxe.Base { @@ -38,7 +34,7 @@ namespace Vocaluxe.Base Profile = 4 } - public delegate void ProfileChangedCallback(EProfileChangedFlags TypeChanged); + public delegate void ProfileChangedCallback(EProfileChangedFlags typeChanged); static class CProfiles { @@ -70,12 +66,12 @@ namespace Vocaluxe.Base private static Dictionary _Avatars; private static Queue _AvatarIDs; - private static Queue _Queue = new Queue(); - private static Object _QueueMutex = new Object(); + private static readonly Queue _Queue = new Queue(); + private static readonly Object _QueueMutex = new Object(); - private static List _ProfileChangedCallbacks = new List(); - private static bool _ProfilesChanged = false; - private static bool _AvatarsChanged = false; + private static readonly List _ProfileChangedCallbacks = new List(); + private static bool _ProfilesChanged; + private static bool _AvatarsChanged; #endregion private vars #region properties @@ -142,7 +138,7 @@ namespace Vocaluxe.Base if (change.Profile == null) break; - if (!ICProfileIDValid(change.Profile.ID)) + if (!IsProfileIDValid(change.Profile.ID)) return; _Profiles[change.Profile.ID] = change.Profile; @@ -150,7 +146,7 @@ namespace Vocaluxe.Base break; case EAction.DeleteProfile: - if (!ICProfileIDValid(change.ProfileID)) + if (!IsProfileIDValid(change.ProfileID)) break; _DeleteProfile(change.ProfileID); @@ -170,15 +166,12 @@ namespace Vocaluxe.Base if (change.Avatar == null) break; - if (!ICAvatarIDValid(change.Avatar.ID)) + if (!IsAvatarIDValid(change.Avatar.ID)) return; _Avatars[change.Avatar.ID] = change.Avatar; _AvatarsChanged = true; break; - - default: - break; } } } @@ -214,15 +207,14 @@ namespace Vocaluxe.Base _ProfilesChanged = false; } - public static void AddProfileChangedCallback(ProfileChangedCallback Notification) + public static void AddProfileChangedCallback(ProfileChangedCallback notification) { - _ProfileChangedCallbacks.Add(Notification); + _ProfileChangedCallbacks.Add(notification); } public static void LoadProfiles() { - SChange change = new SChange(); - change.Action = EAction.LoadProfiles; + SChange change = new SChange {Action = EAction.LoadProfiles}; lock (_QueueMutex) { @@ -232,8 +224,7 @@ namespace Vocaluxe.Base public static void LoadAvatars() { - SChange change = new SChange(); - change.Action = EAction.LoadAvatars; + SChange change = new SChange {Action = EAction.LoadAvatars}; 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; - SChange change = new SChange(); - change.Action = EAction.AddProfile; - change.Profile = NewProfile; + SChange change = new SChange {Action = EAction.AddProfile, Profile = newProfile}; 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; - SChange change = new SChange(); - change.Action = EAction.EditProfile; - change.Profile = EditProfile; + SChange change = new SChange {Action = EAction.EditProfile, Profile = editProfile}; lock (_QueueMutex) { @@ -273,12 +260,10 @@ namespace Vocaluxe.Base public static void DeleteProfile(int profileID) { - if (!ICProfileIDValid(profileID)) + if (!IsProfileIDValid(profileID)) return; - SChange change = new SChange(); - change.Action = EAction.DeleteProfile; - change.ProfileID = profileID; + SChange change = new SChange {Action = EAction.DeleteProfile, ProfileID = profileID}; 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; - SChange change = new SChange(); - change.Action = EAction.AddAvatar; - change.Avatar = NewAvatar; + SChange change = new SChange {Action = EAction.AddAvatar, Avatar = newAvatar}; 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; - SChange change = new SChange(); - change.Action = EAction.EditAvatar; - change.Avatar = EditAvatar; + SChange change = new SChange {Action = EAction.EditAvatar, Avatar = editAvatar}; lock (_QueueMutex) { @@ -318,26 +299,20 @@ namespace Vocaluxe.Base public static CProfile[] GetProfiles() { - List list = new List(); - if (_Profiles.Count == 0) return null; - CProfile[] result = new CProfile[_Profiles.Count]; - _Profiles.Values.CopyTo(result, 0); - for (int i = 0; i < result.Length; i++) - list.Add(result[i]); + List list = new List(_Profiles.Values); list.Sort(_CompareByPlayerName); return list.ToArray(); } - public static CAvatar[] GetAvatars() + public static IEnumerable GetAvatars() { - CAvatar[] result = null; if (_Avatars.Count == 0) return null; - result = new CAvatar[_Avatars.Count]; + CAvatar[] result = new CAvatar[_Avatars.Count]; _Avatars.Values.CopyTo(result, 0); return result; @@ -377,12 +352,12 @@ namespace Vocaluxe.Base _Profiles[id].SaveProfile(); } - public static bool ICProfileIDValid(int profileID) + public static bool IsProfileIDValid(int profileID) { return _Profiles.ContainsKey(profileID); } - public static bool ICAvatarIDValid(int avatarID) + public static bool IsAvatarIDValid(int avatarID) { return _Avatars.ContainsKey(avatarID); } @@ -391,7 +366,7 @@ namespace Vocaluxe.Base #region profile properties public static string GetPlayerName(int profileID, int playerNum = 0) { - if (ICProfileIDValid(profileID)) + if (IsProfileIDValid(profileID)) return _Profiles[profileID].PlayerName; string playerName = CLanguage.Translate("TR_SCREENNAMES_PLAYER"); @@ -400,17 +375,17 @@ namespace Vocaluxe.Base 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; - _Profiles[profileID].PlayerName = PlayerName; + _Profiles[profileID].PlayerName = playerName; } public static string GetProfileFileName(int profileID) { - if (!ICProfileIDValid(profileID)) + if (!IsProfileIDValid(profileID)) return String.Empty; return Path.GetFileName(_Profiles[profileID].FileName); @@ -418,7 +393,7 @@ namespace Vocaluxe.Base public static string AddGetPlayerName(int profileID, char chr) { - if (!ICProfileIDValid(profileID)) + if (!IsProfileIDValid(profileID)) return String.Empty; _Profiles[profileID].PlayerName += chr; @@ -427,7 +402,7 @@ namespace Vocaluxe.Base public static string GetDeleteCharInPlayerName(int profileID) { - if (!ICProfileIDValid(profileID)) + if (!IsProfileIDValid(profileID)) return String.Empty; CProfile profile = _Profiles[profileID]; @@ -439,12 +414,12 @@ namespace Vocaluxe.Base 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) { - if (!ICProfileIDValid(profileID)) + if (!IsProfileIDValid(profileID)) return; _Profiles[profileID].Difficulty = difficulty; @@ -452,12 +427,12 @@ namespace Vocaluxe.Base 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) { - if (!ICProfileIDValid(profileID)) + if (!IsProfileIDValid(profileID)) return; _Profiles[profileID].GuestProfile = option; @@ -465,12 +440,12 @@ namespace Vocaluxe.Base 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) { - if (!ICProfileIDValid(profileID)) + if (!IsProfileIDValid(profileID)) return; _Profiles[profileID].Active = option; @@ -478,7 +453,7 @@ namespace Vocaluxe.Base 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 _Profiles[profileID].GuestProfile == EOffOn.TR_CONFIG_ON; @@ -486,14 +461,14 @@ namespace Vocaluxe.Base public static bool IsActive(int profileID) { - if (!ICProfileIDValid(profileID)) + if (!IsProfileIDValid(profileID)) return false; return _Profiles[profileID].Active == EOffOn.TR_CONFIG_ON; } public static void SetAvatar(int profileID, int avatarID) { - if (!ICProfileIDValid(profileID) || !ICAvatarIDValid(avatarID)) + if (!IsProfileIDValid(profileID) || !IsAvatarIDValid(avatarID)) return; _Profiles[profileID].Avatar = _Avatars[avatarID]; @@ -501,7 +476,7 @@ namespace Vocaluxe.Base public static int GetAvatarID(int profileID) { - if (!ICProfileIDValid(profileID)) + if (!IsProfileIDValid(profileID)) return -1; return _Profiles[profileID].Avatar.ID; @@ -511,7 +486,7 @@ namespace Vocaluxe.Base #region avatar texture public static CTexture GetAvatarTexture(int avatarID) { - if (!ICAvatarIDValid(avatarID)) + if (!IsAvatarIDValid(avatarID)) return null; return _Avatars[avatarID].Texture; @@ -519,7 +494,7 @@ namespace Vocaluxe.Base public static CTexture GetAvatarTextureFromProfile(int profileID) { - if (!ICProfileIDValid(profileID)) + if (!IsProfileIDValid(profileID)) return null; return _Profiles[profileID].Avatar.Texture; @@ -536,15 +511,15 @@ namespace Vocaluxe.Base { int[] ids = new int[_Profiles.Keys.Count]; _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); - knownFiles.Add(Path.GetFileName(_Profiles[ids[i]].FileName)); + _Profiles[id].Avatar = _GetAvatar(_Profiles[id].AvatarFileName); + knownFiles.Add(Path.GetFileName(_Profiles[id].FileName)); } else - _Profiles.Remove(ids[i]); + _Profiles.Remove(id); } } @@ -578,12 +553,12 @@ namespace Vocaluxe.Base { int[] ids = new int[_Avatars.Keys.Count]; _Avatars.Keys.CopyTo(ids, 0); - for (int i = 0; i < ids.Length; i++) + foreach (int id in ids) { - if (_Avatars[ids[i]].Reload()) - knownFiles.Add(Path.GetFileName(_Avatars[ids[i]].FileName)); + if (_Avatars[id].Reload()) + knownFiles.Add(Path.GetFileName(_Avatars[id].FileName)); else - _Avatars.Remove(ids[i]); + _Avatars.Remove(id); } } @@ -610,7 +585,7 @@ namespace Vocaluxe.Base private static void _DeleteProfile(int profileID) { - if (!ICProfileIDValid(profileID)) + if (!IsProfileIDValid(profileID)) return; if (_Profiles[profileID].FileName == "") @@ -651,7 +626,7 @@ namespace Vocaluxe.Base private static void _RemoveProfile(int profileID) { - if (!ICProfileIDValid(profileID)) + if (!IsProfileIDValid(profileID)) return; _Profiles.Remove(profileID); @@ -665,11 +640,11 @@ namespace Vocaluxe.Base private static CAvatar _GetAvatar(string fileName) { - string Name = Path.GetFileName(fileName); + string name = Path.GetFileName(fileName); foreach (int id in _Avatars.Keys) { - if (Path.GetFileName(_Avatars[id].FileName) == Name) + if (Path.GetFileName(_Avatars[id].FileName) == name) return _Avatars[id]; } return new CAvatar(-1); diff --git a/Vocaluxe/Base/CSongCategorizer.cs b/Vocaluxe/Base/CSongCategorizer.cs index 7a43c210..aba5bb88 100644 --- a/Vocaluxe/Base/CSongCategorizer.cs +++ b/Vocaluxe/Base/CSongCategorizer.cs @@ -21,7 +21,6 @@ using System; using System.Collections.Generic; using System.Text; using VocaluxeLib; -using VocaluxeLib.Menu.SongMenu; using VocaluxeLib.Songs; namespace Vocaluxe.Base diff --git a/Vocaluxe/Base/CSongSorter.cs b/Vocaluxe/Base/CSongSorter.cs index 6409d833..161f3eb4 100644 --- a/Vocaluxe/Base/CSongSorter.cs +++ b/Vocaluxe/Base/CSongSorter.cs @@ -140,7 +140,9 @@ namespace Vocaluxe.Base sortList.Add(new CSongPointer(song.ID, "")); else { + // ReSharper disable LoopCanBeConvertedToQuery foreach (String sortString in values) + // ReSharper restore LoopCanBeConvertedToQuery sortList.Add(new CSongPointer(song.ID, sortString)); } } diff --git a/Vocaluxe/Base/CSongs.cs b/Vocaluxe/Base/CSongs.cs index d49b5cef..05f7ac31 100644 --- a/Vocaluxe/Base/CSongs.cs +++ b/Vocaluxe/Base/CSongs.cs @@ -23,8 +23,6 @@ using System.Collections.ObjectModel; using System.Linq; using System.Threading; using VocaluxeLib; -using VocaluxeLib.Menu; -using VocaluxeLib.Menu.SongMenu; using VocaluxeLib.Songs; namespace Vocaluxe.Base @@ -256,7 +254,9 @@ namespace Vocaluxe.Base List songs = new List(); if (_IsCatIndexValid(_CatIndex)) { + // ReSharper disable LoopCanBeConvertedToQuery foreach (CSongPointer sp in Categories[_CatIndex].Songs) + // ReSharper restore LoopCanBeConvertedToQuery { if (!sp.IsSung) songs.Add(_Songs[sp.SongID]); diff --git a/Vocaluxe/Base/CTheme.cs b/Vocaluxe/Base/CTheme.cs index 9353ed43..9461dbda 100644 --- a/Vocaluxe/Base/CTheme.cs +++ b/Vocaluxe/Base/CTheme.cs @@ -26,7 +26,6 @@ using System.Xml; using Vocaluxe.Base.Fonts; using VocaluxeLib; using VocaluxeLib.Draw; -using VocaluxeLib.Menu; namespace Vocaluxe.Base { @@ -113,7 +112,9 @@ namespace Vocaluxe.Base get { List names = new List(); + // ReSharper disable LoopCanBeConvertedToQuery foreach (STheme th in _Themes) + // ReSharper restore LoopCanBeConvertedToQuery { if (th.PartyModeID == -1) names.Add(th.Name); @@ -128,7 +129,9 @@ namespace Vocaluxe.Base get { List names = new List(); + // ReSharper disable LoopCanBeConvertedToQuery foreach (SSkin sk in _Skins) + // ReSharper restore LoopCanBeConvertedToQuery { if (sk.PartyModeID == -1) names.Add(sk.Name); diff --git a/Vocaluxe/Base/CVideo.cs b/Vocaluxe/Base/CVideo.cs index 63fdd7b6..031bc6b6 100644 --- a/Vocaluxe/Base/CVideo.cs +++ b/Vocaluxe/Base/CVideo.cs @@ -22,7 +22,6 @@ using System.Drawing; using Vocaluxe.Lib.Video; using VocaluxeLib; using VocaluxeLib.Draw; -using VocaluxeLib.Menu; namespace Vocaluxe.Base { diff --git a/Vocaluxe/Base/CWebcam.cs b/Vocaluxe/Base/CWebcam.cs index 8c1d95d1..a42b6459 100644 --- a/Vocaluxe/Base/CWebcam.cs +++ b/Vocaluxe/Base/CWebcam.cs @@ -21,7 +21,6 @@ using System.Drawing; using Vocaluxe.Lib.Webcam; using VocaluxeLib; using VocaluxeLib.Draw; -using VocaluxeLib.Menu; namespace Vocaluxe.Base { diff --git a/Vocaluxe/Base/Fonts/CFont.cs b/Vocaluxe/Base/Fonts/CFont.cs index 3fd7bda8..e01c3b2b 100644 --- a/Vocaluxe/Base/Fonts/CFont.cs +++ b/Vocaluxe/Base/Fonts/CFont.cs @@ -23,7 +23,6 @@ using System.Drawing; using System.Drawing.Text; using VocaluxeLib; using VocaluxeLib.Draw; -using VocaluxeLib.Menu; namespace Vocaluxe.Base.Fonts { diff --git a/Vocaluxe/Base/Fonts/CGlyph.cs b/Vocaluxe/Base/Fonts/CGlyph.cs index b73bd60f..ba136617 100644 --- a/Vocaluxe/Base/Fonts/CGlyph.cs +++ b/Vocaluxe/Base/Fonts/CGlyph.cs @@ -25,7 +25,6 @@ using System.Drawing.Text; using System.Runtime.InteropServices; using VocaluxeLib; using VocaluxeLib.Draw; -using VocaluxeLib.Menu; namespace Vocaluxe.Base.Fonts { @@ -219,10 +218,16 @@ namespace Vocaluxe.Base.Fonts } //Add some additional space. Textures need some extra pixel for resizing. - int d = 4; - minX = minX - d; if (minX < 0) minX = 0; - minY = minY - d; if (minY < 0) minY = 0; - maxX = maxX + d; if (maxX > bmp.Width) maxX = bmp.Width; + const int d = 4; + minX = minX - d; + if (minX < 0) + 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); } diff --git a/Vocaluxe/Base/Server/CClientHandler.cs b/Vocaluxe/Base/Server/CClientHandler.cs index dc787c59..a63939f9 100644 --- a/Vocaluxe/Base/Server/CClientHandler.cs +++ b/Vocaluxe/Base/Server/CClientHandler.cs @@ -1,24 +1,33 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Windows.Forms; - -using Vocaluxe.Base; -using Vocaluxe.Lib.Input; -using VocaluxeLib.Menu; +#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 . +// */ +#endregion namespace Vocaluxe.Base.Server { - internal class CClientHandler + class CClientHandler { public int ConnectionID; public bool LoggedIn; - public CClientHandler(int ConnectionID) + public CClientHandler(int connectionID) { - this.ConnectionID = ConnectionID; + ConnectionID = connectionID; LoggedIn = false; } } -} +} \ No newline at end of file diff --git a/Vocaluxe/Base/Server/CVocaluxeServer.cs b/Vocaluxe/Base/Server/CVocaluxeServer.cs index 1351d769..e50e1247 100644 --- a/Vocaluxe/Base/Server/CVocaluxeServer.cs +++ b/Vocaluxe/Base/Server/CVocaluxeServer.cs @@ -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 . +// */ +#endregion + +using System; using System.Collections.Generic; using System.Drawing; using System.Drawing.Imaging; @@ -7,9 +26,7 @@ using System.Linq; using System.IO; using System.Text; using System.Windows.Forms; - using ClientServerLib; -using Vocaluxe.Base; using Vocaluxe.Lib.Input; using VocaluxeLib; using VocaluxeLib.Profile; @@ -22,7 +39,7 @@ namespace Vocaluxe.Base.Server private static CDiscover _Discover; private static Dictionary _Clients; - public static CControllerFramework Controller = new CControllerFramework(); + public static readonly CControllerFramework Controller = new CControllerFramework(); public static void Init() { @@ -48,46 +65,46 @@ namespace Vocaluxe.Base.Server _Clients = new Dictionary(); } - private static byte[] RequestHandler(int ConnectionID, byte[] Message) + private static byte[] RequestHandler(int connectionID, byte[] message) { byte[] answer = CCommands.CreateCommandWithoutParams(CCommands.ResponseNOK); - if (Message == null) + if (message == null) return answer; - if (Message.Length < 4) + if (message.Length < 4) return answer; - bool loggedIn = false; + bool loggedIn; lock (_Clients) { - if (!_Clients.ContainsKey(ConnectionID)) + if (!_Clients.ContainsKey(connectionID)) { - CClientHandler client = new CClientHandler(ConnectionID); - _Clients.Add(ConnectionID, client); + CClientHandler client = new CClientHandler(connectionID); + _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) { case CCommands.CommandLogin: SLoginData data; - if (!CCommands.DecodeCommandLogin(Message, out data)) + if (!CCommands.DecodeCommandLogin(message, out data)) answer = CCommands.CreateCommandWithoutParams(CCommands.ResponseLoginFailed); 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); else { answer = CCommands.CreateCommandWithoutParams(CCommands.ResponseLoginOK); - _Clients[ConnectionID].LoggedIn = true; + _Clients[connectionID].LoggedIn = true; } } break; @@ -95,7 +112,7 @@ namespace Vocaluxe.Base.Server if (!loggedIn) return answer; - + switch (command) { case CCommands.CommandSendKeyUp: @@ -121,13 +138,10 @@ namespace Vocaluxe.Base.Server case CCommands.CommandSendAvatarPicture: SAvatarPicture avatarPicture; - if (CCommands.DecodeCommandSendAvatarPicture(Message, out avatarPicture)) + if (CCommands.DecodeCommandSendAvatarPicture(message, out avatarPicture)) { - Bitmap bmp = null; - bool success = false; - try + using (Bitmap bmp = new Bitmap(avatarPicture.Width, avatarPicture.Height)) { - bmp = new Bitmap(avatarPicture.Width, avatarPicture.Height); 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); bmp.UnlockBits(bmpData); @@ -137,23 +151,16 @@ namespace Vocaluxe.Base.Server while (File.Exists(Path.Combine(CSettings.FolderProfiles, filename + i + ".png"))) i++; 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; case CCommands.CommandSendAvatarPictureJpg: SAvatarPicture avatarPictureJpg; - if (CCommands.DecodeCommandSendAvatarPicture(Message, out avatarPictureJpg)) + if (CCommands.DecodeCommandSendAvatarPicture(message, out avatarPictureJpg)) { if (_AddAvatar(avatarPictureJpg.data) != String.Empty) answer = CCommands.CreateCommandWithoutParams(CCommands.ResponseOK); @@ -162,39 +169,35 @@ namespace Vocaluxe.Base.Server case CCommands.CommandSendProfile: SProfile profile; - if (CCommands.DecodeCommandSendProfile(Message, out profile)) + if (CCommands.DecodeCommandSendProfile(message, out profile)) { - try - { - string AvatarFilename = _AddAvatar(profile.Avatar.data); - if (AvatarFilename != String.Empty) + try + { + string avatarFilename = _AddAvatar(profile.Avatar.data); + if (avatarFilename != String.Empty) { - CProfile p = new CProfile(); - p.Active = EOffOn.TR_CONFIG_ON; - p.AvatarFileName = AvatarFilename; - p.Difficulty = (EGameDifficulty)profile.Difficulty; - p.GuestProfile = EOffOn.TR_CONFIG_OFF; - p.PlayerName = profile.PlayerName; + CProfile p = new CProfile + { + Active = EOffOn.TR_CONFIG_ON, + AvatarFileName = avatarFilename, + Difficulty = (EGameDifficulty)profile.Difficulty, + GuestProfile = EOffOn.TR_CONFIG_OFF, + PlayerName = profile.PlayerName + }; CProfiles.AddProfile(p); answer = CCommands.CreateCommandWithoutParams(CCommands.ResponseOK); } } - catch (Exception) - { - - } + catch (Exception) {} } break; - - default: - break; } return answer; } - private static string _AddAvatar(byte[] JpgData) + private static string _AddAvatar(byte[] jpgData) { string result = String.Empty; try @@ -206,7 +209,7 @@ namespace Vocaluxe.Base.Server filename = filename + i + ".jpg"; FileStream fs = File.Create(filename); - fs.Write(JpgData, 0, JpgData.Length); + fs.Write(jpgData, 0, jpgData.Length); fs.Flush(); fs.Close(); @@ -216,11 +219,10 @@ namespace Vocaluxe.Base.Server CProfiles.AddAvatar(avatar); result = filename; } - } - catch { } + catch {} return result; } } -} +} \ No newline at end of file diff --git a/Vocaluxe/Lib/Draw/CDirect3D.cs b/Vocaluxe/Lib/Draw/CDirect3D.cs index 28b3c5cb..11dc0ea5 100644 --- a/Vocaluxe/Lib/Draw/CDirect3D.cs +++ b/Vocaluxe/Lib/Draw/CDirect3D.cs @@ -33,7 +33,6 @@ using SlimDX.Windows; using Vocaluxe.Base; using VocaluxeLib; using VocaluxeLib.Draw; -using VocaluxeLib.Menu; namespace Vocaluxe.Lib.Draw { diff --git a/Vocaluxe/Lib/Draw/CDrawWinForm.cs b/Vocaluxe/Lib/Draw/CDrawWinForm.cs index e15143b3..0c0c9ac1 100644 --- a/Vocaluxe/Lib/Draw/CDrawWinForm.cs +++ b/Vocaluxe/Lib/Draw/CDrawWinForm.cs @@ -29,7 +29,6 @@ using System.Windows.Forms; using Vocaluxe.Base; using VocaluxeLib; using VocaluxeLib.Draw; -using VocaluxeLib.Menu; namespace Vocaluxe.Lib.Draw { diff --git a/Vocaluxe/Lib/Draw/COpenGL.cs b/Vocaluxe/Lib/Draw/COpenGL.cs index ff9e45ee..e2cc99d8 100644 --- a/Vocaluxe/Lib/Draw/COpenGL.cs +++ b/Vocaluxe/Lib/Draw/COpenGL.cs @@ -32,7 +32,6 @@ using System.Windows.Forms; using Vocaluxe.Base; using VocaluxeLib; using VocaluxeLib.Draw; -using VocaluxeLib.Menu; using BeginMode = OpenTK.Graphics.OpenGL.BeginMode; using BlendingFactorDest = OpenTK.Graphics.OpenGL.BlendingFactorDest; using BlendingFactorSrc = OpenTK.Graphics.OpenGL.BlendingFactorSrc; diff --git a/Vocaluxe/Lib/Draw/IDraw.cs b/Vocaluxe/Lib/Draw/IDraw.cs index 0894c7fe..1eab8eb2 100644 --- a/Vocaluxe/Lib/Draw/IDraw.cs +++ b/Vocaluxe/Lib/Draw/IDraw.cs @@ -19,10 +19,7 @@ using System.Drawing; using VocaluxeLib; -using VocaluxeLib.Menu; - using VocaluxeLib.Draw; -using VocaluxeLib.Menu; namespace Vocaluxe.Lib.Draw { diff --git a/Vocaluxe/Lib/Input/CControllerFramework.cs b/Vocaluxe/Lib/Input/CControllerFramework.cs index eb088a25..c978a247 100644 --- a/Vocaluxe/Lib/Input/CControllerFramework.cs +++ b/Vocaluxe/Lib/Input/CControllerFramework.cs @@ -1,8 +1,24 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; +#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 . +// */ +#endregion +using System; +using System.Collections.Generic; using VocaluxeLib; namespace Vocaluxe.Lib.Input @@ -25,17 +41,11 @@ namespace Vocaluxe.Lib.Input _CurrentMousePool = new List(); } - 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() { @@ -81,9 +91,7 @@ namespace Vocaluxe.Lib.Input return false; } - public virtual void SetRumble(float duration) - { - } + public virtual void SetRumble(float duration) {} public void AddKeyEvent(SKeyEvent keyEvent) { @@ -101,4 +109,4 @@ namespace Vocaluxe.Lib.Input } } } -} +} \ No newline at end of file diff --git a/Vocaluxe/Lib/Playlist/CPlaylistFile.cs b/Vocaluxe/Lib/Playlist/CPlaylistFile.cs index 64c84e7a..ddf4849e 100644 --- a/Vocaluxe/Lib/Playlist/CPlaylistFile.cs +++ b/Vocaluxe/Lib/Playlist/CPlaylistFile.cs @@ -63,7 +63,9 @@ namespace Vocaluxe.Lib.Playlist if (PlaylistFile == "") { string filename = string.Empty; + // ReSharper disable LoopCanBeConvertedToQuery foreach (char chr in PlaylistName) + // ReSharper restore LoopCanBeConvertedToQuery { if (char.IsLetter(chr)) filename += chr.ToString(); diff --git a/Vocaluxe/Lib/Video/CVideoDecoder.cs b/Vocaluxe/Lib/Video/CVideoDecoder.cs index b197abbb..79ea8b52 100644 --- a/Vocaluxe/Lib/Video/CVideoDecoder.cs +++ b/Vocaluxe/Lib/Video/CVideoDecoder.cs @@ -19,7 +19,6 @@ using System.Collections.Generic; using System.Linq; -using VocaluxeLib; using VocaluxeLib.Draw; namespace Vocaluxe.Lib.Video diff --git a/Vocaluxe/Lib/Video/CVideoDecoderFFmpeg.cs b/Vocaluxe/Lib/Video/CVideoDecoderFFmpeg.cs index a3068048..003f1a09 100644 --- a/Vocaluxe/Lib/Video/CVideoDecoderFFmpeg.cs +++ b/Vocaluxe/Lib/Video/CVideoDecoderFFmpeg.cs @@ -25,8 +25,6 @@ using System.Runtime.InteropServices; using System.Threading; using Vocaluxe.Base; using Vocaluxe.Lib.Video.Acinerella; -using VocaluxeLib; - using VocaluxeLib.Draw; namespace Vocaluxe.Lib.Video diff --git a/Vocaluxe/Lib/Video/CVideoDecoderGstreamer.cs b/Vocaluxe/Lib/Video/CVideoDecoderGstreamer.cs index 1bb66d56..f37b0dc8 100644 --- a/Vocaluxe/Lib/Video/CVideoDecoderGstreamer.cs +++ b/Vocaluxe/Lib/Video/CVideoDecoderGstreamer.cs @@ -20,7 +20,6 @@ using System; using Vocaluxe.Base; using Vocaluxe.Lib.Video.Gstreamer; -using VocaluxeLib; using VocaluxeLib.Draw; namespace Vocaluxe.Lib.Video diff --git a/Vocaluxe/Lib/Video/IVideoDecoder.cs b/Vocaluxe/Lib/Video/IVideoDecoder.cs index 93b274e2..39b54587 100644 --- a/Vocaluxe/Lib/Video/IVideoDecoder.cs +++ b/Vocaluxe/Lib/Video/IVideoDecoder.cs @@ -17,8 +17,6 @@ // */ #endregion -using VocaluxeLib; - using VocaluxeLib.Draw; namespace Vocaluxe.Lib.Video @@ -45,7 +43,6 @@ namespace Vocaluxe.Lib.Video float GetLength(int streamID); /// - /// /// /// /// diff --git a/Vocaluxe/Lib/Webcam/CAForgeNet.cs b/Vocaluxe/Lib/Webcam/CAForgeNet.cs index f3723825..2fb2ff6e 100644 --- a/Vocaluxe/Lib/Webcam/CAForgeNet.cs +++ b/Vocaluxe/Lib/Webcam/CAForgeNet.cs @@ -24,7 +24,6 @@ using System.Drawing; using System.Drawing.Imaging; using System.Runtime.InteropServices; using Vocaluxe.Base; -using VocaluxeLib; using VocaluxeLib.Draw; namespace Vocaluxe.Lib.Webcam diff --git a/Vocaluxe/Lib/Webcam/IWebcam.cs b/Vocaluxe/Lib/Webcam/IWebcam.cs index d2aa249f..6ac143ee 100644 --- a/Vocaluxe/Lib/Webcam/IWebcam.cs +++ b/Vocaluxe/Lib/Webcam/IWebcam.cs @@ -18,9 +18,6 @@ #endregion using System.Collections.Generic; -using System.Drawing; -using VocaluxeLib; - using System.Drawing; using VocaluxeLib.Draw; diff --git a/Vocaluxe/Screens/CScreenMain.cs b/Vocaluxe/Screens/CScreenMain.cs index 4d92afdc..3baff4be 100644 --- a/Vocaluxe/Screens/CScreenMain.cs +++ b/Vocaluxe/Screens/CScreenMain.cs @@ -19,7 +19,6 @@ using System.Windows.Forms; using Vocaluxe.Base; -using Vocaluxe.Base.Fonts; using VocaluxeLib; using VocaluxeLib.Menu; @@ -165,9 +164,7 @@ namespace Vocaluxe.Screens // ReSharper disable ConditionIsAlwaysTrueOrFalse if (CSettings.VersionRevision != ERevision.Release) // ReSharper restore ConditionIsAlwaysTrueOrFalse - { _ReleaseText.Draw(); - } return true; } diff --git a/Vocaluxe/Screens/CScreenNames.cs b/Vocaluxe/Screens/CScreenNames.cs index ab05a46c..1f840fdd 100644 --- a/Vocaluxe/Screens/CScreenNames.cs +++ b/Vocaluxe/Screens/CScreenNames.cs @@ -63,8 +63,8 @@ namespace Vocaluxe.Screens private int _SelectingSwitchNr = -1; private int _SelectingFastPlayerNr; private int _SelectedPlayerNr = -1; - private bool _AvatarsChanged = false; - private bool _ProfilesChanged = false; + private bool _AvatarsChanged; + private bool _ProfilesChanged; #region public methods public override void Init() @@ -106,7 +106,7 @@ namespace Vocaluxe.Screens _ChooseAvatarStatic.Visible = false; _ChooseAvatarStatic.Aspect = EAspect.Crop; - CProfiles.AddProfileChangedCallback(new ProfileChangedCallback(_OnProfileChanged)); + CProfiles.AddProfileChangedCallback(_OnProfileChanged); } public override void LoadTheme(string xmlPath) @@ -670,12 +670,12 @@ namespace Vocaluxe.Screens #endregion public 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; - if (EProfileChangedFlags.Profile == (EProfileChangedFlags.Profile & Flags)) + if (EProfileChangedFlags.Profile == (EProfileChangedFlags.Profile & flags)) _ProfilesChanged = true; } @@ -690,7 +690,7 @@ namespace Vocaluxe.Screens 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) : _OriginalPlayerAvatarTextures[i]; _Texts[_TextPlayer[i]].Text = CProfiles.GetPlayerName(CGame.Players[i].ProfileID, i + 1); diff --git a/Vocaluxe/Screens/CScreenOptionsVideo.cs b/Vocaluxe/Screens/CScreenOptionsVideo.cs index 2a0f8f5f..04b1ef16 100644 --- a/Vocaluxe/Screens/CScreenOptionsVideo.cs +++ b/Vocaluxe/Screens/CScreenOptionsVideo.cs @@ -24,7 +24,6 @@ using Vocaluxe.Lib.Webcam; using VocaluxeLib; using VocaluxeLib.Menu; using VocaluxeLib.Draw; -using VocaluxeLib.Menu; namespace Vocaluxe.Screens { diff --git a/Vocaluxe/Screens/CScreenProfiles.cs b/Vocaluxe/Screens/CScreenProfiles.cs index f869d20f..08e37d59 100644 --- a/Vocaluxe/Screens/CScreenProfiles.cs +++ b/Vocaluxe/Screens/CScreenProfiles.cs @@ -28,7 +28,6 @@ using VocaluxeLib; using VocaluxeLib.Menu; using VocaluxeLib.Profile; using VocaluxeLib.Draw; -using VocaluxeLib.Menu; namespace Vocaluxe.Screens { @@ -82,7 +81,7 @@ namespace Vocaluxe.Screens _EditMode = EEditMode.None; _ProfilesChanged = false; _AvatarsChanged = false; - CProfiles.AddProfileChangedCallback(new ProfileChangedCallback(_OnProfileChanged)); + CProfiles.AddProfileChangedCallback(_OnProfileChanged); } public override void LoadTheme(string xmlPath) @@ -302,12 +301,12 @@ namespace Vocaluxe.Screens _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; - if (EProfileChangedFlags.Profile == (EProfileChangedFlags.Profile & Flags)) + if (EProfileChangedFlags.Profile == (EProfileChangedFlags.Profile & flags)) _ProfilesChanged = true; } @@ -399,7 +398,7 @@ namespace Vocaluxe.Screens _SelectSlides[_SelectSlideProfiles].Selection = selection - 1; } - private void _LoadProfiles(bool Keep) + private void _LoadProfiles(bool keep) { string name = String.Empty; if (_EditMode == EEditMode.PlayerName) @@ -409,12 +408,12 @@ namespace Vocaluxe.Screens _SelectSlides[_SelectSlideProfiles].Clear(); CProfile[] profiles = CProfiles.GetProfiles(); - for (int i = 0; i < profiles.Length; i++) + foreach (CProfile profile in profiles) { _SelectSlides[_SelectSlideProfiles].AddValue( - profiles[i].PlayerName, + profile.PlayerName, null, - profiles[i].ID, + profile.ID, -1); } @@ -428,7 +427,7 @@ namespace Vocaluxe.Screens selectedProfileID = _SelectSlides[_SelectSlideProfiles].ValueIndex; } - if (!Keep) + if (!keep) { _SelectSlides[_SelectSlideDifficulty].Selection = (int)CProfiles.GetDifficulty(selectedProfileID); _SelectSlides[_SelectSlideGuestProfile].Selection = (int)CProfiles.GetGuestProfile(selectedProfileID); @@ -442,21 +441,21 @@ namespace Vocaluxe.Screens _ProfilesChanged = false; } - private void _LoadAvatars(bool Keep) + private void _LoadAvatars(bool keep) { int selectedAvatarID = _SelectSlides[_SelectSlideAvatars].ValueIndex; _SelectSlides[_SelectSlideAvatars].Clear(); - CAvatar[] avatars = CProfiles.GetAvatars(); - for (int i = 0; i < avatars.Length; i++) + IEnumerable avatars = CProfiles.GetAvatars(); + foreach (CAvatar avatar in avatars) { _SelectSlides[_SelectSlideAvatars].AddValue( - Path.GetFileName(avatars[i].FileName), + Path.GetFileName(avatar.FileName), null, - avatars[i].ID, + avatar.ID, -1); } - if (Keep) + if (keep) { _SelectSlides[_SelectSlideAvatars].SetSelectionByValueIndex(selectedAvatarID); CProfiles.SetAvatar(_SelectSlides[_SelectSlideProfiles].ValueIndex, selectedAvatarID); diff --git a/Vocaluxe/Screens/CScreenScore.cs b/Vocaluxe/Screens/CScreenScore.cs index 6931b48c..94838312 100644 --- a/Vocaluxe/Screens/CScreenScore.cs +++ b/Vocaluxe/Screens/CScreenScore.cs @@ -333,7 +333,7 @@ namespace Vocaluxe.Screens _Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.Y - _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); } diff --git a/Vocaluxe/Screens/CScreenSing.cs b/Vocaluxe/Screens/CScreenSing.cs index 6db1d379..ed6aebde 100644 --- a/Vocaluxe/Screens/CScreenSing.cs +++ b/Vocaluxe/Screens/CScreenSing.cs @@ -29,8 +29,6 @@ using Vocaluxe.Base.Fonts; using VocaluxeLib; using VocaluxeLib.Draw; using VocaluxeLib.Menu; -using VocaluxeLib.Menu.SingNotes; -using VocaluxeLib.Menu.SongMenu; using VocaluxeLib.Songs; namespace Vocaluxe.Screens @@ -702,7 +700,7 @@ namespace Vocaluxe.Screens { bool lyricsOnTop = CConfig.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_TOP || 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[_LyricSubTop].Visible = lyricsOnTop; _Statics[_StaticLyricsTop].Visible = lyricsOnTop; @@ -712,8 +710,8 @@ namespace Vocaluxe.Screens private void _SetNormalLyricsVisibility() { bool visible = CConfig.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_BOTTOM - || CConfig.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_BOTH - || (CConfig.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_DYNAMIC && _DynamicLyricsBottom); + || CConfig.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_BOTH + || (CConfig.LyricsPosition == ELyricsPosition.TR_CONFIG_LYRICSPOSITION_DYNAMIC && _DynamicLyricsBottom); _Lyrics[_LyricMain].Visible = visible; _Lyrics[_LyricSub].Visible = visible; _Statics[_StaticLyrics].Visible = visible; @@ -1392,7 +1390,7 @@ namespace Vocaluxe.Screens { 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); else _Statics[_StaticAvatars[i, CGame.NumPlayer - 1]].Visible = false; @@ -1403,7 +1401,7 @@ namespace Vocaluxe.Screens { 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); else _Texts[_TextNames[i, CGame.NumPlayer - 1]].Visible = false; diff --git a/Vocaluxe/Screens/CScreenSong.cs b/Vocaluxe/Screens/CScreenSong.cs index b9d85084..40e9582d 100644 --- a/Vocaluxe/Screens/CScreenSong.cs +++ b/Vocaluxe/Screens/CScreenSong.cs @@ -20,11 +20,11 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.Linq; using System.Windows.Forms; using Vocaluxe.Base; using VocaluxeLib; using VocaluxeLib.Menu; -using VocaluxeLib.Menu.SongMenu; using VocaluxeLib.PartyModes; using VocaluxeLib.Songs; @@ -884,9 +884,7 @@ namespace Vocaluxe.Screens CGame.Reset(); CGame.ClearSongs(); - List ids = new List(); - for (int i = 0; i < CSongs.VisibleSongs.Count; i++) - ids.Add(CSongs.VisibleSongs[i].ID); + List ids = CSongs.VisibleSongs.Select(t => t.ID).ToList(); while (ids.Count > 0) { @@ -910,17 +908,15 @@ namespace Vocaluxe.Screens CGame.Reset(); CGame.ClearSongs(); - List ids = new List(); + List ids; if (allSongs) { + ids = new List(); for (int i = 0; i < CSongs.AllSongs.Count; i++) ids.Add(i); } else - { - for (int i = 0; i < CSongs.VisibleSongs.Count; i++) - ids.Add(CSongs.VisibleSongs[i].ID); - } + ids = CSongs.VisibleSongs.Select(t => t.ID).ToList(); int s = 0; while (s < numSongs && ids.Count > 0) { diff --git a/VocaluxeLib/CBasic.cs b/VocaluxeLib/CBasic.cs index 5c32807e..432a4f28 100644 --- a/VocaluxeLib/CBasic.cs +++ b/VocaluxeLib/CBasic.cs @@ -17,8 +17,6 @@ // */ #endregion -using VocaluxeLib.Menu; - namespace VocaluxeLib { public static class CBase diff --git a/VocaluxeLib/CHelper.cs b/VocaluxeLib/CHelper.cs index e23cce76..bb0ead1f 100644 --- a/VocaluxeLib/CHelper.cs +++ b/VocaluxeLib/CHelper.cs @@ -143,7 +143,9 @@ namespace VocaluxeLib try { + // ReSharper disable LoopCanBeConvertedToQuery foreach (FileInfo file in dir.GetFiles(cast)) + // ReSharper restore LoopCanBeConvertedToQuery files.Add(!fullpath ? file.Name : file.FullName); if (recursive) diff --git a/VocaluxeLib/Draw/CTexture.cs b/VocaluxeLib/Draw/CTexture.cs index 7382351f..bcfec7df 100644 --- a/VocaluxeLib/Draw/CTexture.cs +++ b/VocaluxeLib/Draw/CTexture.cs @@ -1,5 +1,23 @@ -using System.Drawing; -using VocaluxeLib.Menu; +#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 . +// */ +#endregion + +using System.Drawing; namespace VocaluxeLib.Draw { @@ -13,7 +31,7 @@ namespace VocaluxeLib.Draw public string TexturePath = ""; /// - /// Original size (e.g. of bmp) + /// Original size (e.g. of bmp) /// public readonly Size OrigSize; public float OrigAspect @@ -22,7 +40,7 @@ namespace VocaluxeLib.Draw } /// - /// Current size when drawn + /// Current size when drawn /// public SRectF Rect; @@ -31,7 +49,7 @@ namespace VocaluxeLib.Draw private int _W2, _H2; private readonly bool _UseFullTexture; /// - /// Internal texture width (on device), a power of 2 if necessary + /// Internal texture width (on device), a power of 2 if necessary /// public int W2 { @@ -46,7 +64,7 @@ namespace VocaluxeLib.Draw } } /// - /// Internal texture height (on device), a power of 2 if necessary + /// Internal texture height (on device), a power of 2 if necessary /// public int H2 { @@ -62,16 +80,16 @@ namespace VocaluxeLib.Draw } /// - /// Internal use. Specifies which part of texture memory is actually used + /// Internal use. Specifies which part of texture memory is actually used /// public float WidthRatio { get; private set; } /// - /// Internal use. Specifies which part of texture memory is actually used + /// Internal use. Specifies which part of texture memory is actually used /// public float HeightRatio { get; private set; } /// - /// Actual texture space used in x direction + /// Actual texture space used in x direction /// public int UsedWidth { @@ -79,7 +97,7 @@ namespace VocaluxeLib.Draw } /// - /// Actual texture space used in y direction + /// Actual texture space used in y direction /// public int UsedHeight { @@ -112,7 +130,7 @@ namespace VocaluxeLib.Draw */ /// - /// Creates a new texture reference + /// Creates a new texture reference /// /// Original width (Bitmap size) /// Original height (Bitmap size) diff --git a/VocaluxeLib/IBasic.cs b/VocaluxeLib/IBasic.cs index f8e0dbbc..54860c5b 100644 --- a/VocaluxeLib/IBasic.cs +++ b/VocaluxeLib/IBasic.cs @@ -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 . +// */ +#endregion + +using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Drawing; -using System.Linq; -using System.Text; using VocaluxeLib.Draw; using VocaluxeLib.Game; using VocaluxeLib.Menu; -using VocaluxeLib.PartyModes; using VocaluxeLib.Profile; using VocaluxeLib.Songs; namespace VocaluxeLib { - public interface IMenuParty - { - void SetPartyModeID(int partyModeID); - int GetPartyModeID(); - - void AssingPartyMode(IPartyMode partyMode); - void DataToScreen(Object data); - } - public interface IConfig { void SetBackgroundMusicVolume(int newVolume); diff --git a/VocaluxeLib/Menu/CNameSelection.cs b/VocaluxeLib/Menu/CNameSelection.cs index 9035a0ae..5c3c043f 100644 --- a/VocaluxeLib/Menu/CNameSelection.cs +++ b/VocaluxeLib/Menu/CNameSelection.cs @@ -22,7 +22,6 @@ using System.Collections.Generic; using System.Windows.Forms; using System.Xml; using VocaluxeLib.Draw; - using VocaluxeLib.Profile; namespace VocaluxeLib.Menu @@ -489,8 +488,7 @@ namespace VocaluxeLib.Menu 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); - CStatic tileStatic = new CStatic(_PartyModeID, _TextureEmptyTile, ColorEmptyTile, rect); - tileStatic.Aspect = EAspect.Crop; + CStatic tileStatic = new CStatic(_PartyModeID, _TextureEmptyTile, ColorEmptyTile, rect) {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, _Theme.NameFont, _Theme.NameColor, ""); _Tiles.Add(new CTile(tileStatic, tileText, -1)); diff --git a/VocaluxeLib/Menu/CPlaylist.cs b/VocaluxeLib/Menu/CPlaylist.cs index c09c3c43..cdb49cbd 100644 --- a/VocaluxeLib/Menu/CPlaylist.cs +++ b/VocaluxeLib/Menu/CPlaylist.cs @@ -21,7 +21,6 @@ using System; using System.Collections.Generic; using System.Windows.Forms; using System.Xml; -using VocaluxeLib.Menu.SongMenu; using VocaluxeLib.Songs; namespace VocaluxeLib.Menu diff --git a/VocaluxeLib/Menu/IMenu.cs b/VocaluxeLib/Menu/IMenu.cs index 00385fb3..b16a2ab2 100644 --- a/VocaluxeLib/Menu/IMenu.cs +++ b/VocaluxeLib/Menu/IMenu.cs @@ -17,18 +17,6 @@ // */ #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 { public interface IMenu diff --git a/VocaluxeLib/Menu/SingNotes/CSingNotes.cs b/VocaluxeLib/Menu/SingNotes/CSingNotes.cs index e1feb905..01846d46 100644 --- a/VocaluxeLib/Menu/SingNotes/CSingNotes.cs +++ b/VocaluxeLib/Menu/SingNotes/CSingNotes.cs @@ -22,7 +22,6 @@ using System.Collections.Generic; using System.Diagnostics; using System.Xml; using VocaluxeLib.Draw; - using VocaluxeLib.Songs; namespace VocaluxeLib.Menu.SingNotes diff --git a/VocaluxeLib/PartyModes/CPartyModeNone.cs b/VocaluxeLib/PartyModes/CPartyModeNone.cs index bb75b0b0..57ffd217 100644 --- a/VocaluxeLib/PartyModes/CPartyModeNone.cs +++ b/VocaluxeLib/PartyModes/CPartyModeNone.cs @@ -18,7 +18,6 @@ #endregion using System; -using VocaluxeLib.Menu; namespace VocaluxeLib.PartyModes { diff --git a/VocaluxeLib/Profile/CAvatar.cs b/VocaluxeLib/Profile/CAvatar.cs index ebb2da02..36c7c840 100644 --- a/VocaluxeLib/Profile/CAvatar.cs +++ b/VocaluxeLib/Profile/CAvatar.cs @@ -1,9 +1,23 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; +#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 . +// */ +#endregion + using VocaluxeLib.Draw; -using VocaluxeLib.Menu; namespace VocaluxeLib.Profile { @@ -13,14 +27,14 @@ namespace VocaluxeLib.Profile public string FileName = ""; 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(); } diff --git a/VocaluxeLib/Profile/CProfile.cs b/VocaluxeLib/Profile/CProfile.cs index c4b9b0ac..8bcd7eaa 100644 --- a/VocaluxeLib/Profile/CProfile.cs +++ b/VocaluxeLib/Profile/CProfile.cs @@ -1,7 +1,24 @@ -using System; -using System.Collections.Generic; +#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 . +// */ +#endregion + +using System; using System.IO; -using System.Linq; using System.Text; using System.Xml; @@ -9,15 +26,15 @@ namespace VocaluxeLib.Profile { public class CProfile { - private static readonly XmlWriterSettings _Settings = new XmlWriterSettings() - { + private static readonly XmlWriterSettings _Settings = new XmlWriterSettings + { Indent = true, Encoding = Encoding.UTF8, ConformanceLevel = ConformanceLevel.Document }; public int ID; - + public string PlayerName; public string FileName; public string AvatarFileName; @@ -55,9 +72,9 @@ namespace VocaluxeLib.Profile return LoadProfile(FileName); } - public bool LoadProfile(string NewFileName) + public bool LoadProfile(string fileName) { - FileName = NewFileName; + FileName = fileName; CXMLReader xmlReader = CXMLReader.OpenFile(FileName); if (xmlReader == null) @@ -85,7 +102,9 @@ namespace VocaluxeLib.Profile if (FileName == String.Empty) { string filename = string.Empty; + // ReSharper disable LoopCanBeConvertedToQuery foreach (char chr in PlayerName) + // ReSharper restore LoopCanBeConvertedToQuery { if (char.IsLetter(chr)) filename += chr.ToString(); @@ -142,4 +161,4 @@ namespace VocaluxeLib.Profile } } } -} +} \ No newline at end of file diff --git a/VocaluxeLib/Songs/CCategory.cs b/VocaluxeLib/Songs/CCategory.cs index 0f20bbbf..4101d746 100644 --- a/VocaluxeLib/Songs/CCategory.cs +++ b/VocaluxeLib/Songs/CCategory.cs @@ -18,8 +18,6 @@ #endregion using System.Collections.Generic; -using VocaluxeLib; - using VocaluxeLib.Draw; namespace VocaluxeLib.Songs diff --git a/VocaluxeLib/Songs/CSong.cs b/VocaluxeLib/Songs/CSong.cs index 2a616dfd..adf7f34d 100644 --- a/VocaluxeLib/Songs/CSong.cs +++ b/VocaluxeLib/Songs/CSong.cs @@ -20,10 +20,10 @@ using System; using System.Collections.Generic; using System.IO; +using System.Linq; using System.Text; using System.Text.RegularExpressions; using VocaluxeLib.Draw; -using VocaluxeLib.Menu.SingNotes; namespace VocaluxeLib.Songs { @@ -806,9 +806,7 @@ namespace VocaluxeLib.Songs return null; // build sentences list - List sentences = new List(); - foreach (CLine line in voice.Lines) - sentences.Add(line.Points != 0 ? line.Lyrics : String.Empty); + List sentences = voice.Lines.Select(line => line.Points != 0 ? line.Lyrics : String.Empty).ToList(); // find equal sentences series List series = new List(); diff --git a/VocaluxeLib/Structs.cs b/VocaluxeLib/Structs.cs index cfd6b351..e94c3359 100644 --- a/VocaluxeLib/Structs.cs +++ b/VocaluxeLib/Structs.cs @@ -23,10 +23,6 @@ using System.Drawing; using System.Windows.Forms; using VocaluxeLib.Songs; -using System.Windows.Forms; -using VocaluxeLib.Draw; -using VocaluxeLib.Menu.SingNotes; - namespace VocaluxeLib {