FIX UrlREBOOT (va sistemato a livello MP/IO)
This commit is contained in:
@@ -336,6 +336,63 @@ namespace IOB_UT
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// IP della macchina
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static string GetIP()
|
||||
{
|
||||
NetworkInterface[] nics = NetworkInterface.GetAllNetworkInterfaces();
|
||||
String sIpAddr = string.Empty;
|
||||
foreach (NetworkInterface adapter in nics)
|
||||
{
|
||||
if (sIpAddr == String.Empty)// only return IP Address from first card
|
||||
{
|
||||
IPInterfaceProperties properties = adapter.GetIPProperties();
|
||||
foreach (var item in properties.UnicastAddresses)
|
||||
{
|
||||
if (item.Address.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
|
||||
{
|
||||
sIpAddr = item.Address.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return sIpAddr;
|
||||
}
|
||||
/// <summary>
|
||||
/// Macaddress della macchina
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static string GetMACAddress()
|
||||
{
|
||||
NetworkInterface[] nics = NetworkInterface.GetAllNetworkInterfaces();
|
||||
String sMacAddress = string.Empty;
|
||||
foreach (NetworkInterface adapter in nics)
|
||||
{
|
||||
if (sMacAddress == String.Empty)// only return MAC Address from first card
|
||||
{
|
||||
IPInterfaceProperties properties = adapter.GetIPProperties();
|
||||
//sMacAddress = adapter.GetPhysicalAddress().ToString();
|
||||
sMacAddress = string.Join(":", (from z in adapter.GetPhysicalAddress().GetAddressBytes() select z.ToString("X2")).ToArray());
|
||||
}
|
||||
}
|
||||
return sMacAddress;
|
||||
}
|
||||
/// <summary>
|
||||
/// Effettua chaimata URL e restituisce risultato
|
||||
/// </summary>
|
||||
/// <param name="URL"></param>
|
||||
/// <returns></returns>
|
||||
public static string callUrl(string URL)
|
||||
{
|
||||
string answ = "";
|
||||
var client = new WebClient();
|
||||
client.Headers.Add("user-agent", CRS("appName"));
|
||||
answ = client.DownloadString(URL);
|
||||
// restituisco valore!
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Oggetto timing x archiviazione dati perfomances
|
||||
|
||||
@@ -6,8 +6,7 @@ NAME=develop
|
||||
[SERVER]
|
||||
MPIP=10.74.82.219
|
||||
MPURL=/MP/IO
|
||||
CMDALIVE=/IOB
|
||||
CMDREBO=/sendReboot.aspx?idxIOB=
|
||||
CMDREBO=/sendReboot.aspx?IP=
|
||||
|
||||
[IOB]
|
||||
STARTLIST=3001,3002,3003,3004,3005
|
||||
+32
-4
@@ -111,7 +111,37 @@ namespace IOB_WIN
|
||||
return string.Format("http://seriate.steamware.net:8083/SWS/MAPO/IOB-WIN/{0}/manifest.xml", branchName);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// IP del PC
|
||||
/// </summary>
|
||||
protected string currIP
|
||||
{
|
||||
get
|
||||
{
|
||||
string answ = "127.0.0.1";
|
||||
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// URL per segnalazione reboot...
|
||||
/// </summary>
|
||||
protected string urlReboot
|
||||
{
|
||||
get
|
||||
{
|
||||
string answ = "";
|
||||
try
|
||||
{
|
||||
answ = string.Format(@"http://{0}{1}{2}{3}&mac={4}", MPIP, MPURL, CMDREBO, utils.GetIP(), utils.GetMACAddress());
|
||||
}
|
||||
catch
|
||||
{
|
||||
answ = string.Format(@"{0}{1}{2}{3}", MPIP, MPURL, CMDREBO, utils.GetIP());
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Richeista verifica update
|
||||
/// </summary>
|
||||
@@ -197,17 +227,15 @@ namespace IOB_WIN
|
||||
}
|
||||
displayTaskAndLog("Minimized");
|
||||
}
|
||||
#if false
|
||||
try
|
||||
{
|
||||
// segnalo reboot (programma)...
|
||||
iobObj.callUrl(iobObj.urlReboot);
|
||||
utils.callUrl(urlReboot);
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
lg.Error(string.Format("EXCEPTION in fase di chaimata URL di reboot:{0}{1}", Environment.NewLine, exc));
|
||||
}
|
||||
#endif
|
||||
displayTaskAndLog("Main Form OK");
|
||||
}
|
||||
/// <summary>
|
||||
@@ -299,7 +327,7 @@ namespace IOB_WIN
|
||||
if (MPIP != "")
|
||||
{
|
||||
IPAddress address = IPAddress.Loopback;
|
||||
// check stato server (ping + pagina ALIVE)
|
||||
// check stato server (SOLO PING!)
|
||||
IPAddress.TryParse(MPIP, out address);
|
||||
if (address != IPAddress.Loopback)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user