bonifica commenti...

This commit is contained in:
Samuele E. Locatelli
2017-10-26 10:55:32 +02:00
parent 2bf97c9dbf
commit b022ed7a17
+8 -13
View File
@@ -1392,7 +1392,7 @@ namespace IOB_WIN
public void accodaRawData(string newLine)
{
// inserisco in cima allo stack, trimmo e aggiorno display
parentForm.dataMonitor_0 = limitLine2show(string.Format("{0}{1}{2}", newLine, Environment.NewLine, parentForm.dataMonitor_0), false);
parentForm.dataMonitor_0 = limitLine2show(string.Format("{0}{1}{2}", newLine, Environment.NewLine, parentForm.dataMonitor_0));
}
/// <summary>
/// Accoda (visualizzando in cima allo stack) la nuova stringa di output per area OTHER DATA
@@ -1401,7 +1401,7 @@ namespace IOB_WIN
public void accodaSignaInlData(string newLine)
{
// inserisco in cima allo stack, trimmo e aggiorno display
parentForm.dataMonitor_1 = limitLine2show(string.Format("{0}{1}{2}", newLine, Environment.NewLine, parentForm.dataMonitor_1), false);
parentForm.dataMonitor_1 = limitLine2show(string.Format("{0}{1}{2}", newLine, Environment.NewLine, parentForm.dataMonitor_1));
}
/// <summary>
/// Accoda (visualizzando in cima allo stack) la nuova stringa di output per area OTHER DATA
@@ -1410,7 +1410,7 @@ namespace IOB_WIN
public void accodaUrlData(string newLine)
{
// inserisco in cima allo stack, trimmo e aggiorno display
parentForm.dataMonitor_2 = limitLine2show(string.Format("{0}{1}{2}", newLine, Environment.NewLine, parentForm.dataMonitor_2), false);
parentForm.dataMonitor_2 = limitLine2show(string.Format("{0}{1}{2}", newLine, Environment.NewLine, parentForm.dataMonitor_2));
}
/// <summary>
/// Accoda (visualizzando in cima allo stack) la nuova stringa di output per area OTHER DATA
@@ -1419,26 +1419,21 @@ namespace IOB_WIN
public void accodaOtherData(string newLine)
{
// inserisco in cima allo stack, trimmo e aggiorno display
parentForm.dataMonitor_3 = limitLine2show(string.Format("{0}{1}{2}", newLine, Environment.NewLine, parentForm.dataMonitor_3), false);
parentForm.dataMonitor_3 = limitLine2show(string.Format("{0}{1}{2}", newLine, Environment.NewLine, parentForm.dataMonitor_3));
}
/// <summary>
/// Effettua un trim della stringa al numero max di linee da mostrare a video
/// </summary>
/// <param name="newString"></param>
/// <returns></returns>
private string limitLine2show(string newString, bool showLog)
private string limitLine2show(string newString)
{
// se num righe superiore a limite trimmo...
if (newString.Split('\r').Length > parentForm.nLine2show)
if (newString.Split('\n').Length > parentForm.nLine2show)
{
// loggo cosa ho adesso...
if (showLog) lg.Info("ACTUAL STRING{0}----------------------------------------{0}{1}{0}----------------------------------------", Environment.NewLine, newString);
int idx = newString.LastIndexOf('\r');
if (showLog) lg.Info("Index Found: {0} | TOT-LEN:{1}", idx, newString.Length);
//int idx = newString.LastIndexOf(Environment.NewLine);
//int idx = newString.LastIndexOf('\r');
int idx = newString.LastIndexOf(Environment.NewLine);
newString = newString.Substring(0, idx);
if (showLog) lg.Info("TRIMMED STRING{0}----------------------------------------{0}{1}{0}----------------------------------------", Environment.NewLine, newString);
if (showLog) lg.Info("NEW-LEN:{0}", newString.Length);
}
return newString;
}