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

updating from string reading to byte reading #215

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions Scripts/Importer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,9 @@ private static string GetGLBJson(Stream stream, out long binChunkStart) {
// 8-[chunkLength+8] - chunkData = json data.
stream.Read(buffer, 0, 8);
uint chunkLength = System.BitConverter.ToUInt32(buffer, 0);
TextReader reader = new StreamReader(stream);
char[] jsonChars = new char[chunkLength];
reader.Read(jsonChars, 0, (int) chunkLength);
string json = new string(jsonChars);
byte[] jsonBytes = new byte[chunkLength];
stream.Read(jsonBytes, 0, (int) chunkLength);
string json = Encoding.Default.GetString(jsonBytes);

// Chunk
binChunkStart = chunkLength + 20;
Expand Down