Repository navigation
Read AppInfo entries by identifier instead of fixed positions - #46
Merged
Merged
Conversation
The UTF-16 AppInfo layout stores an entry count followed by 16-byte identifier and string pairs. The parser assumed exactly one comment and one product XML entry, so one-entry sections ran past the end and Version stayed empty when the version entry was present. Loop over the declared count, map version, notice and product XML by their stable identifiers, skip unknown entries, and fall back to the XML build_version when no version entry exists.
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.
Fixes #11
Problem
The UTF-16
AcDb:AppInfolayout stores a 32-bit entry count followed by that many entries, each a 16-byte identifier and a length-prefixed string.AppInfoParser.TryParseUnicodeassumed exactly one notice entry and one product XML entry and skipped the identifiers as checksums. Sections with one entry (notice only) ran past the end, the ANSI fallback threw, and the section was reported as truncated. Sections that did parse tookVersionfrom the XMLbuild_version, soDwgAppInfo.Versionstayed empty even when the file had a dedicated version entry.Change
1BD848F3...), notice (B8D0F025...) and product XML (E8E09651...).Versionnow comes from the version entry; the XMLbuild_versionattribute remains the fallback when the entry is absent.Tests
Verification
dotnet build DwgIO.slnx -c Release: succeeded.dotnet test DwgIO.slnx -c Release --no-buildwith the AC1024 sample folder: 80 passed, 0 skipped, 0 failed on net8.0 and net10.0.AppInfo_IdentifiesProduceragainst 668 supported drawings (AC1024/AC1027/AC1032) fromC:\Users\maxah\Downloads: passed on net8.0 and net10.0.