Skip to content

Commit

Permalink
Just fun feature
Browse files Browse the repository at this point in the history
  • Loading branch information
bcssov committed Oct 29, 2023
1 parent c9ae917 commit 800f733
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 9 deletions.
23 changes: 17 additions & 6 deletions src/IronyModManager/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -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
// ***********************************************************************
// <copyright file="App.xaml.cs" company="Mario">
// Mario
Expand All @@ -13,6 +14,7 @@
// ***********************************************************************
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Avalonia;
Expand All @@ -38,6 +40,7 @@

namespace IronyModManager
{

/// <summary>
/// Class App.
/// Implements the <see cref="Avalonia.Application" />
Expand Down Expand Up @@ -181,10 +184,18 @@ protected virtual void InitCulture()
protected virtual void SetAppTitle(IClassicDesktopStyleApplicationLifetime desktop)
{
var appTitle = IronyFormatter.Format(DIResolver.Get<ILocalizationManager>().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;
}

Expand All @@ -198,7 +209,7 @@ protected virtual async Task VerifyWritePermissionsAsync()
await Task.Delay(5000);
var permissionService = DIResolver.Get<IPermissionCheckService>();
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<INotificationAction>();
var locManager = DIResolver.Get<ILocalizationManager>();
Expand Down
12 changes: 9 additions & 3 deletions src/IronyModManager/Constants.cs
Original file line number Diff line number Diff line change
@@ -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
// ***********************************************************************
// <copyright file="Constants.cs" company="Mario">
// Mario
Expand All @@ -16,6 +17,7 @@

namespace IronyModManager
{

/// <summary>
/// Class Constants.
/// </summary>
Expand Down Expand Up @@ -53,11 +55,15 @@ public class Constants
/// </summary>
public const string PublicUpdateKey = "Oc2c/G6WMYkKL9+owAZYNIwMAMu9YqURiKw+gkY4zEw=";

/// <summary>
/// The title suffix filename
/// </summary>
public const string TitleSuffixFilename = "Title_Suffix.txt";

/// <summary>
/// The update settings
/// </summary>
public const string UpdateSettings = "update-settings.json";

/// <summary>
/// The wiki URL
/// </summary>
Expand Down

0 comments on commit 800f733

Please sign in to comment.