ReferenceList.cs 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. //
  2. // ReferenceList.cs - ReferenceList implementation for XML Encryption
  3. // http://www.w3.org/2001/04/xmlenc#sec-ReferenceList
  4. //
  5. // Author:
  6. // Tim Coleman ([email protected])
  7. //
  8. // Copyright (C) Tim Coleman, 2004
  9. #if NET_1_2
  10. using System.Collections;
  11. using System.Xml;
  12. namespace System.Security.Cryptography.Xml {
  13. public sealed class ReferenceList : IList, ICollection, IEnumerable {
  14. #region Fields
  15. ArrayList list;
  16. #endregion // Fields
  17. #region Constructors
  18. public ReferenceList ()
  19. {
  20. list = new ArrayList ();
  21. }
  22. #endregion // Constructors
  23. #region Properties
  24. public int Count {
  25. get { return list.Count; }
  26. }
  27. object IList.this [int index] {
  28. get { return this [index]; }
  29. set { this [index] = (EncryptedReference) value; }
  30. }
  31. public bool IsFixedSize {
  32. get { return list.IsFixedSize; }
  33. }
  34. public bool IsReadOnly {
  35. get { return list.IsReadOnly; }
  36. }
  37. public bool IsSynchronized {
  38. get { return list.IsSynchronized; }
  39. }
  40. public EncryptedReference this [int oid] {
  41. get { return (EncryptedReference) list [oid]; }
  42. set { this [oid] = value; }
  43. }
  44. public object SyncRoot {
  45. get { return list.SyncRoot; }
  46. }
  47. #endregion // Properties
  48. #region Methods
  49. public int Add (object value)
  50. {
  51. if (!(value is EncryptedReference))
  52. throw new ArgumentException ("value");
  53. return list.Add (value);
  54. }
  55. public void Clear ()
  56. {
  57. list.Clear ();
  58. }
  59. public bool Contains (object value)
  60. {
  61. return list.Contains (value);
  62. }
  63. public void CopyTo (Array array, int index)
  64. {
  65. list.CopyTo (array, index);
  66. }
  67. public IEnumerator GetEnumerator ()
  68. {
  69. return list.GetEnumerator ();
  70. }
  71. public int IndexOf (object value)
  72. {
  73. return list.IndexOf (value);
  74. }
  75. public void Insert (int index, object value)
  76. {
  77. if (!(value is EncryptedReference))
  78. throw new ArgumentException ("value");
  79. list.Insert (index, value);
  80. }
  81. public void Remove (object value)
  82. {
  83. list.Remove (value);
  84. }
  85. public void RemoveAt (int index)
  86. {
  87. list.RemoveAt (index);
  88. }
  89. #endregion // Methods
  90. }
  91. }
  92. #endif