From 3c0cdc3d0a9ac3048bcb129dd67346c91af438a7 Mon Sep 17 00:00:00 2001 From: Ottermandias Date: Sat, 29 Oct 2022 16:02:18 +0200 Subject: [PATCH] Oops. --- tmp/.editorconfig | 85 ---- tmp/.gitignore | 3 - tmp/Delegates.cs | 16 - tmp/Enums/ChangedItemType.cs | 9 - tmp/Enums/GroupType.cs | 7 - tmp/Enums/ModSettingChange.cs | 12 - tmp/Enums/MouseButton.cs | 9 - tmp/Enums/PenumbraApiEc.cs | 20 - tmp/Enums/RedrawType.cs | 7 - tmp/Helpers/ActionProvider.cs | 66 --- tmp/Helpers/ActionSubscriber.cs | 54 --- tmp/Helpers/EventProvider.cs | 376 ----------------- tmp/Helpers/EventSubscriber.cs | 607 ---------------------------- tmp/Helpers/FuncProvider.cs | 186 --------- tmp/Helpers/FuncSubscriber.cs | 163 -------- tmp/IPenumbraApi.cs | 250 ------------ tmp/IPenumbraApiBase.cs | 11 - tmp/Ipc/Collection.cs | 76 ---- tmp/Ipc/Configuration.cs | 42 -- tmp/Ipc/GameState.cs | 63 --- tmp/Ipc/Meta.cs | 30 -- tmp/Ipc/ModSettings.cs | 116 ------ tmp/Ipc/Mods.cs | 81 ---- tmp/Ipc/PluginState.cs | 68 ---- tmp/Ipc/Redraw.cs | 65 --- tmp/Ipc/Resolve.cs | 74 ---- tmp/Ipc/Temporary.cs | 83 ---- tmp/Ipc/Ui.cs | 55 --- tmp/Penumbra.Api.csproj | 47 --- tmp/Penumbra.Api.csproj.DotSettings | 2 - tmp/README.md | 4 - 31 files changed, 2687 deletions(-) delete mode 100644 tmp/.editorconfig delete mode 100644 tmp/.gitignore delete mode 100644 tmp/Delegates.cs delete mode 100644 tmp/Enums/ChangedItemType.cs delete mode 100644 tmp/Enums/GroupType.cs delete mode 100644 tmp/Enums/ModSettingChange.cs delete mode 100644 tmp/Enums/MouseButton.cs delete mode 100644 tmp/Enums/PenumbraApiEc.cs delete mode 100644 tmp/Enums/RedrawType.cs delete mode 100644 tmp/Helpers/ActionProvider.cs delete mode 100644 tmp/Helpers/ActionSubscriber.cs delete mode 100644 tmp/Helpers/EventProvider.cs delete mode 100644 tmp/Helpers/EventSubscriber.cs delete mode 100644 tmp/Helpers/FuncProvider.cs delete mode 100644 tmp/Helpers/FuncSubscriber.cs delete mode 100644 tmp/IPenumbraApi.cs delete mode 100644 tmp/IPenumbraApiBase.cs delete mode 100644 tmp/Ipc/Collection.cs delete mode 100644 tmp/Ipc/Configuration.cs delete mode 100644 tmp/Ipc/GameState.cs delete mode 100644 tmp/Ipc/Meta.cs delete mode 100644 tmp/Ipc/ModSettings.cs delete mode 100644 tmp/Ipc/Mods.cs delete mode 100644 tmp/Ipc/PluginState.cs delete mode 100644 tmp/Ipc/Redraw.cs delete mode 100644 tmp/Ipc/Resolve.cs delete mode 100644 tmp/Ipc/Temporary.cs delete mode 100644 tmp/Ipc/Ui.cs delete mode 100644 tmp/Penumbra.Api.csproj delete mode 100644 tmp/Penumbra.Api.csproj.DotSettings delete mode 100644 tmp/README.md diff --git a/tmp/.editorconfig b/tmp/.editorconfig deleted file mode 100644 index 238bb1dc..00000000 --- a/tmp/.editorconfig +++ /dev/null @@ -1,85 +0,0 @@ - -[*] -charset=utf-8 -end_of_line=lf -trim_trailing_whitespace=true -insert_final_newline=false -indent_style=space -indent_size=4 - -# Microsoft .NET properties -csharp_new_line_before_members_in_object_initializers=false -csharp_preferred_modifier_order=public, private, protected, internal, new, abstract, virtual, sealed, override, static, readonly, extern, unsafe, volatile, async:suggestion -csharp_prefer_braces=true:none -csharp_space_after_cast=false -csharp_space_after_keywords_in_control_flow_statements=false -csharp_space_between_method_call_parameter_list_parentheses=true -csharp_space_between_method_declaration_parameter_list_parentheses=true -csharp_space_between_parentheses=control_flow_statements,expressions,type_casts -csharp_style_var_elsewhere=true:suggestion -csharp_style_var_for_built_in_types=true:suggestion -csharp_style_var_when_type_is_apparent=true:suggestion -dotnet_style_parentheses_in_arithmetic_binary_operators=never_if_unnecessary:none -dotnet_style_parentheses_in_other_binary_operators=never_if_unnecessary:none -dotnet_style_parentheses_in_relational_binary_operators=never_if_unnecessary:none -dotnet_style_predefined_type_for_locals_parameters_members=true:suggestion -dotnet_style_predefined_type_for_member_access=true:suggestion -dotnet_style_qualification_for_event=false:suggestion -dotnet_style_qualification_for_field=false:suggestion -dotnet_style_qualification_for_method=false:suggestion -dotnet_style_qualification_for_property=false:suggestion -dotnet_style_require_accessibility_modifiers=for_non_interface_members:suggestion - -# ReSharper properties -resharper_align_multiline_binary_expressions_chain=false -resharper_align_multiline_calls_chain=false -resharper_autodetect_indent_settings=true -resharper_braces_redundant=true -resharper_constructor_or_destructor_body=expression_body -resharper_csharp_empty_block_style=together -resharper_csharp_max_line_length=180 -resharper_csharp_space_within_array_access_brackets=true -resharper_enforce_line_ending_style=true -resharper_int_align_assignments=true -resharper_int_align_comments=true -resharper_int_align_fields=true -resharper_int_align_invocations=false -resharper_int_align_nested_ternary=true -resharper_int_align_properties=false -resharper_int_align_switch_expressions=true -resharper_int_align_switch_sections=true -resharper_int_align_variables=true -resharper_local_function_body=expression_body -resharper_method_or_operator_body=expression_body -resharper_place_attribute_on_same_line=false -resharper_space_after_cast=false -resharper_space_within_checked_parentheses=true -resharper_space_within_default_parentheses=true -resharper_space_within_nameof_parentheses=true -resharper_space_within_single_line_array_initializer_braces=true -resharper_space_within_sizeof_parentheses=true -resharper_space_within_typeof_parentheses=true -resharper_space_within_type_argument_angles=true -resharper_space_within_type_parameter_angles=true -resharper_use_indent_from_vs=false -resharper_wrap_lines=true - -# ReSharper inspection severities -resharper_arrange_redundant_parentheses_highlighting=hint -resharper_arrange_this_qualifier_highlighting=hint -resharper_arrange_type_member_modifiers_highlighting=hint -resharper_arrange_type_modifiers_highlighting=hint -resharper_built_in_type_reference_style_for_member_access_highlighting=hint -resharper_built_in_type_reference_style_highlighting=hint -resharper_redundant_base_qualifier_highlighting=warning -resharper_suggest_var_or_type_built_in_types_highlighting=hint -resharper_suggest_var_or_type_elsewhere_highlighting=hint -resharper_suggest_var_or_type_simple_types_highlighting=hint -resharper_web_config_module_not_resolved_highlighting=warning -resharper_web_config_type_not_resolved_highlighting=warning -resharper_web_config_wrong_module_highlighting=warning - -[*.{appxmanifest,asax,ascx,aspx,build,cg,cginc,compute,cs,cshtml,dtd,hlsl,hlsli,hlslinc,master,nuspec,razor,resw,resx,shader,skin,usf,ush,vb,xaml,xamlx,xoml,xsd}] -indent_style=space -indent_size=4 -tab_width=4 diff --git a/tmp/.gitignore b/tmp/.gitignore deleted file mode 100644 index 3e168525..00000000 --- a/tmp/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -bin/ -obj/ -.vs/ \ No newline at end of file diff --git a/tmp/Delegates.cs b/tmp/Delegates.cs deleted file mode 100644 index 97726e81..00000000 --- a/tmp/Delegates.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using Penumbra.Api.Enums; - -namespace Penumbra.Api; - -// Delegates used by different events. -public delegate void ChangedItemHover( object? item ); -public delegate void ChangedItemClick( MouseButton button, object? item ); -public delegate void GameObjectRedrawn( IntPtr objectPtr, int objectTableIndex ); -public delegate void ModSettingChanged( ModSettingChange type, string collectionName, string modDirectory, bool inherited ); - -public delegate void CreatingCharacterBaseDelegate( IntPtr gameObject, string collectionName, IntPtr modelId, IntPtr customize, - IntPtr equipData ); - -public delegate void CreatedCharacterBaseDelegate( IntPtr gameObject, string collectionName, IntPtr drawObject ); -public delegate void GameObjectResourceResolvedDelegate( IntPtr gameObject, string gamePath, string localPath ); \ No newline at end of file diff --git a/tmp/Enums/ChangedItemType.cs b/tmp/Enums/ChangedItemType.cs deleted file mode 100644 index 5cc1b5a7..00000000 --- a/tmp/Enums/ChangedItemType.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace Penumbra.Api.Enums; - -public enum ChangedItemType -{ - None, - Item, - Action, - Customization, -} \ No newline at end of file diff --git a/tmp/Enums/GroupType.cs b/tmp/Enums/GroupType.cs deleted file mode 100644 index 65a8ed39..00000000 --- a/tmp/Enums/GroupType.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace Penumbra.Api.Enums; - -public enum GroupType -{ - Single, - Multi, -} \ No newline at end of file diff --git a/tmp/Enums/ModSettingChange.cs b/tmp/Enums/ModSettingChange.cs deleted file mode 100644 index 5e556d50..00000000 --- a/tmp/Enums/ModSettingChange.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace Penumbra.Api.Enums; - -// Different types a mod setting can change: -public enum ModSettingChange -{ - Inheritance, // it was set to inherit from other collections or not inherit anymore - EnableState, // it was enabled or disabled - Priority, // its priority was changed - Setting, // a specific setting was changed - MultiInheritance, // multiple mods were set to inherit from other collections or not inherit anymore. - MultiEnableState, // multiple mods were enabled or disabled at once. -} \ No newline at end of file diff --git a/tmp/Enums/MouseButton.cs b/tmp/Enums/MouseButton.cs deleted file mode 100644 index 2917c0f8..00000000 --- a/tmp/Enums/MouseButton.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace Penumbra.Api.Enums; - -public enum MouseButton -{ - None, - Left, - Right, - Middle, -} \ No newline at end of file diff --git a/tmp/Enums/PenumbraApiEc.cs b/tmp/Enums/PenumbraApiEc.cs deleted file mode 100644 index a37aefa8..00000000 --- a/tmp/Enums/PenumbraApiEc.cs +++ /dev/null @@ -1,20 +0,0 @@ -namespace Penumbra.Api.Enums; - -public enum PenumbraApiEc -{ - Success = 0, - NothingChanged = 1, - CollectionMissing = 2, - ModMissing = 3, - OptionGroupMissing = 4, - OptionMissing = 5, - - CharacterCollectionExists = 6, - LowerPriority = 7, - InvalidGamePath = 8, - FileMissing = 9, - InvalidManipulation = 10, - InvalidArgument = 11, - PathRenameFailed = 12, - UnknownError = 255, -} \ No newline at end of file diff --git a/tmp/Enums/RedrawType.cs b/tmp/Enums/RedrawType.cs deleted file mode 100644 index 0295554f..00000000 --- a/tmp/Enums/RedrawType.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace Penumbra.Api.Enums; - -public enum RedrawType -{ - Redraw, - AfterGPose, -} \ No newline at end of file diff --git a/tmp/Helpers/ActionProvider.cs b/tmp/Helpers/ActionProvider.cs deleted file mode 100644 index c070dca8..00000000 --- a/tmp/Helpers/ActionProvider.cs +++ /dev/null @@ -1,66 +0,0 @@ -using System; -using Dalamud.Logging; -using Dalamud.Plugin; -using Dalamud.Plugin.Ipc; - -namespace Penumbra.Api.Helpers; - -public sealed class ActionProvider : IDisposable -{ - private ICallGateProvider? _provider; - - public ActionProvider( DalamudPluginInterface pi, string label, Action action ) - { - try - { - _provider = pi.GetIpcProvider( label ); - } - catch( Exception e ) - { - PluginLog.Error( $"Error registering IPC Provider for {label}\n{e}" ); - _provider = null; - } - - _provider?.RegisterAction( action ); - } - - public void Dispose() - { - _provider?.UnregisterAction(); - _provider = null; - GC.SuppressFinalize( this ); - } - - ~ActionProvider() - => Dispose(); -} - -public sealed class ActionProvider< T1, T2 > : IDisposable -{ - private ICallGateProvider< T1, T2, object? >? _provider; - - public ActionProvider( DalamudPluginInterface pi, string label, Action< T1, T2 > action ) - { - try - { - _provider = pi.GetIpcProvider< T1, T2, object? >( label ); - } - catch( Exception e ) - { - PluginLog.Error( $"Error registering IPC Provider for {label}\n{e}" ); - _provider = null; - } - - _provider?.RegisterAction( action ); - } - - public void Dispose() - { - _provider?.UnregisterAction(); - _provider = null; - GC.SuppressFinalize( this ); - } - - ~ActionProvider() - => Dispose(); -} \ No newline at end of file diff --git a/tmp/Helpers/ActionSubscriber.cs b/tmp/Helpers/ActionSubscriber.cs deleted file mode 100644 index e924e4eb..00000000 --- a/tmp/Helpers/ActionSubscriber.cs +++ /dev/null @@ -1,54 +0,0 @@ -using System; -using Dalamud.Logging; -using Dalamud.Plugin; -using Dalamud.Plugin.Ipc; - -namespace Penumbra.Api.Helpers; - -public readonly struct ActionSubscriber< T1 > -{ - private readonly ICallGateSubscriber< T1, object? >? _subscriber; - - public bool Valid - => _subscriber != null; - - public ActionSubscriber( DalamudPluginInterface pi, string label ) - { - try - { - _subscriber = pi.GetIpcSubscriber< T1, object? >( label ); - } - catch( Exception e ) - { - PluginLog.Error( $"Error registering IPC Subscriber for {label}\n{e}" ); - _subscriber = null; - } - } - - public void Invoke( T1 a ) - => _subscriber?.InvokeAction( a ); -} - -public readonly struct ActionSubscriber< T1, T2 > -{ - private readonly ICallGateSubscriber< T1, T2, object? >? _subscriber; - - public bool Valid - => _subscriber != null; - - public ActionSubscriber( DalamudPluginInterface pi, string label ) - { - try - { - _subscriber = pi.GetIpcSubscriber< T1, T2, object? >( label ); - } - catch( Exception e ) - { - PluginLog.Error( $"Error registering IPC Subscriber for {label}\n{e}" ); - _subscriber = null; - } - } - - public void Invoke( T1 a, T2 b ) - => _subscriber?.InvokeAction( a, b ); -} \ No newline at end of file diff --git a/tmp/Helpers/EventProvider.cs b/tmp/Helpers/EventProvider.cs deleted file mode 100644 index b623d41e..00000000 --- a/tmp/Helpers/EventProvider.cs +++ /dev/null @@ -1,376 +0,0 @@ -using System; -using Dalamud.Logging; -using Dalamud.Plugin; -using Dalamud.Plugin.Ipc; - -namespace Penumbra.Api.Helpers; - -public sealed class EventProvider : IDisposable -{ - private ICallGateProvider< object? >? _provider; - private Delegate? _unsubscriber; - - public EventProvider( DalamudPluginInterface pi, string label, (Action< Action > Add, Action< Action > Del)? subscribe = null ) - { - _unsubscriber = null; - try - { - _provider = pi.GetIpcProvider< object? >( label ); - subscribe?.Add( Invoke ); - _unsubscriber = subscribe?.Del; - } - catch( Exception e ) - { - PluginLog.Error( $"Error registering IPC Provider for {label}\n{e}" ); - _provider = null; - } - } - - public EventProvider( DalamudPluginInterface pi, string label, Action add, Action del ) - { - _unsubscriber = null; - try - { - _provider = pi.GetIpcProvider< object? >( label ); - add(); - _unsubscriber = del; - } - catch( Exception e ) - { - PluginLog.Error( $"Error registering IPC Provider for {label}\n{e}" ); - _provider = null; - } - } - - public void Invoke() - => _provider?.SendMessage(); - - public void Dispose() - { - switch( _unsubscriber ) - { - case Action< Action > a: - a( Invoke ); - break; - case Action b: - b(); - break; - } - - _unsubscriber = null; - _provider = null; - GC.SuppressFinalize( this ); - } - - ~EventProvider() - => Dispose(); -} - -public sealed class EventProvider< T1 > : IDisposable -{ - private ICallGateProvider< T1, object? >? _provider; - private Delegate? _unsubscriber; - - public EventProvider( DalamudPluginInterface pi, string label, (Action< Action< T1 > > Add, Action< Action< T1 > > Del)? subscribe = null ) - { - _unsubscriber = null; - try - { - _provider = pi.GetIpcProvider< T1, object? >( label ); - subscribe?.Add( Invoke ); - _unsubscriber = subscribe?.Del; - } - catch( Exception e ) - { - PluginLog.Error( $"Error registering IPC Provider for {label}\n{e}" ); - _provider = null; - } - } - - public EventProvider( DalamudPluginInterface pi, string label, Action add, Action del ) - { - _unsubscriber = null; - try - { - _provider = pi.GetIpcProvider< T1, object? >( label ); - add(); - _unsubscriber = del; - } - catch( Exception e ) - { - PluginLog.Error( $"Error registering IPC Provider for {label}\n{e}" ); - _provider = null; - } - } - - public void Invoke( T1 a ) - => _provider?.SendMessage( a ); - - public void Dispose() - { - switch( _unsubscriber ) - { - case Action< Action< T1 > > a: - a( Invoke ); - break; - case Action b: - b(); - break; - } - - _unsubscriber = null; - _provider = null; - GC.SuppressFinalize( this ); - } - - ~EventProvider() - => Dispose(); -} - -public sealed class EventProvider< T1, T2 > : IDisposable -{ - private ICallGateProvider< T1, T2, object? >? _provider; - private Delegate? _unsubscriber; - - public EventProvider( DalamudPluginInterface pi, string label, - (Action< Action< T1, T2 > > Add, Action< Action< T1, T2 > > Del)? subscribe = null ) - { - _unsubscriber = null; - try - { - _provider = pi.GetIpcProvider< T1, T2, object? >( label ); - subscribe?.Add( Invoke ); - _unsubscriber = subscribe?.Del; - } - catch( Exception e ) - { - PluginLog.Error( $"Error registering IPC Provider for {label}\n{e}" ); - _provider = null; - } - } - - public EventProvider( DalamudPluginInterface pi, string label, Action add, Action del ) - { - _unsubscriber = null; - try - { - _provider = pi.GetIpcProvider< T1, T2, object? >( label ); - add(); - _unsubscriber = del; - } - catch( Exception e ) - { - PluginLog.Error( $"Error registering IPC Provider for {label}\n{e}" ); - _provider = null; - } - } - - public void Invoke( T1 a, T2 b ) - => _provider?.SendMessage( a, b ); - - public void Dispose() - { - switch( _unsubscriber ) - { - case Action< Action< T1, T2 > > a: - a( Invoke ); - break; - case Action b: - b(); - break; - } - - _unsubscriber = null; - _provider = null; - GC.SuppressFinalize( this ); - } - - ~EventProvider() - => Dispose(); -} - -public sealed class EventProvider< T1, T2, T3 > : IDisposable -{ - private ICallGateProvider< T1, T2, T3, object? >? _provider; - private Delegate? _unsubscriber; - - public EventProvider( DalamudPluginInterface pi, string label, - (Action< Action< T1, T2, T3 > > Add, Action< Action< T1, T2, T3 > > Del)? subscribe = null ) - { - _unsubscriber = null; - try - { - _provider = pi.GetIpcProvider< T1, T2, T3, object? >( label ); - subscribe?.Add( Invoke ); - _unsubscriber = subscribe?.Del; - } - catch( Exception e ) - { - PluginLog.Error( $"Error registering IPC Provider for {label}\n{e}" ); - _provider = null; - } - } - - public EventProvider( DalamudPluginInterface pi, string label, Action add, Action del ) - { - _unsubscriber = null; - try - { - _provider = pi.GetIpcProvider< T1, T2, T3, object? >( label ); - add(); - _unsubscriber = del; - } - catch( Exception e ) - { - PluginLog.Error( $"Error registering IPC Provider for {label}\n{e}" ); - _provider = null; - } - } - - public void Invoke( T1 a, T2 b, T3 c ) - => _provider?.SendMessage( a, b, c ); - - public void Dispose() - { - switch( _unsubscriber ) - { - case Action< Action< T1, T2, T3 > > a: - a( Invoke ); - break; - case Action b: - b(); - break; - } - - _unsubscriber = null; - _provider = null; - GC.SuppressFinalize( this ); - } - - ~EventProvider() - => Dispose(); -} - -public sealed class EventProvider< T1, T2, T3, T4 > : IDisposable -{ - private ICallGateProvider< T1, T2, T3, T4, object? >? _provider; - private Delegate? _unsubscriber; - - public EventProvider( DalamudPluginInterface pi, string label, - (Action< Action< T1, T2, T3, T4 > > Add, Action< Action< T1, T2, T3, T4 > > Del)? subscribe = null ) - { - _unsubscriber = null; - try - { - _provider = pi.GetIpcProvider< T1, T2, T3, T4, object? >( label ); - subscribe?.Add( Invoke ); - _unsubscriber = subscribe?.Del; - } - catch( Exception e ) - { - PluginLog.Error( $"Error registering IPC Provider for {label}\n{e}" ); - _provider = null; - } - } - - public EventProvider( DalamudPluginInterface pi, string label, Action add, Action del ) - { - _unsubscriber = null; - try - { - _provider = pi.GetIpcProvider< T1, T2, T3, T4, object? >( label ); - add(); - _unsubscriber = del; - } - catch( Exception e ) - { - PluginLog.Error( $"Error registering IPC Provider for {label}\n{e}" ); - _provider = null; - } - } - - public void Invoke( T1 a, T2 b, T3 c, T4 d ) - => _provider?.SendMessage( a, b, c, d ); - - public void Dispose() - { - switch( _unsubscriber ) - { - case Action< Action< T1, T2, T3, T4 > > a: - a( Invoke ); - break; - case Action b: - b(); - break; - } - - _unsubscriber = null; - _provider = null; - GC.SuppressFinalize( this ); - } - - ~EventProvider() - => Dispose(); -} - -public sealed class EventProvider< T1, T2, T3, T4, T5 > : IDisposable -{ - private ICallGateProvider< T1, T2, T3, T4, T5, object? >? _provider; - private Delegate? _unsubscriber; - - public EventProvider( DalamudPluginInterface pi, string label, - (Action< Action< T1, T2, T3, T4, T5 > > Add, Action< Action< T1, T2, T3, T4, T5 > > Del)? subscribe = null ) - { - _unsubscriber = null; - try - { - _provider = pi.GetIpcProvider< T1, T2, T3, T4, T5, object? >( label ); - subscribe?.Add( Invoke ); - _unsubscriber = subscribe?.Del; - } - catch( Exception e ) - { - PluginLog.Error( $"Error registering IPC Provider for {label}\n{e}" ); - _provider = null; - } - } - - public EventProvider( DalamudPluginInterface pi, string label, Action add, Action del ) - { - _unsubscriber = null; - try - { - _provider = pi.GetIpcProvider< T1, T2, T3, T4, T5, object? >( label ); - add(); - _unsubscriber = del; - } - catch( Exception e ) - { - PluginLog.Error( $"Error registering IPC Provider for {label}\n{e}" ); - _provider = null; - } - } - - public void Invoke( T1 a, T2 b, T3 c, T4 d, T5 e ) - => _provider?.SendMessage( a, b, c, d, e ); - - public void Dispose() - { - switch( _unsubscriber ) - { - case Action< Action< T1, T2, T3, T4, T5 > > a: - a( Invoke ); - break; - case Action b: - b(); - break; - } - - _unsubscriber = null; - _provider = null; - GC.SuppressFinalize( this ); - } - - ~EventProvider() - => Dispose(); -} \ No newline at end of file diff --git a/tmp/Helpers/EventSubscriber.cs b/tmp/Helpers/EventSubscriber.cs deleted file mode 100644 index 0df6bc11..00000000 --- a/tmp/Helpers/EventSubscriber.cs +++ /dev/null @@ -1,607 +0,0 @@ -using System; -using System.Collections.Generic; -using Dalamud.Logging; -using Dalamud.Plugin; -using Dalamud.Plugin.Ipc; - -namespace Penumbra.Api.Helpers; - -public sealed class EventSubscriber : IDisposable -{ - private readonly string _label; - private readonly Dictionary< Action, Action > _delegates = new(); - private ICallGateSubscriber< object? >? _subscriber; - private bool _disabled; - - public EventSubscriber( DalamudPluginInterface pi, string label, params Action[] actions ) - { - _label = label; - try - { - _subscriber = pi.GetIpcSubscriber< object? >( label ); - foreach( var action in actions ) - { - Event += action; - } - - _disabled = false; - } - catch( Exception e ) - { - PluginLog.Error( $"Error registering IPC Subscriber for {label}\n{e}" ); - _subscriber = null; - } - } - - public void Enable() - { - if( _disabled && _subscriber != null ) - { - foreach( var action in _delegates.Keys ) - { - _subscriber.Subscribe( action ); - } - - _disabled = false; - } - } - - public void Disable() - { - if( !_disabled ) - { - if( _subscriber != null ) - { - foreach( var action in _delegates.Keys ) - { - _subscriber.Unsubscribe( action ); - } - } - - _disabled = true; - } - } - - public event Action Event - { - add - { - if( _subscriber != null && !_delegates.ContainsKey( value ) ) - { - void Action() - { - try - { - value(); - } - catch( Exception e ) - { - PluginLog.Error( $"Exception invoking IPC event {_label}:\n{e}" ); - } - } - - if( _delegates.TryAdd( value, Action ) && !_disabled ) - { - _subscriber.Subscribe( Action ); - } - } - } - remove - { - if( _subscriber != null && _delegates.Remove( value, out var action ) ) - { - _subscriber.Unsubscribe( action ); - } - } - } - - public void Dispose() - { - Disable(); - _subscriber = null; - _delegates.Clear(); - } - - ~EventSubscriber() - => Dispose(); -} - -public sealed class EventSubscriber< T1 > : IDisposable -{ - private readonly string _label; - private readonly Dictionary< Action< T1 >, Action< T1 > > _delegates = new(); - private ICallGateSubscriber< T1, object? >? _subscriber; - private bool _disabled; - - public EventSubscriber( DalamudPluginInterface pi, string label, params Action< T1 >[] actions ) - { - _label = label; - try - { - _subscriber = pi.GetIpcSubscriber< T1, object? >( label ); - foreach( var action in actions ) - { - Event += action; - } - - _disabled = false; - } - catch( Exception e ) - { - PluginLog.Error( $"Error registering IPC Subscriber for {label}\n{e}" ); - _subscriber = null; - } - } - - public void Enable() - { - if( _disabled && _subscriber != null ) - { - foreach( var action in _delegates.Keys ) - { - _subscriber.Subscribe( action ); - } - - _disabled = false; - } - } - - public void Disable() - { - if( !_disabled ) - { - if( _subscriber != null ) - { - foreach( var action in _delegates.Keys ) - { - _subscriber.Unsubscribe( action ); - } - } - - _disabled = true; - } - } - - public event Action< T1 > Event - { - add - { - if( _subscriber != null && !_delegates.ContainsKey( value ) ) - { - void Action( T1 a ) - { - try - { - value( a ); - } - catch( Exception e ) - { - PluginLog.Error( $"Exception invoking IPC event {_label}:\n{e}" ); - } - } - - if( _delegates.TryAdd( value, Action ) && !_disabled ) - { - _subscriber.Subscribe( Action ); - } - } - } - remove - { - if( _subscriber != null && _delegates.Remove( value, out var action ) ) - { - _subscriber.Unsubscribe( action ); - } - } - } - - public void Dispose() - { - Disable(); - _subscriber = null; - _delegates.Clear(); - } - - ~EventSubscriber() - => Dispose(); -} - -public sealed class EventSubscriber< T1, T2 > : IDisposable -{ - private readonly string _label; - private readonly Dictionary< Action< T1, T2 >, Action< T1, T2 > > _delegates = new(); - private ICallGateSubscriber< T1, T2, object? >? _subscriber; - private bool _disabled; - - public EventSubscriber( DalamudPluginInterface pi, string label, params Action< T1, T2 >[] actions ) - { - _label = label; - try - { - _subscriber = pi.GetIpcSubscriber< T1, T2, object? >( label ); - foreach( var action in actions ) - { - Event += action; - } - - _disabled = false; - } - catch( Exception e ) - { - PluginLog.Error( $"Error registering IPC Subscriber for {label}\n{e}" ); - _subscriber = null; - } - } - - public void Enable() - { - if( _disabled && _subscriber != null ) - { - foreach( var action in _delegates.Keys ) - { - _subscriber.Subscribe( action ); - } - - _disabled = false; - } - } - - public void Disable() - { - if( !_disabled ) - { - if( _subscriber != null ) - { - foreach( var action in _delegates.Keys ) - { - _subscriber.Unsubscribe( action ); - } - } - - _disabled = true; - } - } - - public event Action< T1, T2 > Event - { - add - { - if( _subscriber != null && !_delegates.ContainsKey( value ) ) - { - void Action( T1 a, T2 b ) - { - try - { - value( a, b ); - } - catch( Exception e ) - { - PluginLog.Error( $"Exception invoking IPC event {_label}:\n{e}" ); - } - } - - if( _delegates.TryAdd( value, Action ) && !_disabled ) - { - _subscriber.Subscribe( Action ); - } - } - } - remove - { - if( _subscriber != null && _delegates.Remove( value, out var action ) ) - { - _subscriber.Unsubscribe( action ); - } - } - } - - public void Dispose() - { - Disable(); - _subscriber = null; - _delegates.Clear(); - } - - ~EventSubscriber() - => Dispose(); -} - -public sealed class EventSubscriber< T1, T2, T3 > : IDisposable -{ - private readonly string _label; - private readonly Dictionary< Action< T1, T2, T3 >, Action< T1, T2, T3 > > _delegates = new(); - private ICallGateSubscriber< T1, T2, T3, object? >? _subscriber; - private bool _disabled; - - public EventSubscriber( DalamudPluginInterface pi, string label, params Action< T1, T2, T3 >[] actions ) - { - _label = label; - try - { - _subscriber = pi.GetIpcSubscriber< T1, T2, T3, object? >( label ); - foreach( var action in actions ) - { - Event += action; - } - - _disabled = false; - } - catch( Exception e ) - { - PluginLog.Error( $"Error registering IPC Subscriber for {label}\n{e}" ); - _subscriber = null; - } - } - - public void Enable() - { - if( _disabled && _subscriber != null ) - { - foreach( var action in _delegates.Keys ) - { - _subscriber.Subscribe( action ); - } - - _disabled = false; - } - } - - public void Disable() - { - if( !_disabled ) - { - if( _subscriber != null ) - { - foreach( var action in _delegates.Keys ) - { - _subscriber.Unsubscribe( action ); - } - } - - _disabled = true; - } - } - - public event Action< T1, T2, T3 > Event - { - add - { - if( _subscriber != null && !_delegates.ContainsKey( value ) ) - { - void Action( T1 a, T2 b, T3 c ) - { - try - { - value( a, b, c ); - } - catch( Exception e ) - { - PluginLog.Error( $"Exception invoking IPC event {_label}:\n{e}" ); - } - } - - if( _delegates.TryAdd( value, Action ) && !_disabled ) - { - _subscriber.Subscribe( Action ); - } - } - } - remove - { - if( _subscriber != null && _delegates.Remove( value, out var action ) ) - { - _subscriber.Unsubscribe( action ); - } - } - } - - public void Dispose() - { - Disable(); - _subscriber = null; - _delegates.Clear(); - } - - ~EventSubscriber() - => Dispose(); -} - -public sealed class EventSubscriber< T1, T2, T3, T4 > : IDisposable -{ - private readonly string _label; - private readonly Dictionary< Action< T1, T2, T3, T4 >, Action< T1, T2, T3, T4 > > _delegates = new(); - private ICallGateSubscriber< T1, T2, T3, T4, object? >? _subscriber; - private bool _disabled; - - public EventSubscriber( DalamudPluginInterface pi, string label, params Action< T1, T2, T3, T4 >[] actions ) - { - _label = label; - try - { - _subscriber = pi.GetIpcSubscriber< T1, T2, T3, T4, object? >( label ); - foreach( var action in actions ) - { - Event += action; - } - - _disabled = false; - } - catch( Exception e ) - { - PluginLog.Error( $"Error registering IPC Subscriber for {label}\n{e}" ); - _subscriber = null; - } - } - - public void Enable() - { - if( _disabled && _subscriber != null ) - { - foreach( var action in _delegates.Keys ) - { - _subscriber.Subscribe( action ); - } - - _disabled = false; - } - } - - public void Disable() - { - if( !_disabled ) - { - if( _subscriber != null ) - { - foreach( var action in _delegates.Keys ) - { - _subscriber.Unsubscribe( action ); - } - } - - _disabled = true; - } - } - - public event Action< T1, T2, T3, T4 > Event - { - add - { - if( _subscriber != null && !_delegates.ContainsKey( value ) ) - { - void Action( T1 a, T2 b, T3 c, T4 d ) - { - try - { - value( a, b, c, d ); - } - catch( Exception e ) - { - PluginLog.Error( $"Exception invoking IPC event {_label}:\n{e}" ); - } - } - - if( _delegates.TryAdd( value, Action ) && !_disabled ) - { - _subscriber.Subscribe( Action ); - } - } - } - remove - { - if( _subscriber != null && _delegates.Remove( value, out var action ) ) - { - _subscriber.Unsubscribe( action ); - } - } - } - - public void Dispose() - { - Disable(); - _subscriber = null; - _delegates.Clear(); - } - - ~EventSubscriber() - => Dispose(); -} - -public sealed class EventSubscriber< T1, T2, T3, T4, T5 > : IDisposable -{ - private readonly string _label; - private readonly Dictionary< Action< T1, T2, T3, T4, T5 >, Action< T1, T2, T3, T4, T5 > > _delegates = new(); - private ICallGateSubscriber< T1, T2, T3, T4, T5, object? >? _subscriber; - private bool _disabled; - - public EventSubscriber( DalamudPluginInterface pi, string label, params Action< T1, T2, T3, T4, T5 >[] actions ) - { - _label = label; - try - { - _subscriber = pi.GetIpcSubscriber< T1, T2, T3, T4, T5, object? >( label ); - foreach( var action in actions ) - { - Event += action; - } - - _disabled = false; - } - catch( Exception e ) - { - PluginLog.Error( $"Error registering IPC Subscriber for {label}\n{e}" ); - _subscriber = null; - } - } - - public void Enable() - { - if( _disabled && _subscriber != null ) - { - foreach( var action in _delegates.Keys ) - { - _subscriber.Subscribe( action ); - } - - _disabled = false; - } - } - - public void Disable() - { - if( !_disabled ) - { - if( _subscriber != null ) - { - foreach( var action in _delegates.Keys ) - { - _subscriber.Unsubscribe( action ); - } - } - - _disabled = true; - } - } - - public event Action< T1, T2, T3, T4, T5 > Event - { - add - { - if( _subscriber != null && !_delegates.ContainsKey( value ) ) - { - void Action( T1 a, T2 b, T3 c, T4 d, T5 e ) - { - try - { - value( a, b, c, d, e ); - } - catch( Exception ex ) - { - PluginLog.Error( $"Exception invoking IPC event {_label}:\n{ex}" ); - } - } - - if( _delegates.TryAdd( value, Action ) && !_disabled ) - { - _subscriber.Subscribe( Action ); - } - } - } - remove - { - if( _subscriber != null && _delegates.Remove( value, out var action ) ) - { - _subscriber.Unsubscribe( action ); - } - } - } - - public void Dispose() - { - Disable(); - _subscriber = null; - _delegates.Clear(); - } - - ~EventSubscriber() - => Dispose(); -} \ No newline at end of file diff --git a/tmp/Helpers/FuncProvider.cs b/tmp/Helpers/FuncProvider.cs deleted file mode 100644 index fac61ce3..00000000 --- a/tmp/Helpers/FuncProvider.cs +++ /dev/null @@ -1,186 +0,0 @@ -using System; -using Dalamud.Logging; -using Dalamud.Plugin; -using Dalamud.Plugin.Ipc; - -namespace Penumbra.Api.Helpers; - -public sealed class FuncProvider< TRet > : IDisposable -{ - private ICallGateProvider< TRet >? _provider; - - public FuncProvider( DalamudPluginInterface pi, string label, Func< TRet > func ) - { - try - { - _provider = pi.GetIpcProvider< TRet >( label ); - } - catch( Exception e ) - { - PluginLog.Error( $"Error registering IPC Provider for {label}\n{e}" ); - _provider = null; - } - - _provider?.RegisterFunc( func ); - } - - public void Dispose() - { - _provider?.UnregisterFunc(); - _provider = null; - GC.SuppressFinalize( this ); - } - - ~FuncProvider() - => Dispose(); -} - -public sealed class FuncProvider< T1, TRet > : IDisposable -{ - private ICallGateProvider< T1, TRet >? _provider; - - public FuncProvider( DalamudPluginInterface pi, string label, Func< T1, TRet > func ) - { - try - { - _provider = pi.GetIpcProvider< T1, TRet >( label ); - } - catch( Exception e ) - { - PluginLog.Error( $"Error registering IPC Provider for {label}\n{e}" ); - _provider = null; - } - - _provider?.RegisterFunc( func ); - } - - public void Dispose() - { - _provider?.UnregisterFunc(); - _provider = null; - GC.SuppressFinalize( this ); - } - - ~FuncProvider() - => Dispose(); -} - -public sealed class FuncProvider< T1, T2, TRet > : IDisposable -{ - private ICallGateProvider< T1, T2, TRet >? _provider; - - public FuncProvider( DalamudPluginInterface pi, string label, Func< T1, T2, TRet > func ) - { - try - { - _provider = pi.GetIpcProvider< T1, T2, TRet >( label ); - } - catch( Exception e ) - { - PluginLog.Error( $"Error registering IPC Provider for {label}\n{e}" ); - _provider = null; - } - - _provider?.RegisterFunc( func ); - } - - public void Dispose() - { - _provider?.UnregisterFunc(); - _provider = null; - GC.SuppressFinalize( this ); - } - - ~FuncProvider() - => Dispose(); -} - -public sealed class FuncProvider< T1, T2, T3, TRet > : IDisposable -{ - private ICallGateProvider< T1, T2, T3, TRet >? _provider; - - public FuncProvider( DalamudPluginInterface pi, string label, Func< T1, T2, T3, TRet > func ) - { - try - { - _provider = pi.GetIpcProvider< T1, T2, T3, TRet >( label ); - } - catch( Exception e ) - { - PluginLog.Error( $"Error registering IPC Provider for {label}\n{e}" ); - _provider = null; - } - - _provider?.RegisterFunc( func ); - } - - public void Dispose() - { - _provider?.UnregisterFunc(); - _provider = null; - GC.SuppressFinalize( this ); - } - - ~FuncProvider() - => Dispose(); -} - -public sealed class FuncProvider< T1, T2, T3, T4, TRet > : IDisposable -{ - private ICallGateProvider< T1, T2, T3, T4, TRet >? _provider; - - public FuncProvider( DalamudPluginInterface pi, string label, Func< T1, T2, T3, T4, TRet > func ) - { - try - { - _provider = pi.GetIpcProvider< T1, T2, T3, T4, TRet >( label ); - } - catch( Exception e ) - { - PluginLog.Error( $"Error registering IPC Provider for {label}\n{e}" ); - _provider = null; - } - - _provider?.RegisterFunc( func ); - } - - public void Dispose() - { - _provider?.UnregisterFunc(); - _provider = null; - GC.SuppressFinalize( this ); - } - - ~FuncProvider() - => Dispose(); -} - -public sealed class FuncProvider< T1, T2, T3, T4, T5, TRet > : IDisposable -{ - private ICallGateProvider< T1, T2, T3, T4, T5, TRet >? _provider; - - public FuncProvider( DalamudPluginInterface pi, string label, Func< T1, T2, T3, T4, T5, TRet > func ) - { - try - { - _provider = pi.GetIpcProvider< T1, T2, T3, T4, T5, TRet >( label ); - } - catch( Exception e ) - { - PluginLog.Error( $"Error registering IPC Provider for {label}\n{e}" ); - _provider = null; - } - - _provider?.RegisterFunc( func ); - } - - public void Dispose() - { - _provider?.UnregisterFunc(); - _provider = null; - GC.SuppressFinalize( this ); - } - - ~FuncProvider() - => Dispose(); -} \ No newline at end of file diff --git a/tmp/Helpers/FuncSubscriber.cs b/tmp/Helpers/FuncSubscriber.cs deleted file mode 100644 index 3f8cbdda..00000000 --- a/tmp/Helpers/FuncSubscriber.cs +++ /dev/null @@ -1,163 +0,0 @@ -using System; -using Dalamud.Logging; -using Dalamud.Plugin; -using Dalamud.Plugin.Ipc; -using Dalamud.Plugin.Ipc.Exceptions; - -namespace Penumbra.Api.Helpers; - -public readonly struct FuncSubscriber< TRet > -{ - private readonly string _label; - private readonly ICallGateSubscriber< TRet >? _subscriber; - - public bool Valid - => _subscriber != null; - - public FuncSubscriber( DalamudPluginInterface pi, string label ) - { - _label = label; - try - { - _subscriber = pi.GetIpcSubscriber< TRet >( label ); - } - catch( Exception e ) - { - PluginLog.Error( $"Error registering IPC Subscriber for {label}\n{e}" ); - _subscriber = null; - } - } - - public TRet Invoke() - => _subscriber != null ? _subscriber.InvokeFunc() : throw new IpcNotReadyError( _label ); -} - -public readonly struct FuncSubscriber< T1, TRet > -{ - private readonly string _label; - private readonly ICallGateSubscriber< T1, TRet >? _subscriber; - - public bool Valid - => _subscriber != null; - - public FuncSubscriber( DalamudPluginInterface pi, string label ) - { - _label = label; - try - { - _subscriber = pi.GetIpcSubscriber< T1, TRet >( label ); - } - catch( Exception e ) - { - PluginLog.Error( $"Error registering IPC Subscriber for {label}\n{e}" ); - _subscriber = null; - } - } - - public TRet Invoke( T1 a ) - => _subscriber != null ? _subscriber.InvokeFunc( a ) : throw new IpcNotReadyError( _label ); -} - -public readonly struct FuncSubscriber< T1, T2, TRet > -{ - private readonly string _label; - private readonly ICallGateSubscriber< T1, T2, TRet >? _subscriber; - - public bool Valid - => _subscriber != null; - - public FuncSubscriber( DalamudPluginInterface pi, string label ) - { - _label = label; - try - { - _subscriber = pi.GetIpcSubscriber< T1, T2, TRet >( label ); - } - catch( Exception e ) - { - PluginLog.Error( $"Error registering IPC Subscriber for {label}\n{e}" ); - _subscriber = null; - } - } - - public TRet Invoke( T1 a, T2 b ) - => _subscriber != null ? _subscriber.InvokeFunc( a, b ) : throw new IpcNotReadyError( _label ); -} - -public readonly struct FuncSubscriber< T1, T2, T3, TRet > -{ - private readonly string _label; - private readonly ICallGateSubscriber< T1, T2, T3, TRet >? _subscriber; - - public bool Valid - => _subscriber != null; - - public FuncSubscriber( DalamudPluginInterface pi, string label ) - { - _label = label; - try - { - _subscriber = pi.GetIpcSubscriber< T1, T2, T3, TRet >( label ); - } - catch( Exception e ) - { - PluginLog.Error( $"Error registering IPC Subscriber for {label}\n{e}" ); - _subscriber = null; - } - } - - public TRet Invoke( T1 a, T2 b, T3 c ) - => _subscriber != null ? _subscriber.InvokeFunc( a, b, c ) : throw new IpcNotReadyError( _label ); -} - -public readonly struct FuncSubscriber< T1, T2, T3, T4, TRet > -{ - private readonly string _label; - private readonly ICallGateSubscriber< T1, T2, T3, T4, TRet >? _subscriber; - - public bool Valid - => _subscriber != null; - - public FuncSubscriber( DalamudPluginInterface pi, string label ) - { - _label = label; - try - { - _subscriber = pi.GetIpcSubscriber< T1, T2, T3, T4, TRet >( label ); - } - catch( Exception e ) - { - PluginLog.Error( $"Error registering IPC Subscriber for {label}\n{e}" ); - _subscriber = null; - } - } - - public TRet Invoke( T1 a, T2 b, T3 c, T4 d ) - => _subscriber != null ? _subscriber.InvokeFunc( a, b, c, d ) : throw new IpcNotReadyError( _label ); -} - -public readonly struct FuncSubscriber< T1, T2, T3, T4, T5, TRet > -{ - private readonly string _label; - private readonly ICallGateSubscriber< T1, T2, T3, T4, T5, TRet >? _subscriber; - - public bool Valid - => _subscriber != null; - - public FuncSubscriber( DalamudPluginInterface pi, string label ) - { - _label = label; - try - { - _subscriber = pi.GetIpcSubscriber< T1, T2, T3, T4, T5, TRet >( label ); - } - catch( Exception e ) - { - PluginLog.Error( $"Error registering IPC Subscriber for {label}\n{e}" ); - _subscriber = null; - } - } - - public TRet Invoke( T1 a, T2 b, T3 c, T4 d, T5 e ) - => _subscriber != null ? _subscriber.InvokeFunc( a, b, c, d, e ) : throw new IpcNotReadyError( _label ); -} \ No newline at end of file diff --git a/tmp/IPenumbraApi.cs b/tmp/IPenumbraApi.cs deleted file mode 100644 index 51860312..00000000 --- a/tmp/IPenumbraApi.cs +++ /dev/null @@ -1,250 +0,0 @@ -using Dalamud.Game.ClientState.Objects.Types; -using Lumina.Data; -using System; -using System.Collections.Generic; -using Penumbra.Api.Enums; - -namespace Penumbra.Api; - -public interface IPenumbraApi : IPenumbraApiBase -{ - #region Game State - - // Obtain the currently set mod directory from the configuration. - public string GetModDirectory(); - - // Obtain the entire current penumbra configuration as a json encoded string. - public string GetConfiguration(); - - // Fired whenever a mod directory change is finished. - // Gives the full path of the mod directory and whether Penumbra treats it as valid. - public event Action< string, bool >? ModDirectoryChanged; - - #endregion - - #region UI - - // Triggered when the user hovers over a listed changed object in a mod tab. - // Can be used to append tooltips. - public event ChangedItemHover? ChangedItemTooltip; - - // Events that are fired before and after the content of a mod settings panel are drawn. - // Both are fired inside the child window of the settings panel itself. - public event Action< string >? PreSettingsPanelDraw; - public event Action< string >? PostSettingsPanelDraw; - - // Triggered when the user clicks a listed changed object in a mod tab. - public event ChangedItemClick? ChangedItemClicked; - - #endregion - - #region Redrawing - - // Queue redrawing of all actors of the given name with the given RedrawType. - public void RedrawObject( string name, RedrawType setting ); - - // Queue redrawing of the specific actor with the given RedrawType. Should only be used when the actor is sure to be valid. - public void RedrawObject( GameObject gameObject, RedrawType setting ); - - // Queue redrawing of the actor with the given object table index, if it exists, with the given RedrawType. - public void RedrawObject( int tableIndex, RedrawType setting ); - - // Queue redrawing of all currently available actors with the given RedrawType. - public void RedrawAll( RedrawType setting ); - - // Triggered whenever a game object is redrawn via Penumbra. - public event GameObjectRedrawn? GameObjectRedrawn; - - #endregion - - #region Game State - - // Obtain the game object associated with a given draw object and the name of the collection associated with this game object. - public (IntPtr, string) GetDrawObjectInfo( IntPtr drawObject ); - - // Obtain the parent game object index for an unnamed cutscene actor by its index. - public int GetCutsceneParentIndex( int actor ); - - // Triggered when a character base is created and a corresponding gameObject could be found, - // before the Draw Object is actually created, so customize and equipdata can be manipulated beforehand. - public event CreatingCharacterBaseDelegate? CreatingCharacterBase; - - // Triggered after a character base was created if a corresponding gameObject could be found, - // so you can apply flag changes after finishing. - public event CreatedCharacterBaseDelegate? CreatedCharacterBase; - - // Triggered whenever a resource is redirected by Penumbra for a specific, identified game object. - // Does not trigger if the resource is not requested for a known game object. - public event GameObjectResourceResolvedDelegate? GameObjectResourceResolved; - - #endregion - - #region Resolving - - // Resolve a given gamePath via Penumbra using the Default collection. - // Returns the given gamePath if penumbra would not manipulate it. - public string ResolveDefaultPath( string gamePath ); - - // Resolve a given gamePath via Penumbra using the Interface collection. - // Returns the given gamePath if penumbra would not manipulate it. - public string ResolveInterfacePath( string gamePath ); - - // Resolve a given gamePath via Penumbra using the character collection for the given name (if it exists) and the Forced collections. - // Returns the given gamePath if penumbra would not manipulate it. - public string ResolvePath( string gamePath, string characterName ); - - // Resolve a given gamePath via Penumbra using any applicable character collections for the current character. - // Returns the given gamePath if penumbra would not manipulate it. - public string ResolvePlayerPath( string gamePath ); - - // Reverse resolves a given modded local path into its replacement in form of all applicable game paths for given character collection. - public string[] ReverseResolvePath( string moddedPath, string characterName ); - - // Reverse resolves a given modded local path into its replacement in form of all applicable game paths - // using the collection applying to the player character. - public string[] ReverseResolvePlayerPath( string moddedPath ); - - // Try to load a given gamePath with the resolved path from Penumbra. - public T? GetFile< T >( string gamePath ) where T : FileResource; - - // Try to load a given gamePath with the resolved path from Penumbra. - public T? GetFile< T >( string gamePath, string characterName ) where T : FileResource; - - #endregion - - #region Collections - - // Obtain a list of the names of all currently installed collections. - public IList< string > GetCollections(); - - // Obtain the name of the currently selected collection. - public string GetCurrentCollection(); - - // Obtain the name of the default collection. - public string GetDefaultCollection(); - - // Obtain the name of the interface collection. - public string GetInterfaceCollection(); - - // Obtain the name of the collection associated with characterName and whether it is configured or inferred from default. - public (string, bool) GetCharacterCollection( string characterName ); - - // Gets a dictionary of effected items from a collection - public IReadOnlyDictionary< string, object? > GetChangedItemsForCollection( string collectionName ); - - #endregion - - #region Meta - - // Obtain a base64 encoded, zipped json-string with a prepended version-byte of the current manipulations - // for the collection currently associated with the player. - public string GetPlayerMetaManipulations(); - - // Obtain a base64 encoded, zipped json-string with a prepended version-byte of the current manipulations - // for the given collection associated with the character name, or the default collection. - public string GetMetaManipulations( string characterName ); - - #endregion - - #region Mods - - // Obtain a list of all installed mods. The first string is their directory name, the second string is their mod name. - public IList< (string, string) > GetModList(); - - // Try to reload an existing mod by its directory name or mod name. - // Can return ModMissing or success. - // Reload is the same as if triggered by button press and might delete the mod if it is not valid anymore. - public PenumbraApiEc ReloadMod( string modDirectory, string modName ); - - // Try to add a new mod inside the mod root directory (modDirectory should only be the name, not the full name). - // Returns FileMissing if the directory does not exist or success otherwise. - // Note that success does only imply a successful call, not a successful mod load. - public PenumbraApiEc AddMod( string modDirectory ); - - // Try to delete a mod given by its modDirectory or its name. - // Returns NothingDone if the mod can not be found or success otherwise. - // Note that success does only imply a successful call, not successful deletion. - public PenumbraApiEc DeleteMod( string modDirectory, string modName ); - - // Get the internal full filesystem path including search order for the specified mod. - // If success is returned, the second return value contains the full path - // and a bool indicating whether this is the default path (false) or a manually set one (true). - // Can return ModMissing or Success. - public (PenumbraApiEc, string, bool) GetModPath( string modDirectory, string modName ); - - // Set the internal search order and filesystem path of the specified mod to the given path. - // Returns InvalidArgument if newPath is empty, ModMissing if the mod can not be found, - // PathRenameFailed if newPath could not be set and Success otherwise. - public PenumbraApiEc SetModPath( string modDirectory, string modName, string newPath ); - - #endregion - - #region Mod Settings - - // Obtain the potential settings of a mod specified by its directory name first or mod name second. - // Returns null if the mod could not be found. - public IDictionary< string, (IList< string >, GroupType) >? GetAvailableModSettings( string modDirectory, string modName ); - - // Obtain the enabled state, the priority, the settings of a mod specified by its directory name first or mod name second, - // and whether these settings are inherited, or null if the collection does not set them at all. - // If allowInheritance is false, only the collection itself will be checked. - public (PenumbraApiEc, (bool, int, IDictionary< string, IList< string > >, bool)?) GetCurrentModSettings( string collectionName, - string modDirectory, string modName, bool allowInheritance ); - - // Try to set the inheritance state in the given collection of a mod specified by its directory name first or mod name second. - // Returns Okay, NothingChanged, CollectionMissing or ModMissing. - public PenumbraApiEc TryInheritMod( string collectionName, string modDirectory, string modName, bool inherit ); - - // Try to set the enabled state in the given collection of a mod specified by its directory name first or mod name second. Also removes inheritance. - // Returns Okay, NothingChanged, CollectionMissing or ModMissing. - public PenumbraApiEc TrySetMod( string collectionName, string modDirectory, string modName, bool enabled ); - - // Try to set the priority in the given collection of a mod specified by its directory name first or mod name second. Also removes inheritance. - // Returns Okay, NothingChanged, CollectionMissing or ModMissing. - public PenumbraApiEc TrySetModPriority( string collectionName, string modDirectory, string modName, int priority ); - - // Try to set a specific option group in the given collection of a mod specified by its directory name first or mod name second. Also removes inheritance. - // If the group is a Single Selection group, options should be a single string, otherwise the array of enabled options. - // Returns Okay, NothingChanged, CollectionMissing or ModMissing, OptionGroupMissing or SettingMissing. - // If any setting can not be found, it will not change anything. - public PenumbraApiEc TrySetModSetting( string collectionName, string modDirectory, string modName, string optionGroupName, string option ); - - public PenumbraApiEc TrySetModSettings( string collectionName, string modDirectory, string modName, string optionGroupName, - IReadOnlyList< string > options ); - - // This event gets fired when any setting in any collection changes. - public event ModSettingChanged? ModSettingChanged; - - #endregion - - #region Temporary - - // Create a temporary collection without actual settings but with a cache. - // If no character collection for this character exists or forceOverwriteCharacter is true, - // associate this collection to a specific character. - // Can return Okay, CharacterCollectionExists or NothingChanged, as well as the name of the new temporary collection on success. - public (PenumbraApiEc, string) CreateTemporaryCollection( string tag, string character, bool forceOverwriteCharacter ); - - // Remove the temporary collection associated with characterName if it exists. - // Can return Okay or NothingChanged. - public PenumbraApiEc RemoveTemporaryCollection( string characterName ); - - // Set a temporary mod with the given paths, manipulations and priority and the name tag to all collections. - // Can return Okay, InvalidGamePath, or InvalidManipulation. - public PenumbraApiEc AddTemporaryModAll( string tag, Dictionary< string, string > paths, string manipString, int priority ); - - // Set a temporary mod with the given paths, manipulations and priority and the name tag to the collection with the given name, which can be temporary. - // Can return Okay, MissingCollection InvalidGamePath, or InvalidManipulation. - public PenumbraApiEc AddTemporaryMod( string tag, string collectionName, Dictionary< string, string > paths, string manipString, - int priority ); - - // Remove the temporary mod with the given tag and priority from the temporary mods applying to all collections, if it exists. - // Can return Okay or NothingDone. - public PenumbraApiEc RemoveTemporaryModAll( string tag, int priority ); - - // Remove the temporary mod with the given tag and priority from the temporary mods applying to the collection of the given name, which can be temporary. - // Can return Okay or NothingDone. - public PenumbraApiEc RemoveTemporaryMod( string tag, string collectionName, int priority ); - - #endregion -} \ No newline at end of file diff --git a/tmp/IPenumbraApiBase.cs b/tmp/IPenumbraApiBase.cs deleted file mode 100644 index e4c452b4..00000000 --- a/tmp/IPenumbraApiBase.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace Penumbra.Api; - -public interface IPenumbraApiBase -{ - // The API version is staggered in two parts. - // The major/Breaking version only increments if there are changes breaking backwards compatibility. - // The minor/Feature version increments any time there is something added - // and resets when Breaking is incremented. - public (int Breaking, int Feature) ApiVersion { get; } - public bool Valid { get; } -} \ No newline at end of file diff --git a/tmp/Ipc/Collection.cs b/tmp/Ipc/Collection.cs deleted file mode 100644 index 3c40cd17..00000000 --- a/tmp/Ipc/Collection.cs +++ /dev/null @@ -1,76 +0,0 @@ -using System; -using System.Collections.Generic; -using Dalamud.Plugin; -using Penumbra.Api.Helpers; - -namespace Penumbra.Api; - -public static partial class Ipc -{ - public static class GetCollections - { - public const string Label = $"Penumbra.{nameof( GetCollections )}"; - - public static FuncProvider< IList< string > > Provider( DalamudPluginInterface pi, Func< IList< string > > func ) - => new(pi, Label, func); - - public static FuncSubscriber< IList< string > > Subscriber( DalamudPluginInterface pi ) - => new(pi, Label); - } - - public static class GetCurrentCollectionName - { - public const string Label = $"Penumbra.{nameof( GetCurrentCollectionName )}"; - - public static FuncProvider< string > Provider( DalamudPluginInterface pi, Func< string > func ) - => new(pi, Label, func); - - public static FuncSubscriber< string > Subscriber( DalamudPluginInterface pi ) - => new(pi, Label); - } - - public static class GetDefaultCollectionName - { - public const string Label = $"Penumbra.{nameof( GetDefaultCollectionName )}"; - - public static FuncProvider< string > Provider( DalamudPluginInterface pi, Func< string > func ) - => new(pi, Label, func); - - public static FuncSubscriber< string > Subscriber( DalamudPluginInterface pi ) - => new(pi, Label); - } - - public static class GetInterfaceCollectionName - { - public const string Label = $"Penumbra.{nameof( GetInterfaceCollectionName )}"; - - public static FuncProvider< string > Provider( DalamudPluginInterface pi, Func< string > func ) - => new(pi, Label, func); - - public static FuncSubscriber< string > Subscriber( DalamudPluginInterface pi ) - => new(pi, Label); - } - - public static class GetCharacterCollectionName - { - public const string Label = $"Penumbra.{nameof( GetCharacterCollectionName )}"; - - public static FuncProvider< string, (string, bool) > Provider( DalamudPluginInterface pi, Func< string, (string, bool) > func ) - => new(pi, Label, func); - - public static FuncSubscriber< string, (string, bool) > Subscriber( DalamudPluginInterface pi ) - => new(pi, Label); - } - - public static class GetChangedItems - { - public const string Label = $"Penumbra.{nameof( GetChangedItems )}"; - - public static FuncProvider< string, IReadOnlyDictionary< string, object? > > Provider( DalamudPluginInterface pi, - Func< string, IReadOnlyDictionary< string, object? > > func ) - => new(pi, Label, func); - - public static FuncSubscriber< string, IReadOnlyDictionary< string, object? > > Subscriber( DalamudPluginInterface pi ) - => new(pi, Label); - } -} \ No newline at end of file diff --git a/tmp/Ipc/Configuration.cs b/tmp/Ipc/Configuration.cs deleted file mode 100644 index 67033458..00000000 --- a/tmp/Ipc/Configuration.cs +++ /dev/null @@ -1,42 +0,0 @@ -using System; -using Dalamud.Plugin; -using Penumbra.Api.Helpers; - -namespace Penumbra.Api; - -public static partial class Ipc -{ - public static class GetModDirectory - { - public const string Label = $"Penumbra.{nameof( GetModDirectory )}"; - - public static FuncProvider< string > Provider( DalamudPluginInterface pi, Func< string > func ) - => new(pi, Label, func); - - public static FuncSubscriber< string > Subscriber( DalamudPluginInterface pi ) - => new(pi, Label); - } - - public static class GetConfiguration - { - public const string Label = $"Penumbra.{nameof( GetConfiguration )}"; - - public static FuncProvider< string > Provider( DalamudPluginInterface pi, Func< string > func ) - => new(pi, Label, func); - - public static FuncSubscriber< string > Subscriber( DalamudPluginInterface pi ) - => new(pi, Label); - } - - public static class ModDirectoryChanged - { - public const string Label = $"Penumbra.{nameof( ModDirectoryChanged )}"; - - public static EventProvider< string, bool > Provider( DalamudPluginInterface pi, - Action< Action< string, bool > > sub, Action< Action< string, bool > > unsub ) - => new(pi, Label, ( sub, unsub )); - - public static EventSubscriber< string, bool > Subscriber( DalamudPluginInterface pi, params Action< string, bool >[] actions ) - => new(pi, Label, actions); - } -} \ No newline at end of file diff --git a/tmp/Ipc/GameState.cs b/tmp/Ipc/GameState.cs deleted file mode 100644 index 89889fda..00000000 --- a/tmp/Ipc/GameState.cs +++ /dev/null @@ -1,63 +0,0 @@ -using System; -using Dalamud.Plugin; -using Penumbra.Api.Helpers; - -namespace Penumbra.Api; - -public static partial class Ipc -{ - public static class GetDrawObjectInfo - { - public const string Label = $"Penumbra.{nameof( GetDrawObjectInfo )}"; - - public static FuncProvider< nint, (nint, string) > Provider( DalamudPluginInterface pi, Func< nint, (nint, string) > func ) - => new(pi, Label, func); - - public static FuncSubscriber< nint, (nint, string) > Subscriber( DalamudPluginInterface pi ) - => new(pi, Label); - } - - public static class GetCutsceneParentIndex - { - public const string Label = $"Penumbra.{nameof( GetCutsceneParentIndex )}"; - - public static FuncProvider< int, int > Provider( DalamudPluginInterface pi, Func< int, int > func ) - => new(pi, Label, func); - - public static FuncSubscriber< int, int > Subscriber( DalamudPluginInterface pi ) - => new(pi, Label); - } - - public static class CreatingCharacterBase - { - public const string Label = $"Penumbra.{nameof( CreatingCharacterBase )}"; - - public static EventProvider< nint, string, nint, nint, nint > Provider( DalamudPluginInterface pi, Action add, Action del ) - => new(pi, Label, add, del); - - public static EventSubscriber< nint, string, nint, nint, nint > Subscriber( DalamudPluginInterface pi, params Action< nint, string, nint, nint, nint >[] actions ) - => new(pi, Label, actions); - } - - public static class CreatedCharacterBase - { - public const string Label = $"Penumbra.{nameof( CreatedCharacterBase )}"; - - public static EventProvider< nint, string, nint > Provider( DalamudPluginInterface pi, Action add, Action del ) - => new(pi, Label, add, del); - - public static EventSubscriber< nint, string, nint > Subscriber( DalamudPluginInterface pi, params Action< nint, string, nint >[] actions ) - => new(pi, Label, actions); - } - - public static class GameObjectResourcePathResolved - { - public const string Label = $"Penumbra.{nameof( GameObjectResourcePathResolved )}"; - - public static EventProvider< nint, string, string > Provider( DalamudPluginInterface pi, Action add, Action del ) - => new(pi, Label, add, del); - - public static EventSubscriber< nint, string, string > Subscriber( DalamudPluginInterface pi, params Action< nint, string, string >[] actions ) - => new(pi, Label, actions); - } -} \ No newline at end of file diff --git a/tmp/Ipc/Meta.cs b/tmp/Ipc/Meta.cs deleted file mode 100644 index ef889f43..00000000 --- a/tmp/Ipc/Meta.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System; -using Dalamud.Plugin; -using Penumbra.Api.Helpers; - -namespace Penumbra.Api; - -public static partial class Ipc -{ - public static class GetPlayerMetaManipulations - { - public const string Label = $"Penumbra.{nameof( GetPlayerMetaManipulations )}"; - - public static FuncProvider< string > Provider( DalamudPluginInterface pi, Func< string > func ) - => new(pi, Label, func); - - public static FuncSubscriber< string > Subscriber( DalamudPluginInterface pi ) - => new(pi, Label); - } - - public static class GetMetaManipulations - { - public const string Label = $"Penumbra.{nameof( GetMetaManipulations )}"; - - public static FuncProvider< string, string > Provider( DalamudPluginInterface pi, Func< string, string > func ) - => new(pi, Label, func); - - public static FuncSubscriber< string, string > Subscriber( DalamudPluginInterface pi ) - => new(pi, Label); - } -} \ No newline at end of file diff --git a/tmp/Ipc/ModSettings.cs b/tmp/Ipc/ModSettings.cs deleted file mode 100644 index 8a0e9cf8..00000000 --- a/tmp/Ipc/ModSettings.cs +++ /dev/null @@ -1,116 +0,0 @@ -using System; -using System.Collections.Generic; -using Dalamud.Plugin; -using Penumbra.Api.Enums; -using Penumbra.Api.Helpers; - -namespace Penumbra.Api; - -using CurrentSettings = ValueTuple< PenumbraApiEc, (bool, int, IDictionary< string, IList< string > >, bool)? >; - -public static partial class Ipc -{ - public static class GetAvailableModSettings - { - public const string Label = $"Penumbra.{nameof( GetAvailableModSettings )}"; - - public static FuncProvider< string, string, IDictionary< string, (IList< string >, GroupType) >? > Provider( - DalamudPluginInterface pi, Func< string, string, IDictionary< string, (IList< string >, GroupType) >? > func ) - => new(pi, Label, func); - - public static FuncSubscriber< string, string, IDictionary< string, (IList< string >, GroupType) >? > Subscriber( - DalamudPluginInterface pi ) - => new(pi, Label); - } - - public static class GetCurrentModSettings - { - public const string Label = $"Penumbra.{nameof( GetCurrentModSettings )}"; - - public static FuncProvider< string, string, string, bool, CurrentSettings > Provider( DalamudPluginInterface pi, - Func< string, string, string, bool, CurrentSettings > func ) - => new(pi, Label, func); - - public static FuncSubscriber< string, string, string, bool, CurrentSettings > Subscriber( - DalamudPluginInterface pi ) - => new(pi, Label); - } - - public static class TryInheritMod - { - public const string Label = $"Penumbra.{nameof( TryInheritMod )}"; - - public static FuncProvider< string, string, string, bool, PenumbraApiEc > Provider( DalamudPluginInterface pi, - Func< string, string, string, bool, PenumbraApiEc > func ) - => new(pi, Label, func); - - public static FuncSubscriber< string, string, string, bool, PenumbraApiEc > Subscriber( - DalamudPluginInterface pi ) - => new(pi, Label); - } - - public static class TrySetMod - { - public const string Label = $"Penumbra.{nameof( TrySetMod )}"; - - public static FuncProvider< string, string, string, bool, PenumbraApiEc > Provider( DalamudPluginInterface pi, - Func< string, string, string, bool, PenumbraApiEc > func ) - => new(pi, Label, func); - - public static FuncSubscriber< string, string, string, bool, PenumbraApiEc > Subscriber( - DalamudPluginInterface pi ) - => new(pi, Label); - } - - public static class TrySetModPriority - { - public const string Label = $"Penumbra.{nameof( TrySetModPriority )}"; - - public static FuncProvider< string, string, string, int, PenumbraApiEc > Provider( DalamudPluginInterface pi, - Func< string, string, string, int, PenumbraApiEc > func ) - => new(pi, Label, func); - - public static FuncSubscriber< string, string, string, int, PenumbraApiEc > Subscriber( - DalamudPluginInterface pi ) - => new(pi, Label); - } - - public static class TrySetModSetting - { - public const string Label = $"Penumbra.{nameof( TrySetModSetting )}"; - - public static FuncProvider< string, string, string, string, string, PenumbraApiEc > Provider( DalamudPluginInterface pi, - Func< string, string, string, string, string, PenumbraApiEc > func ) - => new(pi, Label, func); - - public static FuncSubscriber< string, string, string, string, string, PenumbraApiEc > Subscriber( - DalamudPluginInterface pi ) - => new(pi, Label); - } - - public static class TrySetModSettings - { - public const string Label = $"Penumbra.{nameof( TrySetModSettings )}"; - - public static FuncProvider< string, string, string, string, IReadOnlyList< string >, PenumbraApiEc > Provider( - DalamudPluginInterface pi, - Func< string, string, string, string, IReadOnlyList< string >, PenumbraApiEc > func ) - => new(pi, Label, func); - - public static FuncSubscriber< string, string, string, string, IReadOnlyList< string >, PenumbraApiEc > Subscriber( - DalamudPluginInterface pi ) - => new(pi, Label); - } - - public static class ModSettingChanged - { - public const string Label = $"Penumbra.{nameof( ModSettingChanged )}"; - - public static EventProvider< ModSettingChange, string, string, bool > Provider( DalamudPluginInterface pi, Action add, Action del ) - => new(pi, Label, add, del); - - public static EventSubscriber< ModSettingChange, string, string, bool > Subscriber( DalamudPluginInterface pi, - params Action< ModSettingChange, string, string, bool >[] actions ) - => new(pi, Label, actions); - } -} \ No newline at end of file diff --git a/tmp/Ipc/Mods.cs b/tmp/Ipc/Mods.cs deleted file mode 100644 index d5d09036..00000000 --- a/tmp/Ipc/Mods.cs +++ /dev/null @@ -1,81 +0,0 @@ -using System; -using System.Collections.Generic; -using Dalamud.Plugin; -using Penumbra.Api.Enums; -using Penumbra.Api.Helpers; - -namespace Penumbra.Api; - -public static partial class Ipc -{ - public static class GetMods - { - public const string Label = $"Penumbra.{nameof( GetMods )}"; - - public static FuncProvider< IList< (string, string) > > Provider( DalamudPluginInterface pi, Func< IList< (string, string) > > func ) - => new(pi, Label, func); - - public static FuncSubscriber< IList< (string, string) > > Subscriber( DalamudPluginInterface pi ) - => new(pi, Label); - } - - public static class ReloadMod - { - public const string Label = $"Penumbra.{nameof( ReloadMod )}"; - - public static FuncProvider< string, string, PenumbraApiEc > Provider( DalamudPluginInterface pi, - Func< string, string, PenumbraApiEc > func ) - => new(pi, Label, func); - - public static FuncSubscriber< string, string, PenumbraApiEc > Subscriber( DalamudPluginInterface pi ) - => new(pi, Label); - } - - public static class AddMod - { - public const string Label = $"Penumbra.{nameof( AddMod )}"; - - public static FuncProvider< string, PenumbraApiEc > Provider( DalamudPluginInterface pi, - Func< string, PenumbraApiEc > func ) - => new(pi, Label, func); - - public static FuncSubscriber< string, PenumbraApiEc > Subscriber( DalamudPluginInterface pi ) - => new(pi, Label); - } - - public static class DeleteMod - { - public const string Label = $"Penumbra.{nameof( DeleteMod )}"; - - public static FuncProvider< string, string, PenumbraApiEc > Provider( DalamudPluginInterface pi, - Func< string, string, PenumbraApiEc > func ) - => new(pi, Label, func); - - public static FuncSubscriber< string, string, PenumbraApiEc > Subscriber( DalamudPluginInterface pi ) - => new(pi, Label); - } - - public static class GetModPath - { - public const string Label = $"Penumbra.{nameof( GetModPath )}"; - - public static FuncProvider< string, string, (PenumbraApiEc, string, bool) > Provider( DalamudPluginInterface pi, - Func< string, string, (PenumbraApiEc, string, bool) > func ) - => new(pi, Label, func); - - public static FuncSubscriber< string, string, (PenumbraApiEc, string, bool) > Subscriber( DalamudPluginInterface pi ) - => new(pi, Label); - } - - public static class SetModPath - { - public const string Label = $"Penumbra.{nameof( SetModPath )}"; - - public static FuncProvider< string, string, string, PenumbraApiEc > Provider( DalamudPluginInterface pi, - Func< string, string, string, PenumbraApiEc > func ) - => new(pi, Label, func); - - public static FuncSubscriber< string, string, string, PenumbraApiEc > Subscriber( DalamudPluginInterface pi ) - => new(pi, Label); - } -} \ No newline at end of file diff --git a/tmp/Ipc/PluginState.cs b/tmp/Ipc/PluginState.cs deleted file mode 100644 index 500bf1ee..00000000 --- a/tmp/Ipc/PluginState.cs +++ /dev/null @@ -1,68 +0,0 @@ -using System; -using Dalamud.Plugin; -using Penumbra.Api.Helpers; - -namespace Penumbra.Api; - -public static partial class Ipc -{ - public static class Initialized - { - public const string Label = $"Penumbra.{nameof( Initialized )}"; - - public static EventProvider Provider( DalamudPluginInterface pi ) - => new(pi, Label); - - public static EventSubscriber Subscriber( DalamudPluginInterface pi, params Action[] actions ) - { - var ret = new EventSubscriber( pi, Label ); - foreach( var action in actions ) - { - ret.Event += action; - } - - return ret; - } - } - - public static class Disposed - { - public const string Label = $"Penumbra.{nameof( Disposed )}"; - - public static EventProvider Provider( DalamudPluginInterface pi ) - => new(pi, Label); - - public static EventSubscriber Subscriber( DalamudPluginInterface pi, params Action[] actions ) - { - var ret = new EventSubscriber( pi, Label ); - foreach( var action in actions ) - { - ret.Event += action; - } - - return ret; - } - } - - public static class ApiVersion - { - public const string Label = $"Penumbra.{nameof( ApiVersion )}"; - - public static FuncProvider< int > Provider( DalamudPluginInterface pi, Func< int > func ) - => new(pi, Label, func); - - public static FuncSubscriber< int > Subscriber( DalamudPluginInterface pi ) - => new(pi, Label); - } - - public static class ApiVersions - { - public const string Label = $"Penumbra.{nameof( ApiVersions )}"; - - public static FuncProvider< (int Breaking, int Features) > Provider( DalamudPluginInterface pi, Func< (int, int) > func ) - => new(pi, Label, func); - - public static FuncSubscriber< (int Breaking, int Features) > Subscriber( DalamudPluginInterface pi ) - => new(pi, Label); - } -} \ No newline at end of file diff --git a/tmp/Ipc/Redraw.cs b/tmp/Ipc/Redraw.cs deleted file mode 100644 index 396dfe8a..00000000 --- a/tmp/Ipc/Redraw.cs +++ /dev/null @@ -1,65 +0,0 @@ -using System; -using Dalamud.Game.ClientState.Objects.Types; -using Dalamud.Plugin; -using Penumbra.Api.Enums; -using Penumbra.Api.Helpers; - -namespace Penumbra.Api; - -public static partial class Ipc -{ - public static class RedrawAll - { - public const string Label = $"Penumbra.{nameof( RedrawAll )}"; - - public static ActionProvider< RedrawType > Provider( DalamudPluginInterface pi, Action< RedrawType > action ) - => new(pi, Label, action); - - public static ActionSubscriber< RedrawType > Subscriber( DalamudPluginInterface pi ) - => new(pi, Label); - } - - public static class RedrawObject - { - public const string Label = $"Penumbra.{nameof( RedrawObject )}"; - - public static ActionProvider< GameObject, RedrawType > Provider( DalamudPluginInterface pi, Action< GameObject, RedrawType > action ) - => new(pi, Label, action); - - public static ActionSubscriber< GameObject, RedrawType > Subscriber( DalamudPluginInterface pi ) - => new(pi, Label); - } - - public static class RedrawObjectByIndex - { - public const string Label = $"Penumbra.{nameof( RedrawObjectByIndex )}"; - - public static ActionProvider< int, RedrawType > Provider( DalamudPluginInterface pi, Action< int, RedrawType > action ) - => new(pi, Label, action); - - public static ActionSubscriber< int, RedrawType > Subscriber( DalamudPluginInterface pi ) - => new(pi, Label); - } - - public static class RedrawObjectByName - { - public const string Label = $"Penumbra.{nameof( RedrawObjectByName )}"; - - public static ActionProvider< string, RedrawType > Provider( DalamudPluginInterface pi, Action< string, RedrawType > action ) - => new(pi, Label, action); - - public static ActionSubscriber< string, RedrawType > Subscriber( DalamudPluginInterface pi ) - => new(pi, Label); - } - - public static class GameObjectRedrawn - { - public const string Label = $"Penumbra.{nameof( GameObjectRedrawn )}"; - - public static EventProvider< nint, int > Provider( DalamudPluginInterface pi, Action add, Action del ) - => new(pi, Label, add, del); - - public static EventSubscriber< nint, int > Subscriber( DalamudPluginInterface pi, params Action< nint, int >[] actions ) - => new(pi, Label, actions); - } -} \ No newline at end of file diff --git a/tmp/Ipc/Resolve.cs b/tmp/Ipc/Resolve.cs deleted file mode 100644 index 8b9eb953..00000000 --- a/tmp/Ipc/Resolve.cs +++ /dev/null @@ -1,74 +0,0 @@ -using System; -using Dalamud.Plugin; -using Penumbra.Api.Helpers; - -namespace Penumbra.Api; - -public static partial class Ipc -{ - public static class ResolveDefaultPath - { - public const string Label = $"Penumbra.{nameof( ResolveDefaultPath )}"; - - public static FuncProvider< string, string > Provider( DalamudPluginInterface pi, Func< string, string > func ) - => new(pi, Label, func); - - public static FuncSubscriber< string, string > Subscriber( DalamudPluginInterface pi ) - => new(pi, Label); - } - - public static class ResolveInterfacePath - { - public const string Label = $"Penumbra.{nameof( ResolveInterfacePath )}"; - - public static FuncProvider< string, string > Provider( DalamudPluginInterface pi, Func< string, string > func ) - => new(pi, Label, func); - - public static FuncSubscriber< string, string > Subscriber( DalamudPluginInterface pi ) - => new(pi, Label); - } - - public static class ResolvePlayerPath - { - public const string Label = $"Penumbra.{nameof( ResolvePlayerPath )}"; - - public static FuncProvider< string, string > Provider( DalamudPluginInterface pi, Func< string, string > func ) - => new(pi, Label, func); - - public static FuncSubscriber< string, string > Subscriber( DalamudPluginInterface pi ) - => new(pi, Label); - } - - public static class ResolveCharacterPath - { - public const string Label = $"Penumbra.{nameof( ResolveCharacterPath )}"; - - public static FuncProvider< string, string, string > Provider( DalamudPluginInterface pi, Func< string, string, string > func ) - => new(pi, Label, func); - - public static FuncSubscriber< string, string, string > Subscriber( DalamudPluginInterface pi ) - => new(pi, Label); - } - - public static class ReverseResolvePath - { - public const string Label = $"Penumbra.{nameof( ReverseResolvePath )}"; - - public static FuncProvider< string, string, string[] > Provider( DalamudPluginInterface pi, Func< string, string, string[] > func ) - => new(pi, Label, func); - - public static FuncSubscriber< string, string, string[] > Subscriber( DalamudPluginInterface pi ) - => new(pi, Label); - } - - public static class ReverseResolvePlayerPath - { - public const string Label = $"Penumbra.{nameof( ReverseResolvePlayerPath )}"; - - public static FuncProvider< string, string[] > Provider( DalamudPluginInterface pi, Func< string, string[] > func ) - => new(pi, Label, func); - - public static FuncSubscriber< string, string[] > Subscriber( DalamudPluginInterface pi ) - => new(pi, Label); - } -} \ No newline at end of file diff --git a/tmp/Ipc/Temporary.cs b/tmp/Ipc/Temporary.cs deleted file mode 100644 index 55af6f22..00000000 --- a/tmp/Ipc/Temporary.cs +++ /dev/null @@ -1,83 +0,0 @@ -using System; -using System.Collections.Generic; -using Dalamud.Plugin; -using Penumbra.Api.Enums; -using Penumbra.Api.Helpers; - -namespace Penumbra.Api; - -public static partial class Ipc -{ - public static class CreateTemporaryCollection - { - public const string Label = $"Penumbra.{nameof( CreateTemporaryCollection )}"; - - public static FuncProvider< string, string, bool, (PenumbraApiEc, string) > Provider( DalamudPluginInterface pi, - Func< string, string, bool, (PenumbraApiEc, string) > func ) - => new(pi, Label, func); - - public static FuncSubscriber< string, string, bool, (PenumbraApiEc, string) > Subscriber( DalamudPluginInterface pi ) - => new(pi, Label); - } - - public static class RemoveTemporaryCollection - { - public const string Label = $"Penumbra.{nameof( RemoveTemporaryCollection )}"; - - public static FuncProvider< string, PenumbraApiEc > Provider( DalamudPluginInterface pi, - Func< string, PenumbraApiEc > func ) - => new(pi, Label, func); - - public static FuncSubscriber< string, PenumbraApiEc > Subscriber( DalamudPluginInterface pi ) - => new(pi, Label); - } - - public static class AddTemporaryModAll - { - public const string Label = $"Penumbra.{nameof( AddTemporaryModAll )}"; - - public static FuncProvider< string, Dictionary< string, string >, string, int, PenumbraApiEc > Provider( - DalamudPluginInterface pi, Func< string, Dictionary< string, string >, string, int, PenumbraApiEc > func ) - => new(pi, Label, func); - - public static FuncSubscriber< string, Dictionary< string, string >, string, int, PenumbraApiEc > Subscriber( DalamudPluginInterface pi ) - => new(pi, Label); - } - - public static class AddTemporaryMod - { - public const string Label = $"Penumbra.{nameof( AddTemporaryMod )}"; - - public static FuncProvider< string, string, Dictionary< string, string >, string, int, PenumbraApiEc > Provider( - DalamudPluginInterface pi, Func< string, string, Dictionary< string, string >, string, int, PenumbraApiEc > func ) - => new(pi, Label, func); - - public static FuncSubscriber< string, string, Dictionary< string, string >, string, int, PenumbraApiEc > Subscriber( - DalamudPluginInterface pi ) - => new(pi, Label); - } - - public static class RemoveTemporaryModAll - { - public const string Label = $"Penumbra.{nameof( RemoveTemporaryModAll )}"; - - public static FuncProvider< string, int, PenumbraApiEc > Provider( - DalamudPluginInterface pi, Func< string, int, PenumbraApiEc > func ) - => new(pi, Label, func); - - public static FuncSubscriber< string, int, PenumbraApiEc > Subscriber( DalamudPluginInterface pi ) - => new(pi, Label); - } - - public static class RemoveTemporaryMod - { - public const string Label = $"Penumbra.{nameof( RemoveTemporaryMod )}"; - - public static FuncProvider< string, string, int, PenumbraApiEc > Provider( - DalamudPluginInterface pi, Func< string, string, int, PenumbraApiEc > func ) - => new(pi, Label, func); - - public static FuncSubscriber< string, string, int, PenumbraApiEc > Subscriber( DalamudPluginInterface pi ) - => new(pi, Label); - } -} \ No newline at end of file diff --git a/tmp/Ipc/Ui.cs b/tmp/Ipc/Ui.cs deleted file mode 100644 index d88d6718..00000000 --- a/tmp/Ipc/Ui.cs +++ /dev/null @@ -1,55 +0,0 @@ -using System; -using Dalamud.Plugin; -using Penumbra.Api.Enums; -using Penumbra.Api.Helpers; - -namespace Penumbra.Api; - -public static partial class Ipc -{ - public static class PreSettingsDraw - { - public const string Label = $"Penumbra.{nameof( PreSettingsDraw )}"; - - public static EventProvider< string > Provider( DalamudPluginInterface pi, Action< Action< string > > sub, - Action< Action< string > > unsub ) - => new(pi, Label, ( sub, unsub )); - - public static EventSubscriber< string > Subscriber( DalamudPluginInterface pi, params Action< string >[] actions ) - => new(pi, Label, actions); - } - - public static class PostSettingsDraw - { - public const string Label = $"Penumbra.{nameof( PostSettingsDraw )}"; - - public static EventProvider< string > Provider( DalamudPluginInterface pi, Action< Action< string > > sub, - Action< Action< string > > unsub ) - => new(pi, Label, ( sub, unsub )); - - public static EventSubscriber< string > Subscriber( DalamudPluginInterface pi, params Action< string >[] actions ) - => new(pi, Label, actions); - } - - public static class ChangedItemTooltip - { - public const string Label = $"Penumbra.{nameof( ChangedItemTooltip )}"; - - public static EventProvider< ChangedItemType, uint > Provider( DalamudPluginInterface pi, Action add, Action del ) - => new(pi, Label, add, del); - - public static EventSubscriber< ChangedItemType, uint > Subscriber( DalamudPluginInterface pi, params Action< ChangedItemType, uint >[] actions ) - => new(pi, Label, actions); - } - - public static class ChangedItemClick - { - public const string Label = $"Penumbra.{nameof( ChangedItemClick )}"; - - public static EventProvider< MouseButton, ChangedItemType, uint > Provider( DalamudPluginInterface pi, Action add, Action del ) - => new(pi, Label, add, del); - - public static EventSubscriber< MouseButton, ChangedItemType, uint > Subscriber( DalamudPluginInterface pi, params Action< MouseButton, ChangedItemType, uint >[] actions ) - => new(pi, Label, actions); - } -} \ No newline at end of file diff --git a/tmp/Penumbra.Api.csproj b/tmp/Penumbra.Api.csproj deleted file mode 100644 index 8962883b..00000000 --- a/tmp/Penumbra.Api.csproj +++ /dev/null @@ -1,47 +0,0 @@ - - - net6.0-windows - preview - x64 - Penumbra.Api - absolute gangstas - Penumbra - Copyright © 2022 - 1.0.0.0 - 1.0.0.0 - bin\$(Configuration)\ - true - enable - true - false - false - - - - full - DEBUG;TRACE - - - - pdbonly - - - - $(MSBuildWarningsAsMessages);MSB3277 - - - - $(AppData)\XIVLauncher\addon\Hooks\dev\ - - - - - $(DalamudLibPath)Dalamud.dll - False - - - $(DalamudLibPath)Lumina.dll - False - - - diff --git a/tmp/Penumbra.Api.csproj.DotSettings b/tmp/Penumbra.Api.csproj.DotSettings deleted file mode 100644 index 7d7508cb..00000000 --- a/tmp/Penumbra.Api.csproj.DotSettings +++ /dev/null @@ -1,2 +0,0 @@ - - True \ No newline at end of file diff --git a/tmp/README.md b/tmp/README.md deleted file mode 100644 index 1e9bdf1a..00000000 --- a/tmp/README.md +++ /dev/null @@ -1,4 +0,0 @@ -# Penumbra - -This is an auxiliary repository for Penumbras external API. -For more information, see the [main repo](https://github.com/xivdev/Penumbra). \ No newline at end of file