mirror of
https://github.com/MaSzyna-EU07/StarterNG.git
synced 2026-07-17 17:09:19 +02:00
Version binding
This commit is contained in:
23
StarterNG/AppInfo.cs
Normal file
23
StarterNG/AppInfo.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using System.Reflection;
|
||||
|
||||
namespace StarterNG;
|
||||
|
||||
/// <summary>Static, display-ready information about the running launcher build.</summary>
|
||||
public static class AppInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// The launcher's assembly version (e.g. "1.2.3.4"), with a " (DEBUG)" suffix
|
||||
/// appended for Debug builds so debug and release binaries are easy to tell
|
||||
/// apart. Computed once; safe to bind with {x:Static}.
|
||||
/// </summary>
|
||||
public static string Version { get; } = BuildVersion();
|
||||
|
||||
private static string BuildVersion()
|
||||
{
|
||||
string text = Assembly.GetExecutingAssembly().GetName().Version?.ToString() ?? "0.0.0.0";
|
||||
#if DEBUG
|
||||
text += " (DEBUG)";
|
||||
#endif
|
||||
return text;
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,7 @@
|
||||
ToolTip.Tip="{Binding [ShowLatestLogTooltip], Source={x:Static starterNg:App.Loc}}">
|
||||
<materialIcons:MaterialIcon Kind="FileDocument"/>
|
||||
</Button>
|
||||
<Label VerticalAlignment="Center" Content="{x:Static starterNg:AppInfo.Version}"/>
|
||||
</sukiUi:SukiWindow.RightWindowTitleBarControls>
|
||||
<sukiUi:SukiSideMenu IsMenuExpanded="False">
|
||||
<sukiUi:SukiSideMenu.Items>
|
||||
|
||||
@@ -14,6 +14,9 @@ public partial class MainWindow : SukiWindow
|
||||
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void linkClick(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
if (sender is not Button btn)
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
|
||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||
<AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault>
|
||||
<AssemblyVersion>1.0.0.0</AssemblyVersion>
|
||||
<FileVersion>1.0.0.0</FileVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
|
||||
Reference in New Issue
Block a user