public struct Proc
{
public string Name;
public int ID;
public string? Owner;
}
....................
public static void SaveAppsList()
{
if (File.Exists(FILE_PATH)) File.Delete(FILE_PATH);
using StreamWriter writer = new(FILE_PATH);
foreach (Proc item in ListOfProcs)
writer.WriteLine($"{item.ID}^{item.Name}^{item.Owner}");
}
public static void LoadAppsList()
{
if (!File.Exists(FILE_PATH)) return;
string readText = File.ReadAllText(FILE_PATH);
if (readText.Trim() == string.Empty) return;
readText = readText.Replace("\r\n", "\n");
List<string> lines = [.. readText.Split('\n')];
foreach (string line in lines)
{
if (line.Trim() == string.Empty) continue;
string[] processInfo = line.Split('^');
Proc proc = new()
{
ID = int.Parse(processInfo[0]),
Name = processInfo[1],
Owner = processInfo[2]
};
ListOfProcs.Add(proc);
}
}