From 6a977fb59eaba1376fc2ce5e452be412b2966683 Mon Sep 17 00:00:00 2001
From: goaaats <16760685+goaaats@users.noreply.github.com>
Date: Sun, 5 Dec 2021 02:08:43 +0100
Subject: [PATCH] feat: show client structs hash in Game submenu
---
Dalamud/Dalamud.csproj | 10 ++++++++
.../Game/Network/Structures/MarketTaxRates.cs | 2 +-
.../Interface/Internal/DalamudInterface.cs | 1 +
Dalamud/Utility/Util.cs | 23 +++++++++++++++++--
4 files changed, 33 insertions(+), 3 deletions(-)
diff --git a/Dalamud/Dalamud.csproj b/Dalamud/Dalamud.csproj
index ee8abed6c..64b9ca4b7 100644
--- a/Dalamud/Dalamud.csproj
+++ b/Dalamud/Dalamud.csproj
@@ -105,16 +105,22 @@
$(IntermediateOutputPath)gitver
+ $(IntermediateOutputPath)csver
+
+
+
+
@(GitVersion)
+ @(GitVersionClientStructs)
@@ -132,6 +138,10 @@
<_Parameter1>GitHash
<_Parameter2>$(BuildHash)
+
+ <_Parameter1>GitHashClientStructs
+ <_Parameter2>$(BuildHashClientStructs)
+
diff --git a/Dalamud/Game/Network/Structures/MarketTaxRates.cs b/Dalamud/Game/Network/Structures/MarketTaxRates.cs
index bdca8fe7d..0cb21e5d8 100644
--- a/Dalamud/Game/Network/Structures/MarketTaxRates.cs
+++ b/Dalamud/Game/Network/Structures/MarketTaxRates.cs
@@ -14,7 +14,7 @@ namespace Dalamud.Game.Network.Structures
}
///
- /// Category of this ResultDialog packet.
+ /// Gets the category of this ResultDialog packet.
///
public uint Category { get; private set; }
diff --git a/Dalamud/Interface/Internal/DalamudInterface.cs b/Dalamud/Interface/Internal/DalamudInterface.cs
index 5663de879..4c51d108f 100644
--- a/Dalamud/Interface/Internal/DalamudInterface.cs
+++ b/Dalamud/Interface/Internal/DalamudInterface.cs
@@ -507,6 +507,7 @@ namespace Dalamud.Interface.Internal
var startInfo = Service.Get();
ImGui.MenuItem(Util.AssemblyVersion, false);
ImGui.MenuItem(startInfo.GameVersion.ToString(), false);
+ ImGui.MenuItem($"CS: {Util.GetGitHashClientStructs()}", false);
ImGui.EndMenu();
}
diff --git a/Dalamud/Utility/Util.cs b/Dalamud/Utility/Util.cs
index 8a39b7aea..658ebb79c 100644
--- a/Dalamud/Utility/Util.cs
+++ b/Dalamud/Utility/Util.cs
@@ -22,7 +22,8 @@ namespace Dalamud.Utility
///
public static class Util
{
- private static string gitHashInternal;
+ private static string? gitHashInternal;
+ private static string? gitHashClientStructsInternal;
///
/// Gets an httpclient for usage.
@@ -48,11 +49,29 @@ namespace Dalamud.Utility
var asm = typeof(Util).Assembly;
var attrs = asm.GetCustomAttributes();
- gitHashInternal = attrs.FirstOrDefault(a => a.Key == "GitHash")?.Value;
+ gitHashInternal = attrs.First(a => a.Key == "GitHash").Value;
return gitHashInternal;
}
+ ///
+ /// Gets the git hash value from the assembly
+ /// or null if it cannot be found.
+ ///
+ /// The git hash of the assembly.
+ public static string GetGitHashClientStructs()
+ {
+ if (gitHashClientStructsInternal != null)
+ return gitHashClientStructsInternal;
+
+ var asm = typeof(Util).Assembly;
+ var attrs = asm.GetCustomAttributes();
+
+ gitHashClientStructsInternal = attrs.First(a => a.Key == "GitHashClientStructs").Value;
+
+ return gitHashClientStructsInternal;
+ }
+
///
/// Read memory from an offset and hexdump them via Serilog.
///