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