diff --git a/PartyModes/PartyModeChallengeMedley/CChallengeRounds.cs b/PartyModes/PartyModeChallengeMedley/CChallengeRounds.cs index ea149cdc..7b6310c1 100644 --- a/PartyModes/PartyModeChallengeMedley/CChallengeRounds.cs +++ b/PartyModes/PartyModeChallengeMedley/CChallengeRounds.cs @@ -237,7 +237,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley return false; } - public bool IsAvailableAll(List playerIndices) + public bool IsAvailableAll(IEnumerable playerIndices) { bool result = true; foreach (int p in playerIndices) @@ -245,7 +245,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley return result; } - public bool IsAvailableSomeone(List playerIndices) + public bool IsAvailableSomeone(IEnumerable playerIndices) { bool result = false; foreach (int p in playerIndices) diff --git a/Vocaluxe/Base/CDataBase.cs b/Vocaluxe/Base/CDataBase.cs index b130d5e4..d44dce78 100644 --- a/Vocaluxe/Base/CDataBase.cs +++ b/Vocaluxe/Base/CDataBase.cs @@ -1415,10 +1415,10 @@ namespace Vocaluxe.Base { const int chunkSize = 2 * 1024; byte[] buffer = new byte[chunkSize]; - long bytesRead; long fieldOffset = 0; using (MemoryStream stream = new MemoryStream()) { + long bytesRead; while ((bytesRead = reader.GetBytes(0, fieldOffset, buffer, 0, buffer.Length)) > 0) { byte[] actualRead = new byte[bytesRead]; diff --git a/Vocaluxe/Base/CGraphics.cs b/Vocaluxe/Base/CGraphics.cs index 5f9f3078..eff9e0c4 100644 --- a/Vocaluxe/Base/CGraphics.cs +++ b/Vocaluxe/Base/CGraphics.cs @@ -794,8 +794,7 @@ namespace Vocaluxe.Base if (CTheme.Cursor.Color != "") { - SColorF color; - color = CTheme.GetColor(CTheme.Cursor.Color, -1); + SColorF color = CTheme.GetColor(CTheme.Cursor.Color, -1); CTheme.Cursor.R = color.R; CTheme.Cursor.G = color.G; CTheme.Cursor.B = color.B; diff --git a/Vocaluxe/Base/CLanguage.cs b/Vocaluxe/Base/CLanguage.cs index 00b2d6e5..c9024d67 100644 --- a/Vocaluxe/Base/CLanguage.cs +++ b/Vocaluxe/Base/CLanguage.cs @@ -63,7 +63,7 @@ namespace Vocaluxe.Base return _Languages[lang].Name; } - public static string[] GetLanguageNames() + public static IEnumerable GetLanguageNames() { string[] languages = new string[_Languages.Count]; @@ -179,7 +179,7 @@ namespace Vocaluxe.Base private static bool _LoadLanguageEntries(CXMLReader xmlReader, out Dictionary texts) { texts = new Dictionary(); - List names = xmlReader.GetAttributes("resources", "name"); + IEnumerable names = xmlReader.GetAttributes("resources", "name"); foreach (string name in names) { string value; diff --git a/Vocaluxe/Base/CMain.cs b/Vocaluxe/Base/CMain.cs index 0b77a945..64cbbb9c 100644 --- a/Vocaluxe/Base/CMain.cs +++ b/Vocaluxe/Base/CMain.cs @@ -27,11 +27,11 @@ namespace Vocaluxe.Base { static class CMain { - public static IConfig Config = new CBconfig(); - public static ISettings Settings = new CBsettings(); - public static ITheme Theme = new CBtheme(); - public static IBackgroundMusic BackgroundMusic = new CBbackgroundMusic(); - public static IDrawing Draw = new CBdraw(); + public static readonly IConfig Config = new CBconfig(); + public static readonly ISettings Settings = new CBsettings(); + public static readonly ITheme Theme = new CBtheme(); + public static readonly IBackgroundMusic BackgroundMusic = new CBbackgroundMusic(); + public static readonly IDrawing Draw = new CBdraw(); public static IGraphics Graphics = new CBGraphics(); public static ILog Log = new CBlog(); public static IFonts Fonts = new CBfonts(); @@ -113,7 +113,7 @@ namespace Vocaluxe.Base return CConfig.CoverSize; } - public List GetSongFolder() + public IEnumerable GetSongFolder() { return CConfig.SongFolder; } diff --git a/Vocaluxe/Base/CPlaylists.cs b/Vocaluxe/Base/CPlaylists.cs index 9fad3f43..d71bcda5 100644 --- a/Vocaluxe/Base/CPlaylists.cs +++ b/Vocaluxe/Base/CPlaylists.cs @@ -36,7 +36,7 @@ namespace Vocaluxe.Base get { return _Playlists.ToArray(); } } - public static string[] PlaylistNames + public static IEnumerable PlaylistNames { get { @@ -227,7 +227,7 @@ namespace Vocaluxe.Base private static int _CompareByPlaylistName(CPlaylistFile a, CPlaylistFile b) { - return String.Compare(a.PlaylistName, b.PlaylistName); + return System.String.CompareOrdinal(a.PlaylistName, b.PlaylistName); } private static CPlaylistFile _ConvertUSDXPlaylist(string file) @@ -237,9 +237,9 @@ namespace Vocaluxe.Base if (!File.Exists(file)) return null; - StreamReader sr; try { + StreamReader sr; using (sr = new StreamReader(file, Encoding.Default, true)) { string line; diff --git a/Vocaluxe/Base/CProfiles.cs b/Vocaluxe/Base/CProfiles.cs index 76e910d8..d69effda 100644 --- a/Vocaluxe/Base/CProfiles.cs +++ b/Vocaluxe/Base/CProfiles.cs @@ -282,7 +282,7 @@ namespace Vocaluxe.Base private static int _CompareByPlayerName(SProfile a, SProfile b) { - return String.Compare(a.PlayerName, b.PlayerName); + return System.String.CompareOrdinal(a.PlayerName, b.PlayerName); } #region private methods diff --git a/Vocaluxe/Lib/Sound/CDirectSoundRecord.cs b/Vocaluxe/Lib/Sound/CDirectSoundRecord.cs index a26c9003..746e4bca 100644 --- a/Vocaluxe/Lib/Sound/CDirectSoundRecord.cs +++ b/Vocaluxe/Lib/Sound/CDirectSoundRecord.cs @@ -383,13 +383,12 @@ namespace Vocaluxe.Lib.Sound // Buffer type must match this.waveFormat.FormatTag and this.waveFormat.BitsPerSample byte[] bufferPortion = new byte[bufferPortionSamples]; - int bufferPortionIndex; _CaptureBuffer.Start(true); while (_Running) { - bufferPortionIndex = WaitHandle.WaitAny(_WaitHandles); + int bufferPortionIndex = WaitHandle.WaitAny(_WaitHandles); _CaptureBuffer.Read( bufferPortion, diff --git a/Vocaluxe/Screens/CScreenCredits.cs b/Vocaluxe/Screens/CScreenCredits.cs index c9df9ec0..d8a17f78 100644 --- a/Vocaluxe/Screens/CScreenCredits.cs +++ b/Vocaluxe/Screens/CScreenCredits.cs @@ -152,13 +152,10 @@ namespace Vocaluxe.Screens _ParagraphTexts = new List(); _Paragraphs = new List(); - string paragraph; - string[] words; - - paragraph = "Inspired by the achievements of UltraStar Deluxe and its variants and pursuing the goal of making " + - "a good thing even better, we ended up rewriting the game from scratch. And a new implementation in a new " + - "programming language called for a new name - and VOCALUXE [ˈvoʊˈkəˈlʌks] it is!"; - words = paragraph.Split(new char[] {' '}); + string paragraph = "Inspired by the achievements of UltraStar Deluxe and its variants and pursuing the goal of making " + + "a good thing even better, we ended up rewriting the game from scratch. And a new implementation in a new " + + "programming language called for a new name - and VOCALUXE [ˈvoʊˈkəˈlʌks] it is!"; + string[] words = paragraph.Split(new char[] {' '}); _Paragraphs.Add(words); paragraph = "This first public version has already implemented many of the original features and it is fully " + diff --git a/Vocaluxe/Screens/CScreenSong.cs b/Vocaluxe/Screens/CScreenSong.cs index 6108ade4..85551067 100644 --- a/Vocaluxe/Screens/CScreenSong.cs +++ b/Vocaluxe/Screens/CScreenSong.cs @@ -819,8 +819,7 @@ namespace Vocaluxe.Screens { if (CSongs.Category >= 0 && songNr >= 0 && CSongs.NumVisibleSongs > songNr) { - EGameMode gm; - gm = CSongs.VisibleSongs[songNr].IsDuet ? EGameMode.TR_GAMEMODE_DUET : EGameMode.TR_GAMEMODE_NORMAL; + EGameMode gm = CSongs.VisibleSongs[songNr].IsDuet ? EGameMode.TR_GAMEMODE_DUET : EGameMode.TR_GAMEMODE_NORMAL; CGame.Reset(); CGame.ClearSongs(); diff --git a/VocaluxeLib/Menu/CMenuParty.cs b/VocaluxeLib/Menu/CMenuParty.cs index 2cd1fa5c..965f6175 100644 --- a/VocaluxeLib/Menu/CMenuParty.cs +++ b/VocaluxeLib/Menu/CMenuParty.cs @@ -26,7 +26,7 @@ namespace VocaluxeLib.Menu { protected IPartyMode _PartyMode; - public CMenuParty() + protected CMenuParty() { _PartyMode = new CPartyModeNone(); } diff --git a/VocaluxeLib/Menu/CSelectSlide.cs b/VocaluxeLib/Menu/CSelectSlide.cs index a79d9e93..66ad5b95 100644 --- a/VocaluxeLib/Menu/CSelectSlide.cs +++ b/VocaluxeLib/Menu/CSelectSlide.cs @@ -556,7 +556,7 @@ namespace VocaluxeLib.Menu _ValueBounds.Clear(); } - public void AddValues(string[] values) + public void AddValues(IEnumerable values) { foreach (string value in values) _AddValue(value, new STexture(-1), _PartyModeID); diff --git a/VocaluxeLib/Menu/CXMLReader.cs b/VocaluxeLib/Menu/CXMLReader.cs index 55944771..6173699b 100644 --- a/VocaluxeLib/Menu/CXMLReader.cs +++ b/VocaluxeLib/Menu/CXMLReader.cs @@ -141,7 +141,7 @@ namespace VocaluxeLib.Menu return values; } - public List GetAttributes(string cast, string attribute) + public IEnumerable GetAttributes(string cast, string attribute) { List values = new List(); @@ -180,11 +180,10 @@ namespace VocaluxeLib.Menu public bool ItemExists(string cast) { - XPathNodeIterator iterator; int results = 0; _Navigator.MoveToFirstChild(); - iterator = _Navigator.Select(cast); + XPathNodeIterator iterator = _Navigator.Select(cast); while (iterator.MoveNext()) results++; diff --git a/VocaluxeLib/Menu/IMenu.cs b/VocaluxeLib/Menu/IMenu.cs index 70813cfc..28b278f7 100644 --- a/VocaluxeLib/Menu/IMenu.cs +++ b/VocaluxeLib/Menu/IMenu.cs @@ -86,7 +86,7 @@ namespace VocaluxeLib.Menu int GetCoverSize(); - List GetSongFolder(); + IEnumerable GetSongFolder(); ESongSorting GetSongSorting(); EOffOn GetTabs(); EOffOn GetIgnoreArticles(); diff --git a/VocaluxeLib/Menu/SingNotes/CNotes.cs b/VocaluxeLib/Menu/SingNotes/CNotes.cs index 7c7413ba..1794834c 100644 --- a/VocaluxeLib/Menu/SingNotes/CNotes.cs +++ b/VocaluxeLib/Menu/SingNotes/CNotes.cs @@ -707,7 +707,6 @@ namespace VocaluxeLib.Menu.SingNotes public void UpdateTimings() { CNote lastNote; - int min, max, s; if (_Lines.Count > 0) _Lines[0].StartBeat = -10000; @@ -719,9 +718,10 @@ namespace VocaluxeLib.Menu.SingNotes if ((lastNote != null) && (firstNote != null)) { - min = lastNote.EndBeat; - max = firstNote.StartBeat; + int min = lastNote.EndBeat; + int max = firstNote.StartBeat; + int s; switch (max - min) { case 0: diff --git a/VocaluxeLib/Menu/SingNotes/CSingNotes.cs b/VocaluxeLib/Menu/SingNotes/CSingNotes.cs index 9e254aee..06c227e8 100644 --- a/VocaluxeLib/Menu/SingNotes/CSingNotes.cs +++ b/VocaluxeLib/Menu/SingNotes/CSingNotes.cs @@ -74,7 +74,7 @@ namespace VocaluxeLib.Menu.SingNotes /// public SRectF[,] BarPos { get; set; } - public CSingNotes(int partyModeID) + protected CSingNotes(int partyModeID) { _PartyModeID = partyModeID; _Theme = new SThemeSingBar(); diff --git a/VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs b/VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs index 2fa3ed64..e4cc0766 100644 --- a/VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs +++ b/VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs @@ -234,7 +234,7 @@ namespace VocaluxeLib.Menu.SongMenu _Visible = visible; } - public CSongMenuFramework(int partyModeID) + protected CSongMenuFramework(int partyModeID) { _PartyModeID = partyModeID; _Theme = new SThemeSongMenu diff --git a/VocaluxeLib/PartyModes/CPartyMode.cs b/VocaluxeLib/PartyModes/CPartyMode.cs index de9c9b7a..cbc74a52 100644 --- a/VocaluxeLib/PartyModes/CPartyMode.cs +++ b/VocaluxeLib/PartyModes/CPartyMode.cs @@ -28,7 +28,7 @@ namespace VocaluxeLib.PartyModes protected SScreenSongOptions _ScreenSongOptions; protected readonly Dictionary _Screens; - public CPartyMode() + protected CPartyMode() { _Screens = new Dictionary(); _ScreenSongOptions = new SScreenSongOptions {Selection = new SSelectionOptions(), Sorting = new SSortingOptions()};