diff --git a/RELEASING.md b/.github/RELEASING.md
similarity index 57%
rename from RELEASING.md
rename to .github/RELEASING.md
index efaad0a..328e240 100644
--- a/RELEASING.md
+++ b/.github/RELEASING.md
@@ -1,10 +1,10 @@
# 新版本发布流程备忘
-- 在 `dev-1.3` 分支完成修改的功能,实际运行测试一遍
+- 在 `dev` 分支完成修改的功能,实际运行测试一遍
- 在 GitHub 创建 Release 并发布
- GitHub Actions 会自动补充 Assets
- 从 Artifacts 里下载 `WPF-NupkgReleases`
-- 运行 `squirrel --releasify` 命令
+- 运行 `squirrel releasify` 命令
- commit push soft.danmuji.org
- 修改 `rec.danmuji.org` 上的更新日志
@@ -14,11 +14,8 @@
$pkg=""
$dst=""
-$template="$dst/Setup-old.exe"
$icon="./BililiveRecorder.WPF/installer.ico"
+$appIcon="./BililiveRecorder.WPF/ico.ico"
-mv "$dst/Setup.exe" "$template"
-squirrel --releasify "$pkg" -r "$dst" --setupIcon "$icon" --bootstrapperExe "$template" --framework-version net472 --no-msi
-
-rm "$template"
+squirrel releasify -p "$pkg" -r "$dst" --icon "$icon" --appIcon "$appIcon" -f net472
```
diff --git a/BililiveRecorder.WPF/BililiveRecorder.WPF.csproj b/BililiveRecorder.WPF/BililiveRecorder.WPF.csproj
index a8ff09b..07a062f 100644
--- a/BililiveRecorder.WPF/BililiveRecorder.WPF.csproj
+++ b/BililiveRecorder.WPF/BililiveRecorder.WPF.csproj
@@ -382,8 +382,8 @@
5.0.0
-
- 2.0.1
+
+ 2.9.42
2.0.0-beta4.22272.1
@@ -411,4 +411,4 @@
-
\ No newline at end of file
+
diff --git a/BililiveRecorder.WPF/BililiveRecorder.nuspec b/BililiveRecorder.WPF/BililiveRecorder.nuspec
index f7c4a38..2ff7444 100644
--- a/BililiveRecorder.WPF/BililiveRecorder.nuspec
+++ b/BililiveRecorder.WPF/BililiveRecorder.nuspec
@@ -1,28 +1,27 @@
-
- BililiveRecorder
- 0.0.0
- B站录播姬
- Genteure
- Genteure
- false
- B站录播姬 安装包
- zh-CN
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+ BililiveRecorder
+ 0.0.0
+ B站录播姬
+ Genteure
+ Genteure
+ false
+ B站录播姬 安装包
+ zh-CN
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/BililiveRecorder.WPF/Program.cs b/BililiveRecorder.WPF/Program.cs
index a95a834..a132fa1 100644
--- a/BililiveRecorder.WPF/Program.cs
+++ b/BililiveRecorder.WPF/Program.cs
@@ -1,7 +1,6 @@
using System;
using System.CommandLine;
using System.CommandLine.NamingConventionBinder;
-using System.Diagnostics;
using System.IO;
using System.Net;
using System.Net.Http;
@@ -22,6 +21,7 @@ using Serilog.Core;
using Serilog.Exceptions;
using Serilog.Formatting.Compact;
using Serilog.Formatting.Display;
+using Squirrel;
#nullable enable
namespace BililiveRecorder.WPF
@@ -114,19 +114,79 @@ namespace BililiveRecorder.WPF
var root = new RootCommand("")
{
- run,
new Option("--squirrel-firstrun")
{
IsHidden = true
},
+ new Option("--squirrel-install")
+ {
+ IsHidden = true,
+ IsRequired = false,
+ },
+ new Option("--squirrel-updated")
+ {
+ IsHidden = true,
+ IsRequired = false,
+ },
+ new Option("--squirrel-obsolete")
+ {
+ IsHidden = true,
+ IsRequired = false,
+ },
+ new Option("--squirrel-uninstall")
+ {
+ IsHidden = true,
+ IsRequired = false,
+ },
+
+ run,
new ToolCommand(),
};
- root.Handler = CommandHandler.Create((bool squirrelFirstrun) => Commands.RunWpfHandler(path: null, squirrelFirstrun: squirrelFirstrun, askPath: false, hide: false));
+ root.Handler = CommandHandler.Create(Commands.RunRootCommandHandler);
return root;
}
private static class Commands
{
+ private static IAppTools GetSquirrelAppTools()
+ {
+ var m = new UpdateManager(updateSource: null, applicationIdOverride: null, localAppDataDirectoryOverride: null);
+ m.Dispose();
+ return m;
+ }
+
+ internal static int RunRootCommandHandler(bool squirrelFirstrun, SemanticVersion? squirrelInstall, SemanticVersion? squirrelUpdated, SemanticVersion? squirrelObsolete, SemanticVersion? squirrelUninstall)
+ {
+ var tools = GetSquirrelAppTools();
+ if (squirrelInstall is not null)
+ {
+ tools.CreateShortcutForThisExe();
+ Environment.Exit(0);
+ return 0;
+ }
+ else if (squirrelUpdated is not null)
+ {
+ Environment.Exit(0);
+ return 0;
+ }
+ else if (squirrelObsolete is not null)
+ {
+ Environment.Exit(0);
+ return 0;
+ }
+ else if (squirrelUninstall is not null)
+ {
+ tools.RemoveShortcutForThisExe();
+ Environment.Exit(0);
+ return 0;
+ }
+ else
+ {
+ tools.SetProcessAppUserModelId();
+ return RunWpfHandler(path: null, squirrelFirstrun: squirrelFirstrun, askPath: false, hide: false);
+ }
+ }
+
internal static int RunWpfHandler(string? path, bool squirrelFirstrun, bool askPath, bool hide)
{
Pages.RootPage.CommandArgumentRecorderPath = path;
diff --git a/BililiveRecorder.WPF/Properties/AssemblyInfo.cs b/BililiveRecorder.WPF/Properties/AssemblyInfo.cs
index 2c68685..fbf2336 100644
--- a/BililiveRecorder.WPF/Properties/AssemblyInfo.cs
+++ b/BililiveRecorder.WPF/Properties/AssemblyInfo.cs
@@ -10,7 +10,7 @@ using System.Windows;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Genteure")]
[assembly: AssemblyProduct("B站录播姬")]
-[assembly: AssemblyCopyright("Copyright © 2018 - 2021 Genteure")]
+[assembly: AssemblyCopyright("Copyright © 2018 - 2022 Genteure")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
diff --git a/BililiveRecorder.WPF/Properties/app.manifest b/BililiveRecorder.WPF/Properties/app.manifest
index 43ea2df..650e718 100644
--- a/BililiveRecorder.WPF/Properties/app.manifest
+++ b/BililiveRecorder.WPF/Properties/app.manifest
@@ -1,5 +1,6 @@
-
+
+ 1
@@ -20,4 +21,3 @@
-
\ No newline at end of file
diff --git a/BililiveRecorder.WPF/Update.cs b/BililiveRecorder.WPF/Update.cs
index 86cccd9..8f530b4 100644
--- a/BililiveRecorder.WPF/Update.cs
+++ b/BililiveRecorder.WPF/Update.cs
@@ -34,6 +34,12 @@ namespace BililiveRecorder.WPF
{
using var updateManager = new UpdateManager(@"https://soft.danmuji.org/BililiveRecorder/");
+ if (!updateManager.IsInstalledApp)
+ {
+ this.logger.Information("当前不是安装版,不检查是否有新版本。");
+ return;
+ }
+
var ignoreDeltaUpdates = false;
retry:
@@ -43,15 +49,15 @@ namespace BililiveRecorder.WPF
if (updateInfo.ReleasesToApply.Count == 0)
{
- this.logger.Information("当前运行的是最新版本 {BuildVersion}/{InstalledVersion}",
- typeof(Update).Assembly.GetName().Version.ToString(4),
+ this.logger.Information("当前运行的是最新版本 {BuildVersion} ({InstalledVersion})",
+ GitVersionInformation.FullSemVer,
updateInfo.CurrentlyInstalledVersion?.Version?.ToString() ?? "×");
}
else
{
- this.logger.Information("有新版本 {RemoteVersion},当前本地 {BuildVersion}/{InstalledVersion}",
+ this.logger.Information("有新版本 {RemoteVersion},当前本地是 {BuildVersion} ({InstalledVersion})",
updateInfo.FutureReleaseEntry?.Version?.ToString() ?? "×",
- typeof(Update).Assembly.GetName().Version.ToString(4),
+ GitVersionInformation.FullSemVer,
updateInfo.CurrentlyInstalledVersion?.Version?.ToString() ?? "×");
await updateManager.DownloadReleases(updateInfo.ReleasesToApply);
@@ -74,7 +80,7 @@ namespace BililiveRecorder.WPF
}
catch (Exception ex)
{
- this.logger.Warning(ex, "检查更新时出错");
+ this.logger.Warning(ex, "检查更新时发生错误");
}
}
}