Restructured repository in preparation of the HeuristicLab 3.3.0 release (#1000)
[heuristiclab.git] / HeuristicLab.PluginInfrastructure / 3.3 / Attributes / PluginFileAttribute.cs
bloba8fe4eac0938b42202793187cf423c48586d0ac3
1 #region License Information
2 /* HeuristicLab
3 * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
5 * This file is part of HeuristicLab.
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.
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.
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/>.
20 #endregion
22 using System;
23 using System.Collections.Generic;
24 using System.Text;
25 using System.IO;
27 namespace HeuristicLab.PluginInfrastructure {
28 /// <summary>
29 /// Enumerator of available file types for a plugin.
30 /// </summary>
31 public enum PluginFileType {
32 /// <summary>
33 /// CLR assembly files are loaded by the plugin infrastructure.
34 /// </summary>
35 Assembly,
36 /// <summary>
37 /// Native DLL files are ignored by the plugin infrastructure.
38 /// </summary>
39 NativeDll,
40 /// <summary>
41 /// Data files are any kind of support file for your plugin.
42 /// </summary>
43 Data,
44 /// <summary>
45 /// License files contain the license text of the plugin (ASCII encoding).
46 /// </summary>
47 License
50 /// <summary>
51 /// PluginFileAttribute can be used to declare which files make up an plugin.
52 /// Multiple files can be associated to an plugin. Each file should be associated to only one plugin.
53 /// </summary>
54 [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
55 public sealed class PluginFileAttribute : System.Attribute {
56 private string fileName;
58 /// <summary>
59 /// Gets the file name of the plugin.
60 /// </summary>
61 public string FileName {
62 get { return fileName; }
65 private PluginFileType fileType = PluginFileType.Data;
67 /// <summary>
68 /// Gets the file type of the plugin file.
69 /// </summary>
70 public PluginFileType FileType {
71 get { return fileType; }
74 /// <summary>
75 /// Initializes a new instance of <see cref="PluginFileAttribute"/>.
76 /// <param name="fileName">Name of the file</param>
77 /// <param name="fileType">Type of the file (Assembly, NativeDll, Data, License)</param>
78 /// </summary>
79 public PluginFileAttribute(string fileName, PluginFileType fileType) {
80 if (string.IsNullOrEmpty(fileName)) throw new ArgumentException("File name is empty.", "fileName");
81 // NB: doesn't check if the file actually exists
82 this.fileName = fileName;
83 this.fileType = fileType;