Skip to content

Comments

Refactor BaseProviderManager for easier 3rd party extendability#167

Open
Skunkynator wants to merge 1 commit intoAeroluna:masterfrom
Skunkynator:BaseProviderRework
Open

Refactor BaseProviderManager for easier 3rd party extendability#167
Skunkynator wants to merge 1 commit intoAeroluna:masterfrom
Skunkynator:BaseProviderRework

Conversation

@Skunkynator
Copy link

Adds the ability for other Plugins to extend BaseProviderManager easily

Example class that is installed in "Location.App" using these methods

public class Example
{
    private BaseProviderManagerProvider(BaseProviderManager manager, FeaturesModule featuresModule)
    {
        // not required if your provider cant contain dot character
        manager.AddDynamicSeperator("example", (string call, out string rest) =>
        {
            rest = "";
            if (!featuresModule.Active)
                return "";

            // Do your stuff

            throw new NotImplementedException();
        });

        manager.AddDynamicProvider("example", key =>
        {
            if (!featuresModule.Active)
                return null;

            // Do your stuff

            throw new NotImplementedException();
        });

        manager.AddModifierHandler((string key, IValues provider, out string rest) =>
        {
            rest = "";
            if (!featuresModule.Active)
                return null;

            // Do your stuff

            return null;
        });
    }
}

Im up to change the implementation if any concerns arise.

@Skunkynator Skunkynator force-pushed the BaseProviderRework branch 2 times, most recently from 6a30210 to be33f2b Compare March 23, 2025 17:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant