Fix pack duplicati

This commit is contained in:
Samuele Locatelli
2022-05-30 15:25:56 +02:00
parent e776951ec8
commit aae3504a5b
4 changed files with 49 additions and 171 deletions
+15 -16
View File
@@ -6,20 +6,6 @@ namespace IOB_UT_NEXT
{
public class BinaryUtils : IFormatProvider, ICustomFormatter
{
#region Private Methods
private string HandleOtherFormats(string format, object arg)
{
if (arg is IFormattable)
return ((IFormattable)arg).ToString(format, CultureInfo.CurrentCulture);
else if (arg != null)
return arg.ToString();
else
return String.Empty;
}
#endregion Private Methods
#region Public Methods
// Format number in binary (B), octal (O), or hexadecimal (H).
@@ -29,8 +15,7 @@ namespace IOB_UT_NEXT
int baseNumber;
// Handle null or empty format string, string with precision specifier.
string thisFmt = String.Empty;
// Extract first character of format string (precision specifiers
// are not supported).
// Extract first character of format string (precision specifiers are not supported).
if (!String.IsNullOrEmpty(format))
thisFmt = format.Length > 1 ? format.Substring(0, 1) : format;
@@ -140,5 +125,19 @@ namespace IOB_UT_NEXT
}
#endregion Public Methods
#region Private Methods
private string HandleOtherFormats(string format, object arg)
{
if (arg is IFormattable)
return ((IFormattable)arg).ToString(format, CultureInfo.CurrentCulture);
else if (arg != null)
return arg.ToString();
else
return String.Empty;
}
#endregion Private Methods
}
}
+1 -55
View File
@@ -1,6 +1,4 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System;
using System;
namespace IOB_UT_NEXT
{
@@ -470,35 +468,6 @@ namespace IOB_UT_NEXT
WPS
}
#if false
/// <summary>
/// Enumerazione tipi di semaforo
/// </summary>
public enum Semaforo
{
/// <summary>
/// Stato non definito
/// </summary>
ND,
/// <summary>
/// Verde
/// </summary>
SV,
/// <summary>
/// Giallo
/// </summary>
SG,
/// <summary>
/// Rosso
/// </summary>
SR,
/// <summary>
/// Grigio/Spento
/// </summary>
SS
}
#endif
/// <summary>
/// Enumerazione tipi di tipi di URL x invio
/// </summary>
@@ -524,27 +493,4 @@ namespace IOB_UT_NEXT
/// </summary>
ULog
}
#if false
/// <summary>
/// Tipologia dato Raw Transfer (derivare da MapoSdk e togliere qui)
/// </summary>
/// serializzazione Native
/// [JsonConverter(typeof(JsonStringEnumConverter))]
/// serializzazione Newtonsoft json
/// [JsonConverter(typeof(StringEnumConverter))]
[JsonConverter(typeof(StringEnumConverter))]
public enum rawTransfType
{
ND = 0,
/// <summary>
/// Icoel: Batch info
/// </summary>
IcoelBatch,
/// <summary>
/// Icoel: Variety + layout info relative
/// </summary>
IcoelVarInfo
}
#endif
}
+5 -65
View File
@@ -117,70 +117,6 @@ namespace IOB_UT_NEXT
#endregion Public Methods
}
#if false
/// <summary>
/// Classe di base per trasferimento informazioni di tipo RawTransfer
/// FixMe Todo Fare !!!: elimnare usando SDK MAPO
/// </summary>
public class BaseRawTransf
{
#region Public Properties
/// <summary>
/// Data-Ora riferimento (x ordinamento fifo)
/// </summary>
public DateTime dataRif { get; set; } = DateTime.Now;
/// <summary>
/// Messaggio in modalità raw/stringa
/// </summary>
public object mesContent { get; set; } = "";
/// <summary>
/// Tipo di messaggio trasmesso
/// </summary>
public rawTransfType mesType { get; set; } = rawTransfType.ND;
/// <summary>
/// Costruttore senza parametri
/// </summary>
public BaseRawTransf()
{
this.dataRif = DateTime.Now;
this.mesContent = "";
this.mesType = rawTransfType.ND;
}
/// <summary>
/// Costruttore oggetto
/// </summary>
/// <param name="dataRif"></param>
/// <param name="mesContent"></param>
/// <param name="mesType"></param>
public BaseRawTransf(DateTime dataRif, object mesContent, rawTransfType mesType)
{
this.dataRif = dataRif;
this.mesContent = mesContent;
this.mesType = mesType;
}
#endregion Public Properties
}
/// <summary>
/// Array valori tipo BaseRawTransf inviati come JSon
/// FixMe Todo Fare !!!: elimnare usando SDK MAPO
/// </summary>
public class rawTransfJsonPayload
{
#region Public Properties
public List<BaseRawTransf> rawTransfData { get; set; }
#endregion Public Properties
}
#endif
/// <summary>
/// Cache a tempo valori INT
/// </summary>
@@ -343,6 +279,8 @@ namespace IOB_UT_NEXT
#endregion Public Properties
#region Public Methods
/// <summary>
/// Override metodo di equality
/// </summary>
@@ -371,7 +309,7 @@ namespace IOB_UT_NEXT
return false;
if (queueRawTransfLen != item.queueRawTransfLen)
return false;
if (queueUlLen!= item.queueUlLen)
if (queueUlLen != item.queueUlLen)
return false;
return true;
@@ -381,6 +319,8 @@ namespace IOB_UT_NEXT
{
return base.GetHashCode();
}
#endregion Public Methods
}
/// <summary>
+28 -35
View File
@@ -1,4 +1,3 @@
using MapoSDK;
using NLog;
using System;
using System.Collections;
@@ -49,35 +48,6 @@ namespace IOB_UT_NEXT
#endregion Public Fields
#if false
{
get
{
return redisMan.servStatus.dtVetoPing;
}
set
{
var currData = redisMan.servStatus;
currData.dtVetoPing = value;
redisMan.servStatus = currData;
}
}
#endif
#region Protected Properties
/// <summary>
/// Oggetto WebClient BASE da riutilizzare
/// </summary>
protected static WebClientWT client { get; set; }
/// <summary>
/// Oggetto WebClient con PAYLOAD da riutilizzare
/// </summary>
protected static WebClientWT clientPayload { get; set; }
#endregion Protected Properties
#region Public Properties
/// <summary>
@@ -117,6 +87,7 @@ namespace IOB_UT_NEXT
{ }
return answ;
}
/// <summary>
/// formatta un numero in forma binaria 0/1
/// </summary>
@@ -409,7 +380,9 @@ namespace IOB_UT_NEXT
/// number will be formatted as a 32-character binary number in two's compliment.
/// </summary>
/// <param name="theNumber">self-explanatory</param>
/// <param name="minimumDigits">if binary number contains fewer characters leading zeros are added</param>
/// <param name="minimumDigits">
/// if binary number contains fewer characters leading zeros are added
/// </param>
/// <returns>string as described above</returns>
public static string IntToBinStr(int theNumber, int minimumDigits)
{
@@ -420,7 +393,9 @@ namespace IOB_UT_NEXT
/// verifica se un dato bit sia alzato (come flag di strobe)
/// </summary>
/// <param name="value">valore da testare</param>
/// <param name="flag">valore cercato, può essere un singolo valore o un insieme in modalità AND</param>
/// <param name="flag">
/// valore cercato, può essere un singolo valore o un insieme in modalità AND
/// </param>
/// <returns></returns>
public static bool IsSetAll(StFlag32 value, StFlag32 flag)
{
@@ -431,7 +406,9 @@ namespace IOB_UT_NEXT
/// verifica se un dato bit sia alzato (come flag di strobe)
/// </summary>
/// <param name="value">valore da testare</param>
/// <param name="flag">valore cercato, può essere un singolo valore o un insieme in modalità OR</param>
/// <param name="flag">
/// valore cercato, può essere un singolo valore o un insieme in modalità OR
/// </param>
/// <returns></returns>
public static bool IsSetAny(StFlag32 value, StFlag32 flag)
{
@@ -586,7 +563,8 @@ namespace IOB_UT_NEXT
}
/// <summary>
/// provvede a verificare la dim della cartella dei log e cancella i + vecchi fino a restare a dim inferiori a _logMaxMb
/// provvede a verificare la dim della cartella dei log e cancella i + vecchi fino a restare
/// a dim inferiori a _logMaxMb
/// </summary>
public static void shrinkDir(string dirPath)
{
@@ -616,7 +594,8 @@ namespace IOB_UT_NEXT
// inizio con eliminare file + vecchi della data indicata...
int maxLogDays = CRI("maxLogDays");
fileMover.obj.deleteOlderThan(maxLogDays);
// ora controllo SE sia superata la dim max della directory --> in tal caso cancello dal + vecchio...
// ora controllo SE sia superata la dim max della directory --> in tal caso cancello dal
// + vecchio...
dirSizeMb = fileMover.obj.totalMb();
int maxLogDirSize = CRI("maxLogDirSize");
int maxTry = 100;
@@ -723,6 +702,20 @@ namespace IOB_UT_NEXT
}
#endregion Public Methods
#region Protected Properties
/// <summary>
/// Oggetto WebClient BASE da riutilizzare
/// </summary>
protected static WebClientWT client { get; set; }
/// <summary>
/// Oggetto WebClient con PAYLOAD da riutilizzare
/// </summary>
protected static WebClientWT clientPayload { get; set; }
#endregion Protected Properties
}
/// <summary>