/// <summary> /// Builds text for reading logging. /// </summary> protected string BuildReadingText(byte[] buffer, int index, int bytesToRead, int bytesRead) { return("Receive (" + bytesRead + "/" + bytesToRead + "): " + ScadaUtils.BytesToString(buffer, index, Math.Min(bytesRead, MaxLoggingSize)) + (bytesRead <= MaxLoggingSize ? "" : "...") + (bytesToRead > 0 ? "" : "no data")); }
/// <summary> /// Builds text for writing logging. /// </summary> protected string BuildWritingText(byte[] buffer, int index, int bytesToWrite) { return("Send (" + bytesToWrite + "): " + ScadaUtils.BytesToString(buffer, index, Math.Min(bytesToWrite, MaxLoggingSize)) + (bytesToWrite <= MaxLoggingSize ? "" : "...")); }
/// <summary> /// Builds a log text about writing data. /// </summary> protected static string BuildWriteLogText(byte[] buffer, int offset, int count, ProtocolFormat format) { return($"{CommPhrases.SendNotation} ({count}): " + ScadaUtils.BytesToString(buffer, offset, count, format == ProtocolFormat.Hex)); }
/// <summary> /// Builds a log text about reading data. /// </summary> protected static string BuildReadLogText(byte[] buffer, int offset, int readCnt, ProtocolFormat format) { return($"{CommPhrases.ReceiveNotation} ({readCnt}): " + ScadaUtils.BytesToString(buffer, offset, readCnt, format == ProtocolFormat.Hex)); }