Free cookie consent management tool by TermsFeed Policy Generator

source: branches/3.2/sources/HeuristicLab.PluginInfrastructure/Attributes/PluginFileAttribute.cs @ 8309

Last change on this file since 8309 was 3092, checked in by gkronber, 15 years ago

Fixed relevant warnings in the plugin infrastructure (didn't fix warnings about XML comments of members that will be removed soon). #915 (Remove warnings from HL 3.3 solution)

File size: 2.9 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2010 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.Text;
25using System.IO;
26
27namespace 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
48  };
49
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;
57
58    /// <summary>
59    /// Gets the file name of the plugin.
60    /// </summary>
61    public string FileName {
62      get { return fileName; }
63    }
64
65    private PluginFileType fileType = PluginFileType.Data;
66
67    /// <summary>
68    /// Gets the file type of the plugin file.
69    /// </summary>
70    public PluginFileType FileType {
71      get { return fileType; }
72    }
73
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;
84    }
85  }
86}
Note: See TracBrowser for help on using the repository browser.