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 |
|
---|
22 | using System;
|
---|
23 | using System.Collections.Generic;
|
---|
24 | using System.Linq;
|
---|
25 | using System.Text;
|
---|
26 | using HeuristicLab.PluginInfrastructure.Manager;
|
---|
27 | using System.IO;
|
---|
28 | using System.ComponentModel;
|
---|
29 | using System.Reflection;
|
---|
30 |
|
---|
31 | namespace HeuristicLab.PluginInfrastructure.Advanced.DeploymentService {
|
---|
32 | // extension of auto-generated DataContract class PluginDescription
|
---|
33 | public partial class PluginDescription : IPluginDescription {
|
---|
34 | /// <summary>
|
---|
35 | /// Initializes an new instance of <see cref="PluginDescription" />
|
---|
36 | /// with no dependencies, empty contact details and empty license text.
|
---|
37 | /// </summary>
|
---|
38 | /// <param name="name">Name of the plugin</param>
|
---|
39 | /// <param name="version">Version of the plugin</param>
|
---|
40 | public PluginDescription(string name, Version version) : this(name, version, new List<PluginDescription>()) { }
|
---|
41 | /// <summary>
|
---|
42 | /// Initializes a new instance of <see cref="PluginDescription" />
|
---|
43 | /// with empty contact details and empty license text.
|
---|
44 | /// </summary>
|
---|
45 | /// <param name="name">Name of the plugin</param>
|
---|
46 | /// <param name="version">Version of the plugin</param>
|
---|
47 | /// <param name="dependencies">Enumerable of dependencies of the plugin</param>
|
---|
48 | public PluginDescription(string name, Version version, IEnumerable<PluginDescription> dependencies)
|
---|
49 | : this(name, version, dependencies, string.Empty, string.Empty, string.Empty) {
|
---|
50 | }
|
---|
51 |
|
---|
52 | /// <summary>
|
---|
53 | /// Initializes a new instance of <see cref="PluginDescription" />.
|
---|
54 | /// </summary>
|
---|
55 | /// <param name="name">Name of the plugin</param>
|
---|
56 | /// <param name="version">Version of the plugin</param>
|
---|
57 | /// <param name="dependencies">Enumerable of dependencies of the plugin</param>
|
---|
58 | /// <param name="contactName">Name of the contact person for the plugin</param>
|
---|
59 | /// <param name="contactEmail">E-mail of the contact person for the plugin</param>
|
---|
60 | /// <param name="licenseText">License text for the plugin</param>
|
---|
61 | public PluginDescription(string name, Version version, IEnumerable<PluginDescription> dependencies, string contactName, string contactEmail, string licenseText) {
|
---|
62 | this.Name = name;
|
---|
63 | this.Version = version;
|
---|
64 | this.Dependencies = dependencies.ToArray();
|
---|
65 | this.LicenseText = licenseText;
|
---|
66 | }
|
---|
67 |
|
---|
68 | #region IPluginDescription Members
|
---|
69 | /// <summary>
|
---|
70 | /// Gets the description of the plugin. Always string.Empty.
|
---|
71 | /// </summary>
|
---|
72 | public string Description {
|
---|
73 | get { return string.Empty; }
|
---|
74 | }
|
---|
75 |
|
---|
76 | [Obsolete]
|
---|
77 | public DateTime BuildDate {
|
---|
78 | get { throw new NotImplementedException(); }
|
---|
79 | }
|
---|
80 |
|
---|
81 | /// <summary>
|
---|
82 | /// Gets an enumerable of dependencies of the plugin
|
---|
83 | /// </summary>
|
---|
84 | IEnumerable<IPluginDescription> IPluginDescription.Dependencies {
|
---|
85 | get {
|
---|
86 | return Dependencies;
|
---|
87 | }
|
---|
88 | }
|
---|
89 |
|
---|
90 | /// <summary>
|
---|
91 | /// Gets and enumerable of files that are part of this pluing. Always empty.
|
---|
92 | /// </summary>
|
---|
93 | public IEnumerable<IPluginFile> Files {
|
---|
94 | get { return Enumerable.Empty<IPluginFile>(); }
|
---|
95 | }
|
---|
96 |
|
---|
97 | #endregion
|
---|
98 |
|
---|
99 | /// <summary>
|
---|
100 | /// ToString override
|
---|
101 | /// </summary>
|
---|
102 | /// <returns>String representation of the PluginDescription (name + version)</returns>
|
---|
103 | public override string ToString() {
|
---|
104 | return Name + " " + Version;
|
---|
105 | }
|
---|
106 |
|
---|
107 | public override bool Equals(object obj) {
|
---|
108 | PluginDescription other = obj as PluginDescription;
|
---|
109 | if (other == null) return false;
|
---|
110 | else return other.Name == this.Name && other.Version == this.Version;
|
---|
111 | }
|
---|
112 |
|
---|
113 | public override int GetHashCode() {
|
---|
114 | return Name.GetHashCode() + Version.GetHashCode();
|
---|
115 | }
|
---|
116 | }
|
---|
117 | }
|
---|