Skip to content

Commit

Permalink
Added version suffix support
Browse files Browse the repository at this point in the history
  • Loading branch information
valnoxy committed Aug 13, 2024
1 parent 8c16516 commit 72fb718
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 4 deletions.
20 changes: 19 additions & 1 deletion GoAwayEdge/UserInterface/ControlPanel/Pages/About.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,29 @@ public About()
{
InitializeComponent();

string versionText;
var assembly = Assembly.GetExecutingAssembly();
var version = Assembly.GetExecutingAssembly().GetName().Version!;
try
{
var informationVersion = assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion;
if (!string.IsNullOrEmpty(informationVersion) && version.ToString() != informationVersion)
{
versionText = $"{version}-{informationVersion}";
}
else
{
versionText = $"{version}";
}
}
catch
{
versionText = $"{version}";
}
var appDirectory = AppContext.BaseDirectory;
var assemblyPath = Path.Combine(appDirectory, $"{assembly.GetName().Name}.exe");
var fvi = FileVersionInfo.GetVersionInfo(assemblyPath);
ValueVersion.Content = $"{fvi.ProductName} v{fvi.FileVersion}";
ValueVersion.Content = $"{fvi.ProductName} v{versionText}";
ValueCopyright.Content = fvi.LegalCopyright;
}

Expand Down
23 changes: 21 additions & 2 deletions GoAwayEdge/UserInterface/MessageUI.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,27 @@ public MessageUi(string title, string message, string? btn1 = null, string? btn2
this.Btn2.Visibility = Visibility.Collapsed;
if (btn3 is null or "")
this.Btn3.Visibility = Visibility.Collapsed;

VersionLbl.Content = $"Version {Assembly.GetExecutingAssembly().GetName().Version!}";

string versionText;
var assembly = Assembly.GetExecutingAssembly();
var version = Assembly.GetExecutingAssembly().GetName().Version!;
try
{
var informationVersion = assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion;
if (!string.IsNullOrEmpty(informationVersion) && version.ToString() != informationVersion)
{
versionText = $"Version {version}-{informationVersion}";
}
else
{
versionText = $"Version {version}";
}
}
catch
{
versionText = $"Version {version}";
}
VersionLbl.Content = versionText;

_mainThread = isMainThread;
}
Expand Down
22 changes: 21 additions & 1 deletion GoAwayEdge/UserInterface/Setup/Installer.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,27 @@ public Installer()
{
InitializeComponent();

VersionLbl.Content = $"Version {Assembly.GetExecutingAssembly().GetName().Version!}";
string versionText;
var assembly = Assembly.GetExecutingAssembly();
var version = Assembly.GetExecutingAssembly().GetName().Version!;
try
{
var informationVersion = assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion;
if (!string.IsNullOrEmpty(informationVersion) && version.ToString() != informationVersion)
{
versionText = $"Version {version}-{informationVersion}";
}
else
{
versionText = $"Version {version}";
}
}
catch
{
versionText = $"Version {version}";
}

VersionLbl.Content = versionText;
Configuration.InitialEnvironment();

_welcomePage = new Welcome();
Expand Down

0 comments on commit 72fb718

Please sign in to comment.