Author: igorz
Date: 2007-12-23 03:42:23 -0500 (Sun, 23 Dec 2007)
New Revision: 91820
Modified:
trunk/mcs/class/System.Web/System.Web.UI/ObjectStateFormatter.cs
Log:
refactoring
Modified: trunk/mcs/class/System.Web/System.Web.UI/ObjectStateFormatter.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI/ObjectStateFormatter.cs
2007-12-23 03:21:40 UTC (rev 91819)
+++ trunk/mcs/class/System.Web/System.Web.UI/ObjectStateFormatter.cs
2007-12-23 08:42:23 UTC (rev 91820)
@@ -153,6 +153,10 @@
return "";
#endif
byte [] buffer = Convert.FromBase64String (inputString);
+ return DeserializeInternal (buffer);
+ }
+
+ internal object DeserializeInternal(byte [] buffer) {
int length;
if (buffer == null || (length = buffer.Length) == 0)
throw new ArgumentNullException ("inputString");
@@ -173,7 +177,13 @@
{
if (stateGraph == null)
return "";
-
+ int length;
+ byte [] buffer = SerializeInternal (stateGraph, out
length);
+ return Convert.ToBase64String (buffer, 0, length);
+ }
+
+ internal byte[] SerializeInternal(object stateGraph, out int
length) {
+
MemoryStream ms = new MemoryStream ();
Stream output = ms;
#if NET_2_0
@@ -198,7 +208,9 @@
}
}
- return Convert.ToBase64String (ms.GetBuffer (), 0,
(int) ms.Length);
+
+ length = (int) ms.Length;
+ return ms.GetBuffer ();
}
public void Serialize (Stream outputStream, object stateGraph)
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches