-
Notifications
You must be signed in to change notification settings - Fork 3
/
_zipreport.prg
102 lines (72 loc) · 4.76 KB
/
_zipreport.prg
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
*!* _zipreport
lparameters pfile
local cl, eocd, fileheaders, lines[1], lnx, outfile
m.outfile = forceext(m.pfile, 'txt')
strtofile('', m.outfile)
m.eocd = _zipgeteocdrecord(m.pfile)
strtofile('end of central directory' + 0h0d0a, m.outfile, 1)
strtofile('--------------------------------------------------------------------------------' + 0h0d0a, m.outfile, 1)
strtofile('signature......................: ' + transform(m.eocd.signature) + 0h0d0a, m.outfile, 1)
strtofile('numberofthisdisk...............: ' + transform(m.eocd.numberofthisdisk) + 0h0d0a, m.outfile, 1)
strtofile('numberofthedisk................: ' + transform(m.eocd.numberofthedisk) + 0h0d0a, m.outfile, 1)
strtofile('totalnumberonthisdisk..........: ' + transform(m.eocd.totalnumberonthisdisk) + 0h0d0a, m.outfile, 1)
strtofile('totalnumber....................: ' + transform(m.eocd.totalnumber) + 0h0d0a, m.outfile, 1)
strtofile('sizeofthecentraldirectory......: ' + transform(m.eocd.sizeofthecentraldirectory) + 0h0d0a, m.outfile, 1)
strtofile('offsetofstartofcentraldirectory: ' + transform(m.eocd.offsetofstartofcentraldirectory) + 0h0d0a, m.outfile, 1)
strtofile('zipfilecommentlength...........: ' + transform(m.eocd.zipfilecommentlength) + 0h0d0a, m.outfile, 1)
strtofile('zipfilecomment.................: ' + transform(m.eocd.zipfilecomment) + 0h0d0a, m.outfile, 1)
strtofile('bytes..........................: ' + transform(m.eocd.bytes) + 0h0d0a, m.outfile, 1)
strtofile(0h0d0a0d0a, m.outfile, 1)
m.fileheaders = _zipgetfileheaders(m.pfile)
m.cl = ' #|signatur|' + padr('filename', 100) + '|ver1|ver2|gpbf|cmet|time|date| crc-32| compsize|uncompsize|fnlen|eflen|fclen|dsk#s|infa| extattr|lfh offset|extrafield|filecomment'
strtofile(m.cl + 0h0d0a, m.outfile, 1)
strtofile(replicate('-', len(m.cl)) + 0h0d0a, m.outfile, 1)
dimension m.lines[m.fileheaders.count]
for m.lnx = 1 to m.fileheaders.count
m.lines[m.lnx] = ;
transform(m.fileheaders.item[m.lnx].cfhsignature) + '|' + ;
_zushortenpath(m.fileheaders.item[m.lnx].cfhfilename, 100) + '|' + ;
transform(m.fileheaders.item[m.lnx].cfhversionmadeby, '99999') + '|' + ;
transform(m.fileheaders.item[m.lnx].cfhversiontoextract, '99999') + '|' + ;
transform(m.fileheaders.item[m.lnx].cfhgeneralpurposebitflag, '99999') + '|' + ;
transform(m.fileheaders.item[m.lnx].cfhcompressionmethod, '99999') + '|' + ;
transform(m.fileheaders.item[m.lnx].cfhlastmodfiletime) + '|' + ;
transform(m.fileheaders.item[m.lnx].cfhlastmodfiledate) + '|' + ;
transform(m.fileheaders.item[m.lnx].cfhcrc32, '9999999999') + '|' + ;
transform(m.fileheaders.item[m.lnx].cfhcompressedsize, '9999999999') + '|' + ;
transform(m.fileheaders.item[m.lnx].cfhuncompressedsize, '9999999999') + '|' + ;
transform(m.fileheaders.item[m.lnx].cfhfilenamelength, '99999') + '|' + ;
transform(m.fileheaders.item[m.lnx].cfhextrafieldlength, '99999') + '|' + ;
transform(m.fileheaders.item[m.lnx].cfhfilecommentlength, '99999') + '|' + ;
transform(m.fileheaders.item[m.lnx].cfhdisknumberstart, '99999') + '|' + ;
transform(m.fileheaders.item[m.lnx].cfhinternalfileattributes) + '|' + ;
transform(m.fileheaders.item[m.lnx].cfhexternalfileattributes) + '|' + ;
transform(m.fileheaders.item[m.lnx].cfhrelativeoffsetoflocalheader, '9999999999') + '|' + ;
transform(0h + m.fileheaders.item[m.lnx].cfhextrafield) + '|' + ;
transform(0h + m.fileheaders.item[m.lnx].cfhfilecomment)
endfor
asort(m.lines)
for m.lnx = 1 to m.fileheaders.count
strtofile(transform(m.lnx, '9999') + '|' + m.lines[m.lnx] + 0h0d0a, m.outfile, 1)
endfor
strtofile('--------------------------------------------------------------------------------' + 0h0d0a, m.outfile, 1)
for m.lnx = 1 to m.fileheaders.count
m.lines[m.lnx] = ;
transform(m.fileheaders.item[m.lnx].lfhsignature) + '|' + ;
padr(strextract(m.fileheaders.item[m.lnx].lfhfilename, '/'), 100) + '|' + ;
transform(m.fileheaders.item[m.lnx].lfhversiontoextract, '99999') + '|' + ;
transform(m.fileheaders.item[m.lnx].lfhgeneralpurposebitflag, '99999') + '|' + ;
transform(m.fileheaders.item[m.lnx].lfhcompressionmethod, '99999') + '|' + ;
transform(m.fileheaders.item[m.lnx].lfhlastmodfiletime) + '|' + ;
transform(m.fileheaders.item[m.lnx].lfhlastmodfiledate) + '|' + ;
transform(m.fileheaders.item[m.lnx].lfhcrc32, '9999999999') + '|' + ;
transform(m.fileheaders.item[m.lnx].lfhcompressedsize, '9999999999') + '|' + ;
transform(m.fileheaders.item[m.lnx].cfhuncompressedsize, '9999999999') + '|' + ;
transform(m.fileheaders.item[m.lnx].lfhfilenamelength, '99999') + '|' + ;
transform(m.fileheaders.item[m.lnx].lfhextrafieldlength, '99999') + '|' + ;
transform(0h + m.fileheaders.item[m.lnx].lfhextrafield) + '|'
endfor
asort(m.lines)
for m.lnx = 1 to m.fileheaders.count
strtofile(transform(m.lnx, '9999') + '|' + m.lines[m.lnx] + 0h0d0a, m.outfile, 1)
endfor