Skip to content

知了 Cicada · 任何会议和直播的实时字幕、同声传译、AI 会议纪要,Mac、Windows、Linux、Android 免费开源。Live subtitles, interpreting and meeting notes for any call or stream, on Mac, Windows, Linux and Android.

feat(windows): install with one Cicada-Setup.exe, no admin rights, and upgrade the same way

wquguru059a18ca89a6
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 309d177..8f44823 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -91,12 +91,17 @@ jobs:
$out = "windows/build/Cicada-$($pair[0])"
dotnet publish windows/src/Cicada -c Release -r $pair[0] -o $out -p:DebugType=embedded
if ($LASTEXITCODE -ne 0) { exit 1 }
+ # The zip stays: older Cicadas only look for it when checking for updates.
Compress-Archive -Path "$out/*" -DestinationPath "dist/Cicada-$v-Windows-$($pair[1]).zip"
+ # The download for people: the same exe, which installs itself (Install.cs).
+ Copy-Item "$out/Cicada.exe" "dist/Cicada-Setup$(if ($pair[1] -eq 'ARM64') { '-arm64' }).exe"
}
- uses: actions/upload-artifact@v4
with:
name: windows
- path: dist/*.zip
+ path: |
+ dist/*.zip
+ dist/*.exe
# The voiceprint library (说话人识别) for each architecture, on 22.04 so it loads on 22.04 and 24.04.
linux-native:
diff --git a/site/changelog.json b/site/changelog.json
index c5ebfbf..4735bb9 100644
--- a/site/changelog.json
+++ b/site/changelog.json
@@ -226,6 +226,11 @@
"title": "Windows 上会议应用挂断、或很久没人说话时,自动结束会议、整理纪要。",
"text": "Zoom、腾讯会议、飞书、Teams 等挂断后结束;没人说话时先提醒,也可以在设置 › 结束会议里改成直接结束或一直记录。"
},
+ {
+ "kind": "new",
+ "title": "Windows 版改成一个安装包 Cicada-Setup.exe:双击就装好,不用管理员权限。",
+ "text": "装到你自己的用户目录,开始菜单里有入口,可以在 设置 › 应用 里卸载;新版本也用它升级,会议记录、设置和 Ling key 都在。"
+ },
{
"kind": "new",
"title": "Windows 上有新版本时会提示,点“下载”拿这台电脑对应的版本。",
diff --git a/windows/scripts/build.sh b/windows/scripts/build.sh
index 775e346..2ff4dde 100755
--- a/windows/scripts/build.sh
+++ b/windows/scripts/build.sh
@@ -1,7 +1,8 @@
#!/bin/bash
# Builds the Windows app on the Mac: build/Cicada-win-x64/ and build/Cicada-win-arm64/, each a
-# self-contained Cicada.exe plus Resources/. RELEASE=1 for a release build (else a dev build,
-# which keeps its records under "Cicada Dev" and opens the debug pipe).
+# self-contained Cicada.exe with everything inside it. RELEASE=1 for a release build, which also
+# writes build/Cicada-Setup.exe and Cicada-Setup-arm64.exe (the same exe, for people to download);
+# else a dev build, which keeps its records under "Cicada Dev" and opens the debug pipe.
set -euo pipefail
cd "$(dirname "$0")/.."
root=..
@@ -40,10 +41,12 @@ for rid in win-x64 win-arm64; do
rm -rf "$out"
scripts/dotnet.sh publish src/Cicada -c "$config" -r "$rid" -o "$out" -p:DebugType=embedded -v quiet -nologo 2>&1 | grep -E ' error |warning CS' | sort -u || true
[ -f "$out/Cicada.exe" ] || { echo "build failed for $rid" >&2; exit 1; }
- # Strings.Load reads both tables from Resources/; a misplaced one silently leaves the UI in Chinese.
- for f in Resources/en.lproj/Localizable.strings Resources/en.lproj/Windows.strings; do
- [ -f "$out/$f" ] || { echo "missing $f in $out" >&2; exit 1; }
- done
+ # The exe is the whole app (the UI text and the sample are inside it): Cicada-Setup.exe is a copy.
+ [ "$(ls "$out" | grep -v '^Cicada.exe$' | grep -v '^test$' | grep -v '^Cicada Dev.cmd$' || true)" = "" ] || { echo "unexpected files beside Cicada.exe in $out: $(ls "$out")" >&2; exit 1; }
+ if [ "$config" = Release ]; then
+ setup=build/Cicada-Setup.exe; [ "$rid" = win-arm64 ] && setup=build/Cicada-Setup-arm64.exe
+ cp "$out/Cicada.exe" "$setup"; echo "$setup"
+ fi
if [ "$config" = Debug ]; then
printf '@echo off\r\nstart "" "%%~dp0Cicada.exe" --dev\r\n' > "$out/Cicada Dev.cmd"
# Everything the VM test needs in the one folder: the capture probe, the control script and the clips.
diff --git a/windows/src/Cicada.Core/Setup.cs b/windows/src/Cicada.Core/Setup.cs
new file mode 100644
index 0000000..0cd993c
--- /dev/null
+++ b/windows/src/Cicada.Core/Setup.cs
@@ -0,0 +1,41 @@
+namespace Cicada;
+
+/// What a launch of the release exe should do. Cicada-Setup.exe is Cicada.exe under another name:
+/// a copy that isn't the installed one installs itself into the user's folder (no admin), so
+/// autostart, the Start menu and updates always point at one place.
+public static class SetupPlan
+{
+ public enum Step
+ {
+ /// This is the installed copy (or a dev build): start as usual.
+ Run,
+ /// Nothing installed: ask, then copy in.
+ Install,
+ /// An older version is installed: offer to replace it.
+ Upgrade,
+ /// The same or a newer version is installed: open that one instead (never downgrade).
+ Open,
+ }
+
+ public static Step Decide(bool dev, string running, string installed, string? installedVersion, string version)
+ {
+ if (dev || Same(running, installed)) return Step.Run;
+ if (installedVersion is null) return Step.Install;
+ return UpdateChecker.IsNewer(version, installedVersion) ? Step.Upgrade : Step.Open;
+ }
+
+ /// Windows paths: case-insensitive, `..` and `/` resolved.
+ public static bool Same(string a, string b)
+ {
+ try { return string.Equals(Path.GetFullPath(a).TrimEnd('\\', '/'), Path.GetFullPath(b).TrimEnd('\\', '/'), StringComparison.OrdinalIgnoreCase); }
+ catch { return false; }
+ }
+
+ /// The Start menu entry is named in the language of the UI at install time, so people find
+ /// what they see; the files and paths stay "Cicada" (Chinese names get mangled in downloads).
+ public static string ShortcutName(string language) => language == "zh-Hans" ? "知了" : "Cicada";
+ /// Every name a shortcut may have had, so a reinstall in another language leaves only one.
+ public static readonly string[] ShortcutNames = ["知了", "Cicada"];
+ /// Settings › Apps sorts and searches by name: both names, so either language finds it.
+ public const string DisplayName = "知了 Cicada";
+}
diff --git a/windows/src/Cicada.Core/Strings.cs b/windows/src/Cicada.Core/Strings.cs
index 46b81c5..e4a90b1 100644
--- a/windows/src/Cicada.Core/Strings.cs
+++ b/windows/src/Cicada.Core/Strings.cs
@@ -16,7 +16,12 @@ public static class Strings
/// Loads the table for `language` ("en", "ja", "ko"; anything else is Chinese) from
/// `folder`/<lang>.lproj/Localizable.strings.
- public static void Load(string folder, string? language = null)
+ public static void Load(string folder, string? language = null) =>
+ Load(path => File.Exists(Path.Combine(folder, path)) ? File.ReadAllText(Path.Combine(folder, path), Encoding.UTF8) : null, language);
+
+ /// The same from `read("<lang>.lproj/<name>")`: the app reads the tables from inside its exe,
+ /// so the installer is one file that already speaks the user's language.
+ public static void Load(Func<string, string?> read, string? language = null)
{
var ui = language ?? CultureInfo.CurrentUICulture.Name;
var head = ui.Split('-')[0];
@@ -26,9 +31,8 @@ public static class Strings
table = [];
foreach (var name in new[] { "Localizable.strings", "Windows.strings" })
{
- var file = Path.Combine(folder, $"{Language}.lproj", name);
- if (!File.Exists(file)) continue;
- foreach (var (k, v) in Parse(File.ReadAllText(file, Encoding.UTF8))) table[k] = v;
+ if (read($"{Language}.lproj/{name}") is not { } text) continue;
+ foreach (var (k, v) in Parse(text)) table[k] = v;
}
}
diff --git a/windows/src/Cicada.Core/UpdateChecker.cs b/windows/src/Cicada.Core/UpdateChecker.cs
index 2f7cf0c..3e2a1a4 100644
--- a/windows/src/Cicada.Core/UpdateChecker.cs
+++ b/windows/src/Cicada.Core/UpdateChecker.cs
@@ -8,10 +8,15 @@ namespace Cicada;
/// UpdateChecker: at launch, then whenever the last answer is 4 hours old (a 15-minute tick, so a
/// laptop that sleeps a lot still checks), and when the tray panel opens once it is an hour old.
/// Failures (offline, rate-limited, the repository not public: 404) are silent. This only finds
-/// the update; the app offers the zip for download (no in-place install yet).
+/// the update; the app offers Cicada-Setup.exe for download, which upgrades the installed copy
+/// when opened (older releases only have the zip).
public sealed class UpdateChecker
{
- public sealed record Update(string Version, string Page, string? Zip, long Size);
+ /// `Setup` is this PC's Cicada-Setup exe when the release has one; `Size` is the download's.
+ public sealed record Update(string Version, string Page, string? Zip, long Size, string? Setup = null)
+ {
+ public string? Download => Setup ?? Zip;
+ }
public static readonly TimeSpan Every = TimeSpan.FromHours(4);
public static readonly TimeSpan Stale = TimeSpan.FromHours(1);
@@ -107,8 +112,9 @@ public sealed class UpdateChecker
catch (JsonException) { return null; }
}
- /// The newest published release with a Windows zip. A release without one only carries other
- /// platforms (Windows had no change), so it is skipped. On ARM, an x64-only release still counts.
+ /// The newest published release with a Windows build (installer or zip). A release without one
+ /// only carries other platforms (Windows had no change), so it is skipped. On ARM, an x64-only
+ /// release still counts.
public static Update? NewestWindows(IEnumerable<Release> releases, string arch)
{
Update? best = null;
@@ -116,14 +122,18 @@ public sealed class UpdateChecker
{
if (r.Draft || r.Prerelease || r.Assets is null) continue;
var zip = r.Assets.FirstOrDefault(a => IsZip(a.Name, arch)) ?? (arch == "x64" ? null : r.Assets.FirstOrDefault(a => IsZip(a.Name, "x64")));
- if (zip is null) continue;
- var u = new Update(r.TagName.TrimStart('v'), r.HtmlUrl, zip.Url, zip.Size);
+ var setup = r.Assets.FirstOrDefault(a => a.Name == SetupName(arch)) ?? (arch == "x64" ? null : r.Assets.FirstOrDefault(a => a.Name == SetupName("x64")));
+ if (zip is null && setup is null) continue;
+ var u = new Update(r.TagName.TrimStart('v'), r.HtmlUrl, zip?.Url, (setup ?? zip)!.Size, setup?.Url);
if (best is null || IsNewer(u.Version, best.Version)) best = u;
}
return best;
static bool IsZip(string name, string arch) => name.StartsWith("Cicada-") && name.EndsWith($"-Windows-{arch}.zip");
}
+ /// The installer's release asset: no version in the name, so the site's link never goes stale.
+ public static string SetupName(string arch) => arch == "ARM64" ? "Cicada-Setup-arm64.exe" : "Cicada-Setup.exe";
+
/// Dotted numeric versions: "2.10.0" is newer than "2.9.1".
public static bool IsNewer(string a, string b)
{
diff --git a/windows/src/Cicada/App.cs b/windows/src/Cicada/App.cs
index 1605b72..84d6ed7 100644
--- a/windows/src/Cicada/App.cs
+++ b/windows/src/Cicada/App.cs
@@ -15,9 +15,21 @@ static class Program
static int Main(string[] args)
{
Paths.Dev = Paths.Dev || args.Contains("--dev");
+ // Before the single-instance check: the installer must run while the installed copy does.
+ if (!Paths.Dev)
+ {
+ if (args.Contains("--uninstall")) return SetupWindow.Run(SetupWindow.Mode.Uninstall);
+ switch (SetupPlan.Decide(false, Environment.ProcessPath ?? "", Install.Exe, Install.InstalledVersion(), Controller.Version))
+ {
+ case SetupPlan.Step.Install: return SetupWindow.Run(SetupWindow.Mode.Install);
+ case SetupPlan.Step.Upgrade: return SetupWindow.Run(SetupWindow.Mode.Upgrade);
+ case SetupPlan.Step.Open: Native.LetOthersTakeForeground(); Install.Launch("--opened"); return 0;
+ }
+ }
// One Cicada per user: a second launch just opens the records of the running one.
- using var single = new Mutex(true, Paths.Dev ? "com.wquguru.cicada.dev" : "com.wquguru.cicada", out bool first);
- if (!first) { Native.LetOthersTakeForeground(); DebugServer.Send("show records"); return 0; }
+ using var single = new Mutex(true, Paths.Dev ? "com.wquguru.cicada.dev" : Install.Mutex, out bool first);
+ if (!first) { Native.LetOthersTakeForeground(); DebugServer.Send(args.Contains("--opened") ? "setup opened" : "show records"); return 0; }
+ Controller.Arrived = args.FirstOrDefault(a => a is "--installed" or "--updated" or "--opened");
var app = new Application { ShutdownMode = ShutdownMode.OnExplicitShutdown };
// WPF's own Windows 11 (Fluent) look for the stock controls: menus, combo boxes, text boxes,
// check boxes and scroll bars. Light only for now; Cicada draws its own surfaces on top.
@@ -52,6 +64,8 @@ sealed class Controller
/// The tray panel opened: check in the background once the last answer is an hour old.
public void PanelOpened() { if (checksUpdates) _ = Updates.CheckIfDue(UpdateChecker.Stale); }
public static string Version => typeof(Controller).Assembly.GetName().Version?.ToString(3) ?? "0";
+ /// How the installer started this copy: --installed, --updated or --opened (it was already installed).
+ public static string? Arrived;
PushToTalk? talk;
SpeakBar? speakBar;
DeviceRecorder? mic;
@@ -83,7 +97,7 @@ sealed class Controller
{
this.application = application;
var ui = Settings.UiLanguage == "system" ? null : Settings.UiLanguage;
- Strings.Load(Path.Combine(AppContext.BaseDirectory, "Resources"), ui);
+ Strings.Load(Bundled.Strings, ui);
Ling = new LingClient(Key) { Model = Settings.Model };
SpeakerLabels.Voices = Settings.SpeakerVoices;
Notes = new NotesEngine(Ling, Store);
@@ -123,8 +137,20 @@ sealed class Controller
var watch = new DispatcherTimer { Interval = TimeSpan.FromSeconds(2) };
watch.Tick += (_, _) => _ = WatchEnd();
watch.Start();
- if (!Settings.Onboarded) new Onboarding(this).Show();
- else if (Ling.HasKey) _ = Ling.Check();
+ if (!Settings.Onboarded) new Onboarding(this, installed: Arrived == "--installed").Show();
+ else
+ {
+ if (Ling.HasKey) _ = Ling.Check();
+ if (Arrived == "--updated") Toast(LF("知了已更新到 %@", Version), L("会议记录、设置和 Ling key 都在。"));
+ else if (Arrived is not null) FromInstaller();
+ }
+ }
+
+ /// The installer ran again with this version (or an older one) already here: open the panel.
+ public void FromInstaller()
+ {
+ ShowFlyout();
+ Toast(L("知了已经装好了"), L("下载的安装包可以删掉。"), ShowFlyout);
}
void Changed() => Dispatch.BeginInvoke(() =>
@@ -405,8 +431,7 @@ sealed class Controller
/// the system capture) while it plays aloud for the user.
public async Task PlaySample()
{
- var wav = Path.Combine(AppContext.BaseDirectory, "Resources", "sample.wav");
- if (!File.Exists(wav) || Listen.Listening) return;
+ if (Bundled.Sample() is not { } wav || Listen.Listening) return;
var source = new FileAudioSource(wav);
var done = new TaskCompletionSource();
source.Ended += _ => done.TrySetResult();
@@ -544,7 +569,7 @@ sealed class Controller
public void DownloadUpdate()
{
if (Updates.Available is not { } u) return;
- Open(u.Zip ?? u.Page);
+ Open(u.Download ?? u.Page);
Log.Debug($"update: download {u.Version}");
}
@@ -647,8 +672,9 @@ static class DebugServer
using var reader = new StreamReader(server);
using var writer = new StreamWriter(server) { AutoFlush = true };
var line = reader.ReadLine() ?? "";
- // A release build only takes "show records" (a second launch); the rest is for dev builds.
- if (!Paths.Dev && line != "show records") { writer.WriteLine("{\"error\":\"dev builds only\"}"); continue; }
+ // A release build only takes a second launch's and the installer's few commands; the
+ // rest is for dev builds.
+ if (!Paths.Dev && line is not ("show records" or "setup status" or "setup quit" or "setup opened")) { writer.WriteLine("{\"error\":\"dev builds only\"}"); continue; }
var reply = app.Dispatcher().Invoke(() => Run(app, line));
writer.WriteLine(reply.ToJsonString());
}
@@ -659,13 +685,24 @@ static class DebugServer
static Dispatcher Dispatcher(this Controller _) => Application.Current.Dispatcher;
+ static JsonObject Quitting(Controller app) { _ = app.Quit(); return new JsonObject { ["ok"] = true }; }
+ static JsonObject Opened(Controller app) { app.FromInstaller(); return new JsonObject { ["ok"] = true }; }
+
static JsonObject Run(Controller app, string line)
{
var parts = line.Trim().Split(' ', 2);
var arg = parts.Length > 1 ? parts[1].Trim() : "";
- Log.Debug($"debug: {parts[0]}");
+ // The installer asks for status every 2 seconds while its window is open: not worth a line each.
+ if (line != "setup status") Log.Debug($"debug: {parts[0]}");
switch (parts[0])
{
+ // Cicada-Setup.exe (Install.cs): is a meeting on, quit for the new copy, show yourself.
+ case "setup": return arg switch
+ {
+ "status" => new JsonObject { ["listening"] = app.Listen.Listening },
+ "quit" => Quitting(app),
+ _ => Opened(app),
+ };
case "start": app.StartListening(new SystemAudioTap()); break;
case "stop": _ = app.StopListening(); break;
case "end": app.RequestStop(); break; // the user's 结束: asks first when anything was said
diff --git a/windows/src/Cicada/Bundled.cs b/windows/src/Cicada/Bundled.cs
new file mode 100644
index 0000000..1adc446
--- /dev/null
+++ b/windows/src/Cicada/Bundled.cs
@@ -0,0 +1,38 @@
+using System.Text;
+
+namespace Cicada.App;
+
+/// Files carried inside Cicada.exe (EmbeddedResource in Cicada.csproj), so the exe alone is the
+/// whole app: Cicada-Setup.exe is downloaded as one file and installs by copying itself.
+static class Bundled
+{
+ static readonly System.Reflection.Assembly Self = typeof(Bundled).Assembly;
+ // MSBuild writes %(RecursiveDir) with the build machine's separator: "en.lproj\" on Windows CI.
+ static readonly Dictionary<string, string> Names = Self.GetManifestResourceNames().ToDictionary(n => n.Replace('\\', '/'), n => n);
+
+ /// "en.lproj/Localizable.strings" and the like, for Strings.Load.
+ public static string? Strings(string path)
+ {
+ if (!Names.TryGetValue("strings/" + path, out var name) || Self.GetManifestResourceStream(name) is not { } s) return null;
+ using var reader = new StreamReader(s, Encoding.UTF8);
+ return reader.ReadToEnd();
+ }
+
+ /// The onboarding sample as a file (SoundPlayer and FileAudioSource both want a path), written
+ /// to the temp folder the first time it's asked for.
+ public static string? Sample()
+ {
+ var path = Path.Combine(Path.GetTempPath(), $"cicada-sample-{Controller.Version}.wav");
+ try
+ {
+ if (File.Exists(path)) return path;
+ using var s = Self.GetManifestResourceStream("sample.wav");
+ if (s is null) return null;
+ var part = path + ".part";
+ using (var f = File.Create(part)) s.CopyTo(f);
+ File.Move(part, path, overwrite: true);
+ return path;
+ }
+ catch (Exception e) { Log.Debug($"sample: unavailable {e.GetType().Name}"); return null; }
+ }
+}
diff --git a/windows/src/Cicada/Cicada.csproj b/windows/src/Cicada/Cicada.csproj
index c47baf6..a8f8b2e 100644
--- a/windows/src/Cicada/Cicada.csproj
+++ b/windows/src/Cicada/Cicada.csproj
@@ -25,15 +25,16 @@
<Using Remove="System.Windows.Forms" />
<Using Remove="System.Drawing" />
<Using Include="System.IO" />
- <None Include="../../../Resources/**/Localizable.strings" LinkBase="Resources" CopyToOutputDirectory="PreserveNewest" />
- <!-- LinkBase only moves files from outside the project, so these name their place explicitly. -->
- <None Include="Strings/**/Windows.strings" Link="Resources/%(RecursiveDir)%(Filename)%(Extension)" CopyToOutputDirectory="PreserveNewest" />
+ <!-- The UI text, inside the exe (Bundled.cs reads it): Cicada-Setup.exe is this one file, so it
+ must speak the user's language before anything is installed. -->
+ <EmbeddedResource Include="../../../Resources/**/Localizable.strings" LogicalName="strings/%(RecursiveDir)%(Filename)%(Extension)" />
+ <EmbeddedResource Include="Strings/**/Windows.strings" LogicalName="strings/%(RecursiveDir)%(Filename)%(Extension)" />
<!-- Both made by scripts/build.sh from docs/icon.png and Resources/sample/sample.m4a; committed so CI on Windows needs no Mac tools. -->
<Resource Include="Assets/cicada.ico" Link="cicada.ico" />
<!-- The voiceprint model (scripts/compress-voiceprint.py; WeSpeaker, CC BY 4.0), inside the exe so
single-file compression shrinks it too. -->
<EmbeddedResource Include="Assets/voiceprint.onnx" LogicalName="voiceprint.onnx" />
- <None Include="Assets/sample.wav" Link="Resources/sample.wav" CopyToOutputDirectory="PreserveNewest" />
+ <EmbeddedResource Include="Assets/sample.wav" LogicalName="sample.wav" />
<ProjectReference Include="../Cicada.Core/Cicada.Core.csproj" />
</ItemGroup>
</Project>
diff --git a/windows/src/Cicada/Install.cs b/windows/src/Cicada/Install.cs
new file mode 100644
index 0000000..e9894a5
--- /dev/null
+++ b/windows/src/Cicada/Install.cs
@@ -0,0 +1,176 @@
+using System.Diagnostics;
+using System.Runtime.InteropServices;
+using System.Text;
+using Microsoft.Win32;
+
+namespace Cicada.App;
+
+/// The release build installed for this user only, so nothing asks for admin rights: the exe in
+/// %LOCALAPPDATA%\Programs\Cicada, a Start menu shortcut, the Run key for 开机时启动知了 and an
+/// entry in Settings › Apps whose 卸载 runs `Cicada.exe --uninstall`. The windows are SetupWindow.
+static class Install
+{
+ public static string Folder => Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Programs", "Cicada");
+ public static string Exe => Path.Combine(Folder, "Cicada.exe");
+ const string UninstallKey = @"Software\Microsoft\Windows\CurrentVersion\Uninstall\Cicada";
+ /// The release build's single-instance mutex (Program.Main).
+ public const string Mutex = "com.wquguru.cicada";
+
+ /// The installed version, from Settings › Apps' entry (the exe's own version resource isn't
+ /// written when the app is built on the Mac). Null when nothing is installed.
+ public static string? InstalledVersion()
+ {
+ if (!File.Exists(Exe)) return null;
+ try { using var k = Registry.CurrentUser.OpenSubKey(UninstallKey); return k?.GetValue("DisplayVersion") as string ?? "0"; }
+ catch { return "0"; }
+ }
+
+ /// The running Cicada (installed, or an old copy from a zip), through its pipe: null when none.
+ public static bool? Listening() => DebugServer.Send("setup status") is { } reply ? reply.Contains("\"listening\":true") : null;
+
+ /// Asks the running Cicada to quit (it ends a meeting first and saves it), and waits until it has.
+ static void QuitRunning()
+ {
+ if (DebugServer.Send("setup quit") is null && !Running()) return;
+ using var m = new Mutex(false, Mutex);
+ try { if (!m.WaitOne(TimeSpan.FromSeconds(30))) throw new IOException("Cicada didn't quit"); }
+ catch (AbandonedMutexException) { }
+ m.ReleaseMutex();
+ Log.Debug("setup: the running copy quit");
+ }
+
+ static bool Running()
+ {
+ using var m = new Mutex(false, Mutex);
+ try { if (!m.WaitOne(0)) return true; }
+ catch (AbandonedMutexException) { }
+ m.ReleaseMutex();
+ return false;
+ }
+
+ /// Copies this exe in, then registers it. `step` reports 1–3 as each part is done. First install:
+ /// the two choices. An upgrade (`choices` null) keeps the shortcut and autostart as they were.
+ public static void Run((bool StartMenu, bool AutoStart)? choices, Action<int> step)
+ {
+ var self = Environment.ProcessPath ?? throw new IOException("no exe path");
+ Directory.CreateDirectory(Folder);
+ // Copied beside the old one first, so a full disk or a scanner holding the file leaves the
+ // installed copy as it was.
+ var next = Exe + ".new";
+ File.Copy(self, next, overwrite: true);
+ QuitRunning();
+ for (int i = 0; ; i++)
+ {
+ try { File.Move(next, Exe, overwrite: true); break; }
+ catch (IOException) when (i < 20) { Thread.Sleep(250); } // the old process is still letting go of it
+ catch (UnauthorizedAccessException) when (i < 20) { Thread.Sleep(250); }
+ }
+ step(1);
+ var hadShortcut = Shortcuts().Any(File.Exists);
+ if (choices?.StartMenu ?? hadShortcut) Shortcut(); else foreach (var f in Shortcuts()) File.Delete(f);
+ step(2);
+ // A copy from a zip may have left the Run key pointing into Downloads: point it here.
+ AutoStart.Set(Exe, choices?.AutoStart ?? AutoStart.Enabled);
+ Register();
+ step(3);
+ Log.Debug($"setup: installed {Controller.Version}");
+ }
+
+ public static void Launch(string flag)
+ {
+ try { Process.Start(new ProcessStartInfo(Exe, flag) { UseShellExecute = false, WorkingDirectory = Folder }); }
+ catch (Exception e) { Log.Debug($"setup: launch failed {e.GetType().Name}"); }
+ }
+
+ /// Removes the app; the records, settings and key too unless `keepRecords`. The folder itself
+ /// goes once this process has exited (a running exe can't delete itself): RemoveFolderLater.
+ public static void Uninstall(bool keepRecords)
+ {
+ QuitRunning();
+ AutoStart.Set(Exe, false);
+ foreach (var f in Shortcuts()) try { File.Delete(f); } catch { }
+ try { Registry.CurrentUser.DeleteSubKeyTree(UninstallKey, throwOnMissingSubKey: false); } catch { }
+ if (!keepRecords) try { Directory.Delete(Paths.Root, recursive: true); } catch (Exception e) { Log.Debug($"setup: records not removed {e.GetType().Name}"); }
+ Log.Debug($"setup: uninstalled, records {(keepRecords ? "kept" : "removed")}");
+ }
+
+ /// A hidden cmd that waits for this process to go, then deletes the install folder.
+ public static void RemoveFolderLater()
+ {
+ if (!Directory.Exists(Folder)) return;
+ var script = $"ping -n 3 127.0.0.1 >nul & rmdir /s /q \"{Folder}\"";
+ try
+ {
+ Process.Start(new ProcessStartInfo("cmd.exe", $"/d /c \"{script}\"")
+ {
+ UseShellExecute = false, CreateNoWindow = true, WorkingDirectory = Path.GetTempPath(),
+ });
+ }
+ catch (Exception e) { Log.Debug($"setup: folder removal failed {e.GetType().Name}"); }
+ }
+
+ static IEnumerable<string> Shortcuts()
+ {
+ var menu = Environment.GetFolderPath(Environment.SpecialFolder.Programs);
+ return SetupPlan.ShortcutNames.Select(n => Path.Combine(menu, n + ".lnk"));
+ }
+
+ static void Shortcut()
+ {
+ foreach (var f in Shortcuts()) File.Delete(f);
+ var path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Programs), SetupPlan.ShortcutName(Strings.Language) + ".lnk");
+ var link = (IShellLinkW)new ShellLink();
+ try
+ {
+ link.SetPath(Exe);
+ link.SetWorkingDirectory(Folder);
+ link.SetIconLocation(Exe, 0);
+ link.SetDescription(SetupPlan.DisplayName);
+ ((System.Runtime.InteropServices.ComTypes.IPersistFile)link).Save(path, true);
+ }
+ finally { Marshal.FinalReleaseComObject(link); }
+ }
+
+ /// Settings › Apps: no 修改 or 修复, just 卸载.
+ static void Register()
+ {
+ using var k = Registry.CurrentUser.CreateSubKey(UninstallKey);
+ k.SetValue("DisplayName", SetupPlan.DisplayName);
+ k.SetValue("DisplayVersion", Controller.Version);
+ k.SetValue("Publisher", "wquguru");
+ k.SetValue("DisplayIcon", $"{Exe},0");
+ k.SetValue("InstallLocation", Folder);
+ k.SetValue("UninstallString", $"\"{Exe}\" --uninstall");
+ k.SetValue("QuietUninstallString", $"\"{Exe}\" --uninstall");
+ k.SetValue("URLInfoAbout", "https://cicada.indaloop.app");
+ k.SetValue("InstallDate", DateTime.Now.ToString("yyyyMMdd"));
+ k.SetValue("EstimatedSize", (int)(new FileInfo(Exe).Length / 1024), RegistryValueKind.DWord);
+ k.SetValue("NoModify", 1, RegistryValueKind.DWord);
+ k.SetValue("NoRepair", 1, RegistryValueKind.DWord);
+ }
+
+ [ComImport, Guid("00021401-0000-0000-C000-000000000046")] class ShellLink { }
+
+ [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("000214F9-0000-0000-C000-000000000046")]
+ interface IShellLinkW
+ {
+ void GetPath([Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder file, int size, IntPtr data, int flags);
+ void GetIDList(out IntPtr list);
+ void SetIDList(IntPtr list);
+ void GetDescription([Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder name, int size);
+ void SetDescription([MarshalAs(UnmanagedType.LPWStr)] string name);
+ void GetWorkingDirectory([Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder dir, int size);
+ void SetWorkingDirectory([MarshalAs(UnmanagedType.LPWStr)] string dir);
+ void GetArguments([Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder args, int size);
+ void SetArguments([MarshalAs(UnmanagedType.LPWStr)] string args);
+ void GetHotkey(out short key);
+ void SetHotkey(short key);
+ void GetShowCmd(out int cmd);
+ void SetShowCmd(int cmd);
+ void GetIconLocation([Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder path, int size, out int index);
+ void SetIconLocation([MarshalAs(UnmanagedType.LPWStr)] string path, int index);
+ void SetRelativePath([MarshalAs(UnmanagedType.LPWStr)] string path, int reserved);
+ void Resolve(IntPtr hwnd, int flags);
+ void SetPath([MarshalAs(UnmanagedType.LPWStr)] string file);
+ }
+}
diff --git a/windows/src/Cicada/Onboarding.cs b/windows/src/Cicada/Onboarding.cs
index 3002ca1..05e0e0f 100644
--- a/windows/src/Cicada/Onboarding.cs
+++ b/windows/src/Cicada/Onboarding.cs
@@ -31,9 +31,16 @@ sealed class Onboarding : Window
readonly ContentControl keyStatus = new();
bool checking;
- public Onboarding(Controller app)
+ /// Opened by the installer: step 1 says so, and 开机时启动知了 shows what the installer set.
+ readonly bool installed;
+ /// The first page after installing carries 已装好: the installer's window becomes this one.
+ readonly int badgeStep;
+
+ public Onboarding(Controller app, bool installed = false)
{
this.app = app;
+ this.installed = installed;
+ if (installed) autoStart = AutoStart.Enabled;
Title = L("设置知了");
Width = 860; Height = 640; ResizeMode = ResizeMode.CanMinimize;
Background = Palette.Page; FontFamily = Palette.Font; Icon = AppIcon.Image;
@@ -51,6 +58,7 @@ sealed class Onboarding : Window
keyBox.PasswordChanged += (_, _) => { if (keyText.Text != keyBox.Password) keyText.Text = keyBox.Password; };
keyText.TextChanged += (_, _) => { if (keyBox.Password != keyText.Text) keyBox.Password = keyText.Text; };
step = app.Ling.HasKey ? 1 : 0;
+ badgeStep = installed ? step : -1;
Render();
}
@@ -117,11 +125,19 @@ sealed class Onboarding : Window
FrameworkElement Page(string title, string text, params UIElement[] body)
{
var s = new StackPanel { Margin = new Thickness(64, 30, 64, 0) };
+ if (step == badgeStep)
+ {
+ var note = Ui.Row(10, Ui.Badge(L("已装好"), new SolidColorBrush(Color.FromRgb(0xE3, 0xF1, 0xE8)), Palette.Success),
+ Ui.Text(L("开始菜单里有知了了,安装包可以删掉"), 12, Palette.Secondary, wrap: false));
+ note.Margin = new Thickness(0, 0, 0, 14);
+ s.Children.Add(note);
+ }
s.Children.Add(Ui.Text(title, 30, Palette.Ink, FontWeights.Bold));
var p = Ui.Text(text, 14, Palette.Secondary);
p.Margin = new Thickness(0, 8, 0, 0); p.LineHeight = 22;
s.Children.Add(p);
- foreach (var b in body) { if (b is FrameworkElement f) f.Margin = new Thickness(f.Margin.Left, f.Margin.Top + (s.Children.Count == 2 ? 24 : 16), f.Margin.Right, f.Margin.Bottom); s.Children.Add(b); }
+ var head = s.Children.Count;
+ foreach (var b in body) { if (b is FrameworkElement f) f.Margin = new Thickness(f.Margin.Left, f.Margin.Top + (s.Children.Count == head ? 24 : 16), f.Margin.Right, f.Margin.Bottom); s.Children.Add(b); }
return s;
}
@@ -479,25 +495,8 @@ sealed class Onboarding : Window
},
});
FrameworkElement Key(string what, string keys) => Gap(Ui.Spread(Ui.Text(what, 14, Palette.Ink, wrap: false), Ui.Keycap(keys)), 14);
- // An ink box like the design's, not the theme's blue one; still a CheckBox for keys and readers.
- var box = new Border { Width = 18, Height = 18, CornerRadius = new CornerRadius(4) };
- void Paint()
- {
- box.Background = autoStart ? Palette.Ink : Palette.Surface;
- box.BorderBrush = autoStart ? Palette.Ink : Palette.Secondary;
- box.BorderThickness = new Thickness(autoStart ? 0 : 1.5);
- box.Child = autoStart ? Ui.Icon(Icons.Check, 14, Brushes.White, stroke: 2.2) : null;
- }
- Paint();
- var face = new FrameworkElementFactory(typeof(ContentPresenter));
- var startup = new CheckBox
- {
- IsChecked = autoStart, Content = Ui.Row(10, box, Ui.Text(L("开机时启动知了"), 14, Palette.Ink, wrap: false)),
- Template = new ControlTemplate(typeof(CheckBox)) { VisualTree = face }, Cursor = System.Windows.Input.Cursors.Hand,
- HorizontalAlignment = HorizontalAlignment.Left, Margin = new Thickness(0, 28, 0, 0),
- };
- System.Windows.Automation.AutomationProperties.SetName(startup, L("开机时启动知了"));
- startup.Click += (_, _) => { autoStart = startup.IsChecked == true; Paint(); };
+ var startup = Ui.Check(L("开机时启动知了"), autoStart, v => autoStart = v);
+ startup.Margin = new Thickness(0, 28, 0, 0);
var keys = StepCard(new StackPanel
{
Children =
diff --git a/windows/src/Cicada/Platform.cs b/windows/src/Cicada/Platform.cs
index 4247e6d..9299586 100644
--- a/windows/src/Cicada/Platform.cs
+++ b/windows/src/Cicada/Platform.cs
@@ -45,7 +45,7 @@ static class AutoStart
{
const string RunKey = @"Software\Microsoft\Windows\CurrentVersion\Run";
static string Name => Paths.Dev ? "Cicada Dev" : "Cicada";
- static string Command => $"\"{Environment.ProcessPath}\"" + (Paths.Dev ? " --dev" : "");
+ static string Command(string exe) => $"\"{exe}\"" + (Paths.Dev ? " --dev" : "");
public static bool Enabled
{
@@ -54,16 +54,19 @@ static class AutoStart
try { using var k = Registry.CurrentUser.OpenSubKey(RunKey); return k?.GetValue(Name) is string; }
catch { return false; }
}
- set
+ set => Set(Environment.ProcessPath ?? "", value);
+ }
+
+ /// The installer sets it for the copy it put in place, not for itself in Downloads.
+ public static void Set(string exe, bool on)
+ {
+ try
{
- try
- {
- using var k = Registry.CurrentUser.CreateSubKey(RunKey);
- if (value) k.SetValue(Name, Command); else k.DeleteValue(Name, throwOnMissingValue: false);
- Log.Debug($"autostart: {(value ? "on" : "off")}");
- }
- catch (Exception e) { Log.Debug($"autostart: failed {e.GetType().Name}"); }
+ using var k = Registry.CurrentUser.CreateSubKey(RunKey);
+ if (on) k.SetValue(Name, Command(exe)); else k.DeleteValue(Name, throwOnMissingValue: false);
+ Log.Debug($"autostart: {(on ? "on" : "off")}");
}
+ catch (Exception e) { Log.Debug($"autostart: failed {e.GetType().Name}"); }
}
}
diff --git a/windows/src/Cicada/SettingsWindow.cs b/windows/src/Cicada/SettingsWindow.cs
index 17f5e6c..8983946 100644
--- a/windows/src/Cicada/SettingsWindow.cs
+++ b/windows/src/Cicada/SettingsWindow.cs
@@ -65,9 +65,14 @@ sealed class SettingsWindow : Window
Card(Icons.List, L("说话人识别"), L("按声音标出说话人 1、2…,只在这台电脑上处理"), Ui.Switch(app.Settings.SpeakerVoices, v => { app.Settings.SpeakerVoices = v; Save(); }, L("说话人识别"))),
Card(Icons.Power, L("开机时启动知了"), null, Ui.Switch(AutoStart.Enabled, v => AutoStart.Enabled = v, L("开机时启动知了"))),
Card(Icons.Folder, L("会议记录存放位置"), $"{Paths.Sessions} · {L("和 Mac 版格式相同")}", Ui.Button(L("打开文件夹"), () => OpenFolder(Paths.Sessions), height: 32))));
- Section(page, "about", L("关于"), Group(
+ // 卸载 as in Settings › Apps, with the same confirmation; only an installed copy offers it.
+ FrameworkElement[] about =
+ [
Card(null, LF("知了 %@", Controller.Version), UpdateDetail(), UpdateControl(), AppIcon.Small(24)),
- Card(null, L("日志"), null, Ui.LinkText(L("打开日志"), () => OpenFolder(Path.GetDirectoryName(Paths.Log)!)))),
+ Card(null, L("日志"), null, Ui.LinkText(L("打开日志"), () => OpenFolder(Path.GetDirectoryName(Paths.Log)!))),
+ .. (!Paths.Dev && File.Exists(Install.Exe) ? new[] { Card(null, L("卸载知了"), L("会议记录默认留着"), Ui.LinkText(L("卸载…"), () => Install.Launch("--uninstall"))) } : []),
+ ];
+ Section(page, "about", L("关于"), Group(about),
Credit());
scroll.Content = page;
scroll.ScrollToVerticalOffset(shownPage == current ? offset : 0);
@@ -77,6 +82,9 @@ sealed class SettingsWindow : Window
string? shownPage;
+ /// What to do with the download: the installer upgrades itself; an older release has only the zip.
+ public static string UpdateHint(UpdateChecker.Update u) => u.Setup is not null ? L("下载后打开,知了会自己更新") : L("下载后解压,替换旧的知了");
+
static FrameworkElement Credit() { var t = Ui.Helper(L("说话人识别用 WeSpeaker 的声纹模型(CC BY 4.0)")); t.Margin = new Thickness(6, 0, 0, 0); return t; }
/// Opens one category's page (the debug pipe's `show settings about`).
@@ -88,7 +96,7 @@ sealed class SettingsWindow : Window
// The Mac's AppRows version row: what the last check found, and 检查更新 or 下载.
string? UpdateDetail()
{
- if (app.Updates.Available is { } u) return LF("有新版本 %@", u.Version) + " · " + L("下载后解压,替换旧的知了");
+ if (app.Updates.Available is { } u) return LF("有新版本 %@", u.Version) + " · " + UpdateHint(u);
if (app.UpdateCheck is { } c) return c;
if (app.Updates.LastChecked is not { } d) return null;
var local = d.ToLocalTime();
diff --git a/windows/src/Cicada/SetupWindow.cs b/windows/src/Cicada/SetupWindow.cs
new file mode 100644
index 0000000..18e6f2f
--- /dev/null
+++ b/windows/src/Cicada/SetupWindow.cs
@@ -0,0 +1,198 @@
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Media;
+using System.Windows.Shapes;
+using System.Windows.Threading;
+using static Cicada.Strings;
+
+namespace Cicada.App;
+
+/// Install, upgrade and uninstall (Install.cs does the work), in onboarding's look: the logo, a big
+/// heading with one grey line, one white card, the action bottom right. Installing has one button
+/// and two ticks; once done the installed copy opens onboarding, so there's no "finished" page.
+sealed class SetupWindow : Window
+{
+ public enum Mode { Install, Upgrade, Uninstall }
+ enum Phase { Ask, Working, Failed, Done }
+
+ readonly Mode mode;
+ readonly string? from;
+ Phase phase;
+ int done;
+ string? error;
+ bool startMenu = true, autoStart = true, keepRecords = true;
+ /// The running Cicada is listening: an upgrade waits, an uninstall says it ends the meeting.
+ bool busy;
+ readonly ContentControl body = new();
+ readonly DispatcherTimer poll = new() { Interval = TimeSpan.FromSeconds(2) };
+
+ /// Runs the window as the whole process (no tray, no engines) and returns the exit code.
+ public static int Run(Mode mode)
+ {
+ var app = new Application { ShutdownMode = ShutdownMode.OnMainWindowClose };
+#pragma warning disable WPF0001
+ app.ThemeMode = ThemeMode.Light;
+#pragma warning restore WPF0001
+ app.DispatcherUnhandledException += (_, e) => { Log.Debug($"setup: unhandled {e.Exception.GetType().Name}: {e.Exception.Message}"); e.Handled = true; };
+ // An upgrade or uninstall speaks the language the user picked; a first install the system's.
+ var ui = AppSettings.Load().UiLanguage;
+ Strings.Load(Bundled.Strings, ui == "system" ? null : ui);
+ Log.Debug($"setup: {mode} {Controller.Version} from {Environment.ProcessPath}");
+ return app.Run(new SetupWindow(mode, Install.InstalledVersion()));
+ }
+
+ SetupWindow(Mode mode, string? from)
+ {
+ this.mode = mode;
+ this.from = from;
+ Title = mode == Mode.Uninstall ? L("卸载知了") : L("安装知了");
+ Width = mode == Mode.Uninstall ? 520 : 600; SizeToContent = SizeToContent.Height; ResizeMode = ResizeMode.CanMinimize;
+ Background = Palette.Page; FontFamily = Palette.Font; Icon = AppIcon.Image;
+ WindowStartupLocation = WindowStartupLocation.CenterScreen;
+ Content = Ui.Frameless(this, body, resizable: false, captionHeight: 24, close: () => { if (phase != Phase.Working) Close(); });
+ poll.Tick += (_, _) => Poll();
+ Loaded += (_, _) => { Poll(); poll.Start(); };
+ Closed += (_, _) => { poll.Stop(); if (mode == Mode.Uninstall && phase == Phase.Done) Install.RemoveFolderLater(); };
+ Render();
+ }
+
+ void Poll()
+ {
+ if (phase != Phase.Ask || mode == Mode.Install) return;
+ var now = Install.Listening() == true;
+ if (now != busy) { busy = now; Render(); }
+ }
+
+ void Render() => body.Content = mode == Mode.Uninstall ? UninstallPage() : InstallPage();
+
+ FrameworkElement InstallPage()
+ {
+ var upgrade = mode == Mode.Upgrade;
+ if (phase is Phase.Working)
+ return Page(upgrade ? L("正在更新…") : L("正在装…"), L("马上就好。"), Card(Progress()), null);
+ if (phase is Phase.Failed)
+ return Page(upgrade ? L("没更新成功") : L("没装好"), L("知了没有改动,可以再试一次。"),
+ Ui.InfoBar(Ui.Severity.Error, null, error ?? ""), Footer(null, Ui.Button(L("再试一次"), Start, Ui.Kind.Primary, height: 44)));
+ if (upgrade)
+ {
+ var later = Ui.Button(L("以后再说"), Close, height: 44);
+ var go = Ui.Button(busy ? L("开完会再更新") : L("更新"), Start, Ui.Kind.Primary, height: 44);
+ go.IsEnabled = !busy;
+ return Page(L("更新知了"), LF("从 %@ 更新到 %@。会议记录、设置和 Ling key 都不动。", from ?? "", Controller.Version), null,
+ Footer(Ui.Text(busy ? L("知了正在听,这场会议结束后再更新") : L("知了会先退出,更新完自己再打开"), 13, Palette.Secondary), later, go));
+ }
+ var autoStartHelp = Ui.Helper(L("开会前不用再找它"));
+ autoStartHelp.Margin = new Thickness(28, 4, 0, 0);
+ var where = Ui.Text(LF("装在 %@", Install.Folder), 13, Palette.Secondary, wrap: false);
+ where.TextTrimming = TextTrimming.CharacterEllipsis; where.ToolTip = Install.Folder;
+ return Page(L("把知了装到这台电脑"), L("装好后在开始菜单和任务栏右下角找到它。不需要管理员权限。"),
+ Card(Ui.Stack(16, Ui.Check(L("在开始菜单里放一个入口"), startMenu, v => startMenu = v),
+ Ui.Stack(0, Ui.Check(L("开机时启动知了"), autoStart, v => autoStart = v), autoStartHelp))),
+ Footer(Ui.Row(8, Ui.Icon(Icons.Lock, 14, Palette.Secondary), where), Ui.Button(L("安装"), Start, Ui.Kind.Primary, height: 44)));
+ }
+
+ FrameworkElement UninstallPage()
+ {
+ if (phase is Phase.Done)
+ return Page(L("知了已经卸载"), keepRecords ? LF("会议记录留在 %@。", Paths.Root) : L("会议记录和设置也删掉了。"), null,
+ Footer(null, Ui.Button(L("知道了"), Close, Ui.Kind.Primary, height: 44)), logo: true);
+ if (phase is Phase.Working) return Page(L("正在卸载…"), L("马上就好。"), null, null);
+ int count = 0;
+ try { if (Directory.Exists(Paths.Sessions)) count = Directory.GetDirectories(Paths.Sessions).Length; } catch { }
+ var keepHelp = Ui.Helper(L("以后再装知了还能看到;也能拷给 Mac 版"));
+ keepHelp.Margin = new Thickness(28, 4, 0, 0);
+ var card = Card(Ui.Stack(0, Ui.Check(LF("留下会议记录(%@ 场)", count), keepRecords, v => keepRecords = v), keepHelp));
+ var cancel = Ui.Button(L("取消"), Close, height: 44);
+ var go = Ui.Button(busy ? L("结束会议并卸载") : L("卸载"), Start, Ui.Kind.Danger, height: 44);
+ return Page(L("卸载知了?"), L("开始菜单入口、开机启动和知了本身都会删掉。"),
+ phase is Phase.Failed ? Ui.Stack(12, Ui.InfoBar(Ui.Severity.Error, null, error ?? ""), card) : card,
+ Footer(busy ? Ui.Text(L("知了正在听:先存好这场会议再卸载"), 13, Palette.Secondary) : null, cancel, go), logo: false);
+ }
+
+ void Start()
+ {
+ phase = Phase.Working; done = 0; error = null;
+ Render();
+ var choices = mode == Mode.Install ? (startMenu, autoStart) : ((bool, bool)?)null;
+ var keep = keepRecords;
+ Task.Run(() =>
+ {
+ if (mode == Mode.Uninstall) Install.Uninstall(keep);
+ else Install.Run(choices, n => Dispatcher.BeginInvoke(() => { done = n; Render(); }));
+ }).ContinueWith(t => Dispatcher.BeginInvoke(async () =>
+ {
+ if (t.Exception?.InnerException is { } e)
+ {
+ Log.Debug($"setup: failed {e.GetType().Name}: {e.Message}");
+ error = Reason(e);
+ phase = Phase.Failed;
+ Render();
+ return;
+ }
+ if (mode == Mode.Uninstall) { phase = Phase.Done; Render(); return; }
+ // Let the last tick show, then the installed copy takes over (onboarding, or a toast).
+ await Task.Delay(500);
+ Install.Launch(mode == Mode.Install ? "--installed" : "--updated");
+ Close();
+ }));
+ }
+
+ static string Reason(Exception e) => e switch
+ {
+ IOException io when (io.HResult & 0xFFFF) is 112 or 39 => L("磁盘空间不够。腾出一些空间后再试。"),
+ UnauthorizedAccessException or IOException => L("文件被占用或被杀毒软件拦住了。过一会儿再试。"),
+ _ => e.Message,
+ };
+
+ FrameworkElement Progress()
+ {
+ string[] steps = [L("复制知了"), L("在开始菜单里放入口"), L("登记到“设置 › 应用”,以后从那里卸载")];
+ var bar = new Grid { Height = 4, Margin = new Thickness(0, 0, 0, 18) };
+ bar.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(Math.Max(done, 0.15), GridUnitType.Star) });
+ bar.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(steps.Length - Math.Min(done, steps.Length), GridUnitType.Star) });
+ var track = new Border { Background = Palette.Line, CornerRadius = new CornerRadius(2) };
+ Grid.SetColumnSpan(track, 2);
+ bar.Children.Add(track);
+ bar.Children.Add(new Border { Background = Palette.Ink, CornerRadius = new CornerRadius(2) });
+ var list = new StackPanel();
+ list.Children.Add(bar);
+ for (int i = 0; i < steps.Length; i++)
+ {
+ FrameworkElement lead = i < done ? Ui.Icon(Icons.Check, 14, Palette.Success, stroke: 1.8)
+ : new Ellipse { Width = 8, Height = 8, Fill = i == done ? Palette.Ink : Palette.Line, Margin = new Thickness(3), VerticalAlignment = VerticalAlignment.Center };
+ var row = Ui.Row(10, lead, Ui.Text(steps[i], 14, i <= done ? Palette.Ink : Palette.Secondary, wrap: false));
+ row.Margin = new Thickness(0, i == 0 ? 0 : 10, 0, 0);
+ list.Children.Add(row);
+ }
+ return list;
+ }
+
+ static Border Card(UIElement child) => new()
+ {
+ Background = Brushes.White, CornerRadius = new CornerRadius(18), Padding = new Thickness(22, 20, 22, 20), Child = child,
+ };
+
+ static FrameworkElement Footer(UIElement? left, params Button[] buttons)
+ {
+ var right = new StackPanel { Orientation = Orientation.Horizontal, HorizontalAlignment = HorizontalAlignment.Right };
+ foreach (var b in buttons) { b.MinWidth = 96; b.Margin = new Thickness(8, 0, 0, 0); right.Children.Add(b); }
+ var dock = new DockPanel { LastChildFill = true };
+ DockPanel.SetDock(right, Dock.Right);
+ dock.Children.Add(right);
+ if (left is FrameworkElement l) { l.VerticalAlignment = VerticalAlignment.Center; l.Margin = new Thickness(0, 0, 16, 0); dock.Children.Add(l); }
+ return dock;
+ }
+
+ static FrameworkElement Page(string title, string text, UIElement? card, FrameworkElement? footer, bool logo = true)
+ {
+ var s = new StackPanel { Margin = new Thickness(40, 36, 40, 32) };
+ if (logo) { var icon = AppIcon.Small(48); icon.HorizontalAlignment = HorizontalAlignment.Left; icon.Margin = new Thickness(0, 0, 0, 18); s.Children.Add(icon); }
+ s.Children.Add(Ui.Text(title, 26, Palette.Ink, FontWeights.Bold));
+ var p = Ui.Text(text, 14, Palette.Secondary);
+ p.Margin = new Thickness(0, 8, 0, 0); p.LineHeight = 22;
+ s.Children.Add(p);
+ if (card is FrameworkElement c) { c.Margin = new Thickness(0, 22, 0, 0); s.Children.Add(c); }
+ if (footer is not null) { footer.Margin = new Thickness(0, 26, 0, 0); s.Children.Add(footer); }
+ return s;
+ }
+}
diff --git a/windows/src/Cicada/Strings/en.lproj/Windows.strings b/windows/src/Cicada/Strings/en.lproj/Windows.strings
index 58d89d7..c65cbfd 100644
--- a/windows/src/Cicada/Strings/en.lproj/Windows.strings
+++ b/windows/src/Cicada/Strings/en.lproj/Windows.strings
@@ -176,3 +176,48 @@
"日志" = "Log";
"下载后解压,替换旧的知了" = "Unzip it and replace the old Cicada";
"下载" = "Download";
+
+/* Cicada-Setup.exe: install, update, uninstall */
+"知了已更新到 %@" = "Cicada is updated to %@";
+"会议记录、设置和 Ling key 都在。" = "Your meetings, settings and Ling key are all still here.";
+"知了已经装好了" = "Cicada is already installed";
+"下载的安装包可以删掉。" = "You can delete the downloaded installer.";
+"开始菜单里有知了了,安装包可以删掉" = "Cicada is in the Start menu; you can delete the installer";
+"卸载知了" = "Uninstall Cicada";
+"会议记录默认留着" = "Your meetings are kept unless you say otherwise";
+"卸载…" = "Uninstall…";
+"安装知了" = "Install Cicada";
+"正在更新…" = "Updating…";
+"正在装…" = "Installing…";
+"马上就好。" = "Almost done.";
+"没更新成功" = "The update didn't finish";
+"没装好" = "Cicada wasn't installed";
+"知了没有改动,可以再试一次。" = "Nothing was changed. You can try again.";
+"开完会再更新" = "Update after the meeting";
+"更新" = "Update";
+"更新知了" = "Update Cicada";
+"从 %@ 更新到 %@。会议记录、设置和 Ling key 都不动。" = "From %@ to %@. Your meetings, settings and Ling key stay as they are.";
+"知了正在听,这场会议结束后再更新" = "Cicada is listening: update once this meeting ends";
+"知了会先退出,更新完自己再打开" = "Cicada quits, updates and opens again";
+"开会前不用再找它" = "So it's there before your meetings";
+"装在 %@" = "Installs in %@";
+"把知了装到这台电脑" = "Install Cicada on this PC";
+"装好后在开始菜单和任务栏右下角找到它。不需要管理员权限。" = "Then find it in the Start menu and at the right of the taskbar. No admin rights needed.";
+"在开始菜单里放一个入口" = "Add Cicada to the Start menu";
+"知了已经卸载" = "Cicada is uninstalled";
+"会议记录留在 %@。" = "Your meetings are still in %@.";
+"会议记录和设置也删掉了。" = "Your meetings and settings were deleted too.";
+"正在卸载…" = "Uninstalling…";
+"以后再装知了还能看到;也能拷给 Mac 版" = "They come back if you install Cicada again, and the Mac app reads them too";
+"留下会议记录(%@ 场)" = "Keep my meetings (%@)";
+"结束会议并卸载" = "End meeting and uninstall";
+"卸载" = "Uninstall";
+"卸载知了?" = "Uninstall Cicada?";
+"开始菜单入口、开机启动和知了本身都会删掉。" = "The Start menu entry, starting at login and Cicada itself are removed.";
+"知了正在听:先存好这场会议再卸载" = "Cicada is listening: this meeting is saved first";
+"磁盘空间不够。腾出一些空间后再试。" = "The disk is full. Free some space and try again.";
+"文件被占用或被杀毒软件拦住了。过一会儿再试。" = "A file is in use or was blocked by antivirus. Try again in a moment.";
+"复制知了" = "Copy Cicada";
+"在开始菜单里放入口" = "Add it to the Start menu";
+"登记到“设置 › 应用”,以后从那里卸载" = "Add it to Settings › Apps, to uninstall from there";
+"下载后打开,知了会自己更新" = "Open it and Cicada updates itself";
diff --git a/windows/src/Cicada/Strings/ja.lproj/Windows.strings b/windows/src/Cicada/Strings/ja.lproj/Windows.strings
index 49dbca8..20777f3 100644
--- a/windows/src/Cicada/Strings/ja.lproj/Windows.strings
+++ b/windows/src/Cicada/Strings/ja.lproj/Windows.strings
@@ -176,3 +176,48 @@
"日志" = "ログ";
"下载后解压,替换旧的知了" = "展開して古い Cicada と置き換えてください";
"下载" = "ダウンロード";
+
+/* Cicada-Setup.exe: install, update, uninstall */
+"知了已更新到 %@" = "Cicada を %@ に更新しました";
+"会议记录、设置和 Ling key 都在。" = "会議記録・設定・Ling キーはそのままです。";
+"知了已经装好了" = "Cicada はインストール済みです";
+"下载的安装包可以删掉。" = "ダウンロードしたインストーラーは削除できます。";
+"开始菜单里有知了了,安装包可以删掉" = "スタートメニューに追加しました。インストーラーは削除できます";
+"卸载知了" = "Cicada をアンインストール";
+"会议记录默认留着" = "会議記録は残せます";
+"卸载…" = "アンインストール…";
+"安装知了" = "Cicada をインストール";
+"正在更新…" = "更新中…";
+"正在装…" = "インストール中…";
+"马上就好。" = "もうすぐ終わります。";
+"没更新成功" = "更新できませんでした";
+"没装好" = "インストールできませんでした";
+"知了没有改动,可以再试一次。" = "何も変更していません。もう一度お試しください。";
+"开完会再更新" = "会議の後で更新";
+"更新" = "更新";
+"更新知了" = "Cicada を更新";
+"从 %@ 更新到 %@。会议记录、设置和 Ling key 都不动。" = "%@ から %@ に更新します。会議記録・設定・Ling キーはそのままです。";
+"知了正在听,这场会议结束后再更新" = "Cicada が聞いています。会議が終わってから更新します";
+"知了会先退出,更新完自己再打开" = "Cicada は一度終了し、更新後に自動で開きます";
+"开会前不用再找它" = "会議の前に探す必要がありません";
+"装在 %@" = "インストール先:%@";
+"把知了装到这台电脑" = "この PC に Cicada をインストール";
+"装好后在开始菜单和任务栏右下角找到它。不需要管理员权限。" = "スタートメニューとタスクバーの右下から使えます。管理者権限は不要です。";
+"在开始菜单里放一个入口" = "スタートメニューに追加";
+"知了已经卸载" = "Cicada をアンインストールしました";
+"会议记录留在 %@。" = "会議記録は %@ に残っています。";
+"会议记录和设置也删掉了。" = "会議記録と設定も削除しました。";
+"正在卸载…" = "アンインストール中…";
+"以后再装知了还能看到;也能拷给 Mac 版" = "再インストールすると戻ります。Mac 版にもコピーできます";
+"留下会议记录(%@ 场)" = "会議記録を残す(%@ 件)";
+"结束会议并卸载" = "会議を終えてアンインストール";
+"卸载" = "アンインストール";
+"卸载知了?" = "Cicada をアンインストールしますか?";
+"开始菜单入口、开机启动和知了本身都会删掉。" = "スタートメニューの項目、ログイン時の起動、Cicada 本体を削除します。";
+"知了正在听:先存好这场会议再卸载" = "Cicada が聞いています。この会議を保存してから削除します";
+"磁盘空间不够。腾出一些空间后再试。" = "ディスクの空きが足りません。空きを作ってからお試しください。";
+"文件被占用或被杀毒软件拦住了。过一会儿再试。" = "ファイルが使用中か、ウイルス対策ソフトにブロックされました。少し待ってからお試しください。";
+"复制知了" = "Cicada をコピー";
+"在开始菜单里放入口" = "スタートメニューに追加";
+"登记到“设置 › 应用”,以后从那里卸载" = "「設定 › アプリ」に登録(ここからアンインストールできます)";
+"下载后打开,知了会自己更新" = "開くと Cicada が自動で更新します";
diff --git a/windows/src/Cicada/Strings/ko.lproj/Windows.strings b/windows/src/Cicada/Strings/ko.lproj/Windows.strings
index 0433873..73c1f91 100644
--- a/windows/src/Cicada/Strings/ko.lproj/Windows.strings
+++ b/windows/src/Cicada/Strings/ko.lproj/Windows.strings
@@ -176,3 +176,48 @@
"日志" = "로그";
"下载后解压,替换旧的知了" = "압축을 풀어 이전 Cicada를 교체하세요";
"下载" = "다운로드";
+
+/* Cicada-Setup.exe: install, update, uninstall */
+"知了已更新到 %@" = "Cicada를 %@(으)로 업데이트했어요";
+"会议记录、设置和 Ling key 都在。" = "회의 기록, 설정, Ling 키는 그대로예요.";
+"知了已经装好了" = "Cicada가 이미 설치되어 있어요";
+"下载的安装包可以删掉。" = "다운로드한 설치 파일은 지워도 돼요.";
+"开始菜单里有知了了,安装包可以删掉" = "시작 메뉴에 추가했어요. 설치 파일은 지워도 돼요";
+"卸载知了" = "Cicada 제거";
+"会议记录默认留着" = "회의 기록은 기본으로 남겨요";
+"卸载…" = "제거…";
+"安装知了" = "Cicada 설치";
+"正在更新…" = "업데이트 중…";
+"正在装…" = "설치 중…";
+"马上就好。" = "곧 끝나요.";
+"没更新成功" = "업데이트하지 못했어요";
+"没装好" = "설치하지 못했어요";
+"知了没有改动,可以再试一次。" = "아무것도 바뀌지 않았어요. 다시 시도해 보세요.";
+"开完会再更新" = "회의 후 업데이트";
+"更新" = "업데이트";
+"更新知了" = "Cicada 업데이트";
+"从 %@ 更新到 %@。会议记录、设置和 Ling key 都不动。" = "%@에서 %@(으)로 업데이트해요. 회의 기록, 설정, Ling 키는 그대로예요.";
+"知了正在听,这场会议结束后再更新" = "Cicada가 듣는 중이에요. 회의가 끝나면 업데이트하세요";
+"知了会先退出,更新完自己再打开" = "Cicada가 종료한 뒤 업데이트하고 다시 열려요";
+"开会前不用再找它" = "회의 전에 따로 찾을 필요가 없어요";
+"装在 %@" = "설치 위치: %@";
+"把知了装到这台电脑" = "이 PC에 Cicada 설치";
+"装好后在开始菜单和任务栏右下角找到它。不需要管理员权限。" = "설치 후 시작 메뉴와 작업 표시줄 오른쪽에서 찾을 수 있어요. 관리자 권한은 필요 없어요.";
+"在开始菜单里放一个入口" = "시작 메뉴에 추가";
+"知了已经卸载" = "Cicada를 제거했어요";
+"会议记录留在 %@。" = "회의 기록은 %@에 남아 있어요.";
+"会议记录和设置也删掉了。" = "회의 기록과 설정도 지웠어요.";
+"正在卸载…" = "제거 중…";
+"以后再装知了还能看到;也能拷给 Mac 版" = "다시 설치하면 볼 수 있고, Mac 버전으로 옮길 수도 있어요";
+"留下会议记录(%@ 场)" = "회의 기록 남기기 (%@개)";
+"结束会议并卸载" = "회의 끝내고 제거";
+"卸载" = "제거";
+"卸载知了?" = "Cicada를 제거할까요?";
+"开始菜单入口、开机启动和知了本身都会删掉。" = "시작 메뉴 항목, 로그인 시 실행, Cicada 앱이 삭제돼요.";
+"知了正在听:先存好这场会议再卸载" = "Cicada가 듣는 중이에요. 이 회의를 먼저 저장해요";
+"磁盘空间不够。腾出一些空间后再试。" = "디스크 공간이 부족해요. 공간을 확보한 뒤 다시 시도하세요.";
+"文件被占用或被杀毒软件拦住了。过一会儿再试。" = "파일이 사용 중이거나 백신 프로그램이 막았어요. 잠시 후 다시 시도하세요.";
+"复制知了" = "Cicada 복사";
+"在开始菜单里放入口" = "시작 메뉴에 추가";
+"登记到“设置 › 应用”,以后从那里卸载" = "설정 › 앱에 등록 (여기서 제거할 수 있어요)";
+"下载后打开,知了会自己更新" = "열면 Cicada가 스스로 업데이트해요";
diff --git a/windows/src/Cicada/TrayFlyout.cs b/windows/src/Cicada/TrayFlyout.cs
index e491f91..1450d25 100644
--- a/windows/src/Cicada/TrayFlyout.cs
+++ b/windows/src/Cicada/TrayFlyout.cs
@@ -81,7 +81,7 @@ sealed class TrayFlyout : Window
{
var size = update.Size > 0 ? $"{update.Size / 1_048_576.0:0} MB · " : "";
var text = Ui.Stack(2, Ui.Text(LF("新版本 %@", update.Version), 13, Palette.Ink, Palette.Strong, wrap: false),
- Ui.Text(size + L("下载后解压,替换旧的知了"), 11, Palette.Secondary),
+ Ui.Text(size + SettingsWindow.UpdateHint(update), 11, Palette.Secondary),
Ui.LinkText(L("更新说明"), () => Do(app.OpenReleaseNotes), 11));
var download = Ui.Button(L("下载"), () => Do(app.DownloadUpdate), Ui.Kind.Standard, height: 30);
var dock = new DockPanel();
diff --git a/windows/src/Cicada/Ui.cs b/windows/src/Cicada/Ui.cs
index 2c6e450..fd938d2 100644
--- a/windows/src/Cicada/Ui.cs
+++ b/windows/src/Cicada/Ui.cs
@@ -309,6 +309,29 @@ static class Ui
Padding = padding ?? new Thickness(20), Child = child,
};
+ /// The design's check box: an ink box, not the theme's blue one; still a CheckBox for keys and readers.
+ public static CheckBox Check(string label, bool on, Action<bool> changed)
+ {
+ var box = new Border { Width = 18, Height = 18, CornerRadius = new CornerRadius(4) };
+ void Paint(bool v)
+ {
+ box.Background = v ? Palette.Ink : Palette.Surface;
+ box.BorderBrush = v ? Palette.Ink : Palette.Secondary;
+ box.BorderThickness = new Thickness(v ? 0 : 1.5);
+ box.Child = v ? Icon(Icons.Check, 14, Brushes.White, stroke: 2.2) : null;
+ }
+ Paint(on);
+ var c = new CheckBox
+ {
+ IsChecked = on, Content = Row(10, box, Text(label, 14, Palette.Ink, wrap: false)),
+ Template = new ControlTemplate(typeof(CheckBox)) { VisualTree = new FrameworkElementFactory(typeof(ContentPresenter)) }, Cursor = Cursors.Hand,
+ HorizontalAlignment = HorizontalAlignment.Left,
+ };
+ AutomationName(c, label);
+ c.Click += (_, _) => { var v = c.IsChecked == true; Paint(v); changed(v); };
+ return c;
+ }
+
public enum Severity { Error, Warning }
/// Fluent's InfoBar: an icon, a bold title, one line of body, and up to one action.
diff --git a/windows/src/Cicada/app.manifest b/windows/src/Cicada/app.manifest
index b0bfce4..b3e1bba 100644
--- a/windows/src/Cicada/app.manifest
+++ b/windows/src/Cicada/app.manifest
@@ -1,6 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity version="0.1.0.0" name="com.wquguru.cicada"/>
+ <!-- Without this, Windows guesses that an exe named "…Setup…" is an installer and asks for admin
+ rights (UAC). Cicada installs for this user only and never needs them. -->
+ <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
+ <security>
+ <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
+ <requestedExecutionLevel level="asInvoker" uiAccess="false"/>
+ </requestedPrivileges>
+ </security>
+ </trustInfo>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- Windows 10 and 11 -->
diff --git a/windows/tests/Cicada.Tests/Program.cs b/windows/tests/Cicada.Tests/Program.cs
index 2e43f0e..3079d6a 100644
--- a/windows/tests/Cicada.Tests/Program.cs
+++ b/windows/tests/Cicada.Tests/Program.cs
@@ -35,6 +35,35 @@ static class Tests
if (!EqualityComparer<T>.Default.Equals(expected, actual)) throw new Exception($"{what}: expected «{expected}», got «{actual}»");
}
+ // MARK: Cicada-Setup.exe
+
+ public static void SetupDecidesFromWhereItRuns()
+ {
+ const string home = @"C:\Users\a\AppData\Local\Programs\Cicada\Cicada.exe";
+ const string download = @"C:\Users\a\Downloads\Cicada-Setup.exe";
+ Equal(SetupPlan.Step.Run, SetupPlan.Decide(false, home, home, "1.4.0", "1.4.0"), "the installed copy just runs");
+ Equal(SetupPlan.Step.Run, SetupPlan.Decide(false, @"c:\users\A\appdata\local\programs\cicada\CICADA.EXE", home, "1.4.0", "1.4.0"), "paths compare without case");
+ Equal(SetupPlan.Step.Run, SetupPlan.Decide(true, download, home, null, "1.4.0"), "a dev build never installs");
+ Equal(SetupPlan.Step.Install, SetupPlan.Decide(false, download, home, null, "1.4.0"), "nothing installed: install");
+ Equal(SetupPlan.Step.Upgrade, SetupPlan.Decide(false, download, home, "1.3.9", "1.4.0"), "older installed: upgrade");
+ Equal(SetupPlan.Step.Open, SetupPlan.Decide(false, download, home, "1.4.0", "1.4.0"), "same version: open it");
+ Equal(SetupPlan.Step.Open, SetupPlan.Decide(false, download, home, "1.10.0", "1.9.0"), "never downgrade");
+ Equal("知了", SetupPlan.ShortcutName("zh-Hans"), "Chinese shortcut");
+ Equal("Cicada", SetupPlan.ShortcutName("ja"), "other languages");
+ }
+
+ public static void StringsLoadFromAReader()
+ {
+ var files = new Dictionary<string, string> { ["en.lproj/Localizable.strings"] = "\"知了\" = \"Cicada\";", ["en.lproj/Windows.strings"] = "\"安装\" = \"Install\";" };
+ try
+ {
+ Strings.Load(p => files.GetValueOrDefault(p), "en");
+ Equal("Cicada", Strings.L("知了"), "the Mac table");
+ Equal("Install", Strings.L("安装"), "the Windows table over it");
+ }
+ finally { Strings.Load(Path.Combine(AppContext.BaseDirectory, "Resources"), "zh-Hans"); }
+ }
+
// MARK: 结束会议 (the Mac's MeetingEndTests, case for case)
static readonly DateTimeOffset T0 = DateTimeOffset.FromUnixTimeSeconds(1_000_000);
@@ -881,6 +910,21 @@ static class Tests
Equal(1, UpdateChecker.Decode(Rel("v1.5.0"))!.Count, "a single release");
Equal(null, UpdateChecker.Decode("{\"message\":\"Not Found\"}"), "GitHub's 404");
Equal(null, UpdateChecker.Decode("<html>"), "not JSON");
+ // A release with the installer: it's what to download, on each architecture.
+ var withSetup = UpdateChecker.Decode("""
+ [{"tag_name":"v1.6.0","html_url":"https://example.com/r","assets":[
+ {"name":"Cicada-1.6.0-Windows-x64.zip","browser_download_url":"https://example.com/z","size":5},
+ {"name":"Cicada-Setup.exe","browser_download_url":"https://example.com/setup","size":7},
+ {"name":"Cicada-Setup-arm64.exe","browser_download_url":"https://example.com/setup-arm","size":8}]},
+ {"tag_name":"v1.7.0","html_url":"https://example.com/r2","assets":[
+ {"name":"Cicada-Setup.exe","browser_download_url":"https://example.com/setup2","size":9}]}]
+ """)!;
+ var x = UpdateChecker.NewestWindows(withSetup, "x64")!;
+ Equal("1.7.0", x.Version, "a release with only the installer counts");
+ Equal("https://example.com/setup2", x.Download, "the installer is the download");
+ var older = UpdateChecker.NewestWindows(withSetup.Take(1), "ARM64")!;
+ Equal("https://example.com/setup-arm", older.Download, "ARM's installer");
+ Equal(8L, older.Size, "its size");
}
public static void UpdateDueAfterTheAge()