#region License Information
/* HeuristicLab
* Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
*
* This file is part of HeuristicLab.
*
* HeuristicLab is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* HeuristicLab is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with HeuristicLab. If not, see .
*/
#endregion
using System;
namespace HeuristicLab.PluginInfrastructure {
///
/// This attribute can be used to declare that a plugin depends on a another plugin.
///
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
public sealed class PluginDependencyAttribute : System.Attribute {
private string dependency;
///
/// Gets the name of the plugin that is needed to load a plugin.
///
public string Dependency {
get { return dependency; }
}
private Version version;
///
/// Gets the version of the plugin dependency.
///
public Version Version {
get { return version; }
}
///
/// Initializes a new instance of .
///
/// Name of the plugin dependency.
/// Version of the plugin dependency.
public PluginDependencyAttribute(string dependency, string version) {
if (string.IsNullOrEmpty(dependency)) throw new ArgumentException("Dependency name is null or empty.", "dependency");
if (string.IsNullOrEmpty(version)) throw new ArgumentException("Dependency version is null or empty.", "version");
this.dependency = dependency;
this.version = new Version(version); // throws format exception if the version string can't be parsed
}
}
}