コード例 #1
0
        private void Update55()
        {
            var a55 = AttributeSet.Attributes.FirstOrDefault(a => a.Ifnr == 55);

            if (null == a55)
            {
                AttributeSet.Attributes.Add(a55 = new AllplanAttribute {
                    Ifnr = 55, Suffix = "Y"
                });
            }

            a55.Value = string.Join(" ", AttributeSet.Attributes.Select(a => a.Ifnr).Where(ifnr => 55 != ifnr));
        }
コード例 #2
0
        internal static AllplanAttributeSet ReadFrom(XmlReader reader)
        {
            if (reader.NodeType != XmlNodeType.Element)
            {
                throw new NotSupportedException($"Expecting element type");
            }
            if (!reader.Name.Equals(ELEMENT_NAME))
            {
                throw new NotSupportedException($"Expecting '{ELEMENT_NAME}' as prefix. Got '{reader.Name}'");
            }

            var attribSet = new AllplanAttributeSet
            {
                Key = reader.GetAttribute("KEY")
            };

            while (reader.Read())
            {
                switch (reader.NodeType)
                {
                case XmlNodeType.Element:
                    if (reader.Name.StartsWith(AllplanAttribute.ELEMENT_NAME))
                    {
                        attribSet.Attributes.Add(AllplanAttribute.ReadFrom(reader));
                    }
                    else
                    {
                        throw new NotImplementedException($"Missing implementation for element '{reader.Name}'");
                    }
                    break;

                case XmlNodeType.EndElement:
                    if (reader.Name.Equals(ELEMENT_NAME))
                    {
                        return(attribSet);
                    }
                    break;
                }
            }

            throw new NotSupportedException($"Unexpected end of file");
        }