| 
									
										
										
										
											2018-01-30 16:45:38 +08:00
										 |  |  | #include "..\etools.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-07 16:37:12 +08:00
										 |  |  | void e2d::Data::saveInt(const String & key, int value) | 
					
						
							| 
									
										
										
										
											2018-01-30 16:45:38 +08:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2018-02-27 16:32:17 +08:00
										 |  |  | 	::WritePrivateProfileString(L"Default", key, String::toString(value), File::getDefaultSavePath()); | 
					
						
							| 
									
										
										
										
											2018-01-30 16:45:38 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-27 21:07:43 +08:00
										 |  |  | void e2d::Data::saveDouble(const String & key, double value) | 
					
						
							| 
									
										
										
										
											2018-01-30 16:45:38 +08:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2018-02-27 16:32:17 +08:00
										 |  |  | 	::WritePrivateProfileString(L"Default", key, String::toString(value), File::getDefaultSavePath()); | 
					
						
							| 
									
										
										
										
											2018-01-30 16:45:38 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-28 19:46:03 +08:00
										 |  |  | void e2d::Data::saveBool(const String & key, bool value) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	int nValue = value ? 1 : 0; | 
					
						
							|  |  |  | 	::WritePrivateProfileString(L"Default", key, String::toString(nValue), File::getDefaultSavePath()); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-07 16:37:12 +08:00
										 |  |  | void e2d::Data::saveString(const String & key, const String & value) | 
					
						
							| 
									
										
										
										
											2018-01-30 16:45:38 +08:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2018-02-07 16:37:12 +08:00
										 |  |  | 	::WritePrivateProfileString(L"Default", key, value, File::getDefaultSavePath()); | 
					
						
							| 
									
										
										
										
											2018-01-30 16:45:38 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-28 19:46:03 +08:00
										 |  |  | int e2d::Data::getInt(const String & key, int defaultValue) | 
					
						
							| 
									
										
										
										
											2018-01-30 16:45:38 +08:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2018-02-28 19:46:03 +08:00
										 |  |  | 	return ::GetPrivateProfileInt(L"Default", key, defaultValue, File::getDefaultSavePath()); | 
					
						
							| 
									
										
										
										
											2018-01-30 16:45:38 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-28 19:46:03 +08:00
										 |  |  | double e2d::Data::getDouble(const String & key, double defaultValue) | 
					
						
							| 
									
										
										
										
											2018-01-30 16:45:38 +08:00
										 |  |  | { | 
					
						
							|  |  |  | 	wchar_t temp[32] = { 0 }; | 
					
						
							| 
									
										
										
										
											2018-02-28 19:46:03 +08:00
										 |  |  | 	::GetPrivateProfileString(L"Default", key, String::toString(defaultValue), temp, 31, File::getDefaultSavePath()); | 
					
						
							| 
									
										
										
										
											2018-01-30 16:45:38 +08:00
										 |  |  | 	return std::stof(temp); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-28 19:46:03 +08:00
										 |  |  | bool e2d::Data::getBool(const String & key, bool defaultValue) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	int nDefaultValue = defaultValue ? 1 : 0; | 
					
						
							|  |  |  | 	int nValue = ::GetPrivateProfileInt(L"Default", key, nDefaultValue, File::getDefaultSavePath()); | 
					
						
							|  |  |  | 	return nValue != 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | e2d::String e2d::Data::getString(const String & key, const String & defaultValue) | 
					
						
							| 
									
										
										
										
											2018-01-30 16:45:38 +08:00
										 |  |  | { | 
					
						
							|  |  |  | 	wchar_t temp[256] = { 0 }; | 
					
						
							| 
									
										
										
										
											2018-02-28 19:46:03 +08:00
										 |  |  | 	::GetPrivateProfileString(L"Default", key, defaultValue, temp, 255, File::getDefaultSavePath()); | 
					
						
							| 
									
										
										
										
											2018-01-30 16:45:38 +08:00
										 |  |  | 	return temp; | 
					
						
							|  |  |  | } |