private static void GetAttributes(Type type, out Guid generator, out CustomToolAttribute tool, out VersionSupportAttribute[] versions, out CategorySupportAttribute[] categories) { object[] attrs; // Retrieve the GUID associated with the generator class. attrs = type.GetCustomAttributes(typeof(GuidAttribute), false); if (attrs.Length == 0) { throw new ArgumentException(String.Format( CultureInfo.CurrentCulture, Properties.Resources.Tool_AttributeMissing, type, typeof(GuidAttribute))); } generator = new Guid(((GuidAttribute)attrs[0]).Value); // Retrieve the custom tool information. attrs = type.GetCustomAttributes(typeof(CustomToolAttribute), false); if (attrs.Length == 0) { throw new ArgumentException(String.Format( CultureInfo.CurrentCulture, Properties.Resources.Tool_AttributeMissing, type, typeof(CustomToolAttribute))); } tool = (CustomToolAttribute)attrs[0]; // Retrieve the VS.NET versions supported. Can be inherited. attrs = type.GetCustomAttributes(typeof(VersionSupportAttribute), true); if (attrs.Length == 0) { throw new ArgumentException(String.Format( CultureInfo.CurrentCulture, Properties.Resources.Tool_AttributeMissing, type, typeof(VersionSupportAttribute))); } versions = (VersionSupportAttribute[])attrs; // Retrieve the VS.NET generator categories supported. Can be inherited. attrs = type.GetCustomAttributes(typeof(CategorySupportAttribute), true); if (attrs.Length == 0) { throw new ArgumentException(String.Format( CultureInfo.CurrentCulture, Properties.Resources.Tool_AttributeMissing, type, typeof(CategorySupportAttribute))); } categories = (CategorySupportAttribute[])attrs; }
public static string GetToolGeneratedCodeWarning(Type customToolType) { CustomToolAttribute attribute = (CustomToolAttribute)Attribute.GetCustomAttribute( customToolType, typeof(CustomToolAttribute), true); if (attribute == null) { throw new ArgumentException(String.Format( CultureInfo.CurrentCulture, Properties.Resources.CustomTool_ToolRequiredAttributeMissing, customToolType, typeof(CustomToolAttribute))); } return(String.Format(TemplateAutogenerated, attribute.Name, ThisAssembly.Version, Environment.Version)); }
private static object CustomToolAttribute(CustomToolAttribute customToolAttribute) { throw new Exception("The method or operation is not implemented."); }