本文整理汇总了C#中UPnPService.SetVersion方法的典型用法代码示例。如果您正苦于以下问题:C# UPnPService.SetVersion方法的具体用法?C# UPnPService.SetVersion怎么用?C# UPnPService.SetVersion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UPnPService
的用法示例。
在下文中一共展示了UPnPService.SetVersion方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Generate
/// <summary>
/// Generates Device side implementation from SCPD XML
/// </summary>
/// <param name="ClassName">Class Name to build</param>
/// <param name="ns">Namespace to use</param>
/// <param name="SavePath">Path to save source</param>
/// <param name="ServiceID">Service ID to use</param>
/// <param name="ServiceURN">Service URN to use</param>
/// <param name="SCPD_XML">SCPD XML String</param>
public static void Generate(String ClassName, String ns, String SavePath, String ServiceID, String ServiceURN, String SCPD_XML)
{
UPnPService s = new UPnPService(1);
DText p = new DText();
p.ATTRMARK = ":";
p[0] = ServiceURN;
string v = p[p.DCOUNT()];
s.SetVersion(v);
s.ParseSCPD(SCPD_XML);
String cl = "\r\n";
StringBuilder cs = new StringBuilder();
UPnPArgument[] Args;
UPnPArgument arg;
UPnPStateVariable[] SV = s.GetStateVariables();
cs.Append("using Intel.UPNP;" + cl + cl);
cs.Append("namespace " + ns + cl);
cs.Append("{\r\n");
cs.Append(" /// <summary>" + cl);
cs.Append(" /// Transparent DeviceSide UPnP Service" + cl);
cs.Append(" /// </summary>" + cl);
cs.Append(" public class " + ClassName + " : IUPnPService" + cl);
cs.Append(" {" + cl + cl);
cs.Append(" // Place your declarations above this line\r\n");
cs.Append("\r\n");
cs.Append(" #region AutoGenerated Code Section [Do NOT Modify, unless you know what you're doing]\r\n");
cs.Append(" //{{{{{ Begin Code Block\r\n");
cs.Append("\r\n");
cs.Append(" private _" + ClassName + " _S;\r\n");
cs.Append(" public static string URN = \"" + ServiceURN + "\";\r\n");
cs.Append(" public double VERSION\r\n");
cs.Append(" {\r\n");
cs.Append(" get\r\n");
cs.Append(" {\r\n");
cs.Append(" return(double.Parse(_S.GetUPnPService().Version));\r\n");
cs.Append(" }\r\n");
cs.Append(" }\r\n\r\n");
// Build Enumerations
Hashtable elist = BuildEnumerations(SV);
IDictionaryEnumerator el = elist.GetEnumerator();
VarData vd;
while(el.MoveNext())
{
vd = (VarData)el.Value;
cs.Append(" public enum Enum_" + vd.VariableName + "\r\n");
cs.Append(" {\r\n");
foreach(EnumStruct vs in vd.Enumerations)
{
cs.Append(" " + vs.EnumName + ",\r\n");
}
cs.Append(" }\r\n");
cs.Append(" public Enum_" + vd.VariableName + " ");
if(s.GetStateVariableObject(vd.VariableName).SendEvent==true)
{
cs.Append("Evented_");
}
cs.Append(vd.VariableName + "\r\n");
cs.Append(" {\r\n");
cs.Append(" set\r\n");
cs.Append(" {\r\n");
cs.Append(" string v = \"\";\r\n");
cs.Append(" switch(value)\r\n");
cs.Append(" {\r\n");
foreach(EnumStruct vs in vd.Enumerations)
{
cs.Append(" case Enum_" + vd.VariableName + "." + vs.EnumName + ":\r\n");
cs.Append(" v = \"" + vs.EnumValue + "\";\r\n");
cs.Append(" break;\r\n");
}
cs.Append(" }\r\n");
cs.Append(" _S.SetStateVariable(\"" + vd.VariableName + "\",v);\r\n");
cs.Append(" }\r\n");
cs.Append(" get\r\n");
cs.Append(" {\r\n");
cs.Append(" Enum_" + vd.VariableName + " RetVal = 0;\r\n");
cs.Append(" string v = (string)_S.GetStateVariable(\"" + vd.VariableName + "\");\r\n");
cs.Append(" switch(v)\r\n");
cs.Append(" {\r\n");
foreach(EnumStruct vs in vd.Enumerations)
{
cs.Append(" case \"" + vs.EnumValue + "\":\r\n");
cs.Append(" RetVal = Enum_" + vd.VariableName + "." + vs.EnumName + ";\r\n");
cs.Append(" break;\r\n");
}
cs.Append(" }\r\n");
cs.Append(" return(RetVal);\r\n");
cs.Append(" }\r\n");
//.........这里部分代码省略.........