Code cleanup

Added license stuff
This commit is contained in:
Flamefire committed 2013-08-22 00:56:58 +02:00
1 parent cd826bdafd
commit 762d2c80d2
66 files changed
+551 -355

No files matched your search

+2 -2
View File
@@ -697,7 +697,7 @@ namespace Vocaluxe.Base
/// <param name="args">Parameters</param> /// <param name="args">Parameters</param>
public static void LoadCommandLineParams(string[] args) 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 //Complete argument string
string arguments = args.Aggregate(string.Empty, (current, arg) => current + (arg + " ")); string arguments = args.Aggregate(string.Empty, (current, arg) => current + (arg + " "));
@@ -706,7 +706,7 @@ namespace Vocaluxe.Base
foreach (string text in args) 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 //split arg with Spilter-Regex and save in parts
string[] parts = spliterVal.Split(text, 2); string[] parts = spliterVal.Split(text, 2);
+2 -2
View File
@@ -77,11 +77,11 @@ namespace Vocaluxe.Base
{ {
controller.Update(); controller.Update();
SKeyEvent ke = new SKeyEvent(); var ke = new SKeyEvent();
while (controller.PollKeyEvent(ref ke)) while (controller.PollKeyEvent(ref ke))
_KeysPool.Add(ke); _KeysPool.Add(ke);
SMouseEvent me = new SMouseEvent(); var me = new SMouseEvent();
while (controller.PollMouseEvent(ref me)) while (controller.PollMouseEvent(ref me))
_MousePool.Add(me); _MousePool.Add(me);
} }
+61 -77
View File
@@ -71,13 +71,12 @@ namespace Vocaluxe.Base
} }
#region Highscores #region Highscores
public static bool GetDataBaseSongInfos(string artist, string title, out int numPlayed, out string dateAdded, out int highscoreID) public static bool GetDataBaseSongInfos(string artist, string title, out int numPlayed, out string dateAdded, out int highscoreID)
{ {
string sArtist = string.Empty; string sArtist;
string sTitle = string.Empty; string sTitle;
int songID = -1; int songID;
using (SQLiteConnection connection = new SQLiteConnection()) using (var connection = new SQLiteConnection())
{ {
connection.ConnectionString = "Data Source=" + _HighscoreFilePath; connection.ConnectionString = "Data Source=" + _HighscoreFilePath;
@@ -85,11 +84,9 @@ namespace Vocaluxe.Base
{ {
connection.Open(); connection.Open();
} }
catch (Exception) catch (Exception) {}
{
}
using (SQLiteCommand command = new SQLiteCommand(connection)) using (var command = new SQLiteCommand(connection))
{ {
songID = _GetDataBaseSongID(artist, title, 0, command); songID = _GetDataBaseSongID(artist, title, 0, command);
highscoreID = songID; highscoreID = songID;
@@ -100,7 +97,7 @@ namespace Vocaluxe.Base
public static void IncreaseSongCounter(SPlayer player) public static void IncreaseSongCounter(SPlayer player)
{ {
using (SQLiteConnection connection = new SQLiteConnection()) using (var connection = new SQLiteConnection())
{ {
connection.ConnectionString = "Data Source=" + _HighscoreFilePath; connection.ConnectionString = "Data Source=" + _HighscoreFilePath;
@@ -108,11 +105,9 @@ namespace Vocaluxe.Base
{ {
connection.Open(); connection.Open();
} }
catch (Exception) catch (Exception) {}
{
}
using (SQLiteCommand command = new SQLiteCommand(connection)) using (var command = new SQLiteCommand(connection))
{ {
int dataBaseSongID = _GetDataBaseSongID(player, command); int dataBaseSongID = _GetDataBaseSongID(player, command);
_IncreaseSongCounter(dataBaseSongID, command); _IncreaseSongCounter(dataBaseSongID, command);
@@ -122,7 +117,7 @@ namespace Vocaluxe.Base
public static void IncreaseSongCounter(int dataBaseSongID) public static void IncreaseSongCounter(int dataBaseSongID)
{ {
using (SQLiteConnection connection = new SQLiteConnection()) using (var connection = new SQLiteConnection())
{ {
connection.ConnectionString = "Data Source=" + _HighscoreFilePath; connection.ConnectionString = "Data Source=" + _HighscoreFilePath;
@@ -130,21 +125,17 @@ namespace Vocaluxe.Base
{ {
connection.Open(); connection.Open();
} }
catch (Exception) catch (Exception) {}
{
}
using (SQLiteCommand command = new SQLiteCommand(connection)) using (var command = new SQLiteCommand(connection))
{
_IncreaseSongCounter(dataBaseSongID, command); _IncreaseSongCounter(dataBaseSongID, command);
}
} }
} }
public static int AddScore(string playerName, int score, int lineNr, long date, int medley, int duet, int shortSong, int difficulty, 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) string artist, string title, int numPlayed, string filePath)
{ {
using (SQLiteConnection connection = new SQLiteConnection()) using (var connection = new SQLiteConnection())
{ {
connection.ConnectionString = "Data Source=" + filePath; connection.ConnectionString = "Data Source=" + filePath;
@@ -157,7 +148,7 @@ namespace Vocaluxe.Base
return -1; return -1;
} }
using (SQLiteCommand command = new SQLiteCommand(connection)) using (var command = new SQLiteCommand(connection))
{ {
int dataBaseSongID = _GetDataBaseSongID(artist, title, numPlayed, command); int dataBaseSongID = _GetDataBaseSongID(artist, title, numPlayed, command);
int result = _AddScore(playerName, score, lineNr, date, medley, duet, shortSong, difficulty, dataBaseSongID, 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) public static int AddScore(SPlayer player)
{ {
using (SQLiteConnection connection = new SQLiteConnection()) using (var connection = new SQLiteConnection())
{ {
connection.ConnectionString = "Data Source=" + _HighscoreFilePath; connection.ConnectionString = "Data Source=" + _HighscoreFilePath;
@@ -181,7 +172,7 @@ namespace Vocaluxe.Base
return -1; return -1;
} }
using (SQLiteCommand command = new SQLiteCommand(connection)) using (var command = new SQLiteCommand(connection))
{ {
int dataBaseSongID = CSongs.GetSong(player.SongID).DataBaseSongID; 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, 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<SScores> scores, SPlayer player) public static void LoadScore(out List<SScores> scores, SPlayer player)
{ {
using (SQLiteConnection connection = new SQLiteConnection()) using (var connection = new SQLiteConnection())
{ {
connection.ConnectionString = "Data Source=" + _HighscoreFilePath; connection.ConnectionString = "Data Source=" + _HighscoreFilePath;
@@ -271,7 +262,7 @@ namespace Vocaluxe.Base
return; return;
} }
using (SQLiteCommand command = new SQLiteCommand(connection)) using (var command = new SQLiteCommand(connection))
{ {
int medley = 0; int medley = 0;
if (player.Medley) if (player.Medley)
@@ -301,7 +292,7 @@ namespace Vocaluxe.Base
{ {
while (reader.Read()) while (reader.Read())
{ {
SScores score = new SScores var score = new SScores
{ {
Name = reader.GetString(0), Name = reader.GetString(0),
Score = reader.GetInt32(1), Score = reader.GetInt32(1),
@@ -361,7 +352,7 @@ namespace Vocaluxe.Base
command.Parameters.Add("@title", DbType.String, 0).Value = title; command.Parameters.Add("@title", DbType.String, 0).Value = title;
command.Parameters.Add("@artist", DbType.String, 0).Value = artist; command.Parameters.Add("@artist", DbType.String, 0).Value = artist;
command.Parameters.Add("@numplayed", DbType.Int32, 0).Value = defNumPlayed; 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.ExecuteNonQuery();
command.CommandText = "SELECT id FROM Songs WHERE [Title] = @title AND [Artist] = @artist"; command.CommandText = "SELECT id FROM Songs WHERE [Title] = @title AND [Artist] = @artist";
@@ -388,7 +379,7 @@ namespace Vocaluxe.Base
numPlayed = 0; numPlayed = 0;
dateAdded = String.Empty; dateAdded = String.Empty;
using (SQLiteConnection connection = new SQLiteConnection()) using (var connection = new SQLiteConnection())
{ {
connection.ConnectionString = "Data Source=" + filePath; connection.ConnectionString = "Data Source=" + filePath;
@@ -401,7 +392,7 @@ namespace Vocaluxe.Base
return false; 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.CommandText = "SELECT Artist, Title, NumPlayed, DateAdded FROM Songs WHERE [id] = @id";
command.Parameters.Add("@id", DbType.String, 0).Value = songID; command.Parameters.Add("@id", DbType.String, 0).Value = songID;
@@ -460,7 +451,7 @@ namespace Vocaluxe.Base
private static void _CreateHighscoreDB(string filePath) private static void _CreateHighscoreDB(string filePath)
{ {
using (SQLiteConnection connection = new SQLiteConnection()) using (var connection = new SQLiteConnection())
{ {
connection.ConnectionString = "Data Source=" + filePath; connection.ConnectionString = "Data Source=" + filePath;
@@ -473,7 +464,7 @@ namespace Vocaluxe.Base
return; 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.CommandText = "CREATE TABLE IF NOT EXISTS Version ( id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, Value INTEGER NOT NULL);";
command.ExecuteNonQuery(); command.ExecuteNonQuery();
@@ -496,7 +487,7 @@ namespace Vocaluxe.Base
private static void _CreateHighscoreDBV1(string filePath) private static void _CreateHighscoreDBV1(string filePath)
{ {
using (SQLiteConnection connection = new SQLiteConnection()) using (var connection = new SQLiteConnection())
{ {
connection.ConnectionString = "Data Source=" + filePath; connection.ConnectionString = "Data Source=" + filePath;
@@ -509,7 +500,7 @@ namespace Vocaluxe.Base
return; 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.CommandText = "CREATE TABLE IF NOT EXISTS Version ( id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, Value INTEGER NOT NULL);";
command.ExecuteNonQuery(); command.ExecuteNonQuery();
@@ -536,7 +527,7 @@ namespace Vocaluxe.Base
/// <returns></returns> /// <returns></returns>
private static bool _CreateOrConvert(string filePath) private static bool _CreateOrConvert(string filePath)
{ {
using (SQLiteConnection connection = new SQLiteConnection()) using (var connection = new SQLiteConnection())
{ {
connection.ConnectionString = "Data Source=" + filePath; connection.ConnectionString = "Data Source=" + filePath;
@@ -549,7 +540,7 @@ namespace Vocaluxe.Base
return false; return false;
} }
using (SQLiteCommand command = new SQLiteCommand(connection)) using (var command = new SQLiteCommand(connection))
{ {
command.CommandText = "PRAGMA user_version"; command.CommandText = "PRAGMA user_version";
SQLiteDataReader reader = command.ExecuteReader(); SQLiteDataReader reader = command.ExecuteReader();
@@ -646,7 +637,7 @@ namespace Vocaluxe.Base
/// <returns>True if succeeded</returns> /// <returns>True if succeeded</returns>
private static bool _ConvertFrom110(string filePath) private static bool _ConvertFrom110(string filePath)
{ {
using (SQLiteConnection connection = new SQLiteConnection()) using (var connection = new SQLiteConnection())
{ {
connection.ConnectionString = "Data Source=" + filePath; connection.ConnectionString = "Data Source=" + filePath;
@@ -659,7 +650,7 @@ namespace Vocaluxe.Base
return false; 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 //The USDX database has no column for LineNr, Medley and Duet so just fill 0 in there
command.CommandText = command.CommandText =
@@ -669,8 +660,8 @@ namespace Vocaluxe.Base
command.CommandText = "INSERT INTO Songs SELECT ID, Artist, Title, TimesPlayed from US_Songs"; command.CommandText = "INSERT INTO Songs SELECT ID, Artist, Title, TimesPlayed from US_Songs";
command.ExecuteNonQuery(); command.ExecuteNonQuery();
List<SData> scores = new List<SData>(); var scores = new List<SData>();
List<SData> songs = new List<SData>(); var songs = new List<SData>();
command.CommandText = "SELECT id, PlayerName, Date FROM Scores"; command.CommandText = "SELECT id, PlayerName, Date FROM Scores";
SQLiteDataReader reader = command.ExecuteReader(); SQLiteDataReader reader = command.ExecuteReader();
@@ -679,7 +670,7 @@ namespace Vocaluxe.Base
{ {
while (reader.Read()) 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; Int64 ticks = 0;
try try
@@ -703,7 +694,7 @@ namespace Vocaluxe.Base
{ {
while (reader.Read()) 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); songs.Add(data);
} }
} }
@@ -759,7 +750,7 @@ namespace Vocaluxe.Base
/// <returns>True if succeeded</returns> /// <returns>True if succeeded</returns>
private static bool _ConvertFrom101(string filePath) private static bool _ConvertFrom101(string filePath)
{ {
using (SQLiteConnection connection = new SQLiteConnection()) using (var connection = new SQLiteConnection())
{ {
connection.ConnectionString = "Data Source=" + filePath; connection.ConnectionString = "Data Source=" + filePath;
@@ -772,7 +763,7 @@ namespace Vocaluxe.Base
return false; return false;
} }
using (SQLiteCommand command = new SQLiteCommand(connection)) using (var command = new SQLiteCommand(connection))
{ {
command.CommandText = "PRAGMA table_info(US_Scores);"; command.CommandText = "PRAGMA table_info(US_Scores);";
bool dateExists = false; bool dateExists = false;
@@ -803,8 +794,8 @@ namespace Vocaluxe.Base
command.ExecuteNonQuery(); command.ExecuteNonQuery();
// convert from CP1252 to UTF8 // convert from CP1252 to UTF8
List<SData> scores = new List<SData>(); var scores = new List<SData>();
List<SData> songs = new List<SData>(); var songs = new List<SData>();
Sqlite3.sqlite3 oldDB; Sqlite3.sqlite3 oldDB;
int res = Sqlite3.sqlite3_open(filePath, out 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) + ")"); CLog.LogError("Error opening Database: " + filePath + " (" + Sqlite3.sqlite3_errmsg(oldDB) + ")");
else 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); res = Sqlite3.sqlite3_prepare_v2(oldDB, "SELECT id, Artist, Title FROM Songs", -1, ref stmt, 0);
if (res != Sqlite3.SQLITE_OK) if (res != Sqlite3.SQLITE_OK)
@@ -826,7 +817,7 @@ namespace Vocaluxe.Base
while (Sqlite3.sqlite3_step(stmt) == Sqlite3.SQLITE_ROW) 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); byte[] bytes = Sqlite3.sqlite3_column_rawbytes(stmt, 1);
data.Str1 = bytes != null ? utf8.GetString(Encoding.Convert(cp1252, utf8, bytes)) : "Someone"; 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) 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); byte[] bytes = Sqlite3.sqlite3_column_rawbytes(stmt, 1);
data.Str1 = bytes != null ? utf8.GetString(Encoding.Convert(cp1252, utf8, bytes)) : "Someone"; data.Str1 = bytes != null ? utf8.GetString(Encoding.Convert(cp1252, utf8, bytes)) : "Someone";
@@ -918,20 +909,16 @@ namespace Vocaluxe.Base
bool updated = true; bool updated = true;
if (currentVersion < 2) if (currentVersion < 2)
{
updated &= _ConvertV1toV2(connection); updated &= _ConvertV1toV2(connection);
}
if (currentVersion < 3) if (currentVersion < 3)
{
updated &= _ConvertV2toV3(connection); updated &= _ConvertV2toV3(connection);
}
return updated; return updated;
} }
private static bool _ConvertV1toV2(SQLiteConnection connection) 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.CommandText = "ALTER TABLE Scores ADD ShortSong INTEGER";
command.ExecuteNonQuery(); command.ExecuteNonQuery();
@@ -948,17 +935,14 @@ namespace Vocaluxe.Base
private static bool _ConvertV2toV3(SQLiteConnection connection) 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.ExecuteNonQuery();
command.CommandText = "UPDATE Songs SET [DateAdded] = @DateAdded"; 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.ExecuteNonQuery();
command.CommandText = "UPDATE Version SET [Value] = @version"; 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.ExecuteNonQuery();
command.Dispose(); command.Dispose();
@@ -968,7 +952,7 @@ namespace Vocaluxe.Base
private static bool _ImportData(string sourceDBPath) private static bool _ImportData(string sourceDBPath)
{ {
#region open db #region open db
using (SQLiteConnection connSource = new SQLiteConnection()) using (var connSource = new SQLiteConnection())
{ {
connSource.ConnectionString = "Data Source=" + sourceDBPath; connSource.ConnectionString = "Data Source=" + sourceDBPath;
@@ -983,7 +967,7 @@ namespace Vocaluxe.Base
} }
#endregion open db #endregion open db
using (SQLiteCommand cmdSource = new SQLiteCommand(connSource)) using (var cmdSource = new SQLiteCommand(connSource))
{ {
#region import table scores #region import table scores
cmdSource.CommandText = "SELECT SongID, PlayerName, Score, LineNr, Date, Medley, Duet, ShortSong, Difficulty FROM Scores"; cmdSource.CommandText = "SELECT SongID, PlayerName, Score, LineNr, Date, Medley, Duet, ShortSong, Difficulty FROM Scores";
@@ -1039,7 +1023,7 @@ namespace Vocaluxe.Base
_ConnectionCover.Open(); _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.CommandText = "SELECT id, width, height FROM Cover WHERE [Path] = @path";
command.Parameters.Add("@path", DbType.String, 0).Value = coverPath; 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) else if (origin.Height > origin.Width && origin.Height > h)
w = (int)Math.Round((float)h / origin.Height * origin.Width); 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)) using (Graphics g = Graphics.FromImage(bmp))
g.DrawImage(origin, new Rectangle(0, 0, w, h)); g.DrawImage(origin, new Rectangle(0, 0, w, h));
@@ -1166,7 +1150,7 @@ namespace Vocaluxe.Base
private static bool _InitCoverDB() private static bool _InitCoverDB()
{ {
using (SQLiteConnection connection = new SQLiteConnection()) using (var connection = new SQLiteConnection())
{ {
connection.ConnectionString = "Data Source=" + _CoverFilePath; connection.ConnectionString = "Data Source=" + _CoverFilePath;
@@ -1179,7 +1163,7 @@ namespace Vocaluxe.Base
return false; return false;
} }
using (SQLiteCommand command = new SQLiteCommand(connection)) using (var command = new SQLiteCommand(connection))
{ {
command.CommandText = "SELECT Value FROM Version"; command.CommandText = "SELECT Value FROM Version";
@@ -1219,7 +1203,7 @@ namespace Vocaluxe.Base
private static void _CreateCoverDB() private static void _CreateCoverDB()
{ {
using (SQLiteConnection connection = new SQLiteConnection()) using (var connection = new SQLiteConnection())
{ {
connection.ConnectionString = "Data Source=" + _CoverFilePath; connection.ConnectionString = "Data Source=" + _CoverFilePath;
@@ -1232,7 +1216,7 @@ namespace Vocaluxe.Base
return; 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.CommandText = "CREATE TABLE IF NOT EXISTS Version ( id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, Value INTEGER NOT NULL);";
command.ExecuteNonQuery(); command.ExecuteNonQuery();
@@ -1258,7 +1242,7 @@ namespace Vocaluxe.Base
{ {
bool result = false; bool result = false;
using (SQLiteConnection connection = new SQLiteConnection()) using (var connection = new SQLiteConnection())
{ {
connection.ConnectionString = "Data Source=" + _CreditsRessourcesFilePath; connection.ConnectionString = "Data Source=" + _CreditsRessourcesFilePath;
try try
@@ -1269,7 +1253,7 @@ namespace Vocaluxe.Base
{ {
return false; 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.CommandText = "SELECT id, width, height FROM Images WHERE [Path] = @path";
command.Parameters.Add("@path", DbType.String, 0).Value = fileName; command.Parameters.Add("@path", DbType.String, 0).Value = fileName;
@@ -1391,7 +1375,7 @@ namespace Vocaluxe.Base
private static bool _InitCreditsRessourcesDB() private static bool _InitCreditsRessourcesDB()
{ {
using (SQLiteConnection connection = new SQLiteConnection()) using (var connection = new SQLiteConnection())
{ {
connection.ConnectionString = "Data Source=" + _CreditsRessourcesFilePath; connection.ConnectionString = "Data Source=" + _CreditsRessourcesFilePath;
@@ -1404,7 +1388,7 @@ namespace Vocaluxe.Base
return false; return false;
} }
using (SQLiteCommand command = new SQLiteCommand(connection)) using (var command = new SQLiteCommand(connection))
{ {
command.CommandText = "SELECT Value FROM Version"; command.CommandText = "SELECT Value FROM Version";
@@ -1484,14 +1468,14 @@ namespace Vocaluxe.Base
private static byte[] _GetBytes(SQLiteDataReader reader) private static byte[] _GetBytes(SQLiteDataReader reader)
{ {
const int chunkSize = 2 * 1024; const int chunkSize = 2 * 1024;
byte[] buffer = new byte[chunkSize]; var buffer = new byte[chunkSize];
long fieldOffset = 0; long fieldOffset = 0;
using (MemoryStream stream = new MemoryStream()) using (var stream = new MemoryStream())
{ {
long bytesRead; long bytesRead;
while ((bytesRead = reader.GetBytes(0, fieldOffset, buffer, 0, buffer.Length)) > 0) 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); Buffer.BlockCopy(buffer, 0, actualRead, 0, (int)bytesRead);
stream.Write(actualRead, 0, actualRead.Length); stream.Write(actualRead, 0, actualRead.Length);
fieldOffset += bytesRead; fieldOffset += bytesRead;
@@ -1502,7 +1486,7 @@ namespace Vocaluxe.Base
private static long _UnixTimeToTicks(int unixTime) 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); t70 = t70.AddSeconds(unixTime);
return t70.Ticks; return t70.Ticks;
} }
+1 -1
View File
@@ -206,7 +206,7 @@ namespace Vocaluxe.Base
if (texture == null) if (texture == null)
return; 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; RectangleF rect;
CHelper.SetRect(bounds, out rect, texture.OrigAspect, aspect); CHelper.SetRect(bounds, out rect, texture.OrigAspect, aspect);
+10 -10
View File
@@ -218,7 +218,7 @@ namespace Vocaluxe.Base
if (_Fading) if (_Fading)
{ {
long fadeTime = (long)(CConfig.FadeTime * 1000); var fadeTime = (long)(CConfig.FadeTime * 1000);
if ((_FadingTimer.ElapsedMilliseconds < fadeTime) && (CConfig.FadeTime > 0)) if ((_FadingTimer.ElapsedMilliseconds < fadeTime) && (CConfig.FadeTime > 0))
{ {
@@ -349,10 +349,10 @@ namespace Vocaluxe.Base
#region private stuff #region private stuff
private static bool _HandleInputs(CKeys keys, CMouse mouse) private static bool _HandleInputs(CKeys keys, CMouse mouse)
{ {
SKeyEvent keyEvent = new SKeyEvent(); var keyEvent = new SKeyEvent();
SMouseEvent mouseEvent = new SMouseEvent(); var mouseEvent = new SMouseEvent();
SKeyEvent inputKeyEvent = new SKeyEvent(); var inputKeyEvent = new SKeyEvent();
SMouseEvent inputMouseEvent = new SMouseEvent(); var inputMouseEvent = new SMouseEvent();
bool popupPlayerControlAllowed = _CurrentScreen != EScreens.ScreenOptionsRecord && _CurrentScreen != EScreens.ScreenSing && bool popupPlayerControlAllowed = _CurrentScreen != EScreens.ScreenOptionsRecord && _CurrentScreen != EScreens.ScreenSing &&
(_CurrentScreen != EScreens.ScreenSong || (_CurrentScreen != EScreens.ScreenSong ||
@@ -541,8 +541,8 @@ namespace Vocaluxe.Base
private static bool _HandleInputThemeEditor(CKeys keys, CMouse mouse) private static bool _HandleInputThemeEditor(CKeys keys, CMouse mouse)
{ {
SKeyEvent keyEvent = new SKeyEvent(); var keyEvent = new SKeyEvent();
SMouseEvent mouseEvent = new SMouseEvent(); var mouseEvent = new SMouseEvent();
while (keys.PollEvent(ref keyEvent)) while (keys.PollEvent(ref keyEvent))
{ {
@@ -598,7 +598,7 @@ namespace Vocaluxe.Base
if (CConfig.DebugLevel == EDebugLevel.TR_CONFIG_OFF) if (CConfig.DebugLevel == EDebugLevel.TR_CONFIG_OFF)
return; return;
List<String> debugOutput = new List<string> {CTime.GetFPS().ToString("FPS: 000")}; var debugOutput = new List<string> {CTime.GetFPS().ToString("FPS: 000")};
if (CConfig.DebugLevel >= EDebugLevel.TR_CONFIG_LEVEL1) if (CConfig.DebugLevel >= EDebugLevel.TR_CONFIG_LEVEL1)
{ {
@@ -627,11 +627,11 @@ namespace Vocaluxe.Base
CFonts.Style = EStyle.Normal; CFonts.Style = EStyle.Normal;
CFonts.SetFont("Normal"); CFonts.SetFont("Normal");
CFonts.Height = 25; CFonts.Height = 25;
SColorF gray = new SColorF(1f, 1f, 1f, 0.5f); var gray = new SColorF(1f, 1f, 1f, 0.5f);
float y = 0; float y = 0;
foreach (string txt in debugOutput) 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)); CDraw.DrawColor(gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.ZNear));
CFonts.DrawText(txt, rect.X, rect.Y, CSettings.ZNear); CFonts.DrawText(txt, rect.X, rect.Y, CSettings.ZNear);
y += rect.Height; y += rect.Height;
+5 -5
View File
@@ -66,7 +66,7 @@ namespace Vocaluxe.Base
public static IEnumerable<string> GetLanguageNames() public static IEnumerable<string> GetLanguageNames()
{ {
string[] languages = new string[_Languages.Count]; var languages = new string[_Languages.Count];
for (int i = 0; i < _Languages.Count; i++) for (int i = 0; i < _Languages.Count; i++)
languages[i] = _Languages[i].Name; languages[i] = _Languages[i].Name;
@@ -81,7 +81,7 @@ namespace Vocaluxe.Base
_Settings.Encoding = Encoding.UTF8; _Settings.Encoding = Encoding.UTF8;
_Settings.ConformanceLevel = ConformanceLevel.Document; _Settings.ConformanceLevel = ConformanceLevel.Document;
List<string> files = new List<string>(); var files = new List<string>();
files.AddRange(CHelper.ListFiles(CSettings.FolderLanguages, "*.xml", true, true)); files.AddRange(CHelper.ListFiles(CSettings.FolderLanguages, "*.xml", true, true));
foreach (string file in files) foreach (string file in files)
@@ -166,7 +166,7 @@ namespace Vocaluxe.Base
public static bool LoadPartyLanguageFiles(int partyModeID, string path) public static bool LoadPartyLanguageFiles(int partyModeID, string path)
{ {
List<string> files = new List<string>(); var files = new List<string>();
files.AddRange(CHelper.ListFiles(path, "*.xml", true, true)); files.AddRange(CHelper.ListFiles(path, "*.xml", true, true));
return files.All(file => _LoadPartyLanguageFile(partyModeID, file)); return files.All(file => _LoadPartyLanguageFile(partyModeID, file));
@@ -208,7 +208,7 @@ namespace Vocaluxe.Base
if (nr == -1) if (nr == -1)
return true; return true;
SPartyLanguage lang = new SPartyLanguage {PartyModeID = partyModeID}; var lang = new SPartyLanguage {PartyModeID = partyModeID};
if (!_LoadLanguageEntries(xmlReader, out lang.Texts)) if (!_LoadLanguageEntries(xmlReader, out lang.Texts))
return false; return false;
@@ -221,7 +221,7 @@ namespace Vocaluxe.Base
private static void _LoadLanguageFile(string fileName) 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); CXMLReader xmlReader = CXMLReader.OpenFile(lang.LanguageFilePath);
if (xmlReader == null) if (xmlReader == null)
+1 -1
View File
@@ -304,7 +304,7 @@ namespace Vocaluxe.Base
pm.PartyMode.Initialize(); pm.PartyMode.Initialize();
pm.PartyMode.SetFolder(Path.Combine(Directory.GetCurrentDirectory(), Path.Combine(CSettings.FolderPartyModes, pm.Folder))); 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; return pm;
int themeIndex = CTheme.GetThemeIndex(pm.PartyModeID); int themeIndex = CTheme.GetThemeIndex(pm.PartyModeID);
+20 -20
View File
@@ -179,7 +179,7 @@ namespace Vocaluxe.Base
if (_ProfileChangedCallbacks.Count == 0) if (_ProfileChangedCallbacks.Count == 0)
return; return;
EProfileChangedFlags flags = EProfileChangedFlags.None; var flags = EProfileChangedFlags.None;
if (_AvatarsChanged) if (_AvatarsChanged)
flags = EProfileChangedFlags.Avatar; flags = EProfileChangedFlags.Avatar;
@@ -214,7 +214,7 @@ namespace Vocaluxe.Base
public static void LoadProfiles() public static void LoadProfiles()
{ {
SChange change = new SChange {Action = EAction.LoadProfiles}; var change = new SChange {Action = EAction.LoadProfiles};
lock (_QueueMutex) lock (_QueueMutex)
{ {
@@ -224,7 +224,7 @@ namespace Vocaluxe.Base
public static void LoadAvatars() public static void LoadAvatars()
{ {
SChange change = new SChange {Action = EAction.LoadAvatars}; var change = new SChange {Action = EAction.LoadAvatars};
lock (_QueueMutex) lock (_QueueMutex)
{ {
@@ -237,7 +237,7 @@ namespace Vocaluxe.Base
if (newProfile == null) if (newProfile == null)
return; return;
SChange change = new SChange {Action = EAction.AddProfile, Profile = newProfile}; var change = new SChange {Action = EAction.AddProfile, Profile = newProfile};
lock (_QueueMutex) lock (_QueueMutex)
{ {
@@ -250,7 +250,7 @@ namespace Vocaluxe.Base
if (editProfile == null) if (editProfile == null)
return; return;
SChange change = new SChange {Action = EAction.EditProfile, Profile = editProfile}; var change = new SChange {Action = EAction.EditProfile, Profile = editProfile};
lock (_QueueMutex) lock (_QueueMutex)
{ {
@@ -263,7 +263,7 @@ namespace Vocaluxe.Base
if (!IsProfileIDValid(profileID)) if (!IsProfileIDValid(profileID))
return; return;
SChange change = new SChange {Action = EAction.DeleteProfile, ProfileID = profileID}; var change = new SChange {Action = EAction.DeleteProfile, ProfileID = profileID};
lock (_QueueMutex) lock (_QueueMutex)
{ {
@@ -276,7 +276,7 @@ namespace Vocaluxe.Base
if (newAvatar == null) if (newAvatar == null)
return; return;
SChange change = new SChange {Action = EAction.AddAvatar, Avatar = newAvatar}; var change = new SChange {Action = EAction.AddAvatar, Avatar = newAvatar};
lock (_QueueMutex) lock (_QueueMutex)
{ {
@@ -289,7 +289,7 @@ namespace Vocaluxe.Base
if (editAvatar == null) if (editAvatar == null)
return; return;
SChange change = new SChange {Action = EAction.EditAvatar, Avatar = editAvatar}; var change = new SChange {Action = EAction.EditAvatar, Avatar = editAvatar};
lock (_QueueMutex) lock (_QueueMutex)
{ {
@@ -302,7 +302,7 @@ namespace Vocaluxe.Base
if (_Profiles.Count == 0) if (_Profiles.Count == 0)
return null; return null;
List<CProfile> list = new List<CProfile>(_Profiles.Values); var list = new List<CProfile>(_Profiles.Values);
list.Sort(_CompareByPlayerName); list.Sort(_CompareByPlayerName);
return list.ToArray(); return list.ToArray();
} }
@@ -312,7 +312,7 @@ namespace Vocaluxe.Base
if (_Avatars.Count == 0) if (_Avatars.Count == 0)
return null; return null;
CAvatar[] result = new CAvatar[_Avatars.Count]; var result = new CAvatar[_Avatars.Count];
_Avatars.Values.CopyTo(result, 0); _Avatars.Values.CopyTo(result, 0);
return result; return result;
@@ -320,7 +320,7 @@ namespace Vocaluxe.Base
public static int NewProfile(string fileName = "") public static int NewProfile(string fileName = "")
{ {
CProfile profile = new CProfile var profile = new CProfile
{ {
FileName = fileName != "" ? Path.Combine(CSettings.FolderProfiles, fileName) : String.Empty FileName = fileName != "" ? Path.Combine(CSettings.FolderProfiles, fileName) : String.Empty
}; };
@@ -336,7 +336,7 @@ namespace Vocaluxe.Base
public static int NewAvatar(string fileName) public static int NewAvatar(string fileName)
{ {
CAvatar avatar = new CAvatar(-1); var avatar = new CAvatar(-1);
if (!avatar.LoadFromFile(fileName)) if (!avatar.LoadFromFile(fileName))
return -1; return -1;
@@ -511,10 +511,10 @@ namespace Vocaluxe.Base
{ {
_LoadAvatars(); _LoadAvatars();
List<string> knownFiles = new List<string>(); var knownFiles = new List<string>();
if (_Profiles.Count > 0) if (_Profiles.Count > 0)
{ {
int[] ids = new int[_Profiles.Keys.Count]; var ids = new int[_Profiles.Keys.Count];
_Profiles.Keys.CopyTo(ids, 0); _Profiles.Keys.CopyTo(ids, 0);
foreach (int id in ids) foreach (int id in ids)
{ {
@@ -528,7 +528,7 @@ namespace Vocaluxe.Base
} }
} }
List<string> files = new List<string>(); var files = new List<string>();
files.AddRange(CHelper.ListFiles(CSettings.FolderProfiles, "*.xml", true, true)); files.AddRange(CHelper.ListFiles(CSettings.FolderProfiles, "*.xml", true, true));
foreach (string file in files) foreach (string file in files)
@@ -536,7 +536,7 @@ namespace Vocaluxe.Base
if (knownFiles.Contains(Path.GetFileName(file))) if (knownFiles.Contains(Path.GetFileName(file)))
continue; continue;
CProfile profile = new CProfile var profile = new CProfile
{ {
FileName = Path.Combine(CSettings.FolderProfiles, file) FileName = Path.Combine(CSettings.FolderProfiles, file)
}; };
@@ -553,10 +553,10 @@ namespace Vocaluxe.Base
private static void _LoadAvatars() private static void _LoadAvatars()
{ {
List<string> knownFiles = new List<string>(); var knownFiles = new List<string>();
if (_Avatars.Count > 0) if (_Avatars.Count > 0)
{ {
int[] ids = new int[_Avatars.Keys.Count]; var ids = new int[_Avatars.Keys.Count];
_Avatars.Keys.CopyTo(ids, 0); _Avatars.Keys.CopyTo(ids, 0);
foreach (int id in ids) foreach (int id in ids)
{ {
@@ -567,7 +567,7 @@ namespace Vocaluxe.Base
} }
} }
List<string> files = new List<string>(); var files = new List<string>();
files.AddRange(CHelper.ListFiles(CSettings.FolderProfiles, "*.png", true, true)); files.AddRange(CHelper.ListFiles(CSettings.FolderProfiles, "*.png", true, true));
files.AddRange(CHelper.ListFiles(CSettings.FolderProfiles, "*.jpg", true, true)); files.AddRange(CHelper.ListFiles(CSettings.FolderProfiles, "*.jpg", true, true));
files.AddRange(CHelper.ListFiles(CSettings.FolderProfiles, "*.jpeg", true, true)); files.AddRange(CHelper.ListFiles(CSettings.FolderProfiles, "*.jpeg", true, true));
@@ -578,7 +578,7 @@ namespace Vocaluxe.Base
if (knownFiles.Contains(Path.GetFileName(file))) if (knownFiles.Contains(Path.GetFileName(file)))
continue; continue;
CAvatar avatar = new CAvatar(-1); var avatar = new CAvatar(-1);
if (avatar.LoadFromFile(file)) if (avatar.LoadFromFile(file))
{ {
avatar.ID = _AvatarIDs.Dequeue(); avatar.ID = _AvatarIDs.Dequeue();
+1 -1
View File
@@ -209,7 +209,7 @@ namespace Vocaluxe.Base
public static void CreateFolders() public static void CreateFolders()
{ {
List<string> folders = new List<string> {FolderCover, FolderFonts, FolderProfiles, FolderSongs, FolderScreenshots, FolderBackgroundMusic, FolderSounds, FolderPlaylists}; var folders = new List<string> {FolderCover, FolderFonts, FolderProfiles, FolderSongs, FolderScreenshots, FolderBackgroundMusic, FolderSounds, FolderPlaylists};
foreach (string folder in folders) foreach (string folder in folders)
{ {
+2 -2
View File
@@ -114,7 +114,7 @@ namespace Vocaluxe.Base
private List<CSongPointer> _CreateSortList(string fieldName) private List<CSongPointer> _CreateSortList(string fieldName)
{ {
List<CSongPointer> sortList = new List<CSongPointer>(); var sortList = new List<CSongPointer>();
if (fieldName == "") if (fieldName == "")
CSongs.Filter.FilteredSongs.ForEach(song => sortList.Add(new CSongPointer(song.ID, ""))); CSongs.Filter.FilteredSongs.ForEach(song => sortList.Add(new CSongPointer(song.ID, "")));
else else
@@ -135,7 +135,7 @@ namespace Vocaluxe.Base
sortList.Add(new CSongPointer(song.ID, (String)value)); sortList.Add(new CSongPointer(song.ID, (String)value));
else else
{ {
List<String> values = (List<String>)value; var values = (List<String>)value;
if (values.Count == 0) if (values.Count == 0)
sortList.Add(new CSongPointer(song.ID, "")); sortList.Add(new CSongPointer(song.ID, ""));
else else
+2 -2
View File
@@ -251,7 +251,7 @@ namespace Vocaluxe.Base
{ {
get get
{ {
List<CSong> songs = new List<CSong>(); var songs = new List<CSong>();
if (_IsCatIndexValid(_CatIndex)) if (_IsCatIndexValid(_CatIndex))
{ {
// ReSharper disable LoopCanBeConvertedToQuery // ReSharper disable LoopCanBeConvertedToQuery
@@ -298,7 +298,7 @@ namespace Vocaluxe.Base
_Songs.Clear(); _Songs.Clear();
CLog.StartBenchmark(2, "List Songs"); CLog.StartBenchmark(2, "List Songs");
List<string> files = new List<string>(); var files = new List<string>();
foreach (string p in CConfig.SongFolder) foreach (string p in CConfig.SongFolder)
{ {
string path = p; string path = p;
+4 -4
View File
@@ -450,11 +450,11 @@ namespace Vocaluxe.Base
int len = _AnalysisBuffer.Length * 2; int len = _AnalysisBuffer.Length * 2;
if (_Stream.Length >= len) if (_Stream.Length >= len)
{ {
byte[] buf = new byte[len]; var buf = new byte[len];
_Stream.Position -= len; _Stream.Position -= len;
_Stream.Read(buf, 0, len); _Stream.Read(buf, 0, len);
byte[] b = new byte[2]; var b = new byte[2];
for (int i = 0; i < _AnalysisBuffer.Length; i++) for (int i = 0; i < _AnalysisBuffer.Length; i++)
{ {
b[0] = buf[i * 2]; b[0] = buf[i * 2];
@@ -496,7 +496,7 @@ namespace Vocaluxe.Base
double maxWeight = -1.0; double maxWeight = -1.0;
double minWeight = 1.0; double minWeight = 1.0;
int maxTone = -1; int maxTone = -1;
float[] weigth = new float[_NumHalfTones]; var weigth = new float[_NumHalfTones];
// analyze halftones // analyze halftones
// Note: at the lowest tone (~65Hz) and a buffer-size of 4096 // Note: at the lowest tone (~65Hz) and a buffer-size of 4096
@@ -535,7 +535,7 @@ namespace Vocaluxe.Base
private double _AnalyzeAutocorrelationFreq(double freq) private double _AnalyzeAutocorrelationFreq(double freq)
{ {
int sampleIndex = 0; // index of sample to analyze 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 int correlatingSampleIndex = sampleIndex + samplesPerPeriod; // index of sample one period ahead
double accumDist = 0.0; // accumulated distances double accumDist = 0.0; // accumulated distances
+1 -1
View File
@@ -168,7 +168,7 @@ namespace Vocaluxe.Base
} }
if (_VideoTexture == null) if (_VideoTexture == null)
return; return;
RectangleF bounds = new RectangleF(0f, 0f, CSettings.RenderW, CSettings.RenderH); var bounds = new RectangleF(0f, 0f, CSettings.RenderW, CSettings.RenderH);
RectangleF rect; RectangleF rect;
CHelper.SetRect(bounds, out rect, _VideoTexture.OrigAspect, EAspect.Crop); CHelper.SetRect(bounds, out rect, _VideoTexture.OrigAspect, EAspect.Crop);
+4 -4
View File
@@ -258,8 +258,8 @@ namespace Vocaluxe.Base.Fonts
Height = height; Height = height;
SetFont(text.Font); SetFont(text.Font);
Style = text.Style; Style = text.Style;
RectangleF result = new RectangleF(text.X, text.Y, GetTextWidth(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))); GetTextHeight(CLanguage.Translate(text.Text, text.TranslationID)));
//restore old values //restore old values
Height = oldHeight; Height = oldHeight;
_CurrentFont = oldFont; _CurrentFont = oldFont;
@@ -286,7 +286,7 @@ namespace Vocaluxe.Base.Fonts
int i = 1; int i = 1;
while (xmlReader.GetValue("//root/Fonts/Font" + i + "/Folder", out value, value)) 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; bool ok = true;
@@ -297,7 +297,7 @@ namespace Vocaluxe.Base.Fonts
ok &= xmlReader.GetValue("//root/Fonts/Font" + i + "/FileNormal", out value, value); ok &= xmlReader.GetValue("//root/Fonts/Font" + i + "/FileNormal", out value, value);
sf.FileNormal = value; sf.FileNormal = value;
value = Path.Combine(fontFolder, Path.Combine(sf.Folder, value)); value = Path.Combine(fontFolder, Path.Combine(sf.Folder, value));
CFont f = new CFont(value); var f = new CFont(value);
sf.Normal = f; sf.Normal = f;
ok &= xmlReader.GetValue("//root/Fonts/Font" + i + "/FileItalic", out value, value); ok &= xmlReader.GetValue("//root/Fonts/Font" + i + "/FileItalic", out value, value);
+20 -1
View File
@@ -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 <http://www.gnu.org/licenses/>.
// */
#endregion
using System;
using System.IO; using System.IO;
using System.Text; using System.Text;
using System.Security.Cryptography; using System.Security.Cryptography;
+20 -1
View File
@@ -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 <http://www.gnu.org/licenses/>.
// */
#endregion
namespace Vocaluxe.Base.Server
{ {
public struct SLoginData public struct SLoginData
{ {
+2 -2
View File
@@ -70,7 +70,7 @@ namespace Vocaluxe.GameModes
{ {
protected override CSong _PrepareSong(CSong song) 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 // set lines to short mode
newSong.Notes.SetMedley(song.Notes.GetVoice(0).Lines[0].FirstNoteBeat, song.ShortEnd); 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) 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) if (newSong.Start < 0f)
newSong.Start = 0f; newSong.Start = 0f;
+13 -13
View File
@@ -448,7 +448,7 @@ namespace Vocaluxe.Lib.Draw
if (_Device.SetTextureStageState(0, TextureStage.AlphaOperation, TextureOperation.Modulate).IsFailure) if (_Device.SetTextureStageState(0, TextureStage.AlphaOperation, TextureOperation.Modulate).IsFailure)
CLog.LogError("Failed to set alpha operation"); CLog.LogError("Failed to set alpha operation");
Int16[] indices = new Int16[6]; var indices = new Int16[6];
indices[0] = 0; indices[0] = 0;
indices[1] = 1; indices[1] = 1;
indices[2] = 2; 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 creates a new white texture and adds it to the texture pool
//This texture is used for the DrawRect method //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); Graphics g = Graphics.FromImage(blankMap);
g.Clear(Color.White); g.Clear(Color.White);
@@ -674,7 +674,7 @@ namespace Vocaluxe.Lib.Draw
CTexture texture = _GetNewTexture(_W, _H); CTexture texture = _GetNewTexture(_W, _H);
Surface backbufferSurface = _Device.GetBackBuffer(0, 0); 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 textureSurface = tex.GetSurfaceLevel(0);
Surface.FromSurface(textureSurface, backbufferSurface, Filter.Default, 0, new Rectangle(0, 0, _W, _H), new Rectangle(0, 0, _W, _H)); Surface.FromSurface(textureSurface, backbufferSurface, Filter.Default, 0, new Rectangle(0, 0, _W, _H), new Rectangle(0, 0, _W, _H));
backbufferSurface.Dispose(); backbufferSurface.Dispose();
@@ -722,7 +722,7 @@ namespace Vocaluxe.Lib.Draw
//create a surface of the frame //create a surface of the frame
using (Surface surface = _Device.GetBackBuffer(0, 0)) 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.Save(Path.Combine(path, file + i.ToString("00000") + ".bmp"), ImageFormat.Bmp);
screen.Dispose(); screen.Dispose();
} }
@@ -742,8 +742,8 @@ namespace Vocaluxe.Lib.Draw
/// <param name="y2">The end y-value</param> /// <param name="y2">The end y-value</param>
public void DrawLine(int a, int r, int g, int b, int w, int x1, int y1, int x2, int y2) 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)}; var lineVector = new Vector2[] {new Vector2(x1, y1), new Vector2(x2, y2)};
using (Line line = new Line(_Device)) using (var line = new Line(_Device))
{ {
line.Antialias = true; line.Antialias = true;
line.Begin(); line.Begin();
@@ -850,7 +850,7 @@ namespace Vocaluxe.Lib.Draw
w = _CheckForNextPowerOf2(w); w = _CheckForNextPowerOf2(w);
h = _CheckForNextPowerOf2(h); 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; Bitmap bmp2 = null;
byte[] data; 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 //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 //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); _WriteDataToTexture(t, w, data);
return t; return t;
} }
@@ -939,7 +939,7 @@ namespace Vocaluxe.Lib.Draw
{ {
texture.ID = _IDs.Dequeue(); texture.ID = _IDs.Dequeue();
_D3DTextures.Add(texture.ID, null); _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); _TexturesToLoad.Enqueue(queue);
} }
return texture; return texture;
@@ -1122,7 +1122,7 @@ namespace Vocaluxe.Lib.Draw
if (!mirrored) 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[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[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()); 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 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[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[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()); 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(); 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[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[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()); 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.A = 0;
Color transparent = color.AsColor(); 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[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[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()); vert[2] = new STexturedColoredVertex(new Vector3(rx2, -ry2, rect.Z + CGraphics.ZOffset), new Vector2(x2, y1), transparent.ToArgb());
+7 -7
View File
@@ -289,7 +289,7 @@ namespace Vocaluxe.Lib.Draw
public CTexture CopyScreen() public CTexture CopyScreen()
{ {
Bitmap bmp = new Bitmap(_Backbuffer); var bmp = new Bitmap(_Backbuffer);
_Bitmaps.Add(bmp); _Bitmaps.Add(bmp);
CTexture texture = _GetNewTexture(bmp.Width, bmp.Height); CTexture texture = _GetNewTexture(bmp.Width, bmp.Height);
@@ -333,7 +333,7 @@ namespace Vocaluxe.Lib.Draw
public CTexture AddTexture(Bitmap bmp) public CTexture AddTexture(Bitmap bmp)
{ {
Bitmap bmp2 = new Bitmap(bmp); var bmp2 = new Bitmap(bmp);
_Bitmaps.Add(bmp2); _Bitmaps.Add(bmp2);
CTexture texture = _GetNewTexture(bmp.Width, bmp.Height); CTexture texture = _GetNewTexture(bmp.Width, bmp.Height);
@@ -357,7 +357,7 @@ namespace Vocaluxe.Lib.Draw
if (tex.TexturePath == texturePath) if (tex.TexturePath == texturePath)
return tex; return tex;
} }
using (Bitmap bmp = new Bitmap(texturePath)) using (var bmp = new Bitmap(texturePath))
{ {
CTexture texture = AddTexture(bmp); CTexture texture = AddTexture(bmp);
texture.TexturePath = texturePath; texture.TexturePath = texturePath;
@@ -389,7 +389,7 @@ namespace Vocaluxe.Lib.Draw
public CTexture AddTexture(int w, int h, byte[] data) 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); BitmapData bmpData = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb);
Marshal.Copy(data, 0, bmpData.Scan0, data.Length); Marshal.Copy(data, 0, bmpData.Scan0, data.Length);
@@ -459,13 +459,13 @@ namespace Vocaluxe.Lib.Draw
private static Bitmap _ColorizeBitmap(Bitmap original, SColorF color) 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)) 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); ia.SetColorMatrix(cm);
+5 -5
View File
@@ -124,7 +124,7 @@ namespace Vocaluxe.Lib.Draw
bool ok = false; bool ok = false;
try 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); _Control = new GLControl(gm, 2, 1, GraphicsContextFlags.Default);
if (_Control.GraphicsMode != null) if (_Control.GraphicsMode != null)
ok = true; ok = true;
@@ -473,7 +473,7 @@ namespace Vocaluxe.Lib.Draw
Close(); Close();
} }
catch {} catch {}
CTexture[] textures = new CTexture[_Textures.Count]; var textures = new CTexture[_Textures.Count];
_Textures.Values.CopyTo(textures, 0); _Textures.Values.CopyTo(textures, 0);
for (int i = 0; i < _Textures.Count; i++) for (int i = 0; i < _Textures.Count; i++)
RemoveTexture(ref textures[i]); RemoveTexture(ref textures[i]);
@@ -552,7 +552,7 @@ namespace Vocaluxe.Lib.Draw
int width = GetScreenWidth(); int width = GetScreenWidth();
int height = GetScreenHeight(); 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); 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); w = MathHelper.NextPowerOfTwo(w);
h = MathHelper.NextPowerOfTwo(h); 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); GL.BindTexture(TextureTarget.Texture2D, texture.Name);
Bitmap bmp2 = null; Bitmap bmp2 = null;
@@ -813,7 +813,7 @@ namespace Vocaluxe.Lib.Draw
lock (_MutexTexture) lock (_MutexTexture)
{ {
texture.ID = _IDs.Dequeue(); 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); _TexturesToLoad.Enqueue(queue);
_Textures[texture.ID] = texture; _Textures[texture.ID] = texture;
} }
+5 -5
View File
@@ -204,7 +204,7 @@ namespace Vocaluxe.Lib.Input.WiiMote
bool lb = false; bool lb = false;
bool rb = gesture == EGesture.Back; bool rb = gesture == EGesture.Back;
Keys key = Keys.None; var key = Keys.None;
if (ws.ButtonState.A && !_ButtonStates[0]) if (ws.ButtonState.A && !_ButtonStates[0])
lb = true; lb = true;
@@ -246,7 +246,7 @@ namespace Vocaluxe.Lib.Input.WiiMote
if (key != Keys.None) 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) lock (_KeyCopyLock)
{ {
@@ -260,8 +260,8 @@ namespace Vocaluxe.Lib.Input.WiiMote
float rx = ((p.X / 1024f) - reducing) * factor; float rx = ((p.X / 1024f) - reducing) * factor;
float ry = ((p.Y / 768f) - reducing) * factor; float ry = ((p.Y / 768f) - reducing) * factor;
int x = (int)(rx * CSettings.RenderW); var x = (int)(rx * CSettings.RenderW);
int y = (int)(ry * CSettings.RenderH); var y = (int)(ry * CSettings.RenderH);
bool lbh = !lb && ws.ButtonState.A; bool lbh = !lb && ws.ButtonState.A;
@@ -272,7 +272,7 @@ namespace Vocaluxe.Lib.Input.WiiMote
if (gesture == EGesture.ScrollDown) if (gesture == EGesture.ScrollDown)
wheel = 1; wheel = 1;
SMouseEvent mpool = new SMouseEvent(); var mpool = new SMouseEvent();
bool trigger = false; bool trigger = false;
if (!lb && !rb && (p.X != _OldPosition.X || p.Y != _OldPosition.Y)) if (!lb && !rb && (p.X != _OldPosition.X || p.Y != _OldPosition.Y))
+2 -2
View File
@@ -320,7 +320,7 @@ namespace Vocaluxe.Lib.Input.WiiMote
if (_Handle != IntPtr.Zero && Connected) if (_Handle != IntPtr.Zero && Connected)
{ {
byte[] buff = new byte[_ReportLength]; var buff = new byte[_ReportLength];
try try
{ {
@@ -348,7 +348,7 @@ namespace Vocaluxe.Lib.Input.WiiMote
return false; return false;
} }
EInputReport type = (EInputReport)buff[0]; var type = (EInputReport)buff[0];
switch (type) switch (type)
{ {
+6 -6
View File
@@ -147,7 +147,7 @@ namespace Vocaluxe.Lib.Playlist
Songs = new List<CPlaylistSong>(); Songs = new List<CPlaylistSong>();
List<string> songs = xmlReader.GetValues("Songs"); List<string> songs = xmlReader.GetValues("Songs");
EGameMode gm = EGameMode.TR_GAMEMODE_NORMAL; var gm = EGameMode.TR_GAMEMODE_NORMAL;
foreach (string song in songs) foreach (string song in songs)
{ {
@@ -157,7 +157,7 @@ namespace Vocaluxe.Lib.Playlist
xmlReader.GetValue("//root/Songs/" + song + "/Title", out title, String.Empty); xmlReader.GetValue("//root/Songs/" + song + "/Title", out title, String.Empty);
xmlReader.TryGetEnumValue("//root/Songs/" + song + "/GameMode", ref gm); 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) foreach (CSong curSong in CSongs.AllSongs)
{ {
@@ -182,14 +182,14 @@ namespace Vocaluxe.Lib.Playlist
public void AddSong(int songID) 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); Songs.Add(song);
} }
public void AddSong(int songID, EGameMode gm) 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); 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) if (sourceNr < 0 || destNr < 0 || sourceNr == destNr || sourceNr > Songs.Count - 1 || destNr > Songs.Count - 1)
return; return;
CPlaylistSong ps = new CPlaylistSong(Songs[sourceNr]); var ps = new CPlaylistSong(Songs[sourceNr]);
Songs.RemoveAt(sourceNr); Songs.RemoveAt(sourceNr);
Songs.Insert(destNr, ps); Songs.Insert(destNr, ps);
} }
@@ -226,7 +226,7 @@ namespace Vocaluxe.Lib.Playlist
if (destNr < 0 || destNr > Songs.Count - 1) if (destNr < 0 || destNr > Songs.Count - 1)
return; return;
CPlaylistSong ps = new CPlaylistSong(songID, gm); var ps = new CPlaylistSong(songID, gm);
Songs.Insert(destNr, ps); Songs.Insert(destNr, ps);
} }
} }
+10 -10
View File
@@ -53,9 +53,9 @@ namespace Vocaluxe.Lib.Sound
int id = 0; int id = 0;
foreach (DeviceInformation dev in devices) 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) if (device.Channels > 2)
device.Channels = 2; //more are not supported in vocaluxe device.Channels = 2; //more are not supported in vocaluxe
@@ -89,9 +89,9 @@ namespace Vocaluxe.Lib.Sound
foreach (CBuffer buffer in _Buffer) foreach (CBuffer buffer in _Buffer)
buffer.Reset(); buffer.Reset();
bool[] active = new bool[_Devices.Count]; var active = new bool[_Devices.Count];
Guid[] guid = new Guid[_Devices.Count]; var guid = new Guid[_Devices.Count];
short[] channels = new short[_Devices.Count]; var channels = new short[_Devices.Count];
for (int dev = 0; dev < _Devices.Count; dev++) for (int dev = 0; dev < _Devices.Count; dev++)
{ {
active[dev] = false; active[dev] = false;
@@ -105,7 +105,7 @@ namespace Vocaluxe.Lib.Sound
{ {
if (active[i]) 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.SampleDataReady += _OnDataReady;
source.Start(); source.Start();
@@ -209,8 +209,8 @@ namespace Vocaluxe.Lib.Sound
{ {
if (_Initialized) if (_Initialized)
{ {
byte[] leftBuffer = new byte[e.Data.Length / 2]; var leftBuffer = new byte[e.Data.Length / 2];
byte[] rightBuffer = new byte[e.Data.Length / 2]; var rightBuffer = new byte[e.Data.Length / 2];
//[]: Sample, L: Left channel R: Right channel //[]: Sample, L: Left channel R: Right channel
//[LR][LR][LR][LR][LR][LR] //[LR][LR][LR][LR][LR][LR]
@@ -318,7 +318,7 @@ namespace Vocaluxe.Lib.Sound
for (int i = 0; i < _BufferPortionCount; i++) 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); _Notifications.Add(notification);
} }
@@ -371,7 +371,7 @@ namespace Vocaluxe.Lib.Sound
int bufferPortionSamples = _BufferPortionSize / sizeof(byte); int bufferPortionSamples = _BufferPortionSize / sizeof(byte);
// Buffer type must match this.waveFormat.FormatTag and this.waveFormat.BitsPerSample // Buffer type must match this.waveFormat.FormatTag and this.waveFormat.BitsPerSample
byte[] bufferPortion = new byte[bufferPortionSamples]; var bufferPortion = new byte[bufferPortionSamples];
_CaptureBuffer.Start(true); _CaptureBuffer.Start(true);
+2 -2
View File
@@ -65,14 +65,14 @@ namespace Vocaluxe.Lib.Sound
public int Load(string media) public int Load(string media)
{ {
Uri u = new Uri(media); var u = new Uri(media);
int i = CGstreamerAudioWrapper.Load(u.AbsoluteUri); int i = CGstreamerAudioWrapper.Load(u.AbsoluteUri);
return i; return i;
} }
public int Load(string media, bool prescan) public int Load(string media, bool prescan)
{ {
Uri u = new Uri(media); var u = new Uri(media);
int i = CGstreamerAudioWrapper.Load(u.AbsoluteUri, prescan); int i = CGstreamerAudioWrapper.Load(u.AbsoluteUri, prescan);
return i; return i;
} }
+5 -5
View File
@@ -106,8 +106,8 @@ namespace Vocaluxe.Lib.Sound
public int Load(string media, bool prescan) public int Load(string media, bool prescan)
{ {
SAudioStreams stream = new SAudioStreams(0); var stream = new SAudioStreams(0);
COpenAlStream decoder = new COpenAlStream(); var decoder = new COpenAlStream();
if (decoder.Open(media) > -1) if (decoder.Open(media) > -1)
{ {
@@ -595,7 +595,7 @@ namespace Vocaluxe.Lib.Sound
_CurrentTime = 0f; _CurrentTime = 0f;
_Timer.Reset(); _Timer.Reset();
SAudioStreams stream = new SAudioStreams(0) {Handle = _Buffers[0]}; var stream = new SAudioStreams(0) {Handle = _Buffers[0]};
if (stream.Handle != 0) if (stream.Handle != 0)
{ {
@@ -782,7 +782,7 @@ namespace Vocaluxe.Lib.Sound
return; return;
} }
byte[] buf = new byte[_BufferSize]; var buf = new byte[_BufferSize];
lock (_MutexData) lock (_MutexData)
{ {
@@ -793,7 +793,7 @@ namespace Vocaluxe.Lib.Sound
_Data.Read(buf); _Data.Read(buf);
byte[] b = new byte[2]; var b = new byte[2];
for (int i = 0; i < buf.Length; i += _ByteCount) for (int i = 0; i < buf.Length; i += _ByteCount)
{ {
b[0] = buf[i]; b[0] = buf[i];
+8 -8
View File
@@ -91,8 +91,8 @@ namespace Vocaluxe.Lib.Sound
public int Load(string media, bool prescan) public int Load(string media, bool prescan)
{ {
SAudioStreams stream = new SAudioStreams(0); var stream = new SAudioStreams(0);
CPortAudioStream decoder = new CPortAudioStream(); var decoder = new CPortAudioStream();
if (decoder.Open(media) > -1) if (decoder.Open(media) > -1)
{ {
@@ -599,11 +599,11 @@ namespace Vocaluxe.Lib.Sound
_CurrentTime = 0f; _CurrentTime = 0f;
_SyncTimer.Time = _CurrentTime; _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, ChannelCount = format.ChannelCount,
Device = _ApiInfo.DefaultOutputDevice, Device = _ApiInfo.DefaultOutputDevice,
@@ -611,7 +611,7 @@ namespace Vocaluxe.Lib.Sound
SuggestedLatency = _OutputDeviceInfo.DefaultLowOutputLatency SuggestedLatency = _OutputDeviceInfo.DefaultLowOutputLatency
}; };
uint bufsize = (uint)CConfig.AudioBufferSize; var bufsize = (uint)CConfig.AudioBufferSize;
lock (_Mutex) lock (_Mutex)
{ {
_ErrorCheck("OpenDefaultStream (playback)", CPortAudio.Pa_OpenStream( _ErrorCheck("OpenDefaultStream (playback)", CPortAudio.Pa_OpenStream(
@@ -797,7 +797,7 @@ namespace Vocaluxe.Lib.Sound
CPortAudio.EPaStreamCallbackFlags statusFlags, CPortAudio.EPaStreamCallbackFlags statusFlags,
IntPtr userData) IntPtr userData)
{ {
byte[] buf = new byte[frameCount * _ByteCount]; var buf = new byte[frameCount * _ByteCount];
if (_Paused) if (_Paused)
{ {
@@ -818,7 +818,7 @@ namespace Vocaluxe.Lib.Sound
{ {
_Data.Read(buf); _Data.Read(buf);
byte[] b = new byte[2]; var b = new byte[2];
for (int i = 0; i < buf.Length; i += _ByteCount) for (int i = 0; i < buf.Length; i += _ByteCount)
{ {
b[0] = buf[i]; b[0] = buf[i];
+6 -6
View File
@@ -73,7 +73,7 @@ namespace Vocaluxe.Lib.Sound
CPortAudio.SPaDeviceInfo info = CPortAudio.PaGetDeviceInfo(i); CPortAudio.SPaDeviceInfo info = CPortAudio.PaGetDeviceInfo(i);
if (info.HostApi == hostAPI && info.MaxInputChannels > 0) 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) if (dev.Channels > 2)
dev.Channels = 2; //more are not supported in vocaluxe 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++) for (int i = 0; i < _RecHandle.Length; i++)
_RecHandle[i] = IntPtr.Zero; _RecHandle[i] = IntPtr.Zero;
bool[] active = new bool[_Devices.Count]; var active = new bool[_Devices.Count];
for (int dev = 0; dev < _Devices.Count; dev++) for (int dev = 0; dev < _Devices.Count; dev++)
{ {
active[dev] = false; active[dev] = false;
@@ -135,7 +135,7 @@ namespace Vocaluxe.Lib.Sound
{ {
if (active[i]) if (active[i])
{ {
CPortAudio.SPaStreamParameters inputParams = new CPortAudio.SPaStreamParameters var inputParams = new CPortAudio.SPaStreamParameters
{ {
ChannelCount = _Devices[i].Channels, ChannelCount = _Devices[i].Channels,
Device = _Devices[i].ID, Device = _Devices[i].ID,
@@ -283,9 +283,9 @@ namespace Vocaluxe.Lib.Sound
frameCount *= 4; frameCount *= 4;
if (frameCount > 0 && input != IntPtr.Zero) if (frameCount > 0 && input != IntPtr.Zero)
{ {
byte[] recbuffer = new byte[frameCount]; var recbuffer = new byte[frameCount];
byte[] leftBuffer = new byte[frameCount / 2]; var leftBuffer = new byte[frameCount / 2];
byte[] rightBuffer = new byte[frameCount / 2]; var rightBuffer = new byte[frameCount / 2];
// copy from managed to unmanaged memory // copy from managed to unmanaged memory
Marshal.Copy(input, recbuffer, 0, (int)frameCount); Marshal.Copy(input, recbuffer, 0, (int)frameCount);
@@ -124,7 +124,7 @@ namespace Vocaluxe.Lib.Sound.Decoder
public float GetLength() public float GetLength()
{ {
return _FileOpened ? _Instance.Info.Duration / 1000f:0; return _FileOpened ? _Instance.Info.Duration / 1000f : 0;
} }
public void SetPosition(float time) public void SetPosition(float time)
@@ -134,7 +134,7 @@ namespace Vocaluxe.Lib.Sound.Decoder
try try
{ {
CAcinerella.AcSeek(_Audiodecoder, (time>_CurrentTime)?0:-1, (Int64)(time * 1000f)); CAcinerella.AcSeek(_Audiodecoder, (time > _CurrentTime) ? 0 : -1, (Int64)(time * 1000f));
} }
catch (Exception) catch (Exception)
{ {
@@ -161,7 +161,7 @@ namespace Vocaluxe.Lib.Sound.Decoder
if (frameFinished) if (frameFinished)
{ {
SACDecoder decoder = (SACDecoder)Marshal.PtrToStructure(_Audiodecoder, typeof(SACDecoder)); var decoder = (SACDecoder)Marshal.PtrToStructure(_Audiodecoder, typeof(SACDecoder));
timeStamp = (float)decoder.Timecode; timeStamp = (float)decoder.Timecode;
_CurrentTime = timeStamp; _CurrentTime = timeStamp;
+5 -5
View File
@@ -363,7 +363,7 @@ namespace Vocaluxe.Lib.Video.Acinerella
{ {
lock (_Lock) 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) 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) 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) 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) lock (_Lock)
{ {
return _ac_seek(pAcDecoder, dir, targetPos)!=0; return _ac_seek(pAcDecoder, dir, targetPos) != 0;
} }
} }
+19
View File
@@ -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 <http://www.gnu.org/licenses/>.
// */
#endregion
using System; using System;
using System.Diagnostics; using System.Diagnostics;
using System.IO; using System.IO;
+20 -1
View File
@@ -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 <http://www.gnu.org/licenses/>.
// */
#endregion
using System;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
namespace Vocaluxe.Lib.Video.Acinerella namespace Vocaluxe.Lib.Video.Acinerella
+1 -1
View File
@@ -55,7 +55,7 @@ namespace Vocaluxe.Lib.Video
int i = -1; int i = -1;
try try
{ {
Uri u = new Uri(videoFileName); var u = new Uri(videoFileName);
i = CGstreamerVideoWrapper.LoadVideo(u.AbsoluteUri); i = CGstreamerVideoWrapper.LoadVideo(u.AbsoluteUri);
return i; return i;
} }
+4 -4
View File
@@ -65,7 +65,7 @@ namespace Vocaluxe.Lib.Webcam
{ {
lock (_MutexData) 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); BitmapData bitmapdata = bmp.LockBits(new Rectangle(0, 0, _Width, _Height), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb);
Marshal.Copy(_Data, 0, bitmapdata.Scan0, _Data.Length); Marshal.Copy(_Data, 0, bitmapdata.Scan0, _Data.Length);
bmp.UnlockBits(bitmapdata); bmp.UnlockBits(bitmapdata);
@@ -80,17 +80,17 @@ namespace Vocaluxe.Lib.Webcam
_WebcamDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice); _WebcamDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice);
foreach (FilterInfo info in _WebcamDevices) foreach (FilterInfo info in _WebcamDevices)
{ {
SWebcamDevice device = new SWebcamDevice var device = new SWebcamDevice
{ {
Name = info.Name, Name = info.Name,
MonikerString = info.MonikerString, MonikerString = info.MonikerString,
Capabilities = new List<SCapabilities>() Capabilities = new List<SCapabilities>()
}; };
VideoCaptureDevice tmpdev = new VideoCaptureDevice(info.MonikerString); var tmpdev = new VideoCaptureDevice(info.MonikerString);
foreach (VideoCapabilities capabilities in tmpdev.VideoCapabilities) foreach (VideoCapabilities capabilities in tmpdev.VideoCapabilities)
{ {
SCapabilities item = new SCapabilities var item = new SCapabilities
{ {
Framerate = capabilities.FrameRate, Framerate = capabilities.FrameRate,
Height = capabilities.FrameSize.Height, Height = capabilities.FrameSize.Height,
+1 -1
View File
@@ -253,7 +253,7 @@ namespace Vocaluxe
[HandleProcessCorruptedStateExceptions] [HandleProcessCorruptedStateExceptions]
private static void UnhandledExceptionHandler(object sender, UnhandledExceptionEventArgs args) private static void UnhandledExceptionHandler(object sender, UnhandledExceptionEventArgs args)
{ {
Exception e = (Exception)args.ExceptionObject; var e = (Exception)args.ExceptionObject;
string stackTrace = ""; string stackTrace = "";
try try
{ {
@@ -201,7 +201,7 @@ namespace Vocaluxe.Screens
CGame.Reset(); CGame.Reset();
CGame.ClearSongs(); CGame.ClearSongs();
EGameMode gm = EGameMode.TR_GAMEMODE_NORMAL; var gm = EGameMode.TR_GAMEMODE_NORMAL;
if (CSongs.AllSongs[songNr].IsDuet) if (CSongs.AllSongs[songNr].IsDuet)
gm = EGameMode.TR_GAMEMODE_DUET; gm = EGameMode.TR_GAMEMODE_DUET;
+5 -5
View File
@@ -293,12 +293,12 @@ namespace Vocaluxe.Screens
CStatic image = GetNewStatic(texture, new SColorF(1, 1, 1, 1), new SRectF(-1, -1, 400, 120, -4)); 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); var particleRect = new SRectF(-1, -1, partRectSize, partRectSize, -6);
SRectF imgDotRect = new SRectF(particleRect) {Z = -5}; var imgDotRect = new SRectF(particleRect) {Z = -5};
CStatic imgDot = GetNewStatic(texDot, new SColorF(1, 1, 1, 1), imgDotRect); CStatic imgDot = GetNewStatic(texDot, new SColorF(1, 1, 1, 1), imgDotRect);
CParticleEffect particle = _GetStarParticles(partCount, isRight, particleRect, bigParticles); 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) 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)); new SRectF((float)(CSettings.RenderW - _TexLogo.OrigSize.Width) / 2, -270, _TexLogo.OrigSize.Width, _TexLogo.OrigSize.Height, -2));
//Little stars for logo //Little stars for logo
int numstars = (int)(_Logo.Rect.W * 0.25f / 2f); var 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 partRect = new SRectF(_Logo.Rect.X, _Logo.Rect.Y, _Logo.Rect.W, _Logo.Rect.H, -1);
_StarsRed = _GetStarParticles(numstars, true, partRect, true); _StarsRed = _GetStarParticles(numstars, true, partRect, true);
_StarsBlue = _GetStarParticles(numstars, false, partRect, true); _StarsBlue = _GetStarParticles(numstars, false, partRect, true);
+1 -1
View File
@@ -56,7 +56,7 @@ namespace Vocaluxe.Screens
{ {
base.Init(); base.Init();
List<string> texts = new List<string> {_TextSongName, _TextSongMode}; var texts = new List<string> {_TextSongName, _TextSongMode};
_TextNumber = new string[_NumEntrys]; _TextNumber = new string[_NumEntrys];
for (int i = 0; i < _NumEntrys; i++) for (int i = 0; i < _NumEntrys; i++)
+7 -7
View File
@@ -75,7 +75,7 @@ namespace Vocaluxe.Screens
{ {
base.Init(); base.Init();
List<string> values = new List<string> {_StaticWarning}; var values = new List<string> {_StaticWarning};
values.AddRange(_StaticEnergyChannel); values.AddRange(_StaticEnergyChannel);
_ThemeStatics = values.ToArray(); _ThemeStatics = values.ToArray();
@@ -369,11 +369,11 @@ namespace Vocaluxe.Screens
{ {
if (_ChannelEnergy[i] > 0f) if (_ChannelEnergy[i] > 0f)
{ {
SRectF rect = new SRectF(_Statics[_StaticEnergyChannel[i]].Rect.X, var rect = new SRectF(_Statics[_StaticEnergyChannel[i]].Rect.X,
_Statics[_StaticEnergyChannel[i]].Rect.Y, _Statics[_StaticEnergyChannel[i]].Rect.Y,
_Statics[_StaticEnergyChannel[i]].Rect.W * _ChannelEnergy[i], _Statics[_StaticEnergyChannel[i]].Rect.W * _ChannelEnergy[i],
_Statics[_StaticEnergyChannel[i]].Rect.H, _Statics[_StaticEnergyChannel[i]].Rect.H,
_Statics[_StaticEnergyChannel[i]].Rect.Z); _Statics[_StaticEnergyChannel[i]].Rect.Z);
CDraw.DrawTexture(_Statics[_StaticEnergyChannel[i]].Texture, _Statics[_StaticEnergyChannel[i]].Rect, CDraw.DrawTexture(_Statics[_StaticEnergyChannel[i]].Texture, _Statics[_StaticEnergyChannel[i]].Rect,
new SColorF(1f, 1f, 1f, 1f), rect); new SColorF(1f, 1f, 1f, 1f), rect);
@@ -465,7 +465,7 @@ namespace Vocaluxe.Screens
private bool _CheckMicConfig() private bool _CheckMicConfig()
{ {
bool[] isSet = new bool[CSettings.MaxNumPlayer]; var isSet = new bool[CSettings.MaxNumPlayer];
for (int i = 0; i < CSettings.MaxNumPlayer; i++) for (int i = 0; i < CSettings.MaxNumPlayer; i++)
isSet[i] = false; isSet[i] = false;
+2 -2
View File
@@ -154,8 +154,8 @@ namespace Vocaluxe.Screens
CConfig.PreviewMusicVolume = _SelectSlides[_SelectSlidePreviewMusicVolume].Selection * 5; CConfig.PreviewMusicVolume = _SelectSlides[_SelectSlidePreviewMusicVolume].Selection * 5;
CConfig.SaveConfig(); CConfig.SaveConfig();
EOffOn newOffOn = (EOffOn)_SelectSlides[_SelectSlideBackgroundMusic].Selection; var newOffOn = (EOffOn)_SelectSlides[_SelectSlideBackgroundMusic].Selection;
EBackgroundMusicSource newSource = (EBackgroundMusicSource)_SelectSlides[_SelectSlideBackgroundMusicSource].Selection; var newSource = (EBackgroundMusicSource)_SelectSlides[_SelectSlideBackgroundMusicSource].Selection;
float newVolume = _SelectSlides[_SelectSlideBackgroundMusicVolume].Selection * 5; float newVolume = _SelectSlides[_SelectSlideBackgroundMusicVolume].Selection * 5;
CBackgroundMusic.CheckAndApplyConfig(newOffOn, newSource, newVolume); CBackgroundMusic.CheckAndApplyConfig(newOffOn, newSource, newVolume);
+6 -6
View File
@@ -60,13 +60,13 @@ namespace Vocaluxe.Screens
{ {
base.Init(); base.Init();
List<string> texts = new List<string> {_TextSong}; var texts = new List<string> {_TextSong};
_BuildTextStrings(ref texts); _BuildTextStrings(ref texts);
_ThemeTexts = texts.ToArray(); _ThemeTexts = texts.ToArray();
List<string> statics = new List<string>(); var statics = new List<string>();
_BuildStaticStrings(ref statics); _BuildStaticStrings(ref statics);
_ThemeStatics = statics.ToArray(); _ThemeStatics = statics.ToArray();
@@ -131,7 +131,7 @@ namespace Vocaluxe.Screens
public override bool UpdateGame() public override bool UpdateGame()
{ {
SPlayer[] players = new SPlayer[CGame.NumPlayer]; var players = new SPlayer[CGame.NumPlayer];
if (_Round != 0) if (_Round != 0)
players = _Points.GetPlayer(_Round - 1, CGame.NumPlayer); players = _Points.GetPlayer(_Round - 1, CGame.NumPlayer);
else else
@@ -156,7 +156,7 @@ namespace Vocaluxe.Screens
if (_StaticPointsBarDrawnPoints[p] > players[p].Points) if (_StaticPointsBarDrawnPoints[p] > players[p].Points)
_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") if (direction.ToLower() == "vertical")
{ {
_Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.W = ((float)_StaticPointsBarDrawnPoints[p]) * _Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.W = ((float)_StaticPointsBarDrawnPoints[p]) *
@@ -264,7 +264,7 @@ namespace Vocaluxe.Screens
private void _UpdateRatings() private void _UpdateRatings()
{ {
CSong song = null; CSong song = null;
SPlayer[] players = new SPlayer[CGame.NumPlayer]; var players = new SPlayer[CGame.NumPlayer];
if (_Round != 0) if (_Round != 0)
{ {
song = CGame.GetSong(_Round); 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))); _Texts[_TextRatings[p, CGame.NumPlayer - 1]].Text = CLanguage.Translate(_GetRating((int)Math.Round(players[p].Points)));
_StaticPointsBarDrawnPoints[p] = 0.0; _StaticPointsBarDrawnPoints[p] = 0.0;
string direction = (string)_ScreenSettings[_ScreenSettingAnimationDirection].GetValue(); var direction = (string)_ScreenSettings[_ScreenSettingAnimationDirection].GetValue();
if (direction.ToLower() == "vertical") if (direction.ToLower() == "vertical")
_Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.W = 0; _Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.W = 0;
else else
+2 -2
View File
@@ -546,13 +546,13 @@ namespace Vocaluxe.Screens
public override void ApplyVolume() public override void ApplyVolume()
{ {
if(_CurrentStream > -1) if (_CurrentStream > -1)
CSound.SetStreamVolumeMax(_CurrentStream, CConfig.GameMusicVolume); CSound.SetStreamVolumeMax(_CurrentStream, CConfig.GameMusicVolume);
} }
private void _CloseSong() private void _CloseSong()
{ {
if(_CurrentStream > -1) if (_CurrentStream > -1)
CSound.FadeAndStop(_CurrentStream, 0f, 0.5f); CSound.FadeAndStop(_CurrentStream, 0f, 0.5f);
CSound.RecordStop(); CSound.RecordStop();
if (_CurrentVideo != -1) if (_CurrentVideo != -1)
+13 -13
View File
@@ -105,7 +105,7 @@ namespace Vocaluxe.Screens
_ButtonsJoker.Clear(); _ButtonsJoker.Clear();
for (int i = 0; i < CSettings.MaxNumPlayer; i++) for (int i = 0; i < CSettings.MaxNumPlayer; i++)
_ButtonsJoker.Add("ButtonJoker" + (i + 1)); _ButtonsJoker.Add("ButtonJoker" + (i + 1));
List<string> blist = new List<string>(); var blist = new List<string>();
blist.AddRange(_ButtonsJoker); blist.AddRange(_ButtonsJoker);
blist.Add(_ButtonOptionsClose); blist.Add(_ButtonOptionsClose);
blist.Add(_ButtonOptionsPlaylist); blist.Add(_ButtonOptionsPlaylist);
@@ -123,7 +123,7 @@ namespace Vocaluxe.Screens
_TextsPlayer.Clear(); _TextsPlayer.Clear();
for (int i = 0; i < CSettings.MaxNumPlayer; i++) for (int i = 0; i < CSettings.MaxNumPlayer; i++)
_TextsPlayer.Add("TextPlayer" + (i + 1)); _TextsPlayer.Add("TextPlayer" + (i + 1));
List<string> tlist = new List<string>(); var tlist = new List<string>();
tlist.AddRange(_TextsPlayer); tlist.AddRange(_TextsPlayer);
tlist.Add(_TextCategory); tlist.Add(_TextCategory);
tlist.Add(_TextSelection); tlist.Add(_TextSelection);
@@ -172,7 +172,7 @@ namespace Vocaluxe.Screens
{ {
if (_SearchActive) if (_SearchActive)
_ApplyNewSearchFilter(_SearchText + keyEvent.Unicode); _ApplyNewSearchFilter(_SearchText + keyEvent.Unicode);
else if(!_Sso.Selection.PartyMode) else if (!_Sso.Selection.PartyMode)
{ {
_JumpTo(keyEvent.Unicode); _JumpTo(keyEvent.Unicode);
return true; return true;
@@ -862,7 +862,7 @@ namespace Vocaluxe.Screens
CGame.Reset(); CGame.Reset();
CGame.ClearSongs(); CGame.ClearSongs();
List<int> ids = new List<int>(); var ids = new List<int>();
for (int i = 0; i < CSongs.AllSongs.Count; i++) for (int i = 0; i < CSongs.AllSongs.Count; i++)
ids.Add(i); ids.Add(i);
@@ -870,7 +870,7 @@ namespace Vocaluxe.Screens
{ {
int songNr = ids[CGame.Rand.Next(ids.Count)]; 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) if (CSongs.AllSongs[songNr].IsDuet)
gm = EGameMode.TR_GAMEMODE_DUET; gm = EGameMode.TR_GAMEMODE_DUET;
@@ -894,7 +894,7 @@ namespace Vocaluxe.Screens
{ {
int songNr = ids[CGame.Rand.Next(ids.Count)]; 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) if (CSongs.AllSongs[songNr].IsDuet)
gm = EGameMode.TR_GAMEMODE_DUET; gm = EGameMode.TR_GAMEMODE_DUET;
@@ -1009,10 +1009,10 @@ namespace Vocaluxe.Screens
int curSelected = _SongMenus[_SongMenu].GetActualSelection(); int curSelected = _SongMenus[_SongMenu].GetActualSelection();
bool firstLevel = CConfig.Tabs == EOffOn.TR_CONFIG_OFF && CSongs.IsInCategory; bool firstLevel = CConfig.Tabs == EOffOn.TR_CONFIG_OFF && CSongs.IsInCategory;
bool secondSort = CConfig.Tabs == EOffOn.TR_CONFIG_ON && bool secondSort = CConfig.Tabs == EOffOn.TR_CONFIG_ON &&
(CConfig.SongSorting == ESongSorting.TR_CONFIG_ARTIST || (CConfig.SongSorting == ESongSorting.TR_CONFIG_ARTIST ||
CConfig.SongSorting == ESongSorting.TR_CONFIG_ARTIST_LETTER || CConfig.SongSorting == ESongSorting.TR_CONFIG_ARTIST_LETTER ||
CConfig.SongSorting == ESongSorting.TR_CONFIG_FOLDER || CConfig.SongSorting == ESongSorting.TR_CONFIG_FOLDER ||
CConfig.SongSorting == ESongSorting.TR_CONFIG_TITLE_LETTER); CConfig.SongSorting == ESongSorting.TR_CONFIG_TITLE_LETTER);
if (firstLevel && !secondSort) if (firstLevel && !secondSort)
{ {
//TODO: What's to do with multiple tags? //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)); visibleID = _FindIndex(songs, start, element => element.Artist.StartsWith(letter.ToString(), StringComparison.OrdinalIgnoreCase));
break; 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_YEAR:
case ESongSorting.TR_CONFIG_DECADE: case ESongSorting.TR_CONFIG_DECADE:
if (curSelected >= 0 && curSelected < ct - 1 && songs[curSelected].Year.StartsWith(letter.ToString(), StringComparison.OrdinalIgnoreCase)) if (curSelected >= 0 && curSelected < ct - 1 && songs[curSelected].Year.StartsWith(letter.ToString(), StringComparison.OrdinalIgnoreCase))
@@ -1076,7 +1076,7 @@ namespace Vocaluxe.Screens
if (visibleID > -1) if (visibleID > -1)
_SongMenus[_SongMenu].SetSelectedSong(visibleID); _SongMenus[_SongMenu].SetSelectedSong(visibleID);
} }
else if(!CSongs.IsInCategory) else if (!CSongs.IsInCategory)
{ {
ReadOnlyCollection<CCategory> categories = CSongs.Categories; ReadOnlyCollection<CCategory> categories = CSongs.Categories;
int ct = categories.Count; int ct = categories.Count;
@@ -1166,7 +1166,7 @@ namespace Vocaluxe.Screens
private void _ShowSongOptionsSong() private void _ShowSongOptionsSong()
{ {
EGameMode lastMode = EGameMode.TR_GAMEMODE_NORMAL; var lastMode = EGameMode.TR_GAMEMODE_NORMAL;
if (_AvailableGameModes.Count > 0) if (_AvailableGameModes.Count > 0)
lastMode = _AvailableGameModes[_SelectSlides[_SelectSlideOptionsMode].Selection]; lastMode = _AvailableGameModes[_SelectSlides[_SelectSlideOptionsMode].Selection];
_AvailableGameModes.Clear(); _AvailableGameModes.Clear();
+2 -2
View File
@@ -41,8 +41,8 @@ namespace Vocaluxe.Screens
{ {
base.Init(); base.Init();
const string test = "Ö ÄÜabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPGRSTUVWGXZ1234567890"; const string test = "Ö ÄÜabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPGRSTUVWGXZ1234567890";
SColorF color = new SColorF(1, 0, 0, 1); var 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 text = new CText(10, 50, 1, 32, 0, EAlignment.Left, EStyle.Normal, "Normal", color, "jÄNormal Text" + test, -1, 26, 1);
_AddText(text); _AddText(text);
text = new CText(10, 90, 1, 32, 0, EAlignment.Left, EStyle.Bold, "Normal", color, "jÄBold Text" + test, -1, 26, 1); text = new CText(10, 90, 1, 32, 0, EAlignment.Left, EStyle.Bold, "Normal", color, "jÄBold Text" + test, -1, 26, 1);
_AddText(text); _AddText(text);
+3 -3
View File
@@ -79,7 +79,7 @@ namespace VocaluxeLib
if (sr.EndOfStream) if (sr.EndOfStream)
break; break;
char chr = (char)sr.Read(); var chr = (char)sr.Read();
value += chr.ToString(); value += chr.ToString();
tmp = sr.Peek(); tmp = sr.Peek();
} }
@@ -141,8 +141,8 @@ namespace VocaluxeLib
public static List<string> ListFiles(string path, string cast, bool recursive = false, bool fullpath = false) public static List<string> ListFiles(string path, string cast, bool recursive = false, bool fullpath = false)
{ {
List<string> files = new List<string>(); var files = new List<string>();
DirectoryInfo dir = new DirectoryInfo(path); var dir = new DirectoryInfo(path);
try try
{ {
+3 -3
View File
@@ -37,7 +37,7 @@ namespace VocaluxeLib
private CXMLReader(string uri) private CXMLReader(string uri)
{ {
_FileName = uri; _FileName = uri;
XPathDocument xmlDoc = new XPathDocument(uri); var xmlDoc = new XPathDocument(uri);
_Navigator = xmlDoc.CreateNavigator(); _Navigator = xmlDoc.CreateNavigator();
} }
@@ -123,7 +123,7 @@ namespace VocaluxeLib
public List<string> GetValues(string cast) public List<string> GetValues(string cast)
{ {
List<string> values = new List<string>(); var values = new List<string>();
_Navigator.MoveToRoot(); _Navigator.MoveToRoot();
_Navigator.MoveToFirstChild(); _Navigator.MoveToFirstChild();
@@ -143,7 +143,7 @@ namespace VocaluxeLib
public IEnumerable<string> GetAttributes(string cast, string attribute) public IEnumerable<string> GetAttributes(string cast, string attribute)
{ {
List<string> values = new List<string>(); var values = new List<string>();
_Navigator.MoveToRoot(); _Navigator.MoveToRoot();
_Navigator.MoveToFirstChild(); _Navigator.MoveToFirstChild();
+1 -1
View File
@@ -80,7 +80,7 @@ namespace VocaluxeLib.Game
if (round >= NumRounds) if (round >= NumRounds)
return new SPlayer[1]; return new SPlayer[1];
SPlayer[] players = new SPlayer[numPlayer]; var players = new SPlayer[numPlayer];
for (int p = 0; p < players.Length; p++) for (int p = 0; p < players.Length; p++)
{ {
+4 -4
View File
@@ -196,7 +196,7 @@ namespace VocaluxeLib.Menu
#region internal #region internal
private void _DrawColor() 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); CBase.Drawing.DrawColor(Color, bounds);
} }
@@ -206,7 +206,7 @@ namespace VocaluxeLib.Menu
CTexture texture = CBase.Theme.GetSkinTexture(_Theme.TextureName, _PartyModeID); CTexture texture = CBase.Theme.GetSkinTexture(_Theme.TextureName, _PartyModeID);
if (texture != null) 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; RectangleF rect;
CHelper.SetRect(bounds, out rect, texture.OrigAspect, EAspect.Crop); CHelper.SetRect(bounds, out rect, texture.OrigAspect, EAspect.Crop);
@@ -221,7 +221,7 @@ namespace VocaluxeLib.Menu
CTexture videoTexture = CBase.Theme.GetSkinVideoTexture(_Theme.VideoName, _PartyModeID); CTexture videoTexture = CBase.Theme.GetSkinVideoTexture(_Theme.VideoName, _PartyModeID);
if (videoTexture != null) 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; RectangleF rect;
CHelper.SetRect(bounds, out rect, videoTexture.OrigAspect, EAspect.Crop); CHelper.SetRect(bounds, out rect, videoTexture.OrigAspect, EAspect.Crop);
@@ -236,7 +236,7 @@ namespace VocaluxeLib.Menu
CTexture videoTexture = CBase.BackgroundMusic.GetVideoTexture(); CTexture videoTexture = CBase.BackgroundMusic.GetVideoTexture();
if (videoTexture != null) 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; RectangleF rect;
CHelper.SetRect(bounds, out rect, videoTexture.OrigAspect, EAspect.Crop); CHelper.SetRect(bounds, out rect, videoTexture.OrigAspect, EAspect.Crop);
+1 -1
View File
@@ -258,7 +258,7 @@ namespace VocaluxeLib.Menu
for (int i = 0; i < _Bars.Length; i++) 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; SColorF color = Color;
if (i == max) if (i == max)
color = MaxColor; color = MaxColor;
+1 -1
View File
@@ -208,7 +208,7 @@ namespace VocaluxeLib.Menu
_Width = 0f; _Width = 0f;
foreach (CSongNote note in line.Notes) 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.Text = note.Text;
_Text.Style = EStyle.Bold; _Text.Style = EStyle.Bold;
+21 -21
View File
@@ -151,7 +151,7 @@ namespace VocaluxeLib.Menu
{ {
foreach (string elName in elements) 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)) if (element.LoadTheme("//root/" + ThemeName, elName, xmlReader, skinIndex))
addElementHandler(element, elName); addElementHandler(element, elName);
else else
@@ -198,7 +198,7 @@ namespace VocaluxeLib.Menu
if (_ThemePath == "") if (_ThemePath == "")
return; 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"); string file = Path.Combine(_ThemePath, ThemeName + ".xml");
using (XmlWriter writer = XmlWriter.Create(file, settings)) using (XmlWriter writer = XmlWriter.Create(file, settings))
@@ -770,7 +770,7 @@ namespace VocaluxeLib.Menu
if (_Interactions.Count <= 0) if (_Interactions.Count <= 0)
return; return;
List<SZSort> items = new List<SZSort>(); var items = new List<SZSort>();
for (int i = 0; i < _Interactions.Count; i++) 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.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)) _Interactions[i].Type != EType.Equalizer && _Interactions[i].Type != EType.Playlist && _Interactions[i].Type != EType.ParticleEffect))
continue; continue;
SZSort zs = new SZSort {ID = i, Z = _GetZValue(i)}; var zs = new SZSort {ID = i, Z = _GetZValue(i)};
items.Add(zs); items.Add(zs);
} }
@@ -1105,10 +1105,10 @@ namespace VocaluxeLib.Menu
/// <returns></returns> /// <returns></returns>
private bool _NextInteraction(SKeyEvent key) private bool _NextInteraction(SKeyEvent key)
{ {
SKeyEvent[] directions = new SKeyEvent[4]; var directions = new SKeyEvent[4];
float[] distances = new float[4]; var distances = new float[4];
int[] stages = new int[4]; var stages = new int[4];
int[] elements = new int[4]; var elements = new int[4];
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
directions[i] = new SKeyEvent(); directions[i] = new SKeyEvent();
@@ -1248,11 +1248,11 @@ namespace VocaluxeLib.Menu
private float _GetDistanceDirect(SKeyEvent key, SRectF actualRect, SRectF targetRect) private float _GetDistanceDirect(SKeyEvent key, SRectF actualRect, SRectF targetRect)
{ {
PointF source = new PointF(actualRect.X + actualRect.W / 2f, actualRect.Y + actualRect.H / 2f); var 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 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); var 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 distance = (float)Math.Sqrt(vector.X * vector.X + vector.Y * vector.Y);
bool inDirection = false; bool inDirection = false;
switch (key.Key) switch (key.Key)
{ {
@@ -1281,11 +1281,11 @@ namespace VocaluxeLib.Menu
private float _GetDistance180(SKeyEvent key, SRectF actualRect, SRectF targetRect) private float _GetDistance180(SKeyEvent key, SRectF actualRect, SRectF targetRect)
{ {
PointF source = new PointF(actualRect.X + actualRect.W / 2f, actualRect.Y + actualRect.H / 2f); var 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 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); var 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 distance = (float)Math.Sqrt(vector.X * vector.X + vector.Y * vector.Y);
bool inDirection = false; bool inDirection = false;
switch (key.Key) switch (key.Key)
{ {
@@ -1584,7 +1584,7 @@ namespace VocaluxeLib.Menu
private SRectF _GetRect(CInteraction interaction) private SRectF _GetRect(CInteraction interaction)
{ {
SRectF result = new SRectF(); var result = new SRectF();
switch (interaction.Type) switch (interaction.Type)
{ {
case EType.Button: case EType.Button:
@@ -1808,7 +1808,7 @@ namespace VocaluxeLib.Menu
private void _LoadThemeBasics(CXMLReader xmlReader, int skinIndex) private void _LoadThemeBasics(CXMLReader xmlReader, int skinIndex)
{ {
// Backgrounds // Backgrounds
CBackground background = new CBackground(_PartyModeID); var background = new CBackground(_PartyModeID);
int i = 1; int i = 1;
while (background.LoadTheme("//root/" + ThemeName, "Background" + i, xmlReader, skinIndex)) while (background.LoadTheme("//root/" + ThemeName, "Background" + i, xmlReader, skinIndex))
{ {
@@ -1818,7 +1818,7 @@ namespace VocaluxeLib.Menu
} }
// Statics // Statics
CStatic stat = new CStatic(_PartyModeID); var stat = new CStatic(_PartyModeID);
i = 1; i = 1;
while (stat.LoadTheme("//root/" + ThemeName, "Static" + i, xmlReader, skinIndex)) while (stat.LoadTheme("//root/" + ThemeName, "Static" + i, xmlReader, skinIndex))
{ {
@@ -1828,7 +1828,7 @@ namespace VocaluxeLib.Menu
} }
// Texts // Texts
CText text = new CText(_PartyModeID); var text = new CText(_PartyModeID);
i = 1; i = 1;
while (text.LoadTheme("//root/" + ThemeName, "Text" + i, xmlReader, skinIndex)) while (text.LoadTheme("//root/" + ThemeName, "Text" + i, xmlReader, skinIndex))
{ {
@@ -1838,7 +1838,7 @@ namespace VocaluxeLib.Menu
} }
// ParticleEffects // ParticleEffects
CParticleEffect partef = new CParticleEffect(_PartyModeID); var partef = new CParticleEffect(_PartyModeID);
i = 1; i = 1;
while (partef.LoadTheme("//root/" + ThemeName, "ParticleEffect" + i, xmlReader, skinIndex)) while (partef.LoadTheme("//root/" + ThemeName, "ParticleEffect" + i, xmlReader, skinIndex))
{ {
+15 -15
View File
@@ -307,7 +307,7 @@ namespace VocaluxeLib.Menu
if (_Interactions.Count <= 0) if (_Interactions.Count <= 0)
return; return;
List<SZSort> items = new List<SZSort>(); var items = new List<SZSort>();
for (int i = 0; i < _Interactions.Count; i++) for (int i = 0; i < _Interactions.Count; i++)
{ {
@@ -320,7 +320,7 @@ namespace VocaluxeLib.Menu
_Interactions[i].Type == EType.SongMenu || _Interactions[i].Type == EType.SongMenu ||
_Interactions[i].Type == EType.Equalizer)) _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); items.Add(zs);
} }
} }
@@ -613,10 +613,10 @@ namespace VocaluxeLib.Menu
/// <returns></returns> /// <returns></returns>
private bool _NextInteraction(SKeyEvent key) private bool _NextInteraction(SKeyEvent key)
{ {
SKeyEvent[] directions = new SKeyEvent[4]; var directions = new SKeyEvent[4];
float[] distances = new float[4]; var distances = new float[4];
int[] stages = new int[4]; var stages = new int[4];
int[] elements = new int[4]; var elements = new int[4];
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
directions[i] = new SKeyEvent(); directions[i] = new SKeyEvent();
@@ -756,11 +756,11 @@ namespace VocaluxeLib.Menu
private float _GetDistanceDirect(SKeyEvent key, SRectF actualRect, SRectF targetRect) private float _GetDistanceDirect(SKeyEvent key, SRectF actualRect, SRectF targetRect)
{ {
PointF source = new PointF(actualRect.X + actualRect.W / 2f, actualRect.Y + actualRect.H / 2f); var 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 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); var 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 distance = (float)Math.Sqrt(vector.X * vector.X + vector.Y * vector.Y);
bool inDirection = false; bool inDirection = false;
switch (key.Key) switch (key.Key)
{ {
@@ -789,11 +789,11 @@ namespace VocaluxeLib.Menu
private float _GetDistance180(SKeyEvent key, SRectF actualRect, SRectF targetRect) private float _GetDistance180(SKeyEvent key, SRectF actualRect, SRectF targetRect)
{ {
PointF source = new PointF(actualRect.X + actualRect.W / 2f, actualRect.Y + actualRect.H / 2f); var 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 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); var 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 distance = (float)Math.Sqrt(vector.X * vector.X + vector.Y * vector.Y);
bool inDirection = false; bool inDirection = false;
switch (key.Key) switch (key.Key)
{ {
@@ -1002,7 +1002,7 @@ namespace VocaluxeLib.Menu
private SRectF _GetRect(int interaction) private SRectF _GetRect(int interaction)
{ {
SRectF result = new SRectF(); var result = new SRectF();
switch (_Interactions[interaction].Type) switch (_Interactions[interaction].Type)
{ {
case EType.Button: case EType.Button:
+3 -3
View File
@@ -203,7 +203,7 @@ namespace VocaluxeLib.Menu
break; break;
case EParticleType.Snow: 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) if (Math.Round(Y) < maxy)
{ {
@@ -525,8 +525,8 @@ namespace VocaluxeLib.Menu
break; break;
} }
int w = (int)(Rect.W - size / 4f); var w = (int)(Rect.W - size / 4f);
int h = (int)(Rect.H - size / 4f); var h = (int)(Rect.H - size / 4f);
if (w < 0) if (w < 0)
w = 0; w = 0;
+6 -6
View File
@@ -631,7 +631,7 @@ namespace VocaluxeLib.Menu
CBase.Playlist.MovePlaylistSongUp(ActivePlaylistID, CurrentPlaylistElement + Offset); CBase.Playlist.MovePlaylistSongUp(ActivePlaylistID, CurrentPlaylistElement + Offset);
UpdatePlaylist(); UpdatePlaylist();
SKeyEvent key = new SKeyEvent {Key = Keys.Up}; var key = new SKeyEvent {Key = Keys.Up};
if (CurrentPlaylistElement > scrollLimit) if (CurrentPlaylistElement > scrollLimit)
{ {
@@ -660,7 +660,7 @@ namespace VocaluxeLib.Menu
CBase.Playlist.MovePlaylistSongDown(ActivePlaylistID, CurrentPlaylistElement + Offset); CBase.Playlist.MovePlaylistSongDown(ActivePlaylistID, CurrentPlaylistElement + Offset);
UpdatePlaylist(); UpdatePlaylist();
SKeyEvent key = new SKeyEvent {Key = Keys.Down}; var key = new SKeyEvent {Key = Keys.Down};
if (CurrentPlaylistElement >= scrollLimit) if (CurrentPlaylistElement >= scrollLimit)
{ {
@@ -973,7 +973,7 @@ namespace VocaluxeLib.Menu
if (!mouseEvent.LBH && DragAndDropSongID != -1) if (!mouseEvent.LBH && DragAndDropSongID != -1)
{ {
EGameMode gm = EGameMode.TR_GAMEMODE_NORMAL; var gm = EGameMode.TR_GAMEMODE_NORMAL;
CSong song = CBase.Songs.GetSongByID(DragAndDropSongID); CSong song = CBase.Songs.GetSongByID(DragAndDropSongID);
if (song != null) if (song != null)
@@ -1102,7 +1102,7 @@ namespace VocaluxeLib.Menu
for (int i = 0; i < Math.Floor(Rect.H / _Theme.EntryHeight); i++) 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, Background = new CStatic(_PartyModeID, _Theme.TextureBackgroundName, BackgroundColor,
new SRectF(Rect.X, Rect.Y + (i * _Theme.EntryHeight), Rect.W, _Theme.EntryHeight, Rect.Z)), new SRectF(Rect.X, Rect.Y + (i * _Theme.EntryHeight), Rect.W, _Theme.EntryHeight, Rect.Z)),
@@ -1143,7 +1143,7 @@ namespace VocaluxeLib.Menu
_PlaylistElementContents.Clear(); _PlaylistElementContents.Clear();
for (int i = 0; i < CBase.Playlist.GetPlaylistSongCount(ActivePlaylistID); i++) 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, SongID = CBase.Playlist.GetPlaylistSong(ActivePlaylistID, i).SongID,
Modes = CBase.Songs.GetSongByID(CBase.Playlist.GetPlaylistSong(ActivePlaylistID, i).SongID).AvailableGameModes, Modes = CBase.Songs.GetSongByID(CBase.Playlist.GetPlaylistSong(ActivePlaylistID, i).SongID).AvailableGameModes,
@@ -1162,7 +1162,7 @@ namespace VocaluxeLib.Menu
_PlaylistElementContents.Clear(); _PlaylistElementContents.Clear();
for (int i = 0; i < CBase.Playlist.GetPlaylistSongCount(ActivePlaylistID); i++) 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.Modes = CBase.Songs.GetSongByID(pec.SongID).AvailableGameModes;
pec.Mode = CBase.Playlist.GetPlaylistSong(ActivePlaylistID, i).GameMode; pec.Mode = CBase.Playlist.GetPlaylistSong(ActivePlaylistID, i).GameMode;
_PlaylistElementContents.Add(pec); _PlaylistElementContents.Add(pec);
+4 -4
View File
@@ -750,10 +750,10 @@ namespace VocaluxeLib.Menu
_ValueBounds.Clear(); _ValueBounds.Clear();
for (int i = 0; i < numvis; i++) 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], var text = new CText(0, 0, 0, TextH, MaxW, EAlignment.Center, _Theme.TextStyle, _Theme.TextFont, TextColor, _ValueNames[i + offset],
_ValuePartyModeIDs[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) if (i + offset == _Selection)
{ {
text.Color = SelTextColor; text.Color = SelTextColor;
@@ -774,7 +774,7 @@ namespace VocaluxeLib.Menu
if (WithTextures) if (WithTextures)
{ {
float dh = text.Y - Rect.Y - Rect.H * 0.1f; 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); CBase.Drawing.DrawTexture(_Textures[i + offset], rect, alpha);
_ValueBounds.Add(rect); _ValueBounds.Add(rect);
} }
+2 -2
View File
@@ -469,7 +469,7 @@ namespace VocaluxeLib.Menu
CBase.Fonts.SetStyle(Style); CBase.Fonts.SetStyle(Style);
SColorF currentColor = (Selected) ? SelColor : Color; 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); CBase.Fonts.DrawText(_Text, Rect.H, Rect.X, Rect.Y, Z, color);
@@ -486,7 +486,7 @@ namespace VocaluxeLib.Menu
CBase.Fonts.SetStyle(Style); CBase.Fonts.SetStyle(Style);
SColorF currentColor = (Selected) ? SelColor : Color; 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); CBase.Fonts.DrawText(Text, Rect.H, Rect.X, Rect.Y, Z, color, begin, end);
@@ -518,7 +518,10 @@ namespace VocaluxeLib.Menu.SongMenu
_Active = active; _Active = active;
} }
public virtual bool IsMouseOverActualSelection(SMouseEvent mEvent) { return false; } public virtual bool IsMouseOverActualSelection(SMouseEvent mEvent)
{
return false;
}
public virtual int GetSelectedSong() public virtual int GetSelectedSong()
{ {
+11 -11
View File
@@ -92,9 +92,9 @@ namespace VocaluxeLib.Menu.SongMenu
{ {
for (int j = 0; j < _NumW; j++) for (int j = 0; j < _NumW; j++)
{ {
SRectF rect = new SRectF(_Theme.SongMenuTileBoard.TileRect.X + j * (_TileW + _SpaceW), var rect = new SRectF(_Theme.SongMenuTileBoard.TileRect.X + j * (_TileW + _SpaceW),
_Theme.SongMenuTileBoard.TileRect.Y + i * (_TileH + _SpaceH), _TileW, _TileH, _Rect.Z); _Theme.SongMenuTileBoard.TileRect.Y + i * (_TileH + _SpaceH), _TileW, _TileH, _Rect.Z);
CStatic tile = new CStatic(_PartyModeID, _CoverTexture, Color, rect); var tile = new CStatic(_PartyModeID, _CoverTexture, Color, rect);
_Tiles.Add(tile); _Tiles.Add(tile);
} }
} }
@@ -423,8 +423,8 @@ namespace VocaluxeLib.Menu.SongMenu
time = song.Finish; time = song.Finish;
time -= song.Start; time -= song.Start;
int min = (int)Math.Floor(time / 60f); var min = (int)Math.Floor(time / 60f);
int sec = (int)(time - min * 60f); var sec = (int)(time - min * 60f);
_SongLength.Text = min.ToString("00") + ":" + sec.ToString("00"); _SongLength.Text = min.ToString("00") + ":" + sec.ToString("00");
} }
} }
@@ -458,11 +458,11 @@ namespace VocaluxeLib.Menu.SongMenu
{ {
if (_Vidtex.Color.A < 1) if (_Vidtex.Color.A < 1)
_CoverBig.Draw(1f, EAspect.Crop); _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; RectangleF rect;
CHelper.SetRect(bounds, out rect, _Vidtex.OrigAspect, EAspect.Crop); CHelper.SetRect(bounds, out rect, _Vidtex.OrigAspect, EAspect.Crop);
SRectF vidRect = new SRectF(rect.X, rect.Y, rect.Width, rect.Height, _CoverBig.Rect.Z); var 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 vidRectBounds = new SRectF(bounds.X, bounds.Y, bounds.Width, bounds.Height, 0f);
CBase.Drawing.DrawTexture(_Vidtex, vidRect, _Vidtex.Color, vidRectBounds); CBase.Drawing.DrawTexture(_Vidtex, vidRect, _Vidtex.Color, vidRectBounds);
CBase.Drawing.DrawTextureReflection(_Vidtex, vidRect, _Vidtex.Color, vidRectBounds, _CoverBig.ReflectionSpace, _CoverBig.ReflectionHeight); CBase.Drawing.DrawTextureReflection(_Vidtex, vidRect, _Vidtex.Color, vidRectBounds, _CoverBig.ReflectionSpace, _CoverBig.ReflectionHeight);
@@ -490,7 +490,7 @@ namespace VocaluxeLib.Menu.SongMenu
CStatic selCov = GetSelectedSongCover(); CStatic selCov = GetSelectedSongCover();
if (selCov.Texture == null) if (selCov.Texture == null)
return false; 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); return CHelper.IsInBounds(rect, mEvent);
} }
@@ -679,8 +679,8 @@ namespace VocaluxeLib.Menu.SongMenu
{ {
for (int j = 0; j < _NumW; j++) 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); var 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 tile = new CStatic(_PartyModeID, _CoverTexture, Color, rect);
_Tiles.Add(tile); _Tiles.Add(tile);
} }
} }
+21 -2
View File
@@ -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 <http://www.gnu.org/licenses/>.
// */
#endregion
namespace VocaluxeLib.Songs
{ {
/// <summary> /// <summary>
/// Base class for all note types /// Base class for all note types
/// </summary> /// </summary>
public abstract class CBaseNote public abstract class CBaseNote
{ {
+20 -1
View File
@@ -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 <http://www.gnu.org/licenses/>.
// */
#endregion
using System.Collections.Generic;
using System.Linq; using System.Linq;
namespace VocaluxeLib.Songs namespace VocaluxeLib.Songs
+8 -8
View File
@@ -149,7 +149,7 @@ namespace VocaluxeLib.Songs
public int DataBaseSongID = -1; public int DataBaseSongID = -1;
public string DateAdded = ""; public string DateAdded = "";
public int NumPlayed = 0; public int NumPlayed;
// Notes // Notes
public readonly CNotes Notes = new CNotes(); public readonly CNotes Notes = new CNotes();
@@ -158,7 +158,7 @@ namespace VocaluxeLib.Songs
{ {
get get
{ {
List<EGameMode> gms = new List<EGameMode> {IsDuet ? EGameMode.TR_GAMEMODE_DUET : EGameMode.TR_GAMEMODE_NORMAL}; var gms = new List<EGameMode> {IsDuet ? EGameMode.TR_GAMEMODE_DUET : EGameMode.TR_GAMEMODE_NORMAL};
if (Medley.Source != EMedleySource.None) if (Medley.Source != EMedleySource.None)
gms.Add(EGameMode.TR_GAMEMODE_MEDLEY); gms.Add(EGameMode.TR_GAMEMODE_MEDLEY);
gms.Add(EGameMode.TR_GAMEMODE_SHORTSONG); gms.Add(EGameMode.TR_GAMEMODE_SHORTSONG);
@@ -172,7 +172,7 @@ namespace VocaluxeLib.Songs
public static CSong LoadSong(string filePath) public static CSong LoadSong(string filePath)
{ {
CSong song = new CSong(); var song = new CSong();
return song.ReadHeader(filePath) ? song : null; return song.ReadHeader(filePath) ? song : null;
} }
@@ -289,7 +289,7 @@ namespace VocaluxeLib.Songs
FileName = Path.GetFileName(filePath); FileName = Path.GetFileName(filePath);
EHeaderFlags headerFlags = new EHeaderFlags(); var headerFlags = new EHeaderFlags();
StreamReader sr = null; StreamReader sr = null;
try try
{ {
@@ -737,7 +737,7 @@ namespace VocaluxeLib.Songs
private bool _ParseNote(int player, ENoteType noteType, int start, int length, int tone, string text) 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); CVoice voice = Notes.GetVoice(player);
return voice.AddNote(note); return voice.AddNote(note);
} }
@@ -745,7 +745,7 @@ namespace VocaluxeLib.Songs
private void _NewSentence(int player, int start) private void _NewSentence(int player, int start)
{ {
CVoice voice = Notes.GetVoice(player); CVoice voice = Notes.GetVoice(player);
CSongLine line = new CSongLine {StartBeat = start}; var line = new CSongLine {StartBeat = start};
voice.AddLine(line); voice.AddLine(line);
} }
@@ -821,14 +821,14 @@ namespace VocaluxeLib.Songs
List<string> sentences = voice.Lines.Select(line => line.Points != 0 ? line.Lyrics : String.Empty).ToList(); List<string> sentences = voice.Lines.Select(line => line.Points != 0 ? line.Lyrics : String.Empty).ToList();
// find equal sentences series // find equal sentences series
List<SSeries> series = new List<SSeries>(); var series = new List<SSeries>();
for (int i = 0; i < voice.NumLines - 1; i++) for (int i = 0; i < voice.NumLines - 1; i++)
{ {
for (int j = i + 1; j < voice.NumLines; j++) for (int j = i + 1; j < voice.NumLines; j++)
{ {
if (sentences[i] != sentences[j] || sentences[i] == "") if (sentences[i] != sentences[j] || sentences[i] == "")
continue; continue;
SSeries tempSeries = new SSeries {Start = i, End = i}; var tempSeries = new SSeries {Start = i, End = i};
int max; int max;
if (j + j - i > voice.NumLines) if (j + j - i > voice.NumLines)
+20 -1
View File
@@ -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 <http://www.gnu.org/licenses/>.
// */
#endregion
using System;
using System.Linq; using System.Linq;
namespace VocaluxeLib.Songs namespace VocaluxeLib.Songs
+21 -2
View File
@@ -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 <http://www.gnu.org/licenses/>.
// */
#endregion
namespace VocaluxeLib.Songs
{ {
/// <summary> /// <summary>
/// Class to represent a note in a song /// Class to represent a note in a song
/// </summary> /// </summary>
public class CSongNote : CBaseNote public class CSongNote : CBaseNote
{ {
+20 -1
View File
@@ -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 <http://www.gnu.org/licenses/>.
// */
#endregion
using System.Linq;
namespace VocaluxeLib.Songs namespace VocaluxeLib.Songs
{ {
+23 -4
View File
@@ -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 <http://www.gnu.org/licenses/>.
// */
#endregion
namespace VocaluxeLib.Songs
{ {
/// <summary> /// <summary>
/// Note that was sung by a player /// Note that was sung by a player
/// </summary> /// </summary>
public class CSungNote : CBaseNote public class CSungNote : CBaseNote
{ {
/// <summary> /// <summary>
/// Constructor for a sung note that was not hit /// Constructor for a sung note that was not hit
/// </summary> /// </summary>
/// <param name="startBeat"></param> /// <param name="startBeat"></param>
/// <param name="duration"></param> /// <param name="duration"></param>
@@ -18,7 +37,7 @@
} }
/// <summary> /// <summary>
/// Constructor for a sung note that hit the given note /// Constructor for a sung note that hit the given note
/// </summary> /// </summary>
/// <param name="startBeat"></param> /// <param name="startBeat"></param>
/// <param name="duration"></param> /// <param name="duration"></param>
+20 -1
View File
@@ -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 <http://www.gnu.org/licenses/>.
// */
#endregion
using System.Collections.Generic;
using System.Linq; using System.Linq;
namespace VocaluxeLib.Songs namespace VocaluxeLib.Songs