Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/07/10 21:10:46 (14 years ago)
Author:
gkronber
Message:

Implemented reviewer comments. #893 (HeuristicLab 3.3.0 application review)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.PluginInfrastructure/Advanced/UploadPluginsView.cs

    r3627 r3710  
    118118      var selectedPlugins = (IEnumerable<IPluginDescription>)e.Argument;
    119119      DeploymentService.AdminClient adminClient = DeploymentService.AdminClientFactory.CreateClient();
     120      Dictionary<IPluginDescription, DeploymentService.PluginDescription> cachedPluginDescriptions =
     121        new Dictionary<IPluginDescription, DeploymentService.PluginDescription>();
    120122      try {
    121123        foreach (var plugin in IteratePlugins(selectedPlugins)) {
    122           adminClient.DeployPlugin(MakePluginDescription(plugin), CreateZipPackage(plugin));
     124          adminClient.DeployPlugin(MakePluginDescription(plugin, cachedPluginDescriptions), CreateZipPackage(plugin));
    123125        }
    124126        adminClient.Close();
     
    227229        var matchingLocalPlugin = (from localPlugin in localAndServerPlugins.Keys
    228230                                   where localPlugin.Name == plugin.Name
    229                                    where localPlugin.Version == localPlugin.Version
     231                                   where localPlugin.Version == plugin.Version
    230232                                   select localPlugin).SingleOrDefault();
    231233        if (matchingLocalPlugin != null) {
     
    296298    }
    297299
    298     private DeploymentService.PluginDescription MakePluginDescription(IPluginDescription plugin) {
    299       var dependencies = from dep in plugin.Dependencies
    300                          select MakePluginDescription(dep);
    301       return new DeploymentService.PluginDescription(plugin.Name, plugin.Version, dependencies, plugin.ContactName, plugin.ContactEmail, plugin.LicenseText);
     300    private DeploymentService.PluginDescription MakePluginDescription(IPluginDescription plugin, Dictionary<IPluginDescription, DeploymentService.PluginDescription> cachedPluginDescriptions) {
     301      if (!cachedPluginDescriptions.ContainsKey(plugin)) {
     302        var dependencies = (from dep in plugin.Dependencies
     303                            select MakePluginDescription(dep, cachedPluginDescriptions))
     304                           .ToList();
     305        cachedPluginDescriptions.Add(plugin,
     306          new DeploymentService.PluginDescription(plugin.Name, plugin.Version, dependencies, plugin.ContactName, plugin.ContactEmail, plugin.LicenseText));
     307      }
     308      return cachedPluginDescriptions[plugin];
    302309    }
    303310    #endregion
Note: See TracChangeset for help on using the changeset viewer.