RaumfeldNET.UPNP.XMLParser.getNodeAttributeValue C# (CSharp) Method

getNodeAttributeValue() public method

public getNodeAttributeValue ( string _xmlString, string _nodeId, string _attributeId ) : string
_xmlString string
_nodeId string
_attributeId string
return string
        public string getNodeAttributeValue(string _xmlString, string _nodeId, string _attributeId)
        {
            XmlReader reader = XmlReader.Create(new StringReader(_xmlString));

            if (!reader.ReadToFollowing(_nodeId))
                return null;
            if (!reader.MoveToAttribute(_attributeId))
                return null;
            return reader.Value;
        }

Usage Example

コード例 #1
0
ファイル: UPNPWrapper.cs プロジェクト: stoennies/raumwiese
        protected void propertyChanged()
        {
            string propXml = renderingControl.PropertyLastChange();
                string result;
                XMLParser xmlParser = new XMLParser();
                UInt16 currentVolumeNew;
                Boolean isMutedNew;

                result = xmlParser.getNodeAttributeValue(propXml, "Volume", "val");
                if (result != null)
                {
                    currentVolumeNew = (UInt16)Convert.ToInt16(result);
                    if (currentVolumeNew != null && currentVolume != currentVolumeNew)
                    {
                        currentVolume = currentVolumeNew;
                        this.VolumeChangedSink(currentVolumeNew);
                    }
                }

                result = xmlParser.getNodeAttributeValue(propXml, "Mute", "val");
                if (result != null)
                {
                    if (result == "0")
                        isMutedNew = false;
                    else
                        isMutedNew = true;
                    if (isMutedNew != null /*&& isMuted != isMutedNew*/)
                    {
                        isMuted = isMutedNew;
                        this.MuteStateChangedSink(isMutedNew);
                    }
                }
        }
All Usage Examples Of RaumfeldNET.UPNP.XMLParser::getNodeAttributeValue