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,70 @@
2009-06-06 Gert Driesen <drieseng@users.sourceforge.net>
* ContextStack.cs: Added argument check to Type indexer, avoiding a
NRE. Modify System.Int32 indexer to throw ArgumentOutOfRangeException
instead of ArgumentException. Reduce number of times that item count
must be obtained.
2008-06-05 Ivan N. Zlatev <contact@i-nz.net>
* ContextStack.cs: Also check for subclasses in the Type-based
indexter property.
[Fixes bug #509151]
2007-11-13 Atsushi Enomoto <atsushi@ximian.com>
* ResolveNameEventHandler.cs, RootDesignerSerializerAttribute.cs,
DesignerLoader.cs, SerializationStore.cs : couple of 2.0 API fixes.
2007-11-01 Ivan N. Zlatev <contact@i-nz.net>
* ResolveNameEventArgs.cs: Fix Value to not return and set Name.
2007-08-18 Ivan N. Zlatev <contact@i-nz.net>
* ContextStack.cs: Update to 2.0.
2007-07-21 Gert Driesen <drieseng@users.sourceforge.net>
* InstanceDescriptor.cs: Allow null members. Fixed exception messages.
For properties, do not perform argument check. Fixed Invoke to return
null when member is null or when member is not ctor, method, field or
property (eg. a type). Removed obsolete HasThis method.
2007-07-18 Ivan N. Zlatev <contact@i-nz.net>
* InstanceDescriptor.cs: Fix a NRE.
2007-05-15 Adar Wesley <adarw@mainsoft.com>
* ContextStack.cs: added missing method Append.
2006-03-10 Raja R Harinath <rharinath@novell.com>
* CodeDomSerializerException.cs: Move to System.Design.dll.
2006-03-09 Zoltan Varga <vargaz@gmail.com>
* CodeDomSerializerException.cs: New file.
2005-10-18 Sebastien Pouliot <sebastien@ximian.com>
* InstanceDescriptor.cs: Added CAS permissions (unrestricted at class
level).
2005-10-18 Sebastien Pouliot <sebastien@ximian.com>
* InstanceDescriptor.cs: Fix Invoke method as there's no 'this' for ctors.
2005-01-27 LLuis Sanchez Gual <lluis@novell.com>
* InstanceDescriptor.cs: Constructors don't need to be static.
2003-06-28 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
* ContextStack.cs: Redone based on a stack and completely implemented
* DesignerLoader.cs: Removed unneeded members
* DesignerSerializerAttribute.cs: Implemented, fixed AttributeUsage
* ResolveNameEventArgs.cs: Visibility bug fixed
* RootDesignerSerializerAttribute.cs: Fixed and implemented, fixed AttributeUsage
* InstanceDescriptor.cs: Completely Implemented

View File

@ -0,0 +1,66 @@
//
// System.ComponentModel.Design.Serialization.ComponentSerializationService
//
// Authors:
// Ivan N. Zlatev (contact@i-nZ.net)
//
// (C) 2007 Ivan N. Zlatev
//
// 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.ComponentModel;
using System.Collections;
using System.IO;
namespace System.ComponentModel.Design.Serialization
{
public abstract class ComponentSerializationService
{
protected ComponentSerializationService ()
{
}
public abstract SerializationStore CreateStore ();
public abstract ICollection Deserialize (SerializationStore store);
public abstract ICollection Deserialize (SerializationStore store, IContainer container);
public abstract SerializationStore LoadStore (Stream stream);
public abstract void Serialize (SerializationStore store, object value);
public abstract void SerializeAbsolute (SerializationStore store, object value);
public abstract void SerializeMember (SerializationStore store, object owningObject, MemberDescriptor member);
public abstract void SerializeMemberAbsolute (SerializationStore store, object owningObject, MemberDescriptor member);
public void DeserializeTo (SerializationStore store, IContainer container)
{
DeserializeTo (store, container, true);
}
public void DeserializeTo (SerializationStore store, IContainer container, bool validateRecycledTypes)
{
DeserializeTo (store, container, validateRecycledTypes, true);
}
public abstract void DeserializeTo (SerializationStore store, IContainer container, bool validateRecycledTypes, bool applyDefaults);
}
}

View File

@ -0,0 +1,109 @@
//
// System.ComponentModel.Design.Serialization.ContextStack.cs
//
// Author:
// Alejandro Sánchez Acosta (raciel@gnome.org)
// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
// Ivan N. Zlatev (contact@i-nz.net)
//
// (C) Alejandro Sánchez Acosta
// (C) 2003 Andreas Nahr
// (C) 2007 Ivan N. Zlatev
//
//
// 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;
namespace System.ComponentModel.Design.Serialization
{
public sealed class ContextStack
{
private ArrayList _contextList;
public ContextStack ()
{
_contextList = new ArrayList ();
}
public object Current {
get {
int context_count = _contextList.Count;
if (context_count > 0)
return _contextList [context_count - 1];
return null;
}
}
public object this[Type type] {
get {
if (type == null)
throw new ArgumentNullException ("type");
for (int i = _contextList.Count - 1; i >= 0; i--) {
object context = _contextList [i];
if (type.IsInstanceOfType (context))
return context;
}
return null;
}
}
public object this[int level] {
get {
if (level < 0)
throw new ArgumentOutOfRangeException ("level");
int context_count = _contextList.Count;
if (context_count > 0 && context_count > level)
return _contextList [context_count - 1 - level];
return null;
}
}
public object Pop ()
{
object o = null;
int context_count = _contextList.Count;
if (context_count > 0) {
int lastItem = context_count - 1;
o = _contextList [lastItem];
_contextList.RemoveAt (lastItem);
}
return o;
}
public void Push (object context)
{
if (context == null)
throw new ArgumentNullException ("context");
_contextList.Add (context);
}
public void Append (object context)
{
if (context == null)
throw new ArgumentNullException ("context");
_contextList.Insert (0, context);
}
}
}

View File

@ -0,0 +1,65 @@
//
// System.ComponentModel.Design.Serialization.DefaultSerializationProviderAttribute
//
// Authors:
// Ivan N. Zlatev (contact i-nZ.net)
//
// (C) 2007 Ivan N. Zlatev
//
// 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.ComponentModel;
using System.ComponentModel.Design;
namespace System.ComponentModel.Design.Serialization
{
[AttributeUsageAttribute (AttributeTargets.Class, Inherited=false)]
public sealed class DefaultSerializationProviderAttribute : Attribute
{
private string _providerTypeName;
public DefaultSerializationProviderAttribute (string providerTypeName)
{
if (providerTypeName == null)
throw new ArgumentNullException ("providerTypeName");
_providerTypeName = providerTypeName;
}
public DefaultSerializationProviderAttribute (Type providerType)
{
if (providerType == null)
throw new ArgumentNullException ("providerType");
_providerTypeName = providerType.AssemblyQualifiedName;
}
public string ProviderTypeName {
get { return _providerTypeName; }
}
}
}

View File

@ -0,0 +1,55 @@
//
// System.ComponentModel.Design.Serialization.DesignerLoader.cs
//
// Authors:
// Martin Willemoes Hansen (mwh@sysrq.dk)
// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
//
// (C) 2003 Martin Willemoes Hansen
// (C) 2003 Andreas Nahr
//
//
// 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.ComponentModel.Design.Serialization
{
// This class is merely an interface with no implementation needed
[System.Runtime.InteropServices.ComVisible (true)]
public abstract class DesignerLoader
{
protected DesignerLoader()
{
}
public virtual bool Loading {
get { return false; }
}
public abstract void BeginLoad (IDesignerLoaderHost host);
public abstract void Dispose();
public virtual void Flush()
{
}
}
}

View File

@ -0,0 +1,71 @@
//
// System.ComponentModel.Design.Serialization.DesignerSerializerAttribute.cs
//
// Authors:
// Martin Willemoes Hansen (mwh@sysrq.dk)
// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
//
// (C) 2003 Martin Willemoes Hansen
// (C) 2003 Andreas Nahr
//
//
// 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.ComponentModel.Design.Serialization
{
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface, AllowMultiple = true, Inherited = true)]
public sealed class DesignerSerializerAttribute : Attribute
{
private string serializerTypeName;
private string baseSerializerTypeName;
public DesignerSerializerAttribute (string serializerTypeName,
string baseSerializerTypeName)
{
this.serializerTypeName = serializerTypeName;
this.baseSerializerTypeName = baseSerializerTypeName;
}
public DesignerSerializerAttribute (string serializerTypeName, Type baseSerializerType)
: this (serializerTypeName, baseSerializerType.AssemblyQualifiedName)
{
}
public DesignerSerializerAttribute (Type serializerType, Type baseSerializerType)
: this (serializerType.AssemblyQualifiedName, baseSerializerType.AssemblyQualifiedName)
{
}
public string SerializerBaseTypeName {
get { return baseSerializerTypeName; }
}
public string SerializerTypeName {
get { return serializerTypeName; }
}
public override object TypeId {
get { return string.Concat (this.ToString(), baseSerializerTypeName); }
}
}
}

View File

@ -0,0 +1,40 @@
// System.ComponentModel.Design.Serialization.IDesignerLoaderHost.cs
//
// Author:
// Alejandro Sánchez Acosta <raciel@gnome.org>
//
// (C) Alejandro Sánchez Acosta
//
//
// 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.ComponentModel.Design.Serialization
{
public interface IDesignerLoaderHost : IDesignerHost, IServiceContainer, IServiceProvider
{
void EndLoad (string baseClassName, bool successful, ICollection errorCollection);
void Reload();
}
}

View File

@ -0,0 +1,43 @@
//
// IDesignerLoaderHost2.cs
//
// Author:
// Carlos Alberto Cortez (calberto.cortez@gmail.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
using System;
namespace System.ComponentModel.Design.Serialization
{
public interface IDesignerLoaderHost2 : IDesignerLoaderHost
{
bool CanReloadWithErrors { get; set; }
bool IgnoreErrorsDuringReload { get; set; }
}
}
#endif

View File

@ -0,0 +1,42 @@
// System.ComponentModel.Design.Serialization.IDesignerLoaderService.cs
//
// Author:
// Alejandro Sánchez Acosta <raciel@gnome.org>
//
// (C) Alejandro Sánchez Acosta
//
//
// 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.ComponentModel.Design.Serialization
{
public interface IDesignerLoaderService
{
void AddLoadDependency();
void DependentLoadComplete (bool successful, ICollection errorCollection);
bool Reload();
}
}

View File

@ -0,0 +1,62 @@
// System.ComponentModel.Design.Serialization.IDesignerSerializationManager.cs
//
// Author:
// Alejandro Sánchez Acosta <raciel@gnome.org>
//
// (C) Alejandro Sánchez Acosta
//
//
// 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.ComponentModel.Design.Serialization
{
public interface IDesignerSerializationManager : IServiceProvider
{
ContextStack Context {get;}
PropertyDescriptorCollection Properties {get;}
void AddSerializationProvider (IDesignerSerializationProvider provider);
object CreateInstance (Type type, ICollection arguments, string name, bool addToContainer);
object GetInstance (string name);
string GetName (object value);
object GetSerializer (Type objectType, Type serializerType);
Type GetType (string typeName);
void RemoveSerializationProvider (IDesignerSerializationProvider provider);
void ReportError (object errorInformation);
void SetName (object instance, string name);
event ResolveNameEventHandler ResolveName;
event EventHandler SerializationComplete;
}
}

View File

@ -0,0 +1,38 @@
// System.ComponentModel.Design.Serialization.IDesignerSerializationProvider.cs
//
// Author:
// Alejandro Sánchez Acosta <raciel@gnome.org>
//
// (C) Alejandro Sánchez Acosta
//
//
// 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.ComponentModel.Design.Serialization
{
public interface IDesignerSerializationProvider
{
object GetSerializer (IDesignerSerializationManager manager,
object currentSerializer, Type objectType,
Type serializerType);
}
}

View File

@ -0,0 +1,40 @@
// System.ComponentModel.Design.Serialization.IDesignerSerializationService.cs
//
// Author:
// Alejandro Sánchez Acosta <raciel@gnome.org>
//
// (C) Alejandro Sánchez Acosta
//
//
// 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.ComponentModel.Design.Serialization
{
public interface IDesignerSerializationService
{
ICollection Deserialize (object serializationData);
object Serialize (ICollection objects);
}
}

View File

@ -0,0 +1,42 @@
// System.ComponentModel.Design.Serialization.INameCreationService.cs
//
// Author:
// Alejandro Sánchez Acosta <raciel@gnome.org>
//
// (C) Alejandro Sánchez Acosta
//
//
// 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.ComponentModel.Design.Serialization
{
public interface INameCreationService
{
string CreateName (IContainer container, Type dataType);
bool IsValidName (string name);
void ValidateName (string name);
}
}

View File

@ -0,0 +1,153 @@
//
// System.ComponentModel.Design.Serialization.InstanceDescriptor.cs
//
// Authors:
// Martin Willemoes Hansen (mwh@sysrq.dk)
// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
//
// (C) 2003 Martin Willemoes Hansen
// (C) 2003 Andreas Nahr
// 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.
//
using System.Collections;
using System.Reflection;
using System.Security.Permissions;
namespace System.ComponentModel.Design.Serialization
{
[PermissionSet (SecurityAction.LinkDemand, Unrestricted = true)]
public sealed class InstanceDescriptor {
private MemberInfo member;
private ICollection arguments;
private bool isComplete;
public InstanceDescriptor (MemberInfo member, ICollection arguments)
: this (member, arguments, true)
{
}
public InstanceDescriptor(MemberInfo member, ICollection arguments, bool isComplete)
{
this.isComplete = isComplete;
ValidateMember (member, arguments);
this.member = member;
this.arguments = arguments;
}
private void ValidateMember (MemberInfo member, ICollection arguments)
{
if (member == null)
return;
switch (member.MemberType) {
// According to docs only these types are allowed, but the docs do
// state what happens for other types
case MemberTypes.Constructor:
ConstructorInfo CI = (ConstructorInfo) member;
if (arguments == null) // null counts as no arguments
if (CI.GetParameters().Length != 0)
throw new ArgumentException ("Invalid number of arguments for this constructor");
if (arguments.Count != CI.GetParameters().Length)
throw new ArgumentException ("Invalid number of arguments for this constructor");
break;
case MemberTypes.Method:
MethodInfo MI = (MethodInfo) member;
if (!MI.IsStatic)
throw new ArgumentException ("InstanceDescriptor only describes static (VB.Net: shared) members", "member");
if (arguments == null) // null counts as no arguments
if (MI.GetParameters().Length != 0)
throw new ArgumentException ("Invalid number of arguments for this method", "arguments");
if (arguments.Count != MI.GetParameters().Length)
throw new ArgumentException ("Invalid number of arguments for this method");
break;
case MemberTypes.Field:
FieldInfo FI = (FieldInfo) member;
if (!FI.IsStatic)
throw new ArgumentException ("Parameter must be static");
if (arguments != null && arguments.Count != 0) // null counts as no arguments
throw new ArgumentException ("Field members do not take any arguments");
break;
case MemberTypes.Property:
PropertyInfo PI = (PropertyInfo) member;
if (!(PI.CanRead))
throw new ArgumentException ("Parameter must be readable");
MethodInfo PIM = PI.GetGetMethod();
if (!PIM.IsStatic)
throw new ArgumentException ("Parameter must be static");
break;
}
}
public ICollection Arguments {
get {
// It seems MS does not return null even if we specified null as parameter (but does not cause an exception)
if (arguments == null)
return new object[0];
return arguments;
}
}
public bool IsComplete {
get { return isComplete; }
}
public MemberInfo MemberInfo {
get { return member; }
}
public object Invoke()
{
if (member == null)
return null;
object[] parsearguments;
if (arguments == null)
parsearguments = new object[0];
else {
parsearguments = new object[arguments.Count];
arguments.CopyTo (parsearguments, 0);
}
//MemberInfo member;
switch (member.MemberType) {
case MemberTypes.Constructor:
ConstructorInfo CI = (ConstructorInfo) member;
return CI.Invoke (parsearguments);
case MemberTypes.Method:
MethodInfo MI = (MethodInfo) member;
return MI.Invoke (null, parsearguments);
case MemberTypes.Field:
FieldInfo FI = (FieldInfo) member;
return FI.GetValue (null);
case MemberTypes.Property:
PropertyInfo PI = (PropertyInfo) member;
return PI.GetValue (null, parsearguments);
}
return null;
}
}
}

View File

@ -0,0 +1,90 @@
//
// System.ComponentModel.Design.Serialization.MemberRelationship
//
// Authors:
// Ivan N. Zlatev (contact@i-nZ.net)
//
// (C) 2007 Ivan N. Zlatev
//
// 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.CodeDom;
using System.ComponentModel;
namespace System.ComponentModel.Design.Serialization
{
public struct MemberRelationship
{
public static readonly MemberRelationship Empty = new MemberRelationship ();
private object _owner;
private MemberDescriptor _member;
public MemberRelationship (object owner, MemberDescriptor member)
{
_owner = owner;
_member = member;
}
public bool IsEmpty {
get { return (_owner == null); }
}
public object Owner {
get { return _owner; }
}
public MemberDescriptor Member {
get { return _member; }
}
public static bool operator == (MemberRelationship left, MemberRelationship right)
{
if (left.Owner == right.Owner && left.Member == right.Member)
return true;
else
return false;
}
public static bool operator != (MemberRelationship left, MemberRelationship right)
{
return !(left == right);
}
public override int GetHashCode ()
{
if (_owner != null && _member != null)
return _member.GetHashCode () ^ _owner.GetHashCode ();
return base.GetHashCode ();
}
public override bool Equals (object o)
{
if (o is MemberRelationship) {
return ((MemberRelationship)o) == this;
}
return false;
}
}
}

View File

@ -0,0 +1,138 @@
//
// System.ComponentModel.Design.Serialization.MemberRelationshipService
//
// Authors:
// Ivan N. Zlatev (contact@i-nZ.net)
//
// (C) 2007 Ivan N. Zlatev
//
// 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.CodeDom;
using System.ComponentModel;
using System.Collections;
namespace System.ComponentModel.Design.Serialization
{
public abstract class MemberRelationshipService
{
// MSDN: The default implementation stores relationships in a dictionary using weak references
// so the relationship table does not keep objects alive.
//
private class MemberRelationshipWeakEntry
{
private WeakReference _ownerWeakRef;
private MemberDescriptor _member;
public MemberRelationshipWeakEntry (MemberRelationship relation)
{
_ownerWeakRef = new WeakReference (relation.Owner);
_member = relation.Member;
}
public object Owner {
get {
if (_ownerWeakRef.IsAlive)
return _ownerWeakRef.Target;
return null;
}
}
public MemberDescriptor Member {
get { return _member; }
}
public static bool operator == (MemberRelationshipWeakEntry left, MemberRelationshipWeakEntry right)
{
if (left.Owner == right.Owner && left.Member == right.Member)
return true;
else
return false;
}
public static bool operator != (MemberRelationshipWeakEntry left, MemberRelationshipWeakEntry right)
{
return !(left == right);
}
public override int GetHashCode ()
{
if (this.Owner != null && _member != null)
return _member.GetHashCode () ^ _ownerWeakRef.Target.GetHashCode ();
return base.GetHashCode ();
}
public override bool Equals (object o)
{
if (o is MemberRelationshipWeakEntry) {
return ((MemberRelationshipWeakEntry) o) == this;
}
return false;
}
}
private Hashtable _relations;
protected MemberRelationshipService ()
{
_relations = new Hashtable ();
}
public abstract bool SupportsRelationship (MemberRelationship source, MemberRelationship relationship);
protected virtual MemberRelationship GetRelationship (MemberRelationship source)
{
if (source.IsEmpty)
throw new ArgumentNullException ("source");
MemberRelationshipWeakEntry entry = _relations[new MemberRelationshipWeakEntry (source)] as MemberRelationshipWeakEntry;
if (entry != null)
return new MemberRelationship (entry.Owner, entry.Member);
return MemberRelationship.Empty;
}
protected virtual void SetRelationship (MemberRelationship source, MemberRelationship relationship)
{
if (source.IsEmpty)
throw new ArgumentNullException ("source");
if (!relationship.IsEmpty && !this.SupportsRelationship (source, relationship))
throw new ArgumentException ("Relationship not supported.");
_relations[new MemberRelationshipWeakEntry (source)] = new MemberRelationshipWeakEntry (relationship);
}
public MemberRelationship this [object owner, MemberDescriptor member] {
get { return GetRelationship (new MemberRelationship (owner, member)); }
set { SetRelationship (new MemberRelationship (owner, member), value); }
}
public MemberRelationship this [MemberRelationship source] {
get { return GetRelationship (source); }
set { SetRelationship (source, value); }
}
}
}

View File

@ -0,0 +1,61 @@
//
// System.ComponentModel.Design.Serialization.ResolveNameEventArgs.cs
//
// Author:
// Alejandro Sánchez Acosta (raciel@gnome.org)
// Ivan N. Zlatev (contact@i-nz.net)
//
// (C) Alejandro Sánchez Acosta
// (C) 2007 Ivan N. Zlatev
//
//
// 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.ComponentModel.Design.Serialization
{
public class ResolveNameEventArgs : EventArgs
{
private string name;
private object value;
public ResolveNameEventArgs (string name) {
this.name = name;
}
public string Name {
get {
return this.name;
}
}
public object Value {
get {
return this.value;
}
set {
this.value = value;
}
}
}
}

View File

@ -0,0 +1,33 @@
// System.ComponentModel.Design.Serialization.ResolvedNameEventHandler.cs
//
// Author:
// Alejandro Sánchez Acosta <raciel@gnome.org>
//
// (C) Alejandro Sánchez Acosta
//
//
// 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.ComponentModel.Design.Serialization
{
public delegate void ResolveNameEventHandler (object sender, ResolveNameEventArgs e);
}

View File

@ -0,0 +1,81 @@
//
// System.ComponentModel.Design.Serialization.RootDesignerSerializerAttribute.cs
//
// Authors:
// Alejandro Sánchez Acosta (raciel@gnome.org)
// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
//
// (C) Alejandro Sánchez Acosta
// (C) 2003 Andreas Nahr
//
//
// 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.ComponentModel.Design.Serialization
{
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface, AllowMultiple = true, Inherited = true)]
[Obsolete ("Use DesignerSerializerAttribute instead")]
public sealed class RootDesignerSerializerAttribute : Attribute
{
private string serializer;
private string baseserializer;
private bool reload;
public RootDesignerSerializerAttribute (string serializerTypeName, string baseSerializerTypeName, bool reloadable) {
this.serializer = serializerTypeName;
this.baseserializer = baseSerializerTypeName;
this.reload = reloadable;
}
public RootDesignerSerializerAttribute (string serializerTypeName, Type baseSerializerType, bool reloadable)
: this (serializerTypeName, baseSerializerType.AssemblyQualifiedName, reloadable)
{
}
public RootDesignerSerializerAttribute (Type serializerType, Type baseSerializerType, bool reloadable)
: this (serializerType.AssemblyQualifiedName, baseSerializerType.AssemblyQualifiedName, reloadable)
{
}
public bool Reloadable {
get {
return this.reload;
}
}
public string SerializerBaseTypeName {
get {
return this.baseserializer;
}
}
public string SerializerTypeName {
get {
return this.serializer;
}
}
public override object TypeId {
get { return string.Concat (this.ToString(), baseserializer);}
}
}
}

View File

@ -0,0 +1,57 @@
//
// System.ComponentModel.Design.Serialization.SerializationStore
//
// Authors:
// Ivan N. Zlatev (contact i-nZ.net)
//
// (C) 2007 Ivan N. Zlatev
//
// 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.ComponentModel.Design.Serialization
{
public abstract class SerializationStore : IDisposable
{
protected SerializationStore ()
{
}
public abstract ICollection Errors { get; }
public abstract void Close ();
public abstract void Save (Stream stream);
protected virtual void Dispose (bool disposing)
{
if (disposing)
this.Close ();
}
void IDisposable.Dispose ()
{
this.Dispose (true);
}
}
}