imBMW.iBus.MessageRegistry.ToPrettyString C# (CSharp) Method

ToPrettyString() public static method

public static ToPrettyString ( this message, bool withPerformanceInfo = false, bool withBytesAsAscii = false ) : string
message this
withPerformanceInfo bool
withBytesAsAscii bool
return string
        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) + ")";
            }
            if (withPerformanceInfo)
            {
                description += " (" + message.PerformanceInfo.ToString() + ")";
            }
            return description;
        }