當前位置: 首頁>>代碼示例>>C#>>正文


C# UPnPStateVariable.GetNetType方法代碼示例

本文整理匯總了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);
     }
 }
開發者ID:evolution124,項目名稱:Developer-Tools-for-UPnP-Technologies,代碼行數:16,代碼來源:EmbeddedCGenerator.cs

示例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());
        }
開發者ID:evolution124,項目名稱:Developer-Tools-for-UPnP-Technologies,代碼行數:90,代碼來源:EmbeddedCGenerator.cs

示例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);
     }
 }
開發者ID:evolution124,項目名稱:Developer-Tools-for-UPnP-Technologies,代碼行數:16,代碼來源:EmbeddedCGenerator.cs


注:本文中的OpenSource.UPnP.UPnPStateVariable.GetNetType方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。