コード例 #1
0
        public override void LoadParameters(XElement xml)
        {
            base.LoadParameters(xml);

            if (_loadedParameters == false)
            {
                CreateInputOutputBytes(InputSize, OutputSize);

                if (xml.Element("InputStartIO") != null)
                {
                    var ioName = xml.Element("InputStartIO").Value;
                    FAIOInfo ioInfo = Device.GetInputIOInfo(ioName);
                    if (ioInfo == null)
                        throw new Exception("Not Found IO(" + ioName + ") In IOList. Part Name is " + Name);

                    InputStartIO = new FAPartInputIOInfo(Device, ioName, ioInfo.Index, ioInfo.Description);
                }

                if (xml.Element("OutputStartIO") != null)
                {
                    var ioName = xml.Element("OutputStartIO").Value;
                    FAIOInfo ioInfo = Device.GetOutputIOInfo(ioName);
                    if (ioInfo == null)
                        throw new Exception("Not Found IO(" + ioName + ") In IOList. Part Name is " + Name);

                    OutputStartIO = new FAPartInputIOInfo(Device, ioName, ioInfo.Index, ioInfo.Description);
                }

                _loadedParameters = true;
            }
        }
コード例 #2
0
        private void LoadInputIOList(XElement xml)
        {
            foreach (XElement item in xml.Elements())
            {
                string ioName;
                bool isInverse = false;

                if (item.HasElements)
                {
                    ioName = item.Element("IOName").Value;
                    isInverse = bool.Parse(item.Element("IsInverse").Value);
                }
                else
                {
                    ioName = item.Value;
                }

                FAIOInfo ioInfo = Device.GetInputIOInfo(ioName);
                if (ioInfo == null)
                    throw new Exception("Not Found IO(" + ioName + ") In IOList. Part Name is " + Name);

                var obj = new FAPartInputIOInfo(Device, ioName, ioInfo.Index, ioInfo.Description);
                obj.IsInverse = isInverse;
                this.InputIO.Add(obj);
            }
        }