Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/HeuristicLab.ExtLibs/HeuristicLab.Netron/3.0.2672.12446/Netron.Diagramming.Core-3.0.2672.12446/Serialization/Connector.Serialization.cs @ 17729

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

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

File size: 5.6 KB
Line 
1using System;
2using System.Diagnostics;
3using System.Runtime.Serialization;
4using System.Xml.Schema;
5using System.Xml.Serialization;
6
7namespace Netron.Diagramming.Core {
8  // ----------------------------------------------------------------------
9  /// <summary>
10  /// Complementary partial class related to (de)serialization.
11  /// </summary>
12  // ----------------------------------------------------------------------
13  [Serializable]
14  public partial class Connector :
15      ISerializable,
16      IXmlSerializable,
17      IDeserializationCallback {
18    #region Deserialization constructor
19
20    // ------------------------------------------------------------------
21    /// <summary>
22    /// Deserialization constructor
23    /// </summary>
24    /// <param name="info">The info.</param>
25    /// <param name="context">The context.</param>
26    // ------------------------------------------------------------------
27    protected Connector(
28        SerializationInfo info,
29        StreamingContext context)
30      : base(info, context) {
31      if (Tracing.BinaryDeserializationSwitch.Enabled) {
32        Trace.WriteLine("Deserializing the fields of 'Connector'.");
33      }
34
35      double version = info.GetDouble("ConnectorVersion");
36
37      myStyle = (ConnectorStyle)info.GetValue(
38          "ConnectorStyle",
39          typeof(ConnectorStyle));
40    }
41    #endregion
42
43    #region Serialization events
44    /*
45        [OnSerializing]
46        void OnSerializing(StreamingContext context)
47        {
48            Trace.WriteLine("Starting to serializing the 'Connector' class...");
49        }
50        [OnSerialized]
51        void OnSerialized(StreamingContext context)
52        {
53            Trace.WriteLine("...serialization of 'Connector' finished");
54        }
55        */
56    #endregion
57
58    #region Deserialization events
59    /*
60        [OnDeserializing]
61        void OnDeserializing(StreamingContext context)
62        {
63            Trace.Indent();
64            Trace.WriteLine("Starting deserializing the 'Connector' class...");
65        }
66        [OnDeserialized]
67        void OnDeserialized(StreamingContext context)
68         {
69             Trace.WriteLine("...deserialization of 'Connector' finished");
70             Trace.Unindent();
71         }
72       */
73    #endregion
74
75    #region Serialization
76
77    // ------------------------------------------------------------------
78    /// <summary>
79    /// Populates a <see cref=
80    /// "T:System.Runtime.Serialization.SerializationInfo"></see> with
81    /// the data needed to serialize the target object.
82    /// </summary>
83    /// <param name="info">The <see cref=
84    /// "T:System.Runtime.Serialization.SerializationInfo"></see> to
85    /// populate with data.</param>
86    /// <param name="context">The destination (see <see cref=
87    /// "T:System.Runtime.Serialization.StreamingContext"></see>) for
88    /// this serialization.</param>
89    /// <exception cref="T:System.Security.SecurityException">The caller
90    /// does not have the required permission. </exception>
91    // ------------------------------------------------------------------
92    public override void GetObjectData(
93        SerializationInfo info,
94        StreamingContext context) {
95      if (Tracing.BinarySerializationSwitch.Enabled) {
96        Trace.WriteLine("Serializing the fields of 'Connector'.");
97      }
98
99      base.GetObjectData(info, context);
100
101      info.AddValue("ConnectorVersion", connectorVersion);
102      info.AddValue("ConnectorStyle", myStyle, typeof(ConnectorStyle));
103    }
104    #endregion
105
106    #region Xml serialization
107    /// <summary>
108    /// This property is reserved, apply the <see cref="T:System.Xml.Serialization.XmlSchemaProviderAttribute"></see> to the class instead.
109    /// </summary>
110    /// <returns>
111    /// 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.
112    /// </returns>
113    public override XmlSchema GetSchema() {
114      throw new NotImplementedException("The method or operation is not implemented.");
115    }
116
117    /// <summary>
118    /// Generates an object from its XML representation.
119    /// </summary>
120    /// <param name="reader">The <see cref="T:System.Xml.XmlReader"></see> stream from which the object is deserialized.</param>
121    public override void ReadXml(System.Xml.XmlReader reader) {
122      throw new NotImplementedException("The method or operation is not implemented.");
123    }
124
125    /// <summary>
126    /// Converts an object into its XML representation.
127    /// </summary>
128    /// <param name="writer">The <see cref="T:System.Xml.XmlWriter"></see> stream to which the object is serialized.</param>
129    public override void WriteXml(System.Xml.XmlWriter writer) {
130      throw new NotImplementedException("The method or operation is not implemented.");
131    }
132    #endregion
133
134    #region IDeserializationCallback Members
135
136    /// <summary>
137    /// Runs when the entire object graph has been deserialized.
138    /// </summary>
139    /// <param name="sender">The object that initiated the callback. The functionality for this parameter is not currently implemented.</param>
140    public override void OnDeserialization(object sender) {
141      base.OnDeserialization(sender);
142      if (Tracing.BinaryDeserializationSwitch.Enabled)
143        Trace.WriteLine("IDeserializationCallback of 'Connector' called.");
144    }
145
146    #endregion
147  }
148}
Note: See TracBrowser for help on using the repository browser.