Free cookie consent management tool by TermsFeed Policy Generator

source: tags/3.3.3/HeuristicLab.ExtLibs/HeuristicLab.Netron/3.0.2672.12446/Netron.Diagramming.Core-3.0.2672.12446/Serialization/ConnectorBase.Serialization.cs @ 13398

Last change on this file since 13398 was 4068, checked in by swagner, 14 years ago

Sorted usings and removed unused usings in entire solution (#1094)

File size: 5.8 KB
Line 
1using System;
2using System.Diagnostics;
3using System.Drawing;
4using System.Runtime.Serialization;
5using System.Xml.Schema;
6using System.Xml.Serialization;
7namespace 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
14    /// <summary>
15    /// Deserialization constructor
16    /// </summary>
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'.");
23
24      double version = info.GetDouble("ConnectorBaseVersion");
25
26      this.mShowName = info.GetBoolean("ShowName");
27      this.mNameLocation = (ConnectorNameLocation)info.GetValue(
28          "NameLocation",
29          typeof(ConnectorNameLocation));
30
31      this.mPoint = (Point)info.GetValue("Point", typeof(Point));
32      mAttachedConnectors = new CollectionBase<IConnector>();
33
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
40
41    #region Serialization events
42    /*
43        [OnSerializing]
44        void OnSerializing(StreamingContext context)
45        {
46            Trace.WriteLine("Starting to serializing the 'ConnectorBase' class...");
47        }
48        [OnSerialized]
49        void OnSerialized(StreamingContext context)
50        {
51            Trace.WriteLine("...serialization of 'ConnectorBase' finished");
52        }
53        */
54    #endregion
55
56    #region Deserialization events
57    /*
58        [OnDeserializing]
59        void OnDeserializing(StreamingContext context)
60        {
61            Trace.Indent();
62            Trace.WriteLine("Starting deserializing the 'ConnectorBase' class...");
63        }
64        */
65    [OnDeserialized]
66    void OnDeserialized(StreamingContext context) {
67      if (Tracing.BinaryDeserializationSwitch.Enabled)
68        Trace.WriteLine("...deserialization of 'ConnectorBase' finished");
69
70
71
72    }
73
74    #endregion
75
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);
87
88      info.AddValue("ConnectorBaseVersion", connectorBaseVersion);
89
90      info.AddValue(
91          "NameLocation",
92          mNameLocation,
93          typeof(ConnectorNameLocation));
94
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);
101
102    }
103    #endregion
104
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    }
115
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    }
123
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.");
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  }
148}
Note: See TracBrowser for help on using the repository browser.