Skip to content

Commit 72fb718

Browse files
committed
Added version suffix support
1 parent 8c16516 commit 72fb718

File tree

3 files changed

+61
-4
lines changed

3 files changed

+61
-4
lines changed

GoAwayEdge/UserInterface/ControlPanel/Pages/About.xaml.cs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,29 @@ public About()
1414
{
1515
InitializeComponent();
1616

17+
string versionText;
1718
var assembly = Assembly.GetExecutingAssembly();
19+
var version = Assembly.GetExecutingAssembly().GetName().Version!;
20+
try
21+
{
22+
var informationVersion = assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion;
23+
if (!string.IsNullOrEmpty(informationVersion) && version.ToString() != informationVersion)
24+
{
25+
versionText = $"{version}-{informationVersion}";
26+
}
27+
else
28+
{
29+
versionText = $"{version}";
30+
}
31+
}
32+
catch
33+
{
34+
versionText = $"{version}";
35+
}
1836
var appDirectory = AppContext.BaseDirectory;
1937
var assemblyPath = Path.Combine(appDirectory, $"{assembly.GetName().Name}.exe");
2038
var fvi = FileVersionInfo.GetVersionInfo(assemblyPath);
21-
ValueVersion.Content = $"{fvi.ProductName} v{fvi.FileVersion}";
39+
ValueVersion.Content = $"{fvi.ProductName} v{versionText}";
2240
ValueCopyright.Content = fvi.LegalCopyright;
2341
}
2442

GoAwayEdge/UserInterface/MessageUI.xaml.cs

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,27 @@ public MessageUi(string title, string message, string? btn1 = null, string? btn2
3333
this.Btn2.Visibility = Visibility.Collapsed;
3434
if (btn3 is null or "")
3535
this.Btn3.Visibility = Visibility.Collapsed;
36-
37-
VersionLbl.Content = $"Version {Assembly.GetExecutingAssembly().GetName().Version!}";
36+
37+
string versionText;
38+
var assembly = Assembly.GetExecutingAssembly();
39+
var version = Assembly.GetExecutingAssembly().GetName().Version!;
40+
try
41+
{
42+
var informationVersion = assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion;
43+
if (!string.IsNullOrEmpty(informationVersion) && version.ToString() != informationVersion)
44+
{
45+
versionText = $"Version {version}-{informationVersion}";
46+
}
47+
else
48+
{
49+
versionText = $"Version {version}";
50+
}
51+
}
52+
catch
53+
{
54+
versionText = $"Version {version}";
55+
}
56+
VersionLbl.Content = versionText;
3857

3958
_mainThread = isMainThread;
4059
}

GoAwayEdge/UserInterface/Setup/Installer.xaml.cs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,27 @@ public Installer()
1919
{
2020
InitializeComponent();
2121

22-
VersionLbl.Content = $"Version {Assembly.GetExecutingAssembly().GetName().Version!}";
22+
string versionText;
23+
var assembly = Assembly.GetExecutingAssembly();
24+
var version = Assembly.GetExecutingAssembly().GetName().Version!;
25+
try
26+
{
27+
var informationVersion = assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion;
28+
if (!string.IsNullOrEmpty(informationVersion) && version.ToString() != informationVersion)
29+
{
30+
versionText = $"Version {version}-{informationVersion}";
31+
}
32+
else
33+
{
34+
versionText = $"Version {version}";
35+
}
36+
}
37+
catch
38+
{
39+
versionText = $"Version {version}";
40+
}
41+
42+
VersionLbl.Content = versionText;
2343
Configuration.InitialEnvironment();
2444

2545
_welcomePage = new Welcome();

0 commit comments

Comments
 (0)