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/ImageShape.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.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 ImageShape : 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 ImageShape(SerializationInfo info, StreamingContext context)
20      : base(info, context) {
21      if (Tracing.BinaryDeserializationSwitch.Enabled)
22        Trace.WriteLine("Deserializing the fields of 'ImageShape'.");
23
24      double version = info.GetDouble("ImageShapeVersion");
25
26      try {
27        mImage = info.GetValue("Image", typeof(Image)) as Bitmap;
28        if (mImage != null) {
29          mImagePath = info.GetString("ImagePath");
30        }
31
32      }
33      catch (Exception exc) {
34        Trace.WriteLine(exc.Message);
35      }
36
37    }
38    #endregion
39
40    #region Serialization events
41    /*
42        [OnSerializing]
43        void OnSerializing(StreamingContext context)
44        {
45            Trace.Indent();
46            Trace.WriteLine("Starting to serializing the 'ImageShape' class...");
47        }
48        [OnSerialized]
49        void OnSerialized(StreamingContext context)
50        {
51            Trace.WriteLine("...serialization of 'ImageShape' finished");
52            Trace.Unindent();
53        }
54        */
55    #endregion
56
57    #region Deserialization events
58    /*
59        [OnDeserializing]     
60        void OnDeserializing(StreamingContext context)
61        {
62            Trace.Indent();
63            Trace.WriteLine("IDeserializationCallback of 'ImageShape' called.");
64        }
65        [OnDeserialized]
66        void OnDeserialized(StreamingContext context)
67         {
68             Trace.WriteLine("...deserialization of 'ImageShape' finished");
69             Trace.Unindent();
70         }
71       */
72    #endregion
73
74    #region Serialization
75    /// <summary>
76    /// Populates a <see cref="T:System.Runtime.Serialization.SerializationInfo"></see> with the data needed to serialize the target object.
77    /// </summary>
78    /// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo"></see> to populate with data.</param>
79    /// <param name="context">The destination (see <see cref="T:System.Runtime.Serialization.StreamingContext"></see>) for this serialization.</param>
80    /// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
81    public override void GetObjectData(SerializationInfo info, StreamingContext context) {
82      if (Tracing.BinarySerializationSwitch.Enabled)
83        Trace.WriteLine("Serializing the fields of 'ImageShape'.");
84      base.GetObjectData(info, context);
85
86      info.AddValue("ImageShapeVersion", imageShapeVersion);
87      info.AddValue("ImagePath", this.mImagePath);
88      info.AddValue("Image", mImage, typeof(Image));
89
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 override XmlSchema GetSchema() {
101      throw new NotImplementedException("The method or operation is not implemented.");
102    }
103
104    /// <summary>
105    /// Generates an object from its XML representation.
106    /// </summary>
107    /// <param name="reader">The <see cref="T:System.Xml.XmlReader"></see> stream from which the object is deserialized.</param>
108    public override void ReadXml(System.Xml.XmlReader reader) {
109      throw new NotImplementedException("The method or operation is not implemented.");
110    }
111
112    /// <summary>
113    /// Converts an object into its XML representation.
114    /// </summary>
115    /// <param name="writer">The <see cref="T:System.Xml.XmlWriter"></see> stream to which the object is serialized.</param>
116    public override void WriteXml(System.Xml.XmlWriter writer) {
117      throw new NotImplementedException("The method or operation is not implemented.");
118    }
119    #endregion
120
121
122
123    /// <summary>
124    /// Runs when the entire object graph has been deserialized.
125    /// </summary>
126    /// <param name="sender">The object that initiated the callback. The functionality for this parameter is not currently implemented.</param>
127    public override void OnDeserialization(object sender) {
128      base.OnDeserialization(sender);
129      if (Tracing.BinaryDeserializationSwitch.Enabled)
130        Trace.WriteLine("IDeserializationCallback of 'ImageShape' called.");
131
132
133    }
134  }
135}
Note: See TracBrowser for help on using the repository browser.