Message.ToString C# (CSharp) Method

ToString() public method

public ToString ( ) : string
return string
    public override string ToString()
    {
        mSb.Remove(0, mSb.Length).Append("Notification Name: ")
            .Append(Name)
            .Append("\nBody:")
            .Append((Body == null) ? "null" : Body.ToString())
            .Append("\nType:")
            .Append((Type == null) ? "null" : Type);
        return mSb.ToString();
    }

Usage Example

Example #1
0
        public static void Handle(Message message, DofusClient client)
        {
            if (message.IsNull() && !client.IsNull())
            {
                Logger.Init2("[Rcv] Client " + client.SSyncClient.Ip + " send unknown datas, they wont be handled");
                return;
            }
            var handler = Handlers.FirstOrDefault(x => x.Key == message.MessageId);
            if (!handler.Value.IsNull())
            {
                {
                    if (ConfigurationManager.Instance.ShowProtocolMessages)
                        Logger.Write("[Rcv] Message: " + message.ToString(), ConsoleColor.Gray);
                    try
                    {

                        handler.Value.DynamicInvoke(null, message, client);
                    }
                    catch (Exception ex)
                    {
                        Logger.Error(string.Format("Unable to handle message {0} {1} : '{2}'", message.ToString(), handler.Value.Method.Name, ex.InnerException.ToString()));
                        ErrorLogsManager.AddLog(ex.InnerException.ToString(), client.SSyncClient.Ip);
                        client.SendRaw("forcedbugreport");
                    }
                }
            }
            else
            {
                if (ConfigurationManager.Instance.ShowProtocolMessages)
                    Logger.Log(string.Format("[Rcv] No Handler: ({0}) {1}", message.MessageId, message.ToString()));
            }
        }
All Usage Examples Of Message::ToString