Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/12/09 17:45:45 (15 years ago)
Author:
gkronber
Message:

Worked on plugin infrastructure refactoring. (Fully functional revision). #799

Location:
branches/PluginInfrastructure Refactoring/HeuristicLab.PluginInfrastructure/BaseClasses
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/PluginInfrastructure Refactoring/HeuristicLab.PluginInfrastructure/BaseClasses/ApplicationBase.cs

    r2475 r2488  
    2929  /// Default implementation for the IApplication interface.
    3030  /// </summary>
    31   internal abstract class ApplicationBase : IApplication {
     31  public abstract class ApplicationBase : IApplication {
    3232    /// <summary>
    3333    /// Initializes a new instance of <see cref="ApplicationBase"/>.
     
    3535    public ApplicationBase() { }
    3636
    37     private ApplicationDescriptionAttribute ApplicationDescriptionAttribute {
     37    private ApplicationAttribute ApplicationAttribute {
    3838      get {
    39         object[] appDescAttributes = this.GetType().GetCustomAttributes(typeof(ApplicationDescriptionAttribute), false);
     39        object[] appAttributes = this.GetType().GetCustomAttributes(typeof(ApplicationAttribute), false);
    4040
    4141        // exactly one attribute of the type ClassInfoAttribute must be given
    42         if (appDescAttributes.Length != 1) {
    43           throw new InvalidPluginException("Found multiple ApplicationDescriptionAttributes on type " + this.GetType());
     42        if (appAttributes.Length != 1) {
     43          throw new InvalidPluginException("Found multiple ApplicationAttributes on type " + this.GetType());
    4444        }
    4545
    46         return (ApplicationDescriptionAttribute)appDescAttributes[0];
     46        return (ApplicationAttribute)appAttributes[0];
    4747      }
    4848    }
     
    5454    /// </summary>
    5555    public string Name {
    56       get { return ApplicationDescriptionAttribute.Name; }
     56      get { return ApplicationAttribute.Name; }
    5757    }
    5858
     
    6262    public Version Version {
    6363      get {
    64         var appDescAttribute = ApplicationDescriptionAttribute;
    65         // if the version is not explicitly set in the attribute then the version of the assembly is used as default
    66         if (string.IsNullOrEmpty(appDescAttribute.Version)) {
    67           return this.GetType().Assembly.GetName().Version;
    68         } else {
    69           return new Version(appDescAttribute.Version);
    70         }
     64        return this.GetType().Assembly.GetName().Version;
    7165      }
    7266    }
     
    7771    public string Description {
    7872      get {
    79         var appDescAttribute = ApplicationDescriptionAttribute;
     73        var appDescAttribute = ApplicationAttribute;
    8074        // if the description is not explicitly set in the attribute then the name of the application is used as default
    8175        if (string.IsNullOrEmpty(appDescAttribute.Description)) {
     
    9286    public bool RestartOnErrors {
    9387      get {
    94         return ApplicationDescriptionAttribute.RestartOnErrors;
     88        return ApplicationAttribute.RestartOnErrors;
    9589      }
    9690    }
  • branches/PluginInfrastructure Refactoring/HeuristicLab.PluginInfrastructure/BaseClasses/PluginBase.cs

    r2481 r2488  
    3737    public PluginBase() { }
    3838
    39     private PluginDescriptionAttribute PluginDescriptionAttribute {
     39    private PluginAttribute PluginAttribute {
    4040      get {
    41         object[] pluginAttributes = this.GetType().GetCustomAttributes(typeof(PluginDescriptionAttribute), false);
     41        object[] pluginAttributes = this.GetType().GetCustomAttributes(typeof(PluginAttribute), false);
    4242        // exactly one attribute of the type PluginDescriptionAttribute must be given
    4343        if (pluginAttributes.Length != 1) {
    44           throw new InvalidPluginException("Found multiple PluginDescriptionAttributes on type " + this.GetType());
     44          throw new InvalidPluginException("Found multiple PluginAttributes on type " + this.GetType());
    4545        }
    46         return (PluginDescriptionAttribute)pluginAttributes[0];
     46        return (PluginAttribute)pluginAttributes[0];
    4747      }
    4848    }
     
    5252    public string Name {
    5353      get {
    54         return PluginDescriptionAttribute.Name;
     54        return PluginAttribute.Name;
    5555      }
    5656    }
Note: See TracChangeset for help on using the changeset viewer.