Changeset 2488 for branches/PluginInfrastructure Refactoring/HeuristicLab.PluginInfrastructure/BaseClasses
- Timestamp:
- 11/12/09 17:45:45 (15 years ago)
- Location:
- branches/PluginInfrastructure Refactoring/HeuristicLab.PluginInfrastructure/BaseClasses
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/PluginInfrastructure Refactoring/HeuristicLab.PluginInfrastructure/BaseClasses/ApplicationBase.cs
r2475 r2488 29 29 /// Default implementation for the IApplication interface. 30 30 /// </summary> 31 internalabstract class ApplicationBase : IApplication {31 public abstract class ApplicationBase : IApplication { 32 32 /// <summary> 33 33 /// Initializes a new instance of <see cref="ApplicationBase"/>. … … 35 35 public ApplicationBase() { } 36 36 37 private Application DescriptionAttribute ApplicationDescriptionAttribute {37 private ApplicationAttribute ApplicationAttribute { 38 38 get { 39 object[] app DescAttributes = this.GetType().GetCustomAttributes(typeof(ApplicationDescriptionAttribute), false);39 object[] appAttributes = this.GetType().GetCustomAttributes(typeof(ApplicationAttribute), false); 40 40 41 41 // exactly one attribute of the type ClassInfoAttribute must be given 42 if (app DescAttributes.Length != 1) {43 throw new InvalidPluginException("Found multiple Application DescriptionAttributes on type " + this.GetType());42 if (appAttributes.Length != 1) { 43 throw new InvalidPluginException("Found multiple ApplicationAttributes on type " + this.GetType()); 44 44 } 45 45 46 return (Application DescriptionAttribute)appDescAttributes[0];46 return (ApplicationAttribute)appAttributes[0]; 47 47 } 48 48 } … … 54 54 /// </summary> 55 55 public string Name { 56 get { return Application DescriptionAttribute.Name; }56 get { return ApplicationAttribute.Name; } 57 57 } 58 58 … … 62 62 public Version Version { 63 63 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; 71 65 } 72 66 } … … 77 71 public string Description { 78 72 get { 79 var appDescAttribute = Application DescriptionAttribute;73 var appDescAttribute = ApplicationAttribute; 80 74 // if the description is not explicitly set in the attribute then the name of the application is used as default 81 75 if (string.IsNullOrEmpty(appDescAttribute.Description)) { … … 92 86 public bool RestartOnErrors { 93 87 get { 94 return Application DescriptionAttribute.RestartOnErrors;88 return ApplicationAttribute.RestartOnErrors; 95 89 } 96 90 } -
branches/PluginInfrastructure Refactoring/HeuristicLab.PluginInfrastructure/BaseClasses/PluginBase.cs
r2481 r2488 37 37 public PluginBase() { } 38 38 39 private Plugin DescriptionAttribute PluginDescriptionAttribute {39 private PluginAttribute PluginAttribute { 40 40 get { 41 object[] pluginAttributes = this.GetType().GetCustomAttributes(typeof(Plugin DescriptionAttribute), false);41 object[] pluginAttributes = this.GetType().GetCustomAttributes(typeof(PluginAttribute), false); 42 42 // exactly one attribute of the type PluginDescriptionAttribute must be given 43 43 if (pluginAttributes.Length != 1) { 44 throw new InvalidPluginException("Found multiple Plugin DescriptionAttributes on type " + this.GetType());44 throw new InvalidPluginException("Found multiple PluginAttributes on type " + this.GetType()); 45 45 } 46 return (Plugin DescriptionAttribute)pluginAttributes[0];46 return (PluginAttribute)pluginAttributes[0]; 47 47 } 48 48 } … … 52 52 public string Name { 53 53 get { 54 return Plugin DescriptionAttribute.Name;54 return PluginAttribute.Name; 55 55 } 56 56 }
Note: See TracChangeset
for help on using the changeset viewer.