Changeset 2778 for trunk/sources/HeuristicLab.PluginInfrastructure
- Timestamp:
- 02/11/10 13:04:42 (15 years ago)
- Location:
- trunk/sources/HeuristicLab.PluginInfrastructure
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.PluginInfrastructure/Advanced/InstallationManager.cs
r2763 r2778 71 71 builder.Append("Version: ").AppendLine(desc.Version.ToString()); 72 72 builder.AppendLine("Description:").AppendLine(desc.Description); 73 if (!string.IsNullOrEmpty(desc.ContactName)) { 74 builder.Append("Contact: ").Append(desc.ContactName).Append(", ").AppendLine(desc.ContactEmail); 75 } 73 76 builder.AppendLine("This plugin is " + desc.PluginState.ToString().ToLowerInvariant() + "."); 74 builder.Append("Build date: ").AppendLine(desc.BuildDate.ToString()).AppendLine();77 // builder.Append("Build date: ").AppendLine(desc.BuildDate.ToString()).AppendLine(); 75 78 builder.AppendLine("Files: "); 76 79 foreach (var file in desc.Files) { -
trunk/sources/HeuristicLab.PluginInfrastructure/HeuristicLab.PluginInfrastructure.csproj
r2748 r2778 102 102 <Compile Include="Attributes\ApplicationAttribute.cs" /> 103 103 <Compile Include="Attributes\AssemblyBuildDateAttribute.cs" /> 104 <Compile Include="Attributes\ContactInformationAttribute.cs" /> 104 105 <Compile Include="Attributes\PluginAttribute.cs" /> 105 106 <Compile Include="Attributes\PluginDependencyAttribute.cs" /> -
trunk/sources/HeuristicLab.PluginInfrastructure/Interfaces/IPluginDescription.cs
r2688 r2778 39 39 /// Gets the build date of the plugin. 40 40 /// </summary> 41 [Obsolete] 41 42 DateTime BuildDate { get; } 42 43 /// <summary> -
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.