private static void _LoadCovers() { using (CBenchmark.Time("Loaded Covers")) { int songCount = _Songs.Count; AutoResetEvent ev = new AutoResetEvent(songCount == 0); NumSongsWithCoverLoaded = 0; foreach (CSong song in _Songs) { CSong tmp = song; Task.Factory.StartNew(() => { tmp.LoadSmallCover(); if (Interlocked.Increment(ref _NumSongsWithCoverLoaded) >= songCount) { ev.Set(); } }); } ev.WaitOne(); _CoverLoaded = true; CDataBase.CommitCovers(); } }
public static void LoadSongs() { CLog.StartBenchmark(1, "Load Songs"); _SongsLoaded = false; _Songs.Clear(); CLog.StartBenchmark(2, "List Songs"); List <string> files = new List <string>(); foreach (string p in CConfig.SongFolder) { string path = p; files.AddRange(Helper.ListFiles(path, "*.txt", true, true)); files.AddRange(Helper.ListFiles(path, "*.txd", true, true)); } CLog.StopBenchmark(2, "List Songs"); CLog.StartBenchmark(2, "Read TXTs"); foreach (string file in files) { CSong Song = new CSong(); if (Song.ReadTXTSong(file)) { Song.ID = _Songs.Count; _Songs.Add(Song); } } CLog.StopBenchmark(2, "Read TXTs"); CLog.StartBenchmark(2, "Sort Songs"); Sort(CConfig.SongSorting); CLog.StopBenchmark(2, "Sort Songs"); Category = -1; _SongsLoaded = true; if (CConfig.Renderer != ERenderer.TR_CONFIG_SOFTWARE && CConfig.CoverLoading == ECoverLoading.TR_CONFIG_COVERLOADING_ATSTART) { CLog.StartBenchmark(2, "Load Cover"); for (int i = 0; i < _Songs.Count; i++) { CSong song = _Songs[i]; song.ReadNotes(); STexture texture = song.CoverTextureSmall; song.CoverTextureBig = texture; _CoverLoadIndex++; } _CoverLoaded = true; CDataBase.CommitCovers(); CLog.StopBenchmark(2, "Load Cover"); } CLog.StopBenchmark(1, "Load Songs "); }
private static void _LoadCover() { for (int i = 0; i < _Songs.Count; i++) { CSong song = _Songs[i]; song.ReadNotes(); STexture texture = song.CoverTextureSmall; song.CoverTextureBig = texture; _CoverLoadIndex++; } _CoverLoaded = true; CDataBase.CommitCovers(); }
public bool GetDataBaseSongInfos(string artist, string title, out int numPlayed, out DateTime dateAdded, out int highscoreID) { return(CDataBase.GetDataBaseSongInfos(artist, title, out numPlayed, out dateAdded, out highscoreID)); }
public bool GetCover(string fileName, ref CTextureRef texture, int coverSize) { return(CDataBase.GetCover(fileName, ref texture, coverSize)); }