diff --git a/DownKyi.Core/Storage/StorageCover.cs b/DownKyi.Core/Storage/StorageCover.cs index 49e58c5..28b7dfb 100644 --- a/DownKyi.Core/Storage/StorageCover.cs +++ b/DownKyi.Core/Storage/StorageCover.cs @@ -30,7 +30,7 @@ namespace DownKyi.Core.Storage { string header = GetCover(avid, bvid, cid, url); - return GetGetCoverThumbnail(header, width, height); + return GetCoverThumbnail(header, width, height); } /// @@ -40,10 +40,10 @@ namespace DownKyi.Core.Storage /// /// /// - public BitmapImage GetGetCoverThumbnail(string cover, int width, int height) + public BitmapImage GetCoverThumbnail(string cover, int width, int height) { - var bitmap = new Bitmap(cover); - var thumbnail = bitmap.GetThumbnailImage(width, height, null, IntPtr.Zero); + Bitmap bitmap = new Bitmap(cover); + Image thumbnail = bitmap.GetThumbnailImage(width, height, null, IntPtr.Zero); return StorageUtils.BitmapToBitmapImage(new Bitmap(thumbnail)); } @@ -69,7 +69,7 @@ namespace DownKyi.Core.Storage public string GetCover(long avid, string bvid, long cid, string url) { CoverDb coverDb = new CoverDb(); - var cover = coverDb.QueryByUrl(url); + Cover cover = coverDb.QueryByUrl(url); // 如果存在,直接返回 // 如果不存在,则先下载 @@ -195,7 +195,7 @@ namespace DownKyi.Core.Storage /// public bool IsLocal(CoverDb coverDb, string url) { - var cover = coverDb.QueryByUrl(url); + Cover cover = coverDb.QueryByUrl(url); return cover != null; } @@ -207,7 +207,7 @@ namespace DownKyi.Core.Storage /// public string LocalCover(CoverDb coverDb, string url) { - var cover = coverDb.QueryByUrl(url); + Cover cover = coverDb.QueryByUrl(url); return cover.Md5; } diff --git a/DownKyi/Services/FavoritesService.cs b/DownKyi/Services/FavoritesService.cs index 2363556..21021db 100644 --- a/DownKyi/Services/FavoritesService.cs +++ b/DownKyi/Services/FavoritesService.cs @@ -26,7 +26,7 @@ namespace DownKyi.Services // 查询、保存封面 StorageCover storageCover = new StorageCover(); string coverUrl = favoritesMetaInfo.Cover; - string cover = storageCover.GetCover(favoritesMetaInfo.Id, "Favorites", favoritesMetaInfo.Mid, coverUrl); + BitmapImage cover = storageCover.GetCoverThumbnail(favoritesMetaInfo.Id, "Favorites", favoritesMetaInfo.Mid, coverUrl, 300, 188); // 获取用户头像 string upName; @@ -49,7 +49,7 @@ namespace DownKyi.Services { favorites.CoverUrl = coverUrl; - favorites.Cover = cover == null ? null : new BitmapImage(new Uri(cover)); + favorites.Cover = cover; favorites.Title = favoritesMetaInfo.Title; DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1)); // 当地时区 @@ -98,7 +98,7 @@ namespace DownKyi.Services // 查询、保存封面 StorageCover storageCover = new StorageCover(); string coverUrl = media.Cover; - string cover = storageCover.GetCover(media.Id, media.Bvid, -1, coverUrl); + BitmapImage cover = storageCover.GetCoverThumbnail(media.Id, media.Bvid, -1, coverUrl, 200, 125); App.PropertyChangeAsync(new Action(() => { @@ -107,7 +107,7 @@ namespace DownKyi.Services Avid = media.Id, Bvid = media.Bvid, Order = order, - Cover = cover == null ? null : new BitmapImage(new Uri(cover)), + Cover = cover, Title = media.Title, PlayNumber = media.CntInfo != null ? Format.FormatNumber(media.CntInfo.Play) : "0", DanmakuNumber = media.CntInfo != null ? Format.FormatNumber(media.CntInfo.Danmaku) : "0", @@ -120,7 +120,7 @@ namespace DownKyi.Services if (!result.ToList().Exists(t => t.Avid == newMedia.Avid)) { result.Add(newMedia); - Thread.Sleep(50); + Thread.Sleep(10); } })); }