using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using System.IO; using Newtonsoft.Json; namespace jdis_import { public class JSONMethods { public static JSONSetting GetSettings() { JSONSetting settings = new JSONSetting(); string abPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Settings.json"); Console.WriteLine(abPath); string text = File.ReadAllText(abPath); settings = JsonConvert.DeserializeObject(text); return settings; } } [JsonObject(MemberSerialization.OptIn)] public class JSONSetting { private bool _local = true; [JsonProperty(PropertyName = "Remote")] public bool Remote { get; set; } [JsonProperty(PropertyName = "LogFile")] public string LogFile { get; set; } [JsonProperty(PropertyName = "OSs")] public List OSs { get; set; } [JsonProperty(PropertyName = "Email")] public Email Email { get; set; } public bool Local { get { return _local; } set { _local = value; } } [JsonProperty(PropertyName = "Prelub")] public Prelub Prelub { get; set; } } [JsonObject(MemberSerialization.OptIn)] public class OS { [JsonProperty(PropertyName = "Name")] public string Name { get; set; } [JsonProperty(PropertyName = "Fail")] public string Fail { get; set; } [JsonProperty(PropertyName = "Success")] public string Success { get; set; } [JsonProperty(PropertyName = "Log")] public string Log { get; set; } [JsonProperty(PropertyName = "Temp")] public string Temp { get; set; } } [JsonObject(MemberSerialization.OptIn)] public class Email { [JsonProperty(PropertyName = "Username")] public string Username { get; set; } [JsonProperty(PropertyName = "Password")] public string Password { get; set; } [JsonProperty(PropertyName = "Mailbox")] public int Mailbox { get; set; } [JsonProperty(PropertyName = "Url")] public string Url { get; set; } [JsonProperty(PropertyName = "Filter")] public string Filter { get; set; } } [JsonObject(MemberSerialization.OptIn)] public class Prelub { [JsonProperty(PropertyName = "Check")] public string Check { get; set; } [JsonProperty(PropertyName = "LocalService")] public string LocalService { get; set; } [JsonProperty(PropertyName = "RemoteService")] public string RemoteService { get; set; } public string ActiveService { get; set; } } }