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/PenStyle.Serialization.cs @ 16462

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

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

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