Exemple #1
0
        /// <summary>
        /// Convierte en una cadena de caracteres el mensaje.
        /// </summary>
        /// <returns>
        /// Una cadena de caracteres que representan el mensaje.
        /// </returns>
        public override string ToString()
        {
            CorrectBitMapsValues();

            StringBuilder rendered = new StringBuilder();

            Field field;
            bool  appended = false;

            if (_header != null)
            {
                rendered.Append("H:");
                rendered.Append(_header.ToString());
                appended = true;
            }

            int j = _fields.MaximumFieldNumber;

            for (int i = 0; i <= j; i++)
            {
                if ((field = _fields[i]) != null)
                {
                    if (appended)
                    {
                        rendered.Append(",");
                    }
                    rendered.Append(i);
                    rendered.Append(":");
                    if ((_formatter == null) ||
                        (_formatter.FieldCanBeLogged(i)))
                    {
                        if (field is InnerMessageField)
                        {
                            rendered.Append("{");
                            rendered.Append(field.ToString());
                            rendered.Append("}");
                        }
                        else
                        {
                            rendered.Append(field.ToString());
                        }
                    }
                    else
                    {
                        rendered.Append(_formatter.ObfuscateFieldData(field));
                    }
                    appended = true;
                }
            }

            return(rendered.ToString());
        }