Skip to content

Commit 874a467

Browse files
committed
Release details in the about section converted into dynamic elements. Details will now reflect versioning at time of compile.
1 parent b4f9558 commit 874a467

2 files changed

Lines changed: 51 additions & 1 deletion

File tree

Pages/AboutSimTools.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
<GradientStop Color="Black"/>
6060
<GradientStop Color="Black" Offset="1"/>
6161
</LinearGradientBrush>
62-
</TextBlock.Foreground><Run Text="Version: 4.0.1, Build 3868"/><LineBreak/><Run Text="Released: ??/??/2025"/><LineBreak/><Run Text="Website: http://www.ts3tools.com"/><LineBreak/><Run Text="© 2025, Archeon Industries, LLC."/><LineBreak/><Run/></TextBlock>
62+
</TextBlock.Foreground><Run/><LineBreak/><Run/><LineBreak/><Run/><LineBreak/><Run/></TextBlock>
6363
<TextBlock x:Name="Text6" HorizontalAlignment="Left" Margin="32,432,0,0" TextWrapping="Wrap" Text="For Faith, who inspired me to finally finish this program." VerticalAlignment="Top" Width="169" Height="33" FontFamily="Tahoma" FontWeight="Bold" FontSize="11" FontStyle="Italic">
6464
<TextBlock.Foreground>
6565
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">

Pages/AboutSimTools.xaml.cs

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,60 @@ public partial class AboutSimTools : Window
1919
public AboutSimTools()
2020
{
2121
InitializeComponent();
22+
PopulateVersionInfo();
2223
Loaded += (_, _) => StartSlideshow();
2324
Closing += (_, _) => _slideTimer?.Stop();
2425
}
2526

27+
// ── Version info ──────────────────────────────────────────────────────────────
28+
//
29+
// • Version + Build — read from AssemblyName.Version (Major.Minor.Build, Build Revision)
30+
// • Git hash — read from AssemblyInformationalVersion ("x.y.z+<hash>")
31+
// • Compile date — last-write time of the executing assembly on disk
32+
//
33+
private void PopulateVersionInfo()
34+
{
35+
var asm = Assembly.GetExecutingAssembly();
36+
37+
// Version: Major.Minor.Patch, Build <number>
38+
// ver.Major = Major (4)
39+
// ver.Minor = Minor (0)
40+
// ver.Build = Patch (1) ← .NET names this "Build"
41+
// ver.Revision = Build (3868) ← .NET names this "Revision"
42+
var ver = asm.GetName().Version ?? new Version(4, 0, 1, 0);
43+
string versionBase = $"{ver.Major}.{ver.Minor}.{ver.Build}";
44+
string buildPart = ver.Revision > 0 ? $", Build {ver.Revision}" : "";
45+
46+
// Short git hash from AssemblyInformationalVersion ("4.0.1.3868+abc1234...")
47+
string commitSuffix = "";
48+
string infoVer = asm.GetCustomAttribute<AssemblyInformationalVersionAttribute>()
49+
?.InformationalVersion ?? "";
50+
int plusIdx = infoVer.IndexOf('+');
51+
if (plusIdx >= 0 && plusIdx < infoVer.Length - 1)
52+
{
53+
string hash = infoVer[(plusIdx + 1)..];
54+
if (hash.Length > 7) hash = hash[..7];
55+
commitSuffix = $" ({hash})";
56+
}
57+
58+
// Compile date = last-write time of the assembly file
59+
string asmPath = asm.Location;
60+
DateTime built = File.Exists(asmPath) ? File.GetLastWriteTime(asmPath) : DateTime.Now;
61+
string builtStr = built.ToString("MM/dd/yyyy, h:mm tt");
62+
63+
// Rebuild Text5 Inlines — x:Name on <Run> does not generate code-behind fields
64+
Text5.Inlines.Clear();
65+
Text5.Inlines.Add(new System.Windows.Documents.Run($"Version: {versionBase}{buildPart}{commitSuffix}"));
66+
Text5.Inlines.Add(new System.Windows.Documents.LineBreak());
67+
Text5.Inlines.Add(new System.Windows.Documents.Run($"Released: {builtStr}"));
68+
Text5.Inlines.Add(new System.Windows.Documents.LineBreak());
69+
Text5.Inlines.Add(new System.Windows.Documents.Run("Website: http://www.simtools-app.com"));
70+
Text5.Inlines.Add(new System.Windows.Documents.LineBreak());
71+
int currentYear = DateTime.Now.Year;
72+
string copyrightYear = currentYear > 2025 ? $"2025\u2013{currentYear}" : "2025";
73+
Text5.Inlines.Add(new System.Windows.Documents.Run($"\u00a9 {copyrightYear}, Archeon Industries, LLC."));
74+
}
75+
2676
// ── Changelog button ──────────────────────────────────────────────────────
2777

2878
private void ChangelogButton_Click(object sender, RoutedEventArgs e)

0 commit comments

Comments
 (0)