Changeset 4068 for trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.Netron/3.0.2672.12446/Netron.Diagramming.Core-3.0.2672.12446/Serialization/ConnectorBase.Serialization.cs
- Timestamp:
- 07/22/10 00:44:01 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.Netron/3.0.2672.12446/Netron.Diagramming.Core-3.0.2672.12446/Serialization/ConnectorBase.Serialization.cs
r2768 r4068 1 1 using System; 2 using System.Collections.Generic; 3 using System.Text; 2 using System.Diagnostics; 4 3 using System.Drawing; 5 using System.ComponentModel;6 4 using System.Runtime.Serialization; 5 using System.Xml.Schema; 7 6 using System.Xml.Serialization; 8 using System.Diagnostics; 9 using System.Xml.Schema; 10 namespace Netron.Diagramming.Core 11 { 7 namespace Netron.Diagramming.Core { 8 /// <summary> 9 /// Complementary partial class related to (de)serialization. 10 /// </summary> 11 [Serializable] 12 public abstract partial class ConnectorBase : ISerializable, IXmlSerializable, IDeserializationCallback { 13 #region Deserialization constructor 12 14 /// <summary> 13 /// Complementary partial class related to (de)serialization.15 /// Deserialization constructor 14 16 /// </summary> 15 [Serializable] 16 public abstract partial class ConnectorBase : ISerializable, IXmlSerializable, IDeserializationCallback 17 { 18 #region Deserialization constructor 19 /// <summary> 20 /// Deserialization constructor 21 /// </summary> 22 /// <param name="info">The info.</param> 23 /// <param name="context">The context.</param> 24 protected ConnectorBase(SerializationInfo info, StreamingContext context) : base(info, context) 25 { 26 if(Tracing.BinaryDeserializationSwitch.Enabled) 27 Trace.WriteLine("Deserializing the fields of 'ConnectorBase'."); 17 /// <param name="info">The info.</param> 18 /// <param name="context">The context.</param> 19 protected ConnectorBase(SerializationInfo info, StreamingContext context) 20 : base(info, context) { 21 if (Tracing.BinaryDeserializationSwitch.Enabled) 22 Trace.WriteLine("Deserializing the fields of 'ConnectorBase'."); 28 23 29 24 double version = info.GetDouble("ConnectorBaseVersion"); 30 25 31 32 this.mNameLocation = (ConnectorNameLocation)info.GetValue(33 34 26 this.mShowName = info.GetBoolean("ShowName"); 27 this.mNameLocation = (ConnectorNameLocation)info.GetValue( 28 "NameLocation", 29 typeof(ConnectorNameLocation)); 35 30 36 this.mPoint = (Point)info.GetValue("Point", typeof(Point));37 31 this.mPoint = (Point)info.GetValue("Point", typeof(Point)); 32 mAttachedConnectors = new CollectionBase<IConnector>(); 38 33 39 40 Guid tuid = new Guid(info.GetString("AttachedTo"));41 42 43 44 34 #region Preparation of the anchoring process 35 Guid tuid = new Guid(info.GetString("AttachedTo")); 36 Anchors.Add(this.Uid, new Anchor(tuid, this)); 37 #endregion 38 } 39 #endregion 45 40 46 47 41 #region Serialization events 42 /* 48 43 [OnSerializing] 49 44 void OnSerializing(StreamingContext context) … … 57 52 } 58 53 */ 59 54 #endregion 60 55 61 62 56 #region Deserialization events 57 /* 63 58 [OnDeserializing] 64 59 void OnDeserializing(StreamingContext context) … … 68 63 } 69 64 */ 70 [OnDeserialized] 71 void OnDeserialized(StreamingContext context) 72 { 73 if(Tracing.BinaryDeserializationSwitch.Enabled) 74 Trace.WriteLine("...deserialization of 'ConnectorBase' finished"); 65 [OnDeserialized] 66 void OnDeserialized(StreamingContext context) { 67 if (Tracing.BinaryDeserializationSwitch.Enabled) 68 Trace.WriteLine("...deserialization of 'ConnectorBase' finished"); 75 69 76 70 77 78 }79 80 #endregion81 71 82 #region Serialization 83 /// <summary> 84 /// Populates a <see cref="T:System.Runtime.Serialization.SerializationInfo"></see> with the data needed to serialize the target object. 85 /// </summary> 86 /// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo"></see> to populate with data.</param> 87 /// <param name="context">The destination (see <see cref="T:System.Runtime.Serialization.StreamingContext"></see>) for this serialization.</param> 88 /// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception> 89 public override void GetObjectData(SerializationInfo info, StreamingContext context) 90 { 91 if(Tracing.BinarySerializationSwitch.Enabled) 92 Trace.WriteLine("Serializing the fields of 'ConnectorBase'."); 93 base.GetObjectData(info, context); 72 } 94 73 95 info.AddValue("ConnectorBaseVersion", connectorBaseVersion);74 #endregion 96 75 97 info.AddValue( 98 "NameLocation", 99 mNameLocation, 100 typeof(ConnectorNameLocation)); 76 #region Serialization 77 /// <summary> 78 /// Populates a <see cref="T:System.Runtime.Serialization.SerializationInfo"></see> with the data needed to serialize the target object. 79 /// </summary> 80 /// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo"></see> to populate with data.</param> 81 /// <param name="context">The destination (see <see cref="T:System.Runtime.Serialization.StreamingContext"></see>) for this serialization.</param> 82 /// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception> 83 public override void GetObjectData(SerializationInfo info, StreamingContext context) { 84 if (Tracing.BinarySerializationSwitch.Enabled) 85 Trace.WriteLine("Serializing the fields of 'ConnectorBase'."); 86 base.GetObjectData(info, context); 101 87 102 info.AddValue("ShowName", mShowName); 103 info.AddValue("Point", this.Point, typeof(Point)); 104 if(this.AttachedTo!=null) 105 info.AddValue("AttachedTo", this.AttachedTo.Uid.ToString()); 106 else 107 info.AddValue("AttachedTo", Guid.Empty); 108 109 } 110 #endregion 88 info.AddValue("ConnectorBaseVersion", connectorBaseVersion); 111 89 112 #region Xml serialization 113 /// <summary> 114 /// This property is reserved, apply the <see cref="T:System.Xml.Serialization.XmlSchemaProviderAttribute"></see> to the class instead. 115 /// </summary> 116 /// <returns> 117 /// An <see cref="T:System.Xml.Schema.XmlSchema"></see> that describes the XML representation of the object that is produced by the <see cref="M:System.Xml.Serialization.IXmlSerializable.WriteXml(System.Xml.XmlWriter)"></see> method and consumed by the <see cref="M:System.Xml.Serialization.IXmlSerializable.ReadXml(System.Xml.XmlReader)"></see> method. 118 /// </returns> 119 public override XmlSchema GetSchema() 120 { 121 throw new NotImplementedException("The method or operation is not implemented."); 122 } 90 info.AddValue( 91 "NameLocation", 92 mNameLocation, 93 typeof(ConnectorNameLocation)); 123 94 124 /// <summary> 125 /// Generates an object from its XML representation. 126 /// </summary> 127 /// <param name="reader">The <see cref="T:System.Xml.XmlReader"></see> stream from which the object is deserialized.</param> 128 public override void ReadXml(System.Xml.XmlReader reader) 129 { 130 throw new NotImplementedException("The method or operation is not implemented."); 131 } 95 info.AddValue("ShowName", mShowName); 96 info.AddValue("Point", this.Point, typeof(Point)); 97 if (this.AttachedTo != null) 98 info.AddValue("AttachedTo", this.AttachedTo.Uid.ToString()); 99 else 100 info.AddValue("AttachedTo", Guid.Empty); 132 101 133 /// <summary> 134 /// Converts an object into its XML representation. 135 /// </summary> 136 /// <param name="writer">The <see cref="T:System.Xml.XmlWriter"></see> stream to which the object is serialized.</param> 137 public override void WriteXml(System.Xml.XmlWriter writer) 138 { 139 throw new NotImplementedException("The method or operation is not implemented."); 140 } 141 #endregion 102 } 103 #endregion 142 104 143 #region IDeserializationCallback Members 105 #region Xml serialization 106 /// <summary> 107 /// This property is reserved, apply the <see cref="T:System.Xml.Serialization.XmlSchemaProviderAttribute"></see> to the class instead. 108 /// </summary> 109 /// <returns> 110 /// An <see cref="T:System.Xml.Schema.XmlSchema"></see> that describes the XML representation of the object that is produced by the <see cref="M:System.Xml.Serialization.IXmlSerializable.WriteXml(System.Xml.XmlWriter)"></see> method and consumed by the <see cref="M:System.Xml.Serialization.IXmlSerializable.ReadXml(System.Xml.XmlReader)"></see> method. 111 /// </returns> 112 public override XmlSchema GetSchema() { 113 throw new NotImplementedException("The method or operation is not implemented."); 114 } 144 115 145 /// <summary> 146 /// Runs when the entire object graph has been deserialized. 147 /// </summary> 148 /// <param name="sender">The object that initiated the callback. The functionality for this parameter is not currently implemented.</param> 149 public override void OnDeserialization(object sender) 150 { 151 base.OnDeserialization(sender); 152 153 if(Tracing.BinaryDeserializationSwitch.Enabled) 154 Trace.WriteLine("IDeserializationCallback of 'ConnectorBase' called."); 155 } 116 /// <summary> 117 /// Generates an object from its XML representation. 118 /// </summary> 119 /// <param name="reader">The <see cref="T:System.Xml.XmlReader"></see> stream from which the object is deserialized.</param> 120 public override void ReadXml(System.Xml.XmlReader reader) { 121 throw new NotImplementedException("The method or operation is not implemented."); 122 } 156 123 157 #endregion 124 /// <summary> 125 /// Converts an object into its XML representation. 126 /// </summary> 127 /// <param name="writer">The <see cref="T:System.Xml.XmlWriter"></see> stream to which the object is serialized.</param> 128 public override void WriteXml(System.Xml.XmlWriter writer) { 129 throw new NotImplementedException("The method or operation is not implemented."); 158 130 } 131 #endregion 132 133 #region IDeserializationCallback Members 134 135 /// <summary> 136 /// Runs when the entire object graph has been deserialized. 137 /// </summary> 138 /// <param name="sender">The object that initiated the callback. The functionality for this parameter is not currently implemented.</param> 139 public override void OnDeserialization(object sender) { 140 base.OnDeserialization(sender); 141 142 if (Tracing.BinaryDeserializationSwitch.Enabled) 143 Trace.WriteLine("IDeserializationCallback of 'ConnectorBase' called."); 144 } 145 146 #endregion 147 } 159 148 }
Note: See TracChangeset
for help on using the changeset viewer.