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