This commit is contained in:
David Štaleker
2023-07-18 11:30:02 +02:00
parent a816459e5b
commit edab522e0e
12 changed files with 821 additions and 0 deletions

View File

@@ -0,0 +1,54 @@
using Newtonsoft.Json;
using ResevalnaScanner.Classes;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace InfosysPublisher.Classes
{
internal class Settings
{
public class Application
{
//SQL strežniki
//Privatna polja
[JsonProperty] private string _sftpUsername;
[JsonProperty] private string _sftpPassword;
//Javna polja
public string SftpServerAddress { get; set; }
public int SftpPort { get; set; }
public int BuildSeconds { get; set; }
public string LastFolder { get; set; }
[JsonIgnore]
public string SftpUsername
{
get => _sftpUsername.AesDecrypt();
set => _sftpUsername = value.AesEncrypt();
}
[JsonIgnore]
public string SftpPassword
{
get => _sftpPassword.AesDecrypt();
set => _sftpPassword = value.AesEncrypt();
}
public void Save(string iPath)
{
var json = JsonConvert.SerializeObject(this);
if (!Directory.Exists(Path.GetDirectoryName(iPath)))
{
Directory.CreateDirectory(Path.GetDirectoryName(iPath));
}
File.WriteAllText(iPath, json);
}
}
}
}