+2005-09-27 Chris Toshok <toshok@ximian.com>
+
+ * Microsoft.Web.Services/JavaScriptObjectDeserializer.cs: new
+ file.
+
+ * Microsoft.Web.Services/JavaScriptConverter.cs: new file.
+
+ * Microsoft.Web.Services.Converters/DateTimeConverter.cs: new
+ file.
+
2005-09-27 Chris Toshok <toshok@ximian.com>
* Microsoft.Web/ScriptEvent.cs (RenderActions): remove the
--- /dev/null
+//
+// Microsoft.Web.Services.Converters.DateTimeConverter
+//
+// Author:
+// Chris Toshok (toshok@ximian.com)
+//
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using System;
+using System.Web;
+using Microsoft.Web.Services;
+
+namespace Microsoft.Web.Services.Converters
+{
+ public class DateTimeConverter : JavaScriptConverter
+ {
+ public DateTimeConverter ()
+ {
+ }
+
+ public override object Deserialize (string s, Type t)
+ {
+ return JavaScriptObjectDeserializer.Deserialize (s, t);
+ }
+
+ protected override string GetClientTypeName (Type serverType)
+ {
+ return "Date";
+ }
+
+ protected override void Initialize ()
+ {
+ }
+
+ public override string Serialize (object o)
+ {
+ if (o == null || o.GetType () != typeof (DateTime))
+ throw new ArgumentException ("Value does not fall within the expected range.");
+
+ DateTime dt = (DateTime)o;
+
+ return String.Format ("new Date({0},{1},{2},{3},{4},{5})",
+ dt.Year, dt.Month - 1, dt.Day, dt.Hour, dt.Minute, dt.Second);
+ }
+
+ public string JavaScript {
+ get {
+ return null;
+ }
+
+ }
+
+ Type[] supportedTypes;
+ protected override Type[] SupportedTypes {
+ get {
+ if (supportedTypes == null) {
+ supportedTypes = new Type[1];
+ supportedTypes[0] = typeof (DateTime);
+ }
+
+ return supportedTypes;
+ }
+ }
+ }
+}
+
+#endif
--- /dev/null
+//
+// Microsoft.Web.Services.JavaScriptConverter
+//
+// Author:
+// Chris Toshok (toshok@ximian.com)
+//
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using System;
+using System.Web;
+
+namespace Microsoft.Web.Services
+{
+ public abstract class JavaScriptConverter
+ {
+ protected JavaScriptConverter ()
+ {
+ }
+
+ public virtual object Deserialize (string s, Type t)
+ {
+ return null;
+ }
+
+ public object Deserialize (string s)
+ {
+ return Deserialize (s, null);
+ }
+
+ protected virtual string GetClientTypeName (Type serverType)
+ {
+ return null;
+ }
+
+ internal static JavaScriptConverter GetConverter (Type t)
+ {
+ return null;
+ }
+
+ public static string GetConverterScript (Type t)
+ {
+ return null;
+ }
+
+ protected virtual void Initialize ()
+ {
+ }
+
+ protected void RegisterJavaScript (string javascript)
+ {
+ }
+
+ public virtual string Serialize (object o)
+ {
+ return null;
+ }
+
+ public string JavaScript {
+ get {
+ return null;
+ }
+
+ }
+
+ protected virtual Type[] SupportedTypes {
+ get {
+ return null;
+ }
+ }
+ }
+}
+
+#endif
--- /dev/null
+//
+// Microsoft.Web.Services.JavaScriptObjectDeserializer
+//
+// Author:
+// Chris Toshok (toshok@ximian.com)
+//
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using System;
+using System.Web;
+
+namespace Microsoft.Web.Services
+{
+ public class JavaScriptObjectDeserializer
+ {
+ public static object Deserialize (string input, Type t)
+ {
+ return null;
+ }
+
+ public static object Deserialize (string input)
+ {
+ return null;
+ }
+
+ public static bool IsClientInstantiatableType (Type t)
+ {
+ return false;
+ }
+ }
+}
+
+#endif