public static NameValueCollection ToNameValueCollection(cef_string_multimap* multimap)
        {
            var result = new NameValueCollection(StringComparer.InvariantCultureIgnoreCase);
            if (multimap == null) return result;

            var size = libcef.string_multimap_size(multimap);

            var n_key = new cef_string_t();
            var n_value = new cef_string_t();
            for (var i = 0; i < size; i++)
            {
                libcef.string_multimap_key(multimap, i, &n_key);
                libcef.string_multimap_value(multimap, i, &n_value);

                result.Add(cef_string_t.ToString(&n_key), cef_string_t.ToString(&n_value));
            }

            libcef.string_clear(&n_key);
            libcef.string_clear(&n_value);

            return result;
        }
예제 #2
0
 public static void set(cef_request_t* self, cef_string_t* url, cef_string_t* method, cef_post_data_t* postData, cef_string_multimap* headerMap)
 {
     set_delegate d;
     var p = self->_set;
     if (p == _pc) { d = _dc; }
     else
     {
         d = (set_delegate)Marshal.GetDelegateForFunctionPointer(p, typeof(set_delegate));
         if (_pc == IntPtr.Zero) { _dc = d; _pc = p; }
     }
     d(self, url, method, postData, headerMap);
 }
예제 #3
0
 public static void set_header_map(cef_request_t* self, cef_string_multimap* headerMap)
 {
     set_header_map_delegate d;
     var p = self->_set_header_map;
     if (p == _pb) { d = _db; }
     else
     {
         d = (set_header_map_delegate)Marshal.GetDelegateForFunctionPointer(p, typeof(set_header_map_delegate));
         if (_pb == IntPtr.Zero) { _db = d; _pb = p; }
     }
     d(self, headerMap);
 }
 public static extern void string_multimap_free(cef_string_multimap* map);
 public static extern int string_multimap_append(cef_string_multimap* map, cef_string_t* key, cef_string_t* value);
 public static extern void string_multimap_clear(cef_string_multimap* map);
 public static extern int string_multimap_value(cef_string_multimap* map, int index, cef_string_t* value);
 public static extern int string_multimap_key(cef_string_multimap* map, int index, cef_string_t* key);
 public static extern int string_multimap_enumerate(cef_string_multimap* map, cef_string_t* key, int value_index, cef_string_t* value);
 public static extern int string_multimap_find_count(cef_string_multimap* map, cef_string_t* key);
 public static extern int string_multimap_size(cef_string_multimap* map);