/// <summary> /// Reads a <see cref="Duality.Serialization.MetaFormat.DelegateNode"/>, including possible child nodes. /// </summary> /// <param name="node"></param> protected DelegateNode ReadDelegate() { string delegateTypeString = this.reader.ReadString(); uint objId = this.reader.ReadUInt32(); bool multi = this.reader.ReadBoolean(); DataNode method = this.ReadObject() as DataNode; DataNode target = null; // Create the delegate without target and fix it later, so we don't load its target object before setting this object id DelegateNode result = new DelegateNode(delegateTypeString, objId, method, target, null); // Prepare object reference this.idManager.Inject(result, objId); // Load & fix the target object target = this.ReadObject() as DataNode; target.Parent = result; result.Target = target; // Combine multicast delegates if (multi) { DataNode invokeList = this.ReadObject() as DataNode; result.InvokeList = invokeList; } return(result); }
/// <summary> /// Reads a <see cref="Duality.Serialization.MetaFormat.DelegateNode"/>, including possible child nodes. /// </summary> /// <param name="node"></param> protected DelegateNode ReadDelegate() { string delegateTypeString = this.reader.GetAttribute("type"); string objIdString = this.reader.GetAttribute("id"); string multiString = this.reader.GetAttribute("multi"); uint objId = objIdString == null ? 0 : XmlConvert.ToUInt32(objIdString); bool multi = objIdString != null && XmlConvert.ToBoolean(multiString); DataNode method = this.ReadObjectData() as DataNode; DataNode target = null; // Create the delegate without target and fix it later, so we don't load its target object before setting this object id DelegateNode result = new DelegateNode(delegateTypeString, objId, method, target, null); // Prepare object reference this.idManager.Inject(result, objId); // Load & fix the target object target = this.ReadObjectData() as DataNode; target.Parent = result; result.Target = target; // Combine multicast delegates if (multi) { DataNode invokeList = this.ReadObjectData() as DataNode; result.InvokeList = invokeList; } return(result); }
/// <summary> /// Writes the specified <see cref="Duality.Serialization.MetaFormat.DelegateNode"/>, including possible child nodes. /// </summary> /// <param name="node"></param> protected void WriteDelegate(DelegateNode node) { // Write the delegates type this.writer.Write(node.TypeString); this.writer.Write(node.ObjId); this.writer.Write(node.InvokeList != null); this.WriteObject(node.Method); this.WriteObject(node.Target); if (node.InvokeList != null) { this.WriteObject(node.InvokeList); } }
/// <summary> /// Writes the specified <see cref="Duality.Serialization.MetaFormat.DelegateNode"/>, including possible child nodes. /// </summary> /// <param name="node"></param> protected void WriteDelegate(DelegateNode node) { // Write the delegates type this.writer.WriteAttributeString("type", node.TypeString); if (node.ObjId != 0) { this.writer.WriteAttributeString("id", XmlConvert.ToString(node.ObjId)); } if (node.InvokeList != null) { this.writer.WriteAttributeString("multi", XmlConvert.ToString(true)); } this.WriteObjectData(node.Method); this.WriteObjectData(node.Target); if (node.InvokeList != null) { this.WriteObjectData(node.InvokeList); } }
/// <summary> /// Reads a <see cref="Duality.Serialization.MetaFormat.DelegateNode"/>, including possible child nodes. /// </summary> /// <param name="node"></param> protected DelegateNode ReadDelegate() { string delegateTypeString = this.reader.GetAttribute("type"); string objIdString = this.reader.GetAttribute("id"); string multiString = this.reader.GetAttribute("multi"); uint objId = objIdString == null ? 0 : XmlConvert.ToUInt32(objIdString); bool multi = objIdString != null && XmlConvert.ToBoolean(multiString); DataNode method = this.ReadObject() as DataNode; DataNode target = null; // Create the delegate without target and fix it later, so we don't load its target object before setting this object id DelegateNode result = new DelegateNode(delegateTypeString, objId, method, target, null); // Prepare object reference this.idManager.Inject(result, objId); // Load & fix the target object target = this.ReadObject() as DataNode; target.Parent = result; result.Target = target; // Combine multicast delegates if (multi) { DataNode invokeList = this.ReadObject() as DataNode; result.InvokeList = invokeList; } return result; }
/// <summary> /// Writes the specified <see cref="Duality.Serialization.MetaFormat.DelegateNode"/>, including possible child nodes. /// </summary> /// <param name="node"></param> protected void WriteDelegate(DelegateNode node) { // Write the delegates type this.writer.WriteAttributeString("type", node.TypeString); if (node.ObjId != 0) this.writer.WriteAttributeString("id", XmlConvert.ToString(node.ObjId)); if (node.InvokeList != null) this.writer.WriteAttributeString("multi", XmlConvert.ToString(true)); this.WriteObject(node.Method); this.WriteObject(node.Target); if (node.InvokeList != null) this.WriteObject(node.InvokeList); }
/// <summary> /// Writes the specified <see cref="Duality.Serialization.MetaFormat.DelegateNode"/>, including possible child nodes. /// </summary> /// <param name="node"></param> protected void WriteDelegate(DelegateNode node) { // Write the delegates type this.writer.Write(node.TypeString); this.writer.Write(node.ObjId); this.writer.Write(node.InvokeList != null); this.WriteObject(node.Method); this.WriteObject(node.Target); if (node.InvokeList != null) this.WriteObject(node.InvokeList); }
/// <summary> /// Reads a <see cref="Duality.Serialization.MetaFormat.DelegateNode"/>, including possible child nodes. /// </summary> /// <param name="node"></param> protected DelegateNode ReadDelegate() { string delegateTypeString = this.reader.ReadString(); uint objId = this.reader.ReadUInt32(); bool multi = this.reader.ReadBoolean(); DataNode method = this.ReadObjectData() as DataNode; DataNode target = null; // Create the delegate without target and fix it later, so we don't load its target object before setting this object id DelegateNode result = new DelegateNode(delegateTypeString, objId, method, target, null); // Prepare object reference this.idManager.Inject(result, objId); // Load & fix the target object target = this.ReadObjectData() as DataNode; target.Parent = result; result.Target = target; // Combine multicast delegates if (multi) { DataNode invokeList = this.ReadObjectData() as DataNode; result.InvokeList = invokeList; } return result; }