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/ShapeMaterialBase.Serialization.cs @ 2768

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

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

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