Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Zlatev <ivan@ivanz.com>2007-08-29 23:19:04 +0400
committerIvan Zlatev <ivan@ivanz.com>2007-08-29 23:19:04 +0400
commit03db1d8407d939f55dd11118e0f53fda5730cb60 (patch)
tree7eb808dabf1a56964fbef280fd17f5d5a97fe280 /mcs/class/System/System.ComponentModel.Design.Serialization
parent3eca38f019b1f6324a98b0dbd996c2de32380ea8 (diff)
2007-08-29 Ivan N. Zlatev <contact@i-nz.net>
* ParentControlDesigner.cs: implemented. * IUISelectionService.cs: implemented. * WndProcRouter.cs: implemented. * SelectionFrame.cs: implemented. * ControlDesigner.cs: implemented. * ControlDataObject.cs: implemented. * ComponentTray.cs: implemented. * ScrollableControlDesigner.cs: implemented. * UISelectionService.cs: implemented. * SplitContainerDesigner.cs: implemented. * IMessageReceiver.cs: implemented. * Native.cs: implemented. * DocumentDesigner.cs: implemented. * DefaultSerializationProviderAttribute.cs: implemented. * ComponentSerializationService.cs: implemented. * MemberRelationship.cs: implemented. * SerializationStore.cs: implemented. * DesignSurfaceManager.cs: implemented. * DesignerEventService.cs: implemented. * ComponentDesigner.cs: implemented. * ActiveDesignSurfaceChangedEventHandler.cs: implemented. * LoadedEventHandler.cs: implemented. * DesignSurfaceCollection.cs: implemented. * DesignerHost.cs: implemented. * ExtenderService.cs: implemented. * DesignModeSite.cs: implemented. * SelectionService.cs: implemented. * DesignSurfaceServiceContainer.cs: implemented. * DesignerActionListCollection.cs: implemented. * ActiveDesignSurfaceChangedEventArgs.cs: implemented. * LoadedEventArgs.cs: implemented. * TypeDescriptorFilterService.cs: implemented. * ReferenceService.cs: implemented. * DesignSurface.cs: implemented. * DesignSurfaceEventHandler.cs: implemented. * DesignModeNestedContainer.cs: implemented. * EventBindingService.cs: implemented. * DesignSurfaceEventArgs.cs: implemented. * DesignerOptionService.cs: implemented. * ITreeDesigner.cs: implemented. * CodeDomComponentSerializationService.cs: implemented. * CollectionCodeDomSerializer.cs: implemented. * CodeDomDesignerLoader.cs: implemented. * CodeDomSerializationProvider.cs: implemented. * ComponentCodeDomSerializer.cs: implemented. * RootContext.cs: implemented. * BasicDesignerLoader.cs: implemented. * DesignerSerializationManager.cs: implemented. * EnumCodeDomSerializer.cs: implemented. * SerializeAbsoluteContext.cs: implemented. * MemberCodeDomSerializer.cs: implemented. * PrimitiveCodeDomSerializer.cs: implemented. * CodeDomSerializerBase.cs: implemented. * CodeDomSerializer.cs: implemented. * ExpressionContext.cs: implemented. * EventCodeDomSerializer.cs: implemented. * TypeCodeDomSerializer.cs: implemented. * ObjectStatementCollection.cs: implemented. * RootCodeDomSerializer.cs: implemented. * PropertyCodeDomSerializer.cs: implemented. * StatementContext.cs: implemented. svn path=/trunk/mcs/; revision=85023
Diffstat (limited to 'mcs/class/System/System.ComponentModel.Design.Serialization')
-rw-r--r--mcs/class/System/System.ComponentModel.Design.Serialization/ComponentSerializationService.cs68
-rw-r--r--mcs/class/System/System.ComponentModel.Design.Serialization/DefaultSerializationProviderAttribute.cs67
-rw-r--r--mcs/class/System/System.ComponentModel.Design.Serialization/MemberRelationship.cs93
-rw-r--r--mcs/class/System/System.ComponentModel.Design.Serialization/MemberRelationshipService.cs140
-rw-r--r--mcs/class/System/System.ComponentModel.Design.Serialization/SerializationStore.cs58
5 files changed, 426 insertions, 0 deletions
diff --git a/mcs/class/System/System.ComponentModel.Design.Serialization/ComponentSerializationService.cs b/mcs/class/System/System.ComponentModel.Design.Serialization/ComponentSerializationService.cs
new file mode 100644
index 00000000000..ebb76699f75
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel.Design.Serialization/ComponentSerializationService.cs
@@ -0,0 +1,68 @@
+//
+// 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.
+//
+
+#if NET_2_0
+
+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);
+ }
+}
+#endif
diff --git a/mcs/class/System/System.ComponentModel.Design.Serialization/DefaultSerializationProviderAttribute.cs b/mcs/class/System/System.ComponentModel.Design.Serialization/DefaultSerializationProviderAttribute.cs
new file mode 100644
index 00000000000..4dd9d2bbba6
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel.Design.Serialization/DefaultSerializationProviderAttribute.cs
@@ -0,0 +1,67 @@
+//
+// 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.
+//
+
+#if NET_2_0
+
+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; }
+ }
+ }
+}
+#endif
diff --git a/mcs/class/System/System.ComponentModel.Design.Serialization/MemberRelationship.cs b/mcs/class/System/System.ComponentModel.Design.Serialization/MemberRelationship.cs
new file mode 100644
index 00000000000..008dba9f1d8
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel.Design.Serialization/MemberRelationship.cs
@@ -0,0 +1,93 @@
+//
+// 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.
+//
+
+#if NET_2_0
+
+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;
+ }
+ }
+}
+#endif
diff --git a/mcs/class/System/System.ComponentModel.Design.Serialization/MemberRelationshipService.cs b/mcs/class/System/System.ComponentModel.Design.Serialization/MemberRelationshipService.cs
new file mode 100644
index 00000000000..107a8e389e8
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel.Design.Serialization/MemberRelationshipService.cs
@@ -0,0 +1,140 @@
+//
+// 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.
+//
+
+#if NET_2_0
+
+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); }
+ }
+ }
+}
+#endif
diff --git a/mcs/class/System/System.ComponentModel.Design.Serialization/SerializationStore.cs b/mcs/class/System/System.ComponentModel.Design.Serialization/SerializationStore.cs
new file mode 100644
index 00000000000..406b18b181f
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel.Design.Serialization/SerializationStore.cs
@@ -0,0 +1,58 @@
+//
+// 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.
+//
+
+#if NET_2_0
+
+using System;
+using System.IO;
+
+namespace System.ComponentModel.Design.Serialization
+{
+ public abstract class SerializationStore : IDisposable
+ {
+ public SerializationStore ()
+ {
+ }
+
+ public abstract void Close ();
+ public abstract void Save (Stream stream);
+
+ public void Dispose (bool disposing)
+ {
+ if (disposing)
+ this.Close ();
+ }
+
+ void IDisposable.Dispose ()
+ {
+ this.Dispose (true);
+ }
+ }
+}
+#endif