2022-07-11 04:32:42 +12:00
|
|
|
from dataclasses import dataclass
|
2022-07-24 10:06:35 +12:00
|
|
|
from typing import Callable, List, Optional
|
2022-07-27 03:45:27 +12:00
|
|
|
from typing_extensions import Protocol
|
2022-07-11 04:32:42 +12:00
|
|
|
|
2022-07-27 03:45:27 +12:00
|
|
|
from .api_monkeys import LgndrIndirectStatus
|
2022-07-11 22:22:17 +12:00
|
|
|
|
2022-07-12 05:11:34 +12:00
|
|
|
"""
|
2022-07-11 04:32:42 +12:00
|
|
|
@dataclass(kw_only=True)
|
|
|
|
class LgndrCommonArgs:
|
|
|
|
# keep this here for future reference
|
|
|
|
# when we move to 3.10 we can use 'kw_only' to do dataclass inheritance
|
|
|
|
app_name: str
|
|
|
|
platform: str = "Windows"
|
|
|
|
yes: bool = False
|
2022-07-12 05:11:34 +12:00
|
|
|
"""
|
2022-07-11 04:32:42 +12:00
|
|
|
|
|
|
|
|
2022-07-27 03:45:27 +12:00
|
|
|
class _GetBooleanChoiceP(Protocol):
|
|
|
|
def __call__(self, prompt: str, default: bool = ...) -> bool:
|
|
|
|
...
|
|
|
|
|
|
|
|
|
|
|
|
def _get_boolean_choice(prompt: str, default: bool = True) -> bool:
|
|
|
|
return default
|
|
|
|
|
|
|
|
|
|
|
|
def _verify_stdout(a0: int, a1: int, a2: float, a3: float) -> None:
|
|
|
|
print(f"Verification progress: {a0}/{a1} ({a2:.01f}%) [{a3:.1f} MiB/s]\t\r")
|
|
|
|
|
|
|
|
|
2022-07-11 04:32:42 +12:00
|
|
|
@dataclass
|
|
|
|
class LgndrImportGameArgs:
|
|
|
|
app_path: str
|
|
|
|
app_name: str
|
|
|
|
platform: str = "Windows"
|
|
|
|
disable_check: bool = False
|
|
|
|
skip_dlcs: bool = False
|
|
|
|
with_dlcs: bool = False
|
|
|
|
yes: bool = False
|
2022-07-11 22:22:17 +12:00
|
|
|
# Rare: Extra arguments
|
2022-07-24 10:06:35 +12:00
|
|
|
indirect_status: LgndrIndirectStatus = LgndrIndirectStatus()
|
2022-07-27 03:45:27 +12:00
|
|
|
get_boolean_choice: _GetBooleanChoiceP = _get_boolean_choice
|
2022-07-16 06:00:52 +12:00
|
|
|
|
|
|
|
|
|
|
|
@dataclass
|
|
|
|
class LgndrUninstallGameArgs:
|
|
|
|
app_name: str
|
|
|
|
keep_files: bool = False
|
|
|
|
yes: bool = False
|
|
|
|
# Rare: Extra arguments
|
2022-07-24 10:06:35 +12:00
|
|
|
indirect_status: LgndrIndirectStatus = LgndrIndirectStatus()
|
2022-07-27 03:45:27 +12:00
|
|
|
get_boolean_choice: _GetBooleanChoiceP = _get_boolean_choice
|
2022-07-11 04:32:42 +12:00
|
|
|
|
|
|
|
|
|
|
|
@dataclass
|
|
|
|
class LgndrVerifyGameArgs:
|
|
|
|
app_name: str
|
2022-07-11 07:23:53 +12:00
|
|
|
# Rare: Extra arguments
|
2022-07-24 10:06:35 +12:00
|
|
|
indirect_status: LgndrIndirectStatus = LgndrIndirectStatus()
|
2022-07-27 03:45:27 +12:00
|
|
|
verify_stdout: Callable[[int, int, float, float], None] = _verify_stdout
|
2022-07-11 04:32:42 +12:00
|
|
|
|
|
|
|
|
|
|
|
@dataclass
|
|
|
|
class LgndrInstallGameArgs:
|
|
|
|
app_name: str
|
|
|
|
base_path: str = ""
|
|
|
|
shared_memory: int = 0
|
|
|
|
max_workers: int = 0
|
|
|
|
force: bool = False
|
|
|
|
disable_patching: bool = False
|
|
|
|
game_folder: str = ""
|
|
|
|
override_manifest: str = ""
|
|
|
|
override_old_manifest: str = ""
|
|
|
|
override_base_url: str = ""
|
|
|
|
platform: str = "Windows"
|
|
|
|
file_prefix: List = None
|
|
|
|
file_exclude_prefix: List = None
|
2022-07-24 10:06:35 +12:00
|
|
|
install_tag: Optional[List[str]] = None
|
2022-07-11 04:32:42 +12:00
|
|
|
order_opt: bool = False
|
|
|
|
dl_timeout: int = 10
|
|
|
|
repair_mode: bool = False
|
|
|
|
repair_and_update: bool = False
|
|
|
|
disable_delta: bool = False
|
|
|
|
override_delta_manifest: str = ""
|
|
|
|
egl_guid: str = ""
|
|
|
|
preferred_cdn: str = None
|
|
|
|
no_install: bool = False
|
|
|
|
ignore_space: bool = False
|
|
|
|
disable_sdl: bool = False
|
|
|
|
reset_sdl: bool = False
|
|
|
|
skip_sdl: bool = False
|
|
|
|
disable_https: bool = False
|
|
|
|
yes: bool = True
|
2022-07-11 07:23:53 +12:00
|
|
|
# Rare: Extra arguments
|
2022-07-24 10:06:35 +12:00
|
|
|
indirect_status: LgndrIndirectStatus = LgndrIndirectStatus()
|
2022-07-27 03:45:27 +12:00
|
|
|
get_boolean_choice: _GetBooleanChoiceP = _get_boolean_choice
|
|
|
|
sdl_prompt: Callable[[str, str], List[str]] = lambda app_name, title: [""]
|
|
|
|
verify_stdout: Callable[[int, int, float, float], None] = _verify_stdout
|
|
|
|
|
|
|
|
# def __post_init__(self):
|
|
|
|
# if self.sdl_prompt is None:
|
|
|
|
# self.sdl_prompt: Callable[[str, str], list] = \
|
|
|
|
# lambda app_name, title: self.install_tag if self.install_tag is not None else [""]
|