MCPcopy Create free account
hub / github.com/HexHive/NASS / __create_or_edit_structure

Method __create_or_edit_structure

tools/gef.py:5538–5548  ·  view source on GitHub ↗
(self, mod_name: str, struct_name: str)

Source from the content-addressed store, hash-verified

5536 return
5537
5538 def __create_or_edit_structure(self, mod_name: str, struct_name: str) -> int:
5539 path = pathlib.Path(gef.config["pcustom.struct_path"]).expanduser() / f"{mod_name}.py"
5540 if path.is_file():
5541 info(f"Editing '{path}'")
5542 else:
5543 ok(f"Creating '{path}' from template")
5544 self.__create_template(struct_name, path)
5545
5546 cmd = (os.getenv("EDITOR") or "nano").split()
5547 cmd.append(str(path.absolute()))
5548 return subprocess.call(cmd)
5549
5550 def __create_template(self, structname: str, fpath: pathlib.Path) -> None:
5551 template = f"""from ctypes import *

Callers 1

do_invokeMethod · 0.95

Calls 4

__create_templateMethod · 0.95
infoFunction · 0.85
okFunction · 0.70
callMethod · 0.45

Tested by

no test coverage detected