public string GetTemplate(InteractiveDiagnosticMethod interactiveDiagnosticMethod)
        {
            var diagObjectType = interactiveDiagnosticMethod.ParentDiagnosticObject.GetType();

            return(GetTemplateFromProperty(interactiveDiagnosticMethod, diagObjectType) ??
                   GetTemplateFromAttribute(interactiveDiagnosticMethod));
        }
示例#2
0
        public string GetTemplate(InteractiveDiagnosticMethod interactiveDiagnosticMethod)
        {
            var diagObjectType = interactiveDiagnosticMethod.ParentDiagnosticObject.GetType();

            return GetTemplateFromProperty(interactiveDiagnosticMethod, diagObjectType) ??
                   GetTemplateFromAttribute(interactiveDiagnosticMethod);
        }
        private static MethodInfo GetMethodInfo(InteractiveDiagnosticMethod interactiveDiagnosticMethod)
        {
            var diagObjectType = interactiveDiagnosticMethod.ParentDiagnosticObject.GetType();

            var method = diagObjectType.GetMethod(interactiveDiagnosticMethod.MethodName, Flags);

            return(method);
        }
        private static string GetTemplateFromAttribute(InteractiveDiagnosticMethod interactiveDiagnosticMethod)
        {
            var method = GetMethodInfo(interactiveDiagnosticMethod);

            var attribute = (TemplateAttribute)Attribute.GetCustomAttribute(method, typeof(TemplateAttribute));

            return(attribute != null ? attribute.Template : null);
        }
        public object ExecuteDiagnostic(InteractiveDiagnosticMethod interactiveDiagnosticMethod, object[] arguments)
        {
            var method = GetMethodInfo(interactiveDiagnosticMethod);

            if (method == null)
            {
                throw new ArgumentException(string.Format("Unable to locate method: {0}", interactiveDiagnosticMethod.MethodName));
            }

            return(method.Invoke(interactiveDiagnosticMethod.ParentDiagnosticObject, arguments));
        }
示例#6
0
        public object ExecuteDiagnostic(InteractiveDiagnosticMethod interactiveDiagnosticMethod, object[] arguments)
        {
            var method = GetMethodInfo(interactiveDiagnosticMethod);

            if (method == null)
            {
                throw new ArgumentException(string.Format("Unable to locate method: {0}", interactiveDiagnosticMethod.MethodName));
            }

            return method.Invoke(interactiveDiagnosticMethod.ParentDiagnosticObject, arguments);
        }
        private static string GetTemplateFromProperty(
            InteractiveDiagnosticMethod interactiveDiagnosticMethod, Type diagObjectType)
        {
            var propertyName = String.Format("{0}{1}", interactiveDiagnosticMethod.MethodName, "Template");
            var property     = diagObjectType.GetProperty(propertyName);

            if (property == null)
            {
                return(null);
            }

            return((string)property.GetValue(interactiveDiagnosticMethod.ParentDiagnosticObject, null));
        }
示例#8
0
        private static string GetTemplateFromProperty(
            InteractiveDiagnosticMethod interactiveDiagnosticMethod, Type diagObjectType)
        {
            var propertyName = String.Format("{0}{1}", interactiveDiagnosticMethod.MethodName, "Template");
            var property = diagObjectType.GetProperty(propertyName);

            if (property == null)
            {
                return null;
            }

            return (string)property.GetValue(interactiveDiagnosticMethod.ParentDiagnosticObject, null);
        }
示例#9
0
        private static string GetTemplateFromAttribute(InteractiveDiagnosticMethod interactiveDiagnosticMethod)
        {
            var method = GetMethodInfo(interactiveDiagnosticMethod);

            var attribute = (TemplateAttribute)Attribute.GetCustomAttribute(method, typeof(TemplateAttribute));

            return attribute != null ? attribute.Template : null;
        }
示例#10
0
        private static MethodInfo GetMethodInfo(InteractiveDiagnosticMethod interactiveDiagnosticMethod)
        {
            var diagObjectType = interactiveDiagnosticMethod.ParentDiagnosticObject.GetType();

            var method = diagObjectType.GetMethod(interactiveDiagnosticMethod.MethodName, Flags);

            return method;
        }