Simple Database

Code reference



SaveFile


Constructors
Definition Description
SaveFile(String filename) Initializes a new instance of the class. Save files will be saved on the Application.persistentDataPath with the specified filename.
SaveFile(String filename, String path) Initializes a new instance of the class. Save files will be saved on the specified path with the specified filename.
Static methods
Return type Definition Description
void DeleteSaveFile(string filename) Tries to delete a save file in the Application.persistentDataPath with the specified filename.
void DeleteSaveFile(string filename, string path) Tries to delete a save file in the specified path.
String[] GetSaveFileList() Tries to get a list of save files in the Application.persistentDataPath.
String[] GetSaveFileList(string path) Tries to get a list of save files in the specified path.
Methods
Return type Definition Description
bool IsOpen() Checks if the save file is open
string GetName() Gets the name of the current save file. Returns null if the save file wasn't initialized.
string GetPath() Gets the path where the current save file is being saved. Returns null if the save file wasn't initialized.
void ReOpen() Opens again a closed saveFile
void Set(string key, object value) Inserts a new key-value pair into the database and commits the changes.
T Get(string key, T defaultValue) Gets an object stored in the database identified by a key.
void Delete(string key) Deletes a key and its value from the database and commits the changes. Does nothing if the key doesn't exist.
bool HasKey(string key) Checks if a key exists in the database.
List GetKeys() Gets a list of all the keys in the database. This operation may be slow.
void Close() Shuts down the database, closing the file streams.


Sitemap

home
contact

Social




Copyright © 2016-2019 Eric Mourin