[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] CVS: pnetlib/System/Collections/Specialized NameOb
From: |
Rhys Weatherley <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] CVS: pnetlib/System/Collections/Specialized NameObjectCollectionBase.cs, 1.4, 1.5 NameValueCollection.cs, 1.5, 1.6 |
Date: |
Wed, 27 Aug 2003 06:38:48 -0400 |
Update of /cvsroot/dotgnu-pnet/pnetlib/System/Collections/Specialized
In directory subversions:/tmp/cvs-serv5427/System/Collections/Specialized
Modified Files:
NameObjectCollectionBase.cs NameValueCollection.cs
Log Message:
Serialization support for classes in "System.Collections.Specialized".
Index: NameObjectCollectionBase.cs
===================================================================
RCS file:
/cvsroot/dotgnu-pnet/pnetlib/System/Collections/Specialized/NameObjectCollectionBase.cs,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** NameObjectCollectionBase.cs 26 May 2003 04:41:20 -0000 1.4
--- NameObjectCollectionBase.cs 27 Aug 2003 10:38:46 -0000 1.5
***************
*** 51,54 ****
--- 51,57 ----
private bool readOnly;
private const int HashTableSize = 61;
+ #if CONFIG_SERIALIZATION
+ private SerializationInfo info;
+ #endif
// Constructors.
***************
*** 88,92 ****
: this(0, null, null)
{
! // TODO: serialization support.
}
#endif
--- 91,95 ----
: this(0, null, null)
{
! this.info = info;
}
#endif
***************
*** 155,159 ****
StreamingContext context)
{
! // TODO: serialization support.
}
--- 158,186 ----
StreamingContext context)
{
! // Validate the parameters.
! if(info == null)
! {
! throw new ArgumentNullException("info");
! }
!
! // Add general information.
! info.AddValue("ReadOnly", readOnly);
! info.AddValue("HashProvider", hcp,
typeof(IHashCodeProvider));
! info.AddValue("Comparer", cmp,
typeof(IComparer));
! info.AddValue("Count", entries.Count);
!
! // Build arrays for the keys and values and
serialize them.
! String[] keys = new String [entries.Count];
! Object[] values = new Object [entries.Count];
! int posn;
! Entry entry;
! for(posn = 0; posn < entries.Count; ++posn)
! {
! entry = (Entry)(entries[posn]);
! keys[posn] = entry.key;
! values[posn] = entry.value;
! }
! info.AddValue("Keys", keys, typeof(String[]));
! info.AddValue("Values", values,
typeof(Object[]));
}
***************
*** 161,165 ****
public virtual void OnDeserialization(Object sender)
{
! // TODO: serialization support.
}
--- 188,237 ----
public virtual void OnDeserialization(Object sender)
{
! // Bail out if we've already been deserialized.
! if(hcp != null)
! {
! return;
! }
!
! // Validate the deserialization state.
! if(info == null)
! {
! throw new SerializationException
! (S._("Serialize_StateMissing"));
! }
!
! // De-serialize the hash provider and comparer.
! hcp = (IHashCodeProvider)(info.GetValue
! ("HashProvider",
typeof(IHashCodeProvider)));
! cmp = (IComparer)(info.GetValue
! ("Comparer",
typeof(IComparer)));
! if(hcp == null || cmp == null)
! {
! throw new SerializationException
! (S._("Serialize_StateMissing"));
! }
!
! // De-serialize the key/value arrays.
! String[] keys = (String[])(info.GetValue
! ("Keys", typeof(String[])));
! Object[] values = (String[])(info.GetValue
! ("Values", typeof(Object[])));
! if(keys == null || values == null)
! {
! throw new SerializationException
! (S._("Serialize_StateMissing"));
! }
! int count = info.GetInt32("Count");
! int posn;
! for(posn = 0; posn < count; ++posn)
! {
! BaseAdd(keys[posn], values[posn]);
! }
!
! // De-serialize the read-only flag last.
! readOnly = info.GetBoolean("ReadOnly");
!
! // De-serialization is complete.
! info = null;
}
Index: NameValueCollection.cs
===================================================================
RCS file:
/cvsroot/dotgnu-pnet/pnetlib/System/Collections/Specialized/NameValueCollection.cs,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** NameValueCollection.cs 26 May 2003 04:41:20 -0000 1.5
--- NameValueCollection.cs 27 Aug 2003 10:38:46 -0000 1.6
***************
*** 70,77 ****
protected NameValueCollection(SerializationInfo info,
StreamingContext context)
! : base(info, context)
! {
! // TODO: serialization support.
! }
#endif
--- 70,74 ----
protected NameValueCollection(SerializationInfo info,
StreamingContext context)
! : base(info, context) {}
#endif
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] CVS: pnetlib/System/Collections/Specialized NameObjectCollectionBase.cs, 1.4, 1.5 NameValueCollection.cs, 1.5, 1.6,
Rhys Weatherley <address@hidden> <=