Ejemplo n.º 1
0
            protected override void SerializeCore(XmlElement element)
            {
                XmlElementHelper helper = new XmlElementHelper(element);

                helper.SetAttribute("ShowErrors", ShowErrors);
                helper.SetAttribute("CancelRun", CancelRun);
            }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
            protected override void SerializeCore(XmlElement element)
            {
                XmlElementHelper helper = new XmlElementHelper(element);

                helper.SetAttribute("Tag", Tag);
                helper.SetAttribute("PauseDurationInMs", PauseDurationInMs);
            }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 6
0
            protected override void SerializeCore(XmlElement element)
            {
                XmlElementHelper helper = new XmlElementHelper(element);

                helper.SetAttribute("ModelGuid", ModelGuid);
                helper.SetAttribute("EventName", EventName);
            }
Ejemplo n.º 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");
        }
Ejemplo n.º 8
0
        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);
                }
            }
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 12
0
            protected override void SerializeCore(XmlElement element)
            {
                XmlElementHelper helper = new XmlElementHelper(element);

                helper.SetAttribute("ModelGuid", ModelGuid);
                helper.SetAttribute("Modifiers", ((int)Modifiers));
            }
Ejemplo n.º 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);
        }
Ejemplo n.º 14
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);
 }
Ejemplo n.º 15
0
        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);
        }
Ejemplo n.º 16
0
        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);
        }
Ejemplo n.º 17
0
            protected override void SerializeCore(XmlElement element)
            {
                var helper = new XmlElementHelper(element);

                helper.SetAttribute("ModelGuid", ModelGuid);
                helper.SetAttribute("Name", Name);
                helper.SetAttribute("Value", Value);
            }
Ejemplo n.º 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));
            }
Ejemplo n.º 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());
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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));
            }
Ejemplo n.º 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());
        }
Ejemplo n.º 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);
            }
Ejemplo n.º 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);
            }
Ejemplo n.º 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);
            }
Ejemplo n.º 26
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);
            helper.SetAttribute("pinnedNode", pinnedNode == null ? Guid.Empty : pinnedNode.GUID);
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 29
0
        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");
            });
        }
Ejemplo n.º 30
0
        protected override void SerializeCore(XmlElement element, SaveContext context)
        {
            base.SerializeCore(element, context);
            var helper = new XmlElementHelper(element);

            helper.SetAttribute("Script", Script);
        }
Ejemplo n.º 31
0
        public override void SerializeCore(XmlElement element, SaveContext context)
        {
            base.SerializeCore(element, context);
            var helper = new XmlElementHelper(element);

            helper.SetAttribute("name", Definition.MangledName);
        }
Ejemplo n.º 32
0
        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);
        }
Ejemplo n.º 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");
            });
        }
Ejemplo n.º 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");
            });
        }
Ejemplo n.º 35
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);
 }
Ejemplo n.º 36
0
 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);
 }
Ejemplo n.º 37
0
 protected override void SerializeCore(XmlElement element)
 {
     XmlElementHelper helper = new XmlElementHelper(element);
     helper.SetAttribute("ShowErrors", ShowErrors);
     helper.SetAttribute("CancelRun", CancelRun);
 }
Ejemplo n.º 38
0
 protected override void SerializeCore(XmlElement element)
 {
     XmlElementHelper helper = new XmlElementHelper(element);
     helper.SetAttribute("XmlFilePath", XmlFilePath);
 }
Ejemplo n.º 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;
        }
Ejemplo n.º 40
0
 protected override void SerializeCore(XmlElement element)
 {
     XmlElementHelper helper = new XmlElementHelper(element);
     helper.SetAttribute("CmdOperation", ((int)CmdOperation));
 }
Ejemplo n.º 41
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));
 }
Ejemplo n.º 42
0
 protected override void SerializeCore(XmlElement element)
 {
     XmlElementHelper helper = new XmlElementHelper(element);
     helper.SetAttribute("NodeId", NodeId);
 }
Ejemplo n.º 43
0
 public override void SerializeCore(XmlElement element, SaveContext context)
 {
     base.SerializeCore(element, context);
     var helper = new XmlElementHelper(element);
     helper.SetAttribute("name", Definition.MangledName);
 }
Ejemplo n.º 44
0
        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());
            }
        }
Ejemplo n.º 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));
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 47
0
 protected override void SerializeCore(XmlElement element)
 {
     XmlElementHelper helper = new XmlElementHelper(element);
     helper.SetAttribute("ModelGuid", ModelGuid);
     helper.SetAttribute("Modifiers", ((int)Modifiers));
 }
Ejemplo n.º 48
0
        protected override void SerializeCore(XmlElement element, SaveContext context)
        {
            base.SerializeCore(element, context);

            var helper = new XmlElementHelper(element);
            helper.SetAttribute("Script", this.Script);
        }
Ejemplo n.º 49
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);
 }
Ejemplo n.º 50
0
 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);
 }
Ejemplo n.º 51
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));
 }
Ejemplo n.º 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());
        }
Ejemplo n.º 53
0
 protected override void SerializeCore(XmlElement element)
 {
     XmlElementHelper helper = new XmlElementHelper(element);
     helper.SetAttribute("ModelGuid", ModelGuid);
     helper.SetAttribute("Name", Name);
     helper.SetAttribute("Value", Value);
 }
Ejemplo n.º 54
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;
        }
Ejemplo n.º 55
0
        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);
            }
        }
Ejemplo n.º 56
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);
 }
Ejemplo n.º 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());
         }
     }
 }
Ejemplo n.º 58
0
 protected override void SerializeCore(XmlElement element)
 {
     XmlElementHelper helper = new XmlElementHelper(element);
     helper.SetAttribute("TabIndex", TabIndex);
 }
Ejemplo n.º 59
0
 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);
 }
Ejemplo n.º 60
0
 protected override void SerializeCore(XmlElement element)
 {
     XmlElementHelper helper = new XmlElementHelper(element);
     helper.SetAttribute("Tag", Tag);
     helper.SetAttribute("PauseDurationInMs", PauseDurationInMs);
 }