Changeset 2815


Ignore:
Timestamp:
02/16/10 18:36:45 (11 years ago)
Author:
gkronber
Message:

Added contact info and license text to plugin descriptions. #860

Location:
trunk/sources/HeuristicLab.PluginInfrastructure
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.PluginInfrastructure/Interfaces/IPluginDescription.cs

    r2790 r2815  
    4949    /// </summary>
    5050    IEnumerable<IPluginFile> Files { get; }
     51    /// <summary>
     52    /// Gets the name of the contact person of the plugin.
     53    /// </summary>
     54    string ContactName { get; }
     55    /// <summary>
     56    /// Gets the e-mail address of the contact person of the plugin.
     57    /// </summary>
     58    string ContactEmail { get; }
     59    /// <summary>
     60    /// Gets the license text of the plugin.
     61    /// </summary>
     62    string LicenseText { get; }
    5163  }
    5264}
  • trunk/sources/HeuristicLab.PluginInfrastructure/Manager/PluginDescription.cs

    r2790 r2815  
    7575    /// Gets or sets the name of the contact person for this plugin.
    7676    /// </summary>
    77     internal string ContactName {
     77    public string ContactName {
    7878      get { return contactName; }
    79       set { contactName = value; }
     79      internal set { contactName = value; }
    8080    }
    8181
     
    8484    /// Gets or sets the e-mail address of the contact person for this plugin.
    8585    /// </summary>
    86     internal string ContactEmail {
     86    public string ContactEmail {
    8787      get { return contactEmail; }
    88       set { contactEmail = value; }
     88      internal set { contactEmail = value; }
     89    }
     90    private string licenseText;
     91    /// <summary>
     92    /// Gets or sets the license text of the plugin.
     93    /// </summary>
     94    public string LicenseText {
     95      get { return licenseText; }
     96      internal set { licenseText = value; }
    8997    }
    9098
  • trunk/sources/HeuristicLab.PluginInfrastructure/Manager/PluginValidator.cs

    r2790 r2815  
    286286        info.ContactName = contactName;
    287287        info.ContactEmail = contactAddress;
     288        info.LicenseText = ReadLicenseFiles(pluginFiles);
    288289        info.AddFiles(pluginFiles);
    289290
     
    293294        throw new InvalidPluginException("Invalid metadata in plugin " + pluginType.ToString());
    294295      }
     296    }
     297
     298    private string ReadLicenseFiles(IEnumerable<PluginFile> pluginFiles) {
     299      // combine the contents of all plugin files
     300      var licenseFiles = from file in pluginFiles
     301                         where file.Type == PluginFileType.License
     302                         select file;
     303      if (licenseFiles.Count() == 0) return string.Empty;
     304      StringBuilder licenseTextBuilder = new StringBuilder();
     305      licenseTextBuilder.AppendLine(File.ReadAllText(licenseFiles.First().Name));
     306      foreach (var licenseFile in licenseFiles.Skip(1)) {
     307        licenseTextBuilder.AppendLine().AppendLine(); // leave some empty space between multiple license files
     308        licenseTextBuilder.AppendLine(File.ReadAllText(licenseFile.Name));
     309      }
     310      return licenseTextBuilder.ToString();
    295311    }
    296312
Note: See TracChangeset for help on using the changeset viewer.