Free cookie consent management tool by TermsFeed Policy Generator

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

Last change on this file since 37 was 37, checked in by gkronber, 16 years ago
  • fixed #37. Assemblies that have missing references (wrong versions) are also listed in the disabled plugins.
  • plugin-manager shows a message why a plugin has been disabled (see #8)
File size: 2.9 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
35    public string Name {
36      get { return name; }
37      set { name = value; }
38    }
39
40    private Version version;
41
42    public Version Version {
43      get { return version; }
44      set { version = value; }
45    }
46
47    private List<string> files = new List<string> ();
48    /// <summary>
49    /// Names of all files that belong to this plugin.
50    /// These files are deleted when the plugin is removed or updated.
51    /// </summary>
52    public List<string> Files {
53      get { return files; }
54    }
55
56    private List<PluginInfo> dependencies = new List<PluginInfo> ();
57    public List<PluginInfo> Dependencies {
58      get { return dependencies; }
59    }
60    private List<string> assemblies = new List<string>();
61
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
70
71    private string message;
72    public string Message {
73      get { return message; }
74      set { message = value; }
75    }
76
77    public override string ToString() {
78      return Name;
79    }
80
81    // equals and hashcode have to be implemented because we want to compare PluginDescriptions from
82    // different AppDomains and serialization destroys reference equality
83    public override bool Equals(object obj) {
84      if(!(obj is PluginInfo))
85        return false;
86      PluginInfo other = (PluginInfo)obj;
87
88      return other.Name == this.Name && other.Version == this.Version;
89    }
90
91    public override int GetHashCode() {
92      if(version != null) {
93        return name.GetHashCode() + version.GetHashCode();
94      } else return name.GetHashCode();
95    }
96  }
97}
Note: See TracBrowser for help on using the repository browser.