You cannot 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
1.8 KiB
C++

#include "StdAfx.h"
#include "CommonParaMgr.h"
#include "Propertie.h"
#include "PropertieMgr.h"
#include "AuthorityMgr.h"
#include "LogMgr.h"
#include "FileMgr.h"
#include "CStringFuc.h"
#define COMM_PARA_FILE _T("\\CommPar\\CommPara.bin")
CCommonParaMgr *gCommonParaMgr = new CCommonParaMgr;
CCommonParaMgr::CCommonParaMgr(void)
{
}
CCommonParaMgr::~CCommonParaMgr(void)
{
}
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ
void CCommonParaMgr::OnAppInitialize()
{
//<2F><><EFBFBD>ļ<EFBFBD><C4BC>ж<EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD>ò<EFBFBD><C3B2><EFBFBD>ֵ
ReadCommonParaFile();
}
//<2F><><EFBFBD>ļ<EFBFBD><C4BC>ж<EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD>ò<EFBFBD><C3B2><EFBFBD>ֵ
void CCommonParaMgr::ReadCommonParaFile()
{
gLogMgr->WriteDebugLog("Func--->ReadCommonParaFile");
CFileMgr FileMgr;
CString FilePath;
FileMgr.GetFullFilePath(FilePath,COMM_PARA_FILE);//<2F><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>·<EFBFBD><C2B7>
vector<vector<CString>> StrVec;
FileMgr.ReadFileToStrVec(FilePath,StrVec);
m_CommonParaVec.clear();
int size = StrVec.size();
for(int k=0;k<size;k++)
{
if(StrVec[k].size() == 2)
{
CCommonPara CommonPara;
CommonPara.m_ParaName = StrVec[k][0];//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
CommonPara.m_ParaVal = CStringToDouble(StrVec[k][1]);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ
m_CommonParaVec.push_back(CommonPara);
CString log;
log = CommonPara.m_ParaName + " : ";
log += StrVec[k][1];
gLogMgr->WriteDebugLog(log);
}
}
}
//ͨ<><CDA8><EFBFBD><EFBFBD><EFBFBD>ֻ<EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>ֵ
double CCommonParaMgr::GetCommonParaVal(CString ParName)
{
int size = m_CommonParaVec.size();
for(int k=0;k<size;k++)
{
CCommonPara &CommonPara = m_CommonParaVec[k];
if(CommonPara.m_ParaName == ParName)
return CommonPara.m_ParaVal;
}
//û<><C3BB><EFBFBD>ҵ<EFBFBD>
CString log;
log = "Err---->GetCommonPara : ";
log += ParName;
//gLogMgr->WriteDebugLog(log);
return 0;
}