Skip to content

Commit be8519a

Browse files
Use newtonsoft instead of System.Text.Json
1 parent 1499c84 commit be8519a

File tree

4 files changed

+7
-17
lines changed

4 files changed

+7
-17
lines changed

SabreTools.Serialization/Models/VDF/File.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
#if NET6_0_OR_GREATER
2-
using System.Text.Json.Nodes;
1+
using Newtonsoft.Json.Linq;
32

43
namespace SabreTools.Data.Models.VDF
54
{
@@ -18,7 +17,6 @@ public class File
1817
/// <summary>
1918
/// A JSON Object representing the VDF structure.
2019
/// </summary>
21-
public JsonObject? VDFObject { get; set; }
20+
public JObject? VDFObject { get; set; }
2221
}
2322
}
24-
#endif

SabreTools.Serialization/Readers/SkuSis.cs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
#if NET6_0_OR_GREATER
21
using System;
32
using System.IO;
43
using SabreTools.IO.Extensions;
54
using File = SabreTools.Data.Models.VDF.File;
65
using static SabreTools.Data.Models.VDF.Constants;
76
using System.Text;
8-
using System.Text.Json;
9-
using System.Text.Json.Nodes;
7+
using Newtonsoft.Json.Linq;
108

119
namespace SabreTools.Serialization.Readers
1210
{
@@ -96,11 +94,9 @@ public class SkuSis : BaseBinaryReader<File>
9694
}
9795

9896
json += "\n}";
99-
var options = new JsonDocumentOptions { AllowTrailingCommas = true};
100-
obj.VDFObject = JsonNode.Parse(json, null, options)?.AsObject();
97+
obj.VDFObject = JObject.Parse(json);
10198

10299
return obj;
103100
}
104101
}
105102
}
106-
#endif

SabreTools.Serialization/WrapperFactory.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,7 @@ public static class WrapperFactory
5353
WrapperType.SecuROMDFA => SecuROMDFA.Create(data),
5454
WrapperType.SevenZip => SevenZip.Create(data),
5555
WrapperType.Skeleton => Skeleton.Create(data),
56-
#if NET6_0_OR_GREATER
5756
WrapperType.SkuSis => SkuSis.Create(data),
58-
#endif
5957
WrapperType.SFFS => SFFS.Create(data),
6058
WrapperType.SGA => SGA.Create(data),
6159
WrapperType.TapeArchive => TapeArchive.Create(data),

SabreTools.Serialization/Wrappers/SkuSis.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
#if NET6_0_OR_GREATER
21
using System.IO;
3-
using System.Text.Json.Nodes;
2+
using Newtonsoft.Json.Linq;
43

54
namespace SabreTools.Serialization.Wrappers
65
{
@@ -19,7 +18,7 @@ public partial class SkuSis : WrapperBase<Data.Models.VDF.File>
1918
public byte[]? Signature => Model.Signature;
2019

2120
/// <inheritdoc cref="Models.VDF.File.VDFObject"/>
22-
public JsonObject? VDFObject => Model.VDFObject;
21+
public JObject? VDFObject => Model.VDFObject;
2322

2423
#endregion
2524

@@ -97,5 +96,4 @@ public SkuSis(Data.Models.VDF.File model, Stream data, long offset, long length)
9796

9897
#endregion
9998
}
100-
}
101-
#endif
99+
}

0 commit comments

Comments
 (0)