当前位置: 首页>>代码示例>>C++>>正文


C++ FormatBytes函数代码示例

本文整理汇总了C++中FormatBytes函数的典型用法代码示例。如果您正苦于以下问题:C++ FormatBytes函数的具体用法?C++ FormatBytes怎么用?C++ FormatBytes使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了FormatBytes函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: UNREFERENCED_PARAMETER

LRESULT Cwinproc::OnTaskbarNotify(WPARAM wParam, LPARAM lParam) {
	UNREFERENCED_PARAMETER(wParam);
	
	switch (lParam) {
		case WM_MOUSEMOVE:
		{
			CString s, sRecvBPS, sRecvAVE;
			FormatBytes(RecvStats[0].Bps, sRecvBPS, true);
			FormatBytes(RecvStats[0].ave, sRecvAVE, true);
			s.Format("Current: %s   Average: %s", sRecvBPS, sRecvAVE);
			
			m_SystemTray.cbSize = sizeof(NOTIFYICONDATA);
			m_SystemTray.hWnd   = GetSafeHwnd();
			m_SystemTray.uID    = 1;
			m_SystemTray.uFlags = NIF_TIP;
			strcpy_s(m_SystemTray.szTip, s);
			Shell_NotifyIcon(NIM_MODIFY, &m_SystemTray);
		}
		break;
		
		case WM_LBUTTONDBLCLK:
			ShowPropertiesDlg();
			break;
			
		case WM_RBUTTONUP:
		{
			CMenu menu;
			POINT pt;
			
			GetCursorPos(&pt);
			
			menu.LoadMenu(IDR_MENU1);
			menu.SetDefaultItem(0, TRUE);
			
			CMenu &pMenu = *menu.GetSubMenu(0);
			pMenu.SetDefaultItem(0, TRUE);
			
			// See Q135788 "PRB: Menus for Notification Icons Do Not Work Correctly"
			SetForegroundWindow();
			int cmd = pMenu.TrackPopupMenu(TPM_RETURNCMD | TPM_LEFTALIGN | TPM_NONOTIFY, pt.x, pt.y, this);
			PostMessage(WM_NULL, 0, 0);
			
			if (cmd == IDCLOSE) {
				// Save any settings if the user closes the tray icon while the dialog is open
				if (m_pPropertiesDlg != NULL) {
					SaveSettings();
					m_pPropertiesDlg->SendMessage(WM_CLOSE);
				}
				theApp.m_wnd.PostMessage(WM_CLOSE);
			} else if (cmd == ID_PROPERTIES)
				ShowPropertiesDlg();
		}
		break;
	}
	return 0;
}
开发者ID:nayuki,项目名称:NetPerSec,代码行数:56,代码来源:winproc.cpp

示例2: CheckExtension

void ParticleInstancingRenderer::Initialize() {

    // Initialize can be called at any time - don't actually initialize
    // more than once.
    if (is_initialized)
        return;

    is_initialized = true;
    extensions_supported = false;

    // check for the extensions that are required
    GLboolean shader4_supported = CheckExtension("GL_EXT_gpu_shader4");
    if (shader4_supported)
        debug2 << "ParticleInstancingRenderer: Extension GL_EXT_gpu_shader4 supported" << endl;
    else
        debug2 << "ParticleInstancingRenderer: Extension GL_EXT_gpu_shader4 not supported" << endl;

	
    GLboolean tbo_supported = CheckExtension("GL_EXT_texture_buffer_object");
    if (tbo_supported)
        debug2 << "ParticleInstancingRenderer: Extension GL_EXT_texture_buffer_object supported" << endl;
    else
        debug2 << "ParticleInstancingRenderer: Extension GL_EXT_texture_buffer_object not supported" << endl;


    extensions_supported = (shader4_supported && tbo_supported);
	if (extensions_supported) {
	    debug1 << "ParticleInstancingRenderer: Necessary extensions supported, "
               << "using the new Molecule plot implementation." << endl;
	}
	else
    {
	    debug1 << "ParticleInstancingRenderer: Necessary extensions not supported, "
               << "using the old Molecule plot implementation." << endl;
	}

    // don't do any more if the extensions aren't supported
    if (!extensions_supported)
        return;



    // 
    GLint max_texture_buffer_size;
    glGetIntegerv(GL_MAX_TEXTURE_BUFFER_SIZE_EXT, &max_texture_buffer_size);
    debug1 << "maximal texture buffer size " << FormatBytes(max_texture_buffer_size) << endl;

    size_t instances_position_radius = size_t(max_texture_buffer_size) / (4*sizeof(float));
    size_t instances_color  = size_t(max_texture_buffer_size) / (4*sizeof(unsigned char));
    instanced_batch_size = std::min(instances_position_radius, instances_color);


    debug1 << "ParticleInstancingRenderer: Max number of instances " 
           << instanced_batch_size << " = "
           << instanced_batch_size / 1000000.0f << " million" << endl;

    GenerateAndBuildTBO();
    BuildSphereGeometryVBOs();
    BuildShaders();
}
开发者ID:alvarodlg,项目名称:lotsofcoresbook2code,代码行数:60,代码来源:ParticleInstancingRenderer.C

示例3: peerAddrDetails

void RPCConsole::updateNodeDetail(const CNodeCombinedStats *stats)
{
    // Update cached nodeid
    cachedNodeid = stats->nodeStats.nodeid;

    // update the detail ui with latest node information
    QString peerAddrDetails(QString::fromStdString(stats->nodeStats.addrName) + " ");
    peerAddrDetails += tr("(node id: %1)").arg(QString::number(stats->nodeStats.nodeid));
    if (!stats->nodeStats.addrLocal.empty())
        peerAddrDetails += "<br />" + tr("via %1").arg(QString::fromStdString(stats->nodeStats.addrLocal));
    ui->peerHeading->setText(peerAddrDetails);
    ui->peerServices->setText(GUIUtil::formatServicesStr(stats->nodeStats.nServices));
    ui->peerLastSend->setText(stats->nodeStats.nLastSend ? GUIUtil::formatDurationStr(GetTime() - stats->nodeStats.nLastSend) : tr("never"));
    ui->peerLastRecv->setText(stats->nodeStats.nLastRecv ? GUIUtil::formatDurationStr(GetTime() - stats->nodeStats.nLastRecv) : tr("never"));
    ui->peerBytesSent->setText(FormatBytes(stats->nodeStats.nSendBytes));
    ui->peerBytesRecv->setText(FormatBytes(stats->nodeStats.nRecvBytes));
    ui->peerConnTime->setText(GUIUtil::formatDurationStr(GetTime() - stats->nodeStats.nTimeConnected));
    ui->peerPingTime->setText(GUIUtil::formatPingTime(stats->nodeStats.dPingTime));
    ui->peerPingWait->setText(GUIUtil::formatPingTime(stats->nodeStats.dPingWait));
    ui->timeoffset->setText(GUIUtil::formatTimeOffset(stats->nodeStats.nTimeOffset));
    ui->peerVersion->setText(QString("%1").arg(QString::number(stats->nodeStats.nVersion)));
    ui->peerSubversion->setText(QString::fromStdString(stats->nodeStats.cleanSubVer));
    ui->peerDirection->setText(stats->nodeStats.fInbound ? tr("Inbound") : tr("Outbound"));
    ui->peerHeight->setText(QString("%1").arg(QString::number(stats->nodeStats.nStartingHeight)));
    ui->peerWhitelisted->setText(stats->nodeStats.fWhitelisted ? tr("Yes") : tr("No"));

    // This check fails for example if the lock was busy and
    // nodeStateStats couldn't be fetched.
    if (stats->fNodeStateStatsAvailable) {
        // Ban score is init to 0
        ui->peerBanScore->setText(QString("%1").arg(stats->nodeStateStats.nMisbehavior));

        // Sync height is init to -1
        if (stats->nodeStateStats.nSyncHeight > -1)
            ui->peerSyncHeight->setText(QString("%1").arg(stats->nodeStateStats.nSyncHeight));
        else
            ui->peerSyncHeight->setText(tr("Unknown"));

        // Common height is init to -1
        if (stats->nodeStateStats.nCommonHeight > -1)
            ui->peerCommonHeight->setText(QString("%1").arg(stats->nodeStateStats.nCommonHeight));
        else
            ui->peerCommonHeight->setText(tr("Unknown"));
    }

    ui->detailWidget->show();
}
开发者ID:recalibrate,项目名称:bitcoin,代码行数:47,代码来源:rpcconsole.cpp

示例4: tr

void RPCConsole::updateNodeDetail(const CNodeCombinedStats *combinedStats)
{
    CNodeStats stats = combinedStats->nodestats;

    // keep a copy of timestamps, used to display dates upon disconnect
    detailNodeStats.nodestats.nLastSend = stats.nLastSend;
    detailNodeStats.nodestats.nLastRecv = stats.nLastRecv;
    detailNodeStats.nodestats.nTimeConnected = stats.nTimeConnected;

    // update the detail ui with latest node information
    ui->peerHeading->setText(QString("<b>%1</b>").arg(tr("Node Detail")));
    ui->peerAddr->setText(QString(stats.addrName.c_str()));
    ui->peerServices->setText(GUIUtil::formatServicesStr(stats.nServices));
    ui->peerLastSend->setText(stats.nLastSend ? GUIUtil::formatDurationStr(GetTime() - stats.nLastSend) : tr("never"));
    ui->peerLastRecv->setText(stats.nLastRecv ? GUIUtil::formatDurationStr(GetTime() - stats.nLastRecv) : tr("never"));
    ui->peerBytesSent->setText(FormatBytes(stats.nSendBytes));
    ui->peerBytesRecv->setText(FormatBytes(stats.nRecvBytes));
    ui->peerConnTime->setText(GUIUtil::formatDurationStr(GetTime() - stats.nTimeConnected));
    ui->peerPingTime->setText(stats.dPingTime == 0 ? tr("N/A") : QString(tr("%1 secs")).arg(QString::number(stats.dPingTime, 'f', 3)));
    ui->peerVersion->setText(QString("%1").arg(stats.nVersion));
    ui->peerSubversion->setText(QString(stats.cleanSubVer.c_str()));
    ui->peerDirection->setText(stats.fInbound ? tr("Inbound") : tr("Outbound"));
    ui->peerHeight->setText(QString("%1").arg(stats.nStartingHeight));
    ui->peerSyncNode->setText(stats.fSyncNode ? tr("Yes") : tr("No"));

    // if we can, display the peer's ban score
    CNodeStateStats statestats = combinedStats->statestats;
    if (statestats.nMisbehavior >= 0)
    {
        // we have a new nMisbehavor value - update the cache
        detailNodeStats.statestats.nMisbehavior = statestats.nMisbehavior;
    }

    // pull the ban score from cache.  -1 means it hasn't been retrieved yet (lock busy).
    if (detailNodeStats.statestats.nMisbehavior >= 0)
        ui->peerBanScore->setText(QString("%1").arg(detailNodeStats.statestats.nMisbehavior));
    else
        ui->peerBanScore->setText(tr("Fetching..."));
}
开发者ID:KaSt,项目名称:ekwicoin,代码行数:39,代码来源:rpcconsole.cpp

示例5: switch

CString CDriveItem::GetText(int subitem) const
{
	CString s;

	switch (subitem)
	{
	case COL_NAME:
		s= m_name;
		break;

	case COL_TOTAL:
		if (m_success)
			s= FormatBytes((LONGLONG)m_totalBytes);
		break;

	case COL_FREE:
		if (m_success)
			s= FormatBytes((LONGLONG)m_freeBytes);
		break;

	case COL_GRAPH:
		if (m_querying)
			s.LoadString(IDS_QUERYING);
		else if (!m_success)
			s.LoadString(IDS_NOTACCESSIBLE);
		break;

	case COL_PERCENTUSED:
		if (m_success)
			s= FormatDouble(m_used * 100) + _T("%");
		break;

	default:
		ASSERT(0);
	}
	
	return s;
}
开发者ID:coapp-packages,项目名称:windirstat,代码行数:38,代码来源:SelectDrivesDlg.cpp

示例6: UpdateMemoryInfo

CString CDirstatApp::GetCurrentProcessMemoryInfo()
{
	UpdateMemoryInfo();

	if (m_workingSet == 0)
		return _T("");

	CString n= PadWidthBlanks(FormatBytes(m_workingSet), 11);

	CString s;
	s.FormatMessage(IDS_RAMUSAGEs, n);

	return s;
}
开发者ID:coapp-packages,项目名称:windirstat,代码行数:14,代码来源:windirstat.cpp

示例7: switch

CString CExtensionListControl::CListItem::GetText(int subitem) const
{
    switch (subitem)
    {
    case COL_EXTENSION:
        {
            return GetExtension();
        }

    case COL_COLOR:
        {
            return _T("(color)");
        }

    case COL_BYTES:
        {
            return FormatBytes(m_record.bytes);
        }

    case COL_FILES:
        {
            return FormatCount(m_record.files);
        }

    case COL_DESCRIPTION:
        {
            return GetDescription();
        }

    case COL_BYTESPERCENT:
        {
            return GetBytesPercent();
        }

    default:
        {
            ASSERT(0);
            return wds::strEmpty;
        }
    }
}
开发者ID:JDuverge,项目名称:windirstat,代码行数:41,代码来源:typeview.cpp

示例8: FormatBytes

void ParticleInstancingRenderer::BuildTBO(const GLuint tbo, const GLuint tex, size_t tbo_size,  \
                                          GLenum usage, GLenum internal_format)
{
    debug1 << "\tbuilding texture buffer for instance data of size " << FormatBytes(tbo_size) << endl;

    glBindBufferARB(GL_TEXTURE_BUFFER_ARB, tbo);
    CheckOpenGLError();

    glBufferDataARB(GL_TEXTURE_BUFFER_ARB, tbo_size, 0, usage);
    CheckOpenGLError();

    glBindTexture(GL_TEXTURE_BUFFER_ARB, tex );
    CheckOpenGLError();

    glTexBufferARB(GL_TEXTURE_BUFFER_ARB, internal_format, tbo);
    CheckOpenGLError();

    // clear texture / bufer bindings
    glBindBufferARB(GL_TEXTURE_BUFFER_ARB, 0);
    CheckOpenGLError();
    glBindTexture(GL_TEXTURE_BUFFER_ARB, 0);
    CheckOpenGLError();
}
开发者ID:alvarodlg,项目名称:lotsofcoresbook2code,代码行数:23,代码来源:ParticleInstancingRenderer.C

示例9: SetDlgItemText

void CHomeUI::OnDeviceInfo(PE_DEV_INFO *pInfo)
{
	CString sPhone;
	sPhone.Format(_T("Phone: %s, made by %s"),pInfo->szPhoneModel,pInfo->szPhoneManufacturer);
	SetDlgItemText(IDC_STATIC_PHONE_NAME,sPhone);

	CString sSDCard;
	CString sTotal = FormatBytes(pInfo->dwSDCardTotalSpace);
	float fPercent = 0;
	if (pInfo->dwSDCardTotalSpace)
	{
		fPercent = (float)((double)pInfo->dwSDCardAvailableSpace/(double)pInfo->dwSDCardTotalSpace);
		fPercent *= 100;
	}
	sSDCard.Format(_T("SDCard: total %s(%d%% free)"),sTotal.GetBuffer(),(int)fPercent);
	sTotal.ReleaseBuffer();
	m_progSdCard.SetWindowText(sSDCard);
	m_progSdCard.SetPos((int)fPercent);

	CString sPercent;
	sPercent.Format(_T("Battery:%d%% remaining"),pInfo->dwBatteryLevel);
	m_batteryLevel.SetWindowText(sPercent);
	m_batteryLevel.SetPos((int)pInfo->dwBatteryLevel);
}
开发者ID:HamiguaLu,项目名称:YaSync,代码行数:24,代码来源:HomeUI.cpp

示例10: updateTrafficStats

void RPCConsole::updateTrafficStats(quint64 totalBytesIn, quint64 totalBytesOut)
{
    ui->lblBytesIn->setText(FormatBytes(totalBytesIn));
    ui->lblBytesOut->setText(FormatBytes(totalBytesOut));
}
开发者ID:BoodleKing,项目名称:Boodle,代码行数:5,代码来源:rpcconsole.cpp

示例11: DebugAssert

//---------------------------------------------------------------------------
void __fastcall TQueueController::FillQueueViewItem(TListItem * Item,
  TQueueItemProxy * QueueItem, bool Detail)
{
  DebugAssert(!Detail || (QueueItem->Status != TQueueItem::qsPending));

  DebugAssert((Item->Data == NULL) || (Item->Data == QueueItem));
  Item->Data = QueueItem;

  UnicodeString ProgressStr;
  int Image = -1;

  switch (QueueItem->Status)
  {
    case TQueueItem::qsDone:
      ProgressStr = LoadStr(QUEUE_DONE);
      break;

    case TQueueItem::qsPending:
      ProgressStr = LoadStr(QUEUE_PENDING);
      break;

    case TQueueItem::qsConnecting:
      ProgressStr = LoadStr(QUEUE_CONNECTING);
      break;

    case TQueueItem::qsQuery:
      ProgressStr = LoadStr(QUEUE_QUERY);
      Image = 4;
      break;

    case TQueueItem::qsError:
      ProgressStr = LoadStr(QUEUE_ERROR);
      Image = 5;
      break;

    case TQueueItem::qsPrompt:
      ProgressStr = LoadStr(QUEUE_PROMPT);
      Image = 6;
      break;

    case TQueueItem::qsPaused:
      ProgressStr = LoadStr(QUEUE_PAUSED);
      Image = 7;
      break;
  }

  bool BlinkHide = QueueItemNeedsFrequentRefresh(QueueItem) &&
    !QueueItem->ProcessingUserAction &&
    ((GetTickCount() % MSecsPerSec) >= (MSecsPerSec/2));

  int State = -1;
  UnicodeString Values[6];
  TFileOperationProgressType * ProgressData = QueueItem->ProgressData;
  TQueueItem::TInfo * Info = QueueItem->Info;

  if (!Detail)
  {
    switch (Info->Operation)
    {
      case foCopy:
        State = ((Info->Side == osLocal) ? 2 : 0);
        break;

      case foMove:
        State = ((Info->Side == osLocal) ? 3 : 1);
        break;
    }

    // cannot use ProgressData->Temp as it is set only after the transfer actually starts
    Values[0] = Info->Source.IsEmpty() ? LoadStr(PROGRESS_TEMP_DIR) : Info->Source;
    Values[1] = Info->Destination.IsEmpty() ? LoadStr(PROGRESS_TEMP_DIR) : Info->Destination;

    __int64 TotalTransferred = QueueItem->TotalTransferred;
    if (TotalTransferred >= 0)
    {
      Values[2] =
        FormatPanelBytes(TotalTransferred, WinConfiguration->FormatSizeBytes);
    }

    if (ProgressData != NULL)
    {
      if (ProgressData->Operation == Info->Operation)
      {
        if (QueueItem->Status != TQueueItem::qsDone)
        {
          if (ProgressData->TotalSizeSet)
          {
            Values[3] = FormatDateTimeSpan(Configuration->TimeFormat, ProgressData->TotalTimeLeft());
          }
          else
          {
            Values[3] = FormatDateTimeSpan(Configuration->TimeFormat, ProgressData->TimeElapsed());
          }

          Values[4] = FORMAT(L"%s/s", (FormatBytes(ProgressData->CPS())));
        }

        if (ProgressStr.IsEmpty())
        {
//.........这里部分代码省略.........
开发者ID:anyue100,项目名称:winscp,代码行数:101,代码来源:QueueController.cpp

示例12: SetDlgItemBytes

void SetDlgItemBytes (HWND hDlg, int idc, double lfValue)
{
   TCHAR szText[ 256 ];
   FormatBytes (szText, lfValue);
   SetDlgItemText (hDlg, idc, szText);
}
开发者ID:maxendpoint,项目名称:openafs_cvs,代码行数:6,代码来源:tal_alloc.cpp

示例13: MemMgr_OnListAdd

void MemMgr_OnListAdd (PMEMCHUNK pCopy)
{
   HWND hList = GetDlgItem (l.hManager, IDC_LIST);

   TCHAR szTime[256];
   FormatTime (szTime, pCopy->dwTick);

   TCHAR szFlags[256];
   LPTSTR pszFlags = szFlags;
   *pszFlags++ = (pCopy->fCPP) ? TEXT('C') : TEXT(' ');
   *pszFlags++ = TEXT(' ');
   *pszFlags++ = (pCopy->fFreed) ? TEXT('F') : TEXT(' ');
   *pszFlags++ = 0;

   TCHAR szExpr[256];
   lstrcpy (szExpr, (pCopy->pszExpr) ? pCopy->pszExpr : TEXT("unknown"));

   LPTSTR pszFile = pCopy->pszFile;
   for (LPTSTR psz = pCopy->pszFile; *psz; ++psz)
      {
      if ((*psz == TEXT(':')) || (*psz == TEXT('\\')))
         pszFile = &psz[1];
      }
   TCHAR szLocation[256];
   if (!pszFile || !pCopy->dwLine)
      lstrcpy (szLocation, TEXT("unknown"));
   else
      wsprintf (szLocation, TEXT("%s, %ld"), pszFile, pCopy->dwLine);

   TCHAR szBytes[256];
   FormatBytes (szBytes, (double)pCopy->cbData);

   TCHAR szAddress[256];
   wsprintf (szAddress, TEXT("0x%08p"), pCopy->pData);

   LPTSTR pszKey = NULL;
   switch (lr.iColSort)
      {
      case 0:  pszKey = (LPTSTR)UlongToPtr(pCopy->dwTick);  break;
      case 1:  pszKey = (LPTSTR)szFlags;        break;
      case 2:  pszKey = (LPTSTR)szExpr;         break;
      case 3:  pszKey = (LPTSTR)szLocation;     break;
      case 4:  pszKey = (LPTSTR)pCopy->cbData;  break;
      case 5:  pszKey = (LPTSTR)pCopy->pData;   break;
      }

   LV_ITEM Item;
   memset (&Item, 0x00, sizeof(Item));
   Item.mask = LVIF_TEXT | LVIF_PARAM | LVIF_STATE | LVIF_IMAGE;
   Item.iItem = MemMgr_PickListInsertionPoint (hList, pszKey);
   Item.iSubItem = 0;
   Item.cchTextMax = 256;
   Item.lParam = (LPARAM)pCopy->pData;

   Item.pszText = szTime;
   DWORD iItem = ListView_InsertItem (hList, &Item);
   ListView_SetItemText (hList, iItem, 1, szFlags);
   ListView_SetItemText (hList, iItem, 2, szExpr);
   ListView_SetItemText (hList, iItem, 3, szLocation);
   ListView_SetItemText (hList, iItem, 4, szBytes);
   ListView_SetItemText (hList, iItem, 5, szAddress);

   delete pCopy;
}
开发者ID:maxendpoint,项目名称:openafs_cvs,代码行数:64,代码来源:tal_alloc.cpp

示例14: ASSERT

BOOL CHwSMTP::SendOnAttach(LPCTSTR lpszFileName)
{
	ASSERT ( lpszFileName );
	CString csAttach, csTemp;

	csTemp = lpszFileName;
	CString csShortFileName = csTemp.GetBuffer(0) + csTemp.ReverseFind ( '\\' );
	csShortFileName.TrimLeft ( _T("\\") );

	csTemp.Format ( _T("--%s\r\n"), m_csPartBoundary );
	csAttach += csTemp;

	csTemp.Format ( _T("Content-Type: application/octet-stream; file=%s\r\n"), csShortFileName );
	csAttach += csTemp;

	csTemp.Format ( _T("Content-Transfer-Encoding: base64\r\n") );
	csAttach += csTemp;

	csTemp.Format ( _T("Content-Disposition: attachment; filename=%s\r\n\r\n"), csShortFileName );
	csAttach += csTemp;

	DWORD dwFileSize =  hwGetFileAttr(lpszFileName);
	if ( dwFileSize > 5*1024*1024 )
	{
		m_csLastError.Format ( _T("File [%s] too big. File size is : %s"), lpszFileName, FormatBytes(dwFileSize) );
		return FALSE;
	}
	char *pBuf = new char[dwFileSize+1];
	if ( !pBuf )
	{
		::AfxThrowMemoryException ();
		return FALSE;
	}

	if(!Send ( csAttach ))
	{
		delete[] pBuf;
		return FALSE;
	}

	CFile file;
	CStringA filedata;
	try
	{
		if ( !file.Open ( lpszFileName, CFile::modeRead ) )
		{
			m_csLastError.Format ( _T("Open file [%s] failed"), lpszFileName );			
			delete[] pBuf;
			return FALSE;
		}
		UINT nFileLen = file.Read ( pBuf, dwFileSize );
		CBase64 Base64Encode;
		filedata = Base64Encode.Encode ( pBuf, nFileLen );
		filedata += _T("\r\n\r\n");
	}
	catch (CFileException *e)
	{
		e->Delete();
		m_csLastError.Format ( _T("Read file [%s] failed"), lpszFileName );
		delete[] pBuf;
		return FALSE;
	}

	if(!SendBuffer( filedata.GetBuffer() ))
	{
		delete[] pBuf;
		return FALSE;
	}

	delete[] pBuf;

	return TRUE;
	//return Send ( csAttach );
}
开发者ID:chengn,项目名称:TortoiseGit,代码行数:74,代码来源:HwSMTP.cpp

示例15: switch

CString CItem::GetText(int subitem) const
{
	CString s;
	switch (subitem)
	{
	case COL_NAME:
		s = m_name;
		break;

	case COL_SUBTREEPERCENTAGE:
		if (IsDone())
		{
			ASSERT(m_readJobs == 0);
			//s = "ok";
		}
		else
		{
			if (m_readJobs == 1)
				s.LoadString(IDS_ONEREADJOB);
			else
				s.FormatMessage(IDS_sREADJOBS, FormatCount(m_readJobs));
		}
		break;

	case COL_PERCENTAGE:
		if (GetOptions()->IsShowTimeSpent() && MustShowReadJobs() || IsRootItem())
		{
			s.Format(_T("[%s s]"), FormatMilliseconds(GetTicksWorked()));
		}
		else
		{
			s.Format(_T("%s%%"), FormatDouble(GetFraction() * 100));
		}
		break;

	case COL_SUBTREETOTAL:
		s = FormatBytes(GetSize());
		break;

	case COL_ITEMS:
		if (GetType() != IT_FILE && GetType() != IT_FREESPACE && GetType() != IT_UNKNOWN)
			s = FormatCount(GetItemsCount());
		break;

	case COL_FILES:
		if (GetType() != IT_FILE && GetType() != IT_FREESPACE && GetType() != IT_UNKNOWN)
			s = FormatCount(GetFilesCount());
		break;

	case COL_SUBDIRS:
		if (GetType() != IT_FILE && GetType() != IT_FREESPACE && GetType() != IT_UNKNOWN)
			s = FormatCount(GetSubdirsCount());
		break;

	case COL_LASTCHANGE:
		if (GetType() != IT_FREESPACE && GetType() != IT_UNKNOWN)
		{
			s = FormatFileTime(m_lastChange);
		}
		break;

	case COL_ATTRIBUTES:
		if (GetType() != IT_FREESPACE && GetType() != IT_UNKNOWN && GetType() != IT_MYCOMPUTER && GetType() != IT_FILESFOLDER)
		{
			s = FormatAttributes(GetAttributes());
		}
		break;

	default:
		ASSERT(0);
		break;
	}
	return s;
}
开发者ID:coapp-packages,项目名称:windirstat,代码行数:74,代码来源:item.cpp


注:本文中的FormatBytes函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。