Hi all,
i want to read all values from a config file via "KeyValues".
But the Key's are unknow.
It's no problem when i know the name of the "key" but i didn't.
Example:
Code:
"MyFile"
{
"de_dust"
{
"Key_fvj" "Value_arhu"
"Key_fgaz" "Value_mpai"
"Key_sae" "Value_uusj"
"Key_diugx" "Value_yjko"
}
"de_dust2"
{
"Key_abc" "Value_afdu"
"Key_fguz" "Value_msai"
"Key_sqae" "Value_ddsj"
"Key_diegx" "Value_ejko"
}
}
PHP Code:
public bool:ReadFile(const String:value[], maxlength)
{
decl String:map[64];
GetCurrentMap(map, sizeof(map));
kv = CreateKeyValues("Myfile");
FileToKeyValues(kv, path);
if (!KvGotoFirstSubKey(kv))
{
LogMessage("CFG File not found");
CloseHandle(kv);
return false;
}
do
{
KvGetSectionName(kv, buffer, sizeof(buffer));
if (StrEqual(buffer, map))
{
// Here i dount know the "Key"
KvGetString(kv, "Key_???", Value, maxlength);
CloseHandle(kv);
return true;
}
}while (KvGotoNextKey(kv));
CloseHandle(kv);
return true;
}
I want to save all key's and values to an Array.
Code:
E.x. de_dust:
Array[0][0] = Key_fvj
Array[0][1] = Value_arhu
Array[1][0] = Key_fgaz
Array[1][1] = Value_mpai
...
Can someone tell me how i can realize it?
Thanks for the effort.
__________________