Files
Client/Server/ToolProject/GameLogAnalyzer/GameLogAnalyzerDlg.cpp
LGram16 dd97ddec92 Restructure repository to include all source folders
Move git root from Client/ to src/ to track all source code:
- Client: Game client source (moved to Client/Client/)
- Server: Game server source
- GameTools: Development tools
- CryptoSource: Encryption utilities
- database: Database scripts
- Script: Game scripts
- rylCoder_16.02.2008_src: Legacy coder tools
- GMFont, Game: Additional resources

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-29 20:17:20 +09:00

723 lines
19 KiB
C++

// GameLogAnalyzerDlg.cpp : 구현 파일
//
#include "stdafx.h"
#include "GameLogAnalyzer.h"
#include "GameLogAnalyzerDlg.h"
#include "CharacterInfoDlg.h"
#include "ItemInfoSheet.h"
#include "SearchClass.h"
#include <RylGameLibrary/Log/ParseLog.h>
#include <set>
#include <string>
#include "GlobalFunctions.h"
#include "Clipboard.h"
#include ".\gameloganalyzerdlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// 응용 프로그램 정보에 사용되는 CAboutDlg 대화 상자입니다.
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
// 대화 상자 데이터
enum { IDD = IDD_ABOUTBOX };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 지원
// 구현
protected:
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
END_MESSAGE_MAP()
// CGameLogAnalyzerDlg 대화 상자
CGameLogAnalyzerDlg::CGameLogAnalyzerDlg(CWnd* pParent /*=NULL*/)
: CDialog(CGameLogAnalyzerDlg::IDD, pParent)
, m_SearchValue(_T(""))
, m_FileName(_T(""))
, m_Page(_T(""))
, m_bShowUID(TRUE)
, m_bShowCID(TRUE)
, m_bShowTime(TRUE)
, m_bShowPosition(FALSE)
, m_bSearchInResult(FALSE)
, m_XPos(_T("0"))
, m_YPos(_T("0"))
, m_ZPos(_T("0"))
, m_Radius(_T("0"))
, m_dwGoPageIndex(1)
{
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
void CGameLogAnalyzerDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Control(pDX, IDC_SEARCH_TYPE_COMBO, m_ctrlSearchTypeCb);
DDX_Control(pDX, IDC_VIEW_NUM_COMBO, m_ListNum);
DDX_Text(pDX, IDC_READFILENAME, m_FileName);
DDX_Text(pDX, IDC_SEARCH_VALUE_EDIT, m_SearchValue);
DDX_Text(pDX, IDC_EDIT1, m_Page);
DDX_Check(pDX, IDC_SHOW_UID, m_bShowUID);
DDX_Check(pDX, IDC_CHECK2, m_bShowCID);
DDX_Check(pDX, IDC_CHECK3, m_bShowTime);
DDX_Check(pDX, IDC_CHECK4, m_bShowPosition);
DDX_Check(pDX, IDC_CHECK5, m_bSearchInResult);
DDX_Control(pDX, IDC_DATETIMEPICKER2, m_SearchStartDate);
DDX_Control(pDX, IDC_DATETIMEPICKER3, m_SearchStopDate);
DDX_Text(pDX, IDC_EDIT2, m_XPos);
DDX_Text(pDX, IDC_EDIT3, m_YPos);
DDX_Text(pDX, IDC_EDIT4, m_ZPos);
DDX_Text(pDX, IDC_EDIT5, m_Radius);
DDX_Control(pDX, IDC_RESULT_LIST, m_ListBox);
DDX_Text(pDX, IDC_GOPAGE_EDIT, m_dwGoPageIndex);
DDV_MinMaxUInt(pDX, m_dwGoPageIndex, 1, UINT_MAX);
DDX_Control(pDX, IDC_CATEGORY_TYPE_CB, m_ctrlCategoryTypeCb);
}
BEGIN_MESSAGE_MAP(CGameLogAnalyzerDlg, CDialog)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
//}}AFX_MSG_MAP
ON_BN_CLICKED(IDC_READ_FILE_SELECT_BUTTON, OnBnClickedFileSelect)
ON_BN_CLICKED(IDC_SEARCH_BUTTON, OnBnClickedSearch)
ON_LBN_DBLCLK(IDC_RESULT_LIST, OnLbnDblclkResultList)
ON_BN_CLICKED(IDC_PREV_BUTTON, OnBnClickedPrevButton)
ON_BN_CLICKED(IDC_NEXT_BUTTON, OnBnClickedNextButton)
ON_BN_CLICKED(IDC_BUTTON2, OnBnPositionResetClicked)
ON_BN_CLICKED(IDC_BUTTON3, OnBnTimeResetClicked)
ON_WM_CLOSE()
ON_CBN_SELCHANGE(IDC_CATEGORY_TYPE_CB, OnCbnSelchangeCategoryTypeCombo)
ON_BN_CLICKED(IDC_EXTRACTMULTIFILE, OnBnClickedExtractmultifile)
ON_WM_CONTEXTMENU()
ON_COMMAND(ID_RESULT_EXPORTTOFILE, OnResultExporttofile)
ON_BN_CLICKED(IDC_GOPAGE_BTN, OnBnClickedGopageBtn)
ON_BN_CLICKED(IDC_DEFAULT_BTN, OnBnClickedDefaultBtn)
ON_BN_CLICKED(IDC_CONVERT_TO_TEXT, OnBnClickedConvertToText)
ON_COMMAND(ID_RESULT_EXPORTTOCLIPBOARD, OnResultExportToClipboard)
END_MESSAGE_MAP()
// CGameLogAnalyzerDlg 메시지 처리기
BOOL CGameLogAnalyzerDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// 시스템 메뉴에 "정보..." 메뉴 항목을 추가합니다.
// IDM_ABOUTBOX는 시스템 명령 범위에 있어야 합니다.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
// 이 대화 상자의 아이콘을 설정합니다. 응용 프로그램의 주 창이 대화 상자가 아닐 경우에는
// 프레임워크가 이 작업을 자동으로 수행합니다.
SetIcon(m_hIcon, TRUE); // 큰 아이콘을 설정합니다.
SetIcon(m_hIcon, FALSE); // 작은 아이콘을 설정합니다.
// TODO: 여기에 추가 초기화 작업을 추가합니다.
SetDlgItemText(IDC_LOGFILENAME_STATIC, GetMyINIString("STRING_FOR_LOCALIZE", "LOG_FILE_NAME"));
SetDlgItemText(IDC_READ_FILE_SELECT_BUTTON, GetMyINIString("STRING_FOR_LOCALIZE", "FILE_SELECT"));
SetDlgItemText(IDC_SEARCHTIME_STATIC, GetMyINIString("STRING_FOR_LOCALIZE", "SEARCH_TIME"));
SetDlgItemText(IDC_SEARCHCOORDINATES_STATIC, GetMyINIString("STRING_FOR_LOCALIZE", "SEARCH_COORDINATES"));
SetDlgItemText(IDC_SEARCHTYPE_STATIC, GetMyINIString("STRING_FOR_LOCALIZE", "SEARCH_TYPE"));
SetDlgItemText(IDC_SEARCHCONDITION_STATIC, GetMyINIString("STRING_FOR_LOCALIZE", "SEARCH_CONDITION"));
SetDlgItemText(IDC_SEARCHVALUE_STATIC, GetMyINIString("STRING_FOR_LOCALIZE", "SEARCH_VALUE"));
SetDlgItemText(IDC_EXTRACTMULTIFILE, GetMyINIString("STRING_FOR_LOCALIZE", "EXTRACT_MULTIFILE"));
SetDlgItemText(IDC_SEARCH_BUTTON, GetMyINIString("STRING_FOR_LOCALIZE", "SEARCH"));
SetDlgItemText(IDC_CHECK5, GetMyINIString("STRING_FOR_LOCALIZE", "SEARCH_IN_RESULT"));
SetDlgItemText(IDC_SEARCHSTARTDATE_STATIC, GetMyINIString("STRING_FOR_LOCALIZE", "SEARCH_START_DATE"));
SetDlgItemText(IDC_SEARCHENDDATE_STATIC, GetMyINIString("STRING_FOR_LOCALIZE", "SEARCH_END_DATE"));
SetDlgItemText(IDC_BUTTON3, GetMyINIString("STRING_FOR_LOCALIZE", "RESET_TIME"));
SetDlgItemText(IDC_BUTTON2, GetMyINIString("STRING_FOR_LOCALIZE", "RESET_CORORDINATES"));
SetDlgItemText(IDC_RADIUS_STATIC, GetMyINIString("STRING_FOR_LOCALIZE", "RADIUS"));
SetDlgItemText(IDC_CONVERT_TO_TEXT, GetMyINIString("STRING_FOR_LOCALIZE", "CONVERT_TO_TEXT"));
m_LogAnalyzer.Initialize(m_hWnd, m_ctrlSearchTypeCb, m_ctrlCategoryTypeCb);
for(int nIdx = 0; nIdx < m_ctrlCategoryTypeCb.GetCount(); ++nIdx)
{
m_ctrlCategoryTypeCb.SetCheck(nIdx, false);
}
m_ctrlCategoryTypeCb.SetCheck(0, true); // 기본 선택은 ALL
m_ListNum.InsertString(0, "5000");
m_ListNum.InsertString(1, "1000");
m_ListNum.InsertString(2, "500");
m_ListNum.InsertString(3, "100");
m_ListNum.SetCurSel(0);
m_SearchStartDate.SetFormat(GetMyINIString("STRING_FOR_LOCALIZE", "FORMAT_001"));
m_SearchStopDate.SetFormat(GetMyINIString("STRING_FOR_LOCALIZE", "FORMAT_001"));
CTime startTime(2002, 10, 21, 0, 0, 0);
m_SearchStartDate.SetTime(&startTime);
return TRUE;
}
void CGameLogAnalyzerDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else
{
CDialog::OnSysCommand(nID, lParam);
}
}
// 대화 상자에 최소화 단추를 추가할 경우 아이콘을 그리려면
// 아래 코드가 필요합니다. 문서/뷰 모델을 사용하는 MFC 응용 프로그램의 경우에는
// 프레임워크에서 이 작업을 자동으로 수행합니다.
void CGameLogAnalyzerDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // 그리기를 위한 디바이스 컨텍스트
SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0);
// 클라이언트 사각형에서 아이콘을 가운데에 맞춥니다.
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// 아이콘을 그립니다.
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialog::OnPaint();
}
}
// 사용자가 최소화된 창을 끄는 동안에 커서가 표시되도록 시스템에서
// 이 함수를 호출합니다.
HCURSOR CGameLogAnalyzerDlg::OnQueryDragIcon()
{
return static_cast<HCURSOR>(m_hIcon);
}
void CGameLogAnalyzerDlg::OnBnClickedFileSelect()
{
if (!m_LogAnalyzer.Open())
MessageBox(GetMyINIString("STRING_FOR_LOCALIZE", "ERR_002"));
m_ListBox.ResetContent();
m_FileName = m_LogAnalyzer.GetFileName();
UpdateData(false);
}
void CGameLogAnalyzerDlg::OnCbnSelchangeCategoryTypeCombo()
{
/*
UpdateData(true);
CTime startTime, stopTime;
m_SearchStartDate.GetTime(startTime); m_SearchStopDate.GetTime(stopTime);
if (!m_LogAnalyzer.Category(m_ctrlCategoryTypeCb, startTime, stopTime,
CRegion(m_Radius, m_XPos, m_YPos, m_ZPos), m_bSearchInResult))
{
MessageBox(GetMyINIString("STRING_FOR_LOCALIZE", "ERR_005"));
return;
}
m_LogAnalyzer.SetShowMode(m_bShowUID, m_bShowCID, m_bShowTime, m_bShowPosition);
CString ShowNum;
m_ListNum.GetLBText(m_ListNum.GetCurSel(), ShowNum);
m_LogAnalyzer.Show(m_ListBox, atoi(ShowNum), m_Page);
m_ListBox.SetFocus();
UpdateData(false);
*/
}
void CGameLogAnalyzerDlg::OnBnClickedSearch()
{
UpdateData(true);
CString SearchType;
m_ctrlSearchTypeCb.GetLBText(m_ctrlSearchTypeCb.GetCurSel(), SearchType);
CTime startTime, stopTime;
m_SearchStartDate.GetTime(startTime);
m_SearchStopDate.GetTime(stopTime);
if (!m_LogAnalyzer.Search(m_ctrlCategoryTypeCb,
SearchType, m_SearchValue, startTime, stopTime,
CRegion(m_Radius, m_XPos, m_YPos, m_ZPos), m_bSearchInResult))
{
MessageBox(GetMyINIString("STRING_FOR_LOCALIZE", "ERR_005"));
return;
}
m_LogAnalyzer.SetShowMode(m_bShowUID, m_bShowCID, m_bShowTime, m_bShowPosition);
CString ShowNum;
m_ListNum.GetLBText(m_ListNum.GetCurSel(), ShowNum);
m_LogAnalyzer.Show(m_ListBox, atoi(ShowNum), m_Page);
UpdateData(false);
}
void CGameLogAnalyzerDlg::OnLbnDblclkResultList()
{
UpdateData(true);
int nSel = m_ListBox.GetCurSel();
if(nSel < 0)
{
return;
}
if(false == m_LogAnalyzer.ShowDetail(nSel))
{
MessageBox(GetMyINIString("STRING_FOR_LOCALIZE", "ERR_006"));
}
UpdateData(FALSE);
}
void CGameLogAnalyzerDlg::OnBnClickedGopageBtn()
{
UpdateData(true);
if(m_dwGoPageIndex > 0)
{
m_LogAnalyzer.SetShowMode(m_bShowUID, m_bShowCID, m_bShowTime, m_bShowPosition);
CString ShowNum;
m_ListNum.GetLBText(m_ListNum.GetCurSel(), ShowNum);
m_LogAnalyzer.MovePage(m_ListBox, atoi(ShowNum), m_Page, m_dwGoPageIndex);
UpdateData(false);
}
}
void CGameLogAnalyzerDlg::OnBnClickedPrevButton()
{
UpdateData(true);
m_LogAnalyzer.SetShowMode(m_bShowUID, m_bShowCID, m_bShowTime, m_bShowPosition);
CString ShowNum;
m_ListNum.GetLBText(m_ListNum.GetCurSel(), ShowNum);
m_LogAnalyzer.Prev(m_ListBox, atoi(ShowNum), m_Page);
UpdateData(false);
}
void CGameLogAnalyzerDlg::OnBnClickedNextButton()
{
UpdateData(true);
m_LogAnalyzer.SetShowMode(m_bShowUID, m_bShowCID, m_bShowTime, m_bShowPosition);
CString ShowNum;
m_ListNum.GetLBText(m_ListNum.GetCurSel(), ShowNum);
m_LogAnalyzer.Next(m_ListBox, atoi(ShowNum), m_Page);
UpdateData(false);
}
void CGameLogAnalyzerDlg::OnBnPositionResetClicked()
{
m_XPos = "0";
m_YPos = "0";
m_ZPos = "0";
m_Radius = "0";
UpdateData(false);
}
void CGameLogAnalyzerDlg::OnBnTimeResetClicked()
{
CTime startTime(2002, 10, 21, 0, 0, 0), stopTime;
m_SearchStartDate.SetTime(&startTime);
m_SearchStopDate.SetTime(&CTime::GetCurrentTime());
}
void CGameLogAnalyzerDlg::OnClose()
{
CDialog::OnClose();
}
void WriteLog(CParseLog::LogPtrArray& ResultArray, CFile& writeFile)
{
CParseLog::LogPtrArray::iterator first = ResultArray.begin();
CParseLog::LogPtrArray::iterator last = ResultArray.end();
for(; first != last; ++first)
{
GAMELOG::sLogBase* lpLogBase = *first;
writeFile.Write(lpLogBase, lpLogBase->GetSize());
}
}
void CGameLogAnalyzerDlg::OnBnClickedExtractmultifile()
{
UpdateData(true);
OPENFILENAME openfile;
OPENFILENAME savefile;
char szOpenFileName[MAX_PATH * MAX_PATH] = "";
char szSaveFileName[MAX_PATH] = "";
memset(&openfile, 0, sizeof(OPENFILENAME));
memset(&savefile, 0, sizeof(OPENFILENAME));
openfile.lStructSize = sizeof(OPENFILENAME);
openfile.hwndOwner = m_hWnd;
openfile.lpstrFilter = "Log and ziped files\0*.log;*.zip\0All files\0*.*\0";
openfile.lpstrFile = szOpenFileName;
openfile.nMaxFile = MAX_PATH * MAX_PATH;
openfile.Flags = OFN_FILEMUSTEXIST | OFN_ALLOWMULTISELECT | OFN_LONGNAMES | OFN_EXPLORER;
savefile.lStructSize = sizeof(OPENFILENAME);
savefile.hwndOwner = m_hWnd;
savefile.lpstrFilter = "Log FIles\0*.log\0";
savefile.lpstrFile = szSaveFileName;
savefile.nMaxFile = MAX_PATH;
savefile.Flags = OFN_SHOWHELP | OFN_LONGNAMES | OFN_EXPLORER;
CParseLog ParseLog;
CParseLog::LogPtrArray ResultArray;
CString SearchType;
CTime startTime, stopTime;
UpdateData();
m_ctrlSearchTypeCb.GetLBText(m_ctrlSearchTypeCb.GetCurSel(), SearchType);
m_SearchStartDate.GetTime(startTime);
m_SearchStopDate.GetTime(stopTime);
if(GetOpenFileName(&openfile))
{
if(GetSaveFileName(&savefile))
{
CFile writeData;
CFileException fileException;
strncat(szSaveFileName, ".log", MAX_PATH);
if (!writeData.Open(szSaveFileName,
CFile::modeCreate | CFile::modeReadWrite, &fileException))
{
TRACE("Can't open file %s, error = %u\n", szSaveFileName, fileException.m_cause );
}
const char* szAnalyzeFileName = szOpenFileName;
if(*(szAnalyzeFileName + strlen(szAnalyzeFileName) + 1) == 0)
{
// 파일이 한개
ParseLog.LoadFile(szAnalyzeFileName);
// 검색한 후, 검색 결과를 파일로 저장.
if(CLogAnalyzer::Search(ParseLog, ResultArray,
m_ctrlCategoryTypeCb, SearchType, m_SearchValue,
startTime, stopTime, CRegion(m_Radius, m_XPos, m_YPos, m_ZPos), false))
{
WriteLog(ResultArray, writeData);
ResultArray.clear();
}
}
else
{
// 파일이 여러개.
std::string szPath(szOpenFileName);
std::set<std::string> AnalyzeFileSet;
for (;;)
{
szAnalyzeFileName = szAnalyzeFileName + strlen(szAnalyzeFileName) + 1;
if(*szAnalyzeFileName == 0)
{
break;
}
AnalyzeFileSet.insert(szAnalyzeFileName);
}
std::set<std::string>::iterator
pos = AnalyzeFileSet.begin(),
end = AnalyzeFileSet.end();
std::string szPathName;
szPathName.reserve(MAX_PATH * 2);
for(;pos != end; ++pos)
{
szPathName.assign(szPath);
szPathName.append("\\");
szPathName.append(*pos);
ParseLog.LoadFile(szPathName.c_str());
// 검색한 후, 검색 결과를 파일로 저장.
if(CLogAnalyzer::Search(ParseLog, ResultArray,
m_ctrlCategoryTypeCb, SearchType, m_SearchValue,
startTime, stopTime, CRegion(m_Radius, m_XPos, m_YPos, m_ZPos), false))
{
WriteLog(ResultArray, writeData);
ResultArray.clear();
}
}
}
MessageBox(GetMyINIString("STRING_FOR_LOCALIZE", "ERR_007"));
}
}
}
void CGameLogAnalyzerDlg::OnOK()
{
//CDialog::OnOK();
}
void CGameLogAnalyzerDlg::OnCancel()
{
CDialog::OnCancel();
}
void CGameLogAnalyzerDlg::OnContextMenu(CWnd* pWnd, CPoint point)
{
if(pWnd->GetSafeHwnd() == m_ListBox.GetSafeHwnd()
&& m_ListBox.GetSelCount() != 0)
{
CMenu muTemp, *pContextMenu;
muTemp.LoadMenu(IDR_RESULT_LISTBOX);
pContextMenu = muTemp.GetSubMenu(0);
pContextMenu->TrackPopupMenu(TPM_LEFTALIGN, point.x, point.y, this);
}
}
void CGameLogAnalyzerDlg::OnResultExporttofile()
{
// 다이얼로그 열어 출력 파일 이름 받기.
OPENFILENAME OpenFile;
char szFileNameBuffer[MAX_PATH];
char szFileTitle[MAX_PATH];
memset(&OpenFile, 0, sizeof(OPENFILENAME));
OpenFile.lStructSize = sizeof(OPENFILENAME);
OpenFile.hwndOwner = NULL;
OpenFile.lpstrFilter = "LogFIle\0*.log\0";
OpenFile.nMaxFile = MAX_PATH;
OpenFile.nMaxFileTitle = MAX_PATH;
OpenFile.lpstrInitialDir = (LPSTR)NULL;
OpenFile.Flags = OFN_SHOWHELP | OFN_OVERWRITEPROMPT;
OpenFile.lpstrFile = szFileNameBuffer;
OpenFile.lpstrFileTitle = szFileTitle;
ZeroMemory(szFileNameBuffer, MAX_PATH);
ZeroMemory(szFileTitle, MAX_PATH);
if(GetSaveFileName(&OpenFile))
{
if(0 == strstr(szFileNameBuffer, ".log"))
{
strncat(szFileNameBuffer, ".log", MAX_PATH);
}
CFile WriteFile(szFileNameBuffer, CFile::modeWrite | CFile::modeCreate);
CString ShowNum;
m_ListNum.GetLBText(m_ListNum.GetCurSel(), ShowNum);
int nItemNum = atoi(ShowNum);
LPINT lpItemIndex = new INT[nItemNum];
nItemNum = m_ListBox.GetSelItems(nItemNum, lpItemIndex);
if(LB_ERR != nItemNum)
{
LPINT begin = lpItemIndex;
LPINT end = lpItemIndex + nItemNum;
CString Result;
for(;begin != end; ++begin)
{
m_ListBox.GetText(*begin, Result);
Result += "\r\n";
WriteFile.Write(Result, Result.GetLength());
}
}
WriteFile.Close();
delete [] lpItemIndex;
char szPath[MAX_PATH];
char szFileNameWithPath[MAX_PATH];
UINT nResult = GetWindowsDirectory(szPath, MAX_PATH);
if(0 != nResult && nResult <= MAX_PATH)
{
_snprintf(szFileNameWithPath, MAX_PATH, "%s\\NotePad.exe %s", szPath, szFileNameBuffer);
WinExec(szFileNameWithPath, SW_SHOW);
}
}
}
BOOL CGameLogAnalyzerDlg::PreTranslateMessage(MSG* pMsg)
{
if((WM_KEYDOWN == pMsg->message) && (VK_RETURN == pMsg->wParam))
{
if(GetFocus() == GetDlgItem(IDC_SEARCH_VALUE_EDIT)->GetFocus())
{
OnBnClickedSearch();
}
else if(GetFocus() == GetDlgItem(IDC_GOPAGE_EDIT)->GetFocus())
{
OnBnClickedGopageBtn();
}
}
return CDialog::PreTranslateMessage(pMsg);
}
void CGameLogAnalyzerDlg::OnBnClickedDefaultBtn()
{
CString strALL;
for(int nIndex = 0; nIndex < m_ctrlCategoryTypeCb.GetCount(); ++nIndex)
{
m_ctrlCategoryTypeCb.GetLBText(nIndex, strALL);
if (!strALL.Compare(_T("ALL")))
{
m_ctrlCategoryTypeCb.SetCheck(nIndex, true);
}
else
{
m_ctrlCategoryTypeCb.SetCheck(nIndex, false);
}
}
}
void CGameLogAnalyzerDlg::OnBnClickedConvertToText()
{
// TODO: 여기에 컨트롤 알림 처리기 코드를 추가합니다.
// 다이얼로그 열어 출력 파일 이름 받기.
OPENFILENAME OpenFile;
char szFileNameBuffer[MAX_PATH];
char szFileTitle[MAX_PATH];
memset(&OpenFile, 0, sizeof(OPENFILENAME));
OpenFile.lStructSize = sizeof(OPENFILENAME);
OpenFile.hwndOwner = NULL;
OpenFile.lpstrFilter = "LogFIle\0*.log\0";
OpenFile.nMaxFile = MAX_PATH;
OpenFile.nMaxFileTitle = MAX_PATH;
OpenFile.lpstrInitialDir = (LPSTR)NULL;
OpenFile.Flags = OFN_SHOWHELP | OFN_OVERWRITEPROMPT;
OpenFile.lpstrFile = szFileNameBuffer;
OpenFile.lpstrFileTitle = szFileTitle;
ZeroMemory(szFileNameBuffer, MAX_PATH);
ZeroMemory(szFileTitle, MAX_PATH);
if(GetSaveFileName(&OpenFile))
{
if(0 == strstr(szFileNameBuffer, ".log"))
{
strncat(szFileNameBuffer, ".log", MAX_PATH);
}
m_LogAnalyzer.WriteTextLog(szFileNameBuffer);
}
MessageBox("Convert Success", "Convert");
}
void CGameLogAnalyzerDlg::OnResultExportToClipboard()
{
// TODO: 여기에 명령 처리기 코드를 추가합니다.
CString ShowNum;
m_ListNum.GetLBText(m_ListNum.GetCurSel(), ShowNum);
int nItemNum = atoi(ShowNum);
LPINT lpItemIndex = new INT[nItemNum];
if (0 != lpItemIndex)
{
nItemNum = m_ListBox.GetSelItems(nItemNum, lpItemIndex);
if(LB_ERR != nItemNum)
{
LPINT begin = lpItemIndex;
LPINT end = lpItemIndex + nItemNum;
CString TotalResult;
CString Result;
for(;begin != end; ++begin)
{
m_ListBox.GetText(*begin, Result);
TotalResult += Result;
TotalResult += "\r\n";
}
CClipboard::SetText(TotalResult);
}
delete [] lpItemIndex;
}
}