| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 | using System;using System.Collections.Generic;using System.IO;using InABox.API;using InABox.Core;namespace PRSServer{    public class DatabaseServerLookupGenerator : LookupGenerator<Server>    {        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<SMSProviderType, string>();            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 RPCPort { 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<SMSProviderType, string>? 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, bool newstyle) =>             newstyle                 ? $"{serviceName}_RPC"                : $"{serviceName}_IPC";    }}
 |