Free cookie consent management tool by TermsFeed Policy Generator

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

Last change on this file since 21 was 2, checked in by swagner, 17 years ago

Added HeuristicLab 3.0 sources from former SVN repository at revision 52

File size: 2.7 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    public override string ToString() {
71      return Name;
72    }
73
74    // equals and hashcode have to be implemented because we want to compare PluginDescriptions from
75    // different AppDomains and serialization destroys reference equality
76    public override bool Equals(object obj) {
77      if(!(obj is PluginInfo))
78        return false;
79      PluginInfo other = (PluginInfo)obj;
80
81      return other.Name == this.Name && other.Version == this.Version;
82    }
83
84    public override int GetHashCode() {
85      return name.GetHashCode() + version.GetHashCode();
86    }
87  }
88}
Note: See TracBrowser for help on using the repository browser.