| 1 |
// ==++== |
| 2 |
// |
| 3 |
// Copyright (c) Microsoft Corporation. All rights reserved. |
| 4 |
// |
| 5 |
// ==--== |
| 6 |
/*============================================================ |
| 7 |
** |
| 8 |
** File: AssemblyHash |
| 9 |
** |
| 10 |
** |
| 11 |
** Purpose: |
| 12 |
** |
| 13 |
** |
| 14 |
===========================================================*/ |
| 15 |
namespace System.Configuration.Assemblies { |
| 16 |
using System; |
| 17 |
[Serializable] |
| 18 |
[System.Runtime.InteropServices.ComVisible(true)] |
| 19 |
[Obsolete("The AssemblyHash class has been deprecated. http://go.microsoft.com/fwlink/?linkid=14202")] |
| 20 |
public struct AssemblyHash : ICloneable |
| 21 |
{ |
| 22 |
private AssemblyHashAlgorithm _Algorithm; |
| 23 |
private byte[] _Value; |
| 24 |
|
| 25 |
[Obsolete("The AssemblyHash class has been deprecated. http://go.microsoft.com/fwlink/?linkid=14202")] |
| 26 |
public static readonly AssemblyHash Empty = new AssemblyHash(AssemblyHashAlgorithm.None, null); |
| 27 |
|
| 28 |
[Obsolete("The AssemblyHash class has been deprecated. http://go.microsoft.com/fwlink/?linkid=14202")] |
| 29 |
public AssemblyHash(byte[] value) { |
| 30 |
_Algorithm = AssemblyHashAlgorithm.SHA1; |
| 31 |
_Value = null; |
| 32 |
|
| 33 |
if (value != null) { |
| 34 |
int length = value.Length; |
| 35 |
_Value = new byte[length]; |
| 36 |
Array.Copy(value, _Value, length); |
| 37 |
} |
| 38 |
} |
| 39 |
|
| 40 |
[Obsolete("The AssemblyHash class has been deprecated. http://go.microsoft.com/fwlink/?linkid=14202")] |
| 41 |
public AssemblyHash(AssemblyHashAlgorithm algorithm, byte[] value) { |
| 42 |
_Algorithm = algorithm; |
| 43 |
_Value = null; |
| 44 |
|
| 45 |
if (value != null) { |
| 46 |
int length = value.Length; |
| 47 |
_Value = new byte[length]; |
| 48 |
Array.Copy(value, _Value, length); |
| 49 |
} |
| 50 |
} |
| 51 |
|
| 52 |
// Hash is made up of a byte array and a value from a class of supported |
| 53 |
// algorithm types. |
| 54 |
[Obsolete("The AssemblyHash class has been deprecated. http://go.microsoft.com/fwlink/?linkid=14202")] |
| 55 |
public AssemblyHashAlgorithm Algorithm { |
| 56 |
get { return _Algorithm; } |
| 57 |
set { _Algorithm = value; } |
| 58 |
} |
| 59 |
|
| 60 |
[Obsolete("The AssemblyHash class has been deprecated. http://go.microsoft.com/fwlink/?linkid=14202")] |
| 61 |
public byte[] GetValue() { |
| 62 |
return _Value; |
| 63 |
} |
| 64 |
|
| 65 |
[Obsolete("The AssemblyHash class has been deprecated. http://go.microsoft.com/fwlink/?linkid=14202")] |
| 66 |
public void SetValue(byte[] value) { |
| 67 |
_Value = value; |
| 68 |
} |
| 69 |
|
| 70 |
[Obsolete("The AssemblyHash class has been deprecated. http://go.microsoft.com/fwlink/?linkid=14202")] |
| 71 |
public Object Clone() { |
| 72 |
return new AssemblyHash(_Algorithm, _Value); |
| 73 |
} |
| 74 |
} |
| 75 |
|
| 76 |
} |