示例#1
0
CString CDirstatView::GenerateReport()
{
	CString report= GetOptions()->GetReportPrefix() + _T("\r\n");

	CItem *root= GetDocument()->GetSelection();
	ASSERT(root != NULL);
	ASSERT(root->IsVisible());

	int r= m_treeListControl.FindTreeItem(root);
	
	for (
		int i=r; 
			i < m_treeListControl.GetItemCount() 
			&& (i == r || m_treeListControl.GetItem(i)->GetIndent() > root->GetIndent());
		i++
	)
	{
		CItem *item= (CItem *)m_treeListControl.GetItem(i);
		
		if (item->GetType() == IT_MYCOMPUTER)
			continue;

		report.AppendFormat(_T("%s %s\r\n"), PadWidthBlanks(FormatLongLongHuman(item->GetSize()), 11), item->GetReportPath());
	}

	report+= _T("\r\n\r\n");
	report+= GetOptions()->GetReportSuffix();

	return report;
}
示例#2
0
CString FormatBytes(ULONGLONG const& n)
{
    if(GetOptions()->IsHumanFormat())
    {
        return FormatLongLongHuman(n);
    }
    else
    {
        return FormatLongLongNormal(n);
    }
}