• 大小: 96KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-05-07
  • 语言: C/C++
  • 标签: zip  unzip  CZipper  

资源简介

基于zlib1.1.4的压缩类,可以压缩和解压zip文件,vc6和vs2008编译通过。

资源截图

代码片段和文件信息

//_ **********************************************************
//_ 
//_ Name: driveinfo.cpp 
//_ Purpose: 
//_ Created: 15 September 1998 
//_ Author: D.R.Godson
//_ Modified By: 
//_ 
//_ Copyright (c) 1998 Brilliant Digital Entertainment Inc. 
//_ 
//_ **********************************************************

// CDriveInfo.cpp

#include “stdafx.h“
#include “driveinfo.h“

#include 

float CDriveInfo::GetFreeBytes(int nDrive)
{
CString sRoot;
unsigned long totalClusters freeClusters sectors bytes;
float fSpace;

ASSERT (nDrive > 0 && nDrive <= 26);

if (IsDriveAvailable(nDrive))
{
sRoot = GetRoot(nDrive);

::GetDiskFreeSpace(sRoot §ors &bytes &freeClusters &totalClusters);

// do maths like this to avoid truncation
// errors
fSpace = (float)sectors;
fSpace *= bytes;
fSpace *= freeClusters;
fSpace /= 1048576;

return fSpace;
}

return 0.0f;
}

CString CDriveInfo::GetVolume(int nDrive)
{
CString sVolume sRoot;

ASSERT (nDrive > 0 && nDrive <= 26);

if (IsDriveAvailable(nDrive))
{
sRoot = GetRoot(nDrive);

GetVolumeInformation(sRoot sVolume.GetBuffer(20) 20 NULL NULL NULL NULL 0);
sVolume.ReleaseBuffer();
FormatName(sVolume);

return sVolume;
}

return ““;
}

CString CDriveInfo::GetRoot(int nDrive)
{
CString sRoot;

sRoot = GetLetter(nDrive);
sRoot += _T(“:\\“);

return sRoot;
}

CString CDriveInfo::GetFullName(int nDrive)
{
CString sFullName sLetter sVolume;

ASSERT (nDrive > 0 && nDrive <= 26);

if (IsDriveAvailable(nDrive))
{
sLetter = GetLetter(nDrive);
sVolume = GetVolume(nDrive);

sFullName = sVolume + “ (“ + sLetter + “:)“;

return sFullName;
}

return ““;
}

float CDriveInfo::GetTotalBytes(int nDrive)
{
CString sRoot;
unsigned long totalClusters freeClusters sectors bytes;
float fSpace;

ASSERT (nDrive > 0 && nDrive <= 26);

if (IsDriveAvailable(nDrive))
{
sRoot = GetRoot(nDrive);

::GetDiskFreeSpace(sRoot §ors &bytes &freeClusters &totalClusters);

// do maths like this to avoid truncation
// errors
fSpace = (float)sectors;
fSpace *= bytes;
fSpace *= totalClusters;
fSpace /= 1048576;

return fSpace;
}

return 0.0f;
}

char CDriveInfo::GetLetter(int nDrive)
{
ASSERT (nDrive > 0 && nDrive <= 26);

return (char)(nDrive + ‘A‘ - 1);
}

int CDriveInfo::GetType(int nDrive)
{
CString sVolume;

ASSERT (nDrive > 0 && nDrive <= 26);

// shortcut to avoid floppy access
if (nDrive ==1 || nDrive == 2)
return DRIVE_REMOVABLE;

if (IsDriveAvailable(nDrive))
{
sVolume = GetVolume(nDrive);
FormatName(sVolume);

if (sVolume.Find(_T(“Host“)) >= 0)
return DRIVE_HOST;
else
return ::GetDriveType(GetRoot(nDrive));
}

return DRIVE_UNKNOWN;
}

void CDriveInfo::FormatName(CString& sFilename) 
{
CString sTemp sChar;
int nLen nChar;
char cChar cLastC

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       5148  2003-02-14 14:22  ZipTest_src\Shared\driveinfo.cpp

     文件       1164  2003-02-14 14:22  ZipTest_src\Shared\driveinfo.h

     文件       9964  2003-07-23 23:33  ZipTest_src\Shared\FILEMISC.CPP

     文件       1744  2003-02-17 13:02  ZipTest_src\Shared\FILEMISC.H

     文件       4136  2003-03-05 12:14  ZipTest_src\Shared\FolderDialog.cpp

     文件       3216  2003-03-05 12:05  ZipTest_src\Shared\FolderDialog.h

     文件       8528  2011-12-08 15:40  ZipTest_src\ZipTest\Debug\BuildLog.htm

     文件       3597  2003-06-04 16:52  ZipTest_src\ZipTest\ReadMe.txt

     文件       1078  2003-06-04 16:52  ZipTest_src\ZipTest\res\ZipTest.ico

     文件        399  2003-06-04 16:52  ZipTest_src\ZipTest\res\ZipTest.rc2

     文件       1603  2003-07-19 23:59  ZipTest_src\ZipTest\Resource.h

     文件        209  2003-06-04 16:52  ZipTest_src\ZipTest\StdAfx.cpp

     文件        999  2003-06-04 16:52  ZipTest_src\ZipTest\StdAfx.h

     文件       3902  2003-06-06 23:30  ZipTest_src\ZipTest\UnzipDlg.cpp

     文件       1509  2003-06-06 23:30  ZipTest_src\ZipTest\UnzipDlg.h

     文件       3396  2003-07-23 22:57  ZipTest_src\ZipTest\ZipDlg.cpp

     文件       1384  2003-07-19 23:58  ZipTest_src\ZipTest\ZipDlg.h

     文件       1871  2003-06-04 16:52  ZipTest_src\ZipTest\ZipTest.cpp

     文件       5611  2003-07-10 21:44  ZipTest_src\ZipTest\ZipTest.dsp

     文件        725  2003-06-04 16:53  ZipTest_src\ZipTest\ZipTest.dsw

     文件       1335  2003-06-04 16:52  ZipTest_src\ZipTest\ZipTest.h

     文件       8807  2003-07-19 23:59  ZipTest_src\ZipTest\ZipTest.rc

     文件        879  2011-12-08 15:40  ZipTest_src\ZipTest\ZipTest.sln

    ..A..H.     17920  2011-12-08 16:15  ZipTest_src\ZipTest\ZipTest.suo

     文件      11235  2011-12-08 15:40  ZipTest_src\ZipTest\ZipTest.vcproj

     文件       1409  2011-12-08 16:15  ZipTest_src\ZipTest\ZipTest.vcproj.aaa-PC.aaa.user

     文件       1769  2003-06-06 23:28  ZipTest_src\ZipTest\ZipTestDlg.cpp

     文件       1286  2003-06-06 22:30  ZipTest_src\ZipTest\ZipTestDlg.h

     文件       9753  2003-07-24 20:09  ZipTest_src\ZipUnzip\Unzipper.cpp

     文件       3052  2003-07-23 23:06  ZipTest_src\ZipUnzip\Unzipper.h

............此处省略19个文件信息

评论

共有 条评论