using System; using System.Collections.Generic; using System.IO; using InABox.API; using InABox.Core; namespace PRSServer { public class DatabaseServerLookupGenerator : LookupGenerator { public DatabaseServerLookupGenerator(Server[] items) : base(items) { } protected override void DoGenerateLookups() { foreach (var server in Items) { if (server.Type == ServerType.Database) { AddValue(server.Key, server.Name); } } } } public class DatabaseServerProperties : ServerProperties { public DatabaseServerProperties() { FileName = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "PRS", "prs.dbs"); Port = 8000; GoogleAPIKey = ""; JobPrefix = ""; PurchaseOrderPrefix = ""; SMSProviderProperties = new Dictionary(); PasswordExpiryTime = 90; SessionExpiryTime = 120; CertificateFile = null; ColorScheme = "#FF6495ED"; } [FileNameEditor("Database Files (*.dbs)|*.dbs", AllowView = false, RequireExisting = false)] [EditorSequence(1)] public string FileName { get; set; } [IntegerEditor] [EditorSequence(2)] public int Port { get; set; } [IntegerEditor] [EditorSequence(3)] public int WebSocketPort { get; set; } [TextBoxEditor] [EditorSequence(4)] public string GoogleAPIKey { get; set; } [CodeEditor(Editable = Editable.Enabled)] [EditorSequence(5)] public string JobPrefix { get; set; } [CodeEditor(Editable = Editable.Enabled)] [EditorSequence(6)] public string PurchaseOrderPrefix { get; set; } [EditorSequence(7)] [IntegerEditor] public int PasswordExpiryTime { get; set; } [EditorSequence(8)] [IntegerEditor] [Caption("Login Expiry Time (mins)")] public int SessionExpiryTime { get; set; } [NullEditor] public Dictionary? SMSProviderProperties { get; set; } [EditorSequence(9)] [FileNameEditor("Certificate Files (*.pfx)|*.pfx")] public string CertificateFile { get; set; } [EditorSequence(10)] [TextBoxEditor] public string CertificateExpirationSubscriber { get; set; } [EditorSequence(11)] [ColorEditor] public string ColorScheme { get; set; } [EmbeddedImageEditor(MaximumHeight = 450, MaximumWidth = 450)] [EditorSequence(12)] public byte[] Logo { get; set; } public override ServerType Type() { return ServerType.Database; } public static string GetPipeName(string serviceName) => $"{serviceName}_PipeIPCServer"; } }