Changeset 4068 for trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.Netron/3.0.2672.12446/Netron.Diagramming.Core-3.0.2672.12446/Serialization/ImageShape.Serialization.cs
- Timestamp:
- 07/22/10 00:44:01 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.Netron/3.0.2672.12446/Netron.Diagramming.Core-3.0.2672.12446/Serialization/ImageShape.Serialization.cs
r2768 r4068 1 1 using System; 2 using System.IO; 3 using System.Collections.Generic; 4 using System.Text; 2 using System.Diagnostics; 5 3 using System.Drawing; 6 using System.ComponentModel;7 4 using System.Runtime.Serialization; 5 using System.Xml.Schema; 8 6 using System.Xml.Serialization; 9 using System.Diagnostics; 10 using System.Xml.Schema; 11 namespace Netron.Diagramming.Core 12 { 7 namespace 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 13 14 /// <summary> 14 /// Complementary partial class related to (de)serialization.15 /// Deserialization constructor 15 16 /// </summary> 16 [Serializable] 17 public partial class ImageShape : ISerializable, IXmlSerializable, IDeserializationCallback 18 { 19 #region Deserialization constructor 20 /// <summary> 21 /// Deserialization constructor 22 /// </summary> 23 /// <param name="info">The info.</param> 24 /// <param name="context">The context.</param> 25 protected ImageShape(SerializationInfo info, StreamingContext context) 26 : base(info, context) 27 { 28 if(Tracing.BinaryDeserializationSwitch.Enabled) 29 Trace.WriteLine("Deserializing the fields of 'ImageShape'."); 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'."); 30 23 31 double version = info.GetDouble("ImageShapeVersion"); 32 33 try 34 { 35 mImage = info.GetValue("Image", typeof(Image)) as Bitmap; 36 if (mImage != null) 37 { 38 mImagePath = info.GetString("ImagePath"); 39 } 24 double version = info.GetDouble("ImageShapeVersion"); 40 25 41 }42 catch(Exception exc)43 44 Trace.WriteLine(exc.Message);45 26 try { 27 mImage = info.GetValue("Image", typeof(Image)) as Bitmap; 28 if (mImage != null) { 29 mImagePath = info.GetString("ImagePath"); 30 } 46 31 47 } 48 #endregion 32 } 33 catch (Exception exc) { 34 Trace.WriteLine(exc.Message); 35 } 49 36 50 #region Serialization events 51 /* 37 } 38 #endregion 39 40 #region Serialization events 41 /* 52 42 [OnSerializing] 53 43 void OnSerializing(StreamingContext context) … … 63 53 } 64 54 */ 65 55 #endregion 66 56 67 68 57 #region Deserialization events 58 /* 69 59 [OnDeserializing] 70 60 void OnDeserializing(StreamingContext context) … … 80 70 } 81 71 */ 82 72 #endregion 83 73 84 #region Serialization 85 /// <summary> 86 /// Populates a <see cref="T:System.Runtime.Serialization.SerializationInfo"></see> with the data needed to serialize the target object. 87 /// </summary> 88 /// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo"></see> to populate with data.</param> 89 /// <param name="context">The destination (see <see cref="T:System.Runtime.Serialization.StreamingContext"></see>) for this serialization.</param> 90 /// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception> 91 public override void GetObjectData(SerializationInfo info, StreamingContext context) 92 { 93 if(Tracing.BinarySerializationSwitch.Enabled) 94 Trace.WriteLine("Serializing the fields of 'ImageShape'."); 95 base.GetObjectData(info, context); 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); 96 85 97 98 99 86 info.AddValue("ImageShapeVersion", imageShapeVersion); 87 info.AddValue("ImagePath", this.mImagePath); 88 info.AddValue("Image", mImage, typeof(Image)); 100 89 101 102 90 } 91 #endregion 103 92 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 override XmlSchema GetSchema() 112 { 113 throw new NotImplementedException("The method or operation is not implemented."); 114 } 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 } 115 103 116 /// <summary> 117 /// Generates an object from its XML representation. 118 /// </summary> 119 /// <param name="reader">The <see cref="T:System.Xml.XmlReader"></see> stream from which the object is deserialized.</param> 120 public override void ReadXml(System.Xml.XmlReader reader) 121 { 122 throw new NotImplementedException("The method or operation is not implemented."); 123 } 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 } 124 111 125 /// <summary> 126 /// Converts an object into its XML representation. 127 /// </summary> 128 /// <param name="writer">The <see cref="T:System.Xml.XmlWriter"></see> stream to which the object is serialized.</param> 129 public override void WriteXml(System.Xml.XmlWriter writer) 130 { 131 throw new NotImplementedException("The method or operation is not implemented."); 132 } 133 #endregion 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 134 120 135 121 136 122 137 /// <summary> 138 /// Runs when the entire object graph has been deserialized. 139 /// </summary> 140 /// <param name="sender">The object that initiated the callback. The functionality for this parameter is not currently implemented.</param> 141 public override void OnDeserialization(object sender) 142 { 143 base.OnDeserialization(sender); 144 if(Tracing.BinaryDeserializationSwitch.Enabled) 145 Trace.WriteLine("IDeserializationCallback of 'ImageShape' called."); 146 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."); 147 131 148 } 132 149 133 } 134 } 150 135 }
Note: See TracChangeset
for help on using the changeset viewer.