当前位置: 首页>>代码示例>>C#>>正文


C# GraphController.DoSaveGraph方法代码示例

本文整理汇总了C#中DesignScriptStudio.Graph.Core.GraphController.DoSaveGraph方法的典型用法代码示例。如果您正苦于以下问题:C# GraphController.DoSaveGraph方法的具体用法?C# GraphController.DoSaveGraph怎么用?C# GraphController.DoSaveGraph使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DesignScriptStudio.Graph.Core.GraphController的用法示例。


在下文中一共展示了GraphController.DoSaveGraph方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Defect_IDE_1533

        public void Defect_IDE_1533()
        {
            // Create a simple file with CBN a = 1;
            // Save it as : DesignScriptStudio.Tests\\UnitTests\\testfiles\\Defect_IDE_1533.bin
            // Now try to open the file with the file name only ("Defect_IDE_1533.bin"); and verify

            string commands = @"
                MouseDown|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                CreateCodeBlockNode|d:15417.0|d:15222.0|s:
                BeginNodeEdit|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,Text
                MouseDown|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,NorthWest|i:-1|e:System.Windows.Input.ModifierKeys,None
                EndNodeEdit|u:0x10000001|s:a = 1;|b:True
                MouseDown|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None";

            GraphController graphController01 = new GraphController(null);
            bool result = graphController01.RunCommands(commands);
            Assert.AreEqual(true, result);

            string testPath = "..\\..\\..\\..\\Studio\\DesignScriptStudio.Tests\\UnitTests\\testfiles\\";
            string filePath = testPath + "Defect_IDE_1533.bin";
            graphController01.DoSaveGraph(filePath);
            GraphController graphController02 = new GraphController(null, filePath);

            GraphController controller = new GraphController(null);
            bool result00 = controller.RunCommands(commands);
            Assert.AreEqual(true, result00);

            VisualNode node = controller.GetVisualNode(0x10000001);
            Assert.AreEqual(15417, node.X);
            Assert.AreEqual(15222, node.Y);
            Assert.AreEqual(false, node.Selected);
        }
开发者ID:samuto,项目名称:designscript,代码行数:35,代码来源:FileStorageTests.cs

示例2: TestHandleSaveGraphAndLoadGraph

        public void TestHandleSaveGraphAndLoadGraph()
        {
            try
            {
                GraphController graphController1 = new GraphController(null);
                IVisualNode node1 = new CodeBlockNode(graphController1, "Double Click and Type");
                IVisualNode node2 = new DriverNode(graphController1, Configurations.DriverInitialTextValue);
                IVisualNode node3 = new FunctionNode(graphController1, "", "-", "double,double");
                IVisualNode node4 = new IdentifierNode(graphController1, "c");

                string filePath = Path.GetTempPath() + "test.bin";
                graphController1.DoSaveGraph(filePath);
                GraphController graphController2 = new GraphController(null, filePath);

                Assert.AreEqual(4, graphController2.GetVisualNodes().Count);
            }
            finally
            {
                File.Delete(Path.GetTempPath() + "test.bin");
            }
        }
开发者ID:samuto,项目名称:designscript,代码行数:21,代码来源:GraphController.CommandHandlersTests.cs

示例3: TestSaveAndLoad

        public void TestSaveAndLoad()
        {
            string filePath = Path.GetTempPath() + "test.bin";

            try
            {
                string commands = @"
                    MouseDown|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                    MouseUp|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                    CreateCodeBlockNode|d:15310.0|d:15127.0|s:
                    BeginNodeEdit|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,Text
                    MouseDown|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                    MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,Text|i:-1|e:System.Windows.Input.ModifierKeys,None
                    EndNodeEdit|u:0x10000001|s:a = 1;|b:True
                    MouseDown|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                    MouseUp|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                    CreateDriverNode|d:15387.0|d:15195.0
                    CreateFunctionNode|d:15444.0|d:15256.0|s:|s:+|s:double,double
                    CreateIdentifierNode|d:15533.0|d:15329.0";

                GraphController graphController01 = new GraphController(null);
                bool result = graphController01.RunCommands(commands);
                Assert.AreEqual(true, result);

                graphController01.DoSaveGraph(filePath);
                GraphController graphController02 = new GraphController(null, filePath);

                IVisualNode node00 = graphController02.GetVisualNodes()[0];
                Assert.AreEqual(15310.0, node00.X);
                Assert.AreEqual(15127.0, node00.Y);

                IVisualNode node01 = graphController02.GetVisualNodes()[1];
                Assert.AreEqual(15387.0, node01.X);
                Assert.AreEqual(15195.0, node01.Y);

                IVisualNode node02 = graphController02.GetVisualNodes()[2];
                Assert.AreEqual(15444.0, node02.X);
                Assert.AreEqual(15256.0, node02.Y);

                IVisualNode node03 = graphController02.GetVisualNodes()[3];
                Assert.AreEqual(15533.0, node03.X);
                Assert.AreEqual(15329.0, node03.Y);
            }
            finally
            {
                File.Delete(filePath);
            }
        }
开发者ID:samuto,项目名称:designscript,代码行数:48,代码来源:FileStorageTests.cs

示例4: TestLoadingSavingFile03

        public void TestLoadingSavingFile03()
        {
            // IDE-1066
            // Create mutiple code block with implicit and explicit connection
            // Save the file
            // Load the file
            //
            string filePath = Path.GetTempPath() + "MultipleCodeblockConnection.bin";

            try
            {
                string commands = @"
                    MouseDown|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                    MouseUp|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                    CreateCodeBlockNode|d:15330.0|d:15157.0|s:
                    BeginNodeEdit|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,Text
                    MouseDown|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                    MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,Text|i:-1|e:System.Windows.Input.ModifierKeys,None
                    EndNodeEdit|u:0x10000001|s:a = 10;|b:True
                    MouseDown|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                    MouseUp|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                    MouseDown|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                    MouseUp|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                    CreateCodeBlockNode|d:15541.0|d:15170.0|s:
                    BeginNodeEdit|u:0x10000002|e:DesignScriptStudio.Graph.Core.NodePart,Text
                    MouseDown|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                    MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000002|e:DesignScriptStudio.Graph.Core.NodePart,Text|i:-1|e:System.Windows.Input.ModifierKeys,None
                    EndNodeEdit|u:0x10000002|s:b = a;|b:True
                    MouseDown|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                    MouseUp|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                    MouseDown|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                    MouseUp|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                    CreateCodeBlockNode|d:15431.0|d:15272.0|s:
                    BeginNodeEdit|u:0x10000003|e:DesignScriptStudio.Graph.Core.NodePart,Text
                    MouseDown|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                    MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000003|e:DesignScriptStudio.Graph.Core.NodePart,Text|i:-1|e:System.Windows.Input.ModifierKeys,None
                    EndNodeEdit|u:0x10000003|s:100|b:True
                    MouseDown|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                    MouseUp|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                    CreateFunctionNode|d:15691.0|d:15216.0|s:|s:+|s:double,double
                    MouseDown|e:System.Windows.Input.MouseButton,Left|u:0x10000002|e:DesignScriptStudio.Graph.Core.NodePart,OutputSlot|i:0|e:System.Windows.Input.ModifierKeys,None
                    BeginDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000002|e:DesignScriptStudio.Graph.Core.NodePart,OutputSlot|i:0|e:System.Windows.Input.ModifierKeys,None|d:15579.0|d:15172.0
                    EndDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000004|e:DesignScriptStudio.Graph.Core.NodePart,InputSlot|i:0|e:System.Windows.Input.ModifierKeys,None|d:15645.0|d:15206.0
                    MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000004|e:DesignScriptStudio.Graph.Core.NodePart,InputSlot|i:0|e:System.Windows.Input.ModifierKeys,None
                    MouseDown|e:System.Windows.Input.MouseButton,Left|u:0x10000003|e:DesignScriptStudio.Graph.Core.NodePart,OutputSlot|i:0|e:System.Windows.Input.ModifierKeys,None
                    BeginDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000003|e:DesignScriptStudio.Graph.Core.NodePart,OutputSlot|i:0|e:System.Windows.Input.ModifierKeys,None|d:15461.0|d:15275.0
                    EndDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000004|e:DesignScriptStudio.Graph.Core.NodePart,InputSlot|i:1|e:System.Windows.Input.ModifierKeys,None|d:15643.0|d:15234.0
                    MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000004|e:DesignScriptStudio.Graph.Core.NodePart,InputSlot|i:1|e:System.Windows.Input.ModifierKeys,None";

                GraphController graphController01 = new GraphController(null);
                bool result = graphController01.RunCommands(commands);
                Assert.AreEqual(true, result);

                graphController01.DoSaveGraph(filePath);
                GraphController graphController02 = new GraphController(null, filePath);

                Assert.AreEqual(4, graphController02.GetVisualNodes().Count);
                Assert.AreEqual(NodeType.CodeBlock, graphController02.GetVisualNodes()[0].VisualType);
                Assert.AreEqual(NodeType.CodeBlock, graphController02.GetVisualNodes()[1].VisualType);
                Assert.AreEqual(NodeType.CodeBlock, graphController02.GetVisualNodes()[2].VisualType);
                Assert.AreEqual(NodeType.Function, graphController02.GetVisualNodes()[3].VisualType);
                Assert.IsNotNull(graphController02.GetVisualEdge(0x60000001));
                Assert.IsNotNull(graphController02.GetVisualEdge(0x60000002));
                Assert.IsNotNull(graphController02.GetVisualEdge(0x60000003));
            }
            finally
            {
                File.Delete(filePath);
            }
        }
开发者ID:samuto,项目名称:designscript,代码行数:70,代码来源:FileStorageTests.cs

示例5: TestLoadingSavingFile02

        public void TestLoadingSavingFile02()
        {
            // IDE-1066
            // Create mutiple code block (total of 6 of different content)
            // Save the file
            // Load the file
            //
            string filePath = Path.GetTempPath() + "MutipleCodeblock.bin";

            try
            {
                string commands = @"
                    MouseDown|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                    MouseUp|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                    CreateCodeBlockNode|d:15443.0|d:15122.0|s:
                    BeginNodeEdit|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,Text
                    MouseDown|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                    MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,Text|i:-1|e:System.Windows.Input.ModifierKeys,None
                    EndNodeEdit|u:0x10000001|s:a = 1;|b:True
                    MouseDown|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                    BeginDrag|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None|d:15692.0|d:15240.0
                    EndDrag|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None|d:15695.0|d:15242.0
                    MouseUp|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                    MouseDown|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                    MouseUp|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                    CreateCodeBlockNode|d:15432.0|d:15193.0|s:
                    BeginNodeEdit|u:0x10000002|e:DesignScriptStudio.Graph.Core.NodePart,Text
                    MouseDown|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                    MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000002|e:DesignScriptStudio.Graph.Core.NodePart,Text|i:-1|e:System.Windows.Input.ModifierKeys,None
                    EndNodeEdit|u:0x10000002|s:b + c|b:True
                    MouseDown|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                    MouseUp|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                    MouseDown|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                    MouseUp|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                    CreateCodeBlockNode|d:15449.0|d:15254.0|s:
                    BeginNodeEdit|u:0x10000003|e:DesignScriptStudio.Graph.Core.NodePart,Text
                    MouseDown|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                    MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000003|e:DesignScriptStudio.Graph.Core.NodePart,Text|i:-1|e:System.Windows.Input.ModifierKeys,None
                    EndNodeEdit|u:0x10000003|s:1+4|b:True
                    MouseDown|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                    BeginDrag|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None|d:15613.0|d:15287.0
                    EndDrag|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None|d:15613.0|d:15290.0
                    MouseUp|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                    MouseDown|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                    MouseUp|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                    CreateCodeBlockNode|d:15425.0|d:15351.0|s:
                    BeginNodeEdit|u:0x10000004|e:DesignScriptStudio.Graph.Core.NodePart,Text
                    MouseDown|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                    MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000004|e:DesignScriptStudio.Graph.Core.NodePart,Text|i:-1|e:System.Windows.Input.ModifierKeys,None
                    EndNodeEdit|u:0x10000004|s:d = 12;\ne = f + g;\n\n5 + 4;|b:True
                    MouseDown|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                    MouseUp|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                    MouseDown|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                    MouseUp|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                    CreateCodeBlockNode|d:15586.0|d:15251.0|s:
                    BeginNodeEdit|u:0x10000005|e:DesignScriptStudio.Graph.Core.NodePart,Text
                    MouseDown|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                    MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000005|e:DesignScriptStudio.Graph.Core.NodePart,Text|i:-1|e:System.Windows.Input.ModifierKeys,None
                    EndNodeEdit|u:0x10000005|s:h|b:True
                    MouseDown|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                    MouseUp|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                    MouseDown|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                    MouseUp|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                    CreateCodeBlockNode|d:15610.0|d:15157.0|s:
                    BeginNodeEdit|u:0x10000006|e:DesignScriptStudio.Graph.Core.NodePart,Text
                    MouseDown|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                    MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000006|e:DesignScriptStudio.Graph.Core.NodePart,Text|i:-1|e:System.Windows.Input.ModifierKeys,None
                    EndNodeEdit|u:0x10000006|s:j = Math.Cos(360);|b:True
                    MouseDown|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                    MouseUp|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None";

                GraphController graphController01 = new GraphController(null);
                bool result = graphController01.RunCommands(commands);
                Assert.AreEqual(true, result);

                graphController01.DoSaveGraph(filePath);
                GraphController graphController02 = new GraphController(null, filePath);

                Assert.AreEqual(6, graphController02.GetVisualNodes().Count);
            }
            finally
            {
                File.Delete(filePath);
            }
        }
开发者ID:samuto,项目名称:designscript,代码行数:85,代码来源:FileStorageTests.cs

示例6: TestLoadingSavingFile01

        public void TestLoadingSavingFile01()
        {
            // IDE-1066
            // Create a code block node
            // Save the file
            // Load the file
            //
            string filePath = Path.GetTempPath() + "codeblock.bin";

            try
            {
                string commands = @"
                    MouseDown|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                    MouseUp|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                    CreateCodeBlockNode|d:15310.0|d:15127.0|s:
                    BeginNodeEdit|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,Text
                    MouseDown|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                    MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,Text|i:-1|e:System.Windows.Input.ModifierKeys,None
                    EndNodeEdit|u:0x10000001|s:a = 1;|b:True
                    MouseDown|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                    MouseUp|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None";

                GraphController graphController01 = new GraphController(null);
                bool result = graphController01.RunCommands(commands);
                Assert.AreEqual(true, result);

                graphController01.DoSaveGraph(filePath);
                GraphController graphController02 = new GraphController(null, filePath);

                Assert.AreEqual(1, graphController02.GetVisualNodes().Count);
                Assert.AreEqual(NodeType.CodeBlock, graphController02.GetVisualNodes()[0].VisualType);
            }
            finally
            {
                File.Delete(filePath);
            }
        }
开发者ID:samuto,项目名称:designscript,代码行数:37,代码来源:FileStorageTests.cs

示例7: TestLoadingSavedFile07

        public void TestLoadingSavedFile07()
        {
            // Create a save file at temp path contain 4 nodes and 3 edges
            // Load the file on a new graph controller instance
            // Check and add another node
            // Overwritten the same file
            // Load the file again in a new graph controller instance
            // Check the number of node
            // Delete temp path
            //
            try
            {
                string commands = @"
                    MouseDown|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                    MouseUp|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                    CreateCodeBlockNode|d:10341.0|d:10228.0|s:
                    BeginNodeEdit|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,Text
                    MouseDown|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                    MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,NorthWest|i:-1|e:System.Windows.Input.ModifierKeys,None
                    EndNodeEdit|u:0x10000001|s:200|b:True
                    MouseDown|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                    MouseUp|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                    CreateIdentifierNode|d:10534.0|d:10264.0
                    MouseDown|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,OutputSlot|i:0|e:System.Windows.Input.ModifierKeys,None
                    BeginDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,OutputSlot|i:0|e:System.Windows.Input.ModifierKeys,None|d:10376.0|d:10242.0
                    EndDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000002|e:DesignScriptStudio.Graph.Core.NodePart,InputSlot|i:0|e:System.Windows.Input.ModifierKeys,None|d:10537.0|d:10278.0
                    MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000002|e:DesignScriptStudio.Graph.Core.NodePart,InputSlot|i:0|e:System.Windows.Input.ModifierKeys,None
                    MouseDown|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                    MouseUp|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                    CreateCodeBlockNode|d:10352.0|d:10329.0|s:
                    BeginNodeEdit|u:0x10000003|e:DesignScriptStudio.Graph.Core.NodePart,Text
                    MouseDown|e:System.Windows.Input.MouseButton,Left|u:0x10000003|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                    MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000003|e:DesignScriptStudio.Graph.Core.NodePart,NorthWest|i:-1|e:System.Windows.Input.ModifierKeys,None
                    EndNodeEdit|u:0x10000003|s:100|b:True
                    MouseDown|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                    MouseUp|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                    CreateFunctionNode|d:10526.0|d:10354.0|s:|s:+|s:double,double
                    MouseDown|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,OutputSlot|i:0|e:System.Windows.Input.ModifierKeys,None
                    BeginDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,OutputSlot|i:0|e:System.Windows.Input.ModifierKeys,None|d:10379.0|d:10240.0
                    EndDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000004|e:DesignScriptStudio.Graph.Core.NodePart,InputSlot|i:0|e:System.Windows.Input.ModifierKeys,None|d:10526.0|d:10365.0
                    MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000004|e:DesignScriptStudio.Graph.Core.NodePart,InputSlot|i:0|e:System.Windows.Input.ModifierKeys,None
                    MouseDown|e:System.Windows.Input.MouseButton,Left|u:0x10000003|e:DesignScriptStudio.Graph.Core.NodePart,OutputSlot|i:0|e:System.Windows.Input.ModifierKeys,None
                    BeginDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000003|e:DesignScriptStudio.Graph.Core.NodePart,OutputSlot|i:0|e:System.Windows.Input.ModifierKeys,None|d:10387.0|d:10342.0
                    EndDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000004|e:DesignScriptStudio.Graph.Core.NodePart,InputSlot|i:1|e:System.Windows.Input.ModifierKeys,None|d:10529.0|d:10385.0
                    MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000004|e:DesignScriptStudio.Graph.Core.NodePart,InputSlot|i:1|e:System.Windows.Input.ModifierKeys,None";

                GraphController graphController01 = new GraphController(null);
                bool result = graphController01.RunCommands(commands);
                Assert.AreEqual(true, result);

                string filePath = Path.GetTempPath() + "test.bin";
                graphController01.DoSaveGraph(filePath);
                GraphController graphController02 = new GraphController(null, filePath);

                Assert.AreEqual(4, graphController02.GetVisualNodes().Count);
                IVisualNode node01 = graphController02.GetVisualNodes()[0];
                Assert.AreEqual(NodeType.CodeBlock, node01.VisualType);
                IVisualNode node02 = graphController02.GetVisualNodes()[1];
                Assert.AreEqual(NodeType.Identifier, node02.VisualType);
                IVisualNode node03 = graphController02.GetVisualNodes()[2];
                Assert.AreEqual(NodeType.CodeBlock, node03.VisualType);
                IVisualNode node04 = graphController02.GetVisualNodes()[3];
                Assert.AreEqual(NodeType.Function, node04.VisualType);
                IVisualEdge edge01 = graphController02.GetVisualEdge(0x60000001);
                Assert.IsNotNull(edge01);
                IVisualEdge edge02 = graphController02.GetVisualEdge(0x60000002);
                Assert.IsNotNull(edge02);
                IVisualEdge edge03 = graphController02.GetVisualEdge(0x60000003);
                Assert.IsNotNull(edge03);

                IVisualNode node05 = new CodeBlockNode(graphController02, "a = 1;");
                graphController02.DoSaveGraph(filePath);
                GraphController graphController03 = new GraphController(null, filePath);
                Assert.AreEqual(5, graphController03.GetVisualNodes().Count);
            }
            finally
            {
                string filePath = Path.GetTempPath() + "test.bin";
                File.Delete(filePath);
            }
        }
开发者ID:samuto,项目名称:designscript,代码行数:81,代码来源:FileStorageTests.cs

示例8: Defect_IDE_2087

        public void Defect_IDE_2087()
        {
            // steps as per defect http://adsk-oss.myjetbrains.com/youtrack/issue/IDE-2241
            try
            {
                string commands = @"MouseDown|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
            MouseUp|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
            CreateCodeBlockNode|d:15330.0|d:15123.0|s:
            BeginNodeEdit|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,Text
            MouseDown|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
            MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,Text|i:-1|e:System.Windows.Input.ModifierKeys,None
            EndNodeEdit|u:0x10000001|s:1|b:True
            MouseDown|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
            MouseUp|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
            CreateCodeBlockNode|d:15342.0|d:15206.0|s:
            BeginNodeEdit|u:0x10000002|e:DesignScriptStudio.Graph.Core.NodePart,Text
            MouseDown|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
            MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000002|e:DesignScriptStudio.Graph.Core.NodePart,Text|i:-1|e:System.Windows.Input.ModifierKeys,None
            EndNodeEdit|u:0x10000002|s:a|b:True
            MouseDown|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
            MouseUp|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
            CreateCodeBlockNode|d:15433.0|d:15128.0|s:
            BeginNodeEdit|u:0x10000003|e:DesignScriptStudio.Graph.Core.NodePart,Text
            MouseDown|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
            MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000003|e:DesignScriptStudio.Graph.Core.NodePart,Text|i:-1|e:System.Windows.Input.ModifierKeys,None
            EndNodeEdit|u:0x10000003|s:b = a|b:True
            MouseDown|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
            MouseUp|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
            MouseDown|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,OutputSlot|i:0|e:System.Windows.Input.ModifierKeys,None
            MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,OutputSlot|i:0|e:System.Windows.Input.ModifierKeys,None
            BeginDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,OutputSlot|i:0|e:System.Windows.Input.ModifierKeys,None|d:15348.0|d:15124.0
            EndDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000002|e:DesignScriptStudio.Graph.Core.NodePart,InputSlot|i:0|e:System.Windows.Input.ModifierKeys,None|d:15326.0|d:15206.0
            MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000002|e:DesignScriptStudio.Graph.Core.NodePart,InputSlot|i:0|e:System.Windows.Input.ModifierKeys,None
            CreateFunctionNode|d:15593.0|d:15192.0|s:Special Nodes|s:+|s:double,double
            MouseDown|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,OutputSlot|i:0|e:System.Windows.Input.ModifierKeys,None
            BeginDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,OutputSlot|i:0|e:System.Windows.Input.ModifierKeys,None|d:15347.0|d:15124.0
            MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,OutputSlot|i:0|e:System.Windows.Input.ModifierKeys,None
            EndDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000004|e:DesignScriptStudio.Graph.Core.NodePart,InputLabel|i:0|e:System.Windows.Input.ModifierKeys,None|d:15550.0|d:15190.0
            MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000004|e:DesignScriptStudio.Graph.Core.NodePart,InputLabel|i:0|e:System.Windows.Input.ModifierKeys,None
            MouseDown|e:System.Windows.Input.MouseButton,Left|u:0x10000003|e:DesignScriptStudio.Graph.Core.NodePart,OutputSlot|i:0|e:System.Windows.Input.ModifierKeys,None
            MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000003|e:DesignScriptStudio.Graph.Core.NodePart,OutputSlot|i:0|e:System.Windows.Input.ModifierKeys,None
            BeginDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000003|e:DesignScriptStudio.Graph.Core.NodePart,OutputSlot|i:0|e:System.Windows.Input.ModifierKeys,None|d:15473.0|d:15130.0
            EndDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000004|e:DesignScriptStudio.Graph.Core.NodePart,InputSlot|i:1|e:System.Windows.Input.ModifierKeys,None|d:15538.0|d:15209.0
            MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000004|e:DesignScriptStudio.Graph.Core.NodePart,InputSlot|i:1|e:System.Windows.Input.ModifierKeys,None";

                GraphController graphController01 = new GraphController(null);
                bool result = graphController01.RunCommands(commands);
                Assert.AreEqual(true, result);

                string filePath = Path.GetTempPath() + "Defect_IDE_2087.bin";
                graphController01.DoSaveGraph(filePath);
                GraphController graphController02 = new GraphController(null, filePath);

                // there should not be any errors
                ProtoCore.BuildStatus buildStatus = GraphToDSCompiler.GraphUtilities.BuildStatus;
                Assert.AreEqual(0, buildStatus.ErrorCount);
                Assert.AreEqual(0, buildStatus.WarningCount);

                Assert.AreEqual(4, graphController02.GetVisualNodes().Count);

                IVisualNode node01 = graphController02.GetVisualNodes()[0];
                Assert.AreEqual(NodeType.CodeBlock, node01.VisualType);
                IVisualNode node02 = graphController02.GetVisualNodes()[1];
                Assert.AreEqual(NodeType.CodeBlock, node02.VisualType);
                IVisualNode node03 = graphController02.GetVisualNodes()[2];
                Assert.AreEqual(NodeType.CodeBlock, node03.VisualType);
                IVisualNode node04 = graphController02.GetVisualNodes()[3];
                Assert.AreEqual(NodeType.Function, node04.VisualType);

            }
            finally
            {
                string filePath = Path.GetTempPath() + "Defect_IDE_2087.bin";
                File.Delete(filePath);
            }
        }
开发者ID:samuto,项目名称:designscript,代码行数:76,代码来源:FileStorageTests.cs


注:本文中的DesignScriptStudio.Graph.Core.GraphController.DoSaveGraph方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。