-
Notifications
You must be signed in to change notification settings - Fork 0
/
Taiko.py
61 lines (53 loc) · 1.8 KB
/
Taiko.py
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
#!/usr/bin/python3
# -*- coding:utf-8 -*-
# For Python 3.6+
from TaikoTools.consts import *
from TaikoTools import checker, packer
import fire
ERROR = "[Error]: ERROR COMMAND!"
class CLI(object):
def check(self, type = "all"):
types = [SysType, StoryType, CharaType]
if type == "all":
for t in types:
checker.dat_header_checker(t)
elif type in types: checker.dat_header_checker(type)
else: print(ERROR)
def text(self, action, type = "all"):
types = [SysType, StoryType, CharaType]
actions = ["export", "import"]
if action not in actions: print(ERROR)
elif action == "export":
if type == "all":
for t in types:
packer.unpack_dat(t)
elif type in types: packer.unpack_dat(type)
else: print(ERROR)
else:
if type == "all":
for t in types:
packer.pack_dat(t)
elif type in types: packer.pack_dat(type)
else: print(ERROR)
def img(self, action, type = "all"):
types = [SysType, StoryType]
actions = ["export", "import"]
if action not in actions: print(ERROR)
elif action == "export":
if type == "all":
for t in types:
packer.unpack_txp(t)
elif type in types: packer.unpack_txp(type)
else: print(ERROR)
else:
if type == "all":
for t in types:
packer.pack_txp(t)
elif type in types: packer.pack_txp(type)
else: print(ERROR)
def packall(self):
packer.packall()
def unpackall(self):
packer.unpackall()
if __name__ == "__main__":
fire.Fire(CLI)