52 lines
1.6 KiB
C#
52 lines
1.6 KiB
C#
// Decompiled with JetBrains decompiler
|
|
// Type: ClientStorage
|
|
// Assembly: Raton, Version=0.4.0.0, Culture=neutral, PublicKeyToken=null
|
|
// MVID: 36C4E416-7F8D-4D23-930F-B5CCB0D810E7
|
|
// Assembly location: C:\Users\user\Desktop\v3.8.0 Deluxe Plugins (v4.0.0) cracked\Raton.exe
|
|
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Text.Json;
|
|
using WpfApp1;
|
|
|
|
#nullable disable
|
|
public static class ClientStorage
|
|
{
|
|
private static string FilePath = Path.Combine(MainWindow.appData, "clients.json");
|
|
public static List<StoredClient> Clients = new List<StoredClient>();
|
|
|
|
public static void Load()
|
|
{
|
|
if (!Directory.Exists(MainWindow.appData))
|
|
Directory.CreateDirectory(MainWindow.appData);
|
|
if (!File.Exists(ClientStorage.FilePath))
|
|
ClientStorage.Clients = new List<StoredClient>();
|
|
else
|
|
ClientStorage.Clients = JsonSerializer.Deserialize<List<StoredClient>>(File.ReadAllText(ClientStorage.FilePath)) ?? new List<StoredClient>();
|
|
}
|
|
|
|
public static void Save()
|
|
{
|
|
if (!Directory.Exists(MainWindow.appData))
|
|
Directory.CreateDirectory(MainWindow.appData);
|
|
string contents = JsonSerializer.Serialize<List<StoredClient>>(ClientStorage.Clients, new JsonSerializerOptions()
|
|
{
|
|
WriteIndented = true
|
|
});
|
|
File.WriteAllText(ClientStorage.FilePath, contents);
|
|
}
|
|
|
|
public static void Add(StoredClient client)
|
|
{
|
|
ClientStorage.Clients.Add(client);
|
|
ClientStorage.Save();
|
|
}
|
|
|
|
public static void DeleteUID(string uid)
|
|
{
|
|
ClientStorage.Clients.RemoveAll((Predicate<StoredClient>) (x => x.UID == uid));
|
|
ClientStorage.Save();
|
|
}
|
|
}
|