#region License Information /* HeuristicLab * Copyright (C) 2002-2018 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 { /// /// Enumerator of available file types for a plugin. /// public enum PluginFileType { /// /// CLR assembly files are loaded by the plugin infrastructure. /// Assembly, /// /// Native DLL files are ignored by the plugin infrastructure. /// NativeDll, /// /// Data files are any kind of support file for your plugin. /// Data, /// /// License files contain the license text of the plugin (ASCII encoding). /// License }; /// /// PluginFileAttribute can be used to declare which files make up an plugin. /// Multiple files can be associated to an plugin. Each file should be associated to only one plugin. /// [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)] public sealed class PluginFileAttribute : System.Attribute { private string fileName; /// /// Gets the file name of the plugin. /// public string FileName { get { return fileName; } } private PluginFileType fileType = PluginFileType.Data; /// /// Gets the file type of the plugin file. /// public PluginFileType FileType { get { return fileType; } } /// /// Initializes a new instance of . /// Name of the file /// Type of the file (Assembly, NativeDll, Data, License) /// public PluginFileAttribute(string fileName, PluginFileType fileType) { if (string.IsNullOrEmpty(fileName)) throw new ArgumentException("File name is empty.", "fileName"); // NB: doesn't check if the file actually exists this.fileName = fileName; this.fileType = fileType; } } }