AmmosSource
guix
Last change
on this file since f3421e6 was f3421e6, checked in by recknagel <recknagel@…>, 3 years ago |
updated sample_scripts
|
-
Property mode
set to
100644
|
File size:
646 bytes
|
Line | |
---|
1 | import os
|
---|
2 | import sys
|
---|
3 | sys.path.append('../src/')
|
---|
4 |
|
---|
5 | from ammosreader.PDW import PDW
|
---|
6 |
|
---|
7 | if __name__ == '__main__':
|
---|
8 |
|
---|
9 | if len(sys.argv) != 2:
|
---|
10 | print("Specify name of .ppdw file")
|
---|
11 | sys.exit()
|
---|
12 |
|
---|
13 | file_name = sys.argv[1]
|
---|
14 |
|
---|
15 | with open(file_name, 'rb') as f:
|
---|
16 |
|
---|
17 | while(True):
|
---|
18 | current_bytes = f.read(32)
|
---|
19 | if current_bytes == '':
|
---|
20 | print("End of file detected")
|
---|
21 | break
|
---|
22 | if len(current_bytes) != 32:
|
---|
23 | print("Can not read all 32 bytes of next PDW")
|
---|
24 | break
|
---|
25 |
|
---|
26 | current_pdw = PDW.from_bytes(current_bytes)
|
---|
27 | print(current_pdw)
|
---|
Note:
See
TracBrowser
for help on using the repository browser.