Source code of Windows XP (NT5)
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.

172 lines
2.4 KiB

  1. #ifdef _DEBUG
  2. #define new DEBUG_NEW
  3. #endif
  4. //////////////////////////////////////////////////////////////////////
  5. // State Members
  6. //////////////////////////////////////////////////////////////////////
  7. inline int CEvent::GetStatus(int iAgentState)
  8. {
  9. switch( iAgentState )
  10. {
  11. case 9:
  12. {
  13. return HMS_CRITICAL;
  14. }
  15. break;
  16. case 8:
  17. {
  18. return HMS_WARNING;
  19. }
  20. break;
  21. case 7:
  22. {
  23. return HMS_NODATA;
  24. }
  25. break;
  26. case 6:
  27. {
  28. return HMS_UNKNOWN;
  29. }
  30. break;
  31. case 5:
  32. {
  33. return HMS_SCHEDULEDOUT;
  34. }
  35. break;
  36. case 4:
  37. {
  38. return HMS_DISABLED;
  39. }
  40. break;
  41. case 3:
  42. {
  43. return HMS_INFO;
  44. }
  45. break;
  46. case 2:
  47. {
  48. return HMS_NORMAL;
  49. }
  50. break;
  51. case 1:
  52. {
  53. return HMS_NORMAL;
  54. }
  55. break;
  56. case 0:
  57. {
  58. return HMS_NORMAL;
  59. }
  60. break;
  61. }
  62. ASSERT(FALSE);
  63. return -1;
  64. }
  65. inline void CEvent::GetStatus(int iAgentState, CString& sStatus)
  66. {
  67. switch( iAgentState )
  68. {
  69. case 9:
  70. {
  71. sStatus.LoadString(IDS_STRING_CRITICAL);
  72. }
  73. break;
  74. case 8:
  75. {
  76. sStatus.LoadString(IDS_STRING_WARNING);
  77. }
  78. break;
  79. case 7:
  80. {
  81. sStatus.LoadString(IDS_STRING_NODATA);
  82. }
  83. break;
  84. case 6:
  85. {
  86. sStatus.LoadString(IDS_STRING_UNKNOWN);
  87. }
  88. break;
  89. case 5:
  90. {
  91. sStatus.LoadString(IDS_STRING_OUTAGE);
  92. }
  93. break;
  94. case 4:
  95. {
  96. sStatus.LoadString(IDS_STRING_DISABLED);
  97. }
  98. break;
  99. case 3:
  100. {
  101. sStatus.LoadString(IDS_STRING_INFORMATION);
  102. }
  103. break;
  104. case 2:
  105. {
  106. sStatus.LoadString(IDS_STRING_RESET);
  107. }
  108. break;
  109. case 1:
  110. {
  111. sStatus.LoadString(IDS_STRING_COLLECTING);
  112. }
  113. break;
  114. case 0:
  115. {
  116. sStatus.LoadString(IDS_STRING_RESET);
  117. }
  118. break;
  119. default:
  120. {
  121. sStatus.LoadString(IDS_STRING_NONE);
  122. }
  123. break;
  124. }
  125. }
  126. //////////////////////////////////////////////////////////////////////
  127. // Event Time Members
  128. //////////////////////////////////////////////////////////////////////
  129. inline CString CEvent::GetEventLocalTime()
  130. {
  131. CString sTime;
  132. CString sDate;
  133. CString sDateTime;
  134. int iLen = GetTimeFormat(LOCALE_USER_DEFAULT,0L,&m_st,NULL,NULL,0);
  135. iLen = GetTimeFormat(LOCALE_USER_DEFAULT,0L,&m_st,NULL,sTime.GetBuffer(iLen+(sizeof(TCHAR)*1)),iLen);
  136. sTime.ReleaseBuffer();
  137. iLen = GetDateFormat(LOCALE_USER_DEFAULT,0L,&m_st,NULL,NULL,0);
  138. iLen = GetDateFormat(LOCALE_USER_DEFAULT,0L,&m_st,NULL,sDate.GetBuffer(iLen+(sizeof(TCHAR)*1)),iLen);
  139. sDate.ReleaseBuffer();
  140. sDateTime = sDate + _T(" ") + sTime;
  141. return sDateTime;
  142. }