PluralKit/PluralKit.Core/Services/BuildInfoService.cs
2025-01-05 04:54:40 +00:00

26 lines
No EOL
844 B
C#

namespace PluralKit.Core;
public static class BuildInfoService
{
public static string Version { get; private set; }
public static string FullVersion { get; private set; }
public static string Timestamp { get; private set; }
public static bool IsDev { get; private set; }
public static async Task LoadVersion()
{
using var stream = typeof(BuildInfoService).Assembly.GetManifestResourceStream("version");
if (stream == null) throw new Exception("missing version information");
using var reader = new StreamReader(stream);
var data = (await reader.ReadToEndAsync()).Split("\n");
FullVersion = data[0];
Timestamp = data[1];
IsDev = data.Length < 3 || data[2] == "";
// show only short commit hash to users
Version = FullVersion.Remove(7);
}
}