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++
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)
|
|
{
|
|
}
|
|
//软件打开时
|
|
void CCommonParaMgr::OnAppInitialize()
|
|
{
|
|
//从文件中读取常用参数值
|
|
ReadCommonParaFile();
|
|
}
|
|
//从文件中读取常用参数值
|
|
void CCommonParaMgr::ReadCommonParaFile()
|
|
{
|
|
gLogMgr->WriteDebugLog("Func--->ReadCommonParaFile");
|
|
CFileMgr FileMgr;
|
|
CString FilePath;
|
|
FileMgr.GetFullFilePath(FilePath,COMM_PARA_FILE);//结果文件路径
|
|
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];//参数的名字
|
|
CommonPara.m_ParaVal = CStringToDouble(StrVec[k][1]);//参数的值
|
|
m_CommonParaVec.push_back(CommonPara);
|
|
CString log;
|
|
log = CommonPara.m_ParaName + " : ";
|
|
log += StrVec[k][1];
|
|
gLogMgr->WriteDebugLog(log);
|
|
}
|
|
}
|
|
}
|
|
//通过名字获取参数值
|
|
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;
|
|
}
|
|
//没有找到
|
|
CString log;
|
|
log = "Err---->GetCommonPara : ";
|
|
log += ParName;
|
|
//gLogMgr->WriteDebugLog(log);
|
|
return 0;
|
|
} |