コード例 #1
0
        public bool Parse(XmlNode node)
        {
            bool result = true;

            foreach (XmlNode childNode in node.ChildNodes)
            {
                if (childNode.Name == "paramIDRef")
                {
                    var paramIdRef = new XddParamIdRef();

                    if (!paramIdRef.Parse(childNode))
                    {
                        result = false;
                        break;
                    }

                    ParamIdRef = paramIdRef;
                }
                else if (childNode.Name == "valueEntry")
                {
                    var valueEntry = new XddValueEntry();

                    if (!valueEntry.Parse(childNode))
                    {
                        result = false;
                        break;
                    }

                    ValueEntry = valueEntry;
                }
            }

            return(result);
        }
コード例 #2
0
        public bool Parse(XmlNode node)
        {
            bool result = true;

            foreach (XmlNode childNode in node.ChildNodes)
            {
                if (childNode.Name == "paramIDRef")
                {
                    var paramIdRef = new XddParamIdRef();

                    if (!paramIdRef.Parse(childNode))
                    {
                        result = false;
                        break;
                    }

                    ParamIdRef = paramIdRef;
                }
                else if (childNode.Name == "defaultValue")
                {
                    string defaultValue = childNode.InnerXml;

                    if (defaultValue.StartsWith("0x"))
                    {
                        DefaultValue = Convert.ToInt32(defaultValue.Substring(2), 16);
                    }
                }
            }

            return(result);
        }
コード例 #3
0
        public bool Parse(XmlNode node)
        {
            bool result = true;

            UniqueId = node.Attributes["uniqueID"].InnerXml;

            foreach (XmlNode childNode in node.ChildNodes)
            {
                if (childNode.Name == "label")
                {
                    var label = new XddLabel(childNode);

                    if (!label.Parse())
                    {
                        result = false;
                        break;
                    }

                    Labels.Add(label);
                }
                else if (childNode.Name == "paramIDRef")
                {
                    var paramIdRef = new XddParamIdRef();

                    if (!paramIdRef.Parse(childNode))
                    {
                        result = false;
                        break;
                    }

                    ParamIdRef = paramIdRef;
                }
                else if (childNode.Name == "channelBuffer")
                {
                    var channelBuffer = new ChannelBuffer();

                    if (!channelBuffer.Parse(childNode))
                    {
                        result = false;
                        break;
                    }

                    ChannelBuffer = channelBuffer;
                }
            }

            return(result);
        }
コード例 #4
0
        public bool Parse(XmlNode node)
        {
            bool result = true;

            ParamIdRefs = new List <XddParamIdRef>();

            foreach (XmlNode childNode in node.ChildNodes)
            {
                if (childNode.Name == "paramIDRef")
                {
                    var paramIdRef = new XddParamIdRef();

                    if (!paramIdRef.Parse(childNode))
                    {
                        result = false;
                        break;
                    }

                    ParamIdRefs.Add(paramIdRef);
                }
            }

            return(result);
        }
コード例 #5
0
        public bool Parse()
        {
            bool result = false;

            try
            {
                if (_source.ChildNodes.Count > 0)
                {
                    foreach (XmlNode childNode in _source.ChildNodes)
                    {
                        if (childNode is XmlText)
                        {
                            result = SetDefaultValue(_dataType, _source.InnerXml.Trim());
                        }
                        else if (childNode.Name == "enumEntryIDRef")
                        {
                            var uniqueIdRef = childNode.Attributes["uniqueIDRef"].InnerXml;
                            var value       = _dataTypeList.FindReferenceValue(uniqueIdRef);
                            var dataType    = _dataTypeList.FindReferencedDataType(uniqueIdRef);

                            if (value != null)
                            {
                                result = SetDefaultValue(dataType, value);
                            }

                            break;
                        }
                        else if (childNode.Name == "paramIDRef")
                        {
                            var paramIdRef = new XddParamIdRef();

                            if (!paramIdRef.Parse(childNode))
                            {
                                result = false;
                                break;
                            }

                            ParamIdRef = paramIdRef;

                            result = true;

                            break;
                        }
                        else if (childNode.Name == "value")
                        {
                            result = SetDefaultValue(_dataType, childNode.InnerXml.Trim());
                        }
                    }
                }
                else
                {
                    result = SetDefaultValue(_dataType, _source.InnerXml.Trim());
                }
            }
            catch (Exception e)
            {
                MsgLogger.Exception($"{GetType().Name} - Parse", e);
            }

            return(result);
        }