fix: update version to 1.0.9.2, remove updater functionality, and adjust bug report template

This commit is contained in:
kitbyte
2026-06-28 13:20:36 +03:00
parent b0279ee812
commit 537608c381
21 changed files with 19 additions and 731 deletions
+5 -5
View File
@@ -8,16 +8,16 @@ body:
- type: markdown
attributes:
value: |
**🚨 STOP BEFORE YOU POST: THIS PROJECT HAS NO OFFICIAL YOUTUBE TUTORIALS. 🚨**
If you downloaded an executable from a YouTube video link, you downloaded a virus/password stealer from a scammer. **Run an antivirus immediately and change your passwords.** Do not open issues about stolen accounts here this project is not related to those videos.
**STOP BEFORE YOU POST: THIS PROJECT DOES NOT PUBLISH OFFICIAL EXECUTABLE DOWNLOADS.**
Build WandEnhancer yourself from your own fork or local source. If you downloaded an executable from YouTube, Discord, a mirror, or any other third-party website, treat it as untrusted. Do not open issues about third-party binaries or stolen accounts here - this project is not related to those downloads.
- type: checkboxes
id: scam_check
id: build_source_check
attributes:
label: ⚠️ Download Source Confirmation (REQUIRED)
label: Build Source Confirmation (REQUIRED)
description: You must check this box to proceed.
options:
- label: I confirm that I downloaded this tool DIRECTLY from this official GitHub repository, and NOT from a YouTube video, Discord, or any other third-party website.
- label: I confirm that I built WandEnhancer myself from my own fork or local source, and did not download an executable from YouTube, Discord, mirrors, issue comments, or any other third-party website.
required: true
- type: input
+8
View File
@@ -3,6 +3,14 @@
This file is the source of truth for release notes.
The newest entry must match the version in `WandEnhancer/Properties/AssemblyInfo.cs`.
## [1.0.9.2] - 2026-06-28
### Changed
- Removed the built-in WandEnhancer updater. Official GitHub releases no longer ship executable assets.
- Removed System.Net.Http
- Switched official releases to publish release notes only.
## [1.0.9.1] - 2026-06-24
### Fixes
-15
View File
@@ -8,7 +8,6 @@
<!--#region MainWindow -->
<s:String x:Key="mw_title">WandEnhancer</s:String>
<s:String x:Key="mw_update_available">Eine neue Version ist verfügbar</s:String>
<s:String x:Key="mw_folder_path">Ordnerpfad</s:String>
<s:String x:Key="mw_folder_not_found">Ordner nicht gefunden</s:String>
<s:String x:Key="mw_patch">Anwenden</s:String>
@@ -39,18 +38,4 @@
<s:String x:Key="pv_popup_title">Was werden wir verbessern?</s:String>
<!--#endregion -->
<!--#region UpdatePopup -->
<s:String x:Key="up_warning">Vor dem Update wird dringend empfohlen, Änderungen rückgängig zu machen, falls sie angewendet wurden</s:String>
<s:String x:Key="up_current_version">Aktuelle Version</s:String>
<s:String x:Key="up_latest_version">Neueste Version</s:String>
<s:String x:Key="up_release_notes">Versionshinweise</s:String>
<s:String x:Key="up_release_notes_unavailable">Für diese Version sind keine Versionshinweise verfügbar.</s:String>
<s:String x:Key="up_show_more">Gesamtes Changelog anzeigen</s:String>
<s:String x:Key="up_show_less">Nur aktuelle Hinweise anzeigen</s:String>
<s:String x:Key="up_loading_changelog">Changelog wird geladen...</s:String>
<s:String x:Key="up_changelog_failed">Das vollständige Changelog konnte nicht geladen werden. Stattdessen werden die aktuellen Hinweise angezeigt.</s:String>
<s:String x:Key="up_update_now">Jetzt aktualisieren</s:String>
<s:String x:Key="up_popup_title">Update verfügbar!</s:String>
<!--#endregion -->
</ResourceDictionary>
-15
View File
@@ -8,7 +8,6 @@
<!--#region MainWindow -->
<s:String x:Key="mw_title">WandEnhancer</s:String>
<s:String x:Key="mw_update_available">A new version is available</s:String>
<s:String x:Key="mw_folder_path">Folder path</s:String>
<s:String x:Key="mw_folder_not_found">Folder not found</s:String>
<s:String x:Key="mw_patch">Enhance</s:String>
@@ -39,18 +38,4 @@
<s:String x:Key="pv_popup_title">What are we gonna enhance?</s:String>
<!--#endregion -->
<!--#region UpdatePopup -->
<s:String x:Key="up_warning">Before updating, it is strongly recommended to roll back modifications if they have been applied</s:String>
<s:String x:Key="up_current_version">Current version</s:String>
<s:String x:Key="up_latest_version">Latest version</s:String>
<s:String x:Key="up_release_notes">Release notes</s:String>
<s:String x:Key="up_release_notes_unavailable">Release notes are unavailable for this release.</s:String>
<s:String x:Key="up_show_more">Show full changelog</s:String>
<s:String x:Key="up_show_less">Show latest notes</s:String>
<s:String x:Key="up_loading_changelog">Loading changelog...</s:String>
<s:String x:Key="up_changelog_failed">Failed to load the full changelog. The latest notes are shown instead.</s:String>
<s:String x:Key="up_update_now">Update now</s:String>
<s:String x:Key="up_popup_title">Update available!</s:String>
<!--#endregion -->
</ResourceDictionary>
-15
View File
@@ -8,7 +8,6 @@
<!--#region MainWindow -->
<s:String x:Key="mw_title">WandEnhancer</s:String>
<s:String x:Key="mw_update_available">Una nueva versión está disponible</s:String>
<s:String x:Key="mw_folder_path">Ruta de la carpeta</s:String>
<s:String x:Key="mw_folder_not_found">Carpeta no encontrada</s:String>
<s:String x:Key="mw_patch">Aplicar</s:String>
@@ -39,18 +38,4 @@
<s:String x:Key="pv_popup_title">¿Qué vamos a mejorar?</s:String>
<!--#endregion -->
<!--#region UpdatePopup -->
<s:String x:Key="up_warning">Antes de actualizar, se recomienda encarecidamente revertir las modificaciones si se han aplicado</s:String>
<s:String x:Key="up_current_version">Versión actual</s:String>
<s:String x:Key="up_latest_version">Última versión</s:String>
<s:String x:Key="up_release_notes">Notas de la versión</s:String>
<s:String x:Key="up_release_notes_unavailable">Las notas de la versión no están disponibles para esta versión.</s:String>
<s:String x:Key="up_show_more">Mostrar changelog completo</s:String>
<s:String x:Key="up_show_less">Mostrar solo las notas actuales</s:String>
<s:String x:Key="up_loading_changelog">Cargando changelog...</s:String>
<s:String x:Key="up_changelog_failed">No se pudo cargar el changelog completo. Se muestran las notas actuales.</s:String>
<s:String x:Key="up_update_now">Actualizar ahora</s:String>
<s:String x:Key="up_popup_title">¡Actualización disponible!</s:String>
<!--#endregion -->
</ResourceDictionary>
-15
View File
@@ -8,7 +8,6 @@
<!--#region MainWindow -->
<s:String x:Key="mw_title">WandEnhancer</s:String>
<s:String x:Key="mw_update_available">Une nouvelle version est disponible</s:String>
<s:String x:Key="mw_folder_path">Chemin du dossier</s:String>
<s:String x:Key="mw_folder_not_found">Dossier non trouvé</s:String>
<s:String x:Key="mw_patch">Appliquer</s:String>
@@ -39,18 +38,4 @@
<s:String x:Key="pv_popup_title">Qu'allons-nous modifier ?</s:String>
<!--#endregion -->
<!--#region UpdatePopup -->
<s:String x:Key="up_warning">Avant la mise à jour, il est fortement recommandé d'annuler les modifications si elles ont été appliquées</s:String>
<s:String x:Key="up_current_version">Version actuelle</s:String>
<s:String x:Key="up_latest_version">Dernière version</s:String>
<s:String x:Key="up_release_notes">Notes de version</s:String>
<s:String x:Key="up_release_notes_unavailable">Les notes de version ne sont pas disponibles pour cette version.</s:String>
<s:String x:Key="up_show_more">Afficher le changelog complet</s:String>
<s:String x:Key="up_show_less">Afficher uniquement les notes actuelles</s:String>
<s:String x:Key="up_loading_changelog">Chargement du changelog...</s:String>
<s:String x:Key="up_changelog_failed">Impossible de charger le changelog complet. Les notes actuelles sont affichées à la place.</s:String>
<s:String x:Key="up_update_now">Mettre à jour maintenant</s:String>
<s:String x:Key="up_popup_title">Mise à jour disponible !</s:String>
<!--#endregion -->
</ResourceDictionary>
-15
View File
@@ -8,7 +8,6 @@
<!--#region MainWindow -->
<s:String x:Key="mw_title">WandEnhancer</s:String>
<s:String x:Key="mw_update_available">È disponibile una nuova versione</s:String>
<s:String x:Key="mw_folder_path">Percorso cartella</s:String>
<s:String x:Key="mw_folder_not_found">Cartella non trovata</s:String>
<s:String x:Key="mw_patch">Applica</s:String>
@@ -39,18 +38,4 @@
<s:String x:Key="pv_popup_title">Cosa modificheremo?</s:String>
<!--#endregion -->
<!--#region UpdatePopup -->
<s:String x:Key="up_warning">Prima dell'aggiornamento, si consiglia vivamente di annullare le modifiche se sono state applicate</s:String>
<s:String x:Key="up_current_version">Versione corrente</s:String>
<s:String x:Key="up_latest_version">Ultima versione</s:String>
<s:String x:Key="up_release_notes">Note di rilascio</s:String>
<s:String x:Key="up_release_notes_unavailable">Le note di rilascio non sono disponibili per questa versione.</s:String>
<s:String x:Key="up_show_more">Mostra il changelog completo</s:String>
<s:String x:Key="up_show_less">Mostra solo le note correnti</s:String>
<s:String x:Key="up_loading_changelog">Caricamento del changelog...</s:String>
<s:String x:Key="up_changelog_failed">Impossibile caricare il changelog completo. Vengono mostrate solo le note correnti.</s:String>
<s:String x:Key="up_update_now">Aggiorna ora</s:String>
<s:String x:Key="up_popup_title">Aggiornamento disponibile!</s:String>
<!--#endregion -->
</ResourceDictionary>
-15
View File
@@ -8,7 +8,6 @@
<!--#region MainWindow -->
<s:String x:Key="mw_title">WandEnhancer</s:String>
<s:String x:Key="mw_update_available">新しいバージョンが利用可能です</s:String>
<s:String x:Key="mw_folder_path">フォルダパス</s:String>
<s:String x:Key="mw_folder_not_found">フォルダが見つかりません</s:String>
<s:String x:Key="mw_patch">適用</s:String>
@@ -39,18 +38,4 @@
<s:String x:Key="pv_popup_title">何を改善しますか?</s:String>
<!--#endregion -->
<!--#region UpdatePopup -->
<s:String x:Key="up_warning">アップデート前に、変更が適用されている場合はロールバックすることを強くお勧めします</s:String>
<s:String x:Key="up_current_version">現在のバージョン</s:String>
<s:String x:Key="up_latest_version">最新バージョン</s:String>
<s:String x:Key="up_release_notes">リリースノート</s:String>
<s:String x:Key="up_release_notes_unavailable">このリリースのリリースノートは利用できません。</s:String>
<s:String x:Key="up_show_more">完全な変更履歴を表示</s:String>
<s:String x:Key="up_show_less">最新のリリースノートのみ表示</s:String>
<s:String x:Key="up_loading_changelog">変更履歴を読み込み中...</s:String>
<s:String x:Key="up_changelog_failed">完全な変更履歴を読み込めませんでした。代わりに最新のリリースノートを表示しています。</s:String>
<s:String x:Key="up_update_now">今すぐ更新</s:String>
<s:String x:Key="up_popup_title">アップデート利用可能!</s:String>
<!--#endregion -->
</ResourceDictionary>
-15
View File
@@ -8,7 +8,6 @@
<!--#region MainWindow -->
<s:String x:Key="mw_title">WandEnhancer</s:String>
<s:String x:Key="mw_update_available">Dostępna jest nowa wersja</s:String>
<s:String x:Key="mw_folder_path">Ścieżka folderu</s:String>
<s:String x:Key="mw_folder_not_found">Folder nie znaleziony</s:String>
<s:String x:Key="mw_patch">Zastosuj</s:String>
@@ -39,18 +38,4 @@
<s:String x:Key="pv_popup_title">Co będziemy ulepszać?</s:String>
<!--#endregion -->
<!--#region UpdatePopup -->
<s:String x:Key="up_warning">Przed aktualizacją zdecydowanie zaleca się cofnięcie zmian, jeśli zostały zastosowane</s:String>
<s:String x:Key="up_current_version">Aktualna wersja</s:String>
<s:String x:Key="up_latest_version">Najnowsza wersja</s:String>
<s:String x:Key="up_release_notes">Informacje o wydaniu</s:String>
<s:String x:Key="up_release_notes_unavailable">Informacje o wydaniu są niedostępne dla tej wersji.</s:String>
<s:String x:Key="up_show_more">Pokaż cały changelog</s:String>
<s:String x:Key="up_show_less">Pokaż tylko bieżące zmiany</s:String>
<s:String x:Key="up_loading_changelog">Ładowanie changeloga...</s:String>
<s:String x:Key="up_changelog_failed">Nie udało się załadować pełnego changeloga. Zamiast tego wyświetlono bieżące zmiany.</s:String>
<s:String x:Key="up_update_now">Aktualizuj teraz</s:String>
<s:String x:Key="up_popup_title">Dostępna aktualizacja!</s:String>
<!--#endregion -->
</ResourceDictionary>
-15
View File
@@ -8,7 +8,6 @@
<!--#region MainWindow -->
<s:String x:Key="mw_title">WandEnhancer</s:String>
<s:String x:Key="mw_update_available">Uma nova versão está disponível</s:String>
<s:String x:Key="mw_folder_path">Caminho da pasta</s:String>
<s:String x:Key="mw_folder_not_found">Pasta não encontrada</s:String>
<s:String x:Key="mw_patch">Aplicar</s:String>
@@ -39,18 +38,4 @@
<s:String x:Key="pv_popup_title">O que vamos melhorar?</s:String>
<!--#endregion -->
<!--#region UpdatePopup -->
<s:String x:Key="up_warning">Antes de atualizar, é altamente recomendável reverter as modificações se elas foram aplicadas</s:String>
<s:String x:Key="up_current_version">Versão atual</s:String>
<s:String x:Key="up_latest_version">Versão mais recente</s:String>
<s:String x:Key="up_release_notes">Notas da versão</s:String>
<s:String x:Key="up_release_notes_unavailable">As notas da versão não estão disponíveis para esta versão.</s:String>
<s:String x:Key="up_show_more">Mostrar changelog completo</s:String>
<s:String x:Key="up_show_less">Mostrar apenas as notas atuais</s:String>
<s:String x:Key="up_loading_changelog">Carregando changelog...</s:String>
<s:String x:Key="up_changelog_failed">Falha ao carregar o changelog completo. As notas atuais estão sendo exibidas.</s:String>
<s:String x:Key="up_update_now">Atualizar agora</s:String>
<s:String x:Key="up_popup_title">Atualização disponível!</s:String>
<!--#endregion -->
</ResourceDictionary>
-15
View File
@@ -8,7 +8,6 @@
<!--#region MainWindow -->
<s:String x:Key="mw_title">WandEnhancer</s:String>
<s:String x:Key="mw_update_available">Доступна новая версия</s:String>
<s:String x:Key="mw_folder_path">Путь к папке</s:String>
<s:String x:Key="mw_folder_not_found">Папка не найдена</s:String>
<s:String x:Key="mw_patch">Применить</s:String>
@@ -39,18 +38,4 @@
<s:String x:Key="pv_popup_title">Что будем улучшать?</s:String>
<!--#endregion -->
<!--#region UpdatePopup -->
<s:String x:Key="up_warning">Перед обновлением настоятельно рекомендуется откатить изменения, если они были применены</s:String>
<s:String x:Key="up_current_version">Текущая версия</s:String>
<s:String x:Key="up_latest_version">Новая версия</s:String>
<s:String x:Key="up_release_notes">Что нового</s:String>
<s:String x:Key="up_release_notes_unavailable">Для этого релиза патчноуты недоступны.</s:String>
<s:String x:Key="up_show_more">Показать весь changelog</s:String>
<s:String x:Key="up_show_less">Показать только актуальные изменения</s:String>
<s:String x:Key="up_loading_changelog">Загрузка changelog...</s:String>
<s:String x:Key="up_changelog_failed">Не удалось загрузить полный changelog. Показаны только актуальные изменения.</s:String>
<s:String x:Key="up_update_now">Обновить сейчас</s:String>
<s:String x:Key="up_popup_title">Доступно обновление!</s:String>
<!--#endregion -->
</ResourceDictionary>
-15
View File
@@ -8,7 +8,6 @@
<!--#region MainWindow -->
<s:String x:Key="mw_title">WandEnhancer</s:String>
<s:String x:Key="mw_update_available">Yeni bir sürüm mevcut</s:String>
<s:String x:Key="mw_folder_path">Klasör yolu</s:String>
<s:String x:Key="mw_folder_not_found">Klasör bulunamadı</s:String>
<s:String x:Key="mw_patch">Uygula</s:String>
@@ -39,18 +38,4 @@
<s:String x:Key="pv_popup_title">Neyi geliştireceğiz?</s:String>
<!--#endregion -->
<!--#region UpdatePopup -->
<s:String x:Key="up_warning">Güncellemeden önce, değişiklikler uygulandıysa geri almak şiddetle tavsiye edilir</s:String>
<s:String x:Key="up_current_version">Geçerli sürüm</s:String>
<s:String x:Key="up_latest_version">En son sürüm</s:String>
<s:String x:Key="up_release_notes">Sürüm notları</s:String>
<s:String x:Key="up_release_notes_unavailable">Bu sürüm için sürüm notları kullanılamıyor.</s:String>
<s:String x:Key="up_show_more">Tüm changelog'u göster</s:String>
<s:String x:Key="up_show_less">Yalnızca güncel notları göster</s:String>
<s:String x:Key="up_loading_changelog">Changelog yükleniyor...</s:String>
<s:String x:Key="up_changelog_failed">Tam changelog yüklenemedi. Bunun yerine güncel notlar gösteriliyor.</s:String>
<s:String x:Key="up_update_now">Şimdi güncelle</s:String>
<s:String x:Key="up_popup_title">Güncelleme mevcut!</s:String>
<!--#endregion -->
</ResourceDictionary>
-15
View File
@@ -8,7 +8,6 @@
<!--#region MainWindow -->
<s:String x:Key="mw_title">WandEnhancer</s:String>
<s:String x:Key="mw_update_available">Доступна нова версія</s:String>
<s:String x:Key="mw_folder_path">Шлях до папки</s:String>
<s:String x:Key="mw_folder_not_found">Папку не знайдено</s:String>
<s:String x:Key="mw_patch">Застосувати</s:String>
@@ -39,18 +38,4 @@
<s:String x:Key="pv_popup_title">Що будемо покращувати?</s:String>
<!--#endregion -->
<!--#region UpdatePopup -->
<s:String x:Key="up_warning">Перед оновленням наполегливо рекомендується відкотити зміни, якщо вони були застосовані</s:String>
<s:String x:Key="up_current_version">Поточна версія</s:String>
<s:String x:Key="up_latest_version">Остання версія</s:String>
<s:String x:Key="up_release_notes">Нотатки до релізу</s:String>
<s:String x:Key="up_release_notes_unavailable">Нотатки до цього релізу недоступні.</s:String>
<s:String x:Key="up_show_more">Показати весь список змін</s:String>
<s:String x:Key="up_show_less">Показати лише актуальні зміни</s:String>
<s:String x:Key="up_loading_changelog">Завантаження списку змін...</s:String>
<s:String x:Key="up_changelog_failed">Не вдалося завантажити повний список змін. Натомість показано лише актуальні зміни.</s:String>
<s:String x:Key="up_update_now">Оновити зараз</s:String>
<s:String x:Key="up_popup_title">Доступне оновлення!</s:String>
<!--#endregion -->
</ResourceDictionary>
-15
View File
@@ -8,7 +8,6 @@
<!--#region MainWindow -->
<s:String x:Key="mw_title">WandEnhancer</s:String>
<s:String x:Key="mw_update_available">有新版本可用</s:String>
<s:String x:Key="mw_folder_path">文件夹路径</s:String>
<s:String x:Key="mw_folder_not_found">未找到文件夹</s:String>
<s:String x:Key="mw_patch">增强</s:String>
@@ -39,18 +38,4 @@
<s:String x:Key="pv_popup_title">我们要增强什么?</s:String>
<!--#endregion -->
<!--#region UpdatePopup -->
<s:String x:Key="up_warning">在更新之前,强烈建议回滚已应用的修改</s:String>
<s:String x:Key="up_current_version">当前版本</s:String>
<s:String x:Key="up_latest_version">最新版本</s:String>
<s:String x:Key="up_release_notes">更新说明</s:String>
<s:String x:Key="up_release_notes_unavailable">此版本的更新说明不可用。</s:String>
<s:String x:Key="up_show_more">显示完整更新日志</s:String>
<s:String x:Key="up_show_less">仅显示当前说明</s:String>
<s:String x:Key="up_loading_changelog">正在加载更新日志...</s:String>
<s:String x:Key="up_changelog_failed">无法加载完整更新日志。当前仅显示本次说明。</s:String>
<s:String x:Key="up_update_now">立即更新</s:String>
<s:String x:Key="up_popup_title">有更新可用!</s:String>
<!--#endregion -->
</ResourceDictionary>
+2 -2
View File
@@ -51,5 +51,5 @@ using System.Windows;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.9.1")]
[assembly: AssemblyFileVersion("1.0.9.1")]
[assembly: AssemblyVersion("1.0.9.2")]
[assembly: AssemblyFileVersion("1.0.9.2")]
-281
View File
@@ -1,281 +0,0 @@
using System;
using System.Globalization;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Net.Http;
using Newtonsoft.Json;
namespace WandEnhancer.Utils
{
public class UpdateReleaseInfo
{
public string Version { get; set; }
public string LatestNotes { get; set; }
}
public class GitHubRelease
{
public class AssetsType
{
public string Name { get; set; }
[JsonProperty("browser_download_url")]
public string Url { get; set; }
}
[JsonProperty("tag_name")]
public string TagName { get; set; }
[JsonProperty("assets")]
public AssetsType[] Assets { get; set; }
[JsonProperty("body")]
public string Body { get; set; }
[JsonProperty("published_at")]
public DateTimeOffset PublishedAt { get; set; }
}
public class Updater
{
private GitHubRelease _release = null;
private UpdateReleaseInfo _updateInfo = null;
private string _fullChangelog = null;
private static readonly HttpClient _httpClient = new HttpClient()
{
DefaultRequestHeaders =
{
{ "User-Agent", "GitHub-Updater" }
}
};
private static readonly string ApiUrl = $"https://api.github.com/repos/{Constants.Owner}/{Constants.RepoName}/releases/latest";
private static readonly string ReleasesApiUrl = $"https://api.github.com/repos/{Constants.Owner}/{Constants.RepoName}/releases?per_page=20";
public async Task<bool> CheckForUpdates()
{
try
{
var currentVersion = Assembly.GetExecutingAssembly().GetName().Version;
var response = await _httpClient.GetAsync(ApiUrl);
response.EnsureSuccessStatusCode();
_release = JsonConvert.DeserializeObject<GitHubRelease>(await response.Content.ReadAsStringAsync());
_updateInfo = null;
_fullChangelog = null;
if (_release == null)
{
return false;
}
var latestVersion = ParseVersion(_release.TagName);
if (latestVersion <= currentVersion)
{
return false;
}
_updateInfo = new UpdateReleaseInfo
{
Version = NormalizeVersion(_release.TagName),
LatestNotes = NormalizeText(_release.Body)
};
return true;
}
catch (Exception)
{
return false;
}
}
public async Task<UpdateReleaseInfo> GetUpdateInfoAsync()
{
if (_updateInfo != null)
{
return _updateInfo;
}
return await CheckForUpdates()
? _updateInfo
: null;
}
public async Task<string> GetFullChangelogAsync()
{
if (!string.IsNullOrWhiteSpace(_fullChangelog))
{
return NormalizeText(_fullChangelog);
}
_fullChangelog = await TryLoadFullChangelogAsync();
return NormalizeText(_fullChangelog);
}
public async Task Update()
{
if (_release == null)
{
throw new Exception("No release found");
}
var asset = _release.Assets.FirstOrDefault(o => o.Name.EndsWith(".exe"));
if(asset == null)
{
throw new Exception("No asset found");
}
// download to temp
var downloadPath = Path.Combine(Path.GetTempPath(), asset.Name);
using(var response = await _httpClient.GetAsync(asset.Url))
using(var fileStream = File.Create(downloadPath))
{
response.EnsureSuccessStatusCode();
await response.Content.CopyToAsync(fileStream);
}
ApplyUpdate(downloadPath);
}
private static void ApplyUpdate(string filePath)
{
try
{
var currentExecutable = Assembly.GetExecutingAssembly().Location;
var psCommand = $"Start-Sleep -Seconds 2; " +
$"Copy-Item -Path '{filePath}' -Destination '{currentExecutable}' -Force; " +
$"Remove-Item -Path '{filePath}' -Force; " +
$"Start-Sleep -Seconds 1; " +
$"Start-Process -FilePath '{currentExecutable}';";
var startInfo = new ProcessStartInfo
{
FileName = "powershell.exe",
Arguments = $"-WindowStyle Hidden -ExecutionPolicy Bypass -Command \"{psCommand}\"",
UseShellExecute = true,
CreateNoWindow = true,
WindowStyle = ProcessWindowStyle.Hidden
};
Process.Start(startInfo);
Task.Delay(500).ContinueWith(_ =>
{
App.Shutdown();
});
}
catch (Exception ex)
{
throw new Exception($"Update failed: {ex.Message}");
}
}
private static Version ParseVersion(string versionTag)
{
return new Version(NormalizeVersion(versionTag));
}
private static string NormalizeVersion(string versionTag)
{
if (string.IsNullOrWhiteSpace(versionTag))
{
throw new ArgumentException("Version tag cannot be empty.", nameof(versionTag));
}
return versionTag.Trim().TrimStart('v', 'V');
}
private static string NormalizeText(string text)
{
if (string.IsNullOrWhiteSpace(text))
{
return null;
}
return NormalizeLineEndings(text).Trim();
}
private static string NormalizeLineEndings(string text)
{
return text
.Replace("\r\n", "\n")
.Replace('\r', '\n');
}
private static async Task<string> TryLoadFullChangelogAsync()
{
return await TryBuildReleaseHistoryAsync();
}
private static async Task<string> TryBuildReleaseHistoryAsync()
{
try
{
var response = await _httpClient.GetAsync(ReleasesApiUrl);
if (!response.IsSuccessStatusCode)
{
return null;
}
var releases = JsonConvert.DeserializeObject<GitHubRelease[]>(await response.Content.ReadAsStringAsync());
if (releases == null || releases.Length == 0)
{
return null;
}
return BuildReleaseHistory(releases);
}
catch
{
return null;
}
}
private static string BuildReleaseHistory(GitHubRelease[] releases)
{
var builder = new StringBuilder();
foreach (var release in releases.Where(item => !string.IsNullOrWhiteSpace(item?.TagName)))
{
if (builder.Length > 0)
{
builder.AppendLine();
builder.AppendLine();
}
builder.Append("## [")
.Append(NormalizeVersion(release.TagName))
.Append("]");
if (release.PublishedAt != default(DateTimeOffset))
{
builder.Append(" - ")
.Append(release.PublishedAt.UtcDateTime.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture));
}
var notes = NormalizeText(release.Body);
if (string.IsNullOrWhiteSpace(notes))
{
continue;
}
builder.AppendLine();
builder.AppendLine();
builder.Append(notes);
}
return NormalizeText(builder.ToString());
}
}
}
@@ -45,12 +45,6 @@
v 1.0.0
</TextBlock>
<Button Background="SpringGreen" Foreground="{DynamicResource Muted}"
FontWeight="Medium" Padding="20 0" Margin="10 5 20 5"
ToolTip="Click to update"
Command="{Binding UpdateCommand}"
Visibility="{Binding IsUpdateAvailable, Converter={StaticResource ToVisibilityConverter}}"
Content="{DynamicResource mw_update_available}"/>
</StackPanel>
<StackPanel HorizontalAlignment="Right" Orientation="Horizontal">
@@ -1,7 +1,6 @@
using System;
using System.Collections.ObjectModel;
using System.IO;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
@@ -18,8 +17,6 @@ namespace WandEnhancer.View.MainWindow
{
private readonly MainWindow _view;
public ObservableCollection<LogEntry> LogList { get; set; } = new ObservableCollection<LogEntry>();
private static Updater _updater = new Updater();
private WeModConfig _weModConfig;
public WeModConfig WeModInfo
@@ -61,18 +58,9 @@ namespace WandEnhancer.View.MainWindow
set => SetProperty(ref _alreadyPatched, value);
}
private bool _isUpdateAvailable;
public bool IsUpdateAvailable
{
get => _isUpdateAvailable;
set => SetProperty(ref _isUpdateAvailable, value);
}
public RelayCommand SetFolderPathCommand { get; }
public RelayCommand ApplyPatchCommand { get; }
public RelayCommand RestoreBackupCommand { get; }
public RelayCommand UpdateCommand { get; }
public RelayCommand OpenSettingsCommand { get; }
public RelayCommand CopyLogsCommand { get; }
public RelayCommand ExportLogsCommand { get; }
@@ -185,36 +173,6 @@ namespace WandEnhancer.View.MainWindow
});
}
private async void OnUpdate(object param)
{
var updateInfo = await _updater.GetUpdateInfoAsync();
if (updateInfo == null)
{
Log("No update details are available right now.", ELogType.Warn);
return;
}
MainWindow.Instance.OpenPopup(new UpdatePopup(Constants.Version.ToString(), updateInfo.Version,
updateInfo.LatestNotes, () =>
{
MainWindow.Instance.ClosePopup();
Task.Run(async () =>
{
try
{
await _updater.Update();
}
catch (Exception e)
{
Log($"Failed to update: {e.Message}", ELogType.Error);
return;
}
Log("WandEnhancer updated successfully. Restarting...", ELogType.Success);
});
}, () => _updater.GetFullChangelogAsync()), Application.Current.FindResource("up_popup_title") as string);
}
private void OnOpenSettings(object param)
{
MainWindow.Instance.OpenPopup(new SettingsPopup(), Application.Current.FindResource("settings_title") as string);
@@ -280,16 +238,10 @@ namespace WandEnhancer.View.MainWindow
public MainWindowVm(MainWindow view)
{
Task.Run(async () =>
{
var isUpdateAvailable = await _updater.CheckForUpdates();
Application.Current.Dispatcher.Invoke(() => IsUpdateAvailable = isUpdateAvailable);
});
_view = view;
SetFolderPathCommand = new RelayCommand(OnFolderPathSelection);
ApplyPatchCommand = new RelayCommand(OnPatching);
RestoreBackupCommand = new RelayCommand(OnBackupRestoring);
/*UpdateCommand = new RelayCommand(OnUpdate);*/
OpenSettingsCommand = new RelayCommand(OnOpenSettings);
CopyLogsCommand = new RelayCommand(OnCopyLogs);
ExportLogsCommand = new RelayCommand(OnExportLogs);
-104
View File
@@ -1,104 +0,0 @@
<UserControl x:Class="WandEnhancer.View.Popups.UpdatePopup"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
d:DesignHeight="Auto" d:DesignWidth="Auto"
Background="{DynamicResource Background}"
Foreground="{DynamicResource MutedForeground}"
FontWeight="Medium"
FontSize="13">
<Grid MinWidth="500" MaxWidth="620">
<Grid.Resources>
<Style x:Key="UpdateActionButton" TargetType="Button" BasedOn="{StaticResource {x:Type Button}}">
<Setter Property="Background" Value="{DynamicResource Primary}" />
<Setter Property="BorderBrush" Value="{DynamicResource Primary}" />
<Setter Property="Foreground" Value="{DynamicResource PrimaryForeground}" />
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="{DynamicResource Primary}" />
<Setter Property="BorderBrush" Value="{DynamicResource Primary}" />
</Trigger>
</Style.Triggers>
</Style>
</Grid.Resources>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Border Grid.Row="0" HorizontalAlignment="Left" MaxWidth="560"
Padding="9 4" CornerRadius="4"
Background="{DynamicResource Muted}">
<DockPanel LastChildFill="True">
<Ellipse Width="7" Height="7" Fill="{DynamicResource Destructive}"
Margin="0 0 8 0" VerticalAlignment="Center" />
<TextBlock Foreground="{DynamicResource Foreground}" FontSize="11.5"
Text="{DynamicResource up_warning}" TextWrapping="Wrap" />
</DockPanel>
</Border>
<WrapPanel Grid.Row="1" Margin="0 10 0 0" Orientation="Horizontal">
<Border Padding="8 4" Margin="0 0 8 0" CornerRadius="4"
Background="{DynamicResource Muted}" BorderBrush="{DynamicResource Border}" BorderThickness="1">
<StackPanel Orientation="Horizontal">
<TextBlock Margin="0 0 7 0" VerticalAlignment="Center"
Foreground="{DynamicResource MutedForeground}" FontSize="10.5"
Text="{DynamicResource up_current_version}" />
<TextBlock x:Name="CurrentVersionValue" VerticalAlignment="Center"
Foreground="{DynamicResource Foreground}" FontSize="12.5" FontWeight="Bold" />
</StackPanel>
</Border>
<Border Padding="8 4" CornerRadius="4"
Background="{DynamicResource Primary}" BorderThickness="1">
<StackPanel Orientation="Horizontal">
<TextBlock Margin="0 0 7 0" VerticalAlignment="Center"
Foreground="{DynamicResource PrimaryForeground}" FontSize="10.5"
Text="{DynamicResource up_latest_version}" />
<TextBlock x:Name="LatestVersionValue" VerticalAlignment="Center"
Foreground="{DynamicResource PrimaryForeground}" FontSize="12.5" FontWeight="Bold" />
</StackPanel>
</Border>
</WrapPanel>
<TextBlock Grid.Row="2" Margin="0 12 0 6" Foreground="{DynamicResource Foreground}"
FontSize="14" FontWeight="Bold" Text="{DynamicResource up_release_notes}" />
<Border Grid.Row="3"
Background="{DynamicResource Muted}" BorderBrush="{DynamicResource Border}" BorderThickness="1" CornerRadius="4">
<ScrollViewer x:Name="NotesScrollViewer"
VerticalScrollBarVisibility="Hidden"
HorizontalScrollBarVisibility="Disabled"
CanContentScroll="False">
<TextBox x:Name="NotesTextBlock" Background="Transparent"
BorderBrush="Transparent"
Padding="12"
BorderThickness="0" IsReadOnly="True"
Foreground="{DynamicResource Foreground}"
TextWrapping="Wrap" />
</ScrollViewer>
</Border>
<Grid Grid.Row="4" Margin="0 12 0 0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Button x:Name="ShowMoreButton" Grid.Column="1" Margin="0 0 10 0"
Padding="12 5" Content="{DynamicResource up_show_more}"
Click="OnShowMoreClick" />
<Button Grid.Column="2" Padding="18 5" Style="{StaticResource UpdateActionButton}"
Content="{DynamicResource up_update_now}"
Click="OnUpdateClick" />
</Grid>
</Grid>
</UserControl>
@@ -1,95 +0,0 @@
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;
}
}
}
-6
View File
@@ -55,7 +55,6 @@
<Reference Include="System.Data" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
@@ -84,7 +83,6 @@
<Compile Include="ReactiveUICore\RelayCommand.cs" />
<Compile Include="Utils\Common.cs" />
<Compile Include="Utils\Extensions.cs" />
<Compile Include="Utils\Updater.cs" />
<Compile Include="Utils\Win32\Shortcut.cs" />
<Compile Include="View\Controls\InfoItem.xaml.cs">
<DependentUpon>InfoItem.xaml</DependentUpon>
@@ -103,9 +101,6 @@
<DependentUpon>App.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="View\Popups\UpdatePopup.xaml.cs">
<DependentUpon>UpdatePopup.xaml</DependentUpon>
</Compile>
<Page Include="Locale\lang.en-US.xaml" />
<Page Include="Locale\lang.zh-CN.xaml" />
<Page Include="Locale\lang.de-DE.xaml" />
@@ -126,7 +121,6 @@
<Page Include="View\MainWindow\MainWindow.xaml" />
<Page Include="View\Popups\PatchVectorsPopup.xaml" />
<Page Include="View\Popups\SettingsPopup.xaml" />
<Page Include="View\Popups\UpdatePopup.xaml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs">