From c061ba7b6d56219cb55ebe31c2c8db635bebd4b8 Mon Sep 17 00:00:00 2001 From: Tobi Date: Thu, 21 Dec 2023 12:44:11 +0100 Subject: [PATCH] Finished README.me --- README.md | 44 ++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 40 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 246e617..cf967ba 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# File Class +# 2090s Storage System ## Overview The File class is a storage utility for handling file operations with optional encryption in Godot Engine. It allows for the creation, reading, writing, updating, and deletion of file contents, with an emphasis on handling JSON-formatted data. @@ -13,9 +13,45 @@ The File class is a storage utility for handling file operations with optional e ### Initialization ```gdscript -var file = GStorage.File.new(path, open_file, secretkey="") +var file = GStorage.File.new(file_path, open_file, secretkey="") ``` -- **path**: The path where the file is located or will be created. +- **file_path**: The path where the file is located or will be created. - **open_file**: The name of the file to open or create. -- **secretkey**: The encryption key for securing the file. If left empty, no encryption will be set. +- **secretkey**: The encryption key for securing the file. If empty, no encryption will be set. + + +### Methods +Sets the data in the file dictionary and writes it to the file. Didnt overwrite the whole dictionary. Existing values are overwritten and new values are added + +```gdscript +var file = GStorage.File.set_data(dict) +``` + +- **dict**: i.e. {"device_id": 1, ...} +- **return**: null + + +If you want to change a single value without passing a dictionary: +```gdscript +var file = GStorage.File.set_key(key, value) +``` + +- **key**: i.e. "device_id" +- **value**: i.e. 1 +- **return**: value + +If you want to have all data as a dictionary: +```gdscript +var file = GStorage.File.get_all_data() +``` + +- **return**: dictionary + + +If you want to delete a key: +```gdscript +var file = GStorage.File.delete_data() +``` + +- **return**: null