Replace BTJsonIDCheck.exe with a cross-platform Python port#10829
Open
nx-thaddeusaid wants to merge 1 commit into
Open
Replace BTJsonIDCheck.exe with a cross-platform Python port#10829nx-thaddeusaid wants to merge 1 commit into
nx-thaddeusaid wants to merge 1 commit into
Conversation
The original is a 12 KB Windows-only .NET WinForms assembly built
from a source tree we do not have. UTF-16 string literals embedded in
the .exe's #US heap reveal the exact algorithm: read Description.Id,
compare to Path.GetFileNameWithoutExtension, flag mismatches. The
Python port does the same with the stdlib `json` module and runs on
Linux, macOS, and Windows.
Evidence lifted from the .exe:
- "Description" — JSON property accessed
- "Id not match file name:" — mismatch log line
- "GetFileNameWithoutExtension" — filename-stem comparison
- "Newtonsoft.Json.Linq" — JObject/JToken parser
- "BTJsonIDCheck.log" — output log filename
Full evidence + string dump in docs/reference/btjsonidcheck-evidence.md.
Running the port on this repo:
checked 33,426 JSON files
1 id-mismatch: Core/RogueBackgrounds/event with box CommanderGearEventOfficer.json
(Id='CommanderGearEventOfficer', stem='event with box CommanderGearEventOfficer')
That single mismatch is a real data bug; the original .exe would
have reported the same file on the same tree.
The .exe was GUI-only (WinForms); the Python replacement is CLI.
Redirect stdout if you want the historical BTJsonIDCheck.log format.
Member
|
I have several questions:
|
Author
|
I am a person, and I don't actually expect you to accept all of it, but I was assigned a work task to expend some credits and figured that I would send them this way I will not be offended if you refuse the code and simply delete it. What I was hoping for was that you would find utility in the exe replacement with controllable, understandable code. I've already been paid ;) do with this as you will |
Author
|
However, the documentation does say that no one understands how these exes work There is no documentation There is no source There is no replacement I offer you a replacement The company that I'm consulting for is footing the bill on this one |
Author
I just sent you a message on discord |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Documents/BTJsonIDCheck.exeis a 12 KB Windows-only .NET WinFormsassembly with no source in-tree. This PR replaces it with
tools/btjsonid_check.py, which runs the same algorithm on Linux,macOS, and Windows from source.
What the original does
Proven by the strings embedded in the .NET metadata and
#USuser-string heap (see
docs/reference/btjsonidcheck-evidence.md):GetFileNameWithoutExtension/Newtonsoft.Json.Linq— it readseach
*.JSONfile and parses it as aJObject.Description— the property accessed.Id not match file name:— the check error message.BTJsonIDCheck.log— the output log filename.Algorithm:
What the Python port does
tools/btjsonid_check.py— same algorithm on stdlibjson. Includes--countfor CI integration.Results on current
masterOne real data bug the original would flag identically.
Changes
tools/btjsonid_check.py— the port (83 lines).docs/reference/btjsonidcheck-evidence.md— full decompilation trail.Documents/BTJsonIDCheck.exe.Limitations
not reproduced — this is a deliberate CLI replacement.
validation rests on the decompiled strings rather than a byte-compare
of output files. If a Windows maintainer can run the original against
current master and post the log, that'd close the last gap.
Test plan
python3 tools/btjsonid_check.pyon a clean checkout prints theone known mismatch.
python3 tools/btjsonid_check.py --countreturns1on a cleancheckout.
.exeon Windows against master andcompare the log — expect the same single mismatch.