Since I'm currently working on a little project, I was able to figure something out.
As far as I know we never had a real explanation for this and there are still people out which were wondering about this, so:
Type | Key | Data |
---|---|---|
S | log.ip | 127.0.0.1 |
S | db.auth.port | 1433 |
N | auth.version | 200701120 |
Which would be, as example:
S log.ip:127.0.0.1
Did you ever asked yourself what S, N or even T means?
Here's the answer to that question:
PrincessAurora needs those values to specify which type the data has (see header of the table).
In this case, 127.0.0.1, the IP-Address of the logserver, is a String.
The data of auth.version is a Number.
The rest of those data types:
S -> String, which obviously can hold words or sentences.
N -> Number, which is used for booleans (true or false, which is equal to 1 or 0) as well.
T -> Equal to N, except that its value is a short* instead of long*.
F -> It is used for reading float values, as example: 3.1415
V -> It is used to read vector values, as example: auth.some_vector:2.45;5.43;1.29 **.
Q -> It is used to read a quaternion, as example: auth.some_vector:2.45;5.43;1.29;2.65 **.
*The difference between a short and a long is just their capacity. Short (Int16) is able to hold a value between −32,768 and 32,767, whereas a long (Int32) can hold a value between −2,147,483,648 and 2,147,483,647.
**I'm not really sure for what vector and quaternion is used, but apparently you can use them in the .opt files.
For the people out there which do understand C++, here's the code which does get used for reading the .opt file:
Code:
bool XEnvStruct::LoadFromFile( const char * pszFileName, const char *pszMask ) { THREAD_SYNCRONIZE( &m_pImpl->csLock ); bool bRtn = false; FILE *fp = fopen( pszFileName, "r" ); if( !fp ) return false; char buf[1024]; char *p; bRtn = true; while( !feof( fp ) ) { if( !fgets( buf, 1024, fp ) ) break; p = strchr( &buf[2], ':' ); if( !p ) { bRtn = false; break; } *p = '\0'; p++; if( *p ) { if( p[ strlen( p ) - 1 ] == '\n' ) p[ strlen( p ) - 1 ] = '\0'; } char type = buf[0]; char *key = &buf[2]; char *data = p; if( !XStringUtil::WildCardCmp( pszMask, key, true ) ) continue; Vector v; Quaternion q; v.x = v.y = v.z = 0.0f; q.x = q.y = q.z = q.w = 0.0f; switch( type ) { case 'S': Set( key, data ); break; case 'F': Set( key, (float)atof(data) ); break; case 'V': sscanf( data, "%f;%f;%f", &v.x, &v.y, &v.z ); Set( key, v ); break; case 'Q': sscanf( data, "%f;%f;%f;%f", &q.x, &q.y, &q.z, &q.w ); Set( key, q ); break; case 'N': Set( key, atoi(data) ); break; case 'T': Set( key, (short)atoi(data) ); break; } } fclose( fp ); return bRtn; }
Xijezu