public static string ToPrettyString(this Message message, bool withPerformanceInfo = false, bool withBytesAsAscii = false) { #if !MF_FRAMEWORK_VERSION_V4_1 if (message is InternalMessage) { var m = (InternalMessage)message; return(m.Device.ToStringValue() + ": " + (m.ReceiverDescription ?? m.DataDump)); } #endif string description = message.Describe(); if (description == null) { description = message.DataDump; } description = message.SourceDevice.ToStringValue() + " > " + message.DestinationDevice.ToStringValue() + ": " + description; if (withBytesAsAscii) { description += " (" + ASCIIEncoding.GetString(message.Data, 0, -1, true) + ")"; } if (withPerformanceInfo) { description += " (" + message.PerformanceInfo.ToString() + ")"; } return(description); }
public static string ToPrettyString(this Message message, bool withPerformanceInfo = false, bool withBytesAsAscii = false) { string description = message.Describe(); if (description == null) { description = message.DataDump; } description = message.SourceDevice.ToStringValue() + " > " + message.DestinationDevice.ToStringValue() + ": " + description; if (withBytesAsAscii) { description += " (" + ASCIIEncoding.GetString(message.Data) + ")"; } if (withPerformanceInfo) { description += " (" + message.PerformanceInfo.ToString() + ")"; } return(description); }