示例#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--;
            }
        }
示例#2
0
        public SoChainApi(BitcoinBasedCurrency currency)
        {
            Currency = currency ?? throw new ArgumentNullException(nameof(currency));

            var networkAcronym = AcronymByNetwork(currency.Network);

            if (!Acronyms.ContainsValue(networkAcronym))
            {
                throw new NotSupportedException($"Network {networkAcronym} not supported by chain.so api!");
            }

            NetworkAcronym = networkAcronym;
        }
示例#3
0
        private static string AcronymByNetwork(Network network)
        {
            if (network == null)
            {
                throw new ArgumentNullException(nameof(network));
            }

            if (Acronyms.TryGetValue(network.Name, out var acronym))
            {
                return(acronym);
            }

            throw new NotSupportedException($"Network {network.Name} not supported!");
        }
示例#4
0
文件: Team.cs 项目: rmstreet/RM.TM
 public override bool Equals(object obj)
 {
     return(base.Equals(obj) &&
            Name.Equals(((Team)obj).Name) &&
            Acronyms.Equals(((Team)obj).Acronyms));
 }