config.dart 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. class GuiConfig {
  2. GuiConfig({
  3. required this.selected,
  4. required this.updateInterval,
  5. required this.updateSubsAtStart,
  6. required this.setSystemProxy,
  7. required this.startAtLogin,
  8. required this.breakConnections,
  9. required this.language,
  10. required this.servicePort
  11. });
  12. late String selected;
  13. late int updateInterval;
  14. late bool updateSubsAtStart;
  15. late bool setSystemProxy;
  16. late bool startAtLogin;
  17. late bool breakConnections;
  18. late String language;
  19. late int servicePort;
  20. GuiConfig.fromJson(Map<String, dynamic> json) {
  21. selected = json['selected'];
  22. updateInterval = json['updateInterval'];
  23. updateSubsAtStart = json['updateSubsAtStart'];
  24. setSystemProxy = json['setSystemProxy'];
  25. startAtLogin = json['startAtLogin'];
  26. breakConnections = json['breakConnections'];
  27. language = json['language'];
  28. servicePort = json['servicePort'];
  29. }
  30. Map<String, dynamic> toJson() {
  31. final data = <String, dynamic>{};
  32. data['selected'] = selected;
  33. data['updateInterval'] = updateInterval;
  34. data['updateSubsAtStart'] = updateSubsAtStart;
  35. data['setSystemProxy'] = setSystemProxy;
  36. data['startAtLogin'] = startAtLogin;
  37. data['breakConnections'] = breakConnections;
  38. data['language'] = language;
  39. data['servicePort'] = servicePort;
  40. return data;
  41. }
  42. @override
  43. String toString() {
  44. return toJson().toString();
  45. }
  46. }
  47. class VersionConfig {
  48. late String serviceVersion;
  49. late String coreVersion;
  50. late String appVersion;
  51. VersionConfig({
  52. required this.serviceVersion,
  53. required this.coreVersion,
  54. required this.appVersion,
  55. });
  56. VersionConfig.fromJson(Map<String, dynamic> json) {
  57. serviceVersion = json['serviceVersion'];
  58. coreVersion = json['coreVersion'];
  59. appVersion = json['appVersion'];
  60. }
  61. Map<String, dynamic> toJson() {
  62. final data = <String, dynamic>{};
  63. data['serviceVersion'] = serviceVersion;
  64. data['coreVersion'] = coreVersion;
  65. data['appVersion'] = appVersion;
  66. return data;
  67. }
  68. @override
  69. String toString() {
  70. return toJson().toString();
  71. }
  72. }