本文整理汇总了C++中CMyTrace类的典型用法代码示例。如果您正苦于以下问题:C++ CMyTrace类的具体用法?C++ CMyTrace怎么用?C++ CMyTrace使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CMyTrace类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: switch
void CDPCoreClient::SysMessageHandler( LPDPMSG_GENERIC lpMsg, DWORD dwMsgSize, DPID idFrom )
{
switch( lpMsg->dwType )
{
case DPSYS_DESTROYPLAYERORGROUP:
{
g_MyTrace.Add( CMyTrace::Key( "main" ), TRUE, "destroy player or group." );
break;
}
}
}
示例2: InitInstance
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
HWND hWnd;
hInst = hInstance; // Store instance handle in our global variable
hMainWnd = hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);
if (!hWnd)
return FALSE;
SetTimer( hMainWnd, 3, SEC( 60 ), NULL ); // 10(s)
int x = 480, y = 606;
SetWindowPos( hWnd, NULL, x, y, 400, 416, SWP_SHOWWINDOW );
g_MyTrace.Initialize( hWnd, "SquireD", RGB( 0x00, 0x00, 0x00 ), RGB( 0xff, 0xff, 0xff ) );
CTime time = CTime::GetCurrentTime();
g_MyTrace.Add( 0, FALSE, "%s", time.Format( "%Y/%m/%d %H:%M:%S" ) );
g_MyTrace.AddLine( '\0' );
#ifndef _DEBUG
// InitEH();
#endif // _DEBUG
if( !Script( "CacheServer.ini" ) )
return FALSE;
if( InitializeNetLib() == FALSE )
return FALSE;
if( !g_DPCoreClient.ConnectToServer( g_szCoreAddr, PN_CORESRVR + 1 ) )
return FALSE;
#ifdef __CRC
if( !g_DPCacheSrvr.StartServer( g_uPort, FALSE, CSock::crcRead ) )
#else // __CRC
if( !g_DPCacheSrvr.StartServer( g_uPort ) )
#endif // __CRC
return FALSE;
g_MyTrace.AddLine( '-' );
char lpszIpAddr[16];
g_DPCoreClient.GetPlayerAddr( DPID_SERVERPLAYER, lpszIpAddr );
g_MyTrace.Add( CMyTrace::Key( "main" ), FALSE, "%s", lpszIpAddr );
g_MyTrace.AddLine( '-' );
ShowWindow(hWnd, nCmdShow);
UpdateWindow(hWnd);
return TRUE;
}
示例3: Lock
BOOL CUserMng::RemoveUser( DPID dpid )
{
CMclAutoLock Lock( m_AddRemoveLock );
map<DPID, CUser*>::iterator i = find( dpid );
if( i != end() )
{
CUser* pRemoved = i->second;
SAFE_DELETE( pRemoved );
erase( dpid );
#ifdef _DEBUG
g_MyTrace.Add( CMyTrace::Key( "count" ), FALSE, "// %04d", size() );
#endif // _DEBUG
return TRUE;
}
WriteError( "REMOVE//0" );
return FALSE;
}
示例4: CUser
BOOL CUserMng::AddUser( DPID dpid )
{
CUser* pUser = new CUser( dpid );
CMclAutoLock Lock( m_AddRemoveLock );
bool bResult = insert( map<DPID, CUser*>::value_type( dpid, pUser ) ).second;
if( bResult == false )
{
WriteError( "ADD//0" );
SAFE_DELETE( pUser );
return FALSE;
}
#ifdef _DEBUG
g_MyTrace.Add( CMyTrace::Key( "count" ), FALSE, "// %04d", size() );
#endif // _DEBUG
return TRUE;
}
示例5: Lock
CDPClientArray::Connect( CServerDesc *pServer )
{
CMclAutoLock Lock( m_AddRemoveLock );
CServerDescArray::iterator i = m_apServer.find( pServer->GetKey() );
if( i == m_apServer.end() )
{
CDPClient* pClient;
if( m_pFirstFree == NULL ) {
pClient = new CDPClient;
}
else {
pClient = m_pFirstFree;
m_pFirstFree = m_pFirstFree->pNext;
}
pClient->m_pServer = pServer;
g_MyTrace.Add( pServer->GetKey(), TRUE, "%04d", pServer->GetKey() );
if( pClient->CreateDPObject( FALSE ) && pClient->InitConnection( (LPVOID)pServer->m_szAddr, PN_WORLDSRVR + (u_short)pServer->GetKey() ) && pClient->JoinSession( NULL ) )
{
bool bResult = m_apServer.insert( CServerDescArray::value_type( pServer->GetKey(), pServer ) ).second;
ASSERT( bResult );
Add( pClient );
g_MyTrace.Add( pServer->GetKey(), FALSE, "%04d", pServer->GetKey() );
return TRUE;
}
SAFE_DELETE( pClient );
}
return FALSE;
}
示例6: WndProc
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
int wmId, wmEvent;
PAINTSTRUCT ps;
HDC hdc;
switch (message)
{
case WM_COMMAND:
wmId = LOWORD(wParam);
wmEvent = HIWORD(wParam);
// Parse the menu selections:
switch (wmId)
{
case IDM_ABOUT:
break;
case IDM_EXIT:
DestroyWindow(hWnd);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
break;
case WM_TIMER:
{
OnTimer( wParam ); // wTimerID = wParam
break;
}
case WM_PAINT:
hdc = BeginPaint(hWnd, &ps);
// RECT rt;
// GetClientRect(hWnd, &rt);
g_MyTrace.Paint( hdc );
EndPaint(hWnd, &ps);
break;
case WM_DESTROY:
KillTimer( hMainWnd, TIMER_ID_DEFAULT );
#if !defined(__INTERNALSERVER)
KillTimer( hMainWnd, TIMER_ID_WANTED );
#endif
#ifdef __EVENT0913
KillTimer( hMainWnd, TIMER_ID_EVENT0913 );
#endif // __EVENT0913
#ifdef __EVENT1206
KillTimer( hMainWnd, TIMER_ID_EVENT1206 );
#endif // __EVENT1206
KillTimer( hMainWnd, TIMER_ID_EVENT );
PostQuitMessage(0);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
return 0;
}
示例7: OnProcServerList
void CDPCoreClient::OnProcServerList( CAr & ar, DPID )
{
CServerDesc *pServer;
short nSize;
ar >> nSize;
for( int i = 0; i < nSize; i++ )
{
pServer = new CServerDesc;
pServer->Serialize( ar );
if( !g_DPClientArray.Connect( pServer ) ) {
SAFE_DELETE( pServer );
}
}
g_MyTrace.AddLine( '-' );
}
示例8: Remove
BOOL CDPClientArray::Remove( CDPClient* pClient )
{
CPlayerMng::Instance()->DestroyPlayer( pClient );
CDPClient *pCur, *pPrev = NULL;
CMclAutoLock Lock( m_AddRemoveLock );
pCur = m_pFirstActive;
while( pCur )
{
if( pCur == pClient )
{
if( pPrev ) {
pPrev->pNext = pCur->pNext;
}
else {
m_pFirstActive = m_pFirstActive->pNext;
}
CServerDescArray::iterator i = m_apServer.find( pClient->m_pServer->GetKey() );
if( i != m_apServer.end() )
{
m_apServer.erase( pClient->m_pServer->GetKey() );
g_MyTrace.Add( pClient->m_pServer->GetKey(), TRUE, "%04d", pClient->m_pServer->GetKey() );
SAFE_DELETE( pClient->m_pServer );
}
pClient->pNext = m_pFirstFree;
m_pFirstFree = pClient;
return TRUE;
}
pPrev = pCur;
pCur = pCur->pNext;
}
return FALSE;
}
示例9: WndProc
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
int wmId, wmEvent;
PAINTSTRUCT ps;
HDC hdc;
switch (message)
{
case WM_COMMAND:
wmId = LOWORD(wParam);
wmEvent = HIWORD(wParam);
// Parse the menu selections:
switch (wmId)
{
case IDM_EXIT:
DestroyWindow(hWnd);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
break;
#ifdef __PL_0917
case WM_LBUTTONDOWN:
CPacketLog::Instance()->Print();
break;
case WM_RBUTTONDOWN:
CPacketLog::Instance()->Reset();
break;
#endif // __PL_0917
case WM_TIMER:
{
switch( wParam )
{
case 3:
#ifdef __CRASH_0404
CCrashStatus::GetInstance()->SetMainThreadTask( 1 );
#endif // __CRASH_0404
CPlayerMng::Instance()->DestroyGarbage();
#ifdef __CRASH_0404
CCrashStatus::GetInstance()->SetMainThreadTask( 0 );
#endif // __CRASH_0404
break;
}
break;
}
case WM_PAINT:
hdc = BeginPaint(hWnd, &ps);
// RECT rt;
// GetClientRect(hWnd, &rt);
g_MyTrace.Paint( hdc );
EndPaint(hWnd, &ps);
break;
case WM_DESTROY:
KillTimer( hMainWnd, 3 );
PostQuitMessage(0);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
return 0;
}
示例10: WndProc
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
int wmId, wmEvent;
PAINTSTRUCT ps;
HDC hdc;
#ifdef __BILLING0712
// 빌링에 관련된 윈도우 메세지가 처리되게 한다.
if( GetBillingMgr()->PreTranslateMessage( hWnd, message, wParam, lParam ) )
return 0;
#endif
switch (message)
{
case WM_TIMER:
{
switch( wParam )
{
case IDT_SENDPLAYERCOUNT:
g_dpDbSrvr.SendPlayerCount();
break;
case IDT_PREVENT_EXCESS:
g_AccountMng.PreventExcess();
break;
case IDT_TIME_CHECKADDR:
{
if( g_dpSrvr.m_bCheckAddr && g_AccountMng.IsTimeCheckAddr() )
{
HMENU hMenu = GetMenu( hWnd );
CheckMenuItem( hMenu, IDM_OPT_EXTERNAL, MF_CHECKED );
EnableMenuItem( hMenu, IDM_OPT_EXTERNAL, MF_DISABLED | MF_GRAYED );
CheckMenuItem( hMenu, IDM_OPT_INTERNAL, MF_UNCHECKED );
EnableMenuItem( hMenu, IDM_OPT_INTERNAL, MF_ENABLED );
g_dpSrvr.m_bCheckAddr = false;
}
}
break;
/*
#ifdef __S0114_RELOADPRO
case IDT_RELOAD_PROJECT:
{
if( g_dpSrvr.m_bReloadPro )
g_DbManager.Load_ReloadAccount();
}
break;
#endif // __S0114_RELOADPRO
*/
case IDT_BUYING_INFO:
CBuyingInfoMng::GetInstance()->Process();
break;
}
}
break;
case WM_COMMAND:
wmId = LOWORD(wParam);
wmEvent = HIWORD(wParam);
// Parse the menu selections:
switch (wmId)
{
case IDM_EXIT:
DestroyWindow(hWnd);
break;
case IDM_OPT_INTERNAL:
{
HMENU hMenu = GetMenu( hWnd );
CheckMenuItem( hMenu, IDM_OPT_INTERNAL, MF_CHECKED );
EnableMenuItem( hMenu, IDM_OPT_INTERNAL, MF_DISABLED | MF_GRAYED );
CheckMenuItem( hMenu, IDM_OPT_EXTERNAL, MF_UNCHECKED );
EnableMenuItem( hMenu, IDM_OPT_EXTERNAL, MF_ENABLED );
g_dpSrvr.m_bCheckAddr = true;
break;
}
case IDM_OPT_EXTERNAL:
{
HMENU hMenu = GetMenu( hWnd );
CheckMenuItem( hMenu, IDM_OPT_EXTERNAL, MF_CHECKED );
EnableMenuItem( hMenu, IDM_OPT_EXTERNAL, MF_DISABLED | MF_GRAYED );
CheckMenuItem( hMenu, IDM_OPT_INTERNAL, MF_UNCHECKED );
EnableMenuItem( hMenu, IDM_OPT_INTERNAL, MF_ENABLED );
g_dpSrvr.m_bCheckAddr = false;
break;
}
case IDM_OPT_MAX_CONN:
{
DialogBox( hInst, MAKEINTRESOURCE( IDD_DIALOG_MAX_CONN ), hWnd, MaxConnDlgProc );
break;
}
case IDM_OPT_TOGGLE:
{
DialogBox( hInst, MAKEINTRESOURCE( IDD_DIALOG_TOGGLE ), hWnd, ToggleDlgProc );
break;
}
case IDM_OPT_SETTIME:
{
DialogBox( hInst, MAKEINTRESOURCE( IDD_DIALOG_TIME ), hWnd, SetTimeDlgProc );
break;
}
case IDM_OPT_INTERNAL_IP:
{
//.........这里部分代码省略.........
示例11: InitInstance
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
#ifndef _DEBUG
// InitEH();
#endif // _DEBUG
#ifdef __BILLING0712
if( ::CreateBillingMgr() == FALSE ) // CreateWindow전에 호출되어야 한다.
return FALSE;
#endif
HWND hWnd;
hInst = hInstance; // Store instance handle in our global variable
hMainWnd = hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);
if( !hWnd )
return FALSE;
HMENU hMenu = GetMenu( hWnd );
CheckMenuItem( hMenu, IDM_OPT_INTERNAL, MF_CHECKED );
EnableMenuItem( hMenu, IDM_OPT_INTERNAL, MF_DISABLED | MF_GRAYED );
g_dpSrvr.m_bCheckAddr = true;
int x = 400, y = 416;
SetWindowPos( hWnd, NULL, x, y, 400, 416, SWP_SHOWWINDOW );
LOAD_WS2_32_DLL;
::srand( timeGetTime() );
// Script함수의 호출순서가 중요하다. (menu -> script -> createdbworker)
if( Script( "AccountServer.ini" ) == FALSE )
return FALSE;
#ifdef __SECURITY_0628
LoadResAuth( "Flyff.b" );
#endif // __SECURITY_0628
// if( CQuery::EnableConnectionPooling() )
// OutputDebugString( "EnableConnectionPooling\n" );
g_DbManager.CreateDbWorkers();
if( g_dpSrvr.LoadAddrPmttd( "pmttd.ini" ) == false )
{
TRACE("LoadAddrPmttd false\n");
}
if( g_dpSrvr.LoadIPCut( "IPCut.ini" ) == FALSE )
{
TRACE( "LoadIPCut FALSE\n" );
}
g_MyTrace.Initialize( hWnd, "SquireD", RGB( 0x00, 0x00, 0x00 ), RGB( 0xff, 0xff, 0xff ) );
CTime time = CTime::GetCurrentTime();
g_MyTrace.Add( 0, FALSE, "%s", time.Format( "%Y/%m/%d %H:%M:%S" ) );
g_MyTrace.AddLine( '\0' );
if( FALSE == g_dpSrvr.StartServer( PN_ACCOUNTSRVR_0 )
|| FALSE == g_dpDbSrvr.StartServer( PN_ACCOUNTSRVR_1 )
|| FALSE == CDPAdbill::GetInstance()->StartServer( PN_ADBILL )
/*
#ifdef __GIFTBOX0213
|| FALSE == CDPWldSrvr::GetInstance()->StartServer( PN_ACCOUNTSRVR_2 )
#endif // __GIFTBOX0213
*/
)
{
AfxMessageBox( "Unable to start server" );
return FALSE;
}
#ifdef __BILLING0712
if( GetBillingMgr()->Init( hWnd ) == false )
return FALSE;
#endif
SetTimer( hWnd, IDT_SENDPLAYERCOUNT, 1000 * 60, NULL );
SetTimer( hWnd, IDT_TIME_CHECKADDR, 1000 * 30, NULL );
if( ::GetLanguage() == LANG_THA )
SetTimer( hWnd, IDT_PREVENT_EXCESS, 1000 * 60, NULL );
/*
#ifdef __S0114_RELOADPRO
SetTimer( hWnd, IDT_RELOAD_PROJECT, 1000 * 30, NULL );
#endif // __S0114_RELOADPRO
*/
SetTimer( hWnd, IDT_BUYING_INFO, 500, NULL );
if( FALSE == g_DbManager.AllOff() )
return FALSE;
ShowWindow(hWnd, nCmdShow);
UpdateWindow(hWnd);
return TRUE;
}
示例12: Script
BOOL Script( LPCSTR lpszFileName )
{
CScanner s;
CServerDesc* pServer;
POINT topLeft;
SIZE size;
if( s.Load( lpszFileName ) )
{
g_MyTrace.AddLine( '-' );
s.GetToken();
while( s.tok != FINISHED )
{
if( s.Token == "Sys" )
{
g_dwSys = s.GetNumber();
}
else if( s.Token == "dwId" )
{
g_dwId = s.GetNumber();
}
else if( s.Token == "Database" )
{
s.GetToken();
strcpy( szDataBaseAddr, s.Token );
}
else if( s.Token == "Certifier" )
{
s.GetToken();
strcpy( szCertifierAddr, s.Token );
}
else if( s.Token == "TEST" )
{
s_bTest = TRUE;
}
else if( s.Token == "PartyExpRate" )
{
s_fPartyExpRate = s.GetFloat();
}
else
{
pServer = new CServerDesc;
u_long uKey = (u_long)_ttoi( s.Token );
pServer->SetKey( uKey );
if( s.GetToken() == DELIMITER )
{
while( s.GetToken() != DELIMITER )
{
CJurisdiction* pJurisdiction = new CJurisdiction;
pJurisdiction->m_dwWorldID = (DWORD)_ttoi( s.Token );
topLeft.x = s.GetNumber(); topLeft.y = s.GetNumber();
size.cx = s.GetNumber(); size.cy = s.GetNumber();
pJurisdiction->m_rect.SetRect( topLeft.x, topLeft.y, topLeft.x + size.cx, topLeft.y + size.cy );
pJurisdiction->m_wLeft = s.GetNumber(); pJurisdiction->m_wRight = s.GetNumber();
pServer->m_lspJurisdiction.push_back( pJurisdiction );
}
}
#ifdef __STL_0402
bool bResult = g_dpCoreSrvr.m_apSleepServer.insert( CServerDescArray::value_type( pServer->GetKey(), pServer ) ).second;
ASSERT( bResult );
#else // __STL_0402
g_dpCoreSrvr.m_apSleepServer.SetAt( pServer->GetKey(), pServer );
#endif // __STL_0402
g_MyTrace.Add( pServer->GetKey(), TRUE, "%04d", pServer->GetKey() );
}
s.GetToken();
}
g_MyTrace.AddLine( '-' );
return TRUE;
}
Error( "Can't open file, %s.\n", lpszFileName );
return FALSE;
}
示例13: InitInstance
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
HWND hWnd;
hInst = hInstance; // Store instance handle in our global variable
hMainWnd = hWnd =
CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);
if (!hWnd)
{
return FALSE;
}
int x = 0, y = 416;
SetWindowPos( hWnd, NULL, x, y, 400, 416, SWP_SHOWWINDOW );
g_GameTimer.Compute();
SetTimer( hWnd, TIMER_ID_DEFAULT, 1000, NULL );
#if !defined(__INTERNALSERVER)
SetTimer( hWnd, TIMER_ID_WANTED, g_uWantedElapse, NULL );
#endif
#ifdef __EVENT0913
SetTimer( hWnd, TIMER_ID_EVENT0913, 1000, NULL );
#endif // __EVENT0913
#ifdef __EVENT1206
SetTimer( hWnd, TIMER_ID_EVENT1206, 1000 * 60, NULL );
#endif // __EVENT1206
SetTimer( hWnd, TIMER_ID_EVENT, 1000 * 60, NULL );
g_MyTrace.Initialize( hWnd, "SquireD", RGB( 0xff, 0xff, 0xff ), RGB( 0x00, 0x00, 0x00 ) );
CTime time = CTime::GetCurrentTime();
g_MyTrace.Add( 0, FALSE, "%s", time.Format( "%Y/%m/%d %H:%M:%S" ) );
g_MyTrace.AddLine( '\0' );
#ifndef _DEBUG
// InitEH();
#endif // _DEBUG
g_TickCount.Start();
if( !Script( "CoreServer.ini" ) )
{
return FALSE;
}
if( InitializeNetLib() == FALSE )
return FALSE;
if( !g_dpCoreSrvr.StartServer( PN_CORESRVR + 0 ) )
return FALSE;
if( !g_DPCacheSrvr.StartServer( PN_CORESRVR + 1 ) )
return FALSE;
if( !g_dpLoginSrvr.StartServer( PN_CORESRVR + 2 ) )
return FALSE;
if( !g_dpDatabaseClient.ConnectToServer( szDataBaseAddr, PN_DBSRVR_2, FALSE ) )
{
Error( "Not TransServer Connect" );
return FALSE;
}
if( !g_PartyMng.CreateWorkers() )
{
assert( 0 );
}
#ifdef __ENVIRONMENT_EFFECT
if( CEnvironment::GetInstance()->CreateWorkers() == FALSE )
{
assert( 0 );
}
#else // __ENVIRONMENT_EFFECT
if( !g_Environment.CreateWorkers() )
{
assert( 0 );
}
#endif // __ENVIRONMENT_EFFECT
ShowWindow(hWnd, nCmdShow);
UpdateWindow(hWnd);
return TRUE;
}