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
|
import
sqlite3
import
struct
cx_m
=
sqlite3.connect(
"F:\\zy\\map\\map_v2.db"
)
cu_m
=
cx_m.cursor()
BS
=
256
*
1024
*
1024
bs
=
256
*
1024
sDisk
=
[]
sDisk.append("")
sDisk.append("")
sDisk.append("")
sDisk.append("")
sDisk.append([
"h:\mdisk4.img"
,
0
])
sDisk.append([
"g:\mdisk5.img"
,
0
])
sDisk.append([
"i:\mdisk6.img"
,
0
])
sDisk.append([
"d:\mdisk7.img"
,
0
])
sDisk.append([
"e:\mdisk8.img"
,
0
])
sDisk.append([
"f:\mdisk9.img"
,
0
])
for
disk
in
sDisk[
4
:
10
]:
disk[
1
]
=
open
(disk[
0
],
'rb'
)
tlist
=
list
()
curNo,curDid,curBS
=
0
,
4
,
800
tlist.append([curNo,curDid,curBS])
pEnd
=
0
while
True
:
pos
=
curBS
*
BS
+
512
*
1024
f
=
sDisk[curDid][
1
]
f.seek(pos)
d
=
f.read(bs)
v
=
struct.unpack_from(
"Q"
,d,bs
-
8
-
pEnd
*
8
)[
0
]
if
v
=
=
0
:
break
if
curBS
=
=
13333
or
curBS
=
=
21088
:
vj
=
160
elif
curBS
=
=
22588
or
(curBS
=
=
3861
and
curDid
=
=
7
):
vj
=
1600
elif
curBS
=
=
26044
:
v
=
39160914945
elif
curBS
=
=
6834
and
curDid
=
=
8
:
v
=
55357308929
elif
curBS
=
=
6866
and
curDid
=
=
8
:
v
=
55407631873
elif
curBS
=
=
10472
and
curDid
=
=
9
:
v
=
54081059329
else
:
vj
=
16
v1
=
v
-
vj
*
512
v2
=
v
+
vj
*
512
#print("v1,v2:",v1,v2)
cu_m.execute(r
"select * from map_info where v_num > %d and v_num < %d and MAP_ITEM_POS < 5"
%
(v1,v2))
rows
=
cu_m.fetchall()
isbreak
=
False
if
len
(rows)
=
=
0
:
if
pEnd <
7
:
pEnd
+
=
1
continue
;
else
:
print
(
"len is 0:CurDid,CurBS is break"
, curDid, curBS)
#print(tlist)
pEnd
=
0
break
;
elif
len
(rows) >
1
:
t1,t2
=
rows[
0
][
0
],rows[
0
][
1
]
#print("t1,t2 is",t1,t2)
for
row1
in
rows:
if
t1 !
=
row1[
0
]
or
t2 !
=
row1[
1
]:
print
(
"len >1,t1,t2,row[0],row[1] is"
,t1,t2,row1[
0
],row1[
1
])
isbreak
=
True
break
;
if
isbreak:
print
(
"CurDid,CurBS is break"
, curDid, curBS)
# print(tlist)
break
;
else
:
pEnd
=
0
curNo
+
=
1
curDid
=
rows[
0
][
0
]
curBS
=
rows[
0
][
1
]
#if curDid== 9 and curBS== 7471:
# break
tlist.append([curNo,curDid,curBS])
# if curBS == 18511 and curDid == 8:
# break
print
(
"the list num is"
,
len
(tlist))
print
(tlist)
f1
=
open
(
"f:\\zy\\8gLIST.TXT"
,
'w+'
)
for
i
in
tlist:
f1.write(
"%d\t%d\t%d\n"
%
(i[
0
],i[
1
],i[
2
]))
|
本文转自 张宇 51CTO博客,原文链接:http://blog.51cto.com/zhangyu/1955844,如需转载请自行联系原作者