Imported Upstream version 3.6.0

Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
This commit is contained in:
Jo Shields
2014-08-13 10:39:27 +01:00
commit a575963da9
50588 changed files with 8155799 additions and 0 deletions

View File

@@ -0,0 +1,347 @@
2010-06-03 Jb Evain <jbevain@novell.com>
* SafeSerializationEventArgs.cs: add new type in net_4_0.
2010-06-03 Jb Evain <jbevain@novell.com>
* ISafeSerializationData.cs: add new interface in net_4_0.
2008-05-22 Miguel de Icaza <miguel@novell.com>
* SerializationCallbacks.cs: This lock has a high contention rate
on ASP.NET web sites, with multiple cores we end up spending a lot
of time on this check.
Rewrite this code to have two code paths since we know that the
cache is append-only.
2008-04-02 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
* IFormatterConverter.cs
* SerializationException.cs
* StreamingContext.cs: Fix parameter names
2006-12-18 Lluis Sanchez Gual <lluis@novell.com>
* FormatterServices.cs: In GetFields, avoid creating a field
clone in some cases where it's not really necessary.
2006-11-13 Jensen Somers <jensen.somers@gmail.com>
* Fixed the Serializable attribute in OnDeserializedAttribute,
OnDeserializingAttribute, OnSerializedAttribute and
OnSerializingAttribute.
2006-11-13 Jensen Somers <jensen.somers@gmail.com>
* Removed [Serializable] from OnDeserializedAttribute,
OnDeserializingAttribute, OnSerializedAttribute,
OnSerializingAttribute.
2006-11-10 Jensen Somers <jensen.somers@gmail.com>
* Added ComVisibleAttribute in the ISerializable,
ISerializationSurrogate and ISurrogateSelector interface.
* Added the sealed keyword to the OnDeserializedAttribute,
OnDeserializingAttribute, OnSerializedAttribute,
OnSerializingAttribute and OptionalFieldAttribute class.
2006-10-30 Robert Jordan <robertj@gmx.net>
* Apply ComVisibleAttribute.
2006-10-29 Robert Jordan <robertj@gmx.net>
* ObjectManager.cs: Add NET_2_0 serialization callbacks.
2006-10-29 Robert Jordan <robertj@gmx.net>
* SerializationObjectManager.cs,
SerializationCallbacks.cs: Add support for NET_2_0 serialization
events. See bug #78594.
2006-08-06 Lluis Sanchez Gual <lluis@novell.com>
* ObjectManager.cs: Add support for nested IObjectReference.
Fixes bug #78749.
2006-07-31 Sebastien Pouliot <sebastien@ximian.com>
* ObjectIDGenerator.cs: Fix ArgumentNullException parameter.
2006-06-04 Miguel de Icaza <miguel@novell.com>
* OptionalFieldAttribute.cs, OnSerializedAttribute.cs,
OnSerializingAttribute.cs, OnDeserializedAttribute.cs,
OnDeserializingAttribute.cs: Added a few attributes for the
version tolerant serialization.
2006-01-04 Raja R Harinath <rharinath@novell.com>
* ObjectManager.cs (ObjectRecord.IsInstanceReady): Fix regression
introduced in previous patch. See the re-opened bug #76931.
2005-12-15 Martin Baulig <martin@ximian.com>
* ObjectManager.cs: When deserializing an object that has a
surrogate, actually check the return value of
ISerializationSurrogate.SetObjectData(); fixes #76931.
2005-10-03 Lluis Sanchez Gual <lluis@novell.com>
* ObjectIDGenerator.cs: Use custom comparer instead of an instance
wrapper. Closes bug #76017.
2005-06-13 Lluis Sanchez Gual <lluis@novell.com>
* Formatter.cs: Properly initialize protected fields. Fixes bug #75233.
2005-05-17 Lluis Sanchez Gual <lluis@novell.com>
* SerializationInfo.cs: Use IsInstanceOfType instead of IsAssignableFrom
since GetType() may not return the correct type if the object is
a remoting proxy.
2005-05-09 Lluis Sanchez Gual <lluis@novell.com>
* FormatterServices.cs: In GetSerializableMembers, private fields
from base classes must include the class name in the field name.
In this case, it now creates a clone of the field with the
modified name. This patch together with r44260 fixes bug #74760.
2004-12-09 Lluis Sanchez Gual <lluis@ximian.com>
* ObjectManager.cs: When deserializing an object that implements
ISerializable, check if a surrogate exists for that object, before
trying to deserialize it as ISerializable. This fixes bug #70104.
2004-06-15 Gert Driesen <drieseng@users.sourceforge.net>
* ObjectIDGenerator.cs: added TODO for serialization
2004-06-09 Duncan Mak <duncan@ximian.com>
* ObjectManager.cs (RegisterObject): Add checks for
ArgumentNullException as well.
2004-06-09 Duncan Mak <duncan@ximian.com>
* SerializationInfoEnumerator.cs: Instead of using
IDictionaryEnumerator from a Hashtable, use a normal IEnumerator
from the newly added ArrayList in SerializationInfo.
* SerializationInfo.cs: Added an extra ArrayList so that we can
keep the SerializationEntrys added in the order.
(SerializationInfo, AddValue): Throw ArgumentNullException
correctly.
2004-06-08 Duncan Mak <duncan@ximian.com>
* ObjectManager.cs (RegisterObject): Throw
ArgumentOutOfRangeException if the objectID parameter is less than
or equal to zero. This check was missing from this particular
overload.
2004-05-14 Marek Safar <marek.safar@seznam.cz>
* SerializationInfo.cs: Removed useless [CLSCompliant (false)]
2003-11-21 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
* FormatterServices.cs: Added CheckTypeSecurity() and
GetSafeUninitializedObject().
2003-11-18 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
* ObjectManager.cs: Fixed header, internalized enum
* Formatter.cs: Implemented
2003-11-11 Lluis Sanchez Gual <lluis@ximian.com>
* FormatterServices.cs: Fixed some comments.
2003-10-21 Lluis Sanchez Gual <lluis@ximian.com>
* SerializationInfo.cs: Fixed bug in GetValue. Use IsAssignableFrom instead
of IsSubclass, since the type can be an interface.
2003-10-18 Lluis Sanchez Gual <lluis@ximian.com>
* FormatterServices.cs: In GetUninitializedObject methdod, reuse
ActivationServices.AllocateUninitializedClassInstance, it does the same.
2003-07-28 Duncan Mak <duncan@ximian.com>
* Formatter.cs (WriteSByte): Added CLSCompliant attribute.
2003-07-26 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* FormatterServices.cs:
(GetSerializableMembers): check that all base types are serializable
when getting their fields. Fixes bug #46875.
2003-07-17 Lluis Sanchez Gual <lluis@ximian.com>
* ObjectIDGenerator.cs: Optimized access to hashtable and reduced the
number of calls to GetType(). (Patch by Paolo).
Also added a NextId property that returns a new Id without registering
an object.
2003-06-26 Lluis Sanchez Gual <lluis@ximian.com>
* SerializationInfo.cs: Fixed bug #44955
2003-05-11 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* FormatterServices.cs: patch from Jean Marc that fixes bug #42742.
2003-02-18 Lluis Sanchez Gual <lluis@ideary.com>
* ObjectManager.cs: Corrected a problem with arrays of structs. Elements where
not correctly updated by the final fixup.
2003-01-27 Lluis Sanchez Gual <lluis@ideary.com>
* ObjectManager.cs: Corrected a problem with IObjectReferece objects.
2003-01-24 Martin Baulig <martin@ximian.com>
* ObjectManager.cs (RaiseDeserializationEvent): Walk the object
list in the correct order.
2003-01-16 Lluis Sanchez Gual <lluis@ideary.com>
* ObjectManager.cs: Implemented and added file
* SurrogateSelector.cs: completed implementation.
* SerializationInfo.cs: corrected a bug in GetValue method.
* ObjectIDGenerator.cs: corrected a bug. Now it does not give the same
id for two different instances that return true when calling Equal.
2002-12-06 Duncan Mak <duncan@ximian.com>
* Formatter.cs (WriteValueType): Remove the erroneous CLSCompliant attribute.
2002-08-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* FormatterServices.cs: implemented GetUninitializedObject.
PopulateObjectMembers needs a working FieldInfo.SetValue (it's
not implemented right now).
2002-08-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* FormatterServices.cs:a implemented GetSerializableMembers ().
2002-08-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* FormatterServices.cs: New file with some implementation.
2002-08-16 Dietmar Maurer <dietmar@ximian.com>
* SerializationInfo.cs: special case for null values.
use the converter everywhere.
2002-08-14 Dietmar Maurer <dietmar@ximian.com>
* SerializationInfo.cs: added new function to support the runtime
2002-07-16 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* Formatter.cs: added namespace.
2002-06-10 Duncan Mak <duncan@ximian.com>
* Formatter.cs: Addd to CVS.
* FormatterConverter.cs: Added to CVS.
* SerializationInfo.cs (AddValue): Removed extra CLSCompliant attribute.
2002-04-12 Duncan Mak <duncan@ximian.com>
* SerializationException.cs: Added missing constructor for serialization.
2002-03-12 Duncan Mak <duncan@ximian.com>
* IFormatter.cs: Fix the return type of the Serialize method.
2002/03/07 Nick Drochak <ndrochak@gol.com>
* StreamingContextStates.cs: Add missing value (CrossAppDomain) and
adjust All value accordingly.
2002-03-01 Duncan Mak <duncan@ximian.com>
* ObjectIDGenerator.cs: Implemented.
2002-02-19 Duncan Mak <duncan@ximian.com>
* SurrogateSelector.cs: Implemented.
* SerializationInfoEnumerator.cs: oh, and simplified the Current
property too.
* SerializationInfo.cs: Forgot to finish up GetEnumerator ().
2002-02-18 Duncan Mak <duncan@ximian.com>
* SerializationInfo.cs: Converted Type.GetType calls to the faster
typeof operator.
2002-02-16 Duncan Mak <duncan@ximian.com>
* SurrogateSelector.cs: Stubbed out. Gonna be working on this
tomorrow.
2002-02-15 Duncan Mak <duncan@ximian.com>
* SerializationEntry.cs: Added internal constructor for writing
bits in SerializationInfoEnumerator.
* SerializationInfo.cs: Completed.
* SerializationInfoEnumerator.cs: Implemented. Piggybacking on
Hashtable's GetEnumerator method.
2002-02-13 Dan Lewis <dihlewis@yahoo.co.uk>
* SerializationInfoEnumerator.cs: New file (stub)
2002-02-12 Duncan Mak <duncan@ximian.com>
* SerializationBinder.cs: Implemented.
* SerializationEntry.cs: Implemented.
* SerializationInfo.cs: Fixed the get portion of the AssemblyName
property. Implemented the FullTypename property.
2002-01-06 David Dawkins <david@dawkins.st>
* IFormatter.cs : New file
* ISerializationSurrogate.cs : New file
* ISurrogateSelector.cs : New file
2002-05-01 Ravi Pratap <ravi@ximian.com>
* SerializationInfo.cs : Insert MonoTODO attribute.
2001-08-24 Nick Drochak <ndrochak@gol.com>
* IDeserializationCallback.cs: New File
Wed Nov 14 17:03:30 CET 2001 Paolo Molaro <lupus@ximian.com>
* IFormatterConverter.cs, SerializationInfo.cs: CLSCompliant updates.
Fri Nov 2 18:40:12 CET 2001 Paolo Molaro <lupus@ximian.com>
* SerializationException.cs: implemented.
2001-08-24 Nick Drochak <ndrochak@gol.com>
* SerializationInfo.cs: Added all the public methods so that the compile would not break
2001-07-20 Miguel de Icaza <miguel@ximian.com>
* SerializationInfo.cs: New file.
* IFormatterConverter.cs: New file.
* ISerializable.cs: New file.

View File

@@ -0,0 +1,186 @@
//
// System.Runtime.Serialization.Formatter.cs
//
// Authors:
// Duncan Mak (duncan@ximian.com)
// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
//
// (C) Ximian, Inc.
//
//
// Copyright (C) 2004 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.
//
using System;
using System.Collections;
using System.IO;
namespace System.Runtime.Serialization
{
[CLSCompliant (false)]
[Serializable]
[System.Runtime.InteropServices.ComVisibleAttribute (true)]
public abstract class Formatter : IFormatter
{
protected Formatter ()
{
}
protected ObjectIDGenerator m_idGenerator = new ObjectIDGenerator ();
protected Queue m_objectQueue = new Queue ();
public abstract SerializationBinder Binder {
get;
set;
}
public abstract StreamingContext Context {
get;
set;
}
public abstract ISurrogateSelector SurrogateSelector {
get;
set;
}
public abstract object Deserialize (Stream serializationStream);
protected virtual object GetNext (out long objID)
{
if (m_objectQueue.Count == 0)
{
// set the out field to 0
objID = 0L;
return null;
}
Object o = m_objectQueue.Dequeue ();
bool FirstTime;
objID = m_idGenerator.HasId (o, out FirstTime);
return o;
}
protected virtual long Schedule (object obj)
{
if (obj == null)
return 0L;
bool FirstTime;
long ID = m_idGenerator.GetId (obj, out FirstTime);
if (FirstTime)
m_objectQueue.Enqueue (obj);
return ID;
}
public abstract void Serialize (Stream serializationStream, object graph);
protected abstract void WriteArray (object obj, string name, Type memberType);
protected abstract void WriteBoolean (bool val, string name);
protected abstract void WriteByte (byte val, string name);
protected abstract void WriteChar (char val, string name);
protected abstract void WriteDateTime (DateTime val, string name);
protected abstract void WriteDecimal (Decimal val, string name);
protected abstract void WriteDouble (double val, string name);
protected abstract void WriteInt16 (short val, string name);
protected abstract void WriteInt32 (int val, string name);
protected abstract void WriteInt64 (long val, string name);
protected virtual void WriteMember (string memberName, object data)
{
if (data == null)
WriteObjectRef (data, memberName, typeof(Object));
Type dataType = data.GetType ();
if (dataType.IsArray)
WriteArray (data, memberName, dataType);
else if (dataType == typeof(bool))
WriteBoolean ((bool)data, memberName);
else if (dataType == typeof(byte))
WriteByte ((byte)data, memberName);
else if (dataType == typeof(char))
WriteChar ((char)data, memberName);
else if (dataType == typeof(DateTime))
WriteDateTime ((DateTime)data, memberName);
else if (dataType == typeof(decimal))
WriteDecimal ((decimal)data, memberName);
else if (dataType == typeof(double))
WriteDouble ((double)data, memberName);
else if (dataType == typeof(Int16))
WriteInt16 ((Int16)data, memberName);
else if (dataType == typeof(Int32))
WriteInt32 ((Int32)data, memberName);
else if (dataType == typeof(Int64))
WriteInt64 ((Int64)data, memberName);
else if (dataType == typeof(sbyte))
WriteSByte ((sbyte)data, memberName);
else if (dataType == typeof(float))
WriteSingle ((float)data, memberName);
else if (dataType == typeof(TimeSpan))
WriteTimeSpan ((TimeSpan)data, memberName);
else if (dataType == typeof(UInt16))
WriteUInt16 ((UInt16)data, memberName);
else if (dataType == typeof(UInt32))
WriteUInt32 ((UInt32)data, memberName);
else if (dataType == typeof(UInt64))
WriteUInt64 ((UInt64)data, memberName);
else if (dataType.IsValueType)
WriteValueType (data, memberName, dataType);
WriteObjectRef (data, memberName, dataType);
}
protected abstract void WriteObjectRef (object obj, string name, Type memberType);
[CLSCompliant (false)]
protected abstract void WriteSByte (sbyte val, string name);
protected abstract void WriteSingle (float val, string name);
protected abstract void WriteTimeSpan (TimeSpan val, string name);
[CLSCompliant (false)]
protected abstract void WriteUInt16 (ushort val, string name);
[CLSCompliant (false)]
protected abstract void WriteUInt32 (uint val, string name);
[CLSCompliant (false)]
protected abstract void WriteUInt64 (ulong val, string name);
protected abstract void WriteValueType (object obj, string name, Type memberType);
}
}

View File

@@ -0,0 +1,177 @@
//
// System.Runtime.Serialization.Formatter.cs
//
// Duncan Mak (duncan@ximian.com)
//
// (C) Ximian, Inc.
//
//
// Copyright (C) 2004 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.
//
using System;
using System.Runtime.Serialization;
namespace System.Runtime.Serialization {
[System.Runtime.InteropServices.ComVisibleAttribute (true)]
public class FormatterConverter : IFormatterConverter {
public FormatterConverter ()
{
}
public object Convert (object value, Type type)
{
return System.Convert.ChangeType (value, type);
}
public object Convert (object value, TypeCode typeCode)
{
return System.Convert.ChangeType (value, typeCode);
}
public bool ToBoolean (object value)
{
if (value == null)
throw new ArgumentNullException ("value is null.");
return System.Convert.ToBoolean (value);
}
public byte ToByte (object value)
{
if (value == null)
throw new ArgumentNullException ("value is null.");
return System.Convert.ToByte (value);
}
public char ToChar (object value)
{
if (value == null)
throw new ArgumentNullException ("value is null.");
return System.Convert.ToChar (value);
}
public DateTime ToDateTime (object value)
{
if (value == null)
throw new ArgumentNullException ("value is null.");
return System.Convert.ToDateTime (value);
}
public decimal ToDecimal (object value)
{
if (value == null)
throw new ArgumentNullException ("value is null.");
return System.Convert.ToDecimal (value);
}
public double ToDouble (object value)
{
if (value == null)
throw new ArgumentNullException ("value is null.");
return System.Convert.ToDouble (value);
}
public short ToInt16 (object value)
{
if (value == null)
throw new ArgumentNullException ("value is null.");
return System.Convert.ToInt16 (value);
}
public int ToInt32 (object value)
{
if (value == null)
throw new ArgumentNullException ("value is null.");
return System.Convert.ToInt32 (value);
}
public long ToInt64 (object value)
{
if (value == null)
throw new ArgumentNullException ("value is null.");
return System.Convert.ToInt64 (value);
}
public float ToSingle (object value)
{
if (value == null)
throw new ArgumentNullException ("value is null.");
return System.Convert.ToSingle (value);
}
public string ToString (object value)
{
if (value == null)
throw new ArgumentNullException ("value is null.");
return System.Convert.ToString (value);
}
[CLSCompliant (false)]
public sbyte ToSByte (object value)
{
if (value == null)
throw new ArgumentNullException ("value is null.");
return System.Convert.ToSByte (value);
}
[CLSCompliant (false)]
public ushort ToUInt16 (object value)
{
if (value == null)
throw new ArgumentNullException ("value is null.");
return System.Convert.ToUInt16 (value);
}
[CLSCompliant (false)]
public uint ToUInt32 (object value)
{
if (value == null)
throw new ArgumentNullException ("value is null.");
return System.Convert.ToUInt32 (value);
}
[CLSCompliant (false)]
public ulong ToUInt64 (object value)
{
if (value == null)
throw new ArgumentNullException ("value is null.");
return System.Convert.ToUInt64 (value);
}
}
}

View File

@@ -0,0 +1,222 @@
//
// System.Runtime.Serialization.FormatterServices
//
// Authors:
// Gonzalo Paniagua Javier (gonzalo@ximian.com)
//
// (C) 2002 Ximian, Inc (http://www.ximian.com)
//
//
// Copyright (C) 2004 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.
//
using System;
using System.Collections;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Serialization.Formatters;
using System.Globalization;
namespace System.Runtime.Serialization
{
[System.Runtime.InteropServices.ComVisibleAttribute (true)]
public sealed class FormatterServices
{
private const BindingFlags fieldFlags = BindingFlags.Public |
BindingFlags.Instance |
BindingFlags.NonPublic |
BindingFlags.DeclaredOnly;
private FormatterServices ()
{
}
public static object [] GetObjectData (object obj, MemberInfo [] members)
{
if (obj == null)
throw new ArgumentNullException ("obj");
if (members == null)
throw new ArgumentNullException ("members");
int n = members.Length;
object [] result = new object [n];
for (int i = 0; i < n; i++) {
MemberInfo member = members [i];
if (member == null)
throw new ArgumentNullException (String.Format ("members[{0}]", i));
if (member.MemberType != MemberTypes.Field)
throw new SerializationException (
String.Format ("members [{0}] is not a field.", i));
FieldInfo fi = member as FieldInfo; // members must be fields
result [i] = fi.GetValue (obj);
}
return result;
}
public static MemberInfo [] GetSerializableMembers (Type type)
{
StreamingContext st = new StreamingContext (StreamingContextStates.All);
return GetSerializableMembers (type, st);
}
public static MemberInfo [] GetSerializableMembers (Type type, StreamingContext context)
{
if (type == null)
throw new ArgumentNullException ("type");
//FIXME: context?
ArrayList fields = new ArrayList ();
Type t = type;
while (t != null) {
if (!t.IsSerializable) {
string msg = String.Format ("Type {0} in assembly {1} is not " +
"marked as serializable.",
t, t.Assembly.FullName);
throw new SerializationException (msg);
}
GetFields (type, t, fields);
t = t.BaseType;
}
MemberInfo [] result = new MemberInfo [fields.Count];
fields.CopyTo (result);
return result;
}
private static void GetFields (Type reflectedType, Type type, ArrayList fields)
{
FieldInfo [] fs = type.GetFields (fieldFlags);
foreach (FieldInfo field in fs)
if (!(field.IsNotSerialized)) {
MonoField mf = field as MonoField;
if (mf != null && reflectedType != type && !mf.IsPublic) {
string fname = type.Name + "+" + mf.Name;
fields.Add (mf.Clone (fname));
}
else
fields.Add (field);
}
}
public static Type GetTypeFromAssembly (Assembly assem, string name)
{
if (assem == null)
throw new ArgumentNullException ("assem");
if (name == null)
throw new ArgumentNullException ("name");
return assem.GetType (name);
}
public static object GetUninitializedObject (Type type)
{
if (type == null)
throw new ArgumentNullException ("type");
if (type == typeof (string))
throw new ArgumentException ("Uninitialized Strings cannot be created.");
return System.Runtime.Remoting.Activation.ActivationServices.AllocateUninitializedClassInstance (type);
}
public static object PopulateObjectMembers (object obj, MemberInfo [] members, object [] data)
{
if (obj == null)
throw new ArgumentNullException ("obj");
if (members == null)
throw new ArgumentNullException ("members");
if (data == null)
throw new ArgumentNullException ("data");
int length = members.Length;
if (length != data.Length)
throw new ArgumentException ("different length in members and data");
for (int i = 0; i < length; i++) {
MemberInfo member = members [i];
if (member == null)
throw new ArgumentNullException (String.Format ("members[{0}]", i));
if (member.MemberType != MemberTypes.Field)
throw new SerializationException (
String.Format ("members [{0}] is not a field.", i));
FieldInfo fi = member as FieldInfo; // members must be fields
fi.SetValue (obj, data [i]);
}
return obj;
}
public static void CheckTypeSecurity (Type t, TypeFilterLevel securityLevel)
{
if (securityLevel == TypeFilterLevel.Full) return;
CheckNotAssignable (typeof(System.DelegateSerializationHolder), t);
CheckNotAssignable (typeof(System.Runtime.Remoting.Lifetime.ISponsor), t);
CheckNotAssignable (typeof(System.Runtime.Remoting.IEnvoyInfo), t);
CheckNotAssignable (typeof(System.Runtime.Remoting.ObjRef), t);
}
static void CheckNotAssignable (Type basetype, Type type)
{
if (basetype.IsAssignableFrom (type)) {
string msg = "Type " + basetype + " and the types derived from it";
msg += " (such as " + type + ") are not permitted to be deserialized at this security level";
throw new System.Security.SecurityException (msg);
}
}
public static object GetSafeUninitializedObject (Type type)
{
// FIXME: MS.NET uses code access permissions to check if the caller is
// allowed to create an instance of this type. We can't support this
// because it is not implemented in mono.
// In concrete, the it will request a SecurityPermission of
// type "Infrastructure".
return GetUninitializedObject (type);
}
#if NET_4_0
// This method was introduced in .Net due to a bug serializing objects with circular references
// which we don't appear to have, so we just return the same object.
// See http://support.microsoft.com/kb/927495/en-us/ in case of doubt.
[ComVisible (false)]
public static ISerializationSurrogate GetSurrogateForCyclicalReference (ISerializationSurrogate innerSurrogate)
{
return innerSurrogate;
}
#endif
}
}

View File

@@ -0,0 +1,39 @@
//
// System.Runtime.Serialization.IDeserializationCallback.cs
//
// Author:
// Nick Drochak(ndrochak@gol.com)
//
// (C) Nick Drochak
//
//
// Copyright (C) 2004 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.
//
namespace System.Runtime.Serialization {
[System.Runtime.InteropServices.ComVisibleAttribute (true)]
public interface IDeserializationCallback {
void OnDeserialization(object sender);
}
}

View File

@@ -0,0 +1,90 @@
//
// System.Runtime.Serialization.IFormatter
//
// Author:
// David Dawkins (david@dawkins.st)
//
// (C) David Dawkins
//
//
// Copyright (C) 2004 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.
//
using System.IO;
namespace System.Runtime.Serialization {
/// <summary>
/// Formatting for serialized objects</summary>
[System.Runtime.InteropServices.ComVisibleAttribute (true)]
public interface IFormatter {
//
// Properties
//
/// <summary>
/// Get or set the SerializationBinder used
/// for looking up types during deserialization</summary>
SerializationBinder Binder
{
get;
set;
}
/// <summary>
/// Get or set the StreamingContext used for serialization
/// and deserialization</summary>
StreamingContext Context
{
get;
set;
}
/// <summary>
/// Get or set the SurrogateSelector used by the current
/// formatter</summary>
ISurrogateSelector SurrogateSelector
{
get;
set;
}
/// <summary>
/// Deserialize data from the specified stream, rebuilding
/// the object hierarchy</summary>
object Deserialize(
Stream serializationStream
);
/// <summary>
/// Serialize the specified object to the specified stream.
/// Object may be the root of a graph of objects to be
/// serialized</summary>
void Serialize(
Stream serializationStream,
object graph
);
}
}

View File

@@ -0,0 +1,57 @@
//
// System.Runtime.Serialization.IFormatterConverter.cs
//
// Author:
// Miguel de Icaza (miguel@ximian.com)
//
// (C) Ximian, Inc. http://www.ximian.com
//
//
//
// Copyright (C) 2004 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.
//
namespace System.Runtime.Serialization {
[CLSCompliant(false)]
[System.Runtime.InteropServices.ComVisibleAttribute (true)]
public interface IFormatterConverter {
object Convert (object value, Type type);
object Convert (object value, TypeCode typeCode);
bool ToBoolean (object value);
byte ToByte (object value);
char ToChar (object value);
DateTime ToDateTime (object value);
Decimal ToDecimal (object value);
double ToDouble (object value);
Int16 ToInt16 (object value);
Int32 ToInt32 (object value);
Int64 ToInt64 (object value);
sbyte ToSByte (object value);
float ToSingle (object value);
string ToString (object value);
UInt16 ToUInt16 (object value);
UInt32 ToUInt32 (object value);
UInt64 ToUInt64 (object value);
}
}

View File

@@ -0,0 +1,40 @@
//
// System.Runtime.Serialization.IObjectReference.cs
//
// Author:
// Miguel de Icaza (miguel@ximian.com)
//
// (C) Ximian, Inc. http://www.ximian.com
//
//
// Copyright (C) 2004 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.
//
namespace System.Runtime.Serialization {
[System.Runtime.InteropServices.ComVisibleAttribute (true)]
public interface IObjectReference {
object GetRealObject (StreamingContext context);
}
}

View File

@@ -0,0 +1,38 @@
//
// System.Runtime.Serialization.ISafeSerializationData
//
// Author:
// Jb Evain (jbevain@novell.com)
//
// Copyright (C) 2010 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_4_0
namespace System.Runtime.Serialization {
public interface ISafeSerializationData {
void CompleteDeserialization (object deserialized);
}
}
#endif

View File

@@ -0,0 +1,40 @@
//
// System.Runtime.Serialization.ISerializable.cs
//
// Author:
// Miguel de Icaza (miguel@ximian.com)
//
// (C) Ximian, Inc. http://www.ximian.com
//
//
//
// Copyright (C) 2004 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.
//
namespace System.Runtime.Serialization {
[System.Runtime.InteropServices.ComVisibleAttribute (true)]
public interface ISerializable {
void GetObjectData (SerializationInfo info, StreamingContext context);
}
}

View File

@@ -0,0 +1,68 @@
//
// System.Runtime.Serialization.ISerializationSurrogate
//
// Author:
// David Dawkins (david@dawkins.st)
//
// (C) David Dawkins
//
//
// Copyright (C) 2004 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.
//
namespace System.Runtime.Serialization {
/// <summary>
/// Interface for serialization surrogates</summary>
[System.Runtime.InteropServices.ComVisibleAttribute (true)]
public interface ISerializationSurrogate {
/// <summary>
/// Get the SerializationInfo necessary to serialize
/// the specified object </summary>
/// <param name="obj">Object to be serialized</param>
/// <param name="info">SerializationInfo to be populated</param>
/// <param name="context">Destination for serialization</param>
void GetObjectData(
object obj,
SerializationInfo info,
StreamingContext context
);
/// <summary>
/// Populate an object using the specified SerializationInfo </summary>
/// <param name="obj">Object to be populated</param>
/// <param name="info">Data used for populating object</param>
/// <param name="context">Source for deserialization of object</param>
/// <param name="selector>Starting point for searching for compatible surrogates</param>
/// <returns>The deserialized object</returns>
object SetObjectData(
object obj,
SerializationInfo info,
StreamingContext context,
ISurrogateSelector selector
);
}
}

View File

@@ -0,0 +1,65 @@
//
// System.Runtime.Serialization.ISurrogateSelector
//
// Author:
// David Dawkins (david@dawkins.st)
//
// (C) David Dawkins
//
//
// Copyright (C) 2004 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.
//
namespace System.Runtime.Serialization {
/// <summary>
/// Creation of serialization surrogate selectors</summary>
[System.Runtime.InteropServices.ComVisibleAttribute (true)]
public interface ISurrogateSelector {
/// <summary>
/// Insert specified selector into available surrogates</summary>
void ChainSelector( ISurrogateSelector selector );
/// <summary>
/// Return next surrogate in the surrogate chain</summary>
ISurrogateSelector GetNextSelector();
/// <summary>
/// Fetch the surrogate according the specified type, starting
/// the search from the surrogate selector for the specified
/// StreamingContext</summary>
/// <param name="type">Type of the object to be serialized</param>
/// <param name="context">Context for the serialization/deserialization</para,>
/// <param name="selector">Upon return, contains a reference to the selector where the returned surrogate was found</param>
/// <returns>The surrogate for the specified type and context</returns>
ISerializationSurrogate GetSurrogate(
Type type,
StreamingContext context,
out ISurrogateSelector selector
);
}
}

View File

@@ -0,0 +1,117 @@
//
// System.Runtime.Serialization.ObjectIDGenerator.cs
//
// Author: Duncan Mak (duncan@ximian.com)
// Lluis Sanchez (lsg@ctv.es)
//
// (C) Ximian, Inc.
// Copyright (C) 2004,2006 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.
//
using System.Collections;
namespace System.Runtime.Serialization
{
[Serializable]
[MonoTODO ("Serialization format not compatible with.NET")]
[System.Runtime.InteropServices.ComVisibleAttribute (true)]
public class ObjectIDGenerator
{
// Private field
Hashtable table;
long current; // this is the current ID, starts at 1
static InstanceComparer comparer = new InstanceComparer ();
// ObjectIDGenerator must generate a new id for each object instance.
// If two objects have the same state (i.e. the method Equals() returns true),
// each one should have a different id.
// Thus, the object instance cannot be directly used as key of the hashtable.
// InstanceComparer compares object references instead of object content
// (unless the object is inmutable, like strings).
class InstanceComparer: IComparer, IHashCodeProvider
{
int IComparer.Compare (object o1, object o2)
{
if (o1 is string)
return o1.Equals(o2) ? 0 : 1;
else
return (o1 == o2) ? 0 : 1;
}
int IHashCodeProvider.GetHashCode (object o)
{
return object.InternalGetHashCode (o);
}
}
// constructor
public ObjectIDGenerator ()
: base ()
{
table = new Hashtable (comparer, comparer);
current = 1;
}
// Methods
public virtual long GetId (object obj, out bool firstTime)
{
if (obj == null)
throw new ArgumentNullException ("obj");
object val = table [obj];
if (val != null) {
firstTime = false;
return (long) val;
} else {
firstTime = true;
table.Add (obj, current);
return current ++;
}
}
public virtual long HasId (object obj, out bool firstTime)
{
if (obj == null)
throw new ArgumentNullException ("obj");
object val = table [obj];
if (val != null) {
firstTime = false;
return (long) val;
} else {
firstTime = true;
return 0L; // 0 is the null ID
}
}
internal long NextId
{
get { return current ++; }
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,38 @@
//
// System.Runtime.Serialization.OnDeserializedAttribute.cs
//
// Author:
// Miguel de Icaza (miguel@ximian.com)
//
// Copyright (C) 2006 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.
//
using System;
using System.Runtime.InteropServices;
namespace System.Runtime.Serialization {
[ComVisible(true)]
[AttributeUsage (AttributeTargets.Method, Inherited=false)]
public sealed class OnDeserializedAttribute : Attribute {
}
}

View File

@@ -0,0 +1,38 @@
//
// System.Runtime.Serialization.OnDeserializingAttribute.cs
//
// Author:
// Miguel de Icaza (miguel@ximian.com)
//
// Copyright (C) 2006 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.
//
using System;
using System.Runtime.InteropServices;
namespace System.Runtime.Serialization {
[ComVisible(true)]
[AttributeUsage (AttributeTargets.Method, Inherited=false)]
public sealed class OnDeserializingAttribute : Attribute {
}
}

View File

@@ -0,0 +1,38 @@
//
// System.Runtime.Serialization.OnSerializedAttribute.cs
//
// Author:
// Miguel de Icaza (miguel@ximian.com)
//
// Copyright (C) 2006 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.
//
using System;
using System.Runtime.InteropServices;
namespace System.Runtime.Serialization {
[ComVisible(true)]
[AttributeUsage (AttributeTargets.Method, Inherited=false)]
public sealed class OnSerializedAttribute : Attribute {
}
}

View File

@@ -0,0 +1,38 @@
//
// System.Runtime.Serialization.OnSerializingAttribute.cs
//
// Author:
// Miguel de Icaza (miguel@ximian.com)
//
// Copyright (C) 2006 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.
//
using System;
using System.Runtime.InteropServices;
namespace System.Runtime.Serialization {
[ComVisible(true)]
[AttributeUsage (AttributeTargets.Method, Inherited=false)]
public sealed class OnSerializingAttribute : Attribute {
}
}

View File

@@ -0,0 +1,49 @@
//
// System.Runtime.Serialization.OptionalFieldAttribute.cs
//
// Author:
// Miguel de Icaza (miguel@ximian.com)
//
// Copyright (C) 2006 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.
//
using System;
using System.Runtime.InteropServices;
namespace System.Runtime.Serialization {
[ComVisible(true)]
[AttributeUsage (AttributeTargets.Field, Inherited=false)]
public sealed class OptionalFieldAttribute : Attribute {
int version_added;
public int VersionAdded {
get {
return version_added;
}
set {
version_added = value;
}
}
}
}

View File

@@ -0,0 +1,52 @@
//
// System.Runtime.Serialization.SafeSerializationEventArgs
//
// Author:
// Jb Evain (jbevain@novell.com)
//
// Copyright (C) 2010 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_4_0
namespace System.Runtime.Serialization {
public sealed class SafeSerializationEventArgs : EventArgs {
[MonoTODO]
public StreamingContext StreamingContext {
get { throw new NotImplementedException (); }
}
internal SafeSerializationEventArgs ()
{
}
[MonoTODO]
public void AddSerializedState (ISafeSerializationData serializedState)
{
throw new NotImplementedException ();
}
}
}
#endif

Some files were not shown because too many files have changed in this diff Show More