#include "stdafx.h" #include "GlobalFunc.h" #include "MonitoringTool.h" #include "MonitoringToolSetup.h" #include const int MAX_BUFFER = 256; const char* szSection1 = _T("SERVER_GROUP_INFO"); const char* szSection2 = _T("CHAT_TYPE_INFO"); /// \brief ÀÎÀÚ·Î ¹ÞÀº ¸®½ºÆ® ¹Ú½º¿¡ ¼Â¾÷ÆÄÀÏÀÇ ¼­¹ö±×·ì¸íÀ» ¼ÂÆÃ /// \param ctrlListBox ¼­¹ö±×·ì¸íÀ» ¼ÂÆÃÇÒ ¸®½ºÆ® ¹Ú½º void SetServerListBox(CListBox& ctrlListBox) { ctrlListBox.ResetContent(); CMonitoringToolSetup Setup = CMonitoringToolSetup::GetInstance(); char szKey[MAX_BUFFER]; unsigned int nServerGroup; CString strFormat; int nMaxGroup = Setup.GetInt(szSection1, "SERVER_GROUP_NUM"); for(int nIndex = 0; nIndex < nMaxGroup; ++nIndex) { _snprintf(szKey, MAX_BUFFER, "SERVER_GROUP_INDEX_%02d", nIndex); nServerGroup = Setup.GetInt(szSection1, szKey); strFormat.Format("%s", theApp.GetServerName(nServerGroup)); ctrlListBox.AddString(strFormat); } } /// \brief ÀÎÀÚ·Î ¹ÞÀº ÄÞº¸ ¹Ú½º¿¡ ¼Â¾÷ÆÄÀÏÀÇ ¼­¹ö±×·ì¸íÀ» ¼ÂÆÃ /// \param ctrlCombo ¼­¹ö±×·ì¸íÀ» ¼ÂÆÃÇÒ ÄÞº¸ ¹Ú½º void SetServerGroupCombo(CComboBox& ctrlCombo) { CMonitoringToolSetup Setup = CMonitoringToolSetup::GetInstance(); char szKey[MAX_BUFFER]; unsigned int nServerGroup; CString strFormat; int nMaxGroup = Setup.GetInt(szSection1, "SERVER_GROUP_NUM"); for(int nIndex = 0; nIndex < nMaxGroup; ++nIndex) { _snprintf(szKey, MAX_BUFFER, "SERVER_GROUP_INDEX_%02d", nIndex); nServerGroup = Setup.GetInt(szSection1, szKey); strFormat.Format("%s", theApp.GetServerName(nServerGroup)); ctrlCombo.InsertString(nIndex, strFormat); } } /// \brief ÀÎÀÚ·Î ¹ÞÀº ¸®½ºÆ® ¹Ú½º¿¡ ¼Â¾÷ÆÄÀÏÀÇ Ã¤ÆÃŸÀÔÀ» ¼ÂÆÃ /// \param ctrlListBox äÆÃŸÀÔÀ» ¼ÂÆÃÇÒ ¸®½ºÆ® ¹Ú½º void SetChatTypeListBox(CListBox& ctrlListBox) { CMonitoringToolSetup Setup = CMonitoringToolSetup::GetInstance(); int nMaxChatType = Setup.GetInt(szSection2, "CHAT_TYPE_NUM"); char szKey[MAX_BUFFER]; CString strFormat; for(int nIndex = 0; nIndex < nMaxChatType; ++nIndex) { _snprintf(szKey, MAX_BUFFER, "CHAT_TYPE_NAME_%02d", nIndex); strFormat.Format("%s", Setup.GetString(szSection2, szKey)); ctrlListBox.AddString(strFormat); } } /// \brief ÀÎÀÚ·Î ¹ÞÀº ¸®½ºÆ® ¹Ú½º¿¡ äÆÃ¼­¹ö ¿¬°á»óŸ¦ Ç¥½Ã /// \param ctrlListBox ¿¬°á»óŸ¦ Ç¥½ÃÇÒ ¸®½ºÆ® ¹Ú½º void SetConnectionListBox(CListBox& ctrlListBox) { if(!ctrlListBox.GetSafeHwnd()) return; ctrlListBox.ResetContent(); CMonitoringToolSetup Setup = CMonitoringToolSetup::GetInstance(); char szKey[MAX_BUFFER]; for(unsigned int nIndex = 0; nIndex < Setup.GetInt(szSection1, "SERVER_GROUP_NUM"); ++nIndex) { _snprintf(szKey, MAX_BUFFER, "SERVER_GROUP_INDEX_%02d", nIndex); if(0 != theApp.GetChatServerHandler(Setup.GetInt(szSection1, szKey))) { ctrlListBox.AddString(_T("OK")); } else { ctrlListBox.AddString(_T("DIS")); } } } /// \brief ÀÎÀÚ·Î ¹ÞÀº ÄÞº¸ ¹Ú½º¿¡ ¼Â¾÷ÆÄÀÏÀÇ Ã¤ÆÃŸÀÔÀ» ¼ÂÆÃ /// \param ctrlCombo äÆÃŸÀÔÀ» ¼ÂÆÃÇÒ ÄÞº¸ ¹Ú½º void SetChatTypeCombo(CComboBox& ctrlCombo) { CMonitoringToolSetup Setup = CMonitoringToolSetup::GetInstance(); int nMaxChatType = Setup.GetInt(szSection2, "CHAT_TYPE_NUM"); char szKey[MAX_BUFFER]; CString strFormat; for(int nIndex = 0; nIndex < nMaxChatType; ++nIndex) { _snprintf(szKey, MAX_BUFFER, "CHAT_TYPE_NAME_%02d", nIndex); strFormat.Format("%s", Setup.GetString(szSection2, szKey)); ctrlCombo.InsertString(nIndex, strFormat); } } /// \brief ÀÎÀÚ·Î ¹ÞÀº ÄÞº¸ ¹Ú½º¿¡ ¼Â¾÷ÆÄÀÏÀÇ ¸Þ½ÃÁö¸¦ Àü¼ÛÇÒ Ã¤ÆÃŸÀÔÀ» ¼ÂÆÃ /// \param ctrlCombo äÆÃŸÀÔÀ» ¼ÂÆÃÇÒ ÄÞº¸ ¹Ú½º /// \note SetChatTypeCombo ÇÔ¼ö¿Í ±¸ºÐÇÏ¿© »ç¿ëÇÏ¿©¾ß ÇÔ void SetSendChatTypeCombo(CComboBox& ctrlCombo) { CMonitoringToolSetup Setup = CMonitoringToolSetup::GetInstance(); int nMaxGroup = Setup.GetInt(szSection2, "SEND_CHAT_TYPE_NUM"); char szKey[MAX_BUFFER]; CString strFormat; for(int nIndex = 0; nIndex < nMaxGroup; ++nIndex) { _snprintf(szKey, MAX_BUFFER, "SEND_CHAT_TYPE_NAME_%02d", nIndex); strFormat.Format("%s", Setup.GetString(szSection2, szKey)); ctrlCombo.InsertString(nIndex, strFormat); } } /// \brief ÀÎÀÚ·Î ¹ÞÀº ÄÞº¸ ¹Ú½º¿¡ GM¸íÀ» ¼ÂÆÃ /// \param ctrlCombo GM¸íÀ» ¼ÂÆÃÇÒ ÄÞº¸ ¹Ú½º /// \note ·Î±×ÀÎÇÑ GM¸íÀ¸·Î ¸Þ¼¼Áö º¸³»±â·Î ¼öÁ¤ÇÑ ÈÄ »ç¿ëÇÏÁö ¾ÊÀ½ void SetGMNameCombo(CComboBox& ctrlCombo) { CMonitoringToolSetup Setup = CMonitoringToolSetup::GetInstance(); const char* szSection = _T("GM_INFO"); int nMaxGM = Setup.GetInt(szSection, "GM_NUM"); char szKey[MAX_BUFFER]; CString strFormat; for(int nIndex = 0; nIndex < nMaxGM; ++nIndex) { _snprintf(szKey, MAX_BUFFER, "GM_NAME_%02d", nIndex); strFormat.Format("%s", Setup.GetString(szSection, szKey)); ctrlCombo.InsertString(nIndex, strFormat); } } /// \brief äÆÃŸÀÔ¸íÀ¸·Î äÆÃŸÀÔ À妽º ¾ò±â /// \param strTypeName À妽º¸¦ ¾ò°íÀÚ Çϴ äÆÃŸÀÔ¸í unsigned int GetChatTypeIndex(CString strTypeName) { if(strTypeName == _T("ADMIN_SHOUT")) return PktChat::ADMIN_SHOUT; if(strTypeName == _T("SHOUT")) return PktChat::SHOUT; //if(strTypeName == _T("WHISPER")) return PktChat::WHISPER; return 255; // Á¸ÀçÇÏÁö ¾Ê´Â äÆÃŸÀÔ À妽º } /// \brief ¼½¼Ç¸í°ú Ű·Î ini ¼Â¾÷ ÆÄÀÏ¿¡¼­ ¼ÂÆÃµÈ °ª ¾ò±â /// \param szSection ¾ò°íÀÚÇÏ´Â °ªÀÌ ¼ÓÇÑ ¼½¼Ç¸í /// \param szKey ¾ò°íÀÚ ÇÏ´Â °ª¿¡ ¸ÅĪµÇ´Â Ű const char* GetMyINIString(const char* szSection, const char* szKey) { const char* szResult = CMonitoringToolSetup::GetInstance().GetString(szSection, szKey, 0); if(0 == szResult) { CString strErr; strErr.Format("Setup string load failed! - key: %s", szKey); AfxMessageBox(strErr, MB_ICONSTOP); return "???"; } return szResult; }