Changes

Jump to navigation Jump to search
Line 13: Line 13:  
<source lang="c#">
 
<source lang="c#">
 
// read file
 
// read file
var model = this.Helper.ReadJsonFile<ModData>("data.json") ?? new ModData();
+
var model = this.Helper.Data.ReadJsonFile<ModData>("data.json") ?? new ModData();
    
// save file (if needed)
 
// save file (if needed)
this.Helper.WriteJsonFile("data.json", model);
+
this.Helper.Data.WriteJsonFile("data.json", model);
 
</source>
 
</source>
   Line 27: Line 27:     
===Save data===
 
===Save data===
{{SMAPI upcoming|2.8}}
   
You can store arbitrary data in the current save file. This is mainly useful for save-specific data, like player progression and custom items. Note that a save file must be loaded (e.g. it won't work on the title screen), and the data won't be persisted until the player saves the current day.
 
You can store arbitrary data in the current save file. This is mainly useful for save-specific data, like player progression and custom items. Note that a save file must be loaded (e.g. it won't work on the title screen), and the data won't be persisted until the player saves the current day.
   Line 37: Line 36:  
<source lang="c#">
 
<source lang="c#">
 
// read file
 
// read file
var model = this.Helper.ReadSaveData<ModData>("example-key");
+
var model = this.Helper.Data.ReadSaveData<ModData>("example-key");
    
// save file (if needed)
 
// save file (if needed)
this.Helper.WriteSaveData("example-key", model);
+
this.Helper.Data.WriteSaveData("example-key", model);
 
</source>
 
</source>
   Line 47: Line 46:     
===Global app data===
 
===Global app data===
{{SMAPI upcoming|2.8}}
   
You can store arbitrary data on the local computer, synchronised by GOG/Steam if applicable. This data is global (not per-save) and changes are saved immediately.
 
You can store arbitrary data on the local computer, synchronised by GOG/Steam if applicable. This data is global (not per-save) and changes are saved immediately.
   Line 57: Line 55:  
<source lang="c#">
 
<source lang="c#">
 
// read file
 
// read file
var model = this.Helper.ReadGlobalData<ModData>("example-key");
+
var model = this.Helper.Data.ReadGlobalData<ModData>("example-key");
    
// save file (if needed)
 
// save file (if needed)
this.Helper.WriteGlobalData("example-key", model);
+
this.Helper.Data.WriteGlobalData("example-key", model);
 
</source>
 
</source>
  
translators
8,403

edits

Navigation menu