PtrToStringUtf8() public static method

public static PtrToStringUtf8 ( IntPtr aPtr ) : string
aPtr System.IntPtr
return string
Ejemplo n.º 1
0
        /// <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);
        }
Ejemplo n.º 2
0
        /// <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);
        }
Ejemplo n.º 3
0
        /// <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));
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 5
0
        /// <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);
        }