Table of Contents

Class SaveDataCache

Namespace
Nautilus.Json
Assembly
Nautilus.dll
An abstract implementation of IJsonFile intended for use with caching per-save data.
public abstract class SaveDataCache : JsonFile, IJsonFile
Inheritance
SaveDataCache
Implements
Inherited Members
Extension Methods

Constructors

SaveDataCache()

Creates a new instance of SaveDataCache, parsing the file name from FileNameAttribute if declared, or with default values otherwise.
public SaveDataCache()

Properties

JsonFilePath

The file path at which the JSON file is accessible for reading and writing.
public override string JsonFilePath { get; }

Property Value

string

Methods

Load(bool)

Loads the JSON properties from the file on disk into the SaveDataCache.
public override void Load(bool createFileIfNotExist = true)

Parameters

createFileIfNotExist bool
Whether a new JSON file should be created with default values if it does not already exist.

Exceptions

InvalidOperationException
Thrown when the player is not in-game.
See Also

LoadWithConverters(bool, params JsonConverter[])

Loads the JSON properties from the file on disk into the SaveDataCache.
public override void LoadWithConverters(bool createFileIfNotExist = true, params JsonConverter[] jsonConverters)

Parameters

createFileIfNotExist bool
Whether a new JSON file should be created with default values if it does not already exist.
jsonConverters JsonConverter[]
Optional Newtonsoft.Json.JsonConverters to be used for serialization. The AlwaysIncludedJsonConverters will always be used, regardless of whether you pass them.

Exceptions

InvalidOperationException
Thrown when the player is not in-game.
See Also

Save()

Saves the current fields and properties of the SaveDataCache as JSON properties to the file on disk.
public override void Save()

Exceptions

InvalidOperationException
Thrown when the player is not in-game.
See Also

SaveWithConverters(params JsonConverter[])

Saves the current fields and properties of the SaveDataCache as JSON properties to the file on disk.
public override void SaveWithConverters(params JsonConverter[] jsonConverters)

Parameters

jsonConverters JsonConverter[]
Optional Newtonsoft.Json.JsonConverters to be used for deserialization. The AlwaysIncludedJsonConverters will always be used, regardless of whether you pass them.

Exceptions

InvalidOperationException
Thrown when the player is not in-game.
See Also