DatabaseSettings.cs 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using InABox.Clients;
  5. using InABox.Configuration;
  6. using InABox.Core;
  7. namespace Comal.Classes
  8. {
  9. public enum AutoUpdateChannel
  10. {
  11. Stable,
  12. PreRelease,
  13. Unstable
  14. }
  15. public enum DatabaseType
  16. {
  17. Standalone,
  18. Networked,
  19. Local
  20. }
  21. public class DatabaseSettings : ConnectionSettings
  22. {
  23. public DatabaseSettings()
  24. {
  25. IsActive = true;
  26. DatabaseType = DatabaseType.Standalone;
  27. FileName = Path.Combine(CoreUtils.GetPath(), "prs.dbs");
  28. LocalServerName = "";
  29. URL = "http://127.0.0.1";
  30. Port = 8000;
  31. Protocol = SerializerProtocol.Rest;
  32. Provider = DatabaseProvider.SQLite;
  33. StartPanel = "";
  34. //UpdateType = AutoUpdateType.Url;
  35. //UpdateLocation = "https://prsdigital.com.au/updates/prs";
  36. //UpdateAdmin = false;
  37. //UpdateChannel = AutoUpdateChannel.Stable;
  38. Autologin = false;
  39. LoginType = LoginType.UserID;
  40. Logo = null;
  41. LibraryLocation = "";
  42. GoogleAPIKey = "";
  43. JobPrefix = "";
  44. PurchaseOrderPrefix = "";
  45. SecondaryWindows = new Dictionary<Guid, Tuple<string, string, double, double, double, double>>();
  46. ColorScheme = DefaultColorScheme; // CornflowerBlue
  47. }
  48. public bool RestartRequired(DatabaseSettings original)
  49. {
  50. bool result =
  51. (original.DatabaseType != DatabaseType)
  52. || (!String.Equals(FileName, original.FileName))
  53. || (!String.Equals(LocalServerName, original.LocalServerName))
  54. || (!String.Equals(URL, original.URL));
  55. return result;
  56. }
  57. public bool IsActive { get; set; }
  58. [Obsolete("Use DatabaseType instead")]
  59. public bool IsNetwork {
  60. get => DatabaseType == DatabaseType.Networked;
  61. set
  62. {
  63. if (value)
  64. {
  65. DatabaseType = DatabaseType.Networked;
  66. }
  67. else if(DatabaseType == DatabaseType.Networked)
  68. {
  69. DatabaseType = DatabaseType.Standalone;
  70. }
  71. }
  72. }
  73. public DatabaseType DatabaseType { get; set; }
  74. public string FileName { get; set; }
  75. public string LocalServerName { get; set; }
  76. public LoginType LoginType { get; set; }
  77. public bool Autologin { get; set; }
  78. public string StartPanel { get; set; }
  79. public DatabaseProvider Provider { get; set; }
  80. public string LibraryLocation { get; set; }
  81. //public AutoUpdateType UpdateType { get; set; }
  82. //public String UpdateLocation { get; set; }
  83. public byte[]? Logo { get; set; }
  84. public const string DefaultColorScheme = "#FF6495ED";
  85. public string ColorScheme { get; set; }
  86. //public bool UpdateAdmin { get; set; }
  87. //public AutoUpdateChannel UpdateChannel { get; set; }
  88. public string GoogleAPIKey { get; set; } // Geocoding API vandenbos.frank@gmail.com: "AIzaSyB9ZnKdEpKsbN9cm3K7rNfqeN5fIe_xlJ0";
  89. public string JobPrefix { get; set; }
  90. public string PurchaseOrderPrefix { get; set; }
  91. // Panel Class, Button Name (? this should be panel name, but grrr), left, top, width, height
  92. public Dictionary<Guid, Tuple<string, string, double, double, double, double>> SecondaryWindows { get; set; }
  93. }
  94. public enum AutoUpdateType
  95. {
  96. NotSet,
  97. Url,
  98. File
  99. }
  100. }