當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。