public void TestLoadingSavingFile00()
        {
            try
            {
                IStorage s1 = new FileStorage();
                IStorage s2 = new FileStorage();

                string str = "World Hello";
                byte[] bytes = Encoding.ASCII.GetBytes(str);
                ulong signature = Utilities.MakeEightCC('T', 'E', 'S', 'T', ' ', ' ', ' ', ' ');

                s1.WriteBytes(signature, bytes);
                s1.WriteInteger(signature, 24);
                s1.WriteUnsignedInteger(signature, 2147483648);
                s1.WriteLong(signature, 3000000000);
                s1.WriteUnsignedLong(signature, 9223372036854775808);
                s1.WriteBoolean(signature, true);
                s1.WriteDouble(signature, 1.7);
                s1.WriteString(signature, "Hello World");

                string filePath = Path.GetTempPath() + "test.bin";
                ((FileStorage)s1).Save(filePath);
                ((FileStorage)s2).Load(filePath);

                byte[] a = s2.ReadBytes(signature);
                int b = s2.ReadInteger(signature);
                uint c = s2.ReadUnsignedInteger(signature);
                long d = s2.ReadLong(signature);
                ulong e = s2.ReadUnsignedLong(signature);
                bool f = s2.ReadBoolean(signature);
                double g = s2.ReadDouble(signature);
                string h = s2.ReadString(signature);

                Assert.AreEqual(bytes, a);
                Assert.AreEqual(24, b);
                Assert.AreEqual(2147483648, c);
                Assert.AreEqual(3000000000, d);
                Assert.AreEqual(9223372036854775808, e);
                Assert.AreEqual(true, f);
                Assert.AreEqual(1.7, g);
                Assert.AreEqual("Hello World", h);
            }
            finally
            {
                File.Delete(Path.GetTempPath() + "test.bin");
            }
        }
        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());
        }