PageRenderTime 39ms CodeModel.GetById 35ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/IronPython_Main/Tools/IronStudio/IronStudio/VisualStudio/Project/Automation/VSProject/OAComReference.cs

#
C# | 89 lines | 72 code | 3 blank | 14 comment | 2 complexity | ebfd810ec561ce2579114ffd4f154f57 MD5 | raw file
 1/* ****************************************************************************
 2 *
 3 * Copyright (c) Microsoft Corporation. 
 4 *
 5 * This source code is subject to terms and conditions of the Apache License, Version 2.0. A 
 6 * copy of the license can be found in the License.html file at the root of this distribution. If 
 7 * you cannot locate the Apache License, Version 2.0, please send an email to 
 8 * ironpy@microsoft.com. By using this source code in any fashion, you are agreeing to be bound 
 9 * by the terms of the Apache License, Version 2.0.
10 *
11 * You must not remove this notice, or any other, from this software.
12 *
13 * ***************************************************************************/
14
15using System;
16using System.Diagnostics.CodeAnalysis;
17using System.Globalization;
18using System.Runtime.InteropServices;
19
20namespace Microsoft.VisualStudio.Project.Automation
21{
22	[SuppressMessage("Microsoft.Interoperability", "CA1405:ComVisibleTypeBaseTypesShouldBeComVisible")]
23	[ComVisible(true)]
24	public class OAComReference : OAReferenceBase<ComReferenceNode>
25	{
26		public OAComReference(ComReferenceNode comReference) :
27			base(comReference)
28		{
29		}
30
31		#region Reference override
32		public override string Culture
33		{
34			get
35			{
36				int locale = 0;
37				try
38				{
39					locale = int.Parse(BaseReferenceNode.LCID, CultureInfo.InvariantCulture);
40				}
41				catch(System.FormatException)
42				{
43					// Do Nothing
44				}
45				if(0 == locale)
46				{
47					return string.Empty;
48				}
49				CultureInfo culture = new CultureInfo(locale);
50				return culture.Name;
51			}
52		}
53		public override string Identity
54		{
55			get
56			{
57				return string.Format(CultureInfo.InvariantCulture, "{0}\\{1}", BaseReferenceNode.TypeGuid.ToString("B"), this.Version);
58			}
59		}
60		public override int MajorVersion
61		{
62			get { return BaseReferenceNode.MajorVersionNumber; }
63		}
64		public override int MinorVersion
65		{
66			get { return BaseReferenceNode.MinorVersionNumber; }
67		}
68		public override string Name
69		{
70			get { return BaseReferenceNode.Caption; }
71		}
72		public override VSLangProj.prjReferenceType Type
73		{
74			get
75			{
76				return VSLangProj.prjReferenceType.prjReferenceTypeActiveX;
77			}
78		}
79		public override string Version
80		{
81			get
82			{
83				Version version = new Version(BaseReferenceNode.MajorVersionNumber, BaseReferenceNode.MinorVersionNumber);
84				return version.ToString();
85			}
86		}
87		#endregion
88	}
89}