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