Add songs to highscore.db at start, save date to db, read date and numplayed to song-infos.
This commit is contained in:
1 parent
11a72e6e8d
commit
f0ab780a87
4 files changed
+35
-1
No files matched your search
@@ -72,6 +72,31 @@ namespace Vocaluxe.Base
|
||||
|
||||
#region Highscores
|
||||
|
||||
public static bool GetDataBaseSongInfos(string artist, string title, out int numPlayed, out string dateAdded)
|
||||
{
|
||||
string sArtist = string.Empty;
|
||||
string sTitle = string.Empty;
|
||||
int songID = -1;
|
||||
using (SQLiteConnection connection = new SQLiteConnection())
|
||||
{
|
||||
connection.ConnectionString = "Data Source=" + _HighscoreFilePath;
|
||||
|
||||
try
|
||||
{
|
||||
connection.Open();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
|
||||
using (SQLiteCommand command = new SQLiteCommand(connection))
|
||||
{
|
||||
songID = _GetDataBaseSongID(artist, title, 0, command);
|
||||
}
|
||||
}
|
||||
return _GetDataBaseSongInfos(songID, out sArtist, out sTitle, out numPlayed, out dateAdded, _HighscoreFilePath);
|
||||
}
|
||||
|
||||
public static void IncreaseSongCounter(SPlayer player)
|
||||
{
|
||||
using (SQLiteConnection connection = new SQLiteConnection())
|
||||
@@ -330,7 +355,7 @@ namespace Vocaluxe.Base
|
||||
if (reader != null)
|
||||
reader.Close();
|
||||
|
||||
command.CommandText = "INSERT INTO Songs (Title, Artist, NumPlayedm DateAdded) " +
|
||||
command.CommandText = "INSERT INTO Songs (Title, Artist, NumPlayed, DateAdded) " +
|
||||
"VALUES (@title, @artist, @numplayed, @dateadded)";
|
||||
command.Parameters.Add("@title", DbType.String, 0).Value = title;
|
||||
command.Parameters.Add("@artist", DbType.String, 0).Value = artist;
|
||||
|
||||
@@ -782,6 +782,11 @@ namespace Vocaluxe.Base
|
||||
{
|
||||
return CDataBase.GetCover(fileName, ref texture, coverSize);
|
||||
}
|
||||
|
||||
public bool GetDataBaseSongInfos(string artist, string title, out int numPlayed, out string dateAdded)
|
||||
{
|
||||
return CDataBase.GetDataBaseSongInfos(artist, title, out numPlayed, out dateAdded);
|
||||
}
|
||||
}
|
||||
|
||||
class CBcontrollers : IControllers
|
||||
|
||||
@@ -262,6 +262,7 @@ namespace VocaluxeLib
|
||||
public interface IDataBase
|
||||
{
|
||||
bool GetCover(string fileName, ref CTexture texture, int coverSize);
|
||||
bool GetDataBaseSongInfos(string artist, string title, out int numPlayed, out string dateAdded);
|
||||
}
|
||||
|
||||
public interface IControllers
|
||||
|
||||
@@ -148,6 +148,7 @@ namespace VocaluxeLib.Songs
|
||||
public readonly List<string> Language = new List<string>();
|
||||
|
||||
public string DateAdded = "";
|
||||
public int NumPlayed = 0;
|
||||
|
||||
// Notes
|
||||
public readonly CNotes Notes = new CNotes();
|
||||
@@ -534,6 +535,8 @@ namespace VocaluxeLib.Songs
|
||||
sr.Dispose();
|
||||
_CheckFiles();
|
||||
|
||||
CBase.DataBase.GetDataBaseSongInfos(Artist, Title, out NumPlayed, out DateAdded);
|
||||
|
||||
//Before saving this tags to .txt: Check, if ArtistSorting and Artist are equal, then don't save this tag.
|
||||
if (ArtistSorting == "")
|
||||
ArtistSorting = Artist;
|
||||
|
||||
Reference in new issue
Block a user