Support chinese variant, QQ object in launcher and some code optimizations
This commit is contained in:
@ -4,40 +4,66 @@ import argparse
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def interactive_ui(gamedir=Path.cwd()):
|
||||
raise NotImplementedError("Interactive UI is not implemented")
|
||||
class UI:
|
||||
def __init__(self, gamedir: str, noconfirm: bool) -> None:
|
||||
self._noconfirm = noconfirm
|
||||
self._gamedir = gamedir
|
||||
|
||||
def _ask(self, title, description):
|
||||
raise NotImplementedError()
|
||||
|
||||
def update_game(gamedir=Path.cwd(), noconfirm=False):
|
||||
print("Checking for current game version...")
|
||||
# Call check_game_version()
|
||||
print("Updating game...")
|
||||
# Call update_game(fromver)
|
||||
raise NotImplementedError("Update game is not implemented")
|
||||
def install_game(self):
|
||||
# TODO
|
||||
raise NotImplementedError("Install game is not implemented.")
|
||||
|
||||
def update_game(self):
|
||||
print("Checking for current game version...")
|
||||
# Call check_game_version()
|
||||
print("Updating game...")
|
||||
# Call update_game(fromver)
|
||||
raise NotImplementedError("Update game is not implemented.")
|
||||
|
||||
def interactive_ui(self):
|
||||
raise NotImplementedError()
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(prog="worthless-launcher", description="A worthless launcher written in Python.")
|
||||
parser = argparse.ArgumentParser(prog="worthless", description="A worthless launcher written in Python.")
|
||||
parser.add_argument("-D", "-d", "--dir", action="store", type=Path, default=Path.cwd(),
|
||||
help="Specify the game directory (default current working directory)")
|
||||
parser.add_argument("-I", "-i", "--install", action="store_true",
|
||||
parser.add_argument("-S", "--install", action="store_true",
|
||||
help="Install the game (if not already installed, else do nothing)")
|
||||
parser.add_argument("-U", "-u", "--update", action="store_true", help="Update the game (if not updated)")
|
||||
parser.add_argument("-U", "--install-from-file", action="store_true",
|
||||
help="Install the game from the game archive (if not already installed, \
|
||||
else update from archive)")
|
||||
parser.add_argument("-Sp", "--patch", action="store_true",
|
||||
help="Patch the game (if not already patched, else do nothing)")
|
||||
parser.add_argument("-Sy", "--update", action="store_true",
|
||||
help="Update the game and specified voiceover pack only (or install if not found)")
|
||||
parser.add_argument("-Syu", "--update", action="store_true",
|
||||
help="Update the game and all installed voiceover packs (or install if not found)")
|
||||
parser.add_argument("-Rs", "--remove", action="store_true", help="Remove the game (if installed)")
|
||||
parser.add_argument("-Rp", "--remove-patch", action="store_true", help="Revert the game patch (if patched)")
|
||||
parser.add_argument("-Rv", "--remove-voiceover", action="store_true", help="Remove a Voiceover pack (if installed)")
|
||||
parser.add_argument("--noconfirm", action="store_true",
|
||||
help="Do not ask any questions. (Ignored in interactive mode)")
|
||||
help="Do not ask any for confirmation. (Ignored in interactive mode)")
|
||||
args = parser.parse_args()
|
||||
print(args)
|
||||
interactive_mode = not args.install and not args.install_from_file and not args.patch and not args.update and not \
|
||||
args.remove and not args.remove_patch and not args.remove_voiceover
|
||||
ui = UI(args.dir, args.noconfirm)
|
||||
|
||||
if args.install and args.update:
|
||||
raise ValueError("Cannot specify both --install and --update arguments.")
|
||||
|
||||
if args.install:
|
||||
raise NotImplementedError("Install game is not implemented")
|
||||
ui.install_game()
|
||||
|
||||
if args.update:
|
||||
update_game(args.dir, args.noconfirm)
|
||||
ui.update_game()
|
||||
return
|
||||
|
||||
interactive_ui(args.dir)
|
||||
if interactive_mode:
|
||||
ui.interactive_ui()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user