Free cookie consent management tool by TermsFeed Policy Generator

source: branches/PluginInfrastructure Refactoring/HeuristicLab.Update.Service/UpdateLocation.svc.cs @ 2553

Last change on this file since 2553 was 2528, checked in by gkronber, 15 years ago

Worked on update location service. #799

File size: 1.5 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Runtime.Serialization;
5using System.ServiceModel;
6using System.Text;
7using System.IO;
8using HeuristicLab.PluginInfrastructure.Manager;
9using ICSharpCode.SharpZipLib.Zip;
10
11namespace HeuristicLab.Update.Service {
12  public class UpdateLocation : IUpdateLocation {
13
14    #region IUpdateLocation Members
15
16    public IEnumerable<PluginInformation> GetAvailablePluginsByName(string name) {
17      using (PluginStoreDataContext ctx = new PluginStoreDataContext()) {
18        return from plugin in ctx.Plugins
19               where MatchingName(name, plugin.Name)
20               select new PluginInformation(plugin.Name, new Version(plugin.Version), plugin.BuildDate);
21      }
22    }
23    public IEnumerable<byte[]> GetPluginFiles(PluginInformation info) {
24      using (PluginStoreDataContext ctx = new PluginStoreDataContext()) {
25        return from plugin in ctx.Plugins
26               from file in ctx.PluginFiles
27               where
28                 plugin.Name == info.Name &&
29                 plugin.BuildDate == info.BuildDate &&
30                 plugin.Version == info.Version.ToString() &&
31                 file.PluginId == plugin.Id
32               select file.Data.ToArray();
33      }
34    }
35    #endregion
36
37
38    private static bool MatchingName(string name, string pluginName) {
39      return name.Equals(pluginName, StringComparison.InvariantCultureIgnoreCase);
40    }
41  }
42}
Note: See TracBrowser for help on using the repository browser.