22using System . Collections . Generic ;
33using System . ComponentModel ;
44using System . Diagnostics . CodeAnalysis ;
5- using System . Json ;
5+ using System . Text . Json ;
66using System . Linq ;
77using System . Runtime . CompilerServices ;
88using System . Security . Authentication ;
1717using Flurl . Http ;
1818using Novus . Streams ;
1919using SmartImage . Lib . Utilities ;
20- using JsonObject = System . Json . JsonObject ;
21- using JsonValue = System . Json . JsonValue ;
2220
2321namespace SmartImage . Lib . Clients ;
2422
@@ -60,7 +58,7 @@ public HydrusClient() : this(null, null) { }
6058
6159 public bool IsValid => EndpointUrl != null && Key != null ;
6260
63- public async Task < JsonValue > GetFileHashesAsync ( string hash , string hashType = "sha256" )
61+ public async Task < JsonNode > GetFileHashesAsync ( string hash , string hashType = "sha256" )
6462 {
6563
6664 using var res = await Client . Request ( "/get_files/file_hashes" )
@@ -70,12 +68,12 @@ public async Task<JsonValue> GetFileHashesAsync(string hash, string hashType = "
7068 . GetAsync ( ) ;
7169
7270 var b = await res . GetStreamAsync ( ) ;
73- var j = JsonValue . Load ( b ) ;
71+ var j = JsonValue . Parse ( b ) ;
7472 return j ;
7573
7674 }
7775
78- public async Task < JsonValue > GetFileMetadataAsync ( HydrusQuery q )
76+ public async Task < JsonNode > GetFileMetadataAsync ( HydrusQuery q )
7977 {
8078 var ( name , value ) = q . GetValue ( ) ;
8179
@@ -84,11 +82,11 @@ public async Task<JsonValue> GetFileMetadataAsync(HydrusQuery q)
8482 . GetAsync ( ) ;
8583
8684 var b = await res . GetStreamAsync ( ) ;
87- var j = JsonValue . Load ( b ) ;
85+ var j = JsonValue . Parse ( b ) ;
8886 return j ;
8987 }
9088
91- public async Task < JsonValue > GetFileRelationshipsAsync ( HydrusQuery q )
89+ public async Task < JsonNode > GetFileRelationshipsAsync ( HydrusQuery q )
9290 {
9391 var ( name , value ) = q . GetValue ( ) ;
9492
@@ -97,7 +95,7 @@ public async Task<JsonValue> GetFileRelationshipsAsync(HydrusQuery q)
9795 . GetAsync ( ) ;
9896
9997 var b = await res . GetStreamAsync ( ) ;
100- var j = JsonValue . Load ( b ) ;
98+ var j = JsonValue . Parse ( b ) ;
10199
102100 return j ;
103101 }
@@ -309,9 +307,9 @@ public partial class HydrusFileRelationship
309307 [ JsonPropertyName ( "king_is_on_file_domain" ) ]
310308 public bool KingIsOnFileDomain { get ; set ; }
311309
312- public static Dictionary < string , HydrusFileRelationship > Deserialize ( JsonValue v )
310+ public static Dictionary < string , HydrusFileRelationship > Deserialize ( JsonNode v )
313311 {
314- var vs = ( ( JsonObject ) v ) [ "file_relationships" ] ;
312+ var vs = ( ( JsonNode ) v ) [ "file_relationships" ] ;
315313
316314 var re = JsonSerializer . Deserialize < Dictionary < string , HydrusFileRelationship > > ( vs . ToString ( ) ) ;
317315
0 commit comments