The Labs \ Source Viewer \ SSCLI \ System.Configuration.Assemblies \ AssemblyHash

  1. // ==++==
  2. //
  3. //
  4. // Copyright (c) 2006 Microsoft Corporation. All rights reserved.
  5. //
  6. // The use and distribution terms for this software are contained in the file
  7. // named license.txt, which can be found in the root of this distribution.
  8. // By using this software in any fashion, you are agreeing to be bound by the
  9. // terms of this license.
  10. //
  11. // You must not remove this notice, or any other, from this software.
  12. //
  13. //
  14. // ==--==
  15. /*============================================================
  16. **
  17. ** File:    AssemblyHash
  18. **
  19. **
  20. ** Purpose:
  21. **
  22. **
  23. ===========================================================*/
  24. namespace System.Configuration.Assemblies
  25. {
  26.     using System;
  27.     [Serializable()]
  28.     [System.Runtime.InteropServices.ComVisible(true)]
  29.     [Obsolete("The AssemblyHash class has been deprecated. http://go.microsoft.com/fwlink/?linkid=14202")]
  30.     public struct AssemblyHash : ICloneable
  31.     {
  32.         private AssemblyHashAlgorithm _Algorithm;
  33.         private byte[] _Value;
  34.        
  35.         [Obsolete("The AssemblyHash class has been deprecated. http://go.microsoft.com/fwlink/?linkid=14202")]
  36.         public static readonly AssemblyHash Empty = new AssemblyHash(AssemblyHashAlgorithm.None, null);
  37.        
  38.         [Obsolete("The AssemblyHash class has been deprecated. http://go.microsoft.com/fwlink/?linkid=14202")]
  39.         public AssemblyHash(byte[] value)
  40.         {
  41.             _Algorithm = AssemblyHashAlgorithm.SHA1;
  42.             _Value = null;
  43.            
  44.             if (value != null) {
  45.                 int length = value.Length;
  46.                 _Value = new byte[length];
  47.                 Array.Copy(value, _Value, length);
  48.             }
  49.         }
  50.        
  51.         [Obsolete("The AssemblyHash class has been deprecated. http://go.microsoft.com/fwlink/?linkid=14202")]
  52.         public AssemblyHash(AssemblyHashAlgorithm algorithm, byte[] value)
  53.         {
  54.             _Algorithm = algorithm;
  55.             _Value = null;
  56.            
  57.             if (value != null) {
  58.                 int length = value.Length;
  59.                 _Value = new byte[length];
  60.                 Array.Copy(value, _Value, length);
  61.             }
  62.         }
  63.        
  64.         // Hash is made up of a byte array and a value from a class of supported
  65.         // algorithm types.
  66.         [Obsolete("The AssemblyHash class has been deprecated. http://go.microsoft.com/fwlink/?linkid=14202")]
  67.         public AssemblyHashAlgorithm Algorithm {
  68.             get { return _Algorithm; }
  69.             set { _Algorithm = value; }
  70.         }
  71.        
  72.         [Obsolete("The AssemblyHash class has been deprecated. http://go.microsoft.com/fwlink/?linkid=14202")]
  73.         public byte[] GetValue()
  74.         {
  75.             return _Value;
  76.         }
  77.        
  78.         [Obsolete("The AssemblyHash class has been deprecated. http://go.microsoft.com/fwlink/?linkid=14202")]
  79.         public void SetValue(byte[] value)
  80.         {
  81.             _Value = value;
  82.         }
  83.        
  84.         [Obsolete("The AssemblyHash class has been deprecated. http://go.microsoft.com/fwlink/?linkid=14202")]
  85.         public object Clone()
  86.         {
  87.             return new AssemblyHash(_Algorithm, _Value);
  88.         }
  89.     }
  90.    
  91. }

Developer Fusion