using System;
using System.Diagnostics;
using System.Runtime.Serialization;
using System.Xml.Schema;
using System.Xml.Serialization;
namespace Netron.Diagramming.Core {
///
/// Complementary partial class related to (de)serialization.
///
[Serializable]
public partial class Layer : ISerializable, IXmlSerializable, IDeserializationCallback {
#region Deserialization constructor
///
/// Deserialization constructor
///
/// The info.
/// The context.
protected Layer(SerializationInfo info, StreamingContext context) {
if (Tracing.BinaryDeserializationSwitch.Enabled)
Trace.WriteLine("Deserializing the fields of 'Layer'.");
double version = info.GetDouble("LayerVersion");
mEntities = info.GetValue(
"Entities",
typeof(CollectionBase)) as
CollectionBase;
mIsVisible = info.GetBoolean("IsVisible");
mName = info.GetString("Name");
}
#endregion
#region Serialization events
/*
[OnSerializing]
void OnSerializing(StreamingContext context)
{
Trace.WriteLine("Starting to serializing the 'Layer' class...");
}
[OnSerialized]
void OnSerialized(StreamingContext context)
{
Trace.WriteLine("...serialization of 'Layer' finished");
}
*/
#endregion
#region Deserialization events
/*
[OnDeserializing]
void OnDeserializing(StreamingContext context)
{
Trace.Indent();
Trace.WriteLine("Starting deserializing the 'Layer' class...");
}
*/
[OnDeserialized]
void OnDeserialized(StreamingContext context) {
Init();
if (Tracing.BinaryDeserializationSwitch.Enabled)
Trace.WriteLine("...deserialization of 'Layer' finished");
}
#endregion
#region Serialization
public void GetObjectData(SerializationInfo info, StreamingContext context) {
if (Tracing.BinarySerializationSwitch.Enabled)
Trace.WriteLine("Serializing the fields of 'Layer'.");
info.AddValue("LayerVersion", layerVersion);
info.AddValue("Name", this.Name);
info.AddValue("IsVisible", IsVisible);
info.AddValue(
"Entities",
this.Entities,
typeof(CollectionBase));
}
#endregion
#region Xml serialization
///
/// This property is reserved, apply the to the class instead.
///
///
/// An that describes the XML representation of the object that is produced by the method and consumed by the method.
///
public XmlSchema GetSchema() {
throw new NotImplementedException("The method or operation is not implemented.");
}
///
/// Generates an object from its XML representation.
///
/// The stream from which the object is deserialized.
public void ReadXml(System.Xml.XmlReader reader) {
throw new NotImplementedException("The method or operation is not implemented.");
}
///
/// Converts an object into its XML representation.
///
/// The stream to which the object is serialized.
public void WriteXml(System.Xml.XmlWriter writer) {
throw new NotImplementedException("The method or operation is not implemented.");
}
#endregion
#region IDeserializationCallback Members
///
/// Runs when the entire object graph has been deserialized.
///
/// The object that initiated the callback. The functionality for this parameter is not currently implemented.
public void OnDeserialization(object sender) {
if (Tracing.BinaryDeserializationSwitch.Enabled)
Trace.WriteLine("IDeserializationCallback of 'Layer' called.");
}
#endregion
}
}