Exemple #1
0
        /// <summary>
        /// Parse the specified |url| into its component parts. Returns false (0) if the
        /// URL is NULL or invalid.
        /// </summary>
        /// <remarks>
        /// See also the original CEF documentation in
        /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_parser_capi.h">cef/include/capi/cef_parser_capi.h</see>.
        /// </remarks>
        public static bool ParseUrl(string url, CfxUrlParts parts)
        {
            var url_pinned = new PinnedString(url);
            var __retval   = CfxApi.cfx_parse_url(url_pinned.Obj.PinnedPtr, url_pinned.Length, CfxUrlParts.Unwrap(parts));

            url_pinned.Obj.Free();
            return(0 != __retval);
        }
Exemple #2
0
        /// <summary>
        /// Creates a URL from the specified |parts|, which must contain a non-NULL spec
        /// or a non-NULL host and path (at a minimum), but not both. Returns false (0)
        /// if |parts| isn't initialized as described.
        /// </summary>
        /// <remarks>
        /// See also the original CEF documentation in
        /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_parser_capi.h">cef/include/capi/cef_parser_capi.h</see>.
        /// </remarks>
        public static bool CreateUrl(CfxUrlParts parts, ref string url)
        {
            var    url_pinned = new PinnedString(url);
            IntPtr url_str    = url_pinned.Obj.PinnedPtr;
            int    url_length = url_pinned.Length;
            var    __retval   = CfxApi.cfx_create_url(CfxUrlParts.Unwrap(parts), ref url_str, ref url_length);

            if (url_str != url_pinned.Obj.PinnedPtr)
            {
                if (url_length > 0)
                {
                    url = System.Runtime.InteropServices.Marshal.PtrToStringUni(url_str, url_length);
                    // free the native string?
                }
                else
                {
                    url = null;
                }
            }
            url_pinned.Obj.Free();
            return(0 != __retval);
        }