Replacement for JDIS Importer
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

78 wiersze
2.7 KiB

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Threading.Tasks;
  5. using System.IO;
  6. using Newtonsoft.Json;
  7. namespace jdis_import
  8. {
  9. public class JSONMethods
  10. {
  11. public static JSONSetting GetSettings()
  12. {
  13. JSONSetting settings = new JSONSetting();
  14. string abPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Settings.json");
  15. Console.WriteLine(abPath);
  16. string text = File.ReadAllText(abPath);
  17. settings = JsonConvert.DeserializeObject<JSONSetting>(text);
  18. return settings;
  19. }
  20. }
  21. [JsonObject(MemberSerialization.OptIn)]
  22. public class JSONSetting
  23. {
  24. private bool _local = true;
  25. [JsonProperty(PropertyName = "Remote")]
  26. public bool Remote { get; set; }
  27. [JsonProperty(PropertyName = "LogFile")]
  28. public string LogFile { get; set; }
  29. [JsonProperty(PropertyName = "OSs")]
  30. public List<OS> OSs { get; set; }
  31. [JsonProperty(PropertyName = "Email")]
  32. public Email Email { get; set; }
  33. public bool Local { get { return _local; } set { _local = value; } }
  34. [JsonProperty(PropertyName = "Prelub")]
  35. public Prelub Prelub { get; set; }
  36. }
  37. [JsonObject(MemberSerialization.OptIn)]
  38. public class OS
  39. {
  40. [JsonProperty(PropertyName = "Name")]
  41. public string Name { get; set; }
  42. [JsonProperty(PropertyName = "Fail")]
  43. public string Fail { get; set; }
  44. [JsonProperty(PropertyName = "Success")]
  45. public string Success { get; set; }
  46. [JsonProperty(PropertyName = "Log")]
  47. public string Log { get; set; }
  48. [JsonProperty(PropertyName = "Temp")]
  49. public string Temp { get; set; }
  50. }
  51. [JsonObject(MemberSerialization.OptIn)]
  52. public class Email
  53. {
  54. [JsonProperty(PropertyName = "Username")]
  55. public string Username { get; set; }
  56. [JsonProperty(PropertyName = "Password")]
  57. public string Password { get; set; }
  58. [JsonProperty(PropertyName = "Mailbox")]
  59. public int Mailbox { get; set; }
  60. [JsonProperty(PropertyName = "Url")]
  61. public string Url { get; set; }
  62. [JsonProperty(PropertyName = "Filter")]
  63. public string Filter { get; set; }
  64. }
  65. [JsonObject(MemberSerialization.OptIn)]
  66. public class Prelub
  67. {
  68. [JsonProperty(PropertyName = "Check")]
  69. public string Check { get; set; }
  70. [JsonProperty(PropertyName = "LocalService")]
  71. public string LocalService { get; set; }
  72. [JsonProperty(PropertyName = "RemoteService")]
  73. public string RemoteService { get; set; }
  74. public string ActiveService { get; set; }
  75. }
  76. }