This repository has been archived on 2025-04-28. You can view files and clone it, but cannot push or open issues or pull requests.
Files
Blue-Archive---Asset-Downlo…/lib/TableService.py
2021-11-11 23:18:34 +01:00

21 lines
651 B
Python

# from _typeshed import StrPath
from io import BytesIO
from typing import IO
from zipfile import ZipFile
import os
from .XXHashService import CalculateHash
from typing import Union
class TableZipFile(ZipFile):
def __init__(self, file: Union[str, BytesIO], name: str = None) -> None:
super().__init__(file)
self.password = str(
CalculateHash(name if not isinstance(file, str) else os.path.basename(file))
).encode()
def open(self, name: str, mode: str = "r", force_zip64=False):
return super(self.__class__, self).open(
name, mode, pwd=self.password, force_zip64=force_zip64
)