protected RadiationFieldParameter GetMatchingParameter(ContractParameter param)
        {
            var radiationFieldParameter = param as RadiationFieldParameter;

            if (radiationFieldParameter == null)
            {
                foreach (ContractParameter child in param.GetChildren())
                {
                    var result = GetMatchingParameter(child);
                    if (result != null)
                    {
                        return(result);
                    }
                }
            }
            else if (radiationFieldParameter.field == field || field == RadiationFieldType.ANY)
            {
                return(radiationFieldParameter);
            }
            return(null);
        }
Пример #2
0
        /// <summary>
        /// Gets the text of all the child delegates in one big string.  Useful for printing out
        /// the full details for completed parameters.
        /// </summary>
        /// <param name="param">The parent parameters.</param>
        /// <returns>The full delegate string</returns>
        public static string GetDelegateText(ContractParameter param)
        {
            string output = "";

            foreach (ContractParameter child in param.GetChildren())
            {
                if (child is ParameterDelegate <T> && !((ParameterDelegate <T>)child).trivial)
                {
                    if (!string.IsNullOrEmpty(output))
                    {
                        output += "; ";
                    }
                    output += ((ParameterDelegate <T>)child).title;

                    if (child is AllParameterDelegate <T> )
                    {
                        output += ": " + GetDelegateText(child);
                    }
                }
            }
            return(output);
        }
        /// <summary>
        /// Gets the text of all the child delegates in one big string.  Useful for printing out
        /// the full details for completed parameters.
        /// </summary>
        /// <param name="param">The parent parameters.</param>
        /// <returns>The full delegate string</returns>
        public static string GetDelegateText(ContractParameter param)
        {
            StringBuilder sb = StringBuilderCache.Acquire();

            foreach (ContractParameter child in param.GetChildren())
            {
                if (child is ParameterDelegate <T> && !((ParameterDelegate <T>)child).trivial)
                {
                    if (sb.Length != 0)
                    {
                        sb.Append("; ");
                    }
                    sb.Append(((ParameterDelegate <T>)child).title);

                    if (child is AllParameterDelegate <T> )
                    {
                        sb.Append(": ");
                        sb.Append(GetDelegateText(child));
                    }
                }
            }
            return(sb.ToStringAndRelease());
        }