コード例 #1
0
        private string GetMethodInformation(MethodInfo method)
        {
            string result = "\"" + this.owner.Name + "." + method.Name + " ";
            // Parameter-Liste der Methode bestimmen

            string infoAttribute = GameConsoleTools.GetGameConsoleInfoAttribute(
                Attribute.GetCustomAttributes(method));

            result += GameConsoleTools.GetParameterTypesString(method.GetParameters());
            return(result + "\" : <" + GameConsoleTools.GetParameterTypeString(method.ReturnType) +
                   "> (" + infoAttribute + ")");
        }
コード例 #2
0
        private string GetPropertyInformation()
        {
            Type type = this.owner.SenderType;

            // PropertyInfo holen
            PropertyInfo prop = type.GetProperty(propertyName);

            // Get-Set-Methode holen
            MethodInfo method = prop.GetGetMethod();

            string result = "";

            if (method != null)
            {
                result += "\"" + this.owner.Name + "." + this.propertyName + "\" : <" +
                          GameConsoleTools.GetParameterTypeString(method.ReturnType) + ">" +
                          GameConsoleTools.GetGameConsoleInfoAttribute(prop);
            }

            method = prop.GetSetMethod();
            if (method != null)
            {
                if (!string.IsNullOrEmpty(result))
                {
                    result += "\n";
                }
                result += "\"" + this.owner.Name + "." + this.propertyName + " ";
                // Parameter-Liste der Methode bestimmen
                ParameterInfo[] methodParams = method.GetParameters();

                result += GameConsoleTools.GetParameterTypesString(methodParams);

                /*
                 * for (int i = 0; i < methodParams.Length; i++)
                 * {
                 *  result += "<" + methodParams[i].ParameterType.ToString() + ">";
                 *  if (i < methodParams.Length - 1)
                 *      result += " ";
                 * }
                 */
                result += "\" <" + method.ReturnType.ToString() + ">" +
                          GameConsoleTools.GetGameConsoleInfoAttribute(Attribute.GetCustomAttributes(prop));
            }

            return(result);
        }