NGA-JsonFileIO icon

JsonFileIO

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

By NGA
Last updated 2 weeks ago
Total downloads 245
Total rating 0 
Categories Libraries
Dependency string NGA-JsonFileIO-0.0.3
Dependants 1 other package depends on this package

README

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

  1. Add this to your plugin.csproj
<Reference Include="JsonSaveSystem">
            <HintPath>bin\Debug\net35\JsonSaveSystem.dll</HintPath>
</Reference>
  1. Add the JsonSaveSystem.dll file found in this mod's download to your local workspace, usually bin\Debug\net35
  2. Add [BepInDependency("NGA.JsonFileIO", "0.0.0")] at the top of your C# file class declaration.
  3. Add "NGA-JsonFileIO-0.0.1" to your manifest.json dependencies
  4. Use reference code: https://github.com/NewGenerationAlms/NgaShareableCode/blob/main/h3vr/maxwellrealism_mod/MaxwellRealism_Mod.cs
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