private void GraphInit() { XmlElement graph = myIohandler.ReadFile(); var nodes = graph.GetNode(XmlNames.Nodes); var edges = graph.GetNode(XmlNames.Edges); //Nodes foreach (XmlElement curItem in nodes) { Node newNode = (Node)SerializableHelper.Deserialize(curItem, myConfiguration); if (newNode == null) { throw new SerializationException($"Error found during Deserialize. XML:{curItem}"); } myNodeList.Add(newNode.Guid, newNode); } //Edges foreach (XmlElement curItem in edges) { Edge newEdge = (Edge)SerializableHelper.Deserialize(curItem, myConfiguration); if (newEdge == null) { throw new SerializationException($"Error found during Deserialize. XML:{curItem}"); } //Add Link AddEdgeByGuid(newEdge.FromGuid, newEdge.ToGuid, newEdge); } }
private void GraphInit() { ErrorCode err; XmlElement graph = myIohandler.ReadFile(out err); if (err != ErrorCode.NoError) { throw new Exception($"Error found during read DB file. Error Code:{err}"); } var nodes = graph.GetNode(XmlNames.Nodes); var edges = graph.GetNode(XmlNames.Edges); //Nodes foreach (XmlElement curItem in nodes) { INode newNode = (INode)SerializableHelper.Deserialize(curItem); if (newNode == null) { throw new Exception($"Error found during Deserialize. XML:{curItem}"); } myNodeList.Add(newNode.Guid, newNode); } //Edges foreach (XmlElement curItem in edges) { IEdge newEdge = (IEdge)SerializableHelper.Deserialize(curItem); if (newEdge == null) { throw new Exception($"Error found during Deserialize. XML:{curItem}"); } //Add Link AddEdge(newEdge.FromGuid, newEdge.ToGuid, newEdge); } }