Esempio n. 1
0
        /// <summary>
        /// Set all values at one time.
        /// </summary>
        /// <remarks>
        /// See also the original CEF documentation in
        /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_request_capi.h">cef/include/capi/cef_request_capi.h</see>.
        /// </remarks>
        public void Set(string url, string method, CfxPostData postData, System.Collections.Generic.List <string[]> headerMap)
        {
            var url_pinned    = new PinnedString(url);
            var method_pinned = new PinnedString(method);

            PinnedString[] headerMap_handles;
            var            headerMap_unwrapped = StringFunctions.UnwrapCfxStringMultimap(headerMap, out headerMap_handles);

            CfxApi.Request.cfx_request_set(NativePtr, url_pinned.Obj.PinnedPtr, url_pinned.Length, method_pinned.Obj.PinnedPtr, method_pinned.Length, CfxPostData.Unwrap(postData), headerMap_unwrapped);
            url_pinned.Obj.Free();
            method_pinned.Obj.Free();
            StringFunctions.FreePinnedStrings(headerMap_handles);
            StringFunctions.CfxStringMultimapCopyToManaged(headerMap_unwrapped, headerMap);
            CfxApi.Runtime.cfx_string_multimap_free(headerMap_unwrapped);
        }
Esempio n. 2
0
 internal static CfxPostData Wrap(IntPtr nativePtr)
 {
     if (nativePtr == IntPtr.Zero)
     {
         return(null);
     }
     lock (weakCache) {
         var wrapper = (CfxPostData)weakCache.Get(nativePtr);
         if (wrapper == null)
         {
             wrapper = new CfxPostData(nativePtr);
             weakCache.Add(wrapper);
         }
         else
         {
             CfxApi.cfx_release(nativePtr);
         }
         return(wrapper);
     }
 }
Esempio n. 3
0
 /// <summary>
 /// Create a new CfxPostData object.
 /// </summary>
 /// <remarks>
 /// See also the original CEF documentation in
 /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_request_capi.h">cef/include/capi/cef_request_capi.h</see>.
 /// </remarks>
 public static CfxPostData Create()
 {
     return(CfxPostData.Wrap(CfxApi.cfx_post_data_create()));
 }