本文整理汇总了C#中OpenSource.UPnP.UPnPStateVariable.GetNetType方法的典型用法代码示例。如果您正苦于以下问题:C# UPnPStateVariable.GetNetType方法的具体用法?C# UPnPStateVariable.GetNetType怎么用?C# UPnPStateVariable.GetNetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenSource.UPnP.UPnPStateVariable
的用法示例。
在下文中一共展示了UPnPStateVariable.GetNetType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ToCTypeFromStateVar_Dispatch
public static string ToCTypeFromStateVar_Dispatch(UPnPStateVariable V)
{
if (V.ComplexType == null)
{
string RetVal = V.Name;
if (Static_ToCType(V.GetNetType().ToString()) == "unsigned char*")
{
RetVal += ", " + V.Name + "Length";
}
return (RetVal);
}
else
{
return (V.Name);
}
}
示例2: ToCTypeFromStateVar_Serialize
public static string ToCTypeFromStateVar_Serialize(string InVar, string InVarLength, string OK, string LibPrefix, UPnPStateVariable A)
{
StringBuilder cs = new StringBuilder();
if (OK != "")
{
OK = OK + " = ";
}
switch (A.GetNetType().FullName)
{
case "System.DateTime":
cs.Append(" " + A.Name + " = " + LibPrefix + "Time_Parse(" + InVar + ");" + cl);
break;
case "System.SByte":
case "System.Int16":
case "System.Int32":
cs.Append(" " + OK + LibPrefix + "GetLong(" + InVar + ", " + InVarLength + ", (long*)&" + A.Name + ");" + cl);
break;
case "System.Byte":
case "System.UInt16":
case "System.UInt32":
cs.Append(" " + OK + LibPrefix + "GetULong(" + InVar + ", " + InVarLength + ", (unsigned long*)&" + A.Name + ");" + cl);
break;
case "System.Boolean":
if (OK != "")
{
cs.Append(OK + "0;" + cl);
}
cs.Append(" if (" + InVarLength + "==4)" + cl);
cs.Append(" {" + cl);
cs.Append(" if (strncasecmp(" + InVar + ", \"true\", 4)==0)" + cl);
cs.Append(" {" + cl);
if (OK != "")
{
cs.Append(OK + "1;" + cl);
}
cs.Append(" " + A.Name + " = 1;" + cl);
cs.Append(" }" + cl);
cs.Append(" }" + cl);
cs.Append(" if (" + InVarLength + " == 5)" + cl);
cs.Append(" {" + cl);
cs.Append(" if (strncasecmp(" + InVar + ", \"false\", 5)==0)" + cl);
cs.Append(" {" + cl);
if (OK != "")
{
cs.Append(OK + "1;" + cl);
}
cs.Append(" " + A.Name + " = 0;" + cl);
cs.Append(" }" + cl);
cs.Append(" }" + cl);
cs.Append(" if (" + InVarLength + " == 1)" + cl);
cs.Append(" {" + cl);
cs.Append(" if (memcmp(" + InVar + ", \"0\", 1) == 0)" + cl);
cs.Append(" {" + cl);
if (OK != "")
{
cs.Append(OK + "1;" + cl);
}
cs.Append(" " + A.Name + " = 0;" + cl);
cs.Append(" }" + cl);
cs.Append(" if (memcmp(" + InVar + ", \"1\", 1) == 0)" + cl);
cs.Append(" {" + cl);
if (OK != "")
{
cs.Append(OK + "1;" + cl);
}
cs.Append(" " + A.Name + " = 1;" + cl);
cs.Append(" }" + cl);
cs.Append(" }" + cl);
break;
case "System.Byte[]":
cs.Append(A.Name + "Length = " + LibPrefix + "Base64Decode(" + InVar + ", " + InVarLength + ", &" + A.Name + ");" + cl);
break;
case "System.Uri":
case "System.String":
default:
if (A.ComplexType == null)
{
cs.Append(" " + A.Name + "Length = " + LibPrefix + "InPlaceXmlUnEscape(" + InVar + ");" + cl);
cs.Append(" " + A.Name + " = " + InVar + ";" + cl);
}
else
{
cs.Append(cl + "//ToDo: DeviceBuilder needs to be modified to include a ComplexTypeParsre here!");
}
break;
}
return (cs.ToString());
}
示例3: ToCTypeFromStateVar
public static string ToCTypeFromStateVar(UPnPStateVariable V)
{
if (V.ComplexType == null)
{
string RetVal = Static_ToCType(V.GetNetType().ToString()) + " " + V.Name;
if (Static_ToCType(V.GetNetType().ToString()) == "unsigned char*")
{
RetVal += ", int " + V.Name + "Length";
}
return (RetVal);
}
else
{
return ("struct " + V.ComplexType.Name_LOCAL + "* " + V.Name);
}
}