1 | #region License Information
|
---|
2 | /* HeuristicLab
|
---|
3 | * Copyright (C) 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 |
|
---|
22 | using System;
|
---|
23 | using System.Collections.Generic;
|
---|
24 | using System.Linq;
|
---|
25 |
|
---|
26 | namespace 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 | /// <summary>
|
---|
72 | /// Gets an enumerable of dependencies of the plugin
|
---|
73 | /// </summary>
|
---|
74 | IEnumerable<IPluginDescription> IPluginDescription.Dependencies {
|
---|
75 | get {
|
---|
76 | return Dependencies;
|
---|
77 | }
|
---|
78 | }
|
---|
79 |
|
---|
80 | /// <summary>
|
---|
81 | /// Gets and enumerable of files that are part of this pluing. Always empty.
|
---|
82 | /// </summary>
|
---|
83 | public IEnumerable<IPluginFile> Files {
|
---|
84 | get { return Enumerable.Empty<IPluginFile>(); }
|
---|
85 | }
|
---|
86 |
|
---|
87 | #endregion
|
---|
88 |
|
---|
89 | /// <summary>
|
---|
90 | /// ToString override
|
---|
91 | /// </summary>
|
---|
92 | /// <returns>String representation of the PluginDescription (name + version)</returns>
|
---|
93 | public override string ToString() {
|
---|
94 | return Name + " " + Version;
|
---|
95 | }
|
---|
96 |
|
---|
97 | public override bool Equals(object obj) {
|
---|
98 | PluginDescription other = obj as PluginDescription;
|
---|
99 | if (other == null) return false;
|
---|
100 | else return other.Name == this.Name && other.Version == this.Version;
|
---|
101 | }
|
---|
102 |
|
---|
103 | public override int GetHashCode() {
|
---|
104 | return Name.GetHashCode() + Version.GetHashCode();
|
---|
105 | }
|
---|
106 | }
|
---|
107 | }
|
---|