Exemplo n.º 1
0
        internal static void Remove(this SongItem songItem, ObservableCollection <SongItem> songList, Downloader downloader, Player player)
        {
            switch (songItem.Status)
            {
            case SongStatus.WaitingDownload:
                songList.Remove(songItem);
                break;

            case SongStatus.Downloading:
                downloader.CancelDownload();
                break;

            case SongStatus.WaitingPlay:
                songList.Remove(songItem);
                try { File.Delete(songItem.FilePath); } catch (Exception) { }
                break;

            case SongStatus.Playing:
                player.Next();
                break;

            default:
                break;
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// 主插件调用用
 /// </summary>
 /// <param name="item">要下载的歌曲信息</param>
 /// <returns>下载是否成功</returns>
 internal DownloadStatus SafeDownload(SongItem item)
 {
     try
     {
         return(Download(item));
     }
     catch (Exception ex)
     {
         WriteError(ex, "参数:filepath=" + item.FilePath + " id=" + item.SongId);
         return(DownloadStatus.Failed);
     }
 }
Exemplo n.º 3
0
 internal string SafeGetDownloadUrl(SongItem songInfo)
 {
     try
     {
         return(GetDownloadUrl(songInfo));
     }
     catch (Exception ex)
     {
         WriteError(ex, "SongId: " + songInfo.SongId);
         return(null);
     }
 }
Exemplo n.º 4
0
 internal static string GetDownloadUrl(this SongItem songItem) => songItem.Module.SafeGetDownloadUrl(songItem);
Exemplo n.º 5
0
 /// <summary>
 /// 请在不能使用普通方式下载歌曲文件的情况下重写替代下载
 /// </summary>
 /// <param name="item">要下载的歌曲信息</param>
 /// <returns>下载是否成功</returns>
 protected abstract DownloadStatus Download(SongItem item);
Exemplo n.º 6
0
 protected abstract string GetLyric(SongItem songInfo);
Exemplo n.º 7
0
 protected abstract string GetDownloadUrl(SongItem songInfo);