Example #1
0
        /// <summary>
        /// Traverses the message.
        /// </summary>
        /// <param name="member">The member.</param>
        /// <param name="reportingType">Type of the reporting.</param>
        /// <param name="concat">The concat.</param>
        /// <param name="indent">The indent.</param>
        private static void TraverseMessage(IMessageMember member, ReportingType reportingType, ref StringBuilder concat, ref int indent)
        {
            StringBuilder memberConcat = new StringBuilder();
            string        name         = member.Name;
            object        value        = null;

            if (indent > 0)
            {
                memberConcat.AppendFormat("|{0}", Environment.NewLine);
                memberConcat.AppendFormat("{0}", "+" + new String('-', indent));
            }

            memberConcat.AppendFormat("{0}", Acronyms.BuildPhrase(name));

            if (member.HasValue)
            {
                value = member.GetValue();

                if (null != value)
                {
                    string strValue = String.Format("{0}", value);
                    // verify if value has a description
                    string meaning = Enumerations.GetMeaning(strValue);
                    if (null != meaning)
                    {
                        memberConcat.AppendFormat(" : {0} ({1}){2}", strValue, meaning, Environment.NewLine);
                    }
                    else
                    {
                        memberConcat.AppendFormat(" : {0}{1}", strValue, Environment.NewLine);
                    }
                }
                else
                {
                    memberConcat.AppendFormat("{0}", Environment.NewLine);
                }
            }
            else
            {
                memberConcat.AppendFormat("{0}", Environment.NewLine);
            }

            string line = memberConcat.ToString();

            if (!line.EndsWith("(NULL)" + Environment.NewLine))
            {
                concat.Append(line);
            }

            if (member.HasChildren)
            {
                indent++;
                foreach (IMessageMember child in member.GetChildren())
                {
                    TraverseMessage(child, reportingType, ref concat, ref indent);
                }
                indent--;
            }
        }
Example #2
0
        /// <summary>
        /// Traverses the message.
        /// </summary>
        /// <param name="member">The member.</param>
        /// <param name="reportingType">Type of the reporting.</param>
        /// <param name="concat">The concat.</param>
        /// <param name="indent">The indent.</param>
        private static void TraverseMessage( IMessageMember member, ReportingType reportingType, ref StringBuilder concat, ref int indent )
        {

            StringBuilder memberConcat = new StringBuilder();
            string name = member.Name;
            object value = null;

            if (indent > 0)
            {
                memberConcat.AppendFormat( "|{0}", Environment.NewLine );
                memberConcat.AppendFormat( "{0}", "+" + new String( '-', indent ) );
            }

            memberConcat.AppendFormat( "{0}", Acronyms.BuildPhrase( name ) );

            if (member.HasValue)
            {
                value = member.GetValue();

                if (null != value)
                {
                    string strValue = String.Format("{0}", value);
                    // verify if value has a description
                    string meaning = Enumerations.GetMeaning(strValue);
                    if (null != meaning)
                    {
                        memberConcat.AppendFormat(" : {0} ({1}){2}", strValue, meaning, Environment.NewLine);
                    }
                    else
                    {
                        memberConcat.AppendFormat(" : {0}{1}", strValue, Environment.NewLine);
                    }
                }
                else
                {
                    memberConcat.AppendFormat( "{0}", Environment.NewLine );
                }
            }
            else
            {
                memberConcat.AppendFormat( "{0}", Environment.NewLine );
            }

            string line = memberConcat.ToString();
            if (!line.EndsWith( "(NULL)" + Environment.NewLine ))
            {
                concat.Append( line );
            }

            if (member.HasChildren)
            {
                indent++;
                foreach (IMessageMember child in member.GetChildren())
                {
                    TraverseMessage( child, reportingType, ref concat, ref indent );
                }
                indent--;
            }

        }