mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-04 13:06:50 +00:00
26 lines
No EOL
825 B
C#
26 lines
No EOL
825 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[2] == "";
|
|
|
|
// show only short commit hash to users
|
|
Version = FullVersion.Remove(7);
|
|
}
|
|
} |