~ubuntu-branches/ubuntu/trusty/monodevelop/trusty-proposed

« back to all changes in this revision

Viewing changes to external/mono-addins/Mono.Addins/Mono.Addins.Description/AssemblyDependency.cs

  • Committer: Package Import Robot
  • Author(s): Jo Shields
  • Date: 2013-05-12 09:46:03 UTC
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20130512094603-mad323bzcxvmcam0
Tags: upstream-4.0.5+dfsg
ImportĀ upstreamĀ versionĀ 4.0.5+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//
 
2
// AssemblyDependency.cs
 
3
//
 
4
// Author:
 
5
//   Lluis Sanchez Gual
 
6
//
 
7
// Copyright (C) 2007 Novell, Inc (http://www.novell.com)
 
8
//
 
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:
 
16
// 
 
17
// The above copyright notice and this permission notice shall be
 
18
// included in all copies or substantial portions of the Software.
 
19
// 
 
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.
 
27
//
 
28
 
 
29
using System;
 
30
using System.Collections;
 
31
using System.Collections.Specialized;
 
32
using System.Xml;
 
33
using System.Xml.Serialization;
 
34
using Mono.Addins.Serialization;
 
35
 
 
36
namespace Mono.Addins.Description
 
37
{
 
38
        /// <summary>
 
39
        /// Definition of a dependency of an add-in on an assembly.
 
40
        /// </summary>
 
41
        [XmlType ("AssemblyDependency")]
 
42
        public class AssemblyDependency: Dependency
 
43
        {
 
44
                string fullName;
 
45
                string package;
 
46
                
 
47
                /// <summary>
 
48
                /// Initializes a new instance of the <see cref="Mono.Addins.Description.AssemblyDependency"/> class.
 
49
                /// </summary>
 
50
                public AssemblyDependency ()
 
51
                {
 
52
                }
 
53
                
 
54
                internal AssemblyDependency (XmlElement elem): base (elem)
 
55
                {
 
56
                        fullName = elem.GetAttribute ("name");
 
57
                        package = elem.GetAttribute ("package");
 
58
                }
 
59
                
 
60
                internal override void Verify (string location, StringCollection errors)
 
61
                {
 
62
                        VerifyNotEmpty (location + "Dependencies/Assembly/", errors, "name", FullName);
 
63
                }
 
64
                
 
65
                internal override void SaveXml (XmlElement parent)
 
66
                {
 
67
                        CreateElement (parent, "Assembly"); 
 
68
                        Element.SetAttribute ("name", FullName);
 
69
                        Element.SetAttribute ("package", Package);
 
70
                }
 
71
                
 
72
                /// <summary>
 
73
                /// Gets or sets the full name of the assembly
 
74
                /// </summary>
 
75
                /// <value>
 
76
                /// The full name of the assembly.
 
77
                /// </value>
 
78
                public string FullName {
 
79
                        get { return fullName != null ? fullName : string.Empty; }
 
80
                        set { fullName = value; }
 
81
                }
 
82
                
 
83
                /// <summary>
 
84
                /// Gets or sets the name of the package that provides the assembly.
 
85
                /// </summary>
 
86
                /// <value>
 
87
                /// The name of the package that provides the assembly.
 
88
                /// </value>
 
89
                public string Package {
 
90
                        get { return package != null ? package : string.Empty; }
 
91
                        set { package = value; }
 
92
                }
 
93
                
 
94
                /// <summary>
 
95
                /// Display name of the dependency
 
96
                /// </summary>
 
97
                /// <value>
 
98
                /// The name.
 
99
                /// </value>
 
100
                public override string Name {
 
101
                        get {
 
102
                                if (Package.Length > 0)
 
103
                                        return FullName + " " + GettextCatalog.GetString ("(provided by {0})", Package);
 
104
                                else
 
105
                                        return FullName;
 
106
                        }
 
107
                }
 
108
                
 
109
                internal override bool CheckInstalled (AddinRegistry registry)
 
110
                {
 
111
                        // TODO
 
112
                        return true;
 
113
                }
 
114
                
 
115
                internal override void Write (BinaryXmlWriter writer)
 
116
                {
 
117
                        base.Write (writer);
 
118
                        writer.WriteValue ("fullName", fullName);
 
119
                        writer.WriteValue ("package", package);
 
120
                }
 
121
                
 
122
                internal override void Read (BinaryXmlReader reader)
 
123
                {
 
124
                        base.Read (reader);
 
125
                        fullName = reader.ReadStringValue ("fullName");
 
126
                        package = reader.ReadStringValue ("package");
 
127
                }
 
128
        }
 
129
}