mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-22 08:29:18 +01:00
feat: add git commit count to assembly info/show in dev bar
This commit is contained in:
parent
d7c6172817
commit
c8a7c69ee0
3 changed files with 39 additions and 3 deletions
|
|
@ -28,6 +28,7 @@ namespace Dalamud.Utility;
|
|||
public static class Util
|
||||
{
|
||||
private static string? gitHashInternal;
|
||||
private static int? gitCommitCountInternal;
|
||||
private static string? gitHashClientStructsInternal;
|
||||
|
||||
private static ulong moduleStartAddr;
|
||||
|
|
@ -114,6 +115,26 @@ public static class Util
|
|||
return gitHashInternal;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the amount of commits in the current branch, or null if undetermined.
|
||||
/// </summary>
|
||||
/// <returns>The amount of commits in the current branch.</returns>
|
||||
public static int? GetGitCommitCount()
|
||||
{
|
||||
if (gitCommitCountInternal != null)
|
||||
return gitCommitCountInternal.Value;
|
||||
|
||||
var asm = typeof(Util).Assembly;
|
||||
var attrs = asm.GetCustomAttributes<AssemblyMetadataAttribute>();
|
||||
|
||||
var value = attrs.First(a => a.Key == "GitCommitCount").Value;
|
||||
if (value == null)
|
||||
return null;
|
||||
|
||||
gitCommitCountInternal = int.Parse(value);
|
||||
return gitCommitCountInternal.Value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the git hash value from the assembly
|
||||
/// or null if it cannot be found.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue