Exemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PlayerTrackProvider"/> class.
        /// </summary>
        /// <param name="pluginInterface">plugin interface.</param>
        /// <param name="api">plugin api.</param>
        public PlayerTrackProvider(DalamudPluginInterface pluginInterface, IPlayerTrackAPI api)
        {
            this.API = api;

            try
            {
                this.ProviderAPIVersion = pluginInterface.GetIpcProvider <int>(LabelProviderApiVersion);
                this.ProviderAPIVersion.RegisterFunc(() => api.APIVersion);
            }
            catch (Exception ex)
            {
                Logger.LogError($"Error registering IPC provider for {LabelProviderApiVersion}:\n{ex}");
            }

            try
            {
                this.ProviderGetPlayerCurrentNameWorld =
                    pluginInterface.GetIpcProvider <string, uint, string>(LabelProviderGetPlayerCurrentNameWorld);
                this.ProviderGetPlayerCurrentNameWorld.RegisterFunc(api.GetPlayerCurrentNameWorld);
            }
            catch (Exception e)
            {
                Logger.LogError($"Error registering IPC provider for {LabelProviderGetPlayerCurrentNameWorld}:\n{e}");
            }
        }
    private void InitForSelf()
    {
        _currentSongProvider = OrchestrionPlugin.PluginInterface.GetIpcProvider <int>("Orch.CurrentSong");
        _currentSongProvider.RegisterFunc(CurrentSongFunc);

        _playSongProvider = OrchestrionPlugin.PluginInterface.GetIpcProvider <int, bool>("Orch.PlaySong");
        _playSongProvider.RegisterFunc(PlaySongFunc);

        _songInfoProvider = OrchestrionPlugin.PluginInterface.GetIpcProvider <int, Song>("Orch.SongInfo");
        _songInfoProvider.RegisterFunc(songId => SongList.SongExists(songId) ? SongList.GetSong(songId) : default);
Exemplo n.º 3
0
        public DiscordBridgeProvider(DalamudPluginInterface pluginInterface, IDiscordBridgeAPI api)
        {
            try
            {
                this.providerAPIVersion = pluginInterface.GetIpcProvider <int>(LabelProviderApiVersion);
                this.providerAPIVersion.RegisterFunc(() => api.APIVersion);

                this.providerSendMessage =
                    pluginInterface.GetIpcProvider <string, string, string, object>(LabelProviderSendMessage);
                this.providerSendMessage.RegisterAction(api.SendMessage);
            }
            catch (Exception ex)
            {
                PluginLog.LogError($"Error registering IPC provider:\n{ex}");
            }
        }
Exemplo n.º 4
0
 private void InitIpc()
 {
     try
     {
         IpcProvider = this.pluginInterface.GetIpcProvider <object, object>("PingPlugin.Ipc");
         this.pingTracker.OnPingUpdated += payload =>
         {
             dynamic obj = new ExpandoObject();
             obj.LastRTT    = payload.LastRTT;
             obj.AverageRTT = payload.AverageRTT;
             IpcProvider.SendMessage(obj);
         };
     }
     catch (Exception e)
     {
         PluginLog.Error($"Error registering IPC provider:\n{e}");
     }
 }
Exemplo n.º 5
0
        public PenumbraIpc(DalamudPluginInterface pi, IPenumbraApi api)
        {
            Api = api;

            try
            {
                ProviderApiVersion = pi.GetIpcProvider <int>(LabelProviderApiVersion);
                ProviderApiVersion.RegisterFunc(() => api.ApiVersion);
            }
            catch (Exception e)
            {
                PluginLog.Error($"Error registering IPC provider for {LabelProviderApiVersion}:\n{e}");
            }

            try
            {
                ProviderRedrawName = pi.GetIpcProvider <string, int, object>(LabelProviderRedrawName);
                ProviderRedrawName.RegisterAction((s, i) => api.RedrawObject(s, CheckRedrawType(i)));
            }
            catch (Exception e)
            {
                PluginLog.Error($"Error registering IPC provider for {LabelProviderRedrawName}:\n{e}");
            }

            try
            {
                ProviderRedrawObject = pi.GetIpcProvider <GameObject, int, object>(LabelProviderRedrawObject);
                ProviderRedrawObject.RegisterAction((o, i) => api.RedrawObject(o, CheckRedrawType(i)));
            }
            catch (Exception e)
            {
                PluginLog.Error($"Error registering IPC provider for {LabelProviderRedrawObject}:\n{e}");
            }

            try
            {
                ProviderRedrawAll = pi.GetIpcProvider <int, object>(LabelProviderRedrawAll);
                ProviderRedrawAll.RegisterAction(i => api.RedrawAll(CheckRedrawType(i)));
            }
            catch (Exception e)
            {
                PluginLog.Error($"Error registering IPC provider for {LabelProviderRedrawAll}:\n{e}");
            }

            try
            {
                ProviderResolveDefault = pi.GetIpcProvider <string, string>(LabelProviderResolveDefault);
                ProviderResolveDefault.RegisterFunc(api.ResolvePath);
            }
            catch (Exception e)
            {
                PluginLog.Error($"Error registering IPC provider for {LabelProviderResolveDefault}:\n{e}");
            }

            try
            {
                ProviderResolveCharacter = pi.GetIpcProvider <string, string, string>(LabelProviderResolveCharacter);
                ProviderResolveCharacter.RegisterFunc(api.ResolvePath);
            }
            catch (Exception e)
            {
                PluginLog.Error($"Error registering IPC provider for {LabelProviderResolveCharacter}:\n{e}");
            }

            try
            {
                ProviderChangedItemTooltip = pi.GetIpcProvider <ChangedItemType, uint, object>(LabelProviderChangedItemTooltip);
                api.ChangedItemTooltip    += OnTooltip;
            }
            catch (Exception e)
            {
                PluginLog.Error($"Error registering IPC provider for {LabelProviderChangedItemTooltip}:\n{e}");
            }

            try
            {
                ProviderChangedItemClick = pi.GetIpcProvider <MouseButton, ChangedItemType, uint, object>(LabelProviderChangedItemClick);
                api.ChangedItemClicked  += OnClick;
            }
            catch (Exception e)
            {
                PluginLog.Error($"Error registering IPC provider for {LabelProviderChangedItemClick}:\n{e}");
            }

            try
            {
                ProviderGetChangedItems = pi.GetIpcProvider <string, IReadOnlyDictionary <string, object?> >(LabelProviderGetChangedItems);
                ProviderGetChangedItems.RegisterFunc(api.GetChangedItemsForCollection);
            }
            catch (Exception e)
            {
                PluginLog.Error($"Error registering IPC provider for {LabelProviderChangedItemClick}:\n{e}");
            }
        }
        public VisibilityProvider(IVisibilityApi api)
        {
            this.Api = api;

            try
            {
                this.ProviderApiVersion = VisibilityPlugin.PluginInterface.GetIpcProvider <int>(LabelProviderApiVersion);
                this.ProviderApiVersion.RegisterFunc(() => api.ApiVersion);
            }
            catch (Exception e)
            {
                PluginLog.Error($"Error registering IPC provider for {LabelProviderApiVersion}:\n{e}");
            }

            try
            {
                this.ProviderGetVoidListEntries =
                    VisibilityPlugin.PluginInterface.GetIpcProvider <IEnumerable <string> >(LabelProviderGetVoidListEntries);
                this.ProviderGetVoidListEntries.RegisterFunc(api.GetVoidListEntries);
            }
            catch (Exception e)
            {
                PluginLog.Error($"Error registering IPC provider for {LabelProviderGetVoidListEntries}:\n{e}");
            }

            try
            {
                this.ProviderAddToVoidList =
                    VisibilityPlugin.PluginInterface.GetIpcProvider <string, uint, string, object>(LabelProviderAddToVoidList);
                this.ProviderAddToVoidList.RegisterAction(api.AddToVoidList);
            }
            catch (Exception e)
            {
                PluginLog.Error($"Error registering IPC provider for {LabelProviderAddToVoidList}:\n{e}");
            }

            try
            {
                this.ProviderRemoveFromVoidList =
                    VisibilityPlugin.PluginInterface.GetIpcProvider <string, uint, object>(LabelProviderRemoveFromVoidList);
                this.ProviderRemoveFromVoidList.RegisterAction(api.RemoveFromVoidList);
            }
            catch (Exception e)
            {
                PluginLog.Error($"Error registering IPC provider for {LabelProviderRemoveFromVoidList}:\n{e}");
            }

            try
            {
                this.ProviderGetWhitelistEntries =
                    VisibilityPlugin.PluginInterface.GetIpcProvider <IEnumerable <string> >(LabelProviderGetWhitelistEntries);
                this.ProviderGetWhitelistEntries.RegisterFunc(api.GetWhitelistEntries);
            }
            catch (Exception e)
            {
                PluginLog.Error($"Error registering IPC provider for {LabelProviderGetWhitelistEntries}:\n{e}");
            }

            try
            {
                this.ProviderAddToWhitelist =
                    VisibilityPlugin.PluginInterface.GetIpcProvider <string, uint, string, object>(LabelProviderAddToWhitelist);
                this.ProviderAddToWhitelist.RegisterAction(api.AddToWhitelist);
            }
            catch (Exception e)
            {
                PluginLog.Error($"Error registering IPC provider for {LabelProviderAddToWhitelist}:\n{e}");
            }

            try
            {
                this.ProviderRemoveFromWhitelist =
                    VisibilityPlugin.PluginInterface.GetIpcProvider <string, uint, object>(LabelProviderRemoveFromWhitelist);
                this.ProviderRemoveFromWhitelist.RegisterAction(api.RemoveFromWhitelist);
            }
            catch (Exception e)
            {
                PluginLog.Error($"Error registering IPC provider for {LabelProviderRemoveFromWhitelist}:\n{e}");
            }

            try
            {
                this.ProviderEnable =
                    VisibilityPlugin.PluginInterface.GetIpcProvider <bool, object>(LabelProviderEnable);
                this.ProviderEnable.RegisterAction(api.Enable);
            }
            catch (Exception e)
            {
                PluginLog.Error($"Error registering IPC provider for {LabelProviderEnable}:\n{e}");
            }
        }