Changeset 2778 for trunk/sources/HeuristicLab.PluginInfrastructure/Manager
- Timestamp:
- 02/11/10 13:04:42 (15 years ago)
- Location:
- trunk/sources/HeuristicLab.PluginInfrastructure/Manager
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.PluginInfrastructure/Manager/PluginDescription.cs
r2763 r2778 69 69 get { return buildDate; } 70 70 internal set { buildDate = value; } 71 } 72 73 private string contactName; 74 /// <summary> 75 /// Gets or sets the name of the contact person for this plugin. 76 /// </summary> 77 internal string ContactName { 78 get { return contactName; } 79 set { contactName = value; } 80 } 81 82 private string contactEmail; 83 /// <summary> 84 /// Gets or sets the e-mail address of the contact person for this plugin. 85 /// </summary> 86 internal string ContactEmail { 87 get { return contactEmail; } 88 set { contactEmail = value; } 71 89 } 72 90 -
trunk/sources/HeuristicLab.PluginInfrastructure/Manager/PluginValidator.cs
r2763 r2778 262 262 263 263 string pluginName, pluginDescription, pluginVersion; 264 string contactName, contactAddress; 264 265 GetPluginMetaData(pluginType, out pluginName, out pluginDescription, out pluginVersion); 266 GetPluginContactMetaData(pluginType, out contactName, out contactAddress); 265 267 var pluginFiles = GetPluginFilesMetaData(pluginType); 266 268 var pluginDependencies = GetPluginDependencyMetaData(pluginType); … … 268 270 // minimal sanity check of the attribute values 269 271 if (!string.IsNullOrEmpty(pluginName) && 270 pluginFiles.Count() > 0 && // at least on file271 pluginFiles.Any(f => f.Type == PluginFileType.Assembly)) { // at least on assembly272 pluginFiles.Count() > 0 && // at least one file 273 pluginFiles.Any(f => f.Type == PluginFileType.Assembly)) { // at least one assembly 272 274 // create a temporary PluginDescription that contains the attribute values 273 275 PluginDescription info = new PluginDescription(); … … 275 277 info.Description = pluginDescription; 276 278 info.Version = new Version(pluginVersion); 279 info.ContactName = contactName; 280 info.ContactEmail = contactAddress; 277 281 info.AddFiles(pluginFiles); 278 282 … … 305 309 } 306 310 yield return new PluginDependency(name, version); 311 } 312 } 313 314 private static void GetPluginContactMetaData(Type pluginType, out string contactName, out string contactAddress) { 315 // get attribute of type ContactInformation if there is any 316 var contactInfoAttribute = (from attr in CustomAttributeData.GetCustomAttributes(pluginType) 317 where IsAttributeDataForType(attr, typeof(ContactInformationAttribute)) 318 select attr).SingleOrDefault(); 319 320 if (contactInfoAttribute != null) { 321 contactName = (string)contactInfoAttribute.ConstructorArguments[0].Value; 322 contactAddress = (string)contactInfoAttribute.ConstructorArguments[1].Value; 323 } else { 324 contactName = string.Empty; 325 contactAddress = string.Empty; 307 326 } 308 327 }
Note: See TracChangeset
for help on using the changeset viewer.