Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/18/09 18:33:30 (15 years ago)
Author:
gkronber
Message:

Worked on core of plugin infrastructure.

  • Collected all classes into a single assembly (HL.PluginInfrastructure)
  • Moved SplashScreen and MainForm from HeuristicLab.exe project into the plugin infrastructure.
  • Introduced namespaces
  • Added strict access modifiers (internal)
  • Fixed most FxCop warnings in plugin infrastructure core.
  • Fixed issues with plugin load/unload events
  • Deleted empty interface IControl

#799

Location:
branches/PluginInfrastructure Refactoring/HeuristicLab.PluginInfrastructure/Attributes
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/PluginInfrastructure Refactoring/HeuristicLab.PluginInfrastructure/Attributes/ApplicationAttribute.cs

    r2488 r2504  
    2727  /// <summary>
    2828  /// This attribute can be used to specify meta data for applications.
    29   /// For example to specify name, version and description of applications.
     29  /// For example to specify name and description of applications.
    3030  /// </summary>
    3131  [AttributeUsage(AttributeTargets.Class)]
    32   public class ApplicationAttribute : System.Attribute {
     32  public sealed class ApplicationAttribute : System.Attribute {
    3333    private string name;
    3434    /// <summary>
    35     /// Gets or sets the name of the application.
     35    /// Gets the name of the application.
    3636    /// </summary>
    3737    public string Name {
    3838      get { return name; }
    39       set { name = value; }
    4039    }
    41 
    42     //private string version;
    43     ///// <summary>
    44     ///// Gets or sets the version of the application.
    45     ///// </summary>
    46     //public string Version {
    47     //  get { return version; }
    48     //  set { version = value; }
    49     //}
    5040
    5141    private string description;
    5242    /// <summary>
    53     /// Gets or sets the description of the application.
     43    /// Gets the description of the application.
    5444    /// </summary>
    5545    public string Description {
    5646      get { return description; }
    57       set { description = value; }
    5847    }
    5948
    6049    private bool restartOnErrors;
    6150    /// <summary>
    62     /// Gets or sets the boolean flag whether the plugin should be automatically restarted when it is closed because of an exception (for services).
     51    /// Gets whether the plugin should be automatically restarted when it is closed because of an exception (for services).
    6352    /// </summary>
    6453    public bool RestartOnErrors {
    6554      get { return restartOnErrors; }
    66       set { restartOnErrors = value; }
    6755    }
    6856
     
    7260    /// </summary>
    7361    public ApplicationAttribute(string name)
    74       : this(name, "") {
     62      : this(name, String.Empty) {
    7563    }
    7664
     
    8472    }
    8573
    86     ///// <summary>
    87     ///// Initializes a new instance of <see cref="ApplicationAttribute"/>.
    88     ///// <param name="name">Name of the application</param>
    89     ///// <param name="description">Description of the application</param>
    90     ///// <param name="version">Version string of the application</param>
    91     ///// </summary>
    92     //public ApplicationAttribute(string name, string description, string version)
    93     //  : this(name, description, version, false) {
    94     //}
    95 
    9674    /// <summary>
    9775    /// Initializes a new instance of <see cref="ApplicationAttribute"/>.
     
    10280    /// </summary>
    10381    public ApplicationAttribute(string name, string description, bool restartOnErrors) {
     82      if (name == null) throw new ArgumentNullException("name", "Application name is null.");
     83      if (description == null) throw new ArgumentNullException("description", "Application description is null.");
    10484      this.name = name;
    10585      this.description = description;
  • branches/PluginInfrastructure Refactoring/HeuristicLab.PluginInfrastructure/Attributes/AssemblyBuildDateAttribute.cs

    r2475 r2504  
    3030  /// </summary>
    3131  [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false)]
    32   public class AssemblyBuildDateAttribute : Attribute {
     32  public sealed class AssemblyBuildDateAttribute : Attribute {
    3333    private DateTime buildDate;
    3434    /// <summary>
    35     /// Gets or sets the build date.
     35    /// Gets the build date.
    3636    /// </summary>
    3737    public DateTime BuildDate {
    3838      get { return buildDate; }
    39       set { buildDate = value; }
    4039    }
     40
    4141    /// <summary>
    4242    /// Initializes a new instance of <see cref="AssemblyBuildDateAttribute"/> with the given
     
    4444    /// </summary>
    4545    /// <exception cref="FormatException">Thrown when the time stamp could not be parsed as build date.</exception>
    46     /// <param name="timeStamp">The build date of the assembly.</param>
    47     public AssemblyBuildDateAttribute(string timeStamp)
     46    /// <param name="buildDate">The build date of the assembly.</param>
     47    public AssemblyBuildDateAttribute(string buildDate)
    4848      : base() {
    49 
    50       if(!DateTime.TryParse(timeStamp, out buildDate)) {
    51         throw new FormatException("Can't parse AssemblyBuildDate " + timeStamp);
     49      if (!DateTime.TryParse(buildDate, out this.buildDate)) {
     50        throw new FormatException("Can't parse AssemblyBuildDate " + buildDate);
    5251      }
    5352    }
  • branches/PluginInfrastructure Refactoring/HeuristicLab.PluginInfrastructure/Attributes/PluginAttribute.cs

    r2488 r2504  
    2727  /// <summary>
    2828  /// This attribute can be used to specify meta data for plugins.
    29   /// For example to specify name, version and description of plugins.
     29  /// For example to specify name and description of plugins.
    3030  /// </summary>
    3131  [AttributeUsage(AttributeTargets.Class)]
    32   public class PluginAttribute : System.Attribute {
     32  public sealed class PluginAttribute : System.Attribute {
    3333    private string name;
    3434    /// <summary>
    35     /// Gets or sets the name of the plugin.
     35    /// Gets the name of the plugin.
    3636    /// </summary>
    3737    public string Name {
    3838      get { return name; }
    39       // set { name = value; }
    4039    }
    41 
    42     //private string version;
    43     ///// <summary>
    44     ///// Gets or sets the version of the plugin.
    45     ///// </summary>
    46     //public string Version {
    47     //  get { return version; }
    48     //  set { version = value; }
    49     //}
    5040
    5141    private string description;
    5242    /// <summary>
    53     /// Gets or sets the description of the plugin.
     43    /// Gets the description of the plugin.
    5444    /// </summary>
    5545    public string Description {
    5646      get { return description; }
    57       // set { description = value; }
    5847    }
    5948
     
    7564      this.description = description;
    7665    }
    77 
    78     ///// <summary>
    79     ///// Initializes a new instance of <see cref="PluginDescriptionAttribute"/>.
    80     ///// <param name="name">Name of the plugin</param>
    81     ///// <param name="description">Description of the plugin</param>
    82     ///// <param name="version">Version string of the plugin</param>
    83     ///// </summary>
    84     //public PluginDescriptionAttribute(string name, string description, string version) {
    85     //  this.name = name;
    86     //  this.version = version;
    87     //  this.description = description;
    88     //}
    8966  }
    9067}
  • branches/PluginInfrastructure Refactoring/HeuristicLab.PluginInfrastructure/Attributes/PluginDependencyAttribute.cs

    r2481 r2504  
    3333
    3434    /// <summary>
    35     /// Gets or sets the name of the plugin that is needed to load a plugin.
     35    /// Gets the name of the plugin that is needed to load a plugin.
    3636    /// </summary>
    3737    public string Dependency {
    3838      get { return dependency; }
    39       // set { dependency = value; }
    4039    }
    4140
     
    4544    /// </summary>
    4645    public PluginDependencyAttribute(string dependency) {
     46      if (string.IsNullOrEmpty(dependency)) throw new ArgumentException("Dependency is null or empty.", "dependency");
    4747      this.dependency = dependency;
    4848    }
  • branches/PluginInfrastructure Refactoring/HeuristicLab.PluginInfrastructure/Attributes/PluginFileAttribute.cs

    r2496 r2504  
    2323using System.Collections.Generic;
    2424using System.Text;
     25using System.IO;
    2526
    2627namespace HeuristicLab.PluginInfrastructure {
     
    4041  /// </summary>
    4142  [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
    42   public class PluginFileAttribute : System.Attribute {
    43     private string filename;
     43  public sealed class PluginFileAttribute : System.Attribute {
     44    private string fileName;
    4445
    4546    /// <summary>
    46     /// Gets or sets the filename of the plugin.
     47    /// Gets the file name of the plugin.
    4748    /// </summary>
    48     public string Filename {
    49       get { return filename; }
    50       //set { filename = value; }
     49    public string FileName {
     50      get { return fileName; }
    5151    }
    5252
    53     private PluginFileType filetype = PluginFileType.Data;
     53    private PluginFileType fileType = PluginFileType.Data;
    5454
    5555    /// <summary>
    56     /// Gets or sets the filetype of the plugin file.
     56    /// Gets the file type of the plugin file.
    5757    /// </summary>
    58     public PluginFileType Filetype {
    59       get { return filetype; }
    60       //set { filetype = value; }
     58    public PluginFileType FileType {
     59      get { return fileType; }
    6160    }
    6261
    6362    /// <summary>
    6463    /// Initializes a new instance of <see cref="PluginFileAttribute"/>.
    65     /// <param name="filename">Name of the file</param>
    66     /// <param name="type">Type of the file (Assembly, Executable, Data, License)</param>
     64    /// <param name="fileName">Name of the file</param>
     65    /// <param name="fileType">Type of the file (Assembly, NativeDll, Data, License)</param>
    6766    /// </summary>
    68     public PluginFileAttribute(string filename, PluginFileType type) {
    69       this.filename = filename;
    70       this.filetype = type;
     67    public PluginFileAttribute(string fileName, PluginFileType fileType) {
     68      if (string.IsNullOrEmpty(fileName)) throw new ArgumentException("File name is empty.", "fileName");
     69      // NB: doesn't check if the file actually exists
     70      this.fileName = fileName;
     71      this.fileType = fileType;
    7172    }
    7273  }
Note: See TracChangeset for help on using the changeset viewer.