diff --git a/source/mkw/Patch/PatchOperation/Rename.py b/source/mkw/Patch/PatchOperation/Rename.py index aad4bfb..3aa9911 100644 --- a/source/mkw/Patch/PatchOperation/Rename.py +++ b/source/mkw/Patch/PatchOperation/Rename.py @@ -4,6 +4,7 @@ from source.mkw.Patch.PatchOperation import AbstractPatchOperation if TYPE_CHECKING: from source.mkw.Patch import Patch + from source import TemplateMultipleSafeEval class Rename(AbstractPatchOperation): @@ -13,8 +14,8 @@ class Rename(AbstractPatchOperation): type = "rename" - def __init__(self, name: str): + def __init__(self, name: "TemplateMultipleSafeEval"): self.name = name def patch(self, patch: "Patch", file_name: str, file_content: IO) -> (str, IO): - return self.name, file_content + return patch.mod_config.multiple_safe_eval(self.name)(), file_content diff --git a/source/mkw/Patch/PatchOperation/StrEditor.py b/source/mkw/Patch/PatchOperation/StrEditor.py index 4c3a8e5..897aec2 100644 --- a/source/mkw/Patch/PatchOperation/StrEditor.py +++ b/source/mkw/Patch/PatchOperation/StrEditor.py @@ -8,6 +8,7 @@ from source.wt import wstrt if TYPE_CHECKING: from source.mkw.Patch import Patch + from source import TemplateMultipleSafeEval class StrEditor(AbstractPatchOperation): @@ -17,7 +18,8 @@ class StrEditor(AbstractPatchOperation): type = "str-edit" - def __init__(self, region: int = None, https: str = None, domain: str = None, sections: list[str] = None): + def __init__(self, region: "TemplateMultipleSafeEval" = None, https: "TemplateMultipleSafeEval" = None, + domain: "TemplateMultipleSafeEval" = None, sections: list[str] = None): self.region = region self.https = https self.domain = domain @@ -37,9 +39,9 @@ class StrEditor(AbstractPatchOperation): patch_content = BytesIO( wstrt.patch_data( file_content.read(), - region=self.region, - https=self.https, - domain=self.domain, + region=patch.mod_config.multiple_safe_eval(self.region)(), + https=patch.mod_config.multiple_safe_eval(self.https)(), + domain=patch.mod_config.multiple_safe_eval(self.domain)(), sections=checked_sections ) )