Revert "Use source generated json serializers in order to improve code trimming (#4094)" (#4576)

This reverts commit 4ce4299ca2.
This commit is contained in:
gdkchan 2023-03-21 20:14:46 -03:00 committed by GitHub
parent 4ce4299ca2
commit ba95ee54ab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
73 changed files with 608 additions and 886 deletions

View file

@ -7,13 +7,15 @@ using LibHac.Tools.Fs;
using LibHac.Tools.FsSystem;
using LibHac.Tools.FsSystem.NcaUtils;
using Ryujinx.Common.Configuration;
using Ryujinx.Common.Utilities;
using Ryujinx.HLE.FileSystem;
using Ryujinx.Ui.Widgets;
using System;
using System.Collections.Generic;
using System.IO;
using GUI = Gtk.Builder.ObjectAttribute;
using System.Text;
using GUI = Gtk.Builder.ObjectAttribute;
using JsonHelper = Ryujinx.Common.Utilities.JsonHelper;
namespace Ryujinx.Ui.Windows
{
@ -24,8 +26,6 @@ namespace Ryujinx.Ui.Windows
private readonly string _dlcJsonPath;
private readonly List<DownloadableContentContainer> _dlcContainerList;
private static readonly DownloadableContentJsonSerializerContext SerializerContext = new(JsonHelper.GetDefaultSerializerOptions());
#pragma warning disable CS0649, IDE0044
[GUI] Label _baseTitleInfoLabel;
[GUI] TreeView _dlcTreeView;
@ -45,7 +45,7 @@ namespace Ryujinx.Ui.Windows
try
{
_dlcContainerList = JsonHelper.DeserializeFromFile(_dlcJsonPath, SerializerContext.ListDownloadableContentContainer);
_dlcContainerList = JsonHelper.DeserializeFromFile<List<DownloadableContentContainer>>(_dlcJsonPath);
}
catch
{
@ -260,7 +260,10 @@ namespace Ryujinx.Ui.Windows
while (_dlcTreeView.Model.IterNext(ref parentIter));
}
JsonHelper.SerializeToFile(_dlcJsonPath, _dlcContainerList, SerializerContext.ListDownloadableContentContainer);
using (FileStream dlcJsonStream = File.Create(_dlcJsonPath, 4096, FileOptions.WriteThrough))
{
dlcJsonStream.Write(Encoding.UTF8.GetBytes(JsonHelper.Serialize(_dlcContainerList, true)));
}
Dispose();
}