Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.Netron/3.0.2672.12446/Netron.Diagramming.Core-3.0.2672.12446/Serialization/PenStyle.Serialization.cs @ 3757

Last change on this file since 3757 was 2768, checked in by mkommend, 14 years ago

added solution folders and sources for the netron library (ticket #867)

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