diff --git a/Vocaluxe/Base/CConfig.cs b/Vocaluxe/Base/CConfig.cs index c5024d1e..2b5d8b3d 100644 --- a/Vocaluxe/Base/CConfig.cs +++ b/Vocaluxe/Base/CConfig.cs @@ -60,10 +60,10 @@ namespace Vocaluxe.Base public static int ScreenW = 1024; public static int ScreenH = 576; - public static int BorderLeft = 0; - public static int BorderRight = 0; - public static int BorderTop = 0; - public static int BorderBottom = 0; + public static int BorderLeft; + public static int BorderRight; + public static int BorderTop; + public static int BorderBottom; public static EAntiAliasingModes AAMode = EAntiAliasingModes.X0; diff --git a/Vocaluxe/Base/CGame.cs b/Vocaluxe/Base/CGame.cs index 238e314b..009e585f 100644 --- a/Vocaluxe/Base/CGame.cs +++ b/Vocaluxe/Base/CGame.cs @@ -208,7 +208,7 @@ namespace Vocaluxe.Base public static void UpdatePoints(float time) { - bool DEBUG_HIT = false; + const bool DEBUG_HIT = false; CSong song = _SongQueue.GetSong(); @@ -274,8 +274,6 @@ namespace Vocaluxe.Base { int tone = notes[note].Tone; int tonePlayer = CSound.RecordGetTone(p); - if (DEBUG_HIT) - tonePlayer = tone; while (tonePlayer - tone > 6) tonePlayer -= 12; @@ -362,7 +360,7 @@ namespace Vocaluxe.Base public static void ResetToLastLine(int soundStream, int vidStream) { - float[] time = GetLastSungLineStart(); + float[] time = _GetLastSungLineStart(); ResetToTime(time[0], time[1], soundStream, vidStream); } @@ -416,15 +414,15 @@ namespace Vocaluxe.Base CVideo.Skip(vidStream, time, GetSong().VideoGap); } - private static float[] GetLastSungLineStart() + private static float[] _GetLastSungLineStart() { - return GetNoteTimeBeforeBeat(CurrentBeat); + return _GetNoteTimeBeforeBeat(CurrentBeat); } - private static float[] GetNoteTimeBeforeBeat(int beat) + private static float[] _GetNoteTimeBeforeBeat(int beat) { CSong song = GetSong(); - int StartBeat = (int)Math.Floor(beat - GetBeatFromTime(CSettings.PauseResetTime, song.BPM, 0f)); + int startBeat = (int)Math.Floor(beat - GetBeatFromTime(CSettings.PauseResetTime, song.BPM, 0f)); int lastStart = 0; int nextStart = 0; foreach (CVoice voice in song.Notes.Voices) @@ -436,16 +434,13 @@ namespace Vocaluxe.Base { foreach (CSongNote note in line.Notes) { - if (note.StartBeat > StartBeat) + if (note.StartBeat > startBeat) { nextStartNote = note.StartBeat; break; } - else - { - voiceStart = note.StartBeat; - lastEnd = note.EndBeat; - } + voiceStart = note.StartBeat; + lastEnd = note.EndBeat; } if (nextStartNote > 0) break; diff --git a/Vocaluxe/Base/CGraphics.cs b/Vocaluxe/Base/CGraphics.cs index 60356193..92a2577b 100644 --- a/Vocaluxe/Base/CGraphics.cs +++ b/Vocaluxe/Base/CGraphics.cs @@ -404,9 +404,6 @@ namespace Vocaluxe.Base CConfig.BorderTop = 0; CConfig.BorderBottom = 0; break; - - default: - break; } CConfig.SaveConfig(); break; diff --git a/Vocaluxe/Base/CSettings.cs b/Vocaluxe/Base/CSettings.cs index e9dd805d..8d0c527b 100644 --- a/Vocaluxe/Base/CSettings.cs +++ b/Vocaluxe/Base/CSettings.cs @@ -104,7 +104,7 @@ namespace Vocaluxe.Base #endif Path.Combine(DataPath, FolderProfiles) }; - public static string FolderPhotos = "Photos"; + public const string FolderPhotos = "Photos"; public const string FolderSongs = "Songs"; public const string FolderSounds = "Sounds"; public const string FolderLanguages = "Languages"; diff --git a/Vocaluxe/Base/CSongs.cs b/Vocaluxe/Base/CSongs.cs index 7aa205c9..14b2100e 100644 --- a/Vocaluxe/Base/CSongs.cs +++ b/Vocaluxe/Base/CSongs.cs @@ -221,9 +221,7 @@ namespace Vocaluxe.Base return; //Calc avarage sing-count - int totalCounts = 0; - foreach (CSong song in VisibleSongs) - totalCounts += song.NumPlayedSession; + int totalCounts = VisibleSongs.Sum(song => song.NumPlayedSession); int averageCount = totalCounts / NumSongsVisible; foreach (CSong song in VisibleSongs) diff --git a/Vocaluxe/Base/CTheme.cs b/Vocaluxe/Base/CTheme.cs index 42b1bf7e..35180bcb 100644 --- a/Vocaluxe/Base/CTheme.cs +++ b/Vocaluxe/Base/CTheme.cs @@ -18,7 +18,6 @@ using System; using System.Collections.Generic; using System.IO; -using System.Text; using System.Windows.Forms; using System.Xml; using Vocaluxe.Base.Fonts; diff --git a/Vocaluxe/Base/Server/CCommands.cs b/Vocaluxe/Base/Server/CCommands.cs index be2b0bae..3d8b70d1 100644 --- a/Vocaluxe/Base/Server/CCommands.cs +++ b/Vocaluxe/Base/Server/CCommands.cs @@ -96,9 +96,8 @@ namespace Vocaluxe.Base.Server var stream = new MemoryStream(); stream.Write(cmd, 0, cmd.Length); - byte[] data; string json = JsonConvert.SerializeObject(obj); - data = _Encoder.GetBytes(json); + byte[] data = _Encoder.GetBytes(json); stream.Write(data, 0, data.Length); return stream.ToArray(); } diff --git a/Vocaluxe/Base/Server/CVocaluxeServer.cs b/Vocaluxe/Base/Server/CVocaluxeServer.cs index 03ede100..154dd1db 100644 --- a/Vocaluxe/Base/Server/CVocaluxeServer.cs +++ b/Vocaluxe/Base/Server/CVocaluxeServer.cs @@ -26,7 +26,6 @@ using ServerLib; using Vocaluxe.Lib.Input; using Vocaluxe.Lib.Playlist; using VocaluxeLib; -using VocaluxeLib.Draw; using VocaluxeLib.Menu; using VocaluxeLib.Profile; using VocaluxeLib.Songs; @@ -314,7 +313,7 @@ namespace Vocaluxe.Base.Server #endregion #region photo - private static List photosOfThisRound = new List(); + private static readonly List _PhotosOfThisRound = new List(); private static bool _SendPhoto(SPhotoData photoData) { @@ -325,17 +324,17 @@ namespace Vocaluxe.Base.Server string filePath = _SaveImage(photoData.Photo, name, CSettings.FolderPhotos); if (!string.IsNullOrEmpty(filePath)) { - photosOfThisRound.Add(filePath); + _PhotosOfThisRound.Add(filePath); return true; } return false; } - internal static string[] getPhotosOfThisRound() + internal static string[] GetPhotosOfThisRound() { - string[] result = photosOfThisRound.ToArray(); - photosOfThisRound.Clear(); + string[] result = _PhotosOfThisRound.ToArray(); + _PhotosOfThisRound.Clear(); return result; } #endregion @@ -583,11 +582,11 @@ namespace Vocaluxe.Base.Server return false; } - byte[] salt = profile.PasswordSalt; + //byte[] salt = profile.PasswordSalt; return hashedPassword.SequenceEqual(profile.PasswordHash); } - private static byte[] _GetPassowordSalt(int profileId) + private static byte[] _GetPasswordSalt(int profileId) { CProfile profile = CProfiles.GetProfile(profileId); if (profile == null) diff --git a/Vocaluxe/CProgrammHelper.cs b/Vocaluxe/CProgrammHelper.cs index 12cf6753..f4425776 100644 --- a/Vocaluxe/CProgrammHelper.cs +++ b/Vocaluxe/CProgrammHelper.cs @@ -16,12 +16,8 @@ #endregion using System; -using System.Collections.Generic; using System.IO; -using System.Linq; -using System.Runtime.Serialization; using System.Security; -using System.Text; using Microsoft.Win32; using Vocaluxe.Base; diff --git a/Vocaluxe/Lib/Playlist/CPlaylistFile.cs b/Vocaluxe/Lib/Playlist/CPlaylistFile.cs index 954cc6a7..4ab37b0f 100644 --- a/Vocaluxe/Lib/Playlist/CPlaylistFile.cs +++ b/Vocaluxe/Lib/Playlist/CPlaylistFile.cs @@ -18,7 +18,6 @@ using System; using System.Collections.Generic; using System.IO; -using System.Text; using System.Xml; using Vocaluxe.Base; using VocaluxeLib; diff --git a/Vocaluxe/Lib/Sound/CPortAudioPlay.cs b/Vocaluxe/Lib/Sound/CPortAudioPlay.cs index 985d936e..82af2e91 100644 --- a/Vocaluxe/Lib/Sound/CPortAudioPlay.cs +++ b/Vocaluxe/Lib/Sound/CPortAudioPlay.cs @@ -665,7 +665,7 @@ namespace Vocaluxe.Lib.Sound return -1; } - public bool Skip(float time) + public void Skip(float time) { lock (_LockSyncSignals) { @@ -673,8 +673,6 @@ namespace Vocaluxe.Lib.Sound _SetSkip = true; _Waiting = true; } - - return true; } #region Threading diff --git a/Vocaluxe/Screens/CPopupScreenServerQR.cs b/Vocaluxe/Screens/CPopupScreenServerQR.cs index 94ad9f74..a961edd9 100644 --- a/Vocaluxe/Screens/CPopupScreenServerQR.cs +++ b/Vocaluxe/Screens/CPopupScreenServerQR.cs @@ -15,7 +15,6 @@ // along with Vocaluxe. If not, see . #endregion -using ServerLib; using Vocaluxe.Base; using Vocaluxe.Base.Server; using VocaluxeLib; @@ -56,11 +55,6 @@ namespace Vocaluxe.Screens _ThemeTexts = new string[] {_TextServerAddress, _TextServerNotRunning}; } - public override void LoadTheme(string xmlPath) - { - base.LoadTheme(xmlPath); - } - public override void OnShow() { base.OnShow(); diff --git a/Vocaluxe/Screens/CScreenOptionsVideoAdjustments.cs b/Vocaluxe/Screens/CScreenOptionsVideoAdjustments.cs index 774ef686..6c22392b 100644 --- a/Vocaluxe/Screens/CScreenOptionsVideoAdjustments.cs +++ b/Vocaluxe/Screens/CScreenOptionsVideoAdjustments.cs @@ -15,12 +15,10 @@ // along with Vocaluxe. If not, see . #endregion -using System; using System.Windows.Forms; using Vocaluxe.Base; using VocaluxeLib; using VocaluxeLib.Menu; -using VocaluxeLib.Draw; namespace Vocaluxe.Screens { diff --git a/Vocaluxe/Screens/CScreenScore.cs b/Vocaluxe/Screens/CScreenScore.cs index ad079389..db70f56e 100644 --- a/Vocaluxe/Screens/CScreenScore.cs +++ b/Vocaluxe/Screens/CScreenScore.cs @@ -187,8 +187,8 @@ namespace Vocaluxe.Screens if (_SlideShowBGAvailable) _SlideShowBG.Draw(); else - base._DrawBG(); - base._DrawFG(); + _DrawBG(); + _DrawFG(); return true; } @@ -428,7 +428,7 @@ namespace Vocaluxe.Screens private bool _UpdateBackground() { - string[] photos = CVocaluxeServer.getPhotosOfThisRound(); + string[] photos = CVocaluxeServer.GetPhotosOfThisRound(); _SlideShowBG.RemoveSlideShowTextures(); foreach (string photo in photos) _SlideShowBG.AddSlideShowTexture(photo); diff --git a/Vocaluxe/Website/css/style.css b/Vocaluxe/Website/css/style.css index 95fde798..585e930c 100644 --- a/Vocaluxe/Website/css/style.css +++ b/Vocaluxe/Website/css/style.css @@ -22,6 +22,7 @@ position: relative; height: 100%; width: 100%; + background-color: #000000; background-color: rgba(0,0,0,0.7); } @@ -30,6 +31,7 @@ height: 100%; top: 0; margin: 0; + background: #000000; background: rgba(0, 0, 0, 0.3); display: none; position: fixed; diff --git a/VocaluxeLib/Enums.cs b/VocaluxeLib/Enums.cs index 8e68a52c..5ac45bd3 100644 --- a/VocaluxeLib/Enums.cs +++ b/VocaluxeLib/Enums.cs @@ -355,6 +355,7 @@ namespace VocaluxeLib [Flags] public enum EUserRole { + // ReSharper disable InconsistentNaming TR_USERROLE_GUEST = 0, TR_USERROLE_NORMAL = 1, TR_USERROLE_ADMIN = 2, @@ -362,5 +363,6 @@ namespace VocaluxeLib TR_USERROLE_ADDSONGSUSER = 8, TR_USERROLE_PLAYLISTEDITOR = 16, TR_USERROLE_PROFILEEDITOR = 32 + // ReSharper restore InconsistentNaming } } \ No newline at end of file diff --git a/VocaluxeLib/Extensions.cs b/VocaluxeLib/Extensions.cs index 8def331c..4cc4fe2e 100644 --- a/VocaluxeLib/Extensions.cs +++ b/VocaluxeLib/Extensions.cs @@ -19,11 +19,10 @@ using System; using System.Collections.Generic; using System.Globalization; using System.Linq; -using System.Text; namespace VocaluxeLib { - public static class Extensions + public static class CExtensions { /// /// Resizes the given list to the given size. Removes elements or adds default values diff --git a/VocaluxeLib/Menu/CBackground.cs b/VocaluxeLib/Menu/CBackground.cs index b63de885..7138d3f3 100644 --- a/VocaluxeLib/Menu/CBackground.cs +++ b/VocaluxeLib/Menu/CBackground.cs @@ -54,8 +54,8 @@ namespace VocaluxeLib.Menu private bool _ThemeLoaded; private int _SlideShowCurrent; - private Stopwatch _SlideShowTimer = new Stopwatch(); - private List _SlideShowTextures = new List(); + private readonly Stopwatch _SlideShowTimer = new Stopwatch(); + private readonly List _SlideShowTextures = new List(); public SColorF Color; @@ -69,8 +69,7 @@ namespace VocaluxeLib.Menu { _PartyModeID = partyModeID; _ThemeLoaded = false; - _Theme = new SThemeBackground(); - _Theme.SlideShowTextures = new List(); + _Theme = new SThemeBackground {SlideShowTextures = new List()}; Color = new SColorF(0f, 0f, 0f, 1f); } @@ -102,11 +101,11 @@ namespace VocaluxeLib.Menu _ThemeLoaded &= success; } - string slideShow = ""; int i = 1; while (xmlReader.ItemExists(item + "/SlideShow" + i)) { + string slideShow; xmlReader.GetValue(item + "/SlideShow" + i, out slideShow, String.Empty); if (slideShow != "") _Theme.SlideShowTextures.Add(slideShow); diff --git a/VocaluxeLib/Menu/CLyric.cs b/VocaluxeLib/Menu/CLyric.cs index f4315702..a1c72daa 100644 --- a/VocaluxeLib/Menu/CLyric.cs +++ b/VocaluxeLib/Menu/CLyric.cs @@ -16,8 +16,6 @@ #endregion using System; -using System.Collections.Generic; -using System.Drawing; using System.Xml; using VocaluxeLib.Songs; diff --git a/VocaluxeLib/Menu/CMenu.cs b/VocaluxeLib/Menu/CMenu.cs index 73e53958..c64c9400 100644 --- a/VocaluxeLib/Menu/CMenu.cs +++ b/VocaluxeLib/Menu/CMenu.cs @@ -19,7 +19,6 @@ using System; using System.Collections.Generic; using System.Drawing; using System.IO; -using System.Text; using System.Windows.Forms; using System.Xml; using VocaluxeLib.Draw; diff --git a/VocaluxeLib/Menu/CMenuPartyNameSelection.cs b/VocaluxeLib/Menu/CMenuPartyNameSelection.cs index 1b8686a4..76015829 100644 --- a/VocaluxeLib/Menu/CMenuPartyNameSelection.cs +++ b/VocaluxeLib/Menu/CMenuPartyNameSelection.cs @@ -15,11 +15,8 @@ // along with Vocaluxe. If not, see . #endregion -using System; using System.Collections.Generic; -using System.Linq; using System.Windows.Forms; -using VocaluxeLib.PartyModes; using VocaluxeLib.Draw; using VocaluxeLib.Profile; @@ -94,10 +91,7 @@ namespace VocaluxeLib.Menu _NumPlayer = numPlayer; _NumPlayerTeams = numPlayerTeams; - if (_NumTeams > 0) - _TeamList = new List[_NumTeams]; - else - _TeamList = new List[1]; + _TeamList = new List[_NumTeams > 0 ? _NumTeams : 1]; if (_NumTeams != _NumPlayerTeams.Length) _NumPlayerTeams = new int[_NumTeams]; @@ -126,7 +120,7 @@ namespace VocaluxeLib.Menu { //Handle left/right/up/down _NameSelections[_NameSelection].HandleInput(keyEvent); - int numberPressed = -1; + int numPressed = -1; bool resetSelection = false; switch (keyEvent.Key) { @@ -157,20 +151,65 @@ namespace VocaluxeLib.Menu case Keys.Back: resetSelection = true; break; + + case Keys.D1: + case Keys.NumPad1: + numPressed = 1; + break; + + case Keys.D2: + case Keys.NumPad2: + numPressed = 2; + break; + + case Keys.D3: + case Keys.NumPad3: + numPressed = 3; + break; + + case Keys.D4: + case Keys.NumPad4: + numPressed = 4; + break; + + case Keys.D5: + case Keys.NumPad5: + numPressed = 5; + break; + + case Keys.D6: + case Keys.NumPad6: + numPressed = 6; + break; + + case Keys.D7: + case Keys.NumPad7: + numPressed = 7; + break; + + case Keys.D8: + case Keys.NumPad8: + numPressed = 8; + break; + + case Keys.D9: + case Keys.NumPad9: + numPressed = 9; + break; } - if (numberPressed > 0 || resetSelection) + if (numPressed > 0 || resetSelection) { - if (numberPressed == _SelectingFastPlayerNr || resetSelection) + if (numPressed == _SelectingFastPlayerNr || resetSelection) { //Reset all values _SelectingFastPlayerNr = 0; _SelectingKeyboardActive = false; _NameSelections[_NameSelection].FastSelection(false, -1); } - else if (numberPressed <= _NumPlayerTeams[_CurrentTeam]) + else if (numPressed <= _NumPlayerTeams[_CurrentTeam]) { - _SelectingFastPlayerNr = numberPressed; - _NameSelections[_NameSelection].FastSelection(true, numberPressed); + _SelectingFastPlayerNr = numPressed; + _NameSelections[_NameSelection].FastSelection(true, numPressed); } _SelectingFast = false; } @@ -530,9 +569,7 @@ namespace VocaluxeLib.Menu public SPartyNameOptions GetData() { - SPartyNameOptions option = new SPartyNameOptions(); - option.NumPlayerTeams = _NumPlayerTeams; - option.TeamList = _TeamList; + SPartyNameOptions option = new SPartyNameOptions {NumPlayerTeams = _NumPlayerTeams, TeamList = _TeamList}; return option; } @@ -692,7 +729,7 @@ namespace VocaluxeLib.Menu { if (_NumPlayerTeams[team] == _TeamList[team].Count && !_ChangePlayerNumDynamic) return; - else if (_NumPlayerTeams[team] == _PartyMode.GetMaxPlayerPerTeam()) + if (_NumPlayerTeams[team] == _PartyMode.GetMaxPlayerPerTeam()) return; _NameSelections[_NameSelection].UseProfile(profileID); @@ -707,8 +744,8 @@ namespace VocaluxeLib.Menu { List ids = new List(); ids.AddRange(_TeamList[t]); - for (int p = 0; p < ids.Count; p++) - _RemovePlayer(t, ids[p]); + foreach (int id in ids) + _RemovePlayer(t, id); } } diff --git a/VocaluxeLib/Menu/CNameSelection.cs b/VocaluxeLib/Menu/CNameSelection.cs index 301c2d04..3fd10b95 100644 --- a/VocaluxeLib/Menu/CNameSelection.cs +++ b/VocaluxeLib/Menu/CNameSelection.cs @@ -94,7 +94,7 @@ namespace VocaluxeLib.Menu private int _Player = -1; private readonly List _VisibleProfiles; - private List _UsedProfiles; + private readonly List _UsedProfiles; private CStatic _PlayerSelector; @@ -416,7 +416,6 @@ namespace VocaluxeLib.Menu _Tiles[i].Avatar.Texture = CBase.Profiles.GetAvatar(_VisibleProfiles[i + offset * _Tiles.Count]); _Tiles[i].Avatar.Color = new SColorF(1, 1, 1, 1); _Tiles[i].Name.Text = CBase.Profiles.GetPlayerName(_VisibleProfiles[i + offset * _Tiles.Count]); - ; _Tiles[i].ProfileID = _VisibleProfiles[i + offset * _Tiles.Count]; } else diff --git a/VocaluxeLib/Menu/SongMenu/CSongMenu.cs b/VocaluxeLib/Menu/SongMenu/CSongMenu.cs index 7d5e75fa..964a2ab5 100644 --- a/VocaluxeLib/Menu/SongMenu/CSongMenu.cs +++ b/VocaluxeLib/Menu/SongMenu/CSongMenu.cs @@ -214,7 +214,8 @@ namespace VocaluxeLib.Menu.SongMenu if (_SongMenu != null) _SongMenu.OnHide(); - switch (CBase.Config.GetSongMenuType()) + _Type = CBase.Config.GetSongMenuType(); + switch (_Type) { //case ESongMenu.TR_CONFIG_LIST: // _SongMenu = new CSongMenuList(); @@ -231,8 +232,6 @@ namespace VocaluxeLib.Menu.SongMenu // _SongMenu = new CSongMenuBook(); // break; } - - _Type = CBase.Config.GetSongMenuType(); } } } \ No newline at end of file diff --git a/VocaluxeLib/Menu/SongMenu/CSongMenuTileBoard.cs b/VocaluxeLib/Menu/SongMenu/CSongMenuTileBoard.cs index 2beb4e95..46781018 100644 --- a/VocaluxeLib/Menu/SongMenu/CSongMenuTileBoard.cs +++ b/VocaluxeLib/Menu/SongMenu/CSongMenuTileBoard.cs @@ -67,11 +67,11 @@ namespace VocaluxeLib.Menu.SongMenu { set { - base._PlaySong(value); - base._PreviewIdInternal = value; + _PlaySong(value); + _PreviewIdInternal = value; _UpdatePreview(); } - get { return base._PreviewIdInternal; } + get { return _PreviewIdInternal; } } public override int GetActualSelection() @@ -138,7 +138,7 @@ namespace VocaluxeLib.Menu.SongMenu } if (_Length < 0 && CBase.Sound.GetLength(_PreviewSongStream) > 0 && CBase.Songs.IsInCategory()) - UpdateLength(CBase.Songs.GetVisibleSong(_PreviewId)); + _UpdateLength(CBase.Songs.GetVisibleSong(_PreviewId)); } private void _UpdatePreview() @@ -181,7 +181,7 @@ namespace VocaluxeLib.Menu.SongMenu _MedleyCalcIcon.Visible = song.Medley.Source == EDataSource.Calculated; _MedleyTagIcon.Visible = song.Medley.Source == EDataSource.Tag; - UpdateLength(song); + _UpdateLength(song); } else { @@ -198,23 +198,22 @@ namespace VocaluxeLib.Menu.SongMenu } } - private void UpdateLength(CSong song) + private void _UpdateLength(CSong song) { - if (song != null) - { - float time = CBase.Sound.GetLength(_PreviewSongStream); - if (Math.Abs(song.Finish) > 0.001) - time = song.Finish; + if (song == null) + return; + float time = CBase.Sound.GetLength(_PreviewSongStream); + if (Math.Abs(song.Finish) > 0.001) + time = song.Finish; - // The audiobackend is not yet ready to return the length - if (time > 0) - { - time -= song.Start; - var min = (int)Math.Floor(time / 60f); - var sec = (int)(time - min * 60f); - _SongLength.Text = min.ToString("00") + ":" + sec.ToString("00"); - _Length = time; - } + // The audiobackend is ready to return the length + if (time > 0) + { + time -= song.Start; + var min = (int)Math.Floor(time / 60f); + var sec = (int)(time - min * 60f); + _SongLength.Text = min.ToString("00") + ":" + sec.ToString("00"); + _Length = time; } } @@ -556,7 +555,7 @@ namespace VocaluxeLib.Menu.SongMenu public override void SetSelectedSong(int visibleSongNr) { - base._PlaySong(visibleSongNr); + _PlaySong(visibleSongNr); base.SetSelectedSong(visibleSongNr); if (visibleSongNr >= 0 && visibleSongNr < CBase.Songs.GetNumSongsVisible()) diff --git a/VocaluxeLib/Profile/CAvatar.cs b/VocaluxeLib/Profile/CAvatar.cs index 716884c6..1928c915 100644 --- a/VocaluxeLib/Profile/CAvatar.cs +++ b/VocaluxeLib/Profile/CAvatar.cs @@ -49,7 +49,7 @@ namespace VocaluxeLib.Profile CBase.Drawing.RemoveTexture(ref Texture); } - public string getFileName() + public string GetFileName() { return FileName; } diff --git a/VocaluxeLib/Profile/CProfile.cs b/VocaluxeLib/Profile/CProfile.cs index 7d4e2b54..4e27b4bd 100644 --- a/VocaluxeLib/Profile/CProfile.cs +++ b/VocaluxeLib/Profile/CProfile.cs @@ -17,7 +17,6 @@ using System; using System.IO; -using System.Text; using System.Xml; namespace VocaluxeLib.Profile @@ -71,9 +70,11 @@ namespace VocaluxeLib.Profile FileName = String.Empty; } - public bool LoadProfile() + public bool LoadProfile(string pathName, string fileName) { - return LoadProfile(FilePath, FileName); + FilePath = pathName; + FileName = fileName; + return LoadProfile(); } public bool LoadProfile(string file) @@ -81,10 +82,10 @@ namespace VocaluxeLib.Profile FileName = Path.GetFileName(file); FilePath = Path.GetDirectoryName(file); - return LoadProfile(FilePath, FileName); + return LoadProfile(); } - public bool LoadProfile(string pathName, string fileName) + public bool LoadProfile() { CXMLReader xmlReader = CXMLReader.OpenFile(Path.Combine(FilePath, FileName)); if (xmlReader == null) diff --git a/VocaluxeLib/Songs/CLineBase.cs b/VocaluxeLib/Songs/CLineBase.cs index 2a0bc348..6c972851 100644 --- a/VocaluxeLib/Songs/CLineBase.cs +++ b/VocaluxeLib/Songs/CLineBase.cs @@ -135,11 +135,10 @@ namespace VocaluxeLib.Songs return false; } - public bool IncLastNoteLength() + public void IncLastNoteLength() { if (_Notes.Count > 0) _Notes[NoteCount - 1].Duration++; - return false; } public void DeleteAllNotes() diff --git a/VocaluxeLib/Songs/CSong.cs b/VocaluxeLib/Songs/CSong.cs index e711cd94..c16c1874 100644 --- a/VocaluxeLib/Songs/CSong.cs +++ b/VocaluxeLib/Songs/CSong.cs @@ -97,7 +97,7 @@ namespace VocaluxeLib.Songs public string MP3FileName = String.Empty; public string CoverFileName = String.Empty; - public List BackgroundFileNames = new List(); + public readonly List BackgroundFileNames = new List(); public string VideoFileName = String.Empty; public EAspect VideoAspect = EAspect.Crop; diff --git a/VocaluxeLib/Songs/CSungNote.cs b/VocaluxeLib/Songs/CSungNote.cs index 7dd0e8f7..3fd3b9a1 100644 --- a/VocaluxeLib/Songs/CSungNote.cs +++ b/VocaluxeLib/Songs/CSungNote.cs @@ -41,6 +41,7 @@ namespace VocaluxeLib.Songs /// /// /// + /// public CSungNote(int startBeat, int duration, int tone, CSongNote hitNote, double points) : this(startBeat, duration, tone) { HitNote = hitNote; diff --git a/VocaluxeLib/Songs/CVoice.cs b/VocaluxeLib/Songs/CVoice.cs index 27aaeae0..c9784a3a 100644 --- a/VocaluxeLib/Songs/CVoice.cs +++ b/VocaluxeLib/Songs/CVoice.cs @@ -205,15 +205,13 @@ namespace VocaluxeLib.Songs public void UpdateTimings() { - CSongNote lastNote; - if (_Lines.Count == 0) return; _Lines[0].StartBeat = -10000; for (int i = 1; i < _Lines.Count; i++) { - lastNote = _Lines[i - 1].LastNote; + CSongNote lastNote = _Lines[i - 1].LastNote; CSongNote firstNote = _Lines[i].FirstNote; if ((lastNote != null) && (firstNote != null)) diff --git a/WebserverInitalConfig/CConfigHttpApi.cs b/WebserverInitalConfig/CConfigHttpApi.cs index fe184af4..38002df3 100644 --- a/WebserverInitalConfig/CConfigHttpApi.cs +++ b/WebserverInitalConfig/CConfigHttpApi.cs @@ -15,7 +15,6 @@ // along with Vocaluxe. If not, see . #endregion -using System.Diagnostics; using System.Security.Authentication; using System.Security.Principal; using Security.Cryptography; @@ -166,12 +165,7 @@ namespace WebserverInitalConfig { if (!profile.FirewallEnabled) return true; - foreach (INetFwAuthorizedApplication a in profile.AuthorizedApplications) - { - if (a.ProcessImageFileName == _ExePath) - return true; - } - return false; + return profile.AuthorizedApplications.Cast().Any(a => a.ProcessImageFileName == _ExePath); } private bool _IsPortOpen(INetFwProfile profile) @@ -180,12 +174,7 @@ namespace WebserverInitalConfig if (!profile.FirewallEnabled) return true; - foreach (INetFwOpenPort p in profile.GloballyOpenPorts) - { - if (p.Protocol == protocol && p.Port == _Port) - return true; - } - return false; + return profile.GloballyOpenPorts.Cast().Any(p => p.Protocol == protocol && p.Port == _Port); } private NET_FW_IP_PROTOCOL_ _GetProtocol() diff --git a/WebserverInitalConfig/HttpApi.cs b/WebserverInitalConfig/HttpApi.cs index c248f8b6..39f587ff 100644 --- a/WebserverInitalConfig/HttpApi.cs +++ b/WebserverInitalConfig/HttpApi.cs @@ -18,13 +18,10 @@ using System; using System.Collections.Generic; using System.ComponentModel; -using System.Linq; using System.Net; using System.Net.Sockets; using System.Runtime.InteropServices; using System.Security.Cryptography.X509Certificates; -using System.Text; -using System.Threading.Tasks; namespace WebserverInitalConfig { diff --git a/WebserverInitalConfig/Program.cs b/WebserverInitalConfig/Program.cs index a4f3a315..fc09dac1 100644 --- a/WebserverInitalConfig/Program.cs +++ b/WebserverInitalConfig/Program.cs @@ -19,9 +19,7 @@ using System; using System.Diagnostics; using System.IO; using System.Net; -using System.Net.Mime; using System.Security.Authentication; -using System.Security.Cryptography.X509Certificates; namespace WebserverInitalConfig { diff --git a/WebserverInitalConfig/Properties/AssemblyInfo.cs b/WebserverInitalConfig/Properties/AssemblyInfo.cs index 4665bfa0..4a79c1a6 100644 --- a/WebserverInitalConfig/Properties/AssemblyInfo.cs +++ b/WebserverInitalConfig/Properties/AssemblyInfo.cs @@ -16,7 +16,6 @@ #endregion using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // Allgemeine Informationen über eine Assembly werden über die folgenden