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