using System.Reflection; namespace FCPModUpdater; public static class AppVersion { private static readonly Lazy InformationalVersionLazy = new(() => { var attr = typeof(AppVersion).Assembly .GetCustomAttribute(); return attr?.InformationalVersion ?? "0.0.0-unknown"; }); /// /// Full version string, e.g. "0.1.1" or "0.1.1-dev.4+g2d7e0c6". /// public static string InformationalVersion => InformationalVersionLazy.Value; /// /// Semantic version without +metadata suffix, for comparison. /// public static string SemanticVersion { get { var ver = InformationalVersion; var plusIndex = ver.IndexOf('+'); return plusIndex >= 0 ? ver[..plusIndex] : ver; } } /// /// True if this is a dev/pre-release build. /// public static bool IsDevBuild => SemanticVersion.Contains('-'); }