Ejemplo n.º 1
0
BOOL fsUploadsMgr::SaveUploads(HANDLE hFile)
{
	DWORD dw;

	UPLS_LIST list = m_vUploads;

	size_t cUploads = list.size () - m_cDontSaveUploads;
	if (FALSE == WriteFile (hFile, &cUploads, sizeof (size_t), &dw, NULL))
		return FALSE;

	for (size_t i = 0; i < list.size (); i++)
	{
		vmsUploadSmartPtr upl = list [i];
		if (upl->dwFlags & UF_DONTSAVETOFILE)
			continue;

		if (FALSE == WriteFile (hFile, &upl->bAutostart, sizeof (BOOL), &dw, NULL))
			return FALSE;
		if (FALSE == WriteFile (hFile, &upl->nID, sizeof (UINT), &dw, NULL))
			return FALSE;
		if (FALSE == WriteFile (hFile, &upl->dwFlags, sizeof (DWORD), &dw, NULL))
			return FALSE;
		if (FALSE == WriteFile (hFile, &upl->dwState, sizeof (DWORD), &dw, NULL))
			return FALSE;
		if (FALSE == WriteFile (hFile, &upl->dateAdded, sizeof (FILETIME), &dw, NULL))
			return FALSE;
		if (FALSE == upl->log.Save (hFile))
			return FALSE;
		if (FALSE == upl->pMgr->Save (hFile))
			return FALSE;
	}

	return TRUE;
}
Ejemplo n.º 2
0
DWORD WINAPI fsUploadsMgr::_threadDeleteUploads(LPVOID lp)
{
	UPLS_LIST *pv = (UPLS_LIST*) lp;

	UINT msg = RegisterWindowMessage (_pszUploadsDeletedNotifyMsg);
	UINT nMemId = InterlockedIncrement (_UplsMgr.m_pnNextSharedMemId);
	CString str; str.Format (_pszSharedMemoryName, nMemId);
	vmsSharedDataT <UINT> gdata (str, FALSE, pv->size ());
	int cUplds = 0;

	for (size_t i = 0; i < pv->size (); i++)
	{
		vmsUploadSmartPtr upl = pv->at (i); 
		
		if ((upl->dwFlags & UF_READONLY) == 0)
		{
			upl->pMgr->StopUploading (TRUE);
			upl->pMgr->DeleteZipFile ();
		}

		if ((upl->dwFlags & UF_DONTNOTIFYABOUTDELETE) == 0)
			gdata [cUplds++] = upl->nID;
	}

	DWORD dw;
	if (cUplds)
		SendMessageTimeout (HWND_BROADCAST, msg, cUplds, nMemId, 0, 5000, &dw);

	delete pv;
	return 0;
}
Ejemplo n.º 3
0
BOOL fsUploadsMgr::IsRunning()
{
	UPLS_LIST v = m_vUploads;
	for (size_t i = 0; i < v.size (); i++)
	{
		if (v [i]->pMgr->IsRunning ())
			return TRUE;
	}

	return FALSE;
}
Ejemplo n.º 4
0
void CUploadsWnd::OnDeleteUploads(int cUploads, UINT nIdMem)
{
	CString str; str.Format (_pszSharedMemoryName, nIdMem);
	vmsSharedDataT <UINT> gdata (str, TRUE, cUploads);
	
	UPLS_LIST v;

	for (int i = 0; i < cUploads; i++)
	{
		vmsUploadSmartPtr upl = _UplsMgr.FindUploadById (gdata [i]);
		if (upl == NULL)
			continue;
		
		upl->dwFlags |= UF_DONTNOTIFYABOUTDELETE;
		v.push_back (upl);
	}

	if (v.size ())
		_UplsMgr.DeleteUploads (v);
}