public string GetTemplate(InteractiveDiagnosticMethod interactiveDiagnosticMethod) { var diagObjectType = interactiveDiagnosticMethod.ParentDiagnosticObject.GetType(); return(GetTemplateFromProperty(interactiveDiagnosticMethod, diagObjectType) ?? GetTemplateFromAttribute(interactiveDiagnosticMethod)); }
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)); }
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)); }
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); }
private static string GetTemplateFromAttribute(InteractiveDiagnosticMethod interactiveDiagnosticMethod) { var method = GetMethodInfo(interactiveDiagnosticMethod); var attribute = (TemplateAttribute)Attribute.GetCustomAttribute(method, typeof(TemplateAttribute)); return attribute != null ? attribute.Template : null; }
private static MethodInfo GetMethodInfo(InteractiveDiagnosticMethod interactiveDiagnosticMethod) { var diagObjectType = interactiveDiagnosticMethod.ParentDiagnosticObject.GetType(); var method = diagObjectType.GetMethod(interactiveDiagnosticMethod.MethodName, Flags); return method; }