2
// AssemblyDependency.cs
7
// Copyright (C) 2007 Novell, Inc (http://www.novell.com)
9
// Permission is hereby granted, free of charge, to any person obtaining
10
// a copy of this software and associated documentation files (the
11
// "Software"), to deal in the Software without restriction, including
12
// without limitation the rights to use, copy, modify, merge, publish,
13
// distribute, sublicense, and/or sell copies of the Software, and to
14
// permit persons to whom the Software is furnished to do so, subject to
15
// the following conditions:
17
// The above copyright notice and this permission notice shall be
18
// included in all copies or substantial portions of the Software.
20
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
24
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
25
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30
using System.Collections;
31
using System.Collections.Specialized;
33
using System.Xml.Serialization;
34
using Mono.Addins.Serialization;
36
namespace Mono.Addins.Description
39
/// Definition of a dependency of an add-in on an assembly.
41
[XmlType ("AssemblyDependency")]
42
public class AssemblyDependency: Dependency
48
/// Initializes a new instance of the <see cref="Mono.Addins.Description.AssemblyDependency"/> class.
50
public AssemblyDependency ()
54
internal AssemblyDependency (XmlElement elem): base (elem)
56
fullName = elem.GetAttribute ("name");
57
package = elem.GetAttribute ("package");
60
internal override void Verify (string location, StringCollection errors)
62
VerifyNotEmpty (location + "Dependencies/Assembly/", errors, "name", FullName);
65
internal override void SaveXml (XmlElement parent)
67
CreateElement (parent, "Assembly");
68
Element.SetAttribute ("name", FullName);
69
Element.SetAttribute ("package", Package);
73
/// Gets or sets the full name of the assembly
76
/// The full name of the assembly.
78
public string FullName {
79
get { return fullName != null ? fullName : string.Empty; }
80
set { fullName = value; }
84
/// Gets or sets the name of the package that provides the assembly.
87
/// The name of the package that provides the assembly.
89
public string Package {
90
get { return package != null ? package : string.Empty; }
91
set { package = value; }
95
/// Display name of the dependency
100
public override string Name {
102
if (Package.Length > 0)
103
return FullName + " " + GettextCatalog.GetString ("(provided by {0})", Package);
109
internal override bool CheckInstalled (AddinRegistry registry)
115
internal override void Write (BinaryXmlWriter writer)
118
writer.WriteValue ("fullName", fullName);
119
writer.WriteValue ("package", package);
122
internal override void Read (BinaryXmlReader reader)
125
fullName = reader.ReadStringValue ("fullName");
126
package = reader.ReadStringValue ("package");