You are viewing a potentially older version of this package. View all versions.
Owen3H-CSync-2.2.3 icon

CSync

Configuration file syncing library for BepInEx.

Date uploaded 8 months ago
Version 2.2.3
Download link Owen3H-CSync-2.2.3.zip
Downloads 12011
Dependency string Owen3H-CSync-2.2.3

This mod requires the following mods to function

BepInEx-BepInExPack-5.4.2100 icon
BepInEx-BepInExPack

BepInEx pack for Mono Unity games. Preconfigured and ready to use.

Preferred version: 5.4.2100

README

CSync

An easy-to-implement configuration syncing library for BepInEx files.
This library will help devs share settings from the host to all other clients.

To setup and use CSync, pleaser refer to the wiki. Join my discord to contact me.

Features

  • Can serialize a ConfigEntry with a drop-in replacement. (SyncedEntry)
  • No seperate config file system, retains BepInEx support.
  • Uses DataContractSerializer, a fast and safer alternative to BinaryFormatter.
  • Provides helpful extension methods.

Important Notes

  • This is NOT a standalone mod, it is intended for mod developers and does nothing on its own!
  • This does NOT edit or replace config files directly, everything is done in-memory.
  • It will NOT sync configs from mods that aren't dependent upon it.
  • CSync uses Unity's Named Messages to avoid Netcode Patcher and NetworkBehaviour.

License

This project has the CC BY-NC-SA 4.0 license.
This means the following terms apply:

Attribution
If you remix or adapt this project, appropriate credit must be given.
Cloning the repo with intent to contribute is not subject to this.

NonCommercial
You may not use this material for commercial purposes.

ShareAlike
When remixing, adapting or building upon this material, you must distribute the new material under the same license as the original.

CHANGELOG

v3.0.1

  • Fix CHANGELOG and repo link.

v3.0.0

This update should only be breaking for mods that are subscribed to events. I invite you to join my discord if you have any issues.

Due to my work on other projects, a few features that were intended for this version will have to wait. This also means you can safely revert to this version if need be, without losing all of the following changes.

Changelog

  • CSync should now work with all BepInEx and Unity NGO enabled games by default!
  • Fixed issue where an entry would not function properly when passing a ConfigDescription to BindSyncedEntry.
  • Removed the annoying 'max buffer size' debug log that could possibly show when a client joined.
  • Improved logging surrounding the SyncInstance method (prefixed GUID + error when null passed).
  • Implemented a config file to control patching. Only edit this in rare, edge-case situations.
  • Converted all events from EventHandler to Action for nicer usage.

    See the wiki on how to update.

  • Removed unnecessary Synced bool in SyncedConfig to slightly reduce payload size.

    You can recreate this yourself with SyncComplete if desired.

  • Implemented the following list of serializable Unity types should you need them.
    • SVector (2, 3 and 4)
    • SQuaternion
    • SColor

v2.2.4

  • Fixed dependency bug introduced in v2.2.2. io.github.CSync should work again.

v2.2.3

  • Just README and icon changes. Thanks Thunderstore /s

v2.2.2

  • Little bit more documentation.
  • Removed redundent Metadata file.

v2.2.1

  • Removed accidental assembly reference to LethalConfig.
  • Provided documentation (CSync.xml) file for non-nuget users.

v2.2.0

  • Added new SyncRequested and SyncReceived events because why not.
  • Implemented EnableHostSyncControl to let the host determine if clients can use their own config.

    Documentation is provided for this method.

v2.1.0

  • Added a new SyncReverted event and moved events to SyncedInstance.
  • Added more documentation throughout the library.
  • Fixed access modifiers on some methods that should not have been public.
  • Logs are now prefixed with the GUID to help identify the mod which they originate from.
  • Removed Unregister method - being public allowed this to be used maliciously by devs.

    It also doesn't make sense to unregister, just don't register in the first place :P

v2.0.0

BREAKING UPDATE
This version is not backwards compatible and mods are required to update!
Only update if you can be sure all of your mods use this version.

If you are a mod dev, please see the "Updating to v2.0.0" section of the wiki.

Changelog

  • Removed need for unnecessary boilerplate. CSync now does messaging and patching itself.
  • Added a new SyncComplete event you can subscribe to.
  • Implemented missing .BindSyncedEntry() overloads to support ConfigDefinition and ConfigDescription arguments.
  • Renamed the main class from CSync to Plugin to avoid confusion with the namespace.

v1.0.7

  • Fixed syncing issue when the host's game path was not the same as the client's.
  • Caching now uses the file name instead of the absolute path.
  • When calling SyncInstance, the Synced bool is now set according to whether deserialization succeeds.

v1.0.6

  • Removed the type constraint from SyncedEntry to fix an error when using the string type.
  • Publicized the underlying ConfigEntry (named 'Entry') to enable compatibility with LethalConfig.
  • Some small but important changes to SyncedConfig.

v1.0.5

  • The library is now available on NuGet.

v1.0.4

  • Minor edits to Thunderstore metadata. (No need to download this version)

v1.0.3

  • Implemented a config file cache to speed up deserialization of SyncedEntry's.
  • Exposed BoxedValue and SettingChanged from the underlying entry to SyncedEntry itself.
  • Constrained the SyncedEntry type parameter to a primitive value.
  • Added some documentation to classes.

v1.0.2

  • Fixed bug introduced in v1.0.1 causing syncing issues.
  • Added a class constraint to the SyncedInstance type parameter.

v1.0.1

  • Renamed the built-in SyncedConfig to prevent confusion with the wiki.
  • Reduced instance size by marking some internally used props as [NonSerializable].
  • Removed Instance property from the CSync.cs file as it's not necessary.

v1.0.0

  • Implemented SyncedEntry - a serializable alternative to ConfigEntry.
  • Implemented SyncedInstance that aids with syncing and reverting.
  • Implemented ByteSerializer to serialize instances with DataContractSerializer.
  • Provided extension methods to ConfigFile and FastBufferWriter.