private void Write(AppData appData) { if (appData == null) { File.Delete(DataFileName()); return; } string data = JsonSerializer.Serialize(appData); data = EncryptAse256.EncryptString(data); File.WriteAllText(DataFileName(), data); }
private AppData Read() { try { string data = File.ReadAllText(DataFileName()); data = EncryptAse256.DecryptString(data); return(JsonSerializer.Deserialize <AppData>(data)); } catch (Exception e) { Console.WriteLine(e.Message); return(null); } }