// Error Operator // // Defined by YB ////////////////////////// #include "StdAfx.h" #include "ErOTeam.hpp" #undef CPA_WANTS_IMPORT #undef CPA_EXPORT #define CPA_WANTS_EXPORT #include "ErO_Err.hpp" #undef CPA_WANTS_EXPORT #define CPA_WANTS_IMPORT //Module Info CString g_csModuleName; //Source Info CString g_csCurrentFileName; short g_wCurrentFileLine; CString g_csLastModif; //Global Info CString g_csCurrentAction; CString g_csCurrentFunction; CString g_csAddedInfo; enum ERROR_eErrorGravity g_eErrorGravity; //Script Info CString g_csCurrentScriptFileName; short g_wCurrentScriptLine; //Programmers Info ErrorOperator_TeamList g_clListOfTeams; CStringList g_cslGravityMessages; CStringList g_cslGravityExplanations; extern HMODULE g_hModule; //************************************************************************************ void ERROR_g_fn_vSetGlobalInfo(CString _csCurrentAction, CString _csCurrentFunction, enum ERROR_eErrorGravity _eErrorGravity, CString _csAddedInfo, CString _csModuleName /*= ""*/) { g_eErrorGravity = _eErrorGravity; g_csCurrentAction = _csCurrentAction; g_csCurrentFunction = _csCurrentFunction; g_csAddedInfo = _csAddedInfo; g_csModuleName = _csModuleName; } //************************************************************************************ void ERROR_g_fn_vSetSourceInfo(CString _csCurrentSourceFile, short _wLine, CString _csDate) { g_csCurrentFileName = _csCurrentSourceFile; g_wCurrentFileLine = _wLine; g_csLastModif = _csDate; } //************************************************************************************ void ERROR_g_fn_vResetGlobalInfo() { g_eErrorGravity = E_ERROR_GRAVITY_UNKNOWN; g_csCurrentAction = ""; g_csCurrentFunction = ""; g_csAddedInfo = ""; g_csModuleName = ""; } //************************************************************************************ void ERROR_g_fn_vResetSourceInfo() { g_csCurrentFileName = ""; g_wCurrentFileLine = -1; g_csLastModif = ""; } //************************************************************************************ void ERROR_g_fn_vSetScriptInfo(CString _csCurrentScriptFileName, short _wCurrentScriptFileLine) { g_csCurrentScriptFileName = _csCurrentScriptFileName; g_wCurrentScriptLine = _wCurrentScriptFileLine; } //************************************************************************************ void ERROR_g_fn_vResetScriptInfo() { g_csCurrentScriptFileName = ""; g_wCurrentScriptLine = -1; } //************************************************************************************ void ERROR_g_fn_vAddAModuleDescriptor(CString _csModuleName, CString _csModuleVersion, CString _csMainProgrammerName, CString _csMainProgrammerPhoneNumber, CString _csMainProgrammerEMailAddress, CString _csResponsibleName, CString _csResponsiblePhoneNumber, CString _csResponsibleEMailAddress, CString _csSecondProgrammerName, CString _csSecondProgrammerPhoneNumber, CString _csSecondProgrammerEMailAddress ) { g_clListOfTeams.m_pub_fn_pclAddTeam(_csModuleName, _csModuleVersion, _csMainProgrammerName, _csMainProgrammerPhoneNumber, _csMainProgrammerEMailAddress, _csResponsibleName, _csResponsiblePhoneNumber, _csResponsibleEMailAddress, _csSecondProgrammerName, _csSecondProgrammerPhoneNumber, _csSecondProgrammerEMailAddress); //Updates File //Initializing file name char a_cBuffer[MAX_PATH]; GetModuleFileName(g_hModule, a_cBuffer, MAX_PATH); CString csFileName = a_cBuffer; short wIndex = csFileName.ReverseFind('\\'); if ( wIndex != -1 ) csFileName = csFileName.Left(wIndex + 1); csFileName += "ErrorOut.txt"; CStdioFile cfErrorOutFile; if ( cfErrorOutFile.Open(csFileName, CFile::modeReadWrite | CFile::modeCreate | CFile::typeText ) ) { CString csCurrentString; csCurrentString = "Error Operator Module\n"; cfErrorOutFile.WriteString(csCurrentString); csCurrentString = "---------------------\n"; cfErrorOutFile.WriteString(csCurrentString); csCurrentString = "\n"; cfErrorOutFile.WriteString(csCurrentString); csCurrentString = "At last run, known modules were :\n"; cfErrorOutFile.WriteString(csCurrentString); csCurrentString = "\n"; cfErrorOutFile.WriteString(csCurrentString); ErrorOperator_Team *pclCurrentTeam; POSITION pos = g_clListOfTeams.GetHeadPosition(); while ( pos != NULL ) { pclCurrentTeam = g_clListOfTeams.GetNext(pos); csCurrentString = pclCurrentTeam->m_csModuleName + " (" + pclCurrentTeam->m_csMainProgrammerName + ")\n"; cfErrorOutFile.WriteString(csCurrentString); } csCurrentString = "\n"; cfErrorOutFile.WriteString(csCurrentString); csCurrentString = "---------------------\n"; cfErrorOutFile.WriteString(csCurrentString); cfErrorOutFile.Close(); } }