summaryrefslogtreecommitdiff
path: root/Source/Core/Common/SettingsHandler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Core/Common/SettingsHandler.cpp')
-rw-r--r--Source/Core/Common/SettingsHandler.cpp29
1 files changed, 9 insertions, 20 deletions
diff --git a/Source/Core/Common/SettingsHandler.cpp b/Source/Core/Common/SettingsHandler.cpp
index 8a0240939b..6ce08f6579 100644
--- a/Source/Core/Common/SettingsHandler.cpp
+++ b/Source/Core/Common/SettingsHandler.cpp
@@ -19,8 +19,6 @@
#endif
#include "Common/CommonTypes.h"
-#include "Common/File.h"
-#include "Common/FileUtil.h"
#include "Common/SettingsHandler.h"
#include "Common/Timer.h"
@@ -29,33 +27,24 @@ SettingsHandler::SettingsHandler()
Reset();
}
-bool SettingsHandler::Open(const std::string& settings_file_path)
+SettingsHandler::SettingsHandler(Buffer&& buffer)
{
- Reset();
-
- File::IOFile file{settings_file_path, "rb"};
- if (!file.ReadBytes(m_buffer.data(), m_buffer.size()))
- return false;
-
- Decrypt();
- return true;
+ SetBytes(std::move(buffer));
}
-bool SettingsHandler::Save(const std::string& destination_file_path) const
+const SettingsHandler::Buffer& SettingsHandler::GetBytes() const
{
- if (!File::CreateFullPath(destination_file_path))
- return false;
-
- File::IOFile file{destination_file_path, "wb"};
- return file.WriteBytes(m_buffer.data(), m_buffer.size());
+ return m_buffer;
}
-const u8* SettingsHandler::GetData() const
+void SettingsHandler::SetBytes(SettingsHandler::Buffer&& buffer)
{
- return m_buffer.data();
+ Reset();
+ m_buffer = std::move(buffer);
+ Decrypt();
}
-const std::string SettingsHandler::GetValue(const std::string& key)
+std::string SettingsHandler::GetValue(const std::string& key) const
{
std::string delim = std::string("\r\n");
std::string toFind = delim + key + "=";