Ejemplo n.º 1
0
        /// <summary>
        /// Decodes the base64 encoded string |data|. The returned value will be NULL if
        /// the decoding fails.
        /// </summary>
        public static CefBinaryValue Base64Decode(string data)
        {
            fixed(char *data_str = data)
            {
                var n_data = new cef_string_t(data_str, data != null ? data.Length : 0);

                return(CefBinaryValue.FromNative(libcef.base64decode(&n_data)));
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Returns the DER encoded data for the certificate issuer chain.
        /// If we failed to encode a certificate in the chain it is still
        /// present in the array but is an empty string.
        /// </summary>
        public void GetDEREncodedIssuerChain(out long chainCount, out CefBinaryValue chain)
        {
            UIntPtr             n_chainCount;
            cef_binary_value_t *n_chain;

            cef_sslinfo_t.get_derencoded_issuer_chain(_self, &n_chainCount, &n_chain);

            chainCount = (long)n_chainCount;
            chain      = CefBinaryValue.FromNative(n_chain);
        }
        /// <summary>
        /// Returns the PEM encoded data for the certificate issuer chain.
        /// If we failed to encode a certificate in the chain it is still
        /// present in the array but is an empty string.
        /// </summary>
        public void GetPEMEncodedIssuerChain(out long chainCount, out CefBinaryValue chain)
        {
            UIntPtr             n_chainCount;
            cef_binary_value_t *n_chain;

            cef_x509certificate_t.get_pemencoded_issuer_chain(_self, &n_chainCount, &n_chain);

            chainCount = (long)n_chainCount;
            chain      = CefBinaryValue.FromNative(n_chain);
        }
        /// <summary>
        /// Returns the value at the specified key as type binary. The returned
        /// value will reference existing data.
        /// </summary>
        public CefBinaryValue GetBinary(string key)
        {
            fixed(char *key_str = key)
            {
                var n_key    = new cef_string_t(key_str, key != null ? key.Length : 0);
                var n_result = cef_dictionary_value_t.get_binary(_self, &n_key);

                return(CefBinaryValue.FromNative(n_result));
            }
        }
        /// <summary>
        /// Sets the value at the specified key as type binary. Returns true if the
        /// value was set successfully. If |value| is currently owned by another object
        /// then the value will be copied and the |value| reference will not change.
        /// Otherwise, ownership will be transferred to this object and the |value|
        /// reference will be invalidated.
        /// </summary>
        public bool SetBinary(string key, CefBinaryValue value)
        {
            //FIXME: what means reference will be invalidated ?
            if (value == null)
                throw new ArgumentNullException("value");

            fixed(char *key_str = key)
            {
                var n_key = new cef_string_t(key_str, key != null ? key.Length : 0);

                return(cef_dictionary_value_t.set_binary(_self, &n_key, value.ToNative()) != 0);
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Creates a new object that is not owned by any other object. The specified
        /// |data| will be copied.
        /// </summary>
        public static CefBinaryValue Create(byte[] data)
        {
            if (data == null)
            {
                throw new ArgumentNullException("data");

                fixed(byte *data_ptr = data)
                {
                    var value = cef_binary_value_t.create(data_ptr, (UIntPtr)data.LongLength);

                    return(CefBinaryValue.FromNative(value));
                }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Returns the bitmap representation that most closely matches |scale_factor|.
        /// Only 32-bit RGBA/BGRA formats are supported. |color_type| and |alpha_type|
        /// values specify the desired output pixel format. |pixel_width| and
        /// |pixel_height| are the output representation size in pixel coordinates.
        /// Returns a CefBinaryValue containing the pixel data on success or NULL on
        /// failure.
        /// </summary>
        public CefBinaryValue GetAsBitmap(float scaleFactor, CefColorType colorType, CefAlphaType alphaType, out int pixelWidth, out int pixelHeight)
        {
            int n_pixelWidth;
            int n_pixelHeight;
            var n_result = cef_image_t.get_as_bitmap(_self, scaleFactor, colorType, alphaType, &n_pixelWidth, &n_pixelHeight);

            if (n_result != null)
            {
                pixelWidth  = n_pixelWidth;
                pixelHeight = n_pixelHeight;
                return(CefBinaryValue.FromNative(n_result));
            }
            else
            {
                pixelWidth  = 0;
                pixelHeight = 0;
                return(null);
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Returns the JPEG representation that most closely matches |scale_factor|.
        /// |quality| determines the compression level with 0 == lowest and 100 ==
        /// highest. The JPEG format does not support alpha transparency and the alpha
        /// channel, if any, will be discarded. |pixel_width| and |pixel_height| are
        /// the output representation size in pixel coordinates. Returns a
        /// CefBinaryValue containing the JPEG image data on success or NULL on
        /// failure.
        /// </summary>
        public CefBinaryValue GetAsJpeg(float scaleFactor, int quality, out int pixelWidth, out int pixelHeight)
        {
            int n_pixelWidth;
            int n_pixelHeight;
            var n_result = cef_image_t.get_as_jpeg(_self, scaleFactor, quality, &n_pixelWidth, &n_pixelHeight);

            if (n_result != null)
            {
                pixelWidth  = n_pixelWidth;
                pixelHeight = n_pixelHeight;
                return(CefBinaryValue.FromNative(n_result));
            }
            else
            {
                pixelWidth  = 0;
                pixelHeight = 0;
                return(null);
            }
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Returns the PNG representation that most closely matches |scale_factor|. If
        /// |with_transparency| is true any alpha transparency in the image will be
        /// represented in the resulting PNG data. |pixel_width| and |pixel_height| are
        /// the output representation size in pixel coordinates. Returns a
        /// CefBinaryValue containing the PNG image data on success or NULL on failure.
        /// </summary>
        public CefBinaryValue GetAsPng(float scaleFactor, bool withTransparency, out int pixelWidth, out int pixelHeight)
        {
            int n_pixelWidth;
            int n_pixelHeight;
            var n_result = cef_image_t.get_as_png(_self, scaleFactor, withTransparency ? 1 : 0, &n_pixelWidth, &n_pixelHeight);

            if (n_result != null)
            {
                pixelWidth  = n_pixelWidth;
                pixelHeight = n_pixelHeight;
                return(CefBinaryValue.FromNative(n_result));
            }
            else
            {
                pixelWidth  = 0;
                pixelHeight = 0;
                return(null);
            }
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Returns a copy of this object. The data in this object will also be copied.
        /// </summary>
        public CefBinaryValue Copy()
        {
            var value = cef_binary_value_t.copy(_self);

            return(CefBinaryValue.FromNative(value));
        }
Ejemplo n.º 11
0
 /// <summary>
 /// Returns true if this object and |that| object have an equivalent underlying
 /// value but are not necessarily the same object.
 /// </summary>
 public bool IsEqual(CefBinaryValue that)
 {
     return(cef_binary_value_t.is_equal(_self, that.ToNative()) != 0);
 }
Ejemplo n.º 12
0
 /// <summary>
 /// Returns true if this object and |that| object have the same underlying
 /// data.
 /// </summary>
 public bool IsSame(CefBinaryValue that)
 {
     return(cef_binary_value_t.is_same(_self, that.ToNative()) != 0);
 }
        /// <summary>
        /// Returns the PEM encoded data for the X.509 certificate.
        /// </summary>
        public CefBinaryValue GetPemEncoded()
        {
            var n_result = cef_x509certificate_t.get_pemencoded(_self);

            return(CefBinaryValue.FromNative(n_result));
        }
 /// <summary>
 /// Sets the underlying value as type binary. Returns true if the value was set
 /// successfully. This object keeps a reference to |value| and ownership of the
 /// underlying data remains unchanged.
 /// </summary>
 public bool SetBinary(CefBinaryValue value)
 {
     return(cef_value_t.set_binary(_self, value.ToNative()) != 0);
 }
 /// <summary>
 /// Returns the underlying value as type binary. The returned reference may
 /// become invalid if the value is owned by another object or if ownership is
 /// transferred to another object in the future. To maintain a reference to
 /// the value after assigning ownership to a dictionary or list pass this
 /// object to the SetValue() method instead of passing the returned reference
 /// to SetBinary().
 /// </summary>
 public CefBinaryValue GetBinary()
 {
     return(CefBinaryValue.FromNative(
                cef_value_t.get_binary(_self)
                ));
 }
Ejemplo n.º 16
0
 /// <summary>
 /// Sets the value at the specified index as type binary. Returns true if the
 /// value was set successfully. If |value| is currently owned by another object
 /// then the value will be copied and the |value| reference will not change.
 /// Otherwise, ownership will be transferred to this object and the |value|
 /// reference will be invalidated.
 /// </summary>
 public bool SetBinary(int index, CefBinaryValue value)
 {
     return(cef_list_value_t.set_binary(_self, checked ((UIntPtr)index), value.ToNative()) != 0);
 }
Ejemplo n.º 17
0
 /// <summary>
 /// Returns the value at the specified index as type binary. The returned
 /// value will reference existing data.
 /// </summary>
 public CefBinaryValue GetBinary(int index)
 {
     return(CefBinaryValue.FromNativeOrNull(
                cef_list_value_t.get_binary(_self, checked ((UIntPtr)index))
                ));
 }
Ejemplo n.º 18
0
 /// <summary>
 /// Sets the value at the specified index as type binary. Returns true if the
 /// value was set successfully. After calling this method the |value| object
 /// will no longer be valid. If |value| is currently owned by another object
 /// then the value will be copied and the |value| reference will not change.
 /// Otherwise, ownership will be transferred to this object and the |value|
 /// reference will be invalidated.
 /// </summary>
 public bool SetBinary(int index, CefBinaryValue value)
 {
     return cef_list_value_t.set_binary(_self, index, value.ToNative()) != 0;
 }
Ejemplo n.º 19
0
 /// <summary>
 /// Returns a CefBinaryValue containing the decompressed contents of the
 /// specified scale independent |resource_id| or NULL if not found. Include
 /// cef_pack_resources.h for a listing of valid resource ID values.
 /// </summary>
 public CefBinaryValue GetDataResource(int resource_id)
 {
     return(CefBinaryValue.FromNativeOrNull(
                cef_resource_bundle_t.get_data_resource(_self, resource_id)
                ));
 }
        /// <summary>
        /// Returns the DER encoded serial number for the X.509 certificate. The value
        /// possibly includes a leading 00 byte.
        /// </summary>
        public CefBinaryValue GetSerialNumber()
        {
            var n_result = cef_x509certificate_t.get_serial_number(_self);

            return(CefBinaryValue.FromNative(n_result));
        }
Ejemplo n.º 21
0
        /// <summary>
        /// Sets the value at the specified key as type binary. Returns true if the
        /// value was set successfully. If |value| is currently owned by another object
        /// then the value will be copied and the |value| reference will not change.
        /// Otherwise, ownership will be transferred to this object and the |value|
        /// reference will be invalidated.
        /// </summary>
        public bool SetBinary(string key, CefBinaryValue value)
        {
            //FIXME: what means reference will be invalidated ?
            if (value == null) throw new ArgumentNullException("value");

            fixed (char* key_str = key)
            {
                var n_key = new cef_string_t(key_str, key != null ? key.Length : 0);
                return cef_dictionary_value_t.set_binary(_self, &n_key, value.ToNative()) != 0;
            }
        }
Ejemplo n.º 22
0
 /// <summary>
 /// Returns a CefBinaryValue containing the decompressed contents of the
 /// specified |resource_id| nearest the scale factor |scale_factor| or NULL if
 /// not found. Use a |scale_factor| value of SCALE_FACTOR_NONE for scale
 /// independent resources or call GetDataResource instead.Include
 /// cef_pack_resources.h for a listing of valid resource ID values.
 /// </summary>
 public CefBinaryValue GetDataResourceForScale(int resource_id, CefScaleFactor scale_factor)
 {
     return(CefBinaryValue.FromNativeOrNull(
                cef_resource_bundle_t.get_data_resource_for_scale(_self, resource_id, scale_factor)
                ));
 }
Ejemplo n.º 23
0
 /// <summary>
 /// Sets the value at the specified index as type binary. Returns true if the
 /// value was set successfully. If |value| is currently owned by another object
 /// then the value will be copied and the |value| reference will not change.
 /// Otherwise, ownership will be transferred to this object and the |value|
 /// reference will be invalidated.
 /// </summary>
 public bool SetBinary(int index, CefBinaryValue value)
 {
     return(cef_list_value_t.set_binary(_self, index, value.ToNative()) != 0);
 }