public virtual void Serialize(object obj, Altaxo.Serialization.Xml.IXmlSerializationInfo info) { DocNodeProxy s = (DocNodeProxy)obj; if (s._docNode is Main.IDocumentNode) { info.AddValue("Node", Main.DocumentPath.GetAbsolutePath((Main.IDocumentNode)s._docNode)); } else if (s._docNodePath != null) { info.AddValue("Node", s._docNodePath); } else { info.AddValue("Node", s._docNode); } }
/// <summary> /// Cloning constructor. /// </summary> /// <param name="from">Object to clone from.</param> public DocNodeProxy(DocNodeProxy from) { if (from._docNode is Main.IDocumentNode) { this.SetDocNode(from._docNode); // than the new Proxy refers to the same document node } else if (from._docNode is ICloneable) { this.SetDocNode(((System.ICloneable)from._docNode).Clone()); // clone the underlying object } else if (from._docNode != null) { this.SetDocNode(from._docNode); // the underlying object is not cloneable, so refer directly to it } else if (from._docNodePath != null) { this._docNodePath = from._docNodePath.Clone(); // if no current document available, clone only the path } }
/// <summary> /// Cloning constructor. /// </summary> /// <param name="from">Object to clone from.</param> public DocNodeProxy(DocNodeProxy from) { if (null == from) { throw new ArgumentNullException(nameof(from)); } if (from.IsDisposeInProgress) { throw new ObjectDisposedException(nameof(from)); } if (null != from.InternalDocumentNode) { SetDocNode(from.InternalDocumentNode); // than the new Proxy refers to the same document node } else { InternalDocumentPath = from._docNodePath.Clone(); // if no current document available, clone only the path InternalCheckAbsolutePath(); } }
public virtual object Deserialize(object o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent) { DocNodeProxy s = null != o ?(DocNodeProxy)o : new DocNodeProxy(); object node = info.GetValue("Node", typeof(object)); if (node is Main.DocumentPath) { s._docNodePath = (Main.DocumentPath)node; } else { s.SetDocNode(node); } // create a callback to resolve the instance as early as possible if (s._docNodePath != null && s._docNode == null) { info.DeserializationFinished += new Altaxo.Serialization.Xml.XmlDeserializationCallbackEventHandler(s.EhXmlDeserializationFinished); } return(s); }
/// <summary> /// Cloning constructor. /// </summary> /// <param name="from">Object to clone from.</param> public DocNodeProxy(DocNodeProxy from) { if (null == from) throw new ArgumentNullException(nameof(from)); if (from.IsDisposeInProgress) throw new ObjectDisposedException(nameof(from)); if (null != from.InternalDocumentNode) { this.SetDocNode(from.InternalDocumentNode); // than the new Proxy refers to the same document node } else { this.InternalDocumentPath = from._docNodePath.Clone(); // if no current document available, clone only the path InternalCheckAbsolutePath(); } }
/// <summary> /// Cloning constructor. /// </summary> /// <param name="from">Object to clone from.</param> public DocNodeProxy(DocNodeProxy from) { if (from._docNode is Main.IDocumentNode) this.SetDocNode(from._docNode); // than the new Proxy refers to the same document node else if (from._docNode is ICloneable) this.SetDocNode(((System.ICloneable)from._docNode).Clone()); // clone the underlying object else if (from._docNode != null) this.SetDocNode(from._docNode); // the underlying object is not cloneable, so refer directly to it else if(from._docNodePath != null) this._docNodePath= from._docNodePath.Clone(); // if no current document available, clone only the path }