private void UpdateNodesAndSlostWithResolveMissingSlotAfterAction(IStorage storage, List<IVisualNode> nodeList, List<uint> slotIdList) { DataHeader header = new DataHeader(); storage.Seek(12, SeekOrigin.Current); //By-pass the reading of total number of slots stored foreach (uint slotId in slotIdList) { header.Deserialize(storage); if (this.graphController.ContainSlotKey(slotId)) { ISlot slot = this.graphController.GetSlot(slotId); slot.Deserialize(storage); } else { ISlot slot = Slot.Create(this.graphController, storage); this.graphController.AddSlot(slot); } } storage.Seek(12, SeekOrigin.Current); //By-pass the reading of total number of nodes stored foreach (IVisualNode node in nodeList) { header.Deserialize(storage); node.Deserialize(storage); } }
private void UpdateRuntimeStates(IStorage storage, RuntimeStates runtimeStates) { DataHeader header = new DataHeader(); header.Deserialize(storage); runtimeStates.Deserialize(storage); }
private void UpdateEdges(IStorage storage, List<IVisualEdge> edgeList) { DataHeader header = new DataHeader(); storage.Seek(12, SeekOrigin.Current); //By-pass the reading of total number of edges stored foreach (IVisualEdge edge in edgeList) { header.Deserialize(storage); edge.Deserialize(storage); } }
public void TestDeserializeNullException() { IGraphController graphController = new GraphController(null); IStorage storage = null; DataHeader header = new DataHeader(); Assert.Throws<ArgumentNullException>(() => { header.Deserialize(storage); }); }
private List<IVisualNode> RetrieveNodesFromStorage(IStorage storage) { DataHeader header = new DataHeader(); List<IVisualNode> nodeList = new List<IVisualNode>(); int nodeCount = storage.ReadInteger(FieldCode.NodeCount); for (int i = 0; i < nodeCount; i++) { header.Deserialize(storage); IVisualNode node = VisualNode.Create(this.graphController, storage); nodeList.Add(node); } return nodeList; }
private List<IVisualNode> RetrieveNodesFromIdsInStorage(IStorage storage) { DataHeader header = new DataHeader(); List<IVisualNode> nodeList = new List<IVisualNode>(); int nodeCount = storage.ReadInteger(FieldCode.NodeCount); for (int i = 0; i < nodeCount; i++) { header.Deserialize(storage); uint nodeId = storage.ReadUnsignedInteger(FieldCode.NodeId); nodeList.Add(this.graphController.GetVisualNode(nodeId)); } return nodeList; }
private List<IVisualEdge> RetrieveEdgesFromStorage(IStorage storage) { DataHeader header = new DataHeader(); List<IVisualEdge> edgeList = new List<IVisualEdge>(); int edgeCount = storage.ReadInteger(FieldCode.EdgeCount); for (int i = 0; i < edgeCount; i++) { header.Deserialize(storage); IVisualEdge edge = this.graphController.CreateEdgeFromStorage(storage); edgeList.Add(edge); } return edgeList; }
private List<ISlot> RetrieveSlotsFromStorage(IStorage storage) { DataHeader header = new DataHeader(); List<ISlot> slotList = new List<ISlot>(); int slotCount = storage.ReadInteger(FieldCode.SlotCount); for (int i = 0; i < slotCount; i++) { header.Deserialize(storage); ISlot slot = Slot.Create(this.graphController, storage); slotList.Add(slot); } return slotList; }
public void TestDeserilaizeOperationException() { IGraphController graphController = new GraphController(null); IStorage storage = new BinaryStorage(); DataHeader header = new DataHeader(); storage.WriteUnsignedInteger(FieldCode.DataHeaderSignature, 21); storage.Seek(0, SeekOrigin.Begin); Assert.Throws<InvalidOperationException>(() => { header.Deserialize(storage); }); }
private List <IVisualEdge> RetrieveEdgesFromIdsInStorage(IStorage storage) { DataHeader header = new DataHeader(); List <IVisualEdge> edgeList = new List <IVisualEdge>(); int edgeCount = storage.ReadInteger(FieldCode.EdgeCount); for (int i = 0; i < edgeCount; i++) { header.Deserialize(storage); uint edgeId = storage.ReadUnsignedInteger(FieldCode.EdgeId); edgeList.Add(this.graphController.GetVisualEdge(edgeId)); } return(edgeList); }
private List<uint> RetrieveNodeIdsFromStorage(IStorage storage) { DataHeader header = new DataHeader(); List<uint> nodeIdList = new List<uint>(); int nodeCount = storage.ReadInteger(FieldCode.NodeCount); for (int i = 0; i < nodeCount; i++) { header.Deserialize(storage); storage.Seek(36, SeekOrigin.Current); nodeIdList.Add(storage.ReadUnsignedInteger(FieldCode.NodeId)); storage.Seek(header.DataSize - 48, SeekOrigin.Current); } return nodeIdList; }
public void TestSerializeDeserialize() { IGraphController graphController = new GraphController(null); IStorage storage = new BinaryStorage(); DataHeader header1 = new DataHeader(); header1.DataSize = 21; DataHeader header2 = new DataHeader(); header2.DataSize = 12; header1.Serialize(storage); storage.Seek(0, SeekOrigin.Begin); header2.Deserialize(storage); Assert.AreEqual(21, header2.DataSize); }
private void UpdateEdges(IStorage storage, List<IVisualEdge> edgeList) { DataHeader header = new DataHeader(); storage.Seek(12, SeekOrigin.Current); //By-pass the reading of total number of edges stored foreach (IVisualEdge edge in edgeList) { header.Deserialize(storage); edge.Deserialize(storage); } }
private List<ISlot> RetrieveSlotsFromStorage(IStorage storage) { DataHeader header = new DataHeader(); List<ISlot> slotList = new List<ISlot>(); int slotCount = storage.ReadInteger(FieldCode.SlotCount); for (int i = 0; i < slotCount; i++) { header.Deserialize(storage); ISlot slot = Slot.Create(this.graphController, storage); slotList.Add(slot); } return slotList; }
private List<uint> RetrieveSlotIdsFromStorage(IStorage storage) { DataHeader header = new DataHeader(); List<uint> slotIdList = new List<uint>(); int slotCount = storage.ReadInteger(FieldCode.SlotCount); for (int i = 0; i < slotCount; i++) { header.Deserialize(storage); storage.Seek(36, SeekOrigin.Current); slotIdList.Add(storage.ReadUnsignedInteger(FieldCode.SlotId)); storage.Seek(header.DataSize - 48, SeekOrigin.Current); } return slotIdList; }
private List<IVisualNode> RetrieveNodesFromStorage(IStorage storage) { DataHeader header = new DataHeader(); List<IVisualNode> nodeList = new List<IVisualNode>(); int nodeCount = storage.ReadInteger(FieldCode.NodeCount); for (int i = 0; i < nodeCount; i++) { header.Deserialize(storage); IVisualNode node = VisualNode.Create(this.graphController, storage); nodeList.Add(node); } return nodeList; }
private List<IVisualNode> RetrieveNodesFromIdsInStorage(IStorage storage) { DataHeader header = new DataHeader(); List<IVisualNode> nodeList = new List<IVisualNode>(); int nodeCount = storage.ReadInteger(FieldCode.NodeCount); for (int i = 0; i < nodeCount; i++) { header.Deserialize(storage); uint nodeId = storage.ReadUnsignedInteger(FieldCode.NodeId); nodeList.Add(this.graphController.GetVisualNode(nodeId)); } return nodeList; }
private List<IVisualEdge> RetrieveEdgesFromStorage(IStorage storage) { DataHeader header = new DataHeader(); List<IVisualEdge> edgeList = new List<IVisualEdge>(); int edgeCount = storage.ReadInteger(FieldCode.EdgeCount); for (int i = 0; i < edgeCount; i++) { header.Deserialize(storage); IVisualEdge edge = this.graphController.CreateEdgeFromStorage(storage); edgeList.Add(edge); } return edgeList; }
private void UpdateNodesAndSlostWithResolveMissingSlotAfterAction(IStorage storage, List<IVisualNode> nodeList, List<uint> slotIdList) { DataHeader header = new DataHeader(); storage.Seek(12, SeekOrigin.Current); //By-pass the reading of total number of slots stored foreach (uint slotId in slotIdList) { header.Deserialize(storage); if (this.graphController.ContainSlotKey(slotId)) { ISlot slot = this.graphController.GetSlot(slotId); slot.Deserialize(storage); } else { ISlot slot = Slot.Create(this.graphController, storage); this.graphController.AddSlot(slot); } } storage.Seek(12, SeekOrigin.Current); //By-pass the reading of total number of nodes stored foreach (IVisualNode node in nodeList) { header.Deserialize(storage); node.Deserialize(storage); } }
private void UpdateRuntimeStates(IStorage storage, RuntimeStates runtimeStates) { DataHeader header = new DataHeader(); header.Deserialize(storage); runtimeStates.Deserialize(storage); }
private void LoadFileInternal(string filePath) { FileStorage storage = new FileStorage(); DataHeader header = new DataHeader(); storage.Load(filePath); //Deserialize states header.Deserialize(storage); this.graphProperties.Deserialize(storage); foreach (string scriptPath in this.graphProperties.ImportedScripts) { CoreComponent.Instance.ImportAssembly(scriptPath, filePath, true); } //Deserialize slots int slotCount = storage.ReadInteger(FieldCode.SlotCount); for (int i = 0; i < slotCount; i++) { header.Deserialize(storage); ISlot slot = Slot.Create(this, storage); this.AddSlot(slot); } //Deserialize nodes int nodeCount = storage.ReadInteger(FieldCode.NodeCount); for (int j = 0; j < nodeCount; j++) { header.Deserialize(storage); IVisualNode node = VisualNode.Create(this, storage); this.AddVisualNode(node); } //Deserialize edges int edgeCount = storage.ReadInteger(FieldCode.EdgeCount); for (int j = 0; j < edgeCount; j++) { header.Deserialize(storage); IVisualEdge edge = VisualEdge.Create(this.edgeController, storage); this.AddVisualEdge(edge); } //AuditLoadedGraph(); // These calls internally figure out the type of id // it is meant for, and set the value accordingly. if (nodeCount > 0) this.idGenerator.SetStartId(this.nodeCollection.Keys.Max()); if (slotCount > 0) this.idGenerator.SetStartId(this.slotCollection.Keys.Max()); if (edgeCount > 0) this.idGenerator.SetStartId(this.edgeController.GetMaxEdgeId()); }