using NLog;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
namespace LiMan.Transfer
{
public class utils
{
///
/// Classe logger
///
public static Logger lg = LogManager.GetCurrentClassLogger();
///
/// Effettua logging INFO corretto impostanto anche la variabile IOB prima di scrivere...
///
///
public static void lgInfo(string txt2log)
{
lg.Info(txt2log);
}
///
/// Effettua logging ERROR corretto impostanto anche la variabile IOB prima di scrivere...
///
///
public static void lgError(string txt2log)
{
lg.Error(txt2log);
}
public static string machineName
{
get
{
return Dns.GetHostName();
}
}
public static List machineIp
{
get
{
List ipList = new List();
try
{
IPAddress[] ipAddresses = Dns.GetHostAddresses(machineName);
foreach (var ip in ipAddresses)
{
ipList.Add($"{ip}");
}
}
catch (Exception exc)
{
// Machine not found...
lgError($"Eccezione in recupero MachineIp{Environment.NewLine}{exc}");
}
return ipList;
}
}
}
}