29 lines
788 B
C#
29 lines
788 B
C#
using Massmailer.Shared.Model;
|
|
using Newtonsoft.Json;
|
|
using System.IO;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Massmailer.Shared.Logic
|
|
{
|
|
public static class SmtpSettingsLogic
|
|
{
|
|
public async static void Save(SmtpSettings project, string filePath)
|
|
{
|
|
var json = JsonConvert.SerializeObject(project);
|
|
await File.WriteAllTextAsync(filePath, json);
|
|
}
|
|
|
|
public async static Task<SmtpSettings> Load(string filePath)
|
|
{
|
|
var project = new SmtpSettings();
|
|
if (File.Exists(filePath))
|
|
{
|
|
var json = await File.ReadAllTextAsync(filePath);
|
|
project = JsonConvert.DeserializeObject<SmtpSettings>(json);
|
|
}
|
|
|
|
return project;
|
|
}
|
|
}
|
|
}
|