Newtonsoft.Json

This commit is contained in:
Timerix 2024-09-01 00:30:50 +05:00
parent 5b9bd72308
commit 15361151d9
3 changed files with 4 additions and 7 deletions

View File

@ -1,5 +1,4 @@
using System.Text.Json;
using System.Text.Json.Serialization;
using Newtonsoft.Json;
namespace Млаумчерб.Клиент;
@ -25,7 +24,7 @@ public class Config
}
string text = File.ReadAllText(FileName);
Config? c = JsonSerializer.Deserialize<Config>(text);
Config? c = JsonConvert.DeserializeObject<Config>(text);
if (c is not null)
Instance = c;
else
@ -41,10 +40,7 @@ public class Config
public static void SaveToFile()
{
//TODO: log
var text = JsonSerializer.Serialize(Instance, new JsonSerializerOptions
{
WriteIndented = true
});
var text = JsonConvert.SerializeObject(Instance, Formatting.Indented);
File.WriteAllText(FileName, text, UTF8WithoutBom);
}
}

View File

@ -19,6 +19,7 @@
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.1.3" />
<PackageReference Include="DTLib.Ben.Demystifier" Version="1.0.6" />
<PackageReference Include="MessageBox.Avalonia" Version="3.1.6" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>
<ItemGroup>

0
Млаумчерб.Клиент/собрать Normal file → Executable file
View File