コード例 #1
0
//NewAsynGetHttpFile
CNewAsynGetHttpFileTaskData::CNewAsynGetHttpFileTaskData(CAsynCallbackTaskData *pCallbackData, const char* pUrl, const char* pFilePath, int iCoroutineRef) : 
	m_pCallbackData(pCallbackData), m_iCoroutineRef(iCoroutineRef)
{
	CComBSTR bstrUrl,bstrSavePath;
	LuaStringToCComBSTR(pUrl,bstrUrl);
	m_strUrl = bstrUrl.m_str;
	LuaStringToCComBSTR(pFilePath,bstrSavePath);
	m_strSavePath = bstrSavePath.m_str;
}
コード例 #2
0
//NewAsynSendHttpStat
NewAsynHttpStatData::NewAsynHttpStatData(CAsynCallbackTaskData *pCallbackData, const char* pUrl, int iCoroutineRef) : 
m_pCallbackData(pCallbackData), m_iCoroutineRef(iCoroutineRef)
{
	CComBSTR bstrUrl;
	LuaStringToCComBSTR(pUrl,bstrUrl);
	m_strUrl = bstrUrl.m_str;
}
コード例 #3
0
CPostMsgData::CPostMsgData(const char* pClassName, const char* pTitle, UINT uMsg, WPARAM wParam, LPARAM lParam, lua_State* pState, LONG lRefFn) : m_callInfo(pState, lRefFn)
{
	if (pClassName != NULL)
	{
		CComBSTR bstrClassName;
		LuaStringToCComBSTR(pClassName,bstrClassName);
		m_strClassName = bstrClassName.m_str;
	}
	if (pTitle != NULL)
	{
		CComBSTR bstrTitle;
		LuaStringToCComBSTR(pTitle,bstrTitle);
		m_strTitle = bstrTitle.m_str;
	}
	m_uMsg = uMsg;
	m_wParam = wParam;
	m_lParam = lParam;
}
コード例 #4
0
int LuaAsynUtil::GetHttpFileWithProgress(lua_State* pLuaState)
{
	LuaAsynUtil** ppAsynUtil = (LuaAsynUtil **)luaL_checkudata(pLuaState, 1, XMPTIPWND_ASYNCUTIL_CLASS);
	if (ppAsynUtil != NULL)
	{
		const char *pszUrlUTF8 = lua_tostring(pLuaState, 2);
		const char *pszSavePathUTF8 = lua_tostring(pLuaState, 3);
		int bDel = lua_toboolean(pLuaState, 4);
		if (pszUrlUTF8 && pszSavePathUTF8 && lua_isfunction(pLuaState, 5))
		{
			CComBSTR bstrUrl,bstrSavePath;
			LuaStringToCComBSTR(pszUrlUTF8,bstrUrl);
			LuaStringToCComBSTR(pszSavePathUTF8,bstrSavePath);

			SGetHttpFileDataWithProgress *pData = new SGetHttpFileDataWithProgress(bstrUrl.m_str, bstrSavePath.m_str, pLuaState, luaL_ref(pLuaState, LUA_REGISTRYINDEX));
			_beginthreadex(NULL, 0, GetHttpFileWithProgressProc, pData, 0, NULL);
		}
	}

	return 0;
}
コード例 #5
0
ファイル: LuaTool.cpp プロジェクト: fanliaokeji/lvdun
std::wstring LuaGetString(lua_State* L, int nIndex)
{
	const char* lpszVal = luaL_checkstring(L, nIndex);
	if (lpszVal == NULL)
	{
		return std::wstring(L"");
	}
	CComBSTR bstrRes;
	LuaStringToCComBSTR(lpszVal,bstrRes);
	std::wstring strRes = bstrRes.m_str;
	return strRes;
}
コード例 #6
0
int LuaAsynUtil::AjaxGetHttpFile(lua_State* pLuaState)
{
	LuaAsynUtil** ppAsynUtil = (LuaAsynUtil **)luaL_checkudata(pLuaState, 1, XMPTIPWND_ASYNCUTIL_CLASS);
	if (ppAsynUtil != NULL)
	{
		const char* pUrl = lua_tostring(pLuaState, 2);
		const char* pSavePath = lua_tostring(pLuaState, 3);
		if (pUrl != NULL && pSavePath != NULL && lua_isfunction(pLuaState, 4))
		{
			CComBSTR bstrUrl, bstrSavePath;
			LuaStringToCComBSTR(pUrl,bstrUrl);
			LuaStringToCComBSTR(pSavePath,bstrSavePath);

			CAjaxTaskData *pAjaxTaskData = new CAjaxTaskData(pLuaState, luaL_ref(pLuaState, LUA_REGISTRYINDEX));
			if (pAjaxTaskData)
			{
				pAjaxTaskData->Open(bstrUrl, *ppAsynUtil, false, AJAXTASKFLAG_GETHTTPFILE, bstrSavePath);
			}
		}
	}
	return 0;
}
コード例 #7
0
CProcessParam::CProcessParam(const char* pExePath, const char* pParams, const char* pWorkDir, DWORD dwPriority, int nShow, lua_State* pState, LONG lRefFn) : m_callInfo(pState, lRefFn)
{
	if (pExePath != NULL)
	{
		CComBSTR bstrExePath;
		LuaStringToCComBSTR(pExePath,bstrExePath);
		m_strExePath = bstrExePath.m_str;
	}
	if (pParams != NULL)
	{
		CComBSTR bstrParams;
		LuaStringToCComBSTR(pParams,bstrParams);
		m_strParams = bstrParams.m_str;
	}
	if (pWorkDir != NULL)
	{
		CComBSTR bstrWorkDir;
		LuaStringToCComBSTR(pWorkDir,bstrWorkDir);
		m_strWorkDir = bstrWorkDir.m_str;
	}
	m_dwPriority = dwPriority;
	m_nShow = nShow;
	m_lRef = lRefFn;
}
コード例 #8
0
int LuaAsynUtil::GetHttpContent(lua_State* pLuaState)
{
	LuaAsynUtil** ppAsynUtil = (LuaAsynUtil **)luaL_checkudata(pLuaState, 1, XMPTIPWND_ASYNCUTIL_CLASS);
	if (ppAsynUtil != NULL)
	{
		const char *pszUrlUTF8 = lua_tostring(pLuaState, 2);
		int bDel = lua_toboolean(pLuaState, 3);
		if (pszUrlUTF8 && lua_isfunction(pLuaState, 4))
		{
			CComBSTR bstrUrl;
			LuaStringToCComBSTR(pszUrlUTF8,bstrUrl);
			SGetHttpContentData *pData = new SGetHttpContentData(bstrUrl.m_str, pLuaState, luaL_ref(pLuaState, LUA_REGISTRYINDEX));
			_beginthreadex(NULL, 0, GetHttpContentProc, pData, 0, NULL);
		}
	}

	return 0;
}
コード例 #9
0
int LuaAsynUtil::AjaxSendHttpStat(lua_State* pLuaState)
{
	LuaAsynUtil** ppAsynUtil = (LuaAsynUtil **)luaL_checkudata(pLuaState, 1, XMPTIPWND_ASYNCUTIL_CLASS);
	if (ppAsynUtil != NULL)
	{
		const char* pUrl = lua_tostring(pLuaState, 2);
		if (pUrl != NULL && lua_isfunction(pLuaState, 3))
		{
			CComBSTR bstrUrl;
			LuaStringToCComBSTR(pUrl,bstrUrl);
			CAjaxTaskData *pAjaxTaskData = new CAjaxTaskData(pLuaState, luaL_ref(pLuaState, LUA_REGISTRYINDEX));
			if (pAjaxTaskData)
			{
				pAjaxTaskData->Open(bstrUrl, *ppAsynUtil, false, AJAXTASKFLAG_SENDHTTPSTAT);
			}
		}
	}
	return 0;
}
コード例 #10
0
int LuaAsynUtil::AjaxGetHttpContent(lua_State* pLuaState)
{
	LuaAsynUtil** ppAsynUtil = (LuaAsynUtil **)luaL_checkudata(pLuaState, 1, XMPTIPWND_ASYNCUTIL_CLASS);
	if (ppAsynUtil != NULL)
	{
		const char* pUrl = lua_tostring(pLuaState, 2);
		if (pUrl != NULL && lua_isfunction(pLuaState, 3))
		{
			std::wstring strSavePath;

			CComBSTR bstrUrl;
			LuaStringToCComBSTR(pUrl,bstrUrl);

			CAjaxTaskData *pAjaxTaskData = new CAjaxTaskData(pLuaState, luaL_ref(pLuaState, LUA_REGISTRYINDEX));
			if (pAjaxTaskData)
			{
				CComBSTR bstrSavePath(strSavePath.c_str());
				pAjaxTaskData->Open(bstrUrl, *ppAsynUtil, false, AJAXTASKFLAG_GETHTTPCONTENT);
			}
		}
	}
	return 0;
}
コード例 #11
0
HttpStatData::HttpStatData(const char* pUrl, bool bAsync, lua_State* pState, LONG lRefFn) : m_bAsync(bAsync), m_callInfo(pState, lRefFn)
{
	CComBSTR bstrUrl;
	LuaStringToCComBSTR(pUrl,bstrUrl);
	m_strUrl = bstrUrl.m_str;
}