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