|
5 | 5 | from modules.installer import Installer |
6 | 6 | from modules.args import ArgsUtils |
7 | 7 |
|
8 | | -# Init Arg Vars |
9 | | -uninstall = False |
10 | | -# Parse Args |
11 | | -argsutils = ArgsUtils() |
12 | | -for index, arg in enumerate(argsutils.getArgs()): |
13 | | - if arg == "uninstall": |
14 | | - uninstall = True |
15 | | - |
16 | | -# Init Steam Module |
17 | | -print("Getting Steam Info...") |
18 | | -steamutils = SteamUtils() |
19 | | -if(steamutils.gameDirectory == ""): |
20 | | - steamutils.inputPathIfEmpty() |
21 | | -print(f"Found Game Path: {steamutils.gameDirectory}") |
22 | | - |
23 | | -# Init Installer Module |
24 | | -installer = Installer(steamutils.gameDirectory) |
25 | | - |
26 | | -if (uninstall): |
| 8 | +def main(): |
| 9 | + # Init Arg Vars |
| 10 | + uninstall = False |
| 11 | + # Parse Args |
| 12 | + argsutils = ArgsUtils() |
| 13 | + for index, arg in enumerate(argsutils.getArgs()): |
| 14 | + if arg == "uninstall": |
| 15 | + uninstall = True |
| 16 | + |
| 17 | + # Init Steam Module |
| 18 | + print("Getting Steam Info...") |
| 19 | + steamutils = SteamUtils() |
27 | 20 | if(steamutils.gameDirectory == ""): |
28 | 21 | steamutils.inputPathIfEmpty() |
29 | | - installer.uninstall() |
| 22 | + print(f"Found Game Path: {steamutils.gameDirectory}") |
| 23 | + |
| 24 | + # Init Installer Module |
| 25 | + installer = Installer(steamutils.gameDirectory) |
| 26 | + |
| 27 | + if (uninstall): |
| 28 | + if(steamutils.gameDirectory == ""): |
| 29 | + steamutils.inputPathIfEmpty() |
| 30 | + installer.uninstall() |
| 31 | + |
| 32 | + # Do rest of work: |
| 33 | + else: |
| 34 | + # Init BepInEx Webpage |
| 35 | + print("\nGetting Info from BepInEx Bleeding Edge Website...") |
| 36 | + bepinutils = BepInExUtils() |
| 37 | + |
| 38 | + # Get Download URL |
| 39 | + url = bepinutils.downloadURLs[bepinutils.downloadVersions.index("353")] |
| 40 | + print(f"Found BepInExURL: {url}") |
| 41 | + |
| 42 | + # Run installer |
| 43 | + installer.install(bepinUrl=url) |
| 44 | +try: |
| 45 | + main() |
| 46 | +except Exception as e: |
| 47 | + print(f'Exception: "{e}"') |
| 48 | + input("Press any Key to Close...") |
30 | 49 |
|
31 | | -# Do rest of work: |
32 | | -else: |
33 | | - # Init BepInEx Webpage |
34 | | - print("\nGetting Info from BepInEx Bleeding Edge Website...") |
35 | | - bepinutils = BepInExUtils() |
36 | | - |
37 | | - # Get Download URL |
38 | | - url = bepinutils.downloadURLs[bepinutils.downloadVersions.index("353")] |
39 | | - print(f"Found BepInExURL: {url}") |
40 | | - |
41 | | - # Run installer |
42 | | - installer.install(bepinUrl=url) |
43 | 50 |
|
44 | 51 |
|
0 commit comments