aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.Client/Settings.cpp
blob: 89946773b7858c98998d0ee679337191a6e4f82f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
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();
}