diff --git a/Vocaluxe/Base/CConfig.cs b/Vocaluxe/Base/CConfig.cs index f3dbbdbf..64fd0aed 100644 --- a/Vocaluxe/Base/CConfig.cs +++ b/Vocaluxe/Base/CConfig.cs @@ -697,7 +697,7 @@ namespace Vocaluxe.Base /// Parameters public static void LoadCommandLineParams(string[] args) { - Regex spliterParam = new Regex(@"-{1,2}|\/", RegexOptions.IgnoreCase); + var spliterParam = new Regex(@"-{1,2}|\/", RegexOptions.IgnoreCase); //Complete argument string string arguments = args.Aggregate(string.Empty, (current, arg) => current + (arg + " ")); @@ -706,7 +706,7 @@ namespace Vocaluxe.Base foreach (string text in args) { - Regex spliterVal = new Regex(@"\s", RegexOptions.IgnoreCase); + var spliterVal = new Regex(@"\s", RegexOptions.IgnoreCase); //split arg with Spilter-Regex and save in parts string[] parts = spliterVal.Split(text, 2); diff --git a/Vocaluxe/Base/CController.cs b/Vocaluxe/Base/CController.cs index e28bb2ee..babc1ca0 100644 --- a/Vocaluxe/Base/CController.cs +++ b/Vocaluxe/Base/CController.cs @@ -77,11 +77,11 @@ namespace Vocaluxe.Base { controller.Update(); - SKeyEvent ke = new SKeyEvent(); + var ke = new SKeyEvent(); while (controller.PollKeyEvent(ref ke)) _KeysPool.Add(ke); - SMouseEvent me = new SMouseEvent(); + var me = new SMouseEvent(); while (controller.PollMouseEvent(ref me)) _MousePool.Add(me); } diff --git a/Vocaluxe/Base/CDataBase.cs b/Vocaluxe/Base/CDataBase.cs index ffe314cf..c9e0ebdb 100644 --- a/Vocaluxe/Base/CDataBase.cs +++ b/Vocaluxe/Base/CDataBase.cs @@ -71,13 +71,12 @@ namespace Vocaluxe.Base } #region Highscores - public static bool GetDataBaseSongInfos(string artist, string title, out int numPlayed, out string dateAdded, out int highscoreID) { - string sArtist = string.Empty; - string sTitle = string.Empty; - int songID = -1; - using (SQLiteConnection connection = new SQLiteConnection()) + string sArtist; + string sTitle; + int songID; + using (var connection = new SQLiteConnection()) { connection.ConnectionString = "Data Source=" + _HighscoreFilePath; @@ -85,11 +84,9 @@ namespace Vocaluxe.Base { connection.Open(); } - catch (Exception) - { - } + catch (Exception) {} - using (SQLiteCommand command = new SQLiteCommand(connection)) + using (var command = new SQLiteCommand(connection)) { songID = _GetDataBaseSongID(artist, title, 0, command); highscoreID = songID; @@ -100,7 +97,7 @@ namespace Vocaluxe.Base public static void IncreaseSongCounter(SPlayer player) { - using (SQLiteConnection connection = new SQLiteConnection()) + using (var connection = new SQLiteConnection()) { connection.ConnectionString = "Data Source=" + _HighscoreFilePath; @@ -108,11 +105,9 @@ namespace Vocaluxe.Base { connection.Open(); } - catch (Exception) - { - } + catch (Exception) {} - using (SQLiteCommand command = new SQLiteCommand(connection)) + using (var command = new SQLiteCommand(connection)) { int dataBaseSongID = _GetDataBaseSongID(player, command); _IncreaseSongCounter(dataBaseSongID, command); @@ -122,7 +117,7 @@ namespace Vocaluxe.Base public static void IncreaseSongCounter(int dataBaseSongID) { - using (SQLiteConnection connection = new SQLiteConnection()) + using (var connection = new SQLiteConnection()) { connection.ConnectionString = "Data Source=" + _HighscoreFilePath; @@ -130,21 +125,17 @@ namespace Vocaluxe.Base { connection.Open(); } - catch (Exception) - { - } + catch (Exception) {} - using (SQLiteCommand command = new SQLiteCommand(connection)) - { + using (var command = new SQLiteCommand(connection)) _IncreaseSongCounter(dataBaseSongID, command); - } } } public static int AddScore(string playerName, int score, int lineNr, long date, int medley, int duet, int shortSong, int difficulty, string artist, string title, int numPlayed, string filePath) { - using (SQLiteConnection connection = new SQLiteConnection()) + using (var connection = new SQLiteConnection()) { connection.ConnectionString = "Data Source=" + filePath; @@ -157,7 +148,7 @@ namespace Vocaluxe.Base return -1; } - using (SQLiteCommand command = new SQLiteCommand(connection)) + using (var command = new SQLiteCommand(connection)) { int dataBaseSongID = _GetDataBaseSongID(artist, title, numPlayed, command); int result = _AddScore(playerName, score, lineNr, date, medley, duet, shortSong, difficulty, dataBaseSongID, command); @@ -168,7 +159,7 @@ namespace Vocaluxe.Base public static int AddScore(SPlayer player) { - using (SQLiteConnection connection = new SQLiteConnection()) + using (var connection = new SQLiteConnection()) { connection.ConnectionString = "Data Source=" + _HighscoreFilePath; @@ -181,7 +172,7 @@ namespace Vocaluxe.Base return -1; } - using (SQLiteCommand command = new SQLiteCommand(connection)) + using (var command = new SQLiteCommand(connection)) { int dataBaseSongID = CSongs.GetSong(player.SongID).DataBaseSongID; return _AddScore(CProfiles.GetPlayerName(player.ProfileID), (int)Math.Round(player.Points), player.VoiceNr, player.DateTicks, player.Medley ? 1 : 0, @@ -256,7 +247,7 @@ namespace Vocaluxe.Base public static void LoadScore(out List scores, SPlayer player) { - using (SQLiteConnection connection = new SQLiteConnection()) + using (var connection = new SQLiteConnection()) { connection.ConnectionString = "Data Source=" + _HighscoreFilePath; @@ -271,7 +262,7 @@ namespace Vocaluxe.Base return; } - using (SQLiteCommand command = new SQLiteCommand(connection)) + using (var command = new SQLiteCommand(connection)) { int medley = 0; if (player.Medley) @@ -301,7 +292,7 @@ namespace Vocaluxe.Base { while (reader.Read()) { - SScores score = new SScores + var score = new SScores { Name = reader.GetString(0), Score = reader.GetInt32(1), @@ -361,7 +352,7 @@ namespace Vocaluxe.Base command.Parameters.Add("@title", DbType.String, 0).Value = title; command.Parameters.Add("@artist", DbType.String, 0).Value = artist; command.Parameters.Add("@numplayed", DbType.Int32, 0).Value = defNumPlayed; - command.Parameters.Add("@dateadded", System.Data.DbType.Int64, 0).Value = DateTime.Now.Ticks; + command.Parameters.Add("@dateadded", DbType.Int64, 0).Value = DateTime.Now.Ticks; command.ExecuteNonQuery(); command.CommandText = "SELECT id FROM Songs WHERE [Title] = @title AND [Artist] = @artist"; @@ -388,7 +379,7 @@ namespace Vocaluxe.Base numPlayed = 0; dateAdded = String.Empty; - using (SQLiteConnection connection = new SQLiteConnection()) + using (var connection = new SQLiteConnection()) { connection.ConnectionString = "Data Source=" + filePath; @@ -401,7 +392,7 @@ namespace Vocaluxe.Base return false; } - using (SQLiteCommand command = new SQLiteCommand(connection)) + using (var command = new SQLiteCommand(connection)) { command.CommandText = "SELECT Artist, Title, NumPlayed, DateAdded FROM Songs WHERE [id] = @id"; command.Parameters.Add("@id", DbType.String, 0).Value = songID; @@ -460,7 +451,7 @@ namespace Vocaluxe.Base private static void _CreateHighscoreDB(string filePath) { - using (SQLiteConnection connection = new SQLiteConnection()) + using (var connection = new SQLiteConnection()) { connection.ConnectionString = "Data Source=" + filePath; @@ -473,7 +464,7 @@ namespace Vocaluxe.Base return; } - using (SQLiteCommand command = new SQLiteCommand(connection)) + using (var command = new SQLiteCommand(connection)) { command.CommandText = "CREATE TABLE IF NOT EXISTS Version ( id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, Value INTEGER NOT NULL);"; command.ExecuteNonQuery(); @@ -496,7 +487,7 @@ namespace Vocaluxe.Base private static void _CreateHighscoreDBV1(string filePath) { - using (SQLiteConnection connection = new SQLiteConnection()) + using (var connection = new SQLiteConnection()) { connection.ConnectionString = "Data Source=" + filePath; @@ -509,7 +500,7 @@ namespace Vocaluxe.Base return; } - using (SQLiteCommand command = new SQLiteCommand(connection)) + using (var command = new SQLiteCommand(connection)) { command.CommandText = "CREATE TABLE IF NOT EXISTS Version ( id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, Value INTEGER NOT NULL);"; command.ExecuteNonQuery(); @@ -536,7 +527,7 @@ namespace Vocaluxe.Base /// private static bool _CreateOrConvert(string filePath) { - using (SQLiteConnection connection = new SQLiteConnection()) + using (var connection = new SQLiteConnection()) { connection.ConnectionString = "Data Source=" + filePath; @@ -549,7 +540,7 @@ namespace Vocaluxe.Base return false; } - using (SQLiteCommand command = new SQLiteCommand(connection)) + using (var command = new SQLiteCommand(connection)) { command.CommandText = "PRAGMA user_version"; SQLiteDataReader reader = command.ExecuteReader(); @@ -646,7 +637,7 @@ namespace Vocaluxe.Base /// True if succeeded private static bool _ConvertFrom110(string filePath) { - using (SQLiteConnection connection = new SQLiteConnection()) + using (var connection = new SQLiteConnection()) { connection.ConnectionString = "Data Source=" + filePath; @@ -659,7 +650,7 @@ namespace Vocaluxe.Base return false; } - using (SQLiteCommand command = new SQLiteCommand(connection)) + using (var command = new SQLiteCommand(connection)) { //The USDX database has no column for LineNr, Medley and Duet so just fill 0 in there command.CommandText = @@ -669,8 +660,8 @@ namespace Vocaluxe.Base command.CommandText = "INSERT INTO Songs SELECT ID, Artist, Title, TimesPlayed from US_Songs"; command.ExecuteNonQuery(); - List scores = new List(); - List songs = new List(); + var scores = new List(); + var songs = new List(); command.CommandText = "SELECT id, PlayerName, Date FROM Scores"; SQLiteDataReader reader = command.ExecuteReader(); @@ -679,7 +670,7 @@ namespace Vocaluxe.Base { while (reader.Read()) { - SData data = new SData {Id = reader.GetInt32(0), Str1 = reader.GetString(1)}; + var data = new SData {Id = reader.GetInt32(0), Str1 = reader.GetString(1)}; Int64 ticks = 0; try @@ -703,7 +694,7 @@ namespace Vocaluxe.Base { while (reader.Read()) { - SData data = new SData {Id = reader.GetInt32(0), Str1 = reader.GetString(1), Str2 = reader.GetString(2)}; + var data = new SData {Id = reader.GetInt32(0), Str1 = reader.GetString(1), Str2 = reader.GetString(2)}; songs.Add(data); } } @@ -759,7 +750,7 @@ namespace Vocaluxe.Base /// True if succeeded private static bool _ConvertFrom101(string filePath) { - using (SQLiteConnection connection = new SQLiteConnection()) + using (var connection = new SQLiteConnection()) { connection.ConnectionString = "Data Source=" + filePath; @@ -772,7 +763,7 @@ namespace Vocaluxe.Base return false; } - using (SQLiteCommand command = new SQLiteCommand(connection)) + using (var command = new SQLiteCommand(connection)) { command.CommandText = "PRAGMA table_info(US_Scores);"; bool dateExists = false; @@ -803,8 +794,8 @@ namespace Vocaluxe.Base command.ExecuteNonQuery(); // convert from CP1252 to UTF8 - List scores = new List(); - List songs = new List(); + var scores = new List(); + var songs = new List(); Sqlite3.sqlite3 oldDB; int res = Sqlite3.sqlite3_open(filePath, out oldDB); @@ -813,7 +804,7 @@ namespace Vocaluxe.Base CLog.LogError("Error opening Database: " + filePath + " (" + Sqlite3.sqlite3_errmsg(oldDB) + ")"); else { - Sqlite3.Vdbe stmt = new Sqlite3.Vdbe(); + var stmt = new Sqlite3.Vdbe(); res = Sqlite3.sqlite3_prepare_v2(oldDB, "SELECT id, Artist, Title FROM Songs", -1, ref stmt, 0); if (res != Sqlite3.SQLITE_OK) @@ -826,7 +817,7 @@ namespace Vocaluxe.Base while (Sqlite3.sqlite3_step(stmt) == Sqlite3.SQLITE_ROW) { - SData data = new SData {Id = Sqlite3.sqlite3_column_int(stmt, 0)}; + var data = new SData {Id = Sqlite3.sqlite3_column_int(stmt, 0)}; byte[] bytes = Sqlite3.sqlite3_column_rawbytes(stmt, 1); data.Str1 = bytes != null ? utf8.GetString(Encoding.Convert(cp1252, utf8, bytes)) : "Someone"; @@ -858,7 +849,7 @@ namespace Vocaluxe.Base while (Sqlite3.sqlite3_step(stmt) == Sqlite3.SQLITE_ROW) { - SData data = new SData {Id = Sqlite3.sqlite3_column_int(stmt, 0)}; + var data = new SData {Id = Sqlite3.sqlite3_column_int(stmt, 0)}; byte[] bytes = Sqlite3.sqlite3_column_rawbytes(stmt, 1); data.Str1 = bytes != null ? utf8.GetString(Encoding.Convert(cp1252, utf8, bytes)) : "Someone"; @@ -918,20 +909,16 @@ namespace Vocaluxe.Base bool updated = true; if (currentVersion < 2) - { updated &= _ConvertV1toV2(connection); - } if (currentVersion < 3) - { updated &= _ConvertV2toV3(connection); - } return updated; } private static bool _ConvertV1toV2(SQLiteConnection connection) { - using (SQLiteCommand command = new SQLiteCommand(connection)) + using (var command = new SQLiteCommand(connection)) { command.CommandText = "ALTER TABLE Scores ADD ShortSong INTEGER"; command.ExecuteNonQuery(); @@ -948,17 +935,14 @@ namespace Vocaluxe.Base private static bool _ConvertV2toV3(SQLiteConnection connection) { - SQLiteCommand command; + var command = new SQLiteCommand(connection) {CommandText = "ALTER TABLE Songs ADD DateAdded BIGINT"}; - command = new SQLiteCommand(connection); - - command.CommandText = "ALTER TABLE Songs ADD DateAdded BIGINT"; command.ExecuteNonQuery(); command.CommandText = "UPDATE Songs SET [DateAdded] = @DateAdded"; - command.Parameters.Add("@DateAdded",System.Data.DbType.Int64, 0).Value = DateTime.Now.Ticks; + command.Parameters.Add("@DateAdded", DbType.Int64, 0).Value = DateTime.Now.Ticks; command.ExecuteNonQuery(); command.CommandText = "UPDATE Version SET [Value] = @version"; - command.Parameters.Add("@version", System.Data.DbType.Int32, 0).Value = 3; + command.Parameters.Add("@version", DbType.Int32, 0).Value = 3; command.ExecuteNonQuery(); command.Dispose(); @@ -968,7 +952,7 @@ namespace Vocaluxe.Base private static bool _ImportData(string sourceDBPath) { #region open db - using (SQLiteConnection connSource = new SQLiteConnection()) + using (var connSource = new SQLiteConnection()) { connSource.ConnectionString = "Data Source=" + sourceDBPath; @@ -983,7 +967,7 @@ namespace Vocaluxe.Base } #endregion open db - using (SQLiteCommand cmdSource = new SQLiteCommand(connSource)) + using (var cmdSource = new SQLiteCommand(connSource)) { #region import table scores cmdSource.CommandText = "SELECT SongID, PlayerName, Score, LineNr, Date, Medley, Duet, ShortSong, Difficulty FROM Scores"; @@ -1039,7 +1023,7 @@ namespace Vocaluxe.Base _ConnectionCover.Open(); } - using (SQLiteCommand command = new SQLiteCommand(_ConnectionCover)) + using (var command = new SQLiteCommand(_ConnectionCover)) { command.CommandText = "SELECT id, width, height FROM Cover WHERE [Path] = @path"; command.Parameters.Add("@path", DbType.String, 0).Value = coverPath; @@ -1097,7 +1081,7 @@ namespace Vocaluxe.Base else if (origin.Height > origin.Width && origin.Height > h) w = (int)Math.Round((float)h / origin.Height * origin.Width); - using (Bitmap bmp = new Bitmap(w, h)) + using (var bmp = new Bitmap(w, h)) { using (Graphics g = Graphics.FromImage(bmp)) g.DrawImage(origin, new Rectangle(0, 0, w, h)); @@ -1166,7 +1150,7 @@ namespace Vocaluxe.Base private static bool _InitCoverDB() { - using (SQLiteConnection connection = new SQLiteConnection()) + using (var connection = new SQLiteConnection()) { connection.ConnectionString = "Data Source=" + _CoverFilePath; @@ -1179,7 +1163,7 @@ namespace Vocaluxe.Base return false; } - using (SQLiteCommand command = new SQLiteCommand(connection)) + using (var command = new SQLiteCommand(connection)) { command.CommandText = "SELECT Value FROM Version"; @@ -1219,7 +1203,7 @@ namespace Vocaluxe.Base private static void _CreateCoverDB() { - using (SQLiteConnection connection = new SQLiteConnection()) + using (var connection = new SQLiteConnection()) { connection.ConnectionString = "Data Source=" + _CoverFilePath; @@ -1232,7 +1216,7 @@ namespace Vocaluxe.Base return; } - using (SQLiteCommand command = new SQLiteCommand(connection)) + using (var command = new SQLiteCommand(connection)) { command.CommandText = "CREATE TABLE IF NOT EXISTS Version ( id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, Value INTEGER NOT NULL);"; command.ExecuteNonQuery(); @@ -1258,7 +1242,7 @@ namespace Vocaluxe.Base { bool result = false; - using (SQLiteConnection connection = new SQLiteConnection()) + using (var connection = new SQLiteConnection()) { connection.ConnectionString = "Data Source=" + _CreditsRessourcesFilePath; try @@ -1269,7 +1253,7 @@ namespace Vocaluxe.Base { return false; } - using (SQLiteCommand command = new SQLiteCommand(connection)) + using (var command = new SQLiteCommand(connection)) { command.CommandText = "SELECT id, width, height FROM Images WHERE [Path] = @path"; command.Parameters.Add("@path", DbType.String, 0).Value = fileName; @@ -1391,7 +1375,7 @@ namespace Vocaluxe.Base private static bool _InitCreditsRessourcesDB() { - using (SQLiteConnection connection = new SQLiteConnection()) + using (var connection = new SQLiteConnection()) { connection.ConnectionString = "Data Source=" + _CreditsRessourcesFilePath; @@ -1404,7 +1388,7 @@ namespace Vocaluxe.Base return false; } - using (SQLiteCommand command = new SQLiteCommand(connection)) + using (var command = new SQLiteCommand(connection)) { command.CommandText = "SELECT Value FROM Version"; @@ -1484,14 +1468,14 @@ namespace Vocaluxe.Base private static byte[] _GetBytes(SQLiteDataReader reader) { const int chunkSize = 2 * 1024; - byte[] buffer = new byte[chunkSize]; + var buffer = new byte[chunkSize]; long fieldOffset = 0; - using (MemoryStream stream = new MemoryStream()) + using (var stream = new MemoryStream()) { long bytesRead; while ((bytesRead = reader.GetBytes(0, fieldOffset, buffer, 0, buffer.Length)) > 0) { - byte[] actualRead = new byte[bytesRead]; + var actualRead = new byte[bytesRead]; Buffer.BlockCopy(buffer, 0, actualRead, 0, (int)bytesRead); stream.Write(actualRead, 0, actualRead.Length); fieldOffset += bytesRead; @@ -1502,7 +1486,7 @@ namespace Vocaluxe.Base private static long _UnixTimeToTicks(int unixTime) { - DateTime t70 = new DateTime(1970, 1, 1, 0, 0, 0, 0); + var t70 = new DateTime(1970, 1, 1, 0, 0, 0, 0); t70 = t70.AddSeconds(unixTime); return t70.Ticks; } diff --git a/Vocaluxe/Base/CDraw.cs b/Vocaluxe/Base/CDraw.cs index 3969658a..cf945004 100644 --- a/Vocaluxe/Base/CDraw.cs +++ b/Vocaluxe/Base/CDraw.cs @@ -206,7 +206,7 @@ namespace Vocaluxe.Base if (texture == null) return; - RectangleF bounds = new RectangleF(staticBounds.Rect.X, staticBounds.Rect.Y, staticBounds.Rect.W, staticBounds.Rect.H); + var bounds = new RectangleF(staticBounds.Rect.X, staticBounds.Rect.Y, staticBounds.Rect.W, staticBounds.Rect.H); RectangleF rect; CHelper.SetRect(bounds, out rect, texture.OrigAspect, aspect); diff --git a/Vocaluxe/Base/CGraphics.cs b/Vocaluxe/Base/CGraphics.cs index f531a3c7..87164ab1 100644 --- a/Vocaluxe/Base/CGraphics.cs +++ b/Vocaluxe/Base/CGraphics.cs @@ -218,7 +218,7 @@ namespace Vocaluxe.Base if (_Fading) { - long fadeTime = (long)(CConfig.FadeTime * 1000); + var fadeTime = (long)(CConfig.FadeTime * 1000); if ((_FadingTimer.ElapsedMilliseconds < fadeTime) && (CConfig.FadeTime > 0)) { @@ -349,10 +349,10 @@ namespace Vocaluxe.Base #region private stuff private static bool _HandleInputs(CKeys keys, CMouse mouse) { - SKeyEvent keyEvent = new SKeyEvent(); - SMouseEvent mouseEvent = new SMouseEvent(); - SKeyEvent inputKeyEvent = new SKeyEvent(); - SMouseEvent inputMouseEvent = new SMouseEvent(); + var keyEvent = new SKeyEvent(); + var mouseEvent = new SMouseEvent(); + var inputKeyEvent = new SKeyEvent(); + var inputMouseEvent = new SMouseEvent(); bool popupPlayerControlAllowed = _CurrentScreen != EScreens.ScreenOptionsRecord && _CurrentScreen != EScreens.ScreenSing && (_CurrentScreen != EScreens.ScreenSong || @@ -541,8 +541,8 @@ namespace Vocaluxe.Base private static bool _HandleInputThemeEditor(CKeys keys, CMouse mouse) { - SKeyEvent keyEvent = new SKeyEvent(); - SMouseEvent mouseEvent = new SMouseEvent(); + var keyEvent = new SKeyEvent(); + var mouseEvent = new SMouseEvent(); while (keys.PollEvent(ref keyEvent)) { @@ -598,7 +598,7 @@ namespace Vocaluxe.Base if (CConfig.DebugLevel == EDebugLevel.TR_CONFIG_OFF) return; - List debugOutput = new List {CTime.GetFPS().ToString("FPS: 000")}; + var debugOutput = new List {CTime.GetFPS().ToString("FPS: 000")}; if (CConfig.DebugLevel >= EDebugLevel.TR_CONFIG_LEVEL1) { @@ -627,11 +627,11 @@ namespace Vocaluxe.Base CFonts.Style = EStyle.Normal; CFonts.SetFont("Normal"); CFonts.Height = 25; - SColorF gray = new SColorF(1f, 1f, 1f, 0.5f); + var gray = new SColorF(1f, 1f, 1f, 0.5f); float y = 0; foreach (string txt in debugOutput) { - RectangleF rect = new RectangleF(CSettings.RenderW - CFonts.GetTextWidth(txt), y, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt)); + var 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)); CFonts.DrawText(txt, rect.X, rect.Y, CSettings.ZNear); y += rect.Height; diff --git a/Vocaluxe/Base/CLanguage.cs b/Vocaluxe/Base/CLanguage.cs index ede9e021..d0a1dd9b 100644 --- a/Vocaluxe/Base/CLanguage.cs +++ b/Vocaluxe/Base/CLanguage.cs @@ -66,7 +66,7 @@ namespace Vocaluxe.Base public static IEnumerable GetLanguageNames() { - string[] languages = new string[_Languages.Count]; + var languages = new string[_Languages.Count]; for (int i = 0; i < _Languages.Count; i++) languages[i] = _Languages[i].Name; @@ -81,7 +81,7 @@ namespace Vocaluxe.Base _Settings.Encoding = Encoding.UTF8; _Settings.ConformanceLevel = ConformanceLevel.Document; - List files = new List(); + var files = new List(); files.AddRange(CHelper.ListFiles(CSettings.FolderLanguages, "*.xml", true, true)); foreach (string file in files) @@ -166,7 +166,7 @@ namespace Vocaluxe.Base public static bool LoadPartyLanguageFiles(int partyModeID, string path) { - List files = new List(); + var files = new List(); files.AddRange(CHelper.ListFiles(path, "*.xml", true, true)); return files.All(file => _LoadPartyLanguageFile(partyModeID, file)); @@ -208,7 +208,7 @@ namespace Vocaluxe.Base if (nr == -1) return true; - SPartyLanguage lang = new SPartyLanguage {PartyModeID = partyModeID}; + var lang = new SPartyLanguage {PartyModeID = partyModeID}; if (!_LoadLanguageEntries(xmlReader, out lang.Texts)) return false; @@ -221,7 +221,7 @@ namespace Vocaluxe.Base private static void _LoadLanguageFile(string fileName) { - SLanguage lang = new SLanguage {LanguageFilePath = Path.Combine(CSettings.FolderLanguages, fileName)}; + var lang = new SLanguage {LanguageFilePath = Path.Combine(CSettings.FolderLanguages, fileName)}; CXMLReader xmlReader = CXMLReader.OpenFile(lang.LanguageFilePath); if (xmlReader == null) diff --git a/Vocaluxe/Base/CParty.cs b/Vocaluxe/Base/CParty.cs index 32b283c8..45f0cec9 100644 --- a/Vocaluxe/Base/CParty.cs +++ b/Vocaluxe/Base/CParty.cs @@ -304,7 +304,7 @@ namespace Vocaluxe.Base pm.PartyMode.Initialize(); pm.PartyMode.SetFolder(Path.Combine(Directory.GetCurrentDirectory(), Path.Combine(CSettings.FolderPartyModes, pm.Folder))); - if (!CTheme.AddTheme(Path.Combine(pm.PartyMode.GetFolder(), "Theme.xml"),pm.PartyModeID)) + if (!CTheme.AddTheme(Path.Combine(pm.PartyMode.GetFolder(), "Theme.xml"), pm.PartyModeID)) return pm; int themeIndex = CTheme.GetThemeIndex(pm.PartyModeID); diff --git a/Vocaluxe/Base/CProfiles.cs b/Vocaluxe/Base/CProfiles.cs index 005eefe3..91474e96 100644 --- a/Vocaluxe/Base/CProfiles.cs +++ b/Vocaluxe/Base/CProfiles.cs @@ -179,7 +179,7 @@ namespace Vocaluxe.Base if (_ProfileChangedCallbacks.Count == 0) return; - EProfileChangedFlags flags = EProfileChangedFlags.None; + var flags = EProfileChangedFlags.None; if (_AvatarsChanged) flags = EProfileChangedFlags.Avatar; @@ -214,7 +214,7 @@ namespace Vocaluxe.Base public static void LoadProfiles() { - SChange change = new SChange {Action = EAction.LoadProfiles}; + var change = new SChange {Action = EAction.LoadProfiles}; lock (_QueueMutex) { @@ -224,7 +224,7 @@ namespace Vocaluxe.Base public static void LoadAvatars() { - SChange change = new SChange {Action = EAction.LoadAvatars}; + var change = new SChange {Action = EAction.LoadAvatars}; lock (_QueueMutex) { @@ -237,7 +237,7 @@ namespace Vocaluxe.Base if (newProfile == null) return; - SChange change = new SChange {Action = EAction.AddProfile, Profile = newProfile}; + var change = new SChange {Action = EAction.AddProfile, Profile = newProfile}; lock (_QueueMutex) { @@ -250,7 +250,7 @@ namespace Vocaluxe.Base if (editProfile == null) return; - SChange change = new SChange {Action = EAction.EditProfile, Profile = editProfile}; + var change = new SChange {Action = EAction.EditProfile, Profile = editProfile}; lock (_QueueMutex) { @@ -263,7 +263,7 @@ namespace Vocaluxe.Base if (!IsProfileIDValid(profileID)) return; - SChange change = new SChange {Action = EAction.DeleteProfile, ProfileID = profileID}; + var change = new SChange {Action = EAction.DeleteProfile, ProfileID = profileID}; lock (_QueueMutex) { @@ -276,7 +276,7 @@ namespace Vocaluxe.Base if (newAvatar == null) return; - SChange change = new SChange {Action = EAction.AddAvatar, Avatar = newAvatar}; + var change = new SChange {Action = EAction.AddAvatar, Avatar = newAvatar}; lock (_QueueMutex) { @@ -289,7 +289,7 @@ namespace Vocaluxe.Base if (editAvatar == null) return; - SChange change = new SChange {Action = EAction.EditAvatar, Avatar = editAvatar}; + var change = new SChange {Action = EAction.EditAvatar, Avatar = editAvatar}; lock (_QueueMutex) { @@ -302,7 +302,7 @@ namespace Vocaluxe.Base if (_Profiles.Count == 0) return null; - List list = new List(_Profiles.Values); + var list = new List(_Profiles.Values); list.Sort(_CompareByPlayerName); return list.ToArray(); } @@ -312,7 +312,7 @@ namespace Vocaluxe.Base if (_Avatars.Count == 0) return null; - CAvatar[] result = new CAvatar[_Avatars.Count]; + var result = new CAvatar[_Avatars.Count]; _Avatars.Values.CopyTo(result, 0); return result; @@ -320,7 +320,7 @@ namespace Vocaluxe.Base public static int NewProfile(string fileName = "") { - CProfile profile = new CProfile + var profile = new CProfile { FileName = fileName != "" ? Path.Combine(CSettings.FolderProfiles, fileName) : String.Empty }; @@ -336,7 +336,7 @@ namespace Vocaluxe.Base public static int NewAvatar(string fileName) { - CAvatar avatar = new CAvatar(-1); + var avatar = new CAvatar(-1); if (!avatar.LoadFromFile(fileName)) return -1; @@ -511,10 +511,10 @@ namespace Vocaluxe.Base { _LoadAvatars(); - List knownFiles = new List(); + var knownFiles = new List(); if (_Profiles.Count > 0) { - int[] ids = new int[_Profiles.Keys.Count]; + var ids = new int[_Profiles.Keys.Count]; _Profiles.Keys.CopyTo(ids, 0); foreach (int id in ids) { @@ -528,7 +528,7 @@ namespace Vocaluxe.Base } } - List files = new List(); + var files = new List(); files.AddRange(CHelper.ListFiles(CSettings.FolderProfiles, "*.xml", true, true)); foreach (string file in files) @@ -536,7 +536,7 @@ namespace Vocaluxe.Base if (knownFiles.Contains(Path.GetFileName(file))) continue; - CProfile profile = new CProfile + var profile = new CProfile { FileName = Path.Combine(CSettings.FolderProfiles, file) }; @@ -553,10 +553,10 @@ namespace Vocaluxe.Base private static void _LoadAvatars() { - List knownFiles = new List(); + var knownFiles = new List(); if (_Avatars.Count > 0) { - int[] ids = new int[_Avatars.Keys.Count]; + var ids = new int[_Avatars.Keys.Count]; _Avatars.Keys.CopyTo(ids, 0); foreach (int id in ids) { @@ -567,7 +567,7 @@ namespace Vocaluxe.Base } } - List files = new List(); + var files = new List(); files.AddRange(CHelper.ListFiles(CSettings.FolderProfiles, "*.png", true, true)); files.AddRange(CHelper.ListFiles(CSettings.FolderProfiles, "*.jpg", true, true)); files.AddRange(CHelper.ListFiles(CSettings.FolderProfiles, "*.jpeg", true, true)); @@ -578,7 +578,7 @@ namespace Vocaluxe.Base if (knownFiles.Contains(Path.GetFileName(file))) continue; - CAvatar avatar = new CAvatar(-1); + var avatar = new CAvatar(-1); if (avatar.LoadFromFile(file)) { avatar.ID = _AvatarIDs.Dequeue(); diff --git a/Vocaluxe/Base/CSettings.cs b/Vocaluxe/Base/CSettings.cs index 71cfd196..c4cb68c6 100644 --- a/Vocaluxe/Base/CSettings.cs +++ b/Vocaluxe/Base/CSettings.cs @@ -209,7 +209,7 @@ namespace Vocaluxe.Base public static void CreateFolders() { - List folders = new List {FolderCover, FolderFonts, FolderProfiles, FolderSongs, FolderScreenshots, FolderBackgroundMusic, FolderSounds, FolderPlaylists}; + var folders = new List {FolderCover, FolderFonts, FolderProfiles, FolderSongs, FolderScreenshots, FolderBackgroundMusic, FolderSounds, FolderPlaylists}; foreach (string folder in folders) { @@ -224,4 +224,4 @@ namespace Vocaluxe.Base Directory.CreateDirectory(path); } } -} +} \ No newline at end of file diff --git a/Vocaluxe/Base/CSongSorter.cs b/Vocaluxe/Base/CSongSorter.cs index 1c427fcf..f9921bdd 100644 --- a/Vocaluxe/Base/CSongSorter.cs +++ b/Vocaluxe/Base/CSongSorter.cs @@ -114,7 +114,7 @@ namespace Vocaluxe.Base private List _CreateSortList(string fieldName) { - List sortList = new List(); + var sortList = new List(); if (fieldName == "") CSongs.Filter.FilteredSongs.ForEach(song => sortList.Add(new CSongPointer(song.ID, ""))); else @@ -135,7 +135,7 @@ namespace Vocaluxe.Base sortList.Add(new CSongPointer(song.ID, (String)value)); else { - List values = (List)value; + var values = (List)value; if (values.Count == 0) sortList.Add(new CSongPointer(song.ID, "")); else diff --git a/Vocaluxe/Base/CSongs.cs b/Vocaluxe/Base/CSongs.cs index 05f7ac31..280fcb7d 100644 --- a/Vocaluxe/Base/CSongs.cs +++ b/Vocaluxe/Base/CSongs.cs @@ -251,7 +251,7 @@ namespace Vocaluxe.Base { get { - List songs = new List(); + var songs = new List(); if (_IsCatIndexValid(_CatIndex)) { // ReSharper disable LoopCanBeConvertedToQuery @@ -298,7 +298,7 @@ namespace Vocaluxe.Base _Songs.Clear(); CLog.StartBenchmark(2, "List Songs"); - List files = new List(); + var files = new List(); foreach (string p in CConfig.SongFolder) { string path = p; diff --git a/Vocaluxe/Base/CSound.cs b/Vocaluxe/Base/CSound.cs index a4dc3e5b..97558342 100644 --- a/Vocaluxe/Base/CSound.cs +++ b/Vocaluxe/Base/CSound.cs @@ -450,11 +450,11 @@ namespace Vocaluxe.Base int len = _AnalysisBuffer.Length * 2; if (_Stream.Length >= len) { - byte[] buf = new byte[len]; + var buf = new byte[len]; _Stream.Position -= len; _Stream.Read(buf, 0, len); - byte[] b = new byte[2]; + var b = new byte[2]; for (int i = 0; i < _AnalysisBuffer.Length; i++) { b[0] = buf[i * 2]; @@ -496,7 +496,7 @@ namespace Vocaluxe.Base double maxWeight = -1.0; double minWeight = 1.0; int maxTone = -1; - float[] weigth = new float[_NumHalfTones]; + var weigth = new float[_NumHalfTones]; // analyze halftones // Note: at the lowest tone (~65Hz) and a buffer-size of 4096 @@ -535,7 +535,7 @@ namespace Vocaluxe.Base private double _AnalyzeAutocorrelationFreq(double freq) { int sampleIndex = 0; // index of sample to analyze - int samplesPerPeriod = (int)Math.Round(44100.0 / freq); // samples in one period + var samplesPerPeriod = (int)Math.Round(44100.0 / freq); // samples in one period int correlatingSampleIndex = sampleIndex + samplesPerPeriod; // index of sample one period ahead double accumDist = 0.0; // accumulated distances diff --git a/Vocaluxe/Base/CVideo.cs b/Vocaluxe/Base/CVideo.cs index 031bc6b6..24104123 100644 --- a/Vocaluxe/Base/CVideo.cs +++ b/Vocaluxe/Base/CVideo.cs @@ -168,7 +168,7 @@ namespace Vocaluxe.Base } if (_VideoTexture == null) return; - RectangleF bounds = new RectangleF(0f, 0f, CSettings.RenderW, CSettings.RenderH); + var bounds = new RectangleF(0f, 0f, CSettings.RenderW, CSettings.RenderH); RectangleF rect; CHelper.SetRect(bounds, out rect, _VideoTexture.OrigAspect, EAspect.Crop); diff --git a/Vocaluxe/Base/Fonts/CFonts.cs b/Vocaluxe/Base/Fonts/CFonts.cs index 1de2f929..18b1d61c 100644 --- a/Vocaluxe/Base/Fonts/CFonts.cs +++ b/Vocaluxe/Base/Fonts/CFonts.cs @@ -258,8 +258,8 @@ namespace Vocaluxe.Base.Fonts Height = height; SetFont(text.Font); Style = text.Style; - RectangleF result = new RectangleF(text.X, text.Y, GetTextWidth(CLanguage.Translate(text.Text, text.TranslationID)), - GetTextHeight(CLanguage.Translate(text.Text, text.TranslationID))); + var result = new RectangleF(text.X, text.Y, GetTextWidth(CLanguage.Translate(text.Text, text.TranslationID)), + GetTextHeight(CLanguage.Translate(text.Text, text.TranslationID))); //restore old values Height = oldHeight; _CurrentFont = oldFont; @@ -286,7 +286,7 @@ namespace Vocaluxe.Base.Fonts int i = 1; while (xmlReader.GetValue("//root/Fonts/Font" + i + "/Folder", out value, value)) { - SFont sf = new SFont {Folder = value, IsThemeFont = themeName != "", ThemeName = themeName, PartyModeID = partyModeId}; + var sf = new SFont {Folder = value, IsThemeFont = themeName != "", ThemeName = themeName, PartyModeID = partyModeId}; bool ok = true; @@ -297,7 +297,7 @@ namespace Vocaluxe.Base.Fonts ok &= xmlReader.GetValue("//root/Fonts/Font" + i + "/FileNormal", out value, value); sf.FileNormal = value; value = Path.Combine(fontFolder, Path.Combine(sf.Folder, value)); - CFont f = new CFont(value); + var f = new CFont(value); sf.Normal = f; ok &= xmlReader.GetValue("//root/Fonts/Font" + i + "/FileItalic", out value, value); diff --git a/Vocaluxe/Base/Server/CCommands.cs b/Vocaluxe/Base/Server/CCommands.cs index 6c04e92c..162b4a76 100644 --- a/Vocaluxe/Base/Server/CCommands.cs +++ b/Vocaluxe/Base/Server/CCommands.cs @@ -1,4 +1,23 @@ -using System; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System; using System.IO; using System.Text; using System.Security.Cryptography; diff --git a/Vocaluxe/Base/Server/VocaluxeStructs.cs b/Vocaluxe/Base/Server/VocaluxeStructs.cs index ae5fd5cf..90a294a9 100644 --- a/Vocaluxe/Base/Server/VocaluxeStructs.cs +++ b/Vocaluxe/Base/Server/VocaluxeStructs.cs @@ -1,4 +1,23 @@ -namespace Vocaluxe.Base.Server +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +namespace Vocaluxe.Base.Server { public struct SLoginData { diff --git a/Vocaluxe/GameModes/CGameModes.cs b/Vocaluxe/GameModes/CGameModes.cs index 5090ff44..4dfc2585 100644 --- a/Vocaluxe/GameModes/CGameModes.cs +++ b/Vocaluxe/GameModes/CGameModes.cs @@ -70,7 +70,7 @@ namespace Vocaluxe.GameModes { protected override CSong _PrepareSong(CSong song) { - CSong newSong = new CSong(song) {Finish = CGame.GetTimeFromBeats(song.ShortEnd, song.BPM) + CSettings.DefaultMedleyFadeOutTime + song.Gap}; + var newSong = new CSong(song) {Finish = CGame.GetTimeFromBeats(song.ShortEnd, song.BPM) + CSettings.DefaultMedleyFadeOutTime + song.Gap}; // set lines to short mode newSong.Notes.SetMedley(song.Notes.GetVoice(0).Lines[0].FirstNoteBeat, song.ShortEnd); @@ -82,7 +82,7 @@ namespace Vocaluxe.GameModes { protected override CSong _PrepareSong(CSong song) { - CSong newSong = new CSong(song) {Start = CGame.GetTimeFromBeats(song.Medley.StartBeat, song.BPM) - song.Medley.FadeInTime + song.Gap}; + var newSong = new CSong(song) {Start = CGame.GetTimeFromBeats(song.Medley.StartBeat, song.BPM) - song.Medley.FadeInTime + song.Gap}; if (newSong.Start < 0f) newSong.Start = 0f; diff --git a/Vocaluxe/Lib/Draw/CDirect3D.cs b/Vocaluxe/Lib/Draw/CDirect3D.cs index 0e104ee1..6ab00e27 100644 --- a/Vocaluxe/Lib/Draw/CDirect3D.cs +++ b/Vocaluxe/Lib/Draw/CDirect3D.cs @@ -448,7 +448,7 @@ namespace Vocaluxe.Lib.Draw if (_Device.SetTextureStageState(0, TextureStage.AlphaOperation, TextureOperation.Modulate).IsFailure) CLog.LogError("Failed to set alpha operation"); - Int16[] indices = new Int16[6]; + var indices = new Int16[6]; indices[0] = 0; indices[1] = 1; indices[2] = 2; @@ -465,7 +465,7 @@ namespace Vocaluxe.Lib.Draw //This creates a new white texture and adds it to the texture pool //This texture is used for the DrawRect method - using (Bitmap blankMap = new Bitmap(1, 1)) + using (var blankMap = new Bitmap(1, 1)) { Graphics g = Graphics.FromImage(blankMap); g.Clear(Color.White); @@ -674,7 +674,7 @@ namespace Vocaluxe.Lib.Draw CTexture texture = _GetNewTexture(_W, _H); Surface backbufferSurface = _Device.GetBackBuffer(0, 0); - Texture tex = new Texture(_Device, texture.W2, texture.H2, 0, Usage.AutoGenerateMipMap, Format.A8R8G8B8, Pool.Managed); + var tex = new Texture(_Device, texture.W2, texture.H2, 0, Usage.AutoGenerateMipMap, Format.A8R8G8B8, Pool.Managed); Surface textureSurface = tex.GetSurfaceLevel(0); Surface.FromSurface(textureSurface, backbufferSurface, Filter.Default, 0, new Rectangle(0, 0, _W, _H), new Rectangle(0, 0, _W, _H)); backbufferSurface.Dispose(); @@ -722,7 +722,7 @@ namespace Vocaluxe.Lib.Draw //create a surface of the frame using (Surface surface = _Device.GetBackBuffer(0, 0)) { - Bitmap screen = new Bitmap(Surface.ToStream(surface, ImageFileFormat.Bmp)); + var screen = new Bitmap(Surface.ToStream(surface, ImageFileFormat.Bmp)); screen.Save(Path.Combine(path, file + i.ToString("00000") + ".bmp"), ImageFormat.Bmp); screen.Dispose(); } @@ -742,8 +742,8 @@ namespace Vocaluxe.Lib.Draw /// The end y-value public void DrawLine(int a, int r, int g, int b, int w, int x1, int y1, int x2, int y2) { - Vector2[] lineVector = new Vector2[] {new Vector2(x1, y1), new Vector2(x2, y2)}; - using (Line line = new Line(_Device)) + var lineVector = new Vector2[] {new Vector2(x1, y1), new Vector2(x2, y2)}; + using (var line = new Line(_Device)) { line.Antialias = true; line.Begin(); @@ -850,7 +850,7 @@ namespace Vocaluxe.Lib.Draw w = _CheckForNextPowerOf2(w); h = _CheckForNextPowerOf2(h); - CTexture texture = new CTexture(bmp.Width, bmp.Height, w, h, true); + var texture = new CTexture(bmp.Width, bmp.Height, w, h, true); Bitmap bmp2 = null; byte[] data; @@ -907,7 +907,7 @@ namespace Vocaluxe.Lib.Draw { //Create a new texture in the managed pool, which does not need to be recreated on a lost device //because a copy of the texture is hold in the Ram - Texture t = new Texture(_Device, textureW, textureH, 0, Usage.AutoGenerateMipMap, Format.A8R8G8B8, Pool.Managed); + var t = new Texture(_Device, textureW, textureH, 0, Usage.AutoGenerateMipMap, Format.A8R8G8B8, Pool.Managed); _WriteDataToTexture(t, w, data); return t; } @@ -939,7 +939,7 @@ namespace Vocaluxe.Lib.Draw { texture.ID = _IDs.Dequeue(); _D3DTextures.Add(texture.ID, null); - STextureQueue queue = new STextureQueue(texture.ID, texture.W2, texture.H2, w, h, data); + var queue = new STextureQueue(texture.ID, texture.W2, texture.H2, w, h, data); _TexturesToLoad.Enqueue(queue); } return texture; @@ -1122,7 +1122,7 @@ namespace Vocaluxe.Lib.Draw if (!mirrored) { - STexturedColoredVertex[] vert = new STexturedColoredVertex[4]; + var vert = new STexturedColoredVertex[4]; vert[0] = new STexturedColoredVertex(new Vector3(rx1, -ry1, rect.Z + CGraphics.ZOffset), new Vector2(x1, y1), c.ToArgb()); vert[1] = new STexturedColoredVertex(new Vector3(rx1, -ry2, rect.Z + CGraphics.ZOffset), new Vector2(x1, y2), c.ToArgb()); vert[2] = new STexturedColoredVertex(new Vector3(rx2, -ry2, rect.Z + CGraphics.ZOffset), new Vector2(x2, y2), c.ToArgb()); @@ -1131,7 +1131,7 @@ namespace Vocaluxe.Lib.Draw } else { - STexturedColoredVertex[] vert = new STexturedColoredVertex[4]; + var vert = new STexturedColoredVertex[4]; vert[0] = new STexturedColoredVertex(new Vector3(rx1, -ry1, rect.Z + CGraphics.ZOffset), new Vector2(x1, -y1), c.ToArgb()); vert[1] = new STexturedColoredVertex(new Vector3(rx1, -ry2, rect.Z + CGraphics.ZOffset), new Vector2(x1, -y2), c.ToArgb()); vert[2] = new STexturedColoredVertex(new Vector3(rx2, -ry2, rect.Z + CGraphics.ZOffset), new Vector2(x2, -y2), c.ToArgb()); @@ -1175,7 +1175,7 @@ namespace Vocaluxe.Lib.Draw Color c = color.AsColor(); - STexturedColoredVertex[] vert = new STexturedColoredVertex[4]; + var vert = new STexturedColoredVertex[4]; vert[0] = new STexturedColoredVertex(new Vector3(rx1, -ry1, rect.Z + CGraphics.ZOffset), new Vector2(x1, y1), c.ToArgb()); vert[1] = new STexturedColoredVertex(new Vector3(rx1, -ry2, rect.Z + CGraphics.ZOffset), new Vector2(x1, y2), c.ToArgb()); vert[2] = new STexturedColoredVertex(new Vector3(rx2, -ry2, rect.Z + CGraphics.ZOffset), new Vector2(x2, y2), c.ToArgb()); @@ -1258,7 +1258,7 @@ namespace Vocaluxe.Lib.Draw color.A = 0; Color transparent = color.AsColor(); - STexturedColoredVertex[] vert = new STexturedColoredVertex[4]; + var vert = new STexturedColoredVertex[4]; vert[0] = new STexturedColoredVertex(new Vector3(rx1, -ry1, rect.Z + CGraphics.ZOffset), new Vector2(x1, y2), c.ToArgb()); vert[1] = new STexturedColoredVertex(new Vector3(rx1, -ry2, rect.Z + CGraphics.ZOffset), new Vector2(x1, y1), transparent.ToArgb()); vert[2] = new STexturedColoredVertex(new Vector3(rx2, -ry2, rect.Z + CGraphics.ZOffset), new Vector2(x2, y1), transparent.ToArgb()); diff --git a/Vocaluxe/Lib/Draw/CDrawWinForm.cs b/Vocaluxe/Lib/Draw/CDrawWinForm.cs index 0c0c9ac1..c913faf7 100644 --- a/Vocaluxe/Lib/Draw/CDrawWinForm.cs +++ b/Vocaluxe/Lib/Draw/CDrawWinForm.cs @@ -289,7 +289,7 @@ namespace Vocaluxe.Lib.Draw public CTexture CopyScreen() { - Bitmap bmp = new Bitmap(_Backbuffer); + var bmp = new Bitmap(_Backbuffer); _Bitmaps.Add(bmp); CTexture texture = _GetNewTexture(bmp.Width, bmp.Height); @@ -333,7 +333,7 @@ namespace Vocaluxe.Lib.Draw public CTexture AddTexture(Bitmap bmp) { - Bitmap bmp2 = new Bitmap(bmp); + var bmp2 = new Bitmap(bmp); _Bitmaps.Add(bmp2); CTexture texture = _GetNewTexture(bmp.Width, bmp.Height); @@ -357,7 +357,7 @@ namespace Vocaluxe.Lib.Draw if (tex.TexturePath == texturePath) return tex; } - using (Bitmap bmp = new Bitmap(texturePath)) + using (var bmp = new Bitmap(texturePath)) { CTexture texture = AddTexture(bmp); texture.TexturePath = texturePath; @@ -389,7 +389,7 @@ namespace Vocaluxe.Lib.Draw public CTexture AddTexture(int w, int h, byte[] data) { - using (Bitmap bmp = new Bitmap(w, h)) + using (var bmp = new Bitmap(w, h)) { BitmapData bmpData = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb); Marshal.Copy(data, 0, bmpData.Scan0, data.Length); @@ -459,13 +459,13 @@ namespace Vocaluxe.Lib.Draw private static Bitmap _ColorizeBitmap(Bitmap original, SColorF color) { - Bitmap newBitmap = new Bitmap(original.Width, original.Height); + var newBitmap = new Bitmap(original.Width, original.Height); using (Graphics g = Graphics.FromImage(newBitmap)) { - ColorMatrix cm = new ColorMatrix {Matrix33 = color.A, Matrix00 = color.R, Matrix11 = color.G, Matrix22 = color.B, Matrix44 = 1}; + var cm = new ColorMatrix {Matrix33 = color.A, Matrix00 = color.R, Matrix11 = color.G, Matrix22 = color.B, Matrix44 = 1}; - using (ImageAttributes ia = new ImageAttributes()) + using (var ia = new ImageAttributes()) { ia.SetColorMatrix(cm); diff --git a/Vocaluxe/Lib/Draw/COpenGL.cs b/Vocaluxe/Lib/Draw/COpenGL.cs index e2cc99d8..737b9ceb 100644 --- a/Vocaluxe/Lib/Draw/COpenGL.cs +++ b/Vocaluxe/Lib/Draw/COpenGL.cs @@ -124,7 +124,7 @@ namespace Vocaluxe.Lib.Draw bool ok = false; try { - GraphicsMode gm = new GraphicsMode(32, 24, 0, (int)CConfig.AAMode); + var gm = new GraphicsMode(32, 24, 0, (int)CConfig.AAMode); _Control = new GLControl(gm, 2, 1, GraphicsContextFlags.Default); if (_Control.GraphicsMode != null) ok = true; @@ -473,7 +473,7 @@ namespace Vocaluxe.Lib.Draw Close(); } catch {} - CTexture[] textures = new CTexture[_Textures.Count]; + var textures = new CTexture[_Textures.Count]; _Textures.Values.CopyTo(textures, 0); for (int i = 0; i < _Textures.Count; i++) RemoveTexture(ref textures[i]); @@ -552,7 +552,7 @@ namespace Vocaluxe.Lib.Draw int width = GetScreenWidth(); int height = GetScreenHeight(); - using (Bitmap screen = new Bitmap(width, height)) + using (var screen = new Bitmap(width, height)) { BitmapData bmpData = screen.LockBits(new Rectangle(0, 0, width, height), ImageLockMode.WriteOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb); @@ -707,7 +707,7 @@ namespace Vocaluxe.Lib.Draw w = MathHelper.NextPowerOfTwo(w); h = MathHelper.NextPowerOfTwo(h); - CTexture texture = new CTexture(bmp.Width, bmp.Height, w, h, true) {Name = GL.GenTexture()}; + var texture = new CTexture(bmp.Width, bmp.Height, w, h, true) {Name = GL.GenTexture()}; GL.BindTexture(TextureTarget.Texture2D, texture.Name); Bitmap bmp2 = null; @@ -813,7 +813,7 @@ namespace Vocaluxe.Lib.Draw lock (_MutexTexture) { texture.ID = _IDs.Dequeue(); - STextureQueue queue = new STextureQueue(texture.ID, texture.W2, texture.H2, w, h, data); + var queue = new STextureQueue(texture.ID, texture.W2, texture.H2, w, h, data); _TexturesToLoad.Enqueue(queue); _Textures[texture.ID] = texture; } diff --git a/Vocaluxe/Lib/Input/WiiMote/CWiiMote.cs b/Vocaluxe/Lib/Input/WiiMote/CWiiMote.cs index 6fffb49c..2961172c 100644 --- a/Vocaluxe/Lib/Input/WiiMote/CWiiMote.cs +++ b/Vocaluxe/Lib/Input/WiiMote/CWiiMote.cs @@ -204,7 +204,7 @@ namespace Vocaluxe.Lib.Input.WiiMote bool lb = false; bool rb = gesture == EGesture.Back; - Keys key = Keys.None; + var key = Keys.None; if (ws.ButtonState.A && !_ButtonStates[0]) lb = true; @@ -246,7 +246,7 @@ namespace Vocaluxe.Lib.Input.WiiMote if (key != Keys.None) { - SKeyEvent pool = new SKeyEvent(ESender.WiiMote, false, false, false, false, char.MinValue, key); + var pool = new SKeyEvent(ESender.WiiMote, false, false, false, false, char.MinValue, key); lock (_KeyCopyLock) { @@ -260,8 +260,8 @@ namespace Vocaluxe.Lib.Input.WiiMote float rx = ((p.X / 1024f) - reducing) * factor; float ry = ((p.Y / 768f) - reducing) * factor; - int x = (int)(rx * CSettings.RenderW); - int y = (int)(ry * CSettings.RenderH); + var x = (int)(rx * CSettings.RenderW); + var y = (int)(ry * CSettings.RenderH); bool lbh = !lb && ws.ButtonState.A; @@ -272,7 +272,7 @@ namespace Vocaluxe.Lib.Input.WiiMote if (gesture == EGesture.ScrollDown) wheel = 1; - SMouseEvent mpool = new SMouseEvent(); + var mpool = new SMouseEvent(); bool trigger = false; if (!lb && !rb && (p.X != _OldPosition.X || p.Y != _OldPosition.Y)) diff --git a/Vocaluxe/Lib/Input/WiiMote/WiiMoteLib.cs b/Vocaluxe/Lib/Input/WiiMote/WiiMoteLib.cs index b4e234c9..be556efd 100644 --- a/Vocaluxe/Lib/Input/WiiMote/WiiMoteLib.cs +++ b/Vocaluxe/Lib/Input/WiiMote/WiiMoteLib.cs @@ -320,7 +320,7 @@ namespace Vocaluxe.Lib.Input.WiiMote if (_Handle != IntPtr.Zero && Connected) { - byte[] buff = new byte[_ReportLength]; + var buff = new byte[_ReportLength]; try { @@ -348,7 +348,7 @@ namespace Vocaluxe.Lib.Input.WiiMote return false; } - EInputReport type = (EInputReport)buff[0]; + var type = (EInputReport)buff[0]; switch (type) { diff --git a/Vocaluxe/Lib/Playlist/CPlaylistFile.cs b/Vocaluxe/Lib/Playlist/CPlaylistFile.cs index ddf4849e..e1def3bc 100644 --- a/Vocaluxe/Lib/Playlist/CPlaylistFile.cs +++ b/Vocaluxe/Lib/Playlist/CPlaylistFile.cs @@ -147,7 +147,7 @@ namespace Vocaluxe.Lib.Playlist Songs = new List(); List songs = xmlReader.GetValues("Songs"); - EGameMode gm = EGameMode.TR_GAMEMODE_NORMAL; + var gm = EGameMode.TR_GAMEMODE_NORMAL; foreach (string song in songs) { @@ -157,7 +157,7 @@ namespace Vocaluxe.Lib.Playlist xmlReader.GetValue("//root/Songs/" + song + "/Title", out title, String.Empty); xmlReader.TryGetEnumValue("//root/Songs/" + song + "/GameMode", ref gm); - CPlaylistSong playlistSong = new CPlaylistSong {SongID = -1}; + var playlistSong = new CPlaylistSong {SongID = -1}; foreach (CSong curSong in CSongs.AllSongs) { @@ -182,14 +182,14 @@ namespace Vocaluxe.Lib.Playlist public void AddSong(int songID) { - CPlaylistSong song = new CPlaylistSong {SongID = songID, GameMode = CSongs.GetSong(songID).IsDuet ? EGameMode.TR_GAMEMODE_DUET : EGameMode.TR_GAMEMODE_NORMAL}; + var song = new CPlaylistSong {SongID = songID, GameMode = CSongs.GetSong(songID).IsDuet ? EGameMode.TR_GAMEMODE_DUET : EGameMode.TR_GAMEMODE_NORMAL}; Songs.Add(song); } public void AddSong(int songID, EGameMode gm) { - CPlaylistSong song = new CPlaylistSong {SongID = songID, GameMode = gm}; + var song = new CPlaylistSong {SongID = songID, GameMode = gm}; Songs.Add(song); } @@ -216,7 +216,7 @@ namespace Vocaluxe.Lib.Playlist if (sourceNr < 0 || destNr < 0 || sourceNr == destNr || sourceNr > Songs.Count - 1 || destNr > Songs.Count - 1) return; - CPlaylistSong ps = new CPlaylistSong(Songs[sourceNr]); + var ps = new CPlaylistSong(Songs[sourceNr]); Songs.RemoveAt(sourceNr); Songs.Insert(destNr, ps); } @@ -226,7 +226,7 @@ namespace Vocaluxe.Lib.Playlist if (destNr < 0 || destNr > Songs.Count - 1) return; - CPlaylistSong ps = new CPlaylistSong(songID, gm); + var ps = new CPlaylistSong(songID, gm); Songs.Insert(destNr, ps); } } diff --git a/Vocaluxe/Lib/Sound/CDirectSoundRecord.cs b/Vocaluxe/Lib/Sound/CDirectSoundRecord.cs index fad206a4..49dccd09 100644 --- a/Vocaluxe/Lib/Sound/CDirectSoundRecord.cs +++ b/Vocaluxe/Lib/Sound/CDirectSoundRecord.cs @@ -53,9 +53,9 @@ namespace Vocaluxe.Lib.Sound int id = 0; foreach (DeviceInformation dev in devices) { - using (DirectSoundCapture ds = new DirectSoundCapture(dev.DriverGuid)) + using (var ds = new DirectSoundCapture(dev.DriverGuid)) { - CRecordDevice device = new CRecordDevice {Driver = dev.DriverGuid.ToString(), ID = id, Name = dev.Description, Channels = ds.Capabilities.Channels}; + var device = new CRecordDevice {Driver = dev.DriverGuid.ToString(), ID = id, Name = dev.Description, Channels = ds.Capabilities.Channels}; if (device.Channels > 2) device.Channels = 2; //more are not supported in vocaluxe @@ -89,9 +89,9 @@ namespace Vocaluxe.Lib.Sound foreach (CBuffer buffer in _Buffer) buffer.Reset(); - bool[] active = new bool[_Devices.Count]; - Guid[] guid = new Guid[_Devices.Count]; - short[] channels = new short[_Devices.Count]; + var active = new bool[_Devices.Count]; + var guid = new Guid[_Devices.Count]; + var channels = new short[_Devices.Count]; for (int dev = 0; dev < _Devices.Count; dev++) { active[dev] = false; @@ -105,7 +105,7 @@ namespace Vocaluxe.Lib.Sound { if (active[i]) { - CSoundCardSource source = new CSoundCardSource(guid[i], channels[i]) {SampleRateKhz = 44.1}; + var source = new CSoundCardSource(guid[i], channels[i]) {SampleRateKhz = 44.1}; source.SampleDataReady += _OnDataReady; source.Start(); @@ -209,8 +209,8 @@ namespace Vocaluxe.Lib.Sound { if (_Initialized) { - byte[] leftBuffer = new byte[e.Data.Length / 2]; - byte[] rightBuffer = new byte[e.Data.Length / 2]; + var leftBuffer = new byte[e.Data.Length / 2]; + var rightBuffer = new byte[e.Data.Length / 2]; //[]: Sample, L: Left channel R: Right channel //[LR][LR][LR][LR][LR][LR] @@ -318,7 +318,7 @@ namespace Vocaluxe.Lib.Sound for (int i = 0; i < _BufferPortionCount; i++) { - NotificationPosition notification = new NotificationPosition {Offset = _BufferPortionCount - 1 + (_BufferPortionSize * i), Event = new AutoResetEvent(false)}; + var notification = new NotificationPosition {Offset = _BufferPortionCount - 1 + (_BufferPortionSize * i), Event = new AutoResetEvent(false)}; _Notifications.Add(notification); } @@ -371,7 +371,7 @@ namespace Vocaluxe.Lib.Sound int bufferPortionSamples = _BufferPortionSize / sizeof(byte); // Buffer type must match this.waveFormat.FormatTag and this.waveFormat.BitsPerSample - byte[] bufferPortion = new byte[bufferPortionSamples]; + var bufferPortion = new byte[bufferPortionSamples]; _CaptureBuffer.Start(true); diff --git a/Vocaluxe/Lib/Sound/CGstreamerAudio.cs b/Vocaluxe/Lib/Sound/CGstreamerAudio.cs index 998bdbde..cdc53b45 100644 --- a/Vocaluxe/Lib/Sound/CGstreamerAudio.cs +++ b/Vocaluxe/Lib/Sound/CGstreamerAudio.cs @@ -65,14 +65,14 @@ namespace Vocaluxe.Lib.Sound public int Load(string media) { - Uri u = new Uri(media); + var u = new Uri(media); int i = CGstreamerAudioWrapper.Load(u.AbsoluteUri); return i; } public int Load(string media, bool prescan) { - Uri u = new Uri(media); + var u = new Uri(media); int i = CGstreamerAudioWrapper.Load(u.AbsoluteUri, prescan); return i; } diff --git a/Vocaluxe/Lib/Sound/COpenALPlay.cs b/Vocaluxe/Lib/Sound/COpenALPlay.cs index 36017220..849a484a 100644 --- a/Vocaluxe/Lib/Sound/COpenALPlay.cs +++ b/Vocaluxe/Lib/Sound/COpenALPlay.cs @@ -106,8 +106,8 @@ namespace Vocaluxe.Lib.Sound public int Load(string media, bool prescan) { - SAudioStreams stream = new SAudioStreams(0); - COpenAlStream decoder = new COpenAlStream(); + var stream = new SAudioStreams(0); + var decoder = new COpenAlStream(); if (decoder.Open(media) > -1) { @@ -595,7 +595,7 @@ namespace Vocaluxe.Lib.Sound _CurrentTime = 0f; _Timer.Reset(); - SAudioStreams stream = new SAudioStreams(0) {Handle = _Buffers[0]}; + var stream = new SAudioStreams(0) {Handle = _Buffers[0]}; if (stream.Handle != 0) { @@ -782,7 +782,7 @@ namespace Vocaluxe.Lib.Sound return; } - byte[] buf = new byte[_BufferSize]; + var buf = new byte[_BufferSize]; lock (_MutexData) { @@ -793,7 +793,7 @@ namespace Vocaluxe.Lib.Sound _Data.Read(buf); - byte[] b = new byte[2]; + var b = new byte[2]; for (int i = 0; i < buf.Length; i += _ByteCount) { b[0] = buf[i]; diff --git a/Vocaluxe/Lib/Sound/CPortAudioPlay.cs b/Vocaluxe/Lib/Sound/CPortAudioPlay.cs index 9c195495..7cf0c4f0 100644 --- a/Vocaluxe/Lib/Sound/CPortAudioPlay.cs +++ b/Vocaluxe/Lib/Sound/CPortAudioPlay.cs @@ -91,8 +91,8 @@ namespace Vocaluxe.Lib.Sound public int Load(string media, bool prescan) { - SAudioStreams stream = new SAudioStreams(0); - CPortAudioStream decoder = new CPortAudioStream(); + var stream = new SAudioStreams(0); + var decoder = new CPortAudioStream(); if (decoder.Open(media) > -1) { @@ -599,11 +599,11 @@ namespace Vocaluxe.Lib.Sound _CurrentTime = 0f; _SyncTimer.Time = _CurrentTime; - SAudioStreams stream = new SAudioStreams(0); + var stream = new SAudioStreams(0); - IntPtr data = new IntPtr(0); + var data = new IntPtr(0); - CPortAudio.SPaStreamParameters outputParams = new CPortAudio.SPaStreamParameters + var outputParams = new CPortAudio.SPaStreamParameters { ChannelCount = format.ChannelCount, Device = _ApiInfo.DefaultOutputDevice, @@ -611,7 +611,7 @@ namespace Vocaluxe.Lib.Sound SuggestedLatency = _OutputDeviceInfo.DefaultLowOutputLatency }; - uint bufsize = (uint)CConfig.AudioBufferSize; + var bufsize = (uint)CConfig.AudioBufferSize; lock (_Mutex) { _ErrorCheck("OpenDefaultStream (playback)", CPortAudio.Pa_OpenStream( @@ -797,7 +797,7 @@ namespace Vocaluxe.Lib.Sound CPortAudio.EPaStreamCallbackFlags statusFlags, IntPtr userData) { - byte[] buf = new byte[frameCount * _ByteCount]; + var buf = new byte[frameCount * _ByteCount]; if (_Paused) { @@ -818,7 +818,7 @@ namespace Vocaluxe.Lib.Sound { _Data.Read(buf); - byte[] b = new byte[2]; + var b = new byte[2]; for (int i = 0; i < buf.Length; i += _ByteCount) { b[0] = buf[i]; diff --git a/Vocaluxe/Lib/Sound/CPortAudioRecord.cs b/Vocaluxe/Lib/Sound/CPortAudioRecord.cs index 0f51fa31..a4ae35c4 100644 --- a/Vocaluxe/Lib/Sound/CPortAudioRecord.cs +++ b/Vocaluxe/Lib/Sound/CPortAudioRecord.cs @@ -73,7 +73,7 @@ namespace Vocaluxe.Lib.Sound CPortAudio.SPaDeviceInfo info = CPortAudio.PaGetDeviceInfo(i); if (info.HostApi == hostAPI && info.MaxInputChannels > 0) { - CRecordDevice dev = new CRecordDevice {ID = i, Name = info.Name, Driver = info.Name + i, Channels = info.MaxInputChannels}; + var dev = new CRecordDevice {ID = i, Name = info.Name, Driver = info.Name + i, Channels = info.MaxInputChannels}; if (dev.Channels > 2) dev.Channels = 2; //more are not supported in vocaluxe @@ -123,7 +123,7 @@ namespace Vocaluxe.Lib.Sound for (int i = 0; i < _RecHandle.Length; i++) _RecHandle[i] = IntPtr.Zero; - bool[] active = new bool[_Devices.Count]; + var active = new bool[_Devices.Count]; for (int dev = 0; dev < _Devices.Count; dev++) { active[dev] = false; @@ -135,7 +135,7 @@ namespace Vocaluxe.Lib.Sound { if (active[i]) { - CPortAudio.SPaStreamParameters inputParams = new CPortAudio.SPaStreamParameters + var inputParams = new CPortAudio.SPaStreamParameters { ChannelCount = _Devices[i].Channels, Device = _Devices[i].ID, @@ -283,9 +283,9 @@ namespace Vocaluxe.Lib.Sound frameCount *= 4; if (frameCount > 0 && input != IntPtr.Zero) { - byte[] recbuffer = new byte[frameCount]; - byte[] leftBuffer = new byte[frameCount / 2]; - byte[] rightBuffer = new byte[frameCount / 2]; + var recbuffer = new byte[frameCount]; + var leftBuffer = new byte[frameCount / 2]; + var rightBuffer = new byte[frameCount / 2]; // copy from managed to unmanaged memory Marshal.Copy(input, recbuffer, 0, (int)frameCount); diff --git a/Vocaluxe/Lib/Sound/Decoder/CAudioDecoderFFmpeg.cs b/Vocaluxe/Lib/Sound/Decoder/CAudioDecoderFFmpeg.cs index 15e06b56..a536a35e 100644 --- a/Vocaluxe/Lib/Sound/Decoder/CAudioDecoderFFmpeg.cs +++ b/Vocaluxe/Lib/Sound/Decoder/CAudioDecoderFFmpeg.cs @@ -124,7 +124,7 @@ namespace Vocaluxe.Lib.Sound.Decoder public float GetLength() { - return _FileOpened ? _Instance.Info.Duration / 1000f:0; + return _FileOpened ? _Instance.Info.Duration / 1000f : 0; } public void SetPosition(float time) @@ -134,7 +134,7 @@ namespace Vocaluxe.Lib.Sound.Decoder try { - CAcinerella.AcSeek(_Audiodecoder, (time>_CurrentTime)?0:-1, (Int64)(time * 1000f)); + CAcinerella.AcSeek(_Audiodecoder, (time > _CurrentTime) ? 0 : -1, (Int64)(time * 1000f)); } catch (Exception) { @@ -161,7 +161,7 @@ namespace Vocaluxe.Lib.Sound.Decoder if (frameFinished) { - SACDecoder decoder = (SACDecoder)Marshal.PtrToStructure(_Audiodecoder, typeof(SACDecoder)); + var decoder = (SACDecoder)Marshal.PtrToStructure(_Audiodecoder, typeof(SACDecoder)); timeStamp = (float)decoder.Timecode; _CurrentTime = timeStamp; diff --git a/Vocaluxe/Lib/Video/Acinerella/CAcinerella.cs b/Vocaluxe/Lib/Video/Acinerella/CAcinerella.cs index bfc814c9..5da15ff1 100644 --- a/Vocaluxe/Lib/Video/Acinerella/CAcinerella.cs +++ b/Vocaluxe/Lib/Video/Acinerella/CAcinerella.cs @@ -363,7 +363,7 @@ namespace Vocaluxe.Lib.Video.Acinerella { lock (_Lock) { - return _ac_decode_package(pAcPackage, pAcDecoder)!=0; + return _ac_decode_package(pAcPackage, pAcDecoder) != 0; } } @@ -374,7 +374,7 @@ namespace Vocaluxe.Lib.Video.Acinerella { lock (_Lock) { - return _ac_get_audio_frame(pAcInstance, pAcDecoder)!=0; + return _ac_get_audio_frame(pAcInstance, pAcDecoder) != 0; } } @@ -385,7 +385,7 @@ namespace Vocaluxe.Lib.Video.Acinerella { lock (_Lock) { - return _ac_get_frame(pAcInstance, pAcDecoder)!=0; + return _ac_get_frame(pAcInstance, pAcDecoder) != 0; } } @@ -396,7 +396,7 @@ namespace Vocaluxe.Lib.Video.Acinerella { lock (_Lock) { - return _ac_skip_frames(pAcInstance, pAcDecoder, num)!=0; + return _ac_skip_frames(pAcInstance, pAcDecoder, num) != 0; } } @@ -412,7 +412,7 @@ namespace Vocaluxe.Lib.Video.Acinerella { lock (_Lock) { - return _ac_seek(pAcDecoder, dir, targetPos)!=0; + return _ac_seek(pAcDecoder, dir, targetPos) != 0; } } diff --git a/Vocaluxe/Lib/Video/Acinerella/CDecoder.cs b/Vocaluxe/Lib/Video/Acinerella/CDecoder.cs index 5ba37c91..56509684 100644 --- a/Vocaluxe/Lib/Video/Acinerella/CDecoder.cs +++ b/Vocaluxe/Lib/Video/Acinerella/CDecoder.cs @@ -1,3 +1,22 @@ +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + using System; using System.Diagnostics; using System.IO; diff --git a/Vocaluxe/Lib/Video/Acinerella/CFramebuffer.cs b/Vocaluxe/Lib/Video/Acinerella/CFramebuffer.cs index 8aaa6287..aea38207 100644 --- a/Vocaluxe/Lib/Video/Acinerella/CFramebuffer.cs +++ b/Vocaluxe/Lib/Video/Acinerella/CFramebuffer.cs @@ -1,4 +1,23 @@ -using System; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System; using System.Runtime.InteropServices; namespace Vocaluxe.Lib.Video.Acinerella diff --git a/Vocaluxe/Lib/Video/CVideoDecoderGstreamer.cs b/Vocaluxe/Lib/Video/CVideoDecoderGstreamer.cs index f37b0dc8..53d88c4e 100644 --- a/Vocaluxe/Lib/Video/CVideoDecoderGstreamer.cs +++ b/Vocaluxe/Lib/Video/CVideoDecoderGstreamer.cs @@ -55,7 +55,7 @@ namespace Vocaluxe.Lib.Video int i = -1; try { - Uri u = new Uri(videoFileName); + var u = new Uri(videoFileName); i = CGstreamerVideoWrapper.LoadVideo(u.AbsoluteUri); return i; } diff --git a/Vocaluxe/Lib/Webcam/CAForgeNet.cs b/Vocaluxe/Lib/Webcam/CAForgeNet.cs index 2fb2ff6e..f7e400c7 100644 --- a/Vocaluxe/Lib/Webcam/CAForgeNet.cs +++ b/Vocaluxe/Lib/Webcam/CAForgeNet.cs @@ -65,7 +65,7 @@ namespace Vocaluxe.Lib.Webcam { lock (_MutexData) { - Bitmap bmp = new Bitmap(_Width, _Height); + var bmp = new Bitmap(_Width, _Height); BitmapData bitmapdata = bmp.LockBits(new Rectangle(0, 0, _Width, _Height), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb); Marshal.Copy(_Data, 0, bitmapdata.Scan0, _Data.Length); bmp.UnlockBits(bitmapdata); @@ -80,17 +80,17 @@ namespace Vocaluxe.Lib.Webcam _WebcamDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice); foreach (FilterInfo info in _WebcamDevices) { - SWebcamDevice device = new SWebcamDevice + var device = new SWebcamDevice { Name = info.Name, MonikerString = info.MonikerString, Capabilities = new List() }; - VideoCaptureDevice tmpdev = new VideoCaptureDevice(info.MonikerString); + var tmpdev = new VideoCaptureDevice(info.MonikerString); foreach (VideoCapabilities capabilities in tmpdev.VideoCapabilities) { - SCapabilities item = new SCapabilities + var item = new SCapabilities { Framerate = capabilities.FrameRate, Height = capabilities.FrameSize.Height, diff --git a/Vocaluxe/Program.cs b/Vocaluxe/Program.cs index 63758783..77c4dafc 100644 --- a/Vocaluxe/Program.cs +++ b/Vocaluxe/Program.cs @@ -253,7 +253,7 @@ namespace Vocaluxe [HandleProcessCorruptedStateExceptions] private static void UnhandledExceptionHandler(object sender, UnhandledExceptionEventArgs args) { - Exception e = (Exception)args.ExceptionObject; + var e = (Exception)args.ExceptionObject; string stackTrace = ""; try { diff --git a/Vocaluxe/Screens/CPopupScreenPlayerControl.cs b/Vocaluxe/Screens/CPopupScreenPlayerControl.cs index 1856b90d..c3ba6ece 100644 --- a/Vocaluxe/Screens/CPopupScreenPlayerControl.cs +++ b/Vocaluxe/Screens/CPopupScreenPlayerControl.cs @@ -201,7 +201,7 @@ namespace Vocaluxe.Screens CGame.Reset(); CGame.ClearSongs(); - EGameMode gm = EGameMode.TR_GAMEMODE_NORMAL; + var gm = EGameMode.TR_GAMEMODE_NORMAL; if (CSongs.AllSongs[songNr].IsDuet) gm = EGameMode.TR_GAMEMODE_DUET; diff --git a/Vocaluxe/Screens/CScreenCredits.cs b/Vocaluxe/Screens/CScreenCredits.cs index c73a5df1..c2958750 100644 --- a/Vocaluxe/Screens/CScreenCredits.cs +++ b/Vocaluxe/Screens/CScreenCredits.cs @@ -293,12 +293,12 @@ namespace Vocaluxe.Screens CStatic image = GetNewStatic(texture, new SColorF(1, 1, 1, 1), new SRectF(-1, -1, 400, 120, -4)); - SRectF particleRect = new SRectF(-1, -1, partRectSize, partRectSize, -6); - SRectF imgDotRect = new SRectF(particleRect) {Z = -5}; + var particleRect = new SRectF(-1, -1, partRectSize, partRectSize, -6); + var imgDotRect = new SRectF(particleRect) {Z = -5}; CStatic imgDot = GetNewStatic(texDot, new SColorF(1, 1, 1, 1), imgDotRect); CParticleEffect particle = _GetStarParticles(partCount, isRight, particleRect, bigParticles); - CCreditName credit = new CCreditName(image, imgDot, particle, particleOffsetX, particleOffsetY); + var credit = new CCreditName(image, imgDot, particle, particleOffsetX, particleOffsetY); if (isRight) { @@ -323,8 +323,8 @@ namespace Vocaluxe.Screens new SRectF((float)(CSettings.RenderW - _TexLogo.OrigSize.Width) / 2, -270, _TexLogo.OrigSize.Width, _TexLogo.OrigSize.Height, -2)); //Little stars for logo - int numstars = (int)(_Logo.Rect.W * 0.25f / 2f); - SRectF partRect = new SRectF(_Logo.Rect.X, _Logo.Rect.Y, _Logo.Rect.W, _Logo.Rect.H, -1); + var numstars = (int)(_Logo.Rect.W * 0.25f / 2f); + var partRect = new SRectF(_Logo.Rect.X, _Logo.Rect.Y, _Logo.Rect.W, _Logo.Rect.H, -1); _StarsRed = _GetStarParticles(numstars, true, partRect, true); _StarsBlue = _GetStarParticles(numstars, false, partRect, true); diff --git a/Vocaluxe/Screens/CScreenHighscore.cs b/Vocaluxe/Screens/CScreenHighscore.cs index 56e70ecf..b6b379c3 100644 --- a/Vocaluxe/Screens/CScreenHighscore.cs +++ b/Vocaluxe/Screens/CScreenHighscore.cs @@ -56,7 +56,7 @@ namespace Vocaluxe.Screens { base.Init(); - List texts = new List {_TextSongName, _TextSongMode}; + var texts = new List {_TextSongName, _TextSongMode}; _TextNumber = new string[_NumEntrys]; for (int i = 0; i < _NumEntrys; i++) diff --git a/Vocaluxe/Screens/CScreenOptionsRecord.cs b/Vocaluxe/Screens/CScreenOptionsRecord.cs index 36a7f66d..5bacee52 100644 --- a/Vocaluxe/Screens/CScreenOptionsRecord.cs +++ b/Vocaluxe/Screens/CScreenOptionsRecord.cs @@ -75,7 +75,7 @@ namespace Vocaluxe.Screens { base.Init(); - List values = new List {_StaticWarning}; + var values = new List {_StaticWarning}; values.AddRange(_StaticEnergyChannel); _ThemeStatics = values.ToArray(); @@ -369,11 +369,11 @@ namespace Vocaluxe.Screens { if (_ChannelEnergy[i] > 0f) { - SRectF rect = new SRectF(_Statics[_StaticEnergyChannel[i]].Rect.X, - _Statics[_StaticEnergyChannel[i]].Rect.Y, - _Statics[_StaticEnergyChannel[i]].Rect.W * _ChannelEnergy[i], - _Statics[_StaticEnergyChannel[i]].Rect.H, - _Statics[_StaticEnergyChannel[i]].Rect.Z); + var rect = new SRectF(_Statics[_StaticEnergyChannel[i]].Rect.X, + _Statics[_StaticEnergyChannel[i]].Rect.Y, + _Statics[_StaticEnergyChannel[i]].Rect.W * _ChannelEnergy[i], + _Statics[_StaticEnergyChannel[i]].Rect.H, + _Statics[_StaticEnergyChannel[i]].Rect.Z); CDraw.DrawTexture(_Statics[_StaticEnergyChannel[i]].Texture, _Statics[_StaticEnergyChannel[i]].Rect, new SColorF(1f, 1f, 1f, 1f), rect); @@ -465,7 +465,7 @@ namespace Vocaluxe.Screens private bool _CheckMicConfig() { - bool[] isSet = new bool[CSettings.MaxNumPlayer]; + var isSet = new bool[CSettings.MaxNumPlayer]; for (int i = 0; i < CSettings.MaxNumPlayer; i++) isSet[i] = false; diff --git a/Vocaluxe/Screens/CScreenOptionsSound.cs b/Vocaluxe/Screens/CScreenOptionsSound.cs index ef809fbb..9eb19060 100644 --- a/Vocaluxe/Screens/CScreenOptionsSound.cs +++ b/Vocaluxe/Screens/CScreenOptionsSound.cs @@ -154,8 +154,8 @@ namespace Vocaluxe.Screens CConfig.PreviewMusicVolume = _SelectSlides[_SelectSlidePreviewMusicVolume].Selection * 5; CConfig.SaveConfig(); - EOffOn newOffOn = (EOffOn)_SelectSlides[_SelectSlideBackgroundMusic].Selection; - EBackgroundMusicSource newSource = (EBackgroundMusicSource)_SelectSlides[_SelectSlideBackgroundMusicSource].Selection; + var newOffOn = (EOffOn)_SelectSlides[_SelectSlideBackgroundMusic].Selection; + var newSource = (EBackgroundMusicSource)_SelectSlides[_SelectSlideBackgroundMusicSource].Selection; float newVolume = _SelectSlides[_SelectSlideBackgroundMusicVolume].Selection * 5; CBackgroundMusic.CheckAndApplyConfig(newOffOn, newSource, newVolume); diff --git a/Vocaluxe/Screens/CScreenScore.cs b/Vocaluxe/Screens/CScreenScore.cs index c697207d..aece36cf 100644 --- a/Vocaluxe/Screens/CScreenScore.cs +++ b/Vocaluxe/Screens/CScreenScore.cs @@ -60,13 +60,13 @@ namespace Vocaluxe.Screens { base.Init(); - List texts = new List {_TextSong}; + var texts = new List {_TextSong}; _BuildTextStrings(ref texts); _ThemeTexts = texts.ToArray(); - List statics = new List(); + var statics = new List(); _BuildStaticStrings(ref statics); _ThemeStatics = statics.ToArray(); @@ -131,7 +131,7 @@ namespace Vocaluxe.Screens public override bool UpdateGame() { - SPlayer[] players = new SPlayer[CGame.NumPlayer]; + var players = new SPlayer[CGame.NumPlayer]; if (_Round != 0) players = _Points.GetPlayer(_Round - 1, CGame.NumPlayer); else @@ -156,7 +156,7 @@ namespace Vocaluxe.Screens if (_StaticPointsBarDrawnPoints[p] > players[p].Points) _StaticPointsBarDrawnPoints[p] = players[p].Points; - string direction = (string)_ScreenSettings[_ScreenSettingAnimationDirection].GetValue(); + var direction = (string)_ScreenSettings[_ScreenSettingAnimationDirection].GetValue(); if (direction.ToLower() == "vertical") { _Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.W = ((float)_StaticPointsBarDrawnPoints[p]) * @@ -264,7 +264,7 @@ namespace Vocaluxe.Screens private void _UpdateRatings() { CSong song = null; - SPlayer[] players = new SPlayer[CGame.NumPlayer]; + var players = new SPlayer[CGame.NumPlayer]; if (_Round != 0) { song = CGame.GetSong(_Round); @@ -325,7 +325,7 @@ namespace Vocaluxe.Screens _Texts[_TextRatings[p, CGame.NumPlayer - 1]].Text = CLanguage.Translate(_GetRating((int)Math.Round(players[p].Points))); _StaticPointsBarDrawnPoints[p] = 0.0; - string direction = (string)_ScreenSettings[_ScreenSettingAnimationDirection].GetValue(); + var direction = (string)_ScreenSettings[_ScreenSettingAnimationDirection].GetValue(); if (direction.ToLower() == "vertical") _Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.W = 0; else diff --git a/Vocaluxe/Screens/CScreenSing.cs b/Vocaluxe/Screens/CScreenSing.cs index fcd8d78c..a77c8a6c 100644 --- a/Vocaluxe/Screens/CScreenSing.cs +++ b/Vocaluxe/Screens/CScreenSing.cs @@ -546,13 +546,13 @@ namespace Vocaluxe.Screens public override void ApplyVolume() { - if(_CurrentStream > -1) + if (_CurrentStream > -1) CSound.SetStreamVolumeMax(_CurrentStream, CConfig.GameMusicVolume); } private void _CloseSong() { - if(_CurrentStream > -1) + if (_CurrentStream > -1) CSound.FadeAndStop(_CurrentStream, 0f, 0.5f); CSound.RecordStop(); if (_CurrentVideo != -1) diff --git a/Vocaluxe/Screens/CScreenSong.cs b/Vocaluxe/Screens/CScreenSong.cs index 1a614ba0..81568658 100644 --- a/Vocaluxe/Screens/CScreenSong.cs +++ b/Vocaluxe/Screens/CScreenSong.cs @@ -105,7 +105,7 @@ namespace Vocaluxe.Screens _ButtonsJoker.Clear(); for (int i = 0; i < CSettings.MaxNumPlayer; i++) _ButtonsJoker.Add("ButtonJoker" + (i + 1)); - List blist = new List(); + var blist = new List(); blist.AddRange(_ButtonsJoker); blist.Add(_ButtonOptionsClose); blist.Add(_ButtonOptionsPlaylist); @@ -123,7 +123,7 @@ namespace Vocaluxe.Screens _TextsPlayer.Clear(); for (int i = 0; i < CSettings.MaxNumPlayer; i++) _TextsPlayer.Add("TextPlayer" + (i + 1)); - List tlist = new List(); + var tlist = new List(); tlist.AddRange(_TextsPlayer); tlist.Add(_TextCategory); tlist.Add(_TextSelection); @@ -172,7 +172,7 @@ namespace Vocaluxe.Screens { if (_SearchActive) _ApplyNewSearchFilter(_SearchText + keyEvent.Unicode); - else if(!_Sso.Selection.PartyMode) + else if (!_Sso.Selection.PartyMode) { _JumpTo(keyEvent.Unicode); return true; @@ -862,7 +862,7 @@ namespace Vocaluxe.Screens CGame.Reset(); CGame.ClearSongs(); - List ids = new List(); + var ids = new List(); for (int i = 0; i < CSongs.AllSongs.Count; i++) ids.Add(i); @@ -870,7 +870,7 @@ namespace Vocaluxe.Screens { int songNr = ids[CGame.Rand.Next(ids.Count)]; - EGameMode gm = EGameMode.TR_GAMEMODE_NORMAL; + var gm = EGameMode.TR_GAMEMODE_NORMAL; if (CSongs.AllSongs[songNr].IsDuet) gm = EGameMode.TR_GAMEMODE_DUET; @@ -894,7 +894,7 @@ namespace Vocaluxe.Screens { int songNr = ids[CGame.Rand.Next(ids.Count)]; - EGameMode gm = EGameMode.TR_GAMEMODE_NORMAL; + var gm = EGameMode.TR_GAMEMODE_NORMAL; if (CSongs.AllSongs[songNr].IsDuet) gm = EGameMode.TR_GAMEMODE_DUET; @@ -1009,10 +1009,10 @@ namespace Vocaluxe.Screens int curSelected = _SongMenus[_SongMenu].GetActualSelection(); bool firstLevel = CConfig.Tabs == EOffOn.TR_CONFIG_OFF && CSongs.IsInCategory; bool secondSort = CConfig.Tabs == EOffOn.TR_CONFIG_ON && - (CConfig.SongSorting == ESongSorting.TR_CONFIG_ARTIST || - CConfig.SongSorting == ESongSorting.TR_CONFIG_ARTIST_LETTER || - CConfig.SongSorting == ESongSorting.TR_CONFIG_FOLDER || - CConfig.SongSorting == ESongSorting.TR_CONFIG_TITLE_LETTER); + (CConfig.SongSorting == ESongSorting.TR_CONFIG_ARTIST || + CConfig.SongSorting == ESongSorting.TR_CONFIG_ARTIST_LETTER || + CConfig.SongSorting == ESongSorting.TR_CONFIG_FOLDER || + CConfig.SongSorting == ESongSorting.TR_CONFIG_TITLE_LETTER); if (firstLevel && !secondSort) { //TODO: What's to do with multiple tags? @@ -1029,7 +1029,7 @@ namespace Vocaluxe.Screens visibleID = _FindIndex(songs, start, element => element.Artist.StartsWith(letter.ToString(), StringComparison.OrdinalIgnoreCase)); break; - //TODO: Does this make sense? Maybe we should deactivate this for years? You could only jump between 1 and 2 + //TODO: Does this make sense? Maybe we should deactivate this for years? You could only jump between 1 and 2 case ESongSorting.TR_CONFIG_YEAR: case ESongSorting.TR_CONFIG_DECADE: if (curSelected >= 0 && curSelected < ct - 1 && songs[curSelected].Year.StartsWith(letter.ToString(), StringComparison.OrdinalIgnoreCase)) @@ -1076,7 +1076,7 @@ namespace Vocaluxe.Screens if (visibleID > -1) _SongMenus[_SongMenu].SetSelectedSong(visibleID); } - else if(!CSongs.IsInCategory) + else if (!CSongs.IsInCategory) { ReadOnlyCollection categories = CSongs.Categories; int ct = categories.Count; @@ -1166,7 +1166,7 @@ namespace Vocaluxe.Screens private void _ShowSongOptionsSong() { - EGameMode lastMode = EGameMode.TR_GAMEMODE_NORMAL; + var lastMode = EGameMode.TR_GAMEMODE_NORMAL; if (_AvailableGameModes.Count > 0) lastMode = _AvailableGameModes[_SelectSlides[_SelectSlideOptionsMode].Selection]; _AvailableGameModes.Clear(); diff --git a/Vocaluxe/Screens/CScreenTest.cs b/Vocaluxe/Screens/CScreenTest.cs index 52a6ed1f..15249fc3 100644 --- a/Vocaluxe/Screens/CScreenTest.cs +++ b/Vocaluxe/Screens/CScreenTest.cs @@ -41,8 +41,8 @@ namespace Vocaluxe.Screens { base.Init(); const string test = "Ö ÄÜabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPGRSTUVWGXZ1234567890"; - SColorF color = new SColorF(1, 0, 0, 1); - CText text = new CText(10, 50, 1, 32, 0, EAlignment.Left, EStyle.Normal, "Normal", color, "jÄNormal Text" + test, -1, 26, 1); + var color = new SColorF(1, 0, 0, 1); + var text = new CText(10, 50, 1, 32, 0, EAlignment.Left, EStyle.Normal, "Normal", color, "jÄNormal Text" + test, -1, 26, 1); _AddText(text); text = new CText(10, 90, 1, 32, 0, EAlignment.Left, EStyle.Bold, "Normal", color, "jÄBold Text" + test, -1, 26, 1); _AddText(text); diff --git a/VocaluxeLib/CHelper.cs b/VocaluxeLib/CHelper.cs index af49179f..5fd2947b 100644 --- a/VocaluxeLib/CHelper.cs +++ b/VocaluxeLib/CHelper.cs @@ -69,7 +69,7 @@ namespace VocaluxeLib public static int TryReadInt(StreamReader sr) { string value = String.Empty; - + try { int tmp = sr.Peek(); @@ -79,7 +79,7 @@ namespace VocaluxeLib if (sr.EndOfStream) break; - char chr = (char)sr.Read(); + var chr = (char)sr.Read(); value += chr.ToString(); tmp = sr.Peek(); } @@ -141,8 +141,8 @@ namespace VocaluxeLib public static List ListFiles(string path, string cast, bool recursive = false, bool fullpath = false) { - List files = new List(); - DirectoryInfo dir = new DirectoryInfo(path); + var files = new List(); + var dir = new DirectoryInfo(path); try { diff --git a/VocaluxeLib/CXMLReader.cs b/VocaluxeLib/CXMLReader.cs index 5b295bcb..383db367 100644 --- a/VocaluxeLib/CXMLReader.cs +++ b/VocaluxeLib/CXMLReader.cs @@ -37,7 +37,7 @@ namespace VocaluxeLib private CXMLReader(string uri) { _FileName = uri; - XPathDocument xmlDoc = new XPathDocument(uri); + var xmlDoc = new XPathDocument(uri); _Navigator = xmlDoc.CreateNavigator(); } @@ -123,7 +123,7 @@ namespace VocaluxeLib public List GetValues(string cast) { - List values = new List(); + var values = new List(); _Navigator.MoveToRoot(); _Navigator.MoveToFirstChild(); @@ -143,7 +143,7 @@ namespace VocaluxeLib public IEnumerable GetAttributes(string cast, string attribute) { - List values = new List(); + var values = new List(); _Navigator.MoveToRoot(); _Navigator.MoveToFirstChild(); diff --git a/VocaluxeLib/Game/CPoints.cs b/VocaluxeLib/Game/CPoints.cs index 31afe16c..6837e356 100644 --- a/VocaluxeLib/Game/CPoints.cs +++ b/VocaluxeLib/Game/CPoints.cs @@ -80,7 +80,7 @@ namespace VocaluxeLib.Game if (round >= NumRounds) return new SPlayer[1]; - SPlayer[] players = new SPlayer[numPlayer]; + var players = new SPlayer[numPlayer]; for (int p = 0; p < players.Length; p++) { diff --git a/VocaluxeLib/Menu/CBackground.cs b/VocaluxeLib/Menu/CBackground.cs index 068ea9fc..0027536a 100644 --- a/VocaluxeLib/Menu/CBackground.cs +++ b/VocaluxeLib/Menu/CBackground.cs @@ -196,7 +196,7 @@ namespace VocaluxeLib.Menu #region internal private void _DrawColor() { - SRectF bounds = new SRectF(0f, 0f, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH(), CBase.Settings.GetZFar() / 4); + var bounds = new SRectF(0f, 0f, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH(), CBase.Settings.GetZFar() / 4); CBase.Drawing.DrawColor(Color, bounds); } @@ -206,7 +206,7 @@ namespace VocaluxeLib.Menu CTexture texture = CBase.Theme.GetSkinTexture(_Theme.TextureName, _PartyModeID); if (texture != null) { - RectangleF bounds = new RectangleF(0f, 0f, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH()); + var bounds = new RectangleF(0f, 0f, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH()); RectangleF rect; CHelper.SetRect(bounds, out rect, texture.OrigAspect, EAspect.Crop); @@ -221,7 +221,7 @@ namespace VocaluxeLib.Menu CTexture videoTexture = CBase.Theme.GetSkinVideoTexture(_Theme.VideoName, _PartyModeID); if (videoTexture != null) { - RectangleF bounds = new RectangleF(0f, 0f, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH()); + var bounds = new RectangleF(0f, 0f, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH()); RectangleF rect; CHelper.SetRect(bounds, out rect, videoTexture.OrigAspect, EAspect.Crop); @@ -236,7 +236,7 @@ namespace VocaluxeLib.Menu CTexture videoTexture = CBase.BackgroundMusic.GetVideoTexture(); if (videoTexture != null) { - RectangleF bounds = new RectangleF(0f, 0f, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH()); + var bounds = new RectangleF(0f, 0f, CBase.Settings.GetRenderW(), CBase.Settings.GetRenderH()); RectangleF rect; CHelper.SetRect(bounds, out rect, videoTexture.OrigAspect, EAspect.Crop); diff --git a/VocaluxeLib/Menu/CEqualizer.cs b/VocaluxeLib/Menu/CEqualizer.cs index c65b42c0..94df7eba 100644 --- a/VocaluxeLib/Menu/CEqualizer.cs +++ b/VocaluxeLib/Menu/CEqualizer.cs @@ -258,7 +258,7 @@ namespace VocaluxeLib.Menu for (int i = 0; i < _Bars.Length; i++) { - SRectF bar = new SRectF(Rect.X + dx * i, Rect.Y + Rect.H - _Bars[i] * Rect.H, dx - Space, _Bars[i] * Rect.H, Rect.Z); + var bar = new SRectF(Rect.X + dx * i, Rect.Y + Rect.H - _Bars[i] * Rect.H, dx - Space, _Bars[i] * Rect.H, Rect.Z); SColorF color = Color; if (i == max) color = MaxColor; diff --git a/VocaluxeLib/Menu/CLyric.cs b/VocaluxeLib/Menu/CLyric.cs index cdd1b1a8..a5f2af2a 100644 --- a/VocaluxeLib/Menu/CLyric.cs +++ b/VocaluxeLib/Menu/CLyric.cs @@ -208,7 +208,7 @@ namespace VocaluxeLib.Menu _Width = 0f; foreach (CSongNote note in line.Notes) { - SNote n = new SNote {Text = note.Text, StartBeat = note.StartBeat, EndBeat = note.EndBeat, Duration = note.Duration, Type = note.NoteType}; + var n = new SNote {Text = note.Text, StartBeat = note.StartBeat, EndBeat = note.EndBeat, Duration = note.Duration, Type = note.NoteType}; _Text.Text = note.Text; _Text.Style = EStyle.Bold; diff --git a/VocaluxeLib/Menu/CMenu.cs b/VocaluxeLib/Menu/CMenu.cs index 4a3021b9..29e887ab 100644 --- a/VocaluxeLib/Menu/CMenu.cs +++ b/VocaluxeLib/Menu/CMenu.cs @@ -151,7 +151,7 @@ namespace VocaluxeLib.Menu { foreach (string elName in elements) { - T element = (T)Activator.CreateInstance(typeof(T), _PartyModeID); + var element = (T)Activator.CreateInstance(typeof(T), _PartyModeID); if (element.LoadTheme("//root/" + ThemeName, elName, xmlReader, skinIndex)) addElementHandler(element, elName); else @@ -198,7 +198,7 @@ namespace VocaluxeLib.Menu if (_ThemePath == "") return; - XmlWriterSettings settings = new XmlWriterSettings {Indent = true, Encoding = Encoding.UTF8, ConformanceLevel = ConformanceLevel.Document}; + var settings = new XmlWriterSettings {Indent = true, Encoding = Encoding.UTF8, ConformanceLevel = ConformanceLevel.Document}; string file = Path.Combine(_ThemePath, ThemeName + ".xml"); using (XmlWriter writer = XmlWriter.Create(file, settings)) @@ -770,7 +770,7 @@ namespace VocaluxeLib.Menu if (_Interactions.Count <= 0) return; - List items = new List(); + var items = new List(); for (int i = 0; i < _Interactions.Count; i++) { @@ -779,7 +779,7 @@ namespace VocaluxeLib.Menu _Interactions[i].Type != EType.NameSelection && _Interactions[i].Type != EType.Text && _Interactions[i].Type != EType.SongMenu && _Interactions[i].Type != EType.Equalizer && _Interactions[i].Type != EType.Playlist && _Interactions[i].Type != EType.ParticleEffect)) continue; - SZSort zs = new SZSort {ID = i, Z = _GetZValue(i)}; + var zs = new SZSort {ID = i, Z = _GetZValue(i)}; items.Add(zs); } @@ -1105,10 +1105,10 @@ namespace VocaluxeLib.Menu /// private bool _NextInteraction(SKeyEvent key) { - SKeyEvent[] directions = new SKeyEvent[4]; - float[] distances = new float[4]; - int[] stages = new int[4]; - int[] elements = new int[4]; + var directions = new SKeyEvent[4]; + var distances = new float[4]; + var stages = new int[4]; + var elements = new int[4]; for (int i = 0; i < 4; i++) directions[i] = new SKeyEvent(); @@ -1248,11 +1248,11 @@ namespace VocaluxeLib.Menu private float _GetDistanceDirect(SKeyEvent key, SRectF actualRect, SRectF targetRect) { - PointF source = new PointF(actualRect.X + actualRect.W / 2f, actualRect.Y + actualRect.H / 2f); - PointF dest = new PointF(targetRect.X + targetRect.W / 2f, targetRect.Y + targetRect.H / 2f); + var source = new PointF(actualRect.X + actualRect.W / 2f, actualRect.Y + actualRect.H / 2f); + var dest = new PointF(targetRect.X + targetRect.W / 2f, targetRect.Y + targetRect.H / 2f); - PointF vector = new PointF(dest.X - source.X, dest.Y - source.Y); - float distance = (float)Math.Sqrt(vector.X * vector.X + vector.Y * vector.Y); + var vector = new PointF(dest.X - source.X, dest.Y - source.Y); + var distance = (float)Math.Sqrt(vector.X * vector.X + vector.Y * vector.Y); bool inDirection = false; switch (key.Key) { @@ -1281,11 +1281,11 @@ namespace VocaluxeLib.Menu private float _GetDistance180(SKeyEvent key, SRectF actualRect, SRectF targetRect) { - PointF source = new PointF(actualRect.X + actualRect.W / 2f, actualRect.Y + actualRect.H / 2f); - PointF dest = new PointF(targetRect.X + targetRect.W / 2f, targetRect.Y + targetRect.H / 2f); + var source = new PointF(actualRect.X + actualRect.W / 2f, actualRect.Y + actualRect.H / 2f); + var dest = new PointF(targetRect.X + targetRect.W / 2f, targetRect.Y + targetRect.H / 2f); - PointF vector = new PointF(dest.X - source.X, dest.Y - source.Y); - float distance = (float)Math.Sqrt(vector.X * vector.X + vector.Y * vector.Y); + var vector = new PointF(dest.X - source.X, dest.Y - source.Y); + var distance = (float)Math.Sqrt(vector.X * vector.X + vector.Y * vector.Y); bool inDirection = false; switch (key.Key) { @@ -1584,7 +1584,7 @@ namespace VocaluxeLib.Menu private SRectF _GetRect(CInteraction interaction) { - SRectF result = new SRectF(); + var result = new SRectF(); switch (interaction.Type) { case EType.Button: @@ -1808,7 +1808,7 @@ namespace VocaluxeLib.Menu private void _LoadThemeBasics(CXMLReader xmlReader, int skinIndex) { // Backgrounds - CBackground background = new CBackground(_PartyModeID); + var background = new CBackground(_PartyModeID); int i = 1; while (background.LoadTheme("//root/" + ThemeName, "Background" + i, xmlReader, skinIndex)) { @@ -1818,7 +1818,7 @@ namespace VocaluxeLib.Menu } // Statics - CStatic stat = new CStatic(_PartyModeID); + var stat = new CStatic(_PartyModeID); i = 1; while (stat.LoadTheme("//root/" + ThemeName, "Static" + i, xmlReader, skinIndex)) { @@ -1828,7 +1828,7 @@ namespace VocaluxeLib.Menu } // Texts - CText text = new CText(_PartyModeID); + var text = new CText(_PartyModeID); i = 1; while (text.LoadTheme("//root/" + ThemeName, "Text" + i, xmlReader, skinIndex)) { @@ -1838,7 +1838,7 @@ namespace VocaluxeLib.Menu } // ParticleEffects - CParticleEffect partef = new CParticleEffect(_PartyModeID); + var partef = new CParticleEffect(_PartyModeID); i = 1; while (partef.LoadTheme("//root/" + ThemeName, "ParticleEffect" + i, xmlReader, skinIndex)) { diff --git a/VocaluxeLib/Menu/CObjectInteractions.cs b/VocaluxeLib/Menu/CObjectInteractions.cs index 1aafbb94..fb041cff 100644 --- a/VocaluxeLib/Menu/CObjectInteractions.cs +++ b/VocaluxeLib/Menu/CObjectInteractions.cs @@ -307,7 +307,7 @@ namespace VocaluxeLib.Menu if (_Interactions.Count <= 0) return; - List items = new List(); + var items = new List(); for (int i = 0; i < _Interactions.Count; i++) { @@ -320,7 +320,7 @@ namespace VocaluxeLib.Menu _Interactions[i].Type == EType.SongMenu || _Interactions[i].Type == EType.Equalizer)) { - SZSort zs = new SZSort {ID = i, Z = _GetZValue(i)}; + var zs = new SZSort {ID = i, Z = _GetZValue(i)}; items.Add(zs); } } @@ -613,10 +613,10 @@ namespace VocaluxeLib.Menu /// private bool _NextInteraction(SKeyEvent key) { - SKeyEvent[] directions = new SKeyEvent[4]; - float[] distances = new float[4]; - int[] stages = new int[4]; - int[] elements = new int[4]; + var directions = new SKeyEvent[4]; + var distances = new float[4]; + var stages = new int[4]; + var elements = new int[4]; for (int i = 0; i < 4; i++) directions[i] = new SKeyEvent(); @@ -756,11 +756,11 @@ namespace VocaluxeLib.Menu private float _GetDistanceDirect(SKeyEvent key, SRectF actualRect, SRectF targetRect) { - PointF source = new PointF(actualRect.X + actualRect.W / 2f, actualRect.Y + actualRect.H / 2f); - PointF dest = new PointF(targetRect.X + targetRect.W / 2f, targetRect.Y + targetRect.H / 2f); + var source = new PointF(actualRect.X + actualRect.W / 2f, actualRect.Y + actualRect.H / 2f); + var dest = new PointF(targetRect.X + targetRect.W / 2f, targetRect.Y + targetRect.H / 2f); - PointF vector = new PointF(dest.X - source.X, dest.Y - source.Y); - float distance = (float)Math.Sqrt(vector.X * vector.X + vector.Y * vector.Y); + var vector = new PointF(dest.X - source.X, dest.Y - source.Y); + var distance = (float)Math.Sqrt(vector.X * vector.X + vector.Y * vector.Y); bool inDirection = false; switch (key.Key) { @@ -789,11 +789,11 @@ namespace VocaluxeLib.Menu private float _GetDistance180(SKeyEvent key, SRectF actualRect, SRectF targetRect) { - PointF source = new PointF(actualRect.X + actualRect.W / 2f, actualRect.Y + actualRect.H / 2f); - PointF dest = new PointF(targetRect.X + targetRect.W / 2f, targetRect.Y + targetRect.H / 2f); + var source = new PointF(actualRect.X + actualRect.W / 2f, actualRect.Y + actualRect.H / 2f); + var dest = new PointF(targetRect.X + targetRect.W / 2f, targetRect.Y + targetRect.H / 2f); - PointF vector = new PointF(dest.X - source.X, dest.Y - source.Y); - float distance = (float)Math.Sqrt(vector.X * vector.X + vector.Y * vector.Y); + var vector = new PointF(dest.X - source.X, dest.Y - source.Y); + var distance = (float)Math.Sqrt(vector.X * vector.X + vector.Y * vector.Y); bool inDirection = false; switch (key.Key) { @@ -1002,7 +1002,7 @@ namespace VocaluxeLib.Menu private SRectF _GetRect(int interaction) { - SRectF result = new SRectF(); + var result = new SRectF(); switch (_Interactions[interaction].Type) { case EType.Button: diff --git a/VocaluxeLib/Menu/CParticle.cs b/VocaluxeLib/Menu/CParticle.cs index 3e49902b..d6b58aaf 100644 --- a/VocaluxeLib/Menu/CParticle.cs +++ b/VocaluxeLib/Menu/CParticle.cs @@ -203,7 +203,7 @@ namespace VocaluxeLib.Menu break; case EParticleType.Snow: - int maxy = (int)Math.Round(CBase.Settings.GetRenderH() - _Size * 0.4f); + var maxy = (int)Math.Round(CBase.Settings.GetRenderH() - _Size * 0.4f); if (Math.Round(Y) < maxy) { @@ -525,8 +525,8 @@ namespace VocaluxeLib.Menu break; } - int w = (int)(Rect.W - size / 4f); - int h = (int)(Rect.H - size / 4f); + var w = (int)(Rect.W - size / 4f); + var h = (int)(Rect.H - size / 4f); if (w < 0) w = 0; diff --git a/VocaluxeLib/Menu/CPlaylist.cs b/VocaluxeLib/Menu/CPlaylist.cs index 33af9c65..efa54b11 100644 --- a/VocaluxeLib/Menu/CPlaylist.cs +++ b/VocaluxeLib/Menu/CPlaylist.cs @@ -631,7 +631,7 @@ namespace VocaluxeLib.Menu CBase.Playlist.MovePlaylistSongUp(ActivePlaylistID, CurrentPlaylistElement + Offset); UpdatePlaylist(); - SKeyEvent key = new SKeyEvent {Key = Keys.Up}; + var key = new SKeyEvent {Key = Keys.Up}; if (CurrentPlaylistElement > scrollLimit) { @@ -660,7 +660,7 @@ namespace VocaluxeLib.Menu CBase.Playlist.MovePlaylistSongDown(ActivePlaylistID, CurrentPlaylistElement + Offset); UpdatePlaylist(); - SKeyEvent key = new SKeyEvent {Key = Keys.Down}; + var key = new SKeyEvent {Key = Keys.Down}; if (CurrentPlaylistElement >= scrollLimit) { @@ -973,7 +973,7 @@ namespace VocaluxeLib.Menu if (!mouseEvent.LBH && DragAndDropSongID != -1) { - EGameMode gm = EGameMode.TR_GAMEMODE_NORMAL; + var gm = EGameMode.TR_GAMEMODE_NORMAL; CSong song = CBase.Songs.GetSongByID(DragAndDropSongID); if (song != null) @@ -1102,7 +1102,7 @@ namespace VocaluxeLib.Menu for (int i = 0; i < Math.Floor(Rect.H / _Theme.EntryHeight); i++) { - CPlaylistElement en = new CPlaylistElement + var en = new CPlaylistElement { Background = new CStatic(_PartyModeID, _Theme.TextureBackgroundName, BackgroundColor, new SRectF(Rect.X, Rect.Y + (i * _Theme.EntryHeight), Rect.W, _Theme.EntryHeight, Rect.Z)), @@ -1143,7 +1143,7 @@ namespace VocaluxeLib.Menu _PlaylistElementContents.Clear(); for (int i = 0; i < CBase.Playlist.GetPlaylistSongCount(ActivePlaylistID); i++) { - CPlaylistElementContent pec = new CPlaylistElementContent + var pec = new CPlaylistElementContent { SongID = CBase.Playlist.GetPlaylistSong(ActivePlaylistID, i).SongID, Modes = CBase.Songs.GetSongByID(CBase.Playlist.GetPlaylistSong(ActivePlaylistID, i).SongID).AvailableGameModes, @@ -1162,7 +1162,7 @@ namespace VocaluxeLib.Menu _PlaylistElementContents.Clear(); for (int i = 0; i < CBase.Playlist.GetPlaylistSongCount(ActivePlaylistID); i++) { - CPlaylistElementContent pec = new CPlaylistElementContent {SongID = CBase.Playlist.GetPlaylistSong(ActivePlaylistID, i).SongID}; + var pec = new CPlaylistElementContent {SongID = CBase.Playlist.GetPlaylistSong(ActivePlaylistID, i).SongID}; pec.Modes = CBase.Songs.GetSongByID(pec.SongID).AvailableGameModes; pec.Mode = CBase.Playlist.GetPlaylistSong(ActivePlaylistID, i).GameMode; _PlaylistElementContents.Add(pec); diff --git a/VocaluxeLib/Menu/CSelectSlide.cs b/VocaluxeLib/Menu/CSelectSlide.cs index b7f62571..0f6e5d69 100644 --- a/VocaluxeLib/Menu/CSelectSlide.cs +++ b/VocaluxeLib/Menu/CSelectSlide.cs @@ -750,10 +750,10 @@ namespace VocaluxeLib.Menu _ValueBounds.Clear(); for (int i = 0; i < numvis; i++) { - CText text = new CText(0, 0, 0, TextH, MaxW, EAlignment.Center, _Theme.TextStyle, _Theme.TextFont, TextColor, _ValueNames[i + offset], - _ValuePartyModeIDs[i + offset]); + var text = new CText(0, 0, 0, TextH, MaxW, EAlignment.Center, _Theme.TextStyle, _Theme.TextFont, TextColor, _ValueNames[i + offset], + _ValuePartyModeIDs[i + offset]); - SColorF alpha = new SColorF(1f, 1f, 1f, 0.35f); + var alpha = new SColorF(1f, 1f, 1f, 0.35f); if (i + offset == _Selection) { text.Color = SelTextColor; @@ -774,7 +774,7 @@ namespace VocaluxeLib.Menu if (WithTextures) { float dh = text.Y - Rect.Y - Rect.H * 0.1f; - SRectF rect = new SRectF(text.X - dh / 2, Rect.Y + Rect.H * 0.05f, dh, dh, Rect.Z); + var rect = new SRectF(text.X - dh / 2, Rect.Y + Rect.H * 0.05f, dh, dh, Rect.Z); CBase.Drawing.DrawTexture(_Textures[i + offset], rect, alpha); _ValueBounds.Add(rect); } diff --git a/VocaluxeLib/Menu/CText.cs b/VocaluxeLib/Menu/CText.cs index e326d5d8..a0c1e096 100644 --- a/VocaluxeLib/Menu/CText.cs +++ b/VocaluxeLib/Menu/CText.cs @@ -469,7 +469,7 @@ namespace VocaluxeLib.Menu CBase.Fonts.SetStyle(Style); SColorF currentColor = (Selected) ? SelColor : Color; - SColorF color = new SColorF(currentColor.R, currentColor.G, currentColor.B, currentColor.A * Alpha); + var color = new SColorF(currentColor.R, currentColor.G, currentColor.B, currentColor.A * Alpha); CBase.Fonts.DrawText(_Text, Rect.H, Rect.X, Rect.Y, Z, color); @@ -486,7 +486,7 @@ namespace VocaluxeLib.Menu CBase.Fonts.SetStyle(Style); SColorF currentColor = (Selected) ? SelColor : Color; - SColorF color = new SColorF(currentColor.R, currentColor.G, currentColor.B, currentColor.A * Alpha); + var color = new SColorF(currentColor.R, currentColor.G, currentColor.B, currentColor.A * Alpha); CBase.Fonts.DrawText(Text, Rect.H, Rect.X, Rect.Y, Z, color, begin, end); diff --git a/VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs b/VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs index be9dd224..f637bc1f 100644 --- a/VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs +++ b/VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs @@ -518,7 +518,10 @@ namespace VocaluxeLib.Menu.SongMenu _Active = active; } - public virtual bool IsMouseOverActualSelection(SMouseEvent mEvent) { return false; } + public virtual bool IsMouseOverActualSelection(SMouseEvent mEvent) + { + return false; + } public virtual int GetSelectedSong() { diff --git a/VocaluxeLib/Menu/SongMenu/CSongMenuTileBoard.cs b/VocaluxeLib/Menu/SongMenu/CSongMenuTileBoard.cs index d263fe92..55d0e2e3 100644 --- a/VocaluxeLib/Menu/SongMenu/CSongMenuTileBoard.cs +++ b/VocaluxeLib/Menu/SongMenu/CSongMenuTileBoard.cs @@ -92,9 +92,9 @@ namespace VocaluxeLib.Menu.SongMenu { for (int j = 0; j < _NumW; j++) { - SRectF rect = new SRectF(_Theme.SongMenuTileBoard.TileRect.X + j * (_TileW + _SpaceW), - _Theme.SongMenuTileBoard.TileRect.Y + i * (_TileH + _SpaceH), _TileW, _TileH, _Rect.Z); - CStatic tile = new CStatic(_PartyModeID, _CoverTexture, Color, rect); + var rect = new SRectF(_Theme.SongMenuTileBoard.TileRect.X + j * (_TileW + _SpaceW), + _Theme.SongMenuTileBoard.TileRect.Y + i * (_TileH + _SpaceH), _TileW, _TileH, _Rect.Z); + var tile = new CStatic(_PartyModeID, _CoverTexture, Color, rect); _Tiles.Add(tile); } } @@ -423,8 +423,8 @@ namespace VocaluxeLib.Menu.SongMenu time = song.Finish; time -= song.Start; - int min = (int)Math.Floor(time / 60f); - int sec = (int)(time - min * 60f); + var min = (int)Math.Floor(time / 60f); + var sec = (int)(time - min * 60f); _SongLength.Text = min.ToString("00") + ":" + sec.ToString("00"); } } @@ -458,11 +458,11 @@ namespace VocaluxeLib.Menu.SongMenu { if (_Vidtex.Color.A < 1) _CoverBig.Draw(1f, EAspect.Crop); - RectangleF bounds = new RectangleF(_CoverBig.Rect.X, _CoverBig.Rect.Y, _CoverBig.Rect.W, _CoverBig.Rect.H); + var bounds = new RectangleF(_CoverBig.Rect.X, _CoverBig.Rect.Y, _CoverBig.Rect.W, _CoverBig.Rect.H); RectangleF rect; CHelper.SetRect(bounds, out rect, _Vidtex.OrigAspect, EAspect.Crop); - SRectF vidRect = new SRectF(rect.X, rect.Y, rect.Width, rect.Height, _CoverBig.Rect.Z); - SRectF vidRectBounds = new SRectF(bounds.X, bounds.Y, bounds.Width, bounds.Height, 0f); + var vidRect = new SRectF(rect.X, rect.Y, rect.Width, rect.Height, _CoverBig.Rect.Z); + var vidRectBounds = new SRectF(bounds.X, bounds.Y, bounds.Width, bounds.Height, 0f); CBase.Drawing.DrawTexture(_Vidtex, vidRect, _Vidtex.Color, vidRectBounds); CBase.Drawing.DrawTextureReflection(_Vidtex, vidRect, _Vidtex.Color, vidRectBounds, _CoverBig.ReflectionSpace, _CoverBig.ReflectionHeight); @@ -490,7 +490,7 @@ namespace VocaluxeLib.Menu.SongMenu CStatic selCov = GetSelectedSongCover(); if (selCov.Texture == null) return false; - SRectF rect = new SRectF(selCov.Rect.X - selCov.Rect.W*0.2f, selCov.Rect.Y - selCov.Rect.H*0.2f, selCov.Rect.W*1.2f, selCov.Rect.H*1.2f, selCov.Rect.Z); + var rect = new SRectF(selCov.Rect.X - selCov.Rect.W * 0.2f, selCov.Rect.Y - selCov.Rect.H * 0.2f, selCov.Rect.W * 1.2f, selCov.Rect.H * 1.2f, selCov.Rect.Z); return CHelper.IsInBounds(rect, mEvent); } @@ -679,8 +679,8 @@ namespace VocaluxeLib.Menu.SongMenu { for (int j = 0; j < _NumW; j++) { - SRectF rect = new SRectF(_Rect.X + j * (_TileW + _SpaceW), _Rect.Y + i * (_TileH + _SpaceH), _TileW, _TileH, _Rect.Z); - CStatic tile = new CStatic(_PartyModeID, _CoverTexture, Color, rect); + var rect = new SRectF(_Rect.X + j * (_TileW + _SpaceW), _Rect.Y + i * (_TileH + _SpaceH), _TileW, _TileH, _Rect.Z); + var tile = new CStatic(_PartyModeID, _CoverTexture, Color, rect); _Tiles.Add(tile); } } diff --git a/VocaluxeLib/Songs/CBaseNote.cs b/VocaluxeLib/Songs/CBaseNote.cs index a3a5691f..424eba86 100644 --- a/VocaluxeLib/Songs/CBaseNote.cs +++ b/VocaluxeLib/Songs/CBaseNote.cs @@ -1,7 +1,26 @@ -namespace VocaluxeLib.Songs +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +namespace VocaluxeLib.Songs { /// - /// Base class for all note types + /// Base class for all note types /// public abstract class CBaseNote { diff --git a/VocaluxeLib/Songs/CLineBase.cs b/VocaluxeLib/Songs/CLineBase.cs index f2d700fe..ea6e14b7 100644 --- a/VocaluxeLib/Songs/CLineBase.cs +++ b/VocaluxeLib/Songs/CLineBase.cs @@ -1,4 +1,23 @@ -using System.Collections.Generic; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System.Collections.Generic; using System.Linq; namespace VocaluxeLib.Songs diff --git a/VocaluxeLib/Songs/CSong.cs b/VocaluxeLib/Songs/CSong.cs index 9da713e4..93ba8b78 100644 --- a/VocaluxeLib/Songs/CSong.cs +++ b/VocaluxeLib/Songs/CSong.cs @@ -149,7 +149,7 @@ namespace VocaluxeLib.Songs public int DataBaseSongID = -1; public string DateAdded = ""; - public int NumPlayed = 0; + public int NumPlayed; // Notes public readonly CNotes Notes = new CNotes(); @@ -158,7 +158,7 @@ namespace VocaluxeLib.Songs { get { - List gms = new List {IsDuet ? EGameMode.TR_GAMEMODE_DUET : EGameMode.TR_GAMEMODE_NORMAL}; + var gms = new List {IsDuet ? EGameMode.TR_GAMEMODE_DUET : EGameMode.TR_GAMEMODE_NORMAL}; if (Medley.Source != EMedleySource.None) gms.Add(EGameMode.TR_GAMEMODE_MEDLEY); gms.Add(EGameMode.TR_GAMEMODE_SHORTSONG); @@ -172,7 +172,7 @@ namespace VocaluxeLib.Songs public static CSong LoadSong(string filePath) { - CSong song = new CSong(); + var song = new CSong(); return song.ReadHeader(filePath) ? song : null; } @@ -289,7 +289,7 @@ namespace VocaluxeLib.Songs FileName = Path.GetFileName(filePath); - EHeaderFlags headerFlags = new EHeaderFlags(); + var headerFlags = new EHeaderFlags(); StreamReader sr = null; try { @@ -737,7 +737,7 @@ namespace VocaluxeLib.Songs private bool _ParseNote(int player, ENoteType noteType, int start, int length, int tone, string text) { - CSongNote note = new CSongNote(start, length, tone, text, noteType); + var note = new CSongNote(start, length, tone, text, noteType); CVoice voice = Notes.GetVoice(player); return voice.AddNote(note); } @@ -745,7 +745,7 @@ namespace VocaluxeLib.Songs private void _NewSentence(int player, int start) { CVoice voice = Notes.GetVoice(player); - CSongLine line = new CSongLine {StartBeat = start}; + var line = new CSongLine {StartBeat = start}; voice.AddLine(line); } @@ -821,14 +821,14 @@ namespace VocaluxeLib.Songs List sentences = voice.Lines.Select(line => line.Points != 0 ? line.Lyrics : String.Empty).ToList(); // find equal sentences series - List series = new List(); + var series = new List(); for (int i = 0; i < voice.NumLines - 1; i++) { for (int j = i + 1; j < voice.NumLines; j++) { if (sentences[i] != sentences[j] || sentences[i] == "") continue; - SSeries tempSeries = new SSeries {Start = i, End = i}; + var tempSeries = new SSeries {Start = i, End = i}; int max; if (j + j - i > voice.NumLines) diff --git a/VocaluxeLib/Songs/CSongLine.cs b/VocaluxeLib/Songs/CSongLine.cs index 54f713d9..8617a7b8 100644 --- a/VocaluxeLib/Songs/CSongLine.cs +++ b/VocaluxeLib/Songs/CSongLine.cs @@ -1,4 +1,23 @@ -using System; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System; using System.Linq; namespace VocaluxeLib.Songs diff --git a/VocaluxeLib/Songs/CSongNote.cs b/VocaluxeLib/Songs/CSongNote.cs index d62dfeec..7e26cd54 100644 --- a/VocaluxeLib/Songs/CSongNote.cs +++ b/VocaluxeLib/Songs/CSongNote.cs @@ -1,7 +1,26 @@ -namespace VocaluxeLib.Songs +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +namespace VocaluxeLib.Songs { /// - /// Class to represent a note in a song + /// Class to represent a note in a song /// public class CSongNote : CBaseNote { diff --git a/VocaluxeLib/Songs/CSungLine.cs b/VocaluxeLib/Songs/CSungLine.cs index bb06c393..1f53c719 100644 --- a/VocaluxeLib/Songs/CSungLine.cs +++ b/VocaluxeLib/Songs/CSungLine.cs @@ -1,4 +1,23 @@ -using System.Linq; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System.Linq; namespace VocaluxeLib.Songs { diff --git a/VocaluxeLib/Songs/CSungNote.cs b/VocaluxeLib/Songs/CSungNote.cs index eb0aa49a..40fbef2e 100644 --- a/VocaluxeLib/Songs/CSungNote.cs +++ b/VocaluxeLib/Songs/CSungNote.cs @@ -1,12 +1,31 @@ -namespace VocaluxeLib.Songs +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +namespace VocaluxeLib.Songs { /// - /// Note that was sung by a player + /// Note that was sung by a player /// public class CSungNote : CBaseNote { /// - /// Constructor for a sung note that was not hit + /// Constructor for a sung note that was not hit /// /// /// @@ -18,7 +37,7 @@ } /// - /// Constructor for a sung note that hit the given note + /// Constructor for a sung note that hit the given note /// /// /// diff --git a/VocaluxeLib/Songs/CVoice.cs b/VocaluxeLib/Songs/CVoice.cs index 2b8ae897..72071b24 100644 --- a/VocaluxeLib/Songs/CVoice.cs +++ b/VocaluxeLib/Songs/CVoice.cs @@ -1,4 +1,23 @@ -using System.Collections.Generic; +#region license +// /* +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +// */ +#endregion + +using System.Collections.Generic; using System.Linq; namespace VocaluxeLib.Songs