当前位置: 首页>>代码示例>>C#>>正文


C# UPnPService.SetVersion方法代码示例

本文整理汇总了C#中OpenSource.UPnP.UPnPService.SetVersion方法的典型用法代码示例。如果您正苦于以下问题:C# UPnPService.SetVersion方法的具体用法?C# UPnPService.SetVersion怎么用?C# UPnPService.SetVersion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OpenSource.UPnP.UPnPService的用法示例。


在下文中一共展示了UPnPService.SetVersion方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Parse

        internal static UPnPService Parse(String XML)
        {
            StringReader MyString = new StringReader(XML);
            XmlTextReader XMLDoc = new XmlTextReader(MyString);
            UPnPService RetVal = new UPnPService(1);

            XMLDoc.Read();
            XMLDoc.MoveToContent();

            if (XMLDoc.LocalName == "service")
            {
                if (XMLDoc.AttributeCount > 0)
                {
                    for (int ax = 0; ax < XMLDoc.AttributeCount; ++ax)
                    {
                        XMLDoc.MoveToAttribute(ax);
                        if (XMLDoc.LocalName == "MaxVersion")
                        {
                            RetVal.SetVersion(XMLDoc.Value);
                        }
                    }
                    XMLDoc.MoveToContent();
                    XMLDoc.Read();
                }
                else
                {
                    XMLDoc.Read();
                    XMLDoc.MoveToContent();
                }
                while (XMLDoc.LocalName != "service")
                {
                    switch (XMLDoc.LocalName)
                    {
                        case "serviceType":
                            RetVal.ServiceURN = XMLDoc.ReadString();
                            break;
                        case "serviceId":
                            RetVal.ServiceID = XMLDoc.ReadString();
                            break;
                        case "SCPDURL":
                            RetVal.SCPDURL = XMLDoc.ReadString();
                            break;
                        case "controlURL":
                            RetVal.ControlURL = XMLDoc.ReadString();
                            break;
                        case "eventSubURL":
                            RetVal.EventURL = XMLDoc.ReadString();
                            break;
                        default:
                            break;
                    }
                    XMLDoc.Read();
                    XMLDoc.MoveToContent();
                }
            }
            return (RetVal);
        }
开发者ID:rvodden,项目名称:upnp-developertools-old,代码行数:57,代码来源:UPnPService.cs

示例2: Parse

        static internal UPnPService Parse(String XML, int startLine)
        {
            StringReader MyString = new StringReader(XML);
            XmlTextReader XMLDoc = new XmlTextReader(MyString);
            UPnPService RetVal = new UPnPService(1);

            try
            {
                XMLDoc.Read();
                XMLDoc.MoveToContent();

                if (XMLDoc.LocalName == "service")
                {
                    if (XMLDoc.AttributeCount > 0)
                    {
                        for (int ax = 0; ax < XMLDoc.AttributeCount; ++ax)
                        {
                            XMLDoc.MoveToAttribute(ax);
                            if (XMLDoc.LocalName == "MaxVersion")
                            {
                                RetVal.SetVersion(XMLDoc.Value);
                            }
                        }
                        XMLDoc.MoveToContent();
                        XMLDoc.Read();
                    }
                    else
                    {
                        XMLDoc.Read();
                        XMLDoc.MoveToContent();
                    }
                    while (XMLDoc.LocalName != "service")
                    {
                        switch (XMLDoc.LocalName)
                        {
                            case "serviceType":
                                RetVal.ServiceURN = XMLDoc.ReadString();
                                break;
                            case "serviceId":
                                RetVal.ServiceID = XMLDoc.ReadString();
                                break;
                            case "SCPDURL":
                                RetVal.SCPDURL = XMLDoc.ReadString();
                                break;
                            case "controlURL":
                                RetVal.ControlURL = XMLDoc.ReadString();
                                break;
                            case "eventSubURL":
                                RetVal.EventURL = XMLDoc.ReadString();
                                break;
                            default:
                                break;
                        }
                        XMLDoc.Read();
                        XMLDoc.MoveToContent();
                    }
                }
            }
            catch (Exception ex)
            {
                throw new XMLParsingException("Invalid service XML", startLine + XMLDoc.LineNumber, XMLDoc.LinePosition, ex);
            }
            return (RetVal);
        }
开发者ID:Scannow,项目名称:SWYH,代码行数:64,代码来源:UPnPService.cs


注:本文中的OpenSource.UPnP.UPnPService.SetVersion方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。