/// <summary>
        /// Sets the value at the specified key. Returns true if the value was set
        /// successfully. If |value| represents simple data then the underlying data
        /// will be copied and modifications to |value| will not modify this object. If
        /// |value| represents complex data (binary, dictionary or list) then the
        /// underlying data will be referenced and modifications to |value| will modify
        /// this object.
        /// </summary>
        public bool SetValue(string key, CefValue value)
        {
            fixed(char *key_str = key)
            {
                var n_key   = new cef_string_t(key_str, key != null ? key.Length : 0);
                var n_value = value.ToNative();

                return(cef_dictionary_value_t.set_value(_self, &n_key, n_value) != 0);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Generates a JSON string from the specified root |node| which should be a
        /// dictionary or list value. Returns an empty string on failure. This method
        /// requires exclusive access to |node| including any underlying data.
        /// </summary>
        public static string WriteJson(CefValue value, CefJsonWriterOptions options)
        {
            if (value == null)
            {
                throw new ArgumentNullException("value");
            }
            var n_result = libcef.write_json(value.ToNative(), options);

            return(cef_string_userfree.ToString(n_result));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Set the |value| associated with preference |name|. Returns true if the
        /// value is set successfully and false otherwise. If |value| is NULL the
        /// preference will be restored to its default value. If setting the preference
        /// fails then |error| will be populated with a detailed description of the
        /// problem. This method must be called on the browser process UI thread.
        /// </summary>
        public bool SetPreference(string name, CefValue value, out string error)
        {
            fixed(char *name_str = name)
            {
                var n_name  = new cef_string_t(name_str, name != null ? name.Length : 0);
                var n_value = value != null?value.ToNative() : null;

                cef_string_t n_error;

                var n_result = cef_request_context_t.set_preference(_self, &n_name, n_value, &n_error);

                error = cef_string_t.ToString(&n_error);
                return(n_result != 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(CefValue that)
 {
     return(cef_value_t.is_equal(_self, that.ToNative()) != 0);
 }
 /// <summary>
 /// Returns true if this object and |that| object have the same underlying
 /// data. If true modifications to this object will also affect |that| object
 /// and vice-versa.
 /// </summary>
 public bool IsSame(CefValue that)
 {
     return(cef_value_t.is_same(_self, that.ToNative()) != 0);
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Sets the value at the specified index. Returns true if the value was set
 /// successfully. If |value| represents simple data then the underlying data
 /// will be copied and modifications to |value| will not modify this object. If
 /// |value| represents complex data (binary, dictionary or list) then the
 /// underlying data will be referenced and modifications to |value| will modify
 /// this object.
 /// </summary>
 public bool SetValue(int index, CefValue value)
 {
     return(cef_list_value_t.set_value(_self, checked ((UIntPtr)index), value.ToNative()) != 0);
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Sets the value at the specified index. Returns true if the value was set
 /// successfully. If |value| represents simple data then the underlying data
 /// will be copied and modifications to |value| will not modify this object. If
 /// |value| represents complex data (binary, dictionary or list) then the
 /// underlying data will be referenced and modifications to |value| will modify
 /// this object.
 /// </summary>
 public bool SetValue(int index, CefValue value)
 {
     return(cef_list_value_t.set_value(_self, index, value.ToNative()) != 0);
 }