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.P.Version, Environment.Version, DateTime.Now)); }
/// <summary> /// Get the attribites from the class/type /// </summary> /// <param name="type"></param> /// <param name="generator"></param> /// <param name="tool"></param> /// <param name="versions"></param> /// <param name="categories"></param> 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; }
/// <summary> /// Get the attribites from the class/type /// </summary> /// <param name="type"></param> /// <param name="generator"></param> /// <param name="tool"></param> /// <param name="versions"></param> /// <param name="categories"></param> 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; }
private static object CustomToolAttribute(CustomToolAttribute customToolAttribute) { throw new Exception("The method or operation is not implemented."); }
private static object CustomToolAttribute(CustomToolAttribute customToolAttribute) { throw new Exception("The method or operation is not implemented."); }