Files
Client/Server/ManageTool/MonitoringTool/GMReportDialog.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

134 lines
3.1 KiB
C++

// GMReportDialog.cpp : 구현 파일입니다.
//
#include "stdafx.h"
#include "MonitoringTool.h"
#include "GMReportDialog.h"
#include <Network/Packet/PacketStruct/CharCommunityPacket.h>
#include <Network/Packet/PacketStruct/ServerInfo.h>
#include <UserManage/UserStatistics.h>
#include <Utility/Setup/ServerSetup.h>
#include <Log/ServerLog.h>
// CGMReportDialog 대화 상자입니다.
IMPLEMENT_DYNAMIC(CGMReportDialog, CDialog)
CGMReportDialog::CGMReportDialog(CWnd* pParent /*=NULL*/)
: CDialog(CGMReportDialog::IDD, pParent)
{
theApp.RegisterWindow(IDD_GMREPORTDIALOG, static_cast<CWnd*>(this));
}
CGMReportDialog::~CGMReportDialog()
{
theApp.RemoveWindow(IDD_GMREPORTDIALOG);
}
void CGMReportDialog::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Control(pDX, IDC_REPORTLIST, m_ReportList);
}
BEGIN_MESSAGE_MAP(CGMReportDialog, CDialog)
ON_WM_SIZE()
ON_BN_CLICKED(IDC_SAVEBUTTON, OnBnClickedSavebutton)
ON_BN_CLICKED(IDC_SAVEBUTTON3, OnBnClickedSavebutton3)
END_MESSAGE_MAP()
// CGMReportDialog 메시지 처리기입니다.
BOOL CGMReportDialog::OnInitDialog()
{
CDialog::OnInitDialog();
return TRUE;
}
void CGMReportDialog::OnOK()
{
ShowWindow(SW_HIDE);
}
void CGMReportDialog::OnCancel()
{
ShowWindow(SW_HIDE);
}
void CGMReportDialog::OnSize(UINT nType, int cx, int cy)
{
CDialog::OnSize(nType, cx, cy);
// TODO: 여기에 메시지 처리기 코드를 추가합니다.
if(m_ReportList.GetSafeHwnd())
{
CRect rt;
GetClientRect(rt);
rt.top += 22;
m_ReportList.MoveWindow(rt);
}
}
void CGMReportDialog::AddMessage(ChatToolPkt::ChatDataSend* lpChatData)
{
const int MAX_CHAT_LEN = 1024;
char strRecvMsg[UCHAR_MAX * 2];
memcpy(strRecvMsg, reinterpret_cast<char*>(lpChatData + 1), lpChatData->m_cChatMsgLen);
strRecvMsg[lpChatData->m_cChatMsgLen] = 0;
char strChatMsg[MAX_CHAT_LEN];
SERVER_ID serverID;
serverID.dwID = lpChatData->m_dwServerID;
time_t tCurrent = time(NULL);
struct tm tmCurrent = *localtime(&tCurrent);
CXListBox::Color cBackColor = CXListBox::BackColor;
CXListBox::Color cMessageColor = CXListBox::GMReport;
_snprintf(strChatMsg, MAX_CHAT_LEN - 1, "%s\t [Z:%02d/C:%d/L:%04x][%02d:%02d] %s : %s",
theApp.GetServerName((unsigned int)serverID.GetGroup()),
serverID.GetZone(), serverID.GetChannel(), lpChatData->m_usLang, tmCurrent.tm_hour, tmCurrent.tm_min,
lpChatData->m_szSenderName, strRecvMsg);
m_ReportList.AddLine(cMessageColor, cBackColor, strChatMsg, true);
ShowWindow(SW_SHOW);
}
void CGMReportDialog::OnBnClickedSavebutton()
{
// TODO: 여기에 컨트롤 알림 처리기 코드를 추가합니다.
CString strFilter = _T("Text File (*.txt)|*.txt||");
CFileDialog dlg(FALSE, _T("txt"), _T(""), OFN_HIDEREADONLY|OFN_READONLY, strFilter, this);
if (dlg.DoModal() == IDOK)
{
CFile file(dlg.GetPathName(), CFile::modeWrite|CFile::modeCreate);
CString str;
CString line = _T("\r\n");
int iCount = m_ReportList.GetCount();
for(int i = 0; i < iCount; ++i)
{
m_ReportList.GetText(i, str);
file.Write(str.GetString(), str.GetLength());
file.Write(line.GetString(), line.GetLength());
}
}
}
void CGMReportDialog::OnBnClickedSavebutton3()
{
// TODO: 여기에 컨트롤 알림 처리기 코드를 추가합니다.
m_ReportList.ResetContent();
}