Free cookie consent management tool by TermsFeed Policy Generator

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

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.