📄 rapi1.cpp
字号:
//
// Author: Alexander Shilonosov,
// shilo@dekart.com, Aug 2003.
//
// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND "NO WARRANTY" terms .
//
//
// CRAPI.h
//
//
//
/*
How recursion works here:
For example when you execute "copy()"
copy (call) -> enumFiles (for each file/folder call) -> doActionFile, doActionEnterFolder, doActionExitFolder
*/
/*
History:
Dec 2003
encounter an error while printing DB string-records.
Aug 2002 Year:
first release
*/
#include "Rapi1.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
//
// convert File size to "human" string (ie 1.4Mb, or 0.9Kb)
// to Bytes if size < 100
// to Kb if size > 990 bytes
// to Mb if size > 990 Kb
LPCTSTR itoaFileSize(DWORD size, LPTSTR out = NULL)
{
float sz = (float)size;
static TCHAR str[50];
LPTSTR pStr;
TCHAR postfix[5];
if (out)
pStr = out;
else
pStr = str;
_tcscpy(postfix, TEXT("bytes") );
if ( sz > 99.9) {
_tcscpy(postfix, TEXT("Kb") );
sz = sz / 1024;
if ( sz > 99.9) {
_tcscpy(postfix, TEXT("Mb") );
sz /= 1024;
if ( sz > 99.9){
_tcscpy(postfix, TEXT("Gb") );
sz = sz / 1024;
}
}
_stprintf(pStr, TEXT("%.1f %s"), sz, postfix);
} else
_stprintf(pStr, TEXT("%d bytes"), size);
return pStr;
}
CRapi::CRapi()
{
}
CRapi::~CRapi()
{
CeRapiUninit();
}
bool CRapi::Init()
{
HRESULT hRapiResult;
PrintMsg( TEXT("Connecting to Windows CE..."));
hRapiResult = CeRapiInit();
if (FAILED(hRapiResult)) {
PrintMsg( TEXT("Failed\n"));
return false;
}
_tcscpy(curr_dir, _TEXT("\\") );
m_TotalCopySize = m_TotalFiles = m_TotalFolders=0;
m_bRecursive = true; // only DIR dont need recursion
// Getting free space on Device...
if ( !CeGetStoreInformation( &m_ppc_store ) )
PrintMsg( TEXT("Erro
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -