public void ConsumeNodeXml(XmlReader xml, string domainNodeId, string documentLibraryUrl) { if (xml != null && xml.NodeType == XmlNodeType.Element && xml.Name == "node") { #region Attribute Values #region Id if (xml.MoveToAttribute("id")) { Id = xml.Value; } #endregion #region NodeType if (Id == domainNodeId) { _nodeType = IoCContainer.GetInjectionInstance().GetInstance <TransactionalNodeService.Proxy.IMapManager>().NodeTypes["DomainNode"]; } else { if (xml.MoveToAttribute("type")) { switch (xml.Value) { case CON_NODE_TYPE_ID: _nodeType = IoCContainer.GetInjectionInstance().GetInstance <TransactionalNodeService.Proxy.IMapManager>().NodeTypes["CompendiumConNode"]; break; case DECISION_NODE_TYPE_ID: _nodeType = IoCContainer.GetInjectionInstance().GetInstance <TransactionalNodeService.Proxy.IMapManager>().NodeTypes["CompendiumDecisionNode"]; break; case IDEA_NODE_TYPE_ID: _nodeType = IoCContainer.GetInjectionInstance().GetInstance <TransactionalNodeService.Proxy.IMapManager>().NodeTypes["CompendiumIdeaNode"]; break; case MAP_NODE_TYPE_ID: _nodeType = IoCContainer.GetInjectionInstance().GetInstance <TransactionalNodeService.Proxy.IMapManager>().NodeTypes["CompendiumMapNode"]; break; case PRO_NODE_TYPE_ID: _nodeType = IoCContainer.GetInjectionInstance().GetInstance <TransactionalNodeService.Proxy.IMapManager>().NodeTypes["CompendiumProNode"]; break; case QUESTION_NODE_TYPE_ID: _nodeType = IoCContainer.GetInjectionInstance().GetInstance <TransactionalNodeService.Proxy.IMapManager>().NodeTypes["CompendiumQuestionNode"]; break; case REFERENCE_NODE_TYPE_ID: _nodeType = IoCContainer.GetInjectionInstance().GetInstance <TransactionalNodeService.Proxy.IMapManager>().NodeTypes["CompendiumReferenceNode"]; break; case ARGUMENT_NODE_TYPE_ID: _nodeType = IoCContainer.GetInjectionInstance().GetInstance <TransactionalNodeService.Proxy.IMapManager>().NodeTypes["CompendiumArgumentNode"]; break; case NOTE_NODE_TYPE_ID: _nodeType = IoCContainer.GetInjectionInstance().GetInstance <TransactionalNodeService.Proxy.IMapManager>().NodeTypes["CompendiumNoteNode"]; break; case LIST_NODE_TYPE_ID: _nodeType = IoCContainer.GetInjectionInstance().GetInstance <TransactionalNodeService.Proxy.IMapManager>().NodeTypes["CompendiumListNode"]; break; default: _nodeType = IoCContainer.GetInjectionInstance().GetInstance <TransactionalNodeService.Proxy.IMapManager>().NodeTypes["CompendiumNoteNode"]; break; } } } #endregion #region CreatedBy if (xml.MoveToAttribute("author")) { CreatedBy = xml.Value; } #endregion #region Created if (xml.MoveToAttribute("created")) { string createdMillisecondsXmlValue = xml.Value; long createdMilliseconds; if (long.TryParse(createdMillisecondsXmlValue, out createdMilliseconds)) { Created = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); Created = Created.AddMilliseconds(createdMilliseconds); } } #endregion #region LastModified if (xml.MoveToAttribute("lastModified")) { string lastModifiedMillisecondsXmlValue = xml.Value; long lastModifiedMilliseconds; if (long.TryParse(lastModifiedMillisecondsXmlValue, out lastModifiedMilliseconds)) { LastModified = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); LastModified = LastModified.AddMilliseconds(lastModifiedMilliseconds); } } #endregion #region Name if (xml.MoveToAttribute("label")) { Name = xml.Value; } #endregion #region LastModifiedBy if (xml.MoveToAttribute("lastModificationAuthor")) { LastModifiedBy = xml.Value; } #endregion #endregion while (xml.Read()) { if (xml.NodeType == XmlNodeType.Element) { if (xml.Name.ToLower() == "details") { } if (_nodeType.Name == "CompendiumReferenceNode") { if (xml.Name.ToLower() == "source") { string fullFilePath = xml.ReadInnerXml(); if (!string.IsNullOrEmpty(fullFilePath)) { if (fullFilePath.ToLower().StartsWith("http://") || fullFilePath.ToLower().StartsWith("https://") || fullFilePath.ToLower().StartsWith("ftp://") || fullFilePath.ToLower().StartsWith("ftps://")) { Attachment = fullFilePath; } else { string linkedFileName = string.Empty; if (fullFilePath.LastIndexOf("/") < 0 && fullFilePath.LastIndexOf("\\") > 0) { linkedFileName = fullFilePath.Substring(fullFilePath.LastIndexOf("\\") + 1); } else { linkedFileName = fullFilePath.Substring(fullFilePath.LastIndexOf("/") + 1); } Attachment = documentLibraryUrl + linkedFileName; //set the file name, the node name is can change independently } } } } } else if (xml.NodeType == XmlNodeType.EndElement && xml.Name == "node") { break; } } } }
public XmlCompendiumNode(TransactionalNodeService.Proxy.NodeType nodeType) : this() { _nodeType = nodeType; }