File tree 2 files changed +12
-4
lines changed
2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change 1
1
using System . Security . Cryptography ;
2
2
using System . Text ;
3
+ using System . Text . Json . Serialization ;
3
4
4
5
namespace SyncCodes ;
5
6
@@ -9,7 +10,7 @@ public class FileItem
9
10
10
11
public string Hash { get ; }
11
12
12
- public bool FileLoaded { get ; set ; }
13
+ [ JsonIgnore ] public bool FileLoaded { get ; set ; }
13
14
14
15
public FileItem ( string path )
15
16
{
Original file line number Diff line number Diff line change 11
11
var builder = WebApplication . CreateBuilder ( args ) ;
12
12
var app = builder . Build ( ) ;
13
13
14
+ var jsonSerializerOptions = new JsonSerializerOptions ( )
15
+ {
16
+ PropertyNamingPolicy = JsonNamingPolicy . CamelCase ,
17
+ WriteIndented = true ,
18
+ } ;
19
+
14
20
Parser . Default . ParseArguments < CommandLineOptions > ( args )
15
21
. WithParsed ( options =>
16
22
{
@@ -121,7 +127,8 @@ void RunClient(Context context)
121
127
}
122
128
123
129
var catalog = JsonSerializer . Deserialize < List < FileItem > > (
124
- await catalogResponse . Content . ReadAsStringAsync ( )
130
+ await catalogResponse . Content . ReadAsStringAsync ( ) ,
131
+ jsonSerializerOptions
125
132
) ! ;
126
133
127
134
var localCatalog = context . GetFiles ( ) ;
@@ -142,8 +149,8 @@ await catalogResponse.Content.ReadAsStringAsync()
142
149
// .Select(c => new { Original = c.Original, Difference = c.New })
143
150
// ;
144
151
145
- app . Logger . LogInformation ( "Need to fetch: {json}" , JsonSerializer . Serialize ( needToFetch ) ) ;
146
- app . Logger . LogInformation ( "Need to delete:: {json}" , JsonSerializer . Serialize ( needToDelete ) ) ;
152
+ app . Logger . LogInformation ( "Need to fetch: {json}" , JsonSerializer . Serialize ( needToFetch , jsonSerializerOptions ) ) ;
153
+ app . Logger . LogInformation ( "Need to delete:: {json}" , JsonSerializer . Serialize ( needToDelete , jsonSerializerOptions ) ) ;
147
154
// app.Logger.LogDebug("Need to update: {json}", JsonSerializer.Serialize(needToUpdate));
148
155
} ;
149
156
timer . Start ( ) ;
You can’t perform that action at this time.
0 commit comments