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

VdfConvert deserializing comments somehow #38

Open
Redplcs opened this issue Jan 7, 2024 · 2 comments
Open

VdfConvert deserializing comments somehow #38

Redplcs opened this issue Jan 7, 2024 · 2 comments

Comments

@Redplcs
Copy link

Redplcs commented Jan 7, 2024

I've tried to deserialize file that contains some comments starts with "\" and I got some weird results. When I enumerate VToken through foreach, it sends me VValue struct with comment itself. Please fix.

VProperty subtitles = VdfConvert.Deserialize(reader: new StreamReader(subtitlesTextStream, leaveOpen: true));
VToken subtitlesTokens = subtitles.Value["Tokens"] ?? throw new InvalidDataException("Cannot find 'Tokens' property.");

foreach (VToken token in subtitlesTokens)
{
    // subtitlesTokens could send me VValue comment. why??
    if (token is VProperty property)
    {
        string key = property.Key;
        string value = property.Value.ToString();

        tokens.Add(new KeyValuePair<string, string>(key, value));
    }
}
@shravan2x
Copy link
Owner

@Redpoll2 Could you share the original VDF file so I can test with it? If you prefer, feel free to email me using the address on my profile

@Redplcs
Copy link
Author

Redplcs commented Jan 10, 2024

@shravan2x Sorry for late response. The comment on the 614 line

subtitles_english.txt

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

No branches or pull requests

2 participants