Use proper version string based on build version

This commit is contained in:
MBucari 2025-07-27 21:09:45 -06:00 committed by Michael Bucari-Tovo
parent be96f99461
commit ca30fd41c6
10 changed files with 24 additions and 13 deletions

View File

@ -5,6 +5,7 @@ using System.Threading.Tasks;
using AudibleUtilities; using AudibleUtilities;
using DataLayer; using DataLayer;
using Dinah.Core; using Dinah.Core;
using LibationFileManager;
using LibationFileManager.Templates; using LibationFileManager.Templates;
#nullable enable #nullable enable
@ -66,7 +67,7 @@ namespace FileLiberator
BitRate = libraryBook.Book.UserDefinedItem.LastDownloadedFormat?.BitRate, BitRate = libraryBook.Book.UserDefinedItem.LastDownloadedFormat?.BitRate,
SampleRate = libraryBook.Book.UserDefinedItem.LastDownloadedFormat?.SampleRate, SampleRate = libraryBook.Book.UserDefinedItem.LastDownloadedFormat?.SampleRate,
Channels = libraryBook.Book.UserDefinedItem.LastDownloadedFormat?.ChannelCount, Channels = libraryBook.Book.UserDefinedItem.LastDownloadedFormat?.ChannelCount,
LibationVersion = libraryBook.Book.UserDefinedItem.LastDownloadedVersion?.ToString(3), LibationVersion = libraryBook.Book.UserDefinedItem.LastDownloadedVersion?.ToVersionString(),
FileVersion = libraryBook.Book.UserDefinedItem.LastDownloadedFileVersion FileVersion = libraryBook.Book.UserDefinedItem.LastDownloadedFileVersion
}; };
} }

View File

@ -61,7 +61,7 @@ namespace LibationAvalonia.Dialogs
private void Link_getlibation(object sender, Avalonia.Input.TappedEventArgs e) => Dinah.Core.Go.To.Url(AppScaffolding.LibationScaffolding.WebsiteUrl); private void Link_getlibation(object sender, Avalonia.Input.TappedEventArgs e) => Dinah.Core.Go.To.Url(AppScaffolding.LibationScaffolding.WebsiteUrl);
private void ViewReleaseNotes_Tapped(object sender, Avalonia.Input.TappedEventArgs e) private void ViewReleaseNotes_Tapped(object sender, Avalonia.Input.TappedEventArgs e)
=> Dinah.Core.Go.To.Url($"{AppScaffolding.LibationScaffolding.RepositoryUrl}/releases/tag/v{AppScaffolding.LibationScaffolding.BuildVersion.ToString(3)}"); => Dinah.Core.Go.To.Url($"{AppScaffolding.LibationScaffolding.RepositoryUrl}/releases/tag/v{AppScaffolding.LibationScaffolding.BuildVersion.ToVersionString()}");
} }
public class AboutVM : ViewModelBase public class AboutVM : ViewModelBase

View File

@ -1,6 +1,7 @@
using AppScaffolding; using AppScaffolding;
using Avalonia.Controls; using Avalonia.Controls;
using Dinah.Core; using Dinah.Core;
using LibationFileManager;
using LibationUiBase.Forms; using LibationUiBase.Forms;
namespace LibationAvalonia.Dialogs namespace LibationAvalonia.Dialogs
@ -30,7 +31,7 @@ namespace LibationAvalonia.Dialogs
public UpgradeNotificationDialog(UpgradeProperties upgradeProperties, bool canUpgrade) : this() public UpgradeNotificationDialog(UpgradeProperties upgradeProperties, bool canUpgrade) : this()
{ {
Title = $"Libation version {upgradeProperties.LatestRelease.ToString(3)} is now available."; Title = $"Libation version {upgradeProperties.LatestRelease.ToVersionString()} is now available.";
PackageUrl = upgradeProperties.ZipUrl; PackageUrl = upgradeProperties.ZipUrl;
DownloadLinkText = upgradeProperties.ZipName; DownloadLinkText = upgradeProperties.ZipName;
ReleaseNotes = upgradeProperties.Notes; ReleaseNotes = upgradeProperties.Notes;

View File

@ -1,6 +1,7 @@
using AppScaffolding; using AppScaffolding;
using CommandLine; using CommandLine;
using CommandLine.Text; using CommandLine.Text;
using LibationFileManager;
namespace LibationCli; namespace LibationCli;
@ -20,7 +21,7 @@ internal class HelpVerb
{ {
AutoVersion = false, AutoVersion = false,
AutoHelp = false, AutoHelp = false,
Heading = $"LibationCli v{LibationScaffolding.BuildVersion.ToString(3)}", Heading = $"LibationCli v{LibationScaffolding.BuildVersion.ToVersionString()}",
AdditionalNewLineAfterOption = true, AdditionalNewLineAfterOption = true,
MaximumDisplayWidth = 80 MaximumDisplayWidth = 80
}; };

View File

@ -1,5 +1,6 @@
using AppScaffolding; using AppScaffolding;
using CommandLine; using CommandLine;
using LibationFileManager;
using System; using System;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -14,7 +15,7 @@ internal class VersionOptions : OptionsBase
protected override Task ProcessAsync() protected override Task ProcessAsync()
{ {
const string checkingForUpgrade = "Checking for upgrade..."; const string checkingForUpgrade = "Checking for upgrade...";
Console.WriteLine($"Libation {LibationScaffolding.Variety} v{LibationScaffolding.BuildVersion.ToString(3)}"); Console.WriteLine($"Libation {LibationScaffolding.Variety} v{LibationScaffolding.BuildVersion.ToVersionString()}");
if (CheckForUpgrade) if (CheckForUpgrade)
{ {
@ -34,7 +35,7 @@ internal class VersionOptions : OptionsBase
else else
{ {
Console.ForegroundColor = ConsoleColor.Red; Console.ForegroundColor = ConsoleColor.Red;
ReplaceConsoleText(Console.Out, checkingForUpgrade.Length, $"Upgrade Available: v{upgradeProperties.LatestRelease.ToString(3)}"); ReplaceConsoleText(Console.Out, checkingForUpgrade.Length, $"Upgrade Available: v{upgradeProperties.LatestRelease.ToVersionString()}");
Console.WriteLine(); Console.WriteLine();
Console.WriteLine(); Console.WriteLine();
Console.WriteLine(upgradeProperties.ZipUrl); Console.WriteLine(upgradeProperties.ZipUrl);

View File

@ -16,6 +16,11 @@ namespace LibationFileManager
MacOS = 0x400000, MacOS = 0x400000,
} }
public static class Estensions
{
public static string ToVersionString(this Version version) => version.Revision > 1 ? version.ToString(4) : version.ToString(3);
}
public partial class Configuration public partial class Configuration
{ {
public static bool IsWindows { get; } = OperatingSystem.IsWindows(); public static bool IsWindows { get; } = OperatingSystem.IsWindows();

View File

@ -70,7 +70,7 @@ namespace LibationFileManager.Templates
Narrators = [new("Stephen Fry", null)], Narrators = [new("Stephen Fry", null)],
Series = [new("Sherlock Holmes", 1, "B08376S3R2"), new("Some Other Series", 1, "B000000000")], Series = [new("Sherlock Holmes", 1, "B08376S3R2"), new("Some Other Series", 1, "B000000000")],
Codec = "AAC-LC", Codec = "AAC-LC",
LibationVersion = Configuration.LibationVersion?.ToString(3), LibationVersion = Configuration.LibationVersion?.ToVersionString(),
FileVersion = "36217811", FileVersion = "36217811",
BitRate = 128, BitRate = 128,
SampleRate = 44100, SampleRate = 44100,

View File

@ -1,4 +1,5 @@
using DataLayer; using DataLayer;
using LibationFileManager;
using System; using System;
namespace LibationUiBase.GridView namespace LibationUiBase.GridView
@ -10,7 +11,7 @@ namespace LibationUiBase.GridView
public string LastDownloadedFileVersion { get; } public string LastDownloadedFileVersion { get; }
public Version LastDownloadedVersion { get; } public Version LastDownloadedVersion { get; }
public DateTime? LastDownloaded { get; } public DateTime? LastDownloaded { get; }
public string ToolTipText => IsValid ? $"Double click to open v{LastDownloadedVersion.ToString(3)} release notes" : ""; public string ToolTipText => IsValid ? $"Double click to open v{LastDownloadedVersion.ToVersionString()} release notes" : "";
public LastDownloadStatus() { } public LastDownloadStatus() { }
public LastDownloadStatus(UserDefinedItem udi) public LastDownloadStatus(UserDefinedItem udi)
@ -24,14 +25,14 @@ namespace LibationUiBase.GridView
public void OpenReleaseUrl() public void OpenReleaseUrl()
{ {
if (IsValid) if (IsValid)
Dinah.Core.Go.To.Url($"{AppScaffolding.LibationScaffolding.RepositoryUrl}/releases/tag/v{LastDownloadedVersion.ToString(3)}"); Dinah.Core.Go.To.Url($"{AppScaffolding.LibationScaffolding.RepositoryUrl}/releases/tag/v{LastDownloadedVersion.ToVersionString()}");
} }
public override string ToString() public override string ToString()
=> IsValid ? $""" => IsValid ? $"""
{dateString()} {versionString()} {dateString()} {versionString()}
{LastDownloadedFormat} {LastDownloadedFormat}
Libation v{LastDownloadedVersion.ToString(3)} Libation v{LastDownloadedVersion.ToVersionString()}
""" : ""; """ : "";
private string versionString() => LastDownloadedFileVersion is string ver ? $"(File v.{ver})" : ""; private string versionString() => LastDownloadedFileVersion is string ver ? $"(File v.{ver})" : "";

View File

@ -1,4 +1,5 @@
using LibationUiBase; using LibationFileManager;
using LibationUiBase;
using System; using System;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -38,7 +39,7 @@ namespace LibationWinForms.Dialogs
} }
private void releaseNotesLbl_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) private void releaseNotesLbl_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
=> Dinah.Core.Go.To.Url($"{AppScaffolding.LibationScaffolding.RepositoryUrl}/releases/tag/v{AppScaffolding.LibationScaffolding.BuildVersion.ToString(3)}"); => Dinah.Core.Go.To.Url($"{AppScaffolding.LibationScaffolding.RepositoryUrl}/releases/tag/v{AppScaffolding.LibationScaffolding.BuildVersion.ToVersionString()}");
private async void checkForUpgradeBtn_Click(object sender, EventArgs e) private async void checkForUpgradeBtn_Click(object sender, EventArgs e)
{ {

View File

@ -18,7 +18,7 @@ namespace LibationWinForms.Dialogs
public UpgradeNotificationDialog(UpgradeProperties upgradeProperties) : this() public UpgradeNotificationDialog(UpgradeProperties upgradeProperties) : this()
{ {
Text = $"Libation version {upgradeProperties.LatestRelease.ToString(3)} is now available."; Text = $"Libation version {upgradeProperties.LatestRelease.ToVersionString()} is now available.";
PackageUrl = upgradeProperties.ZipUrl; PackageUrl = upgradeProperties.ZipUrl;
packageDlLink.Text = upgradeProperties.ZipName; packageDlLink.Text = upgradeProperties.ZipName;
releaseNotesTbox.Text = upgradeProperties.Notes; releaseNotesTbox.Text = upgradeProperties.Notes;