From 800f733f12441e9cffb1512498eb5711a5c152bf Mon Sep 17 00:00:00 2001 From: bcssov Date: Sun, 29 Oct 2023 23:16:31 +0100 Subject: [PATCH] Just fun feature --- src/IronyModManager/App.xaml.cs | 23 +++++++++++++++++------ src/IronyModManager/Constants.cs | 12 +++++++++--- 2 files changed, 26 insertions(+), 9 deletions(-) diff --git a/src/IronyModManager/App.xaml.cs b/src/IronyModManager/App.xaml.cs index f33d3915..9e9968d2 100644 --- a/src/IronyModManager/App.xaml.cs +++ b/src/IronyModManager/App.xaml.cs @@ -1,10 +1,11 @@ -// *********************************************************************** + +// *********************************************************************** // Assembly : IronyModManager // Author : Mario // Created : 01-10-2020 // // Last Modified By : Mario -// Last Modified On : 11-29-2022 +// Last Modified On : 10-29-2023 // *********************************************************************** // // Mario @@ -13,6 +14,7 @@ // *********************************************************************** using System; using System.Diagnostics; +using System.IO; using System.Linq; using System.Threading.Tasks; using Avalonia; @@ -38,6 +40,7 @@ namespace IronyModManager { + /// /// Class App. /// Implements the @@ -181,10 +184,18 @@ protected virtual void InitCulture() protected virtual void SetAppTitle(IClassicDesktopStyleApplicationLifetime desktop) { var appTitle = IronyFormatter.Format(DIResolver.Get().GetResource(LocalizationResources.App.Title), - new + new + { + AppVersion = FileVersionInfo.GetVersionInfo(GetType().Assembly.Location).ProductVersion.Split("+")[0] + }); + if (File.Exists(Constants.TitleSuffixFilename)) + { + var suffix = File.ReadAllLines(Constants.TitleSuffixFilename); + if (suffix.Any()) { - AppVersion = FileVersionInfo.GetVersionInfo(GetType().Assembly.Location).ProductVersion.Split("+")[0] - }); + appTitle = $"{appTitle} ({suffix.FirstOrDefault()})"; + } + } desktop.MainWindow.Title = appTitle; } @@ -198,7 +209,7 @@ protected virtual async Task VerifyWritePermissionsAsync() await Task.Delay(5000); var permissionService = DIResolver.Get(); var permissions = permissionService.VerifyPermissions(); - if (permissions.Count > 0 && permissions.Any(p => !p.Valid)) + if (permissions.Any() && permissions.Any(p => !p.Valid)) { var notificationAction = DIResolver.Get(); var locManager = DIResolver.Get(); diff --git a/src/IronyModManager/Constants.cs b/src/IronyModManager/Constants.cs index 46235938..852cc892 100644 --- a/src/IronyModManager/Constants.cs +++ b/src/IronyModManager/Constants.cs @@ -1,10 +1,11 @@ -// *********************************************************************** + +// *********************************************************************** // Assembly : IronyModManager // Author : Mario // Created : 01-13-2020 // // Last Modified By : Mario -// Last Modified On : 10-28-2022 +// Last Modified On : 10-29-2023 // *********************************************************************** // // Mario @@ -16,6 +17,7 @@ namespace IronyModManager { + /// /// Class Constants. /// @@ -53,11 +55,15 @@ public class Constants /// public const string PublicUpdateKey = "Oc2c/G6WMYkKL9+owAZYNIwMAMu9YqURiKw+gkY4zEw="; + /// + /// The title suffix filename + /// + public const string TitleSuffixFilename = "Title_Suffix.txt"; + /// /// The update settings /// public const string UpdateSettings = "update-settings.json"; - /// /// The wiki URL ///