EXtremeZip 2022.2.4 → 2022.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/extremeunzip.zzaqsu.rb +45 -60
- data/lib/extremezip.zzaqsv.rb +13 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8a901704ebb0119ce33eb6456905840c2b4dc6c0b5b59fef45412a1503bf71b9
|
4
|
+
data.tar.gz: 7b848ffaf0a33ae060d77f13c12f45b4c686a155d2fca7a86b69bb816d2e3dc3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 38a3aa8e8679c4d065df2b21af79c0808f69e6e7756efd4bc68cbdf35d519c5eff0219e3d2541671ff1fe69f5d1688836f27a53c00ed56ce4d417852613609d0
|
7
|
+
data.tar.gz: 90b04389278faddbc27977f5e86c8ce468ffbf85aa95177c48a6630eb29e14f3ca540850b84e4cb95617bf487a54fa5566e9e330f309132249953cae7752c12d
|
data/lib/extremeunzip.zzaqsu.rb
CHANGED
@@ -1,20 +1,47 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
# require 'pathname'
|
4
|
-
# require File.dirname(__FILE__)+'/filemessage.pb.rb'
|
5
3
|
require 'victoriafresh'
|
6
4
|
require 'cbor'
|
7
5
|
require 'lzma'
|
8
6
|
require 'get_process_mem'
|
9
7
|
|
10
8
|
def checkMemoryUsage(lineNumber)
|
11
|
-
|
9
|
+
mem = GetProcessMem.new
|
12
10
|
|
13
|
-
|
11
|
+
puts("#{lineNumber} , Memory: #{mem.mb}"); # Debug
|
14
12
|
end # def checkMemoryUsage
|
15
13
|
|
16
|
-
|
17
|
-
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
class ExtremeUnZip
|
18
|
+
# 根据偏移值来读取压缩块数据列表。
|
19
|
+
def readVfsDataList(wholeCbor)
|
20
|
+
compressedVfsDataList = [] # 获取压缩后的数据块列表
|
21
|
+
startIndix=wholeCbor['vfsDataListStart'] # 初始起始位置。
|
22
|
+
|
23
|
+
puts "whole length: #{@wholeFileContent.length}, list conent: #{wholeCbor['vfsDataList']}" # Debug
|
24
|
+
|
25
|
+
|
26
|
+
wholeCbor['vfsDataList'].each do |currentBlockInfo| # 一个个块地处理
|
27
|
+
length=currentBlockInfo['length'] # 获取长度。
|
28
|
+
|
29
|
+
currentBlock=@wholeFileContent[startIndix, length] # 读取内容
|
30
|
+
|
31
|
+
puts "start index: #{startIndix}, length: #{length}, content length: #{currentBlock.length}" # Debug
|
32
|
+
|
33
|
+
compressedVfsDataList << currentBlock # 加入当前块
|
34
|
+
|
35
|
+
startIndix+=length # 位移。
|
36
|
+
end
|
37
|
+
|
38
|
+
compressedVfsDataList # 返回 内容
|
39
|
+
end
|
40
|
+
|
41
|
+
# 根据版本号,提取VFS数据内容
|
42
|
+
|
43
|
+
|
44
|
+
def extractVfsDataWithVersionExternalFile(wholeCbor, fileVersion)
|
18
45
|
victoriaFreshData = '' # 解压后的数据块整体
|
19
46
|
dataFileName = 'victoriafreshdata.w' # 数据文件名
|
20
47
|
dataFile = {} # 数据文件对象
|
@@ -31,6 +58,10 @@ def extractVfsDataWithVersionExternalFile(wholeCbor, fileVersion)
|
|
31
58
|
dataFile.close # 关闭文件
|
32
59
|
elsif (fileVersion >= 30) # 30以上版本
|
33
60
|
compressedVfsDataList = wholeCbor['vfsDataList'] # 获取压缩后的数据块列表
|
61
|
+
|
62
|
+
if (fileVersion>=251) # 251 以上版本。要按照偏移值来读取压缩数据块列表。
|
63
|
+
compressedVfsDataList=readVfsDataList(wholeCbor) # 根据偏移值来读取压缩块数据列表。
|
64
|
+
end # if (fileVersion>=251) # 251 以上版本
|
34
65
|
|
35
66
|
puts("data block amont: #{compressedVfsDataList.length}") # Debug
|
36
67
|
|
@@ -44,18 +75,12 @@ def extractVfsDataWithVersionExternalFile(wholeCbor, fileVersion)
|
|
44
75
|
|
45
76
|
begin # 解压
|
46
77
|
currentRawData = LZMA.decompress(currentCompressed) # 解压这一块
|
47
|
-
|
48
78
|
|
49
79
|
dataFile.syswrite(currentRawData) # 写入内容
|
50
80
|
rescue RuntimeError => e # 解压失败
|
51
81
|
puts "Warning: the exz file may be incomplete." # 报告错误。文件可能不完整。
|
52
82
|
end # begin # 解压
|
53
83
|
|
54
|
-
# victoriaFreshData=victoriaFreshData+currentRawData #追加
|
55
|
-
# victoriaFreshData << currentRawData #追加
|
56
|
-
|
57
|
-
#puts("byte size: #{victoriaFreshData.bytesize}") # debug.
|
58
|
-
|
59
84
|
dataBlockCounter += 1 # count
|
60
85
|
end # compressedVfsDataList.each do |currentCompressed|
|
61
86
|
|
@@ -65,54 +90,21 @@ def extractVfsDataWithVersionExternalFile(wholeCbor, fileVersion)
|
|
65
90
|
dataFileName # 返回解压后的数据块整体
|
66
91
|
end # def extractVfsDataWithVersionExternalFile(wholeCbor, fileVersion) #根据版本号,提取VFS数据内容
|
67
92
|
|
68
|
-
|
69
|
-
victoriaFreshData = '' # 解压后的数据块整体
|
70
|
-
|
71
|
-
if (fileVersion == 14) # 14版本
|
72
|
-
compressedVfsData = wholeCbor['vfsData'] # 获取压缩后的数据内容
|
73
|
-
|
74
|
-
victoriaFreshData = LZMA.decompress(compressedVfsData) # 解压缩数据内容
|
75
|
-
elsif (fileVersion >= 30) # 30以上版本
|
76
|
-
compressedVfsDataList = wholeCbor['vfsDataList'] # 获取压缩后的数据块列表
|
77
|
-
|
78
|
-
puts("data block amont: #{compressedVfsDataList.length}") # Debug
|
79
|
-
|
80
|
-
dataBlockCounter = 0 # Data block counter
|
81
|
-
|
82
|
-
compressedVfsDataList.each do |currentCompressed| # 一块块地解压
|
83
|
-
puts("data block counter: #{dataBlockCounter}") # Debug
|
84
|
-
checkMemoryUsage(34)
|
85
|
-
|
86
|
-
currentRawData = LZMA.decompress(currentCompressed) # 解压这一块
|
87
|
-
|
88
|
-
# victoriaFreshData=victoriaFreshData+currentRawData #追加
|
89
|
-
victoriaFreshData << currentRawData # 追加
|
90
|
-
|
91
|
-
puts("byte size: #{victoriaFreshData.bytesize}") # debug.
|
92
|
-
|
93
|
-
dataBlockCounter += 1 # count
|
94
|
-
end # compressedVfsDataList.each do |currentCompressed|
|
95
|
-
end # if (fileVersion==14) #14版本
|
96
|
-
|
97
|
-
victoriaFreshData # 返回解压后的数据块整体
|
98
|
-
end # extractVfsDataWithVersion(wholeCbor, fileVersion) #根据版本号,提取VFS数据内容
|
99
|
-
|
100
|
-
class ExtremeUnZip
|
101
|
-
# 解压
|
93
|
+
# 解压
|
102
94
|
def exuz(rootPath)
|
103
95
|
result = true # 解压结果
|
104
96
|
|
105
|
-
|
97
|
+
currentBlockFile = File.new(rootPath, 'rb') # 打开文件
|
106
98
|
|
107
|
-
|
99
|
+
@wholeFileContent = currentBlockFile.read # 读取全部内容
|
108
100
|
|
109
|
-
|
101
|
+
currentBlockFile.close # 关闭文件
|
110
102
|
|
111
|
-
|
103
|
+
#@wholeFileContent = File.read(rootPath) # 最终文件内容
|
112
104
|
|
113
|
-
|
105
|
+
checkMemoryUsage(60)
|
114
106
|
|
115
|
-
|
107
|
+
wholeCborByteArray = @wholeFileContent[4..-1] # 从第5个到末尾
|
116
108
|
|
117
109
|
begin # 可能出错。
|
118
110
|
options = {:tolerant => true}
|
@@ -130,23 +122,16 @@ class ExtremeUnZip
|
|
130
122
|
checkMemoryUsage(90)
|
131
123
|
replyByteArray = LZMA.decompress(compressedVfsMenu) # 解码目录VFS字节数组内容
|
132
124
|
|
133
|
-
# puts replyByteArray #Debug
|
134
|
-
|
135
125
|
checkMemoryUsage(95)
|
136
|
-
|
126
|
+
|
137
127
|
victoriaFreshDataFile = extractVfsDataWithVersionExternalFile(wholeCbor, fileVersion) # 根据版本号,提取VFS数据内容
|
138
128
|
|
139
|
-
# puts victoriaFreshData #Debug
|
140
|
-
|
141
129
|
checkMemoryUsage(100)
|
142
130
|
$clipDownloader = VictoriaFresh.new # 创建下载器。
|
143
131
|
|
144
132
|
$clipDownloader.releaseFilesExternalDataFile(replyByteArray, victoriaFreshDataFile) # 释放各个文件
|
145
133
|
|
146
134
|
fileToRemove = File.new(victoriaFreshDataFile) # 要删除的文件
|
147
|
-
|
148
|
-
#File.delete(fileToRemove) # 删除文件
|
149
|
-
|
150
135
|
end # if (fileVersion<14) #版本号过小
|
151
136
|
|
152
137
|
result =true # 解压成功
|
data/lib/extremezip.zzaqsv.rb
CHANGED
@@ -88,7 +88,7 @@ class ExtremeZip
|
|
88
88
|
# 写入文件:
|
89
89
|
writeFile(wholeFileContent, victoriaFresh) # 写入文件内容
|
90
90
|
|
91
|
-
appendVfsDataList # 追加压缩块列表数据。
|
91
|
+
appendVfsDataList victoriaFresh # 追加压缩块列表数据。
|
92
92
|
end # def exz(rootPath)
|
93
93
|
|
94
94
|
# 写入压缩块文件
|
@@ -99,7 +99,7 @@ class ExtremeZip
|
|
99
99
|
end
|
100
100
|
|
101
101
|
# 追加压缩块列表数据。
|
102
|
-
def appendVfsDataList
|
102
|
+
def appendVfsDataList (victoriaFresh)
|
103
103
|
extremeZipOutputFile = File.new("#{victoriaFresh['name']}.exz", 'ab') # 打开文件
|
104
104
|
|
105
105
|
processCounter=0 # 块计数器。
|
@@ -107,7 +107,15 @@ class ExtremeZip
|
|
107
107
|
@wholeCbor['vfsDataList'].each do
|
108
108
|
#extremeZipOutputFile = File.new("comressed.#{processCounter}.cex", 'wb') # 创建文件
|
109
109
|
|
110
|
-
|
110
|
+
currentBlockFile = File.new("comressed.#{processCounter}.cex", 'rb') # 打开文件
|
111
|
+
|
112
|
+
wholeFileContent = currentBlockFile.read # 读取全部内容
|
113
|
+
|
114
|
+
currentBlockFile.close # 关闭文件
|
115
|
+
|
116
|
+
#wholeFileContent=File.read("comressed.#{processCounter}.cex", 'rb') # 读取压缩块。
|
117
|
+
|
118
|
+
puts "wirte file contetn length: #{wholeFileContent.length}" # Debghu
|
111
119
|
|
112
120
|
extremeZipOutputFile.syswrite(wholeFileContent) # 写入文件
|
113
121
|
|
@@ -138,6 +146,8 @@ class ExtremeZip
|
|
138
146
|
|
139
147
|
blockInfo={} # 块信息
|
140
148
|
blockInfo['length']=compressed.length # 记录长度
|
149
|
+
|
150
|
+
puts "block length: #{blockInfo['length']}" # Debug
|
141
151
|
|
142
152
|
@vfsDataList << blockInfo # 加入数据块列表中
|
143
153
|
checkMemoryUsage(150)
|
@@ -214,7 +224,6 @@ class ExtremeZip
|
|
214
224
|
|
215
225
|
currentResponsePipe.put currentCompressedVfsData # 将压缩后的数据块写入到回复管道中
|
216
226
|
|
217
|
-
checkMemoryUsage(125)
|
218
227
|
puts("finished #{Process.pid}") # Debug
|
219
228
|
end # compressInSubProcess(currentBlockData, currentResponsePipe) # 在子进程中具体执行的压缩代码
|
220
229
|
|