PageRenderTime 46ms CodeModel.GetById 20ms RepoModel.GetById 0ms 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
Possible License(s): GPL-2.0, MPL-2.0-no-copyleft-exception, CPL-1.0, CC-BY-SA-3.0, BSD-3-Clause, ISC, AGPL-3.0, LGPL-2.1, Apache-2.0
  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. using System;
  15. using System.Diagnostics.CodeAnalysis;
  16. using System.Globalization;
  17. using System.Runtime.InteropServices;
  18. namespace Microsoft.VisualStudio.Project.Automation
  19. {
  20. [SuppressMessage("Microsoft.Interoperability", "CA1405:ComVisibleTypeBaseTypesShouldBeComVisible")]
  21. [ComVisible(true)]
  22. public class OAComReference : OAReferenceBase<ComReferenceNode>
  23. {
  24. public OAComReference(ComReferenceNode comReference) :
  25. base(comReference)
  26. {
  27. }
  28. #region Reference override
  29. public override string Culture
  30. {
  31. get
  32. {
  33. int locale = 0;
  34. try
  35. {
  36. locale = int.Parse(BaseReferenceNode.LCID, CultureInfo.InvariantCulture);
  37. }
  38. catch(System.FormatException)
  39. {
  40. // Do Nothing
  41. }
  42. if(0 == locale)
  43. {
  44. return string.Empty;
  45. }
  46. CultureInfo culture = new CultureInfo(locale);
  47. return culture.Name;
  48. }
  49. }
  50. public override string Identity
  51. {
  52. get
  53. {
  54. return string.Format(CultureInfo.InvariantCulture, "{0}\\{1}", BaseReferenceNode.TypeGuid.ToString("B"), this.Version);
  55. }
  56. }
  57. public override int MajorVersion
  58. {
  59. get { return BaseReferenceNode.MajorVersionNumber; }
  60. }
  61. public override int MinorVersion
  62. {
  63. get { return BaseReferenceNode.MinorVersionNumber; }
  64. }
  65. public override string Name
  66. {
  67. get { return BaseReferenceNode.Caption; }
  68. }
  69. public override VSLangProj.prjReferenceType Type
  70. {
  71. get
  72. {
  73. return VSLangProj.prjReferenceType.prjReferenceTypeActiveX;
  74. }
  75. }
  76. public override string Version
  77. {
  78. get
  79. {
  80. Version version = new Version(BaseReferenceNode.MajorVersionNumber, BaseReferenceNode.MinorVersionNumber);
  81. return version.ToString();
  82. }
  83. }
  84. #endregion
  85. }
  86. }