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 class JsonConvert
{ {
static void WriteJsonString (System.IO.TextWriter w, string s) public static void WriteJsonString (System.IO.TextWriter w, string s)
{ {
w.Write ('\"'); w.Write ('\"');
for (var i = 0; i < s.Length; i++) { for (var i = 0; i < s.Length; i++) {

View File

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