예제 #1
0
void CDownloads_History::UpdateRecord(int iItem)
{
	fsDLHistoryRecord *rec = (fsDLHistoryRecord*) GetItemData (iItem);
	SetItemText (iItem, 0, rec->strFileName);

	SetItemText (iItem, 1, rec->strURL);

	char sz [1000];
	
	FileTimeToStr (&rec->dateAdded, sz, NULL);
	SetItemText (iItem, 2, sz);

	if (rec->dateDownloaded.dwHighDateTime != 0)
	{
		FileTimeToStr (&rec->dateDownloaded, sz, NULL);
		SetItemText (iItem, 3, sz);
	}
	else
	{
		CString str = LS (L_WASDELETED_);
		FileTimeToStr (&rec->dateRecordAdded, sz, NULL);
		str += " (";
		str += sz;
		str += ')';
		SetItemText (iItem, 3, str);
	}

	CString str;
	if (rec->uFileSize != _UI64_MAX)
	{
		if (FALSE == _pwndDownloads->IsSizesInBytes ())
		{
			float val;
			char szDim [10];
			BytesToXBytes (rec->uFileSize, &val, szDim);
			str.Format ("%.*g %s", val > 999 ? 4 : 3, val, szDim);
		}
		else
			str = fsBytesToStr (rec->uFileSize);
	}
	else
		str = LS (L_UNKNOWN);

	SetItemText (iItem, 4, str);

	SetItemText (iItem, 5, rec->strSavedTo);
	
	str = rec->strComment;
	str.Replace ("\r", " ");
	str.Replace ("\n", " ");
	SetItemText (iItem, 6, str);

	SetItemImage (iItem, GetRecordImage (rec));
}
DWORD WINAPI CCreateTPDownloadDlg::_threadQSize(LPVOID lp)
{
	CCreateTPDownloadDlg *pThis = (CCreateTPDownloadDlg*) lp;

	try{

		CString strSize;
		UINT64 uSize = 0;
		vmsTpDownloadMgr* pMgr = pThis->m_dld->pMgr->GetTpDownloadMgr ();
		if (pMgr->CreateTPDownload (pThis->m_strUrl, "", "", 1))
		{
			pMgr->StartDownloading (FALSE);

			while ((uSize = pMgr->GetTotalFilesSize ()) == 0
				&& pThis->m_bNeedExit == FALSE)
			{
				Sleep (500);
			}
			pMgr->StopDownloading ();
		}

		if (pThis->m_bNeedExit == FALSE)
		{
			if (uSize == _UI64_MAX)
				strSize = LS (L_UNKNOWN);
			else
			{
				if (_pwndDownloads->IsSizesInBytes () == FALSE)
				{
					char szDim [50];
					float fSize;
					BytesToXBytes (uSize, &fSize, szDim);
					if (pMgr->GetPercentDone () == -1)
						strSize.Format ("%s", LS (L_LIVESTREAMING));
					else
						strSize.Format ("%.*g %s", fSize > 999 ? 4 : 3, fSize, szDim);
				}
				else
					strSize = fsBytesToStr (uSize); 
			}

			
			pThis->SetDlgItemText (IDC_QSIZE, strSize);
			pThis->GetDlgItem (IDC_QSIZE)->EnableWindow (TRUE);
		}

		pThis->m_bThread = FALSE;

	}catch (...) {} 

	return 0;
}
예제 #3
0
void fsUploadMgr::AddItemToZipContentsDescHtml(LPCSTR pszName, UINT64 uSize)
{
	m_strZipContentsDescHtml += "<li>";
	m_strZipContentsDescHtml += pszName;

	if (uSize != _UI64_MAX)
	{
		m_strZipContentsDescHtml += " (";
		m_strZipContentsDescHtml += fsBytesToStr (uSize, FALSE);
		m_strZipContentsDescHtml += " bytes";
		m_strZipContentsDescHtml += ")";
	}

	m_strZipContentsDescHtml += "</li>";
}
예제 #4
0
CString BytesToString (UINT64 uSize)
{
	CString str;

	if (FALSE == _pDllCaller->GetSettings ()->ShowSizesInBytes ())
	{
		float val;
		char szDim [10];
		BytesToXBytes (uSize, &val, szDim);
		str.Format ("%.*g %s", val > 999 ? 4 : 3, val, szDim);
	}
	else
		str = fsBytesToStr (uSize, TRUE);

	return str;
}
예제 #5
0
void CDownloads_Deleted::UpdateDownload(int iItem)
{
	vmsDownloadSmartPtr dld = (fsDownload*)GetItemData (iItem);

	CHAR szFile [10000];	
	CDownloads_Tasks::GetFileName (dld, szFile);
	lstrcat (szFile, " (");
	lstrcat (szFile, dld->pMgr->get_URL ());
	lstrcat (szFile, ")");
	SetItemText (iItem, 0, szFile);

	int cSects = dld->pMgr->GetNumberOfSections ();
	UINT64 uSize = dld->pMgr->GetLDFileSize ();
	UINT64 uDone = 0;

	
	SetItemImage (iItem, GetDownloadImage (dld));

	
	
	
	
	uDone = dld->pMgr->GetDownloadedBytesCount ();

	CString str;
	CHAR szDim [10];
	float val;

	

	if (cSects)
	{
		

		if (uSize != _UI64_MAX)
		{
			if (_pwndDownloads->IsSizesInBytes () == FALSE)
			{
				
				BytesToXBytes (uSize, &val, szDim);
				str.Format ("%.*g %s", val > 999 ? 4 : 3, val, szDim);
			}
			else
			{
				
				
				str = fsBytesToStr (uSize);
			}
			SetItemText (iItem, 1, str);
		}
		else
			SetItemText (iItem, 1, "?");	

		

		if (_pwndDownloads->IsSizesInBytes () == FALSE)
		{
			BytesToXBytes (uDone, &val, szDim);
			if (uSize != _UI64_MAX)
				str.Format ("%d%% [%.*g %s]", (int)((double)(INT64)uDone / (INT64)uSize * 100), val > 999 ? 4 : 3, val, szDim);
			else
				str.Format ("%.*g %s", val > 999 ? 4 : 3, val, szDim);
		}
		else
		{
			CString s = fsBytesToStr (uDone);
			if (uSize != _UI64_MAX)
				str.Format ("%d%% [%s]", (int)((double)(INT64)uDone / (INT64)uSize * 100), s);
			else
				str = s;
		}
		SetItemText (iItem, 2, str);
	}
	else
	{
		SetItemText (iItem, 1, "");
		SetItemText (iItem, 2, "");
	}

	

	str.Format ("%d", cSects);
	SetItemText (iItem, 3, str);

	
	str = dld->strComment;
	str.Replace ("\r", " ");
	str.Replace ("\n", " ");
	SetItemText (iItem, 4, str);
}
예제 #6
0
DWORD WINAPI CCreateBatchDownload::_threadCalculateSize(LPVOID lp)
{
	ProcWaitInfo *info = (ProcWaitInfo*) lp;
	CWaitDlg* dlg = (CWaitDlg*) info->lpParam2;
	CCreateBatchDownload* pThis = (CCreateBatchDownload*) info->lpParam1;

	int iFailed = 0;	
	UINT64 uSummSize = 0;	

	
	for (size_t i = 0; i < pThis->m_pvDownloads->size () && info->bNeedStop == FALSE; i++)
	{
		vmsDownloadSmartPtr dld = pThis->m_pvDownloads->at (i);
		if (IR_SUCCESS != dld->pMgr->GetDownloadMgr ()->QuerySize ())	
			iFailed ++;	

		UINT64 uSize = dld->pMgr->GetDownloadMgr ()->GetDownloader ()->GetSSFileSize ();

		
		if (uSize == _UI64_MAX)
		{
			uSummSize = _UI64_MAX;	
			break;
		}

		uSummSize += uSize;

		CString str;
		str.Format ("%s (%d - %s, %d - %s)", LS (L_QUERINGSIZE), i+1, LS (L_DONE), iFailed, LS (L_ERR));
		dlg->SetDlgItemText (IDC_MESSAGE, str);	

		info->iProgress = (int) ((double) i / pThis->m_pvDownloads->size () * 100);
	}

	if (info->bNeedStop == FALSE)
	{
		CString strSize;

		if (uSummSize == _UI64_MAX)
			strSize = LS (L_UNKNOWN);
		else
		{
			if (_pwndDownloads->IsSizesInBytes () == FALSE)
			{
				char szDim [50];
				float fSize;
				BytesToXBytes (uSummSize, &fSize, szDim);
				strSize.Format ("%.*g %s", fSize > 999 ? 4 : 3, fSize, szDim);
			}
			else
				strSize = fsBytesToStr (uSummSize);
		}

		
		pThis->SetDlgItemText (IDC_QUERYSIZE, strSize);
	}
	else
		pThis->SetDlgItemText (IDC_QUERYSIZE, LS (L_QUERYSIZE));

	info->bWaitDone = TRUE;

	return 0;
}