Code/ServerApp/Source/Application.cpp
//=================================================================================================
// INIT CLIENT CONFIG FROM STRING
// Take a commandline string, and create a ClientConfig from it.
// Simple format of (Hostname);(HostPort)
//=================================================================================================
INIT CLIENT CONFIG FROM STRING
Take a commandline string, and create a ClientConfig from it.
Simple format of (Hostname);(HostPort)
INIT CLIENT CONFIG FROM STRING Take a commandline string and create a ClientConfig from it . Simple format of ( Hostname ) ; ( HostPort )
bool InitClientConfigFromString(const char* string, ClientConfig& cmdlineClientOut)
{
	const char* zEntryStart		= string;
	const char* zEntryCur		= string;
	int paramIndex				= 0;
	cmdlineClientOut			= ClientConfig();
	cmdlineClientOut.Transient	= true;
	strcpy_s(cmdlineClientOut.ClientName, "Commandline");
	while( *zEntryCur != 0 )
	{
		zEntryCur++;
		if( (*zEntryCur == ';' || *zEntryCur == 0) )
		{
			if (paramIndex == 0)
				strncpy_s(cmdlineClientOut.HostName, zEntryStart, zEntryCur-zEntryStart);
			else if (paramIndex == 1)
				cmdlineClientOut.HostPort = static_cast<uint32_t>(atoi(zEntryStart));
			cmdlineClientOut.ConnectAuto	= paramIndex >= 1;	
			zEntryStart						= zEntryCur + 1;
			paramIndex++;
		}
	}
	return cmdlineClientOut.ConnectAuto == true;
}
bool InitClientConfigFromString ( const char * string , ClientConfig & cmdlineClientOut ) { const char * zEntryStart = string ; const char * zEntryCur = string ; int paramIndex = 0 ; cmdlineClientOut = ClientConfig ( ) ; cmdlineClientOut . Transient = true ; strcpy_s ( cmdlineClientOut . ClientName , " " ) ; while ( * zEntryCur != 0 ) { zEntryCur ++ ; if ( ( * zEntryCur == ' ' || * zEntryCur == 0 ) ) { if ( paramIndex == 0 ) strncpy_s ( cmdlineClientOut . HostName , zEntryStart , zEntryCur - zEntryStart ) ; else if ( paramIndex == 1 ) cmdlineClientOut . HostPort = static_cast < uint32_t > ( atoi ( zEntryStart ) ) ; cmdlineClientOut . ConnectAuto = paramIndex >= 1 ; zEntryStart = zEntryCur + 1 ; paramIndex ++ ; } } return cmdlineClientOut . ConnectAuto == true ; }
INIT CLIENT CONFIG FROM STRING
Take a commandline string, and create a ClientConfig from it.
INIT CLIENT CONFIG FROM STRING Take a commandline string and create a ClientConfig from it .
//Mark valid for connexion as soon as we have a HostAddress