mirror of
https://github.com/k1tbyte/Wand-Enhancer.git
synced 2026-08-28 17:01:04 +00:00
13759b1db6
- reduce ASAR IO overhead with streamed archive reads, buffered copies, faster relative-path handling and placeholder integrity records - fix in-place app.asar.unpacked packing/extraction self-copy cases that caused locked-file failures - tighten JS patch discovery with candidate bundle filters and search hints - require prebuilt remote-panel dist artifacts and clean up embedded bridge/script packaging - add unified build entrypoints for PowerShell, cmd and bash and move native CMake output under .tmp - add release metadata validation, changelog section extraction, pre-commit hook and GitHub Actions validation/release pipelines - make CHANGELOG the source of truth for release notes and document the tag-driven release flow - add updater release notes UI with latest/full changelog loading and localize the new update strings - modularize bridge renderer scripts, add installed apps and game status sync, and support remote launch/stop commands - centralize bridge protocol, IPC and WebSocket constants and improve LAN IP selection for QR pairing - refactor remote panel controls/state enums, persist accent color, polish library/session UI and refresh assets
95 lines
3.0 KiB
C#
95 lines
3.0 KiB
C#
using System;
|
|
using System.Threading.Tasks;
|
|
using System.Windows;
|
|
using System.Windows.Controls;
|
|
|
|
namespace WandEnhancer.View.Popups
|
|
{
|
|
public partial class UpdatePopup : UserControl
|
|
{
|
|
private readonly Action _onUpdate;
|
|
private readonly Func<Task<string>> _loadFullChangelog;
|
|
private readonly string _latestNotes;
|
|
private string _fullChangelog;
|
|
private bool _showingFullChangelog;
|
|
|
|
public UpdatePopup(string currentVersion, string latestVersion, string latestNotes, Action onUpdate,
|
|
Func<Task<string>> loadFullChangelog)
|
|
{
|
|
_onUpdate = onUpdate;
|
|
_loadFullChangelog = loadFullChangelog;
|
|
InitializeComponent();
|
|
|
|
CurrentVersionValue.Text = currentVersion;
|
|
LatestVersionValue.Text = latestVersion;
|
|
_latestNotes = string.IsNullOrWhiteSpace(latestNotes)
|
|
? GetResourceText("up_release_notes_unavailable")
|
|
: latestNotes;
|
|
|
|
SetNotesText(_latestNotes);
|
|
ShowMoreButton.Visibility = loadFullChangelog == null ? Visibility.Collapsed : Visibility.Visible;
|
|
}
|
|
|
|
private void OnUpdateClick(object sender, RoutedEventArgs e)
|
|
{
|
|
_onUpdate();
|
|
}
|
|
|
|
private async void OnShowMoreClick(object sender, RoutedEventArgs e)
|
|
{
|
|
if (_loadFullChangelog == null)
|
|
{
|
|
return;
|
|
}
|
|
|
|
if (_showingFullChangelog)
|
|
{
|
|
SetNotesText(_latestNotes);
|
|
ShowMoreButton.Content = GetResourceText("up_show_more");
|
|
_showingFullChangelog = false;
|
|
return;
|
|
}
|
|
|
|
if (string.IsNullOrWhiteSpace(_fullChangelog))
|
|
{
|
|
ShowMoreButton.IsEnabled = false;
|
|
ShowMoreButton.Content = GetResourceText("up_loading_changelog");
|
|
|
|
try
|
|
{
|
|
_fullChangelog = await _loadFullChangelog();
|
|
}
|
|
finally
|
|
{
|
|
ShowMoreButton.IsEnabled = true;
|
|
}
|
|
}
|
|
|
|
if (string.IsNullOrWhiteSpace(_fullChangelog))
|
|
{
|
|
ShowMoreButton.Content = GetResourceText("up_show_more");
|
|
SetNotesText(string.Concat(
|
|
_latestNotes,
|
|
Environment.NewLine,
|
|
Environment.NewLine,
|
|
GetResourceText("up_changelog_failed")));
|
|
return;
|
|
}
|
|
|
|
SetNotesText(_fullChangelog);
|
|
ShowMoreButton.Content = GetResourceText("up_show_less");
|
|
_showingFullChangelog = true;
|
|
}
|
|
|
|
private void SetNotesText(string text)
|
|
{
|
|
NotesTextBlock.Text = text ?? string.Empty;
|
|
NotesScrollViewer.ScrollToTop();
|
|
}
|
|
|
|
private static string GetResourceText(string key)
|
|
{
|
|
return Application.Current.TryFindResource(key) as string ?? string.Empty;
|
|
}
|
|
}
|
|
} |