mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-08-02 10:15:58 +08:00
Show documentation version in footer
This commit is contained in:
@ -1,8 +1,7 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Docs.Models;
|
||||
using NJsonSchema;
|
||||
using Statiq.Common;
|
||||
using Statiq.Core;
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NJsonSchema;
|
||||
using Statiq.Common;
|
||||
using System.Xml.Linq;
|
||||
using Docs.Pipelines;
|
||||
|
34
docs/src/Utilities/VersionUtilities.cs
Normal file
34
docs/src/Utilities/VersionUtilities.cs
Normal file
@ -0,0 +1,34 @@
|
||||
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 "?";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user