Example #1
0
void CLogView::Log(LogFacility logType, BSTR bsSource, BSTR bsModuleID, VARIANT vtValue)
{
  CHARFORMAT cf = {0};
  cf.cbSize = sizeof(CHARFORMAT);
  cf.dwMask = CFM_COLOR;
  CString sType;
  switch(logType)
  {
    case LT_DEBUG:
      sType = _T("debug");
      cf.crTextColor = LOG_COLOR_DEBUG;
      break;
    case LT_INFO:
      sType = _T("info");
      cf.crTextColor = LOG_COLOR_INFO;
      break;
    case LT_WARN:
      sType = _T("warning");
      cf.crTextColor = LOG_COLOR_WARN;
      break;
    case LT_ERROR:
      sType = _T("error");
      cf.crTextColor = LOG_COLOR_ERROR;
      break;
    default:
      sType = _T("log");
      cf.crTextColor = LOG_DEFAULTCOLOR;
      break;
  }

  CTime ts = CTime::GetCurrentTime();
  CString sDate(ts.Format(_T("%H:%M:%S")));

  CComVariant vt;
  vt.ChangeType(VT_BSTR, &vtValue);
  if (vt.vt != VT_BSTR)
  {
    vt = _T("???");
  }
  CString s;
  s.Format(_T("%s %s [%s: %s]: "), sDate, sType, bsSource, bsModuleID);

  SetSelectionCharFormat(cf);
  AppendText(s);

  cf.dwMask |= CFM_BOLD;
  cf.dwEffects = CFE_BOLD;
  SetSelectionCharFormat(cf);
  AppendText(vt.bstrVal);

  cf.dwMask = CFM_COLOR;
  cf.crTextColor = LOG_DEFAULTCOLOR;
  SetSelectionCharFormat(cf);
  AppendText(_T("\r\n"));
}
Example #2
0
void LogViewRE::LogIntro(LogFacility logType, LPCWSTR aName)
{
  // set color, set bold, print date, logtype, source and module
  CHARFORMAT cf = {0};
  cf.cbSize = sizeof(CHARFORMAT);
  cf.dwMask = CFM_COLOR;
  CString sType;
  switch(logType)
  {
    case LT_INTERNAL:
      sType = _T("internal");
      cf.crTextColor = LOG_COLOR_INTERNAL;
      break;
    case LT_DEBUG:
      sType = _T("debug");
      cf.crTextColor = LOG_COLOR_DEBUG;
      break;
    case LT_INFO:
      sType = _T("info");
      cf.crTextColor = LOG_COLOR_INFO;
      break;
    case LT_WARN:
      sType = _T("warning");
      cf.crTextColor = LOG_COLOR_WARN;
      break;
    case LT_ERROR:
      sType = _T("error");
      cf.crTextColor = LOG_COLOR_ERROR;
      break;
    default:
      sType = _T("log");
      cf.crTextColor = LOG_DEFAULTCOLOR;
      break;
  }

  CTime ts = CTime::GetCurrentTime();
  CString sDate(ts.Format(_T("%H:%M:%S")));

  CString s;
  s.Format(_T("%s\t%s\t[%s]: "), sDate, sType, aName);

  SetSel(-1, -1);
  SetSelectionCharFormat(cf);
  AppendText(s);

  cf.dwMask |= CFM_BOLD;
  cf.dwEffects = CFE_BOLD;
  SetSelectionCharFormat(cf);
  // the view has now bold font with the correct color selected
}
Example #3
0
bool CFrontPageEditor::AddEditForm(CWholePage *pPageXML, const TDVCHAR *pSubject, const TDVCHAR *pBody, const TDVCHAR *pSkin, const TDVCHAR* pDate, int iRegistered)
{
    CTDVString sSubject(pSubject);
    CTDVString sBody(pBody);
    CTDVString sDate(pDate);
    CXMLObject::EscapeAllXML(&sSubject);
    CXMLObject::EscapeAllXML(&sBody);
    CXMLObject::EscapeAllXML(&sDate);
    CTDVString sXML;
    sXML = "<FRONTPAGE-EDIT-FORM><SUBJECT>";
    sXML << sSubject << "</SUBJECT>";
    sXML << "<BODY>" << sBody << "</BODY>";
    sXML << "<REGISTERED>" << iRegistered << "</REGISTERED>";
    sXML << "<SKIN>" << pSkin << "</SKIN>";
    sXML << "<DATE>" << sDate << "</DATE>";
    sXML << "</FRONTPAGE-EDIT-FORM>";
    pPageXML->AddInside("H2G2", sXML);
    return true;
}
Example #4
0
CConfigMgr::CConfigMgr()
{
	BOOL bTest = TRUE;
	if (bTest)
	{
		CString sDate("2001-7-9");

		CString sY, sM,sD; //Year, Month , Day
		int pos = util::split_next(sDate, sY, '-', 0);
		pos = util::split_next(sDate, sM, '-', pos+1);
		pos = util::split_next(sDate, sD, '-', pos+1);

	}
	//Load Config Data
	util::InitApp();
	char *pConfigurationFile = util::GetAppPath();
	strcat(pConfigurationFile, CONFIG_FILE);
	char lpDefault[1024];
	memset(lpDefault,0,1024);
	DWORD dwRet = GetPrivateProfileString("SYS_CFG", "PicWinIndex","",lpDefault,sizeof(lpDefault),pConfigurationFile);
	if (dwRet>0)
		m_nPicWinIndex = atoi(lpDefault);

	dwRet = GetPrivateProfileString("SYS_CFG", "PlayPicInterval","",lpDefault,sizeof(lpDefault),pConfigurationFile);
	if (dwRet>0)
		m_nPlayPicInterval = atoi(lpDefault);

	dwRet = GetPrivateProfileString("SYS_CFG", "MaxPopWarnWin","",lpDefault,sizeof(lpDefault),pConfigurationFile);
	if (dwRet>0)
		m_nMaxPopWarnWin = atoi(lpDefault);

	dwRet = GetPrivateProfileString("SYS_CFG", "PopWarnSound","",lpDefault,sizeof(lpDefault),pConfigurationFile);
	if (dwRet>0)
		m_sPopWarnSound = lpDefault;

	dwRet = GetPrivateProfileString("SYS_CFG", "PopWarnEnable","",lpDefault,sizeof(lpDefault),pConfigurationFile);
	if (dwRet>0 && lpDefault[0]=='1')
		m_bPopWarnEnable = true;
	else
		m_bPopWarnEnable = false;


	//Task Cfg
	m_pArrTask = new CObArray();
	if (!m_pArrTask)
		return;

	CStdioFile	m_fTaskList;
	CFileException error;
	if ( !m_fTaskList.Open("TaskInfo.txt", CFile::modeNoTruncate | CFile::modeCreate | CFile::modeReadWrite, &error) )
	{
		CString strError;
		strError.Format( "Can't open file %s, error = %u\n", "TaskInfo.txt", error.m_cause );
		AfxMessageBox(strError);	
		return;
	}
	else
	{
		//ULONGLONG nSize = m_fTaskList.GetLength();
		//if (m_fTaskList.GetLength() == 0)
		//	return;

		//Read All Task Info to ArrTask...
		CString sOneTask, sTemp;
		int pos = 0;
		while (m_fTaskList.ReadString(sOneTask))
		{
			CTaskItem *pItem = NULL;
			VERIFY(pItem = new CTaskItem());
			pos = util::split_next(sOneTask, pItem->sName,		'\t', 0);
			pos = util::split_next(sOneTask, pItem->sBTSName,	'\t', pos+1);
			pos = util::split_next(sOneTask, pItem->sUUID,		'\t', pos+1);
			pos = util::split_next(sOneTask, pItem->sCh,		'\t', pos+1);
			pos = util::split_next(sOneTask, sTemp,				'\t', pos+1);
			pItem->nVV = atoi(sTemp);
			pos = util::split_next(sOneTask, pItem->sBeginDate, '\t', pos+1);
			pos = util::split_next(sOneTask, pItem->sEndDate,	'\t', pos+1);
			pos = util::split_next(sOneTask, sTemp,			    '\t', pos+1);
			pItem->nBeginHour = atoi(sTemp);
			pos = util::split_next(sOneTask, sTemp, '\t', pos+1);
			pItem->nBeginMin = atoi(sTemp);
			pos = util::split_next(sOneTask, sTemp, '\t', pos+1);
			pItem->nBeginSec = atoi(sTemp);

			pos = util::split_next(sOneTask, sTemp, '\t', pos+1);
			pItem->nEndHour = atoi(sTemp);
			pos = util::split_next(sOneTask, sTemp, '\t', pos+1);
			pItem->nEndMin = atoi(sTemp);
			pos = util::split_next(sOneTask, sTemp, '\t', pos+1);
			pItem->nEndSec = atoi(sTemp);

			pos = util::split_next(sOneTask, sTemp, '\t', pos+1);
			pItem->status = atoi(sTemp);
			pos = util::split_next(sOneTask, pItem->sUUID_Old,	'\t', pos+1);
			pos = util::split_next(sOneTask, pItem->sCh_Old,	 '\t', pos+1);

			m_pArrTask->Add(pItem);
		}

	}
	m_fTaskList.Close();
	/*
	dwRet = GetPrivateProfileString("SYS_TASK", "count","",lpDefault,sizeof(lpDefault),pConfigurationFile);
	if (dwRet>0)
		m_sPopWarnSound = lpDefault;
	dwRet = GetPrivateProfileString("SYS_TASK", "size","",lpDefault,sizeof(lpDefault),pConfigurationFile);
	if (dwRet>0)
		m_sPopWarnSound = lpDefault;

	lpDefault
	dwRet = GetPrivateProfileStruct("SYS_TASK", "taskinfo",lpDefault,nSize,pConfigurationFile);
	if (dwRet>0)
		m_sPopWarnSound = lpDefault;
	*/

	//Control Process Event Init
	m_hCtrlTask[0] = ::CreateEvent(NULL,TRUE,FALSE,NULL);  //manual 
	m_hCtrlTask[1] = ::CreateEvent(NULL,FALSE,FALSE,NULL); //auto Exit
}
Example #5
0
std::wstring RtfOle::RenderToOOX(RenderParameter oRenderParameter)
{
	if( false == IsValid() )	return L"";
	
    std::wstring sResult;

	RtfDocument*	poRtfDocument	= static_cast<RtfDocument*>	(oRenderParameter.poDocument);
	OOXWriter*		poOOXWriter		= static_cast<OOXWriter*>	(oRenderParameter.poWriter);
	
	if( RENDER_TO_OOX_PARAM_OLE_ONLY == oRenderParameter.nType )
	{
		sResult += RenderToOOXOnlyOle(oRenderParameter);
	}
	else
	{
		RtfCharProperty * pCharProps = &m_oCharProperty;
//------------------------------------------
// todooo общая часть с RtfChar
		bool bInsert = false;
		bool bDelete = false;

		if (pCharProps->m_nRevised != PROP_DEF)
		{
			bInsert = true;
			
            std::wstring sAuthor = poRtfDocument->m_oRevisionTable.GetAuthor(pCharProps->m_nRevauth);
            std::wstring sDate(RtfUtility::convertDateTime(pCharProps->m_nRevdttm).c_str());
			
			sResult += L"<w:ins w:date=\"" + sDate +  L"\" w:author=\"" + sAuthor + L"\" w:id=\"" + std::to_wstring(poOOXWriter->m_nCurTrackChangesId++).c_str() + L"\">";
			pCharProps->m_nRevised = PROP_DEF;
		}
		if (pCharProps->m_nDeleted != PROP_DEF)
		{
			bDelete = true;
			
            std::wstring sAuthor = poRtfDocument->m_oRevisionTable.GetAuthor(pCharProps->m_nRevauthDel);
            std::wstring sDate(RtfUtility::convertDateTime(pCharProps->m_nRevdttmDel).c_str());
			
			sResult += L"<w:del w:date=\"" + sDate +  L"\" w:author=\"" + sAuthor + L"\" w:id=\"" + std::to_wstring(poOOXWriter->m_nCurTrackChangesId++).c_str() + L"\">";
			pCharProps->m_nDeleted = PROP_DEF;
		}
//----------
		sResult += L"<w:r>";
		
        std::wstring sCharProp = pCharProps->RenderToOOX(oRenderParameter);

        if (!sCharProp .empty())
		{
			sResult += L"<w:rPr>";
				sResult += sCharProp;
			sResult += L"</w:rPr>";
		}
		
        sResult += L"<w:object w:dxaOrig=\"" + std::to_wstring(m_nWidth) +
                          L"\" w:dyaOrig=\"" + std::to_wstring(m_nHeight) + L"\">";
		
		RenderParameter oNewRenderParameter = oRenderParameter;
		oNewRenderParameter.nType = RENDER_TO_OOX_PARAM_SHAPE_WSHAPE2;

		if (m_oResultShape)
		{
			m_oResultShape->m_bIsOle = true;

			sResult += m_oResultShape->RenderToOOX(oNewRenderParameter);

			oNewRenderParameter.nValue = m_oResultShape->m_nID;
		}
		sResult += RenderToOOXOnlyOle(oNewRenderParameter);

		sResult += L"</w:object>";
		sResult += L"</w:r>";
		
		if (bDelete)sResult += L"</w:del>";
		if (bInsert)sResult += L"</w:ins>";
	}
	return sResult;
}
Example #6
0
// 날짜 포맷으로 부터 날짜 문자열 획득
CString CAguraDateBox::GetDate(CTime &time, CString &sDateFormat)
{
	int nStart=0, nFind=0;
	CString sDate(_T("")), sTemp(_T(""));

	// Year(yyyy)
	nFind = sDateFormat.Find(_T("yyyy"), nStart);	
	if( nFind >= 0 )
	{
		sDate += sDateFormat.Mid(nStart, nFind-nStart);

		sTemp.Format(_T("%04d"), time.GetYear());
		sDate += sTemp;

		nStart = nFind + 4;
	}

	// Month(MM)
	nFind = sDateFormat.Find(_T("MM"), nStart);		
	if( nFind >= 0 ) 
	{
		sDate += sDateFormat.Mid(nStart, nFind-nStart);

		sTemp.Format(_T("%02d"), time.GetMonth());
		sDate += sTemp;

		nStart = nFind + 2;
	}

	// Day(dd)
	nFind = sDateFormat.Find(_T("dd"), nStart);		
	if( nFind >= 0 ) 
	{
		sDate += sDateFormat.Mid(nStart, nFind-nStart);

		sTemp.Format(_T("%02d"), time.GetDay());
		sDate += sTemp;

		nStart = nFind + 2;
	}

	// Hour(HH)
	nFind = sDateFormat.Find(_T("HH"), nStart);		
	if( nFind >= 0 ) 
	{
		sDate += sDateFormat.Mid(nStart, nFind-nStart);

		sTemp.Format(_T("%02d"), time.GetHour());
		sDate += sTemp;

		nStart = nFind + 2;
	}

	// Minute(mm)
	nFind = sDateFormat.Find(_T("mm"), nStart);		
	if( nFind >= 0 )
	{
		sDate += sDateFormat.Mid(nStart, nFind-nStart);

		sTemp.Format(_T("%02d"), time.GetMinute());
		sDate += sTemp;

		nStart = nFind + 2;
	}

	// Seconds(ss)
	nFind = sDateFormat.Find(_T("ss"), nStart);		
	if( nFind >= 0 ) 
	{
		sDate += sDateFormat.Mid(nStart, nFind-nStart);

		sTemp.Format(_T("%02d"), time.GetSecond());
		sDate += sTemp;		

		nStart = nFind + 2;
	}

	sDate += sDateFormat.Mid(nStart);

	sDate.Remove(_T('\''));
	return sDate;
}