Big update. Replaced Newtonsoft with System.Text.Json where possible, removed Spectre, tried to suppress the pile of compiler warnings I get on the GUI project, and tried to correct an issue where sometimes the session token retrieved is not usable.

This commit is contained in:
barelyprofessional
2024-06-14 23:03:05 +08:00
parent 98f7b2b27e
commit cdad1d6549
21 changed files with 281 additions and 251 deletions

View File

@@ -6,6 +6,7 @@ using System.Linq;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text.Json;
using System.Threading.Tasks;
using Avalonia;
using Avalonia.Controls;
@@ -16,7 +17,6 @@ using Avalonia.Threading;
using HtmlAgilityPack;
using KfChatDotNetGui.Models;
using KfChatDotNetGui.ViewModels;
using Newtonsoft.Json;
using NLog;
namespace KfChatDotNetGui.Views;
@@ -54,7 +54,9 @@ public partial class RoomSettingsWindow : Window
Name = room.Name
});
}
File.WriteAllText("rooms.json", JsonConvert.SerializeObject(roomSettings, Formatting.Indented));
File.WriteAllText("rooms.json",
JsonSerializer.Serialize(roomSettings, new JsonSerializerOptions { WriteIndented = true }));
}
catch (Exception ex)
{
@@ -102,7 +104,7 @@ public partial class RoomSettingsWindow : Window
var kfDomain = "kiwifarms.net";
if (File.Exists("settings.json"))
{
var settings = JsonConvert.DeserializeObject<SettingsModel>(await File.ReadAllTextAsync("settings.json"));
var settings = JsonSerializer.Deserialize<SettingsModel>(await File.ReadAllTextAsync("settings.json"));
kfDomain = settings.WsUri.Host;
}