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