Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.PluginInfrastructure/PluginInfo.cs @ 370

Last change on this file since 370 was 91, checked in by gkronber, 17 years ago
  • added an attribute for the build time of an assembly.
  • build-date is automatically updated via SubWCRev in the pre-build action.
  • adapted PluginManager to correctly handle plugins with same version but newer build date

fixes ticket #39

File size: 3.0 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2008 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;
25
26namespace HeuristicLab.PluginInfrastructure {
27  /// <summary>
28  /// Holds information of loaded plugins that is needed for plugin management.
29  /// Used to represent plugins in AppDomains without loading the plugin assemblies.
30  /// </summary>
31  [Serializable]
32  public class PluginInfo {
33    private string name;
34    public string Name {
35      get { return name; }
36      set { name = value; }
37    }
38    private Version version;
39    public Version Version {
40      get { return version; }
41      set { version = value; }
42    }
43    private DateTime buildDate;
44    public DateTime BuildDate {
45      get { return buildDate; }
46      set { buildDate = value; }
47    }
48    private List<string> files = new List<string>();
49    /// <summary>
50    /// Names of all files that belong to this plugin.
51    /// These files are deleted when the plugin is removed or updated.
52    /// </summary>
53    public List<string> Files {
54      get { return files; }
55    }
56
57    private List<PluginInfo> dependencies = new List<PluginInfo>();
58    public List<PluginInfo> Dependencies {
59      get { return dependencies; }
60    }
61    private List<string> assemblies = new List<string>();
62    /// <summary>
63    /// Names of the assemblies that belong to this plugin.
64    /// </summary>
65    public List<string> Assemblies {
66      get { return assemblies; }
67      set { assemblies = value; }
68    }
69    private string message;
70    public string Message {
71      get { return message; }
72      set { message = value; }
73    }
74    public override string ToString() {
75      return Name;
76    }
77    // equals and hashcode have to be implemented because we want to compare PluginDescriptions from
78    // different AppDomains and serialization destroys reference equality
79    public override bool Equals(object obj) {
80      if(!(obj is PluginInfo))
81        return false;
82      PluginInfo other = (PluginInfo)obj;
83
84      return other.Name == this.Name && other.Version == this.Version;
85    }
86    public override int GetHashCode() {
87      if(version != null) {
88        return name.GetHashCode() + version.GetHashCode();
89      } else return name.GetHashCode();
90    }
91  }
92}
Note: See TracBrowser for help on using the repository browser.