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/Document.Serialization.cs @ 18009

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

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

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