Ejemplo n.º 1
0
void CLogger::FormatMessage(wxString& string, CSteamID steamID, const char* cszMessage)
{
	wxMutexLocker configLock(m_configLock);

	wxArrayString tags, replacements;

	tags.Add(_T("{SteamID}"));		replacements.Add(wxString(steamID.SteamRender(), wxConvUTF8));
	tags.Add(_T("{MySteamID}"));	replacements.Add(wxString(m_pSteamUser->GetSteamID().SteamRender(), wxConvUTF8));
	tags.Add(_T("{SteamID64}"));	replacements.Add(wxString::Format(_T("%llu"), steamID.ConvertToUint64()));
	tags.Add(_T("{MySteamID64}"));	replacements.Add(wxString::Format(_T("%llu"), m_pSteamUser->GetSteamID().ConvertToUint64()));

	tags.Add(_T("{Name}"));

	wxString name = wxString(m_pSteamFriends->GetFriendPersonaName(steamID), wxConvUTF8);
	const char* cszNickname = NULL;

	if(m_pClientFriends && m_pGetPlayerNickname)
		cszNickname = m_pGetPlayerNickname(m_pClientFriends, steamID);

	if(cszNickname)
	{
		name += _T(" (") + wxString(cszNickname, wxConvUTF8) + _T(")");
	}
	replacements.Add(name);

	tags.Add(_T("{MyName}"));		replacements.Add(wxString(m_pSteamFriends->GetPersonaName(), wxConvUTF8));
	tags.Add(_T("{Date}"));			replacements.Add(wxDateTime::Now().Format(m_dateFormat));
	tags.Add(_T("{Time}"));			replacements.Add(wxDateTime::Now().Format(m_timeFormat));
	tags.Add(_T("{UnixTime}"));		replacements.Add(wxString::Format(_T("%lld"), (long long)wxDateTime::GetTimeNow()));
	tags.Add(_T("{NewLine}"));		replacements.Add(_T("\n"));
	tags.Add(_T("{Tab}"));			replacements.Add(_T("\t"));
	tags.Add(_T("{Message}"));		replacements.Add(wxString(cszMessage, wxConvUTF8));
	
	string = TagsReplace(string, tags, replacements);
}
Ejemplo n.º 2
0
void DrillClientConfig::setSocketTimeout(int32_t t){
    boost::lock_guard<boost::mutex> configLock(DrillClientConfig::s_mutex);
    s_socketTimeout=t;
}
Ejemplo n.º 3
0
uint64_t DrillClientConfig::getBufferLimit(){
    boost::lock_guard<boost::mutex> configLock(DrillClientConfig::s_mutex);
    return s_bufferLimit;
}
Ejemplo n.º 4
0
void DrillClientConfig::setBufferLimit(uint64_t l){
    boost::lock_guard<boost::mutex> configLock(DrillClientConfig::s_mutex);
    s_bufferLimit=l;
}
Ejemplo n.º 5
0
void DrillClientConfig::setLogLevel(logLevel_t l){
    boost::lock_guard<boost::mutex> configLock(DrillClientConfig::s_mutex);
    s_logLevel=l;
    getLogger().m_level=l;
    //boost::log::core::get()->set_filter(boost::log::trivial::severity >= s_logLevel);
}
Ejemplo n.º 6
0
logLevel_t DrillClientConfig::getLogLevel(){
    boost::lock_guard<boost::mutex> configLock(DrillClientConfig::s_mutex);
    return s_logLevel;
}
Ejemplo n.º 7
0
int32_t DrillClientConfig::getHeartbeatFrequency(){
    boost::lock_guard<boost::mutex> configLock(DrillClientConfig::s_mutex);
    return s_heartbeatFrequency;
}
Ejemplo n.º 8
0
void CLogger::SetLogDirectory(const wxString& path)
{
	wxMutexLocker configLock(m_configLock);

	m_logDirectory = path;
}
Ejemplo n.º 9
0
int32_t DrillClientConfig::getHandshakeTimeout(){
    boost::lock_guard<boost::mutex> configLock(DrillClientConfig::s_mutex);
    return  s_handshakeTimeout;
}
Ejemplo n.º 10
0
void DrillClientConfig::setHeartbeatFrequency(int32_t t){
    if (t>0){
        boost::lock_guard<boost::mutex> configLock(DrillClientConfig::s_mutex);
        s_heartbeatFrequency=t;
    }
}
Ejemplo n.º 11
0
void CLogger::SetTimeFormat(const wxString& format)
{
	wxMutexLocker configLock(m_configLock);

	m_timeFormat = format;
}
Ejemplo n.º 12
0
void CLogger::SetSeparationString(const wxString& string)
{
	wxMutexLocker configLock(m_configLock);

	m_separationString = string;
}
Ejemplo n.º 13
0
void CLogger::SetMessageFormat(const wxString& format)
{
	wxMutexLocker configLock(m_configLock);

	m_messageFormat = format;
}
Ejemplo n.º 14
0
void CLogger::SetReplacementChar(const wxString& c)
{
	wxMutexLocker configLock(m_configLock);

	m_replacementChar = c;
}
Ejemplo n.º 15
0
void DrillClientConfig::setHandshakeTimeout(int32_t t){
    if (t > 0) {
        boost::lock_guard<boost::mutex> configLock(DrillClientConfig::s_mutex);
        s_handshakeTimeout = t;
    }
}
Ejemplo n.º 16
0
int32_t DrillClientConfig::getQueryTimeout(){
    boost::lock_guard<boost::mutex> configLock(DrillClientConfig::s_mutex);
    return s_queryTimeout;
}
Ejemplo n.º 17
0
void DrillClientConfig::setQueryTimeout(int32_t t){
    if (t>0){
        boost::lock_guard<boost::mutex> configLock(DrillClientConfig::s_mutex);
        s_queryTimeout=t;
    }
}
Ejemplo n.º 18
0
void CLogger::FormatFilename(wxString& string, CSteamID steamID)
{
	wxMutexLocker configLock(m_configLock);

	wxArrayString tags, replacements;

	tags.Add(_T("{SteamID}"));		replacements.Add(wxString(steamID.SteamRender(), wxConvUTF8));
	tags.Add(_T("{MySteamID}"));	replacements.Add(wxString(m_pSteamUser->GetSteamID().SteamRender(), wxConvUTF8));
	tags.Add(_T("{SteamID64}"));	replacements.Add(wxString::Format(_T("%llu"), steamID.ConvertToUint64()));
	tags.Add(_T("{MySteamID64}"));	replacements.Add(wxString::Format(_T("%llu"), m_pSteamUser->GetSteamID().ConvertToUint64()));

	tags.Add(_T("{Name}"));
	if(steamID.BIndividualAccount())
	{
		replacements.Add(wxString(m_pSteamFriends->GetFriendPersonaName(steamID), wxConvUTF8));
	}
	else
	{
		const char* cszChatRoomName = NULL;
		
		if(m_pClientFriends && m_pGetChatRoomName)
			cszChatRoomName = m_pGetChatRoomName(m_pClientFriends, steamID);

		if(*cszChatRoomName)
		{
			replacements.Add(wxString(cszChatRoomName, wxConvUTF8));
		}
		else
		{
			wxString name;
			for(int i = 0; i < m_pSteamFriends->GetFriendCountFromSource(steamID); i++)
			{
				name += wxString(m_pSteamFriends->GetFriendPersonaName(m_pSteamFriends->GetFriendFromSourceByIndex(steamID, i)), wxConvUTF8) + _T(" + ");
			}
			name.RemoveLast(3);

			replacements.Add(name);
		}
	}

	tags.Add(_T("{Nickname}"));

	if(steamID.BIndividualAccount())
	{
		const char* cszNickname = NULL;

		if(m_pClientFriends && m_pGetPlayerNickname)
			cszNickname = m_pGetPlayerNickname(m_pClientFriends, steamID);

		if(cszNickname)
		{
			replacements.Add(wxString(cszNickname, wxConvUTF8));
		}
		else
		{
			replacements.Add(wxString(m_pSteamFriends->GetFriendPersonaName(steamID), wxConvUTF8));
		}
	}
	else
	{
		replacements.Add(replacements.Last());
	}

	tags.Add(_T("{MyName}"));		replacements.Add(wxString(m_pSteamFriends->GetPersonaName(), wxConvUTF8));
	tags.Add(_T("{Date}"));			replacements.Add(wxDateTime::Now().Format(m_dateFormat));
	tags.Add(_T("{Time}"));			replacements.Add(wxDateTime::Now().Format(m_timeFormat));
	tags.Add(_T("{UnixTime}"));		replacements.Add(wxString::Format(_T("%lld"), (long long)wxDateTime::GetTimeNow()));
	
	string = TagsReplace(string, tags, replacements);

	static const wxChar* invalidChars[] = {_T("\\"), _T("/"), _T(":"), _T("*"), _T("?"), _T("\""), _T("<"), _T(">"), _T("|")};
	for(int i = 0; i < sizeof(invalidChars) / sizeof(*invalidChars); i++)
	{
		string.Replace(invalidChars[i], m_replacementChar);
	}
}