Add encrypted files support to ConfigFile

Fix #26477
Add in ConfigFile this methods:
load_encrypted(path, key)
load_encrypted_pass(path, password)
save_encrypted(path, key)
save_encrypted_pass(path, password)
This commit is contained in:
Vasiliy Makarov 2019-06-27 14:57:45 +03:00
parent 755b589384
commit fcd8faf2f4
2 changed files with 101 additions and 2 deletions

View file

@ -32,6 +32,7 @@
#define CONFIG_FILE_H
#include "core/ordered_hash_map.h"
#include "core/os/file_access.h"
#include "core/reference.h"
class ConfigFile : public Reference {
@ -42,6 +43,8 @@ class ConfigFile : public Reference {
PoolStringArray _get_sections() const;
PoolStringArray _get_section_keys(const String &p_section) const;
Error _internal_load(const String &p_path, FileAccess *f);
Error _internal_save(FileAccess *file);
protected:
static void _bind_methods();
@ -61,6 +64,12 @@ public:
Error save(const String &p_path);
Error load(const String &p_path);
Error load_encrypted(const String &p_path, const Vector<uint8_t> &p_key);
Error load_encrypted_pass(const String &p_path, const String &p_pass);
Error save_encrypted(const String &p_path, const Vector<uint8_t> &p_key);
Error save_encrypted_pass(const String &p_path, const String &p_pass);
ConfigFile();
};