fix parametro lenght stringa...
This commit is contained in:
+54
-17
@@ -52,6 +52,52 @@ namespace IOB_WIN
|
||||
|
||||
#region area metodi lettura/Scrittura
|
||||
|
||||
/// <summary>
|
||||
/// Inserimento/aggiornamento chiavi/valore in currProdData
|
||||
/// </summary>
|
||||
/// <param name="chiave"></param>
|
||||
/// <param name="valore"></param>
|
||||
public void upsertKey(string chiave, string valore)
|
||||
{
|
||||
if (currProdData.ContainsKey(chiave))
|
||||
{
|
||||
currProdData[chiave] = valore;
|
||||
}
|
||||
else
|
||||
{
|
||||
currProdData.Add(chiave, valore);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Converte direttamente un valore stringa su un oggetto byte[] (senza limitazioni di dimensione)
|
||||
/// </summary>
|
||||
/// <param name="valore"></param>
|
||||
/// <param name="maxLenght">Dimensione massima ammessa per la stringa</param>
|
||||
/// <returns></returns>
|
||||
public byte[] stringToByte(string valore, int maxLenght)
|
||||
{
|
||||
byte[] answ = new byte[1];
|
||||
byte[] stringPar = new byte[2];
|
||||
byte[] strByte = S7.Net.Types.String.ToByteArray(valore);
|
||||
int shiftStrByte = writePre ? 2 : 0;
|
||||
int byteLen = strByte.Length <= maxLenght ? strByte.Length : maxLenght;
|
||||
if (writePre)
|
||||
{
|
||||
// tolgo 2 alla lunghezza... SE > 2
|
||||
if (byteLen > 2)
|
||||
{
|
||||
byteLen = byteLen - 2;
|
||||
}
|
||||
// MAX LUN
|
||||
stringPar[1] = (byte)maxLenght;
|
||||
// LUNGH STRING
|
||||
stringPar[0] = (byte)byteLen;
|
||||
Buffer.BlockCopy(stringPar, 0, answ, 0, shiftStrByte);
|
||||
}
|
||||
Buffer.BlockCopy(strByte, 0, answ, shiftStrByte, byteLen);
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Salvo in memblock il valore stringa indicato con formattazione siemens
|
||||
/// </summary>
|
||||
@@ -111,22 +157,6 @@ namespace IOB_WIN
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Inserimento/aggiornamento chiavi/valore in currProdData
|
||||
/// </summary>
|
||||
/// <param name="chiave"></param>
|
||||
/// <param name="valore"></param>
|
||||
public void upsertKey(string chiave, string valore)
|
||||
{
|
||||
if (currProdData.ContainsKey(chiave))
|
||||
{
|
||||
currProdData[chiave] = valore;
|
||||
}
|
||||
else
|
||||
{
|
||||
currProdData.Add(chiave, valore);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Salvo in memblock il valore Int indicato con formattazione siemens
|
||||
/// </summary>
|
||||
@@ -1159,7 +1189,14 @@ namespace IOB_WIN
|
||||
saveRealOnMemBlock(ref MemBlock, 0, currMem.value);
|
||||
break;
|
||||
case plcDataType.String:
|
||||
saveStringOnMemBlock(ref MemBlock, 0, currMem.value.Length, currMem.value);
|
||||
if (true)
|
||||
{
|
||||
saveStringOnMemBlock(ref MemBlock, 0, currMem.size, currMem.value);
|
||||
}
|
||||
else
|
||||
{
|
||||
MemBlock = stringToByte(currMem.value, currMem.size);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
Vendored
+1
-1
@@ -16,7 +16,7 @@ pipeline {
|
||||
|
||||
/* calcolo numero versione... diverso x branch MASTER/DEVELOP */
|
||||
script {
|
||||
withEnv(['NEXT_BUILD_NUMBER=520']) {
|
||||
withEnv(['NEXT_BUILD_NUMBER=521']) {
|
||||
// env.versionNumber = VersionNumber(versionNumberString : '2.4.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true)
|
||||
env.versionNumber = VersionNumber(versionNumberString : '2.4.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}')
|
||||
env.APP_NAME = 'MAPO-IOB-WIN'
|
||||
|
||||
Reference in New Issue
Block a user