Skip to content

Commit 086ebe7

Browse files
committed
Switch to System.Text.Json
1 parent 1bbbff8 commit 086ebe7

4 files changed

Lines changed: 13 additions & 8 deletions

File tree

dnSpy/dnSpy/Documents/Tabs/NodeTabSaver.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ You should have received a copy of the GNU General Public License
2121
using System.ComponentModel.Composition;
2222
using System.IO;
2323
using System.Linq;
24-
using System.Windows.Forms;
2524
using System.Windows.Threading;
2625
using dnSpy.Contracts.App;
2726
using dnSpy.Contracts.Decompiler;

dnSpy/dnSpy/MainApp/UpdateService.cs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ You should have received a copy of the GNU General Public License
2424
using System.Net.Http;
2525
using System.Net.Http.Headers;
2626
using System.Reflection;
27+
using System.Text.Json;
2728
using System.Threading.Tasks;
2829
using dnSpy.Contracts.Settings;
29-
using Newtonsoft.Json.Linq;
3030

3131
namespace dnSpy.MainApp {
3232
public readonly struct UpdateCheckInfo {
@@ -146,11 +146,18 @@ public async Task<UpdateCheckInfo> CheckForUpdatesAsync() {
146146
result = await client.GetStringAsync("https://api.github.com/repos/dnSpyEx/dnSpy/releases/latest");
147147
}
148148

149-
var json = JObject.Parse(result);
150-
if (!json.TryGetValue("tag_name", out var tagToken) || tagToken is not JValue tagValue || tagValue.Value is not string tagName)
149+
using var doc = JsonDocument.Parse(result);
150+
var root = doc.RootElement;
151+
if (!root.TryGetProperty("tag_name", out var tagElement) || tagElement.ValueKind != JsonValueKind.String)
151152
return null;
152-
if (!json.TryGetValue("html_url", out var urlToken) || urlToken is not JValue urlValue || urlValue.Value is not string htmlUrl)
153+
if (!root.TryGetProperty("html_url", out var urlElement) || urlElement.ValueKind != JsonValueKind.String)
153154
return null;
155+
156+
string? tagName = tagElement.GetString();
157+
string? htmlUrl = urlElement.GetString();
158+
if (tagName is null || htmlUrl is null)
159+
return null;
160+
154161
if (tagName[0] == 'v')
155162
tagName = tagName.Remove(0, 1);
156163
if (Version.TryParse(tagName, out var version)) {

dnSpy/dnSpy/app.config

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,11 @@
111111

112112
<dependentAssembly>
113113
<assemblyIdentity name="System.Collections.Immutable" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" />
114-
<bindingRedirect oldVersion="1.1.0.0-10.0.0.3" newVersion="10.0.0.3" />
114+
<bindingRedirect oldVersion="1.1.0.0-10.0.0.5" newVersion="10.0.0.5" />
115115
</dependentAssembly>
116116
<dependentAssembly>
117117
<assemblyIdentity name="System.Reflection.Metadata" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" />
118-
<bindingRedirect oldVersion="1.0.21.0-10.0.0.3" newVersion="10.0.0.3" />
118+
<bindingRedirect oldVersion="1.0.21.0-10.0.0.5" newVersion="10.0.0.5" />
119119
</dependentAssembly>
120120
<dependentAssembly>
121121
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />

dnSpy/dnSpy/dnSpy.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@
108108
<!-- Self contained .NET apps already ship with this DLL (not necessarily the same version, though) -->
109109
<PackageReference Include="Microsoft.DiaSymReader.Native" Version="$(DiaSymReaderVersion)" Condition=" '$(IsSelfContainedDotNet)' != 'true' " />
110110
<PackageReference Include="Microsoft.VisualStudio.Text.UI.Wpf" Version="$(MSVSTextVersion)" />
111-
<PackageReference Include="Newtonsoft.Json" Version="$(NewtonsoftJsonVersion)" />
112111
</ItemGroup>
113112

114113
</Project>

0 commit comments

Comments
 (0)