Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom Save and Reload implementations for ConfigFile #243

Conversation

Algorithman
Copy link

Description

Made ConfigFile class more versatile with virtual Save and Reload methods.
The type to use for the ConfigFile implementation can be added as BepInConfigType attribute to the BaseUnityPlugin class.

Motivation and Context

More and more games go online, so we had to work around issues involving server side only configuration values, but still keep them all inside one ConfigFile instance.
This not also addresses this, it also addresses others who might want to use their own file format.
The custom implementation can be done overriding SaveImplementation() and ReloadImplementation() methods.

How Has This Been Tested?

Checked it inside our Valheim plugin, our ConfigFile implementation is instanced correctly and loaded/saved also correctly.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

- added virtual SaveImplementation() and ReloadImplementation() methods (called by Save() and Reload())
- Added Activator code to BaseUnityPlugin to use the specified type for the ConfigFile
…with different ConfigFile implementations. Use the first one found while walking up the class tree.
@ghorsington
Copy link
Contributor

The extendable configuration files are now being implemented as part of #267 and its general configuration overhaul

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.

None yet

2 participants