Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.PluginInfrastructure/3.3/Advanced/DeploymentService/PluginDescription.cs @ 4068

Last change on this file since 4068 was 4068, checked in by swagner, 14 years ago

Sorted usings and removed unused usings in entire solution (#1094)

File size: 4.3 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
4 *
5 * This file is part of HeuristicLab.
6 *
7 * HeuristicLab is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * HeuristicLab is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
19 */
20#endregion
21
22using System;
23using System.Collections.Generic;
24using System.Linq;
25
26namespace HeuristicLab.PluginInfrastructure.Advanced.DeploymentService {
27  // extension of auto-generated DataContract class PluginDescription
28  public partial class PluginDescription : IPluginDescription {
29    /// <summary>
30    /// Initializes an new instance of <see cref="PluginDescription" />
31    /// with no dependencies, empty contact details and empty license text.
32    /// </summary>
33    /// <param name="name">Name of the plugin</param>
34    /// <param name="version">Version of the plugin</param>
35    public PluginDescription(string name, Version version) : this(name, version, new List<PluginDescription>()) { }
36    /// <summary>
37    /// Initializes a new instance of <see cref="PluginDescription" />
38    /// with empty contact details and empty license text.
39    /// </summary>
40    /// <param name="name">Name of the plugin</param>
41    /// <param name="version">Version of the plugin</param>
42    /// <param name="dependencies">Enumerable of dependencies of the plugin</param>
43    public PluginDescription(string name, Version version, IEnumerable<PluginDescription> dependencies)
44      : this(name, version, dependencies, string.Empty, string.Empty, string.Empty) {
45    }
46
47    /// <summary>
48    /// Initializes a new instance of <see cref="PluginDescription" />.
49    /// </summary>
50    /// <param name="name">Name of the plugin</param>
51    /// <param name="version">Version of the plugin</param>
52    /// <param name="dependencies">Enumerable of dependencies of the plugin</param>
53    /// <param name="contactName">Name of the contact person for the plugin</param>
54    /// <param name="contactEmail">E-mail of the contact person for the plugin</param>
55    /// <param name="licenseText">License text for the plugin</param>
56    public PluginDescription(string name, Version version, IEnumerable<PluginDescription> dependencies, string contactName, string contactEmail, string licenseText) {
57      this.Name = name;
58      this.Version = version;
59      this.Dependencies = dependencies.ToArray();
60      this.LicenseText = licenseText;
61    }
62
63    #region IPluginDescription Members
64    /// <summary>
65    /// Gets the description of the plugin. Always string.Empty.
66    /// </summary>
67    public string Description {
68      get { return string.Empty; }
69    }
70
71    [Obsolete]
72    public DateTime BuildDate {
73      get { throw new NotImplementedException(); }
74    }
75
76    /// <summary>
77    /// Gets an enumerable of dependencies of the plugin
78    /// </summary>
79    IEnumerable<IPluginDescription> IPluginDescription.Dependencies {
80      get {
81        return Dependencies;
82      }
83    }
84
85    /// <summary>
86    /// Gets and enumerable of files that are part of this pluing. Always empty.
87    /// </summary>
88    public IEnumerable<IPluginFile> Files {
89      get { return Enumerable.Empty<IPluginFile>(); }
90    }
91
92    #endregion
93
94    /// <summary>
95    /// ToString override
96    /// </summary>
97    /// <returns>String representation of the PluginDescription (name + version)</returns>
98    public override string ToString() {
99      return Name + " " + Version;
100    }
101
102    public override bool Equals(object obj) {
103      PluginDescription other = obj as PluginDescription;
104      if (other == null) return false;
105      else return other.Name == this.Name && other.Version == this.Version;
106    }
107
108    public override int GetHashCode() {
109      return Name.GetHashCode() + Version.GetHashCode();
110    }
111  }
112}
Note: See TracBrowser for help on using the repository browser.