mirror of
https://github.com/WerWolv/ImHex-Patterns.git
synced 2026-03-31 13:25:58 -05:00
Compare commits
2 Commits
ImHex-v1.2
...
ImHex-v1.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
87efc6cf54 | ||
|
|
5e48adcb9d |
@@ -39,15 +39,12 @@ namespace std::string {
|
||||
};
|
||||
|
||||
fn contains(str a, str b) {
|
||||
s32 a_len, b_len;
|
||||
a_len = std::string::length(a);
|
||||
b_len = std::string::length(b);
|
||||
s32 a_len = std::string::length(a);
|
||||
s32 b_len = std::string::length(b);
|
||||
|
||||
s32 i;
|
||||
while (i < a_len - b_len) {
|
||||
for (s32 i = 0, i <= (a_len - b_len), i += 1) {
|
||||
if (std::string::substr(a, i, b_len) == b)
|
||||
return true;
|
||||
i = i + 1;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
@@ -4,7 +4,7 @@ from pathlib import Path
|
||||
|
||||
def extractData(projectName, jsonData, objectName, extension):
|
||||
if objectName in jsonData:
|
||||
with open(f"./{projectName}.{extension}", "w") as output:
|
||||
with open(f"./{projectName}.{extension}", mode="w", encoding="utf-8") as output:
|
||||
output.write(jsonData[objectName])
|
||||
|
||||
def main():
|
||||
@@ -13,7 +13,7 @@ def main():
|
||||
exit(1)
|
||||
|
||||
projectPath = sys.argv[1]
|
||||
with open(projectPath, "r") as file:
|
||||
with open(projectPath, mode="r", encoding="utf-8") as file:
|
||||
jsonData = json.loads(file.read())
|
||||
|
||||
projectName = Path(projectPath).stem
|
||||
@@ -22,7 +22,7 @@ def main():
|
||||
extractData(projectName, jsonData, "pattern", "hexpat")
|
||||
|
||||
if "bookmarks" in jsonData:
|
||||
with open(f"./{projectName}.hexbm", "w") as output:
|
||||
with open(f"./{projectName}.hexbm", mode="w", encoding="utf-8") as output:
|
||||
jsonOutput = {}
|
||||
jsonOutput["bookmarks"] = jsonData["bookmarks"]
|
||||
|
||||
@@ -32,4 +32,4 @@ def main():
|
||||
print(f"Project file used file {jsonData['filePath']}")
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user