예제 #1
0
        private async Task <byte[]> GetDecryptedBytes(TrackInfo trackInfo, AudioQuality audioQuality, IProgressBar trackProgress, string progressTitle)
        {
            trackProgress.Next($"{progressTitle} | Grabbing download URL");

            string downloadUrl = EncryptionHandler.GetDownloadUrl(trackInfo, (int)audioQuality);

            byte[] encryptedBytes = await _deezerHttp.DownloadTrack(downloadUrl, trackProgress, progressTitle);

            if (encryptedBytes == null || encryptedBytes.Length == 0)
            {
                Helpers.RedMessage("Failed to download encrypted track");
                return(new byte[0]);
            }

            trackProgress.Next($"{progressTitle} | Decrypting track");
            return(await EncryptionHandler.DecryptTrack(encryptedBytes, trackInfo.TrackTags.Id));
        }