PtrToStringUtf8() public static method

public static PtrToStringUtf8 ( IntPtr aPtr ) : string
aPtr System.IntPtr
return string
Example #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);
        }
Example #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);
        }
Example #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));
        }
Example #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);
        }
Example #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);
        }