Save DatabaseSongID to CSong for (should be) faster saving of NumPlayed and Scores.
This commit is contained in:
1 parent
bb8166351f
commit
fb9476d1cf
5 files changed
+13
-8
No files matched your search
@@ -72,7 +72,7 @@ namespace Vocaluxe.Base
|
||||
|
||||
#region Highscores
|
||||
|
||||
public static bool GetDataBaseSongInfos(string artist, string title, out int numPlayed, out string dateAdded)
|
||||
public static bool GetDataBaseSongInfos(string artist, string title, out int numPlayed, out string dateAdded, out int highscoreID)
|
||||
{
|
||||
string sArtist = string.Empty;
|
||||
string sTitle = string.Empty;
|
||||
@@ -92,6 +92,7 @@ namespace Vocaluxe.Base
|
||||
using (SQLiteCommand command = new SQLiteCommand(connection))
|
||||
{
|
||||
songID = _GetDataBaseSongID(artist, title, 0, command);
|
||||
highscoreID = songID;
|
||||
}
|
||||
}
|
||||
return _GetDataBaseSongInfos(songID, out sArtist, out sTitle, out numPlayed, out dateAdded, _HighscoreFilePath);
|
||||
@@ -182,7 +183,7 @@ namespace Vocaluxe.Base
|
||||
|
||||
using (SQLiteCommand command = new SQLiteCommand(connection))
|
||||
{
|
||||
int dataBaseSongID = _GetDataBaseSongID(player, command);
|
||||
int dataBaseSongID = CSongs.GetSong(player.SongID).DataBaseSongID;
|
||||
return _AddScore(CProfiles.GetPlayerName(player.ProfileID), (int)Math.Round(player.Points), player.LineNr, player.DateTicks, player.Medley ? 1 : 0,
|
||||
player.Duet ? 1 : 0, player.ShortSong ? 1 : 0, (int)CProfiles.GetDifficulty(player.ProfileID), dataBaseSongID, command);
|
||||
}
|
||||
|
||||
@@ -783,9 +783,9 @@ namespace Vocaluxe.Base
|
||||
return CDataBase.GetCover(fileName, ref texture, coverSize);
|
||||
}
|
||||
|
||||
public bool GetDataBaseSongInfos(string artist, string title, out int numPlayed, out string dateAdded)
|
||||
public bool GetDataBaseSongInfos(string artist, string title, out int numPlayed, out string dateAdded, out int highscoreID)
|
||||
{
|
||||
return CDataBase.GetDataBaseSongInfos(artist, title, out numPlayed, out dateAdded);
|
||||
return CDataBase.GetDataBaseSongInfos(artist, title, out numPlayed, out dateAdded, out highscoreID);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -401,8 +401,9 @@ namespace Vocaluxe.Screens
|
||||
{
|
||||
if (players[p].Points > CSettings.MinScoreForDB && players[p].SongFinished)
|
||||
{
|
||||
CDataBase.IncreaseSongCounter(players[p]);
|
||||
CSongs.GetSong(players[p].SongID).NumPlayed++;
|
||||
CSong song = CSongs.GetSong(players[p].SongID);
|
||||
CDataBase.IncreaseSongCounter(song.DataBaseSongID);
|
||||
song.NumPlayed++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -262,7 +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);
|
||||
bool GetDataBaseSongInfos(string artist, string title, out int numPlayed, out string dateAdded, out int highscoreID);
|
||||
}
|
||||
|
||||
public interface IControllers
|
||||
|
||||
@@ -147,6 +147,7 @@ namespace VocaluxeLib.Songs
|
||||
|
||||
public readonly List<string> Language = new List<string>();
|
||||
|
||||
public int DataBaseSongID = -1;
|
||||
public string DateAdded = "";
|
||||
public int NumPlayed = 0;
|
||||
|
||||
@@ -243,7 +244,9 @@ namespace VocaluxeLib.Songs
|
||||
foreach (string value in song.Language)
|
||||
Language.Add(value);
|
||||
|
||||
DataBaseSongID = song.DataBaseSongID;
|
||||
DateAdded = song.DateAdded;
|
||||
NumPlayed = song.NumPlayed;
|
||||
|
||||
Notes = new CNotes(song.Notes);
|
||||
}
|
||||
@@ -535,7 +538,7 @@ namespace VocaluxeLib.Songs
|
||||
sr.Dispose();
|
||||
_CheckFiles();
|
||||
|
||||
CBase.DataBase.GetDataBaseSongInfos(Artist, Title, out NumPlayed, out DateAdded);
|
||||
CBase.DataBase.GetDataBaseSongInfos(Artist, Title, out NumPlayed, out DateAdded, out DataBaseSongID);
|
||||
|
||||
//Before saving this tags to .txt: Check, if ArtistSorting and Artist are equal, then don't save this tag.
|
||||
if (ArtistSorting == "")
|
||||
|
||||
Reference in new issue
Block a user