mirror of
https://github.com/BililiveRecorder/BililiveRecorder.git
synced 2024-11-15 19:22:19 +08:00
WPF: Switch to Clowd.Squirrel
This commit is contained in:
parent
9d99da71c0
commit
f130af64b6
11
RELEASING.md → .github/RELEASING.md
vendored
11
RELEASING.md → .github/RELEASING.md
vendored
|
@ -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
|
||||
```
|
|
@ -382,8 +382,8 @@
|
|||
<PackageReference Include="Serilog.Sinks.File">
|
||||
<Version>5.0.0</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="squirrel.windows">
|
||||
<Version>2.0.1</Version>
|
||||
<PackageReference Include="Clowd.Squirrel">
|
||||
<Version>2.9.42</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="System.CommandLine">
|
||||
<Version>2.0.0-beta4.22272.1</Version>
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
<description>B站录播姬 安装包</description>
|
||||
<language>zh-CN</language>
|
||||
<dependencies>
|
||||
<group targetFramework=".NETFramework4.5"/>
|
||||
</dependencies>
|
||||
</metadata>
|
||||
<files>
|
||||
|
|
|
@ -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<bool>("--squirrel-firstrun")
|
||||
{
|
||||
IsHidden = true
|
||||
},
|
||||
new Option<SemanticVersion?>("--squirrel-install")
|
||||
{
|
||||
IsHidden = true,
|
||||
IsRequired = false,
|
||||
},
|
||||
new Option<SemanticVersion?>("--squirrel-updated")
|
||||
{
|
||||
IsHidden = true,
|
||||
IsRequired = false,
|
||||
},
|
||||
new Option<SemanticVersion?>("--squirrel-obsolete")
|
||||
{
|
||||
IsHidden = true,
|
||||
IsRequired = false,
|
||||
},
|
||||
new Option<SemanticVersion?>("--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<bool, SemanticVersion?, SemanticVersion?, SemanticVersion?, SemanticVersion?>(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;
|
||||
|
|
|
@ -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("")]
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<SquirrelAwareVersion xmlns="urn:schema-squirrel-com:asm.v1">1</SquirrelAwareVersion>
|
||||
<assemblyIdentity version="1.0.0.0" name="MyApplication.app" />
|
||||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
|
||||
<security>
|
||||
|
@ -20,4 +21,3 @@
|
|||
</application>
|
||||
</compatibility>
|
||||
</assembly>
|
||||
<!--你在看什么(*゜Д゜*)-->
|
|
@ -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, "检查更新时发生错误");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user