Fix \n Json decoding and allow line breaks in chat

See #281
This commit is contained in:
ORelio 2017-06-07 18:58:21 +02:00
parent dc09896959
commit 214f8a23da
2 changed files with 19 additions and 1 deletions

View file

@ -104,6 +104,24 @@ namespace MinecraftClient
data.StringValue += char.ConvertFromUtf32(int.Parse(toparse.Substring(cursorpos + 2, 4), System.Globalization.NumberStyles.HexNumber));
cursorpos += 6; continue;
}
else if (toparse[cursorpos + 1] == 'n')
{
data.StringValue += '\n';
cursorpos += 2;
continue;
}
else if (toparse[cursorpos + 1] == 'r')
{
data.StringValue += '\r';
cursorpos += 2;
continue;
}
else if (toparse[cursorpos + 1] == 't')
{
data.StringValue += '\t';
cursorpos += 2;
continue;
}
else cursorpos++; //Normal character escapement \"
}
catch (IndexOutOfRangeException) { cursorpos++; } // \u01<end of string>