Ejemplo n.º 1
0
        public void ReadFromXml(XmlNode node)
        {
            if (node.Attributes != null)
            {
                _name      = node.Attributes["Name"] == null ? "" : node.Attributes["Name"].Value;
                _aliasName = node.Attributes["AliasName"] == null ? "" : node.Attributes["AliasName"].Value;
                _visible   = node.Attributes["Visible"] == null
                    ? true
                    : (node.Attributes["Visible"].Value.ToUpper().StartsWith("T") ? true : false);
                _dataType = node.Attributes["DataType"] == null
                    ? enumPipelineDataType.Point
                    : EnumHelper.ConvertDataTypeFromString(node.Attributes["DataType"].Value);
                _heightType = node.Attributes["HeightType"] == null
                    ? enumPipelineHeightType.Top
                    : EnumHelper.ConvertHeightTypeFromStr(node.Attributes["HeightType"].Value);
                _validateKeys = node.Attributes["ValidateKeys"] == null ? "" : node.Attributes["ValidateKeys"].Value;
                _templateName = node.Attributes["TemplateName"] == null ? "" : node.Attributes["TemplateName"].Value;
                _autoNames    = node.Attributes["AutoNames"].Value;
            }

            XmlNodeList fieldNodes = node.SelectNodes("Fields/Field");

            foreach (XmlNode fieldNode in fieldNodes)
            {
                IYTField field = new YTField(fieldNode);
                //需要检查已有的字段定义中有没有重名的
                IYTField findField = _fields.FirstOrDefault(c => c.Name == field.Name);
                if (findField != null)
                {
                    _fields.Remove(findField);
                }
                _fields.Add(field);
            }
        }
Ejemplo n.º 2
0
        public void ReadFromXml(XmlNode xmlNode)
        {
            if (xmlNode.Attributes != null)
            {
                _name     = xmlNode.Attributes["Name"].Value;
                _caption  = xmlNode.Attributes["Caption"].Value;
                _dataType = xmlNode.Attributes["DataType"] == null
                    ? enumPipelineDataType.Point
                    : EnumHelper.ConvertDataTypeFromString(xmlNode.Attributes["DataType"].Value);
            }
            XmlNodeList nodeList =
                xmlNode.SelectNodes($"/PipelineConfig/LayerTemplates/Template[@Name='{_name}']/Fields/Field");

            foreach (XmlNode node in nodeList)
            {
                IYTField field = new YTField(node);
                _fields.Add(field);
            }
        }