using System; using System.Collections.Generic; using System.IO; using System.Net; using InABox.Clients; using InABox.Configuration; using InABox.Core; namespace Comal.Classes { public enum AutoUpdateChannel { Stable, PreRelease, Unstable } public enum DatabaseType { Standalone, Networked, Local, RPC } public class DatabaseSettings : ILocalConfigurationSettings { public DatabaseSettings() { IsActive = true; DatabaseType = DatabaseType.Networked; // If DatabaseType == Standalone FileName = Path.Combine(CoreUtils.GetPath(), "prs.dbs"); Provider = DatabaseProvider.SQLite; // If DatabaseType == Pipe LocalServerName = ""; // If DatabaseType == Networked //URL = "http://127.0.0.1"; //Port = 8000; Protocol = SerializerProtocol.RPC; URLs = new string[] { "https://demo.prsdigital.com.au:8033" }; StartPanel = ""; Autologin = false; LoginType = LoginType.UserID; Logo = null; LibraryLocation = ""; GoogleAPIKey = ""; JobPrefix = ""; PurchaseOrderPrefix = ""; SecondaryWindows = new Dictionary>(); ColorScheme = DefaultColorScheme; // CornflowerBlue } public bool RestartRequired(DatabaseSettings original) { bool result = (original.DatabaseType != DatabaseType) || (!String.Equals(FileName, original.FileName)) || (!String.Equals(LocalServerName, original.LocalServerName)) //|| (!String.Equals(URL, original.URL)) //|| (!int.Equals(Port, original.Port)) || (!String.Equals(String.Join(";", URLs), String.Join(";", original.URLs))); return result; } public bool IsActive { get; set; } [Obsolete("Use DatabaseType instead")] public bool IsNetwork { get => DatabaseType == DatabaseType.Networked; set { if (value) { DatabaseType = DatabaseType.Networked; } else if(DatabaseType == DatabaseType.Networked) { DatabaseType = DatabaseType.Standalone; } } } [Obsolete("Replaced with HostNames", true)] public string URL { get; set; } [Obsolete("Replaced with HostNames", true)] public int Port { get; set; } public SerializerProtocol Protocol { get; set; } public string UserID { get; set; } public string Password { get; set; } public DatabaseType DatabaseType { get; set; } public string FileName { get; set; } public string LocalServerName { get; set; } public string[] URLs { get; set; } public LoginType LoginType { get; set; } public bool Autologin { get; set; } public string StartPanel { get; set; } public DatabaseProvider Provider { get; set; } public string LibraryLocation { get; set; } public byte[]? Logo { get; set; } public const string DefaultColorScheme = "#FF6495ED"; public string ColorScheme { get; set; } public string GoogleAPIKey { get; set; } // Geocoding API vandenbos.frank@gmail.com: "AIzaSyB9ZnKdEpKsbN9cm3K7rNfqeN5fIe_xlJ0"; public string JobPrefix { get; set; } public string PurchaseOrderPrefix { get; set; } // Panel Class, Button Name (? this should be panel name, but grrr), left, top, width, height public Dictionary> SecondaryWindows { get; set; } public Dictionary ButtonFavourites { get; set; } } public enum AutoUpdateType { NotSet, Url, File } }