#include "stdafx.h" #include "GMTool.h" #include "resource.h" #include "Protocol_Cheat.h" #include "Notice_Common.h" #include "UIPrintImageText.h" #include "GameResourceManager.h" #include /// °øÁö°ü·Ã void cGMTool::OnShowNotice() { HWND hWnd = mSubDlg[GMTOOL_SUBDLG_NOTICE]; SetDlgItemText( hWnd, IDC_RICHEDIT_TEXT, _T("") ); SendMessage( GetDlgItem(hWnd, IDC_COMBO_NOTICETYPE), CB_SETCURSEL, 0, 0 ); /// À§Ä¡¼¼ÆÃ RECT rc0; ::GetWindowRect( mMainDlg, &rc0 ); int x = rc0.right; int y = rc0.top + GetSystemMetrics(SM_CYCAPTION); ::SetWindowPos( hWnd, 0, x, y, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE ); mSubDlgPos[GMTOOL_SUBDLG_NOTICE].x = 0; mSubDlgPos[GMTOOL_SUBDLG_NOTICE].y = GetSystemMetrics(SM_CYCAPTION); SetDlgItemTextA( mSubDlg[GMTOOL_SUBDLG_NOTICE], IDC_EDIT_NOTICE_PATH, mCurrentPath ); if( mIsNoticefileOpen == true ) { mNoticeFileLoader.Close(); mIsNoticefileOpen = false; } SetDlgItemInt( mSubDlg[GMTOOL_SUBDLG_NOTICE], IDC_EDIT_NOTICE_TIME_INTERVAL, 10, FALSE ); mTimeInterval = 0; SetDlgItemInt( mSubDlg[GMTOOL_SUBDLG_NOTICE], IDC_EDIT_NOTICE_TIME_INTERVAL, mTimeInterval, false ); SetDlgItemText( mSubDlg[GMTOOL_SUBDLG_NOTICE], IDC_EDIT_NOTICE_FILEREAD_END, _T("") ); SetDlgItemText( mSubDlg[GMTOOL_SUBDLG_NOTICE], IDC_EDIT_NOTICE_AUTO, _T("")); cStringT charCounter; charCounter.Format(_T("(0/%d)"), MSG_PRINT_LENGTH ); SetDlgItemText( mSubDlg[GMTOOL_SUBDLG_NOTICE], IDC_STATIC_NOTICE_CHAR_COUNTER, charCounter.Cstr() ); SendDlgItemMessage(mSubDlg[GMTOOL_SUBDLG_NOTICE], IDC_LIST_NOTICE_FILELIST, LB_RESETCONTENT, NULL, NULL); } void cGMTool::OnCommandNotice( int id, int msg ) { switch( id ) { case IDC_BUTTON_NOTICE_CANCEL: case IDC_BUTTON_NOTICE_CANCEL2: { ::ShowWindow( mSubDlg[GMTOOL_SUBDLG_NOTICE], SW_HIDE ); if( mIsNoticefileOpen == true ) { mNoticeFileLoader.Close(); mIsNoticefileOpen = false; SetDlgItemText( mSubDlg[GMTOOL_SUBDLG_NOTICE], IDC_EDIT_NOTICE_FILEREAD_END, _T("") ); SendDlgItemMessage(mSubDlg[GMTOOL_SUBDLG_NOTICE], IDC_LIST_NOTICE_FILELIST, LB_RESETCONTENT, NULL, NULL); } if( mIsNoticeTimerRun == true ) { KillTimer( mSubDlg[GMTOOL_SUBDLG_NOTICE], eGMTOOL_TIMER_NOTICE_SEND); mIsNoticeTimerRun = false; } if( mIsCounterTimerRun == true ) { KillTimer( mSubDlg[GMTOOL_SUBDLG_NOTICE], eGMTOOL_TIMER_DOWN_COUNT ); mIsCounterTimerRun = false; } ::SetActiveWindow( mParentWnd ); } break; case IDC_EDIT_NOTICE_NORMAL: { if( msg == EN_CHANGE ) { /// ³»¿ë ¹Þ±â TCHAR str[MSG_PRINT_LENGTH] = {0,}; int retcode = GetDlgItemTextW( mSubDlg[GMTOOL_SUBDLG_NOTICE], IDC_EDIT_NOTICE_NORMAL, str, MSG_PRINT_LENGTH ); if( retcode == false ) { cStringT charCounter; charCounter.Format(_T("(0/%d)"), MSG_PRINT_LENGTH ); SetDlgItemText( mSubDlg[GMTOOL_SUBDLG_NOTICE], IDC_STATIC_NOTICE_CHAR_COUNTER, charCounter.Cstr() ); return; } cStringT temp = str; temp.Replace( _T("\r\n"), _T(" ") ); temp.Replace( _T("\t"), _T(" ") ); temp.Replace( _T("\n"), _T(" ") ); temp.Replace( _T("\r"), _T(" ") ); cStringT charCounter; charCounter.Format(_T("(%d/%d)"), temp.GetLength(), MSG_PRINT_LENGTH ); SetDlgItemText( mSubDlg[GMTOOL_SUBDLG_NOTICE], IDC_STATIC_NOTICE_CHAR_COUNTER, charCounter.Cstr() ); } } break; case IDC_BUTTON_NOTICESEND: /// °øÁö Àü¼Û if( NETWORK->IsConnected() == true ) { HWND hComDlg = GetDlgItem( mSubDlg[GMTOOL_SUBDLG_NOTICE], IDC_COMBO_NOTICETYPE ); int noticeType = SendMessage( hComDlg, CB_GETCURSEL, 0, 0 ); /// ³»¿ë ¹Þ±â TCHAR str[MSG_PRINT_LENGTH] = {0,}; int retcode = GetDlgItemTextW( mSubDlg[GMTOOL_SUBDLG_NOTICE], IDC_EDIT_NOTICE_NORMAL, str, MSG_PRINT_LENGTH ); if( retcode == false ) return; /// °øÁö º¸³»±â SendNoticeMsg( noticeType, str ); /// ÃʱâÈ­ SetDlgItemText( mSubDlg[GMTOOL_SUBDLG_NOTICE], IDC_EDIT_NOTICE_NORMAL, _T("") ); } break; case IDC_BUTTON_NOTICE_FILESEARCH: { char findPath[ MAX_PATH ] = { 0, }; sprintf_s( findPath, "%s\\*.txt", mCurrentPath ); DlgDirListA( mSubDlg[GMTOOL_SUBDLG_NOTICE], findPath, IDC_LIST_NOTICE_FILELIST, 0, (DDL_ARCHIVE | DDL_DRIVES | DDL_DIRECTORY | DDL_READWRITE ) ); } break; case IDC_BUTTON_NOTICE_AUTORUN: { if( mAutoNoticeList.IsEmpty() == true ) { SetDlgItemText( mSubDlg[GMTOOL_SUBDLG_NOTICE], IDC_EDIT_NOTICE_FILEREAD_END, GAMERESOURCEMAN->GetGameText( 8063 ) ); return; } if( mIsNoticefileOpen == false ) { SetDlgItemText( mSubDlg[GMTOOL_SUBDLG_NOTICE], IDC_EDIT_NOTICE_FILEREAD_END, GAMERESOURCEMAN->GetGameText( 8063 ) ); return; } if( mIsNoticeTimerRun == true ) KillTimer( mSubDlg[GMTOOL_SUBDLG_NOTICE], eGMTOOL_TIMER_NOTICE_SEND ); /// ¸®½ºÆ®¿¡ Àִ ù¹øÂ° ÁÙÀ» °øÁö·Î º¸³»°í ŸÀÌ¸Ó µ¹¸®±â sAutoNotice* pAutoNotice = NULL; pAutoNotice = mAutoNoticeList.Front(); if( pAutoNotice ) { mTimeInterval = pAutoNotice->mTimeDelay; SetDlgItemInt( mSubDlg[GMTOOL_SUBDLG_NOTICE], IDC_EDIT_NOTICE_TIME_INTERVAL, pAutoNotice->mTimeDelay, FALSE ); /// °øÁö º¸³»±â int noticeType = SendDlgItemMessage( mSubDlg[GMTOOL_SUBDLG_NOTICE], IDC_COMBO_NOTICETYPE, CB_GETCURSEL, 0, 0 ); SendNoticeMsg( noticeType, pAutoNotice->mNoticeMsg ); SAFE_DELETE( pAutoNotice ); } mAutoNoticeList.PopFront(); ShowAutoNoticeMsg(); SetTimer( mSubDlg[GMTOOL_SUBDLG_NOTICE], eGMTOOL_TIMER_NOTICE_SEND, 1000, NULL ); mIsNoticeTimerRun = true; } break; case IDC_LIST_NOTICE_FILELIST: { switch( msg ) { case LBN_DBLCLK: { BOOL dir; char selectedName[MAX_PATH] = { 0, }; char path[MAX_PATH] = { 0, }; dir = DlgDirSelectExA( mSubDlg[GMTOOL_SUBDLG_NOTICE], selectedName, MAX_PATH, IDC_LIST_NOTICE_FILELIST ); ///Æú´õ ¼±Åà if( dir ) { if(lstrcmpA(selectedName, "..\\") == 0) { char *p; p = strrchr( mCurrentPath, '\\' ); *p = 0; } else if( selectedName[1] == ':' ) { sprintf_s( mCurrentPath, "%c:\\", selectedName[0] ); } else { sprintf_s( path, "%s\\%s", mCurrentPath, selectedName ); path[::lstrlenA(path)-1]=0; ::lstrcpyA(mCurrentPath, path ); } sprintf_s( path, "%s\\*.txt", mCurrentPath ); /// ºñ¾îÀÖ´Â µå¶óÀ̺ê·Î À̵¿ÇÒ °æ¿ì DDL_DRIVES ¿É¼ÇÀÌ DDL_EXECLUSIVE¸¦ È£ÃâÇÏ¿© ¸®½ºÆ®°¡ »ý¼ºµÇÁö ¾ÊÀ¸¹Ç·Î 2¹ø È£Ãâ DlgDirListA( mSubDlg[GMTOOL_SUBDLG_NOTICE], path, IDC_LIST_NOTICE_FILELIST, 0, ( DDL_DRIVES ) ); DlgDirListA( mSubDlg[GMTOOL_SUBDLG_NOTICE], path, IDC_LIST_NOTICE_FILELIST, 0, ( DDL_ARCHIVE | DDL_DRIVES | DDL_DIRECTORY | DDL_READWRITE ) ); SetDlgItemTextA( mSubDlg[GMTOOL_SUBDLG_NOTICE], IDC_EDIT_NOTICE_PATH, mCurrentPath ); } else { if( mIsNoticefileOpen == true ) { if ( mNoticeFileLoader.Close() == -1 ) { SetDlgItemText( mSubDlg[GMTOOL_SUBDLG_NOTICE], IDC_EDIT_NOTICE_FILEREAD_END, GAMERESOURCEMAN->GetGameText( 8065 ) ); break; } } if( mIsNoticeTimerRun == true ) { KillTimer( mSubDlg[GMTOOL_SUBDLG_NOTICE], eGMTOOL_TIMER_NOTICE_SEND ); mIsNoticeTimerRun = false; } SetDlgItemTextA( mSubDlg[GMTOOL_SUBDLG_NOTICE], IDC_EDIT_NOTICE_FILEREAD_END, "" ); /// ÆÄÀÏ ÀԷ½à .txtÆÄÀÏÀ» Àоî¿À±â sprintf_s( path, "%s\\%s", mCurrentPath, selectedName ); if( ParsingNoticeFile( path ) == false ) break; } } break; } } break; case IDC_BUTTON_SERVER_COUNT_SEND: { /// ¼­¹ö ÀÚµ¿ Á¾·á Ä«¿îÅÍ Àü¼Û HWND hComDlg = GetDlgItem( mSubDlg[GMTOOL_SUBDLG_NOTICE], IDC_COMBO_NOTICETYPE ); int noticeType = SendMessage( hComDlg, CB_GETCURSEL, 0, 0 ); if( noticeType != NM_NOTICE_NOTICE_SERVER_REQ && noticeType != NM_NOTICE_NOTICE_CHANNEL_REQ ) { SetDlgItemText( mSubDlg[GMTOOL_SUBDLG_NOTICE], IDC_EDIT_NOTICE_FILEREAD_END, GAMERESOURCEMAN->GetGameText( 8066 ) ); return; } int count = 0; BOOL ret = FALSE; count = GetDlgItemInt( mSubDlg[GMTOOL_SUBDLG_NOTICE], IDC_EDIT_SERVER_COUNT, &ret, FALSE ); if( ret == FALSE || count == 0 ) { SetDlgItemText( mSubDlg[GMTOOL_SUBDLG_NOTICE], IDC_EDIT_NOTICE_FILEREAD_END, GAMERESOURCEMAN->GetGameText( 8067 ) ); return; } if( mIsCounterTimerRun == true ) KillTimer( mSubDlg[GMTOOL_SUBDLG_NOTICE], eGMTOOL_TIMER_DOWN_COUNT ); /// ¼­¹ö °øÁö if( noticeType == 0 ) { MSG_REQ_NOTICE_DOWN_COUNT_SERVER msg; msg.Category = NM_NOTICE; msg.Protocol = NM_NOTICE_DOWN_COUNT_NOTICE_SERVER_REQ; msg.mCount = (unsigned short)count; if( NETWORK->IsConnected() == true ) { NETWORK->SendNetworkMsg( (char*)&msg, sizeof( msg ) ); } if( count-1 > 0 ) { SetTimer( mSubDlg[GMTOOL_SUBDLG_NOTICE], eGMTOOL_TIMER_DOWN_COUNT, 1000, NULL ); mNumDownCounter.mCount = (unsigned short)count-1; mNumDownCounter.mNoticeType = (short)noticeType; } } /// ä³Î °øÁö else if( noticeType == 1 ) { MSG_REQ_NOTICE_DOWN_COUNT_CHANNEL msg; msg.Category = NM_NOTICE; msg.Protocol = NM_NOTICE_DOWN_COUNT_NOTICE_CHANNEL_REQ; msg.mCount = (unsigned short)count; if( NETWORK->IsConnected() == true ) { NETWORK->SendNetworkMsg( (char*)&msg, sizeof( msg ) ); } if( count-1 > 0 ) { SetTimer( mSubDlg[GMTOOL_SUBDLG_NOTICE], eGMTOOL_TIMER_DOWN_COUNT, 1000, NULL ); mNumDownCounter.mCount = (unsigned short)count-1; mNumDownCounter.mNoticeType = (short)noticeType; } } mIsCounterTimerRun = true; } break; case IDC_BUTTON_NOTICE_CANCEL_AUTORUN: { /// ¼­¹ö ÀÚµ¿ °øÁö Ãë¼Ò mIsNoticeTimerRun = false; mIsNoticefileOpen = false; mTimeInterval = 0; KillTimer( mSubDlg[GMTOOL_SUBDLG_NOTICE], eGMTOOL_TIMER_NOTICE_SEND ); SetDlgItemText( mSubDlg[GMTOOL_SUBDLG_NOTICE], IDC_EDIT_NOTICE_AUTO, _T("")); SetDlgItemText( mSubDlg[GMTOOL_SUBDLG_NOTICE], IDC_EDIT_NOTICE_FILEREAD_END, GAMERESOURCEMAN->GetGameText( 8064 ) ); SetDlgItemInt( mSubDlg[GMTOOL_SUBDLG_NOTICE], IDC_EDIT_NOTICE_TIME_INTERVAL, 0, FALSE ); tAutoNoticeList::cConstIterator iBegin = mAutoNoticeList.Begin(); tAutoNoticeList::cConstIterator iEnd = mAutoNoticeList.End(); for( ; iBegin != iEnd; ++iBegin ) { sAutoNotice* pAutoNotice = NULL; pAutoNotice = *iBegin; SAFE_DELETE( pAutoNotice ); } mAutoNoticeList.Clear(); } break; case IDC_BUTTON_CANCEL_SERVER_COUNT: { /// ¼­¹ö ÀÚµ¿ Á¾·á Ä«¿îÅÍ Ãë¼Ò if( mIsCounterTimerRun == true ) { KillTimer( mSubDlg[GMTOOL_SUBDLG_NOTICE], eGMTOOL_TIMER_DOWN_COUNT ); mIsCounterTimerRun = false; } } break; } } void cGMTool::OnTimerNotice( int timerIndex ) { switch( timerIndex ) { case eGMTOOL_TIMER_NOTICE_SEND: { --mTimeInterval; SetDlgItemInt( mSubDlg[GMTOOL_SUBDLG_NOTICE], IDC_EDIT_NOTICE_TIME_INTERVAL, mTimeInterval, FALSE ); if( mTimeInterval < 1 ) { /// ¸®½ºÆ®¿¡ Àִ ù¹øÂ° ÁÙÀ» °øÁö·Î º¸³»°í ŸÀÌ¸Ó µ¹¸®±â sAutoNotice* pAutoNotice = NULL; pAutoNotice = mAutoNoticeList.Front(); if( pAutoNotice ) { mTimeInterval = pAutoNotice->mTimeDelay; SetDlgItemInt( mSubDlg[GMTOOL_SUBDLG_NOTICE], IDC_EDIT_NOTICE_TIME_INTERVAL, pAutoNotice->mTimeDelay, FALSE ); /// °øÁö º¸³»±â int noticeType = SendDlgItemMessage( mSubDlg[GMTOOL_SUBDLG_NOTICE], IDC_COMBO_NOTICETYPE, CB_GETCURSEL, 0, 0 ); SendNoticeMsg( noticeType, pAutoNotice->mNoticeMsg ); SAFE_DELETE( pAutoNotice ); } mAutoNoticeList.PopFront(); ShowAutoNoticeMsg(); if( mAutoNoticeList.IsEmpty() == true ) { mIsNoticeTimerRun = false; mIsNoticefileOpen = false; mTimeInterval = 0; KillTimer( mSubDlg[GMTOOL_SUBDLG_NOTICE], eGMTOOL_TIMER_NOTICE_SEND ); SetDlgItemText( mSubDlg[GMTOOL_SUBDLG_NOTICE], IDC_EDIT_NOTICE_AUTO, _T("")); SetDlgItemText( mSubDlg[GMTOOL_SUBDLG_NOTICE], IDC_EDIT_NOTICE_FILEREAD_END, GAMERESOURCEMAN->GetGameText( 8064 ) ); SetDlgItemInt( mSubDlg[GMTOOL_SUBDLG_NOTICE], IDC_EDIT_NOTICE_TIME_INTERVAL, 0, FALSE ); return; } } } break; case eGMTOOL_TIMER_DOWN_COUNT: { if( mNumDownCounter.mNoticeType == 0 ) { MSG_REQ_NOTICE_DOWN_COUNT_SERVER msg; msg.Category = NM_NOTICE; msg.Protocol = NM_NOTICE_DOWN_COUNT_NOTICE_SERVER_REQ; msg.mCount = mNumDownCounter.mCount; if( NETWORK->IsConnected() == true ) { NETWORK->SendNetworkMsg( (char*)&msg, sizeof( msg ) ); } } else { MSG_REQ_NOTICE_DOWN_COUNT_CHANNEL msg; msg.Category = NM_NOTICE; msg.Protocol = NM_NOTICE_DOWN_COUNT_NOTICE_CHANNEL_REQ; msg.mCount = mNumDownCounter.mCount; if( NETWORK->IsConnected() == true ) { NETWORK->SendNetworkMsg( (char*)&msg, sizeof( msg ) ); } } SetDlgItemInt( mSubDlg[GMTOOL_SUBDLG_NOTICE], IDC_EDIT_SERVER_COUNT, mNumDownCounter.mCount, NULL ); if ( mNumDownCounter.mCount <= 1 ) { KillTimer( mSubDlg[GMTOOL_SUBDLG_NOTICE], eGMTOOL_TIMER_DOWN_COUNT ); mIsCounterTimerRun = false; return; } else mNumDownCounter.mCount--; } break; } } bool cGMTool::LoadNoticeData() { HWND typeCombo = GetDlgItem( mSubDlg[GMTOOL_SUBDLG_NOTICE], IDC_COMBO_NOTICETYPE ); if( ::IsWindow( typeCombo ) == false ) { assert(0); return false; } /// Á¤º¸ »ðÀÔ SendMessage( typeCombo, CB_ADDSTRING, 0, (LPARAM)_T("Server")); SendMessage( typeCombo, CB_ADDSTRING, 0, (LPARAM)_T("Channel")); SendMessage( typeCombo, CB_ADDSTRING, 0, (LPARAM)_T("Map")); /// °øÁö º¸³¾ ¼ö ÀÖ´Â ±æÀÌ Á¦ÇÑ °É±â SendDlgItemMessage( mSubDlg[GMTOOL_SUBDLG_NOTICE], IDC_EDIT_NOTICE_NORMAL, EM_SETLIMITTEXT, (WPARAM)MSG_PRINT_LENGTH, 0 ); /// ¼­¹ö Ä«¿îÆ® ´Ù¿î ±æÀÌ Á¦ÇѰɱâ 999ÃÊ ÇѰè SendDlgItemMessage( mSubDlg[GMTOOL_SUBDLG_NOTICE], IDC_EDIT_SERVER_COUNT, EM_SETLIMITTEXT, (WPARAM)3, 0 ); return true; } bool cGMTool::ParsingNoticeFile( char* filePath ) { if( mNoticeFileLoader.Open( filePath, true ) == false ) return false; tAutoNoticeList::cConstIterator iBegin = mAutoNoticeList.Begin(); tAutoNoticeList::cConstIterator iEnd = mAutoNoticeList.End(); for( ; iBegin != iEnd; ++iBegin ) { sAutoNotice* pAutoNotice = NULL; pAutoNotice = *iBegin; SAFE_DELETE( pAutoNotice ); } mAutoNoticeList.Clear(); mIsNoticefileOpen = true; char noticeMsg [ MSG_PRINT_LENGTH*2 + 2 ] = { 0, }; while( mNoticeFileLoader.IsEnd() != true ) { memset( noticeMsg, 0, sizeof( noticeMsg ) ); int readByte = mNoticeFileLoader.ReadLine( noticeMsg, sizeof(char)*MSG_PRINT_LENGTH*2 ); if( readByte != 0 ) { if( noticeMsg[0] == '\r' || noticeMsg[0] == '\n' ) continue; if( _ismbslead( (unsigned char*)noticeMsg, (unsigned char*)¬iceMsg[readByte-1] ) == -1 ) { char readBuf[2] = {0,}; /// ÀоîµéÀÎ ºÎºÐÀÇ ¸¶Áö¸· ±ÛÀÚ°¡ ©·Á¼­ ÀÐÈù°æ¿ì 1byte ´õ ÀÐÀ½ if( mNoticeFileLoader.ReadLine( readBuf, 2 ) != 0 ) strcat_s( noticeMsg, sizeof(noticeMsg), readBuf ); } try { /// ½Ã°£ÀÌ ¼³Á¤µÇ¾î ÀÖ´ÂÁö °Ë»ç if( noticeMsg[0] == '[' ) { char* pos = NULL; pos = strchr( noticeMsg, ']' ); if( pos != NULL ) { char numBuffer[MSG_PRINT_LENGTH] = {0,}; strncpy_s( numBuffer, sizeof(numBuffer), ¬iceMsg[1], pos - noticeMsg ); int timeDelay = atoi( numBuffer ); /// ½Ã°£ °ª ÃàÃâ ¼º°ø if( timeDelay != 0 ) { sAutoNotice* pAutoNoticeMsg; pAutoNoticeMsg = new sAutoNotice; if( pAutoNoticeMsg ) { pAutoNoticeMsg->mTimeDelay = timeDelay; if( ConvertToUnicode( ++pos, pAutoNoticeMsg->mNoticeMsg, sizeof( pAutoNoticeMsg->mNoticeMsg ) ) != 0 ) { mAutoNoticeList.PushBack( pAutoNoticeMsg ); } else { delete pAutoNoticeMsg; } } } else throw -1; } else throw -1; } else throw -1; } catch ( ... ) { ///½Ã°£ °ª ÃàÃâ ½ÇÆÐ½Ã ±âº»ÀûÀÎ ½Ã°£ µô·¹À̸¦ 1 ÃÊ·Î ¼³Á¤ÇÏ°í ³»¿ëÀ» Ãâ·ÂÇÑ´Ù. sAutoNotice* pAutoNoticeMsg; pAutoNoticeMsg = new sAutoNotice; if( pAutoNoticeMsg ) { pAutoNoticeMsg->mTimeDelay = 1; if( ConvertToUnicode( noticeMsg, pAutoNoticeMsg->mNoticeMsg, sizeof( pAutoNoticeMsg->mNoticeMsg ) ) != 0 ) { mAutoNoticeList.PushBack( pAutoNoticeMsg ); } else { delete pAutoNoticeMsg; } } } } } //int fileSize = mNoticeFileLoader.GetSize(); mNoticeFileLoader.Close(); ShowAutoNoticeMsg(); return true; } void cGMTool::SendNoticeMsg( int noticeType, WCHAR* str ) { /// ÇÊÅ͸µ cStringT temp = str; temp.Replace( _T("\r\n"), _T("\0") ); temp.Replace( _T("\t"), _T(" ") ); temp.Replace( _T("\n"), _T("\0") ); temp.Replace( _T("\r"), _T("\0") ); /// ¼­¹ö°øÁö if( noticeType == eGMTOOL_NOTICE_SERVER ) { MSG_REQ_NOTICE_SERVER msg; ::memset( &msg, 0, sizeof( msg ) ); msg.Category = NM_NOTICE; msg.Protocol = NM_NOTICE_NOTICE_SERVER_REQ; ::Sstrncpy( msg.mMessage, MAX_CHAT_BUFFER_SIZE, temp.Cstr(), MSG_PRINT_LENGTH ); NETWORK->SendNetworkMsg( (char*)&msg, (unsigned short)msg.GetMsgLength() ); } /// ä³Î°øÁö else if( noticeType == eGMTOOL_NOTICE_CHANNEL ) { MSG_REQ_NOTICE_CHANNEL msg; ::memset( &msg, 0, sizeof( msg ) ); msg.Category = NM_NOTICE; msg.Protocol = NM_NOTICE_NOTICE_CHANNEL_REQ; ::Sstrncpy( msg.mMessage, MAX_CHAT_BUFFER_SIZE, temp.Cstr(), MSG_PRINT_LENGTH ); NETWORK->SendNetworkMsg( (char*)&msg, (unsigned short)msg.GetMsgLength() ); } /// ¸Ê °øÁö else if( noticeType == eGMTOOL_NOTICE_MAP ) { MSG_REQ_NOTICE_AREA msg; ::memset( &msg, 0, sizeof( msg ) ); msg.Category = NM_NOTICE; msg.Protocol = NM_NOTICE_NOTICE_AREA_REQ; ::Sstrncpy( msg.mMessage, MAX_CHAT_BUFFER_SIZE, temp.Cstr(), MSG_PRINT_LENGTH ); NETWORK->SendNetworkMsg( (char*)&msg, (unsigned short)msg.GetMsgLength() ); } else { assert(0); return; } } void cGMTool::ShowAutoNoticeMsg() { SetDlgItemText( mSubDlg[GMTOOL_SUBDLG_NOTICE], IDC_EDIT_NOTICE_AUTO, _T("")); if( mAutoNoticeList.IsEmpty() == true ) return; cStringT text; cStringT temp; tAutoNoticeList::cConstIterator iBegin = mAutoNoticeList.Begin(); tAutoNoticeList::cConstIterator iEnd = mAutoNoticeList.End(); for( ; iBegin != iEnd; ++iBegin ) { sAutoNotice* pAutoNotice = NULL; pAutoNotice = *iBegin; temp.Format( _T( "[%d]%s\r\n" ), pAutoNotice->mTimeDelay, pAutoNotice->mNoticeMsg ); text += temp; } SetDlgItemText( mSubDlg[GMTOOL_SUBDLG_NOTICE], IDC_EDIT_NOTICE_AUTO, text.Cstr() ); }