示例#1
0
void vmsAppSmallTipsMgr::Load()
{
	vmsAUTOLOCKSECTION (m_csTipAcc);

	m_vTips.clear ();
	std::vector <tstring> vEngTips;

	Load_imp (fsGetDataFilePath ("tips.dat"), m_vTips, false);
	Load_imp (fsGetProgramFilePath ("tips.dat"), vEngTips, !m_vTips.empty ());	

	if (vEngTips.size () > m_vTips.size ())
	{
		for (size_t i = m_vTips.size (); i < vEngTips.size (); i++)
			m_vTips.push_back (vEngTips [i]);
	}
}
示例#2
0
bool vmsAppSmallTipsMgr::UpdateTipsFile()
{
	CString strUrl;
	CString strLng = _LngMgr.GetLngFileNameWoExt (_LngMgr.GetCurLng ());
	strUrl.Format ("%stips/%s.dat", (LPCTSTR)_App.Update_URL (), (LPCTSTR)strLng);
	CString strFile = fsGetDataFilePath ("tips.bak");
	fsInternetResult ir = vmsAppUtil::UrlDownloadToFile (strUrl, strFile);
	if (ir != IR_SUCCESS && strLng.CompareNoCase ("eng") != 0)
	{
		strUrl = _App.Update_URL ();
		strUrl += "tips/eng.dat";
		ir = vmsAppUtil::UrlDownloadToFile (strUrl, strFile);
	}
	if (ir != IR_SUCCESS)
		return false;
	CString strKeyFile = ((CFdmApp*)AfxGetApp ())->m_strAppPath;
	strKeyFile += "sigkey.dat";
	if (GetFileAttributes (strKeyFile) == DWORD (-1))
		strKeyFile = fsGetProgramFilePath ("sigkey.dat");
	if (false == vmsSecurity::VerifySign (strFile, strKeyFile))
	{
		DeleteFile (strFile);
		return false;
	}
	if (false == vmsSecurity::ExtractFileFromSignedFile (strFile, fsGetDataFilePath ("tips.dat")))
	{
		ASSERT (false);
		return false; 
	}
	DeleteFile (strFile);
	BOOL b = _App.SmallTips_Show ();
	EnterCriticalSection (&m_csTipAcc);
	Load ();
	SetupCurrentTipIndex ();
	LeaveCriticalSection (&m_csTipAcc);
	if (b == FALSE && _App.SmallTips_Show ())
		((CMainFrame*)AfxGetApp ()->m_pMainWnd)->ApplyShowSmallTipsSetting ();
	return true;
}
示例#3
0
DWORD fsUpdateMgr::_DownloadMgrEvents(fsDownloadMgr* pMgr, fsDownloaderEvent ev, UINT uInfo, LPVOID lp)
{
	fsUpdateMgr *pThis = (fsUpdateMgr*) lp;

	switch (ev)
	{
		case DE_SECTIONSTARTED:
			if (pMgr->GetDownloader ()->GetRunningSectionCount ())
			{
				if (pThis->m_bChecking)
					pThis->Event (UME_RETREIVINGUPDLST);
				else
					pThis->Event (UME_RETREIVINGUPDATE);
			}
		break;

		case DE_EXTERROR:
			if (uInfo == DMEE_STOPPEDORDONE)
			{
				if (pMgr->IsDone ())
				{
					if (pThis->m_bChecking)
					{
						SYSTEMTIME time;
						GetLocalTime (&time);
						_App.NewVerExists (TRUE);
						_App.Update_LastCheck (time);
						_App.Update_CheckedOnce (TRUE);

						pThis->Event (UME_UPDLSTDONE);
						pThis->m_bChecking = FALSE;
						pThis->ProcessUpdateLstFile ();
					}
					else
					{
						CString strKeyFile = ((CFdmApp*)AfxGetApp ())->m_strAppPath;
						strKeyFile += _T("sigkey.dat");
						if (GetFileAttributes (strKeyFile) == DWORD (-1))
							strKeyFile = fsGetProgramFilePath (_T("sigkey.dat"));
						if (false == vmsSecurity::VerifySign (pThis->m_dldr->GetDP ()->pszFileName, strKeyFile))
						{
							DeleteFile (pThis->m_dldr->GetDP ()->pszFileName);
							pThis->Event (UME_VERIFYSIGN_ERROR);
							pThis->m_bRunning = FALSE;
						}
						else
						{
							pThis->m_strUpdateFile = pThis->m_dldr->GetDP ()->pszFileName;
							pThis->Event (UME_UPDATEDONE);
							pThis->m_bRunning = FALSE;
						}
						
					}
				}
				else
				{
					pThis->Event (UME_FATALERROR);
					pThis->m_bRunning = FALSE;
				}
			}
			else
			{
				pThis->Event (UME_ERROR);
			}
		break;

		case DE_ERRFROMSERVER:
		case DE_ERROROCCURED:
		case DE_FAILCONNECT:
		case DE_WRITEERROR:
			pThis->Event (UME_ERROR);
		break;
	}

	return TRUE;
}