Files
Samuele Locatelli 1a43c31b32 Refresh FANUC
2026-04-04 12:02:06 +02:00

83 lines
2.4 KiB
C#

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
/// <summary>
/// nome di base del metodo API
/// </summary>
public string BaseApiClass { get; set; } = "IOB";
/// <summary>
/// URL Base del server applicativo
/// </summary>
public string BaseAppUrl { get; set; } = "/MP/IO/";
/// <summary>
/// Directory Installazione di riferimento x applicativi MAN/IOB sotto la radice C:\
/// </summary>
public string ClientInstall { get; set; } = "SteamWare";
/// <summary>
/// Dizionario comandi configurati
/// </summary>
public Dictionary<string, string> Commands { get; set; } = new Dictionary<string, string>();
/// <summary>
/// Disabilitazione keepalive aggiungendo opzione in URL
/// </summary>
public bool DisabKeepAlive { get; set; } = false;
/// <summary>
/// Disabilitazione ping verso server
/// </summary>
public bool DisabPing { get; set; } = false;
/// <summary>
/// Indirizzo IP server
/// </summary>
public string IpAddr { get; set; } = "127.0.0.1";
/// <summary>
/// Indica il metodo di trasporto http/https
/// </summary>
public string Transport { get; set; } = "http";
#endregion Public Properties
#region Public Methods
/// <summary>
/// Restituisce la API del comando richiesto dalla BaseUrl
/// </summary>
/// <param name="CmdReq">Comando richiesto da comporre</param>
/// <returns></returns>
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
}
}