File tree Expand file tree Collapse file tree 4 files changed +56
-0
lines changed Expand file tree Collapse file tree 4 files changed +56
-0
lines changed Original file line number Diff line number Diff line change
1
+ if __name__ == "__main__" :
2
+ from UnityPy .cli import main
3
+
4
+ main ()
Original file line number Diff line number Diff line change
1
+ from argparse import ArgumentParser
2
+
3
+ from UnityPy .cli .update_tpk import update_tpk
4
+
5
+
6
+ def main ():
7
+ parser = ArgumentParser (
8
+ prog = "UnityPy" ,
9
+ description = "UnityPy cli utility" ,
10
+ )
11
+
12
+ subparsers = parser .add_subparsers (title = "utils" )
13
+
14
+ update_tpk_parser = subparsers .add_parser ("update_tpk" , help = "Updates TPK (typetree dump) file" )
15
+ update_tpk_parser .set_defaults (func = update_tpk )
16
+
17
+ args = parser .parse_args ()
18
+
19
+ if not hasattr (args , "func" ):
20
+ parser .print_help ()
21
+ return
22
+
23
+ operands = getattr (args , "operands" , [])
24
+ args .func (* operands )
25
+
26
+
27
+ if __name__ == "__main__" :
28
+ main ()
Original file line number Diff line number Diff line change
1
+ import os
2
+ from io import BytesIO
3
+ from urllib .request import urlopen
4
+ from zipfile import ZipFile
5
+
6
+ URL = "https://nightly.link/AssetRipper/Tpk/workflows/type_tree_tpk/master/uncompressed_file.zip"
7
+ RESOURCE_PATH = os .path .join (os .path .dirname (__file__ ), ".." , "resources" )
8
+
9
+
10
+ def update_tpk ():
11
+ print ("Updating TPK file..." )
12
+ print ("\t Downloading..." )
13
+ with urlopen (URL ) as response :
14
+ zip_data = response .read ()
15
+ print ("\t Extracting..." )
16
+ with ZipFile (BytesIO (zip_data )) as zip_file :
17
+ zip_file .extract ("uncompressed.tpk" , path = RESOURCE_PATH )
18
+ print ("\t Done." )
19
+
20
+
21
+ __all__ = ["update_tpk" ]
Original file line number Diff line number Diff line change @@ -54,6 +54,9 @@ dependencies = [
54
54
]
55
55
dynamic = [" version" ]
56
56
57
+ [project .scripts ]
58
+ UnityPy = " UnityPy.cli:main"
59
+
57
60
[project .optional-dependencies ]
58
61
# optional dependencies must be lowercase/normalized
59
62
ttgen = [" typetreegeneratorapi>=0.0.5" ]
You can’t perform that action at this time.
0 commit comments