using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using YamlDotNet.Core.Tokens; namespace IOB_UT_NEXT.Config.Base { public class ServerMapoDto { #region Public Properties /// /// nome di base del metodo API /// public string BaseApiClass { get; set; } = "IOB"; /// /// URL Base del server applicativo /// public string BaseAppUrl { get; set; } = "/MP/IO/"; /// /// Directory Installazione di riferimento x applicativi MAN/IOB sotto la radice C:\ /// public string ClientInstall { get; set; } = "SteamWare"; /// /// Dizionario comandi configurati /// public Dictionary Commands { get; set; } = new Dictionary(); /// /// Disabilitazione keepalive aggiungendo opzione in URL /// public bool DisabKeepAlive { get; set; } = false; /// /// Disabilitazione ping verso server /// public bool DisabPing { get; set; } = false; /// /// Indirizzo IP server /// public string IpAddr { get; set; } = "127.0.0.1"; /// /// Indica il metodo di trasporto http/https /// public string Transport { get; set; } = "http"; #endregion Public Properties #region Public Methods /// /// Restituisce la API del comando richiesto dalla BaseUrl /// /// Comando richiesto da comporre /// public string ApiUrl(string CmdReq) { // verifico se vadano inizializzati i commands... if (Commands.Count == 0) { Commands = new CmdUriDto(BaseApiClass).StdCommands(); } // default ad implicito con IOB/RIOB da conf... string answ = $"{BaseAppUrl}{BaseApiClass}/{CmdReq}/"; if (Commands.ContainsKey(CmdReq)) { answ = $"{BaseAppUrl}{Commands[CmdReq]}"; } // elimino doppie barre answ = answ.Replace("//", "/"); return answ; } #endregion Public Methods } }