Repository navigation
Conversation
Add IXmlSource, which M2dReader implements, and XmlDirectorySource, which reads an unpacked folder laid out like the archive. ServerTableParser takes an IXmlSource, so existing M2dReader callers compile unchanged. Bump to 2.4.42. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
Author
|
Not needed after all: the server tables will be read from the XML once with the existing parser, then live in a database. Closing. |
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.
ServerTableParsercould only read from a packedServer.m2d. This adds a two-methodIXmlSourceinterface, whichM2dReaderimplements, andXmlDirectorySource, which reads an unpacked folder laid out like the archive. A server can then parse edited XML without repacking, or serve the files from a source of its own, such as a database.Changes
Maple2.File.IO/IXmlSource.cs: new.GetString(path)andGetXmlReader(path), with archive-relative paths such astable/Server/constants.xml. These are the only two readsServerTableParsermakes.Maple2.File.IO/M2dReader.cs: implementsIXmlSourceexplicitly throughGetEntry, so its public API stays as it was.Maple2.File.IO/XmlDirectorySource.cs: new. It strips the BOM likeM2dReader.GetString, and reads into memory before creating theXmlReader, because parsers never dispose the reader. It refuses paths that resolve outside its root.Maple2.File.Parser/ServerTableParser.cs: takes anIXmlSource. Its 65xmlReader.X(xmlReader.GetEntry(path))calls becomexmlReader.X(path), and nothing else changes.new ServerTableParser(m2dReader)still compiles.Maple2.File.Parser/Maple2.File.Parser.csproj: 2.4.41 to 2.4.42.Maple2.File.Tests/XmlDirectorySourceTest.cs: new. These tests need no game data.ParseConstantsis checked against a fixture folder, along with BOM stripping, missing files, a missing root, and paths that escape the root, including a sibling folder whose name starts with the root's.Verification
XmlDirectorySourceTestandDataFreeParsingTest: 15 passed.ServerTableParserTestagainst a realServer.m2d, read throughM2dReaderas anIXmlSource: 52 passed.ServerTableMappertaking anIXmlSource.🤖 Generated with Claude Code
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.