Code Formating

This commit is contained in:
Flamefire committed 2013-03-20 00:13:17 +01:00
1 parent 71d5b2ce76
commit 21a7ea257e
4 files changed
+136 -197

No files matched your search

+34
View File
@@ -0,0 +1,34 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CodeStyle/CodeCleanup/Profiles/=Cleanup/@EntryIndexedValue">&lt;?xml version="1.0" encoding="utf-16"?&gt;&lt;Profile name="Cleanup"&gt;&lt;CSArrangeThisQualifier&gt;True&lt;/CSArrangeThisQualifier&gt;&lt;CSRemoveCodeRedundancies&gt;True&lt;/CSRemoveCodeRedundancies&gt;&lt;CSMakeFieldReadonly&gt;True&lt;/CSMakeFieldReadonly&gt;&lt;CSUseVar&gt;&lt;BehavourStyle&gt;DISABLED&lt;/BehavourStyle&gt;&lt;LocalVariableStyle&gt;ALWAYS_EXPLICIT&lt;/LocalVariableStyle&gt;&lt;ForeachVariableStyle&gt;ALWAYS_EXPLICIT&lt;/ForeachVariableStyle&gt;&lt;/CSUseVar&gt;&lt;CSOptimizeUsings&gt;&lt;OptimizeUsings&gt;False&lt;/OptimizeUsings&gt;&lt;EmbraceInRegion&gt;False&lt;/EmbraceInRegion&gt;&lt;RegionName&gt;&lt;/RegionName&gt;&lt;/CSOptimizeUsings&gt;&lt;CSReformatCode&gt;True&lt;/CSReformatCode&gt;&lt;CSharpFormatDocComments&gt;True&lt;/CSharpFormatDocComments&gt;&lt;CSShortenReferences&gt;True&lt;/CSShortenReferences&gt;&lt;CSUseAutoProperty&gt;True&lt;/CSUseAutoProperty&gt;&lt;/Profile&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/CodeCleanup/RecentlyUsedProfile/@EntryValue">Cleanup</s:String>
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/BLANK_LINES_AROUND_FIELD/@EntryValue">0</s:Int64>
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/BLANK_LINES_INSIDE_REGION/@EntryValue">0</s:Int64>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/EMPTY_BLOCK_STYLE/@EntryValue">TOGETHER_SAME_LINE</s:String>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/EXPLICIT_INTERNAL_MODIFIER/@EntryValue">False</s:Boolean>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/FORCE_ATTRIBUTE_STYLE/@EntryValue">JOIN</s:String>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/FORCE_FIXED_BRACES_STYLE/@EntryValue">ONLY_FOR_MULTILINE</s:String>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/FORCE_FOR_BRACES_STYLE/@EntryValue">ONLY_FOR_MULTILINE</s:String>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/FORCE_FOREACH_BRACES_STYLE/@EntryValue">ONLY_FOR_MULTILINE</s:String>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/FORCE_IFELSE_BRACES_STYLE/@EntryValue">ONLY_FOR_MULTILINE</s:String>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/FORCE_USING_BRACES_STYLE/@EntryValue">ONLY_FOR_MULTILINE</s:String>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/FORCE_WHILE_BRACES_STYLE/@EntryValue">ONLY_FOR_MULTILINE</s:String>
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/KEEP_BLANK_LINES_IN_DECLARATIONS/@EntryValue">1</s:Int64>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_COMPLEX_ACCESSOR_ATTRIBUTE_ON_SAME_LINE/@EntryValue">True</s:Boolean>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/SIMPLE_EMBEDDED_STATEMENT_STYLE/@EntryValue">LINE_BREAK</s:String>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/SPACE_AFTER_TYPECAST_PARENTHESES/@EntryValue">False</s:Boolean>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/SPACE_AROUND_MULTIPLICATIVE_OP/@EntryValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/SPACE_BEFORE_SIZEOF_PARENTHESES/@EntryValue">False</s:Boolean>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/SPACE_BEFORE_TYPEOF_PARENTHESES/@EntryValue">False</s:Boolean>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_FOR_STMT_HEADER_STYLE/@EntryValue">WRAP_IF_LONG</s:String>
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_LIMIT/@EntryValue">180</s:Int64>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_MULTIPLE_DECLARATION_STYLE/@EntryValue">WRAP_IF_LONG</s:String>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_TERNARY_EXPR_STYLE/@EntryValue">WRAP_IF_LONG</s:String>
<s:Boolean x:Key="/Default/CodeStyle/CSharpUsing/AllowAlias/@EntryValue">False</s:Boolean>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=EnumMember/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateConstants/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="_" Suffix="" Style="AaBb" /&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateInstanceFields/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="_" Suffix="" Style="AaBb" /&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateStaticFields/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="_" Suffix="" Style="AaBb" /&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateStaticReadonly/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="_" Suffix="" Style="AaBb" /&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PublicFields/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/UserRules/=27c8359b_002D97bf_002D4e1d_002Db126_002D4f613028bcc5/@EntryIndexedValue">&lt;Policy&gt;&lt;Descriptor Staticness="Static, Instance" AccessRightKinds="Private, Protected, ProtectedInternal, Internal, Public" Description="Enums"&gt;&lt;ElementKinds&gt;&lt;Kind Name="ENUM" /&gt;&lt;/ElementKinds&gt;&lt;/Descriptor&gt;&lt;Policy Inspect="True" Prefix="E" Suffix="" Style="AaBb" /&gt;&lt;/Policy&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/UserRules/=8cff90ce_002Def0d_002D436d_002Db8f2_002D5b5bdb923d3b/@EntryIndexedValue">&lt;Policy&gt;&lt;Descriptor Staticness="Static, Instance" AccessRightKinds="Private, Protected, ProtectedInternal, Internal, Public" Description="Classes"&gt;&lt;ElementKinds&gt;&lt;Kind Name="CLASS" /&gt;&lt;/ElementKinds&gt;&lt;/Descriptor&gt;&lt;Policy Inspect="True" Prefix="C" Suffix="" Style="AaBb" /&gt;&lt;/Policy&gt;</s:String></wpf:ResourceDictionary>
+77 -128
View File
@@ -6,7 +6,6 @@ using System.Drawing.Imaging;
using System.Runtime.InteropServices;
using System.IO;
using System.Text;
#if WIN
using System.Data.SQLite;
#else
@@ -16,9 +15,7 @@ using SQLiteTransaction = Mono.Data.Sqlite.SqliteTransaction;
using SQLiteCommand = Mono.Data.Sqlite.SqliteCommand;
using SQLiteDataReader = Mono.Data.Sqlite.SqliteDataReader;
#endif
using Community.CsharpSqlite;
using Vocaluxe.Lib.Draw;
using Vocaluxe.Menu;
using Vocaluxe.Menu.SongMenu;
@@ -27,7 +24,7 @@ namespace Vocaluxe.Base
{
static class CDataBase
{
struct SData
private struct SData
{
public int id;
public long ticks;
@@ -39,14 +36,14 @@ namespace Vocaluxe.Base
private static string _CoverFilePath;
private static string _CreditsRessourcesFilePath;
private static SQLiteConnection _ConnectionCover = null;
private static SQLiteTransaction _TransactionCover = null;
private static SQLiteConnection _ConnectionCover;
private static SQLiteTransaction _TransactionCover;
public static void Init()
{
_HighscoreFilePath = Path.Combine(System.Environment.CurrentDirectory, CSettings.sFileHighscoreDB);
_CoverFilePath = Path.Combine(System.Environment.CurrentDirectory, CSettings.sFileCoverDB);
_CreditsRessourcesFilePath = Path.Combine(System.Environment.CurrentDirectory, CSettings.sFileCreditsRessourcesDB);
_HighscoreFilePath = Path.Combine(Environment.CurrentDirectory, CSettings.sFileHighscoreDB);
_CoverFilePath = Path.Combine(Environment.CurrentDirectory, CSettings.sFileCoverDB);
_CreditsRessourcesFilePath = Path.Combine(Environment.CurrentDirectory, CSettings.sFileCreditsRessourcesDB);
InitHighscoreDB();
InitCoverDB();
@@ -83,13 +80,11 @@ namespace Vocaluxe.Base
using (SQLiteCommand command = new SQLiteCommand(connection))
{
int DataBaseSongID = GetDataBaseSongID(Artist, Title, NumPlayed, command);
int result = AddScore(player, command, DataBaseSongID);
return result;
}
}
}
public static int AddScore(SPlayer player)
@@ -109,7 +104,6 @@ namespace Vocaluxe.Base
using (SQLiteCommand command = new SQLiteCommand(connection))
{
int DataBaseSongID = GetDataBaseSongID(player, command);
int result = AddScore(player, command, DataBaseSongID);
@@ -124,7 +118,6 @@ namespace Vocaluxe.Base
if (DataBaseSongID >= 0)
{
int Medley = 0;
if (player.Medley)
Medley = 1;
@@ -139,24 +132,22 @@ namespace Vocaluxe.Base
command.CommandText = "SELECT id FROM Scores WHERE SongID = @SongID AND PlayerName = @PlayerName AND Score = @Score AND " +
"LineNr = @LineNr AND Date = @Date AND Medley = @Medley AND Duet = @Duet AND ShortSong = @ShortSong AND Difficulty = @Difficulty";
command.Parameters.Add("@SongID", System.Data.DbType.Int32, 0).Value = DataBaseSongID;
command.Parameters.Add("@PlayerName", System.Data.DbType.String, 0).Value = player.Name;
command.Parameters.Add("@Score", System.Data.DbType.Int32, 0).Value = (int)Math.Round(player.Points);
command.Parameters.Add("@LineNr", System.Data.DbType.Int32, 0).Value = (int)player.LineNr;
command.Parameters.Add("@Date", System.Data.DbType.Int64, 0).Value = player.DateTicks;
command.Parameters.Add("@Medley", System.Data.DbType.Int32, 0).Value = Medley;
command.Parameters.Add("@Duet", System.Data.DbType.Int32, 0).Value = Duet;
command.Parameters.Add("@ShortSong", System.Data.DbType.Int32, 0).Value = ShortSong;
command.Parameters.Add("@Difficulty", System.Data.DbType.Int32, 0).Value = (int)player.Difficulty;
command.Parameters.Add("@SongID", DbType.Int32, 0).Value = DataBaseSongID;
command.Parameters.Add("@PlayerName", DbType.String, 0).Value = player.Name;
command.Parameters.Add("@Score", DbType.Int32, 0).Value = (int)Math.Round(player.Points);
command.Parameters.Add("@LineNr", DbType.Int32, 0).Value = player.LineNr;
command.Parameters.Add("@Date", DbType.Int64, 0).Value = player.DateTicks;
command.Parameters.Add("@Medley", DbType.Int32, 0).Value = Medley;
command.Parameters.Add("@Duet", DbType.Int32, 0).Value = Duet;
command.Parameters.Add("@ShortSong", DbType.Int32, 0).Value = ShortSong;
command.Parameters.Add("@Difficulty", DbType.Int32, 0).Value = (int)player.Difficulty;
SQLiteDataReader reader = null;
try
{
reader = command.ExecuteReader();
}
catch (Exception)
{
}
catch (Exception) {}
if (reader != null && reader.HasRows)
{
@@ -172,15 +163,15 @@ namespace Vocaluxe.Base
command.CommandText = "INSERT INTO Scores (SongID, PlayerName, Score, LineNr, Date, Medley, Duet, ShortSong, Difficulty) " +
"VALUES (@SongID, @PlayerName, @Score, @LineNr, @Date, @Medley, @Duet, @ShortSong, @Difficulty)";
command.Parameters.Add("@SongID", System.Data.DbType.Int32, 0).Value = DataBaseSongID;
command.Parameters.Add("@PlayerName", System.Data.DbType.String, 0).Value = player.Name;
command.Parameters.Add("@Score", System.Data.DbType.Int32, 0).Value = (int)Math.Round(player.Points);
command.Parameters.Add("@LineNr", System.Data.DbType.Int32, 0).Value = (int)player.LineNr;
command.Parameters.Add("@Date", System.Data.DbType.Int64, 0).Value = player.DateTicks;
command.Parameters.Add("@Medley", System.Data.DbType.Int32, 0).Value = Medley;
command.Parameters.Add("@Duet", System.Data.DbType.Int32, 0).Value = Duet;
command.Parameters.Add("@ShortSong", System.Data.DbType.Int32, 0).Value = ShortSong;
command.Parameters.Add("@Difficulty", System.Data.DbType.Int32, 0).Value = (int)player.Difficulty;
command.Parameters.Add("@SongID", DbType.Int32, 0).Value = DataBaseSongID;
command.Parameters.Add("@PlayerName", DbType.String, 0).Value = player.Name;
command.Parameters.Add("@Score", DbType.Int32, 0).Value = (int)Math.Round(player.Points);
command.Parameters.Add("@LineNr", DbType.Int32, 0).Value = player.LineNr;
command.Parameters.Add("@Date", DbType.Int64, 0).Value = player.DateTicks;
command.Parameters.Add("@Medley", DbType.Int32, 0).Value = Medley;
command.Parameters.Add("@Duet", DbType.Int32, 0).Value = Duet;
command.Parameters.Add("@ShortSong", DbType.Int32, 0).Value = ShortSong;
command.Parameters.Add("@Difficulty", DbType.Int32, 0).Value = (int)player.Difficulty;
command.ExecuteNonQuery();
//Read last insert line
@@ -191,9 +182,7 @@ namespace Vocaluxe.Base
if (reader != null && reader.HasRows)
{
while (reader.Read())
{
lastInsertID = reader.GetInt32(0);
}
reader.Dispose();
}
}
@@ -220,7 +209,6 @@ namespace Vocaluxe.Base
using (SQLiteCommand command = new SQLiteCommand(connection))
{
int Medley = 0;
if (player.Medley)
Medley = 1;
@@ -239,10 +227,10 @@ namespace Vocaluxe.Base
command.CommandText = "SELECT PlayerName, Score, Date, Difficulty, LineNr, id FROM Scores " +
"WHERE [SongID] = @SongID AND [Medley] = @Medley AND [Duet] = @Duet AND [ShortSong] = @ShortSong " +
"ORDER BY [Score] DESC";
command.Parameters.Add("@SongID", System.Data.DbType.Int32, 0).Value = DataBaseSongID;
command.Parameters.Add("@Medley", System.Data.DbType.Int32, 0).Value = Medley;
command.Parameters.Add("@Duet", System.Data.DbType.Int32, 0).Value = Duet;
command.Parameters.Add("@ShortSong", System.Data.DbType.Int32, 0).Value = ShortSong;
command.Parameters.Add("@SongID", DbType.Int32, 0).Value = DataBaseSongID;
command.Parameters.Add("@Medley", DbType.Int32, 0).Value = Medley;
command.Parameters.Add("@Duet", DbType.Int32, 0).Value = Duet;
command.Parameters.Add("@ShortSong", DbType.Int32, 0).Value = ShortSong;
SQLiteDataReader reader = command.ExecuteReader();
if (reader != null && reader.HasRows)
@@ -261,10 +249,7 @@ namespace Vocaluxe.Base
}
reader.Dispose();
}
}
}
}
}
@@ -295,18 +280,15 @@ namespace Vocaluxe.Base
}
using (SQLiteCommand command = new SQLiteCommand(connection))
{
return GetDataBaseSongID(Artist, Title, DefNumPlayed, command);
}
}
}
private static int GetDataBaseSongID(string Artist, string Title, int DefNumPlayed, SQLiteCommand command)
{
command.CommandText = "SELECT id FROM Songs WHERE [Title] = @title AND [Artist] = @artist";
command.Parameters.Add("@title", System.Data.DbType.String, 0).Value = Title;
command.Parameters.Add("@artist", System.Data.DbType.String, 0).Value = Artist;
command.Parameters.Add("@title", DbType.String, 0).Value = Title;
command.Parameters.Add("@artist", DbType.String, 0).Value = Artist;
SQLiteDataReader reader = command.ExecuteReader();
@@ -324,14 +306,14 @@ namespace Vocaluxe.Base
command.CommandText = "INSERT INTO Songs (Title, Artist, NumPlayed) " +
"VALUES (@title, @artist, @numplayed)";
command.Parameters.Add("@title", System.Data.DbType.String, 0).Value = Title;
command.Parameters.Add("@artist", System.Data.DbType.String, 0).Value = Artist;
command.Parameters.Add("@numplayed", System.Data.DbType.Int32, 0).Value = DefNumPlayed;
command.Parameters.Add("@title", DbType.String, 0).Value = Title;
command.Parameters.Add("@artist", DbType.String, 0).Value = Artist;
command.Parameters.Add("@numplayed", DbType.Int32, 0).Value = DefNumPlayed;
command.ExecuteNonQuery();
command.CommandText = "SELECT id FROM Songs WHERE [Title] = @title AND [Artist] = @artist";
command.Parameters.Add("@title", System.Data.DbType.String, 0).Value = Title;
command.Parameters.Add("@artist", System.Data.DbType.String, 0).Value = Artist;
command.Parameters.Add("@title", DbType.String, 0).Value = Title;
command.Parameters.Add("@artist", DbType.String, 0).Value = Artist;
reader = command.ExecuteReader();
@@ -372,7 +354,7 @@ namespace Vocaluxe.Base
using (SQLiteCommand command = new SQLiteCommand(connection))
{
command.CommandText = "SELECT Artist, Title, NumPlayed FROM Songs WHERE [id] = @id";
command.Parameters.Add("@id", System.Data.DbType.String, 0).Value = SongID;
command.Parameters.Add("@id", DbType.String, 0).Value = SongID;
SQLiteDataReader reader = null;
try
@@ -442,7 +424,6 @@ namespace Vocaluxe.Base
using (SQLiteCommand command = new SQLiteCommand(connection))
{
command.CommandText = "CREATE TABLE IF NOT EXISTS Version ( id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, Value INTEGER NOT NULL);";
command.ExecuteNonQuery();
@@ -458,7 +439,6 @@ namespace Vocaluxe.Base
"SongID INTEGER NOT NULL, PlayerName TEXT NOT NULL, Score INTEGER NOT NULL, LineNr INTEGER NOT NULL, Date BIGINT NOT NULL, " +
"Medley INTEGER NOT NULL, Duet INTEGER NOT NULL, ShortSong INTEGER NOT NULL, Difficulty INTEGER NOT NULL);";
command.ExecuteNonQuery();
}
}
}
@@ -480,7 +460,6 @@ namespace Vocaluxe.Base
using (SQLiteCommand command = new SQLiteCommand(connection))
{
command.CommandText = "CREATE TABLE IF NOT EXISTS Version ( id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, Value INTEGER NOT NULL);";
command.ExecuteNonQuery();
@@ -495,7 +474,6 @@ namespace Vocaluxe.Base
"SongID INTEGER NOT NULL, PlayerName TEXT NOT NULL, Score INTEGER NOT NULL, LineNr INTEGER NOT NULL, Date BIGINT NOT NULL, " +
"Medley INTEGER NOT NULL, Duet INTEGER NOT NULL, Difficulty INTEGER NOT NULL);";
command.ExecuteNonQuery();
}
}
}
@@ -523,7 +501,6 @@ namespace Vocaluxe.Base
SQLiteDataReader reader = null;
using (SQLiteCommand command = new SQLiteCommand(connection))
{
command.CommandText = "PRAGMA user_version";
reader = command.ExecuteReader();
reader.Read();
@@ -547,9 +524,7 @@ namespace Vocaluxe.Base
{
reader = command.ExecuteReader();
}
catch (Exception)
{
}
catch (Exception) {}
if (reader == null)
{
@@ -628,9 +603,9 @@ namespace Vocaluxe.Base
using (SQLiteCommand command = new SQLiteCommand(connection))
{
//The USDX database has no column for LineNr, Medley and Duet so just fill 0 in there
command.CommandText = "INSERT INTO Scores (SongID, PlayerName, Score, LineNr, Date, Medley, Duet, Difficulty) SELECT SongID, Player, Score, '0', Date, '0', '0', Difficulty from US_Scores";
command.CommandText =
"INSERT INTO Scores (SongID, PlayerName, Score, LineNr, Date, Medley, Duet, Difficulty) SELECT SongID, Player, Score, '0', Date, '0', '0', Difficulty from US_Scores";
command.ExecuteNonQuery();
command.CommandText = "INSERT INTO Songs SELECT ID, Artist, Title, TimesPlayed from US_Songs";
@@ -696,9 +671,9 @@ namespace Vocaluxe.Base
foreach (SData data in songs)
{
command.CommandText = "UPDATE Songs SET [Artist] = @artist, [Title] = @title WHERE [ID] = @id";
command.Parameters.Add("@title", System.Data.DbType.String, 0).Value = data.str2;
command.Parameters.Add("@artist", System.Data.DbType.String, 0).Value = data.str1;
command.Parameters.Add("@id", System.Data.DbType.Int32, 0).Value = data.id;
command.Parameters.Add("@title", DbType.String, 0).Value = data.str2;
command.Parameters.Add("@artist", DbType.String, 0).Value = data.str1;
command.Parameters.Add("@id", DbType.Int32, 0).Value = data.id;
command.ExecuteNonQuery();
}
@@ -706,9 +681,9 @@ namespace Vocaluxe.Base
foreach (SData data in scores)
{
command.CommandText = "UPDATE Scores SET [PlayerName] = @player, [Date] = @date WHERE [id] = @id";
command.Parameters.Add("@player", System.Data.DbType.String, 0).Value = data.str1;
command.Parameters.Add("@date", System.Data.DbType.Int64, 0).Value = data.ticks;
command.Parameters.Add("@id", System.Data.DbType.Int32, 0).Value = data.id;
command.Parameters.Add("@player", DbType.String, 0).Value = data.str1;
command.Parameters.Add("@date", DbType.Int64, 0).Value = data.ticks;
command.Parameters.Add("@id", DbType.Int32, 0).Value = data.id;
command.ExecuteNonQuery();
}
_Transaction.Commit();
@@ -726,7 +701,6 @@ namespace Vocaluxe.Base
//This versioning is not used in Vocaluxe so reset it to 0
command.CommandText = "PRAGMA user_version = 0";
command.ExecuteNonQuery();
}
}
@@ -755,7 +729,6 @@ namespace Vocaluxe.Base
using (SQLiteCommand command = new SQLiteCommand(connection))
{
command.CommandText = "PRAGMA table_info(US_Scores);";
bool dateExists = false;
using (SQLiteDataReader reader = command.ExecuteReader())
@@ -773,14 +746,19 @@ namespace Vocaluxe.Base
}
}
}
}
//This is a USDX 1.01 DB
if (!dateExists)
command.CommandText = "INSERT INTO Scores (SongID, PlayerName, Score, LineNr, Date, Medley, Duet, Difficulty) SELECT SongID, Player, Score, '0', '0', '0', '0', Difficulty from US_Scores";
{
command.CommandText =
"INSERT INTO Scores (SongID, PlayerName, Score, LineNr, Date, Medley, Duet, Difficulty) SELECT SongID, Player, Score, '0', '0', '0', '0', Difficulty from US_Scores";
}
else // This is a CMD 1.01 DB
command.CommandText = "INSERT INTO Scores (SongID, PlayerName, Score, LineNr, Date, Medley, Duet, Difficulty) SELECT SongID, Player, Score, '0', Date, '0', '0', Difficulty from US_Scores";
{
command.CommandText =
"INSERT INTO Scores (SongID, PlayerName, Score, LineNr, Date, Medley, Duet, Difficulty) SELECT SongID, Player, Score, '0', Date, '0', '0', Difficulty from US_Scores";
}
command.ExecuteNonQuery();
command.CommandText = "INSERT INTO Songs SELECT ID, Artist, Title, TimesPlayed from US_Songs";
@@ -794,18 +772,14 @@ namespace Vocaluxe.Base
int res = Sqlite3.sqlite3_open(FilePath, out OldDB);
if (res != Sqlite3.SQLITE_OK)
{
CLog.LogError("Error opening Database: " + FilePath + " (" + Sqlite3.sqlite3_errmsg(OldDB) + ")");
}
else
{
Sqlite3.Vdbe Stmt = new Sqlite3.Vdbe();
res = Sqlite3.sqlite3_prepare_v2(OldDB, "SELECT id, Artist, Title FROM Songs", -1, ref Stmt, 0);
if (res != Sqlite3.SQLITE_OK)
{
CLog.LogError("Error query Database: " + FilePath + " (" + Sqlite3.sqlite3_errmsg(OldDB) + ")");
}
else
{
//Sqlite3.sqlite3_step(Stmt);
@@ -844,9 +818,7 @@ namespace Vocaluxe.Base
res = Sqlite3.sqlite3_prepare_v2(OldDB, "SELECT id, PlayerName, Date FROM Scores", -1, ref Stmt, 0);
if (res != Sqlite3.SQLITE_OK)
{
CLog.LogError("Error query Database: " + FilePath + " (" + Sqlite3.sqlite3_errmsg(OldDB) + ")");
}
else
{
//Sqlite3.sqlite3_step(Stmt);
@@ -882,9 +854,9 @@ namespace Vocaluxe.Base
foreach (SData data in songs)
{
command.CommandText = "UPDATE Songs SET [Artist] = @artist, [Title] = @title WHERE [ID] = @id";
command.Parameters.Add("@title", System.Data.DbType.String, 0).Value = data.str2;
command.Parameters.Add("@artist", System.Data.DbType.String, 0).Value = data.str1;
command.Parameters.Add("@id", System.Data.DbType.Int32, 0).Value = data.id;
command.Parameters.Add("@title", DbType.String, 0).Value = data.str2;
command.Parameters.Add("@artist", DbType.String, 0).Value = data.str1;
command.Parameters.Add("@id", DbType.Int32, 0).Value = data.id;
command.ExecuteNonQuery();
}
@@ -896,10 +868,10 @@ namespace Vocaluxe.Base
else
{
command.CommandText = "UPDATE Scores SET [PlayerName] = @player, [Date] = @date WHERE [id] = @id";
command.Parameters.Add("@date", System.Data.DbType.Int64, 0).Value = data.ticks;
command.Parameters.Add("@date", DbType.Int64, 0).Value = data.ticks;
}
command.Parameters.Add("@player", System.Data.DbType.String, 0).Value = data.str1;
command.Parameters.Add("@id", System.Data.DbType.Int32, 0).Value = data.id;
command.Parameters.Add("@player", DbType.String, 0).Value = data.str1;
command.Parameters.Add("@id", DbType.Int32, 0).Value = data.id;
command.ExecuteNonQuery();
}
_Transaction.Commit();
@@ -920,25 +892,21 @@ namespace Vocaluxe.Base
{
bool updated = true;
if (CurrentVersion < 2)
{
updated &= ConvertV1toV2(connection);
}
return updated;
}
private static bool ConvertV1toV2(SQLiteConnection connection)
{
using (SQLiteCommand command = new SQLiteCommand(connection))
{
command.CommandText = "ALTER TABLE Scores ADD ShortSong INTEGER";
command.ExecuteNonQuery();
command.CommandText = "UPDATE Scores SET [ShortSong] = @ShortSong";
command.Parameters.Add("@ShortSong", System.Data.DbType.Int32, 0).Value = 0;
command.Parameters.Add("@ShortSong", DbType.Int32, 0).Value = 0;
command.ExecuteNonQuery();
command.CommandText = "UPDATE Version SET [Value] = @version";
command.Parameters.Add("@version", System.Data.DbType.Int32, 0).Value = 2;
command.Parameters.Add("@version", DbType.Int32, 0).Value = 2;
command.ExecuteNonQuery();
}
@@ -994,10 +962,8 @@ namespace Vocaluxe.Base
string artist, title;
int numplayed;
if (GetDataBaseSongInfos(songid, out artist, out title, out numplayed, SourceDBPath))
{
AddScore(player, score, linenr, date, medley, duet, shortsong, diff, artist, title, numplayed, _HighscoreFilePath);
}
}
#endregion import table scores
rSource.Close();
@@ -1026,9 +992,8 @@ namespace Vocaluxe.Base
using (SQLiteCommand command = new SQLiteCommand(_ConnectionCover))
{
command.CommandText = "SELECT id, width, height FROM Cover WHERE [Path] = @path";
command.Parameters.Add("@path", System.Data.DbType.String, 0).Value = CoverPath;
command.Parameters.Add("@path", DbType.String, 0).Value = CoverPath;
SQLiteDataReader reader = command.ExecuteReader();
@@ -1059,9 +1024,7 @@ namespace Vocaluxe.Base
reader.Close();
if (_TransactionCover == null)
{
_TransactionCover = _ConnectionCover.BeginTransaction();
}
Bitmap origin;
try
@@ -1088,12 +1051,10 @@ namespace Vocaluxe.Base
using (Bitmap bmp = new Bitmap(w, h))
{
using (Graphics g = Graphics.FromImage(bmp))
{
g.DrawImage(origin, new Rectangle(0, 0, w, h));
}
data = new byte[w * h * 4];
BitmapData bmp_data = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
BitmapData bmp_data = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb);
Marshal.Copy(bmp_data.Scan0, data, 0, w * h * 4);
bmp.UnlockBits(bmp_data);
}
@@ -1108,11 +1069,11 @@ namespace Vocaluxe.Base
command.CommandText = "INSERT INTO Cover (Path, width, height) VALUES (@path, @w, @h)";
command.Parameters.Add("@w", DbType.Int32).Value = w;
command.Parameters.Add("@h", DbType.Int32).Value = h;
command.Parameters.Add("@path", System.Data.DbType.String, 0).Value = CoverPath;
command.Parameters.Add("@path", DbType.String, 0).Value = CoverPath;
command.ExecuteNonQuery();
command.CommandText = "SELECT id FROM Cover WHERE [Path] = @path";
command.Parameters.Add("@path", System.Data.DbType.String, 0).Value = CoverPath;
command.Parameters.Add("@path", DbType.String, 0).Value = CoverPath;
reader = command.ExecuteReader();
if (reader != null)
@@ -1122,7 +1083,7 @@ namespace Vocaluxe.Base
reader.Dispose();
command.CommandText = "INSERT INTO CoverData (CoverID, Data) VALUES (@id, @data)";
command.Parameters.Add("@id", DbType.Int32).Value = id;
command.Parameters.Add("@data", System.Data.DbType.Binary, 20).Value = data;
command.Parameters.Add("@data", DbType.Binary, 20).Value = data;
command.ExecuteReader();
return true;
}
@@ -1179,9 +1140,7 @@ namespace Vocaluxe.Base
{
reader = command.ExecuteReader();
}
catch (Exception)
{
}
catch (Exception) {}
if (reader == null)
{
@@ -1226,7 +1185,6 @@ namespace Vocaluxe.Base
using (SQLiteCommand command = new SQLiteCommand(connection))
{
command.CommandText = "CREATE TABLE IF NOT EXISTS Version ( id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, Value INTEGER NOT NULL);";
command.ExecuteNonQuery();
@@ -1241,7 +1199,6 @@ namespace Vocaluxe.Base
command.CommandText = "CREATE TABLE IF NOT EXISTS CoverData ( id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, " +
"CoverID INTEGER NOT NULL, Data BLOB NOT NULL);";
command.ExecuteNonQuery();
}
}
}
@@ -1265,9 +1222,8 @@ namespace Vocaluxe.Base
}
using (SQLiteCommand command = new SQLiteCommand(connection))
{
command.CommandText = "SELECT id, width, height FROM Images WHERE [Path] = @path";
command.Parameters.Add("@path", System.Data.DbType.String, 0).Value = FileName;
command.Parameters.Add("@path", DbType.String, 0).Value = FileName;
SQLiteDataReader reader = command.ExecuteReader();
@@ -1307,7 +1263,6 @@ namespace Vocaluxe.Base
if (File.Exists(ImagePath))
{
using (SQLiteConnection connection = new SQLiteConnection())
{
connection.ConnectionString = "Data Source=" + _CreditsRessourcesFilePath;
@@ -1321,7 +1276,6 @@ namespace Vocaluxe.Base
}
using (SQLiteCommand command = new SQLiteCommand(connection))
{
Bitmap origin;
try
{
@@ -1340,18 +1294,18 @@ namespace Vocaluxe.Base
{
data = new byte[w * h * 4];
BitmapData bmp_data = origin.LockBits(new Rectangle(0, 0, w, h), ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
BitmapData bmp_data = origin.LockBits(new Rectangle(0, 0, w, h), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb);
Marshal.Copy(bmp_data.Scan0, data, 0, w * h * 4);
origin.UnlockBits(bmp_data);
command.CommandText = "INSERT INTO Images (Path, width, height) VALUES (@path, @w, @h)";
command.Parameters.Add("@path", System.Data.DbType.String, 0).Value = Path.GetFileName(ImagePath);
command.Parameters.Add("@w", System.Data.DbType.Int32, 0).Value = w;
command.Parameters.Add("@h", System.Data.DbType.Int32, 0).Value = h;
command.Parameters.Add("@path", DbType.String, 0).Value = Path.GetFileName(ImagePath);
command.Parameters.Add("@w", DbType.Int32, 0).Value = w;
command.Parameters.Add("@h", DbType.Int32, 0).Value = h;
command.ExecuteNonQuery();
command.CommandText = "SELECT id FROM Images WHERE [Path] = @path";
command.Parameters.Add("@path", System.Data.DbType.String, 0).Value = Path.GetFileName(ImagePath);
command.Parameters.Add("@path", DbType.String, 0).Value = Path.GetFileName(ImagePath);
SQLiteDataReader reader = command.ExecuteReader();
if (reader != null)
@@ -1360,8 +1314,8 @@ namespace Vocaluxe.Base
int id = reader.GetInt32(0);
reader.Close();
command.CommandText = "INSERT INTO ImageData (ImageID, Data) VALUES (@id, @data)";
command.Parameters.Add("@id", System.Data.DbType.Int32, 20).Value = id;
command.Parameters.Add("@data", System.Data.DbType.Binary, 20).Value = data;
command.Parameters.Add("@id", DbType.Int32, 20).Value = id;
command.Parameters.Add("@data", DbType.Binary, 20).Value = data;
command.ExecuteReader();
result = true;
}
@@ -1370,7 +1324,6 @@ namespace Vocaluxe.Base
{
origin.Dispose();
}
}
}
}
@@ -1403,9 +1356,7 @@ namespace Vocaluxe.Base
{
reader = command.ExecuteReader();
}
catch (Exception)
{
}
catch (Exception) {}
if (reader == null)
{
@@ -1451,7 +1402,6 @@ namespace Vocaluxe.Base
using (SQLiteCommand command = new SQLiteCommand(connection))
{
command.CommandText = "CREATE TABLE IF NOT EXISTS Version ( id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, Value INTEGER NOT NULL);";
command.ExecuteNonQuery();
@@ -1466,7 +1416,6 @@ namespace Vocaluxe.Base
command.CommandText = "CREATE TABLE IF NOT EXISTS ImageData ( id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, " +
"ImageID INTEGER NOT NULL, Data BLOB NOT NULL);";
command.ExecuteNonQuery();
}
}
}
+6 -21
View File
@@ -27,7 +27,7 @@ namespace Vocaluxe.Menu
public class CEqualizer : IMenuElement
{
private int _PartyModeID;
private readonly int _PartyModeID;
private SThemeEqualizer _Theme;
private bool _ThemeLoaded;
@@ -87,14 +87,12 @@ namespace Vocaluxe.Menu
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/Space", ref Space);
_ThemeLoaded &= xmlReader.TryGetEnumValue<EEqualizerStyle>(item + "/Style", ref _Theme.Style);
_ThemeLoaded &= xmlReader.TryGetEnumValue(item + "/Style", ref _Theme.Style);
_ThemeLoaded &= xmlReader.TryGetEnumValue<EOffOn>(item + "/DrawNegative", ref _Theme.DrawNegative);
_ThemeLoaded &= xmlReader.TryGetEnumValue(item + "/DrawNegative", ref _Theme.DrawNegative);
if (xmlReader.GetValue(item + "/Color", ref _Theme.ColorName, String.Empty))
{
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, SkinIndex, out Color);
}
else
{
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/R", ref Color.R);
@@ -104,9 +102,7 @@ namespace Vocaluxe.Menu
}
if (xmlReader.GetValue(item + "/MaxColor", ref _Theme.MaxColorName, String.Empty))
{
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, SkinIndex, out Color);
}
else
{
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/MaxR", ref MaxColor.R);
@@ -130,9 +126,7 @@ namespace Vocaluxe.Menu
_Theme.Name = ElementName;
_Bars = new float[_Theme.NumBars];
for (int i = 0; i < _Bars.Length; i++)
{
_Bars[i] = 0f;
}
LoadTextures();
}
return _ThemeLoaded;
@@ -166,9 +160,7 @@ namespace Vocaluxe.Menu
writer.WriteComment("<Color>: Equalizer color from ColorScheme (high priority)");
writer.WriteComment("or <R>, <G>, <B>, <A> (lower priority)");
if (_Theme.ColorName.Length > 0)
{
writer.WriteElementString("Color", _Theme.ColorName);
}
else
{
writer.WriteElementString("R", Color.R.ToString("#0.00"));
@@ -179,9 +171,7 @@ namespace Vocaluxe.Menu
writer.WriteComment("<MaxColor>: Equalizer color for maximal volume from ColorScheme (high priority)");
writer.WriteComment("or <MaxR>, <MaxG>, <MaxB>, <MaxA> (lower priority)");
if (_Theme.ColorName.Length > 0)
{
writer.WriteElementString("MaxColor", _Theme.ColorName);
}
else
{
writer.WriteElementString("MaxR", Color.R.ToString("#0.00"));
@@ -213,7 +203,8 @@ namespace Vocaluxe.Menu
return;
for (int i = 0; i < _Bars.Length; i++)
{
if (weights.Length > i){
if (weights.Length > i)
{
_Bars[i] = 1f - weights[i];
if (_Theme.DrawNegative == EOffOn.TR_CONFIG_OFF && weights[i] < 0)
_Bars[i] = (1f + weights[i]);
@@ -229,10 +220,8 @@ namespace Vocaluxe.Menu
return;
for (int i = 0; i < _Bars.Length; i++)
{
_Bars[i] = 0f;
}
}
public void Draw()
{
@@ -256,9 +245,7 @@ namespace Vocaluxe.Menu
SRectF bar = new SRectF(Rect.X + dx * i, Rect.Y + Rect.H - _Bars[i] * Rect.H, dx - Space, _Bars[i] * Rect.H, Rect.Z);
SColorF color = Color;
if (i == max)
{
color = MaxColor;
}
CBase.Drawing.DrawColor(color, bar);
@@ -267,9 +254,7 @@ namespace Vocaluxe.Menu
}
}
public void UnloadTextures()
{
}
public void UnloadTextures() {}
public void LoadTextures()
{
+19 -48
View File
@@ -36,8 +36,8 @@ namespace Vocaluxe.Menu
public class CText : IMenuElement
{
private SThemeText _Theme;
private bool _ThemeLoaded=false;
private int _PartyModeID=-1;
private bool _ThemeLoaded;
private readonly int _PartyModeID = -1;
private int _TranslationID = -1;
public string GetThemeName()
@@ -45,12 +45,12 @@ namespace Vocaluxe.Menu
return _Theme.Name;
}
private bool _ButtonText=false;
private bool _ButtonText;
private bool _PositionNeedsUpdate = true;
private STextPosition _DrawPosition = new STextPosition(0);
private float _X = 0f;
private float _X;
public float X //left
{
get { return _X; }
@@ -64,7 +64,7 @@ namespace Vocaluxe.Menu
}
}
private float _Y = 0f;
private float _Y;
public float Y //higher
{
get { return _Y; }
@@ -78,14 +78,14 @@ namespace Vocaluxe.Menu
}
}
private float _Z = 0f;
private float _Z;
public float Z
{
get { return _Z; }
set { _Z = value; }
}
private float _Height = 0f;
private float _Height;
public float Height
{
get { return _Height; }
@@ -99,7 +99,7 @@ namespace Vocaluxe.Menu
}
}
private float _MaxWidth = 0f;
private float _MaxWidth;
public float MaxWidth
{
get { return _MaxWidth; }
@@ -118,7 +118,7 @@ namespace Vocaluxe.Menu
}
}
private SRectF _Bounds = new SRectF();
private SRectF _Bounds;
public SRectF Bounds
{
get { return _Bounds; }
@@ -232,7 +232,7 @@ namespace Vocaluxe.Menu
public bool Selected = false;
public bool Visible = true;
private bool _EditMode = false;
private bool _EditMode;
public bool EditMode
{
get { return _EditMode; }
@@ -286,7 +286,8 @@ namespace Vocaluxe.Menu
_EditMode = text._EditMode;
}
public CText(float x, float y, float z, EAlignment align, float h, float mw, float r, float g, float b, float a, EStyle style, string font, string text, float rspace, float rheight)
public CText(float x, float y, float z, EAlignment align, float h, float mw, float r, float g, float b, float a, EStyle style, string font, string text, float rspace,
float rheight)
{
_Theme = new SThemeText();
_ThemeLoaded = false;
@@ -312,13 +313,9 @@ namespace Vocaluxe.Menu
Selected = false;
if (MaxWidth > 0)
{
Bounds = new SRectF(-CBase.Settings.GetRenderW(), -CBase.Settings.GetRenderH(), MaxWidth, 3f * CBase.Settings.GetRenderH(), 0f);
}
else
{
Bounds = new SRectF(-CBase.Settings.GetRenderW(), -CBase.Settings.GetRenderH(), 3f * CBase.Settings.GetRenderW(), 3f * CBase.Settings.GetRenderH(), 0f);
}
Reflection = true;
ReflectionSpace = rspace;
@@ -351,13 +348,9 @@ namespace Vocaluxe.Menu
Selected = false;
if (MaxWidth > 0)
{
Bounds = new SRectF(-CBase.Settings.GetRenderW(), -CBase.Settings.GetRenderH(), MaxWidth, 3f * CBase.Settings.GetRenderH(), 0f);
}
else
{
Bounds = new SRectF(-CBase.Settings.GetRenderW(), -CBase.Settings.GetRenderH(), 3f * CBase.Settings.GetRenderW(), 3f * CBase.Settings.GetRenderH(), 0f);
}
Reflection = false;
}
@@ -388,13 +381,9 @@ namespace Vocaluxe.Menu
Selected = false;
if (MaxWidth > 0)
{
Bounds = new SRectF(-CBase.Settings.GetRenderW(), -CBase.Settings.GetRenderH(), MaxWidth, 3f * CBase.Settings.GetRenderH(), 0f);
}
else
{
Bounds = new SRectF(-CBase.Settings.GetRenderW(), -CBase.Settings.GetRenderH(), 3f * CBase.Settings.GetRenderW(), 3f * CBase.Settings.GetRenderH(), 0f);
}
Reflection = true;
ReflectionSpace = rspace;
@@ -427,13 +416,9 @@ namespace Vocaluxe.Menu
Selected = false;
if (MaxWidth > 0)
{
Bounds = new SRectF(-CBase.Settings.GetRenderW(), -CBase.Settings.GetRenderH(), MaxWidth, 3f * CBase.Settings.GetRenderH(), 0f);
}
else
{
Bounds = new SRectF(-CBase.Settings.GetRenderW(), -CBase.Settings.GetRenderH(), 3f * CBase.Settings.GetRenderW(), 3f * CBase.Settings.GetRenderH(), 0f);
}
Reflection = false;
}
@@ -458,9 +443,7 @@ namespace Vocaluxe.Menu
xmlReader.TryGetFloatValue(item + "/MaxW", ref _MaxWidth);
if (xmlReader.GetValue(item + "/Color", ref _Theme.ColorName, String.Empty))
{
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, SkinIndex, out Color);
}
else
{
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/R", ref Color.R);
@@ -470,9 +453,7 @@ namespace Vocaluxe.Menu
}
if (xmlReader.GetValue(item + "/SColor", ref _Theme.SColorName, String.Empty))
{
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.SColorName, SkinIndex, out SColor);
}
else
{
if (xmlReader.TryGetFloatValue(item + "/SR", ref SColor.R))
@@ -483,9 +464,9 @@ namespace Vocaluxe.Menu
}
}
_ThemeLoaded &= xmlReader.TryGetEnumValue<EAlignment>(item + "/Align", ref _Align);
xmlReader.TryGetEnumValue<EHAlignment>(item + "/HAlign", ref _HAlign);
_ThemeLoaded &= xmlReader.TryGetEnumValue<EStyle>(item + "/Style", ref _Style);
_ThemeLoaded &= xmlReader.TryGetEnumValue(item + "/Align", ref _Align);
xmlReader.TryGetEnumValue(item + "/HAlign", ref _HAlign);
_ThemeLoaded &= xmlReader.TryGetEnumValue(item + "/Style", ref _Style);
_ThemeLoaded &= xmlReader.GetValue(item + "/Font", ref _Font, "Normal");
_ThemeLoaded &= xmlReader.GetValue(item + "/Text", ref _Theme.Text, String.Empty);
@@ -542,9 +523,7 @@ namespace Vocaluxe.Menu
writer.WriteComment("<Color>: Text color from ColorScheme (high priority)");
writer.WriteComment("or <R>, <G>, <B>, <A> (lower priority)");
if (_Theme.ColorName.Length > 0)
{
writer.WriteElementString("Color", _Theme.ColorName);
}
else
{
writer.WriteElementString("R", Color.R.ToString("#0.00"));
@@ -556,9 +535,7 @@ namespace Vocaluxe.Menu
writer.WriteComment("<SColor>: Selected Text color from ColorScheme (high priority)");
writer.WriteComment("or <SR>, <SG>, <SB>, <SA> (lower priority)");
if (_Theme.SColorName.Length > 0)
{
writer.WriteElementString("SColor", _Theme.SColorName);
}
else
{
writer.WriteElementString("SR", SColor.R.ToString("#0.00"));
@@ -663,7 +640,7 @@ namespace Vocaluxe.Menu
public void Draw(float begin, float end)
{
RectangleF bounds = CBase.Fonts.GetTextBounds(this, this.Height);
RectangleF bounds = CBase.Fonts.GetTextBounds(this, Height);
float x = X;
switch (Align)
@@ -693,10 +670,8 @@ namespace Vocaluxe.Menu
}
if (Selected && (CBase.Settings.GetGameState() == EGameState.EditTheme))
{
CBase.Drawing.DrawColor(new SColorF(0.5f, 1f, 0.5f, 0.5f), new SRectF(x, Y, bounds.Width, bounds.Height, Z));
}
}
public void DrawRelative(float x, float y)
{
@@ -721,7 +696,7 @@ namespace Vocaluxe.Menu
CBase.Fonts.SetFont(Font);
CBase.Fonts.SetStyle(Style);
RectangleF bounds = CBase.Fonts.GetTextBounds(this, this.Height);
RectangleF bounds = CBase.Fonts.GetTextBounds(this, Height);
if (bounds.Width > Bounds.W && Bounds.W > 0f && bounds.Width > 0f)
{
@@ -775,14 +750,10 @@ namespace Vocaluxe.Menu
}
if (Selected && (CBase.Settings.GetGameState() == EGameState.EditTheme))
{
CBase.Drawing.DrawColor(new SColorF(0.5f, 1f, 0.5f, 0.5f * CBase.Graphics.GetGlobalAlpha()), new SRectF(x, y, bounds.Width, bounds.Height, Z));
}
}
public void UnloadTextures()
{
}
public void UnloadTextures() {}
public void LoadTextures()
{
@@ -824,7 +795,7 @@ namespace Vocaluxe.Menu
float h = Height;
float y = Y;
RectangleF bounds = CBase.Fonts.GetTextBounds(this, this.Height);
RectangleF bounds = CBase.Fonts.GetTextBounds(this, Height);
if (bounds.Width > Bounds.W && Bounds.W > 0f && bounds.Width > 0f)
{