Fix writing messages with result ids

Fixes #115
This commit is contained in:
Frank A. Krueger 2018-03-23 16:13:10 -07:00
parent 2eafc04615
commit 6c02b985bc
No known key found for this signature in database
GPG Key ID: 0471C67474FFE664
2 changed files with 7 additions and 5 deletions

View File

@ -4,7 +4,7 @@ namespace Ooui
{
class JsonConvert
{
static void WriteJsonString (System.IO.TextWriter w, string s)
public static void WriteJsonString (System.IO.TextWriter w, string s)
{
w.Write ('\"');
for (var i = 0; i < s.Length; i++) {

View File

@ -52,14 +52,16 @@ namespace Ooui
w.Write (TargetId);
w.Write ("\",\"k\":\"");
w.Write (Key);
w.Write ('\"');
if (Value != null) {
w.Write ("\",\"v\":");
w.Write (",\"v\":");
JsonConvert.WriteJsonValue (w, Value);
w.Write ('}');
}
else {
w.Write ("\"}");
if (ResultId != null) {
w.Write (",\"rid\":");
JsonConvert.WriteJsonString (w, ResultId);
}
w.Write ('}');
}
public string ToJson ()