2023-02-08 23:53:42 +00:00
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Reflection;
|
|
|
|
|
|
|
|
|
|
namespace SharpChat {
|
|
|
|
|
public static class SharpInfo {
|
|
|
|
|
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; }
|
|
|
|
|
|
|
|
|
|
static SharpInfo() {
|
|
|
|
|
#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
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|