Class: ExtremeUnZip
- Inherits:
-
Object
- Object
- ExtremeUnZip
- Defined in:
- lib/extremeunzip.zzaqsu.rb
Overview
extractVfsDataWithVersion(wholeCbor, fileVersion) #根据版本号,提取VFS数据内容
Instance Method Summary collapse
Instance Method Details
#exuz(rootPath) ⇒ Object
解压
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 |
# File 'lib/extremeunzip.zzaqsu.rb', line 102 def exuz(rootPath) result = true # 解压结果 wholeFileContent = File.read(rootPath) # 最终文件内容 checkMemoryUsage(60) puts wholeFileContent.class # debug wholeCborByteArray = wholeFileContent[4..-1] # 从第5个到末尾 # puts wholeCborByteArray #Debug. #/usr/local/share/gems/gems/EXtremeZip-2021.7.8/lib/extremeunzip.zzaqsu.rb:110:in `decode': end of buffer reached (EOFError) begin # 可能出错。 = {:tolerant => true} wholeCbor = CBOR.decode(wholeCborByteArray, ) # 解码 fileVersion = wholeCbor['version'] # 获取版本号 if (fileVersion < 14) # 版本号过小 checkMemoryUsage(85) puts 'file version too old' # 报告错误 else # 版本号够大 compressedVfsMenu = wholeCbor['vfsMenu'] # 获取压缩后的目录内容 checkMemoryUsage(90) replyByteArray = LZMA.decompress(compressedVfsMenu) # 解码目录VFS字节数组内容 # puts replyByteArray #Debug checkMemoryUsage(95) # victoriaFreshData=extractVfsDataWithVersion(wholeCbor, fileVersion) #根据版本号,提取VFS数据内容 victoriaFreshDataFile = extractVfsDataWithVersionExternalFile(wholeCbor, fileVersion) # 根据版本号,提取VFS数据内容 # puts victoriaFreshData #Debug checkMemoryUsage(100) $clipDownloader = VictoriaFresh.new # 创建下载器。 $clipDownloader.releaseFilesExternalDataFile(replyByteArray, victoriaFreshDataFile) # 释放各个文件 fileToRemove = File.new(victoriaFreshDataFile) # 要删除的文件 File.delete(fileToRemove) # 删除文件 end # if (fileVersion<14) #版本号过小 result =true # 解压成功 rescue EOFError => e # 文件内容提前到末尾。一般是压缩包文件未传输完全 。 puts "Error: the exz file may be incomplete." # 报告错误。文件可能不完整。 result = false # 失败 end #begin # 可能出错。 end |