7Zip解压支持库,
支持LZMA/BCJ*算法
创建7Zip解压对象
创建7Zip解压对象,
关闭对象
返回文件数
for path,isDir,time,size64 in sevenZipDecoder2Object.each(){
/*遍历压缩包中的所有文件或目录,
path 参数为相对路径,
isDir 参数指定当前路径是否目录,
time 参数为文件修改时间,
size64 参数为文件大小,math.size64 对象*/
}
解压文件到指定目录,
目录不存在则自动创建该目录
sevenZipDecoder2Object.extractPrepareOperation = function(askExtractMode,itemIndex,filepath,isDir){
/*准备解压时回调此函数,filepath参数为当前解压的文件路径*/
}
sevenZipDecoder2Object.extractSetCompleted = function(lowSize,hiSize,percent){
io.print("已解压",math.formatSize(lowSize,hiSize)," %" + percent )
/*解压完成时回调此函数,percent为表示解压进度的百分比数值*/
}
sevenZipDecoder2Object.extractSetOperationResult = function(opRet){
/*这里可以获取操作结果*/
if( opRet == 0/*kOK*/ ){
}
elseif( opRet == 1/*kUnSupportedMethod*/ ){
io.print("Unsupported Method")
}
elseif( opRet == 0/*kDataError*/ ){
io.print("CRC Failed")
}
elseif( opRet == 0/*kCRCError*/ ){
io.print("Data Error")
}
else {
io.print("Unknown Error")
}
}
sevenZipDecoder2Object.extractSetTotal = function(lowSize,hiSize){
var size64 = math.size64(lowBytes,hiBytes);
io.print("压缩包大小",size64.format() )
/*返回 _S_FALSE 取消解压*/
}
文件索引自1开始,返回属性布尔值
参数2使用_kpid前缀的常量表示属性索引
文件索引自1开始,返回属性数值
参数2使用_kpid前缀的常量表示属性索引
文件索引自1开始,返回文件大小
文件索引自1开始,返回属性字符串值
参数2使用_kpid前缀的常量表示属性索引
文件索引自1开始,返回属性时间值
参数2使用_kpid前缀的常量表示属性索引
打开压缩包,
成功返回true,失败返回false以及错误信息
sevenZipDecoder2Object.openSetCompleted = function(files,lowBytes,hiBytes,percent){
io.print("已打开",math.size64(lowBytes,hiBytes).format() ," %" + percent)
/*打开压缩包回调此函数,percent为表示打开进度的百分比数值*/
}
sevenZipDecoder2Object.openSetTotal = function(files,lowBytes,hiBytes){
var size64 = ..math.size64(lowBytes,hiBytes);
/*返回 _S_FALSE 取消解压*/
}
sevenZipDecoder2Object.printError = function(name,message){
/*解压时调用此函数显示错误信息*/
io.print("出错了", name,message )
}
返回解压后大小
_kpidATime=0xB
_kpidAttrib=9
_kpidBigEndian=0x2A
_kpidBit64=0x29
_kpidBlock=0x1B
_kpidCRC=0x13
_kpidCTime=0xA
_kpidCharacts=0x2F
_kpidChecksum=0x2E
_kpidClusterSize=0x1102
_kpidComment=0x1C
_kpidCommented=0xE
_kpidCpu=0x2B
_kpidCreatorApp=0x33
_kpidDictionarySize=0x12
_kpidEncrypted=0xF
_kpidError=0x37
_kpidExtension=5
_kpidFileSystem=0x18
_kpidFreeSpace=0x1101
_kpidGroup=0x1A
_kpidHandlerItemIndex=2
_kpidHeadersSize=0x2D
_kpidHostOS=0x17
_kpidId=0x31
_kpidIsAnti=0x15
_kpidIsDir=6
_kpidIsVolume=0x23
_kpidLink=0x36
_kpidLinks=0x25
_kpidLocalName=0x1200
_kpidMTime=0xC
_kpidMainSubfile=1
_kpidMethod=0x16
_kpidName=4
_kpidNumBlocks=0x26
_kpidNumSubDirs=0x1F
_kpidNumSubFiles=0x20
_kpidNumVolumes=0x27
_kpidOffset=0x24
_kpidPackSize=8
_kpidPath=3
_kpidPhySize=0x2C
_kpidPosition=0x1D
_kpidPosixAttrib=0x35
_kpidPrefix=0x1E
_kpidProvider=0x1201
_kpidSectorSize=0x34
_kpidShortName=0x32
_kpidSize=7
_kpidSolid=0xD
_kpidSplitAfter=0x11
_kpidSplitBefore=0x10
_kpidTimeType=0x28
_kpidTotalSize=0x1100
_kpidType=0x14
_kpidUnpackVer=0x21
_kpidUser=0x19
_kpidUserDefined=0x10000
_kpidVa=0x30
_kpidVolume=0x22
_kpidVolumeName=0x1103