示例#1
0
wxString wxLuaCheckStack::DumpStack(const wxString& msg)
{
    wxCHECK_MSG(m_luaState, wxEmptyString, wxT("Invalid lua_State"));

    lua_State* L = m_luaState;
    int i, count = lua_gettop(L);
    wxString str;
    wxString retStr;

    str.Printf(wxT("wxLuaCheckStack::DumpStack(L=%p), '%s':'%s', items %d, starting top %d\n"), L, m_msg.c_str(), msg.c_str(), count, m_top);
    retStr += str;
    OutputMsg(str);

    wxLuaState wxlState(L);

    for (i = 1; i <= count; i++)
    {
        int wxl_type = 0;
        wxString value;
        int l_type = wxLuaDebugData::GetTypeValue(L, i, &wxl_type, value);

        str.Printf(wxT("  idx %d: l_type = %d, wxl_type = %d : '%s'='%s'\n"),
                i, l_type, wxl_type, wxluaT_typename(L, wxl_type).c_str(), value.c_str());
        retStr += str;
        OutputMsg(str);
    }

    return retStr;
}
示例#2
0
/************************************************************************************
  파일 패치
*************************************************************************************/
bool CNewAppDlg::PatchFile( const char* szPatchFileName, const char* szFileName)
{
	// 업데이트 파일을 찾는다
	WIN32_FIND_DATA FindData;
	HANDLE hFind = FindFirstFile( _T( szPatchFileName), &FindData);
	if ( hFind != INVALID_HANDLE_VALUE)		// 파일이 있으면...
	{
		FindClose( hFind);


		// 업데이트 파일을 복사한다.
		if ( CopyFile( _T( szPatchFileName), _T( szFileName), false) == TRUE)	// 복사 했으면...
		{
			// 업데이트 파일을 삭제한다.
			DeleteFile( _T( szPatchFileName));


			// 출력 메시지 작성
			char szMsg[ 512];
			sprintf( szMsg, "%s : Patched", szFileName);
			OutputMsg( szMsg);

			return true;
		}

		// 복사 실패이면...
		else
		{
			// 에러 코드
			LPVOID lpMsgBuf;
			DWORD error = GetLastError();
			FormatMessage(	FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
							NULL, error, MAKELANGID( LANG_NEUTRAL, SUBLANG_DEFAULT),
							(LPTSTR)&lpMsgBuf, 0, NULL);

			// 출력 메시지 작성
			char szMsg[ 512];
			sprintf( szMsg, "%s : Failed (%s)\n", szFileName, lpMsgBuf);
			OutputMsg( szMsg);

			LocalFree( lpMsgBuf);

			return false;
		}
	}


	return true;
}
QTcpClientSocketThread::QTcpClientSocketThread(QObject *parent) :
    QMyBaseThread(parent)
{
    setObjectName( "QTcpClientSocketThread" );
    OutputMsg( QString( " Created" ) );
    pClientSocket = NULL;
}
示例#4
0
void cLog::write(const tstring & buffer)
{
    if (!m_bUsefull)
    {
        //OutputMsg("log unusefull:%s", buffer.c_str());
        return;
    }

#ifdef _DEBUG

#ifdef _UNICODE
//     std::string tmpString = wcharToChar(buffer);
//     OutputMsg("%s", tmpString.c_str());
    OutputMsgW(_T("%s"), buffer.c_str());
#else
    OutputMsg("%s", buffer.c_str());
#endif

#endif

    ZLockHolder holder(&m_writeMutex);
    tstring header;
    generateTimeHead(header);
    m_fLog<<header<<buffer<<std::endl;
}
示例#5
0
wxString wxLuaCheckStack::DumpTable(const wxString &tablename, const wxString& msg)
{
    wxCHECK_MSG(m_luaState, wxEmptyString, wxT("Invalid lua_State"));

    lua_State* L = m_luaState;
    wxSortedArrayString tableArray;
    wxString s;

    // Allow iteration through table1.table2.table3...
    wxString tname(tablename);
    lua_pushglobaltable(L);

    do {
        lua_pushstring(L, wx2lua(tname.BeforeFirst(wxT('.'))));
        lua_rawget(L, -2);

        if (lua_isnil(L, -1) || !lua_istable(L, -1))
        {
            lua_pop(L, 2);  // remove table and value

            s.Printf(wxT("wxLuaCheckStack::DumpTable(L=%p) Table: '%s' cannot be found!\n"), L, tablename.c_str());
            OutputMsg(s);
            return s;
        }

        lua_remove(L, -2);  // remove previous table
        tname = tname.AfterFirst(wxT('.'));
    } while (tname.Len() > 0);

    s = DumpTable(lua_gettop(L), tablename, msg, tableArray, 0);
    lua_pop(L, 1);

    return s;
}
void QTcpClientSocketThread::InitializeSubThread( )
{
    if ( NULL == pClientSocket ) {
        pClientSocket = network.GenerateTcpClientSocket( commonFunction.GetTextCodec( ) );
        OutputMsg( objectName( ) );
    }

    connect( &network, SIGNAL( NotifyMessage( void*, QManipulateIniFile::LogTypes ) ), this, SLOT( HandleMessage( void*, QManipulateIniFile::LogTypes ) ) );
    connect( &network, SIGNAL( GetWholeTcpStreamData( QTcpSocket*, void* ) ), this, SLOT( HandleGetWholeTcpStreamData( QTcpSocket*, void* ) ) );
}
QTcpClientSocketThread::~QTcpClientSocketThread( )
{
    if ( NULL != pClientSocket ) {
        pClientSocket->close( );
        delete pClientSocket;
        pClientSocket = NULL;
    }

    OutputMsg( "" );
}
示例#8
0
void QUdpClient::HandleError( QAbstractSocket::SocketError socketError )
{
    QString* pstrMsg = new QString( );
    QNetCommFunction::GetErrorMsg( *pstrMsg, socketError, this );

    *pstrMsg = LogText( *pstrMsg  );
    OutputMsg( "Sender:" + sender( )->objectName( ) + QString( "emit NotifyMessage( %1, QManipulateIniFile::LogNetwork )" ).arg( *pstrMsg ) );

    emit NotifyMessage( pstrMsg, QManipulateIniFile::LogNetwork );
}
示例#9
0
wxString wxLuaCheckStack::TestStack(const wxString &msg)
{
    wxString s;
    s.Printf(wxT("wxLuaCheckStack::TestStack(L=%p) '%s':'%s': starting top %d ending top %d\n"),
                    m_luaState, m_msg.c_str(), msg.c_str(), m_top, lua_gettop(m_luaState));

    if (m_top != lua_gettop(m_luaState)) s += wxT(" **********"); // easy to find

    OutputMsg(s);

    return s;
}
示例#10
0
void QUdpClient::IncomingData( )
{
    //OutputMsg( "Receive data" );

    if ( NULL == pByteArray ) {
        pByteArray = new QByteArray( );
    }

    QHostAddress senderAddr;
    quint16 senderPort;
    GetUdpDatagram( senderAddr, senderPort );

    OutputMsg( senderAddr.toString( ) + ":" + QString::number( senderPort ) );

    emit GetWholeUdpDatagram( pByteArray, senderAddr.toString( ), senderPort );

    pByteArray = NULL;
}
示例#11
0
// OnInitDialog : 다이얼로그를 초기화는 함수
BOOL CNewAppDlg::OnInitDialog() 
{
	CDDBDialog::OnInitDialog();
	

	// 다이얼로그 타이틀 변경
	SetWindowText( "GunZ Updater");


#ifdef LOCALE_NHNUSA
	GetScreen()->PutText( 1, 3, GetWidth(), 20, 16, "Arial", "GunZ Updater", RGB( 20, 20, 20), TS_BOLD, DT_CENTER);
	GetScreen()->PutText( 0, 2, GetWidth(), 20, 16, "Arial", "GunZ Updater", RGB( 200, 200, 200), TS_BOLD, DT_CENTER);
	GetScreen()->PutBox( 12, 24, GetWidth() - 24, GetHeight() - 68, RGB( 80, 80, 80));
#endif


	// 다이얼로그 위치 이동 및 크기 조절
	CRect rect; 
	GetWindowRect( &rect);
	int nWidth = rect.Width(), nHeight = rect.Height();
	rect.right  = rect.left + nWidth;
	rect.bottom = rect.top  + nHeight;
	MoveWindow( rect, true);


	// 메시지 표시
	((CListBox*)GetDlgItem( IDC_OUTPUT))->ResetContent();
	((CListBox*)GetDlgItem( IDC_OUTPUT))->MoveWindow( 13, 25, GetWidth() - 26, GetHeight() - 70);
	OutputMsg( "Ready...");


	// 버튼 초기화
	m_cOK.InitDDBButton( IDR_BMP_BUTTON, NULL);
	m_cOK.MoveWindow( GetWidth() / 2 - m_cOK.GetWidth() / 2, GetHeight() - 35);
	m_cOK.EnableWindow( FALSE);


	// 타이머 개시
	SetTimer( 0, 200, NULL);


	return true;
}
示例#12
0
/************************************************************************************
  타이머
*************************************************************************************/
void CNewAppDlg::OnTimer(UINT nIDEvent)
{
	// 업데이트 타이머
	if ( nIDEvent == 0)
	{
		static DWORD tStartTime = timeGetTime();
		DWORD currTime = timeGetTime() - tStartTime;


		// 런쳐 프로세스가 종료되는 것을 확인한다
		static bool bClosedLauncher = false;
		if ( !bClosedLauncher && (currTime > 500))
		{
			bClosedLauncher = FindLauncherProcess();
		}


		// 파일 패치
		if ( bClosedLauncher)
		{
			static int nPatchCount = 0;
			static int nErrorCount = 0;
			switch ( nPatchCount)
			{
				case 0 :
					nPatchCount++;
					if ( PatchFile( ".\\PATCH\\AbbyLauncher.exe_", ".\\AbbyLauncher.exe") == false)
						nErrorCount++;
					break;

				case 1 :
					nPatchCount++;
					if ( PatchFile( ".\\PATCH\\HanAuthForClient.dll_", ".\\HanAuthForClient.dll") == false)
						nErrorCount++;
					break;

				case 2 :
					nPatchCount++;
					if ( PatchFile( ".\\PATCH\\HanReportForClient.dll_", ".\\HanReportForClient.dll") == false)
						nErrorCount++;
					break;

				case 3 :
					nPatchCount++;

					if ( nErrorCount)
					{
						((CListBox*)GetDlgItem( IDC_OUTPUT))->ShowScrollBar( SB_HORZ);
						((CListBox*)GetDlgItem( IDC_OUTPUT))->SetHorizontalExtent( 1000);
						
						char szMsg[ 512];
						sprintf( szMsg, "%d error has been found.", nErrorCount);
						OutputMsg( szMsg);
					}
					else
						OutputMsg( "Patch successfully completed.");
					
					tStartTime = timeGetTime();
					m_cOK.EnableWindow( TRUE);
					break;

				// 윈도우 종료
				case 4 :
					if ( (nErrorCount == 0) && (currTime > 2000))
						OnOK();
					break;

				default :
					break;
			}
		}
	}


	CDDBDialog::OnTimer(nIDEvent);
}
void QTcpClientSocketThread::HandleGetWholeTcpStreamData( QTcpSocket* pPeerSocket, void *pByteArray )
{
    OutputMsg( "Sender:" + sender( )->objectName( ) + "GetWholeTcpStreamData( ... )" );
    emit GetWholeTcpStreamData( pPeerSocket, pByteArray );
}
示例#14
0
wxString wxLuaCheckStack::DumpTable(int stack_idx, const wxString& tablename, const wxString& msg, wxSortedArrayString& tableArray, int indent)
{
    wxCHECK_MSG(m_luaState, wxEmptyString, wxT("Invalid lua_State"));

    lua_State* L = m_luaState;
    wxLuaState wxlState(L);
    wxString indentStr;
    wxString s;

    // We only do tables, return error message
    if (!lua_istable(L, stack_idx))
    {
        s.Printf(wxT("wxLuaCheckStack::DumpTable(L=%p) stack idx %d is not a table.\n"), L, stack_idx);
        OutputMsg(s);
        return s;
    }

    if (indent == 0)
    {
        // First time through print header
        s.Printf(wxT("wxLuaCheckStack::DumpTable(L=%p) Table: '%s'\n"), L, tablename.c_str());
        OutputMsg(s);
    }
    else if (indent > 10)
    {
        // Don't let things get out of hand...
        s.Printf(wxT("wxLuaCheckStack::DumpTable(L=%p) Table depth > 10! Truncating: '%s'\n"), L, tablename.c_str());
        OutputMsg(s);
        return s;
    }
    else
    {
        indentStr = wxString(wxT(' '), indent*2) + wxT(">");
    }

    wxString title = wxString::Format(wxT("%sTable Level %d : name '%s'\n"), indentStr.c_str(), indent, tablename.c_str());
    s += title;
    OutputMsg(title);

    lua_pushvalue(L, stack_idx); // push the table to read the top of the stack

    lua_pushnil(L);
    while (lua_next(L, -2) != 0)
    {
        int keyType = 0, valueType = 0;
        wxString key, value;

        wxLuaDebugData::GetTypeValue(L, -2, &keyType,   key);
        wxLuaDebugData::GetTypeValue(L, -1, &valueType, value);

        wxString info = wxString::Format(wxT("%s%-32s\t%-16s\t%-20s\t%-16s\n"),
                indentStr.c_str(), key.c_str(), wxluaT_typename(L, keyType).c_str(), value.c_str(), wxluaT_typename(L, valueType).c_str());
        s += info;
        OutputMsg(info);

        if (tableArray.Index(value) == wxNOT_FOUND)
        {
            if (valueType == WXLUA_TTABLE)
            {
                tableArray.Add(value);
                s += DumpTable(lua_gettop(L), tablename + wxT(".") + key, msg, tableArray, indent+1);
            }
            else
            {
                tableArray.Add(value);
            }
        }

        lua_pop(L, 1); // pop value
    }

    lua_pop(L, 1); // pop pushed table

    return s;
}