Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void CConfig::Save( const std::string& name ) {
- if( name.empty( ) )
- return;
- CreateDirectoryA( u8"C:\\M0ne0N Free\\", NULL );
- std::string file = u8"C:\\M0ne0N Free\\" + name;
- for( auto value : ints ) {
- WritePrivateProfileStringA( value->category.c_str( ), value->name.c_str( ), std::to_string( *value->value ).c_str( ), file.c_str( ) );
- }
- for( auto value : floats ) WritePrivateProfileStringA( value->category.c_str( ), value->name.c_str( ), std::to_string( *value->value ).c_str( ), file.c_str( ) );
- for( auto value : bools ) WritePrivateProfileStringA( value->category.c_str( ), value->name.c_str( ), *value->value ? "true" : "false", file.c_str( ) );
- }
- void CConfig::Load( const std::string& name ) {
- if( name.empty( ) )
- return;
- g_ClientState->ForceFullUpdate();
- CreateDirectoryA( u8"C:\\M0ne0N Free\\", NULL );
- std::string file = u8"C:\\M0ne0N Free\\" + name;
- char value_l[32] = { '\0' };
- for( auto value : ints ) {
- GetPrivateProfileStringA( value->category.c_str( ), value->name.c_str( ), "0", value_l, 32, file.c_str( ) ); *value->value = atoi( value_l );
- }
- for( auto value : floats ) {
- GetPrivateProfileStringA( value->category.c_str( ), value->name.c_str( ), "0.0f", value_l, 32, file.c_str( ) ); *value->value = atof( value_l );
- }
- for( auto value : bools ) {
- GetPrivateProfileStringA(value->category.c_str(), value->name.c_str(), "false", value_l, 32, file.c_str()); *value->value = !strcmp(value_l, "true");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement