diff options
| author | daoge_cmd <3523206925@qq.com> | 2026-03-01 12:16:08 +0800 |
|---|---|---|
| committer | daoge_cmd <3523206925@qq.com> | 2026-03-01 12:16:08 +0800 |
| commit | b691c43c44ff180d10e7d4a9afc83b98551ff586 (patch) | |
| tree | 3e9849222cbc6ba49f2f1fc6e5fe7179632c7390 /Minecraft.Client/Settings.cpp | |
| parent | def8cb415354ac390b7e89052a50605285f1aca9 (diff) | |
Initial commit
Diffstat (limited to 'Minecraft.Client/Settings.cpp')
| -rw-r--r-- | Minecraft.Client/Settings.cpp | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/Minecraft.Client/Settings.cpp b/Minecraft.Client/Settings.cpp new file mode 100644 index 00000000..89946773 --- /dev/null +++ b/Minecraft.Client/Settings.cpp @@ -0,0 +1,55 @@ +#include "stdafx.h" +#include "Settings.h" +#include "..\Minecraft.World\StringHelpers.h" + +// 4J - TODO - serialise/deserialise from file +Settings::Settings(File *file) +{ +} + +void Settings::generateNewProperties() +{ +} + +void Settings::saveProperties() +{ +} + +wstring Settings::getString(const wstring& key, const wstring& defaultValue) +{ + if(properties.find(key) == properties.end()) + { + properties[key] = defaultValue; + saveProperties(); + } + return properties[key]; +} + +int Settings::getInt(const wstring& key, int defaultValue) +{ + if(properties.find(key) == properties.end()) + { + properties[key] = _toString<int>(defaultValue); + saveProperties(); + } + return _fromString<int>(properties[key]); +} + +bool Settings::getBoolean(const wstring& key, bool defaultValue) +{ + if(properties.find(key) == properties.end()) + { + properties[key] = _toString<bool>(defaultValue); + saveProperties(); + } + MemSect(35); + bool retval = _fromString<bool>(properties[key]); + MemSect(0); + return retval; +} + +void Settings::setBooleanAndSave(const wstring& key, bool value) +{ + properties[key] = _toString<bool>(value); + saveProperties(); +}
\ No newline at end of file |
