1 // ****************************************************************
\r
2 // Copyright 2007, Charlie Poole
\r
3 // This is free software licensed under the NUnit license. You may
\r
4 // obtain a copy of the license at http://nunit.org/?p=license&r=2.4
\r
5 // ****************************************************************
\r
7 using System.Reflection;
\r
9 namespace NUnit.Core.Extensibility
\r
12 /// The Addin class holds information about an addin.
\r
17 #region Private Fields
\r
18 private string typeName;
\r
19 private string name;
\r
20 private string description;
\r
21 private ExtensionType extensionType;
\r
22 private AddinStatus status;
\r
23 private string message;
\r
28 /// Construct an Addin for a type.
\r
30 /// <param name="type">The type to be used</param>
\r
31 public Addin( Type type )
\r
33 this.typeName = type.AssemblyQualifiedName;
\r
35 object[] attrs = type.GetCustomAttributes( typeof(NUnitAddinAttribute), false );
\r
36 if ( attrs.Length == 1 )
\r
38 NUnitAddinAttribute attr = (NUnitAddinAttribute)attrs[0];
\r
39 this.name = attr.Name;
\r
40 this.description = attr.Description;
\r
41 this.extensionType = attr.Type;
\r
44 if ( this.name == null )
\r
45 this.name = type.Name;
\r
47 if ( this.extensionType == 0 )
\r
48 this.extensionType = ExtensionType.Core;
\r
50 this.status = AddinStatus.Enabled;
\r
56 /// The name of the Addin
\r
60 get { return name; }
\r
64 /// Brief description of what the Addin does
\r
66 public string Description
\r
68 get { return description; }
\r
72 /// The type or types of extension provided, using
\r
73 /// one or more members of the ExtensionType enumeration.
\r
75 public ExtensionType ExtensionType
\r
77 get { return extensionType; }
\r
81 /// The AssemblyQualifiedName of the type that implements
\r
84 public string TypeName
\r
86 get { return typeName; }
\r
90 /// The status of the addin
\r
92 public AddinStatus Status
\r
94 get { return status; }
\r
95 set { status = value; }
\r
99 /// Any message that clarifies the status of the Addin,
\r
100 /// such as an error message or an explanation of why
\r
101 /// the addin is disabled.
\r
103 public string Message
\r
105 get { return message; }
\r
106 set { message = value; }
\r