From 3fb965f35d2a709c2f666b35bfebe3ca6219ff22 Mon Sep 17 00:00:00 2001 From: Gokce Kantarci Date: Tue, 16 Jan 2024 15:03:54 +0300 Subject: [PATCH] [PTRun] Build fix --- .../Storage/StoragePowerToysVersionInfo.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/modules/launcher/Wox.Infrastructure/Storage/StoragePowerToysVersionInfo.cs b/src/modules/launcher/Wox.Infrastructure/Storage/StoragePowerToysVersionInfo.cs index a962bad65a..01fb509433 100644 --- a/src/modules/launcher/Wox.Infrastructure/Storage/StoragePowerToysVersionInfo.cs +++ b/src/modules/launcher/Wox.Infrastructure/Storage/StoragePowerToysVersionInfo.cs @@ -5,6 +5,7 @@ using System; using System.IO; using System.IO.Abstractions; +using System.Text.Encodings.Web; using System.Text.Json; namespace Wox.Infrastructure.Storage @@ -21,6 +22,11 @@ namespace Wox.Infrastructure.Storage private string FilePath { get; set; } = string.Empty; + private static readonly JsonSerializerOptions _serializerOptions = new JsonSerializerOptions + { + WriteIndented = true, + }; + // As of now this information is not pertinent but may be in the future // There may be cases when we want to delete only the .cache files and not the .json storage files private enum StorageType @@ -157,7 +163,7 @@ namespace Wox.Infrastructure.Storage }; // Serialize the StorageObject to a JSON string - string json = JsonSerializer.Serialize(dataToSerialize, new JsonSerializerOptions { WriteIndented = true }); + string json = JsonSerializer.Serialize(dataToSerialize, _serializerOptions); // Write the JSON string to the file File.WriteAllText(FilePath, json);