JsonFileIO

v0.0.3·Updated 2024-04-15

BETA! (For making mods) Code lets you read/write JSONs full of key-value pairs to your plugin folder.

About this mod Author’s original text

JsonSaveSystem

Features

  • Everything's under namespace NGA
  • Class ExtensibleDictionary is made up of a list of key-value pairs 'DictionaryEntry'
  • Call ExtensibleDictionary.AddEntry to create a new key-value pair,.RemoveEntry to remove it by key, and.GetValue to get it value by key
  • Call.ContainsKey to quickly check if a key exists
  • Call ExtensibleDictionary.ToJson to turn the dictionary into a string
  • Calling.FromJson on a valid string will return ExtensibleDictionary
  • Class FileIO has utilities that let you write to your own mod's folder within the current profile
  • Call FileJsonIO.WriteToFile() with a filename (not a file path) and string content to write/clean-overwrite an existing file
  • Call.ReadFile() with a filename to read in string of that file

How to use in Your mod

Plugin

  • Add this to your plugin.csproj

bin\Debug\net35\JsonSaveSystem.dll

  • Add the JsonSaveSystem.dll file found in this mod's download to your local workspace, usually bin\Debug\net35
  • Add [BepInDependency("NGA.JsonFileIO", "0.0.0")] at the top of your C# file class declaration.
  • Add "NGA-JsonFileIO-0.0.1" to your manifest.json dependencies
  • Use reference code:

Collapsed Info

  • Nothing to see here

Planned Features

  • [✓] ExtensibleDictionary and FileIO classes work

Versions

0.0.1

  • Bug fixes
  • Allows different mods to use it simultanously
  • Example code link

0.0.1

  • Adds ExtensibleDictionary and FileIO

Install & use Install: BepInEx plugin

  1. The archive from playbuff is the mod itself — usually a BepInEx plugin (a .dll or a plugin folder once unzipped).
  2. Recommended: use a community mod manager (such as r2modman) — pick this game, import the mod, and the manager sets up BepInEx and its dependencies for you.
  3. Manual route: install the BepInEx loader in the game folder, then drop the unzipped .dll or plugin folder into BepInEx/plugins/.
  4. Launch the game — the BepInEx console logs every plugin it loads; seeing this mod in the log means it is installed.

Mods with listed dependencies need those installed too, or they will not load. Options are usually changed in-game or in the plugin's config file.

File & checksum

Filename
JsonFileIO-0.0.3.zip
File size
120.2 KiB