protected override IEnumerable <XmlPortNode> CreateItems()
        {
            var xmlPortTextAttribute = new XmlPortTextAttribute(Name, GetIndentation(), ID);

            xmlPortTextAttribute.Properties.DataType   = DataType;
            xmlPortTextAttribute.Properties.Occurrence = Occurrence;
            xmlPortTextAttribute.Properties.OnAfterAssignVariable.Set(OnAfterAssignVariable);
            xmlPortTextAttribute.Properties.OnBeforePassVariable.Set(OnBeforePassVariable);
            xmlPortTextAttribute.Properties.TextType     = TextType;
            xmlPortTextAttribute.Properties.VariableName = VariableName;
            xmlPortTextAttribute.Properties.Width        = Width;

            yield return(xmlPortTextAttribute);

            if (ChildNodes != null)
            {
                var variables = new List <PSVariable>()
                {
                    new PSVariable("NodeIndentation", GetIndentation() + 1)
                };
                var childNodes = ChildNodes.InvokeWithContext(null, variables).Select(c => c.BaseObject);


                foreach (var childNode in childNodes.OfType <XmlPortNode>())
                {
                    yield return(childNode);
                }
            }
        }
Exemplo n.º 2
0
        public static void Write(this XmlPortTextAttribute xmlPortTextAttribute, CSideWriter writer)
        {
            var relevantProperties = xmlPortTextAttribute.Properties.Where(p => p.HasValue);

            WriteDeclaration(xmlPortTextAttribute.ID, xmlPortTextAttribute.NodeName, xmlPortTextAttribute.IndentationLevel, "Attribute", "Text", relevantProperties.Any(), writer);
            relevantProperties.Write(PropertiesStyle.Field, writer);
            writer.Write(IndentationAfterLastTrigger(relevantProperties));
            writer.WriteLine("}");
            writer.Unindent();
            writer.InnerWriter.WriteLine();
        }