Skip to content

Commit

Permalink
chore:规避封面生成失败,无法保存壁纸问题
Browse files Browse the repository at this point in the history
  • Loading branch information
GiantappMan committed Feb 6, 2024
1 parent 21b26f1 commit 3c68248
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
10 changes: 9 additions & 1 deletion docs/2.更新记录.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@

### 修复

- [ ] 程序运行时,商店更新失败
- [ ] 画面拉伸失效,当切换视频后

---
Expand Down Expand Up @@ -60,6 +59,15 @@

---

## v3.0.8-alpha.8 发布日期:2024.2.7

### 修复

- [x] 规避封面生成失败,无法保存壁纸问题

---


## v3.0.7-alpha.7 发布日期:2024.2.6

### 修复
Expand Down
4 changes: 2 additions & 2 deletions src/giantapp-wallpaper-client/WallpaperCore/WallpaperApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -460,16 +460,16 @@ public static bool UpdateWallpaper(Wallpaper newWallpaper, Wallpaper oldWallpape
}

//移动cover位置
if (newWallpaper.CoverPath != oldWallpaper.CoverPath)
if (!string.IsNullOrEmpty(newWallpaper.CoverPath) && newWallpaper.CoverPath != oldWallpaper.CoverPath)
{
string coverExtension = Path.GetExtension(newWallpaper.CoverPath);
string coverSavePath = Path.Combine(saveFolder, $"{saveFileName}.cover{coverExtension}");
File.Copy(newWallpaper.CoverPath, coverSavePath, true);
newWallpaper.Meta.Cover = $"{saveFileName}.cover{Path.GetExtension(newWallpaper.CoverPath)}";
}

//保存meta
newWallpaper.Meta.UpdateTime = DateTime.Now;
newWallpaper.Meta.Cover = $"{saveFileName}.cover{Path.GetExtension(newWallpaper.CoverPath)}";
string metaJsonFile = Path.Combine(saveFolder, $"{saveFileName}.meta.json");
File.WriteAllText(metaJsonFile, JsonConvert.SerializeObject(newWallpaper.Meta, JsonSettings));
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ export function WallpaperDialog(props: WallpaperDialogProps) {
</video>
}
{
loadVideoError && <>加载视频失败,请重试</>
loadVideoError && <>加载视频失败,偶尔会出现这种情况,暂时无解,关闭窗口重新打开再试,也可以忽略直接保存 </>
}
{
importedFile.fileType === "img" &&
Expand Down

0 comments on commit 3c68248

Please sign in to comment.