mirror of
https://github.com/spectreconsole/spectre.console.git
synced 2025-10-25 15:19:23 +00:00
35 lines
748 B
C#
35 lines
748 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Diagnostics;
|
|
using System.Reflection;
|
|
using System.Text;
|
|
|
|
namespace Docs.Utilities
|
|
{
|
|
public static class VersionUtilities
|
|
{
|
|
public static string GetVersion()
|
|
{
|
|
return GetVersion(typeof(VersionUtilities).Assembly);
|
|
}
|
|
|
|
private static string GetVersion(Assembly assembly)
|
|
{
|
|
if (assembly == null)
|
|
{
|
|
return "?";
|
|
}
|
|
|
|
try
|
|
{
|
|
var info = FileVersionInfo.GetVersionInfo(assembly.Location);
|
|
return info.ProductVersion ?? "?";
|
|
}
|
|
catch
|
|
{
|
|
return "?";
|
|
}
|
|
}
|
|
}
|
|
}
|