コード例 #1
0
            protected override void SerializeCore(XmlElement element)
            {
                XmlElementHelper helper = new XmlElementHelper(element);

                helper.SetAttribute("ShowErrors", ShowErrors);
                helper.SetAttribute("CancelRun", CancelRun);
            }
コード例 #2
0
ファイル: Watch3D.cs プロジェクト: abhicris/Dynamo
        protected override void SerializeCore(XmlElement nodeElement, SaveContext context)
        {
            base.SerializeCore(nodeElement, context);

            var viewElement = nodeElement.OwnerDocument.CreateElement("view");

            nodeElement.AppendChild(viewElement);
            var viewHelper = new XmlElementHelper(viewElement);

            WatchWidth  = Width;
            WatchHeight = Height;
            viewHelper.SetAttribute("width", WatchWidth);
            viewHelper.SetAttribute("height", WatchHeight);

            // the view stores the latest position
            OnRequestUpdateLatestCameraPosition();

            var camElement = nodeElement.OwnerDocument.CreateElement("camera");

            viewElement.AppendChild(camElement);
            var camHelper = new XmlElementHelper(camElement);

            camHelper.SetAttribute("pos_x", CameraPosition.X);
            camHelper.SetAttribute("pos_y", CameraPosition.Y);
            camHelper.SetAttribute("pos_z", CameraPosition.Z);
            camHelper.SetAttribute("look_x", LookDirection.X);
            camHelper.SetAttribute("look_y", LookDirection.Y);
            camHelper.SetAttribute("look_z", LookDirection.Z);
        }
コード例 #3
0
            protected override void SerializeCore(XmlElement element)
            {
                XmlElementHelper helper = new XmlElementHelper(element);

                helper.SetAttribute("Tag", Tag);
                helper.SetAttribute("PauseDurationInMs", PauseDurationInMs);
            }
コード例 #4
0
ファイル: dynWatch3D.cs プロジェクト: vtaran/Dynamo
        protected override void SaveNode(XmlDocument xmlDoc, XmlElement nodeElement, SaveContext context)
        {
            base.SaveNode(xmlDoc, nodeElement, context);

            var viewElement = xmlDoc.CreateElement("view");

            nodeElement.AppendChild(viewElement);
            var viewHelper = new XmlElementHelper(viewElement);

            viewHelper.SetAttribute("width", Width);
            viewHelper.SetAttribute("height", Height);

            //Bail out early if the view hasn't been created.
            if (View == null)
            {
                return;
            }

            var camElement = xmlDoc.CreateElement("camera");

            viewElement.AppendChild(camElement);
            var camHelper = new XmlElementHelper(camElement);

            camHelper.SetAttribute("pos_x", View.View.Camera.Position.X);
            camHelper.SetAttribute("pos_y", View.View.Camera.Position.Y);
            camHelper.SetAttribute("pos_z", View.View.Camera.Position.Z);
            camHelper.SetAttribute("look_x", View.View.Camera.LookDirection.X);
            camHelper.SetAttribute("look_y", View.View.Camera.LookDirection.Y);
            camHelper.SetAttribute("look_z", View.View.Camera.LookDirection.Z);
        }
コード例 #5
0
        protected override void SerializeCore(XmlElement element, SaveContext context)
        {
            XmlElementHelper helper = new XmlElementHelper(element);

            helper.SetAttribute(DummyModel.RadiusName, this.Radius);
            helper.SetAttribute(DummyModel.IdName, this.Identifier);
        }
コード例 #6
0
            protected override void SerializeCore(XmlElement element)
            {
                XmlElementHelper helper = new XmlElementHelper(element);

                helper.SetAttribute("ModelGuid", ModelGuid);
                helper.SetAttribute("EventName", EventName);
            }
コード例 #7
0
        public void GetNodeFromCommand_XMLTest()
        {
            //Arrange
            XmlDocument xmlDocument = new XmlDocument();
            XmlElement  elemTest    = xmlDocument.CreateElement("TestCommand");
            var         helper      = new XmlElementHelper(elemTest);

            //DeserializeCore method is looking for the attributes ShowErrors and CancelRun, then we need to set them up before calling the method.
            helper.SetAttribute("X", 100);
            helper.SetAttribute("Y", 100);
            helper.SetAttribute("DefaultPosition", true);
            helper.SetAttribute("TransformCoordinates", true);
            helper.SetAttribute("NodeName", "TestNode");
            helper.SetAttribute("type", "Dynamo.Graph.Nodes.CodeBlockNodeModel");


            XmlElement elemTestChild = xmlDocument.CreateElement("TestCommandChild");
            var        helper2       = new XmlElementHelper(elemTestChild);

            helper2.SetAttribute("type", "Dynamo.Graph.Nodes.CodeBlockNodeModel");
            helper2.SetAttribute("ShouldFocus", true);
            helper2.SetAttribute("CodeText", "text");
            elemTest.AppendChild(elemTestChild);

            //Act
            var createNodeCommand = DynamoModel.CreateNodeCommand.DeserializeCore(elemTest);

            //Calling Execute method will call internally the GetNodeFromCommand method
            createNodeCommand.Execute(CurrentDynamoModel);

            //Assert
            //Validating that the creageNodeCommand was successful
            Assert.IsNotNull(createNodeCommand);
            Assert.AreEqual(createNodeCommand.NodeXml.Name, "TestCommandChild");
        }
コード例 #8
0
ファイル: dynFunction.cs プロジェクト: l2obin/Dynamo
        protected override void SerializeCore(XmlElement element, SaveContext context)
        {
            base.SerializeCore(element, context); //Base implementation must be called
            if (context == SaveContext.Undo)
            {
                XmlElementHelper helper = new XmlElementHelper(element);
                helper.SetAttribute("functionId", Symbol);
                helper.SetAttribute("functionName", NickName);
                helper.SetAttribute("functionDesc", Description);

                XmlDocument xmlDoc = element.OwnerDocument;
                foreach (var input in InPortData.Select(x => x.NickName))
                {
                    var inputEl = xmlDoc.CreateElement("functionInput");
                    inputEl.SetAttribute("inputValue", input);
                    element.AppendChild(inputEl);
                }

                foreach (var input in OutPortData.Select(x => x.NickName))
                {
                    var outputEl = xmlDoc.CreateElement("functionOutput");
                    outputEl.SetAttribute("outputValue", input);
                    element.AppendChild(outputEl);
                }
            }
        }
コード例 #9
0
        internal string SaveRecordedCommands()
        {
            XmlDocument document    = new XmlDocument();
            XmlElement  commandRoot = document.CreateElement("Commands");

            document.AppendChild(commandRoot);

            // Create attributes that applied to the entire recording.
            XmlElementHelper helper = new XmlElementHelper(commandRoot);

            helper.SetAttribute(ExitAttribName, ExitAfterPlayback);
            helper.SetAttribute(PauseAttribName, PauseAfterPlayback);
            helper.SetAttribute(IntervalAttribName, CommandInterval);

            foreach (DynCmd.RecordableCommand command in recordedCommands)
            {
                commandRoot.AppendChild(command.Serialize(document));
            }

            string format      = "Commands-{0:yyyyMMdd-hhmmss}.xml";
            string xmlFileName = string.Format(format, DateTime.Now);
            string xmlFilePath = Path.Combine(Path.GetTempPath(), xmlFileName);

            // Save recorded commands into XML file and open it in viewer.
            document.Save(xmlFilePath);
            return(xmlFilePath);
        }
コード例 #10
0
        internal string SaveRecordedCommands()
        {
            var        document    = new XmlDocument();
            XmlElement commandRoot = document.CreateElement("Commands");

            document.AppendChild(commandRoot);

            const string format      = "Commands-{0:yyyyMMdd-hhmmss}.xml";
            string       xmlFileName = string.Format(format, DateTime.Now);
            string       xmlFilePath = Path.Combine(Path.GetTempPath(), xmlFileName);

            // Create attributes that applied to the entire recording.
            var helper = new XmlElementHelper(commandRoot);

            helper.SetAttribute(EXIT_ATTRIB_NAME, ExitAfterPlayback);
            helper.SetAttribute(PAUSE_ATTRIB_NAME, PauseAfterPlayback);
            helper.SetAttribute(INTERVAL_ATTRIB_NAME, CommandInterval);
            // Serialization in SaveContext.File may need file path. Add it
            // temporarily and remove it after searilization.
            NodeUtils.SetDocumentXmlPath(document, xmlFilePath);

            foreach (DynamoModel.RecordableCommand command in recordedCommands)
            {
                commandRoot.AppendChild(command.Serialize(document));
            }

            NodeUtils.SetDocumentXmlPath(document, null);

            // Save recorded commands into XML file and open it in viewer.
            document.Save(xmlFilePath);
            return(xmlFilePath);
        }
コード例 #11
0
        public void ForceRunCancelCommand_DeserializeCoreTest()
        {
            //Arrange
            string wspath      = Path.Combine(TestDirectory, @"core\callsite\RebindingSingleDimension.dyn");
            var    fileCommand = new DynamoModel.OpenFileCommand(wspath);

            var runCancelCommand = new DynamoModel.ForceRunCancelCommand(false, false);

            CurrentDynamoModel.ExecuteCommand(runCancelCommand);

            XmlDocument xmlDocument = new XmlDocument();
            XmlElement  elemTest    = xmlDocument.CreateElement("TestCommand");

            //Act
            var helper = new XmlElementHelper(elemTest);

            //DeserializeCore method is looking for the attributes ShowErrors and CancelRun, then we need to set them up before calling the method.
            helper.SetAttribute("ShowErrors", true);
            helper.SetAttribute("CancelRun", true);

            var deserializedCommand = ForceRunCancelCommand.DeserializeCore(elemTest);

            //Assert
            Assert.IsNotNull(deserializedCommand);
        }
コード例 #12
0
            protected override void SerializeCore(XmlElement element)
            {
                XmlElementHelper helper = new XmlElementHelper(element);

                helper.SetAttribute("ModelGuid", ModelGuid);
                helper.SetAttribute("Modifiers", ((int)Modifiers));
            }
コード例 #13
0
        public void CreateNodeCommandXML_ExecuteCore()
        {
            //Arrange
            XmlDocument xmlDocument = new XmlDocument();

            //Act
            XmlElement elemTest = xmlDocument.CreateElement("TestCommand");
            var        helper   = new XmlElementHelper(elemTest);

            //DeserializeCore method is looking for the attributes ShowErrors and CancelRun, then we need to set them up before calling the method.
            helper.SetAttribute("X", 100);
            helper.SetAttribute("Y", 100);
            helper.SetAttribute("DefaultPosition", true);
            helper.SetAttribute("TransformCoordinates", true);
            helper.SetAttribute("NodeName", "TestNode");


            XmlElement elemTestChild = xmlDocument.CreateElement("TestCommandChild");

            elemTest.AppendChild(elemTestChild);

            var createNodeCommand = DynCmd.CreateNodeCommand.DeserializeCore(elemTest);
            var serializedCommand = createNodeCommand.Serialize(xmlDocument);

            createNodeCommand.TrackAnalytics();

            //Assert
            Assert.IsNotNull(createNodeCommand);
            Assert.IsNotNull(serializedCommand);
        }
コード例 #14
0
ファイル: NoteModel.cs プロジェクト: ankushraizada/Dynamo
 protected override void SerializeCore(XmlElement element, SaveContext context)
 {
     var helper = new XmlElementHelper(element);
     helper.SetAttribute("guid", GUID);
     helper.SetAttribute("text", Text);
     helper.SetAttribute("x", X);
     helper.SetAttribute("y", Y);
 }
コード例 #15
0
ファイル: CodeBlockNode.cs プロジェクト: whztt07/Dynamo
        protected override void SaveNode(XmlDocument xmlDoc, XmlElement nodeElement, SaveContext context)
        {
            base.SaveNode(xmlDoc, nodeElement, context);
            var helper = new XmlElementHelper(nodeElement);

            helper.SetAttribute("CodeText", code);
            helper.SetAttribute("ShouldFocus", shouldFocus);
        }
コード例 #16
0
ファイル: CodeBlockNode.cs プロジェクト: venusdharan/Dynamo
        protected override void SerializeCore(XmlElement element, SaveContext context)
        {
            base.SerializeCore(element, context);
            var helper = new XmlElementHelper(element);

            helper.SetAttribute("CodeText", code);
            helper.SetAttribute("ShouldFocus", shouldFocus);
        }
コード例 #17
0
ファイル: RecordableCommands.cs プロジェクト: Steell/Dynamo
            protected override void SerializeCore(XmlElement element)
            {
                var helper = new XmlElementHelper(element);

                helper.SetAttribute("ModelGuid", ModelGuid);
                helper.SetAttribute("Name", Name);
                helper.SetAttribute("Value", Value);
            }
コード例 #18
0
            protected override void SerializeCore(XmlElement element)
            {
                XmlElementHelper helper = new XmlElementHelper(element);

                helper.SetAttribute("X", MouseCursor.X);
                helper.SetAttribute("Y", MouseCursor.Y);
                helper.SetAttribute("DragOperation", ((int)DragOperation));
            }
コード例 #19
0
        protected override void SerializeCore(XmlElement element, SaveContext context)
        {
            base.SerializeCore(element, context);

            var helper = new XmlElementHelper(element);

            helper.SetAttribute("color", _plotColor);
            helper.SetAttribute("values", _values.ToString());
        }
コード例 #20
0
        protected override void SerializeCore(XmlElement element, SaveContext context)
        {
            var helper = new XmlElementHelper(element);

            helper.SetAttribute("guid", GUID);
            helper.SetAttribute("text", Text);
            helper.SetAttribute("x", X);
            helper.SetAttribute("y", Y);
        }
コード例 #21
0
            protected override void SerializeCore(XmlElement element)
            {
                XmlElementHelper helper = new XmlElementHelper(element);

                helper.SetAttribute("NodeId", NodeId);
                helper.SetAttribute("PortIndex", PortIndex);
                helper.SetAttribute("Type", ((int)Type));
                helper.SetAttribute("ConnectionMode", ((int)ConnectionMode));
            }
コード例 #22
0
        protected override void SerializeCore(XmlElement element, SaveContext context)
        {
            base.SerializeCore(element, context); // Base implementation must be called.

            var helper = new XmlElementHelper(element);

            helper.SetAttribute("conversionMetric", SelectedMetricConversion.ToString());
            helper.SetAttribute("conversionFrom", SelectedFromConversion.ToString());
            helper.SetAttribute("conversionTo", SelectedToConversion.ToString());
        }
コード例 #23
0
            protected override void SerializeCore(XmlElement element)
            {
                XmlElementHelper helper = new XmlElementHelper(element);

                helper.SetAttribute("X", Region.X);
                helper.SetAttribute("Y", Region.Y);
                helper.SetAttribute("Width", Region.Width);
                helper.SetAttribute("Height", Region.Height);
                helper.SetAttribute("IsCrossSelection", IsCrossSelection);
            }
コード例 #24
0
            protected override void SerializeCore(XmlElement element)
            {
                XmlElementHelper helper = new XmlElementHelper(element);

                helper.SetAttribute("NodeId", NodeId);
                helper.SetAttribute("NoteText", NoteText);
                helper.SetAttribute("X", X);
                helper.SetAttribute("Y", Y);
                helper.SetAttribute("DefaultPosition", DefaultPosition);
            }
コード例 #25
0
            protected override void SerializeCore(XmlElement element)
            {
                XmlElementHelper helper = new XmlElementHelper(element);

                helper.SetAttribute("NodeId", NodeId);
                helper.SetAttribute("Name", Name);
                helper.SetAttribute("Category", Category);
                helper.SetAttribute("Description", Description);
                helper.SetAttribute("MakeCurrent", MakeCurrent);
            }
コード例 #26
0
ファイル: NoteModel.cs プロジェクト: reddyashish/Dynamo
        protected override void SerializeCore(XmlElement element, SaveContext context)
        {
            var helper = new XmlElementHelper(element);

            helper.SetAttribute("guid", GUID);
            helper.SetAttribute("text", Text);
            helper.SetAttribute("x", X);
            helper.SetAttribute("y", Y);
            helper.SetAttribute("pinnedNode", pinnedNode == null ? Guid.Empty : pinnedNode.GUID);
        }
コード例 #27
0
        protected override void SerializeCore(XmlElement element, SaveContext context)
        {
            var helper = new XmlElementHelper(element);

            helper.SetAttribute("guid", GUID);
            helper.SetAttribute("start", Start.Owner.GUID);
            helper.SetAttribute("start_index", Start.Index);
            helper.SetAttribute("end", End.Owner.GUID);
            helper.SetAttribute("end_index", End.Index);
            //helper.SetAttribute("portType", ((int) End.PortType));
        }
コード例 #28
0
        public void CreateProxyNodeCommand_SerializeDeserializeCore()
        {
            //Arrange
            XmlDocument xmlDocument   = new XmlDocument();
            XmlElement  elemProxyTest = xmlDocument.CreateElement("TestProxyCommand");

            XmlElement elemTestChild = xmlDocument.CreateElement("TestProxyCommandChild");

            elemProxyTest.AppendChild(elemTestChild);

            var helper = new XmlElementHelper(elemProxyTest);

            //DeserializeCore method is checking several attributes, then we need to set them up before calling DeserializeCore
            helper.SetAttribute("NodeName", "ProxyNodeTest");
            helper.SetAttribute("NickName", "ProxyNode");
            helper.SetAttribute("X", 100);
            helper.SetAttribute("Y", 150);
            helper.SetAttribute("DefaultPosition", true);
            helper.SetAttribute("TransformCoordinates", true);
            helper.SetAttribute("Inputs", 1);
            helper.SetAttribute("Outputs", 1);

            //Act
            var proxyNodeCommandNode = CreateProxyNodeCommand.DeserializeCore(elemProxyTest);
            var xmlSerializedCommand = proxyNodeCommandNode.Serialize(xmlDocument);

            //Assert
            Assert.IsNotNull(proxyNodeCommandNode);
            Assert.AreEqual(proxyNodeCommandNode.NickName, "ProxyNode");
            Assert.AreEqual(proxyNodeCommandNode.Inputs, 1);
            Assert.AreEqual(proxyNodeCommandNode.Outputs, 1);
        }
コード例 #29
0
ファイル: XmlHelperTests.cs プロジェクト: rafatahmed/Dynamo
        public void TestGuidAttributes()
        {
            XmlElement element = xmlDocument.CreateElement("element");

            // Test attribute writing.
            System.Guid      guidValue = System.Guid.NewGuid();
            XmlElementHelper writer    = new XmlElementHelper(element);

            writer.SetAttribute("ValidName", guidValue);

            // Test reading of existing attribute.
            XmlElementHelper reader = new XmlElementHelper(element);

            Assert.AreEqual(guidValue, reader.ReadGuid("ValidName"));

            // Test reading of non-existence attribute with default value.
            System.Guid defaultGuid = System.Guid.NewGuid();
            Assert.AreEqual(defaultGuid, reader.ReadGuid("InvalidName", defaultGuid));

            // Test reading of non-existence attribute without default value.
            Assert.Throws <InvalidOperationException>(() =>
            {
                reader.ReadGuid("InvalidName");
            });
        }
コード例 #30
0
ファイル: PythonNode.cs プロジェクト: algobasket/Dynamo
        protected override void SerializeCore(XmlElement element, SaveContext context)
        {
            base.SerializeCore(element, context);
            var helper = new XmlElementHelper(element);

            helper.SetAttribute("Script", Script);
        }
コード例 #31
0
ファイル: DSFunction.cs プロジェクト: whztt07/Dynamo
        public override void SerializeCore(XmlElement element, SaveContext context)
        {
            base.SerializeCore(element, context);
            var helper = new XmlElementHelper(element);

            helper.SetAttribute("name", Definition.MangledName);
        }
コード例 #32
0
ファイル: BaseTypes.cs プロジェクト: norbertzsiros/Dynamo
        protected override void SerializeCore(XmlElement nodeElement, SaveContext context)
        {
            base.SerializeCore(nodeElement, context);
            XmlElement outEl = nodeElement.OwnerDocument.CreateElement(typeof(string).FullName);

            var helper = new XmlElementHelper(outEl);
            helper.SetAttribute("value", SerializeValue());
            nodeElement.AppendChild(outEl);
        }
コード例 #33
0
        public void TestDoubleAttributes()
        {
            XmlElement element = xmlDocument.CreateElement("element");

            // Test attribute writing.
            XmlElementHelper writer = new XmlElementHelper(element);
            writer.SetAttribute("ValidName", -12.34);

            // Test reading of existing attribute.
            XmlElementHelper reader = new XmlElementHelper(element);
            Assert.AreEqual(-12.34, reader.ReadDouble("ValidName"));

            // Test reading of non-existence attribute with default value.
            Assert.AreEqual(56.78, reader.ReadDouble("InvalidName", 56.78));

            // Test reading of non-existence attribute without default value.
            Assert.Throws<InvalidOperationException>(() =>
            {
                reader.ReadDouble("InvalidName");
            });
        }
コード例 #34
0
        public void TestBooleanAttributes()
        {
            XmlElement element = xmlDocument.CreateElement("element");

            // Test attribute writing.
            XmlElementHelper writer = new XmlElementHelper(element);
            writer.SetAttribute("ValidName", true);

            // Test reading of existing attribute.
            XmlElementHelper reader = new XmlElementHelper(element);
            Assert.AreEqual(true, reader.ReadBoolean("ValidName"));

            // Test reading of non-existence attribute with default value.
            Assert.AreEqual(true, reader.ReadBoolean("InvalidName", true));
            Assert.AreEqual(false, reader.ReadBoolean("InvalidName", false));

            // Test reading of non-existence attribute without default value.
            Assert.Throws<InvalidOperationException>(() =>
            {
                reader.ReadBoolean("InvalidName");
            });
        }
コード例 #35
0
ファイル: RecordableCommands.cs プロジェクト: heegwon/Dynamo
 protected override void SerializeCore(XmlElement element)
 {
     XmlElementHelper helper = new XmlElementHelper(element);
     helper.SetAttribute("NodeId", NodeId);
     helper.SetAttribute("NoteText", NoteText);
     helper.SetAttribute("X", X);
     helper.SetAttribute("Y", Y);
     helper.SetAttribute("DefaultPosition", DefaultPosition);
 }
コード例 #36
0
ファイル: RecordableCommands.cs プロジェクト: heegwon/Dynamo
 protected override void SerializeCore(XmlElement element)
 {
     XmlElementHelper helper = new XmlElementHelper(element);
     helper.SetAttribute("NodeId", NodeId);
     helper.SetAttribute("NodeName", NodeName);
     helper.SetAttribute("X", X);
     helper.SetAttribute("Y", Y);
     helper.SetAttribute("DefaultPosition", DefaultPosition);
     helper.SetAttribute("TransformCoordinates", TransformCoordinates);
 }
コード例 #37
0
ファイル: RecordableCommands.cs プロジェクト: heegwon/Dynamo
 protected override void SerializeCore(XmlElement element)
 {
     XmlElementHelper helper = new XmlElementHelper(element);
     helper.SetAttribute("ShowErrors", ShowErrors);
     helper.SetAttribute("CancelRun", CancelRun);
 }
コード例 #38
0
ファイル: RecordableCommands.cs プロジェクト: heegwon/Dynamo
 protected override void SerializeCore(XmlElement element)
 {
     XmlElementHelper helper = new XmlElementHelper(element);
     helper.SetAttribute("XmlFilePath", XmlFilePath);
 }
コード例 #39
0
        internal string SaveRecordedCommands()
        {
            var document = new XmlDocument();
            XmlElement commandRoot = document.CreateElement("Commands");
            document.AppendChild(commandRoot);

            const string format = "Commands-{0:yyyyMMdd-hhmmss}.xml";
            string xmlFileName = string.Format(format, DateTime.Now);
            string xmlFilePath = Path.Combine(Path.GetTempPath(), xmlFileName);
            
            // Create attributes that applied to the entire recording.
            var helper = new XmlElementHelper(commandRoot);
            helper.SetAttribute(EXIT_ATTRIB_NAME, ExitAfterPlayback);
            helper.SetAttribute(PAUSE_ATTRIB_NAME, PauseAfterPlayback);
            helper.SetAttribute(INTERVAL_ATTRIB_NAME, CommandInterval);
            // Serialization in SaveContext.File may need file path. Add it
            // temporarily and remove it after searilization.
            NodeUtils.SetDocumentXmlPath(document, xmlFilePath);

            foreach (DynamoModel.RecordableCommand command in recordedCommands)
                commandRoot.AppendChild(command.Serialize(document));

            NodeUtils.SetDocumentXmlPath(document, null);

            // Save recorded commands into XML file and open it in viewer.
            document.Save(xmlFilePath);
            return xmlFilePath;
        }
コード例 #40
0
ファイル: RecordableCommands.cs プロジェクト: heegwon/Dynamo
 protected override void SerializeCore(XmlElement element)
 {
     XmlElementHelper helper = new XmlElementHelper(element);
     helper.SetAttribute("CmdOperation", ((int)CmdOperation));
 }
コード例 #41
0
ファイル: RecordableCommands.cs プロジェクト: heegwon/Dynamo
 protected override void SerializeCore(XmlElement element)
 {
     XmlElementHelper helper = new XmlElementHelper(element);
     helper.SetAttribute("X", MouseCursor.X);
     helper.SetAttribute("Y", MouseCursor.Y);
     helper.SetAttribute("DragOperation", ((int)DragOperation));
 }
コード例 #42
0
ファイル: RecordableCommands.cs プロジェクト: heegwon/Dynamo
 protected override void SerializeCore(XmlElement element)
 {
     XmlElementHelper helper = new XmlElementHelper(element);
     helper.SetAttribute("NodeId", NodeId);
 }
コード例 #43
0
ファイル: DSFunction.cs プロジェクト: khoaho/Dynamo
 public override void SerializeCore(XmlElement element, SaveContext context)
 {
     base.SerializeCore(element, context);
     var helper = new XmlElementHelper(element);
     helper.SetAttribute("name", Definition.MangledName);
 }
コード例 #44
0
ファイル: NodeModel.cs プロジェクト: riteshchandawar/Dynamo
        protected override void SerializeCore(XmlElement element, SaveContext context)
        {
            XmlElementHelper helper = new XmlElementHelper(element);

            // Set the type attribute
            helper.SetAttribute("type", this.GetType().ToString());
            helper.SetAttribute("guid", this.GUID);
            helper.SetAttribute("nickname", this.NickName);
            helper.SetAttribute("x", this.X);
            helper.SetAttribute("y", this.Y);
            helper.SetAttribute("isVisible", this.IsVisible);
            helper.SetAttribute("isUpstreamVisible", this.IsUpstreamVisible);
            helper.SetAttribute("lacing", this.ArgumentLacing.ToString());

            if (context == SaveContext.Undo)
            {
                // Fix: MAGN-159 (nodes are not editable after undo/redo).
                helper.SetAttribute("interactionEnabled", this.interactionEnabled);
                helper.SetAttribute("nodeState", this.state.ToString());
            }
        }
コード例 #45
0
 protected override void SerializeCore(XmlElement element, SaveContext context)
 {
     var helper = new XmlElementHelper(element);
     helper.SetAttribute("guid", GUID);
     helper.SetAttribute("start", Start.Owner.GUID);
     helper.SetAttribute("start_index", Start.Index);
     helper.SetAttribute("end", End.Owner.GUID);
     helper.SetAttribute("end_index", End.Index);
     //helper.SetAttribute("portType", ((int) End.PortType));
 }
コード例 #46
0
 protected override void SerializeCore(XmlElement element, SaveContext context)
 {
     XmlElementHelper helper = new XmlElementHelper(element);
     helper.SetAttribute(DummyModel.RadiusName, this.Radius);
     helper.SetAttribute(DummyModel.IdName, this.Identifier);
 }
コード例 #47
0
ファイル: RecordableCommands.cs プロジェクト: heegwon/Dynamo
 protected override void SerializeCore(XmlElement element)
 {
     XmlElementHelper helper = new XmlElementHelper(element);
     helper.SetAttribute("ModelGuid", ModelGuid);
     helper.SetAttribute("Modifiers", ((int)Modifiers));
 }
コード例 #48
0
ファイル: dynPython.cs プロジェクト: kscalvin/Dynamo
        protected override void SerializeCore(XmlElement element, SaveContext context)
        {
            base.SerializeCore(element, context);

            var helper = new XmlElementHelper(element);
            helper.SetAttribute("Script", this.Script);
        }
コード例 #49
0
ファイル: RecordableCommands.cs プロジェクト: heegwon/Dynamo
 protected override void SerializeCore(XmlElement element)
 {
     XmlElementHelper helper = new XmlElementHelper(element);
     helper.SetAttribute("X", Region.X);
     helper.SetAttribute("Y", Region.Y);
     helper.SetAttribute("Width", Region.Width);
     helper.SetAttribute("Height", Region.Height);
     helper.SetAttribute("IsCrossSelection", IsCrossSelection);
 }
コード例 #50
0
ファイル: CodeBlockNode.cs プロジェクト: TheChosen0ne/Dynamo
 protected override void SaveNode(XmlDocument xmlDoc, XmlElement nodeElement, SaveContext context)
 {
     base.SaveNode(xmlDoc, nodeElement, context);
     var helper = new XmlElementHelper(nodeElement);
     helper.SetAttribute("CodeText", code);
     helper.SetAttribute("ShouldFocus", shouldFocus);
 }
コード例 #51
0
ファイル: RecordableCommands.cs プロジェクト: heegwon/Dynamo
 protected override void SerializeCore(XmlElement element)
 {
     XmlElementHelper helper = new XmlElementHelper(element);
     helper.SetAttribute("NodeId", NodeId);
     helper.SetAttribute("PortIndex", PortIndex);
     helper.SetAttribute("Type", ((int)Type));
     helper.SetAttribute("ConnectionMode", ((int)ConnectionMode));
 }
コード例 #52
0
        protected override void SerializeCore(XmlElement element, SaveContext context)
        {
            base.SerializeCore(element, context); // Base implementation must be called.

            var helper = new XmlElementHelper(element);
            helper.SetAttribute("conversionMetric", SelectedMetricConversion.ToString());
            helper.SetAttribute("conversionFrom", SelectedFromConversion.ToString());
            helper.SetAttribute("conversionTo", SelectedToConversion.ToString());
        }
コード例 #53
0
ファイル: RecordableCommands.cs プロジェクト: heegwon/Dynamo
 protected override void SerializeCore(XmlElement element)
 {
     XmlElementHelper helper = new XmlElementHelper(element);
     helper.SetAttribute("ModelGuid", ModelGuid);
     helper.SetAttribute("Name", Name);
     helper.SetAttribute("Value", Value);
 }
コード例 #54
0
ファイル: AutomationSettings.cs プロジェクト: RobertiF/Dynamo
        internal string SaveRecordedCommands()
        {
            XmlDocument document = new XmlDocument();
            XmlElement commandRoot = document.CreateElement("Commands");
            document.AppendChild(commandRoot);

            // Create attributes that applied to the entire recording.
            XmlElementHelper helper = new XmlElementHelper(commandRoot);
            helper.SetAttribute(ExitAttribName, ExitAfterPlayback);
            helper.SetAttribute(PauseAttribName, PauseAfterPlayback);
            helper.SetAttribute(IntervalAttribName, CommandInterval);

            foreach (DynCmd.RecordableCommand command in recordedCommands)
                commandRoot.AppendChild(command.Serialize(document));

            string format = "Commands-{0:yyyyMMdd-hhmmss}.xml";
            string xmlFileName = string.Format(format, DateTime.Now);
            string xmlFilePath = Path.Combine(Path.GetTempPath(), xmlFileName);

            // Save recorded commands into XML file and open it in viewer.
            document.Save(xmlFilePath);
            return xmlFilePath;
        }
コード例 #55
0
ファイル: Function.cs プロジェクト: khoaho/Dynamo
        protected override void SerializeCore(XmlElement element, SaveContext context)
        {
            base.SerializeCore(element, context); //Base implementation must be called
            
            if (context != SaveContext.Undo) return;

            var helper = new XmlElementHelper(element);
            helper.SetAttribute("functionId", Definition.FunctionId.ToString());
            helper.SetAttribute("functionName", NickName);
            helper.SetAttribute("functionDesc", Description);

            XmlDocument xmlDoc = element.OwnerDocument;
            foreach (string input in InPortData.Select(x => x.NickName))
            {
                XmlElement inputEl = xmlDoc.CreateElement("functionInput");
                inputEl.SetAttribute("inputValue", input);
                element.AppendChild(inputEl);
            }

            foreach (string input in OutPortData.Select(x => x.NickName))
            {
                XmlElement outputEl = xmlDoc.CreateElement("functionOutput");
                outputEl.SetAttribute("outputValue", input);
                element.AppendChild(outputEl);
            }
        }
コード例 #56
0
ファイル: RecordableCommands.cs プロジェクト: heegwon/Dynamo
 protected override void SerializeCore(XmlElement element)
 {
     XmlElementHelper helper = new XmlElementHelper(element);
     helper.SetAttribute("NodeId", NodeId);
     helper.SetAttribute("Name", Name);
     helper.SetAttribute("Category", Category);
     helper.SetAttribute("Description", Description);
     helper.SetAttribute("MakeCurrent", MakeCurrent);
 }
コード例 #57
0
      void SerializeCore(XmlElement element, SaveContext context)
 {            
     XmlElementHelper helper = new XmlElementHelper(element);
     helper.SetAttribute("guid", this.GUID);
     helper.SetAttribute("annotationText", this.AnnotationText);
     helper.SetAttribute("left", this.X);
     helper.SetAttribute("top", this.Y);
     helper.SetAttribute("width", this.Width);
     helper.SetAttribute("height", this.Height);
     helper.SetAttribute("fontSize", this.FontSize);
     helper.SetAttribute("InitialTop", this.InitialTop);
     helper.SetAttribute("InitialHeight", this.InitialHeight);
     helper.SetAttribute("TextblockHeight", this.TextBlockHeight);
     helper.SetAttribute("backgrouund", (this.Background == null ? "" : this.Background.ToString()));        
     //Serialize Selected models
     XmlDocument xmlDoc = element.OwnerDocument;            
     foreach (var guids in this.SelectedModels.Select(x => x.GUID))
     {
         if (xmlDoc != null)
         {
             var modelElement = xmlDoc.CreateElement("Models");
             element.AppendChild(modelElement);
             XmlElementHelper mhelper = new XmlElementHelper(modelElement);
             modelElement.SetAttribute("ModelGuid", guids.ToString());
         }
     }
 }
コード例 #58
0
ファイル: RecordableCommands.cs プロジェクト: heegwon/Dynamo
 protected override void SerializeCore(XmlElement element)
 {
     XmlElementHelper helper = new XmlElementHelper(element);
     helper.SetAttribute("TabIndex", TabIndex);
 }
コード例 #59
0
ファイル: CodeBlockNode.cs プロジェクト: TheChosen0ne/Dynamo
 protected override void SerializeCore(XmlElement element, SaveContext context)
 {
     base.SerializeCore(element, context);
     var helper = new XmlElementHelper(element);
     helper.SetAttribute("CodeText", code);
     helper.SetAttribute("ShouldFocus", shouldFocus);
 }
コード例 #60
0
ファイル: RecordableCommands.cs プロジェクト: heegwon/Dynamo
 protected override void SerializeCore(XmlElement element)
 {
     XmlElementHelper helper = new XmlElementHelper(element);
     helper.SetAttribute("Tag", Tag);
     helper.SetAttribute("PauseDurationInMs", PauseDurationInMs);
 }