show current version and hash in new ui footer
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
namespace Il2CppInspector.Redux.GUI;
|
||||
using System.Reflection;
|
||||
|
||||
public static class DictionaryExtensions
|
||||
namespace Il2CppInspector.Redux.GUI;
|
||||
|
||||
public static class Extensions
|
||||
{
|
||||
public static bool GetAsBooleanOrDefault(this Dictionary<string, string> dict, string key, bool defaultValue)
|
||||
{
|
||||
@@ -18,4 +20,7 @@ public static class DictionaryExtensions
|
||||
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
public static string? GetAssemblyVersion(this Assembly assembly)
|
||||
=> assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion;
|
||||
}
|
||||
@@ -4,21 +4,23 @@ namespace Il2CppInspector.Redux.GUI;
|
||||
|
||||
internal class Il2CppHub : Hub
|
||||
{
|
||||
public UiContext State
|
||||
private const string ContextKey = "context";
|
||||
|
||||
private UiContext State
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!Context.Items.TryGetValue("context", out var context)
|
||||
if (!Context.Items.TryGetValue(ContextKey, out var context)
|
||||
|| context is not UiContext ctx)
|
||||
{
|
||||
Context.Items["context"] = ctx = new UiContext();
|
||||
Context.Items[ContextKey] = ctx = new UiContext();
|
||||
}
|
||||
|
||||
return ctx;
|
||||
}
|
||||
}
|
||||
|
||||
public UiClient Client => new(Clients.Caller);
|
||||
private UiClient Client => new(Clients.Caller);
|
||||
|
||||
public async Task OnUiLaunched()
|
||||
{
|
||||
|
||||
@@ -41,4 +41,7 @@ public class UiClient(ISingleClientProxy client)
|
||||
|
||||
public async Task OnImportCompleted(CancellationToken cancellationToken = default)
|
||||
=> await client.SendAsync(nameof(OnImportCompleted), cancellationToken);
|
||||
|
||||
public async Task SetInspectorVersion(string version, CancellationToken cancellationToken = default)
|
||||
=> await client.SendAsync(nameof(SetInspectorVersion), version, cancellationToken);
|
||||
}
|
||||
@@ -122,6 +122,7 @@ public class UiContext
|
||||
public async Task Initialize(UiClient client, CancellationToken cancellationToken = default)
|
||||
{
|
||||
await client.ShowSuccessToast("SignalR initialized!", cancellationToken);
|
||||
await client.SetInspectorVersion(typeof(UiContext).Assembly.GetAssemblyVersion() ?? "<unknown>", cancellationToken);
|
||||
}
|
||||
|
||||
public async Task LoadInputFiles(UiClient client, List<string> inputFiles,
|
||||
|
||||
Reference in New Issue
Block a user