Newtonsoft.Json
This commit is contained in:
parent
5b9bd72308
commit
15361151d9
@ -1,5 +1,4 @@
|
|||||||
using System.Text.Json;
|
using Newtonsoft.Json;
|
||||||
using System.Text.Json.Serialization;
|
|
||||||
|
|
||||||
namespace Млаумчерб.Клиент;
|
namespace Млаумчерб.Клиент;
|
||||||
|
|
||||||
@ -25,7 +24,7 @@ public class Config
|
|||||||
}
|
}
|
||||||
|
|
||||||
string text = File.ReadAllText(FileName);
|
string text = File.ReadAllText(FileName);
|
||||||
Config? c = JsonSerializer.Deserialize<Config>(text);
|
Config? c = JsonConvert.DeserializeObject<Config>(text);
|
||||||
if (c is not null)
|
if (c is not null)
|
||||||
Instance = c;
|
Instance = c;
|
||||||
else
|
else
|
||||||
@ -41,10 +40,7 @@ public class Config
|
|||||||
public static void SaveToFile()
|
public static void SaveToFile()
|
||||||
{
|
{
|
||||||
//TODO: log
|
//TODO: log
|
||||||
var text = JsonSerializer.Serialize(Instance, new JsonSerializerOptions
|
var text = JsonConvert.SerializeObject(Instance, Formatting.Indented);
|
||||||
{
|
|
||||||
WriteIndented = true
|
|
||||||
});
|
|
||||||
File.WriteAllText(FileName, text, UTF8WithoutBom);
|
File.WriteAllText(FileName, text, UTF8WithoutBom);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -19,6 +19,7 @@
|
|||||||
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.1.3" />
|
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.1.3" />
|
||||||
<PackageReference Include="DTLib.Ben.Demystifier" Version="1.0.6" />
|
<PackageReference Include="DTLib.Ben.Demystifier" Version="1.0.6" />
|
||||||
<PackageReference Include="MessageBox.Avalonia" Version="3.1.6" />
|
<PackageReference Include="MessageBox.Avalonia" Version="3.1.6" />
|
||||||
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
0
Млаумчерб.Клиент/собрать
Normal file → Executable file
0
Млаумчерб.Клиент/собрать
Normal file → Executable file
Loading…
Reference in New Issue
Block a user