PtrToStringUtf8() public static method

public static PtrToStringUtf8 ( IntPtr aPtr ) : string
aPtr System.IntPtr
return string
コード例 #1
0
ファイル: OhNet.cs プロジェクト: broonie/ohNet
        /// <summary>
        /// Get the full name for a given network interface.
        /// </summary>
        /// <returns>String in the form a.b.c.d (name).</returns>
        public string FullName()
        {
            IntPtr cStr = OhNetNetworkAdapterFullName(iHandle);
            string name = InteropUtils.PtrToStringUtf8(cStr);

            Library.Free(cStr);
            return(name);
        }
コード例 #2
0
ファイル: OhNet.cs プロジェクト: broonie/ohNet
        /// <summary>
        /// Get the name for a given network interface.
        /// </summary>
        /// <returns>String containing name of the adapter.</returns>
        public string Name()
        {
            IntPtr cStr = OhNetNetworkAdapterName(iHandle);
            string name = InteropUtils.PtrToStringUtf8(cStr);

            // Library.Free(cStr) not necessary because a copy is not allocated by the underlying NetworkAdapter object
            return(name);
        }
コード例 #3
0
ファイル: Service.cs プロジェクト: fuzzy01/ohNet
        /// <summary>
        /// Query the name of the action
        /// </summary>
        /// <returns>Action name</returns>
        public unsafe String Name()
        {
            IntPtr str;
            uint   len;

            ServiceActionGetName(iHandle, &str, &len);
            return(InteropUtils.PtrToStringUtf8(str, len));
        }
コード例 #4
0
        /// <summary>
        /// Query the value of the property
        /// </summary>
        /// <returns>String property value</returns>
        public unsafe String Value()
        {
            IntPtr ptr;
            uint   len;

            ServicePropertyGetValueString(iHandle, &ptr, &len);
            String str = InteropUtils.PtrToStringUtf8(ptr, len);

            OhNetFree(ptr);
            return(str);
        }
コード例 #5
0
ファイル: Service.cs プロジェクト: fuzzy01/ohNet
        /// <summary>
        /// Query the value of the property
        /// </summary>
        /// <returns>String property value</returns>
        public unsafe String Value()
        {
            IntPtr ptr;
            uint   len;

            if (ServicePropertyGetValueString(iHandle, &ptr, &len) == -1)
            {
                throw new PropertyError();
            }
            String str = InteropUtils.PtrToStringUtf8(ptr, len);

            OhNetFree(ptr);
            return(str);
        }