本文整理汇总了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);
}
示例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);
}