mirror of
https://github.com/Ottermandias/Glamourer.git
synced 2025-12-12 18:27:24 +01:00
add api version
This commit is contained in:
parent
0057e5b6a9
commit
e8639505a1
1 changed files with 15 additions and 0 deletions
|
|
@ -10,6 +10,7 @@ namespace Glamourer.Api
|
|||
{
|
||||
public class GlamourerIpc : IDisposable
|
||||
{
|
||||
public const string LabelProviderApiVersion = "Glamourer.ApiVersion";
|
||||
public const string LabelProviderGetCharacterCustomization = "Glamourer.GetCharacterCustomization";
|
||||
public const string LabelProviderApplyCharacterCustomization = "Glamourer.ApplyCharacterCustomization";
|
||||
private readonly ClientState clientState;
|
||||
|
|
@ -18,6 +19,7 @@ namespace Glamourer.Api
|
|||
|
||||
internal ICallGateProvider<string>? ProviderGetCharacterCustomization;
|
||||
internal ICallGateProvider<string, string, object>? ProviderApplyCharacterCustomization;
|
||||
internal ICallGateProvider<int>? ProviderGetApiVersion;
|
||||
|
||||
public GlamourerIpc(ClientState clientState, ObjectTable objectTable, DalamudPluginInterface pluginInterface)
|
||||
{
|
||||
|
|
@ -37,10 +39,21 @@ namespace Glamourer.Api
|
|||
{
|
||||
ProviderApplyCharacterCustomization?.UnregisterFunc();
|
||||
ProviderGetCharacterCustomization?.UnregisterAction();
|
||||
ProviderGetApiVersion?.UnregisterFunc();
|
||||
}
|
||||
|
||||
private void InitializeProviders()
|
||||
{
|
||||
try
|
||||
{
|
||||
ProviderGetApiVersion = pluginInterface.GetIpcProvider<int>(LabelProviderApiVersion);
|
||||
ProviderGetApiVersion.RegisterFunc(GetApiVersion);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
PluginLog.Error(ex, $"Error registering IPC provider for {LabelProviderApiVersion}.");
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
ProviderGetCharacterCustomization = pluginInterface.GetIpcProvider<string>(LabelProviderGetCharacterCustomization);
|
||||
|
|
@ -62,6 +75,8 @@ namespace Glamourer.Api
|
|||
}
|
||||
}
|
||||
|
||||
private int GetApiVersion() => 0;
|
||||
|
||||
private void ApplyCharacterCustomization(string customization, string characterName)
|
||||
{
|
||||
var save = CharacterSave.FromString(customization);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue