prvi
This commit is contained in:
54
InfosysPublisher/Classes/Settings.cs
Normal file
54
InfosysPublisher/Classes/Settings.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user