Free cookie consent management tool by TermsFeed Policy Generator

source: stable/HeuristicLab.Services.Deployment/3.3/PluginDescription.cs @ 11620

Last change on this file since 11620 was 11170, checked in by ascheibe, 10 years ago

#2115 updated copyright year in stable branch

File size: 3.6 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2014 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;
25using System.Runtime.Serialization;
26
27namespace HeuristicLab.Services.Deployment {
28  [DataContract(Name = "PluginDescription", IsReference = true)]
29  public class PluginDescription {
30
31    [DataMember(Name = "Name")]
32    private string name;
33    public string Name {
34      get { return name; }
35      set {
36        if (string.IsNullOrEmpty(value)) throw new ArgumentException();
37        name = value;
38      }
39    }
40
41    [DataMember(Name = "Version")]
42    private Version version;
43    public Version Version {
44      get { return version; }
45      set {
46        if (value == null) throw new ArgumentNullException();
47        version = value;
48      }
49    }
50
51    [DataMember(Name = "ContactName")]
52    private string contactName;
53    public string ContactName {
54      get { return contactName; }
55      set {
56        if (value == null) throw new ArgumentNullException();
57        contactName = value;
58      }
59    }
60
61    [DataMember(Name = "ContactEmail")]
62    private string contactEmail;
63    public string ContactEmail {
64      get { return contactEmail; }
65      set {
66        if (value == null) throw new ArgumentNullException();
67        contactEmail = value;
68      }
69    }
70
71    [DataMember(Name = "LicenseText")]
72    private string licenseText;
73    public string LicenseText {
74      get { return licenseText; }
75      set {
76        if (value == null) throw new ArgumentNullException();
77        licenseText = value;
78      }
79    }
80
81    [DataMember(Name = "Dependencies")]
82    private List<PluginDescription> dependencies;
83    public List<PluginDescription> Dependencies {
84      get { return dependencies; }
85      set {
86        if (value == null) throw new ArgumentNullException();
87        dependencies = value;
88      }
89    }
90
91    public PluginDescription(string name, Version version, IEnumerable<PluginDescription> dependencies,
92      string contactName, string contactEmail, string license) {
93      if (string.IsNullOrEmpty(name)) throw new ArgumentException("name is empty");
94      if (version == null || dependencies == null ||
95        contactName == null || contactEmail == null ||
96        license == null) throw new ArgumentNullException();
97      this.name = name;
98      this.version = version;
99      this.dependencies = new List<PluginDescription>(dependencies);
100      this.licenseText = license;
101      this.contactName = contactName;
102      this.contactEmail = contactEmail;
103    }
104
105    public PluginDescription(string name, Version version)
106      : this(name, version, Enumerable.Empty<PluginDescription>()) {
107    }
108
109    public PluginDescription(string name, Version version, IEnumerable<PluginDescription> dependencies)
110      : this(name, version, dependencies, string.Empty, string.Empty, string.Empty) {
111    }
112  }
113}
Note: See TracBrowser for help on using the repository browser.