DatabaseSettings.cs 3.6 KB

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