Skip to content

Commit de3e3cb

Browse files
NeWbY100claude
andcommitted
feat: show version and git hash in status bar
- Embed short git commit hash via SourceRevisionId MSBuild target - Add AppVersion property to MainWindowViewModel reading from assembly - Display "ReScene.NET v1.0.1 (hash)" as clickable link in status bar - Bump version to 1.0.1 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent fd6a71b commit de3e3cb

3 files changed

Lines changed: 26 additions & 3 deletions

File tree

ReScene.NET/ReScene.NET.csproj

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<PropertyGroup>
44
<OutputType>WinExe</OutputType>
55
<TargetFramework>net10.0-windows</TargetFramework>
6-
<Version>1.0.0</Version>
6+
<Version>1.0.1</Version>
77
<ImplicitUsings>enable</ImplicitUsings>
88
<Nullable>enable</Nullable>
99
<UseWPF>true</UseWPF>
@@ -12,6 +12,12 @@
1212
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
1313
</PropertyGroup>
1414

15+
<Target Name="SetSourceRevisionId" BeforeTargets="InitializeSourceControlInformation">
16+
<Exec Command="git rev-parse --short HEAD" ConsoleToMsBuild="true" IgnoreExitCode="true">
17+
<Output TaskParameter="ConsoleOutput" PropertyName="SourceRevisionId" />
18+
</Exec>
19+
</Target>
20+
1521
<ItemGroup>
1622
<Using Include="System.IO" />
1723
</ItemGroup>

ReScene.NET/ViewModels/MainWindowViewModel.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using System.Reflection;
12
using CommunityToolkit.Mvvm.ComponentModel;
23
using CommunityToolkit.Mvvm.Input;
34
using ReScene.NET.Services;
@@ -30,6 +31,21 @@ public partial class MainWindowViewModel : ViewModelBase
3031
[ObservableProperty]
3132
private bool _isBusy;
3233

34+
public string AppVersion { get; } = GetAppVersion();
35+
36+
private static string GetAppVersion()
37+
{
38+
string? version = Assembly.GetEntryAssembly()?
39+
.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion;
40+
41+
if (version is null)
42+
return "0.0.0";
43+
44+
// InformationalVersion is "1.0.0+abcdef1" — extract hash after '+'
45+
int plus = version.IndexOf('+');
46+
return plus >= 0 ? version[..plus] + " (" + version[(plus + 1)..] + ")" : version;
47+
}
48+
3349
public MainWindowViewModel()
3450
: this(new SrrCreationService(), new SrsCreationService(), new SrsReconstructionService(), new SampleRestorerService(), new BruteForceService(), new FileCompareService(), new FileDialogService(), new RecentFilesService())
3551
{

ReScene.NET/Views/MainWindow.xaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,13 @@
6161
Foreground="{DynamicResource SystemControlForegroundBaseMediumBrush}" />
6262
<TextBlock Grid.Column="1"
6363
FontSize="{DynamicResource FontSizeCaption}"
64-
VerticalAlignment="Center">
64+
VerticalAlignment="Center"
65+
Foreground="{DynamicResource SystemControlForegroundBaseMediumLowBrush}">
6566
<Hyperlink NavigateUri="https://github.com/NeWbY100/ReScene.NET"
6667
RequestNavigate="OnHyperlinkRequestNavigate"
6768
Foreground="{DynamicResource SystemControlForegroundBaseMediumLowBrush}"
6869
TextDecorations="None">
69-
ReScene.NET
70+
<Run Text="ReScene.NET v" /><Run Text="{Binding AppVersion, Mode=OneTime}" />
7071
</Hyperlink>
7172
</TextBlock>
7273
</Grid>

0 commit comments

Comments
 (0)