Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Properly handle tabs and newlines in node values #148

Merged
merged 7 commits into from Jun 29, 2019
Merged

Conversation

blowfishpro
Copy link
Collaborator

KSP strips them out in ConfigNode.AddValue(string, string), meaning the cache didn't break but the newlines would get removed from strings.

This fixes some that in some ConfigNode modifying code, and makes sure that the cache also handles it properly

Resolves #84

Strictly assert the structure of the node
KSP removes these automatically, so we want to avoid that by constructing the Value ourselves
Use AssertValue method
Use AssertEmpty rather than asserting count zero
KSP removes these in AddValue, we can circumvent that by constructing the Value ourselves
new AddValueSafe method to handle this

use safe ShallowCopyFrom rather than ConfigNode's CopyTo as recursion is not necessary and it handles escaped characters correctly
Explicitly escape \n and \t which the localizer unescapes when game database is initially loaded
@sarbian
Copy link
Owner

sarbian commented Jun 29, 2019

run test

@blowfishpro blowfishpro merged commit e2027f1 into dev Jun 29, 2019
@blowfishpro blowfishpro deleted the FixNewlinesInCache branch June 29, 2019 03:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants