public static CTextureRef GenerateCover(string text, ECoverGeneratorType type, CSong firstSong) { CTextureRef texture = Cover(text); if (texture != NoCover) { return(texture); } texture = CDraw.CopyTexture(NoCover); Task.Factory.StartNew(() => { _CancelToken.Token.ThrowIfCancellationRequested(); Bitmap coverBmp = !_CoverGenerators.ContainsKey(type) ? null : _CoverGenerators[type].GetCover(text, firstSong != null ? Path.Combine(firstSong.Folder, firstSong.CoverFileName) : null); _CancelToken.Token.ThrowIfCancellationRequested(); if (coverBmp == null && _CoverGenerators.ContainsKey(ECoverGeneratorType.Default)) { coverBmp = _CoverGenerators[ECoverGeneratorType.Default].GetCover(text, firstSong != null ? Path.Combine(firstSong.Folder, firstSong.CoverFileName) : null); } _CancelToken.Token.ThrowIfCancellationRequested(); if (coverBmp != null) { CDraw.EnqueueTextureUpdate(texture, coverBmp); } _CancelToken.Token.ThrowIfCancellationRequested(); }, _CancelToken.Token); lock (_Covers) { _Covers.Add(text, texture); } return(texture); }
public CTextureRef GenerateCover(string text, ECoverGeneratorType type, CSong firstSong) { return(CCover.GenerateCover(text, type, firstSong)); }