诸暨麻将添加redis
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

69 lines
2.1 KiB

  1. #include "Stdafx.h"
  2. #include "Commend.h"
  3. #include <strsafe.h>
  4. #include "GameServerDlg.h"
  5. bool mylog::ToSet(TCHAR* pBuffer, int iLen, DWORD dUserID)
  6. {
  7. TCHAR* szTemp = NULL;
  8. try
  9. {
  10. if (wcslen(pBuffer) == 0) return true;
  11. szTemp = (TCHAR*)malloc(iLen);
  12. ZeroMemory(szTemp, iLen);
  13. TCHAR szKey[512] = { 0 };
  14. CString csTest = pBuffer;
  15. bool bFind = false;
  16. if(csTest.Replace(_T("->"),_T("<br><font color=#888888>")))
  17. {
  18. bFind = true;
  19. }
  20. StringCchCopy(pBuffer, iLen / sizeof(TCHAR), csTest.GetBuffer(0));
  21. csTest.ReleaseBuffer();
  22. CTime m_time;
  23. m_time=CTime::GetCurrentTime(); //获取当前时间日期
  24. CString m_strDateTime = m_time.Format(_T("%Y-%m-%d %H:%M:%S %A")); //格式化日期时间
  25. #ifdef _UNICODE
  26. _snwprintf(szKey, 512, TEXT("【%d】发生时间:%s"), dUserID, m_strDateTime);
  27. _snwprintf(szTemp, iLen / sizeof(TCHAR), TEXT("<p style='font-size:9pt;' class=\"%d\"><br>-----------------------------------------------------<br><font color=red>"), dUserID);
  28. #else
  29. _snprintf(szKey, 512, TEXT("【%d】发生时间:%s"), dUserID, m_strDateTime);
  30. _snprintf(szTemp, iLen / sizeof(TCHAR), TEXT("<p style='font-size:9pt;' class=\"%d\"><br>-----------------------------------------------------<br><font color=red>"), dUserID);
  31. #endif
  32. StringCchCat(szTemp, iLen / sizeof(TCHAR), TEXT("【协议】"));
  33. StringCchCat(szTemp, iLen / sizeof(TCHAR), szKey);
  34. StringCchCat(szTemp, iLen / sizeof(TCHAR), TEXT("</font><br><font color=green>"));
  35. StringCchCat(szTemp, iLen / sizeof(TCHAR), pBuffer);
  36. if (bFind) StringCchCat(szTemp, iLen / sizeof(TCHAR), TEXT("</font></font></p>"));
  37. else StringCchCat(szTemp, iLen / sizeof(TCHAR), TEXT("</font></p>"));
  38. StringCchCopy(pBuffer, iLen / sizeof(TCHAR), szTemp);
  39. free(szTemp);
  40. szTemp = NULL;
  41. }
  42. catch (CMemoryException* e)
  43. {
  44. if (szTemp)
  45. {
  46. free(szTemp);
  47. szTemp = NULL;
  48. }
  49. }
  50. pBuffer[iLen - 1] = 0;
  51. return true;
  52. }
  53. void mylog::OutputString(TCHAR* pBuffer, int iTableID)
  54. {
  55. //检查日志是否启用
  56. if (!CGameServerDlg::g_bGameLog) return;
  57. Commend::AddLog(iTableID, pBuffer);
  58. //OutputDebugString(pBuffer);
  59. }