Skip to content

Commit

Permalink
Merge branch '2.X' into adcs
Browse files Browse the repository at this point in the history
  • Loading branch information
urangel authored Dec 6, 2023
2 parents c130d1c + f87713c commit c27955e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/JsonExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Serialization;
using SharpHoundCommonLib;
using SharpHoundCommonLib.Enums;

namespace Sharphound
Expand All @@ -14,7 +13,8 @@ public class CacheContractResolver : DefaultContractResolver
private static readonly CacheContractResolver Instance = new();
public static readonly JsonSerializerSettings Settings = new()
{
ContractResolver = Instance
ContractResolver = Instance,
Converters = new List<JsonConverter> {new VersionConverter()}
};

protected override JsonProperty CreateProperty(MemberInfo member, MemberSerialization memberSerialization)
Expand Down
2 changes: 1 addition & 1 deletion src/Sharphound.cs
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ public IContext SaveCacheFile(IContext context)
// 15. Program exit started. Save the cache file
var cache = Cache.GetCacheInstance();
context.Logger.LogInformation("Saving cache with stats: {stats}", cache.GetCacheStats());
var serialized = JsonConvert.SerializeObject(cache);
var serialized = JsonConvert.SerializeObject(cache, CacheContractResolver.Settings);
using var stream =
new StreamWriter(context.GetCachePath());
stream.Write(serialized);
Expand Down

0 comments on commit c27955e

Please sign in to comment.