PUlizia codice vario

This commit is contained in:
Samuele Locatelli
2021-09-29 19:01:03 +02:00
parent 4cf26d64eb
commit 89261bd5f8
8 changed files with 36 additions and 17 deletions
+3 -1
View File
@@ -133,7 +133,9 @@
<HintPath>..\packages\System.Formats.Asn1.5.0.0\lib\net461\System.Formats.Asn1.dll</HintPath>
</Reference>
<Reference Include="System.IdentityModel" />
<Reference Include="System.IO.Compression" />
<Reference Include="System.IO.Compression, Version=4.1.2.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<HintPath>..\packages\System.IO.Compression.4.3.0\lib\net46\System.IO.Compression.dll</HintPath>
</Reference>
<Reference Include="System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Memory.4.5.4\lib\net461\System.Memory.dll</HintPath>
</Reference>
+15 -9
View File
@@ -111,7 +111,7 @@ namespace IOB_WIN_NEXT
protected AdapterForm parentForm;
/// <summary>
/// TImeout x ping al server
/// Timeout x ping al server
/// </summary>
protected int pingServerMsTimeout = utils.CRI("pingMsTimeout");
@@ -521,6 +521,7 @@ namespace IOB_WIN_NEXT
{
get
{
lgInfo($"Test Server Ping");
IPStatus answ = IPStatus.Unknown;
// se disabilitato salto...
if (pingDisabled)
@@ -531,6 +532,8 @@ namespace IOB_WIN_NEXT
{
IPAddress address;
PingReply reply;
var rand = new Random();
int pingTOut = 500;
using (Ping pingSender = new Ping())
{
address = IPAddress.Loopback;
@@ -552,24 +555,27 @@ namespace IOB_WIN_NEXT
// se != null --> uso address...
if (address != null)
{
reply = pingSender.Send(address, 300);
pingTOut = rand.Next(100, 200);
reply = pingSender.Send(address, pingServerMsTimeout + pingTOut);
}
else
{
reply = pingSender.Send(cIobConf.cncIpAddr, 300);
pingTOut = rand.Next(200, 400);
reply = pingSender.Send(cIobConf.cncIpAddr, pingServerMsTimeout + pingTOut);
}
}
catch
catch (Exception exc)
{
reply = pingSender.Send(IPAddress.Loopback, 300);
pingTOut = rand.Next(50, 100);
reply = pingSender.Send(IPAddress.Loopback, pingServerMsTimeout + pingTOut);
lgError($"ping to loopback addres per eccezione:{Environment.NewLine}{exc}");
}
// se ho timeout riprovo...
while (reply.Status != IPStatus.Success && numRetry < maxRetry)
{
lgInfo($"Server Ping KO | reply: {reply.Status} --> retry");
var rand = new Random();
Thread.Sleep(rand.Next(150, 500));
reply = pingSender.Send(address, pingServerMsTimeout * numRetry / 2);
Thread.Sleep(rand.Next(300, 600));
reply = pingSender.Send(address, pingServerMsTimeout * numRetry / 2 + pingTOut);
numRetry++;
if (reply.Status == IPStatus.Success)
{
@@ -4522,7 +4528,7 @@ namespace IOB_WIN_NEXT
/// <param name="valore"></param>
/// <param name="chiave"></param>
/// <returns></returns>
public void saveValue(ref Dictionary<string, string> outVal, double valore, string chiave)
public virtual void saveValue(ref Dictionary<string, string> outVal, double valore, string chiave)
{
//check obj preliminare
if (outVal == null)
+9 -1
View File
@@ -6,7 +6,7 @@ using System.Net.NetworkInformation;
namespace IOB_WIN_NEXT
{
public class IobKawasaki : IobGeneric
public class IobKawasaki : IobGeneric, IDisposable
{
#region Private Fields
@@ -696,6 +696,14 @@ namespace IOB_WIN_NEXT
#region Public Methods
/// <summary>
/// Metodo dispose x il currPLC contenuto
/// </summary>
public void Dispose()
{
KAWASAKI_ref.Dispose();
}
/// <summary>
/// Processo i task richiesti e li elimino dalla coda 1:1
/// </summary>
+1 -1
View File
@@ -1166,7 +1166,7 @@ namespace IOB_WIN_NEXT
/// <param name="valore"></param>
/// <param name="chiave"></param>
/// <returns></returns>
public void saveValue(ref Dictionary<string, string> outVal, double valore, string chiave)
public override void saveValue(ref Dictionary<string, string> outVal, double valore, string chiave)
{
//check obj preliminare
if (outVal == null)
+3 -1
View File
@@ -43,7 +43,9 @@ namespace IOB_WIN_NEXT
processDynData();
}
catch (Exception exc)
{ }
{
lgError($"Eccezione in processDynData iniziale x ModBus TCP HAM:{Environment.NewLine}{exc}");
}
}
}
+2 -2
View File
@@ -111,8 +111,8 @@ namespace IOB_WIN_NEXT
*
----------------------------------------------------- */
bool fatto = false;
ushort valW = 0;
//bool fatto = false;
//ushort valW = 0;
var MemInt = new byte[2];
+2 -2
View File
@@ -71,10 +71,10 @@ namespace IOB_WIN_NEXT
*
----------------------------------------------------- */
bool fatto = false;
//bool fatto = false;
ushort currStatus = 0;
ushort allarme = 0;
ushort valW = 0;
//ushort valW = 0;
var MemInt = new byte[2];
+1
View File
@@ -22,6 +22,7 @@
<package id="Selenium.WebDriver.ChromeDriver" version="90.0.4430.2400" targetFramework="net462" />
<package id="System.Buffers" version="4.5.1" targetFramework="net462" />
<package id="System.Formats.Asn1" version="5.0.0" targetFramework="net462" />
<package id="System.IO.Compression" version="4.3.0" targetFramework="net462" />
<package id="System.Memory" version="4.5.4" targetFramework="net462" />
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net462" />
<package id="System.Runtime.CompilerServices.Unsafe" version="5.0.0" targetFramework="net462" />