From b2d307d34f02bd77daec5a14e14434769f47f791 Mon Sep 17 00:00:00 2001 From: Ac_K Date: Mon, 23 Mar 2020 21:58:41 +0100 Subject: [PATCH] Fix Prepo parsing reports (#1016) This fix the parsing of prepo service reports which could failed in some edge case. I've improved the parsing of the object to a JSON string too. --- Ryujinx.HLE/HOS/Services/Prepo/IPrepoService.cs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Ryujinx.HLE/HOS/Services/Prepo/IPrepoService.cs b/Ryujinx.HLE/HOS/Services/Prepo/IPrepoService.cs index e882032bd1..67344061a8 100644 --- a/Ryujinx.HLE/HOS/Services/Prepo/IPrepoService.cs +++ b/Ryujinx.HLE/HOS/Services/Prepo/IPrepoService.cs @@ -3,9 +3,9 @@ using Ryujinx.Common; using Ryujinx.Common.Logging; using Ryujinx.HLE.HOS.Services.Account.Acc; using Ryujinx.HLE.Utilities; -using System.Collections.Generic; using System.IO; using System.Text; +using Utf8Json; namespace Ryujinx.HLE.HOS.Services.Prepo { @@ -95,12 +95,11 @@ namespace Ryujinx.HLE.HOS.Services.Prepo sb.AppendLine($" Room: {room}"); - var payload = Deserialize>(buffer); + var deserializedReport = Deserialize(buffer); + string jsonReport = Encoding.ASCII.GetString(JsonSerializer.PrettyPrintByteArray(Encoding.UTF8.GetBytes(deserializedReport.ToString()))); - foreach (var field in payload) - { - sb.AppendLine($" Key: {field.Key}, Value: {field.Value}"); - } + sb.AppendLine($" Report:"); + sb.AppendLine(jsonReport); return sb.ToString(); }