Free cookie consent management tool by TermsFeed Policy Generator

source: stable/HeuristicLab.ExtLibs/HeuristicLab.Netron/3.0.2672.12446/Netron.Diagramming.Core-3.0.2672.12446/Serialization/Layer.Serialization.cs

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

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

File size: 4.5 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 Layer : 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 Layer(SerializationInfo info, StreamingContext context) {
19      if (Tracing.BinaryDeserializationSwitch.Enabled)
20        Trace.WriteLine("Deserializing the fields of 'Layer'.");
21
22      double version = info.GetDouble("LayerVersion");
23
24      mEntities = info.GetValue(
25          "Entities",
26          typeof(CollectionBase<IDiagramEntity>)) as
27          CollectionBase<IDiagramEntity>;
28
29      mIsVisible = info.GetBoolean("IsVisible");
30
31      mName = info.GetString("Name");
32
33    }
34    #endregion
35
36    #region Serialization events
37    /*
38        [OnSerializing]
39        void OnSerializing(StreamingContext context)
40        {
41            Trace.WriteLine("Starting to serializing the 'Layer' class...");
42        }
43        [OnSerialized]
44        void OnSerialized(StreamingContext context)
45        {
46           
47            Trace.WriteLine("...serialization of 'Layer' finished");
48        }
49        */
50    #endregion
51
52    #region Deserialization events
53    /*
54        [OnDeserializing]
55        void OnDeserializing(StreamingContext context)
56        {
57            Trace.Indent();
58            Trace.WriteLine("Starting deserializing the 'Layer' class...");
59        }
60        */
61    [OnDeserialized]
62    void OnDeserialized(StreamingContext context) {
63      Init();
64      if (Tracing.BinaryDeserializationSwitch.Enabled)
65        Trace.WriteLine("...deserialization of 'Layer' finished");
66    }
67
68    #endregion
69
70    #region Serialization
71    public void GetObjectData(SerializationInfo info, StreamingContext context) {
72      if (Tracing.BinarySerializationSwitch.Enabled)
73        Trace.WriteLine("Serializing the fields of 'Layer'.");
74
75      info.AddValue("LayerVersion", layerVersion);
76
77      info.AddValue("Name", this.Name);
78
79      info.AddValue("IsVisible", IsVisible);
80
81      info.AddValue(
82          "Entities",
83          this.Entities,
84          typeof(CollectionBase<IDiagramEntity>));
85    }
86    #endregion
87
88    #region Xml serialization
89    /// <summary>
90    /// This property is reserved, apply the <see cref="T:System.Xml.Serialization.XmlSchemaProviderAttribute"></see> to the class instead.
91    /// </summary>
92    /// <returns>
93    /// 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.
94    /// </returns>
95    public XmlSchema GetSchema() {
96      throw new NotImplementedException("The method or operation is not implemented.");
97    }
98
99    /// <summary>
100    /// Generates an object from its XML representation.
101    /// </summary>
102    /// <param name="reader">The <see cref="T:System.Xml.XmlReader"></see> stream from which the object is deserialized.</param>
103    public void ReadXml(System.Xml.XmlReader reader) {
104      throw new NotImplementedException("The method or operation is not implemented.");
105    }
106
107    /// <summary>
108    /// Converts an object into its XML representation.
109    /// </summary>
110    /// <param name="writer">The <see cref="T:System.Xml.XmlWriter"></see> stream to which the object is serialized.</param>
111    public void WriteXml(System.Xml.XmlWriter writer) {
112      throw new NotImplementedException("The method or operation is not implemented.");
113    }
114    #endregion
115
116    #region IDeserializationCallback Members
117
118    /// <summary>
119    /// Runs when the entire object graph has been deserialized.
120    /// </summary>
121    /// <param name="sender">The object that initiated the callback. The functionality for this parameter is not currently implemented.</param>
122    public void OnDeserialization(object sender) {
123      if (Tracing.BinaryDeserializationSwitch.Enabled)
124        Trace.WriteLine("IDeserializationCallback of 'Layer' called.");
125    }
126
127    #endregion
128  }
129}
Note: See TracBrowser for help on using the repository browser.