AssemblyName.cs 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. //
  2. // System.Reflection/AssemblyName.cs
  3. //
  4. // Author:
  5. // Paolo Molaro ([email protected])
  6. //
  7. // (C) 2001 Ximian, Inc. http://www.ximian.com
  8. //
  9. using System;
  10. using System.Reflection;
  11. using System.Globalization;
  12. using System.Configuration.Assemblies;
  13. using System.Runtime.Serialization;
  14. namespace System.Reflection {
  15. [Serializable]
  16. public sealed class AssemblyName : ISerializable // ICloneable, , IDeserializationCallback
  17. {
  18. string name = "";
  19. string codebase;
  20. int major, minor, build, revision;
  21. CultureInfo cultureinfo;
  22. AssemblyNameFlags flags;
  23. AssemblyHashAlgorithm hashalg;
  24. StrongNameKeyPair keypair;
  25. AssemblyVersionCompatibility versioncompat;
  26. public AssemblyName ()
  27. {
  28. }
  29. internal AssemblyName (SerializationInfo si, StreamingContext sc)
  30. {
  31. name = si.GetString ("_Name");
  32. codebase = si.GetString ("_CodeBase");
  33. Version = (Version)si.GetValue ("_Version", typeof (Version));
  34. }
  35. public string Name {
  36. get {
  37. return name;
  38. }
  39. set {
  40. name = value;
  41. }
  42. }
  43. public string CodeBase {
  44. get {
  45. return codebase;
  46. }
  47. set {
  48. codebase = value;
  49. }
  50. }
  51. [MonoTODO]
  52. public string EscapedCodeBase {
  53. get {
  54. return codebase;
  55. }
  56. }
  57. public CultureInfo CultureInfo {
  58. get {
  59. return cultureinfo;
  60. }
  61. set {
  62. cultureinfo = value;
  63. }
  64. }
  65. public AssemblyNameFlags Flags {
  66. get {
  67. return flags;
  68. }
  69. set {
  70. flags = value;
  71. }
  72. }
  73. [MonoTODO]
  74. public string FullName {
  75. get {
  76. return name;
  77. }
  78. }
  79. public AssemblyHashAlgorithm HashAlgorithm {
  80. get {
  81. return hashalg;
  82. }
  83. set {
  84. hashalg = value;
  85. }
  86. }
  87. public StrongNameKeyPair KeyPair {
  88. get {
  89. return keypair;
  90. }
  91. set {
  92. keypair = value;
  93. }
  94. }
  95. public Version Version {
  96. get {
  97. return new Version (major, minor, build, revision);
  98. }
  99. set {
  100. major = value.Major;
  101. minor = value.Minor;
  102. build = value.Build;
  103. revision = value.Revision;
  104. }
  105. }
  106. public AssemblyVersionCompatibility VersionCompatibility {
  107. get {
  108. return versioncompat;
  109. }
  110. set {
  111. versioncompat = value;
  112. }
  113. }
  114. public override int GetHashCode ()
  115. {
  116. return name.GetHashCode ();
  117. }
  118. public override bool Equals (object o)
  119. {
  120. if (!(o is System.Reflection.AssemblyName))
  121. return false;
  122. AssemblyName an = (AssemblyName)o;
  123. if (an.name == this.name)
  124. return true;
  125. return false;
  126. }
  127. [MonoTODO]
  128. public byte[] GetPublicKeyToken() {
  129. return new byte[0];
  130. }
  131. public void GetObjectData (SerializationInfo info, StreamingContext context)
  132. {
  133. info.AddValue ("_Name", name);
  134. info.AddValue ("_CodeBase", codebase);
  135. info.AddValue ("_Version", Version);
  136. }
  137. }
  138. }