/// <summary>
        /// Retrieve the post data elements.
        /// </summary>
        public CefPostDataElement[] GetElements()
        {
            // FIXME: CefPostDataElement.GetElements(): check CEF C API impl
            var count = Count;

            if (count == 0)
            {
                return(new CefPostDataElement[0]);
            }

            UIntPtr n_elementsCount = (UIntPtr)count;
            var     n_elements      = new cef_post_data_element_t *[count];

            fixed(cef_post_data_element_t **n_elements_ptr = n_elements)
            {
                cef_post_data_t.get_elements(_self, &n_elementsCount, n_elements_ptr);
                if ((int)n_elementsCount > count)
                {
                    throw new InvalidOperationException();
                }
            }

            count = (int)n_elementsCount;
            var elements = new CefPostDataElement[count];

            for (var i = 0; i < count; i++)
            {
                elements[i] = CefPostDataElement.FromNative(n_elements[i]);
            }

            return(elements);
        }
コード例 #2
0
 /// <summary>
 /// Create a new CefPostDataElement object.
 /// </summary>
 public static CefPostDataElement Create()
 {
     return(CefPostDataElement.FromNative(
                cef_post_data_element_t.create()
                ));
 }