-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
-automate name/ver/builddate to console
- Loading branch information
Lewis Kirkaldie
committed
Aug 24, 2022
1 parent
90e91f9
commit e997b97
Showing
2 changed files
with
60 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
using System; | ||
using System.Diagnostics; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Reflection; | ||
using static System.Char; | ||
|
||
namespace StreamGoo.Helpers; | ||
|
||
public static class Product | ||
{ | ||
private static string _tracingName; | ||
|
||
#region Constructors | ||
|
||
static Product() | ||
{ | ||
var assembly = Assembly.GetExecutingAssembly(); | ||
|
||
var appFile = Path.Combine(AppContext.BaseDirectory, "streamgoo"); | ||
|
||
if (File.Exists(appFile)) | ||
{ | ||
var versionInfo = FileVersionInfo.GetVersionInfo(appFile); | ||
|
||
Version = versionInfo.FileVersion; | ||
BuildTime = File.GetCreationTime(appFile); | ||
} | ||
else if (File.Exists($"{appFile}.exe")) | ||
{ | ||
var versionInfo = FileVersionInfo.GetVersionInfo($"{appFile}.exe"); | ||
|
||
Version = versionInfo.FileVersion; | ||
BuildTime = File.GetCreationTime(appFile); | ||
} | ||
|
||
Name = "StreamGoo"; | ||
} | ||
|
||
#endregion | ||
|
||
#region Static members | ||
|
||
public static string Name { get; } | ||
|
||
public static string TracingName | ||
{ | ||
get | ||
{ | ||
return _tracingName ??= string.Concat(Name.Where(c => !IsWhiteSpace(c))).ToLowerInvariant(); | ||
} | ||
} | ||
public static string Version { get; } = "0.0"; | ||
public static DateTime BuildTime { get; } = DateTime.MinValue; | ||
|
||
#endregion | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters