2023-02-08 23:53:42 +00:00
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Reflection;
|
|
|
|
|
|
|
|
|
|
namespace SharpChat {
|
2024-05-19 02:17:51 +00:00
|
|
|
|
public static class BuildInfo {
|
2023-02-08 23:53:42 +00:00
|
|
|
|
private const string NAME = @"SharpChat";
|
|
|
|
|
private const string UNKNOWN = @"XXXXXXX";
|
|
|
|
|
|
|
|
|
|
public static string VersionString { get; }
|
|
|
|
|
public static string VersionStringShort { get; }
|
|
|
|
|
public static bool IsDebugBuild { get; }
|
|
|
|
|
|
|
|
|
|
public static string ProgramName { get; }
|
|
|
|
|
|
2024-05-19 02:17:51 +00:00
|
|
|
|
static BuildInfo() {
|
2023-02-08 23:53:42 +00:00
|
|
|
|
#if DEBUG
|
|
|
|
|
IsDebugBuild = true;
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
try {
|
2024-05-10 19:18:55 +00:00
|
|
|
|
using Stream? s = Assembly.GetExecutingAssembly().GetManifestResourceStream(@"SharpChat.version.txt");
|
|
|
|
|
if(s != null) {
|
|
|
|
|
using StreamReader sr = new(s);
|
|
|
|
|
VersionString = sr.ReadLine()?.Trim() ?? string.Empty;
|
|
|
|
|
} else
|
|
|
|
|
VersionString = string.Empty;
|
2023-02-08 23:53:42 +00:00
|
|
|
|
VersionStringShort = VersionString.Length > 10 ? VersionString[..10] : VersionString;
|
|
|
|
|
} catch {
|
|
|
|
|
VersionStringShort = VersionString = UNKNOWN;
|
|
|
|
|
}
|
|
|
|
|
|
2024-05-10 19:18:55 +00:00
|
|
|
|
ProgramName = string.Format(@"{0}/{1}", NAME, VersionStringShort);
|
2023-02-08 23:53:42 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|