diff --git a/PartyModes/PartyModeChallenge/CChallengeRounds.cs b/PartyModes/PartyModeChallenge/CChallengeRounds.cs index 1ad4fe25..ed122395 100644 --- a/PartyModes/PartyModeChallenge/CChallengeRounds.cs +++ b/PartyModes/PartyModeChallenge/CChallengeRounds.cs @@ -157,21 +157,15 @@ namespace VocaluxeLib.PartyModes.Challenge //filter against PlayerNrDemand List combsFiltered = new List(); if (playerNrDemand != null) - { combsFiltered.AddRange(_Combs.Where(t => t.IsAvailableAll(playerNrDemand))); - } //1st fallback if (playerNrDemand != null && combsFiltered.Count == 0) - { combsFiltered.AddRange(_Combs.Where(t => t.IsAvailableSomeone(playerNrDemand))); - } //2nd fallback if (combsFiltered.Count == 0) - { combsFiltered.AddRange(_Combs); - } int num = combsFiltered.Count; int rand = _Rand.Next(num); diff --git a/PartyModes/PartyModeChallenge/CPartyModeChallenge.cs b/PartyModes/PartyModeChallenge/CPartyModeChallenge.cs index b3e860af..fcdd4b98 100644 --- a/PartyModes/PartyModeChallenge/CPartyModeChallenge.cs +++ b/PartyModes/PartyModeChallenge/CPartyModeChallenge.cs @@ -368,9 +368,9 @@ namespace VocaluxeLib.PartyModes.Challenge return _ScreenSongOptions; } -// ReSharper disable RedundantAssignment + // ReSharper disable RedundantAssignment public override void OnSongChange(int songIndex, ref SScreenSongOptions screenSongOptions) -// ReSharper restore RedundantAssignment + // ReSharper restore RedundantAssignment { _ScreenSongOptions.Selection.SongIndex = -1; @@ -389,9 +389,9 @@ namespace VocaluxeLib.PartyModes.Challenge screenSongOptions = _ScreenSongOptions; } -// ReSharper disable RedundantAssignment + // ReSharper disable RedundantAssignment public override void OnCategoryChange(int categoryIndex, ref SScreenSongOptions screenSongOptions) -// ReSharper restore RedundantAssignment + // ReSharper restore RedundantAssignment { if (_GameData.CatSongIndices != null && categoryIndex != -1) { diff --git a/PartyModes/PartyModeChallenge/CPartyScreenChallengeConfig.cs b/PartyModes/PartyModeChallenge/CPartyScreenChallengeConfig.cs index df3678be..bbbd930f 100644 --- a/PartyModes/PartyModeChallenge/CPartyScreenChallengeConfig.cs +++ b/PartyModes/PartyModeChallenge/CPartyScreenChallengeConfig.cs @@ -23,9 +23,9 @@ using VocaluxeLib.Menu; namespace VocaluxeLib.PartyModes.Challenge { -// ReSharper disable UnusedMember.Global + // ReSharper disable UnusedMember.Global public class CPartyScreenChallengeConfig : CMenuParty -// ReSharper restore UnusedMember.Global + // ReSharper restore UnusedMember.Global { // Version number for theme files. Increment it, if you've changed something on the theme files! protected override int _ScreenVersion diff --git a/PartyModes/PartyModeChallenge/CPartyScreenChallengeMain.cs b/PartyModes/PartyModeChallenge/CPartyScreenChallengeMain.cs index 43e6443c..82db58c1 100644 --- a/PartyModes/PartyModeChallenge/CPartyScreenChallengeMain.cs +++ b/PartyModes/PartyModeChallenge/CPartyScreenChallengeMain.cs @@ -41,9 +41,9 @@ namespace VocaluxeLib.PartyModes.Challenge public List TextScores; } -// ReSharper disable UnusedMember.Global + // ReSharper disable UnusedMember.Global public class CPartyScreenChallengeMain : CMenuParty -// ReSharper restore UnusedMember.Global + // ReSharper restore UnusedMember.Global { // Version number for theme files. Increment it, if you've changed something on the theme files! protected override int _ScreenVersion @@ -352,7 +352,7 @@ namespace VocaluxeLib.PartyModes.Challenge private void _UpdateNextPlayerPositions() { - float x = (float) CBase.Settings.GetRenderW() / 2 - ((_GameState.NumPlayerAtOnce * _Statics[_StaticNextPlayer].Rect.W) + ((_GameState.NumPlayerAtOnce - 1) * 15)) / 2; + float x = (float)CBase.Settings.GetRenderW() / 2 - ((_GameState.NumPlayerAtOnce * _Statics[_StaticNextPlayer].Rect.W) + ((_GameState.NumPlayerAtOnce - 1) * 15)) / 2; const float staticY = 590; const float textY = 550; for (int i = 0; i < _GameState.NumPlayerAtOnce; i++) diff --git a/PartyModes/PartyModeChallenge/CPartyScreenChallengeNames.cs b/PartyModes/PartyModeChallenge/CPartyScreenChallengeNames.cs index eadf2a62..08bf3f0d 100644 --- a/PartyModes/PartyModeChallenge/CPartyScreenChallengeNames.cs +++ b/PartyModes/PartyModeChallenge/CPartyScreenChallengeNames.cs @@ -25,9 +25,9 @@ using VocaluxeLib.Menu; namespace VocaluxeLib.PartyModes.Challenge { -// ReSharper disable UnusedMember.Global + // ReSharper disable UnusedMember.Global public class CPartyScreenChallengeNames : CMenuParty -// ReSharper restore UnusedMember.Global + // ReSharper restore UnusedMember.Global { // Version number for theme files. Increment it, if you've changed something on the theme files! protected override int _ScreenVersion @@ -382,9 +382,7 @@ namespace VocaluxeLib.PartyModes.Challenge bool visible = false; //Show profile only if active if (CBase.Profiles.GetProfiles()[i].Active == EOffOn.TR_CONFIG_ON) - { visible = _Data.ScreenNames.ProfileIDs.All(profileID => profileID != i); - } if (visible) _PlayerChooseButtonsVisibleProfiles.Add(i); } diff --git a/PartyModes/PartyModeChallengeMedley/CPartyModeChallengeMedley.cs b/PartyModes/PartyModeChallengeMedley/CPartyModeChallengeMedley.cs index e82ac72b..7028f104 100644 --- a/PartyModes/PartyModeChallengeMedley/CPartyModeChallengeMedley.cs +++ b/PartyModes/PartyModeChallengeMedley/CPartyModeChallengeMedley.cs @@ -375,9 +375,9 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley return _ScreenSongOptions; } -// ReSharper disable RedundantAssignment + // ReSharper disable RedundantAssignment public override void OnSongChange(int songIndex, ref SScreenSongOptions screenSongOptions) -// ReSharper restore RedundantAssignment + // ReSharper restore RedundantAssignment { _ScreenSongOptions.Selection.SongIndex = -1; @@ -396,9 +396,9 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley screenSongOptions = _ScreenSongOptions; } -// ReSharper disable RedundantAssignment + // ReSharper disable RedundantAssignment public override void OnCategoryChange(int categoryIndex, ref SScreenSongOptions screenSongOptions) -// ReSharper restore RedundantAssignment + // ReSharper restore RedundantAssignment { if (_GameData.CatSongIndices != null && categoryIndex != -1) { diff --git a/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyConfig.cs b/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyConfig.cs index 658c93fb..03222db4 100644 --- a/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyConfig.cs +++ b/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyConfig.cs @@ -23,9 +23,9 @@ using VocaluxeLib.Menu; namespace VocaluxeLib.PartyModes.ChallengeMedley { -// ReSharper disable UnusedMember.Global + // ReSharper disable UnusedMember.Global public class CPartyScreenChallengeMedleyConfig : CMenuParty -// ReSharper restore UnusedMember.Global + // ReSharper restore UnusedMember.Global { // Version number for theme files. Increment it, if you've changed something on the theme files! protected override int _ScreenVersion diff --git a/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyMain.cs b/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyMain.cs index 1150dff4..ba0d258d 100644 --- a/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyMain.cs +++ b/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyMain.cs @@ -41,9 +41,9 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley public List TextScores; } -// ReSharper disable UnusedMember.Global + // ReSharper disable UnusedMember.Global public class CPartyScreenChallengeMedleyMain : CMenuParty -// ReSharper restore UnusedMember.Global + // ReSharper restore UnusedMember.Global { // Version number for theme files. Increment it, if you've changed something on the theme files! protected override int _ScreenVersion @@ -352,7 +352,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley private void _UpdateNextPlayerPositions() { - float x = (float) CBase.Settings.GetRenderW() / 2 - ((_GameState.NumPlayerAtOnce * _Statics[_StaticNextPlayer].Rect.W) + ((_GameState.NumPlayerAtOnce - 1) * 15)) / 2; + float x = (float)CBase.Settings.GetRenderW() / 2 - ((_GameState.NumPlayerAtOnce * _Statics[_StaticNextPlayer].Rect.W) + ((_GameState.NumPlayerAtOnce - 1) * 15)) / 2; const float staticY = 590; const float textY = 550; for (int i = 0; i < _GameState.NumPlayerAtOnce; i++) diff --git a/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyNames.cs b/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyNames.cs index cfbf84c6..af6cbc13 100644 --- a/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyNames.cs +++ b/PartyModes/PartyModeChallengeMedley/CPartyScreenChallengeMedleyNames.cs @@ -24,9 +24,9 @@ using VocaluxeLib.Menu; namespace VocaluxeLib.PartyModes.ChallengeMedley { -// ReSharper disable UnusedMember.Global + // ReSharper disable UnusedMember.Global public class CPartyScreenChallengeMedleyNames : CMenuParty -// ReSharper restore UnusedMember.Global + // ReSharper restore UnusedMember.Global { // Version number for theme files. Increment it, if you've changed something on the theme files! protected override int _ScreenVersion diff --git a/PartyModes/PartyModeTicTacToe/CPartyModeTicTacToe.cs b/PartyModes/PartyModeTicTacToe/CPartyModeTicTacToe.cs index 0e012ee3..69d7c33f 100644 --- a/PartyModes/PartyModeTicTacToe/CPartyModeTicTacToe.cs +++ b/PartyModes/PartyModeTicTacToe/CPartyModeTicTacToe.cs @@ -456,16 +456,16 @@ namespace VocaluxeLib.PartyModes.TicTacToe return _ScreenSongOptions; } -// ReSharper disable RedundantAssignment + // ReSharper disable RedundantAssignment public override void OnSongChange(int songIndex, ref SScreenSongOptions screenSongOptions) -// ReSharper restore RedundantAssignment + // ReSharper restore RedundantAssignment { screenSongOptions = _ScreenSongOptions; } -// ReSharper disable RedundantAssignment + // ReSharper disable RedundantAssignment public override void OnCategoryChange(int categoryIndex, ref SScreenSongOptions screenSongOptions) -// ReSharper restore RedundantAssignment + // ReSharper restore RedundantAssignment { screenSongOptions = _ScreenSongOptions; } diff --git a/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeConfig.cs b/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeConfig.cs index 516efd76..c563ee48 100644 --- a/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeConfig.cs +++ b/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeConfig.cs @@ -24,9 +24,9 @@ using VocaluxeLib.Menu; namespace VocaluxeLib.PartyModes.TicTacToe { -// ReSharper disable UnusedMember.Global + // ReSharper disable UnusedMember.Global public class CPartyScreenTicTacToeConfig : CMenuParty -// ReSharper restore UnusedMember.Global + // ReSharper restore UnusedMember.Global { // Version number for theme files. Increment it, if you've changed something on the theme files! protected override int _ScreenVersion @@ -289,7 +289,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe _ConfigOk = false; for (int i = 0; i < CBase.Songs.NumSongsInCategory(_Data.ScreenConfig.CategoryID); i++) { - _ConfigOk=CBase.Songs.GetVisibleSong(i).AvailableGameModes.Any(mode => mode == gm); + _ConfigOk = CBase.Songs.GetVisibleSong(i).AvailableGameModes.Any(mode => mode == gm); if (_ConfigOk) break; } diff --git a/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeMain.cs b/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeMain.cs index 886a9779..6d1065ed 100644 --- a/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeMain.cs +++ b/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeMain.cs @@ -353,7 +353,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe { _Texts[_TextFinishMessage].Color = CBase.Theme.GetPlayerColor(winner); _Texts[_TextFinishMessage].Text = CBase.Language.Translate("TR_SCREENMAIN_WINNER", _PartyModeID) + " " + CBase.Language.Translate("TR_TEAM", _PartyModeID) + " " + - winner; + winner; } else { @@ -607,7 +607,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe { _Texts[_TextTeamChoosing].Color = CBase.Theme.GetPlayerColor(_GameData.Team + 1); _Texts[_TextTeamChoosing].Text = CBase.Language.Translate("TR_TEAM", _PartyModeID) + " " + (_GameData.Team + 1) + "! " + - CBase.Language.Translate("TR_SCREENMAIN_TEAM_CHOOSE", _PartyModeID); + CBase.Language.Translate("TR_SCREENMAIN_TEAM_CHOOSE", _PartyModeID); if (_Status == EStatus.JokerRetry || _Status == EStatus.FieldChoosing) _Texts[_TextTeamChoosing].Visible = true; else diff --git a/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeNames.cs b/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeNames.cs index 6ef12c28..c8e79710 100644 --- a/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeNames.cs +++ b/PartyModes/PartyModeTicTacToe/CPartyScreenTicTacToeNames.cs @@ -24,9 +24,9 @@ using VocaluxeLib.Menu; namespace VocaluxeLib.PartyModes.TicTacToe { -// ReSharper disable UnusedMember.Global + // ReSharper disable UnusedMember.Global public class CPartyScreenTicTacToeNames : CMenuParty -// ReSharper restore UnusedMember.Global + // ReSharper restore UnusedMember.Global { // Version number for theme files. Increment it, if you've changed something on the theme files! protected override int _ScreenVersion @@ -405,7 +405,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe _UpdateButtonPlayerChoose(_PlayerChooseButtonsOffset); _Buttons[_ButtonPlayerChooseScrollUp].Enabled = _PlayerChooseButtonsOffset > 0; _Buttons[_ButtonPlayerChooseScrollDown].Enabled = _PlayerChooseButtonsVisibleProfiles.Count > - _PlayerChooseButtons.Count + _PlayerChooseButtonsOffset * _PlayerChooseButtonsNumH; + _PlayerChooseButtons.Count + _PlayerChooseButtonsOffset * _PlayerChooseButtonsNumH; } private void _UpdateButtonPlayerChoose(int offset) diff --git a/Vocaluxe/Base/CBackgroundMusic.cs b/Vocaluxe/Base/CBackgroundMusic.cs index e5eeff57..c968dadf 100644 --- a/Vocaluxe/Base/CBackgroundMusic.cs +++ b/Vocaluxe/Base/CBackgroundMusic.cs @@ -116,7 +116,7 @@ namespace Vocaluxe.Base { get { - if (_CurrentPlaylistElement.Artist.Length > 0 && _CurrentPlaylistElement.Title.Length > 0) + if (_CurrentPlaylistElement.Artist != "" && _CurrentPlaylistElement.Title != "") return _CurrentPlaylistElement.Artist + " - " + _CurrentPlaylistElement.Title; else return Path.GetFileNameWithoutExtension(_CurrentPlaylistElement.MusicFilePath); diff --git a/Vocaluxe/Base/CConfig.cs b/Vocaluxe/Base/CConfig.cs index fa60513a..ed3287be 100644 --- a/Vocaluxe/Base/CConfig.cs +++ b/Vocaluxe/Base/CConfig.cs @@ -505,7 +505,7 @@ namespace Vocaluxe.Base for (int p = 1; p <= CSettings.MaxNumPlayer; p++) { - if (MicConfig[p - 1].DeviceName.Length > 0 && MicConfig[p - 1].InputName.Length > 0 && MicConfig[p - 1].Channel > 0) + if (MicConfig[p - 1].DeviceName != "" && MicConfig[p - 1].InputName != "" && MicConfig[p - 1].Channel > 0) { writer.WriteStartElement("MicConfig" + p); @@ -580,15 +580,15 @@ namespace Vocaluxe.Base if (devices == null) return false; - for (int dev = 0; dev < devices.Length; dev++) + for (int dev = 0; dev < devices.Length; dev++) + { + for (int inp = 0; inp < devices[dev].Inputs.Count; inp++) { - for (int inp = 0; inp < devices[dev].Inputs.Count; inp++) - { - if (devices[dev].Inputs[inp].PlayerChannel1 == player || devices[dev].Inputs[inp].PlayerChannel2 == player) - return true; - } + if (devices[dev].Inputs[inp].PlayerChannel1 == player || devices[dev].Inputs[inp].PlayerChannel2 == player) + return true; } - return false; + } + return false; } /// @@ -689,7 +689,7 @@ namespace Vocaluxe.Base { //Only found a parameter case 1: - if (!Regex.IsMatch(parts[0], @"ReplacedStr:::3:::") && parts[0].Length > 0) + if (!Regex.IsMatch(parts[0], @"ReplacedStr:::3:::") && parts[0] != "") { //Add parameter _Params.Add(parts[0]); @@ -702,7 +702,7 @@ namespace Vocaluxe.Base //Found parameter and value case 2: - if (!Regex.IsMatch(parts[0], @"ReplacedStr:::5:::") && parts[0].Length > 0) + if (!Regex.IsMatch(parts[0], @"ReplacedStr:::5:::") && parts[0] != "") { //Add parameter _Params.Add(parts[0]); @@ -810,7 +810,7 @@ namespace Vocaluxe.Base { for (int j = 0; j < CSettings.MaxNumPlayer; j++) { - if (Players[j].Length > 0) + if (Players[j] != "") { if (Path.GetFileName(CProfiles.Profiles[i].ProfileFile) == Players[j] && CProfiles.Profiles[i].Active == EOffOn.TR_CONFIG_ON) { diff --git a/Vocaluxe/Base/CCover.cs b/Vocaluxe/Base/CCover.cs index f508e73f..d6089808 100644 --- a/Vocaluxe/Base/CCover.cs +++ b/Vocaluxe/Base/CCover.cs @@ -177,7 +177,7 @@ namespace Vocaluxe.Base xmlReader.GetValue("//root/Info/Name", out coverTheme.Name, String.Empty); xmlReader.GetValue("//root/Info/Folder", out coverTheme.Folder, String.Empty); - if (coverTheme.Folder.Length > 0 && coverTheme.Name.Length > 0) + if (coverTheme.Folder != "" && coverTheme.Name != "") { coverTheme.File = file; @@ -239,9 +239,9 @@ namespace Vocaluxe.Base if (_CoverExists(name)) continue; -// ReSharper disable AssignNullToNotNullAttribute + // ReSharper disable AssignNullToNotNullAttribute SCover sk = new SCover {Name = name, Value = Path.Combine(coverTheme.Folder, Path.GetFileName(file))}; -// ReSharper restore AssignNullToNotNullAttribute + // ReSharper restore AssignNullToNotNullAttribute sk.Texture = CDraw.AddTexture(Path.Combine(CSettings.FolderCover, sk.Value)); diff --git a/Vocaluxe/Base/CDataBase.cs b/Vocaluxe/Base/CDataBase.cs index 8f2e1b89..6a41e5fb 100644 --- a/Vocaluxe/Base/CDataBase.cs +++ b/Vocaluxe/Base/CDataBase.cs @@ -174,9 +174,7 @@ namespace Vocaluxe.Base } if (reader != null) - { reader.Dispose(); - } command.CommandText = "INSERT INTO Scores (SongID, PlayerName, Score, LineNr, Date, Medley, Duet, ShortSong, Difficulty) " + "VALUES (@SongID, @PlayerName, @Score, @LineNr, @Date, @Medley, @Duet, @ShortSong, @Difficulty)"; diff --git a/Vocaluxe/Base/CFont.cs b/Vocaluxe/Base/CFont.cs index f5274c6f..10b8f7d0 100644 --- a/Vocaluxe/Base/CFont.cs +++ b/Vocaluxe/Base/CFont.cs @@ -341,9 +341,7 @@ namespace Vocaluxe.Base public static float Height { get { return _Height; } - set { - _Height = value < 0f ? 0f : value; - } + set { _Height = value < 0f ? 0f : value; } } public static float Outline @@ -413,7 +411,7 @@ namespace Vocaluxe.Base if (h <= 0f) return; - if (text.Length == 0) + if (text == "") return; Height = h; @@ -432,7 +430,7 @@ namespace Vocaluxe.Base if (h <= 0f) return; - if (text.Length == 0) + if (text == "") return; Height = h; @@ -451,7 +449,7 @@ namespace Vocaluxe.Base if (h <= 0f) return; - if (text.Length == 0) + if (text == "") return; Height = h; @@ -581,7 +579,7 @@ namespace Vocaluxe.Base { SFont sf = new SFont(); sf.Folder = value; - sf.IsThemeFont = themeName.Length > 0; + sf.IsThemeFont = themeName != ""; sf.ThemeName = themeName; sf.PartyModeID = partyModeId; @@ -631,7 +629,7 @@ namespace Vocaluxe.Base string fontTypes; if (partyModeId >= 0) fontTypes = "theme fonts for party mode"; - else if (themeName.Length > 0) + else if (themeName != "") fontTypes = "theme fonts for theme \"" + themeName + "\""; else fontTypes = "basic fonts"; @@ -747,7 +745,7 @@ namespace Vocaluxe.Base private static int _GetFontIndex(string themeName, string fontName) { - if (themeName.Length == 0 || fontName.Length == 0) + if (themeName == "" || fontName == "") return -1; for (int i = 0; i < _Fonts.Count; i++) @@ -761,7 +759,7 @@ namespace Vocaluxe.Base private static int _GetFontIndexParty(int partyModeID, string fontName) { - if (partyModeID == -1 || fontName.Length == 0) + if (partyModeID == -1 || fontName == "") return -1; for (int i = 0; i < _Fonts.Count; i++) diff --git a/Vocaluxe/Base/CGraphics.cs b/Vocaluxe/Base/CGraphics.cs index 524371ad..88f603cf 100644 --- a/Vocaluxe/Base/CGraphics.cs +++ b/Vocaluxe/Base/CGraphics.cs @@ -772,9 +772,7 @@ namespace Vocaluxe.Base debugOutput.Add(CSongs.NumSongsWithCoverLoaded.ToString(CLanguage.Translate("TR_DEBUG_SONGS") + ": 00000")); if (CConfig.DebugLevel >= EDebugLevel.TR_CONFIG_LEVEL_MAX) - { debugOutput.Add(_Cursor.X.ToString(CLanguage.Translate("TR_DEBUG_MOUSE") + " : (0000/") + _Cursor.Y.ToString("0000)")); - } } } } @@ -783,7 +781,7 @@ namespace Vocaluxe.Base CFonts.Height = 30; SColorF gray = new SColorF(1f, 1f, 1f, 0.5f); float y = 0; - foreach (var txt in debugOutput) + foreach (string txt in debugOutput) { RectangleF rect = new RectangleF(CSettings.RenderW - CFonts.GetTextWidth(txt), y, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt)); CDraw.DrawColor(gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.ZNear)); @@ -796,7 +794,7 @@ namespace Vocaluxe.Base { _Cursor.UnloadTextures(); - if (CTheme.Cursor.Color.Length > 0) + if (CTheme.Cursor.Color != "") { SColorF color; color = CTheme.GetColor(CTheme.Cursor.Color, -1); diff --git a/Vocaluxe/Base/CLog.cs b/Vocaluxe/Base/CLog.cs index b97b8d46..9243d516 100644 --- a/Vocaluxe/Base/CLog.cs +++ b/Vocaluxe/Base/CLog.cs @@ -62,9 +62,9 @@ namespace Vocaluxe.Base if (_LogFile == null) _Open(); -// ReSharper disable PossibleNullReferenceException + // ReSharper disable PossibleNullReferenceException _LogFile.WriteLine(text); -// ReSharper restore PossibleNullReferenceException + // ReSharper restore PossibleNullReferenceException _LogFile.Flush(); } diff --git a/Vocaluxe/Base/CParty.cs b/Vocaluxe/Base/CParty.cs index 4961957e..62c97b72 100644 --- a/Vocaluxe/Base/CParty.cs +++ b/Vocaluxe/Base/CParty.cs @@ -343,10 +343,7 @@ namespace Vocaluxe.Base private static Assembly _CompileFiles(string[] files) { - if (files == null) - return null; - - if (files.Length == 0) + if (files == null || files.Length == 0) return null; CompilerParameters compilerParams = new CompilerParameters(); diff --git a/Vocaluxe/Base/CPlaylists.cs b/Vocaluxe/Base/CPlaylists.cs index 17cc5713..0b6903b7 100644 --- a/Vocaluxe/Base/CPlaylists.cs +++ b/Vocaluxe/Base/CPlaylists.cs @@ -116,7 +116,7 @@ namespace Vocaluxe.Base { if (playlistID < 0 || playlistID >= _Playlists.Count) return; - if (_Playlists[playlistID].PlaylistFile.Length > 0) + if (_Playlists[playlistID].PlaylistFile != "") { try { diff --git a/Vocaluxe/Base/CProfiles.cs b/Vocaluxe/Base/CProfiles.cs index f4542639..3538024a 100644 --- a/Vocaluxe/Base/CProfiles.cs +++ b/Vocaluxe/Base/CProfiles.cs @@ -77,7 +77,7 @@ namespace Vocaluxe.Base profile.GuestProfile = EOffOn.TR_CONFIG_OFF; profile.Active = EOffOn.TR_CONFIG_ON; - if (fileName.Length > 0) + if (fileName != "") profile.ProfileFile = Path.Combine(CSettings.FolderProfiles, fileName); else profile.ProfileFile = String.Empty; @@ -163,7 +163,7 @@ namespace Vocaluxe.Base return String.Empty; SProfile profile = _Profiles[profileNr]; - if (profile.PlayerName.Length > 0) + if (profile.PlayerName != "") profile.PlayerName = profile.PlayerName.Remove(profile.PlayerName.Length - 1); _Profiles[profileNr] = profile; @@ -266,7 +266,7 @@ namespace Vocaluxe.Base { if (profileID < 0 || profileID >= _Profiles.Count) return; - if (_Profiles[profileID].ProfileFile.Length > 0) + if (_Profiles[profileID].ProfileFile != "") { try { @@ -306,7 +306,7 @@ namespace Vocaluxe.Base if (profileID < 0 || profileID >= _Profiles.Count) return; - if (_Profiles[profileID].ProfileFile.Length == 0) + if (_Profiles[profileID].ProfileFile == "") { string filename = string.Empty; foreach (char chr in _Profiles[profileID].PlayerName) @@ -315,7 +315,7 @@ namespace Vocaluxe.Base filename += chr.ToString(); } - if (filename.Length == 0) + if (filename == "") filename = "1"; int i = 0; diff --git a/Vocaluxe/Base/CSettings.cs b/Vocaluxe/Base/CSettings.cs index cbf890e2..f69c922b 100644 --- a/Vocaluxe/Base/CSettings.cs +++ b/Vocaluxe/Base/CSettings.cs @@ -148,9 +148,9 @@ namespace Vocaluxe.Base VersionMinor + "." + VersionSub + " (" + Arch + ")"; -// ReSharper disable ConditionIsAlwaysTrueOrFalse + // ReSharper disable ConditionIsAlwaysTrueOrFalse if (VersionRevision != ERevision.Release) -// ReSharper restore ConditionIsAlwaysTrueOrFalse + // ReSharper restore ConditionIsAlwaysTrueOrFalse version += " " + _GetVersionStatus() + String.Format(" ({0:0000)}", Build); return version; @@ -160,7 +160,7 @@ namespace Vocaluxe.Base { string version = ProgramName; - if (ProgramCodeName.Length > 0) + if (ProgramCodeName != "") version += " \"" + ProgramCodeName + "\""; return version + " " + GetVersionText(); @@ -170,9 +170,9 @@ namespace Vocaluxe.Base { string result; -// ReSharper disable ConditionIsAlwaysTrueOrFalse + // ReSharper disable ConditionIsAlwaysTrueOrFalse if (VersionRevision != ERevision.Release) -// ReSharper restore ConditionIsAlwaysTrueOrFalse + // ReSharper restore ConditionIsAlwaysTrueOrFalse result = Enum.GetName(typeof(ERevision), VersionRevision); return result; diff --git a/Vocaluxe/Base/CSongCategorizer.cs b/Vocaluxe/Base/CSongCategorizer.cs index 425adf78..a9aedb6b 100644 --- a/Vocaluxe/Base/CSongCategorizer.cs +++ b/Vocaluxe/Base/CSongCategorizer.cs @@ -98,7 +98,7 @@ namespace Vocaluxe.Base int noCategoryIndex = -1; for (int i = 0; i < CSongs.Sorter.SortedSongs.Length; i++) { - if (CSongs.Sorter.SortedSongs[i].SortString.Length > 0) + if (CSongs.Sorter.SortedSongs[i].SortString != "") { if (CSongs.Sorter.SortedSongs[i].SortString != category) { @@ -154,7 +154,7 @@ namespace Vocaluxe.Base for (int i = 0; i < CSongs.Sorter.SortedSongs.Length; i++) { string year = CSongs.Sorter.SortedSongs[i].SortString; - if (year.Length > 0) + if (year != "") { year = year.Substring(0, 3); CSongs.Sorter.SortedSongs[i].SortString = year + "0 - " + year + "9"; diff --git a/Vocaluxe/Base/CSongFilter.cs b/Vocaluxe/Base/CSongFilter.cs index c5e6fd9f..c031695a 100644 --- a/Vocaluxe/Base/CSongFilter.cs +++ b/Vocaluxe/Base/CSongFilter.cs @@ -84,7 +84,7 @@ namespace Vocaluxe.Base _FilteredSongs.Clear(); string[] searchStrings = null; - if (_SearchString.Length > 0) + if (_SearchString != "") searchStrings = _SearchString.ToUpper().Split(new char[] {' '}); foreach (CSong song in CSongs.Songs) diff --git a/Vocaluxe/Base/CSongSorter.cs b/Vocaluxe/Base/CSongSorter.cs index 1a4d569e..7e589b2a 100644 --- a/Vocaluxe/Base/CSongSorter.cs +++ b/Vocaluxe/Base/CSongSorter.cs @@ -125,14 +125,14 @@ namespace Vocaluxe.Base private List _CreateSortList(string fieldName) { List sortList = new List(); - if (fieldName.Length == 0) + if (fieldName == "") CSongs.Filter.FilteredSongs.ForEach(song => sortList.Add(new SSongPointer(song.ID, ""))); else { FieldInfo field = typeof(CSong).GetField(fieldName, BindingFlags.Instance | BindingFlags.DeclaredOnly | BindingFlags.Public); if (field == null) { - CLog.LogError("Unknow sorting field: "+fieldName); + CLog.LogError("Unknow sorting field: " + fieldName); return _CreateSortList(""); } bool isString = field.FieldType == typeof(string); diff --git a/Vocaluxe/Base/CSound.cs b/Vocaluxe/Base/CSound.cs index 6cb30fc7..6b09af30 100644 --- a/Vocaluxe/Base/CSound.cs +++ b/Vocaluxe/Base/CSound.cs @@ -183,7 +183,7 @@ namespace Vocaluxe.Base break; } - if (file.Length == 0) + if (file == "") return -1; int stream = Load(file); diff --git a/Vocaluxe/Base/CTheme.cs b/Vocaluxe/Base/CTheme.cs index 81fe6739..c61499f3 100644 --- a/Vocaluxe/Base/CTheme.cs +++ b/Vocaluxe/Base/CTheme.cs @@ -426,7 +426,7 @@ namespace Vocaluxe.Base if (version == _ThemeSystemVersion) { xmlReader.GetValue("//root/Info/Name", out theme.Name, String.Empty); - if (theme.Name.Length > 0) + if (theme.Name != "") { xmlReader.GetValue("//root/Info/Author", out theme.Author, String.Empty); xmlReader.GetValue("//root/Info/SkinFolder", out theme.SkinFolder, String.Empty); @@ -493,7 +493,7 @@ namespace Vocaluxe.Base if (version == _SkinSystemVersion) { xmlReader.GetValue("//root/Info/Name", out skin.Name, String.Empty); - if (skin.Name.Length > 0) + if (skin.Name != "") { xmlReader.GetValue("//root/Info/Author", out skin.Author, String.Empty); xmlReader.TryGetIntValue("//root/Info/SkinVersionMajor", ref skin.SkinVersionMajor); @@ -835,7 +835,7 @@ namespace Vocaluxe.Base writer.WriteElementString("W", Cursor.W.ToString("#0.000")); writer.WriteElementString("H", Cursor.H.ToString("#0.000")); - if (Cursor.Color.Length > 0) + if (Cursor.Color != "") writer.WriteElementString("Color", Cursor.Color); else { diff --git a/Vocaluxe/Base/CWebcam.cs b/Vocaluxe/Base/CWebcam.cs index 74995990..0a361c68 100644 --- a/Vocaluxe/Base/CWebcam.cs +++ b/Vocaluxe/Base/CWebcam.cs @@ -86,5 +86,10 @@ namespace Vocaluxe.Base { return _Webcam.GetDevices(); } + + public static bool IsDeviceAvailable() + { + return _Webcam.IsDeviceAvailable(); + } } } \ No newline at end of file diff --git a/Vocaluxe/GameModes/CGameModeNormal.cs b/Vocaluxe/GameModes/CGameModeNormal.cs index 31375949..e728a923 100644 --- a/Vocaluxe/GameModes/CGameModeNormal.cs +++ b/Vocaluxe/GameModes/CGameModeNormal.cs @@ -20,6 +20,5 @@ namespace Vocaluxe.GameModes { // Nomal singing - class CGameModeNormal : CGameMode - {} + class CGameModeNormal : CGameMode {} } \ No newline at end of file diff --git a/Vocaluxe/Lib/Draw/CDrawWinForm.cs b/Vocaluxe/Lib/Draw/CDrawWinForm.cs index 7aa33fca..bd2756c4 100644 --- a/Vocaluxe/Lib/Draw/CDrawWinForm.cs +++ b/Vocaluxe/Lib/Draw/CDrawWinForm.cs @@ -346,7 +346,7 @@ namespace Vocaluxe.Lib.Draw } // Draw Basic Text - public void DrawText(string text, int x, int y, int h, int z=0) + public void DrawText(string text, int x, int y, int h, int z = 0) { CFonts.DrawText(text, h, x, y, z, new SColorF(1, 1, 1, 1)); } diff --git a/Vocaluxe/Lib/Draw/COpenGL.cs b/Vocaluxe/Lib/Draw/COpenGL.cs index 4ef1bc67..54056001 100644 --- a/Vocaluxe/Lib/Draw/COpenGL.cs +++ b/Vocaluxe/Lib/Draw/COpenGL.cs @@ -142,7 +142,7 @@ namespace Vocaluxe.Lib.Draw if (setValue > 32) setValue = 32; - while (samples<=setValue) + while (samples <= setValue) { GraphicsMode mode; try @@ -563,7 +563,7 @@ namespace Vocaluxe.Lib.Draw public void DrawLine(int a, int r, int g, int b, int w, int x1, int y1, int x2, int y2) {} // Draw Basic Text (must be deleted later) - public void DrawText(string text, int x, int y, int h, int z=0) + public void DrawText(string text, int x, int y, int h, int z = 0) { CFonts.DrawText(text, h, x, y, z, new SColorF(1, 1, 1, 1)); } @@ -1094,7 +1094,8 @@ namespace Vocaluxe.Lib.Draw public void DrawTexture(STexture texture, SRectF rect, SColorF color, SRectF bounds, bool mirrored) { - if (Math.Abs(rect.W) < float.Epsilon || Math.Abs(rect.H) < float.Epsilon || Math.Abs(bounds.H) < float.Epsilon || Math.Abs(bounds.W) < float.Epsilon || Math.Abs(color.A) < float.Epsilon) + if (Math.Abs(rect.W) < float.Epsilon || Math.Abs(rect.H) < float.Epsilon || Math.Abs(bounds.H) < float.Epsilon || Math.Abs(bounds.W) < float.Epsilon || + Math.Abs(color.A) < float.Epsilon) return; if (bounds.X > rect.X + rect.W || bounds.X + bounds.W < rect.X) @@ -1233,7 +1234,8 @@ namespace Vocaluxe.Lib.Draw public void DrawTextureReflection(STexture texture, SRectF rect, SColorF color, SRectF bounds, float space, float height) { - if (Math.Abs(rect.W) < float.Epsilon || Math.Abs(rect.H) < float.Epsilon || Math.Abs(bounds.H) < float.Epsilon || Math.Abs(bounds.W) < float.Epsilon || Math.Abs(color.A) < float.Epsilon || height <= float.Epsilon) + if (Math.Abs(rect.W) < float.Epsilon || Math.Abs(rect.H) < float.Epsilon || Math.Abs(bounds.H) < float.Epsilon || Math.Abs(bounds.W) < float.Epsilon || + Math.Abs(color.A) < float.Epsilon || height <= float.Epsilon) return; if (bounds.X > rect.X + rect.W || bounds.X + bounds.W < rect.X) diff --git a/Vocaluxe/Lib/Draw/IDraw.cs b/Vocaluxe/Lib/Draw/IDraw.cs index 728c4ea9..6da270b0 100644 --- a/Vocaluxe/Lib/Draw/IDraw.cs +++ b/Vocaluxe/Lib/Draw/IDraw.cs @@ -46,7 +46,7 @@ namespace Vocaluxe.Lib.Draw void MakeScreenShot(); // Draw Basic Text (must be deleted later) - void DrawText(string text, int x, int y, int h, int z=0); + void DrawText(string text, int x, int y, int h, int z = 0); STexture AddTexture(string texturePath); STexture AddTexture(Bitmap bitmap); diff --git a/Vocaluxe/Lib/Playlist/CPlaylistFile.cs b/Vocaluxe/Lib/Playlist/CPlaylistFile.cs index c1273112..58d57c00 100644 --- a/Vocaluxe/Lib/Playlist/CPlaylistFile.cs +++ b/Vocaluxe/Lib/Playlist/CPlaylistFile.cs @@ -59,7 +59,7 @@ namespace Vocaluxe.Lib.Playlist public void SavePlaylist() { - if (PlaylistFile.Length == 0) + if (PlaylistFile == "") { string filename = string.Empty; foreach (char chr in PlaylistName) @@ -68,7 +68,7 @@ namespace Vocaluxe.Lib.Playlist filename += chr.ToString(); } - if (filename.Length == 0) + if (filename == "") filename = "1"; int i = 0; @@ -146,7 +146,8 @@ namespace Vocaluxe.Lib.Playlist List songs = xmlReader.GetValues("Songs"); EGameMode gm = EGameMode.TR_GAMEMODE_NORMAL; - foreach (string song in songs) { + foreach (string song in songs) + { string artist; string title; xmlReader.GetValue("//root/Songs/" + song + "/Artist", out artist, String.Empty); @@ -157,7 +158,8 @@ namespace Vocaluxe.Lib.Playlist playlistSong.SongID = -1; CSong[] allSongs = CSongs.AllSongs; - foreach (CSong curSong in allSongs) { + foreach (CSong curSong in allSongs) + { if (curSong.Artist != artist || curSong.Title != title) continue; playlistSong.SongID = curSong.ID; diff --git a/Vocaluxe/Lib/Sound/COpenALPlay.cs b/Vocaluxe/Lib/Sound/COpenALPlay.cs index 775b6ca5..f9616987 100644 --- a/Vocaluxe/Lib/Sound/COpenALPlay.cs +++ b/Vocaluxe/Lib/Sound/COpenALPlay.cs @@ -844,7 +844,7 @@ namespace Vocaluxe.Lib.Sound if (buffer != 0) { - ALFormat alFormat = (_Format.ChannelCount == 2)?ALFormat.Stereo16:ALFormat.Mono16; + ALFormat alFormat = (_Format.ChannelCount == 2) ? ALFormat.Stereo16 : ALFormat.Mono16; AL.BufferData(buffer, alFormat, buf, buf.Length, _Format.SamplesPerSecond); Console.WriteLine("Write to Buffer: " + buffer); AL.SourceQueueBuffer(_Source, buffer); diff --git a/Vocaluxe/Lib/Sound/CPortAudioRecord.cs b/Vocaluxe/Lib/Sound/CPortAudioRecord.cs index b39c3eee..fab75e12 100644 --- a/Vocaluxe/Lib/Sound/CPortAudioRecord.cs +++ b/Vocaluxe/Lib/Sound/CPortAudioRecord.cs @@ -120,19 +120,16 @@ namespace Vocaluxe.Lib.Sound if (deviceConfig == null) return false; - if (_RecHandle == null) + if (_RecHandle == null || _RecHandle.Length == 0) return false; - if (_RecHandle.Length == 0) - return false; + foreach (CBuffer buffer in _Buffer) + buffer.Reset(); - for (int i = 0; i < _Buffer.Length; i++) - _Buffer[i].Reset(); - - for (int i = 0; i < _RecHandle.Length; i++) + foreach (IntPtr handle in _RecHandle) { int waitcount = 0; - while (waitcount < 5 && CPortAudio.Pa_IsStreamStopped(_RecHandle[i]) == CPortAudio.EPaError.PaStreamIsNotStopped) + while (waitcount < 5 && CPortAudio.Pa_IsStreamStopped(handle) == CPortAudio.EPaError.PaStreamIsNotStopped) { Thread.Sleep(1); waitcount++; diff --git a/Vocaluxe/Lib/Sound/Decoder/CAudioDecoderFFmpeg.cs b/Vocaluxe/Lib/Sound/Decoder/CAudioDecoderFFmpeg.cs index 3bdd388c..6f40c539 100644 --- a/Vocaluxe/Lib/Sound/Decoder/CAudioDecoderFFmpeg.cs +++ b/Vocaluxe/Lib/Sound/Decoder/CAudioDecoderFFmpeg.cs @@ -36,9 +36,7 @@ namespace Vocaluxe.Lib.Sound.Decoder private string _FileName; private bool _FileOpened; - public void Init() - { - } + public void Init() {} public void Open(string fileName, bool loop) { diff --git a/Vocaluxe/Lib/Sound/Decoder/IAudioDecoder.cs b/Vocaluxe/Lib/Sound/Decoder/IAudioDecoder.cs index c98b66ec..55c21761 100644 --- a/Vocaluxe/Lib/Sound/Decoder/IAudioDecoder.cs +++ b/Vocaluxe/Lib/Sound/Decoder/IAudioDecoder.cs @@ -31,7 +31,7 @@ namespace Vocaluxe.Lib.Sound.Decoder void Init(); void Close(); - void Open(string fileName, bool loop=false); + void Open(string fileName, bool loop = false); SFormatInfo GetFormatInfo(); float GetLength(); diff --git a/Vocaluxe/Lib/Sound/Portaudio/PortAudio.cs b/Vocaluxe/Lib/Sound/Portaudio/PortAudio.cs index 7adfb7c1..d80d4cac 100644 --- a/Vocaluxe/Lib/Sound/Portaudio/PortAudio.cs +++ b/Vocaluxe/Lib/Sound/Portaudio/PortAudio.cs @@ -28,7 +28,7 @@ namespace Vocaluxe.Lib.Sound.PortAudio */ - public static partial class CPortAudio + public static class CPortAudio { #region **** PORTAUDIO CALLBACKS **** [UnmanagedFunctionPointer(CallingConvention.Cdecl)] diff --git a/Vocaluxe/Lib/Video/Acinerella/CAcinerella.cs b/Vocaluxe/Lib/Video/Acinerella/CAcinerella.cs index 32eafb4f..3851b485 100644 --- a/Vocaluxe/Lib/Video/Acinerella/CAcinerella.cs +++ b/Vocaluxe/Lib/Video/Acinerella/CAcinerella.cs @@ -141,6 +141,7 @@ namespace Vocaluxe.Lib.Video.Acinerella //Size of the data in the buffer. public readonly Int32 BufferSize; } + // Contains information about an Acinerella package. [StructLayout(LayoutKind.Sequential)] public struct SACPackage @@ -278,9 +279,9 @@ namespace Vocaluxe.Lib.Video.Acinerella string filename ); -// ReSharper disable UnusedMethodReturnValue.Global + // ReSharper disable UnusedMethodReturnValue.Global public static Int32 AcOpen2( -// ReSharper restore UnusedMethodReturnValue.Global + // ReSharper restore UnusedMethodReturnValue.Global IntPtr pAcInstance, string filename ) @@ -430,9 +431,9 @@ namespace Vocaluxe.Lib.Video.Acinerella [DllImport(_AcDll, EntryPoint = "ac_seek", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Auto)] private static extern Int32 _ac_seek(IntPtr pAcDecoder, Int32 dir, Int64 targetPos); -// ReSharper disable UnusedMethodReturnValue.Global + // ReSharper disable UnusedMethodReturnValue.Global public static Int32 AcSeek(IntPtr pAcDecoder, Int32 dir, Int64 targetPos) -// ReSharper restore UnusedMethodReturnValue.Global + // ReSharper restore UnusedMethodReturnValue.Global { lock (_Lock) { @@ -450,5 +451,6 @@ namespace Vocaluxe.Lib.Video.Acinerella out Int32 scoreMax ); } + // ReSharper restore UnusedMember.Global } \ No newline at end of file diff --git a/Vocaluxe/Lib/Video/CVideoDecoderFFmpeg.cs b/Vocaluxe/Lib/Video/CVideoDecoderFFmpeg.cs index aa998ad0..38c57cce 100644 --- a/Vocaluxe/Lib/Video/CVideoDecoderFFmpeg.cs +++ b/Vocaluxe/Lib/Video/CVideoDecoderFFmpeg.cs @@ -262,10 +262,7 @@ namespace Vocaluxe.Lib.Video public float Length { - get - { - return _FileOpened ? _Duration : 0f; - } + get { return _FileOpened ? _Duration : 0f; } } public bool Paused diff --git a/Vocaluxe/Lib/Video/Gstreamer/CGstreamerVideoWrapper.cs b/Vocaluxe/Lib/Video/Gstreamer/CGstreamerVideoWrapper.cs index 5a863adc..c5cb5020 100644 --- a/Vocaluxe/Lib/Video/Gstreamer/CGstreamerVideoWrapper.cs +++ b/Vocaluxe/Lib/Video/Gstreamer/CGstreamerVideoWrapper.cs @@ -24,7 +24,7 @@ namespace Vocaluxe.Lib.Video.Gstreamer { public struct SNativeFrame { -// ReSharper disable UnassignedField.Global + // ReSharper disable UnassignedField.Global internal IntPtr Buffer; public int Size; public int Width; diff --git a/Vocaluxe/Lib/Webcam/CAForgeNet.cs b/Vocaluxe/Lib/Webcam/CAForgeNet.cs index 20d25328..35926e50 100644 --- a/Vocaluxe/Lib/Webcam/CAForgeNet.cs +++ b/Vocaluxe/Lib/Webcam/CAForgeNet.cs @@ -101,7 +101,8 @@ namespace Vocaluxe.Lib.Webcam num++; VideoCaptureDevice tmpdev = new VideoCaptureDevice(info.MonikerString); - foreach (VideoCapabilities capabilities in tmpdev.VideoCapabilities) { + foreach (VideoCapabilities capabilities in tmpdev.VideoCapabilities) + { SCapabilities item = new SCapabilities { Framerate = capabilities.FrameRate, @@ -162,6 +163,11 @@ namespace Vocaluxe.Lib.Webcam return _Devices.ToArray(); } + public bool IsDeviceAvailable() + { + return _Devices.Count > 0; + } + public bool Select(SWebcamConfig config) { //Close old camera connection diff --git a/Vocaluxe/Lib/Webcam/IWebcam.cs b/Vocaluxe/Lib/Webcam/IWebcam.cs index 7e138b79..15dd403d 100644 --- a/Vocaluxe/Lib/Webcam/IWebcam.cs +++ b/Vocaluxe/Lib/Webcam/IWebcam.cs @@ -59,6 +59,7 @@ namespace Vocaluxe.Lib.Webcam Bitmap GetBitmap(); SWebcamConfig GetConfig(); SWebcamDevice[] GetDevices(); + bool IsDeviceAvailable(); bool Select(SWebcamConfig webcamConfig); } diff --git a/Vocaluxe/Screens/CPopupScreenPlayerControl.cs b/Vocaluxe/Screens/CPopupScreenPlayerControl.cs index 4f56232b..fd38ee1a 100644 --- a/Vocaluxe/Screens/CPopupScreenPlayerControl.cs +++ b/Vocaluxe/Screens/CPopupScreenPlayerControl.cs @@ -90,7 +90,7 @@ namespace Vocaluxe.Screens _ThemeStatics = new string[] {_StaticBG, _StaticCover}; _ThemeTexts = new string[] {_TextCurrentSong}; - _ThemeButtons = new string[]{_ButtonPlay,_ButtonPause,_ButtonPrevious,_ButtonNext,_ButtonRepeat,_ButtonShowVideo,_ButtonSing,_ButtonToBackgroundVideo}; + _ThemeButtons = new string[] {_ButtonPlay, _ButtonPause, _ButtonPrevious, _ButtonNext, _ButtonRepeat, _ButtonShowVideo, _ButtonSing, _ButtonToBackgroundVideo}; } public override void LoadTheme(string xmlPath) diff --git a/Vocaluxe/Screens/CScreenLoad.cs b/Vocaluxe/Screens/CScreenLoad.cs index 61c25afb..4d7dec77 100644 --- a/Vocaluxe/Screens/CScreenLoad.cs +++ b/Vocaluxe/Screens/CScreenLoad.cs @@ -105,8 +105,8 @@ namespace Vocaluxe.Screens _SongLoaderThread = new Thread(CSongs.LoadSongs) {Name = "SongLoader"}; _Texts[_TextStatus].Text = CLanguage.Translate("TR_SCREENLOAD_TOTAL") + ": 0 " + - CLanguage.Translate("TR_SCREENLOAD_SONGS") + " (0 " + - CLanguage.Translate("TR_SCREENLOAD_LOADED") + ")"; + CLanguage.Translate("TR_SCREENLOAD_SONGS") + " (0 " + + CLanguage.Translate("TR_SCREENLOAD_LOADED") + ")"; _SkipIntro = false; _CurrentIntroVideoNr = -1; diff --git a/Vocaluxe/Screens/CScreenMain.cs b/Vocaluxe/Screens/CScreenMain.cs index e44b3950..807ec508 100644 --- a/Vocaluxe/Screens/CScreenMain.cs +++ b/Vocaluxe/Screens/CScreenMain.cs @@ -124,7 +124,7 @@ namespace Vocaluxe.Screens return true; } -// ReSharper disable RedundantOverridenMember + // ReSharper disable RedundantOverridenMember public override void OnShow() { base.OnShow(); @@ -132,7 +132,8 @@ namespace Vocaluxe.Screens //if (Snowflakes != null) // Snowflakes.Resume(); } -// ReSharper restore RedundantOverridenMember + + // ReSharper restore RedundantOverridenMember public override bool UpdateGame() { @@ -150,9 +151,9 @@ namespace Vocaluxe.Screens //Snowflakes.Draw(); _DrawFG(); -// ReSharper disable ConditionIsAlwaysTrueOrFalse + // ReSharper disable ConditionIsAlwaysTrueOrFalse if (CSettings.VersionRevision != ERevision.Release) -// ReSharper restore ConditionIsAlwaysTrueOrFalse + // ReSharper restore ConditionIsAlwaysTrueOrFalse { CFonts.SetFont("Normal"); CFonts.Style = EStyle.Normal; @@ -162,7 +163,7 @@ namespace Vocaluxe.Screens return true; } -// ReSharper disable RedundantOverridenMember + // ReSharper disable RedundantOverridenMember public override void OnClose() { base.OnClose(); @@ -170,6 +171,7 @@ namespace Vocaluxe.Screens //if (Snowflakes != null) // Snowflakes.Pause(); } -// ReSharper restore RedundantOverridenMember + + // ReSharper restore RedundantOverridenMember } } \ No newline at end of file diff --git a/Vocaluxe/Screens/CScreenNames.cs b/Vocaluxe/Screens/CScreenNames.cs index 12cead30..70cfaa8d 100644 --- a/Vocaluxe/Screens/CScreenNames.cs +++ b/Vocaluxe/Screens/CScreenNames.cs @@ -375,7 +375,8 @@ namespace Vocaluxe.Screens { processed = true; CGraphics.FadeTo(EScreens.ScreenSong); - }else + } + else { processed = true; _StartSong(); @@ -511,12 +512,10 @@ namespace Vocaluxe.Screens if (mouseEvent.LB && _IsMouseOver(mouseEvent)) { if (_Buttons[_ButtonBack].Selected) - { CGraphics.FadeTo(EScreens.ScreenSong); - }else if (_Buttons[_ButtonStart].Selected) - { + else if (_Buttons[_ButtonStart].Selected) _StartSong(); - }else + else _UpdatePlayerNumber(); //Update Tiles-List _NameSelections[_NameSelection].UpdateList(); @@ -587,7 +586,7 @@ namespace Vocaluxe.Screens for (int i = 0; i < CSettings.MaxNumPlayer; i++) { //Update texture and name - if (CConfig.Players[i].Length > 0) + if (CConfig.Players[i] != "") { if (CGame.Player[i].ProfileID > -1 && CProfiles.NumProfiles > CGame.Player[i].ProfileID) { @@ -675,7 +674,7 @@ namespace Vocaluxe.Screens _Statics["StaticPlayer" + i].Visible = true; _Statics["StaticPlayerAvatar" + i].Visible = true; _Texts["TextPlayer" + i].Visible = true; - if (_Texts["TextPlayer" + i].Text.Length == 0) + if (_Texts["TextPlayer" + i].Text == "") _Texts["TextPlayer" + i].Text = CLanguage.Translate("TR_SCREENNAMES_PLAYER") + " " + i; _Equalizers["EqualizerPlayer" + i].Visible = true; if (CGame.GetNumSongs() == 1 && CGame.GetSong(1).IsDuet) diff --git a/Vocaluxe/Screens/CScreenOptionsVideo.cs b/Vocaluxe/Screens/CScreenOptionsVideo.cs index 7583df7b..3367edc2 100644 --- a/Vocaluxe/Screens/CScreenOptionsVideo.cs +++ b/Vocaluxe/Screens/CScreenOptionsVideo.cs @@ -175,42 +175,40 @@ namespace Vocaluxe.Screens SWebcamDevice[] devices = CWebcam.GetDevices(); + bool ssVisible = false; try { - if (devices != null) + if (devices != null && devices.Length > 0) { - if (devices.Length > 0) - { - _DeviceNr = 0; - _CapabilityNr = 0; - _GetFirstConfiguredWebcamDevice(ref _DeviceNr, ref _CapabilityNr); + _DeviceNr = 0; + _CapabilityNr = 0; + _GetFirstConfiguredWebcamDevice(ref _DeviceNr, ref _CapabilityNr); - foreach (SWebcamDevice d in devices) - _SelectSlides[_SelectSlideWebcamDevices].AddValue(d.Name); - _SelectSlides[_SelectSlideWebcamDevices].Selection = _DeviceNr; + foreach (SWebcamDevice d in devices) + _SelectSlides[_SelectSlideWebcamDevices].AddValue(d.Name); + _SelectSlides[_SelectSlideWebcamDevices].Selection = _DeviceNr; - foreach (SCapabilities c in devices[_DeviceNr].Capabilities) - _SelectSlides[_SelectSlideWebcamCapabilities].AddValue(c.Width + " x " + c.Height + " @ " + c.Framerate + " FPS "); - _Config.MonikerString = devices[_SelectSlides[_SelectSlideWebcamDevices].Selection].MonikerString; - _Config.Width = devices[_SelectSlides[_SelectSlideWebcamDevices].Selection].Capabilities[_SelectSlides[_SelectSlideWebcamCapabilities].Selection].Width; - _Config.Height = devices[_SelectSlides[_SelectSlideWebcamDevices].Selection].Capabilities[_SelectSlides[_SelectSlideWebcamCapabilities].Selection].Height; - _Config.Framerate = - devices[_SelectSlides[_SelectSlideWebcamDevices].Selection].Capabilities[_SelectSlides[_SelectSlideWebcamCapabilities].Selection].Framerate; - CWebcam.Close(); - CWebcam.Select(CConfig.WebcamConfig); - CWebcam.Start(); - } + foreach (SCapabilities c in devices[_DeviceNr].Capabilities) + _SelectSlides[_SelectSlideWebcamCapabilities].AddValue(c.Width + " x " + c.Height + " @ " + c.Framerate + " FPS "); + _Config.MonikerString = devices[_SelectSlides[_SelectSlideWebcamDevices].Selection].MonikerString; + _Config.Width = devices[_SelectSlides[_SelectSlideWebcamDevices].Selection].Capabilities[_SelectSlides[_SelectSlideWebcamCapabilities].Selection].Width; + _Config.Height = devices[_SelectSlides[_SelectSlideWebcamDevices].Selection].Capabilities[_SelectSlides[_SelectSlideWebcamCapabilities].Selection].Height; + _Config.Framerate = + devices[_SelectSlides[_SelectSlideWebcamDevices].Selection].Capabilities[_SelectSlides[_SelectSlideWebcamCapabilities].Selection].Framerate; + CWebcam.Close(); + CWebcam.Select(CConfig.WebcamConfig); + CWebcam.Start(); + ssVisible = true; } } catch (Exception e) { CLog.LogError("Error on listing webcam capabilities: " + e.Message); - devices = null; } - _SelectSlides[_SelectSlideWebcamDevices].Visible = devices != null && devices.Length > 0; - _SelectSlides[_SelectSlideWebcamCapabilities].Visible = devices != null && devices.Length > 0; - _Statics[_StaticWebcamOutput].Visible = devices != null && devices.Length > 0; + _SelectSlides[_SelectSlideWebcamDevices].Visible = ssVisible; + _SelectSlides[_SelectSlideWebcamCapabilities].Visible = ssVisible; + _Statics[_StaticWebcamOutput].Visible = ssVisible; } private void _SaveConfig() @@ -234,18 +232,18 @@ namespace Vocaluxe.Screens _DeviceNr = _SelectSlides[_SelectSlideWebcamDevices].Selection; _CapabilityNr = 0; - SWebcamDevice[] d = CWebcam.GetDevices(); - for (int i = 0; i < d[_SelectSlides[_SelectSlideWebcamDevices].Selection].Capabilities.Count; i++) + SWebcamDevice d = CWebcam.GetDevices()[_DeviceNr]; + for (int i = 0; i < d.Capabilities.Count; i++) { - _SelectSlides[_SelectSlideWebcamCapabilities].AddValue(d[_DeviceNr].Capabilities[i].Width + " x " + d[_DeviceNr].Capabilities[i].Height + - " @ " + d[_DeviceNr].Capabilities[i].Framerate + "FPS"); + _SelectSlides[_SelectSlideWebcamCapabilities].AddValue(d.Capabilities[i].Width + " x " + d.Capabilities[i].Height + + " @ " + d.Capabilities[i].Framerate + "FPS"); } _SelectSlides[_SelectSlideWebcamCapabilities].Selection = 0; - _Config.MonikerString = d[_SelectSlides[_SelectSlideWebcamDevices].Selection].MonikerString; - _Config.Width = d[_SelectSlides[_SelectSlideWebcamDevices].Selection].Capabilities[_SelectSlides[_SelectSlideWebcamCapabilities].Selection].Width; - _Config.Height = d[_SelectSlides[_SelectSlideWebcamDevices].Selection].Capabilities[_SelectSlides[_SelectSlideWebcamCapabilities].Selection].Height; - _Config.Framerate = d[_SelectSlides[_SelectSlideWebcamDevices].Selection].Capabilities[_SelectSlides[_SelectSlideWebcamCapabilities].Selection].Framerate; + _Config.MonikerString = d.MonikerString; + _Config.Width = d.Capabilities[_SelectSlides[_SelectSlideWebcamCapabilities].Selection].Width; + _Config.Height = d.Capabilities[_SelectSlides[_SelectSlideWebcamCapabilities].Selection].Height; + _Config.Framerate = d.Capabilities[_SelectSlides[_SelectSlideWebcamCapabilities].Selection].Framerate; CWebcam.Close(); CWebcam.Select(_Config); @@ -259,11 +257,11 @@ namespace Vocaluxe.Screens { _CapabilityNr = _SelectSlides[_SelectSlideWebcamCapabilities].Selection; - SWebcamDevice[] d = CWebcam.GetDevices(); - _Config.MonikerString = d[_SelectSlides[_SelectSlideWebcamDevices].Selection].MonikerString; - _Config.Width = d[_SelectSlides[_SelectSlideWebcamDevices].Selection].Capabilities[_SelectSlides[_SelectSlideWebcamCapabilities].Selection].Width; - _Config.Height = d[_SelectSlides[_SelectSlideWebcamDevices].Selection].Capabilities[_SelectSlides[_SelectSlideWebcamCapabilities].Selection].Height; - _Config.Framerate = d[_SelectSlides[_SelectSlideWebcamDevices].Selection].Capabilities[_SelectSlides[_SelectSlideWebcamCapabilities].Selection].Framerate; + SWebcamDevice d = CWebcam.GetDevices()[_SelectSlides[_SelectSlideWebcamDevices].Selection]; + _Config.MonikerString = d.MonikerString; + _Config.Width = d.Capabilities[_SelectSlides[_SelectSlideWebcamCapabilities].Selection].Width; + _Config.Height = d.Capabilities[_SelectSlides[_SelectSlideWebcamCapabilities].Selection].Height; + _Config.Framerate = d.Capabilities[_SelectSlides[_SelectSlideWebcamCapabilities].Selection].Framerate; CWebcam.Close(); CWebcam.Select(_Config); @@ -280,17 +278,16 @@ namespace Vocaluxe.Screens for (int i = 0; i < devices.Length; i++) { - if (devices[i].MonikerString == CConfig.WebcamConfig.MonikerString) + if (devices[i].MonikerString != CConfig.WebcamConfig.MonikerString) + continue; + for (int j = 0; j < devices[i].Capabilities.Count; j++) { - for (int j = 0; j < devices[i].Capabilities.Count; j++) + if (devices[i].Capabilities[j].Framerate == CConfig.WebcamConfig.Framerate && devices[i].Capabilities[j].Width == CConfig.WebcamConfig.Width && + devices[i].Capabilities[j].Height == CConfig.WebcamConfig.Height) { - if (devices[i].Capabilities[j].Framerate == CConfig.WebcamConfig.Framerate && devices[i].Capabilities[j].Width == CConfig.WebcamConfig.Width && - devices[i].Capabilities[j].Height == CConfig.WebcamConfig.Height) - { - device = i; - capabilities = j; - return; - } + device = i; + capabilities = j; + return; } } } diff --git a/Vocaluxe/Screens/CScreenProfiles.cs b/Vocaluxe/Screens/CScreenProfiles.cs index eb04d9a8..7f8647ad 100644 --- a/Vocaluxe/Screens/CScreenProfiles.cs +++ b/Vocaluxe/Screens/CScreenProfiles.cs @@ -82,10 +82,7 @@ namespace Vocaluxe.Screens _Buttons[_ButtonSaveSnapshot].Visible = false; _Buttons[_ButtonDiscardSnapshot].Visible = false; _Buttons[_ButtonTakeSnapshot].Visible = false; - if (CWebcam.GetDevices().Length > 0) - _Buttons[_ButtonWebcam].Visible = true; - else - _Buttons[_ButtonWebcam].Visible = false; + _Buttons[_ButtonWebcam].Visible = CWebcam.IsDeviceAvailable(); _SelectSlides[_SelectSlideDifficulty].SetValues(0); _SelectSlides[_SelectSlideGuestProfile].SetValues(0); _SelectSlides[_SelectSlideActive].SetValues(0); @@ -132,13 +129,13 @@ namespace Vocaluxe.Screens } else if (_Buttons[_ButtonDelete].Selected) _DeleteProfile(); - else if (_Buttons[_ButtonWebcam].Selected && CWebcam.GetDevices().Length > 0) + else if (_Buttons[_ButtonWebcam].Selected && CWebcam.IsDeviceAvailable()) _OnWebcam(); - else if (_Buttons[_ButtonSaveSnapshot].Selected && CWebcam.GetDevices().Length > 0) + else if (_Buttons[_ButtonSaveSnapshot].Selected && CWebcam.IsDeviceAvailable()) _OnSaveSnapshot(); - else if (_Buttons[_ButtonDiscardSnapshot].Selected && CWebcam.GetDevices().Length > 0) + else if (_Buttons[_ButtonDiscardSnapshot].Selected && CWebcam.IsDeviceAvailable()) _OnDiscardSnapshot(); - else if (_Buttons[_ButtonTakeSnapshot].Selected && CWebcam.GetDevices().Length > 0) + else if (_Buttons[_ButtonTakeSnapshot].Selected && CWebcam.IsDeviceAvailable()) _OnTakeSnapshot(); break; @@ -212,7 +209,7 @@ namespace Vocaluxe.Screens { CProfiles.SetAvatar(_SelectSlides[_SelectSlideProfiles].Selection, _SelectSlides[_SelectSlideAvatars].Selection); - if (CWebcam.GetDevices().Length > 0 && _WebcamTexture.Index > 0) + if (CWebcam.IsDeviceAvailable() && _WebcamTexture.Index > 0) _OnDiscardSnapshot(); } else if (_SelectSlides[_SelectSlideGuestProfile].Selected) @@ -225,13 +222,13 @@ namespace Vocaluxe.Screens CProfiles.SetActive(_SelectSlides[_SelectSlideProfiles].Selection, (EOffOn)_SelectSlides[_SelectSlideActive].Selection); } - else if (_Buttons[_ButtonWebcam].Selected && CWebcam.GetDevices().Length > 0) + else if (_Buttons[_ButtonWebcam].Selected && CWebcam.IsDeviceAvailable()) _OnWebcam(); - else if (_Buttons[_ButtonSaveSnapshot].Selected && CWebcam.GetDevices().Length > 0) + else if (_Buttons[_ButtonSaveSnapshot].Selected && CWebcam.IsDeviceAvailable()) _OnSaveSnapshot(); - else if (_Buttons[_ButtonDiscardSnapshot].Selected && CWebcam.GetDevices().Length > 0) + else if (_Buttons[_ButtonDiscardSnapshot].Selected && CWebcam.IsDeviceAvailable()) _OnDiscardSnapshot(); - else if (_Buttons[_ButtonTakeSnapshot].Selected && CWebcam.GetDevices().Length > 0) + else if (_Buttons[_ButtonTakeSnapshot].Selected && CWebcam.IsDeviceAvailable()) _OnTakeSnapshot(); } @@ -313,7 +310,7 @@ namespace Vocaluxe.Screens int avatarNr = CProfiles.GetAvatarNr(_SelectSlides[_SelectSlideProfiles].Selection); _SelectSlides[_SelectSlideAvatars].Selection = avatarNr; - if (CWebcam.GetDevices().Length > 0 && _WebcamTexture.Index > 0) + if (CWebcam.IsDeviceAvailable() && _WebcamTexture.Index > 0) { if (_Snapshot == null) CWebcam.GetFrame(ref _WebcamTexture); diff --git a/Vocaluxe/Screens/CScreenScore.cs b/Vocaluxe/Screens/CScreenScore.cs index 318f42c7..b15df9b5 100644 --- a/Vocaluxe/Screens/CScreenScore.cs +++ b/Vocaluxe/Screens/CScreenScore.cs @@ -156,15 +156,15 @@ namespace Vocaluxe.Screens if (direction.ToLower() == "vertical") { _Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.W = ((float)_StaticPointsBarDrawnPoints[p]) * - (_Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.W / 10000); + (_Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.W / 10000); } else { _Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.H = ((float)_StaticPointsBarDrawnPoints[p]) * - (_Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.H / 10000); + (_Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.H / 10000); _Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.Y = _Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.H + - _Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.Y - - _Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.H; + _Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.Y - + _Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.H; } } } @@ -316,14 +316,14 @@ namespace Vocaluxe.Screens if (CGame.NumPlayer < (int)_ScreenSettings[_ScreenSettingShortDifficulty].GetValue()) { _Texts[_TextDifficulty[p, CGame.NumPlayer - 1]].Text = CLanguage.Translate("TR_SCREENSCORE_GAMEDIFFICULTY") + ": " + - CLanguage.Translate(player[p].Difficulty.ToString()); + CLanguage.Translate(player[p].Difficulty.ToString()); } else _Texts[_TextDifficulty[p, CGame.NumPlayer - 1]].Text = CLanguage.Translate(player[p].Difficulty.ToString()); if (CGame.NumPlayer < (int)_ScreenSettings[_ScreenSettingShortRating].GetValue()) { _Texts[_TextRatings[p, CGame.NumPlayer - 1]].Text = CLanguage.Translate("TR_SCREENSCORE_RATING") + ": " + - CLanguage.Translate(_GetRating((int)Math.Round(player[p].Points))); + CLanguage.Translate(_GetRating((int)Math.Round(player[p].Points))); } else _Texts[_TextRatings[p, CGame.NumPlayer - 1]].Text = CLanguage.Translate(_GetRating((int)Math.Round(player[p].Points))); @@ -336,8 +336,8 @@ namespace Vocaluxe.Screens { _Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.H = 0; _Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.Y = _Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.H + - _Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.Y - - _Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.H; + _Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.Y - + _Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.H; } if (player[p].ProfileID >= 0 && player[p].ProfileID < CProfiles.NumProfiles) _Statics[_StaticAvatar[p, CGame.NumPlayer - 1]].Texture = CProfiles.Profiles[player[p].ProfileID].Avatar.Texture; @@ -349,8 +349,8 @@ namespace Vocaluxe.Screens { _Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.H = ((float)player[p].Points) * (_Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.H / 10000); _Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.Y = _Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.H + - _Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.Y - - _Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.H; + _Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.Y - + _Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.H; _StaticPointsBarDrawnPoints[p] = player[p].Points; } } diff --git a/Vocaluxe/Screens/CScreenSing.cs b/Vocaluxe/Screens/CScreenSing.cs index 0262c1ca..1df67e38 100644 --- a/Vocaluxe/Screens/CScreenSing.cs +++ b/Vocaluxe/Screens/CScreenSing.cs @@ -230,7 +230,7 @@ namespace Vocaluxe.Screens } break; case Keys.W: - if (CWebcam.GetDevices().Length > 0) + if (CWebcam.IsDeviceAvailable()) { _Webcam = !_Webcam; if (_Webcam) @@ -614,7 +614,7 @@ namespace Vocaluxe.Screens CDraw.RemoveTexture(ref _CurrentVideoTexture); - if (song.VideoFileName.Length > 0) + if (song.VideoFileName != "") { _CurrentVideo = CVideo.VdLoad(Path.Combine(song.Folder, song.VideoFileName)); CVideo.VdSkip(_CurrentVideo, song.Start, song.VideoGap); @@ -622,7 +622,7 @@ namespace Vocaluxe.Screens } CDraw.RemoveTexture(ref _Background); - if (song.BackgroundFileName.Length > 0) + if (song.BackgroundFileName != "") _Background = CDraw.AddTexture(Path.Combine(song.Folder, song.BackgroundFileName)); _SingNotes[_SingBars].Reset(); @@ -924,14 +924,14 @@ namespace Vocaluxe.Screens { _Texts[_TextScores[player, numplayer]].Visible = numplayer + 1 == CGame.NumPlayer; _Texts[_TextNames[player, numplayer]].Visible = (numplayer + 1 == CGame.NumPlayer) - && - (CConfig.PlayerInfo == EPlayerInfo.TR_CONFIG_PLAYERINFO_BOTH || - CConfig.PlayerInfo == EPlayerInfo.TR_CONFIG_PLAYERINFO_NAME); + && + (CConfig.PlayerInfo == EPlayerInfo.TR_CONFIG_PLAYERINFO_BOTH || + CConfig.PlayerInfo == EPlayerInfo.TR_CONFIG_PLAYERINFO_NAME); _Statics[_StaticScores[player, numplayer]].Visible = numplayer + 1 == CGame.NumPlayer; _Statics[_StaticAvatars[player, numplayer]].Visible = (numplayer + 1 == CGame.NumPlayer) - && - (CConfig.PlayerInfo == EPlayerInfo.TR_CONFIG_PLAYERINFO_BOTH || - CConfig.PlayerInfo == EPlayerInfo.TR_CONFIG_PLAYERINFO_AVATAR); + && + (CConfig.PlayerInfo == EPlayerInfo.TR_CONFIG_PLAYERINFO_BOTH || + CConfig.PlayerInfo == EPlayerInfo.TR_CONFIG_PLAYERINFO_AVATAR); } } } @@ -1325,7 +1325,8 @@ namespace Vocaluxe.Screens return; CLines[] partLines = song.Notes.Lines; - foreach (CLines partLine in partLines) { + foreach (CLines partLine in partLines) + { CLine[] line = partLine.Line; for (int j = 0; j < line.Length; j++) { diff --git a/Vocaluxe/Screens/CScreenSong.cs b/Vocaluxe/Screens/CScreenSong.cs index 2db8b37a..8e9dcde9 100644 --- a/Vocaluxe/Screens/CScreenSong.cs +++ b/Vocaluxe/Screens/CScreenSong.cs @@ -233,7 +233,7 @@ namespace Vocaluxe.Screens break; case Keys.Back: - if (_SearchActive && _SearchText.Length > 0) + if (_SearchActive && _SearchText != "") _ApplyNewSearchFilter(_SearchText.Remove(_SearchText.Length - 1)); if ((CSongs.Category < 0 || _Sso.Sorting.Tabs == EOffOn.TR_CONFIG_OFF) && !_Sso.Selection.PartyMode && !_SearchActive) @@ -1041,13 +1041,13 @@ namespace Vocaluxe.Screens if (songIndex != -1 && CSongs.NumVisibleSongs > 0 && CSongs.NumVisibleSongs > songIndex) songID = CSongs.VisibleSongs[songIndex].ID; - if (newFilterString.Length == 0 && _Sso.Sorting.Tabs == EOffOn.TR_CONFIG_ON) + if (newFilterString == "" && _Sso.Sorting.Tabs == EOffOn.TR_CONFIG_ON) { CSongs.Category = -1; refresh = true; } - if (newFilterString.Length > 0 && CSongs.Category != 0) + if (newFilterString != "" && CSongs.Category != 0) { CSongs.Category = 0; refresh = true; diff --git a/VocaluxeLib/Menu/CBackground.cs b/VocaluxeLib/Menu/CBackground.cs index 356cb116..11cf7124 100644 --- a/VocaluxeLib/Menu/CBackground.cs +++ b/VocaluxeLib/Menu/CBackground.cs @@ -118,7 +118,7 @@ namespace VocaluxeLib.Menu writer.WriteComment(": Background color for type \"Color\" from ColorScheme (high priority)"); writer.WriteComment("or , , , (lower priority)"); - if (_Theme.ColorName.Length > 0) + if (_Theme.ColorName != "") writer.WriteElementString("Color", _Theme.ColorName); else { @@ -139,13 +139,13 @@ namespace VocaluxeLib.Menu public void Resume() { - if (_Theme.Type == EBackgroundTypes.Video && _Theme.VideoName.Length > 0 && CBase.Config.GetVideoBackgrounds() == EOffOn.TR_CONFIG_ON) + if (_Theme.Type == EBackgroundTypes.Video && _Theme.VideoName != "" && CBase.Config.GetVideoBackgrounds() == EOffOn.TR_CONFIG_ON) CBase.Theme.SkinVideoResume(_Theme.VideoName, _PartyModeID); } public void Pause() { - if (_Theme.VideoName.Length > 0) + if (_Theme.VideoName != "") CBase.Theme.SkinVideoPause(_Theme.VideoName, _PartyModeID); } @@ -165,7 +165,7 @@ namespace VocaluxeLib.Menu ok = _DrawVideo(); } - if (_Theme.TextureName.Length > 0 && + if (_Theme.TextureName != "" && (_Theme.Type == EBackgroundTypes.Texture || (_Theme.Type == EBackgroundTypes.Video && (CBase.Config.GetVideoBackgrounds() == EOffOn.TR_CONFIG_OFF || !ok)))) ok = _DrawTexture(); @@ -181,7 +181,7 @@ namespace VocaluxeLib.Menu public void LoadTextures() { - if (_Theme.ColorName.Length > 0) + if (_Theme.ColorName != "") Color = CBase.Theme.GetColor(_Theme.ColorName, _PartyModeID); } diff --git a/VocaluxeLib/Menu/CButton.cs b/VocaluxeLib/Menu/CButton.cs index a7b9194e..9c74f8e1 100644 --- a/VocaluxeLib/Menu/CButton.cs +++ b/VocaluxeLib/Menu/CButton.cs @@ -239,7 +239,7 @@ namespace VocaluxeLib.Menu writer.WriteComment(": Button color from ColorScheme (high priority)"); writer.WriteComment("or , , , (lower priority)"); - if (_Theme.ColorName.Length > 0) + if (_Theme.ColorName != "") writer.WriteElementString("Color", _Theme.ColorName); else { @@ -251,7 +251,7 @@ namespace VocaluxeLib.Menu writer.WriteComment(": Selected button color from ColorScheme (high priority)"); writer.WriteComment("or , , , (lower priority)"); - if (_Theme.SelColorName.Length > 0) + if (_Theme.SelColorName != "") writer.WriteElementString("SColor", _Theme.SelColorName); else { @@ -378,10 +378,10 @@ namespace VocaluxeLib.Menu { Text.LoadTextures(); - if (_Theme.ColorName.Length > 0) + if (_Theme.ColorName != "") Color = CBase.Theme.GetColor(_Theme.ColorName, _PartyModeID); - if (_Theme.SelColorName.Length > 0) + if (_Theme.SelColorName != "") SelColor = CBase.Theme.GetColor(_Theme.SelColorName, _PartyModeID); } diff --git a/VocaluxeLib/Menu/CEqualizer.cs b/VocaluxeLib/Menu/CEqualizer.cs index a1d7fc89..5c258229 100644 --- a/VocaluxeLib/Menu/CEqualizer.cs +++ b/VocaluxeLib/Menu/CEqualizer.cs @@ -175,7 +175,7 @@ namespace VocaluxeLib.Menu writer.WriteComment(": Equalizer color from ColorScheme (high priority)"); writer.WriteComment("or , , , (lower priority)"); - if (_Theme.ColorName.Length > 0) + if (_Theme.ColorName != "") writer.WriteElementString("Color", _Theme.ColorName); else { @@ -186,7 +186,7 @@ namespace VocaluxeLib.Menu } writer.WriteComment(": Equalizer color for maximal volume from ColorScheme (high priority)"); writer.WriteComment("or , , , (lower priority)"); - if (_Theme.ColorName.Length > 0) + if (_Theme.ColorName != "") writer.WriteElementString("MaxColor", _Theme.ColorName); else { @@ -241,7 +241,7 @@ namespace VocaluxeLib.Menu public void Draw() { - if (_Bars == null || _Theme.Style!=EEqualizerStyle.Collums) + if (_Bars == null || _Theme.Style != EEqualizerStyle.Collums) return; float dx = Rect.W / _Bars.Length; @@ -274,10 +274,10 @@ namespace VocaluxeLib.Menu public void LoadTextures() { - if (_Theme.ColorName.Length > 0) + if (_Theme.ColorName != "") Color = CBase.Theme.GetColor(_Theme.ColorName, _PartyModeID); - if (_Theme.MaxColorName.Length > 0) + if (_Theme.MaxColorName != "") MaxColor = CBase.Theme.GetColor(_Theme.MaxColorName, _PartyModeID); } diff --git a/VocaluxeLib/Menu/CHelper.cs b/VocaluxeLib/Menu/CHelper.cs index d64fb482..95048f07 100644 --- a/VocaluxeLib/Menu/CHelper.cs +++ b/VocaluxeLib/Menu/CHelper.cs @@ -157,9 +157,7 @@ namespace VocaluxeLib.Menu try { foreach (FileInfo file in dir.GetFiles(cast)) - { files.Add(!fullpath ? file.Name : file.FullName); - } if (recursive) { diff --git a/VocaluxeLib/Menu/CLyric.cs b/VocaluxeLib/Menu/CLyric.cs index cad0c576..a0c9471a 100644 --- a/VocaluxeLib/Menu/CLyric.cs +++ b/VocaluxeLib/Menu/CLyric.cs @@ -172,7 +172,7 @@ namespace VocaluxeLib.Menu writer.WriteComment(": Lyric text color from ColorScheme (high priority)"); writer.WriteComment("or , , , (lower priority)"); - if (_Theme.ColorName.Length > 0) + if (_Theme.ColorName != "") writer.WriteElementString("Color", _Theme.ColorName); else { @@ -184,7 +184,7 @@ namespace VocaluxeLib.Menu writer.WriteComment(": Highlighted lyric color from ColorScheme (high priority)"); writer.WriteComment("or , , , (lower priority)"); - if (_Theme.SelColorName.Length > 0) + if (_Theme.SelColorName != "") writer.WriteElementString("SColor", _Theme.SelColorName); else { @@ -525,10 +525,10 @@ namespace VocaluxeLib.Menu public void LoadTextures() { - if (_Theme.ColorName.Length > 0) + if (_Theme.ColorName != "") _Color = CBase.Theme.GetColor(_Theme.ColorName, _PartyModeID); - if (_Theme.SelColorName.Length > 0) + if (_Theme.SelColorName != "") _ColorProcessed = CBase.Theme.GetColor(_Theme.SelColorName, _PartyModeID); } diff --git a/VocaluxeLib/Menu/CMenu.cs b/VocaluxeLib/Menu/CMenu.cs index 6b10e51d..e17e6aec 100644 --- a/VocaluxeLib/Menu/CMenu.cs +++ b/VocaluxeLib/Menu/CMenu.cs @@ -194,7 +194,7 @@ namespace VocaluxeLib.Menu public virtual void SaveTheme() { - if (_ThemePath.Length == 0) + if (_ThemePath == "") return; XmlWriterSettings settings = new XmlWriterSettings {Indent = true, Encoding = Encoding.UTF8, ConformanceLevel = ConformanceLevel.Document}; @@ -357,7 +357,7 @@ namespace VocaluxeLib.Menu public virtual void ReloadTheme(string xmlPath) { - if (_ThemePath.Length == 0) + if (_ThemePath == "") return; UnloadTextures(); @@ -436,7 +436,7 @@ namespace VocaluxeLib.Menu #region ElementHandler #region Create Elements -// ReSharper disable UnusedMember.Global + // ReSharper disable UnusedMember.Global // ReSharper disable MemberCanBeProtected.Global public CButton GetNewButton() { @@ -527,6 +527,7 @@ namespace VocaluxeLib.Menu { return new CParticleEffect(_PartyModeID, maxNumber, color, area, texture, size, type); } + // ReSharper restore MemberCanBeProtected.Global // ReSharper restore UnusedMember.Global #endregion Create Elements @@ -793,7 +794,7 @@ namespace VocaluxeLib.Menu #endregion Drawing #region Elements -// ReSharper disable MemberCanBePrivate.Global + // ReSharper disable MemberCanBePrivate.Global protected void _AddBackground(CBackground bg, String key = null) { _AddInteraction(_Backgrounds.Add(bg, key), EType.Background); @@ -858,6 +859,7 @@ namespace VocaluxeLib.Menu { _ScreenSettings.Add(se, key); } + // ReSharper restore MemberCanBePrivate.Global #endregion Elements @@ -1515,7 +1517,7 @@ namespace VocaluxeLib.Menu } } -// ReSharper disable UnusedMember.Local + // ReSharper disable UnusedMember.Local private void _ToggleHighlighted() { if (_Selection >= _Interactions.Count || _Selection < 0) @@ -1532,6 +1534,7 @@ namespace VocaluxeLib.Menu return _Interactions[_Selection].Type == EType.SelectSlide && _SelectSlides[_Interactions[_Selection].Num].Highlighted; } + // ReSharper restore UnusedMember.Local private bool _IsVisible(int interaction) diff --git a/VocaluxeLib/Menu/CNameSelection.cs b/VocaluxeLib/Menu/CNameSelection.cs index 1b19f16a..c09387f9 100644 --- a/VocaluxeLib/Menu/CNameSelection.cs +++ b/VocaluxeLib/Menu/CNameSelection.cs @@ -190,7 +190,7 @@ namespace VocaluxeLib.Menu writer.WriteComment(": Static color from ColorScheme (high priority)"); writer.WriteComment("or , , , (lower priority)"); - if (_Theme.ColorEmptyTileName.Length > 0) + if (_Theme.ColorEmptyTileName != "") writer.WriteElementString("ColorEmptyTile", _Theme.ColorEmptyTileName); else { @@ -221,7 +221,7 @@ namespace VocaluxeLib.Menu writer.WriteComment(": Text font name"); writer.WriteElementString("Font", _Theme.NameFont); writer.WriteComment(": Text color from ColorScheme (high priority)"); - if (_Theme.NameColorName.Length > 0) + if (_Theme.NameColorName != "") writer.WriteElementString("Color", _Theme.NameColorName); else { @@ -455,10 +455,10 @@ namespace VocaluxeLib.Menu _TextureEmptyTile = CBase.Theme.GetSkinTexture(_Theme.TextureEmptyTileName, _PartyModeID); _TextureTileSelected = CBase.Theme.GetSkinTexture(_Theme.TextureTileSelectedName, _PartyModeID); - if (_Theme.ColorEmptyTileName.Length > 0) + if (_Theme.ColorEmptyTileName != "") ColorEmptyTile = CBase.Theme.GetColor(_Theme.ColorEmptyTileName, _PartyModeID); - if (_Theme.NameColorName.Length > 0) + if (_Theme.NameColorName != "") _Theme.NameColor = CBase.Theme.GetColor(_Theme.NameColorName, _PartyModeID); } diff --git a/VocaluxeLib/Menu/CParticle.cs b/VocaluxeLib/Menu/CParticle.cs index f0926631..8aecbd89 100644 --- a/VocaluxeLib/Menu/CParticle.cs +++ b/VocaluxeLib/Menu/CParticle.cs @@ -297,7 +297,7 @@ namespace VocaluxeLib.Menu public void Draw() { - if (_TextureName.Length > 0) + if (_TextureName != "") CBase.Drawing.DrawTexture(CBase.Theme.GetSkinTexture(_TextureName, _PartyModeID), _Rect, new SColorF(_Color.R, _Color.G, _Color.B, _Color.A * Alpha2 * _Alpha)); else CBase.Drawing.DrawTexture(_Texture, _Rect, new SColorF(_Color.R, _Color.G, _Color.B, _Color.A * Alpha2 * _Alpha)); @@ -433,7 +433,7 @@ namespace VocaluxeLib.Menu writer.WriteComment(": ParticleEffect color from ColorScheme (high priority)"); writer.WriteComment("or , , , (lower priority)"); - if (_Theme.ColorName.Length > 0) + if (_Theme.ColorName != "") writer.WriteElementString("Color", _Theme.ColorName); else { @@ -544,7 +544,7 @@ namespace VocaluxeLib.Menu h = 0; CParticle star; - if (_Theme.TextureName.Length > 0) + if (_Theme.TextureName != "") { star = new CParticle(_PartyModeID, _Theme.TextureName, Color, CBase.Game.GetRandom(w) + Rect.X - size / 4f, @@ -605,9 +605,9 @@ namespace VocaluxeLib.Menu public void LoadTextures() { - if (_Theme.ColorName.Length > 0) + if (_Theme.ColorName != "") Color = CBase.Theme.GetColor(_Theme.ColorName, _PartyModeID); - if (_Theme.TextureName.Length > 0) + if (_Theme.TextureName != "") Texture = CBase.Theme.GetSkinTexture(_Theme.TextureName, _PartyModeID); } diff --git a/VocaluxeLib/Menu/CPlaylist.cs b/VocaluxeLib/Menu/CPlaylist.cs index c0386fc7..b748048d 100644 --- a/VocaluxeLib/Menu/CPlaylist.cs +++ b/VocaluxeLib/Menu/CPlaylist.cs @@ -370,7 +370,7 @@ namespace VocaluxeLib.Menu writer.WriteComment(": Button color from ColorScheme (high priority)"); writer.WriteComment("or , , , (lower priority)"); - if (_Theme.ColorBackgroundName.Length > 0) + if (_Theme.ColorBackgroundName != "") writer.WriteElementString("ColorBackground", _Theme.ColorBackgroundName); else { @@ -382,7 +382,7 @@ namespace VocaluxeLib.Menu writer.WriteComment(": Selected paylist-entry color from ColorScheme (high priority)"); writer.WriteComment("or , , , (lower priority)"); - if (_Theme.SelColorBackgroundName.Length > 0) + if (_Theme.SelColorBackgroundName != "") writer.WriteElementString("SColorBackground", _Theme.SelColorBackgroundName); else { @@ -471,10 +471,10 @@ namespace VocaluxeLib.Menu public void LoadTextures() { - if (_Theme.ColorBackgroundName.Length > 0) + if (_Theme.ColorBackgroundName != "") BackgroundColor = CBase.Theme.GetColor(_Theme.ColorBackgroundName, _PartyModeID); - if (_Theme.SelColorBackgroundName.Length > 0) + if (_Theme.SelColorBackgroundName != "") BackgroundSelColor = CBase.Theme.GetColor(_Theme.SelColorBackgroundName, _PartyModeID); _Theme.Text1.LoadTextures(); @@ -523,7 +523,7 @@ namespace VocaluxeLib.Menu } else if (keyEvent.Key == Keys.Back || keyEvent.Key == Keys.Delete) { - if (_Theme.ButtonPlaylistName.Text.Text.Length > 0) + if (_Theme.ButtonPlaylistName.Text.Text != "") _Theme.ButtonPlaylistName.Text.Text = _Theme.ButtonPlaylistName.Text.Text.Remove(_Theme.ButtonPlaylistName.Text.Text.Length - 1); } } diff --git a/VocaluxeLib/Menu/CScreenSetting.cs b/VocaluxeLib/Menu/CScreenSetting.cs index 25063735..691074f9 100644 --- a/VocaluxeLib/Menu/CScreenSetting.cs +++ b/VocaluxeLib/Menu/CScreenSetting.cs @@ -37,10 +37,10 @@ namespace VocaluxeLib.Menu public ESettingType Type; } -// ReSharper disable ClassNeverInstantiated.Global + // ReSharper disable ClassNeverInstantiated.Global //Instantiated by reflection public class CScreenSetting : IMenuElement -// ReSharper restore ClassNeverInstantiated.Global + // ReSharper restore ClassNeverInstantiated.Global { private readonly int _PartyModeID; diff --git a/VocaluxeLib/Menu/CSelectSlide.cs b/VocaluxeLib/Menu/CSelectSlide.cs index f320a084..16fab82a 100644 --- a/VocaluxeLib/Menu/CSelectSlide.cs +++ b/VocaluxeLib/Menu/CSelectSlide.cs @@ -417,7 +417,7 @@ namespace VocaluxeLib.Menu writer.WriteComment(": SelectSlide color from ColorScheme (high priority)"); writer.WriteComment("or , , , (lower priority)"); - if (_Theme.ColorName.Length > 0) + if (_Theme.ColorName != "") writer.WriteElementString("Color", _Theme.ColorName); else { @@ -429,7 +429,7 @@ namespace VocaluxeLib.Menu writer.WriteComment(": Selected SelectSlide color from ColorScheme (high priority)"); writer.WriteComment("or , , , (lower priority)"); - if (_Theme.SelColorName.Length > 0) + if (_Theme.SelColorName != "") writer.WriteElementString("SColor", _Theme.SelColorName); else { @@ -441,7 +441,7 @@ namespace VocaluxeLib.Menu writer.WriteComment(": Highlighted SelectSlide color from ColorScheme (high priority)"); writer.WriteComment("or
, , , (lower priority)"); - if (_Theme.HighlightColorName.Length > 0) + if (_Theme.HighlightColorName != "") writer.WriteElementString("HColor", _Theme.HighlightColorName); else { @@ -453,7 +453,7 @@ namespace VocaluxeLib.Menu writer.WriteComment(": Arrow color from ColorScheme (high priority)"); writer.WriteComment("or , , , (lower priority)"); - if (_Theme.ArrowColorName.Length > 0) + if (_Theme.ArrowColorName != "") writer.WriteElementString("ArrowColor", _Theme.ArrowColorName); else { @@ -465,7 +465,7 @@ namespace VocaluxeLib.Menu writer.WriteComment(": Selected arrow color from ColorScheme (high priority)"); writer.WriteComment("or , , , (lower priority)"); - if (_Theme.SelArrowColorName.Length > 0) + if (_Theme.SelArrowColorName != "") writer.WriteElementString("ArrowSColor", _Theme.SelArrowColorName); else { @@ -477,7 +477,7 @@ namespace VocaluxeLib.Menu writer.WriteComment(": Text color from ColorScheme (high priority)"); writer.WriteComment("or , , , (lower priority)"); - if (_Theme.TextColorName.Length > 0) + if (_Theme.TextColorName != "") writer.WriteElementString("TextColor", _Theme.TextColorName); else { @@ -489,7 +489,7 @@ namespace VocaluxeLib.Menu writer.WriteComment(": Selected text color from ColorScheme (high priority)"); writer.WriteComment("or , , , (lower priority)"); - if (_Theme.SelTextColorName.Length > 0) + if (_Theme.SelTextColorName != "") writer.WriteElementString("TextSColor", _Theme.SelTextColorName); else { @@ -797,25 +797,25 @@ namespace VocaluxeLib.Menu public void LoadTextures() { - if (_Theme.ColorName.Length > 0) + if (_Theme.ColorName != "") Color = CBase.Theme.GetColor(_Theme.ColorName, _PartyModeID); - if (_Theme.SelColorName.Length > 0) + if (_Theme.SelColorName != "") SelColor = CBase.Theme.GetColor(_Theme.SelColorName, _PartyModeID); - if (_Theme.HighlightColorName.Length > 0) + if (_Theme.HighlightColorName != "") HighlightColor = CBase.Theme.GetColor(_Theme.HighlightColorName, _PartyModeID); - if (_Theme.ArrowColorName.Length > 0) + if (_Theme.ArrowColorName != "") ColorArrow = CBase.Theme.GetColor(_Theme.ArrowColorName, _PartyModeID); - if (_Theme.SelArrowColorName.Length > 0) + if (_Theme.SelArrowColorName != "") SelColorArrow = CBase.Theme.GetColor(_Theme.SelArrowColorName, _PartyModeID); - if (_Theme.TextColorName.Length > 0) + if (_Theme.TextColorName != "") TextColor = CBase.Theme.GetColor(_Theme.TextColorName, _PartyModeID); - if (_Theme.SelColorName.Length > 0) + if (_Theme.SelColorName != "") SelTextColor = CBase.Theme.GetColor(_Theme.SelTextColorName, _PartyModeID); } diff --git a/VocaluxeLib/Menu/CStatic.cs b/VocaluxeLib/Menu/CStatic.cs index 14bc216c..50bf7278 100644 --- a/VocaluxeLib/Menu/CStatic.cs +++ b/VocaluxeLib/Menu/CStatic.cs @@ -201,7 +201,7 @@ namespace VocaluxeLib.Menu writer.WriteComment(": Static color from ColorScheme (high priority)"); writer.WriteComment("or , , ,
(lower priority)"); - if (_Theme.ColorName.Length > 0) + if (_Theme.ColorName != "") writer.WriteElementString("Color", _Theme.ColorName); else { @@ -293,7 +293,7 @@ namespace VocaluxeLib.Menu public void LoadTextures() { - if (_Theme.ColorName.Length > 0) + if (_Theme.ColorName != "") Color = CBase.Theme.GetColor(_Theme.ColorName, _PartyModeID); } diff --git a/VocaluxeLib/Menu/CText.cs b/VocaluxeLib/Menu/CText.cs index 613a5000..b09737b9 100644 --- a/VocaluxeLib/Menu/CText.cs +++ b/VocaluxeLib/Menu/CText.cs @@ -541,7 +541,7 @@ namespace VocaluxeLib.Menu writer.WriteComment(": Text color from ColorScheme (high priority)"); writer.WriteComment("or , , , (lower priority)"); - if (_Theme.ColorName.Length > 0) + if (_Theme.ColorName != "") writer.WriteElementString("Color", _Theme.ColorName); else { @@ -553,7 +553,7 @@ namespace VocaluxeLib.Menu writer.WriteComment(": Selected Text color from ColorScheme (high priority)"); writer.WriteComment("or , , , (lower priority)"); - if (_Theme.SelColorName.Length > 0) + if (_Theme.SelColorName != "") writer.WriteElementString("SColor", _Theme.SelColorName); else { @@ -776,10 +776,10 @@ namespace VocaluxeLib.Menu public void LoadTextures() { - if (_Theme.ColorName.Length > 0) + if (_Theme.ColorName != "") Color = CBase.Theme.GetColor(_Theme.ColorName, _PartyModeID); - if (_Theme.SelColorName.Length > 0) + if (_Theme.SelColorName != "") SelColor = CBase.Theme.GetColor(_Theme.SelColorName, _PartyModeID); } @@ -806,7 +806,7 @@ namespace VocaluxeLib.Menu private void _UpdateTextPosition() { - if (_Text.Length == 0) + if (_Text == "") return; CBase.Fonts.SetFont(Font); diff --git a/VocaluxeLib/Menu/CXMLReader.cs b/VocaluxeLib/Menu/CXMLReader.cs index 0a21f4e7..55944771 100644 --- a/VocaluxeLib/Menu/CXMLReader.cs +++ b/VocaluxeLib/Menu/CXMLReader.cs @@ -112,7 +112,7 @@ namespace VocaluxeLib.Menu resultCt++; } - if (resultCt!=1) + if (resultCt != 1) { value = defaultValue; return false; diff --git a/VocaluxeLib/Menu/Enums.cs b/VocaluxeLib/Menu/Enums.cs index e52e1b86..5c40785a 100644 --- a/VocaluxeLib/Menu/Enums.cs +++ b/VocaluxeLib/Menu/Enums.cs @@ -136,7 +136,7 @@ namespace VocaluxeLib.Menu public enum EBufferSize { -// ReSharper disable UnusedMember.Global + // ReSharper disable UnusedMember.Global B0 = 0, B512 = 512, B1024 = 1024, diff --git a/VocaluxeLib/Menu/SingNotes/CSingNotes.cs b/VocaluxeLib/Menu/SingNotes/CSingNotes.cs index 3cadcdbc..3243261d 100644 --- a/VocaluxeLib/Menu/SingNotes/CSingNotes.cs +++ b/VocaluxeLib/Menu/SingNotes/CSingNotes.cs @@ -245,7 +245,7 @@ namespace VocaluxeLib.Menu.SingNotes SPlayerNotes notes = _PlayerNotes[n]; - if (line.Length == 0 || line.Length <= lineNr) + if (line.Length <= lineNr) return; notes.Lines = line; diff --git a/VocaluxeLib/Menu/SongMenu/CSong.cs b/VocaluxeLib/Menu/SongMenu/CSong.cs index 2197bdc5..06babb1b 100644 --- a/VocaluxeLib/Menu/SongMenu/CSong.cs +++ b/VocaluxeLib/Menu/SongMenu/CSong.cs @@ -369,7 +369,7 @@ namespace VocaluxeLib.Menu.SongMenu while (!sr.EndOfStream) { string line = sr.ReadLine(); - if (line.Length == 0) + if (line == "") continue; if (!line[0].ToString().Equals("#")) break; @@ -381,7 +381,7 @@ namespace VocaluxeLib.Menu.SongMenu string identifier = line.Substring(1, pos - 1).Trim().ToUpper(); string value = line.Substring(pos + 1, line.Length - pos - 1).Trim(); - if (value.Length > 0) + if (value != "") { switch (identifier) { @@ -395,7 +395,7 @@ namespace VocaluxeLib.Menu.SongMenu while (!sr.EndOfStream) { line = sr.ReadLine(); - if (line.Length == 0) + if (line == "") continue; if (!line[0].ToString().Equals("#")) break; @@ -411,33 +411,33 @@ namespace VocaluxeLib.Menu.SongMenu } break; case "TITLE": - if (value.Length > 0) + if (value != "") { Title = value; headerFlags |= EHeaderFlags.Title; } break; case "ARTIST": - if (value.Length > 0) + if (value != "") { Artist = value; headerFlags |= EHeaderFlags.Artist; } break; case "TITLE-ON-SORTING": - if (value.Length > 0) + if (value != "") TitleSorting = value; break; case "ARTIST-ON-SORTING": - if (value.Length > 0) + if (value != "") ArtistSorting = value; break; case "P1": - if (value.Length > 0) + if (value != "") DuetPart1 = value; break; case "P2": - if (value.Length > 0) + if (value != "") DuetPart2 = value; break; case "MP3": @@ -608,10 +608,10 @@ namespace VocaluxeLib.Menu.SongMenu _CheckFiles(); //Before saving this tags to .txt: Check, if ArtistSorting and Artist are equal, then don't save this tag. - if (ArtistSorting.Length == 0) + if (ArtistSorting == "") ArtistSorting = Artist; - if (TitleSorting.Length == 0) + if (TitleSorting == "") TitleSorting = Title; return true; @@ -821,7 +821,7 @@ namespace VocaluxeLib.Menu.SongMenu { if (_CoverSmallLoaded) return; - if (CoverFileName.Length > 0) + if (CoverFileName != "") { if (!CBase.DataBase.GetCover(Path.Combine(Folder, CoverFileName), ref _CoverTextureSmall, CBase.Config.GetCoverSize())) _CoverTextureSmall = CBase.Cover.GetNoCover(); @@ -834,7 +834,7 @@ namespace VocaluxeLib.Menu.SongMenu private void _CheckFiles() { - if (CoverFileName.Length == 0) + if (CoverFileName == "") { List files = CHelper.ListFiles(Folder, "*.jpg", false); files.AddRange(CHelper.ListFiles(Folder, "*.png", false)); @@ -846,7 +846,7 @@ namespace VocaluxeLib.Menu.SongMenu } } - if (BackgroundFileName.Length == 0) + if (BackgroundFileName == "") { List files = CHelper.ListFiles(Folder, "*.jpg", false); files.AddRange(CHelper.ListFiles(Folder, "*.png", false)); @@ -861,12 +861,12 @@ namespace VocaluxeLib.Menu.SongMenu private void _CheckDuet() { - if (DuetPart1.Length == 0) + if (DuetPart1 == "") { DuetPart1 = "Part 1"; CBase.Log.LogError("Warning: Can't find #P1-tag for duets in \"" + Artist + " - " + Title + "\"."); } - if (DuetPart2.Length == 0) + if (DuetPart2 == "") { DuetPart2 = "Part 2"; CBase.Log.LogError("Warning: Can't find #P2-tag for duets in \"" + Artist + " - " + Title + "\"."); @@ -915,7 +915,7 @@ namespace VocaluxeLib.Menu.SongMenu for (int k = 1; k <= max; k++) { - if (sentences[i + k] == sentences[j + k] && sentences[i + k]!="") + if (sentences[i + k] == sentences[j + k] && sentences[i + k] != "") tempSeries.End = i + k; else break; diff --git a/VocaluxeLib/Menu/SongMenu/CSongMenuDreidel.cs b/VocaluxeLib/Menu/SongMenu/CSongMenuDreidel.cs index 10d9c0e7..bfbad2a0 100644 --- a/VocaluxeLib/Menu/SongMenu/CSongMenuDreidel.cs +++ b/VocaluxeLib/Menu/SongMenu/CSongMenuDreidel.cs @@ -44,7 +44,7 @@ namespace VocaluxeLib.Menu.SongMenu public CSongMenuDreidel(int partyModeID) : base(partyModeID) {} -// ReSharper disable RedundantOverridenMember + // ReSharper disable RedundantOverridenMember public override void Init() { base.Init(); @@ -59,6 +59,7 @@ namespace VocaluxeLib.Menu.SongMenu _SongLength = _Theme.songMenuDreidel.TextSongLength; **/ } -// ReSharper restore RedundantOverridenMember + + // ReSharper restore RedundantOverridenMember } } \ No newline at end of file diff --git a/VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs b/VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs index 42c2b03f..ef2d530c 100644 --- a/VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs +++ b/VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs @@ -349,7 +349,7 @@ namespace VocaluxeLib.Menu.SongMenu writer.WriteComment(": Tile color from ColorScheme (high priority)"); writer.WriteComment("or , , , (lower priority)"); - if (_Theme.ColorName.Length > 0) + if (_Theme.ColorName != "") writer.WriteElementString("Color", _Theme.ColorName); else { @@ -481,13 +481,9 @@ namespace VocaluxeLib.Menu.SongMenu _SelectedInternal = _SelectedPending; } - public virtual void HandleInput(ref SKeyEvent keyEvent, SScreenSongOptions songOptions) - { - } + public virtual void HandleInput(ref SKeyEvent keyEvent, SScreenSongOptions songOptions) {} - public virtual void HandleMouse(ref SMouseEvent mouseEvent, SScreenSongOptions songOptions) - { - } + public virtual void HandleMouse(ref SMouseEvent mouseEvent, SScreenSongOptions songOptions) {} public virtual void Draw() { @@ -531,17 +527,11 @@ namespace VocaluxeLib.Menu.SongMenu return -1; } - public virtual void SetSelectedSong(int visibleSongNr) - { - } + public virtual void SetSelectedSong(int visibleSongNr) {} - public virtual void SetSelectedCategory(int categoryNr) - { - } + public virtual void SetSelectedCategory(int categoryNr) {} - public virtual void SetSmallView(bool smallView) - { - } + public virtual void SetSmallView(bool smallView) {} public virtual bool IsSmallView() { @@ -554,7 +544,7 @@ namespace VocaluxeLib.Menu.SongMenu { Init(); - if (_Theme.ColorName.Length > 0) + if (_Theme.ColorName != "") _Color = CBase.Theme.GetColor(_Theme.ColorName, _PartyModeID); } @@ -635,7 +625,7 @@ namespace VocaluxeLib.Menu.SongMenu _Streams.Add(stream); _Actsongstream = stream; - if (CBase.Songs.GetVisibleSong(_Actsong).VideoFileName.Length > 0 && CBase.Config.GetVideoPreview() == EOffOn.TR_CONFIG_ON) + if (CBase.Songs.GetVisibleSong(_Actsong).VideoFileName != "" && CBase.Config.GetVideoPreview() == EOffOn.TR_CONFIG_ON) { _Video = CBase.Video.Load(Path.Combine(CBase.Songs.GetVisibleSong(_Actsong).Folder, CBase.Songs.GetVisibleSong(_Actsong).VideoFileName)); if (_Video == -1) diff --git a/VocaluxeLib/Menu/SongMenu/CSongMenuTileBoard.cs b/VocaluxeLib/Menu/SongMenu/CSongMenuTileBoard.cs index 6e38429c..2f3ee5fd 100644 --- a/VocaluxeLib/Menu/SongMenu/CSongMenuTileBoard.cs +++ b/VocaluxeLib/Menu/SongMenu/CSongMenuTileBoard.cs @@ -154,7 +154,7 @@ namespace VocaluxeLib.Menu.SongMenu _MedleyTagIcon.Visible = false; } - if (CBase.Songs.GetNumVisibleSongs() == 0 && CBase.Songs.GetSearchFilter().Length > 0) + if (CBase.Songs.GetNumVisibleSongs() == 0 && CBase.Songs.GetSearchFilter() != "") { _CoverBig.Texture = _CoverBigTexture; _Artist.Text = String.Empty; @@ -418,7 +418,7 @@ namespace VocaluxeLib.Menu.SongMenu _Artist.Text = song.Artist; _Title.Text = song.Title; _DuetIcon.Visible = song.IsDuet; - _VideoIcon.Visible = song.VideoFileName.Length > 0; + _VideoIcon.Visible = song.VideoFileName != ""; _MedleyCalcIcon.Visible = song.Medley.Source == EMedleySource.Calculated; _MedleyTagIcon.Visible = song.Medley.Source == EMedleySource.Tag;