Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

108 lines
2.5 KiB

  1. using System;
  2. using System.Text;
  3. using System.Collections;
  4. namespace Microsoft.Fusion.ADF
  5. {
  6. // A class for storing values associated with assembly's identity.
  7. // Standard information, such as name, version, public key token,
  8. // processor architecture, and culture are explicitly stored as
  9. // properties, while any other custom attributes can be set using
  10. // this class as a hashtable.
  11. public class AssemblyIdentity
  12. {
  13. private string name;
  14. private Version vers;
  15. private string pktString;
  16. private string procArch;
  17. private string lang;
  18. private Hashtable properties;
  19. public AssemblyIdentity(string name, Version vers, string pktString, string procArch, string lang)
  20. {
  21. this.name = "";
  22. if(name != null) this.name = name;
  23. this.vers = new Version(0, 0, 0, 0);
  24. if(vers != null) this.vers = vers;
  25. this.pktString = "";
  26. if(pktString != null) this.pktString = pktString;
  27. this.procArch = "";
  28. if(procArch != null) this.procArch = procArch;
  29. this.lang = "";
  30. if(lang != null) this.lang = lang;
  31. properties = new Hashtable();
  32. properties[AssemblyIdentityStandardProps.Name] = this.name;
  33. properties[AssemblyIdentityStandardProps.Version] = this.vers.ToString();
  34. properties[AssemblyIdentityStandardProps.PubKeyTok] = this.pktString;
  35. properties[AssemblyIdentityStandardProps.ProcArch] = this.procArch;
  36. properties[AssemblyIdentityStandardProps.Lang] = this.lang;
  37. }
  38. public string Name
  39. {
  40. get
  41. {
  42. return name;
  43. }
  44. }
  45. public Version Vers
  46. {
  47. get
  48. {
  49. return vers;
  50. }
  51. }
  52. public string PublicKeyTokenString
  53. {
  54. get
  55. {
  56. return pktString;
  57. }
  58. }
  59. public string ProcessorArchitecture
  60. {
  61. get
  62. {
  63. return procArch;
  64. }
  65. }
  66. public string Language
  67. {
  68. get
  69. {
  70. return lang;
  71. }
  72. }
  73. public string FullName
  74. {
  75. get
  76. {
  77. StringBuilder sb = new StringBuilder();
  78. sb.Append("name=" + this.name);
  79. sb.Append(", version=" + this.vers.ToString());
  80. sb.Append(", pubKeyTok=" + this.pktString);
  81. sb.Append(", procArch=" + this.procArch);
  82. sb.Append(", lang=" + this.lang);
  83. return sb.ToString();
  84. }
  85. }
  86. public string this[string index]
  87. {
  88. get { return (string) properties[index]; }
  89. set
  90. {
  91. if(properties[index] == null) properties[index] = (object) value;
  92. //else throw new Exception("Property " + index + " of this AssemblyIdentity is already set");
  93. }
  94. }
  95. }
  96. }