📄 systemprofile.cpp
字号:
// SystemProfile.cpp: implementation of the CSystemProfile class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "SystemProfile.h"
#include "int.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
CSystemProfile gProfile;
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CSystemProfile::CSystemProfile()
{
}
CSystemProfile::~CSystemProfile()
{
}
CString CSystemProfile::GetProfile()
{
CString strFile, strExt;
CHelpFunc::ParseAppName(CHelpFunc::GetAppName(), strFile, strExt);
strFile = CHelpFunc::GetAppPath() + strFile + "." + "INI";
return strFile;
}
void CSystemProfile::ReadProfile()
{
CString strFile = GetProfile();
char strBuff[1024];
::GetPrivateProfileString("SMG网关", "server_ip", "", strBuff, 1023, strFile);
mstrmsgip = strBuff;
::GetPrivateProfileString("SMG网关", "server_port", "", strBuff, 1023, strFile );
mstrmsgport=strBuff;
//SP接入号码
::GetPrivateProfileString("SMG网关", "SP接入号码", "", strBuff, 1023, strFile );
mstrSpnum=strBuff;
//网关代码
::GetPrivateProfileString("SMG网关", "网关代码", "", strBuff, 1023, strFile );
mstrgatenumber=strBuff;
// SP节点编码
mlngSpnumber=::GetPrivateProfileInt("SMG网关", "SP节点编码", 0, strFile );
//
//企业代码
::GetPrivateProfileString("SMG网关", "企业代码", "", strBuff, 1023, strFile );
mstrCorpId=strBuff;
// 企业名称
::GetPrivateProfileString("SMG网关", "企业名称", "", strBuff, 1023, strFile );
mstrCorpname=strBuff;
// 登陆用户名
::GetPrivateProfileString("SMG网关", "登陆用户名", "", strBuff, 1023, strFile );
mstrLoginName=strBuff;
// 登陆密码
::GetPrivateProfileString("SMG网关", "登陆密码", "", strBuff, 1023, strFile );
mstrLoginPassowrd=strBuff;
//监听端口
::GetPrivateProfileString("SMG网关连接参数", "监听端口", "", strBuff, 1023, strFile );
mstrmsglistenport=strBuff;
//监听端口
::GetPrivateProfileString("客户服务", "监听端口", "", strBuff, 1023, strFile );
mstrPort=strBuff;
//协议类型
::GetPrivateProfileString("客户服务", "协议类型", "", strBuff, 1023, strFile );
mstrProtocol=strBuff;
// 计费
mnFeeType = ::GetPrivateProfileInt("如意呼计费", "FeeType", 2, strFile);
::GetPrivateProfileString("如意呼计费", "FeeValue", "00010", strBuff, 1023, strFile);
mstrFeeValue = strBuff;
}
#include "int.h"
void CSystemProfile::WriteProfile()
{
CString strFile = GetProfile();
::WritePrivateProfileString("SMG网关", "server_ip", mstrmsgip, strFile);
::WritePrivateProfileString("SMG网关", "server_port", mstrmsgport, strFile );
::WritePrivateProfileString("SMG网关", "SP接入号码", mstrSpnum, strFile );
//网关代码
::WritePrivateProfileString("SMG网关", "网关代码", mstrgatenumber, strFile );
// SP节点编码
char buffer[20];
_ltoa( mlngSpnumber, buffer, 10 );
::WritePrivateProfileString("SMG网关", "SP节点编码", buffer, strFile );
//企业代码
::WritePrivateProfileString("SMG网关", "企业代码", mstrCorpId, strFile );
// 企业名称
::WritePrivateProfileString("SMG网关", "企业名称", mstrCorpname, strFile );
// 登陆用户名
::WritePrivateProfileString("SMG网关", "登陆用户名",mstrLoginName, strFile );
// 登陆密码
::WritePrivateProfileString("SMG网关", "登陆密码", mstrLoginPassowrd, strFile );
//监听端口
::WritePrivateProfileString("SMG网关连接参数", "监听端口",mstrmsglistenport, strFile );
//监听端口
::WritePrivateProfileString("客户服务", "监听端口", mstrPort, strFile );
//协议类型
::WritePrivateProfileString("客户服务", "协议类型", mstrProtocol, strFile );
// 计费
CInt n = gProfile.mnFeeType;
::WritePrivateProfileString("如意呼计费", "FeeType", n.ToStr(), strFile);
::WritePrivateProfileString("如意呼计费", "FeeValue", mstrFeeValue, strFile);
}
// 检查是否是接入号
BOOL CSystemProfile::IsValidServiceCode(LPCTSTR strServiceCode)
{
return true;
}
BOOL CSystemProfile::CheckProfile()
{
return TRUE;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -